aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Manuel Alejandro de Brito Fontes <aledbf@gmail.com> 2018-09-29 19:47:07 -0300
committerGravatar Miek Gieben <miek@miek.nl> 2018-09-29 23:47:07 +0100
commit0e8977761d441c478a53c4b2a7299527ea1f2b47 (patch)
treea5f7fc982b94b418755c8fb70a5c0c1b7d00256d
parent8f8b81f56b66d49bc94503cc56441f0504654587 (diff)
downloadcoredns-0e8977761d441c478a53c4b2a7299527ea1f2b47.tar.gz
coredns-0e8977761d441c478a53c4b2a7299527ea1f2b47.tar.zst
coredns-0e8977761d441c478a53c4b2a7299527ea1f2b47.zip
Dep helper (#2151)
* Add dep task to update go dependencies * Update go dependencies
-rw-r--r--CONTRIBUTING.md2
-rw-r--r--Gopkg.lock184
-rw-r--r--Makefile7
-rw-r--r--vendor/github.com/DataDog/dd-trace-go/opentracing/config_test.go58
-rw-r--r--vendor/github.com/DataDog/dd-trace-go/opentracing/context_test.go29
-rw-r--r--vendor/github.com/DataDog/dd-trace-go/opentracing/example_context_test.go30
-rw-r--r--vendor/github.com/DataDog/dd-trace-go/opentracing/example_test.go30
-rw-r--r--vendor/github.com/DataDog/dd-trace-go/opentracing/example_tracing_test.go24
-rw-r--r--vendor/github.com/DataDog/dd-trace-go/opentracing/propagators_test.go81
-rw-r--r--vendor/github.com/DataDog/dd-trace-go/opentracing/span_test.go129
-rw-r--r--vendor/github.com/DataDog/dd-trace-go/opentracing/tracer_test.go131
-rw-r--r--vendor/github.com/DataDog/dd-trace-go/tracer/buffer_test.go105
-rw-r--r--vendor/github.com/DataDog/dd-trace-go/tracer/channels_test.go117
-rw-r--r--vendor/github.com/DataDog/dd-trace-go/tracer/context_test.go69
-rw-r--r--vendor/github.com/DataDog/dd-trace-go/tracer/encoder_test.go114
-rw-r--r--vendor/github.com/DataDog/dd-trace-go/tracer/errors_test.go98
-rw-r--r--vendor/github.com/DataDog/dd-trace-go/tracer/example_context_test.go73
-rw-r--r--vendor/github.com/DataDog/dd-trace-go/tracer/example_test.go23
-rw-r--r--vendor/github.com/DataDog/dd-trace-go/tracer/span_test.go289
-rw-r--r--vendor/github.com/DataDog/dd-trace-go/tracer/time_windows_test.go30
-rw-r--r--vendor/github.com/DataDog/dd-trace-go/tracer/tracer_test.go648
-rw-r--r--vendor/github.com/DataDog/dd-trace-go/tracer/transport_test.go202
-rw-r--r--vendor/github.com/Shopify/sarama/acl_create_request_test.go34
-rw-r--r--vendor/github.com/Shopify/sarama/acl_create_response_test.go41
-rw-r--r--vendor/github.com/Shopify/sarama/acl_delete_request_test.go69
-rw-r--r--vendor/github.com/Shopify/sarama/acl_delete_response_test.go38
-rw-r--r--vendor/github.com/Shopify/sarama/acl_describe_request_test.go35
-rw-r--r--vendor/github.com/Shopify/sarama/acl_describe_response_test.go45
-rw-r--r--vendor/github.com/Shopify/sarama/add_offsets_to_txn_request_test.go23
-rw-r--r--vendor/github.com/Shopify/sarama/add_offsets_to_txn_response_test.go22
-rw-r--r--vendor/github.com/Shopify/sarama/add_partitions_to_txn_request_test.go27
-rw-r--r--vendor/github.com/Shopify/sarama/add_partitions_to_txn_response_test.go31
-rw-r--r--vendor/github.com/Shopify/sarama/alter_configs_request_test.go86
-rw-r--r--vendor/github.com/Shopify/sarama/alter_configs_response_test.go45
-rw-r--r--vendor/github.com/Shopify/sarama/api_versions_request_test.go14
-rw-r--r--vendor/github.com/Shopify/sarama/api_versions_response_test.go32
-rw-r--r--vendor/github.com/Shopify/sarama/async_producer_test.go845
-rw-r--r--vendor/github.com/Shopify/sarama/broker_test.go358
-rw-r--r--vendor/github.com/Shopify/sarama/client_test.go660
-rw-r--r--vendor/github.com/Shopify/sarama/client_tls_test.go206
-rw-r--r--vendor/github.com/Shopify/sarama/config_test.go233
-rw-r--r--vendor/github.com/Shopify/sarama/consumer_group_members_test.go73
-rw-r--r--vendor/github.com/Shopify/sarama/consumer_metadata_request_test.go23
-rw-r--r--vendor/github.com/Shopify/sarama/consumer_metadata_response_test.go44
-rw-r--r--vendor/github.com/Shopify/sarama/consumer_test.go985
-rw-r--r--vendor/github.com/Shopify/sarama/create_partitions_request_test.go50
-rw-r--r--vendor/github.com/Shopify/sarama/create_partitions_response_test.go52
-rw-r--r--vendor/github.com/Shopify/sarama/create_topics_request_test.go50
-rw-r--r--vendor/github.com/Shopify/sarama/create_topics_response_test.go52
-rw-r--r--vendor/github.com/Shopify/sarama/delete_groups_request_test.go34
-rw-r--r--vendor/github.com/Shopify/sarama/delete_groups_response_test.go57
-rw-r--r--vendor/github.com/Shopify/sarama/delete_records_request_test.go36
-rw-r--r--vendor/github.com/Shopify/sarama/delete_records_response_test.go39
-rw-r--r--vendor/github.com/Shopify/sarama/delete_topics_request_test.go33
-rw-r--r--vendor/github.com/Shopify/sarama/delete_topics_response_test.go36
-rw-r--r--vendor/github.com/Shopify/sarama/describe_configs_request_test.go90
-rw-r--r--vendor/github.com/Shopify/sarama/describe_configs_response_test.go60
-rw-r--r--vendor/github.com/Shopify/sarama/describe_groups_request_test.go34
-rw-r--r--vendor/github.com/Shopify/sarama/describe_groups_response_test.go91
-rw-r--r--vendor/github.com/Shopify/sarama/end_txn_request_test.go23
-rw-r--r--vendor/github.com/Shopify/sarama/end_txn_response_test.go22
-rw-r--r--vendor/github.com/Shopify/sarama/fetch_request_test.go48
-rw-r--r--vendor/github.com/Shopify/sarama/fetch_response_test.go248
-rw-r--r--vendor/github.com/Shopify/sarama/find_coordinator_request_test.go33
-rw-r--r--vendor/github.com/Shopify/sarama/find_coordinator_response_test.go83
-rw-r--r--vendor/github.com/Shopify/sarama/functional_client_test.go90
-rw-r--r--vendor/github.com/Shopify/sarama/functional_consumer_test.go226
-rw-r--r--vendor/github.com/Shopify/sarama/functional_offset_manager_test.go47
-rw-r--r--vendor/github.com/Shopify/sarama/functional_producer_test.go323
-rw-r--r--vendor/github.com/Shopify/sarama/functional_test.go148
-rw-r--r--vendor/github.com/Shopify/sarama/heartbeat_request_test.go21
-rw-r--r--vendor/github.com/Shopify/sarama/heartbeat_response_test.go18
-rw-r--r--vendor/github.com/Shopify/sarama/init_producer_id_request_test.go31
-rw-r--r--vendor/github.com/Shopify/sarama/init_producer_id_response_test.go37
-rw-r--r--vendor/github.com/Shopify/sarama/join_group_request_test.go83
-rw-r--r--vendor/github.com/Shopify/sarama/join_group_response_test.go172
-rw-r--r--vendor/github.com/Shopify/sarama/leave_group_request_test.go19
-rw-r--r--vendor/github.com/Shopify/sarama/leave_group_response_test.go24
-rw-r--r--vendor/github.com/Shopify/sarama/list_groups_request_test.go7
-rw-r--r--vendor/github.com/Shopify/sarama/list_groups_response_test.go58
-rw-r--r--vendor/github.com/Shopify/sarama/message_test.go196
-rw-r--r--vendor/github.com/Shopify/sarama/metadata_request_test.go76
-rw-r--r--vendor/github.com/Shopify/sarama/metadata_response_test.go290
-rw-r--r--vendor/github.com/Shopify/sarama/metrics_test.go172
-rw-r--r--vendor/github.com/Shopify/sarama/offset_commit_request_test.go90
-rw-r--r--vendor/github.com/Shopify/sarama/offset_commit_response_test.go24
-rw-r--r--vendor/github.com/Shopify/sarama/offset_fetch_request_test.go31
-rw-r--r--vendor/github.com/Shopify/sarama/offset_fetch_response_test.go22
-rw-r--r--vendor/github.com/Shopify/sarama/offset_manager_test.go433
-rw-r--r--vendor/github.com/Shopify/sarama/offset_request_test.go43
-rw-r--r--vendor/github.com/Shopify/sarama/offset_response_test.go111
-rw-r--r--vendor/github.com/Shopify/sarama/partitioner_test.go265
-rw-r--r--vendor/github.com/Shopify/sarama/produce_request_test.go106
-rw-r--r--vendor/github.com/Shopify/sarama/produce_response_test.go128
-rw-r--r--vendor/github.com/Shopify/sarama/produce_set_test.go255
-rw-r--r--vendor/github.com/Shopify/sarama/record_test.go292
-rw-r--r--vendor/github.com/Shopify/sarama/records_test.go143
-rw-r--r--vendor/github.com/Shopify/sarama/request_test.go105
-rw-r--r--vendor/github.com/Shopify/sarama/response_header_test.go21
-rw-r--r--vendor/github.com/Shopify/sarama/sasl_handshake_request_test.go17
-rw-r--r--vendor/github.com/Shopify/sarama/sasl_handshake_response_test.go24
-rw-r--r--vendor/github.com/Shopify/sarama/sync_group_request_test.go38
-rw-r--r--vendor/github.com/Shopify/sarama/sync_group_response_test.go40
-rw-r--r--vendor/github.com/Shopify/sarama/sync_producer_test.go199
-rw-r--r--vendor/github.com/Shopify/sarama/txn_offset_commit_request_test.go35
-rw-r--r--vendor/github.com/Shopify/sarama/txn_offset_commit_response_test.go31
-rw-r--r--vendor/github.com/Shopify/sarama/utils_test.go41
-rw-r--r--vendor/github.com/apache/thrift/lib/go/thrift/application_exception_test.go41
-rw-r--r--vendor/github.com/apache/thrift/lib/go/thrift/binary_protocol_test.go28
-rw-r--r--vendor/github.com/apache/thrift/lib/go/thrift/buffered_transport_test.go29
-rw-r--r--vendor/github.com/apache/thrift/lib/go/thrift/common_test.go30
-rw-r--r--vendor/github.com/apache/thrift/lib/go/thrift/compact_protocol_test.go53
-rw-r--r--vendor/github.com/apache/thrift/lib/go/thrift/exception_test.go69
-rw-r--r--vendor/github.com/apache/thrift/lib/go/thrift/framed_transport_test.go29
-rw-r--r--vendor/github.com/apache/thrift/lib/go/thrift/http_client_test.go106
-rw-r--r--vendor/github.com/apache/thrift/lib/go/thrift/iostream_transport_test.go52
-rw-r--r--vendor/github.com/apache/thrift/lib/go/thrift/json_protocol_test.go650
-rw-r--r--vendor/github.com/apache/thrift/lib/go/thrift/lowlevel_benchmarks_test.go540
-rw-r--r--vendor/github.com/apache/thrift/lib/go/thrift/memory_buffer_test.go29
-rw-r--r--vendor/github.com/apache/thrift/lib/go/thrift/protocol_test.go516
-rw-r--r--vendor/github.com/apache/thrift/lib/go/thrift/rich_transport_test.go89
-rw-r--r--vendor/github.com/apache/thrift/lib/go/thrift/serializer_test.go170
-rw-r--r--vendor/github.com/apache/thrift/lib/go/thrift/serializer_types_test.go633
-rw-r--r--vendor/github.com/apache/thrift/lib/go/thrift/server_socket_test.go60
-rw-r--r--vendor/github.com/apache/thrift/lib/go/thrift/server_test.go28
-rw-r--r--vendor/github.com/apache/thrift/lib/go/thrift/simple_json_protocol_test.go716
-rw-r--r--vendor/github.com/apache/thrift/lib/go/thrift/simple_server_test.go156
-rw-r--r--vendor/github.com/apache/thrift/lib/go/thrift/transport_exception_test.go60
-rw-r--r--vendor/github.com/apache/thrift/lib/go/thrift/transport_test.go177
-rw-r--r--vendor/github.com/apache/thrift/lib/go/thrift/zlib_transport_test.go62
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy_test.go353
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal_test.go30
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value_test.go182
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/client/client_test.go78
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer_test.go189
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/client/logger_test.go222
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/config_test.go86
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/context_test.go37
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/convert_types_test.go641
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_1_8_test.go64
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_test.go398
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator_test.go286
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/corehandlers/user_agent_test.go40
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider_test.go154
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials_bench_test.go90
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials_test.go73
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider_test.go159
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/credentials/endpointcreds/provider_test.go111
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider_test.go70
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go136
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider_test.go34
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider_test.go150
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/csm/enable_test.go74
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/csm/example_test.go40
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/csm/metric_chan_test.go72
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/csm/reporter_test.go249
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults_test.go116
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api_test.go289
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service_test.go120
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/endpoints/decode_test.go117
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints_test.go342
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/endpoints/example_test.go66
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model_test.go541
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other_test.go9
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_test.go11
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/request/handlers_test.go266
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/request/http_request_copy_test.go34
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/request/http_request_retry_test.go37
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader_test.go140
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/request/request_1_5_test.go11
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/request/request_1_6_test.go51
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/request/request_1_7_test.go24
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8_test.go85
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/request/request_context_test.go46
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/request/request_internal_test.go27
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go648
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/request/request_resetbody_test.go107
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/request/request_test.go1121
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/request/retryer_test.go62
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_benchmark_test.go76
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_test.go118
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/request/waiter_test.go654
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/session/custom_ca_bundle_test.go243
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/session/env_config_test.go306
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/session/session_test.go446
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/session/shared_config_test.go274
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/signer/v4/functional_1_5_test.go86
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/signer/v4/functional_test.go254
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/signer/v4/header_rules_test.go77
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4_test.go737
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/types_test.go92
-rw-r--r--vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config_other_test.go40
-rw-r--r--vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config_windows_test.go40
-rw-r--r--vendor/github.com/aws/aws-sdk-go/private/protocol/idempotency_test.go106
-rw-r--r--vendor/github.com/aws/aws-sdk-go/private/protocol/jsonvalue_test.go93
-rw-r--r--vendor/github.com/aws/aws-sdk-go/private/protocol/protocol_test.go203
-rw-r--r--vendor/github.com/aws/aws-sdk-go/private/protocol/query/build_test.go4071
-rw-r--r--vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_test.go3007
-rw-r--r--vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build_test.go63
-rw-r--r--vendor/github.com/aws/aws-sdk-go/private/protocol/rest/rest_test.go63
-rw-r--r--vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/build_bench_test.go366
-rw-r--r--vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/build_test.go6369
-rw-r--r--vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/unmarshal_test.go3145
-rw-r--r--vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal_test.go40
-rw-r--r--vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal_test.go142
-rw-r--r--vendor/github.com/aws/aws-sdk-go/service/route53/customizations_test.go35
-rw-r--r--vendor/github.com/aws/aws-sdk-go/service/route53/examples_test.go936
-rw-r--r--vendor/github.com/aws/aws-sdk-go/service/route53/unmarshal_error_leak_test.go43
-rw-r--r--vendor/github.com/aws/aws-sdk-go/service/route53/unmarshal_error_test.go130
-rw-r--r--vendor/github.com/aws/aws-sdk-go/service/sts/customizations_test.go45
-rw-r--r--vendor/github.com/aws/aws-sdk-go/service/sts/examples_test.go282
-rw-r--r--vendor/github.com/coreos/etcd/auth/jwt_test.go100
-rw-r--r--vendor/github.com/coreos/etcd/auth/range_perm_cache_test.go59
-rw-r--r--vendor/github.com/coreos/etcd/auth/simple_token_test.go67
-rw-r--r--vendor/github.com/coreos/etcd/auth/store_test.go743
-rw-r--r--vendor/github.com/coreos/etcd/client/client_test.go1074
-rw-r--r--vendor/github.com/coreos/etcd/client/example_keys_test.go93
-rw-r--r--vendor/github.com/coreos/etcd/client/fake_transport_test.go40
-rw-r--r--vendor/github.com/coreos/etcd/client/keys_bench_test.go87
-rw-r--r--vendor/github.com/coreos/etcd/client/keys_test.go1428
-rw-r--r--vendor/github.com/coreos/etcd/client/main_test.go77
-rw-r--r--vendor/github.com/coreos/etcd/client/members_test.go598
-rw-r--r--vendor/github.com/coreos/etcd/clientv3/client_test.go153
-rw-r--r--vendor/github.com/coreos/etcd/clientv3/compact_op_test.go30
-rw-r--r--vendor/github.com/coreos/etcd/clientv3/example_auth_test.go113
-rw-r--r--vendor/github.com/coreos/etcd/clientv3/example_cluster_test.go103
-rw-r--r--vendor/github.com/coreos/etcd/clientv3/example_kv_test.go282
-rw-r--r--vendor/github.com/coreos/etcd/clientv3/example_lease_test.go141
-rw-r--r--vendor/github.com/coreos/etcd/clientv3/example_maintenence_test.go62
-rw-r--r--vendor/github.com/coreos/etcd/clientv3/example_metrics_test.go85
-rw-r--r--vendor/github.com/coreos/etcd/clientv3/example_test.go77
-rw-r--r--vendor/github.com/coreos/etcd/clientv3/example_watch_test.go100
-rw-r--r--vendor/github.com/coreos/etcd/clientv3/health_balancer_test.go298
-rw-r--r--vendor/github.com/coreos/etcd/clientv3/logger_test.go51
-rw-r--r--vendor/github.com/coreos/etcd/clientv3/main_test.go73
-rw-r--r--vendor/github.com/coreos/etcd/clientv3/op_test.go38
-rw-r--r--vendor/github.com/coreos/etcd/clientv3/txn_test.go105
-rw-r--r--vendor/github.com/coreos/etcd/clientv3/watch_test.go55
-rw-r--r--vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes/error_test.go44
-rw-r--r--vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/util_test.go50
-rw-r--r--vendor/github.com/coreos/etcd/etcdserver/cluster_util_test.go131
-rw-r--r--vendor/github.com/coreos/etcd/etcdserver/config_test.go204
-rw-r--r--vendor/github.com/coreos/etcd/etcdserver/consistent_index_test.go25
-rw-r--r--vendor/github.com/coreos/etcd/etcdserver/raft_test.go221
-rw-r--r--vendor/github.com/coreos/etcd/etcdserver/server_test.go1654
-rw-r--r--vendor/github.com/coreos/etcd/etcdserver/util_test.go90
-rw-r--r--vendor/github.com/coreos/etcd/main_test.go35
-rw-r--r--vendor/github.com/coreos/etcd/mvcc/index_test.go292
-rw-r--r--vendor/github.com/coreos/etcd/mvcc/key_index_test.go698
-rw-r--r--vendor/github.com/coreos/etcd/mvcc/kv_test.go831
-rw-r--r--vendor/github.com/coreos/etcd/mvcc/kvstore_bench_test.go174
-rw-r--r--vendor/github.com/coreos/etcd/mvcc/kvstore_compaction_test.go135
-rw-r--r--vendor/github.com/coreos/etcd/mvcc/kvstore_test.go829
-rw-r--r--vendor/github.com/coreos/etcd/mvcc/revision_test.go53
-rw-r--r--vendor/github.com/coreos/etcd/mvcc/watchable_store_bench_test.go200
-rw-r--r--vendor/github.com/coreos/etcd/mvcc/watchable_store_test.go652
-rw-r--r--vendor/github.com/coreos/etcd/mvcc/watcher_bench_test.go38
-rw-r--r--vendor/github.com/coreos/etcd/mvcc/watcher_test.go344
-rw-r--r--vendor/github.com/coreos/etcd/pkg/types/id_test.go95
-rw-r--r--vendor/github.com/coreos/etcd/pkg/types/set_test.go186
-rw-r--r--vendor/github.com/coreos/etcd/pkg/types/slice_test.go30
-rw-r--r--vendor/github.com/coreos/etcd/pkg/types/urls_test.go169
-rw-r--r--vendor/github.com/coreos/etcd/pkg/types/urlsmap_test.go155
-rw-r--r--vendor/github.com/davecgh/go-spew/spew/common_test.go298
-rw-r--r--vendor/github.com/davecgh/go-spew/spew/dump_test.go1042
-rw-r--r--vendor/github.com/davecgh/go-spew/spew/dumpcgo_test.go99
-rw-r--r--vendor/github.com/davecgh/go-spew/spew/dumpnocgo_test.go26
-rw-r--r--vendor/github.com/davecgh/go-spew/spew/example_test.go226
-rw-r--r--vendor/github.com/davecgh/go-spew/spew/format_test.go1558
-rw-r--r--vendor/github.com/davecgh/go-spew/spew/internal_test.go87
-rw-r--r--vendor/github.com/davecgh/go-spew/spew/internalunsafe_test.go102
-rw-r--r--vendor/github.com/davecgh/go-spew/spew/spew_test.go320
-rw-r--r--vendor/github.com/eapache/go-resiliency/breaker/breaker_test.go196
-rw-r--r--vendor/github.com/eapache/go-xerial-snappy/snappy_test.go49
-rw-r--r--vendor/github.com/eapache/queue/queue_test.go178
-rw-r--r--vendor/github.com/farsightsec/golang-framestream/framestream_test.go185
-rw-r--r--vendor/github.com/ghodss/yaml/yaml_test.go287
-rw-r--r--vendor/github.com/go-ini/ini/bench_test.go118
-rw-r--r--vendor/github.com/go-ini/ini/file_test.go294
-rw-r--r--vendor/github.com/go-ini/ini/ini_internal_test.go35
-rw-r--r--vendor/github.com/go-ini/ini/ini_test.go1210
-rw-r--r--vendor/github.com/go-ini/ini/key_test.go523
-rw-r--r--vendor/github.com/go-ini/ini/parser_test.go77
-rw-r--r--vendor/github.com/go-ini/ini/section_test.go313
-rw-r--r--vendor/github.com/go-ini/ini/struct_test.go387
-rw-r--r--vendor/github.com/go-logfmt/logfmt/decode-bench_test.go75
-rw-r--r--vendor/github.com/go-logfmt/logfmt/decode_test.go184
-rw-r--r--vendor/github.com/go-logfmt/logfmt/encode_internal_test.go233
-rw-r--r--vendor/github.com/go-logfmt/logfmt/encode_test.go206
-rw-r--r--vendor/github.com/go-logfmt/logfmt/example_test.go60
-rw-r--r--vendor/github.com/gogo/protobuf/proto/all_test.go2278
-rw-r--r--vendor/github.com/gogo/protobuf/proto/any_test.go300
-rw-r--r--vendor/github.com/gogo/protobuf/proto/clone_test.go300
-rw-r--r--vendor/github.com/gogo/protobuf/proto/decode_test.go262
-rw-r--r--vendor/github.com/gogo/protobuf/proto/encode_test.go84
-rw-r--r--vendor/github.com/gogo/protobuf/proto/equal_test.go224
-rw-r--r--vendor/github.com/gogo/protobuf/proto/extensions_test.go538
-rw-r--r--vendor/github.com/gogo/protobuf/proto/map_test.go46
-rw-r--r--vendor/github.com/gogo/protobuf/proto/message_set_test.go66
-rw-r--r--vendor/github.com/gogo/protobuf/proto/proto3_test.go135
-rw-r--r--vendor/github.com/gogo/protobuf/proto/size2_test.go63
-rw-r--r--vendor/github.com/gogo/protobuf/proto/size_test.go164
-rw-r--r--vendor/github.com/gogo/protobuf/proto/text_parser_test.go673
-rw-r--r--vendor/github.com/gogo/protobuf/proto/text_test.go474
-rw-r--r--vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor_test.go31
-rw-r--r--vendor/github.com/golang/glog/glog_test.go415
-rw-r--r--vendor/github.com/golang/protobuf/proto/all_test.go2410
-rw-r--r--vendor/github.com/golang/protobuf/proto/any_test.go300
-rw-r--r--vendor/github.com/golang/protobuf/proto/clone_test.go390
-rw-r--r--vendor/github.com/golang/protobuf/proto/decode_test.go255
-rw-r--r--vendor/github.com/golang/protobuf/proto/discard_test.go170
-rw-r--r--vendor/github.com/golang/protobuf/proto/encode_test.go85
-rw-r--r--vendor/github.com/golang/protobuf/proto/equal_test.go244
-rw-r--r--vendor/github.com/golang/protobuf/proto/extensions_test.go688
-rw-r--r--vendor/github.com/golang/protobuf/proto/map_test.go70
-rw-r--r--vendor/github.com/golang/protobuf/proto/message_set_test.go77
-rw-r--r--vendor/github.com/golang/protobuf/proto/proto3_test.go151
-rw-r--r--vendor/github.com/golang/protobuf/proto/size2_test.go63
-rw-r--r--vendor/github.com/golang/protobuf/proto/size_test.go191
-rw-r--r--vendor/github.com/golang/protobuf/proto/text_parser_test.go706
-rw-r--r--vendor/github.com/golang/protobuf/proto/text_test.go518
-rw-r--r--vendor/github.com/golang/protobuf/ptypes/any_test.go113
-rw-r--r--vendor/github.com/golang/protobuf/ptypes/duration_test.go121
-rw-r--r--vendor/github.com/golang/protobuf/ptypes/timestamp_test.go153
-rw-r--r--vendor/github.com/golang/snappy/golden_test.go1965
-rw-r--r--vendor/github.com/golang/snappy/snappy_test.go1353
-rw-r--r--vendor/github.com/google/btree/btree_test.go770
-rw-r--r--vendor/github.com/google/gofuzz/example_test.go225
-rw-r--r--vendor/github.com/google/gofuzz/fuzz_test.go472
-rw-r--r--vendor/github.com/googleapis/gnostic/gnostic_test.go453
-rw-r--r--vendor/github.com/gregjones/httpcache/diskcache/diskcache_test.go42
-rw-r--r--vendor/github.com/gregjones/httpcache/httpcache_test.go1475
-rw-r--r--vendor/github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc/errors_test.go57
-rw-r--r--vendor/github.com/hashicorp/golang-lru/2q_test.go306
-rw-r--r--vendor/github.com/hashicorp/golang-lru/arc_test.go377
-rw-r--r--vendor/github.com/hashicorp/golang-lru/lru_test.go221
-rw-r--r--vendor/github.com/hashicorp/golang-lru/simplelru/lru_test.go167
-rw-r--r--vendor/github.com/imdario/mergo/issue17_test.go25
-rw-r--r--vendor/github.com/imdario/mergo/issue23_test.go27
-rw-r--r--vendor/github.com/imdario/mergo/issue33_test.go33
-rw-r--r--vendor/github.com/imdario/mergo/issue38_test.go59
-rw-r--r--vendor/github.com/imdario/mergo/issue50_test.go18
-rw-r--r--vendor/github.com/imdario/mergo/issue52_test.go99
-rw-r--r--vendor/github.com/imdario/mergo/issue61_test.go20
-rw-r--r--vendor/github.com/imdario/mergo/issue64_test.go38
-rw-r--r--vendor/github.com/imdario/mergo/issue66_test.go48
-rw-r--r--vendor/github.com/imdario/mergo/merge_appendslice_test.go33
-rw-r--r--vendor/github.com/imdario/mergo/merge_test.go50
-rw-r--r--vendor/github.com/imdario/mergo/mergo_test.go733
-rw-r--r--vendor/github.com/imdario/mergo/pr80_test.go18
-rw-r--r--vendor/github.com/imdario/mergo/pr81_test.go42
-rw-r--r--vendor/github.com/jmespath/go-jmespath/api_test.go32
-rw-r--r--vendor/github.com/jmespath/go-jmespath/compliance_test.go123
-rw-r--r--vendor/github.com/jmespath/go-jmespath/interpreter_test.go221
-rw-r--r--vendor/github.com/jmespath/go-jmespath/lexer_test.go161
-rw-r--r--vendor/github.com/jmespath/go-jmespath/parser_test.go136
-rw-r--r--vendor/github.com/jmespath/go-jmespath/util_test.go73
-rw-r--r--vendor/github.com/json-iterator/go/example_test.go121
-rw-r--r--vendor/github.com/json-iterator/go/iter_skip_sloppy_test.go162
-rw-r--r--vendor/github.com/json-iterator/go/stream_test.go69
-rw-r--r--vendor/github.com/kr/logfmt/bench_test.go59
-rw-r--r--vendor/github.com/kr/logfmt/decode_test.go110
-rw-r--r--vendor/github.com/kr/logfmt/example_test.go59
-rw-r--r--vendor/github.com/kr/logfmt/scanner_test.go67
-rw-r--r--vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/all_test.go178
-rw-r--r--vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode_test.go99
-rw-r--r--vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode_test.go67
-rw-r--r--vendor/github.com/modern-go/concurrent/map_test.go18
-rw-r--r--vendor/github.com/modern-go/concurrent/unbounded_executor_test.go54
-rw-r--r--vendor/github.com/opentracing/opentracing-go/ext/tags_test.go148
-rw-r--r--vendor/github.com/opentracing/opentracing-go/gocontext_test.go81
-rw-r--r--vendor/github.com/opentracing/opentracing-go/log/field_test.go39
-rw-r--r--vendor/github.com/opentracing/opentracing-go/options_test.go31
-rw-r--r--vendor/github.com/opentracing/opentracing-go/propagation_test.go93
-rw-r--r--vendor/github.com/opentracing/opentracing-go/testtracer_test.go138
-rw-r--r--vendor/github.com/openzipkin/zipkin-go-opentracing/bench_test.go197
-rw-r--r--vendor/github.com/openzipkin/zipkin-go-opentracing/collector-http_test.go382
-rw-r--r--vendor/github.com/openzipkin/zipkin-go-opentracing/collector-kafka_test.go194
-rw-r--r--vendor/github.com/openzipkin/zipkin-go-opentracing/collector-scribe_test.go189
-rw-r--r--vendor/github.com/openzipkin/zipkin-go-opentracing/collector_test.go110
-rw-r--r--vendor/github.com/openzipkin/zipkin-go-opentracing/concurrency_test.go134
-rw-r--r--vendor/github.com/openzipkin/zipkin-go-opentracing/log-materializers_test.go74
-rw-r--r--vendor/github.com/openzipkin/zipkin-go-opentracing/propagation_test.go171
-rw-r--r--vendor/github.com/openzipkin/zipkin-go-opentracing/recorder_test.go29
-rw-r--r--vendor/github.com/openzipkin/zipkin-go-opentracing/sample_test.go52
-rw-r--r--vendor/github.com/openzipkin/zipkin-go-opentracing/span_test.go252
-rw-r--r--vendor/github.com/openzipkin/zipkin-go-opentracing/testutil_test.go125
-rw-r--r--vendor/github.com/openzipkin/zipkin-go-opentracing/types/traceid_test.go13
-rw-r--r--vendor/github.com/openzipkin/zipkin-go-opentracing/wire/carrier_test.go50
-rw-r--r--vendor/github.com/petar/GoLLRB/llrb/iterator_test.go76
-rw-r--r--vendor/github.com/petar/GoLLRB/llrb/llrb_test.go239
-rw-r--r--vendor/github.com/peterbourgon/diskv/basic_test.go336
-rw-r--r--vendor/github.com/peterbourgon/diskv/compression_test.go72
-rw-r--r--vendor/github.com/peterbourgon/diskv/import_test.go76
-rw-r--r--vendor/github.com/peterbourgon/diskv/index_test.go148
-rw-r--r--vendor/github.com/peterbourgon/diskv/issues_test.go121
-rw-r--r--vendor/github.com/peterbourgon/diskv/keys_test.go231
-rw-r--r--vendor/github.com/peterbourgon/diskv/speed_test.go153
-rw-r--r--vendor/github.com/peterbourgon/diskv/stream_test.go117
-rw-r--r--vendor/github.com/pierrec/lz4/bench_test.go119
-rw-r--r--vendor/github.com/pierrec/lz4/block_test.go98
-rw-r--r--vendor/github.com/pierrec/lz4/export_test.go13
-rw-r--r--vendor/github.com/pierrec/lz4/internal/xxh32/xxh32zero_test.go161
-rw-r--r--vendor/github.com/pierrec/lz4/reader_test.go59
-rw-r--r--vendor/github.com/pierrec/lz4/writer_test.go78
-rw-r--r--vendor/github.com/prometheus/common/expfmt/bench_test.go167
-rw-r--r--vendor/github.com/prometheus/common/expfmt/decode_test.go435
-rw-r--r--vendor/github.com/prometheus/common/expfmt/text_create_test.go443
-rw-r--r--vendor/github.com/prometheus/common/expfmt/text_parse_test.go593
-rw-r--r--vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg_test.go33
-rw-r--r--vendor/github.com/prometheus/common/model/alert_test.go118
-rw-r--r--vendor/github.com/prometheus/common/model/labels_test.go140
-rw-r--r--vendor/github.com/prometheus/common/model/metric_test.go132
-rw-r--r--vendor/github.com/prometheus/common/model/signature_test.go314
-rw-r--r--vendor/github.com/prometheus/common/model/silence_test.go228
-rw-r--r--vendor/github.com/prometheus/common/model/time_test.go132
-rw-r--r--vendor/github.com/prometheus/common/model/value_test.go468
-rw-r--r--vendor/github.com/rcrowley/go-metrics/counter_test.go77
-rw-r--r--vendor/github.com/rcrowley/go-metrics/debug_test.go48
-rw-r--r--vendor/github.com/rcrowley/go-metrics/ewma_test.go258
-rw-r--r--vendor/github.com/rcrowley/go-metrics/gauge_float64_test.go69
-rw-r--r--vendor/github.com/rcrowley/go-metrics/gauge_test.go87
-rw-r--r--vendor/github.com/rcrowley/go-metrics/graphite_test.go22
-rw-r--r--vendor/github.com/rcrowley/go-metrics/histogram_test.go95
-rw-r--r--vendor/github.com/rcrowley/go-metrics/json_test.go28
-rw-r--r--vendor/github.com/rcrowley/go-metrics/meter_test.go107
-rw-r--r--vendor/github.com/rcrowley/go-metrics/metrics_test.go124
-rw-r--r--vendor/github.com/rcrowley/go-metrics/opentsdb_test.go21
-rw-r--r--vendor/github.com/rcrowley/go-metrics/registry_test.go363
-rw-r--r--vendor/github.com/rcrowley/go-metrics/runtime_test.go88
-rw-r--r--vendor/github.com/rcrowley/go-metrics/sample_test.go363
-rw-r--r--vendor/github.com/rcrowley/go-metrics/timer_test.go101
-rw-r--r--vendor/github.com/rcrowley/go-metrics/writer_test.go22
-rw-r--r--vendor/github.com/spf13/pflag/bool_slice_test.go215
-rw-r--r--vendor/github.com/spf13/pflag/bool_test.go179
-rw-r--r--vendor/github.com/spf13/pflag/bytes_test.go72
-rw-r--r--vendor/github.com/spf13/pflag/count_test.go56
-rw-r--r--vendor/github.com/spf13/pflag/duration_slice_test.go165
-rw-r--r--vendor/github.com/spf13/pflag/example_test.go36
-rw-r--r--vendor/github.com/spf13/pflag/export_test.go29
-rw-r--r--vendor/github.com/spf13/pflag/flag_test.go1259
-rw-r--r--vendor/github.com/spf13/pflag/golangflag_test.go47
-rw-r--r--vendor/github.com/spf13/pflag/int_slice_test.go165
-rw-r--r--vendor/github.com/spf13/pflag/ip_slice_test.go222
-rw-r--r--vendor/github.com/spf13/pflag/ip_test.go63
-rw-r--r--vendor/github.com/spf13/pflag/ipnet_test.go70
-rw-r--r--vendor/github.com/spf13/pflag/printusage_test.go74
-rw-r--r--vendor/github.com/spf13/pflag/string_array_test.go233
-rw-r--r--vendor/github.com/spf13/pflag/string_slice_test.go253
-rw-r--r--vendor/github.com/spf13/pflag/uint_slice_test.go161
-rw-r--r--vendor/github.com/ugorji/go/codec/cbor_test.go230
-rw-r--r--vendor/github.com/ugorji/go/codec/codec_test.go3008
-rw-r--r--vendor/github.com/ugorji/go/codec/helper_test.go54
-rw-r--r--vendor/github.com/ugorji/go/codec/mammoth2_codecgen_generated_test.go38474
-rw-r--r--vendor/github.com/ugorji/go/codec/mammoth2_generated_test.go658
-rw-r--r--vendor/github.com/ugorji/go/codec/mammoth_generated_test.go13188
-rw-r--r--vendor/github.com/ugorji/go/codec/py_test.go30
-rw-r--r--vendor/github.com/ugorji/go/codec/shared_test.go304
-rw-r--r--vendor/github.com/ugorji/go/codec/values_flex_test.go208
-rw-r--r--vendor/github.com/ugorji/go/codec/values_test.go400
-rw-r--r--vendor/github.com/ugorji/go/codec/z_all_test.go488
-rw-r--r--vendor/golang.org/x/crypto/ssh/benchmark_test.go123
-rw-r--r--vendor/golang.org/x/crypto/ssh/buffer_test.go87
-rw-r--r--vendor/golang.org/x/crypto/ssh/certs_test.go335
-rw-r--r--vendor/golang.org/x/crypto/ssh/cipher_test.go131
-rw-r--r--vendor/golang.org/x/crypto/ssh/client_auth_test.go628
-rw-r--r--vendor/golang.org/x/crypto/ssh/client_test.go166
-rw-r--r--vendor/golang.org/x/crypto/ssh/example_test.go320
-rw-r--r--vendor/golang.org/x/crypto/ssh/handshake_test.go559
-rw-r--r--vendor/golang.org/x/crypto/ssh/kex_test.go50
-rw-r--r--vendor/golang.org/x/crypto/ssh/keys_test.go500
-rw-r--r--vendor/golang.org/x/crypto/ssh/mempipe_test.go110
-rw-r--r--vendor/golang.org/x/crypto/ssh/messages_test.go288
-rw-r--r--vendor/golang.org/x/crypto/ssh/mux_test.go501
-rw-r--r--vendor/golang.org/x/crypto/ssh/session_test.go774
-rw-r--r--vendor/golang.org/x/crypto/ssh/tcpip_test.go20
-rw-r--r--vendor/golang.org/x/crypto/ssh/terminal/terminal_test.go358
-rw-r--r--vendor/golang.org/x/crypto/ssh/testdata_test.go63
-rw-r--r--vendor/golang.org/x/crypto/ssh/transport_test.go113
-rw-r--r--vendor/golang.org/x/net/context/context_test.go583
-rw-r--r--vendor/golang.org/x/net/context/withtimeout_test.go31
-rw-r--r--vendor/golang.org/x/net/http/httpguts/httplex_test.go119
-rw-r--r--vendor/golang.org/x/net/http2/ciphers_test.go309
-rw-r--r--vendor/golang.org/x/net/http2/databuffer_test.go157
-rw-r--r--vendor/golang.org/x/net/http2/errors_test.go24
-rw-r--r--vendor/golang.org/x/net/http2/flow_test.go87
-rw-r--r--vendor/golang.org/x/net/http2/frame_test.go1191
-rw-r--r--vendor/golang.org/x/net/http2/go18_test.go79
-rw-r--r--vendor/golang.org/x/net/http2/go19_test.go59
-rw-r--r--vendor/golang.org/x/net/http2/gotrack_test.go33
-rw-r--r--vendor/golang.org/x/net/http2/hpack/encode_test.go386
-rw-r--r--vendor/golang.org/x/net/http2/hpack/hpack_test.go741
-rw-r--r--vendor/golang.org/x/net/http2/hpack/tables_test.go214
-rw-r--r--vendor/golang.org/x/net/http2/http2_test.go227
-rw-r--r--vendor/golang.org/x/net/http2/pipe_test.go130
-rw-r--r--vendor/golang.org/x/net/http2/server_push_test.go521
-rw-r--r--vendor/golang.org/x/net/http2/server_test.go3843
-rw-r--r--vendor/golang.org/x/net/http2/transport_test.go3848
-rw-r--r--vendor/golang.org/x/net/http2/writesched_priority_test.go541
-rw-r--r--vendor/golang.org/x/net/http2/writesched_random_test.go44
-rw-r--r--vendor/golang.org/x/net/http2/writesched_test.go125
-rw-r--r--vendor/golang.org/x/net/http2/z_spec_test.go356
-rw-r--r--vendor/golang.org/x/net/idna/example_test.go70
-rw-r--r--vendor/golang.org/x/net/idna/idna_test.go108
-rw-r--r--vendor/golang.org/x/net/idna/punycode_test.go198
-rw-r--r--vendor/golang.org/x/net/internal/timeseries/timeseries_test.go170
-rw-r--r--vendor/golang.org/x/net/trace/histogram_test.go325
-rw-r--r--vendor/golang.org/x/net/trace/trace_test.go178
-rw-r--r--vendor/golang.org/x/sys/unix/creds_test.go134
-rw-r--r--vendor/golang.org/x/sys/unix/dev_linux_test.go56
-rw-r--r--vendor/golang.org/x/sys/unix/example_test.go19
-rw-r--r--vendor/golang.org/x/sys/unix/export_test.go9
-rw-r--r--vendor/golang.org/x/sys/unix/mmap_unix_test.go35
-rw-r--r--vendor/golang.org/x/sys/unix/openbsd_test.go113
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_bsd_test.go93
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_darwin_test.go19
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_freebsd_test.go312
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_linux_test.go421
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_solaris_test.go55
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_test.go60
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_unix_test.go657
-rw-r--r--vendor/golang.org/x/sys/unix/timestruct_test.go54
-rw-r--r--vendor/golang.org/x/sys/unix/xattr_test.go119
-rw-r--r--vendor/golang.org/x/sys/windows/syscall_test.go53
-rw-r--r--vendor/golang.org/x/sys/windows/syscall_windows_test.go113
-rw-r--r--vendor/golang.org/x/text/collate/build/builder_test.go290
-rw-r--r--vendor/golang.org/x/text/collate/build/colelem_test.go215
-rw-r--r--vendor/golang.org/x/text/collate/build/contract_test.go266
-rw-r--r--vendor/golang.org/x/text/collate/build/order_test.go229
-rw-r--r--vendor/golang.org/x/text/collate/build/trie_test.go107
-rw-r--r--vendor/golang.org/x/text/collate/collate_test.go482
-rw-r--r--vendor/golang.org/x/text/collate/export_test.go51
-rw-r--r--vendor/golang.org/x/text/collate/option_test.go209
-rw-r--r--vendor/golang.org/x/text/collate/reg_test.go230
-rw-r--r--vendor/golang.org/x/text/collate/sort_test.go55
-rw-r--r--vendor/golang.org/x/text/collate/table_test.go291
-rw-r--r--vendor/golang.org/x/text/internal/colltab/collate_test.go121
-rw-r--r--vendor/golang.org/x/text/internal/colltab/collelem_test.go183
-rw-r--r--vendor/golang.org/x/text/internal/colltab/colltab_test.go64
-rw-r--r--vendor/golang.org/x/text/internal/colltab/contract_test.go131
-rw-r--r--vendor/golang.org/x/text/internal/colltab/iter_test.go63
-rw-r--r--vendor/golang.org/x/text/internal/colltab/numeric_test.go159
-rw-r--r--vendor/golang.org/x/text/internal/colltab/trie_test.go106
-rw-r--r--vendor/golang.org/x/text/internal/colltab/weighter_test.go42
-rw-r--r--vendor/golang.org/x/text/internal/gen_test.go38
-rw-r--r--vendor/golang.org/x/text/internal/internal_test.go38
-rw-r--r--vendor/golang.org/x/text/internal/match_test.go56
-rw-r--r--vendor/golang.org/x/text/internal/tag/tag_test.go67
-rw-r--r--vendor/golang.org/x/text/internal/triegen/data_test.go875
-rw-r--r--vendor/golang.org/x/text/internal/triegen/example_compact_test.go71
-rw-r--r--vendor/golang.org/x/text/internal/triegen/example_test.go148
-rw-r--r--vendor/golang.org/x/text/internal/triegen/gen_test.go68
-rw-r--r--vendor/golang.org/x/text/internal/ucd/example_test.go81
-rw-r--r--vendor/golang.org/x/text/internal/ucd/ucd_test.go105
-rw-r--r--vendor/golang.org/x/text/language/coverage_test.go154
-rw-r--r--vendor/golang.org/x/text/language/examples_test.go413
-rw-r--r--vendor/golang.org/x/text/language/httpexample_test.go48
-rw-r--r--vendor/golang.org/x/text/language/language_test.go911
-rw-r--r--vendor/golang.org/x/text/language/lookup_test.go457
-rw-r--r--vendor/golang.org/x/text/language/match_test.go505
-rw-r--r--vendor/golang.org/x/text/language/parse_test.go517
-rw-r--r--vendor/golang.org/x/text/secure/bidirule/bench_test.go54
-rw-r--r--vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0_test.go694
-rw-r--r--vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0_test.go668
-rw-r--r--vendor/golang.org/x/text/secure/bidirule/bidirule_test.go168
-rw-r--r--vendor/golang.org/x/text/transform/examples_test.go37
-rw-r--r--vendor/golang.org/x/text/transform/transform_test.go1317
-rw-r--r--vendor/golang.org/x/text/unicode/bidi/core_test.go224
-rw-r--r--vendor/golang.org/x/text/unicode/bidi/ranges_test.go53
-rw-r--r--vendor/golang.org/x/text/unicode/bidi/tables_test.go82
-rw-r--r--vendor/golang.org/x/text/unicode/cldr/cldr_test.go27
-rw-r--r--vendor/golang.org/x/text/unicode/cldr/collate_test.go275
-rw-r--r--vendor/golang.org/x/text/unicode/cldr/data_test.go186
-rw-r--r--vendor/golang.org/x/text/unicode/cldr/examples_test.go21
-rw-r--r--vendor/golang.org/x/text/unicode/cldr/resolve_test.go368
-rw-r--r--vendor/golang.org/x/text/unicode/cldr/slice_test.go175
-rw-r--r--vendor/golang.org/x/text/unicode/norm/composition_test.go130
-rw-r--r--vendor/golang.org/x/text/unicode/norm/data10.0.0_test.go7424
-rw-r--r--vendor/golang.org/x/text/unicode/norm/data9.0.0_test.go7409
-rw-r--r--vendor/golang.org/x/text/unicode/norm/example_iter_test.go82
-rw-r--r--vendor/golang.org/x/text/unicode/norm/example_test.go27
-rw-r--r--vendor/golang.org/x/text/unicode/norm/forminfo_test.go54
-rw-r--r--vendor/golang.org/x/text/unicode/norm/iter_test.go98
-rw-r--r--vendor/golang.org/x/text/unicode/norm/normalize_test.go1287
-rw-r--r--vendor/golang.org/x/text/unicode/norm/readwriter_test.go56
-rw-r--r--vendor/golang.org/x/text/unicode/norm/transform_test.go101
-rw-r--r--vendor/golang.org/x/text/unicode/norm/ucd_test.go275
-rw-r--r--vendor/golang.org/x/text/unicode/rangetable/merge_test.go184
-rw-r--r--vendor/golang.org/x/text/unicode/rangetable/rangetable_test.go55
-rw-r--r--vendor/golang.org/x/time/rate/rate_test.go459
-rw-r--r--vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin_test.go477
-rw-r--r--vendor/google.golang.org/grpc/balancer_switching_test.go469
-rw-r--r--vendor/google.golang.org/grpc/balancer_test.go804
-rw-r--r--vendor/google.golang.org/grpc/call_test.go293
-rw-r--r--vendor/google.golang.org/grpc/clientconn_test.go678
-rw-r--r--vendor/google.golang.org/grpc/codec_test.go32
-rw-r--r--vendor/google.golang.org/grpc/codes/codes_test.go84
-rw-r--r--vendor/google.golang.org/grpc/credentials/credentials_test.go206
-rw-r--r--vendor/google.golang.org/grpc/encoding/proto/proto_benchmark_test.go100
-rw-r--r--vendor/google.golang.org/grpc/encoding/proto/proto_test.go129
-rw-r--r--vendor/google.golang.org/grpc/grpclog/loggerv2_test.go62
-rw-r--r--vendor/google.golang.org/grpc/metadata/metadata_test.go251
-rw-r--r--vendor/google.golang.org/grpc/naming/dns_resolver_test.go315
-rw-r--r--vendor/google.golang.org/grpc/naming/go17_test.go42
-rw-r--r--vendor/google.golang.org/grpc/naming/go18_test.go41
-rw-r--r--vendor/google.golang.org/grpc/picker_wrapper_test.go160
-rw-r--r--vendor/google.golang.org/grpc/pickfirst_test.go360
-rw-r--r--vendor/google.golang.org/grpc/proxy_test.go182
-rw-r--r--vendor/google.golang.org/grpc/resolver/dns/dns_resolver_test.go936
-rw-r--r--vendor/google.golang.org/grpc/resolver/dns/go17_test.go50
-rw-r--r--vendor/google.golang.org/grpc/resolver/dns/go18_test.go49
-rw-r--r--vendor/google.golang.org/grpc/resolver_conn_wrapper_test.go113
-rw-r--r--vendor/google.golang.org/grpc/rpc_util_test.go288
-rw-r--r--vendor/google.golang.org/grpc/server_test.go136
-rw-r--r--vendor/google.golang.org/grpc/service_config_test.go386
-rw-r--r--vendor/google.golang.org/grpc/stats/stats_test.go1257
-rw-r--r--vendor/google.golang.org/grpc/status/go17_test.go44
-rw-r--r--vendor/google.golang.org/grpc/status/status_test.go348
-rw-r--r--vendor/google.golang.org/grpc/stickiness_linkedmap_test.go186
-rw-r--r--vendor/google.golang.org/grpc/stickiness_test.go288
-rw-r--r--vendor/google.golang.org/grpc/transport/handler_server_test.go482
-rw-r--r--vendor/google.golang.org/grpc/transport/http_util_test.go237
-rw-r--r--vendor/google.golang.org/grpc/transport/transport_test.go2312
-rw-r--r--vendor/gopkg.in/inf.v0/benchmark_test.go210
-rw-r--r--vendor/gopkg.in/inf.v0/dec_go1_2_test.go33
-rw-r--r--vendor/gopkg.in/inf.v0/dec_internal_test.go40
-rw-r--r--vendor/gopkg.in/inf.v0/dec_test.go379
-rw-r--r--vendor/gopkg.in/inf.v0/example_test.go62
-rw-r--r--vendor/gopkg.in/inf.v0/rounder_example_test.go73
-rw-r--r--vendor/gopkg.in/inf.v0/rounder_test.go109
-rw-r--r--vendor/gopkg.in/yaml.v2/decode_test.go1326
-rw-r--r--vendor/gopkg.in/yaml.v2/encode_test.go595
-rw-r--r--vendor/gopkg.in/yaml.v2/example_embedded_test.go41
-rw-r--r--vendor/gopkg.in/yaml.v2/suite_test.go12
-rw-r--r--vendor/k8s.io/api/core/v1/taint_test.go122
-rw-r--r--vendor/k8s.io/api/core/v1/toleration_test.go123
-rw-r--r--vendor/k8s.io/api/roundtrip_test.go150
-rw-r--r--vendor/k8s.io/apimachinery/pkg/api/errors/errors_test.go222
-rw-r--r--vendor/k8s.io/apimachinery/pkg/api/meta/meta_test.go51
-rw-r--r--vendor/k8s.io/apimachinery/pkg/api/meta/multirestmapper_test.go391
-rw-r--r--vendor/k8s.io/apimachinery/pkg/api/meta/priority_test.go409
-rw-r--r--vendor/k8s.io/apimachinery/pkg/api/meta/restmapper_test.go724
-rw-r--r--vendor/k8s.io/apimachinery/pkg/api/resource/amount_test.go133
-rw-r--r--vendor/k8s.io/apimachinery/pkg/api/resource/math_test.go211
-rw-r--r--vendor/k8s.io/apimachinery/pkg/api/resource/quantity_example_test.go59
-rw-r--r--vendor/k8s.io/apimachinery/pkg/api/resource/quantity_proto_test.go103
-rw-r--r--vendor/k8s.io/apimachinery/pkg/api/resource/quantity_test.go1352
-rw-r--r--vendor/k8s.io/apimachinery/pkg/api/resource/scale_int_test.go85
-rw-r--r--vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/register_test.go89
-rw-r--r--vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/roundtrip_test.go28
-rw-r--r--vendor/k8s.io/apimachinery/pkg/apis/meta/v1/controller_ref_test.go133
-rw-r--r--vendor/k8s.io/apimachinery/pkg/apis/meta/v1/conversion_test.go84
-rw-r--r--vendor/k8s.io/apimachinery/pkg/apis/meta/v1/duration_test.go153
-rw-r--r--vendor/k8s.io/apimachinery/pkg/apis/meta/v1/group_version_test.go79
-rw-r--r--vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers_test.go154
-rw-r--r--vendor/k8s.io/apimachinery/pkg/apis/meta/v1/labels_test.go123
-rw-r--r--vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_test.go139
-rw-r--r--vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time_test.go197
-rw-r--r--vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types_test.go135
-rw-r--r--vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers_test.go136
-rw-r--r--vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list_test.go86
-rw-r--r--vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_test.go32
-rw-r--r--vendor/k8s.io/apimachinery/pkg/conversion/converter_test.go826
-rw-r--r--vendor/k8s.io/apimachinery/pkg/conversion/helper_test.go38
-rw-r--r--vendor/k8s.io/apimachinery/pkg/conversion/queryparams/convert_test.go219
-rw-r--r--vendor/k8s.io/apimachinery/pkg/fields/fields_test.go57
-rw-r--r--vendor/k8s.io/apimachinery/pkg/fields/selector_test.go397
-rw-r--r--vendor/k8s.io/apimachinery/pkg/labels/labels_test.go231
-rw-r--r--vendor/k8s.io/apimachinery/pkg/labels/selector_test.go575
-rw-r--r--vendor/k8s.io/apimachinery/pkg/runtime/conversion_test.go115
-rw-r--r--vendor/k8s.io/apimachinery/pkg/runtime/converter_test.go597
-rw-r--r--vendor/k8s.io/apimachinery/pkg/runtime/embedded_test.go256
-rw-r--r--vendor/k8s.io/apimachinery/pkg/runtime/extension_test.go113
-rw-r--r--vendor/k8s.io/apimachinery/pkg/runtime/local_scheme_test.go150
-rw-r--r--vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version_test.go180
-rw-r--r--vendor/k8s.io/apimachinery/pkg/runtime/scheme_test.go1035
-rw-r--r--vendor/k8s.io/apimachinery/pkg/runtime/serializer/codec_test.go339
-rw-r--r--vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/json_test.go336
-rw-r--r--vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/meta_test.go45
-rw-r--r--vendor/k8s.io/apimachinery/pkg/runtime/serializer/sparse_test.go91
-rw-r--r--vendor/k8s.io/apimachinery/pkg/runtime/serializer/streaming/streaming_test.go84
-rw-r--r--vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning_test.go381
-rw-r--r--vendor/k8s.io/apimachinery/pkg/runtime/swagger_doc_generator_test.go43
-rw-r--r--vendor/k8s.io/apimachinery/pkg/util/cache/cache_test.go90
-rw-r--r--vendor/k8s.io/apimachinery/pkg/util/cache/lruexpirecache_test.go68
-rw-r--r--vendor/k8s.io/apimachinery/pkg/util/clock/clock_test.go196
-rw-r--r--vendor/k8s.io/apimachinery/pkg/util/diff/diff_test.go143
-rw-r--r--vendor/k8s.io/apimachinery/pkg/util/errors/errors_test.go368
-rw-r--r--vendor/k8s.io/apimachinery/pkg/util/framer/framer_test.go176
-rw-r--r--vendor/k8s.io/apimachinery/pkg/util/intstr/intstr_test.go176
-rw-r--r--vendor/k8s.io/apimachinery/pkg/util/json/json_test.go319
-rw-r--r--vendor/k8s.io/apimachinery/pkg/util/mergepatch/util_test.go138
-rw-r--r--vendor/k8s.io/apimachinery/pkg/util/net/http_test.go282
-rw-r--r--vendor/k8s.io/apimachinery/pkg/util/net/interface_test.go725
-rw-r--r--vendor/k8s.io/apimachinery/pkg/util/net/port_range_test.go77
-rw-r--r--vendor/k8s.io/apimachinery/pkg/util/net/port_split_test.go121
-rw-r--r--vendor/k8s.io/apimachinery/pkg/util/net/util_test.go68
-rw-r--r--vendor/k8s.io/apimachinery/pkg/util/runtime/runtime_test.go71
-rw-r--r--vendor/k8s.io/apimachinery/pkg/util/sets/set_test.go270
-rw-r--r--vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch_test.go6763
-rw-r--r--vendor/k8s.io/apimachinery/pkg/util/validation/field/errors_test.go175
-rw-r--r--vendor/k8s.io/apimachinery/pkg/util/validation/field/path_test.go123
-rw-r--r--vendor/k8s.io/apimachinery/pkg/util/validation/validation_test.go513
-rw-r--r--vendor/k8s.io/apimachinery/pkg/util/wait/wait_test.go501
-rw-r--r--vendor/k8s.io/apimachinery/pkg/util/yaml/decoder_test.go405
-rw-r--r--vendor/k8s.io/apimachinery/pkg/version/helpers_test.go52
-rw-r--r--vendor/k8s.io/apimachinery/pkg/watch/filter_test.go84
-rw-r--r--vendor/k8s.io/apimachinery/pkg/watch/mux_test.go176
-rw-r--r--vendor/k8s.io/apimachinery/pkg/watch/streamwatcher_test.go68
-rw-r--r--vendor/k8s.io/apimachinery/pkg/watch/until_test.go172
-rw-r--r--vendor/k8s.io/apimachinery/pkg/watch/watch_test.go137
-rw-r--r--vendor/k8s.io/apimachinery/third_party/forked/golang/json/fields_test.go30
-rw-r--r--vendor/k8s.io/apimachinery/third_party/forked/golang/reflect/deep_equal_test.go137
-rw-r--r--vendor/k8s.io/client-go/discovery/cached_discovery_test.go169
-rw-r--r--vendor/k8s.io/client-go/discovery/discovery_client_test.go882
-rw-r--r--vendor/k8s.io/client-go/discovery/fake/discovery_test.go46
-rw-r--r--vendor/k8s.io/client-go/discovery/helper_blackbox_test.go184
-rw-r--r--vendor/k8s.io/client-go/discovery/round_tripper_test.go95
-rw-r--r--vendor/k8s.io/client-go/plugin/pkg/client/auth/exec/exec_test.go748
-rw-r--r--vendor/k8s.io/client-go/rest/client_test.go343
-rw-r--r--vendor/k8s.io/client-go/rest/config_test.go375
-rw-r--r--vendor/k8s.io/client-go/rest/plugin_test.go311
-rwxr-xr-xvendor/k8s.io/client-go/rest/request_test.go1789
-rw-r--r--vendor/k8s.io/client-go/rest/url_utils_test.go61
-rw-r--r--vendor/k8s.io/client-go/rest/urlbackoff_test.go79
-rw-r--r--vendor/k8s.io/client-go/rest/watch/decoder_test.go123
-rw-r--r--vendor/k8s.io/client-go/rest/watch/encoder_test.go84
-rw-r--r--vendor/k8s.io/client-go/testing/fixture_test.go235
-rw-r--r--vendor/k8s.io/client-go/tools/auth/clientauth_test.go69
-rw-r--r--vendor/k8s.io/client-go/tools/cache/controller_test.go405
-rw-r--r--vendor/k8s.io/client-go/tools/cache/delta_fifo_test.go492
-rw-r--r--vendor/k8s.io/client-go/tools/cache/expiration_cache_test.go189
-rw-r--r--vendor/k8s.io/client-go/tools/cache/fifo_test.go280
-rw-r--r--vendor/k8s.io/client-go/tools/cache/heap_test.go382
-rw-r--r--vendor/k8s.io/client-go/tools/cache/index_test.go163
-rw-r--r--vendor/k8s.io/client-go/tools/cache/mutation_detector_test.go81
-rw-r--r--vendor/k8s.io/client-go/tools/cache/processor_listener_test.go58
-rw-r--r--vendor/k8s.io/client-go/tools/cache/reflector_test.go389
-rw-r--r--vendor/k8s.io/client-go/tools/cache/shared_informer_test.go265
-rw-r--r--vendor/k8s.io/client-go/tools/cache/store_test.go156
-rw-r--r--vendor/k8s.io/client-go/tools/cache/undelta_store_test.go131
-rw-r--r--vendor/k8s.io/client-go/tools/clientcmd/api/helpers_test.go301
-rw-r--r--vendor/k8s.io/client-go/tools/clientcmd/api/types_test.go135
-rw-r--r--vendor/k8s.io/client-go/tools/clientcmd/client_config_test.go528
-rw-r--r--vendor/k8s.io/client-go/tools/clientcmd/loader_test.go789
-rw-r--r--vendor/k8s.io/client-go/tools/clientcmd/merged_client_builder_test.go328
-rw-r--r--vendor/k8s.io/client-go/tools/clientcmd/overrides_test.go50
-rw-r--r--vendor/k8s.io/client-go/tools/clientcmd/validation_test.go574
-rw-r--r--vendor/k8s.io/client-go/tools/pager/pager_test.go206
-rw-r--r--vendor/k8s.io/client-go/tools/reference/ref_test.go72
-rw-r--r--vendor/k8s.io/client-go/transport/cache_test.go157
-rw-r--r--vendor/k8s.io/client-go/transport/round_trippers_test.go218
-rw-r--r--vendor/k8s.io/client-go/transport/transport_test.go288
-rw-r--r--vendor/k8s.io/client-go/util/buffer/ring_growing_test.go50
-rw-r--r--vendor/k8s.io/client-go/util/cert/csr_test.go75
-rw-r--r--vendor/k8s.io/client-go/util/cert/pem_test.go197
-rw-r--r--vendor/k8s.io/client-go/util/connrotation/connrotation_test.go61
-rw-r--r--vendor/k8s.io/client-go/util/flowcontrol/backoff_test.go195
-rw-r--r--vendor/k8s.io/client-go/util/flowcontrol/throttle_test.go153
-rw-r--r--vendor/k8s.io/client-go/util/integer/integer_test.go244
-rw-r--r--vendor/k8s.io/client-go/util/retry/util_test.go71
-rw-r--r--vendor/k8s.io/kube-openapi/pkg/util/proto/openapi_suite_test.go49
-rw-r--r--vendor/k8s.io/kube-openapi/pkg/util/proto/openapi_test.go265
-rw-r--r--vendor/k8s.io/kube-openapi/pkg/util/util_test.go58
764 files changed, 172 insertions, 267451 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index c44b85f9d..e99420d8d 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -95,7 +95,7 @@ $ go get -u github.com/golang/dep/cmd/dep
Use the following to update the locked versions of all dependencies
```sh
-$ dep ensure -update
+$ make dep-ensure
```
To add a dependency to the project, you might run
diff --git a/Gopkg.lock b/Gopkg.lock
index 3c3d7b0a2..48fbbca32 100644
--- a/Gopkg.lock
+++ b/Gopkg.lock
@@ -2,27 +2,34 @@
[[projects]]
+ digest = "1:6aa683f91e93784ec7b76fe1568492f419aa3aa0b72f2087912c8c2cada7a375"
name = "github.com/DataDog/dd-trace-go"
packages = [
"opentracing",
"tracer",
- "tracer/ext"
+ "tracer/ext",
]
+ pruneopts = ""
revision = "27617015d45e6cd550b9a7ac7715c37cc2f7d020"
version = "v0.6.1"
[[projects]]
+ digest = "1:9362b2212139b7821f73a86169bf80ce6b0264956f87d82ab3aeedb2b5c08fea"
name = "github.com/Shopify/sarama"
packages = ["."]
+ pruneopts = ""
revision = "35324cf48e33d8260e1c7c18854465a904ade249"
version = "v1.17.0"
[[projects]]
+ digest = "1:58a1a132df6267aff83b2bf0ab62f42571695e6e74335107deafbb7ca55db4fc"
name = "github.com/apache/thrift"
packages = ["lib/go/thrift"]
+ pruneopts = ""
revision = "e59b73d3c2bf1c328ccb78e683c0462fa1a473c7"
[[projects]]
+ digest = "1:8a047cbc1be2f1578abaa9ba4daf4c87992de1121149632ad9147ee536b53031"
name = "github.com/aws/aws-sdk-go"
packages = [
"aws",
@@ -53,12 +60,14 @@
"private/protocol/xml/xmlutil",
"service/route53",
"service/route53/route53iface",
- "service/sts"
+ "service/sts",
]
+ pruneopts = ""
revision = "852052a10992d92f68b9a60862a3312292524903"
version = "v1.14.17"
[[projects]]
+ digest = "1:96637fd1b47c35bd2fc49969138b40ad6b66166e2e36664ac5ffd97c93542e62"
name = "github.com/coreos/etcd"
packages = [
"auth/authpb",
@@ -66,204 +75,262 @@
"etcdserver/api/v3rpc/rpctypes",
"etcdserver/etcdserverpb",
"mvcc/mvccpb",
- "pkg/types"
+ "pkg/types",
]
+ pruneopts = ""
revision = "33245c6b5b49130ca99280408fadfab01aac0e48"
version = "v3.3.8"
[[projects]]
+ digest = "1:56c130d885a4aacae1dd9c7b71cfe39912c7ebc1ff7d2b46083c8812996dc43b"
name = "github.com/davecgh/go-spew"
packages = ["spew"]
+ pruneopts = ""
revision = "346938d642f2ec3594ed81d874461961cd0faa76"
version = "v1.1.0"
[[projects]]
branch = "master"
+ digest = "1:1376ae7eff7cb0f47cf003d1ce49202dad343a7494e97bb6a54aff1ae5eb9397"
name = "github.com/dnstap/golang-dnstap"
packages = ["."]
+ pruneopts = ""
revision = "2cf77a2b5e11ac8d0ba3892772ac8e1f7b528344"
[[projects]]
+ digest = "1:6d6672f85a84411509885eaa32f597577873de00e30729b9bb0eb1e1faa49c12"
name = "github.com/eapache/go-resiliency"
packages = ["breaker"]
+ pruneopts = ""
revision = "ea41b0fad31007accc7f806884dcdf3da98b79ce"
version = "v1.1.0"
[[projects]]
branch = "master"
+ digest = "1:1f7503fa58a852a1416556ae2ddb219b49a1304fd408391948e2e3676514c48d"
name = "github.com/eapache/go-xerial-snappy"
packages = ["."]
+ pruneopts = ""
revision = "bb955e01b9346ac19dc29eb16586c90ded99a98c"
[[projects]]
+ digest = "1:d8d46d21073d0f65daf1740ebf4629c65e04bf92e14ce93c2201e8624843c3d3"
name = "github.com/eapache/queue"
packages = ["."]
+ pruneopts = ""
revision = "44cc805cf13205b55f69e14bcb69867d1ae92f98"
version = "v1.1.0"
[[projects]]
branch = "master"
+ digest = "1:3ef2b40796b5a4ac1b0da237c6e1bc31aae513d3b86cdb0506198ba49f33b458"
name = "github.com/farsightsec/golang-framestream"
packages = ["."]
+ pruneopts = ""
revision = "c06a5734334d9629b3db143d74b47eb94ea68612"
[[projects]]
+ digest = "1:b13707423743d41665fd23f0c36b2f37bb49c30e94adb813319c44188a51ba22"
name = "github.com/ghodss/yaml"
packages = ["."]
+ pruneopts = ""
revision = "0ca9ea5df5451ffdf184b4428c902747c2c11cd7"
version = "v1.0.0"
[[projects]]
+ digest = "1:617b3e0f5989d4ff866a1820480990c65dfc9257eb080da749a45e2d76681b02"
name = "github.com/go-ini/ini"
packages = ["."]
+ pruneopts = ""
revision = "06f5f3d67269ccec1fe5fe4134ba6e982984f7f5"
version = "v1.37.0"
[[projects]]
+ digest = "1:6a4a01d58b227c4b6b11111b9f172ec5c17682b82724e58e6daf3f19f4faccd8"
name = "github.com/go-logfmt/logfmt"
packages = ["."]
+ pruneopts = ""
revision = "390ab7935ee28ec6b286364bba9b4dd6410cb3d5"
version = "v0.3.0"
[[projects]]
+ digest = "1:0a3f6a0c68ab8f3d455f8892295503b179e571b7fefe47cc6c556405d1f83411"
name = "github.com/gogo/protobuf"
packages = [
"gogoproto",
"proto",
"protoc-gen-gogo/descriptor",
- "sortkeys"
+ "sortkeys",
]
+ pruneopts = ""
revision = "1adfc126b41513cc696b209667c8656ea7aac67c"
version = "v1.0.0"
[[projects]]
branch = "master"
+ digest = "1:107b233e45174dbab5b1324201d092ea9448e58243ab9f039e4c0f332e121e3a"
name = "github.com/golang/glog"
packages = ["."]
+ pruneopts = ""
revision = "23def4e6c14b4da8ac2ed8007337bc5eb5007998"
[[projects]]
+ digest = "1:f958a1c137db276e52f0b50efee41a1a389dcdded59a69711f3e872757dab34b"
name = "github.com/golang/protobuf"
packages = [
"proto",
"ptypes",
"ptypes/any",
"ptypes/duration",
- "ptypes/timestamp"
+ "ptypes/timestamp",
]
+ pruneopts = ""
revision = "b4deda0973fb4c70b50d226b1af49f3da59f5265"
version = "v1.1.0"
[[projects]]
branch = "master"
+ digest = "1:2a5888946cdbc8aa360fd43301f9fc7869d663f60d5eedae7d4e6e5e4f06f2bf"
name = "github.com/golang/snappy"
packages = ["."]
+ pruneopts = ""
revision = "2e65f85255dbc3072edf28d6b5b8efc472979f5a"
[[projects]]
branch = "master"
+ digest = "1:be28c0531a755f2178acf1e327e6f5a8a3968feb5f2567cdc968064253141751"
name = "github.com/google/btree"
packages = ["."]
+ pruneopts = ""
revision = "e89373fe6b4a7413d7acd6da1725b83ef713e6e4"
[[projects]]
branch = "master"
+ digest = "1:754f77e9c839b24778a4b64422236d38515301d2baeb63113aa3edc42e6af692"
name = "github.com/google/gofuzz"
packages = ["."]
+ pruneopts = ""
revision = "24818f796faf91cd76ec7bddd72458fbced7a6c1"
[[projects]]
+ digest = "1:16b2837c8b3cf045fa2cdc82af0cf78b19582701394484ae76b2c3bc3c99ad73"
name = "github.com/googleapis/gnostic"
packages = [
"OpenAPIv2",
"compiler",
- "extensions"
+ "extensions",
]
+ pruneopts = ""
revision = "7c663266750e7d82587642f65e60bc4083f1f84e"
version = "v0.2.0"
[[projects]]
branch = "master"
+ digest = "1:009a1928b8c096338b68b5822d838a72b4d8520715c1463614476359f3282ec8"
name = "github.com/gregjones/httpcache"
packages = [
".",
- "diskcache"
+ "diskcache",
]
+ pruneopts = ""
revision = "9cad4c3443a7200dd6400aef47183728de563a38"
[[projects]]
branch = "master"
+ digest = "1:0c93b4970c254d3f8f76c3e8eb72571d6f24a15415f9c418ecb0801ba5765a90"
name = "github.com/grpc-ecosystem/grpc-opentracing"
packages = ["go/otgrpc"]
+ pruneopts = ""
revision = "8e809c8a86450a29b90dcc9efbf062d0fe6d9746"
[[projects]]
branch = "master"
+ digest = "1:9c776d7d9c54b7ed89f119e449983c3f24c0023e75001d6092442412ebca6b94"
name = "github.com/hashicorp/golang-lru"
packages = [
".",
- "simplelru"
+ "simplelru",
]
+ pruneopts = ""
revision = "0fb14efe8c47ae851c0034ed7a448854d3d34cf3"
[[projects]]
+ digest = "1:302c6eb8e669c997bec516a138b8fc496018faa1ece4c13e445a2749fbe079bb"
name = "github.com/imdario/mergo"
packages = ["."]
+ pruneopts = ""
revision = "9316a62528ac99aaecb4e47eadd6dc8aa6533d58"
version = "v0.3.5"
[[projects]]
+ digest = "1:6f49eae0c1e5dab1dafafee34b207aeb7a42303105960944828c2079b92fc88e"
name = "github.com/jmespath/go-jmespath"
packages = ["."]
+ pruneopts = ""
revision = "0b12d6b5"
[[projects]]
+ digest = "1:53ac4e911e12dde0ab68655e2006449d207a5a681f084974da2b06e5dbeaca72"
name = "github.com/json-iterator/go"
packages = ["."]
+ pruneopts = ""
revision = "ab8a2e0c74be9d3be70b3184d9acc634935ded82"
version = "1.1.4"
[[projects]]
branch = "master"
+ digest = "1:1ed9eeebdf24aadfbca57eb50e6455bd1d2474525e0f0d4454de8c8e9bc7ee9a"
name = "github.com/kr/logfmt"
packages = ["."]
+ pruneopts = ""
revision = "b84e30acd515aadc4b783ad4ff83aff3299bdfe0"
[[projects]]
+ digest = "1:63722a4b1e1717be7b98fc686e0b30d5e7f734b9e93d7dee86293b6deab7ea28"
name = "github.com/matttproud/golang_protobuf_extensions"
packages = ["pbutil"]
+ pruneopts = ""
revision = "c12348ce28de40eed0136aa2b644d0ee0650e56c"
version = "v1.0.1"
[[projects]]
+ digest = "1:0c0ff2a89c1bb0d01887e1dac043ad7efbf3ec77482ef058ac423d13497e16fd"
name = "github.com/modern-go/concurrent"
packages = ["."]
+ pruneopts = ""
revision = "bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94"
version = "1.0.3"
[[projects]]
+ digest = "1:e32bdbdb7c377a07a9a46378290059822efdce5c8d96fe71940d87cb4f918855"
name = "github.com/modern-go/reflect2"
packages = ["."]
+ pruneopts = ""
revision = "4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd"
version = "1.0.1"
[[projects]]
branch = "master"
+ digest = "1:2da0e5077ed40453dc281b9a2428d84cf6ad14063aed189f6296ca5dd25cf13d"
name = "github.com/opentracing-contrib/go-observer"
packages = ["."]
+ pruneopts = ""
revision = "a52f2342449246d5bcc273e65cbdcfa5f7d6c63c"
[[projects]]
+ digest = "1:78fb99d6011c2ae6c72f3293a83951311147b12b06a5ffa43abf750c4fab6ac5"
name = "github.com/opentracing/opentracing-go"
packages = [
".",
"ext",
- "log"
+ "log",
]
+ pruneopts = ""
revision = "1949ddbfd147afd4d964a9f00b24eb291e0e7c38"
version = "v1.0.2"
[[projects]]
+ digest = "1:fea0e67285d900e5a0a7ec19ff4b4c82865a28dddbee8454c5360ad908f7069c"
name = "github.com/openzipkin/zipkin-go-opentracing"
packages = [
".",
@@ -271,73 +338,93 @@
"thrift/gen-go/scribe",
"thrift/gen-go/zipkincore",
"types",
- "wire"
+ "wire",
]
+ pruneopts = ""
revision = "26cf9707480e6b90e5eff22cf0bbf05319154232"
version = "v0.3.4"
[[projects]]
branch = "master"
+ digest = "1:c24598ffeadd2762552269271b3b1510df2d83ee6696c1e543a0ff653af494bc"
name = "github.com/petar/GoLLRB"
packages = ["llrb"]
+ pruneopts = ""
revision = "53be0d36a84c2a886ca057d34b6aa4468df9ccb4"
[[projects]]
+ digest = "1:b46305723171710475f2dd37547edd57b67b9de9f2a6267cafdd98331fd6897f"
name = "github.com/peterbourgon/diskv"
packages = ["."]
+ pruneopts = ""
revision = "5f041e8faa004a95c88a202771f4cc3e991971e6"
version = "v2.0.1"
[[projects]]
+ digest = "1:29e34e58f26655c4d73135cdfc0517ea2ff1483eff34e5d5ef4b6fddbb81e31b"
name = "github.com/pierrec/lz4"
packages = [
".",
- "internal/xxh32"
+ "internal/xxh32",
]
+ pruneopts = ""
revision = "1958fd8fff7f115e79725b1288e0b878b3e06b00"
version = "v2.0.3"
[[projects]]
branch = "master"
+ digest = "1:60aca47f4eeeb972f1b9da7e7db51dee15ff6c59f7b401c1588b8e6771ba15ef"
name = "github.com/prometheus/client_model"
packages = ["go"]
+ pruneopts = ""
revision = "99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c"
[[projects]]
branch = "master"
+ digest = "1:bfbc121ef802d245ef67421cff206615357d9202337a3d492b8f668906b485a8"
name = "github.com/prometheus/common"
packages = [
"expfmt",
"internal/bitbucket.org/ww/goautoneg",
- "model"
+ "model",
]
+ pruneopts = ""
revision = "7600349dcfe1abd18d72d3a1770870d9800a7801"
[[projects]]
branch = "master"
+ digest = "1:15bcdc717654ef21128e8af3a63eec39a6d08a830e297f93d65163f87c8eb523"
name = "github.com/rcrowley/go-metrics"
packages = ["."]
+ pruneopts = ""
revision = "e2704e165165ec55d062f5919b4b29494e9fa790"
[[projects]]
+ digest = "1:8e243c568f36b09031ec18dff5f7d2769dcf5ca4d624ea511c8e3197dc3d352d"
name = "github.com/spf13/pflag"
packages = ["."]
+ pruneopts = ""
revision = "583c0c0531f06d5278b7d917446061adc344b5cd"
version = "v1.0.1"
[[projects]]
+ digest = "1:bfc538280d91f15c117ed9cd9c1c24ced21999c2945c6982d338a6fd207592ce"
name = "github.com/ugorji/go"
packages = ["codec"]
+ pruneopts = ""
revision = "f3cacc17c85ecb7f1b6a9e373ee85d1480919868"
[[projects]]
branch = "master"
+ digest = "1:6ef14be530be39b6b9d75d54ce1d546ae9231e652d9e3eef198cbb19ce8ed3e7"
name = "golang.org/x/crypto"
packages = ["ssh/terminal"]
+ pruneopts = ""
revision = "a49355c7e3f8fe157a85be2f77e6e269a0f89602"
[[projects]]
branch = "master"
+ digest = "1:cef4c63f5c97c27ab65498fd8de6661df17b31e40cd3b4f6f1e217e97f0e23f3"
name = "golang.org/x/net"
packages = [
"context",
@@ -346,20 +433,24 @@
"http2/hpack",
"idna",
"internal/timeseries",
- "trace"
+ "trace",
]
+ pruneopts = ""
revision = "4cb1c02c05b0e749b0365f61ae859a8e0cfceed9"
[[projects]]
branch = "master"
+ digest = "1:274e6fab68b7f298bf3f70bd60d4ba0c55284d1d2034175fb3324924268ccd9e"
name = "golang.org/x/sys"
packages = [
"unix",
- "windows"
+ "windows",
]
+ pruneopts = ""
revision = "7138fd3d9dc8335c567ca206f4333fb75eb05d56"
[[projects]]
+ digest = "1:5acd3512b047305d49e8763eef7ba423901e85d5dd2fd1e71778a0ea8de10bd4"
name = "golang.org/x/text"
packages = [
"collate",
@@ -375,24 +466,30 @@
"unicode/bidi",
"unicode/cldr",
"unicode/norm",
- "unicode/rangetable"
+ "unicode/rangetable",
]
+ pruneopts = ""
revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
version = "v0.3.0"
[[projects]]
branch = "master"
+ digest = "1:55a681cb66f28755765fa5fa5104cbd8dc85c55c02d206f9f89566451e3fe1aa"
name = "golang.org/x/time"
packages = ["rate"]
+ pruneopts = ""
revision = "fbb02b2291d28baffd63558aa44b4b56f178d650"
[[projects]]
branch = "master"
+ digest = "1:a5959f4640612317b0d3122569b7c02565ba6277aa0374cff2ed610c81ef8d74"
name = "google.golang.org/genproto"
packages = ["googleapis/rpc/status"]
+ pruneopts = ""
revision = "ff3583edef7de132f219f0efc00e097cabcc0ec0"
[[projects]]
+ digest = "1:5f31b45ee9da7a87f140bef3ed0a7ca34ea2a6d38eb888123b8e28170e8aa4f2"
name = "google.golang.org/grpc"
packages = [
".",
@@ -420,24 +517,30 @@
"stats",
"status",
"tap",
- "transport"
+ "transport",
]
+ pruneopts = ""
revision = "168a6198bcb0ef175f7dacec0b8691fc141dc9b8"
version = "v1.13.0"
[[projects]]
+ digest = "1:75fb3fcfc73a8c723efde7777b40e8e8ff9babf30d8c56160d01beffea8a95a6"
name = "gopkg.in/inf.v0"
packages = ["."]
+ pruneopts = ""
revision = "d2d2541c53f18d2a059457998ce2876cc8e67cbf"
version = "v0.9.1"
[[projects]]
+ digest = "1:f0620375dd1f6251d9973b5f2596228cc8042e887cd7f827e4220bc1ce8c30e2"
name = "gopkg.in/yaml.v2"
packages = ["."]
+ pruneopts = ""
revision = "5420a8b6744d3b0345ab293f6fcba19c978f1183"
version = "v2.2.1"
[[projects]]
+ digest = "1:f420c8548c93242d8e5dcfa5b34e0243883b4e660f65076e869daafac877144d"
name = "k8s.io/api"
packages = [
"admissionregistration/v1alpha1",
@@ -468,11 +571,13 @@
"settings/v1alpha1",
"storage/v1",
"storage/v1alpha1",
- "storage/v1beta1"
+ "storage/v1beta1",
]
+ pruneopts = ""
revision = "072894a440bdee3a891dea811fe42902311cd2a3"
[[projects]]
+ digest = "1:b6b2fb7b4da1ac973b64534ace2299a02504f16bc7820cb48edb8ca4077183e1"
name = "k8s.io/apimachinery"
packages = [
"pkg/api/errors",
@@ -515,11 +620,13 @@
"pkg/version",
"pkg/watch",
"third_party/forked/golang/json",
- "third_party/forked/golang/reflect"
+ "third_party/forked/golang/reflect",
]
+ pruneopts = ""
revision = "103fd098999dc9c0c88536f5c9ad2e5da39373ae"
[[projects]]
+ digest = "1:d04779a8de7d5465e0463bd986506348de5e89677c74777f695d3145a7a8d15e"
name = "k8s.io/client-go"
packages = [
"discovery",
@@ -609,20 +716,57 @@
"util/flowcontrol",
"util/homedir",
"util/integer",
- "util/retry"
+ "util/retry",
]
+ pruneopts = ""
revision = "7d04d0e2a0a1a4d4a1cd6baa432a2301492e4e65"
version = "v8.0.0"
[[projects]]
branch = "master"
+ digest = "1:7b06ff480fd71dead51f0f243b573c448c372ec086b790ec7ed4f8a78f2c1cbf"
name = "k8s.io/kube-openapi"
packages = ["pkg/util/proto"]
+ pruneopts = ""
revision = "9dfdf9be683f61f82cda12362c44c784e0778b56"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
- inputs-digest = "ca446af2026e042acf8d1bb2014aee378cdd577c43d96a75b52e51b4ec4e85ad"
+ input-imports = [
+ "github.com/DataDog/dd-trace-go/opentracing",
+ "github.com/aws/aws-sdk-go/aws",
+ "github.com/aws/aws-sdk-go/aws/credentials",
+ "github.com/aws/aws-sdk-go/aws/request",
+ "github.com/aws/aws-sdk-go/aws/session",
+ "github.com/aws/aws-sdk-go/service/route53",
+ "github.com/aws/aws-sdk-go/service/route53/route53iface",
+ "github.com/coreos/etcd/clientv3",
+ "github.com/coreos/etcd/mvcc/mvccpb",
+ "github.com/dnstap/golang-dnstap",
+ "github.com/farsightsec/golang-framestream",
+ "github.com/golang/protobuf/proto",
+ "github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc",
+ "github.com/matttproud/golang_protobuf_extensions/pbutil",
+ "github.com/opentracing/opentracing-go",
+ "github.com/openzipkin/zipkin-go-opentracing",
+ "github.com/prometheus/client_model/go",
+ "github.com/prometheus/common/expfmt",
+ "google.golang.org/grpc",
+ "google.golang.org/grpc/credentials",
+ "google.golang.org/grpc/grpclog",
+ "google.golang.org/grpc/peer",
+ "k8s.io/api/core/v1",
+ "k8s.io/apimachinery/pkg/apis/meta/v1",
+ "k8s.io/apimachinery/pkg/labels",
+ "k8s.io/apimachinery/pkg/runtime",
+ "k8s.io/apimachinery/pkg/watch",
+ "k8s.io/client-go/kubernetes",
+ "k8s.io/client-go/kubernetes/fake",
+ "k8s.io/client-go/rest",
+ "k8s.io/client-go/tools/cache",
+ "k8s.io/client-go/tools/clientcmd",
+ "k8s.io/client-go/tools/clientcmd/api",
+ ]
solver-name = "gps-cdcl"
solver-version = 1
diff --git a/Makefile b/Makefile
index 7ef204335..e79c9f799 100644
--- a/Makefile
+++ b/Makefile
@@ -96,3 +96,10 @@ presubmit:
clean:
go clean
rm -f coredns
+
+.PHONY: dep-ensure
+dep-ensure:
+ dep version || go get -u github.com/golang/dep/cmd/dep
+ dep ensure -v
+ dep prune -v
+ find vendor -name '*_test.go' -delete
diff --git a/vendor/github.com/DataDog/dd-trace-go/opentracing/config_test.go b/vendor/github.com/DataDog/dd-trace-go/opentracing/config_test.go
deleted file mode 100644
index 849965d0c..000000000
--- a/vendor/github.com/DataDog/dd-trace-go/opentracing/config_test.go
+++ /dev/null
@@ -1,58 +0,0 @@
-package opentracing
-
-import (
- "testing"
-
- ot "github.com/opentracing/opentracing-go"
- "github.com/stretchr/testify/assert"
-)
-
-func TestConfigurationDefaults(t *testing.T) {
- assert := assert.New(t)
-
- config := NewConfiguration()
- assert.Equal(true, config.Enabled)
- assert.Equal(false, config.Debug)
- assert.Equal(float64(1), config.SampleRate)
- assert.Equal("opentracing.test", config.ServiceName)
- assert.Equal("localhost", config.AgentHostname)
- assert.Equal("8126", config.AgentPort)
-}
-
-func TestConfiguration(t *testing.T) {
- assert := assert.New(t)
-
- config := NewConfiguration()
- config.SampleRate = 0
- config.ServiceName = "api-intake"
- config.AgentHostname = "ddagent.consul.local"
- config.AgentPort = "58126"
- tracer, closer, err := NewTracer(config)
- assert.NotNil(tracer)
- assert.NotNil(closer)
- assert.Nil(err)
- assert.Equal("api-intake", tracer.(*Tracer).config.ServiceName)
-}
-
-func TestTracerServiceName(t *testing.T) {
- assert := assert.New(t)
-
- config := NewConfiguration()
- config.ServiceName = ""
- tracer, closer, err := NewTracer(config)
- assert.Nil(tracer)
- assert.Nil(closer)
- assert.NotNil(err)
- assert.Equal("A Datadog Tracer requires a valid `ServiceName` set", err.Error())
-}
-
-func TestDisabledTracer(t *testing.T) {
- assert := assert.New(t)
-
- config := NewConfiguration()
- config.Enabled = false
- tracer, closer, err := NewTracer(config)
- assert.IsType(&ot.NoopTracer{}, tracer)
- assert.IsType(&noopCloser{}, closer)
- assert.Nil(err)
-}
diff --git a/vendor/github.com/DataDog/dd-trace-go/opentracing/context_test.go b/vendor/github.com/DataDog/dd-trace-go/opentracing/context_test.go
deleted file mode 100644
index df0ca836a..000000000
--- a/vendor/github.com/DataDog/dd-trace-go/opentracing/context_test.go
+++ /dev/null
@@ -1,29 +0,0 @@
-package opentracing
-
-import (
- "testing"
-
- "github.com/stretchr/testify/assert"
-)
-
-func TestSpanContextBaggage(t *testing.T) {
- assert := assert.New(t)
-
- ctx := SpanContext{}
- ctx = ctx.WithBaggageItem("key", "value")
- assert.Equal("value", ctx.baggage["key"])
-}
-
-func TestSpanContextIterator(t *testing.T) {
- assert := assert.New(t)
-
- baggageIterator := make(map[string]string)
- ctx := SpanContext{baggage: map[string]string{"key": "value"}}
- ctx.ForeachBaggageItem(func(k, v string) bool {
- baggageIterator[k] = v
- return true
- })
-
- assert.Len(baggageIterator, 1)
- assert.Equal("value", baggageIterator["key"])
-}
diff --git a/vendor/github.com/DataDog/dd-trace-go/opentracing/example_context_test.go b/vendor/github.com/DataDog/dd-trace-go/opentracing/example_context_test.go
deleted file mode 100644
index a312f20ad..000000000
--- a/vendor/github.com/DataDog/dd-trace-go/opentracing/example_context_test.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package opentracing_test
-
-import (
- "context"
-
- opentracing "github.com/opentracing/opentracing-go"
-)
-
-// You can leverage the Golang `Context` for intra-process propagation of
-// Spans. In this example we create a root Span, so that it can be reused
-// in a nested function to create a child Span.
-func Example_startContext() {
- // create a new root Span and return a new Context that includes
- // the Span itself
- ctx := context.Background()
- rootSpan, ctx := opentracing.StartSpanFromContext(ctx, "web.request")
- defer rootSpan.Finish()
-
- requestHandler(ctx)
-}
-
-func requestHandler(ctx context.Context) {
- // retrieve the previously set root Span
- span := opentracing.SpanFromContext(ctx)
- span.SetTag("resource.name", "/")
-
- // or simply create a new child Span from the previous Context
- childSpan, _ := opentracing.StartSpanFromContext(ctx, "sql.query")
- defer childSpan.Finish()
-}
diff --git a/vendor/github.com/DataDog/dd-trace-go/opentracing/example_test.go b/vendor/github.com/DataDog/dd-trace-go/opentracing/example_test.go
deleted file mode 100644
index 18f2c8b65..000000000
--- a/vendor/github.com/DataDog/dd-trace-go/opentracing/example_test.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package opentracing_test
-
-import (
- // ddtrace namespace is suggested
- ddtrace "github.com/DataDog/dd-trace-go/opentracing"
- opentracing "github.com/opentracing/opentracing-go"
-)
-
-func Example_initialization() {
- // create a Tracer configuration
- config := ddtrace.NewConfiguration()
- config.ServiceName = "api-intake"
- config.AgentHostname = "ddagent.consul.local"
-
- // initialize a Tracer and ensure a graceful shutdown
- // using the `closer.Close()`
- tracer, closer, err := ddtrace.NewTracer(config)
- if err != nil {
- // handle the configuration error
- }
- defer closer.Close()
-
- // set the Datadog tracer as a GlobalTracer
- opentracing.SetGlobalTracer(tracer)
- startWebServer()
-}
-
-func startWebServer() {
- // start a web server
-}
diff --git a/vendor/github.com/DataDog/dd-trace-go/opentracing/example_tracing_test.go b/vendor/github.com/DataDog/dd-trace-go/opentracing/example_tracing_test.go
deleted file mode 100644
index a8a207378..000000000
--- a/vendor/github.com/DataDog/dd-trace-go/opentracing/example_tracing_test.go
+++ /dev/null
@@ -1,24 +0,0 @@
-package opentracing_test
-
-import (
- opentracing "github.com/opentracing/opentracing-go"
-)
-
-// You can use the GlobalTracer to create a root Span. If you need to create a hierarchy,
-// simply use the `ChildOf` reference
-func Example_startSpan() {
- // use the GlobalTracer previously set
- rootSpan := opentracing.StartSpan("web.request")
- defer rootSpan.Finish()
-
- // set the reference to create a hierarchy of spans
- reference := opentracing.ChildOf(rootSpan.Context())
- childSpan := opentracing.StartSpan("sql.query", reference)
- defer childSpan.Finish()
-
- dbQuery()
-}
-
-func dbQuery() {
- // start a database query
-}
diff --git a/vendor/github.com/DataDog/dd-trace-go/opentracing/propagators_test.go b/vendor/github.com/DataDog/dd-trace-go/opentracing/propagators_test.go
deleted file mode 100644
index 2c276ddc0..000000000
--- a/vendor/github.com/DataDog/dd-trace-go/opentracing/propagators_test.go
+++ /dev/null
@@ -1,81 +0,0 @@
-package opentracing
-
-import (
- "net/http"
- "strconv"
- "testing"
-
- opentracing "github.com/opentracing/opentracing-go"
- "github.com/stretchr/testify/assert"
-)
-
-func TestTracerPropagationDefaults(t *testing.T) {
- assert := assert.New(t)
-
- config := NewConfiguration()
- tracer, _, _ := NewTracer(config)
-
- root := tracer.StartSpan("web.request")
- ctx := root.Context()
- headers := http.Header{}
-
- // inject the SpanContext
- carrier := opentracing.HTTPHeadersCarrier(headers)
- err := tracer.Inject(ctx, opentracing.HTTPHeaders, carrier)
- assert.Nil(err)
-
- // retrieve the SpanContext
- propagated, err := tracer.Extract(opentracing.HTTPHeaders, carrier)
- assert.Nil(err)
-
- tCtx, ok := ctx.(SpanContext)
- assert.True(ok)
- tPropagated, ok := propagated.(SpanContext)
- assert.True(ok)
-
- // compare if there is a Context match
- assert.Equal(tCtx.traceID, tPropagated.traceID)
- assert.Equal(tCtx.spanID, tPropagated.spanID)
-
- // ensure a child can be created
- child := tracer.StartSpan("db.query", opentracing.ChildOf(propagated))
- tRoot, ok := root.(*Span)
- assert.True(ok)
- tChild, ok := child.(*Span)
- assert.True(ok)
-
- assert.NotEqual(uint64(0), tChild.Span.TraceID)
- assert.NotEqual(uint64(0), tChild.Span.SpanID)
- assert.Equal(tRoot.Span.SpanID, tChild.Span.ParentID)
- assert.Equal(tRoot.Span.TraceID, tChild.Span.ParentID)
-
- tid := strconv.FormatUint(tRoot.Span.TraceID, 10)
- pid := strconv.FormatUint(tRoot.Span.SpanID, 10)
-
- // hardcode header names to fail test if defaults are changed
- assert.Equal(headers.Get("x-datadog-trace-id"), tid)
- assert.Equal(headers.Get("x-datadog-parent-id"), pid)
-}
-
-func TestTracerTextMapPropagationHeader(t *testing.T) {
- assert := assert.New(t)
-
- config := NewConfiguration()
- config.TextMapPropagator = NewTextMapPropagator("bg-", "tid", "pid")
- tracer, _, _ := NewTracer(config)
-
- root := tracer.StartSpan("web.request").SetBaggageItem("item", "x").(*Span)
- ctx := root.Context()
- headers := http.Header{}
-
- carrier := opentracing.HTTPHeadersCarrier(headers)
- err := tracer.Inject(ctx, opentracing.HTTPHeaders, carrier)
- assert.Nil(err)
-
- tid := strconv.FormatUint(root.Span.TraceID, 10)
- pid := strconv.FormatUint(root.Span.SpanID, 10)
-
- assert.Equal(headers.Get("tid"), tid)
- assert.Equal(headers.Get("pid"), pid)
- assert.Equal(headers.Get("bg-item"), "x")
-}
diff --git a/vendor/github.com/DataDog/dd-trace-go/opentracing/span_test.go b/vendor/github.com/DataDog/dd-trace-go/opentracing/span_test.go
deleted file mode 100644
index 2154b5b19..000000000
--- a/vendor/github.com/DataDog/dd-trace-go/opentracing/span_test.go
+++ /dev/null
@@ -1,129 +0,0 @@
-package opentracing
-
-import (
- "errors"
- "testing"
- "time"
-
- opentracing "github.com/opentracing/opentracing-go"
- "github.com/stretchr/testify/assert"
-)
-
-func TestSpanBaggage(t *testing.T) {
- assert := assert.New(t)
-
- span := NewSpan("web.request")
- span.SetBaggageItem("key", "value")
- assert.Equal("value", span.BaggageItem("key"))
-}
-
-func TestSpanContext(t *testing.T) {
- assert := assert.New(t)
-
- span := NewSpan("web.request")
- assert.NotNil(span.Context())
-}
-
-func TestSpanOperationName(t *testing.T) {
- assert := assert.New(t)
-
- span := NewSpan("web.request")
- span.SetOperationName("http.request")
- assert.Equal("http.request", span.Span.Name)
-}
-
-func TestSpanFinish(t *testing.T) {
- assert := assert.New(t)
-
- span := NewSpan("web.request")
- span.Finish()
-
- assert.True(span.Span.Duration > 0)
-}
-
-func TestSpanFinishWithTime(t *testing.T) {
- assert := assert.New(t)
-
- finishTime := time.Now().Add(10 * time.Second)
- span := NewSpan("web.request")
- span.FinishWithOptions(opentracing.FinishOptions{FinishTime: finishTime})
-
- duration := finishTime.UnixNano() - span.Span.Start
- assert.Equal(duration, span.Span.Duration)
-}
-
-func TestSpanSetTag(t *testing.T) {
- assert := assert.New(t)
-
- span := NewSpan("web.request")
- span.SetTag("component", "tracer")
- assert.Equal("tracer", span.Meta["component"])
-
- span.SetTag("tagInt", 1234)
- assert.Equal("1234", span.Meta["tagInt"])
-}
-
-func TestSpanSetDatadogTags(t *testing.T) {
- assert := assert.New(t)
-
- span := NewSpan("web.request")
- span.SetTag("span.type", "http")
- span.SetTag("service.name", "db-cluster")
- span.SetTag("resource.name", "SELECT * FROM users;")
-
- assert.Equal("http", span.Span.Type)
- assert.Equal("db-cluster", span.Span.Service)
- assert.Equal("SELECT * FROM users;", span.Span.Resource)
-}
-
-func TestSpanSetErrorTag(t *testing.T) {
- assert := assert.New(t)
-
- for _, tt := range []struct {
- name string // span name
- val interface{} // tag value
- msg string // error message
- typ string // error type
- }{
- {
- name: "error.error",
- val: errors.New("some error"),
- msg: "some error",
- typ: "*errors.errorString",
- },
- {
- name: "error.string",
- val: "some string error",
- msg: "some string error",
- typ: "*errors.errorString",
- },
- {
- name: "error.struct",
- val: struct{ N int }{5},
- msg: "{5}",
- typ: "*errors.errorString",
- },
- {
- name: "error.other",
- val: 1,
- msg: "1",
- typ: "*errors.errorString",
- },
- {
- name: "error.nil",
- val: nil,
- msg: "",
- typ: "",
- },
- } {
- span := NewSpan(tt.name)
- span.SetTag(Error, tt.val)
-
- assert.Equal(span.Meta["error.msg"], tt.msg)
- assert.Equal(span.Meta["error.type"], tt.typ)
-
- if tt.val != nil {
- assert.NotEqual(span.Meta["error.stack"], "")
- }
- }
-}
diff --git a/vendor/github.com/DataDog/dd-trace-go/opentracing/tracer_test.go b/vendor/github.com/DataDog/dd-trace-go/opentracing/tracer_test.go
deleted file mode 100644
index a083dc43f..000000000
--- a/vendor/github.com/DataDog/dd-trace-go/opentracing/tracer_test.go
+++ /dev/null
@@ -1,131 +0,0 @@
-package opentracing
-
-import (
- "testing"
- "time"
-
- ddtrace "github.com/DataDog/dd-trace-go/tracer"
- opentracing "github.com/opentracing/opentracing-go"
- "github.com/stretchr/testify/assert"
-)
-
-func TestDefaultTracer(t *testing.T) {
- assert := assert.New(t)
-
- config := NewConfiguration()
- tracer, _, _ := NewTracer(config)
- tTracer, ok := tracer.(*Tracer)
- assert.True(ok)
-
- assert.Equal(tTracer.impl, ddtrace.DefaultTracer)
-}
-
-func TestTracerStartSpan(t *testing.T) {
- assert := assert.New(t)
-
- config := NewConfiguration()
- tracer, _, _ := NewTracer(config)
-
- span, ok := tracer.StartSpan("web.request").(*Span)
- assert.True(ok)
-
- assert.NotEqual(uint64(0), span.Span.TraceID)
- assert.NotEqual(uint64(0), span.Span.SpanID)
- assert.Equal(uint64(0), span.Span.ParentID)
- assert.Equal("web.request", span.Span.Name)
- assert.Equal("opentracing.test", span.Span.Service)
- assert.NotNil(span.Span.Tracer())
-}
-
-func TestTracerStartChildSpan(t *testing.T) {
- assert := assert.New(t)
-
- config := NewConfiguration()
- tracer, _, _ := NewTracer(config)
-
- root := tracer.StartSpan("web.request")
- child := tracer.StartSpan("db.query", opentracing.ChildOf(root.Context()))
- tRoot, ok := root.(*Span)
- assert.True(ok)
- tChild, ok := child.(*Span)
- assert.True(ok)
-
- assert.NotEqual(uint64(0), tChild.Span.TraceID)
- assert.NotEqual(uint64(0), tChild.Span.SpanID)
- assert.Equal(tRoot.Span.SpanID, tChild.Span.ParentID)
- assert.Equal(tRoot.Span.TraceID, tChild.Span.ParentID)
-}
-
-func TestTracerBaggagePropagation(t *testing.T) {
- assert := assert.New(t)
-
- config := NewConfiguration()
- tracer, _, _ := NewTracer(config)
-
- root := tracer.StartSpan("web.request")
- root.SetBaggageItem("key", "value")
- child := tracer.StartSpan("db.query", opentracing.ChildOf(root.Context()))
- context, ok := child.Context().(SpanContext)
- assert.True(ok)
-
- assert.Equal("value", context.baggage["key"])
-}
-
-func TestTracerBaggageImmutability(t *testing.T) {
- assert := assert.New(t)
-
- config := NewConfiguration()
- tracer, _, _ := NewTracer(config)
-
- root := tracer.StartSpan("web.request")
- root.SetBaggageItem("key", "value")
- child := tracer.StartSpan("db.query", opentracing.ChildOf(root.Context()))
- child.SetBaggageItem("key", "changed!")
- parentContext, ok := root.Context().(SpanContext)
- assert.True(ok)
- childContext, ok := child.Context().(SpanContext)
- assert.True(ok)
-
- assert.Equal("value", parentContext.baggage["key"])
- assert.Equal("changed!", childContext.baggage["key"])
-}
-
-func TestTracerSpanTags(t *testing.T) {
- assert := assert.New(t)
-
- config := NewConfiguration()
- tracer, _, _ := NewTracer(config)
-
- tag := opentracing.Tag{Key: "key", Value: "value"}
- span, ok := tracer.StartSpan("web.request", tag).(*Span)
- assert.True(ok)
-
- assert.Equal("value", span.Span.Meta["key"])
-}
-
-func TestTracerSpanGlobalTags(t *testing.T) {
- assert := assert.New(t)
-
- config := NewConfiguration()
- config.GlobalTags["key"] = "value"
- tracer, _, _ := NewTracer(config)
-
- span := tracer.StartSpan("web.request").(*Span)
- assert.Equal("value", span.Span.Meta["key"])
-
- child := tracer.StartSpan("db.query", opentracing.ChildOf(span.Context())).(*Span)
- assert.Equal("value", child.Span.Meta["key"])
-}
-
-func TestTracerSpanStartTime(t *testing.T) {
- assert := assert.New(t)
-
- config := NewConfiguration()
- tracer, _, _ := NewTracer(config)
-
- startTime := time.Now().Add(-10 * time.Second)
- span, ok := tracer.StartSpan("web.request", opentracing.StartTime(startTime)).(*Span)
- assert.True(ok)
-
- assert.Equal(startTime.UnixNano(), span.Span.Start)
-}
diff --git a/vendor/github.com/DataDog/dd-trace-go/tracer/buffer_test.go b/vendor/github.com/DataDog/dd-trace-go/tracer/buffer_test.go
deleted file mode 100644
index 10608a65e..000000000
--- a/vendor/github.com/DataDog/dd-trace-go/tracer/buffer_test.go
+++ /dev/null
@@ -1,105 +0,0 @@
-package tracer
-
-import (
- "testing"
- "time"
-
- "github.com/stretchr/testify/assert"
-)
-
-const (
- testInitSize = 2
- testMaxSize = 5
-)
-
-func TestSpanBufferPushOne(t *testing.T) {
- assert := assert.New(t)
-
- buffer := newSpanBuffer(newTracerChans(), testInitSize, testMaxSize)
- assert.NotNil(buffer)
- assert.Len(buffer.spans, 0)
-
- traceID := NextSpanID()
- root := NewSpan("name1", "a-service", "a-resource", traceID, traceID, 0, nil)
- root.buffer = buffer
-
- buffer.Push(root)
- assert.Len(buffer.spans, 1, "there is one span in the buffer")
- assert.Equal(root, buffer.spans[0], "the span is the one pushed before")
-
- root.Finish()
-
- select {
- case trace := <-buffer.channels.trace:
- assert.Len(trace, 1, "there was a trace in the channel")
- assert.Equal(root, trace[0], "the trace in the channel is the one pushed before")
- assert.Equal(0, buffer.Len(), "no more spans in the buffer")
- case err := <-buffer.channels.err:
- assert.Fail("unexpected error:", err.Error())
- t.Logf("buffer: %v", buffer)
- }
-}
-
-func TestSpanBufferPushNoFinish(t *testing.T) {
- assert := assert.New(t)
-
- buffer := newSpanBuffer(newTracerChans(), testInitSize, testMaxSize)
- assert.NotNil(buffer)
- assert.Len(buffer.spans, 0)
-
- traceID := NextSpanID()
- root := NewSpan("name1", "a-service", "a-resource", traceID, traceID, 0, nil)
- root.buffer = buffer
-
- buffer.Push(root)
- assert.Len(buffer.spans, 1, "there is one span in the buffer")
- assert.Equal(root, buffer.spans[0], "the span is the one pushed before")
-
- select {
- case <-buffer.channels.trace:
- assert.Fail("span was not finished, should not be flushed")
- t.Logf("buffer: %v", buffer)
- case err := <-buffer.channels.err:
- assert.Fail("unexpected error:", err.Error())
- t.Logf("buffer: %v", buffer)
- case <-time.After(time.Second / 10):
- t.Logf("expected timeout, nothing should show up in buffer as the trace is not finished")
- }
-}
-
-func TestSpanBufferPushSeveral(t *testing.T) {
- assert := assert.New(t)
-
- buffer := newSpanBuffer(newTracerChans(), testInitSize, testMaxSize)
- assert.NotNil(buffer)
- assert.Len(buffer.spans, 0)
-
- traceID := NextSpanID()
- root := NewSpan("name1", "a-service", "a-resource", traceID, traceID, 0, nil)
- span2 := NewSpan("name2", "a-service", "a-resource", NextSpanID(), traceID, root.SpanID, nil)
- span3 := NewSpan("name3", "a-service", "a-resource", NextSpanID(), traceID, root.SpanID, nil)
- span3a := NewSpan("name3", "a-service", "a-resource", NextSpanID(), traceID, span3.SpanID, nil)
-
- spans := []*Span{root, span2, span3, span3a}
-
- for i, span := range spans {
- span.buffer = buffer
- buffer.Push(span)
- assert.Len(buffer.spans, i+1, "there is one more span in the buffer")
- assert.Equal(span, buffer.spans[i], "the span is the one pushed before")
- }
-
- for _, span := range spans {
- span.Finish()
- }
-
- select {
- case trace := <-buffer.channels.trace:
- assert.Len(trace, 4, "there was one trace with the right number of spans in the channel")
- for _, span := range spans {
- assert.Contains(trace, span, "the trace contains the spans")
- }
- case err := <-buffer.channels.err:
- assert.Fail("unexpected error:", err.Error())
- }
-}
diff --git a/vendor/github.com/DataDog/dd-trace-go/tracer/channels_test.go b/vendor/github.com/DataDog/dd-trace-go/tracer/channels_test.go
deleted file mode 100644
index 6cf71ed85..000000000
--- a/vendor/github.com/DataDog/dd-trace-go/tracer/channels_test.go
+++ /dev/null
@@ -1,117 +0,0 @@
-package tracer
-
-import (
- "fmt"
- "testing"
-
- "github.com/stretchr/testify/assert"
-)
-
-func TestPushTrace(t *testing.T) {
- assert := assert.New(t)
-
- channels := newTracerChans()
-
- trace := []*Span{
- &Span{
- Name: "pylons.request",
- Service: "pylons",
- Resource: "/",
- },
- &Span{
- Name: "pylons.request",
- Service: "pylons",
- Resource: "/foo",
- },
- }
- channels.pushTrace(trace)
-
- assert.Len(channels.trace, 1, "there should be data in channel")
- assert.Len(channels.traceFlush, 0, "no flush requested yet")
-
- pushed := <-channels.trace
- assert.Equal(trace, pushed)
-
- many := traceChanLen/2 + 1
- for i := 0; i < many; i++ {
- channels.pushTrace(make([]*Span, i))
- }
- assert.Len(channels.trace, many, "all traces should be in the channel, not yet blocking")
- assert.Len(channels.traceFlush, 1, "a trace flush should have been requested")
-
- for i := 0; i < cap(channels.trace); i++ {
- channels.pushTrace(make([]*Span, i))
- }
- assert.Len(channels.trace, traceChanLen, "buffer should be full")
- assert.NotEqual(0, len(channels.err), "there should be an error logged")
- err := <-channels.err
- assert.Equal(&errorTraceChanFull{Len: traceChanLen}, err)
-}
-
-func TestPushService(t *testing.T) {
- assert := assert.New(t)
-
- channels := newTracerChans()
-
- service := Service{
- Name: "redis-master",
- App: "redis",
- AppType: "db",
- }
- channels.pushService(service)
-
- assert.Len(channels.service, 1, "there should be data in channel")
- assert.Len(channels.serviceFlush, 0, "no flush requested yet")
-
- pushed := <-channels.service
- assert.Equal(service, pushed)
-
- many := serviceChanLen/2 + 1
- for i := 0; i < many; i++ {
- channels.pushService(Service{
- Name: fmt.Sprintf("service%d", i),
- App: "custom",
- AppType: "web",
- })
- }
- assert.Len(channels.service, many, "all services should be in the channel, not yet blocking")
- assert.Len(channels.serviceFlush, 1, "a service flush should have been requested")
-
- for i := 0; i < cap(channels.service); i++ {
- channels.pushService(Service{
- Name: fmt.Sprintf("service%d", i),
- App: "custom",
- AppType: "web",
- })
- }
- assert.Len(channels.service, serviceChanLen, "buffer should be full")
- assert.NotEqual(0, len(channels.err), "there should be an error logged")
- err := <-channels.err
- assert.Equal(&errorServiceChanFull{Len: serviceChanLen}, err)
-}
-
-func TestPushErr(t *testing.T) {
- assert := assert.New(t)
-
- channels := newTracerChans()
-
- err := fmt.Errorf("ooops")
- channels.pushErr(err)
-
- assert.Len(channels.err, 1, "there should be data in channel")
- assert.Len(channels.errFlush, 0, "no flush requested yet")
-
- pushed := <-channels.err
- assert.Equal(err, pushed)
-
- many := errChanLen/2 + 1
- for i := 0; i < many; i++ {
- channels.pushErr(fmt.Errorf("err %d", i))
- }
- assert.Len(channels.err, many, "all errs should be in the channel, not yet blocking")
- assert.Len(channels.errFlush, 1, "a err flush should have been requested")
- for i := 0; i < cap(channels.err); i++ {
- channels.pushErr(fmt.Errorf("err %d", i))
- }
- // if we reach this, means pushErr is not blocking, which is what we want to double-check
-}
diff --git a/vendor/github.com/DataDog/dd-trace-go/tracer/context_test.go b/vendor/github.com/DataDog/dd-trace-go/tracer/context_test.go
deleted file mode 100644
index e48c251fa..000000000
--- a/vendor/github.com/DataDog/dd-trace-go/tracer/context_test.go
+++ /dev/null
@@ -1,69 +0,0 @@
-package tracer
-
-import (
- "testing"
-
- "context"
-
- "github.com/stretchr/testify/assert"
-)
-
-func TestContextWithSpanDefault(t *testing.T) {
- assert := assert.New(t)
-
- // create a new context with a span
- span := SpanFromContextDefault(nil)
- assert.NotNil(span)
-
- ctx := context.Background()
- assert.NotNil(SpanFromContextDefault(ctx))
-}
-
-func TestSpanFromContext(t *testing.T) {
- assert := assert.New(t)
-
- // create a new context with a span
- ctx := context.Background()
- tracer := NewTracer()
- expectedSpan := tracer.NewRootSpan("pylons.request", "pylons", "/")
- ctx = ContextWithSpan(ctx, expectedSpan)
-
- span, ok := SpanFromContext(ctx)
- assert.True(ok)
- assert.Equal(expectedSpan, span)
-}
-
-func TestSpanFromContextNil(t *testing.T) {
- assert := assert.New(t)
-
- // create a context without a span
- ctx := context.Background()
-
- span, ok := SpanFromContext(ctx)
- assert.False(ok)
- assert.Nil(span)
-
- span, ok = SpanFromContext(nil)
- assert.False(ok)
- assert.Nil(span)
-
-}
-
-func TestSpanMissingParent(t *testing.T) {
- assert := assert.New(t)
- tracer := NewTracer()
-
- // assuming we're in an inner function and we
- // forget the nil or ok checks
- ctx := context.Background()
- span, _ := SpanFromContext(ctx)
-
- // span is nil according to the API
- child := tracer.NewChildSpan("redis.command", span)
- child.Finish()
-
- // the child is finished but it's not recorded in
- // the tracer buffer because the service is missing
- assert.True(child.Duration > 0)
- assert.Equal(1, len(tracer.channels.trace))
-}
diff --git a/vendor/github.com/DataDog/dd-trace-go/tracer/encoder_test.go b/vendor/github.com/DataDog/dd-trace-go/tracer/encoder_test.go
deleted file mode 100644
index d4dc4ca15..000000000
--- a/vendor/github.com/DataDog/dd-trace-go/tracer/encoder_test.go
+++ /dev/null
@@ -1,114 +0,0 @@
-package tracer
-
-import (
- "encoding/json"
- "testing"
-
- "github.com/stretchr/testify/assert"
- "github.com/ugorji/go/codec"
-)
-
-func TestEncoderContentType(t *testing.T) {
- assert := assert.New(t)
-
- testCases := []struct {
- encoder Encoder
- contentType string
- }{
- {newJSONEncoder(), "application/json"},
- {newMsgpackEncoder(), "application/msgpack"},
- }
-
- for _, tc := range testCases {
- assert.Equal(tc.contentType, tc.encoder.ContentType())
- }
-}
-
-func TestJSONEncoding(t *testing.T) {
- assert := assert.New(t)
-
- testCases := []struct {
- traces int
- size int
- }{
- {1, 1},
- {3, 1},
- {1, 3},
- {3, 3},
- }
-
- for _, tc := range testCases {
- payload := getTestTrace(tc.traces, tc.size)
- encoder := newJSONEncoder()
- err := encoder.EncodeTraces(payload)
- assert.Nil(err)
-
- // decode to check the right encoding
- var traces [][]*Span
- dec := json.NewDecoder(encoder.buffer)
- err = dec.Decode(&traces)
- assert.Nil(err)
- assert.Len(traces, tc.traces)
-
- for _, trace := range traces {
- assert.Len(trace, tc.size)
- span := trace[0]
- assert.Equal(uint64(42), span.TraceID)
- assert.Equal(uint64(52), span.SpanID)
- assert.Equal(uint64(42), span.ParentID)
- assert.Equal("web", span.Type)
- assert.Equal("high.throughput", span.Service)
- assert.Equal("sending.events", span.Name)
- assert.Equal("SEND /data", span.Resource)
- assert.Equal(int64(1481215590883401105), span.Start)
- assert.Equal(int64(1000000000), span.Duration)
- assert.Equal("192.168.0.1", span.Meta["http.host"])
- assert.Equal(float64(41.99), span.Metrics["http.monitor"])
- }
- }
-}
-
-func TestMsgpackEncoding(t *testing.T) {
- assert := assert.New(t)
-
- testCases := []struct {
- traces int
- size int
- }{
- {1, 1},
- {3, 1},
- {1, 3},
- {3, 3},
- }
-
- for _, tc := range testCases {
- payload := getTestTrace(tc.traces, tc.size)
- encoder := newMsgpackEncoder()
- err := encoder.EncodeTraces(payload)
- assert.Nil(err)
-
- // decode to check the right encoding
- var traces [][]*Span
- var mh codec.MsgpackHandle
- dec := codec.NewDecoder(encoder.buffer, &mh)
- err = dec.Decode(&traces)
- assert.Nil(err)
- assert.Len(traces, tc.traces)
-
- for _, trace := range traces {
- assert.Len(trace, tc.size)
- span := trace[0]
- assert.Equal(uint64(42), span.TraceID)
- assert.Equal(uint64(52), span.SpanID)
- assert.Equal(uint64(42), span.ParentID)
- assert.Equal("web", span.Type)
- assert.Equal("high.throughput", span.Service)
- assert.Equal("sending.events", span.Name)
- assert.Equal("SEND /data", span.Resource)
- assert.Equal(int64(1481215590883401105), span.Start)
- assert.Equal(int64(1000000000), span.Duration)
- assert.Equal("192.168.0.1", span.Meta["http.host"])
- assert.Equal(float64(41.99), span.Metrics["http.monitor"])
- }
- }
-}
diff --git a/vendor/github.com/DataDog/dd-trace-go/tracer/errors_test.go b/vendor/github.com/DataDog/dd-trace-go/tracer/errors_test.go
deleted file mode 100644
index f3834b784..000000000
--- a/vendor/github.com/DataDog/dd-trace-go/tracer/errors_test.go
+++ /dev/null
@@ -1,98 +0,0 @@
-package tracer
-
-import (
- "fmt"
- "testing"
-
- "github.com/stretchr/testify/assert"
-)
-
-func TestErrorSpanBufFull(t *testing.T) {
- assert := assert.New(t)
-
- err := &errorSpanBufFull{Len: 42}
- assert.Equal("span buffer is full (length: 42)", err.Error())
- assert.Equal("ErrorSpanBufFull", errorKey(err))
-}
-
-func TestErrorTraceChanFull(t *testing.T) {
- assert := assert.New(t)
-
- err := &errorTraceChanFull{Len: 42}
- assert.Equal("trace channel is full (length: 42)", err.Error())
- assert.Equal("ErrorTraceChanFull", errorKey(err))
-}
-
-func TestErrorServiceChanFull(t *testing.T) {
- assert := assert.New(t)
-
- err := &errorServiceChanFull{Len: 42}
- assert.Equal("service channel is full (length: 42)", err.Error())
- assert.Equal("ErrorServiceChanFull", errorKey(err))
-}
-
-func TestErrorTraceIDMismatch(t *testing.T) {
- assert := assert.New(t)
-
- err := &errorTraceIDMismatch{Expected: 42, Actual: 65535}
- assert.Equal("trace ID mismatch (expected: 2a actual: ffff)", err.Error())
- assert.Equal("ErrorTraceIDMismatch", errorKey(err))
-}
-
-func TestErrorNoSpanBuf(t *testing.T) {
- assert := assert.New(t)
-
- err := &errorNoSpanBuf{SpanName: "do"}
- assert.Equal("no span buffer (span name: 'do')", err.Error())
-}
-
-func TestErrorFlushLostTraces(t *testing.T) {
- assert := assert.New(t)
-
- err := &errorFlushLostTraces{Nb: 100}
- assert.Equal("unable to flush traces, lost 100 traces", err.Error())
-}
-
-func TestErrorFlushLostServices(t *testing.T) {
- assert := assert.New(t)
-
- err := &errorFlushLostServices{Nb: 100}
- assert.Equal("unable to flush services, lost 100 services", err.Error())
-}
-
-func TestErrorKey(t *testing.T) {
- assert := assert.New(t)
-
- assert.Equal("this is something unexpected", errorKey(fmt.Errorf("this is something unexpected")))
- assert.Equal("", errorKey(nil))
-}
-
-func TestAggregateErrors(t *testing.T) {
- assert := assert.New(t)
-
- errChan := make(chan error, 100)
- errChan <- &errorSpanBufFull{Len: 1000}
- errChan <- &errorSpanBufFull{Len: 1000}
- errChan <- &errorSpanBufFull{Len: 1000}
- errChan <- &errorSpanBufFull{Len: 1000}
- errChan <- &errorFlushLostTraces{Nb: 42}
- errChan <- &errorTraceIDMismatch{Expected: 42, Actual: 1}
- errChan <- &errorTraceIDMismatch{Expected: 42, Actual: 4095}
-
- errs := aggregateErrors(errChan)
-
- assert.Equal(map[string]errorSummary{
- "ErrorSpanBufFull": errorSummary{
- Count: 4,
- Example: "span buffer is full (length: 1000)",
- },
- "ErrorTraceIDMismatch": errorSummary{
- Count: 2,
- Example: "trace ID mismatch (expected: 2a actual: fff)",
- },
- "ErrorFlushLostTraces": errorSummary{
- Count: 1,
- Example: "unable to flush traces, lost 42 traces",
- },
- }, errs)
-}
diff --git a/vendor/github.com/DataDog/dd-trace-go/tracer/example_context_test.go b/vendor/github.com/DataDog/dd-trace-go/tracer/example_context_test.go
deleted file mode 100644
index 6ed29ec10..000000000
--- a/vendor/github.com/DataDog/dd-trace-go/tracer/example_context_test.go
+++ /dev/null
@@ -1,73 +0,0 @@
-package tracer_test
-
-import (
- "context"
- "fmt"
- "io"
- "log"
- "net/http"
- "os"
-
- "github.com/DataDog/dd-trace-go/tracer"
-)
-
-func saveFile(ctx context.Context, path string, r io.Reader) error {
- // Start a new span that is the child of the span stored in the context, and
- // attach it to the current context. If the context has no span, it will
- // return an empty root span.
- span, ctx := tracer.NewChildSpanWithContext("filestore.saveFile", ctx)
- defer span.Finish()
-
- // save the file contents.
- file, err := os.Create(path)
- if err != nil {
- span.SetError(err)
- return err
- }
- defer file.Close()
-
- _, err = io.Copy(file, r)
- span.SetError(err)
- return err
-}
-
-func saveFileHandler(w http.ResponseWriter, r *http.Request) {
- // the name of the operation we're measuring
- name := "http.request"
- service := "example-filestore"
- resource := "/saveFile"
-
- // This is the main entry point of our application, so we create a root span
- // that includes the service and resource name.
- span := tracer.NewRootSpan(name, service, resource)
- defer span.Finish()
-
- // Add the span to the request's context so we can pass the tracing information
- // down the stack.
- ctx := span.Context(r.Context())
-
- // Do the work.
- err := saveFile(ctx, "/tmp/example", r.Body)
- span.SetError(err) // no-op if err == nil
-
- if err != nil {
- http.Error(w, fmt.Sprintf("error saving file! %s", err), 500)
- return
- }
-
- w.Write([]byte("saved file!"))
-}
-
-// Tracing the hierarchy of spans in a request is a key part of tracing. This, for example,
-// let's a developer associate all of the database calls in a web request. As of Go 1.7,
-// the standard way of doing this is with the context package. Along with supporting
-// deadlines, cancellation signals and more, Contexts are perfect for passing (optional)
-// telemetry data through your stack.
-//
-// Read more about contexts here: https://golang.org/pkg/context/
-//
-// Here is an example illustrating how to pass tracing data with contexts.
-func Example_context() {
- http.HandleFunc("/saveFile", saveFileHandler)
- log.Fatal(http.ListenAndServe(":8080", nil))
-}
diff --git a/vendor/github.com/DataDog/dd-trace-go/tracer/example_test.go b/vendor/github.com/DataDog/dd-trace-go/tracer/example_test.go
deleted file mode 100644
index 93fb1559f..000000000
--- a/vendor/github.com/DataDog/dd-trace-go/tracer/example_test.go
+++ /dev/null
@@ -1,23 +0,0 @@
-package tracer_test
-
-import (
- "net/http"
-
- "github.com/DataDog/dd-trace-go/tracer"
-)
-
-func Example() {
- span := tracer.NewRootSpan("http.client.request", "example.com", "/user/{id}")
- defer span.Finish()
-
- url := "http://example.com/user/123"
-
- resp, err := http.Get(url)
- if err != nil {
- span.SetError(err)
- return
- }
-
- span.SetMeta("http.status", resp.Status)
- span.SetMeta("http.url", url)
-}
diff --git a/vendor/github.com/DataDog/dd-trace-go/tracer/span_test.go b/vendor/github.com/DataDog/dd-trace-go/tracer/span_test.go
deleted file mode 100644
index 6fb025319..000000000
--- a/vendor/github.com/DataDog/dd-trace-go/tracer/span_test.go
+++ /dev/null
@@ -1,289 +0,0 @@
-package tracer
-
-import (
- "context"
- "errors"
- "testing"
- "time"
-
- "github.com/stretchr/testify/assert"
-
- "github.com/DataDog/dd-trace-go/tracer/ext"
-)
-
-func TestSpanStart(t *testing.T) {
- assert := assert.New(t)
- tracer := NewTracer()
- span := tracer.NewRootSpan("pylons.request", "pylons", "/")
-
- // a new span sets the Start after the initialization
- assert.NotEqual(int64(0), span.Start)
-}
-
-func TestSpanString(t *testing.T) {
- assert := assert.New(t)
- tracer := NewTracer()
- span := tracer.NewRootSpan("pylons.request", "pylons", "/")
- // don't bother checking the contents, just make sure it works.
- assert.NotEqual("", span.String())
- span.Finish()
- assert.NotEqual("", span.String())
-}
-
-func TestSpanSetMeta(t *testing.T) {
- assert := assert.New(t)
- tracer := NewTracer()
- span := tracer.NewRootSpan("pylons.request", "pylons", "/")
-
- // check the map is properly initialized
- span.SetMeta("status.code", "200")
- assert.Equal("200", span.Meta["status.code"])
-
- // operating on a finished span is a no-op
- nMeta := len(span.Meta)
- span.Finish()
- span.SetMeta("finished.test", "true")
- assert.Equal(len(span.Meta), nMeta)
- assert.Equal(span.Meta["finished.test"], "")
-}
-
-func TestSpanSetMetas(t *testing.T) {
- assert := assert.New(t)
- tracer := NewTracer()
- span := tracer.NewRootSpan("pylons.request", "pylons", "/")
- span.SetSamplingPriority(0) // avoid interferences with "_sampling_priority_v1" meta
- metas := map[string]string{
- "error.msg": "Something wrong",
- "error.type": "*errors.errorString",
- "status.code": "200",
- "system.pid": "29176",
- }
- extraMetas := map[string]string{
- "custom.1": "something custom",
- "custom.2": "something even more special",
- }
- nopMetas := map[string]string{
- "nopKey1": "nopValue1",
- "nopKey2": "nopValue2",
- }
-
- // check the map is properly initialized
- span.SetMetas(metas)
- assert.Equal(len(metas), len(span.Meta))
- for k := range metas {
- assert.Equal(metas[k], span.Meta[k])
- }
-
- // check a second call adds the new metas, but does not remove old ones
- span.SetMetas(extraMetas)
- assert.Equal(len(metas)+len(extraMetas), len(span.Meta))
- for k := range extraMetas {
- assert.Equal(extraMetas[k], span.Meta[k])
- }
-
- assert.Equal(span.Meta["status.code"], "200")
-
- // operating on a finished span is a no-op
- span.Finish()
- span.SetMetas(nopMetas)
- assert.Equal(len(metas)+len(extraMetas), len(span.Meta))
- for k := range nopMetas {
- assert.Equal("", span.Meta[k])
- }
-
-}
-
-func TestSpanSetMetric(t *testing.T) {
- assert := assert.New(t)
- tracer := NewTracer()
- span := tracer.NewRootSpan("pylons.request", "pylons", "/")
-
- // check the map is properly initialized
- span.SetMetric("bytes", 1024.42)
- assert.Equal(1, len(span.Metrics))
- assert.Equal(1024.42, span.Metrics["bytes"])
-
- // operating on a finished span is a no-op
- span.Finish()
- span.SetMetric("finished.test", 1337)
- assert.Equal(1, len(span.Metrics))
- assert.Equal(0.0, span.Metrics["finished.test"])
-}
-
-func TestSpanError(t *testing.T) {
- assert := assert.New(t)
- tracer := NewTracer()
- span := tracer.NewRootSpan("pylons.request", "pylons", "/")
-
- // check the error is set in the default meta
- err := errors.New("Something wrong")
- span.SetError(err)
- assert.Equal(int32(1), span.Error)
- assert.Equal("Something wrong", span.Meta["error.msg"])
- assert.Equal("*errors.errorString", span.Meta["error.type"])
- assert.NotEqual("", span.Meta["error.stack"])
-
- // operating on a finished span is a no-op
- span = tracer.NewRootSpan("flask.request", "flask", "/")
- nMeta := len(span.Meta)
- span.Finish()
- span.SetError(err)
- assert.Equal(int32(0), span.Error)
- assert.Equal(nMeta, len(span.Meta))
- assert.Equal("", span.Meta["error.msg"])
- assert.Equal("", span.Meta["error.type"])
- assert.Equal("", span.Meta["error.stack"])
-}
-
-func TestSpanError_Typed(t *testing.T) {
- assert := assert.New(t)
- tracer := NewTracer()
- span := tracer.NewRootSpan("pylons.request", "pylons", "/")
-
- // check the error is set in the default meta
- err := &boomError{}
- span.SetError(err)
- assert.Equal(int32(1), span.Error)
- assert.Equal("boom", span.Meta["error.msg"])
- assert.Equal("*tracer.boomError", span.Meta["error.type"])
- assert.NotEqual("", span.Meta["error.stack"])
-}
-
-func TestEmptySpan(t *testing.T) {
- // ensure the empty span won't crash the app
- var span Span
- span.SetMeta("a", "b")
- span.SetError(nil)
- span.Finish()
-
- var s *Span
- s.SetMeta("a", "b")
- s.SetError(nil)
- s.Finish()
-}
-
-func TestSpanErrorNil(t *testing.T) {
- assert := assert.New(t)
- tracer := NewTracer()
- span := tracer.NewRootSpan("pylons.request", "pylons", "/")
-
- // don't set the error if it's nil
- nMeta := len(span.Meta)
- span.SetError(nil)
- assert.Equal(int32(0), span.Error)
- assert.Equal(nMeta, len(span.Meta))
-}
-
-func TestSpanFinish(t *testing.T) {
- assert := assert.New(t)
- wait := time.Millisecond * 2
- tracer := NewTracer()
- span := tracer.NewRootSpan("pylons.request", "pylons", "/")
-
- // the finish should set finished and the duration
- time.Sleep(wait)
- span.Finish()
- assert.True(span.Duration > int64(wait))
- assert.True(span.finished)
-}
-
-func TestSpanFinishTwice(t *testing.T) {
- assert := assert.New(t)
- wait := time.Millisecond * 2
-
- tracer, _ := getTestTracer()
- defer tracer.Stop()
-
- assert.Len(tracer.channels.trace, 0)
-
- // the finish must be idempotent
- span := tracer.NewRootSpan("pylons.request", "pylons", "/")
- time.Sleep(wait)
- span.Finish()
- assert.Len(tracer.channels.trace, 1)
-
- previousDuration := span.Duration
- time.Sleep(wait)
- span.Finish()
- assert.Equal(previousDuration, span.Duration)
- assert.Len(tracer.channels.trace, 1)
-}
-
-func TestSpanContext(t *testing.T) {
- ctx := context.Background()
- _, ok := SpanFromContext(ctx)
- assert.False(t, ok)
-
- tracer := NewTracer()
- span := tracer.NewRootSpan("pylons.request", "pylons", "/")
-
- ctx = span.Context(ctx)
- s2, ok := SpanFromContext(ctx)
- assert.True(t, ok)
- assert.Equal(t, span.SpanID, s2.SpanID)
-
-}
-
-// Prior to a bug fix, this failed when running `go test -race`
-func TestSpanModifyWhileFlushing(t *testing.T) {
- tracer, _ := getTestTracer()
- defer tracer.Stop()
-
- done := make(chan struct{})
- go func() {
- span := tracer.NewRootSpan("pylons.request", "pylons", "/")
- span.Finish()
- // It doesn't make much sense to update the span after it's been finished,
- // but an error in a user's code could lead to this.
- span.SetMeta("race_test", "true")
- span.SetMetric("race_test2", 133.7)
- span.SetMetrics("race_test3", 133.7)
- span.SetError(errors.New("t"))
- done <- struct{}{}
- }()
-
- run := true
- for run {
- select {
- case <-done:
- run = false
- default:
- tracer.flushTraces()
- }
- }
-}
-
-func TestSpanSamplingPriority(t *testing.T) {
- assert := assert.New(t)
- tracer := NewTracer()
-
- span := tracer.NewRootSpan("my.name", "my.service", "my.resource")
- assert.Equal(0.0, span.Metrics["_sampling_priority_v1"], "default sampling priority if undefined is 0")
- assert.False(span.HasSamplingPriority(), "by default, sampling priority is undefined")
- assert.Equal(0, span.GetSamplingPriority(), "default sampling priority for root spans is 0")
-
- childSpan := tracer.NewChildSpan("my.child", span)
- assert.Equal(span.Metrics["_sampling_priority_v1"], childSpan.Metrics["_sampling_priority_v1"])
- assert.Equal(span.HasSamplingPriority(), childSpan.HasSamplingPriority())
- assert.Equal(span.GetSamplingPriority(), childSpan.GetSamplingPriority())
-
- for _, priority := range []int{
- ext.PriorityUserReject,
- ext.PriorityAutoReject,
- ext.PriorityAutoKeep,
- ext.PriorityUserKeep,
- 999, // not used yet, but we should allow it
- } {
- span.SetSamplingPriority(priority)
- assert.True(span.HasSamplingPriority())
- assert.Equal(priority, span.GetSamplingPriority())
- childSpan = tracer.NewChildSpan("my.child", span)
- assert.Equal(span.Metrics["_sampling_priority_v1"], childSpan.Metrics["_sampling_priority_v1"])
- assert.Equal(span.HasSamplingPriority(), childSpan.HasSamplingPriority())
- assert.Equal(span.GetSamplingPriority(), childSpan.GetSamplingPriority())
- }
-}
-
-type boomError struct{}
-
-func (e *boomError) Error() string { return "boom" }
diff --git a/vendor/github.com/DataDog/dd-trace-go/tracer/time_windows_test.go b/vendor/github.com/DataDog/dd-trace-go/tracer/time_windows_test.go
deleted file mode 100644
index a7267727c..000000000
--- a/vendor/github.com/DataDog/dd-trace-go/tracer/time_windows_test.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package tracer
-
-import (
- "fmt"
- "github.com/stretchr/testify/assert"
- "testing"
-)
-
-func BenchmarkNormalTimeNow(b *testing.B) {
- for n := 0; n < b.N; n++ {
- lowPrecisionNow()
- }
-}
-
-func BenchmarkHighPrecisionTime(b *testing.B) {
- for n := 0; n < b.N; n++ {
- highPrecisionNow()
- }
-}
-
-func TestHighPrecisionTimerIsMoreAccurate(t *testing.T) {
- startLow := lowPrecisionNow()
- startHigh := highPrecisionNow()
- stopHigh := highPrecisionNow()
- for stopHigh == startHigh {
- stopHigh = highPrecisionNow()
- }
- stopLow := lowPrecisionNow()
- assert.Equal(t, int64(0), stopLow-startLow)
-}
diff --git a/vendor/github.com/DataDog/dd-trace-go/tracer/tracer_test.go b/vendor/github.com/DataDog/dd-trace-go/tracer/tracer_test.go
deleted file mode 100644
index 008a35643..000000000
--- a/vendor/github.com/DataDog/dd-trace-go/tracer/tracer_test.go
+++ /dev/null
@@ -1,648 +0,0 @@
-package tracer
-
-import (
- "context"
- "fmt"
- "github.com/DataDog/dd-trace-go/tracer/ext"
- "net/http"
- "os"
- "strconv"
- "sync"
- "testing"
- "time"
-
- "github.com/stretchr/testify/assert"
-)
-
-func TestDefaultTracer(t *testing.T) {
- assert := assert.New(t)
-
- var wg sync.WaitGroup
-
- // the default client must be available
- assert.NotNil(DefaultTracer)
-
- // package free functions must proxy the calls to the
- // default client
- root := NewRootSpan("pylons.request", "pylons", "/")
- NewChildSpan("pylons.request", root)
-
- wg.Add(2)
-
- go func() {
- for i := 0; i < 1000; i++ {
- Disable()
- Enable()
- }
- wg.Done()
- }()
-
- go func() {
- for i := 0; i < 1000; i++ {
- _ = DefaultTracer.Enabled()
- }
- wg.Done()
- }()
-
- wg.Wait()
-}
-
-func TestNewSpan(t *testing.T) {
- assert := assert.New(t)
-
- // the tracer must create root spans
- tracer := NewTracer()
- span := tracer.NewRootSpan("pylons.request", "pylons", "/")
- assert.Equal(uint64(0), span.ParentID)
- assert.Equal("pylons", span.Service)
- assert.Equal("pylons.request", span.Name)
- assert.Equal("/", span.Resource)
-}
-
-func TestNewSpanFromContextNil(t *testing.T) {
- assert := assert.New(t)
- tracer := NewTracer()
-
- child := tracer.NewChildSpanFromContext("abc", nil)
- assert.Equal("abc", child.Name)
- assert.Equal("", child.Service)
-
- child = tracer.NewChildSpanFromContext("def", context.Background())
- assert.Equal("def", child.Name)
- assert.Equal("", child.Service)
-
-}
-
-func TestNewChildSpanWithContext(t *testing.T) {
- assert := assert.New(t)
- tracer := NewTracer()
-
- // nil context
- span, ctx := tracer.NewChildSpanWithContext("abc", nil)
- assert.Equal("abc", span.Name)
- assert.Equal("", span.Service)
- assert.Equal(span.ParentID, span.SpanID) // it should be a root span
- assert.Equal(span.Tracer(), tracer)
- // the returned ctx should contain the created span
- assert.NotNil(ctx)
- ctxSpan, ok := SpanFromContext(ctx)
- assert.True(ok)
- assert.Equal(span, ctxSpan)
-
- // context without span
- span, ctx = tracer.NewChildSpanWithContext("abc", context.Background())
- assert.Equal("abc", span.Name)
- assert.Equal("", span.Service)
- assert.Equal(span.ParentID, span.SpanID) // it should be a root span
- // the returned ctx should contain the created span
- assert.NotNil(ctx)
- ctxSpan, ok = SpanFromContext(ctx)
- assert.True(ok)
- assert.Equal(span, ctxSpan)
-
- // context with span
- parent := tracer.NewRootSpan("pylons.request", "pylons", "/")
- parentCTX := ContextWithSpan(context.Background(), parent)
- span, ctx = tracer.NewChildSpanWithContext("def", parentCTX)
- assert.Equal("def", span.Name)
- assert.Equal("pylons", span.Service)
- assert.Equal(parent.Service, span.Service)
- // the created span should be a child of the parent span
- assert.Equal(span.ParentID, parent.SpanID)
- // the returned ctx should contain the created span
- assert.NotNil(ctx)
- ctxSpan, ok = SpanFromContext(ctx)
- assert.True(ok)
- assert.Equal(ctxSpan, span)
-}
-
-func TestNewSpanFromContext(t *testing.T) {
- assert := assert.New(t)
-
- // the tracer must create child spans
- tracer := NewTracer()
- parent := tracer.NewRootSpan("pylons.request", "pylons", "/")
- ctx := ContextWithSpan(context.Background(), parent)
-
- child := tracer.NewChildSpanFromContext("redis.command", ctx)
- // ids and services are inherited
- assert.Equal(parent.SpanID, child.ParentID)
- assert.Equal(parent.TraceID, child.TraceID)
- assert.Equal(parent.Service, child.Service)
- // the resource is not inherited and defaults to the name
- assert.Equal("redis.command", child.Resource)
- // the tracer instance is the same
- assert.Equal(tracer, parent.tracer)
- assert.Equal(tracer, child.tracer)
-
-}
-
-func TestNewSpanChild(t *testing.T) {
- assert := assert.New(t)
-
- // the tracer must create child spans
- tracer := NewTracer()
- parent := tracer.NewRootSpan("pylons.request", "pylons", "/")
- child := tracer.NewChildSpan("redis.command", parent)
- // ids and services are inherited
- assert.Equal(parent.SpanID, child.ParentID)
- assert.Equal(parent.TraceID, child.TraceID)
- assert.Equal(parent.Service, child.Service)
- // the resource is not inherited and defaults to the name
- assert.Equal("redis.command", child.Resource)
- // the tracer instance is the same
- assert.Equal(tracer, parent.tracer)
- assert.Equal(tracer, child.tracer)
-}
-
-func TestNewRootSpanHasPid(t *testing.T) {
- assert := assert.New(t)
-
- tracer := NewTracer()
- root := tracer.NewRootSpan("pylons.request", "pylons", "/")
-
- assert.Equal(strconv.Itoa(os.Getpid()), root.GetMeta(ext.Pid))
-}
-
-func TestNewChildHasNoPid(t *testing.T) {
- assert := assert.New(t)
-
- tracer := NewTracer()
- root := tracer.NewRootSpan("pylons.request", "pylons", "/")
- child := tracer.NewChildSpan("redis.command", root)
-
- assert.Equal("", child.GetMeta(ext.Pid))
-}
-
-func TestTracerDisabled(t *testing.T) {
- assert := assert.New(t)
-
- // disable the tracer and be sure that the span is not added
- tracer := NewTracer()
- tracer.SetEnabled(false)
- span := tracer.NewRootSpan("pylons.request", "pylons", "/")
- span.Finish()
- assert.Len(tracer.channels.trace, 0)
-}
-
-func TestTracerEnabledAgain(t *testing.T) {
- assert := assert.New(t)
-
- // disable the tracer and enable it again
- tracer := NewTracer()
- tracer.SetEnabled(false)
- preSpan := tracer.NewRootSpan("pylons.request", "pylons", "/")
- preSpan.Finish()
- assert.Len(tracer.channels.trace, 0)
- tracer.SetEnabled(true)
- postSpan := tracer.NewRootSpan("pylons.request", "pylons", "/")
- postSpan.Finish()
- assert.Len(tracer.channels.trace, 1)
-}
-
-func TestTracerSampler(t *testing.T) {
- assert := assert.New(t)
-
- sampleRate := 0.5
- tracer := NewTracer()
- tracer.SetSampleRate(sampleRate)
-
- span := tracer.NewRootSpan("pylons.request", "pylons", "/")
-
- // The span might be sampled or not, we don't know, but at least it should have the sample rate metric
- assert.Equal(sampleRate, span.Metrics[sampleRateMetricKey])
-}
-
-func TestTracerEdgeSampler(t *testing.T) {
- assert := assert.New(t)
-
- // a sample rate of 0 should sample nothing
- tracer0 := NewTracer()
- tracer0.SetSampleRate(0)
- // a sample rate of 1 should sample everything
- tracer1 := NewTracer()
- tracer1.SetSampleRate(1)
-
- count := traceChanLen / 3
-
- for i := 0; i < count; i++ {
- span0 := tracer0.NewRootSpan("pylons.request", "pylons", "/")
- span0.Finish()
- span1 := tracer1.NewRootSpan("pylons.request", "pylons", "/")
- span1.Finish()
- }
-
- assert.Len(tracer0.channels.trace, 0)
- assert.Len(tracer1.channels.trace, count)
-
- tracer0.Stop()
- tracer1.Stop()
-}
-
-func TestTracerConcurrent(t *testing.T) {
- assert := assert.New(t)
- tracer, transport := getTestTracer()
- defer tracer.Stop()
-
- // Wait for three different goroutines that should create
- // three different traces with one child each
- var wg sync.WaitGroup
- wg.Add(3)
- go func() {
- defer wg.Done()
- tracer.NewRootSpan("pylons.request", "pylons", "/").Finish()
- }()
- go func() {
- defer wg.Done()
- tracer.NewRootSpan("pylons.request", "pylons", "/home").Finish()
- }()
- go func() {
- defer wg.Done()
- tracer.NewRootSpan("pylons.request", "pylons", "/trace").Finish()
- }()
-
- wg.Wait()
- tracer.ForceFlush()
- traces := transport.Traces()
- assert.Len(traces, 3)
- assert.Len(traces[0], 1)
- assert.Len(traces[1], 1)
- assert.Len(traces[2], 1)
-}
-
-func TestTracerParentFinishBeforeChild(t *testing.T) {
- assert := assert.New(t)
- tracer, transport := getTestTracer()
- defer tracer.Stop()
-
- // Testing an edge case: a child refers to a parent that is already closed.
-
- parent := tracer.NewRootSpan("pylons.request", "pylons", "/")
- parent.Finish()
-
- tracer.ForceFlush()
- traces := transport.Traces()
- assert.Len(traces, 1)
- assert.Len(traces[0], 1)
- assert.Equal(parent, traces[0][0])
-
- child := tracer.NewChildSpan("redis.command", parent)
- child.Finish()
-
- tracer.ForceFlush()
-
- traces = transport.Traces()
- assert.Len(traces, 1)
- assert.Len(traces[0], 1)
- assert.Equal(child, traces[0][0])
- assert.Equal(parent.SpanID, traces[0][0].ParentID, "child should refer to parent, even if they have been flushed separately")
-}
-
-func TestTracerConcurrentMultipleSpans(t *testing.T) {
- assert := assert.New(t)
- tracer, transport := getTestTracer()
- defer tracer.Stop()
-
- // Wait for two different goroutines that should create
- // two traces with two children each
- var wg sync.WaitGroup
- wg.Add(2)
- go func() {
- defer wg.Done()
- parent := tracer.NewRootSpan("pylons.request", "pylons", "/")
- child := tracer.NewChildSpan("redis.command", parent)
- child.Finish()
- parent.Finish()
- }()
- go func() {
- defer wg.Done()
- parent := tracer.NewRootSpan("pylons.request", "pylons", "/")
- child := tracer.NewChildSpan("redis.command", parent)
- child.Finish()
- parent.Finish()
- }()
-
- wg.Wait()
- tracer.ForceFlush()
- traces := transport.Traces()
- assert.Len(traces, 2)
- assert.Len(traces[0], 2)
- assert.Len(traces[1], 2)
-}
-
-func TestTracerAtomicFlush(t *testing.T) {
- assert := assert.New(t)
- tracer, transport := getTestTracer()
- defer tracer.Stop()
-
- // Make sure we don't flush partial bits of traces
- root := tracer.NewRootSpan("pylons.request", "pylons", "/")
- span := tracer.NewChildSpan("redis.command", root)
- span1 := tracer.NewChildSpan("redis.command.1", span)
- span2 := tracer.NewChildSpan("redis.command.2", span)
- span.Finish()
- span1.Finish()
- span2.Finish()
-
- tracer.ForceFlush()
- traces := transport.Traces()
- assert.Len(traces, 0, "nothing should be flushed now as span2 is not finished yet")
-
- root.Finish()
-
- tracer.ForceFlush()
- traces = transport.Traces()
- assert.Len(traces, 1)
- assert.Len(traces[0], 4, "all spans should show up at once")
-}
-
-func TestTracerServices(t *testing.T) {
- assert := assert.New(t)
- tracer, transport := getTestTracer()
-
- tracer.SetServiceInfo("svc1", "a", "b")
- tracer.SetServiceInfo("svc2", "c", "d")
- tracer.SetServiceInfo("svc1", "e", "f")
-
- tracer.Stop()
-
- assert.Len(transport.services, 2)
-
- svc1 := transport.services["svc1"]
- assert.NotNil(svc1)
- assert.Equal("svc1", svc1.Name)
- assert.Equal("e", svc1.App)
- assert.Equal("f", svc1.AppType)
-
- svc2 := transport.services["svc2"]
- assert.NotNil(svc2)
- assert.Equal("svc2", svc2.Name)
- assert.Equal("c", svc2.App)
- assert.Equal("d", svc2.AppType)
-}
-
-func TestTracerServicesDisabled(t *testing.T) {
- assert := assert.New(t)
- tracer, transport := getTestTracer()
-
- tracer.SetEnabled(false)
- tracer.SetServiceInfo("svc1", "a", "b")
- tracer.Stop()
-
- assert.Len(transport.services, 0)
-}
-
-func TestTracerMeta(t *testing.T) {
- assert := assert.New(t)
-
- var nilTracer *Tracer
- nilTracer.SetMeta("key", "value")
- assert.Nil(nilTracer.getAllMeta(), "nil tracer should return nil meta")
-
- tracer, _ := getTestTracer()
- defer tracer.Stop()
-
- assert.Nil(tracer.getAllMeta(), "by default, no meta")
- tracer.SetMeta("env", "staging")
-
- span := tracer.NewRootSpan("pylons.request", "pylons", "/")
- assert.Equal("staging", span.GetMeta("env"))
- assert.Equal("", span.GetMeta("component"))
- span.Finish()
- assert.Equal(map[string]string{"env": "staging"}, tracer.getAllMeta(), "there should be one meta")
-
- tracer.SetMeta("component", "core")
- span = tracer.NewRootSpan("pylons.request", "pylons", "/")
- assert.Equal("staging", span.GetMeta("env"))
- assert.Equal("core", span.GetMeta("component"))
- span.Finish()
- assert.Equal(map[string]string{"env": "staging", "component": "core"}, tracer.getAllMeta(), "there should be two entries")
-
- tracer.SetMeta("env", "prod")
- span = tracer.NewRootSpan("pylons.request", "pylons", "/")
- assert.Equal("prod", span.GetMeta("env"))
- assert.Equal("core", span.GetMeta("component"))
- span.SetMeta("env", "sandbox")
- assert.Equal("sandbox", span.GetMeta("env"))
- assert.Equal("core", span.GetMeta("component"))
- span.Finish()
-
- assert.Equal(map[string]string{"env": "prod", "component": "core"}, tracer.getAllMeta(), "key1 should have been updated")
-}
-
-func TestTracerRace(t *testing.T) {
- assert := assert.New(t)
-
- tracer, transport := getTestTracer()
- defer tracer.Stop()
-
- total := (traceChanLen / 3) / 10
- var wg sync.WaitGroup
- wg.Add(total)
-
- // Trying to be quite brutal here, firing lots of concurrent things, finishing in
- // different orders, and modifying spans after creation.
- for n := 0; n < total; n++ {
- i := n // keep local copy
- odd := ((i % 2) != 0)
- go func() {
- if i%11 == 0 {
- time.Sleep(time.Microsecond)
- }
-
- tracer.SetMeta("foo", "bar")
-
- parent := tracer.NewRootSpan("pylons.request", "pylons", "/")
-
- NewChildSpan("redis.command", parent).Finish()
- child := NewChildSpan("async.service", parent)
-
- if i%13 == 0 {
- time.Sleep(time.Microsecond)
- }
-
- if odd {
- parent.SetMeta("odd", "true")
- parent.SetMetric("oddity", 1)
- parent.Finish()
- } else {
- child.SetMeta("odd", "false")
- child.SetMetric("oddity", 0)
- child.Finish()
- }
-
- if i%17 == 0 {
- time.Sleep(time.Microsecond)
- }
-
- if odd {
- child.Resource = "HGETALL"
- child.SetMeta("odd", "false")
- child.SetMetric("oddity", 0)
- } else {
- parent.Resource = "/" + strconv.Itoa(i) + ".html"
- parent.SetMeta("odd", "true")
- parent.SetMetric("oddity", 1)
- }
-
- if i%19 == 0 {
- time.Sleep(time.Microsecond)
- }
-
- if odd {
- child.Finish()
- } else {
- parent.Finish()
- }
-
- wg.Done()
- }()
- }
-
- wg.Wait()
-
- tracer.ForceFlush()
- traces := transport.Traces()
- assert.Len(traces, total, "we should have exactly as many traces as expected")
- for _, trace := range traces {
- assert.Len(trace, 3, "each trace should have exactly 3 spans")
- var parent, child, redis *Span
- for _, span := range trace {
- assert.Equal("bar", span.GetMeta("foo"), "tracer meta should have been applied to all spans")
- switch span.Name {
- case "pylons.request":
- parent = span
- case "async.service":
- child = span
- case "redis.command":
- redis = span
- default:
- assert.Fail("unexpected span", span)
- }
- }
- assert.NotNil(parent)
- assert.NotNil(child)
- assert.NotNil(redis)
-
- assert.Equal(uint64(0), parent.ParentID)
- assert.Equal(parent.TraceID, parent.SpanID)
-
- assert.Equal(parent.TraceID, redis.TraceID)
- assert.Equal(parent.TraceID, child.TraceID)
-
- assert.Equal(parent.TraceID, redis.ParentID)
- assert.Equal(parent.TraceID, child.ParentID)
- }
-}
-
-// TestWorker is definitely a flaky test, as here we test that the worker
-// background task actually does flush things. Most other tests are and should
-// be using ForceFlush() to make sure things are really sent to transport.
-// Here, we just wait until things show up, as we would do with a real program.
-func TestWorker(t *testing.T) {
- assert := assert.New(t)
-
- tracer, transport := getTestTracer()
- defer tracer.Stop()
-
- n := traceChanLen * 10 // put more traces than the chan size, on purpose
- for i := 0; i < n; i++ {
- root := tracer.NewRootSpan("pylons.request", "pylons", "/")
- child := tracer.NewChildSpan("redis.command", root)
- child.Finish()
- root.Finish()
- }
-
- now := time.Now()
- count := 0
- for time.Now().Before(now.Add(time.Minute)) && count < traceChanLen {
- nbTraces := len(transport.Traces())
- if nbTraces > 0 {
- t.Logf("popped %d traces", nbTraces)
- }
- count += nbTraces
- time.Sleep(time.Millisecond)
- }
- // here we just check that we have "enough traces". In practice, lots of them
- // are dropped, it's another interesting side-effect of this test: it does
- // trigger error messages (which are repeated, so it aggregates them etc.)
- if count < traceChanLen {
- assert.Fail(fmt.Sprintf("timeout, not enough traces in buffer (%d/%d)", count, n))
- }
-}
-
-// BenchmarkConcurrentTracing tests the performance of spawning a lot of
-// goroutines where each one creates a trace with a parent and a child.
-func BenchmarkConcurrentTracing(b *testing.B) {
- tracer, _ := getTestTracer()
- defer tracer.Stop()
-
- b.ResetTimer()
- for n := 0; n < b.N; n++ {
- go func() {
- parent := tracer.NewRootSpan("pylons.request", "pylons", "/")
- defer parent.Finish()
-
- for i := 0; i < 10; i++ {
- tracer.NewChildSpan("redis.command", parent).Finish()
- }
- }()
- }
-}
-
-// BenchmarkTracerAddSpans tests the performance of creating and finishing a root
-// span. It should include the encoding overhead.
-func BenchmarkTracerAddSpans(b *testing.B) {
- tracer, _ := getTestTracer()
- defer tracer.Stop()
-
- for n := 0; n < b.N; n++ {
- span := tracer.NewRootSpan("pylons.request", "pylons", "/")
- span.Finish()
- }
-}
-
-// getTestTracer returns a Tracer with a DummyTransport
-func getTestTracer() (*Tracer, *dummyTransport) {
- transport := &dummyTransport{getEncoder: msgpackEncoderFactory}
- tracer := NewTracerTransport(transport)
- return tracer, transport
-}
-
-// Mock Transport with a real Encoder
-type dummyTransport struct {
- getEncoder encoderFactory
- traces [][]*Span
- services map[string]Service
-
- sync.RWMutex // required because of some poll-testing (eg: worker)
-}
-
-func (t *dummyTransport) SendTraces(traces [][]*Span) (*http.Response, error) {
- t.Lock()
- t.traces = append(t.traces, traces...)
- t.Unlock()
-
- encoder := t.getEncoder()
- return nil, encoder.EncodeTraces(traces)
-}
-
-func (t *dummyTransport) SendServices(services map[string]Service) (*http.Response, error) {
- t.Lock()
- t.services = services
- t.Unlock()
-
- encoder := t.getEncoder()
- return nil, encoder.EncodeServices(services)
-}
-
-func (t *dummyTransport) Traces() [][]*Span {
- t.Lock()
- defer t.Unlock()
-
- traces := t.traces
- t.traces = nil
- return traces
-}
-
-func (t *dummyTransport) SetHeader(key, value string) {}
diff --git a/vendor/github.com/DataDog/dd-trace-go/tracer/transport_test.go b/vendor/github.com/DataDog/dd-trace-go/tracer/transport_test.go
deleted file mode 100644
index 6bbe75386..000000000
--- a/vendor/github.com/DataDog/dd-trace-go/tracer/transport_test.go
+++ /dev/null
@@ -1,202 +0,0 @@
-package tracer
-
-import (
- "net/http"
- "net/http/httptest"
- "net/url"
- "strconv"
- "strings"
- "testing"
-
- "github.com/stretchr/testify/assert"
-)
-
-// getTestSpan returns a Span with different fields set
-func getTestSpan() *Span {
- return &Span{
- TraceID: 42,
- SpanID: 52,
- ParentID: 42,
- Type: "web",
- Service: "high.throughput",
- Name: "sending.events",
- Resource: "SEND /data",
- Start: 1481215590883401105,
- Duration: 1000000000,
- Meta: map[string]string{"http.host": "192.168.0.1"},
- Metrics: map[string]float64{"http.monitor": 41.99},
- }
-}
-
-// getTestTrace returns a list of traces that is composed by ``traceN`` number
-// of traces, each one composed by ``size`` number of spans.
-func getTestTrace(traceN, size int) [][]*Span {
- var traces [][]*Span
-
- for i := 0; i < traceN; i++ {
- trace := []*Span{}
- for j := 0; j < size; j++ {
- trace = append(trace, getTestSpan())
- }
- traces = append(traces, trace)
- }
- return traces
-}
-
-func getTestServices() map[string]Service {
- return map[string]Service{
- "svc1": Service{Name: "scv1", App: "a", AppType: "b"},
- "svc2": Service{Name: "scv2", App: "c", AppType: "d"},
- }
-}
-
-type mockDatadogAPIHandler struct {
- t *testing.T
-}
-
-func (m mockDatadogAPIHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
- assert := assert.New(m.t)
-
- header := r.Header.Get("X-Datadog-Trace-Count")
- assert.NotEqual("", header, "X-Datadog-Trace-Count header should be here")
- count, err := strconv.Atoi(header)
- assert.Nil(err, "header should be an int")
- assert.NotEqual(0, count, "there should be a non-zero amount of traces")
-}
-
-func mockDatadogAPINewServer(t *testing.T) *httptest.Server {
- handler := mockDatadogAPIHandler{t: t}
- server := httptest.NewServer(handler)
- return server
-}
-
-func TestTracesAgentIntegration(t *testing.T) {
- assert := assert.New(t)
-
- testCases := []struct {
- payload [][]*Span
- }{
- {getTestTrace(1, 1)},
- {getTestTrace(10, 1)},
- {getTestTrace(1, 10)},
- {getTestTrace(10, 10)},
- }
-
- for _, tc := range testCases {
- transport := newHTTPTransport(defaultHostname, defaultPort)
- response, err := transport.SendTraces(tc.payload)
- assert.NoError(err)
- assert.NotNil(response)
- assert.Equal(200, response.StatusCode)
- }
-}
-
-func TestAPIDowngrade(t *testing.T) {
- assert := assert.New(t)
- transport := newHTTPTransport(defaultHostname, defaultPort)
- transport.traceURL = "http://localhost:8126/v0.0/traces"
-
- // if we get a 404 we should downgrade the API
- traces := getTestTrace(2, 2)
- response, err := transport.SendTraces(traces)
- assert.NoError(err)
- assert.NotNil(response)
- assert.Equal(200, response.StatusCode)
-}
-
-func TestEncoderDowngrade(t *testing.T) {
- assert := assert.New(t)
- transport := newHTTPTransport(defaultHostname, defaultPort)
- transport.traceURL = "http://localhost:8126/v0.2/traces"
-
- // if we get a 415 because of a wrong encoder, we should downgrade the encoder
- traces := getTestTrace(2, 2)
- response, err := transport.SendTraces(traces)
- assert.NoError(err)
- assert.NotNil(response)
- assert.Equal(200, response.StatusCode)
-}
-
-func TestTransportServices(t *testing.T) {
- assert := assert.New(t)
-
- transport := newHTTPTransport(defaultHostname, defaultPort)
-
- response, err := transport.SendServices(getTestServices())
- assert.NoError(err)
- assert.NotNil(response)
- assert.Equal(200, response.StatusCode)
-}
-
-func TestTransportServicesDowngrade_0_0(t *testing.T) {
- assert := assert.New(t)
-
- transport := newHTTPTransport(defaultHostname, defaultPort)
- transport.serviceURL = "http://localhost:8126/v0.0/services"
-
- response, err := transport.SendServices(getTestServices())
- assert.NoError(err)
- assert.NotNil(response)
- assert.Equal(200, response.StatusCode)
-}
-
-func TestTransportServicesDowngrade_0_2(t *testing.T) {
- assert := assert.New(t)
-
- transport := newHTTPTransport(defaultHostname, defaultPort)
- transport.serviceURL = "http://localhost:8126/v0.2/services"
-
- response, err := transport.SendServices(getTestServices())
- assert.NoError(err)
- assert.NotNil(response)
- assert.Equal(200, response.StatusCode)
-}
-
-func TestTransportEncoderPool(t *testing.T) {
- assert := assert.New(t)
- transport := newHTTPTransport(defaultHostname, defaultPort)
-
- // MsgpackEncoder is the default encoder of the pool
- encoder := transport.getEncoder()
- assert.Equal("application/msgpack", encoder.ContentType())
-}
-
-func TestTransportSwitchEncoder(t *testing.T) {
- assert := assert.New(t)
- transport := newHTTPTransport(defaultHostname, defaultPort)
- transport.changeEncoder(jsonEncoderFactory)
-
- // MsgpackEncoder is the default encoder of the pool
- encoder := transport.getEncoder()
- assert.Equal("application/json", encoder.ContentType())
-}
-
-func TestTraceCountHeader(t *testing.T) {
- assert := assert.New(t)
-
- testCases := []struct {
- payload [][]*Span
- }{
- {getTestTrace(1, 1)},
- {getTestTrace(10, 1)},
- {getTestTrace(100, 10)},
- }
-
- receiver := mockDatadogAPINewServer(t)
- parsedURL, err := url.Parse(receiver.URL)
- assert.NoError(err)
- host := parsedURL.Host
- hostItems := strings.Split(host, ":")
- assert.Equal(2, len(hostItems), "port should be given, as it's chosen randomly")
- hostname := hostItems[0]
- port := hostItems[1]
- for _, tc := range testCases {
- transport := newHTTPTransport(hostname, port)
- response, err := transport.SendTraces(tc.payload)
- assert.NoError(err)
- assert.NotNil(response)
- assert.Equal(200, response.StatusCode)
- }
-
- receiver.Close()
-}
diff --git a/vendor/github.com/Shopify/sarama/acl_create_request_test.go b/vendor/github.com/Shopify/sarama/acl_create_request_test.go
deleted file mode 100644
index fb4b35c16..000000000
--- a/vendor/github.com/Shopify/sarama/acl_create_request_test.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- aclCreateRequest = []byte{
- 0, 0, 0, 1,
- 3, // resource type = group
- 0, 5, 'g', 'r', 'o', 'u', 'p',
- 0, 9, 'p', 'r', 'i', 'n', 'c', 'i', 'p', 'a', 'l',
- 0, 4, 'h', 'o', 's', 't',
- 2, // all
- 2, // deny
- }
-)
-
-func TestCreateAclsRequest(t *testing.T) {
- req := &CreateAclsRequest{
- AclCreations: []*AclCreation{{
- Resource: Resource{
- ResourceType: AclResourceGroup,
- ResourceName: "group",
- },
- Acl: Acl{
- Principal: "principal",
- Host: "host",
- Operation: AclOperationAll,
- PermissionType: AclPermissionDeny,
- }},
- },
- }
-
- testRequest(t, "create request", req, aclCreateRequest)
-}
diff --git a/vendor/github.com/Shopify/sarama/acl_create_response_test.go b/vendor/github.com/Shopify/sarama/acl_create_response_test.go
deleted file mode 100644
index 65b934d9a..000000000
--- a/vendor/github.com/Shopify/sarama/acl_create_response_test.go
+++ /dev/null
@@ -1,41 +0,0 @@
-package sarama
-
-import (
- "testing"
- "time"
-)
-
-var (
- createResponseWithError = []byte{
- 0, 0, 0, 100,
- 0, 0, 0, 1,
- 0, 42,
- 0, 5, 'e', 'r', 'r', 'o', 'r',
- }
-
- createResponseArray = []byte{
- 0, 0, 0, 100,
- 0, 0, 0, 2,
- 0, 42,
- 0, 5, 'e', 'r', 'r', 'o', 'r',
- 0, 0,
- 255, 255,
- }
-)
-
-func TestCreateAclsResponse(t *testing.T) {
- errmsg := "error"
- resp := &CreateAclsResponse{
- ThrottleTime: 100 * time.Millisecond,
- AclCreationResponses: []*AclCreationResponse{{
- Err: ErrInvalidRequest,
- ErrMsg: &errmsg,
- }},
- }
-
- testResponse(t, "response with error", resp, createResponseWithError)
-
- resp.AclCreationResponses = append(resp.AclCreationResponses, new(AclCreationResponse))
-
- testResponse(t, "response array", resp, createResponseArray)
-}
diff --git a/vendor/github.com/Shopify/sarama/acl_delete_request_test.go b/vendor/github.com/Shopify/sarama/acl_delete_request_test.go
deleted file mode 100644
index 2efdcb48e..000000000
--- a/vendor/github.com/Shopify/sarama/acl_delete_request_test.go
+++ /dev/null
@@ -1,69 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- aclDeleteRequestNulls = []byte{
- 0, 0, 0, 1,
- 1,
- 255, 255,
- 255, 255,
- 255, 255,
- 11,
- 3,
- }
-
- aclDeleteRequest = []byte{
- 0, 0, 0, 1,
- 1, // any
- 0, 6, 'f', 'i', 'l', 't', 'e', 'r',
- 0, 9, 'p', 'r', 'i', 'n', 'c', 'i', 'p', 'a', 'l',
- 0, 4, 'h', 'o', 's', 't',
- 4, // write
- 3, // allow
- }
-
- aclDeleteRequestArray = []byte{
- 0, 0, 0, 2,
- 1,
- 0, 6, 'f', 'i', 'l', 't', 'e', 'r',
- 0, 9, 'p', 'r', 'i', 'n', 'c', 'i', 'p', 'a', 'l',
- 0, 4, 'h', 'o', 's', 't',
- 4, // write
- 3, // allow
- 2,
- 0, 5, 't', 'o', 'p', 'i', 'c',
- 255, 255,
- 255, 255,
- 6,
- 2,
- }
-)
-
-func TestDeleteAclsRequest(t *testing.T) {
- req := &DeleteAclsRequest{
- Filters: []*AclFilter{{
- ResourceType: AclResourceAny,
- Operation: AclOperationAlterConfigs,
- PermissionType: AclPermissionAllow,
- }},
- }
-
- testRequest(t, "delete request nulls", req, aclDeleteRequestNulls)
-
- req.Filters[0].ResourceName = nullString("filter")
- req.Filters[0].Principal = nullString("principal")
- req.Filters[0].Host = nullString("host")
- req.Filters[0].Operation = AclOperationWrite
-
- testRequest(t, "delete request", req, aclDeleteRequest)
-
- req.Filters = append(req.Filters, &AclFilter{
- ResourceType: AclResourceTopic,
- ResourceName: nullString("topic"),
- Operation: AclOperationDelete,
- PermissionType: AclPermissionDeny,
- })
-
- testRequest(t, "delete request array", req, aclDeleteRequestArray)
-}
diff --git a/vendor/github.com/Shopify/sarama/acl_delete_response_test.go b/vendor/github.com/Shopify/sarama/acl_delete_response_test.go
deleted file mode 100644
index 0d9dea684..000000000
--- a/vendor/github.com/Shopify/sarama/acl_delete_response_test.go
+++ /dev/null
@@ -1,38 +0,0 @@
-package sarama
-
-import (
- "testing"
- "time"
-)
-
-var (
- deleteAclsResponse = []byte{
- 0, 0, 0, 100,
- 0, 0, 0, 1,
- 0, 0, // no error
- 255, 255, // no error message
- 0, 0, 0, 1, // 1 matching acl
- 0, 0, // no error
- 255, 255, // no error message
- 2, // resource type
- 0, 5, 't', 'o', 'p', 'i', 'c',
- 0, 9, 'p', 'r', 'i', 'n', 'c', 'i', 'p', 'a', 'l',
- 0, 4, 'h', 'o', 's', 't',
- 4,
- 3,
- }
-)
-
-func TestDeleteAclsResponse(t *testing.T) {
- resp := &DeleteAclsResponse{
- ThrottleTime: 100 * time.Millisecond,
- FilterResponses: []*FilterResponse{{
- MatchingAcls: []*MatchingAcl{{
- Resource: Resource{ResourceType: AclResourceTopic, ResourceName: "topic"},
- Acl: Acl{Principal: "principal", Host: "host", Operation: AclOperationWrite, PermissionType: AclPermissionAllow},
- }},
- }},
- }
-
- testResponse(t, "", resp, deleteAclsResponse)
-}
diff --git a/vendor/github.com/Shopify/sarama/acl_describe_request_test.go b/vendor/github.com/Shopify/sarama/acl_describe_request_test.go
deleted file mode 100644
index 3af14c616..000000000
--- a/vendor/github.com/Shopify/sarama/acl_describe_request_test.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package sarama
-
-import (
- "testing"
-)
-
-var (
- aclDescribeRequest = []byte{
- 2, // resource type
- 0, 5, 't', 'o', 'p', 'i', 'c',
- 0, 9, 'p', 'r', 'i', 'n', 'c', 'i', 'p', 'a', 'l',
- 0, 4, 'h', 'o', 's', 't',
- 5, // acl operation
- 3, // acl permission type
- }
-)
-
-func TestAclDescribeRequest(t *testing.T) {
- resourcename := "topic"
- principal := "principal"
- host := "host"
-
- req := &DescribeAclsRequest{
- AclFilter{
- ResourceType: AclResourceTopic,
- ResourceName: &resourcename,
- Principal: &principal,
- Host: &host,
- Operation: AclOperationCreate,
- PermissionType: AclPermissionAllow,
- },
- }
-
- testRequest(t, "", req, aclDescribeRequest)
-}
diff --git a/vendor/github.com/Shopify/sarama/acl_describe_response_test.go b/vendor/github.com/Shopify/sarama/acl_describe_response_test.go
deleted file mode 100644
index f0652cfee..000000000
--- a/vendor/github.com/Shopify/sarama/acl_describe_response_test.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package sarama
-
-import (
- "testing"
- "time"
-)
-
-var aclDescribeResponseError = []byte{
- 0, 0, 0, 100,
- 0, 8, // error
- 0, 5, 'e', 'r', 'r', 'o', 'r',
- 0, 0, 0, 1, // 1 resource
- 2, // cluster type
- 0, 5, 't', 'o', 'p', 'i', 'c',
- 0, 0, 0, 1, // 1 acl
- 0, 9, 'p', 'r', 'i', 'n', 'c', 'i', 'p', 'a', 'l',
- 0, 4, 'h', 'o', 's', 't',
- 4, // write
- 3, // allow
-}
-
-func TestAclDescribeResponse(t *testing.T) {
- errmsg := "error"
- resp := &DescribeAclsResponse{
- ThrottleTime: 100 * time.Millisecond,
- Err: ErrBrokerNotAvailable,
- ErrMsg: &errmsg,
- ResourceAcls: []*ResourceAcls{{
- Resource: Resource{
- ResourceName: "topic",
- ResourceType: AclResourceTopic,
- },
- Acls: []*Acl{
- {
- Principal: "principal",
- Host: "host",
- Operation: AclOperationWrite,
- PermissionType: AclPermissionAllow,
- },
- },
- }},
- }
-
- testResponse(t, "describe", resp, aclDescribeResponseError)
-}
diff --git a/vendor/github.com/Shopify/sarama/add_offsets_to_txn_request_test.go b/vendor/github.com/Shopify/sarama/add_offsets_to_txn_request_test.go
deleted file mode 100644
index e96b3d33f..000000000
--- a/vendor/github.com/Shopify/sarama/add_offsets_to_txn_request_test.go
+++ /dev/null
@@ -1,23 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- addOffsetsToTxnRequest = []byte{
- 0, 3, 't', 'x', 'n',
- 0, 0, 0, 0, 0, 0, 31, 64,
- 0, 0,
- 0, 7, 'g', 'r', 'o', 'u', 'p', 'i', 'd',
- }
-)
-
-func TestAddOffsetsToTxnRequest(t *testing.T) {
- req := &AddOffsetsToTxnRequest{
- TransactionalID: "txn",
- ProducerID: 8000,
- ProducerEpoch: 0,
- GroupID: "groupid",
- }
-
- testRequest(t, "", req, addOffsetsToTxnRequest)
-}
diff --git a/vendor/github.com/Shopify/sarama/add_offsets_to_txn_response_test.go b/vendor/github.com/Shopify/sarama/add_offsets_to_txn_response_test.go
deleted file mode 100644
index 4504966fe..000000000
--- a/vendor/github.com/Shopify/sarama/add_offsets_to_txn_response_test.go
+++ /dev/null
@@ -1,22 +0,0 @@
-package sarama
-
-import (
- "testing"
- "time"
-)
-
-var (
- addOffsetsToTxnResponse = []byte{
- 0, 0, 0, 100,
- 0, 47,
- }
-)
-
-func TestAddOffsetsToTxnResponse(t *testing.T) {
- resp := &AddOffsetsToTxnResponse{
- ThrottleTime: 100 * time.Millisecond,
- Err: ErrInvalidProducerEpoch,
- }
-
- testResponse(t, "", resp, addOffsetsToTxnResponse)
-}
diff --git a/vendor/github.com/Shopify/sarama/add_partitions_to_txn_request_test.go b/vendor/github.com/Shopify/sarama/add_partitions_to_txn_request_test.go
deleted file mode 100644
index 76a2eee43..000000000
--- a/vendor/github.com/Shopify/sarama/add_partitions_to_txn_request_test.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- addPartitionsToTxnRequest = []byte{
- 0, 3, 't', 'x', 'n',
- 0, 0, 0, 0, 0, 0, 31, 64, // ProducerID
- 0, 0, 0, 0, // ProducerEpoch
- 0, 1, // 1 topic
- 0, 5, 't', 'o', 'p', 'i', 'c',
- 0, 0, 0, 1, 0, 0, 0, 1,
- }
-)
-
-func TestAddPartitionsToTxnRequest(t *testing.T) {
- req := &AddPartitionsToTxnRequest{
- TransactionalID: "txn",
- ProducerID: 8000,
- ProducerEpoch: 0,
- TopicPartitions: map[string][]int32{
- "topic": []int32{1},
- },
- }
-
- testRequest(t, "", req, addPartitionsToTxnRequest)
-}
diff --git a/vendor/github.com/Shopify/sarama/add_partitions_to_txn_response_test.go b/vendor/github.com/Shopify/sarama/add_partitions_to_txn_response_test.go
deleted file mode 100644
index 7b5b82f80..000000000
--- a/vendor/github.com/Shopify/sarama/add_partitions_to_txn_response_test.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package sarama
-
-import (
- "testing"
- "time"
-)
-
-var (
- addPartitionsToTxnResponse = []byte{
- 0, 0, 0, 100,
- 0, 0, 0, 1,
- 0, 5, 't', 'o', 'p', 'i', 'c',
- 0, 0, 0, 1, // 1 partition error
- 0, 0, 0, 2, // partition 2
- 0, 48, // error
- }
-)
-
-func TestAddPartitionsToTxnResponse(t *testing.T) {
- resp := &AddPartitionsToTxnResponse{
- ThrottleTime: 100 * time.Millisecond,
- Errors: map[string][]*PartitionError{
- "topic": []*PartitionError{&PartitionError{
- Err: ErrInvalidTxnState,
- Partition: 2,
- }},
- },
- }
-
- testResponse(t, "", resp, addPartitionsToTxnResponse)
-}
diff --git a/vendor/github.com/Shopify/sarama/alter_configs_request_test.go b/vendor/github.com/Shopify/sarama/alter_configs_request_test.go
deleted file mode 100644
index b9407ca7e..000000000
--- a/vendor/github.com/Shopify/sarama/alter_configs_request_test.go
+++ /dev/null
@@ -1,86 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- emptyAlterConfigsRequest = []byte{
- 0, 0, 0, 0, // 0 configs
- 0, // don't Validate
- }
-
- singleAlterConfigsRequest = []byte{
- 0, 0, 0, 1, // 1 config
- 2, // a topic
- 0, 3, 'f', 'o', 'o', // topic name: foo
- 0, 0, 0, 1, //1 config name
- 0, 10, // 10 chars
- 's', 'e', 'g', 'm', 'e', 'n', 't', '.', 'm', 's',
- 0, 4,
- '1', '0', '0', '0',
- 0, // don't validate
- }
-
- doubleAlterConfigsRequest = []byte{
- 0, 0, 0, 2, // 2 config
- 2, // a topic
- 0, 3, 'f', 'o', 'o', // topic name: foo
- 0, 0, 0, 1, //1 config name
- 0, 10, // 10 chars
- 's', 'e', 'g', 'm', 'e', 'n', 't', '.', 'm', 's',
- 0, 4,
- '1', '0', '0', '0',
- 2, // a topic
- 0, 3, 'b', 'a', 'r', // topic name: foo
- 0, 0, 0, 1, //2 config
- 0, 12, // 12 chars
- 'r', 'e', 't', 'e', 'n', 't', 'i', 'o', 'n', '.', 'm', 's',
- 0, 4,
- '1', '0', '0', '0',
- 0, // don't validate
- }
-)
-
-func TestAlterConfigsRequest(t *testing.T) {
- var request *AlterConfigsRequest
-
- request = &AlterConfigsRequest{
- Resources: []*AlterConfigsResource{},
- }
- testRequest(t, "no requests", request, emptyAlterConfigsRequest)
-
- configValue := "1000"
- request = &AlterConfigsRequest{
- Resources: []*AlterConfigsResource{
- &AlterConfigsResource{
- Type: TopicResource,
- Name: "foo",
- ConfigEntries: map[string]*string{
- "segment.ms": &configValue,
- },
- },
- },
- }
-
- testRequest(t, "one config", request, singleAlterConfigsRequest)
-
- request = &AlterConfigsRequest{
- Resources: []*AlterConfigsResource{
- &AlterConfigsResource{
- Type: TopicResource,
- Name: "foo",
- ConfigEntries: map[string]*string{
- "segment.ms": &configValue,
- },
- },
- &AlterConfigsResource{
- Type: TopicResource,
- Name: "bar",
- ConfigEntries: map[string]*string{
- "retention.ms": &configValue,
- },
- },
- },
- }
-
- testRequest(t, "two configs", request, doubleAlterConfigsRequest)
-}
diff --git a/vendor/github.com/Shopify/sarama/alter_configs_response_test.go b/vendor/github.com/Shopify/sarama/alter_configs_response_test.go
deleted file mode 100644
index 459202870..000000000
--- a/vendor/github.com/Shopify/sarama/alter_configs_response_test.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package sarama
-
-import (
- "testing"
-)
-
-var (
- alterResponseEmpty = []byte{
- 0, 0, 0, 0, //throttle
- 0, 0, 0, 0, // no configs
- }
-
- alterResponsePopulated = []byte{
- 0, 0, 0, 0, //throttle
- 0, 0, 0, 1, // response
- 0, 0, //errorcode
- 0, 0, //string
- 2, // topic
- 0, 3, 'f', 'o', 'o',
- }
-)
-
-func TestAlterConfigsResponse(t *testing.T) {
- var response *AlterConfigsResponse
-
- response = &AlterConfigsResponse{
- Resources: []*AlterConfigsResourceResponse{},
- }
- testVersionDecodable(t, "empty", response, alterResponseEmpty, 0)
- if len(response.Resources) != 0 {
- t.Error("Expected no groups")
- }
-
- response = &AlterConfigsResponse{
- Resources: []*AlterConfigsResourceResponse{
- &AlterConfigsResourceResponse{
- ErrorCode: 0,
- ErrorMsg: "",
- Type: TopicResource,
- Name: "foo",
- },
- },
- }
- testResponse(t, "response with error", response, alterResponsePopulated)
-}
diff --git a/vendor/github.com/Shopify/sarama/api_versions_request_test.go b/vendor/github.com/Shopify/sarama/api_versions_request_test.go
deleted file mode 100644
index 5ab4fa71c..000000000
--- a/vendor/github.com/Shopify/sarama/api_versions_request_test.go
+++ /dev/null
@@ -1,14 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- apiVersionRequest = []byte{}
-)
-
-func TestApiVersionsRequest(t *testing.T) {
- var request *ApiVersionsRequest
-
- request = new(ApiVersionsRequest)
- testRequest(t, "basic", request, apiVersionRequest)
-}
diff --git a/vendor/github.com/Shopify/sarama/api_versions_response_test.go b/vendor/github.com/Shopify/sarama/api_versions_response_test.go
deleted file mode 100644
index 675a65a7d..000000000
--- a/vendor/github.com/Shopify/sarama/api_versions_response_test.go
+++ /dev/null
@@ -1,32 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- apiVersionResponse = []byte{
- 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x03,
- 0x00, 0x02,
- 0x00, 0x01,
- }
-)
-
-func TestApiVersionsResponse(t *testing.T) {
- var response *ApiVersionsResponse
-
- response = new(ApiVersionsResponse)
- testVersionDecodable(t, "no error", response, apiVersionResponse, 0)
- if response.Err != ErrNoError {
- t.Error("Decoding error failed: no error expected but found", response.Err)
- }
- if response.ApiVersions[0].ApiKey != 0x03 {
- t.Error("Decoding error: expected 0x03 but got", response.ApiVersions[0].ApiKey)
- }
- if response.ApiVersions[0].MinVersion != 0x02 {
- t.Error("Decoding error: expected 0x02 but got", response.ApiVersions[0].MinVersion)
- }
- if response.ApiVersions[0].MaxVersion != 0x01 {
- t.Error("Decoding error: expected 0x01 but got", response.ApiVersions[0].MaxVersion)
- }
-}
diff --git a/vendor/github.com/Shopify/sarama/async_producer_test.go b/vendor/github.com/Shopify/sarama/async_producer_test.go
deleted file mode 100644
index 478dca4cf..000000000
--- a/vendor/github.com/Shopify/sarama/async_producer_test.go
+++ /dev/null
@@ -1,845 +0,0 @@
-package sarama
-
-import (
- "errors"
- "log"
- "os"
- "os/signal"
- "sync"
- "testing"
- "time"
-)
-
-const TestMessage = "ABC THE MESSAGE"
-
-func closeProducer(t *testing.T, p AsyncProducer) {
- var wg sync.WaitGroup
- p.AsyncClose()
-
- wg.Add(2)
- go func() {
- for range p.Successes() {
- t.Error("Unexpected message on Successes()")
- }
- wg.Done()
- }()
- go func() {
- for msg := range p.Errors() {
- t.Error(msg.Err)
- }
- wg.Done()
- }()
- wg.Wait()
-}
-
-func expectResults(t *testing.T, p AsyncProducer, successes, errors int) {
- expect := successes + errors
- for expect > 0 {
- select {
- case msg := <-p.Errors():
- if msg.Msg.flags != 0 {
- t.Error("Message had flags set")
- }
- errors--
- expect--
- if errors < 0 {
- t.Error(msg.Err)
- }
- case msg := <-p.Successes():
- if msg.flags != 0 {
- t.Error("Message had flags set")
- }
- successes--
- expect--
- if successes < 0 {
- t.Error("Too many successes")
- }
- }
- }
- if successes != 0 || errors != 0 {
- t.Error("Unexpected successes", successes, "or errors", errors)
- }
-}
-
-type testPartitioner chan *int32
-
-func (p testPartitioner) Partition(msg *ProducerMessage, numPartitions int32) (int32, error) {
- part := <-p
- if part == nil {
- return 0, errors.New("BOOM")
- }
-
- return *part, nil
-}
-
-func (p testPartitioner) RequiresConsistency() bool {
- return true
-}
-
-func (p testPartitioner) feed(partition int32) {
- p <- &partition
-}
-
-type flakyEncoder bool
-
-func (f flakyEncoder) Length() int {
- return len(TestMessage)
-}
-
-func (f flakyEncoder) Encode() ([]byte, error) {
- if !bool(f) {
- return nil, errors.New("flaky encoding error")
- }
- return []byte(TestMessage), nil
-}
-
-func TestAsyncProducer(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
- leader := NewMockBroker(t, 2)
-
- metadataResponse := new(MetadataResponse)
- metadataResponse.AddBroker(leader.Addr(), leader.BrokerID())
- metadataResponse.AddTopicPartition("my_topic", 0, leader.BrokerID(), nil, nil, ErrNoError)
- seedBroker.Returns(metadataResponse)
-
- prodSuccess := new(ProduceResponse)
- prodSuccess.AddTopicPartition("my_topic", 0, ErrNoError)
- leader.Returns(prodSuccess)
-
- config := NewConfig()
- config.Producer.Flush.Messages = 10
- config.Producer.Return.Successes = true
- producer, err := NewAsyncProducer([]string{seedBroker.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
-
- for i := 0; i < 10; i++ {
- producer.Input() <- &ProducerMessage{Topic: "my_topic", Key: nil, Value: StringEncoder(TestMessage), Metadata: i}
- }
- for i := 0; i < 10; i++ {
- select {
- case msg := <-producer.Errors():
- t.Error(msg.Err)
- if msg.Msg.flags != 0 {
- t.Error("Message had flags set")
- }
- case msg := <-producer.Successes():
- if msg.flags != 0 {
- t.Error("Message had flags set")
- }
- if msg.Metadata.(int) != i {
- t.Error("Message metadata did not match")
- }
- case <-time.After(time.Second):
- t.Errorf("Timeout waiting for msg #%d", i)
- goto done
- }
- }
-done:
- closeProducer(t, producer)
- leader.Close()
- seedBroker.Close()
-}
-
-func TestAsyncProducerMultipleFlushes(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
- leader := NewMockBroker(t, 2)
-
- metadataResponse := new(MetadataResponse)
- metadataResponse.AddBroker(leader.Addr(), leader.BrokerID())
- metadataResponse.AddTopicPartition("my_topic", 0, leader.BrokerID(), nil, nil, ErrNoError)
- seedBroker.Returns(metadataResponse)
-
- prodSuccess := new(ProduceResponse)
- prodSuccess.AddTopicPartition("my_topic", 0, ErrNoError)
- leader.Returns(prodSuccess)
- leader.Returns(prodSuccess)
- leader.Returns(prodSuccess)
-
- config := NewConfig()
- config.Producer.Flush.Messages = 5
- config.Producer.Return.Successes = true
- producer, err := NewAsyncProducer([]string{seedBroker.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
-
- for flush := 0; flush < 3; flush++ {
- for i := 0; i < 5; i++ {
- producer.Input() <- &ProducerMessage{Topic: "my_topic", Key: nil, Value: StringEncoder(TestMessage)}
- }
- expectResults(t, producer, 5, 0)
- }
-
- closeProducer(t, producer)
- leader.Close()
- seedBroker.Close()
-}
-
-func TestAsyncProducerMultipleBrokers(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
- leader0 := NewMockBroker(t, 2)
- leader1 := NewMockBroker(t, 3)
-
- metadataResponse := new(MetadataResponse)
- metadataResponse.AddBroker(leader0.Addr(), leader0.BrokerID())
- metadataResponse.AddBroker(leader1.Addr(), leader1.BrokerID())
- metadataResponse.AddTopicPartition("my_topic", 0, leader0.BrokerID(), nil, nil, ErrNoError)
- metadataResponse.AddTopicPartition("my_topic", 1, leader1.BrokerID(), nil, nil, ErrNoError)
- seedBroker.Returns(metadataResponse)
-
- prodResponse0 := new(ProduceResponse)
- prodResponse0.AddTopicPartition("my_topic", 0, ErrNoError)
- leader0.Returns(prodResponse0)
-
- prodResponse1 := new(ProduceResponse)
- prodResponse1.AddTopicPartition("my_topic", 1, ErrNoError)
- leader1.Returns(prodResponse1)
-
- config := NewConfig()
- config.Producer.Flush.Messages = 5
- config.Producer.Return.Successes = true
- config.Producer.Partitioner = NewRoundRobinPartitioner
- producer, err := NewAsyncProducer([]string{seedBroker.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
-
- for i := 0; i < 10; i++ {
- producer.Input() <- &ProducerMessage{Topic: "my_topic", Key: nil, Value: StringEncoder(TestMessage)}
- }
- expectResults(t, producer, 10, 0)
-
- closeProducer(t, producer)
- leader1.Close()
- leader0.Close()
- seedBroker.Close()
-}
-
-func TestAsyncProducerCustomPartitioner(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
- leader := NewMockBroker(t, 2)
-
- metadataResponse := new(MetadataResponse)
- metadataResponse.AddBroker(leader.Addr(), leader.BrokerID())
- metadataResponse.AddTopicPartition("my_topic", 0, leader.BrokerID(), nil, nil, ErrNoError)
- seedBroker.Returns(metadataResponse)
-
- prodResponse := new(ProduceResponse)
- prodResponse.AddTopicPartition("my_topic", 0, ErrNoError)
- leader.Returns(prodResponse)
-
- config := NewConfig()
- config.Producer.Flush.Messages = 2
- config.Producer.Return.Successes = true
- config.Producer.Partitioner = func(topic string) Partitioner {
- p := make(testPartitioner)
- go func() {
- p.feed(0)
- p <- nil
- p <- nil
- p <- nil
- p.feed(0)
- }()
- return p
- }
- producer, err := NewAsyncProducer([]string{seedBroker.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
-
- for i := 0; i < 5; i++ {
- producer.Input() <- &ProducerMessage{Topic: "my_topic", Key: nil, Value: StringEncoder(TestMessage)}
- }
- expectResults(t, producer, 2, 3)
-
- closeProducer(t, producer)
- leader.Close()
- seedBroker.Close()
-}
-
-func TestAsyncProducerFailureRetry(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
- leader1 := NewMockBroker(t, 2)
- leader2 := NewMockBroker(t, 3)
-
- metadataLeader1 := new(MetadataResponse)
- metadataLeader1.AddBroker(leader1.Addr(), leader1.BrokerID())
- metadataLeader1.AddTopicPartition("my_topic", 0, leader1.BrokerID(), nil, nil, ErrNoError)
- seedBroker.Returns(metadataLeader1)
-
- config := NewConfig()
- config.Producer.Flush.Messages = 10
- config.Producer.Return.Successes = true
- config.Producer.Retry.Backoff = 0
- producer, err := NewAsyncProducer([]string{seedBroker.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
- seedBroker.Close()
-
- for i := 0; i < 10; i++ {
- producer.Input() <- &ProducerMessage{Topic: "my_topic", Key: nil, Value: StringEncoder(TestMessage)}
- }
- prodNotLeader := new(ProduceResponse)
- prodNotLeader.AddTopicPartition("my_topic", 0, ErrNotLeaderForPartition)
- leader1.Returns(prodNotLeader)
-
- metadataLeader2 := new(MetadataResponse)
- metadataLeader2.AddBroker(leader2.Addr(), leader2.BrokerID())
- metadataLeader2.AddTopicPartition("my_topic", 0, leader2.BrokerID(), nil, nil, ErrNoError)
- leader1.Returns(metadataLeader2)
-
- prodSuccess := new(ProduceResponse)
- prodSuccess.AddTopicPartition("my_topic", 0, ErrNoError)
- leader2.Returns(prodSuccess)
- expectResults(t, producer, 10, 0)
- leader1.Close()
-
- for i := 0; i < 10; i++ {
- producer.Input() <- &ProducerMessage{Topic: "my_topic", Key: nil, Value: StringEncoder(TestMessage)}
- }
- leader2.Returns(prodSuccess)
- expectResults(t, producer, 10, 0)
-
- leader2.Close()
- closeProducer(t, producer)
-}
-
-func TestAsyncProducerEncoderFailures(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
- leader := NewMockBroker(t, 2)
-
- metadataResponse := new(MetadataResponse)
- metadataResponse.AddBroker(leader.Addr(), leader.BrokerID())
- metadataResponse.AddTopicPartition("my_topic", 0, leader.BrokerID(), nil, nil, ErrNoError)
- seedBroker.Returns(metadataResponse)
-
- prodSuccess := new(ProduceResponse)
- prodSuccess.AddTopicPartition("my_topic", 0, ErrNoError)
- leader.Returns(prodSuccess)
- leader.Returns(prodSuccess)
- leader.Returns(prodSuccess)
-
- config := NewConfig()
- config.Producer.Flush.Messages = 1
- config.Producer.Return.Successes = true
- config.Producer.Partitioner = NewManualPartitioner
- producer, err := NewAsyncProducer([]string{seedBroker.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
-
- for flush := 0; flush < 3; flush++ {
- producer.Input() <- &ProducerMessage{Topic: "my_topic", Key: flakyEncoder(true), Value: flakyEncoder(false)}
- producer.Input() <- &ProducerMessage{Topic: "my_topic", Key: flakyEncoder(false), Value: flakyEncoder(true)}
- producer.Input() <- &ProducerMessage{Topic: "my_topic", Key: flakyEncoder(true), Value: flakyEncoder(true)}
- expectResults(t, producer, 1, 2)
- }
-
- closeProducer(t, producer)
- leader.Close()
- seedBroker.Close()
-}
-
-// If a Kafka broker becomes unavailable and then returns back in service, then
-// producer reconnects to it and continues sending messages.
-func TestAsyncProducerBrokerBounce(t *testing.T) {
- // Given
- seedBroker := NewMockBroker(t, 1)
- leader := NewMockBroker(t, 2)
- leaderAddr := leader.Addr()
-
- metadataResponse := new(MetadataResponse)
- metadataResponse.AddBroker(leaderAddr, leader.BrokerID())
- metadataResponse.AddTopicPartition("my_topic", 0, leader.BrokerID(), nil, nil, ErrNoError)
- seedBroker.Returns(metadataResponse)
-
- prodSuccess := new(ProduceResponse)
- prodSuccess.AddTopicPartition("my_topic", 0, ErrNoError)
-
- config := NewConfig()
- config.Producer.Flush.Messages = 1
- config.Producer.Return.Successes = true
- config.Producer.Retry.Backoff = 0
- producer, err := NewAsyncProducer([]string{seedBroker.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
- producer.Input() <- &ProducerMessage{Topic: "my_topic", Key: nil, Value: StringEncoder(TestMessage)}
- leader.Returns(prodSuccess)
- expectResults(t, producer, 1, 0)
-
- // When: a broker connection gets reset by a broker (network glitch, restart, you name it).
- leader.Close() // producer should get EOF
- leader = NewMockBrokerAddr(t, 2, leaderAddr) // start it up again right away for giggles
- seedBroker.Returns(metadataResponse) // tell it to go to broker 2 again
-
- // Then: a produced message goes through the new broker connection.
- producer.Input() <- &ProducerMessage{Topic: "my_topic", Key: nil, Value: StringEncoder(TestMessage)}
- leader.Returns(prodSuccess)
- expectResults(t, producer, 1, 0)
-
- closeProducer(t, producer)
- seedBroker.Close()
- leader.Close()
-}
-
-func TestAsyncProducerBrokerBounceWithStaleMetadata(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
- leader1 := NewMockBroker(t, 2)
- leader2 := NewMockBroker(t, 3)
-
- metadataLeader1 := new(MetadataResponse)
- metadataLeader1.AddBroker(leader1.Addr(), leader1.BrokerID())
- metadataLeader1.AddTopicPartition("my_topic", 0, leader1.BrokerID(), nil, nil, ErrNoError)
- seedBroker.Returns(metadataLeader1)
-
- config := NewConfig()
- config.Producer.Flush.Messages = 10
- config.Producer.Return.Successes = true
- config.Producer.Retry.Max = 3
- config.Producer.Retry.Backoff = 0
- producer, err := NewAsyncProducer([]string{seedBroker.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
-
- for i := 0; i < 10; i++ {
- producer.Input() <- &ProducerMessage{Topic: "my_topic", Key: nil, Value: StringEncoder(TestMessage)}
- }
- leader1.Close() // producer should get EOF
- seedBroker.Returns(metadataLeader1) // tell it to go to leader1 again even though it's still down
- seedBroker.Returns(metadataLeader1) // tell it to go to leader1 again even though it's still down
-
- // ok fine, tell it to go to leader2 finally
- metadataLeader2 := new(MetadataResponse)
- metadataLeader2.AddBroker(leader2.Addr(), leader2.BrokerID())
- metadataLeader2.AddTopicPartition("my_topic", 0, leader2.BrokerID(), nil, nil, ErrNoError)
- seedBroker.Returns(metadataLeader2)
-
- prodSuccess := new(ProduceResponse)
- prodSuccess.AddTopicPartition("my_topic", 0, ErrNoError)
- leader2.Returns(prodSuccess)
- expectResults(t, producer, 10, 0)
- seedBroker.Close()
- leader2.Close()
-
- closeProducer(t, producer)
-}
-
-func TestAsyncProducerMultipleRetries(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
- leader1 := NewMockBroker(t, 2)
- leader2 := NewMockBroker(t, 3)
-
- metadataLeader1 := new(MetadataResponse)
- metadataLeader1.AddBroker(leader1.Addr(), leader1.BrokerID())
- metadataLeader1.AddTopicPartition("my_topic", 0, leader1.BrokerID(), nil, nil, ErrNoError)
- seedBroker.Returns(metadataLeader1)
-
- config := NewConfig()
- config.Producer.Flush.Messages = 10
- config.Producer.Return.Successes = true
- config.Producer.Retry.Max = 4
- config.Producer.Retry.Backoff = 0
- producer, err := NewAsyncProducer([]string{seedBroker.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
-
- for i := 0; i < 10; i++ {
- producer.Input() <- &ProducerMessage{Topic: "my_topic", Key: nil, Value: StringEncoder(TestMessage)}
- }
- prodNotLeader := new(ProduceResponse)
- prodNotLeader.AddTopicPartition("my_topic", 0, ErrNotLeaderForPartition)
- leader1.Returns(prodNotLeader)
-
- metadataLeader2 := new(MetadataResponse)
- metadataLeader2.AddBroker(leader2.Addr(), leader2.BrokerID())
- metadataLeader2.AddTopicPartition("my_topic", 0, leader2.BrokerID(), nil, nil, ErrNoError)
- seedBroker.Returns(metadataLeader2)
- leader2.Returns(prodNotLeader)
- seedBroker.Returns(metadataLeader1)
- leader1.Returns(prodNotLeader)
- seedBroker.Returns(metadataLeader1)
- leader1.Returns(prodNotLeader)
- seedBroker.Returns(metadataLeader2)
-
- prodSuccess := new(ProduceResponse)
- prodSuccess.AddTopicPartition("my_topic", 0, ErrNoError)
- leader2.Returns(prodSuccess)
- expectResults(t, producer, 10, 0)
-
- for i := 0; i < 10; i++ {
- producer.Input() <- &ProducerMessage{Topic: "my_topic", Key: nil, Value: StringEncoder(TestMessage)}
- }
- leader2.Returns(prodSuccess)
- expectResults(t, producer, 10, 0)
-
- seedBroker.Close()
- leader1.Close()
- leader2.Close()
- closeProducer(t, producer)
-}
-
-func TestAsyncProducerOutOfRetries(t *testing.T) {
- t.Skip("Enable once bug #294 is fixed.")
-
- seedBroker := NewMockBroker(t, 1)
- leader := NewMockBroker(t, 2)
-
- metadataResponse := new(MetadataResponse)
- metadataResponse.AddBroker(leader.Addr(), leader.BrokerID())
- metadataResponse.AddTopicPartition("my_topic", 0, leader.BrokerID(), nil, nil, ErrNoError)
- seedBroker.Returns(metadataResponse)
-
- config := NewConfig()
- config.Producer.Flush.Messages = 10
- config.Producer.Return.Successes = true
- config.Producer.Retry.Backoff = 0
- config.Producer.Retry.Max = 0
- producer, err := NewAsyncProducer([]string{seedBroker.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
-
- for i := 0; i < 10; i++ {
- producer.Input() <- &ProducerMessage{Topic: "my_topic", Key: nil, Value: StringEncoder(TestMessage)}
- }
-
- prodNotLeader := new(ProduceResponse)
- prodNotLeader.AddTopicPartition("my_topic", 0, ErrNotLeaderForPartition)
- leader.Returns(prodNotLeader)
-
- for i := 0; i < 10; i++ {
- select {
- case msg := <-producer.Errors():
- if msg.Err != ErrNotLeaderForPartition {
- t.Error(msg.Err)
- }
- case <-producer.Successes():
- t.Error("Unexpected success")
- }
- }
-
- seedBroker.Returns(metadataResponse)
-
- for i := 0; i < 10; i++ {
- producer.Input() <- &ProducerMessage{Topic: "my_topic", Key: nil, Value: StringEncoder(TestMessage)}
- }
-
- prodSuccess := new(ProduceResponse)
- prodSuccess.AddTopicPartition("my_topic", 0, ErrNoError)
- leader.Returns(prodSuccess)
-
- expectResults(t, producer, 10, 0)
-
- leader.Close()
- seedBroker.Close()
- safeClose(t, producer)
-}
-
-func TestAsyncProducerRetryWithReferenceOpen(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
- leader := NewMockBroker(t, 2)
- leaderAddr := leader.Addr()
-
- metadataResponse := new(MetadataResponse)
- metadataResponse.AddBroker(leaderAddr, leader.BrokerID())
- metadataResponse.AddTopicPartition("my_topic", 0, leader.BrokerID(), nil, nil, ErrNoError)
- metadataResponse.AddTopicPartition("my_topic", 1, leader.BrokerID(), nil, nil, ErrNoError)
- seedBroker.Returns(metadataResponse)
-
- config := NewConfig()
- config.Producer.Return.Successes = true
- config.Producer.Retry.Backoff = 0
- config.Producer.Retry.Max = 1
- config.Producer.Partitioner = NewRoundRobinPartitioner
- producer, err := NewAsyncProducer([]string{seedBroker.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
-
- // prime partition 0
- producer.Input() <- &ProducerMessage{Topic: "my_topic", Key: nil, Value: StringEncoder(TestMessage)}
- prodSuccess := new(ProduceResponse)
- prodSuccess.AddTopicPartition("my_topic", 0, ErrNoError)
- leader.Returns(prodSuccess)
- expectResults(t, producer, 1, 0)
-
- // prime partition 1
- producer.Input() <- &ProducerMessage{Topic: "my_topic", Key: nil, Value: StringEncoder(TestMessage)}
- prodSuccess = new(ProduceResponse)
- prodSuccess.AddTopicPartition("my_topic", 1, ErrNoError)
- leader.Returns(prodSuccess)
- expectResults(t, producer, 1, 0)
-
- // reboot the broker (the producer will get EOF on its existing connection)
- leader.Close()
- leader = NewMockBrokerAddr(t, 2, leaderAddr)
-
- // send another message on partition 0 to trigger the EOF and retry
- producer.Input() <- &ProducerMessage{Topic: "my_topic", Key: nil, Value: StringEncoder(TestMessage)}
-
- // tell partition 0 to go to that broker again
- seedBroker.Returns(metadataResponse)
-
- // succeed this time
- prodSuccess = new(ProduceResponse)
- prodSuccess.AddTopicPartition("my_topic", 0, ErrNoError)
- leader.Returns(prodSuccess)
- expectResults(t, producer, 1, 0)
-
- // shutdown
- closeProducer(t, producer)
- seedBroker.Close()
- leader.Close()
-}
-
-func TestAsyncProducerFlusherRetryCondition(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
- leader := NewMockBroker(t, 2)
-
- metadataResponse := new(MetadataResponse)
- metadataResponse.AddBroker(leader.Addr(), leader.BrokerID())
- metadataResponse.AddTopicPartition("my_topic", 0, leader.BrokerID(), nil, nil, ErrNoError)
- metadataResponse.AddTopicPartition("my_topic", 1, leader.BrokerID(), nil, nil, ErrNoError)
- seedBroker.Returns(metadataResponse)
-
- config := NewConfig()
- config.Producer.Flush.Messages = 5
- config.Producer.Return.Successes = true
- config.Producer.Retry.Backoff = 0
- config.Producer.Retry.Max = 1
- config.Producer.Partitioner = NewManualPartitioner
- producer, err := NewAsyncProducer([]string{seedBroker.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
-
- // prime partitions
- for p := int32(0); p < 2; p++ {
- for i := 0; i < 5; i++ {
- producer.Input() <- &ProducerMessage{Topic: "my_topic", Key: nil, Value: StringEncoder(TestMessage), Partition: p}
- }
- prodSuccess := new(ProduceResponse)
- prodSuccess.AddTopicPartition("my_topic", p, ErrNoError)
- leader.Returns(prodSuccess)
- expectResults(t, producer, 5, 0)
- }
-
- // send more messages on partition 0
- for i := 0; i < 5; i++ {
- producer.Input() <- &ProducerMessage{Topic: "my_topic", Key: nil, Value: StringEncoder(TestMessage), Partition: 0}
- }
- prodNotLeader := new(ProduceResponse)
- prodNotLeader.AddTopicPartition("my_topic", 0, ErrNotLeaderForPartition)
- leader.Returns(prodNotLeader)
-
- time.Sleep(50 * time.Millisecond)
-
- leader.SetHandlerByMap(map[string]MockResponse{
- "ProduceRequest": NewMockProduceResponse(t).
- SetVersion(0).
- SetError("my_topic", 0, ErrNoError),
- })
-
- // tell partition 0 to go to that broker again
- seedBroker.Returns(metadataResponse)
-
- // succeed this time
- expectResults(t, producer, 5, 0)
-
- // put five more through
- for i := 0; i < 5; i++ {
- producer.Input() <- &ProducerMessage{Topic: "my_topic", Key: nil, Value: StringEncoder(TestMessage), Partition: 0}
- }
- expectResults(t, producer, 5, 0)
-
- // shutdown
- closeProducer(t, producer)
- seedBroker.Close()
- leader.Close()
-}
-
-func TestAsyncProducerRetryShutdown(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
- leader := NewMockBroker(t, 2)
-
- metadataLeader := new(MetadataResponse)
- metadataLeader.AddBroker(leader.Addr(), leader.BrokerID())
- metadataLeader.AddTopicPartition("my_topic", 0, leader.BrokerID(), nil, nil, ErrNoError)
- seedBroker.Returns(metadataLeader)
-
- config := NewConfig()
- config.Producer.Flush.Messages = 10
- config.Producer.Return.Successes = true
- config.Producer.Retry.Backoff = 0
- producer, err := NewAsyncProducer([]string{seedBroker.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
-
- for i := 0; i < 10; i++ {
- producer.Input() <- &ProducerMessage{Topic: "my_topic", Key: nil, Value: StringEncoder(TestMessage)}
- }
- producer.AsyncClose()
- time.Sleep(5 * time.Millisecond) // let the shutdown goroutine kick in
-
- producer.Input() <- &ProducerMessage{Topic: "FOO"}
- if err := <-producer.Errors(); err.Err != ErrShuttingDown {
- t.Error(err)
- }
-
- prodNotLeader := new(ProduceResponse)
- prodNotLeader.AddTopicPartition("my_topic", 0, ErrNotLeaderForPartition)
- leader.Returns(prodNotLeader)
-
- seedBroker.Returns(metadataLeader)
-
- prodSuccess := new(ProduceResponse)
- prodSuccess.AddTopicPartition("my_topic", 0, ErrNoError)
- leader.Returns(prodSuccess)
- expectResults(t, producer, 10, 0)
-
- seedBroker.Close()
- leader.Close()
-
- // wait for the async-closed producer to shut down fully
- for err := range producer.Errors() {
- t.Error(err)
- }
-}
-
-func TestAsyncProducerNoReturns(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
- leader := NewMockBroker(t, 2)
-
- metadataLeader := new(MetadataResponse)
- metadataLeader.AddBroker(leader.Addr(), leader.BrokerID())
- metadataLeader.AddTopicPartition("my_topic", 0, leader.BrokerID(), nil, nil, ErrNoError)
- seedBroker.Returns(metadataLeader)
-
- config := NewConfig()
- config.Producer.Flush.Messages = 10
- config.Producer.Return.Successes = false
- config.Producer.Return.Errors = false
- config.Producer.Retry.Backoff = 0
- producer, err := NewAsyncProducer([]string{seedBroker.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
-
- for i := 0; i < 10; i++ {
- producer.Input() <- &ProducerMessage{Topic: "my_topic", Key: nil, Value: StringEncoder(TestMessage)}
- }
-
- wait := make(chan bool)
- go func() {
- if err := producer.Close(); err != nil {
- t.Error(err)
- }
- close(wait)
- }()
-
- prodSuccess := new(ProduceResponse)
- prodSuccess.AddTopicPartition("my_topic", 0, ErrNoError)
- leader.Returns(prodSuccess)
-
- <-wait
- seedBroker.Close()
- leader.Close()
-}
-
-// This example shows how to use the producer while simultaneously
-// reading the Errors channel to know about any failures.
-func ExampleAsyncProducer_select() {
- producer, err := NewAsyncProducer([]string{"localhost:9092"}, nil)
- if err != nil {
- panic(err)
- }
-
- defer func() {
- if err := producer.Close(); err != nil {
- log.Fatalln(err)
- }
- }()
-
- // Trap SIGINT to trigger a shutdown.
- signals := make(chan os.Signal, 1)
- signal.Notify(signals, os.Interrupt)
-
- var enqueued, errors int
-ProducerLoop:
- for {
- select {
- case producer.Input() <- &ProducerMessage{Topic: "my_topic", Key: nil, Value: StringEncoder("testing 123")}:
- enqueued++
- case err := <-producer.Errors():
- log.Println("Failed to produce message", err)
- errors++
- case <-signals:
- break ProducerLoop
- }
- }
-
- log.Printf("Enqueued: %d; errors: %d\n", enqueued, errors)
-}
-
-// This example shows how to use the producer with separate goroutines
-// reading from the Successes and Errors channels. Note that in order
-// for the Successes channel to be populated, you have to set
-// config.Producer.Return.Successes to true.
-func ExampleAsyncProducer_goroutines() {
- config := NewConfig()
- config.Producer.Return.Successes = true
- producer, err := NewAsyncProducer([]string{"localhost:9092"}, config)
- if err != nil {
- panic(err)
- }
-
- // Trap SIGINT to trigger a graceful shutdown.
- signals := make(chan os.Signal, 1)
- signal.Notify(signals, os.Interrupt)
-
- var (
- wg sync.WaitGroup
- enqueued, successes, errors int
- )
-
- wg.Add(1)
- go func() {
- defer wg.Done()
- for range producer.Successes() {
- successes++
- }
- }()
-
- wg.Add(1)
- go func() {
- defer wg.Done()
- for err := range producer.Errors() {
- log.Println(err)
- errors++
- }
- }()
-
-ProducerLoop:
- for {
- message := &ProducerMessage{Topic: "my_topic", Value: StringEncoder("testing 123")}
- select {
- case producer.Input() <- message:
- enqueued++
-
- case <-signals:
- producer.AsyncClose() // Trigger a shutdown of the producer.
- break ProducerLoop
- }
- }
-
- wg.Wait()
-
- log.Printf("Successfully produced: %d; errors: %d\n", successes, errors)
-}
diff --git a/vendor/github.com/Shopify/sarama/broker_test.go b/vendor/github.com/Shopify/sarama/broker_test.go
deleted file mode 100644
index 9263cef8b..000000000
--- a/vendor/github.com/Shopify/sarama/broker_test.go
+++ /dev/null
@@ -1,358 +0,0 @@
-package sarama
-
-import (
- "fmt"
- "testing"
- "time"
-)
-
-func ExampleBroker() {
- broker := NewBroker("localhost:9092")
- err := broker.Open(nil)
- if err != nil {
- panic(err)
- }
-
- request := MetadataRequest{Topics: []string{"myTopic"}}
- response, err := broker.GetMetadata(&request)
- if err != nil {
- _ = broker.Close()
- panic(err)
- }
-
- fmt.Println("There are", len(response.Topics), "topics active in the cluster.")
-
- if err = broker.Close(); err != nil {
- panic(err)
- }
-}
-
-type mockEncoder struct {
- bytes []byte
-}
-
-func (m mockEncoder) encode(pe packetEncoder) error {
- return pe.putRawBytes(m.bytes)
-}
-
-type brokerMetrics struct {
- bytesRead int
- bytesWritten int
-}
-
-func TestBrokerAccessors(t *testing.T) {
- broker := NewBroker("abc:123")
-
- if broker.ID() != -1 {
- t.Error("New broker didn't have an ID of -1.")
- }
-
- if broker.Addr() != "abc:123" {
- t.Error("New broker didn't have the correct address")
- }
-
- broker.id = 34
- if broker.ID() != 34 {
- t.Error("Manually setting broker ID did not take effect.")
- }
-}
-
-func TestSimpleBrokerCommunication(t *testing.T) {
- for _, tt := range brokerTestTable {
- Logger.Printf("Testing broker communication for %s", tt.name)
- mb := NewMockBroker(t, 0)
- mb.Returns(&mockEncoder{tt.response})
- pendingNotify := make(chan brokerMetrics)
- // Register a callback to be notified about successful requests
- mb.SetNotifier(func(bytesRead, bytesWritten int) {
- pendingNotify <- brokerMetrics{bytesRead, bytesWritten}
- })
- broker := NewBroker(mb.Addr())
- // Set the broker id in order to validate local broker metrics
- broker.id = 0
- conf := NewConfig()
- conf.Version = tt.version
- err := broker.Open(conf)
- if err != nil {
- t.Fatal(err)
- }
- tt.runner(t, broker)
- // Wait up to 500 ms for the remote broker to process the request and
- // notify us about the metrics
- timeout := 500 * time.Millisecond
- select {
- case mockBrokerMetrics := <-pendingNotify:
- validateBrokerMetrics(t, broker, mockBrokerMetrics)
- case <-time.After(timeout):
- t.Errorf("No request received for: %s after waiting for %v", tt.name, timeout)
- }
- mb.Close()
- err = broker.Close()
- if err != nil {
- t.Error(err)
- }
- }
-
-}
-
-// We're not testing encoding/decoding here, so most of the requests/responses will be empty for simplicity's sake
-var brokerTestTable = []struct {
- version KafkaVersion
- name string
- response []byte
- runner func(*testing.T, *Broker)
-}{
- {V0_10_0_0,
- "MetadataRequest",
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- func(t *testing.T, broker *Broker) {
- request := MetadataRequest{}
- response, err := broker.GetMetadata(&request)
- if err != nil {
- t.Error(err)
- }
- if response == nil {
- t.Error("Metadata request got no response!")
- }
- }},
-
- {V0_10_0_0,
- "ConsumerMetadataRequest",
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 't', 0x00, 0x00, 0x00, 0x00},
- func(t *testing.T, broker *Broker) {
- request := ConsumerMetadataRequest{}
- response, err := broker.GetConsumerMetadata(&request)
- if err != nil {
- t.Error(err)
- }
- if response == nil {
- t.Error("Consumer Metadata request got no response!")
- }
- }},
-
- {V0_10_0_0,
- "ProduceRequest (NoResponse)",
- []byte{},
- func(t *testing.T, broker *Broker) {
- request := ProduceRequest{}
- request.RequiredAcks = NoResponse
- response, err := broker.Produce(&request)
- if err != nil {
- t.Error(err)
- }
- if response != nil {
- t.Error("Produce request with NoResponse got a response!")
- }
- }},
-
- {V0_10_0_0,
- "ProduceRequest (WaitForLocal)",
- []byte{0x00, 0x00, 0x00, 0x00},
- func(t *testing.T, broker *Broker) {
- request := ProduceRequest{}
- request.RequiredAcks = WaitForLocal
- response, err := broker.Produce(&request)
- if err != nil {
- t.Error(err)
- }
- if response == nil {
- t.Error("Produce request without NoResponse got no response!")
- }
- }},
-
- {V0_10_0_0,
- "FetchRequest",
- []byte{0x00, 0x00, 0x00, 0x00},
- func(t *testing.T, broker *Broker) {
- request := FetchRequest{}
- response, err := broker.Fetch(&request)
- if err != nil {
- t.Error(err)
- }
- if response == nil {
- t.Error("Fetch request got no response!")
- }
- }},
-
- {V0_10_0_0,
- "OffsetFetchRequest",
- []byte{0x00, 0x00, 0x00, 0x00},
- func(t *testing.T, broker *Broker) {
- request := OffsetFetchRequest{}
- response, err := broker.FetchOffset(&request)
- if err != nil {
- t.Error(err)
- }
- if response == nil {
- t.Error("OffsetFetch request got no response!")
- }
- }},
-
- {V0_10_0_0,
- "OffsetCommitRequest",
- []byte{0x00, 0x00, 0x00, 0x00},
- func(t *testing.T, broker *Broker) {
- request := OffsetCommitRequest{}
- response, err := broker.CommitOffset(&request)
- if err != nil {
- t.Error(err)
- }
- if response == nil {
- t.Error("OffsetCommit request got no response!")
- }
- }},
-
- {V0_10_0_0,
- "OffsetRequest",
- []byte{0x00, 0x00, 0x00, 0x00},
- func(t *testing.T, broker *Broker) {
- request := OffsetRequest{}
- response, err := broker.GetAvailableOffsets(&request)
- if err != nil {
- t.Error(err)
- }
- if response == nil {
- t.Error("Offset request got no response!")
- }
- }},
-
- {V0_10_0_0,
- "JoinGroupRequest",
- []byte{0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- func(t *testing.T, broker *Broker) {
- request := JoinGroupRequest{}
- response, err := broker.JoinGroup(&request)
- if err != nil {
- t.Error(err)
- }
- if response == nil {
- t.Error("JoinGroup request got no response!")
- }
- }},
-
- {V0_10_0_0,
- "SyncGroupRequest",
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- func(t *testing.T, broker *Broker) {
- request := SyncGroupRequest{}
- response, err := broker.SyncGroup(&request)
- if err != nil {
- t.Error(err)
- }
- if response == nil {
- t.Error("SyncGroup request got no response!")
- }
- }},
-
- {V0_10_0_0,
- "LeaveGroupRequest",
- []byte{0x00, 0x00},
- func(t *testing.T, broker *Broker) {
- request := LeaveGroupRequest{}
- response, err := broker.LeaveGroup(&request)
- if err != nil {
- t.Error(err)
- }
- if response == nil {
- t.Error("LeaveGroup request got no response!")
- }
- }},
-
- {V0_10_0_0,
- "HeartbeatRequest",
- []byte{0x00, 0x00},
- func(t *testing.T, broker *Broker) {
- request := HeartbeatRequest{}
- response, err := broker.Heartbeat(&request)
- if err != nil {
- t.Error(err)
- }
- if response == nil {
- t.Error("Heartbeat request got no response!")
- }
- }},
-
- {V0_10_0_0,
- "ListGroupsRequest",
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- func(t *testing.T, broker *Broker) {
- request := ListGroupsRequest{}
- response, err := broker.ListGroups(&request)
- if err != nil {
- t.Error(err)
- }
- if response == nil {
- t.Error("ListGroups request got no response!")
- }
- }},
-
- {V0_10_0_0,
- "DescribeGroupsRequest",
- []byte{0x00, 0x00, 0x00, 0x00},
- func(t *testing.T, broker *Broker) {
- request := DescribeGroupsRequest{}
- response, err := broker.DescribeGroups(&request)
- if err != nil {
- t.Error(err)
- }
- if response == nil {
- t.Error("DescribeGroups request got no response!")
- }
- }},
-
- {V0_10_0_0,
- "ApiVersionsRequest",
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- func(t *testing.T, broker *Broker) {
- request := ApiVersionsRequest{}
- response, err := broker.ApiVersions(&request)
- if err != nil {
- t.Error(err)
- }
- if response == nil {
- t.Error("ApiVersions request got no response!")
- }
- }},
-
- {V1_1_0_0,
- "DeleteGroupsRequest",
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- func(t *testing.T, broker *Broker) {
- request := DeleteGroupsRequest{}
- response, err := broker.DeleteGroups(&request)
- if err != nil {
- t.Error(err)
- }
- if response == nil {
- t.Error("DeleteGroups request got no response!")
- }
- }},
-}
-
-func validateBrokerMetrics(t *testing.T, broker *Broker, mockBrokerMetrics brokerMetrics) {
- metricValidators := newMetricValidators()
- mockBrokerBytesRead := mockBrokerMetrics.bytesRead
- mockBrokerBytesWritten := mockBrokerMetrics.bytesWritten
-
- // Check that the number of bytes sent corresponds to what the mock broker received
- metricValidators.registerForAllBrokers(broker, countMeterValidator("incoming-byte-rate", mockBrokerBytesWritten))
- if mockBrokerBytesWritten == 0 {
- // This a ProduceRequest with NoResponse
- metricValidators.registerForAllBrokers(broker, countMeterValidator("response-rate", 0))
- metricValidators.registerForAllBrokers(broker, countHistogramValidator("response-size", 0))
- metricValidators.registerForAllBrokers(broker, minMaxHistogramValidator("response-size", 0, 0))
- } else {
- metricValidators.registerForAllBrokers(broker, countMeterValidator("response-rate", 1))
- metricValidators.registerForAllBrokers(broker, countHistogramValidator("response-size", 1))
- metricValidators.registerForAllBrokers(broker, minMaxHistogramValidator("response-size", mockBrokerBytesWritten, mockBrokerBytesWritten))
- }
-
- // Check that the number of bytes received corresponds to what the mock broker sent
- metricValidators.registerForAllBrokers(broker, countMeterValidator("outgoing-byte-rate", mockBrokerBytesRead))
- metricValidators.registerForAllBrokers(broker, countMeterValidator("request-rate", 1))
- metricValidators.registerForAllBrokers(broker, countHistogramValidator("request-size", 1))
- metricValidators.registerForAllBrokers(broker, minMaxHistogramValidator("request-size", mockBrokerBytesRead, mockBrokerBytesRead))
-
- // Run the validators
- metricValidators.run(t, broker.conf.MetricRegistry)
-}
diff --git a/vendor/github.com/Shopify/sarama/client_test.go b/vendor/github.com/Shopify/sarama/client_test.go
deleted file mode 100644
index fc255a730..000000000
--- a/vendor/github.com/Shopify/sarama/client_test.go
+++ /dev/null
@@ -1,660 +0,0 @@
-package sarama
-
-import (
- "io"
- "sync"
- "testing"
- "time"
-)
-
-func safeClose(t testing.TB, c io.Closer) {
- err := c.Close()
- if err != nil {
- t.Error(err)
- }
-}
-
-func TestSimpleClient(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
-
- seedBroker.Returns(new(MetadataResponse))
-
- client, err := NewClient([]string{seedBroker.Addr()}, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- seedBroker.Close()
- safeClose(t, client)
-}
-
-func TestCachedPartitions(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
-
- replicas := []int32{3, 1, 5}
- isr := []int32{5, 1}
-
- metadataResponse := new(MetadataResponse)
- metadataResponse.AddBroker("localhost:12345", 2)
- metadataResponse.AddTopicPartition("my_topic", 0, 2, replicas, isr, ErrNoError)
- metadataResponse.AddTopicPartition("my_topic", 1, 2, replicas, isr, ErrLeaderNotAvailable)
- seedBroker.Returns(metadataResponse)
-
- config := NewConfig()
- config.Metadata.Retry.Max = 0
- c, err := NewClient([]string{seedBroker.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
- client := c.(*client)
-
- // Verify they aren't cached the same
- allP := client.cachedPartitionsResults["my_topic"][allPartitions]
- writeP := client.cachedPartitionsResults["my_topic"][writablePartitions]
- if len(allP) == len(writeP) {
- t.Fatal("Invalid lengths!")
- }
-
- tmp := client.cachedPartitionsResults["my_topic"]
- // Verify we actually use the cache at all!
- tmp[allPartitions] = []int32{1, 2, 3, 4}
- client.cachedPartitionsResults["my_topic"] = tmp
- if 4 != len(client.cachedPartitions("my_topic", allPartitions)) {
- t.Fatal("Not using the cache!")
- }
-
- seedBroker.Close()
- safeClose(t, client)
-}
-
-func TestClientDoesntCachePartitionsForTopicsWithErrors(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
-
- replicas := []int32{seedBroker.BrokerID()}
-
- metadataResponse := new(MetadataResponse)
- metadataResponse.AddBroker(seedBroker.Addr(), seedBroker.BrokerID())
- metadataResponse.AddTopicPartition("my_topic", 1, replicas[0], replicas, replicas, ErrNoError)
- metadataResponse.AddTopicPartition("my_topic", 2, replicas[0], replicas, replicas, ErrNoError)
- seedBroker.Returns(metadataResponse)
-
- config := NewConfig()
- config.Metadata.Retry.Max = 0
- client, err := NewClient([]string{seedBroker.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
-
- metadataResponse = new(MetadataResponse)
- metadataResponse.AddTopic("unknown", ErrUnknownTopicOrPartition)
- seedBroker.Returns(metadataResponse)
-
- partitions, err := client.Partitions("unknown")
-
- if err != ErrUnknownTopicOrPartition {
- t.Error("Expected ErrUnknownTopicOrPartition, found", err)
- }
- if partitions != nil {
- t.Errorf("Should return nil as partition list, found %v", partitions)
- }
-
- // Should still use the cache of a known topic
- partitions, err = client.Partitions("my_topic")
- if err != nil {
- t.Errorf("Expected no error, found %v", err)
- }
-
- metadataResponse = new(MetadataResponse)
- metadataResponse.AddTopic("unknown", ErrUnknownTopicOrPartition)
- seedBroker.Returns(metadataResponse)
-
- // Should not use cache for unknown topic
- partitions, err = client.Partitions("unknown")
- if err != ErrUnknownTopicOrPartition {
- t.Error("Expected ErrUnknownTopicOrPartition, found", err)
- }
- if partitions != nil {
- t.Errorf("Should return nil as partition list, found %v", partitions)
- }
-
- seedBroker.Close()
- safeClose(t, client)
-}
-
-func TestClientSeedBrokers(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
-
- metadataResponse := new(MetadataResponse)
- metadataResponse.AddBroker("localhost:12345", 2)
- seedBroker.Returns(metadataResponse)
-
- client, err := NewClient([]string{seedBroker.Addr()}, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- seedBroker.Close()
- safeClose(t, client)
-}
-
-func TestClientMetadata(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
- leader := NewMockBroker(t, 5)
-
- replicas := []int32{3, 1, 5}
- isr := []int32{5, 1}
-
- metadataResponse := new(MetadataResponse)
- metadataResponse.AddBroker(leader.Addr(), leader.BrokerID())
- metadataResponse.AddTopicPartition("my_topic", 0, leader.BrokerID(), replicas, isr, ErrNoError)
- metadataResponse.AddTopicPartition("my_topic", 1, leader.BrokerID(), replicas, isr, ErrLeaderNotAvailable)
- seedBroker.Returns(metadataResponse)
-
- config := NewConfig()
- config.Metadata.Retry.Max = 0
- client, err := NewClient([]string{seedBroker.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
-
- topics, err := client.Topics()
- if err != nil {
- t.Error(err)
- } else if len(topics) != 1 || topics[0] != "my_topic" {
- t.Error("Client returned incorrect topics:", topics)
- }
-
- parts, err := client.Partitions("my_topic")
- if err != nil {
- t.Error(err)
- } else if len(parts) != 2 || parts[0] != 0 || parts[1] != 1 {
- t.Error("Client returned incorrect partitions for my_topic:", parts)
- }
-
- parts, err = client.WritablePartitions("my_topic")
- if err != nil {
- t.Error(err)
- } else if len(parts) != 1 || parts[0] != 0 {
- t.Error("Client returned incorrect writable partitions for my_topic:", parts)
- }
-
- tst, err := client.Leader("my_topic", 0)
- if err != nil {
- t.Error(err)
- } else if tst.ID() != 5 {
- t.Error("Leader for my_topic had incorrect ID.")
- }
-
- replicas, err = client.Replicas("my_topic", 0)
- if err != nil {
- t.Error(err)
- } else if replicas[0] != 3 {
- t.Error("Incorrect (or sorted) replica")
- } else if replicas[1] != 1 {
- t.Error("Incorrect (or sorted) replica")
- } else if replicas[2] != 5 {
- t.Error("Incorrect (or sorted) replica")
- }
-
- isr, err = client.InSyncReplicas("my_topic", 0)
- if err != nil {
- t.Error(err)
- } else if len(isr) != 2 {
- t.Error("Client returned incorrect ISRs for partition:", isr)
- } else if isr[0] != 5 {
- t.Error("Incorrect (or sorted) ISR:", isr)
- } else if isr[1] != 1 {
- t.Error("Incorrect (or sorted) ISR:", isr)
- }
-
- leader.Close()
- seedBroker.Close()
- safeClose(t, client)
-}
-
-func TestClientGetOffset(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
- leader := NewMockBroker(t, 2)
- leaderAddr := leader.Addr()
-
- metadata := new(MetadataResponse)
- metadata.AddTopicPartition("foo", 0, leader.BrokerID(), nil, nil, ErrNoError)
- metadata.AddBroker(leaderAddr, leader.BrokerID())
- seedBroker.Returns(metadata)
-
- client, err := NewClient([]string{seedBroker.Addr()}, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- offsetResponse := new(OffsetResponse)
- offsetResponse.AddTopicPartition("foo", 0, 123)
- leader.Returns(offsetResponse)
-
- offset, err := client.GetOffset("foo", 0, OffsetNewest)
- if err != nil {
- t.Error(err)
- }
- if offset != 123 {
- t.Error("Unexpected offset, got ", offset)
- }
-
- leader.Close()
- seedBroker.Returns(metadata)
-
- leader = NewMockBrokerAddr(t, 2, leaderAddr)
- offsetResponse = new(OffsetResponse)
- offsetResponse.AddTopicPartition("foo", 0, 456)
- leader.Returns(offsetResponse)
-
- offset, err = client.GetOffset("foo", 0, OffsetNewest)
- if err != nil {
- t.Error(err)
- }
- if offset != 456 {
- t.Error("Unexpected offset, got ", offset)
- }
-
- seedBroker.Close()
- leader.Close()
- safeClose(t, client)
-}
-
-func TestClientReceivingUnknownTopic(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
-
- metadataResponse1 := new(MetadataResponse)
- seedBroker.Returns(metadataResponse1)
-
- config := NewConfig()
- config.Metadata.Retry.Max = 1
- config.Metadata.Retry.Backoff = 0
- client, err := NewClient([]string{seedBroker.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
-
- metadataUnknownTopic := new(MetadataResponse)
- metadataUnknownTopic.AddTopic("new_topic", ErrUnknownTopicOrPartition)
- seedBroker.Returns(metadataUnknownTopic)
- seedBroker.Returns(metadataUnknownTopic)
-
- if err := client.RefreshMetadata("new_topic"); err != ErrUnknownTopicOrPartition {
- t.Error("ErrUnknownTopicOrPartition expected, got", err)
- }
-
- // If we are asking for the leader of a partition of the non-existing topic.
- // we will request metadata again.
- seedBroker.Returns(metadataUnknownTopic)
- seedBroker.Returns(metadataUnknownTopic)
-
- if _, err = client.Leader("new_topic", 1); err != ErrUnknownTopicOrPartition {
- t.Error("Expected ErrUnknownTopicOrPartition, got", err)
- }
-
- safeClose(t, client)
- seedBroker.Close()
-}
-
-func TestClientReceivingPartialMetadata(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
- leader := NewMockBroker(t, 5)
-
- metadataResponse1 := new(MetadataResponse)
- metadataResponse1.AddBroker(leader.Addr(), leader.BrokerID())
- seedBroker.Returns(metadataResponse1)
-
- config := NewConfig()
- config.Metadata.Retry.Max = 0
- client, err := NewClient([]string{seedBroker.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
-
- replicas := []int32{leader.BrokerID(), seedBroker.BrokerID()}
-
- metadataPartial := new(MetadataResponse)
- metadataPartial.AddTopic("new_topic", ErrLeaderNotAvailable)
- metadataPartial.AddTopicPartition("new_topic", 0, leader.BrokerID(), replicas, replicas, ErrNoError)
- metadataPartial.AddTopicPartition("new_topic", 1, -1, replicas, []int32{}, ErrLeaderNotAvailable)
- seedBroker.Returns(metadataPartial)
-
- if err := client.RefreshMetadata("new_topic"); err != nil {
- t.Error("ErrLeaderNotAvailable should not make RefreshMetadata respond with an error")
- }
-
- // Even though the metadata was incomplete, we should be able to get the leader of a partition
- // for which we did get a useful response, without doing additional requests.
-
- partition0Leader, err := client.Leader("new_topic", 0)
- if err != nil {
- t.Error(err)
- } else if partition0Leader.Addr() != leader.Addr() {
- t.Error("Unexpected leader returned", partition0Leader.Addr())
- }
-
- // If we are asking for the leader of a partition that didn't have a leader before,
- // we will do another metadata request.
-
- seedBroker.Returns(metadataPartial)
-
- // Still no leader for the partition, so asking for it should return an error.
- _, err = client.Leader("new_topic", 1)
- if err != ErrLeaderNotAvailable {
- t.Error("Expected ErrLeaderNotAvailable, got", err)
- }
-
- safeClose(t, client)
- seedBroker.Close()
- leader.Close()
-}
-
-func TestClientRefreshBehaviour(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
- leader := NewMockBroker(t, 5)
-
- metadataResponse1 := new(MetadataResponse)
- metadataResponse1.AddBroker(leader.Addr(), leader.BrokerID())
- seedBroker.Returns(metadataResponse1)
-
- metadataResponse2 := new(MetadataResponse)
- metadataResponse2.AddTopicPartition("my_topic", 0xb, leader.BrokerID(), nil, nil, ErrNoError)
- seedBroker.Returns(metadataResponse2)
-
- client, err := NewClient([]string{seedBroker.Addr()}, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- parts, err := client.Partitions("my_topic")
- if err != nil {
- t.Error(err)
- } else if len(parts) != 1 || parts[0] != 0xb {
- t.Error("Client returned incorrect partitions for my_topic:", parts)
- }
-
- tst, err := client.Leader("my_topic", 0xb)
- if err != nil {
- t.Error(err)
- } else if tst.ID() != 5 {
- t.Error("Leader for my_topic had incorrect ID.")
- }
-
- leader.Close()
- seedBroker.Close()
- safeClose(t, client)
-}
-
-func TestClientResurrectDeadSeeds(t *testing.T) {
- initialSeed := NewMockBroker(t, 0)
- emptyMetadata := new(MetadataResponse)
- initialSeed.Returns(emptyMetadata)
-
- conf := NewConfig()
- conf.Metadata.Retry.Backoff = 0
- conf.Metadata.RefreshFrequency = 0
- c, err := NewClient([]string{initialSeed.Addr()}, conf)
- if err != nil {
- t.Fatal(err)
- }
- initialSeed.Close()
-
- client := c.(*client)
-
- seed1 := NewMockBroker(t, 1)
- seed2 := NewMockBroker(t, 2)
- seed3 := NewMockBroker(t, 3)
- addr1 := seed1.Addr()
- addr2 := seed2.Addr()
- addr3 := seed3.Addr()
-
- // Overwrite the seed brokers with a fixed ordering to make this test deterministic.
- safeClose(t, client.seedBrokers[0])
- client.seedBrokers = []*Broker{NewBroker(addr1), NewBroker(addr2), NewBroker(addr3)}
- client.deadSeeds = []*Broker{}
-
- wg := sync.WaitGroup{}
- wg.Add(1)
- go func() {
- if err := client.RefreshMetadata(); err != nil {
- t.Error(err)
- }
- wg.Done()
- }()
- seed1.Close()
- seed2.Close()
-
- seed1 = NewMockBrokerAddr(t, 1, addr1)
- seed2 = NewMockBrokerAddr(t, 2, addr2)
-
- seed3.Close()
-
- seed1.Close()
- seed2.Returns(emptyMetadata)
-
- wg.Wait()
-
- if len(client.seedBrokers) != 2 {
- t.Error("incorrect number of live seeds")
- }
- if len(client.deadSeeds) != 1 {
- t.Error("incorrect number of dead seeds")
- }
-
- safeClose(t, c)
-}
-
-func TestClientController(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
- defer seedBroker.Close()
- controllerBroker := NewMockBroker(t, 2)
- defer controllerBroker.Close()
-
- seedBroker.SetHandlerByMap(map[string]MockResponse{
- "MetadataRequest": NewMockMetadataResponse(t).
- SetController(controllerBroker.BrokerID()).
- SetBroker(seedBroker.Addr(), seedBroker.BrokerID()).
- SetBroker(controllerBroker.Addr(), controllerBroker.BrokerID()),
- })
-
- cfg := NewConfig()
-
- // test kafka version greater than 0.10.0.0
- cfg.Version = V0_10_0_0
- client1, err := NewClient([]string{seedBroker.Addr()}, cfg)
- if err != nil {
- t.Fatal(err)
- }
- defer safeClose(t, client1)
- broker, err := client1.Controller()
- if err != nil {
- t.Fatal(err)
- }
- if broker.Addr() != controllerBroker.Addr() {
- t.Errorf("Expected controller to have address %s, found %s", controllerBroker.Addr(), broker.Addr())
- }
-
- // test kafka version earlier than 0.10.0.0
- cfg.Version = V0_9_0_1
- client2, err := NewClient([]string{seedBroker.Addr()}, cfg)
- if err != nil {
- t.Fatal(err)
- }
- defer safeClose(t, client2)
- if _, err = client2.Controller(); err != ErrControllerNotAvailable {
- t.Errorf("Expected Contoller() to return %s, found %s", ErrControllerNotAvailable, err)
- }
-}
-func TestClientCoordinatorWithConsumerOffsetsTopic(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
- staleCoordinator := NewMockBroker(t, 2)
- freshCoordinator := NewMockBroker(t, 3)
-
- replicas := []int32{staleCoordinator.BrokerID(), freshCoordinator.BrokerID()}
- metadataResponse1 := new(MetadataResponse)
- metadataResponse1.AddBroker(staleCoordinator.Addr(), staleCoordinator.BrokerID())
- metadataResponse1.AddBroker(freshCoordinator.Addr(), freshCoordinator.BrokerID())
- metadataResponse1.AddTopicPartition("__consumer_offsets", 0, replicas[0], replicas, replicas, ErrNoError)
- seedBroker.Returns(metadataResponse1)
-
- client, err := NewClient([]string{seedBroker.Addr()}, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- coordinatorResponse1 := new(ConsumerMetadataResponse)
- coordinatorResponse1.Err = ErrConsumerCoordinatorNotAvailable
- seedBroker.Returns(coordinatorResponse1)
-
- coordinatorResponse2 := new(ConsumerMetadataResponse)
- coordinatorResponse2.CoordinatorID = staleCoordinator.BrokerID()
- coordinatorResponse2.CoordinatorHost = "127.0.0.1"
- coordinatorResponse2.CoordinatorPort = staleCoordinator.Port()
-
- seedBroker.Returns(coordinatorResponse2)
-
- broker, err := client.Coordinator("my_group")
- if err != nil {
- t.Error(err)
- }
-
- if staleCoordinator.Addr() != broker.Addr() {
- t.Errorf("Expected coordinator to have address %s, found %s", staleCoordinator.Addr(), broker.Addr())
- }
-
- if staleCoordinator.BrokerID() != broker.ID() {
- t.Errorf("Expected coordinator to have ID %d, found %d", staleCoordinator.BrokerID(), broker.ID())
- }
-
- // Grab the cached value
- broker2, err := client.Coordinator("my_group")
- if err != nil {
- t.Error(err)
- }
-
- if broker2.Addr() != broker.Addr() {
- t.Errorf("Expected the coordinator to be the same, but found %s vs. %s", broker2.Addr(), broker.Addr())
- }
-
- coordinatorResponse3 := new(ConsumerMetadataResponse)
- coordinatorResponse3.CoordinatorID = freshCoordinator.BrokerID()
- coordinatorResponse3.CoordinatorHost = "127.0.0.1"
- coordinatorResponse3.CoordinatorPort = freshCoordinator.Port()
-
- seedBroker.Returns(coordinatorResponse3)
-
- // Refresh the locally cahced value because it's stale
- if err := client.RefreshCoordinator("my_group"); err != nil {
- t.Error(err)
- }
-
- // Grab the fresh value
- broker3, err := client.Coordinator("my_group")
- if err != nil {
- t.Error(err)
- }
-
- if broker3.Addr() != freshCoordinator.Addr() {
- t.Errorf("Expected the freshCoordinator to be returned, but found %s.", broker3.Addr())
- }
-
- freshCoordinator.Close()
- staleCoordinator.Close()
- seedBroker.Close()
- safeClose(t, client)
-}
-
-func TestClientCoordinatorWithoutConsumerOffsetsTopic(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
- coordinator := NewMockBroker(t, 2)
-
- metadataResponse1 := new(MetadataResponse)
- seedBroker.Returns(metadataResponse1)
-
- config := NewConfig()
- config.Metadata.Retry.Max = 1
- config.Metadata.Retry.Backoff = 0
- client, err := NewClient([]string{seedBroker.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
-
- coordinatorResponse1 := new(ConsumerMetadataResponse)
- coordinatorResponse1.Err = ErrConsumerCoordinatorNotAvailable
- seedBroker.Returns(coordinatorResponse1)
-
- metadataResponse2 := new(MetadataResponse)
- metadataResponse2.AddTopic("__consumer_offsets", ErrUnknownTopicOrPartition)
- seedBroker.Returns(metadataResponse2)
-
- replicas := []int32{coordinator.BrokerID()}
- metadataResponse3 := new(MetadataResponse)
- metadataResponse3.AddTopicPartition("__consumer_offsets", 0, replicas[0], replicas, replicas, ErrNoError)
- seedBroker.Returns(metadataResponse3)
-
- coordinatorResponse2 := new(ConsumerMetadataResponse)
- coordinatorResponse2.CoordinatorID = coordinator.BrokerID()
- coordinatorResponse2.CoordinatorHost = "127.0.0.1"
- coordinatorResponse2.CoordinatorPort = coordinator.Port()
-
- seedBroker.Returns(coordinatorResponse2)
-
- broker, err := client.Coordinator("my_group")
- if err != nil {
- t.Error(err)
- }
-
- if coordinator.Addr() != broker.Addr() {
- t.Errorf("Expected coordinator to have address %s, found %s", coordinator.Addr(), broker.Addr())
- }
-
- if coordinator.BrokerID() != broker.ID() {
- t.Errorf("Expected coordinator to have ID %d, found %d", coordinator.BrokerID(), broker.ID())
- }
-
- coordinator.Close()
- seedBroker.Close()
- safeClose(t, client)
-}
-
-func TestClientAutorefreshShutdownRace(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
-
- metadataResponse := new(MetadataResponse)
- seedBroker.Returns(metadataResponse)
-
- conf := NewConfig()
- conf.Metadata.RefreshFrequency = 100 * time.Millisecond
- client, err := NewClient([]string{seedBroker.Addr()}, conf)
- if err != nil {
- t.Fatal(err)
- }
-
- // Wait for the background refresh to kick in
- time.Sleep(110 * time.Millisecond)
-
- done := make(chan none)
- go func() {
- // Close the client
- if err := client.Close(); err != nil {
- t.Fatal(err)
- }
- close(done)
- }()
-
- // Wait for the Close to kick in
- time.Sleep(10 * time.Millisecond)
-
- // Then return some metadata to the still-running background thread
- leader := NewMockBroker(t, 2)
- metadataResponse.AddBroker(leader.Addr(), leader.BrokerID())
- metadataResponse.AddTopicPartition("foo", 0, leader.BrokerID(), []int32{2}, []int32{2}, ErrNoError)
- seedBroker.Returns(metadataResponse)
-
- <-done
-
- seedBroker.Close()
-
- // give the update time to happen so we get a panic if it's still running (which it shouldn't)
- time.Sleep(10 * time.Millisecond)
-}
diff --git a/vendor/github.com/Shopify/sarama/client_tls_test.go b/vendor/github.com/Shopify/sarama/client_tls_test.go
deleted file mode 100644
index eef5f6e9c..000000000
--- a/vendor/github.com/Shopify/sarama/client_tls_test.go
+++ /dev/null
@@ -1,206 +0,0 @@
-package sarama
-
-import (
- "math/big"
- "net"
- "testing"
- "time"
-
- "crypto/rand"
- "crypto/rsa"
- "crypto/tls"
- "crypto/x509"
- "crypto/x509/pkix"
-)
-
-func TestTLS(t *testing.T) {
- cakey, err := rsa.GenerateKey(rand.Reader, 2048)
- if err != nil {
- t.Fatal(err)
- }
-
- clientkey, err := rsa.GenerateKey(rand.Reader, 2048)
- if err != nil {
- t.Fatal(err)
- }
-
- hostkey, err := rsa.GenerateKey(rand.Reader, 2048)
- if err != nil {
- t.Fatal(err)
- }
-
- nvb := time.Now().Add(-1 * time.Hour)
- nva := time.Now().Add(1 * time.Hour)
-
- caTemplate := &x509.Certificate{
- Subject: pkix.Name{CommonName: "ca"},
- Issuer: pkix.Name{CommonName: "ca"},
- SerialNumber: big.NewInt(0),
- NotAfter: nva,
- NotBefore: nvb,
- IsCA: true,
- BasicConstraintsValid: true,
- KeyUsage: x509.KeyUsageCertSign,
- }
- caDer, err := x509.CreateCertificate(rand.Reader, caTemplate, caTemplate, &cakey.PublicKey, cakey)
- if err != nil {
- t.Fatal(err)
- }
- caFinalCert, err := x509.ParseCertificate(caDer)
- if err != nil {
- t.Fatal(err)
- }
-
- hostDer, err := x509.CreateCertificate(rand.Reader, &x509.Certificate{
- Subject: pkix.Name{CommonName: "host"},
- Issuer: pkix.Name{CommonName: "ca"},
- IPAddresses: []net.IP{net.IPv4(127, 0, 0, 1)},
- SerialNumber: big.NewInt(0),
- NotAfter: nva,
- NotBefore: nvb,
- ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},
- }, caFinalCert, &hostkey.PublicKey, cakey)
- if err != nil {
- t.Fatal(err)
- }
-
- clientDer, err := x509.CreateCertificate(rand.Reader, &x509.Certificate{
- Subject: pkix.Name{CommonName: "client"},
- Issuer: pkix.Name{CommonName: "ca"},
- SerialNumber: big.NewInt(0),
- NotAfter: nva,
- NotBefore: nvb,
- ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth},
- }, caFinalCert, &clientkey.PublicKey, cakey)
- if err != nil {
- t.Fatal(err)
- }
-
- pool := x509.NewCertPool()
- pool.AddCert(caFinalCert)
-
- systemCerts, err := x509.SystemCertPool()
- if err != nil {
- t.Fatal(err)
- }
-
- // Keep server the same - it's the client that we're testing
- serverTLSConfig := &tls.Config{
- Certificates: []tls.Certificate{tls.Certificate{
- Certificate: [][]byte{hostDer},
- PrivateKey: hostkey,
- }},
- ClientAuth: tls.RequireAndVerifyClientCert,
- ClientCAs: pool,
- }
-
- for _, tc := range []struct {
- Succeed bool
- Server, Client *tls.Config
- }{
- { // Verify client fails if wrong CA cert pool is specified
- Succeed: false,
- Server: serverTLSConfig,
- Client: &tls.Config{
- RootCAs: systemCerts,
- Certificates: []tls.Certificate{tls.Certificate{
- Certificate: [][]byte{clientDer},
- PrivateKey: clientkey,
- }},
- },
- },
- { // Verify client fails if wrong key is specified
- Succeed: false,
- Server: serverTLSConfig,
- Client: &tls.Config{
- RootCAs: pool,
- Certificates: []tls.Certificate{tls.Certificate{
- Certificate: [][]byte{clientDer},
- PrivateKey: hostkey,
- }},
- },
- },
- { // Verify client fails if wrong cert is specified
- Succeed: false,
- Server: serverTLSConfig,
- Client: &tls.Config{
- RootCAs: pool,
- Certificates: []tls.Certificate{tls.Certificate{
- Certificate: [][]byte{hostDer},
- PrivateKey: clientkey,
- }},
- },
- },
- { // Verify client fails if no CAs are specified
- Succeed: false,
- Server: serverTLSConfig,
- Client: &tls.Config{
- Certificates: []tls.Certificate{tls.Certificate{
- Certificate: [][]byte{clientDer},
- PrivateKey: clientkey,
- }},
- },
- },
- { // Verify client fails if no keys are specified
- Succeed: false,
- Server: serverTLSConfig,
- Client: &tls.Config{
- RootCAs: pool,
- },
- },
- { // Finally, verify it all works happily with client and server cert in place
- Succeed: true,
- Server: serverTLSConfig,
- Client: &tls.Config{
- RootCAs: pool,
- Certificates: []tls.Certificate{tls.Certificate{
- Certificate: [][]byte{clientDer},
- PrivateKey: clientkey,
- }},
- },
- },
- } {
- doListenerTLSTest(t, tc.Succeed, tc.Server, tc.Client)
- }
-}
-
-func doListenerTLSTest(t *testing.T, expectSuccess bool, serverConfig, clientConfig *tls.Config) {
- serverConfig.BuildNameToCertificate()
- clientConfig.BuildNameToCertificate()
-
- seedListener, err := tls.Listen("tcp", "127.0.0.1:0", serverConfig)
- if err != nil {
- t.Fatal("cannot open listener", err)
- }
-
- var childT *testing.T
- if expectSuccess {
- childT = t
- } else {
- childT = &testing.T{} // we want to swallow errors
- }
-
- seedBroker := NewMockBrokerListener(childT, 1, seedListener)
- defer seedBroker.Close()
-
- seedBroker.Returns(new(MetadataResponse))
-
- config := NewConfig()
- config.Net.TLS.Enable = true
- config.Net.TLS.Config = clientConfig
-
- client, err := NewClient([]string{seedBroker.Addr()}, config)
- if err == nil {
- safeClose(t, client)
- }
-
- if expectSuccess {
- if err != nil {
- t.Fatal(err)
- }
- } else {
- if err == nil {
- t.Fatal("expected failure")
- }
- }
-}
diff --git a/vendor/github.com/Shopify/sarama/config_test.go b/vendor/github.com/Shopify/sarama/config_test.go
deleted file mode 100644
index 40aa453a9..000000000
--- a/vendor/github.com/Shopify/sarama/config_test.go
+++ /dev/null
@@ -1,233 +0,0 @@
-package sarama
-
-import (
- "os"
- "testing"
-
- "github.com/rcrowley/go-metrics"
-)
-
-func TestDefaultConfigValidates(t *testing.T) {
- config := NewConfig()
- if err := config.Validate(); err != nil {
- t.Error(err)
- }
- if config.MetricRegistry == nil {
- t.Error("Expected non nil metrics.MetricRegistry, got nil")
- }
-}
-
-func TestInvalidClientIDConfigValidates(t *testing.T) {
- config := NewConfig()
- config.ClientID = "foo:bar"
- if err := config.Validate(); string(err.(ConfigurationError)) != "ClientID is invalid" {
- t.Error("Expected invalid ClientID, got ", err)
- }
-}
-
-func TestEmptyClientIDConfigValidates(t *testing.T) {
- config := NewConfig()
- config.ClientID = ""
- if err := config.Validate(); string(err.(ConfigurationError)) != "ClientID is invalid" {
- t.Error("Expected invalid ClientID, got ", err)
- }
-}
-
-func TestNetConfigValidates(t *testing.T) {
- tests := []struct {
- name string
- cfg func(*Config) // resorting to using a function as a param because of internal composite structs
- err string
- }{
- {
- "OpenRequests",
- func(cfg *Config) {
- cfg.Net.MaxOpenRequests = 0
- },
- "Net.MaxOpenRequests must be > 0"},
- {"DialTimeout",
- func(cfg *Config) {
- cfg.Net.DialTimeout = 0
- },
- "Net.DialTimeout must be > 0"},
- {"ReadTimeout",
- func(cfg *Config) {
- cfg.Net.ReadTimeout = 0
- },
- "Net.ReadTimeout must be > 0"},
- {"WriteTimeout",
- func(cfg *Config) {
- cfg.Net.WriteTimeout = 0
- },
- "Net.WriteTimeout must be > 0"},
- {"KeepAlive",
- func(cfg *Config) {
- cfg.Net.KeepAlive = -1
- },
- "Net.KeepAlive must be >= 0"},
- {"SASL.User",
- func(cfg *Config) {
- cfg.Net.SASL.Enable = true
- cfg.Net.SASL.User = ""
- },
- "Net.SASL.User must not be empty when SASL is enabled"},
- {"SASL.Password",
- func(cfg *Config) {
- cfg.Net.SASL.Enable = true
- cfg.Net.SASL.User = "user"
- cfg.Net.SASL.Password = ""
- },
- "Net.SASL.Password must not be empty when SASL is enabled"},
- }
-
- for i, test := range tests {
- c := NewConfig()
- test.cfg(c)
- if err := c.Validate(); string(err.(ConfigurationError)) != test.err {
- t.Errorf("[%d]:[%s] Expected %s, Got %s\n", i, test.name, test.err, err)
- }
- }
-}
-
-func TestMetadataConfigValidates(t *testing.T) {
- tests := []struct {
- name string
- cfg func(*Config) // resorting to using a function as a param because of internal composite structs
- err string
- }{
- {
- "Retry.Max",
- func(cfg *Config) {
- cfg.Metadata.Retry.Max = -1
- },
- "Metadata.Retry.Max must be >= 0"},
- {"Retry.Backoff",
- func(cfg *Config) {
- cfg.Metadata.Retry.Backoff = -1
- },
- "Metadata.Retry.Backoff must be >= 0"},
- {"RefreshFrequency",
- func(cfg *Config) {
- cfg.Metadata.RefreshFrequency = -1
- },
- "Metadata.RefreshFrequency must be >= 0"},
- }
-
- for i, test := range tests {
- c := NewConfig()
- test.cfg(c)
- if err := c.Validate(); string(err.(ConfigurationError)) != test.err {
- t.Errorf("[%d]:[%s] Expected %s, Got %s\n", i, test.name, test.err, err)
- }
- }
-}
-
-func TestProducerConfigValidates(t *testing.T) {
- tests := []struct {
- name string
- cfg func(*Config) // resorting to using a function as a param because of internal composite structs
- err string
- }{
- {
- "MaxMessageBytes",
- func(cfg *Config) {
- cfg.Producer.MaxMessageBytes = 0
- },
- "Producer.MaxMessageBytes must be > 0"},
- {"RequiredAcks",
- func(cfg *Config) {
- cfg.Producer.RequiredAcks = -2
- },
- "Producer.RequiredAcks must be >= -1"},
- {"Timeout",
- func(cfg *Config) {
- cfg.Producer.Timeout = 0
- },
- "Producer.Timeout must be > 0"},
- {"Partitioner",
- func(cfg *Config) {
- cfg.Producer.Partitioner = nil
- },
- "Producer.Partitioner must not be nil"},
- {"Flush.Bytes",
- func(cfg *Config) {
- cfg.Producer.Flush.Bytes = -1
- },
- "Producer.Flush.Bytes must be >= 0"},
- {"Flush.Messages",
- func(cfg *Config) {
- cfg.Producer.Flush.Messages = -1
- },
- "Producer.Flush.Messages must be >= 0"},
- {"Flush.Frequency",
- func(cfg *Config) {
- cfg.Producer.Flush.Frequency = -1
- },
- "Producer.Flush.Frequency must be >= 0"},
- {"Flush.MaxMessages",
- func(cfg *Config) {
- cfg.Producer.Flush.MaxMessages = -1
- },
- "Producer.Flush.MaxMessages must be >= 0"},
- {"Flush.MaxMessages with Producer.Flush.Messages",
- func(cfg *Config) {
- cfg.Producer.Flush.MaxMessages = 1
- cfg.Producer.Flush.Messages = 2
- },
- "Producer.Flush.MaxMessages must be >= Producer.Flush.Messages when set"},
- {"Flush.Retry.Max",
- func(cfg *Config) {
- cfg.Producer.Retry.Max = -1
- },
- "Producer.Retry.Max must be >= 0"},
- {"Flush.Retry.Backoff",
- func(cfg *Config) {
- cfg.Producer.Retry.Backoff = -1
- },
- "Producer.Retry.Backoff must be >= 0"},
- }
-
- for i, test := range tests {
- c := NewConfig()
- test.cfg(c)
- if err := c.Validate(); string(err.(ConfigurationError)) != test.err {
- t.Errorf("[%d]:[%s] Expected %s, Got %s\n", i, test.name, test.err, err)
- }
- }
-}
-
-func TestLZ4ConfigValidation(t *testing.T) {
- config := NewConfig()
- config.Producer.Compression = CompressionLZ4
- if err := config.Validate(); string(err.(ConfigurationError)) != "lz4 compression requires Version >= V0_10_0_0" {
- t.Error("Expected invalid lz4/kakfa version error, got ", err)
- }
- config.Version = V0_10_0_0
- if err := config.Validate(); err != nil {
- t.Error("Expected lz4 to work, got ", err)
- }
-}
-
-// This example shows how to integrate with an existing registry as well as publishing metrics
-// on the standard output
-func ExampleConfig_metrics() {
- // Our application registry
- appMetricRegistry := metrics.NewRegistry()
- appGauge := metrics.GetOrRegisterGauge("m1", appMetricRegistry)
- appGauge.Update(1)
-
- config := NewConfig()
- // Use a prefix registry instead of the default local one
- config.MetricRegistry = metrics.NewPrefixedChildRegistry(appMetricRegistry, "sarama.")
-
- // Simulate a metric created by sarama without starting a broker
- saramaGauge := metrics.GetOrRegisterGauge("m2", config.MetricRegistry)
- saramaGauge.Update(2)
-
- metrics.WriteOnce(appMetricRegistry, os.Stdout)
- // Output:
- // gauge m1
- // value: 1
- // gauge sarama.m2
- // value: 2
-}
diff --git a/vendor/github.com/Shopify/sarama/consumer_group_members_test.go b/vendor/github.com/Shopify/sarama/consumer_group_members_test.go
deleted file mode 100644
index d65e8adc4..000000000
--- a/vendor/github.com/Shopify/sarama/consumer_group_members_test.go
+++ /dev/null
@@ -1,73 +0,0 @@
-package sarama
-
-import (
- "bytes"
- "reflect"
- "testing"
-)
-
-var (
- groupMemberMetadata = []byte{
- 0, 1, // Version
- 0, 0, 0, 2, // Topic array length
- 0, 3, 'o', 'n', 'e', // Topic one
- 0, 3, 't', 'w', 'o', // Topic two
- 0, 0, 0, 3, 0x01, 0x02, 0x03, // Userdata
- }
- groupMemberAssignment = []byte{
- 0, 1, // Version
- 0, 0, 0, 1, // Topic array length
- 0, 3, 'o', 'n', 'e', // Topic one
- 0, 0, 0, 3, // Topic one, partition array length
- 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 4, // 0, 2, 4
- 0, 0, 0, 3, 0x01, 0x02, 0x03, // Userdata
- }
-)
-
-func TestConsumerGroupMemberMetadata(t *testing.T) {
- meta := &ConsumerGroupMemberMetadata{
- Version: 1,
- Topics: []string{"one", "two"},
- UserData: []byte{0x01, 0x02, 0x03},
- }
-
- buf, err := encode(meta, nil)
- if err != nil {
- t.Error("Failed to encode data", err)
- } else if !bytes.Equal(groupMemberMetadata, buf) {
- t.Errorf("Encoded data does not match expectation\nexpected: %v\nactual: %v", groupMemberMetadata, buf)
- }
-
- meta2 := new(ConsumerGroupMemberMetadata)
- err = decode(buf, meta2)
- if err != nil {
- t.Error("Failed to decode data", err)
- } else if !reflect.DeepEqual(meta, meta2) {
- t.Errorf("Encoded data does not match expectation\nexpected: %v\nactual: %v", meta, meta2)
- }
-}
-
-func TestConsumerGroupMemberAssignment(t *testing.T) {
- amt := &ConsumerGroupMemberAssignment{
- Version: 1,
- Topics: map[string][]int32{
- "one": {0, 2, 4},
- },
- UserData: []byte{0x01, 0x02, 0x03},
- }
-
- buf, err := encode(amt, nil)
- if err != nil {
- t.Error("Failed to encode data", err)
- } else if !bytes.Equal(groupMemberAssignment, buf) {
- t.Errorf("Encoded data does not match expectation\nexpected: %v\nactual: %v", groupMemberAssignment, buf)
- }
-
- amt2 := new(ConsumerGroupMemberAssignment)
- err = decode(buf, amt2)
- if err != nil {
- t.Error("Failed to decode data", err)
- } else if !reflect.DeepEqual(amt, amt2) {
- t.Errorf("Encoded data does not match expectation\nexpected: %v\nactual: %v", amt, amt2)
- }
-}
diff --git a/vendor/github.com/Shopify/sarama/consumer_metadata_request_test.go b/vendor/github.com/Shopify/sarama/consumer_metadata_request_test.go
deleted file mode 100644
index 24e5f0a43..000000000
--- a/vendor/github.com/Shopify/sarama/consumer_metadata_request_test.go
+++ /dev/null
@@ -1,23 +0,0 @@
-package sarama
-
-import (
- "testing"
-)
-
-var (
- consumerMetadataRequestEmpty = []byte{
- 0x00, 0x00}
-
- consumerMetadataRequestString = []byte{
- 0x00, 0x06, 'f', 'o', 'o', 'b', 'a', 'r'}
-)
-
-func TestConsumerMetadataRequest(t *testing.T) {
- request := new(ConsumerMetadataRequest)
- testEncodable(t, "empty string", request, consumerMetadataRequestEmpty)
- testVersionDecodable(t, "empty string", request, consumerMetadataRequestEmpty, 0)
-
- request.ConsumerGroup = "foobar"
- testEncodable(t, "with string", request, consumerMetadataRequestString)
- testVersionDecodable(t, "with string", request, consumerMetadataRequestString, 0)
-}
diff --git a/vendor/github.com/Shopify/sarama/consumer_metadata_response_test.go b/vendor/github.com/Shopify/sarama/consumer_metadata_response_test.go
deleted file mode 100644
index 8482f6ff1..000000000
--- a/vendor/github.com/Shopify/sarama/consumer_metadata_response_test.go
+++ /dev/null
@@ -1,44 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- consumerMetadataResponseError = []byte{
- 0x00, 0x0E,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00}
-
- consumerMetadataResponseSuccess = []byte{
- 0x00, 0x00,
- 0x00, 0x00, 0x00, 0xAB,
- 0x00, 0x03, 'f', 'o', 'o',
- 0x00, 0x00, 0xCC, 0xDD}
-)
-
-func TestConsumerMetadataResponseError(t *testing.T) {
- response := &ConsumerMetadataResponse{Err: ErrOffsetsLoadInProgress}
- testEncodable(t, "", response, consumerMetadataResponseError)
-
- decodedResp := &ConsumerMetadataResponse{}
- if err := versionedDecode(consumerMetadataResponseError, decodedResp, 0); err != nil {
- t.Error("could not decode: ", err)
- }
-
- if decodedResp.Err != ErrOffsetsLoadInProgress {
- t.Errorf("got %s, want %s", decodedResp.Err, ErrOffsetsLoadInProgress)
- }
-}
-
-func TestConsumerMetadataResponseSuccess(t *testing.T) {
- broker := NewBroker("foo:52445")
- broker.id = 0xAB
- response := ConsumerMetadataResponse{
- Coordinator: broker,
- CoordinatorID: 0xAB,
- CoordinatorHost: "foo",
- CoordinatorPort: 0xCCDD,
- Err: ErrNoError,
- }
- testResponse(t, "success", &response, consumerMetadataResponseSuccess)
-}
diff --git a/vendor/github.com/Shopify/sarama/consumer_test.go b/vendor/github.com/Shopify/sarama/consumer_test.go
deleted file mode 100644
index 881e0fe82..000000000
--- a/vendor/github.com/Shopify/sarama/consumer_test.go
+++ /dev/null
@@ -1,985 +0,0 @@
-package sarama
-
-import (
- "log"
- "os"
- "os/signal"
- "sync"
- "testing"
- "time"
-)
-
-var testMsg = StringEncoder("Foo")
-
-// If a particular offset is provided then messages are consumed starting from
-// that offset.
-func TestConsumerOffsetManual(t *testing.T) {
- // Given
- broker0 := NewMockBroker(t, 0)
-
- mockFetchResponse := NewMockFetchResponse(t, 1)
- for i := 0; i < 10; i++ {
- mockFetchResponse.SetMessage("my_topic", 0, int64(i+1234), testMsg)
- }
-
- broker0.SetHandlerByMap(map[string]MockResponse{
- "MetadataRequest": NewMockMetadataResponse(t).
- SetBroker(broker0.Addr(), broker0.BrokerID()).
- SetLeader("my_topic", 0, broker0.BrokerID()),
- "OffsetRequest": NewMockOffsetResponse(t).
- SetOffset("my_topic", 0, OffsetOldest, 0).
- SetOffset("my_topic", 0, OffsetNewest, 2345),
- "FetchRequest": mockFetchResponse,
- })
-
- // When
- master, err := NewConsumer([]string{broker0.Addr()}, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- consumer, err := master.ConsumePartition("my_topic", 0, 1234)
- if err != nil {
- t.Fatal(err)
- }
-
- // Then: messages starting from offset 1234 are consumed.
- for i := 0; i < 10; i++ {
- select {
- case message := <-consumer.Messages():
- assertMessageOffset(t, message, int64(i+1234))
- case err := <-consumer.Errors():
- t.Error(err)
- }
- }
-
- safeClose(t, consumer)
- safeClose(t, master)
- broker0.Close()
-}
-
-// If `OffsetNewest` is passed as the initial offset then the first consumed
-// message is indeed corresponds to the offset that broker claims to be the
-// newest in its metadata response.
-func TestConsumerOffsetNewest(t *testing.T) {
- // Given
- broker0 := NewMockBroker(t, 0)
- broker0.SetHandlerByMap(map[string]MockResponse{
- "MetadataRequest": NewMockMetadataResponse(t).
- SetBroker(broker0.Addr(), broker0.BrokerID()).
- SetLeader("my_topic", 0, broker0.BrokerID()),
- "OffsetRequest": NewMockOffsetResponse(t).
- SetOffset("my_topic", 0, OffsetNewest, 10).
- SetOffset("my_topic", 0, OffsetOldest, 7),
- "FetchRequest": NewMockFetchResponse(t, 1).
- SetMessage("my_topic", 0, 9, testMsg).
- SetMessage("my_topic", 0, 10, testMsg).
- SetMessage("my_topic", 0, 11, testMsg).
- SetHighWaterMark("my_topic", 0, 14),
- })
-
- master, err := NewConsumer([]string{broker0.Addr()}, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- // When
- consumer, err := master.ConsumePartition("my_topic", 0, OffsetNewest)
- if err != nil {
- t.Fatal(err)
- }
-
- // Then
- assertMessageOffset(t, <-consumer.Messages(), 10)
- if hwmo := consumer.HighWaterMarkOffset(); hwmo != 14 {
- t.Errorf("Expected high water mark offset 14, found %d", hwmo)
- }
-
- safeClose(t, consumer)
- safeClose(t, master)
- broker0.Close()
-}
-
-// It is possible to close a partition consumer and create the same anew.
-func TestConsumerRecreate(t *testing.T) {
- // Given
- broker0 := NewMockBroker(t, 0)
- broker0.SetHandlerByMap(map[string]MockResponse{
- "MetadataRequest": NewMockMetadataResponse(t).
- SetBroker(broker0.Addr(), broker0.BrokerID()).
- SetLeader("my_topic", 0, broker0.BrokerID()),
- "OffsetRequest": NewMockOffsetResponse(t).
- SetOffset("my_topic", 0, OffsetOldest, 0).
- SetOffset("my_topic", 0, OffsetNewest, 1000),
- "FetchRequest": NewMockFetchResponse(t, 1).
- SetMessage("my_topic", 0, 10, testMsg),
- })
-
- c, err := NewConsumer([]string{broker0.Addr()}, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- pc, err := c.ConsumePartition("my_topic", 0, 10)
- if err != nil {
- t.Fatal(err)
- }
- assertMessageOffset(t, <-pc.Messages(), 10)
-
- // When
- safeClose(t, pc)
- pc, err = c.ConsumePartition("my_topic", 0, 10)
- if err != nil {
- t.Fatal(err)
- }
-
- // Then
- assertMessageOffset(t, <-pc.Messages(), 10)
-
- safeClose(t, pc)
- safeClose(t, c)
- broker0.Close()
-}
-
-// An attempt to consume the same partition twice should fail.
-func TestConsumerDuplicate(t *testing.T) {
- // Given
- broker0 := NewMockBroker(t, 0)
- broker0.SetHandlerByMap(map[string]MockResponse{
- "MetadataRequest": NewMockMetadataResponse(t).
- SetBroker(broker0.Addr(), broker0.BrokerID()).
- SetLeader("my_topic", 0, broker0.BrokerID()),
- "OffsetRequest": NewMockOffsetResponse(t).
- SetOffset("my_topic", 0, OffsetOldest, 0).
- SetOffset("my_topic", 0, OffsetNewest, 1000),
- "FetchRequest": NewMockFetchResponse(t, 1),
- })
-
- config := NewConfig()
- config.ChannelBufferSize = 0
- c, err := NewConsumer([]string{broker0.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
-
- pc1, err := c.ConsumePartition("my_topic", 0, 0)
- if err != nil {
- t.Fatal(err)
- }
-
- // When
- pc2, err := c.ConsumePartition("my_topic", 0, 0)
-
- // Then
- if pc2 != nil || err != ConfigurationError("That topic/partition is already being consumed") {
- t.Fatal("A partition cannot be consumed twice at the same time")
- }
-
- safeClose(t, pc1)
- safeClose(t, c)
- broker0.Close()
-}
-
-// If consumer fails to refresh metadata it keeps retrying with frequency
-// specified by `Config.Consumer.Retry.Backoff`.
-func TestConsumerLeaderRefreshError(t *testing.T) {
- // Given
- broker0 := NewMockBroker(t, 100)
-
- // Stage 1: my_topic/0 served by broker0
- Logger.Printf(" STAGE 1")
-
- broker0.SetHandlerByMap(map[string]MockResponse{
- "MetadataRequest": NewMockMetadataResponse(t).
- SetBroker(broker0.Addr(), broker0.BrokerID()).
- SetLeader("my_topic", 0, broker0.BrokerID()),
- "OffsetRequest": NewMockOffsetResponse(t).
- SetOffset("my_topic", 0, OffsetOldest, 123).
- SetOffset("my_topic", 0, OffsetNewest, 1000),
- "FetchRequest": NewMockFetchResponse(t, 1).
- SetMessage("my_topic", 0, 123, testMsg),
- })
-
- config := NewConfig()
- config.Net.ReadTimeout = 100 * time.Millisecond
- config.Consumer.Retry.Backoff = 200 * time.Millisecond
- config.Consumer.Return.Errors = true
- config.Metadata.Retry.Max = 0
- c, err := NewConsumer([]string{broker0.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
-
- pc, err := c.ConsumePartition("my_topic", 0, OffsetOldest)
- if err != nil {
- t.Fatal(err)
- }
-
- assertMessageOffset(t, <-pc.Messages(), 123)
-
- // Stage 2: broker0 says that it is no longer the leader for my_topic/0,
- // but the requests to retrieve metadata fail with network timeout.
- Logger.Printf(" STAGE 2")
-
- fetchResponse2 := &FetchResponse{}
- fetchResponse2.AddError("my_topic", 0, ErrNotLeaderForPartition)
-
- broker0.SetHandlerByMap(map[string]MockResponse{
- "FetchRequest": NewMockWrapper(fetchResponse2),
- })
-
- if consErr := <-pc.Errors(); consErr.Err != ErrOutOfBrokers {
- t.Errorf("Unexpected error: %v", consErr.Err)
- }
-
- // Stage 3: finally the metadata returned by broker0 tells that broker1 is
- // a new leader for my_topic/0. Consumption resumes.
-
- Logger.Printf(" STAGE 3")
-
- broker1 := NewMockBroker(t, 101)
-
- broker1.SetHandlerByMap(map[string]MockResponse{
- "FetchRequest": NewMockFetchResponse(t, 1).
- SetMessage("my_topic", 0, 124, testMsg),
- })
- broker0.SetHandlerByMap(map[string]MockResponse{
- "MetadataRequest": NewMockMetadataResponse(t).
- SetBroker(broker0.Addr(), broker0.BrokerID()).
- SetBroker(broker1.Addr(), broker1.BrokerID()).
- SetLeader("my_topic", 0, broker1.BrokerID()),
- })
-
- assertMessageOffset(t, <-pc.Messages(), 124)
-
- safeClose(t, pc)
- safeClose(t, c)
- broker1.Close()
- broker0.Close()
-}
-
-func TestConsumerInvalidTopic(t *testing.T) {
- // Given
- broker0 := NewMockBroker(t, 100)
- broker0.SetHandlerByMap(map[string]MockResponse{
- "MetadataRequest": NewMockMetadataResponse(t).
- SetBroker(broker0.Addr(), broker0.BrokerID()),
- })
-
- c, err := NewConsumer([]string{broker0.Addr()}, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- // When
- pc, err := c.ConsumePartition("my_topic", 0, OffsetOldest)
-
- // Then
- if pc != nil || err != ErrUnknownTopicOrPartition {
- t.Errorf("Should fail with, err=%v", err)
- }
-
- safeClose(t, c)
- broker0.Close()
-}
-
-// Nothing bad happens if a partition consumer that has no leader assigned at
-// the moment is closed.
-func TestConsumerClosePartitionWithoutLeader(t *testing.T) {
- // Given
- broker0 := NewMockBroker(t, 100)
- broker0.SetHandlerByMap(map[string]MockResponse{
- "MetadataRequest": NewMockMetadataResponse(t).
- SetBroker(broker0.Addr(), broker0.BrokerID()).
- SetLeader("my_topic", 0, broker0.BrokerID()),
- "OffsetRequest": NewMockOffsetResponse(t).
- SetOffset("my_topic", 0, OffsetOldest, 123).
- SetOffset("my_topic", 0, OffsetNewest, 1000),
- "FetchRequest": NewMockFetchResponse(t, 1).
- SetMessage("my_topic", 0, 123, testMsg),
- })
-
- config := NewConfig()
- config.Net.ReadTimeout = 100 * time.Millisecond
- config.Consumer.Retry.Backoff = 100 * time.Millisecond
- config.Consumer.Return.Errors = true
- config.Metadata.Retry.Max = 0
- c, err := NewConsumer([]string{broker0.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
-
- pc, err := c.ConsumePartition("my_topic", 0, OffsetOldest)
- if err != nil {
- t.Fatal(err)
- }
-
- assertMessageOffset(t, <-pc.Messages(), 123)
-
- // broker0 says that it is no longer the leader for my_topic/0, but the
- // requests to retrieve metadata fail with network timeout.
- fetchResponse2 := &FetchResponse{}
- fetchResponse2.AddError("my_topic", 0, ErrNotLeaderForPartition)
-
- broker0.SetHandlerByMap(map[string]MockResponse{
- "FetchRequest": NewMockWrapper(fetchResponse2),
- })
-
- // When
- if consErr := <-pc.Errors(); consErr.Err != ErrOutOfBrokers {
- t.Errorf("Unexpected error: %v", consErr.Err)
- }
-
- // Then: the partition consumer can be closed without any problem.
- safeClose(t, pc)
- safeClose(t, c)
- broker0.Close()
-}
-
-// If the initial offset passed on partition consumer creation is out of the
-// actual offset range for the partition, then the partition consumer stops
-// immediately closing its output channels.
-func TestConsumerShutsDownOutOfRange(t *testing.T) {
- // Given
- broker0 := NewMockBroker(t, 0)
- fetchResponse := new(FetchResponse)
- fetchResponse.AddError("my_topic", 0, ErrOffsetOutOfRange)
- broker0.SetHandlerByMap(map[string]MockResponse{
- "MetadataRequest": NewMockMetadataResponse(t).
- SetBroker(broker0.Addr(), broker0.BrokerID()).
- SetLeader("my_topic", 0, broker0.BrokerID()),
- "OffsetRequest": NewMockOffsetResponse(t).
- SetOffset("my_topic", 0, OffsetNewest, 1234).
- SetOffset("my_topic", 0, OffsetOldest, 7),
- "FetchRequest": NewMockWrapper(fetchResponse),
- })
-
- master, err := NewConsumer([]string{broker0.Addr()}, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- // When
- consumer, err := master.ConsumePartition("my_topic", 0, 101)
- if err != nil {
- t.Fatal(err)
- }
-
- // Then: consumer should shut down closing its messages and errors channels.
- if _, ok := <-consumer.Messages(); ok {
- t.Error("Expected the consumer to shut down")
- }
- safeClose(t, consumer)
-
- safeClose(t, master)
- broker0.Close()
-}
-
-// If a fetch response contains messages with offsets that are smaller then
-// requested, then such messages are ignored.
-func TestConsumerExtraOffsets(t *testing.T) {
- // Given
- legacyFetchResponse := &FetchResponse{}
- legacyFetchResponse.AddMessage("my_topic", 0, nil, testMsg, 1)
- legacyFetchResponse.AddMessage("my_topic", 0, nil, testMsg, 2)
- legacyFetchResponse.AddMessage("my_topic", 0, nil, testMsg, 3)
- legacyFetchResponse.AddMessage("my_topic", 0, nil, testMsg, 4)
- newFetchResponse := &FetchResponse{Version: 4}
- newFetchResponse.AddRecord("my_topic", 0, nil, testMsg, 1)
- newFetchResponse.AddRecord("my_topic", 0, nil, testMsg, 2)
- newFetchResponse.AddRecord("my_topic", 0, nil, testMsg, 3)
- newFetchResponse.AddRecord("my_topic", 0, nil, testMsg, 4)
- newFetchResponse.SetLastOffsetDelta("my_topic", 0, 4)
- newFetchResponse.SetLastStableOffset("my_topic", 0, 4)
- for _, fetchResponse1 := range []*FetchResponse{legacyFetchResponse, newFetchResponse} {
- var offsetResponseVersion int16
- cfg := NewConfig()
- cfg.Consumer.Return.Errors = true
- if fetchResponse1.Version >= 4 {
- cfg.Version = V0_11_0_0
- offsetResponseVersion = 1
- }
-
- broker0 := NewMockBroker(t, 0)
- fetchResponse2 := &FetchResponse{}
- fetchResponse2.Version = fetchResponse1.Version
- fetchResponse2.AddError("my_topic", 0, ErrNoError)
- broker0.SetHandlerByMap(map[string]MockResponse{
- "MetadataRequest": NewMockMetadataResponse(t).
- SetBroker(broker0.Addr(), broker0.BrokerID()).
- SetLeader("my_topic", 0, broker0.BrokerID()),
- "OffsetRequest": NewMockOffsetResponse(t).
- SetVersion(offsetResponseVersion).
- SetOffset("my_topic", 0, OffsetNewest, 1234).
- SetOffset("my_topic", 0, OffsetOldest, 0),
- "FetchRequest": NewMockSequence(fetchResponse1, fetchResponse2),
- })
-
- master, err := NewConsumer([]string{broker0.Addr()}, cfg)
- if err != nil {
- t.Fatal(err)
- }
-
- // When
- consumer, err := master.ConsumePartition("my_topic", 0, 3)
- if err != nil {
- t.Fatal(err)
- }
-
- // Then: messages with offsets 1 and 2 are not returned even though they
- // are present in the response.
- select {
- case msg := <-consumer.Messages():
- assertMessageOffset(t, msg, 3)
- case err := <-consumer.Errors():
- t.Fatal(err)
- }
-
- select {
- case msg := <-consumer.Messages():
- assertMessageOffset(t, msg, 4)
- case err := <-consumer.Errors():
- t.Fatal(err)
- }
-
- safeClose(t, consumer)
- safeClose(t, master)
- broker0.Close()
- }
-}
-
-func TestConsumeMessageWithNewerFetchAPIVersion(t *testing.T) {
- // Given
- fetchResponse1 := &FetchResponse{Version: 4}
- fetchResponse1.AddMessage("my_topic", 0, nil, testMsg, 1)
- fetchResponse1.AddMessage("my_topic", 0, nil, testMsg, 2)
-
- cfg := NewConfig()
- cfg.Version = V0_11_0_0
-
- broker0 := NewMockBroker(t, 0)
- fetchResponse2 := &FetchResponse{}
- fetchResponse2.Version = 4
- fetchResponse2.AddError("my_topic", 0, ErrNoError)
- broker0.SetHandlerByMap(map[string]MockResponse{
- "MetadataRequest": NewMockMetadataResponse(t).
- SetBroker(broker0.Addr(), broker0.BrokerID()).
- SetLeader("my_topic", 0, broker0.BrokerID()),
- "OffsetRequest": NewMockOffsetResponse(t).
- SetVersion(1).
- SetOffset("my_topic", 0, OffsetNewest, 1234).
- SetOffset("my_topic", 0, OffsetOldest, 0),
- "FetchRequest": NewMockSequence(fetchResponse1, fetchResponse2),
- })
-
- master, err := NewConsumer([]string{broker0.Addr()}, cfg)
- if err != nil {
- t.Fatal(err)
- }
-
- // When
- consumer, err := master.ConsumePartition("my_topic", 0, 1)
- if err != nil {
- t.Fatal(err)
- }
-
- assertMessageOffset(t, <-consumer.Messages(), 1)
- assertMessageOffset(t, <-consumer.Messages(), 2)
-
- safeClose(t, consumer)
- safeClose(t, master)
- broker0.Close()
-}
-
-// It is fine if offsets of fetched messages are not sequential (although
-// strictly increasing!).
-func TestConsumerNonSequentialOffsets(t *testing.T) {
- // Given
- legacyFetchResponse := &FetchResponse{}
- legacyFetchResponse.AddMessage("my_topic", 0, nil, testMsg, 5)
- legacyFetchResponse.AddMessage("my_topic", 0, nil, testMsg, 7)
- legacyFetchResponse.AddMessage("my_topic", 0, nil, testMsg, 11)
- newFetchResponse := &FetchResponse{Version: 4}
- newFetchResponse.AddRecord("my_topic", 0, nil, testMsg, 5)
- newFetchResponse.AddRecord("my_topic", 0, nil, testMsg, 7)
- newFetchResponse.AddRecord("my_topic", 0, nil, testMsg, 11)
- newFetchResponse.SetLastOffsetDelta("my_topic", 0, 11)
- newFetchResponse.SetLastStableOffset("my_topic", 0, 11)
- for _, fetchResponse1 := range []*FetchResponse{legacyFetchResponse, newFetchResponse} {
- var offsetResponseVersion int16
- cfg := NewConfig()
- if fetchResponse1.Version >= 4 {
- cfg.Version = V0_11_0_0
- offsetResponseVersion = 1
- }
-
- broker0 := NewMockBroker(t, 0)
- fetchResponse2 := &FetchResponse{Version: fetchResponse1.Version}
- fetchResponse2.AddError("my_topic", 0, ErrNoError)
- broker0.SetHandlerByMap(map[string]MockResponse{
- "MetadataRequest": NewMockMetadataResponse(t).
- SetBroker(broker0.Addr(), broker0.BrokerID()).
- SetLeader("my_topic", 0, broker0.BrokerID()),
- "OffsetRequest": NewMockOffsetResponse(t).
- SetVersion(offsetResponseVersion).
- SetOffset("my_topic", 0, OffsetNewest, 1234).
- SetOffset("my_topic", 0, OffsetOldest, 0),
- "FetchRequest": NewMockSequence(fetchResponse1, fetchResponse2),
- })
-
- master, err := NewConsumer([]string{broker0.Addr()}, cfg)
- if err != nil {
- t.Fatal(err)
- }
-
- // When
- consumer, err := master.ConsumePartition("my_topic", 0, 3)
- if err != nil {
- t.Fatal(err)
- }
-
- // Then: messages with offsets 1 and 2 are not returned even though they
- // are present in the response.
- assertMessageOffset(t, <-consumer.Messages(), 5)
- assertMessageOffset(t, <-consumer.Messages(), 7)
- assertMessageOffset(t, <-consumer.Messages(), 11)
-
- safeClose(t, consumer)
- safeClose(t, master)
- broker0.Close()
- }
-}
-
-// If leadership for a partition is changing then consumer resolves the new
-// leader and switches to it.
-func TestConsumerRebalancingMultiplePartitions(t *testing.T) {
- // initial setup
- seedBroker := NewMockBroker(t, 10)
- leader0 := NewMockBroker(t, 0)
- leader1 := NewMockBroker(t, 1)
-
- seedBroker.SetHandlerByMap(map[string]MockResponse{
- "MetadataRequest": NewMockMetadataResponse(t).
- SetBroker(leader0.Addr(), leader0.BrokerID()).
- SetBroker(leader1.Addr(), leader1.BrokerID()).
- SetLeader("my_topic", 0, leader0.BrokerID()).
- SetLeader("my_topic", 1, leader1.BrokerID()),
- })
-
- mockOffsetResponse1 := NewMockOffsetResponse(t).
- SetOffset("my_topic", 0, OffsetOldest, 0).
- SetOffset("my_topic", 0, OffsetNewest, 1000).
- SetOffset("my_topic", 1, OffsetOldest, 0).
- SetOffset("my_topic", 1, OffsetNewest, 1000)
- leader0.SetHandlerByMap(map[string]MockResponse{
- "OffsetRequest": mockOffsetResponse1,
- "FetchRequest": NewMockFetchResponse(t, 1),
- })
- leader1.SetHandlerByMap(map[string]MockResponse{
- "OffsetRequest": mockOffsetResponse1,
- "FetchRequest": NewMockFetchResponse(t, 1),
- })
-
- // launch test goroutines
- config := NewConfig()
- config.Consumer.Retry.Backoff = 50
- master, err := NewConsumer([]string{seedBroker.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
-
- // we expect to end up (eventually) consuming exactly ten messages on each partition
- var wg sync.WaitGroup
- for i := int32(0); i < 2; i++ {
- consumer, err := master.ConsumePartition("my_topic", i, 0)
- if err != nil {
- t.Error(err)
- }
-
- go func(c PartitionConsumer) {
- for err := range c.Errors() {
- t.Error(err)
- }
- }(consumer)
-
- wg.Add(1)
- go func(partition int32, c PartitionConsumer) {
- for i := 0; i < 10; i++ {
- message := <-consumer.Messages()
- if message.Offset != int64(i) {
- t.Error("Incorrect message offset!", i, partition, message.Offset)
- }
- if message.Partition != partition {
- t.Error("Incorrect message partition!")
- }
- }
- safeClose(t, consumer)
- wg.Done()
- }(i, consumer)
- }
-
- time.Sleep(50 * time.Millisecond)
- Logger.Printf(" STAGE 1")
- // Stage 1:
- // * my_topic/0 -> leader0 serves 4 messages
- // * my_topic/1 -> leader1 serves 0 messages
-
- mockFetchResponse := NewMockFetchResponse(t, 1)
- for i := 0; i < 4; i++ {
- mockFetchResponse.SetMessage("my_topic", 0, int64(i), testMsg)
- }
- leader0.SetHandlerByMap(map[string]MockResponse{
- "FetchRequest": mockFetchResponse,
- })
-
- time.Sleep(50 * time.Millisecond)
- Logger.Printf(" STAGE 2")
- // Stage 2:
- // * leader0 says that it is no longer serving my_topic/0
- // * seedBroker tells that leader1 is serving my_topic/0 now
-
- // seed broker tells that the new partition 0 leader is leader1
- seedBroker.SetHandlerByMap(map[string]MockResponse{
- "MetadataRequest": NewMockMetadataResponse(t).
- SetLeader("my_topic", 0, leader1.BrokerID()).
- SetLeader("my_topic", 1, leader1.BrokerID()),
- })
-
- // leader0 says no longer leader of partition 0
- fetchResponse := new(FetchResponse)
- fetchResponse.AddError("my_topic", 0, ErrNotLeaderForPartition)
- leader0.SetHandlerByMap(map[string]MockResponse{
- "FetchRequest": NewMockWrapper(fetchResponse),
- })
-
- time.Sleep(50 * time.Millisecond)
- Logger.Printf(" STAGE 3")
- // Stage 3:
- // * my_topic/0 -> leader1 serves 3 messages
- // * my_topic/1 -> leader1 server 8 messages
-
- // leader1 provides 3 message on partition 0, and 8 messages on partition 1
- mockFetchResponse2 := NewMockFetchResponse(t, 2)
- for i := 4; i < 7; i++ {
- mockFetchResponse2.SetMessage("my_topic", 0, int64(i), testMsg)
- }
- for i := 0; i < 8; i++ {
- mockFetchResponse2.SetMessage("my_topic", 1, int64(i), testMsg)
- }
- leader1.SetHandlerByMap(map[string]MockResponse{
- "FetchRequest": mockFetchResponse2,
- })
-
- time.Sleep(50 * time.Millisecond)
- Logger.Printf(" STAGE 4")
- // Stage 4:
- // * my_topic/0 -> leader1 serves 3 messages
- // * my_topic/1 -> leader1 tells that it is no longer the leader
- // * seedBroker tells that leader0 is a new leader for my_topic/1
-
- // metadata assigns 0 to leader1 and 1 to leader0
- seedBroker.SetHandlerByMap(map[string]MockResponse{
- "MetadataRequest": NewMockMetadataResponse(t).
- SetLeader("my_topic", 0, leader1.BrokerID()).
- SetLeader("my_topic", 1, leader0.BrokerID()),
- })
-
- // leader1 provides three more messages on partition0, says no longer leader of partition1
- mockFetchResponse3 := NewMockFetchResponse(t, 3).
- SetMessage("my_topic", 0, int64(7), testMsg).
- SetMessage("my_topic", 0, int64(8), testMsg).
- SetMessage("my_topic", 0, int64(9), testMsg)
- fetchResponse4 := new(FetchResponse)
- fetchResponse4.AddError("my_topic", 1, ErrNotLeaderForPartition)
- leader1.SetHandlerByMap(map[string]MockResponse{
- "FetchRequest": NewMockSequence(mockFetchResponse3, fetchResponse4),
- })
-
- // leader0 provides two messages on partition 1
- mockFetchResponse4 := NewMockFetchResponse(t, 2)
- for i := 8; i < 10; i++ {
- mockFetchResponse4.SetMessage("my_topic", 1, int64(i), testMsg)
- }
- leader0.SetHandlerByMap(map[string]MockResponse{
- "FetchRequest": mockFetchResponse4,
- })
-
- wg.Wait()
- safeClose(t, master)
- leader1.Close()
- leader0.Close()
- seedBroker.Close()
-}
-
-// When two partitions have the same broker as the leader, if one partition
-// consumer channel buffer is full then that does not affect the ability to
-// read messages by the other consumer.
-func TestConsumerInterleavedClose(t *testing.T) {
- // Given
- broker0 := NewMockBroker(t, 0)
- broker0.SetHandlerByMap(map[string]MockResponse{
- "MetadataRequest": NewMockMetadataResponse(t).
- SetBroker(broker0.Addr(), broker0.BrokerID()).
- SetLeader("my_topic", 0, broker0.BrokerID()).
- SetLeader("my_topic", 1, broker0.BrokerID()),
- "OffsetRequest": NewMockOffsetResponse(t).
- SetOffset("my_topic", 0, OffsetOldest, 1000).
- SetOffset("my_topic", 0, OffsetNewest, 1100).
- SetOffset("my_topic", 1, OffsetOldest, 2000).
- SetOffset("my_topic", 1, OffsetNewest, 2100),
- "FetchRequest": NewMockFetchResponse(t, 1).
- SetMessage("my_topic", 0, 1000, testMsg).
- SetMessage("my_topic", 0, 1001, testMsg).
- SetMessage("my_topic", 0, 1002, testMsg).
- SetMessage("my_topic", 1, 2000, testMsg),
- })
-
- config := NewConfig()
- config.ChannelBufferSize = 0
- master, err := NewConsumer([]string{broker0.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
-
- c0, err := master.ConsumePartition("my_topic", 0, 1000)
- if err != nil {
- t.Fatal(err)
- }
-
- c1, err := master.ConsumePartition("my_topic", 1, 2000)
- if err != nil {
- t.Fatal(err)
- }
-
- // When/Then: we can read from partition 0 even if nobody reads from partition 1
- assertMessageOffset(t, <-c0.Messages(), 1000)
- assertMessageOffset(t, <-c0.Messages(), 1001)
- assertMessageOffset(t, <-c0.Messages(), 1002)
-
- safeClose(t, c1)
- safeClose(t, c0)
- safeClose(t, master)
- broker0.Close()
-}
-
-func TestConsumerBounceWithReferenceOpen(t *testing.T) {
- broker0 := NewMockBroker(t, 0)
- broker0Addr := broker0.Addr()
- broker1 := NewMockBroker(t, 1)
-
- mockMetadataResponse := NewMockMetadataResponse(t).
- SetBroker(broker0.Addr(), broker0.BrokerID()).
- SetBroker(broker1.Addr(), broker1.BrokerID()).
- SetLeader("my_topic", 0, broker0.BrokerID()).
- SetLeader("my_topic", 1, broker1.BrokerID())
-
- mockOffsetResponse := NewMockOffsetResponse(t).
- SetOffset("my_topic", 0, OffsetOldest, 1000).
- SetOffset("my_topic", 0, OffsetNewest, 1100).
- SetOffset("my_topic", 1, OffsetOldest, 2000).
- SetOffset("my_topic", 1, OffsetNewest, 2100)
-
- mockFetchResponse := NewMockFetchResponse(t, 1)
- for i := 0; i < 10; i++ {
- mockFetchResponse.SetMessage("my_topic", 0, int64(1000+i), testMsg)
- mockFetchResponse.SetMessage("my_topic", 1, int64(2000+i), testMsg)
- }
-
- broker0.SetHandlerByMap(map[string]MockResponse{
- "OffsetRequest": mockOffsetResponse,
- "FetchRequest": mockFetchResponse,
- })
- broker1.SetHandlerByMap(map[string]MockResponse{
- "MetadataRequest": mockMetadataResponse,
- "OffsetRequest": mockOffsetResponse,
- "FetchRequest": mockFetchResponse,
- })
-
- config := NewConfig()
- config.Consumer.Return.Errors = true
- config.Consumer.Retry.Backoff = 100 * time.Millisecond
- config.ChannelBufferSize = 1
- master, err := NewConsumer([]string{broker1.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
-
- c0, err := master.ConsumePartition("my_topic", 0, 1000)
- if err != nil {
- t.Fatal(err)
- }
-
- c1, err := master.ConsumePartition("my_topic", 1, 2000)
- if err != nil {
- t.Fatal(err)
- }
-
- // read messages from both partition to make sure that both brokers operate
- // normally.
- assertMessageOffset(t, <-c0.Messages(), 1000)
- assertMessageOffset(t, <-c1.Messages(), 2000)
-
- // Simulate broker shutdown. Note that metadata response does not change,
- // that is the leadership does not move to another broker. So partition
- // consumer will keep retrying to restore the connection with the broker.
- broker0.Close()
-
- // Make sure that while the partition/0 leader is down, consumer/partition/1
- // is capable of pulling messages from broker1.
- for i := 1; i < 7; i++ {
- offset := (<-c1.Messages()).Offset
- if offset != int64(2000+i) {
- t.Errorf("Expected offset %d from consumer/partition/1", int64(2000+i))
- }
- }
-
- // Bring broker0 back to service.
- broker0 = NewMockBrokerAddr(t, 0, broker0Addr)
- broker0.SetHandlerByMap(map[string]MockResponse{
- "FetchRequest": mockFetchResponse,
- })
-
- // Read the rest of messages from both partitions.
- for i := 7; i < 10; i++ {
- assertMessageOffset(t, <-c1.Messages(), int64(2000+i))
- }
- for i := 1; i < 10; i++ {
- assertMessageOffset(t, <-c0.Messages(), int64(1000+i))
- }
-
- select {
- case <-c0.Errors():
- default:
- t.Errorf("Partition consumer should have detected broker restart")
- }
-
- safeClose(t, c1)
- safeClose(t, c0)
- safeClose(t, master)
- broker0.Close()
- broker1.Close()
-}
-
-func TestConsumerOffsetOutOfRange(t *testing.T) {
- // Given
- broker0 := NewMockBroker(t, 2)
- broker0.SetHandlerByMap(map[string]MockResponse{
- "MetadataRequest": NewMockMetadataResponse(t).
- SetBroker(broker0.Addr(), broker0.BrokerID()).
- SetLeader("my_topic", 0, broker0.BrokerID()),
- "OffsetRequest": NewMockOffsetResponse(t).
- SetOffset("my_topic", 0, OffsetNewest, 1234).
- SetOffset("my_topic", 0, OffsetOldest, 2345),
- })
-
- master, err := NewConsumer([]string{broker0.Addr()}, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- // When/Then
- if _, err := master.ConsumePartition("my_topic", 0, 0); err != ErrOffsetOutOfRange {
- t.Fatal("Should return ErrOffsetOutOfRange, got:", err)
- }
- if _, err := master.ConsumePartition("my_topic", 0, 3456); err != ErrOffsetOutOfRange {
- t.Fatal("Should return ErrOffsetOutOfRange, got:", err)
- }
- if _, err := master.ConsumePartition("my_topic", 0, -3); err != ErrOffsetOutOfRange {
- t.Fatal("Should return ErrOffsetOutOfRange, got:", err)
- }
-
- safeClose(t, master)
- broker0.Close()
-}
-
-func TestConsumerExpiryTicker(t *testing.T) {
- // Given
- broker0 := NewMockBroker(t, 0)
- fetchResponse1 := &FetchResponse{}
- for i := 1; i <= 8; i++ {
- fetchResponse1.AddMessage("my_topic", 0, nil, testMsg, int64(i))
- }
- broker0.SetHandlerByMap(map[string]MockResponse{
- "MetadataRequest": NewMockMetadataResponse(t).
- SetBroker(broker0.Addr(), broker0.BrokerID()).
- SetLeader("my_topic", 0, broker0.BrokerID()),
- "OffsetRequest": NewMockOffsetResponse(t).
- SetOffset("my_topic", 0, OffsetNewest, 1234).
- SetOffset("my_topic", 0, OffsetOldest, 1),
- "FetchRequest": NewMockSequence(fetchResponse1),
- })
-
- config := NewConfig()
- config.ChannelBufferSize = 0
- config.Consumer.MaxProcessingTime = 10 * time.Millisecond
- master, err := NewConsumer([]string{broker0.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
-
- // When
- consumer, err := master.ConsumePartition("my_topic", 0, 1)
- if err != nil {
- t.Fatal(err)
- }
-
- // Then: messages with offsets 1 through 8 are read
- for i := 1; i <= 8; i++ {
- assertMessageOffset(t, <-consumer.Messages(), int64(i))
- time.Sleep(2 * time.Millisecond)
- }
-
- safeClose(t, consumer)
- safeClose(t, master)
- broker0.Close()
-}
-
-func assertMessageOffset(t *testing.T, msg *ConsumerMessage, expectedOffset int64) {
- if msg.Offset != expectedOffset {
- t.Errorf("Incorrect message offset: expected=%d, actual=%d", expectedOffset, msg.Offset)
- }
-}
-
-// This example shows how to use the consumer to read messages
-// from a single partition.
-func ExampleConsumer() {
- consumer, err := NewConsumer([]string{"localhost:9092"}, nil)
- if err != nil {
- panic(err)
- }
-
- defer func() {
- if err := consumer.Close(); err != nil {
- log.Fatalln(err)
- }
- }()
-
- partitionConsumer, err := consumer.ConsumePartition("my_topic", 0, OffsetNewest)
- if err != nil {
- panic(err)
- }
-
- defer func() {
- if err := partitionConsumer.Close(); err != nil {
- log.Fatalln(err)
- }
- }()
-
- // Trap SIGINT to trigger a shutdown.
- signals := make(chan os.Signal, 1)
- signal.Notify(signals, os.Interrupt)
-
- consumed := 0
-ConsumerLoop:
- for {
- select {
- case msg := <-partitionConsumer.Messages():
- log.Printf("Consumed message offset %d\n", msg.Offset)
- consumed++
- case <-signals:
- break ConsumerLoop
- }
- }
-
- log.Printf("Consumed: %d\n", consumed)
-}
diff --git a/vendor/github.com/Shopify/sarama/create_partitions_request_test.go b/vendor/github.com/Shopify/sarama/create_partitions_request_test.go
deleted file mode 100644
index db8cb7329..000000000
--- a/vendor/github.com/Shopify/sarama/create_partitions_request_test.go
+++ /dev/null
@@ -1,50 +0,0 @@
-package sarama
-
-import (
- "testing"
- "time"
-)
-
-var (
- createPartitionRequestNoAssignment = []byte{
- 0, 0, 0, 1, // one topic
- 0, 5, 't', 'o', 'p', 'i', 'c',
- 0, 0, 0, 3, // 3 partitions
- 255, 255, 255, 255, // no assignments
- 0, 0, 0, 100, // timeout
- 0, // validate only = false
- }
-
- createPartitionRequestAssignment = []byte{
- 0, 0, 0, 1,
- 0, 5, 't', 'o', 'p', 'i', 'c',
- 0, 0, 0, 3, // 3 partitions
- 0, 0, 0, 2,
- 0, 0, 0, 2,
- 0, 0, 0, 2, 0, 0, 0, 3,
- 0, 0, 0, 2,
- 0, 0, 0, 3, 0, 0, 0, 1,
- 0, 0, 0, 100,
- 1, // validate only = true
- }
-)
-
-func TestCreatePartitionsRequest(t *testing.T) {
- req := &CreatePartitionsRequest{
- TopicPartitions: map[string]*TopicPartition{
- "topic": &TopicPartition{
- Count: 3,
- },
- },
- Timeout: 100 * time.Millisecond,
- }
-
- buf := testRequestEncode(t, "no assignment", req, createPartitionRequestNoAssignment)
- testRequestDecode(t, "no assignment", req, buf)
-
- req.ValidateOnly = true
- req.TopicPartitions["topic"].Assignment = [][]int32{{2, 3}, {3, 1}}
-
- buf = testRequestEncode(t, "assignment", req, createPartitionRequestAssignment)
- testRequestDecode(t, "assignment", req, buf)
-}
diff --git a/vendor/github.com/Shopify/sarama/create_partitions_response_test.go b/vendor/github.com/Shopify/sarama/create_partitions_response_test.go
deleted file mode 100644
index 3219882ca..000000000
--- a/vendor/github.com/Shopify/sarama/create_partitions_response_test.go
+++ /dev/null
@@ -1,52 +0,0 @@
-package sarama
-
-import (
- "reflect"
- "testing"
- "time"
-)
-
-var (
- createPartitionResponseSuccess = []byte{
- 0, 0, 0, 100, // throttleTimeMs
- 0, 0, 0, 1,
- 0, 5, 't', 'o', 'p', 'i', 'c',
- 0, 0, // no error
- 255, 255, // no error message
- }
-
- createPartitionResponseFail = []byte{
- 0, 0, 0, 100, // throttleTimeMs
- 0, 0, 0, 1,
- 0, 5, 't', 'o', 'p', 'i', 'c',
- 0, 37, // partition error
- 0, 5, 'e', 'r', 'r', 'o', 'r',
- }
-)
-
-func TestCreatePartitionsResponse(t *testing.T) {
- resp := &CreatePartitionsResponse{
- ThrottleTime: 100 * time.Millisecond,
- TopicPartitionErrors: map[string]*TopicPartitionError{
- "topic": &TopicPartitionError{},
- },
- }
-
- testResponse(t, "success", resp, createPartitionResponseSuccess)
- decodedresp := new(CreatePartitionsResponse)
- testVersionDecodable(t, "success", decodedresp, createPartitionResponseSuccess, 0)
- if !reflect.DeepEqual(decodedresp, resp) {
- t.Errorf("Decoding error: expected %v but got %v", decodedresp, resp)
- }
-
- errMsg := "error"
- resp.TopicPartitionErrors["topic"].Err = ErrInvalidPartitions
- resp.TopicPartitionErrors["topic"].ErrMsg = &errMsg
-
- testResponse(t, "with errors", resp, createPartitionResponseFail)
- decodedresp = new(CreatePartitionsResponse)
- testVersionDecodable(t, "with errors", decodedresp, createPartitionResponseFail, 0)
- if !reflect.DeepEqual(decodedresp, resp) {
- t.Errorf("Decoding error: expected %v but got %v", decodedresp, resp)
- }
-}
diff --git a/vendor/github.com/Shopify/sarama/create_topics_request_test.go b/vendor/github.com/Shopify/sarama/create_topics_request_test.go
deleted file mode 100644
index 56b1b80e5..000000000
--- a/vendor/github.com/Shopify/sarama/create_topics_request_test.go
+++ /dev/null
@@ -1,50 +0,0 @@
-package sarama
-
-import (
- "testing"
- "time"
-)
-
-var (
- createTopicsRequestV0 = []byte{
- 0, 0, 0, 1,
- 0, 5, 't', 'o', 'p', 'i', 'c',
- 255, 255, 255, 255,
- 255, 255,
- 0, 0, 0, 1, // 1 replica assignment
- 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2,
- 0, 0, 0, 1, // 1 config
- 0, 12, 'r', 'e', 't', 'e', 'n', 't', 'i', 'o', 'n', '.', 'm', 's',
- 0, 2, '-', '1',
- 0, 0, 0, 100,
- }
-
- createTopicsRequestV1 = append(createTopicsRequestV0, byte(1))
-)
-
-func TestCreateTopicsRequest(t *testing.T) {
- retention := "-1"
-
- req := &CreateTopicsRequest{
- TopicDetails: map[string]*TopicDetail{
- "topic": {
- NumPartitions: -1,
- ReplicationFactor: -1,
- ReplicaAssignment: map[int32][]int32{
- 0: []int32{0, 1, 2},
- },
- ConfigEntries: map[string]*string{
- "retention.ms": &retention,
- },
- },
- },
- Timeout: 100 * time.Millisecond,
- }
-
- testRequest(t, "version 0", req, createTopicsRequestV0)
-
- req.Version = 1
- req.ValidateOnly = true
-
- testRequest(t, "version 1", req, createTopicsRequestV1)
-}
diff --git a/vendor/github.com/Shopify/sarama/create_topics_response_test.go b/vendor/github.com/Shopify/sarama/create_topics_response_test.go
deleted file mode 100644
index 53790064f..000000000
--- a/vendor/github.com/Shopify/sarama/create_topics_response_test.go
+++ /dev/null
@@ -1,52 +0,0 @@
-package sarama
-
-import (
- "testing"
- "time"
-)
-
-var (
- createTopicsResponseV0 = []byte{
- 0, 0, 0, 1,
- 0, 5, 't', 'o', 'p', 'i', 'c',
- 0, 42,
- }
-
- createTopicsResponseV1 = []byte{
- 0, 0, 0, 1,
- 0, 5, 't', 'o', 'p', 'i', 'c',
- 0, 42,
- 0, 3, 'm', 's', 'g',
- }
-
- createTopicsResponseV2 = []byte{
- 0, 0, 0, 100,
- 0, 0, 0, 1,
- 0, 5, 't', 'o', 'p', 'i', 'c',
- 0, 42,
- 0, 3, 'm', 's', 'g',
- }
-)
-
-func TestCreateTopicsResponse(t *testing.T) {
- resp := &CreateTopicsResponse{
- TopicErrors: map[string]*TopicError{
- "topic": &TopicError{
- Err: ErrInvalidRequest,
- },
- },
- }
-
- testResponse(t, "version 0", resp, createTopicsResponseV0)
-
- resp.Version = 1
- msg := "msg"
- resp.TopicErrors["topic"].ErrMsg = &msg
-
- testResponse(t, "version 1", resp, createTopicsResponseV1)
-
- resp.Version = 2
- resp.ThrottleTime = 100 * time.Millisecond
-
- testResponse(t, "version 2", resp, createTopicsResponseV2)
-}
diff --git a/vendor/github.com/Shopify/sarama/delete_groups_request_test.go b/vendor/github.com/Shopify/sarama/delete_groups_request_test.go
deleted file mode 100644
index 908172498..000000000
--- a/vendor/github.com/Shopify/sarama/delete_groups_request_test.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- emptyDeleteGroupsRequest = []byte{0, 0, 0, 0}
-
- singleDeleteGroupsRequest = []byte{
- 0, 0, 0, 1, // 1 group
- 0, 3, 'f', 'o', 'o', // group name: foo
- }
-
- doubleDeleteGroupsRequest = []byte{
- 0, 0, 0, 2, // 2 groups
- 0, 3, 'f', 'o', 'o', // group name: foo
- 0, 3, 'b', 'a', 'r', // group name: foo
- }
-)
-
-func TestDeleteGroupsRequest(t *testing.T) {
- var request *DeleteGroupsRequest
-
- request = new(DeleteGroupsRequest)
- testRequest(t, "no groups", request, emptyDeleteGroupsRequest)
-
- request = new(DeleteGroupsRequest)
- request.AddGroup("foo")
- testRequest(t, "one group", request, singleDeleteGroupsRequest)
-
- request = new(DeleteGroupsRequest)
- request.AddGroup("foo")
- request.AddGroup("bar")
- testRequest(t, "two groups", request, doubleDeleteGroupsRequest)
-}
diff --git a/vendor/github.com/Shopify/sarama/delete_groups_response_test.go b/vendor/github.com/Shopify/sarama/delete_groups_response_test.go
deleted file mode 100644
index 6f622b5f0..000000000
--- a/vendor/github.com/Shopify/sarama/delete_groups_response_test.go
+++ /dev/null
@@ -1,57 +0,0 @@
-package sarama
-
-import (
- "testing"
-)
-
-var (
- emptyDeleteGroupsResponse = []byte{
- 0, 0, 0, 0, // does not violate any quota
- 0, 0, 0, 0, // no groups
- }
-
- errorDeleteGroupsResponse = []byte{
- 0, 0, 0, 0, // does not violate any quota
- 0, 0, 0, 1, // 1 group
- 0, 3, 'f', 'o', 'o', // group name
- 0, 31, // error ErrClusterAuthorizationFailed
- }
-
- noErrorDeleteGroupsResponse = []byte{
- 0, 0, 0, 0, // does not violate any quota
- 0, 0, 0, 1, // 1 group
- 0, 3, 'f', 'o', 'o', // group name
- 0, 0, // no error
- }
-)
-
-func TestDeleteGroupsResponse(t *testing.T) {
- var response *DeleteGroupsResponse
-
- response = new(DeleteGroupsResponse)
- testVersionDecodable(t, "empty", response, emptyDeleteGroupsResponse, 0)
- if response.ThrottleTime != 0 {
- t.Error("Expected no violation")
- }
- if len(response.GroupErrorCodes) != 0 {
- t.Error("Expected no groups")
- }
-
- response = new(DeleteGroupsResponse)
- testVersionDecodable(t, "error", response, errorDeleteGroupsResponse, 0)
- if response.ThrottleTime != 0 {
- t.Error("Expected no violation")
- }
- if response.GroupErrorCodes["foo"] != ErrClusterAuthorizationFailed {
- t.Error("Expected error ErrClusterAuthorizationFailed, found:", response.GroupErrorCodes["foo"])
- }
-
- response = new(DeleteGroupsResponse)
- testVersionDecodable(t, "no error", response, noErrorDeleteGroupsResponse, 0)
- if response.ThrottleTime != 0 {
- t.Error("Expected no violation")
- }
- if response.GroupErrorCodes["foo"] != ErrNoError {
- t.Error("Expected error ErrClusterAuthorizationFailed, found:", response.GroupErrorCodes["foo"])
- }
-}
diff --git a/vendor/github.com/Shopify/sarama/delete_records_request_test.go b/vendor/github.com/Shopify/sarama/delete_records_request_test.go
deleted file mode 100644
index c72960cfb..000000000
--- a/vendor/github.com/Shopify/sarama/delete_records_request_test.go
+++ /dev/null
@@ -1,36 +0,0 @@
-package sarama
-
-import (
- "testing"
- "time"
-)
-
-var deleteRecordsRequest = []byte{
- 0, 0, 0, 2,
- 0, 5, 'o', 't', 'h', 'e', 'r',
- 0, 0, 0, 0,
- 0, 5, 't', 'o', 'p', 'i', 'c',
- 0, 0, 0, 2,
- 0, 0, 0, 19,
- 0, 0, 0, 0, 0, 0, 0, 200,
- 0, 0, 0, 20,
- 0, 0, 0, 0, 0, 0, 0, 190,
- 0, 0, 0, 100,
-}
-
-func TestDeleteRecordsRequest(t *testing.T) {
- req := &DeleteRecordsRequest{
- Topics: map[string]*DeleteRecordsRequestTopic{
- "topic": {
- PartitionOffsets: map[int32]int64{
- 19: 200,
- 20: 190,
- },
- },
- "other": {},
- },
- Timeout: 100 * time.Millisecond,
- }
-
- testRequest(t, "", req, deleteRecordsRequest)
-}
diff --git a/vendor/github.com/Shopify/sarama/delete_records_response_test.go b/vendor/github.com/Shopify/sarama/delete_records_response_test.go
deleted file mode 100644
index 3653cdc41..000000000
--- a/vendor/github.com/Shopify/sarama/delete_records_response_test.go
+++ /dev/null
@@ -1,39 +0,0 @@
-package sarama
-
-import (
- "testing"
- "time"
-)
-
-var deleteRecordsResponse = []byte{
- 0, 0, 0, 100,
- 0, 0, 0, 2,
- 0, 5, 'o', 't', 'h', 'e', 'r',
- 0, 0, 0, 0,
- 0, 5, 't', 'o', 'p', 'i', 'c',
- 0, 0, 0, 2,
- 0, 0, 0, 19,
- 0, 0, 0, 0, 0, 0, 0, 200,
- 0, 0,
- 0, 0, 0, 20,
- 255, 255, 255, 255, 255, 255, 255, 255,
- 0, 3,
-}
-
-func TestDeleteRecordsResponse(t *testing.T) {
- resp := &DeleteRecordsResponse{
- Version: 0,
- ThrottleTime: 100 * time.Millisecond,
- Topics: map[string]*DeleteRecordsResponseTopic{
- "topic": {
- Partitions: map[int32]*DeleteRecordsResponsePartition{
- 19: {LowWatermark: 200, Err: 0},
- 20: {LowWatermark: -1, Err: 3},
- },
- },
- "other": {},
- },
- }
-
- testResponse(t, "", resp, deleteRecordsResponse)
-}
diff --git a/vendor/github.com/Shopify/sarama/delete_topics_request_test.go b/vendor/github.com/Shopify/sarama/delete_topics_request_test.go
deleted file mode 100644
index c313a2f3b..000000000
--- a/vendor/github.com/Shopify/sarama/delete_topics_request_test.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package sarama
-
-import (
- "testing"
- "time"
-)
-
-var deleteTopicsRequest = []byte{
- 0, 0, 0, 2,
- 0, 5, 't', 'o', 'p', 'i', 'c',
- 0, 5, 'o', 't', 'h', 'e', 'r',
- 0, 0, 0, 100,
-}
-
-func TestDeleteTopicsRequestV0(t *testing.T) {
- req := &DeleteTopicsRequest{
- Version: 0,
- Topics: []string{"topic", "other"},
- Timeout: 100 * time.Millisecond,
- }
-
- testRequest(t, "", req, deleteTopicsRequest)
-}
-
-func TestDeleteTopicsRequestV1(t *testing.T) {
- req := &DeleteTopicsRequest{
- Version: 1,
- Topics: []string{"topic", "other"},
- Timeout: 100 * time.Millisecond,
- }
-
- testRequest(t, "", req, deleteTopicsRequest)
-}
diff --git a/vendor/github.com/Shopify/sarama/delete_topics_response_test.go b/vendor/github.com/Shopify/sarama/delete_topics_response_test.go
deleted file mode 100644
index 516f1a3bd..000000000
--- a/vendor/github.com/Shopify/sarama/delete_topics_response_test.go
+++ /dev/null
@@ -1,36 +0,0 @@
-package sarama
-
-import (
- "testing"
- "time"
-)
-
-var (
- deleteTopicsResponseV0 = []byte{
- 0, 0, 0, 1,
- 0, 5, 't', 'o', 'p', 'i', 'c',
- 0, 0,
- }
-
- deleteTopicsResponseV1 = []byte{
- 0, 0, 0, 100,
- 0, 0, 0, 1,
- 0, 5, 't', 'o', 'p', 'i', 'c',
- 0, 0,
- }
-)
-
-func TestDeleteTopicsResponse(t *testing.T) {
- resp := &DeleteTopicsResponse{
- TopicErrorCodes: map[string]KError{
- "topic": ErrNoError,
- },
- }
-
- testResponse(t, "version 0", resp, deleteTopicsResponseV0)
-
- resp.Version = 1
- resp.ThrottleTime = 100 * time.Millisecond
-
- testResponse(t, "version 1", resp, deleteTopicsResponseV1)
-}
diff --git a/vendor/github.com/Shopify/sarama/describe_configs_request_test.go b/vendor/github.com/Shopify/sarama/describe_configs_request_test.go
deleted file mode 100644
index ca0fd0495..000000000
--- a/vendor/github.com/Shopify/sarama/describe_configs_request_test.go
+++ /dev/null
@@ -1,90 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- emptyDescribeConfigsRequest = []byte{
- 0, 0, 0, 0, // 0 configs
- }
-
- singleDescribeConfigsRequest = []byte{
- 0, 0, 0, 1, // 1 config
- 2, // a topic
- 0, 3, 'f', 'o', 'o', // topic name: foo
- 0, 0, 0, 1, //1 config name
- 0, 10, // 10 chars
- 's', 'e', 'g', 'm', 'e', 'n', 't', '.', 'm', 's',
- }
-
- doubleDescribeConfigsRequest = []byte{
- 0, 0, 0, 2, // 2 configs
- 2, // a topic
- 0, 3, 'f', 'o', 'o', // topic name: foo
- 0, 0, 0, 2, //2 config name
- 0, 10, // 10 chars
- 's', 'e', 'g', 'm', 'e', 'n', 't', '.', 'm', 's',
- 0, 12, // 12 chars
- 'r', 'e', 't', 'e', 'n', 't', 'i', 'o', 'n', '.', 'm', 's',
- 2, // a topic
- 0, 3, 'b', 'a', 'r', // topic name: foo
- 0, 0, 0, 1, // 1 config
- 0, 10, // 10 chars
- 's', 'e', 'g', 'm', 'e', 'n', 't', '.', 'm', 's',
- }
-
- singleDescribeConfigsRequestAllConfigs = []byte{
- 0, 0, 0, 1, // 1 config
- 2, // a topic
- 0, 3, 'f', 'o', 'o', // topic name: foo
- 255, 255, 255, 255, // no configs
- }
-)
-
-func TestDescribeConfigsRequest(t *testing.T) {
- var request *DescribeConfigsRequest
-
- request = &DescribeConfigsRequest{
- Resources: []*ConfigResource{},
- }
- testRequest(t, "no requests", request, emptyDescribeConfigsRequest)
-
- configs := []string{"segment.ms"}
- request = &DescribeConfigsRequest{
- Resources: []*ConfigResource{
- &ConfigResource{
- Type: TopicResource,
- Name: "foo",
- ConfigNames: configs,
- },
- },
- }
-
- testRequest(t, "one config", request, singleDescribeConfigsRequest)
-
- request = &DescribeConfigsRequest{
- Resources: []*ConfigResource{
- &ConfigResource{
- Type: TopicResource,
- Name: "foo",
- ConfigNames: []string{"segment.ms", "retention.ms"},
- },
- &ConfigResource{
- Type: TopicResource,
- Name: "bar",
- ConfigNames: []string{"segment.ms"},
- },
- },
- }
- testRequest(t, "two configs", request, doubleDescribeConfigsRequest)
-
- request = &DescribeConfigsRequest{
- Resources: []*ConfigResource{
- &ConfigResource{
- Type: TopicResource,
- Name: "foo",
- },
- },
- }
-
- testRequest(t, "one topic, all configs", request, singleDescribeConfigsRequestAllConfigs)
-}
diff --git a/vendor/github.com/Shopify/sarama/describe_configs_response_test.go b/vendor/github.com/Shopify/sarama/describe_configs_response_test.go
deleted file mode 100644
index e3dcbac39..000000000
--- a/vendor/github.com/Shopify/sarama/describe_configs_response_test.go
+++ /dev/null
@@ -1,60 +0,0 @@
-package sarama
-
-import (
- "testing"
-)
-
-var (
- describeConfigsResponseEmpty = []byte{
- 0, 0, 0, 0, //throttle
- 0, 0, 0, 0, // no configs
- }
-
- describeConfigsResponsePopulated = []byte{
- 0, 0, 0, 0, //throttle
- 0, 0, 0, 1, // response
- 0, 0, //errorcode
- 0, 0, //string
- 2, // topic
- 0, 3, 'f', 'o', 'o',
- 0, 0, 0, 1, //configs
- 0, 10, 's', 'e', 'g', 'm', 'e', 'n', 't', '.', 'm', 's',
- 0, 4, '1', '0', '0', '0',
- 0, // ReadOnly
- 0, // Default
- 0, // Sensitive
- }
-)
-
-func TestDescribeConfigsResponse(t *testing.T) {
- var response *DescribeConfigsResponse
-
- response = &DescribeConfigsResponse{
- Resources: []*ResourceResponse{},
- }
- testVersionDecodable(t, "empty", response, describeConfigsResponseEmpty, 0)
- if len(response.Resources) != 0 {
- t.Error("Expected no groups")
- }
-
- response = &DescribeConfigsResponse{
- Resources: []*ResourceResponse{
- &ResourceResponse{
- ErrorCode: 0,
- ErrorMsg: "",
- Type: TopicResource,
- Name: "foo",
- Configs: []*ConfigEntry{
- &ConfigEntry{
- Name: "segment.ms",
- Value: "1000",
- ReadOnly: false,
- Default: false,
- Sensitive: false,
- },
- },
- },
- },
- }
- testResponse(t, "response with error", response, describeConfigsResponsePopulated)
-}
diff --git a/vendor/github.com/Shopify/sarama/describe_groups_request_test.go b/vendor/github.com/Shopify/sarama/describe_groups_request_test.go
deleted file mode 100644
index 7d45f3fee..000000000
--- a/vendor/github.com/Shopify/sarama/describe_groups_request_test.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- emptyDescribeGroupsRequest = []byte{0, 0, 0, 0}
-
- singleDescribeGroupsRequest = []byte{
- 0, 0, 0, 1, // 1 group
- 0, 3, 'f', 'o', 'o', // group name: foo
- }
-
- doubleDescribeGroupsRequest = []byte{
- 0, 0, 0, 2, // 2 groups
- 0, 3, 'f', 'o', 'o', // group name: foo
- 0, 3, 'b', 'a', 'r', // group name: foo
- }
-)
-
-func TestDescribeGroupsRequest(t *testing.T) {
- var request *DescribeGroupsRequest
-
- request = new(DescribeGroupsRequest)
- testRequest(t, "no groups", request, emptyDescribeGroupsRequest)
-
- request = new(DescribeGroupsRequest)
- request.AddGroup("foo")
- testRequest(t, "one group", request, singleDescribeGroupsRequest)
-
- request = new(DescribeGroupsRequest)
- request.AddGroup("foo")
- request.AddGroup("bar")
- testRequest(t, "two groups", request, doubleDescribeGroupsRequest)
-}
diff --git a/vendor/github.com/Shopify/sarama/describe_groups_response_test.go b/vendor/github.com/Shopify/sarama/describe_groups_response_test.go
deleted file mode 100644
index dd3973191..000000000
--- a/vendor/github.com/Shopify/sarama/describe_groups_response_test.go
+++ /dev/null
@@ -1,91 +0,0 @@
-package sarama
-
-import (
- "reflect"
- "testing"
-)
-
-var (
- describeGroupsResponseEmpty = []byte{
- 0, 0, 0, 0, // no groups
- }
-
- describeGroupsResponsePopulated = []byte{
- 0, 0, 0, 2, // 2 groups
-
- 0, 0, // no error
- 0, 3, 'f', 'o', 'o', // Group ID
- 0, 3, 'b', 'a', 'r', // State
- 0, 8, 'c', 'o', 'n', 's', 'u', 'm', 'e', 'r', // ConsumerProtocol type
- 0, 3, 'b', 'a', 'z', // Protocol name
- 0, 0, 0, 1, // 1 member
- 0, 2, 'i', 'd', // Member ID
- 0, 6, 's', 'a', 'r', 'a', 'm', 'a', // Client ID
- 0, 9, 'l', 'o', 'c', 'a', 'l', 'h', 'o', 's', 't', // Client Host
- 0, 0, 0, 3, 0x01, 0x02, 0x03, // MemberMetadata
- 0, 0, 0, 3, 0x04, 0x05, 0x06, // MemberAssignment
-
- 0, 30, // ErrGroupAuthorizationFailed
- 0, 0,
- 0, 0,
- 0, 0,
- 0, 0,
- 0, 0, 0, 0,
- }
-)
-
-func TestDescribeGroupsResponse(t *testing.T) {
- var response *DescribeGroupsResponse
-
- response = new(DescribeGroupsResponse)
- testVersionDecodable(t, "empty", response, describeGroupsResponseEmpty, 0)
- if len(response.Groups) != 0 {
- t.Error("Expected no groups")
- }
-
- response = new(DescribeGroupsResponse)
- testVersionDecodable(t, "populated", response, describeGroupsResponsePopulated, 0)
- if len(response.Groups) != 2 {
- t.Error("Expected two groups")
- }
-
- group0 := response.Groups[0]
- if group0.Err != ErrNoError {
- t.Error("Unxpected groups[0].Err, found", group0.Err)
- }
- if group0.GroupId != "foo" {
- t.Error("Unxpected groups[0].GroupId, found", group0.GroupId)
- }
- if group0.State != "bar" {
- t.Error("Unxpected groups[0].State, found", group0.State)
- }
- if group0.ProtocolType != "consumer" {
- t.Error("Unxpected groups[0].ProtocolType, found", group0.ProtocolType)
- }
- if group0.Protocol != "baz" {
- t.Error("Unxpected groups[0].Protocol, found", group0.Protocol)
- }
- if len(group0.Members) != 1 {
- t.Error("Unxpected groups[0].Members, found", group0.Members)
- }
- if group0.Members["id"].ClientId != "sarama" {
- t.Error("Unxpected groups[0].Members[id].ClientId, found", group0.Members["id"].ClientId)
- }
- if group0.Members["id"].ClientHost != "localhost" {
- t.Error("Unxpected groups[0].Members[id].ClientHost, found", group0.Members["id"].ClientHost)
- }
- if !reflect.DeepEqual(group0.Members["id"].MemberMetadata, []byte{0x01, 0x02, 0x03}) {
- t.Error("Unxpected groups[0].Members[id].MemberMetadata, found", group0.Members["id"].MemberMetadata)
- }
- if !reflect.DeepEqual(group0.Members["id"].MemberAssignment, []byte{0x04, 0x05, 0x06}) {
- t.Error("Unxpected groups[0].Members[id].MemberAssignment, found", group0.Members["id"].MemberAssignment)
- }
-
- group1 := response.Groups[1]
- if group1.Err != ErrGroupAuthorizationFailed {
- t.Error("Unxpected groups[1].Err, found", group0.Err)
- }
- if len(group1.Members) != 0 {
- t.Error("Unxpected groups[1].Members, found", group0.Members)
- }
-}
diff --git a/vendor/github.com/Shopify/sarama/end_txn_request_test.go b/vendor/github.com/Shopify/sarama/end_txn_request_test.go
deleted file mode 100644
index 20e404eb8..000000000
--- a/vendor/github.com/Shopify/sarama/end_txn_request_test.go
+++ /dev/null
@@ -1,23 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- endTxnRequest = []byte{
- 0, 3, 't', 'x', 'n',
- 0, 0, 0, 0, 0, 0, 31, 64,
- 0, 1,
- 1,
- }
-)
-
-func TestEndTxnRequest(t *testing.T) {
- req := &EndTxnRequest{
- TransactionalID: "txn",
- ProducerID: 8000,
- ProducerEpoch: 1,
- TransactionResult: true,
- }
-
- testRequest(t, "", req, endTxnRequest)
-}
diff --git a/vendor/github.com/Shopify/sarama/end_txn_response_test.go b/vendor/github.com/Shopify/sarama/end_txn_response_test.go
deleted file mode 100644
index 41d730418..000000000
--- a/vendor/github.com/Shopify/sarama/end_txn_response_test.go
+++ /dev/null
@@ -1,22 +0,0 @@
-package sarama
-
-import (
- "testing"
- "time"
-)
-
-var (
- endTxnResponse = []byte{
- 0, 0, 0, 100,
- 0, 49,
- }
-)
-
-func TestEndTxnResponse(t *testing.T) {
- resp := &EndTxnResponse{
- ThrottleTime: 100 * time.Millisecond,
- Err: ErrInvalidProducerIDMapping,
- }
-
- testResponse(t, "", resp, endTxnResponse)
-}
diff --git a/vendor/github.com/Shopify/sarama/fetch_request_test.go b/vendor/github.com/Shopify/sarama/fetch_request_test.go
deleted file mode 100644
index 1a94c2d1f..000000000
--- a/vendor/github.com/Shopify/sarama/fetch_request_test.go
+++ /dev/null
@@ -1,48 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- fetchRequestNoBlocks = []byte{
- 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00}
-
- fetchRequestWithProperties = []byte{
- 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xEF,
- 0x00, 0x00, 0x00, 0x00}
-
- fetchRequestOneBlock = []byte{
- 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x05, 't', 'o', 'p', 'i', 'c',
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x56}
-
- fetchRequestOneBlockV4 = []byte{
- 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0xFF,
- 0x01,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x05, 't', 'o', 'p', 'i', 'c',
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x56}
-)
-
-func TestFetchRequest(t *testing.T) {
- request := new(FetchRequest)
- testRequest(t, "no blocks", request, fetchRequestNoBlocks)
-
- request.MaxWaitTime = 0x20
- request.MinBytes = 0xEF
- testRequest(t, "with properties", request, fetchRequestWithProperties)
-
- request.MaxWaitTime = 0
- request.MinBytes = 0
- request.AddBlock("topic", 0x12, 0x34, 0x56)
- testRequest(t, "one block", request, fetchRequestOneBlock)
-
- request.Version = 4
- request.MaxBytes = 0xFF
- request.Isolation = ReadCommitted
- testRequest(t, "one block v4", request, fetchRequestOneBlockV4)
-}
diff --git a/vendor/github.com/Shopify/sarama/fetch_response_test.go b/vendor/github.com/Shopify/sarama/fetch_response_test.go
deleted file mode 100644
index c6b6b46e4..000000000
--- a/vendor/github.com/Shopify/sarama/fetch_response_test.go
+++ /dev/null
@@ -1,248 +0,0 @@
-package sarama
-
-import (
- "bytes"
- "testing"
-)
-
-var (
- emptyFetchResponse = []byte{
- 0x00, 0x00, 0x00, 0x00}
-
- oneMessageFetchResponse = []byte{
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x05, 't', 'o', 'p', 'i', 'c',
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x05,
- 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10,
- 0x00, 0x00, 0x00, 0x1C,
- // messageSet
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x10,
- // message
- 0x23, 0x96, 0x4a, 0xf7, // CRC
- 0x00,
- 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF,
- 0x00, 0x00, 0x00, 0x02, 0x00, 0xEE}
-
- oneRecordFetchResponse = []byte{
- 0x00, 0x00, 0x00, 0x00, // ThrottleTime
- 0x00, 0x00, 0x00, 0x01, // Number of Topics
- 0x00, 0x05, 't', 'o', 'p', 'i', 'c', // Topic
- 0x00, 0x00, 0x00, 0x01, // Number of Partitions
- 0x00, 0x00, 0x00, 0x05, // Partition
- 0x00, 0x01, // Error
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, // High Watermark Offset
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, // Last Stable Offset
- 0x00, 0x00, 0x00, 0x00, // Number of Aborted Transactions
- 0x00, 0x00, 0x00, 0x52, // Records length
- // recordBatch
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x46,
- 0x00, 0x00, 0x00, 0x00,
- 0x02,
- 0xDB, 0x47, 0x14, 0xC9,
- 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x01,
- // record
- 0x28,
- 0x00,
- 0x0A,
- 0x00,
- 0x08, 0x01, 0x02, 0x03, 0x04,
- 0x06, 0x05, 0x06, 0x07,
- 0x02,
- 0x06, 0x08, 0x09, 0x0A,
- 0x04, 0x0B, 0x0C}
-
- oneMessageFetchResponseV4 = []byte{
- 0x00, 0x00, 0x00, 0x00, // ThrottleTime
- 0x00, 0x00, 0x00, 0x01, // Number of Topics
- 0x00, 0x05, 't', 'o', 'p', 'i', 'c', // Topic
- 0x00, 0x00, 0x00, 0x01, // Number of Partitions
- 0x00, 0x00, 0x00, 0x05, // Partition
- 0x00, 0x01, // Error
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, // High Watermark Offset
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, // Last Stable Offset
- 0x00, 0x00, 0x00, 0x00, // Number of Aborted Transactions
- 0x00, 0x00, 0x00, 0x1C,
- // messageSet
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x10,
- // message
- 0x23, 0x96, 0x4a, 0xf7, // CRC
- 0x00,
- 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF,
- 0x00, 0x00, 0x00, 0x02, 0x00, 0xEE}
-)
-
-func TestEmptyFetchResponse(t *testing.T) {
- response := FetchResponse{}
- testVersionDecodable(t, "empty", &response, emptyFetchResponse, 0)
-
- if len(response.Blocks) != 0 {
- t.Error("Decoding produced topic blocks where there were none.")
- }
-
-}
-
-func TestOneMessageFetchResponse(t *testing.T) {
- response := FetchResponse{}
- testVersionDecodable(t, "one message", &response, oneMessageFetchResponse, 0)
-
- if len(response.Blocks) != 1 {
- t.Fatal("Decoding produced incorrect number of topic blocks.")
- }
-
- if len(response.Blocks["topic"]) != 1 {
- t.Fatal("Decoding produced incorrect number of partition blocks for topic.")
- }
-
- block := response.GetBlock("topic", 5)
- if block == nil {
- t.Fatal("GetBlock didn't return block.")
- }
- if block.Err != ErrOffsetOutOfRange {
- t.Error("Decoding didn't produce correct error code.")
- }
- if block.HighWaterMarkOffset != 0x10101010 {
- t.Error("Decoding didn't produce correct high water mark offset.")
- }
- partial, err := block.isPartial()
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
- if partial {
- t.Error("Decoding detected a partial trailing message where there wasn't one.")
- }
-
- n, err := block.numRecords()
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
- if n != 1 {
- t.Fatal("Decoding produced incorrect number of messages.")
- }
- msgBlock := block.RecordsSet[0].MsgSet.Messages[0]
- if msgBlock.Offset != 0x550000 {
- t.Error("Decoding produced incorrect message offset.")
- }
- msg := msgBlock.Msg
- if msg.Codec != CompressionNone {
- t.Error("Decoding produced incorrect message compression.")
- }
- if msg.Key != nil {
- t.Error("Decoding produced message key where there was none.")
- }
- if !bytes.Equal(msg.Value, []byte{0x00, 0xEE}) {
- t.Error("Decoding produced incorrect message value.")
- }
-}
-
-func TestOneRecordFetchResponse(t *testing.T) {
- response := FetchResponse{}
- testVersionDecodable(t, "one record", &response, oneRecordFetchResponse, 4)
-
- if len(response.Blocks) != 1 {
- t.Fatal("Decoding produced incorrect number of topic blocks.")
- }
-
- if len(response.Blocks["topic"]) != 1 {
- t.Fatal("Decoding produced incorrect number of partition blocks for topic.")
- }
-
- block := response.GetBlock("topic", 5)
- if block == nil {
- t.Fatal("GetBlock didn't return block.")
- }
- if block.Err != ErrOffsetOutOfRange {
- t.Error("Decoding didn't produce correct error code.")
- }
- if block.HighWaterMarkOffset != 0x10101010 {
- t.Error("Decoding didn't produce correct high water mark offset.")
- }
- partial, err := block.isPartial()
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
- if partial {
- t.Error("Decoding detected a partial trailing record where there wasn't one.")
- }
-
- n, err := block.numRecords()
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
- if n != 1 {
- t.Fatal("Decoding produced incorrect number of records.")
- }
- rec := block.RecordsSet[0].RecordBatch.Records[0]
- if !bytes.Equal(rec.Key, []byte{0x01, 0x02, 0x03, 0x04}) {
- t.Error("Decoding produced incorrect record key.")
- }
- if !bytes.Equal(rec.Value, []byte{0x05, 0x06, 0x07}) {
- t.Error("Decoding produced incorrect record value.")
- }
-}
-
-func TestOneMessageFetchResponseV4(t *testing.T) {
- response := FetchResponse{}
- testVersionDecodable(t, "one message v4", &response, oneMessageFetchResponseV4, 4)
-
- if len(response.Blocks) != 1 {
- t.Fatal("Decoding produced incorrect number of topic blocks.")
- }
-
- if len(response.Blocks["topic"]) != 1 {
- t.Fatal("Decoding produced incorrect number of partition blocks for topic.")
- }
-
- block := response.GetBlock("topic", 5)
- if block == nil {
- t.Fatal("GetBlock didn't return block.")
- }
- if block.Err != ErrOffsetOutOfRange {
- t.Error("Decoding didn't produce correct error code.")
- }
- if block.HighWaterMarkOffset != 0x10101010 {
- t.Error("Decoding didn't produce correct high water mark offset.")
- }
- partial, err := block.isPartial()
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
- if partial {
- t.Error("Decoding detected a partial trailing record where there wasn't one.")
- }
-
- n, err := block.numRecords()
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
- if n != 1 {
- t.Fatal("Decoding produced incorrect number of records.")
- }
- msgBlock := block.RecordsSet[0].MsgSet.Messages[0]
- if msgBlock.Offset != 0x550000 {
- t.Error("Decoding produced incorrect message offset.")
- }
- msg := msgBlock.Msg
- if msg.Codec != CompressionNone {
- t.Error("Decoding produced incorrect message compression.")
- }
- if msg.Key != nil {
- t.Error("Decoding produced message key where there was none.")
- }
- if !bytes.Equal(msg.Value, []byte{0x00, 0xEE}) {
- t.Error("Decoding produced incorrect message value.")
- }
-}
diff --git a/vendor/github.com/Shopify/sarama/find_coordinator_request_test.go b/vendor/github.com/Shopify/sarama/find_coordinator_request_test.go
deleted file mode 100644
index 7e889b074..000000000
--- a/vendor/github.com/Shopify/sarama/find_coordinator_request_test.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- findCoordinatorRequestConsumerGroup = []byte{
- 0, 5, 'g', 'r', 'o', 'u', 'p',
- 0,
- }
-
- findCoordinatorRequestTransaction = []byte{
- 0, 13, 't', 'r', 'a', 'n', 's', 'a', 'c', 't', 'i', 'o', 'n', 'i', 'd',
- 1,
- }
-)
-
-func TestFindCoordinatorRequest(t *testing.T) {
- req := &FindCoordinatorRequest{
- Version: 1,
- CoordinatorKey: "group",
- CoordinatorType: CoordinatorGroup,
- }
-
- testRequest(t, "version 1 - group", req, findCoordinatorRequestConsumerGroup)
-
- req = &FindCoordinatorRequest{
- Version: 1,
- CoordinatorKey: "transactionid",
- CoordinatorType: CoordinatorTransaction,
- }
-
- testRequest(t, "version 1 - transaction", req, findCoordinatorRequestTransaction)
-}
diff --git a/vendor/github.com/Shopify/sarama/find_coordinator_response_test.go b/vendor/github.com/Shopify/sarama/find_coordinator_response_test.go
deleted file mode 100644
index 417a76c6e..000000000
--- a/vendor/github.com/Shopify/sarama/find_coordinator_response_test.go
+++ /dev/null
@@ -1,83 +0,0 @@
-package sarama
-
-import (
- "testing"
- "time"
-)
-
-func TestFindCoordinatorResponse(t *testing.T) {
- errMsg := "kaboom"
-
- for _, tc := range []struct {
- desc string
- response *FindCoordinatorResponse
- encoded []byte
- }{{
- desc: "version 0 - no error",
- response: &FindCoordinatorResponse{
- Version: 0,
- Err: ErrNoError,
- Coordinator: &Broker{
- id: 7,
- addr: "host:9092",
- },
- },
- encoded: []byte{
- 0, 0, // Err
- 0, 0, 0, 7, // Coordinator.ID
- 0, 4, 'h', 'o', 's', 't', // Coordinator.Host
- 0, 0, 35, 132, // Coordinator.Port
- },
- }, {
- desc: "version 1 - no error",
- response: &FindCoordinatorResponse{
- Version: 1,
- ThrottleTime: 100 * time.Millisecond,
- Err: ErrNoError,
- Coordinator: &Broker{
- id: 7,
- addr: "host:9092",
- },
- },
- encoded: []byte{
- 0, 0, 0, 100, // ThrottleTime
- 0, 0, // Err
- 255, 255, // ErrMsg: empty
- 0, 0, 0, 7, // Coordinator.ID
- 0, 4, 'h', 'o', 's', 't', // Coordinator.Host
- 0, 0, 35, 132, // Coordinator.Port
- },
- }, {
- desc: "version 0 - error",
- response: &FindCoordinatorResponse{
- Version: 0,
- Err: ErrConsumerCoordinatorNotAvailable,
- Coordinator: NoNode,
- },
- encoded: []byte{
- 0, 15, // Err
- 255, 255, 255, 255, // Coordinator.ID: -1
- 0, 0, // Coordinator.Host: ""
- 255, 255, 255, 255, // Coordinator.Port: -1
- },
- }, {
- desc: "version 1 - error",
- response: &FindCoordinatorResponse{
- Version: 1,
- ThrottleTime: 100 * time.Millisecond,
- Err: ErrConsumerCoordinatorNotAvailable,
- ErrMsg: &errMsg,
- Coordinator: NoNode,
- },
- encoded: []byte{
- 0, 0, 0, 100, // ThrottleTime
- 0, 15, // Err
- 0, 6, 'k', 'a', 'b', 'o', 'o', 'm', // ErrMsg
- 255, 255, 255, 255, // Coordinator.ID: -1
- 0, 0, // Coordinator.Host: ""
- 255, 255, 255, 255, // Coordinator.Port: -1
- },
- }} {
- testResponse(t, tc.desc, tc.response, tc.encoded)
- }
-}
diff --git a/vendor/github.com/Shopify/sarama/functional_client_test.go b/vendor/github.com/Shopify/sarama/functional_client_test.go
deleted file mode 100644
index 2bf99d252..000000000
--- a/vendor/github.com/Shopify/sarama/functional_client_test.go
+++ /dev/null
@@ -1,90 +0,0 @@
-package sarama
-
-import (
- "fmt"
- "testing"
- "time"
-)
-
-func TestFuncConnectionFailure(t *testing.T) {
- setupFunctionalTest(t)
- defer teardownFunctionalTest(t)
-
- Proxies["kafka1"].Enabled = false
- SaveProxy(t, "kafka1")
-
- config := NewConfig()
- config.Metadata.Retry.Max = 1
-
- _, err := NewClient([]string{kafkaBrokers[0]}, config)
- if err != ErrOutOfBrokers {
- t.Fatal("Expected returned error to be ErrOutOfBrokers, but was: ", err)
- }
-}
-
-func TestFuncClientMetadata(t *testing.T) {
- setupFunctionalTest(t)
- defer teardownFunctionalTest(t)
-
- config := NewConfig()
- config.Metadata.Retry.Max = 1
- config.Metadata.Retry.Backoff = 10 * time.Millisecond
- client, err := NewClient(kafkaBrokers, config)
- if err != nil {
- t.Fatal(err)
- }
-
- if err := client.RefreshMetadata("unknown_topic"); err != ErrUnknownTopicOrPartition {
- t.Error("Expected ErrUnknownTopicOrPartition, got", err)
- }
-
- if _, err := client.Leader("unknown_topic", 0); err != ErrUnknownTopicOrPartition {
- t.Error("Expected ErrUnknownTopicOrPartition, got", err)
- }
-
- if _, err := client.Replicas("invalid/topic", 0); err != ErrUnknownTopicOrPartition {
- t.Error("Expected ErrUnknownTopicOrPartition, got", err)
- }
-
- partitions, err := client.Partitions("test.4")
- if err != nil {
- t.Error(err)
- }
- if len(partitions) != 4 {
- t.Errorf("Expected test.4 topic to have 4 partitions, found %v", partitions)
- }
-
- partitions, err = client.Partitions("test.1")
- if err != nil {
- t.Error(err)
- }
- if len(partitions) != 1 {
- t.Errorf("Expected test.1 topic to have 1 partitions, found %v", partitions)
- }
-
- safeClose(t, client)
-}
-
-func TestFuncClientCoordinator(t *testing.T) {
- checkKafkaVersion(t, "0.8.2")
- setupFunctionalTest(t)
- defer teardownFunctionalTest(t)
-
- client, err := NewClient(kafkaBrokers, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- for i := 0; i < 10; i++ {
- broker, err := client.Coordinator(fmt.Sprintf("another_new_consumer_group_%d", i))
- if err != nil {
- t.Fatal(err)
- }
-
- if connected, err := broker.Connected(); !connected || err != nil {
- t.Errorf("Expected to coordinator %s broker to be properly connected.", broker.Addr())
- }
- }
-
- safeClose(t, client)
-}
diff --git a/vendor/github.com/Shopify/sarama/functional_consumer_test.go b/vendor/github.com/Shopify/sarama/functional_consumer_test.go
deleted file mode 100644
index 83bec0331..000000000
--- a/vendor/github.com/Shopify/sarama/functional_consumer_test.go
+++ /dev/null
@@ -1,226 +0,0 @@
-package sarama
-
-import (
- "fmt"
- "math"
- "os"
- "sort"
- "sync"
- "testing"
- "time"
-)
-
-func TestFuncConsumerOffsetOutOfRange(t *testing.T) {
- setupFunctionalTest(t)
- defer teardownFunctionalTest(t)
-
- consumer, err := NewConsumer(kafkaBrokers, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- if _, err := consumer.ConsumePartition("test.1", 0, -10); err != ErrOffsetOutOfRange {
- t.Error("Expected ErrOffsetOutOfRange, got:", err)
- }
-
- if _, err := consumer.ConsumePartition("test.1", 0, math.MaxInt64); err != ErrOffsetOutOfRange {
- t.Error("Expected ErrOffsetOutOfRange, got:", err)
- }
-
- safeClose(t, consumer)
-}
-
-func TestConsumerHighWaterMarkOffset(t *testing.T) {
- setupFunctionalTest(t)
- defer teardownFunctionalTest(t)
-
- p, err := NewSyncProducer(kafkaBrokers, nil)
- if err != nil {
- t.Fatal(err)
- }
- defer safeClose(t, p)
-
- _, offset, err := p.SendMessage(&ProducerMessage{Topic: "test.1", Value: StringEncoder("Test")})
- if err != nil {
- t.Fatal(err)
- }
-
- c, err := NewConsumer(kafkaBrokers, nil)
- if err != nil {
- t.Fatal(err)
- }
- defer safeClose(t, c)
-
- pc, err := c.ConsumePartition("test.1", 0, offset)
- if err != nil {
- t.Fatal(err)
- }
-
- <-pc.Messages()
-
- if hwmo := pc.HighWaterMarkOffset(); hwmo != offset+1 {
- t.Logf("Last produced offset %d; high water mark should be one higher but found %d.", offset, hwmo)
- }
-
- safeClose(t, pc)
-}
-
-// Makes sure that messages produced by all supported client versions/
-// compression codecs (except LZ4) combinations can be consumed by all
-// supported consumer versions. It relies on the KAFKA_VERSION environment
-// variable to provide the version of the test Kafka cluster.
-//
-// Note that LZ4 codec was introduced in v0.10.0.0 and therefore is excluded
-// from this test case. It has a similar version matrix test case below that
-// only checks versions from v0.10.0.0 until KAFKA_VERSION.
-func TestVersionMatrix(t *testing.T) {
- setupFunctionalTest(t)
- defer teardownFunctionalTest(t)
-
- // Produce lot's of message with all possible combinations of supported
- // protocol versions and compressions for the except of LZ4.
- testVersions := versionRange(V0_8_2_0)
- allCodecsButLZ4 := []CompressionCodec{CompressionNone, CompressionGZIP, CompressionSnappy}
- producedMessages := produceMsgs(t, testVersions, allCodecsButLZ4, 17, 100)
-
- // When/Then
- consumeMsgs(t, testVersions, producedMessages)
-}
-
-// Support for LZ4 codec was introduced in v0.10.0.0 so a version matrix to
-// test LZ4 should start with v0.10.0.0.
-func TestVersionMatrixLZ4(t *testing.T) {
- setupFunctionalTest(t)
- defer teardownFunctionalTest(t)
-
- // Produce lot's of message with all possible combinations of supported
- // protocol versions starting with v0.10 (first where LZ4 was supported)
- // and all possible compressions.
- testVersions := versionRange(V0_10_0_0)
- allCodecs := []CompressionCodec{CompressionNone, CompressionGZIP, CompressionSnappy, CompressionLZ4}
- producedMessages := produceMsgs(t, testVersions, allCodecs, 17, 100)
-
- // When/Then
- consumeMsgs(t, testVersions, producedMessages)
-}
-
-func prodMsg2Str(prodMsg *ProducerMessage) string {
- return fmt.Sprintf("{offset: %d, value: %s}", prodMsg.Offset, string(prodMsg.Value.(StringEncoder)))
-}
-
-func consMsg2Str(consMsg *ConsumerMessage) string {
- return fmt.Sprintf("{offset: %d, value: %s}", consMsg.Offset, string(consMsg.Value))
-}
-
-func versionRange(lower KafkaVersion) []KafkaVersion {
- // Get the test cluster version from the environment. If there is nothing
- // there then assume the highest.
- upper, err := ParseKafkaVersion(os.Getenv("KAFKA_VERSION"))
- if err != nil {
- upper = MaxVersion
- }
-
- versions := make([]KafkaVersion, 0, len(SupportedVersions))
- for _, v := range SupportedVersions {
- if !v.IsAtLeast(lower) {
- continue
- }
- if !upper.IsAtLeast(v) {
- return versions
- }
- versions = append(versions, v)
- }
- return versions
-}
-
-func produceMsgs(t *testing.T, clientVersions []KafkaVersion, codecs []CompressionCodec, flush int, countPerVerCodec int) []*ProducerMessage {
- var wg sync.WaitGroup
- var producedMessagesMu sync.Mutex
- var producedMessages []*ProducerMessage
- for _, prodVer := range clientVersions {
- for _, codec := range codecs {
- prodCfg := NewConfig()
- prodCfg.Version = prodVer
- prodCfg.Producer.Return.Successes = true
- prodCfg.Producer.Return.Errors = true
- prodCfg.Producer.Flush.MaxMessages = flush
- prodCfg.Producer.Compression = codec
-
- p, err := NewSyncProducer(kafkaBrokers, prodCfg)
- if err != nil {
- t.Errorf("Failed to create producer: version=%s, compression=%s, err=%v", prodVer, codec, err)
- continue
- }
- defer safeClose(t, p)
- for i := 0; i < countPerVerCodec; i++ {
- msg := &ProducerMessage{
- Topic: "test.1",
- Value: StringEncoder(fmt.Sprintf("msg:%s:%s:%d", prodVer, codec, i)),
- }
- wg.Add(1)
- go func() {
- defer wg.Done()
- _, _, err := p.SendMessage(msg)
- if err != nil {
- t.Errorf("Failed to produce message: %s, err=%v", msg.Value, err)
- }
- producedMessagesMu.Lock()
- producedMessages = append(producedMessages, msg)
- producedMessagesMu.Unlock()
- }()
- }
- }
- }
- wg.Wait()
-
- // Sort produced message in ascending offset order.
- sort.Slice(producedMessages, func(i, j int) bool {
- return producedMessages[i].Offset < producedMessages[j].Offset
- })
- t.Logf("*** Total produced %d, firstOffset=%d, lastOffset=%d\n",
- len(producedMessages), producedMessages[0].Offset, producedMessages[len(producedMessages)-1].Offset)
- return producedMessages
-}
-
-func consumeMsgs(t *testing.T, clientVersions []KafkaVersion, producedMessages []*ProducerMessage) {
- // Consume all produced messages with all client versions supported by the
- // cluster.
-consumerVersionLoop:
- for _, consVer := range clientVersions {
- t.Logf("*** Consuming with client version %s\n", consVer)
- // Create a partition consumer that should start from the first produced
- // message.
- consCfg := NewConfig()
- consCfg.Version = consVer
- c, err := NewConsumer(kafkaBrokers, consCfg)
- if err != nil {
- t.Fatal(err)
- }
- defer safeClose(t, c)
- pc, err := c.ConsumePartition("test.1", 0, producedMessages[0].Offset)
- if err != nil {
- t.Fatal(err)
- }
- defer safeClose(t, pc)
-
- // Consume as many messages as there have been produced and make sure that
- // order is preserved.
- for i, prodMsg := range producedMessages {
- select {
- case consMsg := <-pc.Messages():
- if consMsg.Offset != prodMsg.Offset {
- t.Errorf("Consumed unexpected offset: version=%s, index=%d, want=%s, got=%s",
- consVer, i, prodMsg2Str(prodMsg), consMsg2Str(consMsg))
- continue consumerVersionLoop
- }
- if string(consMsg.Value) != string(prodMsg.Value.(StringEncoder)) {
- t.Errorf("Consumed unexpected msg: version=%s, index=%d, want=%s, got=%s",
- consVer, i, prodMsg2Str(prodMsg), consMsg2Str(consMsg))
- continue consumerVersionLoop
- }
- case <-time.After(3 * time.Second):
- t.Fatalf("Timeout waiting for: index=%d, offset=%d, msg=%s", i, prodMsg.Offset, prodMsg.Value)
- }
- }
- }
-}
diff --git a/vendor/github.com/Shopify/sarama/functional_offset_manager_test.go b/vendor/github.com/Shopify/sarama/functional_offset_manager_test.go
deleted file mode 100644
index 436f35ef4..000000000
--- a/vendor/github.com/Shopify/sarama/functional_offset_manager_test.go
+++ /dev/null
@@ -1,47 +0,0 @@
-package sarama
-
-import (
- "testing"
-)
-
-func TestFuncOffsetManager(t *testing.T) {
- checkKafkaVersion(t, "0.8.2")
- setupFunctionalTest(t)
- defer teardownFunctionalTest(t)
-
- client, err := NewClient(kafkaBrokers, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- offsetManager, err := NewOffsetManagerFromClient("sarama.TestFuncOffsetManager", client)
- if err != nil {
- t.Fatal(err)
- }
-
- pom1, err := offsetManager.ManagePartition("test.1", 0)
- if err != nil {
- t.Fatal(err)
- }
-
- pom1.MarkOffset(10, "test metadata")
- safeClose(t, pom1)
-
- pom2, err := offsetManager.ManagePartition("test.1", 0)
- if err != nil {
- t.Fatal(err)
- }
-
- offset, metadata := pom2.NextOffset()
-
- if offset != 10 {
- t.Errorf("Expected the next offset to be 10, found %d.", offset)
- }
- if metadata != "test metadata" {
- t.Errorf("Expected metadata to be 'test metadata', found %s.", metadata)
- }
-
- safeClose(t, pom2)
- safeClose(t, offsetManager)
- safeClose(t, client)
-}
diff --git a/vendor/github.com/Shopify/sarama/functional_producer_test.go b/vendor/github.com/Shopify/sarama/functional_producer_test.go
deleted file mode 100644
index 91bf3b5ee..000000000
--- a/vendor/github.com/Shopify/sarama/functional_producer_test.go
+++ /dev/null
@@ -1,323 +0,0 @@
-package sarama
-
-import (
- "fmt"
- "os"
- "sync"
- "testing"
- "time"
-
- toxiproxy "github.com/Shopify/toxiproxy/client"
- "github.com/rcrowley/go-metrics"
-)
-
-const TestBatchSize = 1000
-
-func TestFuncProducing(t *testing.T) {
- config := NewConfig()
- testProducingMessages(t, config)
-}
-
-func TestFuncProducingGzip(t *testing.T) {
- config := NewConfig()
- config.Producer.Compression = CompressionGZIP
- testProducingMessages(t, config)
-}
-
-func TestFuncProducingSnappy(t *testing.T) {
- config := NewConfig()
- config.Producer.Compression = CompressionSnappy
- testProducingMessages(t, config)
-}
-
-func TestFuncProducingNoResponse(t *testing.T) {
- config := NewConfig()
- config.Producer.RequiredAcks = NoResponse
- testProducingMessages(t, config)
-}
-
-func TestFuncProducingFlushing(t *testing.T) {
- config := NewConfig()
- config.Producer.Flush.Messages = TestBatchSize / 8
- config.Producer.Flush.Frequency = 250 * time.Millisecond
- testProducingMessages(t, config)
-}
-
-func TestFuncMultiPartitionProduce(t *testing.T) {
- setupFunctionalTest(t)
- defer teardownFunctionalTest(t)
-
- config := NewConfig()
- config.ChannelBufferSize = 20
- config.Producer.Flush.Frequency = 50 * time.Millisecond
- config.Producer.Flush.Messages = 200
- config.Producer.Return.Successes = true
- producer, err := NewSyncProducer(kafkaBrokers, config)
- if err != nil {
- t.Fatal(err)
- }
-
- var wg sync.WaitGroup
- wg.Add(TestBatchSize)
-
- for i := 1; i <= TestBatchSize; i++ {
- go func(i int) {
- defer wg.Done()
- msg := &ProducerMessage{Topic: "test.64", Key: nil, Value: StringEncoder(fmt.Sprintf("hur %d", i))}
- if _, _, err := producer.SendMessage(msg); err != nil {
- t.Error(i, err)
- }
- }(i)
- }
-
- wg.Wait()
- if err := producer.Close(); err != nil {
- t.Error(err)
- }
-}
-
-func TestFuncProducingToInvalidTopic(t *testing.T) {
- setupFunctionalTest(t)
- defer teardownFunctionalTest(t)
-
- producer, err := NewSyncProducer(kafkaBrokers, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- if _, _, err := producer.SendMessage(&ProducerMessage{Topic: "in/valid"}); err != ErrUnknownTopicOrPartition {
- t.Error("Expected ErrUnknownTopicOrPartition, found", err)
- }
-
- if _, _, err := producer.SendMessage(&ProducerMessage{Topic: "in/valid"}); err != ErrUnknownTopicOrPartition {
- t.Error("Expected ErrUnknownTopicOrPartition, found", err)
- }
-
- safeClose(t, producer)
-}
-
-func testProducingMessages(t *testing.T, config *Config) {
- setupFunctionalTest(t)
- defer teardownFunctionalTest(t)
-
- // Configure some latency in order to properly validate the request latency metric
- for _, proxy := range Proxies {
- if _, err := proxy.AddToxic("", "latency", "", 1, toxiproxy.Attributes{"latency": 10}); err != nil {
- t.Fatal("Unable to configure latency toxicity", err)
- }
- }
-
- config.Producer.Return.Successes = true
- config.Consumer.Return.Errors = true
-
- client, err := NewClient(kafkaBrokers, config)
- if err != nil {
- t.Fatal(err)
- }
-
- // Keep in mind the current offset
- initialOffset, err := client.GetOffset("test.1", 0, OffsetNewest)
- if err != nil {
- t.Fatal(err)
- }
-
- producer, err := NewAsyncProducerFromClient(client)
- if err != nil {
- t.Fatal(err)
- }
-
- expectedResponses := TestBatchSize
- for i := 1; i <= TestBatchSize; {
- msg := &ProducerMessage{Topic: "test.1", Key: nil, Value: StringEncoder(fmt.Sprintf("testing %d", i))}
- select {
- case producer.Input() <- msg:
- i++
- case ret := <-producer.Errors():
- t.Fatal(ret.Err)
- case <-producer.Successes():
- expectedResponses--
- }
- }
- for expectedResponses > 0 {
- select {
- case ret := <-producer.Errors():
- t.Fatal(ret.Err)
- case <-producer.Successes():
- expectedResponses--
- }
- }
- safeClose(t, producer)
-
- // Validate producer metrics before using the consumer minus the offset request
- validateMetrics(t, client)
-
- master, err := NewConsumerFromClient(client)
- if err != nil {
- t.Fatal(err)
- }
- consumer, err := master.ConsumePartition("test.1", 0, initialOffset)
- if err != nil {
- t.Fatal(err)
- }
-
- for i := 1; i <= TestBatchSize; i++ {
- select {
- case <-time.After(10 * time.Second):
- t.Fatal("Not received any more events in the last 10 seconds.")
-
- case err := <-consumer.Errors():
- t.Error(err)
-
- case message := <-consumer.Messages():
- if string(message.Value) != fmt.Sprintf("testing %d", i) {
- t.Fatalf("Unexpected message with index %d: %s", i, message.Value)
- }
- }
-
- }
- safeClose(t, consumer)
- safeClose(t, client)
-}
-
-func validateMetrics(t *testing.T, client Client) {
- // Get the broker used by test1 topic
- var broker *Broker
- if partitions, err := client.Partitions("test.1"); err != nil {
- t.Error(err)
- } else {
- for _, partition := range partitions {
- if b, err := client.Leader("test.1", partition); err != nil {
- t.Error(err)
- } else {
- if broker != nil && b != broker {
- t.Fatal("Expected only one broker, got at least 2")
- }
- broker = b
- }
- }
- }
-
- metricValidators := newMetricValidators()
- noResponse := client.Config().Producer.RequiredAcks == NoResponse
- compressionEnabled := client.Config().Producer.Compression != CompressionNone
-
- // We are adding 10ms of latency to all requests with toxiproxy
- minRequestLatencyInMs := 10
- if noResponse {
- // but when we do not wait for a response it can be less than 1ms
- minRequestLatencyInMs = 0
- }
-
- // We read at least 1 byte from the broker
- metricValidators.registerForAllBrokers(broker, minCountMeterValidator("incoming-byte-rate", 1))
- // in at least 3 global requests (1 for metadata request, 1 for offset request and N for produce request)
- metricValidators.register(minCountMeterValidator("request-rate", 3))
- metricValidators.register(minCountHistogramValidator("request-size", 3))
- metricValidators.register(minValHistogramValidator("request-size", 1))
- metricValidators.register(minValHistogramValidator("request-latency-in-ms", minRequestLatencyInMs))
- // and at least 2 requests to the registered broker (offset + produces)
- metricValidators.registerForBroker(broker, minCountMeterValidator("request-rate", 2))
- metricValidators.registerForBroker(broker, minCountHistogramValidator("request-size", 2))
- metricValidators.registerForBroker(broker, minValHistogramValidator("request-size", 1))
- metricValidators.registerForBroker(broker, minValHistogramValidator("request-latency-in-ms", minRequestLatencyInMs))
-
- // We send at least 1 batch
- metricValidators.registerForGlobalAndTopic("test_1", minCountHistogramValidator("batch-size", 1))
- metricValidators.registerForGlobalAndTopic("test_1", minValHistogramValidator("batch-size", 1))
- if compressionEnabled {
- // We record compression ratios between [0.50,-10.00] (50-1000 with a histogram) for at least one "fake" record
- metricValidators.registerForGlobalAndTopic("test_1", minCountHistogramValidator("compression-ratio", 1))
- metricValidators.registerForGlobalAndTopic("test_1", minValHistogramValidator("compression-ratio", 50))
- metricValidators.registerForGlobalAndTopic("test_1", maxValHistogramValidator("compression-ratio", 1000))
- } else {
- // We record compression ratios of 1.00 (100 with a histogram) for every TestBatchSize record
- metricValidators.registerForGlobalAndTopic("test_1", countHistogramValidator("compression-ratio", TestBatchSize))
- metricValidators.registerForGlobalAndTopic("test_1", minValHistogramValidator("compression-ratio", 100))
- metricValidators.registerForGlobalAndTopic("test_1", maxValHistogramValidator("compression-ratio", 100))
- }
-
- // We send exactly TestBatchSize messages
- metricValidators.registerForGlobalAndTopic("test_1", countMeterValidator("record-send-rate", TestBatchSize))
- // We send at least one record per request
- metricValidators.registerForGlobalAndTopic("test_1", minCountHistogramValidator("records-per-request", 1))
- metricValidators.registerForGlobalAndTopic("test_1", minValHistogramValidator("records-per-request", 1))
-
- // We receive at least 1 byte from the broker
- metricValidators.registerForAllBrokers(broker, minCountMeterValidator("outgoing-byte-rate", 1))
- if noResponse {
- // in exactly 2 global responses (metadata + offset)
- metricValidators.register(countMeterValidator("response-rate", 2))
- metricValidators.register(minCountHistogramValidator("response-size", 2))
- metricValidators.register(minValHistogramValidator("response-size", 1))
- // and exactly 1 offset response for the registered broker
- metricValidators.registerForBroker(broker, countMeterValidator("response-rate", 1))
- metricValidators.registerForBroker(broker, minCountHistogramValidator("response-size", 1))
- metricValidators.registerForBroker(broker, minValHistogramValidator("response-size", 1))
- } else {
- // in at least 3 global responses (metadata + offset + produces)
- metricValidators.register(minCountMeterValidator("response-rate", 3))
- metricValidators.register(minCountHistogramValidator("response-size", 3))
- metricValidators.register(minValHistogramValidator("response-size", 1))
- // and at least 2 for the registered broker
- metricValidators.registerForBroker(broker, minCountMeterValidator("response-rate", 2))
- metricValidators.registerForBroker(broker, minCountHistogramValidator("response-size", 2))
- metricValidators.registerForBroker(broker, minValHistogramValidator("response-size", 1))
- }
-
- // Run the validators
- metricValidators.run(t, client.Config().MetricRegistry)
-}
-
-// Benchmarks
-
-func BenchmarkProducerSmall(b *testing.B) {
- benchmarkProducer(b, nil, "test.64", ByteEncoder(make([]byte, 128)))
-}
-func BenchmarkProducerMedium(b *testing.B) {
- benchmarkProducer(b, nil, "test.64", ByteEncoder(make([]byte, 1024)))
-}
-func BenchmarkProducerLarge(b *testing.B) {
- benchmarkProducer(b, nil, "test.64", ByteEncoder(make([]byte, 8192)))
-}
-func BenchmarkProducerSmallSinglePartition(b *testing.B) {
- benchmarkProducer(b, nil, "test.1", ByteEncoder(make([]byte, 128)))
-}
-func BenchmarkProducerMediumSnappy(b *testing.B) {
- conf := NewConfig()
- conf.Producer.Compression = CompressionSnappy
- benchmarkProducer(b, conf, "test.1", ByteEncoder(make([]byte, 1024)))
-}
-
-func benchmarkProducer(b *testing.B, conf *Config, topic string, value Encoder) {
- setupFunctionalTest(b)
- defer teardownFunctionalTest(b)
-
- metricsDisable := os.Getenv("METRICS_DISABLE")
- if metricsDisable != "" {
- previousUseNilMetrics := metrics.UseNilMetrics
- Logger.Println("Disabling metrics using no-op implementation")
- metrics.UseNilMetrics = true
- // Restore previous setting
- defer func() {
- metrics.UseNilMetrics = previousUseNilMetrics
- }()
- }
-
- producer, err := NewAsyncProducer(kafkaBrokers, conf)
- if err != nil {
- b.Fatal(err)
- }
-
- b.ResetTimer()
-
- for i := 1; i <= b.N; {
- msg := &ProducerMessage{Topic: topic, Key: StringEncoder(fmt.Sprintf("%d", i)), Value: value}
- select {
- case producer.Input() <- msg:
- i++
- case ret := <-producer.Errors():
- b.Fatal(ret.Err)
- }
- }
- safeClose(b, producer)
-}
diff --git a/vendor/github.com/Shopify/sarama/functional_test.go b/vendor/github.com/Shopify/sarama/functional_test.go
deleted file mode 100644
index 846eb29f9..000000000
--- a/vendor/github.com/Shopify/sarama/functional_test.go
+++ /dev/null
@@ -1,148 +0,0 @@
-package sarama
-
-import (
- "log"
- "math/rand"
- "net"
- "os"
- "strconv"
- "strings"
- "testing"
- "time"
-
- toxiproxy "github.com/Shopify/toxiproxy/client"
-)
-
-const (
- VagrantToxiproxy = "http://192.168.100.67:8474"
- VagrantKafkaPeers = "192.168.100.67:9091,192.168.100.67:9092,192.168.100.67:9093,192.168.100.67:9094,192.168.100.67:9095"
- VagrantZookeeperPeers = "192.168.100.67:2181,192.168.100.67:2182,192.168.100.67:2183,192.168.100.67:2184,192.168.100.67:2185"
-)
-
-var (
- kafkaAvailable, kafkaRequired bool
- kafkaBrokers []string
-
- proxyClient *toxiproxy.Client
- Proxies map[string]*toxiproxy.Proxy
- ZKProxies = []string{"zk1", "zk2", "zk3", "zk4", "zk5"}
- KafkaProxies = []string{"kafka1", "kafka2", "kafka3", "kafka4", "kafka5"}
-)
-
-func init() {
- if os.Getenv("DEBUG") == "true" {
- Logger = log.New(os.Stdout, "[sarama] ", log.LstdFlags)
- }
-
- seed := time.Now().UTC().UnixNano()
- if tmp := os.Getenv("TEST_SEED"); tmp != "" {
- seed, _ = strconv.ParseInt(tmp, 0, 64)
- }
- Logger.Println("Using random seed:", seed)
- rand.Seed(seed)
-
- proxyAddr := os.Getenv("TOXIPROXY_ADDR")
- if proxyAddr == "" {
- proxyAddr = VagrantToxiproxy
- }
- proxyClient = toxiproxy.NewClient(proxyAddr)
-
- kafkaPeers := os.Getenv("KAFKA_PEERS")
- if kafkaPeers == "" {
- kafkaPeers = VagrantKafkaPeers
- }
- kafkaBrokers = strings.Split(kafkaPeers, ",")
-
- if c, err := net.DialTimeout("tcp", kafkaBrokers[0], 5*time.Second); err == nil {
- if err = c.Close(); err == nil {
- kafkaAvailable = true
- }
- }
-
- kafkaRequired = os.Getenv("CI") != ""
-}
-
-func checkKafkaAvailability(t testing.TB) {
- if !kafkaAvailable {
- if kafkaRequired {
- t.Fatalf("Kafka broker is not available on %s. Set KAFKA_PEERS to connect to Kafka on a different location.", kafkaBrokers[0])
- } else {
- t.Skipf("Kafka broker is not available on %s. Set KAFKA_PEERS to connect to Kafka on a different location.", kafkaBrokers[0])
- }
- }
-}
-
-func checkKafkaVersion(t testing.TB, requiredVersion string) {
- kafkaVersion := os.Getenv("KAFKA_VERSION")
- if kafkaVersion == "" {
- t.Logf("No KAFKA_VERSION set. This test requires Kafka version %s or higher. Continuing...", requiredVersion)
- } else {
- available := parseKafkaVersion(kafkaVersion)
- required := parseKafkaVersion(requiredVersion)
- if !available.satisfies(required) {
- t.Skipf("Kafka version %s is required for this test; you have %s. Skipping...", requiredVersion, kafkaVersion)
- }
- }
-}
-
-func resetProxies(t testing.TB) {
- if err := proxyClient.ResetState(); err != nil {
- t.Error(err)
- }
- Proxies = nil
-}
-
-func fetchProxies(t testing.TB) {
- var err error
- Proxies, err = proxyClient.Proxies()
- if err != nil {
- t.Fatal(err)
- }
-}
-
-func SaveProxy(t *testing.T, px string) {
- if err := Proxies[px].Save(); err != nil {
- t.Fatal(err)
- }
-}
-
-func setupFunctionalTest(t testing.TB) {
- checkKafkaAvailability(t)
- resetProxies(t)
- fetchProxies(t)
-}
-
-func teardownFunctionalTest(t testing.TB) {
- resetProxies(t)
-}
-
-type kafkaVersion []int
-
-func (kv kafkaVersion) satisfies(other kafkaVersion) bool {
- var ov int
- for index, v := range kv {
- if len(other) <= index {
- ov = 0
- } else {
- ov = other[index]
- }
-
- if v < ov {
- return false
- } else if v > ov {
- return true
- }
- }
- return true
-}
-
-func parseKafkaVersion(version string) kafkaVersion {
- numbers := strings.Split(version, ".")
- result := make(kafkaVersion, 0, len(numbers))
- for _, number := range numbers {
- nr, _ := strconv.Atoi(number)
- result = append(result, nr)
- }
-
- return result
-}
diff --git a/vendor/github.com/Shopify/sarama/heartbeat_request_test.go b/vendor/github.com/Shopify/sarama/heartbeat_request_test.go
deleted file mode 100644
index da6cd18f5..000000000
--- a/vendor/github.com/Shopify/sarama/heartbeat_request_test.go
+++ /dev/null
@@ -1,21 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- basicHeartbeatRequest = []byte{
- 0, 3, 'f', 'o', 'o', // Group ID
- 0x00, 0x01, 0x02, 0x03, // Generatiuon ID
- 0, 3, 'b', 'a', 'z', // Member ID
- }
-)
-
-func TestHeartbeatRequest(t *testing.T) {
- var request *HeartbeatRequest
-
- request = new(HeartbeatRequest)
- request.GroupId = "foo"
- request.GenerationId = 66051
- request.MemberId = "baz"
- testRequest(t, "basic", request, basicHeartbeatRequest)
-}
diff --git a/vendor/github.com/Shopify/sarama/heartbeat_response_test.go b/vendor/github.com/Shopify/sarama/heartbeat_response_test.go
deleted file mode 100644
index 5bcbec985..000000000
--- a/vendor/github.com/Shopify/sarama/heartbeat_response_test.go
+++ /dev/null
@@ -1,18 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- heartbeatResponseNoError = []byte{
- 0x00, 0x00}
-)
-
-func TestHeartbeatResponse(t *testing.T) {
- var response *HeartbeatResponse
-
- response = new(HeartbeatResponse)
- testVersionDecodable(t, "no error", response, heartbeatResponseNoError, 0)
- if response.Err != ErrNoError {
- t.Error("Decoding error failed: no error expected but found", response.Err)
- }
-}
diff --git a/vendor/github.com/Shopify/sarama/init_producer_id_request_test.go b/vendor/github.com/Shopify/sarama/init_producer_id_request_test.go
deleted file mode 100644
index 5c83d8514..000000000
--- a/vendor/github.com/Shopify/sarama/init_producer_id_request_test.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package sarama
-
-import (
- "testing"
- "time"
-)
-
-var (
- initProducerIDRequestNull = []byte{
- 255, 255,
- 0, 0, 0, 100,
- }
-
- initProducerIDRequest = []byte{
- 0, 3, 't', 'x', 'n',
- 0, 0, 0, 100,
- }
-)
-
-func TestInitProducerIDRequest(t *testing.T) {
- req := &InitProducerIDRequest{
- TransactionTimeout: 100 * time.Millisecond,
- }
-
- testRequest(t, "null transaction id", req, initProducerIDRequestNull)
-
- transactionID := "txn"
- req.TransactionalID = &transactionID
-
- testRequest(t, "transaction id", req, initProducerIDRequest)
-}
diff --git a/vendor/github.com/Shopify/sarama/init_producer_id_response_test.go b/vendor/github.com/Shopify/sarama/init_producer_id_response_test.go
deleted file mode 100644
index b0649386a..000000000
--- a/vendor/github.com/Shopify/sarama/init_producer_id_response_test.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package sarama
-
-import (
- "testing"
- "time"
-)
-
-var (
- initProducerIDResponse = []byte{
- 0, 0, 0, 100,
- 0, 0,
- 0, 0, 0, 0, 0, 0, 31, 64, // producerID = 8000
- 0, 0, // epoch
- }
-
- initProducerIDRequestError = []byte{
- 0, 0, 0, 100,
- 0, 51,
- 255, 255, 255, 255, 255, 255, 255, 255,
- 0, 0,
- }
-)
-
-func TestInitProducerIDResponse(t *testing.T) {
- resp := &InitProducerIDResponse{
- ThrottleTime: 100 * time.Millisecond,
- ProducerID: 8000,
- ProducerEpoch: 0,
- }
-
- testResponse(t, "", resp, initProducerIDResponse)
-
- resp.Err = ErrConcurrentTransactions
- resp.ProducerID = -1
-
- testResponse(t, "with error", resp, initProducerIDRequestError)
-}
diff --git a/vendor/github.com/Shopify/sarama/join_group_request_test.go b/vendor/github.com/Shopify/sarama/join_group_request_test.go
deleted file mode 100644
index a2e17f980..000000000
--- a/vendor/github.com/Shopify/sarama/join_group_request_test.go
+++ /dev/null
@@ -1,83 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- joinGroupRequestV0_NoProtocols = []byte{
- 0, 9, 'T', 'e', 's', 't', 'G', 'r', 'o', 'u', 'p', // Group ID
- 0, 0, 0, 100, // Session timeout
- 0, 0, // Member ID
- 0, 8, 'c', 'o', 'n', 's', 'u', 'm', 'e', 'r', // Protocol Type
- 0, 0, 0, 0, // 0 protocol groups
- }
-
- joinGroupRequestV0_OneProtocol = []byte{
- 0, 9, 'T', 'e', 's', 't', 'G', 'r', 'o', 'u', 'p', // Group ID
- 0, 0, 0, 100, // Session timeout
- 0, 11, 'O', 'n', 'e', 'P', 'r', 'o', 't', 'o', 'c', 'o', 'l', // Member ID
- 0, 8, 'c', 'o', 'n', 's', 'u', 'm', 'e', 'r', // Protocol Type
- 0, 0, 0, 1, // 1 group protocol
- 0, 3, 'o', 'n', 'e', // Protocol name
- 0, 0, 0, 3, 0x01, 0x02, 0x03, // protocol metadata
- }
-
- joinGroupRequestV1 = []byte{
- 0, 9, 'T', 'e', 's', 't', 'G', 'r', 'o', 'u', 'p', // Group ID
- 0, 0, 0, 100, // Session timeout
- 0, 0, 0, 200, // Rebalance timeout
- 0, 11, 'O', 'n', 'e', 'P', 'r', 'o', 't', 'o', 'c', 'o', 'l', // Member ID
- 0, 8, 'c', 'o', 'n', 's', 'u', 'm', 'e', 'r', // Protocol Type
- 0, 0, 0, 1, // 1 group protocol
- 0, 3, 'o', 'n', 'e', // Protocol name
- 0, 0, 0, 3, 0x01, 0x02, 0x03, // protocol metadata
- }
-)
-
-func TestJoinGroupRequest(t *testing.T) {
- request := new(JoinGroupRequest)
- request.GroupId = "TestGroup"
- request.SessionTimeout = 100
- request.ProtocolType = "consumer"
- testRequest(t, "V0: no protocols", request, joinGroupRequestV0_NoProtocols)
-}
-
-func TestJoinGroupRequestV0_OneProtocol(t *testing.T) {
- request := new(JoinGroupRequest)
- request.GroupId = "TestGroup"
- request.SessionTimeout = 100
- request.MemberId = "OneProtocol"
- request.ProtocolType = "consumer"
- request.AddGroupProtocol("one", []byte{0x01, 0x02, 0x03})
- packet := testRequestEncode(t, "V0: one protocol", request, joinGroupRequestV0_OneProtocol)
- request.GroupProtocols = make(map[string][]byte)
- request.GroupProtocols["one"] = []byte{0x01, 0x02, 0x03}
- testRequestDecode(t, "V0: one protocol", request, packet)
-}
-
-func TestJoinGroupRequestDeprecatedEncode(t *testing.T) {
- request := new(JoinGroupRequest)
- request.GroupId = "TestGroup"
- request.SessionTimeout = 100
- request.MemberId = "OneProtocol"
- request.ProtocolType = "consumer"
- request.GroupProtocols = make(map[string][]byte)
- request.GroupProtocols["one"] = []byte{0x01, 0x02, 0x03}
- packet := testRequestEncode(t, "V0: one protocol", request, joinGroupRequestV0_OneProtocol)
- request.AddGroupProtocol("one", []byte{0x01, 0x02, 0x03})
- testRequestDecode(t, "V0: one protocol", request, packet)
-}
-
-func TestJoinGroupRequestV1(t *testing.T) {
- request := new(JoinGroupRequest)
- request.Version = 1
- request.GroupId = "TestGroup"
- request.SessionTimeout = 100
- request.RebalanceTimeout = 200
- request.MemberId = "OneProtocol"
- request.ProtocolType = "consumer"
- request.AddGroupProtocol("one", []byte{0x01, 0x02, 0x03})
- packet := testRequestEncode(t, "V1", request, joinGroupRequestV1)
- request.GroupProtocols = make(map[string][]byte)
- request.GroupProtocols["one"] = []byte{0x01, 0x02, 0x03}
- testRequestDecode(t, "V1", request, packet)
-}
diff --git a/vendor/github.com/Shopify/sarama/join_group_response_test.go b/vendor/github.com/Shopify/sarama/join_group_response_test.go
deleted file mode 100644
index a43b37a95..000000000
--- a/vendor/github.com/Shopify/sarama/join_group_response_test.go
+++ /dev/null
@@ -1,172 +0,0 @@
-package sarama
-
-import (
- "reflect"
- "testing"
-)
-
-var (
- joinGroupResponseV0_NoError = []byte{
- 0x00, 0x00, // No error
- 0x00, 0x01, 0x02, 0x03, // Generation ID
- 0, 8, 'p', 'r', 'o', 't', 'o', 'c', 'o', 'l', // Protocol name chosen
- 0, 3, 'f', 'o', 'o', // Leader ID
- 0, 3, 'b', 'a', 'r', // Member ID
- 0, 0, 0, 0, // No member info
- }
-
- joinGroupResponseV0_WithError = []byte{
- 0, 23, // Error: inconsistent group protocol
- 0x00, 0x00, 0x00, 0x00, // Generation ID
- 0, 0, // Protocol name chosen
- 0, 0, // Leader ID
- 0, 0, // Member ID
- 0, 0, 0, 0, // No member info
- }
-
- joinGroupResponseV0_Leader = []byte{
- 0x00, 0x00, // No error
- 0x00, 0x01, 0x02, 0x03, // Generation ID
- 0, 8, 'p', 'r', 'o', 't', 'o', 'c', 'o', 'l', // Protocol name chosen
- 0, 3, 'f', 'o', 'o', // Leader ID
- 0, 3, 'f', 'o', 'o', // Member ID == Leader ID
- 0, 0, 0, 1, // 1 member
- 0, 3, 'f', 'o', 'o', // Member ID
- 0, 0, 0, 3, 0x01, 0x02, 0x03, // Member metadata
- }
-
- joinGroupResponseV1 = []byte{
- 0x00, 0x00, // No error
- 0x00, 0x01, 0x02, 0x03, // Generation ID
- 0, 8, 'p', 'r', 'o', 't', 'o', 'c', 'o', 'l', // Protocol name chosen
- 0, 3, 'f', 'o', 'o', // Leader ID
- 0, 3, 'b', 'a', 'r', // Member ID
- 0, 0, 0, 0, // No member info
- }
-
- joinGroupResponseV2 = []byte{
- 0, 0, 0, 100,
- 0x00, 0x00, // No error
- 0x00, 0x01, 0x02, 0x03, // Generation ID
- 0, 8, 'p', 'r', 'o', 't', 'o', 'c', 'o', 'l', // Protocol name chosen
- 0, 3, 'f', 'o', 'o', // Leader ID
- 0, 3, 'b', 'a', 'r', // Member ID
- 0, 0, 0, 0, // No member info
- }
-)
-
-func TestJoinGroupResponseV0(t *testing.T) {
- var response *JoinGroupResponse
-
- response = new(JoinGroupResponse)
- testVersionDecodable(t, "no error", response, joinGroupResponseV0_NoError, 0)
- if response.Err != ErrNoError {
- t.Error("Decoding Err failed: no error expected but found", response.Err)
- }
- if response.GenerationId != 66051 {
- t.Error("Decoding GenerationId failed, found:", response.GenerationId)
- }
- if response.LeaderId != "foo" {
- t.Error("Decoding LeaderId failed, found:", response.LeaderId)
- }
- if response.MemberId != "bar" {
- t.Error("Decoding MemberId failed, found:", response.MemberId)
- }
- if len(response.Members) != 0 {
- t.Error("Decoding Members failed, found:", response.Members)
- }
-
- response = new(JoinGroupResponse)
- testVersionDecodable(t, "with error", response, joinGroupResponseV0_WithError, 0)
- if response.Err != ErrInconsistentGroupProtocol {
- t.Error("Decoding Err failed: ErrInconsistentGroupProtocol expected but found", response.Err)
- }
- if response.GenerationId != 0 {
- t.Error("Decoding GenerationId failed, found:", response.GenerationId)
- }
- if response.LeaderId != "" {
- t.Error("Decoding LeaderId failed, found:", response.LeaderId)
- }
- if response.MemberId != "" {
- t.Error("Decoding MemberId failed, found:", response.MemberId)
- }
- if len(response.Members) != 0 {
- t.Error("Decoding Members failed, found:", response.Members)
- }
-
- response = new(JoinGroupResponse)
- testVersionDecodable(t, "with error", response, joinGroupResponseV0_Leader, 0)
- if response.Err != ErrNoError {
- t.Error("Decoding Err failed: ErrNoError expected but found", response.Err)
- }
- if response.GenerationId != 66051 {
- t.Error("Decoding GenerationId failed, found:", response.GenerationId)
- }
- if response.LeaderId != "foo" {
- t.Error("Decoding LeaderId failed, found:", response.LeaderId)
- }
- if response.MemberId != "foo" {
- t.Error("Decoding MemberId failed, found:", response.MemberId)
- }
- if len(response.Members) != 1 {
- t.Error("Decoding Members failed, found:", response.Members)
- }
- if !reflect.DeepEqual(response.Members["foo"], []byte{0x01, 0x02, 0x03}) {
- t.Error("Decoding foo member failed, found:", response.Members["foo"])
- }
-}
-
-func TestJoinGroupResponseV1(t *testing.T) {
- response := new(JoinGroupResponse)
- testVersionDecodable(t, "no error", response, joinGroupResponseV1, 1)
- if response.Err != ErrNoError {
- t.Error("Decoding Err failed: no error expected but found", response.Err)
- }
- if response.GenerationId != 66051 {
- t.Error("Decoding GenerationId failed, found:", response.GenerationId)
- }
- if response.GroupProtocol != "protocol" {
- t.Error("Decoding GroupProtocol failed, found:", response.GroupProtocol)
- }
- if response.LeaderId != "foo" {
- t.Error("Decoding LeaderId failed, found:", response.LeaderId)
- }
- if response.MemberId != "bar" {
- t.Error("Decoding MemberId failed, found:", response.MemberId)
- }
- if response.Version != 1 {
- t.Error("Decoding Version failed, found:", response.Version)
- }
- if len(response.Members) != 0 {
- t.Error("Decoding Members failed, found:", response.Members)
- }
-}
-
-func TestJoinGroupResponseV2(t *testing.T) {
- response := new(JoinGroupResponse)
- testVersionDecodable(t, "no error", response, joinGroupResponseV2, 2)
- if response.ThrottleTime != 100 {
- t.Error("Decoding ThrottleTime failed, found:", response.ThrottleTime)
- }
- if response.Err != ErrNoError {
- t.Error("Decoding Err failed: no error expected but found", response.Err)
- }
- if response.GenerationId != 66051 {
- t.Error("Decoding GenerationId failed, found:", response.GenerationId)
- }
- if response.GroupProtocol != "protocol" {
- t.Error("Decoding GroupProtocol failed, found:", response.GroupProtocol)
- }
- if response.LeaderId != "foo" {
- t.Error("Decoding LeaderId failed, found:", response.LeaderId)
- }
- if response.MemberId != "bar" {
- t.Error("Decoding MemberId failed, found:", response.MemberId)
- }
- if response.Version != 2 {
- t.Error("Decoding Version failed, found:", response.Version)
- }
- if len(response.Members) != 0 {
- t.Error("Decoding Members failed, found:", response.Members)
- }
-}
diff --git a/vendor/github.com/Shopify/sarama/leave_group_request_test.go b/vendor/github.com/Shopify/sarama/leave_group_request_test.go
deleted file mode 100644
index c1fed6d25..000000000
--- a/vendor/github.com/Shopify/sarama/leave_group_request_test.go
+++ /dev/null
@@ -1,19 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- basicLeaveGroupRequest = []byte{
- 0, 3, 'f', 'o', 'o',
- 0, 3, 'b', 'a', 'r',
- }
-)
-
-func TestLeaveGroupRequest(t *testing.T) {
- var request *LeaveGroupRequest
-
- request = new(LeaveGroupRequest)
- request.GroupId = "foo"
- request.MemberId = "bar"
- testRequest(t, "basic", request, basicLeaveGroupRequest)
-}
diff --git a/vendor/github.com/Shopify/sarama/leave_group_response_test.go b/vendor/github.com/Shopify/sarama/leave_group_response_test.go
deleted file mode 100644
index 9207c6668..000000000
--- a/vendor/github.com/Shopify/sarama/leave_group_response_test.go
+++ /dev/null
@@ -1,24 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- leaveGroupResponseNoError = []byte{0x00, 0x00}
- leaveGroupResponseWithError = []byte{0, 25}
-)
-
-func TestLeaveGroupResponse(t *testing.T) {
- var response *LeaveGroupResponse
-
- response = new(LeaveGroupResponse)
- testVersionDecodable(t, "no error", response, leaveGroupResponseNoError, 0)
- if response.Err != ErrNoError {
- t.Error("Decoding error failed: no error expected but found", response.Err)
- }
-
- response = new(LeaveGroupResponse)
- testVersionDecodable(t, "with error", response, leaveGroupResponseWithError, 0)
- if response.Err != ErrUnknownMemberId {
- t.Error("Decoding error failed: ErrUnknownMemberId expected but found", response.Err)
- }
-}
diff --git a/vendor/github.com/Shopify/sarama/list_groups_request_test.go b/vendor/github.com/Shopify/sarama/list_groups_request_test.go
deleted file mode 100644
index 2e977d9a5..000000000
--- a/vendor/github.com/Shopify/sarama/list_groups_request_test.go
+++ /dev/null
@@ -1,7 +0,0 @@
-package sarama
-
-import "testing"
-
-func TestListGroupsRequest(t *testing.T) {
- testRequest(t, "ListGroupsRequest", &ListGroupsRequest{}, []byte{})
-}
diff --git a/vendor/github.com/Shopify/sarama/list_groups_response_test.go b/vendor/github.com/Shopify/sarama/list_groups_response_test.go
deleted file mode 100644
index 41ab822f9..000000000
--- a/vendor/github.com/Shopify/sarama/list_groups_response_test.go
+++ /dev/null
@@ -1,58 +0,0 @@
-package sarama
-
-import (
- "testing"
-)
-
-var (
- listGroupsResponseEmpty = []byte{
- 0, 0, // no error
- 0, 0, 0, 0, // no groups
- }
-
- listGroupsResponseError = []byte{
- 0, 31, // no error
- 0, 0, 0, 0, // ErrClusterAuthorizationFailed
- }
-
- listGroupsResponseWithConsumer = []byte{
- 0, 0, // no error
- 0, 0, 0, 1, // 1 group
- 0, 3, 'f', 'o', 'o', // group name
- 0, 8, 'c', 'o', 'n', 's', 'u', 'm', 'e', 'r', // protocol type
- }
-)
-
-func TestListGroupsResponse(t *testing.T) {
- var response *ListGroupsResponse
-
- response = new(ListGroupsResponse)
- testVersionDecodable(t, "no error", response, listGroupsResponseEmpty, 0)
- if response.Err != ErrNoError {
- t.Error("Expected no gerror, found:", response.Err)
- }
- if len(response.Groups) != 0 {
- t.Error("Expected no groups")
- }
-
- response = new(ListGroupsResponse)
- testVersionDecodable(t, "no error", response, listGroupsResponseError, 0)
- if response.Err != ErrClusterAuthorizationFailed {
- t.Error("Expected no gerror, found:", response.Err)
- }
- if len(response.Groups) != 0 {
- t.Error("Expected no groups")
- }
-
- response = new(ListGroupsResponse)
- testVersionDecodable(t, "no error", response, listGroupsResponseWithConsumer, 0)
- if response.Err != ErrNoError {
- t.Error("Expected no gerror, found:", response.Err)
- }
- if len(response.Groups) != 1 {
- t.Error("Expected one group")
- }
- if response.Groups["foo"] != "consumer" {
- t.Error("Expected foo group to use consumer protocol")
- }
-}
diff --git a/vendor/github.com/Shopify/sarama/message_test.go b/vendor/github.com/Shopify/sarama/message_test.go
deleted file mode 100644
index 0eb02f263..000000000
--- a/vendor/github.com/Shopify/sarama/message_test.go
+++ /dev/null
@@ -1,196 +0,0 @@
-package sarama
-
-import (
- "testing"
- "time"
-)
-
-var (
- emptyMessage = []byte{
- 167, 236, 104, 3, // CRC
- 0x00, // magic version byte
- 0x00, // attribute flags
- 0xFF, 0xFF, 0xFF, 0xFF, // key
- 0xFF, 0xFF, 0xFF, 0xFF} // value
-
- emptyV1Message = []byte{
- 204, 47, 121, 217, // CRC
- 0x01, // magic version byte
- 0x00, // attribute flags
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // timestamp
- 0xFF, 0xFF, 0xFF, 0xFF, // key
- 0xFF, 0xFF, 0xFF, 0xFF} // value
-
- emptyV2Message = []byte{
- 167, 236, 104, 3, // CRC
- 0x02, // magic version byte
- 0x00, // attribute flags
- 0xFF, 0xFF, 0xFF, 0xFF, // key
- 0xFF, 0xFF, 0xFF, 0xFF} // value
-
- emptyGzipMessage = []byte{
- 132, 99, 80, 148, //CRC
- 0x00, // magic version byte
- 0x01, // attribute flags
- 0xFF, 0xFF, 0xFF, 0xFF, // key
- // value
- 0x00, 0x00, 0x00, 0x17,
- 0x1f, 0x8b,
- 0x08,
- 0, 0, 0, 0, 0, 0, 255, 1, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0}
-
- emptyLZ4Message = []byte{
- 132, 219, 238, 101, // CRC
- 0x01, // version byte
- 0x03, // attribute flags: lz4
- 0, 0, 1, 88, 141, 205, 89, 56, // timestamp
- 0xFF, 0xFF, 0xFF, 0xFF, // key
- 0x00, 0x00, 0x00, 0x0f, // len
- 0x04, 0x22, 0x4D, 0x18, // LZ4 magic number
- 100, // LZ4 flags: version 01, block indepedant, content checksum
- 112, 185, 0, 0, 0, 0, // LZ4 data
- 5, 93, 204, 2, // LZ4 checksum
- }
-
- emptyBulkSnappyMessage = []byte{
- 180, 47, 53, 209, //CRC
- 0x00, // magic version byte
- 0x02, // attribute flags
- 0xFF, 0xFF, 0xFF, 0xFF, // key
- 0, 0, 0, 42,
- 130, 83, 78, 65, 80, 80, 89, 0, // SNAPPY magic
- 0, 0, 0, 1, // min version
- 0, 0, 0, 1, // default version
- 0, 0, 0, 22, 52, 0, 0, 25, 1, 16, 14, 227, 138, 104, 118, 25, 15, 13, 1, 8, 1, 0, 0, 62, 26, 0}
-
- emptyBulkGzipMessage = []byte{
- 139, 160, 63, 141, //CRC
- 0x00, // magic version byte
- 0x01, // attribute flags
- 0xFF, 0xFF, 0xFF, 0xFF, // key
- 0x00, 0x00, 0x00, 0x27, // len
- 0x1f, 0x8b, // Gzip Magic
- 0x08, // deflate compressed
- 0, 0, 0, 0, 0, 0, 0, 99, 96, 128, 3, 190, 202, 112, 143, 7, 12, 12, 255, 129, 0, 33, 200, 192, 136, 41, 3, 0, 199, 226, 155, 70, 52, 0, 0, 0}
-
- emptyBulkLZ4Message = []byte{
- 246, 12, 188, 129, // CRC
- 0x01, // Version
- 0x03, // attribute flags (LZ4)
- 255, 255, 249, 209, 212, 181, 73, 201, // timestamp
- 0xFF, 0xFF, 0xFF, 0xFF, // key
- 0x00, 0x00, 0x00, 0x47, // len
- 0x04, 0x22, 0x4D, 0x18, // magic number lz4
- 100, // lz4 flags 01100100
- // version: 01, block indep: 1, block checksum: 0, content size: 0, content checksum: 1, reserved: 00
- 112, 185, 52, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 121, 87, 72, 224, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 14, 121, 87, 72, 224, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0,
- 71, 129, 23, 111, // LZ4 checksum
- }
-)
-
-func TestMessageEncoding(t *testing.T) {
- message := Message{}
- testEncodable(t, "empty", &message, emptyMessage)
-
- message.Value = []byte{}
- message.Codec = CompressionGZIP
- testEncodable(t, "empty gzip", &message, emptyGzipMessage)
-
- message.Value = []byte{}
- message.Codec = CompressionLZ4
- message.Timestamp = time.Unix(1479847795, 0)
- message.Version = 1
- testEncodable(t, "empty lz4", &message, emptyLZ4Message)
-}
-
-func TestMessageDecoding(t *testing.T) {
- message := Message{}
- testDecodable(t, "empty", &message, emptyMessage)
- if message.Codec != CompressionNone {
- t.Error("Decoding produced compression codec where there was none.")
- }
- if message.Key != nil {
- t.Error("Decoding produced key where there was none.")
- }
- if message.Value != nil {
- t.Error("Decoding produced value where there was none.")
- }
- if message.Set != nil {
- t.Error("Decoding produced set where there was none.")
- }
-
- testDecodable(t, "empty gzip", &message, emptyGzipMessage)
- if message.Codec != CompressionGZIP {
- t.Error("Decoding produced incorrect compression codec (was gzip).")
- }
- if message.Key != nil {
- t.Error("Decoding produced key where there was none.")
- }
- if message.Value == nil || len(message.Value) != 0 {
- t.Error("Decoding produced nil or content-ful value where there was an empty array.")
- }
-}
-
-func TestMessageDecodingBulkSnappy(t *testing.T) {
- message := Message{}
- testDecodable(t, "bulk snappy", &message, emptyBulkSnappyMessage)
- if message.Codec != CompressionSnappy {
- t.Errorf("Decoding produced codec %d, but expected %d.", message.Codec, CompressionSnappy)
- }
- if message.Key != nil {
- t.Errorf("Decoding produced key %+v, but none was expected.", message.Key)
- }
- if message.Set == nil {
- t.Error("Decoding produced no set, but one was expected.")
- } else if len(message.Set.Messages) != 2 {
- t.Errorf("Decoding produced a set with %d messages, but 2 were expected.", len(message.Set.Messages))
- }
-}
-
-func TestMessageDecodingBulkGzip(t *testing.T) {
- message := Message{}
- testDecodable(t, "bulk gzip", &message, emptyBulkGzipMessage)
- if message.Codec != CompressionGZIP {
- t.Errorf("Decoding produced codec %d, but expected %d.", message.Codec, CompressionGZIP)
- }
- if message.Key != nil {
- t.Errorf("Decoding produced key %+v, but none was expected.", message.Key)
- }
- if message.Set == nil {
- t.Error("Decoding produced no set, but one was expected.")
- } else if len(message.Set.Messages) != 2 {
- t.Errorf("Decoding produced a set with %d messages, but 2 were expected.", len(message.Set.Messages))
- }
-}
-
-func TestMessageDecodingBulkLZ4(t *testing.T) {
- message := Message{}
- testDecodable(t, "bulk lz4", &message, emptyBulkLZ4Message)
- if message.Codec != CompressionLZ4 {
- t.Errorf("Decoding produced codec %d, but expected %d.", message.Codec, CompressionLZ4)
- }
- if message.Key != nil {
- t.Errorf("Decoding produced key %+v, but none was expected.", message.Key)
- }
- if message.Set == nil {
- t.Error("Decoding produced no set, but one was expected.")
- } else if len(message.Set.Messages) != 2 {
- t.Errorf("Decoding produced a set with %d messages, but 2 were expected.", len(message.Set.Messages))
- }
-}
-
-func TestMessageDecodingVersion1(t *testing.T) {
- message := Message{Version: 1}
- testDecodable(t, "decoding empty v1 message", &message, emptyV1Message)
-}
-
-func TestMessageDecodingUnknownVersions(t *testing.T) {
- message := Message{Version: 2}
- err := decode(emptyV2Message, &message)
- if err == nil {
- t.Error("Decoding did not produce an error for an unknown magic byte")
- }
- if err.Error() != "kafka: error decoding packet: unknown magic byte (2)" {
- t.Error("Decoding an unknown magic byte produced an unknown error ", err)
- }
-}
diff --git a/vendor/github.com/Shopify/sarama/metadata_request_test.go b/vendor/github.com/Shopify/sarama/metadata_request_test.go
deleted file mode 100644
index 727e48a2c..000000000
--- a/vendor/github.com/Shopify/sarama/metadata_request_test.go
+++ /dev/null
@@ -1,76 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- metadataRequestNoTopicsV0 = []byte{
- 0x00, 0x00, 0x00, 0x00}
-
- metadataRequestOneTopicV0 = []byte{
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x06, 't', 'o', 'p', 'i', 'c', '1'}
-
- metadataRequestThreeTopicsV0 = []byte{
- 0x00, 0x00, 0x00, 0x03,
- 0x00, 0x03, 'f', 'o', 'o',
- 0x00, 0x03, 'b', 'a', 'r',
- 0x00, 0x03, 'b', 'a', 'z'}
-
- metadataRequestNoTopicsV1 = []byte{
- 0xff, 0xff, 0xff, 0xff}
-
- metadataRequestAutoCreateV4 = append(metadataRequestOneTopicV0, byte(1))
- metadataRequestNoAutoCreateV4 = append(metadataRequestOneTopicV0, byte(0))
-)
-
-func TestMetadataRequestV0(t *testing.T) {
- request := new(MetadataRequest)
- testRequest(t, "no topics", request, metadataRequestNoTopicsV0)
-
- request.Topics = []string{"topic1"}
- testRequest(t, "one topic", request, metadataRequestOneTopicV0)
-
- request.Topics = []string{"foo", "bar", "baz"}
- testRequest(t, "three topics", request, metadataRequestThreeTopicsV0)
-}
-
-func TestMetadataRequestV1(t *testing.T) {
- request := new(MetadataRequest)
- request.Version = 1
- testRequest(t, "no topics", request, metadataRequestNoTopicsV1)
-
- request.Topics = []string{"topic1"}
- testRequest(t, "one topic", request, metadataRequestOneTopicV0)
-
- request.Topics = []string{"foo", "bar", "baz"}
- testRequest(t, "three topics", request, metadataRequestThreeTopicsV0)
-}
-
-func TestMetadataRequestV2(t *testing.T) {
- request := new(MetadataRequest)
- request.Version = 2
- testRequest(t, "no topics", request, metadataRequestNoTopicsV1)
-
- request.Topics = []string{"topic1"}
- testRequest(t, "one topic", request, metadataRequestOneTopicV0)
-}
-
-func TestMetadataRequestV3(t *testing.T) {
- request := new(MetadataRequest)
- request.Version = 3
- testRequest(t, "no topics", request, metadataRequestNoTopicsV1)
-
- request.Topics = []string{"topic1"}
- testRequest(t, "one topic", request, metadataRequestOneTopicV0)
-}
-
-func TestMetadataRequestV4(t *testing.T) {
- request := new(MetadataRequest)
- request.Version = 4
- request.Topics = []string{"topic1"}
- request.AllowAutoTopicCreation = true
- testRequest(t, "one topic", request, metadataRequestAutoCreateV4)
-
- request.AllowAutoTopicCreation = false
- testRequest(t, "one topic", request, metadataRequestNoAutoCreateV4)
-}
diff --git a/vendor/github.com/Shopify/sarama/metadata_response_test.go b/vendor/github.com/Shopify/sarama/metadata_response_test.go
deleted file mode 100644
index 04a4ce7fc..000000000
--- a/vendor/github.com/Shopify/sarama/metadata_response_test.go
+++ /dev/null
@@ -1,290 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- emptyMetadataResponseV0 = []byte{
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00}
-
- brokersNoTopicsMetadataResponseV0 = []byte{
- 0x00, 0x00, 0x00, 0x02,
-
- 0x00, 0x00, 0xab, 0xff,
- 0x00, 0x09, 'l', 'o', 'c', 'a', 'l', 'h', 'o', 's', 't',
- 0x00, 0x00, 0x00, 0x33,
-
- 0x00, 0x01, 0x02, 0x03,
- 0x00, 0x0a, 'g', 'o', 'o', 'g', 'l', 'e', '.', 'c', 'o', 'm',
- 0x00, 0x00, 0x01, 0x11,
-
- 0x00, 0x00, 0x00, 0x00}
-
- topicsNoBrokersMetadataResponseV0 = []byte{
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x02,
-
- 0x00, 0x00,
- 0x00, 0x03, 'f', 'o', 'o',
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x04,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x07,
- 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03,
- 0x00, 0x00, 0x00, 0x00,
-
- 0x00, 0x00,
- 0x00, 0x03, 'b', 'a', 'r',
- 0x00, 0x00, 0x00, 0x00}
-
- brokersNoTopicsMetadataResponseV1 = []byte{
- 0x00, 0x00, 0x00, 0x02,
-
- 0x00, 0x00, 0xab, 0xff,
- 0x00, 0x09, 'l', 'o', 'c', 'a', 'l', 'h', 'o', 's', 't',
- 0x00, 0x00, 0x00, 0x33,
- 0x00, 0x05, 'r', 'a', 'c', 'k', '0',
-
- 0x00, 0x01, 0x02, 0x03,
- 0x00, 0x0a, 'g', 'o', 'o', 'g', 'l', 'e', '.', 'c', 'o', 'm',
- 0x00, 0x00, 0x01, 0x11,
- 0x00, 0x05, 'r', 'a', 'c', 'k', '1',
-
- 0x00, 0x00, 0x00, 0x01,
-
- 0x00, 0x00, 0x00, 0x00}
-
- topicsNoBrokersMetadataResponseV1 = []byte{
- 0x00, 0x00, 0x00, 0x00,
-
- 0x00, 0x00, 0x00, 0x04,
-
- 0x00, 0x00, 0x00, 0x02,
-
- 0x00, 0x00,
- 0x00, 0x03, 'f', 'o', 'o',
- 0x00,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x04,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x07,
- 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03,
- 0x00, 0x00, 0x00, 0x00,
-
- 0x00, 0x00,
- 0x00, 0x03, 'b', 'a', 'r',
- 0x01,
- 0x00, 0x00, 0x00, 0x00}
-
- noBrokersNoTopicsWithThrottleTimeAndClusterIDV3 = []byte{
- 0x00, 0x00, 0x00, 0x10,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x09, 'c', 'l', 'u', 's', 't', 'e', 'r', 'I', 'd',
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x00}
-
- noBrokersOneTopicWithOfflineReplicasV5 = []byte{
- 0x00, 0x00, 0x00, 0x05,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x09, 'c', 'l', 'u', 's', 't', 'e', 'r', 'I', 'd',
- 0x00, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00,
- 0x00, 0x03, 'f', 'o', 'o',
- 0x00,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x04,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x07,
- 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03,
- 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03,
- }
-)
-
-func TestEmptyMetadataResponseV0(t *testing.T) {
- response := MetadataResponse{}
-
- testVersionDecodable(t, "empty, V0", &response, emptyMetadataResponseV0, 0)
- if len(response.Brokers) != 0 {
- t.Error("Decoding produced", len(response.Brokers), "brokers where there were none!")
- }
- if len(response.Topics) != 0 {
- t.Error("Decoding produced", len(response.Topics), "topics where there were none!")
- }
-}
-
-func TestMetadataResponseWithBrokersV0(t *testing.T) {
- response := MetadataResponse{}
-
- testVersionDecodable(t, "brokers, no topics, V0", &response, brokersNoTopicsMetadataResponseV0, 0)
- if len(response.Brokers) != 2 {
- t.Fatal("Decoding produced", len(response.Brokers), "brokers where there were two!")
- }
-
- if response.Brokers[0].id != 0xabff {
- t.Error("Decoding produced invalid broker 0 id.")
- }
- if response.Brokers[0].addr != "localhost:51" {
- t.Error("Decoding produced invalid broker 0 address.")
- }
- if response.Brokers[1].id != 0x010203 {
- t.Error("Decoding produced invalid broker 1 id.")
- }
- if response.Brokers[1].addr != "google.com:273" {
- t.Error("Decoding produced invalid broker 1 address.")
- }
-
- if len(response.Topics) != 0 {
- t.Error("Decoding produced", len(response.Topics), "topics where there were none!")
- }
-}
-
-func TestMetadataResponseWithTopicsV0(t *testing.T) {
- response := MetadataResponse{}
-
- testVersionDecodable(t, "topics, no brokers, V0", &response, topicsNoBrokersMetadataResponseV0, 0)
- if len(response.Brokers) != 0 {
- t.Error("Decoding produced", len(response.Brokers), "brokers where there were none!")
- }
-
- if len(response.Topics) != 2 {
- t.Fatal("Decoding produced", len(response.Topics), "topics where there were two!")
- }
-
- if response.Topics[0].Err != ErrNoError {
- t.Error("Decoding produced invalid topic 0 error.")
- }
-
- if response.Topics[0].Name != "foo" {
- t.Error("Decoding produced invalid topic 0 name.")
- }
-
- if len(response.Topics[0].Partitions) != 1 {
- t.Fatal("Decoding produced invalid partition count for topic 0.")
- }
-
- if response.Topics[0].Partitions[0].Err != ErrInvalidMessageSize {
- t.Error("Decoding produced invalid topic 0 partition 0 error.")
- }
-
- if response.Topics[0].Partitions[0].ID != 0x01 {
- t.Error("Decoding produced invalid topic 0 partition 0 id.")
- }
-
- if response.Topics[0].Partitions[0].Leader != 0x07 {
- t.Error("Decoding produced invalid topic 0 partition 0 leader.")
- }
-
- if len(response.Topics[0].Partitions[0].Replicas) != 3 {
- t.Fatal("Decoding produced invalid topic 0 partition 0 replicas.")
- }
- for i := 0; i < 3; i++ {
- if response.Topics[0].Partitions[0].Replicas[i] != int32(i+1) {
- t.Error("Decoding produced invalid topic 0 partition 0 replica", i)
- }
- }
-
- if len(response.Topics[0].Partitions[0].Isr) != 0 {
- t.Error("Decoding produced invalid topic 0 partition 0 isr length.")
- }
-
- if response.Topics[1].Err != ErrNoError {
- t.Error("Decoding produced invalid topic 1 error.")
- }
-
- if response.Topics[1].Name != "bar" {
- t.Error("Decoding produced invalid topic 0 name.")
- }
-
- if len(response.Topics[1].Partitions) != 0 {
- t.Error("Decoding produced invalid partition count for topic 1.")
- }
-}
-
-func TestMetadataResponseWithBrokersV1(t *testing.T) {
- response := MetadataResponse{}
-
- testVersionDecodable(t, "topics, V1", &response, brokersNoTopicsMetadataResponseV1, 1)
- if len(response.Brokers) != 2 {
- t.Error("Decoding produced", len(response.Brokers), "brokers where there were 2!")
- }
- if response.Brokers[0].rack == nil || *response.Brokers[0].rack != "rack0" {
- t.Error("Decoding produced invalid broker 0 rack.")
- }
- if response.Brokers[1].rack == nil || *response.Brokers[1].rack != "rack1" {
- t.Error("Decoding produced invalid broker 1 rack.")
- }
- if response.ControllerID != 1 {
- t.Error("Decoding produced", response.ControllerID, "should have been 1!")
- }
- if len(response.Topics) != 0 {
- t.Error("Decoding produced", len(response.Brokers), "brokers where there were none!")
- }
-}
-
-func TestMetadataResponseWithTopicsV1(t *testing.T) {
- response := MetadataResponse{}
-
- testVersionDecodable(t, "topics, V1", &response, topicsNoBrokersMetadataResponseV1, 1)
- if len(response.Brokers) != 0 {
- t.Error("Decoding produced", len(response.Brokers), "brokers where there were none!")
- }
- if response.ControllerID != 4 {
- t.Error("Decoding produced", response.ControllerID, "should have been 4!")
- }
- if len(response.Topics) != 2 {
- t.Error("Decoding produced", len(response.Topics), "topics where there were 2!")
- }
- if response.Topics[0].IsInternal {
- t.Error("Decoding produced", response.Topics[0], "topic0 should have been false!")
- }
- if !response.Topics[1].IsInternal {
- t.Error("Decoding produced", response.Topics[1], "topic1 should have been true!")
- }
-}
-
-func TestMetadataResponseWithThrottleTime(t *testing.T) {
- response := MetadataResponse{}
-
- testVersionDecodable(t, "no topics, no brokers, throttle time and cluster Id V3", &response, noBrokersNoTopicsWithThrottleTimeAndClusterIDV3, 3)
- if response.ThrottleTimeMs != int32(16) {
- t.Error("Decoding produced", response.ThrottleTimeMs, "should have been 16!")
- }
- if len(response.Brokers) != 0 {
- t.Error("Decoding produced", response.Brokers, "should have been 0!")
- }
- if response.ControllerID != int32(1) {
- t.Error("Decoding produced", response.ControllerID, "should have been 1!")
- }
- if *response.ClusterID != "clusterId" {
- t.Error("Decoding produced", response.ClusterID, "should have been clusterId!")
- }
- if len(response.Topics) != 0 {
- t.Error("Decoding produced", len(response.Topics), "should have been 0!")
- }
-}
-
-func TestMetadataResponseWithOfflineReplicasV5(t *testing.T) {
- response := MetadataResponse{}
-
- testVersionDecodable(t, "no brokers, 1 topic with offline replica V5", &response, noBrokersOneTopicWithOfflineReplicasV5, 5)
- if response.ThrottleTimeMs != int32(5) {
- t.Error("Decoding produced", response.ThrottleTimeMs, "should have been 5!")
- }
- if len(response.Brokers) != 0 {
- t.Error("Decoding produced", response.Brokers, "should have been 0!")
- }
- if response.ControllerID != int32(2) {
- t.Error("Decoding produced", response.ControllerID, "should have been 21!")
- }
- if *response.ClusterID != "clusterId" {
- t.Error("Decoding produced", response.ClusterID, "should have been clusterId!")
- }
- if len(response.Topics) != 1 {
- t.Error("Decoding produced", len(response.Topics), "should have been 1!")
- }
- if len(response.Topics[0].Partitions[0].OfflineReplicas) != 1 {
- t.Error("Decoding produced", len(response.Topics[0].Partitions[0].OfflineReplicas), "should have been 1!")
- }
-}
diff --git a/vendor/github.com/Shopify/sarama/metrics_test.go b/vendor/github.com/Shopify/sarama/metrics_test.go
deleted file mode 100644
index 789c0ff33..000000000
--- a/vendor/github.com/Shopify/sarama/metrics_test.go
+++ /dev/null
@@ -1,172 +0,0 @@
-package sarama
-
-import (
- "testing"
-
- "github.com/rcrowley/go-metrics"
-)
-
-func TestGetOrRegisterHistogram(t *testing.T) {
- metricRegistry := metrics.NewRegistry()
- histogram := getOrRegisterHistogram("name", metricRegistry)
-
- if histogram == nil {
- t.Error("Unexpected nil histogram")
- }
-
- // Fetch the metric
- foundHistogram := metricRegistry.Get("name")
-
- if foundHistogram != histogram {
- t.Error("Unexpected different histogram", foundHistogram, histogram)
- }
-
- // Try to register the metric again
- sameHistogram := getOrRegisterHistogram("name", metricRegistry)
-
- if sameHistogram != histogram {
- t.Error("Unexpected different histogram", sameHistogram, histogram)
- }
-}
-
-func TestGetMetricNameForBroker(t *testing.T) {
- metricName := getMetricNameForBroker("name", &Broker{id: 1})
-
- if metricName != "name-for-broker-1" {
- t.Error("Unexpected metric name", metricName)
- }
-}
-
-// Common type and functions for metric validation
-type metricValidator struct {
- name string
- validator func(*testing.T, interface{})
-}
-
-type metricValidators []*metricValidator
-
-func newMetricValidators() metricValidators {
- return make([]*metricValidator, 0, 32)
-}
-
-func (m *metricValidators) register(validator *metricValidator) {
- *m = append(*m, validator)
-}
-
-func (m *metricValidators) registerForBroker(broker *Broker, validator *metricValidator) {
- m.register(&metricValidator{getMetricNameForBroker(validator.name, broker), validator.validator})
-}
-
-func (m *metricValidators) registerForGlobalAndTopic(topic string, validator *metricValidator) {
- m.register(&metricValidator{validator.name, validator.validator})
- m.register(&metricValidator{getMetricNameForTopic(validator.name, topic), validator.validator})
-}
-
-func (m *metricValidators) registerForAllBrokers(broker *Broker, validator *metricValidator) {
- m.register(validator)
- m.registerForBroker(broker, validator)
-}
-
-func (m metricValidators) run(t *testing.T, r metrics.Registry) {
- for _, metricValidator := range m {
- metric := r.Get(metricValidator.name)
- if metric == nil {
- t.Error("No metric named", metricValidator.name)
- } else {
- metricValidator.validator(t, metric)
- }
- }
-}
-
-func meterValidator(name string, extraValidator func(*testing.T, metrics.Meter)) *metricValidator {
- return &metricValidator{
- name: name,
- validator: func(t *testing.T, metric interface{}) {
- if meter, ok := metric.(metrics.Meter); !ok {
- t.Errorf("Expected meter metric for '%s', got %T", name, metric)
- } else {
- extraValidator(t, meter)
- }
- },
- }
-}
-
-func countMeterValidator(name string, expectedCount int) *metricValidator {
- return meterValidator(name, func(t *testing.T, meter metrics.Meter) {
- count := meter.Count()
- if count != int64(expectedCount) {
- t.Errorf("Expected meter metric '%s' count = %d, got %d", name, expectedCount, count)
- }
- })
-}
-
-func minCountMeterValidator(name string, minCount int) *metricValidator {
- return meterValidator(name, func(t *testing.T, meter metrics.Meter) {
- count := meter.Count()
- if count < int64(minCount) {
- t.Errorf("Expected meter metric '%s' count >= %d, got %d", name, minCount, count)
- }
- })
-}
-
-func histogramValidator(name string, extraValidator func(*testing.T, metrics.Histogram)) *metricValidator {
- return &metricValidator{
- name: name,
- validator: func(t *testing.T, metric interface{}) {
- if histogram, ok := metric.(metrics.Histogram); !ok {
- t.Errorf("Expected histogram metric for '%s', got %T", name, metric)
- } else {
- extraValidator(t, histogram)
- }
- },
- }
-}
-
-func countHistogramValidator(name string, expectedCount int) *metricValidator {
- return histogramValidator(name, func(t *testing.T, histogram metrics.Histogram) {
- count := histogram.Count()
- if count != int64(expectedCount) {
- t.Errorf("Expected histogram metric '%s' count = %d, got %d", name, expectedCount, count)
- }
- })
-}
-
-func minCountHistogramValidator(name string, minCount int) *metricValidator {
- return histogramValidator(name, func(t *testing.T, histogram metrics.Histogram) {
- count := histogram.Count()
- if count < int64(minCount) {
- t.Errorf("Expected histogram metric '%s' count >= %d, got %d", name, minCount, count)
- }
- })
-}
-
-func minMaxHistogramValidator(name string, expectedMin int, expectedMax int) *metricValidator {
- return histogramValidator(name, func(t *testing.T, histogram metrics.Histogram) {
- min := int(histogram.Min())
- if min != expectedMin {
- t.Errorf("Expected histogram metric '%s' min = %d, got %d", name, expectedMin, min)
- }
- max := int(histogram.Max())
- if max != expectedMax {
- t.Errorf("Expected histogram metric '%s' max = %d, got %d", name, expectedMax, max)
- }
- })
-}
-
-func minValHistogramValidator(name string, minMin int) *metricValidator {
- return histogramValidator(name, func(t *testing.T, histogram metrics.Histogram) {
- min := int(histogram.Min())
- if min < minMin {
- t.Errorf("Expected histogram metric '%s' min >= %d, got %d", name, minMin, min)
- }
- })
-}
-
-func maxValHistogramValidator(name string, maxMax int) *metricValidator {
- return histogramValidator(name, func(t *testing.T, histogram metrics.Histogram) {
- max := int(histogram.Max())
- if max > maxMax {
- t.Errorf("Expected histogram metric '%s' max <= %d, got %d", name, maxMax, max)
- }
- })
-}
diff --git a/vendor/github.com/Shopify/sarama/offset_commit_request_test.go b/vendor/github.com/Shopify/sarama/offset_commit_request_test.go
deleted file mode 100644
index afc25b7b3..000000000
--- a/vendor/github.com/Shopify/sarama/offset_commit_request_test.go
+++ /dev/null
@@ -1,90 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- offsetCommitRequestNoBlocksV0 = []byte{
- 0x00, 0x06, 'f', 'o', 'o', 'b', 'a', 'r',
- 0x00, 0x00, 0x00, 0x00}
-
- offsetCommitRequestNoBlocksV1 = []byte{
- 0x00, 0x06, 'f', 'o', 'o', 'b', 'a', 'r',
- 0x00, 0x00, 0x11, 0x22,
- 0x00, 0x04, 'c', 'o', 'n', 's',
- 0x00, 0x00, 0x00, 0x00}
-
- offsetCommitRequestNoBlocksV2 = []byte{
- 0x00, 0x06, 'f', 'o', 'o', 'b', 'a', 'r',
- 0x00, 0x00, 0x11, 0x22,
- 0x00, 0x04, 'c', 'o', 'n', 's',
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x33,
- 0x00, 0x00, 0x00, 0x00}
-
- offsetCommitRequestOneBlockV0 = []byte{
- 0x00, 0x06, 'f', 'o', 'o', 'b', 'a', 'r',
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x05, 't', 'o', 'p', 'i', 'c',
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x52, 0x21,
- 0x00, 0x00, 0x00, 0x00, 0xDE, 0xAD, 0xBE, 0xEF,
- 0x00, 0x08, 'm', 'e', 't', 'a', 'd', 'a', 't', 'a'}
-
- offsetCommitRequestOneBlockV1 = []byte{
- 0x00, 0x06, 'f', 'o', 'o', 'b', 'a', 'r',
- 0x00, 0x00, 0x11, 0x22,
- 0x00, 0x04, 'c', 'o', 'n', 's',
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x05, 't', 'o', 'p', 'i', 'c',
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x52, 0x21,
- 0x00, 0x00, 0x00, 0x00, 0xDE, 0xAD, 0xBE, 0xEF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0x00, 0x08, 'm', 'e', 't', 'a', 'd', 'a', 't', 'a'}
-
- offsetCommitRequestOneBlockV2 = []byte{
- 0x00, 0x06, 'f', 'o', 'o', 'b', 'a', 'r',
- 0x00, 0x00, 0x11, 0x22,
- 0x00, 0x04, 'c', 'o', 'n', 's',
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x33,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x05, 't', 'o', 'p', 'i', 'c',
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x52, 0x21,
- 0x00, 0x00, 0x00, 0x00, 0xDE, 0xAD, 0xBE, 0xEF,
- 0x00, 0x08, 'm', 'e', 't', 'a', 'd', 'a', 't', 'a'}
-)
-
-func TestOffsetCommitRequestV0(t *testing.T) {
- request := new(OffsetCommitRequest)
- request.Version = 0
- request.ConsumerGroup = "foobar"
- testRequest(t, "no blocks v0", request, offsetCommitRequestNoBlocksV0)
-
- request.AddBlock("topic", 0x5221, 0xDEADBEEF, 0, "metadata")
- testRequest(t, "one block v0", request, offsetCommitRequestOneBlockV0)
-}
-
-func TestOffsetCommitRequestV1(t *testing.T) {
- request := new(OffsetCommitRequest)
- request.ConsumerGroup = "foobar"
- request.ConsumerID = "cons"
- request.ConsumerGroupGeneration = 0x1122
- request.Version = 1
- testRequest(t, "no blocks v1", request, offsetCommitRequestNoBlocksV1)
-
- request.AddBlock("topic", 0x5221, 0xDEADBEEF, ReceiveTime, "metadata")
- testRequest(t, "one block v1", request, offsetCommitRequestOneBlockV1)
-}
-
-func TestOffsetCommitRequestV2(t *testing.T) {
- request := new(OffsetCommitRequest)
- request.ConsumerGroup = "foobar"
- request.ConsumerID = "cons"
- request.ConsumerGroupGeneration = 0x1122
- request.RetentionTime = 0x4433
- request.Version = 2
- testRequest(t, "no blocks v2", request, offsetCommitRequestNoBlocksV2)
-
- request.AddBlock("topic", 0x5221, 0xDEADBEEF, 0, "metadata")
- testRequest(t, "one block v2", request, offsetCommitRequestOneBlockV2)
-}
diff --git a/vendor/github.com/Shopify/sarama/offset_commit_response_test.go b/vendor/github.com/Shopify/sarama/offset_commit_response_test.go
deleted file mode 100644
index 074ec9232..000000000
--- a/vendor/github.com/Shopify/sarama/offset_commit_response_test.go
+++ /dev/null
@@ -1,24 +0,0 @@
-package sarama
-
-import (
- "testing"
-)
-
-var (
- emptyOffsetCommitResponse = []byte{
- 0x00, 0x00, 0x00, 0x00}
-)
-
-func TestEmptyOffsetCommitResponse(t *testing.T) {
- response := OffsetCommitResponse{}
- testResponse(t, "empty", &response, emptyOffsetCommitResponse)
-}
-
-func TestNormalOffsetCommitResponse(t *testing.T) {
- response := OffsetCommitResponse{}
- response.AddError("t", 0, ErrNotLeaderForPartition)
- response.Errors["m"] = make(map[int32]KError)
- // The response encoded form cannot be checked for it varies due to
- // unpredictable map traversal order.
- testResponse(t, "normal", &response, nil)
-}
diff --git a/vendor/github.com/Shopify/sarama/offset_fetch_request_test.go b/vendor/github.com/Shopify/sarama/offset_fetch_request_test.go
deleted file mode 100644
index 025d725c9..000000000
--- a/vendor/github.com/Shopify/sarama/offset_fetch_request_test.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- offsetFetchRequestNoGroupNoPartitions = []byte{
- 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00}
-
- offsetFetchRequestNoPartitions = []byte{
- 0x00, 0x04, 'b', 'l', 'a', 'h',
- 0x00, 0x00, 0x00, 0x00}
-
- offsetFetchRequestOnePartition = []byte{
- 0x00, 0x04, 'b', 'l', 'a', 'h',
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x0D, 't', 'o', 'p', 'i', 'c', 'T', 'h', 'e', 'F', 'i', 'r', 's', 't',
- 0x00, 0x00, 0x00, 0x01,
- 0x4F, 0x4F, 0x4F, 0x4F}
-)
-
-func TestOffsetFetchRequest(t *testing.T) {
- request := new(OffsetFetchRequest)
- testRequest(t, "no group, no partitions", request, offsetFetchRequestNoGroupNoPartitions)
-
- request.ConsumerGroup = "blah"
- testRequest(t, "no partitions", request, offsetFetchRequestNoPartitions)
-
- request.AddPartition("topicTheFirst", 0x4F4F4F4F)
- testRequest(t, "one partition", request, offsetFetchRequestOnePartition)
-}
diff --git a/vendor/github.com/Shopify/sarama/offset_fetch_response_test.go b/vendor/github.com/Shopify/sarama/offset_fetch_response_test.go
deleted file mode 100644
index 7614ae424..000000000
--- a/vendor/github.com/Shopify/sarama/offset_fetch_response_test.go
+++ /dev/null
@@ -1,22 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- emptyOffsetFetchResponse = []byte{
- 0x00, 0x00, 0x00, 0x00}
-)
-
-func TestEmptyOffsetFetchResponse(t *testing.T) {
- response := OffsetFetchResponse{}
- testResponse(t, "empty", &response, emptyOffsetFetchResponse)
-}
-
-func TestNormalOffsetFetchResponse(t *testing.T) {
- response := OffsetFetchResponse{}
- response.AddBlock("t", 0, &OffsetFetchResponseBlock{0, "md", ErrRequestTimedOut})
- response.Blocks["m"] = nil
- // The response encoded form cannot be checked for it varies due to
- // unpredictable map traversal order.
- testResponse(t, "normal", &response, nil)
-}
diff --git a/vendor/github.com/Shopify/sarama/offset_manager_test.go b/vendor/github.com/Shopify/sarama/offset_manager_test.go
deleted file mode 100644
index 21e4947c6..000000000
--- a/vendor/github.com/Shopify/sarama/offset_manager_test.go
+++ /dev/null
@@ -1,433 +0,0 @@
-package sarama
-
-import (
- "testing"
- "time"
-)
-
-func initOffsetManager(t *testing.T) (om OffsetManager,
- testClient Client, broker, coordinator *MockBroker) {
-
- config := NewConfig()
- config.Metadata.Retry.Max = 1
- config.Consumer.Offsets.CommitInterval = 1 * time.Millisecond
- config.Version = V0_9_0_0
-
- broker = NewMockBroker(t, 1)
- coordinator = NewMockBroker(t, 2)
-
- seedMeta := new(MetadataResponse)
- seedMeta.AddBroker(coordinator.Addr(), coordinator.BrokerID())
- seedMeta.AddTopicPartition("my_topic", 0, 1, []int32{}, []int32{}, ErrNoError)
- seedMeta.AddTopicPartition("my_topic", 1, 1, []int32{}, []int32{}, ErrNoError)
- broker.Returns(seedMeta)
-
- var err error
- testClient, err = NewClient([]string{broker.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
-
- broker.Returns(&ConsumerMetadataResponse{
- CoordinatorID: coordinator.BrokerID(),
- CoordinatorHost: "127.0.0.1",
- CoordinatorPort: coordinator.Port(),
- })
-
- om, err = NewOffsetManagerFromClient("group", testClient)
- if err != nil {
- t.Fatal(err)
- }
-
- return om, testClient, broker, coordinator
-}
-
-func initPartitionOffsetManager(t *testing.T, om OffsetManager,
- coordinator *MockBroker, initialOffset int64, metadata string) PartitionOffsetManager {
-
- fetchResponse := new(OffsetFetchResponse)
- fetchResponse.AddBlock("my_topic", 0, &OffsetFetchResponseBlock{
- Err: ErrNoError,
- Offset: initialOffset,
- Metadata: metadata,
- })
- coordinator.Returns(fetchResponse)
-
- pom, err := om.ManagePartition("my_topic", 0)
- if err != nil {
- t.Fatal(err)
- }
-
- return pom
-}
-
-func TestNewOffsetManager(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
- seedBroker.Returns(new(MetadataResponse))
-
- testClient, err := NewClient([]string{seedBroker.Addr()}, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- _, err = NewOffsetManagerFromClient("group", testClient)
- if err != nil {
- t.Error(err)
- }
-
- safeClose(t, testClient)
-
- _, err = NewOffsetManagerFromClient("group", testClient)
- if err != ErrClosedClient {
- t.Errorf("Error expected for closed client; actual value: %v", err)
- }
-
- seedBroker.Close()
-}
-
-// Test recovery from ErrNotCoordinatorForConsumer
-// on first fetchInitialOffset call
-func TestOffsetManagerFetchInitialFail(t *testing.T) {
- om, testClient, broker, coordinator := initOffsetManager(t)
-
- // Error on first fetchInitialOffset call
- responseBlock := OffsetFetchResponseBlock{
- Err: ErrNotCoordinatorForConsumer,
- Offset: 5,
- Metadata: "test_meta",
- }
-
- fetchResponse := new(OffsetFetchResponse)
- fetchResponse.AddBlock("my_topic", 0, &responseBlock)
- coordinator.Returns(fetchResponse)
-
- // Refresh coordinator
- newCoordinator := NewMockBroker(t, 3)
- broker.Returns(&ConsumerMetadataResponse{
- CoordinatorID: newCoordinator.BrokerID(),
- CoordinatorHost: "127.0.0.1",
- CoordinatorPort: newCoordinator.Port(),
- })
-
- // Second fetchInitialOffset call is fine
- fetchResponse2 := new(OffsetFetchResponse)
- responseBlock2 := responseBlock
- responseBlock2.Err = ErrNoError
- fetchResponse2.AddBlock("my_topic", 0, &responseBlock2)
- newCoordinator.Returns(fetchResponse2)
-
- pom, err := om.ManagePartition("my_topic", 0)
- if err != nil {
- t.Error(err)
- }
-
- broker.Close()
- coordinator.Close()
- newCoordinator.Close()
- safeClose(t, pom)
- safeClose(t, om)
- safeClose(t, testClient)
-}
-
-// Test fetchInitialOffset retry on ErrOffsetsLoadInProgress
-func TestOffsetManagerFetchInitialLoadInProgress(t *testing.T) {
- om, testClient, broker, coordinator := initOffsetManager(t)
-
- // Error on first fetchInitialOffset call
- responseBlock := OffsetFetchResponseBlock{
- Err: ErrOffsetsLoadInProgress,
- Offset: 5,
- Metadata: "test_meta",
- }
-
- fetchResponse := new(OffsetFetchResponse)
- fetchResponse.AddBlock("my_topic", 0, &responseBlock)
- coordinator.Returns(fetchResponse)
-
- // Second fetchInitialOffset call is fine
- fetchResponse2 := new(OffsetFetchResponse)
- responseBlock2 := responseBlock
- responseBlock2.Err = ErrNoError
- fetchResponse2.AddBlock("my_topic", 0, &responseBlock2)
- coordinator.Returns(fetchResponse2)
-
- pom, err := om.ManagePartition("my_topic", 0)
- if err != nil {
- t.Error(err)
- }
-
- broker.Close()
- coordinator.Close()
- safeClose(t, pom)
- safeClose(t, om)
- safeClose(t, testClient)
-}
-
-func TestPartitionOffsetManagerInitialOffset(t *testing.T) {
- om, testClient, broker, coordinator := initOffsetManager(t)
- testClient.Config().Consumer.Offsets.Initial = OffsetOldest
-
- // Kafka returns -1 if no offset has been stored for this partition yet.
- pom := initPartitionOffsetManager(t, om, coordinator, -1, "")
-
- offset, meta := pom.NextOffset()
- if offset != OffsetOldest {
- t.Errorf("Expected offset 5. Actual: %v", offset)
- }
- if meta != "" {
- t.Errorf("Expected metadata to be empty. Actual: %q", meta)
- }
-
- safeClose(t, pom)
- safeClose(t, om)
- broker.Close()
- coordinator.Close()
- safeClose(t, testClient)
-}
-
-func TestPartitionOffsetManagerNextOffset(t *testing.T) {
- om, testClient, broker, coordinator := initOffsetManager(t)
- pom := initPartitionOffsetManager(t, om, coordinator, 5, "test_meta")
-
- offset, meta := pom.NextOffset()
- if offset != 5 {
- t.Errorf("Expected offset 5. Actual: %v", offset)
- }
- if meta != "test_meta" {
- t.Errorf("Expected metadata \"test_meta\". Actual: %q", meta)
- }
-
- safeClose(t, pom)
- safeClose(t, om)
- broker.Close()
- coordinator.Close()
- safeClose(t, testClient)
-}
-
-func TestPartitionOffsetManagerResetOffset(t *testing.T) {
- om, testClient, broker, coordinator := initOffsetManager(t)
- pom := initPartitionOffsetManager(t, om, coordinator, 5, "original_meta")
-
- ocResponse := new(OffsetCommitResponse)
- ocResponse.AddError("my_topic", 0, ErrNoError)
- coordinator.Returns(ocResponse)
-
- expected := int64(1)
- pom.ResetOffset(expected, "modified_meta")
- actual, meta := pom.NextOffset()
-
- if actual != expected {
- t.Errorf("Expected offset %v. Actual: %v", expected, actual)
- }
- if meta != "modified_meta" {
- t.Errorf("Expected metadata \"modified_meta\". Actual: %q", meta)
- }
-
- safeClose(t, pom)
- safeClose(t, om)
- safeClose(t, testClient)
- broker.Close()
- coordinator.Close()
-}
-
-func TestPartitionOffsetManagerResetOffsetWithRetention(t *testing.T) {
- om, testClient, broker, coordinator := initOffsetManager(t)
- testClient.Config().Consumer.Offsets.Retention = time.Hour
-
- pom := initPartitionOffsetManager(t, om, coordinator, 5, "original_meta")
-
- ocResponse := new(OffsetCommitResponse)
- ocResponse.AddError("my_topic", 0, ErrNoError)
- handler := func(req *request) (res encoder) {
- if req.body.version() != 2 {
- t.Errorf("Expected to be using version 2. Actual: %v", req.body.version())
- }
- offsetCommitRequest := req.body.(*OffsetCommitRequest)
- if offsetCommitRequest.RetentionTime != (60 * 60 * 1000) {
- t.Errorf("Expected an hour retention time. Actual: %v", offsetCommitRequest.RetentionTime)
- }
- return ocResponse
- }
- coordinator.setHandler(handler)
-
- expected := int64(1)
- pom.ResetOffset(expected, "modified_meta")
- actual, meta := pom.NextOffset()
-
- if actual != expected {
- t.Errorf("Expected offset %v. Actual: %v", expected, actual)
- }
- if meta != "modified_meta" {
- t.Errorf("Expected metadata \"modified_meta\". Actual: %q", meta)
- }
-
- safeClose(t, pom)
- safeClose(t, om)
- safeClose(t, testClient)
- broker.Close()
- coordinator.Close()
-}
-
-func TestPartitionOffsetManagerMarkOffset(t *testing.T) {
- om, testClient, broker, coordinator := initOffsetManager(t)
- pom := initPartitionOffsetManager(t, om, coordinator, 5, "original_meta")
-
- ocResponse := new(OffsetCommitResponse)
- ocResponse.AddError("my_topic", 0, ErrNoError)
- coordinator.Returns(ocResponse)
-
- pom.MarkOffset(100, "modified_meta")
- offset, meta := pom.NextOffset()
-
- if offset != 100 {
- t.Errorf("Expected offset 100. Actual: %v", offset)
- }
- if meta != "modified_meta" {
- t.Errorf("Expected metadata \"modified_meta\". Actual: %q", meta)
- }
-
- safeClose(t, pom)
- safeClose(t, om)
- safeClose(t, testClient)
- broker.Close()
- coordinator.Close()
-}
-
-func TestPartitionOffsetManagerMarkOffsetWithRetention(t *testing.T) {
- om, testClient, broker, coordinator := initOffsetManager(t)
- testClient.Config().Consumer.Offsets.Retention = time.Hour
-
- pom := initPartitionOffsetManager(t, om, coordinator, 5, "original_meta")
-
- ocResponse := new(OffsetCommitResponse)
- ocResponse.AddError("my_topic", 0, ErrNoError)
- handler := func(req *request) (res encoder) {
- if req.body.version() != 2 {
- t.Errorf("Expected to be using version 2. Actual: %v", req.body.version())
- }
- offsetCommitRequest := req.body.(*OffsetCommitRequest)
- if offsetCommitRequest.RetentionTime != (60 * 60 * 1000) {
- t.Errorf("Expected an hour retention time. Actual: %v", offsetCommitRequest.RetentionTime)
- }
- return ocResponse
- }
- coordinator.setHandler(handler)
-
- pom.MarkOffset(100, "modified_meta")
- offset, meta := pom.NextOffset()
-
- if offset != 100 {
- t.Errorf("Expected offset 100. Actual: %v", offset)
- }
- if meta != "modified_meta" {
- t.Errorf("Expected metadata \"modified_meta\". Actual: %q", meta)
- }
-
- safeClose(t, pom)
- safeClose(t, om)
- safeClose(t, testClient)
- broker.Close()
- coordinator.Close()
-}
-
-func TestPartitionOffsetManagerCommitErr(t *testing.T) {
- om, testClient, broker, coordinator := initOffsetManager(t)
- pom := initPartitionOffsetManager(t, om, coordinator, 5, "meta")
-
- // Error on one partition
- ocResponse := new(OffsetCommitResponse)
- ocResponse.AddError("my_topic", 0, ErrOffsetOutOfRange)
- ocResponse.AddError("my_topic", 1, ErrNoError)
- coordinator.Returns(ocResponse)
-
- newCoordinator := NewMockBroker(t, 3)
-
- // For RefreshCoordinator()
- broker.Returns(&ConsumerMetadataResponse{
- CoordinatorID: newCoordinator.BrokerID(),
- CoordinatorHost: "127.0.0.1",
- CoordinatorPort: newCoordinator.Port(),
- })
-
- // Nothing in response.Errors at all
- ocResponse2 := new(OffsetCommitResponse)
- newCoordinator.Returns(ocResponse2)
-
- // For RefreshCoordinator()
- broker.Returns(&ConsumerMetadataResponse{
- CoordinatorID: newCoordinator.BrokerID(),
- CoordinatorHost: "127.0.0.1",
- CoordinatorPort: newCoordinator.Port(),
- })
-
- // Error on the wrong partition for this pom
- ocResponse3 := new(OffsetCommitResponse)
- ocResponse3.AddError("my_topic", 1, ErrNoError)
- newCoordinator.Returns(ocResponse3)
-
- // For RefreshCoordinator()
- broker.Returns(&ConsumerMetadataResponse{
- CoordinatorID: newCoordinator.BrokerID(),
- CoordinatorHost: "127.0.0.1",
- CoordinatorPort: newCoordinator.Port(),
- })
-
- // ErrUnknownTopicOrPartition/ErrNotLeaderForPartition/ErrLeaderNotAvailable block
- ocResponse4 := new(OffsetCommitResponse)
- ocResponse4.AddError("my_topic", 0, ErrUnknownTopicOrPartition)
- newCoordinator.Returns(ocResponse4)
-
- // For RefreshCoordinator()
- broker.Returns(&ConsumerMetadataResponse{
- CoordinatorID: newCoordinator.BrokerID(),
- CoordinatorHost: "127.0.0.1",
- CoordinatorPort: newCoordinator.Port(),
- })
-
- // Normal error response
- ocResponse5 := new(OffsetCommitResponse)
- ocResponse5.AddError("my_topic", 0, ErrNoError)
- newCoordinator.Returns(ocResponse5)
-
- pom.MarkOffset(100, "modified_meta")
-
- err := pom.Close()
- if err != nil {
- t.Error(err)
- }
-
- broker.Close()
- coordinator.Close()
- newCoordinator.Close()
- safeClose(t, om)
- safeClose(t, testClient)
-}
-
-// Test of recovery from abort
-func TestAbortPartitionOffsetManager(t *testing.T) {
- om, testClient, broker, coordinator := initOffsetManager(t)
- pom := initPartitionOffsetManager(t, om, coordinator, 5, "meta")
-
- // this triggers an error in the CommitOffset request,
- // which leads to the abort call
- coordinator.Close()
-
- // Response to refresh coordinator request
- newCoordinator := NewMockBroker(t, 3)
- broker.Returns(&ConsumerMetadataResponse{
- CoordinatorID: newCoordinator.BrokerID(),
- CoordinatorHost: "127.0.0.1",
- CoordinatorPort: newCoordinator.Port(),
- })
-
- ocResponse := new(OffsetCommitResponse)
- ocResponse.AddError("my_topic", 0, ErrNoError)
- newCoordinator.Returns(ocResponse)
-
- pom.MarkOffset(100, "modified_meta")
-
- safeClose(t, pom)
- safeClose(t, om)
- broker.Close()
- safeClose(t, testClient)
-}
diff --git a/vendor/github.com/Shopify/sarama/offset_request_test.go b/vendor/github.com/Shopify/sarama/offset_request_test.go
deleted file mode 100644
index 9ce562c99..000000000
--- a/vendor/github.com/Shopify/sarama/offset_request_test.go
+++ /dev/null
@@ -1,43 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- offsetRequestNoBlocks = []byte{
- 0xFF, 0xFF, 0xFF, 0xFF,
- 0x00, 0x00, 0x00, 0x00}
-
- offsetRequestOneBlock = []byte{
- 0xFF, 0xFF, 0xFF, 0xFF,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x03, 'f', 'o', 'o',
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x04,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x02}
-
- offsetRequestOneBlockV1 = []byte{
- 0xFF, 0xFF, 0xFF, 0xFF,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x03, 'b', 'a', 'r',
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x04,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}
-)
-
-func TestOffsetRequest(t *testing.T) {
- request := new(OffsetRequest)
- testRequest(t, "no blocks", request, offsetRequestNoBlocks)
-
- request.AddBlock("foo", 4, 1, 2)
- testRequest(t, "one block", request, offsetRequestOneBlock)
-}
-
-func TestOffsetRequestV1(t *testing.T) {
- request := new(OffsetRequest)
- request.Version = 1
- testRequest(t, "no blocks", request, offsetRequestNoBlocks)
-
- request.AddBlock("bar", 4, 1, 2) // Last argument is ignored for V1
- testRequest(t, "one block", request, offsetRequestOneBlockV1)
-}
diff --git a/vendor/github.com/Shopify/sarama/offset_response_test.go b/vendor/github.com/Shopify/sarama/offset_response_test.go
deleted file mode 100644
index 0df6c9f3e..000000000
--- a/vendor/github.com/Shopify/sarama/offset_response_test.go
+++ /dev/null
@@ -1,111 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- emptyOffsetResponse = []byte{
- 0x00, 0x00, 0x00, 0x00}
-
- normalOffsetResponse = []byte{
- 0x00, 0x00, 0x00, 0x02,
-
- 0x00, 0x01, 'a',
- 0x00, 0x00, 0x00, 0x00,
-
- 0x00, 0x01, 'z',
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x02,
- 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06}
-
- normalOffsetResponseV1 = []byte{
- 0x00, 0x00, 0x00, 0x02,
-
- 0x00, 0x01, 'a',
- 0x00, 0x00, 0x00, 0x00,
-
- 0x00, 0x01, 'z',
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x02,
- 0x00, 0x00,
- 0x00, 0x00, 0x01, 0x58, 0x1A, 0xE6, 0x48, 0x86,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06}
-)
-
-func TestEmptyOffsetResponse(t *testing.T) {
- response := OffsetResponse{}
-
- testVersionDecodable(t, "empty", &response, emptyOffsetResponse, 0)
- if len(response.Blocks) != 0 {
- t.Error("Decoding produced", len(response.Blocks), "topics where there were none.")
- }
-
- response = OffsetResponse{}
-
- testVersionDecodable(t, "empty", &response, emptyOffsetResponse, 1)
- if len(response.Blocks) != 0 {
- t.Error("Decoding produced", len(response.Blocks), "topics where there were none.")
- }
-}
-
-func TestNormalOffsetResponse(t *testing.T) {
- response := OffsetResponse{}
-
- testVersionDecodable(t, "normal", &response, normalOffsetResponse, 0)
-
- if len(response.Blocks) != 2 {
- t.Fatal("Decoding produced", len(response.Blocks), "topics where there were two.")
- }
-
- if len(response.Blocks["a"]) != 0 {
- t.Fatal("Decoding produced", len(response.Blocks["a"]), "partitions for topic 'a' where there were none.")
- }
-
- if len(response.Blocks["z"]) != 1 {
- t.Fatal("Decoding produced", len(response.Blocks["z"]), "partitions for topic 'z' where there was one.")
- }
-
- if response.Blocks["z"][2].Err != ErrNoError {
- t.Fatal("Decoding produced invalid error for topic z partition 2.")
- }
-
- if len(response.Blocks["z"][2].Offsets) != 2 {
- t.Fatal("Decoding produced invalid number of offsets for topic z partition 2.")
- }
-
- if response.Blocks["z"][2].Offsets[0] != 5 || response.Blocks["z"][2].Offsets[1] != 6 {
- t.Fatal("Decoding produced invalid offsets for topic z partition 2.")
- }
-}
-
-func TestNormalOffsetResponseV1(t *testing.T) {
- response := OffsetResponse{}
-
- testVersionDecodable(t, "normal", &response, normalOffsetResponseV1, 1)
-
- if len(response.Blocks) != 2 {
- t.Fatal("Decoding produced", len(response.Blocks), "topics where there were two.")
- }
-
- if len(response.Blocks["a"]) != 0 {
- t.Fatal("Decoding produced", len(response.Blocks["a"]), "partitions for topic 'a' where there were none.")
- }
-
- if len(response.Blocks["z"]) != 1 {
- t.Fatal("Decoding produced", len(response.Blocks["z"]), "partitions for topic 'z' where there was one.")
- }
-
- if response.Blocks["z"][2].Err != ErrNoError {
- t.Fatal("Decoding produced invalid error for topic z partition 2.")
- }
-
- if response.Blocks["z"][2].Timestamp != 1477920049286 {
- t.Fatal("Decoding produced invalid timestamp for topic z partition 2.", response.Blocks["z"][2].Timestamp)
- }
-
- if response.Blocks["z"][2].Offset != 6 {
- t.Fatal("Decoding produced invalid offsets for topic z partition 2.")
- }
-}
diff --git a/vendor/github.com/Shopify/sarama/partitioner_test.go b/vendor/github.com/Shopify/sarama/partitioner_test.go
deleted file mode 100644
index 83376431f..000000000
--- a/vendor/github.com/Shopify/sarama/partitioner_test.go
+++ /dev/null
@@ -1,265 +0,0 @@
-package sarama
-
-import (
- "crypto/rand"
- "hash/fnv"
- "log"
- "testing"
-)
-
-func assertPartitioningConsistent(t *testing.T, partitioner Partitioner, message *ProducerMessage, numPartitions int32) {
- choice, err := partitioner.Partition(message, numPartitions)
- if err != nil {
- t.Error(partitioner, err)
- }
- if choice < 0 || choice >= numPartitions {
- t.Error(partitioner, "returned partition", choice, "outside of range for", message)
- }
- for i := 1; i < 50; i++ {
- newChoice, err := partitioner.Partition(message, numPartitions)
- if err != nil {
- t.Error(partitioner, err)
- }
- if newChoice != choice {
- t.Error(partitioner, "returned partition", newChoice, "inconsistent with", choice, ".")
- }
- }
-}
-
-func TestRandomPartitioner(t *testing.T) {
- partitioner := NewRandomPartitioner("mytopic")
-
- choice, err := partitioner.Partition(nil, 1)
- if err != nil {
- t.Error(partitioner, err)
- }
- if choice != 0 {
- t.Error("Returned non-zero partition when only one available.")
- }
-
- for i := 1; i < 50; i++ {
- choice, err := partitioner.Partition(nil, 50)
- if err != nil {
- t.Error(partitioner, err)
- }
- if choice < 0 || choice >= 50 {
- t.Error("Returned partition", choice, "outside of range.")
- }
- }
-}
-
-func TestRoundRobinPartitioner(t *testing.T) {
- partitioner := NewRoundRobinPartitioner("mytopic")
-
- choice, err := partitioner.Partition(nil, 1)
- if err != nil {
- t.Error(partitioner, err)
- }
- if choice != 0 {
- t.Error("Returned non-zero partition when only one available.")
- }
-
- var i int32
- for i = 1; i < 50; i++ {
- choice, err := partitioner.Partition(nil, 7)
- if err != nil {
- t.Error(partitioner, err)
- }
- if choice != i%7 {
- t.Error("Returned partition", choice, "expecting", i%7)
- }
- }
-}
-
-func TestNewHashPartitionerWithHasher(t *testing.T) {
- // use the current default hasher fnv.New32a()
- partitioner := NewCustomHashPartitioner(fnv.New32a)("mytopic")
-
- choice, err := partitioner.Partition(&ProducerMessage{}, 1)
- if err != nil {
- t.Error(partitioner, err)
- }
- if choice != 0 {
- t.Error("Returned non-zero partition when only one available.")
- }
-
- for i := 1; i < 50; i++ {
- choice, err := partitioner.Partition(&ProducerMessage{}, 50)
- if err != nil {
- t.Error(partitioner, err)
- }
- if choice < 0 || choice >= 50 {
- t.Error("Returned partition", choice, "outside of range for nil key.")
- }
- }
-
- buf := make([]byte, 256)
- for i := 1; i < 50; i++ {
- if _, err := rand.Read(buf); err != nil {
- t.Error(err)
- }
- assertPartitioningConsistent(t, partitioner, &ProducerMessage{Key: ByteEncoder(buf)}, 50)
- }
-}
-
-func TestHashPartitionerWithHasherMinInt32(t *testing.T) {
- // use the current default hasher fnv.New32a()
- partitioner := NewCustomHashPartitioner(fnv.New32a)("mytopic")
-
- msg := ProducerMessage{}
- // "1468509572224" generates 2147483648 (uint32) result from Sum32 function
- // which is -2147483648 or int32's min value
- msg.Key = StringEncoder("1468509572224")
-
- choice, err := partitioner.Partition(&msg, 50)
- if err != nil {
- t.Error(partitioner, err)
- }
- if choice < 0 || choice >= 50 {
- t.Error("Returned partition", choice, "outside of range for nil key.")
- }
-}
-
-func TestHashPartitioner(t *testing.T) {
- partitioner := NewHashPartitioner("mytopic")
-
- choice, err := partitioner.Partition(&ProducerMessage{}, 1)
- if err != nil {
- t.Error(partitioner, err)
- }
- if choice != 0 {
- t.Error("Returned non-zero partition when only one available.")
- }
-
- for i := 1; i < 50; i++ {
- choice, err := partitioner.Partition(&ProducerMessage{}, 50)
- if err != nil {
- t.Error(partitioner, err)
- }
- if choice < 0 || choice >= 50 {
- t.Error("Returned partition", choice, "outside of range for nil key.")
- }
- }
-
- buf := make([]byte, 256)
- for i := 1; i < 50; i++ {
- if _, err := rand.Read(buf); err != nil {
- t.Error(err)
- }
- assertPartitioningConsistent(t, partitioner, &ProducerMessage{Key: ByteEncoder(buf)}, 50)
- }
-}
-
-func TestHashPartitionerMinInt32(t *testing.T) {
- partitioner := NewHashPartitioner("mytopic")
-
- msg := ProducerMessage{}
- // "1468509572224" generates 2147483648 (uint32) result from Sum32 function
- // which is -2147483648 or int32's min value
- msg.Key = StringEncoder("1468509572224")
-
- choice, err := partitioner.Partition(&msg, 50)
- if err != nil {
- t.Error(partitioner, err)
- }
- if choice < 0 || choice >= 50 {
- t.Error("Returned partition", choice, "outside of range for nil key.")
- }
-}
-
-func TestManualPartitioner(t *testing.T) {
- partitioner := NewManualPartitioner("mytopic")
-
- choice, err := partitioner.Partition(&ProducerMessage{}, 1)
- if err != nil {
- t.Error(partitioner, err)
- }
- if choice != 0 {
- t.Error("Returned non-zero partition when only one available.")
- }
-
- for i := int32(1); i < 50; i++ {
- choice, err := partitioner.Partition(&ProducerMessage{Partition: i}, 50)
- if err != nil {
- t.Error(partitioner, err)
- }
- if choice != i {
- t.Error("Returned partition not the same as the input partition")
- }
- }
-}
-
-// By default, Sarama uses the message's key to consistently assign a partition to
-// a message using hashing. If no key is set, a random partition will be chosen.
-// This example shows how you can partition messages randomly, even when a key is set,
-// by overriding Config.Producer.Partitioner.
-func ExamplePartitioner_random() {
- config := NewConfig()
- config.Producer.Partitioner = NewRandomPartitioner
-
- producer, err := NewSyncProducer([]string{"localhost:9092"}, config)
- if err != nil {
- log.Fatal(err)
- }
- defer func() {
- if err := producer.Close(); err != nil {
- log.Println("Failed to close producer:", err)
- }
- }()
-
- msg := &ProducerMessage{Topic: "test", Key: StringEncoder("key is set"), Value: StringEncoder("test")}
- partition, offset, err := producer.SendMessage(msg)
- if err != nil {
- log.Fatalln("Failed to produce message to kafka cluster.")
- }
-
- log.Printf("Produced message to partition %d with offset %d", partition, offset)
-}
-
-// This example shows how to assign partitions to your messages manually.
-func ExamplePartitioner_manual() {
- config := NewConfig()
-
- // First, we tell the producer that we are going to partition ourselves.
- config.Producer.Partitioner = NewManualPartitioner
-
- producer, err := NewSyncProducer([]string{"localhost:9092"}, config)
- if err != nil {
- log.Fatal(err)
- }
- defer func() {
- if err := producer.Close(); err != nil {
- log.Println("Failed to close producer:", err)
- }
- }()
-
- // Now, we set the Partition field of the ProducerMessage struct.
- msg := &ProducerMessage{Topic: "test", Partition: 6, Value: StringEncoder("test")}
-
- partition, offset, err := producer.SendMessage(msg)
- if err != nil {
- log.Fatalln("Failed to produce message to kafka cluster.")
- }
-
- if partition != 6 {
- log.Fatal("Message should have been produced to partition 6!")
- }
-
- log.Printf("Produced message to partition %d with offset %d", partition, offset)
-}
-
-// This example shows how to set a different partitioner depending on the topic.
-func ExamplePartitioner_per_topic() {
- config := NewConfig()
- config.Producer.Partitioner = func(topic string) Partitioner {
- switch topic {
- case "access_log", "error_log":
- return NewRandomPartitioner(topic)
-
- default:
- return NewHashPartitioner(topic)
- }
- }
-
- // ...
-}
diff --git a/vendor/github.com/Shopify/sarama/produce_request_test.go b/vendor/github.com/Shopify/sarama/produce_request_test.go
deleted file mode 100644
index b9896eb61..000000000
--- a/vendor/github.com/Shopify/sarama/produce_request_test.go
+++ /dev/null
@@ -1,106 +0,0 @@
-package sarama
-
-import (
- "testing"
- "time"
-)
-
-var (
- produceRequestEmpty = []byte{
- 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00}
-
- produceRequestHeader = []byte{
- 0x01, 0x23,
- 0x00, 0x00, 0x04, 0x44,
- 0x00, 0x00, 0x00, 0x00}
-
- produceRequestOneMessage = []byte{
- 0x01, 0x23,
- 0x00, 0x00, 0x04, 0x44,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x05, 't', 'o', 'p', 'i', 'c',
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0xAD,
- 0x00, 0x00, 0x00, 0x1C,
- // messageSet
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x10,
- // message
- 0x23, 0x96, 0x4a, 0xf7, // CRC
- 0x00,
- 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF,
- 0x00, 0x00, 0x00, 0x02, 0x00, 0xEE}
-
- produceRequestOneRecord = []byte{
- 0xFF, 0xFF, // Transaction ID
- 0x01, 0x23, // Required Acks
- 0x00, 0x00, 0x04, 0x44, // Timeout
- 0x00, 0x00, 0x00, 0x01, // Number of Topics
- 0x00, 0x05, 't', 'o', 'p', 'i', 'c', // Topic
- 0x00, 0x00, 0x00, 0x01, // Number of Partitions
- 0x00, 0x00, 0x00, 0xAD, // Partition
- 0x00, 0x00, 0x00, 0x52, // Records length
- // recordBatch
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x46,
- 0x00, 0x00, 0x00, 0x00,
- 0x02,
- 0xCA, 0x33, 0xBC, 0x05,
- 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x01, 0x58, 0x8D, 0xCD, 0x59, 0x38,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x01,
- // record
- 0x28,
- 0x00,
- 0x0A,
- 0x00,
- 0x08, 0x01, 0x02, 0x03, 0x04,
- 0x06, 0x05, 0x06, 0x07,
- 0x02,
- 0x06, 0x08, 0x09, 0x0A,
- 0x04, 0x0B, 0x0C,
- }
-)
-
-func TestProduceRequest(t *testing.T) {
- request := new(ProduceRequest)
- testRequest(t, "empty", request, produceRequestEmpty)
-
- request.RequiredAcks = 0x123
- request.Timeout = 0x444
- testRequest(t, "header", request, produceRequestHeader)
-
- request.AddMessage("topic", 0xAD, &Message{Codec: CompressionNone, Key: nil, Value: []byte{0x00, 0xEE}})
- testRequest(t, "one message", request, produceRequestOneMessage)
-
- request.Version = 3
- batch := &RecordBatch{
- LastOffsetDelta: 1,
- Version: 2,
- FirstTimestamp: time.Unix(1479847795, 0),
- MaxTimestamp: time.Unix(0, 0),
- Records: []*Record{{
- TimestampDelta: 5 * time.Millisecond,
- Key: []byte{0x01, 0x02, 0x03, 0x04},
- Value: []byte{0x05, 0x06, 0x07},
- Headers: []*RecordHeader{{
- Key: []byte{0x08, 0x09, 0x0A},
- Value: []byte{0x0B, 0x0C},
- }},
- }},
- }
- request.AddBatch("topic", 0xAD, batch)
- packet := testRequestEncode(t, "one record", request, produceRequestOneRecord)
- // compressRecords field is not populated on decoding because consumers
- // are only interested in decoded records.
- batch.compressedRecords = nil
- testRequestDecode(t, "one record", request, packet)
-}
diff --git a/vendor/github.com/Shopify/sarama/produce_response_test.go b/vendor/github.com/Shopify/sarama/produce_response_test.go
deleted file mode 100644
index 197c7fb50..000000000
--- a/vendor/github.com/Shopify/sarama/produce_response_test.go
+++ /dev/null
@@ -1,128 +0,0 @@
-package sarama
-
-import (
- "fmt"
- "testing"
- "time"
-)
-
-var (
- produceResponseNoBlocksV0 = []byte{
- 0x00, 0x00, 0x00, 0x00}
-
- produceResponseManyBlocksVersions = [][]byte{
- {
- 0x00, 0x00, 0x00, 0x01,
-
- 0x00, 0x03, 'f', 'o', 'o',
- 0x00, 0x00, 0x00, 0x01,
-
- 0x00, 0x00, 0x00, 0x01, // Partition 1
- 0x00, 0x02, // ErrInvalidMessage
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, // Offset 255
- }, {
- 0x00, 0x00, 0x00, 0x01,
-
- 0x00, 0x03, 'f', 'o', 'o',
- 0x00, 0x00, 0x00, 0x01,
-
- 0x00, 0x00, 0x00, 0x01, // Partition 1
- 0x00, 0x02, // ErrInvalidMessage
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, // Offset 255
-
- 0x00, 0x00, 0x00, 0x64, // 100 ms throttle time
- }, {
- 0x00, 0x00, 0x00, 0x01,
-
- 0x00, 0x03, 'f', 'o', 'o',
- 0x00, 0x00, 0x00, 0x01,
-
- 0x00, 0x00, 0x00, 0x01, // Partition 1
- 0x00, 0x02, // ErrInvalidMessage
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, // Offset 255
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xE8, // Timestamp January 1st 0001 at 00:00:01,000 UTC (LogAppendTime was used)
-
- 0x00, 0x00, 0x00, 0x64, // 100 ms throttle time
- },
- }
-)
-
-func TestProduceResponseDecode(t *testing.T) {
- response := ProduceResponse{}
-
- testVersionDecodable(t, "no blocks", &response, produceResponseNoBlocksV0, 0)
- if len(response.Blocks) != 0 {
- t.Error("Decoding produced", len(response.Blocks), "topics where there were none")
- }
-
- for v, produceResponseManyBlocks := range produceResponseManyBlocksVersions {
- t.Logf("Decoding produceResponseManyBlocks version %d", v)
- testVersionDecodable(t, "many blocks", &response, produceResponseManyBlocks, int16(v))
- if len(response.Blocks) != 1 {
- t.Error("Decoding produced", len(response.Blocks), "topics where there was 1")
- }
- if len(response.Blocks["foo"]) != 1 {
- t.Error("Decoding produced", len(response.Blocks["foo"]), "partitions for 'foo' where there was one")
- }
- block := response.GetBlock("foo", 1)
- if block == nil {
- t.Error("Decoding did not produce a block for foo/1")
- } else {
- if block.Err != ErrInvalidMessage {
- t.Error("Decoding failed for foo/2/Err, got:", int16(block.Err))
- }
- if block.Offset != 255 {
- t.Error("Decoding failed for foo/1/Offset, got:", block.Offset)
- }
- if v >= 2 {
- if block.Timestamp != time.Unix(1, 0) {
- t.Error("Decoding failed for foo/2/Timestamp, got:", block.Timestamp)
- }
- }
- }
- if v >= 1 {
- if expected := 100 * time.Millisecond; response.ThrottleTime != expected {
- t.Error("Failed decoding produced throttle time, expected:", expected, ", got:", response.ThrottleTime)
- }
- }
- }
-}
-
-func TestProduceResponseEncode(t *testing.T) {
- response := ProduceResponse{}
- response.Blocks = make(map[string]map[int32]*ProduceResponseBlock)
- testEncodable(t, "empty", &response, produceResponseNoBlocksV0)
-
- response.Blocks["foo"] = make(map[int32]*ProduceResponseBlock)
- response.Blocks["foo"][1] = &ProduceResponseBlock{
- Err: ErrInvalidMessage,
- Offset: 255,
- Timestamp: time.Unix(1, 0),
- }
- response.ThrottleTime = 100 * time.Millisecond
- for v, produceResponseManyBlocks := range produceResponseManyBlocksVersions {
- response.Version = int16(v)
- testEncodable(t, fmt.Sprintf("many blocks version %d", v), &response, produceResponseManyBlocks)
- }
-}
-
-func TestProduceResponseEncodeInvalidTimestamp(t *testing.T) {
- response := ProduceResponse{}
- response.Version = 2
- response.Blocks = make(map[string]map[int32]*ProduceResponseBlock)
- response.Blocks["t"] = make(map[int32]*ProduceResponseBlock)
- response.Blocks["t"][0] = &ProduceResponseBlock{
- Err: ErrNoError,
- Offset: 0,
- // Use a timestamp before Unix time
- Timestamp: time.Unix(0, 0).Add(-1 * time.Millisecond),
- }
- response.ThrottleTime = 100 * time.Millisecond
- _, err := encode(&response, nil)
- if err == nil {
- t.Error("Expecting error, got nil")
- }
- if _, ok := err.(PacketEncodingError); !ok {
- t.Error("Expecting PacketEncodingError, got:", err)
- }
-}
diff --git a/vendor/github.com/Shopify/sarama/produce_set_test.go b/vendor/github.com/Shopify/sarama/produce_set_test.go
deleted file mode 100644
index 6663f36f7..000000000
--- a/vendor/github.com/Shopify/sarama/produce_set_test.go
+++ /dev/null
@@ -1,255 +0,0 @@
-package sarama
-
-import (
- "fmt"
- "testing"
- "time"
-)
-
-func makeProduceSet() (*asyncProducer, *produceSet) {
- parent := &asyncProducer{
- conf: NewConfig(),
- }
- return parent, newProduceSet(parent)
-}
-
-func safeAddMessage(t *testing.T, ps *produceSet, msg *ProducerMessage) {
- if err := ps.add(msg); err != nil {
- t.Error(err)
- }
-}
-
-func TestProduceSetInitial(t *testing.T) {
- _, ps := makeProduceSet()
-
- if !ps.empty() {
- t.Error("New produceSet should be empty")
- }
-
- if ps.readyToFlush() {
- t.Error("Empty produceSet must never be ready to flush")
- }
-}
-
-func TestProduceSetAddingMessages(t *testing.T) {
- parent, ps := makeProduceSet()
- parent.conf.Producer.Flush.MaxMessages = 1000
-
- msg := &ProducerMessage{Key: StringEncoder(TestMessage), Value: StringEncoder(TestMessage)}
- safeAddMessage(t, ps, msg)
-
- if ps.empty() {
- t.Error("set shouldn't be empty when a message is added")
- }
-
- if !ps.readyToFlush() {
- t.Error("by default set should be ready to flush when any message is in place")
- }
-
- for i := 0; i < 999; i++ {
- if ps.wouldOverflow(msg) {
- t.Error("set shouldn't fill up after only", i+1, "messages")
- }
- safeAddMessage(t, ps, msg)
- }
-
- if !ps.wouldOverflow(msg) {
- t.Error("set should be full after 1000 messages")
- }
-}
-
-func TestProduceSetPartitionTracking(t *testing.T) {
- _, ps := makeProduceSet()
-
- m1 := &ProducerMessage{Topic: "t1", Partition: 0}
- m2 := &ProducerMessage{Topic: "t1", Partition: 1}
- m3 := &ProducerMessage{Topic: "t2", Partition: 0}
- safeAddMessage(t, ps, m1)
- safeAddMessage(t, ps, m2)
- safeAddMessage(t, ps, m3)
-
- seenT1P0 := false
- seenT1P1 := false
- seenT2P0 := false
-
- ps.eachPartition(func(topic string, partition int32, msgs []*ProducerMessage) {
- if len(msgs) != 1 {
- t.Error("Wrong message count")
- }
-
- if topic == "t1" && partition == 0 {
- seenT1P0 = true
- } else if topic == "t1" && partition == 1 {
- seenT1P1 = true
- } else if topic == "t2" && partition == 0 {
- seenT2P0 = true
- }
- })
-
- if !seenT1P0 {
- t.Error("Didn't see t1p0")
- }
- if !seenT1P1 {
- t.Error("Didn't see t1p1")
- }
- if !seenT2P0 {
- t.Error("Didn't see t2p0")
- }
-
- if len(ps.dropPartition("t1", 1)) != 1 {
- t.Error("Got wrong messages back from dropping partition")
- }
-
- if ps.bufferCount != 2 {
- t.Error("Incorrect buffer count after dropping partition")
- }
-}
-
-func TestProduceSetRequestBuilding(t *testing.T) {
- parent, ps := makeProduceSet()
- parent.conf.Producer.RequiredAcks = WaitForAll
- parent.conf.Producer.Timeout = 10 * time.Second
-
- msg := &ProducerMessage{
- Topic: "t1",
- Partition: 0,
- Key: StringEncoder(TestMessage),
- Value: StringEncoder(TestMessage),
- }
- for i := 0; i < 10; i++ {
- safeAddMessage(t, ps, msg)
- }
- msg.Partition = 1
- for i := 0; i < 10; i++ {
- safeAddMessage(t, ps, msg)
- }
- msg.Topic = "t2"
- for i := 0; i < 10; i++ {
- safeAddMessage(t, ps, msg)
- }
-
- req := ps.buildRequest()
-
- if req.RequiredAcks != WaitForAll {
- t.Error("RequiredAcks not set properly")
- }
-
- if req.Timeout != 10000 {
- t.Error("Timeout not set properly")
- }
-
- if len(req.records) != 2 {
- t.Error("Wrong number of topics in request")
- }
-}
-
-func TestProduceSetCompressedRequestBuilding(t *testing.T) {
- parent, ps := makeProduceSet()
- parent.conf.Producer.RequiredAcks = WaitForAll
- parent.conf.Producer.Timeout = 10 * time.Second
- parent.conf.Producer.Compression = CompressionGZIP
- parent.conf.Version = V0_10_0_0
-
- msg := &ProducerMessage{
- Topic: "t1",
- Partition: 0,
- Key: StringEncoder(TestMessage),
- Value: StringEncoder(TestMessage),
- Timestamp: time.Now(),
- }
- for i := 0; i < 10; i++ {
- safeAddMessage(t, ps, msg)
- }
-
- req := ps.buildRequest()
-
- if req.Version != 2 {
- t.Error("Wrong request version")
- }
-
- for _, msgBlock := range req.records["t1"][0].MsgSet.Messages {
- msg := msgBlock.Msg
- err := msg.decodeSet()
- if err != nil {
- t.Error("Failed to decode set from payload")
- }
- for i, compMsgBlock := range msg.Set.Messages {
- compMsg := compMsgBlock.Msg
- if compMsg.Version != 1 {
- t.Error("Wrong compressed message version")
- }
- if compMsgBlock.Offset != int64(i) {
- t.Errorf("Wrong relative inner offset, expected %d, got %d", i, compMsgBlock.Offset)
- }
- }
- if msg.Version != 1 {
- t.Error("Wrong compressed parent message version")
- }
- }
-}
-
-func TestProduceSetV3RequestBuilding(t *testing.T) {
- parent, ps := makeProduceSet()
- parent.conf.Producer.RequiredAcks = WaitForAll
- parent.conf.Producer.Timeout = 10 * time.Second
- parent.conf.Version = V0_11_0_0
-
- now := time.Now()
- msg := &ProducerMessage{
- Topic: "t1",
- Partition: 0,
- Key: StringEncoder(TestMessage),
- Value: StringEncoder(TestMessage),
- Headers: []RecordHeader{
- RecordHeader{
- Key: []byte("header-1"),
- Value: []byte("value-1"),
- },
- RecordHeader{
- Key: []byte("header-2"),
- Value: []byte("value-2"),
- },
- RecordHeader{
- Key: []byte("header-3"),
- Value: []byte("value-3"),
- },
- },
- Timestamp: now,
- }
- for i := 0; i < 10; i++ {
- safeAddMessage(t, ps, msg)
- msg.Timestamp = msg.Timestamp.Add(time.Second)
- }
-
- req := ps.buildRequest()
-
- if req.Version != 3 {
- t.Error("Wrong request version")
- }
-
- batch := req.records["t1"][0].RecordBatch
- if batch.FirstTimestamp != now {
- t.Errorf("Wrong first timestamp: %v", batch.FirstTimestamp)
- }
- for i := 0; i < 10; i++ {
- rec := batch.Records[i]
- if rec.TimestampDelta != time.Duration(i)*time.Second {
- t.Errorf("Wrong timestamp delta: %v", rec.TimestampDelta)
- }
-
- if rec.OffsetDelta != int64(i) {
- t.Errorf("Wrong relative inner offset, expected %d, got %d", i, rec.OffsetDelta)
- }
-
- for j, h := range batch.Records[i].Headers {
- exp := fmt.Sprintf("header-%d", j+1)
- if string(h.Key) != exp {
- t.Errorf("Wrong header key, expected %v, got %v", exp, h.Key)
- }
- exp = fmt.Sprintf("value-%d", j+1)
- if string(h.Value) != exp {
- t.Errorf("Wrong header value, expected %v, got %v", exp, h.Value)
- }
- }
- }
-}
diff --git a/vendor/github.com/Shopify/sarama/record_test.go b/vendor/github.com/Shopify/sarama/record_test.go
deleted file mode 100644
index 2756c5b25..000000000
--- a/vendor/github.com/Shopify/sarama/record_test.go
+++ /dev/null
@@ -1,292 +0,0 @@
-package sarama
-
-import (
- "reflect"
- "runtime"
- "strconv"
- "strings"
- "testing"
- "time"
-
- "github.com/davecgh/go-spew/spew"
-)
-
-var recordBatchTestCases = []struct {
- name string
- batch RecordBatch
- encoded []byte
- oldGoEncoded []byte // used in case of gzipped content for go versions prior to 1.8
-}{
- {
- name: "empty record",
- batch: RecordBatch{
- Version: 2,
- FirstTimestamp: time.Unix(0, 0),
- MaxTimestamp: time.Unix(0, 0),
- Records: []*Record{},
- },
- encoded: []byte{
- 0, 0, 0, 0, 0, 0, 0, 0, // First Offset
- 0, 0, 0, 49, // Length
- 0, 0, 0, 0, // Partition Leader Epoch
- 2, // Version
- 89, 95, 183, 221, // CRC
- 0, 0, // Attributes
- 0, 0, 0, 0, // Last Offset Delta
- 0, 0, 0, 0, 0, 0, 0, 0, // First Timestamp
- 0, 0, 0, 0, 0, 0, 0, 0, // Max Timestamp
- 0, 0, 0, 0, 0, 0, 0, 0, // Producer ID
- 0, 0, // Producer Epoch
- 0, 0, 0, 0, // First Sequence
- 0, 0, 0, 0, // Number of Records
- },
- },
- {
- name: "control batch",
- batch: RecordBatch{
- Version: 2,
- Control: true,
- FirstTimestamp: time.Unix(0, 0),
- MaxTimestamp: time.Unix(0, 0),
- Records: []*Record{},
- },
- encoded: []byte{
- 0, 0, 0, 0, 0, 0, 0, 0, // First Offset
- 0, 0, 0, 49, // Length
- 0, 0, 0, 0, // Partition Leader Epoch
- 2, // Version
- 81, 46, 67, 217, // CRC
- 0, 32, // Attributes
- 0, 0, 0, 0, // Last Offset Delta
- 0, 0, 0, 0, 0, 0, 0, 0, // First Timestamp
- 0, 0, 0, 0, 0, 0, 0, 0, // Max Timestamp
- 0, 0, 0, 0, 0, 0, 0, 0, // Producer ID
- 0, 0, // Producer Epoch
- 0, 0, 0, 0, // First Sequence
- 0, 0, 0, 0, // Number of Records
- },
- },
- {
- name: "uncompressed record",
- batch: RecordBatch{
- Version: 2,
- FirstTimestamp: time.Unix(1479847795, 0),
- MaxTimestamp: time.Unix(0, 0),
- LastOffsetDelta: 0,
- Records: []*Record{{
- TimestampDelta: 5 * time.Millisecond,
- Key: []byte{1, 2, 3, 4},
- Value: []byte{5, 6, 7},
- Headers: []*RecordHeader{{
- Key: []byte{8, 9, 10},
- Value: []byte{11, 12},
- }},
- }},
- recordsLen: 21,
- },
- encoded: []byte{
- 0, 0, 0, 0, 0, 0, 0, 0, // First Offset
- 0, 0, 0, 70, // Length
- 0, 0, 0, 0, // Partition Leader Epoch
- 2, // Version
- 84, 121, 97, 253, // CRC
- 0, 0, // Attributes
- 0, 0, 0, 0, // Last Offset Delta
- 0, 0, 1, 88, 141, 205, 89, 56, // First Timestamp
- 0, 0, 0, 0, 0, 0, 0, 0, // Max Timestamp
- 0, 0, 0, 0, 0, 0, 0, 0, // Producer ID
- 0, 0, // Producer Epoch
- 0, 0, 0, 0, // First Sequence
- 0, 0, 0, 1, // Number of Records
- 40, // Record Length
- 0, // Attributes
- 10, // Timestamp Delta
- 0, // Offset Delta
- 8, // Key Length
- 1, 2, 3, 4,
- 6, // Value Length
- 5, 6, 7,
- 2, // Number of Headers
- 6, // Header Key Length
- 8, 9, 10, // Header Key
- 4, // Header Value Length
- 11, 12, // Header Value
- },
- },
- {
- name: "gzipped record",
- batch: RecordBatch{
- Version: 2,
- Codec: CompressionGZIP,
- CompressionLevel: CompressionLevelDefault,
- FirstTimestamp: time.Unix(1479847795, 0),
- MaxTimestamp: time.Unix(0, 0),
- LastOffsetDelta: 0,
- Records: []*Record{{
- TimestampDelta: 5 * time.Millisecond,
- Key: []byte{1, 2, 3, 4},
- Value: []byte{5, 6, 7},
- Headers: []*RecordHeader{{
- Key: []byte{8, 9, 10},
- Value: []byte{11, 12},
- }},
- }},
- recordsLen: 21,
- },
- encoded: []byte{
- 0, 0, 0, 0, 0, 0, 0, 0, // First Offset
- 0, 0, 0, 94, // Length
- 0, 0, 0, 0, // Partition Leader Epoch
- 2, // Version
- 159, 236, 182, 189, // CRC
- 0, 1, // Attributes
- 0, 0, 0, 0, // Last Offset Delta
- 0, 0, 1, 88, 141, 205, 89, 56, // First Timestamp
- 0, 0, 0, 0, 0, 0, 0, 0, // Max Timestamp
- 0, 0, 0, 0, 0, 0, 0, 0, // Producer ID
- 0, 0, // Producer Epoch
- 0, 0, 0, 0, // First Sequence
- 0, 0, 0, 1, // Number of Records
- 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 210, 96, 224, 98, 224, 96, 100, 98, 102, 97, 99, 101,
- 99, 103, 98, 227, 224, 228, 98, 225, 230, 1, 4, 0, 0, 255, 255, 173, 201, 88, 103, 21, 0, 0, 0,
- },
- oldGoEncoded: []byte{
- 0, 0, 0, 0, 0, 0, 0, 0, // First Offset
- 0, 0, 0, 94, // Length
- 0, 0, 0, 0, // Partition Leader Epoch
- 2, // Version
- 0, 216, 14, 210, // CRC
- 0, 1, // Attributes
- 0, 0, 0, 0, // Last Offset Delta
- 0, 0, 1, 88, 141, 205, 89, 56, // First Timestamp
- 0, 0, 0, 0, 0, 0, 0, 0, // Max Timestamp
- 0, 0, 0, 0, 0, 0, 0, 0, // Producer ID
- 0, 0, // Producer Epoch
- 0, 0, 0, 0, // First Sequence
- 0, 0, 0, 1, // Number of Records
- 31, 139, 8, 0, 0, 9, 110, 136, 0, 255, 210, 96, 224, 98, 224, 96, 100, 98, 102, 97, 99, 101,
- 99, 103, 98, 227, 224, 228, 98, 225, 230, 1, 4, 0, 0, 255, 255, 173, 201, 88, 103, 21, 0, 0, 0,
- },
- },
- {
- name: "snappy compressed record",
- batch: RecordBatch{
- Version: 2,
- Codec: CompressionSnappy,
- FirstTimestamp: time.Unix(1479847795, 0),
- MaxTimestamp: time.Unix(0, 0),
- LastOffsetDelta: 0,
- Records: []*Record{{
- TimestampDelta: 5 * time.Millisecond,
- Key: []byte{1, 2, 3, 4},
- Value: []byte{5, 6, 7},
- Headers: []*RecordHeader{{
- Key: []byte{8, 9, 10},
- Value: []byte{11, 12},
- }},
- }},
- recordsLen: 21,
- },
- encoded: []byte{
- 0, 0, 0, 0, 0, 0, 0, 0, // First Offset
- 0, 0, 0, 72, // Length
- 0, 0, 0, 0, // Partition Leader Epoch
- 2, // Version
- 21, 0, 159, 97, // CRC
- 0, 2, // Attributes
- 0, 0, 0, 0, // Last Offset Delta
- 0, 0, 1, 88, 141, 205, 89, 56, // First Timestamp
- 0, 0, 0, 0, 0, 0, 0, 0, // Max Timestamp
- 0, 0, 0, 0, 0, 0, 0, 0, // Producer ID
- 0, 0, // Producer Epoch
- 0, 0, 0, 0, // First Sequence
- 0, 0, 0, 1, // Number of Records
- 21, 80, 40, 0, 10, 0, 8, 1, 2, 3, 4, 6, 5, 6, 7, 2, 6, 8, 9, 10, 4, 11, 12,
- },
- },
- {
- name: "lz4 compressed record",
- batch: RecordBatch{
- Version: 2,
- Codec: CompressionLZ4,
- FirstTimestamp: time.Unix(1479847795, 0),
- MaxTimestamp: time.Unix(0, 0),
- LastOffsetDelta: 0,
- Records: []*Record{{
- TimestampDelta: 5 * time.Millisecond,
- Key: []byte{1, 2, 3, 4},
- Value: []byte{5, 6, 7},
- Headers: []*RecordHeader{{
- Key: []byte{8, 9, 10},
- Value: []byte{11, 12},
- }},
- }},
- recordsLen: 21,
- },
- encoded: []byte{
- 0, 0, 0, 0, 0, 0, 0, 0, // First Offset
- 0, 0, 0, 89, // Length
- 0, 0, 0, 0, // Partition Leader Epoch
- 2, // Version
- 169, 74, 119, 197, // CRC
- 0, 3, // Attributes
- 0, 0, 0, 0, // Last Offset Delta
- 0, 0, 1, 88, 141, 205, 89, 56, // First Timestamp
- 0, 0, 0, 0, 0, 0, 0, 0, // Max Timestamp
- 0, 0, 0, 0, 0, 0, 0, 0, // Producer ID
- 0, 0, // Producer Epoch
- 0, 0, 0, 0, // First Sequence
- 0, 0, 0, 1, // Number of Records
- 4, 34, 77, 24, 100, 112, 185, 21, 0, 0, 128, 40, 0, 10, 0, 8, 1, 2, 3, 4, 6, 5, 6, 7, 2,
- 6, 8, 9, 10, 4, 11, 12, 0, 0, 0, 0, 12, 59, 239, 146,
- },
- },
-}
-
-func isOldGo(t *testing.T) bool {
- v := strings.Split(runtime.Version()[2:], ".")
- if len(v) < 2 {
- t.Logf("Can't parse version: %s", runtime.Version())
- return false
- }
- maj, err := strconv.Atoi(v[0])
- if err != nil {
- t.Logf("Can't parse version: %s", runtime.Version())
- return false
- }
- min, err := strconv.Atoi(v[1])
- if err != nil {
- t.Logf("Can't parse version: %s", runtime.Version())
- return false
- }
- return maj < 1 || (maj == 1 && min < 8)
-}
-
-func TestRecordBatchEncoding(t *testing.T) {
- for _, tc := range recordBatchTestCases {
- if tc.oldGoEncoded != nil && isOldGo(t) {
- testEncodable(t, tc.name, &tc.batch, tc.oldGoEncoded)
- } else {
- testEncodable(t, tc.name, &tc.batch, tc.encoded)
- }
- }
-}
-
-func TestRecordBatchDecoding(t *testing.T) {
- for _, tc := range recordBatchTestCases {
- batch := RecordBatch{}
- testDecodable(t, tc.name, &batch, tc.encoded)
- for _, r := range batch.Records {
- r.length = varintLengthField{}
- }
- for _, r := range tc.batch.Records {
- r.length = varintLengthField{}
- }
- // The compression level is not restored on decoding. It is not needed
- // anyway. We only set it here to ensure that comparision succeeds.
- batch.CompressionLevel = tc.batch.CompressionLevel
- if !reflect.DeepEqual(batch, tc.batch) {
- t.Errorf(spew.Sprintf("invalid decode of %s\ngot %+v\nwanted %+v", tc.name, batch, tc.batch))
- }
- }
-}
diff --git a/vendor/github.com/Shopify/sarama/records_test.go b/vendor/github.com/Shopify/sarama/records_test.go
deleted file mode 100644
index cd6aa2784..000000000
--- a/vendor/github.com/Shopify/sarama/records_test.go
+++ /dev/null
@@ -1,143 +0,0 @@
-package sarama
-
-import (
- "bytes"
- "reflect"
- "testing"
-)
-
-func TestLegacyRecords(t *testing.T) {
- set := &MessageSet{
- Messages: []*MessageBlock{
- {
- Msg: &Message{
- Version: 1,
- },
- },
- },
- }
- r := newLegacyRecords(set)
-
- exp, err := encode(set, nil)
- if err != nil {
- t.Fatal(err)
- }
- buf, err := encode(&r, nil)
- if err != nil {
- t.Fatal(err)
- }
- if !bytes.Equal(buf, exp) {
- t.Errorf("Wrong encoding for legacy records, wanted %v, got %v", exp, buf)
- }
-
- set = &MessageSet{}
- r = Records{}
-
- err = decode(exp, set)
- if err != nil {
- t.Fatal(err)
- }
- err = decode(buf, &r)
- if err != nil {
- t.Fatal(err)
- }
-
- if r.recordsType != legacyRecords {
- t.Fatalf("Wrong records type %v, expected %v", r.recordsType, legacyRecords)
- }
- if !reflect.DeepEqual(set, r.MsgSet) {
- t.Errorf("Wrong decoding for legacy records, wanted %#+v, got %#+v", set, r.MsgSet)
- }
-
- n, err := r.numRecords()
- if err != nil {
- t.Fatal(err)
- }
- if n != 1 {
- t.Errorf("Wrong number of records, wanted 1, got %d", n)
- }
-
- p, err := r.isPartial()
- if err != nil {
- t.Fatal(err)
- }
- if p {
- t.Errorf("MessageSet shouldn't have a partial trailing message")
- }
-
- c, err := r.isControl()
- if err != nil {
- t.Fatal(err)
- }
- if c {
- t.Errorf("MessageSet can't be a control batch")
- }
-}
-
-func TestDefaultRecords(t *testing.T) {
- batch := &RecordBatch{
- Version: 2,
- Records: []*Record{
- {
- Value: []byte{1},
- },
- },
- }
-
- r := newDefaultRecords(batch)
-
- exp, err := encode(batch, nil)
- if err != nil {
- t.Fatal(err)
- }
- buf, err := encode(&r, nil)
- if err != nil {
- t.Fatal(err)
- }
- if !bytes.Equal(buf, exp) {
- t.Errorf("Wrong encoding for default records, wanted %v, got %v", exp, buf)
- }
-
- batch = &RecordBatch{}
- r = Records{}
-
- err = decode(exp, batch)
- if err != nil {
- t.Fatal(err)
- }
- err = decode(buf, &r)
- if err != nil {
- t.Fatal(err)
- }
-
- if r.recordsType != defaultRecords {
- t.Fatalf("Wrong records type %v, expected %v", r.recordsType, defaultRecords)
- }
- if !reflect.DeepEqual(batch, r.RecordBatch) {
- t.Errorf("Wrong decoding for default records, wanted %#+v, got %#+v", batch, r.RecordBatch)
- }
-
- n, err := r.numRecords()
- if err != nil {
- t.Fatal(err)
- }
- if n != 1 {
- t.Errorf("Wrong number of records, wanted 1, got %d", n)
- }
-
- p, err := r.isPartial()
- if err != nil {
- t.Fatal(err)
- }
- if p {
- t.Errorf("RecordBatch shouldn't have a partial trailing record")
- }
-
- c, err := r.isControl()
- if err != nil {
- t.Fatal(err)
- }
- if c {
- t.Errorf("RecordBatch shouldn't be a control batch")
- }
-}
diff --git a/vendor/github.com/Shopify/sarama/request_test.go b/vendor/github.com/Shopify/sarama/request_test.go
deleted file mode 100644
index ffc2bb7a8..000000000
--- a/vendor/github.com/Shopify/sarama/request_test.go
+++ /dev/null
@@ -1,105 +0,0 @@
-package sarama
-
-import (
- "bytes"
- "reflect"
- "testing"
-
- "github.com/davecgh/go-spew/spew"
-)
-
-type testRequestBody struct {
-}
-
-func (s *testRequestBody) key() int16 {
- return 0x666
-}
-
-func (s *testRequestBody) version() int16 {
- return 0xD2
-}
-
-func (s *testRequestBody) encode(pe packetEncoder) error {
- return pe.putString("abc")
-}
-
-// not specific to request tests, just helper functions for testing structures that
-// implement the encoder or decoder interfaces that needed somewhere to live
-
-func testEncodable(t *testing.T, name string, in encoder, expect []byte) {
- packet, err := encode(in, nil)
- if err != nil {
- t.Error(err)
- } else if !bytes.Equal(packet, expect) {
- t.Error("Encoding", name, "failed\ngot ", packet, "\nwant", expect)
- }
-}
-
-func testDecodable(t *testing.T, name string, out decoder, in []byte) {
- err := decode(in, out)
- if err != nil {
- t.Error("Decoding", name, "failed:", err)
- }
-}
-
-func testVersionDecodable(t *testing.T, name string, out versionedDecoder, in []byte, version int16) {
- err := versionedDecode(in, out, version)
- if err != nil {
- t.Error("Decoding", name, "version", version, "failed:", err)
- }
-}
-
-func testRequest(t *testing.T, name string, rb protocolBody, expected []byte) {
- if !rb.requiredVersion().IsAtLeast(MinVersion) {
- t.Errorf("Request %s has invalid required version", name)
- }
- packet := testRequestEncode(t, name, rb, expected)
- testRequestDecode(t, name, rb, packet)
-}
-
-func testRequestEncode(t *testing.T, name string, rb protocolBody, expected []byte) []byte {
- req := &request{correlationID: 123, clientID: "foo", body: rb}
- packet, err := encode(req, nil)
- headerSize := 14 + len("foo")
- if err != nil {
- t.Error(err)
- } else if !bytes.Equal(packet[headerSize:], expected) {
- t.Error("Encoding", name, "failed\ngot ", packet[headerSize:], "\nwant", expected)
- }
- return packet
-}
-
-func testRequestDecode(t *testing.T, name string, rb protocolBody, packet []byte) {
- decoded, n, err := decodeRequest(bytes.NewReader(packet))
- if err != nil {
- t.Error("Failed to decode request", err)
- } else if decoded.correlationID != 123 || decoded.clientID != "foo" {
- t.Errorf("Decoded header %q is not valid: %+v", name, decoded)
- } else if !reflect.DeepEqual(rb, decoded.body) {
- t.Error(spew.Sprintf("Decoded request %q does not match the encoded one\nencoded: %+v\ndecoded: %+v", name, rb, decoded.body))
- } else if n != len(packet) {
- t.Errorf("Decoded request %q bytes: %d does not match the encoded one: %d\n", name, n, len(packet))
- } else if rb.version() != decoded.body.version() {
- t.Errorf("Decoded request %q version: %d does not match the encoded one: %d\n", name, decoded.body.version(), rb.version())
- }
-}
-
-func testResponse(t *testing.T, name string, res protocolBody, expected []byte) {
- encoded, err := encode(res, nil)
- if err != nil {
- t.Error(err)
- } else if expected != nil && !bytes.Equal(encoded, expected) {
- t.Error("Encoding", name, "failed\ngot ", encoded, "\nwant", expected)
- }
-
- decoded := reflect.New(reflect.TypeOf(res).Elem()).Interface().(versionedDecoder)
- if err := versionedDecode(encoded, decoded, res.version()); err != nil {
- t.Error("Decoding", name, "failed:", err)
- }
-
- if !reflect.DeepEqual(decoded, res) {
- t.Errorf("Decoded response does not match the encoded one\nencoded: %#v\ndecoded: %#v", res, decoded)
- }
-}
-
-func nullString(s string) *string { return &s }
diff --git a/vendor/github.com/Shopify/sarama/response_header_test.go b/vendor/github.com/Shopify/sarama/response_header_test.go
deleted file mode 100644
index 8f9fdb80c..000000000
--- a/vendor/github.com/Shopify/sarama/response_header_test.go
+++ /dev/null
@@ -1,21 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- responseHeaderBytes = []byte{
- 0x00, 0x00, 0x0f, 0x00,
- 0x0a, 0xbb, 0xcc, 0xff}
-)
-
-func TestResponseHeader(t *testing.T) {
- header := responseHeader{}
-
- testDecodable(t, "response header", &header, responseHeaderBytes)
- if header.length != 0xf00 {
- t.Error("Decoding header length failed, got", header.length)
- }
- if header.correlationID != 0x0abbccff {
- t.Error("Decoding header correlation id failed, got", header.correlationID)
- }
-}
diff --git a/vendor/github.com/Shopify/sarama/sasl_handshake_request_test.go b/vendor/github.com/Shopify/sarama/sasl_handshake_request_test.go
deleted file mode 100644
index 806e628fd..000000000
--- a/vendor/github.com/Shopify/sarama/sasl_handshake_request_test.go
+++ /dev/null
@@ -1,17 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- baseSaslRequest = []byte{
- 0, 3, 'f', 'o', 'o', // Mechanism
- }
-)
-
-func TestSaslHandshakeRequest(t *testing.T) {
- var request *SaslHandshakeRequest
-
- request = new(SaslHandshakeRequest)
- request.Mechanism = "foo"
- testRequest(t, "basic", request, baseSaslRequest)
-}
diff --git a/vendor/github.com/Shopify/sarama/sasl_handshake_response_test.go b/vendor/github.com/Shopify/sarama/sasl_handshake_response_test.go
deleted file mode 100644
index 1fd4c79e0..000000000
--- a/vendor/github.com/Shopify/sarama/sasl_handshake_response_test.go
+++ /dev/null
@@ -1,24 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- saslHandshakeResponse = []byte{
- 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x03, 'f', 'o', 'o',
- }
-)
-
-func TestSaslHandshakeResponse(t *testing.T) {
- var response *SaslHandshakeResponse
-
- response = new(SaslHandshakeResponse)
- testVersionDecodable(t, "no error", response, saslHandshakeResponse, 0)
- if response.Err != ErrNoError {
- t.Error("Decoding error failed: no error expected but found", response.Err)
- }
- if response.EnabledMechanisms[0] != "foo" {
- t.Error("Decoding error failed: expected 'foo' but found", response.EnabledMechanisms)
- }
-}
diff --git a/vendor/github.com/Shopify/sarama/sync_group_request_test.go b/vendor/github.com/Shopify/sarama/sync_group_request_test.go
deleted file mode 100644
index 3f537ef9f..000000000
--- a/vendor/github.com/Shopify/sarama/sync_group_request_test.go
+++ /dev/null
@@ -1,38 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- emptySyncGroupRequest = []byte{
- 0, 3, 'f', 'o', 'o', // Group ID
- 0x00, 0x01, 0x02, 0x03, // Generation ID
- 0, 3, 'b', 'a', 'z', // Member ID
- 0, 0, 0, 0, // no assignments
- }
-
- populatedSyncGroupRequest = []byte{
- 0, 3, 'f', 'o', 'o', // Group ID
- 0x00, 0x01, 0x02, 0x03, // Generation ID
- 0, 3, 'b', 'a', 'z', // Member ID
- 0, 0, 0, 1, // one assignment
- 0, 3, 'b', 'a', 'z', // Member ID
- 0, 0, 0, 3, 'f', 'o', 'o', // Member assignment
- }
-)
-
-func TestSyncGroupRequest(t *testing.T) {
- var request *SyncGroupRequest
-
- request = new(SyncGroupRequest)
- request.GroupId = "foo"
- request.GenerationId = 66051
- request.MemberId = "baz"
- testRequest(t, "empty", request, emptySyncGroupRequest)
-
- request = new(SyncGroupRequest)
- request.GroupId = "foo"
- request.GenerationId = 66051
- request.MemberId = "baz"
- request.AddGroupAssignment("baz", []byte("foo"))
- testRequest(t, "populated", request, populatedSyncGroupRequest)
-}
diff --git a/vendor/github.com/Shopify/sarama/sync_group_response_test.go b/vendor/github.com/Shopify/sarama/sync_group_response_test.go
deleted file mode 100644
index 6fb708858..000000000
--- a/vendor/github.com/Shopify/sarama/sync_group_response_test.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package sarama
-
-import (
- "reflect"
- "testing"
-)
-
-var (
- syncGroupResponseNoError = []byte{
- 0x00, 0x00, // No error
- 0, 0, 0, 3, 0x01, 0x02, 0x03, // Member assignment data
- }
-
- syncGroupResponseWithError = []byte{
- 0, 27, // ErrRebalanceInProgress
- 0, 0, 0, 0, // No member assignment data
- }
-)
-
-func TestSyncGroupResponse(t *testing.T) {
- var response *SyncGroupResponse
-
- response = new(SyncGroupResponse)
- testVersionDecodable(t, "no error", response, syncGroupResponseNoError, 0)
- if response.Err != ErrNoError {
- t.Error("Decoding Err failed: no error expected but found", response.Err)
- }
- if !reflect.DeepEqual(response.MemberAssignment, []byte{0x01, 0x02, 0x03}) {
- t.Error("Decoding MemberAssignment failed, found:", response.MemberAssignment)
- }
-
- response = new(SyncGroupResponse)
- testVersionDecodable(t, "no error", response, syncGroupResponseWithError, 0)
- if response.Err != ErrRebalanceInProgress {
- t.Error("Decoding Err failed: ErrRebalanceInProgress expected but found", response.Err)
- }
- if !reflect.DeepEqual(response.MemberAssignment, []byte{}) {
- t.Error("Decoding MemberAssignment failed, found:", response.MemberAssignment)
- }
-}
diff --git a/vendor/github.com/Shopify/sarama/sync_producer_test.go b/vendor/github.com/Shopify/sarama/sync_producer_test.go
deleted file mode 100644
index cb97548db..000000000
--- a/vendor/github.com/Shopify/sarama/sync_producer_test.go
+++ /dev/null
@@ -1,199 +0,0 @@
-package sarama
-
-import (
- "log"
- "sync"
- "testing"
-)
-
-func TestSyncProducer(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
- leader := NewMockBroker(t, 2)
-
- metadataResponse := new(MetadataResponse)
- metadataResponse.AddBroker(leader.Addr(), leader.BrokerID())
- metadataResponse.AddTopicPartition("my_topic", 0, leader.BrokerID(), nil, nil, ErrNoError)
- seedBroker.Returns(metadataResponse)
-
- prodSuccess := new(ProduceResponse)
- prodSuccess.AddTopicPartition("my_topic", 0, ErrNoError)
- for i := 0; i < 10; i++ {
- leader.Returns(prodSuccess)
- }
-
- producer, err := NewSyncProducer([]string{seedBroker.Addr()}, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- for i := 0; i < 10; i++ {
- msg := &ProducerMessage{
- Topic: "my_topic",
- Value: StringEncoder(TestMessage),
- Metadata: "test",
- }
-
- partition, offset, err := producer.SendMessage(msg)
-
- if partition != 0 || msg.Partition != partition {
- t.Error("Unexpected partition")
- }
- if offset != 0 || msg.Offset != offset {
- t.Error("Unexpected offset")
- }
- if str, ok := msg.Metadata.(string); !ok || str != "test" {
- t.Error("Unexpected metadata")
- }
- if err != nil {
- t.Error(err)
- }
- }
-
- safeClose(t, producer)
- leader.Close()
- seedBroker.Close()
-}
-
-func TestSyncProducerBatch(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
- leader := NewMockBroker(t, 2)
-
- metadataResponse := new(MetadataResponse)
- metadataResponse.AddBroker(leader.Addr(), leader.BrokerID())
- metadataResponse.AddTopicPartition("my_topic", 0, leader.BrokerID(), nil, nil, ErrNoError)
- seedBroker.Returns(metadataResponse)
-
- prodSuccess := new(ProduceResponse)
- prodSuccess.AddTopicPartition("my_topic", 0, ErrNoError)
- leader.Returns(prodSuccess)
-
- config := NewConfig()
- config.Producer.Flush.Messages = 3
- config.Producer.Return.Successes = true
- producer, err := NewSyncProducer([]string{seedBroker.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
-
- err = producer.SendMessages([]*ProducerMessage{
- {
- Topic: "my_topic",
- Value: StringEncoder(TestMessage),
- Metadata: "test",
- },
- {
- Topic: "my_topic",
- Value: StringEncoder(TestMessage),
- Metadata: "test",
- },
- {
- Topic: "my_topic",
- Value: StringEncoder(TestMessage),
- Metadata: "test",
- },
- })
-
- if err != nil {
- t.Error(err)
- }
-
- safeClose(t, producer)
- leader.Close()
- seedBroker.Close()
-}
-
-func TestConcurrentSyncProducer(t *testing.T) {
- seedBroker := NewMockBroker(t, 1)
- leader := NewMockBroker(t, 2)
-
- metadataResponse := new(MetadataResponse)
- metadataResponse.AddBroker(leader.Addr(), leader.BrokerID())
- metadataResponse.AddTopicPartition("my_topic", 0, leader.BrokerID(), nil, nil, ErrNoError)
- seedBroker.Returns(metadataResponse)
-
- prodSuccess := new(ProduceResponse)
- prodSuccess.AddTopicPartition("my_topic", 0, ErrNoError)
- leader.Returns(prodSuccess)
-
- config := NewConfig()
- config.Producer.Flush.Messages = 100
- config.Producer.Return.Successes = true
- producer, err := NewSyncProducer([]string{seedBroker.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
-
- wg := sync.WaitGroup{}
-
- for i := 0; i < 100; i++ {
- wg.Add(1)
- go func() {
- msg := &ProducerMessage{Topic: "my_topic", Value: StringEncoder(TestMessage)}
- partition, _, err := producer.SendMessage(msg)
- if partition != 0 {
- t.Error("Unexpected partition")
- }
- if err != nil {
- t.Error(err)
- }
- wg.Done()
- }()
- }
- wg.Wait()
-
- safeClose(t, producer)
- leader.Close()
- seedBroker.Close()
-}
-
-func TestSyncProducerToNonExistingTopic(t *testing.T) {
- broker := NewMockBroker(t, 1)
-
- metadataResponse := new(MetadataResponse)
- metadataResponse.AddBroker(broker.Addr(), broker.BrokerID())
- metadataResponse.AddTopicPartition("my_topic", 0, broker.BrokerID(), nil, nil, ErrNoError)
- broker.Returns(metadataResponse)
-
- config := NewConfig()
- config.Metadata.Retry.Max = 0
- config.Producer.Retry.Max = 0
- config.Producer.Return.Successes = true
-
- producer, err := NewSyncProducer([]string{broker.Addr()}, config)
- if err != nil {
- t.Fatal(err)
- }
-
- metadataResponse = new(MetadataResponse)
- metadataResponse.AddTopic("unknown", ErrUnknownTopicOrPartition)
- broker.Returns(metadataResponse)
-
- _, _, err = producer.SendMessage(&ProducerMessage{Topic: "unknown"})
- if err != ErrUnknownTopicOrPartition {
- t.Error("Uxpected ErrUnknownTopicOrPartition, found:", err)
- }
-
- safeClose(t, producer)
- broker.Close()
-}
-
-// This example shows the basic usage pattern of the SyncProducer.
-func ExampleSyncProducer() {
- producer, err := NewSyncProducer([]string{"localhost:9092"}, nil)
- if err != nil {
- log.Fatalln(err)
- }
- defer func() {
- if err := producer.Close(); err != nil {
- log.Fatalln(err)
- }
- }()
-
- msg := &ProducerMessage{Topic: "my_topic", Value: StringEncoder("testing 123")}
- partition, offset, err := producer.SendMessage(msg)
- if err != nil {
- log.Printf("FAILED to send message: %s\n", err)
- } else {
- log.Printf("> message sent to partition %d at offset %d\n", partition, offset)
- }
-}
diff --git a/vendor/github.com/Shopify/sarama/txn_offset_commit_request_test.go b/vendor/github.com/Shopify/sarama/txn_offset_commit_request_test.go
deleted file mode 100644
index fe3bba548..000000000
--- a/vendor/github.com/Shopify/sarama/txn_offset_commit_request_test.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package sarama
-
-import "testing"
-
-var (
- txnOffsetCommitRequest = []byte{
- 0, 3, 't', 'x', 'n',
- 0, 7, 'g', 'r', 'o', 'u', 'p', 'i', 'd',
- 0, 0, 0, 0, 0, 0, 31, 64, // producer ID
- 0, 1, // producer epoch
- 0, 0, 0, 1, // 1 topic
- 0, 5, 't', 'o', 'p', 'i', 'c',
- 0, 0, 0, 1, // 1 partition
- 0, 0, 0, 2, // partition no 2
- 0, 0, 0, 0, 0, 0, 0, 123,
- 255, 255, // no meta data
- }
-)
-
-func TestTxnOffsetCommitRequest(t *testing.T) {
- req := &TxnOffsetCommitRequest{
- TransactionalID: "txn",
- GroupID: "groupid",
- ProducerID: 8000,
- ProducerEpoch: 1,
- Topics: map[string][]*PartitionOffsetMetadata{
- "topic": []*PartitionOffsetMetadata{{
- Offset: 123,
- Partition: 2,
- }},
- },
- }
-
- testRequest(t, "", req, txnOffsetCommitRequest)
-}
diff --git a/vendor/github.com/Shopify/sarama/txn_offset_commit_response_test.go b/vendor/github.com/Shopify/sarama/txn_offset_commit_response_test.go
deleted file mode 100644
index b275265c6..000000000
--- a/vendor/github.com/Shopify/sarama/txn_offset_commit_response_test.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package sarama
-
-import (
- "testing"
- "time"
-)
-
-var (
- txnOffsetCommitResponse = []byte{
- 0, 0, 0, 100,
- 0, 0, 0, 1, // 1 topic
- 0, 5, 't', 'o', 'p', 'i', 'c',
- 0, 0, 0, 1, // 1 partition response
- 0, 0, 0, 2, // partition number 2
- 0, 47, // err
- }
-)
-
-func TestTxnOffsetCommitResponse(t *testing.T) {
- resp := &TxnOffsetCommitResponse{
- ThrottleTime: 100 * time.Millisecond,
- Topics: map[string][]*PartitionError{
- "topic": []*PartitionError{{
- Partition: 2,
- Err: ErrInvalidProducerEpoch,
- }},
- },
- }
-
- testResponse(t, "", resp, txnOffsetCommitResponse)
-}
diff --git a/vendor/github.com/Shopify/sarama/utils_test.go b/vendor/github.com/Shopify/sarama/utils_test.go
deleted file mode 100644
index 013620e55..000000000
--- a/vendor/github.com/Shopify/sarama/utils_test.go
+++ /dev/null
@@ -1,41 +0,0 @@
-package sarama
-
-import "testing"
-
-func TestVersionCompare(t *testing.T) {
- if V0_8_2_0.IsAtLeast(V0_8_2_1) {
- t.Error("0.8.2.0 >= 0.8.2.1")
- }
- if !V0_8_2_1.IsAtLeast(V0_8_2_0) {
- t.Error("! 0.8.2.1 >= 0.8.2.0")
- }
- if !V0_8_2_0.IsAtLeast(V0_8_2_0) {
- t.Error("! 0.8.2.0 >= 0.8.2.0")
- }
- if !V0_9_0_0.IsAtLeast(V0_8_2_1) {
- t.Error("! 0.9.0.0 >= 0.8.2.1")
- }
- if V0_8_2_1.IsAtLeast(V0_10_0_0) {
- t.Error("0.8.2.1 >= 0.10.0.0")
- }
-}
-
-func TestVersionParsing(t *testing.T) {
- validVersions := []string{"0.8.2.0", "0.8.2.1", "0.9.0.0", "0.10.2.0", "1.0.0"}
- for _, s := range validVersions {
- v, err := ParseKafkaVersion(s)
- if err != nil {
- t.Errorf("could not parse valid version %s: %s", s, err)
- }
- if v.String() != s {
- t.Errorf("version %s != %s", v.String(), s)
- }
- }
-
- invalidVersions := []string{"0.8.2-4", "0.8.20", "1.19.0.0", "1.0.x"}
- for _, s := range invalidVersions {
- if _, err := ParseKafkaVersion(s); err == nil {
- t.Errorf("invalid version %s parsed without error", s)
- }
- }
-}
diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/application_exception_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/application_exception_test.go
deleted file mode 100644
index 77433575d..000000000
--- a/vendor/github.com/apache/thrift/lib/go/thrift/application_exception_test.go
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package thrift
-
-import (
- "testing"
-)
-
-func TestTApplicationException(t *testing.T) {
- exc := NewTApplicationException(UNKNOWN_APPLICATION_EXCEPTION, "")
- if exc.Error() != defaultApplicationExceptionMessage[UNKNOWN_APPLICATION_EXCEPTION] {
- t.Fatalf("Expected empty string for exception but found '%s'", exc.Error())
- }
- if exc.TypeId() != UNKNOWN_APPLICATION_EXCEPTION {
- t.Fatalf("Expected type UNKNOWN for exception but found '%v'", exc.TypeId())
- }
- exc = NewTApplicationException(WRONG_METHOD_NAME, "junk_method")
- if exc.Error() != "junk_method" {
- t.Fatalf("Expected 'junk_method' for exception but found '%s'", exc.Error())
- }
- if exc.TypeId() != WRONG_METHOD_NAME {
- t.Fatalf("Expected type WRONG_METHOD_NAME for exception but found '%v'", exc.TypeId())
- }
-}
diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/binary_protocol_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/binary_protocol_test.go
deleted file mode 100644
index 0462cc79d..000000000
--- a/vendor/github.com/apache/thrift/lib/go/thrift/binary_protocol_test.go
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package thrift
-
-import (
- "testing"
-)
-
-func TestReadWriteBinaryProtocol(t *testing.T) {
- ReadWriteProtocolTest(t, NewTBinaryProtocolFactoryDefault())
-}
diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/buffered_transport_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/buffered_transport_test.go
deleted file mode 100644
index 95ec0cbd2..000000000
--- a/vendor/github.com/apache/thrift/lib/go/thrift/buffered_transport_test.go
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package thrift
-
-import (
- "testing"
-)
-
-func TestBufferedTransport(t *testing.T) {
- trans := NewTBufferedTransport(NewTMemoryBuffer(), 10240)
- TransportTest(t, trans, trans)
-}
diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/common_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/common_test.go
deleted file mode 100644
index 93597ff8a..000000000
--- a/vendor/github.com/apache/thrift/lib/go/thrift/common_test.go
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package thrift
-
-import "context"
-
-type mockProcessor struct {
- ProcessFunc func(in, out TProtocol) (bool, TException)
-}
-
-func (m *mockProcessor) Process(ctx context.Context, in, out TProtocol) (bool, TException) {
- return m.ProcessFunc(in, out)
-}
diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/compact_protocol_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/compact_protocol_test.go
deleted file mode 100644
index f940b4e15..000000000
--- a/vendor/github.com/apache/thrift/lib/go/thrift/compact_protocol_test.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package thrift
-
-import (
- "bytes"
- "testing"
-)
-
-func TestReadWriteCompactProtocol(t *testing.T) {
- ReadWriteProtocolTest(t, NewTCompactProtocolFactory())
- transports := []TTransport{
- NewTMemoryBuffer(),
- NewStreamTransportRW(bytes.NewBuffer(make([]byte, 0, 16384))),
- NewTFramedTransport(NewTMemoryBuffer()),
- }
- for _, trans := range transports {
- p := NewTCompactProtocol(trans)
- ReadWriteBool(t, p, trans)
- p = NewTCompactProtocol(trans)
- ReadWriteByte(t, p, trans)
- p = NewTCompactProtocol(trans)
- ReadWriteI16(t, p, trans)
- p = NewTCompactProtocol(trans)
- ReadWriteI32(t, p, trans)
- p = NewTCompactProtocol(trans)
- ReadWriteI64(t, p, trans)
- p = NewTCompactProtocol(trans)
- ReadWriteDouble(t, p, trans)
- p = NewTCompactProtocol(trans)
- ReadWriteString(t, p, trans)
- p = NewTCompactProtocol(trans)
- ReadWriteBinary(t, p, trans)
- trans.Close()
- }
-}
diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/exception_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/exception_test.go
deleted file mode 100644
index 71f5e2c7e..000000000
--- a/vendor/github.com/apache/thrift/lib/go/thrift/exception_test.go
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package thrift
-
-import (
- "errors"
- "testing"
-)
-
-func TestPrependError(t *testing.T) {
- err := NewTApplicationException(INTERNAL_ERROR, "original error")
- err2, ok := PrependError("Prepend: ", err).(TApplicationException)
- if !ok {
- t.Fatal("Couldn't cast error TApplicationException")
- }
- if err2.Error() != "Prepend: original error" {
- t.Fatal("Unexpected error string")
- }
- if err2.TypeId() != INTERNAL_ERROR {
- t.Fatal("Unexpected type error")
- }
-
- err3 := NewTProtocolExceptionWithType(INVALID_DATA, errors.New("original error"))
- err4, ok := PrependError("Prepend: ", err3).(TProtocolException)
- if !ok {
- t.Fatal("Couldn't cast error TProtocolException")
- }
- if err4.Error() != "Prepend: original error" {
- t.Fatal("Unexpected error string")
- }
- if err4.TypeId() != INVALID_DATA {
- t.Fatal("Unexpected type error")
- }
-
- err5 := NewTTransportException(TIMED_OUT, "original error")
- err6, ok := PrependError("Prepend: ", err5).(TTransportException)
- if !ok {
- t.Fatal("Couldn't cast error TTransportException")
- }
- if err6.Error() != "Prepend: original error" {
- t.Fatal("Unexpected error string")
- }
- if err6.TypeId() != TIMED_OUT {
- t.Fatal("Unexpected type error")
- }
-
- err7 := errors.New("original error")
- err8 := PrependError("Prepend: ", err7)
- if err8.Error() != "Prepend: original error" {
- t.Fatal("Unexpected error string")
- }
-}
diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/framed_transport_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/framed_transport_test.go
deleted file mode 100644
index 8f683ef30..000000000
--- a/vendor/github.com/apache/thrift/lib/go/thrift/framed_transport_test.go
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package thrift
-
-import (
- "testing"
-)
-
-func TestFramedTransport(t *testing.T) {
- trans := NewTFramedTransport(NewTMemoryBuffer())
- TransportTest(t, trans, trans)
-}
diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/http_client_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/http_client_test.go
deleted file mode 100644
index 453680ace..000000000
--- a/vendor/github.com/apache/thrift/lib/go/thrift/http_client_test.go
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package thrift
-
-import (
- "net/http"
- "testing"
-)
-
-func TestHttpClient(t *testing.T) {
- l, addr := HttpClientSetupForTest(t)
- if l != nil {
- defer l.Close()
- }
- trans, err := NewTHttpPostClient("http://" + addr.String())
- if err != nil {
- l.Close()
- t.Fatalf("Unable to connect to %s: %s", addr.String(), err)
- }
- TransportTest(t, trans, trans)
-}
-
-func TestHttpClientHeaders(t *testing.T) {
- l, addr := HttpClientSetupForTest(t)
- if l != nil {
- defer l.Close()
- }
- trans, err := NewTHttpPostClient("http://" + addr.String())
- if err != nil {
- l.Close()
- t.Fatalf("Unable to connect to %s: %s", addr.String(), err)
- }
- TransportHeaderTest(t, trans, trans)
-}
-
-func TestHttpCustomClient(t *testing.T) {
- l, addr := HttpClientSetupForTest(t)
- if l != nil {
- defer l.Close()
- }
-
- httpTransport := &customHttpTransport{}
-
- trans, err := NewTHttpPostClientWithOptions("http://"+addr.String(), THttpClientOptions{
- Client: &http.Client{
- Transport: httpTransport,
- },
- })
- if err != nil {
- l.Close()
- t.Fatalf("Unable to connect to %s: %s", addr.String(), err)
- }
- TransportHeaderTest(t, trans, trans)
-
- if !httpTransport.hit {
- t.Fatalf("Custom client was not used")
- }
-}
-
-func TestHttpCustomClientPackageScope(t *testing.T) {
- l, addr := HttpClientSetupForTest(t)
- if l != nil {
- defer l.Close()
- }
- httpTransport := &customHttpTransport{}
- DefaultHttpClient = &http.Client{
- Transport: httpTransport,
- }
-
- trans, err := NewTHttpPostClient("http://" + addr.String())
- if err != nil {
- l.Close()
- t.Fatalf("Unable to connect to %s: %s", addr.String(), err)
- }
- TransportHeaderTest(t, trans, trans)
-
- if !httpTransport.hit {
- t.Fatalf("Custom client was not used")
- }
-}
-
-type customHttpTransport struct {
- hit bool
-}
-
-func (c *customHttpTransport) RoundTrip(req *http.Request) (*http.Response, error) {
- c.hit = true
- return http.DefaultTransport.RoundTrip(req)
-}
diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/iostream_transport_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/iostream_transport_test.go
deleted file mode 100644
index 15a611642..000000000
--- a/vendor/github.com/apache/thrift/lib/go/thrift/iostream_transport_test.go
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package thrift
-
-import (
- "bytes"
- "testing"
-)
-
-func TestStreamTransport(t *testing.T) {
- trans := NewStreamTransportRW(bytes.NewBuffer(make([]byte, 0, 1024)))
- TransportTest(t, trans, trans)
-}
-
-func TestStreamTransportOpenClose(t *testing.T) {
- trans := NewStreamTransportRW(bytes.NewBuffer(make([]byte, 0, 1024)))
- if !trans.IsOpen() {
- t.Fatal("StreamTransport should be already open")
- }
- if trans.Open() == nil {
- t.Fatal("StreamTransport should return error when open twice")
- }
- if trans.Close() != nil {
- t.Fatal("StreamTransport should not return error when closing open transport")
- }
- if trans.IsOpen() {
- t.Fatal("StreamTransport should not be open after close")
- }
- if trans.Close() == nil {
- t.Fatal("StreamTransport should return error when closing a non open transport")
- }
- if trans.Open() == nil {
- t.Fatal("StreamTransport should not be able to reopen")
- }
-}
diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/json_protocol_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/json_protocol_test.go
deleted file mode 100644
index 59c4d64a2..000000000
--- a/vendor/github.com/apache/thrift/lib/go/thrift/json_protocol_test.go
+++ /dev/null
@@ -1,650 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package thrift
-
-import (
- "context"
- "encoding/base64"
- "encoding/json"
- "fmt"
- "math"
- "strconv"
- "testing"
-)
-
-func TestWriteJSONProtocolBool(t *testing.T) {
- thetype := "boolean"
- trans := NewTMemoryBuffer()
- p := NewTJSONProtocol(trans)
- for _, value := range BOOL_VALUES {
- if e := p.WriteBool(value); e != nil {
- t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error())
- }
- if e := p.Flush(context.Background()); e != nil {
- t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error())
- }
- s := trans.String()
- expected := ""
- if value {
- expected = "1"
- } else {
- expected = "0"
- }
- if s != expected {
- t.Fatalf("Bad value for %s %v: %s expected", thetype, value, s)
- }
- v := -1
- if err := json.Unmarshal([]byte(s), &v); err != nil || (v != 0) != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v)
- }
- trans.Reset()
- }
- trans.Close()
-}
-
-func TestReadJSONProtocolBool(t *testing.T) {
- thetype := "boolean"
- for _, value := range BOOL_VALUES {
- trans := NewTMemoryBuffer()
- p := NewTJSONProtocol(trans)
- if value {
- trans.Write([]byte{'1'}) // not JSON_TRUE
- } else {
- trans.Write([]byte{'0'}) // not JSON_FALSE
- }
- trans.Flush(context.Background())
- s := trans.String()
- v, e := p.ReadBool()
- if e != nil {
- t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error())
- }
- if v != value {
- t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v)
- }
- vv := -1
- if err := json.Unmarshal([]byte(s), &vv); err != nil || (vv != 0) != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, vv)
- }
- trans.Reset()
- trans.Close()
- }
-}
-
-func TestWriteJSONProtocolByte(t *testing.T) {
- thetype := "byte"
- trans := NewTMemoryBuffer()
- p := NewTJSONProtocol(trans)
- for _, value := range BYTE_VALUES {
- if e := p.WriteByte(value); e != nil {
- t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error())
- }
- if e := p.Flush(context.Background()); e != nil {
- t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error())
- }
- s := trans.String()
- if s != fmt.Sprint(value) {
- t.Fatalf("Bad value for %s %v: %s", thetype, value, s)
- }
- v := int8(0)
- if err := json.Unmarshal([]byte(s), &v); err != nil || v != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v)
- }
- trans.Reset()
- }
- trans.Close()
-}
-
-func TestReadJSONProtocolByte(t *testing.T) {
- thetype := "byte"
- for _, value := range BYTE_VALUES {
- trans := NewTMemoryBuffer()
- p := NewTJSONProtocol(trans)
- trans.WriteString(strconv.Itoa(int(value)))
- trans.Flush(context.Background())
- s := trans.String()
- v, e := p.ReadByte()
- if e != nil {
- t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error())
- }
- if v != value {
- t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v)
- }
- if err := json.Unmarshal([]byte(s), &v); err != nil || v != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v)
- }
- trans.Reset()
- trans.Close()
- }
-}
-
-func TestWriteJSONProtocolI16(t *testing.T) {
- thetype := "int16"
- trans := NewTMemoryBuffer()
- p := NewTJSONProtocol(trans)
- for _, value := range INT16_VALUES {
- if e := p.WriteI16(value); e != nil {
- t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error())
- }
- if e := p.Flush(context.Background()); e != nil {
- t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error())
- }
- s := trans.String()
- if s != fmt.Sprint(value) {
- t.Fatalf("Bad value for %s %v: %s", thetype, value, s)
- }
- v := int16(0)
- if err := json.Unmarshal([]byte(s), &v); err != nil || v != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v)
- }
- trans.Reset()
- }
- trans.Close()
-}
-
-func TestReadJSONProtocolI16(t *testing.T) {
- thetype := "int16"
- for _, value := range INT16_VALUES {
- trans := NewTMemoryBuffer()
- p := NewTJSONProtocol(trans)
- trans.WriteString(strconv.Itoa(int(value)))
- trans.Flush(context.Background())
- s := trans.String()
- v, e := p.ReadI16()
- if e != nil {
- t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error())
- }
- if v != value {
- t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v)
- }
- if err := json.Unmarshal([]byte(s), &v); err != nil || v != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v)
- }
- trans.Reset()
- trans.Close()
- }
-}
-
-func TestWriteJSONProtocolI32(t *testing.T) {
- thetype := "int32"
- trans := NewTMemoryBuffer()
- p := NewTJSONProtocol(trans)
- for _, value := range INT32_VALUES {
- if e := p.WriteI32(value); e != nil {
- t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error())
- }
- if e := p.Flush(context.Background()); e != nil {
- t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error())
- }
- s := trans.String()
- if s != fmt.Sprint(value) {
- t.Fatalf("Bad value for %s %v: %s", thetype, value, s)
- }
- v := int32(0)
- if err := json.Unmarshal([]byte(s), &v); err != nil || v != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v)
- }
- trans.Reset()
- }
- trans.Close()
-}
-
-func TestReadJSONProtocolI32(t *testing.T) {
- thetype := "int32"
- for _, value := range INT32_VALUES {
- trans := NewTMemoryBuffer()
- p := NewTJSONProtocol(trans)
- trans.WriteString(strconv.Itoa(int(value)))
- trans.Flush(context.Background())
- s := trans.String()
- v, e := p.ReadI32()
- if e != nil {
- t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error())
- }
- if v != value {
- t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v)
- }
- if err := json.Unmarshal([]byte(s), &v); err != nil || v != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v)
- }
- trans.Reset()
- trans.Close()
- }
-}
-
-func TestWriteJSONProtocolI64(t *testing.T) {
- thetype := "int64"
- trans := NewTMemoryBuffer()
- p := NewTJSONProtocol(trans)
- for _, value := range INT64_VALUES {
- if e := p.WriteI64(value); e != nil {
- t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error())
- }
- if e := p.Flush(context.Background()); e != nil {
- t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error())
- }
- s := trans.String()
- if s != fmt.Sprint(value) {
- t.Fatalf("Bad value for %s %v: %s", thetype, value, s)
- }
- v := int64(0)
- if err := json.Unmarshal([]byte(s), &v); err != nil || v != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v)
- }
- trans.Reset()
- }
- trans.Close()
-}
-
-func TestReadJSONProtocolI64(t *testing.T) {
- thetype := "int64"
- for _, value := range INT64_VALUES {
- trans := NewTMemoryBuffer()
- p := NewTJSONProtocol(trans)
- trans.WriteString(strconv.FormatInt(value, 10))
- trans.Flush(context.Background())
- s := trans.String()
- v, e := p.ReadI64()
- if e != nil {
- t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error())
- }
- if v != value {
- t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v)
- }
- if err := json.Unmarshal([]byte(s), &v); err != nil || v != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v)
- }
- trans.Reset()
- trans.Close()
- }
-}
-
-func TestWriteJSONProtocolDouble(t *testing.T) {
- thetype := "double"
- trans := NewTMemoryBuffer()
- p := NewTJSONProtocol(trans)
- for _, value := range DOUBLE_VALUES {
- if e := p.WriteDouble(value); e != nil {
- t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error())
- }
- if e := p.Flush(context.Background()); e != nil {
- t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error())
- }
- s := trans.String()
- if math.IsInf(value, 1) {
- if s != jsonQuote(JSON_INFINITY) {
- t.Fatalf("Bad value for %s %v, wrote: %v, expected: %v", thetype, value, s, jsonQuote(JSON_INFINITY))
- }
- } else if math.IsInf(value, -1) {
- if s != jsonQuote(JSON_NEGATIVE_INFINITY) {
- t.Fatalf("Bad value for %s %v, wrote: %v, expected: %v", thetype, value, s, jsonQuote(JSON_NEGATIVE_INFINITY))
- }
- } else if math.IsNaN(value) {
- if s != jsonQuote(JSON_NAN) {
- t.Fatalf("Bad value for %s %v, wrote: %v, expected: %v", thetype, value, s, jsonQuote(JSON_NAN))
- }
- } else {
- if s != fmt.Sprint(value) {
- t.Fatalf("Bad value for %s %v: %s", thetype, value, s)
- }
- v := float64(0)
- if err := json.Unmarshal([]byte(s), &v); err != nil || v != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v)
- }
- }
- trans.Reset()
- }
- trans.Close()
-}
-
-func TestReadJSONProtocolDouble(t *testing.T) {
- thetype := "double"
- for _, value := range DOUBLE_VALUES {
- trans := NewTMemoryBuffer()
- p := NewTJSONProtocol(trans)
- n := NewNumericFromDouble(value)
- trans.WriteString(n.String())
- trans.Flush(context.Background())
- s := trans.String()
- v, e := p.ReadDouble()
- if e != nil {
- t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error())
- }
- if math.IsInf(value, 1) {
- if !math.IsInf(v, 1) {
- t.Fatalf("Bad value for %s %v, wrote: %v, received: %v", thetype, value, s, v)
- }
- } else if math.IsInf(value, -1) {
- if !math.IsInf(v, -1) {
- t.Fatalf("Bad value for %s %v, wrote: %v, received: %v", thetype, value, s, v)
- }
- } else if math.IsNaN(value) {
- if !math.IsNaN(v) {
- t.Fatalf("Bad value for %s %v, wrote: %v, received: %v", thetype, value, s, v)
- }
- } else {
- if v != value {
- t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v)
- }
- if err := json.Unmarshal([]byte(s), &v); err != nil || v != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v)
- }
- }
- trans.Reset()
- trans.Close()
- }
-}
-
-func TestWriteJSONProtocolString(t *testing.T) {
- thetype := "string"
- trans := NewTMemoryBuffer()
- p := NewTJSONProtocol(trans)
- for _, value := range STRING_VALUES {
- if e := p.WriteString(value); e != nil {
- t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error())
- }
- if e := p.Flush(context.Background()); e != nil {
- t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error())
- }
- s := trans.String()
- if s[0] != '"' || s[len(s)-1] != '"' {
- t.Fatalf("Bad value for %s '%v', wrote '%v', expected: %v", thetype, value, s, fmt.Sprint("\"", value, "\""))
- }
- v := new(string)
- if err := json.Unmarshal([]byte(s), v); err != nil || *v != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, *v)
- }
- trans.Reset()
- }
- trans.Close()
-}
-
-func TestReadJSONProtocolString(t *testing.T) {
- thetype := "string"
- for _, value := range STRING_VALUES {
- trans := NewTMemoryBuffer()
- p := NewTJSONProtocol(trans)
- trans.WriteString(jsonQuote(value))
- trans.Flush(context.Background())
- s := trans.String()
- v, e := p.ReadString()
- if e != nil {
- t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error())
- }
- if v != value {
- t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v)
- }
- v1 := new(string)
- if err := json.Unmarshal([]byte(s), v1); err != nil || *v1 != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, *v1)
- }
- trans.Reset()
- trans.Close()
- }
-}
-
-func TestWriteJSONProtocolBinary(t *testing.T) {
- thetype := "binary"
- value := protocol_bdata
- b64value := make([]byte, base64.StdEncoding.EncodedLen(len(protocol_bdata)))
- base64.StdEncoding.Encode(b64value, value)
- b64String := string(b64value)
- trans := NewTMemoryBuffer()
- p := NewTJSONProtocol(trans)
- if e := p.WriteBinary(value); e != nil {
- t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error())
- }
- if e := p.Flush(context.Background()); e != nil {
- t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error())
- }
- s := trans.String()
- expectedString := fmt.Sprint("\"", b64String, "\"")
- if s != expectedString {
- t.Fatalf("Bad value for %s %v\n wrote: \"%v\"\nexpected: \"%v\"", thetype, value, s, expectedString)
- }
- v1, err := p.ReadBinary()
- if err != nil {
- t.Fatalf("Unable to read binary: %s", err.Error())
- }
- if len(v1) != len(value) {
- t.Fatalf("Invalid value for binary\nexpected: \"%v\"\n read: \"%v\"", value, v1)
- }
- for k, v := range value {
- if v1[k] != v {
- t.Fatalf("Invalid value for binary at %v\nexpected: \"%v\"\n read: \"%v\"", k, v, v1[k])
- }
- }
- trans.Close()
-}
-
-func TestReadJSONProtocolBinary(t *testing.T) {
- thetype := "binary"
- value := protocol_bdata
- b64value := make([]byte, base64.StdEncoding.EncodedLen(len(protocol_bdata)))
- base64.StdEncoding.Encode(b64value, value)
- b64String := string(b64value)
- trans := NewTMemoryBuffer()
- p := NewTJSONProtocol(trans)
- trans.WriteString(jsonQuote(b64String))
- trans.Flush(context.Background())
- s := trans.String()
- v, e := p.ReadBinary()
- if e != nil {
- t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error())
- }
- if len(v) != len(value) {
- t.Fatalf("Bad value for %s value length %v, wrote: %v, received length: %v", thetype, len(value), s, len(v))
- }
- for i := 0; i < len(v); i++ {
- if v[i] != value[i] {
- t.Fatalf("Bad value for %s at index %d value %v, wrote: %v, received: %v", thetype, i, value[i], s, v[i])
- }
- }
- v1 := new(string)
- if err := json.Unmarshal([]byte(s), v1); err != nil || *v1 != b64String {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, *v1)
- }
- trans.Reset()
- trans.Close()
-}
-
-func TestWriteJSONProtocolList(t *testing.T) {
- thetype := "list"
- trans := NewTMemoryBuffer()
- p := NewTJSONProtocol(trans)
- p.WriteListBegin(TType(DOUBLE), len(DOUBLE_VALUES))
- for _, value := range DOUBLE_VALUES {
- if e := p.WriteDouble(value); e != nil {
- t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error())
- }
- }
- p.WriteListEnd()
- if e := p.Flush(context.Background()); e != nil {
- t.Fatalf("Unable to write %s due to error flushing: %s", thetype, e.Error())
- }
- str := trans.String()
- str1 := new([]interface{})
- err := json.Unmarshal([]byte(str), str1)
- if err != nil {
- t.Fatalf("Unable to decode %s, wrote: %s", thetype, str)
- }
- l := *str1
- if len(l) < 2 {
- t.Fatalf("List must be at least of length two to include metadata")
- }
- if l[0] != "dbl" {
- t.Fatal("Invalid type for list, expected: ", STRING, ", but was: ", l[0])
- }
- if int(l[1].(float64)) != len(DOUBLE_VALUES) {
- t.Fatal("Invalid length for list, expected: ", len(DOUBLE_VALUES), ", but was: ", l[1])
- }
- for k, value := range DOUBLE_VALUES {
- s := l[k+2]
- if math.IsInf(value, 1) {
- if s.(string) != JSON_INFINITY {
- t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_INFINITY), str)
- }
- } else if math.IsInf(value, 0) {
- if s.(string) != JSON_NEGATIVE_INFINITY {
- t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_NEGATIVE_INFINITY), str)
- }
- } else if math.IsNaN(value) {
- if s.(string) != JSON_NAN {
- t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_NAN), str)
- }
- } else {
- if s.(float64) != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s'", thetype, value, s)
- }
- }
- trans.Reset()
- }
- trans.Close()
-}
-
-func TestWriteJSONProtocolSet(t *testing.T) {
- thetype := "set"
- trans := NewTMemoryBuffer()
- p := NewTJSONProtocol(trans)
- p.WriteSetBegin(TType(DOUBLE), len(DOUBLE_VALUES))
- for _, value := range DOUBLE_VALUES {
- if e := p.WriteDouble(value); e != nil {
- t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error())
- }
- }
- p.WriteSetEnd()
- if e := p.Flush(context.Background()); e != nil {
- t.Fatalf("Unable to write %s due to error flushing: %s", thetype, e.Error())
- }
- str := trans.String()
- str1 := new([]interface{})
- err := json.Unmarshal([]byte(str), str1)
- if err != nil {
- t.Fatalf("Unable to decode %s, wrote: %s", thetype, str)
- }
- l := *str1
- if len(l) < 2 {
- t.Fatalf("Set must be at least of length two to include metadata")
- }
- if l[0] != "dbl" {
- t.Fatal("Invalid type for set, expected: ", DOUBLE, ", but was: ", l[0])
- }
- if int(l[1].(float64)) != len(DOUBLE_VALUES) {
- t.Fatal("Invalid length for set, expected: ", len(DOUBLE_VALUES), ", but was: ", l[1])
- }
- for k, value := range DOUBLE_VALUES {
- s := l[k+2]
- if math.IsInf(value, 1) {
- if s.(string) != JSON_INFINITY {
- t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_INFINITY), str)
- }
- } else if math.IsInf(value, 0) {
- if s.(string) != JSON_NEGATIVE_INFINITY {
- t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_NEGATIVE_INFINITY), str)
- }
- } else if math.IsNaN(value) {
- if s.(string) != JSON_NAN {
- t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_NAN), str)
- }
- } else {
- if s.(float64) != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s'", thetype, value, s)
- }
- }
- trans.Reset()
- }
- trans.Close()
-}
-
-func TestWriteJSONProtocolMap(t *testing.T) {
- thetype := "map"
- trans := NewTMemoryBuffer()
- p := NewTJSONProtocol(trans)
- p.WriteMapBegin(TType(I32), TType(DOUBLE), len(DOUBLE_VALUES))
- for k, value := range DOUBLE_VALUES {
- if e := p.WriteI32(int32(k)); e != nil {
- t.Fatalf("Unable to write %s key int32 value %v due to error: %s", thetype, k, e.Error())
- }
- if e := p.WriteDouble(value); e != nil {
- t.Fatalf("Unable to write %s value float64 value %v due to error: %s", thetype, value, e.Error())
- }
- }
- p.WriteMapEnd()
- if e := p.Flush(context.Background()); e != nil {
- t.Fatalf("Unable to write %s due to error flushing: %s", thetype, e.Error())
- }
- str := trans.String()
- if str[0] != '[' || str[len(str)-1] != ']' {
- t.Fatalf("Bad value for %s, wrote: %v, in go: %v", thetype, str, DOUBLE_VALUES)
- }
- expectedKeyType, expectedValueType, expectedSize, err := p.ReadMapBegin()
- if err != nil {
- t.Fatalf("Error while reading map begin: %s", err.Error())
- }
- if expectedKeyType != I32 {
- t.Fatal("Expected map key type ", I32, ", but was ", expectedKeyType)
- }
- if expectedValueType != DOUBLE {
- t.Fatal("Expected map value type ", DOUBLE, ", but was ", expectedValueType)
- }
- if expectedSize != len(DOUBLE_VALUES) {
- t.Fatal("Expected map size of ", len(DOUBLE_VALUES), ", but was ", expectedSize)
- }
- for k, value := range DOUBLE_VALUES {
- ik, err := p.ReadI32()
- if err != nil {
- t.Fatalf("Bad key for %s index %v, wrote: %v, expected: %v, error: %s", thetype, k, ik, string(k), err.Error())
- }
- if int(ik) != k {
- t.Fatalf("Bad key for %s index %v, wrote: %v, expected: %v", thetype, k, ik, k)
- }
- dv, err := p.ReadDouble()
- if err != nil {
- t.Fatalf("Bad value for %s index %v, wrote: %v, expected: %v, error: %s", thetype, k, dv, value, err.Error())
- }
- s := strconv.FormatFloat(dv, 'g', 10, 64)
- if math.IsInf(value, 1) {
- if !math.IsInf(dv, 1) {
- t.Fatalf("Bad value for %s at index %v %v, wrote: %v, expected: %v", thetype, k, value, s, jsonQuote(JSON_INFINITY))
- }
- } else if math.IsInf(value, 0) {
- if !math.IsInf(dv, 0) {
- t.Fatalf("Bad value for %s at index %v %v, wrote: %v, expected: %v", thetype, k, value, s, jsonQuote(JSON_NEGATIVE_INFINITY))
- }
- } else if math.IsNaN(value) {
- if !math.IsNaN(dv) {
- t.Fatalf("Bad value for %s at index %v %v, wrote: %v, expected: %v", thetype, k, value, s, jsonQuote(JSON_NAN))
- }
- } else {
- expected := strconv.FormatFloat(value, 'g', 10, 64)
- if s != expected {
- t.Fatalf("Bad value for %s at index %v %v, wrote: %v, expected %v", thetype, k, value, s, expected)
- }
- v := float64(0)
- if err := json.Unmarshal([]byte(s), &v); err != nil || v != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v)
- }
- }
- }
- err = p.ReadMapEnd()
- if err != nil {
- t.Fatalf("Error while reading map end: %s", err.Error())
- }
- trans.Close()
-}
diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/lowlevel_benchmarks_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/lowlevel_benchmarks_test.go
deleted file mode 100644
index e1736557b..000000000
--- a/vendor/github.com/apache/thrift/lib/go/thrift/lowlevel_benchmarks_test.go
+++ /dev/null
@@ -1,540 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package thrift
-
-import (
- "bytes"
- "testing"
-)
-
-var binaryProtoF = NewTBinaryProtocolFactoryDefault()
-var compactProtoF = NewTCompactProtocolFactory()
-
-var buf = bytes.NewBuffer(make([]byte, 0, 1024))
-
-var tfv = []TTransportFactory{
- NewTMemoryBufferTransportFactory(1024),
- NewStreamTransportFactory(buf, buf, true),
- NewTFramedTransportFactory(NewTMemoryBufferTransportFactory(1024)),
-}
-
-func BenchmarkBinaryBool_0(b *testing.B) {
- trans, err := tfv[0].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := binaryProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteBool(b, p, trans)
- }
-}
-
-func BenchmarkBinaryByte_0(b *testing.B) {
- trans, err := tfv[0].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := binaryProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteByte(b, p, trans)
- }
-}
-
-func BenchmarkBinaryI16_0(b *testing.B) {
- trans, err := tfv[0].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := binaryProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteI16(b, p, trans)
- }
-}
-
-func BenchmarkBinaryI32_0(b *testing.B) {
- trans, err := tfv[0].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := binaryProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteI32(b, p, trans)
- }
-}
-func BenchmarkBinaryI64_0(b *testing.B) {
- trans, err := tfv[0].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := binaryProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteI64(b, p, trans)
- }
-}
-func BenchmarkBinaryDouble_0(b *testing.B) {
- trans, err := tfv[0].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := binaryProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteDouble(b, p, trans)
- }
-}
-func BenchmarkBinaryString_0(b *testing.B) {
- trans, err := tfv[0].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := binaryProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteString(b, p, trans)
- }
-}
-func BenchmarkBinaryBinary_0(b *testing.B) {
- trans, err := tfv[0].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := binaryProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteBinary(b, p, trans)
- }
-}
-
-func BenchmarkBinaryBool_1(b *testing.B) {
- trans, err := tfv[1].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := binaryProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteBool(b, p, trans)
- }
-}
-
-func BenchmarkBinaryByte_1(b *testing.B) {
- trans, err := tfv[1].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := binaryProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteByte(b, p, trans)
- }
-}
-
-func BenchmarkBinaryI16_1(b *testing.B) {
- trans, err := tfv[1].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := binaryProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteI16(b, p, trans)
- }
-}
-
-func BenchmarkBinaryI32_1(b *testing.B) {
- trans, err := tfv[1].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := binaryProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteI32(b, p, trans)
- }
-}
-func BenchmarkBinaryI64_1(b *testing.B) {
- trans, err := tfv[1].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := binaryProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteI64(b, p, trans)
- }
-}
-func BenchmarkBinaryDouble_1(b *testing.B) {
- trans, err := tfv[1].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := binaryProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteDouble(b, p, trans)
- }
-}
-func BenchmarkBinaryString_1(b *testing.B) {
- trans, err := tfv[1].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := binaryProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteString(b, p, trans)
- }
-}
-func BenchmarkBinaryBinary_1(b *testing.B) {
- trans, err := tfv[1].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := binaryProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteBinary(b, p, trans)
- }
-}
-
-func BenchmarkBinaryBool_2(b *testing.B) {
- trans, err := tfv[2].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := binaryProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteBool(b, p, trans)
- }
-}
-
-func BenchmarkBinaryByte_2(b *testing.B) {
- trans, err := tfv[2].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := binaryProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteByte(b, p, trans)
- }
-}
-
-func BenchmarkBinaryI16_2(b *testing.B) {
- trans, err := tfv[2].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := binaryProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteI16(b, p, trans)
- }
-}
-
-func BenchmarkBinaryI32_2(b *testing.B) {
- trans, err := tfv[2].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := binaryProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteI32(b, p, trans)
- }
-}
-func BenchmarkBinaryI64_2(b *testing.B) {
- trans, err := tfv[2].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := binaryProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteI64(b, p, trans)
- }
-}
-func BenchmarkBinaryDouble_2(b *testing.B) {
- trans, err := tfv[2].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := binaryProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteDouble(b, p, trans)
- }
-}
-func BenchmarkBinaryString_2(b *testing.B) {
- trans, err := tfv[2].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := binaryProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteString(b, p, trans)
- }
-}
-func BenchmarkBinaryBinary_2(b *testing.B) {
- trans, err := tfv[2].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := binaryProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteBinary(b, p, trans)
- }
-}
-
-func BenchmarkCompactBool_0(b *testing.B) {
- trans, err := tfv[0].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := compactProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteBool(b, p, trans)
- }
-}
-
-func BenchmarkCompactByte_0(b *testing.B) {
- trans, err := tfv[0].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := compactProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteByte(b, p, trans)
- }
-}
-
-func BenchmarkCompactI16_0(b *testing.B) {
- trans, err := tfv[0].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := compactProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteI16(b, p, trans)
- }
-}
-
-func BenchmarkCompactI32_0(b *testing.B) {
- trans, err := tfv[0].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := compactProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteI32(b, p, trans)
- }
-}
-func BenchmarkCompactI64_0(b *testing.B) {
- trans, err := tfv[0].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := compactProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteI64(b, p, trans)
- }
-}
-func BenchmarkCompactDouble0(b *testing.B) {
- trans, err := tfv[0].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := compactProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteDouble(b, p, trans)
- }
-}
-func BenchmarkCompactString0(b *testing.B) {
- trans, err := tfv[0].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := compactProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteString(b, p, trans)
- }
-}
-func BenchmarkCompactBinary0(b *testing.B) {
- trans, err := tfv[0].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := compactProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteBinary(b, p, trans)
- }
-}
-
-func BenchmarkCompactBool_1(b *testing.B) {
- trans, err := tfv[1].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := compactProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteBool(b, p, trans)
- }
-}
-
-func BenchmarkCompactByte_1(b *testing.B) {
- trans, err := tfv[1].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := compactProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteByte(b, p, trans)
- }
-}
-
-func BenchmarkCompactI16_1(b *testing.B) {
- trans, err := tfv[1].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := compactProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteI16(b, p, trans)
- }
-}
-
-func BenchmarkCompactI32_1(b *testing.B) {
- trans, err := tfv[1].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := compactProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteI32(b, p, trans)
- }
-}
-func BenchmarkCompactI64_1(b *testing.B) {
- trans, err := tfv[1].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := compactProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteI64(b, p, trans)
- }
-}
-func BenchmarkCompactDouble1(b *testing.B) {
- trans, err := tfv[1].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := compactProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteDouble(b, p, trans)
- }
-}
-func BenchmarkCompactString1(b *testing.B) {
- trans, err := tfv[1].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := compactProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteString(b, p, trans)
- }
-}
-func BenchmarkCompactBinary1(b *testing.B) {
- trans, err := tfv[1].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := compactProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteBinary(b, p, trans)
- }
-}
-
-func BenchmarkCompactBool_2(b *testing.B) {
- trans, err := tfv[2].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := compactProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteBool(b, p, trans)
- }
-}
-
-func BenchmarkCompactByte_2(b *testing.B) {
- trans, err := tfv[2].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := compactProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteByte(b, p, trans)
- }
-}
-
-func BenchmarkCompactI16_2(b *testing.B) {
- trans, err := tfv[2].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := compactProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteI16(b, p, trans)
- }
-}
-
-func BenchmarkCompactI32_2(b *testing.B) {
- trans, err := tfv[2].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := compactProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteI32(b, p, trans)
- }
-}
-func BenchmarkCompactI64_2(b *testing.B) {
- trans, err := tfv[2].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := compactProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteI64(b, p, trans)
- }
-}
-func BenchmarkCompactDouble2(b *testing.B) {
- trans, err := tfv[2].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := compactProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteDouble(b, p, trans)
- }
-}
-func BenchmarkCompactString2(b *testing.B) {
- trans, err := tfv[2].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := compactProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteString(b, p, trans)
- }
-}
-func BenchmarkCompactBinary2(b *testing.B) {
- trans, err := tfv[2].GetTransport(nil)
- if err != nil {
- b.Fatal(err)
- }
- p := compactProtoF.GetProtocol(trans)
- for i := 0; i < b.N; i++ {
- ReadWriteBinary(b, p, trans)
- }
-}
diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/memory_buffer_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/memory_buffer_test.go
deleted file mode 100644
index af2e8bfe5..000000000
--- a/vendor/github.com/apache/thrift/lib/go/thrift/memory_buffer_test.go
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package thrift
-
-import (
- "testing"
-)
-
-func TestMemoryBuffer(t *testing.T) {
- trans := NewTMemoryBufferLen(1024)
- TransportTest(t, trans, trans)
-}
diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/protocol_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/protocol_test.go
deleted file mode 100644
index e9118da88..000000000
--- a/vendor/github.com/apache/thrift/lib/go/thrift/protocol_test.go
+++ /dev/null
@@ -1,516 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package thrift
-
-import (
- "bytes"
- "context"
- "io/ioutil"
- "math"
- "net"
- "net/http"
- "testing"
-)
-
-const PROTOCOL_BINARY_DATA_SIZE = 155
-
-var (
- data string // test data for writing
- protocol_bdata []byte // test data for writing; same as data
- BOOL_VALUES []bool
- BYTE_VALUES []int8
- INT16_VALUES []int16
- INT32_VALUES []int32
- INT64_VALUES []int64
- DOUBLE_VALUES []float64
- STRING_VALUES []string
-)
-
-func init() {
- protocol_bdata = make([]byte, PROTOCOL_BINARY_DATA_SIZE)
- for i := 0; i < PROTOCOL_BINARY_DATA_SIZE; i++ {
- protocol_bdata[i] = byte((i + 'a') % 255)
- }
- data = string(protocol_bdata)
- BOOL_VALUES = []bool{false, true, false, false, true}
- BYTE_VALUES = []int8{117, 0, 1, 32, 127, -128, -1}
- INT16_VALUES = []int16{459, 0, 1, -1, -128, 127, 32767, -32768}
- INT32_VALUES = []int32{459, 0, 1, -1, -128, 127, 32767, 2147483647, -2147483535}
- INT64_VALUES = []int64{459, 0, 1, -1, -128, 127, 32767, 2147483647, -2147483535, 34359738481, -35184372088719, -9223372036854775808, 9223372036854775807}
- DOUBLE_VALUES = []float64{459.3, 0.0, -1.0, 1.0, 0.5, 0.3333, 3.14159, 1.537e-38, 1.673e25, 6.02214179e23, -6.02214179e23, INFINITY.Float64(), NEGATIVE_INFINITY.Float64(), NAN.Float64()}
- STRING_VALUES = []string{"", "a", "st[uf]f", "st,u:ff with spaces", "stuff\twith\nescape\\characters'...\"lots{of}fun</xml>"}
-}
-
-type HTTPEchoServer struct{}
-type HTTPHeaderEchoServer struct{}
-
-func (p *HTTPEchoServer) ServeHTTP(w http.ResponseWriter, req *http.Request) {
- buf, err := ioutil.ReadAll(req.Body)
- if err != nil {
- w.WriteHeader(http.StatusBadRequest)
- w.Write(buf)
- } else {
- w.WriteHeader(http.StatusOK)
- w.Write(buf)
- }
-}
-
-func (p *HTTPHeaderEchoServer) ServeHTTP(w http.ResponseWriter, req *http.Request) {
- buf, err := ioutil.ReadAll(req.Body)
- if err != nil {
- w.WriteHeader(http.StatusBadRequest)
- w.Write(buf)
- } else {
- w.WriteHeader(http.StatusOK)
- w.Write(buf)
- }
-}
-
-func HttpClientSetupForTest(t *testing.T) (net.Listener, net.Addr) {
- addr, err := FindAvailableTCPServerPort(40000)
- if err != nil {
- t.Fatalf("Unable to find available tcp port addr: %s", err)
- return nil, addr
- }
- l, err := net.Listen(addr.Network(), addr.String())
- if err != nil {
- t.Fatalf("Unable to setup tcp listener on %s: %s", addr.String(), err)
- return l, addr
- }
- go http.Serve(l, &HTTPEchoServer{})
- return l, addr
-}
-
-func HttpClientSetupForHeaderTest(t *testing.T) (net.Listener, net.Addr) {
- addr, err := FindAvailableTCPServerPort(40000)
- if err != nil {
- t.Fatalf("Unable to find available tcp port addr: %s", err)
- return nil, addr
- }
- l, err := net.Listen(addr.Network(), addr.String())
- if err != nil {
- t.Fatalf("Unable to setup tcp listener on %s: %s", addr.String(), err)
- return l, addr
- }
- go http.Serve(l, &HTTPHeaderEchoServer{})
- return l, addr
-}
-
-func ReadWriteProtocolTest(t *testing.T, protocolFactory TProtocolFactory) {
- buf := bytes.NewBuffer(make([]byte, 0, 1024))
- l, addr := HttpClientSetupForTest(t)
- defer l.Close()
- transports := []TTransportFactory{
- NewTMemoryBufferTransportFactory(1024),
- NewStreamTransportFactory(buf, buf, true),
- NewTFramedTransportFactory(NewTMemoryBufferTransportFactory(1024)),
- NewTHttpPostClientTransportFactory("http://" + addr.String()),
- }
- for _, tf := range transports {
- trans, err := tf.GetTransport(nil)
- if err != nil {
- t.Error(err)
- continue
- }
- p := protocolFactory.GetProtocol(trans)
- ReadWriteBool(t, p, trans)
- trans.Close()
- }
- for _, tf := range transports {
- trans, err := tf.GetTransport(nil)
- if err != nil {
- t.Error(err)
- continue
- }
- p := protocolFactory.GetProtocol(trans)
- ReadWriteByte(t, p, trans)
- trans.Close()
- }
- for _, tf := range transports {
- trans, err := tf.GetTransport(nil)
- if err != nil {
- t.Error(err)
- continue
- }
- p := protocolFactory.GetProtocol(trans)
- ReadWriteI16(t, p, trans)
- trans.Close()
- }
- for _, tf := range transports {
- trans, err := tf.GetTransport(nil)
- if err != nil {
- t.Error(err)
- continue
- }
- p := protocolFactory.GetProtocol(trans)
- ReadWriteI32(t, p, trans)
- trans.Close()
- }
- for _, tf := range transports {
- trans, err := tf.GetTransport(nil)
- if err != nil {
- t.Error(err)
- continue
- }
- p := protocolFactory.GetProtocol(trans)
- ReadWriteI64(t, p, trans)
- trans.Close()
- }
- for _, tf := range transports {
- trans, err := tf.GetTransport(nil)
- if err != nil {
- t.Error(err)
- continue
- }
- p := protocolFactory.GetProtocol(trans)
- ReadWriteDouble(t, p, trans)
- trans.Close()
- }
- for _, tf := range transports {
- trans, err := tf.GetTransport(nil)
- if err != nil {
- t.Error(err)
- continue
- }
- p := protocolFactory.GetProtocol(trans)
- ReadWriteString(t, p, trans)
- trans.Close()
- }
- for _, tf := range transports {
- trans, err := tf.GetTransport(nil)
- if err != nil {
- t.Error(err)
- continue
- }
- p := protocolFactory.GetProtocol(trans)
- ReadWriteBinary(t, p, trans)
- trans.Close()
- }
- for _, tf := range transports {
- trans, err := tf.GetTransport(nil)
- if err != nil {
- t.Error(err)
- continue
- }
- p := protocolFactory.GetProtocol(trans)
- ReadWriteI64(t, p, trans)
- ReadWriteDouble(t, p, trans)
- ReadWriteBinary(t, p, trans)
- ReadWriteByte(t, p, trans)
- trans.Close()
- }
-}
-
-func ReadWriteBool(t testing.TB, p TProtocol, trans TTransport) {
- thetype := TType(BOOL)
- thelen := len(BOOL_VALUES)
- err := p.WriteListBegin(thetype, thelen)
- if err != nil {
- t.Errorf("%s: %T %T %q Error writing list begin: %q", "ReadWriteBool", p, trans, err, thetype)
- }
- for k, v := range BOOL_VALUES {
- err = p.WriteBool(v)
- if err != nil {
- t.Errorf("%s: %T %T %v Error writing bool in list at index %v: %v", "ReadWriteBool", p, trans, err, k, v)
- }
- }
- p.WriteListEnd()
- if err != nil {
- t.Errorf("%s: %T %T %v Error writing list end: %v", "ReadWriteBool", p, trans, err, BOOL_VALUES)
- }
- p.Flush(context.Background())
- thetype2, thelen2, err := p.ReadListBegin()
- if err != nil {
- t.Errorf("%s: %T %T %v Error reading list: %v", "ReadWriteBool", p, trans, err, BOOL_VALUES)
- }
- _, ok := p.(*TSimpleJSONProtocol)
- if !ok {
- if thetype != thetype2 {
- t.Errorf("%s: %T %T type %s != type %s", "ReadWriteBool", p, trans, thetype, thetype2)
- }
- if thelen != thelen2 {
- t.Errorf("%s: %T %T len %v != len %v", "ReadWriteBool", p, trans, thelen, thelen2)
- }
- }
- for k, v := range BOOL_VALUES {
- value, err := p.ReadBool()
- if err != nil {
- t.Errorf("%s: %T %T %v Error reading bool at index %v: %v", "ReadWriteBool", p, trans, err, k, v)
- }
- if v != value {
- t.Errorf("%s: index %v %v %v %v != %v", "ReadWriteBool", k, p, trans, v, value)
- }
- }
- err = p.ReadListEnd()
- if err != nil {
- t.Errorf("%s: %T %T Unable to read list end: %q", "ReadWriteBool", p, trans, err)
- }
-}
-
-func ReadWriteByte(t testing.TB, p TProtocol, trans TTransport) {
- thetype := TType(BYTE)
- thelen := len(BYTE_VALUES)
- err := p.WriteListBegin(thetype, thelen)
- if err != nil {
- t.Errorf("%s: %T %T %q Error writing list begin: %q", "ReadWriteByte", p, trans, err, thetype)
- }
- for k, v := range BYTE_VALUES {
- err = p.WriteByte(v)
- if err != nil {
- t.Errorf("%s: %T %T %q Error writing byte in list at index %d: %q", "ReadWriteByte", p, trans, err, k, v)
- }
- }
- err = p.WriteListEnd()
- if err != nil {
- t.Errorf("%s: %T %T %q Error writing list end: %q", "ReadWriteByte", p, trans, err, BYTE_VALUES)
- }
- err = p.Flush(context.Background())
- if err != nil {
- t.Errorf("%s: %T %T %q Error flushing list of bytes: %q", "ReadWriteByte", p, trans, err, BYTE_VALUES)
- }
- thetype2, thelen2, err := p.ReadListBegin()
- if err != nil {
- t.Errorf("%s: %T %T %q Error reading list: %q", "ReadWriteByte", p, trans, err, BYTE_VALUES)
- }
- _, ok := p.(*TSimpleJSONProtocol)
- if !ok {
- if thetype != thetype2 {
- t.Errorf("%s: %T %T type %s != type %s", "ReadWriteByte", p, trans, thetype, thetype2)
- }
- if thelen != thelen2 {
- t.Errorf("%s: %T %T len %v != len %v", "ReadWriteByte", p, trans, thelen, thelen2)
- }
- }
- for k, v := range BYTE_VALUES {
- value, err := p.ReadByte()
- if err != nil {
- t.Errorf("%s: %T %T %q Error reading byte at index %d: %q", "ReadWriteByte", p, trans, err, k, v)
- }
- if v != value {
- t.Errorf("%s: %T %T %d != %d", "ReadWriteByte", p, trans, v, value)
- }
- }
- err = p.ReadListEnd()
- if err != nil {
- t.Errorf("%s: %T %T Unable to read list end: %q", "ReadWriteByte", p, trans, err)
- }
-}
-
-func ReadWriteI16(t testing.TB, p TProtocol, trans TTransport) {
- thetype := TType(I16)
- thelen := len(INT16_VALUES)
- p.WriteListBegin(thetype, thelen)
- for _, v := range INT16_VALUES {
- p.WriteI16(v)
- }
- p.WriteListEnd()
- p.Flush(context.Background())
- thetype2, thelen2, err := p.ReadListBegin()
- if err != nil {
- t.Errorf("%s: %T %T %q Error reading list: %q", "ReadWriteI16", p, trans, err, INT16_VALUES)
- }
- _, ok := p.(*TSimpleJSONProtocol)
- if !ok {
- if thetype != thetype2 {
- t.Errorf("%s: %T %T type %s != type %s", "ReadWriteI16", p, trans, thetype, thetype2)
- }
- if thelen != thelen2 {
- t.Errorf("%s: %T %T len %v != len %v", "ReadWriteI16", p, trans, thelen, thelen2)
- }
- }
- for k, v := range INT16_VALUES {
- value, err := p.ReadI16()
- if err != nil {
- t.Errorf("%s: %T %T %q Error reading int16 at index %d: %q", "ReadWriteI16", p, trans, err, k, v)
- }
- if v != value {
- t.Errorf("%s: %T %T %d != %d", "ReadWriteI16", p, trans, v, value)
- }
- }
- err = p.ReadListEnd()
- if err != nil {
- t.Errorf("%s: %T %T Unable to read list end: %q", "ReadWriteI16", p, trans, err)
- }
-}
-
-func ReadWriteI32(t testing.TB, p TProtocol, trans TTransport) {
- thetype := TType(I32)
- thelen := len(INT32_VALUES)
- p.WriteListBegin(thetype, thelen)
- for _, v := range INT32_VALUES {
- p.WriteI32(v)
- }
- p.WriteListEnd()
- p.Flush(context.Background())
- thetype2, thelen2, err := p.ReadListBegin()
- if err != nil {
- t.Errorf("%s: %T %T %q Error reading list: %q", "ReadWriteI32", p, trans, err, INT32_VALUES)
- }
- _, ok := p.(*TSimpleJSONProtocol)
- if !ok {
- if thetype != thetype2 {
- t.Errorf("%s: %T %T type %s != type %s", "ReadWriteI32", p, trans, thetype, thetype2)
- }
- if thelen != thelen2 {
- t.Errorf("%s: %T %T len %v != len %v", "ReadWriteI32", p, trans, thelen, thelen2)
- }
- }
- for k, v := range INT32_VALUES {
- value, err := p.ReadI32()
- if err != nil {
- t.Errorf("%s: %T %T %q Error reading int32 at index %d: %q", "ReadWriteI32", p, trans, err, k, v)
- }
- if v != value {
- t.Errorf("%s: %T %T %d != %d", "ReadWriteI32", p, trans, v, value)
- }
- }
- if err != nil {
- t.Errorf("%s: %T %T Unable to read list end: %q", "ReadWriteI32", p, trans, err)
- }
-}
-
-func ReadWriteI64(t testing.TB, p TProtocol, trans TTransport) {
- thetype := TType(I64)
- thelen := len(INT64_VALUES)
- p.WriteListBegin(thetype, thelen)
- for _, v := range INT64_VALUES {
- p.WriteI64(v)
- }
- p.WriteListEnd()
- p.Flush(context.Background())
- thetype2, thelen2, err := p.ReadListBegin()
- if err != nil {
- t.Errorf("%s: %T %T %q Error reading list: %q", "ReadWriteI64", p, trans, err, INT64_VALUES)
- }
- _, ok := p.(*TSimpleJSONProtocol)
- if !ok {
- if thetype != thetype2 {
- t.Errorf("%s: %T %T type %s != type %s", "ReadWriteI64", p, trans, thetype, thetype2)
- }
- if thelen != thelen2 {
- t.Errorf("%s: %T %T len %v != len %v", "ReadWriteI64", p, trans, thelen, thelen2)
- }
- }
- for k, v := range INT64_VALUES {
- value, err := p.ReadI64()
- if err != nil {
- t.Errorf("%s: %T %T %q Error reading int64 at index %d: %q", "ReadWriteI64", p, trans, err, k, v)
- }
- if v != value {
- t.Errorf("%s: %T %T %q != %q", "ReadWriteI64", p, trans, v, value)
- }
- }
- if err != nil {
- t.Errorf("%s: %T %T Unable to read list end: %q", "ReadWriteI64", p, trans, err)
- }
-}
-
-func ReadWriteDouble(t testing.TB, p TProtocol, trans TTransport) {
- thetype := TType(DOUBLE)
- thelen := len(DOUBLE_VALUES)
- p.WriteListBegin(thetype, thelen)
- for _, v := range DOUBLE_VALUES {
- p.WriteDouble(v)
- }
- p.WriteListEnd()
- p.Flush(context.Background())
- thetype2, thelen2, err := p.ReadListBegin()
- if err != nil {
- t.Errorf("%s: %T %T %v Error reading list: %v", "ReadWriteDouble", p, trans, err, DOUBLE_VALUES)
- }
- if thetype != thetype2 {
- t.Errorf("%s: %T %T type %s != type %s", "ReadWriteDouble", p, trans, thetype, thetype2)
- }
- if thelen != thelen2 {
- t.Errorf("%s: %T %T len %v != len %v", "ReadWriteDouble", p, trans, thelen, thelen2)
- }
- for k, v := range DOUBLE_VALUES {
- value, err := p.ReadDouble()
- if err != nil {
- t.Errorf("%s: %T %T %q Error reading double at index %d: %v", "ReadWriteDouble", p, trans, err, k, v)
- }
- if math.IsNaN(v) {
- if !math.IsNaN(value) {
- t.Errorf("%s: %T %T math.IsNaN(%v) != math.IsNaN(%v)", "ReadWriteDouble", p, trans, v, value)
- }
- } else if v != value {
- t.Errorf("%s: %T %T %v != %v", "ReadWriteDouble", p, trans, v, value)
- }
- }
- err = p.ReadListEnd()
- if err != nil {
- t.Errorf("%s: %T %T Unable to read list end: %q", "ReadWriteDouble", p, trans, err)
- }
-}
-
-func ReadWriteString(t testing.TB, p TProtocol, trans TTransport) {
- thetype := TType(STRING)
- thelen := len(STRING_VALUES)
- p.WriteListBegin(thetype, thelen)
- for _, v := range STRING_VALUES {
- p.WriteString(v)
- }
- p.WriteListEnd()
- p.Flush(context.Background())
- thetype2, thelen2, err := p.ReadListBegin()
- if err != nil {
- t.Errorf("%s: %T %T %q Error reading list: %q", "ReadWriteString", p, trans, err, STRING_VALUES)
- }
- _, ok := p.(*TSimpleJSONProtocol)
- if !ok {
- if thetype != thetype2 {
- t.Errorf("%s: %T %T type %s != type %s", "ReadWriteString", p, trans, thetype, thetype2)
- }
- if thelen != thelen2 {
- t.Errorf("%s: %T %T len %v != len %v", "ReadWriteString", p, trans, thelen, thelen2)
- }
- }
- for k, v := range STRING_VALUES {
- value, err := p.ReadString()
- if err != nil {
- t.Errorf("%s: %T %T %q Error reading string at index %d: %q", "ReadWriteString", p, trans, err, k, v)
- }
- if v != value {
- t.Errorf("%s: %T %T %v != %v", "ReadWriteString", p, trans, v, value)
- }
- }
- if err != nil {
- t.Errorf("%s: %T %T Unable to read list end: %q", "ReadWriteString", p, trans, err)
- }
-}
-
-func ReadWriteBinary(t testing.TB, p TProtocol, trans TTransport) {
- v := protocol_bdata
- p.WriteBinary(v)
- p.Flush(context.Background())
- value, err := p.ReadBinary()
- if err != nil {
- t.Errorf("%s: %T %T Unable to read binary: %s", "ReadWriteBinary", p, trans, err.Error())
- }
- if len(v) != len(value) {
- t.Errorf("%s: %T %T len(v) != len(value)... %d != %d", "ReadWriteBinary", p, trans, len(v), len(value))
- } else {
- for i := 0; i < len(v); i++ {
- if v[i] != value[i] {
- t.Errorf("%s: %T %T %s != %s", "ReadWriteBinary", p, trans, v, value)
- }
- }
- }
-}
diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/rich_transport_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/rich_transport_test.go
deleted file mode 100644
index 25c3fd5aa..000000000
--- a/vendor/github.com/apache/thrift/lib/go/thrift/rich_transport_test.go
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package thrift
-
-import (
- "bytes"
- "errors"
- "io"
- "reflect"
- "testing"
-)
-
-func TestEnsureTransportsAreRich(t *testing.T) {
- buf := bytes.NewBuffer(make([]byte, 0, 1024))
-
- transports := []TTransportFactory{
- NewTMemoryBufferTransportFactory(1024),
- NewStreamTransportFactory(buf, buf, true),
- NewTFramedTransportFactory(NewTMemoryBufferTransportFactory(1024)),
- NewTHttpPostClientTransportFactory("http://127.0.0.1"),
- }
- for _, tf := range transports {
- trans, err := tf.GetTransport(nil)
- if err != nil {
- t.Error(err)
- continue
- }
- _, ok := trans.(TRichTransport)
- if !ok {
- t.Errorf("Transport %s does not implement TRichTransport interface", reflect.ValueOf(trans))
- }
- }
-}
-
-// TestReadByte tests whether readByte handles error cases correctly.
-func TestReadByte(t *testing.T) {
- for i, test := range readByteTests {
- v, err := readByte(test.r)
- if v != test.v {
- t.Fatalf("TestReadByte %d: value differs. Expected %d, got %d", i, test.v, test.r.v)
- }
- if err != test.err {
- t.Fatalf("TestReadByte %d: error differs. Expected %s, got %s", i, test.err, test.r.err)
- }
- }
-}
-
-var someError = errors.New("Some error")
-var readByteTests = []struct {
- r *mockReader
- v byte
- err error
-}{
- {&mockReader{0, 55, io.EOF}, 0, io.EOF}, // reader sends EOF w/o data
- {&mockReader{0, 55, someError}, 0, someError}, // reader sends some other error
- {&mockReader{1, 55, nil}, 55, nil}, // reader sends data w/o error
- {&mockReader{1, 55, io.EOF}, 55, nil}, // reader sends data with EOF
- {&mockReader{1, 55, someError}, 55, someError}, // reader sends data withsome error
-}
-
-type mockReader struct {
- n int
- v byte
- err error
-}
-
-func (r *mockReader) Read(p []byte) (n int, err error) {
- if r.n > 0 {
- p[0] = r.v
- }
- return r.n, r.err
-}
diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/serializer_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/serializer_test.go
deleted file mode 100644
index 32227ef49..000000000
--- a/vendor/github.com/apache/thrift/lib/go/thrift/serializer_test.go
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package thrift
-
-import (
- "context"
- "errors"
- "fmt"
- "testing"
-)
-
-type ProtocolFactory interface {
- GetProtocol(t TTransport) TProtocol
-}
-
-func compareStructs(m, m1 MyTestStruct) (bool, error) {
- switch {
- case m.On != m1.On:
- return false, errors.New("Boolean not equal")
- case m.B != m1.B:
- return false, errors.New("Byte not equal")
- case m.Int16 != m1.Int16:
- return false, errors.New("Int16 not equal")
- case m.Int32 != m1.Int32:
- return false, errors.New("Int32 not equal")
- case m.Int64 != m1.Int64:
- return false, errors.New("Int64 not equal")
- case m.D != m1.D:
- return false, errors.New("Double not equal")
- case m.St != m1.St:
- return false, errors.New("String not equal")
-
- case len(m.Bin) != len(m1.Bin):
- return false, errors.New("Binary size not equal")
- case len(m.Bin) == len(m1.Bin):
- for i := range m.Bin {
- if m.Bin[i] != m1.Bin[i] {
- return false, errors.New("Binary not equal")
- }
- }
- case len(m.StringMap) != len(m1.StringMap):
- return false, errors.New("StringMap size not equal")
- case len(m.StringList) != len(m1.StringList):
- return false, errors.New("StringList size not equal")
- case len(m.StringSet) != len(m1.StringSet):
- return false, errors.New("StringSet size not equal")
-
- case m.E != m1.E:
- return false, errors.New("MyTestEnum not equal")
-
- default:
- return true, nil
-
- }
- return true, nil
-}
-
-func ProtocolTest1(test *testing.T, pf ProtocolFactory) (bool, error) {
- t := NewTSerializer()
- t.Protocol = pf.GetProtocol(t.Transport)
- var m = MyTestStruct{}
- m.On = true
- m.B = int8(0)
- m.Int16 = 1
- m.Int32 = 2
- m.Int64 = 3
- m.D = 4.1
- m.St = "Test"
- m.Bin = make([]byte, 10)
- m.StringMap = make(map[string]string, 5)
- m.StringList = make([]string, 5)
- m.StringSet = make(map[string]struct{}, 5)
- m.E = 2
-
- s, err := t.WriteString(context.Background(), &m)
- if err != nil {
- return false, errors.New(fmt.Sprintf("Unable to Serialize struct\n\t %s", err))
- }
-
- t1 := NewTDeserializer()
- t1.Protocol = pf.GetProtocol(t1.Transport)
- var m1 = MyTestStruct{}
- if err = t1.ReadString(&m1, s); err != nil {
- return false, errors.New(fmt.Sprintf("Unable to Deserialize struct\n\t %s", err))
-
- }
-
- return compareStructs(m, m1)
-
-}
-
-func ProtocolTest2(test *testing.T, pf ProtocolFactory) (bool, error) {
- t := NewTSerializer()
- t.Protocol = pf.GetProtocol(t.Transport)
- var m = MyTestStruct{}
- m.On = false
- m.B = int8(0)
- m.Int16 = 1
- m.Int32 = 2
- m.Int64 = 3
- m.D = 4.1
- m.St = "Test"
- m.Bin = make([]byte, 10)
- m.StringMap = make(map[string]string, 5)
- m.StringList = make([]string, 5)
- m.StringSet = make(map[string]struct{}, 5)
- m.E = 2
-
- s, err := t.WriteString(context.Background(), &m)
- if err != nil {
- return false, errors.New(fmt.Sprintf("Unable to Serialize struct\n\t %s", err))
-
- }
-
- t1 := NewTDeserializer()
- t1.Protocol = pf.GetProtocol(t1.Transport)
- var m1 = MyTestStruct{}
- if err = t1.ReadString(&m1, s); err != nil {
- return false, errors.New(fmt.Sprintf("Unable to Deserialize struct\n\t %s", err))
-
- }
-
- return compareStructs(m, m1)
-
-}
-
-func TestSerializer(t *testing.T) {
-
- var protocol_factories map[string]ProtocolFactory
- protocol_factories = make(map[string]ProtocolFactory)
- protocol_factories["Binary"] = NewTBinaryProtocolFactoryDefault()
- protocol_factories["Compact"] = NewTCompactProtocolFactory()
- //protocol_factories["SimpleJSON"] = NewTSimpleJSONProtocolFactory() - write only, can't be read back by design
- protocol_factories["JSON"] = NewTJSONProtocolFactory()
-
- var tests map[string]func(*testing.T, ProtocolFactory) (bool, error)
- tests = make(map[string]func(*testing.T, ProtocolFactory) (bool, error))
- tests["Test 1"] = ProtocolTest1
- tests["Test 2"] = ProtocolTest2
- //tests["Test 3"] = ProtocolTest3 // Example of how to add additional tests
-
- for name, pf := range protocol_factories {
-
- for test, f := range tests {
-
- if s, err := f(t, pf); !s || err != nil {
- t.Errorf("%s Failed for %s protocol\n\t %s", test, name, err)
- }
-
- }
- }
-
-}
diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/serializer_types_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/serializer_types_test.go
deleted file mode 100644
index c8e3b3be4..000000000
--- a/vendor/github.com/apache/thrift/lib/go/thrift/serializer_types_test.go
+++ /dev/null
@@ -1,633 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package thrift
-
-// Autogenerated by Thrift Compiler (1.0.0-dev)
-// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
-
-/* THE FOLLOWING THRIFT FILE WAS USED TO CREATE THIS
-
-enum MyTestEnum {
- FIRST = 1,
- SECOND = 2,
- THIRD = 3,
- FOURTH = 4,
-}
-
-struct MyTestStruct {
- 1: bool on,
- 2: byte b,
- 3: i16 int16,
- 4: i32 int32,
- 5: i64 int64,
- 6: double d,
- 7: string st,
- 8: binary bin,
- 9: map<string, string> stringMap,
- 10: list<string> stringList,
- 11: set<string> stringSet,
- 12: MyTestEnum e,
-}
-*/
-
-import (
- "fmt"
-)
-
-// (needed to ensure safety because of naive import list construction.)
-var _ = ZERO
-var _ = fmt.Printf
-
-var GoUnusedProtection__ int
-
-type MyTestEnum int64
-
-const (
- MyTestEnum_FIRST MyTestEnum = 1
- MyTestEnum_SECOND MyTestEnum = 2
- MyTestEnum_THIRD MyTestEnum = 3
- MyTestEnum_FOURTH MyTestEnum = 4
-)
-
-func (p MyTestEnum) String() string {
- switch p {
- case MyTestEnum_FIRST:
- return "FIRST"
- case MyTestEnum_SECOND:
- return "SECOND"
- case MyTestEnum_THIRD:
- return "THIRD"
- case MyTestEnum_FOURTH:
- return "FOURTH"
- }
- return "<UNSET>"
-}
-
-func MyTestEnumFromString(s string) (MyTestEnum, error) {
- switch s {
- case "FIRST":
- return MyTestEnum_FIRST, nil
- case "SECOND":
- return MyTestEnum_SECOND, nil
- case "THIRD":
- return MyTestEnum_THIRD, nil
- case "FOURTH":
- return MyTestEnum_FOURTH, nil
- }
- return MyTestEnum(0), fmt.Errorf("not a valid MyTestEnum string")
-}
-
-func MyTestEnumPtr(v MyTestEnum) *MyTestEnum { return &v }
-
-type MyTestStruct struct {
- On bool `thrift:"on,1" json:"on"`
- B int8 `thrift:"b,2" json:"b"`
- Int16 int16 `thrift:"int16,3" json:"int16"`
- Int32 int32 `thrift:"int32,4" json:"int32"`
- Int64 int64 `thrift:"int64,5" json:"int64"`
- D float64 `thrift:"d,6" json:"d"`
- St string `thrift:"st,7" json:"st"`
- Bin []byte `thrift:"bin,8" json:"bin"`
- StringMap map[string]string `thrift:"stringMap,9" json:"stringMap"`
- StringList []string `thrift:"stringList,10" json:"stringList"`
- StringSet map[string]struct{} `thrift:"stringSet,11" json:"stringSet"`
- E MyTestEnum `thrift:"e,12" json:"e"`
-}
-
-func NewMyTestStruct() *MyTestStruct {
- return &MyTestStruct{}
-}
-
-func (p *MyTestStruct) GetOn() bool {
- return p.On
-}
-
-func (p *MyTestStruct) GetB() int8 {
- return p.B
-}
-
-func (p *MyTestStruct) GetInt16() int16 {
- return p.Int16
-}
-
-func (p *MyTestStruct) GetInt32() int32 {
- return p.Int32
-}
-
-func (p *MyTestStruct) GetInt64() int64 {
- return p.Int64
-}
-
-func (p *MyTestStruct) GetD() float64 {
- return p.D
-}
-
-func (p *MyTestStruct) GetSt() string {
- return p.St
-}
-
-func (p *MyTestStruct) GetBin() []byte {
- return p.Bin
-}
-
-func (p *MyTestStruct) GetStringMap() map[string]string {
- return p.StringMap
-}
-
-func (p *MyTestStruct) GetStringList() []string {
- return p.StringList
-}
-
-func (p *MyTestStruct) GetStringSet() map[string]struct{} {
- return p.StringSet
-}
-
-func (p *MyTestStruct) GetE() MyTestEnum {
- return p.E
-}
-func (p *MyTestStruct) Read(iprot TProtocol) error {
- if _, err := iprot.ReadStructBegin(); err != nil {
- return PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
- if err != nil {
- return PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
- }
- if fieldTypeId == STOP {
- break
- }
- switch fieldId {
- case 1:
- if err := p.readField1(iprot); err != nil {
- return err
- }
- case 2:
- if err := p.readField2(iprot); err != nil {
- return err
- }
- case 3:
- if err := p.readField3(iprot); err != nil {
- return err
- }
- case 4:
- if err := p.readField4(iprot); err != nil {
- return err
- }
- case 5:
- if err := p.readField5(iprot); err != nil {
- return err
- }
- case 6:
- if err := p.readField6(iprot); err != nil {
- return err
- }
- case 7:
- if err := p.readField7(iprot); err != nil {
- return err
- }
- case 8:
- if err := p.readField8(iprot); err != nil {
- return err
- }
- case 9:
- if err := p.readField9(iprot); err != nil {
- return err
- }
- case 10:
- if err := p.readField10(iprot); err != nil {
- return err
- }
- case 11:
- if err := p.readField11(iprot); err != nil {
- return err
- }
- case 12:
- if err := p.readField12(iprot); err != nil {
- return err
- }
- default:
- if err := iprot.Skip(fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(); err != nil {
- return PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- return nil
-}
-
-func (p *MyTestStruct) readField1(iprot TProtocol) error {
- if v, err := iprot.ReadBool(); err != nil {
- return PrependError("error reading field 1: ", err)
- } else {
- p.On = v
- }
- return nil
-}
-
-func (p *MyTestStruct) readField2(iprot TProtocol) error {
- if v, err := iprot.ReadByte(); err != nil {
- return PrependError("error reading field 2: ", err)
- } else {
- temp := int8(v)
- p.B = temp
- }
- return nil
-}
-
-func (p *MyTestStruct) readField3(iprot TProtocol) error {
- if v, err := iprot.ReadI16(); err != nil {
- return PrependError("error reading field 3: ", err)
- } else {
- p.Int16 = v
- }
- return nil
-}
-
-func (p *MyTestStruct) readField4(iprot TProtocol) error {
- if v, err := iprot.ReadI32(); err != nil {
- return PrependError("error reading field 4: ", err)
- } else {
- p.Int32 = v
- }
- return nil
-}
-
-func (p *MyTestStruct) readField5(iprot TProtocol) error {
- if v, err := iprot.ReadI64(); err != nil {
- return PrependError("error reading field 5: ", err)
- } else {
- p.Int64 = v
- }
- return nil
-}
-
-func (p *MyTestStruct) readField6(iprot TProtocol) error {
- if v, err := iprot.ReadDouble(); err != nil {
- return PrependError("error reading field 6: ", err)
- } else {
- p.D = v
- }
- return nil
-}
-
-func (p *MyTestStruct) readField7(iprot TProtocol) error {
- if v, err := iprot.ReadString(); err != nil {
- return PrependError("error reading field 7: ", err)
- } else {
- p.St = v
- }
- return nil
-}
-
-func (p *MyTestStruct) readField8(iprot TProtocol) error {
- if v, err := iprot.ReadBinary(); err != nil {
- return PrependError("error reading field 8: ", err)
- } else {
- p.Bin = v
- }
- return nil
-}
-
-func (p *MyTestStruct) readField9(iprot TProtocol) error {
- _, _, size, err := iprot.ReadMapBegin()
- if err != nil {
- return PrependError("error reading map begin: ", err)
- }
- tMap := make(map[string]string, size)
- p.StringMap = tMap
- for i := 0; i < size; i++ {
- var _key0 string
- if v, err := iprot.ReadString(); err != nil {
- return PrependError("error reading field 0: ", err)
- } else {
- _key0 = v
- }
- var _val1 string
- if v, err := iprot.ReadString(); err != nil {
- return PrependError("error reading field 0: ", err)
- } else {
- _val1 = v
- }
- p.StringMap[_key0] = _val1
- }
- if err := iprot.ReadMapEnd(); err != nil {
- return PrependError("error reading map end: ", err)
- }
- return nil
-}
-
-func (p *MyTestStruct) readField10(iprot TProtocol) error {
- _, size, err := iprot.ReadListBegin()
- if err != nil {
- return PrependError("error reading list begin: ", err)
- }
- tSlice := make([]string, 0, size)
- p.StringList = tSlice
- for i := 0; i < size; i++ {
- var _elem2 string
- if v, err := iprot.ReadString(); err != nil {
- return PrependError("error reading field 0: ", err)
- } else {
- _elem2 = v
- }
- p.StringList = append(p.StringList, _elem2)
- }
- if err := iprot.ReadListEnd(); err != nil {
- return PrependError("error reading list end: ", err)
- }
- return nil
-}
-
-func (p *MyTestStruct) readField11(iprot TProtocol) error {
- _, size, err := iprot.ReadSetBegin()
- if err != nil {
- return PrependError("error reading set begin: ", err)
- }
- tSet := make(map[string]struct{}, size)
- p.StringSet = tSet
- for i := 0; i < size; i++ {
- var _elem3 string
- if v, err := iprot.ReadString(); err != nil {
- return PrependError("error reading field 0: ", err)
- } else {
- _elem3 = v
- }
- p.StringSet[_elem3] = struct{}{}
- }
- if err := iprot.ReadSetEnd(); err != nil {
- return PrependError("error reading set end: ", err)
- }
- return nil
-}
-
-func (p *MyTestStruct) readField12(iprot TProtocol) error {
- if v, err := iprot.ReadI32(); err != nil {
- return PrependError("error reading field 12: ", err)
- } else {
- temp := MyTestEnum(v)
- p.E = temp
- }
- return nil
-}
-
-func (p *MyTestStruct) Write(oprot TProtocol) error {
- if err := oprot.WriteStructBegin("MyTestStruct"); err != nil {
- return PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
- }
- if err := p.writeField1(oprot); err != nil {
- return err
- }
- if err := p.writeField2(oprot); err != nil {
- return err
- }
- if err := p.writeField3(oprot); err != nil {
- return err
- }
- if err := p.writeField4(oprot); err != nil {
- return err
- }
- if err := p.writeField5(oprot); err != nil {
- return err
- }
- if err := p.writeField6(oprot); err != nil {
- return err
- }
- if err := p.writeField7(oprot); err != nil {
- return err
- }
- if err := p.writeField8(oprot); err != nil {
- return err
- }
- if err := p.writeField9(oprot); err != nil {
- return err
- }
- if err := p.writeField10(oprot); err != nil {
- return err
- }
- if err := p.writeField11(oprot); err != nil {
- return err
- }
- if err := p.writeField12(oprot); err != nil {
- return err
- }
- if err := oprot.WriteFieldStop(); err != nil {
- return PrependError("write field stop error: ", err)
- }
- if err := oprot.WriteStructEnd(); err != nil {
- return PrependError("write struct stop error: ", err)
- }
- return nil
-}
-
-func (p *MyTestStruct) writeField1(oprot TProtocol) (err error) {
- if err := oprot.WriteFieldBegin("on", BOOL, 1); err != nil {
- return PrependError(fmt.Sprintf("%T write field begin error 1:on: ", p), err)
- }
- if err := oprot.WriteBool(bool(p.On)); err != nil {
- return PrependError(fmt.Sprintf("%T.on (1) field write error: ", p), err)
- }
- if err := oprot.WriteFieldEnd(); err != nil {
- return PrependError(fmt.Sprintf("%T write field end error 1:on: ", p), err)
- }
- return err
-}
-
-func (p *MyTestStruct) writeField2(oprot TProtocol) (err error) {
- if err := oprot.WriteFieldBegin("b", BYTE, 2); err != nil {
- return PrependError(fmt.Sprintf("%T write field begin error 2:b: ", p), err)
- }
- if err := oprot.WriteByte(int8(p.B)); err != nil {
- return PrependError(fmt.Sprintf("%T.b (2) field write error: ", p), err)
- }
- if err := oprot.WriteFieldEnd(); err != nil {
- return PrependError(fmt.Sprintf("%T write field end error 2:b: ", p), err)
- }
- return err
-}
-
-func (p *MyTestStruct) writeField3(oprot TProtocol) (err error) {
- if err := oprot.WriteFieldBegin("int16", I16, 3); err != nil {
- return PrependError(fmt.Sprintf("%T write field begin error 3:int16: ", p), err)
- }
- if err := oprot.WriteI16(int16(p.Int16)); err != nil {
- return PrependError(fmt.Sprintf("%T.int16 (3) field write error: ", p), err)
- }
- if err := oprot.WriteFieldEnd(); err != nil {
- return PrependError(fmt.Sprintf("%T write field end error 3:int16: ", p), err)
- }
- return err
-}
-
-func (p *MyTestStruct) writeField4(oprot TProtocol) (err error) {
- if err := oprot.WriteFieldBegin("int32", I32, 4); err != nil {
- return PrependError(fmt.Sprintf("%T write field begin error 4:int32: ", p), err)
- }
- if err := oprot.WriteI32(int32(p.Int32)); err != nil {
- return PrependError(fmt.Sprintf("%T.int32 (4) field write error: ", p), err)
- }
- if err := oprot.WriteFieldEnd(); err != nil {
- return PrependError(fmt.Sprintf("%T write field end error 4:int32: ", p), err)
- }
- return err
-}
-
-func (p *MyTestStruct) writeField5(oprot TProtocol) (err error) {
- if err := oprot.WriteFieldBegin("int64", I64, 5); err != nil {
- return PrependError(fmt.Sprintf("%T write field begin error 5:int64: ", p), err)
- }
- if err := oprot.WriteI64(int64(p.Int64)); err != nil {
- return PrependError(fmt.Sprintf("%T.int64 (5) field write error: ", p), err)
- }
- if err := oprot.WriteFieldEnd(); err != nil {
- return PrependError(fmt.Sprintf("%T write field end error 5:int64: ", p), err)
- }
- return err
-}
-
-func (p *MyTestStruct) writeField6(oprot TProtocol) (err error) {
- if err := oprot.WriteFieldBegin("d", DOUBLE, 6); err != nil {
- return PrependError(fmt.Sprintf("%T write field begin error 6:d: ", p), err)
- }
- if err := oprot.WriteDouble(float64(p.D)); err != nil {
- return PrependError(fmt.Sprintf("%T.d (6) field write error: ", p), err)
- }
- if err := oprot.WriteFieldEnd(); err != nil {
- return PrependError(fmt.Sprintf("%T write field end error 6:d: ", p), err)
- }
- return err
-}
-
-func (p *MyTestStruct) writeField7(oprot TProtocol) (err error) {
- if err := oprot.WriteFieldBegin("st", STRING, 7); err != nil {
- return PrependError(fmt.Sprintf("%T write field begin error 7:st: ", p), err)
- }
- if err := oprot.WriteString(string(p.St)); err != nil {
- return PrependError(fmt.Sprintf("%T.st (7) field write error: ", p), err)
- }
- if err := oprot.WriteFieldEnd(); err != nil {
- return PrependError(fmt.Sprintf("%T write field end error 7:st: ", p), err)
- }
- return err
-}
-
-func (p *MyTestStruct) writeField8(oprot TProtocol) (err error) {
- if err := oprot.WriteFieldBegin("bin", STRING, 8); err != nil {
- return PrependError(fmt.Sprintf("%T write field begin error 8:bin: ", p), err)
- }
- if err := oprot.WriteBinary(p.Bin); err != nil {
- return PrependError(fmt.Sprintf("%T.bin (8) field write error: ", p), err)
- }
- if err := oprot.WriteFieldEnd(); err != nil {
- return PrependError(fmt.Sprintf("%T write field end error 8:bin: ", p), err)
- }
- return err
-}
-
-func (p *MyTestStruct) writeField9(oprot TProtocol) (err error) {
- if err := oprot.WriteFieldBegin("stringMap", MAP, 9); err != nil {
- return PrependError(fmt.Sprintf("%T write field begin error 9:stringMap: ", p), err)
- }
- if err := oprot.WriteMapBegin(STRING, STRING, len(p.StringMap)); err != nil {
- return PrependError("error writing map begin: ", err)
- }
- for k, v := range p.StringMap {
- if err := oprot.WriteString(string(k)); err != nil {
- return PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err)
- }
- if err := oprot.WriteString(string(v)); err != nil {
- return PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err)
- }
- }
- if err := oprot.WriteMapEnd(); err != nil {
- return PrependError("error writing map end: ", err)
- }
- if err := oprot.WriteFieldEnd(); err != nil {
- return PrependError(fmt.Sprintf("%T write field end error 9:stringMap: ", p), err)
- }
- return err
-}
-
-func (p *MyTestStruct) writeField10(oprot TProtocol) (err error) {
- if err := oprot.WriteFieldBegin("stringList", LIST, 10); err != nil {
- return PrependError(fmt.Sprintf("%T write field begin error 10:stringList: ", p), err)
- }
- if err := oprot.WriteListBegin(STRING, len(p.StringList)); err != nil {
- return PrependError("error writing list begin: ", err)
- }
- for _, v := range p.StringList {
- if err := oprot.WriteString(string(v)); err != nil {
- return PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err)
- }
- }
- if err := oprot.WriteListEnd(); err != nil {
- return PrependError("error writing list end: ", err)
- }
- if err := oprot.WriteFieldEnd(); err != nil {
- return PrependError(fmt.Sprintf("%T write field end error 10:stringList: ", p), err)
- }
- return err
-}
-
-func (p *MyTestStruct) writeField11(oprot TProtocol) (err error) {
- if err := oprot.WriteFieldBegin("stringSet", SET, 11); err != nil {
- return PrependError(fmt.Sprintf("%T write field begin error 11:stringSet: ", p), err)
- }
- if err := oprot.WriteSetBegin(STRING, len(p.StringSet)); err != nil {
- return PrependError("error writing set begin: ", err)
- }
- for v := range p.StringSet {
- if err := oprot.WriteString(string(v)); err != nil {
- return PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err)
- }
- }
- if err := oprot.WriteSetEnd(); err != nil {
- return PrependError("error writing set end: ", err)
- }
- if err := oprot.WriteFieldEnd(); err != nil {
- return PrependError(fmt.Sprintf("%T write field end error 11:stringSet: ", p), err)
- }
- return err
-}
-
-func (p *MyTestStruct) writeField12(oprot TProtocol) (err error) {
- if err := oprot.WriteFieldBegin("e", I32, 12); err != nil {
- return PrependError(fmt.Sprintf("%T write field begin error 12:e: ", p), err)
- }
- if err := oprot.WriteI32(int32(p.E)); err != nil {
- return PrependError(fmt.Sprintf("%T.e (12) field write error: ", p), err)
- }
- if err := oprot.WriteFieldEnd(); err != nil {
- return PrependError(fmt.Sprintf("%T write field end error 12:e: ", p), err)
- }
- return err
-}
-
-func (p *MyTestStruct) String() string {
- if p == nil {
- return "<nil>"
- }
- return fmt.Sprintf("MyTestStruct(%+v)", *p)
-}
diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/server_socket_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/server_socket_test.go
deleted file mode 100644
index f1e1983a9..000000000
--- a/vendor/github.com/apache/thrift/lib/go/thrift/server_socket_test.go
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package thrift
-
-import (
- "fmt"
- "testing"
-)
-
-func TestSocketIsntListeningAfterInterrupt(t *testing.T) {
- host := "127.0.0.1"
- port := 9090
- addr := fmt.Sprintf("%s:%d", host, port)
-
- socket := CreateServerSocket(t, addr)
- socket.Listen()
- socket.Interrupt()
-
- newSocket := CreateServerSocket(t, addr)
- err := newSocket.Listen()
- defer newSocket.Interrupt()
- if err != nil {
- t.Fatalf("Failed to rebinds: %s", err)
- }
-}
-
-func TestSocketConcurrency(t *testing.T) {
- host := "127.0.0.1"
- port := 9090
- addr := fmt.Sprintf("%s:%d", host, port)
-
- socket := CreateServerSocket(t, addr)
- go func() { socket.Listen() }()
- go func() { socket.Interrupt() }()
-}
-
-func CreateServerSocket(t *testing.T, addr string) *TServerSocket {
- socket, err := NewTServerSocket(addr)
- if err != nil {
- t.Fatalf("Failed to create server socket: %s", err)
- }
- return socket
-}
diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/server_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/server_test.go
deleted file mode 100644
index ffaf45702..000000000
--- a/vendor/github.com/apache/thrift/lib/go/thrift/server_test.go
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package thrift
-
-import (
- "testing"
-)
-
-func TestNothing(t *testing.T) {
-
-}
diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/simple_json_protocol_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/simple_json_protocol_test.go
deleted file mode 100644
index 7b98082a4..000000000
--- a/vendor/github.com/apache/thrift/lib/go/thrift/simple_json_protocol_test.go
+++ /dev/null
@@ -1,716 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package thrift
-
-import (
- "context"
- "encoding/base64"
- "encoding/json"
- "fmt"
- "math"
- "strconv"
- "strings"
- "testing"
-)
-
-func TestWriteSimpleJSONProtocolBool(t *testing.T) {
- thetype := "boolean"
- trans := NewTMemoryBuffer()
- p := NewTSimpleJSONProtocol(trans)
- for _, value := range BOOL_VALUES {
- if e := p.WriteBool(value); e != nil {
- t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error())
- }
- if e := p.Flush(context.Background()); e != nil {
- t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error())
- }
- s := trans.String()
- if s != fmt.Sprint(value) {
- t.Fatalf("Bad value for %s %v: %s", thetype, value, s)
- }
- v := false
- if err := json.Unmarshal([]byte(s), &v); err != nil || v != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v)
- }
- trans.Reset()
- }
- trans.Close()
-}
-
-func TestReadSimpleJSONProtocolBool(t *testing.T) {
- thetype := "boolean"
- for _, value := range BOOL_VALUES {
- trans := NewTMemoryBuffer()
- p := NewTSimpleJSONProtocol(trans)
- if value {
- trans.Write(JSON_TRUE)
- } else {
- trans.Write(JSON_FALSE)
- }
- trans.Flush(context.Background())
- s := trans.String()
- v, e := p.ReadBool()
- if e != nil {
- t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error())
- }
- if v != value {
- t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v)
- }
- if err := json.Unmarshal([]byte(s), &v); err != nil || v != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v)
- }
- trans.Reset()
- trans.Close()
- }
-}
-
-func TestWriteSimpleJSONProtocolByte(t *testing.T) {
- thetype := "byte"
- trans := NewTMemoryBuffer()
- p := NewTSimpleJSONProtocol(trans)
- for _, value := range BYTE_VALUES {
- if e := p.WriteByte(value); e != nil {
- t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error())
- }
- if e := p.Flush(context.Background()); e != nil {
- t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error())
- }
- s := trans.String()
- if s != fmt.Sprint(value) {
- t.Fatalf("Bad value for %s %v: %s", thetype, value, s)
- }
- v := int8(0)
- if err := json.Unmarshal([]byte(s), &v); err != nil || v != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v)
- }
- trans.Reset()
- }
- trans.Close()
-}
-
-func TestReadSimpleJSONProtocolByte(t *testing.T) {
- thetype := "byte"
- for _, value := range BYTE_VALUES {
- trans := NewTMemoryBuffer()
- p := NewTSimpleJSONProtocol(trans)
- trans.WriteString(strconv.Itoa(int(value)))
- trans.Flush(context.Background())
- s := trans.String()
- v, e := p.ReadByte()
- if e != nil {
- t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error())
- }
- if v != value {
- t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v)
- }
- if err := json.Unmarshal([]byte(s), &v); err != nil || v != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v)
- }
- trans.Reset()
- trans.Close()
- }
-}
-
-func TestWriteSimpleJSONProtocolI16(t *testing.T) {
- thetype := "int16"
- trans := NewTMemoryBuffer()
- p := NewTSimpleJSONProtocol(trans)
- for _, value := range INT16_VALUES {
- if e := p.WriteI16(value); e != nil {
- t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error())
- }
- if e := p.Flush(context.Background()); e != nil {
- t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error())
- }
- s := trans.String()
- if s != fmt.Sprint(value) {
- t.Fatalf("Bad value for %s %v: %s", thetype, value, s)
- }
- v := int16(0)
- if err := json.Unmarshal([]byte(s), &v); err != nil || v != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v)
- }
- trans.Reset()
- }
- trans.Close()
-}
-
-func TestReadSimpleJSONProtocolI16(t *testing.T) {
- thetype := "int16"
- for _, value := range INT16_VALUES {
- trans := NewTMemoryBuffer()
- p := NewTSimpleJSONProtocol(trans)
- trans.WriteString(strconv.Itoa(int(value)))
- trans.Flush(context.Background())
- s := trans.String()
- v, e := p.ReadI16()
- if e != nil {
- t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error())
- }
- if v != value {
- t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v)
- }
- if err := json.Unmarshal([]byte(s), &v); err != nil || v != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v)
- }
- trans.Reset()
- trans.Close()
- }
-}
-
-func TestWriteSimpleJSONProtocolI32(t *testing.T) {
- thetype := "int32"
- trans := NewTMemoryBuffer()
- p := NewTSimpleJSONProtocol(trans)
- for _, value := range INT32_VALUES {
- if e := p.WriteI32(value); e != nil {
- t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error())
- }
- if e := p.Flush(context.Background()); e != nil {
- t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error())
- }
- s := trans.String()
- if s != fmt.Sprint(value) {
- t.Fatalf("Bad value for %s %v: %s", thetype, value, s)
- }
- v := int32(0)
- if err := json.Unmarshal([]byte(s), &v); err != nil || v != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v)
- }
- trans.Reset()
- }
- trans.Close()
-}
-
-func TestReadSimpleJSONProtocolI32(t *testing.T) {
- thetype := "int32"
- for _, value := range INT32_VALUES {
- trans := NewTMemoryBuffer()
- p := NewTSimpleJSONProtocol(trans)
- trans.WriteString(strconv.Itoa(int(value)))
- trans.Flush(context.Background())
- s := trans.String()
- v, e := p.ReadI32()
- if e != nil {
- t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error())
- }
- if v != value {
- t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v)
- }
- if err := json.Unmarshal([]byte(s), &v); err != nil || v != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v)
- }
- trans.Reset()
- trans.Close()
- }
-}
-
-func TestReadSimpleJSONProtocolI32Null(t *testing.T) {
- thetype := "int32"
- value := "null"
-
- trans := NewTMemoryBuffer()
- p := NewTSimpleJSONProtocol(trans)
- trans.WriteString(value)
- trans.Flush(context.Background())
- s := trans.String()
- v, e := p.ReadI32()
-
- if e != nil {
- t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error())
- }
- if v != 0 {
- t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v)
- }
- trans.Reset()
- trans.Close()
-}
-
-func TestWriteSimpleJSONProtocolI64(t *testing.T) {
- thetype := "int64"
- trans := NewTMemoryBuffer()
- p := NewTSimpleJSONProtocol(trans)
- for _, value := range INT64_VALUES {
- if e := p.WriteI64(value); e != nil {
- t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error())
- }
- if e := p.Flush(context.Background()); e != nil {
- t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error())
- }
- s := trans.String()
- if s != fmt.Sprint(value) {
- t.Fatalf("Bad value for %s %v: %s", thetype, value, s)
- }
- v := int64(0)
- if err := json.Unmarshal([]byte(s), &v); err != nil || v != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v)
- }
- trans.Reset()
- }
- trans.Close()
-}
-
-func TestReadSimpleJSONProtocolI64(t *testing.T) {
- thetype := "int64"
- for _, value := range INT64_VALUES {
- trans := NewTMemoryBuffer()
- p := NewTSimpleJSONProtocol(trans)
- trans.WriteString(strconv.FormatInt(value, 10))
- trans.Flush(context.Background())
- s := trans.String()
- v, e := p.ReadI64()
- if e != nil {
- t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error())
- }
- if v != value {
- t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v)
- }
- if err := json.Unmarshal([]byte(s), &v); err != nil || v != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v)
- }
- trans.Reset()
- trans.Close()
- }
-}
-
-func TestReadSimpleJSONProtocolI64Null(t *testing.T) {
- thetype := "int32"
- value := "null"
-
- trans := NewTMemoryBuffer()
- p := NewTSimpleJSONProtocol(trans)
- trans.WriteString(value)
- trans.Flush(context.Background())
- s := trans.String()
- v, e := p.ReadI64()
-
- if e != nil {
- t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error())
- }
- if v != 0 {
- t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v)
- }
- trans.Reset()
- trans.Close()
-}
-
-func TestWriteSimpleJSONProtocolDouble(t *testing.T) {
- thetype := "double"
- trans := NewTMemoryBuffer()
- p := NewTSimpleJSONProtocol(trans)
- for _, value := range DOUBLE_VALUES {
- if e := p.WriteDouble(value); e != nil {
- t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error())
- }
- if e := p.Flush(context.Background()); e != nil {
- t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error())
- }
- s := trans.String()
- if math.IsInf(value, 1) {
- if s != jsonQuote(JSON_INFINITY) {
- t.Fatalf("Bad value for %s %v, wrote: %v, expected: %v", thetype, value, s, jsonQuote(JSON_INFINITY))
- }
- } else if math.IsInf(value, -1) {
- if s != jsonQuote(JSON_NEGATIVE_INFINITY) {
- t.Fatalf("Bad value for %s %v, wrote: %v, expected: %v", thetype, value, s, jsonQuote(JSON_NEGATIVE_INFINITY))
- }
- } else if math.IsNaN(value) {
- if s != jsonQuote(JSON_NAN) {
- t.Fatalf("Bad value for %s %v, wrote: %v, expected: %v", thetype, value, s, jsonQuote(JSON_NAN))
- }
- } else {
- if s != fmt.Sprint(value) {
- t.Fatalf("Bad value for %s %v: %s", thetype, value, s)
- }
- v := float64(0)
- if err := json.Unmarshal([]byte(s), &v); err != nil || v != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v)
- }
- }
- trans.Reset()
- }
- trans.Close()
-}
-
-func TestReadSimpleJSONProtocolDouble(t *testing.T) {
- thetype := "double"
- for _, value := range DOUBLE_VALUES {
- trans := NewTMemoryBuffer()
- p := NewTSimpleJSONProtocol(trans)
- n := NewNumericFromDouble(value)
- trans.WriteString(n.String())
- trans.Flush(context.Background())
- s := trans.String()
- v, e := p.ReadDouble()
- if e != nil {
- t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error())
- }
- if math.IsInf(value, 1) {
- if !math.IsInf(v, 1) {
- t.Fatalf("Bad value for %s %v, wrote: %v, received: %v", thetype, value, s, v)
- }
- } else if math.IsInf(value, -1) {
- if !math.IsInf(v, -1) {
- t.Fatalf("Bad value for %s %v, wrote: %v, received: %v", thetype, value, s, v)
- }
- } else if math.IsNaN(value) {
- if !math.IsNaN(v) {
- t.Fatalf("Bad value for %s %v, wrote: %v, received: %v", thetype, value, s, v)
- }
- } else {
- if v != value {
- t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v)
- }
- if err := json.Unmarshal([]byte(s), &v); err != nil || v != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v)
- }
- }
- trans.Reset()
- trans.Close()
- }
-}
-
-func TestWriteSimpleJSONProtocolString(t *testing.T) {
- thetype := "string"
- trans := NewTMemoryBuffer()
- p := NewTSimpleJSONProtocol(trans)
- for _, value := range STRING_VALUES {
- if e := p.WriteString(value); e != nil {
- t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error())
- }
- if e := p.Flush(context.Background()); e != nil {
- t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error())
- }
- s := trans.String()
- if s[0] != '"' || s[len(s)-1] != '"' {
- t.Fatalf("Bad value for %s '%v', wrote '%v', expected: %v", thetype, value, s, fmt.Sprint("\"", value, "\""))
- }
- v := new(string)
- if err := json.Unmarshal([]byte(s), v); err != nil || *v != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, *v)
- }
- trans.Reset()
- }
- trans.Close()
-}
-
-func TestReadSimpleJSONProtocolString(t *testing.T) {
- thetype := "string"
- for _, value := range STRING_VALUES {
- trans := NewTMemoryBuffer()
- p := NewTSimpleJSONProtocol(trans)
- trans.WriteString(jsonQuote(value))
- trans.Flush(context.Background())
- s := trans.String()
- v, e := p.ReadString()
- if e != nil {
- t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error())
- }
- if v != value {
- t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v)
- }
- v1 := new(string)
- if err := json.Unmarshal([]byte(s), v1); err != nil || *v1 != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, *v1)
- }
- trans.Reset()
- trans.Close()
- }
-}
-func TestReadSimpleJSONProtocolStringNull(t *testing.T) {
- thetype := "string"
- value := "null"
-
- trans := NewTMemoryBuffer()
- p := NewTSimpleJSONProtocol(trans)
- trans.WriteString(value)
- trans.Flush(context.Background())
- s := trans.String()
- v, e := p.ReadString()
- if e != nil {
- t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error())
- }
- if v != "" {
- t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v)
- }
- trans.Reset()
- trans.Close()
-}
-
-func TestWriteSimpleJSONProtocolBinary(t *testing.T) {
- thetype := "binary"
- value := protocol_bdata
- b64value := make([]byte, base64.StdEncoding.EncodedLen(len(protocol_bdata)))
- base64.StdEncoding.Encode(b64value, value)
- b64String := string(b64value)
- trans := NewTMemoryBuffer()
- p := NewTSimpleJSONProtocol(trans)
- if e := p.WriteBinary(value); e != nil {
- t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error())
- }
- if e := p.Flush(context.Background()); e != nil {
- t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error())
- }
- s := trans.String()
- if s != fmt.Sprint("\"", b64String, "\"") {
- t.Fatalf("Bad value for %s %v\n wrote: %v\nexpected: %v", thetype, value, s, "\""+b64String+"\"")
- }
- v1 := new(string)
- if err := json.Unmarshal([]byte(s), v1); err != nil || *v1 != b64String {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, *v1)
- }
- trans.Close()
-}
-
-func TestReadSimpleJSONProtocolBinary(t *testing.T) {
- thetype := "binary"
- value := protocol_bdata
- b64value := make([]byte, base64.StdEncoding.EncodedLen(len(protocol_bdata)))
- base64.StdEncoding.Encode(b64value, value)
- b64String := string(b64value)
- trans := NewTMemoryBuffer()
- p := NewTSimpleJSONProtocol(trans)
- trans.WriteString(jsonQuote(b64String))
- trans.Flush(context.Background())
- s := trans.String()
- v, e := p.ReadBinary()
- if e != nil {
- t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error())
- }
- if len(v) != len(value) {
- t.Fatalf("Bad value for %s value length %v, wrote: %v, received length: %v", thetype, len(value), s, len(v))
- }
- for i := 0; i < len(v); i++ {
- if v[i] != value[i] {
- t.Fatalf("Bad value for %s at index %d value %v, wrote: %v, received: %v", thetype, i, value[i], s, v[i])
- }
- }
- v1 := new(string)
- if err := json.Unmarshal([]byte(s), v1); err != nil || *v1 != b64String {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, *v1)
- }
- trans.Reset()
- trans.Close()
-}
-
-func TestReadSimpleJSONProtocolBinaryNull(t *testing.T) {
- thetype := "binary"
- value := "null"
-
- trans := NewTMemoryBuffer()
- p := NewTSimpleJSONProtocol(trans)
- trans.WriteString(value)
- trans.Flush(context.Background())
- s := trans.String()
- b, e := p.ReadBinary()
- v := string(b)
-
- if e != nil {
- t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error())
- }
- if v != "" {
- t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v)
- }
- trans.Reset()
- trans.Close()
-}
-
-func TestWriteSimpleJSONProtocolList(t *testing.T) {
- thetype := "list"
- trans := NewTMemoryBuffer()
- p := NewTSimpleJSONProtocol(trans)
- p.WriteListBegin(TType(DOUBLE), len(DOUBLE_VALUES))
- for _, value := range DOUBLE_VALUES {
- if e := p.WriteDouble(value); e != nil {
- t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error())
- }
- }
- p.WriteListEnd()
- if e := p.Flush(context.Background()); e != nil {
- t.Fatalf("Unable to write %s due to error flushing: %s", thetype, e.Error())
- }
- str := trans.String()
- str1 := new([]interface{})
- err := json.Unmarshal([]byte(str), str1)
- if err != nil {
- t.Fatalf("Unable to decode %s, wrote: %s", thetype, str)
- }
- l := *str1
- if len(l) < 2 {
- t.Fatalf("List must be at least of length two to include metadata")
- }
- if int(l[0].(float64)) != DOUBLE {
- t.Fatal("Invalid type for list, expected: ", DOUBLE, ", but was: ", l[0])
- }
- if int(l[1].(float64)) != len(DOUBLE_VALUES) {
- t.Fatal("Invalid length for list, expected: ", len(DOUBLE_VALUES), ", but was: ", l[1])
- }
- for k, value := range DOUBLE_VALUES {
- s := l[k+2]
- if math.IsInf(value, 1) {
- if s.(string) != JSON_INFINITY {
- t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_INFINITY), str)
- }
- } else if math.IsInf(value, 0) {
- if s.(string) != JSON_NEGATIVE_INFINITY {
- t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_NEGATIVE_INFINITY), str)
- }
- } else if math.IsNaN(value) {
- if s.(string) != JSON_NAN {
- t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_NAN), str)
- }
- } else {
- if s.(float64) != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s'", thetype, value, s)
- }
- }
- trans.Reset()
- }
- trans.Close()
-}
-
-func TestWriteSimpleJSONProtocolSet(t *testing.T) {
- thetype := "set"
- trans := NewTMemoryBuffer()
- p := NewTSimpleJSONProtocol(trans)
- p.WriteSetBegin(TType(DOUBLE), len(DOUBLE_VALUES))
- for _, value := range DOUBLE_VALUES {
- if e := p.WriteDouble(value); e != nil {
- t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error())
- }
- }
- p.WriteSetEnd()
- if e := p.Flush(context.Background()); e != nil {
- t.Fatalf("Unable to write %s due to error flushing: %s", thetype, e.Error())
- }
- str := trans.String()
- str1 := new([]interface{})
- err := json.Unmarshal([]byte(str), str1)
- if err != nil {
- t.Fatalf("Unable to decode %s, wrote: %s", thetype, str)
- }
- l := *str1
- if len(l) < 2 {
- t.Fatalf("Set must be at least of length two to include metadata")
- }
- if int(l[0].(float64)) != DOUBLE {
- t.Fatal("Invalid type for set, expected: ", DOUBLE, ", but was: ", l[0])
- }
- if int(l[1].(float64)) != len(DOUBLE_VALUES) {
- t.Fatal("Invalid length for set, expected: ", len(DOUBLE_VALUES), ", but was: ", l[1])
- }
- for k, value := range DOUBLE_VALUES {
- s := l[k+2]
- if math.IsInf(value, 1) {
- if s.(string) != JSON_INFINITY {
- t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_INFINITY), str)
- }
- } else if math.IsInf(value, 0) {
- if s.(string) != JSON_NEGATIVE_INFINITY {
- t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_NEGATIVE_INFINITY), str)
- }
- } else if math.IsNaN(value) {
- if s.(string) != JSON_NAN {
- t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_NAN), str)
- }
- } else {
- if s.(float64) != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s'", thetype, value, s)
- }
- }
- trans.Reset()
- }
- trans.Close()
-}
-
-func TestWriteSimpleJSONProtocolMap(t *testing.T) {
- thetype := "map"
- trans := NewTMemoryBuffer()
- p := NewTSimpleJSONProtocol(trans)
- p.WriteMapBegin(TType(I32), TType(DOUBLE), len(DOUBLE_VALUES))
- for k, value := range DOUBLE_VALUES {
- if e := p.WriteI32(int32(k)); e != nil {
- t.Fatalf("Unable to write %s key int32 value %v due to error: %s", thetype, k, e.Error())
- }
- if e := p.WriteDouble(value); e != nil {
- t.Fatalf("Unable to write %s value float64 value %v due to error: %s", thetype, value, e.Error())
- }
- }
- p.WriteMapEnd()
- if e := p.Flush(context.Background()); e != nil {
- t.Fatalf("Unable to write %s due to error flushing: %s", thetype, e.Error())
- }
- str := trans.String()
- if str[0] != '[' || str[len(str)-1] != ']' {
- t.Fatalf("Bad value for %s, wrote: %v, in go: %v", thetype, str, DOUBLE_VALUES)
- }
- l := strings.Split(str[1:len(str)-1], ",")
- if len(l) < 3 {
- t.Fatal("Expected list of at least length 3 for map for metadata, but was of length ", len(l))
- }
- expectedKeyType, _ := strconv.Atoi(l[0])
- expectedValueType, _ := strconv.Atoi(l[1])
- expectedSize, _ := strconv.Atoi(l[2])
- if expectedKeyType != I32 {
- t.Fatal("Expected map key type ", I32, ", but was ", l[0])
- }
- if expectedValueType != DOUBLE {
- t.Fatal("Expected map value type ", DOUBLE, ", but was ", l[1])
- }
- if expectedSize != len(DOUBLE_VALUES) {
- t.Fatal("Expected map size of ", len(DOUBLE_VALUES), ", but was ", l[2])
- }
- for k, value := range DOUBLE_VALUES {
- strk := l[k*2+3]
- strv := l[k*2+4]
- ik, err := strconv.Atoi(strk)
- if err != nil {
- t.Fatalf("Bad value for %s index %v, wrote: %v, expected: %v, error: %s", thetype, k, strk, string(k), err.Error())
- }
- if ik != k {
- t.Fatalf("Bad value for %s index %v, wrote: %v, expected: %v", thetype, k, strk, k)
- }
- s := strv
- if math.IsInf(value, 1) {
- if s != jsonQuote(JSON_INFINITY) {
- t.Fatalf("Bad value for %s at index %v %v, wrote: %v, expected: %v", thetype, k, value, s, jsonQuote(JSON_INFINITY))
- }
- } else if math.IsInf(value, 0) {
- if s != jsonQuote(JSON_NEGATIVE_INFINITY) {
- t.Fatalf("Bad value for %s at index %v %v, wrote: %v, expected: %v", thetype, k, value, s, jsonQuote(JSON_NEGATIVE_INFINITY))
- }
- } else if math.IsNaN(value) {
- if s != jsonQuote(JSON_NAN) {
- t.Fatalf("Bad value for %s at index %v %v, wrote: %v, expected: %v", thetype, k, value, s, jsonQuote(JSON_NAN))
- }
- } else {
- expected := strconv.FormatFloat(value, 'g', 10, 64)
- if s != expected {
- t.Fatalf("Bad value for %s at index %v %v, wrote: %v, expected %v", thetype, k, value, s, expected)
- }
- v := float64(0)
- if err := json.Unmarshal([]byte(s), &v); err != nil || v != value {
- t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v)
- }
- }
- trans.Reset()
- }
- trans.Close()
-}
diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/simple_server_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/simple_server_test.go
deleted file mode 100644
index 58149a8e6..000000000
--- a/vendor/github.com/apache/thrift/lib/go/thrift/simple_server_test.go
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package thrift
-
-import (
- "testing"
- "errors"
- "runtime"
-)
-
-type mockServerTransport struct {
- ListenFunc func() error
- AcceptFunc func() (TTransport, error)
- CloseFunc func() error
- InterruptFunc func() error
-}
-
-func (m *mockServerTransport) Listen() error {
- return m.ListenFunc()
-}
-
-func (m *mockServerTransport) Accept() (TTransport, error) {
- return m.AcceptFunc()
-}
-
-func (m *mockServerTransport) Close() error {
- return m.CloseFunc()
-}
-
-func (m *mockServerTransport) Interrupt() error {
- return m.InterruptFunc()
-}
-
-type mockTTransport struct {
- TTransport
-}
-
-func (m *mockTTransport) Close() error {
- return nil
-}
-
-func TestMultipleStop(t *testing.T) {
- proc := &mockProcessor{
- ProcessFunc: func(in, out TProtocol) (bool, TException) {
- return false, nil
- },
- }
-
- var interruptCalled bool
- c := make(chan struct{})
- trans := &mockServerTransport{
- ListenFunc: func() error {
- return nil
- },
- AcceptFunc: func() (TTransport, error) {
- <-c
- return nil, nil
- },
- CloseFunc: func() error {
- c <- struct{}{}
- return nil
- },
- InterruptFunc: func() error {
- interruptCalled = true
- return nil
- },
- }
-
- serv := NewTSimpleServer2(proc, trans)
- go serv.Serve()
- serv.Stop()
- if !interruptCalled {
- t.Error("first server transport should have been interrupted")
- }
-
- serv = NewTSimpleServer2(proc, trans)
- interruptCalled = false
- go serv.Serve()
- serv.Stop()
- if !interruptCalled {
- t.Error("second server transport should have been interrupted")
- }
-}
-
-func TestWaitRace(t *testing.T) {
- proc := &mockProcessor{
- ProcessFunc: func(in, out TProtocol) (bool, TException) {
- return false, nil
- },
- }
-
- trans := &mockServerTransport{
- ListenFunc: func() error {
- return nil
- },
- AcceptFunc: func() (TTransport, error) {
- return &mockTTransport{}, nil
- },
- CloseFunc: func() error {
- return nil
- },
- InterruptFunc: func() error {
- return nil
- },
- }
-
- serv := NewTSimpleServer2(proc, trans)
- go serv.Serve()
- runtime.Gosched()
- serv.Stop()
-}
-
-func TestNoHangDuringStopFromDanglingLockAcquireDuringAcceptLoop(t *testing.T) {
- proc := &mockProcessor{
- ProcessFunc: func(in, out TProtocol) (bool, TException) {
- return false, nil
- },
- }
-
- trans := &mockServerTransport{
- ListenFunc: func() error {
- return nil
- },
- AcceptFunc: func() (TTransport, error) {
- return nil, errors.New("no sir")
- },
- CloseFunc: func() error {
- return nil
- },
- InterruptFunc: func() error {
- return nil
- },
- }
-
- serv := NewTSimpleServer2(proc, trans)
- go serv.Serve()
- runtime.Gosched()
- serv.Stop()
-}
diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/transport_exception_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/transport_exception_test.go
deleted file mode 100644
index b44314f49..000000000
--- a/vendor/github.com/apache/thrift/lib/go/thrift/transport_exception_test.go
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package thrift
-
-import (
- "fmt"
- "io"
-
- "testing"
-)
-
-type timeout struct{ timedout bool }
-
-func (t *timeout) Timeout() bool {
- return t.timedout
-}
-
-func (t *timeout) Error() string {
- return fmt.Sprintf("Timeout: %v", t.timedout)
-}
-
-func TestTExceptionTimeout(t *testing.T) {
- timeout := &timeout{true}
- exception := NewTTransportExceptionFromError(timeout)
- if timeout.Error() != exception.Error() {
- t.Fatalf("Error did not match: expected %q, got %q", timeout.Error(), exception.Error())
- }
-
- if exception.TypeId() != TIMED_OUT {
- t.Fatalf("TypeId was not TIMED_OUT: expected %v, got %v", TIMED_OUT, exception.TypeId())
- }
-}
-
-func TestTExceptionEOF(t *testing.T) {
- exception := NewTTransportExceptionFromError(io.EOF)
- if io.EOF.Error() != exception.Error() {
- t.Fatalf("Error did not match: expected %q, got %q", io.EOF.Error(), exception.Error())
- }
-
- if exception.TypeId() != END_OF_FILE {
- t.Fatalf("TypeId was not END_OF_FILE: expected %v, got %v", END_OF_FILE, exception.TypeId())
- }
-}
diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/transport_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/transport_test.go
deleted file mode 100644
index 01278038e..000000000
--- a/vendor/github.com/apache/thrift/lib/go/thrift/transport_test.go
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package thrift
-
-import (
- "context"
- "io"
- "net"
- "strconv"
- "testing"
-)
-
-const TRANSPORT_BINARY_DATA_SIZE = 4096
-
-var (
- transport_bdata []byte // test data for writing; same as data
- transport_header map[string]string
-)
-
-func init() {
- transport_bdata = make([]byte, TRANSPORT_BINARY_DATA_SIZE)
- for i := 0; i < TRANSPORT_BINARY_DATA_SIZE; i++ {
- transport_bdata[i] = byte((i + 'a') % 255)
- }
- transport_header = map[string]string{"key": "User-Agent",
- "value": "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36"}
-}
-
-func TransportTest(t *testing.T, writeTrans TTransport, readTrans TTransport) {
- buf := make([]byte, TRANSPORT_BINARY_DATA_SIZE)
- if !writeTrans.IsOpen() {
- t.Fatalf("Transport %T not open: %s", writeTrans, writeTrans)
- }
- if !readTrans.IsOpen() {
- t.Fatalf("Transport %T not open: %s", readTrans, readTrans)
- }
- _, err := writeTrans.Write(transport_bdata)
- if err != nil {
- t.Fatalf("Transport %T cannot write binary data of length %d: %s", writeTrans, len(transport_bdata), err)
- }
- err = writeTrans.Flush(context.Background())
- if err != nil {
- t.Fatalf("Transport %T cannot flush write of binary data: %s", writeTrans, err)
- }
- n, err := io.ReadFull(readTrans, buf)
- if err != nil {
- t.Errorf("Transport %T cannot read binary data of length %d: %s", readTrans, TRANSPORT_BINARY_DATA_SIZE, err)
- }
- if n != TRANSPORT_BINARY_DATA_SIZE {
- t.Errorf("Transport %T read only %d instead of %d bytes of binary data", readTrans, n, TRANSPORT_BINARY_DATA_SIZE)
- }
- for k, v := range buf {
- if v != transport_bdata[k] {
- t.Fatalf("Transport %T read %d instead of %d for index %d of binary data 2", readTrans, v, transport_bdata[k], k)
- }
- }
- _, err = writeTrans.Write(transport_bdata)
- if err != nil {
- t.Fatalf("Transport %T cannot write binary data 2 of length %d: %s", writeTrans, len(transport_bdata), err)
- }
- err = writeTrans.Flush(context.Background())
- if err != nil {
- t.Fatalf("Transport %T cannot flush write binary data 2: %s", writeTrans, err)
- }
- buf = make([]byte, TRANSPORT_BINARY_DATA_SIZE)
- read := 1
- for n = 0; n < TRANSPORT_BINARY_DATA_SIZE && read != 0; {
- read, err = readTrans.Read(buf[n:])
- if err != nil {
- t.Errorf("Transport %T cannot read binary data 2 of total length %d from offset %d: %s", readTrans, TRANSPORT_BINARY_DATA_SIZE, n, err)
- }
- n += read
- }
- if n != TRANSPORT_BINARY_DATA_SIZE {
- t.Errorf("Transport %T read only %d instead of %d bytes of binary data 2", readTrans, n, TRANSPORT_BINARY_DATA_SIZE)
- }
- for k, v := range buf {
- if v != transport_bdata[k] {
- t.Fatalf("Transport %T read %d instead of %d for index %d of binary data 2", readTrans, v, transport_bdata[k], k)
- }
- }
-}
-
-func TransportHeaderTest(t *testing.T, writeTrans TTransport, readTrans TTransport) {
- buf := make([]byte, TRANSPORT_BINARY_DATA_SIZE)
- if !writeTrans.IsOpen() {
- t.Fatalf("Transport %T not open: %s", writeTrans, writeTrans)
- }
- if !readTrans.IsOpen() {
- t.Fatalf("Transport %T not open: %s", readTrans, readTrans)
- }
- // Need to assert type of TTransport to THttpClient to expose the Setter
- httpWPostTrans := writeTrans.(*THttpClient)
- httpWPostTrans.SetHeader(transport_header["key"], transport_header["value"])
-
- _, err := writeTrans.Write(transport_bdata)
- if err != nil {
- t.Fatalf("Transport %T cannot write binary data of length %d: %s", writeTrans, len(transport_bdata), err)
- }
- err = writeTrans.Flush(context.Background())
- if err != nil {
- t.Fatalf("Transport %T cannot flush write of binary data: %s", writeTrans, err)
- }
- // Need to assert type of TTransport to THttpClient to expose the Getter
- httpRPostTrans := readTrans.(*THttpClient)
- readHeader := httpRPostTrans.GetHeader(transport_header["key"])
- if err != nil {
- t.Errorf("Transport %T cannot read HTTP Header Value", httpRPostTrans)
- }
-
- if transport_header["value"] != readHeader {
- t.Errorf("Expected HTTP Header Value %s, got %s", transport_header["value"], readHeader)
- }
- n, err := io.ReadFull(readTrans, buf)
- if err != nil {
- t.Errorf("Transport %T cannot read binary data of length %d: %s", readTrans, TRANSPORT_BINARY_DATA_SIZE, err)
- }
- if n != TRANSPORT_BINARY_DATA_SIZE {
- t.Errorf("Transport %T read only %d instead of %d bytes of binary data", readTrans, n, TRANSPORT_BINARY_DATA_SIZE)
- }
- for k, v := range buf {
- if v != transport_bdata[k] {
- t.Fatalf("Transport %T read %d instead of %d for index %d of binary data 2", readTrans, v, transport_bdata[k], k)
- }
- }
-}
-
-func CloseTransports(t *testing.T, readTrans TTransport, writeTrans TTransport) {
- err := readTrans.Close()
- if err != nil {
- t.Errorf("Transport %T cannot close read transport: %s", readTrans, err)
- }
- if writeTrans != readTrans {
- err = writeTrans.Close()
- if err != nil {
- t.Errorf("Transport %T cannot close write transport: %s", writeTrans, err)
- }
- }
-}
-
-func FindAvailableTCPServerPort(startPort int) (net.Addr, error) {
- for i := startPort; i < 65535; i++ {
- s := "127.0.0.1:" + strconv.Itoa(i)
- l, err := net.Listen("tcp", s)
- if err == nil {
- l.Close()
- return net.ResolveTCPAddr("tcp", s)
- }
- }
- return nil, NewTTransportException(UNKNOWN_TRANSPORT_EXCEPTION, "Could not find available server port")
-}
-
-func valueInSlice(value string, slice []string) bool {
- for _, v := range slice {
- if value == v {
- return true
- }
- }
- return false
-}
diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/zlib_transport_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/zlib_transport_test.go
deleted file mode 100644
index 3c6f11eb5..000000000
--- a/vendor/github.com/apache/thrift/lib/go/thrift/zlib_transport_test.go
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package thrift
-
-import (
- "compress/zlib"
- "testing"
-)
-
-func TestZlibTransport(t *testing.T) {
- trans, err := NewTZlibTransport(NewTMemoryBuffer(), zlib.BestCompression)
- if err != nil {
- t.Fatal(err)
- }
- TransportTest(t, trans, trans)
-}
-
-type DummyTransportFactory struct{}
-
-func (p *DummyTransportFactory) GetTransport(trans TTransport) (TTransport, error) {
- return NewTMemoryBuffer(), nil
-}
-
-func TestZlibFactoryTransportWithFactory(t *testing.T) {
- factory := NewTZlibTransportFactoryWithFactory(
- zlib.BestCompression,
- &DummyTransportFactory{},
- )
- buffer := NewTMemoryBuffer()
- trans, err := factory.GetTransport(buffer)
- if err != nil {
- t.Fatal(err)
- }
- TransportTest(t, trans, trans)
-}
-
-func TestZlibFactoryTransportWithoutFactory(t *testing.T) {
- factory := NewTZlibTransportFactoryWithFactory(zlib.BestCompression, nil)
- buffer := NewTMemoryBuffer()
- trans, err := factory.GetTransport(buffer)
- if err != nil {
- t.Fatal(err)
- }
- TransportTest(t, trans, trans)
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy_test.go b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy_test.go
deleted file mode 100644
index 007b37be1..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy_test.go
+++ /dev/null
@@ -1,353 +0,0 @@
-package awsutil_test
-
-import (
- "bytes"
- "fmt"
- "io"
- "io/ioutil"
- "reflect"
- "testing"
- "time"
-
- "github.com/aws/aws-sdk-go/aws/awsutil"
-)
-
-func ExampleCopy() {
- type Foo struct {
- A int
- B []*string
- }
-
- // Create the initial value
- str1 := "hello"
- str2 := "bye bye"
- f1 := &Foo{A: 1, B: []*string{&str1, &str2}}
-
- // Do the copy
- var f2 Foo
- awsutil.Copy(&f2, f1)
-
- // Print the result
- fmt.Println(awsutil.Prettify(f2))
-
- // Output:
- // {
- // A: 1,
- // B: ["hello","bye bye"]
- // }
-}
-
-func TestCopy1(t *testing.T) {
- type Bar struct {
- a *int
- B *int
- c int
- D int
- }
- type Foo struct {
- A int
- B []*string
- C map[string]*int
- D *time.Time
- E *Bar
- }
-
- // Create the initial value
- str1 := "hello"
- str2 := "bye bye"
- int1 := 1
- int2 := 2
- intPtr1 := 1
- intPtr2 := 2
- now := time.Now()
- f1 := &Foo{
- A: 1,
- B: []*string{&str1, &str2},
- C: map[string]*int{
- "A": &int1,
- "B": &int2,
- },
- D: &now,
- E: &Bar{
- &intPtr1,
- &intPtr2,
- 2,
- 3,
- },
- }
-
- // Do the copy
- var f2 Foo
- awsutil.Copy(&f2, f1)
-
- // Values are equal
- if v1, v2 := f2.A, f1.A; v1 != v2 {
- t.Errorf("expected values to be equivalent but received %v and %v", v1, v2)
- }
- if v1, v2 := f2.B, f1.B; !reflect.DeepEqual(v1, v2) {
- t.Errorf("expected values to be equivalent but received %v and %v", v1, v2)
- }
- if v1, v2 := f2.C, f1.C; !reflect.DeepEqual(v1, v2) {
- t.Errorf("expected values to be equivalent but received %v and %v", v1, v2)
- }
- if v1, v2 := f2.D, f1.D; !v1.Equal(*v2) {
- t.Errorf("expected values to be equivalent but received %v and %v", v1, v2)
- }
- if v1, v2 := f2.E.B, f1.E.B; !reflect.DeepEqual(v1, v2) {
- t.Errorf("expected values to be equivalent but received %v and %v", v1, v2)
- }
- if v1, v2 := f2.E.D, f1.E.D; v1 != v2 {
- t.Errorf("expected values to be equivalent but received %v and %v", v1, v2)
- }
-
- // But pointers are not!
- str3 := "nothello"
- int3 := 57
- f2.A = 100
- *f2.B[0] = str3
- *f2.C["B"] = int3
- *f2.D = time.Now()
- f2.E.a = &int3
- *f2.E.B = int3
- f2.E.c = 5
- f2.E.D = 5
- if v1, v2 := f2.A, f1.A; v1 == v2 {
- t.Errorf("expected values to be not equivalent, but received %v", v1)
- }
- if v1, v2 := f2.B, f1.B; reflect.DeepEqual(v1, v2) {
- t.Errorf("expected values to be not equivalent, but received %v", v1)
- }
- if v1, v2 := f2.C, f1.C; reflect.DeepEqual(v1, v2) {
- t.Errorf("expected values to be not equivalent, but received %v", v1)
- }
- if v1, v2 := f2.D, f1.D; v1 == v2 {
- t.Errorf("expected values to be not equivalent, but received %v", v1)
- }
- if v1, v2 := f2.E.a, f1.E.a; v1 == v2 {
- t.Errorf("expected values to be not equivalent, but received %v", v1)
- }
- if v1, v2 := f2.E.B, f1.E.B; v1 == v2 {
- t.Errorf("expected values to be not equivalent, but received %v", v1)
- }
- if v1, v2 := f2.E.c, f1.E.c; v1 == v2 {
- t.Errorf("expected values to be not equivalent, but received %v", v1)
- }
- if v1, v2 := f2.E.D, f1.E.D; v1 == v2 {
- t.Errorf("expected values to be not equivalent, but received %v", v1)
- }
-}
-
-func TestCopyNestedWithUnexported(t *testing.T) {
- type Bar struct {
- a int
- B int
- }
- type Foo struct {
- A string
- B Bar
- }
-
- f1 := &Foo{A: "string", B: Bar{a: 1, B: 2}}
-
- var f2 Foo
- awsutil.Copy(&f2, f1)
-
- // Values match
- if v1, v2 := f2.A, f1.A; v1 != v2 {
- t.Errorf("expected values to be equivalent but received %v and %v", v1, v2)
- }
- if v1, v2 := f2.B, f1.B; v1 == v2 {
- t.Errorf("expected values to be not equivalent, but received %v", v1)
- }
- if v1, v2 := f2.B.a, f1.B.a; v1 == v2 {
- t.Errorf("expected values to be not equivalent, but received %v", v1)
- }
- if v1, v2 := f2.B.B, f2.B.B; v1 != v2 {
- t.Errorf("expected values to be equivalent but received %v and %v", v1, v2)
- }
-}
-
-func TestCopyIgnoreNilMembers(t *testing.T) {
- type Foo struct {
- A *string
- B []string
- C map[string]string
- }
-
- f := &Foo{}
- if v1 := f.A; v1 != nil {
- t.Errorf("expected nil, but received %v", v1)
- }
- if v1 := f.B; v1 != nil {
- t.Errorf("expected nil, but received %v", v1)
- }
- if v1 := f.C; v1 != nil {
- t.Errorf("expected nil, but received %v", v1)
- }
-
- var f2 Foo
- awsutil.Copy(&f2, f)
- if v1 := f2.A; v1 != nil {
- t.Errorf("expected nil, but received %v", v1)
- }
- if v1 := f2.B; v1 != nil {
- t.Errorf("expected nil, but received %v", v1)
- }
- if v1 := f2.C; v1 != nil {
- t.Errorf("expected nil, but received %v", v1)
- }
-
- fcopy := awsutil.CopyOf(f)
- f3 := fcopy.(*Foo)
- if v1 := f3.A; v1 != nil {
- t.Errorf("expected nil, but received %v", v1)
- }
- if v1 := f3.B; v1 != nil {
- t.Errorf("expected nil, but received %v", v1)
- }
- if v1 := f3.C; v1 != nil {
- t.Errorf("expected nil, but received %v", v1)
- }
-}
-
-func TestCopyPrimitive(t *testing.T) {
- str := "hello"
- var s string
- awsutil.Copy(&s, &str)
- if v1, v2 := "hello", s; v1 != v2 {
- t.Errorf("expected values to be equivalent but received %v and %v", v1, v2)
- }
-}
-
-func TestCopyNil(t *testing.T) {
- var s string
- awsutil.Copy(&s, nil)
- if v1, v2 := "", s; v1 != v2 {
- t.Errorf("expected values to be equivalent but received %v and %v", v1, v2)
- }
-}
-
-func TestCopyReader(t *testing.T) {
- var buf io.Reader = bytes.NewReader([]byte("hello world"))
- var r io.Reader
- awsutil.Copy(&r, buf)
- b, err := ioutil.ReadAll(r)
- if err != nil {
- t.Errorf("expected no error, but received %v", err)
- }
- if v1, v2 := []byte("hello world"), b; !bytes.Equal(v1, v2) {
- t.Errorf("expected values to be equivalent but received %v and %v", v1, v2)
- }
-
- // empty bytes because this is not a deep copy
- b, err = ioutil.ReadAll(buf)
- if err != nil {
- t.Errorf("expected no error, but received %v", err)
- }
- if v1, v2 := []byte(""), b; !bytes.Equal(v1, v2) {
- t.Errorf("expected values to be equivalent but received %v and %v", v1, v2)
- }
-}
-
-func TestCopyDifferentStructs(t *testing.T) {
- type SrcFoo struct {
- A int
- B []*string
- C map[string]*int
- SrcUnique string
- SameNameDiffType int
- unexportedPtr *int
- ExportedPtr *int
- }
- type DstFoo struct {
- A int
- B []*string
- C map[string]*int
- DstUnique int
- SameNameDiffType string
- unexportedPtr *int
- ExportedPtr *int
- }
-
- // Create the initial value
- str1 := "hello"
- str2 := "bye bye"
- int1 := 1
- int2 := 2
- f1 := &SrcFoo{
- A: 1,
- B: []*string{&str1, &str2},
- C: map[string]*int{
- "A": &int1,
- "B": &int2,
- },
- SrcUnique: "unique",
- SameNameDiffType: 1,
- unexportedPtr: &int1,
- ExportedPtr: &int2,
- }
-
- // Do the copy
- var f2 DstFoo
- awsutil.Copy(&f2, f1)
-
- // Values are equal
- if v1, v2 := f2.A, f1.A; v1 != v2 {
- t.Errorf("expected values to be equivalent but received %v and %v", v1, v2)
- }
- if v1, v2 := f2.B, f1.B; !reflect.DeepEqual(v1, v2) {
- t.Errorf("expected values to be equivalent but received %v and %v", v1, v2)
- }
- if v1, v2 := f2.C, f1.C; !reflect.DeepEqual(v1, v2) {
- t.Errorf("expected values to be equivalent but received %v and %v", v1, v2)
- }
- if v1, v2 := "unique", f1.SrcUnique; v1 != v2 {
- t.Errorf("expected values to be equivalent but received %v and %v", v1, v2)
- }
- if v1, v2 := 1, f1.SameNameDiffType; v1 != v2 {
- t.Errorf("expected values to be equivalent but received %v and %v", v1, v2)
- }
- if v1, v2 := 0, f2.DstUnique; v1 != v2 {
- t.Errorf("expected values to be equivalent but received %v and %v", v1, v2)
- }
- if v1, v2 := "", f2.SameNameDiffType; v1 != v2 {
- t.Errorf("expected values to be equivalent but received %v and %v", v1, v2)
- }
- if v1, v2 := int1, *f1.unexportedPtr; v1 != v2 {
- t.Errorf("expected values to be equivalent but received %v and %v", v1, v2)
- }
- if v1 := f2.unexportedPtr; v1 != nil {
- t.Errorf("expected nil, but received %v", v1)
- }
- if v1, v2 := int2, *f1.ExportedPtr; v1 != v2 {
- t.Errorf("expected values to be equivalent but received %v and %v", v1, v2)
- }
- if v1, v2 := int2, *f2.ExportedPtr; v1 != v2 {
- t.Errorf("expected values to be equivalent but received %v and %v", v1, v2)
- }
-}
-
-func ExampleCopyOf() {
- type Foo struct {
- A int
- B []*string
- }
-
- // Create the initial value
- str1 := "hello"
- str2 := "bye bye"
- f1 := &Foo{A: 1, B: []*string{&str1, &str2}}
-
- // Do the copy
- v := awsutil.CopyOf(f1)
- var f2 *Foo = v.(*Foo)
-
- // Print the result
- fmt.Println(awsutil.Prettify(f2))
-
- // Output:
- // {
- // A: 1,
- // B: ["hello","bye bye"]
- // }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal_test.go b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal_test.go
deleted file mode 100644
index 18d3c5b8e..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal_test.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package awsutil_test
-
-import (
- "testing"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/awsutil"
-)
-
-func TestDeepEqual(t *testing.T) {
- cases := []struct {
- a, b interface{}
- equal bool
- }{
- {"a", "a", true},
- {"a", "b", false},
- {"a", aws.String(""), false},
- {"a", nil, false},
- {"a", aws.String("a"), true},
- {(*bool)(nil), (*bool)(nil), true},
- {(*bool)(nil), (*string)(nil), false},
- {nil, nil, true},
- }
-
- for i, c := range cases {
- if awsutil.DeepEqual(c.a, c.b) != c.equal {
- t.Errorf("%d, a:%v b:%v, %t", i, c.a, c.b, c.equal)
- }
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value_test.go b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value_test.go
deleted file mode 100644
index 58a05d6ce..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value_test.go
+++ /dev/null
@@ -1,182 +0,0 @@
-package awsutil_test
-
-import (
- "strings"
- "testing"
-
- "github.com/aws/aws-sdk-go/aws/awsutil"
-)
-
-type Struct struct {
- A []Struct
- z []Struct
- B *Struct
- D *Struct
- C string
- E map[string]string
-}
-
-var data = Struct{
- A: []Struct{{C: "value1"}, {C: "value2"}, {C: "value3"}},
- z: []Struct{{C: "value1"}, {C: "value2"}, {C: "value3"}},
- B: &Struct{B: &Struct{C: "terminal"}, D: &Struct{C: "terminal2"}},
- C: "initial",
-}
-var data2 = Struct{A: []Struct{
- {A: []Struct{{C: "1"}, {C: "1"}, {C: "1"}, {C: "1"}, {C: "1"}}},
- {A: []Struct{{C: "2"}, {C: "2"}, {C: "2"}, {C: "2"}, {C: "2"}}},
-}}
-
-func TestValueAtPathSuccess(t *testing.T) {
- var testCases = []struct {
- expect []interface{}
- data interface{}
- path string
- }{
- {[]interface{}{"initial"}, data, "C"},
- {[]interface{}{"value1"}, data, "A[0].C"},
- {[]interface{}{"value2"}, data, "A[1].C"},
- {[]interface{}{"value3"}, data, "A[2].C"},
- {[]interface{}{"value3"}, data, "a[2].c"},
- {[]interface{}{"value3"}, data, "A[-1].C"},
- {[]interface{}{"value1", "value2", "value3"}, data, "A[].C"},
- {[]interface{}{"terminal"}, data, "B . B . C"},
- {[]interface{}{"initial"}, data, "A.D.X || C"},
- {[]interface{}{"initial"}, data, "A[0].B || C"},
- {[]interface{}{
- Struct{A: []Struct{{C: "1"}, {C: "1"}, {C: "1"}, {C: "1"}, {C: "1"}}},
- Struct{A: []Struct{{C: "2"}, {C: "2"}, {C: "2"}, {C: "2"}, {C: "2"}}},
- }, data2, "A"},
- }
- for i, c := range testCases {
- v, err := awsutil.ValuesAtPath(c.data, c.path)
- if err != nil {
- t.Errorf("case %v, expected no error, %v", i, c.path)
- }
- if e, a := c.expect, v; !awsutil.DeepEqual(e, a) {
- t.Errorf("case %v, %v", i, c.path)
- }
- }
-}
-
-func TestValueAtPathFailure(t *testing.T) {
- var testCases = []struct {
- expect []interface{}
- errContains string
- data interface{}
- path string
- }{
- {nil, "", data, "C.x"},
- {nil, "SyntaxError: Invalid token: tDot", data, ".x"},
- {nil, "", data, "X.Y.Z"},
- {nil, "", data, "A[100].C"},
- {nil, "", data, "A[3].C"},
- {nil, "", data, "B.B.C.Z"},
- {nil, "", data, "z[-1].C"},
- {nil, "", nil, "A.B.C"},
- {[]interface{}{}, "", Struct{}, "A"},
- {nil, "", data, "A[0].B.C"},
- {nil, "", data, "D"},
- }
-
- for i, c := range testCases {
- v, err := awsutil.ValuesAtPath(c.data, c.path)
- if c.errContains != "" {
- if !strings.Contains(err.Error(), c.errContains) {
- t.Errorf("case %v, expected error, %v", i, c.path)
- }
- continue
- } else {
- if err != nil {
- t.Errorf("case %v, expected no error, %v", i, c.path)
- }
- }
- if e, a := c.expect, v; !awsutil.DeepEqual(e, a) {
- t.Errorf("case %v, %v", i, c.path)
- }
- }
-}
-
-func TestSetValueAtPathSuccess(t *testing.T) {
- var s Struct
- awsutil.SetValueAtPath(&s, "C", "test1")
- awsutil.SetValueAtPath(&s, "B.B.C", "test2")
- awsutil.SetValueAtPath(&s, "B.D.C", "test3")
- if e, a := "test1", s.C; e != a {
- t.Errorf("expected %v, but received %v", e, a)
- }
- if e, a := "test2", s.B.B.C; e != a {
- t.Errorf("expected %v, but received %v", e, a)
- }
- if e, a := "test3", s.B.D.C; e != a {
- t.Errorf("expected %v, but received %v", e, a)
- }
-
- awsutil.SetValueAtPath(&s, "B.*.C", "test0")
- if e, a := "test0", s.B.B.C; e != a {
- t.Errorf("expected %v, but received %v", e, a)
- }
- if e, a := "test0", s.B.D.C; e != a {
- t.Errorf("expected %v, but received %v", e, a)
- }
-
- var s2 Struct
- awsutil.SetValueAtPath(&s2, "b.b.c", "test0")
- if e, a := "test0", s2.B.B.C; e != a {
- t.Errorf("expected %v, but received %v", e, a)
- }
- awsutil.SetValueAtPath(&s2, "A", []Struct{{}})
- if e, a := []Struct{{}}, s2.A; !awsutil.DeepEqual(e, a) {
- t.Errorf("expected %v, but received %v", e, a)
- }
-
- str := "foo"
-
- s3 := Struct{}
- awsutil.SetValueAtPath(&s3, "b.b.c", str)
- if e, a := "foo", s3.B.B.C; e != a {
- t.Errorf("expected %v, but received %v", e, a)
- }
-
- s3 = Struct{B: &Struct{B: &Struct{C: str}}}
- awsutil.SetValueAtPath(&s3, "b.b.c", nil)
- if e, a := "", s3.B.B.C; e != a {
- t.Errorf("expected %v, but received %v", e, a)
- }
-
- s3 = Struct{}
- awsutil.SetValueAtPath(&s3, "b.b.c", nil)
- if e, a := "", s3.B.B.C; e != a {
- t.Errorf("expected %v, but received %v", e, a)
- }
-
- s3 = Struct{}
- awsutil.SetValueAtPath(&s3, "b.b.c", &str)
- if e, a := "foo", s3.B.B.C; e != a {
- t.Errorf("expected %v, but received %v", e, a)
- }
-
- var s4 struct{ Name *string }
- awsutil.SetValueAtPath(&s4, "Name", str)
- if e, a := str, *s4.Name; e != a {
- t.Errorf("expected %v, but received %v", e, a)
- }
-
- s4 = struct{ Name *string }{}
- awsutil.SetValueAtPath(&s4, "Name", nil)
- if e, a := (*string)(nil), s4.Name; e != a {
- t.Errorf("expected %v, but received %v", e, a)
- }
-
- s4 = struct{ Name *string }{Name: &str}
- awsutil.SetValueAtPath(&s4, "Name", nil)
- if e, a := (*string)(nil), s4.Name; e != a {
- t.Errorf("expected %v, but received %v", e, a)
- }
-
- s4 = struct{ Name *string }{}
- awsutil.SetValueAtPath(&s4, "Name", &str)
- if e, a := str, *s4.Name; e != a {
- t.Errorf("expected %v, but received %v", e, a)
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/client_test.go b/vendor/github.com/aws/aws-sdk-go/aws/client/client_test.go
deleted file mode 100644
index 30d3b9997..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/client/client_test.go
+++ /dev/null
@@ -1,78 +0,0 @@
-package client
-
-import (
- "testing"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/client/metadata"
- "github.com/aws/aws-sdk-go/aws/request"
-)
-
-func pushBackTestHandler(name string, list *request.HandlerList) *bool {
- called := false
- (*list).PushBackNamed(request.NamedHandler{
- Name: name,
- Fn: func(r *request.Request) {
- called = true
- },
- })
-
- return &called
-}
-
-func pushFrontTestHandler(name string, list *request.HandlerList) *bool {
- called := false
- (*list).PushFrontNamed(request.NamedHandler{
- Name: name,
- Fn: func(r *request.Request) {
- called = true
- },
- })
-
- return &called
-}
-
-func TestNewClient_CopyHandlers(t *testing.T) {
- handlers := request.Handlers{}
- firstCalled := pushBackTestHandler("first", &handlers.Send)
- secondCalled := pushBackTestHandler("second", &handlers.Send)
-
- var clientHandlerCalled *bool
- c := New(aws.Config{}, metadata.ClientInfo{}, handlers,
- func(c *Client) {
- clientHandlerCalled = pushFrontTestHandler("client handler", &c.Handlers.Send)
- },
- )
-
- if e, a := 2, handlers.Send.Len(); e != a {
- t.Errorf("expect %d original handlers, got %d", e, a)
- }
- if e, a := 3, c.Handlers.Send.Len(); e != a {
- t.Errorf("expect %d client handlers, got %d", e, a)
- }
-
- handlers.Send.Run(nil)
- if !*firstCalled {
- t.Errorf("expect first handler to of been called")
- }
- *firstCalled = false
- if !*secondCalled {
- t.Errorf("expect second handler to of been called")
- }
- *secondCalled = false
- if *clientHandlerCalled {
- t.Errorf("expect client handler to not of been called, but was")
- }
-
- c.Handlers.Send.Run(nil)
- if !*firstCalled {
- t.Errorf("expect client's first handler to of been called")
- }
- if !*secondCalled {
- t.Errorf("expect client's second handler to of been called")
- }
- if !*clientHandlerCalled {
- t.Errorf("expect client's client handler to of been called")
- }
-
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer_test.go b/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer_test.go
deleted file mode 100644
index fddba4e49..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer_test.go
+++ /dev/null
@@ -1,189 +0,0 @@
-package client
-
-import (
- "net/http"
- "testing"
- "time"
-
- "github.com/aws/aws-sdk-go/aws/request"
-)
-
-func TestRetryThrottleStatusCodes(t *testing.T) {
- cases := []struct {
- expectThrottle bool
- expectRetry bool
- r request.Request
- }{
- {
- false,
- false,
- request.Request{
- HTTPResponse: &http.Response{StatusCode: 200},
- },
- },
- {
- true,
- true,
- request.Request{
- HTTPResponse: &http.Response{StatusCode: 429},
- },
- },
- {
- true,
- true,
- request.Request{
- HTTPResponse: &http.Response{StatusCode: 502},
- },
- },
- {
- true,
- true,
- request.Request{
- HTTPResponse: &http.Response{StatusCode: 503},
- },
- },
- {
- true,
- true,
- request.Request{
- HTTPResponse: &http.Response{StatusCode: 504},
- },
- },
- {
- false,
- true,
- request.Request{
- HTTPResponse: &http.Response{StatusCode: 500},
- },
- },
- }
-
- d := DefaultRetryer{NumMaxRetries: 10}
- for i, c := range cases {
- throttle := d.shouldThrottle(&c.r)
- retry := d.ShouldRetry(&c.r)
-
- if e, a := c.expectThrottle, throttle; e != a {
- t.Errorf("%d: expected %v, but received %v", i, e, a)
- }
-
- if e, a := c.expectRetry, retry; e != a {
- t.Errorf("%d: expected %v, but received %v", i, e, a)
- }
- }
-}
-
-func TestCanUseRetryAfter(t *testing.T) {
- cases := []struct {
- r request.Request
- e bool
- }{
- {
- request.Request{
- HTTPResponse: &http.Response{StatusCode: 200},
- },
- false,
- },
- {
- request.Request{
- HTTPResponse: &http.Response{StatusCode: 500},
- },
- false,
- },
- {
- request.Request{
- HTTPResponse: &http.Response{StatusCode: 429},
- },
- true,
- },
- {
- request.Request{
- HTTPResponse: &http.Response{StatusCode: 503},
- },
- true,
- },
- }
-
- for i, c := range cases {
- a := canUseRetryAfterHeader(&c.r)
- if c.e != a {
- t.Errorf("%d: expected %v, but received %v", i, c.e, a)
- }
- }
-}
-
-func TestGetRetryDelay(t *testing.T) {
- cases := []struct {
- r request.Request
- e time.Duration
- equal bool
- ok bool
- }{
- {
- request.Request{
- HTTPResponse: &http.Response{StatusCode: 429, Header: http.Header{"Retry-After": []string{"3600"}}},
- },
- 3600 * time.Second,
- true,
- true,
- },
- {
- request.Request{
- HTTPResponse: &http.Response{StatusCode: 503, Header: http.Header{"Retry-After": []string{"120"}}},
- },
- 120 * time.Second,
- true,
- true,
- },
- {
- request.Request{
- HTTPResponse: &http.Response{StatusCode: 503, Header: http.Header{"Retry-After": []string{"120"}}},
- },
- 1 * time.Second,
- false,
- true,
- },
- {
- request.Request{
- HTTPResponse: &http.Response{StatusCode: 503, Header: http.Header{"Retry-After": []string{""}}},
- },
- 0 * time.Second,
- true,
- false,
- },
- }
-
- for i, c := range cases {
- a, ok := getRetryDelay(&c.r)
- if c.ok != ok {
- t.Errorf("%d: expected %v, but received %v", i, c.ok, ok)
- }
-
- if (c.e != a) == c.equal {
- t.Errorf("%d: expected %v, but received %v", i, c.e, a)
- }
- }
-}
-
-func TestRetryDelay(t *testing.T) {
- r := request.Request{}
- for i := 0; i < 100; i++ {
- rTemp := r
- rTemp.HTTPResponse = &http.Response{StatusCode: 500, Header: http.Header{"Retry-After": []string{""}}}
- rTemp.RetryCount = i
- a, _ := getRetryDelay(&rTemp)
- if a > 5*time.Minute {
- t.Errorf("retry delay should never be greater than five minutes, received %d", a)
- }
- }
-
- for i := 0; i < 100; i++ {
- rTemp := r
- rTemp.RetryCount = i
- rTemp.HTTPResponse = &http.Response{StatusCode: 503, Header: http.Header{"Retry-After": []string{""}}}
- a, _ := getRetryDelay(&rTemp)
- if a > 5*time.Minute {
- t.Errorf("retry delay should never be greater than five minutes, received %d", a)
- }
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/logger_test.go b/vendor/github.com/aws/aws-sdk-go/aws/client/logger_test.go
deleted file mode 100644
index ee3630e6c..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/client/logger_test.go
+++ /dev/null
@@ -1,222 +0,0 @@
-package client
-
-import (
- "bytes"
- "fmt"
- "io"
- "io/ioutil"
- "net/http"
- "reflect"
- "testing"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/client/metadata"
- "github.com/aws/aws-sdk-go/aws/corehandlers"
- "github.com/aws/aws-sdk-go/aws/credentials"
- "github.com/aws/aws-sdk-go/aws/request"
-)
-
-type mockCloser struct {
- closed bool
-}
-
-func (closer *mockCloser) Read(b []byte) (int, error) {
- return 0, io.EOF
-}
-
-func (closer *mockCloser) Close() error {
- closer.closed = true
- return nil
-}
-
-func TestTeeReaderCloser(t *testing.T) {
- expected := "FOO"
- buf := bytes.NewBuffer([]byte(expected))
- lw := bytes.NewBuffer(nil)
- c := &mockCloser{}
- closer := teeReaderCloser{
- io.TeeReader(buf, lw),
- c,
- }
-
- b := make([]byte, len(expected))
- _, err := closer.Read(b)
- closer.Close()
-
- if expected != lw.String() {
- t.Errorf("Expected %q, but received %q", expected, lw.String())
- }
-
- if err != nil {
- t.Errorf("Expected 'nil', but received %v", err)
- }
-
- if !c.closed {
- t.Error("Expected 'true', but received 'false'")
- }
-}
-
-func TestLogWriter(t *testing.T) {
- expected := "FOO"
- lw := &logWriter{nil, bytes.NewBuffer(nil)}
- lw.Write([]byte(expected))
-
- if expected != lw.buf.String() {
- t.Errorf("Expected %q, but received %q", expected, lw.buf.String())
- }
-}
-
-func TestLogRequest(t *testing.T) {
- cases := []struct {
- Body io.ReadSeeker
- ExpectBody []byte
- LogLevel aws.LogLevelType
- }{
- {
- Body: aws.ReadSeekCloser(bytes.NewBuffer([]byte("body content"))),
- ExpectBody: []byte("body content"),
- },
- {
- Body: aws.ReadSeekCloser(bytes.NewBuffer([]byte("body content"))),
- LogLevel: aws.LogDebugWithHTTPBody,
- ExpectBody: []byte("body content"),
- },
- {
- Body: bytes.NewReader([]byte("body content")),
- ExpectBody: []byte("body content"),
- },
- {
- Body: bytes.NewReader([]byte("body content")),
- LogLevel: aws.LogDebugWithHTTPBody,
- ExpectBody: []byte("body content"),
- },
- }
-
- for i, c := range cases {
- logW := bytes.NewBuffer(nil)
- req := request.New(
- aws.Config{
- Credentials: credentials.AnonymousCredentials,
- Logger: &bufLogger{w: logW},
- LogLevel: aws.LogLevel(c.LogLevel),
- },
- metadata.ClientInfo{
- Endpoint: "https://mock-service.mock-region.amazonaws.com",
- },
- testHandlers(),
- nil,
- &request.Operation{
- Name: "APIName",
- HTTPMethod: "POST",
- HTTPPath: "/",
- },
- struct{}{}, nil,
- )
- req.SetReaderBody(c.Body)
- req.Build()
-
- logRequest(req)
-
- b, err := ioutil.ReadAll(req.HTTPRequest.Body)
- if err != nil {
- t.Fatalf("%d, expect to read SDK request Body", i)
- }
-
- if e, a := c.ExpectBody, b; !reflect.DeepEqual(e, a) {
- t.Errorf("%d, expect %v body, got %v", i, e, a)
- }
- }
-}
-
-func TestLogResponse(t *testing.T) {
- cases := []struct {
- Body *bytes.Buffer
- ExpectBody []byte
- ReadBody bool
- LogLevel aws.LogLevelType
- }{
- {
- Body: bytes.NewBuffer([]byte("body content")),
- ExpectBody: []byte("body content"),
- },
- {
- Body: bytes.NewBuffer([]byte("body content")),
- LogLevel: aws.LogDebug,
- ExpectBody: []byte("body content"),
- },
- {
- Body: bytes.NewBuffer([]byte("body content")),
- LogLevel: aws.LogDebugWithHTTPBody,
- ReadBody: true,
- ExpectBody: []byte("body content"),
- },
- }
-
- for i, c := range cases {
- var logW bytes.Buffer
- req := request.New(
- aws.Config{
- Credentials: credentials.AnonymousCredentials,
- Logger: &bufLogger{w: &logW},
- LogLevel: aws.LogLevel(c.LogLevel),
- },
- metadata.ClientInfo{
- Endpoint: "https://mock-service.mock-region.amazonaws.com",
- },
- testHandlers(),
- nil,
- &request.Operation{
- Name: "APIName",
- HTTPMethod: "POST",
- HTTPPath: "/",
- },
- struct{}{}, nil,
- )
- req.HTTPResponse = &http.Response{
- StatusCode: 200,
- Status: "OK",
- Header: http.Header{
- "ABC": []string{"123"},
- },
- Body: ioutil.NopCloser(c.Body),
- }
-
- logResponse(req)
- req.Handlers.Unmarshal.Run(req)
-
- if c.ReadBody {
- if e, a := len(c.ExpectBody), c.Body.Len(); e != a {
- t.Errorf("%d, expect orginal body not to of been read", i)
- }
- }
-
- if logW.Len() == 0 {
- t.Errorf("%d, expect HTTP Response headers to be logged", i)
- }
-
- b, err := ioutil.ReadAll(req.HTTPResponse.Body)
- if err != nil {
- t.Fatalf("%d, expect to read SDK request Body", i)
- }
-
- if e, a := c.ExpectBody, b; !bytes.Equal(e, a) {
- t.Errorf("%d, expect %v body, got %v", i, e, a)
- }
- }
-}
-
-type bufLogger struct {
- w *bytes.Buffer
-}
-
-func (l *bufLogger) Log(args ...interface{}) {
- fmt.Fprintln(l.w, args...)
-}
-
-func testHandlers() request.Handlers {
- var handlers request.Handlers
-
- handlers.Build.PushBackNamed(corehandlers.SDKVersionUserAgentHandler)
-
- return handlers
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/config_test.go b/vendor/github.com/aws/aws-sdk-go/aws/config_test.go
deleted file mode 100644
index fe97a31fc..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/config_test.go
+++ /dev/null
@@ -1,86 +0,0 @@
-package aws
-
-import (
- "net/http"
- "reflect"
- "testing"
-
- "github.com/aws/aws-sdk-go/aws/credentials"
-)
-
-var testCredentials = credentials.NewStaticCredentials("AKID", "SECRET", "SESSION")
-
-var copyTestConfig = Config{
- Credentials: testCredentials,
- Endpoint: String("CopyTestEndpoint"),
- Region: String("COPY_TEST_AWS_REGION"),
- DisableSSL: Bool(true),
- HTTPClient: http.DefaultClient,
- LogLevel: LogLevel(LogDebug),
- Logger: NewDefaultLogger(),
- MaxRetries: Int(3),
- DisableParamValidation: Bool(true),
- DisableComputeChecksums: Bool(true),
- S3ForcePathStyle: Bool(true),
-}
-
-func TestCopy(t *testing.T) {
- want := copyTestConfig
- got := copyTestConfig.Copy()
- if !reflect.DeepEqual(*got, want) {
- t.Errorf("Copy() = %+v", got)
- t.Errorf(" want %+v", want)
- }
-
- got.Region = String("other")
- if got.Region == want.Region {
- t.Errorf("Expect setting copy values not not reflect in source")
- }
-}
-
-func TestCopyReturnsNewInstance(t *testing.T) {
- want := copyTestConfig
- got := copyTestConfig.Copy()
- if got == &want {
- t.Errorf("Copy() = %p; want different instance as source %p", got, &want)
- }
-}
-
-var mergeTestZeroValueConfig = Config{}
-
-var mergeTestConfig = Config{
- Credentials: testCredentials,
- Endpoint: String("MergeTestEndpoint"),
- Region: String("MERGE_TEST_AWS_REGION"),
- DisableSSL: Bool(true),
- HTTPClient: http.DefaultClient,
- LogLevel: LogLevel(LogDebug),
- Logger: NewDefaultLogger(),
- MaxRetries: Int(10),
- DisableParamValidation: Bool(true),
- DisableComputeChecksums: Bool(true),
- S3ForcePathStyle: Bool(true),
-}
-
-var mergeTests = []struct {
- cfg *Config
- in *Config
- want *Config
-}{
- {&Config{}, nil, &Config{}},
- {&Config{}, &mergeTestZeroValueConfig, &Config{}},
- {&Config{}, &mergeTestConfig, &mergeTestConfig},
-}
-
-func TestMerge(t *testing.T) {
- for i, tt := range mergeTests {
- got := tt.cfg.Copy()
- got.MergeIn(tt.in)
- if !reflect.DeepEqual(got, tt.want) {
- t.Errorf("Config %d %+v", i, tt.cfg)
- t.Errorf(" Merge(%+v)", tt.in)
- t.Errorf(" got %+v", got)
- t.Errorf(" want %+v", tt.want)
- }
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/context_test.go b/vendor/github.com/aws/aws-sdk-go/aws/context_test.go
deleted file mode 100644
index d80a1bb6d..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/context_test.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package aws_test
-
-import (
- "fmt"
- "testing"
- "time"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/awstesting"
-)
-
-func TestSleepWithContext(t *testing.T) {
- ctx := &awstesting.FakeContext{DoneCh: make(chan struct{})}
-
- err := aws.SleepWithContext(ctx, 1*time.Millisecond)
- if err != nil {
- t.Errorf("expect context to not be canceled, got %v", err)
- }
-}
-
-func TestSleepWithContext_Canceled(t *testing.T) {
- ctx := &awstesting.FakeContext{DoneCh: make(chan struct{})}
-
- expectErr := fmt.Errorf("context canceled")
-
- ctx.Error = expectErr
- close(ctx.DoneCh)
-
- err := aws.SleepWithContext(ctx, 1*time.Millisecond)
- if err == nil {
- t.Fatalf("expect error, did not get one")
- }
-
- if e, a := expectErr, err; e != a {
- t.Errorf("expect %v error, got %v", e, a)
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/convert_types_test.go b/vendor/github.com/aws/aws-sdk-go/aws/convert_types_test.go
deleted file mode 100644
index 1a9461e1b..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/convert_types_test.go
+++ /dev/null
@@ -1,641 +0,0 @@
-package aws
-
-import (
- "reflect"
- "testing"
- "time"
-)
-
-var testCasesStringSlice = [][]string{
- {"a", "b", "c", "d", "e"},
- {"a", "b", "", "", "e"},
-}
-
-func TestStringSlice(t *testing.T) {
- for idx, in := range testCasesStringSlice {
- if in == nil {
- continue
- }
- out := StringSlice(in)
- if e, a := len(out), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- for i := range out {
- if e, a := in[i], *(out[i]); e != a {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
-
- out2 := StringValueSlice(out)
- if e, a := len(out2), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- if e, a := in, out2; !reflect.DeepEqual(e, a) {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
-}
-
-var testCasesStringValueSlice = [][]*string{
- {String("a"), String("b"), nil, String("c")},
-}
-
-func TestStringValueSlice(t *testing.T) {
- for idx, in := range testCasesStringValueSlice {
- if in == nil {
- continue
- }
- out := StringValueSlice(in)
- if e, a := len(out), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- for i := range out {
- if in[i] == nil {
- if out[i] != "" {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- } else {
- if e, a := *(in[i]), out[i]; e != a {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
- }
-
- out2 := StringSlice(out)
- if e, a := len(out2), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- for i := range out2 {
- if in[i] == nil {
- if *(out2[i]) != "" {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- } else {
- if e, a := *in[i], *out2[i]; e != a {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
- }
- }
-}
-
-var testCasesStringMap = []map[string]string{
- {"a": "1", "b": "2", "c": "3"},
-}
-
-func TestStringMap(t *testing.T) {
- for idx, in := range testCasesStringMap {
- if in == nil {
- continue
- }
- out := StringMap(in)
- if e, a := len(out), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- for i := range out {
- if e, a := in[i], *(out[i]); e != a {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
-
- out2 := StringValueMap(out)
- if e, a := len(out2), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- if e, a := in, out2; !reflect.DeepEqual(e, a) {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
-}
-
-var testCasesBoolSlice = [][]bool{
- {true, true, false, false},
-}
-
-func TestBoolSlice(t *testing.T) {
- for idx, in := range testCasesBoolSlice {
- if in == nil {
- continue
- }
- out := BoolSlice(in)
- if e, a := len(out), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- for i := range out {
- if e, a := in[i], *(out[i]); e != a {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
-
- out2 := BoolValueSlice(out)
- if e, a := len(out2), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- if e, a := in, out2; !reflect.DeepEqual(e, a) {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
-}
-
-var testCasesBoolValueSlice = [][]*bool{}
-
-func TestBoolValueSlice(t *testing.T) {
- for idx, in := range testCasesBoolValueSlice {
- if in == nil {
- continue
- }
- out := BoolValueSlice(in)
- if e, a := len(out), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- for i := range out {
- if in[i] == nil {
- if out[i] {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- } else {
- if e, a := *(in[i]), out[i]; e != a {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
- }
-
- out2 := BoolSlice(out)
- if e, a := len(out2), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- for i := range out2 {
- if in[i] == nil {
- if *(out2[i]) {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- } else {
- if e, a := in[i], out2[i]; e != a {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
- }
- }
-}
-
-var testCasesBoolMap = []map[string]bool{
- {"a": true, "b": false, "c": true},
-}
-
-func TestBoolMap(t *testing.T) {
- for idx, in := range testCasesBoolMap {
- if in == nil {
- continue
- }
- out := BoolMap(in)
- if e, a := len(out), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- for i := range out {
- if e, a := in[i], *(out[i]); e != a {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
-
- out2 := BoolValueMap(out)
- if e, a := len(out2), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- if e, a := in, out2; !reflect.DeepEqual(e, a) {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
-}
-
-var testCasesIntSlice = [][]int{
- {1, 2, 3, 4},
-}
-
-func TestIntSlice(t *testing.T) {
- for idx, in := range testCasesIntSlice {
- if in == nil {
- continue
- }
- out := IntSlice(in)
- if e, a := len(out), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- for i := range out {
- if e, a := in[i], *(out[i]); e != a {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
-
- out2 := IntValueSlice(out)
- if e, a := len(out2), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- if e, a := in, out2; !reflect.DeepEqual(e, a) {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
-}
-
-var testCasesIntValueSlice = [][]*int{}
-
-func TestIntValueSlice(t *testing.T) {
- for idx, in := range testCasesIntValueSlice {
- if in == nil {
- continue
- }
- out := IntValueSlice(in)
- if e, a := len(out), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- for i := range out {
- if in[i] == nil {
- if out[i] != 0 {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- } else {
- if e, a := *(in[i]), out[i]; e != a {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
- }
-
- out2 := IntSlice(out)
- if e, a := len(out2), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- for i := range out2 {
- if in[i] == nil {
- if *(out2[i]) != 0 {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- } else {
- if e, a := in[i], out2[i]; e != a {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
- }
- }
-}
-
-var testCasesIntMap = []map[string]int{
- {"a": 3, "b": 2, "c": 1},
-}
-
-func TestIntMap(t *testing.T) {
- for idx, in := range testCasesIntMap {
- if in == nil {
- continue
- }
- out := IntMap(in)
- if e, a := len(out), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- for i := range out {
- if e, a := in[i], *(out[i]); e != a {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
-
- out2 := IntValueMap(out)
- if e, a := len(out2), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- if e, a := in, out2; !reflect.DeepEqual(e, a) {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
-}
-
-var testCasesInt64Slice = [][]int64{
- {1, 2, 3, 4},
-}
-
-func TestInt64Slice(t *testing.T) {
- for idx, in := range testCasesInt64Slice {
- if in == nil {
- continue
- }
- out := Int64Slice(in)
- if e, a := len(out), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- for i := range out {
- if e, a := in[i], *(out[i]); e != a {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
-
- out2 := Int64ValueSlice(out)
- if e, a := len(out2), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- if e, a := in, out2; !reflect.DeepEqual(e, a) {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
-}
-
-var testCasesInt64ValueSlice = [][]*int64{}
-
-func TestInt64ValueSlice(t *testing.T) {
- for idx, in := range testCasesInt64ValueSlice {
- if in == nil {
- continue
- }
- out := Int64ValueSlice(in)
- if e, a := len(out), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- for i := range out {
- if in[i] == nil {
- if out[i] != 0 {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- } else {
- if e, a := *(in[i]), out[i]; e != a {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
- }
-
- out2 := Int64Slice(out)
- if e, a := len(out2), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- for i := range out2 {
- if in[i] == nil {
- if *(out2[i]) != 0 {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- } else {
- if e, a := in[i], out2[i]; e != a {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
- }
- }
-}
-
-var testCasesInt64Map = []map[string]int64{
- {"a": 3, "b": 2, "c": 1},
-}
-
-func TestInt64Map(t *testing.T) {
- for idx, in := range testCasesInt64Map {
- if in == nil {
- continue
- }
- out := Int64Map(in)
- if e, a := len(out), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- for i := range out {
- if e, a := in[i], *(out[i]); e != a {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
-
- out2 := Int64ValueMap(out)
- if e, a := len(out2), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- if e, a := in, out2; !reflect.DeepEqual(e, a) {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
-}
-
-var testCasesFloat64Slice = [][]float64{
- {1, 2, 3, 4},
-}
-
-func TestFloat64Slice(t *testing.T) {
- for idx, in := range testCasesFloat64Slice {
- if in == nil {
- continue
- }
- out := Float64Slice(in)
- if e, a := len(out), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- for i := range out {
- if e, a := in[i], *(out[i]); e != a {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
-
- out2 := Float64ValueSlice(out)
- if e, a := len(out2), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- if e, a := in, out2; !reflect.DeepEqual(e, a) {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
-}
-
-var testCasesFloat64ValueSlice = [][]*float64{}
-
-func TestFloat64ValueSlice(t *testing.T) {
- for idx, in := range testCasesFloat64ValueSlice {
- if in == nil {
- continue
- }
- out := Float64ValueSlice(in)
- if e, a := len(out), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- for i := range out {
- if in[i] == nil {
- if out[i] != 0 {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- } else {
- if e, a := *(in[i]), out[i]; e != a {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
- }
-
- out2 := Float64Slice(out)
- if e, a := len(out2), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- for i := range out2 {
- if in[i] == nil {
- if *(out2[i]) != 0 {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- } else {
- if e, a := in[i], out2[i]; e != a {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
- }
- }
-}
-
-var testCasesFloat64Map = []map[string]float64{
- {"a": 3, "b": 2, "c": 1},
-}
-
-func TestFloat64Map(t *testing.T) {
- for idx, in := range testCasesFloat64Map {
- if in == nil {
- continue
- }
- out := Float64Map(in)
- if e, a := len(out), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- for i := range out {
- if e, a := in[i], *(out[i]); e != a {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
-
- out2 := Float64ValueMap(out)
- if e, a := len(out2), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- if e, a := in, out2; !reflect.DeepEqual(e, a) {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
-}
-
-var testCasesTimeSlice = [][]time.Time{
- {time.Now(), time.Now().AddDate(100, 0, 0)},
-}
-
-func TestTimeSlice(t *testing.T) {
- for idx, in := range testCasesTimeSlice {
- if in == nil {
- continue
- }
- out := TimeSlice(in)
- if e, a := len(out), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- for i := range out {
- if e, a := in[i], *(out[i]); e != a {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
-
- out2 := TimeValueSlice(out)
- if e, a := len(out2), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- if e, a := in, out2; !reflect.DeepEqual(e, a) {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
-}
-
-var testCasesTimeValueSlice = [][]*time.Time{}
-
-func TestTimeValueSlice(t *testing.T) {
- for idx, in := range testCasesTimeValueSlice {
- if in == nil {
- continue
- }
- out := TimeValueSlice(in)
- if e, a := len(out), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- for i := range out {
- if in[i] == nil {
- if !out[i].IsZero() {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- } else {
- if e, a := *(in[i]), out[i]; e != a {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
- }
-
- out2 := TimeSlice(out)
- if e, a := len(out2), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- for i := range out2 {
- if in[i] == nil {
- if !(*(out2[i])).IsZero() {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- } else {
- if e, a := in[i], out2[i]; e != a {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
- }
- }
-}
-
-var testCasesTimeMap = []map[string]time.Time{
- {"a": time.Now().AddDate(-100, 0, 0), "b": time.Now()},
-}
-
-func TestTimeMap(t *testing.T) {
- for idx, in := range testCasesTimeMap {
- if in == nil {
- continue
- }
- out := TimeMap(in)
- if e, a := len(out), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- for i := range out {
- if e, a := in[i], *(out[i]); e != a {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
-
- out2 := TimeValueMap(out)
- if e, a := len(out2), len(in); e != a {
- t.Errorf("Unexpected len at idx %d", idx)
- }
- if e, a := in, out2; !reflect.DeepEqual(e, a) {
- t.Errorf("Unexpected value at idx %d", idx)
- }
- }
-}
-
-type TimeValueTestCase struct {
- in int64
- outSecs time.Time
- outMillis time.Time
-}
-
-var testCasesTimeValue = []TimeValueTestCase{
- {
- in: int64(1501558289000),
- outSecs: time.Unix(1501558289, 0),
- outMillis: time.Unix(1501558289, 0),
- },
- {
- in: int64(1501558289001),
- outSecs: time.Unix(1501558289, 0),
- outMillis: time.Unix(1501558289, 1*1000000),
- },
-}
-
-func TestSecondsTimeValue(t *testing.T) {
- for idx, testCase := range testCasesTimeValue {
- out := SecondsTimeValue(&testCase.in)
- if e, a := testCase.outSecs, out; e != a {
- t.Errorf("Unexpected value for time value at %d", idx)
- }
- }
-}
-
-func TestMillisecondsTimeValue(t *testing.T) {
- for idx, testCase := range testCasesTimeValue {
- out := MillisecondsTimeValue(&testCase.in)
- if e, a := testCase.outMillis, out; e != a {
- t.Errorf("Unexpected value for time value at %d", idx)
- }
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_1_8_test.go b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_1_8_test.go
deleted file mode 100644
index b47afc249..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_1_8_test.go
+++ /dev/null
@@ -1,64 +0,0 @@
-// +build go1.8
-
-package corehandlers_test
-
-import (
- "crypto/tls"
- "net/http"
- "testing"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/credentials"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/aws/session"
- "github.com/aws/aws-sdk-go/awstesting"
- "github.com/aws/aws-sdk-go/service/s3"
- "golang.org/x/net/http2"
-)
-
-func TestSendHandler_HEADNoBody(t *testing.T) {
- TLSBundleCertFile, TLSBundleKeyFile, TLSBundleCAFile, err := awstesting.CreateTLSBundleFiles()
- if err != nil {
- panic(err)
- }
- defer awstesting.CleanupTLSBundleFiles(TLSBundleCertFile, TLSBundleKeyFile, TLSBundleCAFile)
-
- endpoint, err := awstesting.CreateTLSServer(TLSBundleCertFile, TLSBundleKeyFile, nil)
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- transport := http.DefaultTransport.(*http.Transport)
- // test server's certificate is self-signed certificate
- transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
- http2.ConfigureTransport(transport)
-
- sess, err := session.NewSessionWithOptions(session.Options{
- Config: aws.Config{
- HTTPClient: &http.Client{},
- Endpoint: aws.String(endpoint),
- Region: aws.String("mock-region"),
- Credentials: credentials.AnonymousCredentials,
- S3ForcePathStyle: aws.Bool(true),
- },
- })
-
- svc := s3.New(sess)
-
- req, _ := svc.HeadObjectRequest(&s3.HeadObjectInput{
- Bucket: aws.String("bucketname"),
- Key: aws.String("keyname"),
- })
-
- if e, a := request.NoBody, req.HTTPRequest.Body; e != a {
- t.Fatalf("expect %T request body, got %T", e, a)
- }
-
- err = req.Send()
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
- if e, a := http.StatusOK, req.HTTPResponse.StatusCode; e != a {
- t.Errorf("expect %d status code, got %d", e, a)
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_test.go b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_test.go
deleted file mode 100644
index 1d715c9f3..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_test.go
+++ /dev/null
@@ -1,398 +0,0 @@
-package corehandlers_test
-
-import (
- "bytes"
- "fmt"
- "io/ioutil"
- "net/http"
- "net/http/httptest"
- "os"
- "strings"
- "testing"
- "time"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/awserr"
- "github.com/aws/aws-sdk-go/aws/corehandlers"
- "github.com/aws/aws-sdk-go/aws/credentials"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/awstesting"
- "github.com/aws/aws-sdk-go/awstesting/unit"
- "github.com/aws/aws-sdk-go/service/s3"
-)
-
-func TestValidateEndpointHandler(t *testing.T) {
- os.Clearenv()
-
- svc := awstesting.NewClient(aws.NewConfig().WithRegion("us-west-2"))
- svc.Handlers.Clear()
- svc.Handlers.Validate.PushBackNamed(corehandlers.ValidateEndpointHandler)
-
- req := svc.NewRequest(&request.Operation{Name: "Operation"}, nil, nil)
- err := req.Build()
-
- if err != nil {
- t.Errorf("expect no error, got %v", err)
- }
-}
-
-func TestValidateEndpointHandlerErrorRegion(t *testing.T) {
- os.Clearenv()
-
- svc := awstesting.NewClient()
- svc.Handlers.Clear()
- svc.Handlers.Validate.PushBackNamed(corehandlers.ValidateEndpointHandler)
-
- req := svc.NewRequest(&request.Operation{Name: "Operation"}, nil, nil)
- err := req.Build()
-
- if err == nil {
- t.Errorf("expect error, got none")
- }
- if e, a := aws.ErrMissingRegion, err; e != a {
- t.Errorf("expect %v to be %v", e, a)
- }
-}
-
-type mockCredsProvider struct {
- expired bool
- retrieveCalled bool
-}
-
-func (m *mockCredsProvider) Retrieve() (credentials.Value, error) {
- m.retrieveCalled = true
- return credentials.Value{ProviderName: "mockCredsProvider"}, nil
-}
-
-func (m *mockCredsProvider) IsExpired() bool {
- return m.expired
-}
-
-func TestAfterRetryRefreshCreds(t *testing.T) {
- os.Clearenv()
- credProvider := &mockCredsProvider{}
-
- svc := awstesting.NewClient(&aws.Config{
- Credentials: credentials.NewCredentials(credProvider),
- MaxRetries: aws.Int(1),
- })
-
- svc.Handlers.Clear()
- svc.Handlers.ValidateResponse.PushBack(func(r *request.Request) {
- r.Error = awserr.New("UnknownError", "", nil)
- r.HTTPResponse = &http.Response{StatusCode: 400, Body: ioutil.NopCloser(bytes.NewBuffer([]byte{}))}
- })
- svc.Handlers.UnmarshalError.PushBack(func(r *request.Request) {
- r.Error = awserr.New("ExpiredTokenException", "", nil)
- })
- svc.Handlers.AfterRetry.PushBackNamed(corehandlers.AfterRetryHandler)
-
- if !svc.Config.Credentials.IsExpired() {
- t.Errorf("Expect to start out expired")
- }
- if credProvider.retrieveCalled {
- t.Errorf("expect not called")
- }
-
- req := svc.NewRequest(&request.Operation{Name: "Operation"}, nil, nil)
- req.Send()
-
- if !svc.Config.Credentials.IsExpired() {
- t.Errorf("Expect to start out expired")
- }
- if credProvider.retrieveCalled {
- t.Errorf("expect not called")
- }
-
- _, err := svc.Config.Credentials.Get()
- if err != nil {
- t.Errorf("expect no error, got %v", err)
- }
- if !credProvider.retrieveCalled {
- t.Errorf("expect not called")
- }
-}
-
-func TestAfterRetryWithContextCanceled(t *testing.T) {
- c := awstesting.NewClient()
-
- req := c.NewRequest(&request.Operation{Name: "Operation"}, nil, nil)
-
- ctx := &awstesting.FakeContext{DoneCh: make(chan struct{}, 0)}
- req.SetContext(ctx)
-
- req.Error = fmt.Errorf("some error")
- req.Retryable = aws.Bool(true)
- req.HTTPResponse = &http.Response{
- StatusCode: 500,
- }
-
- close(ctx.DoneCh)
- ctx.Error = fmt.Errorf("context canceled")
-
- corehandlers.AfterRetryHandler.Fn(req)
-
- if req.Error == nil {
- t.Fatalf("expect error but didn't receive one")
- }
-
- aerr := req.Error.(awserr.Error)
-
- if e, a := request.CanceledErrorCode, aerr.Code(); e != a {
- t.Errorf("expect %q, error code got %q", e, a)
- }
-}
-
-func TestAfterRetryWithContext(t *testing.T) {
- c := awstesting.NewClient()
-
- req := c.NewRequest(&request.Operation{Name: "Operation"}, nil, nil)
-
- ctx := &awstesting.FakeContext{DoneCh: make(chan struct{}, 0)}
- req.SetContext(ctx)
-
- req.Error = fmt.Errorf("some error")
- req.Retryable = aws.Bool(true)
- req.HTTPResponse = &http.Response{
- StatusCode: 500,
- }
-
- corehandlers.AfterRetryHandler.Fn(req)
-
- if req.Error != nil {
- t.Fatalf("expect no error, got %v", req.Error)
- }
- if e, a := 1, req.RetryCount; e != a {
- t.Errorf("expect retry count to be %d, got %d", e, a)
- }
-}
-
-func TestSendWithContextCanceled(t *testing.T) {
- c := awstesting.NewClient(&aws.Config{
- SleepDelay: func(dur time.Duration) {
- t.Errorf("SleepDelay should not be called")
- },
- })
-
- req := c.NewRequest(&request.Operation{Name: "Operation"}, nil, nil)
-
- ctx := &awstesting.FakeContext{DoneCh: make(chan struct{}, 0)}
- req.SetContext(ctx)
-
- req.Error = fmt.Errorf("some error")
- req.Retryable = aws.Bool(true)
- req.HTTPResponse = &http.Response{
- StatusCode: 500,
- }
-
- close(ctx.DoneCh)
- ctx.Error = fmt.Errorf("context canceled")
-
- corehandlers.SendHandler.Fn(req)
-
- if req.Error == nil {
- t.Fatalf("expect error but didn't receive one")
- }
-
- aerr := req.Error.(awserr.Error)
-
- if e, a := request.CanceledErrorCode, aerr.Code(); e != a {
- t.Errorf("expect %q, error code got %q", e, a)
- }
-}
-
-type testSendHandlerTransport struct{}
-
-func (t *testSendHandlerTransport) RoundTrip(r *http.Request) (*http.Response, error) {
- return nil, fmt.Errorf("mock error")
-}
-
-func TestSendHandlerError(t *testing.T) {
- svc := awstesting.NewClient(&aws.Config{
- HTTPClient: &http.Client{
- Transport: &testSendHandlerTransport{},
- },
- })
- svc.Handlers.Clear()
- svc.Handlers.Send.PushBackNamed(corehandlers.SendHandler)
- r := svc.NewRequest(&request.Operation{Name: "Operation"}, nil, nil)
-
- r.Send()
-
- if r.Error == nil {
- t.Errorf("expect error, got none")
- }
- if r.HTTPResponse == nil {
- t.Errorf("expect response, got none")
- }
-}
-
-func TestSendWithoutFollowRedirects(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- switch r.URL.Path {
- case "/original":
- w.Header().Set("Location", "/redirected")
- w.WriteHeader(301)
- case "/redirected":
- t.Fatalf("expect not to redirect, but was")
- }
- }))
-
- svc := awstesting.NewClient(&aws.Config{
- DisableSSL: aws.Bool(true),
- Endpoint: aws.String(server.URL),
- })
- svc.Handlers.Clear()
- svc.Handlers.Send.PushBackNamed(corehandlers.SendHandler)
-
- r := svc.NewRequest(&request.Operation{
- Name: "Operation",
- HTTPPath: "/original",
- }, nil, nil)
- r.DisableFollowRedirects = true
-
- err := r.Send()
- if err != nil {
- t.Errorf("expect no error, got %v", err)
- }
- if e, a := 301, r.HTTPResponse.StatusCode; e != a {
- t.Errorf("expect %d status code, got %d", e, a)
- }
-}
-
-func TestValidateReqSigHandler(t *testing.T) {
- cases := []struct {
- Req *request.Request
- Resign bool
- }{
- {
- Req: &request.Request{
- Config: aws.Config{Credentials: credentials.AnonymousCredentials},
- Time: time.Now().Add(-15 * time.Minute),
- },
- Resign: false,
- },
- {
- Req: &request.Request{
- Time: time.Now().Add(-15 * time.Minute),
- },
- Resign: true,
- },
- {
- Req: &request.Request{
- Time: time.Now().Add(-1 * time.Minute),
- },
- Resign: false,
- },
- }
-
- for i, c := range cases {
- resigned := false
- c.Req.Handlers.Sign.PushBack(func(r *request.Request) {
- resigned = true
- })
-
- corehandlers.ValidateReqSigHandler.Fn(c.Req)
-
- if c.Req.Error != nil {
- t.Errorf("expect no error, got %v", c.Req.Error)
- }
- if e, a := c.Resign, resigned; e != a {
- t.Errorf("%d, expect %v to be %v", i, e, a)
- }
- }
-}
-
-func setupContentLengthTestServer(t *testing.T, hasContentLength bool, contentLength int64) *httptest.Server {
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- _, ok := r.Header["Content-Length"]
- if e, a := hasContentLength, ok; e != a {
- t.Errorf("expect %v to be %v", e, a)
- }
- if hasContentLength {
- if e, a := contentLength, r.ContentLength; e != a {
- t.Errorf("expect %v to be %v", e, a)
- }
- }
-
- b, err := ioutil.ReadAll(r.Body)
- if err != nil {
- t.Errorf("expect no error, got %v", err)
- }
- r.Body.Close()
-
- authHeader := r.Header.Get("Authorization")
- if hasContentLength {
- if e, a := "content-length", authHeader; !strings.Contains(a, e) {
- t.Errorf("expect %v to be in %v", e, a)
- }
- } else {
- if e, a := "content-length", authHeader; strings.Contains(a, e) {
- t.Errorf("expect %v to not be in %v", e, a)
- }
- }
-
- if e, a := contentLength, int64(len(b)); e != a {
- t.Errorf("expect %v to be %v", e, a)
- }
- }))
-
- return server
-}
-
-func TestBuildContentLength_ZeroBody(t *testing.T) {
- server := setupContentLengthTestServer(t, false, 0)
-
- svc := s3.New(unit.Session, &aws.Config{
- Endpoint: aws.String(server.URL),
- S3ForcePathStyle: aws.Bool(true),
- DisableSSL: aws.Bool(true),
- })
- _, err := svc.GetObject(&s3.GetObjectInput{
- Bucket: aws.String("bucketname"),
- Key: aws.String("keyname"),
- })
-
- if err != nil {
- t.Errorf("expect no error, got %v", err)
- }
-}
-
-func TestBuildContentLength_NegativeBody(t *testing.T) {
- server := setupContentLengthTestServer(t, false, 0)
-
- svc := s3.New(unit.Session, &aws.Config{
- Endpoint: aws.String(server.URL),
- S3ForcePathStyle: aws.Bool(true),
- DisableSSL: aws.Bool(true),
- })
- req, _ := svc.GetObjectRequest(&s3.GetObjectInput{
- Bucket: aws.String("bucketname"),
- Key: aws.String("keyname"),
- })
-
- req.HTTPRequest.Header.Set("Content-Length", "-1")
-
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-}
-
-func TestBuildContentLength_WithBody(t *testing.T) {
- server := setupContentLengthTestServer(t, true, 1024)
-
- svc := s3.New(unit.Session, &aws.Config{
- Endpoint: aws.String(server.URL),
- S3ForcePathStyle: aws.Bool(true),
- DisableSSL: aws.Bool(true),
- })
- _, err := svc.PutObject(&s3.PutObjectInput{
- Bucket: aws.String("bucketname"),
- Key: aws.String("keyname"),
- Body: bytes.NewReader(make([]byte, 1024)),
- })
-
- if err != nil {
- t.Errorf("expect no error, got %v", err)
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator_test.go b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator_test.go
deleted file mode 100644
index e1d8a08fd..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator_test.go
+++ /dev/null
@@ -1,286 +0,0 @@
-package corehandlers_test
-
-import (
- "fmt"
- "testing"
- "reflect"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/awserr"
- "github.com/aws/aws-sdk-go/aws/client"
- "github.com/aws/aws-sdk-go/aws/client/metadata"
- "github.com/aws/aws-sdk-go/aws/corehandlers"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/awstesting/unit"
- "github.com/aws/aws-sdk-go/service/kinesis"
-)
-
-var testSvc = func() *client.Client {
- s := &client.Client{
- Config: aws.Config{},
- ClientInfo: metadata.ClientInfo{
- ServiceName: "mock-service",
- APIVersion: "2015-01-01",
- },
- }
- return s
-}()
-
-type StructShape struct {
- _ struct{} `type:"structure"`
-
- RequiredList []*ConditionalStructShape `required:"true"`
- RequiredMap map[string]*ConditionalStructShape `required:"true"`
- RequiredBool *bool `required:"true"`
- OptionalStruct *ConditionalStructShape
-
- hiddenParameter *string
-}
-
-func (s *StructShape) Validate() error {
- invalidParams := request.ErrInvalidParams{Context: "StructShape"}
- if s.RequiredList == nil {
- invalidParams.Add(request.NewErrParamRequired("RequiredList"))
- }
- if s.RequiredMap == nil {
- invalidParams.Add(request.NewErrParamRequired("RequiredMap"))
- }
- if s.RequiredBool == nil {
- invalidParams.Add(request.NewErrParamRequired("RequiredBool"))
- }
- if s.RequiredList != nil {
- for i, v := range s.RequiredList {
- if v == nil {
- continue
- }
- if err := v.Validate(); err != nil {
- invalidParams.AddNested(fmt.Sprintf("%s[%v]", "RequiredList", i), err.(request.ErrInvalidParams))
- }
- }
- }
- if s.RequiredMap != nil {
- for i, v := range s.RequiredMap {
- if v == nil {
- continue
- }
- if err := v.Validate(); err != nil {
- invalidParams.AddNested(fmt.Sprintf("%s[%v]", "RequiredMap", i), err.(request.ErrInvalidParams))
- }
- }
- }
- if s.OptionalStruct != nil {
- if err := s.OptionalStruct.Validate(); err != nil {
- invalidParams.AddNested("OptionalStruct", err.(request.ErrInvalidParams))
- }
- }
-
- if invalidParams.Len() > 0 {
- return invalidParams
- }
- return nil
-}
-
-type ConditionalStructShape struct {
- _ struct{} `type:"structure"`
-
- Name *string `required:"true"`
-}
-
-func (s *ConditionalStructShape) Validate() error {
- invalidParams := request.ErrInvalidParams{Context: "ConditionalStructShape"}
- if s.Name == nil {
- invalidParams.Add(request.NewErrParamRequired("Name"))
- }
-
- if invalidParams.Len() > 0 {
- return invalidParams
- }
- return nil
-}
-
-func TestNoErrors(t *testing.T) {
- input := &StructShape{
- RequiredList: []*ConditionalStructShape{},
- RequiredMap: map[string]*ConditionalStructShape{
- "key1": {Name: aws.String("Name")},
- "key2": {Name: aws.String("Name")},
- },
- RequiredBool: aws.Bool(true),
- OptionalStruct: &ConditionalStructShape{Name: aws.String("Name")},
- }
-
- req := testSvc.NewRequest(&request.Operation{}, input, nil)
- corehandlers.ValidateParametersHandler.Fn(req)
- if req.Error != nil {
- t.Fatalf("expect no error, got %v", req.Error)
- }
-}
-
-func TestMissingRequiredParameters(t *testing.T) {
- input := &StructShape{}
- req := testSvc.NewRequest(&request.Operation{}, input, nil)
- corehandlers.ValidateParametersHandler.Fn(req)
-
- if req.Error == nil {
- t.Fatalf("expect error")
- }
- if e, a := "InvalidParameter", req.Error.(awserr.Error).Code(); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "3 validation error(s) found.", req.Error.(awserr.Error).Message(); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
- errs := req.Error.(awserr.BatchedErrors).OrigErrs()
- if e, a := 3, len(errs); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "ParamRequiredError: missing required field, StructShape.RequiredList.", errs[0].Error(); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "ParamRequiredError: missing required field, StructShape.RequiredMap.", errs[1].Error(); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "ParamRequiredError: missing required field, StructShape.RequiredBool.", errs[2].Error(); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
- if e, a := "InvalidParameter: 3 validation error(s) found.\n- missing required field, StructShape.RequiredList.\n- missing required field, StructShape.RequiredMap.\n- missing required field, StructShape.RequiredBool.\n", req.Error.Error(); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-func TestNestedMissingRequiredParameters(t *testing.T) {
- input := &StructShape{
- RequiredList: []*ConditionalStructShape{{}},
- RequiredMap: map[string]*ConditionalStructShape{
- "key1": {Name: aws.String("Name")},
- "key2": {},
- },
- RequiredBool: aws.Bool(true),
- OptionalStruct: &ConditionalStructShape{},
- }
-
- req := testSvc.NewRequest(&request.Operation{}, input, nil)
- corehandlers.ValidateParametersHandler.Fn(req)
-
- if req.Error == nil {
- t.Fatalf("expect error")
- }
- if e, a := "InvalidParameter", req.Error.(awserr.Error).Code(); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "3 validation error(s) found.", req.Error.(awserr.Error).Message(); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
- errs := req.Error.(awserr.BatchedErrors).OrigErrs()
- if e, a := 3, len(errs); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "ParamRequiredError: missing required field, StructShape.RequiredList[0].Name.", errs[0].Error(); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "ParamRequiredError: missing required field, StructShape.RequiredMap[key2].Name.", errs[1].Error(); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "ParamRequiredError: missing required field, StructShape.OptionalStruct.Name.", errs[2].Error(); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-type testInput struct {
- StringField *string `min:"5"`
- ListField []string `min:"3"`
- MapField map[string]string `min:"4"`
-}
-
-func (s testInput) Validate() error {
- invalidParams := request.ErrInvalidParams{Context: "testInput"}
- if s.StringField != nil && len(*s.StringField) < 5 {
- invalidParams.Add(request.NewErrParamMinLen("StringField", 5))
- }
- if s.ListField != nil && len(s.ListField) < 3 {
- invalidParams.Add(request.NewErrParamMinLen("ListField", 3))
- }
- if s.MapField != nil && len(s.MapField) < 4 {
- invalidParams.Add(request.NewErrParamMinLen("MapField", 4))
- }
-
- if invalidParams.Len() > 0 {
- return invalidParams
- }
- return nil
-}
-
-var testsFieldMin = []struct {
- err awserr.Error
- in testInput
-}{
- {
- err: func() awserr.Error {
- invalidParams := request.ErrInvalidParams{Context: "testInput"}
- invalidParams.Add(request.NewErrParamMinLen("StringField", 5))
- return invalidParams
- }(),
- in: testInput{StringField: aws.String("abcd")},
- },
- {
- err: func() awserr.Error {
- invalidParams := request.ErrInvalidParams{Context: "testInput"}
- invalidParams.Add(request.NewErrParamMinLen("StringField", 5))
- invalidParams.Add(request.NewErrParamMinLen("ListField", 3))
- return invalidParams
- }(),
- in: testInput{StringField: aws.String("abcd"), ListField: []string{"a", "b"}},
- },
- {
- err: func() awserr.Error {
- invalidParams := request.ErrInvalidParams{Context: "testInput"}
- invalidParams.Add(request.NewErrParamMinLen("StringField", 5))
- invalidParams.Add(request.NewErrParamMinLen("ListField", 3))
- invalidParams.Add(request.NewErrParamMinLen("MapField", 4))
- return invalidParams
- }(),
- in: testInput{StringField: aws.String("abcd"), ListField: []string{"a", "b"}, MapField: map[string]string{"a": "a", "b": "b"}},
- },
- {
- err: nil,
- in: testInput{StringField: aws.String("abcde"),
- ListField: []string{"a", "b", "c"}, MapField: map[string]string{"a": "a", "b": "b", "c": "c", "d": "d"}},
- },
-}
-
-func TestValidateFieldMinParameter(t *testing.T) {
- for i, c := range testsFieldMin {
- req := testSvc.NewRequest(&request.Operation{}, &c.in, nil)
- corehandlers.ValidateParametersHandler.Fn(req)
-
- if e, a := c.err, req.Error; !reflect.DeepEqual(e,a) {
- t.Errorf("%d, expect %v, got %v", i, e, a)
- }
- }
-}
-
-func BenchmarkValidateAny(b *testing.B) {
- input := &kinesis.PutRecordsInput{
- StreamName: aws.String("stream"),
- }
- for i := 0; i < 100; i++ {
- record := &kinesis.PutRecordsRequestEntry{
- Data: make([]byte, 10000),
- PartitionKey: aws.String("partition"),
- }
- input.Records = append(input.Records, record)
- }
-
- req, _ := kinesis.New(unit.Session).PutRecordsRequest(input)
-
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- corehandlers.ValidateParametersHandler.Fn(req)
- if err := req.Error; err != nil {
- b.Fatalf("validation failed: %v", err)
- }
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/user_agent_test.go b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/user_agent_test.go
deleted file mode 100644
index 4f6183560..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/user_agent_test.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package corehandlers
-
-import (
- "net/http"
- "os"
- "testing"
-
- "github.com/aws/aws-sdk-go/aws/request"
-)
-
-func TestAddHostExecEnvUserAgentHander(t *testing.T) {
- cases := []struct {
- ExecEnv string
- Expect string
- }{
- {ExecEnv: "Lambda", Expect: "exec_env/Lambda"},
- {ExecEnv: "", Expect: ""},
- {ExecEnv: "someThingCool", Expect: "exec_env/someThingCool"},
- }
-
- for i, c := range cases {
- os.Clearenv()
- os.Setenv(execEnvVar, c.ExecEnv)
-
- req := &request.Request{
- HTTPRequest: &http.Request{
- Header: http.Header{},
- },
- }
- AddHostExecEnvUserAgentHander.Fn(req)
-
- if err := req.Error; err != nil {
- t.Fatalf("%d, expect no error, got %v", i, err)
- }
-
- if e, a := c.Expect, req.HTTPRequest.Header.Get("User-Agent"); e != a {
- t.Errorf("%d, expect %v user agent, got %v", i, e, a)
- }
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider_test.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider_test.go
deleted file mode 100644
index 3b393a2ed..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider_test.go
+++ /dev/null
@@ -1,154 +0,0 @@
-package credentials
-
-import (
- "testing"
-
- "github.com/aws/aws-sdk-go/aws/awserr"
- "github.com/stretchr/testify/assert"
-)
-
-type secondStubProvider struct {
- creds Value
- expired bool
- err error
-}
-
-func (s *secondStubProvider) Retrieve() (Value, error) {
- s.expired = false
- s.creds.ProviderName = "secondStubProvider"
- return s.creds, s.err
-}
-func (s *secondStubProvider) IsExpired() bool {
- return s.expired
-}
-
-func TestChainProviderWithNames(t *testing.T) {
- p := &ChainProvider{
- Providers: []Provider{
- &stubProvider{err: awserr.New("FirstError", "first provider error", nil)},
- &stubProvider{err: awserr.New("SecondError", "second provider error", nil)},
- &secondStubProvider{
- creds: Value{
- AccessKeyID: "AKIF",
- SecretAccessKey: "NOSECRET",
- SessionToken: "",
- },
- },
- &stubProvider{
- creds: Value{
- AccessKeyID: "AKID",
- SecretAccessKey: "SECRET",
- SessionToken: "",
- },
- },
- },
- }
-
- creds, err := p.Retrieve()
- assert.Nil(t, err, "Expect no error")
- assert.Equal(t, "secondStubProvider", creds.ProviderName, "Expect provider name to match")
-
- // Also check credentials
- assert.Equal(t, "AKIF", creds.AccessKeyID, "Expect access key ID to match")
- assert.Equal(t, "NOSECRET", creds.SecretAccessKey, "Expect secret access key to match")
- assert.Empty(t, creds.SessionToken, "Expect session token to be empty")
-
-}
-
-func TestChainProviderGet(t *testing.T) {
- p := &ChainProvider{
- Providers: []Provider{
- &stubProvider{err: awserr.New("FirstError", "first provider error", nil)},
- &stubProvider{err: awserr.New("SecondError", "second provider error", nil)},
- &stubProvider{
- creds: Value{
- AccessKeyID: "AKID",
- SecretAccessKey: "SECRET",
- SessionToken: "",
- },
- },
- },
- }
-
- creds, err := p.Retrieve()
- assert.Nil(t, err, "Expect no error")
- assert.Equal(t, "AKID", creds.AccessKeyID, "Expect access key ID to match")
- assert.Equal(t, "SECRET", creds.SecretAccessKey, "Expect secret access key to match")
- assert.Empty(t, creds.SessionToken, "Expect session token to be empty")
-}
-
-func TestChainProviderIsExpired(t *testing.T) {
- stubProvider := &stubProvider{expired: true}
- p := &ChainProvider{
- Providers: []Provider{
- stubProvider,
- },
- }
-
- assert.True(t, p.IsExpired(), "Expect expired to be true before any Retrieve")
- _, err := p.Retrieve()
- assert.Nil(t, err, "Expect no error")
- assert.False(t, p.IsExpired(), "Expect not expired after retrieve")
-
- stubProvider.expired = true
- assert.True(t, p.IsExpired(), "Expect return of expired provider")
-
- _, err = p.Retrieve()
- assert.False(t, p.IsExpired(), "Expect not expired after retrieve")
-}
-
-func TestChainProviderWithNoProvider(t *testing.T) {
- p := &ChainProvider{
- Providers: []Provider{},
- }
-
- assert.True(t, p.IsExpired(), "Expect expired with no providers")
- _, err := p.Retrieve()
- assert.Equal(t,
- ErrNoValidProvidersFoundInChain,
- err,
- "Expect no providers error returned")
-}
-
-func TestChainProviderWithNoValidProvider(t *testing.T) {
- errs := []error{
- awserr.New("FirstError", "first provider error", nil),
- awserr.New("SecondError", "second provider error", nil),
- }
- p := &ChainProvider{
- Providers: []Provider{
- &stubProvider{err: errs[0]},
- &stubProvider{err: errs[1]},
- },
- }
-
- assert.True(t, p.IsExpired(), "Expect expired with no providers")
- _, err := p.Retrieve()
-
- assert.Equal(t,
- ErrNoValidProvidersFoundInChain,
- err,
- "Expect no providers error returned")
-}
-
-func TestChainProviderWithNoValidProviderWithVerboseEnabled(t *testing.T) {
- errs := []error{
- awserr.New("FirstError", "first provider error", nil),
- awserr.New("SecondError", "second provider error", nil),
- }
- p := &ChainProvider{
- VerboseErrors: true,
- Providers: []Provider{
- &stubProvider{err: errs[0]},
- &stubProvider{err: errs[1]},
- },
- }
-
- assert.True(t, p.IsExpired(), "Expect expired with no providers")
- _, err := p.Retrieve()
-
- assert.Equal(t,
- awserr.NewBatchError("NoCredentialProviders", "no valid providers in chain", errs),
- err,
- "Expect no providers error returned")
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials_bench_test.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials_bench_test.go
deleted file mode 100644
index 01a5d633b..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials_bench_test.go
+++ /dev/null
@@ -1,90 +0,0 @@
-// +build go1.9
-
-package credentials
-
-import (
- "fmt"
- "strconv"
- "sync"
- "testing"
- "time"
-)
-
-func BenchmarkCredentials_Get(b *testing.B) {
- stub := &stubProvider{}
-
- cases := []int{1, 10, 100, 500, 1000, 10000}
-
- for _, c := range cases {
- b.Run(strconv.Itoa(c), func(b *testing.B) {
- creds := NewCredentials(stub)
- var wg sync.WaitGroup
- wg.Add(c)
- for i := 0; i < c; i++ {
- go func() {
- for j := 0; j < b.N; j++ {
- v, err := creds.Get()
- if err != nil {
- b.Fatalf("expect no error %v, %v", v, err)
- }
- }
- wg.Done()
- }()
- }
- b.ResetTimer()
-
- wg.Wait()
- })
- }
-}
-
-func BenchmarkCredentials_Get_Expire(b *testing.B) {
- p := &blockProvider{}
-
- expRates := []int{10000, 1000, 100}
- cases := []int{1, 10, 100, 500, 1000, 10000}
-
- for _, expRate := range expRates {
- for _, c := range cases {
- b.Run(fmt.Sprintf("%d-%d", expRate, c), func(b *testing.B) {
- creds := NewCredentials(p)
- var wg sync.WaitGroup
- wg.Add(c)
- for i := 0; i < c; i++ {
- go func(id int) {
- for j := 0; j < b.N; j++ {
- v, err := creds.Get()
- if err != nil {
- b.Fatalf("expect no error %v, %v", v, err)
- }
- // periodically expire creds to cause rwlock
- if id == 0 && j%expRate == 0 {
- creds.Expire()
- }
- }
- wg.Done()
- }(i)
- }
- b.ResetTimer()
-
- wg.Wait()
- })
- }
- }
-}
-
-type blockProvider struct {
- creds Value
- expired bool
- err error
-}
-
-func (s *blockProvider) Retrieve() (Value, error) {
- s.expired = false
- s.creds.ProviderName = "blockProvider"
- time.Sleep(time.Millisecond)
- return s.creds, s.err
-}
-func (s *blockProvider) IsExpired() bool {
- return s.expired
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials_test.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials_test.go
deleted file mode 100644
index 7b79ba985..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials_test.go
+++ /dev/null
@@ -1,73 +0,0 @@
-package credentials
-
-import (
- "testing"
-
- "github.com/aws/aws-sdk-go/aws/awserr"
- "github.com/stretchr/testify/assert"
-)
-
-type stubProvider struct {
- creds Value
- expired bool
- err error
-}
-
-func (s *stubProvider) Retrieve() (Value, error) {
- s.expired = false
- s.creds.ProviderName = "stubProvider"
- return s.creds, s.err
-}
-func (s *stubProvider) IsExpired() bool {
- return s.expired
-}
-
-func TestCredentialsGet(t *testing.T) {
- c := NewCredentials(&stubProvider{
- creds: Value{
- AccessKeyID: "AKID",
- SecretAccessKey: "SECRET",
- SessionToken: "",
- },
- expired: true,
- })
-
- creds, err := c.Get()
- assert.Nil(t, err, "Expected no error")
- assert.Equal(t, "AKID", creds.AccessKeyID, "Expect access key ID to match")
- assert.Equal(t, "SECRET", creds.SecretAccessKey, "Expect secret access key to match")
- assert.Empty(t, creds.SessionToken, "Expect session token to be empty")
-}
-
-func TestCredentialsGetWithError(t *testing.T) {
- c := NewCredentials(&stubProvider{err: awserr.New("provider error", "", nil), expired: true})
-
- _, err := c.Get()
- assert.Equal(t, "provider error", err.(awserr.Error).Code(), "Expected provider error")
-}
-
-func TestCredentialsExpire(t *testing.T) {
- stub := &stubProvider{}
- c := NewCredentials(stub)
-
- stub.expired = false
- assert.True(t, c.IsExpired(), "Expected to start out expired")
- c.Expire()
- assert.True(t, c.IsExpired(), "Expected to be expired")
-
- c.forceRefresh = false
- assert.False(t, c.IsExpired(), "Expected not to be expired")
-
- stub.expired = true
- assert.True(t, c.IsExpired(), "Expected to be expired")
-}
-
-func TestCredentialsGetWithProviderName(t *testing.T) {
- stub := &stubProvider{}
-
- c := NewCredentials(stub)
-
- creds, err := c.Get()
- assert.Nil(t, err, "Expected no error")
- assert.Equal(t, creds.ProviderName, "stubProvider", "Expected provider name to match")
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider_test.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider_test.go
deleted file mode 100644
index cccd4bffe..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider_test.go
+++ /dev/null
@@ -1,159 +0,0 @@
-package ec2rolecreds_test
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
- "time"
-
- "github.com/stretchr/testify/assert"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/awserr"
- "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds"
- "github.com/aws/aws-sdk-go/aws/ec2metadata"
- "github.com/aws/aws-sdk-go/awstesting/unit"
-)
-
-const credsRespTmpl = `{
- "Code": "Success",
- "Type": "AWS-HMAC",
- "AccessKeyId" : "accessKey",
- "SecretAccessKey" : "secret",
- "Token" : "token",
- "Expiration" : "%s",
- "LastUpdated" : "2009-11-23T0:00:00Z"
-}`
-
-const credsFailRespTmpl = `{
- "Code": "ErrorCode",
- "Message": "ErrorMsg",
- "LastUpdated": "2009-11-23T0:00:00Z"
-}`
-
-func initTestServer(expireOn string, failAssume bool) *httptest.Server {
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- if r.URL.Path == "/latest/meta-data/iam/security-credentials" {
- fmt.Fprintln(w, "RoleName")
- } else if r.URL.Path == "/latest/meta-data/iam/security-credentials/RoleName" {
- if failAssume {
- fmt.Fprintf(w, credsFailRespTmpl)
- } else {
- fmt.Fprintf(w, credsRespTmpl, expireOn)
- }
- } else {
- http.Error(w, "bad request", http.StatusBadRequest)
- }
- }))
-
- return server
-}
-
-func TestEC2RoleProvider(t *testing.T) {
- server := initTestServer("2014-12-16T01:51:37Z", false)
- defer server.Close()
-
- p := &ec2rolecreds.EC2RoleProvider{
- Client: ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}),
- }
-
- creds, err := p.Retrieve()
- assert.Nil(t, err, "Expect no error, %v", err)
-
- assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match")
- assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match")
- assert.Equal(t, "token", creds.SessionToken, "Expect session token to match")
-}
-
-func TestEC2RoleProviderFailAssume(t *testing.T) {
- server := initTestServer("2014-12-16T01:51:37Z", true)
- defer server.Close()
-
- p := &ec2rolecreds.EC2RoleProvider{
- Client: ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}),
- }
-
- creds, err := p.Retrieve()
- assert.Error(t, err, "Expect error")
-
- e := err.(awserr.Error)
- assert.Equal(t, "ErrorCode", e.Code())
- assert.Equal(t, "ErrorMsg", e.Message())
- assert.Nil(t, e.OrigErr())
-
- assert.Equal(t, "", creds.AccessKeyID, "Expect access key ID to match")
- assert.Equal(t, "", creds.SecretAccessKey, "Expect secret access key to match")
- assert.Equal(t, "", creds.SessionToken, "Expect session token to match")
-}
-
-func TestEC2RoleProviderIsExpired(t *testing.T) {
- server := initTestServer("2014-12-16T01:51:37Z", false)
- defer server.Close()
-
- p := &ec2rolecreds.EC2RoleProvider{
- Client: ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}),
- }
- p.CurrentTime = func() time.Time {
- return time.Date(2014, 12, 15, 21, 26, 0, 0, time.UTC)
- }
-
- assert.True(t, p.IsExpired(), "Expect creds to be expired before retrieve.")
-
- _, err := p.Retrieve()
- assert.Nil(t, err, "Expect no error, %v", err)
-
- assert.False(t, p.IsExpired(), "Expect creds to not be expired after retrieve.")
-
- p.CurrentTime = func() time.Time {
- return time.Date(3014, 12, 15, 21, 26, 0, 0, time.UTC)
- }
-
- assert.True(t, p.IsExpired(), "Expect creds to be expired.")
-}
-
-func TestEC2RoleProviderExpiryWindowIsExpired(t *testing.T) {
- server := initTestServer("2014-12-16T01:51:37Z", false)
- defer server.Close()
-
- p := &ec2rolecreds.EC2RoleProvider{
- Client: ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}),
- ExpiryWindow: time.Hour * 1,
- }
- p.CurrentTime = func() time.Time {
- return time.Date(2014, 12, 15, 0, 51, 37, 0, time.UTC)
- }
-
- assert.True(t, p.IsExpired(), "Expect creds to be expired before retrieve.")
-
- _, err := p.Retrieve()
- assert.Nil(t, err, "Expect no error, %v", err)
-
- assert.False(t, p.IsExpired(), "Expect creds to not be expired after retrieve.")
-
- p.CurrentTime = func() time.Time {
- return time.Date(2014, 12, 16, 0, 55, 37, 0, time.UTC)
- }
-
- assert.True(t, p.IsExpired(), "Expect creds to be expired.")
-}
-
-func BenchmarkEC3RoleProvider(b *testing.B) {
- server := initTestServer("2014-12-16T01:51:37Z", false)
- defer server.Close()
-
- p := &ec2rolecreds.EC2RoleProvider{
- Client: ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}),
- }
- _, err := p.Retrieve()
- if err != nil {
- b.Fatal(err)
- }
-
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- if _, err := p.Retrieve(); err != nil {
- b.Fatal(err)
- }
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/endpointcreds/provider_test.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/endpointcreds/provider_test.go
deleted file mode 100644
index ad057a355..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/endpointcreds/provider_test.go
+++ /dev/null
@@ -1,111 +0,0 @@
-package endpointcreds_test
-
-import (
- "encoding/json"
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
- "time"
-
- "github.com/aws/aws-sdk-go/aws/awserr"
- "github.com/aws/aws-sdk-go/aws/credentials/endpointcreds"
- "github.com/aws/aws-sdk-go/awstesting/unit"
- "github.com/stretchr/testify/assert"
-)
-
-func TestRetrieveRefreshableCredentials(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- assert.Equal(t, "/path/to/endpoint", r.URL.Path)
- assert.Equal(t, "application/json", r.Header.Get("Accept"))
- assert.Equal(t, "else", r.URL.Query().Get("something"))
-
- encoder := json.NewEncoder(w)
- err := encoder.Encode(map[string]interface{}{
- "AccessKeyID": "AKID",
- "SecretAccessKey": "SECRET",
- "Token": "TOKEN",
- "Expiration": time.Now().Add(1 * time.Hour),
- })
-
- if err != nil {
- fmt.Println("failed to write out creds", err)
- }
- }))
-
- client := endpointcreds.NewProviderClient(*unit.Session.Config,
- unit.Session.Handlers,
- server.URL+"/path/to/endpoint?something=else",
- )
- creds, err := client.Retrieve()
-
- assert.NoError(t, err)
-
- assert.Equal(t, "AKID", creds.AccessKeyID)
- assert.Equal(t, "SECRET", creds.SecretAccessKey)
- assert.Equal(t, "TOKEN", creds.SessionToken)
- assert.False(t, client.IsExpired())
-
- client.(*endpointcreds.Provider).CurrentTime = func() time.Time {
- return time.Now().Add(2 * time.Hour)
- }
-
- assert.True(t, client.IsExpired())
-}
-
-func TestRetrieveStaticCredentials(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- encoder := json.NewEncoder(w)
- err := encoder.Encode(map[string]interface{}{
- "AccessKeyID": "AKID",
- "SecretAccessKey": "SECRET",
- })
-
- if err != nil {
- fmt.Println("failed to write out creds", err)
- }
- }))
-
- client := endpointcreds.NewProviderClient(*unit.Session.Config, unit.Session.Handlers, server.URL)
- creds, err := client.Retrieve()
-
- assert.NoError(t, err)
-
- assert.Equal(t, "AKID", creds.AccessKeyID)
- assert.Equal(t, "SECRET", creds.SecretAccessKey)
- assert.Empty(t, creds.SessionToken)
- assert.False(t, client.IsExpired())
-}
-
-func TestFailedRetrieveCredentials(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.WriteHeader(400)
- encoder := json.NewEncoder(w)
- err := encoder.Encode(map[string]interface{}{
- "Code": "Error",
- "Message": "Message",
- })
-
- if err != nil {
- fmt.Println("failed to write error", err)
- }
- }))
-
- client := endpointcreds.NewProviderClient(*unit.Session.Config, unit.Session.Handlers, server.URL)
- creds, err := client.Retrieve()
-
- assert.Error(t, err)
- aerr := err.(awserr.Error)
-
- assert.Equal(t, "CredentialsEndpointError", aerr.Code())
- assert.Equal(t, "failed to load credentials", aerr.Message())
-
- aerr = aerr.OrigErr().(awserr.Error)
- assert.Equal(t, "Error", aerr.Code())
- assert.Equal(t, "Message", aerr.Message())
-
- assert.Empty(t, creds.AccessKeyID)
- assert.Empty(t, creds.SecretAccessKey)
- assert.Empty(t, creds.SessionToken)
- assert.True(t, client.IsExpired())
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider_test.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider_test.go
deleted file mode 100644
index 53f6ce256..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider_test.go
+++ /dev/null
@@ -1,70 +0,0 @@
-package credentials
-
-import (
- "github.com/stretchr/testify/assert"
- "os"
- "testing"
-)
-
-func TestEnvProviderRetrieve(t *testing.T) {
- os.Clearenv()
- os.Setenv("AWS_ACCESS_KEY_ID", "access")
- os.Setenv("AWS_SECRET_ACCESS_KEY", "secret")
- os.Setenv("AWS_SESSION_TOKEN", "token")
-
- e := EnvProvider{}
- creds, err := e.Retrieve()
- assert.Nil(t, err, "Expect no error")
-
- assert.Equal(t, "access", creds.AccessKeyID, "Expect access key ID to match")
- assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match")
- assert.Equal(t, "token", creds.SessionToken, "Expect session token to match")
-}
-
-func TestEnvProviderIsExpired(t *testing.T) {
- os.Clearenv()
- os.Setenv("AWS_ACCESS_KEY_ID", "access")
- os.Setenv("AWS_SECRET_ACCESS_KEY", "secret")
- os.Setenv("AWS_SESSION_TOKEN", "token")
-
- e := EnvProvider{}
-
- assert.True(t, e.IsExpired(), "Expect creds to be expired before retrieve.")
-
- _, err := e.Retrieve()
- assert.Nil(t, err, "Expect no error")
-
- assert.False(t, e.IsExpired(), "Expect creds to not be expired after retrieve.")
-}
-
-func TestEnvProviderNoAccessKeyID(t *testing.T) {
- os.Clearenv()
- os.Setenv("AWS_SECRET_ACCESS_KEY", "secret")
-
- e := EnvProvider{}
- creds, err := e.Retrieve()
- assert.Equal(t, ErrAccessKeyIDNotFound, err, "ErrAccessKeyIDNotFound expected, but was %#v error: %#v", creds, err)
-}
-
-func TestEnvProviderNoSecretAccessKey(t *testing.T) {
- os.Clearenv()
- os.Setenv("AWS_ACCESS_KEY_ID", "access")
-
- e := EnvProvider{}
- creds, err := e.Retrieve()
- assert.Equal(t, ErrSecretAccessKeyNotFound, err, "ErrSecretAccessKeyNotFound expected, but was %#v error: %#v", creds, err)
-}
-
-func TestEnvProviderAlternateNames(t *testing.T) {
- os.Clearenv()
- os.Setenv("AWS_ACCESS_KEY", "access")
- os.Setenv("AWS_SECRET_KEY", "secret")
-
- e := EnvProvider{}
- creds, err := e.Retrieve()
- assert.Nil(t, err, "Expect no error")
-
- assert.Equal(t, "access", creds.AccessKeyID, "Expected access key ID")
- assert.Equal(t, "secret", creds.SecretAccessKey, "Expected secret access key")
- assert.Empty(t, creds.SessionToken, "Expected no token")
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go
deleted file mode 100644
index 1eb45f263..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go
+++ /dev/null
@@ -1,136 +0,0 @@
-package credentials
-
-import (
- "os"
- "path/filepath"
- "testing"
-
- "github.com/aws/aws-sdk-go/internal/shareddefaults"
- "github.com/stretchr/testify/assert"
-)
-
-func TestSharedCredentialsProvider(t *testing.T) {
- os.Clearenv()
-
- p := SharedCredentialsProvider{Filename: "example.ini", Profile: ""}
- creds, err := p.Retrieve()
- assert.Nil(t, err, "Expect no error")
-
- assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match")
- assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match")
- assert.Equal(t, "token", creds.SessionToken, "Expect session token to match")
-}
-
-func TestSharedCredentialsProviderIsExpired(t *testing.T) {
- os.Clearenv()
-
- p := SharedCredentialsProvider{Filename: "example.ini", Profile: ""}
-
- assert.True(t, p.IsExpired(), "Expect creds to be expired before retrieve")
-
- _, err := p.Retrieve()
- assert.Nil(t, err, "Expect no error")
-
- assert.False(t, p.IsExpired(), "Expect creds to not be expired after retrieve")
-}
-
-func TestSharedCredentialsProviderWithAWS_SHARED_CREDENTIALS_FILE(t *testing.T) {
- os.Clearenv()
- os.Setenv("AWS_SHARED_CREDENTIALS_FILE", "example.ini")
- p := SharedCredentialsProvider{}
- creds, err := p.Retrieve()
-
- assert.Nil(t, err, "Expect no error")
-
- assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match")
- assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match")
- assert.Equal(t, "token", creds.SessionToken, "Expect session token to match")
-}
-
-func TestSharedCredentialsProviderWithAWS_SHARED_CREDENTIALS_FILEAbsPath(t *testing.T) {
- os.Clearenv()
- wd, err := os.Getwd()
- assert.NoError(t, err)
- os.Setenv("AWS_SHARED_CREDENTIALS_FILE", filepath.Join(wd, "example.ini"))
- p := SharedCredentialsProvider{}
- creds, err := p.Retrieve()
- assert.Nil(t, err, "Expect no error")
-
- assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match")
- assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match")
- assert.Equal(t, "token", creds.SessionToken, "Expect session token to match")
-}
-
-func TestSharedCredentialsProviderWithAWS_PROFILE(t *testing.T) {
- os.Clearenv()
- os.Setenv("AWS_PROFILE", "no_token")
-
- p := SharedCredentialsProvider{Filename: "example.ini", Profile: ""}
- creds, err := p.Retrieve()
- assert.Nil(t, err, "Expect no error")
-
- assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match")
- assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match")
- assert.Empty(t, creds.SessionToken, "Expect no token")
-}
-
-func TestSharedCredentialsProviderWithoutTokenFromProfile(t *testing.T) {
- os.Clearenv()
-
- p := SharedCredentialsProvider{Filename: "example.ini", Profile: "no_token"}
- creds, err := p.Retrieve()
- assert.Nil(t, err, "Expect no error")
-
- assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match")
- assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match")
- assert.Empty(t, creds.SessionToken, "Expect no token")
-}
-
-func TestSharedCredentialsProviderColonInCredFile(t *testing.T) {
- os.Clearenv()
-
- p := SharedCredentialsProvider{Filename: "example.ini", Profile: "with_colon"}
- creds, err := p.Retrieve()
- assert.Nil(t, err, "Expect no error")
-
- assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match")
- assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match")
- assert.Empty(t, creds.SessionToken, "Expect no token")
-}
-
-func TestSharedCredentialsProvider_DefaultFilename(t *testing.T) {
- os.Clearenv()
- os.Setenv("USERPROFILE", "profile_dir")
- os.Setenv("HOME", "home_dir")
-
- // default filename and profile
- p := SharedCredentialsProvider{}
-
- filename, err := p.filename()
-
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- if e, a := shareddefaults.SharedCredentialsFilename(), filename; e != a {
- t.Errorf("expect %q filename, got %q", e, a)
- }
-}
-
-func BenchmarkSharedCredentialsProvider(b *testing.B) {
- os.Clearenv()
-
- p := SharedCredentialsProvider{Filename: "example.ini", Profile: ""}
- _, err := p.Retrieve()
- if err != nil {
- b.Fatal(err)
- }
-
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- _, err := p.Retrieve()
- if err != nil {
- b.Fatal(err)
- }
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider_test.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider_test.go
deleted file mode 100644
index ea0123696..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider_test.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package credentials
-
-import (
- "github.com/stretchr/testify/assert"
- "testing"
-)
-
-func TestStaticProviderGet(t *testing.T) {
- s := StaticProvider{
- Value: Value{
- AccessKeyID: "AKID",
- SecretAccessKey: "SECRET",
- SessionToken: "",
- },
- }
-
- creds, err := s.Retrieve()
- assert.Nil(t, err, "Expect no error")
- assert.Equal(t, "AKID", creds.AccessKeyID, "Expect access key ID to match")
- assert.Equal(t, "SECRET", creds.SecretAccessKey, "Expect secret access key to match")
- assert.Empty(t, creds.SessionToken, "Expect no session token")
-}
-
-func TestStaticProviderIsExpired(t *testing.T) {
- s := StaticProvider{
- Value: Value{
- AccessKeyID: "AKID",
- SecretAccessKey: "SECRET",
- SessionToken: "",
- },
- }
-
- assert.False(t, s.IsExpired(), "Expect static credentials to never expire")
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider_test.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider_test.go
deleted file mode 100644
index 4c0212a01..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider_test.go
+++ /dev/null
@@ -1,150 +0,0 @@
-package stscreds
-
-import (
- "fmt"
- "testing"
- "time"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/service/sts"
- "github.com/stretchr/testify/assert"
-)
-
-type stubSTS struct {
- TestInput func(*sts.AssumeRoleInput)
-}
-
-func (s *stubSTS) AssumeRole(input *sts.AssumeRoleInput) (*sts.AssumeRoleOutput, error) {
- if s.TestInput != nil {
- s.TestInput(input)
- }
- expiry := time.Now().Add(60 * time.Minute)
- return &sts.AssumeRoleOutput{
- Credentials: &sts.Credentials{
- // Just reflect the role arn to the provider.
- AccessKeyId: input.RoleArn,
- SecretAccessKey: aws.String("assumedSecretAccessKey"),
- SessionToken: aws.String("assumedSessionToken"),
- Expiration: &expiry,
- },
- }, nil
-}
-
-func TestAssumeRoleProvider(t *testing.T) {
- stub := &stubSTS{}
- p := &AssumeRoleProvider{
- Client: stub,
- RoleARN: "roleARN",
- }
-
- creds, err := p.Retrieve()
- assert.Nil(t, err, "Expect no error")
-
- assert.Equal(t, "roleARN", creds.AccessKeyID, "Expect access key ID to be reflected role ARN")
- assert.Equal(t, "assumedSecretAccessKey", creds.SecretAccessKey, "Expect secret access key to match")
- assert.Equal(t, "assumedSessionToken", creds.SessionToken, "Expect session token to match")
-}
-
-func TestAssumeRoleProvider_WithTokenCode(t *testing.T) {
- stub := &stubSTS{
- TestInput: func(in *sts.AssumeRoleInput) {
- assert.Equal(t, "0123456789", *in.SerialNumber)
- assert.Equal(t, "code", *in.TokenCode)
- },
- }
- p := &AssumeRoleProvider{
- Client: stub,
- RoleARN: "roleARN",
- SerialNumber: aws.String("0123456789"),
- TokenCode: aws.String("code"),
- }
-
- creds, err := p.Retrieve()
- assert.Nil(t, err, "Expect no error")
-
- assert.Equal(t, "roleARN", creds.AccessKeyID, "Expect access key ID to be reflected role ARN")
- assert.Equal(t, "assumedSecretAccessKey", creds.SecretAccessKey, "Expect secret access key to match")
- assert.Equal(t, "assumedSessionToken", creds.SessionToken, "Expect session token to match")
-}
-
-func TestAssumeRoleProvider_WithTokenProvider(t *testing.T) {
- stub := &stubSTS{
- TestInput: func(in *sts.AssumeRoleInput) {
- assert.Equal(t, "0123456789", *in.SerialNumber)
- assert.Equal(t, "code", *in.TokenCode)
- },
- }
- p := &AssumeRoleProvider{
- Client: stub,
- RoleARN: "roleARN",
- SerialNumber: aws.String("0123456789"),
- TokenProvider: func() (string, error) {
- return "code", nil
- },
- }
-
- creds, err := p.Retrieve()
- assert.Nil(t, err, "Expect no error")
-
- assert.Equal(t, "roleARN", creds.AccessKeyID, "Expect access key ID to be reflected role ARN")
- assert.Equal(t, "assumedSecretAccessKey", creds.SecretAccessKey, "Expect secret access key to match")
- assert.Equal(t, "assumedSessionToken", creds.SessionToken, "Expect session token to match")
-}
-
-func TestAssumeRoleProvider_WithTokenProviderError(t *testing.T) {
- stub := &stubSTS{
- TestInput: func(in *sts.AssumeRoleInput) {
- assert.Fail(t, "API request should not of been called")
- },
- }
- p := &AssumeRoleProvider{
- Client: stub,
- RoleARN: "roleARN",
- SerialNumber: aws.String("0123456789"),
- TokenProvider: func() (string, error) {
- return "", fmt.Errorf("error occurred")
- },
- }
-
- creds, err := p.Retrieve()
- assert.Error(t, err)
-
- assert.Empty(t, creds.AccessKeyID)
- assert.Empty(t, creds.SecretAccessKey)
- assert.Empty(t, creds.SessionToken)
-}
-
-func TestAssumeRoleProvider_MFAWithNoToken(t *testing.T) {
- stub := &stubSTS{
- TestInput: func(in *sts.AssumeRoleInput) {
- assert.Fail(t, "API request should not of been called")
- },
- }
- p := &AssumeRoleProvider{
- Client: stub,
- RoleARN: "roleARN",
- SerialNumber: aws.String("0123456789"),
- }
-
- creds, err := p.Retrieve()
- assert.Error(t, err)
-
- assert.Empty(t, creds.AccessKeyID)
- assert.Empty(t, creds.SecretAccessKey)
- assert.Empty(t, creds.SessionToken)
-}
-
-func BenchmarkAssumeRoleProvider(b *testing.B) {
- stub := &stubSTS{}
- p := &AssumeRoleProvider{
- Client: stub,
- RoleARN: "roleARN",
- }
-
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- if _, err := p.Retrieve(); err != nil {
- b.Fatal(err)
- }
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/csm/enable_test.go b/vendor/github.com/aws/aws-sdk-go/aws/csm/enable_test.go
deleted file mode 100644
index a7504d3f9..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/csm/enable_test.go
+++ /dev/null
@@ -1,74 +0,0 @@
-package csm
-
-import (
- "encoding/json"
- "fmt"
- "net"
- "testing"
-)
-
-func startUDPServer(done chan struct{}, fn func([]byte)) (string, error) {
- addr, err := net.ResolveUDPAddr("udp", "127.0.0.1:0")
- if err != nil {
- return "", err
- }
-
- conn, err := net.ListenUDP("udp", addr)
- if err != nil {
- return "", err
- }
-
- buf := make([]byte, 1024)
- go func() {
- defer conn.Close()
-
- for {
- select {
- case <-done:
- return
- default:
- }
-
- n, _, err := conn.ReadFromUDP(buf)
- fn(buf[:n])
-
- if err != nil {
- panic(err)
- }
- }
- }()
-
- return conn.LocalAddr().String(), nil
-}
-
-func TestDifferentParams(t *testing.T) {
- defer func() {
- if r := recover(); r == nil {
- t.Errorf("expected panic with different parameters")
- }
- }()
- Start("clientID2", ":0")
-}
-
-var MetricsCh = make(chan map[string]interface{}, 1)
-var Done = make(chan struct{})
-
-func init() {
- url, err := startUDPServer(Done, func(b []byte) {
- m := map[string]interface{}{}
- if err := json.Unmarshal(b, &m); err != nil {
- panic(fmt.Sprintf("expected no error, but received %v", err))
- }
-
- MetricsCh <- m
- })
-
- if err != nil {
- panic(err)
- }
-
- _, err = Start("clientID", url)
- if err != nil {
- panic(err)
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/csm/example_test.go b/vendor/github.com/aws/aws-sdk-go/aws/csm/example_test.go
deleted file mode 100644
index 3da43dccd..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/csm/example_test.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package csm_test
-
-import (
- "fmt"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/csm"
- "github.com/aws/aws-sdk-go/aws/session"
- "github.com/aws/aws-sdk-go/service/s3"
-)
-
-func ExampleStart() {
- r, err := csm.Start("clientID", ":31000")
- if err != nil {
- panic(fmt.Errorf("failed starting CSM: %v", err))
- }
-
- sess, err := session.NewSession(&aws.Config{})
- if err != nil {
- panic(fmt.Errorf("failed loading session: %v", err))
- }
-
- r.InjectHandlers(&sess.Handlers)
-
- client := s3.New(sess)
- client.GetObject(&s3.GetObjectInput{
- Bucket: aws.String("bucket"),
- Key: aws.String("key"),
- })
-
- // Pauses monitoring
- r.Pause()
- client.GetObject(&s3.GetObjectInput{
- Bucket: aws.String("bucket"),
- Key: aws.String("key"),
- })
-
- // Resume monitoring
- r.Continue()
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/csm/metric_chan_test.go b/vendor/github.com/aws/aws-sdk-go/aws/csm/metric_chan_test.go
deleted file mode 100644
index 81bdb25c8..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/csm/metric_chan_test.go
+++ /dev/null
@@ -1,72 +0,0 @@
-package csm
-
-import (
- "testing"
-)
-
-func TestMetricChanPush(t *testing.T) {
- ch := newMetricChan(5)
- defer close(ch.ch)
-
- pushed := ch.Push(metric{})
- if !pushed {
- t.Errorf("expected metrics to be pushed")
- }
-
- if e, a := 1, len(ch.ch); e != a {
- t.Errorf("expected %d, but received %d", e, a)
- }
-}
-
-func TestMetricChanPauseContinue(t *testing.T) {
- ch := newMetricChan(5)
- defer close(ch.ch)
- ch.Pause()
-
- if !ch.IsPaused() {
- t.Errorf("expected to be paused, but did not pause properly")
- }
-
- ch.Continue()
- if ch.IsPaused() {
- t.Errorf("expected to be not paused, but did not continue properly")
- }
-
- pushed := ch.Push(metric{})
- if !pushed {
- t.Errorf("expected metrics to be pushed")
- }
-
- if e, a := 1, len(ch.ch); e != a {
- t.Errorf("expected %d, but received %d", e, a)
- }
-}
-
-func TestMetricChanPushWhenPaused(t *testing.T) {
- ch := newMetricChan(5)
- defer close(ch.ch)
- ch.Pause()
-
- pushed := ch.Push(metric{})
- if pushed {
- t.Errorf("expected metrics to not be pushed")
- }
-
- if e, a := 0, len(ch.ch); e != a {
- t.Errorf("expected %d, but received %d", e, a)
- }
-}
-
-func TestMetricChanNonBlocking(t *testing.T) {
- ch := newMetricChan(0)
- defer close(ch.ch)
-
- pushed := ch.Push(metric{})
- if pushed {
- t.Errorf("expected metrics to be not pushed")
- }
-
- if e, a := 0, len(ch.ch); e != a {
- t.Errorf("expected %d, but received %d", e, a)
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/csm/reporter_test.go b/vendor/github.com/aws/aws-sdk-go/aws/csm/reporter_test.go
deleted file mode 100644
index 4a1001983..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/csm/reporter_test.go
+++ /dev/null
@@ -1,249 +0,0 @@
-package csm_test
-
-import (
- "fmt"
- "net"
- "net/http"
- "net/http/httptest"
- "strings"
- "testing"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/client"
- "github.com/aws/aws-sdk-go/aws/client/metadata"
- "github.com/aws/aws-sdk-go/aws/csm"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/aws/session"
- "github.com/aws/aws-sdk-go/aws/signer/v4"
- "github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
-)
-
-func startUDPServer(done chan struct{}, fn func([]byte)) (string, error) {
- addr, err := net.ResolveUDPAddr("udp", "127.0.0.1:0")
- if err != nil {
- return "", err
- }
-
- conn, err := net.ListenUDP("udp", addr)
- if err != nil {
- return "", err
- }
-
- buf := make([]byte, 1024)
- i := 0
- go func() {
- defer conn.Close()
- for {
- i++
- select {
- case <-done:
- return
- default:
- }
-
- n, _, err := conn.ReadFromUDP(buf)
- fn(buf[:n])
-
- if err != nil {
- panic(err)
- }
- }
- }()
-
- return conn.LocalAddr().String(), nil
-}
-
-func TestReportingMetrics(t *testing.T) {
- reporter := csm.Get()
- if reporter == nil {
- t.Errorf("expected non-nil reporter")
- }
-
- sess := session.New()
- sess.Handlers.Clear()
- reporter.InjectHandlers(&sess.Handlers)
-
- md := metadata.ClientInfo{}
- op := &request.Operation{}
- r := request.New(*sess.Config, md, sess.Handlers, client.DefaultRetryer{NumMaxRetries: 0}, op, nil, nil)
- sess.Handlers.Complete.Run(r)
-
- foundAttempt := false
- foundCall := false
-
- expectedMetrics := 2
-
- for i := 0; i < expectedMetrics; i++ {
- m := <-csm.MetricsCh
- for k, v := range m {
- switch k {
- case "Type":
- a := v.(string)
- foundCall = foundCall || a == "ApiCall"
- foundAttempt = foundAttempt || a == "ApiCallAttempt"
-
- if prefix := "ApiCall"; !strings.HasPrefix(a, prefix) {
- t.Errorf("expected 'APICall' prefix, but received %q", a)
- }
- }
- }
- }
-
- if !foundAttempt {
- t.Errorf("expected attempt event to have occurred")
- }
-
- if !foundCall {
- t.Errorf("expected call event to have occurred")
- }
-}
-
-type mockService struct {
- *client.Client
-}
-
-type input struct{}
-type output struct{}
-
-func (s *mockService) Request(i input) *request.Request {
- op := &request.Operation{
- Name: "foo",
- HTTPMethod: "POST",
- HTTPPath: "/",
- }
-
- o := output{}
- req := s.NewRequest(op, &i, &o)
- return req
-}
-
-func BenchmarkWithCSM(b *testing.B) {
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.Write([]byte(fmt.Sprintf("{}")))
- }))
-
- cfg := aws.Config{
- Endpoint: aws.String(server.URL),
- }
-
- sess := session.New(&cfg)
- r := csm.Get()
-
- r.InjectHandlers(&sess.Handlers)
-
- c := sess.ClientConfig("id", &cfg)
-
- svc := mockService{
- client.New(
- *c.Config,
- metadata.ClientInfo{
- ServiceName: "service",
- ServiceID: "id",
- SigningName: "signing",
- SigningRegion: "region",
- Endpoint: server.URL,
- APIVersion: "0",
- JSONVersion: "1.1",
- TargetPrefix: "prefix",
- },
- c.Handlers,
- ),
- }
-
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
-
- for i := 0; i < b.N; i++ {
- req := svc.Request(input{})
- req.Send()
- }
-}
-
-func BenchmarkWithCSMNoUDPConnection(b *testing.B) {
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.Write([]byte(fmt.Sprintf("{}")))
- }))
-
- cfg := aws.Config{
- Endpoint: aws.String(server.URL),
- }
-
- sess := session.New(&cfg)
- r := csm.Get()
- r.Pause()
- r.InjectHandlers(&sess.Handlers)
- defer r.Pause()
-
- c := sess.ClientConfig("id", &cfg)
-
- svc := mockService{
- client.New(
- *c.Config,
- metadata.ClientInfo{
- ServiceName: "service",
- ServiceID: "id",
- SigningName: "signing",
- SigningRegion: "region",
- Endpoint: server.URL,
- APIVersion: "0",
- JSONVersion: "1.1",
- TargetPrefix: "prefix",
- },
- c.Handlers,
- ),
- }
-
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
-
- for i := 0; i < b.N; i++ {
- req := svc.Request(input{})
- req.Send()
- }
-}
-
-func BenchmarkWithoutCSM(b *testing.B) {
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.Write([]byte(fmt.Sprintf("{}")))
- }))
-
- cfg := aws.Config{
- Endpoint: aws.String(server.URL),
- }
- sess := session.New(&cfg)
- c := sess.ClientConfig("id", &cfg)
-
- svc := mockService{
- client.New(
- *c.Config,
- metadata.ClientInfo{
- ServiceName: "service",
- ServiceID: "id",
- SigningName: "signing",
- SigningRegion: "region",
- Endpoint: server.URL,
- APIVersion: "0",
- JSONVersion: "1.1",
- TargetPrefix: "prefix",
- },
- c.Handlers,
- ),
- }
-
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
-
- for i := 0; i < b.N; i++ {
- req := svc.Request(input{})
- req.Send()
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults_test.go b/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults_test.go
deleted file mode 100644
index cb0646838..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults_test.go
+++ /dev/null
@@ -1,116 +0,0 @@
-package defaults
-
-import (
- "fmt"
- "os"
- "testing"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/awserr"
- "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds"
- "github.com/aws/aws-sdk-go/aws/credentials/endpointcreds"
- "github.com/aws/aws-sdk-go/aws/request"
-)
-
-func TestHTTPCredProvider(t *testing.T) {
- origFn := lookupHostFn
- defer func() { lookupHostFn = origFn }()
-
- lookupHostFn = func(host string) ([]string, error) {
- m := map[string]struct {
- Addrs []string
- Err error
- }{
- "localhost": {Addrs: []string{"::1", "127.0.0.1"}},
- "actuallylocal": {Addrs: []string{"127.0.0.2"}},
- "notlocal": {Addrs: []string{"::1", "127.0.0.1", "192.168.1.10"}},
- "www.example.com": {Addrs: []string{"10.10.10.10"}},
- }
-
- h, ok := m[host]
- if !ok {
- t.Fatalf("unknown host in test, %v", host)
- return nil, fmt.Errorf("unknown host")
- }
-
- return h.Addrs, h.Err
- }
-
- cases := []struct {
- Host string
- Fail bool
- }{
- {"localhost", false},
- {"actuallylocal", false},
- {"127.0.0.1", false},
- {"127.1.1.1", false},
- {"[::1]", false},
- {"www.example.com", true},
- {"169.254.170.2", true},
- }
-
- defer os.Clearenv()
-
- for i, c := range cases {
- u := fmt.Sprintf("http://%s/abc/123", c.Host)
- os.Setenv(httpProviderEnvVar, u)
-
- provider := RemoteCredProvider(aws.Config{}, request.Handlers{})
- if provider == nil {
- t.Fatalf("%d, expect provider not to be nil, but was", i)
- }
-
- if c.Fail {
- creds, err := provider.Retrieve()
- if err == nil {
- t.Fatalf("%d, expect error but got none", i)
- } else {
- aerr := err.(awserr.Error)
- if e, a := "CredentialsEndpointError", aerr.Code(); e != a {
- t.Errorf("%d, expect %s error code, got %s", i, e, a)
- }
- }
- if e, a := endpointcreds.ProviderName, creds.ProviderName; e != a {
- t.Errorf("%d, expect %s provider name got %s", i, e, a)
- }
- } else {
- httpProvider := provider.(*endpointcreds.Provider)
- if e, a := u, httpProvider.Client.Endpoint; e != a {
- t.Errorf("%d, expect %q endpoint, got %q", i, e, a)
- }
- }
- }
-}
-
-func TestECSCredProvider(t *testing.T) {
- defer os.Clearenv()
- os.Setenv(ecsCredsProviderEnvVar, "/abc/123")
-
- provider := RemoteCredProvider(aws.Config{}, request.Handlers{})
- if provider == nil {
- t.Fatalf("expect provider not to be nil, but was")
- }
-
- httpProvider := provider.(*endpointcreds.Provider)
- if httpProvider == nil {
- t.Fatalf("expect provider not to be nil, but was")
- }
- if e, a := "http://169.254.170.2/abc/123", httpProvider.Client.Endpoint; e != a {
- t.Errorf("expect %q endpoint, got %q", e, a)
- }
-}
-
-func TestDefaultEC2RoleProvider(t *testing.T) {
- provider := RemoteCredProvider(aws.Config{}, request.Handlers{})
- if provider == nil {
- t.Fatalf("expect provider not to be nil, but was")
- }
-
- ec2Provider := provider.(*ec2rolecreds.EC2RoleProvider)
- if ec2Provider == nil {
- t.Fatalf("expect provider not to be nil, but was")
- }
- if e, a := "http://169.254.169.254/latest", ec2Provider.Client.Endpoint; e != a {
- t.Errorf("expect %q endpoint, got %q", e, a)
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api_test.go b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api_test.go
deleted file mode 100644
index 7dde1fb36..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api_test.go
+++ /dev/null
@@ -1,289 +0,0 @@
-package ec2metadata_test
-
-import (
- "bytes"
- "fmt"
- "io"
- "io/ioutil"
- "net/http"
- "net/http/httptest"
- "path"
- "strings"
- "testing"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/awserr"
- "github.com/aws/aws-sdk-go/aws/ec2metadata"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/awstesting/unit"
-)
-
-const instanceIdentityDocument = `{
- "devpayProductCodes" : null,
- "availabilityZone" : "us-east-1d",
- "privateIp" : "10.158.112.84",
- "version" : "2010-08-31",
- "region" : "us-east-1",
- "instanceId" : "i-1234567890abcdef0",
- "billingProducts" : null,
- "instanceType" : "t1.micro",
- "accountId" : "123456789012",
- "pendingTime" : "2015-11-19T16:32:11Z",
- "imageId" : "ami-5fb8c835",
- "kernelId" : "aki-919dcaf8",
- "ramdiskId" : null,
- "architecture" : "x86_64"
-}`
-
-const validIamInfo = `{
- "Code" : "Success",
- "LastUpdated" : "2016-03-17T12:27:32Z",
- "InstanceProfileArn" : "arn:aws:iam::123456789012:instance-profile/my-instance-profile",
- "InstanceProfileId" : "AIPAABCDEFGHIJKLMN123"
-}`
-
-const unsuccessfulIamInfo = `{
- "Code" : "Failed",
- "LastUpdated" : "2016-03-17T12:27:32Z",
- "InstanceProfileArn" : "arn:aws:iam::123456789012:instance-profile/my-instance-profile",
- "InstanceProfileId" : "AIPAABCDEFGHIJKLMN123"
-}`
-
-func initTestServer(path string, resp string) *httptest.Server {
- return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- if r.RequestURI != path {
- http.Error(w, "not found", http.StatusNotFound)
- return
- }
-
- w.Write([]byte(resp))
- }))
-}
-
-func TestEndpoint(t *testing.T) {
- c := ec2metadata.New(unit.Session)
- op := &request.Operation{
- Name: "GetMetadata",
- HTTPMethod: "GET",
- HTTPPath: path.Join("/", "meta-data", "testpath"),
- }
-
- req := c.NewRequest(op, nil, nil)
- if e, a := "http://169.254.169.254/latest", req.ClientInfo.Endpoint; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "http://169.254.169.254/latest/meta-data/testpath", req.HTTPRequest.URL.String(); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-func TestGetMetadata(t *testing.T) {
- server := initTestServer(
- "/latest/meta-data/some/path",
- "success", // real response includes suffix
- )
- defer server.Close()
- c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")})
-
- resp, err := c.GetMetadata("some/path")
-
- if err != nil {
- t.Errorf("expect no error, got %v", err)
- }
- if e, a := "success", resp; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-func TestGetUserData(t *testing.T) {
- server := initTestServer(
- "/latest/user-data",
- "success", // real response includes suffix
- )
- defer server.Close()
- c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")})
-
- resp, err := c.GetUserData()
-
- if err != nil {
- t.Errorf("expect no error, got %v", err)
- }
- if e, a := "success", resp; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-func TestGetUserData_Error(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- reader := strings.NewReader(`<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <title>404 - Not Found</title>
- </head>
- <body>
- <h1>404 - Not Found</h1>
- </body>
-</html>`)
- w.Header().Set("Content-Type", "text/html")
- w.Header().Set("Content-Length", fmt.Sprintf("%d", reader.Len()))
- w.WriteHeader(http.StatusNotFound)
- io.Copy(w, reader)
- }))
-
- defer server.Close()
- c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")})
-
- resp, err := c.GetUserData()
- if err == nil {
- t.Errorf("expect error")
- }
- if len(resp) != 0 {
- t.Errorf("expect empty, got %v", resp)
- }
-
- aerr := err.(awserr.Error)
- if e, a := "NotFoundError", aerr.Code(); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-func TestGetRegion(t *testing.T) {
- server := initTestServer(
- "/latest/meta-data/placement/availability-zone",
- "us-west-2a", // real response includes suffix
- )
- defer server.Close()
- c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")})
-
- region, err := c.Region()
-
- if err != nil {
- t.Errorf("expect no error, got %v", err)
- }
- if e, a := "us-west-2", region; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-func TestMetadataAvailable(t *testing.T) {
- server := initTestServer(
- "/latest/meta-data/instance-id",
- "instance-id",
- )
- defer server.Close()
- c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")})
-
- if !c.Available() {
- t.Errorf("expect available")
- }
-}
-
-func TestMetadataIAMInfo_success(t *testing.T) {
- server := initTestServer(
- "/latest/meta-data/iam/info",
- validIamInfo,
- )
- defer server.Close()
- c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")})
-
- iamInfo, err := c.IAMInfo()
- if err != nil {
- t.Errorf("expect no error, got %v", err)
- }
- if e, a := "Success", iamInfo.Code; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "arn:aws:iam::123456789012:instance-profile/my-instance-profile", iamInfo.InstanceProfileArn; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "AIPAABCDEFGHIJKLMN123", iamInfo.InstanceProfileID; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-func TestMetadataIAMInfo_failure(t *testing.T) {
- server := initTestServer(
- "/latest/meta-data/iam/info",
- unsuccessfulIamInfo,
- )
- defer server.Close()
- c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")})
-
- iamInfo, err := c.IAMInfo()
- if err == nil {
- t.Errorf("expect error")
- }
- if e, a := "", iamInfo.Code; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "", iamInfo.InstanceProfileArn; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "", iamInfo.InstanceProfileID; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-func TestMetadataNotAvailable(t *testing.T) {
- c := ec2metadata.New(unit.Session)
- c.Handlers.Send.Clear()
- c.Handlers.Send.PushBack(func(r *request.Request) {
- r.HTTPResponse = &http.Response{
- StatusCode: int(0),
- Status: http.StatusText(int(0)),
- Body: ioutil.NopCloser(bytes.NewReader([]byte{})),
- }
- r.Error = awserr.New("RequestError", "send request failed", nil)
- r.Retryable = aws.Bool(true) // network errors are retryable
- })
-
- if c.Available() {
- t.Errorf("expect not available")
- }
-}
-
-func TestMetadataErrorResponse(t *testing.T) {
- c := ec2metadata.New(unit.Session)
- c.Handlers.Send.Clear()
- c.Handlers.Send.PushBack(func(r *request.Request) {
- r.HTTPResponse = &http.Response{
- StatusCode: http.StatusBadRequest,
- Status: http.StatusText(http.StatusBadRequest),
- Body: ioutil.NopCloser(strings.NewReader("error message text")),
- }
- r.Retryable = aws.Bool(false) // network errors are retryable
- })
-
- data, err := c.GetMetadata("uri/path")
- if len(data) != 0 {
- t.Errorf("expect empty, got %v", data)
- }
- if e, a := "error message text", err.Error(); !strings.Contains(a, e) {
- t.Errorf("expect %v to be in %v", e, a)
- }
-}
-
-func TestEC2RoleProviderInstanceIdentity(t *testing.T) {
- server := initTestServer(
- "/latest/dynamic/instance-identity/document",
- instanceIdentityDocument,
- )
- defer server.Close()
- c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")})
-
- doc, err := c.GetInstanceIdentityDocument()
- if err != nil {
- t.Errorf("expect no error, got %v", err)
- }
- if e, a := doc.AccountID, "123456789012"; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := doc.AvailabilityZone, "us-east-1d"; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := doc.Region, "us-east-1"; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service_test.go b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service_test.go
deleted file mode 100644
index 6902e0b1e..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service_test.go
+++ /dev/null
@@ -1,120 +0,0 @@
-package ec2metadata_test
-
-import (
- "net/http"
- "net/http/httptest"
- "os"
- "strings"
- "sync"
- "testing"
- "time"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/awserr"
- "github.com/aws/aws-sdk-go/aws/ec2metadata"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/awstesting"
- "github.com/aws/aws-sdk-go/awstesting/unit"
-)
-
-func TestClientOverrideDefaultHTTPClientTimeout(t *testing.T) {
- svc := ec2metadata.New(unit.Session)
-
- if e, a := http.DefaultClient, svc.Config.HTTPClient; e == a {
- t.Errorf("expect %v, not to equal %v", e, a)
- }
-
- if e, a := 5*time.Second, svc.Config.HTTPClient.Timeout; e != a {
- t.Errorf("expect %v to be %v", e, a)
- }
-}
-
-func TestClientNotOverrideDefaultHTTPClientTimeout(t *testing.T) {
- http.DefaultClient.Transport = &http.Transport{}
- defer func() {
- http.DefaultClient.Transport = nil
- }()
-
- svc := ec2metadata.New(unit.Session)
-
- if e, a := http.DefaultClient, svc.Config.HTTPClient; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
- tr := svc.Config.HTTPClient.Transport.(*http.Transport)
- if tr == nil {
- t.Fatalf("expect transport not to be nil")
- }
- if tr.Dial != nil {
- t.Errorf("expect dial to be nil, was not")
- }
-}
-
-func TestClientDisableOverrideDefaultHTTPClientTimeout(t *testing.T) {
- svc := ec2metadata.New(unit.Session, aws.NewConfig().WithEC2MetadataDisableTimeoutOverride(true))
-
- if e, a := http.DefaultClient, svc.Config.HTTPClient; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-func TestClientOverrideDefaultHTTPClientTimeoutRace(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.Write([]byte("us-east-1a"))
- }))
-
- cfg := aws.NewConfig().WithEndpoint(server.URL)
- runEC2MetadataClients(t, cfg, 100)
-}
-
-func TestClientOverrideDefaultHTTPClientTimeoutRaceWithTransport(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.Write([]byte("us-east-1a"))
- }))
-
- cfg := aws.NewConfig().WithEndpoint(server.URL).WithHTTPClient(&http.Client{
- Transport: http.DefaultTransport,
- })
-
- runEC2MetadataClients(t, cfg, 100)
-}
-
-func TestClientDisableIMDS(t *testing.T) {
- env := awstesting.StashEnv()
- defer awstesting.PopEnv(env)
-
- os.Setenv("AWS_EC2_METADATA_DISABLED", "true")
-
- svc := ec2metadata.New(unit.Session)
- resp, err := svc.Region()
- if err == nil {
- t.Fatalf("expect error, got none")
- }
- if len(resp) != 0 {
- t.Errorf("expect no response, got %v", resp)
- }
-
- aerr := err.(awserr.Error)
- if e, a := request.CanceledErrorCode, aerr.Code(); e != a {
- t.Errorf("expect %v error code, got %v", e, a)
- }
- if e, a := "AWS_EC2_METADATA_DISABLED", aerr.Message(); !strings.Contains(a, e) {
- t.Errorf("expect %v in error message, got %v", e, a)
- }
-}
-
-func runEC2MetadataClients(t *testing.T, cfg *aws.Config, atOnce int) {
- var wg sync.WaitGroup
- wg.Add(atOnce)
- for i := 0; i < atOnce; i++ {
- go func() {
- svc := ec2metadata.New(unit.Session, cfg)
- _, err := svc.Region()
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
- wg.Done()
- }()
- }
- wg.Wait()
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/decode_test.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/decode_test.go
deleted file mode 100644
index 319390721..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/decode_test.go
+++ /dev/null
@@ -1,117 +0,0 @@
-package endpoints
-
-import (
- "strings"
- "testing"
-)
-
-func TestDecodeEndpoints_V3(t *testing.T) {
- const v3Doc = `
-{
- "version": 3,
- "partitions": [
- {
- "defaults": {
- "hostname": "{service}.{region}.{dnsSuffix}",
- "protocols": [
- "https"
- ],
- "signatureVersions": [
- "v4"
- ]
- },
- "dnsSuffix": "amazonaws.com",
- "partition": "aws",
- "partitionName": "AWS Standard",
- "regionRegex": "^(us|eu|ap|sa|ca)\\-\\w+\\-\\d+$",
- "regions": {
- "ap-northeast-1": {
- "description": "Asia Pacific (Tokyo)"
- }
- },
- "services": {
- "acm": {
- "endpoints": {
- "ap-northeast-1": {}
- }
- },
- "s3": {
- "endpoints": {
- "ap-northeast-1": {}
- }
- }
- }
- }
- ]
-}`
-
- resolver, err := DecodeModel(strings.NewReader(v3Doc))
- if err != nil {
- t.Fatalf("expected no error, got %v", err)
- }
-
- endpoint, err := resolver.EndpointFor("acm", "ap-northeast-1")
- if err != nil {
- t.Fatalf("failed to resolve endpoint, %v", err)
- }
-
- if a, e := endpoint.URL, "https://acm.ap-northeast-1.amazonaws.com"; a != e {
- t.Errorf("expected %q URL got %q", e, a)
- }
-
- p := resolver.(partitions)[0]
-
- s3Defaults := p.Services["s3"].Defaults
- if a, e := s3Defaults.HasDualStack, boxedTrue; a != e {
- t.Errorf("expect s3 service to have dualstack enabled")
- }
- if a, e := s3Defaults.DualStackHostname, "{service}.dualstack.{region}.{dnsSuffix}"; a != e {
- t.Errorf("expect s3 dualstack host pattern to be %q, got %q", e, a)
- }
-
- ec2metaEndpoint := p.Services["ec2metadata"].Endpoints["aws-global"]
- if a, e := ec2metaEndpoint.Hostname, "169.254.169.254/latest"; a != e {
- t.Errorf("expect ec2metadata host to be %q, got %q", e, a)
- }
-}
-
-func TestDecodeEndpoints_NoPartitions(t *testing.T) {
- const doc = `{ "version": 3 }`
-
- resolver, err := DecodeModel(strings.NewReader(doc))
- if err == nil {
- t.Fatalf("expected error")
- }
-
- if resolver != nil {
- t.Errorf("expect resolver to be nil")
- }
-}
-
-func TestDecodeEndpoints_UnsupportedVersion(t *testing.T) {
- const doc = `{ "version": 2 }`
-
- resolver, err := DecodeModel(strings.NewReader(doc))
- if err == nil {
- t.Fatalf("expected error decoding model")
- }
-
- if resolver != nil {
- t.Errorf("expect resolver to be nil")
- }
-}
-
-func TestDecodeModelOptionsSet(t *testing.T) {
- var actual DecodeModelOptions
- actual.Set(func(o *DecodeModelOptions) {
- o.SkipCustomizations = true
- })
-
- expect := DecodeModelOptions{
- SkipCustomizations: true,
- }
-
- if actual != expect {
- t.Errorf("expect %v options got %v", expect, actual)
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints_test.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints_test.go
deleted file mode 100644
index de0e53026..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints_test.go
+++ /dev/null
@@ -1,342 +0,0 @@
-package endpoints
-
-import "testing"
-
-func TestEnumDefaultPartitions(t *testing.T) {
- resolver := DefaultResolver()
- enum, ok := resolver.(EnumPartitions)
-
- if ok != true {
- t.Fatalf("resolver must satisfy EnumPartition interface")
- }
-
- ps := enum.Partitions()
-
- if a, e := len(ps), len(defaultPartitions); a != e {
- t.Errorf("expected %d partitions, got %d", e, a)
- }
-}
-
-func TestEnumDefaultRegions(t *testing.T) {
- expectPart := defaultPartitions[0]
- partEnum := defaultPartitions[0].Partition()
-
- regEnum := partEnum.Regions()
-
- if a, e := len(regEnum), len(expectPart.Regions); a != e {
- t.Errorf("expected %d regions, got %d", e, a)
- }
-}
-
-func TestEnumPartitionServices(t *testing.T) {
- expectPart := testPartitions[0]
- partEnum := testPartitions[0].Partition()
-
- if a, e := partEnum.ID(), "part-id"; a != e {
- t.Errorf("expect %q partition ID, got %q", e, a)
- }
-
- svcEnum := partEnum.Services()
-
- if a, e := len(svcEnum), len(expectPart.Services); a != e {
- t.Errorf("expected %d regions, got %d", e, a)
- }
-}
-
-func TestEnumRegionServices(t *testing.T) {
- p := testPartitions[0].Partition()
-
- rs := p.Regions()
-
- if a, e := len(rs), 2; a != e {
- t.Errorf("expect %d regions got %d", e, a)
- }
-
- if _, ok := rs["us-east-1"]; !ok {
- t.Errorf("expect us-east-1 region to be found, was not")
- }
- if _, ok := rs["us-west-2"]; !ok {
- t.Errorf("expect us-west-2 region to be found, was not")
- }
-
- r := rs["us-east-1"]
-
- if a, e := r.ID(), "us-east-1"; a != e {
- t.Errorf("expect %q region ID, got %q", e, a)
- }
-
- if a, e := r.Description(), "region description"; a != e {
- t.Errorf("expect %q region Description, got %q", e, a)
- }
-
- ss := r.Services()
- if a, e := len(ss), 1; a != e {
- t.Errorf("expect %d services for us-east-1, got %d", e, a)
- }
-
- if _, ok := ss["service1"]; !ok {
- t.Errorf("expect service1 service to be found, was not")
- }
-
- resolved, err := r.ResolveEndpoint("service1")
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- if a, e := resolved.URL, "https://service1.us-east-1.amazonaws.com"; a != e {
- t.Errorf("expect %q resolved URL, got %q", e, a)
- }
-}
-
-func TestEnumServiceRegions(t *testing.T) {
- p := testPartitions[0].Partition()
-
- rs := p.Services()["service1"].Regions()
- if e, a := 2, len(rs); e != a {
- t.Errorf("expect %d regions, got %d", e, a)
- }
-
- if _, ok := rs["us-east-1"]; !ok {
- t.Errorf("expect region to be found")
- }
- if _, ok := rs["us-west-2"]; !ok {
- t.Errorf("expect region to be found")
- }
-}
-
-func TestEnumServicesEndpoints(t *testing.T) {
- p := testPartitions[0].Partition()
-
- ss := p.Services()
-
- if a, e := len(ss), 5; a != e {
- t.Errorf("expect %d regions got %d", e, a)
- }
-
- if _, ok := ss["service1"]; !ok {
- t.Errorf("expect service1 region to be found, was not")
- }
- if _, ok := ss["service2"]; !ok {
- t.Errorf("expect service2 region to be found, was not")
- }
-
- s := ss["service1"]
- if a, e := s.ID(), "service1"; a != e {
- t.Errorf("expect %q service ID, got %q", e, a)
- }
-
- resolved, err := s.ResolveEndpoint("us-west-2")
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- if a, e := resolved.URL, "https://service1.us-west-2.amazonaws.com"; a != e {
- t.Errorf("expect %q resolved URL, got %q", e, a)
- }
-}
-
-func TestEnumEndpoints(t *testing.T) {
- p := testPartitions[0].Partition()
- s := p.Services()["service1"]
-
- es := s.Endpoints()
- if a, e := len(es), 2; a != e {
- t.Errorf("expect %d endpoints for service2, got %d", e, a)
- }
- if _, ok := es["us-east-1"]; !ok {
- t.Errorf("expect us-east-1 to be found, was not")
- }
-
- e := es["us-east-1"]
- if a, e := e.ID(), "us-east-1"; a != e {
- t.Errorf("expect %q endpoint ID, got %q", e, a)
- }
- if a, e := e.ServiceID(), "service1"; a != e {
- t.Errorf("expect %q service ID, got %q", e, a)
- }
-
- resolved, err := e.ResolveEndpoint()
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- if a, e := resolved.URL, "https://service1.us-east-1.amazonaws.com"; a != e {
- t.Errorf("expect %q resolved URL, got %q", e, a)
- }
-}
-
-func TestResolveEndpointForPartition(t *testing.T) {
- enum := testPartitions.Partitions()[0]
-
- expected, err := testPartitions.EndpointFor("service1", "us-east-1")
-
- actual, err := enum.EndpointFor("service1", "us-east-1")
- if err != nil {
- t.Fatalf("unexpected error, %v", err)
- }
-
- if expected != actual {
- t.Errorf("expect resolved endpoint to be %v, but got %v", expected, actual)
- }
-}
-
-func TestAddScheme(t *testing.T) {
- cases := []struct {
- In string
- Expect string
- DisableSSL bool
- }{
- {
- In: "https://example.com",
- Expect: "https://example.com",
- },
- {
- In: "example.com",
- Expect: "https://example.com",
- },
- {
- In: "http://example.com",
- Expect: "http://example.com",
- },
- {
- In: "example.com",
- Expect: "http://example.com",
- DisableSSL: true,
- },
- {
- In: "https://example.com",
- Expect: "https://example.com",
- DisableSSL: true,
- },
- }
-
- for i, c := range cases {
- actual := AddScheme(c.In, c.DisableSSL)
- if actual != c.Expect {
- t.Errorf("%d, expect URL to be %q, got %q", i, c.Expect, actual)
- }
- }
-}
-
-func TestResolverFunc(t *testing.T) {
- var resolver Resolver
-
- resolver = ResolverFunc(func(s, r string, opts ...func(*Options)) (ResolvedEndpoint, error) {
- return ResolvedEndpoint{
- URL: "https://service.region.dnssuffix.com",
- SigningRegion: "region",
- SigningName: "service",
- }, nil
- })
-
- resolved, err := resolver.EndpointFor("service", "region", func(o *Options) {
- o.DisableSSL = true
- })
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- if a, e := resolved.URL, "https://service.region.dnssuffix.com"; a != e {
- t.Errorf("expect %q endpoint URL, got %q", e, a)
- }
-
- if a, e := resolved.SigningRegion, "region"; a != e {
- t.Errorf("expect %q region, got %q", e, a)
- }
- if a, e := resolved.SigningName, "service"; a != e {
- t.Errorf("expect %q signing name, got %q", e, a)
- }
-}
-
-func TestOptionsSet(t *testing.T) {
- var actual Options
- actual.Set(DisableSSLOption, UseDualStackOption, StrictMatchingOption)
-
- expect := Options{
- DisableSSL: true,
- UseDualStack: true,
- StrictMatching: true,
- }
-
- if actual != expect {
- t.Errorf("expect %v options got %v", expect, actual)
- }
-}
-
-func TestRegionsForService(t *testing.T) {
- ps := DefaultPartitions()
-
- var expect map[string]Region
- var serviceID string
- for _, s := range ps[0].Services() {
- expect = s.Regions()
- serviceID = s.ID()
- if len(expect) > 0 {
- break
- }
- }
-
- actual, ok := RegionsForService(ps, ps[0].ID(), serviceID)
- if !ok {
- t.Fatalf("expect regions to be found, was not")
- }
-
- if len(actual) == 0 {
- t.Fatalf("expect service %s to have regions", serviceID)
- }
- if e, a := len(expect), len(actual); e != a {
- t.Fatalf("expect %d regions, got %d", e, a)
- }
-
- for id, r := range actual {
- if e, a := id, r.ID(); e != a {
- t.Errorf("expect %s region id, got %s", e, a)
- }
- if _, ok := expect[id]; !ok {
- t.Errorf("expect %s region to be found", id)
- }
- if a, e := r.Description(), expect[id].desc; a != e {
- t.Errorf("expect %q region Description, got %q", e, a)
- }
- }
-}
-
-func TestRegionsForService_NotFound(t *testing.T) {
- ps := testPartitions.Partitions()
-
- actual, ok := RegionsForService(ps, ps[0].ID(), "service-not-exists")
- if ok {
- t.Fatalf("expect no regions to be found, but were")
- }
- if len(actual) != 0 {
- t.Errorf("expect no regions, got %v", actual)
- }
-}
-
-func TestPartitionForRegion(t *testing.T) {
- ps := DefaultPartitions()
- expect := ps[len(ps)%2]
-
- var regionID string
- for id := range expect.Regions() {
- regionID = id
- break
- }
-
- actual, ok := PartitionForRegion(ps, regionID)
- if !ok {
- t.Fatalf("expect partition to be found")
- }
- if e, a := expect.ID(), actual.ID(); e != a {
- t.Errorf("expect %s partition, got %s", e, a)
- }
-}
-
-func TestPartitionForRegion_NotFound(t *testing.T) {
- ps := DefaultPartitions()
-
- actual, ok := PartitionForRegion(ps, "regionNotExists")
- if ok {
- t.Errorf("expect no partition to be found, got %v", actual)
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/example_test.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/example_test.go
deleted file mode 100644
index 007fed2f9..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/example_test.go
+++ /dev/null
@@ -1,66 +0,0 @@
-package endpoints_test
-
-import (
- "fmt"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/endpoints"
- "github.com/aws/aws-sdk-go/aws/session"
- "github.com/aws/aws-sdk-go/service/s3"
- "github.com/aws/aws-sdk-go/service/sqs"
-)
-
-func ExampleEnumPartitions() {
- resolver := endpoints.DefaultResolver()
- partitions := resolver.(endpoints.EnumPartitions).Partitions()
-
- for _, p := range partitions {
- fmt.Println("Regions for", p.ID())
- for id := range p.Regions() {
- fmt.Println("*", id)
- }
-
- fmt.Println("Services for", p.ID())
- for id := range p.Services() {
- fmt.Println("*", id)
- }
- }
-}
-
-func ExampleResolverFunc() {
- myCustomResolver := func(service, region string, optFns ...func(*endpoints.Options)) (endpoints.ResolvedEndpoint, error) {
- if service == endpoints.S3ServiceID {
- return endpoints.ResolvedEndpoint{
- URL: "s3.custom.endpoint.com",
- SigningRegion: "custom-signing-region",
- }, nil
- }
-
- return endpoints.DefaultResolver().EndpointFor(service, region, optFns...)
- }
-
- sess := session.Must(session.NewSession(&aws.Config{
- Region: aws.String("us-west-2"),
- EndpointResolver: endpoints.ResolverFunc(myCustomResolver),
- }))
-
- // Create the S3 service client with the shared session. This will
- // automatically use the S3 custom endpoint configured in the custom
- // endpoint resolver wrapping the default endpoint resolver.
- s3Svc := s3.New(sess)
- // Operation calls will be made to the custom endpoint.
- s3Svc.GetObject(&s3.GetObjectInput{
- Bucket: aws.String("myBucket"),
- Key: aws.String("myObjectKey"),
- })
-
- // Create the SQS service client with the shared session. This will
- // fallback to the default endpoint resolver because the customization
- // passes any non S3 service endpoint resolve to the default resolver.
- sqsSvc := sqs.New(sess)
- // Operation calls will be made to the default endpoint for SQS for the
- // region configured.
- sqsSvc.ReceiveMessage(&sqs.ReceiveMessageInput{
- QueueUrl: aws.String("my-queue-url"),
- })
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model_test.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model_test.go
deleted file mode 100644
index 0b8b00673..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model_test.go
+++ /dev/null
@@ -1,541 +0,0 @@
-package endpoints
-
-import (
- "encoding/json"
- "reflect"
- "regexp"
- "testing"
-)
-
-func TestUnmarshalRegionRegex(t *testing.T) {
- var input = []byte(`
-{
- "regionRegex": "^(us|eu|ap|sa|ca)\\-\\w+\\-\\d+$"
-}`)
-
- p := partition{}
- err := json.Unmarshal(input, &p)
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- expectRegexp, err := regexp.Compile(`^(us|eu|ap|sa|ca)\-\w+\-\d+$`)
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- if e, a := expectRegexp.String(), p.RegionRegex.Regexp.String(); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-func TestUnmarshalRegion(t *testing.T) {
- var input = []byte(`
-{
- "aws-global": {
- "description": "AWS partition-global endpoint"
- },
- "us-east-1": {
- "description": "US East (N. Virginia)"
- }
-}`)
-
- rs := regions{}
- err := json.Unmarshal(input, &rs)
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- if e, a := 2, len(rs); e != a {
- t.Errorf("expect %v len, got %v", e, a)
- }
- r, ok := rs["aws-global"]
- if !ok {
- t.Errorf("expect found, was not")
- }
- if e, a := "AWS partition-global endpoint", r.Description; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
- r, ok = rs["us-east-1"]
- if !ok {
- t.Errorf("expect found, was not")
- }
- if e, a := "US East (N. Virginia)", r.Description; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-func TestUnmarshalServices(t *testing.T) {
- var input = []byte(`
-{
- "acm": {
- "endpoints": {
- "us-east-1": {}
- }
- },
- "apigateway": {
- "isRegionalized": true,
- "endpoints": {
- "us-east-1": {},
- "us-west-2": {}
- }
- },
- "notRegionalized": {
- "isRegionalized": false,
- "endpoints": {
- "us-east-1": {},
- "us-west-2": {}
- }
- }
-}`)
-
- ss := services{}
- err := json.Unmarshal(input, &ss)
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- if e, a := 3, len(ss); e != a {
- t.Errorf("expect %v len, got %v", e, a)
- }
- s, ok := ss["acm"]
- if !ok {
- t.Errorf("expect found, was not")
- }
- if e, a := 1, len(s.Endpoints); e != a {
- t.Errorf("expect %v len, got %v", e, a)
- }
- if e, a := boxedBoolUnset, s.IsRegionalized; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
- s, ok = ss["apigateway"]
- if !ok {
- t.Errorf("expect found, was not")
- }
- if e, a := 2, len(s.Endpoints); e != a {
- t.Errorf("expect %v len, got %v", e, a)
- }
- if e, a := boxedTrue, s.IsRegionalized; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
- s, ok = ss["notRegionalized"]
- if !ok {
- t.Errorf("expect found, was not")
- }
- if e, a := 2, len(s.Endpoints); e != a {
- t.Errorf("expect %v len, got %v", e, a)
- }
- if e, a := boxedFalse, s.IsRegionalized; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-func TestUnmarshalEndpoints(t *testing.T) {
- var inputs = []byte(`
-{
- "aws-global": {
- "hostname": "cloudfront.amazonaws.com",
- "protocols": [
- "http",
- "https"
- ],
- "signatureVersions": [ "v4" ],
- "credentialScope": {
- "region": "us-east-1",
- "service": "serviceName"
- },
- "sslCommonName": "commonName"
- },
- "us-east-1": {}
-}`)
-
- es := endpoints{}
- err := json.Unmarshal(inputs, &es)
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- if e, a := 2, len(es); e != a {
- t.Errorf("expect %v len, got %v", e, a)
- }
- s, ok := es["aws-global"]
- if !ok {
- t.Errorf("expect found, was not")
- }
- if e, a := "cloudfront.amazonaws.com", s.Hostname; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := []string{"http", "https"}, s.Protocols; !reflect.DeepEqual(e, a) {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := []string{"v4"}, s.SignatureVersions; !reflect.DeepEqual(e, a) {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := (credentialScope{"us-east-1", "serviceName"}), s.CredentialScope; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "commonName", s.SSLCommonName; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-func TestEndpointResolve(t *testing.T) {
- defs := []endpoint{
- {
- Hostname: "{service}.{region}.{dnsSuffix}",
- SignatureVersions: []string{"v2"},
- SSLCommonName: "sslCommonName",
- },
- {
- Hostname: "other-hostname",
- Protocols: []string{"http"},
- CredentialScope: credentialScope{
- Region: "signing_region",
- Service: "signing_service",
- },
- },
- }
-
- e := endpoint{
- Hostname: "{service}.{region}.{dnsSuffix}",
- Protocols: []string{"http", "https"},
- SignatureVersions: []string{"v4"},
- SSLCommonName: "new sslCommonName",
- }
-
- resolved := e.resolve("service", "region", "dnsSuffix",
- defs, Options{},
- )
-
- if e, a := "https://service.region.dnsSuffix", resolved.URL; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "signing_service", resolved.SigningName; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "signing_region", resolved.SigningRegion; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "v4", resolved.SigningMethod; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-func TestEndpointMergeIn(t *testing.T) {
- expected := endpoint{
- Hostname: "other hostname",
- Protocols: []string{"http"},
- SignatureVersions: []string{"v4"},
- SSLCommonName: "ssl common name",
- CredentialScope: credentialScope{
- Region: "region",
- Service: "service",
- },
- }
-
- actual := endpoint{}
- actual.mergeIn(endpoint{
- Hostname: "other hostname",
- Protocols: []string{"http"},
- SignatureVersions: []string{"v4"},
- SSLCommonName: "ssl common name",
- CredentialScope: credentialScope{
- Region: "region",
- Service: "service",
- },
- })
-
- if e, a := expected, actual; !reflect.DeepEqual(e, a) {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-var testPartitions = partitions{
- partition{
- ID: "part-id",
- Name: "partitionName",
- DNSSuffix: "amazonaws.com",
- RegionRegex: regionRegex{
- Regexp: func() *regexp.Regexp {
- reg, _ := regexp.Compile("^(us|eu|ap|sa|ca)\\-\\w+\\-\\d+$")
- return reg
- }(),
- },
- Defaults: endpoint{
- Hostname: "{service}.{region}.{dnsSuffix}",
- Protocols: []string{"https"},
- SignatureVersions: []string{"v4"},
- },
- Regions: regions{
- "us-east-1": region{
- Description: "region description",
- },
- "us-west-2": region{},
- },
- Services: services{
- "s3": service{},
- "service1": service{
- Defaults: endpoint{
- CredentialScope: credentialScope{
- Service: "service1",
- },
- },
- Endpoints: endpoints{
- "us-east-1": {},
- "us-west-2": {
- HasDualStack: boxedTrue,
- DualStackHostname: "{service}.dualstack.{region}.{dnsSuffix}",
- },
- },
- },
- "service2": service{
- Defaults: endpoint{
- CredentialScope: credentialScope{
- Service: "service2",
- },
- },
- },
- "httpService": service{
- Defaults: endpoint{
- Protocols: []string{"http"},
- },
- },
- "globalService": service{
- IsRegionalized: boxedFalse,
- PartitionEndpoint: "aws-global",
- Endpoints: endpoints{
- "aws-global": endpoint{
- CredentialScope: credentialScope{
- Region: "us-east-1",
- },
- Hostname: "globalService.amazonaws.com",
- },
- },
- },
- },
- },
-}
-
-func TestResolveEndpoint(t *testing.T) {
- resolved, err := testPartitions.EndpointFor("service2", "us-west-2")
-
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
- if e, a := "https://service2.us-west-2.amazonaws.com", resolved.URL; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "us-west-2", resolved.SigningRegion; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "service2", resolved.SigningName; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if resolved.SigningNameDerived {
- t.Errorf("expect the signing name not to be derived, but was")
- }
-}
-
-func TestResolveEndpoint_DisableSSL(t *testing.T) {
- resolved, err := testPartitions.EndpointFor("service2", "us-west-2", DisableSSLOption)
-
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
- if e, a := "http://service2.us-west-2.amazonaws.com", resolved.URL; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "us-west-2", resolved.SigningRegion; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "service2", resolved.SigningName; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if resolved.SigningNameDerived {
- t.Errorf("expect the signing name not to be derived, but was")
- }
-}
-
-func TestResolveEndpoint_UseDualStack(t *testing.T) {
- resolved, err := testPartitions.EndpointFor("service1", "us-west-2", UseDualStackOption)
-
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
- if e, a := "https://service1.dualstack.us-west-2.amazonaws.com", resolved.URL; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "us-west-2", resolved.SigningRegion; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "service1", resolved.SigningName; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if resolved.SigningNameDerived {
- t.Errorf("expect the signing name not to be derived, but was")
- }
-}
-
-func TestResolveEndpoint_HTTPProtocol(t *testing.T) {
- resolved, err := testPartitions.EndpointFor("httpService", "us-west-2")
-
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
- if e, a := "http://httpService.us-west-2.amazonaws.com", resolved.URL; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "us-west-2", resolved.SigningRegion; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "httpService", resolved.SigningName; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if !resolved.SigningNameDerived {
- t.Errorf("expect the signing name to be derived")
- }
-}
-
-func TestResolveEndpoint_UnknownService(t *testing.T) {
- _, err := testPartitions.EndpointFor("unknownservice", "us-west-2")
-
- if err == nil {
- t.Errorf("expect error, got none")
- }
-
- _, ok := err.(UnknownServiceError)
- if !ok {
- t.Errorf("expect error to be UnknownServiceError")
- }
-}
-
-func TestResolveEndpoint_ResolveUnknownService(t *testing.T) {
- resolved, err := testPartitions.EndpointFor("unknown-service", "us-region-1",
- ResolveUnknownServiceOption)
-
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- if e, a := "https://unknown-service.us-region-1.amazonaws.com", resolved.URL; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "us-region-1", resolved.SigningRegion; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "unknown-service", resolved.SigningName; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if !resolved.SigningNameDerived {
- t.Errorf("expect the signing name to be derived")
- }
-}
-
-func TestResolveEndpoint_UnknownMatchedRegion(t *testing.T) {
- resolved, err := testPartitions.EndpointFor("service2", "us-region-1")
-
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
- if e, a := "https://service2.us-region-1.amazonaws.com", resolved.URL; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "us-region-1", resolved.SigningRegion; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "service2", resolved.SigningName; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if resolved.SigningNameDerived {
- t.Errorf("expect the signing name not to be derived, but was")
- }
-}
-
-func TestResolveEndpoint_UnknownRegion(t *testing.T) {
- resolved, err := testPartitions.EndpointFor("service2", "unknownregion")
-
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
- if e, a := "https://service2.unknownregion.amazonaws.com", resolved.URL; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "unknownregion", resolved.SigningRegion; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "service2", resolved.SigningName; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if resolved.SigningNameDerived {
- t.Errorf("expect the signing name not to be derived, but was")
- }
-}
-
-func TestResolveEndpoint_StrictPartitionUnknownEndpoint(t *testing.T) {
- _, err := testPartitions[0].EndpointFor("service2", "unknownregion", StrictMatchingOption)
-
- if err == nil {
- t.Errorf("expect error, got none")
- }
-
- _, ok := err.(UnknownEndpointError)
- if !ok {
- t.Errorf("expect error to be UnknownEndpointError")
- }
-}
-
-func TestResolveEndpoint_StrictPartitionsUnknownEndpoint(t *testing.T) {
- _, err := testPartitions.EndpointFor("service2", "us-region-1", StrictMatchingOption)
-
- if err == nil {
- t.Errorf("expect error, got none")
- }
-
- _, ok := err.(UnknownEndpointError)
- if !ok {
- t.Errorf("expect error to be UnknownEndpointError")
- }
-}
-
-func TestResolveEndpoint_NotRegionalized(t *testing.T) {
- resolved, err := testPartitions.EndpointFor("globalService", "us-west-2")
-
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
- if e, a := "https://globalService.amazonaws.com", resolved.URL; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "us-east-1", resolved.SigningRegion; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "globalService", resolved.SigningName; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if !resolved.SigningNameDerived {
- t.Errorf("expect the signing name to be derived")
- }
-}
-
-func TestResolveEndpoint_AwsGlobal(t *testing.T) {
- resolved, err := testPartitions.EndpointFor("globalService", "aws-global")
-
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
- if e, a := "https://globalService.amazonaws.com", resolved.URL; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "us-east-1", resolved.SigningRegion; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "globalService", resolved.SigningName; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if !resolved.SigningNameDerived {
- t.Errorf("expect the signing name to be derived")
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other_test.go
deleted file mode 100644
index aba8eb4e8..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other_test.go
+++ /dev/null
@@ -1,9 +0,0 @@
-// +build appengine plan9
-
-package request_test
-
-import (
- "errors"
-)
-
-var stubConnectionResetError = errors.New("connection reset")
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_test.go
deleted file mode 100644
index bb5f6bddc..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_test.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// +build !appengine,!plan9
-
-package request_test
-
-import (
- "net"
- "os"
- "syscall"
-)
-
-var stubConnectionResetError = &net.OpError{Err: &os.SyscallError{Syscall: "read", Err: syscall.ECONNRESET}}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/handlers_test.go
deleted file mode 100644
index b2da558d6..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers_test.go
+++ /dev/null
@@ -1,266 +0,0 @@
-package request_test
-
-import (
- "reflect"
- "testing"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/awstesting/unit"
- "github.com/aws/aws-sdk-go/service/s3"
-)
-
-func TestHandlerList(t *testing.T) {
- s := ""
- r := &request.Request{}
- l := request.HandlerList{}
- l.PushBack(func(r *request.Request) {
- s += "a"
- r.Data = s
- })
- l.Run(r)
- if e, a := "a", s; e != a {
- t.Errorf("expect %q update got %q", e, a)
- }
- if e, a := "a", r.Data.(string); e != a {
- t.Errorf("expect %q data update got %q", e, a)
- }
-}
-
-func TestMultipleHandlers(t *testing.T) {
- r := &request.Request{}
- l := request.HandlerList{}
- l.PushBack(func(r *request.Request) { r.Data = nil })
- l.PushFront(func(r *request.Request) { r.Data = aws.Bool(true) })
- l.Run(r)
- if r.Data != nil {
- t.Error("Expected handler to execute")
- }
-}
-
-func TestNamedHandlers(t *testing.T) {
- l := request.HandlerList{}
- named := request.NamedHandler{Name: "Name", Fn: func(r *request.Request) {}}
- named2 := request.NamedHandler{Name: "NotName", Fn: func(r *request.Request) {}}
- l.PushBackNamed(named)
- l.PushBackNamed(named)
- l.PushBackNamed(named2)
- l.PushBack(func(r *request.Request) {})
- if e, a := 4, l.Len(); e != a {
- t.Errorf("expect %d list length, got %d", e, a)
- }
- l.Remove(named)
- if e, a := 2, l.Len(); e != a {
- t.Errorf("expect %d list length, got %d", e, a)
- }
-}
-
-func TestSwapHandlers(t *testing.T) {
- firstHandlerCalled := 0
- swappedOutHandlerCalled := 0
- swappedInHandlerCalled := 0
-
- l := request.HandlerList{}
- named := request.NamedHandler{Name: "Name", Fn: func(r *request.Request) {
- firstHandlerCalled++
- }}
- named2 := request.NamedHandler{Name: "SwapOutName", Fn: func(r *request.Request) {
- swappedOutHandlerCalled++
- }}
- l.PushBackNamed(named)
- l.PushBackNamed(named2)
- l.PushBackNamed(named)
-
- l.SwapNamed(request.NamedHandler{Name: "SwapOutName", Fn: func(r *request.Request) {
- swappedInHandlerCalled++
- }})
-
- l.Run(&request.Request{})
-
- if e, a := 2, firstHandlerCalled; e != a {
- t.Errorf("expect first handler to be called %d, was called %d times", e, a)
- }
- if n := swappedOutHandlerCalled; n != 0 {
- t.Errorf("expect swapped out handler to not be called, was called %d times", n)
- }
- if e, a := 1, swappedInHandlerCalled; e != a {
- t.Errorf("expect swapped in handler to be called %d, was called %d times", e, a)
- }
-}
-
-func TestSetBackNamed_Exists(t *testing.T) {
- firstHandlerCalled := 0
- swappedOutHandlerCalled := 0
- swappedInHandlerCalled := 0
-
- l := request.HandlerList{}
- named := request.NamedHandler{Name: "Name", Fn: func(r *request.Request) {
- firstHandlerCalled++
- }}
- named2 := request.NamedHandler{Name: "SwapOutName", Fn: func(r *request.Request) {
- swappedOutHandlerCalled++
- }}
- l.PushBackNamed(named)
- l.PushBackNamed(named2)
-
- l.SetBackNamed(request.NamedHandler{Name: "SwapOutName", Fn: func(r *request.Request) {
- swappedInHandlerCalled++
- }})
-
- l.Run(&request.Request{})
-
- if e, a := 1, firstHandlerCalled; e != a {
- t.Errorf("expect first handler to be called %d, was called %d times", e, a)
- }
- if n := swappedOutHandlerCalled; n != 0 {
- t.Errorf("expect swapped out handler to not be called, was called %d times", n)
- }
- if e, a := 1, swappedInHandlerCalled; e != a {
- t.Errorf("expect swapped in handler to be called %d, was called %d times", e, a)
- }
-}
-
-func TestSetBackNamed_NotExists(t *testing.T) {
- firstHandlerCalled := 0
- secondHandlerCalled := 0
- swappedInHandlerCalled := 0
-
- l := request.HandlerList{}
- named := request.NamedHandler{Name: "Name", Fn: func(r *request.Request) {
- firstHandlerCalled++
- }}
- named2 := request.NamedHandler{Name: "OtherName", Fn: func(r *request.Request) {
- secondHandlerCalled++
- }}
- l.PushBackNamed(named)
- l.PushBackNamed(named2)
-
- l.SetBackNamed(request.NamedHandler{Name: "SwapOutName", Fn: func(r *request.Request) {
- swappedInHandlerCalled++
- }})
-
- l.Run(&request.Request{})
-
- if e, a := 1, firstHandlerCalled; e != a {
- t.Errorf("expect first handler to be called %d, was called %d times", e, a)
- }
- if e, a := 1, secondHandlerCalled; e != a {
- t.Errorf("expect second handler to be called %d, was called %d times", e, a)
- }
- if e, a := 1, swappedInHandlerCalled; e != a {
- t.Errorf("expect swapped in handler to be called %d, was called %d times", e, a)
- }
-}
-
-func TestLoggedHandlers(t *testing.T) {
- expectedHandlers := []string{"name1", "name2"}
- l := request.HandlerList{}
- loggedHandlers := []string{}
- l.AfterEachFn = request.HandlerListLogItem
- cfg := aws.Config{Logger: aws.LoggerFunc(func(args ...interface{}) {
- loggedHandlers = append(loggedHandlers, args[2].(string))
- })}
-
- named1 := request.NamedHandler{Name: "name1", Fn: func(r *request.Request) {}}
- named2 := request.NamedHandler{Name: "name2", Fn: func(r *request.Request) {}}
- l.PushBackNamed(named1)
- l.PushBackNamed(named2)
- l.Run(&request.Request{Config: cfg})
-
- if !reflect.DeepEqual(expectedHandlers, loggedHandlers) {
- t.Errorf("expect handlers executed %v to match logged handlers, %v",
- expectedHandlers, loggedHandlers)
- }
-}
-
-func TestStopHandlers(t *testing.T) {
- l := request.HandlerList{}
- stopAt := 1
- l.AfterEachFn = func(item request.HandlerListRunItem) bool {
- return item.Index != stopAt
- }
-
- called := 0
- l.PushBackNamed(request.NamedHandler{Name: "name1", Fn: func(r *request.Request) {
- called++
- }})
- l.PushBackNamed(request.NamedHandler{Name: "name2", Fn: func(r *request.Request) {
- called++
- }})
- l.PushBackNamed(request.NamedHandler{Name: "name3", Fn: func(r *request.Request) {
- t.Fatalf("third handler should not be called")
- }})
- l.Run(&request.Request{})
-
- if e, a := 2, called; e != a {
- t.Errorf("expect %d handlers called, got %d", e, a)
- }
-}
-
-func BenchmarkNewRequest(b *testing.B) {
- svc := s3.New(unit.Session)
-
- for i := 0; i < b.N; i++ {
- r, _ := svc.GetObjectRequest(nil)
- if r == nil {
- b.Fatal("r should not be nil")
- }
- }
-}
-
-func BenchmarkHandlersCopy(b *testing.B) {
- handlers := request.Handlers{}
-
- handlers.Validate.PushBack(func(r *request.Request) {})
- handlers.Validate.PushBack(func(r *request.Request) {})
- handlers.Build.PushBack(func(r *request.Request) {})
- handlers.Build.PushBack(func(r *request.Request) {})
- handlers.Send.PushBack(func(r *request.Request) {})
- handlers.Send.PushBack(func(r *request.Request) {})
- handlers.Unmarshal.PushBack(func(r *request.Request) {})
- handlers.Unmarshal.PushBack(func(r *request.Request) {})
-
- for i := 0; i < b.N; i++ {
- h := handlers.Copy()
- if e, a := handlers.Validate.Len(), h.Validate.Len(); e != a {
- b.Fatalf("expected %d handlers got %d", e, a)
- }
- }
-}
-
-func BenchmarkHandlersPushBack(b *testing.B) {
- handlers := request.Handlers{}
-
- for i := 0; i < b.N; i++ {
- h := handlers.Copy()
- h.Validate.PushBack(func(r *request.Request) {})
- h.Validate.PushBack(func(r *request.Request) {})
- h.Validate.PushBack(func(r *request.Request) {})
- h.Validate.PushBack(func(r *request.Request) {})
- }
-}
-
-func BenchmarkHandlersPushFront(b *testing.B) {
- handlers := request.Handlers{}
-
- for i := 0; i < b.N; i++ {
- h := handlers.Copy()
- h.Validate.PushFront(func(r *request.Request) {})
- h.Validate.PushFront(func(r *request.Request) {})
- h.Validate.PushFront(func(r *request.Request) {})
- h.Validate.PushFront(func(r *request.Request) {})
- }
-}
-
-func BenchmarkHandlersClear(b *testing.B) {
- handlers := request.Handlers{}
-
- for i := 0; i < b.N; i++ {
- h := handlers.Copy()
- h.Validate.PushFront(func(r *request.Request) {})
- h.Validate.PushFront(func(r *request.Request) {})
- h.Validate.PushFront(func(r *request.Request) {})
- h.Validate.PushFront(func(r *request.Request) {})
- h.Clear()
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/http_request_copy_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/http_request_copy_test.go
deleted file mode 100644
index 4a4f8550b..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/request/http_request_copy_test.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package request
-
-import (
- "bytes"
- "io/ioutil"
- "net/http"
- "net/url"
- "sync"
- "testing"
-)
-
-func TestRequestCopyRace(t *testing.T) {
- origReq := &http.Request{URL: &url.URL{}, Header: http.Header{}}
- origReq.Header.Set("Header", "OrigValue")
-
- var wg sync.WaitGroup
- for i := 0; i < 100; i++ {
- wg.Add(1)
- go func() {
- req := copyHTTPRequest(origReq, ioutil.NopCloser(&bytes.Buffer{}))
- req.Header.Set("Header", "Value")
- go func() {
- req2 := copyHTTPRequest(req, ioutil.NopCloser(&bytes.Buffer{}))
- req2.Header.Add("Header", "Value2")
- }()
- _ = req.Header.Get("Header")
- wg.Done()
- }()
- _ = origReq.Header.Get("Header")
- }
- origReq.Header.Get("Header")
-
- wg.Wait()
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/http_request_retry_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/http_request_retry_test.go
deleted file mode 100644
index 2ce9ef4c3..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/request/http_request_retry_test.go
+++ /dev/null
@@ -1,37 +0,0 @@
-// +build go1.5
-
-package request_test
-
-import (
- "errors"
- "strings"
- "testing"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/awstesting/mock"
- "github.com/stretchr/testify/assert"
-)
-
-func TestRequestCancelRetry(t *testing.T) {
- c := make(chan struct{})
-
- reqNum := 0
- s := mock.NewMockClient(aws.NewConfig().WithMaxRetries(10))
- s.Handlers.Validate.Clear()
- s.Handlers.Unmarshal.Clear()
- s.Handlers.UnmarshalMeta.Clear()
- s.Handlers.UnmarshalError.Clear()
- s.Handlers.Send.PushFront(func(r *request.Request) {
- reqNum++
- r.Error = errors.New("net/http: request canceled")
- })
- out := &testData{}
- r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out)
- r.HTTPRequest.Cancel = c
- close(c)
-
- err := r.Send()
- assert.True(t, strings.Contains(err.Error(), "canceled"))
- assert.Equal(t, 1, reqNum)
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader_test.go
deleted file mode 100644
index e5ec043b8..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader_test.go
+++ /dev/null
@@ -1,140 +0,0 @@
-package request
-
-import (
- "bytes"
- "io"
- "math/rand"
- "sync"
- "testing"
- "time"
-
- "github.com/aws/aws-sdk-go/internal/sdkio"
- "github.com/stretchr/testify/assert"
-)
-
-func TestOffsetReaderRead(t *testing.T) {
- buf := []byte("testData")
- reader := &offsetReader{buf: bytes.NewReader(buf)}
-
- tempBuf := make([]byte, len(buf))
-
- n, err := reader.Read(tempBuf)
-
- assert.Equal(t, n, len(buf))
- assert.Nil(t, err)
- assert.Equal(t, buf, tempBuf)
-}
-
-func TestOffsetReaderSeek(t *testing.T) {
- buf := []byte("testData")
- reader := newOffsetReader(bytes.NewReader(buf), 0)
-
- orig, err := reader.Seek(0, sdkio.SeekCurrent)
- assert.NoError(t, err)
- assert.Equal(t, int64(0), orig)
-
- n, err := reader.Seek(0, sdkio.SeekEnd)
- assert.NoError(t, err)
- assert.Equal(t, int64(len(buf)), n)
-
- n, err = reader.Seek(orig, sdkio.SeekStart)
- assert.NoError(t, err)
- assert.Equal(t, int64(0), n)
-}
-
-func TestOffsetReaderClose(t *testing.T) {
- buf := []byte("testData")
- reader := &offsetReader{buf: bytes.NewReader(buf)}
-
- err := reader.Close()
- assert.Nil(t, err)
-
- tempBuf := make([]byte, len(buf))
- n, err := reader.Read(tempBuf)
- assert.Equal(t, n, 0)
- assert.Equal(t, err, io.EOF)
-}
-
-func TestOffsetReaderCloseAndCopy(t *testing.T) {
- buf := []byte("testData")
- tempBuf := make([]byte, len(buf))
- reader := &offsetReader{buf: bytes.NewReader(buf)}
-
- newReader := reader.CloseAndCopy(0)
-
- n, err := reader.Read(tempBuf)
- assert.Equal(t, n, 0)
- assert.Equal(t, err, io.EOF)
-
- n, err = newReader.Read(tempBuf)
- assert.Equal(t, n, len(buf))
- assert.Nil(t, err)
- assert.Equal(t, buf, tempBuf)
-}
-
-func TestOffsetReaderCloseAndCopyOffset(t *testing.T) {
- buf := []byte("testData")
- tempBuf := make([]byte, len(buf))
- reader := &offsetReader{buf: bytes.NewReader(buf)}
-
- newReader := reader.CloseAndCopy(4)
- n, err := newReader.Read(tempBuf)
- assert.Equal(t, n, len(buf)-4)
- assert.Nil(t, err)
-
- expected := []byte{'D', 'a', 't', 'a', 0, 0, 0, 0}
- assert.Equal(t, expected, tempBuf)
-}
-
-func TestOffsetReaderRace(t *testing.T) {
- wg := sync.WaitGroup{}
-
- f := func(reader *offsetReader) {
- defer wg.Done()
- var err error
- buf := make([]byte, 1)
- _, err = reader.Read(buf)
- for err != io.EOF {
- _, err = reader.Read(buf)
- }
-
- }
-
- closeFn := func(reader *offsetReader) {
- defer wg.Done()
- time.Sleep(time.Duration(rand.Intn(20)+1) * time.Millisecond)
- reader.Close()
- }
- for i := 0; i < 50; i++ {
- reader := &offsetReader{buf: bytes.NewReader(make([]byte, 1024*1024))}
- wg.Add(1)
- go f(reader)
- wg.Add(1)
- go closeFn(reader)
- }
- wg.Wait()
-}
-
-func BenchmarkOffsetReader(b *testing.B) {
- bufSize := 1024 * 1024 * 100
- buf := make([]byte, bufSize)
- reader := &offsetReader{buf: bytes.NewReader(buf)}
-
- tempBuf := make([]byte, 1024)
-
- for i := 0; i < b.N; i++ {
- reader.Read(tempBuf)
- }
-}
-
-func BenchmarkBytesReader(b *testing.B) {
- bufSize := 1024 * 1024 * 100
- buf := make([]byte, bufSize)
- reader := bytes.NewReader(buf)
-
- tempBuf := make([]byte, 1024)
-
- for i := 0; i < b.N; i++ {
- reader.Read(tempBuf)
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_5_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_5_test.go
deleted file mode 100644
index 91b4e7b3b..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_5_test.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// +build !go1.6
-
-package request_test
-
-import (
- "errors"
-
- "github.com/aws/aws-sdk-go/aws/awserr"
-)
-
-var errTimeout = awserr.New("foo", "bar", errors.New("net/http: request canceled Timeout"))
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_6_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_6_test.go
deleted file mode 100644
index d0314abe9..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_6_test.go
+++ /dev/null
@@ -1,51 +0,0 @@
-// +build go1.6
-
-package request_test
-
-import (
- "errors"
- "testing"
-
- "github.com/stretchr/testify/assert"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/awserr"
- "github.com/aws/aws-sdk-go/aws/client"
- "github.com/aws/aws-sdk-go/aws/client/metadata"
- "github.com/aws/aws-sdk-go/aws/defaults"
- "github.com/aws/aws-sdk-go/aws/request"
-)
-
-// go version 1.4 and 1.5 do not return an error. Version 1.5 will url encode
-// the uri while 1.4 will not
-func TestRequestInvalidEndpoint(t *testing.T) {
- endpoint := "http://localhost:90 "
-
- r := request.New(
- aws.Config{},
- metadata.ClientInfo{Endpoint: endpoint},
- defaults.Handlers(),
- client.DefaultRetryer{},
- &request.Operation{},
- nil,
- nil,
- )
-
- assert.Error(t, r.Error)
-}
-
-type timeoutErr struct {
- error
-}
-
-var errTimeout = awserr.New("foo", "bar", &timeoutErr{
- errors.New("net/http: request canceled"),
-})
-
-func (e *timeoutErr) Timeout() bool {
- return true
-}
-
-func (e *timeoutErr) Temporary() bool {
- return true
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_7_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_7_test.go
deleted file mode 100644
index ca6150cb0..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_7_test.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// +build !go1.8
-
-package request
-
-import (
- "net/http"
- "strings"
- "testing"
-)
-
-func TestResetBody_WithEmptyBody(t *testing.T) {
- r := Request{
- HTTPRequest: &http.Request{},
- }
-
- reader := strings.NewReader("")
- r.Body = reader
-
- r.ResetBody()
-
- if a, e := r.HTTPRequest.Body, (noBody{}); a != e {
- t.Errorf("expected request body to be set to reader, got %#v", r.HTTPRequest.Body)
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8_test.go
deleted file mode 100644
index 8f3b0f04e..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8_test.go
+++ /dev/null
@@ -1,85 +0,0 @@
-// +build go1.8
-
-package request_test
-
-import (
- "bytes"
- "io"
- "net/http"
- "net/http/httptest"
- "strings"
- "testing"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/awstesting"
- "github.com/aws/aws-sdk-go/awstesting/unit"
-)
-
-func TestResetBody_WithEmptyBody(t *testing.T) {
- r := request.Request{
- HTTPRequest: &http.Request{},
- }
-
- reader := strings.NewReader("")
- r.Body = reader
-
- r.ResetBody()
-
- if a, e := r.HTTPRequest.Body, http.NoBody; a != e {
- t.Errorf("expected request body to be set to reader, got %#v",
- r.HTTPRequest.Body)
- }
-}
-
-func TestRequest_FollowPUTRedirects(t *testing.T) {
- const bodySize = 1024
-
- redirectHit := 0
- endpointHit := 0
-
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- switch r.URL.Path {
- case "/redirect-me":
- u := *r.URL
- u.Path = "/endpoint"
- w.Header().Set("Location", u.String())
- w.WriteHeader(307)
- redirectHit++
- case "/endpoint":
- b := bytes.Buffer{}
- io.Copy(&b, r.Body)
- r.Body.Close()
- if e, a := bodySize, b.Len(); e != a {
- t.Fatalf("expect %d body size, got %d", e, a)
- }
- endpointHit++
- default:
- t.Fatalf("unexpected endpoint used, %q", r.URL.String())
- }
- }))
-
- svc := awstesting.NewClient(&aws.Config{
- Region: unit.Session.Config.Region,
- DisableSSL: aws.Bool(true),
- Endpoint: aws.String(server.URL),
- })
-
- req := svc.NewRequest(&request.Operation{
- Name: "Operation",
- HTTPMethod: "PUT",
- HTTPPath: "/redirect-me",
- }, &struct{}{}, &struct{}{})
- req.SetReaderBody(bytes.NewReader(make([]byte, bodySize)))
-
- err := req.Send()
- if err != nil {
- t.Errorf("expect no error, got %v", err)
- }
- if e, a := 1, redirectHit; e != a {
- t.Errorf("expect %d redirect hits, got %d", e, a)
- }
- if e, a := 1, endpointHit; e != a {
- t.Errorf("expect %d endpoint hits, got %d", e, a)
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_context_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_context_test.go
deleted file mode 100644
index 2af286756..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_context_test.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package request_test
-
-import (
- "fmt"
- "strings"
- "testing"
-
- "github.com/aws/aws-sdk-go/aws/corehandlers"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/awstesting"
-)
-
-func TestRequest_SetContext(t *testing.T) {
- svc := awstesting.NewClient()
- svc.Handlers.Clear()
- svc.Handlers.Send.PushBackNamed(corehandlers.SendHandler)
-
- r := svc.NewRequest(&request.Operation{Name: "Operation"}, nil, nil)
- ctx := &awstesting.FakeContext{DoneCh: make(chan struct{})}
- r.SetContext(ctx)
-
- ctx.Error = fmt.Errorf("context canceled")
- close(ctx.DoneCh)
-
- err := r.Send()
- if err == nil {
- t.Fatalf("expected error, got none")
- }
-
- // Only check against canceled because go 1.6 will not use the context's
- // Err().
- if e, a := "canceled", err.Error(); !strings.Contains(a, e) {
- t.Errorf("expect %q to be in %q, but was not", e, a)
- }
-}
-
-func TestRequest_SetContextPanic(t *testing.T) {
- defer func() {
- if r := recover(); r == nil {
- t.Fatalf("expect SetContext to panic, did not")
- }
- }()
- r := &request.Request{}
-
- r.SetContext(nil)
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_internal_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_internal_test.go
deleted file mode 100644
index 966f93455..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_internal_test.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package request
-
-import (
- "testing"
-)
-
-func TestCopy(t *testing.T) {
- handlers := Handlers{}
- op := &Operation{}
- op.HTTPMethod = "Foo"
- req := &Request{}
- req.Operation = op
- req.Handlers = handlers
-
- r := req.copy()
-
- if r == req {
- t.Fatal("expect request pointer copy to be different")
- }
- if r.Operation == req.Operation {
- t.Errorf("expect request operation pointer to be different")
- }
-
- if e, a := req.Operation.HTTPMethod, r.Operation.HTTPMethod; e != a {
- t.Errorf("expect %q http method, got %q", e, a)
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go
deleted file mode 100644
index 03aed301a..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go
+++ /dev/null
@@ -1,648 +0,0 @@
-package request_test
-
-import (
- "testing"
-
- "github.com/stretchr/testify/assert"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/awstesting"
- "github.com/aws/aws-sdk-go/awstesting/unit"
- "github.com/aws/aws-sdk-go/service/dynamodb"
- "github.com/aws/aws-sdk-go/service/route53"
- "github.com/aws/aws-sdk-go/service/s3"
-)
-
-// Use DynamoDB methods for simplicity
-func TestPaginationQueryPage(t *testing.T) {
- db := dynamodb.New(unit.Session)
- tokens, pages, numPages, gotToEnd := []map[string]*dynamodb.AttributeValue{}, []map[string]*dynamodb.AttributeValue{}, 0, false
-
- reqNum := 0
- resps := []*dynamodb.QueryOutput{
- {
- LastEvaluatedKey: map[string]*dynamodb.AttributeValue{"key": {S: aws.String("key1")}},
- Count: aws.Int64(1),
- Items: []map[string]*dynamodb.AttributeValue{
- {
- "key": {S: aws.String("key1")},
- },
- },
- },
- {
- LastEvaluatedKey: map[string]*dynamodb.AttributeValue{"key": {S: aws.String("key2")}},
- Count: aws.Int64(1),
- Items: []map[string]*dynamodb.AttributeValue{
- {
- "key": {S: aws.String("key2")},
- },
- },
- },
- {
- LastEvaluatedKey: map[string]*dynamodb.AttributeValue{},
- Count: aws.Int64(1),
- Items: []map[string]*dynamodb.AttributeValue{
- {
- "key": {S: aws.String("key3")},
- },
- },
- },
- }
-
- db.Handlers.Send.Clear() // mock sending
- db.Handlers.Unmarshal.Clear()
- db.Handlers.UnmarshalMeta.Clear()
- db.Handlers.ValidateResponse.Clear()
- db.Handlers.Build.PushBack(func(r *request.Request) {
- in := r.Params.(*dynamodb.QueryInput)
- if in == nil {
- tokens = append(tokens, nil)
- } else if len(in.ExclusiveStartKey) != 0 {
- tokens = append(tokens, in.ExclusiveStartKey)
- }
- })
- db.Handlers.Unmarshal.PushBack(func(r *request.Request) {
- r.Data = resps[reqNum]
- reqNum++
- })
-
- params := &dynamodb.QueryInput{
- Limit: aws.Int64(2),
- TableName: aws.String("tablename"),
- }
- err := db.QueryPages(params, func(p *dynamodb.QueryOutput, last bool) bool {
- numPages++
- for _, item := range p.Items {
- pages = append(pages, item)
- }
- if last {
- if gotToEnd {
- assert.Fail(t, "last=true happened twice")
- }
- gotToEnd = true
- }
- return true
- })
- assert.Nil(t, err)
-
- assert.Equal(t,
- []map[string]*dynamodb.AttributeValue{
- {"key": {S: aws.String("key1")}},
- {"key": {S: aws.String("key2")}},
- }, tokens)
- assert.Equal(t,
- []map[string]*dynamodb.AttributeValue{
- {"key": {S: aws.String("key1")}},
- {"key": {S: aws.String("key2")}},
- {"key": {S: aws.String("key3")}},
- }, pages)
- assert.Equal(t, 3, numPages)
- assert.True(t, gotToEnd)
- assert.Nil(t, params.ExclusiveStartKey)
-}
-
-// Use DynamoDB methods for simplicity
-func TestPagination(t *testing.T) {
- db := dynamodb.New(unit.Session)
- tokens, pages, numPages, gotToEnd := []string{}, []string{}, 0, false
-
- reqNum := 0
- resps := []*dynamodb.ListTablesOutput{
- {TableNames: []*string{aws.String("Table1"), aws.String("Table2")}, LastEvaluatedTableName: aws.String("Table2")},
- {TableNames: []*string{aws.String("Table3"), aws.String("Table4")}, LastEvaluatedTableName: aws.String("Table4")},
- {TableNames: []*string{aws.String("Table5")}},
- }
-
- db.Handlers.Send.Clear() // mock sending
- db.Handlers.Unmarshal.Clear()
- db.Handlers.UnmarshalMeta.Clear()
- db.Handlers.ValidateResponse.Clear()
- db.Handlers.Build.PushBack(func(r *request.Request) {
- in := r.Params.(*dynamodb.ListTablesInput)
- if in == nil {
- tokens = append(tokens, "")
- } else if in.ExclusiveStartTableName != nil {
- tokens = append(tokens, *in.ExclusiveStartTableName)
- }
- })
- db.Handlers.Unmarshal.PushBack(func(r *request.Request) {
- r.Data = resps[reqNum]
- reqNum++
- })
-
- params := &dynamodb.ListTablesInput{Limit: aws.Int64(2)}
- err := db.ListTablesPages(params, func(p *dynamodb.ListTablesOutput, last bool) bool {
- numPages++
- for _, t := range p.TableNames {
- pages = append(pages, *t)
- }
- if last {
- if gotToEnd {
- assert.Fail(t, "last=true happened twice")
- }
- gotToEnd = true
- }
- return true
- })
-
- assert.Equal(t, []string{"Table2", "Table4"}, tokens)
- assert.Equal(t, []string{"Table1", "Table2", "Table3", "Table4", "Table5"}, pages)
- assert.Equal(t, 3, numPages)
- assert.True(t, gotToEnd)
- assert.Nil(t, err)
- assert.Nil(t, params.ExclusiveStartTableName)
-}
-
-// Use DynamoDB methods for simplicity
-func TestPaginationEachPage(t *testing.T) {
- db := dynamodb.New(unit.Session)
- tokens, pages, numPages, gotToEnd := []string{}, []string{}, 0, false
-
- reqNum := 0
- resps := []*dynamodb.ListTablesOutput{
- {TableNames: []*string{aws.String("Table1"), aws.String("Table2")}, LastEvaluatedTableName: aws.String("Table2")},
- {TableNames: []*string{aws.String("Table3"), aws.String("Table4")}, LastEvaluatedTableName: aws.String("Table4")},
- {TableNames: []*string{aws.String("Table5")}},
- }
-
- db.Handlers.Send.Clear() // mock sending
- db.Handlers.Unmarshal.Clear()
- db.Handlers.UnmarshalMeta.Clear()
- db.Handlers.ValidateResponse.Clear()
- db.Handlers.Build.PushBack(func(r *request.Request) {
- in := r.Params.(*dynamodb.ListTablesInput)
- if in == nil {
- tokens = append(tokens, "")
- } else if in.ExclusiveStartTableName != nil {
- tokens = append(tokens, *in.ExclusiveStartTableName)
- }
- })
- db.Handlers.Unmarshal.PushBack(func(r *request.Request) {
- r.Data = resps[reqNum]
- reqNum++
- })
-
- params := &dynamodb.ListTablesInput{Limit: aws.Int64(2)}
- req, _ := db.ListTablesRequest(params)
- err := req.EachPage(func(p interface{}, last bool) bool {
- numPages++
- for _, t := range p.(*dynamodb.ListTablesOutput).TableNames {
- pages = append(pages, *t)
- }
- if last {
- if gotToEnd {
- assert.Fail(t, "last=true happened twice")
- }
- gotToEnd = true
- }
-
- return true
- })
-
- assert.Equal(t, []string{"Table2", "Table4"}, tokens)
- assert.Equal(t, []string{"Table1", "Table2", "Table3", "Table4", "Table5"}, pages)
- assert.Equal(t, 3, numPages)
- assert.True(t, gotToEnd)
- assert.Nil(t, err)
-}
-
-// Use DynamoDB methods for simplicity
-func TestPaginationEarlyExit(t *testing.T) {
- db := dynamodb.New(unit.Session)
- numPages, gotToEnd := 0, false
-
- reqNum := 0
- resps := []*dynamodb.ListTablesOutput{
- {TableNames: []*string{aws.String("Table1"), aws.String("Table2")}, LastEvaluatedTableName: aws.String("Table2")},
- {TableNames: []*string{aws.String("Table3"), aws.String("Table4")}, LastEvaluatedTableName: aws.String("Table4")},
- {TableNames: []*string{aws.String("Table5")}},
- }
-
- db.Handlers.Send.Clear() // mock sending
- db.Handlers.Unmarshal.Clear()
- db.Handlers.UnmarshalMeta.Clear()
- db.Handlers.ValidateResponse.Clear()
- db.Handlers.Unmarshal.PushBack(func(r *request.Request) {
- r.Data = resps[reqNum]
- reqNum++
- })
-
- params := &dynamodb.ListTablesInput{Limit: aws.Int64(2)}
- err := db.ListTablesPages(params, func(p *dynamodb.ListTablesOutput, last bool) bool {
- numPages++
- if numPages == 2 {
- return false
- }
- if last {
- if gotToEnd {
- assert.Fail(t, "last=true happened twice")
- }
- gotToEnd = true
- }
- return true
- })
-
- assert.Equal(t, 2, numPages)
- assert.False(t, gotToEnd)
- assert.Nil(t, err)
-}
-
-func TestSkipPagination(t *testing.T) {
- client := s3.New(unit.Session)
- client.Handlers.Send.Clear() // mock sending
- client.Handlers.Unmarshal.Clear()
- client.Handlers.UnmarshalMeta.Clear()
- client.Handlers.ValidateResponse.Clear()
- client.Handlers.Unmarshal.PushBack(func(r *request.Request) {
- r.Data = &s3.HeadBucketOutput{}
- })
-
- req, _ := client.HeadBucketRequest(&s3.HeadBucketInput{Bucket: aws.String("bucket")})
-
- numPages, gotToEnd := 0, false
- req.EachPage(func(p interface{}, last bool) bool {
- numPages++
- if last {
- gotToEnd = true
- }
- return true
- })
- assert.Equal(t, 1, numPages)
- assert.True(t, gotToEnd)
-}
-
-// Use S3 for simplicity
-func TestPaginationTruncation(t *testing.T) {
- client := s3.New(unit.Session)
-
- reqNum := 0
- resps := []*s3.ListObjectsOutput{
- {IsTruncated: aws.Bool(true), Contents: []*s3.Object{{Key: aws.String("Key1")}}},
- {IsTruncated: aws.Bool(true), Contents: []*s3.Object{{Key: aws.String("Key2")}}},
- {IsTruncated: aws.Bool(false), Contents: []*s3.Object{{Key: aws.String("Key3")}}},
- {IsTruncated: aws.Bool(true), Contents: []*s3.Object{{Key: aws.String("Key4")}}},
- }
-
- client.Handlers.Send.Clear() // mock sending
- client.Handlers.Unmarshal.Clear()
- client.Handlers.UnmarshalMeta.Clear()
- client.Handlers.ValidateResponse.Clear()
- client.Handlers.Unmarshal.PushBack(func(r *request.Request) {
- r.Data = resps[reqNum]
- reqNum++
- })
-
- params := &s3.ListObjectsInput{Bucket: aws.String("bucket")}
-
- results := []string{}
- err := client.ListObjectsPages(params, func(p *s3.ListObjectsOutput, last bool) bool {
- results = append(results, *p.Contents[0].Key)
- return true
- })
-
- assert.Equal(t, []string{"Key1", "Key2", "Key3"}, results)
- assert.Nil(t, err)
-
- // Try again without truncation token at all
- reqNum = 0
- resps[1].IsTruncated = nil
- resps[2].IsTruncated = aws.Bool(true)
- results = []string{}
- err = client.ListObjectsPages(params, func(p *s3.ListObjectsOutput, last bool) bool {
- results = append(results, *p.Contents[0].Key)
- return true
- })
-
- assert.Equal(t, []string{"Key1", "Key2"}, results)
- assert.Nil(t, err)
-}
-
-func TestPaginationNilToken(t *testing.T) {
- client := route53.New(unit.Session)
-
- reqNum := 0
- resps := []*route53.ListResourceRecordSetsOutput{
- {
- ResourceRecordSets: []*route53.ResourceRecordSet{
- {Name: aws.String("first.example.com.")},
- },
- IsTruncated: aws.Bool(true),
- NextRecordName: aws.String("second.example.com."),
- NextRecordType: aws.String("MX"),
- NextRecordIdentifier: aws.String("second"),
- MaxItems: aws.String("1"),
- },
- {
- ResourceRecordSets: []*route53.ResourceRecordSet{
- {Name: aws.String("second.example.com.")},
- },
- IsTruncated: aws.Bool(true),
- NextRecordName: aws.String("third.example.com."),
- NextRecordType: aws.String("MX"),
- MaxItems: aws.String("1"),
- },
- {
- ResourceRecordSets: []*route53.ResourceRecordSet{
- {Name: aws.String("third.example.com.")},
- },
- IsTruncated: aws.Bool(false),
- MaxItems: aws.String("1"),
- },
- }
- client.Handlers.Send.Clear() // mock sending
- client.Handlers.Unmarshal.Clear()
- client.Handlers.UnmarshalMeta.Clear()
- client.Handlers.ValidateResponse.Clear()
-
- idents := []string{}
- client.Handlers.Build.PushBack(func(r *request.Request) {
- p := r.Params.(*route53.ListResourceRecordSetsInput)
- idents = append(idents, aws.StringValue(p.StartRecordIdentifier))
-
- })
- client.Handlers.Unmarshal.PushBack(func(r *request.Request) {
- r.Data = resps[reqNum]
- reqNum++
- })
-
- params := &route53.ListResourceRecordSetsInput{
- HostedZoneId: aws.String("id-zone"),
- }
-
- results := []string{}
- err := client.ListResourceRecordSetsPages(params, func(p *route53.ListResourceRecordSetsOutput, last bool) bool {
- results = append(results, *p.ResourceRecordSets[0].Name)
- return true
- })
-
- assert.NoError(t, err)
- assert.Equal(t, []string{"", "second", ""}, idents)
- assert.Equal(t, []string{"first.example.com.", "second.example.com.", "third.example.com."}, results)
-}
-
-func TestPaginationNilInput(t *testing.T) {
- // Code generation doesn't have a great way to verify the code is correct
- // other than being run via unit tests in the SDK. This should be fixed
- // So code generation can be validated independently.
-
- client := s3.New(unit.Session)
- client.Handlers.Validate.Clear()
- client.Handlers.Send.Clear() // mock sending
- client.Handlers.Unmarshal.Clear()
- client.Handlers.UnmarshalMeta.Clear()
- client.Handlers.ValidateResponse.Clear()
- client.Handlers.Unmarshal.PushBack(func(r *request.Request) {
- r.Data = &s3.ListObjectsOutput{}
- })
-
- gotToEnd := false
- numPages := 0
- err := client.ListObjectsPages(nil, func(p *s3.ListObjectsOutput, last bool) bool {
- numPages++
- if last {
- gotToEnd = true
- }
- return true
- })
-
- if err != nil {
- t.Fatalf("expect no error, but got %v", err)
- }
- if e, a := 1, numPages; e != a {
- t.Errorf("expect %d number pages but got %d", e, a)
- }
- if !gotToEnd {
- t.Errorf("expect to of gotten to end, did not")
- }
-}
-
-func TestPaginationWithContextNilInput(t *testing.T) {
- // Code generation doesn't have a great way to verify the code is correct
- // other than being run via unit tests in the SDK. This should be fixed
- // So code generation can be validated independently.
-
- client := s3.New(unit.Session)
- client.Handlers.Validate.Clear()
- client.Handlers.Send.Clear() // mock sending
- client.Handlers.Unmarshal.Clear()
- client.Handlers.UnmarshalMeta.Clear()
- client.Handlers.ValidateResponse.Clear()
- client.Handlers.Unmarshal.PushBack(func(r *request.Request) {
- r.Data = &s3.ListObjectsOutput{}
- })
-
- gotToEnd := false
- numPages := 0
- ctx := &awstesting.FakeContext{DoneCh: make(chan struct{})}
- err := client.ListObjectsPagesWithContext(ctx, nil, func(p *s3.ListObjectsOutput, last bool) bool {
- numPages++
- if last {
- gotToEnd = true
- }
- return true
- })
-
- if err != nil {
- t.Fatalf("expect no error, but got %v", err)
- }
- if e, a := 1, numPages; e != a {
- t.Errorf("expect %d number pages but got %d", e, a)
- }
- if !gotToEnd {
- t.Errorf("expect to of gotten to end, did not")
- }
-}
-
-func TestPagination_Standalone(t *testing.T) {
- type testPageInput struct {
- NextToken *string
- }
- type testPageOutput struct {
- Value *string
- NextToken *string
- }
- type testCase struct {
- Value, PrevToken, NextToken *string
- }
-
- type testCaseList struct {
- StopOnSameToken bool
- Cases []testCase
- }
-
- cases := []testCaseList{
- {
- Cases: []testCase{
- testCase{aws.String("FirstValue"), aws.String("InitalToken"), aws.String("FirstToken")},
- testCase{aws.String("SecondValue"), aws.String("FirstToken"), aws.String("SecondToken")},
- testCase{aws.String("ThirdValue"), aws.String("SecondToken"), nil},
- },
- StopOnSameToken: false,
- },
- {
- Cases: []testCase{
- testCase{aws.String("FirstValue"), aws.String("InitalToken"), aws.String("FirstToken")},
- testCase{aws.String("SecondValue"), aws.String("FirstToken"), aws.String("SecondToken")},
- testCase{aws.String("ThirdValue"), aws.String("SecondToken"), aws.String("")},
- },
- StopOnSameToken: false,
- },
- {
- Cases: []testCase{
- testCase{aws.String("FirstValue"), aws.String("InitalToken"), aws.String("FirstToken")},
- testCase{aws.String("SecondValue"), aws.String("FirstToken"), aws.String("SecondToken")},
- testCase{nil, aws.String("SecondToken"), aws.String("SecondToken")},
- },
- StopOnSameToken: true,
- },
- {
- Cases: []testCase{
- testCase{aws.String("FirstValue"), aws.String("InitalToken"), aws.String("FirstToken")},
- testCase{aws.String("SecondValue"), aws.String("FirstToken"), aws.String("SecondToken")},
- testCase{aws.String("SecondValue"), aws.String("SecondToken"), aws.String("SecondToken")},
- },
- StopOnSameToken: true,
- },
- }
-
- for _, testcase := range cases {
- c := testcase.Cases
- input := testPageInput{
- NextToken: c[0].PrevToken,
- }
-
- svc := awstesting.NewClient()
- i := 0
- p := request.Pagination{
- EndPageOnSameToken: testcase.StopOnSameToken,
- NewRequest: func() (*request.Request, error) {
- r := svc.NewRequest(
- &request.Operation{
- Name: "Operation",
- Paginator: &request.Paginator{
- InputTokens: []string{"NextToken"},
- OutputTokens: []string{"NextToken"},
- },
- },
- &input, &testPageOutput{},
- )
- // Setup handlers for testing
- r.Handlers.Clear()
- r.Handlers.Build.PushBack(func(req *request.Request) {
- if e, a := len(c), i+1; a > e {
- t.Fatalf("expect no more than %d requests, got %d", e, a)
- }
- in := req.Params.(*testPageInput)
- if e, a := aws.StringValue(c[i].PrevToken), aws.StringValue(in.NextToken); e != a {
- t.Errorf("%d, expect NextToken input %q, got %q", i, e, a)
- }
- })
- r.Handlers.Unmarshal.PushBack(func(req *request.Request) {
- out := &testPageOutput{
- Value: c[i].Value,
- }
- if c[i].NextToken != nil {
- next := *c[i].NextToken
- out.NextToken = aws.String(next)
- }
- req.Data = out
- })
- return r, nil
- },
- }
-
- for p.Next() {
- data := p.Page().(*testPageOutput)
-
- if e, a := aws.StringValue(c[i].Value), aws.StringValue(data.Value); e != a {
- t.Errorf("%d, expect Value to be %q, got %q", i, e, a)
- }
- if e, a := aws.StringValue(c[i].NextToken), aws.StringValue(data.NextToken); e != a {
- t.Errorf("%d, expect NextToken to be %q, got %q", i, e, a)
- }
-
- i++
- }
- if e, a := len(c), i; e != a {
- t.Errorf("expected to process %d pages, did %d", e, a)
- }
- if err := p.Err(); err != nil {
- t.Fatalf("%d, expected no error, got %v", i, err)
- }
- }
-}
-
-// Benchmarks
-var benchResps = []*dynamodb.ListTablesOutput{
- {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
- {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
- {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
- {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
- {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
- {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
- {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
- {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
- {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
- {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
- {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
- {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
- {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
- {TableNames: []*string{aws.String("TABLE")}},
-}
-
-var benchDb = func() *dynamodb.DynamoDB {
- db := dynamodb.New(unit.Session)
- db.Handlers.Send.Clear() // mock sending
- db.Handlers.Unmarshal.Clear()
- db.Handlers.UnmarshalMeta.Clear()
- db.Handlers.ValidateResponse.Clear()
- return db
-}
-
-func BenchmarkCodegenIterator(b *testing.B) {
- reqNum := 0
- db := benchDb()
- db.Handlers.Unmarshal.PushBack(func(r *request.Request) {
- r.Data = benchResps[reqNum]
- reqNum++
- })
-
- input := &dynamodb.ListTablesInput{Limit: aws.Int64(2)}
- iter := func(fn func(*dynamodb.ListTablesOutput, bool) bool) error {
- page, _ := db.ListTablesRequest(input)
- for ; page != nil; page = page.NextPage() {
- page.Send()
- out := page.Data.(*dynamodb.ListTablesOutput)
- if result := fn(out, !page.HasNextPage()); page.Error != nil || !result {
- return page.Error
- }
- }
- return nil
- }
-
- for i := 0; i < b.N; i++ {
- reqNum = 0
- iter(func(p *dynamodb.ListTablesOutput, last bool) bool {
- return true
- })
- }
-}
-
-func BenchmarkEachPageIterator(b *testing.B) {
- reqNum := 0
- db := benchDb()
- db.Handlers.Unmarshal.PushBack(func(r *request.Request) {
- r.Data = benchResps[reqNum]
- reqNum++
- })
-
- input := &dynamodb.ListTablesInput{Limit: aws.Int64(2)}
- for i := 0; i < b.N; i++ {
- reqNum = 0
- req, _ := db.ListTablesRequest(input)
- req.EachPage(func(p interface{}, last bool) bool {
- return true
- })
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_resetbody_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_resetbody_test.go
deleted file mode 100644
index d7845b752..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_resetbody_test.go
+++ /dev/null
@@ -1,107 +0,0 @@
-package request
-
-import (
- "bytes"
- "io"
- "net/http"
- "strings"
- "testing"
-
- "github.com/aws/aws-sdk-go/aws"
-)
-
-func TestResetBody_WithBodyContents(t *testing.T) {
- r := Request{
- HTTPRequest: &http.Request{},
- }
-
- reader := strings.NewReader("abc")
- r.Body = reader
-
- r.ResetBody()
-
- if v, ok := r.HTTPRequest.Body.(*offsetReader); !ok || v == nil {
- t.Errorf("expected request body to be set to reader, got %#v",
- r.HTTPRequest.Body)
- }
-}
-
-type mockReader struct{}
-
-func (mockReader) Read([]byte) (int, error) {
- return 0, io.EOF
-}
-
-func TestResetBody_ExcludeEmptyUnseekableBodyByMethod(t *testing.T) {
- cases := []struct {
- Method string
- Body io.ReadSeeker
- IsNoBody bool
- }{
- {
- Method: "GET",
- IsNoBody: true,
- Body: aws.ReadSeekCloser(mockReader{}),
- },
- {
- Method: "HEAD",
- IsNoBody: true,
- Body: aws.ReadSeekCloser(mockReader{}),
- },
- {
- Method: "DELETE",
- IsNoBody: true,
- Body: aws.ReadSeekCloser(mockReader{}),
- },
- {
- Method: "PUT",
- IsNoBody: false,
- Body: aws.ReadSeekCloser(mockReader{}),
- },
- {
- Method: "PATCH",
- IsNoBody: false,
- Body: aws.ReadSeekCloser(mockReader{}),
- },
- {
- Method: "POST",
- IsNoBody: false,
- Body: aws.ReadSeekCloser(mockReader{}),
- },
- {
- Method: "GET",
- IsNoBody: false,
- Body: aws.ReadSeekCloser(bytes.NewBuffer([]byte("abc"))),
- },
- {
- Method: "GET",
- IsNoBody: true,
- Body: aws.ReadSeekCloser(bytes.NewBuffer(nil)),
- },
- {
- Method: "POST",
- IsNoBody: false,
- Body: aws.ReadSeekCloser(bytes.NewBuffer([]byte("abc"))),
- },
- {
- Method: "POST",
- IsNoBody: true,
- Body: aws.ReadSeekCloser(bytes.NewBuffer(nil)),
- },
- }
-
- for i, c := range cases {
- r := Request{
- HTTPRequest: &http.Request{},
- Operation: &Operation{
- HTTPMethod: c.Method,
- },
- }
- r.SetReaderBody(c.Body)
-
- if a, e := r.HTTPRequest.Body == NoBody, c.IsNoBody; a != e {
- t.Errorf("%d, expect body to be set to noBody(%t), but was %t", i, e, a)
- }
- }
-
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_test.go
deleted file mode 100644
index 0e4cef06b..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_test.go
+++ /dev/null
@@ -1,1121 +0,0 @@
-package request_test
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "io"
- "io/ioutil"
- "net/http"
- "net/http/httptest"
- "net/url"
- "reflect"
- "runtime"
- "strconv"
- "strings"
- "testing"
- "time"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/awserr"
- "github.com/aws/aws-sdk-go/aws/client"
- "github.com/aws/aws-sdk-go/aws/client/metadata"
- "github.com/aws/aws-sdk-go/aws/corehandlers"
- "github.com/aws/aws-sdk-go/aws/credentials"
- "github.com/aws/aws-sdk-go/aws/defaults"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/aws/signer/v4"
- "github.com/aws/aws-sdk-go/awstesting"
- "github.com/aws/aws-sdk-go/awstesting/unit"
- "github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
- "github.com/aws/aws-sdk-go/private/protocol/rest"
-)
-
-type testData struct {
- Data string
-}
-
-func body(str string) io.ReadCloser {
- return ioutil.NopCloser(bytes.NewReader([]byte(str)))
-}
-
-func unmarshal(req *request.Request) {
- defer req.HTTPResponse.Body.Close()
- if req.Data != nil {
- json.NewDecoder(req.HTTPResponse.Body).Decode(req.Data)
- }
- return
-}
-
-func unmarshalError(req *request.Request) {
- bodyBytes, err := ioutil.ReadAll(req.HTTPResponse.Body)
- if err != nil {
- req.Error = awserr.New("UnmarshaleError", req.HTTPResponse.Status, err)
- return
- }
- if len(bodyBytes) == 0 {
- req.Error = awserr.NewRequestFailure(
- awserr.New("UnmarshaleError", req.HTTPResponse.Status, fmt.Errorf("empty body")),
- req.HTTPResponse.StatusCode,
- "",
- )
- return
- }
- var jsonErr jsonErrorResponse
- if err := json.Unmarshal(bodyBytes, &jsonErr); err != nil {
- req.Error = awserr.New("UnmarshaleError", "JSON unmarshal", err)
- return
- }
- req.Error = awserr.NewRequestFailure(
- awserr.New(jsonErr.Code, jsonErr.Message, nil),
- req.HTTPResponse.StatusCode,
- "",
- )
-}
-
-type jsonErrorResponse struct {
- Code string `json:"__type"`
- Message string `json:"message"`
-}
-
-// test that retries occur for 5xx status codes
-func TestRequestRecoverRetry5xx(t *testing.T) {
- reqNum := 0
- reqs := []http.Response{
- {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)},
- {StatusCode: 502, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)},
- {StatusCode: 200, Body: body(`{"data":"valid"}`)},
- }
-
- s := awstesting.NewClient(aws.NewConfig().WithMaxRetries(10))
- s.Handlers.Validate.Clear()
- s.Handlers.Unmarshal.PushBack(unmarshal)
- s.Handlers.UnmarshalError.PushBack(unmarshalError)
- s.Handlers.Send.Clear() // mock sending
- s.Handlers.Send.PushBack(func(r *request.Request) {
- r.HTTPResponse = &reqs[reqNum]
- reqNum++
- })
- out := &testData{}
- r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out)
- err := r.Send()
- if err != nil {
- t.Fatalf("expect no error, but got %v", err)
- }
- if e, a := 2, int(r.RetryCount); e != a {
- t.Errorf("expect %d retry count, got %d", e, a)
- }
- if e, a := "valid", out.Data; e != a {
- t.Errorf("expect %q output got %q", e, a)
- }
-}
-
-// test that retries occur for 4xx status codes with a response type that can be retried - see `shouldRetry`
-func TestRequestRecoverRetry4xxRetryable(t *testing.T) {
- reqNum := 0
- reqs := []http.Response{
- {StatusCode: 400, Body: body(`{"__type":"Throttling","message":"Rate exceeded."}`)},
- {StatusCode: 400, Body: body(`{"__type":"ProvisionedThroughputExceededException","message":"Rate exceeded."}`)},
- {StatusCode: 429, Body: body(`{"__type":"FooException","message":"Rate exceeded."}`)},
- {StatusCode: 200, Body: body(`{"data":"valid"}`)},
- }
-
- s := awstesting.NewClient(aws.NewConfig().WithMaxRetries(10))
- s.Handlers.Validate.Clear()
- s.Handlers.Unmarshal.PushBack(unmarshal)
- s.Handlers.UnmarshalError.PushBack(unmarshalError)
- s.Handlers.Send.Clear() // mock sending
- s.Handlers.Send.PushBack(func(r *request.Request) {
- r.HTTPResponse = &reqs[reqNum]
- reqNum++
- })
- out := &testData{}
- r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out)
- err := r.Send()
- if err != nil {
- t.Fatalf("expect no error, but got %v", err)
- }
- if e, a := 3, int(r.RetryCount); e != a {
- t.Errorf("expect %d retry count, got %d", e, a)
- }
- if e, a := "valid", out.Data; e != a {
- t.Errorf("expect %q output got %q", e, a)
- }
-}
-
-// test that retries don't occur for 4xx status codes with a response type that can't be retried
-func TestRequest4xxUnretryable(t *testing.T) {
- s := awstesting.NewClient(aws.NewConfig().WithMaxRetries(10))
- s.Handlers.Validate.Clear()
- s.Handlers.Unmarshal.PushBack(unmarshal)
- s.Handlers.UnmarshalError.PushBack(unmarshalError)
- s.Handlers.Send.Clear() // mock sending
- s.Handlers.Send.PushBack(func(r *request.Request) {
- r.HTTPResponse = &http.Response{StatusCode: 401, Body: body(`{"__type":"SignatureDoesNotMatch","message":"Signature does not match."}`)}
- })
- out := &testData{}
- r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out)
- err := r.Send()
- if err == nil {
- t.Fatalf("expect error, but did not get one")
- }
- aerr := err.(awserr.RequestFailure)
- if e, a := 401, aerr.StatusCode(); e != a {
- t.Errorf("expect %d status code, got %d", e, a)
- }
- if e, a := "SignatureDoesNotMatch", aerr.Code(); e != a {
- t.Errorf("expect %q error code, got %q", e, a)
- }
- if e, a := "Signature does not match.", aerr.Message(); e != a {
- t.Errorf("expect %q error message, got %q", e, a)
- }
- if e, a := 0, int(r.RetryCount); e != a {
- t.Errorf("expect %d retry count, got %d", e, a)
- }
-}
-
-func TestRequestExhaustRetries(t *testing.T) {
- delays := []time.Duration{}
- sleepDelay := func(delay time.Duration) {
- delays = append(delays, delay)
- }
-
- reqNum := 0
- reqs := []http.Response{
- {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)},
- {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)},
- {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)},
- {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)},
- }
-
- s := awstesting.NewClient(aws.NewConfig().WithSleepDelay(sleepDelay))
- s.Handlers.Validate.Clear()
- s.Handlers.Unmarshal.PushBack(unmarshal)
- s.Handlers.UnmarshalError.PushBack(unmarshalError)
- s.Handlers.Send.Clear() // mock sending
- s.Handlers.Send.PushBack(func(r *request.Request) {
- r.HTTPResponse = &reqs[reqNum]
- reqNum++
- })
- r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, nil)
- err := r.Send()
- if err == nil {
- t.Fatalf("expect error, but did not get one")
- }
- aerr := err.(awserr.RequestFailure)
- if e, a := 500, aerr.StatusCode(); e != a {
- t.Errorf("expect %d status code, got %d", e, a)
- }
- if e, a := "UnknownError", aerr.Code(); e != a {
- t.Errorf("expect %q error code, got %q", e, a)
- }
- if e, a := "An error occurred.", aerr.Message(); e != a {
- t.Errorf("expect %q error message, got %q", e, a)
- }
- if e, a := 3, int(r.RetryCount); e != a {
- t.Errorf("expect %d retry count, got %d", e, a)
- }
-
- expectDelays := []struct{ min, max time.Duration }{{30, 59}, {60, 118}, {120, 236}}
- for i, v := range delays {
- min := expectDelays[i].min * time.Millisecond
- max := expectDelays[i].max * time.Millisecond
- if !(min <= v && v <= max) {
- t.Errorf("Expect delay to be within range, i:%d, v:%s, min:%s, max:%s",
- i, v, min, max)
- }
- }
-}
-
-// test that the request is retried after the credentials are expired.
-func TestRequestRecoverExpiredCreds(t *testing.T) {
- reqNum := 0
- reqs := []http.Response{
- {StatusCode: 400, Body: body(`{"__type":"ExpiredTokenException","message":"expired token"}`)},
- {StatusCode: 200, Body: body(`{"data":"valid"}`)},
- }
-
- s := awstesting.NewClient(&aws.Config{MaxRetries: aws.Int(10), Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "")})
- s.Handlers.Validate.Clear()
- s.Handlers.Unmarshal.PushBack(unmarshal)
- s.Handlers.UnmarshalError.PushBack(unmarshalError)
-
- credExpiredBeforeRetry := false
- credExpiredAfterRetry := false
-
- s.Handlers.AfterRetry.PushBack(func(r *request.Request) {
- credExpiredAfterRetry = r.Config.Credentials.IsExpired()
- })
-
- s.Handlers.Sign.Clear()
- s.Handlers.Sign.PushBack(func(r *request.Request) {
- r.Config.Credentials.Get()
- })
- s.Handlers.Send.Clear() // mock sending
- s.Handlers.Send.PushBack(func(r *request.Request) {
- r.HTTPResponse = &reqs[reqNum]
- reqNum++
- })
- out := &testData{}
- r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out)
- err := r.Send()
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- if credExpiredBeforeRetry {
- t.Errorf("Expect valid creds before retry check")
- }
- if !credExpiredAfterRetry {
- t.Errorf("Expect expired creds after retry check")
- }
- if s.Config.Credentials.IsExpired() {
- t.Errorf("Expect valid creds after cred expired recovery")
- }
-
- if e, a := 1, int(r.RetryCount); e != a {
- t.Errorf("expect %d retry count, got %d", e, a)
- }
- if e, a := "valid", out.Data; e != a {
- t.Errorf("expect %q output got %q", e, a)
- }
-}
-
-func TestMakeAddtoUserAgentHandler(t *testing.T) {
- fn := request.MakeAddToUserAgentHandler("name", "version", "extra1", "extra2")
- r := &request.Request{HTTPRequest: &http.Request{Header: http.Header{}}}
- r.HTTPRequest.Header.Set("User-Agent", "foo/bar")
- fn(r)
-
- if e, a := "foo/bar name/version (extra1; extra2)", r.HTTPRequest.Header.Get("User-Agent"); e != a {
- t.Errorf("expect %q user agent, got %q", e, a)
- }
-}
-
-func TestMakeAddtoUserAgentFreeFormHandler(t *testing.T) {
- fn := request.MakeAddToUserAgentFreeFormHandler("name/version (extra1; extra2)")
- r := &request.Request{HTTPRequest: &http.Request{Header: http.Header{}}}
- r.HTTPRequest.Header.Set("User-Agent", "foo/bar")
- fn(r)
-
- if e, a := "foo/bar name/version (extra1; extra2)", r.HTTPRequest.Header.Get("User-Agent"); e != a {
- t.Errorf("expect %q user agent, got %q", e, a)
- }
-}
-
-func TestRequestUserAgent(t *testing.T) {
- s := awstesting.NewClient(&aws.Config{Region: aws.String("us-east-1")})
- // s.Handlers.Validate.Clear()
-
- req := s.NewRequest(&request.Operation{Name: "Operation"}, nil, &testData{})
- req.HTTPRequest.Header.Set("User-Agent", "foo/bar")
- if err := req.Build(); err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- expectUA := fmt.Sprintf("foo/bar %s/%s (%s; %s; %s)",
- aws.SDKName, aws.SDKVersion, runtime.Version(), runtime.GOOS, runtime.GOARCH)
- if e, a := expectUA, req.HTTPRequest.Header.Get("User-Agent"); e != a {
- t.Errorf("expect %q user agent, got %q", e, a)
- }
-}
-
-func TestRequestThrottleRetries(t *testing.T) {
- delays := []time.Duration{}
- sleepDelay := func(delay time.Duration) {
- delays = append(delays, delay)
- }
-
- reqNum := 0
- reqs := []http.Response{
- {StatusCode: 500, Body: body(`{"__type":"Throttling","message":"An error occurred."}`)},
- {StatusCode: 500, Body: body(`{"__type":"Throttling","message":"An error occurred."}`)},
- {StatusCode: 500, Body: body(`{"__type":"Throttling","message":"An error occurred."}`)},
- {StatusCode: 500, Body: body(`{"__type":"Throttling","message":"An error occurred."}`)},
- }
-
- s := awstesting.NewClient(aws.NewConfig().WithSleepDelay(sleepDelay))
- s.Handlers.Validate.Clear()
- s.Handlers.Unmarshal.PushBack(unmarshal)
- s.Handlers.UnmarshalError.PushBack(unmarshalError)
- s.Handlers.Send.Clear() // mock sending
- s.Handlers.Send.PushBack(func(r *request.Request) {
- r.HTTPResponse = &reqs[reqNum]
- reqNum++
- })
- r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, nil)
- err := r.Send()
- if err == nil {
- t.Fatalf("expect error, but did not get one")
- }
- aerr := err.(awserr.RequestFailure)
- if e, a := 500, aerr.StatusCode(); e != a {
- t.Errorf("expect %d status code, got %d", e, a)
- }
- if e, a := "Throttling", aerr.Code(); e != a {
- t.Errorf("expect %q error code, got %q", e, a)
- }
- if e, a := "An error occurred.", aerr.Message(); e != a {
- t.Errorf("expect %q error message, got %q", e, a)
- }
- if e, a := 3, int(r.RetryCount); e != a {
- t.Errorf("expect %d retry count, got %d", e, a)
- }
-
- expectDelays := []struct{ min, max time.Duration }{{500, 999}, {1000, 1998}, {2000, 3996}}
- for i, v := range delays {
- min := expectDelays[i].min * time.Millisecond
- max := expectDelays[i].max * time.Millisecond
- if !(min <= v && v <= max) {
- t.Errorf("Expect delay to be within range, i:%d, v:%s, min:%s, max:%s",
- i, v, min, max)
- }
- }
-}
-
-// test that retries occur for request timeouts when response.Body can be nil
-func TestRequestRecoverTimeoutWithNilBody(t *testing.T) {
- reqNum := 0
- reqs := []*http.Response{
- {StatusCode: 0, Body: nil}, // body can be nil when requests time out
- {StatusCode: 200, Body: body(`{"data":"valid"}`)},
- }
- errors := []error{
- errTimeout, nil,
- }
-
- s := awstesting.NewClient(aws.NewConfig().WithMaxRetries(10))
- s.Handlers.Validate.Clear()
- s.Handlers.Unmarshal.PushBack(unmarshal)
- s.Handlers.UnmarshalError.PushBack(unmarshalError)
- s.Handlers.AfterRetry.Clear() // force retry on all errors
- s.Handlers.AfterRetry.PushBack(func(r *request.Request) {
- if r.Error != nil {
- r.Error = nil
- r.Retryable = aws.Bool(true)
- r.RetryCount++
- }
- })
- s.Handlers.Send.Clear() // mock sending
- s.Handlers.Send.PushBack(func(r *request.Request) {
- r.HTTPResponse = reqs[reqNum]
- r.Error = errors[reqNum]
- reqNum++
- })
- out := &testData{}
- r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out)
- err := r.Send()
- if err != nil {
- t.Fatalf("expect no error, but got %v", err)
- }
- if e, a := 1, int(r.RetryCount); e != a {
- t.Errorf("expect %d retry count, got %d", e, a)
- }
- if e, a := "valid", out.Data; e != a {
- t.Errorf("expect %q output got %q", e, a)
- }
-}
-
-func TestRequestRecoverTimeoutWithNilResponse(t *testing.T) {
- reqNum := 0
- reqs := []*http.Response{
- nil,
- {StatusCode: 200, Body: body(`{"data":"valid"}`)},
- }
- errors := []error{
- errTimeout,
- nil,
- }
-
- s := awstesting.NewClient(aws.NewConfig().WithMaxRetries(10))
- s.Handlers.Validate.Clear()
- s.Handlers.Unmarshal.PushBack(unmarshal)
- s.Handlers.UnmarshalError.PushBack(unmarshalError)
- s.Handlers.AfterRetry.Clear() // force retry on all errors
- s.Handlers.AfterRetry.PushBack(func(r *request.Request) {
- if r.Error != nil {
- r.Error = nil
- r.Retryable = aws.Bool(true)
- r.RetryCount++
- }
- })
- s.Handlers.Send.Clear() // mock sending
- s.Handlers.Send.PushBack(func(r *request.Request) {
- r.HTTPResponse = reqs[reqNum]
- r.Error = errors[reqNum]
- reqNum++
- })
- out := &testData{}
- r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out)
- err := r.Send()
- if err != nil {
- t.Fatalf("expect no error, but got %v", err)
- }
- if e, a := 1, int(r.RetryCount); e != a {
- t.Errorf("expect %d retry count, got %d", e, a)
- }
- if e, a := "valid", out.Data; e != a {
- t.Errorf("expect %q output got %q", e, a)
- }
-}
-
-func TestRequest_NoBody(t *testing.T) {
- cases := []string{
- "GET", "HEAD", "DELETE",
- "PUT", "POST", "PATCH",
- }
-
- for i, c := range cases {
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- if v := r.TransferEncoding; len(v) > 0 {
- t.Errorf("%d, expect no body sent with Transfer-Encoding, %v", i, v)
- }
-
- outMsg := []byte(`{"Value": "abc"}`)
-
- if b, err := ioutil.ReadAll(r.Body); err != nil {
- t.Fatalf("%d, expect no error reading request body, got %v", i, err)
- } else if n := len(b); n > 0 {
- t.Errorf("%d, expect no request body, got %d bytes", i, n)
- }
-
- w.Header().Set("Content-Length", strconv.Itoa(len(outMsg)))
- if _, err := w.Write(outMsg); err != nil {
- t.Fatalf("%d, expect no error writing server response, got %v", i, err)
- }
- }))
-
- s := awstesting.NewClient(&aws.Config{
- Region: aws.String("mock-region"),
- MaxRetries: aws.Int(0),
- Endpoint: aws.String(server.URL),
- DisableSSL: aws.Bool(true),
- })
- s.Handlers.Build.PushBack(rest.Build)
- s.Handlers.Validate.Clear()
- s.Handlers.Unmarshal.PushBack(unmarshal)
- s.Handlers.UnmarshalError.PushBack(unmarshalError)
-
- in := struct {
- Bucket *string `location:"uri" locationName:"bucket"`
- Key *string `location:"uri" locationName:"key"`
- }{
- Bucket: aws.String("mybucket"), Key: aws.String("myKey"),
- }
-
- out := struct {
- Value *string
- }{}
-
- r := s.NewRequest(&request.Operation{
- Name: "OpName", HTTPMethod: c, HTTPPath: "/{bucket}/{key+}",
- }, &in, &out)
-
- if err := r.Send(); err != nil {
- t.Fatalf("%d, expect no error sending request, got %v", i, err)
- }
- }
-}
-
-func TestIsSerializationErrorRetryable(t *testing.T) {
- testCases := []struct {
- err error
- expected bool
- }{
- {
- err: awserr.New(request.ErrCodeSerialization, "foo error", nil),
- expected: false,
- },
- {
- err: awserr.New("ErrFoo", "foo error", nil),
- expected: false,
- },
- {
- err: nil,
- expected: false,
- },
- {
- err: awserr.New(request.ErrCodeSerialization, "foo error", stubConnectionResetError),
- expected: true,
- },
- }
-
- for i, c := range testCases {
- r := &request.Request{
- Error: c.err,
- }
- if r.IsErrorRetryable() != c.expected {
- t.Errorf("Case %d: Expected %v, but received %v", i+1, c.expected, !c.expected)
- }
- }
-}
-
-func TestWithLogLevel(t *testing.T) {
- r := &request.Request{}
-
- opt := request.WithLogLevel(aws.LogDebugWithHTTPBody)
- r.ApplyOptions(opt)
-
- if !r.Config.LogLevel.Matches(aws.LogDebugWithHTTPBody) {
- t.Errorf("expect log level to be set, but was not, %v",
- r.Config.LogLevel.Value())
- }
-}
-
-func TestWithGetResponseHeader(t *testing.T) {
- r := &request.Request{}
-
- var val, val2 string
- r.ApplyOptions(
- request.WithGetResponseHeader("x-a-header", &val),
- request.WithGetResponseHeader("x-second-header", &val2),
- )
-
- r.HTTPResponse = &http.Response{
- Header: func() http.Header {
- h := http.Header{}
- h.Set("x-a-header", "first")
- h.Set("x-second-header", "second")
- return h
- }(),
- }
- r.Handlers.Complete.Run(r)
-
- if e, a := "first", val; e != a {
- t.Errorf("expect %q header value got %q", e, a)
- }
- if e, a := "second", val2; e != a {
- t.Errorf("expect %q header value got %q", e, a)
- }
-}
-
-func TestWithGetResponseHeaders(t *testing.T) {
- r := &request.Request{}
-
- var headers http.Header
- opt := request.WithGetResponseHeaders(&headers)
-
- r.ApplyOptions(opt)
-
- r.HTTPResponse = &http.Response{
- Header: func() http.Header {
- h := http.Header{}
- h.Set("x-a-header", "headerValue")
- return h
- }(),
- }
- r.Handlers.Complete.Run(r)
-
- if e, a := "headerValue", headers.Get("x-a-header"); e != a {
- t.Errorf("expect %q header value got %q", e, a)
- }
-}
-
-type connResetCloser struct {
-}
-
-func (rc *connResetCloser) Read(b []byte) (int, error) {
- return 0, stubConnectionResetError
-}
-
-func (rc *connResetCloser) Close() error {
- return nil
-}
-
-func TestSerializationErrConnectionReset(t *testing.T) {
- count := 0
- handlers := request.Handlers{}
- handlers.Send.PushBack(func(r *request.Request) {
- count++
- r.HTTPResponse = &http.Response{}
- r.HTTPResponse.Body = &connResetCloser{}
- })
-
- handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
- handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
- handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
- handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
- handlers.AfterRetry.PushBackNamed(corehandlers.AfterRetryHandler)
-
- op := &request.Operation{
- Name: "op",
- HTTPMethod: "POST",
- HTTPPath: "/",
- }
-
- meta := metadata.ClientInfo{
- ServiceName: "fooService",
- SigningName: "foo",
- SigningRegion: "foo",
- Endpoint: "localhost",
- APIVersion: "2001-01-01",
- JSONVersion: "1.1",
- TargetPrefix: "Foo",
- }
- cfg := unit.Session.Config.Copy()
- cfg.MaxRetries = aws.Int(5)
-
- req := request.New(
- *cfg,
- meta,
- handlers,
- client.DefaultRetryer{NumMaxRetries: 5},
- op,
- &struct {
- }{},
- &struct {
- }{},
- )
-
- osErr := stubConnectionResetError
- req.ApplyOptions(request.WithResponseReadTimeout(time.Second))
- err := req.Send()
- if err == nil {
- t.Error("Expected rror 'SerializationError', but received nil")
- }
- if aerr, ok := err.(awserr.Error); ok && aerr.Code() != "SerializationError" {
- t.Errorf("Expected 'SerializationError', but received %q", aerr.Code())
- } else if !ok {
- t.Errorf("Expected 'awserr.Error', but received %v", reflect.TypeOf(err))
- } else if aerr.OrigErr().Error() != osErr.Error() {
- t.Errorf("Expected %q, but received %q", osErr.Error(), aerr.OrigErr().Error())
- }
-
- if count != 6 {
- t.Errorf("Expected '6', but received %d", count)
- }
-}
-
-type testRetryer struct {
- shouldRetry bool
-}
-
-func (d *testRetryer) MaxRetries() int {
- return 3
-}
-
-// RetryRules returns the delay duration before retrying this request again
-func (d *testRetryer) RetryRules(r *request.Request) time.Duration {
- return time.Duration(time.Millisecond)
-}
-
-func (d *testRetryer) ShouldRetry(r *request.Request) bool {
- d.shouldRetry = true
- if r.Retryable != nil {
- return *r.Retryable
- }
-
- if r.HTTPResponse.StatusCode >= 500 {
- return true
- }
- return r.IsErrorRetryable()
-}
-
-func TestEnforceShouldRetryCheck(t *testing.T) {
- tp := &http.Transport{
- Proxy: http.ProxyFromEnvironment,
- ResponseHeaderTimeout: 1 * time.Millisecond,
- }
-
- client := &http.Client{Transport: tp}
-
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- // This server should wait forever. Requests will timeout and the SDK should
- // attempt to retry.
- select {}
- }))
-
- retryer := &testRetryer{}
- s := awstesting.NewClient(&aws.Config{
- Region: aws.String("mock-region"),
- MaxRetries: aws.Int(0),
- Endpoint: aws.String(server.URL),
- DisableSSL: aws.Bool(true),
- Retryer: retryer,
- HTTPClient: client,
- EnforceShouldRetryCheck: aws.Bool(true),
- })
-
- s.Handlers.Validate.Clear()
- s.Handlers.Unmarshal.PushBack(unmarshal)
- s.Handlers.UnmarshalError.PushBack(unmarshalError)
-
- out := &testData{}
- r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out)
- err := r.Send()
- if err == nil {
- t.Fatalf("expect error, but got nil")
- }
- if e, a := 3, int(r.RetryCount); e != a {
- t.Errorf("expect %d retry count, got %d", e, a)
- }
- if !retryer.shouldRetry {
- t.Errorf("expect 'true' for ShouldRetry, but got %v", retryer.shouldRetry)
- }
-}
-
-type errReader struct {
- err error
-}
-
-func (reader *errReader) Read(b []byte) (int, error) {
- return 0, reader.err
-}
-
-func (reader *errReader) Close() error {
- return nil
-}
-
-func TestIsNoBodyReader(t *testing.T) {
- cases := []struct {
- reader io.ReadCloser
- expect bool
- }{
- {ioutil.NopCloser(bytes.NewReader([]byte("abc"))), false},
- {ioutil.NopCloser(bytes.NewReader(nil)), false},
- {nil, false},
- {request.NoBody, true},
- }
-
- for i, c := range cases {
- if e, a := c.expect, request.NoBody == c.reader; e != a {
- t.Errorf("%d, expect %t match, but was %t", i, e, a)
- }
- }
-}
-
-func TestRequest_TemporaryRetry(t *testing.T) {
- done := make(chan struct{})
-
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Length", "1024")
- w.WriteHeader(http.StatusOK)
-
- w.Write(make([]byte, 100))
-
- f := w.(http.Flusher)
- f.Flush()
-
- <-done
- }))
-
- client := &http.Client{
- Timeout: 100 * time.Millisecond,
- }
-
- svc := awstesting.NewClient(&aws.Config{
- Region: unit.Session.Config.Region,
- MaxRetries: aws.Int(1),
- HTTPClient: client,
- DisableSSL: aws.Bool(true),
- Endpoint: aws.String(server.URL),
- })
-
- req := svc.NewRequest(&request.Operation{
- Name: "name", HTTPMethod: "GET", HTTPPath: "/path",
- }, &struct{}{}, &struct{}{})
-
- req.Handlers.Unmarshal.PushBack(func(r *request.Request) {
- defer req.HTTPResponse.Body.Close()
- _, err := io.Copy(ioutil.Discard, req.HTTPResponse.Body)
- r.Error = awserr.New(request.ErrCodeSerialization, "error", err)
- })
-
- err := req.Send()
- if err == nil {
- t.Errorf("expect error, got none")
- }
- close(done)
-
- aerr := err.(awserr.Error)
- if e, a := request.ErrCodeSerialization, aerr.Code(); e != a {
- t.Errorf("expect %q error code, got %q", e, a)
- }
-
- if e, a := 1, req.RetryCount; e != a {
- t.Errorf("expect %d retries, got %d", e, a)
- }
-
- type temporary interface {
- Temporary() bool
- }
-
- terr := aerr.OrigErr().(temporary)
- if !terr.Temporary() {
- t.Errorf("expect temporary error, was not")
- }
-}
-
-func TestRequest_Presign(t *testing.T) {
- presign := func(r *request.Request, expire time.Duration) (string, http.Header, error) {
- u, err := r.Presign(expire)
- return u, nil, err
- }
- presignRequest := func(r *request.Request, expire time.Duration) (string, http.Header, error) {
- return r.PresignRequest(expire)
- }
- mustParseURL := func(v string) *url.URL {
- u, err := url.Parse(v)
- if err != nil {
- panic(err)
- }
- return u
- }
-
- cases := []struct {
- Expire time.Duration
- PresignFn func(*request.Request, time.Duration) (string, http.Header, error)
- SignerFn func(*request.Request)
- URL string
- Header http.Header
- Err string
- }{
- {
- PresignFn: presign,
- Err: request.ErrCodeInvalidPresignExpire,
- },
- {
- PresignFn: presignRequest,
- Err: request.ErrCodeInvalidPresignExpire,
- },
- {
- Expire: -1,
- PresignFn: presign,
- Err: request.ErrCodeInvalidPresignExpire,
- },
- {
- // Presign clear NotHoist
- Expire: 1 * time.Minute,
- PresignFn: func(r *request.Request, dur time.Duration) (string, http.Header, error) {
- r.NotHoist = true
- return presign(r, dur)
- },
- SignerFn: func(r *request.Request) {
- r.HTTPRequest.URL = mustParseURL("https://endpoint/presignedURL")
- if r.NotHoist {
- r.Error = fmt.Errorf("expect NotHoist to be cleared")
- }
- },
- URL: "https://endpoint/presignedURL",
- },
- {
- // PresignRequest does not clear NotHoist
- Expire: 1 * time.Minute,
- PresignFn: func(r *request.Request, dur time.Duration) (string, http.Header, error) {
- r.NotHoist = true
- return presignRequest(r, dur)
- },
- SignerFn: func(r *request.Request) {
- r.HTTPRequest.URL = mustParseURL("https://endpoint/presignedURL")
- if !r.NotHoist {
- r.Error = fmt.Errorf("expect NotHoist not to be cleared")
- }
- },
- URL: "https://endpoint/presignedURL",
- },
- {
- // PresignRequest returns signed headers
- Expire: 1 * time.Minute,
- PresignFn: presignRequest,
- SignerFn: func(r *request.Request) {
- r.HTTPRequest.URL = mustParseURL("https://endpoint/presignedURL")
- r.HTTPRequest.Header.Set("UnsigndHeader", "abc")
- r.SignedHeaderVals = http.Header{
- "X-Amzn-Header": []string{"abc", "123"},
- "X-Amzn-Header2": []string{"efg", "456"},
- }
- },
- URL: "https://endpoint/presignedURL",
- Header: http.Header{
- "X-Amzn-Header": []string{"abc", "123"},
- "X-Amzn-Header2": []string{"efg", "456"},
- },
- },
- }
-
- svc := awstesting.NewClient()
- svc.Handlers.Clear()
- for i, c := range cases {
- req := svc.NewRequest(&request.Operation{
- Name: "name", HTTPMethod: "GET", HTTPPath: "/path",
- }, &struct{}{}, &struct{}{})
- req.Handlers.Sign.PushBack(c.SignerFn)
-
- u, h, err := c.PresignFn(req, c.Expire)
- if len(c.Err) != 0 {
- if e, a := c.Err, err.Error(); !strings.Contains(a, e) {
- t.Errorf("%d, expect %v to be in %v", i, e, a)
- }
- continue
- } else if err != nil {
- t.Errorf("%d, expect no error, got %v", i, err)
- continue
- }
- if e, a := c.URL, u; e != a {
- t.Errorf("%d, expect %v URL, got %v", i, e, a)
- }
- if e, a := c.Header, h; !reflect.DeepEqual(e, a) {
- t.Errorf("%d, expect %v header got %v", i, e, a)
- }
- }
-}
-
-func TestNew_EndpointWithDefaultPort(t *testing.T) {
- endpoint := "https://estest.us-east-1.es.amazonaws.com:443"
- expectedRequestHost := "estest.us-east-1.es.amazonaws.com"
-
- r := request.New(
- aws.Config{},
- metadata.ClientInfo{Endpoint: endpoint},
- defaults.Handlers(),
- client.DefaultRetryer{},
- &request.Operation{},
- nil,
- nil,
- )
-
- if h := r.HTTPRequest.Host; h != expectedRequestHost {
- t.Errorf("expect %v host, got %q", expectedRequestHost, h)
- }
-}
-
-func TestSanitizeHostForHeader(t *testing.T) {
- cases := []struct {
- url string
- expectedRequestHost string
- }{
- {"https://estest.us-east-1.es.amazonaws.com:443", "estest.us-east-1.es.amazonaws.com"},
- {"https://estest.us-east-1.es.amazonaws.com", "estest.us-east-1.es.amazonaws.com"},
- {"https://localhost:9200", "localhost:9200"},
- {"http://localhost:80", "localhost"},
- {"http://localhost:8080", "localhost:8080"},
- }
-
- for _, c := range cases {
- r, _ := http.NewRequest("GET", c.url, nil)
- request.SanitizeHostForHeader(r)
-
- if h := r.Host; h != c.expectedRequestHost {
- t.Errorf("expect %v host, got %q", c.expectedRequestHost, h)
- }
- }
-}
-
-func TestRequestWillRetry_ByBody(t *testing.T) {
- svc := awstesting.NewClient()
-
- cases := []struct {
- WillRetry bool
- HTTPMethod string
- Body io.ReadSeeker
- IsReqNoBody bool
- }{
- {
- WillRetry: true,
- HTTPMethod: "GET",
- Body: bytes.NewReader([]byte{}),
- IsReqNoBody: true,
- },
- {
- WillRetry: true,
- HTTPMethod: "GET",
- Body: bytes.NewReader(nil),
- IsReqNoBody: true,
- },
- {
- WillRetry: true,
- HTTPMethod: "POST",
- Body: bytes.NewReader([]byte("abc123")),
- },
- {
- WillRetry: true,
- HTTPMethod: "POST",
- Body: aws.ReadSeekCloser(bytes.NewReader([]byte("abc123"))),
- },
- {
- WillRetry: true,
- HTTPMethod: "GET",
- Body: aws.ReadSeekCloser(bytes.NewBuffer(nil)),
- IsReqNoBody: true,
- },
- {
- WillRetry: true,
- HTTPMethod: "POST",
- Body: aws.ReadSeekCloser(bytes.NewBuffer(nil)),
- IsReqNoBody: true,
- },
- {
- WillRetry: false,
- HTTPMethod: "POST",
- Body: aws.ReadSeekCloser(bytes.NewBuffer([]byte("abc123"))),
- },
- }
-
- for i, c := range cases {
- req := svc.NewRequest(&request.Operation{
- Name: "Operation",
- HTTPMethod: c.HTTPMethod,
- HTTPPath: "/",
- }, nil, nil)
- req.SetReaderBody(c.Body)
- req.Build()
-
- req.Error = fmt.Errorf("some error")
- req.Retryable = aws.Bool(true)
- req.HTTPResponse = &http.Response{
- StatusCode: 500,
- }
-
- if e, a := c.IsReqNoBody, request.NoBody == req.HTTPRequest.Body; e != a {
- t.Errorf("%d, expect request to be no body, %t, got %t, %T", i, e, a, req.HTTPRequest.Body)
- }
-
- if e, a := c.WillRetry, req.WillRetry(); e != a {
- t.Errorf("%d, expect %t willRetry, got %t", i, e, a)
- }
-
- if req.Error == nil {
- t.Fatalf("%d, expect error, got none", i)
- }
- if e, a := "some error", req.Error.Error(); !strings.Contains(a, e) {
- t.Errorf("%d, expect %q error in %q", i, e, a)
- }
- if e, a := 0, req.RetryCount; e != a {
- t.Errorf("%d, expect retry count to be %d, got %d", i, e, a)
- }
- }
-}
-
-func Test501NotRetrying(t *testing.T) {
- reqNum := 0
- reqs := []http.Response{
- {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)},
- {StatusCode: 501, Body: body(`{"__type":"NotImplemented","message":"An error occurred."}`)},
- {StatusCode: 200, Body: body(`{"data":"valid"}`)},
- }
-
- s := awstesting.NewClient(aws.NewConfig().WithMaxRetries(10))
- s.Handlers.Validate.Clear()
- s.Handlers.Unmarshal.PushBack(unmarshal)
- s.Handlers.UnmarshalError.PushBack(unmarshalError)
- s.Handlers.Send.Clear() // mock sending
- s.Handlers.Send.PushBack(func(r *request.Request) {
- r.HTTPResponse = &reqs[reqNum]
- reqNum++
- })
- out := &testData{}
- r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out)
- err := r.Send()
- if err == nil {
- t.Fatal("expect error, but got none")
- }
-
- aerr := err.(awserr.Error)
- if e, a := "NotImplemented", aerr.Code(); e != a {
- t.Errorf("expected error code %q, but received %q", e, a)
- }
- if e, a := 1, int(r.RetryCount); e != a {
- t.Errorf("expect %d retry count, got %d", e, a)
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/retryer_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/retryer_test.go
deleted file mode 100644
index a8787487e..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/request/retryer_test.go
+++ /dev/null
@@ -1,62 +0,0 @@
-package request
-
-import (
- "errors"
- "fmt"
- "testing"
-
- "github.com/aws/aws-sdk-go/aws/awserr"
-)
-
-func TestRequestThrottling(t *testing.T) {
- req := Request{}
-
- req.Error = awserr.New("Throttling", "", nil)
- if e, a := true, req.IsErrorThrottle(); e != a {
- t.Errorf("expect %t to be throttled, was %t", e, a)
- }
-}
-
-type mockTempError bool
-
-func (e mockTempError) Error() string {
- return fmt.Sprintf("mock temporary error: %t", e.Temporary())
-}
-func (e mockTempError) Temporary() bool {
- return bool(e)
-}
-
-func TestIsErrorRetryable(t *testing.T) {
- cases := []struct {
- Err error
- IsTemp bool
- }{
- {
- Err: awserr.New(ErrCodeSerialization, "temporary error", mockTempError(true)),
- IsTemp: true,
- },
- {
- Err: awserr.New(ErrCodeSerialization, "temporary error", mockTempError(false)),
- IsTemp: false,
- },
- {
- Err: awserr.New(ErrCodeSerialization, "some error", errors.New("blah")),
- IsTemp: false,
- },
- {
- Err: awserr.New("SomeError", "some error", nil),
- IsTemp: false,
- },
- {
- Err: awserr.New("RequestError", "some error", nil),
- IsTemp: true,
- },
- }
-
- for i, c := range cases {
- retryable := IsErrorRetryable(c.Err)
- if e, a := c.IsTemp, retryable; e != a {
- t.Errorf("%d, expect %t temporary error, got %t", i, e, a)
- }
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_benchmark_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_benchmark_test.go
deleted file mode 100644
index 33e1b2d18..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_benchmark_test.go
+++ /dev/null
@@ -1,76 +0,0 @@
-package request_test
-
-import (
- "bytes"
- "io/ioutil"
- "net/http"
- "testing"
- "time"
-
- "github.com/aws/aws-sdk-go/aws/client"
- "github.com/aws/aws-sdk-go/aws/client/metadata"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/aws/signer/v4"
- "github.com/aws/aws-sdk-go/awstesting/unit"
- "github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
-)
-
-func BenchmarkTimeoutReadCloser(b *testing.B) {
- resp := `
- {
- "Bar": "qux"
- }
- `
-
- handlers := request.Handlers{}
-
- handlers.Send.PushBack(func(r *request.Request) {
- r.HTTPResponse = &http.Response{
- StatusCode: http.StatusOK,
- Body: ioutil.NopCloser(bytes.NewBuffer([]byte(resp))),
- }
- })
- handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
- handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
- handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
- handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
-
- op := &request.Operation{
- Name: "op",
- HTTPMethod: "POST",
- HTTPPath: "/",
- }
-
- meta := metadata.ClientInfo{
- ServiceName: "fooService",
- SigningName: "foo",
- SigningRegion: "foo",
- Endpoint: "localhost",
- APIVersion: "2001-01-01",
- JSONVersion: "1.1",
- TargetPrefix: "Foo",
- }
-
- req := request.New(
- *unit.Session.Config,
- meta,
- handlers,
- client.DefaultRetryer{NumMaxRetries: 5},
- op,
- &struct {
- Foo *string
- }{},
- &struct {
- Bar *string
- }{},
- )
-
- req.ApplyOptions(request.WithResponseReadTimeout(15 * time.Second))
- for i := 0; i < b.N; i++ {
- err := req.Send()
- if err != nil {
- b.Errorf("Expected no error, but received %v", err)
- }
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_test.go
deleted file mode 100644
index c814158da..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_test.go
+++ /dev/null
@@ -1,118 +0,0 @@
-package request
-
-import (
- "bytes"
- "io"
- "io/ioutil"
- "net/http"
- "testing"
- "time"
-
- "github.com/aws/aws-sdk-go/aws/awserr"
-)
-
-type testReader struct {
- duration time.Duration
- count int
-}
-
-func (r *testReader) Read(b []byte) (int, error) {
- if r.count > 0 {
- r.count--
- return len(b), nil
- }
- time.Sleep(r.duration)
- return 0, io.EOF
-}
-
-func (r *testReader) Close() error {
- return nil
-}
-
-func TestTimeoutReadCloser(t *testing.T) {
- reader := timeoutReadCloser{
- reader: &testReader{
- duration: time.Second,
- count: 5,
- },
- duration: time.Millisecond,
- }
- b := make([]byte, 100)
- _, err := reader.Read(b)
- if err != nil {
- t.Log(err)
- }
-}
-
-func TestTimeoutReadCloserSameDuration(t *testing.T) {
- reader := timeoutReadCloser{
- reader: &testReader{
- duration: time.Millisecond,
- count: 5,
- },
- duration: time.Millisecond,
- }
- b := make([]byte, 100)
- _, err := reader.Read(b)
- if err != nil {
- t.Log(err)
- }
-}
-
-func TestWithResponseReadTimeout(t *testing.T) {
- r := Request{
- HTTPResponse: &http.Response{
- Body: ioutil.NopCloser(bytes.NewReader(nil)),
- },
- }
- r.ApplyOptions(WithResponseReadTimeout(time.Second))
- err := r.Send()
- if err != nil {
- t.Error(err)
- }
- v, ok := r.HTTPResponse.Body.(*timeoutReadCloser)
- if !ok {
- t.Error("Expected the body to be a timeoutReadCloser")
- }
- if v.duration != time.Second {
- t.Errorf("Expected %v, but receive %v\n", time.Second, v.duration)
- }
-}
-
-func TestAdaptToResponseTimeout(t *testing.T) {
- testCases := []struct {
- childErr error
- r Request
- expectedRootCode string
- }{
- {
- childErr: awserr.New(ErrCodeResponseTimeout, "timeout!", nil),
- r: Request{
- Error: awserr.New("ErrTest", "FooBar", awserr.New(ErrCodeResponseTimeout, "timeout!", nil)),
- },
- expectedRootCode: ErrCodeResponseTimeout,
- },
- {
- childErr: awserr.New(ErrCodeResponseTimeout+"1", "timeout!", nil),
- r: Request{
- Error: awserr.New("ErrTest", "FooBar", awserr.New(ErrCodeResponseTimeout+"1", "timeout!", nil)),
- },
- expectedRootCode: "ErrTest",
- },
- {
- r: Request{
- Error: awserr.New("ErrTest", "FooBar", nil),
- },
- expectedRootCode: "ErrTest",
- },
- }
-
- for i, c := range testCases {
- adaptToResponseTimeoutError(&c.r)
- if aerr, ok := c.r.Error.(awserr.Error); !ok {
- t.Errorf("Case %d: Expected 'awserr', but received %v", i+1, c.r.Error)
- } else if aerr.Code() != c.expectedRootCode {
- t.Errorf("Case %d: Expected %q, but received %s", i+1, c.expectedRootCode, aerr.Code())
- }
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/waiter_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/waiter_test.go
deleted file mode 100644
index db0f92df1..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/request/waiter_test.go
+++ /dev/null
@@ -1,654 +0,0 @@
-package request_test
-
-import (
- "bytes"
- "fmt"
- "io/ioutil"
- "net/http"
- "testing"
- "time"
-
- "github.com/stretchr/testify/assert"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/awserr"
- "github.com/aws/aws-sdk-go/aws/client"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/awstesting"
- "github.com/aws/aws-sdk-go/awstesting/unit"
- "github.com/aws/aws-sdk-go/service/s3"
-)
-
-type mockClient struct {
- *client.Client
-}
-type MockInput struct{}
-type MockOutput struct {
- States []*MockState
-}
-type MockState struct {
- State *string
-}
-
-func (c *mockClient) MockRequest(input *MockInput) (*request.Request, *MockOutput) {
- op := &request.Operation{
- Name: "Mock",
- HTTPMethod: "POST",
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &MockInput{}
- }
-
- output := &MockOutput{}
- req := c.NewRequest(op, input, output)
- req.Data = output
- return req, output
-}
-
-func BuildNewMockRequest(c *mockClient, in *MockInput) func([]request.Option) (*request.Request, error) {
- return func(opts []request.Option) (*request.Request, error) {
- req, _ := c.MockRequest(in)
- req.ApplyOptions(opts...)
- return req, nil
- }
-}
-
-func TestWaiterPathAll(t *testing.T) {
- svc := &mockClient{Client: awstesting.NewClient(&aws.Config{
- Region: aws.String("mock-region"),
- })}
- svc.Handlers.Send.Clear() // mock sending
- svc.Handlers.Unmarshal.Clear()
- svc.Handlers.UnmarshalMeta.Clear()
- svc.Handlers.ValidateResponse.Clear()
-
- reqNum := 0
- resps := []*MockOutput{
- { // Request 1
- States: []*MockState{
- {State: aws.String("pending")},
- {State: aws.String("pending")},
- },
- },
- { // Request 2
- States: []*MockState{
- {State: aws.String("running")},
- {State: aws.String("pending")},
- },
- },
- { // Request 3
- States: []*MockState{
- {State: aws.String("running")},
- {State: aws.String("running")},
- },
- },
- }
-
- numBuiltReq := 0
- svc.Handlers.Build.PushBack(func(r *request.Request) {
- numBuiltReq++
- })
- svc.Handlers.Unmarshal.PushBack(func(r *request.Request) {
- if reqNum >= len(resps) {
- assert.Fail(t, "too many polling requests made")
- return
- }
- r.Data = resps[reqNum]
- reqNum++
- })
-
- w := request.Waiter{
- MaxAttempts: 10,
- Delay: request.ConstantWaiterDelay(0),
- SleepWithContext: aws.SleepWithContext,
- Acceptors: []request.WaiterAcceptor{
- {
- State: request.SuccessWaiterState,
- Matcher: request.PathAllWaiterMatch,
- Argument: "States[].State",
- Expected: "running",
- },
- },
- NewRequest: BuildNewMockRequest(svc, &MockInput{}),
- }
-
- err := w.WaitWithContext(aws.BackgroundContext())
- assert.NoError(t, err)
- assert.Equal(t, 3, numBuiltReq)
- assert.Equal(t, 3, reqNum)
-}
-
-func TestWaiterPath(t *testing.T) {
- svc := &mockClient{Client: awstesting.NewClient(&aws.Config{
- Region: aws.String("mock-region"),
- })}
- svc.Handlers.Send.Clear() // mock sending
- svc.Handlers.Unmarshal.Clear()
- svc.Handlers.UnmarshalMeta.Clear()
- svc.Handlers.ValidateResponse.Clear()
-
- reqNum := 0
- resps := []*MockOutput{
- { // Request 1
- States: []*MockState{
- {State: aws.String("pending")},
- {State: aws.String("pending")},
- },
- },
- { // Request 2
- States: []*MockState{
- {State: aws.String("running")},
- {State: aws.String("pending")},
- },
- },
- { // Request 3
- States: []*MockState{
- {State: aws.String("running")},
- {State: aws.String("running")},
- },
- },
- }
-
- numBuiltReq := 0
- svc.Handlers.Build.PushBack(func(r *request.Request) {
- numBuiltReq++
- })
- svc.Handlers.Unmarshal.PushBack(func(r *request.Request) {
- if reqNum >= len(resps) {
- assert.Fail(t, "too many polling requests made")
- return
- }
- r.Data = resps[reqNum]
- reqNum++
- })
-
- w := request.Waiter{
- MaxAttempts: 10,
- Delay: request.ConstantWaiterDelay(0),
- SleepWithContext: aws.SleepWithContext,
- Acceptors: []request.WaiterAcceptor{
- {
- State: request.SuccessWaiterState,
- Matcher: request.PathWaiterMatch,
- Argument: "States[].State",
- Expected: "running",
- },
- },
- NewRequest: BuildNewMockRequest(svc, &MockInput{}),
- }
-
- err := w.WaitWithContext(aws.BackgroundContext())
- assert.NoError(t, err)
- assert.Equal(t, 3, numBuiltReq)
- assert.Equal(t, 3, reqNum)
-}
-
-func TestWaiterFailure(t *testing.T) {
- svc := &mockClient{Client: awstesting.NewClient(&aws.Config{
- Region: aws.String("mock-region"),
- })}
- svc.Handlers.Send.Clear() // mock sending
- svc.Handlers.Unmarshal.Clear()
- svc.Handlers.UnmarshalMeta.Clear()
- svc.Handlers.ValidateResponse.Clear()
-
- reqNum := 0
- resps := []*MockOutput{
- { // Request 1
- States: []*MockState{
- {State: aws.String("pending")},
- {State: aws.String("pending")},
- },
- },
- { // Request 2
- States: []*MockState{
- {State: aws.String("running")},
- {State: aws.String("pending")},
- },
- },
- { // Request 3
- States: []*MockState{
- {State: aws.String("running")},
- {State: aws.String("stopping")},
- },
- },
- }
-
- numBuiltReq := 0
- svc.Handlers.Build.PushBack(func(r *request.Request) {
- numBuiltReq++
- })
- svc.Handlers.Unmarshal.PushBack(func(r *request.Request) {
- if reqNum >= len(resps) {
- assert.Fail(t, "too many polling requests made")
- return
- }
- r.Data = resps[reqNum]
- reqNum++
- })
-
- w := request.Waiter{
- MaxAttempts: 10,
- Delay: request.ConstantWaiterDelay(0),
- SleepWithContext: aws.SleepWithContext,
- Acceptors: []request.WaiterAcceptor{
- {
- State: request.SuccessWaiterState,
- Matcher: request.PathAllWaiterMatch,
- Argument: "States[].State",
- Expected: "running",
- },
- {
- State: request.FailureWaiterState,
- Matcher: request.PathAnyWaiterMatch,
- Argument: "States[].State",
- Expected: "stopping",
- },
- },
- NewRequest: BuildNewMockRequest(svc, &MockInput{}),
- }
-
- err := w.WaitWithContext(aws.BackgroundContext()).(awserr.Error)
- assert.Error(t, err)
- assert.Equal(t, request.WaiterResourceNotReadyErrorCode, err.Code())
- assert.Equal(t, "failed waiting for successful resource state", err.Message())
- assert.Equal(t, 3, numBuiltReq)
- assert.Equal(t, 3, reqNum)
-}
-
-func TestWaiterError(t *testing.T) {
- svc := &mockClient{Client: awstesting.NewClient(&aws.Config{
- Region: aws.String("mock-region"),
- })}
- svc.Handlers.Send.Clear() // mock sending
- svc.Handlers.Unmarshal.Clear()
- svc.Handlers.UnmarshalMeta.Clear()
- svc.Handlers.UnmarshalError.Clear()
- svc.Handlers.ValidateResponse.Clear()
-
- reqNum := 0
- resps := []*MockOutput{
- { // Request 1
- States: []*MockState{
- {State: aws.String("pending")},
- {State: aws.String("pending")},
- },
- },
- { // Request 1, error case retry
- },
- { // Request 2, error case failure
- },
- { // Request 3
- States: []*MockState{
- {State: aws.String("running")},
- {State: aws.String("running")},
- },
- },
- }
- reqErrs := make([]error, len(resps))
- reqErrs[1] = awserr.New("MockException", "mock exception message", nil)
- reqErrs[2] = awserr.New("FailureException", "mock failure exception message", nil)
-
- numBuiltReq := 0
- svc.Handlers.Build.PushBack(func(r *request.Request) {
- numBuiltReq++
- })
- svc.Handlers.Send.PushBack(func(r *request.Request) {
- code := 200
- if reqNum == 1 {
- code = 400
- }
- r.HTTPResponse = &http.Response{
- StatusCode: code,
- Status: http.StatusText(code),
- Body: ioutil.NopCloser(bytes.NewReader([]byte{})),
- }
- })
- svc.Handlers.Unmarshal.PushBack(func(r *request.Request) {
- if reqNum >= len(resps) {
- assert.Fail(t, "too many polling requests made")
- return
- }
- r.Data = resps[reqNum]
- reqNum++
- })
- svc.Handlers.UnmarshalMeta.PushBack(func(r *request.Request) {
- // If there was an error unmarshal error will be called instead of unmarshal
- // need to increment count here also
- if err := reqErrs[reqNum]; err != nil {
- r.Error = err
- reqNum++
- }
- })
-
- w := request.Waiter{
- MaxAttempts: 10,
- Delay: request.ConstantWaiterDelay(0),
- SleepWithContext: aws.SleepWithContext,
- Acceptors: []request.WaiterAcceptor{
- {
- State: request.SuccessWaiterState,
- Matcher: request.PathAllWaiterMatch,
- Argument: "States[].State",
- Expected: "running",
- },
- {
- State: request.RetryWaiterState,
- Matcher: request.ErrorWaiterMatch,
- Argument: "",
- Expected: "MockException",
- },
- {
- State: request.FailureWaiterState,
- Matcher: request.ErrorWaiterMatch,
- Argument: "",
- Expected: "FailureException",
- },
- },
- NewRequest: BuildNewMockRequest(svc, &MockInput{}),
- }
-
- err := w.WaitWithContext(aws.BackgroundContext())
- if err == nil {
- t.Fatalf("expected error, but did not get one")
- }
- aerr := err.(awserr.Error)
- if e, a := request.WaiterResourceNotReadyErrorCode, aerr.Code(); e != a {
- t.Errorf("expect %q error code, got %q", e, a)
- }
- if e, a := 3, numBuiltReq; e != a {
- t.Errorf("expect %d built requests got %d", e, a)
- }
- if e, a := 3, reqNum; e != a {
- t.Errorf("expect %d reqNum got %d", e, a)
- }
-}
-
-func TestWaiterStatus(t *testing.T) {
- svc := &mockClient{Client: awstesting.NewClient(&aws.Config{
- Region: aws.String("mock-region"),
- })}
- svc.Handlers.Send.Clear() // mock sending
- svc.Handlers.Unmarshal.Clear()
- svc.Handlers.UnmarshalMeta.Clear()
- svc.Handlers.ValidateResponse.Clear()
-
- reqNum := 0
- svc.Handlers.Build.PushBack(func(r *request.Request) {
- reqNum++
- })
- svc.Handlers.Send.PushBack(func(r *request.Request) {
- code := 200
- if reqNum == 3 {
- code = 404
- r.Error = awserr.New("NotFound", "Not Found", nil)
- }
- r.HTTPResponse = &http.Response{
- StatusCode: code,
- Status: http.StatusText(code),
- Body: ioutil.NopCloser(bytes.NewReader([]byte{})),
- }
- })
-
- w := request.Waiter{
- MaxAttempts: 10,
- Delay: request.ConstantWaiterDelay(0),
- SleepWithContext: aws.SleepWithContext,
- Acceptors: []request.WaiterAcceptor{
- {
- State: request.SuccessWaiterState,
- Matcher: request.StatusWaiterMatch,
- Argument: "",
- Expected: 404,
- },
- },
- NewRequest: BuildNewMockRequest(svc, &MockInput{}),
- }
-
- err := w.WaitWithContext(aws.BackgroundContext())
- assert.NoError(t, err)
- assert.Equal(t, 3, reqNum)
-}
-
-func TestWaiter_ApplyOptions(t *testing.T) {
- w := request.Waiter{}
-
- logger := aws.NewDefaultLogger()
-
- w.ApplyOptions(
- request.WithWaiterLogger(logger),
- request.WithWaiterRequestOptions(request.WithLogLevel(aws.LogDebug)),
- request.WithWaiterMaxAttempts(2),
- request.WithWaiterDelay(request.ConstantWaiterDelay(5*time.Second)),
- )
-
- if e, a := logger, w.Logger; e != a {
- t.Errorf("expect logger to be set, and match, was not, %v, %v", e, a)
- }
-
- if len(w.RequestOptions) != 1 {
- t.Fatalf("expect request options to be set to only a single option, %v", w.RequestOptions)
- }
- r := request.Request{}
- r.ApplyOptions(w.RequestOptions...)
- if e, a := aws.LogDebug, r.Config.LogLevel.Value(); e != a {
- t.Errorf("expect %v loglevel got %v", e, a)
- }
-
- if e, a := 2, w.MaxAttempts; e != a {
- t.Errorf("expect %d retryer max attempts, got %d", e, a)
- }
- if e, a := 5*time.Second, w.Delay(0); e != a {
- t.Errorf("expect %d retryer delay, got %d", e, a)
- }
-}
-
-func TestWaiter_WithContextCanceled(t *testing.T) {
- c := awstesting.NewClient()
-
- ctx := &awstesting.FakeContext{DoneCh: make(chan struct{})}
- reqCount := 0
-
- w := request.Waiter{
- Name: "TestWaiter",
- MaxAttempts: 10,
- Delay: request.ConstantWaiterDelay(1 * time.Millisecond),
- SleepWithContext: aws.SleepWithContext,
- Acceptors: []request.WaiterAcceptor{
- {
- State: request.SuccessWaiterState,
- Matcher: request.StatusWaiterMatch,
- Expected: 200,
- },
- },
- Logger: aws.NewDefaultLogger(),
- NewRequest: func(opts []request.Option) (*request.Request, error) {
- req := c.NewRequest(&request.Operation{Name: "Operation"}, nil, nil)
- req.HTTPResponse = &http.Response{StatusCode: http.StatusNotFound}
- req.Handlers.Clear()
- req.Data = struct{}{}
- req.Handlers.Send.PushBack(func(r *request.Request) {
- if reqCount == 1 {
- ctx.Error = fmt.Errorf("context canceled")
- close(ctx.DoneCh)
- }
- reqCount++
- })
-
- return req, nil
- },
- }
-
- w.SleepWithContext = func(c aws.Context, delay time.Duration) error {
- context := c.(*awstesting.FakeContext)
- select {
- case <-context.DoneCh:
- return context.Err()
- default:
- return nil
- }
- }
-
- err := w.WaitWithContext(ctx)
-
- if err == nil {
- t.Fatalf("expect waiter to be canceled.")
- }
- aerr := err.(awserr.Error)
- if e, a := request.CanceledErrorCode, aerr.Code(); e != a {
- t.Errorf("expect %q error code, got %q", e, a)
- }
- if e, a := 2, reqCount; e != a {
- t.Errorf("expect %d requests, got %d", e, a)
- }
-}
-
-func TestWaiter_WithContext(t *testing.T) {
- c := awstesting.NewClient()
-
- ctx := &awstesting.FakeContext{DoneCh: make(chan struct{})}
- reqCount := 0
-
- statuses := []int{http.StatusNotFound, http.StatusOK}
-
- w := request.Waiter{
- Name: "TestWaiter",
- MaxAttempts: 10,
- Delay: request.ConstantWaiterDelay(1 * time.Millisecond),
- SleepWithContext: aws.SleepWithContext,
- Acceptors: []request.WaiterAcceptor{
- {
- State: request.SuccessWaiterState,
- Matcher: request.StatusWaiterMatch,
- Expected: 200,
- },
- },
- Logger: aws.NewDefaultLogger(),
- NewRequest: func(opts []request.Option) (*request.Request, error) {
- req := c.NewRequest(&request.Operation{Name: "Operation"}, nil, nil)
- req.HTTPResponse = &http.Response{StatusCode: statuses[reqCount]}
- req.Handlers.Clear()
- req.Data = struct{}{}
- req.Handlers.Send.PushBack(func(r *request.Request) {
- if reqCount == 1 {
- ctx.Error = fmt.Errorf("context canceled")
- close(ctx.DoneCh)
- }
- reqCount++
- })
-
- return req, nil
- },
- }
-
- err := w.WaitWithContext(ctx)
-
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
- if e, a := 2, reqCount; e != a {
- t.Errorf("expect %d requests, got %d", e, a)
- }
-}
-
-func TestWaiter_AttemptsExpires(t *testing.T) {
- c := awstesting.NewClient()
-
- ctx := &awstesting.FakeContext{DoneCh: make(chan struct{})}
- reqCount := 0
-
- w := request.Waiter{
- Name: "TestWaiter",
- MaxAttempts: 2,
- Delay: request.ConstantWaiterDelay(1 * time.Millisecond),
- SleepWithContext: aws.SleepWithContext,
- Acceptors: []request.WaiterAcceptor{
- {
- State: request.SuccessWaiterState,
- Matcher: request.StatusWaiterMatch,
- Expected: 200,
- },
- },
- Logger: aws.NewDefaultLogger(),
- NewRequest: func(opts []request.Option) (*request.Request, error) {
- req := c.NewRequest(&request.Operation{Name: "Operation"}, nil, nil)
- req.HTTPResponse = &http.Response{StatusCode: http.StatusNotFound}
- req.Handlers.Clear()
- req.Data = struct{}{}
- req.Handlers.Send.PushBack(func(r *request.Request) {
- reqCount++
- })
-
- return req, nil
- },
- }
-
- err := w.WaitWithContext(ctx)
-
- if err == nil {
- t.Fatalf("expect error did not get one")
- }
- aerr := err.(awserr.Error)
- if e, a := request.WaiterResourceNotReadyErrorCode, aerr.Code(); e != a {
- t.Errorf("expect %q error code, got %q", e, a)
- }
- if e, a := 2, reqCount; e != a {
- t.Errorf("expect %d requests, got %d", e, a)
- }
-}
-
-func TestWaiterNilInput(t *testing.T) {
- // Code generation doesn't have a great way to verify the code is correct
- // other than being run via unit tests in the SDK. This should be fixed
- // So code generation can be validated independently.
-
- client := s3.New(unit.Session)
- client.Handlers.Validate.Clear()
- client.Handlers.Send.Clear() // mock sending
- client.Handlers.Send.PushBack(func(r *request.Request) {
- r.HTTPResponse = &http.Response{
- StatusCode: http.StatusOK,
- }
- })
- client.Handlers.Unmarshal.Clear()
- client.Handlers.UnmarshalMeta.Clear()
- client.Handlers.ValidateResponse.Clear()
- client.Config.SleepDelay = func(dur time.Duration) {}
-
- // Ensure waiters do not panic on nil input. It doesn't make sense to
- // call a waiter without an input, Validation will
- err := client.WaitUntilBucketExists(nil)
- if err != nil {
- t.Fatalf("expect no error, but got %v", err)
- }
-}
-
-func TestWaiterWithContextNilInput(t *testing.T) {
- // Code generation doesn't have a great way to verify the code is correct
- // other than being run via unit tests in the SDK. This should be fixed
- // So code generation can be validated independently.
-
- client := s3.New(unit.Session)
- client.Handlers.Validate.Clear()
- client.Handlers.Send.Clear() // mock sending
- client.Handlers.Send.PushBack(func(r *request.Request) {
- r.HTTPResponse = &http.Response{
- StatusCode: http.StatusOK,
- }
- })
- client.Handlers.Unmarshal.Clear()
- client.Handlers.UnmarshalMeta.Clear()
- client.Handlers.ValidateResponse.Clear()
-
- // Ensure waiters do not panic on nil input
- ctx := &awstesting.FakeContext{DoneCh: make(chan struct{})}
- err := client.WaitUntilBucketExistsWithContext(ctx, nil,
- request.WithWaiterDelay(request.ConstantWaiterDelay(0)),
- request.WithWaiterMaxAttempts(1),
- )
- if err != nil {
- t.Fatalf("expect no error, but got %v", err)
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/custom_ca_bundle_test.go b/vendor/github.com/aws/aws-sdk-go/aws/session/custom_ca_bundle_test.go
deleted file mode 100644
index a89c0af59..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/session/custom_ca_bundle_test.go
+++ /dev/null
@@ -1,243 +0,0 @@
-package session
-
-import (
- "bytes"
- "fmt"
- "net"
- "net/http"
- "os"
- "strings"
- "testing"
- "time"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/awserr"
- "github.com/aws/aws-sdk-go/aws/credentials"
- "github.com/aws/aws-sdk-go/awstesting"
-)
-
-var TLSBundleCertFile string
-var TLSBundleKeyFile string
-var TLSBundleCAFile string
-
-func TestMain(m *testing.M) {
- var err error
-
- TLSBundleCertFile, TLSBundleKeyFile, TLSBundleCAFile, err = awstesting.CreateTLSBundleFiles()
- if err != nil {
- panic(err)
- }
-
- fmt.Println("TestMain", TLSBundleCertFile, TLSBundleKeyFile)
-
- code := m.Run()
-
- err = awstesting.CleanupTLSBundleFiles(TLSBundleCertFile, TLSBundleKeyFile, TLSBundleCAFile)
- if err != nil {
- panic(err)
- }
-
- os.Exit(code)
-}
-
-func TestNewSession_WithCustomCABundle_Env(t *testing.T) {
- oldEnv := initSessionTestEnv()
- defer awstesting.PopEnv(oldEnv)
-
- endpoint, err := awstesting.CreateTLSServer(TLSBundleCertFile, TLSBundleKeyFile, nil)
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- os.Setenv("AWS_CA_BUNDLE", TLSBundleCAFile)
-
- s, err := NewSession(&aws.Config{
- HTTPClient: &http.Client{},
- Endpoint: aws.String(endpoint),
- Region: aws.String("mock-region"),
- Credentials: credentials.AnonymousCredentials,
- })
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
- if s == nil {
- t.Fatalf("expect session to be created, got none")
- }
-
- req, _ := http.NewRequest("GET", *s.Config.Endpoint, nil)
- resp, err := s.Config.HTTPClient.Do(req)
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
- if e, a := http.StatusOK, resp.StatusCode; e != a {
- t.Errorf("expect %d status code, got %d", e, a)
- }
-}
-
-func TestNewSession_WithCustomCABundle_EnvNotExists(t *testing.T) {
- oldEnv := initSessionTestEnv()
- defer awstesting.PopEnv(oldEnv)
-
- os.Setenv("AWS_CA_BUNDLE", "file-not-exists")
-
- s, err := NewSession()
- if err == nil {
- t.Fatalf("expect error, got none")
- }
- if e, a := "LoadCustomCABundleError", err.(awserr.Error).Code(); e != a {
- t.Errorf("expect %s error code, got %s", e, a)
- }
- if s != nil {
- t.Errorf("expect nil session, got %v", s)
- }
-}
-
-func TestNewSession_WithCustomCABundle_Option(t *testing.T) {
- oldEnv := initSessionTestEnv()
- defer awstesting.PopEnv(oldEnv)
-
- endpoint, err := awstesting.CreateTLSServer(TLSBundleCertFile, TLSBundleKeyFile, nil)
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- s, err := NewSessionWithOptions(Options{
- Config: aws.Config{
- HTTPClient: &http.Client{},
- Endpoint: aws.String(endpoint),
- Region: aws.String("mock-region"),
- Credentials: credentials.AnonymousCredentials,
- },
- CustomCABundle: bytes.NewReader(awstesting.TLSBundleCA),
- })
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
- if s == nil {
- t.Fatalf("expect session to be created, got none")
- }
-
- req, _ := http.NewRequest("GET", *s.Config.Endpoint, nil)
- resp, err := s.Config.HTTPClient.Do(req)
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
- if e, a := http.StatusOK, resp.StatusCode; e != a {
- t.Errorf("expect %d status code, got %d", e, a)
- }
-}
-
-func TestNewSession_WithCustomCABundle_OptionPriority(t *testing.T) {
- oldEnv := initSessionTestEnv()
- defer awstesting.PopEnv(oldEnv)
-
- endpoint, err := awstesting.CreateTLSServer(TLSBundleCertFile, TLSBundleKeyFile, nil)
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- os.Setenv("AWS_CA_BUNDLE", "file-not-exists")
-
- s, err := NewSessionWithOptions(Options{
- Config: aws.Config{
- HTTPClient: &http.Client{},
- Endpoint: aws.String(endpoint),
- Region: aws.String("mock-region"),
- Credentials: credentials.AnonymousCredentials,
- },
- CustomCABundle: bytes.NewReader(awstesting.TLSBundleCA),
- })
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
- if s == nil {
- t.Fatalf("expect session to be created, got none")
- }
-
- req, _ := http.NewRequest("GET", *s.Config.Endpoint, nil)
- resp, err := s.Config.HTTPClient.Do(req)
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
- if e, a := http.StatusOK, resp.StatusCode; e != a {
- t.Errorf("expect %d status code, got %d", e, a)
- }
-}
-
-type mockRoundTripper struct{}
-
-func (m *mockRoundTripper) RoundTrip(r *http.Request) (*http.Response, error) {
- return nil, nil
-}
-
-func TestNewSession_WithCustomCABundle_UnsupportedTransport(t *testing.T) {
- oldEnv := initSessionTestEnv()
- defer awstesting.PopEnv(oldEnv)
-
- s, err := NewSessionWithOptions(Options{
- Config: aws.Config{
- HTTPClient: &http.Client{
- Transport: &mockRoundTripper{},
- },
- },
- CustomCABundle: bytes.NewReader(awstesting.TLSBundleCA),
- })
- if err == nil {
- t.Fatalf("expect error, got none")
- }
- if e, a := "LoadCustomCABundleError", err.(awserr.Error).Code(); e != a {
- t.Errorf("expect %s error code, got %s", e, a)
- }
- if s != nil {
- t.Errorf("expect nil session, got %v", s)
- }
- aerrMsg := err.(awserr.Error).Message()
- if e, a := "transport unsupported type", aerrMsg; !strings.Contains(a, e) {
- t.Errorf("expect %s to be in %s", e, a)
- }
-}
-
-func TestNewSession_WithCustomCABundle_TransportSet(t *testing.T) {
- oldEnv := initSessionTestEnv()
- defer awstesting.PopEnv(oldEnv)
-
- endpoint, err := awstesting.CreateTLSServer(TLSBundleCertFile, TLSBundleKeyFile, nil)
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- s, err := NewSessionWithOptions(Options{
- Config: aws.Config{
- Endpoint: aws.String(endpoint),
- Region: aws.String("mock-region"),
- Credentials: credentials.AnonymousCredentials,
- HTTPClient: &http.Client{
- Transport: &http.Transport{
- Proxy: http.ProxyFromEnvironment,
- Dial: (&net.Dialer{
- Timeout: 30 * time.Second,
- KeepAlive: 30 * time.Second,
- DualStack: true,
- }).Dial,
- TLSHandshakeTimeout: 2 * time.Second,
- },
- },
- },
- CustomCABundle: bytes.NewReader(awstesting.TLSBundleCA),
- })
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
- if s == nil {
- t.Fatalf("expect session to be created, got none")
- }
-
- req, _ := http.NewRequest("GET", *s.Config.Endpoint, nil)
- resp, err := s.Config.HTTPClient.Do(req)
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
- if e, a := http.StatusOK, resp.StatusCode; e != a {
- t.Errorf("expect %d status code, got %d", e, a)
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/env_config_test.go b/vendor/github.com/aws/aws-sdk-go/aws/session/env_config_test.go
deleted file mode 100644
index 3a0b6464d..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/session/env_config_test.go
+++ /dev/null
@@ -1,306 +0,0 @@
-package session
-
-import (
- "os"
- "reflect"
- "testing"
-
- "github.com/aws/aws-sdk-go/aws/credentials"
- "github.com/aws/aws-sdk-go/awstesting"
- "github.com/aws/aws-sdk-go/internal/shareddefaults"
-)
-
-func TestLoadEnvConfig_Creds(t *testing.T) {
- env := awstesting.StashEnv()
- defer awstesting.PopEnv(env)
-
- cases := []struct {
- Env map[string]string
- Val credentials.Value
- }{
- {
- Env: map[string]string{
- "AWS_ACCESS_KEY": "AKID",
- },
- Val: credentials.Value{},
- },
- {
- Env: map[string]string{
- "AWS_ACCESS_KEY_ID": "AKID",
- },
- Val: credentials.Value{},
- },
- {
- Env: map[string]string{
- "AWS_SECRET_KEY": "SECRET",
- },
- Val: credentials.Value{},
- },
- {
- Env: map[string]string{
- "AWS_SECRET_ACCESS_KEY": "SECRET",
- },
- Val: credentials.Value{},
- },
- {
- Env: map[string]string{
- "AWS_ACCESS_KEY_ID": "AKID",
- "AWS_SECRET_ACCESS_KEY": "SECRET",
- },
- Val: credentials.Value{
- AccessKeyID: "AKID", SecretAccessKey: "SECRET",
- ProviderName: "EnvConfigCredentials",
- },
- },
- {
- Env: map[string]string{
- "AWS_ACCESS_KEY": "AKID",
- "AWS_SECRET_KEY": "SECRET",
- },
- Val: credentials.Value{
- AccessKeyID: "AKID", SecretAccessKey: "SECRET",
- ProviderName: "EnvConfigCredentials",
- },
- },
- {
- Env: map[string]string{
- "AWS_ACCESS_KEY": "AKID",
- "AWS_SECRET_KEY": "SECRET",
- "AWS_SESSION_TOKEN": "TOKEN",
- },
- Val: credentials.Value{
- AccessKeyID: "AKID", SecretAccessKey: "SECRET", SessionToken: "TOKEN",
- ProviderName: "EnvConfigCredentials",
- },
- },
- }
-
- for _, c := range cases {
- os.Clearenv()
-
- for k, v := range c.Env {
- os.Setenv(k, v)
- }
-
- cfg := loadEnvConfig()
- if !reflect.DeepEqual(c.Val, cfg.Creds) {
- t.Errorf("expect credentials to match.\n%s",
- awstesting.SprintExpectActual(c.Val, cfg.Creds))
- }
- }
-}
-
-func TestLoadEnvConfig(t *testing.T) {
- env := awstesting.StashEnv()
- defer awstesting.PopEnv(env)
-
- cases := []struct {
- Env map[string]string
- UseSharedConfigCall bool
- Config envConfig
- }{
- {
- Env: map[string]string{
- "AWS_REGION": "region",
- "AWS_PROFILE": "profile",
- },
- Config: envConfig{
- Region: "region", Profile: "profile",
- SharedCredentialsFile: shareddefaults.SharedCredentialsFilename(),
- SharedConfigFile: shareddefaults.SharedConfigFilename(),
- },
- },
- {
- Env: map[string]string{
- "AWS_REGION": "region",
- "AWS_DEFAULT_REGION": "default_region",
- "AWS_PROFILE": "profile",
- "AWS_DEFAULT_PROFILE": "default_profile",
- },
- Config: envConfig{
- Region: "region", Profile: "profile",
- SharedCredentialsFile: shareddefaults.SharedCredentialsFilename(),
- SharedConfigFile: shareddefaults.SharedConfigFilename(),
- },
- },
- {
- Env: map[string]string{
- "AWS_REGION": "region",
- "AWS_DEFAULT_REGION": "default_region",
- "AWS_PROFILE": "profile",
- "AWS_DEFAULT_PROFILE": "default_profile",
- "AWS_SDK_LOAD_CONFIG": "1",
- },
- Config: envConfig{
- Region: "region", Profile: "profile",
- EnableSharedConfig: true,
- SharedCredentialsFile: shareddefaults.SharedCredentialsFilename(),
- SharedConfigFile: shareddefaults.SharedConfigFilename(),
- },
- },
- {
- Env: map[string]string{
- "AWS_DEFAULT_REGION": "default_region",
- "AWS_DEFAULT_PROFILE": "default_profile",
- },
- Config: envConfig{
- SharedCredentialsFile: shareddefaults.SharedCredentialsFilename(),
- SharedConfigFile: shareddefaults.SharedConfigFilename(),
- },
- },
- {
- Env: map[string]string{
- "AWS_DEFAULT_REGION": "default_region",
- "AWS_DEFAULT_PROFILE": "default_profile",
- "AWS_SDK_LOAD_CONFIG": "1",
- },
- Config: envConfig{
- Region: "default_region", Profile: "default_profile",
- EnableSharedConfig: true,
- SharedCredentialsFile: shareddefaults.SharedCredentialsFilename(),
- SharedConfigFile: shareddefaults.SharedConfigFilename(),
- },
- },
- {
- Env: map[string]string{
- "AWS_REGION": "region",
- "AWS_PROFILE": "profile",
- },
- Config: envConfig{
- Region: "region", Profile: "profile",
- EnableSharedConfig: true,
- SharedCredentialsFile: shareddefaults.SharedCredentialsFilename(),
- SharedConfigFile: shareddefaults.SharedConfigFilename(),
- },
- UseSharedConfigCall: true,
- },
- {
- Env: map[string]string{
- "AWS_REGION": "region",
- "AWS_DEFAULT_REGION": "default_region",
- "AWS_PROFILE": "profile",
- "AWS_DEFAULT_PROFILE": "default_profile",
- },
- Config: envConfig{
- Region: "region", Profile: "profile",
- EnableSharedConfig: true,
- SharedCredentialsFile: shareddefaults.SharedCredentialsFilename(),
- SharedConfigFile: shareddefaults.SharedConfigFilename(),
- },
- UseSharedConfigCall: true,
- },
- {
- Env: map[string]string{
- "AWS_REGION": "region",
- "AWS_DEFAULT_REGION": "default_region",
- "AWS_PROFILE": "profile",
- "AWS_DEFAULT_PROFILE": "default_profile",
- "AWS_SDK_LOAD_CONFIG": "1",
- },
- Config: envConfig{
- Region: "region", Profile: "profile",
- EnableSharedConfig: true,
- SharedCredentialsFile: shareddefaults.SharedCredentialsFilename(),
- SharedConfigFile: shareddefaults.SharedConfigFilename(),
- },
- UseSharedConfigCall: true,
- },
- {
- Env: map[string]string{
- "AWS_DEFAULT_REGION": "default_region",
- "AWS_DEFAULT_PROFILE": "default_profile",
- },
- Config: envConfig{
- Region: "default_region", Profile: "default_profile",
- EnableSharedConfig: true,
- SharedCredentialsFile: shareddefaults.SharedCredentialsFilename(),
- SharedConfigFile: shareddefaults.SharedConfigFilename(),
- },
- UseSharedConfigCall: true,
- },
- {
- Env: map[string]string{
- "AWS_DEFAULT_REGION": "default_region",
- "AWS_DEFAULT_PROFILE": "default_profile",
- "AWS_SDK_LOAD_CONFIG": "1",
- },
- Config: envConfig{
- Region: "default_region", Profile: "default_profile",
- EnableSharedConfig: true,
- SharedCredentialsFile: shareddefaults.SharedCredentialsFilename(),
- SharedConfigFile: shareddefaults.SharedConfigFilename(),
- },
- UseSharedConfigCall: true,
- },
- {
- Env: map[string]string{
- "AWS_CA_BUNDLE": "custom_ca_bundle",
- },
- Config: envConfig{
- CustomCABundle: "custom_ca_bundle",
- SharedCredentialsFile: shareddefaults.SharedCredentialsFilename(),
- SharedConfigFile: shareddefaults.SharedConfigFilename(),
- },
- },
- {
- Env: map[string]string{
- "AWS_CA_BUNDLE": "custom_ca_bundle",
- },
- Config: envConfig{
- CustomCABundle: "custom_ca_bundle",
- EnableSharedConfig: true,
- SharedCredentialsFile: shareddefaults.SharedCredentialsFilename(),
- SharedConfigFile: shareddefaults.SharedConfigFilename(),
- },
- UseSharedConfigCall: true,
- },
- {
- Env: map[string]string{
- "AWS_SHARED_CREDENTIALS_FILE": "/path/to/credentials/file",
- "AWS_CONFIG_FILE": "/path/to/config/file",
- },
- Config: envConfig{
- SharedCredentialsFile: "/path/to/credentials/file",
- SharedConfigFile: "/path/to/config/file",
- },
- },
- }
-
- for _, c := range cases {
- os.Clearenv()
-
- for k, v := range c.Env {
- os.Setenv(k, v)
- }
-
- var cfg envConfig
- if c.UseSharedConfigCall {
- cfg = loadSharedEnvConfig()
- } else {
- cfg = loadEnvConfig()
- }
-
- if !reflect.DeepEqual(c.Config, cfg) {
- t.Errorf("expect config to match.\n%s",
- awstesting.SprintExpectActual(c.Config, cfg))
- }
- }
-}
-
-func TestSetEnvValue(t *testing.T) {
- env := awstesting.StashEnv()
- defer awstesting.PopEnv(env)
-
- os.Setenv("empty_key", "")
- os.Setenv("second_key", "2")
- os.Setenv("third_key", "3")
-
- var dst string
- setFromEnvVal(&dst, []string{
- "empty_key", "first_key", "second_key", "third_key",
- })
-
- if e, a := "2", dst; e != a {
- t.Errorf("expect %s value from environment, got %s", e, a)
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/session_test.go b/vendor/github.com/aws/aws-sdk-go/aws/session/session_test.go
deleted file mode 100644
index 9612b3150..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/session/session_test.go
+++ /dev/null
@@ -1,446 +0,0 @@
-package session
-
-import (
- "bytes"
- "fmt"
- "net/http"
- "net/http/httptest"
- "os"
- "testing"
- "time"
-
- "github.com/stretchr/testify/assert"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/credentials"
- "github.com/aws/aws-sdk-go/aws/defaults"
- "github.com/aws/aws-sdk-go/aws/endpoints"
- "github.com/aws/aws-sdk-go/awstesting"
- "github.com/aws/aws-sdk-go/service/s3"
-)
-
-func TestNewDefaultSession(t *testing.T) {
- oldEnv := initSessionTestEnv()
- defer awstesting.PopEnv(oldEnv)
-
- s := New(&aws.Config{Region: aws.String("region")})
-
- assert.Equal(t, "region", *s.Config.Region)
- assert.Equal(t, http.DefaultClient, s.Config.HTTPClient)
- assert.NotNil(t, s.Config.Logger)
- assert.Equal(t, aws.LogOff, *s.Config.LogLevel)
-}
-
-func TestNew_WithCustomCreds(t *testing.T) {
- oldEnv := initSessionTestEnv()
- defer awstesting.PopEnv(oldEnv)
-
- customCreds := credentials.NewStaticCredentials("AKID", "SECRET", "TOKEN")
- s := New(&aws.Config{Credentials: customCreds})
-
- assert.Equal(t, customCreds, s.Config.Credentials)
-}
-
-type mockLogger struct {
- *bytes.Buffer
-}
-
-func (w mockLogger) Log(args ...interface{}) {
- fmt.Fprintln(w, args...)
-}
-
-func TestNew_WithSessionLoadError(t *testing.T) {
- oldEnv := initSessionTestEnv()
- defer awstesting.PopEnv(oldEnv)
-
- os.Setenv("AWS_SDK_LOAD_CONFIG", "1")
- os.Setenv("AWS_CONFIG_FILE", testConfigFilename)
- os.Setenv("AWS_PROFILE", "assume_role_invalid_source_profile")
-
- logger := bytes.Buffer{}
- s := New(&aws.Config{Logger: &mockLogger{&logger}})
-
- assert.NotNil(t, s)
-
- svc := s3.New(s)
- _, err := svc.ListBuckets(&s3.ListBucketsInput{})
-
- assert.Error(t, err)
- assert.Contains(t, logger.String(), "ERROR: failed to create session with AWS_SDK_LOAD_CONFIG enabled")
- assert.Contains(t, err.Error(), SharedConfigAssumeRoleError{
- RoleARN: "assume_role_invalid_source_profile_role_arn",
- }.Error())
-}
-
-func TestSessionCopy(t *testing.T) {
- oldEnv := initSessionTestEnv()
- defer awstesting.PopEnv(oldEnv)
-
- os.Setenv("AWS_REGION", "orig_region")
-
- s := Session{
- Config: defaults.Config(),
- Handlers: defaults.Handlers(),
- }
-
- newSess := s.Copy(&aws.Config{Region: aws.String("new_region")})
-
- assert.Equal(t, "orig_region", *s.Config.Region)
- assert.Equal(t, "new_region", *newSess.Config.Region)
-}
-
-func TestSessionClientConfig(t *testing.T) {
- s, err := NewSession(&aws.Config{
- Credentials: credentials.AnonymousCredentials,
- Region: aws.String("orig_region"),
- EndpointResolver: endpoints.ResolverFunc(
- func(service, region string, opts ...func(*endpoints.Options)) (endpoints.ResolvedEndpoint, error) {
- if e, a := "mock-service", service; e != a {
- t.Errorf("expect %q service, got %q", e, a)
- }
- if e, a := "other-region", region; e != a {
- t.Errorf("expect %q region, got %q", e, a)
- }
- return endpoints.ResolvedEndpoint{
- URL: "https://" + service + "." + region + ".amazonaws.com",
- SigningRegion: region,
- }, nil
- },
- ),
- })
- assert.NoError(t, err)
-
- cfg := s.ClientConfig("mock-service", &aws.Config{Region: aws.String("other-region")})
-
- assert.Equal(t, "https://mock-service.other-region.amazonaws.com", cfg.Endpoint)
- assert.Equal(t, "other-region", cfg.SigningRegion)
- assert.Equal(t, "other-region", *cfg.Config.Region)
-}
-
-func TestNewSession_NoCredentials(t *testing.T) {
- oldEnv := initSessionTestEnv()
- defer awstesting.PopEnv(oldEnv)
-
- s, err := NewSession()
- assert.NoError(t, err)
-
- assert.NotNil(t, s.Config.Credentials)
- assert.NotEqual(t, credentials.AnonymousCredentials, s.Config.Credentials)
-}
-
-func TestNewSessionWithOptions_OverrideProfile(t *testing.T) {
- oldEnv := initSessionTestEnv()
- defer awstesting.PopEnv(oldEnv)
-
- os.Setenv("AWS_SDK_LOAD_CONFIG", "1")
- os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename)
- os.Setenv("AWS_PROFILE", "other_profile")
-
- s, err := NewSessionWithOptions(Options{
- Profile: "full_profile",
- })
- assert.NoError(t, err)
-
- assert.Equal(t, "full_profile_region", *s.Config.Region)
-
- creds, err := s.Config.Credentials.Get()
- assert.NoError(t, err)
- assert.Equal(t, "full_profile_akid", creds.AccessKeyID)
- assert.Equal(t, "full_profile_secret", creds.SecretAccessKey)
- assert.Empty(t, creds.SessionToken)
- assert.Contains(t, creds.ProviderName, "SharedConfigCredentials")
-}
-
-func TestNewSessionWithOptions_OverrideSharedConfigEnable(t *testing.T) {
- oldEnv := initSessionTestEnv()
- defer awstesting.PopEnv(oldEnv)
-
- os.Setenv("AWS_SDK_LOAD_CONFIG", "0")
- os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename)
- os.Setenv("AWS_PROFILE", "full_profile")
-
- s, err := NewSessionWithOptions(Options{
- SharedConfigState: SharedConfigEnable,
- })
- assert.NoError(t, err)
-
- assert.Equal(t, "full_profile_region", *s.Config.Region)
-
- creds, err := s.Config.Credentials.Get()
- assert.NoError(t, err)
- assert.Equal(t, "full_profile_akid", creds.AccessKeyID)
- assert.Equal(t, "full_profile_secret", creds.SecretAccessKey)
- assert.Empty(t, creds.SessionToken)
- assert.Contains(t, creds.ProviderName, "SharedConfigCredentials")
-}
-
-func TestNewSessionWithOptions_OverrideSharedConfigDisable(t *testing.T) {
- oldEnv := initSessionTestEnv()
- defer awstesting.PopEnv(oldEnv)
-
- os.Setenv("AWS_SDK_LOAD_CONFIG", "1")
- os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename)
- os.Setenv("AWS_PROFILE", "full_profile")
-
- s, err := NewSessionWithOptions(Options{
- SharedConfigState: SharedConfigDisable,
- })
- assert.NoError(t, err)
-
- assert.Empty(t, *s.Config.Region)
-
- creds, err := s.Config.Credentials.Get()
- assert.NoError(t, err)
- assert.Equal(t, "full_profile_akid", creds.AccessKeyID)
- assert.Equal(t, "full_profile_secret", creds.SecretAccessKey)
- assert.Empty(t, creds.SessionToken)
- assert.Contains(t, creds.ProviderName, "SharedConfigCredentials")
-}
-
-func TestNewSessionWithOptions_OverrideSharedConfigFiles(t *testing.T) {
- oldEnv := initSessionTestEnv()
- defer awstesting.PopEnv(oldEnv)
-
- os.Setenv("AWS_SDK_LOAD_CONFIG", "1")
- os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename)
- os.Setenv("AWS_PROFILE", "config_file_load_order")
-
- s, err := NewSessionWithOptions(Options{
- SharedConfigFiles: []string{testConfigOtherFilename},
- })
- assert.NoError(t, err)
-
- assert.Equal(t, "shared_config_other_region", *s.Config.Region)
-
- creds, err := s.Config.Credentials.Get()
- assert.NoError(t, err)
- assert.Equal(t, "shared_config_other_akid", creds.AccessKeyID)
- assert.Equal(t, "shared_config_other_secret", creds.SecretAccessKey)
- assert.Empty(t, creds.SessionToken)
- assert.Contains(t, creds.ProviderName, "SharedConfigCredentials")
-}
-
-func TestNewSessionWithOptions_Overrides(t *testing.T) {
- cases := []struct {
- InEnvs map[string]string
- InProfile string
- OutRegion string
- OutCreds credentials.Value
- }{
- {
- InEnvs: map[string]string{
- "AWS_SDK_LOAD_CONFIG": "0",
- "AWS_SHARED_CREDENTIALS_FILE": testConfigFilename,
- "AWS_PROFILE": "other_profile",
- },
- InProfile: "full_profile",
- OutRegion: "full_profile_region",
- OutCreds: credentials.Value{
- AccessKeyID: "full_profile_akid",
- SecretAccessKey: "full_profile_secret",
- ProviderName: "SharedConfigCredentials",
- },
- },
- {
- InEnvs: map[string]string{
- "AWS_SDK_LOAD_CONFIG": "0",
- "AWS_SHARED_CREDENTIALS_FILE": testConfigFilename,
- "AWS_REGION": "env_region",
- "AWS_ACCESS_KEY": "env_akid",
- "AWS_SECRET_ACCESS_KEY": "env_secret",
- "AWS_PROFILE": "other_profile",
- },
- InProfile: "full_profile",
- OutRegion: "env_region",
- OutCreds: credentials.Value{
- AccessKeyID: "env_akid",
- SecretAccessKey: "env_secret",
- ProviderName: "EnvConfigCredentials",
- },
- },
- {
- InEnvs: map[string]string{
- "AWS_SDK_LOAD_CONFIG": "0",
- "AWS_SHARED_CREDENTIALS_FILE": testConfigFilename,
- "AWS_CONFIG_FILE": testConfigOtherFilename,
- "AWS_PROFILE": "shared_profile",
- },
- InProfile: "config_file_load_order",
- OutRegion: "shared_config_region",
- OutCreds: credentials.Value{
- AccessKeyID: "shared_config_akid",
- SecretAccessKey: "shared_config_secret",
- ProviderName: "SharedConfigCredentials",
- },
- },
- }
-
- for _, c := range cases {
- oldEnv := initSessionTestEnv()
- defer awstesting.PopEnv(oldEnv)
-
- for k, v := range c.InEnvs {
- os.Setenv(k, v)
- }
-
- s, err := NewSessionWithOptions(Options{
- Profile: c.InProfile,
- SharedConfigState: SharedConfigEnable,
- })
- assert.NoError(t, err)
-
- creds, err := s.Config.Credentials.Get()
- assert.NoError(t, err)
- assert.Equal(t, c.OutRegion, *s.Config.Region)
- assert.Equal(t, c.OutCreds.AccessKeyID, creds.AccessKeyID)
- assert.Equal(t, c.OutCreds.SecretAccessKey, creds.SecretAccessKey)
- assert.Equal(t, c.OutCreds.SessionToken, creds.SessionToken)
- assert.Contains(t, creds.ProviderName, c.OutCreds.ProviderName)
- }
-}
-
-const assumeRoleRespMsg = `
-<AssumeRoleResponse xmlns="https://sts.amazonaws.com/doc/2011-06-15/">
- <AssumeRoleResult>
- <AssumedRoleUser>
- <Arn>arn:aws:sts::account_id:assumed-role/role/session_name</Arn>
- <AssumedRoleId>AKID:session_name</AssumedRoleId>
- </AssumedRoleUser>
- <Credentials>
- <AccessKeyId>AKID</AccessKeyId>
- <SecretAccessKey>SECRET</SecretAccessKey>
- <SessionToken>SESSION_TOKEN</SessionToken>
- <Expiration>%s</Expiration>
- </Credentials>
- </AssumeRoleResult>
- <ResponseMetadata>
- <RequestId>request-id</RequestId>
- </ResponseMetadata>
-</AssumeRoleResponse>
-`
-
-func TestSesisonAssumeRole(t *testing.T) {
- oldEnv := initSessionTestEnv()
- defer awstesting.PopEnv(oldEnv)
-
- os.Setenv("AWS_REGION", "us-east-1")
- os.Setenv("AWS_SDK_LOAD_CONFIG", "1")
- os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename)
- os.Setenv("AWS_PROFILE", "assume_role_w_creds")
-
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.Write([]byte(fmt.Sprintf(assumeRoleRespMsg, time.Now().Add(15*time.Minute).Format("2006-01-02T15:04:05Z"))))
- }))
-
- s, err := NewSession(&aws.Config{Endpoint: aws.String(server.URL), DisableSSL: aws.Bool(true)})
-
- creds, err := s.Config.Credentials.Get()
- assert.NoError(t, err)
- assert.Equal(t, "AKID", creds.AccessKeyID)
- assert.Equal(t, "SECRET", creds.SecretAccessKey)
- assert.Equal(t, "SESSION_TOKEN", creds.SessionToken)
- assert.Contains(t, creds.ProviderName, "AssumeRoleProvider")
-}
-
-func TestSessionAssumeRole_WithMFA(t *testing.T) {
- oldEnv := initSessionTestEnv()
- defer awstesting.PopEnv(oldEnv)
-
- os.Setenv("AWS_REGION", "us-east-1")
- os.Setenv("AWS_SDK_LOAD_CONFIG", "1")
- os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename)
- os.Setenv("AWS_PROFILE", "assume_role_w_creds")
-
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- assert.Equal(t, r.FormValue("SerialNumber"), "0123456789")
- assert.Equal(t, r.FormValue("TokenCode"), "tokencode")
-
- w.Write([]byte(fmt.Sprintf(assumeRoleRespMsg, time.Now().Add(15*time.Minute).Format("2006-01-02T15:04:05Z"))))
- }))
-
- customProviderCalled := false
- sess, err := NewSessionWithOptions(Options{
- Profile: "assume_role_w_mfa",
- Config: aws.Config{
- Region: aws.String("us-east-1"),
- Endpoint: aws.String(server.URL),
- DisableSSL: aws.Bool(true),
- },
- SharedConfigState: SharedConfigEnable,
- AssumeRoleTokenProvider: func() (string, error) {
- customProviderCalled = true
-
- return "tokencode", nil
- },
- })
- assert.NoError(t, err)
-
- creds, err := sess.Config.Credentials.Get()
- assert.NoError(t, err)
- assert.True(t, customProviderCalled)
-
- assert.Equal(t, "AKID", creds.AccessKeyID)
- assert.Equal(t, "SECRET", creds.SecretAccessKey)
- assert.Equal(t, "SESSION_TOKEN", creds.SessionToken)
- assert.Contains(t, creds.ProviderName, "AssumeRoleProvider")
-}
-
-func TestSessionAssumeRole_WithMFA_NoTokenProvider(t *testing.T) {
- oldEnv := initSessionTestEnv()
- defer awstesting.PopEnv(oldEnv)
-
- os.Setenv("AWS_REGION", "us-east-1")
- os.Setenv("AWS_SDK_LOAD_CONFIG", "1")
- os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename)
- os.Setenv("AWS_PROFILE", "assume_role_w_creds")
-
- _, err := NewSessionWithOptions(Options{
- Profile: "assume_role_w_mfa",
- SharedConfigState: SharedConfigEnable,
- })
- assert.Equal(t, err, AssumeRoleTokenProviderNotSetError{})
-}
-
-func TestSessionAssumeRole_DisableSharedConfig(t *testing.T) {
- // Backwards compatibility with Shared config disabled
- // assume role should not be built into the config.
- oldEnv := initSessionTestEnv()
- defer awstesting.PopEnv(oldEnv)
-
- os.Setenv("AWS_SDK_LOAD_CONFIG", "0")
- os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename)
- os.Setenv("AWS_PROFILE", "assume_role_w_creds")
-
- s, err := NewSession()
- assert.NoError(t, err)
-
- creds, err := s.Config.Credentials.Get()
- assert.NoError(t, err)
- assert.Equal(t, "assume_role_w_creds_akid", creds.AccessKeyID)
- assert.Equal(t, "assume_role_w_creds_secret", creds.SecretAccessKey)
- assert.Contains(t, creds.ProviderName, "SharedConfigCredentials")
-}
-
-func TestSessionAssumeRole_InvalidSourceProfile(t *testing.T) {
- // Backwards compatibility with Shared config disabled
- // assume role should not be built into the config.
- oldEnv := initSessionTestEnv()
- defer awstesting.PopEnv(oldEnv)
-
- os.Setenv("AWS_SDK_LOAD_CONFIG", "1")
- os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename)
- os.Setenv("AWS_PROFILE", "assume_role_invalid_source_profile")
-
- s, err := NewSession()
- assert.Error(t, err)
- assert.Contains(t, err.Error(), "SharedConfigAssumeRoleError: failed to load assume role")
- assert.Nil(t, s)
-}
-
-func initSessionTestEnv() (oldEnv []string) {
- oldEnv = awstesting.StashEnv()
- os.Setenv("AWS_CONFIG_FILE", "file_not_exists")
- os.Setenv("AWS_SHARED_CREDENTIALS_FILE", "file_not_exists")
-
- return oldEnv
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config_test.go b/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config_test.go
deleted file mode 100644
index 3a07b8d97..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config_test.go
+++ /dev/null
@@ -1,274 +0,0 @@
-package session
-
-import (
- "fmt"
- "path/filepath"
- "testing"
-
- "github.com/aws/aws-sdk-go/aws/credentials"
- "github.com/go-ini/ini"
- "github.com/stretchr/testify/assert"
-)
-
-var (
- testConfigFilename = filepath.Join("testdata", "shared_config")
- testConfigOtherFilename = filepath.Join("testdata", "shared_config_other")
-)
-
-func TestLoadSharedConfig(t *testing.T) {
- cases := []struct {
- Filenames []string
- Profile string
- Expected sharedConfig
- Err error
- }{
- {
- Filenames: []string{"file_not_exists"},
- Profile: "default",
- },
- {
- Filenames: []string{testConfigFilename},
- Expected: sharedConfig{
- Region: "default_region",
- },
- },
- {
- Filenames: []string{testConfigOtherFilename, testConfigFilename},
- Profile: "config_file_load_order",
- Expected: sharedConfig{
- Region: "shared_config_region",
- Creds: credentials.Value{
- AccessKeyID: "shared_config_akid",
- SecretAccessKey: "shared_config_secret",
- ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", testConfigFilename),
- },
- },
- },
- {
- Filenames: []string{testConfigFilename, testConfigOtherFilename},
- Profile: "config_file_load_order",
- Expected: sharedConfig{
- Region: "shared_config_other_region",
- Creds: credentials.Value{
- AccessKeyID: "shared_config_other_akid",
- SecretAccessKey: "shared_config_other_secret",
- ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", testConfigOtherFilename),
- },
- },
- },
- {
- Filenames: []string{testConfigOtherFilename, testConfigFilename},
- Profile: "assume_role",
- Expected: sharedConfig{
- AssumeRole: assumeRoleConfig{
- RoleARN: "assume_role_role_arn",
- SourceProfile: "complete_creds",
- },
- AssumeRoleSource: &sharedConfig{
- Creds: credentials.Value{
- AccessKeyID: "complete_creds_akid",
- SecretAccessKey: "complete_creds_secret",
- ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", testConfigFilename),
- },
- },
- },
- },
- {
- Filenames: []string{testConfigOtherFilename, testConfigFilename},
- Profile: "assume_role_invalid_source_profile",
- Expected: sharedConfig{
- AssumeRole: assumeRoleConfig{
- RoleARN: "assume_role_invalid_source_profile_role_arn",
- SourceProfile: "profile_not_exists",
- },
- },
- Err: SharedConfigAssumeRoleError{RoleARN: "assume_role_invalid_source_profile_role_arn"},
- },
- {
- Filenames: []string{testConfigOtherFilename, testConfigFilename},
- Profile: "assume_role_w_creds",
- Expected: sharedConfig{
- Creds: credentials.Value{
- AccessKeyID: "assume_role_w_creds_akid",
- SecretAccessKey: "assume_role_w_creds_secret",
- ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", testConfigFilename),
- },
- AssumeRole: assumeRoleConfig{
- RoleARN: "assume_role_w_creds_role_arn",
- SourceProfile: "assume_role_w_creds",
- ExternalID: "1234",
- RoleSessionName: "assume_role_w_creds_session_name",
- },
- AssumeRoleSource: &sharedConfig{
- Creds: credentials.Value{
- AccessKeyID: "assume_role_w_creds_akid",
- SecretAccessKey: "assume_role_w_creds_secret",
- ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", testConfigFilename),
- },
- },
- },
- },
- {
- Filenames: []string{testConfigOtherFilename, testConfigFilename},
- Profile: "assume_role_wo_creds",
- Expected: sharedConfig{
- AssumeRole: assumeRoleConfig{
- RoleARN: "assume_role_wo_creds_role_arn",
- SourceProfile: "assume_role_wo_creds",
- },
- },
- Err: SharedConfigAssumeRoleError{RoleARN: "assume_role_wo_creds_role_arn"},
- },
- {
- Filenames: []string{filepath.Join("testdata", "shared_config_invalid_ini")},
- Profile: "profile_name",
- Err: SharedConfigLoadError{Filename: filepath.Join("testdata", "shared_config_invalid_ini")},
- },
- }
-
- for i, c := range cases {
- cfg, err := loadSharedConfig(c.Profile, c.Filenames)
- if c.Err != nil {
- assert.Contains(t, err.Error(), c.Err.Error(), "expected error, %d", i)
- continue
- }
-
- assert.NoError(t, err, "unexpected error, %d", i)
- assert.Equal(t, c.Expected, cfg, "not equal, %d", i)
- }
-}
-
-func TestLoadSharedConfigFromFile(t *testing.T) {
- filename := testConfigFilename
- f, err := ini.Load(filename)
- if err != nil {
- t.Fatalf("failed to load test config file, %s, %v", filename, err)
- }
- iniFile := sharedConfigFile{IniData: f, Filename: filename}
-
- cases := []struct {
- Profile string
- Expected sharedConfig
- Err error
- }{
- {
- Profile: "default",
- Expected: sharedConfig{Region: "default_region"},
- },
- {
- Profile: "alt_profile_name",
- Expected: sharedConfig{Region: "alt_profile_name_region"},
- },
- {
- Profile: "short_profile_name_first",
- Expected: sharedConfig{Region: "short_profile_name_first_short"},
- },
- {
- Profile: "partial_creds",
- Expected: sharedConfig{},
- },
- {
- Profile: "complete_creds",
- Expected: sharedConfig{
- Creds: credentials.Value{
- AccessKeyID: "complete_creds_akid",
- SecretAccessKey: "complete_creds_secret",
- ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", testConfigFilename),
- },
- },
- },
- {
- Profile: "complete_creds_with_token",
- Expected: sharedConfig{
- Creds: credentials.Value{
- AccessKeyID: "complete_creds_with_token_akid",
- SecretAccessKey: "complete_creds_with_token_secret",
- SessionToken: "complete_creds_with_token_token",
- ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", testConfigFilename),
- },
- },
- },
- {
- Profile: "full_profile",
- Expected: sharedConfig{
- Creds: credentials.Value{
- AccessKeyID: "full_profile_akid",
- SecretAccessKey: "full_profile_secret",
- ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", testConfigFilename),
- },
- Region: "full_profile_region",
- },
- },
- {
- Profile: "partial_assume_role",
- Expected: sharedConfig{},
- },
- {
- Profile: "assume_role",
- Expected: sharedConfig{
- AssumeRole: assumeRoleConfig{
- RoleARN: "assume_role_role_arn",
- SourceProfile: "complete_creds",
- },
- },
- },
- {
- Profile: "assume_role_w_mfa",
- Expected: sharedConfig{
- AssumeRole: assumeRoleConfig{
- RoleARN: "assume_role_role_arn",
- SourceProfile: "complete_creds",
- MFASerial: "0123456789",
- },
- },
- },
- {
- Profile: "does_not_exists",
- Err: SharedConfigProfileNotExistsError{Profile: "does_not_exists"},
- },
- }
-
- for i, c := range cases {
- cfg := sharedConfig{}
-
- err := cfg.setFromIniFile(c.Profile, iniFile)
- if c.Err != nil {
- assert.Contains(t, err.Error(), c.Err.Error(), "expected error, %d", i)
- continue
- }
-
- assert.NoError(t, err, "unexpected error, %d", i)
- assert.Equal(t, c.Expected, cfg, "not equal, %d", i)
- }
-}
-
-func TestLoadSharedConfigIniFiles(t *testing.T) {
- cases := []struct {
- Filenames []string
- Expected []sharedConfigFile
- }{
- {
- Filenames: []string{"not_exists", testConfigFilename},
- Expected: []sharedConfigFile{
- {Filename: testConfigFilename},
- },
- },
- {
- Filenames: []string{testConfigFilename, testConfigOtherFilename},
- Expected: []sharedConfigFile{
- {Filename: testConfigFilename},
- {Filename: testConfigOtherFilename},
- },
- },
- }
-
- for i, c := range cases {
- files, err := loadSharedConfigIniFiles(c.Filenames)
- assert.NoError(t, err, "unexpected error, %d", i)
- assert.Equal(t, len(c.Expected), len(files), "expected num files, %d", i)
-
- for i, expectedFile := range c.Expected {
- assert.Equal(t, expectedFile.Filename, files[i].Filename)
- }
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/functional_1_5_test.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/functional_1_5_test.go
deleted file mode 100644
index 2e591c27f..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/functional_1_5_test.go
+++ /dev/null
@@ -1,86 +0,0 @@
-// +build go1.5
-
-package v4_test
-
-import (
- "fmt"
- "net/http"
- "testing"
- "time"
-
- "github.com/aws/aws-sdk-go/aws/signer/v4"
- "github.com/aws/aws-sdk-go/awstesting/unit"
-)
-
-func TestStandaloneSign(t *testing.T) {
- creds := unit.Session.Config.Credentials
- signer := v4.NewSigner(creds)
-
- for _, c := range standaloneSignCases {
- host := fmt.Sprintf("https://%s.%s.%s.amazonaws.com",
- c.SubDomain, c.Region, c.Service)
-
- req, err := http.NewRequest("GET", host, nil)
- if err != nil {
- t.Errorf("expected no error, but received %v", err)
- }
-
- // URL.EscapedPath() will be used by the signer to get the
- // escaped form of the request's URI path.
- req.URL.Path = c.OrigURI
- req.URL.RawQuery = c.OrigQuery
-
- _, err = signer.Sign(req, nil, c.Service, c.Region, time.Unix(0, 0))
- if err != nil {
- t.Errorf("expected no error, but received %v", err)
- }
-
- actual := req.Header.Get("Authorization")
- if e, a := c.ExpSig, actual; e != a {
- t.Errorf("expected %v, but recieved %v", e, a)
- }
- if e, a := c.OrigURI, req.URL.Path; e != a {
- t.Errorf("expected %v, but recieved %v", e, a)
- }
- if e, a := c.EscapedURI, req.URL.EscapedPath(); e != a {
- t.Errorf("expected %v, but recieved %v", e, a)
- }
- }
-}
-
-func TestStandaloneSign_RawPath(t *testing.T) {
- creds := unit.Session.Config.Credentials
- signer := v4.NewSigner(creds)
-
- for _, c := range standaloneSignCases {
- host := fmt.Sprintf("https://%s.%s.%s.amazonaws.com",
- c.SubDomain, c.Region, c.Service)
-
- req, err := http.NewRequest("GET", host, nil)
- if err != nil {
- t.Errorf("expected no error, but received %v", err)
- }
-
- // URL.EscapedPath() will be used by the signer to get the
- // escaped form of the request's URI path.
- req.URL.Path = c.OrigURI
- req.URL.RawPath = c.EscapedURI
- req.URL.RawQuery = c.OrigQuery
-
- _, err = signer.Sign(req, nil, c.Service, c.Region, time.Unix(0, 0))
- if err != nil {
- t.Errorf("expected no error, but received %v", err)
- }
-
- actual := req.Header.Get("Authorization")
- if e, a := c.ExpSig, actual; e != a {
- t.Errorf("expected %v, but recieved %v", e, a)
- }
- if e, a := c.OrigURI, req.URL.Path; e != a {
- t.Errorf("expected %v, but recieved %v", e, a)
- }
- if e, a := c.EscapedURI, req.URL.EscapedPath(); e != a {
- t.Errorf("expected %v, but recieved %v", e, a)
- }
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/functional_test.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/functional_test.go
deleted file mode 100644
index 817494522..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/functional_test.go
+++ /dev/null
@@ -1,254 +0,0 @@
-package v4_test
-
-import (
- "net/http"
- "net/url"
- "reflect"
- "strings"
- "testing"
- "time"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/signer/v4"
- "github.com/aws/aws-sdk-go/awstesting/unit"
- "github.com/aws/aws-sdk-go/service/s3"
-)
-
-var standaloneSignCases = []struct {
- OrigURI string
- OrigQuery string
- Region, Service, SubDomain string
- ExpSig string
- EscapedURI string
-}{
- {
- OrigURI: `/logs-*/_search`,
- OrigQuery: `pretty=true`,
- Region: "us-west-2", Service: "es", SubDomain: "hostname-clusterkey",
- EscapedURI: `/logs-%2A/_search`,
- ExpSig: `AWS4-HMAC-SHA256 Credential=AKID/19700101/us-west-2/es/aws4_request, SignedHeaders=host;x-amz-date;x-amz-security-token, Signature=79d0760751907af16f64a537c1242416dacf51204a7dd5284492d15577973b91`,
- },
-}
-
-func TestPresignHandler(t *testing.T) {
- svc := s3.New(unit.Session)
- req, _ := svc.PutObjectRequest(&s3.PutObjectInput{
- Bucket: aws.String("bucket"),
- Key: aws.String("key"),
- ContentDisposition: aws.String("a+b c$d"),
- ACL: aws.String("public-read"),
- })
- req.Time = time.Unix(0, 0)
- urlstr, err := req.Presign(5 * time.Minute)
-
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- expectedHost := "bucket.s3.mock-region.amazonaws.com"
- expectedDate := "19700101T000000Z"
- expectedHeaders := "content-disposition;host;x-amz-acl"
- expectedSig := "2d76a414208c0eac2a23ef9c834db9635ecd5a0fbb447a00ad191f82d854f55b"
- expectedCred := "AKID/19700101/mock-region/s3/aws4_request"
-
- u, _ := url.Parse(urlstr)
- urlQ := u.Query()
- if e, a := expectedHost, u.Host; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := expectedSig, urlQ.Get("X-Amz-Signature"); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := expectedCred, urlQ.Get("X-Amz-Credential"); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := expectedHeaders, urlQ.Get("X-Amz-SignedHeaders"); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := expectedDate, urlQ.Get("X-Amz-Date"); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "300", urlQ.Get("X-Amz-Expires"); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if a := urlQ.Get("X-Amz-Content-Sha256"); len(a) != 0 {
- t.Errorf("expect no content sha256 got %v", a)
- }
-
- if e, a := "+", urlstr; strings.Contains(a, e) { // + encoded as %20
- t.Errorf("expect %v not to be in %v", e, a)
- }
-}
-
-func TestPresignRequest(t *testing.T) {
- svc := s3.New(unit.Session)
- req, _ := svc.PutObjectRequest(&s3.PutObjectInput{
- Bucket: aws.String("bucket"),
- Key: aws.String("key"),
- ContentDisposition: aws.String("a+b c$d"),
- ACL: aws.String("public-read"),
- })
- req.Time = time.Unix(0, 0)
- urlstr, headers, err := req.PresignRequest(5 * time.Minute)
-
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- expectedHost := "bucket.s3.mock-region.amazonaws.com"
- expectedDate := "19700101T000000Z"
- expectedHeaders := "content-disposition;host;x-amz-acl"
- expectedSig := "2d76a414208c0eac2a23ef9c834db9635ecd5a0fbb447a00ad191f82d854f55b"
- expectedCred := "AKID/19700101/mock-region/s3/aws4_request"
- expectedHeaderMap := http.Header{
- "x-amz-acl": []string{"public-read"},
- "content-disposition": []string{"a+b c$d"},
- }
-
- u, _ := url.Parse(urlstr)
- urlQ := u.Query()
- if e, a := expectedHost, u.Host; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := expectedSig, urlQ.Get("X-Amz-Signature"); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := expectedCred, urlQ.Get("X-Amz-Credential"); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := expectedHeaders, urlQ.Get("X-Amz-SignedHeaders"); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := expectedDate, urlQ.Get("X-Amz-Date"); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := expectedHeaderMap, headers; !reflect.DeepEqual(e, a) {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "300", urlQ.Get("X-Amz-Expires"); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if a := urlQ.Get("X-Amz-Content-Sha256"); len(a) != 0 {
- t.Errorf("expect no content sha256 got %v", a)
- }
-
- if e, a := "+", urlstr; strings.Contains(a, e) { // + encoded as %20
- t.Errorf("expect %v not to be in %v", e, a)
- }
-}
-
-func TestStandaloneSign_CustomURIEscape(t *testing.T) {
- var expectSig = `AWS4-HMAC-SHA256 Credential=AKID/19700101/us-east-1/es/aws4_request, SignedHeaders=host;x-amz-date;x-amz-security-token, Signature=6601e883cc6d23871fd6c2a394c5677ea2b8c82b04a6446786d64cd74f520967`
-
- creds := unit.Session.Config.Credentials
- signer := v4.NewSigner(creds, func(s *v4.Signer) {
- s.DisableURIPathEscaping = true
- })
-
- host := "https://subdomain.us-east-1.es.amazonaws.com"
- req, err := http.NewRequest("GET", host, nil)
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- req.URL.Path = `/log-*/_search`
- req.URL.Opaque = "//subdomain.us-east-1.es.amazonaws.com/log-%2A/_search"
-
- _, err = signer.Sign(req, nil, "es", "us-east-1", time.Unix(0, 0))
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- actual := req.Header.Get("Authorization")
- if e, a := expectSig, actual; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-func TestStandaloneSign_WithPort(t *testing.T) {
-
- cases := []struct {
- description string
- url string
- expectedSig string
- }{
- {
- "default HTTPS port",
- "https://estest.us-east-1.es.amazonaws.com:443/_search",
- "AWS4-HMAC-SHA256 Credential=AKID/19700101/us-east-1/es/aws4_request, SignedHeaders=host;x-amz-date;x-amz-security-token, Signature=e573fc9aa3a156b720976419319be98fb2824a3abc2ddd895ecb1d1611c6a82d",
- },
- {
- "default HTTP port",
- "http://example.com:80/_search",
- "AWS4-HMAC-SHA256 Credential=AKID/19700101/us-east-1/es/aws4_request, SignedHeaders=host;x-amz-date;x-amz-security-token, Signature=54ebe60c4ae03a40948b849e13c333523235f38002e2807059c64a9a8c7cb951",
- },
- {
- "non-standard HTTP port",
- "http://example.com:9200/_search",
- "AWS4-HMAC-SHA256 Credential=AKID/19700101/us-east-1/es/aws4_request, SignedHeaders=host;x-amz-date;x-amz-security-token, Signature=cd9d926a460f8d3b58b57beadbd87666dc667e014c0afaa4cea37b2867f51b4f",
- },
- {
- "non-standard HTTPS port",
- "https://example.com:9200/_search",
- "AWS4-HMAC-SHA256 Credential=AKID/19700101/us-east-1/es/aws4_request, SignedHeaders=host;x-amz-date;x-amz-security-token, Signature=cd9d926a460f8d3b58b57beadbd87666dc667e014c0afaa4cea37b2867f51b4f",
- },
- }
-
- for _, c := range cases {
- signer := v4.NewSigner(unit.Session.Config.Credentials)
- req, _ := http.NewRequest("GET", c.url, nil)
- _, err := signer.Sign(req, nil, "es", "us-east-1", time.Unix(0, 0))
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- actual := req.Header.Get("Authorization")
- if e, a := c.expectedSig, actual; e != a {
- t.Errorf("%s, expect %v, got %v", c.description, e, a)
- }
- }
-}
-
-func TestStandalonePresign_WithPort(t *testing.T) {
-
- cases := []struct {
- description string
- url string
- expectedSig string
- }{
- {
- "default HTTPS port",
- "https://estest.us-east-1.es.amazonaws.com:443/_search",
- "0abcf61a351063441296febf4b485734d780634fba8cf1e7d9769315c35255d6",
- },
- {
- "default HTTP port",
- "http://example.com:80/_search",
- "fce9976dd6c849c21adfa6d3f3e9eefc651d0e4a2ccd740d43efddcccfdc8179",
- },
- {
- "non-standard HTTP port",
- "http://example.com:9200/_search",
- "f33c25a81c735e42bef35ed5e9f720c43940562e3e616ff0777bf6dde75249b0",
- },
- {
- "non-standard HTTPS port",
- "https://example.com:9200/_search",
- "f33c25a81c735e42bef35ed5e9f720c43940562e3e616ff0777bf6dde75249b0",
- },
- }
-
- for _, c := range cases {
- signer := v4.NewSigner(unit.Session.Config.Credentials)
- req, _ := http.NewRequest("GET", c.url, nil)
- _, err := signer.Presign(req, nil, "es", "us-east-1", 5*time.Minute, time.Unix(0, 0))
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- actual := req.URL.Query().Get("X-Amz-Signature")
- if e, a := c.expectedSig, actual; e != a {
- t.Errorf("%s, expect %v, got %v", c.description, e, a)
- }
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/header_rules_test.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/header_rules_test.go
deleted file mode 100644
index f4be951ac..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/header_rules_test.go
+++ /dev/null
@@ -1,77 +0,0 @@
-package v4
-
-import (
- "testing"
-)
-
-func TestRuleCheckWhitelist(t *testing.T) {
- w := whitelist{
- mapRule{
- "Cache-Control": struct{}{},
- },
- }
-
- if !w.IsValid("Cache-Control") {
- t.Error("expected true value")
- }
- if w.IsValid("Cache-") {
- t.Error("expected false value")
- }
-}
-
-func TestRuleCheckBlacklist(t *testing.T) {
- b := blacklist{
- mapRule{
- "Cache-Control": struct{}{},
- },
- }
-
- if b.IsValid("Cache-Control") {
- t.Error("expected false value")
- }
- if !b.IsValid("Cache-") {
- t.Error("expected true value")
- }
-}
-
-func TestRuleCheckPattern(t *testing.T) {
- p := patterns{"X-Amz-Meta-"}
-
- if !p.IsValid("X-Amz-Meta-") {
- t.Error("expected true value")
- }
- if !p.IsValid("X-Amz-Meta-Star") {
- t.Error("expected true value")
- }
- if p.IsValid("Cache-") {
- t.Error("expected false value")
- }
-}
-
-func TestRuleComplexWhitelist(t *testing.T) {
- w := rules{
- whitelist{
- mapRule{
- "Cache-Control": struct{}{},
- },
- },
- patterns{"X-Amz-Meta-"},
- }
-
- r := rules{
- inclusiveRules{patterns{"X-Amz-"}, blacklist{w}},
- }
-
- if !r.IsValid("X-Amz-Blah") {
- t.Error("expected true value")
- }
- if r.IsValid("X-Amz-Meta-") {
- t.Error("expected false value")
- }
- if r.IsValid("X-Amz-Meta-Star") {
- t.Error("expected false value")
- }
- if r.IsValid("Cache-Control") {
- t.Error("expected false value")
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4_test.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4_test.go
deleted file mode 100644
index 09c054d06..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4_test.go
+++ /dev/null
@@ -1,737 +0,0 @@
-package v4
-
-import (
- "bytes"
- "io"
- "io/ioutil"
- "net/http"
- "net/http/httptest"
- "reflect"
- "strconv"
- "strings"
- "testing"
- "time"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/credentials"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/awstesting"
-)
-
-func TestStripExcessHeaders(t *testing.T) {
- vals := []string{
- "",
- "123",
- "1 2 3",
- "1 2 3 ",
- " 1 2 3",
- "1 2 3",
- "1 23",
- "1 2 3",
- "1 2 ",
- " 1 2 ",
- "12 3",
- "12 3 1",
- "12 3 1",
- "12 3 1abc123",
- }
-
- expected := []string{
- "",
- "123",
- "1 2 3",
- "1 2 3",
- "1 2 3",
- "1 2 3",
- "1 23",
- "1 2 3",
- "1 2",
- "1 2",
- "12 3",
- "12 3 1",
- "12 3 1",
- "12 3 1abc123",
- }
-
- stripExcessSpaces(vals)
- for i := 0; i < len(vals); i++ {
- if e, a := expected[i], vals[i]; e != a {
- t.Errorf("%d, expect %v, got %v", i, e, a)
- }
- }
-}
-
-func buildRequest(serviceName, region, body string) (*http.Request, io.ReadSeeker) {
- reader := strings.NewReader(body)
- return buildRequestWithBodyReader(serviceName, region, reader)
-}
-
-func buildRequestWithBodyReader(serviceName, region string, body io.Reader) (*http.Request, io.ReadSeeker) {
- var bodyLen int
-
- type lenner interface {
- Len() int
- }
- if lr, ok := body.(lenner); ok {
- bodyLen = lr.Len()
- }
-
- endpoint := "https://" + serviceName + "." + region + ".amazonaws.com"
- req, _ := http.NewRequest("POST", endpoint, body)
- req.URL.Opaque = "//example.org/bucket/key-._~,!@#$%^&*()"
- req.Header.Set("X-Amz-Target", "prefix.Operation")
- req.Header.Set("Content-Type", "application/x-amz-json-1.0")
-
- if bodyLen > 0 {
- req.Header.Set("Content-Length", strconv.Itoa(bodyLen))
- }
-
- req.Header.Set("X-Amz-Meta-Other-Header", "some-value=!@#$%^&* (+)")
- req.Header.Add("X-Amz-Meta-Other-Header_With_Underscore", "some-value=!@#$%^&* (+)")
- req.Header.Add("X-amz-Meta-Other-Header_With_Underscore", "some-value=!@#$%^&* (+)")
-
- var seeker io.ReadSeeker
- if sr, ok := body.(io.ReadSeeker); ok {
- seeker = sr
- } else {
- seeker = aws.ReadSeekCloser(body)
- }
-
- return req, seeker
-}
-
-func buildSigner() Signer {
- return Signer{
- Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "SESSION"),
- }
-}
-
-func removeWS(text string) string {
- text = strings.Replace(text, " ", "", -1)
- text = strings.Replace(text, "\n", "", -1)
- text = strings.Replace(text, "\t", "", -1)
- return text
-}
-
-func assertEqual(t *testing.T, expected, given string) {
- if removeWS(expected) != removeWS(given) {
- t.Errorf("\nExpected: %s\nGiven: %s", expected, given)
- }
-}
-
-func TestPresignRequest(t *testing.T) {
- req, body := buildRequest("dynamodb", "us-east-1", "{}")
-
- signer := buildSigner()
- signer.Presign(req, body, "dynamodb", "us-east-1", 300*time.Second, time.Unix(0, 0))
-
- expectedDate := "19700101T000000Z"
- expectedHeaders := "content-length;content-type;host;x-amz-meta-other-header;x-amz-meta-other-header_with_underscore"
- expectedSig := "122f0b9e091e4ba84286097e2b3404a1f1f4c4aad479adda95b7dff0ccbe5581"
- expectedCred := "AKID/19700101/us-east-1/dynamodb/aws4_request"
- expectedTarget := "prefix.Operation"
-
- q := req.URL.Query()
- if e, a := expectedSig, q.Get("X-Amz-Signature"); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := expectedCred, q.Get("X-Amz-Credential"); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := expectedHeaders, q.Get("X-Amz-SignedHeaders"); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := expectedDate, q.Get("X-Amz-Date"); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if a := q.Get("X-Amz-Meta-Other-Header"); len(a) != 0 {
- t.Errorf("expect %v to be empty", a)
- }
- if e, a := expectedTarget, q.Get("X-Amz-Target"); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-func TestPresignBodyWithArrayRequest(t *testing.T) {
- req, body := buildRequest("dynamodb", "us-east-1", "{}")
- req.URL.RawQuery = "Foo=z&Foo=o&Foo=m&Foo=a"
-
- signer := buildSigner()
- signer.Presign(req, body, "dynamodb", "us-east-1", 300*time.Second, time.Unix(0, 0))
-
- expectedDate := "19700101T000000Z"
- expectedHeaders := "content-length;content-type;host;x-amz-meta-other-header;x-amz-meta-other-header_with_underscore"
- expectedSig := "e3ac55addee8711b76c6d608d762cff285fe8b627a057f8b5ec9268cf82c08b1"
- expectedCred := "AKID/19700101/us-east-1/dynamodb/aws4_request"
- expectedTarget := "prefix.Operation"
-
- q := req.URL.Query()
- if e, a := expectedSig, q.Get("X-Amz-Signature"); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := expectedCred, q.Get("X-Amz-Credential"); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := expectedHeaders, q.Get("X-Amz-SignedHeaders"); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := expectedDate, q.Get("X-Amz-Date"); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if a := q.Get("X-Amz-Meta-Other-Header"); len(a) != 0 {
- t.Errorf("expect %v to be empty, was not", a)
- }
- if e, a := expectedTarget, q.Get("X-Amz-Target"); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-func TestSignRequest(t *testing.T) {
- req, body := buildRequest("dynamodb", "us-east-1", "{}")
- signer := buildSigner()
- signer.Sign(req, body, "dynamodb", "us-east-1", time.Unix(0, 0))
-
- expectedDate := "19700101T000000Z"
- expectedSig := "AWS4-HMAC-SHA256 Credential=AKID/19700101/us-east-1/dynamodb/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date;x-amz-meta-other-header;x-amz-meta-other-header_with_underscore;x-amz-security-token;x-amz-target, Signature=a518299330494908a70222cec6899f6f32f297f8595f6df1776d998936652ad9"
-
- q := req.Header
- if e, a := expectedSig, q.Get("Authorization"); e != a {
- t.Errorf("expect\n%v\nactual\n%v\n", e, a)
- }
- if e, a := expectedDate, q.Get("X-Amz-Date"); e != a {
- t.Errorf("expect\n%v\nactual\n%v\n", e, a)
- }
-}
-
-func TestSignBodyS3(t *testing.T) {
- req, body := buildRequest("s3", "us-east-1", "hello")
- signer := buildSigner()
- signer.Sign(req, body, "s3", "us-east-1", time.Now())
- hash := req.Header.Get("X-Amz-Content-Sha256")
- if e, a := "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824", hash; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-func TestSignBodyGlacier(t *testing.T) {
- req, body := buildRequest("glacier", "us-east-1", "hello")
- signer := buildSigner()
- signer.Sign(req, body, "glacier", "us-east-1", time.Now())
- hash := req.Header.Get("X-Amz-Content-Sha256")
- if e, a := "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824", hash; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-func TestPresign_SignedPayload(t *testing.T) {
- req, body := buildRequest("glacier", "us-east-1", "hello")
- signer := buildSigner()
- signer.Presign(req, body, "glacier", "us-east-1", 5*time.Minute, time.Now())
- hash := req.Header.Get("X-Amz-Content-Sha256")
- if e, a := "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824", hash; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-func TestPresign_UnsignedPayload(t *testing.T) {
- req, body := buildRequest("service-name", "us-east-1", "hello")
- signer := buildSigner()
- signer.UnsignedPayload = true
- signer.Presign(req, body, "service-name", "us-east-1", 5*time.Minute, time.Now())
- hash := req.Header.Get("X-Amz-Content-Sha256")
- if e, a := "UNSIGNED-PAYLOAD", hash; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-func TestPresign_UnsignedPayload_S3(t *testing.T) {
- req, body := buildRequest("s3", "us-east-1", "hello")
- signer := buildSigner()
- signer.Presign(req, body, "s3", "us-east-1", 5*time.Minute, time.Now())
- if a := req.Header.Get("X-Amz-Content-Sha256"); len(a) != 0 {
- t.Errorf("expect no content sha256 got %v", a)
- }
-}
-
-func TestSignUnseekableBody(t *testing.T) {
- req, body := buildRequestWithBodyReader("mock-service", "mock-region", bytes.NewBuffer([]byte("hello")))
- signer := buildSigner()
- _, err := signer.Sign(req, body, "mock-service", "mock-region", time.Now())
- if err == nil {
- t.Fatalf("expect error signing request")
- }
-
- if e, a := "unseekable request body", err.Error(); !strings.Contains(a, e) {
- t.Errorf("expect %q to be in %q", e, a)
- }
-}
-
-func TestSignUnsignedPayloadUnseekableBody(t *testing.T) {
- req, body := buildRequestWithBodyReader("mock-service", "mock-region", bytes.NewBuffer([]byte("hello")))
-
- signer := buildSigner()
- signer.UnsignedPayload = true
-
- _, err := signer.Sign(req, body, "mock-service", "mock-region", time.Now())
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- hash := req.Header.Get("X-Amz-Content-Sha256")
- if e, a := "UNSIGNED-PAYLOAD", hash; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-func TestSignPreComputedHashUnseekableBody(t *testing.T) {
- req, body := buildRequestWithBodyReader("mock-service", "mock-region", bytes.NewBuffer([]byte("hello")))
-
- signer := buildSigner()
-
- req.Header.Set("X-Amz-Content-Sha256", "some-content-sha256")
- _, err := signer.Sign(req, body, "mock-service", "mock-region", time.Now())
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- hash := req.Header.Get("X-Amz-Content-Sha256")
- if e, a := "some-content-sha256", hash; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-func TestSignPrecomputedBodyChecksum(t *testing.T) {
- req, body := buildRequest("dynamodb", "us-east-1", "hello")
- req.Header.Set("X-Amz-Content-Sha256", "PRECOMPUTED")
- signer := buildSigner()
- signer.Sign(req, body, "dynamodb", "us-east-1", time.Now())
- hash := req.Header.Get("X-Amz-Content-Sha256")
- if e, a := "PRECOMPUTED", hash; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-func TestAnonymousCredentials(t *testing.T) {
- svc := awstesting.NewClient(&aws.Config{Credentials: credentials.AnonymousCredentials})
- r := svc.NewRequest(
- &request.Operation{
- Name: "BatchGetItem",
- HTTPMethod: "POST",
- HTTPPath: "/",
- },
- nil,
- nil,
- )
- SignSDKRequest(r)
-
- urlQ := r.HTTPRequest.URL.Query()
- if a := urlQ.Get("X-Amz-Signature"); len(a) != 0 {
- t.Errorf("expect %v to be empty, was not", a)
- }
- if a := urlQ.Get("X-Amz-Credential"); len(a) != 0 {
- t.Errorf("expect %v to be empty, was not", a)
- }
- if a := urlQ.Get("X-Amz-SignedHeaders"); len(a) != 0 {
- t.Errorf("expect %v to be empty, was not", a)
- }
- if a := urlQ.Get("X-Amz-Date"); len(a) != 0 {
- t.Errorf("expect %v to be empty, was not", a)
- }
-
- hQ := r.HTTPRequest.Header
- if a := hQ.Get("Authorization"); len(a) != 0 {
- t.Errorf("expect %v to be empty, was not", a)
- }
- if a := hQ.Get("X-Amz-Date"); len(a) != 0 {
- t.Errorf("expect %v to be empty, was not", a)
- }
-}
-
-func TestIgnoreResignRequestWithValidCreds(t *testing.T) {
- svc := awstesting.NewClient(&aws.Config{
- Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "SESSION"),
- Region: aws.String("us-west-2"),
- })
- r := svc.NewRequest(
- &request.Operation{
- Name: "BatchGetItem",
- HTTPMethod: "POST",
- HTTPPath: "/",
- },
- nil,
- nil,
- )
-
- SignSDKRequest(r)
- sig := r.HTTPRequest.Header.Get("Authorization")
-
- signSDKRequestWithCurrTime(r, func() time.Time {
- // Simulate one second has passed so that signature's date changes
- // when it is resigned.
- return time.Now().Add(1 * time.Second)
- })
- if e, a := sig, r.HTTPRequest.Header.Get("Authorization"); e == a {
- t.Errorf("expect %v to be %v, but was not", e, a)
- }
-}
-
-func TestIgnorePreResignRequestWithValidCreds(t *testing.T) {
- svc := awstesting.NewClient(&aws.Config{
- Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "SESSION"),
- Region: aws.String("us-west-2"),
- })
- r := svc.NewRequest(
- &request.Operation{
- Name: "BatchGetItem",
- HTTPMethod: "POST",
- HTTPPath: "/",
- },
- nil,
- nil,
- )
- r.ExpireTime = time.Minute * 10
-
- SignSDKRequest(r)
- sig := r.HTTPRequest.URL.Query().Get("X-Amz-Signature")
-
- signSDKRequestWithCurrTime(r, func() time.Time {
- // Simulate one second has passed so that signature's date changes
- // when it is resigned.
- return time.Now().Add(1 * time.Second)
- })
- if e, a := sig, r.HTTPRequest.URL.Query().Get("X-Amz-Signature"); e == a {
- t.Errorf("expect %v to be %v, but was not", e, a)
- }
-}
-
-func TestResignRequestExpiredCreds(t *testing.T) {
- creds := credentials.NewStaticCredentials("AKID", "SECRET", "SESSION")
- svc := awstesting.NewClient(&aws.Config{Credentials: creds})
- r := svc.NewRequest(
- &request.Operation{
- Name: "BatchGetItem",
- HTTPMethod: "POST",
- HTTPPath: "/",
- },
- nil,
- nil,
- )
- SignSDKRequest(r)
- querySig := r.HTTPRequest.Header.Get("Authorization")
- var origSignedHeaders string
- for _, p := range strings.Split(querySig, ", ") {
- if strings.HasPrefix(p, "SignedHeaders=") {
- origSignedHeaders = p[len("SignedHeaders="):]
- break
- }
- }
- if a := origSignedHeaders; len(a) == 0 {
- t.Errorf("expect not to be empty, but was")
- }
- if e, a := origSignedHeaders, "authorization"; strings.Contains(a, e) {
- t.Errorf("expect %v to not be in %v, but was", e, a)
- }
- origSignedAt := r.LastSignedAt
-
- creds.Expire()
-
- signSDKRequestWithCurrTime(r, func() time.Time {
- // Simulate one second has passed so that signature's date changes
- // when it is resigned.
- return time.Now().Add(1 * time.Second)
- })
- updatedQuerySig := r.HTTPRequest.Header.Get("Authorization")
- if e, a := querySig, updatedQuerySig; e == a {
- t.Errorf("expect %v to be %v, was not", e, a)
- }
-
- var updatedSignedHeaders string
- for _, p := range strings.Split(updatedQuerySig, ", ") {
- if strings.HasPrefix(p, "SignedHeaders=") {
- updatedSignedHeaders = p[len("SignedHeaders="):]
- break
- }
- }
- if a := updatedSignedHeaders; len(a) == 0 {
- t.Errorf("expect not to be empty, but was")
- }
- if e, a := updatedQuerySig, "authorization"; strings.Contains(a, e) {
- t.Errorf("expect %v to not be in %v, but was", e, a)
- }
- if e, a := origSignedAt, r.LastSignedAt; e == a {
- t.Errorf("expect %v to be %v, was not", e, a)
- }
-}
-
-func TestPreResignRequestExpiredCreds(t *testing.T) {
- provider := &credentials.StaticProvider{Value: credentials.Value{
- AccessKeyID: "AKID",
- SecretAccessKey: "SECRET",
- SessionToken: "SESSION",
- }}
- creds := credentials.NewCredentials(provider)
- svc := awstesting.NewClient(&aws.Config{Credentials: creds})
- r := svc.NewRequest(
- &request.Operation{
- Name: "BatchGetItem",
- HTTPMethod: "POST",
- HTTPPath: "/",
- },
- nil,
- nil,
- )
- r.ExpireTime = time.Minute * 10
-
- SignSDKRequest(r)
- querySig := r.HTTPRequest.URL.Query().Get("X-Amz-Signature")
- signedHeaders := r.HTTPRequest.URL.Query().Get("X-Amz-SignedHeaders")
- if a := signedHeaders; len(a) == 0 {
- t.Errorf("expect not to be empty, but was")
- }
- origSignedAt := r.LastSignedAt
-
- creds.Expire()
-
- signSDKRequestWithCurrTime(r, func() time.Time {
- // Simulate the request occurred 15 minutes in the past
- return time.Now().Add(-48 * time.Hour)
- })
- if e, a := querySig, r.HTTPRequest.URL.Query().Get("X-Amz-Signature"); e == a {
- t.Errorf("expect %v to be %v, was not", e, a)
- }
- resignedHeaders := r.HTTPRequest.URL.Query().Get("X-Amz-SignedHeaders")
- if e, a := signedHeaders, resignedHeaders; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := signedHeaders, "x-amz-signedHeaders"; strings.Contains(a, e) {
- t.Errorf("expect %v to not be in %v, but was", e, a)
- }
- if e, a := origSignedAt, r.LastSignedAt; e == a {
- t.Errorf("expect %v to be %v, was not", e, a)
- }
-}
-
-func TestResignRequestExpiredRequest(t *testing.T) {
- creds := credentials.NewStaticCredentials("AKID", "SECRET", "SESSION")
- svc := awstesting.NewClient(&aws.Config{Credentials: creds})
- r := svc.NewRequest(
- &request.Operation{
- Name: "BatchGetItem",
- HTTPMethod: "POST",
- HTTPPath: "/",
- },
- nil,
- nil,
- )
-
- SignSDKRequest(r)
- querySig := r.HTTPRequest.Header.Get("Authorization")
- origSignedAt := r.LastSignedAt
-
- signSDKRequestWithCurrTime(r, func() time.Time {
- // Simulate the request occurred 15 minutes in the past
- return time.Now().Add(15 * time.Minute)
- })
- if e, a := querySig, r.HTTPRequest.Header.Get("Authorization"); e == a {
- t.Errorf("expect %v to be %v, was not", e, a)
- }
- if e, a := origSignedAt, r.LastSignedAt; e == a {
- t.Errorf("expect %v to be %v, was not", e, a)
- }
-}
-
-func TestSignWithRequestBody(t *testing.T) {
- creds := credentials.NewStaticCredentials("AKID", "SECRET", "SESSION")
- signer := NewSigner(creds)
-
- expectBody := []byte("abc123")
-
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- b, err := ioutil.ReadAll(r.Body)
- r.Body.Close()
- if err != nil {
- t.Errorf("expect no error, got %v", err)
- }
- if e, a := expectBody, b; !reflect.DeepEqual(e, a) {
- t.Errorf("expect %v, got %v", e, a)
- }
- w.WriteHeader(http.StatusOK)
- }))
-
- req, err := http.NewRequest("POST", server.URL, nil)
-
- _, err = signer.Sign(req, bytes.NewReader(expectBody), "service", "region", time.Now())
- if err != nil {
- t.Errorf("expect not no error, got %v", err)
- }
-
- resp, err := http.DefaultClient.Do(req)
- if err != nil {
- t.Errorf("expect not no error, got %v", err)
- }
- if e, a := http.StatusOK, resp.StatusCode; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-func TestSignWithRequestBody_Overwrite(t *testing.T) {
- creds := credentials.NewStaticCredentials("AKID", "SECRET", "SESSION")
- signer := NewSigner(creds)
-
- var expectBody []byte
-
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- b, err := ioutil.ReadAll(r.Body)
- r.Body.Close()
- if err != nil {
- t.Errorf("expect not no error, got %v", err)
- }
- if e, a := len(expectBody), len(b); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- w.WriteHeader(http.StatusOK)
- }))
-
- req, err := http.NewRequest("GET", server.URL, strings.NewReader("invalid body"))
-
- _, err = signer.Sign(req, nil, "service", "region", time.Now())
- req.ContentLength = 0
-
- if err != nil {
- t.Errorf("expect not no error, got %v", err)
- }
-
- resp, err := http.DefaultClient.Do(req)
- if err != nil {
- t.Errorf("expect not no error, got %v", err)
- }
- if e, a := http.StatusOK, resp.StatusCode; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-func TestBuildCanonicalRequest(t *testing.T) {
- req, body := buildRequest("dynamodb", "us-east-1", "{}")
- req.URL.RawQuery = "Foo=z&Foo=o&Foo=m&Foo=a"
- ctx := &signingCtx{
- ServiceName: "dynamodb",
- Region: "us-east-1",
- Request: req,
- Body: body,
- Query: req.URL.Query(),
- Time: time.Now(),
- ExpireTime: 5 * time.Second,
- }
-
- ctx.buildCanonicalString()
- expected := "https://example.org/bucket/key-._~,!@#$%^&*()?Foo=z&Foo=o&Foo=m&Foo=a"
- if e, a := expected, ctx.Request.URL.String(); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-func TestSignWithBody_ReplaceRequestBody(t *testing.T) {
- creds := credentials.NewStaticCredentials("AKID", "SECRET", "SESSION")
- req, seekerBody := buildRequest("dynamodb", "us-east-1", "{}")
- req.Body = ioutil.NopCloser(bytes.NewReader([]byte{}))
-
- s := NewSigner(creds)
- origBody := req.Body
-
- _, err := s.Sign(req, seekerBody, "dynamodb", "us-east-1", time.Now())
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- if req.Body == origBody {
- t.Errorf("expeect request body to not be origBody")
- }
-
- if req.Body == nil {
- t.Errorf("expect request body to be changed but was nil")
- }
-}
-
-func TestSignWithBody_NoReplaceRequestBody(t *testing.T) {
- creds := credentials.NewStaticCredentials("AKID", "SECRET", "SESSION")
- req, seekerBody := buildRequest("dynamodb", "us-east-1", "{}")
- req.Body = ioutil.NopCloser(bytes.NewReader([]byte{}))
-
- s := NewSigner(creds, func(signer *Signer) {
- signer.DisableRequestBodyOverwrite = true
- })
-
- origBody := req.Body
-
- _, err := s.Sign(req, seekerBody, "dynamodb", "us-east-1", time.Now())
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- if req.Body != origBody {
- t.Errorf("expect request body to not be chagned")
- }
-}
-
-func TestRequestHost(t *testing.T) {
- req, body := buildRequest("dynamodb", "us-east-1", "{}")
- req.URL.RawQuery = "Foo=z&Foo=o&Foo=m&Foo=a"
- req.Host = "myhost"
- ctx := &signingCtx{
- ServiceName: "dynamodb",
- Region: "us-east-1",
- Request: req,
- Body: body,
- Query: req.URL.Query(),
- Time: time.Now(),
- ExpireTime: 5 * time.Second,
- }
-
- ctx.buildCanonicalHeaders(ignoredHeaders, ctx.Request.Header)
- if !strings.Contains(ctx.canonicalHeaders, "host:"+req.Host) {
- t.Errorf("canonical host header invalid")
- }
-}
-
-func BenchmarkPresignRequest(b *testing.B) {
- signer := buildSigner()
- req, body := buildRequest("dynamodb", "us-east-1", "{}")
- for i := 0; i < b.N; i++ {
- signer.Presign(req, body, "dynamodb", "us-east-1", 300*time.Second, time.Now())
- }
-}
-
-func BenchmarkSignRequest(b *testing.B) {
- signer := buildSigner()
- req, body := buildRequest("dynamodb", "us-east-1", "{}")
- for i := 0; i < b.N; i++ {
- signer.Sign(req, body, "dynamodb", "us-east-1", time.Now())
- }
-}
-
-var stripExcessSpaceCases = []string{
- `AWS4-HMAC-SHA256 Credential=AKIDFAKEIDFAKEID/20160628/us-west-2/s3/aws4_request, SignedHeaders=host;x-amz-date, Signature=1234567890abcdef1234567890abcdef1234567890abcdef`,
- `123 321 123 321`,
- ` 123 321 123 321 `,
- ` 123 321 123 321 `,
- "123",
- "1 2 3",
- " 1 2 3",
- "1 2 3",
- "1 23",
- "1 2 3",
- "1 2 ",
- " 1 2 ",
- "12 3",
- "12 3 1",
- "12 3 1",
- "12 3 1abc123",
-}
-
-func BenchmarkStripExcessSpaces(b *testing.B) {
- for i := 0; i < b.N; i++ {
- // Make sure to start with a copy of the cases
- cases := append([]string{}, stripExcessSpaceCases...)
- stripExcessSpaces(cases)
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/types_test.go b/vendor/github.com/aws/aws-sdk-go/aws/types_test.go
deleted file mode 100644
index e399ef573..000000000
--- a/vendor/github.com/aws/aws-sdk-go/aws/types_test.go
+++ /dev/null
@@ -1,92 +0,0 @@
-package aws
-
-import (
- "bytes"
- "math/rand"
- "testing"
-)
-
-func TestWriteAtBuffer(t *testing.T) {
- b := &WriteAtBuffer{}
-
- n, err := b.WriteAt([]byte{1}, 0)
- if err != nil {
- t.Errorf("expected no error, but received %v", err)
- }
- if e, a := 1, n; e != a {
- t.Errorf("expected %d, but recieved %d", e, a)
- }
-
- n, err = b.WriteAt([]byte{1, 1, 1}, 5)
- if err != nil {
- t.Errorf("expected no error, but received %v", err)
- }
- if e, a := 3, n; e != a {
- t.Errorf("expected %d, but recieved %d", e, a)
- }
-
- n, err = b.WriteAt([]byte{2}, 1)
- if err != nil {
- t.Errorf("expected no error, but received %v", err)
- }
- if e, a := 1, n; e != a {
- t.Errorf("expected %d, but recieved %d", e, a)
- }
-
- n, err = b.WriteAt([]byte{3}, 2)
- if err != nil {
- t.Errorf("expected no error, but received %v", err)
- }
- if e, a := 1, n; e != a {
- t.Errorf("expected %d, but received %d", e, a)
- }
-
- if !bytes.Equal([]byte{1, 2, 3, 0, 0, 1, 1, 1}, b.Bytes()) {
- t.Errorf("expected %v, but received %v", []byte{1, 2, 3, 0, 0, 1, 1, 1}, b.Bytes())
- }
-}
-
-func BenchmarkWriteAtBuffer(b *testing.B) {
- buf := &WriteAtBuffer{}
- r := rand.New(rand.NewSource(1))
-
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- to := r.Intn(10) * 4096
- bs := make([]byte, to)
- buf.WriteAt(bs, r.Int63n(10)*4096)
- }
-}
-
-func BenchmarkWriteAtBufferOrderedWrites(b *testing.B) {
- // test the performance of a WriteAtBuffer when written in an
- // ordered fashion. This is similar to the behavior of the
- // s3.Downloader, since downloads the first chunk of the file, then
- // the second, and so on.
- //
- // This test simulates a 150MB file being written in 30 ordered 5MB chunks.
- chunk := int64(5e6)
- max := chunk * 30
- // we'll write the same 5MB chunk every time
- tmp := make([]byte, chunk)
- for i := 0; i < b.N; i++ {
- buf := &WriteAtBuffer{}
- for i := int64(0); i < max; i += chunk {
- buf.WriteAt(tmp, i)
- }
- }
-}
-
-func BenchmarkWriteAtBufferParallel(b *testing.B) {
- buf := &WriteAtBuffer{}
- r := rand.New(rand.NewSource(1))
-
- b.ResetTimer()
- b.RunParallel(func(pb *testing.PB) {
- for pb.Next() {
- to := r.Intn(10) * 4096
- bs := make([]byte, to)
- buf.WriteAt(bs, r.Int63n(10)*4096)
- }
- })
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config_other_test.go b/vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config_other_test.go
deleted file mode 100644
index a2fd4558b..000000000
--- a/vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config_other_test.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package shareddefaults_test
-
-import (
- "os"
- "path/filepath"
- "testing"
-
- "github.com/aws/aws-sdk-go/awstesting"
- "github.com/aws/aws-sdk-go/internal/shareddefaults"
-)
-
-func TestSharedCredsFilename(t *testing.T) {
- env := awstesting.StashEnv()
- defer awstesting.PopEnv(env)
-
- os.Setenv("HOME", "home_dir")
- os.Setenv("USERPROFILE", "profile_dir")
-
- expect := filepath.Join("home_dir", ".aws", "credentials")
-
- name := shareddefaults.SharedCredentialsFilename()
- if e, a := expect, name; e != a {
- t.Errorf("expect %q shared creds filename, got %q", e, a)
- }
-}
-
-func TestSharedConfigFilename(t *testing.T) {
- env := awstesting.StashEnv()
- defer awstesting.PopEnv(env)
-
- os.Setenv("HOME", "home_dir")
- os.Setenv("USERPROFILE", "profile_dir")
-
- expect := filepath.Join("home_dir", ".aws", "config")
-
- name := shareddefaults.SharedConfigFilename()
- if e, a := expect, name; e != a {
- t.Errorf("expect %q shared config filename, got %q", e, a)
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config_windows_test.go b/vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config_windows_test.go
deleted file mode 100644
index afe96b17d..000000000
--- a/vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config_windows_test.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package shareddefaults_test
-
-import (
- "os"
- "path/filepath"
- "testing"
-
- "github.com/aws/aws-sdk-go/awstesting"
- "github.com/aws/aws-sdk-go/internal/shareddefaults"
-)
-
-func TestSharedCredsFilename(t *testing.T) {
- env := awstesting.StashEnv()
- defer awstesting.PopEnv(env)
-
- os.Setenv("HOME", "home_dir")
- os.Setenv("USERPROFILE", "profile_dir")
-
- expect := filepath.Join("profile_dir", ".aws", "credentials")
-
- name := shareddefaults.SharedCredentialsFilename()
- if e, a := expect, name; e != a {
- t.Errorf("expect %q shared creds filename, got %q", e, a)
- }
-}
-
-func TestSharedConfigFilename(t *testing.T) {
- env := awstesting.StashEnv()
- defer awstesting.PopEnv(env)
-
- os.Setenv("HOME", "home_dir")
- os.Setenv("USERPROFILE", "profile_dir")
-
- expect := filepath.Join("profile_dir", ".aws", "config")
-
- name := shareddefaults.SharedConfigFilename()
- if e, a := expect, name; e != a {
- t.Errorf("expect %q shared config filename, got %q", e, a)
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/idempotency_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/idempotency_test.go
deleted file mode 100644
index b6ea23562..000000000
--- a/vendor/github.com/aws/aws-sdk-go/private/protocol/idempotency_test.go
+++ /dev/null
@@ -1,106 +0,0 @@
-package protocol_test
-
-import (
- "reflect"
- "testing"
-
- "github.com/aws/aws-sdk-go/private/protocol"
- "github.com/stretchr/testify/assert"
-)
-
-func TestCanSetIdempotencyToken(t *testing.T) {
- cases := []struct {
- CanSet bool
- Case interface{}
- }{
- {
- true,
- struct {
- Field *string `idempotencyToken:"true"`
- }{},
- },
- {
- true,
- struct {
- Field string `idempotencyToken:"true"`
- }{},
- },
- {
- false,
- struct {
- Field *string `idempotencyToken:"true"`
- }{Field: new(string)},
- },
- {
- false,
- struct {
- Field string `idempotencyToken:"true"`
- }{Field: "value"},
- },
- {
- false,
- struct {
- Field *int `idempotencyToken:"true"`
- }{},
- },
- {
- false,
- struct {
- Field *string
- }{},
- },
- }
-
- for i, c := range cases {
- v := reflect.Indirect(reflect.ValueOf(c.Case))
- ty := v.Type()
- canSet := protocol.CanSetIdempotencyToken(v.Field(0), ty.Field(0))
- assert.Equal(t, c.CanSet, canSet, "Expect case %d can set to match", i)
- }
-}
-
-func TestSetIdempotencyToken(t *testing.T) {
- cases := []struct {
- Case interface{}
- }{
- {
- &struct {
- Field *string `idempotencyToken:"true"`
- }{},
- },
- {
- &struct {
- Field string `idempotencyToken:"true"`
- }{},
- },
- {
- &struct {
- Field *string `idempotencyToken:"true"`
- }{Field: new(string)},
- },
- {
- &struct {
- Field string `idempotencyToken:"true"`
- }{Field: ""},
- },
- }
-
- for i, c := range cases {
- v := reflect.Indirect(reflect.ValueOf(c.Case))
-
- protocol.SetIdempotencyToken(v.Field(0))
- assert.NotEmpty(t, v.Field(0).Interface(), "Expect case %d to be set", i)
- }
-}
-
-func TestUUIDVersion4(t *testing.T) {
- uuid := protocol.UUIDVersion4(make([]byte, 16))
- assert.Equal(t, `00000000-0000-4000-8000-000000000000`, uuid)
-
- b := make([]byte, 16)
- for i := 0; i < len(b); i++ {
- b[i] = 1
- }
- uuid = protocol.UUIDVersion4(b)
- assert.Equal(t, `01010101-0101-4101-8101-010101010101`, uuid)
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonvalue_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonvalue_test.go
deleted file mode 100644
index 66a3c8cde..000000000
--- a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonvalue_test.go
+++ /dev/null
@@ -1,93 +0,0 @@
-package protocol
-
-import (
- "fmt"
- "reflect"
- "strings"
- "testing"
-
- "github.com/aws/aws-sdk-go/aws"
-)
-
-var testJSONValueCases = []struct {
- Value aws.JSONValue
- Mode EscapeMode
- String string
-}{
- {
- Value: aws.JSONValue{
- "abc": 123.,
- },
- Mode: NoEscape,
- String: `{"abc":123}`,
- },
- {
- Value: aws.JSONValue{
- "abc": 123.,
- },
- Mode: Base64Escape,
- String: `eyJhYmMiOjEyM30=`,
- },
- {
- Value: aws.JSONValue{
- "abc": 123.,
- },
- Mode: QuotedEscape,
- String: `"{\"abc\":123}"`,
- },
-}
-
-func TestEncodeJSONValue(t *testing.T) {
- for i, c := range testJSONValueCases {
- str, err := EncodeJSONValue(c.Value, c.Mode)
- if err != nil {
- t.Fatalf("%d, expect no error, got %v", i, err)
- }
- if e, a := c.String, str; e != a {
- t.Errorf("%d, expect %v encoded value, got %v", i, e, a)
- }
- }
-}
-
-func TestDecodeJSONValue(t *testing.T) {
- for i, c := range testJSONValueCases {
- val, err := DecodeJSONValue(c.String, c.Mode)
- if err != nil {
- t.Fatalf("%d, expect no error, got %v", i, err)
- }
- if e, a := c.Value, val; !reflect.DeepEqual(e, a) {
- t.Errorf("%d, expect %v encoded value, got %v", i, e, a)
- }
- }
-}
-
-func TestEncodeJSONValue_PanicUnkownMode(t *testing.T) {
- defer func() {
- if r := recover(); r == nil {
- t.Errorf("expect panic, got none")
- } else {
- reason := fmt.Sprintf("%v", r)
- if e, a := "unknown EscapeMode", reason; !strings.Contains(a, e) {
- t.Errorf("expect %q to be in %v", e, a)
- }
- }
- }()
-
- val := aws.JSONValue{}
-
- EncodeJSONValue(val, 123456)
-}
-func TestDecodeJSONValue_PanicUnkownMode(t *testing.T) {
- defer func() {
- if r := recover(); r == nil {
- t.Errorf("expect panic, got none")
- } else {
- reason := fmt.Sprintf("%v", r)
- if e, a := "unknown EscapeMode", reason; !strings.Contains(a, e) {
- t.Errorf("expect %q to be in %v", e, a)
- }
- }
- }()
-
- DecodeJSONValue(`{"abc":123}`, 123456)
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/protocol_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/protocol_test.go
deleted file mode 100644
index eb2e155be..000000000
--- a/vendor/github.com/aws/aws-sdk-go/private/protocol/protocol_test.go
+++ /dev/null
@@ -1,203 +0,0 @@
-package protocol_test
-
-import (
- "net/http"
- "net/url"
- "testing"
-
- "github.com/stretchr/testify/assert"
-
- "github.com/aws/aws-sdk-go/aws/client/metadata"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/awstesting"
- "github.com/aws/aws-sdk-go/private/protocol"
- "github.com/aws/aws-sdk-go/private/protocol/ec2query"
- "github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
- "github.com/aws/aws-sdk-go/private/protocol/query"
- "github.com/aws/aws-sdk-go/private/protocol/rest"
- "github.com/aws/aws-sdk-go/private/protocol/restjson"
- "github.com/aws/aws-sdk-go/private/protocol/restxml"
-)
-
-func xmlData(set bool, b []byte, size, delta int) {
- const openingTags = "<B><A>"
- const closingTags = "</A></B>"
- if !set {
- copy(b, []byte(openingTags))
- }
- if size == 0 {
- copy(b[delta-len(closingTags):], []byte(closingTags))
- }
-}
-
-func jsonData(set bool, b []byte, size, delta int) {
- if !set {
- copy(b, []byte("{\"A\": \""))
- }
- if size == 0 {
- copy(b[delta-len("\"}"):], []byte("\"}"))
- }
-}
-
-func buildNewRequest(data interface{}) *request.Request {
- v := url.Values{}
- v.Set("test", "TEST")
- v.Add("test1", "TEST1")
-
- req := &request.Request{
- HTTPRequest: &http.Request{
- Header: make(http.Header),
- Body: &awstesting.ReadCloser{Size: 2048},
- URL: &url.URL{
- RawQuery: v.Encode(),
- },
- },
- Params: &struct {
- LocationName string `locationName:"test"`
- }{
- "Test",
- },
- ClientInfo: metadata.ClientInfo{
- ServiceName: "test",
- TargetPrefix: "test",
- JSONVersion: "test",
- APIVersion: "test",
- Endpoint: "test",
- SigningName: "test",
- SigningRegion: "test",
- },
- Operation: &request.Operation{
- Name: "test",
- },
- }
- req.HTTPResponse = &http.Response{
- Body: &awstesting.ReadCloser{Size: 2048},
- Header: http.Header{
- "X-Amzn-Requestid": []string{"1"},
- },
- StatusCode: http.StatusOK,
- }
-
- if data == nil {
- data = &struct {
- _ struct{} `type:"structure"`
- LocationName *string `locationName:"testName"`
- Location *string `location:"statusCode"`
- A *string `type:"string"`
- }{}
- }
-
- req.Data = data
-
- return req
-}
-
-type expected struct {
- dataType int
- closed bool
- size int
- errExists bool
-}
-
-const (
- jsonType = iota
- xmlType
-)
-
-func checkForLeak(data interface{}, build, fn func(*request.Request), t *testing.T, result expected) {
- req := buildNewRequest(data)
- reader := req.HTTPResponse.Body.(*awstesting.ReadCloser)
- switch result.dataType {
- case jsonType:
- reader.FillData = jsonData
- case xmlType:
- reader.FillData = xmlData
- }
- build(req)
- fn(req)
-
- if result.errExists {
- assert.NotNil(t, req.Error)
- } else {
- assert.Nil(t, req.Error)
- }
-
- assert.Equal(t, reader.Closed, result.closed)
- assert.Equal(t, reader.Size, result.size)
-}
-
-func TestJSONRpc(t *testing.T) {
- checkForLeak(nil, jsonrpc.Build, jsonrpc.Unmarshal, t, expected{jsonType, true, 0, false})
- checkForLeak(nil, jsonrpc.Build, jsonrpc.UnmarshalMeta, t, expected{jsonType, false, 2048, false})
- checkForLeak(nil, jsonrpc.Build, jsonrpc.UnmarshalError, t, expected{jsonType, true, 0, true})
-}
-
-func TestQuery(t *testing.T) {
- checkForLeak(nil, query.Build, query.Unmarshal, t, expected{jsonType, true, 0, false})
- checkForLeak(nil, query.Build, query.UnmarshalMeta, t, expected{jsonType, false, 2048, false})
- checkForLeak(nil, query.Build, query.UnmarshalError, t, expected{jsonType, true, 0, true})
-}
-
-func TestRest(t *testing.T) {
- // case 1: Payload io.ReadSeeker
- checkForLeak(nil, rest.Build, rest.Unmarshal, t, expected{jsonType, false, 2048, false})
- checkForLeak(nil, query.Build, query.UnmarshalMeta, t, expected{jsonType, false, 2048, false})
-
- // case 2: Payload *string
- // should close the body
- dataStr := struct {
- _ struct{} `type:"structure" payload:"Payload"`
- LocationName *string `locationName:"testName"`
- Location *string `location:"statusCode"`
- A *string `type:"string"`
- Payload *string `locationName:"payload" type:"blob" required:"true"`
- }{}
- checkForLeak(&dataStr, rest.Build, rest.Unmarshal, t, expected{jsonType, true, 0, false})
- checkForLeak(&dataStr, query.Build, query.UnmarshalMeta, t, expected{jsonType, false, 2048, false})
-
- // case 3: Payload []byte
- // should close the body
- dataBytes := struct {
- _ struct{} `type:"structure" payload:"Payload"`
- LocationName *string `locationName:"testName"`
- Location *string `location:"statusCode"`
- A *string `type:"string"`
- Payload []byte `locationName:"payload" type:"blob" required:"true"`
- }{}
- checkForLeak(&dataBytes, rest.Build, rest.Unmarshal, t, expected{jsonType, true, 0, false})
- checkForLeak(&dataBytes, query.Build, query.UnmarshalMeta, t, expected{jsonType, false, 2048, false})
-
- // case 4: Payload unsupported type
- // should close the body
- dataUnsupported := struct {
- _ struct{} `type:"structure" payload:"Payload"`
- LocationName *string `locationName:"testName"`
- Location *string `location:"statusCode"`
- A *string `type:"string"`
- Payload string `locationName:"payload" type:"blob" required:"true"`
- }{}
- checkForLeak(&dataUnsupported, rest.Build, rest.Unmarshal, t, expected{jsonType, true, 0, true})
- checkForLeak(&dataUnsupported, query.Build, query.UnmarshalMeta, t, expected{jsonType, false, 2048, false})
-}
-
-func TestRestJSON(t *testing.T) {
- checkForLeak(nil, restjson.Build, restjson.Unmarshal, t, expected{jsonType, true, 0, false})
- checkForLeak(nil, restjson.Build, restjson.UnmarshalMeta, t, expected{jsonType, false, 2048, false})
- checkForLeak(nil, restjson.Build, restjson.UnmarshalError, t, expected{jsonType, true, 0, true})
-}
-
-func TestRestXML(t *testing.T) {
- checkForLeak(nil, restxml.Build, restxml.Unmarshal, t, expected{xmlType, true, 0, false})
- checkForLeak(nil, restxml.Build, restxml.UnmarshalMeta, t, expected{xmlType, false, 2048, false})
- checkForLeak(nil, restxml.Build, restxml.UnmarshalError, t, expected{xmlType, true, 0, true})
-}
-
-func TestXML(t *testing.T) {
- checkForLeak(nil, ec2query.Build, ec2query.Unmarshal, t, expected{jsonType, true, 0, false})
- checkForLeak(nil, ec2query.Build, ec2query.UnmarshalMeta, t, expected{jsonType, false, 2048, false})
- checkForLeak(nil, ec2query.Build, ec2query.UnmarshalError, t, expected{jsonType, true, 0, true})
-}
-
-func TestProtocol(t *testing.T) {
- checkForLeak(nil, restxml.Build, protocol.UnmarshalDiscardBody, t, expected{xmlType, true, 0, false})
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build_test.go
deleted file mode 100644
index 50dcea52d..000000000
--- a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build_test.go
+++ /dev/null
@@ -1,4071 +0,0 @@
-package query_test
-
-import (
- "bytes"
- "encoding/json"
- "encoding/xml"
- "fmt"
- "io"
- "io/ioutil"
- "net/http"
- "net/url"
- "reflect"
- "testing"
- "time"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/client"
- "github.com/aws/aws-sdk-go/aws/client/metadata"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/aws/signer/v4"
- "github.com/aws/aws-sdk-go/awstesting"
- "github.com/aws/aws-sdk-go/awstesting/unit"
- "github.com/aws/aws-sdk-go/private/protocol"
- "github.com/aws/aws-sdk-go/private/protocol/query"
- "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil"
- "github.com/aws/aws-sdk-go/private/util"
-)
-
-var _ bytes.Buffer // always import bytes
-var _ http.Request
-var _ json.Marshaler
-var _ time.Time
-var _ xmlutil.XMLNode
-var _ xml.Attr
-var _ = ioutil.Discard
-var _ = util.Trim("")
-var _ = url.Values{}
-var _ = io.EOF
-var _ = aws.String
-var _ = fmt.Println
-var _ = reflect.Value{}
-
-func init() {
- protocol.RandReader = &awstesting.ZeroReader{}
-}
-
-// InputService1ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService1ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService1ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService1ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService1ProtocolTest client from just a session.
-// svc := inputservice1protocoltest.New(mySession)
-//
-// // Create a InputService1ProtocolTest client with additional configuration
-// svc := inputservice1protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService1ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService1ProtocolTest {
- c := p.ClientConfig("inputservice1protocoltest", cfgs...)
- return newInputService1ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService1ProtocolTest {
- svc := &InputService1ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService1ProtocolTest",
- ServiceID: "InputService1ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService1ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService1TestCaseOperation1 = "OperationName"
-
-// InputService1TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService1TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService1TestCaseOperation1 for more information on using the InputService1TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService1TestCaseOperation1Request method.
-// req, resp := client.InputService1TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService1ProtocolTest) InputService1TestCaseOperation1Request(input *InputService1TestShapeInputService1TestCaseOperation3Input) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService1TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService1TestShapeInputService1TestCaseOperation3Input{}
- }
-
- output = &InputService1TestShapeInputService1TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService1TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService1TestCaseOperation1 for usage and error information.
-func (c *InputService1ProtocolTest) InputService1TestCaseOperation1(input *InputService1TestShapeInputService1TestCaseOperation3Input) (*InputService1TestShapeInputService1TestCaseOperation1Output, error) {
- req, out := c.InputService1TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService1TestCaseOperation1WithContext is the same as InputService1TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService1TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService1ProtocolTest) InputService1TestCaseOperation1WithContext(ctx aws.Context, input *InputService1TestShapeInputService1TestCaseOperation3Input, opts ...request.Option) (*InputService1TestShapeInputService1TestCaseOperation1Output, error) {
- req, out := c.InputService1TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opInputService1TestCaseOperation2 = "OperationName"
-
-// InputService1TestCaseOperation2Request generates a "aws/request.Request" representing the
-// client's request for the InputService1TestCaseOperation2 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService1TestCaseOperation2 for more information on using the InputService1TestCaseOperation2
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService1TestCaseOperation2Request method.
-// req, resp := client.InputService1TestCaseOperation2Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService1ProtocolTest) InputService1TestCaseOperation2Request(input *InputService1TestShapeInputService1TestCaseOperation3Input) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation2Output) {
- op := &request.Operation{
- Name: opInputService1TestCaseOperation2,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService1TestShapeInputService1TestCaseOperation3Input{}
- }
-
- output = &InputService1TestShapeInputService1TestCaseOperation2Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService1TestCaseOperation2 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService1TestCaseOperation2 for usage and error information.
-func (c *InputService1ProtocolTest) InputService1TestCaseOperation2(input *InputService1TestShapeInputService1TestCaseOperation3Input) (*InputService1TestShapeInputService1TestCaseOperation2Output, error) {
- req, out := c.InputService1TestCaseOperation2Request(input)
- return out, req.Send()
-}
-
-// InputService1TestCaseOperation2WithContext is the same as InputService1TestCaseOperation2 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService1TestCaseOperation2 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService1ProtocolTest) InputService1TestCaseOperation2WithContext(ctx aws.Context, input *InputService1TestShapeInputService1TestCaseOperation3Input, opts ...request.Option) (*InputService1TestShapeInputService1TestCaseOperation2Output, error) {
- req, out := c.InputService1TestCaseOperation2Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opInputService1TestCaseOperation3 = "OperationName"
-
-// InputService1TestCaseOperation3Request generates a "aws/request.Request" representing the
-// client's request for the InputService1TestCaseOperation3 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService1TestCaseOperation3 for more information on using the InputService1TestCaseOperation3
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService1TestCaseOperation3Request method.
-// req, resp := client.InputService1TestCaseOperation3Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService1ProtocolTest) InputService1TestCaseOperation3Request(input *InputService1TestShapeInputService1TestCaseOperation3Input) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation3Output) {
- op := &request.Operation{
- Name: opInputService1TestCaseOperation3,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService1TestShapeInputService1TestCaseOperation3Input{}
- }
-
- output = &InputService1TestShapeInputService1TestCaseOperation3Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService1TestCaseOperation3 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService1TestCaseOperation3 for usage and error information.
-func (c *InputService1ProtocolTest) InputService1TestCaseOperation3(input *InputService1TestShapeInputService1TestCaseOperation3Input) (*InputService1TestShapeInputService1TestCaseOperation3Output, error) {
- req, out := c.InputService1TestCaseOperation3Request(input)
- return out, req.Send()
-}
-
-// InputService1TestCaseOperation3WithContext is the same as InputService1TestCaseOperation3 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService1TestCaseOperation3 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService1ProtocolTest) InputService1TestCaseOperation3WithContext(ctx aws.Context, input *InputService1TestShapeInputService1TestCaseOperation3Input, opts ...request.Option) (*InputService1TestShapeInputService1TestCaseOperation3Output, error) {
- req, out := c.InputService1TestCaseOperation3Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService1TestShapeInputService1TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService1TestShapeInputService1TestCaseOperation2Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService1TestShapeInputService1TestCaseOperation3Input struct {
- _ struct{} `type:"structure"`
-
- Bar *string `type:"string"`
-
- Baz *bool `type:"boolean"`
-
- Foo *string `type:"string"`
-}
-
-// SetBar sets the Bar field's value.
-func (s *InputService1TestShapeInputService1TestCaseOperation3Input) SetBar(v string) *InputService1TestShapeInputService1TestCaseOperation3Input {
- s.Bar = &v
- return s
-}
-
-// SetBaz sets the Baz field's value.
-func (s *InputService1TestShapeInputService1TestCaseOperation3Input) SetBaz(v bool) *InputService1TestShapeInputService1TestCaseOperation3Input {
- s.Baz = &v
- return s
-}
-
-// SetFoo sets the Foo field's value.
-func (s *InputService1TestShapeInputService1TestCaseOperation3Input) SetFoo(v string) *InputService1TestShapeInputService1TestCaseOperation3Input {
- s.Foo = &v
- return s
-}
-
-type InputService1TestShapeInputService1TestCaseOperation3Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService2ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService2ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService2ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService2ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService2ProtocolTest client from just a session.
-// svc := inputservice2protocoltest.New(mySession)
-//
-// // Create a InputService2ProtocolTest client with additional configuration
-// svc := inputservice2protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService2ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService2ProtocolTest {
- c := p.ClientConfig("inputservice2protocoltest", cfgs...)
- return newInputService2ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService2ProtocolTest {
- svc := &InputService2ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService2ProtocolTest",
- ServiceID: "InputService2ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService2ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService2TestCaseOperation1 = "OperationName"
-
-// InputService2TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService2TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService2TestCaseOperation1 for more information on using the InputService2TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService2TestCaseOperation1Request method.
-// req, resp := client.InputService2TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService2ProtocolTest) InputService2TestCaseOperation1Request(input *InputService2TestShapeInputService2TestCaseOperation1Input) (req *request.Request, output *InputService2TestShapeInputService2TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService2TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService2TestShapeInputService2TestCaseOperation1Input{}
- }
-
- output = &InputService2TestShapeInputService2TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService2TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService2TestCaseOperation1 for usage and error information.
-func (c *InputService2ProtocolTest) InputService2TestCaseOperation1(input *InputService2TestShapeInputService2TestCaseOperation1Input) (*InputService2TestShapeInputService2TestCaseOperation1Output, error) {
- req, out := c.InputService2TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService2TestCaseOperation1WithContext is the same as InputService2TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService2TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService2ProtocolTest) InputService2TestCaseOperation1WithContext(ctx aws.Context, input *InputService2TestShapeInputService2TestCaseOperation1Input, opts ...request.Option) (*InputService2TestShapeInputService2TestCaseOperation1Output, error) {
- req, out := c.InputService2TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService2TestShapeInputService2TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-
- StructArg *InputService2TestShapeStructType `type:"structure"`
-}
-
-// SetStructArg sets the StructArg field's value.
-func (s *InputService2TestShapeInputService2TestCaseOperation1Input) SetStructArg(v *InputService2TestShapeStructType) *InputService2TestShapeInputService2TestCaseOperation1Input {
- s.StructArg = v
- return s
-}
-
-type InputService2TestShapeInputService2TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService2TestShapeStructType struct {
- _ struct{} `type:"structure"`
-
- ScalarArg *string `type:"string"`
-}
-
-// SetScalarArg sets the ScalarArg field's value.
-func (s *InputService2TestShapeStructType) SetScalarArg(v string) *InputService2TestShapeStructType {
- s.ScalarArg = &v
- return s
-}
-
-// InputService3ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService3ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService3ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService3ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService3ProtocolTest client from just a session.
-// svc := inputservice3protocoltest.New(mySession)
-//
-// // Create a InputService3ProtocolTest client with additional configuration
-// svc := inputservice3protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService3ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService3ProtocolTest {
- c := p.ClientConfig("inputservice3protocoltest", cfgs...)
- return newInputService3ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService3ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService3ProtocolTest {
- svc := &InputService3ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService3ProtocolTest",
- ServiceID: "InputService3ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService3ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService3TestCaseOperation1 = "OperationName"
-
-// InputService3TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService3TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService3TestCaseOperation1 for more information on using the InputService3TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService3TestCaseOperation1Request method.
-// req, resp := client.InputService3TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService3ProtocolTest) InputService3TestCaseOperation1Request(input *InputService3TestShapeInputService3TestCaseOperation2Input) (req *request.Request, output *InputService3TestShapeInputService3TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService3TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService3TestShapeInputService3TestCaseOperation2Input{}
- }
-
- output = &InputService3TestShapeInputService3TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService3TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService3TestCaseOperation1 for usage and error information.
-func (c *InputService3ProtocolTest) InputService3TestCaseOperation1(input *InputService3TestShapeInputService3TestCaseOperation2Input) (*InputService3TestShapeInputService3TestCaseOperation1Output, error) {
- req, out := c.InputService3TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService3TestCaseOperation1WithContext is the same as InputService3TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService3TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService3ProtocolTest) InputService3TestCaseOperation1WithContext(ctx aws.Context, input *InputService3TestShapeInputService3TestCaseOperation2Input, opts ...request.Option) (*InputService3TestShapeInputService3TestCaseOperation1Output, error) {
- req, out := c.InputService3TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opInputService3TestCaseOperation2 = "OperationName"
-
-// InputService3TestCaseOperation2Request generates a "aws/request.Request" representing the
-// client's request for the InputService3TestCaseOperation2 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService3TestCaseOperation2 for more information on using the InputService3TestCaseOperation2
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService3TestCaseOperation2Request method.
-// req, resp := client.InputService3TestCaseOperation2Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService3ProtocolTest) InputService3TestCaseOperation2Request(input *InputService3TestShapeInputService3TestCaseOperation2Input) (req *request.Request, output *InputService3TestShapeInputService3TestCaseOperation2Output) {
- op := &request.Operation{
- Name: opInputService3TestCaseOperation2,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService3TestShapeInputService3TestCaseOperation2Input{}
- }
-
- output = &InputService3TestShapeInputService3TestCaseOperation2Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService3TestCaseOperation2 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService3TestCaseOperation2 for usage and error information.
-func (c *InputService3ProtocolTest) InputService3TestCaseOperation2(input *InputService3TestShapeInputService3TestCaseOperation2Input) (*InputService3TestShapeInputService3TestCaseOperation2Output, error) {
- req, out := c.InputService3TestCaseOperation2Request(input)
- return out, req.Send()
-}
-
-// InputService3TestCaseOperation2WithContext is the same as InputService3TestCaseOperation2 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService3TestCaseOperation2 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService3ProtocolTest) InputService3TestCaseOperation2WithContext(ctx aws.Context, input *InputService3TestShapeInputService3TestCaseOperation2Input, opts ...request.Option) (*InputService3TestShapeInputService3TestCaseOperation2Output, error) {
- req, out := c.InputService3TestCaseOperation2Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService3TestShapeInputService3TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService3TestShapeInputService3TestCaseOperation2Input struct {
- _ struct{} `type:"structure"`
-
- ListArg []*string `type:"list"`
-}
-
-// SetListArg sets the ListArg field's value.
-func (s *InputService3TestShapeInputService3TestCaseOperation2Input) SetListArg(v []*string) *InputService3TestShapeInputService3TestCaseOperation2Input {
- s.ListArg = v
- return s
-}
-
-type InputService3TestShapeInputService3TestCaseOperation2Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService4ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService4ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService4ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService4ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService4ProtocolTest client from just a session.
-// svc := inputservice4protocoltest.New(mySession)
-//
-// // Create a InputService4ProtocolTest client with additional configuration
-// svc := inputservice4protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService4ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService4ProtocolTest {
- c := p.ClientConfig("inputservice4protocoltest", cfgs...)
- return newInputService4ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService4ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService4ProtocolTest {
- svc := &InputService4ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService4ProtocolTest",
- ServiceID: "InputService4ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService4ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService4TestCaseOperation1 = "OperationName"
-
-// InputService4TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService4TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService4TestCaseOperation1 for more information on using the InputService4TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService4TestCaseOperation1Request method.
-// req, resp := client.InputService4TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService4ProtocolTest) InputService4TestCaseOperation1Request(input *InputService4TestShapeInputService4TestCaseOperation2Input) (req *request.Request, output *InputService4TestShapeInputService4TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService4TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService4TestShapeInputService4TestCaseOperation2Input{}
- }
-
- output = &InputService4TestShapeInputService4TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService4TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService4TestCaseOperation1 for usage and error information.
-func (c *InputService4ProtocolTest) InputService4TestCaseOperation1(input *InputService4TestShapeInputService4TestCaseOperation2Input) (*InputService4TestShapeInputService4TestCaseOperation1Output, error) {
- req, out := c.InputService4TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService4TestCaseOperation1WithContext is the same as InputService4TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService4TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService4ProtocolTest) InputService4TestCaseOperation1WithContext(ctx aws.Context, input *InputService4TestShapeInputService4TestCaseOperation2Input, opts ...request.Option) (*InputService4TestShapeInputService4TestCaseOperation1Output, error) {
- req, out := c.InputService4TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opInputService4TestCaseOperation2 = "OperationName"
-
-// InputService4TestCaseOperation2Request generates a "aws/request.Request" representing the
-// client's request for the InputService4TestCaseOperation2 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService4TestCaseOperation2 for more information on using the InputService4TestCaseOperation2
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService4TestCaseOperation2Request method.
-// req, resp := client.InputService4TestCaseOperation2Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService4ProtocolTest) InputService4TestCaseOperation2Request(input *InputService4TestShapeInputService4TestCaseOperation2Input) (req *request.Request, output *InputService4TestShapeInputService4TestCaseOperation2Output) {
- op := &request.Operation{
- Name: opInputService4TestCaseOperation2,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService4TestShapeInputService4TestCaseOperation2Input{}
- }
-
- output = &InputService4TestShapeInputService4TestCaseOperation2Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService4TestCaseOperation2 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService4TestCaseOperation2 for usage and error information.
-func (c *InputService4ProtocolTest) InputService4TestCaseOperation2(input *InputService4TestShapeInputService4TestCaseOperation2Input) (*InputService4TestShapeInputService4TestCaseOperation2Output, error) {
- req, out := c.InputService4TestCaseOperation2Request(input)
- return out, req.Send()
-}
-
-// InputService4TestCaseOperation2WithContext is the same as InputService4TestCaseOperation2 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService4TestCaseOperation2 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService4ProtocolTest) InputService4TestCaseOperation2WithContext(ctx aws.Context, input *InputService4TestShapeInputService4TestCaseOperation2Input, opts ...request.Option) (*InputService4TestShapeInputService4TestCaseOperation2Output, error) {
- req, out := c.InputService4TestCaseOperation2Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService4TestShapeInputService4TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService4TestShapeInputService4TestCaseOperation2Input struct {
- _ struct{} `type:"structure"`
-
- ListArg []*string `type:"list" flattened:"true"`
-
- NamedListArg []*string `locationNameList:"Foo" type:"list" flattened:"true"`
-
- ScalarArg *string `type:"string"`
-}
-
-// SetListArg sets the ListArg field's value.
-func (s *InputService4TestShapeInputService4TestCaseOperation2Input) SetListArg(v []*string) *InputService4TestShapeInputService4TestCaseOperation2Input {
- s.ListArg = v
- return s
-}
-
-// SetNamedListArg sets the NamedListArg field's value.
-func (s *InputService4TestShapeInputService4TestCaseOperation2Input) SetNamedListArg(v []*string) *InputService4TestShapeInputService4TestCaseOperation2Input {
- s.NamedListArg = v
- return s
-}
-
-// SetScalarArg sets the ScalarArg field's value.
-func (s *InputService4TestShapeInputService4TestCaseOperation2Input) SetScalarArg(v string) *InputService4TestShapeInputService4TestCaseOperation2Input {
- s.ScalarArg = &v
- return s
-}
-
-type InputService4TestShapeInputService4TestCaseOperation2Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService5ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService5ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService5ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService5ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService5ProtocolTest client from just a session.
-// svc := inputservice5protocoltest.New(mySession)
-//
-// // Create a InputService5ProtocolTest client with additional configuration
-// svc := inputservice5protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService5ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService5ProtocolTest {
- c := p.ClientConfig("inputservice5protocoltest", cfgs...)
- return newInputService5ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService5ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService5ProtocolTest {
- svc := &InputService5ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService5ProtocolTest",
- ServiceID: "InputService5ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService5ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService5TestCaseOperation1 = "OperationName"
-
-// InputService5TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService5TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService5TestCaseOperation1 for more information on using the InputService5TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService5TestCaseOperation1Request method.
-// req, resp := client.InputService5TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService5ProtocolTest) InputService5TestCaseOperation1Request(input *InputService5TestShapeInputService5TestCaseOperation1Input) (req *request.Request, output *InputService5TestShapeInputService5TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService5TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService5TestShapeInputService5TestCaseOperation1Input{}
- }
-
- output = &InputService5TestShapeInputService5TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService5TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService5TestCaseOperation1 for usage and error information.
-func (c *InputService5ProtocolTest) InputService5TestCaseOperation1(input *InputService5TestShapeInputService5TestCaseOperation1Input) (*InputService5TestShapeInputService5TestCaseOperation1Output, error) {
- req, out := c.InputService5TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService5TestCaseOperation1WithContext is the same as InputService5TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService5TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService5ProtocolTest) InputService5TestCaseOperation1WithContext(ctx aws.Context, input *InputService5TestShapeInputService5TestCaseOperation1Input, opts ...request.Option) (*InputService5TestShapeInputService5TestCaseOperation1Output, error) {
- req, out := c.InputService5TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService5TestShapeInputService5TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-
- MapArg map[string]*string `type:"map" flattened:"true"`
-}
-
-// SetMapArg sets the MapArg field's value.
-func (s *InputService5TestShapeInputService5TestCaseOperation1Input) SetMapArg(v map[string]*string) *InputService5TestShapeInputService5TestCaseOperation1Input {
- s.MapArg = v
- return s
-}
-
-type InputService5TestShapeInputService5TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService6ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService6ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService6ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService6ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService6ProtocolTest client from just a session.
-// svc := inputservice6protocoltest.New(mySession)
-//
-// // Create a InputService6ProtocolTest client with additional configuration
-// svc := inputservice6protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService6ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService6ProtocolTest {
- c := p.ClientConfig("inputservice6protocoltest", cfgs...)
- return newInputService6ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService6ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService6ProtocolTest {
- svc := &InputService6ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService6ProtocolTest",
- ServiceID: "InputService6ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService6ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService6TestCaseOperation1 = "OperationName"
-
-// InputService6TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService6TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService6TestCaseOperation1 for more information on using the InputService6TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService6TestCaseOperation1Request method.
-// req, resp := client.InputService6TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService6ProtocolTest) InputService6TestCaseOperation1Request(input *InputService6TestShapeInputService6TestCaseOperation1Input) (req *request.Request, output *InputService6TestShapeInputService6TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService6TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService6TestShapeInputService6TestCaseOperation1Input{}
- }
-
- output = &InputService6TestShapeInputService6TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService6TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService6TestCaseOperation1 for usage and error information.
-func (c *InputService6ProtocolTest) InputService6TestCaseOperation1(input *InputService6TestShapeInputService6TestCaseOperation1Input) (*InputService6TestShapeInputService6TestCaseOperation1Output, error) {
- req, out := c.InputService6TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService6TestCaseOperation1WithContext is the same as InputService6TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService6TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService6ProtocolTest) InputService6TestCaseOperation1WithContext(ctx aws.Context, input *InputService6TestShapeInputService6TestCaseOperation1Input, opts ...request.Option) (*InputService6TestShapeInputService6TestCaseOperation1Output, error) {
- req, out := c.InputService6TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService6TestShapeInputService6TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-
- ListArg []*string `locationNameList:"item" type:"list"`
-}
-
-// SetListArg sets the ListArg field's value.
-func (s *InputService6TestShapeInputService6TestCaseOperation1Input) SetListArg(v []*string) *InputService6TestShapeInputService6TestCaseOperation1Input {
- s.ListArg = v
- return s
-}
-
-type InputService6TestShapeInputService6TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService7ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService7ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService7ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService7ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService7ProtocolTest client from just a session.
-// svc := inputservice7protocoltest.New(mySession)
-//
-// // Create a InputService7ProtocolTest client with additional configuration
-// svc := inputservice7protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService7ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService7ProtocolTest {
- c := p.ClientConfig("inputservice7protocoltest", cfgs...)
- return newInputService7ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService7ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService7ProtocolTest {
- svc := &InputService7ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService7ProtocolTest",
- ServiceID: "InputService7ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService7ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService7TestCaseOperation1 = "OperationName"
-
-// InputService7TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService7TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService7TestCaseOperation1 for more information on using the InputService7TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService7TestCaseOperation1Request method.
-// req, resp := client.InputService7TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService7ProtocolTest) InputService7TestCaseOperation1Request(input *InputService7TestShapeInputService7TestCaseOperation1Input) (req *request.Request, output *InputService7TestShapeInputService7TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService7TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService7TestShapeInputService7TestCaseOperation1Input{}
- }
-
- output = &InputService7TestShapeInputService7TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService7TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService7TestCaseOperation1 for usage and error information.
-func (c *InputService7ProtocolTest) InputService7TestCaseOperation1(input *InputService7TestShapeInputService7TestCaseOperation1Input) (*InputService7TestShapeInputService7TestCaseOperation1Output, error) {
- req, out := c.InputService7TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService7TestCaseOperation1WithContext is the same as InputService7TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService7TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService7ProtocolTest) InputService7TestCaseOperation1WithContext(ctx aws.Context, input *InputService7TestShapeInputService7TestCaseOperation1Input, opts ...request.Option) (*InputService7TestShapeInputService7TestCaseOperation1Output, error) {
- req, out := c.InputService7TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService7TestShapeInputService7TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-
- ListArg []*string `locationNameList:"ListArgLocation" type:"list" flattened:"true"`
-
- ScalarArg *string `type:"string"`
-}
-
-// SetListArg sets the ListArg field's value.
-func (s *InputService7TestShapeInputService7TestCaseOperation1Input) SetListArg(v []*string) *InputService7TestShapeInputService7TestCaseOperation1Input {
- s.ListArg = v
- return s
-}
-
-// SetScalarArg sets the ScalarArg field's value.
-func (s *InputService7TestShapeInputService7TestCaseOperation1Input) SetScalarArg(v string) *InputService7TestShapeInputService7TestCaseOperation1Input {
- s.ScalarArg = &v
- return s
-}
-
-type InputService7TestShapeInputService7TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService8ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService8ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService8ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService8ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService8ProtocolTest client from just a session.
-// svc := inputservice8protocoltest.New(mySession)
-//
-// // Create a InputService8ProtocolTest client with additional configuration
-// svc := inputservice8protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService8ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService8ProtocolTest {
- c := p.ClientConfig("inputservice8protocoltest", cfgs...)
- return newInputService8ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService8ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService8ProtocolTest {
- svc := &InputService8ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService8ProtocolTest",
- ServiceID: "InputService8ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService8ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService8TestCaseOperation1 = "OperationName"
-
-// InputService8TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService8TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService8TestCaseOperation1 for more information on using the InputService8TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService8TestCaseOperation1Request method.
-// req, resp := client.InputService8TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService8ProtocolTest) InputService8TestCaseOperation1Request(input *InputService8TestShapeInputService8TestCaseOperation1Input) (req *request.Request, output *InputService8TestShapeInputService8TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService8TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService8TestShapeInputService8TestCaseOperation1Input{}
- }
-
- output = &InputService8TestShapeInputService8TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService8TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService8TestCaseOperation1 for usage and error information.
-func (c *InputService8ProtocolTest) InputService8TestCaseOperation1(input *InputService8TestShapeInputService8TestCaseOperation1Input) (*InputService8TestShapeInputService8TestCaseOperation1Output, error) {
- req, out := c.InputService8TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService8TestCaseOperation1WithContext is the same as InputService8TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService8TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService8ProtocolTest) InputService8TestCaseOperation1WithContext(ctx aws.Context, input *InputService8TestShapeInputService8TestCaseOperation1Input, opts ...request.Option) (*InputService8TestShapeInputService8TestCaseOperation1Output, error) {
- req, out := c.InputService8TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService8TestShapeInputService8TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-
- MapArg map[string]*string `type:"map"`
-}
-
-// SetMapArg sets the MapArg field's value.
-func (s *InputService8TestShapeInputService8TestCaseOperation1Input) SetMapArg(v map[string]*string) *InputService8TestShapeInputService8TestCaseOperation1Input {
- s.MapArg = v
- return s
-}
-
-type InputService8TestShapeInputService8TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService9ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService9ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService9ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService9ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService9ProtocolTest client from just a session.
-// svc := inputservice9protocoltest.New(mySession)
-//
-// // Create a InputService9ProtocolTest client with additional configuration
-// svc := inputservice9protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService9ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService9ProtocolTest {
- c := p.ClientConfig("inputservice9protocoltest", cfgs...)
- return newInputService9ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService9ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService9ProtocolTest {
- svc := &InputService9ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService9ProtocolTest",
- ServiceID: "InputService9ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService9ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService9ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService9TestCaseOperation1 = "OperationName"
-
-// InputService9TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService9TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService9TestCaseOperation1 for more information on using the InputService9TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService9TestCaseOperation1Request method.
-// req, resp := client.InputService9TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService9ProtocolTest) InputService9TestCaseOperation1Request(input *InputService9TestShapeInputService9TestCaseOperation1Input) (req *request.Request, output *InputService9TestShapeInputService9TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService9TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService9TestShapeInputService9TestCaseOperation1Input{}
- }
-
- output = &InputService9TestShapeInputService9TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService9TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService9TestCaseOperation1 for usage and error information.
-func (c *InputService9ProtocolTest) InputService9TestCaseOperation1(input *InputService9TestShapeInputService9TestCaseOperation1Input) (*InputService9TestShapeInputService9TestCaseOperation1Output, error) {
- req, out := c.InputService9TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService9TestCaseOperation1WithContext is the same as InputService9TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService9TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService9ProtocolTest) InputService9TestCaseOperation1WithContext(ctx aws.Context, input *InputService9TestShapeInputService9TestCaseOperation1Input, opts ...request.Option) (*InputService9TestShapeInputService9TestCaseOperation1Output, error) {
- req, out := c.InputService9TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService9TestShapeInputService9TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-
- MapArg map[string]*string `locationNameKey:"TheKey" locationNameValue:"TheValue" type:"map"`
-}
-
-// SetMapArg sets the MapArg field's value.
-func (s *InputService9TestShapeInputService9TestCaseOperation1Input) SetMapArg(v map[string]*string) *InputService9TestShapeInputService9TestCaseOperation1Input {
- s.MapArg = v
- return s
-}
-
-type InputService9TestShapeInputService9TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService10ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService10ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService10ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService10ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService10ProtocolTest client from just a session.
-// svc := inputservice10protocoltest.New(mySession)
-//
-// // Create a InputService10ProtocolTest client with additional configuration
-// svc := inputservice10protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService10ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService10ProtocolTest {
- c := p.ClientConfig("inputservice10protocoltest", cfgs...)
- return newInputService10ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService10ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService10ProtocolTest {
- svc := &InputService10ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService10ProtocolTest",
- ServiceID: "InputService10ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService10ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService10ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService10TestCaseOperation1 = "OperationName"
-
-// InputService10TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService10TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService10TestCaseOperation1 for more information on using the InputService10TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService10TestCaseOperation1Request method.
-// req, resp := client.InputService10TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService10ProtocolTest) InputService10TestCaseOperation1Request(input *InputService10TestShapeInputService10TestCaseOperation1Input) (req *request.Request, output *InputService10TestShapeInputService10TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService10TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService10TestShapeInputService10TestCaseOperation1Input{}
- }
-
- output = &InputService10TestShapeInputService10TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService10TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService10TestCaseOperation1 for usage and error information.
-func (c *InputService10ProtocolTest) InputService10TestCaseOperation1(input *InputService10TestShapeInputService10TestCaseOperation1Input) (*InputService10TestShapeInputService10TestCaseOperation1Output, error) {
- req, out := c.InputService10TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService10TestCaseOperation1WithContext is the same as InputService10TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService10TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService10ProtocolTest) InputService10TestCaseOperation1WithContext(ctx aws.Context, input *InputService10TestShapeInputService10TestCaseOperation1Input, opts ...request.Option) (*InputService10TestShapeInputService10TestCaseOperation1Output, error) {
- req, out := c.InputService10TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService10TestShapeInputService10TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-
- // BlobArg is automatically base64 encoded/decoded by the SDK.
- BlobArg []byte `type:"blob"`
-}
-
-// SetBlobArg sets the BlobArg field's value.
-func (s *InputService10TestShapeInputService10TestCaseOperation1Input) SetBlobArg(v []byte) *InputService10TestShapeInputService10TestCaseOperation1Input {
- s.BlobArg = v
- return s
-}
-
-type InputService10TestShapeInputService10TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService11ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService11ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService11ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService11ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService11ProtocolTest client from just a session.
-// svc := inputservice11protocoltest.New(mySession)
-//
-// // Create a InputService11ProtocolTest client with additional configuration
-// svc := inputservice11protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService11ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService11ProtocolTest {
- c := p.ClientConfig("inputservice11protocoltest", cfgs...)
- return newInputService11ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService11ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService11ProtocolTest {
- svc := &InputService11ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService11ProtocolTest",
- ServiceID: "InputService11ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService11ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService11ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService11TestCaseOperation1 = "OperationName"
-
-// InputService11TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService11TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService11TestCaseOperation1 for more information on using the InputService11TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService11TestCaseOperation1Request method.
-// req, resp := client.InputService11TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService11ProtocolTest) InputService11TestCaseOperation1Request(input *InputService11TestShapeInputService11TestCaseOperation1Input) (req *request.Request, output *InputService11TestShapeInputService11TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService11TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService11TestShapeInputService11TestCaseOperation1Input{}
- }
-
- output = &InputService11TestShapeInputService11TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService11TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService11TestCaseOperation1 for usage and error information.
-func (c *InputService11ProtocolTest) InputService11TestCaseOperation1(input *InputService11TestShapeInputService11TestCaseOperation1Input) (*InputService11TestShapeInputService11TestCaseOperation1Output, error) {
- req, out := c.InputService11TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService11TestCaseOperation1WithContext is the same as InputService11TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService11TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService11ProtocolTest) InputService11TestCaseOperation1WithContext(ctx aws.Context, input *InputService11TestShapeInputService11TestCaseOperation1Input, opts ...request.Option) (*InputService11TestShapeInputService11TestCaseOperation1Output, error) {
- req, out := c.InputService11TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService11TestShapeInputService11TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-
- BlobArgs [][]byte `type:"list" flattened:"true"`
-}
-
-// SetBlobArgs sets the BlobArgs field's value.
-func (s *InputService11TestShapeInputService11TestCaseOperation1Input) SetBlobArgs(v [][]byte) *InputService11TestShapeInputService11TestCaseOperation1Input {
- s.BlobArgs = v
- return s
-}
-
-type InputService11TestShapeInputService11TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService12ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService12ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService12ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService12ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService12ProtocolTest client from just a session.
-// svc := inputservice12protocoltest.New(mySession)
-//
-// // Create a InputService12ProtocolTest client with additional configuration
-// svc := inputservice12protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService12ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService12ProtocolTest {
- c := p.ClientConfig("inputservice12protocoltest", cfgs...)
- return newInputService12ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService12ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService12ProtocolTest {
- svc := &InputService12ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService12ProtocolTest",
- ServiceID: "InputService12ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService12ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService12ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService12TestCaseOperation1 = "OperationName"
-
-// InputService12TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService12TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService12TestCaseOperation1 for more information on using the InputService12TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService12TestCaseOperation1Request method.
-// req, resp := client.InputService12TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService12ProtocolTest) InputService12TestCaseOperation1Request(input *InputService12TestShapeInputService12TestCaseOperation1Input) (req *request.Request, output *InputService12TestShapeInputService12TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService12TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService12TestShapeInputService12TestCaseOperation1Input{}
- }
-
- output = &InputService12TestShapeInputService12TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService12TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService12TestCaseOperation1 for usage and error information.
-func (c *InputService12ProtocolTest) InputService12TestCaseOperation1(input *InputService12TestShapeInputService12TestCaseOperation1Input) (*InputService12TestShapeInputService12TestCaseOperation1Output, error) {
- req, out := c.InputService12TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService12TestCaseOperation1WithContext is the same as InputService12TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService12TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService12ProtocolTest) InputService12TestCaseOperation1WithContext(ctx aws.Context, input *InputService12TestShapeInputService12TestCaseOperation1Input, opts ...request.Option) (*InputService12TestShapeInputService12TestCaseOperation1Output, error) {
- req, out := c.InputService12TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService12TestShapeInputService12TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-
- TimeArg *time.Time `type:"timestamp" timestampFormat:"iso8601"`
-}
-
-// SetTimeArg sets the TimeArg field's value.
-func (s *InputService12TestShapeInputService12TestCaseOperation1Input) SetTimeArg(v time.Time) *InputService12TestShapeInputService12TestCaseOperation1Input {
- s.TimeArg = &v
- return s
-}
-
-type InputService12TestShapeInputService12TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService13ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService13ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService13ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService13ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService13ProtocolTest client from just a session.
-// svc := inputservice13protocoltest.New(mySession)
-//
-// // Create a InputService13ProtocolTest client with additional configuration
-// svc := inputservice13protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService13ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService13ProtocolTest {
- c := p.ClientConfig("inputservice13protocoltest", cfgs...)
- return newInputService13ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService13ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService13ProtocolTest {
- svc := &InputService13ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService13ProtocolTest",
- ServiceID: "InputService13ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService13ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService13ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService13TestCaseOperation1 = "OperationName"
-
-// InputService13TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService13TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService13TestCaseOperation1 for more information on using the InputService13TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService13TestCaseOperation1Request method.
-// req, resp := client.InputService13TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService13ProtocolTest) InputService13TestCaseOperation1Request(input *InputService13TestShapeInputService13TestCaseOperation6Input) (req *request.Request, output *InputService13TestShapeInputService13TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService13TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService13TestShapeInputService13TestCaseOperation6Input{}
- }
-
- output = &InputService13TestShapeInputService13TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService13TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService13TestCaseOperation1 for usage and error information.
-func (c *InputService13ProtocolTest) InputService13TestCaseOperation1(input *InputService13TestShapeInputService13TestCaseOperation6Input) (*InputService13TestShapeInputService13TestCaseOperation1Output, error) {
- req, out := c.InputService13TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService13TestCaseOperation1WithContext is the same as InputService13TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService13TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService13ProtocolTest) InputService13TestCaseOperation1WithContext(ctx aws.Context, input *InputService13TestShapeInputService13TestCaseOperation6Input, opts ...request.Option) (*InputService13TestShapeInputService13TestCaseOperation1Output, error) {
- req, out := c.InputService13TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opInputService13TestCaseOperation2 = "OperationName"
-
-// InputService13TestCaseOperation2Request generates a "aws/request.Request" representing the
-// client's request for the InputService13TestCaseOperation2 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService13TestCaseOperation2 for more information on using the InputService13TestCaseOperation2
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService13TestCaseOperation2Request method.
-// req, resp := client.InputService13TestCaseOperation2Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService13ProtocolTest) InputService13TestCaseOperation2Request(input *InputService13TestShapeInputService13TestCaseOperation6Input) (req *request.Request, output *InputService13TestShapeInputService13TestCaseOperation2Output) {
- op := &request.Operation{
- Name: opInputService13TestCaseOperation2,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService13TestShapeInputService13TestCaseOperation6Input{}
- }
-
- output = &InputService13TestShapeInputService13TestCaseOperation2Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService13TestCaseOperation2 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService13TestCaseOperation2 for usage and error information.
-func (c *InputService13ProtocolTest) InputService13TestCaseOperation2(input *InputService13TestShapeInputService13TestCaseOperation6Input) (*InputService13TestShapeInputService13TestCaseOperation2Output, error) {
- req, out := c.InputService13TestCaseOperation2Request(input)
- return out, req.Send()
-}
-
-// InputService13TestCaseOperation2WithContext is the same as InputService13TestCaseOperation2 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService13TestCaseOperation2 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService13ProtocolTest) InputService13TestCaseOperation2WithContext(ctx aws.Context, input *InputService13TestShapeInputService13TestCaseOperation6Input, opts ...request.Option) (*InputService13TestShapeInputService13TestCaseOperation2Output, error) {
- req, out := c.InputService13TestCaseOperation2Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opInputService13TestCaseOperation3 = "OperationName"
-
-// InputService13TestCaseOperation3Request generates a "aws/request.Request" representing the
-// client's request for the InputService13TestCaseOperation3 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService13TestCaseOperation3 for more information on using the InputService13TestCaseOperation3
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService13TestCaseOperation3Request method.
-// req, resp := client.InputService13TestCaseOperation3Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService13ProtocolTest) InputService13TestCaseOperation3Request(input *InputService13TestShapeInputService13TestCaseOperation6Input) (req *request.Request, output *InputService13TestShapeInputService13TestCaseOperation3Output) {
- op := &request.Operation{
- Name: opInputService13TestCaseOperation3,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService13TestShapeInputService13TestCaseOperation6Input{}
- }
-
- output = &InputService13TestShapeInputService13TestCaseOperation3Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService13TestCaseOperation3 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService13TestCaseOperation3 for usage and error information.
-func (c *InputService13ProtocolTest) InputService13TestCaseOperation3(input *InputService13TestShapeInputService13TestCaseOperation6Input) (*InputService13TestShapeInputService13TestCaseOperation3Output, error) {
- req, out := c.InputService13TestCaseOperation3Request(input)
- return out, req.Send()
-}
-
-// InputService13TestCaseOperation3WithContext is the same as InputService13TestCaseOperation3 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService13TestCaseOperation3 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService13ProtocolTest) InputService13TestCaseOperation3WithContext(ctx aws.Context, input *InputService13TestShapeInputService13TestCaseOperation6Input, opts ...request.Option) (*InputService13TestShapeInputService13TestCaseOperation3Output, error) {
- req, out := c.InputService13TestCaseOperation3Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opInputService13TestCaseOperation4 = "OperationName"
-
-// InputService13TestCaseOperation4Request generates a "aws/request.Request" representing the
-// client's request for the InputService13TestCaseOperation4 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService13TestCaseOperation4 for more information on using the InputService13TestCaseOperation4
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService13TestCaseOperation4Request method.
-// req, resp := client.InputService13TestCaseOperation4Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService13ProtocolTest) InputService13TestCaseOperation4Request(input *InputService13TestShapeInputService13TestCaseOperation6Input) (req *request.Request, output *InputService13TestShapeInputService13TestCaseOperation4Output) {
- op := &request.Operation{
- Name: opInputService13TestCaseOperation4,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService13TestShapeInputService13TestCaseOperation6Input{}
- }
-
- output = &InputService13TestShapeInputService13TestCaseOperation4Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService13TestCaseOperation4 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService13TestCaseOperation4 for usage and error information.
-func (c *InputService13ProtocolTest) InputService13TestCaseOperation4(input *InputService13TestShapeInputService13TestCaseOperation6Input) (*InputService13TestShapeInputService13TestCaseOperation4Output, error) {
- req, out := c.InputService13TestCaseOperation4Request(input)
- return out, req.Send()
-}
-
-// InputService13TestCaseOperation4WithContext is the same as InputService13TestCaseOperation4 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService13TestCaseOperation4 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService13ProtocolTest) InputService13TestCaseOperation4WithContext(ctx aws.Context, input *InputService13TestShapeInputService13TestCaseOperation6Input, opts ...request.Option) (*InputService13TestShapeInputService13TestCaseOperation4Output, error) {
- req, out := c.InputService13TestCaseOperation4Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opInputService13TestCaseOperation5 = "OperationName"
-
-// InputService13TestCaseOperation5Request generates a "aws/request.Request" representing the
-// client's request for the InputService13TestCaseOperation5 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService13TestCaseOperation5 for more information on using the InputService13TestCaseOperation5
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService13TestCaseOperation5Request method.
-// req, resp := client.InputService13TestCaseOperation5Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService13ProtocolTest) InputService13TestCaseOperation5Request(input *InputService13TestShapeInputService13TestCaseOperation6Input) (req *request.Request, output *InputService13TestShapeInputService13TestCaseOperation5Output) {
- op := &request.Operation{
- Name: opInputService13TestCaseOperation5,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService13TestShapeInputService13TestCaseOperation6Input{}
- }
-
- output = &InputService13TestShapeInputService13TestCaseOperation5Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService13TestCaseOperation5 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService13TestCaseOperation5 for usage and error information.
-func (c *InputService13ProtocolTest) InputService13TestCaseOperation5(input *InputService13TestShapeInputService13TestCaseOperation6Input) (*InputService13TestShapeInputService13TestCaseOperation5Output, error) {
- req, out := c.InputService13TestCaseOperation5Request(input)
- return out, req.Send()
-}
-
-// InputService13TestCaseOperation5WithContext is the same as InputService13TestCaseOperation5 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService13TestCaseOperation5 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService13ProtocolTest) InputService13TestCaseOperation5WithContext(ctx aws.Context, input *InputService13TestShapeInputService13TestCaseOperation6Input, opts ...request.Option) (*InputService13TestShapeInputService13TestCaseOperation5Output, error) {
- req, out := c.InputService13TestCaseOperation5Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opInputService13TestCaseOperation6 = "OperationName"
-
-// InputService13TestCaseOperation6Request generates a "aws/request.Request" representing the
-// client's request for the InputService13TestCaseOperation6 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService13TestCaseOperation6 for more information on using the InputService13TestCaseOperation6
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService13TestCaseOperation6Request method.
-// req, resp := client.InputService13TestCaseOperation6Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService13ProtocolTest) InputService13TestCaseOperation6Request(input *InputService13TestShapeInputService13TestCaseOperation6Input) (req *request.Request, output *InputService13TestShapeInputService13TestCaseOperation6Output) {
- op := &request.Operation{
- Name: opInputService13TestCaseOperation6,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService13TestShapeInputService13TestCaseOperation6Input{}
- }
-
- output = &InputService13TestShapeInputService13TestCaseOperation6Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService13TestCaseOperation6 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService13TestCaseOperation6 for usage and error information.
-func (c *InputService13ProtocolTest) InputService13TestCaseOperation6(input *InputService13TestShapeInputService13TestCaseOperation6Input) (*InputService13TestShapeInputService13TestCaseOperation6Output, error) {
- req, out := c.InputService13TestCaseOperation6Request(input)
- return out, req.Send()
-}
-
-// InputService13TestCaseOperation6WithContext is the same as InputService13TestCaseOperation6 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService13TestCaseOperation6 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService13ProtocolTest) InputService13TestCaseOperation6WithContext(ctx aws.Context, input *InputService13TestShapeInputService13TestCaseOperation6Input, opts ...request.Option) (*InputService13TestShapeInputService13TestCaseOperation6Output, error) {
- req, out := c.InputService13TestCaseOperation6Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService13TestShapeInputService13TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService13TestShapeInputService13TestCaseOperation2Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService13TestShapeInputService13TestCaseOperation3Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService13TestShapeInputService13TestCaseOperation4Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService13TestShapeInputService13TestCaseOperation5Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService13TestShapeInputService13TestCaseOperation6Input struct {
- _ struct{} `type:"structure"`
-
- RecursiveStruct *InputService13TestShapeRecursiveStructType `type:"structure"`
-}
-
-// SetRecursiveStruct sets the RecursiveStruct field's value.
-func (s *InputService13TestShapeInputService13TestCaseOperation6Input) SetRecursiveStruct(v *InputService13TestShapeRecursiveStructType) *InputService13TestShapeInputService13TestCaseOperation6Input {
- s.RecursiveStruct = v
- return s
-}
-
-type InputService13TestShapeInputService13TestCaseOperation6Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService13TestShapeRecursiveStructType struct {
- _ struct{} `type:"structure"`
-
- NoRecurse *string `type:"string"`
-
- RecursiveList []*InputService13TestShapeRecursiveStructType `type:"list"`
-
- RecursiveMap map[string]*InputService13TestShapeRecursiveStructType `type:"map"`
-
- RecursiveStruct *InputService13TestShapeRecursiveStructType `type:"structure"`
-}
-
-// SetNoRecurse sets the NoRecurse field's value.
-func (s *InputService13TestShapeRecursiveStructType) SetNoRecurse(v string) *InputService13TestShapeRecursiveStructType {
- s.NoRecurse = &v
- return s
-}
-
-// SetRecursiveList sets the RecursiveList field's value.
-func (s *InputService13TestShapeRecursiveStructType) SetRecursiveList(v []*InputService13TestShapeRecursiveStructType) *InputService13TestShapeRecursiveStructType {
- s.RecursiveList = v
- return s
-}
-
-// SetRecursiveMap sets the RecursiveMap field's value.
-func (s *InputService13TestShapeRecursiveStructType) SetRecursiveMap(v map[string]*InputService13TestShapeRecursiveStructType) *InputService13TestShapeRecursiveStructType {
- s.RecursiveMap = v
- return s
-}
-
-// SetRecursiveStruct sets the RecursiveStruct field's value.
-func (s *InputService13TestShapeRecursiveStructType) SetRecursiveStruct(v *InputService13TestShapeRecursiveStructType) *InputService13TestShapeRecursiveStructType {
- s.RecursiveStruct = v
- return s
-}
-
-// InputService14ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService14ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService14ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService14ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService14ProtocolTest client from just a session.
-// svc := inputservice14protocoltest.New(mySession)
-//
-// // Create a InputService14ProtocolTest client with additional configuration
-// svc := inputservice14protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService14ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService14ProtocolTest {
- c := p.ClientConfig("inputservice14protocoltest", cfgs...)
- return newInputService14ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService14ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService14ProtocolTest {
- svc := &InputService14ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService14ProtocolTest",
- ServiceID: "InputService14ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService14ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService14ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService14TestCaseOperation1 = "OperationName"
-
-// InputService14TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService14TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService14TestCaseOperation1 for more information on using the InputService14TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService14TestCaseOperation1Request method.
-// req, resp := client.InputService14TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService14ProtocolTest) InputService14TestCaseOperation1Request(input *InputService14TestShapeInputService14TestCaseOperation2Input) (req *request.Request, output *InputService14TestShapeInputService14TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService14TestCaseOperation1,
- HTTPMethod: "POST",
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService14TestShapeInputService14TestCaseOperation2Input{}
- }
-
- output = &InputService14TestShapeInputService14TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService14TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService14TestCaseOperation1 for usage and error information.
-func (c *InputService14ProtocolTest) InputService14TestCaseOperation1(input *InputService14TestShapeInputService14TestCaseOperation2Input) (*InputService14TestShapeInputService14TestCaseOperation1Output, error) {
- req, out := c.InputService14TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService14TestCaseOperation1WithContext is the same as InputService14TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService14TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService14ProtocolTest) InputService14TestCaseOperation1WithContext(ctx aws.Context, input *InputService14TestShapeInputService14TestCaseOperation2Input, opts ...request.Option) (*InputService14TestShapeInputService14TestCaseOperation1Output, error) {
- req, out := c.InputService14TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opInputService14TestCaseOperation2 = "OperationName"
-
-// InputService14TestCaseOperation2Request generates a "aws/request.Request" representing the
-// client's request for the InputService14TestCaseOperation2 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService14TestCaseOperation2 for more information on using the InputService14TestCaseOperation2
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService14TestCaseOperation2Request method.
-// req, resp := client.InputService14TestCaseOperation2Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService14ProtocolTest) InputService14TestCaseOperation2Request(input *InputService14TestShapeInputService14TestCaseOperation2Input) (req *request.Request, output *InputService14TestShapeInputService14TestCaseOperation2Output) {
- op := &request.Operation{
- Name: opInputService14TestCaseOperation2,
- HTTPMethod: "POST",
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService14TestShapeInputService14TestCaseOperation2Input{}
- }
-
- output = &InputService14TestShapeInputService14TestCaseOperation2Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService14TestCaseOperation2 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService14TestCaseOperation2 for usage and error information.
-func (c *InputService14ProtocolTest) InputService14TestCaseOperation2(input *InputService14TestShapeInputService14TestCaseOperation2Input) (*InputService14TestShapeInputService14TestCaseOperation2Output, error) {
- req, out := c.InputService14TestCaseOperation2Request(input)
- return out, req.Send()
-}
-
-// InputService14TestCaseOperation2WithContext is the same as InputService14TestCaseOperation2 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService14TestCaseOperation2 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService14ProtocolTest) InputService14TestCaseOperation2WithContext(ctx aws.Context, input *InputService14TestShapeInputService14TestCaseOperation2Input, opts ...request.Option) (*InputService14TestShapeInputService14TestCaseOperation2Output, error) {
- req, out := c.InputService14TestCaseOperation2Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService14TestShapeInputService14TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService14TestShapeInputService14TestCaseOperation2Input struct {
- _ struct{} `type:"structure"`
-
- Token *string `type:"string" idempotencyToken:"true"`
-}
-
-// SetToken sets the Token field's value.
-func (s *InputService14TestShapeInputService14TestCaseOperation2Input) SetToken(v string) *InputService14TestShapeInputService14TestCaseOperation2Input {
- s.Token = &v
- return s
-}
-
-type InputService14TestShapeInputService14TestCaseOperation2Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService15ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService15ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService15ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService15ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService15ProtocolTest client from just a session.
-// svc := inputservice15protocoltest.New(mySession)
-//
-// // Create a InputService15ProtocolTest client with additional configuration
-// svc := inputservice15protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService15ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService15ProtocolTest {
- c := p.ClientConfig("inputservice15protocoltest", cfgs...)
- return newInputService15ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService15ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService15ProtocolTest {
- svc := &InputService15ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService15ProtocolTest",
- ServiceID: "InputService15ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService15ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService15ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService15TestCaseOperation1 = "OperationName"
-
-// InputService15TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService15TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService15TestCaseOperation1 for more information on using the InputService15TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService15TestCaseOperation1Request method.
-// req, resp := client.InputService15TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService15ProtocolTest) InputService15TestCaseOperation1Request(input *InputService15TestShapeInputService15TestCaseOperation3Input) (req *request.Request, output *InputService15TestShapeInputService15TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService15TestCaseOperation1,
- HTTPMethod: "POST",
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService15TestShapeInputService15TestCaseOperation3Input{}
- }
-
- output = &InputService15TestShapeInputService15TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService15TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService15TestCaseOperation1 for usage and error information.
-func (c *InputService15ProtocolTest) InputService15TestCaseOperation1(input *InputService15TestShapeInputService15TestCaseOperation3Input) (*InputService15TestShapeInputService15TestCaseOperation1Output, error) {
- req, out := c.InputService15TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService15TestCaseOperation1WithContext is the same as InputService15TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService15TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService15ProtocolTest) InputService15TestCaseOperation1WithContext(ctx aws.Context, input *InputService15TestShapeInputService15TestCaseOperation3Input, opts ...request.Option) (*InputService15TestShapeInputService15TestCaseOperation1Output, error) {
- req, out := c.InputService15TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opInputService15TestCaseOperation2 = "OperationName"
-
-// InputService15TestCaseOperation2Request generates a "aws/request.Request" representing the
-// client's request for the InputService15TestCaseOperation2 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService15TestCaseOperation2 for more information on using the InputService15TestCaseOperation2
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService15TestCaseOperation2Request method.
-// req, resp := client.InputService15TestCaseOperation2Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService15ProtocolTest) InputService15TestCaseOperation2Request(input *InputService15TestShapeInputService15TestCaseOperation3Input) (req *request.Request, output *InputService15TestShapeInputService15TestCaseOperation2Output) {
- op := &request.Operation{
- Name: opInputService15TestCaseOperation2,
- HTTPMethod: "POST",
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService15TestShapeInputService15TestCaseOperation3Input{}
- }
-
- output = &InputService15TestShapeInputService15TestCaseOperation2Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService15TestCaseOperation2 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService15TestCaseOperation2 for usage and error information.
-func (c *InputService15ProtocolTest) InputService15TestCaseOperation2(input *InputService15TestShapeInputService15TestCaseOperation3Input) (*InputService15TestShapeInputService15TestCaseOperation2Output, error) {
- req, out := c.InputService15TestCaseOperation2Request(input)
- return out, req.Send()
-}
-
-// InputService15TestCaseOperation2WithContext is the same as InputService15TestCaseOperation2 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService15TestCaseOperation2 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService15ProtocolTest) InputService15TestCaseOperation2WithContext(ctx aws.Context, input *InputService15TestShapeInputService15TestCaseOperation3Input, opts ...request.Option) (*InputService15TestShapeInputService15TestCaseOperation2Output, error) {
- req, out := c.InputService15TestCaseOperation2Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opInputService15TestCaseOperation3 = "OperationName"
-
-// InputService15TestCaseOperation3Request generates a "aws/request.Request" representing the
-// client's request for the InputService15TestCaseOperation3 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService15TestCaseOperation3 for more information on using the InputService15TestCaseOperation3
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService15TestCaseOperation3Request method.
-// req, resp := client.InputService15TestCaseOperation3Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService15ProtocolTest) InputService15TestCaseOperation3Request(input *InputService15TestShapeInputService15TestCaseOperation3Input) (req *request.Request, output *InputService15TestShapeInputService15TestCaseOperation3Output) {
- op := &request.Operation{
- Name: opInputService15TestCaseOperation3,
- HTTPMethod: "POST",
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService15TestShapeInputService15TestCaseOperation3Input{}
- }
-
- output = &InputService15TestShapeInputService15TestCaseOperation3Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService15TestCaseOperation3 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService15TestCaseOperation3 for usage and error information.
-func (c *InputService15ProtocolTest) InputService15TestCaseOperation3(input *InputService15TestShapeInputService15TestCaseOperation3Input) (*InputService15TestShapeInputService15TestCaseOperation3Output, error) {
- req, out := c.InputService15TestCaseOperation3Request(input)
- return out, req.Send()
-}
-
-// InputService15TestCaseOperation3WithContext is the same as InputService15TestCaseOperation3 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService15TestCaseOperation3 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService15ProtocolTest) InputService15TestCaseOperation3WithContext(ctx aws.Context, input *InputService15TestShapeInputService15TestCaseOperation3Input, opts ...request.Option) (*InputService15TestShapeInputService15TestCaseOperation3Output, error) {
- req, out := c.InputService15TestCaseOperation3Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService15TestShapeInputService15TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService15TestShapeInputService15TestCaseOperation2Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService15TestShapeInputService15TestCaseOperation3Input struct {
- _ struct{} `type:"structure"`
-
- FooEnum *string `type:"string" enum:"InputService15TestShapeEnumType"`
-
- ListEnums []*string `type:"list"`
-}
-
-// SetFooEnum sets the FooEnum field's value.
-func (s *InputService15TestShapeInputService15TestCaseOperation3Input) SetFooEnum(v string) *InputService15TestShapeInputService15TestCaseOperation3Input {
- s.FooEnum = &v
- return s
-}
-
-// SetListEnums sets the ListEnums field's value.
-func (s *InputService15TestShapeInputService15TestCaseOperation3Input) SetListEnums(v []*string) *InputService15TestShapeInputService15TestCaseOperation3Input {
- s.ListEnums = v
- return s
-}
-
-type InputService15TestShapeInputService15TestCaseOperation3Output struct {
- _ struct{} `type:"structure"`
-}
-
-const (
- // EnumTypeFoo is a InputService15TestShapeEnumType enum value
- EnumTypeFoo = "foo"
-
- // EnumTypeBar is a InputService15TestShapeEnumType enum value
- EnumTypeBar = "bar"
-)
-
-//
-// Tests begin here
-//
-
-func TestInputService1ProtocolTestScalarMembersCase1(t *testing.T) {
- svc := NewInputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService1TestShapeInputService1TestCaseOperation3Input{
- Bar: aws.String("val2"),
- Foo: aws.String("val1"),
- }
- req, _ := svc.InputService1TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body, _ := ioutil.ReadAll(r.Body)
- awstesting.AssertQuery(t, `Action=OperationName&Bar=val2&Foo=val1&Version=2014-01-01`, util.Trim(string(body)))
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService1ProtocolTestScalarMembersCase2(t *testing.T) {
- svc := NewInputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService1TestShapeInputService1TestCaseOperation3Input{
- Baz: aws.Bool(true),
- }
- req, _ := svc.InputService1TestCaseOperation2Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body, _ := ioutil.ReadAll(r.Body)
- awstesting.AssertQuery(t, `Action=OperationName&Baz=true&Version=2014-01-01`, util.Trim(string(body)))
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService1ProtocolTestScalarMembersCase3(t *testing.T) {
- svc := NewInputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService1TestShapeInputService1TestCaseOperation3Input{
- Baz: aws.Bool(false),
- }
- req, _ := svc.InputService1TestCaseOperation3Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body, _ := ioutil.ReadAll(r.Body)
- awstesting.AssertQuery(t, `Action=OperationName&Baz=false&Version=2014-01-01`, util.Trim(string(body)))
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService2ProtocolTestNestedStructureMembersCase1(t *testing.T) {
- svc := NewInputService2ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService2TestShapeInputService2TestCaseOperation1Input{
- StructArg: &InputService2TestShapeStructType{
- ScalarArg: aws.String("foo"),
- },
- }
- req, _ := svc.InputService2TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body, _ := ioutil.ReadAll(r.Body)
- awstesting.AssertQuery(t, `Action=OperationName&StructArg.ScalarArg=foo&Version=2014-01-01`, util.Trim(string(body)))
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService3ProtocolTestListTypesCase1(t *testing.T) {
- svc := NewInputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService3TestShapeInputService3TestCaseOperation2Input{
- ListArg: []*string{
- aws.String("foo"),
- aws.String("bar"),
- aws.String("baz"),
- },
- }
- req, _ := svc.InputService3TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body, _ := ioutil.ReadAll(r.Body)
- awstesting.AssertQuery(t, `Action=OperationName&ListArg.member.1=foo&ListArg.member.2=bar&ListArg.member.3=baz&Version=2014-01-01`, util.Trim(string(body)))
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService3ProtocolTestListTypesCase2(t *testing.T) {
- svc := NewInputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService3TestShapeInputService3TestCaseOperation2Input{
- ListArg: []*string{},
- }
- req, _ := svc.InputService3TestCaseOperation2Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body, _ := ioutil.ReadAll(r.Body)
- awstesting.AssertQuery(t, `Action=OperationName&ListArg=&Version=2014-01-01`, util.Trim(string(body)))
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService4ProtocolTestFlattenedListCase1(t *testing.T) {
- svc := NewInputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService4TestShapeInputService4TestCaseOperation2Input{
- ListArg: []*string{
- aws.String("a"),
- aws.String("b"),
- aws.String("c"),
- },
- ScalarArg: aws.String("foo"),
- }
- req, _ := svc.InputService4TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body, _ := ioutil.ReadAll(r.Body)
- awstesting.AssertQuery(t, `Action=OperationName&ListArg.1=a&ListArg.2=b&ListArg.3=c&ScalarArg=foo&Version=2014-01-01`, util.Trim(string(body)))
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService4ProtocolTestFlattenedListCase2(t *testing.T) {
- svc := NewInputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService4TestShapeInputService4TestCaseOperation2Input{
- NamedListArg: []*string{
- aws.String("a"),
- },
- }
- req, _ := svc.InputService4TestCaseOperation2Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body, _ := ioutil.ReadAll(r.Body)
- awstesting.AssertQuery(t, `Action=OperationName&Foo.1=a&Version=2014-01-01`, util.Trim(string(body)))
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService5ProtocolTestSerializeFlattenedMapTypeCase1(t *testing.T) {
- svc := NewInputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService5TestShapeInputService5TestCaseOperation1Input{
- MapArg: map[string]*string{
- "key1": aws.String("val1"),
- "key2": aws.String("val2"),
- },
- }
- req, _ := svc.InputService5TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body, _ := ioutil.ReadAll(r.Body)
- awstesting.AssertQuery(t, `Action=OperationName&MapArg.1.key=key1&MapArg.1.value=val1&MapArg.2.key=key2&MapArg.2.value=val2&Version=2014-01-01`, util.Trim(string(body)))
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService6ProtocolTestNonFlattenedListWithLocationNameCase1(t *testing.T) {
- svc := NewInputService6ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService6TestShapeInputService6TestCaseOperation1Input{
- ListArg: []*string{
- aws.String("a"),
- aws.String("b"),
- aws.String("c"),
- },
- }
- req, _ := svc.InputService6TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body, _ := ioutil.ReadAll(r.Body)
- awstesting.AssertQuery(t, `Action=OperationName&ListArg.item.1=a&ListArg.item.2=b&ListArg.item.3=c&Version=2014-01-01`, util.Trim(string(body)))
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService7ProtocolTestFlattenedListWithLocationNameCase1(t *testing.T) {
- svc := NewInputService7ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService7TestShapeInputService7TestCaseOperation1Input{
- ListArg: []*string{
- aws.String("a"),
- aws.String("b"),
- aws.String("c"),
- },
- ScalarArg: aws.String("foo"),
- }
- req, _ := svc.InputService7TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body, _ := ioutil.ReadAll(r.Body)
- awstesting.AssertQuery(t, `Action=OperationName&ListArgLocation.1=a&ListArgLocation.2=b&ListArgLocation.3=c&ScalarArg=foo&Version=2014-01-01`, util.Trim(string(body)))
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService8ProtocolTestSerializeMapTypeCase1(t *testing.T) {
- svc := NewInputService8ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService8TestShapeInputService8TestCaseOperation1Input{
- MapArg: map[string]*string{
- "key1": aws.String("val1"),
- "key2": aws.String("val2"),
- },
- }
- req, _ := svc.InputService8TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body, _ := ioutil.ReadAll(r.Body)
- awstesting.AssertQuery(t, `Action=OperationName&MapArg.entry.1.key=key1&MapArg.entry.1.value=val1&MapArg.entry.2.key=key2&MapArg.entry.2.value=val2&Version=2014-01-01`, util.Trim(string(body)))
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService9ProtocolTestSerializeMapTypeWithLocationNameCase1(t *testing.T) {
- svc := NewInputService9ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService9TestShapeInputService9TestCaseOperation1Input{
- MapArg: map[string]*string{
- "key1": aws.String("val1"),
- "key2": aws.String("val2"),
- },
- }
- req, _ := svc.InputService9TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body, _ := ioutil.ReadAll(r.Body)
- awstesting.AssertQuery(t, `Action=OperationName&MapArg.entry.1.TheKey=key1&MapArg.entry.1.TheValue=val1&MapArg.entry.2.TheKey=key2&MapArg.entry.2.TheValue=val2&Version=2014-01-01`, util.Trim(string(body)))
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService10ProtocolTestBase64EncodedBlobsCase1(t *testing.T) {
- svc := NewInputService10ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService10TestShapeInputService10TestCaseOperation1Input{
- BlobArg: []byte("foo"),
- }
- req, _ := svc.InputService10TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body, _ := ioutil.ReadAll(r.Body)
- awstesting.AssertQuery(t, `Action=OperationName&BlobArg=Zm9v&Version=2014-01-01`, util.Trim(string(body)))
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService11ProtocolTestBase64EncodedBlobsNestedCase1(t *testing.T) {
- svc := NewInputService11ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService11TestShapeInputService11TestCaseOperation1Input{
- BlobArgs: [][]byte{
- []byte("foo"),
- },
- }
- req, _ := svc.InputService11TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body, _ := ioutil.ReadAll(r.Body)
- awstesting.AssertQuery(t, `Action=OperationName&BlobArgs.1=Zm9v&Version=2014-01-01`, util.Trim(string(body)))
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService12ProtocolTestTimestampValuesCase1(t *testing.T) {
- svc := NewInputService12ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService12TestShapeInputService12TestCaseOperation1Input{
- TimeArg: aws.Time(time.Unix(1422172800, 0)),
- }
- req, _ := svc.InputService12TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body, _ := ioutil.ReadAll(r.Body)
- awstesting.AssertQuery(t, `Action=OperationName&TimeArg=2015-01-25T08%3A00%3A00Z&Version=2014-01-01`, util.Trim(string(body)))
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService13ProtocolTestRecursiveShapesCase1(t *testing.T) {
- svc := NewInputService13ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService13TestShapeInputService13TestCaseOperation6Input{
- RecursiveStruct: &InputService13TestShapeRecursiveStructType{
- NoRecurse: aws.String("foo"),
- },
- }
- req, _ := svc.InputService13TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body, _ := ioutil.ReadAll(r.Body)
- awstesting.AssertQuery(t, `Action=OperationName&RecursiveStruct.NoRecurse=foo&Version=2014-01-01`, util.Trim(string(body)))
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService13ProtocolTestRecursiveShapesCase2(t *testing.T) {
- svc := NewInputService13ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService13TestShapeInputService13TestCaseOperation6Input{
- RecursiveStruct: &InputService13TestShapeRecursiveStructType{
- RecursiveStruct: &InputService13TestShapeRecursiveStructType{
- NoRecurse: aws.String("foo"),
- },
- },
- }
- req, _ := svc.InputService13TestCaseOperation2Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body, _ := ioutil.ReadAll(r.Body)
- awstesting.AssertQuery(t, `Action=OperationName&RecursiveStruct.RecursiveStruct.NoRecurse=foo&Version=2014-01-01`, util.Trim(string(body)))
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService13ProtocolTestRecursiveShapesCase3(t *testing.T) {
- svc := NewInputService13ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService13TestShapeInputService13TestCaseOperation6Input{
- RecursiveStruct: &InputService13TestShapeRecursiveStructType{
- RecursiveStruct: &InputService13TestShapeRecursiveStructType{
- RecursiveStruct: &InputService13TestShapeRecursiveStructType{
- RecursiveStruct: &InputService13TestShapeRecursiveStructType{
- NoRecurse: aws.String("foo"),
- },
- },
- },
- },
- }
- req, _ := svc.InputService13TestCaseOperation3Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body, _ := ioutil.ReadAll(r.Body)
- awstesting.AssertQuery(t, `Action=OperationName&RecursiveStruct.RecursiveStruct.RecursiveStruct.RecursiveStruct.NoRecurse=foo&Version=2014-01-01`, util.Trim(string(body)))
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService13ProtocolTestRecursiveShapesCase4(t *testing.T) {
- svc := NewInputService13ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService13TestShapeInputService13TestCaseOperation6Input{
- RecursiveStruct: &InputService13TestShapeRecursiveStructType{
- RecursiveList: []*InputService13TestShapeRecursiveStructType{
- {
- NoRecurse: aws.String("foo"),
- },
- {
- NoRecurse: aws.String("bar"),
- },
- },
- },
- }
- req, _ := svc.InputService13TestCaseOperation4Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body, _ := ioutil.ReadAll(r.Body)
- awstesting.AssertQuery(t, `Action=OperationName&RecursiveStruct.RecursiveList.member.1.NoRecurse=foo&RecursiveStruct.RecursiveList.member.2.NoRecurse=bar&Version=2014-01-01`, util.Trim(string(body)))
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService13ProtocolTestRecursiveShapesCase5(t *testing.T) {
- svc := NewInputService13ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService13TestShapeInputService13TestCaseOperation6Input{
- RecursiveStruct: &InputService13TestShapeRecursiveStructType{
- RecursiveList: []*InputService13TestShapeRecursiveStructType{
- {
- NoRecurse: aws.String("foo"),
- },
- {
- RecursiveStruct: &InputService13TestShapeRecursiveStructType{
- NoRecurse: aws.String("bar"),
- },
- },
- },
- },
- }
- req, _ := svc.InputService13TestCaseOperation5Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body, _ := ioutil.ReadAll(r.Body)
- awstesting.AssertQuery(t, `Action=OperationName&RecursiveStruct.RecursiveList.member.1.NoRecurse=foo&RecursiveStruct.RecursiveList.member.2.RecursiveStruct.NoRecurse=bar&Version=2014-01-01`, util.Trim(string(body)))
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService13ProtocolTestRecursiveShapesCase6(t *testing.T) {
- svc := NewInputService13ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService13TestShapeInputService13TestCaseOperation6Input{
- RecursiveStruct: &InputService13TestShapeRecursiveStructType{
- RecursiveMap: map[string]*InputService13TestShapeRecursiveStructType{
- "bar": {
- NoRecurse: aws.String("bar"),
- },
- "foo": {
- NoRecurse: aws.String("foo"),
- },
- },
- },
- }
- req, _ := svc.InputService13TestCaseOperation6Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body, _ := ioutil.ReadAll(r.Body)
- awstesting.AssertQuery(t, `Action=OperationName&RecursiveStruct.RecursiveMap.entry.1.key=foo&RecursiveStruct.RecursiveMap.entry.1.value.NoRecurse=foo&RecursiveStruct.RecursiveMap.entry.2.key=bar&RecursiveStruct.RecursiveMap.entry.2.value.NoRecurse=bar&Version=2014-01-01`, util.Trim(string(body)))
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService14ProtocolTestIdempotencyTokenAutoFillCase1(t *testing.T) {
- svc := NewInputService14ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService14TestShapeInputService14TestCaseOperation2Input{
- Token: aws.String("abc123"),
- }
- req, _ := svc.InputService14TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body, _ := ioutil.ReadAll(r.Body)
- awstesting.AssertQuery(t, `Action=OperationName&Token=abc123&Version=2014-01-01`, util.Trim(string(body)))
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService14ProtocolTestIdempotencyTokenAutoFillCase2(t *testing.T) {
- svc := NewInputService14ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService14TestShapeInputService14TestCaseOperation2Input{}
- req, _ := svc.InputService14TestCaseOperation2Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body, _ := ioutil.ReadAll(r.Body)
- awstesting.AssertQuery(t, `Action=OperationName&Token=00000000-0000-4000-8000-000000000000&Version=2014-01-01`, util.Trim(string(body)))
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService15ProtocolTestEnumCase1(t *testing.T) {
- svc := NewInputService15ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService15TestShapeInputService15TestCaseOperation3Input{
- FooEnum: aws.String("foo"),
- ListEnums: []*string{
- aws.String("foo"),
- aws.String(""),
- aws.String("bar"),
- },
- }
- req, _ := svc.InputService15TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body, _ := ioutil.ReadAll(r.Body)
- awstesting.AssertQuery(t, `Action=OperationName&FooEnum=foo&ListEnums.member.1=foo&ListEnums.member.2=&ListEnums.member.3=bar&Version=2014-01-01`, util.Trim(string(body)))
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService15ProtocolTestEnumCase2(t *testing.T) {
- svc := NewInputService15ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService15TestShapeInputService15TestCaseOperation3Input{
- FooEnum: aws.String("foo"),
- }
- req, _ := svc.InputService15TestCaseOperation2Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body, _ := ioutil.ReadAll(r.Body)
- awstesting.AssertQuery(t, `Action=OperationName&FooEnum=foo&Version=2014-01-01`, util.Trim(string(body)))
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService15ProtocolTestEnumCase3(t *testing.T) {
- svc := NewInputService15ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService15TestShapeInputService15TestCaseOperation3Input{}
- req, _ := svc.InputService15TestCaseOperation3Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body, _ := ioutil.ReadAll(r.Body)
- awstesting.AssertQuery(t, `Action=OperationName&Version=2014-01-01`, util.Trim(string(body)))
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_test.go
deleted file mode 100644
index a1872cc74..000000000
--- a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_test.go
+++ /dev/null
@@ -1,3007 +0,0 @@
-package query_test
-
-import (
- "bytes"
- "encoding/json"
- "encoding/xml"
- "fmt"
- "io"
- "io/ioutil"
- "net/http"
- "net/url"
- "reflect"
- "testing"
- "time"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/client"
- "github.com/aws/aws-sdk-go/aws/client/metadata"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/aws/signer/v4"
- "github.com/aws/aws-sdk-go/awstesting"
- "github.com/aws/aws-sdk-go/awstesting/unit"
- "github.com/aws/aws-sdk-go/private/protocol"
- "github.com/aws/aws-sdk-go/private/protocol/query"
- "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil"
- "github.com/aws/aws-sdk-go/private/util"
-)
-
-var _ bytes.Buffer // always import bytes
-var _ http.Request
-var _ json.Marshaler
-var _ time.Time
-var _ xmlutil.XMLNode
-var _ xml.Attr
-var _ = ioutil.Discard
-var _ = util.Trim("")
-var _ = url.Values{}
-var _ = io.EOF
-var _ = aws.String
-var _ = fmt.Println
-var _ = reflect.Value{}
-
-func init() {
- protocol.RandReader = &awstesting.ZeroReader{}
-}
-
-// OutputService1ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService1ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService1ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService1ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService1ProtocolTest client from just a session.
-// svc := outputservice1protocoltest.New(mySession)
-//
-// // Create a OutputService1ProtocolTest client with additional configuration
-// svc := outputservice1protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService1ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService1ProtocolTest {
- c := p.ClientConfig("outputservice1protocoltest", cfgs...)
- return newOutputService1ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService1ProtocolTest {
- svc := &OutputService1ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService1ProtocolTest",
- ServiceID: "OutputService1ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService1ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService1TestCaseOperation1 = "OperationName"
-
-// OutputService1TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService1TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService1TestCaseOperation1 for more information on using the OutputService1TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService1TestCaseOperation1Request method.
-// req, resp := client.OutputService1TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1Request(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (req *request.Request, output *OutputService1TestShapeOutputService1TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService1TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService1TestShapeOutputService1TestCaseOperation1Input{}
- }
-
- output = &OutputService1TestShapeOutputService1TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService1TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService1TestCaseOperation1 for usage and error information.
-func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (*OutputService1TestShapeOutputService1TestCaseOperation1Output, error) {
- req, out := c.OutputService1TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService1TestCaseOperation1WithContext is the same as OutputService1TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService1TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1WithContext(ctx aws.Context, input *OutputService1TestShapeOutputService1TestCaseOperation1Input, opts ...request.Option) (*OutputService1TestShapeOutputService1TestCaseOperation1Output, error) {
- req, out := c.OutputService1TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService1TestShapeOutputService1TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService1TestShapeOutputService1TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-
- Char *string `type:"character"`
-
- Double *float64 `type:"double"`
-
- FalseBool *bool `type:"boolean"`
-
- Float *float64 `type:"float"`
-
- Long *int64 `type:"long"`
-
- Num *int64 `locationName:"FooNum" type:"integer"`
-
- Str *string `type:"string"`
-
- Timestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"`
-
- TrueBool *bool `type:"boolean"`
-}
-
-// SetChar sets the Char field's value.
-func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetChar(v string) *OutputService1TestShapeOutputService1TestCaseOperation1Output {
- s.Char = &v
- return s
-}
-
-// SetDouble sets the Double field's value.
-func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetDouble(v float64) *OutputService1TestShapeOutputService1TestCaseOperation1Output {
- s.Double = &v
- return s
-}
-
-// SetFalseBool sets the FalseBool field's value.
-func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetFalseBool(v bool) *OutputService1TestShapeOutputService1TestCaseOperation1Output {
- s.FalseBool = &v
- return s
-}
-
-// SetFloat sets the Float field's value.
-func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetFloat(v float64) *OutputService1TestShapeOutputService1TestCaseOperation1Output {
- s.Float = &v
- return s
-}
-
-// SetLong sets the Long field's value.
-func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetLong(v int64) *OutputService1TestShapeOutputService1TestCaseOperation1Output {
- s.Long = &v
- return s
-}
-
-// SetNum sets the Num field's value.
-func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetNum(v int64) *OutputService1TestShapeOutputService1TestCaseOperation1Output {
- s.Num = &v
- return s
-}
-
-// SetStr sets the Str field's value.
-func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetStr(v string) *OutputService1TestShapeOutputService1TestCaseOperation1Output {
- s.Str = &v
- return s
-}
-
-// SetTimestamp sets the Timestamp field's value.
-func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetTimestamp(v time.Time) *OutputService1TestShapeOutputService1TestCaseOperation1Output {
- s.Timestamp = &v
- return s
-}
-
-// SetTrueBool sets the TrueBool field's value.
-func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetTrueBool(v bool) *OutputService1TestShapeOutputService1TestCaseOperation1Output {
- s.TrueBool = &v
- return s
-}
-
-// OutputService2ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService2ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService2ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService2ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService2ProtocolTest client from just a session.
-// svc := outputservice2protocoltest.New(mySession)
-//
-// // Create a OutputService2ProtocolTest client with additional configuration
-// svc := outputservice2protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService2ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService2ProtocolTest {
- c := p.ClientConfig("outputservice2protocoltest", cfgs...)
- return newOutputService2ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService2ProtocolTest {
- svc := &OutputService2ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService2ProtocolTest",
- ServiceID: "OutputService2ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService2ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService2TestCaseOperation1 = "OperationName"
-
-// OutputService2TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService2TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService2TestCaseOperation1 for more information on using the OutputService2TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService2TestCaseOperation1Request method.
-// req, resp := client.OutputService2TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1Request(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (req *request.Request, output *OutputService2TestShapeOutputService2TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService2TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService2TestShapeOutputService2TestCaseOperation1Input{}
- }
-
- output = &OutputService2TestShapeOutputService2TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService2TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService2TestCaseOperation1 for usage and error information.
-func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (*OutputService2TestShapeOutputService2TestCaseOperation1Output, error) {
- req, out := c.OutputService2TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService2TestCaseOperation1WithContext is the same as OutputService2TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService2TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1WithContext(ctx aws.Context, input *OutputService2TestShapeOutputService2TestCaseOperation1Input, opts ...request.Option) (*OutputService2TestShapeOutputService2TestCaseOperation1Output, error) {
- req, out := c.OutputService2TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService2TestShapeOutputService2TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService2TestShapeOutputService2TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-
- Num *int64 `type:"integer"`
-
- Str *string `type:"string"`
-}
-
-// SetNum sets the Num field's value.
-func (s *OutputService2TestShapeOutputService2TestCaseOperation1Output) SetNum(v int64) *OutputService2TestShapeOutputService2TestCaseOperation1Output {
- s.Num = &v
- return s
-}
-
-// SetStr sets the Str field's value.
-func (s *OutputService2TestShapeOutputService2TestCaseOperation1Output) SetStr(v string) *OutputService2TestShapeOutputService2TestCaseOperation1Output {
- s.Str = &v
- return s
-}
-
-// OutputService3ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService3ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService3ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService3ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService3ProtocolTest client from just a session.
-// svc := outputservice3protocoltest.New(mySession)
-//
-// // Create a OutputService3ProtocolTest client with additional configuration
-// svc := outputservice3protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService3ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService3ProtocolTest {
- c := p.ClientConfig("outputservice3protocoltest", cfgs...)
- return newOutputService3ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService3ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService3ProtocolTest {
- svc := &OutputService3ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService3ProtocolTest",
- ServiceID: "OutputService3ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService3ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService3TestCaseOperation1 = "OperationName"
-
-// OutputService3TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService3TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService3TestCaseOperation1 for more information on using the OutputService3TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService3TestCaseOperation1Request method.
-// req, resp := client.OutputService3TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1Request(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (req *request.Request, output *OutputService3TestShapeOutputService3TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService3TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService3TestShapeOutputService3TestCaseOperation1Input{}
- }
-
- output = &OutputService3TestShapeOutputService3TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService3TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService3TestCaseOperation1 for usage and error information.
-func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (*OutputService3TestShapeOutputService3TestCaseOperation1Output, error) {
- req, out := c.OutputService3TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService3TestCaseOperation1WithContext is the same as OutputService3TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService3TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1WithContext(ctx aws.Context, input *OutputService3TestShapeOutputService3TestCaseOperation1Input, opts ...request.Option) (*OutputService3TestShapeOutputService3TestCaseOperation1Output, error) {
- req, out := c.OutputService3TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService3TestShapeOutputService3TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService3TestShapeOutputService3TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-
- // Blob is automatically base64 encoded/decoded by the SDK.
- Blob []byte `type:"blob"`
-}
-
-// SetBlob sets the Blob field's value.
-func (s *OutputService3TestShapeOutputService3TestCaseOperation1Output) SetBlob(v []byte) *OutputService3TestShapeOutputService3TestCaseOperation1Output {
- s.Blob = v
- return s
-}
-
-// OutputService4ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService4ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService4ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService4ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService4ProtocolTest client from just a session.
-// svc := outputservice4protocoltest.New(mySession)
-//
-// // Create a OutputService4ProtocolTest client with additional configuration
-// svc := outputservice4protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService4ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService4ProtocolTest {
- c := p.ClientConfig("outputservice4protocoltest", cfgs...)
- return newOutputService4ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService4ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService4ProtocolTest {
- svc := &OutputService4ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService4ProtocolTest",
- ServiceID: "OutputService4ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService4ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService4TestCaseOperation1 = "OperationName"
-
-// OutputService4TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService4TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService4TestCaseOperation1 for more information on using the OutputService4TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService4TestCaseOperation1Request method.
-// req, resp := client.OutputService4TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1Request(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (req *request.Request, output *OutputService4TestShapeOutputService4TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService4TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService4TestShapeOutputService4TestCaseOperation1Input{}
- }
-
- output = &OutputService4TestShapeOutputService4TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService4TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService4TestCaseOperation1 for usage and error information.
-func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (*OutputService4TestShapeOutputService4TestCaseOperation1Output, error) {
- req, out := c.OutputService4TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService4TestCaseOperation1WithContext is the same as OutputService4TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService4TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1WithContext(ctx aws.Context, input *OutputService4TestShapeOutputService4TestCaseOperation1Input, opts ...request.Option) (*OutputService4TestShapeOutputService4TestCaseOperation1Output, error) {
- req, out := c.OutputService4TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService4TestShapeOutputService4TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService4TestShapeOutputService4TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-
- ListMember []*string `type:"list"`
-}
-
-// SetListMember sets the ListMember field's value.
-func (s *OutputService4TestShapeOutputService4TestCaseOperation1Output) SetListMember(v []*string) *OutputService4TestShapeOutputService4TestCaseOperation1Output {
- s.ListMember = v
- return s
-}
-
-// OutputService5ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService5ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService5ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService5ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService5ProtocolTest client from just a session.
-// svc := outputservice5protocoltest.New(mySession)
-//
-// // Create a OutputService5ProtocolTest client with additional configuration
-// svc := outputservice5protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService5ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService5ProtocolTest {
- c := p.ClientConfig("outputservice5protocoltest", cfgs...)
- return newOutputService5ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService5ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService5ProtocolTest {
- svc := &OutputService5ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService5ProtocolTest",
- ServiceID: "OutputService5ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService5ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService5TestCaseOperation1 = "OperationName"
-
-// OutputService5TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService5TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService5TestCaseOperation1 for more information on using the OutputService5TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService5TestCaseOperation1Request method.
-// req, resp := client.OutputService5TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1Request(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (req *request.Request, output *OutputService5TestShapeOutputService5TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService5TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService5TestShapeOutputService5TestCaseOperation1Input{}
- }
-
- output = &OutputService5TestShapeOutputService5TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService5TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService5TestCaseOperation1 for usage and error information.
-func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (*OutputService5TestShapeOutputService5TestCaseOperation1Output, error) {
- req, out := c.OutputService5TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService5TestCaseOperation1WithContext is the same as OutputService5TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService5TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1WithContext(ctx aws.Context, input *OutputService5TestShapeOutputService5TestCaseOperation1Input, opts ...request.Option) (*OutputService5TestShapeOutputService5TestCaseOperation1Output, error) {
- req, out := c.OutputService5TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService5TestShapeOutputService5TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService5TestShapeOutputService5TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-
- ListMember []*string `locationNameList:"item" type:"list"`
-}
-
-// SetListMember sets the ListMember field's value.
-func (s *OutputService5TestShapeOutputService5TestCaseOperation1Output) SetListMember(v []*string) *OutputService5TestShapeOutputService5TestCaseOperation1Output {
- s.ListMember = v
- return s
-}
-
-// OutputService6ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService6ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService6ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService6ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService6ProtocolTest client from just a session.
-// svc := outputservice6protocoltest.New(mySession)
-//
-// // Create a OutputService6ProtocolTest client with additional configuration
-// svc := outputservice6protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService6ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService6ProtocolTest {
- c := p.ClientConfig("outputservice6protocoltest", cfgs...)
- return newOutputService6ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService6ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService6ProtocolTest {
- svc := &OutputService6ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService6ProtocolTest",
- ServiceID: "OutputService6ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService6ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService6TestCaseOperation1 = "OperationName"
-
-// OutputService6TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService6TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService6TestCaseOperation1 for more information on using the OutputService6TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService6TestCaseOperation1Request method.
-// req, resp := client.OutputService6TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1Request(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (req *request.Request, output *OutputService6TestShapeOutputService6TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService6TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService6TestShapeOutputService6TestCaseOperation1Input{}
- }
-
- output = &OutputService6TestShapeOutputService6TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService6TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService6TestCaseOperation1 for usage and error information.
-func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (*OutputService6TestShapeOutputService6TestCaseOperation1Output, error) {
- req, out := c.OutputService6TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService6TestCaseOperation1WithContext is the same as OutputService6TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService6TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1WithContext(ctx aws.Context, input *OutputService6TestShapeOutputService6TestCaseOperation1Input, opts ...request.Option) (*OutputService6TestShapeOutputService6TestCaseOperation1Output, error) {
- req, out := c.OutputService6TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService6TestShapeOutputService6TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService6TestShapeOutputService6TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-
- ListMember []*string `type:"list" flattened:"true"`
-}
-
-// SetListMember sets the ListMember field's value.
-func (s *OutputService6TestShapeOutputService6TestCaseOperation1Output) SetListMember(v []*string) *OutputService6TestShapeOutputService6TestCaseOperation1Output {
- s.ListMember = v
- return s
-}
-
-// OutputService7ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService7ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService7ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService7ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService7ProtocolTest client from just a session.
-// svc := outputservice7protocoltest.New(mySession)
-//
-// // Create a OutputService7ProtocolTest client with additional configuration
-// svc := outputservice7protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService7ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService7ProtocolTest {
- c := p.ClientConfig("outputservice7protocoltest", cfgs...)
- return newOutputService7ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService7ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService7ProtocolTest {
- svc := &OutputService7ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService7ProtocolTest",
- ServiceID: "OutputService7ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService7ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService7TestCaseOperation1 = "OperationName"
-
-// OutputService7TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService7TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService7TestCaseOperation1 for more information on using the OutputService7TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService7TestCaseOperation1Request method.
-// req, resp := client.OutputService7TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1Request(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (req *request.Request, output *OutputService7TestShapeOutputService7TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService7TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService7TestShapeOutputService7TestCaseOperation1Input{}
- }
-
- output = &OutputService7TestShapeOutputService7TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService7TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService7TestCaseOperation1 for usage and error information.
-func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (*OutputService7TestShapeOutputService7TestCaseOperation1Output, error) {
- req, out := c.OutputService7TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService7TestCaseOperation1WithContext is the same as OutputService7TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService7TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1WithContext(ctx aws.Context, input *OutputService7TestShapeOutputService7TestCaseOperation1Input, opts ...request.Option) (*OutputService7TestShapeOutputService7TestCaseOperation1Output, error) {
- req, out := c.OutputService7TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService7TestShapeOutputService7TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService7TestShapeOutputService7TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-
- ListMember []*string `type:"list" flattened:"true"`
-}
-
-// SetListMember sets the ListMember field's value.
-func (s *OutputService7TestShapeOutputService7TestCaseOperation1Output) SetListMember(v []*string) *OutputService7TestShapeOutputService7TestCaseOperation1Output {
- s.ListMember = v
- return s
-}
-
-// OutputService8ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService8ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService8ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService8ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService8ProtocolTest client from just a session.
-// svc := outputservice8protocoltest.New(mySession)
-//
-// // Create a OutputService8ProtocolTest client with additional configuration
-// svc := outputservice8protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService8ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService8ProtocolTest {
- c := p.ClientConfig("outputservice8protocoltest", cfgs...)
- return newOutputService8ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService8ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService8ProtocolTest {
- svc := &OutputService8ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService8ProtocolTest",
- ServiceID: "OutputService8ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService8ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService8TestCaseOperation1 = "OperationName"
-
-// OutputService8TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService8TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService8TestCaseOperation1 for more information on using the OutputService8TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService8TestCaseOperation1Request method.
-// req, resp := client.OutputService8TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1Request(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (req *request.Request, output *OutputService8TestShapeOutputService8TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService8TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService8TestShapeOutputService8TestCaseOperation1Input{}
- }
-
- output = &OutputService8TestShapeOutputService8TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService8TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService8TestCaseOperation1 for usage and error information.
-func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (*OutputService8TestShapeOutputService8TestCaseOperation1Output, error) {
- req, out := c.OutputService8TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService8TestCaseOperation1WithContext is the same as OutputService8TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService8TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1WithContext(ctx aws.Context, input *OutputService8TestShapeOutputService8TestCaseOperation1Input, opts ...request.Option) (*OutputService8TestShapeOutputService8TestCaseOperation1Output, error) {
- req, out := c.OutputService8TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService8TestShapeOutputService8TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService8TestShapeOutputService8TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-
- List []*OutputService8TestShapeStructureShape `type:"list"`
-}
-
-// SetList sets the List field's value.
-func (s *OutputService8TestShapeOutputService8TestCaseOperation1Output) SetList(v []*OutputService8TestShapeStructureShape) *OutputService8TestShapeOutputService8TestCaseOperation1Output {
- s.List = v
- return s
-}
-
-type OutputService8TestShapeStructureShape struct {
- _ struct{} `type:"structure"`
-
- Bar *string `type:"string"`
-
- Baz *string `type:"string"`
-
- Foo *string `type:"string"`
-}
-
-// SetBar sets the Bar field's value.
-func (s *OutputService8TestShapeStructureShape) SetBar(v string) *OutputService8TestShapeStructureShape {
- s.Bar = &v
- return s
-}
-
-// SetBaz sets the Baz field's value.
-func (s *OutputService8TestShapeStructureShape) SetBaz(v string) *OutputService8TestShapeStructureShape {
- s.Baz = &v
- return s
-}
-
-// SetFoo sets the Foo field's value.
-func (s *OutputService8TestShapeStructureShape) SetFoo(v string) *OutputService8TestShapeStructureShape {
- s.Foo = &v
- return s
-}
-
-// OutputService9ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService9ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService9ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService9ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService9ProtocolTest client from just a session.
-// svc := outputservice9protocoltest.New(mySession)
-//
-// // Create a OutputService9ProtocolTest client with additional configuration
-// svc := outputservice9protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService9ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService9ProtocolTest {
- c := p.ClientConfig("outputservice9protocoltest", cfgs...)
- return newOutputService9ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService9ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService9ProtocolTest {
- svc := &OutputService9ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService9ProtocolTest",
- ServiceID: "OutputService9ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService9ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService9ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService9TestCaseOperation1 = "OperationName"
-
-// OutputService9TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService9TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService9TestCaseOperation1 for more information on using the OutputService9TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService9TestCaseOperation1Request method.
-// req, resp := client.OutputService9TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1Request(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (req *request.Request, output *OutputService9TestShapeOutputService9TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService9TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService9TestShapeOutputService9TestCaseOperation1Input{}
- }
-
- output = &OutputService9TestShapeOutputService9TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService9TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService9TestCaseOperation1 for usage and error information.
-func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (*OutputService9TestShapeOutputService9TestCaseOperation1Output, error) {
- req, out := c.OutputService9TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService9TestCaseOperation1WithContext is the same as OutputService9TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService9TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1WithContext(ctx aws.Context, input *OutputService9TestShapeOutputService9TestCaseOperation1Input, opts ...request.Option) (*OutputService9TestShapeOutputService9TestCaseOperation1Output, error) {
- req, out := c.OutputService9TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService9TestShapeOutputService9TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService9TestShapeOutputService9TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-
- List []*OutputService9TestShapeStructureShape `type:"list" flattened:"true"`
-}
-
-// SetList sets the List field's value.
-func (s *OutputService9TestShapeOutputService9TestCaseOperation1Output) SetList(v []*OutputService9TestShapeStructureShape) *OutputService9TestShapeOutputService9TestCaseOperation1Output {
- s.List = v
- return s
-}
-
-type OutputService9TestShapeStructureShape struct {
- _ struct{} `type:"structure"`
-
- Bar *string `type:"string"`
-
- Baz *string `type:"string"`
-
- Foo *string `type:"string"`
-}
-
-// SetBar sets the Bar field's value.
-func (s *OutputService9TestShapeStructureShape) SetBar(v string) *OutputService9TestShapeStructureShape {
- s.Bar = &v
- return s
-}
-
-// SetBaz sets the Baz field's value.
-func (s *OutputService9TestShapeStructureShape) SetBaz(v string) *OutputService9TestShapeStructureShape {
- s.Baz = &v
- return s
-}
-
-// SetFoo sets the Foo field's value.
-func (s *OutputService9TestShapeStructureShape) SetFoo(v string) *OutputService9TestShapeStructureShape {
- s.Foo = &v
- return s
-}
-
-// OutputService10ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService10ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService10ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService10ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService10ProtocolTest client from just a session.
-// svc := outputservice10protocoltest.New(mySession)
-//
-// // Create a OutputService10ProtocolTest client with additional configuration
-// svc := outputservice10protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService10ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService10ProtocolTest {
- c := p.ClientConfig("outputservice10protocoltest", cfgs...)
- return newOutputService10ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService10ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService10ProtocolTest {
- svc := &OutputService10ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService10ProtocolTest",
- ServiceID: "OutputService10ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService10ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService10ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService10TestCaseOperation1 = "OperationName"
-
-// OutputService10TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService10TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService10TestCaseOperation1 for more information on using the OutputService10TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService10TestCaseOperation1Request method.
-// req, resp := client.OutputService10TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1Request(input *OutputService10TestShapeOutputService10TestCaseOperation1Input) (req *request.Request, output *OutputService10TestShapeOutputService10TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService10TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService10TestShapeOutputService10TestCaseOperation1Input{}
- }
-
- output = &OutputService10TestShapeOutputService10TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService10TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService10TestCaseOperation1 for usage and error information.
-func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1(input *OutputService10TestShapeOutputService10TestCaseOperation1Input) (*OutputService10TestShapeOutputService10TestCaseOperation1Output, error) {
- req, out := c.OutputService10TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService10TestCaseOperation1WithContext is the same as OutputService10TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService10TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1WithContext(ctx aws.Context, input *OutputService10TestShapeOutputService10TestCaseOperation1Input, opts ...request.Option) (*OutputService10TestShapeOutputService10TestCaseOperation1Output, error) {
- req, out := c.OutputService10TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService10TestShapeOutputService10TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService10TestShapeOutputService10TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-
- List []*string `locationNameList:"NamedList" type:"list" flattened:"true"`
-}
-
-// SetList sets the List field's value.
-func (s *OutputService10TestShapeOutputService10TestCaseOperation1Output) SetList(v []*string) *OutputService10TestShapeOutputService10TestCaseOperation1Output {
- s.List = v
- return s
-}
-
-// OutputService11ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService11ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService11ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService11ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService11ProtocolTest client from just a session.
-// svc := outputservice11protocoltest.New(mySession)
-//
-// // Create a OutputService11ProtocolTest client with additional configuration
-// svc := outputservice11protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService11ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService11ProtocolTest {
- c := p.ClientConfig("outputservice11protocoltest", cfgs...)
- return newOutputService11ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService11ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService11ProtocolTest {
- svc := &OutputService11ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService11ProtocolTest",
- ServiceID: "OutputService11ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService11ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService11ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService11TestCaseOperation1 = "OperationName"
-
-// OutputService11TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService11TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService11TestCaseOperation1 for more information on using the OutputService11TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService11TestCaseOperation1Request method.
-// req, resp := client.OutputService11TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1Request(input *OutputService11TestShapeOutputService11TestCaseOperation1Input) (req *request.Request, output *OutputService11TestShapeOutputService11TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService11TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService11TestShapeOutputService11TestCaseOperation1Input{}
- }
-
- output = &OutputService11TestShapeOutputService11TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService11TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService11TestCaseOperation1 for usage and error information.
-func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1(input *OutputService11TestShapeOutputService11TestCaseOperation1Input) (*OutputService11TestShapeOutputService11TestCaseOperation1Output, error) {
- req, out := c.OutputService11TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService11TestCaseOperation1WithContext is the same as OutputService11TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService11TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1WithContext(ctx aws.Context, input *OutputService11TestShapeOutputService11TestCaseOperation1Input, opts ...request.Option) (*OutputService11TestShapeOutputService11TestCaseOperation1Output, error) {
- req, out := c.OutputService11TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService11TestShapeOutputService11TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService11TestShapeOutputService11TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-
- Map map[string]*OutputService11TestShapeStructType `type:"map"`
-}
-
-// SetMap sets the Map field's value.
-func (s *OutputService11TestShapeOutputService11TestCaseOperation1Output) SetMap(v map[string]*OutputService11TestShapeStructType) *OutputService11TestShapeOutputService11TestCaseOperation1Output {
- s.Map = v
- return s
-}
-
-type OutputService11TestShapeStructType struct {
- _ struct{} `type:"structure"`
-
- Foo *string `locationName:"foo" type:"string"`
-}
-
-// SetFoo sets the Foo field's value.
-func (s *OutputService11TestShapeStructType) SetFoo(v string) *OutputService11TestShapeStructType {
- s.Foo = &v
- return s
-}
-
-// OutputService12ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService12ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService12ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService12ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService12ProtocolTest client from just a session.
-// svc := outputservice12protocoltest.New(mySession)
-//
-// // Create a OutputService12ProtocolTest client with additional configuration
-// svc := outputservice12protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService12ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService12ProtocolTest {
- c := p.ClientConfig("outputservice12protocoltest", cfgs...)
- return newOutputService12ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService12ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService12ProtocolTest {
- svc := &OutputService12ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService12ProtocolTest",
- ServiceID: "OutputService12ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService12ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService12ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService12TestCaseOperation1 = "OperationName"
-
-// OutputService12TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService12TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService12TestCaseOperation1 for more information on using the OutputService12TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService12TestCaseOperation1Request method.
-// req, resp := client.OutputService12TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService12ProtocolTest) OutputService12TestCaseOperation1Request(input *OutputService12TestShapeOutputService12TestCaseOperation1Input) (req *request.Request, output *OutputService12TestShapeOutputService12TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService12TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService12TestShapeOutputService12TestCaseOperation1Input{}
- }
-
- output = &OutputService12TestShapeOutputService12TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService12TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService12TestCaseOperation1 for usage and error information.
-func (c *OutputService12ProtocolTest) OutputService12TestCaseOperation1(input *OutputService12TestShapeOutputService12TestCaseOperation1Input) (*OutputService12TestShapeOutputService12TestCaseOperation1Output, error) {
- req, out := c.OutputService12TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService12TestCaseOperation1WithContext is the same as OutputService12TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService12TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService12ProtocolTest) OutputService12TestCaseOperation1WithContext(ctx aws.Context, input *OutputService12TestShapeOutputService12TestCaseOperation1Input, opts ...request.Option) (*OutputService12TestShapeOutputService12TestCaseOperation1Output, error) {
- req, out := c.OutputService12TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService12TestShapeOutputService12TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService12TestShapeOutputService12TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-
- Map map[string]*string `type:"map" flattened:"true"`
-}
-
-// SetMap sets the Map field's value.
-func (s *OutputService12TestShapeOutputService12TestCaseOperation1Output) SetMap(v map[string]*string) *OutputService12TestShapeOutputService12TestCaseOperation1Output {
- s.Map = v
- return s
-}
-
-// OutputService13ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService13ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService13ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService13ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService13ProtocolTest client from just a session.
-// svc := outputservice13protocoltest.New(mySession)
-//
-// // Create a OutputService13ProtocolTest client with additional configuration
-// svc := outputservice13protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService13ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService13ProtocolTest {
- c := p.ClientConfig("outputservice13protocoltest", cfgs...)
- return newOutputService13ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService13ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService13ProtocolTest {
- svc := &OutputService13ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService13ProtocolTest",
- ServiceID: "OutputService13ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService13ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService13ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService13TestCaseOperation1 = "OperationName"
-
-// OutputService13TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService13TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService13TestCaseOperation1 for more information on using the OutputService13TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService13TestCaseOperation1Request method.
-// req, resp := client.OutputService13TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService13ProtocolTest) OutputService13TestCaseOperation1Request(input *OutputService13TestShapeOutputService13TestCaseOperation1Input) (req *request.Request, output *OutputService13TestShapeOutputService13TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService13TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService13TestShapeOutputService13TestCaseOperation1Input{}
- }
-
- output = &OutputService13TestShapeOutputService13TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService13TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService13TestCaseOperation1 for usage and error information.
-func (c *OutputService13ProtocolTest) OutputService13TestCaseOperation1(input *OutputService13TestShapeOutputService13TestCaseOperation1Input) (*OutputService13TestShapeOutputService13TestCaseOperation1Output, error) {
- req, out := c.OutputService13TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService13TestCaseOperation1WithContext is the same as OutputService13TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService13TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService13ProtocolTest) OutputService13TestCaseOperation1WithContext(ctx aws.Context, input *OutputService13TestShapeOutputService13TestCaseOperation1Input, opts ...request.Option) (*OutputService13TestShapeOutputService13TestCaseOperation1Output, error) {
- req, out := c.OutputService13TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService13TestShapeOutputService13TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService13TestShapeOutputService13TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-
- Map map[string]*string `locationName:"Attribute" locationNameKey:"Name" locationNameValue:"Value" type:"map" flattened:"true"`
-}
-
-// SetMap sets the Map field's value.
-func (s *OutputService13TestShapeOutputService13TestCaseOperation1Output) SetMap(v map[string]*string) *OutputService13TestShapeOutputService13TestCaseOperation1Output {
- s.Map = v
- return s
-}
-
-// OutputService14ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService14ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService14ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService14ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService14ProtocolTest client from just a session.
-// svc := outputservice14protocoltest.New(mySession)
-//
-// // Create a OutputService14ProtocolTest client with additional configuration
-// svc := outputservice14protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService14ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService14ProtocolTest {
- c := p.ClientConfig("outputservice14protocoltest", cfgs...)
- return newOutputService14ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService14ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService14ProtocolTest {
- svc := &OutputService14ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService14ProtocolTest",
- ServiceID: "OutputService14ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService14ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService14ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService14TestCaseOperation1 = "OperationName"
-
-// OutputService14TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService14TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService14TestCaseOperation1 for more information on using the OutputService14TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService14TestCaseOperation1Request method.
-// req, resp := client.OutputService14TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService14ProtocolTest) OutputService14TestCaseOperation1Request(input *OutputService14TestShapeOutputService14TestCaseOperation1Input) (req *request.Request, output *OutputService14TestShapeOutputService14TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService14TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService14TestShapeOutputService14TestCaseOperation1Input{}
- }
-
- output = &OutputService14TestShapeOutputService14TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService14TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService14TestCaseOperation1 for usage and error information.
-func (c *OutputService14ProtocolTest) OutputService14TestCaseOperation1(input *OutputService14TestShapeOutputService14TestCaseOperation1Input) (*OutputService14TestShapeOutputService14TestCaseOperation1Output, error) {
- req, out := c.OutputService14TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService14TestCaseOperation1WithContext is the same as OutputService14TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService14TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService14ProtocolTest) OutputService14TestCaseOperation1WithContext(ctx aws.Context, input *OutputService14TestShapeOutputService14TestCaseOperation1Input, opts ...request.Option) (*OutputService14TestShapeOutputService14TestCaseOperation1Output, error) {
- req, out := c.OutputService14TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService14TestShapeOutputService14TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService14TestShapeOutputService14TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-
- Map map[string]*string `locationNameKey:"foo" locationNameValue:"bar" type:"map" flattened:"true"`
-}
-
-// SetMap sets the Map field's value.
-func (s *OutputService14TestShapeOutputService14TestCaseOperation1Output) SetMap(v map[string]*string) *OutputService14TestShapeOutputService14TestCaseOperation1Output {
- s.Map = v
- return s
-}
-
-// OutputService15ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService15ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService15ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService15ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService15ProtocolTest client from just a session.
-// svc := outputservice15protocoltest.New(mySession)
-//
-// // Create a OutputService15ProtocolTest client with additional configuration
-// svc := outputservice15protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService15ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService15ProtocolTest {
- c := p.ClientConfig("outputservice15protocoltest", cfgs...)
- return newOutputService15ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService15ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService15ProtocolTest {
- svc := &OutputService15ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService15ProtocolTest",
- ServiceID: "OutputService15ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService15ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService15ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService15TestCaseOperation1 = "OperationName"
-
-// OutputService15TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService15TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService15TestCaseOperation1 for more information on using the OutputService15TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService15TestCaseOperation1Request method.
-// req, resp := client.OutputService15TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService15ProtocolTest) OutputService15TestCaseOperation1Request(input *OutputService15TestShapeOutputService15TestCaseOperation1Input) (req *request.Request, output *OutputService15TestShapeOutputService15TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService15TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService15TestShapeOutputService15TestCaseOperation1Input{}
- }
-
- output = &OutputService15TestShapeOutputService15TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService15TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService15TestCaseOperation1 for usage and error information.
-func (c *OutputService15ProtocolTest) OutputService15TestCaseOperation1(input *OutputService15TestShapeOutputService15TestCaseOperation1Input) (*OutputService15TestShapeOutputService15TestCaseOperation1Output, error) {
- req, out := c.OutputService15TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService15TestCaseOperation1WithContext is the same as OutputService15TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService15TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService15ProtocolTest) OutputService15TestCaseOperation1WithContext(ctx aws.Context, input *OutputService15TestShapeOutputService15TestCaseOperation1Input, opts ...request.Option) (*OutputService15TestShapeOutputService15TestCaseOperation1Output, error) {
- req, out := c.OutputService15TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService15TestShapeOutputService15TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService15TestShapeOutputService15TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-
- Foo *string `type:"string"`
-}
-
-// SetFoo sets the Foo field's value.
-func (s *OutputService15TestShapeOutputService15TestCaseOperation1Output) SetFoo(v string) *OutputService15TestShapeOutputService15TestCaseOperation1Output {
- s.Foo = &v
- return s
-}
-
-// OutputService16ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService16ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService16ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService16ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService16ProtocolTest client from just a session.
-// svc := outputservice16protocoltest.New(mySession)
-//
-// // Create a OutputService16ProtocolTest client with additional configuration
-// svc := outputservice16protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService16ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService16ProtocolTest {
- c := p.ClientConfig("outputservice16protocoltest", cfgs...)
- return newOutputService16ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService16ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService16ProtocolTest {
- svc := &OutputService16ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService16ProtocolTest",
- ServiceID: "OutputService16ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(query.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService16ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService16ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService16TestCaseOperation1 = "OperationName"
-
-// OutputService16TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService16TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService16TestCaseOperation1 for more information on using the OutputService16TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService16TestCaseOperation1Request method.
-// req, resp := client.OutputService16TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService16ProtocolTest) OutputService16TestCaseOperation1Request(input *OutputService16TestShapeOutputService16TestCaseOperation1Input) (req *request.Request, output *OutputService16TestShapeOutputService16TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService16TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService16TestShapeOutputService16TestCaseOperation1Input{}
- }
-
- output = &OutputService16TestShapeOutputService16TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService16TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService16TestCaseOperation1 for usage and error information.
-func (c *OutputService16ProtocolTest) OutputService16TestCaseOperation1(input *OutputService16TestShapeOutputService16TestCaseOperation1Input) (*OutputService16TestShapeOutputService16TestCaseOperation1Output, error) {
- req, out := c.OutputService16TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService16TestCaseOperation1WithContext is the same as OutputService16TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService16TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService16ProtocolTest) OutputService16TestCaseOperation1WithContext(ctx aws.Context, input *OutputService16TestShapeOutputService16TestCaseOperation1Input, opts ...request.Option) (*OutputService16TestShapeOutputService16TestCaseOperation1Output, error) {
- req, out := c.OutputService16TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService16TestShapeOutputService16TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService16TestShapeOutputService16TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-
- FooEnum *string `type:"string" enum:"OutputService16TestShapeEC2EnumType"`
-
- ListEnums []*string `type:"list"`
-}
-
-// SetFooEnum sets the FooEnum field's value.
-func (s *OutputService16TestShapeOutputService16TestCaseOperation1Output) SetFooEnum(v string) *OutputService16TestShapeOutputService16TestCaseOperation1Output {
- s.FooEnum = &v
- return s
-}
-
-// SetListEnums sets the ListEnums field's value.
-func (s *OutputService16TestShapeOutputService16TestCaseOperation1Output) SetListEnums(v []*string) *OutputService16TestShapeOutputService16TestCaseOperation1Output {
- s.ListEnums = v
- return s
-}
-
-const (
- // EC2EnumTypeFoo is a OutputService16TestShapeEC2EnumType enum value
- EC2EnumTypeFoo = "foo"
-
- // EC2EnumTypeBar is a OutputService16TestShapeEC2EnumType enum value
- EC2EnumTypeBar = "bar"
-)
-
-//
-// Tests begin here
-//
-
-func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) {
- svc := NewOutputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResponse><OperationNameResult><Str>myname</Str><FooNum>123</FooNum><FalseBool>false</FalseBool><TrueBool>true</TrueBool><Float>1.2</Float><Double>1.3</Double><Long>200</Long><Char>a</Char><Timestamp>2015-01-25T08:00:00Z</Timestamp></OperationNameResult><ResponseMetadata><RequestId>request-id</RequestId></ResponseMetadata></OperationNameResponse>"))
- req, out := svc.OutputService1TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "a", *out.Char; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := 1.3, *out.Double; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := false, *out.FalseBool; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := 1.2, *out.Float; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := int64(200), *out.Long; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := int64(123), *out.Num; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "myname", *out.Str; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := time.Unix(1.4221728e+09, 0).UTC().String(), out.Timestamp.UTC().String(); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := true, *out.TrueBool; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService2ProtocolTestNotAllMembersInResponseCase1(t *testing.T) {
- svc := NewOutputService2ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResponse><OperationNameResult><Str>myname</Str></OperationNameResult><ResponseMetadata><RequestId>request-id</RequestId></ResponseMetadata></OperationNameResponse>"))
- req, out := svc.OutputService2TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "myname", *out.Str; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService3ProtocolTestBlobCase1(t *testing.T) {
- svc := NewOutputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResponse><OperationNameResult><Blob>dmFsdWU=</Blob></OperationNameResult><ResponseMetadata><RequestId>requestid</RequestId></ResponseMetadata></OperationNameResponse>"))
- req, out := svc.OutputService3TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "value", string(out.Blob); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService4ProtocolTestListsCase1(t *testing.T) {
- svc := NewOutputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResponse><OperationNameResult><ListMember><member>abc</member><member>123</member></ListMember></OperationNameResult><ResponseMetadata><RequestId>requestid</RequestId></ResponseMetadata></OperationNameResponse>"))
- req, out := svc.OutputService4TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "abc", *out.ListMember[0]; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "123", *out.ListMember[1]; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService5ProtocolTestListWithCustomMemberNameCase1(t *testing.T) {
- svc := NewOutputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResponse><OperationNameResult><ListMember><item>abc</item><item>123</item></ListMember></OperationNameResult><ResponseMetadata><RequestId>requestid</RequestId></ResponseMetadata></OperationNameResponse>"))
- req, out := svc.OutputService5TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "abc", *out.ListMember[0]; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "123", *out.ListMember[1]; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService6ProtocolTestFlattenedListCase1(t *testing.T) {
- svc := NewOutputService6ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResponse><OperationNameResult><ListMember>abc</ListMember><ListMember>123</ListMember></OperationNameResult><ResponseMetadata><RequestId>requestid</RequestId></ResponseMetadata></OperationNameResponse>"))
- req, out := svc.OutputService6TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "abc", *out.ListMember[0]; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "123", *out.ListMember[1]; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService7ProtocolTestFlattenedSingleElementListCase1(t *testing.T) {
- svc := NewOutputService7ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResponse><OperationNameResult><ListMember>abc</ListMember></OperationNameResult><ResponseMetadata><RequestId>requestid</RequestId></ResponseMetadata></OperationNameResponse>"))
- req, out := svc.OutputService7TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "abc", *out.ListMember[0]; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService8ProtocolTestListOfStructuresCase1(t *testing.T) {
- svc := NewOutputService8ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResponse xmlns=\"https://service.amazonaws.com/doc/2010-05-08/\"><OperationNameResult><List><member><Foo>firstfoo</Foo><Bar>firstbar</Bar><Baz>firstbaz</Baz></member><member><Foo>secondfoo</Foo><Bar>secondbar</Bar><Baz>secondbaz</Baz></member></List></OperationNameResult><ResponseMetadata><RequestId>requestid</RequestId></ResponseMetadata></OperationNameResponse>"))
- req, out := svc.OutputService8TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "firstbar", *out.List[0].Bar; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "firstbaz", *out.List[0].Baz; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "firstfoo", *out.List[0].Foo; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "secondbar", *out.List[1].Bar; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "secondbaz", *out.List[1].Baz; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "secondfoo", *out.List[1].Foo; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService9ProtocolTestFlattenedListOfStructuresCase1(t *testing.T) {
- svc := NewOutputService9ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResponse xmlns=\"https://service.amazonaws.com/doc/2010-05-08/\"><OperationNameResult><List><Foo>firstfoo</Foo><Bar>firstbar</Bar><Baz>firstbaz</Baz></List><List><Foo>secondfoo</Foo><Bar>secondbar</Bar><Baz>secondbaz</Baz></List></OperationNameResult><ResponseMetadata><RequestId>requestid</RequestId></ResponseMetadata></OperationNameResponse>"))
- req, out := svc.OutputService9TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "firstbar", *out.List[0].Bar; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "firstbaz", *out.List[0].Baz; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "firstfoo", *out.List[0].Foo; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "secondbar", *out.List[1].Bar; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "secondbaz", *out.List[1].Baz; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "secondfoo", *out.List[1].Foo; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService10ProtocolTestFlattenedListWithLocationNameCase1(t *testing.T) {
- svc := NewOutputService10ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResponse xmlns=\"https://service.amazonaws.com/doc/2010-05-08/\"><OperationNameResult><NamedList>a</NamedList><NamedList>b</NamedList></OperationNameResult><ResponseMetadata><RequestId>requestid</RequestId></ResponseMetadata></OperationNameResponse>"))
- req, out := svc.OutputService10TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "a", *out.List[0]; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "b", *out.List[1]; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService11ProtocolTestNormalMapCase1(t *testing.T) {
- svc := NewOutputService11ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResponse xmlns=\"https://service.amazonaws.com/doc/2010-05-08\"><OperationNameResult><Map><entry><key>qux</key><value><foo>bar</foo></value></entry><entry><key>baz</key><value><foo>bam</foo></value></entry></Map></OperationNameResult><ResponseMetadata><RequestId>requestid</RequestId></ResponseMetadata></OperationNameResponse>"))
- req, out := svc.OutputService11TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "bam", *out.Map["baz"].Foo; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "bar", *out.Map["qux"].Foo; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService12ProtocolTestFlattenedMapCase1(t *testing.T) {
- svc := NewOutputService12ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResponse><OperationNameResult><Map><key>qux</key><value>bar</value></Map><Map><key>baz</key><value>bam</value></Map></OperationNameResult><ResponseMetadata><RequestId>requestid</RequestId></ResponseMetadata></OperationNameResponse>"))
- req, out := svc.OutputService12TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "bam", *out.Map["baz"]; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "bar", *out.Map["qux"]; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService13ProtocolTestFlattenedMapInShapeDefinitionCase1(t *testing.T) {
- svc := NewOutputService13ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResponse><OperationNameResult><Attribute><Name>qux</Name><Value>bar</Value></Attribute></OperationNameResult><ResponseMetadata><RequestId>requestid</RequestId></ResponseMetadata></OperationNameResponse>"))
- req, out := svc.OutputService13TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "bar", *out.Map["qux"]; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService14ProtocolTestNamedMapCase1(t *testing.T) {
- svc := NewOutputService14ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResponse><OperationNameResult><Map><foo>qux</foo><bar>bar</bar></Map><Map><foo>baz</foo><bar>bam</bar></Map></OperationNameResult><ResponseMetadata><RequestId>requestid</RequestId></ResponseMetadata></OperationNameResponse>"))
- req, out := svc.OutputService14TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "bam", *out.Map["baz"]; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "bar", *out.Map["qux"]; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService15ProtocolTestEmptyStringCase1(t *testing.T) {
- svc := NewOutputService15ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResponse><OperationNameResult><Foo/></OperationNameResult><ResponseMetadata><RequestId>requestid</RequestId></ResponseMetadata></OperationNameResponse>"))
- req, out := svc.OutputService15TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "", *out.Foo; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService16ProtocolTestEnumOutputCase1(t *testing.T) {
- svc := NewOutputService16ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResponse><FooEnum>foo</FooEnum><ListEnums><member>foo</member><member>bar</member></ListEnums></OperationNameResponse>"))
- req, out := svc.OutputService16TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "foo", *out.FooEnum; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "foo", *out.ListEnums[0]; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "bar", *out.ListEnums[1]; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build_test.go
deleted file mode 100644
index 9f18081a9..000000000
--- a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build_test.go
+++ /dev/null
@@ -1,63 +0,0 @@
-package rest
-
-import (
- "net/http"
- "net/url"
- "testing"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/request"
-)
-
-func TestCleanPath(t *testing.T) {
- uri := &url.URL{
- Path: "//foo//bar",
- Scheme: "https",
- Host: "host",
- }
- cleanPath(uri)
-
- expected := "https://host/foo/bar"
- if a, e := uri.String(), expected; a != e {
- t.Errorf("expect %q URI, got %q", e, a)
- }
-}
-
-func TestMarshalPath(t *testing.T) {
- in := struct {
- Bucket *string `location:"uri" locationName:"bucket"`
- Key *string `location:"uri" locationName:"key"`
- }{
- Bucket: aws.String("mybucket"),
- Key: aws.String("my/cool+thing space/object世界"),
- }
-
- expectURL := `/mybucket/my/cool+thing space/object世界`
- expectEscapedURL := `/mybucket/my/cool%2Bthing%20space/object%E4%B8%96%E7%95%8C`
-
- req := &request.Request{
- HTTPRequest: &http.Request{
- URL: &url.URL{Scheme: "https", Host: "exmaple.com", Path: "/{bucket}/{key+}"},
- },
- Params: &in,
- }
-
- Build(req)
-
- if req.Error != nil {
- t.Fatalf("unexpected error, %v", req.Error)
- }
-
- if a, e := req.HTTPRequest.URL.Path, expectURL; a != e {
- t.Errorf("expect %q URI, got %q", e, a)
- }
-
- if a, e := req.HTTPRequest.URL.RawPath, expectEscapedURL; a != e {
- t.Errorf("expect %q escaped URI, got %q", e, a)
- }
-
- if a, e := req.HTTPRequest.URL.EscapedPath(), expectEscapedURL; a != e {
- t.Errorf("expect %q escaped URI, got %q", e, a)
- }
-
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/rest_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/rest_test.go
deleted file mode 100644
index 46457b279..000000000
--- a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/rest_test.go
+++ /dev/null
@@ -1,63 +0,0 @@
-package rest_test
-
-import (
- "bytes"
- "io/ioutil"
- "net/http"
- "testing"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/client"
- "github.com/aws/aws-sdk-go/aws/client/metadata"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/aws/signer/v4"
- "github.com/aws/aws-sdk-go/awstesting/unit"
- "github.com/aws/aws-sdk-go/private/protocol/rest"
-)
-
-func TestUnsetHeaders(t *testing.T) {
- cfg := &aws.Config{Region: aws.String("us-west-2")}
- c := unit.Session.ClientConfig("testService", cfg)
- svc := client.New(
- *cfg,
- metadata.ClientInfo{
- ServiceName: "testService",
- SigningName: c.SigningName,
- SigningRegion: c.SigningRegion,
- Endpoint: c.Endpoint,
- APIVersion: "",
- },
- c.Handlers,
- )
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(rest.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(rest.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(rest.UnmarshalMetaHandler)
- op := &request.Operation{
- Name: "test-operation",
- HTTPPath: "/",
- }
-
- input := &struct {
- Foo aws.JSONValue `location:"header" locationName:"x-amz-foo" type:"jsonvalue"`
- Bar aws.JSONValue `location:"header" locationName:"x-amz-bar" type:"jsonvalue"`
- }{}
-
- output := &struct {
- Foo aws.JSONValue `location:"header" locationName:"x-amz-foo" type:"jsonvalue"`
- Bar aws.JSONValue `location:"header" locationName:"x-amz-bar" type:"jsonvalue"`
- }{}
-
- req := svc.NewRequest(op, input, output)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(bytes.NewBuffer(nil)), Header: http.Header{}}
- req.HTTPResponse.Header.Set("X-Amz-Foo", "e30=")
-
- // unmarshal response
- rest.UnmarshalMeta(req)
- rest.Unmarshal(req)
- if req.Error != nil {
- t.Fatal(req.Error)
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/build_bench_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/build_bench_test.go
deleted file mode 100644
index 13106ee43..000000000
--- a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/build_bench_test.go
+++ /dev/null
@@ -1,366 +0,0 @@
-// +build bench
-
-package restxml_test
-
-import (
- "net/http"
- "net/http/httptest"
- "os"
- "testing"
-
- "bytes"
- "encoding/xml"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/credentials"
- "github.com/aws/aws-sdk-go/aws/endpoints"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/aws/session"
- "github.com/aws/aws-sdk-go/private/protocol/restxml"
- "github.com/aws/aws-sdk-go/service/cloudfront"
- "github.com/aws/aws-sdk-go/service/s3"
-)
-
-var (
- cloudfrontSvc *cloudfront.CloudFront
- s3Svc *s3.S3
-)
-
-func TestMain(m *testing.M) {
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.WriteHeader(http.StatusOK)
- }))
-
- sess := session.Must(session.NewSession(&aws.Config{
- Credentials: credentials.NewStaticCredentials("Key", "Secret", "Token"),
- Endpoint: aws.String(server.URL),
- S3ForcePathStyle: aws.Bool(true),
- DisableSSL: aws.Bool(true),
- Region: aws.String(endpoints.UsWest2RegionID),
- }))
- cloudfrontSvc = cloudfront.New(sess)
- s3Svc = s3.New(sess)
-
- c := m.Run()
- server.Close()
- os.Exit(c)
-}
-
-func BenchmarkRESTXMLBuild_Complex_CFCreateDistro(b *testing.B) {
- params := cloudfrontCreateDistributionInput()
-
- benchRESTXMLBuild(b, func() *request.Request {
- req, _ := cloudfrontSvc.CreateDistributionRequest(params)
- return req
- })
-}
-
-func BenchmarkRESTXMLBuild_Simple_CFDeleteDistro(b *testing.B) {
- params := cloudfrontDeleteDistributionInput()
-
- benchRESTXMLBuild(b, func() *request.Request {
- req, _ := cloudfrontSvc.DeleteDistributionRequest(params)
- return req
- })
-}
-
-func BenchmarkRESTXMLBuild_REST_S3HeadObject(b *testing.B) {
- params := s3HeadObjectInput()
-
- benchRESTXMLBuild(b, func() *request.Request {
- req, _ := s3Svc.HeadObjectRequest(params)
- return req
- })
-}
-
-func BenchmarkRESTXMLBuild_XML_S3PutObjectAcl(b *testing.B) {
- params := s3PutObjectAclInput()
-
- benchRESTXMLBuild(b, func() *request.Request {
- req, _ := s3Svc.PutObjectAclRequest(params)
- return req
- })
-}
-
-func BenchmarkRESTXMLRequest_Complex_CFCreateDistro(b *testing.B) {
- benchRESTXMLRequest(b, func() *request.Request {
- req, _ := cloudfrontSvc.CreateDistributionRequest(cloudfrontCreateDistributionInput())
- return req
- })
-}
-
-func BenchmarkRESTXMLRequest_Simple_CFDeleteDistro(b *testing.B) {
- benchRESTXMLRequest(b, func() *request.Request {
- req, _ := cloudfrontSvc.DeleteDistributionRequest(cloudfrontDeleteDistributionInput())
- return req
- })
-}
-
-func BenchmarkRESTXMLRequest_REST_S3HeadObject(b *testing.B) {
- benchRESTXMLRequest(b, func() *request.Request {
- req, _ := s3Svc.HeadObjectRequest(s3HeadObjectInput())
- return req
- })
-}
-
-func BenchmarkRESTXMLRequest_XML_S3PutObjectAcl(b *testing.B) {
- benchRESTXMLRequest(b, func() *request.Request {
- req, _ := s3Svc.PutObjectAclRequest(s3PutObjectAclInput())
- return req
- })
-}
-
-func BenchmarkEncodingXML_Simple(b *testing.B) {
- params := cloudfrontDeleteDistributionInput()
-
- for i := 0; i < b.N; i++ {
- buf := &bytes.Buffer{}
- encoder := xml.NewEncoder(buf)
- if err := encoder.Encode(params); err != nil {
- b.Fatal("Unexpected error", err)
- }
- }
-}
-
-func benchRESTXMLBuild(b *testing.B, reqFn func() *request.Request) {
- b.ResetTimer()
-
- for i := 0; i < b.N; i++ {
- req := reqFn()
- restxml.Build(req)
- if req.Error != nil {
- b.Fatal("Unexpected error", req.Error)
- }
- }
-}
-
-func benchRESTXMLRequest(b *testing.B, reqFn func() *request.Request) {
- b.ResetTimer()
-
- for i := 0; i < b.N; i++ {
- err := reqFn().Send()
- if err != nil {
- b.Fatal("Unexpected error", err)
- }
- }
-}
-
-func cloudfrontCreateDistributionInput() *cloudfront.CreateDistributionInput {
- return &cloudfront.CreateDistributionInput{
- DistributionConfig: &cloudfront.DistributionConfig{ // Required
- CallerReference: aws.String("string"), // Required
- Comment: aws.String("string"), // Required
- DefaultCacheBehavior: &cloudfront.DefaultCacheBehavior{ // Required
- ForwardedValues: &cloudfront.ForwardedValues{ // Required
- Cookies: &cloudfront.CookiePreference{ // Required
- Forward: aws.String("ItemSelection"), // Required
- WhitelistedNames: &cloudfront.CookieNames{
- Quantity: aws.Int64(1), // Required
- Items: []*string{
- aws.String("string"), // Required
- // More values...
- },
- },
- },
- QueryString: aws.Bool(true), // Required
- Headers: &cloudfront.Headers{
- Quantity: aws.Int64(1), // Required
- Items: []*string{
- aws.String("string"), // Required
- // More values...
- },
- },
- },
- MinTTL: aws.Int64(1), // Required
- TargetOriginId: aws.String("string"), // Required
- TrustedSigners: &cloudfront.TrustedSigners{ // Required
- Enabled: aws.Bool(true), // Required
- Quantity: aws.Int64(1), // Required
- Items: []*string{
- aws.String("string"), // Required
- // More values...
- },
- },
- ViewerProtocolPolicy: aws.String("ViewerProtocolPolicy"), // Required
- AllowedMethods: &cloudfront.AllowedMethods{
- Items: []*string{ // Required
- aws.String("Method"), // Required
- // More values...
- },
- Quantity: aws.Int64(1), // Required
- CachedMethods: &cloudfront.CachedMethods{
- Items: []*string{ // Required
- aws.String("Method"), // Required
- // More values...
- },
- Quantity: aws.Int64(1), // Required
- },
- },
- DefaultTTL: aws.Int64(1),
- MaxTTL: aws.Int64(1),
- SmoothStreaming: aws.Bool(true),
- },
- Enabled: aws.Bool(true), // Required
- Origins: &cloudfront.Origins{ // Required
- Quantity: aws.Int64(1), // Required
- Items: []*cloudfront.Origin{
- { // Required
- DomainName: aws.String("string"), // Required
- Id: aws.String("string"), // Required
- CustomOriginConfig: &cloudfront.CustomOriginConfig{
- HTTPPort: aws.Int64(1), // Required
- HTTPSPort: aws.Int64(1), // Required
- OriginProtocolPolicy: aws.String("OriginProtocolPolicy"), // Required
- },
- OriginPath: aws.String("string"),
- S3OriginConfig: &cloudfront.S3OriginConfig{
- OriginAccessIdentity: aws.String("string"), // Required
- },
- },
- // More values...
- },
- },
- Aliases: &cloudfront.Aliases{
- Quantity: aws.Int64(1), // Required
- Items: []*string{
- aws.String("string"), // Required
- // More values...
- },
- },
- CacheBehaviors: &cloudfront.CacheBehaviors{
- Quantity: aws.Int64(1), // Required
- Items: []*cloudfront.CacheBehavior{
- { // Required
- ForwardedValues: &cloudfront.ForwardedValues{ // Required
- Cookies: &cloudfront.CookiePreference{ // Required
- Forward: aws.String("ItemSelection"), // Required
- WhitelistedNames: &cloudfront.CookieNames{
- Quantity: aws.Int64(1), // Required
- Items: []*string{
- aws.String("string"), // Required
- // More values...
- },
- },
- },
- QueryString: aws.Bool(true), // Required
- Headers: &cloudfront.Headers{
- Quantity: aws.Int64(1), // Required
- Items: []*string{
- aws.String("string"), // Required
- // More values...
- },
- },
- },
- MinTTL: aws.Int64(1), // Required
- PathPattern: aws.String("string"), // Required
- TargetOriginId: aws.String("string"), // Required
- TrustedSigners: &cloudfront.TrustedSigners{ // Required
- Enabled: aws.Bool(true), // Required
- Quantity: aws.Int64(1), // Required
- Items: []*string{
- aws.String("string"), // Required
- // More values...
- },
- },
- ViewerProtocolPolicy: aws.String("ViewerProtocolPolicy"), // Required
- AllowedMethods: &cloudfront.AllowedMethods{
- Items: []*string{ // Required
- aws.String("Method"), // Required
- // More values...
- },
- Quantity: aws.Int64(1), // Required
- CachedMethods: &cloudfront.CachedMethods{
- Items: []*string{ // Required
- aws.String("Method"), // Required
- // More values...
- },
- Quantity: aws.Int64(1), // Required
- },
- },
- DefaultTTL: aws.Int64(1),
- MaxTTL: aws.Int64(1),
- SmoothStreaming: aws.Bool(true),
- },
- // More values...
- },
- },
- CustomErrorResponses: &cloudfront.CustomErrorResponses{
- Quantity: aws.Int64(1), // Required
- Items: []*cloudfront.CustomErrorResponse{
- { // Required
- ErrorCode: aws.Int64(1), // Required
- ErrorCachingMinTTL: aws.Int64(1),
- ResponseCode: aws.String("string"),
- ResponsePagePath: aws.String("string"),
- },
- // More values...
- },
- },
- DefaultRootObject: aws.String("string"),
- Logging: &cloudfront.LoggingConfig{
- Bucket: aws.String("string"), // Required
- Enabled: aws.Bool(true), // Required
- IncludeCookies: aws.Bool(true), // Required
- Prefix: aws.String("string"), // Required
- },
- PriceClass: aws.String("PriceClass"),
- Restrictions: &cloudfront.Restrictions{
- GeoRestriction: &cloudfront.GeoRestriction{ // Required
- Quantity: aws.Int64(1), // Required
- RestrictionType: aws.String("GeoRestrictionType"), // Required
- Items: []*string{
- aws.String("string"), // Required
- // More values...
- },
- },
- },
- ViewerCertificate: &cloudfront.ViewerCertificate{
- CloudFrontDefaultCertificate: aws.Bool(true),
- IAMCertificateId: aws.String("string"),
- MinimumProtocolVersion: aws.String("MinimumProtocolVersion"),
- SSLSupportMethod: aws.String("SSLSupportMethod"),
- },
- },
- }
-}
-
-func cloudfrontDeleteDistributionInput() *cloudfront.DeleteDistributionInput {
- return &cloudfront.DeleteDistributionInput{
- Id: aws.String("string"), // Required
- IfMatch: aws.String("string"),
- }
-}
-
-func s3HeadObjectInput() *s3.HeadObjectInput {
- return &s3.HeadObjectInput{
- Bucket: aws.String("somebucketname"),
- Key: aws.String("keyname"),
- VersionId: aws.String("someVersion"),
- IfMatch: aws.String("IfMatch"),
- }
-}
-
-func s3PutObjectAclInput() *s3.PutObjectAclInput {
- return &s3.PutObjectAclInput{
- Bucket: aws.String("somebucketname"),
- Key: aws.String("keyname"),
- AccessControlPolicy: &s3.AccessControlPolicy{
- Grants: []*s3.Grant{
- {
- Grantee: &s3.Grantee{
- DisplayName: aws.String("someName"),
- EmailAddress: aws.String("someAddr"),
- ID: aws.String("someID"),
- Type: aws.String(s3.TypeCanonicalUser),
- URI: aws.String("someURI"),
- },
- Permission: aws.String(s3.PermissionWrite),
- },
- },
- Owner: &s3.Owner{
- DisplayName: aws.String("howdy"),
- ID: aws.String("someID"),
- },
- },
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/build_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/build_test.go
deleted file mode 100644
index a13c421a7..000000000
--- a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/build_test.go
+++ /dev/null
@@ -1,6369 +0,0 @@
-package restxml_test
-
-import (
- "bytes"
- "encoding/json"
- "encoding/xml"
- "fmt"
- "io"
- "io/ioutil"
- "net/http"
- "net/url"
- "reflect"
- "testing"
- "time"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/client"
- "github.com/aws/aws-sdk-go/aws/client/metadata"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/aws/signer/v4"
- "github.com/aws/aws-sdk-go/awstesting"
- "github.com/aws/aws-sdk-go/awstesting/unit"
- "github.com/aws/aws-sdk-go/private/protocol"
- "github.com/aws/aws-sdk-go/private/protocol/restxml"
- "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil"
- "github.com/aws/aws-sdk-go/private/util"
-)
-
-var _ bytes.Buffer // always import bytes
-var _ http.Request
-var _ json.Marshaler
-var _ time.Time
-var _ xmlutil.XMLNode
-var _ xml.Attr
-var _ = ioutil.Discard
-var _ = util.Trim("")
-var _ = url.Values{}
-var _ = io.EOF
-var _ = aws.String
-var _ = fmt.Println
-var _ = reflect.Value{}
-
-func init() {
- protocol.RandReader = &awstesting.ZeroReader{}
-}
-
-// InputService1ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService1ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService1ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService1ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService1ProtocolTest client from just a session.
-// svc := inputservice1protocoltest.New(mySession)
-//
-// // Create a InputService1ProtocolTest client with additional configuration
-// svc := inputservice1protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService1ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService1ProtocolTest {
- c := p.ClientConfig("inputservice1protocoltest", cfgs...)
- return newInputService1ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService1ProtocolTest {
- svc := &InputService1ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService1ProtocolTest",
- ServiceID: "InputService1ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService1ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService1TestCaseOperation1 = "OperationName"
-
-// InputService1TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService1TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService1TestCaseOperation1 for more information on using the InputService1TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService1TestCaseOperation1Request method.
-// req, resp := client.InputService1TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService1ProtocolTest) InputService1TestCaseOperation1Request(input *InputService1TestShapeInputService1TestCaseOperation2Input) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService1TestCaseOperation1,
- HTTPMethod: "POST",
- HTTPPath: "/2014-01-01/hostedzone",
- }
-
- if input == nil {
- input = &InputService1TestShapeInputService1TestCaseOperation2Input{}
- }
-
- output = &InputService1TestShapeInputService1TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService1TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService1TestCaseOperation1 for usage and error information.
-func (c *InputService1ProtocolTest) InputService1TestCaseOperation1(input *InputService1TestShapeInputService1TestCaseOperation2Input) (*InputService1TestShapeInputService1TestCaseOperation1Output, error) {
- req, out := c.InputService1TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService1TestCaseOperation1WithContext is the same as InputService1TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService1TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService1ProtocolTest) InputService1TestCaseOperation1WithContext(ctx aws.Context, input *InputService1TestShapeInputService1TestCaseOperation2Input, opts ...request.Option) (*InputService1TestShapeInputService1TestCaseOperation1Output, error) {
- req, out := c.InputService1TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opInputService1TestCaseOperation2 = "OperationName"
-
-// InputService1TestCaseOperation2Request generates a "aws/request.Request" representing the
-// client's request for the InputService1TestCaseOperation2 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService1TestCaseOperation2 for more information on using the InputService1TestCaseOperation2
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService1TestCaseOperation2Request method.
-// req, resp := client.InputService1TestCaseOperation2Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService1ProtocolTest) InputService1TestCaseOperation2Request(input *InputService1TestShapeInputService1TestCaseOperation2Input) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation2Output) {
- op := &request.Operation{
- Name: opInputService1TestCaseOperation2,
- HTTPMethod: "PUT",
- HTTPPath: "/2014-01-01/hostedzone",
- }
-
- if input == nil {
- input = &InputService1TestShapeInputService1TestCaseOperation2Input{}
- }
-
- output = &InputService1TestShapeInputService1TestCaseOperation2Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService1TestCaseOperation2 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService1TestCaseOperation2 for usage and error information.
-func (c *InputService1ProtocolTest) InputService1TestCaseOperation2(input *InputService1TestShapeInputService1TestCaseOperation2Input) (*InputService1TestShapeInputService1TestCaseOperation2Output, error) {
- req, out := c.InputService1TestCaseOperation2Request(input)
- return out, req.Send()
-}
-
-// InputService1TestCaseOperation2WithContext is the same as InputService1TestCaseOperation2 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService1TestCaseOperation2 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService1ProtocolTest) InputService1TestCaseOperation2WithContext(ctx aws.Context, input *InputService1TestShapeInputService1TestCaseOperation2Input, opts ...request.Option) (*InputService1TestShapeInputService1TestCaseOperation2Output, error) {
- req, out := c.InputService1TestCaseOperation2Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opInputService1TestCaseOperation3 = "OperationName"
-
-// InputService1TestCaseOperation3Request generates a "aws/request.Request" representing the
-// client's request for the InputService1TestCaseOperation3 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService1TestCaseOperation3 for more information on using the InputService1TestCaseOperation3
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService1TestCaseOperation3Request method.
-// req, resp := client.InputService1TestCaseOperation3Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService1ProtocolTest) InputService1TestCaseOperation3Request(input *InputService1TestShapeInputService1TestCaseOperation3Input) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation3Output) {
- op := &request.Operation{
- Name: opInputService1TestCaseOperation3,
- HTTPMethod: "GET",
- HTTPPath: "/2014-01-01/hostedzone",
- }
-
- if input == nil {
- input = &InputService1TestShapeInputService1TestCaseOperation3Input{}
- }
-
- output = &InputService1TestShapeInputService1TestCaseOperation3Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService1TestCaseOperation3 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService1TestCaseOperation3 for usage and error information.
-func (c *InputService1ProtocolTest) InputService1TestCaseOperation3(input *InputService1TestShapeInputService1TestCaseOperation3Input) (*InputService1TestShapeInputService1TestCaseOperation3Output, error) {
- req, out := c.InputService1TestCaseOperation3Request(input)
- return out, req.Send()
-}
-
-// InputService1TestCaseOperation3WithContext is the same as InputService1TestCaseOperation3 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService1TestCaseOperation3 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService1ProtocolTest) InputService1TestCaseOperation3WithContext(ctx aws.Context, input *InputService1TestShapeInputService1TestCaseOperation3Input, opts ...request.Option) (*InputService1TestShapeInputService1TestCaseOperation3Output, error) {
- req, out := c.InputService1TestCaseOperation3Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService1TestShapeInputService1TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService1TestShapeInputService1TestCaseOperation2Input struct {
- _ struct{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"`
-
- Description *string `type:"string"`
-
- Name *string `type:"string"`
-}
-
-// SetDescription sets the Description field's value.
-func (s *InputService1TestShapeInputService1TestCaseOperation2Input) SetDescription(v string) *InputService1TestShapeInputService1TestCaseOperation2Input {
- s.Description = &v
- return s
-}
-
-// SetName sets the Name field's value.
-func (s *InputService1TestShapeInputService1TestCaseOperation2Input) SetName(v string) *InputService1TestShapeInputService1TestCaseOperation2Input {
- s.Name = &v
- return s
-}
-
-type InputService1TestShapeInputService1TestCaseOperation2Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService1TestShapeInputService1TestCaseOperation3Input struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService1TestShapeInputService1TestCaseOperation3Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService2ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService2ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService2ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService2ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService2ProtocolTest client from just a session.
-// svc := inputservice2protocoltest.New(mySession)
-//
-// // Create a InputService2ProtocolTest client with additional configuration
-// svc := inputservice2protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService2ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService2ProtocolTest {
- c := p.ClientConfig("inputservice2protocoltest", cfgs...)
- return newInputService2ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService2ProtocolTest {
- svc := &InputService2ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService2ProtocolTest",
- ServiceID: "InputService2ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService2ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService2TestCaseOperation1 = "OperationName"
-
-// InputService2TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService2TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService2TestCaseOperation1 for more information on using the InputService2TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService2TestCaseOperation1Request method.
-// req, resp := client.InputService2TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService2ProtocolTest) InputService2TestCaseOperation1Request(input *InputService2TestShapeInputService2TestCaseOperation1Input) (req *request.Request, output *InputService2TestShapeInputService2TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService2TestCaseOperation1,
- HTTPMethod: "POST",
- HTTPPath: "/2014-01-01/hostedzone",
- }
-
- if input == nil {
- input = &InputService2TestShapeInputService2TestCaseOperation1Input{}
- }
-
- output = &InputService2TestShapeInputService2TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService2TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService2TestCaseOperation1 for usage and error information.
-func (c *InputService2ProtocolTest) InputService2TestCaseOperation1(input *InputService2TestShapeInputService2TestCaseOperation1Input) (*InputService2TestShapeInputService2TestCaseOperation1Output, error) {
- req, out := c.InputService2TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService2TestCaseOperation1WithContext is the same as InputService2TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService2TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService2ProtocolTest) InputService2TestCaseOperation1WithContext(ctx aws.Context, input *InputService2TestShapeInputService2TestCaseOperation1Input, opts ...request.Option) (*InputService2TestShapeInputService2TestCaseOperation1Output, error) {
- req, out := c.InputService2TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService2TestShapeInputService2TestCaseOperation1Input struct {
- _ struct{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"`
-
- First *bool `type:"boolean"`
-
- Fourth *int64 `type:"integer"`
-
- Second *bool `type:"boolean"`
-
- Third *float64 `type:"float"`
-}
-
-// SetFirst sets the First field's value.
-func (s *InputService2TestShapeInputService2TestCaseOperation1Input) SetFirst(v bool) *InputService2TestShapeInputService2TestCaseOperation1Input {
- s.First = &v
- return s
-}
-
-// SetFourth sets the Fourth field's value.
-func (s *InputService2TestShapeInputService2TestCaseOperation1Input) SetFourth(v int64) *InputService2TestShapeInputService2TestCaseOperation1Input {
- s.Fourth = &v
- return s
-}
-
-// SetSecond sets the Second field's value.
-func (s *InputService2TestShapeInputService2TestCaseOperation1Input) SetSecond(v bool) *InputService2TestShapeInputService2TestCaseOperation1Input {
- s.Second = &v
- return s
-}
-
-// SetThird sets the Third field's value.
-func (s *InputService2TestShapeInputService2TestCaseOperation1Input) SetThird(v float64) *InputService2TestShapeInputService2TestCaseOperation1Input {
- s.Third = &v
- return s
-}
-
-type InputService2TestShapeInputService2TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService3ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService3ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService3ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService3ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService3ProtocolTest client from just a session.
-// svc := inputservice3protocoltest.New(mySession)
-//
-// // Create a InputService3ProtocolTest client with additional configuration
-// svc := inputservice3protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService3ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService3ProtocolTest {
- c := p.ClientConfig("inputservice3protocoltest", cfgs...)
- return newInputService3ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService3ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService3ProtocolTest {
- svc := &InputService3ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService3ProtocolTest",
- ServiceID: "InputService3ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService3ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService3TestCaseOperation1 = "OperationName"
-
-// InputService3TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService3TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService3TestCaseOperation1 for more information on using the InputService3TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService3TestCaseOperation1Request method.
-// req, resp := client.InputService3TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService3ProtocolTest) InputService3TestCaseOperation1Request(input *InputService3TestShapeInputService3TestCaseOperation2Input) (req *request.Request, output *InputService3TestShapeInputService3TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService3TestCaseOperation1,
- HTTPMethod: "POST",
- HTTPPath: "/2014-01-01/hostedzone",
- }
-
- if input == nil {
- input = &InputService3TestShapeInputService3TestCaseOperation2Input{}
- }
-
- output = &InputService3TestShapeInputService3TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService3TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService3TestCaseOperation1 for usage and error information.
-func (c *InputService3ProtocolTest) InputService3TestCaseOperation1(input *InputService3TestShapeInputService3TestCaseOperation2Input) (*InputService3TestShapeInputService3TestCaseOperation1Output, error) {
- req, out := c.InputService3TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService3TestCaseOperation1WithContext is the same as InputService3TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService3TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService3ProtocolTest) InputService3TestCaseOperation1WithContext(ctx aws.Context, input *InputService3TestShapeInputService3TestCaseOperation2Input, opts ...request.Option) (*InputService3TestShapeInputService3TestCaseOperation1Output, error) {
- req, out := c.InputService3TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opInputService3TestCaseOperation2 = "OperationName"
-
-// InputService3TestCaseOperation2Request generates a "aws/request.Request" representing the
-// client's request for the InputService3TestCaseOperation2 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService3TestCaseOperation2 for more information on using the InputService3TestCaseOperation2
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService3TestCaseOperation2Request method.
-// req, resp := client.InputService3TestCaseOperation2Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService3ProtocolTest) InputService3TestCaseOperation2Request(input *InputService3TestShapeInputService3TestCaseOperation2Input) (req *request.Request, output *InputService3TestShapeInputService3TestCaseOperation2Output) {
- op := &request.Operation{
- Name: opInputService3TestCaseOperation2,
- HTTPMethod: "POST",
- HTTPPath: "/2014-01-01/hostedzone",
- }
-
- if input == nil {
- input = &InputService3TestShapeInputService3TestCaseOperation2Input{}
- }
-
- output = &InputService3TestShapeInputService3TestCaseOperation2Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService3TestCaseOperation2 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService3TestCaseOperation2 for usage and error information.
-func (c *InputService3ProtocolTest) InputService3TestCaseOperation2(input *InputService3TestShapeInputService3TestCaseOperation2Input) (*InputService3TestShapeInputService3TestCaseOperation2Output, error) {
- req, out := c.InputService3TestCaseOperation2Request(input)
- return out, req.Send()
-}
-
-// InputService3TestCaseOperation2WithContext is the same as InputService3TestCaseOperation2 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService3TestCaseOperation2 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService3ProtocolTest) InputService3TestCaseOperation2WithContext(ctx aws.Context, input *InputService3TestShapeInputService3TestCaseOperation2Input, opts ...request.Option) (*InputService3TestShapeInputService3TestCaseOperation2Output, error) {
- req, out := c.InputService3TestCaseOperation2Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService3TestShapeInputService3TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService3TestShapeInputService3TestCaseOperation2Input struct {
- _ struct{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"`
-
- Description *string `type:"string"`
-
- SubStructure *InputService3TestShapeSubStructure `type:"structure"`
-}
-
-// SetDescription sets the Description field's value.
-func (s *InputService3TestShapeInputService3TestCaseOperation2Input) SetDescription(v string) *InputService3TestShapeInputService3TestCaseOperation2Input {
- s.Description = &v
- return s
-}
-
-// SetSubStructure sets the SubStructure field's value.
-func (s *InputService3TestShapeInputService3TestCaseOperation2Input) SetSubStructure(v *InputService3TestShapeSubStructure) *InputService3TestShapeInputService3TestCaseOperation2Input {
- s.SubStructure = v
- return s
-}
-
-type InputService3TestShapeInputService3TestCaseOperation2Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService3TestShapeSubStructure struct {
- _ struct{} `type:"structure"`
-
- Bar *string `type:"string"`
-
- Foo *string `type:"string"`
-}
-
-// SetBar sets the Bar field's value.
-func (s *InputService3TestShapeSubStructure) SetBar(v string) *InputService3TestShapeSubStructure {
- s.Bar = &v
- return s
-}
-
-// SetFoo sets the Foo field's value.
-func (s *InputService3TestShapeSubStructure) SetFoo(v string) *InputService3TestShapeSubStructure {
- s.Foo = &v
- return s
-}
-
-// InputService4ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService4ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService4ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService4ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService4ProtocolTest client from just a session.
-// svc := inputservice4protocoltest.New(mySession)
-//
-// // Create a InputService4ProtocolTest client with additional configuration
-// svc := inputservice4protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService4ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService4ProtocolTest {
- c := p.ClientConfig("inputservice4protocoltest", cfgs...)
- return newInputService4ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService4ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService4ProtocolTest {
- svc := &InputService4ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService4ProtocolTest",
- ServiceID: "InputService4ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService4ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService4TestCaseOperation1 = "OperationName"
-
-// InputService4TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService4TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService4TestCaseOperation1 for more information on using the InputService4TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService4TestCaseOperation1Request method.
-// req, resp := client.InputService4TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService4ProtocolTest) InputService4TestCaseOperation1Request(input *InputService4TestShapeInputService4TestCaseOperation1Input) (req *request.Request, output *InputService4TestShapeInputService4TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService4TestCaseOperation1,
- HTTPMethod: "POST",
- HTTPPath: "/2014-01-01/hostedzone",
- }
-
- if input == nil {
- input = &InputService4TestShapeInputService4TestCaseOperation1Input{}
- }
-
- output = &InputService4TestShapeInputService4TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService4TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService4TestCaseOperation1 for usage and error information.
-func (c *InputService4ProtocolTest) InputService4TestCaseOperation1(input *InputService4TestShapeInputService4TestCaseOperation1Input) (*InputService4TestShapeInputService4TestCaseOperation1Output, error) {
- req, out := c.InputService4TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService4TestCaseOperation1WithContext is the same as InputService4TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService4TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService4ProtocolTest) InputService4TestCaseOperation1WithContext(ctx aws.Context, input *InputService4TestShapeInputService4TestCaseOperation1Input, opts ...request.Option) (*InputService4TestShapeInputService4TestCaseOperation1Output, error) {
- req, out := c.InputService4TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService4TestShapeInputService4TestCaseOperation1Input struct {
- _ struct{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"`
-
- Description *string `type:"string"`
-
- SubStructure *InputService4TestShapeSubStructure `type:"structure"`
-}
-
-// SetDescription sets the Description field's value.
-func (s *InputService4TestShapeInputService4TestCaseOperation1Input) SetDescription(v string) *InputService4TestShapeInputService4TestCaseOperation1Input {
- s.Description = &v
- return s
-}
-
-// SetSubStructure sets the SubStructure field's value.
-func (s *InputService4TestShapeInputService4TestCaseOperation1Input) SetSubStructure(v *InputService4TestShapeSubStructure) *InputService4TestShapeInputService4TestCaseOperation1Input {
- s.SubStructure = v
- return s
-}
-
-type InputService4TestShapeInputService4TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService4TestShapeSubStructure struct {
- _ struct{} `type:"structure"`
-
- Bar *string `type:"string"`
-
- Foo *string `type:"string"`
-}
-
-// SetBar sets the Bar field's value.
-func (s *InputService4TestShapeSubStructure) SetBar(v string) *InputService4TestShapeSubStructure {
- s.Bar = &v
- return s
-}
-
-// SetFoo sets the Foo field's value.
-func (s *InputService4TestShapeSubStructure) SetFoo(v string) *InputService4TestShapeSubStructure {
- s.Foo = &v
- return s
-}
-
-// InputService5ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService5ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService5ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService5ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService5ProtocolTest client from just a session.
-// svc := inputservice5protocoltest.New(mySession)
-//
-// // Create a InputService5ProtocolTest client with additional configuration
-// svc := inputservice5protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService5ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService5ProtocolTest {
- c := p.ClientConfig("inputservice5protocoltest", cfgs...)
- return newInputService5ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService5ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService5ProtocolTest {
- svc := &InputService5ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService5ProtocolTest",
- ServiceID: "InputService5ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService5ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService5TestCaseOperation1 = "OperationName"
-
-// InputService5TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService5TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService5TestCaseOperation1 for more information on using the InputService5TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService5TestCaseOperation1Request method.
-// req, resp := client.InputService5TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService5ProtocolTest) InputService5TestCaseOperation1Request(input *InputService5TestShapeInputService5TestCaseOperation1Input) (req *request.Request, output *InputService5TestShapeInputService5TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService5TestCaseOperation1,
- HTTPMethod: "POST",
- HTTPPath: "/2014-01-01/hostedzone",
- }
-
- if input == nil {
- input = &InputService5TestShapeInputService5TestCaseOperation1Input{}
- }
-
- output = &InputService5TestShapeInputService5TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService5TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService5TestCaseOperation1 for usage and error information.
-func (c *InputService5ProtocolTest) InputService5TestCaseOperation1(input *InputService5TestShapeInputService5TestCaseOperation1Input) (*InputService5TestShapeInputService5TestCaseOperation1Output, error) {
- req, out := c.InputService5TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService5TestCaseOperation1WithContext is the same as InputService5TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService5TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService5ProtocolTest) InputService5TestCaseOperation1WithContext(ctx aws.Context, input *InputService5TestShapeInputService5TestCaseOperation1Input, opts ...request.Option) (*InputService5TestShapeInputService5TestCaseOperation1Output, error) {
- req, out := c.InputService5TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService5TestShapeInputService5TestCaseOperation1Input struct {
- _ struct{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"`
-
- ListParam []*string `type:"list"`
-}
-
-// SetListParam sets the ListParam field's value.
-func (s *InputService5TestShapeInputService5TestCaseOperation1Input) SetListParam(v []*string) *InputService5TestShapeInputService5TestCaseOperation1Input {
- s.ListParam = v
- return s
-}
-
-type InputService5TestShapeInputService5TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService6ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService6ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService6ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService6ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService6ProtocolTest client from just a session.
-// svc := inputservice6protocoltest.New(mySession)
-//
-// // Create a InputService6ProtocolTest client with additional configuration
-// svc := inputservice6protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService6ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService6ProtocolTest {
- c := p.ClientConfig("inputservice6protocoltest", cfgs...)
- return newInputService6ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService6ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService6ProtocolTest {
- svc := &InputService6ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService6ProtocolTest",
- ServiceID: "InputService6ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService6ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService6TestCaseOperation1 = "OperationName"
-
-// InputService6TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService6TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService6TestCaseOperation1 for more information on using the InputService6TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService6TestCaseOperation1Request method.
-// req, resp := client.InputService6TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService6ProtocolTest) InputService6TestCaseOperation1Request(input *InputService6TestShapeInputService6TestCaseOperation1Input) (req *request.Request, output *InputService6TestShapeInputService6TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService6TestCaseOperation1,
- HTTPMethod: "POST",
- HTTPPath: "/2014-01-01/hostedzone",
- }
-
- if input == nil {
- input = &InputService6TestShapeInputService6TestCaseOperation1Input{}
- }
-
- output = &InputService6TestShapeInputService6TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService6TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService6TestCaseOperation1 for usage and error information.
-func (c *InputService6ProtocolTest) InputService6TestCaseOperation1(input *InputService6TestShapeInputService6TestCaseOperation1Input) (*InputService6TestShapeInputService6TestCaseOperation1Output, error) {
- req, out := c.InputService6TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService6TestCaseOperation1WithContext is the same as InputService6TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService6TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService6ProtocolTest) InputService6TestCaseOperation1WithContext(ctx aws.Context, input *InputService6TestShapeInputService6TestCaseOperation1Input, opts ...request.Option) (*InputService6TestShapeInputService6TestCaseOperation1Output, error) {
- req, out := c.InputService6TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService6TestShapeInputService6TestCaseOperation1Input struct {
- _ struct{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"`
-
- ListParam []*string `locationName:"AlternateName" locationNameList:"NotMember" type:"list"`
-}
-
-// SetListParam sets the ListParam field's value.
-func (s *InputService6TestShapeInputService6TestCaseOperation1Input) SetListParam(v []*string) *InputService6TestShapeInputService6TestCaseOperation1Input {
- s.ListParam = v
- return s
-}
-
-type InputService6TestShapeInputService6TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService7ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService7ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService7ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService7ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService7ProtocolTest client from just a session.
-// svc := inputservice7protocoltest.New(mySession)
-//
-// // Create a InputService7ProtocolTest client with additional configuration
-// svc := inputservice7protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService7ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService7ProtocolTest {
- c := p.ClientConfig("inputservice7protocoltest", cfgs...)
- return newInputService7ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService7ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService7ProtocolTest {
- svc := &InputService7ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService7ProtocolTest",
- ServiceID: "InputService7ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService7ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService7TestCaseOperation1 = "OperationName"
-
-// InputService7TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService7TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService7TestCaseOperation1 for more information on using the InputService7TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService7TestCaseOperation1Request method.
-// req, resp := client.InputService7TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService7ProtocolTest) InputService7TestCaseOperation1Request(input *InputService7TestShapeInputService7TestCaseOperation1Input) (req *request.Request, output *InputService7TestShapeInputService7TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService7TestCaseOperation1,
- HTTPMethod: "POST",
- HTTPPath: "/2014-01-01/hostedzone",
- }
-
- if input == nil {
- input = &InputService7TestShapeInputService7TestCaseOperation1Input{}
- }
-
- output = &InputService7TestShapeInputService7TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService7TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService7TestCaseOperation1 for usage and error information.
-func (c *InputService7ProtocolTest) InputService7TestCaseOperation1(input *InputService7TestShapeInputService7TestCaseOperation1Input) (*InputService7TestShapeInputService7TestCaseOperation1Output, error) {
- req, out := c.InputService7TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService7TestCaseOperation1WithContext is the same as InputService7TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService7TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService7ProtocolTest) InputService7TestCaseOperation1WithContext(ctx aws.Context, input *InputService7TestShapeInputService7TestCaseOperation1Input, opts ...request.Option) (*InputService7TestShapeInputService7TestCaseOperation1Output, error) {
- req, out := c.InputService7TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService7TestShapeInputService7TestCaseOperation1Input struct {
- _ struct{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"`
-
- ListParam []*string `type:"list" flattened:"true"`
-}
-
-// SetListParam sets the ListParam field's value.
-func (s *InputService7TestShapeInputService7TestCaseOperation1Input) SetListParam(v []*string) *InputService7TestShapeInputService7TestCaseOperation1Input {
- s.ListParam = v
- return s
-}
-
-type InputService7TestShapeInputService7TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService8ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService8ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService8ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService8ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService8ProtocolTest client from just a session.
-// svc := inputservice8protocoltest.New(mySession)
-//
-// // Create a InputService8ProtocolTest client with additional configuration
-// svc := inputservice8protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService8ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService8ProtocolTest {
- c := p.ClientConfig("inputservice8protocoltest", cfgs...)
- return newInputService8ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService8ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService8ProtocolTest {
- svc := &InputService8ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService8ProtocolTest",
- ServiceID: "InputService8ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService8ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService8TestCaseOperation1 = "OperationName"
-
-// InputService8TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService8TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService8TestCaseOperation1 for more information on using the InputService8TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService8TestCaseOperation1Request method.
-// req, resp := client.InputService8TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService8ProtocolTest) InputService8TestCaseOperation1Request(input *InputService8TestShapeInputService8TestCaseOperation1Input) (req *request.Request, output *InputService8TestShapeInputService8TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService8TestCaseOperation1,
- HTTPMethod: "POST",
- HTTPPath: "/2014-01-01/hostedzone",
- }
-
- if input == nil {
- input = &InputService8TestShapeInputService8TestCaseOperation1Input{}
- }
-
- output = &InputService8TestShapeInputService8TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService8TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService8TestCaseOperation1 for usage and error information.
-func (c *InputService8ProtocolTest) InputService8TestCaseOperation1(input *InputService8TestShapeInputService8TestCaseOperation1Input) (*InputService8TestShapeInputService8TestCaseOperation1Output, error) {
- req, out := c.InputService8TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService8TestCaseOperation1WithContext is the same as InputService8TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService8TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService8ProtocolTest) InputService8TestCaseOperation1WithContext(ctx aws.Context, input *InputService8TestShapeInputService8TestCaseOperation1Input, opts ...request.Option) (*InputService8TestShapeInputService8TestCaseOperation1Output, error) {
- req, out := c.InputService8TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService8TestShapeInputService8TestCaseOperation1Input struct {
- _ struct{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"`
-
- ListParam []*string `locationName:"item" type:"list" flattened:"true"`
-}
-
-// SetListParam sets the ListParam field's value.
-func (s *InputService8TestShapeInputService8TestCaseOperation1Input) SetListParam(v []*string) *InputService8TestShapeInputService8TestCaseOperation1Input {
- s.ListParam = v
- return s
-}
-
-type InputService8TestShapeInputService8TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService9ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService9ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService9ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService9ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService9ProtocolTest client from just a session.
-// svc := inputservice9protocoltest.New(mySession)
-//
-// // Create a InputService9ProtocolTest client with additional configuration
-// svc := inputservice9protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService9ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService9ProtocolTest {
- c := p.ClientConfig("inputservice9protocoltest", cfgs...)
- return newInputService9ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService9ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService9ProtocolTest {
- svc := &InputService9ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService9ProtocolTest",
- ServiceID: "InputService9ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService9ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService9ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService9TestCaseOperation1 = "OperationName"
-
-// InputService9TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService9TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService9TestCaseOperation1 for more information on using the InputService9TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService9TestCaseOperation1Request method.
-// req, resp := client.InputService9TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService9ProtocolTest) InputService9TestCaseOperation1Request(input *InputService9TestShapeInputService9TestCaseOperation1Input) (req *request.Request, output *InputService9TestShapeInputService9TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService9TestCaseOperation1,
- HTTPMethod: "POST",
- HTTPPath: "/2014-01-01/hostedzone",
- }
-
- if input == nil {
- input = &InputService9TestShapeInputService9TestCaseOperation1Input{}
- }
-
- output = &InputService9TestShapeInputService9TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService9TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService9TestCaseOperation1 for usage and error information.
-func (c *InputService9ProtocolTest) InputService9TestCaseOperation1(input *InputService9TestShapeInputService9TestCaseOperation1Input) (*InputService9TestShapeInputService9TestCaseOperation1Output, error) {
- req, out := c.InputService9TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService9TestCaseOperation1WithContext is the same as InputService9TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService9TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService9ProtocolTest) InputService9TestCaseOperation1WithContext(ctx aws.Context, input *InputService9TestShapeInputService9TestCaseOperation1Input, opts ...request.Option) (*InputService9TestShapeInputService9TestCaseOperation1Output, error) {
- req, out := c.InputService9TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService9TestShapeInputService9TestCaseOperation1Input struct {
- _ struct{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"`
-
- ListParam []*InputService9TestShapeSingleFieldStruct `locationName:"item" type:"list" flattened:"true"`
-}
-
-// SetListParam sets the ListParam field's value.
-func (s *InputService9TestShapeInputService9TestCaseOperation1Input) SetListParam(v []*InputService9TestShapeSingleFieldStruct) *InputService9TestShapeInputService9TestCaseOperation1Input {
- s.ListParam = v
- return s
-}
-
-type InputService9TestShapeInputService9TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService9TestShapeSingleFieldStruct struct {
- _ struct{} `type:"structure"`
-
- Element *string `locationName:"value" type:"string"`
-}
-
-// SetElement sets the Element field's value.
-func (s *InputService9TestShapeSingleFieldStruct) SetElement(v string) *InputService9TestShapeSingleFieldStruct {
- s.Element = &v
- return s
-}
-
-// InputService10ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService10ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService10ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService10ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService10ProtocolTest client from just a session.
-// svc := inputservice10protocoltest.New(mySession)
-//
-// // Create a InputService10ProtocolTest client with additional configuration
-// svc := inputservice10protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService10ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService10ProtocolTest {
- c := p.ClientConfig("inputservice10protocoltest", cfgs...)
- return newInputService10ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService10ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService10ProtocolTest {
- svc := &InputService10ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService10ProtocolTest",
- ServiceID: "InputService10ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService10ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService10ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService10TestCaseOperation1 = "OperationName"
-
-// InputService10TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService10TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService10TestCaseOperation1 for more information on using the InputService10TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService10TestCaseOperation1Request method.
-// req, resp := client.InputService10TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService10ProtocolTest) InputService10TestCaseOperation1Request(input *InputService10TestShapeInputService10TestCaseOperation1Input) (req *request.Request, output *InputService10TestShapeInputService10TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService10TestCaseOperation1,
- HTTPMethod: "POST",
- HTTPPath: "/2014-01-01/hostedzone",
- }
-
- if input == nil {
- input = &InputService10TestShapeInputService10TestCaseOperation1Input{}
- }
-
- output = &InputService10TestShapeInputService10TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService10TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService10TestCaseOperation1 for usage and error information.
-func (c *InputService10ProtocolTest) InputService10TestCaseOperation1(input *InputService10TestShapeInputService10TestCaseOperation1Input) (*InputService10TestShapeInputService10TestCaseOperation1Output, error) {
- req, out := c.InputService10TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService10TestCaseOperation1WithContext is the same as InputService10TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService10TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService10ProtocolTest) InputService10TestCaseOperation1WithContext(ctx aws.Context, input *InputService10TestShapeInputService10TestCaseOperation1Input, opts ...request.Option) (*InputService10TestShapeInputService10TestCaseOperation1Output, error) {
- req, out := c.InputService10TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService10TestShapeInputService10TestCaseOperation1Input struct {
- _ struct{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"`
-
- StructureParam *InputService10TestShapeStructureShape `type:"structure"`
-}
-
-// SetStructureParam sets the StructureParam field's value.
-func (s *InputService10TestShapeInputService10TestCaseOperation1Input) SetStructureParam(v *InputService10TestShapeStructureShape) *InputService10TestShapeInputService10TestCaseOperation1Input {
- s.StructureParam = v
- return s
-}
-
-type InputService10TestShapeInputService10TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService10TestShapeStructureShape struct {
- _ struct{} `type:"structure"`
-
- // B is automatically base64 encoded/decoded by the SDK.
- B []byte `locationName:"b" type:"blob"`
-
- T *time.Time `locationName:"t" type:"timestamp" timestampFormat:"iso8601"`
-}
-
-// SetB sets the B field's value.
-func (s *InputService10TestShapeStructureShape) SetB(v []byte) *InputService10TestShapeStructureShape {
- s.B = v
- return s
-}
-
-// SetT sets the T field's value.
-func (s *InputService10TestShapeStructureShape) SetT(v time.Time) *InputService10TestShapeStructureShape {
- s.T = &v
- return s
-}
-
-// InputService11ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService11ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService11ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService11ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService11ProtocolTest client from just a session.
-// svc := inputservice11protocoltest.New(mySession)
-//
-// // Create a InputService11ProtocolTest client with additional configuration
-// svc := inputservice11protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService11ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService11ProtocolTest {
- c := p.ClientConfig("inputservice11protocoltest", cfgs...)
- return newInputService11ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService11ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService11ProtocolTest {
- svc := &InputService11ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService11ProtocolTest",
- ServiceID: "InputService11ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService11ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService11ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService11TestCaseOperation1 = "OperationName"
-
-// InputService11TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService11TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService11TestCaseOperation1 for more information on using the InputService11TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService11TestCaseOperation1Request method.
-// req, resp := client.InputService11TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService11ProtocolTest) InputService11TestCaseOperation1Request(input *InputService11TestShapeInputService11TestCaseOperation1Input) (req *request.Request, output *InputService11TestShapeInputService11TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService11TestCaseOperation1,
- HTTPMethod: "POST",
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService11TestShapeInputService11TestCaseOperation1Input{}
- }
-
- output = &InputService11TestShapeInputService11TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService11TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService11TestCaseOperation1 for usage and error information.
-func (c *InputService11ProtocolTest) InputService11TestCaseOperation1(input *InputService11TestShapeInputService11TestCaseOperation1Input) (*InputService11TestShapeInputService11TestCaseOperation1Output, error) {
- req, out := c.InputService11TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService11TestCaseOperation1WithContext is the same as InputService11TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService11TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService11ProtocolTest) InputService11TestCaseOperation1WithContext(ctx aws.Context, input *InputService11TestShapeInputService11TestCaseOperation1Input, opts ...request.Option) (*InputService11TestShapeInputService11TestCaseOperation1Output, error) {
- req, out := c.InputService11TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService11TestShapeInputService11TestCaseOperation1Input struct {
- _ struct{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"`
-
- Foo map[string]*string `location:"headers" locationName:"x-foo-" type:"map"`
-}
-
-// SetFoo sets the Foo field's value.
-func (s *InputService11TestShapeInputService11TestCaseOperation1Input) SetFoo(v map[string]*string) *InputService11TestShapeInputService11TestCaseOperation1Input {
- s.Foo = v
- return s
-}
-
-type InputService11TestShapeInputService11TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService12ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService12ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService12ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService12ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService12ProtocolTest client from just a session.
-// svc := inputservice12protocoltest.New(mySession)
-//
-// // Create a InputService12ProtocolTest client with additional configuration
-// svc := inputservice12protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService12ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService12ProtocolTest {
- c := p.ClientConfig("inputservice12protocoltest", cfgs...)
- return newInputService12ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService12ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService12ProtocolTest {
- svc := &InputService12ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService12ProtocolTest",
- ServiceID: "InputService12ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService12ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService12ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService12TestCaseOperation1 = "OperationName"
-
-// InputService12TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService12TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService12TestCaseOperation1 for more information on using the InputService12TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService12TestCaseOperation1Request method.
-// req, resp := client.InputService12TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService12ProtocolTest) InputService12TestCaseOperation1Request(input *InputService12TestShapeInputService12TestCaseOperation1Input) (req *request.Request, output *InputService12TestShapeInputService12TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService12TestCaseOperation1,
- HTTPMethod: "GET",
- HTTPPath: "/path",
- }
-
- if input == nil {
- input = &InputService12TestShapeInputService12TestCaseOperation1Input{}
- }
-
- output = &InputService12TestShapeInputService12TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService12TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService12TestCaseOperation1 for usage and error information.
-func (c *InputService12ProtocolTest) InputService12TestCaseOperation1(input *InputService12TestShapeInputService12TestCaseOperation1Input) (*InputService12TestShapeInputService12TestCaseOperation1Output, error) {
- req, out := c.InputService12TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService12TestCaseOperation1WithContext is the same as InputService12TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService12TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService12ProtocolTest) InputService12TestCaseOperation1WithContext(ctx aws.Context, input *InputService12TestShapeInputService12TestCaseOperation1Input, opts ...request.Option) (*InputService12TestShapeInputService12TestCaseOperation1Output, error) {
- req, out := c.InputService12TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService12TestShapeInputService12TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-
- Items []*string `location:"querystring" locationName:"item" type:"list"`
-}
-
-// SetItems sets the Items field's value.
-func (s *InputService12TestShapeInputService12TestCaseOperation1Input) SetItems(v []*string) *InputService12TestShapeInputService12TestCaseOperation1Input {
- s.Items = v
- return s
-}
-
-type InputService12TestShapeInputService12TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService13ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService13ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService13ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService13ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService13ProtocolTest client from just a session.
-// svc := inputservice13protocoltest.New(mySession)
-//
-// // Create a InputService13ProtocolTest client with additional configuration
-// svc := inputservice13protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService13ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService13ProtocolTest {
- c := p.ClientConfig("inputservice13protocoltest", cfgs...)
- return newInputService13ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService13ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService13ProtocolTest {
- svc := &InputService13ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService13ProtocolTest",
- ServiceID: "InputService13ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService13ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService13ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService13TestCaseOperation1 = "OperationName"
-
-// InputService13TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService13TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService13TestCaseOperation1 for more information on using the InputService13TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService13TestCaseOperation1Request method.
-// req, resp := client.InputService13TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService13ProtocolTest) InputService13TestCaseOperation1Request(input *InputService13TestShapeInputService13TestCaseOperation1Input) (req *request.Request, output *InputService13TestShapeInputService13TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService13TestCaseOperation1,
- HTTPMethod: "GET",
- HTTPPath: "/2014-01-01/jobsByPipeline/{PipelineId}",
- }
-
- if input == nil {
- input = &InputService13TestShapeInputService13TestCaseOperation1Input{}
- }
-
- output = &InputService13TestShapeInputService13TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService13TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService13TestCaseOperation1 for usage and error information.
-func (c *InputService13ProtocolTest) InputService13TestCaseOperation1(input *InputService13TestShapeInputService13TestCaseOperation1Input) (*InputService13TestShapeInputService13TestCaseOperation1Output, error) {
- req, out := c.InputService13TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService13TestCaseOperation1WithContext is the same as InputService13TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService13TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService13ProtocolTest) InputService13TestCaseOperation1WithContext(ctx aws.Context, input *InputService13TestShapeInputService13TestCaseOperation1Input, opts ...request.Option) (*InputService13TestShapeInputService13TestCaseOperation1Output, error) {
- req, out := c.InputService13TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService13TestShapeInputService13TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-
- PipelineId *string `location:"uri" type:"string"`
-
- QueryDoc map[string]*string `location:"querystring" type:"map"`
-}
-
-// SetPipelineId sets the PipelineId field's value.
-func (s *InputService13TestShapeInputService13TestCaseOperation1Input) SetPipelineId(v string) *InputService13TestShapeInputService13TestCaseOperation1Input {
- s.PipelineId = &v
- return s
-}
-
-// SetQueryDoc sets the QueryDoc field's value.
-func (s *InputService13TestShapeInputService13TestCaseOperation1Input) SetQueryDoc(v map[string]*string) *InputService13TestShapeInputService13TestCaseOperation1Input {
- s.QueryDoc = v
- return s
-}
-
-type InputService13TestShapeInputService13TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService14ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService14ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService14ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService14ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService14ProtocolTest client from just a session.
-// svc := inputservice14protocoltest.New(mySession)
-//
-// // Create a InputService14ProtocolTest client with additional configuration
-// svc := inputservice14protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService14ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService14ProtocolTest {
- c := p.ClientConfig("inputservice14protocoltest", cfgs...)
- return newInputService14ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService14ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService14ProtocolTest {
- svc := &InputService14ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService14ProtocolTest",
- ServiceID: "InputService14ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService14ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService14ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService14TestCaseOperation1 = "OperationName"
-
-// InputService14TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService14TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService14TestCaseOperation1 for more information on using the InputService14TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService14TestCaseOperation1Request method.
-// req, resp := client.InputService14TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService14ProtocolTest) InputService14TestCaseOperation1Request(input *InputService14TestShapeInputService14TestCaseOperation1Input) (req *request.Request, output *InputService14TestShapeInputService14TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService14TestCaseOperation1,
- HTTPMethod: "GET",
- HTTPPath: "/2014-01-01/jobsByPipeline/{PipelineId}",
- }
-
- if input == nil {
- input = &InputService14TestShapeInputService14TestCaseOperation1Input{}
- }
-
- output = &InputService14TestShapeInputService14TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService14TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService14TestCaseOperation1 for usage and error information.
-func (c *InputService14ProtocolTest) InputService14TestCaseOperation1(input *InputService14TestShapeInputService14TestCaseOperation1Input) (*InputService14TestShapeInputService14TestCaseOperation1Output, error) {
- req, out := c.InputService14TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService14TestCaseOperation1WithContext is the same as InputService14TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService14TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService14ProtocolTest) InputService14TestCaseOperation1WithContext(ctx aws.Context, input *InputService14TestShapeInputService14TestCaseOperation1Input, opts ...request.Option) (*InputService14TestShapeInputService14TestCaseOperation1Output, error) {
- req, out := c.InputService14TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService14TestShapeInputService14TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-
- PipelineId *string `location:"uri" type:"string"`
-
- QueryDoc map[string][]*string `location:"querystring" type:"map"`
-}
-
-// SetPipelineId sets the PipelineId field's value.
-func (s *InputService14TestShapeInputService14TestCaseOperation1Input) SetPipelineId(v string) *InputService14TestShapeInputService14TestCaseOperation1Input {
- s.PipelineId = &v
- return s
-}
-
-// SetQueryDoc sets the QueryDoc field's value.
-func (s *InputService14TestShapeInputService14TestCaseOperation1Input) SetQueryDoc(v map[string][]*string) *InputService14TestShapeInputService14TestCaseOperation1Input {
- s.QueryDoc = v
- return s
-}
-
-type InputService14TestShapeInputService14TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService15ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService15ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService15ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService15ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService15ProtocolTest client from just a session.
-// svc := inputservice15protocoltest.New(mySession)
-//
-// // Create a InputService15ProtocolTest client with additional configuration
-// svc := inputservice15protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService15ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService15ProtocolTest {
- c := p.ClientConfig("inputservice15protocoltest", cfgs...)
- return newInputService15ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService15ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService15ProtocolTest {
- svc := &InputService15ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService15ProtocolTest",
- ServiceID: "InputService15ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService15ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService15ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService15TestCaseOperation1 = "OperationName"
-
-// InputService15TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService15TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService15TestCaseOperation1 for more information on using the InputService15TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService15TestCaseOperation1Request method.
-// req, resp := client.InputService15TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService15ProtocolTest) InputService15TestCaseOperation1Request(input *InputService15TestShapeInputService15TestCaseOperation2Input) (req *request.Request, output *InputService15TestShapeInputService15TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService15TestCaseOperation1,
- HTTPMethod: "GET",
- HTTPPath: "/path",
- }
-
- if input == nil {
- input = &InputService15TestShapeInputService15TestCaseOperation2Input{}
- }
-
- output = &InputService15TestShapeInputService15TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService15TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService15TestCaseOperation1 for usage and error information.
-func (c *InputService15ProtocolTest) InputService15TestCaseOperation1(input *InputService15TestShapeInputService15TestCaseOperation2Input) (*InputService15TestShapeInputService15TestCaseOperation1Output, error) {
- req, out := c.InputService15TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService15TestCaseOperation1WithContext is the same as InputService15TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService15TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService15ProtocolTest) InputService15TestCaseOperation1WithContext(ctx aws.Context, input *InputService15TestShapeInputService15TestCaseOperation2Input, opts ...request.Option) (*InputService15TestShapeInputService15TestCaseOperation1Output, error) {
- req, out := c.InputService15TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opInputService15TestCaseOperation2 = "OperationName"
-
-// InputService15TestCaseOperation2Request generates a "aws/request.Request" representing the
-// client's request for the InputService15TestCaseOperation2 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService15TestCaseOperation2 for more information on using the InputService15TestCaseOperation2
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService15TestCaseOperation2Request method.
-// req, resp := client.InputService15TestCaseOperation2Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService15ProtocolTest) InputService15TestCaseOperation2Request(input *InputService15TestShapeInputService15TestCaseOperation2Input) (req *request.Request, output *InputService15TestShapeInputService15TestCaseOperation2Output) {
- op := &request.Operation{
- Name: opInputService15TestCaseOperation2,
- HTTPMethod: "GET",
- HTTPPath: "/path",
- }
-
- if input == nil {
- input = &InputService15TestShapeInputService15TestCaseOperation2Input{}
- }
-
- output = &InputService15TestShapeInputService15TestCaseOperation2Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService15TestCaseOperation2 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService15TestCaseOperation2 for usage and error information.
-func (c *InputService15ProtocolTest) InputService15TestCaseOperation2(input *InputService15TestShapeInputService15TestCaseOperation2Input) (*InputService15TestShapeInputService15TestCaseOperation2Output, error) {
- req, out := c.InputService15TestCaseOperation2Request(input)
- return out, req.Send()
-}
-
-// InputService15TestCaseOperation2WithContext is the same as InputService15TestCaseOperation2 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService15TestCaseOperation2 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService15ProtocolTest) InputService15TestCaseOperation2WithContext(ctx aws.Context, input *InputService15TestShapeInputService15TestCaseOperation2Input, opts ...request.Option) (*InputService15TestShapeInputService15TestCaseOperation2Output, error) {
- req, out := c.InputService15TestCaseOperation2Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService15TestShapeInputService15TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService15TestShapeInputService15TestCaseOperation2Input struct {
- _ struct{} `type:"structure"`
-
- BoolQuery *bool `location:"querystring" locationName:"bool-query" type:"boolean"`
-}
-
-// SetBoolQuery sets the BoolQuery field's value.
-func (s *InputService15TestShapeInputService15TestCaseOperation2Input) SetBoolQuery(v bool) *InputService15TestShapeInputService15TestCaseOperation2Input {
- s.BoolQuery = &v
- return s
-}
-
-type InputService15TestShapeInputService15TestCaseOperation2Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService16ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService16ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService16ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService16ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService16ProtocolTest client from just a session.
-// svc := inputservice16protocoltest.New(mySession)
-//
-// // Create a InputService16ProtocolTest client with additional configuration
-// svc := inputservice16protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService16ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService16ProtocolTest {
- c := p.ClientConfig("inputservice16protocoltest", cfgs...)
- return newInputService16ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService16ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService16ProtocolTest {
- svc := &InputService16ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService16ProtocolTest",
- ServiceID: "InputService16ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService16ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService16ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService16TestCaseOperation1 = "OperationName"
-
-// InputService16TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService16TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService16TestCaseOperation1 for more information on using the InputService16TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService16TestCaseOperation1Request method.
-// req, resp := client.InputService16TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService16ProtocolTest) InputService16TestCaseOperation1Request(input *InputService16TestShapeInputService16TestCaseOperation1Input) (req *request.Request, output *InputService16TestShapeInputService16TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService16TestCaseOperation1,
- HTTPMethod: "POST",
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService16TestShapeInputService16TestCaseOperation1Input{}
- }
-
- output = &InputService16TestShapeInputService16TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService16TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService16TestCaseOperation1 for usage and error information.
-func (c *InputService16ProtocolTest) InputService16TestCaseOperation1(input *InputService16TestShapeInputService16TestCaseOperation1Input) (*InputService16TestShapeInputService16TestCaseOperation1Output, error) {
- req, out := c.InputService16TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService16TestCaseOperation1WithContext is the same as InputService16TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService16TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService16ProtocolTest) InputService16TestCaseOperation1WithContext(ctx aws.Context, input *InputService16TestShapeInputService16TestCaseOperation1Input, opts ...request.Option) (*InputService16TestShapeInputService16TestCaseOperation1Output, error) {
- req, out := c.InputService16TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService16TestShapeInputService16TestCaseOperation1Input struct {
- _ struct{} `type:"structure" payload:"Foo"`
-
- Foo *string `locationName:"foo" type:"string"`
-}
-
-// SetFoo sets the Foo field's value.
-func (s *InputService16TestShapeInputService16TestCaseOperation1Input) SetFoo(v string) *InputService16TestShapeInputService16TestCaseOperation1Input {
- s.Foo = &v
- return s
-}
-
-type InputService16TestShapeInputService16TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService17ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService17ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService17ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService17ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService17ProtocolTest client from just a session.
-// svc := inputservice17protocoltest.New(mySession)
-//
-// // Create a InputService17ProtocolTest client with additional configuration
-// svc := inputservice17protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService17ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService17ProtocolTest {
- c := p.ClientConfig("inputservice17protocoltest", cfgs...)
- return newInputService17ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService17ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService17ProtocolTest {
- svc := &InputService17ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService17ProtocolTest",
- ServiceID: "InputService17ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService17ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService17ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService17TestCaseOperation1 = "OperationName"
-
-// InputService17TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService17TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService17TestCaseOperation1 for more information on using the InputService17TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService17TestCaseOperation1Request method.
-// req, resp := client.InputService17TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService17ProtocolTest) InputService17TestCaseOperation1Request(input *InputService17TestShapeInputService17TestCaseOperation2Input) (req *request.Request, output *InputService17TestShapeInputService17TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService17TestCaseOperation1,
- HTTPMethod: "POST",
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService17TestShapeInputService17TestCaseOperation2Input{}
- }
-
- output = &InputService17TestShapeInputService17TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService17TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService17TestCaseOperation1 for usage and error information.
-func (c *InputService17ProtocolTest) InputService17TestCaseOperation1(input *InputService17TestShapeInputService17TestCaseOperation2Input) (*InputService17TestShapeInputService17TestCaseOperation1Output, error) {
- req, out := c.InputService17TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService17TestCaseOperation1WithContext is the same as InputService17TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService17TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService17ProtocolTest) InputService17TestCaseOperation1WithContext(ctx aws.Context, input *InputService17TestShapeInputService17TestCaseOperation2Input, opts ...request.Option) (*InputService17TestShapeInputService17TestCaseOperation1Output, error) {
- req, out := c.InputService17TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opInputService17TestCaseOperation2 = "OperationName"
-
-// InputService17TestCaseOperation2Request generates a "aws/request.Request" representing the
-// client's request for the InputService17TestCaseOperation2 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService17TestCaseOperation2 for more information on using the InputService17TestCaseOperation2
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService17TestCaseOperation2Request method.
-// req, resp := client.InputService17TestCaseOperation2Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService17ProtocolTest) InputService17TestCaseOperation2Request(input *InputService17TestShapeInputService17TestCaseOperation2Input) (req *request.Request, output *InputService17TestShapeInputService17TestCaseOperation2Output) {
- op := &request.Operation{
- Name: opInputService17TestCaseOperation2,
- HTTPMethod: "POST",
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService17TestShapeInputService17TestCaseOperation2Input{}
- }
-
- output = &InputService17TestShapeInputService17TestCaseOperation2Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService17TestCaseOperation2 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService17TestCaseOperation2 for usage and error information.
-func (c *InputService17ProtocolTest) InputService17TestCaseOperation2(input *InputService17TestShapeInputService17TestCaseOperation2Input) (*InputService17TestShapeInputService17TestCaseOperation2Output, error) {
- req, out := c.InputService17TestCaseOperation2Request(input)
- return out, req.Send()
-}
-
-// InputService17TestCaseOperation2WithContext is the same as InputService17TestCaseOperation2 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService17TestCaseOperation2 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService17ProtocolTest) InputService17TestCaseOperation2WithContext(ctx aws.Context, input *InputService17TestShapeInputService17TestCaseOperation2Input, opts ...request.Option) (*InputService17TestShapeInputService17TestCaseOperation2Output, error) {
- req, out := c.InputService17TestCaseOperation2Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService17TestShapeInputService17TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService17TestShapeInputService17TestCaseOperation2Input struct {
- _ struct{} `type:"structure" payload:"Foo"`
-
- Foo []byte `locationName:"foo" type:"blob"`
-}
-
-// SetFoo sets the Foo field's value.
-func (s *InputService17TestShapeInputService17TestCaseOperation2Input) SetFoo(v []byte) *InputService17TestShapeInputService17TestCaseOperation2Input {
- s.Foo = v
- return s
-}
-
-type InputService17TestShapeInputService17TestCaseOperation2Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService18ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService18ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService18ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService18ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService18ProtocolTest client from just a session.
-// svc := inputservice18protocoltest.New(mySession)
-//
-// // Create a InputService18ProtocolTest client with additional configuration
-// svc := inputservice18protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService18ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService18ProtocolTest {
- c := p.ClientConfig("inputservice18protocoltest", cfgs...)
- return newInputService18ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService18ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService18ProtocolTest {
- svc := &InputService18ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService18ProtocolTest",
- ServiceID: "InputService18ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService18ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService18ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService18TestCaseOperation1 = "OperationName"
-
-// InputService18TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService18TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService18TestCaseOperation1 for more information on using the InputService18TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService18TestCaseOperation1Request method.
-// req, resp := client.InputService18TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService18ProtocolTest) InputService18TestCaseOperation1Request(input *InputService18TestShapeInputService18TestCaseOperation4Input) (req *request.Request, output *InputService18TestShapeInputService18TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService18TestCaseOperation1,
- HTTPMethod: "POST",
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService18TestShapeInputService18TestCaseOperation4Input{}
- }
-
- output = &InputService18TestShapeInputService18TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService18TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService18TestCaseOperation1 for usage and error information.
-func (c *InputService18ProtocolTest) InputService18TestCaseOperation1(input *InputService18TestShapeInputService18TestCaseOperation4Input) (*InputService18TestShapeInputService18TestCaseOperation1Output, error) {
- req, out := c.InputService18TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService18TestCaseOperation1WithContext is the same as InputService18TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService18TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService18ProtocolTest) InputService18TestCaseOperation1WithContext(ctx aws.Context, input *InputService18TestShapeInputService18TestCaseOperation4Input, opts ...request.Option) (*InputService18TestShapeInputService18TestCaseOperation1Output, error) {
- req, out := c.InputService18TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opInputService18TestCaseOperation2 = "OperationName"
-
-// InputService18TestCaseOperation2Request generates a "aws/request.Request" representing the
-// client's request for the InputService18TestCaseOperation2 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService18TestCaseOperation2 for more information on using the InputService18TestCaseOperation2
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService18TestCaseOperation2Request method.
-// req, resp := client.InputService18TestCaseOperation2Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService18ProtocolTest) InputService18TestCaseOperation2Request(input *InputService18TestShapeInputService18TestCaseOperation4Input) (req *request.Request, output *InputService18TestShapeInputService18TestCaseOperation2Output) {
- op := &request.Operation{
- Name: opInputService18TestCaseOperation2,
- HTTPMethod: "POST",
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService18TestShapeInputService18TestCaseOperation4Input{}
- }
-
- output = &InputService18TestShapeInputService18TestCaseOperation2Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService18TestCaseOperation2 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService18TestCaseOperation2 for usage and error information.
-func (c *InputService18ProtocolTest) InputService18TestCaseOperation2(input *InputService18TestShapeInputService18TestCaseOperation4Input) (*InputService18TestShapeInputService18TestCaseOperation2Output, error) {
- req, out := c.InputService18TestCaseOperation2Request(input)
- return out, req.Send()
-}
-
-// InputService18TestCaseOperation2WithContext is the same as InputService18TestCaseOperation2 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService18TestCaseOperation2 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService18ProtocolTest) InputService18TestCaseOperation2WithContext(ctx aws.Context, input *InputService18TestShapeInputService18TestCaseOperation4Input, opts ...request.Option) (*InputService18TestShapeInputService18TestCaseOperation2Output, error) {
- req, out := c.InputService18TestCaseOperation2Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opInputService18TestCaseOperation3 = "OperationName"
-
-// InputService18TestCaseOperation3Request generates a "aws/request.Request" representing the
-// client's request for the InputService18TestCaseOperation3 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService18TestCaseOperation3 for more information on using the InputService18TestCaseOperation3
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService18TestCaseOperation3Request method.
-// req, resp := client.InputService18TestCaseOperation3Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService18ProtocolTest) InputService18TestCaseOperation3Request(input *InputService18TestShapeInputService18TestCaseOperation4Input) (req *request.Request, output *InputService18TestShapeInputService18TestCaseOperation3Output) {
- op := &request.Operation{
- Name: opInputService18TestCaseOperation3,
- HTTPMethod: "POST",
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService18TestShapeInputService18TestCaseOperation4Input{}
- }
-
- output = &InputService18TestShapeInputService18TestCaseOperation3Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService18TestCaseOperation3 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService18TestCaseOperation3 for usage and error information.
-func (c *InputService18ProtocolTest) InputService18TestCaseOperation3(input *InputService18TestShapeInputService18TestCaseOperation4Input) (*InputService18TestShapeInputService18TestCaseOperation3Output, error) {
- req, out := c.InputService18TestCaseOperation3Request(input)
- return out, req.Send()
-}
-
-// InputService18TestCaseOperation3WithContext is the same as InputService18TestCaseOperation3 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService18TestCaseOperation3 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService18ProtocolTest) InputService18TestCaseOperation3WithContext(ctx aws.Context, input *InputService18TestShapeInputService18TestCaseOperation4Input, opts ...request.Option) (*InputService18TestShapeInputService18TestCaseOperation3Output, error) {
- req, out := c.InputService18TestCaseOperation3Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opInputService18TestCaseOperation4 = "OperationName"
-
-// InputService18TestCaseOperation4Request generates a "aws/request.Request" representing the
-// client's request for the InputService18TestCaseOperation4 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService18TestCaseOperation4 for more information on using the InputService18TestCaseOperation4
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService18TestCaseOperation4Request method.
-// req, resp := client.InputService18TestCaseOperation4Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService18ProtocolTest) InputService18TestCaseOperation4Request(input *InputService18TestShapeInputService18TestCaseOperation4Input) (req *request.Request, output *InputService18TestShapeInputService18TestCaseOperation4Output) {
- op := &request.Operation{
- Name: opInputService18TestCaseOperation4,
- HTTPMethod: "POST",
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService18TestShapeInputService18TestCaseOperation4Input{}
- }
-
- output = &InputService18TestShapeInputService18TestCaseOperation4Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService18TestCaseOperation4 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService18TestCaseOperation4 for usage and error information.
-func (c *InputService18ProtocolTest) InputService18TestCaseOperation4(input *InputService18TestShapeInputService18TestCaseOperation4Input) (*InputService18TestShapeInputService18TestCaseOperation4Output, error) {
- req, out := c.InputService18TestCaseOperation4Request(input)
- return out, req.Send()
-}
-
-// InputService18TestCaseOperation4WithContext is the same as InputService18TestCaseOperation4 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService18TestCaseOperation4 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService18ProtocolTest) InputService18TestCaseOperation4WithContext(ctx aws.Context, input *InputService18TestShapeInputService18TestCaseOperation4Input, opts ...request.Option) (*InputService18TestShapeInputService18TestCaseOperation4Output, error) {
- req, out := c.InputService18TestCaseOperation4Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService18TestShapeFooShape struct {
- _ struct{} `locationName:"foo" type:"structure"`
-
- Baz *string `locationName:"baz" type:"string"`
-}
-
-// SetBaz sets the Baz field's value.
-func (s *InputService18TestShapeFooShape) SetBaz(v string) *InputService18TestShapeFooShape {
- s.Baz = &v
- return s
-}
-
-type InputService18TestShapeInputService18TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService18TestShapeInputService18TestCaseOperation2Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService18TestShapeInputService18TestCaseOperation3Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService18TestShapeInputService18TestCaseOperation4Input struct {
- _ struct{} `type:"structure" payload:"Foo"`
-
- Foo *InputService18TestShapeFooShape `locationName:"foo" type:"structure"`
-}
-
-// SetFoo sets the Foo field's value.
-func (s *InputService18TestShapeInputService18TestCaseOperation4Input) SetFoo(v *InputService18TestShapeFooShape) *InputService18TestShapeInputService18TestCaseOperation4Input {
- s.Foo = v
- return s
-}
-
-type InputService18TestShapeInputService18TestCaseOperation4Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService19ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService19ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService19ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService19ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService19ProtocolTest client from just a session.
-// svc := inputservice19protocoltest.New(mySession)
-//
-// // Create a InputService19ProtocolTest client with additional configuration
-// svc := inputservice19protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService19ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService19ProtocolTest {
- c := p.ClientConfig("inputservice19protocoltest", cfgs...)
- return newInputService19ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService19ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService19ProtocolTest {
- svc := &InputService19ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService19ProtocolTest",
- ServiceID: "InputService19ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService19ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService19ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService19TestCaseOperation1 = "OperationName"
-
-// InputService19TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService19TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService19TestCaseOperation1 for more information on using the InputService19TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService19TestCaseOperation1Request method.
-// req, resp := client.InputService19TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService19ProtocolTest) InputService19TestCaseOperation1Request(input *InputService19TestShapeInputService19TestCaseOperation1Input) (req *request.Request, output *InputService19TestShapeInputService19TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService19TestCaseOperation1,
- HTTPMethod: "POST",
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &InputService19TestShapeInputService19TestCaseOperation1Input{}
- }
-
- output = &InputService19TestShapeInputService19TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService19TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService19TestCaseOperation1 for usage and error information.
-func (c *InputService19ProtocolTest) InputService19TestCaseOperation1(input *InputService19TestShapeInputService19TestCaseOperation1Input) (*InputService19TestShapeInputService19TestCaseOperation1Output, error) {
- req, out := c.InputService19TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService19TestCaseOperation1WithContext is the same as InputService19TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService19TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService19ProtocolTest) InputService19TestCaseOperation1WithContext(ctx aws.Context, input *InputService19TestShapeInputService19TestCaseOperation1Input, opts ...request.Option) (*InputService19TestShapeInputService19TestCaseOperation1Output, error) {
- req, out := c.InputService19TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService19TestShapeGrant struct {
- _ struct{} `locationName:"Grant" type:"structure"`
-
- Grantee *InputService19TestShapeGrantee `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"`
-}
-
-// SetGrantee sets the Grantee field's value.
-func (s *InputService19TestShapeGrant) SetGrantee(v *InputService19TestShapeGrantee) *InputService19TestShapeGrant {
- s.Grantee = v
- return s
-}
-
-type InputService19TestShapeGrantee struct {
- _ struct{} `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"`
-
- EmailAddress *string `type:"string"`
-
- Type *string `locationName:"xsi:type" type:"string" xmlAttribute:"true"`
-}
-
-// SetEmailAddress sets the EmailAddress field's value.
-func (s *InputService19TestShapeGrantee) SetEmailAddress(v string) *InputService19TestShapeGrantee {
- s.EmailAddress = &v
- return s
-}
-
-// SetType sets the Type field's value.
-func (s *InputService19TestShapeGrantee) SetType(v string) *InputService19TestShapeGrantee {
- s.Type = &v
- return s
-}
-
-type InputService19TestShapeInputService19TestCaseOperation1Input struct {
- _ struct{} `type:"structure" payload:"Grant"`
-
- Grant *InputService19TestShapeGrant `locationName:"Grant" type:"structure"`
-}
-
-// SetGrant sets the Grant field's value.
-func (s *InputService19TestShapeInputService19TestCaseOperation1Input) SetGrant(v *InputService19TestShapeGrant) *InputService19TestShapeInputService19TestCaseOperation1Input {
- s.Grant = v
- return s
-}
-
-type InputService19TestShapeInputService19TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService20ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService20ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService20ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService20ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService20ProtocolTest client from just a session.
-// svc := inputservice20protocoltest.New(mySession)
-//
-// // Create a InputService20ProtocolTest client with additional configuration
-// svc := inputservice20protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService20ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService20ProtocolTest {
- c := p.ClientConfig("inputservice20protocoltest", cfgs...)
- return newInputService20ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService20ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService20ProtocolTest {
- svc := &InputService20ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService20ProtocolTest",
- ServiceID: "InputService20ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService20ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService20ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService20TestCaseOperation1 = "OperationName"
-
-// InputService20TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService20TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService20TestCaseOperation1 for more information on using the InputService20TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService20TestCaseOperation1Request method.
-// req, resp := client.InputService20TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService20ProtocolTest) InputService20TestCaseOperation1Request(input *InputService20TestShapeInputService20TestCaseOperation1Input) (req *request.Request, output *InputService20TestShapeInputService20TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService20TestCaseOperation1,
- HTTPMethod: "GET",
- HTTPPath: "/{Bucket}/{Key+}",
- }
-
- if input == nil {
- input = &InputService20TestShapeInputService20TestCaseOperation1Input{}
- }
-
- output = &InputService20TestShapeInputService20TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService20TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService20TestCaseOperation1 for usage and error information.
-func (c *InputService20ProtocolTest) InputService20TestCaseOperation1(input *InputService20TestShapeInputService20TestCaseOperation1Input) (*InputService20TestShapeInputService20TestCaseOperation1Output, error) {
- req, out := c.InputService20TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService20TestCaseOperation1WithContext is the same as InputService20TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService20TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService20ProtocolTest) InputService20TestCaseOperation1WithContext(ctx aws.Context, input *InputService20TestShapeInputService20TestCaseOperation1Input, opts ...request.Option) (*InputService20TestShapeInputService20TestCaseOperation1Output, error) {
- req, out := c.InputService20TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService20TestShapeInputService20TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-
- Bucket *string `location:"uri" type:"string"`
-
- Key *string `location:"uri" type:"string"`
-}
-
-// SetBucket sets the Bucket field's value.
-func (s *InputService20TestShapeInputService20TestCaseOperation1Input) SetBucket(v string) *InputService20TestShapeInputService20TestCaseOperation1Input {
- s.Bucket = &v
- return s
-}
-
-// SetKey sets the Key field's value.
-func (s *InputService20TestShapeInputService20TestCaseOperation1Input) SetKey(v string) *InputService20TestShapeInputService20TestCaseOperation1Input {
- s.Key = &v
- return s
-}
-
-type InputService20TestShapeInputService20TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService21ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService21ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService21ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService21ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService21ProtocolTest client from just a session.
-// svc := inputservice21protocoltest.New(mySession)
-//
-// // Create a InputService21ProtocolTest client with additional configuration
-// svc := inputservice21protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService21ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService21ProtocolTest {
- c := p.ClientConfig("inputservice21protocoltest", cfgs...)
- return newInputService21ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService21ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService21ProtocolTest {
- svc := &InputService21ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService21ProtocolTest",
- ServiceID: "InputService21ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService21ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService21ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService21TestCaseOperation1 = "OperationName"
-
-// InputService21TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService21TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService21TestCaseOperation1 for more information on using the InputService21TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService21TestCaseOperation1Request method.
-// req, resp := client.InputService21TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService21ProtocolTest) InputService21TestCaseOperation1Request(input *InputService21TestShapeInputService21TestCaseOperation2Input) (req *request.Request, output *InputService21TestShapeInputService21TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService21TestCaseOperation1,
- HTTPMethod: "POST",
- HTTPPath: "/path",
- }
-
- if input == nil {
- input = &InputService21TestShapeInputService21TestCaseOperation2Input{}
- }
-
- output = &InputService21TestShapeInputService21TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService21TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService21TestCaseOperation1 for usage and error information.
-func (c *InputService21ProtocolTest) InputService21TestCaseOperation1(input *InputService21TestShapeInputService21TestCaseOperation2Input) (*InputService21TestShapeInputService21TestCaseOperation1Output, error) {
- req, out := c.InputService21TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService21TestCaseOperation1WithContext is the same as InputService21TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService21TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService21ProtocolTest) InputService21TestCaseOperation1WithContext(ctx aws.Context, input *InputService21TestShapeInputService21TestCaseOperation2Input, opts ...request.Option) (*InputService21TestShapeInputService21TestCaseOperation1Output, error) {
- req, out := c.InputService21TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opInputService21TestCaseOperation2 = "OperationName"
-
-// InputService21TestCaseOperation2Request generates a "aws/request.Request" representing the
-// client's request for the InputService21TestCaseOperation2 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService21TestCaseOperation2 for more information on using the InputService21TestCaseOperation2
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService21TestCaseOperation2Request method.
-// req, resp := client.InputService21TestCaseOperation2Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService21ProtocolTest) InputService21TestCaseOperation2Request(input *InputService21TestShapeInputService21TestCaseOperation2Input) (req *request.Request, output *InputService21TestShapeInputService21TestCaseOperation2Output) {
- op := &request.Operation{
- Name: opInputService21TestCaseOperation2,
- HTTPMethod: "POST",
- HTTPPath: "/path?abc=mno",
- }
-
- if input == nil {
- input = &InputService21TestShapeInputService21TestCaseOperation2Input{}
- }
-
- output = &InputService21TestShapeInputService21TestCaseOperation2Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService21TestCaseOperation2 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService21TestCaseOperation2 for usage and error information.
-func (c *InputService21ProtocolTest) InputService21TestCaseOperation2(input *InputService21TestShapeInputService21TestCaseOperation2Input) (*InputService21TestShapeInputService21TestCaseOperation2Output, error) {
- req, out := c.InputService21TestCaseOperation2Request(input)
- return out, req.Send()
-}
-
-// InputService21TestCaseOperation2WithContext is the same as InputService21TestCaseOperation2 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService21TestCaseOperation2 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService21ProtocolTest) InputService21TestCaseOperation2WithContext(ctx aws.Context, input *InputService21TestShapeInputService21TestCaseOperation2Input, opts ...request.Option) (*InputService21TestShapeInputService21TestCaseOperation2Output, error) {
- req, out := c.InputService21TestCaseOperation2Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService21TestShapeInputService21TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService21TestShapeInputService21TestCaseOperation2Input struct {
- _ struct{} `type:"structure"`
-
- Foo *string `location:"querystring" locationName:"param-name" type:"string"`
-}
-
-// SetFoo sets the Foo field's value.
-func (s *InputService21TestShapeInputService21TestCaseOperation2Input) SetFoo(v string) *InputService21TestShapeInputService21TestCaseOperation2Input {
- s.Foo = &v
- return s
-}
-
-type InputService21TestShapeInputService21TestCaseOperation2Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService22ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService22ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService22ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService22ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService22ProtocolTest client from just a session.
-// svc := inputservice22protocoltest.New(mySession)
-//
-// // Create a InputService22ProtocolTest client with additional configuration
-// svc := inputservice22protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService22ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService22ProtocolTest {
- c := p.ClientConfig("inputservice22protocoltest", cfgs...)
- return newInputService22ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService22ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService22ProtocolTest {
- svc := &InputService22ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService22ProtocolTest",
- ServiceID: "InputService22ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService22ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService22ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService22TestCaseOperation1 = "OperationName"
-
-// InputService22TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService22TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService22TestCaseOperation1 for more information on using the InputService22TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService22TestCaseOperation1Request method.
-// req, resp := client.InputService22TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService22ProtocolTest) InputService22TestCaseOperation1Request(input *InputService22TestShapeInputService22TestCaseOperation6Input) (req *request.Request, output *InputService22TestShapeInputService22TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService22TestCaseOperation1,
- HTTPMethod: "POST",
- HTTPPath: "/path",
- }
-
- if input == nil {
- input = &InputService22TestShapeInputService22TestCaseOperation6Input{}
- }
-
- output = &InputService22TestShapeInputService22TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService22TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService22TestCaseOperation1 for usage and error information.
-func (c *InputService22ProtocolTest) InputService22TestCaseOperation1(input *InputService22TestShapeInputService22TestCaseOperation6Input) (*InputService22TestShapeInputService22TestCaseOperation1Output, error) {
- req, out := c.InputService22TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService22TestCaseOperation1WithContext is the same as InputService22TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService22TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService22ProtocolTest) InputService22TestCaseOperation1WithContext(ctx aws.Context, input *InputService22TestShapeInputService22TestCaseOperation6Input, opts ...request.Option) (*InputService22TestShapeInputService22TestCaseOperation1Output, error) {
- req, out := c.InputService22TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opInputService22TestCaseOperation2 = "OperationName"
-
-// InputService22TestCaseOperation2Request generates a "aws/request.Request" representing the
-// client's request for the InputService22TestCaseOperation2 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService22TestCaseOperation2 for more information on using the InputService22TestCaseOperation2
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService22TestCaseOperation2Request method.
-// req, resp := client.InputService22TestCaseOperation2Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService22ProtocolTest) InputService22TestCaseOperation2Request(input *InputService22TestShapeInputService22TestCaseOperation6Input) (req *request.Request, output *InputService22TestShapeInputService22TestCaseOperation2Output) {
- op := &request.Operation{
- Name: opInputService22TestCaseOperation2,
- HTTPMethod: "POST",
- HTTPPath: "/path",
- }
-
- if input == nil {
- input = &InputService22TestShapeInputService22TestCaseOperation6Input{}
- }
-
- output = &InputService22TestShapeInputService22TestCaseOperation2Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService22TestCaseOperation2 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService22TestCaseOperation2 for usage and error information.
-func (c *InputService22ProtocolTest) InputService22TestCaseOperation2(input *InputService22TestShapeInputService22TestCaseOperation6Input) (*InputService22TestShapeInputService22TestCaseOperation2Output, error) {
- req, out := c.InputService22TestCaseOperation2Request(input)
- return out, req.Send()
-}
-
-// InputService22TestCaseOperation2WithContext is the same as InputService22TestCaseOperation2 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService22TestCaseOperation2 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService22ProtocolTest) InputService22TestCaseOperation2WithContext(ctx aws.Context, input *InputService22TestShapeInputService22TestCaseOperation6Input, opts ...request.Option) (*InputService22TestShapeInputService22TestCaseOperation2Output, error) {
- req, out := c.InputService22TestCaseOperation2Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opInputService22TestCaseOperation3 = "OperationName"
-
-// InputService22TestCaseOperation3Request generates a "aws/request.Request" representing the
-// client's request for the InputService22TestCaseOperation3 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService22TestCaseOperation3 for more information on using the InputService22TestCaseOperation3
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService22TestCaseOperation3Request method.
-// req, resp := client.InputService22TestCaseOperation3Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService22ProtocolTest) InputService22TestCaseOperation3Request(input *InputService22TestShapeInputService22TestCaseOperation6Input) (req *request.Request, output *InputService22TestShapeInputService22TestCaseOperation3Output) {
- op := &request.Operation{
- Name: opInputService22TestCaseOperation3,
- HTTPMethod: "POST",
- HTTPPath: "/path",
- }
-
- if input == nil {
- input = &InputService22TestShapeInputService22TestCaseOperation6Input{}
- }
-
- output = &InputService22TestShapeInputService22TestCaseOperation3Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService22TestCaseOperation3 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService22TestCaseOperation3 for usage and error information.
-func (c *InputService22ProtocolTest) InputService22TestCaseOperation3(input *InputService22TestShapeInputService22TestCaseOperation6Input) (*InputService22TestShapeInputService22TestCaseOperation3Output, error) {
- req, out := c.InputService22TestCaseOperation3Request(input)
- return out, req.Send()
-}
-
-// InputService22TestCaseOperation3WithContext is the same as InputService22TestCaseOperation3 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService22TestCaseOperation3 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService22ProtocolTest) InputService22TestCaseOperation3WithContext(ctx aws.Context, input *InputService22TestShapeInputService22TestCaseOperation6Input, opts ...request.Option) (*InputService22TestShapeInputService22TestCaseOperation3Output, error) {
- req, out := c.InputService22TestCaseOperation3Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opInputService22TestCaseOperation4 = "OperationName"
-
-// InputService22TestCaseOperation4Request generates a "aws/request.Request" representing the
-// client's request for the InputService22TestCaseOperation4 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService22TestCaseOperation4 for more information on using the InputService22TestCaseOperation4
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService22TestCaseOperation4Request method.
-// req, resp := client.InputService22TestCaseOperation4Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService22ProtocolTest) InputService22TestCaseOperation4Request(input *InputService22TestShapeInputService22TestCaseOperation6Input) (req *request.Request, output *InputService22TestShapeInputService22TestCaseOperation4Output) {
- op := &request.Operation{
- Name: opInputService22TestCaseOperation4,
- HTTPMethod: "POST",
- HTTPPath: "/path",
- }
-
- if input == nil {
- input = &InputService22TestShapeInputService22TestCaseOperation6Input{}
- }
-
- output = &InputService22TestShapeInputService22TestCaseOperation4Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService22TestCaseOperation4 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService22TestCaseOperation4 for usage and error information.
-func (c *InputService22ProtocolTest) InputService22TestCaseOperation4(input *InputService22TestShapeInputService22TestCaseOperation6Input) (*InputService22TestShapeInputService22TestCaseOperation4Output, error) {
- req, out := c.InputService22TestCaseOperation4Request(input)
- return out, req.Send()
-}
-
-// InputService22TestCaseOperation4WithContext is the same as InputService22TestCaseOperation4 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService22TestCaseOperation4 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService22ProtocolTest) InputService22TestCaseOperation4WithContext(ctx aws.Context, input *InputService22TestShapeInputService22TestCaseOperation6Input, opts ...request.Option) (*InputService22TestShapeInputService22TestCaseOperation4Output, error) {
- req, out := c.InputService22TestCaseOperation4Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opInputService22TestCaseOperation5 = "OperationName"
-
-// InputService22TestCaseOperation5Request generates a "aws/request.Request" representing the
-// client's request for the InputService22TestCaseOperation5 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService22TestCaseOperation5 for more information on using the InputService22TestCaseOperation5
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService22TestCaseOperation5Request method.
-// req, resp := client.InputService22TestCaseOperation5Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService22ProtocolTest) InputService22TestCaseOperation5Request(input *InputService22TestShapeInputService22TestCaseOperation6Input) (req *request.Request, output *InputService22TestShapeInputService22TestCaseOperation5Output) {
- op := &request.Operation{
- Name: opInputService22TestCaseOperation5,
- HTTPMethod: "POST",
- HTTPPath: "/path",
- }
-
- if input == nil {
- input = &InputService22TestShapeInputService22TestCaseOperation6Input{}
- }
-
- output = &InputService22TestShapeInputService22TestCaseOperation5Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService22TestCaseOperation5 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService22TestCaseOperation5 for usage and error information.
-func (c *InputService22ProtocolTest) InputService22TestCaseOperation5(input *InputService22TestShapeInputService22TestCaseOperation6Input) (*InputService22TestShapeInputService22TestCaseOperation5Output, error) {
- req, out := c.InputService22TestCaseOperation5Request(input)
- return out, req.Send()
-}
-
-// InputService22TestCaseOperation5WithContext is the same as InputService22TestCaseOperation5 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService22TestCaseOperation5 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService22ProtocolTest) InputService22TestCaseOperation5WithContext(ctx aws.Context, input *InputService22TestShapeInputService22TestCaseOperation6Input, opts ...request.Option) (*InputService22TestShapeInputService22TestCaseOperation5Output, error) {
- req, out := c.InputService22TestCaseOperation5Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opInputService22TestCaseOperation6 = "OperationName"
-
-// InputService22TestCaseOperation6Request generates a "aws/request.Request" representing the
-// client's request for the InputService22TestCaseOperation6 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService22TestCaseOperation6 for more information on using the InputService22TestCaseOperation6
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService22TestCaseOperation6Request method.
-// req, resp := client.InputService22TestCaseOperation6Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService22ProtocolTest) InputService22TestCaseOperation6Request(input *InputService22TestShapeInputService22TestCaseOperation6Input) (req *request.Request, output *InputService22TestShapeInputService22TestCaseOperation6Output) {
- op := &request.Operation{
- Name: opInputService22TestCaseOperation6,
- HTTPMethod: "POST",
- HTTPPath: "/path",
- }
-
- if input == nil {
- input = &InputService22TestShapeInputService22TestCaseOperation6Input{}
- }
-
- output = &InputService22TestShapeInputService22TestCaseOperation6Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService22TestCaseOperation6 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService22TestCaseOperation6 for usage and error information.
-func (c *InputService22ProtocolTest) InputService22TestCaseOperation6(input *InputService22TestShapeInputService22TestCaseOperation6Input) (*InputService22TestShapeInputService22TestCaseOperation6Output, error) {
- req, out := c.InputService22TestCaseOperation6Request(input)
- return out, req.Send()
-}
-
-// InputService22TestCaseOperation6WithContext is the same as InputService22TestCaseOperation6 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService22TestCaseOperation6 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService22ProtocolTest) InputService22TestCaseOperation6WithContext(ctx aws.Context, input *InputService22TestShapeInputService22TestCaseOperation6Input, opts ...request.Option) (*InputService22TestShapeInputService22TestCaseOperation6Output, error) {
- req, out := c.InputService22TestCaseOperation6Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService22TestShapeInputService22TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService22TestShapeInputService22TestCaseOperation2Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService22TestShapeInputService22TestCaseOperation3Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService22TestShapeInputService22TestCaseOperation4Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService22TestShapeInputService22TestCaseOperation5Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService22TestShapeInputService22TestCaseOperation6Input struct {
- _ struct{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"`
-
- RecursiveStruct *InputService22TestShapeRecursiveStructType `type:"structure"`
-}
-
-// SetRecursiveStruct sets the RecursiveStruct field's value.
-func (s *InputService22TestShapeInputService22TestCaseOperation6Input) SetRecursiveStruct(v *InputService22TestShapeRecursiveStructType) *InputService22TestShapeInputService22TestCaseOperation6Input {
- s.RecursiveStruct = v
- return s
-}
-
-type InputService22TestShapeInputService22TestCaseOperation6Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService22TestShapeRecursiveStructType struct {
- _ struct{} `type:"structure"`
-
- NoRecurse *string `type:"string"`
-
- RecursiveList []*InputService22TestShapeRecursiveStructType `type:"list"`
-
- RecursiveMap map[string]*InputService22TestShapeRecursiveStructType `type:"map"`
-
- RecursiveStruct *InputService22TestShapeRecursiveStructType `type:"structure"`
-}
-
-// SetNoRecurse sets the NoRecurse field's value.
-func (s *InputService22TestShapeRecursiveStructType) SetNoRecurse(v string) *InputService22TestShapeRecursiveStructType {
- s.NoRecurse = &v
- return s
-}
-
-// SetRecursiveList sets the RecursiveList field's value.
-func (s *InputService22TestShapeRecursiveStructType) SetRecursiveList(v []*InputService22TestShapeRecursiveStructType) *InputService22TestShapeRecursiveStructType {
- s.RecursiveList = v
- return s
-}
-
-// SetRecursiveMap sets the RecursiveMap field's value.
-func (s *InputService22TestShapeRecursiveStructType) SetRecursiveMap(v map[string]*InputService22TestShapeRecursiveStructType) *InputService22TestShapeRecursiveStructType {
- s.RecursiveMap = v
- return s
-}
-
-// SetRecursiveStruct sets the RecursiveStruct field's value.
-func (s *InputService22TestShapeRecursiveStructType) SetRecursiveStruct(v *InputService22TestShapeRecursiveStructType) *InputService22TestShapeRecursiveStructType {
- s.RecursiveStruct = v
- return s
-}
-
-// InputService23ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService23ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService23ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService23ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService23ProtocolTest client from just a session.
-// svc := inputservice23protocoltest.New(mySession)
-//
-// // Create a InputService23ProtocolTest client with additional configuration
-// svc := inputservice23protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService23ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService23ProtocolTest {
- c := p.ClientConfig("inputservice23protocoltest", cfgs...)
- return newInputService23ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService23ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService23ProtocolTest {
- svc := &InputService23ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService23ProtocolTest",
- ServiceID: "InputService23ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService23ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService23ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService23TestCaseOperation1 = "OperationName"
-
-// InputService23TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService23TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService23TestCaseOperation1 for more information on using the InputService23TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService23TestCaseOperation1Request method.
-// req, resp := client.InputService23TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService23ProtocolTest) InputService23TestCaseOperation1Request(input *InputService23TestShapeInputService23TestCaseOperation1Input) (req *request.Request, output *InputService23TestShapeInputService23TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService23TestCaseOperation1,
- HTTPMethod: "POST",
- HTTPPath: "/path",
- }
-
- if input == nil {
- input = &InputService23TestShapeInputService23TestCaseOperation1Input{}
- }
-
- output = &InputService23TestShapeInputService23TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService23TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService23TestCaseOperation1 for usage and error information.
-func (c *InputService23ProtocolTest) InputService23TestCaseOperation1(input *InputService23TestShapeInputService23TestCaseOperation1Input) (*InputService23TestShapeInputService23TestCaseOperation1Output, error) {
- req, out := c.InputService23TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService23TestCaseOperation1WithContext is the same as InputService23TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService23TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService23ProtocolTest) InputService23TestCaseOperation1WithContext(ctx aws.Context, input *InputService23TestShapeInputService23TestCaseOperation1Input, opts ...request.Option) (*InputService23TestShapeInputService23TestCaseOperation1Output, error) {
- req, out := c.InputService23TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService23TestShapeInputService23TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-
- TimeArgInHeader *time.Time `location:"header" locationName:"x-amz-timearg" type:"timestamp" timestampFormat:"rfc822"`
-}
-
-// SetTimeArgInHeader sets the TimeArgInHeader field's value.
-func (s *InputService23TestShapeInputService23TestCaseOperation1Input) SetTimeArgInHeader(v time.Time) *InputService23TestShapeInputService23TestCaseOperation1Input {
- s.TimeArgInHeader = &v
- return s
-}
-
-type InputService23TestShapeInputService23TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService24ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService24ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService24ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService24ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService24ProtocolTest client from just a session.
-// svc := inputservice24protocoltest.New(mySession)
-//
-// // Create a InputService24ProtocolTest client with additional configuration
-// svc := inputservice24protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService24ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService24ProtocolTest {
- c := p.ClientConfig("inputservice24protocoltest", cfgs...)
- return newInputService24ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService24ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService24ProtocolTest {
- svc := &InputService24ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService24ProtocolTest",
- ServiceID: "InputService24ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService24ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService24ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService24TestCaseOperation1 = "OperationName"
-
-// InputService24TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService24TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService24TestCaseOperation1 for more information on using the InputService24TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService24TestCaseOperation1Request method.
-// req, resp := client.InputService24TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService24ProtocolTest) InputService24TestCaseOperation1Request(input *InputService24TestShapeInputService24TestCaseOperation2Input) (req *request.Request, output *InputService24TestShapeInputService24TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService24TestCaseOperation1,
- HTTPMethod: "POST",
- HTTPPath: "/path",
- }
-
- if input == nil {
- input = &InputService24TestShapeInputService24TestCaseOperation2Input{}
- }
-
- output = &InputService24TestShapeInputService24TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService24TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService24TestCaseOperation1 for usage and error information.
-func (c *InputService24ProtocolTest) InputService24TestCaseOperation1(input *InputService24TestShapeInputService24TestCaseOperation2Input) (*InputService24TestShapeInputService24TestCaseOperation1Output, error) {
- req, out := c.InputService24TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService24TestCaseOperation1WithContext is the same as InputService24TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService24TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService24ProtocolTest) InputService24TestCaseOperation1WithContext(ctx aws.Context, input *InputService24TestShapeInputService24TestCaseOperation2Input, opts ...request.Option) (*InputService24TestShapeInputService24TestCaseOperation1Output, error) {
- req, out := c.InputService24TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opInputService24TestCaseOperation2 = "OperationName"
-
-// InputService24TestCaseOperation2Request generates a "aws/request.Request" representing the
-// client's request for the InputService24TestCaseOperation2 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService24TestCaseOperation2 for more information on using the InputService24TestCaseOperation2
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService24TestCaseOperation2Request method.
-// req, resp := client.InputService24TestCaseOperation2Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService24ProtocolTest) InputService24TestCaseOperation2Request(input *InputService24TestShapeInputService24TestCaseOperation2Input) (req *request.Request, output *InputService24TestShapeInputService24TestCaseOperation2Output) {
- op := &request.Operation{
- Name: opInputService24TestCaseOperation2,
- HTTPMethod: "POST",
- HTTPPath: "/path",
- }
-
- if input == nil {
- input = &InputService24TestShapeInputService24TestCaseOperation2Input{}
- }
-
- output = &InputService24TestShapeInputService24TestCaseOperation2Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService24TestCaseOperation2 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService24TestCaseOperation2 for usage and error information.
-func (c *InputService24ProtocolTest) InputService24TestCaseOperation2(input *InputService24TestShapeInputService24TestCaseOperation2Input) (*InputService24TestShapeInputService24TestCaseOperation2Output, error) {
- req, out := c.InputService24TestCaseOperation2Request(input)
- return out, req.Send()
-}
-
-// InputService24TestCaseOperation2WithContext is the same as InputService24TestCaseOperation2 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService24TestCaseOperation2 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService24ProtocolTest) InputService24TestCaseOperation2WithContext(ctx aws.Context, input *InputService24TestShapeInputService24TestCaseOperation2Input, opts ...request.Option) (*InputService24TestShapeInputService24TestCaseOperation2Output, error) {
- req, out := c.InputService24TestCaseOperation2Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService24TestShapeInputService24TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService24TestShapeInputService24TestCaseOperation2Input struct {
- _ struct{} `type:"structure"`
-
- Token *string `type:"string" idempotencyToken:"true"`
-}
-
-// SetToken sets the Token field's value.
-func (s *InputService24TestShapeInputService24TestCaseOperation2Input) SetToken(v string) *InputService24TestShapeInputService24TestCaseOperation2Input {
- s.Token = &v
- return s
-}
-
-type InputService24TestShapeInputService24TestCaseOperation2Output struct {
- _ struct{} `type:"structure"`
-}
-
-// InputService25ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// InputService25ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type InputService25ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the InputService25ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a InputService25ProtocolTest client from just a session.
-// svc := inputservice25protocoltest.New(mySession)
-//
-// // Create a InputService25ProtocolTest client with additional configuration
-// svc := inputservice25protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewInputService25ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService25ProtocolTest {
- c := p.ClientConfig("inputservice25protocoltest", cfgs...)
- return newInputService25ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newInputService25ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService25ProtocolTest {
- svc := &InputService25ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "InputService25ProtocolTest",
- ServiceID: "InputService25ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "2014-01-01",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a InputService25ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService25ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService25TestCaseOperation1 = "OperationName"
-
-// InputService25TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the InputService25TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService25TestCaseOperation1 for more information on using the InputService25TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService25TestCaseOperation1Request method.
-// req, resp := client.InputService25TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService25ProtocolTest) InputService25TestCaseOperation1Request(input *InputService25TestShapeInputService25TestCaseOperation2Input) (req *request.Request, output *InputService25TestShapeInputService25TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService25TestCaseOperation1,
- HTTPMethod: "POST",
- HTTPPath: "/Enum/{URIEnum}",
- }
-
- if input == nil {
- input = &InputService25TestShapeInputService25TestCaseOperation2Input{}
- }
-
- output = &InputService25TestShapeInputService25TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService25TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService25TestCaseOperation1 for usage and error information.
-func (c *InputService25ProtocolTest) InputService25TestCaseOperation1(input *InputService25TestShapeInputService25TestCaseOperation2Input) (*InputService25TestShapeInputService25TestCaseOperation1Output, error) {
- req, out := c.InputService25TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// InputService25TestCaseOperation1WithContext is the same as InputService25TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService25TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService25ProtocolTest) InputService25TestCaseOperation1WithContext(ctx aws.Context, input *InputService25TestShapeInputService25TestCaseOperation2Input, opts ...request.Option) (*InputService25TestShapeInputService25TestCaseOperation1Output, error) {
- req, out := c.InputService25TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opInputService25TestCaseOperation2 = "OperationName"
-
-// InputService25TestCaseOperation2Request generates a "aws/request.Request" representing the
-// client's request for the InputService25TestCaseOperation2 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See InputService25TestCaseOperation2 for more information on using the InputService25TestCaseOperation2
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the InputService25TestCaseOperation2Request method.
-// req, resp := client.InputService25TestCaseOperation2Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *InputService25ProtocolTest) InputService25TestCaseOperation2Request(input *InputService25TestShapeInputService25TestCaseOperation2Input) (req *request.Request, output *InputService25TestShapeInputService25TestCaseOperation2Output) {
- op := &request.Operation{
- Name: opInputService25TestCaseOperation2,
- HTTPMethod: "POST",
- HTTPPath: "/path",
- }
-
- if input == nil {
- input = &InputService25TestShapeInputService25TestCaseOperation2Input{}
- }
-
- output = &InputService25TestShapeInputService25TestCaseOperation2Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// InputService25TestCaseOperation2 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation InputService25TestCaseOperation2 for usage and error information.
-func (c *InputService25ProtocolTest) InputService25TestCaseOperation2(input *InputService25TestShapeInputService25TestCaseOperation2Input) (*InputService25TestShapeInputService25TestCaseOperation2Output, error) {
- req, out := c.InputService25TestCaseOperation2Request(input)
- return out, req.Send()
-}
-
-// InputService25TestCaseOperation2WithContext is the same as InputService25TestCaseOperation2 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See InputService25TestCaseOperation2 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *InputService25ProtocolTest) InputService25TestCaseOperation2WithContext(ctx aws.Context, input *InputService25TestShapeInputService25TestCaseOperation2Input, opts ...request.Option) (*InputService25TestShapeInputService25TestCaseOperation2Output, error) {
- req, out := c.InputService25TestCaseOperation2Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type InputService25TestShapeInputService25TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-}
-
-type InputService25TestShapeInputService25TestCaseOperation2Input struct {
- _ struct{} `type:"structure"`
-
- FooEnum *string `type:"string" enum:"InputService25TestShapeEnumType"`
-
- HeaderEnum *string `location:"header" locationName:"x-amz-enum" type:"string" enum:"InputService25TestShapeEnumType"`
-
- ListEnums []*string `type:"list"`
-
- URIFooEnum *string `location:"uri" locationName:"URIEnum" type:"string" enum:"InputService25TestShapeEnumType"`
-
- URIListEnums []*string `location:"querystring" locationName:"ListEnums" type:"list"`
-}
-
-// SetFooEnum sets the FooEnum field's value.
-func (s *InputService25TestShapeInputService25TestCaseOperation2Input) SetFooEnum(v string) *InputService25TestShapeInputService25TestCaseOperation2Input {
- s.FooEnum = &v
- return s
-}
-
-// SetHeaderEnum sets the HeaderEnum field's value.
-func (s *InputService25TestShapeInputService25TestCaseOperation2Input) SetHeaderEnum(v string) *InputService25TestShapeInputService25TestCaseOperation2Input {
- s.HeaderEnum = &v
- return s
-}
-
-// SetListEnums sets the ListEnums field's value.
-func (s *InputService25TestShapeInputService25TestCaseOperation2Input) SetListEnums(v []*string) *InputService25TestShapeInputService25TestCaseOperation2Input {
- s.ListEnums = v
- return s
-}
-
-// SetURIFooEnum sets the URIFooEnum field's value.
-func (s *InputService25TestShapeInputService25TestCaseOperation2Input) SetURIFooEnum(v string) *InputService25TestShapeInputService25TestCaseOperation2Input {
- s.URIFooEnum = &v
- return s
-}
-
-// SetURIListEnums sets the URIListEnums field's value.
-func (s *InputService25TestShapeInputService25TestCaseOperation2Input) SetURIListEnums(v []*string) *InputService25TestShapeInputService25TestCaseOperation2Input {
- s.URIListEnums = v
- return s
-}
-
-type InputService25TestShapeInputService25TestCaseOperation2Output struct {
- _ struct{} `type:"structure"`
-}
-
-const (
- // EnumTypeFoo is a InputService25TestShapeEnumType enum value
- EnumTypeFoo = "foo"
-
- // EnumTypeBar is a InputService25TestShapeEnumType enum value
- EnumTypeBar = "bar"
-
- // EnumType0 is a InputService25TestShapeEnumType enum value
- EnumType0 = "0"
-
- // EnumType1 is a InputService25TestShapeEnumType enum value
- EnumType1 = "1"
-)
-
-//
-// Tests begin here
-//
-
-func TestInputService1ProtocolTestBasicXMLSerializationCase1(t *testing.T) {
- svc := NewInputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService1TestShapeInputService1TestCaseOperation2Input{
- Description: aws.String("bar"),
- Name: aws.String("foo"),
- }
- req, _ := svc.InputService1TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body := util.SortXML(r.Body)
- awstesting.AssertXML(t, `<OperationRequest xmlns="https://foo/"><Description xmlns="https://foo/">bar</Description><Name xmlns="https://foo/">foo</Name></OperationRequest>`, util.Trim(string(body)), InputService1TestShapeInputService1TestCaseOperation2Input{})
-
- // assert URL
- awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService1ProtocolTestBasicXMLSerializationCase2(t *testing.T) {
- svc := NewInputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService1TestShapeInputService1TestCaseOperation2Input{
- Description: aws.String("bar"),
- Name: aws.String("foo"),
- }
- req, _ := svc.InputService1TestCaseOperation2Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body := util.SortXML(r.Body)
- awstesting.AssertXML(t, `<OperationRequest xmlns="https://foo/"><Description xmlns="https://foo/">bar</Description><Name xmlns="https://foo/">foo</Name></OperationRequest>`, util.Trim(string(body)), InputService1TestShapeInputService1TestCaseOperation2Input{})
-
- // assert URL
- awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService1ProtocolTestBasicXMLSerializationCase3(t *testing.T) {
- svc := NewInputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService1TestShapeInputService1TestCaseOperation3Input{}
- req, _ := svc.InputService1TestCaseOperation3Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert URL
- awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService2ProtocolTestSerializeOtherScalarTypesCase1(t *testing.T) {
- svc := NewInputService2ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService2TestShapeInputService2TestCaseOperation1Input{
- First: aws.Bool(true),
- Fourth: aws.Int64(3),
- Second: aws.Bool(false),
- Third: aws.Float64(1.2),
- }
- req, _ := svc.InputService2TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body := util.SortXML(r.Body)
- awstesting.AssertXML(t, `<OperationRequest xmlns="https://foo/"><First xmlns="https://foo/">true</First><Fourth xmlns="https://foo/">3</Fourth><Second xmlns="https://foo/">false</Second><Third xmlns="https://foo/">1.2</Third></OperationRequest>`, util.Trim(string(body)), InputService2TestShapeInputService2TestCaseOperation1Input{})
-
- // assert URL
- awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService3ProtocolTestNestedStructuresCase1(t *testing.T) {
- svc := NewInputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService3TestShapeInputService3TestCaseOperation2Input{
- Description: aws.String("baz"),
- SubStructure: &InputService3TestShapeSubStructure{
- Bar: aws.String("b"),
- Foo: aws.String("a"),
- },
- }
- req, _ := svc.InputService3TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body := util.SortXML(r.Body)
- awstesting.AssertXML(t, `<OperationRequest xmlns="https://foo/"><Description xmlns="https://foo/">baz</Description><SubStructure xmlns="https://foo/"><Bar xmlns="https://foo/">b</Bar><Foo xmlns="https://foo/">a</Foo></SubStructure></OperationRequest>`, util.Trim(string(body)), InputService3TestShapeInputService3TestCaseOperation2Input{})
-
- // assert URL
- awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService3ProtocolTestNestedStructuresCase2(t *testing.T) {
- svc := NewInputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService3TestShapeInputService3TestCaseOperation2Input{
- Description: aws.String("baz"),
- SubStructure: &InputService3TestShapeSubStructure{
- Foo: aws.String("a"),
- },
- }
- req, _ := svc.InputService3TestCaseOperation2Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body := util.SortXML(r.Body)
- awstesting.AssertXML(t, `<OperationRequest xmlns="https://foo/"><Description xmlns="https://foo/">baz</Description><SubStructure xmlns="https://foo/"><Foo xmlns="https://foo/">a</Foo></SubStructure></OperationRequest>`, util.Trim(string(body)), InputService3TestShapeInputService3TestCaseOperation2Input{})
-
- // assert URL
- awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService4ProtocolTestNestedStructuresCase1(t *testing.T) {
- svc := NewInputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService4TestShapeInputService4TestCaseOperation1Input{
- Description: aws.String("baz"),
- SubStructure: &InputService4TestShapeSubStructure{},
- }
- req, _ := svc.InputService4TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body := util.SortXML(r.Body)
- awstesting.AssertXML(t, `<OperationRequest xmlns="https://foo/"><Description xmlns="https://foo/">baz</Description><SubStructure xmlns="https://foo/"></SubStructure></OperationRequest>`, util.Trim(string(body)), InputService4TestShapeInputService4TestCaseOperation1Input{})
-
- // assert URL
- awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService5ProtocolTestNonFlattenedListsCase1(t *testing.T) {
- svc := NewInputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService5TestShapeInputService5TestCaseOperation1Input{
- ListParam: []*string{
- aws.String("one"),
- aws.String("two"),
- aws.String("three"),
- },
- }
- req, _ := svc.InputService5TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body := util.SortXML(r.Body)
- awstesting.AssertXML(t, `<OperationRequest xmlns="https://foo/"><ListParam xmlns="https://foo/"><member xmlns="https://foo/">one</member><member xmlns="https://foo/">two</member><member xmlns="https://foo/">three</member></ListParam></OperationRequest>`, util.Trim(string(body)), InputService5TestShapeInputService5TestCaseOperation1Input{})
-
- // assert URL
- awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService6ProtocolTestNonFlattenedListsWithLocationNameCase1(t *testing.T) {
- svc := NewInputService6ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService6TestShapeInputService6TestCaseOperation1Input{
- ListParam: []*string{
- aws.String("one"),
- aws.String("two"),
- aws.String("three"),
- },
- }
- req, _ := svc.InputService6TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body := util.SortXML(r.Body)
- awstesting.AssertXML(t, `<OperationRequest xmlns="https://foo/"><AlternateName xmlns="https://foo/"><NotMember xmlns="https://foo/">one</NotMember><NotMember xmlns="https://foo/">two</NotMember><NotMember xmlns="https://foo/">three</NotMember></AlternateName></OperationRequest>`, util.Trim(string(body)), InputService6TestShapeInputService6TestCaseOperation1Input{})
-
- // assert URL
- awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService7ProtocolTestFlattenedListsCase1(t *testing.T) {
- svc := NewInputService7ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService7TestShapeInputService7TestCaseOperation1Input{
- ListParam: []*string{
- aws.String("one"),
- aws.String("two"),
- aws.String("three"),
- },
- }
- req, _ := svc.InputService7TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body := util.SortXML(r.Body)
- awstesting.AssertXML(t, `<OperationRequest xmlns="https://foo/"><ListParam xmlns="https://foo/">one</ListParam><ListParam xmlns="https://foo/">two</ListParam><ListParam xmlns="https://foo/">three</ListParam></OperationRequest>`, util.Trim(string(body)), InputService7TestShapeInputService7TestCaseOperation1Input{})
-
- // assert URL
- awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService8ProtocolTestFlattenedListsWithLocationNameCase1(t *testing.T) {
- svc := NewInputService8ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService8TestShapeInputService8TestCaseOperation1Input{
- ListParam: []*string{
- aws.String("one"),
- aws.String("two"),
- aws.String("three"),
- },
- }
- req, _ := svc.InputService8TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body := util.SortXML(r.Body)
- awstesting.AssertXML(t, `<OperationRequest xmlns="https://foo/"><item xmlns="https://foo/">one</item><item xmlns="https://foo/">two</item><item xmlns="https://foo/">three</item></OperationRequest>`, util.Trim(string(body)), InputService8TestShapeInputService8TestCaseOperation1Input{})
-
- // assert URL
- awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService9ProtocolTestListOfStructuresCase1(t *testing.T) {
- svc := NewInputService9ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService9TestShapeInputService9TestCaseOperation1Input{
- ListParam: []*InputService9TestShapeSingleFieldStruct{
- {
- Element: aws.String("one"),
- },
- {
- Element: aws.String("two"),
- },
- {
- Element: aws.String("three"),
- },
- },
- }
- req, _ := svc.InputService9TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body := util.SortXML(r.Body)
- awstesting.AssertXML(t, `<OperationRequest xmlns="https://foo/"><item xmlns="https://foo/"><value xmlns="https://foo/">one</value></item><item xmlns="https://foo/"><value xmlns="https://foo/">two</value></item><item xmlns="https://foo/"><value xmlns="https://foo/">three</value></item></OperationRequest>`, util.Trim(string(body)), InputService9TestShapeInputService9TestCaseOperation1Input{})
-
- // assert URL
- awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService10ProtocolTestBlobAndTimestampShapesCase1(t *testing.T) {
- svc := NewInputService10ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService10TestShapeInputService10TestCaseOperation1Input{
- StructureParam: &InputService10TestShapeStructureShape{
- B: []byte("foo"),
- T: aws.Time(time.Unix(1422172800, 0)),
- },
- }
- req, _ := svc.InputService10TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body := util.SortXML(r.Body)
- awstesting.AssertXML(t, `<OperationRequest xmlns="https://foo/"><StructureParam xmlns="https://foo/"><b xmlns="https://foo/">Zm9v</b><t xmlns="https://foo/">2015-01-25T08:00:00Z</t></StructureParam></OperationRequest>`, util.Trim(string(body)), InputService10TestShapeInputService10TestCaseOperation1Input{})
-
- // assert URL
- awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService11ProtocolTestHeaderMapsCase1(t *testing.T) {
- svc := NewInputService11ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService11TestShapeInputService11TestCaseOperation1Input{
- Foo: map[string]*string{
- "a": aws.String("b"),
- "c": aws.String("d"),
- },
- }
- req, _ := svc.InputService11TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
- if e, a := "b", r.Header.Get("x-foo-a"); e != a {
- t.Errorf("expect %v to be %v", e, a)
- }
- if e, a := "d", r.Header.Get("x-foo-c"); e != a {
- t.Errorf("expect %v to be %v", e, a)
- }
-
-}
-
-func TestInputService12ProtocolTestQuerystringListOfStringsCase1(t *testing.T) {
- svc := NewInputService12ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService12TestShapeInputService12TestCaseOperation1Input{
- Items: []*string{
- aws.String("value1"),
- aws.String("value2"),
- },
- }
- req, _ := svc.InputService12TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert URL
- awstesting.AssertURL(t, "https://test/path?item=value1&item=value2", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService13ProtocolTestStringToStringMapsInQuerystringCase1(t *testing.T) {
- svc := NewInputService13ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService13TestShapeInputService13TestCaseOperation1Input{
- PipelineId: aws.String("foo"),
- QueryDoc: map[string]*string{
- "bar": aws.String("baz"),
- "fizz": aws.String("buzz"),
- },
- }
- req, _ := svc.InputService13TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert URL
- awstesting.AssertURL(t, "https://test/2014-01-01/jobsByPipeline/foo?bar=baz&fizz=buzz", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService14ProtocolTestStringToStringListMapsInQuerystringCase1(t *testing.T) {
- svc := NewInputService14ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService14TestShapeInputService14TestCaseOperation1Input{
- PipelineId: aws.String("id"),
- QueryDoc: map[string][]*string{
- "fizz": {
- aws.String("buzz"),
- aws.String("pop"),
- },
- "foo": {
- aws.String("bar"),
- aws.String("baz"),
- },
- },
- }
- req, _ := svc.InputService14TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert URL
- awstesting.AssertURL(t, "https://test/2014-01-01/jobsByPipeline/id?foo=bar&foo=baz&fizz=buzz&fizz=pop", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService15ProtocolTestBooleanInQuerystringCase1(t *testing.T) {
- svc := NewInputService15ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService15TestShapeInputService15TestCaseOperation2Input{
- BoolQuery: aws.Bool(true),
- }
- req, _ := svc.InputService15TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert URL
- awstesting.AssertURL(t, "https://test/path?bool-query=true", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService15ProtocolTestBooleanInQuerystringCase2(t *testing.T) {
- svc := NewInputService15ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService15TestShapeInputService15TestCaseOperation2Input{
- BoolQuery: aws.Bool(false),
- }
- req, _ := svc.InputService15TestCaseOperation2Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert URL
- awstesting.AssertURL(t, "https://test/path?bool-query=false", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService16ProtocolTestStringPayloadCase1(t *testing.T) {
- svc := NewInputService16ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService16TestShapeInputService16TestCaseOperation1Input{
- Foo: aws.String("bar"),
- }
- req, _ := svc.InputService16TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body := util.SortXML(r.Body)
- if e, a := "bar", util.Trim(string(body)); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService17ProtocolTestBlobPayloadCase1(t *testing.T) {
- svc := NewInputService17ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService17TestShapeInputService17TestCaseOperation2Input{
- Foo: []byte("bar"),
- }
- req, _ := svc.InputService17TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body := util.SortXML(r.Body)
- if e, a := "bar", util.Trim(string(body)); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService17ProtocolTestBlobPayloadCase2(t *testing.T) {
- svc := NewInputService17ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService17TestShapeInputService17TestCaseOperation2Input{}
- req, _ := svc.InputService17TestCaseOperation2Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService18ProtocolTestStructurePayloadCase1(t *testing.T) {
- svc := NewInputService18ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService18TestShapeInputService18TestCaseOperation4Input{
- Foo: &InputService18TestShapeFooShape{
- Baz: aws.String("bar"),
- },
- }
- req, _ := svc.InputService18TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body := util.SortXML(r.Body)
- awstesting.AssertXML(t, `<foo><baz>bar</baz></foo>`, util.Trim(string(body)), InputService18TestShapeInputService18TestCaseOperation4Input{})
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService18ProtocolTestStructurePayloadCase2(t *testing.T) {
- svc := NewInputService18ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService18TestShapeInputService18TestCaseOperation4Input{}
- req, _ := svc.InputService18TestCaseOperation2Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService18ProtocolTestStructurePayloadCase3(t *testing.T) {
- svc := NewInputService18ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService18TestShapeInputService18TestCaseOperation4Input{
- Foo: &InputService18TestShapeFooShape{},
- }
- req, _ := svc.InputService18TestCaseOperation3Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body := util.SortXML(r.Body)
- awstesting.AssertXML(t, `<foo></foo>`, util.Trim(string(body)), InputService18TestShapeInputService18TestCaseOperation4Input{})
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService18ProtocolTestStructurePayloadCase4(t *testing.T) {
- svc := NewInputService18ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService18TestShapeInputService18TestCaseOperation4Input{}
- req, _ := svc.InputService18TestCaseOperation4Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService19ProtocolTestXMLAttributeCase1(t *testing.T) {
- svc := NewInputService19ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService19TestShapeInputService19TestCaseOperation1Input{
- Grant: &InputService19TestShapeGrant{
- Grantee: &InputService19TestShapeGrantee{
- EmailAddress: aws.String("foo@example.com"),
- Type: aws.String("CanonicalUser"),
- },
- },
- }
- req, _ := svc.InputService19TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body := util.SortXML(r.Body)
- awstesting.AssertXML(t, `<Grant xmlns:_xmlns="xmlns" _xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:XMLSchema-instance="http://www.w3.org/2001/XMLSchema-instance" XMLSchema-instance:type="CanonicalUser"><Grantee><EmailAddress>foo@example.com</EmailAddress></Grantee></Grant>`, util.Trim(string(body)), InputService19TestShapeInputService19TestCaseOperation1Input{})
-
- // assert URL
- awstesting.AssertURL(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService20ProtocolTestGreedyKeysCase1(t *testing.T) {
- svc := NewInputService20ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService20TestShapeInputService20TestCaseOperation1Input{
- Bucket: aws.String("my/bucket"),
- Key: aws.String("testing /123"),
- }
- req, _ := svc.InputService20TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert URL
- awstesting.AssertURL(t, "https://test/my%2Fbucket/testing%20/123", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService21ProtocolTestOmitsNullQueryParamsButSerializesEmptyStringsCase1(t *testing.T) {
- svc := NewInputService21ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService21TestShapeInputService21TestCaseOperation2Input{}
- req, _ := svc.InputService21TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert URL
- awstesting.AssertURL(t, "https://test/path", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService21ProtocolTestOmitsNullQueryParamsButSerializesEmptyStringsCase2(t *testing.T) {
- svc := NewInputService21ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService21TestShapeInputService21TestCaseOperation2Input{
- Foo: aws.String(""),
- }
- req, _ := svc.InputService21TestCaseOperation2Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert URL
- awstesting.AssertURL(t, "https://test/path?abc=mno&param-name=", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService22ProtocolTestRecursiveShapesCase1(t *testing.T) {
- svc := NewInputService22ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService22TestShapeInputService22TestCaseOperation6Input{
- RecursiveStruct: &InputService22TestShapeRecursiveStructType{
- NoRecurse: aws.String("foo"),
- },
- }
- req, _ := svc.InputService22TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body := util.SortXML(r.Body)
- awstesting.AssertXML(t, `<OperationRequest xmlns="https://foo/"><RecursiveStruct xmlns="https://foo/"><NoRecurse xmlns="https://foo/">foo</NoRecurse></RecursiveStruct></OperationRequest>`, util.Trim(string(body)), InputService22TestShapeInputService22TestCaseOperation6Input{})
-
- // assert URL
- awstesting.AssertURL(t, "https://test/path", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService22ProtocolTestRecursiveShapesCase2(t *testing.T) {
- svc := NewInputService22ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService22TestShapeInputService22TestCaseOperation6Input{
- RecursiveStruct: &InputService22TestShapeRecursiveStructType{
- RecursiveStruct: &InputService22TestShapeRecursiveStructType{
- NoRecurse: aws.String("foo"),
- },
- },
- }
- req, _ := svc.InputService22TestCaseOperation2Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body := util.SortXML(r.Body)
- awstesting.AssertXML(t, `<OperationRequest xmlns="https://foo/"><RecursiveStruct xmlns="https://foo/"><RecursiveStruct xmlns="https://foo/"><NoRecurse xmlns="https://foo/">foo</NoRecurse></RecursiveStruct></RecursiveStruct></OperationRequest>`, util.Trim(string(body)), InputService22TestShapeInputService22TestCaseOperation6Input{})
-
- // assert URL
- awstesting.AssertURL(t, "https://test/path", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService22ProtocolTestRecursiveShapesCase3(t *testing.T) {
- svc := NewInputService22ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService22TestShapeInputService22TestCaseOperation6Input{
- RecursiveStruct: &InputService22TestShapeRecursiveStructType{
- RecursiveStruct: &InputService22TestShapeRecursiveStructType{
- RecursiveStruct: &InputService22TestShapeRecursiveStructType{
- RecursiveStruct: &InputService22TestShapeRecursiveStructType{
- NoRecurse: aws.String("foo"),
- },
- },
- },
- },
- }
- req, _ := svc.InputService22TestCaseOperation3Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body := util.SortXML(r.Body)
- awstesting.AssertXML(t, `<OperationRequest xmlns="https://foo/"><RecursiveStruct xmlns="https://foo/"><RecursiveStruct xmlns="https://foo/"><RecursiveStruct xmlns="https://foo/"><RecursiveStruct xmlns="https://foo/"><NoRecurse xmlns="https://foo/">foo</NoRecurse></RecursiveStruct></RecursiveStruct></RecursiveStruct></RecursiveStruct></OperationRequest>`, util.Trim(string(body)), InputService22TestShapeInputService22TestCaseOperation6Input{})
-
- // assert URL
- awstesting.AssertURL(t, "https://test/path", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService22ProtocolTestRecursiveShapesCase4(t *testing.T) {
- svc := NewInputService22ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService22TestShapeInputService22TestCaseOperation6Input{
- RecursiveStruct: &InputService22TestShapeRecursiveStructType{
- RecursiveList: []*InputService22TestShapeRecursiveStructType{
- {
- NoRecurse: aws.String("foo"),
- },
- {
- NoRecurse: aws.String("bar"),
- },
- },
- },
- }
- req, _ := svc.InputService22TestCaseOperation4Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body := util.SortXML(r.Body)
- awstesting.AssertXML(t, `<OperationRequest xmlns="https://foo/"><RecursiveStruct xmlns="https://foo/"><RecursiveList xmlns="https://foo/"><member xmlns="https://foo/"><NoRecurse xmlns="https://foo/">foo</NoRecurse></member><member xmlns="https://foo/"><NoRecurse xmlns="https://foo/">bar</NoRecurse></member></RecursiveList></RecursiveStruct></OperationRequest>`, util.Trim(string(body)), InputService22TestShapeInputService22TestCaseOperation6Input{})
-
- // assert URL
- awstesting.AssertURL(t, "https://test/path", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService22ProtocolTestRecursiveShapesCase5(t *testing.T) {
- svc := NewInputService22ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService22TestShapeInputService22TestCaseOperation6Input{
- RecursiveStruct: &InputService22TestShapeRecursiveStructType{
- RecursiveList: []*InputService22TestShapeRecursiveStructType{
- {
- NoRecurse: aws.String("foo"),
- },
- {
- RecursiveStruct: &InputService22TestShapeRecursiveStructType{
- NoRecurse: aws.String("bar"),
- },
- },
- },
- },
- }
- req, _ := svc.InputService22TestCaseOperation5Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body := util.SortXML(r.Body)
- awstesting.AssertXML(t, `<OperationRequest xmlns="https://foo/"><RecursiveStruct xmlns="https://foo/"><RecursiveList xmlns="https://foo/"><member xmlns="https://foo/"><NoRecurse xmlns="https://foo/">foo</NoRecurse></member><member xmlns="https://foo/"><RecursiveStruct xmlns="https://foo/"><NoRecurse xmlns="https://foo/">bar</NoRecurse></RecursiveStruct></member></RecursiveList></RecursiveStruct></OperationRequest>`, util.Trim(string(body)), InputService22TestShapeInputService22TestCaseOperation6Input{})
-
- // assert URL
- awstesting.AssertURL(t, "https://test/path", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService22ProtocolTestRecursiveShapesCase6(t *testing.T) {
- svc := NewInputService22ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService22TestShapeInputService22TestCaseOperation6Input{
- RecursiveStruct: &InputService22TestShapeRecursiveStructType{
- RecursiveMap: map[string]*InputService22TestShapeRecursiveStructType{
- "bar": {
- NoRecurse: aws.String("bar"),
- },
- "foo": {
- NoRecurse: aws.String("foo"),
- },
- },
- },
- }
- req, _ := svc.InputService22TestCaseOperation6Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body := util.SortXML(r.Body)
- awstesting.AssertXML(t, `<OperationRequest xmlns="https://foo/"><RecursiveStruct xmlns="https://foo/"><RecursiveMap xmlns="https://foo/"><entry xmlns="https://foo/"><key xmlns="https://foo/">foo</key><value xmlns="https://foo/"><NoRecurse xmlns="https://foo/">foo</NoRecurse></value></entry><entry xmlns="https://foo/"><key xmlns="https://foo/">bar</key><value xmlns="https://foo/"><NoRecurse xmlns="https://foo/">bar</NoRecurse></value></entry></RecursiveMap></RecursiveStruct></OperationRequest>`, util.Trim(string(body)), InputService22TestShapeInputService22TestCaseOperation6Input{})
-
- // assert URL
- awstesting.AssertURL(t, "https://test/path", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService23ProtocolTestTimestampInHeaderCase1(t *testing.T) {
- svc := NewInputService23ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService23TestShapeInputService23TestCaseOperation1Input{
- TimeArgInHeader: aws.Time(time.Unix(1422172800, 0)),
- }
- req, _ := svc.InputService23TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert URL
- awstesting.AssertURL(t, "https://test/path", r.URL.String())
-
- // assert headers
- if e, a := "Sun, 25 Jan 2015 08:00:00 GMT", r.Header.Get("x-amz-timearg"); e != a {
- t.Errorf("expect %v to be %v", e, a)
- }
-
-}
-
-func TestInputService24ProtocolTestIdempotencyTokenAutoFillCase1(t *testing.T) {
- svc := NewInputService24ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService24TestShapeInputService24TestCaseOperation2Input{
- Token: aws.String("abc123"),
- }
- req, _ := svc.InputService24TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body := util.SortXML(r.Body)
- awstesting.AssertXML(t, `<InputShape><Token>abc123</Token></InputShape>`, util.Trim(string(body)), InputService24TestShapeInputService24TestCaseOperation2Input{})
-
- // assert URL
- awstesting.AssertURL(t, "https://test/path", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService24ProtocolTestIdempotencyTokenAutoFillCase2(t *testing.T) {
- svc := NewInputService24ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService24TestShapeInputService24TestCaseOperation2Input{}
- req, _ := svc.InputService24TestCaseOperation2Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body := util.SortXML(r.Body)
- awstesting.AssertXML(t, `<InputShape><Token>00000000-0000-4000-8000-000000000000</Token></InputShape>`, util.Trim(string(body)), InputService24TestShapeInputService24TestCaseOperation2Input{})
-
- // assert URL
- awstesting.AssertURL(t, "https://test/path", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService25ProtocolTestEnumCase1(t *testing.T) {
- svc := NewInputService25ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService25TestShapeInputService25TestCaseOperation2Input{
- FooEnum: aws.String("foo"),
- HeaderEnum: aws.String("baz"),
- ListEnums: []*string{
- aws.String("foo"),
- aws.String(""),
- aws.String("bar"),
- },
- URIFooEnum: aws.String("bar"),
- URIListEnums: []*string{
- aws.String("0"),
- aws.String(""),
- aws.String("1"),
- },
- }
- req, _ := svc.InputService25TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert body
- if r.Body == nil {
- t.Errorf("expect body not to be nil")
- }
- body := util.SortXML(r.Body)
- awstesting.AssertXML(t, `<InputShape><FooEnum>foo</FooEnum><ListEnums><member>foo</member><member></member><member>bar</member></ListEnums></InputShape>`, util.Trim(string(body)), InputService25TestShapeInputService25TestCaseOperation2Input{})
-
- // assert URL
- awstesting.AssertURL(t, "https://test/Enum/bar?ListEnums=0&ListEnums=&ListEnums=1", r.URL.String())
-
- // assert headers
- if e, a := "baz", r.Header.Get("x-amz-enum"); e != a {
- t.Errorf("expect %v to be %v", e, a)
- }
-
-}
-
-func TestInputService25ProtocolTestEnumCase2(t *testing.T) {
- svc := NewInputService25ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
- input := &InputService25TestShapeInputService25TestCaseOperation2Input{}
- req, _ := svc.InputService25TestCaseOperation2Request(input)
- r := req.HTTPRequest
-
- // build request
- restxml.Build(req)
- if req.Error != nil {
- t.Errorf("expect no error, got %v", req.Error)
- }
-
- // assert URL
- awstesting.AssertURL(t, "https://test/path", r.URL.String())
-
- // assert headers
-
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/unmarshal_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/unmarshal_test.go
deleted file mode 100644
index 1b9f9c5bb..000000000
--- a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/unmarshal_test.go
+++ /dev/null
@@ -1,3145 +0,0 @@
-package restxml_test
-
-import (
- "bytes"
- "encoding/json"
- "encoding/xml"
- "fmt"
- "io"
- "io/ioutil"
- "net/http"
- "net/url"
- "reflect"
- "testing"
- "time"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/client"
- "github.com/aws/aws-sdk-go/aws/client/metadata"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/aws/signer/v4"
- "github.com/aws/aws-sdk-go/awstesting"
- "github.com/aws/aws-sdk-go/awstesting/unit"
- "github.com/aws/aws-sdk-go/private/protocol"
- "github.com/aws/aws-sdk-go/private/protocol/restxml"
- "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil"
- "github.com/aws/aws-sdk-go/private/util"
-)
-
-var _ bytes.Buffer // always import bytes
-var _ http.Request
-var _ json.Marshaler
-var _ time.Time
-var _ xmlutil.XMLNode
-var _ xml.Attr
-var _ = ioutil.Discard
-var _ = util.Trim("")
-var _ = url.Values{}
-var _ = io.EOF
-var _ = aws.String
-var _ = fmt.Println
-var _ = reflect.Value{}
-
-func init() {
- protocol.RandReader = &awstesting.ZeroReader{}
-}
-
-// OutputService1ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService1ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService1ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService1ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService1ProtocolTest client from just a session.
-// svc := outputservice1protocoltest.New(mySession)
-//
-// // Create a OutputService1ProtocolTest client with additional configuration
-// svc := outputservice1protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService1ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService1ProtocolTest {
- c := p.ClientConfig("outputservice1protocoltest", cfgs...)
- return newOutputService1ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService1ProtocolTest {
- svc := &OutputService1ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService1ProtocolTest",
- ServiceID: "OutputService1ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService1ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService1TestCaseOperation1 = "OperationName"
-
-// OutputService1TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService1TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService1TestCaseOperation1 for more information on using the OutputService1TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService1TestCaseOperation1Request method.
-// req, resp := client.OutputService1TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1Request(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (req *request.Request, output *OutputService1TestShapeOutputService1TestCaseOperation3Output) {
- op := &request.Operation{
- Name: opOutputService1TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService1TestShapeOutputService1TestCaseOperation1Input{}
- }
-
- output = &OutputService1TestShapeOutputService1TestCaseOperation3Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService1TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService1TestCaseOperation1 for usage and error information.
-func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (*OutputService1TestShapeOutputService1TestCaseOperation3Output, error) {
- req, out := c.OutputService1TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService1TestCaseOperation1WithContext is the same as OutputService1TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService1TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1WithContext(ctx aws.Context, input *OutputService1TestShapeOutputService1TestCaseOperation1Input, opts ...request.Option) (*OutputService1TestShapeOutputService1TestCaseOperation3Output, error) {
- req, out := c.OutputService1TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opOutputService1TestCaseOperation2 = "OperationName"
-
-// OutputService1TestCaseOperation2Request generates a "aws/request.Request" representing the
-// client's request for the OutputService1TestCaseOperation2 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService1TestCaseOperation2 for more information on using the OutputService1TestCaseOperation2
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService1TestCaseOperation2Request method.
-// req, resp := client.OutputService1TestCaseOperation2Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation2Request(input *OutputService1TestShapeOutputService1TestCaseOperation2Input) (req *request.Request, output *OutputService1TestShapeOutputService1TestCaseOperation3Output) {
- op := &request.Operation{
- Name: opOutputService1TestCaseOperation2,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService1TestShapeOutputService1TestCaseOperation2Input{}
- }
-
- output = &OutputService1TestShapeOutputService1TestCaseOperation3Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService1TestCaseOperation2 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService1TestCaseOperation2 for usage and error information.
-func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation2(input *OutputService1TestShapeOutputService1TestCaseOperation2Input) (*OutputService1TestShapeOutputService1TestCaseOperation3Output, error) {
- req, out := c.OutputService1TestCaseOperation2Request(input)
- return out, req.Send()
-}
-
-// OutputService1TestCaseOperation2WithContext is the same as OutputService1TestCaseOperation2 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService1TestCaseOperation2 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation2WithContext(ctx aws.Context, input *OutputService1TestShapeOutputService1TestCaseOperation2Input, opts ...request.Option) (*OutputService1TestShapeOutputService1TestCaseOperation3Output, error) {
- req, out := c.OutputService1TestCaseOperation2Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opOutputService1TestCaseOperation3 = "OperationName"
-
-// OutputService1TestCaseOperation3Request generates a "aws/request.Request" representing the
-// client's request for the OutputService1TestCaseOperation3 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService1TestCaseOperation3 for more information on using the OutputService1TestCaseOperation3
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService1TestCaseOperation3Request method.
-// req, resp := client.OutputService1TestCaseOperation3Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation3Request(input *OutputService1TestShapeOutputService1TestCaseOperation3Input) (req *request.Request, output *OutputService1TestShapeOutputService1TestCaseOperation3Output) {
- op := &request.Operation{
- Name: opOutputService1TestCaseOperation3,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService1TestShapeOutputService1TestCaseOperation3Input{}
- }
-
- output = &OutputService1TestShapeOutputService1TestCaseOperation3Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService1TestCaseOperation3 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService1TestCaseOperation3 for usage and error information.
-func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation3(input *OutputService1TestShapeOutputService1TestCaseOperation3Input) (*OutputService1TestShapeOutputService1TestCaseOperation3Output, error) {
- req, out := c.OutputService1TestCaseOperation3Request(input)
- return out, req.Send()
-}
-
-// OutputService1TestCaseOperation3WithContext is the same as OutputService1TestCaseOperation3 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService1TestCaseOperation3 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation3WithContext(ctx aws.Context, input *OutputService1TestShapeOutputService1TestCaseOperation3Input, opts ...request.Option) (*OutputService1TestShapeOutputService1TestCaseOperation3Output, error) {
- req, out := c.OutputService1TestCaseOperation3Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService1TestShapeOutputService1TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService1TestShapeOutputService1TestCaseOperation2Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService1TestShapeOutputService1TestCaseOperation3Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService1TestShapeOutputService1TestCaseOperation3Output struct {
- _ struct{} `type:"structure"`
-
- Blobs [][]byte `type:"list"`
-
- Char *string `type:"character"`
-
- Double *float64 `type:"double"`
-
- FalseBool *bool `type:"boolean"`
-
- Float *float64 `type:"float"`
-
- ImaHeader *string `location:"header" type:"string"`
-
- ImaHeaderLocation *string `location:"header" locationName:"X-Foo" type:"string"`
-
- Long *int64 `type:"long"`
-
- Num *int64 `locationName:"FooNum" type:"integer"`
-
- Str *string `type:"string"`
-
- Timestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"`
-
- Timestamps []*time.Time `type:"list"`
-
- TrueBool *bool `type:"boolean"`
-}
-
-// SetBlobs sets the Blobs field's value.
-func (s *OutputService1TestShapeOutputService1TestCaseOperation3Output) SetBlobs(v [][]byte) *OutputService1TestShapeOutputService1TestCaseOperation3Output {
- s.Blobs = v
- return s
-}
-
-// SetChar sets the Char field's value.
-func (s *OutputService1TestShapeOutputService1TestCaseOperation3Output) SetChar(v string) *OutputService1TestShapeOutputService1TestCaseOperation3Output {
- s.Char = &v
- return s
-}
-
-// SetDouble sets the Double field's value.
-func (s *OutputService1TestShapeOutputService1TestCaseOperation3Output) SetDouble(v float64) *OutputService1TestShapeOutputService1TestCaseOperation3Output {
- s.Double = &v
- return s
-}
-
-// SetFalseBool sets the FalseBool field's value.
-func (s *OutputService1TestShapeOutputService1TestCaseOperation3Output) SetFalseBool(v bool) *OutputService1TestShapeOutputService1TestCaseOperation3Output {
- s.FalseBool = &v
- return s
-}
-
-// SetFloat sets the Float field's value.
-func (s *OutputService1TestShapeOutputService1TestCaseOperation3Output) SetFloat(v float64) *OutputService1TestShapeOutputService1TestCaseOperation3Output {
- s.Float = &v
- return s
-}
-
-// SetImaHeader sets the ImaHeader field's value.
-func (s *OutputService1TestShapeOutputService1TestCaseOperation3Output) SetImaHeader(v string) *OutputService1TestShapeOutputService1TestCaseOperation3Output {
- s.ImaHeader = &v
- return s
-}
-
-// SetImaHeaderLocation sets the ImaHeaderLocation field's value.
-func (s *OutputService1TestShapeOutputService1TestCaseOperation3Output) SetImaHeaderLocation(v string) *OutputService1TestShapeOutputService1TestCaseOperation3Output {
- s.ImaHeaderLocation = &v
- return s
-}
-
-// SetLong sets the Long field's value.
-func (s *OutputService1TestShapeOutputService1TestCaseOperation3Output) SetLong(v int64) *OutputService1TestShapeOutputService1TestCaseOperation3Output {
- s.Long = &v
- return s
-}
-
-// SetNum sets the Num field's value.
-func (s *OutputService1TestShapeOutputService1TestCaseOperation3Output) SetNum(v int64) *OutputService1TestShapeOutputService1TestCaseOperation3Output {
- s.Num = &v
- return s
-}
-
-// SetStr sets the Str field's value.
-func (s *OutputService1TestShapeOutputService1TestCaseOperation3Output) SetStr(v string) *OutputService1TestShapeOutputService1TestCaseOperation3Output {
- s.Str = &v
- return s
-}
-
-// SetTimestamp sets the Timestamp field's value.
-func (s *OutputService1TestShapeOutputService1TestCaseOperation3Output) SetTimestamp(v time.Time) *OutputService1TestShapeOutputService1TestCaseOperation3Output {
- s.Timestamp = &v
- return s
-}
-
-// SetTimestamps sets the Timestamps field's value.
-func (s *OutputService1TestShapeOutputService1TestCaseOperation3Output) SetTimestamps(v []*time.Time) *OutputService1TestShapeOutputService1TestCaseOperation3Output {
- s.Timestamps = v
- return s
-}
-
-// SetTrueBool sets the TrueBool field's value.
-func (s *OutputService1TestShapeOutputService1TestCaseOperation3Output) SetTrueBool(v bool) *OutputService1TestShapeOutputService1TestCaseOperation3Output {
- s.TrueBool = &v
- return s
-}
-
-// OutputService2ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService2ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService2ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService2ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService2ProtocolTest client from just a session.
-// svc := outputservice2protocoltest.New(mySession)
-//
-// // Create a OutputService2ProtocolTest client with additional configuration
-// svc := outputservice2protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService2ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService2ProtocolTest {
- c := p.ClientConfig("outputservice2protocoltest", cfgs...)
- return newOutputService2ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService2ProtocolTest {
- svc := &OutputService2ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService2ProtocolTest",
- ServiceID: "OutputService2ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService2ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService2TestCaseOperation1 = "OperationName"
-
-// OutputService2TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService2TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService2TestCaseOperation1 for more information on using the OutputService2TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService2TestCaseOperation1Request method.
-// req, resp := client.OutputService2TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1Request(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (req *request.Request, output *OutputService2TestShapeOutputService2TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService2TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService2TestShapeOutputService2TestCaseOperation1Input{}
- }
-
- output = &OutputService2TestShapeOutputService2TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService2TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService2TestCaseOperation1 for usage and error information.
-func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (*OutputService2TestShapeOutputService2TestCaseOperation1Output, error) {
- req, out := c.OutputService2TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService2TestCaseOperation1WithContext is the same as OutputService2TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService2TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1WithContext(ctx aws.Context, input *OutputService2TestShapeOutputService2TestCaseOperation1Input, opts ...request.Option) (*OutputService2TestShapeOutputService2TestCaseOperation1Output, error) {
- req, out := c.OutputService2TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService2TestShapeOutputService2TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService2TestShapeOutputService2TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-
- // Blob is automatically base64 encoded/decoded by the SDK.
- Blob []byte `type:"blob"`
-}
-
-// SetBlob sets the Blob field's value.
-func (s *OutputService2TestShapeOutputService2TestCaseOperation1Output) SetBlob(v []byte) *OutputService2TestShapeOutputService2TestCaseOperation1Output {
- s.Blob = v
- return s
-}
-
-// OutputService3ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService3ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService3ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService3ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService3ProtocolTest client from just a session.
-// svc := outputservice3protocoltest.New(mySession)
-//
-// // Create a OutputService3ProtocolTest client with additional configuration
-// svc := outputservice3protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService3ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService3ProtocolTest {
- c := p.ClientConfig("outputservice3protocoltest", cfgs...)
- return newOutputService3ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService3ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService3ProtocolTest {
- svc := &OutputService3ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService3ProtocolTest",
- ServiceID: "OutputService3ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService3ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService3TestCaseOperation1 = "OperationName"
-
-// OutputService3TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService3TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService3TestCaseOperation1 for more information on using the OutputService3TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService3TestCaseOperation1Request method.
-// req, resp := client.OutputService3TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1Request(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (req *request.Request, output *OutputService3TestShapeOutputService3TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService3TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService3TestShapeOutputService3TestCaseOperation1Input{}
- }
-
- output = &OutputService3TestShapeOutputService3TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService3TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService3TestCaseOperation1 for usage and error information.
-func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (*OutputService3TestShapeOutputService3TestCaseOperation1Output, error) {
- req, out := c.OutputService3TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService3TestCaseOperation1WithContext is the same as OutputService3TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService3TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1WithContext(ctx aws.Context, input *OutputService3TestShapeOutputService3TestCaseOperation1Input, opts ...request.Option) (*OutputService3TestShapeOutputService3TestCaseOperation1Output, error) {
- req, out := c.OutputService3TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService3TestShapeOutputService3TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService3TestShapeOutputService3TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-
- ListMember []*string `type:"list"`
-}
-
-// SetListMember sets the ListMember field's value.
-func (s *OutputService3TestShapeOutputService3TestCaseOperation1Output) SetListMember(v []*string) *OutputService3TestShapeOutputService3TestCaseOperation1Output {
- s.ListMember = v
- return s
-}
-
-// OutputService4ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService4ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService4ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService4ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService4ProtocolTest client from just a session.
-// svc := outputservice4protocoltest.New(mySession)
-//
-// // Create a OutputService4ProtocolTest client with additional configuration
-// svc := outputservice4protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService4ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService4ProtocolTest {
- c := p.ClientConfig("outputservice4protocoltest", cfgs...)
- return newOutputService4ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService4ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService4ProtocolTest {
- svc := &OutputService4ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService4ProtocolTest",
- ServiceID: "OutputService4ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService4ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService4TestCaseOperation1 = "OperationName"
-
-// OutputService4TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService4TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService4TestCaseOperation1 for more information on using the OutputService4TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService4TestCaseOperation1Request method.
-// req, resp := client.OutputService4TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1Request(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (req *request.Request, output *OutputService4TestShapeOutputService4TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService4TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService4TestShapeOutputService4TestCaseOperation1Input{}
- }
-
- output = &OutputService4TestShapeOutputService4TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService4TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService4TestCaseOperation1 for usage and error information.
-func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (*OutputService4TestShapeOutputService4TestCaseOperation1Output, error) {
- req, out := c.OutputService4TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService4TestCaseOperation1WithContext is the same as OutputService4TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService4TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1WithContext(ctx aws.Context, input *OutputService4TestShapeOutputService4TestCaseOperation1Input, opts ...request.Option) (*OutputService4TestShapeOutputService4TestCaseOperation1Output, error) {
- req, out := c.OutputService4TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService4TestShapeOutputService4TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService4TestShapeOutputService4TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-
- ListMember []*string `locationNameList:"item" type:"list"`
-}
-
-// SetListMember sets the ListMember field's value.
-func (s *OutputService4TestShapeOutputService4TestCaseOperation1Output) SetListMember(v []*string) *OutputService4TestShapeOutputService4TestCaseOperation1Output {
- s.ListMember = v
- return s
-}
-
-// OutputService5ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService5ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService5ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService5ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService5ProtocolTest client from just a session.
-// svc := outputservice5protocoltest.New(mySession)
-//
-// // Create a OutputService5ProtocolTest client with additional configuration
-// svc := outputservice5protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService5ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService5ProtocolTest {
- c := p.ClientConfig("outputservice5protocoltest", cfgs...)
- return newOutputService5ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService5ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService5ProtocolTest {
- svc := &OutputService5ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService5ProtocolTest",
- ServiceID: "OutputService5ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService5ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService5TestCaseOperation1 = "OperationName"
-
-// OutputService5TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService5TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService5TestCaseOperation1 for more information on using the OutputService5TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService5TestCaseOperation1Request method.
-// req, resp := client.OutputService5TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1Request(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (req *request.Request, output *OutputService5TestShapeOutputService5TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService5TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService5TestShapeOutputService5TestCaseOperation1Input{}
- }
-
- output = &OutputService5TestShapeOutputService5TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService5TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService5TestCaseOperation1 for usage and error information.
-func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (*OutputService5TestShapeOutputService5TestCaseOperation1Output, error) {
- req, out := c.OutputService5TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService5TestCaseOperation1WithContext is the same as OutputService5TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService5TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1WithContext(ctx aws.Context, input *OutputService5TestShapeOutputService5TestCaseOperation1Input, opts ...request.Option) (*OutputService5TestShapeOutputService5TestCaseOperation1Output, error) {
- req, out := c.OutputService5TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService5TestShapeOutputService5TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService5TestShapeOutputService5TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-
- ListMember []*string `type:"list" flattened:"true"`
-}
-
-// SetListMember sets the ListMember field's value.
-func (s *OutputService5TestShapeOutputService5TestCaseOperation1Output) SetListMember(v []*string) *OutputService5TestShapeOutputService5TestCaseOperation1Output {
- s.ListMember = v
- return s
-}
-
-// OutputService6ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService6ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService6ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService6ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService6ProtocolTest client from just a session.
-// svc := outputservice6protocoltest.New(mySession)
-//
-// // Create a OutputService6ProtocolTest client with additional configuration
-// svc := outputservice6protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService6ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService6ProtocolTest {
- c := p.ClientConfig("outputservice6protocoltest", cfgs...)
- return newOutputService6ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService6ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService6ProtocolTest {
- svc := &OutputService6ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService6ProtocolTest",
- ServiceID: "OutputService6ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService6ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService6TestCaseOperation1 = "OperationName"
-
-// OutputService6TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService6TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService6TestCaseOperation1 for more information on using the OutputService6TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService6TestCaseOperation1Request method.
-// req, resp := client.OutputService6TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1Request(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (req *request.Request, output *OutputService6TestShapeOutputService6TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService6TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService6TestShapeOutputService6TestCaseOperation1Input{}
- }
-
- output = &OutputService6TestShapeOutputService6TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService6TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService6TestCaseOperation1 for usage and error information.
-func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (*OutputService6TestShapeOutputService6TestCaseOperation1Output, error) {
- req, out := c.OutputService6TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService6TestCaseOperation1WithContext is the same as OutputService6TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService6TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1WithContext(ctx aws.Context, input *OutputService6TestShapeOutputService6TestCaseOperation1Input, opts ...request.Option) (*OutputService6TestShapeOutputService6TestCaseOperation1Output, error) {
- req, out := c.OutputService6TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService6TestShapeOutputService6TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService6TestShapeOutputService6TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-
- Map map[string]*OutputService6TestShapeSingleStructure `type:"map"`
-}
-
-// SetMap sets the Map field's value.
-func (s *OutputService6TestShapeOutputService6TestCaseOperation1Output) SetMap(v map[string]*OutputService6TestShapeSingleStructure) *OutputService6TestShapeOutputService6TestCaseOperation1Output {
- s.Map = v
- return s
-}
-
-type OutputService6TestShapeSingleStructure struct {
- _ struct{} `type:"structure"`
-
- Foo *string `locationName:"foo" type:"string"`
-}
-
-// SetFoo sets the Foo field's value.
-func (s *OutputService6TestShapeSingleStructure) SetFoo(v string) *OutputService6TestShapeSingleStructure {
- s.Foo = &v
- return s
-}
-
-// OutputService7ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService7ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService7ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService7ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService7ProtocolTest client from just a session.
-// svc := outputservice7protocoltest.New(mySession)
-//
-// // Create a OutputService7ProtocolTest client with additional configuration
-// svc := outputservice7protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService7ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService7ProtocolTest {
- c := p.ClientConfig("outputservice7protocoltest", cfgs...)
- return newOutputService7ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService7ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService7ProtocolTest {
- svc := &OutputService7ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService7ProtocolTest",
- ServiceID: "OutputService7ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService7ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService7TestCaseOperation1 = "OperationName"
-
-// OutputService7TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService7TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService7TestCaseOperation1 for more information on using the OutputService7TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService7TestCaseOperation1Request method.
-// req, resp := client.OutputService7TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1Request(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (req *request.Request, output *OutputService7TestShapeOutputService7TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService7TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService7TestShapeOutputService7TestCaseOperation1Input{}
- }
-
- output = &OutputService7TestShapeOutputService7TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService7TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService7TestCaseOperation1 for usage and error information.
-func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (*OutputService7TestShapeOutputService7TestCaseOperation1Output, error) {
- req, out := c.OutputService7TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService7TestCaseOperation1WithContext is the same as OutputService7TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService7TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1WithContext(ctx aws.Context, input *OutputService7TestShapeOutputService7TestCaseOperation1Input, opts ...request.Option) (*OutputService7TestShapeOutputService7TestCaseOperation1Output, error) {
- req, out := c.OutputService7TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService7TestShapeOutputService7TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService7TestShapeOutputService7TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-
- Map map[string]*string `type:"map" flattened:"true"`
-}
-
-// SetMap sets the Map field's value.
-func (s *OutputService7TestShapeOutputService7TestCaseOperation1Output) SetMap(v map[string]*string) *OutputService7TestShapeOutputService7TestCaseOperation1Output {
- s.Map = v
- return s
-}
-
-// OutputService8ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService8ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService8ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService8ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService8ProtocolTest client from just a session.
-// svc := outputservice8protocoltest.New(mySession)
-//
-// // Create a OutputService8ProtocolTest client with additional configuration
-// svc := outputservice8protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService8ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService8ProtocolTest {
- c := p.ClientConfig("outputservice8protocoltest", cfgs...)
- return newOutputService8ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService8ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService8ProtocolTest {
- svc := &OutputService8ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService8ProtocolTest",
- ServiceID: "OutputService8ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService8ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService8TestCaseOperation1 = "OperationName"
-
-// OutputService8TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService8TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService8TestCaseOperation1 for more information on using the OutputService8TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService8TestCaseOperation1Request method.
-// req, resp := client.OutputService8TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1Request(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (req *request.Request, output *OutputService8TestShapeOutputService8TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService8TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService8TestShapeOutputService8TestCaseOperation1Input{}
- }
-
- output = &OutputService8TestShapeOutputService8TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService8TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService8TestCaseOperation1 for usage and error information.
-func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (*OutputService8TestShapeOutputService8TestCaseOperation1Output, error) {
- req, out := c.OutputService8TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService8TestCaseOperation1WithContext is the same as OutputService8TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService8TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1WithContext(ctx aws.Context, input *OutputService8TestShapeOutputService8TestCaseOperation1Input, opts ...request.Option) (*OutputService8TestShapeOutputService8TestCaseOperation1Output, error) {
- req, out := c.OutputService8TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService8TestShapeOutputService8TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService8TestShapeOutputService8TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-
- Map map[string]*string `locationNameKey:"foo" locationNameValue:"bar" type:"map"`
-}
-
-// SetMap sets the Map field's value.
-func (s *OutputService8TestShapeOutputService8TestCaseOperation1Output) SetMap(v map[string]*string) *OutputService8TestShapeOutputService8TestCaseOperation1Output {
- s.Map = v
- return s
-}
-
-// OutputService9ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService9ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService9ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService9ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService9ProtocolTest client from just a session.
-// svc := outputservice9protocoltest.New(mySession)
-//
-// // Create a OutputService9ProtocolTest client with additional configuration
-// svc := outputservice9protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService9ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService9ProtocolTest {
- c := p.ClientConfig("outputservice9protocoltest", cfgs...)
- return newOutputService9ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService9ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService9ProtocolTest {
- svc := &OutputService9ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService9ProtocolTest",
- ServiceID: "OutputService9ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService9ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService9ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService9TestCaseOperation1 = "OperationName"
-
-// OutputService9TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService9TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService9TestCaseOperation1 for more information on using the OutputService9TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService9TestCaseOperation1Request method.
-// req, resp := client.OutputService9TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1Request(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (req *request.Request, output *OutputService9TestShapeOutputService9TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService9TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService9TestShapeOutputService9TestCaseOperation1Input{}
- }
-
- output = &OutputService9TestShapeOutputService9TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService9TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService9TestCaseOperation1 for usage and error information.
-func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (*OutputService9TestShapeOutputService9TestCaseOperation1Output, error) {
- req, out := c.OutputService9TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService9TestCaseOperation1WithContext is the same as OutputService9TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService9TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1WithContext(ctx aws.Context, input *OutputService9TestShapeOutputService9TestCaseOperation1Input, opts ...request.Option) (*OutputService9TestShapeOutputService9TestCaseOperation1Output, error) {
- req, out := c.OutputService9TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService9TestShapeOutputService9TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService9TestShapeOutputService9TestCaseOperation1Output struct {
- _ struct{} `type:"structure" payload:"Data"`
-
- Data *OutputService9TestShapeSingleStructure `type:"structure"`
-
- Header *string `location:"header" locationName:"X-Foo" type:"string"`
-}
-
-// SetData sets the Data field's value.
-func (s *OutputService9TestShapeOutputService9TestCaseOperation1Output) SetData(v *OutputService9TestShapeSingleStructure) *OutputService9TestShapeOutputService9TestCaseOperation1Output {
- s.Data = v
- return s
-}
-
-// SetHeader sets the Header field's value.
-func (s *OutputService9TestShapeOutputService9TestCaseOperation1Output) SetHeader(v string) *OutputService9TestShapeOutputService9TestCaseOperation1Output {
- s.Header = &v
- return s
-}
-
-type OutputService9TestShapeSingleStructure struct {
- _ struct{} `type:"structure"`
-
- Foo *string `type:"string"`
-}
-
-// SetFoo sets the Foo field's value.
-func (s *OutputService9TestShapeSingleStructure) SetFoo(v string) *OutputService9TestShapeSingleStructure {
- s.Foo = &v
- return s
-}
-
-// OutputService10ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService10ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService10ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService10ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService10ProtocolTest client from just a session.
-// svc := outputservice10protocoltest.New(mySession)
-//
-// // Create a OutputService10ProtocolTest client with additional configuration
-// svc := outputservice10protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService10ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService10ProtocolTest {
- c := p.ClientConfig("outputservice10protocoltest", cfgs...)
- return newOutputService10ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService10ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService10ProtocolTest {
- svc := &OutputService10ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService10ProtocolTest",
- ServiceID: "OutputService10ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService10ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService10ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService10TestCaseOperation1 = "OperationName"
-
-// OutputService10TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService10TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService10TestCaseOperation1 for more information on using the OutputService10TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService10TestCaseOperation1Request method.
-// req, resp := client.OutputService10TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1Request(input *OutputService10TestShapeOutputService10TestCaseOperation1Input) (req *request.Request, output *OutputService10TestShapeOutputService10TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService10TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService10TestShapeOutputService10TestCaseOperation1Input{}
- }
-
- output = &OutputService10TestShapeOutputService10TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService10TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService10TestCaseOperation1 for usage and error information.
-func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1(input *OutputService10TestShapeOutputService10TestCaseOperation1Input) (*OutputService10TestShapeOutputService10TestCaseOperation1Output, error) {
- req, out := c.OutputService10TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService10TestCaseOperation1WithContext is the same as OutputService10TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService10TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1WithContext(ctx aws.Context, input *OutputService10TestShapeOutputService10TestCaseOperation1Input, opts ...request.Option) (*OutputService10TestShapeOutputService10TestCaseOperation1Output, error) {
- req, out := c.OutputService10TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService10TestShapeOutputService10TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService10TestShapeOutputService10TestCaseOperation1Output struct {
- _ struct{} `type:"structure" payload:"Stream"`
-
- Stream []byte `type:"blob"`
-}
-
-// SetStream sets the Stream field's value.
-func (s *OutputService10TestShapeOutputService10TestCaseOperation1Output) SetStream(v []byte) *OutputService10TestShapeOutputService10TestCaseOperation1Output {
- s.Stream = v
- return s
-}
-
-// OutputService11ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService11ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService11ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService11ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService11ProtocolTest client from just a session.
-// svc := outputservice11protocoltest.New(mySession)
-//
-// // Create a OutputService11ProtocolTest client with additional configuration
-// svc := outputservice11protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService11ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService11ProtocolTest {
- c := p.ClientConfig("outputservice11protocoltest", cfgs...)
- return newOutputService11ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService11ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService11ProtocolTest {
- svc := &OutputService11ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService11ProtocolTest",
- ServiceID: "OutputService11ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService11ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService11ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService11TestCaseOperation1 = "OperationName"
-
-// OutputService11TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService11TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService11TestCaseOperation1 for more information on using the OutputService11TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService11TestCaseOperation1Request method.
-// req, resp := client.OutputService11TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1Request(input *OutputService11TestShapeOutputService11TestCaseOperation1Input) (req *request.Request, output *OutputService11TestShapeOutputService11TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService11TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService11TestShapeOutputService11TestCaseOperation1Input{}
- }
-
- output = &OutputService11TestShapeOutputService11TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService11TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService11TestCaseOperation1 for usage and error information.
-func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1(input *OutputService11TestShapeOutputService11TestCaseOperation1Input) (*OutputService11TestShapeOutputService11TestCaseOperation1Output, error) {
- req, out := c.OutputService11TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService11TestCaseOperation1WithContext is the same as OutputService11TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService11TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1WithContext(ctx aws.Context, input *OutputService11TestShapeOutputService11TestCaseOperation1Input, opts ...request.Option) (*OutputService11TestShapeOutputService11TestCaseOperation1Output, error) {
- req, out := c.OutputService11TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService11TestShapeOutputService11TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService11TestShapeOutputService11TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-
- Char *string `location:"header" locationName:"x-char" type:"character"`
-
- Double *float64 `location:"header" locationName:"x-double" type:"double"`
-
- FalseBool *bool `location:"header" locationName:"x-false-bool" type:"boolean"`
-
- Float *float64 `location:"header" locationName:"x-float" type:"float"`
-
- Integer *int64 `location:"header" locationName:"x-int" type:"integer"`
-
- Long *int64 `location:"header" locationName:"x-long" type:"long"`
-
- Str *string `location:"header" locationName:"x-str" type:"string"`
-
- Timestamp *time.Time `location:"header" locationName:"x-timestamp" type:"timestamp" timestampFormat:"iso8601"`
-
- TrueBool *bool `location:"header" locationName:"x-true-bool" type:"boolean"`
-}
-
-// SetChar sets the Char field's value.
-func (s *OutputService11TestShapeOutputService11TestCaseOperation1Output) SetChar(v string) *OutputService11TestShapeOutputService11TestCaseOperation1Output {
- s.Char = &v
- return s
-}
-
-// SetDouble sets the Double field's value.
-func (s *OutputService11TestShapeOutputService11TestCaseOperation1Output) SetDouble(v float64) *OutputService11TestShapeOutputService11TestCaseOperation1Output {
- s.Double = &v
- return s
-}
-
-// SetFalseBool sets the FalseBool field's value.
-func (s *OutputService11TestShapeOutputService11TestCaseOperation1Output) SetFalseBool(v bool) *OutputService11TestShapeOutputService11TestCaseOperation1Output {
- s.FalseBool = &v
- return s
-}
-
-// SetFloat sets the Float field's value.
-func (s *OutputService11TestShapeOutputService11TestCaseOperation1Output) SetFloat(v float64) *OutputService11TestShapeOutputService11TestCaseOperation1Output {
- s.Float = &v
- return s
-}
-
-// SetInteger sets the Integer field's value.
-func (s *OutputService11TestShapeOutputService11TestCaseOperation1Output) SetInteger(v int64) *OutputService11TestShapeOutputService11TestCaseOperation1Output {
- s.Integer = &v
- return s
-}
-
-// SetLong sets the Long field's value.
-func (s *OutputService11TestShapeOutputService11TestCaseOperation1Output) SetLong(v int64) *OutputService11TestShapeOutputService11TestCaseOperation1Output {
- s.Long = &v
- return s
-}
-
-// SetStr sets the Str field's value.
-func (s *OutputService11TestShapeOutputService11TestCaseOperation1Output) SetStr(v string) *OutputService11TestShapeOutputService11TestCaseOperation1Output {
- s.Str = &v
- return s
-}
-
-// SetTimestamp sets the Timestamp field's value.
-func (s *OutputService11TestShapeOutputService11TestCaseOperation1Output) SetTimestamp(v time.Time) *OutputService11TestShapeOutputService11TestCaseOperation1Output {
- s.Timestamp = &v
- return s
-}
-
-// SetTrueBool sets the TrueBool field's value.
-func (s *OutputService11TestShapeOutputService11TestCaseOperation1Output) SetTrueBool(v bool) *OutputService11TestShapeOutputService11TestCaseOperation1Output {
- s.TrueBool = &v
- return s
-}
-
-// OutputService12ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService12ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService12ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService12ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService12ProtocolTest client from just a session.
-// svc := outputservice12protocoltest.New(mySession)
-//
-// // Create a OutputService12ProtocolTest client with additional configuration
-// svc := outputservice12protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService12ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService12ProtocolTest {
- c := p.ClientConfig("outputservice12protocoltest", cfgs...)
- return newOutputService12ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService12ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService12ProtocolTest {
- svc := &OutputService12ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService12ProtocolTest",
- ServiceID: "OutputService12ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService12ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService12ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService12TestCaseOperation1 = "OperationName"
-
-// OutputService12TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService12TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService12TestCaseOperation1 for more information on using the OutputService12TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService12TestCaseOperation1Request method.
-// req, resp := client.OutputService12TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService12ProtocolTest) OutputService12TestCaseOperation1Request(input *OutputService12TestShapeOutputService12TestCaseOperation1Input) (req *request.Request, output *OutputService12TestShapeOutputService12TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService12TestCaseOperation1,
- HTTPPath: "/",
- }
-
- if input == nil {
- input = &OutputService12TestShapeOutputService12TestCaseOperation1Input{}
- }
-
- output = &OutputService12TestShapeOutputService12TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService12TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService12TestCaseOperation1 for usage and error information.
-func (c *OutputService12ProtocolTest) OutputService12TestCaseOperation1(input *OutputService12TestShapeOutputService12TestCaseOperation1Input) (*OutputService12TestShapeOutputService12TestCaseOperation1Output, error) {
- req, out := c.OutputService12TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService12TestCaseOperation1WithContext is the same as OutputService12TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService12TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService12ProtocolTest) OutputService12TestCaseOperation1WithContext(ctx aws.Context, input *OutputService12TestShapeOutputService12TestCaseOperation1Input, opts ...request.Option) (*OutputService12TestShapeOutputService12TestCaseOperation1Output, error) {
- req, out := c.OutputService12TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService12TestShapeOutputService12TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService12TestShapeOutputService12TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-
- Foo *string `type:"string"`
-}
-
-// SetFoo sets the Foo field's value.
-func (s *OutputService12TestShapeOutputService12TestCaseOperation1Output) SetFoo(v string) *OutputService12TestShapeOutputService12TestCaseOperation1Output {
- s.Foo = &v
- return s
-}
-
-// OutputService13ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService13ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService13ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService13ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService13ProtocolTest client from just a session.
-// svc := outputservice13protocoltest.New(mySession)
-//
-// // Create a OutputService13ProtocolTest client with additional configuration
-// svc := outputservice13protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService13ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService13ProtocolTest {
- c := p.ClientConfig("outputservice13protocoltest", cfgs...)
- return newOutputService13ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService13ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService13ProtocolTest {
- svc := &OutputService13ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService13ProtocolTest",
- ServiceID: "OutputService13ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService13ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService13ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService13TestCaseOperation1 = "OperationName"
-
-// OutputService13TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService13TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService13TestCaseOperation1 for more information on using the OutputService13TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService13TestCaseOperation1Request method.
-// req, resp := client.OutputService13TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService13ProtocolTest) OutputService13TestCaseOperation1Request(input *OutputService13TestShapeOutputService13TestCaseOperation1Input) (req *request.Request, output *OutputService13TestShapeOutputService13TestCaseOperation2Input) {
- op := &request.Operation{
- Name: opOutputService13TestCaseOperation1,
- HTTPMethod: "POST",
- HTTPPath: "/path",
- }
-
- if input == nil {
- input = &OutputService13TestShapeOutputService13TestCaseOperation1Input{}
- }
-
- output = &OutputService13TestShapeOutputService13TestCaseOperation2Input{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService13TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService13TestCaseOperation1 for usage and error information.
-func (c *OutputService13ProtocolTest) OutputService13TestCaseOperation1(input *OutputService13TestShapeOutputService13TestCaseOperation1Input) (*OutputService13TestShapeOutputService13TestCaseOperation2Input, error) {
- req, out := c.OutputService13TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService13TestCaseOperation1WithContext is the same as OutputService13TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService13TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService13ProtocolTest) OutputService13TestCaseOperation1WithContext(ctx aws.Context, input *OutputService13TestShapeOutputService13TestCaseOperation1Input, opts ...request.Option) (*OutputService13TestShapeOutputService13TestCaseOperation2Input, error) {
- req, out := c.OutputService13TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-const opOutputService13TestCaseOperation2 = "OperationName"
-
-// OutputService13TestCaseOperation2Request generates a "aws/request.Request" representing the
-// client's request for the OutputService13TestCaseOperation2 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService13TestCaseOperation2 for more information on using the OutputService13TestCaseOperation2
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService13TestCaseOperation2Request method.
-// req, resp := client.OutputService13TestCaseOperation2Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService13ProtocolTest) OutputService13TestCaseOperation2Request(input *OutputService13TestShapeOutputService13TestCaseOperation2Input) (req *request.Request, output *OutputService13TestShapeOutputService13TestCaseOperation2Output) {
- op := &request.Operation{
- Name: opOutputService13TestCaseOperation2,
- HTTPMethod: "POST",
- HTTPPath: "/path",
- }
-
- if input == nil {
- input = &OutputService13TestShapeOutputService13TestCaseOperation2Input{}
- }
-
- output = &OutputService13TestShapeOutputService13TestCaseOperation2Output{}
- req = c.newRequest(op, input, output)
- req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler)
- req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
- return
-}
-
-// OutputService13TestCaseOperation2 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService13TestCaseOperation2 for usage and error information.
-func (c *OutputService13ProtocolTest) OutputService13TestCaseOperation2(input *OutputService13TestShapeOutputService13TestCaseOperation2Input) (*OutputService13TestShapeOutputService13TestCaseOperation2Output, error) {
- req, out := c.OutputService13TestCaseOperation2Request(input)
- return out, req.Send()
-}
-
-// OutputService13TestCaseOperation2WithContext is the same as OutputService13TestCaseOperation2 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService13TestCaseOperation2 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService13ProtocolTest) OutputService13TestCaseOperation2WithContext(ctx aws.Context, input *OutputService13TestShapeOutputService13TestCaseOperation2Input, opts ...request.Option) (*OutputService13TestShapeOutputService13TestCaseOperation2Output, error) {
- req, out := c.OutputService13TestCaseOperation2Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService13TestShapeOutputService13TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService13TestShapeOutputService13TestCaseOperation2Input struct {
- _ struct{} `type:"structure"`
-
- FooEnum *string `type:"string" enum:"OutputService13TestShapeRESTJSONEnumType"`
-
- HeaderEnum *string `location:"header" locationName:"x-amz-enum" type:"string" enum:"OutputService13TestShapeRESTJSONEnumType"`
-
- ListEnums []*string `type:"list"`
-}
-
-// SetFooEnum sets the FooEnum field's value.
-func (s *OutputService13TestShapeOutputService13TestCaseOperation2Input) SetFooEnum(v string) *OutputService13TestShapeOutputService13TestCaseOperation2Input {
- s.FooEnum = &v
- return s
-}
-
-// SetHeaderEnum sets the HeaderEnum field's value.
-func (s *OutputService13TestShapeOutputService13TestCaseOperation2Input) SetHeaderEnum(v string) *OutputService13TestShapeOutputService13TestCaseOperation2Input {
- s.HeaderEnum = &v
- return s
-}
-
-// SetListEnums sets the ListEnums field's value.
-func (s *OutputService13TestShapeOutputService13TestCaseOperation2Input) SetListEnums(v []*string) *OutputService13TestShapeOutputService13TestCaseOperation2Input {
- s.ListEnums = v
- return s
-}
-
-type OutputService13TestShapeOutputService13TestCaseOperation2Output struct {
- _ struct{} `type:"structure"`
-}
-
-const (
- // RESTJSONEnumTypeFoo is a OutputService13TestShapeRESTJSONEnumType enum value
- RESTJSONEnumTypeFoo = "foo"
-
- // RESTJSONEnumTypeBar is a OutputService13TestShapeRESTJSONEnumType enum value
- RESTJSONEnumTypeBar = "bar"
-
- // RESTJSONEnumType0 is a OutputService13TestShapeRESTJSONEnumType enum value
- RESTJSONEnumType0 = "0"
-
- // RESTJSONEnumType1 is a OutputService13TestShapeRESTJSONEnumType enum value
- RESTJSONEnumType1 = "1"
-)
-
-// OutputService14ProtocolTest provides the API operation methods for making requests to
-// . See this package's package overview docs
-// for details on the service.
-//
-// OutputService14ProtocolTest methods are safe to use concurrently. It is not safe to
-// modify mutate any of the struct's properties though.
-type OutputService14ProtocolTest struct {
- *client.Client
-}
-
-// New creates a new instance of the OutputService14ProtocolTest client with a session.
-// If additional configuration is needed for the client instance use the optional
-// aws.Config parameter to add your extra config.
-//
-// Example:
-// // Create a OutputService14ProtocolTest client from just a session.
-// svc := outputservice14protocoltest.New(mySession)
-//
-// // Create a OutputService14ProtocolTest client with additional configuration
-// svc := outputservice14protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
-func NewOutputService14ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService14ProtocolTest {
- c := p.ClientConfig("outputservice14protocoltest", cfgs...)
- return newOutputService14ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
-}
-
-// newClient creates, initializes and returns a new service client instance.
-func newOutputService14ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService14ProtocolTest {
- svc := &OutputService14ProtocolTest{
- Client: client.New(
- cfg,
- metadata.ClientInfo{
- ServiceName: "OutputService14ProtocolTest",
- ServiceID: "OutputService14ProtocolTest",
- SigningName: signingName,
- SigningRegion: signingRegion,
- Endpoint: endpoint,
- APIVersion: "",
- },
- handlers,
- ),
- }
-
- // Handlers
- svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
- svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
- svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
- svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
- svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
-
- return svc
-}
-
-// newRequest creates a new request for a OutputService14ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService14ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService14TestCaseOperation1 = "OperationName"
-
-// OutputService14TestCaseOperation1Request generates a "aws/request.Request" representing the
-// client's request for the OutputService14TestCaseOperation1 operation. The "output" return
-// value will be populated with the request's response once the request completes
-// successfuly.
-//
-// Use "Send" method on the returned Request to send the API call to the service.
-// the "output" return value is not valid until after Send returns without error.
-//
-// See OutputService14TestCaseOperation1 for more information on using the OutputService14TestCaseOperation1
-// API call, and error handling.
-//
-// This method is useful when you want to inject custom logic or configuration
-// into the SDK's request lifecycle. Such as custom headers, or retry logic.
-//
-//
-// // Example sending a request using the OutputService14TestCaseOperation1Request method.
-// req, resp := client.OutputService14TestCaseOperation1Request(params)
-//
-// err := req.Send()
-// if err == nil { // resp is now filled
-// fmt.Println(resp)
-// }
-func (c *OutputService14ProtocolTest) OutputService14TestCaseOperation1Request(input *OutputService14TestShapeOutputService14TestCaseOperation1Input) (req *request.Request, output *OutputService14TestShapeOutputService14TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService14TestCaseOperation1,
- HTTPMethod: "GET",
- HTTPPath: "/path",
- }
-
- if input == nil {
- input = &OutputService14TestShapeOutputService14TestCaseOperation1Input{}
- }
-
- output = &OutputService14TestShapeOutputService14TestCaseOperation1Output{}
- req = c.newRequest(op, input, output)
- return
-}
-
-// OutputService14TestCaseOperation1 API operation for .
-//
-// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
-// with awserr.Error's Code and Message methods to get detailed information about
-// the error.
-//
-// See the AWS API reference guide for 's
-// API operation OutputService14TestCaseOperation1 for usage and error information.
-func (c *OutputService14ProtocolTest) OutputService14TestCaseOperation1(input *OutputService14TestShapeOutputService14TestCaseOperation1Input) (*OutputService14TestShapeOutputService14TestCaseOperation1Output, error) {
- req, out := c.OutputService14TestCaseOperation1Request(input)
- return out, req.Send()
-}
-
-// OutputService14TestCaseOperation1WithContext is the same as OutputService14TestCaseOperation1 with the addition of
-// the ability to pass a context and additional request options.
-//
-// See OutputService14TestCaseOperation1 for details on how to use this API operation.
-//
-// The context must be non-nil and will be used for request cancellation. If
-// the context is nil a panic will occur. In the future the SDK may create
-// sub-contexts for http.Requests. See https://golang.org/pkg/context/
-// for more information on using Contexts.
-func (c *OutputService14ProtocolTest) OutputService14TestCaseOperation1WithContext(ctx aws.Context, input *OutputService14TestShapeOutputService14TestCaseOperation1Input, opts ...request.Option) (*OutputService14TestShapeOutputService14TestCaseOperation1Output, error) {
- req, out := c.OutputService14TestCaseOperation1Request(input)
- req.SetContext(ctx)
- req.ApplyOptions(opts...)
- return out, req.Send()
-}
-
-type OutputService14TestShapeItemDetailShape struct {
- _ struct{} `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"`
-
- ID *string `type:"string"`
-
- // Type is a required field
- Type *string `locationName:"xsi:type" type:"string" xmlAttribute:"true" required:"true" enum:"OutputService14TestShapeItemType"`
-}
-
-// SetID sets the ID field's value.
-func (s *OutputService14TestShapeItemDetailShape) SetID(v string) *OutputService14TestShapeItemDetailShape {
- s.ID = &v
- return s
-}
-
-// SetType sets the Type field's value.
-func (s *OutputService14TestShapeItemDetailShape) SetType(v string) *OutputService14TestShapeItemDetailShape {
- s.Type = &v
- return s
-}
-
-type OutputService14TestShapeItemShape struct {
- _ struct{} `type:"structure"`
-
- ItemDetail *OutputService14TestShapeItemDetailShape `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"`
-}
-
-// SetItemDetail sets the ItemDetail field's value.
-func (s *OutputService14TestShapeItemShape) SetItemDetail(v *OutputService14TestShapeItemDetailShape) *OutputService14TestShapeItemShape {
- s.ItemDetail = v
- return s
-}
-
-type OutputService14TestShapeOutputService14TestCaseOperation1Input struct {
- _ struct{} `type:"structure"`
-}
-
-type OutputService14TestShapeOutputService14TestCaseOperation1Output struct {
- _ struct{} `type:"structure"`
-
- ListItems []*OutputService14TestShapeItemShape `locationName:"ItemsList" locationNameList:"Item" type:"list"`
-}
-
-// SetListItems sets the ListItems field's value.
-func (s *OutputService14TestShapeOutputService14TestCaseOperation1Output) SetListItems(v []*OutputService14TestShapeItemShape) *OutputService14TestShapeOutputService14TestCaseOperation1Output {
- s.ListItems = v
- return s
-}
-
-const (
- // ItemTypeType1 is a OutputService14TestShapeItemType enum value
- ItemTypeType1 = "Type1"
-
- // ItemTypeType2 is a OutputService14TestShapeItemType enum value
- ItemTypeType2 = "Type2"
-
- // ItemTypeType3 is a OutputService14TestShapeItemType enum value
- ItemTypeType3 = "Type3"
-)
-
-//
-// Tests begin here
-//
-
-func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) {
- svc := NewOutputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResponse><Str>myname</Str><FooNum>123</FooNum><FalseBool>false</FalseBool><TrueBool>true</TrueBool><Float>1.2</Float><Double>1.3</Double><Long>200</Long><Char>a</Char><Timestamp>2015-01-25T08:00:00Z</Timestamp></OperationNameResponse>"))
- req, out := svc.OutputService1TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
- req.HTTPResponse.Header.Set("ImaHeader", "test")
- req.HTTPResponse.Header.Set("X-Foo", "abc")
-
- // unmarshal response
- restxml.UnmarshalMeta(req)
- restxml.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "a", *out.Char; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := 1.3, *out.Double; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := false, *out.FalseBool; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := 1.2, *out.Float; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "test", *out.ImaHeader; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "abc", *out.ImaHeaderLocation; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := int64(200), *out.Long; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := int64(123), *out.Num; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "myname", *out.Str; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := time.Unix(1.4221728e+09, 0).UTC().String(), out.Timestamp.UTC().String(); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := true, *out.TrueBool; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService1ProtocolTestScalarMembersCase2(t *testing.T) {
- svc := NewOutputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResponse><Str></Str><FooNum>123</FooNum><FalseBool>false</FalseBool><TrueBool>true</TrueBool><Float>1.2</Float><Double>1.3</Double><Long>200</Long><Char>a</Char><Timestamp>2015-01-25T08:00:00Z</Timestamp></OperationNameResponse>"))
- req, out := svc.OutputService1TestCaseOperation2Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
- req.HTTPResponse.Header.Set("ImaHeader", "test")
- req.HTTPResponse.Header.Set("X-Foo", "abc")
-
- // unmarshal response
- restxml.UnmarshalMeta(req)
- restxml.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "a", *out.Char; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := 1.3, *out.Double; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := false, *out.FalseBool; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := 1.2, *out.Float; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "test", *out.ImaHeader; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "abc", *out.ImaHeaderLocation; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := int64(200), *out.Long; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := int64(123), *out.Num; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "", *out.Str; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := time.Unix(1.4221728e+09, 0).UTC().String(), out.Timestamp.UTC().String(); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := true, *out.TrueBool; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService1ProtocolTestScalarMembersCase3(t *testing.T) {
- svc := NewOutputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResponse><Blobs><member>dmFsdWU=</member><member>dmFsdWUy</member></Blobs><Timestamps><member>2015-01-25T08:00:00Z</member><member>2015-01-25T08:00:01Z</member></Timestamps></OperationNameResponse>"))
- req, out := svc.OutputService1TestCaseOperation3Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- restxml.UnmarshalMeta(req)
- restxml.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "value", string(out.Blobs[0]); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "value2", string(out.Blobs[1]); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := time.Unix(1.4221728e+09, 0).UTC().String(), out.Timestamps[0].UTC().String(); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := time.Unix(1.422172801e+09, 0).UTC().String(), out.Timestamps[1].UTC().String(); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService2ProtocolTestBlobCase1(t *testing.T) {
- svc := NewOutputService2ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResult><Blob>dmFsdWU=</Blob></OperationNameResult>"))
- req, out := svc.OutputService2TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- restxml.UnmarshalMeta(req)
- restxml.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "value", string(out.Blob); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService3ProtocolTestListsCase1(t *testing.T) {
- svc := NewOutputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResult><ListMember><member>abc</member><member>123</member></ListMember></OperationNameResult>"))
- req, out := svc.OutputService3TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- restxml.UnmarshalMeta(req)
- restxml.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "abc", *out.ListMember[0]; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "123", *out.ListMember[1]; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService4ProtocolTestListWithCustomMemberNameCase1(t *testing.T) {
- svc := NewOutputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResult><ListMember><item>abc</item><item>123</item></ListMember></OperationNameResult>"))
- req, out := svc.OutputService4TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- restxml.UnmarshalMeta(req)
- restxml.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "abc", *out.ListMember[0]; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "123", *out.ListMember[1]; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService5ProtocolTestFlattenedListCase1(t *testing.T) {
- svc := NewOutputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResult><ListMember>abc</ListMember><ListMember>123</ListMember></OperationNameResult>"))
- req, out := svc.OutputService5TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- restxml.UnmarshalMeta(req)
- restxml.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "abc", *out.ListMember[0]; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "123", *out.ListMember[1]; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService6ProtocolTestNormalMapCase1(t *testing.T) {
- svc := NewOutputService6ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResult><Map><entry><key>qux</key><value><foo>bar</foo></value></entry><entry><key>baz</key><value><foo>bam</foo></value></entry></Map></OperationNameResult>"))
- req, out := svc.OutputService6TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- restxml.UnmarshalMeta(req)
- restxml.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "bam", *out.Map["baz"].Foo; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "bar", *out.Map["qux"].Foo; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService7ProtocolTestFlattenedMapCase1(t *testing.T) {
- svc := NewOutputService7ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResult><Map><key>qux</key><value>bar</value></Map><Map><key>baz</key><value>bam</value></Map></OperationNameResult>"))
- req, out := svc.OutputService7TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- restxml.UnmarshalMeta(req)
- restxml.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "bam", *out.Map["baz"]; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "bar", *out.Map["qux"]; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService8ProtocolTestNamedMapCase1(t *testing.T) {
- svc := NewOutputService8ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResult><Map><entry><foo>qux</foo><bar>bar</bar></entry><entry><foo>baz</foo><bar>bam</bar></entry></Map></OperationNameResult>"))
- req, out := svc.OutputService8TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- restxml.UnmarshalMeta(req)
- restxml.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "bam", *out.Map["baz"]; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "bar", *out.Map["qux"]; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService9ProtocolTestXMLPayloadCase1(t *testing.T) {
- svc := NewOutputService9ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResponse><Foo>abc</Foo></OperationNameResponse>"))
- req, out := svc.OutputService9TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
- req.HTTPResponse.Header.Set("X-Foo", "baz")
-
- // unmarshal response
- restxml.UnmarshalMeta(req)
- restxml.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "abc", *out.Data.Foo; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "baz", *out.Header; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService10ProtocolTestStreamingPayloadCase1(t *testing.T) {
- svc := NewOutputService10ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("abc"))
- req, out := svc.OutputService10TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- restxml.UnmarshalMeta(req)
- restxml.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "abc", string(out.Stream); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService11ProtocolTestScalarMembersInHeadersCase1(t *testing.T) {
- svc := NewOutputService11ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte(""))
- req, out := svc.OutputService11TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
- req.HTTPResponse.Header.Set("x-char", "a")
- req.HTTPResponse.Header.Set("x-double", "1.5")
- req.HTTPResponse.Header.Set("x-false-bool", "false")
- req.HTTPResponse.Header.Set("x-float", "1.5")
- req.HTTPResponse.Header.Set("x-int", "1")
- req.HTTPResponse.Header.Set("x-long", "100")
- req.HTTPResponse.Header.Set("x-str", "string")
- req.HTTPResponse.Header.Set("x-timestamp", "Sun, 25 Jan 2015 08:00:00 GMT")
- req.HTTPResponse.Header.Set("x-true-bool", "true")
-
- // unmarshal response
- restxml.UnmarshalMeta(req)
- restxml.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "a", *out.Char; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := 1.5, *out.Double; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := false, *out.FalseBool; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := 1.5, *out.Float; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := int64(1), *out.Integer; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := int64(100), *out.Long; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "string", *out.Str; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := time.Unix(1.4221728e+09, 0).UTC().String(), out.Timestamp.UTC().String(); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := true, *out.TrueBool; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService12ProtocolTestEmptyStringCase1(t *testing.T) {
- svc := NewOutputService12ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResponse><Foo/><RequestId>requestid</RequestId></OperationNameResponse>"))
- req, out := svc.OutputService12TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- restxml.UnmarshalMeta(req)
- restxml.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "", *out.Foo; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService13ProtocolTestEnumCase1(t *testing.T) {
- svc := NewOutputService13ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<OperationNameResponse><FooEnum>foo</FooEnum><ListEnums><member>0</member><member>1</member></ListEnums></OperationNameResponse>"))
- req, out := svc.OutputService13TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
- req.HTTPResponse.Header.Set("x-amz-enum", "baz")
-
- // unmarshal response
- restxml.UnmarshalMeta(req)
- restxml.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "foo", *out.FooEnum; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "baz", *out.HeaderEnum; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "0", *out.ListEnums[0]; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "1", *out.ListEnums[1]; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
-
-func TestOutputService13ProtocolTestEnumCase2(t *testing.T) {
- svc := NewOutputService13ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte(""))
- req, out := svc.OutputService13TestCaseOperation2Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- restxml.UnmarshalMeta(req)
- restxml.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
-
-}
-
-func TestOutputService14ProtocolTestXMLAttributesCase1(t *testing.T) {
- svc := NewOutputService14ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
-
- buf := bytes.NewReader([]byte("<SomeOutputDoc xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\"><ItemsList><Item><ItemDetail xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"Type1\"><ID>id1</ID></ItemDetail></Item><Item><ItemDetail xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"Type2\"><ID>id2</ID></ItemDetail></Item><Item><ItemDetail xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"Type3\"><ID>id3</ID></ItemDetail></Item></ItemsList></SomeOutputDoc>"))
- req, out := svc.OutputService14TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- restxml.UnmarshalMeta(req)
- restxml.Unmarshal(req)
- if req.Error != nil {
- t.Errorf("expect not error, got %v", req.Error)
- }
-
- // assert response
- if out == nil {
- t.Errorf("expect not to be nil")
- }
- if e, a := "id1", *out.ListItems[0].ItemDetail.ID; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "Type1", *out.ListItems[0].ItemDetail.Type; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "id2", *out.ListItems[1].ItemDetail.ID; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "Type2", *out.ListItems[1].ItemDetail.Type; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "id3", *out.ListItems[2].ItemDetail.ID; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
- if e, a := "Type3", *out.ListItems[2].ItemDetail.Type; e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal_test.go
deleted file mode 100644
index 2733e993d..000000000
--- a/vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal_test.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package protocol_test
-
-import (
- "net/http"
- "strings"
- "testing"
-
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/private/protocol"
- "github.com/stretchr/testify/assert"
-)
-
-type mockCloser struct {
- *strings.Reader
- Closed bool
-}
-
-func (m *mockCloser) Close() error {
- m.Closed = true
- return nil
-}
-
-func TestUnmarshalDrainBody(t *testing.T) {
- b := &mockCloser{Reader: strings.NewReader("example body")}
- r := &request.Request{HTTPResponse: &http.Response{
- Body: b,
- }}
-
- protocol.UnmarshalDiscardBody(r)
- assert.NoError(t, r.Error)
- assert.Equal(t, 0, b.Len())
- assert.True(t, b.Closed)
-}
-
-func TestUnmarshalDrainBodyNoBody(t *testing.T) {
- r := &request.Request{HTTPResponse: &http.Response{}}
-
- protocol.UnmarshalDiscardBody(r)
- assert.NoError(t, r.Error)
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal_test.go
deleted file mode 100644
index 1185d2328..000000000
--- a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal_test.go
+++ /dev/null
@@ -1,142 +0,0 @@
-package xmlutil
-
-import (
- "encoding/xml"
- "fmt"
- "io"
- "reflect"
- "strings"
- "testing"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/awsutil"
-)
-
-type mockBody struct {
- DoneErr error
- Body io.Reader
-}
-
-func (m *mockBody) Read(p []byte) (int, error) {
- n, err := m.Body.Read(p)
- if (n == 0 || err == io.EOF) && m.DoneErr != nil {
- return n, m.DoneErr
- }
-
- return n, err
-}
-
-type mockOutput struct {
- _ struct{} `type:"structure"`
- String *string `type:"string"`
- Integer *int64 `type:"integer"`
- Nested *mockNestedStruct `type:"structure"`
- List []*mockListElem `locationName:"List" locationNameList:"Elem" type:"list"`
- Closed *mockClosedTags `type:"structure"`
-}
-type mockNestedStruct struct {
- _ struct{} `type:"structure"`
- NestedString *string `type:"string"`
- NestedInt *int64 `type:"integer"`
-}
-type mockClosedTags struct {
- _ struct{} `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"`
- Attr *string `locationName:"xsi:attrval" type:"string" xmlAttribute:"true"`
-}
-type mockListElem struct {
- _ struct{} `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"`
- String *string `type:"string"`
- NestedElem *mockNestedListElem `type:"structure"`
-}
-type mockNestedListElem struct {
- _ struct{} `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"`
-
- String *string `type:"string"`
- Type *string `locationName:"xsi:type" type:"string" xmlAttribute:"true"`
-}
-
-func TestUnmarshal(t *testing.T) {
- const xmlBodyStr = `<?xml version="1.0" encoding="UTF-8"?>
-<MockResponse xmlns="http://xmlns.example.com">
- <String>string value</String>
- <Integer>123</Integer>
- <Closed xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:attrval="attr value"/>
- <Nested>
- <NestedString>nested string value</NestedString>
- <NestedInt>321</NestedInt>
- </Nested>
- <List>
- <Elem>
- <NestedElem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="type">
- <String>nested elem string value</String>
- </NestedElem>
- <String>elem string value</String>
- </Elem>
- </List>
-</MockResponse>`
-
- expect := mockOutput{
- String: aws.String("string value"),
- Integer: aws.Int64(123),
- Closed: &mockClosedTags{
- Attr: aws.String("attr value"),
- },
- Nested: &mockNestedStruct{
- NestedString: aws.String("nested string value"),
- NestedInt: aws.Int64(321),
- },
- List: []*mockListElem{
- {
- String: aws.String("elem string value"),
- NestedElem: &mockNestedListElem{
- String: aws.String("nested elem string value"),
- Type: aws.String("type"),
- },
- },
- },
- }
-
- actual := mockOutput{}
- decoder := xml.NewDecoder(strings.NewReader(xmlBodyStr))
- err := UnmarshalXML(&actual, decoder, "")
- if err != nil {
- t.Fatalf("expect no error, got %v", err)
- }
-
- if !reflect.DeepEqual(expect, actual) {
- t.Errorf("expect unmarshal to match\nExpect: %s\nActual: %s",
- awsutil.Prettify(expect), awsutil.Prettify(actual))
- }
-}
-
-func TestUnmarshal_UnexpectedEOF(t *testing.T) {
- const partialXMLBody = `<?xml version="1.0" encoding="UTF-8"?>
- <First>first value</First>
- <Second>Second val`
-
- out := struct {
- First *string `locationName:"First" type:"string"`
- Second *string `locationName:"Second" type:"string"`
- }{}
-
- expect := out
- expect.First = aws.String("first")
- expect.Second = aws.String("second")
-
- expectErr := fmt.Errorf("expected read error")
-
- body := &mockBody{
- DoneErr: expectErr,
- Body: strings.NewReader(partialXMLBody),
- }
-
- decoder := xml.NewDecoder(body)
- err := UnmarshalXML(&out, decoder, "")
-
- if err == nil {
- t.Fatalf("expect error, got none")
- }
- if e, a := expectErr, err; e != a {
- t.Errorf("expect %v error in %v, but was not", e, a)
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/service/route53/customizations_test.go b/vendor/github.com/aws/aws-sdk-go/service/route53/customizations_test.go
deleted file mode 100644
index 2823b26d6..000000000
--- a/vendor/github.com/aws/aws-sdk-go/service/route53/customizations_test.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package route53_test
-
-import (
- "testing"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/awstesting/unit"
- "github.com/aws/aws-sdk-go/service/route53"
-)
-
-func TestBuildCorrectURI(t *testing.T) {
- const expectPath = "/2013-04-01/hostedzone/ABCDEFG"
-
- svc := route53.New(unit.Session)
- svc.Handlers.Validate.Clear()
- req, _ := svc.GetHostedZoneRequest(&route53.GetHostedZoneInput{
- Id: aws.String("/hostedzone/ABCDEFG"),
- })
-
- req.HTTPRequest.URL.RawQuery = "abc=123"
-
- req.Build()
-
- if a, e := req.HTTPRequest.URL.Path, expectPath; a != e {
- t.Errorf("expect path %q, got %q", e, a)
- }
-
- if a, e := req.HTTPRequest.URL.RawPath, expectPath; a != e {
- t.Errorf("expect raw path %q, got %q", e, a)
- }
-
- if a, e := req.HTTPRequest.URL.RawQuery, "abc=123"; a != e {
- t.Errorf("expect query to be %q, got %q", e, a)
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/service/route53/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/route53/examples_test.go
deleted file mode 100644
index 06111c42c..000000000
--- a/vendor/github.com/aws/aws-sdk-go/service/route53/examples_test.go
+++ /dev/null
@@ -1,936 +0,0 @@
-// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
-
-package route53_test
-
-import (
- "fmt"
- "strings"
- "time"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/awserr"
- "github.com/aws/aws-sdk-go/aws/session"
- "github.com/aws/aws-sdk-go/service/route53"
-)
-
-var _ time.Duration
-var _ strings.Reader
-var _ aws.Config
-
-func parseTime(layout, value string) *time.Time {
- t, err := time.Parse(layout, value)
- if err != nil {
- panic(err)
- }
- return &t
-}
-
-// To associate a VPC with a hosted zone
-//
-// The following example associates the VPC with ID vpc-1a2b3c4d with the hosted zone
-// with ID Z3M3LMPEXAMPLE.
-func ExampleRoute53_AssociateVPCWithHostedZone_shared00() {
- svc := route53.New(session.New())
- input := &route53.AssociateVPCWithHostedZoneInput{
- Comment: aws.String(""),
- HostedZoneId: aws.String("Z3M3LMPEXAMPLE"),
- VPC: &route53.VPC{
- VPCId: aws.String("vpc-1a2b3c4d"),
- VPCRegion: aws.String("us-east-2"),
- },
- }
-
- result, err := svc.AssociateVPCWithHostedZone(input)
- if err != nil {
- if aerr, ok := err.(awserr.Error); ok {
- switch aerr.Code() {
- case route53.ErrCodeNoSuchHostedZone:
- fmt.Println(route53.ErrCodeNoSuchHostedZone, aerr.Error())
- case route53.ErrCodeNotAuthorizedException:
- fmt.Println(route53.ErrCodeNotAuthorizedException, aerr.Error())
- case route53.ErrCodeInvalidVPCId:
- fmt.Println(route53.ErrCodeInvalidVPCId, aerr.Error())
- case route53.ErrCodeInvalidInput:
- fmt.Println(route53.ErrCodeInvalidInput, aerr.Error())
- case route53.ErrCodePublicZoneVPCAssociation:
- fmt.Println(route53.ErrCodePublicZoneVPCAssociation, aerr.Error())
- case route53.ErrCodeConflictingDomainExists:
- fmt.Println(route53.ErrCodeConflictingDomainExists, aerr.Error())
- case route53.ErrCodeLimitsExceeded:
- fmt.Println(route53.ErrCodeLimitsExceeded, aerr.Error())
- default:
- fmt.Println(aerr.Error())
- }
- } else {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- }
- return
- }
-
- fmt.Println(result)
-}
-
-// To create a basic resource record set
-//
-// The following example creates a resource record set that routes Internet traffic
-// to a resource with an IP address of 192.0.2.44.
-func ExampleRoute53_ChangeResourceRecordSets_shared00() {
- svc := route53.New(session.New())
- input := &route53.ChangeResourceRecordSetsInput{
- ChangeBatch: &route53.ChangeBatch{
- Changes: []*route53.Change{
- {
- Action: aws.String("CREATE"),
- ResourceRecordSet: &route53.ResourceRecordSet{
- Name: aws.String("example.com"),
- ResourceRecords: []*route53.ResourceRecord{
- {
- Value: aws.String("192.0.2.44"),
- },
- },
- TTL: aws.Int64(60),
- Type: aws.String("A"),
- },
- },
- },
- Comment: aws.String("Web server for example.com"),
- },
- HostedZoneId: aws.String("Z3M3LMPEXAMPLE"),
- }
-
- result, err := svc.ChangeResourceRecordSets(input)
- if err != nil {
- if aerr, ok := err.(awserr.Error); ok {
- switch aerr.Code() {
- case route53.ErrCodeNoSuchHostedZone:
- fmt.Println(route53.ErrCodeNoSuchHostedZone, aerr.Error())
- case route53.ErrCodeNoSuchHealthCheck:
- fmt.Println(route53.ErrCodeNoSuchHealthCheck, aerr.Error())
- case route53.ErrCodeInvalidChangeBatch:
- fmt.Println(route53.ErrCodeInvalidChangeBatch, aerr.Error())
- case route53.ErrCodeInvalidInput:
- fmt.Println(route53.ErrCodeInvalidInput, aerr.Error())
- case route53.ErrCodePriorRequestNotComplete:
- fmt.Println(route53.ErrCodePriorRequestNotComplete, aerr.Error())
- default:
- fmt.Println(aerr.Error())
- }
- } else {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- }
- return
- }
-
- fmt.Println(result)
-}
-
-// To create weighted resource record sets
-//
-// The following example creates two weighted resource record sets. The resource with
-// a Weight of 100 will get 1/3rd of traffic (100/100+200), and the other resource will
-// get the rest of the traffic for example.com.
-func ExampleRoute53_ChangeResourceRecordSets_shared01() {
- svc := route53.New(session.New())
- input := &route53.ChangeResourceRecordSetsInput{
- ChangeBatch: &route53.ChangeBatch{
- Changes: []*route53.Change{
- {
- Action: aws.String("CREATE"),
- ResourceRecordSet: &route53.ResourceRecordSet{
- HealthCheckId: aws.String("abcdef11-2222-3333-4444-555555fedcba"),
- Name: aws.String("example.com"),
- ResourceRecords: []*route53.ResourceRecord{
- {
- Value: aws.String("192.0.2.44"),
- },
- },
- SetIdentifier: aws.String("Seattle data center"),
- TTL: aws.Int64(60),
- Type: aws.String("A"),
- Weight: aws.Int64(100),
- },
- },
- {
- Action: aws.String("CREATE"),
- ResourceRecordSet: &route53.ResourceRecordSet{
- HealthCheckId: aws.String("abcdef66-7777-8888-9999-000000fedcba"),
- Name: aws.String("example.com"),
- ResourceRecords: []*route53.ResourceRecord{
- {
- Value: aws.String("192.0.2.45"),
- },
- },
- SetIdentifier: aws.String("Portland data center"),
- TTL: aws.Int64(60),
- Type: aws.String("A"),
- Weight: aws.Int64(200),
- },
- },
- },
- Comment: aws.String("Web servers for example.com"),
- },
- HostedZoneId: aws.String("Z3M3LMPEXAMPLE"),
- }
-
- result, err := svc.ChangeResourceRecordSets(input)
- if err != nil {
- if aerr, ok := err.(awserr.Error); ok {
- switch aerr.Code() {
- case route53.ErrCodeNoSuchHostedZone:
- fmt.Println(route53.ErrCodeNoSuchHostedZone, aerr.Error())
- case route53.ErrCodeNoSuchHealthCheck:
- fmt.Println(route53.ErrCodeNoSuchHealthCheck, aerr.Error())
- case route53.ErrCodeInvalidChangeBatch:
- fmt.Println(route53.ErrCodeInvalidChangeBatch, aerr.Error())
- case route53.ErrCodeInvalidInput:
- fmt.Println(route53.ErrCodeInvalidInput, aerr.Error())
- case route53.ErrCodePriorRequestNotComplete:
- fmt.Println(route53.ErrCodePriorRequestNotComplete, aerr.Error())
- default:
- fmt.Println(aerr.Error())
- }
- } else {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- }
- return
- }
-
- fmt.Println(result)
-}
-
-// To create an alias resource record set
-//
-// The following example creates an alias resource record set that routes traffic to
-// a CloudFront distribution.
-func ExampleRoute53_ChangeResourceRecordSets_shared02() {
- svc := route53.New(session.New())
- input := &route53.ChangeResourceRecordSetsInput{
- ChangeBatch: &route53.ChangeBatch{
- Changes: []*route53.Change{
- {
- Action: aws.String("CREATE"),
- ResourceRecordSet: &route53.ResourceRecordSet{
- AliasTarget: &route53.AliasTarget{
- DNSName: aws.String("d123rk29d0stfj.cloudfront.net"),
- EvaluateTargetHealth: aws.Bool(false),
- HostedZoneId: aws.String("Z2FDTNDATAQYW2"),
- },
- Name: aws.String("example.com"),
- Type: aws.String("A"),
- },
- },
- },
- Comment: aws.String("CloudFront distribution for example.com"),
- },
- HostedZoneId: aws.String("Z3M3LMPEXAMPLE"),
- }
-
- result, err := svc.ChangeResourceRecordSets(input)
- if err != nil {
- if aerr, ok := err.(awserr.Error); ok {
- switch aerr.Code() {
- case route53.ErrCodeNoSuchHostedZone:
- fmt.Println(route53.ErrCodeNoSuchHostedZone, aerr.Error())
- case route53.ErrCodeNoSuchHealthCheck:
- fmt.Println(route53.ErrCodeNoSuchHealthCheck, aerr.Error())
- case route53.ErrCodeInvalidChangeBatch:
- fmt.Println(route53.ErrCodeInvalidChangeBatch, aerr.Error())
- case route53.ErrCodeInvalidInput:
- fmt.Println(route53.ErrCodeInvalidInput, aerr.Error())
- case route53.ErrCodePriorRequestNotComplete:
- fmt.Println(route53.ErrCodePriorRequestNotComplete, aerr.Error())
- default:
- fmt.Println(aerr.Error())
- }
- } else {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- }
- return
- }
-
- fmt.Println(result)
-}
-
-// To create weighted alias resource record sets
-//
-// The following example creates two weighted alias resource record sets that route
-// traffic to ELB load balancers. The resource with a Weight of 100 will get 1/3rd of
-// traffic (100/100+200), and the other resource will get the rest of the traffic for
-// example.com.
-func ExampleRoute53_ChangeResourceRecordSets_shared03() {
- svc := route53.New(session.New())
- input := &route53.ChangeResourceRecordSetsInput{
- ChangeBatch: &route53.ChangeBatch{
- Changes: []*route53.Change{
- {
- Action: aws.String("CREATE"),
- ResourceRecordSet: &route53.ResourceRecordSet{
- AliasTarget: &route53.AliasTarget{
- DNSName: aws.String("example-com-123456789.us-east-2.elb.amazonaws.com "),
- EvaluateTargetHealth: aws.Bool(true),
- HostedZoneId: aws.String("Z3AADJGX6KTTL2"),
- },
- Name: aws.String("example.com"),
- SetIdentifier: aws.String("Ohio region"),
- Type: aws.String("A"),
- Weight: aws.Int64(100),
- },
- },
- {
- Action: aws.String("CREATE"),
- ResourceRecordSet: &route53.ResourceRecordSet{
- AliasTarget: &route53.AliasTarget{
- DNSName: aws.String("example-com-987654321.us-west-2.elb.amazonaws.com "),
- EvaluateTargetHealth: aws.Bool(true),
- HostedZoneId: aws.String("Z1H1FL5HABSF5"),
- },
- Name: aws.String("example.com"),
- SetIdentifier: aws.String("Oregon region"),
- Type: aws.String("A"),
- Weight: aws.Int64(200),
- },
- },
- },
- Comment: aws.String("ELB load balancers for example.com"),
- },
- HostedZoneId: aws.String("Z3M3LMPEXAMPLE"),
- }
-
- result, err := svc.ChangeResourceRecordSets(input)
- if err != nil {
- if aerr, ok := err.(awserr.Error); ok {
- switch aerr.Code() {
- case route53.ErrCodeNoSuchHostedZone:
- fmt.Println(route53.ErrCodeNoSuchHostedZone, aerr.Error())
- case route53.ErrCodeNoSuchHealthCheck:
- fmt.Println(route53.ErrCodeNoSuchHealthCheck, aerr.Error())
- case route53.ErrCodeInvalidChangeBatch:
- fmt.Println(route53.ErrCodeInvalidChangeBatch, aerr.Error())
- case route53.ErrCodeInvalidInput:
- fmt.Println(route53.ErrCodeInvalidInput, aerr.Error())
- case route53.ErrCodePriorRequestNotComplete:
- fmt.Println(route53.ErrCodePriorRequestNotComplete, aerr.Error())
- default:
- fmt.Println(aerr.Error())
- }
- } else {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- }
- return
- }
-
- fmt.Println(result)
-}
-
-// To create latency resource record sets
-//
-// The following example creates two latency resource record sets that route traffic
-// to EC2 instances. Traffic for example.com is routed either to the Ohio region or
-// the Oregon region, depending on the latency between the user and those regions.
-func ExampleRoute53_ChangeResourceRecordSets_shared04() {
- svc := route53.New(session.New())
- input := &route53.ChangeResourceRecordSetsInput{
- ChangeBatch: &route53.ChangeBatch{
- Changes: []*route53.Change{
- {
- Action: aws.String("CREATE"),
- ResourceRecordSet: &route53.ResourceRecordSet{
- HealthCheckId: aws.String("abcdef11-2222-3333-4444-555555fedcba"),
- Name: aws.String("example.com"),
- Region: aws.String("us-east-2"),
- ResourceRecords: []*route53.ResourceRecord{
- {
- Value: aws.String("192.0.2.44"),
- },
- },
- SetIdentifier: aws.String("Ohio region"),
- TTL: aws.Int64(60),
- Type: aws.String("A"),
- },
- },
- {
- Action: aws.String("CREATE"),
- ResourceRecordSet: &route53.ResourceRecordSet{
- HealthCheckId: aws.String("abcdef66-7777-8888-9999-000000fedcba"),
- Name: aws.String("example.com"),
- Region: aws.String("us-west-2"),
- ResourceRecords: []*route53.ResourceRecord{
- {
- Value: aws.String("192.0.2.45"),
- },
- },
- SetIdentifier: aws.String("Oregon region"),
- TTL: aws.Int64(60),
- Type: aws.String("A"),
- },
- },
- },
- Comment: aws.String("EC2 instances for example.com"),
- },
- HostedZoneId: aws.String("Z3M3LMPEXAMPLE"),
- }
-
- result, err := svc.ChangeResourceRecordSets(input)
- if err != nil {
- if aerr, ok := err.(awserr.Error); ok {
- switch aerr.Code() {
- case route53.ErrCodeNoSuchHostedZone:
- fmt.Println(route53.ErrCodeNoSuchHostedZone, aerr.Error())
- case route53.ErrCodeNoSuchHealthCheck:
- fmt.Println(route53.ErrCodeNoSuchHealthCheck, aerr.Error())
- case route53.ErrCodeInvalidChangeBatch:
- fmt.Println(route53.ErrCodeInvalidChangeBatch, aerr.Error())
- case route53.ErrCodeInvalidInput:
- fmt.Println(route53.ErrCodeInvalidInput, aerr.Error())
- case route53.ErrCodePriorRequestNotComplete:
- fmt.Println(route53.ErrCodePriorRequestNotComplete, aerr.Error())
- default:
- fmt.Println(aerr.Error())
- }
- } else {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- }
- return
- }
-
- fmt.Println(result)
-}
-
-// To create latency alias resource record sets
-//
-// The following example creates two latency alias resource record sets that route traffic
-// for example.com to ELB load balancers. Requests are routed either to the Ohio region
-// or the Oregon region, depending on the latency between the user and those regions.
-func ExampleRoute53_ChangeResourceRecordSets_shared05() {
- svc := route53.New(session.New())
- input := &route53.ChangeResourceRecordSetsInput{
- ChangeBatch: &route53.ChangeBatch{
- Changes: []*route53.Change{
- {
- Action: aws.String("CREATE"),
- ResourceRecordSet: &route53.ResourceRecordSet{
- AliasTarget: &route53.AliasTarget{
- DNSName: aws.String("example-com-123456789.us-east-2.elb.amazonaws.com "),
- EvaluateTargetHealth: aws.Bool(true),
- HostedZoneId: aws.String("Z3AADJGX6KTTL2"),
- },
- Name: aws.String("example.com"),
- Region: aws.String("us-east-2"),
- SetIdentifier: aws.String("Ohio region"),
- Type: aws.String("A"),
- },
- },
- {
- Action: aws.String("CREATE"),
- ResourceRecordSet: &route53.ResourceRecordSet{
- AliasTarget: &route53.AliasTarget{
- DNSName: aws.String("example-com-987654321.us-west-2.elb.amazonaws.com "),
- EvaluateTargetHealth: aws.Bool(true),
- HostedZoneId: aws.String("Z1H1FL5HABSF5"),
- },
- Name: aws.String("example.com"),
- Region: aws.String("us-west-2"),
- SetIdentifier: aws.String("Oregon region"),
- Type: aws.String("A"),
- },
- },
- },
- Comment: aws.String("ELB load balancers for example.com"),
- },
- HostedZoneId: aws.String("Z3M3LMPEXAMPLE"),
- }
-
- result, err := svc.ChangeResourceRecordSets(input)
- if err != nil {
- if aerr, ok := err.(awserr.Error); ok {
- switch aerr.Code() {
- case route53.ErrCodeNoSuchHostedZone:
- fmt.Println(route53.ErrCodeNoSuchHostedZone, aerr.Error())
- case route53.ErrCodeNoSuchHealthCheck:
- fmt.Println(route53.ErrCodeNoSuchHealthCheck, aerr.Error())
- case route53.ErrCodeInvalidChangeBatch:
- fmt.Println(route53.ErrCodeInvalidChangeBatch, aerr.Error())
- case route53.ErrCodeInvalidInput:
- fmt.Println(route53.ErrCodeInvalidInput, aerr.Error())
- case route53.ErrCodePriorRequestNotComplete:
- fmt.Println(route53.ErrCodePriorRequestNotComplete, aerr.Error())
- default:
- fmt.Println(aerr.Error())
- }
- } else {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- }
- return
- }
-
- fmt.Println(result)
-}
-
-// To create failover resource record sets
-//
-// The following example creates primary and secondary failover resource record sets
-// that route traffic to EC2 instances. Traffic is generally routed to the primary resource,
-// in the Ohio region. If that resource is unavailable, traffic is routed to the secondary
-// resource, in the Oregon region.
-func ExampleRoute53_ChangeResourceRecordSets_shared06() {
- svc := route53.New(session.New())
- input := &route53.ChangeResourceRecordSetsInput{
- ChangeBatch: &route53.ChangeBatch{
- Changes: []*route53.Change{
- {
- Action: aws.String("CREATE"),
- ResourceRecordSet: &route53.ResourceRecordSet{
- Failover: aws.String("PRIMARY"),
- HealthCheckId: aws.String("abcdef11-2222-3333-4444-555555fedcba"),
- Name: aws.String("example.com"),
- ResourceRecords: []*route53.ResourceRecord{
- {
- Value: aws.String("192.0.2.44"),
- },
- },
- SetIdentifier: aws.String("Ohio region"),
- TTL: aws.Int64(60),
- Type: aws.String("A"),
- },
- },
- {
- Action: aws.String("CREATE"),
- ResourceRecordSet: &route53.ResourceRecordSet{
- Failover: aws.String("SECONDARY"),
- HealthCheckId: aws.String("abcdef66-7777-8888-9999-000000fedcba"),
- Name: aws.String("example.com"),
- ResourceRecords: []*route53.ResourceRecord{
- {
- Value: aws.String("192.0.2.45"),
- },
- },
- SetIdentifier: aws.String("Oregon region"),
- TTL: aws.Int64(60),
- Type: aws.String("A"),
- },
- },
- },
- Comment: aws.String("Failover configuration for example.com"),
- },
- HostedZoneId: aws.String("Z3M3LMPEXAMPLE"),
- }
-
- result, err := svc.ChangeResourceRecordSets(input)
- if err != nil {
- if aerr, ok := err.(awserr.Error); ok {
- switch aerr.Code() {
- case route53.ErrCodeNoSuchHostedZone:
- fmt.Println(route53.ErrCodeNoSuchHostedZone, aerr.Error())
- case route53.ErrCodeNoSuchHealthCheck:
- fmt.Println(route53.ErrCodeNoSuchHealthCheck, aerr.Error())
- case route53.ErrCodeInvalidChangeBatch:
- fmt.Println(route53.ErrCodeInvalidChangeBatch, aerr.Error())
- case route53.ErrCodeInvalidInput:
- fmt.Println(route53.ErrCodeInvalidInput, aerr.Error())
- case route53.ErrCodePriorRequestNotComplete:
- fmt.Println(route53.ErrCodePriorRequestNotComplete, aerr.Error())
- default:
- fmt.Println(aerr.Error())
- }
- } else {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- }
- return
- }
-
- fmt.Println(result)
-}
-
-// To create failover alias resource record sets
-//
-// The following example creates primary and secondary failover alias resource record
-// sets that route traffic to ELB load balancers. Traffic is generally routed to the
-// primary resource, in the Ohio region. If that resource is unavailable, traffic is
-// routed to the secondary resource, in the Oregon region.
-func ExampleRoute53_ChangeResourceRecordSets_shared07() {
- svc := route53.New(session.New())
- input := &route53.ChangeResourceRecordSetsInput{
- ChangeBatch: &route53.ChangeBatch{
- Changes: []*route53.Change{
- {
- Action: aws.String("CREATE"),
- ResourceRecordSet: &route53.ResourceRecordSet{
- AliasTarget: &route53.AliasTarget{
- DNSName: aws.String("example-com-123456789.us-east-2.elb.amazonaws.com "),
- EvaluateTargetHealth: aws.Bool(true),
- HostedZoneId: aws.String("Z3AADJGX6KTTL2"),
- },
- Failover: aws.String("PRIMARY"),
- Name: aws.String("example.com"),
- SetIdentifier: aws.String("Ohio region"),
- Type: aws.String("A"),
- },
- },
- {
- Action: aws.String("CREATE"),
- ResourceRecordSet: &route53.ResourceRecordSet{
- AliasTarget: &route53.AliasTarget{
- DNSName: aws.String("example-com-987654321.us-west-2.elb.amazonaws.com "),
- EvaluateTargetHealth: aws.Bool(true),
- HostedZoneId: aws.String("Z1H1FL5HABSF5"),
- },
- Failover: aws.String("SECONDARY"),
- Name: aws.String("example.com"),
- SetIdentifier: aws.String("Oregon region"),
- Type: aws.String("A"),
- },
- },
- },
- Comment: aws.String("Failover alias configuration for example.com"),
- },
- HostedZoneId: aws.String("Z3M3LMPEXAMPLE"),
- }
-
- result, err := svc.ChangeResourceRecordSets(input)
- if err != nil {
- if aerr, ok := err.(awserr.Error); ok {
- switch aerr.Code() {
- case route53.ErrCodeNoSuchHostedZone:
- fmt.Println(route53.ErrCodeNoSuchHostedZone, aerr.Error())
- case route53.ErrCodeNoSuchHealthCheck:
- fmt.Println(route53.ErrCodeNoSuchHealthCheck, aerr.Error())
- case route53.ErrCodeInvalidChangeBatch:
- fmt.Println(route53.ErrCodeInvalidChangeBatch, aerr.Error())
- case route53.ErrCodeInvalidInput:
- fmt.Println(route53.ErrCodeInvalidInput, aerr.Error())
- case route53.ErrCodePriorRequestNotComplete:
- fmt.Println(route53.ErrCodePriorRequestNotComplete, aerr.Error())
- default:
- fmt.Println(aerr.Error())
- }
- } else {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- }
- return
- }
-
- fmt.Println(result)
-}
-
-// To create geolocation resource record sets
-//
-// The following example creates four geolocation resource record sets that use IPv4
-// addresses to route traffic to resources such as web servers running on EC2 instances.
-// Traffic is routed to one of four IP addresses, for North America (NA), for South
-// America (SA), for Europe (EU), and for all other locations (*).
-func ExampleRoute53_ChangeResourceRecordSets_shared08() {
- svc := route53.New(session.New())
- input := &route53.ChangeResourceRecordSetsInput{
- ChangeBatch: &route53.ChangeBatch{
- Changes: []*route53.Change{
- {
- Action: aws.String("CREATE"),
- ResourceRecordSet: &route53.ResourceRecordSet{
- GeoLocation: &route53.GeoLocation{
- ContinentCode: aws.String("NA"),
- },
- Name: aws.String("example.com"),
- ResourceRecords: []*route53.ResourceRecord{
- {
- Value: aws.String("192.0.2.44"),
- },
- },
- SetIdentifier: aws.String("North America"),
- TTL: aws.Int64(60),
- Type: aws.String("A"),
- },
- },
- {
- Action: aws.String("CREATE"),
- ResourceRecordSet: &route53.ResourceRecordSet{
- GeoLocation: &route53.GeoLocation{
- ContinentCode: aws.String("SA"),
- },
- Name: aws.String("example.com"),
- ResourceRecords: []*route53.ResourceRecord{
- {
- Value: aws.String("192.0.2.45"),
- },
- },
- SetIdentifier: aws.String("South America"),
- TTL: aws.Int64(60),
- Type: aws.String("A"),
- },
- },
- {
- Action: aws.String("CREATE"),
- ResourceRecordSet: &route53.ResourceRecordSet{
- GeoLocation: &route53.GeoLocation{
- ContinentCode: aws.String("EU"),
- },
- Name: aws.String("example.com"),
- ResourceRecords: []*route53.ResourceRecord{
- {
- Value: aws.String("192.0.2.46"),
- },
- },
- SetIdentifier: aws.String("Europe"),
- TTL: aws.Int64(60),
- Type: aws.String("A"),
- },
- },
- {
- Action: aws.String("CREATE"),
- ResourceRecordSet: &route53.ResourceRecordSet{
- GeoLocation: &route53.GeoLocation{
- CountryCode: aws.String("*"),
- },
- Name: aws.String("example.com"),
- ResourceRecords: []*route53.ResourceRecord{
- {
- Value: aws.String("192.0.2.47"),
- },
- },
- SetIdentifier: aws.String("Other locations"),
- TTL: aws.Int64(60),
- Type: aws.String("A"),
- },
- },
- },
- Comment: aws.String("Geolocation configuration for example.com"),
- },
- HostedZoneId: aws.String("Z3M3LMPEXAMPLE"),
- }
-
- result, err := svc.ChangeResourceRecordSets(input)
- if err != nil {
- if aerr, ok := err.(awserr.Error); ok {
- switch aerr.Code() {
- case route53.ErrCodeNoSuchHostedZone:
- fmt.Println(route53.ErrCodeNoSuchHostedZone, aerr.Error())
- case route53.ErrCodeNoSuchHealthCheck:
- fmt.Println(route53.ErrCodeNoSuchHealthCheck, aerr.Error())
- case route53.ErrCodeInvalidChangeBatch:
- fmt.Println(route53.ErrCodeInvalidChangeBatch, aerr.Error())
- case route53.ErrCodeInvalidInput:
- fmt.Println(route53.ErrCodeInvalidInput, aerr.Error())
- case route53.ErrCodePriorRequestNotComplete:
- fmt.Println(route53.ErrCodePriorRequestNotComplete, aerr.Error())
- default:
- fmt.Println(aerr.Error())
- }
- } else {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- }
- return
- }
-
- fmt.Println(result)
-}
-
-// To create geolocation alias resource record sets
-//
-// The following example creates four geolocation alias resource record sets that route
-// traffic to ELB load balancers. Traffic is routed to one of four IP addresses, for
-// North America (NA), for South America (SA), for Europe (EU), and for all other locations
-// (*).
-func ExampleRoute53_ChangeResourceRecordSets_shared09() {
- svc := route53.New(session.New())
- input := &route53.ChangeResourceRecordSetsInput{
- ChangeBatch: &route53.ChangeBatch{
- Changes: []*route53.Change{
- {
- Action: aws.String("CREATE"),
- ResourceRecordSet: &route53.ResourceRecordSet{
- AliasTarget: &route53.AliasTarget{
- DNSName: aws.String("example-com-123456789.us-east-2.elb.amazonaws.com "),
- EvaluateTargetHealth: aws.Bool(true),
- HostedZoneId: aws.String("Z3AADJGX6KTTL2"),
- },
- GeoLocation: &route53.GeoLocation{
- ContinentCode: aws.String("NA"),
- },
- Name: aws.String("example.com"),
- SetIdentifier: aws.String("North America"),
- Type: aws.String("A"),
- },
- },
- {
- Action: aws.String("CREATE"),
- ResourceRecordSet: &route53.ResourceRecordSet{
- AliasTarget: &route53.AliasTarget{
- DNSName: aws.String("example-com-234567890.sa-east-1.elb.amazonaws.com "),
- EvaluateTargetHealth: aws.Bool(true),
- HostedZoneId: aws.String("Z2P70J7HTTTPLU"),
- },
- GeoLocation: &route53.GeoLocation{
- ContinentCode: aws.String("SA"),
- },
- Name: aws.String("example.com"),
- SetIdentifier: aws.String("South America"),
- Type: aws.String("A"),
- },
- },
- {
- Action: aws.String("CREATE"),
- ResourceRecordSet: &route53.ResourceRecordSet{
- AliasTarget: &route53.AliasTarget{
- DNSName: aws.String("example-com-234567890.eu-central-1.elb.amazonaws.com "),
- EvaluateTargetHealth: aws.Bool(true),
- HostedZoneId: aws.String("Z215JYRZR1TBD5"),
- },
- GeoLocation: &route53.GeoLocation{
- ContinentCode: aws.String("EU"),
- },
- Name: aws.String("example.com"),
- SetIdentifier: aws.String("Europe"),
- Type: aws.String("A"),
- },
- },
- {
- Action: aws.String("CREATE"),
- ResourceRecordSet: &route53.ResourceRecordSet{
- AliasTarget: &route53.AliasTarget{
- DNSName: aws.String("example-com-234567890.ap-southeast-1.elb.amazonaws.com "),
- EvaluateTargetHealth: aws.Bool(true),
- HostedZoneId: aws.String("Z1LMS91P8CMLE5"),
- },
- GeoLocation: &route53.GeoLocation{
- CountryCode: aws.String("*"),
- },
- Name: aws.String("example.com"),
- SetIdentifier: aws.String("Other locations"),
- Type: aws.String("A"),
- },
- },
- },
- Comment: aws.String("Geolocation alias configuration for example.com"),
- },
- HostedZoneId: aws.String("Z3M3LMPEXAMPLE"),
- }
-
- result, err := svc.ChangeResourceRecordSets(input)
- if err != nil {
- if aerr, ok := err.(awserr.Error); ok {
- switch aerr.Code() {
- case route53.ErrCodeNoSuchHostedZone:
- fmt.Println(route53.ErrCodeNoSuchHostedZone, aerr.Error())
- case route53.ErrCodeNoSuchHealthCheck:
- fmt.Println(route53.ErrCodeNoSuchHealthCheck, aerr.Error())
- case route53.ErrCodeInvalidChangeBatch:
- fmt.Println(route53.ErrCodeInvalidChangeBatch, aerr.Error())
- case route53.ErrCodeInvalidInput:
- fmt.Println(route53.ErrCodeInvalidInput, aerr.Error())
- case route53.ErrCodePriorRequestNotComplete:
- fmt.Println(route53.ErrCodePriorRequestNotComplete, aerr.Error())
- default:
- fmt.Println(aerr.Error())
- }
- } else {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- }
- return
- }
-
- fmt.Println(result)
-}
-
-// To add or remove tags from a hosted zone or health check
-//
-// The following example adds two tags and removes one tag from the hosted zone with
-// ID Z3M3LMPEXAMPLE.
-func ExampleRoute53_ChangeTagsForResource_shared00() {
- svc := route53.New(session.New())
- input := &route53.ChangeTagsForResourceInput{
- AddTags: []*route53.Tag{
- {
- Key: aws.String("apex"),
- Value: aws.String("3874"),
- },
- {
- Key: aws.String("acme"),
- Value: aws.String("4938"),
- },
- },
- RemoveTagKeys: []*string{
- aws.String("Nadir"),
- },
- ResourceId: aws.String("Z3M3LMPEXAMPLE"),
- ResourceType: aws.String("hostedzone"),
- }
-
- result, err := svc.ChangeTagsForResource(input)
- if err != nil {
- if aerr, ok := err.(awserr.Error); ok {
- switch aerr.Code() {
- case route53.ErrCodeInvalidInput:
- fmt.Println(route53.ErrCodeInvalidInput, aerr.Error())
- case route53.ErrCodeNoSuchHealthCheck:
- fmt.Println(route53.ErrCodeNoSuchHealthCheck, aerr.Error())
- case route53.ErrCodeNoSuchHostedZone:
- fmt.Println(route53.ErrCodeNoSuchHostedZone, aerr.Error())
- case route53.ErrCodePriorRequestNotComplete:
- fmt.Println(route53.ErrCodePriorRequestNotComplete, aerr.Error())
- case route53.ErrCodeThrottlingException:
- fmt.Println(route53.ErrCodeThrottlingException, aerr.Error())
- default:
- fmt.Println(aerr.Error())
- }
- } else {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- }
- return
- }
-
- fmt.Println(result)
-}
-
-// To get information about a hosted zone
-//
-// The following example gets information about the Z3M3LMPEXAMPLE hosted zone.
-func ExampleRoute53_GetHostedZone_shared00() {
- svc := route53.New(session.New())
- input := &route53.GetHostedZoneInput{
- Id: aws.String("Z3M3LMPEXAMPLE"),
- }
-
- result, err := svc.GetHostedZone(input)
- if err != nil {
- if aerr, ok := err.(awserr.Error); ok {
- switch aerr.Code() {
- case route53.ErrCodeNoSuchHostedZone:
- fmt.Println(route53.ErrCodeNoSuchHostedZone, aerr.Error())
- case route53.ErrCodeInvalidInput:
- fmt.Println(route53.ErrCodeInvalidInput, aerr.Error())
- default:
- fmt.Println(aerr.Error())
- }
- } else {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- }
- return
- }
-
- fmt.Println(result)
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/service/route53/unmarshal_error_leak_test.go b/vendor/github.com/aws/aws-sdk-go/service/route53/unmarshal_error_leak_test.go
deleted file mode 100644
index 74926ae91..000000000
--- a/vendor/github.com/aws/aws-sdk-go/service/route53/unmarshal_error_leak_test.go
+++ /dev/null
@@ -1,43 +0,0 @@
-package route53
-
-import (
- "net/http"
- "testing"
-
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/awstesting"
-)
-
-func TestUnmarhsalErrorLeak(t *testing.T) {
- req := &request.Request{
- Operation: &request.Operation{
- Name: opChangeResourceRecordSets,
- },
- HTTPRequest: &http.Request{
- Header: make(http.Header),
- Body: &awstesting.ReadCloser{Size: 2048},
- },
- }
- req.HTTPResponse = &http.Response{
- Body: &awstesting.ReadCloser{Size: 2048},
- Header: http.Header{
- "X-Amzn-Requestid": []string{"1"},
- },
- StatusCode: http.StatusOK,
- }
-
- reader := req.HTTPResponse.Body.(*awstesting.ReadCloser)
- unmarshalChangeResourceRecordSetsError(req)
-
- if req.Error == nil {
- t.Error("expected an error, but received none")
- }
-
- if !reader.Closed {
- t.Error("expected reader to be closed")
- }
-
- if e, a := 0, reader.Size; e != a {
- t.Errorf("expected %d, but received %d", e, a)
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/service/route53/unmarshal_error_test.go b/vendor/github.com/aws/aws-sdk-go/service/route53/unmarshal_error_test.go
deleted file mode 100644
index 750a937fd..000000000
--- a/vendor/github.com/aws/aws-sdk-go/service/route53/unmarshal_error_test.go
+++ /dev/null
@@ -1,130 +0,0 @@
-package route53_test
-
-import (
- "bytes"
- "io/ioutil"
- "net/http"
- "testing"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/awserr"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/awstesting/unit"
- "github.com/aws/aws-sdk-go/service/route53"
-)
-
-func makeClientWithResponse(response string) *route53.Route53 {
- r := route53.New(unit.Session)
- r.Handlers.Send.Clear()
- r.Handlers.Send.PushBack(func(r *request.Request) {
- body := ioutil.NopCloser(bytes.NewReader([]byte(response)))
- r.HTTPResponse = &http.Response{
- ContentLength: int64(len(response)),
- StatusCode: 400,
- Status: "Bad Request",
- Body: body,
- }
- })
-
- return r
-}
-
-func TestUnmarshalStandardError(t *testing.T) {
- const errorResponse = `<?xml version="1.0" encoding="UTF-8"?>
-<ErrorResponse xmlns="https://route53.amazonaws.com/doc/2013-04-01/">
- <Error>
- <Code>InvalidDomainName</Code>
- <Message>The domain name is invalid</Message>
- </Error>
- <RequestId>12345</RequestId>
-</ErrorResponse>
-`
-
- r := makeClientWithResponse(errorResponse)
-
- _, err := r.CreateHostedZone(&route53.CreateHostedZoneInput{
- CallerReference: aws.String("test"),
- Name: aws.String("test_zone"),
- })
-
- if err == nil {
- t.Error("expected error, but received none")
- }
-
- if e, a := "InvalidDomainName", err.(awserr.Error).Code(); e != a {
- t.Errorf("expected %s, but received %s", e, a)
- }
-
- if e, a := "The domain name is invalid", err.(awserr.Error).Message(); e != a {
- t.Errorf("expected %s, but received %s", e, a)
- }
-}
-
-func TestUnmarshalInvalidChangeBatch(t *testing.T) {
- const errorMessage = `
-Tried to create resource record set duplicate.example.com. type A,
-but it already exists
-`
- const errorResponse = `<?xml version="1.0" encoding="UTF-8"?>
-<InvalidChangeBatch xmlns="https://route53.amazonaws.com/doc/2013-04-01/">
- <Messages>
- <Message>` + errorMessage + `</Message>
- </Messages>
-</InvalidChangeBatch>
-`
-
- r := makeClientWithResponse(errorResponse)
-
- req := &route53.ChangeResourceRecordSetsInput{
- HostedZoneId: aws.String("zoneId"),
- ChangeBatch: &route53.ChangeBatch{
- Changes: []*route53.Change{
- {
- Action: aws.String("CREATE"),
- ResourceRecordSet: &route53.ResourceRecordSet{
- Name: aws.String("domain"),
- Type: aws.String("CNAME"),
- TTL: aws.Int64(120),
- ResourceRecords: []*route53.ResourceRecord{
- {
- Value: aws.String("cname"),
- },
- },
- },
- },
- },
- },
- }
-
- _, err := r.ChangeResourceRecordSets(req)
- if err == nil {
- t.Error("expected error, but received none")
- }
-
- if reqErr, ok := err.(awserr.RequestFailure); ok {
- if reqErr == nil {
- t.Error("expected error, but received none")
- }
-
- if e, a := 400, reqErr.StatusCode(); e != a {
- t.Errorf("expected %d, but received %d", e, a)
- }
- } else {
- t.Fatal("returned error is not a RequestFailure")
- }
-
- if batchErr, ok := err.(awserr.BatchedErrors); ok {
- errs := batchErr.OrigErrs()
- if e, a := 1, len(errs); e != a {
- t.Errorf("expected %d, but received %d", e, a)
- }
- if e, a := "InvalidChangeBatch", errs[0].(awserr.Error).Code(); e != a {
- t.Errorf("expected %s, but received %s", e, a)
- }
- if e, a := errorMessage, errs[0].(awserr.Error).Message(); e != a {
- t.Errorf("expected %s, but received %s", e, a)
- }
- } else {
- t.Fatal("returned error is not a BatchedErrors")
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/customizations_test.go b/vendor/github.com/aws/aws-sdk-go/service/sts/customizations_test.go
deleted file mode 100644
index 18972b1f5..000000000
--- a/vendor/github.com/aws/aws-sdk-go/service/sts/customizations_test.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package sts_test
-
-import (
- "testing"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/awstesting/unit"
- "github.com/aws/aws-sdk-go/service/sts"
-)
-
-var svc = sts.New(unit.Session, &aws.Config{
- Region: aws.String("mock-region"),
-})
-
-func TestUnsignedRequest_AssumeRoleWithSAML(t *testing.T) {
- req, _ := svc.AssumeRoleWithSAMLRequest(&sts.AssumeRoleWithSAMLInput{
- PrincipalArn: aws.String("ARN01234567890123456789"),
- RoleArn: aws.String("ARN01234567890123456789"),
- SAMLAssertion: aws.String("ASSERT"),
- })
-
- err := req.Sign()
- if err != nil {
- t.Errorf("expect no error, got %v", err)
- }
- if e, a := "", req.HTTPRequest.Header.Get("Authorization"); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
-
-func TestUnsignedRequest_AssumeRoleWithWebIdentity(t *testing.T) {
- req, _ := svc.AssumeRoleWithWebIdentityRequest(&sts.AssumeRoleWithWebIdentityInput{
- RoleArn: aws.String("ARN01234567890123456789"),
- RoleSessionName: aws.String("SESSION"),
- WebIdentityToken: aws.String("TOKEN"),
- })
-
- err := req.Sign()
- if err != nil {
- t.Errorf("expect no error, got %v", err)
- }
- if e, a := "", req.HTTPRequest.Header.Get("Authorization"); e != a {
- t.Errorf("expect %v, got %v", e, a)
- }
-}
diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/sts/examples_test.go
deleted file mode 100644
index d61a9932b..000000000
--- a/vendor/github.com/aws/aws-sdk-go/service/sts/examples_test.go
+++ /dev/null
@@ -1,282 +0,0 @@
-// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
-
-package sts_test
-
-import (
- "fmt"
- "strings"
- "time"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/awserr"
- "github.com/aws/aws-sdk-go/aws/session"
- "github.com/aws/aws-sdk-go/service/sts"
-)
-
-var _ time.Duration
-var _ strings.Reader
-var _ aws.Config
-
-func parseTime(layout, value string) *time.Time {
- t, err := time.Parse(layout, value)
- if err != nil {
- panic(err)
- }
- return &t
-}
-
-// To assume a role
-//
-
-func ExampleSTS_AssumeRole_shared00() {
- svc := sts.New(session.New())
- input := &sts.AssumeRoleInput{
- DurationSeconds: aws.Int64(3600),
- ExternalId: aws.String("123ABC"),
- Policy: aws.String("{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"Stmt1\",\"Effect\":\"Allow\",\"Action\":\"s3:*\",\"Resource\":\"*\"}]}"),
- RoleArn: aws.String("arn:aws:iam::123456789012:role/demo"),
- RoleSessionName: aws.String("Bob"),
- }
-
- result, err := svc.AssumeRole(input)
- if err != nil {
- if aerr, ok := err.(awserr.Error); ok {
- switch aerr.Code() {
- case sts.ErrCodeMalformedPolicyDocumentException:
- fmt.Println(sts.ErrCodeMalformedPolicyDocumentException, aerr.Error())
- case sts.ErrCodePackedPolicyTooLargeException:
- fmt.Println(sts.ErrCodePackedPolicyTooLargeException, aerr.Error())
- case sts.ErrCodeRegionDisabledException:
- fmt.Println(sts.ErrCodeRegionDisabledException, aerr.Error())
- default:
- fmt.Println(aerr.Error())
- }
- } else {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- }
- return
- }
-
- fmt.Println(result)
-}
-
-// To assume a role as an OpenID Connect-federated user
-//
-
-func ExampleSTS_AssumeRoleWithWebIdentity_shared00() {
- svc := sts.New(session.New())
- input := &sts.AssumeRoleWithWebIdentityInput{
- DurationSeconds: aws.Int64(3600),
- ProviderId: aws.String("www.amazon.com"),
- RoleArn: aws.String("arn:aws:iam::123456789012:role/FederatedWebIdentityRole"),
- RoleSessionName: aws.String("app1"),
- WebIdentityToken: aws.String("Atza%7CIQEBLjAsAhRFiXuWpUXuRvQ9PZL3GMFcYevydwIUFAHZwXZXXXXXXXXJnrulxKDHwy87oGKPznh0D6bEQZTSCzyoCtL_8S07pLpr0zMbn6w1lfVZKNTBdDansFBmtGnIsIapjI6xKR02Yc_2bQ8LZbUXSGm6Ry6_BG7PrtLZtj_dfCTj92xNGed-CrKqjG7nPBjNIL016GGvuS5gSvPRUxWES3VYfm1wl7WTI7jn-Pcb6M-buCgHhFOzTQxod27L9CqnOLio7N3gZAGpsp6n1-AJBOCJckcyXe2c6uD0srOJeZlKUm2eTDVMf8IehDVI0r1QOnTV6KzzAI3OY87Vd_cVMQ"),
- }
-
- result, err := svc.AssumeRoleWithWebIdentity(input)
- if err != nil {
- if aerr, ok := err.(awserr.Error); ok {
- switch aerr.Code() {
- case sts.ErrCodeMalformedPolicyDocumentException:
- fmt.Println(sts.ErrCodeMalformedPolicyDocumentException, aerr.Error())
- case sts.ErrCodePackedPolicyTooLargeException:
- fmt.Println(sts.ErrCodePackedPolicyTooLargeException, aerr.Error())
- case sts.ErrCodeIDPRejectedClaimException:
- fmt.Println(sts.ErrCodeIDPRejectedClaimException, aerr.Error())
- case sts.ErrCodeIDPCommunicationErrorException:
- fmt.Println(sts.ErrCodeIDPCommunicationErrorException, aerr.Error())
- case sts.ErrCodeInvalidIdentityTokenException:
- fmt.Println(sts.ErrCodeInvalidIdentityTokenException, aerr.Error())
- case sts.ErrCodeExpiredTokenException:
- fmt.Println(sts.ErrCodeExpiredTokenException, aerr.Error())
- case sts.ErrCodeRegionDisabledException:
- fmt.Println(sts.ErrCodeRegionDisabledException, aerr.Error())
- default:
- fmt.Println(aerr.Error())
- }
- } else {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- }
- return
- }
-
- fmt.Println(result)
-}
-
-// To decode information about an authorization status of a request
-//
-
-func ExampleSTS_DecodeAuthorizationMessage_shared00() {
- svc := sts.New(session.New())
- input := &sts.DecodeAuthorizationMessageInput{
- EncodedMessage: aws.String("<encoded-message>"),
- }
-
- result, err := svc.DecodeAuthorizationMessage(input)
- if err != nil {
- if aerr, ok := err.(awserr.Error); ok {
- switch aerr.Code() {
- case sts.ErrCodeInvalidAuthorizationMessageException:
- fmt.Println(sts.ErrCodeInvalidAuthorizationMessageException, aerr.Error())
- default:
- fmt.Println(aerr.Error())
- }
- } else {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- }
- return
- }
-
- fmt.Println(result)
-}
-
-// To get details about a calling IAM user
-//
-// This example shows a request and response made with the credentials for a user named
-// Alice in the AWS account 123456789012.
-func ExampleSTS_GetCallerIdentity_shared00() {
- svc := sts.New(session.New())
- input := &sts.GetCallerIdentityInput{}
-
- result, err := svc.GetCallerIdentity(input)
- if err != nil {
- if aerr, ok := err.(awserr.Error); ok {
- switch aerr.Code() {
- default:
- fmt.Println(aerr.Error())
- }
- } else {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- }
- return
- }
-
- fmt.Println(result)
-}
-
-// To get details about a calling user federated with AssumeRole
-//
-// This example shows a request and response made with temporary credentials created
-// by AssumeRole. The name of the assumed role is my-role-name, and the RoleSessionName
-// is set to my-role-session-name.
-func ExampleSTS_GetCallerIdentity_shared01() {
- svc := sts.New(session.New())
- input := &sts.GetCallerIdentityInput{}
-
- result, err := svc.GetCallerIdentity(input)
- if err != nil {
- if aerr, ok := err.(awserr.Error); ok {
- switch aerr.Code() {
- default:
- fmt.Println(aerr.Error())
- }
- } else {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- }
- return
- }
-
- fmt.Println(result)
-}
-
-// To get details about a calling user federated with GetFederationToken
-//
-// This example shows a request and response made with temporary credentials created
-// by using GetFederationToken. The Name parameter is set to my-federated-user-name.
-func ExampleSTS_GetCallerIdentity_shared02() {
- svc := sts.New(session.New())
- input := &sts.GetCallerIdentityInput{}
-
- result, err := svc.GetCallerIdentity(input)
- if err != nil {
- if aerr, ok := err.(awserr.Error); ok {
- switch aerr.Code() {
- default:
- fmt.Println(aerr.Error())
- }
- } else {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- }
- return
- }
-
- fmt.Println(result)
-}
-
-// To get temporary credentials for a role by using GetFederationToken
-//
-
-func ExampleSTS_GetFederationToken_shared00() {
- svc := sts.New(session.New())
- input := &sts.GetFederationTokenInput{
- DurationSeconds: aws.Int64(3600),
- Name: aws.String("Bob"),
- Policy: aws.String("{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"Stmt1\",\"Effect\":\"Allow\",\"Action\":\"s3:*\",\"Resource\":\"*\"}]}"),
- }
-
- result, err := svc.GetFederationToken(input)
- if err != nil {
- if aerr, ok := err.(awserr.Error); ok {
- switch aerr.Code() {
- case sts.ErrCodeMalformedPolicyDocumentException:
- fmt.Println(sts.ErrCodeMalformedPolicyDocumentException, aerr.Error())
- case sts.ErrCodePackedPolicyTooLargeException:
- fmt.Println(sts.ErrCodePackedPolicyTooLargeException, aerr.Error())
- case sts.ErrCodeRegionDisabledException:
- fmt.Println(sts.ErrCodeRegionDisabledException, aerr.Error())
- default:
- fmt.Println(aerr.Error())
- }
- } else {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- }
- return
- }
-
- fmt.Println(result)
-}
-
-// To get temporary credentials for an IAM user or an AWS account
-//
-
-func ExampleSTS_GetSessionToken_shared00() {
- svc := sts.New(session.New())
- input := &sts.GetSessionTokenInput{
- DurationSeconds: aws.Int64(3600),
- SerialNumber: aws.String("YourMFASerialNumber"),
- TokenCode: aws.String("123456"),
- }
-
- result, err := svc.GetSessionToken(input)
- if err != nil {
- if aerr, ok := err.(awserr.Error); ok {
- switch aerr.Code() {
- case sts.ErrCodeRegionDisabledException:
- fmt.Println(sts.ErrCodeRegionDisabledException, aerr.Error())
- default:
- fmt.Println(aerr.Error())
- }
- } else {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- }
- return
- }
-
- fmt.Println(result)
-}
diff --git a/vendor/github.com/coreos/etcd/auth/jwt_test.go b/vendor/github.com/coreos/etcd/auth/jwt_test.go
deleted file mode 100644
index 42724a2f6..000000000
--- a/vendor/github.com/coreos/etcd/auth/jwt_test.go
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright 2017 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package auth
-
-import (
- "context"
- "fmt"
- "testing"
-)
-
-const (
- jwtPubKey = "../integration/fixtures/server.crt"
- jwtPrivKey = "../integration/fixtures/server.key.insecure"
-)
-
-func TestJWTInfo(t *testing.T) {
- opts := map[string]string{
- "pub-key": jwtPubKey,
- "priv-key": jwtPrivKey,
- "sign-method": "RS256",
- }
- jwt, err := newTokenProviderJWT(opts)
- if err != nil {
- t.Fatal(err)
- }
- token, aerr := jwt.assign(context.TODO(), "abc", 123)
- if aerr != nil {
- t.Fatal(err)
- }
- ai, ok := jwt.info(context.TODO(), token, 123)
- if !ok {
- t.Fatalf("failed to authenticate with token %s", token)
- }
- if ai.Revision != 123 {
- t.Fatalf("expected revision 123, got %d", ai.Revision)
- }
- ai, ok = jwt.info(context.TODO(), "aaa", 120)
- if ok || ai != nil {
- t.Fatalf("expected aaa to fail to authenticate, got %+v", ai)
- }
-}
-
-func TestJWTBad(t *testing.T) {
- opts := map[string]string{
- "pub-key": jwtPubKey,
- "priv-key": jwtPrivKey,
- "sign-method": "RS256",
- }
- // private key instead of public key
- opts["pub-key"] = jwtPrivKey
- if _, err := newTokenProviderJWT(opts); err == nil {
- t.Fatalf("expected failure on missing public key")
- }
- opts["pub-key"] = jwtPubKey
-
- // public key instead of private key
- opts["priv-key"] = jwtPubKey
- if _, err := newTokenProviderJWT(opts); err == nil {
- t.Fatalf("expected failure on missing public key")
- }
- opts["priv-key"] = jwtPrivKey
-
- // missing signing option
- delete(opts, "sign-method")
- if _, err := newTokenProviderJWT(opts); err == nil {
- t.Fatal("expected error on missing option")
- }
- opts["sign-method"] = "RS256"
-
- // bad file for pubkey
- opts["pub-key"] = "whatever"
- if _, err := newTokenProviderJWT(opts); err == nil {
- t.Fatalf("expected failure on missing public key")
- }
- opts["pub-key"] = jwtPubKey
-
- // bad file for private key
- opts["priv-key"] = "whatever"
- if _, err := newTokenProviderJWT(opts); err == nil {
- t.Fatalf("expeceted failure on missing private key")
- }
- opts["priv-key"] = jwtPrivKey
-}
-
-// testJWTOpts is useful for passing to NewTokenProvider which requires a string.
-func testJWTOpts() string {
- return fmt.Sprintf("%s,pub-key=%s,priv-key=%s,sign-method=RS256", tokenTypeJWT, jwtPubKey, jwtPrivKey)
-}
diff --git a/vendor/github.com/coreos/etcd/auth/range_perm_cache_test.go b/vendor/github.com/coreos/etcd/auth/range_perm_cache_test.go
deleted file mode 100644
index fd8df6a9e..000000000
--- a/vendor/github.com/coreos/etcd/auth/range_perm_cache_test.go
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package auth
-
-import (
- "testing"
-
- "github.com/coreos/etcd/auth/authpb"
- "github.com/coreos/etcd/pkg/adt"
-)
-
-func TestRangePermission(t *testing.T) {
- tests := []struct {
- perms []adt.Interval
- begin []byte
- end []byte
- want bool
- }{
- {
- []adt.Interval{adt.NewBytesAffineInterval([]byte("a"), []byte("c")), adt.NewBytesAffineInterval([]byte("x"), []byte("z"))},
- []byte("a"), []byte("z"),
- false,
- },
- {
- []adt.Interval{adt.NewBytesAffineInterval([]byte("a"), []byte("f")), adt.NewBytesAffineInterval([]byte("c"), []byte("d")), adt.NewBytesAffineInterval([]byte("f"), []byte("z"))},
- []byte("a"), []byte("z"),
- true,
- },
- {
- []adt.Interval{adt.NewBytesAffineInterval([]byte("a"), []byte("d")), adt.NewBytesAffineInterval([]byte("a"), []byte("b")), adt.NewBytesAffineInterval([]byte("c"), []byte("f"))},
- []byte("a"), []byte("f"),
- true,
- },
- }
-
- for i, tt := range tests {
- readPerms := &adt.IntervalTree{}
- for _, p := range tt.perms {
- readPerms.Insert(p, struct{}{})
- }
-
- result := checkKeyInterval(&unifiedRangePermissions{readPerms: readPerms}, tt.begin, tt.end, authpb.READ)
- if result != tt.want {
- t.Errorf("#%d: result=%t, want=%t", i, result, tt.want)
- }
- }
-}
diff --git a/vendor/github.com/coreos/etcd/auth/simple_token_test.go b/vendor/github.com/coreos/etcd/auth/simple_token_test.go
deleted file mode 100644
index 1890521d4..000000000
--- a/vendor/github.com/coreos/etcd/auth/simple_token_test.go
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2017 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package auth
-
-import (
- "context"
- "testing"
-)
-
-// TestSimpleTokenDisabled ensures that TokenProviderSimple behaves correctly when
-// disabled.
-func TestSimpleTokenDisabled(t *testing.T) {
- initialState := newTokenProviderSimple(dummyIndexWaiter)
-
- explicitlyDisabled := newTokenProviderSimple(dummyIndexWaiter)
- explicitlyDisabled.enable()
- explicitlyDisabled.disable()
-
- for _, tp := range []*tokenSimple{initialState, explicitlyDisabled} {
- ctx := context.WithValue(context.WithValue(context.TODO(), AuthenticateParamIndex{}, uint64(1)), AuthenticateParamSimpleTokenPrefix{}, "dummy")
- token, err := tp.assign(ctx, "user1", 0)
- if err != nil {
- t.Fatal(err)
- }
- authInfo, ok := tp.info(ctx, token, 0)
- if ok {
- t.Errorf("expected (true, \"user1\") got (%t, %s)", ok, authInfo.Username)
- }
-
- tp.invalidateUser("user1") // should be no-op
- }
-}
-
-// TestSimpleTokenAssign ensures that TokenProviderSimple can correctly assign a
-// token, look it up with info, and invalidate it by user.
-func TestSimpleTokenAssign(t *testing.T) {
- tp := newTokenProviderSimple(dummyIndexWaiter)
- tp.enable()
- ctx := context.WithValue(context.WithValue(context.TODO(), AuthenticateParamIndex{}, uint64(1)), AuthenticateParamSimpleTokenPrefix{}, "dummy")
- token, err := tp.assign(ctx, "user1", 0)
- if err != nil {
- t.Fatal(err)
- }
- authInfo, ok := tp.info(ctx, token, 0)
- if !ok || authInfo.Username != "user1" {
- t.Errorf("expected (true, \"token2\") got (%t, %s)", ok, authInfo.Username)
- }
-
- tp.invalidateUser("user1")
-
- _, ok = tp.info(context.TODO(), token, 0)
- if ok {
- t.Errorf("expected ok == false after user is invalidated")
- }
-}
diff --git a/vendor/github.com/coreos/etcd/auth/store_test.go b/vendor/github.com/coreos/etcd/auth/store_test.go
deleted file mode 100644
index 02c8539d3..000000000
--- a/vendor/github.com/coreos/etcd/auth/store_test.go
+++ /dev/null
@@ -1,743 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package auth
-
-import (
- "context"
- "fmt"
- "os"
- "reflect"
- "strings"
- "sync"
- "testing"
- "time"
-
- "github.com/coreos/etcd/auth/authpb"
- pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
- "github.com/coreos/etcd/mvcc/backend"
-
- "golang.org/x/crypto/bcrypt"
- "google.golang.org/grpc/metadata"
-)
-
-func init() { BcryptCost = bcrypt.MinCost }
-
-func dummyIndexWaiter(index uint64) <-chan struct{} {
- ch := make(chan struct{})
- go func() {
- ch <- struct{}{}
- }()
- return ch
-}
-
-// TestNewAuthStoreRevision ensures newly auth store
-// keeps the old revision when there are no changes.
-func TestNewAuthStoreRevision(t *testing.T) {
- b, tPath := backend.NewDefaultTmpBackend()
- defer os.Remove(tPath)
-
- tp, err := NewTokenProvider(tokenTypeSimple, dummyIndexWaiter)
- if err != nil {
- t.Fatal(err)
- }
- as := NewAuthStore(b, tp)
- err = enableAuthAndCreateRoot(as)
- if err != nil {
- t.Fatal(err)
- }
- old := as.Revision()
- b.Close()
- as.Close()
-
- // no changes to commit
- b2 := backend.NewDefaultBackend(tPath)
- as = NewAuthStore(b2, tp)
- new := as.Revision()
- b2.Close()
- as.Close()
-
- if old != new {
- t.Fatalf("expected revision %d, got %d", old, new)
- }
-}
-
-func setupAuthStore(t *testing.T) (store *authStore, teardownfunc func(t *testing.T)) {
- b, tPath := backend.NewDefaultTmpBackend()
-
- tp, err := NewTokenProvider(tokenTypeSimple, dummyIndexWaiter)
- if err != nil {
- t.Fatal(err)
- }
- as := NewAuthStore(b, tp)
- err = enableAuthAndCreateRoot(as)
- if err != nil {
- t.Fatal(err)
- }
-
- // adds a new role
- _, err = as.RoleAdd(&pb.AuthRoleAddRequest{Name: "role-test"})
- if err != nil {
- t.Fatal(err)
- }
-
- ua := &pb.AuthUserAddRequest{Name: "foo", Password: "bar"}
- _, err = as.UserAdd(ua) // add a non-existing user
- if err != nil {
- t.Fatal(err)
- }
-
- tearDown := func(t *testing.T) {
- b.Close()
- os.Remove(tPath)
- as.Close()
- }
- return as, tearDown
-}
-
-func enableAuthAndCreateRoot(as *authStore) error {
- _, err := as.UserAdd(&pb.AuthUserAddRequest{Name: "root", Password: "root"})
- if err != nil {
- return err
- }
-
- _, err = as.RoleAdd(&pb.AuthRoleAddRequest{Name: "root"})
- if err != nil {
- return err
- }
-
- _, err = as.UserGrantRole(&pb.AuthUserGrantRoleRequest{User: "root", Role: "root"})
- if err != nil {
- return err
- }
-
- return as.AuthEnable()
-}
-
-func TestUserAdd(t *testing.T) {
- as, tearDown := setupAuthStore(t)
- defer tearDown(t)
-
- ua := &pb.AuthUserAddRequest{Name: "foo"}
- _, err := as.UserAdd(ua) // add an existing user
- if err == nil {
- t.Fatalf("expected %v, got %v", ErrUserAlreadyExist, err)
- }
- if err != ErrUserAlreadyExist {
- t.Fatalf("expected %v, got %v", ErrUserAlreadyExist, err)
- }
-
- ua = &pb.AuthUserAddRequest{Name: ""}
- _, err = as.UserAdd(ua) // add a user with empty name
- if err != ErrUserEmpty {
- t.Fatal(err)
- }
-}
-
-func TestCheckPassword(t *testing.T) {
- as, tearDown := setupAuthStore(t)
- defer tearDown(t)
-
- // auth a non-existing user
- _, err := as.CheckPassword("foo-test", "bar")
- if err == nil {
- t.Fatalf("expected %v, got %v", ErrAuthFailed, err)
- }
- if err != ErrAuthFailed {
- t.Fatalf("expected %v, got %v", ErrAuthFailed, err)
- }
-
- // auth an existing user with correct password
- _, err = as.CheckPassword("foo", "bar")
- if err != nil {
- t.Fatal(err)
- }
-
- // auth an existing user but with wrong password
- _, err = as.CheckPassword("foo", "")
- if err == nil {
- t.Fatalf("expected %v, got %v", ErrAuthFailed, err)
- }
- if err != ErrAuthFailed {
- t.Fatalf("expected %v, got %v", ErrAuthFailed, err)
- }
-}
-
-func TestUserDelete(t *testing.T) {
- as, tearDown := setupAuthStore(t)
- defer tearDown(t)
-
- // delete an existing user
- ud := &pb.AuthUserDeleteRequest{Name: "foo"}
- _, err := as.UserDelete(ud)
- if err != nil {
- t.Fatal(err)
- }
-
- // delete a non-existing user
- _, err = as.UserDelete(ud)
- if err == nil {
- t.Fatalf("expected %v, got %v", ErrUserNotFound, err)
- }
- if err != ErrUserNotFound {
- t.Fatalf("expected %v, got %v", ErrUserNotFound, err)
- }
-}
-
-func TestUserChangePassword(t *testing.T) {
- as, tearDown := setupAuthStore(t)
- defer tearDown(t)
-
- ctx1 := context.WithValue(context.WithValue(context.TODO(), AuthenticateParamIndex{}, uint64(1)), AuthenticateParamSimpleTokenPrefix{}, "dummy")
- _, err := as.Authenticate(ctx1, "foo", "bar")
- if err != nil {
- t.Fatal(err)
- }
-
- _, err = as.UserChangePassword(&pb.AuthUserChangePasswordRequest{Name: "foo", Password: "baz"})
- if err != nil {
- t.Fatal(err)
- }
-
- ctx2 := context.WithValue(context.WithValue(context.TODO(), AuthenticateParamIndex{}, uint64(2)), AuthenticateParamSimpleTokenPrefix{}, "dummy")
- _, err = as.Authenticate(ctx2, "foo", "baz")
- if err != nil {
- t.Fatal(err)
- }
-
- // change a non-existing user
- _, err = as.UserChangePassword(&pb.AuthUserChangePasswordRequest{Name: "foo-test", Password: "bar"})
- if err == nil {
- t.Fatalf("expected %v, got %v", ErrUserNotFound, err)
- }
- if err != ErrUserNotFound {
- t.Fatalf("expected %v, got %v", ErrUserNotFound, err)
- }
-}
-
-func TestRoleAdd(t *testing.T) {
- as, tearDown := setupAuthStore(t)
- defer tearDown(t)
-
- // adds a new role
- _, err := as.RoleAdd(&pb.AuthRoleAddRequest{Name: "role-test-1"})
- if err != nil {
- t.Fatal(err)
- }
-}
-
-func TestUserGrant(t *testing.T) {
- as, tearDown := setupAuthStore(t)
- defer tearDown(t)
-
- // grants a role to the user
- _, err := as.UserGrantRole(&pb.AuthUserGrantRoleRequest{User: "foo", Role: "role-test"})
- if err != nil {
- t.Fatal(err)
- }
-
- // grants a role to a non-existing user
- _, err = as.UserGrantRole(&pb.AuthUserGrantRoleRequest{User: "foo-test", Role: "role-test"})
- if err == nil {
- t.Errorf("expected %v, got %v", ErrUserNotFound, err)
- }
- if err != ErrUserNotFound {
- t.Errorf("expected %v, got %v", ErrUserNotFound, err)
- }
-}
-
-func TestGetUser(t *testing.T) {
- as, tearDown := setupAuthStore(t)
- defer tearDown(t)
-
- _, err := as.UserGrantRole(&pb.AuthUserGrantRoleRequest{User: "foo", Role: "role-test"})
- if err != nil {
- t.Fatal(err)
- }
-
- u, err := as.UserGet(&pb.AuthUserGetRequest{Name: "foo"})
- if err != nil {
- t.Fatal(err)
- }
- if u == nil {
- t.Fatal("expect user not nil, got nil")
- }
- expected := []string{"role-test"}
- if !reflect.DeepEqual(expected, u.Roles) {
- t.Errorf("expected %v, got %v", expected, u.Roles)
- }
-}
-
-func TestListUsers(t *testing.T) {
- as, tearDown := setupAuthStore(t)
- defer tearDown(t)
-
- ua := &pb.AuthUserAddRequest{Name: "user1", Password: "pwd1"}
- _, err := as.UserAdd(ua) // add a non-existing user
- if err != nil {
- t.Fatal(err)
- }
-
- ul, err := as.UserList(&pb.AuthUserListRequest{})
- if err != nil {
- t.Fatal(err)
- }
- if !contains(ul.Users, "root") {
- t.Errorf("expected %v in %v", "root", ul.Users)
- }
- if !contains(ul.Users, "user1") {
- t.Errorf("expected %v in %v", "user1", ul.Users)
- }
-}
-
-func TestRoleGrantPermission(t *testing.T) {
- as, tearDown := setupAuthStore(t)
- defer tearDown(t)
-
- _, err := as.RoleAdd(&pb.AuthRoleAddRequest{Name: "role-test-1"})
- if err != nil {
- t.Fatal(err)
- }
-
- perm := &authpb.Permission{
- PermType: authpb.WRITE,
- Key: []byte("Keys"),
- RangeEnd: []byte("RangeEnd"),
- }
- _, err = as.RoleGrantPermission(&pb.AuthRoleGrantPermissionRequest{
- Name: "role-test-1",
- Perm: perm,
- })
-
- if err != nil {
- t.Error(err)
- }
-
- r, err := as.RoleGet(&pb.AuthRoleGetRequest{Role: "role-test-1"})
- if err != nil {
- t.Fatal(err)
- }
-
- if !reflect.DeepEqual(perm, r.Perm[0]) {
- t.Errorf("expected %v, got %v", perm, r.Perm[0])
- }
-}
-
-func TestRoleRevokePermission(t *testing.T) {
- as, tearDown := setupAuthStore(t)
- defer tearDown(t)
-
- _, err := as.RoleAdd(&pb.AuthRoleAddRequest{Name: "role-test-1"})
- if err != nil {
- t.Fatal(err)
- }
-
- perm := &authpb.Permission{
- PermType: authpb.WRITE,
- Key: []byte("Keys"),
- RangeEnd: []byte("RangeEnd"),
- }
- _, err = as.RoleGrantPermission(&pb.AuthRoleGrantPermissionRequest{
- Name: "role-test-1",
- Perm: perm,
- })
-
- if err != nil {
- t.Fatal(err)
- }
-
- _, err = as.RoleGet(&pb.AuthRoleGetRequest{Role: "role-test-1"})
- if err != nil {
- t.Fatal(err)
- }
-
- _, err = as.RoleRevokePermission(&pb.AuthRoleRevokePermissionRequest{
- Role: "role-test-1",
- Key: "Keys",
- RangeEnd: "RangeEnd",
- })
- if err != nil {
- t.Fatal(err)
- }
-
- var r *pb.AuthRoleGetResponse
- r, err = as.RoleGet(&pb.AuthRoleGetRequest{Role: "role-test-1"})
- if err != nil {
- t.Fatal(err)
- }
- if len(r.Perm) != 0 {
- t.Errorf("expected %v, got %v", 0, len(r.Perm))
- }
-}
-
-func TestUserRevokePermission(t *testing.T) {
- as, tearDown := setupAuthStore(t)
- defer tearDown(t)
-
- _, err := as.RoleAdd(&pb.AuthRoleAddRequest{Name: "role-test-1"})
- if err != nil {
- t.Fatal(err)
- }
-
- _, err = as.UserGrantRole(&pb.AuthUserGrantRoleRequest{User: "foo", Role: "role-test"})
- if err != nil {
- t.Fatal(err)
- }
-
- _, err = as.UserGrantRole(&pb.AuthUserGrantRoleRequest{User: "foo", Role: "role-test-1"})
- if err != nil {
- t.Fatal(err)
- }
-
- u, err := as.UserGet(&pb.AuthUserGetRequest{Name: "foo"})
- if err != nil {
- t.Fatal(err)
- }
-
- expected := []string{"role-test", "role-test-1"}
- if !reflect.DeepEqual(expected, u.Roles) {
- t.Fatalf("expected %v, got %v", expected, u.Roles)
- }
-
- _, err = as.UserRevokeRole(&pb.AuthUserRevokeRoleRequest{Name: "foo", Role: "role-test-1"})
- if err != nil {
- t.Fatal(err)
- }
-
- u, err = as.UserGet(&pb.AuthUserGetRequest{Name: "foo"})
- if err != nil {
- t.Fatal(err)
- }
-
- expected = []string{"role-test"}
- if !reflect.DeepEqual(expected, u.Roles) {
- t.Errorf("expected %v, got %v", expected, u.Roles)
- }
-}
-
-func TestRoleDelete(t *testing.T) {
- as, tearDown := setupAuthStore(t)
- defer tearDown(t)
-
- _, err := as.RoleDelete(&pb.AuthRoleDeleteRequest{Role: "role-test"})
- if err != nil {
- t.Fatal(err)
- }
- rl, err := as.RoleList(&pb.AuthRoleListRequest{})
- if err != nil {
- t.Fatal(err)
- }
- expected := []string{"root"}
- if !reflect.DeepEqual(expected, rl.Roles) {
- t.Errorf("expected %v, got %v", expected, rl.Roles)
- }
-}
-
-func TestAuthInfoFromCtx(t *testing.T) {
- as, tearDown := setupAuthStore(t)
- defer tearDown(t)
-
- ctx := context.Background()
- ai, err := as.AuthInfoFromCtx(ctx)
- if err != nil && ai != nil {
- t.Errorf("expected (nil, nil), got (%v, %v)", ai, err)
- }
-
- // as if it came from RPC
- ctx = metadata.NewIncomingContext(context.Background(), metadata.New(map[string]string{"tokens": "dummy"}))
- ai, err = as.AuthInfoFromCtx(ctx)
- if err != nil && ai != nil {
- t.Errorf("expected (nil, nil), got (%v, %v)", ai, err)
- }
-
- ctx = context.WithValue(context.WithValue(context.TODO(), AuthenticateParamIndex{}, uint64(1)), AuthenticateParamSimpleTokenPrefix{}, "dummy")
- resp, err := as.Authenticate(ctx, "foo", "bar")
- if err != nil {
- t.Error(err)
- }
-
- ctx = metadata.NewIncomingContext(context.Background(), metadata.New(map[string]string{"token": "Invalid Token"}))
- _, err = as.AuthInfoFromCtx(ctx)
- if err != ErrInvalidAuthToken {
- t.Errorf("expected %v, got %v", ErrInvalidAuthToken, err)
- }
-
- ctx = metadata.NewIncomingContext(context.Background(), metadata.New(map[string]string{"token": "Invalid.Token"}))
- _, err = as.AuthInfoFromCtx(ctx)
- if err != ErrInvalidAuthToken {
- t.Errorf("expected %v, got %v", ErrInvalidAuthToken, err)
- }
-
- ctx = metadata.NewIncomingContext(context.Background(), metadata.New(map[string]string{"token": resp.Token}))
- ai, err = as.AuthInfoFromCtx(ctx)
- if err != nil {
- t.Error(err)
- }
- if ai.Username != "foo" {
- t.Errorf("expected %v, got %v", "foo", ai.Username)
- }
-}
-
-func TestAuthDisable(t *testing.T) {
- as, tearDown := setupAuthStore(t)
- defer tearDown(t)
-
- as.AuthDisable()
- ctx := context.WithValue(context.WithValue(context.TODO(), AuthenticateParamIndex{}, uint64(2)), AuthenticateParamSimpleTokenPrefix{}, "dummy")
- _, err := as.Authenticate(ctx, "foo", "bar")
- if err != ErrAuthNotEnabled {
- t.Errorf("expected %v, got %v", ErrAuthNotEnabled, err)
- }
-
- // Disabling disabled auth to make sure it can return safely if store is already disabled.
- as.AuthDisable()
- _, err = as.Authenticate(ctx, "foo", "bar")
- if err != ErrAuthNotEnabled {
- t.Errorf("expected %v, got %v", ErrAuthNotEnabled, err)
- }
-}
-
-// TestAuthRevisionRace ensures that access to authStore.revision is thread-safe.
-func TestAuthInfoFromCtxRace(t *testing.T) {
- b, tPath := backend.NewDefaultTmpBackend()
- defer os.Remove(tPath)
-
- tp, err := NewTokenProvider(tokenTypeSimple, dummyIndexWaiter)
- if err != nil {
- t.Fatal(err)
- }
- as := NewAuthStore(b, tp)
- defer as.Close()
-
- donec := make(chan struct{})
- go func() {
- defer close(donec)
- ctx := metadata.NewIncomingContext(context.Background(), metadata.New(map[string]string{"token": "test"}))
- as.AuthInfoFromCtx(ctx)
- }()
- as.UserAdd(&pb.AuthUserAddRequest{Name: "test"})
- <-donec
-}
-
-func TestIsAdminPermitted(t *testing.T) {
- as, tearDown := setupAuthStore(t)
- defer tearDown(t)
-
- err := as.IsAdminPermitted(&AuthInfo{Username: "root", Revision: 1})
- if err != nil {
- t.Errorf("expected nil, got %v", err)
- }
-
- // invalid user
- err = as.IsAdminPermitted(&AuthInfo{Username: "rooti", Revision: 1})
- if err != ErrUserNotFound {
- t.Errorf("expected %v, got %v", ErrUserNotFound, err)
- }
-
- // non-admin user
- err = as.IsAdminPermitted(&AuthInfo{Username: "foo", Revision: 1})
- if err != ErrPermissionDenied {
- t.Errorf("expected %v, got %v", ErrPermissionDenied, err)
- }
-
- // disabled auth should return nil
- as.AuthDisable()
- err = as.IsAdminPermitted(&AuthInfo{Username: "root", Revision: 1})
- if err != nil {
- t.Errorf("expected nil, got %v", err)
- }
-}
-
-func TestRecoverFromSnapshot(t *testing.T) {
- as, _ := setupAuthStore(t)
-
- ua := &pb.AuthUserAddRequest{Name: "foo"}
- _, err := as.UserAdd(ua) // add an existing user
- if err == nil {
- t.Fatalf("expected %v, got %v", ErrUserAlreadyExist, err)
- }
- if err != ErrUserAlreadyExist {
- t.Fatalf("expected %v, got %v", ErrUserAlreadyExist, err)
- }
-
- ua = &pb.AuthUserAddRequest{Name: ""}
- _, err = as.UserAdd(ua) // add a user with empty name
- if err != ErrUserEmpty {
- t.Fatal(err)
- }
-
- as.Close()
-
- tp, err := NewTokenProvider(tokenTypeSimple, dummyIndexWaiter)
- if err != nil {
- t.Fatal(err)
- }
- as2 := NewAuthStore(as.be, tp)
- defer func(a *authStore) {
- a.Close()
- }(as2)
-
- if !as2.isAuthEnabled() {
- t.Fatal("recovering authStore from existing backend failed")
- }
-
- ul, err := as.UserList(&pb.AuthUserListRequest{})
- if err != nil {
- t.Fatal(err)
- }
- if !contains(ul.Users, "root") {
- t.Errorf("expected %v in %v", "root", ul.Users)
- }
-}
-
-func contains(array []string, str string) bool {
- for _, s := range array {
- if s == str {
- return true
- }
- }
- return false
-}
-
-func TestHammerSimpleAuthenticate(t *testing.T) {
- // set TTL values low to try to trigger races
- oldTTL, oldTTLRes := simpleTokenTTL, simpleTokenTTLResolution
- defer func() {
- simpleTokenTTL = oldTTL
- simpleTokenTTLResolution = oldTTLRes
- }()
- simpleTokenTTL = 10 * time.Millisecond
- simpleTokenTTLResolution = simpleTokenTTL
- users := make(map[string]struct{})
-
- as, tearDown := setupAuthStore(t)
- defer tearDown(t)
-
- // create lots of users
- for i := 0; i < 50; i++ {
- u := fmt.Sprintf("user-%d", i)
- ua := &pb.AuthUserAddRequest{Name: u, Password: "123"}
- if _, err := as.UserAdd(ua); err != nil {
- t.Fatal(err)
- }
- users[u] = struct{}{}
- }
-
- // hammer on authenticate with lots of users
- for i := 0; i < 10; i++ {
- var wg sync.WaitGroup
- wg.Add(len(users))
- for u := range users {
- go func(user string) {
- defer wg.Done()
- token := fmt.Sprintf("%s(%d)", user, i)
- ctx := context.WithValue(context.WithValue(context.TODO(), AuthenticateParamIndex{}, uint64(1)), AuthenticateParamSimpleTokenPrefix{}, token)
- if _, err := as.Authenticate(ctx, user, "123"); err != nil {
- t.Fatal(err)
- }
- if _, err := as.AuthInfoFromCtx(ctx); err != nil {
- t.Fatal(err)
- }
- }(u)
- }
- time.Sleep(time.Millisecond)
- wg.Wait()
- }
-}
-
-// TestRolesOrder tests authpb.User.Roles is sorted
-func TestRolesOrder(t *testing.T) {
- b, tPath := backend.NewDefaultTmpBackend()
- defer os.Remove(tPath)
-
- tp, err := NewTokenProvider(tokenTypeSimple, dummyIndexWaiter)
- if err != nil {
- t.Fatal(err)
- }
- as := NewAuthStore(b, tp)
- err = enableAuthAndCreateRoot(as)
- if err != nil {
- t.Fatal(err)
- }
-
- username := "user"
- _, err = as.UserAdd(&pb.AuthUserAddRequest{username, "pass"})
- if err != nil {
- t.Fatal(err)
- }
-
- roles := []string{"role1", "role2", "abc", "xyz", "role3"}
- for _, role := range roles {
- _, err = as.RoleAdd(&pb.AuthRoleAddRequest{role})
- if err != nil {
- t.Fatal(err)
- }
-
- _, err = as.UserGrantRole(&pb.AuthUserGrantRoleRequest{username, role})
- if err != nil {
- t.Fatal(err)
- }
- }
-
- user, err := as.UserGet(&pb.AuthUserGetRequest{username})
- if err != nil {
- t.Fatal(err)
- }
-
- for i := 1; i < len(user.Roles); i++ {
- if strings.Compare(user.Roles[i-1], user.Roles[i]) != -1 {
- t.Errorf("User.Roles isn't sorted (%s vs %s)", user.Roles[i-1], user.Roles[i])
- }
- }
-}
-
-func TestAuthInfoFromCtxWithRootSimple(t *testing.T) {
- testAuthInfoFromCtxWithRoot(t, tokenTypeSimple)
-}
-
-func TestAuthInfoFromCtxWithRootJWT(t *testing.T) {
- opts := testJWTOpts()
- testAuthInfoFromCtxWithRoot(t, opts)
-}
-
-// testAuthInfoFromCtxWithRoot ensures "WithRoot" properly embeds token in the context.
-func testAuthInfoFromCtxWithRoot(t *testing.T, opts string) {
- b, tPath := backend.NewDefaultTmpBackend()
- defer os.Remove(tPath)
-
- tp, err := NewTokenProvider(opts, dummyIndexWaiter)
- if err != nil {
- t.Fatal(err)
- }
- as := NewAuthStore(b, tp)
- defer as.Close()
-
- if err = enableAuthAndCreateRoot(as); err != nil {
- t.Fatal(err)
- }
-
- ctx := context.Background()
- ctx = as.WithRoot(ctx)
-
- ai, aerr := as.AuthInfoFromCtx(ctx)
- if aerr != nil {
- t.Error(err)
- }
- if ai == nil {
- t.Error("expected non-nil *AuthInfo")
- }
- if ai.Username != "root" {
- t.Errorf("expected user name 'root', got %+v", ai)
- }
-}
diff --git a/vendor/github.com/coreos/etcd/client/client_test.go b/vendor/github.com/coreos/etcd/client/client_test.go
deleted file mode 100644
index 40328a1e9..000000000
--- a/vendor/github.com/coreos/etcd/client/client_test.go
+++ /dev/null
@@ -1,1074 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package client
-
-import (
- "context"
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "math/rand"
- "net/http"
- "net/url"
- "reflect"
- "sort"
- "strings"
- "testing"
- "time"
-
- "github.com/coreos/etcd/pkg/testutil"
- "github.com/coreos/etcd/version"
-)
-
-type actionAssertingHTTPClient struct {
- t *testing.T
- num int
- act httpAction
-
- resp http.Response
- body []byte
- err error
-}
-
-func (a *actionAssertingHTTPClient) Do(_ context.Context, act httpAction) (*http.Response, []byte, error) {
- if !reflect.DeepEqual(a.act, act) {
- a.t.Errorf("#%d: unexpected httpAction: want=%#v got=%#v", a.num, a.act, act)
- }
-
- return &a.resp, a.body, a.err
-}
-
-type staticHTTPClient struct {
- resp http.Response
- body []byte
- err error
-}
-
-func (s *staticHTTPClient) Do(context.Context, httpAction) (*http.Response, []byte, error) {
- return &s.resp, s.body, s.err
-}
-
-type staticHTTPAction struct {
- request http.Request
-}
-
-func (s *staticHTTPAction) HTTPRequest(url.URL) *http.Request {
- return &s.request
-}
-
-type staticHTTPResponse struct {
- resp http.Response
- body []byte
- err error
-}
-
-type multiStaticHTTPClient struct {
- responses []staticHTTPResponse
- cur int
-}
-
-func (s *multiStaticHTTPClient) Do(context.Context, httpAction) (*http.Response, []byte, error) {
- r := s.responses[s.cur]
- s.cur++
- return &r.resp, r.body, r.err
-}
-
-func newStaticHTTPClientFactory(responses []staticHTTPResponse) httpClientFactory {
- var cur int
- return func(url.URL) httpClient {
- r := responses[cur]
- cur++
- return &staticHTTPClient{resp: r.resp, body: r.body, err: r.err}
- }
-}
-
-type fakeTransport struct {
- respchan chan *http.Response
- errchan chan error
- startCancel chan struct{}
- finishCancel chan struct{}
-}
-
-func newFakeTransport() *fakeTransport {
- return &fakeTransport{
- respchan: make(chan *http.Response, 1),
- errchan: make(chan error, 1),
- startCancel: make(chan struct{}, 1),
- finishCancel: make(chan struct{}, 1),
- }
-}
-
-func (t *fakeTransport) CancelRequest(*http.Request) {
- t.startCancel <- struct{}{}
-}
-
-type fakeAction struct{}
-
-func (a *fakeAction) HTTPRequest(url.URL) *http.Request {
- return &http.Request{}
-}
-
-func TestSimpleHTTPClientDoSuccess(t *testing.T) {
- tr := newFakeTransport()
- c := &simpleHTTPClient{transport: tr}
-
- tr.respchan <- &http.Response{
- StatusCode: http.StatusTeapot,
- Body: ioutil.NopCloser(strings.NewReader("foo")),
- }
-
- resp, body, err := c.Do(context.Background(), &fakeAction{})
- if err != nil {
- t.Fatalf("incorrect error value: want=nil got=%v", err)
- }
-
- wantCode := http.StatusTeapot
- if wantCode != resp.StatusCode {
- t.Fatalf("invalid response code: want=%d got=%d", wantCode, resp.StatusCode)
- }
-
- wantBody := []byte("foo")
- if !reflect.DeepEqual(wantBody, body) {
- t.Fatalf("invalid response body: want=%q got=%q", wantBody, body)
- }
-}
-
-func TestSimpleHTTPClientDoError(t *testing.T) {
- tr := newFakeTransport()
- c := &simpleHTTPClient{transport: tr}
-
- tr.errchan <- errors.New("fixture")
-
- _, _, err := c.Do(context.Background(), &fakeAction{})
- if err == nil {
- t.Fatalf("expected non-nil error, got nil")
- }
-}
-
-func TestSimpleHTTPClientDoCancelContext(t *testing.T) {
- tr := newFakeTransport()
- c := &simpleHTTPClient{transport: tr}
-
- tr.startCancel <- struct{}{}
- tr.finishCancel <- struct{}{}
-
- _, _, err := c.Do(context.Background(), &fakeAction{})
- if err == nil {
- t.Fatalf("expected non-nil error, got nil")
- }
-}
-
-type checkableReadCloser struct {
- io.ReadCloser
- closed bool
-}
-
-func (c *checkableReadCloser) Close() error {
- if !c.closed {
- c.closed = true
- return c.ReadCloser.Close()
- }
- return nil
-}
-
-func TestSimpleHTTPClientDoCancelContextResponseBodyClosed(t *testing.T) {
- tr := newFakeTransport()
- c := &simpleHTTPClient{transport: tr}
-
- // create an already-cancelled context
- ctx, cancel := context.WithCancel(context.Background())
- cancel()
-
- body := &checkableReadCloser{ReadCloser: ioutil.NopCloser(strings.NewReader("foo"))}
- go func() {
- // wait that simpleHTTPClient knows the context is already timed out,
- // and calls CancelRequest
- testutil.WaitSchedule()
-
- // response is returned before cancel effects
- tr.respchan <- &http.Response{Body: body}
- }()
-
- _, _, err := c.Do(ctx, &fakeAction{})
- if err == nil {
- t.Fatalf("expected non-nil error, got nil")
- }
-
- if !body.closed {
- t.Fatalf("expected closed body")
- }
-}
-
-type blockingBody struct {
- c chan struct{}
-}
-
-func (bb *blockingBody) Read(p []byte) (n int, err error) {
- <-bb.c
- return 0, errors.New("closed")
-}
-
-func (bb *blockingBody) Close() error {
- close(bb.c)
- return nil
-}
-
-func TestSimpleHTTPClientDoCancelContextResponseBodyClosedWithBlockingBody(t *testing.T) {
- tr := newFakeTransport()
- c := &simpleHTTPClient{transport: tr}
-
- ctx, cancel := context.WithCancel(context.Background())
- body := &checkableReadCloser{ReadCloser: &blockingBody{c: make(chan struct{})}}
- go func() {
- tr.respchan <- &http.Response{Body: body}
- time.Sleep(2 * time.Millisecond)
- // cancel after the body is received
- cancel()
- }()
-
- _, _, err := c.Do(ctx, &fakeAction{})
- if err != context.Canceled {
- t.Fatalf("expected %+v, got %+v", context.Canceled, err)
- }
-
- if !body.closed {
- t.Fatalf("expected closed body")
- }
-}
-
-func TestSimpleHTTPClientDoCancelContextWaitForRoundTrip(t *testing.T) {
- tr := newFakeTransport()
- c := &simpleHTTPClient{transport: tr}
-
- donechan := make(chan struct{})
- ctx, cancel := context.WithCancel(context.Background())
- go func() {
- c.Do(ctx, &fakeAction{})
- close(donechan)
- }()
-
- // This should call CancelRequest and begin the cancellation process
- cancel()
-
- select {
- case <-donechan:
- t.Fatalf("simpleHTTPClient.Do should not have exited yet")
- default:
- }
-
- tr.finishCancel <- struct{}{}
-
- select {
- case <-donechan:
- //expected behavior
- return
- case <-time.After(time.Second):
- t.Fatalf("simpleHTTPClient.Do did not exit within 1s")
- }
-}
-
-func TestSimpleHTTPClientDoHeaderTimeout(t *testing.T) {
- tr := newFakeTransport()
- tr.finishCancel <- struct{}{}
- c := &simpleHTTPClient{transport: tr, headerTimeout: time.Millisecond}
-
- errc := make(chan error)
- go func() {
- _, _, err := c.Do(context.Background(), &fakeAction{})
- errc <- err
- }()
-
- select {
- case err := <-errc:
- if err == nil {
- t.Fatalf("expected non-nil error, got nil")
- }
- case <-time.After(time.Second):
- t.Fatalf("unexpected timeout when waiting for the test to finish")
- }
-}
-
-func TestHTTPClusterClientDo(t *testing.T) {
- fakeErr := errors.New("fake!")
- fakeURL := url.URL{}
- tests := []struct {
- client *httpClusterClient
- ctx context.Context
-
- wantCode int
- wantErr error
- wantPinned int
- }{
- // first good response short-circuits Do
- {
- client: &httpClusterClient{
- endpoints: []url.URL{fakeURL, fakeURL},
- clientFactory: newStaticHTTPClientFactory(
- []staticHTTPResponse{
- {resp: http.Response{StatusCode: http.StatusTeapot}},
- {err: fakeErr},
- },
- ),
- rand: rand.New(rand.NewSource(0)),
- },
- wantCode: http.StatusTeapot,
- },
-
- // fall through to good endpoint if err is arbitrary
- {
- client: &httpClusterClient{
- endpoints: []url.URL{fakeURL, fakeURL},
- clientFactory: newStaticHTTPClientFactory(
- []staticHTTPResponse{
- {err: fakeErr},
- {resp: http.Response{StatusCode: http.StatusTeapot}},
- },
- ),
- rand: rand.New(rand.NewSource(0)),
- },
- wantCode: http.StatusTeapot,
- wantPinned: 1,
- },
-
- // context.Canceled short-circuits Do
- {
- client: &httpClusterClient{
- endpoints: []url.URL{fakeURL, fakeURL},
- clientFactory: newStaticHTTPClientFactory(
- []staticHTTPResponse{
- {err: context.Canceled},
- {resp: http.Response{StatusCode: http.StatusTeapot}},
- },
- ),
- rand: rand.New(rand.NewSource(0)),
- },
- wantErr: context.Canceled,
- },
-
- // return err if there are no endpoints
- {
- client: &httpClusterClient{
- endpoints: []url.URL{},
- clientFactory: newHTTPClientFactory(nil, nil, 0),
- rand: rand.New(rand.NewSource(0)),
- },
- wantErr: ErrNoEndpoints,
- },
-
- // return err if all endpoints return arbitrary errors
- {
- client: &httpClusterClient{
- endpoints: []url.URL{fakeURL, fakeURL},
- clientFactory: newStaticHTTPClientFactory(
- []staticHTTPResponse{
- {err: fakeErr},
- {err: fakeErr},
- },
- ),
- rand: rand.New(rand.NewSource(0)),
- },
- wantErr: &ClusterError{Errors: []error{fakeErr, fakeErr}},
- },
-
- // 500-level errors cause Do to fallthrough to next endpoint
- {
- client: &httpClusterClient{
- endpoints: []url.URL{fakeURL, fakeURL},
- clientFactory: newStaticHTTPClientFactory(
- []staticHTTPResponse{
- {resp: http.Response{StatusCode: http.StatusBadGateway}},
- {resp: http.Response{StatusCode: http.StatusTeapot}},
- },
- ),
- rand: rand.New(rand.NewSource(0)),
- },
- wantCode: http.StatusTeapot,
- wantPinned: 1,
- },
-
- // 500-level errors cause one shot Do to fallthrough to next endpoint
- {
- client: &httpClusterClient{
- endpoints: []url.URL{fakeURL, fakeURL},
- clientFactory: newStaticHTTPClientFactory(
- []staticHTTPResponse{
- {resp: http.Response{StatusCode: http.StatusBadGateway}},
- {resp: http.Response{StatusCode: http.StatusTeapot}},
- },
- ),
- rand: rand.New(rand.NewSource(0)),
- },
- ctx: context.WithValue(context.Background(), &oneShotCtxValue, &oneShotCtxValue),
- wantErr: fmt.Errorf("client: etcd member returns server error [Bad Gateway]"),
- wantPinned: 1,
- },
- }
-
- for i, tt := range tests {
- if tt.ctx == nil {
- tt.ctx = context.Background()
- }
- resp, _, err := tt.client.Do(tt.ctx, nil)
- if !reflect.DeepEqual(tt.wantErr, err) {
- t.Errorf("#%d: got err=%v, want=%v", i, err, tt.wantErr)
- continue
- }
-
- if resp == nil {
- if tt.wantCode != 0 {
- t.Errorf("#%d: resp is nil, want=%d", i, tt.wantCode)
- continue
- }
- } else if resp.StatusCode != tt.wantCode {
- t.Errorf("#%d: resp code=%d, want=%d", i, resp.StatusCode, tt.wantCode)
- continue
- }
-
- if tt.client.pinned != tt.wantPinned {
- t.Errorf("#%d: pinned=%d, want=%d", i, tt.client.pinned, tt.wantPinned)
- }
- }
-}
-
-func TestHTTPClusterClientDoDeadlineExceedContext(t *testing.T) {
- fakeURL := url.URL{}
- tr := newFakeTransport()
- tr.finishCancel <- struct{}{}
- c := &httpClusterClient{
- clientFactory: newHTTPClientFactory(tr, DefaultCheckRedirect, 0),
- endpoints: []url.URL{fakeURL},
- }
-
- errc := make(chan error)
- go func() {
- ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond)
- defer cancel()
- _, _, err := c.Do(ctx, &fakeAction{})
- errc <- err
- }()
-
- select {
- case err := <-errc:
- if err != context.DeadlineExceeded {
- t.Errorf("err = %+v, want %+v", err, context.DeadlineExceeded)
- }
- case <-time.After(time.Second):
- t.Fatalf("unexpected timeout when waiting for request to deadline exceed")
- }
-}
-
-type fakeCancelContext struct{}
-
-var fakeCancelContextError = errors.New("fake context canceled")
-
-func (f fakeCancelContext) Deadline() (time.Time, bool) { return time.Time{}, false }
-func (f fakeCancelContext) Done() <-chan struct{} {
- d := make(chan struct{}, 1)
- d <- struct{}{}
- return d
-}
-func (f fakeCancelContext) Err() error { return fakeCancelContextError }
-func (f fakeCancelContext) Value(key interface{}) interface{} { return 1 }
-
-func withTimeout(parent context.Context, timeout time.Duration) (context.Context, context.CancelFunc) {
- return parent, func() { parent = nil }
-}
-
-func TestHTTPClusterClientDoCanceledContext(t *testing.T) {
- fakeURL := url.URL{}
- tr := newFakeTransport()
- tr.finishCancel <- struct{}{}
- c := &httpClusterClient{
- clientFactory: newHTTPClientFactory(tr, DefaultCheckRedirect, 0),
- endpoints: []url.URL{fakeURL},
- }
-
- errc := make(chan error)
- go func() {
- ctx, cancel := withTimeout(fakeCancelContext{}, time.Millisecond)
- cancel()
- _, _, err := c.Do(ctx, &fakeAction{})
- errc <- err
- }()
-
- select {
- case err := <-errc:
- if err != fakeCancelContextError {
- t.Errorf("err = %+v, want %+v", err, fakeCancelContextError)
- }
- case <-time.After(time.Second):
- t.Fatalf("unexpected timeout when waiting for request to fake context canceled")
- }
-}
-
-func TestRedirectedHTTPAction(t *testing.T) {
- act := &redirectedHTTPAction{
- action: &staticHTTPAction{
- request: http.Request{
- Method: "DELETE",
- URL: &url.URL{
- Scheme: "https",
- Host: "foo.example.com",
- Path: "/ping",
- },
- },
- },
- location: url.URL{
- Scheme: "https",
- Host: "bar.example.com",
- Path: "/pong",
- },
- }
-
- want := &http.Request{
- Method: "DELETE",
- URL: &url.URL{
- Scheme: "https",
- Host: "bar.example.com",
- Path: "/pong",
- },
- }
- got := act.HTTPRequest(url.URL{Scheme: "http", Host: "baz.example.com", Path: "/pang"})
-
- if !reflect.DeepEqual(want, got) {
- t.Fatalf("HTTPRequest is %#v, want %#v", want, got)
- }
-}
-
-func TestRedirectFollowingHTTPClient(t *testing.T) {
- tests := []struct {
- checkRedirect CheckRedirectFunc
- client httpClient
- wantCode int
- wantErr error
- }{
- // errors bubbled up
- {
- checkRedirect: func(int) error { return ErrTooManyRedirects },
- client: &multiStaticHTTPClient{
- responses: []staticHTTPResponse{
- {
- err: errors.New("fail!"),
- },
- },
- },
- wantErr: errors.New("fail!"),
- },
-
- // no need to follow redirect if none given
- {
- checkRedirect: func(int) error { return ErrTooManyRedirects },
- client: &multiStaticHTTPClient{
- responses: []staticHTTPResponse{
- {
- resp: http.Response{
- StatusCode: http.StatusTeapot,
- },
- },
- },
- },
- wantCode: http.StatusTeapot,
- },
-
- // redirects if less than max
- {
- checkRedirect: func(via int) error {
- if via >= 2 {
- return ErrTooManyRedirects
- }
- return nil
- },
- client: &multiStaticHTTPClient{
- responses: []staticHTTPResponse{
- {
- resp: http.Response{
- StatusCode: http.StatusTemporaryRedirect,
- Header: http.Header{"Location": []string{"http://example.com"}},
- },
- },
- {
- resp: http.Response{
- StatusCode: http.StatusTeapot,
- },
- },
- },
- },
- wantCode: http.StatusTeapot,
- },
-
- // succeed after reaching max redirects
- {
- checkRedirect: func(via int) error {
- if via >= 3 {
- return ErrTooManyRedirects
- }
- return nil
- },
- client: &multiStaticHTTPClient{
- responses: []staticHTTPResponse{
- {
- resp: http.Response{
- StatusCode: http.StatusTemporaryRedirect,
- Header: http.Header{"Location": []string{"http://example.com"}},
- },
- },
- {
- resp: http.Response{
- StatusCode: http.StatusTemporaryRedirect,
- Header: http.Header{"Location": []string{"http://example.com"}},
- },
- },
- {
- resp: http.Response{
- StatusCode: http.StatusTeapot,
- },
- },
- },
- },
- wantCode: http.StatusTeapot,
- },
-
- // fail if too many redirects
- {
- checkRedirect: func(via int) error {
- if via >= 2 {
- return ErrTooManyRedirects
- }
- return nil
- },
- client: &multiStaticHTTPClient{
- responses: []staticHTTPResponse{
- {
- resp: http.Response{
- StatusCode: http.StatusTemporaryRedirect,
- Header: http.Header{"Location": []string{"http://example.com"}},
- },
- },
- {
- resp: http.Response{
- StatusCode: http.StatusTemporaryRedirect,
- Header: http.Header{"Location": []string{"http://example.com"}},
- },
- },
- {
- resp: http.Response{
- StatusCode: http.StatusTeapot,
- },
- },
- },
- },
- wantErr: ErrTooManyRedirects,
- },
-
- // fail if Location header not set
- {
- checkRedirect: func(int) error { return ErrTooManyRedirects },
- client: &multiStaticHTTPClient{
- responses: []staticHTTPResponse{
- {
- resp: http.Response{
- StatusCode: http.StatusTemporaryRedirect,
- },
- },
- },
- },
- wantErr: errors.New("Location header not set"),
- },
-
- // fail if Location header is invalid
- {
- checkRedirect: func(int) error { return ErrTooManyRedirects },
- client: &multiStaticHTTPClient{
- responses: []staticHTTPResponse{
- {
- resp: http.Response{
- StatusCode: http.StatusTemporaryRedirect,
- Header: http.Header{"Location": []string{":"}},
- },
- },
- },
- },
- wantErr: errors.New("Location header not valid URL: :"),
- },
-
- // fail if redirects checked way too many times
- {
- checkRedirect: func(int) error { return nil },
- client: &staticHTTPClient{
- resp: http.Response{
- StatusCode: http.StatusTemporaryRedirect,
- Header: http.Header{"Location": []string{"http://example.com"}},
- },
- },
- wantErr: errTooManyRedirectChecks,
- },
- }
-
- for i, tt := range tests {
- client := &redirectFollowingHTTPClient{client: tt.client, checkRedirect: tt.checkRedirect}
- resp, _, err := client.Do(context.Background(), nil)
- if !reflect.DeepEqual(tt.wantErr, err) {
- t.Errorf("#%d: got err=%v, want=%v", i, err, tt.wantErr)
- continue
- }
-
- if resp == nil {
- if tt.wantCode != 0 {
- t.Errorf("#%d: resp is nil, want=%d", i, tt.wantCode)
- }
- continue
- }
-
- if resp.StatusCode != tt.wantCode {
- t.Errorf("#%d: resp code=%d, want=%d", i, resp.StatusCode, tt.wantCode)
- continue
- }
- }
-}
-
-func TestDefaultCheckRedirect(t *testing.T) {
- tests := []struct {
- num int
- err error
- }{
- {0, nil},
- {5, nil},
- {10, nil},
- {11, ErrTooManyRedirects},
- {29, ErrTooManyRedirects},
- }
-
- for i, tt := range tests {
- err := DefaultCheckRedirect(tt.num)
- if !reflect.DeepEqual(tt.err, err) {
- t.Errorf("#%d: want=%#v got=%#v", i, tt.err, err)
- }
- }
-}
-
-func TestHTTPClusterClientSync(t *testing.T) {
- cf := newStaticHTTPClientFactory([]staticHTTPResponse{
- {
- resp: http.Response{StatusCode: http.StatusOK, Header: http.Header{"Content-Type": []string{"application/json"}}},
- body: []byte(`{"members":[{"id":"2745e2525fce8fe","peerURLs":["http://127.0.0.1:7003"],"name":"node3","clientURLs":["http://127.0.0.1:4003"]},{"id":"42134f434382925","peerURLs":["http://127.0.0.1:2380","http://127.0.0.1:7001"],"name":"node1","clientURLs":["http://127.0.0.1:2379","http://127.0.0.1:4001"]},{"id":"94088180e21eb87b","peerURLs":["http://127.0.0.1:7002"],"name":"node2","clientURLs":["http://127.0.0.1:4002"]}]}`),
- },
- })
-
- hc := &httpClusterClient{
- clientFactory: cf,
- rand: rand.New(rand.NewSource(0)),
- }
- err := hc.SetEndpoints([]string{"http://127.0.0.1:2379"})
- if err != nil {
- t.Fatalf("unexpected error during setup: %#v", err)
- }
-
- want := []string{"http://127.0.0.1:2379"}
- got := hc.Endpoints()
- if !reflect.DeepEqual(want, got) {
- t.Fatalf("incorrect endpoints: want=%#v got=%#v", want, got)
- }
-
- err = hc.Sync(context.Background())
- if err != nil {
- t.Fatalf("unexpected error during Sync: %#v", err)
- }
-
- want = []string{"http://127.0.0.1:2379", "http://127.0.0.1:4001", "http://127.0.0.1:4002", "http://127.0.0.1:4003"}
- got = hc.Endpoints()
- sort.Sort(sort.StringSlice(got))
- if !reflect.DeepEqual(want, got) {
- t.Fatalf("incorrect endpoints post-Sync: want=%#v got=%#v", want, got)
- }
-
- err = hc.SetEndpoints([]string{"http://127.0.0.1:4009"})
- if err != nil {
- t.Fatalf("unexpected error during reset: %#v", err)
- }
-
- want = []string{"http://127.0.0.1:4009"}
- got = hc.Endpoints()
- if !reflect.DeepEqual(want, got) {
- t.Fatalf("incorrect endpoints post-reset: want=%#v got=%#v", want, got)
- }
-}
-
-func TestHTTPClusterClientSyncFail(t *testing.T) {
- cf := newStaticHTTPClientFactory([]staticHTTPResponse{
- {err: errors.New("fail!")},
- })
-
- hc := &httpClusterClient{
- clientFactory: cf,
- rand: rand.New(rand.NewSource(0)),
- }
- err := hc.SetEndpoints([]string{"http://127.0.0.1:2379"})
- if err != nil {
- t.Fatalf("unexpected error during setup: %#v", err)
- }
-
- want := []string{"http://127.0.0.1:2379"}
- got := hc.Endpoints()
- if !reflect.DeepEqual(want, got) {
- t.Fatalf("incorrect endpoints: want=%#v got=%#v", want, got)
- }
-
- err = hc.Sync(context.Background())
- if err == nil {
- t.Fatalf("got nil error during Sync")
- }
-
- got = hc.Endpoints()
- if !reflect.DeepEqual(want, got) {
- t.Fatalf("incorrect endpoints after failed Sync: want=%#v got=%#v", want, got)
- }
-}
-
-func TestHTTPClusterClientAutoSyncCancelContext(t *testing.T) {
- cf := newStaticHTTPClientFactory([]staticHTTPResponse{
- {
- resp: http.Response{StatusCode: http.StatusOK, Header: http.Header{"Content-Type": []string{"application/json"}}},
- body: []byte(`{"members":[{"id":"2745e2525fce8fe","peerURLs":["http://127.0.0.1:7003"],"name":"node3","clientURLs":["http://127.0.0.1:4003"]},{"id":"42134f434382925","peerURLs":["http://127.0.0.1:2380","http://127.0.0.1:7001"],"name":"node1","clientURLs":["http://127.0.0.1:2379","http://127.0.0.1:4001"]},{"id":"94088180e21eb87b","peerURLs":["http://127.0.0.1:7002"],"name":"node2","clientURLs":["http://127.0.0.1:4002"]}]}`),
- },
- })
-
- hc := &httpClusterClient{
- clientFactory: cf,
- rand: rand.New(rand.NewSource(0)),
- }
- err := hc.SetEndpoints([]string{"http://127.0.0.1:2379"})
- if err != nil {
- t.Fatalf("unexpected error during setup: %#v", err)
- }
- ctx, cancel := context.WithCancel(context.Background())
- cancel()
-
- err = hc.AutoSync(ctx, time.Hour)
- if err != context.Canceled {
- t.Fatalf("incorrect error value: want=%v got=%v", context.Canceled, err)
- }
-}
-
-func TestHTTPClusterClientAutoSyncFail(t *testing.T) {
- cf := newStaticHTTPClientFactory([]staticHTTPResponse{
- {err: errors.New("fail!")},
- })
-
- hc := &httpClusterClient{
- clientFactory: cf,
- rand: rand.New(rand.NewSource(0)),
- }
- err := hc.SetEndpoints([]string{"http://127.0.0.1:2379"})
- if err != nil {
- t.Fatalf("unexpected error during setup: %#v", err)
- }
-
- err = hc.AutoSync(context.Background(), time.Hour)
- if !strings.HasPrefix(err.Error(), ErrClusterUnavailable.Error()) {
- t.Fatalf("incorrect error value: want=%v got=%v", ErrClusterUnavailable, err)
- }
-}
-
-func TestHTTPClusterClientGetVersion(t *testing.T) {
- body := []byte(`{"etcdserver":"2.3.2","etcdcluster":"2.3.0"}`)
- cf := newStaticHTTPClientFactory([]staticHTTPResponse{
- {
- resp: http.Response{StatusCode: http.StatusOK, Header: http.Header{"Content-Length": []string{"44"}}},
- body: body,
- },
- })
-
- hc := &httpClusterClient{
- clientFactory: cf,
- rand: rand.New(rand.NewSource(0)),
- }
- err := hc.SetEndpoints([]string{"http://127.0.0.1:4003", "http://127.0.0.1:2379", "http://127.0.0.1:4001", "http://127.0.0.1:4002"})
- if err != nil {
- t.Fatalf("unexpected error during setup: %#v", err)
- }
-
- actual, err := hc.GetVersion(context.Background())
- if err != nil {
- t.Errorf("non-nil error: %#v", err)
- }
- expected := version.Versions{Server: "2.3.2", Cluster: "2.3.0"}
- if !reflect.DeepEqual(&expected, actual) {
- t.Errorf("incorrect Response: want=%#v got=%#v", expected, actual)
- }
-}
-
-// TestHTTPClusterClientSyncPinEndpoint tests that Sync() pins the endpoint when
-// it gets the exactly same member list as before.
-func TestHTTPClusterClientSyncPinEndpoint(t *testing.T) {
- cf := newStaticHTTPClientFactory([]staticHTTPResponse{
- {
- resp: http.Response{StatusCode: http.StatusOK, Header: http.Header{"Content-Type": []string{"application/json"}}},
- body: []byte(`{"members":[{"id":"2745e2525fce8fe","peerURLs":["http://127.0.0.1:7003"],"name":"node3","clientURLs":["http://127.0.0.1:4003"]},{"id":"42134f434382925","peerURLs":["http://127.0.0.1:2380","http://127.0.0.1:7001"],"name":"node1","clientURLs":["http://127.0.0.1:2379","http://127.0.0.1:4001"]},{"id":"94088180e21eb87b","peerURLs":["http://127.0.0.1:7002"],"name":"node2","clientURLs":["http://127.0.0.1:4002"]}]}`),
- },
- {
- resp: http.Response{StatusCode: http.StatusOK, Header: http.Header{"Content-Type": []string{"application/json"}}},
- body: []byte(`{"members":[{"id":"2745e2525fce8fe","peerURLs":["http://127.0.0.1:7003"],"name":"node3","clientURLs":["http://127.0.0.1:4003"]},{"id":"42134f434382925","peerURLs":["http://127.0.0.1:2380","http://127.0.0.1:7001"],"name":"node1","clientURLs":["http://127.0.0.1:2379","http://127.0.0.1:4001"]},{"id":"94088180e21eb87b","peerURLs":["http://127.0.0.1:7002"],"name":"node2","clientURLs":["http://127.0.0.1:4002"]}]}`),
- },
- {
- resp: http.Response{StatusCode: http.StatusOK, Header: http.Header{"Content-Type": []string{"application/json"}}},
- body: []byte(`{"members":[{"id":"2745e2525fce8fe","peerURLs":["http://127.0.0.1:7003"],"name":"node3","clientURLs":["http://127.0.0.1:4003"]},{"id":"42134f434382925","peerURLs":["http://127.0.0.1:2380","http://127.0.0.1:7001"],"name":"node1","clientURLs":["http://127.0.0.1:2379","http://127.0.0.1:4001"]},{"id":"94088180e21eb87b","peerURLs":["http://127.0.0.1:7002"],"name":"node2","clientURLs":["http://127.0.0.1:4002"]}]}`),
- },
- })
-
- hc := &httpClusterClient{
- clientFactory: cf,
- rand: rand.New(rand.NewSource(0)),
- }
- err := hc.SetEndpoints([]string{"http://127.0.0.1:4003", "http://127.0.0.1:2379", "http://127.0.0.1:4001", "http://127.0.0.1:4002"})
- if err != nil {
- t.Fatalf("unexpected error during setup: %#v", err)
- }
- pinnedEndpoint := hc.endpoints[hc.pinned]
-
- for i := 0; i < 3; i++ {
- err = hc.Sync(context.Background())
- if err != nil {
- t.Fatalf("#%d: unexpected error during Sync: %#v", i, err)
- }
-
- if g := hc.endpoints[hc.pinned]; g != pinnedEndpoint {
- t.Errorf("#%d: pinned endpoint = %v, want %v", i, g, pinnedEndpoint)
- }
- }
-}
-
-// TestHTTPClusterClientSyncUnpinEndpoint tests that Sync() unpins the endpoint when
-// it gets a different member list than before.
-func TestHTTPClusterClientSyncUnpinEndpoint(t *testing.T) {
- cf := newStaticHTTPClientFactory([]staticHTTPResponse{
- {
- resp: http.Response{StatusCode: http.StatusOK, Header: http.Header{"Content-Type": []string{"application/json"}}},
- body: []byte(`{"members":[{"id":"2745e2525fce8fe","peerURLs":["http://127.0.0.1:7003"],"name":"node3","clientURLs":["http://127.0.0.1:4003"]},{"id":"42134f434382925","peerURLs":["http://127.0.0.1:2380","http://127.0.0.1:7001"],"name":"node1","clientURLs":["http://127.0.0.1:2379","http://127.0.0.1:4001"]},{"id":"94088180e21eb87b","peerURLs":["http://127.0.0.1:7002"],"name":"node2","clientURLs":["http://127.0.0.1:4002"]}]}`),
- },
- {
- resp: http.Response{StatusCode: http.StatusOK, Header: http.Header{"Content-Type": []string{"application/json"}}},
- body: []byte(`{"members":[{"id":"42134f434382925","peerURLs":["http://127.0.0.1:2380","http://127.0.0.1:7001"],"name":"node1","clientURLs":["http://127.0.0.1:2379","http://127.0.0.1:4001"]},{"id":"94088180e21eb87b","peerURLs":["http://127.0.0.1:7002"],"name":"node2","clientURLs":["http://127.0.0.1:4002"]}]}`),
- },
- {
- resp: http.Response{StatusCode: http.StatusOK, Header: http.Header{"Content-Type": []string{"application/json"}}},
- body: []byte(`{"members":[{"id":"2745e2525fce8fe","peerURLs":["http://127.0.0.1:7003"],"name":"node3","clientURLs":["http://127.0.0.1:4003"]},{"id":"42134f434382925","peerURLs":["http://127.0.0.1:2380","http://127.0.0.1:7001"],"name":"node1","clientURLs":["http://127.0.0.1:2379","http://127.0.0.1:4001"]},{"id":"94088180e21eb87b","peerURLs":["http://127.0.0.1:7002"],"name":"node2","clientURLs":["http://127.0.0.1:4002"]}]}`),
- },
- })
-
- hc := &httpClusterClient{
- clientFactory: cf,
- rand: rand.New(rand.NewSource(0)),
- }
- err := hc.SetEndpoints([]string{"http://127.0.0.1:4003", "http://127.0.0.1:2379", "http://127.0.0.1:4001", "http://127.0.0.1:4002"})
- if err != nil {
- t.Fatalf("unexpected error during setup: %#v", err)
- }
- wants := []string{"http://127.0.0.1:2379", "http://127.0.0.1:4001", "http://127.0.0.1:4002"}
-
- for i := 0; i < 3; i++ {
- err = hc.Sync(context.Background())
- if err != nil {
- t.Fatalf("#%d: unexpected error during Sync: %#v", i, err)
- }
-
- if g := hc.endpoints[hc.pinned]; g.String() != wants[i] {
- t.Errorf("#%d: pinned endpoint = %v, want %v", i, g, wants[i])
- }
- }
-}
-
-// TestHTTPClusterClientSyncPinLeaderEndpoint tests that Sync() pins the leader
-// when the selection mode is EndpointSelectionPrioritizeLeader
-func TestHTTPClusterClientSyncPinLeaderEndpoint(t *testing.T) {
- cf := newStaticHTTPClientFactory([]staticHTTPResponse{
- {
- resp: http.Response{StatusCode: http.StatusOK, Header: http.Header{"Content-Type": []string{"application/json"}}},
- body: []byte(`{"members":[{"id":"2745e2525fce8fe","peerURLs":["http://127.0.0.1:7003"],"name":"node3","clientURLs":["http://127.0.0.1:4003"]},{"id":"42134f434382925","peerURLs":["http://127.0.0.1:2380","http://127.0.0.1:7001"],"name":"node1","clientURLs":["http://127.0.0.1:2379","http://127.0.0.1:4001"]},{"id":"94088180e21eb87b","peerURLs":["http://127.0.0.1:7002"],"name":"node2","clientURLs":["http://127.0.0.1:4002"]}]}`),
- },
- {
- resp: http.Response{StatusCode: http.StatusOK, Header: http.Header{"Content-Type": []string{"application/json"}}},
- body: []byte(`{"id":"2745e2525fce8fe","peerURLs":["http://127.0.0.1:7003"],"name":"node3","clientURLs":["http://127.0.0.1:4003"]}`),
- },
- {
- resp: http.Response{StatusCode: http.StatusOK, Header: http.Header{"Content-Type": []string{"application/json"}}},
- body: []byte(`{"members":[{"id":"2745e2525fce8fe","peerURLs":["http://127.0.0.1:7003"],"name":"node3","clientURLs":["http://127.0.0.1:4003"]},{"id":"42134f434382925","peerURLs":["http://127.0.0.1:2380","http://127.0.0.1:7001"],"name":"node1","clientURLs":["http://127.0.0.1:2379","http://127.0.0.1:4001"]},{"id":"94088180e21eb87b","peerURLs":["http://127.0.0.1:7002"],"name":"node2","clientURLs":["http://127.0.0.1:4002"]}]}`),
- },
- {
- resp: http.Response{StatusCode: http.StatusOK, Header: http.Header{"Content-Type": []string{"application/json"}}},
- body: []byte(`{"id":"94088180e21eb87b","peerURLs":["http://127.0.0.1:7002"],"name":"node2","clientURLs":["http://127.0.0.1:4002"]}`),
- },
- })
-
- hc := &httpClusterClient{
- clientFactory: cf,
- rand: rand.New(rand.NewSource(0)),
- selectionMode: EndpointSelectionPrioritizeLeader,
- endpoints: []url.URL{{}}, // Need somewhere to pretend to send to initially
- }
-
- wants := []string{"http://127.0.0.1:4003", "http://127.0.0.1:4002"}
-
- for i, want := range wants {
- err := hc.Sync(context.Background())
- if err != nil {
- t.Fatalf("#%d: unexpected error during Sync: %#v", i, err)
- }
-
- pinned := hc.endpoints[hc.pinned].String()
- if pinned != want {
- t.Errorf("#%d: pinned endpoint = %v, want %v", i, pinned, want)
- }
- }
-}
-
-func TestHTTPClusterClientResetFail(t *testing.T) {
- tests := [][]string{
- // need at least one endpoint
- {},
-
- // urls must be valid
- {":"},
- }
-
- for i, tt := range tests {
- hc := &httpClusterClient{rand: rand.New(rand.NewSource(0))}
- err := hc.SetEndpoints(tt)
- if err == nil {
- t.Errorf("#%d: expected non-nil error", i)
- }
- }
-}
-
-func TestHTTPClusterClientResetPinRandom(t *testing.T) {
- round := 2000
- pinNum := 0
- for i := 0; i < round; i++ {
- hc := &httpClusterClient{rand: rand.New(rand.NewSource(int64(i)))}
- err := hc.SetEndpoints([]string{"http://127.0.0.1:4001", "http://127.0.0.1:4002", "http://127.0.0.1:4003"})
- if err != nil {
- t.Fatalf("#%d: reset error (%v)", i, err)
- }
- if hc.endpoints[hc.pinned].String() == "http://127.0.0.1:4001" {
- pinNum++
- }
- }
-
- min := 1.0/3.0 - 0.05
- max := 1.0/3.0 + 0.05
- if ratio := float64(pinNum) / float64(round); ratio > max || ratio < min {
- t.Errorf("pinned ratio = %v, want [%v, %v]", ratio, min, max)
- }
-}
diff --git a/vendor/github.com/coreos/etcd/client/example_keys_test.go b/vendor/github.com/coreos/etcd/client/example_keys_test.go
deleted file mode 100644
index 66063571d..000000000
--- a/vendor/github.com/coreos/etcd/client/example_keys_test.go
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright 2017 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package client_test
-
-import (
- "context"
- "fmt"
- "log"
- "sort"
-
- "github.com/coreos/etcd/client"
-)
-
-func ExampleKeysAPI_directory() {
- c, err := client.New(client.Config{
- Endpoints: exampleEndpoints,
- Transport: exampleTransport,
- })
- if err != nil {
- log.Fatal(err)
- }
- kapi := client.NewKeysAPI(c)
-
- // Setting '/myNodes' to create a directory that will hold some keys.
- o := client.SetOptions{Dir: true}
- resp, err := kapi.Set(context.Background(), "/myNodes", "", &o)
- if err != nil {
- log.Fatal(err)
- }
-
- // Add keys to /myNodes directory.
- resp, err = kapi.Set(context.Background(), "/myNodes/key1", "value1", nil)
- if err != nil {
- log.Fatal(err)
- }
- resp, err = kapi.Set(context.Background(), "/myNodes/key2", "value2", nil)
- if err != nil {
- log.Fatal(err)
- }
-
- // fetch directory
- resp, err = kapi.Get(context.Background(), "/myNodes", nil)
- if err != nil {
- log.Fatal(err)
- }
- // print directory keys
- sort.Sort(resp.Node.Nodes)
- for _, n := range resp.Node.Nodes {
- fmt.Printf("Key: %q, Value: %q\n", n.Key, n.Value)
- }
-
- // Output:
- // Key: "/myNodes/key1", Value: "value1"
- // Key: "/myNodes/key2", Value: "value2"
-}
-
-func ExampleKeysAPI_setget() {
- c, err := client.New(client.Config{
- Endpoints: exampleEndpoints,
- Transport: exampleTransport,
- })
- if err != nil {
- log.Fatal(err)
- }
- kapi := client.NewKeysAPI(c)
-
- // Set key "/foo" to value "bar".
- resp, err := kapi.Set(context.Background(), "/foo", "bar", nil)
- if err != nil {
- log.Fatal(err)
- }
- // Get key "/foo"
- resp, err = kapi.Get(context.Background(), "/foo", nil)
- if err != nil {
- log.Fatal(err)
- }
-
- fmt.Printf("%q key has %q value\n", resp.Node.Key, resp.Node.Value)
-
- // Output: "/foo" key has "bar" value
-}
diff --git a/vendor/github.com/coreos/etcd/client/fake_transport_test.go b/vendor/github.com/coreos/etcd/client/fake_transport_test.go
deleted file mode 100644
index 7a725c17c..000000000
--- a/vendor/github.com/coreos/etcd/client/fake_transport_test.go
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package client
-
-import (
- "errors"
- "net/http"
-)
-
-func (t *fakeTransport) RoundTrip(req *http.Request) (*http.Response, error) {
- select {
- case resp := <-t.respchan:
- return resp, nil
- case err := <-t.errchan:
- return nil, err
- case <-t.startCancel:
- case <-req.Cancel:
- }
- select {
- // this simulates that the request is finished before cancel effects
- case resp := <-t.respchan:
- return resp, nil
- // wait on finishCancel to simulate taking some amount of
- // time while calling CancelRequest
- case <-t.finishCancel:
- return nil, errors.New("cancelled")
- }
-}
diff --git a/vendor/github.com/coreos/etcd/client/keys_bench_test.go b/vendor/github.com/coreos/etcd/client/keys_bench_test.go
deleted file mode 100644
index f8ca3ea33..000000000
--- a/vendor/github.com/coreos/etcd/client/keys_bench_test.go
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package client
-
-import (
- "encoding/json"
- "net/http"
- "reflect"
- "strings"
- "testing"
-)
-
-func createTestNode(size int) *Node {
- return &Node{
- Key: strings.Repeat("a", 30),
- Value: strings.Repeat("a", size),
- CreatedIndex: 123456,
- ModifiedIndex: 123456,
- TTL: 123456789,
- }
-}
-
-func createTestNodeWithChildren(children, size int) *Node {
- node := createTestNode(size)
- for i := 0; i < children; i++ {
- node.Nodes = append(node.Nodes, createTestNode(size))
- }
- return node
-}
-
-func createTestResponse(children, size int) *Response {
- return &Response{
- Action: "aaaaa",
- Node: createTestNodeWithChildren(children, size),
- PrevNode: nil,
- }
-}
-
-func benchmarkResponseUnmarshalling(b *testing.B, children, size int) {
- header := http.Header{}
- header.Add("X-Etcd-Index", "123456")
- response := createTestResponse(children, size)
- body, err := json.Marshal(response)
- if err != nil {
- b.Fatal(err)
- }
-
- b.ResetTimer()
- newResponse := new(Response)
- for i := 0; i < b.N; i++ {
- if newResponse, err = unmarshalSuccessfulKeysResponse(header, body); err != nil {
- b.Errorf("error unmarshaling response (%v)", err)
- }
-
- }
- if !reflect.DeepEqual(response.Node, newResponse.Node) {
- b.Errorf("Unexpected difference in a parsed response: \n%+v\n%+v", response, newResponse)
- }
-}
-
-func BenchmarkSmallResponseUnmarshal(b *testing.B) {
- benchmarkResponseUnmarshalling(b, 30, 20)
-}
-
-func BenchmarkManySmallResponseUnmarshal(b *testing.B) {
- benchmarkResponseUnmarshalling(b, 3000, 20)
-}
-
-func BenchmarkMediumResponseUnmarshal(b *testing.B) {
- benchmarkResponseUnmarshalling(b, 300, 200)
-}
-
-func BenchmarkLargeResponseUnmarshal(b *testing.B) {
- benchmarkResponseUnmarshalling(b, 3000, 2000)
-}
diff --git a/vendor/github.com/coreos/etcd/client/keys_test.go b/vendor/github.com/coreos/etcd/client/keys_test.go
deleted file mode 100644
index 0e190cf59..000000000
--- a/vendor/github.com/coreos/etcd/client/keys_test.go
+++ /dev/null
@@ -1,1428 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package client
-
-import (
- "context"
- "errors"
- "fmt"
- "io/ioutil"
- "net/http"
- "net/url"
- "reflect"
- "testing"
- "time"
-)
-
-func TestV2KeysURLHelper(t *testing.T) {
- tests := []struct {
- endpoint url.URL
- prefix string
- key string
- want url.URL
- }{
- // key is empty, no problem
- {
- endpoint: url.URL{Scheme: "http", Host: "example.com", Path: "/v2/keys"},
- prefix: "",
- key: "",
- want: url.URL{Scheme: "http", Host: "example.com", Path: "/v2/keys"},
- },
-
- // key is joined to path
- {
- endpoint: url.URL{Scheme: "http", Host: "example.com", Path: "/v2/keys"},
- prefix: "",
- key: "/foo/bar",
- want: url.URL{Scheme: "http", Host: "example.com", Path: "/v2/keys/foo/bar"},
- },
-
- // key is joined to path when path is empty
- {
- endpoint: url.URL{Scheme: "http", Host: "example.com", Path: ""},
- prefix: "",
- key: "/foo/bar",
- want: url.URL{Scheme: "http", Host: "example.com", Path: "/foo/bar"},
- },
-
- // Host field carries through with port
- {
- endpoint: url.URL{Scheme: "http", Host: "example.com:8080", Path: "/v2/keys"},
- prefix: "",
- key: "",
- want: url.URL{Scheme: "http", Host: "example.com:8080", Path: "/v2/keys"},
- },
-
- // Scheme carries through
- {
- endpoint: url.URL{Scheme: "https", Host: "example.com", Path: "/v2/keys"},
- prefix: "",
- key: "",
- want: url.URL{Scheme: "https", Host: "example.com", Path: "/v2/keys"},
- },
- // Prefix is applied
- {
- endpoint: url.URL{Scheme: "https", Host: "example.com", Path: "/foo"},
- prefix: "/bar",
- key: "/baz",
- want: url.URL{Scheme: "https", Host: "example.com", Path: "/foo/bar/baz"},
- },
- // Prefix is joined to path
- {
- endpoint: url.URL{Scheme: "https", Host: "example.com", Path: "/foo"},
- prefix: "/bar",
- key: "",
- want: url.URL{Scheme: "https", Host: "example.com", Path: "/foo/bar"},
- },
- // Keep trailing slash
- {
- endpoint: url.URL{Scheme: "https", Host: "example.com", Path: "/foo"},
- prefix: "/bar",
- key: "/baz/",
- want: url.URL{Scheme: "https", Host: "example.com", Path: "/foo/bar/baz/"},
- },
- }
-
- for i, tt := range tests {
- got := v2KeysURL(tt.endpoint, tt.prefix, tt.key)
- if tt.want != *got {
- t.Errorf("#%d: want=%#v, got=%#v", i, tt.want, *got)
- }
- }
-}
-
-func TestGetAction(t *testing.T) {
- ep := url.URL{Scheme: "http", Host: "example.com", Path: "/v2/keys"}
- baseWantURL := &url.URL{
- Scheme: "http",
- Host: "example.com",
- Path: "/v2/keys/foo/bar",
- }
- wantHeader := http.Header{}
-
- tests := []struct {
- recursive bool
- sorted bool
- quorum bool
- wantQuery string
- }{
- {
- recursive: false,
- sorted: false,
- quorum: false,
- wantQuery: "quorum=false&recursive=false&sorted=false",
- },
- {
- recursive: true,
- sorted: false,
- quorum: false,
- wantQuery: "quorum=false&recursive=true&sorted=false",
- },
- {
- recursive: false,
- sorted: true,
- quorum: false,
- wantQuery: "quorum=false&recursive=false&sorted=true",
- },
- {
- recursive: true,
- sorted: true,
- quorum: false,
- wantQuery: "quorum=false&recursive=true&sorted=true",
- },
- {
- recursive: false,
- sorted: false,
- quorum: true,
- wantQuery: "quorum=true&recursive=false&sorted=false",
- },
- }
-
- for i, tt := range tests {
- f := getAction{
- Key: "/foo/bar",
- Recursive: tt.recursive,
- Sorted: tt.sorted,
- Quorum: tt.quorum,
- }
- got := *f.HTTPRequest(ep)
-
- wantURL := baseWantURL
- wantURL.RawQuery = tt.wantQuery
-
- err := assertRequest(got, "GET", wantURL, wantHeader, nil)
- if err != nil {
- t.Errorf("#%d: %v", i, err)
- }
- }
-}
-
-func TestWaitAction(t *testing.T) {
- ep := url.URL{Scheme: "http", Host: "example.com", Path: "/v2/keys"}
- baseWantURL := &url.URL{
- Scheme: "http",
- Host: "example.com",
- Path: "/v2/keys/foo/bar",
- }
- wantHeader := http.Header{}
-
- tests := []struct {
- waitIndex uint64
- recursive bool
- wantQuery string
- }{
- {
- recursive: false,
- waitIndex: uint64(0),
- wantQuery: "recursive=false&wait=true&waitIndex=0",
- },
- {
- recursive: false,
- waitIndex: uint64(12),
- wantQuery: "recursive=false&wait=true&waitIndex=12",
- },
- {
- recursive: true,
- waitIndex: uint64(12),
- wantQuery: "recursive=true&wait=true&waitIndex=12",
- },
- }
-
- for i, tt := range tests {
- f := waitAction{
- Key: "/foo/bar",
- WaitIndex: tt.waitIndex,
- Recursive: tt.recursive,
- }
- got := *f.HTTPRequest(ep)
-
- wantURL := baseWantURL
- wantURL.RawQuery = tt.wantQuery
-
- err := assertRequest(got, "GET", wantURL, wantHeader, nil)
- if err != nil {
- t.Errorf("#%d: unexpected error: %#v", i, err)
- }
- }
-}
-
-func TestSetAction(t *testing.T) {
- wantHeader := http.Header(map[string][]string{
- "Content-Type": {"application/x-www-form-urlencoded"},
- })
-
- tests := []struct {
- act setAction
- wantURL string
- wantBody string
- }{
- // default prefix
- {
- act: setAction{
- Prefix: defaultV2KeysPrefix,
- Key: "foo",
- },
- wantURL: "http://example.com/v2/keys/foo",
- wantBody: "value=",
- },
-
- // non-default prefix
- {
- act: setAction{
- Prefix: "/pfx",
- Key: "foo",
- },
- wantURL: "http://example.com/pfx/foo",
- wantBody: "value=",
- },
-
- // no prefix
- {
- act: setAction{
- Key: "foo",
- },
- wantURL: "http://example.com/foo",
- wantBody: "value=",
- },
-
- // Key with path separators
- {
- act: setAction{
- Prefix: defaultV2KeysPrefix,
- Key: "foo/bar/baz",
- },
- wantURL: "http://example.com/v2/keys/foo/bar/baz",
- wantBody: "value=",
- },
-
- // Key with leading slash, Prefix with trailing slash
- {
- act: setAction{
- Prefix: "/foo/",
- Key: "/bar",
- },
- wantURL: "http://example.com/foo/bar",
- wantBody: "value=",
- },
-
- // Key with trailing slash
- {
- act: setAction{
- Key: "/foo/",
- },
- wantURL: "http://example.com/foo/",
- wantBody: "value=",
- },
-
- // Value is set
- {
- act: setAction{
- Key: "foo",
- Value: "baz",
- },
- wantURL: "http://example.com/foo",
- wantBody: "value=baz",
- },
-
- // PrevExist set, but still ignored
- {
- act: setAction{
- Key: "foo",
- PrevExist: PrevIgnore,
- },
- wantURL: "http://example.com/foo",
- wantBody: "value=",
- },
-
- // PrevExist set to true
- {
- act: setAction{
- Key: "foo",
- PrevExist: PrevExist,
- },
- wantURL: "http://example.com/foo?prevExist=true",
- wantBody: "value=",
- },
-
- // PrevExist set to false
- {
- act: setAction{
- Key: "foo",
- PrevExist: PrevNoExist,
- },
- wantURL: "http://example.com/foo?prevExist=false",
- wantBody: "value=",
- },
-
- // PrevValue is urlencoded
- {
- act: setAction{
- Key: "foo",
- PrevValue: "bar baz",
- },
- wantURL: "http://example.com/foo?prevValue=bar+baz",
- wantBody: "value=",
- },
-
- // PrevIndex is set
- {
- act: setAction{
- Key: "foo",
- PrevIndex: uint64(12),
- },
- wantURL: "http://example.com/foo?prevIndex=12",
- wantBody: "value=",
- },
-
- // TTL is set
- {
- act: setAction{
- Key: "foo",
- TTL: 3 * time.Minute,
- },
- wantURL: "http://example.com/foo",
- wantBody: "ttl=180&value=",
- },
-
- // Refresh is set
- {
- act: setAction{
- Key: "foo",
- TTL: 3 * time.Minute,
- Refresh: true,
- },
- wantURL: "http://example.com/foo",
- wantBody: "refresh=true&ttl=180&value=",
- },
-
- // Dir is set
- {
- act: setAction{
- Key: "foo",
- Dir: true,
- },
- wantURL: "http://example.com/foo?dir=true",
- wantBody: "",
- },
- // Dir is set with a value
- {
- act: setAction{
- Key: "foo",
- Value: "bar",
- Dir: true,
- },
- wantURL: "http://example.com/foo?dir=true",
- wantBody: "",
- },
- // Dir is set with PrevExist set to true
- {
- act: setAction{
- Key: "foo",
- PrevExist: PrevExist,
- Dir: true,
- },
- wantURL: "http://example.com/foo?dir=true&prevExist=true",
- wantBody: "",
- },
- // Dir is set with PrevValue
- {
- act: setAction{
- Key: "foo",
- PrevValue: "bar",
- Dir: true,
- },
- wantURL: "http://example.com/foo?dir=true",
- wantBody: "",
- },
- // NoValueOnSuccess is set
- {
- act: setAction{
- Key: "foo",
- NoValueOnSuccess: true,
- },
- wantURL: "http://example.com/foo?noValueOnSuccess=true",
- wantBody: "value=",
- },
- }
-
- for i, tt := range tests {
- u, err := url.Parse(tt.wantURL)
- if err != nil {
- t.Errorf("#%d: unable to use wantURL fixture: %v", i, err)
- }
-
- got := tt.act.HTTPRequest(url.URL{Scheme: "http", Host: "example.com"})
- if err := assertRequest(*got, "PUT", u, wantHeader, []byte(tt.wantBody)); err != nil {
- t.Errorf("#%d: %v", i, err)
- }
- }
-}
-
-func TestCreateInOrderAction(t *testing.T) {
- wantHeader := http.Header(map[string][]string{
- "Content-Type": {"application/x-www-form-urlencoded"},
- })
-
- tests := []struct {
- act createInOrderAction
- wantURL string
- wantBody string
- }{
- // default prefix
- {
- act: createInOrderAction{
- Prefix: defaultV2KeysPrefix,
- Dir: "foo",
- },
- wantURL: "http://example.com/v2/keys/foo",
- wantBody: "value=",
- },
-
- // non-default prefix
- {
- act: createInOrderAction{
- Prefix: "/pfx",
- Dir: "foo",
- },
- wantURL: "http://example.com/pfx/foo",
- wantBody: "value=",
- },
-
- // no prefix
- {
- act: createInOrderAction{
- Dir: "foo",
- },
- wantURL: "http://example.com/foo",
- wantBody: "value=",
- },
-
- // Key with path separators
- {
- act: createInOrderAction{
- Prefix: defaultV2KeysPrefix,
- Dir: "foo/bar/baz",
- },
- wantURL: "http://example.com/v2/keys/foo/bar/baz",
- wantBody: "value=",
- },
-
- // Key with leading slash, Prefix with trailing slash
- {
- act: createInOrderAction{
- Prefix: "/foo/",
- Dir: "/bar",
- },
- wantURL: "http://example.com/foo/bar",
- wantBody: "value=",
- },
-
- // Key with trailing slash
- {
- act: createInOrderAction{
- Dir: "/foo/",
- },
- wantURL: "http://example.com/foo/",
- wantBody: "value=",
- },
-
- // Value is set
- {
- act: createInOrderAction{
- Dir: "foo",
- Value: "baz",
- },
- wantURL: "http://example.com/foo",
- wantBody: "value=baz",
- },
- // TTL is set
- {
- act: createInOrderAction{
- Dir: "foo",
- TTL: 3 * time.Minute,
- },
- wantURL: "http://example.com/foo",
- wantBody: "ttl=180&value=",
- },
- }
-
- for i, tt := range tests {
- u, err := url.Parse(tt.wantURL)
- if err != nil {
- t.Errorf("#%d: unable to use wantURL fixture: %v", i, err)
- }
-
- got := tt.act.HTTPRequest(url.URL{Scheme: "http", Host: "example.com"})
- if err := assertRequest(*got, "POST", u, wantHeader, []byte(tt.wantBody)); err != nil {
- t.Errorf("#%d: %v", i, err)
- }
- }
-}
-
-func TestDeleteAction(t *testing.T) {
- wantHeader := http.Header(map[string][]string{
- "Content-Type": {"application/x-www-form-urlencoded"},
- })
-
- tests := []struct {
- act deleteAction
- wantURL string
- }{
- // default prefix
- {
- act: deleteAction{
- Prefix: defaultV2KeysPrefix,
- Key: "foo",
- },
- wantURL: "http://example.com/v2/keys/foo",
- },
-
- // non-default prefix
- {
- act: deleteAction{
- Prefix: "/pfx",
- Key: "foo",
- },
- wantURL: "http://example.com/pfx/foo",
- },
-
- // no prefix
- {
- act: deleteAction{
- Key: "foo",
- },
- wantURL: "http://example.com/foo",
- },
-
- // Key with path separators
- {
- act: deleteAction{
- Prefix: defaultV2KeysPrefix,
- Key: "foo/bar/baz",
- },
- wantURL: "http://example.com/v2/keys/foo/bar/baz",
- },
-
- // Key with leading slash, Prefix with trailing slash
- {
- act: deleteAction{
- Prefix: "/foo/",
- Key: "/bar",
- },
- wantURL: "http://example.com/foo/bar",
- },
-
- // Key with trailing slash
- {
- act: deleteAction{
- Key: "/foo/",
- },
- wantURL: "http://example.com/foo/",
- },
-
- // Recursive set to true
- {
- act: deleteAction{
- Key: "foo",
- Recursive: true,
- },
- wantURL: "http://example.com/foo?recursive=true",
- },
-
- // PrevValue is urlencoded
- {
- act: deleteAction{
- Key: "foo",
- PrevValue: "bar baz",
- },
- wantURL: "http://example.com/foo?prevValue=bar+baz",
- },
-
- // PrevIndex is set
- {
- act: deleteAction{
- Key: "foo",
- PrevIndex: uint64(12),
- },
- wantURL: "http://example.com/foo?prevIndex=12",
- },
- }
-
- for i, tt := range tests {
- u, err := url.Parse(tt.wantURL)
- if err != nil {
- t.Errorf("#%d: unable to use wantURL fixture: %v", i, err)
- }
-
- got := tt.act.HTTPRequest(url.URL{Scheme: "http", Host: "example.com"})
- if err := assertRequest(*got, "DELETE", u, wantHeader, nil); err != nil {
- t.Errorf("#%d: %v", i, err)
- }
- }
-}
-
-func assertRequest(got http.Request, wantMethod string, wantURL *url.URL, wantHeader http.Header, wantBody []byte) error {
- if wantMethod != got.Method {
- return fmt.Errorf("want.Method=%#v got.Method=%#v", wantMethod, got.Method)
- }
-
- if !reflect.DeepEqual(wantURL, got.URL) {
- return fmt.Errorf("want.URL=%#v got.URL=%#v", wantURL, got.URL)
- }
-
- if !reflect.DeepEqual(wantHeader, got.Header) {
- return fmt.Errorf("want.Header=%#v got.Header=%#v", wantHeader, got.Header)
- }
-
- if got.Body == nil {
- if wantBody != nil {
- return fmt.Errorf("want.Body=%v got.Body=%v", wantBody, got.Body)
- }
- } else {
- if wantBody == nil {
- return fmt.Errorf("want.Body=%v got.Body=%s", wantBody, got.Body)
- }
- gotBytes, err := ioutil.ReadAll(got.Body)
- if err != nil {
- return err
- }
-
- if !reflect.DeepEqual(wantBody, gotBytes) {
- return fmt.Errorf("want.Body=%s got.Body=%s", wantBody, gotBytes)
- }
- }
-
- return nil
-}
-
-func TestUnmarshalSuccessfulResponse(t *testing.T) {
- var expiration time.Time
- expiration.UnmarshalText([]byte("2015-04-07T04:40:23.044979686Z"))
-
- tests := []struct {
- indexHdr string
- clusterIDHdr string
- body string
- wantRes *Response
- wantErr bool
- }{
- // Neither PrevNode or Node
- {
- indexHdr: "1",
- body: `{"action":"delete"}`,
- wantRes: &Response{Action: "delete", Index: 1},
- wantErr: false,
- },
-
- // PrevNode
- {
- indexHdr: "15",
- body: `{"action":"delete", "prevNode": {"key": "/foo", "value": "bar", "modifiedIndex": 12, "createdIndex": 10}}`,
- wantRes: &Response{
- Action: "delete",
- Index: 15,
- Node: nil,
- PrevNode: &Node{
- Key: "/foo",
- Value: "bar",
- ModifiedIndex: 12,
- CreatedIndex: 10,
- },
- },
- wantErr: false,
- },
-
- // Node
- {
- indexHdr: "15",
- body: `{"action":"get", "node": {"key": "/foo", "value": "bar", "modifiedIndex": 12, "createdIndex": 10, "ttl": 10, "expiration": "2015-04-07T04:40:23.044979686Z"}}`,
- wantRes: &Response{
- Action: "get",
- Index: 15,
- Node: &Node{
- Key: "/foo",
- Value: "bar",
- ModifiedIndex: 12,
- CreatedIndex: 10,
- TTL: 10,
- Expiration: &expiration,
- },
- PrevNode: nil,
- },
- wantErr: false,
- },
-
- // Node Dir
- {
- indexHdr: "15",
- clusterIDHdr: "abcdef",
- body: `{"action":"get", "node": {"key": "/foo", "dir": true, "modifiedIndex": 12, "createdIndex": 10}}`,
- wantRes: &Response{
- Action: "get",
- Index: 15,
- Node: &Node{
- Key: "/foo",
- Dir: true,
- ModifiedIndex: 12,
- CreatedIndex: 10,
- },
- PrevNode: nil,
- ClusterID: "abcdef",
- },
- wantErr: false,
- },
-
- // PrevNode and Node
- {
- indexHdr: "15",
- body: `{"action":"update", "prevNode": {"key": "/foo", "value": "baz", "modifiedIndex": 10, "createdIndex": 10}, "node": {"key": "/foo", "value": "bar", "modifiedIndex": 12, "createdIndex": 10}}`,
- wantRes: &Response{
- Action: "update",
- Index: 15,
- PrevNode: &Node{
- Key: "/foo",
- Value: "baz",
- ModifiedIndex: 10,
- CreatedIndex: 10,
- },
- Node: &Node{
- Key: "/foo",
- Value: "bar",
- ModifiedIndex: 12,
- CreatedIndex: 10,
- },
- },
- wantErr: false,
- },
-
- // Garbage in body
- {
- indexHdr: "",
- body: `garbage`,
- wantRes: nil,
- wantErr: true,
- },
-
- // non-integer index
- {
- indexHdr: "poo",
- body: `{}`,
- wantRes: nil,
- wantErr: true,
- },
- }
-
- for i, tt := range tests {
- h := make(http.Header)
- h.Add("X-Etcd-Index", tt.indexHdr)
- res, err := unmarshalSuccessfulKeysResponse(h, []byte(tt.body))
- if tt.wantErr != (err != nil) {
- t.Errorf("#%d: wantErr=%t, err=%v", i, tt.wantErr, err)
- }
-
- if (res == nil) != (tt.wantRes == nil) {
- t.Errorf("#%d: received res=%#v, but expected res=%#v", i, res, tt.wantRes)
- continue
- } else if tt.wantRes == nil {
- // expected and successfully got nil response
- continue
- }
-
- if res.Action != tt.wantRes.Action {
- t.Errorf("#%d: Action=%s, expected %s", i, res.Action, tt.wantRes.Action)
- }
- if res.Index != tt.wantRes.Index {
- t.Errorf("#%d: Index=%d, expected %d", i, res.Index, tt.wantRes.Index)
- }
- if !reflect.DeepEqual(res.Node, tt.wantRes.Node) {
- t.Errorf("#%d: Node=%v, expected %v", i, res.Node, tt.wantRes.Node)
- }
- }
-}
-
-func TestUnmarshalFailedKeysResponse(t *testing.T) {
- body := []byte(`{"errorCode":100,"message":"Key not found","cause":"/foo","index":18}`)
-
- wantErr := Error{
- Code: 100,
- Message: "Key not found",
- Cause: "/foo",
- Index: uint64(18),
- }
-
- gotErr := unmarshalFailedKeysResponse(body)
- if !reflect.DeepEqual(wantErr, gotErr) {
- t.Errorf("unexpected error: want=%#v got=%#v", wantErr, gotErr)
- }
-}
-
-func TestUnmarshalFailedKeysResponseBadJSON(t *testing.T) {
- err := unmarshalFailedKeysResponse([]byte(`{"er`))
- if err == nil {
- t.Errorf("got nil error")
- } else if _, ok := err.(Error); ok {
- t.Errorf("error is of incorrect type *Error: %#v", err)
- }
-}
-
-func TestHTTPWatcherNextWaitAction(t *testing.T) {
- initAction := waitAction{
- Prefix: "/pants",
- Key: "/foo/bar",
- Recursive: true,
- WaitIndex: 19,
- }
-
- client := &actionAssertingHTTPClient{
- t: t,
- act: &initAction,
- resp: http.Response{
- StatusCode: http.StatusOK,
- Header: http.Header{"X-Etcd-Index": []string{"42"}},
- },
- body: []byte(`{"action":"update","node":{"key":"/pants/foo/bar/baz","value":"snarf","modifiedIndex":21,"createdIndex":19},"prevNode":{"key":"/pants/foo/bar/baz","value":"snazz","modifiedIndex":20,"createdIndex":19}}`),
- }
-
- wantResponse := &Response{
- Action: "update",
- Node: &Node{Key: "/pants/foo/bar/baz", Value: "snarf", CreatedIndex: uint64(19), ModifiedIndex: uint64(21)},
- PrevNode: &Node{Key: "/pants/foo/bar/baz", Value: "snazz", CreatedIndex: uint64(19), ModifiedIndex: uint64(20)},
- Index: uint64(42),
- }
-
- wantNextWait := waitAction{
- Prefix: "/pants",
- Key: "/foo/bar",
- Recursive: true,
- WaitIndex: 22,
- }
-
- watcher := &httpWatcher{
- client: client,
- nextWait: initAction,
- }
-
- resp, err := watcher.Next(context.Background())
- if err != nil {
- t.Errorf("non-nil error: %#v", err)
- }
-
- if !reflect.DeepEqual(wantResponse, resp) {
- t.Errorf("received incorrect Response: want=%#v got=%#v", wantResponse, resp)
- }
-
- if !reflect.DeepEqual(wantNextWait, watcher.nextWait) {
- t.Errorf("nextWait incorrect: want=%#v got=%#v", wantNextWait, watcher.nextWait)
- }
-}
-
-func TestHTTPWatcherNextFail(t *testing.T) {
- tests := []httpClient{
- // generic HTTP client failure
- &staticHTTPClient{
- err: errors.New("fail!"),
- },
-
- // unusable status code
- &staticHTTPClient{
- resp: http.Response{
- StatusCode: http.StatusTeapot,
- },
- },
-
- // etcd Error response
- &staticHTTPClient{
- resp: http.Response{
- StatusCode: http.StatusNotFound,
- },
- body: []byte(`{"errorCode":100,"message":"Key not found","cause":"/foo","index":18}`),
- },
- }
-
- for i, tt := range tests {
- act := waitAction{
- Prefix: "/pants",
- Key: "/foo/bar",
- Recursive: true,
- WaitIndex: 19,
- }
-
- watcher := &httpWatcher{
- client: tt,
- nextWait: act,
- }
-
- resp, err := watcher.Next(context.Background())
- if err == nil {
- t.Errorf("#%d: expected non-nil error", i)
- }
- if resp != nil {
- t.Errorf("#%d: expected nil Response, got %#v", i, resp)
- }
- if !reflect.DeepEqual(act, watcher.nextWait) {
- t.Errorf("#%d: nextWait changed: want=%#v got=%#v", i, act, watcher.nextWait)
- }
- }
-}
-
-func TestHTTPKeysAPIWatcherAction(t *testing.T) {
- tests := []struct {
- key string
- opts *WatcherOptions
- want waitAction
- }{
- {
- key: "/foo",
- opts: nil,
- want: waitAction{
- Key: "/foo",
- Recursive: false,
- WaitIndex: 0,
- },
- },
-
- {
- key: "/foo",
- opts: &WatcherOptions{
- Recursive: false,
- AfterIndex: 0,
- },
- want: waitAction{
- Key: "/foo",
- Recursive: false,
- WaitIndex: 0,
- },
- },
-
- {
- key: "/foo",
- opts: &WatcherOptions{
- Recursive: true,
- AfterIndex: 0,
- },
- want: waitAction{
- Key: "/foo",
- Recursive: true,
- WaitIndex: 0,
- },
- },
-
- {
- key: "/foo",
- opts: &WatcherOptions{
- Recursive: false,
- AfterIndex: 19,
- },
- want: waitAction{
- Key: "/foo",
- Recursive: false,
- WaitIndex: 20,
- },
- },
- }
-
- for i, tt := range tests {
- kAPI := &httpKeysAPI{
- client: &staticHTTPClient{err: errors.New("fail!")},
- }
-
- want := &httpWatcher{
- client: &staticHTTPClient{err: errors.New("fail!")},
- nextWait: tt.want,
- }
-
- got := kAPI.Watcher(tt.key, tt.opts)
- if !reflect.DeepEqual(want, got) {
- t.Errorf("#%d: incorrect watcher: want=%#v got=%#v", i, want, got)
- }
- }
-}
-
-func TestHTTPKeysAPISetAction(t *testing.T) {
- tests := []struct {
- key string
- value string
- opts *SetOptions
- wantAction httpAction
- }{
- // nil SetOptions
- {
- key: "/foo",
- value: "bar",
- opts: nil,
- wantAction: &setAction{
- Key: "/foo",
- Value: "bar",
- PrevValue: "",
- PrevIndex: 0,
- PrevExist: PrevIgnore,
- TTL: 0,
- },
- },
- // empty SetOptions
- {
- key: "/foo",
- value: "bar",
- opts: &SetOptions{},
- wantAction: &setAction{
- Key: "/foo",
- Value: "bar",
- PrevValue: "",
- PrevIndex: 0,
- PrevExist: PrevIgnore,
- TTL: 0,
- },
- },
- // populated SetOptions
- {
- key: "/foo",
- value: "bar",
- opts: &SetOptions{
- PrevValue: "baz",
- PrevIndex: 13,
- PrevExist: PrevExist,
- TTL: time.Minute,
- Dir: true,
- },
- wantAction: &setAction{
- Key: "/foo",
- Value: "bar",
- PrevValue: "baz",
- PrevIndex: 13,
- PrevExist: PrevExist,
- TTL: time.Minute,
- Dir: true,
- },
- },
- }
-
- for i, tt := range tests {
- client := &actionAssertingHTTPClient{t: t, num: i, act: tt.wantAction}
- kAPI := httpKeysAPI{client: client}
- kAPI.Set(context.Background(), tt.key, tt.value, tt.opts)
- }
-}
-
-func TestHTTPKeysAPISetError(t *testing.T) {
- tests := []httpClient{
- // generic HTTP client failure
- &staticHTTPClient{
- err: errors.New("fail!"),
- },
-
- // unusable status code
- &staticHTTPClient{
- resp: http.Response{
- StatusCode: http.StatusTeapot,
- },
- },
-
- // etcd Error response
- &staticHTTPClient{
- resp: http.Response{
- StatusCode: http.StatusInternalServerError,
- },
- body: []byte(`{"errorCode":300,"message":"Raft internal error","cause":"/foo","index":18}`),
- },
- }
-
- for i, tt := range tests {
- kAPI := httpKeysAPI{client: tt}
- resp, err := kAPI.Set(context.Background(), "/foo", "bar", nil)
- if err == nil {
- t.Errorf("#%d: received nil error", i)
- }
- if resp != nil {
- t.Errorf("#%d: received non-nil Response: %#v", i, resp)
- }
- }
-}
-
-func TestHTTPKeysAPISetResponse(t *testing.T) {
- client := &staticHTTPClient{
- resp: http.Response{
- StatusCode: http.StatusOK,
- Header: http.Header{"X-Etcd-Index": []string{"21"}},
- },
- body: []byte(`{"action":"set","node":{"key":"/pants/foo/bar/baz","value":"snarf","modifiedIndex":21,"createdIndex":21},"prevNode":{"key":"/pants/foo/bar/baz","value":"snazz","modifiedIndex":20,"createdIndex":19}}`),
- }
-
- wantResponse := &Response{
- Action: "set",
- Node: &Node{Key: "/pants/foo/bar/baz", Value: "snarf", CreatedIndex: uint64(21), ModifiedIndex: uint64(21)},
- PrevNode: &Node{Key: "/pants/foo/bar/baz", Value: "snazz", CreatedIndex: uint64(19), ModifiedIndex: uint64(20)},
- Index: uint64(21),
- }
-
- kAPI := &httpKeysAPI{client: client, prefix: "/pants"}
- resp, err := kAPI.Set(context.Background(), "/foo/bar/baz", "snarf", nil)
- if err != nil {
- t.Errorf("non-nil error: %#v", err)
- }
- if !reflect.DeepEqual(wantResponse, resp) {
- t.Errorf("incorrect Response: want=%#v got=%#v", wantResponse, resp)
- }
-}
-
-func TestHTTPKeysAPIGetAction(t *testing.T) {
- tests := []struct {
- key string
- opts *GetOptions
- wantAction httpAction
- }{
- // nil GetOptions
- {
- key: "/foo",
- opts: nil,
- wantAction: &getAction{
- Key: "/foo",
- Sorted: false,
- Recursive: false,
- },
- },
- // empty GetOptions
- {
- key: "/foo",
- opts: &GetOptions{},
- wantAction: &getAction{
- Key: "/foo",
- Sorted: false,
- Recursive: false,
- },
- },
- // populated GetOptions
- {
- key: "/foo",
- opts: &GetOptions{
- Sort: true,
- Recursive: true,
- Quorum: true,
- },
- wantAction: &getAction{
- Key: "/foo",
- Sorted: true,
- Recursive: true,
- Quorum: true,
- },
- },
- }
-
- for i, tt := range tests {
- client := &actionAssertingHTTPClient{t: t, num: i, act: tt.wantAction}
- kAPI := httpKeysAPI{client: client}
- kAPI.Get(context.Background(), tt.key, tt.opts)
- }
-}
-
-func TestHTTPKeysAPIGetError(t *testing.T) {
- tests := []httpClient{
- // generic HTTP client failure
- &staticHTTPClient{
- err: errors.New("fail!"),
- },
-
- // unusable status code
- &staticHTTPClient{
- resp: http.Response{
- StatusCode: http.StatusTeapot,
- },
- },
-
- // etcd Error response
- &staticHTTPClient{
- resp: http.Response{
- StatusCode: http.StatusInternalServerError,
- },
- body: []byte(`{"errorCode":300,"message":"Raft internal error","cause":"/foo","index":18}`),
- },
- }
-
- for i, tt := range tests {
- kAPI := httpKeysAPI{client: tt}
- resp, err := kAPI.Get(context.Background(), "/foo", nil)
- if err == nil {
- t.Errorf("#%d: received nil error", i)
- }
- if resp != nil {
- t.Errorf("#%d: received non-nil Response: %#v", i, resp)
- }
- }
-}
-
-func TestHTTPKeysAPIGetResponse(t *testing.T) {
- client := &staticHTTPClient{
- resp: http.Response{
- StatusCode: http.StatusOK,
- Header: http.Header{"X-Etcd-Index": []string{"42"}},
- },
- body: []byte(`{"action":"get","node":{"key":"/pants/foo/bar","modifiedIndex":25,"createdIndex":19,"nodes":[{"key":"/pants/foo/bar/baz","value":"snarf","createdIndex":21,"modifiedIndex":25}]}}`),
- }
-
- wantResponse := &Response{
- Action: "get",
- Node: &Node{
- Key: "/pants/foo/bar",
- Nodes: []*Node{
- {Key: "/pants/foo/bar/baz", Value: "snarf", CreatedIndex: 21, ModifiedIndex: 25},
- },
- CreatedIndex: uint64(19),
- ModifiedIndex: uint64(25),
- },
- Index: uint64(42),
- }
-
- kAPI := &httpKeysAPI{client: client, prefix: "/pants"}
- resp, err := kAPI.Get(context.Background(), "/foo/bar", &GetOptions{Recursive: true})
- if err != nil {
- t.Errorf("non-nil error: %#v", err)
- }
- if !reflect.DeepEqual(wantResponse, resp) {
- t.Errorf("incorrect Response: want=%#v got=%#v", wantResponse, resp)
- }
-}
-
-func TestHTTPKeysAPIDeleteAction(t *testing.T) {
- tests := []struct {
- key string
- opts *DeleteOptions
- wantAction httpAction
- }{
- // nil DeleteOptions
- {
- key: "/foo",
- opts: nil,
- wantAction: &deleteAction{
- Key: "/foo",
- PrevValue: "",
- PrevIndex: 0,
- Recursive: false,
- },
- },
- // empty DeleteOptions
- {
- key: "/foo",
- opts: &DeleteOptions{},
- wantAction: &deleteAction{
- Key: "/foo",
- PrevValue: "",
- PrevIndex: 0,
- Recursive: false,
- },
- },
- // populated DeleteOptions
- {
- key: "/foo",
- opts: &DeleteOptions{
- PrevValue: "baz",
- PrevIndex: 13,
- Recursive: true,
- },
- wantAction: &deleteAction{
- Key: "/foo",
- PrevValue: "baz",
- PrevIndex: 13,
- Recursive: true,
- },
- },
- }
-
- for i, tt := range tests {
- client := &actionAssertingHTTPClient{t: t, num: i, act: tt.wantAction}
- kAPI := httpKeysAPI{client: client}
- kAPI.Delete(context.Background(), tt.key, tt.opts)
- }
-}
-
-func TestHTTPKeysAPIDeleteError(t *testing.T) {
- tests := []httpClient{
- // generic HTTP client failure
- &staticHTTPClient{
- err: errors.New("fail!"),
- },
-
- // unusable status code
- &staticHTTPClient{
- resp: http.Response{
- StatusCode: http.StatusTeapot,
- },
- },
-
- // etcd Error response
- &staticHTTPClient{
- resp: http.Response{
- StatusCode: http.StatusInternalServerError,
- },
- body: []byte(`{"errorCode":300,"message":"Raft internal error","cause":"/foo","index":18}`),
- },
- }
-
- for i, tt := range tests {
- kAPI := httpKeysAPI{client: tt}
- resp, err := kAPI.Delete(context.Background(), "/foo", nil)
- if err == nil {
- t.Errorf("#%d: received nil error", i)
- }
- if resp != nil {
- t.Errorf("#%d: received non-nil Response: %#v", i, resp)
- }
- }
-}
-
-func TestHTTPKeysAPIDeleteResponse(t *testing.T) {
- client := &staticHTTPClient{
- resp: http.Response{
- StatusCode: http.StatusOK,
- Header: http.Header{"X-Etcd-Index": []string{"22"}},
- },
- body: []byte(`{"action":"delete","node":{"key":"/pants/foo/bar/baz","value":"snarf","modifiedIndex":22,"createdIndex":19},"prevNode":{"key":"/pants/foo/bar/baz","value":"snazz","modifiedIndex":20,"createdIndex":19}}`),
- }
-
- wantResponse := &Response{
- Action: "delete",
- Node: &Node{Key: "/pants/foo/bar/baz", Value: "snarf", CreatedIndex: uint64(19), ModifiedIndex: uint64(22)},
- PrevNode: &Node{Key: "/pants/foo/bar/baz", Value: "snazz", CreatedIndex: uint64(19), ModifiedIndex: uint64(20)},
- Index: uint64(22),
- }
-
- kAPI := &httpKeysAPI{client: client, prefix: "/pants"}
- resp, err := kAPI.Delete(context.Background(), "/foo/bar/baz", nil)
- if err != nil {
- t.Errorf("non-nil error: %#v", err)
- }
- if !reflect.DeepEqual(wantResponse, resp) {
- t.Errorf("incorrect Response: want=%#v got=%#v", wantResponse, resp)
- }
-}
-
-func TestHTTPKeysAPICreateAction(t *testing.T) {
- act := &setAction{
- Key: "/foo",
- Value: "bar",
- PrevExist: PrevNoExist,
- PrevIndex: 0,
- PrevValue: "",
- TTL: 0,
- }
-
- kAPI := httpKeysAPI{client: &actionAssertingHTTPClient{t: t, act: act}}
- kAPI.Create(context.Background(), "/foo", "bar")
-}
-
-func TestHTTPKeysAPICreateInOrderAction(t *testing.T) {
- act := &createInOrderAction{
- Dir: "/foo",
- Value: "bar",
- TTL: 0,
- }
- kAPI := httpKeysAPI{client: &actionAssertingHTTPClient{t: t, act: act}}
- kAPI.CreateInOrder(context.Background(), "/foo", "bar", nil)
-}
-
-func TestHTTPKeysAPIUpdateAction(t *testing.T) {
- act := &setAction{
- Key: "/foo",
- Value: "bar",
- PrevExist: PrevExist,
- PrevIndex: 0,
- PrevValue: "",
- TTL: 0,
- }
-
- kAPI := httpKeysAPI{client: &actionAssertingHTTPClient{t: t, act: act}}
- kAPI.Update(context.Background(), "/foo", "bar")
-}
-
-func TestNodeTTLDuration(t *testing.T) {
- tests := []struct {
- node *Node
- want time.Duration
- }{
- {
- node: &Node{TTL: 0},
- want: 0,
- },
- {
- node: &Node{TTL: 97},
- want: 97 * time.Second,
- },
- }
-
- for i, tt := range tests {
- got := tt.node.TTLDuration()
- if tt.want != got {
- t.Errorf("#%d: incorrect duration: want=%v got=%v", i, tt.want, got)
- }
- }
-}
diff --git a/vendor/github.com/coreos/etcd/client/main_test.go b/vendor/github.com/coreos/etcd/client/main_test.go
deleted file mode 100644
index 1f2f3f306..000000000
--- a/vendor/github.com/coreos/etcd/client/main_test.go
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2017 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package client_test
-
-import (
- "fmt"
- "net/http"
- "os"
- "regexp"
- "strings"
- "testing"
- "time"
-
- "github.com/coreos/etcd/integration"
- "github.com/coreos/etcd/pkg/testutil"
- "github.com/coreos/etcd/pkg/transport"
-)
-
-var exampleEndpoints []string
-var exampleTransport *http.Transport
-
-// TestMain sets up an etcd cluster if running the examples.
-func TestMain(m *testing.M) {
- useCluster, hasRunArg := false, false // default to running only Test*
- for _, arg := range os.Args {
- if strings.HasPrefix(arg, "-test.run=") {
- exp := strings.Split(arg, "=")[1]
- match, err := regexp.MatchString(exp, "Example")
- useCluster = (err == nil && match) || strings.Contains(exp, "Example")
- hasRunArg = true
- break
- }
- }
- if !hasRunArg {
- // force only running Test* if no args given to avoid leak false
- // positives from having a long-running cluster for the examples.
- os.Args = append(os.Args, "-test.run=Test")
- }
-
- var v int
- if useCluster {
- tr, trerr := transport.NewTransport(transport.TLSInfo{}, time.Second)
- if trerr != nil {
- fmt.Fprintf(os.Stderr, "%v", trerr)
- os.Exit(1)
- }
- cfg := integration.ClusterConfig{Size: 1}
- clus := integration.NewClusterV3(nil, &cfg)
- exampleEndpoints = []string{clus.Members[0].URL()}
- exampleTransport = tr
- v = m.Run()
- clus.Terminate(nil)
- if err := testutil.CheckAfterTest(time.Second); err != nil {
- fmt.Fprintf(os.Stderr, "%v", err)
- os.Exit(1)
- }
- } else {
- v = m.Run()
- }
-
- if v == 0 && testutil.CheckLeakedGoroutine() {
- os.Exit(1)
- }
- os.Exit(v)
-}
diff --git a/vendor/github.com/coreos/etcd/client/members_test.go b/vendor/github.com/coreos/etcd/client/members_test.go
deleted file mode 100644
index 706b6aeb8..000000000
--- a/vendor/github.com/coreos/etcd/client/members_test.go
+++ /dev/null
@@ -1,598 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package client
-
-import (
- "context"
- "encoding/json"
- "errors"
- "net/http"
- "net/url"
- "reflect"
- "testing"
-
- "github.com/coreos/etcd/pkg/types"
-)
-
-func TestMembersAPIActionList(t *testing.T) {
- ep := url.URL{Scheme: "http", Host: "example.com"}
- act := &membersAPIActionList{}
-
- wantURL := &url.URL{
- Scheme: "http",
- Host: "example.com",
- Path: "/v2/members",
- }
-
- got := *act.HTTPRequest(ep)
- err := assertRequest(got, "GET", wantURL, http.Header{}, nil)
- if err != nil {
- t.Error(err.Error())
- }
-}
-
-func TestMembersAPIActionAdd(t *testing.T) {
- ep := url.URL{Scheme: "http", Host: "example.com"}
- act := &membersAPIActionAdd{
- peerURLs: types.URLs([]url.URL{
- {Scheme: "https", Host: "127.0.0.1:8081"},
- {Scheme: "http", Host: "127.0.0.1:8080"},
- }),
- }
-
- wantURL := &url.URL{
- Scheme: "http",
- Host: "example.com",
- Path: "/v2/members",
- }
- wantHeader := http.Header{
- "Content-Type": []string{"application/json"},
- }
- wantBody := []byte(`{"peerURLs":["https://127.0.0.1:8081","http://127.0.0.1:8080"]}`)
-
- got := *act.HTTPRequest(ep)
- err := assertRequest(got, "POST", wantURL, wantHeader, wantBody)
- if err != nil {
- t.Error(err.Error())
- }
-}
-
-func TestMembersAPIActionUpdate(t *testing.T) {
- ep := url.URL{Scheme: "http", Host: "example.com"}
- act := &membersAPIActionUpdate{
- memberID: "0xabcd",
- peerURLs: types.URLs([]url.URL{
- {Scheme: "https", Host: "127.0.0.1:8081"},
- {Scheme: "http", Host: "127.0.0.1:8080"},
- }),
- }
-
- wantURL := &url.URL{
- Scheme: "http",
- Host: "example.com",
- Path: "/v2/members/0xabcd",
- }
- wantHeader := http.Header{
- "Content-Type": []string{"application/json"},
- }
- wantBody := []byte(`{"peerURLs":["https://127.0.0.1:8081","http://127.0.0.1:8080"]}`)
-
- got := *act.HTTPRequest(ep)
- err := assertRequest(got, "PUT", wantURL, wantHeader, wantBody)
- if err != nil {
- t.Error(err.Error())
- }
-}
-
-func TestMembersAPIActionRemove(t *testing.T) {
- ep := url.URL{Scheme: "http", Host: "example.com"}
- act := &membersAPIActionRemove{memberID: "XXX"}
-
- wantURL := &url.URL{
- Scheme: "http",
- Host: "example.com",
- Path: "/v2/members/XXX",
- }
-
- got := *act.HTTPRequest(ep)
- err := assertRequest(got, "DELETE", wantURL, http.Header{}, nil)
- if err != nil {
- t.Error(err.Error())
- }
-}
-
-func TestMembersAPIActionLeader(t *testing.T) {
- ep := url.URL{Scheme: "http", Host: "example.com"}
- act := &membersAPIActionLeader{}
-
- wantURL := &url.URL{
- Scheme: "http",
- Host: "example.com",
- Path: "/v2/members/leader",
- }
-
- got := *act.HTTPRequest(ep)
- err := assertRequest(got, "GET", wantURL, http.Header{}, nil)
- if err != nil {
- t.Error(err.Error())
- }
-}
-
-func TestAssertStatusCode(t *testing.T) {
- if err := assertStatusCode(404, 400); err == nil {
- t.Errorf("assertStatusCode failed to detect conflict in 400 vs 404")
- }
-
- if err := assertStatusCode(404, 400, 404); err != nil {
- t.Errorf("assertStatusCode found conflict in (404,400) vs 400: %v", err)
- }
-}
-
-func TestV2MembersURL(t *testing.T) {
- got := v2MembersURL(url.URL{
- Scheme: "http",
- Host: "foo.example.com:4002",
- Path: "/pants",
- })
- want := &url.URL{
- Scheme: "http",
- Host: "foo.example.com:4002",
- Path: "/pants/v2/members",
- }
-
- if !reflect.DeepEqual(want, got) {
- t.Fatalf("v2MembersURL got %#v, want %#v", got, want)
- }
-}
-
-func TestMemberUnmarshal(t *testing.T) {
- tests := []struct {
- body []byte
- wantMember Member
- wantError bool
- }{
- // no URLs, just check ID & Name
- {
- body: []byte(`{"id": "c", "name": "dungarees"}`),
- wantMember: Member{ID: "c", Name: "dungarees", PeerURLs: nil, ClientURLs: nil},
- },
-
- // both client and peer URLs
- {
- body: []byte(`{"peerURLs": ["http://127.0.0.1:2379"], "clientURLs": ["http://127.0.0.1:2379"]}`),
- wantMember: Member{
- PeerURLs: []string{
- "http://127.0.0.1:2379",
- },
- ClientURLs: []string{
- "http://127.0.0.1:2379",
- },
- },
- },
-
- // multiple peer URLs
- {
- body: []byte(`{"peerURLs": ["http://127.0.0.1:2379", "https://example.com"]}`),
- wantMember: Member{
- PeerURLs: []string{
- "http://127.0.0.1:2379",
- "https://example.com",
- },
- ClientURLs: nil,
- },
- },
-
- // multiple client URLs
- {
- body: []byte(`{"clientURLs": ["http://127.0.0.1:2379", "https://example.com"]}`),
- wantMember: Member{
- PeerURLs: nil,
- ClientURLs: []string{
- "http://127.0.0.1:2379",
- "https://example.com",
- },
- },
- },
-
- // invalid JSON
- {
- body: []byte(`{"peerU`),
- wantError: true,
- },
- }
-
- for i, tt := range tests {
- got := Member{}
- err := json.Unmarshal(tt.body, &got)
- if tt.wantError != (err != nil) {
- t.Errorf("#%d: want error %t, got %v", i, tt.wantError, err)
- continue
- }
-
- if !reflect.DeepEqual(tt.wantMember, got) {
- t.Errorf("#%d: incorrect output: want=%#v, got=%#v", i, tt.wantMember, got)
- }
- }
-}
-
-func TestMemberCollectionUnmarshalFail(t *testing.T) {
- mc := &memberCollection{}
- if err := mc.UnmarshalJSON([]byte(`{`)); err == nil {
- t.Errorf("got nil error")
- }
-}
-
-func TestMemberCollectionUnmarshal(t *testing.T) {
- tests := []struct {
- body []byte
- want memberCollection
- }{
- {
- body: []byte(`{}`),
- want: memberCollection([]Member{}),
- },
- {
- body: []byte(`{"members":[]}`),
- want: memberCollection([]Member{}),
- },
- {
- body: []byte(`{"members":[{"id":"2745e2525fce8fe","peerURLs":["http://127.0.0.1:7003"],"name":"node3","clientURLs":["http://127.0.0.1:4003"]},{"id":"42134f434382925","peerURLs":["http://127.0.0.1:2380","http://127.0.0.1:7001"],"name":"node1","clientURLs":["http://127.0.0.1:2379","http://127.0.0.1:4001"]},{"id":"94088180e21eb87b","peerURLs":["http://127.0.0.1:7002"],"name":"node2","clientURLs":["http://127.0.0.1:4002"]}]}`),
- want: memberCollection(
- []Member{
- {
- ID: "2745e2525fce8fe",
- Name: "node3",
- PeerURLs: []string{
- "http://127.0.0.1:7003",
- },
- ClientURLs: []string{
- "http://127.0.0.1:4003",
- },
- },
- {
- ID: "42134f434382925",
- Name: "node1",
- PeerURLs: []string{
- "http://127.0.0.1:2380",
- "http://127.0.0.1:7001",
- },
- ClientURLs: []string{
- "http://127.0.0.1:2379",
- "http://127.0.0.1:4001",
- },
- },
- {
- ID: "94088180e21eb87b",
- Name: "node2",
- PeerURLs: []string{
- "http://127.0.0.1:7002",
- },
- ClientURLs: []string{
- "http://127.0.0.1:4002",
- },
- },
- },
- ),
- },
- }
-
- for i, tt := range tests {
- var got memberCollection
- err := json.Unmarshal(tt.body, &got)
- if err != nil {
- t.Errorf("#%d: unexpected error: %v", i, err)
- continue
- }
-
- if !reflect.DeepEqual(tt.want, got) {
- t.Errorf("#%d: incorrect output: want=%#v, got=%#v", i, tt.want, got)
- }
- }
-}
-
-func TestMemberCreateRequestMarshal(t *testing.T) {
- req := memberCreateOrUpdateRequest{
- PeerURLs: types.URLs([]url.URL{
- {Scheme: "http", Host: "127.0.0.1:8081"},
- {Scheme: "https", Host: "127.0.0.1:8080"},
- }),
- }
- want := []byte(`{"peerURLs":["http://127.0.0.1:8081","https://127.0.0.1:8080"]}`)
-
- got, err := json.Marshal(&req)
- if err != nil {
- t.Fatalf("Marshal returned unexpected err=%v", err)
- }
-
- if !reflect.DeepEqual(want, got) {
- t.Fatalf("Failed to marshal memberCreateRequest: want=%s, got=%s", want, got)
- }
-}
-
-func TestHTTPMembersAPIAddSuccess(t *testing.T) {
- wantAction := &membersAPIActionAdd{
- peerURLs: types.URLs([]url.URL{
- {Scheme: "http", Host: "127.0.0.1:7002"},
- }),
- }
-
- mAPI := &httpMembersAPI{
- client: &actionAssertingHTTPClient{
- t: t,
- act: wantAction,
- resp: http.Response{
- StatusCode: http.StatusCreated,
- },
- body: []byte(`{"id":"94088180e21eb87b","peerURLs":["http://127.0.0.1:7002"]}`),
- },
- }
-
- wantResponseMember := &Member{
- ID: "94088180e21eb87b",
- PeerURLs: []string{"http://127.0.0.1:7002"},
- }
-
- m, err := mAPI.Add(context.Background(), "http://127.0.0.1:7002")
- if err != nil {
- t.Errorf("got non-nil err: %#v", err)
- }
- if !reflect.DeepEqual(wantResponseMember, m) {
- t.Errorf("incorrect Member: want=%#v got=%#v", wantResponseMember, m)
- }
-}
-
-func TestHTTPMembersAPIAddError(t *testing.T) {
- okPeer := "http://example.com:2379"
- tests := []struct {
- peerURL string
- client httpClient
-
- // if wantErr == nil, assert that the returned error is non-nil
- // if wantErr != nil, assert that the returned error matches
- wantErr error
- }{
- // malformed peer URL
- {
- peerURL: ":",
- },
-
- // generic httpClient failure
- {
- peerURL: okPeer,
- client: &staticHTTPClient{err: errors.New("fail!")},
- },
-
- // unrecognized HTTP status code
- {
- peerURL: okPeer,
- client: &staticHTTPClient{
- resp: http.Response{StatusCode: http.StatusTeapot},
- },
- },
-
- // unmarshal body into membersError on StatusConflict
- {
- peerURL: okPeer,
- client: &staticHTTPClient{
- resp: http.Response{
- StatusCode: http.StatusConflict,
- },
- body: []byte(`{"message":"fail!"}`),
- },
- wantErr: membersError{Message: "fail!"},
- },
-
- // fail to unmarshal body on StatusConflict
- {
- peerURL: okPeer,
- client: &staticHTTPClient{
- resp: http.Response{
- StatusCode: http.StatusConflict,
- },
- body: []byte(`{"`),
- },
- },
-
- // fail to unmarshal body on StatusCreated
- {
- peerURL: okPeer,
- client: &staticHTTPClient{
- resp: http.Response{
- StatusCode: http.StatusCreated,
- },
- body: []byte(`{"id":"XX`),
- },
- },
- }
-
- for i, tt := range tests {
- mAPI := &httpMembersAPI{client: tt.client}
- m, err := mAPI.Add(context.Background(), tt.peerURL)
- if err == nil {
- t.Errorf("#%d: got nil err", i)
- }
- if tt.wantErr != nil && !reflect.DeepEqual(tt.wantErr, err) {
- t.Errorf("#%d: incorrect error: want=%#v got=%#v", i, tt.wantErr, err)
- }
- if m != nil {
- t.Errorf("#%d: got non-nil Member", i)
- }
- }
-}
-
-func TestHTTPMembersAPIRemoveSuccess(t *testing.T) {
- wantAction := &membersAPIActionRemove{
- memberID: "94088180e21eb87b",
- }
-
- mAPI := &httpMembersAPI{
- client: &actionAssertingHTTPClient{
- t: t,
- act: wantAction,
- resp: http.Response{
- StatusCode: http.StatusNoContent,
- },
- },
- }
-
- if err := mAPI.Remove(context.Background(), "94088180e21eb87b"); err != nil {
- t.Errorf("got non-nil err: %#v", err)
- }
-}
-
-func TestHTTPMembersAPIRemoveFail(t *testing.T) {
- tests := []httpClient{
- // generic error
- &staticHTTPClient{
- err: errors.New("fail!"),
- },
-
- // unexpected HTTP status code
- &staticHTTPClient{
- resp: http.Response{
- StatusCode: http.StatusInternalServerError,
- },
- },
- }
-
- for i, tt := range tests {
- mAPI := &httpMembersAPI{client: tt}
- if err := mAPI.Remove(context.Background(), "94088180e21eb87b"); err == nil {
- t.Errorf("#%d: got nil err", i)
- }
- }
-}
-
-func TestHTTPMembersAPIListSuccess(t *testing.T) {
- wantAction := &membersAPIActionList{}
- mAPI := &httpMembersAPI{
- client: &actionAssertingHTTPClient{
- t: t,
- act: wantAction,
- resp: http.Response{
- StatusCode: http.StatusOK,
- },
- body: []byte(`{"members":[{"id":"94088180e21eb87b","name":"node2","peerURLs":["http://127.0.0.1:7002"],"clientURLs":["http://127.0.0.1:4002"]}]}`),
- },
- }
-
- wantResponseMembers := []Member{
- {
- ID: "94088180e21eb87b",
- Name: "node2",
- PeerURLs: []string{"http://127.0.0.1:7002"},
- ClientURLs: []string{"http://127.0.0.1:4002"},
- },
- }
-
- m, err := mAPI.List(context.Background())
- if err != nil {
- t.Errorf("got non-nil err: %#v", err)
- }
- if !reflect.DeepEqual(wantResponseMembers, m) {
- t.Errorf("incorrect Members: want=%#v got=%#v", wantResponseMembers, m)
- }
-}
-
-func TestHTTPMembersAPIListError(t *testing.T) {
- tests := []httpClient{
- // generic httpClient failure
- &staticHTTPClient{err: errors.New("fail!")},
-
- // unrecognized HTTP status code
- &staticHTTPClient{
- resp: http.Response{StatusCode: http.StatusTeapot},
- },
-
- // fail to unmarshal body on StatusOK
- &staticHTTPClient{
- resp: http.Response{
- StatusCode: http.StatusOK,
- },
- body: []byte(`[{"id":"XX`),
- },
- }
-
- for i, tt := range tests {
- mAPI := &httpMembersAPI{client: tt}
- ms, err := mAPI.List(context.Background())
- if err == nil {
- t.Errorf("#%d: got nil err", i)
- }
- if ms != nil {
- t.Errorf("#%d: got non-nil Member slice", i)
- }
- }
-}
-
-func TestHTTPMembersAPILeaderSuccess(t *testing.T) {
- wantAction := &membersAPIActionLeader{}
- mAPI := &httpMembersAPI{
- client: &actionAssertingHTTPClient{
- t: t,
- act: wantAction,
- resp: http.Response{
- StatusCode: http.StatusOK,
- },
- body: []byte(`{"id":"94088180e21eb87b","name":"node2","peerURLs":["http://127.0.0.1:7002"],"clientURLs":["http://127.0.0.1:4002"]}`),
- },
- }
-
- wantResponseMember := &Member{
- ID: "94088180e21eb87b",
- Name: "node2",
- PeerURLs: []string{"http://127.0.0.1:7002"},
- ClientURLs: []string{"http://127.0.0.1:4002"},
- }
-
- m, err := mAPI.Leader(context.Background())
- if err != nil {
- t.Errorf("err = %v, want %v", err, nil)
- }
- if !reflect.DeepEqual(wantResponseMember, m) {
- t.Errorf("incorrect member: member = %v, want %v", wantResponseMember, m)
- }
-}
-
-func TestHTTPMembersAPILeaderError(t *testing.T) {
- tests := []httpClient{
- // generic httpClient failure
- &staticHTTPClient{err: errors.New("fail!")},
-
- // unrecognized HTTP status code
- &staticHTTPClient{
- resp: http.Response{StatusCode: http.StatusTeapot},
- },
-
- // fail to unmarshal body on StatusOK
- &staticHTTPClient{
- resp: http.Response{
- StatusCode: http.StatusOK,
- },
- body: []byte(`[{"id":"XX`),
- },
- }
-
- for i, tt := range tests {
- mAPI := &httpMembersAPI{client: tt}
- m, err := mAPI.Leader(context.Background())
- if err == nil {
- t.Errorf("#%d: err = nil, want not nil", i)
- }
- if m != nil {
- t.Errorf("member slice = %v, want nil", m)
- }
- }
-}
diff --git a/vendor/github.com/coreos/etcd/clientv3/client_test.go b/vendor/github.com/coreos/etcd/clientv3/client_test.go
deleted file mode 100644
index d09e64330..000000000
--- a/vendor/github.com/coreos/etcd/clientv3/client_test.go
+++ /dev/null
@@ -1,153 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3
-
-import (
- "context"
- "fmt"
- "net"
- "testing"
- "time"
-
- "github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes"
- "github.com/coreos/etcd/pkg/testutil"
-)
-
-func TestDialCancel(t *testing.T) {
- defer testutil.AfterTest(t)
-
- // accept first connection so client is created with dial timeout
- ln, err := net.Listen("unix", "dialcancel:12345")
- if err != nil {
- t.Fatal(err)
- }
- defer ln.Close()
-
- ep := "unix://dialcancel:12345"
- cfg := Config{
- Endpoints: []string{ep},
- DialTimeout: 30 * time.Second}
- c, err := New(cfg)
- if err != nil {
- t.Fatal(err)
- }
-
- // connect to ipv4 black hole so dial blocks
- c.SetEndpoints("http://254.0.0.1:12345")
-
- // issue Get to force redial attempts
- getc := make(chan struct{})
- go func() {
- defer close(getc)
- // Get may hang forever on grpc's Stream.Header() if its
- // context is never canceled.
- c.Get(c.Ctx(), "abc")
- }()
-
- // wait a little bit so client close is after dial starts
- time.Sleep(100 * time.Millisecond)
-
- donec := make(chan struct{})
- go func() {
- defer close(donec)
- c.Close()
- }()
-
- select {
- case <-time.After(5 * time.Second):
- t.Fatalf("failed to close")
- case <-donec:
- }
- select {
- case <-time.After(5 * time.Second):
- t.Fatalf("get failed to exit")
- case <-getc:
- }
-}
-
-func TestDialTimeout(t *testing.T) {
- defer testutil.AfterTest(t)
-
- testCfgs := []Config{
- {
- Endpoints: []string{"http://254.0.0.1:12345"},
- DialTimeout: 2 * time.Second,
- },
- {
- Endpoints: []string{"http://254.0.0.1:12345"},
- DialTimeout: time.Second,
- Username: "abc",
- Password: "def",
- },
- }
-
- for i, cfg := range testCfgs {
- donec := make(chan error)
- go func() {
- // without timeout, dial continues forever on ipv4 black hole
- c, err := New(cfg)
- if c != nil || err == nil {
- t.Errorf("#%d: new client should fail", i)
- }
- donec <- err
- }()
-
- time.Sleep(10 * time.Millisecond)
-
- select {
- case err := <-donec:
- t.Errorf("#%d: dial didn't wait (%v)", i, err)
- default:
- }
-
- select {
- case <-time.After(5 * time.Second):
- t.Errorf("#%d: failed to timeout dial on time", i)
- case err := <-donec:
- if err != context.DeadlineExceeded {
- t.Errorf("#%d: unexpected error %v, want %v", i, err, context.DeadlineExceeded)
- }
- }
- }
-}
-
-func TestDialNoTimeout(t *testing.T) {
- cfg := Config{Endpoints: []string{"127.0.0.1:12345"}}
- c, err := New(cfg)
- if c == nil || err != nil {
- t.Fatalf("new client with DialNoWait should succeed, got %v", err)
- }
- c.Close()
-}
-
-func TestIsHaltErr(t *testing.T) {
- if !isHaltErr(nil, fmt.Errorf("etcdserver: some etcdserver error")) {
- t.Errorf(`error prefixed with "etcdserver: " should be Halted by default`)
- }
- if isHaltErr(nil, rpctypes.ErrGRPCStopped) {
- t.Errorf("error %v should not halt", rpctypes.ErrGRPCStopped)
- }
- if isHaltErr(nil, rpctypes.ErrGRPCNoLeader) {
- t.Errorf("error %v should not halt", rpctypes.ErrGRPCNoLeader)
- }
- ctx, cancel := context.WithCancel(context.TODO())
- if isHaltErr(ctx, nil) {
- t.Errorf("no error and active context should not be Halted")
- }
- cancel()
- if !isHaltErr(ctx, nil) {
- t.Errorf("cancel on context should be Halted")
- }
-}
diff --git a/vendor/github.com/coreos/etcd/clientv3/compact_op_test.go b/vendor/github.com/coreos/etcd/clientv3/compact_op_test.go
deleted file mode 100644
index 6c91d3ab0..000000000
--- a/vendor/github.com/coreos/etcd/clientv3/compact_op_test.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3
-
-import (
- "reflect"
- "testing"
-
- "github.com/coreos/etcd/etcdserver/etcdserverpb"
-)
-
-func TestCompactOp(t *testing.T) {
- req1 := OpCompact(100, WithCompactPhysical()).toRequest()
- req2 := &etcdserverpb.CompactionRequest{Revision: 100, Physical: true}
- if !reflect.DeepEqual(req1, req2) {
- t.Fatalf("expected %+v, got %+v", req2, req1)
- }
-}
diff --git a/vendor/github.com/coreos/etcd/clientv3/example_auth_test.go b/vendor/github.com/coreos/etcd/clientv3/example_auth_test.go
deleted file mode 100644
index 8200df998..000000000
--- a/vendor/github.com/coreos/etcd/clientv3/example_auth_test.go
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3_test
-
-import (
- "context"
- "fmt"
- "log"
-
- "github.com/coreos/etcd/clientv3"
-)
-
-func ExampleAuth() {
- cli, err := clientv3.New(clientv3.Config{
- Endpoints: endpoints,
- DialTimeout: dialTimeout,
- })
- if err != nil {
- log.Fatal(err)
- }
- defer cli.Close()
-
- if _, err = cli.RoleAdd(context.TODO(), "root"); err != nil {
- log.Fatal(err)
- }
- if _, err = cli.UserAdd(context.TODO(), "root", "123"); err != nil {
- log.Fatal(err)
- }
- if _, err = cli.UserGrantRole(context.TODO(), "root", "root"); err != nil {
- log.Fatal(err)
- }
-
- if _, err = cli.RoleAdd(context.TODO(), "r"); err != nil {
- log.Fatal(err)
- }
-
- if _, err = cli.RoleGrantPermission(
- context.TODO(),
- "r", // role name
- "foo", // key
- "zoo", // range end
- clientv3.PermissionType(clientv3.PermReadWrite),
- ); err != nil {
- log.Fatal(err)
- }
- if _, err = cli.UserAdd(context.TODO(), "u", "123"); err != nil {
- log.Fatal(err)
- }
- if _, err = cli.UserGrantRole(context.TODO(), "u", "r"); err != nil {
- log.Fatal(err)
- }
- if _, err = cli.AuthEnable(context.TODO()); err != nil {
- log.Fatal(err)
- }
-
- cliAuth, err := clientv3.New(clientv3.Config{
- Endpoints: endpoints,
- DialTimeout: dialTimeout,
- Username: "u",
- Password: "123",
- })
- if err != nil {
- log.Fatal(err)
- }
- defer cliAuth.Close()
-
- if _, err = cliAuth.Put(context.TODO(), "foo1", "bar"); err != nil {
- log.Fatal(err)
- }
-
- _, err = cliAuth.Txn(context.TODO()).
- If(clientv3.Compare(clientv3.Value("zoo1"), ">", "abc")).
- Then(clientv3.OpPut("zoo1", "XYZ")).
- Else(clientv3.OpPut("zoo1", "ABC")).
- Commit()
- fmt.Println(err)
-
- // now check the permission with the root account
- rootCli, err := clientv3.New(clientv3.Config{
- Endpoints: endpoints,
- DialTimeout: dialTimeout,
- Username: "root",
- Password: "123",
- })
- if err != nil {
- log.Fatal(err)
- }
- defer rootCli.Close()
-
- resp, err := rootCli.RoleGet(context.TODO(), "r")
- if err != nil {
- log.Fatal(err)
- }
- fmt.Printf("user u permission: key %q, range end %q\n", resp.Perm[0].Key, resp.Perm[0].RangeEnd)
-
- if _, err = rootCli.AuthDisable(context.TODO()); err != nil {
- log.Fatal(err)
- }
- // Output: etcdserver: permission denied
- // user u permission: key "foo", range end "zoo"
-}
diff --git a/vendor/github.com/coreos/etcd/clientv3/example_cluster_test.go b/vendor/github.com/coreos/etcd/clientv3/example_cluster_test.go
deleted file mode 100644
index 5aa03fd65..000000000
--- a/vendor/github.com/coreos/etcd/clientv3/example_cluster_test.go
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3_test
-
-import (
- "context"
- "fmt"
- "log"
-
- "github.com/coreos/etcd/clientv3"
-)
-
-func ExampleCluster_memberList() {
- cli, err := clientv3.New(clientv3.Config{
- Endpoints: endpoints,
- DialTimeout: dialTimeout,
- })
- if err != nil {
- log.Fatal(err)
- }
- defer cli.Close()
-
- resp, err := cli.MemberList(context.Background())
- if err != nil {
- log.Fatal(err)
- }
- fmt.Println("members:", len(resp.Members))
- // Output: members: 3
-}
-
-func ExampleCluster_memberAdd() {
- cli, err := clientv3.New(clientv3.Config{
- Endpoints: endpoints[:2],
- DialTimeout: dialTimeout,
- })
- if err != nil {
- log.Fatal(err)
- }
- defer cli.Close()
-
- peerURLs := endpoints[2:]
- mresp, err := cli.MemberAdd(context.Background(), peerURLs)
- if err != nil {
- log.Fatal(err)
- }
- fmt.Println("added member.PeerURLs:", mresp.Member.PeerURLs)
- // added member.PeerURLs: [http://localhost:32380]
-}
-
-func ExampleCluster_memberRemove() {
- cli, err := clientv3.New(clientv3.Config{
- Endpoints: endpoints[1:],
- DialTimeout: dialTimeout,
- })
- if err != nil {
- log.Fatal(err)
- }
- defer cli.Close()
-
- resp, err := cli.MemberList(context.Background())
- if err != nil {
- log.Fatal(err)
- }
-
- _, err = cli.MemberRemove(context.Background(), resp.Members[0].ID)
- if err != nil {
- log.Fatal(err)
- }
-}
-
-func ExampleCluster_memberUpdate() {
- cli, err := clientv3.New(clientv3.Config{
- Endpoints: endpoints,
- DialTimeout: dialTimeout,
- })
- if err != nil {
- log.Fatal(err)
- }
- defer cli.Close()
-
- resp, err := cli.MemberList(context.Background())
- if err != nil {
- log.Fatal(err)
- }
-
- peerURLs := []string{"http://localhost:12380"}
- _, err = cli.MemberUpdate(context.Background(), resp.Members[0].ID, peerURLs)
- if err != nil {
- log.Fatal(err)
- }
-}
diff --git a/vendor/github.com/coreos/etcd/clientv3/example_kv_test.go b/vendor/github.com/coreos/etcd/clientv3/example_kv_test.go
deleted file mode 100644
index e2476e3e7..000000000
--- a/vendor/github.com/coreos/etcd/clientv3/example_kv_test.go
+++ /dev/null
@@ -1,282 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3_test
-
-import (
- "context"
- "fmt"
- "log"
-
- "github.com/coreos/etcd/clientv3"
- "github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes"
-)
-
-func ExampleKV_put() {
- cli, err := clientv3.New(clientv3.Config{
- Endpoints: endpoints,
- DialTimeout: dialTimeout,
- })
- if err != nil {
- log.Fatal(err)
- }
- defer cli.Close()
-
- ctx, cancel := context.WithTimeout(context.Background(), requestTimeout)
- _, err = cli.Put(ctx, "sample_key", "sample_value")
- cancel()
- if err != nil {
- log.Fatal(err)
- }
-}
-
-func ExampleKV_putErrorHandling() {
- cli, err := clientv3.New(clientv3.Config{
- Endpoints: endpoints,
- DialTimeout: dialTimeout,
- })
- if err != nil {
- log.Fatal(err)
- }
- defer cli.Close()
-
- ctx, cancel := context.WithTimeout(context.Background(), requestTimeout)
- _, err = cli.Put(ctx, "", "sample_value")
- cancel()
- if err != nil {
- switch err {
- case context.Canceled:
- fmt.Printf("ctx is canceled by another routine: %v\n", err)
- case context.DeadlineExceeded:
- fmt.Printf("ctx is attached with a deadline is exceeded: %v\n", err)
- case rpctypes.ErrEmptyKey:
- fmt.Printf("client-side error: %v\n", err)
- default:
- fmt.Printf("bad cluster endpoints, which are not etcd servers: %v\n", err)
- }
- }
- // Output: client-side error: etcdserver: key is not provided
-}
-
-func ExampleKV_get() {
- cli, err := clientv3.New(clientv3.Config{
- Endpoints: endpoints,
- DialTimeout: dialTimeout,
- })
- if err != nil {
- log.Fatal(err)
- }
- defer cli.Close()
-
- _, err = cli.Put(context.TODO(), "foo", "bar")
- if err != nil {
- log.Fatal(err)
- }
-
- ctx, cancel := context.WithTimeout(context.Background(), requestTimeout)
- resp, err := cli.Get(ctx, "foo")
- cancel()
- if err != nil {
- log.Fatal(err)
- }
- for _, ev := range resp.Kvs {
- fmt.Printf("%s : %s\n", ev.Key, ev.Value)
- }
- // Output: foo : bar
-}
-
-func ExampleKV_getWithRev() {
- cli, err := clientv3.New(clientv3.Config{
- Endpoints: endpoints,
- DialTimeout: dialTimeout,
- })
- if err != nil {
- log.Fatal(err)
- }
- defer cli.Close()
-
- presp, err := cli.Put(context.TODO(), "foo", "bar1")
- if err != nil {
- log.Fatal(err)
- }
- _, err = cli.Put(context.TODO(), "foo", "bar2")
- if err != nil {
- log.Fatal(err)
- }
-
- ctx, cancel := context.WithTimeout(context.Background(), requestTimeout)
- resp, err := cli.Get(ctx, "foo", clientv3.WithRev(presp.Header.Revision))
- cancel()
- if err != nil {
- log.Fatal(err)
- }
- for _, ev := range resp.Kvs {
- fmt.Printf("%s : %s\n", ev.Key, ev.Value)
- }
- // Output: foo : bar1
-}
-
-func ExampleKV_getSortedPrefix() {
- cli, err := clientv3.New(clientv3.Config{
- Endpoints: endpoints,
- DialTimeout: dialTimeout,
- })
- if err != nil {
- log.Fatal(err)
- }
- defer cli.Close()
-
- for i := range make([]int, 3) {
- ctx, cancel := context.WithTimeout(context.Background(), requestTimeout)
- _, err = cli.Put(ctx, fmt.Sprintf("key_%d", i), "value")
- cancel()
- if err != nil {
- log.Fatal(err)
- }
- }
-
- ctx, cancel := context.WithTimeout(context.Background(), requestTimeout)
- resp, err := cli.Get(ctx, "key", clientv3.WithPrefix(), clientv3.WithSort(clientv3.SortByKey, clientv3.SortDescend))
- cancel()
- if err != nil {
- log.Fatal(err)
- }
- for _, ev := range resp.Kvs {
- fmt.Printf("%s : %s\n", ev.Key, ev.Value)
- }
- // Output:
- // key_2 : value
- // key_1 : value
- // key_0 : value
-}
-
-func ExampleKV_delete() {
- cli, err := clientv3.New(clientv3.Config{
- Endpoints: endpoints,
- DialTimeout: dialTimeout,
- })
- if err != nil {
- log.Fatal(err)
- }
- defer cli.Close()
-
- ctx, cancel := context.WithTimeout(context.Background(), requestTimeout)
- defer cancel()
-
- // count keys about to be deleted
- gresp, err := cli.Get(ctx, "key", clientv3.WithPrefix())
- if err != nil {
- log.Fatal(err)
- }
-
- // delete the keys
- dresp, err := cli.Delete(ctx, "key", clientv3.WithPrefix())
- if err != nil {
- log.Fatal(err)
- }
-
- fmt.Println("Deleted all keys:", int64(len(gresp.Kvs)) == dresp.Deleted)
- // Output:
- // Deleted all keys: true
-}
-
-func ExampleKV_compact() {
- cli, err := clientv3.New(clientv3.Config{
- Endpoints: endpoints,
- DialTimeout: dialTimeout,
- })
- if err != nil {
- log.Fatal(err)
- }
- defer cli.Close()
-
- ctx, cancel := context.WithTimeout(context.Background(), requestTimeout)
- resp, err := cli.Get(ctx, "foo")
- cancel()
- if err != nil {
- log.Fatal(err)
- }
- compRev := resp.Header.Revision // specify compact revision of your choice
-
- ctx, cancel = context.WithTimeout(context.Background(), requestTimeout)
- _, err = cli.Compact(ctx, compRev)
- cancel()
- if err != nil {
- log.Fatal(err)
- }
-}
-
-func ExampleKV_txn() {
- cli, err := clientv3.New(clientv3.Config{
- Endpoints: endpoints,
- DialTimeout: dialTimeout,
- })
- if err != nil {
- log.Fatal(err)
- }
- defer cli.Close()
-
- kvc := clientv3.NewKV(cli)
-
- _, err = kvc.Put(context.TODO(), "key", "xyz")
- if err != nil {
- log.Fatal(err)
- }
-
- ctx, cancel := context.WithTimeout(context.Background(), requestTimeout)
- _, err = kvc.Txn(ctx).
- // txn value comparisons are lexical
- If(clientv3.Compare(clientv3.Value("key"), ">", "abc")).
- // the "Then" runs, since "xyz" > "abc"
- Then(clientv3.OpPut("key", "XYZ")).
- // the "Else" does not run
- Else(clientv3.OpPut("key", "ABC")).
- Commit()
- cancel()
- if err != nil {
- log.Fatal(err)
- }
-
- gresp, err := kvc.Get(context.TODO(), "key")
- cancel()
- if err != nil {
- log.Fatal(err)
- }
- for _, ev := range gresp.Kvs {
- fmt.Printf("%s : %s\n", ev.Key, ev.Value)
- }
- // Output: key : XYZ
-}
-
-func ExampleKV_do() {
- cli, err := clientv3.New(clientv3.Config{
- Endpoints: endpoints,
- DialTimeout: dialTimeout,
- })
- if err != nil {
- log.Fatal(err)
- }
- defer cli.Close()
-
- ops := []clientv3.Op{
- clientv3.OpPut("put-key", "123"),
- clientv3.OpGet("put-key"),
- clientv3.OpPut("put-key", "456")}
-
- for _, op := range ops {
- if _, err := cli.Do(context.TODO(), op); err != nil {
- log.Fatal(err)
- }
- }
-}
diff --git a/vendor/github.com/coreos/etcd/clientv3/example_lease_test.go b/vendor/github.com/coreos/etcd/clientv3/example_lease_test.go
deleted file mode 100644
index 98db148b9..000000000
--- a/vendor/github.com/coreos/etcd/clientv3/example_lease_test.go
+++ /dev/null
@@ -1,141 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3_test
-
-import (
- "context"
- "fmt"
- "log"
-
- "github.com/coreos/etcd/clientv3"
-)
-
-func ExampleLease_grant() {
- cli, err := clientv3.New(clientv3.Config{
- Endpoints: endpoints,
- DialTimeout: dialTimeout,
- })
- if err != nil {
- log.Fatal(err)
- }
- defer cli.Close()
-
- // minimum lease TTL is 5-second
- resp, err := cli.Grant(context.TODO(), 5)
- if err != nil {
- log.Fatal(err)
- }
-
- // after 5 seconds, the key 'foo' will be removed
- _, err = cli.Put(context.TODO(), "foo", "bar", clientv3.WithLease(resp.ID))
- if err != nil {
- log.Fatal(err)
- }
-}
-
-func ExampleLease_revoke() {
- cli, err := clientv3.New(clientv3.Config{
- Endpoints: endpoints,
- DialTimeout: dialTimeout,
- })
- if err != nil {
- log.Fatal(err)
- }
- defer cli.Close()
-
- resp, err := cli.Grant(context.TODO(), 5)
- if err != nil {
- log.Fatal(err)
- }
-
- _, err = cli.Put(context.TODO(), "foo", "bar", clientv3.WithLease(resp.ID))
- if err != nil {
- log.Fatal(err)
- }
-
- // revoking lease expires the key attached to its lease ID
- _, err = cli.Revoke(context.TODO(), resp.ID)
- if err != nil {
- log.Fatal(err)
- }
-
- gresp, err := cli.Get(context.TODO(), "foo")
- if err != nil {
- log.Fatal(err)
- }
- fmt.Println("number of keys:", len(gresp.Kvs))
- // Output: number of keys: 0
-}
-
-func ExampleLease_keepAlive() {
- cli, err := clientv3.New(clientv3.Config{
- Endpoints: endpoints,
- DialTimeout: dialTimeout,
- })
- if err != nil {
- log.Fatal(err)
- }
- defer cli.Close()
-
- resp, err := cli.Grant(context.TODO(), 5)
- if err != nil {
- log.Fatal(err)
- }
-
- _, err = cli.Put(context.TODO(), "foo", "bar", clientv3.WithLease(resp.ID))
- if err != nil {
- log.Fatal(err)
- }
-
- // the key 'foo' will be kept forever
- ch, kaerr := cli.KeepAlive(context.TODO(), resp.ID)
- if kaerr != nil {
- log.Fatal(kaerr)
- }
-
- ka := <-ch
- fmt.Println("ttl:", ka.TTL)
- // Output: ttl: 5
-}
-
-func ExampleLease_keepAliveOnce() {
- cli, err := clientv3.New(clientv3.Config{
- Endpoints: endpoints,
- DialTimeout: dialTimeout,
- })
- if err != nil {
- log.Fatal(err)
- }
- defer cli.Close()
-
- resp, err := cli.Grant(context.TODO(), 5)
- if err != nil {
- log.Fatal(err)
- }
-
- _, err = cli.Put(context.TODO(), "foo", "bar", clientv3.WithLease(resp.ID))
- if err != nil {
- log.Fatal(err)
- }
-
- // to renew the lease only once
- ka, kaerr := cli.KeepAliveOnce(context.TODO(), resp.ID)
- if kaerr != nil {
- log.Fatal(kaerr)
- }
-
- fmt.Println("ttl:", ka.TTL)
- // Output: ttl: 5
-}
diff --git a/vendor/github.com/coreos/etcd/clientv3/example_maintenence_test.go b/vendor/github.com/coreos/etcd/clientv3/example_maintenence_test.go
deleted file mode 100644
index a66a23abc..000000000
--- a/vendor/github.com/coreos/etcd/clientv3/example_maintenence_test.go
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3_test
-
-import (
- "context"
- "fmt"
- "log"
-
- "github.com/coreos/etcd/clientv3"
-)
-
-func ExampleMaintenance_status() {
- for _, ep := range endpoints {
- cli, err := clientv3.New(clientv3.Config{
- Endpoints: []string{ep},
- DialTimeout: dialTimeout,
- })
- if err != nil {
- log.Fatal(err)
- }
- defer cli.Close()
-
- resp, err := cli.Status(context.Background(), ep)
- if err != nil {
- log.Fatal(err)
- }
- fmt.Printf("endpoint: %s / Leader: %v\n", ep, resp.Header.MemberId == resp.Leader)
- }
- // endpoint: localhost:2379 / Leader: false
- // endpoint: localhost:22379 / Leader: false
- // endpoint: localhost:32379 / Leader: true
-}
-
-func ExampleMaintenance_defragment() {
- for _, ep := range endpoints {
- cli, err := clientv3.New(clientv3.Config{
- Endpoints: []string{ep},
- DialTimeout: dialTimeout,
- })
- if err != nil {
- log.Fatal(err)
- }
- defer cli.Close()
-
- if _, err = cli.Defragment(context.TODO(), ep); err != nil {
- log.Fatal(err)
- }
- }
-}
diff --git a/vendor/github.com/coreos/etcd/clientv3/example_metrics_test.go b/vendor/github.com/coreos/etcd/clientv3/example_metrics_test.go
deleted file mode 100644
index 802a2af1f..000000000
--- a/vendor/github.com/coreos/etcd/clientv3/example_metrics_test.go
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3_test
-
-import (
- "context"
- "fmt"
- "io/ioutil"
- "log"
- "net"
- "net/http"
- "strings"
-
- "github.com/coreos/etcd/clientv3"
-
- grpcprom "github.com/grpc-ecosystem/go-grpc-prometheus"
- "github.com/prometheus/client_golang/prometheus/promhttp"
- "google.golang.org/grpc"
-)
-
-func ExampleClient_metrics() {
- cli, err := clientv3.New(clientv3.Config{
- Endpoints: endpoints,
- DialOptions: []grpc.DialOption{
- grpc.WithUnaryInterceptor(grpcprom.UnaryClientInterceptor),
- grpc.WithStreamInterceptor(grpcprom.StreamClientInterceptor),
- },
- })
- if err != nil {
- log.Fatal(err)
- }
- defer cli.Close()
-
- // get a key so it shows up in the metrics as a range RPC
- cli.Get(context.TODO(), "test_key")
-
- // listen for all Prometheus metrics
- ln, err := net.Listen("tcp", ":0")
- if err != nil {
- log.Fatal(err)
- }
- donec := make(chan struct{})
- go func() {
- defer close(donec)
- http.Serve(ln, promhttp.Handler())
- }()
- defer func() {
- ln.Close()
- <-donec
- }()
-
- // make an http request to fetch all Prometheus metrics
- url := "http://" + ln.Addr().String() + "/metrics"
- resp, err := http.Get(url)
- if err != nil {
- log.Fatalf("fetch error: %v", err)
- }
- b, err := ioutil.ReadAll(resp.Body)
- resp.Body.Close()
- if err != nil {
- log.Fatalf("fetch error: reading %s: %v", url, err)
- }
-
- // confirm range request in metrics
- for _, l := range strings.Split(string(b), "\n") {
- if strings.Contains(l, `grpc_client_started_total{grpc_method="Range"`) {
- fmt.Println(l)
- break
- }
- }
- // Output:
- // grpc_client_started_total{grpc_method="Range",grpc_service="etcdserverpb.KV",grpc_type="unary"} 1
-}
diff --git a/vendor/github.com/coreos/etcd/clientv3/example_test.go b/vendor/github.com/coreos/etcd/clientv3/example_test.go
deleted file mode 100644
index e486981e5..000000000
--- a/vendor/github.com/coreos/etcd/clientv3/example_test.go
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3_test
-
-import (
- "context"
- "log"
- "os"
- "time"
-
- "github.com/coreos/etcd/clientv3"
- "github.com/coreos/etcd/pkg/transport"
-
- "google.golang.org/grpc/grpclog"
-)
-
-var (
- dialTimeout = 5 * time.Second
- requestTimeout = 10 * time.Second
- endpoints = []string{"localhost:2379", "localhost:22379", "localhost:32379"}
-)
-
-func Example() {
- clientv3.SetLogger(grpclog.NewLoggerV2(os.Stderr, os.Stderr, os.Stderr))
-
- cli, err := clientv3.New(clientv3.Config{
- Endpoints: endpoints,
- DialTimeout: dialTimeout,
- })
- if err != nil {
- log.Fatal(err)
- }
- defer cli.Close() // make sure to close the client
-
- _, err = cli.Put(context.TODO(), "foo", "bar")
- if err != nil {
- log.Fatal(err)
- }
-}
-
-func ExampleConfig_withTLS() {
- tlsInfo := transport.TLSInfo{
- CertFile: "/tmp/test-certs/test-name-1.pem",
- KeyFile: "/tmp/test-certs/test-name-1-key.pem",
- TrustedCAFile: "/tmp/test-certs/trusted-ca.pem",
- }
- tlsConfig, err := tlsInfo.ClientConfig()
- if err != nil {
- log.Fatal(err)
- }
- cli, err := clientv3.New(clientv3.Config{
- Endpoints: endpoints,
- DialTimeout: dialTimeout,
- TLS: tlsConfig,
- })
- if err != nil {
- log.Fatal(err)
- }
- defer cli.Close() // make sure to close the client
-
- _, err = cli.Put(context.TODO(), "foo", "bar")
- if err != nil {
- log.Fatal(err)
- }
-}
diff --git a/vendor/github.com/coreos/etcd/clientv3/example_watch_test.go b/vendor/github.com/coreos/etcd/clientv3/example_watch_test.go
deleted file mode 100644
index 08c199b38..000000000
--- a/vendor/github.com/coreos/etcd/clientv3/example_watch_test.go
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3_test
-
-import (
- "context"
- "fmt"
- "log"
-
- "github.com/coreos/etcd/clientv3"
-)
-
-func ExampleWatcher_watch() {
- cli, err := clientv3.New(clientv3.Config{
- Endpoints: endpoints,
- DialTimeout: dialTimeout,
- })
- if err != nil {
- log.Fatal(err)
- }
- defer cli.Close()
-
- rch := cli.Watch(context.Background(), "foo")
- for wresp := range rch {
- for _, ev := range wresp.Events {
- fmt.Printf("%s %q : %q\n", ev.Type, ev.Kv.Key, ev.Kv.Value)
- }
- }
- // PUT "foo" : "bar"
-}
-
-func ExampleWatcher_watchWithPrefix() {
- cli, err := clientv3.New(clientv3.Config{
- Endpoints: endpoints,
- DialTimeout: dialTimeout,
- })
- if err != nil {
- log.Fatal(err)
- }
- defer cli.Close()
-
- rch := cli.Watch(context.Background(), "foo", clientv3.WithPrefix())
- for wresp := range rch {
- for _, ev := range wresp.Events {
- fmt.Printf("%s %q : %q\n", ev.Type, ev.Kv.Key, ev.Kv.Value)
- }
- }
- // PUT "foo1" : "bar"
-}
-
-func ExampleWatcher_watchWithRange() {
- cli, err := clientv3.New(clientv3.Config{
- Endpoints: endpoints,
- DialTimeout: dialTimeout,
- })
- if err != nil {
- log.Fatal(err)
- }
- defer cli.Close()
-
- // watches within ['foo1', 'foo4'), in lexicographical order
- rch := cli.Watch(context.Background(), "foo1", clientv3.WithRange("foo4"))
- for wresp := range rch {
- for _, ev := range wresp.Events {
- fmt.Printf("%s %q : %q\n", ev.Type, ev.Kv.Key, ev.Kv.Value)
- }
- }
- // PUT "foo1" : "bar"
- // PUT "foo2" : "bar"
- // PUT "foo3" : "bar"
-}
-
-func ExampleWatcher_watchWithProgressNotify() {
- cli, err := clientv3.New(clientv3.Config{
- Endpoints: endpoints,
- DialTimeout: dialTimeout,
- })
- if err != nil {
- log.Fatal(err)
- }
-
- rch := cli.Watch(context.Background(), "foo", clientv3.WithProgressNotify())
- wresp := <-rch
- fmt.Printf("wresp.Header.Revision: %d\n", wresp.Header.Revision)
- fmt.Println("wresp.IsProgressNotify:", wresp.IsProgressNotify())
- // wresp.Header.Revision: 0
- // wresp.IsProgressNotify: true
-}
diff --git a/vendor/github.com/coreos/etcd/clientv3/health_balancer_test.go b/vendor/github.com/coreos/etcd/clientv3/health_balancer_test.go
deleted file mode 100644
index dc9d28d0e..000000000
--- a/vendor/github.com/coreos/etcd/clientv3/health_balancer_test.go
+++ /dev/null
@@ -1,298 +0,0 @@
-// Copyright 2017 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3
-
-import (
- "context"
- "errors"
- "net"
- "sync"
- "testing"
- "time"
-
- pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
- "github.com/coreos/etcd/pkg/testutil"
-
- "google.golang.org/grpc"
-)
-
-var endpoints = []string{"localhost:2379", "localhost:22379", "localhost:32379"}
-
-func TestBalancerGetUnblocking(t *testing.T) {
- hb := newHealthBalancer(endpoints, minHealthRetryDuration, func(string) (bool, error) { return true, nil })
- defer hb.Close()
- if addrs := <-hb.Notify(); len(addrs) != len(endpoints) {
- t.Errorf("Initialize newHealthBalancer should have triggered Notify() chan, but it didn't")
- }
- unblockingOpts := grpc.BalancerGetOptions{BlockingWait: false}
-
- _, _, err := hb.Get(context.Background(), unblockingOpts)
- if err != ErrNoAddrAvilable {
- t.Errorf("Get() with no up endpoints should return ErrNoAddrAvailable, got: %v", err)
- }
-
- down1 := hb.Up(grpc.Address{Addr: endpoints[1]})
- if addrs := <-hb.Notify(); len(addrs) != 1 {
- t.Errorf("first Up() should have triggered balancer to send the first connected address via Notify chan so that other connections can be closed")
- }
- down2 := hb.Up(grpc.Address{Addr: endpoints[2]})
- addrFirst, putFun, err := hb.Get(context.Background(), unblockingOpts)
- if err != nil {
- t.Errorf("Get() with up endpoints should success, got %v", err)
- }
- if addrFirst.Addr != endpoints[1] {
- t.Errorf("Get() didn't return expected address, got %v", addrFirst)
- }
- if putFun == nil {
- t.Errorf("Get() returned unexpected nil put function")
- }
- addrSecond, _, _ := hb.Get(context.Background(), unblockingOpts)
- if addrFirst.Addr != addrSecond.Addr {
- t.Errorf("Get() didn't return the same address as previous call, got %v and %v", addrFirst, addrSecond)
- }
-
- down1(errors.New("error"))
- if addrs := <-hb.Notify(); len(addrs) != len(endpoints)-1 { // we call down on one endpoint
- t.Errorf("closing the only connection should triggered balancer to send the %d endpoints via Notify chan so that we can establish a connection", len(endpoints)-1)
- }
- down2(errors.New("error"))
- _, _, err = hb.Get(context.Background(), unblockingOpts)
- if err != ErrNoAddrAvilable {
- t.Errorf("Get() with no up endpoints should return ErrNoAddrAvailable, got: %v", err)
- }
-}
-
-func TestBalancerGetBlocking(t *testing.T) {
- hb := newHealthBalancer(endpoints, minHealthRetryDuration, func(string) (bool, error) { return true, nil })
- defer hb.Close()
- if addrs := <-hb.Notify(); len(addrs) != len(endpoints) {
- t.Errorf("Initialize newHealthBalancer should have triggered Notify() chan, but it didn't")
- }
- blockingOpts := grpc.BalancerGetOptions{BlockingWait: true}
-
- ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*100)
- _, _, err := hb.Get(ctx, blockingOpts)
- cancel()
- if err != context.DeadlineExceeded {
- t.Errorf("Get() with no up endpoints should timeout, got %v", err)
- }
-
- downC := make(chan func(error), 1)
-
- go func() {
- // ensure hb.Up() will be called after hb.Get() to see if Up() releases blocking Get()
- time.Sleep(time.Millisecond * 100)
- f := hb.Up(grpc.Address{Addr: endpoints[1]})
- if addrs := <-hb.Notify(); len(addrs) != 1 {
- t.Errorf("first Up() should have triggered balancer to send the first connected address via Notify chan so that other connections can be closed")
- }
- downC <- f
- }()
- addrFirst, putFun, err := hb.Get(context.Background(), blockingOpts)
- if err != nil {
- t.Errorf("Get() with up endpoints should success, got %v", err)
- }
- if addrFirst.Addr != endpoints[1] {
- t.Errorf("Get() didn't return expected address, got %v", addrFirst)
- }
- if putFun == nil {
- t.Errorf("Get() returned unexpected nil put function")
- }
- down1 := <-downC
-
- down2 := hb.Up(grpc.Address{Addr: endpoints[2]})
- addrSecond, _, _ := hb.Get(context.Background(), blockingOpts)
- if addrFirst.Addr != addrSecond.Addr {
- t.Errorf("Get() didn't return the same address as previous call, got %v and %v", addrFirst, addrSecond)
- }
-
- down1(errors.New("error"))
- if addrs := <-hb.Notify(); len(addrs) != len(endpoints)-1 { // we call down on one endpoint
- t.Errorf("closing the only connection should triggered balancer to send the %d endpoints via Notify chan so that we can establish a connection", len(endpoints)-1)
- }
- down2(errors.New("error"))
- ctx, cancel = context.WithTimeout(context.Background(), time.Millisecond*100)
- _, _, err = hb.Get(ctx, blockingOpts)
- cancel()
- if err != context.DeadlineExceeded {
- t.Errorf("Get() with no up endpoints should timeout, got %v", err)
- }
-}
-
-// TestHealthBalancerGraylist checks one endpoint is tried after the other
-// due to gray listing.
-func TestHealthBalancerGraylist(t *testing.T) {
- var wg sync.WaitGroup
- // Use 3 endpoints so gray list doesn't fallback to all connections
- // after failing on 2 endpoints.
- lns, eps := make([]net.Listener, 3), make([]string, 3)
- wg.Add(3)
- connc := make(chan string, 2)
- for i := range eps {
- ln, err := net.Listen("tcp", ":0")
- testutil.AssertNil(t, err)
- lns[i], eps[i] = ln, ln.Addr().String()
- go func() {
- defer wg.Done()
- for {
- conn, err := ln.Accept()
- if err != nil {
- return
- }
- _, err = conn.Read(make([]byte, 512))
- conn.Close()
- if err == nil {
- select {
- case connc <- ln.Addr().String():
- // sleep some so balancer catches up
- // before attempted next reconnect.
- time.Sleep(50 * time.Millisecond)
- default:
- }
- }
- }
- }()
- }
-
- tf := func(s string) (bool, error) { return false, nil }
- hb := newHealthBalancer(eps, 5*time.Second, tf)
-
- conn, err := grpc.Dial("", grpc.WithInsecure(), grpc.WithBalancer(hb))
- testutil.AssertNil(t, err)
- defer conn.Close()
-
- kvc := pb.NewKVClient(conn)
- <-hb.ready()
-
- kvc.Range(context.TODO(), &pb.RangeRequest{})
- ep1 := <-connc
- kvc.Range(context.TODO(), &pb.RangeRequest{})
- ep2 := <-connc
- for _, ln := range lns {
- ln.Close()
- }
- wg.Wait()
-
- if ep1 == ep2 {
- t.Fatalf("expected %q != %q", ep1, ep2)
- }
-}
-
-// TestBalancerDoNotBlockOnClose ensures that balancer and grpc don't deadlock each other
-// due to rapid open/close conn. The deadlock causes balancer.Close() to block forever.
-// See issue: https://github.com/coreos/etcd/issues/7283 for more detail.
-func TestBalancerDoNotBlockOnClose(t *testing.T) {
- defer testutil.AfterTest(t)
-
- kcl := newKillConnListener(t, 3)
- defer kcl.close()
-
- for i := 0; i < 5; i++ {
- hb := newHealthBalancer(kcl.endpoints(), minHealthRetryDuration, func(string) (bool, error) { return true, nil })
- conn, err := grpc.Dial("", grpc.WithInsecure(), grpc.WithBalancer(hb))
- if err != nil {
- t.Fatal(err)
- }
- kvc := pb.NewKVClient(conn)
- <-hb.readyc
-
- var wg sync.WaitGroup
- wg.Add(100)
- cctx, cancel := context.WithCancel(context.TODO())
- for j := 0; j < 100; j++ {
- go func() {
- defer wg.Done()
- kvc.Range(cctx, &pb.RangeRequest{}, grpc.FailFast(false))
- }()
- }
- // balancer.Close() might block
- // if balancer and grpc deadlock each other.
- bclosec, cclosec := make(chan struct{}), make(chan struct{})
- go func() {
- defer close(bclosec)
- hb.Close()
- }()
- go func() {
- defer close(cclosec)
- conn.Close()
- }()
- select {
- case <-bclosec:
- case <-time.After(3 * time.Second):
- testutil.FatalStack(t, "balancer close timeout")
- }
- select {
- case <-cclosec:
- case <-time.After(3 * time.Second):
- t.Fatal("grpc conn close timeout")
- }
-
- cancel()
- wg.Wait()
- }
-}
-
-// killConnListener listens incoming conn and kills it immediately.
-type killConnListener struct {
- wg sync.WaitGroup
- eps []string
- stopc chan struct{}
- t *testing.T
-}
-
-func newKillConnListener(t *testing.T, size int) *killConnListener {
- kcl := &killConnListener{stopc: make(chan struct{}), t: t}
-
- for i := 0; i < size; i++ {
- ln, err := net.Listen("tcp", ":0")
- if err != nil {
- t.Fatal(err)
- }
- kcl.eps = append(kcl.eps, ln.Addr().String())
- kcl.wg.Add(1)
- go kcl.listen(ln)
- }
- return kcl
-}
-
-func (kcl *killConnListener) endpoints() []string {
- return kcl.eps
-}
-
-func (kcl *killConnListener) listen(l net.Listener) {
- go func() {
- defer kcl.wg.Done()
- for {
- conn, err := l.Accept()
- select {
- case <-kcl.stopc:
- return
- default:
- }
- if err != nil {
- kcl.t.Fatal(err)
- }
- time.Sleep(1 * time.Millisecond)
- conn.Close()
- }
- }()
- <-kcl.stopc
- l.Close()
-}
-
-func (kcl *killConnListener) close() {
- close(kcl.stopc)
- kcl.wg.Wait()
-}
diff --git a/vendor/github.com/coreos/etcd/clientv3/logger_test.go b/vendor/github.com/coreos/etcd/clientv3/logger_test.go
deleted file mode 100644
index e54d48a1b..000000000
--- a/vendor/github.com/coreos/etcd/clientv3/logger_test.go
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2017 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3
-
-import (
- "bytes"
- "io/ioutil"
- "strings"
- "testing"
-
- "google.golang.org/grpc/grpclog"
-)
-
-func TestLogger(t *testing.T) {
- buf := new(bytes.Buffer)
-
- l := NewLogger(grpclog.NewLoggerV2WithVerbosity(buf, buf, buf, 10))
- l.Infof("hello world!")
- if !strings.Contains(buf.String(), "hello world!") {
- t.Fatalf("expected 'hello world!', got %q", buf.String())
- }
- buf.Reset()
-
- l.Lvl(10).Infof("Level 10")
- l.Lvl(30).Infof("Level 30")
- if !strings.Contains(buf.String(), "Level 10") {
- t.Fatalf("expected 'Level 10', got %q", buf.String())
- }
- if strings.Contains(buf.String(), "Level 30") {
- t.Fatalf("unexpected 'Level 30', got %q", buf.String())
- }
- buf.Reset()
-
- l = NewLogger(grpclog.NewLoggerV2(ioutil.Discard, ioutil.Discard, ioutil.Discard))
- l.Infof("ignore this")
- if len(buf.Bytes()) > 0 {
- t.Fatalf("unexpected logs %q", buf.String())
- }
-}
diff --git a/vendor/github.com/coreos/etcd/clientv3/main_test.go b/vendor/github.com/coreos/etcd/clientv3/main_test.go
deleted file mode 100644
index 89b30860b..000000000
--- a/vendor/github.com/coreos/etcd/clientv3/main_test.go
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3_test
-
-import (
- "fmt"
- "os"
- "regexp"
- "strings"
- "testing"
- "time"
-
- "github.com/coreos/etcd/auth"
- "github.com/coreos/etcd/integration"
- "github.com/coreos/etcd/pkg/testutil"
- "golang.org/x/crypto/bcrypt"
-)
-
-func init() { auth.BcryptCost = bcrypt.MinCost }
-
-// TestMain sets up an etcd cluster if running the examples.
-func TestMain(m *testing.M) {
- useCluster, hasRunArg := false, false // default to running only Test*
- for _, arg := range os.Args {
- if strings.HasPrefix(arg, "-test.run=") {
- exp := strings.Split(arg, "=")[1]
- match, err := regexp.MatchString(exp, "Example")
- useCluster = (err == nil && match) || strings.Contains(exp, "Example")
- hasRunArg = true
- break
- }
- }
- if !hasRunArg {
- // force only running Test* if no args given to avoid leak false
- // positives from having a long-running cluster for the examples.
- os.Args = append(os.Args, "-test.run=Test")
- }
-
- var v int
- if useCluster {
- cfg := integration.ClusterConfig{Size: 3}
- clus := integration.NewClusterV3(nil, &cfg)
- endpoints = make([]string, 3)
- for i := range endpoints {
- endpoints[i] = clus.Client(i).Endpoints()[0]
- }
- v = m.Run()
- clus.Terminate(nil)
- if err := testutil.CheckAfterTest(time.Second); err != nil {
- fmt.Fprintf(os.Stderr, "%v", err)
- os.Exit(1)
- }
- } else {
- v = m.Run()
- }
-
- if v == 0 && testutil.CheckLeakedGoroutine() {
- os.Exit(1)
- }
- os.Exit(v)
-}
diff --git a/vendor/github.com/coreos/etcd/clientv3/op_test.go b/vendor/github.com/coreos/etcd/clientv3/op_test.go
deleted file mode 100644
index de533f954..000000000
--- a/vendor/github.com/coreos/etcd/clientv3/op_test.go
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3
-
-import (
- "reflect"
- "testing"
-
- pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
-)
-
-// TestOpWithSort tests if WithSort(ASCEND, KEY) and WithLimit are specified,
-// RangeRequest ignores the SortOption to avoid unnecessarily fetching
-// the entire key-space.
-func TestOpWithSort(t *testing.T) {
- opReq := OpGet("foo", WithSort(SortByKey, SortAscend), WithLimit(10)).toRequestOp().Request
- q, ok := opReq.(*pb.RequestOp_RequestRange)
- if !ok {
- t.Fatalf("expected range request, got %v", reflect.TypeOf(opReq))
- }
- req := q.RequestRange
- wreq := &pb.RangeRequest{Key: []byte("foo"), SortOrder: pb.RangeRequest_NONE, Limit: 10}
- if !reflect.DeepEqual(req, wreq) {
- t.Fatalf("expected %+v, got %+v", wreq, req)
- }
-}
diff --git a/vendor/github.com/coreos/etcd/clientv3/txn_test.go b/vendor/github.com/coreos/etcd/clientv3/txn_test.go
deleted file mode 100644
index d48151612..000000000
--- a/vendor/github.com/coreos/etcd/clientv3/txn_test.go
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3
-
-import (
- "testing"
- "time"
-
- "github.com/coreos/etcd/pkg/testutil"
-)
-
-func TestTxnPanics(t *testing.T) {
- defer testutil.AfterTest(t)
-
- kv := &kv{}
-
- errc := make(chan string)
- df := func() {
- if s := recover(); s != nil {
- errc <- s.(string)
- }
- }
-
- cmp := Compare(CreateRevision("foo"), "=", 0)
- op := OpPut("foo", "bar")
-
- tests := []struct {
- f func()
-
- err string
- }{
- {
- f: func() {
- defer df()
- kv.Txn(nil).If(cmp).If(cmp)
- },
-
- err: "cannot call If twice!",
- },
- {
- f: func() {
- defer df()
- kv.Txn(nil).Then(op).If(cmp)
- },
-
- err: "cannot call If after Then!",
- },
- {
- f: func() {
- defer df()
- kv.Txn(nil).Else(op).If(cmp)
- },
-
- err: "cannot call If after Else!",
- },
- {
- f: func() {
- defer df()
- kv.Txn(nil).Then(op).Then(op)
- },
-
- err: "cannot call Then twice!",
- },
- {
- f: func() {
- defer df()
- kv.Txn(nil).Else(op).Then(op)
- },
-
- err: "cannot call Then after Else!",
- },
- {
- f: func() {
- defer df()
- kv.Txn(nil).Else(op).Else(op)
- },
-
- err: "cannot call Else twice!",
- },
- }
-
- for i, tt := range tests {
- go tt.f()
- select {
- case err := <-errc:
- if err != tt.err {
- t.Errorf("#%d: got %s, wanted %s", i, err, tt.err)
- }
- case <-time.After(time.Second):
- t.Errorf("#%d: did not panic, wanted panic %s", i, tt.err)
- }
- }
-}
diff --git a/vendor/github.com/coreos/etcd/clientv3/watch_test.go b/vendor/github.com/coreos/etcd/clientv3/watch_test.go
deleted file mode 100644
index 8d3380522..000000000
--- a/vendor/github.com/coreos/etcd/clientv3/watch_test.go
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3
-
-import (
- "testing"
-
- "github.com/coreos/etcd/mvcc/mvccpb"
-)
-
-func TestEvent(t *testing.T) {
- tests := []struct {
- ev *Event
- isCreate bool
- isModify bool
- }{{
- ev: &Event{
- Type: EventTypePut,
- Kv: &mvccpb.KeyValue{
- CreateRevision: 3,
- ModRevision: 3,
- },
- },
- isCreate: true,
- }, {
- ev: &Event{
- Type: EventTypePut,
- Kv: &mvccpb.KeyValue{
- CreateRevision: 3,
- ModRevision: 4,
- },
- },
- isModify: true,
- }}
- for i, tt := range tests {
- if tt.isCreate && !tt.ev.IsCreate() {
- t.Errorf("#%d: event should be Create event", i)
- }
- if tt.isModify && !tt.ev.IsModify() {
- t.Errorf("#%d: event should be Modify event", i)
- }
- }
-}
diff --git a/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes/error_test.go b/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes/error_test.go
deleted file mode 100644
index e1b396822..000000000
--- a/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes/error_test.go
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package rpctypes
-
-import (
- "testing"
-
- "google.golang.org/grpc/codes"
- "google.golang.org/grpc/status"
-)
-
-func TestConvert(t *testing.T) {
- e1 := status.New(codes.InvalidArgument, "etcdserver: key is not provided").Err()
- e2 := ErrGRPCEmptyKey
- e3 := ErrEmptyKey
-
- if e1.Error() != e2.Error() {
- t.Fatalf("expected %q == %q", e1.Error(), e2.Error())
- }
- ev1, _ := status.FromError(e1)
- if ev1.Code() != e3.(EtcdError).Code() {
- t.Fatalf("expected them to be equal, got %v / %v", ev1.Code(), e3.(EtcdError).Code())
- }
-
- if e1.Error() == e3.Error() {
- t.Fatalf("expected %q != %q", e1.Error(), e3.Error())
- }
- ev2, _ := status.FromError(e2)
- if ev2.Code() != e3.(EtcdError).Code() {
- t.Fatalf("expected them to be equal, got %v / %v", ev2.Code(), e3.(EtcdError).Code())
- }
-}
diff --git a/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/util_test.go b/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/util_test.go
deleted file mode 100644
index 8890b1d4f..000000000
--- a/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/util_test.go
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2017 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package v3rpc
-
-import (
- "context"
- "errors"
- "testing"
-
- "github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes"
- "github.com/coreos/etcd/mvcc"
-
- "google.golang.org/grpc/codes"
- "google.golang.org/grpc/status"
-)
-
-func TestGRPCError(t *testing.T) {
- tt := []struct {
- err error
- exp error
- }{
- {err: mvcc.ErrCompacted, exp: rpctypes.ErrGRPCCompacted},
- {err: mvcc.ErrFutureRev, exp: rpctypes.ErrGRPCFutureRev},
- {err: context.Canceled, exp: context.Canceled},
- {err: context.DeadlineExceeded, exp: context.DeadlineExceeded},
- {err: errors.New("foo"), exp: status.Error(codes.Unknown, "foo")},
- }
- for i := range tt {
- if err := togRPCError(tt[i].err); err != tt[i].exp {
- if _, ok := status.FromError(err); ok {
- if err.Error() == tt[i].exp.Error() {
- continue
- }
- }
- t.Errorf("#%d: got %v, expected %v", i, err, tt[i].exp)
- }
- }
-}
diff --git a/vendor/github.com/coreos/etcd/etcdserver/cluster_util_test.go b/vendor/github.com/coreos/etcd/etcdserver/cluster_util_test.go
deleted file mode 100644
index 159d3f3a9..000000000
--- a/vendor/github.com/coreos/etcd/etcdserver/cluster_util_test.go
+++ /dev/null
@@ -1,131 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package etcdserver
-
-import (
- "reflect"
- "testing"
-
- "github.com/coreos/etcd/pkg/types"
- "github.com/coreos/etcd/version"
- "github.com/coreos/go-semver/semver"
-)
-
-func TestDecideClusterVersion(t *testing.T) {
- tests := []struct {
- vers map[string]*version.Versions
- wdver *semver.Version
- }{
- {
- map[string]*version.Versions{"a": {Server: "2.0.0"}},
- semver.Must(semver.NewVersion("2.0.0")),
- },
- // unknown
- {
- map[string]*version.Versions{"a": nil},
- nil,
- },
- {
- map[string]*version.Versions{"a": {Server: "2.0.0"}, "b": {Server: "2.1.0"}, "c": {Server: "2.1.0"}},
- semver.Must(semver.NewVersion("2.0.0")),
- },
- {
- map[string]*version.Versions{"a": {Server: "2.1.0"}, "b": {Server: "2.1.0"}, "c": {Server: "2.1.0"}},
- semver.Must(semver.NewVersion("2.1.0")),
- },
- {
- map[string]*version.Versions{"a": nil, "b": {Server: "2.1.0"}, "c": {Server: "2.1.0"}},
- nil,
- },
- }
-
- for i, tt := range tests {
- dver := decideClusterVersion(tt.vers)
- if !reflect.DeepEqual(dver, tt.wdver) {
- t.Errorf("#%d: ver = %+v, want %+v", i, dver, tt.wdver)
- }
- }
-}
-
-func TestIsCompatibleWithVers(t *testing.T) {
- tests := []struct {
- vers map[string]*version.Versions
- local types.ID
- minV, maxV *semver.Version
- wok bool
- }{
- // too low
- {
- map[string]*version.Versions{
- "a": {Server: "2.0.0", Cluster: "not_decided"},
- "b": {Server: "2.1.0", Cluster: "2.1.0"},
- "c": {Server: "2.1.0", Cluster: "2.1.0"},
- },
- 0xa,
- semver.Must(semver.NewVersion("2.0.0")), semver.Must(semver.NewVersion("2.0.0")),
- false,
- },
- {
- map[string]*version.Versions{
- "a": {Server: "2.1.0", Cluster: "not_decided"},
- "b": {Server: "2.1.0", Cluster: "2.1.0"},
- "c": {Server: "2.1.0", Cluster: "2.1.0"},
- },
- 0xa,
- semver.Must(semver.NewVersion("2.0.0")), semver.Must(semver.NewVersion("2.1.0")),
- true,
- },
- // too high
- {
- map[string]*version.Versions{
- "a": {Server: "2.2.0", Cluster: "not_decided"},
- "b": {Server: "2.0.0", Cluster: "2.0.0"},
- "c": {Server: "2.0.0", Cluster: "2.0.0"},
- },
- 0xa,
- semver.Must(semver.NewVersion("2.1.0")), semver.Must(semver.NewVersion("2.2.0")),
- false,
- },
- // cannot get b's version, expect ok
- {
- map[string]*version.Versions{
- "a": {Server: "2.1.0", Cluster: "not_decided"},
- "b": nil,
- "c": {Server: "2.1.0", Cluster: "2.1.0"},
- },
- 0xa,
- semver.Must(semver.NewVersion("2.0.0")), semver.Must(semver.NewVersion("2.1.0")),
- true,
- },
- // cannot get b and c's version, expect not ok
- {
- map[string]*version.Versions{
- "a": {Server: "2.1.0", Cluster: "not_decided"},
- "b": nil,
- "c": nil,
- },
- 0xa,
- semver.Must(semver.NewVersion("2.0.0")), semver.Must(semver.NewVersion("2.1.0")),
- false,
- },
- }
-
- for i, tt := range tests {
- ok := isCompatibleWithVers(tt.vers, tt.local, tt.minV, tt.maxV)
- if ok != tt.wok {
- t.Errorf("#%d: ok = %+v, want %+v", i, ok, tt.wok)
- }
- }
-}
diff --git a/vendor/github.com/coreos/etcd/etcdserver/config_test.go b/vendor/github.com/coreos/etcd/etcdserver/config_test.go
deleted file mode 100644
index e574ab10d..000000000
--- a/vendor/github.com/coreos/etcd/etcdserver/config_test.go
+++ /dev/null
@@ -1,204 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package etcdserver
-
-import (
- "net/url"
- "testing"
-
- "github.com/coreos/etcd/pkg/types"
-)
-
-func mustNewURLs(t *testing.T, urls []string) []url.URL {
- if len(urls) == 0 {
- return nil
- }
- u, err := types.NewURLs(urls)
- if err != nil {
- t.Fatalf("error creating new URLs from %q: %v", urls, err)
- }
- return u
-}
-
-func TestConfigVerifyBootstrapWithoutClusterAndDiscoveryURLFail(t *testing.T) {
- c := &ServerConfig{
- Name: "node1",
- DiscoveryURL: "",
- InitialPeerURLsMap: types.URLsMap{},
- }
- if err := c.VerifyBootstrap(); err == nil {
- t.Errorf("err = nil, want not nil")
- }
-}
-
-func TestConfigVerifyExistingWithDiscoveryURLFail(t *testing.T) {
- cluster, err := types.NewURLsMap("node1=http://127.0.0.1:2380")
- if err != nil {
- t.Fatalf("NewCluster error: %v", err)
- }
- c := &ServerConfig{
- Name: "node1",
- DiscoveryURL: "http://127.0.0.1:2379/abcdefg",
- PeerURLs: mustNewURLs(t, []string{"http://127.0.0.1:2380"}),
- InitialPeerURLsMap: cluster,
- NewCluster: false,
- }
- if err := c.VerifyJoinExisting(); err == nil {
- t.Errorf("err = nil, want not nil")
- }
-}
-
-func TestConfigVerifyLocalMember(t *testing.T) {
- tests := []struct {
- clusterSetting string
- apurls []string
- strict bool
- shouldError bool
- }{
- {
- // Node must exist in cluster
- "",
- nil,
- true,
-
- true,
- },
- {
- // Initial cluster set
- "node1=http://localhost:7001,node2=http://localhost:7002",
- []string{"http://localhost:7001"},
- true,
-
- false,
- },
- {
- // Default initial cluster
- "node1=http://localhost:2380,node1=http://localhost:7001",
- []string{"http://localhost:2380", "http://localhost:7001"},
- true,
-
- false,
- },
- {
- // Advertised peer URLs must match those in cluster-state
- "node1=http://localhost:7001",
- []string{"http://localhost:12345"},
- true,
-
- true,
- },
- {
- // Advertised peer URLs must match those in cluster-state
- "node1=http://localhost:2380,node1=http://localhost:12345",
- []string{"http://localhost:12345"},
- true,
-
- true,
- },
- {
- // Advertised peer URLs must match those in cluster-state
- "node1=http://localhost:12345",
- []string{"http://localhost:2380", "http://localhost:12345"},
- true,
-
- true,
- },
- {
- // Advertised peer URLs must match those in cluster-state
- "node1=http://localhost:2380",
- []string{},
- true,
-
- true,
- },
- {
- // do not care about the urls if strict is not set
- "node1=http://localhost:2380",
- []string{},
- false,
-
- false,
- },
- }
-
- for i, tt := range tests {
- cluster, err := types.NewURLsMap(tt.clusterSetting)
- if err != nil {
- t.Fatalf("#%d: Got unexpected error: %v", i, err)
- }
- cfg := ServerConfig{
- Name: "node1",
- InitialPeerURLsMap: cluster,
- }
- if tt.apurls != nil {
- cfg.PeerURLs = mustNewURLs(t, tt.apurls)
- }
- if err = cfg.hasLocalMember(); err == nil && tt.strict {
- err = cfg.advertiseMatchesCluster()
- }
- if (err == nil) && tt.shouldError {
- t.Errorf("#%d: Got no error where one was expected", i)
- }
- if (err != nil) && !tt.shouldError {
- t.Errorf("#%d: Got unexpected error: %v", i, err)
- }
- }
-}
-
-func TestSnapDir(t *testing.T) {
- tests := map[string]string{
- "/": "/member/snap",
- "/var/lib/etc": "/var/lib/etc/member/snap",
- }
- for dd, w := range tests {
- cfg := ServerConfig{
- DataDir: dd,
- }
- if g := cfg.SnapDir(); g != w {
- t.Errorf("DataDir=%q: SnapDir()=%q, want=%q", dd, g, w)
- }
- }
-}
-
-func TestWALDir(t *testing.T) {
- tests := map[string]string{
- "/": "/member/wal",
- "/var/lib/etc": "/var/lib/etc/member/wal",
- }
- for dd, w := range tests {
- cfg := ServerConfig{
- DataDir: dd,
- }
- if g := cfg.WALDir(); g != w {
- t.Errorf("DataDir=%q: WALDir()=%q, want=%q", dd, g, w)
- }
- }
-}
-
-func TestShouldDiscover(t *testing.T) {
- tests := map[string]bool{
- "": false,
- "foo": true,
- "http://discovery.etcd.io/asdf": true,
- }
- for durl, w := range tests {
- cfg := ServerConfig{
- DiscoveryURL: durl,
- }
- if g := cfg.ShouldDiscover(); g != w {
- t.Errorf("durl=%q: ShouldDiscover()=%t, want=%t", durl, g, w)
- }
- }
-}
diff --git a/vendor/github.com/coreos/etcd/etcdserver/consistent_index_test.go b/vendor/github.com/coreos/etcd/etcdserver/consistent_index_test.go
deleted file mode 100644
index 0d74fca8a..000000000
--- a/vendor/github.com/coreos/etcd/etcdserver/consistent_index_test.go
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package etcdserver
-
-import "testing"
-
-func TestConsistentIndex(t *testing.T) {
- var i consistentIndex
- i.setConsistentIndex(10)
- if g := i.ConsistentIndex(); g != 10 {
- t.Errorf("value = %d, want 10", g)
- }
-}
diff --git a/vendor/github.com/coreos/etcd/etcdserver/raft_test.go b/vendor/github.com/coreos/etcd/etcdserver/raft_test.go
deleted file mode 100644
index 757826cc9..000000000
--- a/vendor/github.com/coreos/etcd/etcdserver/raft_test.go
+++ /dev/null
@@ -1,221 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package etcdserver
-
-import (
- "encoding/json"
- "reflect"
- "testing"
- "time"
-
- "github.com/coreos/etcd/etcdserver/membership"
- "github.com/coreos/etcd/pkg/mock/mockstorage"
- "github.com/coreos/etcd/pkg/pbutil"
- "github.com/coreos/etcd/pkg/types"
- "github.com/coreos/etcd/raft"
- "github.com/coreos/etcd/raft/raftpb"
- "github.com/coreos/etcd/rafthttp"
-)
-
-func TestGetIDs(t *testing.T) {
- addcc := &raftpb.ConfChange{Type: raftpb.ConfChangeAddNode, NodeID: 2}
- addEntry := raftpb.Entry{Type: raftpb.EntryConfChange, Data: pbutil.MustMarshal(addcc)}
- removecc := &raftpb.ConfChange{Type: raftpb.ConfChangeRemoveNode, NodeID: 2}
- removeEntry := raftpb.Entry{Type: raftpb.EntryConfChange, Data: pbutil.MustMarshal(removecc)}
- normalEntry := raftpb.Entry{Type: raftpb.EntryNormal}
- updatecc := &raftpb.ConfChange{Type: raftpb.ConfChangeUpdateNode, NodeID: 2}
- updateEntry := raftpb.Entry{Type: raftpb.EntryConfChange, Data: pbutil.MustMarshal(updatecc)}
-
- tests := []struct {
- confState *raftpb.ConfState
- ents []raftpb.Entry
-
- widSet []uint64
- }{
- {nil, []raftpb.Entry{}, []uint64{}},
- {&raftpb.ConfState{Nodes: []uint64{1}},
- []raftpb.Entry{}, []uint64{1}},
- {&raftpb.ConfState{Nodes: []uint64{1}},
- []raftpb.Entry{addEntry}, []uint64{1, 2}},
- {&raftpb.ConfState{Nodes: []uint64{1}},
- []raftpb.Entry{addEntry, removeEntry}, []uint64{1}},
- {&raftpb.ConfState{Nodes: []uint64{1}},
- []raftpb.Entry{addEntry, normalEntry}, []uint64{1, 2}},
- {&raftpb.ConfState{Nodes: []uint64{1}},
- []raftpb.Entry{addEntry, normalEntry, updateEntry}, []uint64{1, 2}},
- {&raftpb.ConfState{Nodes: []uint64{1}},
- []raftpb.Entry{addEntry, removeEntry, normalEntry}, []uint64{1}},
- }
-
- for i, tt := range tests {
- var snap raftpb.Snapshot
- if tt.confState != nil {
- snap.Metadata.ConfState = *tt.confState
- }
- idSet := getIDs(&snap, tt.ents)
- if !reflect.DeepEqual(idSet, tt.widSet) {
- t.Errorf("#%d: idset = %#v, want %#v", i, idSet, tt.widSet)
- }
- }
-}
-
-func TestCreateConfigChangeEnts(t *testing.T) {
- m := membership.Member{
- ID: types.ID(1),
- RaftAttributes: membership.RaftAttributes{PeerURLs: []string{"http://localhost:2380"}},
- }
- ctx, err := json.Marshal(m)
- if err != nil {
- t.Fatal(err)
- }
- addcc1 := &raftpb.ConfChange{Type: raftpb.ConfChangeAddNode, NodeID: 1, Context: ctx}
- removecc2 := &raftpb.ConfChange{Type: raftpb.ConfChangeRemoveNode, NodeID: 2}
- removecc3 := &raftpb.ConfChange{Type: raftpb.ConfChangeRemoveNode, NodeID: 3}
- tests := []struct {
- ids []uint64
- self uint64
- term, index uint64
-
- wents []raftpb.Entry
- }{
- {
- []uint64{1},
- 1,
- 1, 1,
-
- []raftpb.Entry{},
- },
- {
- []uint64{1, 2},
- 1,
- 1, 1,
-
- []raftpb.Entry{{Term: 1, Index: 2, Type: raftpb.EntryConfChange, Data: pbutil.MustMarshal(removecc2)}},
- },
- {
- []uint64{1, 2},
- 1,
- 2, 2,
-
- []raftpb.Entry{{Term: 2, Index: 3, Type: raftpb.EntryConfChange, Data: pbutil.MustMarshal(removecc2)}},
- },
- {
- []uint64{1, 2, 3},
- 1,
- 2, 2,
-
- []raftpb.Entry{
- {Term: 2, Index: 3, Type: raftpb.EntryConfChange, Data: pbutil.MustMarshal(removecc2)},
- {Term: 2, Index: 4, Type: raftpb.EntryConfChange, Data: pbutil.MustMarshal(removecc3)},
- },
- },
- {
- []uint64{2, 3},
- 2,
- 2, 2,
-
- []raftpb.Entry{
- {Term: 2, Index: 3, Type: raftpb.EntryConfChange, Data: pbutil.MustMarshal(removecc3)},
- },
- },
- {
- []uint64{2, 3},
- 1,
- 2, 2,
-
- []raftpb.Entry{
- {Term: 2, Index: 3, Type: raftpb.EntryConfChange, Data: pbutil.MustMarshal(removecc2)},
- {Term: 2, Index: 4, Type: raftpb.EntryConfChange, Data: pbutil.MustMarshal(removecc3)},
- {Term: 2, Index: 5, Type: raftpb.EntryConfChange, Data: pbutil.MustMarshal(addcc1)},
- },
- },
- }
-
- for i, tt := range tests {
- gents := createConfigChangeEnts(tt.ids, tt.self, tt.term, tt.index)
- if !reflect.DeepEqual(gents, tt.wents) {
- t.Errorf("#%d: ents = %v, want %v", i, gents, tt.wents)
- }
- }
-}
-
-func TestStopRaftWhenWaitingForApplyDone(t *testing.T) {
- n := newNopReadyNode()
- r := newRaftNode(raftNodeConfig{
- Node: n,
- storage: mockstorage.NewStorageRecorder(""),
- raftStorage: raft.NewMemoryStorage(),
- transport: rafthttp.NewNopTransporter(),
- })
- srv := &EtcdServer{r: *r}
- srv.r.start(nil)
- n.readyc <- raft.Ready{}
- select {
- case <-srv.r.applyc:
- case <-time.After(time.Second):
- t.Fatalf("failed to receive apply struct")
- }
-
- srv.r.stopped <- struct{}{}
- select {
- case <-srv.r.done:
- case <-time.After(time.Second):
- t.Fatalf("failed to stop raft loop")
- }
-}
-
-// TestConfgChangeBlocksApply ensures apply blocks if committed entries contain config-change.
-func TestConfgChangeBlocksApply(t *testing.T) {
- n := newNopReadyNode()
-
- r := newRaftNode(raftNodeConfig{
- Node: n,
- storage: mockstorage.NewStorageRecorder(""),
- raftStorage: raft.NewMemoryStorage(),
- transport: rafthttp.NewNopTransporter(),
- })
- srv := &EtcdServer{r: *r}
-
- srv.r.start(&raftReadyHandler{updateLeadership: func(bool) {}})
- defer srv.r.Stop()
-
- n.readyc <- raft.Ready{
- SoftState: &raft.SoftState{RaftState: raft.StateFollower},
- CommittedEntries: []raftpb.Entry{{Type: raftpb.EntryConfChange}},
- }
- ap := <-srv.r.applyc
-
- continueC := make(chan struct{})
- go func() {
- n.readyc <- raft.Ready{}
- <-srv.r.applyc
- close(continueC)
- }()
-
- select {
- case <-continueC:
- t.Fatalf("unexpected execution: raft routine should block waiting for apply")
- case <-time.After(time.Second):
- }
-
- // finish apply, unblock raft routine
- <-ap.notifyc
-
- select {
- case <-continueC:
- case <-time.After(time.Second):
- t.Fatalf("unexpected blocking on execution")
- }
-}
diff --git a/vendor/github.com/coreos/etcd/etcdserver/server_test.go b/vendor/github.com/coreos/etcd/etcdserver/server_test.go
deleted file mode 100644
index e3ea0f925..000000000
--- a/vendor/github.com/coreos/etcd/etcdserver/server_test.go
+++ /dev/null
@@ -1,1654 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package etcdserver
-
-import (
- "context"
- "encoding/json"
- "fmt"
- "io/ioutil"
- "os"
- "path"
- "path/filepath"
- "reflect"
- "testing"
- "time"
-
- pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
- "github.com/coreos/etcd/etcdserver/membership"
- "github.com/coreos/etcd/lease"
- "github.com/coreos/etcd/mvcc"
- "github.com/coreos/etcd/mvcc/backend"
- "github.com/coreos/etcd/pkg/fileutil"
- "github.com/coreos/etcd/pkg/idutil"
- "github.com/coreos/etcd/pkg/mock/mockstorage"
- "github.com/coreos/etcd/pkg/mock/mockstore"
- "github.com/coreos/etcd/pkg/mock/mockwait"
- "github.com/coreos/etcd/pkg/pbutil"
- "github.com/coreos/etcd/pkg/testutil"
- "github.com/coreos/etcd/pkg/types"
- "github.com/coreos/etcd/pkg/wait"
- "github.com/coreos/etcd/raft"
- "github.com/coreos/etcd/raft/raftpb"
- "github.com/coreos/etcd/rafthttp"
- "github.com/coreos/etcd/snap"
- "github.com/coreos/etcd/store"
-)
-
-// TestDoLocalAction tests requests which do not need to go through raft to be applied,
-// and are served through local data.
-func TestDoLocalAction(t *testing.T) {
- tests := []struct {
- req pb.Request
-
- wresp Response
- werr error
- wactions []testutil.Action
- }{
- {
- pb.Request{Method: "GET", ID: 1, Wait: true},
- Response{Watcher: store.NewNopWatcher()}, nil, []testutil.Action{{Name: "Watch"}},
- },
- {
- pb.Request{Method: "GET", ID: 1},
- Response{Event: &store.Event{}}, nil,
- []testutil.Action{
- {
- Name: "Get",
- Params: []interface{}{"", false, false},
- },
- },
- },
- {
- pb.Request{Method: "HEAD", ID: 1},
- Response{Event: &store.Event{}}, nil,
- []testutil.Action{
- {
- Name: "Get",
- Params: []interface{}{"", false, false},
- },
- },
- },
- {
- pb.Request{Method: "BADMETHOD", ID: 1},
- Response{}, ErrUnknownMethod, []testutil.Action{},
- },
- }
- for i, tt := range tests {
- st := mockstore.NewRecorder()
- srv := &EtcdServer{
- store: st,
- reqIDGen: idutil.NewGenerator(0, time.Time{}),
- }
- resp, err := srv.Do(context.TODO(), tt.req)
-
- if err != tt.werr {
- t.Fatalf("#%d: err = %+v, want %+v", i, err, tt.werr)
- }
- if !reflect.DeepEqual(resp, tt.wresp) {
- t.Errorf("#%d: resp = %+v, want %+v", i, resp, tt.wresp)
- }
- gaction := st.Action()
- if !reflect.DeepEqual(gaction, tt.wactions) {
- t.Errorf("#%d: action = %+v, want %+v", i, gaction, tt.wactions)
- }
- }
-}
-
-// TestDoBadLocalAction tests server requests which do not need to go through consensus,
-// and return errors when they fetch from local data.
-func TestDoBadLocalAction(t *testing.T) {
- storeErr := fmt.Errorf("bah")
- tests := []struct {
- req pb.Request
-
- wactions []testutil.Action
- }{
- {
- pb.Request{Method: "GET", ID: 1, Wait: true},
- []testutil.Action{{Name: "Watch"}},
- },
- {
- pb.Request{Method: "GET", ID: 1},
- []testutil.Action{
- {
- Name: "Get",
- Params: []interface{}{"", false, false},
- },
- },
- },
- {
- pb.Request{Method: "HEAD", ID: 1},
- []testutil.Action{
- {
- Name: "Get",
- Params: []interface{}{"", false, false},
- },
- },
- },
- }
- for i, tt := range tests {
- st := mockstore.NewErrRecorder(storeErr)
- srv := &EtcdServer{
- store: st,
- reqIDGen: idutil.NewGenerator(0, time.Time{}),
- }
- resp, err := srv.Do(context.Background(), tt.req)
-
- if err != storeErr {
- t.Fatalf("#%d: err = %+v, want %+v", i, err, storeErr)
- }
- if !reflect.DeepEqual(resp, Response{}) {
- t.Errorf("#%d: resp = %+v, want %+v", i, resp, Response{})
- }
- gaction := st.Action()
- if !reflect.DeepEqual(gaction, tt.wactions) {
- t.Errorf("#%d: action = %+v, want %+v", i, gaction, tt.wactions)
- }
- }
-}
-
-// TestApplyRepeat tests that server handles repeat raft messages gracefully
-func TestApplyRepeat(t *testing.T) {
- n := newNodeConfChangeCommitterStream()
- n.readyc <- raft.Ready{
- SoftState: &raft.SoftState{RaftState: raft.StateLeader},
- }
- cl := newTestCluster(nil)
- st := store.New()
- cl.SetStore(store.New())
- cl.AddMember(&membership.Member{ID: 1234})
- r := newRaftNode(raftNodeConfig{
- Node: n,
- raftStorage: raft.NewMemoryStorage(),
- storage: mockstorage.NewStorageRecorder(""),
- transport: rafthttp.NewNopTransporter(),
- })
- s := &EtcdServer{
- r: *r,
- store: st,
- cluster: cl,
- reqIDGen: idutil.NewGenerator(0, time.Time{}),
- SyncTicker: &time.Ticker{},
- }
- s.applyV2 = &applierV2store{store: s.store, cluster: s.cluster}
- s.start()
- req := &pb.Request{Method: "QGET", ID: uint64(1)}
- ents := []raftpb.Entry{{Index: 1, Data: pbutil.MustMarshal(req)}}
- n.readyc <- raft.Ready{CommittedEntries: ents}
- // dup msg
- n.readyc <- raft.Ready{CommittedEntries: ents}
-
- // use a conf change to block until dup msgs are all processed
- cc := &raftpb.ConfChange{Type: raftpb.ConfChangeRemoveNode, NodeID: 2}
- ents = []raftpb.Entry{{
- Index: 2,
- Type: raftpb.EntryConfChange,
- Data: pbutil.MustMarshal(cc),
- }}
- n.readyc <- raft.Ready{CommittedEntries: ents}
- // wait for conf change message
- act, err := n.Wait(1)
- // wait for stop message (async to avoid deadlock)
- stopc := make(chan error)
- go func() {
- _, werr := n.Wait(1)
- stopc <- werr
- }()
- s.Stop()
-
- // only want to confirm etcdserver won't panic; no data to check
-
- if err != nil {
- t.Fatal(err)
- }
- if len(act) == 0 {
- t.Fatalf("expected len(act)=0, got %d", len(act))
- }
-
- if err = <-stopc; err != nil {
- t.Fatalf("error on stop (%v)", err)
- }
-}
-
-func TestApplyRequest(t *testing.T) {
- tests := []struct {
- req pb.Request
-
- wresp Response
- wactions []testutil.Action
- }{
- // POST ==> Create
- {
- pb.Request{Method: "POST", ID: 1},
- Response{Event: &store.Event{}},
- []testutil.Action{
- {
- Name: "Create",
- Params: []interface{}{"", false, "", true, store.TTLOptionSet{ExpireTime: time.Time{}}},
- },
- },
- },
- // POST ==> Create, with expiration
- {
- pb.Request{Method: "POST", ID: 1, Expiration: 1337},
- Response{Event: &store.Event{}},
- []testutil.Action{
- {
- Name: "Create",
- Params: []interface{}{"", false, "", true, store.TTLOptionSet{ExpireTime: time.Unix(0, 1337)}},
- },
- },
- },
- // POST ==> Create, with dir
- {
- pb.Request{Method: "POST", ID: 1, Dir: true},
- Response{Event: &store.Event{}},
- []testutil.Action{
- {
- Name: "Create",
- Params: []interface{}{"", true, "", true, store.TTLOptionSet{ExpireTime: time.Time{}}},
- },
- },
- },
- // PUT ==> Set
- {
- pb.Request{Method: "PUT", ID: 1},
- Response{Event: &store.Event{}},
- []testutil.Action{
- {
- Name: "Set",
- Params: []interface{}{"", false, "", store.TTLOptionSet{ExpireTime: time.Time{}}},
- },
- },
- },
- // PUT ==> Set, with dir
- {
- pb.Request{Method: "PUT", ID: 1, Dir: true},
- Response{Event: &store.Event{}},
- []testutil.Action{
- {
- Name: "Set",
- Params: []interface{}{"", true, "", store.TTLOptionSet{ExpireTime: time.Time{}}},
- },
- },
- },
- // PUT with PrevExist=true ==> Update
- {
- pb.Request{Method: "PUT", ID: 1, PrevExist: pbutil.Boolp(true)},
- Response{Event: &store.Event{}},
- []testutil.Action{
- {
- Name: "Update",
- Params: []interface{}{"", "", store.TTLOptionSet{ExpireTime: time.Time{}}},
- },
- },
- },
- // PUT with PrevExist=false ==> Create
- {
- pb.Request{Method: "PUT", ID: 1, PrevExist: pbutil.Boolp(false)},
- Response{Event: &store.Event{}},
- []testutil.Action{
- {
- Name: "Create",
- Params: []interface{}{"", false, "", false, store.TTLOptionSet{ExpireTime: time.Time{}}},
- },
- },
- },
- // PUT with PrevExist=true *and* PrevIndex set ==> CompareAndSwap
- {
- pb.Request{Method: "PUT", ID: 1, PrevExist: pbutil.Boolp(true), PrevIndex: 1},
- Response{Event: &store.Event{}},
- []testutil.Action{
- {
- Name: "CompareAndSwap",
- Params: []interface{}{"", "", uint64(1), "", store.TTLOptionSet{ExpireTime: time.Time{}}},
- },
- },
- },
- // PUT with PrevExist=false *and* PrevIndex set ==> Create
- {
- pb.Request{Method: "PUT", ID: 1, PrevExist: pbutil.Boolp(false), PrevIndex: 1},
- Response{Event: &store.Event{}},
- []testutil.Action{
- {
- Name: "Create",
- Params: []interface{}{"", false, "", false, store.TTLOptionSet{ExpireTime: time.Time{}}},
- },
- },
- },
- // PUT with PrevIndex set ==> CompareAndSwap
- {
- pb.Request{Method: "PUT", ID: 1, PrevIndex: 1},
- Response{Event: &store.Event{}},
- []testutil.Action{
- {
- Name: "CompareAndSwap",
- Params: []interface{}{"", "", uint64(1), "", store.TTLOptionSet{ExpireTime: time.Time{}}},
- },
- },
- },
- // PUT with PrevValue set ==> CompareAndSwap
- {
- pb.Request{Method: "PUT", ID: 1, PrevValue: "bar"},
- Response{Event: &store.Event{}},
- []testutil.Action{
- {
- Name: "CompareAndSwap",
- Params: []interface{}{"", "bar", uint64(0), "", store.TTLOptionSet{ExpireTime: time.Time{}}},
- },
- },
- },
- // PUT with PrevIndex and PrevValue set ==> CompareAndSwap
- {
- pb.Request{Method: "PUT", ID: 1, PrevIndex: 1, PrevValue: "bar"},
- Response{Event: &store.Event{}},
- []testutil.Action{
- {
- Name: "CompareAndSwap",
- Params: []interface{}{"", "bar", uint64(1), "", store.TTLOptionSet{ExpireTime: time.Time{}}},
- },
- },
- },
- // DELETE ==> Delete
- {
- pb.Request{Method: "DELETE", ID: 1},
- Response{Event: &store.Event{}},
- []testutil.Action{
- {
- Name: "Delete",
- Params: []interface{}{"", false, false},
- },
- },
- },
- // DELETE with PrevIndex set ==> CompareAndDelete
- {
- pb.Request{Method: "DELETE", ID: 1, PrevIndex: 1},
- Response{Event: &store.Event{}},
- []testutil.Action{
- {
- Name: "CompareAndDelete",
- Params: []interface{}{"", "", uint64(1)},
- },
- },
- },
- // DELETE with PrevValue set ==> CompareAndDelete
- {
- pb.Request{Method: "DELETE", ID: 1, PrevValue: "bar"},
- Response{Event: &store.Event{}},
- []testutil.Action{
- {
- Name: "CompareAndDelete",
- Params: []interface{}{"", "bar", uint64(0)},
- },
- },
- },
- // DELETE with PrevIndex *and* PrevValue set ==> CompareAndDelete
- {
- pb.Request{Method: "DELETE", ID: 1, PrevIndex: 5, PrevValue: "bar"},
- Response{Event: &store.Event{}},
- []testutil.Action{
- {
- Name: "CompareAndDelete",
- Params: []interface{}{"", "bar", uint64(5)},
- },
- },
- },
- // QGET ==> Get
- {
- pb.Request{Method: "QGET", ID: 1},
- Response{Event: &store.Event{}},
- []testutil.Action{
- {
- Name: "Get",
- Params: []interface{}{"", false, false},
- },
- },
- },
- // SYNC ==> DeleteExpiredKeys
- {
- pb.Request{Method: "SYNC", ID: 1},
- Response{},
- []testutil.Action{
- {
- Name: "DeleteExpiredKeys",
- Params: []interface{}{time.Unix(0, 0)},
- },
- },
- },
- {
- pb.Request{Method: "SYNC", ID: 1, Time: 12345},
- Response{},
- []testutil.Action{
- {
- Name: "DeleteExpiredKeys",
- Params: []interface{}{time.Unix(0, 12345)},
- },
- },
- },
- // Unknown method - error
- {
- pb.Request{Method: "BADMETHOD", ID: 1},
- Response{Err: ErrUnknownMethod},
- []testutil.Action{},
- },
- }
-
- for i, tt := range tests {
- st := mockstore.NewRecorder()
- srv := &EtcdServer{store: st}
- srv.applyV2 = &applierV2store{store: srv.store, cluster: srv.cluster}
- resp := srv.applyV2Request((*RequestV2)(&tt.req))
-
- if !reflect.DeepEqual(resp, tt.wresp) {
- t.Errorf("#%d: resp = %+v, want %+v", i, resp, tt.wresp)
- }
- gaction := st.Action()
- if !reflect.DeepEqual(gaction, tt.wactions) {
- t.Errorf("#%d: action = %#v, want %#v", i, gaction, tt.wactions)
- }
- }
-}
-
-func TestApplyRequestOnAdminMemberAttributes(t *testing.T) {
- cl := newTestCluster([]*membership.Member{{ID: 1}})
- srv := &EtcdServer{
- store: mockstore.NewRecorder(),
- cluster: cl,
- }
- srv.applyV2 = &applierV2store{store: srv.store, cluster: srv.cluster}
-
- req := pb.Request{
- Method: "PUT",
- ID: 1,
- Path: membership.MemberAttributesStorePath(1),
- Val: `{"Name":"abc","ClientURLs":["http://127.0.0.1:2379"]}`,
- }
- srv.applyV2Request((*RequestV2)(&req))
- w := membership.Attributes{Name: "abc", ClientURLs: []string{"http://127.0.0.1:2379"}}
- if g := cl.Member(1).Attributes; !reflect.DeepEqual(g, w) {
- t.Errorf("attributes = %v, want %v", g, w)
- }
-}
-
-func TestApplyConfChangeError(t *testing.T) {
- cl := membership.NewCluster("")
- cl.SetStore(store.New())
- for i := 1; i <= 4; i++ {
- cl.AddMember(&membership.Member{ID: types.ID(i)})
- }
- cl.RemoveMember(4)
-
- tests := []struct {
- cc raftpb.ConfChange
- werr error
- }{
- {
- raftpb.ConfChange{
- Type: raftpb.ConfChangeAddNode,
- NodeID: 4,
- },
- membership.ErrIDRemoved,
- },
- {
- raftpb.ConfChange{
- Type: raftpb.ConfChangeUpdateNode,
- NodeID: 4,
- },
- membership.ErrIDRemoved,
- },
- {
- raftpb.ConfChange{
- Type: raftpb.ConfChangeAddNode,
- NodeID: 1,
- },
- membership.ErrIDExists,
- },
- {
- raftpb.ConfChange{
- Type: raftpb.ConfChangeRemoveNode,
- NodeID: 5,
- },
- membership.ErrIDNotFound,
- },
- }
- for i, tt := range tests {
- n := newNodeRecorder()
- srv := &EtcdServer{
- r: *newRaftNode(raftNodeConfig{Node: n}),
- cluster: cl,
- }
- _, err := srv.applyConfChange(tt.cc, nil)
- if err != tt.werr {
- t.Errorf("#%d: applyConfChange error = %v, want %v", i, err, tt.werr)
- }
- cc := raftpb.ConfChange{Type: tt.cc.Type, NodeID: raft.None}
- w := []testutil.Action{
- {
- Name: "ApplyConfChange",
- Params: []interface{}{cc},
- },
- }
- if g, _ := n.Wait(1); !reflect.DeepEqual(g, w) {
- t.Errorf("#%d: action = %+v, want %+v", i, g, w)
- }
- }
-}
-
-func TestApplyConfChangeShouldStop(t *testing.T) {
- cl := membership.NewCluster("")
- cl.SetStore(store.New())
- for i := 1; i <= 3; i++ {
- cl.AddMember(&membership.Member{ID: types.ID(i)})
- }
- r := newRaftNode(raftNodeConfig{
- Node: newNodeNop(),
- transport: rafthttp.NewNopTransporter(),
- })
- srv := &EtcdServer{
- id: 1,
- r: *r,
- cluster: cl,
- }
- cc := raftpb.ConfChange{
- Type: raftpb.ConfChangeRemoveNode,
- NodeID: 2,
- }
- // remove non-local member
- shouldStop, err := srv.applyConfChange(cc, &raftpb.ConfState{})
- if err != nil {
- t.Fatalf("unexpected error %v", err)
- }
- if shouldStop {
- t.Errorf("shouldStop = %t, want %t", shouldStop, false)
- }
-
- // remove local member
- cc.NodeID = 1
- shouldStop, err = srv.applyConfChange(cc, &raftpb.ConfState{})
- if err != nil {
- t.Fatalf("unexpected error %v", err)
- }
- if !shouldStop {
- t.Errorf("shouldStop = %t, want %t", shouldStop, true)
- }
-}
-
-// TestApplyConfigChangeUpdatesConsistIndex ensures a config change also updates the consistIndex
-// where consistIndex equals to applied index.
-func TestApplyConfigChangeUpdatesConsistIndex(t *testing.T) {
- cl := membership.NewCluster("")
- cl.SetStore(store.New())
- cl.AddMember(&membership.Member{ID: types.ID(1)})
- r := newRaftNode(raftNodeConfig{
- Node: newNodeNop(),
- transport: rafthttp.NewNopTransporter(),
- })
- srv := &EtcdServer{
- id: 1,
- r: *r,
- cluster: cl,
- w: wait.New(),
- }
-
- // create EntryConfChange entry
- now := time.Now()
- urls, err := types.NewURLs([]string{"http://whatever:123"})
- if err != nil {
- t.Fatal(err)
- }
- m := membership.NewMember("", urls, "", &now)
- m.ID = types.ID(2)
- b, err := json.Marshal(m)
- if err != nil {
- t.Fatal(err)
- }
- cc := &raftpb.ConfChange{Type: raftpb.ConfChangeAddNode, NodeID: 2, Context: b}
- ents := []raftpb.Entry{{
- Index: 2,
- Type: raftpb.EntryConfChange,
- Data: pbutil.MustMarshal(cc),
- }}
-
- _, appliedi, _ := srv.apply(ents, &raftpb.ConfState{})
- consistIndex := srv.consistIndex.ConsistentIndex()
- if consistIndex != appliedi {
- t.Fatalf("consistIndex = %v, want %v", consistIndex, appliedi)
- }
-}
-
-// TestApplyMultiConfChangeShouldStop ensures that apply will return shouldStop
-// if the local member is removed along with other conf updates.
-func TestApplyMultiConfChangeShouldStop(t *testing.T) {
- cl := membership.NewCluster("")
- cl.SetStore(store.New())
- for i := 1; i <= 5; i++ {
- cl.AddMember(&membership.Member{ID: types.ID(i)})
- }
- r := newRaftNode(raftNodeConfig{
- Node: newNodeNop(),
- transport: rafthttp.NewNopTransporter(),
- })
- srv := &EtcdServer{
- id: 2,
- r: *r,
- cluster: cl,
- w: wait.New(),
- }
- ents := []raftpb.Entry{}
- for i := 1; i <= 4; i++ {
- ent := raftpb.Entry{
- Term: 1,
- Index: uint64(i),
- Type: raftpb.EntryConfChange,
- Data: pbutil.MustMarshal(
- &raftpb.ConfChange{
- Type: raftpb.ConfChangeRemoveNode,
- NodeID: uint64(i)}),
- }
- ents = append(ents, ent)
- }
-
- _, _, shouldStop := srv.apply(ents, &raftpb.ConfState{})
- if !shouldStop {
- t.Errorf("shouldStop = %t, want %t", shouldStop, true)
- }
-}
-
-func TestDoProposal(t *testing.T) {
- tests := []pb.Request{
- {Method: "POST", ID: 1},
- {Method: "PUT", ID: 1},
- {Method: "DELETE", ID: 1},
- {Method: "GET", ID: 1, Quorum: true},
- }
- for i, tt := range tests {
- st := mockstore.NewRecorder()
- r := newRaftNode(raftNodeConfig{
- Node: newNodeCommitter(),
- storage: mockstorage.NewStorageRecorder(""),
- raftStorage: raft.NewMemoryStorage(),
- transport: rafthttp.NewNopTransporter(),
- })
- srv := &EtcdServer{
- Cfg: ServerConfig{TickMs: 1},
- r: *r,
- store: st,
- reqIDGen: idutil.NewGenerator(0, time.Time{}),
- SyncTicker: &time.Ticker{},
- }
- srv.applyV2 = &applierV2store{store: srv.store, cluster: srv.cluster}
- srv.start()
- resp, err := srv.Do(context.Background(), tt)
- srv.Stop()
-
- action := st.Action()
- if len(action) != 1 {
- t.Errorf("#%d: len(action) = %d, want 1", i, len(action))
- }
- if err != nil {
- t.Fatalf("#%d: err = %v, want nil", i, err)
- }
- // resp.Index is set in Do() based on the raft state; may either be 0 or 1
- wresp := Response{Event: &store.Event{}, Index: resp.Index}
- if !reflect.DeepEqual(resp, wresp) {
- t.Errorf("#%d: resp = %v, want %v", i, resp, wresp)
- }
- }
-}
-
-func TestDoProposalCancelled(t *testing.T) {
- wt := mockwait.NewRecorder()
- srv := &EtcdServer{
- Cfg: ServerConfig{TickMs: 1},
- r: *newRaftNode(raftNodeConfig{Node: newNodeNop()}),
- w: wt,
- reqIDGen: idutil.NewGenerator(0, time.Time{}),
- }
- srv.applyV2 = &applierV2store{store: srv.store, cluster: srv.cluster}
-
- ctx, cancel := context.WithCancel(context.Background())
- cancel()
- _, err := srv.Do(ctx, pb.Request{Method: "PUT"})
-
- if err != ErrCanceled {
- t.Fatalf("err = %v, want %v", err, ErrCanceled)
- }
- w := []testutil.Action{{Name: "Register"}, {Name: "Trigger"}}
- if !reflect.DeepEqual(wt.Action(), w) {
- t.Errorf("wt.action = %+v, want %+v", wt.Action(), w)
- }
-}
-
-func TestDoProposalTimeout(t *testing.T) {
- srv := &EtcdServer{
- Cfg: ServerConfig{TickMs: 1},
- r: *newRaftNode(raftNodeConfig{Node: newNodeNop()}),
- w: mockwait.NewNop(),
- reqIDGen: idutil.NewGenerator(0, time.Time{}),
- }
- srv.applyV2 = &applierV2store{store: srv.store, cluster: srv.cluster}
-
- ctx, cancel := context.WithTimeout(context.Background(), 0)
- _, err := srv.Do(ctx, pb.Request{Method: "PUT"})
- cancel()
- if err != ErrTimeout {
- t.Fatalf("err = %v, want %v", err, ErrTimeout)
- }
-}
-
-func TestDoProposalStopped(t *testing.T) {
- srv := &EtcdServer{
- Cfg: ServerConfig{TickMs: 1},
- r: *newRaftNode(raftNodeConfig{Node: newNodeNop()}),
- w: mockwait.NewNop(),
- reqIDGen: idutil.NewGenerator(0, time.Time{}),
- }
- srv.applyV2 = &applierV2store{store: srv.store, cluster: srv.cluster}
-
- srv.stopping = make(chan struct{})
- close(srv.stopping)
- _, err := srv.Do(context.Background(), pb.Request{Method: "PUT", ID: 1})
- if err != ErrStopped {
- t.Errorf("err = %v, want %v", err, ErrStopped)
- }
-}
-
-// TestSync tests sync 1. is nonblocking 2. proposes SYNC request.
-func TestSync(t *testing.T) {
- n := newNodeRecorder()
- ctx, cancel := context.WithCancel(context.TODO())
- srv := &EtcdServer{
- r: *newRaftNode(raftNodeConfig{Node: n}),
- reqIDGen: idutil.NewGenerator(0, time.Time{}),
- ctx: ctx,
- cancel: cancel,
- }
- srv.applyV2 = &applierV2store{store: srv.store, cluster: srv.cluster}
-
- // check that sync is non-blocking
- done := make(chan struct{})
- go func() {
- srv.sync(10 * time.Second)
- done <- struct{}{}
- }()
-
- select {
- case <-done:
- case <-time.After(time.Second):
- t.Fatal("sync should be non-blocking but did not return after 1s!")
- }
-
- action, _ := n.Wait(1)
- if len(action) != 1 {
- t.Fatalf("len(action) = %d, want 1", len(action))
- }
- if action[0].Name != "Propose" {
- t.Fatalf("action = %s, want Propose", action[0].Name)
- }
- data := action[0].Params[0].([]byte)
- var r pb.Request
- if err := r.Unmarshal(data); err != nil {
- t.Fatalf("unmarshal request error: %v", err)
- }
- if r.Method != "SYNC" {
- t.Errorf("method = %s, want SYNC", r.Method)
- }
-}
-
-// TestSyncTimeout tests the case that sync 1. is non-blocking 2. cancel request
-// after timeout
-func TestSyncTimeout(t *testing.T) {
- n := newProposalBlockerRecorder()
- ctx, cancel := context.WithCancel(context.TODO())
- srv := &EtcdServer{
- r: *newRaftNode(raftNodeConfig{Node: n}),
- reqIDGen: idutil.NewGenerator(0, time.Time{}),
- ctx: ctx,
- cancel: cancel,
- }
- srv.applyV2 = &applierV2store{store: srv.store, cluster: srv.cluster}
-
- // check that sync is non-blocking
- done := make(chan struct{})
- go func() {
- srv.sync(0)
- done <- struct{}{}
- }()
-
- select {
- case <-done:
- case <-time.After(time.Second):
- t.Fatal("sync should be non-blocking but did not return after 1s!")
- }
-
- w := []testutil.Action{{Name: "Propose blocked"}}
- if g, _ := n.Wait(1); !reflect.DeepEqual(g, w) {
- t.Errorf("action = %v, want %v", g, w)
- }
-}
-
-// TODO: TestNoSyncWhenNoLeader
-
-// TestSyncTrigger tests that the server proposes a SYNC request when its sync timer ticks
-func TestSyncTrigger(t *testing.T) {
- n := newReadyNode()
- st := make(chan time.Time, 1)
- tk := &time.Ticker{C: st}
- r := newRaftNode(raftNodeConfig{
- Node: n,
- raftStorage: raft.NewMemoryStorage(),
- transport: rafthttp.NewNopTransporter(),
- storage: mockstorage.NewStorageRecorder(""),
- })
-
- srv := &EtcdServer{
- Cfg: ServerConfig{TickMs: 1},
- r: *r,
- store: mockstore.NewNop(),
- SyncTicker: tk,
- reqIDGen: idutil.NewGenerator(0, time.Time{}),
- }
-
- // trigger the server to become a leader and accept sync requests
- go func() {
- srv.start()
- n.readyc <- raft.Ready{
- SoftState: &raft.SoftState{
- RaftState: raft.StateLeader,
- },
- }
- // trigger a sync request
- st <- time.Time{}
- }()
-
- action, _ := n.Wait(1)
- go srv.Stop()
-
- if len(action) != 1 {
- t.Fatalf("len(action) = %d, want 1", len(action))
- }
- if action[0].Name != "Propose" {
- t.Fatalf("action = %s, want Propose", action[0].Name)
- }
- data := action[0].Params[0].([]byte)
- var req pb.Request
- if err := req.Unmarshal(data); err != nil {
- t.Fatalf("error unmarshalling data: %v", err)
- }
- if req.Method != "SYNC" {
- t.Fatalf("unexpected proposed request: %#v", req.Method)
- }
-
- // wait on stop message
- <-n.Chan()
-}
-
-// snapshot should snapshot the store and cut the persistent
-func TestSnapshot(t *testing.T) {
- be, tmpPath := backend.NewDefaultTmpBackend()
- defer func() {
- os.RemoveAll(tmpPath)
- }()
-
- s := raft.NewMemoryStorage()
- s.Append([]raftpb.Entry{{Index: 1}})
- st := mockstore.NewRecorderStream()
- p := mockstorage.NewStorageRecorderStream("")
- r := newRaftNode(raftNodeConfig{
- Node: newNodeNop(),
- raftStorage: s,
- storage: p,
- })
- srv := &EtcdServer{
- r: *r,
- store: st,
- }
- srv.kv = mvcc.New(be, &lease.FakeLessor{}, &srv.consistIndex)
- srv.be = be
-
- ch := make(chan struct{}, 2)
-
- go func() {
- gaction, _ := p.Wait(1)
- defer func() { ch <- struct{}{} }()
-
- if len(gaction) != 1 {
- t.Fatalf("len(action) = %d, want 1", len(gaction))
- }
- if !reflect.DeepEqual(gaction[0], testutil.Action{Name: "SaveSnap"}) {
- t.Errorf("action = %s, want SaveSnap", gaction[0])
- }
- }()
-
- go func() {
- gaction, _ := st.Wait(2)
- defer func() { ch <- struct{}{} }()
-
- if len(gaction) != 2 {
- t.Fatalf("len(action) = %d, want 2", len(gaction))
- }
- if !reflect.DeepEqual(gaction[0], testutil.Action{Name: "Clone"}) {
- t.Errorf("action = %s, want Clone", gaction[0])
- }
- if !reflect.DeepEqual(gaction[1], testutil.Action{Name: "SaveNoCopy"}) {
- t.Errorf("action = %s, want SaveNoCopy", gaction[1])
- }
- }()
-
- srv.snapshot(1, raftpb.ConfState{Nodes: []uint64{1}})
- <-ch
- <-ch
-}
-
-// TestSnapshotOrdering ensures raft persists snapshot onto disk before
-// snapshot db is applied.
-func TestSnapshotOrdering(t *testing.T) {
- n := newNopReadyNode()
- st := store.New()
- cl := membership.NewCluster("abc")
- cl.SetStore(st)
-
- testdir, err := ioutil.TempDir(os.TempDir(), "testsnapdir")
- if err != nil {
- t.Fatalf("couldn't open tempdir (%v)", err)
- }
- defer os.RemoveAll(testdir)
-
- snapdir := filepath.Join(testdir, "member", "snap")
- if err := os.MkdirAll(snapdir, 0755); err != nil {
- t.Fatalf("couldn't make snap dir (%v)", err)
- }
-
- rs := raft.NewMemoryStorage()
- p := mockstorage.NewStorageRecorderStream(testdir)
- tr, snapDoneC := rafthttp.NewSnapTransporter(snapdir)
- r := newRaftNode(raftNodeConfig{
- isIDRemoved: func(id uint64) bool { return cl.IsIDRemoved(types.ID(id)) },
- Node: n,
- transport: tr,
- storage: p,
- raftStorage: rs,
- })
- s := &EtcdServer{
- Cfg: ServerConfig{DataDir: testdir},
- r: *r,
- store: st,
- snapshotter: snap.New(snapdir),
- cluster: cl,
- SyncTicker: &time.Ticker{},
- }
- s.applyV2 = &applierV2store{store: s.store, cluster: s.cluster}
-
- be, tmpPath := backend.NewDefaultTmpBackend()
- defer os.RemoveAll(tmpPath)
- s.kv = mvcc.New(be, &lease.FakeLessor{}, &s.consistIndex)
- s.be = be
-
- s.start()
- defer s.Stop()
-
- n.readyc <- raft.Ready{Messages: []raftpb.Message{{Type: raftpb.MsgSnap}}}
- go func() {
- // get the snapshot sent by the transport
- snapMsg := <-snapDoneC
- // Snapshot first triggers raftnode to persists the snapshot onto disk
- // before renaming db snapshot file to db
- snapMsg.Snapshot.Metadata.Index = 1
- n.readyc <- raft.Ready{Snapshot: snapMsg.Snapshot}
- }()
-
- if ac := <-p.Chan(); ac.Name != "Save" {
- t.Fatalf("expected Save, got %+v", ac)
- }
- if ac := <-p.Chan(); ac.Name != "Save" {
- t.Fatalf("expected Save, got %+v", ac)
- }
- // confirm snapshot file still present before calling SaveSnap
- snapPath := filepath.Join(snapdir, fmt.Sprintf("%016x.snap.db", 1))
- if !fileutil.Exist(snapPath) {
- t.Fatalf("expected file %q, got missing", snapPath)
- }
- // unblock SaveSnapshot, etcdserver now permitted to move snapshot file
- if ac := <-p.Chan(); ac.Name != "SaveSnap" {
- t.Fatalf("expected SaveSnap, got %+v", ac)
- }
-}
-
-// Applied > SnapCount should trigger a SaveSnap event
-func TestTriggerSnap(t *testing.T) {
- be, tmpPath := backend.NewDefaultTmpBackend()
- defer func() {
- os.RemoveAll(tmpPath)
- }()
-
- snapc := 10
- st := mockstore.NewRecorder()
- p := mockstorage.NewStorageRecorderStream("")
- r := newRaftNode(raftNodeConfig{
- Node: newNodeCommitter(),
- raftStorage: raft.NewMemoryStorage(),
- storage: p,
- transport: rafthttp.NewNopTransporter(),
- })
- srv := &EtcdServer{
- Cfg: ServerConfig{TickMs: 1, SnapCount: uint64(snapc)},
- r: *r,
- store: st,
- reqIDGen: idutil.NewGenerator(0, time.Time{}),
- SyncTicker: &time.Ticker{},
- }
- srv.applyV2 = &applierV2store{store: srv.store, cluster: srv.cluster}
-
- srv.kv = mvcc.New(be, &lease.FakeLessor{}, &srv.consistIndex)
- srv.be = be
-
- srv.start()
-
- donec := make(chan struct{})
- go func() {
- wcnt := 2 + snapc
- gaction, _ := p.Wait(wcnt)
-
- // each operation is recorded as a Save
- // (SnapCount+1) * Puts + SaveSnap = (SnapCount+1) * Save + SaveSnap
- if len(gaction) != wcnt {
- t.Fatalf("len(action) = %d, want %d", len(gaction), wcnt)
- }
- if !reflect.DeepEqual(gaction[wcnt-1], testutil.Action{Name: "SaveSnap"}) {
- t.Errorf("action = %s, want SaveSnap", gaction[wcnt-1])
- }
- close(donec)
- }()
-
- for i := 0; i < snapc+1; i++ {
- srv.Do(context.Background(), pb.Request{Method: "PUT"})
- }
-
- <-donec
- srv.Stop()
-}
-
-// TestConcurrentApplyAndSnapshotV3 will send out snapshots concurrently with
-// proposals.
-func TestConcurrentApplyAndSnapshotV3(t *testing.T) {
- n := newNopReadyNode()
- st := store.New()
- cl := membership.NewCluster("abc")
- cl.SetStore(st)
-
- testdir, err := ioutil.TempDir(os.TempDir(), "testsnapdir")
- if err != nil {
- t.Fatalf("Couldn't open tempdir (%v)", err)
- }
- defer os.RemoveAll(testdir)
- if err := os.MkdirAll(testdir+"/member/snap", 0755); err != nil {
- t.Fatalf("Couldn't make snap dir (%v)", err)
- }
-
- rs := raft.NewMemoryStorage()
- tr, snapDoneC := rafthttp.NewSnapTransporter(testdir)
- r := newRaftNode(raftNodeConfig{
- isIDRemoved: func(id uint64) bool { return cl.IsIDRemoved(types.ID(id)) },
- Node: n,
- transport: tr,
- storage: mockstorage.NewStorageRecorder(testdir),
- raftStorage: rs,
- })
- s := &EtcdServer{
- Cfg: ServerConfig{DataDir: testdir},
- r: *r,
- store: st,
- snapshotter: snap.New(testdir),
- cluster: cl,
- SyncTicker: &time.Ticker{},
- }
- s.applyV2 = &applierV2store{store: s.store, cluster: s.cluster}
-
- be, tmpPath := backend.NewDefaultTmpBackend()
- defer func() {
- os.RemoveAll(tmpPath)
- }()
- s.kv = mvcc.New(be, &lease.FakeLessor{}, &s.consistIndex)
- s.be = be
-
- s.start()
- defer s.Stop()
-
- // submit applied entries and snap entries
- idx := uint64(0)
- outdated := 0
- accepted := 0
- for k := 1; k <= 101; k++ {
- idx++
- ch := s.w.Register(uint64(idx))
- req := &pb.Request{Method: "QGET", ID: uint64(idx)}
- ent := raftpb.Entry{Index: uint64(idx), Data: pbutil.MustMarshal(req)}
- ready := raft.Ready{Entries: []raftpb.Entry{ent}}
- n.readyc <- ready
-
- ready = raft.Ready{CommittedEntries: []raftpb.Entry{ent}}
- n.readyc <- ready
-
- // "idx" applied
- <-ch
-
- // one snapshot for every two messages
- if k%2 != 0 {
- continue
- }
-
- n.readyc <- raft.Ready{Messages: []raftpb.Message{{Type: raftpb.MsgSnap}}}
- // get the snapshot sent by the transport
- snapMsg := <-snapDoneC
- // If the snapshot trails applied records, recovery will panic
- // since there's no allocated snapshot at the place of the
- // snapshot record. This only happens when the applier and the
- // snapshot sender get out of sync.
- if snapMsg.Snapshot.Metadata.Index == idx {
- idx++
- snapMsg.Snapshot.Metadata.Index = idx
- ready = raft.Ready{Snapshot: snapMsg.Snapshot}
- n.readyc <- ready
- accepted++
- } else {
- outdated++
- }
- // don't wait for the snapshot to complete, move to next message
- }
- if accepted != 50 {
- t.Errorf("accepted=%v, want 50", accepted)
- }
- if outdated != 0 {
- t.Errorf("outdated=%v, want 0", outdated)
- }
-}
-
-// TestAddMember tests AddMember can propose and perform node addition.
-func TestAddMember(t *testing.T) {
- n := newNodeConfChangeCommitterRecorder()
- n.readyc <- raft.Ready{
- SoftState: &raft.SoftState{RaftState: raft.StateLeader},
- }
- cl := newTestCluster(nil)
- st := store.New()
- cl.SetStore(st)
- r := newRaftNode(raftNodeConfig{
- Node: n,
- raftStorage: raft.NewMemoryStorage(),
- storage: mockstorage.NewStorageRecorder(""),
- transport: rafthttp.NewNopTransporter(),
- })
- s := &EtcdServer{
- r: *r,
- store: st,
- cluster: cl,
- reqIDGen: idutil.NewGenerator(0, time.Time{}),
- SyncTicker: &time.Ticker{},
- }
- s.start()
- m := membership.Member{ID: 1234, RaftAttributes: membership.RaftAttributes{PeerURLs: []string{"foo"}}}
- _, err := s.AddMember(context.TODO(), m)
- gaction := n.Action()
- s.Stop()
-
- if err != nil {
- t.Fatalf("AddMember error: %v", err)
- }
- wactions := []testutil.Action{{Name: "ProposeConfChange:ConfChangeAddNode"}, {Name: "ApplyConfChange:ConfChangeAddNode"}}
- if !reflect.DeepEqual(gaction, wactions) {
- t.Errorf("action = %v, want %v", gaction, wactions)
- }
- if cl.Member(1234) == nil {
- t.Errorf("member with id 1234 is not added")
- }
-}
-
-// TestRemoveMember tests RemoveMember can propose and perform node removal.
-func TestRemoveMember(t *testing.T) {
- n := newNodeConfChangeCommitterRecorder()
- n.readyc <- raft.Ready{
- SoftState: &raft.SoftState{RaftState: raft.StateLeader},
- }
- cl := newTestCluster(nil)
- st := store.New()
- cl.SetStore(store.New())
- cl.AddMember(&membership.Member{ID: 1234})
- r := newRaftNode(raftNodeConfig{
- Node: n,
- raftStorage: raft.NewMemoryStorage(),
- storage: mockstorage.NewStorageRecorder(""),
- transport: rafthttp.NewNopTransporter(),
- })
- s := &EtcdServer{
- r: *r,
- store: st,
- cluster: cl,
- reqIDGen: idutil.NewGenerator(0, time.Time{}),
- SyncTicker: &time.Ticker{},
- }
- s.start()
- _, err := s.RemoveMember(context.TODO(), 1234)
- gaction := n.Action()
- s.Stop()
-
- if err != nil {
- t.Fatalf("RemoveMember error: %v", err)
- }
- wactions := []testutil.Action{{Name: "ProposeConfChange:ConfChangeRemoveNode"}, {Name: "ApplyConfChange:ConfChangeRemoveNode"}}
- if !reflect.DeepEqual(gaction, wactions) {
- t.Errorf("action = %v, want %v", gaction, wactions)
- }
- if cl.Member(1234) != nil {
- t.Errorf("member with id 1234 is not removed")
- }
-}
-
-// TestUpdateMember tests RemoveMember can propose and perform node update.
-func TestUpdateMember(t *testing.T) {
- n := newNodeConfChangeCommitterRecorder()
- n.readyc <- raft.Ready{
- SoftState: &raft.SoftState{RaftState: raft.StateLeader},
- }
- cl := newTestCluster(nil)
- st := store.New()
- cl.SetStore(st)
- cl.AddMember(&membership.Member{ID: 1234})
- r := newRaftNode(raftNodeConfig{
- Node: n,
- raftStorage: raft.NewMemoryStorage(),
- storage: mockstorage.NewStorageRecorder(""),
- transport: rafthttp.NewNopTransporter(),
- })
- s := &EtcdServer{
- r: *r,
- store: st,
- cluster: cl,
- reqIDGen: idutil.NewGenerator(0, time.Time{}),
- SyncTicker: &time.Ticker{},
- }
- s.start()
- wm := membership.Member{ID: 1234, RaftAttributes: membership.RaftAttributes{PeerURLs: []string{"http://127.0.0.1:1"}}}
- _, err := s.UpdateMember(context.TODO(), wm)
- gaction := n.Action()
- s.Stop()
-
- if err != nil {
- t.Fatalf("UpdateMember error: %v", err)
- }
- wactions := []testutil.Action{{Name: "ProposeConfChange:ConfChangeUpdateNode"}, {Name: "ApplyConfChange:ConfChangeUpdateNode"}}
- if !reflect.DeepEqual(gaction, wactions) {
- t.Errorf("action = %v, want %v", gaction, wactions)
- }
- if !reflect.DeepEqual(cl.Member(1234), &wm) {
- t.Errorf("member = %v, want %v", cl.Member(1234), &wm)
- }
-}
-
-// TODO: test server could stop itself when being removed
-
-func TestPublish(t *testing.T) {
- n := newNodeRecorder()
- ch := make(chan interface{}, 1)
- // simulate that request has gone through consensus
- ch <- Response{}
- w := wait.NewWithResponse(ch)
- ctx, cancel := context.WithCancel(context.TODO())
- srv := &EtcdServer{
- readych: make(chan struct{}),
- Cfg: ServerConfig{TickMs: 1},
- id: 1,
- r: *newRaftNode(raftNodeConfig{Node: n}),
- attributes: membership.Attributes{Name: "node1", ClientURLs: []string{"http://a", "http://b"}},
- cluster: &membership.RaftCluster{},
- w: w,
- reqIDGen: idutil.NewGenerator(0, time.Time{}),
- SyncTicker: &time.Ticker{},
-
- ctx: ctx,
- cancel: cancel,
- }
- srv.publish(time.Hour)
-
- action := n.Action()
- if len(action) != 1 {
- t.Fatalf("len(action) = %d, want 1", len(action))
- }
- if action[0].Name != "Propose" {
- t.Fatalf("action = %s, want Propose", action[0].Name)
- }
- data := action[0].Params[0].([]byte)
- var r pb.Request
- if err := r.Unmarshal(data); err != nil {
- t.Fatalf("unmarshal request error: %v", err)
- }
- if r.Method != "PUT" {
- t.Errorf("method = %s, want PUT", r.Method)
- }
- wm := membership.Member{ID: 1, Attributes: membership.Attributes{Name: "node1", ClientURLs: []string{"http://a", "http://b"}}}
- if wpath := membership.MemberAttributesStorePath(wm.ID); r.Path != wpath {
- t.Errorf("path = %s, want %s", r.Path, wpath)
- }
- var gattr membership.Attributes
- if err := json.Unmarshal([]byte(r.Val), &gattr); err != nil {
- t.Fatalf("unmarshal val error: %v", err)
- }
- if !reflect.DeepEqual(gattr, wm.Attributes) {
- t.Errorf("member = %v, want %v", gattr, wm.Attributes)
- }
-}
-
-// TestPublishStopped tests that publish will be stopped if server is stopped.
-func TestPublishStopped(t *testing.T) {
- ctx, cancel := context.WithCancel(context.TODO())
- r := newRaftNode(raftNodeConfig{
- Node: newNodeNop(),
- transport: rafthttp.NewNopTransporter(),
- })
- srv := &EtcdServer{
- Cfg: ServerConfig{TickMs: 1},
- r: *r,
- cluster: &membership.RaftCluster{},
- w: mockwait.NewNop(),
- done: make(chan struct{}),
- stopping: make(chan struct{}),
- stop: make(chan struct{}),
- reqIDGen: idutil.NewGenerator(0, time.Time{}),
- SyncTicker: &time.Ticker{},
-
- ctx: ctx,
- cancel: cancel,
- }
- close(srv.stopping)
- srv.publish(time.Hour)
-}
-
-// TestPublishRetry tests that publish will keep retry until success.
-func TestPublishRetry(t *testing.T) {
- ctx, cancel := context.WithCancel(context.TODO())
- n := newNodeRecorderStream()
- srv := &EtcdServer{
- Cfg: ServerConfig{TickMs: 1},
- r: *newRaftNode(raftNodeConfig{Node: n}),
- w: mockwait.NewNop(),
- stopping: make(chan struct{}),
- reqIDGen: idutil.NewGenerator(0, time.Time{}),
- SyncTicker: &time.Ticker{},
- ctx: ctx,
- cancel: cancel,
- }
- // expect multiple proposals from retrying
- ch := make(chan struct{})
- go func() {
- defer close(ch)
- if action, err := n.Wait(2); err != nil {
- t.Errorf("len(action) = %d, want >= 2 (%v)", len(action), err)
- }
- close(srv.stopping)
- // drain remaining actions, if any, so publish can terminate
- for {
- select {
- case <-ch:
- return
- default:
- n.Action()
- }
- }
- }()
- srv.publish(10 * time.Nanosecond)
- ch <- struct{}{}
- <-ch
-}
-
-func TestUpdateVersion(t *testing.T) {
- n := newNodeRecorder()
- ch := make(chan interface{}, 1)
- // simulate that request has gone through consensus
- ch <- Response{}
- w := wait.NewWithResponse(ch)
- ctx, cancel := context.WithCancel(context.TODO())
- srv := &EtcdServer{
- id: 1,
- Cfg: ServerConfig{TickMs: 1},
- r: *newRaftNode(raftNodeConfig{Node: n}),
- attributes: membership.Attributes{Name: "node1", ClientURLs: []string{"http://node1.com"}},
- cluster: &membership.RaftCluster{},
- w: w,
- reqIDGen: idutil.NewGenerator(0, time.Time{}),
- SyncTicker: &time.Ticker{},
-
- ctx: ctx,
- cancel: cancel,
- }
- srv.updateClusterVersion("2.0.0")
-
- action := n.Action()
- if len(action) != 1 {
- t.Fatalf("len(action) = %d, want 1", len(action))
- }
- if action[0].Name != "Propose" {
- t.Fatalf("action = %s, want Propose", action[0].Name)
- }
- data := action[0].Params[0].([]byte)
- var r pb.Request
- if err := r.Unmarshal(data); err != nil {
- t.Fatalf("unmarshal request error: %v", err)
- }
- if r.Method != "PUT" {
- t.Errorf("method = %s, want PUT", r.Method)
- }
- if wpath := path.Join(StoreClusterPrefix, "version"); r.Path != wpath {
- t.Errorf("path = %s, want %s", r.Path, wpath)
- }
- if r.Val != "2.0.0" {
- t.Errorf("val = %s, want %s", r.Val, "2.0.0")
- }
-}
-
-func TestStopNotify(t *testing.T) {
- s := &EtcdServer{
- stop: make(chan struct{}),
- done: make(chan struct{}),
- }
- go func() {
- <-s.stop
- close(s.done)
- }()
-
- notifier := s.StopNotify()
- select {
- case <-notifier:
- t.Fatalf("received unexpected stop notification")
- default:
- }
- s.Stop()
- select {
- case <-notifier:
- default:
- t.Fatalf("cannot receive stop notification")
- }
-}
-
-func TestGetOtherPeerURLs(t *testing.T) {
- tests := []struct {
- membs []*membership.Member
- wurls []string
- }{
- {
- []*membership.Member{
- membership.NewMember("1", types.MustNewURLs([]string{"http://10.0.0.1:1"}), "a", nil),
- },
- []string{},
- },
- {
- []*membership.Member{
- membership.NewMember("1", types.MustNewURLs([]string{"http://10.0.0.1:1"}), "a", nil),
- membership.NewMember("2", types.MustNewURLs([]string{"http://10.0.0.2:2"}), "a", nil),
- membership.NewMember("3", types.MustNewURLs([]string{"http://10.0.0.3:3"}), "a", nil),
- },
- []string{"http://10.0.0.2:2", "http://10.0.0.3:3"},
- },
- {
- []*membership.Member{
- membership.NewMember("1", types.MustNewURLs([]string{"http://10.0.0.1:1"}), "a", nil),
- membership.NewMember("3", types.MustNewURLs([]string{"http://10.0.0.3:3"}), "a", nil),
- membership.NewMember("2", types.MustNewURLs([]string{"http://10.0.0.2:2"}), "a", nil),
- },
- []string{"http://10.0.0.2:2", "http://10.0.0.3:3"},
- },
- }
- for i, tt := range tests {
- cl := membership.NewClusterFromMembers("", types.ID(0), tt.membs)
- self := "1"
- urls := getRemotePeerURLs(cl, self)
- if !reflect.DeepEqual(urls, tt.wurls) {
- t.Errorf("#%d: urls = %+v, want %+v", i, urls, tt.wurls)
- }
- }
-}
-
-type nodeRecorder struct{ testutil.Recorder }
-
-func newNodeRecorder() *nodeRecorder { return &nodeRecorder{&testutil.RecorderBuffered{}} }
-func newNodeRecorderStream() *nodeRecorder { return &nodeRecorder{testutil.NewRecorderStream()} }
-func newNodeNop() raft.Node { return newNodeRecorder() }
-
-func (n *nodeRecorder) Tick() { n.Record(testutil.Action{Name: "Tick"}) }
-func (n *nodeRecorder) Campaign(ctx context.Context) error {
- n.Record(testutil.Action{Name: "Campaign"})
- return nil
-}
-func (n *nodeRecorder) Propose(ctx context.Context, data []byte) error {
- n.Record(testutil.Action{Name: "Propose", Params: []interface{}{data}})
- return nil
-}
-func (n *nodeRecorder) ProposeConfChange(ctx context.Context, conf raftpb.ConfChange) error {
- n.Record(testutil.Action{Name: "ProposeConfChange"})
- return nil
-}
-func (n *nodeRecorder) Step(ctx context.Context, msg raftpb.Message) error {
- n.Record(testutil.Action{Name: "Step"})
- return nil
-}
-func (n *nodeRecorder) Status() raft.Status { return raft.Status{} }
-func (n *nodeRecorder) Ready() <-chan raft.Ready { return nil }
-func (n *nodeRecorder) TransferLeadership(ctx context.Context, lead, transferee uint64) {}
-func (n *nodeRecorder) ReadIndex(ctx context.Context, rctx []byte) error { return nil }
-func (n *nodeRecorder) Advance() {}
-func (n *nodeRecorder) ApplyConfChange(conf raftpb.ConfChange) *raftpb.ConfState {
- n.Record(testutil.Action{Name: "ApplyConfChange", Params: []interface{}{conf}})
- return &raftpb.ConfState{}
-}
-
-func (n *nodeRecorder) Stop() {
- n.Record(testutil.Action{Name: "Stop"})
-}
-
-func (n *nodeRecorder) ReportUnreachable(id uint64) {}
-
-func (n *nodeRecorder) ReportSnapshot(id uint64, status raft.SnapshotStatus) {}
-
-func (n *nodeRecorder) Compact(index uint64, nodes []uint64, d []byte) {
- n.Record(testutil.Action{Name: "Compact"})
-}
-
-type nodeProposalBlockerRecorder struct {
- nodeRecorder
-}
-
-func newProposalBlockerRecorder() *nodeProposalBlockerRecorder {
- return &nodeProposalBlockerRecorder{*newNodeRecorderStream()}
-}
-
-func (n *nodeProposalBlockerRecorder) Propose(ctx context.Context, data []byte) error {
- <-ctx.Done()
- n.Record(testutil.Action{Name: "Propose blocked"})
- return nil
-}
-
-// readyNode is a nodeRecorder with a user-writeable ready channel
-type readyNode struct {
- nodeRecorder
- readyc chan raft.Ready
-}
-
-func newReadyNode() *readyNode {
- return &readyNode{
- nodeRecorder{testutil.NewRecorderStream()},
- make(chan raft.Ready, 1)}
-}
-func newNopReadyNode() *readyNode {
- return &readyNode{*newNodeRecorder(), make(chan raft.Ready, 1)}
-}
-
-func (n *readyNode) Ready() <-chan raft.Ready { return n.readyc }
-
-type nodeConfChangeCommitterRecorder struct {
- readyNode
- index uint64
-}
-
-func newNodeConfChangeCommitterRecorder() *nodeConfChangeCommitterRecorder {
- return &nodeConfChangeCommitterRecorder{*newNopReadyNode(), 0}
-}
-
-func newNodeConfChangeCommitterStream() *nodeConfChangeCommitterRecorder {
- return &nodeConfChangeCommitterRecorder{*newReadyNode(), 0}
-}
-
-func (n *nodeConfChangeCommitterRecorder) ProposeConfChange(ctx context.Context, conf raftpb.ConfChange) error {
- data, err := conf.Marshal()
- if err != nil {
- return err
- }
- n.index++
- n.Record(testutil.Action{Name: "ProposeConfChange:" + conf.Type.String()})
- n.readyc <- raft.Ready{CommittedEntries: []raftpb.Entry{{Index: n.index, Type: raftpb.EntryConfChange, Data: data}}}
- return nil
-}
-func (n *nodeConfChangeCommitterRecorder) Ready() <-chan raft.Ready {
- return n.readyc
-}
-func (n *nodeConfChangeCommitterRecorder) ApplyConfChange(conf raftpb.ConfChange) *raftpb.ConfState {
- n.Record(testutil.Action{Name: "ApplyConfChange:" + conf.Type.String()})
- return &raftpb.ConfState{}
-}
-
-// nodeCommitter commits proposed data immediately.
-type nodeCommitter struct {
- readyNode
- index uint64
-}
-
-func newNodeCommitter() raft.Node {
- return &nodeCommitter{*newNopReadyNode(), 0}
-}
-func (n *nodeCommitter) Propose(ctx context.Context, data []byte) error {
- n.index++
- ents := []raftpb.Entry{{Index: n.index, Data: data}}
- n.readyc <- raft.Ready{
- Entries: ents,
- CommittedEntries: ents,
- }
- return nil
-}
-
-func newTestCluster(membs []*membership.Member) *membership.RaftCluster {
- c := membership.NewCluster("")
- for _, m := range membs {
- c.AddMember(m)
- }
- return c
-}
diff --git a/vendor/github.com/coreos/etcd/etcdserver/util_test.go b/vendor/github.com/coreos/etcd/etcdserver/util_test.go
deleted file mode 100644
index b1cbe236c..000000000
--- a/vendor/github.com/coreos/etcd/etcdserver/util_test.go
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package etcdserver
-
-import (
- "net/http"
- "testing"
- "time"
-
- "github.com/coreos/etcd/etcdserver/membership"
- "github.com/coreos/etcd/pkg/types"
- "github.com/coreos/etcd/raft/raftpb"
- "github.com/coreos/etcd/rafthttp"
- "github.com/coreos/etcd/snap"
-)
-
-func TestLongestConnected(t *testing.T) {
- umap, err := types.NewURLsMap("mem1=http://10.1:2379,mem2=http://10.2:2379,mem3=http://10.3:2379")
- if err != nil {
- t.Fatal(err)
- }
- clus, err := membership.NewClusterFromURLsMap("test", umap)
- if err != nil {
- t.Fatal(err)
- }
- memberIDs := clus.MemberIDs()
-
- tr := newNopTransporterWithActiveTime(memberIDs)
- transferee, ok := longestConnected(tr, memberIDs)
- if !ok {
- t.Fatalf("unexpected ok %v", ok)
- }
- if memberIDs[0] != transferee {
- t.Fatalf("expected first member %s to be transferee, got %s", memberIDs[0], transferee)
- }
-
- // make all members non-active
- amap := make(map[types.ID]time.Time)
- for _, id := range memberIDs {
- amap[id] = time.Time{}
- }
- tr.(*nopTransporterWithActiveTime).reset(amap)
-
- _, ok2 := longestConnected(tr, memberIDs)
- if ok2 {
- t.Fatalf("unexpected ok %v", ok)
- }
-}
-
-type nopTransporterWithActiveTime struct {
- activeMap map[types.ID]time.Time
-}
-
-// newNopTransporterWithActiveTime creates nopTransporterWithActiveTime with the first member
-// being the most stable (longest active-since time).
-func newNopTransporterWithActiveTime(memberIDs []types.ID) rafthttp.Transporter {
- am := make(map[types.ID]time.Time)
- for i, id := range memberIDs {
- am[id] = time.Now().Add(time.Duration(i) * time.Second)
- }
- return &nopTransporterWithActiveTime{activeMap: am}
-}
-
-func (s *nopTransporterWithActiveTime) Start() error { return nil }
-func (s *nopTransporterWithActiveTime) Handler() http.Handler { return nil }
-func (s *nopTransporterWithActiveTime) Send(m []raftpb.Message) {}
-func (s *nopTransporterWithActiveTime) SendSnapshot(m snap.Message) {}
-func (s *nopTransporterWithActiveTime) AddRemote(id types.ID, us []string) {}
-func (s *nopTransporterWithActiveTime) AddPeer(id types.ID, us []string) {}
-func (s *nopTransporterWithActiveTime) RemovePeer(id types.ID) {}
-func (s *nopTransporterWithActiveTime) RemoveAllPeers() {}
-func (s *nopTransporterWithActiveTime) UpdatePeer(id types.ID, us []string) {}
-func (s *nopTransporterWithActiveTime) ActiveSince(id types.ID) time.Time { return s.activeMap[id] }
-func (s *nopTransporterWithActiveTime) ActivePeers() int { return 0 }
-func (s *nopTransporterWithActiveTime) Stop() {}
-func (s *nopTransporterWithActiveTime) Pause() {}
-func (s *nopTransporterWithActiveTime) Resume() {}
-func (s *nopTransporterWithActiveTime) reset(am map[types.ID]time.Time) { s.activeMap = am }
diff --git a/vendor/github.com/coreos/etcd/main_test.go b/vendor/github.com/coreos/etcd/main_test.go
deleted file mode 100644
index 371ff1d0a..000000000
--- a/vendor/github.com/coreos/etcd/main_test.go
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2017 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package main
-
-import (
- "os"
- "os/signal"
- "strings"
- "syscall"
- "testing"
-)
-
-func TestMain(t *testing.T) {
- // don't launch etcd server when invoked via go test
- if strings.HasSuffix(os.Args[0], "etcd.test") {
- return
- }
-
- notifier := make(chan os.Signal, 1)
- signal.Notify(notifier, syscall.SIGINT, syscall.SIGTERM)
- go main()
- <-notifier
-}
diff --git a/vendor/github.com/coreos/etcd/mvcc/index_test.go b/vendor/github.com/coreos/etcd/mvcc/index_test.go
deleted file mode 100644
index d05315601..000000000
--- a/vendor/github.com/coreos/etcd/mvcc/index_test.go
+++ /dev/null
@@ -1,292 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package mvcc
-
-import (
- "reflect"
- "testing"
-
- "github.com/google/btree"
-)
-
-func TestIndexGet(t *testing.T) {
- ti := newTreeIndex()
- ti.Put([]byte("foo"), revision{main: 2})
- ti.Put([]byte("foo"), revision{main: 4})
- ti.Tombstone([]byte("foo"), revision{main: 6})
-
- tests := []struct {
- rev int64
-
- wrev revision
- wcreated revision
- wver int64
- werr error
- }{
- {0, revision{}, revision{}, 0, ErrRevisionNotFound},
- {1, revision{}, revision{}, 0, ErrRevisionNotFound},
- {2, revision{main: 2}, revision{main: 2}, 1, nil},
- {3, revision{main: 2}, revision{main: 2}, 1, nil},
- {4, revision{main: 4}, revision{main: 2}, 2, nil},
- {5, revision{main: 4}, revision{main: 2}, 2, nil},
- {6, revision{}, revision{}, 0, ErrRevisionNotFound},
- }
- for i, tt := range tests {
- rev, created, ver, err := ti.Get([]byte("foo"), tt.rev)
- if err != tt.werr {
- t.Errorf("#%d: err = %v, want %v", i, err, tt.werr)
- }
- if rev != tt.wrev {
- t.Errorf("#%d: rev = %+v, want %+v", i, rev, tt.wrev)
- }
- if created != tt.wcreated {
- t.Errorf("#%d: created = %+v, want %+v", i, created, tt.wcreated)
- }
- if ver != tt.wver {
- t.Errorf("#%d: ver = %d, want %d", i, ver, tt.wver)
- }
- }
-}
-
-func TestIndexRange(t *testing.T) {
- allKeys := [][]byte{[]byte("foo"), []byte("foo1"), []byte("foo2")}
- allRevs := []revision{{main: 1}, {main: 2}, {main: 3}}
-
- ti := newTreeIndex()
- for i := range allKeys {
- ti.Put(allKeys[i], allRevs[i])
- }
-
- atRev := int64(3)
- tests := []struct {
- key, end []byte
- wkeys [][]byte
- wrevs []revision
- }{
- // single key that not found
- {
- []byte("bar"), nil, nil, nil,
- },
- // single key that found
- {
- []byte("foo"), nil, allKeys[:1], allRevs[:1],
- },
- // range keys, return first member
- {
- []byte("foo"), []byte("foo1"), allKeys[:1], allRevs[:1],
- },
- // range keys, return first two members
- {
- []byte("foo"), []byte("foo2"), allKeys[:2], allRevs[:2],
- },
- // range keys, return all members
- {
- []byte("foo"), []byte("fop"), allKeys, allRevs,
- },
- // range keys, return last two members
- {
- []byte("foo1"), []byte("fop"), allKeys[1:], allRevs[1:],
- },
- // range keys, return last member
- {
- []byte("foo2"), []byte("fop"), allKeys[2:], allRevs[2:],
- },
- // range keys, return nothing
- {
- []byte("foo3"), []byte("fop"), nil, nil,
- },
- }
- for i, tt := range tests {
- keys, revs := ti.Range(tt.key, tt.end, atRev)
- if !reflect.DeepEqual(keys, tt.wkeys) {
- t.Errorf("#%d: keys = %+v, want %+v", i, keys, tt.wkeys)
- }
- if !reflect.DeepEqual(revs, tt.wrevs) {
- t.Errorf("#%d: revs = %+v, want %+v", i, revs, tt.wrevs)
- }
- }
-}
-
-func TestIndexTombstone(t *testing.T) {
- ti := newTreeIndex()
- ti.Put([]byte("foo"), revision{main: 1})
-
- err := ti.Tombstone([]byte("foo"), revision{main: 2})
- if err != nil {
- t.Errorf("tombstone error = %v, want nil", err)
- }
-
- _, _, _, err = ti.Get([]byte("foo"), 2)
- if err != ErrRevisionNotFound {
- t.Errorf("get error = %v, want nil", err)
- }
- err = ti.Tombstone([]byte("foo"), revision{main: 3})
- if err != ErrRevisionNotFound {
- t.Errorf("tombstone error = %v, want %v", err, ErrRevisionNotFound)
- }
-}
-
-func TestIndexRangeSince(t *testing.T) {
- allKeys := [][]byte{[]byte("foo"), []byte("foo1"), []byte("foo2"), []byte("foo2"), []byte("foo1"), []byte("foo")}
- allRevs := []revision{{main: 1}, {main: 2}, {main: 3}, {main: 4}, {main: 5}, {main: 6}}
-
- ti := newTreeIndex()
- for i := range allKeys {
- ti.Put(allKeys[i], allRevs[i])
- }
-
- atRev := int64(1)
- tests := []struct {
- key, end []byte
- wrevs []revision
- }{
- // single key that not found
- {
- []byte("bar"), nil, nil,
- },
- // single key that found
- {
- []byte("foo"), nil, []revision{{main: 1}, {main: 6}},
- },
- // range keys, return first member
- {
- []byte("foo"), []byte("foo1"), []revision{{main: 1}, {main: 6}},
- },
- // range keys, return first two members
- {
- []byte("foo"), []byte("foo2"), []revision{{main: 1}, {main: 2}, {main: 5}, {main: 6}},
- },
- // range keys, return all members
- {
- []byte("foo"), []byte("fop"), allRevs,
- },
- // range keys, return last two members
- {
- []byte("foo1"), []byte("fop"), []revision{{main: 2}, {main: 3}, {main: 4}, {main: 5}},
- },
- // range keys, return last member
- {
- []byte("foo2"), []byte("fop"), []revision{{main: 3}, {main: 4}},
- },
- // range keys, return nothing
- {
- []byte("foo3"), []byte("fop"), nil,
- },
- }
- for i, tt := range tests {
- revs := ti.RangeSince(tt.key, tt.end, atRev)
- if !reflect.DeepEqual(revs, tt.wrevs) {
- t.Errorf("#%d: revs = %+v, want %+v", i, revs, tt.wrevs)
- }
- }
-}
-
-func TestIndexCompactAndKeep(t *testing.T) {
- maxRev := int64(20)
- tests := []struct {
- key []byte
- remove bool
- rev revision
- created revision
- ver int64
- }{
- {[]byte("foo"), false, revision{main: 1}, revision{main: 1}, 1},
- {[]byte("foo1"), false, revision{main: 2}, revision{main: 2}, 1},
- {[]byte("foo2"), false, revision{main: 3}, revision{main: 3}, 1},
- {[]byte("foo2"), false, revision{main: 4}, revision{main: 3}, 2},
- {[]byte("foo"), false, revision{main: 5}, revision{main: 1}, 2},
- {[]byte("foo1"), false, revision{main: 6}, revision{main: 2}, 2},
- {[]byte("foo1"), true, revision{main: 7}, revision{}, 0},
- {[]byte("foo2"), true, revision{main: 8}, revision{}, 0},
- {[]byte("foo"), true, revision{main: 9}, revision{}, 0},
- {[]byte("foo"), false, revision{10, 0}, revision{10, 0}, 1},
- {[]byte("foo1"), false, revision{10, 1}, revision{10, 1}, 1},
- }
-
- // Continuous Compact and Keep
- ti := newTreeIndex()
- for _, tt := range tests {
- if tt.remove {
- ti.Tombstone(tt.key, tt.rev)
- } else {
- ti.Put(tt.key, tt.rev)
- }
- }
- for i := int64(1); i < maxRev; i++ {
- am := ti.Compact(i)
- keep := ti.Keep(i)
- if !(reflect.DeepEqual(am, keep)) {
- t.Errorf("#%d: compact keep %v != Keep keep %v", i, am, keep)
- }
- wti := &treeIndex{tree: btree.New(32)}
- for _, tt := range tests {
- if _, ok := am[tt.rev]; ok || tt.rev.GreaterThan(revision{main: i}) {
- if tt.remove {
- wti.Tombstone(tt.key, tt.rev)
- } else {
- restore(wti, tt.key, tt.created, tt.rev, tt.ver)
- }
- }
- }
- if !ti.Equal(wti) {
- t.Errorf("#%d: not equal ti", i)
- }
- }
-
- // Once Compact and Keep
- for i := int64(1); i < maxRev; i++ {
- ti := newTreeIndex()
- for _, tt := range tests {
- if tt.remove {
- ti.Tombstone(tt.key, tt.rev)
- } else {
- ti.Put(tt.key, tt.rev)
- }
- }
- am := ti.Compact(i)
- keep := ti.Keep(i)
- if !(reflect.DeepEqual(am, keep)) {
- t.Errorf("#%d: compact keep %v != Keep keep %v", i, am, keep)
- }
- wti := &treeIndex{tree: btree.New(32)}
- for _, tt := range tests {
- if _, ok := am[tt.rev]; ok || tt.rev.GreaterThan(revision{main: i}) {
- if tt.remove {
- wti.Tombstone(tt.key, tt.rev)
- } else {
- restore(wti, tt.key, tt.created, tt.rev, tt.ver)
- }
- }
- }
- if !ti.Equal(wti) {
- t.Errorf("#%d: not equal ti", i)
- }
- }
-}
-
-func restore(ti *treeIndex, key []byte, created, modified revision, ver int64) {
- keyi := &keyIndex{key: key}
-
- ti.Lock()
- defer ti.Unlock()
- item := ti.tree.Get(keyi)
- if item == nil {
- keyi.restore(created, modified, ver)
- ti.tree.ReplaceOrInsert(keyi)
- return
- }
- okeyi := item.(*keyIndex)
- okeyi.put(modified.main, modified.sub)
-}
diff --git a/vendor/github.com/coreos/etcd/mvcc/key_index_test.go b/vendor/github.com/coreos/etcd/mvcc/key_index_test.go
deleted file mode 100644
index 57e6a9cd7..000000000
--- a/vendor/github.com/coreos/etcd/mvcc/key_index_test.go
+++ /dev/null
@@ -1,698 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package mvcc
-
-import (
- "reflect"
- "testing"
-)
-
-func TestKeyIndexGet(t *testing.T) {
- // key: "foo"
- // rev: 16
- // generations:
- // {empty}
- // {{14, 0}[1], {14, 1}[2], {16, 0}(t)[3]}
- // {{8, 0}[1], {10, 0}[2], {12, 0}(t)[3]}
- // {{2, 0}[1], {4, 0}[2], {6, 0}(t)[3]}
- ki := newTestKeyIndex()
- ki.compact(4, make(map[revision]struct{}))
-
- tests := []struct {
- rev int64
-
- wmod revision
- wcreat revision
- wver int64
- werr error
- }{
- {17, revision{}, revision{}, 0, ErrRevisionNotFound},
- {16, revision{}, revision{}, 0, ErrRevisionNotFound},
-
- // get on generation 3
- {15, revision{14, 1}, revision{14, 0}, 2, nil},
- {14, revision{14, 1}, revision{14, 0}, 2, nil},
-
- {13, revision{}, revision{}, 0, ErrRevisionNotFound},
- {12, revision{}, revision{}, 0, ErrRevisionNotFound},
-
- // get on generation 2
- {11, revision{10, 0}, revision{8, 0}, 2, nil},
- {10, revision{10, 0}, revision{8, 0}, 2, nil},
- {9, revision{8, 0}, revision{8, 0}, 1, nil},
- {8, revision{8, 0}, revision{8, 0}, 1, nil},
-
- {7, revision{}, revision{}, 0, ErrRevisionNotFound},
- {6, revision{}, revision{}, 0, ErrRevisionNotFound},
-
- // get on generation 1
- {5, revision{4, 0}, revision{2, 0}, 2, nil},
- {4, revision{4, 0}, revision{2, 0}, 2, nil},
-
- {3, revision{}, revision{}, 0, ErrRevisionNotFound},
- {2, revision{}, revision{}, 0, ErrRevisionNotFound},
- {1, revision{}, revision{}, 0, ErrRevisionNotFound},
- {0, revision{}, revision{}, 0, ErrRevisionNotFound},
- }
-
- for i, tt := range tests {
- mod, creat, ver, err := ki.get(tt.rev)
- if err != tt.werr {
- t.Errorf("#%d: err = %v, want %v", i, err, tt.werr)
- }
- if mod != tt.wmod {
- t.Errorf("#%d: modified = %+v, want %+v", i, mod, tt.wmod)
- }
- if creat != tt.wcreat {
- t.Errorf("#%d: created = %+v, want %+v", i, creat, tt.wcreat)
- }
- if ver != tt.wver {
- t.Errorf("#%d: version = %d, want %d", i, ver, tt.wver)
- }
- }
-}
-
-func TestKeyIndexSince(t *testing.T) {
- ki := newTestKeyIndex()
- ki.compact(4, make(map[revision]struct{}))
-
- allRevs := []revision{{4, 0}, {6, 0}, {8, 0}, {10, 0}, {12, 0}, {14, 1}, {16, 0}}
- tests := []struct {
- rev int64
-
- wrevs []revision
- }{
- {17, nil},
- {16, allRevs[6:]},
- {15, allRevs[6:]},
- {14, allRevs[5:]},
- {13, allRevs[5:]},
- {12, allRevs[4:]},
- {11, allRevs[4:]},
- {10, allRevs[3:]},
- {9, allRevs[3:]},
- {8, allRevs[2:]},
- {7, allRevs[2:]},
- {6, allRevs[1:]},
- {5, allRevs[1:]},
- {4, allRevs},
- {3, allRevs},
- {2, allRevs},
- {1, allRevs},
- {0, allRevs},
- }
-
- for i, tt := range tests {
- revs := ki.since(tt.rev)
- if !reflect.DeepEqual(revs, tt.wrevs) {
- t.Errorf("#%d: revs = %+v, want %+v", i, revs, tt.wrevs)
- }
- }
-}
-
-func TestKeyIndexPut(t *testing.T) {
- ki := &keyIndex{key: []byte("foo")}
- ki.put(5, 0)
-
- wki := &keyIndex{
- key: []byte("foo"),
- modified: revision{5, 0},
- generations: []generation{{created: revision{5, 0}, ver: 1, revs: []revision{{main: 5}}}},
- }
- if !reflect.DeepEqual(ki, wki) {
- t.Errorf("ki = %+v, want %+v", ki, wki)
- }
-
- ki.put(7, 0)
-
- wki = &keyIndex{
- key: []byte("foo"),
- modified: revision{7, 0},
- generations: []generation{{created: revision{5, 0}, ver: 2, revs: []revision{{main: 5}, {main: 7}}}},
- }
- if !reflect.DeepEqual(ki, wki) {
- t.Errorf("ki = %+v, want %+v", ki, wki)
- }
-}
-
-func TestKeyIndexRestore(t *testing.T) {
- ki := &keyIndex{key: []byte("foo")}
- ki.restore(revision{5, 0}, revision{7, 0}, 2)
-
- wki := &keyIndex{
- key: []byte("foo"),
- modified: revision{7, 0},
- generations: []generation{{created: revision{5, 0}, ver: 2, revs: []revision{{main: 7}}}},
- }
- if !reflect.DeepEqual(ki, wki) {
- t.Errorf("ki = %+v, want %+v", ki, wki)
- }
-}
-
-func TestKeyIndexTombstone(t *testing.T) {
- ki := &keyIndex{key: []byte("foo")}
- ki.put(5, 0)
-
- err := ki.tombstone(7, 0)
- if err != nil {
- t.Errorf("unexpected tombstone error: %v", err)
- }
-
- wki := &keyIndex{
- key: []byte("foo"),
- modified: revision{7, 0},
- generations: []generation{{created: revision{5, 0}, ver: 2, revs: []revision{{main: 5}, {main: 7}}}, {}},
- }
- if !reflect.DeepEqual(ki, wki) {
- t.Errorf("ki = %+v, want %+v", ki, wki)
- }
-
- ki.put(8, 0)
- ki.put(9, 0)
- err = ki.tombstone(15, 0)
- if err != nil {
- t.Errorf("unexpected tombstone error: %v", err)
- }
-
- wki = &keyIndex{
- key: []byte("foo"),
- modified: revision{15, 0},
- generations: []generation{
- {created: revision{5, 0}, ver: 2, revs: []revision{{main: 5}, {main: 7}}},
- {created: revision{8, 0}, ver: 3, revs: []revision{{main: 8}, {main: 9}, {main: 15}}},
- {},
- },
- }
- if !reflect.DeepEqual(ki, wki) {
- t.Errorf("ki = %+v, want %+v", ki, wki)
- }
-
- err = ki.tombstone(16, 0)
- if err != ErrRevisionNotFound {
- t.Errorf("tombstone error = %v, want %v", err, ErrRevisionNotFound)
- }
-}
-
-func TestKeyIndexCompactAndKeep(t *testing.T) {
- tests := []struct {
- compact int64
-
- wki *keyIndex
- wam map[revision]struct{}
- }{
- {
- 1,
- &keyIndex{
- key: []byte("foo"),
- modified: revision{16, 0},
- generations: []generation{
- {created: revision{2, 0}, ver: 3, revs: []revision{{main: 2}, {main: 4}, {main: 6}}},
- {created: revision{8, 0}, ver: 3, revs: []revision{{main: 8}, {main: 10}, {main: 12}}},
- {created: revision{14, 0}, ver: 3, revs: []revision{{main: 14}, {main: 14, sub: 1}, {main: 16}}},
- {},
- },
- },
- map[revision]struct{}{},
- },
- {
- 2,
- &keyIndex{
- key: []byte("foo"),
- modified: revision{16, 0},
- generations: []generation{
- {created: revision{2, 0}, ver: 3, revs: []revision{{main: 2}, {main: 4}, {main: 6}}},
- {created: revision{8, 0}, ver: 3, revs: []revision{{main: 8}, {main: 10}, {main: 12}}},
- {created: revision{14, 0}, ver: 3, revs: []revision{{main: 14}, {main: 14, sub: 1}, {main: 16}}},
- {},
- },
- },
- map[revision]struct{}{
- {main: 2}: {},
- },
- },
- {
- 3,
- &keyIndex{
- key: []byte("foo"),
- modified: revision{16, 0},
- generations: []generation{
- {created: revision{2, 0}, ver: 3, revs: []revision{{main: 2}, {main: 4}, {main: 6}}},
- {created: revision{8, 0}, ver: 3, revs: []revision{{main: 8}, {main: 10}, {main: 12}}},
- {created: revision{14, 0}, ver: 3, revs: []revision{{main: 14}, {main: 14, sub: 1}, {main: 16}}},
- {},
- },
- },
- map[revision]struct{}{
- {main: 2}: {},
- },
- },
- {
- 4,
- &keyIndex{
- key: []byte("foo"),
- modified: revision{16, 0},
- generations: []generation{
- {created: revision{2, 0}, ver: 3, revs: []revision{{main: 4}, {main: 6}}},
- {created: revision{8, 0}, ver: 3, revs: []revision{{main: 8}, {main: 10}, {main: 12}}},
- {created: revision{14, 0}, ver: 3, revs: []revision{{main: 14}, {main: 14, sub: 1}, {main: 16}}},
- {},
- },
- },
- map[revision]struct{}{
- {main: 4}: {},
- },
- },
- {
- 5,
- &keyIndex{
- key: []byte("foo"),
- modified: revision{16, 0},
- generations: []generation{
- {created: revision{2, 0}, ver: 3, revs: []revision{{main: 4}, {main: 6}}},
- {created: revision{8, 0}, ver: 3, revs: []revision{{main: 8}, {main: 10}, {main: 12}}},
- {created: revision{14, 0}, ver: 3, revs: []revision{{main: 14}, {main: 14, sub: 1}, {main: 16}}},
- {},
- },
- },
- map[revision]struct{}{
- {main: 4}: {},
- },
- },
- {
- 6,
- &keyIndex{
- key: []byte("foo"),
- modified: revision{16, 0},
- generations: []generation{
- {created: revision{8, 0}, ver: 3, revs: []revision{{main: 8}, {main: 10}, {main: 12}}},
- {created: revision{14, 0}, ver: 3, revs: []revision{{main: 14}, {main: 14, sub: 1}, {main: 16}}},
- {},
- },
- },
- map[revision]struct{}{},
- },
- {
- 7,
- &keyIndex{
- key: []byte("foo"),
- modified: revision{16, 0},
- generations: []generation{
- {created: revision{8, 0}, ver: 3, revs: []revision{{main: 8}, {main: 10}, {main: 12}}},
- {created: revision{14, 0}, ver: 3, revs: []revision{{main: 14}, {main: 14, sub: 1}, {main: 16}}},
- {},
- },
- },
- map[revision]struct{}{},
- },
- {
- 8,
- &keyIndex{
- key: []byte("foo"),
- modified: revision{16, 0},
- generations: []generation{
- {created: revision{8, 0}, ver: 3, revs: []revision{{main: 8}, {main: 10}, {main: 12}}},
- {created: revision{14, 0}, ver: 3, revs: []revision{{main: 14}, {main: 14, sub: 1}, {main: 16}}},
- {},
- },
- },
- map[revision]struct{}{
- {main: 8}: {},
- },
- },
- {
- 9,
- &keyIndex{
- key: []byte("foo"),
- modified: revision{16, 0},
- generations: []generation{
- {created: revision{8, 0}, ver: 3, revs: []revision{{main: 8}, {main: 10}, {main: 12}}},
- {created: revision{14, 0}, ver: 3, revs: []revision{{main: 14}, {main: 14, sub: 1}, {main: 16}}},
- {},
- },
- },
- map[revision]struct{}{
- {main: 8}: {},
- },
- },
- {
- 10,
- &keyIndex{
- key: []byte("foo"),
- modified: revision{16, 0},
- generations: []generation{
- {created: revision{8, 0}, ver: 3, revs: []revision{{main: 10}, {main: 12}}},
- {created: revision{14, 0}, ver: 3, revs: []revision{{main: 14}, {main: 14, sub: 1}, {main: 16}}},
- {},
- },
- },
- map[revision]struct{}{
- {main: 10}: {},
- },
- },
- {
- 11,
- &keyIndex{
- key: []byte("foo"),
- modified: revision{16, 0},
- generations: []generation{
- {created: revision{8, 0}, ver: 3, revs: []revision{{main: 10}, {main: 12}}},
- {created: revision{14, 0}, ver: 3, revs: []revision{{main: 14}, {main: 14, sub: 1}, {main: 16}}},
- {},
- },
- },
- map[revision]struct{}{
- {main: 10}: {},
- },
- },
- {
- 12,
- &keyIndex{
- key: []byte("foo"),
- modified: revision{16, 0},
- generations: []generation{
- {created: revision{14, 0}, ver: 3, revs: []revision{{main: 14}, {main: 14, sub: 1}, {main: 16}}},
- {},
- },
- },
- map[revision]struct{}{},
- },
- {
- 13,
- &keyIndex{
- key: []byte("foo"),
- modified: revision{16, 0},
- generations: []generation{
- {created: revision{14, 0}, ver: 3, revs: []revision{{main: 14}, {main: 14, sub: 1}, {main: 16}}},
- {},
- },
- },
- map[revision]struct{}{},
- },
- {
- 14,
- &keyIndex{
- key: []byte("foo"),
- modified: revision{16, 0},
- generations: []generation{
- {created: revision{14, 0}, ver: 3, revs: []revision{{main: 14, sub: 1}, {main: 16}}},
- {},
- },
- },
- map[revision]struct{}{
- {main: 14, sub: 1}: {},
- },
- },
- {
- 15,
- &keyIndex{
- key: []byte("foo"),
- modified: revision{16, 0},
- generations: []generation{
- {created: revision{14, 0}, ver: 3, revs: []revision{{main: 14, sub: 1}, {main: 16}}},
- {},
- },
- },
- map[revision]struct{}{
- {main: 14, sub: 1}: {},
- },
- },
- {
- 16,
- &keyIndex{
- key: []byte("foo"),
- modified: revision{16, 0},
- generations: []generation{
- {},
- },
- },
- map[revision]struct{}{},
- },
- }
-
- // Continuous Compaction and finding Keep
- ki := newTestKeyIndex()
- for i, tt := range tests {
- am := make(map[revision]struct{})
- kiclone := cloneKeyIndex(ki)
- ki.keep(tt.compact, am)
- if !reflect.DeepEqual(ki, kiclone) {
- t.Errorf("#%d: ki = %+v, want %+v", i, ki, kiclone)
- }
- if !reflect.DeepEqual(am, tt.wam) {
- t.Errorf("#%d: am = %+v, want %+v", i, am, tt.wam)
- }
- am = make(map[revision]struct{})
- ki.compact(tt.compact, am)
- if !reflect.DeepEqual(ki, tt.wki) {
- t.Errorf("#%d: ki = %+v, want %+v", i, ki, tt.wki)
- }
- if !reflect.DeepEqual(am, tt.wam) {
- t.Errorf("#%d: am = %+v, want %+v", i, am, tt.wam)
- }
- }
-
- // Jump Compaction and finding Keep
- ki = newTestKeyIndex()
- for i, tt := range tests {
- if (i%2 == 0 && i < 6) || (i%2 == 1 && i > 6) {
- am := make(map[revision]struct{})
- kiclone := cloneKeyIndex(ki)
- ki.keep(tt.compact, am)
- if !reflect.DeepEqual(ki, kiclone) {
- t.Errorf("#%d: ki = %+v, want %+v", i, ki, kiclone)
- }
- if !reflect.DeepEqual(am, tt.wam) {
- t.Errorf("#%d: am = %+v, want %+v", i, am, tt.wam)
- }
- am = make(map[revision]struct{})
- ki.compact(tt.compact, am)
- if !reflect.DeepEqual(ki, tt.wki) {
- t.Errorf("#%d: ki = %+v, want %+v", i, ki, tt.wki)
- }
- if !reflect.DeepEqual(am, tt.wam) {
- t.Errorf("#%d: am = %+v, want %+v", i, am, tt.wam)
- }
- }
- }
-
- kiClone := newTestKeyIndex()
- // Once Compaction and finding Keep
- for i, tt := range tests {
- ki := newTestKeyIndex()
- am := make(map[revision]struct{})
- ki.keep(tt.compact, am)
- if !reflect.DeepEqual(ki, kiClone) {
- t.Errorf("#%d: ki = %+v, want %+v", i, ki, kiClone)
- }
- if !reflect.DeepEqual(am, tt.wam) {
- t.Errorf("#%d: am = %+v, want %+v", i, am, tt.wam)
- }
- am = make(map[revision]struct{})
- ki.compact(tt.compact, am)
- if !reflect.DeepEqual(ki, tt.wki) {
- t.Errorf("#%d: ki = %+v, want %+v", i, ki, tt.wki)
- }
- if !reflect.DeepEqual(am, tt.wam) {
- t.Errorf("#%d: am = %+v, want %+v", i, am, tt.wam)
- }
- }
-}
-
-func cloneKeyIndex(ki *keyIndex) *keyIndex {
- generations := make([]generation, len(ki.generations))
- for i, gen := range ki.generations {
- generations[i] = *cloneGeneration(&gen)
- }
- return &keyIndex{ki.key, ki.modified, generations}
-}
-
-func cloneGeneration(g *generation) *generation {
- if g.revs == nil {
- return &generation{g.ver, g.created, nil}
- }
- tmp := make([]revision, len(g.revs))
- copy(tmp, g.revs)
- return &generation{g.ver, g.created, tmp}
-}
-
-// test that compact on version that higher than last modified version works well
-func TestKeyIndexCompactOnFurtherRev(t *testing.T) {
- ki := &keyIndex{key: []byte("foo")}
- ki.put(1, 0)
- ki.put(2, 0)
- am := make(map[revision]struct{})
- ki.compact(3, am)
-
- wki := &keyIndex{
- key: []byte("foo"),
- modified: revision{2, 0},
- generations: []generation{
- {created: revision{1, 0}, ver: 2, revs: []revision{{main: 2}}},
- },
- }
- wam := map[revision]struct{}{
- {main: 2}: {},
- }
- if !reflect.DeepEqual(ki, wki) {
- t.Errorf("ki = %+v, want %+v", ki, wki)
- }
- if !reflect.DeepEqual(am, wam) {
- t.Errorf("am = %+v, want %+v", am, wam)
- }
-}
-
-func TestKeyIndexIsEmpty(t *testing.T) {
- tests := []struct {
- ki *keyIndex
- w bool
- }{
- {
- &keyIndex{
- key: []byte("foo"),
- generations: []generation{{}},
- },
- true,
- },
- {
- &keyIndex{
- key: []byte("foo"),
- modified: revision{2, 0},
- generations: []generation{
- {created: revision{1, 0}, ver: 2, revs: []revision{{main: 2}}},
- },
- },
- false,
- },
- }
- for i, tt := range tests {
- g := tt.ki.isEmpty()
- if g != tt.w {
- t.Errorf("#%d: isEmpty = %v, want %v", i, g, tt.w)
- }
- }
-}
-
-func TestKeyIndexFindGeneration(t *testing.T) {
- ki := newTestKeyIndex()
-
- tests := []struct {
- rev int64
- wg *generation
- }{
- {0, nil},
- {1, nil},
- {2, &ki.generations[0]},
- {3, &ki.generations[0]},
- {4, &ki.generations[0]},
- {5, &ki.generations[0]},
- {6, nil},
- {7, nil},
- {8, &ki.generations[1]},
- {9, &ki.generations[1]},
- {10, &ki.generations[1]},
- {11, &ki.generations[1]},
- {12, nil},
- {13, nil},
- }
- for i, tt := range tests {
- g := ki.findGeneration(tt.rev)
- if g != tt.wg {
- t.Errorf("#%d: generation = %+v, want %+v", i, g, tt.wg)
- }
- }
-}
-
-func TestKeyIndexLess(t *testing.T) {
- ki := &keyIndex{key: []byte("foo")}
-
- tests := []struct {
- ki *keyIndex
- w bool
- }{
- {&keyIndex{key: []byte("doo")}, false},
- {&keyIndex{key: []byte("foo")}, false},
- {&keyIndex{key: []byte("goo")}, true},
- }
- for i, tt := range tests {
- g := ki.Less(tt.ki)
- if g != tt.w {
- t.Errorf("#%d: Less = %v, want %v", i, g, tt.w)
- }
- }
-}
-
-func TestGenerationIsEmpty(t *testing.T) {
- tests := []struct {
- g *generation
- w bool
- }{
- {nil, true},
- {&generation{}, true},
- {&generation{revs: []revision{{main: 1}}}, false},
- }
- for i, tt := range tests {
- g := tt.g.isEmpty()
- if g != tt.w {
- t.Errorf("#%d: isEmpty = %v, want %v", i, g, tt.w)
- }
- }
-}
-
-func TestGenerationWalk(t *testing.T) {
- g := &generation{
- ver: 3,
- created: revision{2, 0},
- revs: []revision{{main: 2}, {main: 4}, {main: 6}},
- }
- tests := []struct {
- f func(rev revision) bool
- wi int
- }{
- {func(rev revision) bool { return rev.main >= 7 }, 2},
- {func(rev revision) bool { return rev.main >= 6 }, 1},
- {func(rev revision) bool { return rev.main >= 5 }, 1},
- {func(rev revision) bool { return rev.main >= 4 }, 0},
- {func(rev revision) bool { return rev.main >= 3 }, 0},
- {func(rev revision) bool { return rev.main >= 2 }, -1},
- }
- for i, tt := range tests {
- idx := g.walk(tt.f)
- if idx != tt.wi {
- t.Errorf("#%d: index = %d, want %d", i, idx, tt.wi)
- }
- }
-}
-
-func newTestKeyIndex() *keyIndex {
- // key: "foo"
- // rev: 16
- // generations:
- // {empty}
- // {{14, 0}[1], {14, 1}[2], {16, 0}(t)[3]}
- // {{8, 0}[1], {10, 0}[2], {12, 0}(t)[3]}
- // {{2, 0}[1], {4, 0}[2], {6, 0}(t)[3]}
-
- ki := &keyIndex{key: []byte("foo")}
- ki.put(2, 0)
- ki.put(4, 0)
- ki.tombstone(6, 0)
- ki.put(8, 0)
- ki.put(10, 0)
- ki.tombstone(12, 0)
- ki.put(14, 0)
- ki.put(14, 1)
- ki.tombstone(16, 0)
- return ki
-}
diff --git a/vendor/github.com/coreos/etcd/mvcc/kv_test.go b/vendor/github.com/coreos/etcd/mvcc/kv_test.go
deleted file mode 100644
index d6f49ee14..000000000
--- a/vendor/github.com/coreos/etcd/mvcc/kv_test.go
+++ /dev/null
@@ -1,831 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package mvcc
-
-import (
- "fmt"
- "os"
- "reflect"
- "testing"
- "time"
-
- "github.com/coreos/etcd/lease"
- "github.com/coreos/etcd/mvcc/backend"
- "github.com/coreos/etcd/mvcc/mvccpb"
- "github.com/coreos/etcd/pkg/testutil"
-
- "github.com/prometheus/client_golang/prometheus"
- dto "github.com/prometheus/client_model/go"
-)
-
-// Functional tests for features implemented in v3 store. It treats v3 store
-// as a black box, and tests it by feeding the input and validating the output.
-
-// TODO: add similar tests on operations in one txn/rev
-
-type (
- rangeFunc func(kv KV, key, end []byte, ro RangeOptions) (*RangeResult, error)
- putFunc func(kv KV, key, value []byte, lease lease.LeaseID) int64
- deleteRangeFunc func(kv KV, key, end []byte) (n, rev int64)
-)
-
-var (
- normalRangeFunc = func(kv KV, key, end []byte, ro RangeOptions) (*RangeResult, error) {
- return kv.Range(key, end, ro)
- }
- txnRangeFunc = func(kv KV, key, end []byte, ro RangeOptions) (*RangeResult, error) {
- txn := kv.Read()
- defer txn.End()
- return txn.Range(key, end, ro)
- }
-
- normalPutFunc = func(kv KV, key, value []byte, lease lease.LeaseID) int64 {
- return kv.Put(key, value, lease)
- }
- txnPutFunc = func(kv KV, key, value []byte, lease lease.LeaseID) int64 {
- txn := kv.Write()
- defer txn.End()
- return txn.Put(key, value, lease)
- }
-
- normalDeleteRangeFunc = func(kv KV, key, end []byte) (n, rev int64) {
- return kv.DeleteRange(key, end)
- }
- txnDeleteRangeFunc = func(kv KV, key, end []byte) (n, rev int64) {
- txn := kv.Write()
- defer txn.End()
- return txn.DeleteRange(key, end)
- }
-)
-
-func TestKVRange(t *testing.T) { testKVRange(t, normalRangeFunc) }
-func TestKVTxnRange(t *testing.T) { testKVRange(t, txnRangeFunc) }
-
-func testKVRange(t *testing.T, f rangeFunc) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(b, &lease.FakeLessor{}, nil)
- defer cleanup(s, b, tmpPath)
-
- kvs := put3TestKVs(s)
-
- wrev := int64(4)
- tests := []struct {
- key, end []byte
- wkvs []mvccpb.KeyValue
- }{
- // get no keys
- {
- []byte("doo"), []byte("foo"),
- nil,
- },
- // get no keys when key == end
- {
- []byte("foo"), []byte("foo"),
- nil,
- },
- // get no keys when ranging single key
- {
- []byte("doo"), nil,
- nil,
- },
- // get all keys
- {
- []byte("foo"), []byte("foo3"),
- kvs,
- },
- // get partial keys
- {
- []byte("foo"), []byte("foo1"),
- kvs[:1],
- },
- // get single key
- {
- []byte("foo"), nil,
- kvs[:1],
- },
- // get entire keyspace
- {
- []byte(""), []byte(""),
- kvs,
- },
- }
-
- for i, tt := range tests {
- r, err := f(s, tt.key, tt.end, RangeOptions{})
- if err != nil {
- t.Fatal(err)
- }
- if r.Rev != wrev {
- t.Errorf("#%d: rev = %d, want %d", i, r.Rev, wrev)
- }
- if !reflect.DeepEqual(r.KVs, tt.wkvs) {
- t.Errorf("#%d: kvs = %+v, want %+v", i, r.KVs, tt.wkvs)
- }
- }
-}
-
-func TestKVRangeRev(t *testing.T) { testKVRangeRev(t, normalRangeFunc) }
-func TestKVTxnRangeRev(t *testing.T) { testKVRangeRev(t, txnRangeFunc) }
-
-func testKVRangeRev(t *testing.T, f rangeFunc) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(b, &lease.FakeLessor{}, nil)
- defer cleanup(s, b, tmpPath)
-
- kvs := put3TestKVs(s)
-
- tests := []struct {
- rev int64
- wrev int64
- wkvs []mvccpb.KeyValue
- }{
- {-1, 4, kvs},
- {0, 4, kvs},
- {2, 4, kvs[:1]},
- {3, 4, kvs[:2]},
- {4, 4, kvs},
- }
-
- for i, tt := range tests {
- r, err := f(s, []byte("foo"), []byte("foo3"), RangeOptions{Rev: tt.rev})
- if err != nil {
- t.Fatal(err)
- }
- if r.Rev != tt.wrev {
- t.Errorf("#%d: rev = %d, want %d", i, r.Rev, tt.wrev)
- }
- if !reflect.DeepEqual(r.KVs, tt.wkvs) {
- t.Errorf("#%d: kvs = %+v, want %+v", i, r.KVs, tt.wkvs)
- }
- }
-}
-
-func TestKVRangeBadRev(t *testing.T) { testKVRangeBadRev(t, normalRangeFunc) }
-func TestKVTxnRangeBadRev(t *testing.T) { testKVRangeBadRev(t, txnRangeFunc) }
-
-func testKVRangeBadRev(t *testing.T, f rangeFunc) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(b, &lease.FakeLessor{}, nil)
- defer cleanup(s, b, tmpPath)
-
- put3TestKVs(s)
- if _, err := s.Compact(4); err != nil {
- t.Fatalf("compact error (%v)", err)
- }
-
- tests := []struct {
- rev int64
- werr error
- }{
- {-1, nil}, // <= 0 is most recent store
- {0, nil},
- {1, ErrCompacted},
- {2, ErrCompacted},
- {4, nil},
- {5, ErrFutureRev},
- {100, ErrFutureRev},
- }
- for i, tt := range tests {
- _, err := f(s, []byte("foo"), []byte("foo3"), RangeOptions{Rev: tt.rev})
- if err != tt.werr {
- t.Errorf("#%d: error = %v, want %v", i, err, tt.werr)
- }
- }
-}
-
-func TestKVRangeLimit(t *testing.T) { testKVRangeLimit(t, normalRangeFunc) }
-func TestKVTxnRangeLimit(t *testing.T) { testKVRangeLimit(t, txnRangeFunc) }
-
-func testKVRangeLimit(t *testing.T, f rangeFunc) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(b, &lease.FakeLessor{}, nil)
- defer cleanup(s, b, tmpPath)
-
- kvs := put3TestKVs(s)
-
- wrev := int64(4)
- tests := []struct {
- limit int64
- wkvs []mvccpb.KeyValue
- }{
- // no limit
- {-1, kvs},
- // no limit
- {0, kvs},
- {1, kvs[:1]},
- {2, kvs[:2]},
- {3, kvs},
- {100, kvs},
- }
- for i, tt := range tests {
- r, err := f(s, []byte("foo"), []byte("foo3"), RangeOptions{Limit: tt.limit})
- if err != nil {
- t.Fatalf("#%d: range error (%v)", i, err)
- }
- if !reflect.DeepEqual(r.KVs, tt.wkvs) {
- t.Errorf("#%d: kvs = %+v, want %+v", i, r.KVs, tt.wkvs)
- }
- if r.Rev != wrev {
- t.Errorf("#%d: rev = %d, want %d", i, r.Rev, wrev)
- }
- if r.Count != len(kvs) {
- t.Errorf("#%d: count = %d, want %d", i, r.Count, len(kvs))
- }
- }
-}
-
-func TestKVPutMultipleTimes(t *testing.T) { testKVPutMultipleTimes(t, normalPutFunc) }
-func TestKVTxnPutMultipleTimes(t *testing.T) { testKVPutMultipleTimes(t, txnPutFunc) }
-
-func testKVPutMultipleTimes(t *testing.T, f putFunc) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(b, &lease.FakeLessor{}, nil)
- defer cleanup(s, b, tmpPath)
-
- for i := 0; i < 10; i++ {
- base := int64(i + 1)
-
- rev := f(s, []byte("foo"), []byte("bar"), lease.LeaseID(base))
- if rev != base+1 {
- t.Errorf("#%d: rev = %d, want %d", i, rev, base+1)
- }
-
- r, err := s.Range([]byte("foo"), nil, RangeOptions{})
- if err != nil {
- t.Fatal(err)
- }
- wkvs := []mvccpb.KeyValue{
- {Key: []byte("foo"), Value: []byte("bar"), CreateRevision: 2, ModRevision: base + 1, Version: base, Lease: base},
- }
- if !reflect.DeepEqual(r.KVs, wkvs) {
- t.Errorf("#%d: kvs = %+v, want %+v", i, r.KVs, wkvs)
- }
- }
-}
-
-func TestKVDeleteRange(t *testing.T) { testKVDeleteRange(t, normalDeleteRangeFunc) }
-func TestKVTxnDeleteRange(t *testing.T) { testKVDeleteRange(t, txnDeleteRangeFunc) }
-
-func testKVDeleteRange(t *testing.T, f deleteRangeFunc) {
- tests := []struct {
- key, end []byte
-
- wrev int64
- wN int64
- }{
- {
- []byte("foo"), nil,
- 5, 1,
- },
- {
- []byte("foo"), []byte("foo1"),
- 5, 1,
- },
- {
- []byte("foo"), []byte("foo2"),
- 5, 2,
- },
- {
- []byte("foo"), []byte("foo3"),
- 5, 3,
- },
- {
- []byte("foo3"), []byte("foo8"),
- 4, 0,
- },
- {
- []byte("foo3"), nil,
- 4, 0,
- },
- }
-
- for i, tt := range tests {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(b, &lease.FakeLessor{}, nil)
-
- s.Put([]byte("foo"), []byte("bar"), lease.NoLease)
- s.Put([]byte("foo1"), []byte("bar1"), lease.NoLease)
- s.Put([]byte("foo2"), []byte("bar2"), lease.NoLease)
-
- n, rev := f(s, tt.key, tt.end)
- if n != tt.wN || rev != tt.wrev {
- t.Errorf("#%d: n = %d, rev = %d, want (%d, %d)", i, n, rev, tt.wN, tt.wrev)
- }
-
- cleanup(s, b, tmpPath)
- }
-}
-
-func TestKVDeleteMultipleTimes(t *testing.T) { testKVDeleteMultipleTimes(t, normalDeleteRangeFunc) }
-func TestKVTxnDeleteMultipleTimes(t *testing.T) { testKVDeleteMultipleTimes(t, txnDeleteRangeFunc) }
-
-func testKVDeleteMultipleTimes(t *testing.T, f deleteRangeFunc) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(b, &lease.FakeLessor{}, nil)
- defer cleanup(s, b, tmpPath)
-
- s.Put([]byte("foo"), []byte("bar"), lease.NoLease)
-
- n, rev := f(s, []byte("foo"), nil)
- if n != 1 || rev != 3 {
- t.Fatalf("n = %d, rev = %d, want (%d, %d)", n, rev, 1, 3)
- }
-
- for i := 0; i < 10; i++ {
- n, rev := f(s, []byte("foo"), nil)
- if n != 0 || rev != 3 {
- t.Fatalf("#%d: n = %d, rev = %d, want (%d, %d)", i, n, rev, 0, 3)
- }
- }
-}
-
-// test that range, put, delete on single key in sequence repeatedly works correctly.
-func TestKVOperationInSequence(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(b, &lease.FakeLessor{}, nil)
- defer cleanup(s, b, tmpPath)
-
- for i := 0; i < 10; i++ {
- base := int64(i*2 + 1)
-
- // put foo
- rev := s.Put([]byte("foo"), []byte("bar"), lease.NoLease)
- if rev != base+1 {
- t.Errorf("#%d: put rev = %d, want %d", i, rev, base+1)
- }
-
- r, err := s.Range([]byte("foo"), nil, RangeOptions{Rev: base + 1})
- if err != nil {
- t.Fatal(err)
- }
- wkvs := []mvccpb.KeyValue{
- {Key: []byte("foo"), Value: []byte("bar"), CreateRevision: base + 1, ModRevision: base + 1, Version: 1, Lease: int64(lease.NoLease)},
- }
- if !reflect.DeepEqual(r.KVs, wkvs) {
- t.Errorf("#%d: kvs = %+v, want %+v", i, r.KVs, wkvs)
- }
- if r.Rev != base+1 {
- t.Errorf("#%d: range rev = %d, want %d", i, rev, base+1)
- }
-
- // delete foo
- n, rev := s.DeleteRange([]byte("foo"), nil)
- if n != 1 || rev != base+2 {
- t.Errorf("#%d: n = %d, rev = %d, want (%d, %d)", i, n, rev, 1, base+2)
- }
-
- r, err = s.Range([]byte("foo"), nil, RangeOptions{Rev: base + 2})
- if err != nil {
- t.Fatal(err)
- }
- if r.KVs != nil {
- t.Errorf("#%d: kvs = %+v, want %+v", i, r.KVs, nil)
- }
- if r.Rev != base+2 {
- t.Errorf("#%d: range rev = %d, want %d", i, r.Rev, base+2)
- }
- }
-}
-
-func TestKVTxnBlockWriteOperations(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(b, &lease.FakeLessor{}, nil)
-
- tests := []func(){
- func() { s.Put([]byte("foo"), nil, lease.NoLease) },
- func() { s.DeleteRange([]byte("foo"), nil) },
- }
- for i, tt := range tests {
- txn := s.Write()
- done := make(chan struct{}, 1)
- go func() {
- tt()
- done <- struct{}{}
- }()
- select {
- case <-done:
- t.Fatalf("#%d: operation failed to be blocked", i)
- case <-time.After(10 * time.Millisecond):
- }
-
- txn.End()
- select {
- case <-done:
- case <-time.After(10 * time.Second):
- testutil.FatalStack(t, fmt.Sprintf("#%d: operation failed to be unblocked", i))
- }
- }
-
- // only close backend when we know all the tx are finished
- cleanup(s, b, tmpPath)
-}
-
-func TestKVTxnNonBlockRange(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(b, &lease.FakeLessor{}, nil)
- defer cleanup(s, b, tmpPath)
-
- txn := s.Write()
- defer txn.End()
-
- donec := make(chan struct{})
- go func() {
- defer close(donec)
- s.Range([]byte("foo"), nil, RangeOptions{})
- }()
- select {
- case <-donec:
- case <-time.After(100 * time.Millisecond):
- t.Fatalf("range operation blocked on write txn")
- }
-}
-
-// test that txn range, put, delete on single key in sequence repeatedly works correctly.
-func TestKVTxnOperationInSequence(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(b, &lease.FakeLessor{}, nil)
- defer cleanup(s, b, tmpPath)
-
- for i := 0; i < 10; i++ {
- txn := s.Write()
- base := int64(i + 1)
-
- // put foo
- rev := txn.Put([]byte("foo"), []byte("bar"), lease.NoLease)
- if rev != base+1 {
- t.Errorf("#%d: put rev = %d, want %d", i, rev, base+1)
- }
-
- r, err := txn.Range([]byte("foo"), nil, RangeOptions{Rev: base + 1})
- if err != nil {
- t.Fatal(err)
- }
- wkvs := []mvccpb.KeyValue{
- {Key: []byte("foo"), Value: []byte("bar"), CreateRevision: base + 1, ModRevision: base + 1, Version: 1, Lease: int64(lease.NoLease)},
- }
- if !reflect.DeepEqual(r.KVs, wkvs) {
- t.Errorf("#%d: kvs = %+v, want %+v", i, r.KVs, wkvs)
- }
- if r.Rev != base+1 {
- t.Errorf("#%d: range rev = %d, want %d", i, r.Rev, base+1)
- }
-
- // delete foo
- n, rev := txn.DeleteRange([]byte("foo"), nil)
- if n != 1 || rev != base+1 {
- t.Errorf("#%d: n = %d, rev = %d, want (%d, %d)", i, n, rev, 1, base+1)
- }
-
- r, err = txn.Range([]byte("foo"), nil, RangeOptions{Rev: base + 1})
- if err != nil {
- t.Errorf("#%d: range error (%v)", i, err)
- }
- if r.KVs != nil {
- t.Errorf("#%d: kvs = %+v, want %+v", i, r.KVs, nil)
- }
- if r.Rev != base+1 {
- t.Errorf("#%d: range rev = %d, want %d", i, r.Rev, base+1)
- }
-
- txn.End()
- }
-}
-
-func TestKVCompactReserveLastValue(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(b, &lease.FakeLessor{}, nil)
- defer cleanup(s, b, tmpPath)
-
- s.Put([]byte("foo"), []byte("bar0"), 1)
- s.Put([]byte("foo"), []byte("bar1"), 2)
- s.DeleteRange([]byte("foo"), nil)
- s.Put([]byte("foo"), []byte("bar2"), 3)
-
- // rev in tests will be called in Compact() one by one on the same store
- tests := []struct {
- rev int64
- // wanted kvs right after the compacted rev
- wkvs []mvccpb.KeyValue
- }{
- {
- 1,
- []mvccpb.KeyValue{
- {Key: []byte("foo"), Value: []byte("bar0"), CreateRevision: 2, ModRevision: 2, Version: 1, Lease: 1},
- },
- },
- {
- 2,
- []mvccpb.KeyValue{
- {Key: []byte("foo"), Value: []byte("bar1"), CreateRevision: 2, ModRevision: 3, Version: 2, Lease: 2},
- },
- },
- {
- 3,
- nil,
- },
- {
- 4,
- []mvccpb.KeyValue{
- {Key: []byte("foo"), Value: []byte("bar2"), CreateRevision: 5, ModRevision: 5, Version: 1, Lease: 3},
- },
- },
- }
- for i, tt := range tests {
- _, err := s.Compact(tt.rev)
- if err != nil {
- t.Errorf("#%d: unexpect compact error %v", i, err)
- }
- r, err := s.Range([]byte("foo"), nil, RangeOptions{Rev: tt.rev + 1})
- if err != nil {
- t.Errorf("#%d: unexpect range error %v", i, err)
- }
- if !reflect.DeepEqual(r.KVs, tt.wkvs) {
- t.Errorf("#%d: kvs = %+v, want %+v", i, r.KVs, tt.wkvs)
- }
- }
-}
-
-func TestKVCompactBad(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(b, &lease.FakeLessor{}, nil)
- defer cleanup(s, b, tmpPath)
-
- s.Put([]byte("foo"), []byte("bar0"), lease.NoLease)
- s.Put([]byte("foo"), []byte("bar1"), lease.NoLease)
- s.Put([]byte("foo"), []byte("bar2"), lease.NoLease)
-
- // rev in tests will be called in Compact() one by one on the same store
- tests := []struct {
- rev int64
- werr error
- }{
- {0, nil},
- {1, nil},
- {1, ErrCompacted},
- {4, nil},
- {5, ErrFutureRev},
- {100, ErrFutureRev},
- }
- for i, tt := range tests {
- _, err := s.Compact(tt.rev)
- if err != tt.werr {
- t.Errorf("#%d: compact error = %v, want %v", i, err, tt.werr)
- }
- }
-}
-
-func TestKVHash(t *testing.T) {
- hashes := make([]uint32, 3)
-
- for i := 0; i < len(hashes); i++ {
- var err error
- b, tmpPath := backend.NewDefaultTmpBackend()
- kv := NewStore(b, &lease.FakeLessor{}, nil)
- kv.Put([]byte("foo0"), []byte("bar0"), lease.NoLease)
- kv.Put([]byte("foo1"), []byte("bar0"), lease.NoLease)
- hashes[i], _, err = kv.Hash()
- if err != nil {
- t.Fatalf("failed to get hash: %v", err)
- }
- cleanup(kv, b, tmpPath)
- }
-
- for i := 1; i < len(hashes); i++ {
- if hashes[i-1] != hashes[i] {
- t.Errorf("hash[%d](%d) != hash[%d](%d)", i-1, hashes[i-1], i, hashes[i])
- }
- }
-}
-
-func TestKVRestore(t *testing.T) {
- tests := []func(kv KV){
- func(kv KV) {
- kv.Put([]byte("foo"), []byte("bar0"), 1)
- kv.Put([]byte("foo"), []byte("bar1"), 2)
- kv.Put([]byte("foo"), []byte("bar2"), 3)
- kv.Put([]byte("foo2"), []byte("bar0"), 1)
- },
- func(kv KV) {
- kv.Put([]byte("foo"), []byte("bar0"), 1)
- kv.DeleteRange([]byte("foo"), nil)
- kv.Put([]byte("foo"), []byte("bar1"), 2)
- },
- func(kv KV) {
- kv.Put([]byte("foo"), []byte("bar0"), 1)
- kv.Put([]byte("foo"), []byte("bar1"), 2)
- kv.Compact(1)
- },
- }
- for i, tt := range tests {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(b, &lease.FakeLessor{}, nil)
- tt(s)
- var kvss [][]mvccpb.KeyValue
- for k := int64(0); k < 10; k++ {
- r, _ := s.Range([]byte("a"), []byte("z"), RangeOptions{Rev: k})
- kvss = append(kvss, r.KVs)
- }
-
- keysBefore := readGaugeInt(&keysGauge)
- s.Close()
-
- // ns should recover the the previous state from backend.
- ns := NewStore(b, &lease.FakeLessor{}, nil)
-
- if keysRestore := readGaugeInt(&keysGauge); keysBefore != keysRestore {
- t.Errorf("#%d: got %d key count, expected %d", i, keysRestore, keysBefore)
- }
-
- // wait for possible compaction to finish
- testutil.WaitSchedule()
- var nkvss [][]mvccpb.KeyValue
- for k := int64(0); k < 10; k++ {
- r, _ := ns.Range([]byte("a"), []byte("z"), RangeOptions{Rev: k})
- nkvss = append(nkvss, r.KVs)
- }
- cleanup(ns, b, tmpPath)
-
- if !reflect.DeepEqual(nkvss, kvss) {
- t.Errorf("#%d: kvs history = %+v, want %+v", i, nkvss, kvss)
- }
- }
-}
-
-func readGaugeInt(g *prometheus.Gauge) int {
- ch := make(chan prometheus.Metric, 1)
- keysGauge.Collect(ch)
- m := <-ch
- mm := &dto.Metric{}
- m.Write(mm)
- return int(mm.GetGauge().GetValue())
-}
-
-func TestKVSnapshot(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(b, &lease.FakeLessor{}, nil)
- defer cleanup(s, b, tmpPath)
-
- wkvs := put3TestKVs(s)
-
- newPath := "new_test"
- f, err := os.Create(newPath)
- if err != nil {
- t.Fatal(err)
- }
- defer os.Remove(newPath)
-
- snap := s.b.Snapshot()
- defer snap.Close()
- _, err = snap.WriteTo(f)
- if err != nil {
- t.Fatal(err)
- }
- f.Close()
-
- ns := NewStore(b, &lease.FakeLessor{}, nil)
- defer ns.Close()
- r, err := ns.Range([]byte("a"), []byte("z"), RangeOptions{})
- if err != nil {
- t.Errorf("unexpect range error (%v)", err)
- }
- if !reflect.DeepEqual(r.KVs, wkvs) {
- t.Errorf("kvs = %+v, want %+v", r.KVs, wkvs)
- }
- if r.Rev != 4 {
- t.Errorf("rev = %d, want %d", r.Rev, 4)
- }
-}
-
-func TestWatchableKVWatch(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := WatchableKV(newWatchableStore(b, &lease.FakeLessor{}, nil))
- defer cleanup(s, b, tmpPath)
-
- w := s.NewWatchStream()
- defer w.Close()
-
- wid := w.Watch([]byte("foo"), []byte("fop"), 0)
-
- wev := []mvccpb.Event{
- {Type: mvccpb.PUT,
- Kv: &mvccpb.KeyValue{
- Key: []byte("foo"),
- Value: []byte("bar"),
- CreateRevision: 2,
- ModRevision: 2,
- Version: 1,
- Lease: 1,
- },
- },
- {
- Type: mvccpb.PUT,
- Kv: &mvccpb.KeyValue{
- Key: []byte("foo1"),
- Value: []byte("bar1"),
- CreateRevision: 3,
- ModRevision: 3,
- Version: 1,
- Lease: 2,
- },
- },
- {
- Type: mvccpb.PUT,
- Kv: &mvccpb.KeyValue{
- Key: []byte("foo1"),
- Value: []byte("bar11"),
- CreateRevision: 3,
- ModRevision: 4,
- Version: 2,
- Lease: 3,
- },
- },
- }
-
- s.Put([]byte("foo"), []byte("bar"), 1)
- select {
- case resp := <-w.Chan():
- if resp.WatchID != wid {
- t.Errorf("resp.WatchID got = %d, want = %d", resp.WatchID, wid)
- }
- ev := resp.Events[0]
- if !reflect.DeepEqual(ev, wev[0]) {
- t.Errorf("watched event = %+v, want %+v", ev, wev[0])
- }
- case <-time.After(5 * time.Second):
- // CPU might be too slow, and the routine is not able to switch around
- testutil.FatalStack(t, "failed to watch the event")
- }
-
- s.Put([]byte("foo1"), []byte("bar1"), 2)
- select {
- case resp := <-w.Chan():
- if resp.WatchID != wid {
- t.Errorf("resp.WatchID got = %d, want = %d", resp.WatchID, wid)
- }
- ev := resp.Events[0]
- if !reflect.DeepEqual(ev, wev[1]) {
- t.Errorf("watched event = %+v, want %+v", ev, wev[1])
- }
- case <-time.After(5 * time.Second):
- testutil.FatalStack(t, "failed to watch the event")
- }
-
- w = s.NewWatchStream()
- wid = w.Watch([]byte("foo1"), []byte("foo2"), 3)
-
- select {
- case resp := <-w.Chan():
- if resp.WatchID != wid {
- t.Errorf("resp.WatchID got = %d, want = %d", resp.WatchID, wid)
- }
- ev := resp.Events[0]
- if !reflect.DeepEqual(ev, wev[1]) {
- t.Errorf("watched event = %+v, want %+v", ev, wev[1])
- }
- case <-time.After(5 * time.Second):
- testutil.FatalStack(t, "failed to watch the event")
- }
-
- s.Put([]byte("foo1"), []byte("bar11"), 3)
- select {
- case resp := <-w.Chan():
- if resp.WatchID != wid {
- t.Errorf("resp.WatchID got = %d, want = %d", resp.WatchID, wid)
- }
- ev := resp.Events[0]
- if !reflect.DeepEqual(ev, wev[2]) {
- t.Errorf("watched event = %+v, want %+v", ev, wev[2])
- }
- case <-time.After(5 * time.Second):
- testutil.FatalStack(t, "failed to watch the event")
- }
-}
-
-func cleanup(s KV, b backend.Backend, path string) {
- s.Close()
- b.Close()
- os.Remove(path)
-}
-
-func put3TestKVs(s KV) []mvccpb.KeyValue {
- s.Put([]byte("foo"), []byte("bar"), 1)
- s.Put([]byte("foo1"), []byte("bar1"), 2)
- s.Put([]byte("foo2"), []byte("bar2"), 3)
- return []mvccpb.KeyValue{
- {Key: []byte("foo"), Value: []byte("bar"), CreateRevision: 2, ModRevision: 2, Version: 1, Lease: 1},
- {Key: []byte("foo1"), Value: []byte("bar1"), CreateRevision: 3, ModRevision: 3, Version: 1, Lease: 2},
- {Key: []byte("foo2"), Value: []byte("bar2"), CreateRevision: 4, ModRevision: 4, Version: 1, Lease: 3},
- }
-}
diff --git a/vendor/github.com/coreos/etcd/mvcc/kvstore_bench_test.go b/vendor/github.com/coreos/etcd/mvcc/kvstore_bench_test.go
deleted file mode 100644
index a64a3c5a5..000000000
--- a/vendor/github.com/coreos/etcd/mvcc/kvstore_bench_test.go
+++ /dev/null
@@ -1,174 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package mvcc
-
-import (
- "sync/atomic"
- "testing"
-
- "github.com/coreos/etcd/lease"
- "github.com/coreos/etcd/mvcc/backend"
-)
-
-type fakeConsistentIndex uint64
-
-func (i *fakeConsistentIndex) ConsistentIndex() uint64 {
- return atomic.LoadUint64((*uint64)(i))
-}
-
-func BenchmarkStorePut(b *testing.B) {
- var i fakeConsistentIndex
- be, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(be, &lease.FakeLessor{}, &i)
- defer cleanup(s, be, tmpPath)
-
- // arbitrary number of bytes
- bytesN := 64
- keys := createBytesSlice(bytesN, b.N)
- vals := createBytesSlice(bytesN, b.N)
-
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- s.Put(keys[i], vals[i], lease.NoLease)
- }
-}
-
-func BenchmarkStoreRangeKey1(b *testing.B) { benchmarkStoreRange(b, 1) }
-func BenchmarkStoreRangeKey100(b *testing.B) { benchmarkStoreRange(b, 100) }
-
-func benchmarkStoreRange(b *testing.B, n int) {
- var i fakeConsistentIndex
- be, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(be, &lease.FakeLessor{}, &i)
- defer cleanup(s, be, tmpPath)
-
- // 64 byte key/val
- keys, val := createBytesSlice(64, n), createBytesSlice(64, 1)
- for i := range keys {
- s.Put(keys[i], val[0], lease.NoLease)
- }
- // Force into boltdb tx instead of backend read tx.
- s.Commit()
-
- var begin, end []byte
- if n == 1 {
- begin, end = keys[0], nil
- } else {
- begin, end = []byte{}, []byte{}
- }
-
- b.ReportAllocs()
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- s.Range(begin, end, RangeOptions{})
- }
-}
-
-func BenchmarkConsistentIndex(b *testing.B) {
- fci := fakeConsistentIndex(10)
- be, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(be, &lease.FakeLessor{}, &fci)
- defer cleanup(s, be, tmpPath)
-
- tx := s.b.BatchTx()
- tx.Lock()
- s.saveIndex(tx)
- tx.Unlock()
-
- b.ReportAllocs()
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- s.ConsistentIndex()
- }
-}
-
-// BenchmarkStoreTxnPutUpdate is same as above, but instead updates single key
-func BenchmarkStorePutUpdate(b *testing.B) {
- var i fakeConsistentIndex
- be, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(be, &lease.FakeLessor{}, &i)
- defer cleanup(s, be, tmpPath)
-
- // arbitrary number of bytes
- keys := createBytesSlice(64, 1)
- vals := createBytesSlice(1024, 1)
-
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- s.Put(keys[0], vals[0], lease.NoLease)
- }
-}
-
-// BenchmarkStoreTxnPut benchmarks the Put operation
-// with transaction begin and end, where transaction involves
-// some synchronization operations, such as mutex locking.
-func BenchmarkStoreTxnPut(b *testing.B) {
- var i fakeConsistentIndex
- be, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(be, &lease.FakeLessor{}, &i)
- defer cleanup(s, be, tmpPath)
-
- // arbitrary number of bytes
- bytesN := 64
- keys := createBytesSlice(bytesN, b.N)
- vals := createBytesSlice(bytesN, b.N)
-
- b.ResetTimer()
- b.ReportAllocs()
- for i := 0; i < b.N; i++ {
- txn := s.Write()
- txn.Put(keys[i], vals[i], lease.NoLease)
- txn.End()
- }
-}
-
-// benchmarkStoreRestore benchmarks the restore operation
-func benchmarkStoreRestore(revsPerKey int, b *testing.B) {
- var i fakeConsistentIndex
- be, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(be, &lease.FakeLessor{}, &i)
- // use closure to capture 's' to pick up the reassignment
- defer func() { cleanup(s, be, tmpPath) }()
-
- // arbitrary number of bytes
- bytesN := 64
- keys := createBytesSlice(bytesN, b.N)
- vals := createBytesSlice(bytesN, b.N)
-
- for i := 0; i < b.N; i++ {
- for j := 0; j < revsPerKey; j++ {
- txn := s.Write()
- txn.Put(keys[i], vals[i], lease.NoLease)
- txn.End()
- }
- }
- s.Close()
-
- b.ReportAllocs()
- b.ResetTimer()
- s = NewStore(be, &lease.FakeLessor{}, &i)
-}
-
-func BenchmarkStoreRestoreRevs1(b *testing.B) {
- benchmarkStoreRestore(1, b)
-}
-
-func BenchmarkStoreRestoreRevs10(b *testing.B) {
- benchmarkStoreRestore(10, b)
-}
-
-func BenchmarkStoreRestoreRevs20(b *testing.B) {
- benchmarkStoreRestore(20, b)
-}
diff --git a/vendor/github.com/coreos/etcd/mvcc/kvstore_compaction_test.go b/vendor/github.com/coreos/etcd/mvcc/kvstore_compaction_test.go
deleted file mode 100644
index b2ee570f9..000000000
--- a/vendor/github.com/coreos/etcd/mvcc/kvstore_compaction_test.go
+++ /dev/null
@@ -1,135 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package mvcc
-
-import (
- "os"
- "reflect"
- "testing"
- "time"
-
- "github.com/coreos/etcd/lease"
- "github.com/coreos/etcd/mvcc/backend"
-)
-
-func TestScheduleCompaction(t *testing.T) {
- revs := []revision{{1, 0}, {2, 0}, {3, 0}}
-
- tests := []struct {
- rev int64
- keep map[revision]struct{}
- wrevs []revision
- }{
- // compact at 1 and discard all history
- {
- 1,
- nil,
- revs[1:],
- },
- // compact at 3 and discard all history
- {
- 3,
- nil,
- nil,
- },
- // compact at 1 and keeps history one step earlier
- {
- 1,
- map[revision]struct{}{
- {main: 1}: {},
- },
- revs,
- },
- // compact at 1 and keeps history two steps earlier
- {
- 3,
- map[revision]struct{}{
- {main: 2}: {},
- {main: 3}: {},
- },
- revs[1:],
- },
- }
- for i, tt := range tests {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(b, &lease.FakeLessor{}, nil)
- tx := s.b.BatchTx()
-
- tx.Lock()
- ibytes := newRevBytes()
- for _, rev := range revs {
- revToBytes(rev, ibytes)
- tx.UnsafePut(keyBucketName, ibytes, []byte("bar"))
- }
- tx.Unlock()
-
- s.scheduleCompaction(tt.rev, tt.keep)
-
- tx.Lock()
- for _, rev := range tt.wrevs {
- revToBytes(rev, ibytes)
- keys, _ := tx.UnsafeRange(keyBucketName, ibytes, nil, 0)
- if len(keys) != 1 {
- t.Errorf("#%d: range on %v = %d, want 1", i, rev, len(keys))
- }
- }
- _, vals := tx.UnsafeRange(metaBucketName, finishedCompactKeyName, nil, 0)
- revToBytes(revision{main: tt.rev}, ibytes)
- if w := [][]byte{ibytes}; !reflect.DeepEqual(vals, w) {
- t.Errorf("#%d: vals on %v = %+v, want %+v", i, finishedCompactKeyName, vals, w)
- }
- tx.Unlock()
-
- cleanup(s, b, tmpPath)
- }
-}
-
-func TestCompactAllAndRestore(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s0 := NewStore(b, &lease.FakeLessor{}, nil)
- defer os.Remove(tmpPath)
-
- s0.Put([]byte("foo"), []byte("bar"), lease.NoLease)
- s0.Put([]byte("foo"), []byte("bar1"), lease.NoLease)
- s0.Put([]byte("foo"), []byte("bar2"), lease.NoLease)
- s0.DeleteRange([]byte("foo"), nil)
-
- rev := s0.Rev()
- // compact all keys
- done, err := s0.Compact(rev)
- if err != nil {
- t.Fatal(err)
- }
-
- select {
- case <-done:
- case <-time.After(10 * time.Second):
- t.Fatal("timeout waiting for compaction to finish")
- }
-
- err = s0.Close()
- if err != nil {
- t.Fatal(err)
- }
-
- s1 := NewStore(b, &lease.FakeLessor{}, nil)
- if s1.Rev() != rev {
- t.Errorf("rev = %v, want %v", s1.Rev(), rev)
- }
- _, err = s1.Range([]byte("foo"), nil, RangeOptions{})
- if err != nil {
- t.Errorf("unexpect range error %v", err)
- }
-}
diff --git a/vendor/github.com/coreos/etcd/mvcc/kvstore_test.go b/vendor/github.com/coreos/etcd/mvcc/kvstore_test.go
deleted file mode 100644
index 6a0e1d3b1..000000000
--- a/vendor/github.com/coreos/etcd/mvcc/kvstore_test.go
+++ /dev/null
@@ -1,829 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package mvcc
-
-import (
- "crypto/rand"
- "encoding/binary"
- "fmt"
- "math"
- mrand "math/rand"
- "os"
- "reflect"
- "sync"
- "testing"
- "time"
-
- "github.com/coreos/etcd/lease"
- "github.com/coreos/etcd/mvcc/backend"
- "github.com/coreos/etcd/mvcc/mvccpb"
- "github.com/coreos/etcd/pkg/schedule"
- "github.com/coreos/etcd/pkg/testutil"
-)
-
-func TestStoreRev(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(b, &lease.FakeLessor{}, nil)
- defer s.Close()
- defer os.Remove(tmpPath)
-
- for i := 1; i <= 3; i++ {
- s.Put([]byte("foo"), []byte("bar"), lease.NoLease)
- if r := s.Rev(); r != int64(i+1) {
- t.Errorf("#%d: rev = %d, want %d", i, r, i+1)
- }
- }
-}
-
-func TestStorePut(t *testing.T) {
- kv := mvccpb.KeyValue{
- Key: []byte("foo"),
- Value: []byte("bar"),
- CreateRevision: 1,
- ModRevision: 2,
- Version: 1,
- }
- kvb, err := kv.Marshal()
- if err != nil {
- t.Fatal(err)
- }
-
- tests := []struct {
- rev revision
- r indexGetResp
- rr *rangeResp
-
- wrev revision
- wkey []byte
- wkv mvccpb.KeyValue
- wputrev revision
- }{
- {
- revision{1, 0},
- indexGetResp{revision{}, revision{}, 0, ErrRevisionNotFound},
- nil,
-
- revision{2, 0},
- newTestKeyBytes(revision{2, 0}, false),
- mvccpb.KeyValue{
- Key: []byte("foo"),
- Value: []byte("bar"),
- CreateRevision: 2,
- ModRevision: 2,
- Version: 1,
- Lease: 1,
- },
- revision{2, 0},
- },
- {
- revision{1, 1},
- indexGetResp{revision{2, 0}, revision{2, 0}, 1, nil},
- &rangeResp{[][]byte{newTestKeyBytes(revision{2, 1}, false)}, [][]byte{kvb}},
-
- revision{2, 0},
- newTestKeyBytes(revision{2, 0}, false),
- mvccpb.KeyValue{
- Key: []byte("foo"),
- Value: []byte("bar"),
- CreateRevision: 2,
- ModRevision: 2,
- Version: 2,
- Lease: 2,
- },
- revision{2, 0},
- },
- {
- revision{2, 0},
- indexGetResp{revision{2, 1}, revision{2, 0}, 2, nil},
- &rangeResp{[][]byte{newTestKeyBytes(revision{2, 1}, false)}, [][]byte{kvb}},
-
- revision{3, 0},
- newTestKeyBytes(revision{3, 0}, false),
- mvccpb.KeyValue{
- Key: []byte("foo"),
- Value: []byte("bar"),
- CreateRevision: 2,
- ModRevision: 3,
- Version: 3,
- Lease: 3,
- },
- revision{3, 0},
- },
- }
- for i, tt := range tests {
- s := newFakeStore()
- b := s.b.(*fakeBackend)
- fi := s.kvindex.(*fakeIndex)
-
- s.currentRev = tt.rev.main
- fi.indexGetRespc <- tt.r
- if tt.rr != nil {
- b.tx.rangeRespc <- *tt.rr
- }
-
- s.Put([]byte("foo"), []byte("bar"), lease.LeaseID(i+1))
-
- data, err := tt.wkv.Marshal()
- if err != nil {
- t.Errorf("#%d: marshal err = %v, want nil", i, err)
- }
-
- wact := []testutil.Action{
- {"seqput", []interface{}{keyBucketName, tt.wkey, data}},
- }
-
- if tt.rr != nil {
- wact = []testutil.Action{
- {"seqput", []interface{}{keyBucketName, tt.wkey, data}},
- }
- }
-
- if g := b.tx.Action(); !reflect.DeepEqual(g, wact) {
- t.Errorf("#%d: tx action = %+v, want %+v", i, g, wact)
- }
- wact = []testutil.Action{
- {"get", []interface{}{[]byte("foo"), tt.wputrev.main}},
- {"put", []interface{}{[]byte("foo"), tt.wputrev}},
- }
- if g := fi.Action(); !reflect.DeepEqual(g, wact) {
- t.Errorf("#%d: index action = %+v, want %+v", i, g, wact)
- }
- if s.currentRev != tt.wrev.main {
- t.Errorf("#%d: rev = %+v, want %+v", i, s.currentRev, tt.wrev)
- }
-
- s.Close()
- }
-}
-
-func TestStoreRange(t *testing.T) {
- key := newTestKeyBytes(revision{2, 0}, false)
- kv := mvccpb.KeyValue{
- Key: []byte("foo"),
- Value: []byte("bar"),
- CreateRevision: 1,
- ModRevision: 2,
- Version: 1,
- }
- kvb, err := kv.Marshal()
- if err != nil {
- t.Fatal(err)
- }
- wrev := int64(2)
-
- tests := []struct {
- idxr indexRangeResp
- r rangeResp
- }{
- {
- indexRangeResp{[][]byte{[]byte("foo")}, []revision{{2, 0}}},
- rangeResp{[][]byte{key}, [][]byte{kvb}},
- },
- {
- indexRangeResp{[][]byte{[]byte("foo"), []byte("foo1")}, []revision{{2, 0}, {3, 0}}},
- rangeResp{[][]byte{key}, [][]byte{kvb}},
- },
- }
-
- ro := RangeOptions{Limit: 1, Rev: 0, Count: false}
- for i, tt := range tests {
- s := newFakeStore()
- b := s.b.(*fakeBackend)
- fi := s.kvindex.(*fakeIndex)
-
- s.currentRev = 2
- b.tx.rangeRespc <- tt.r
- fi.indexRangeRespc <- tt.idxr
-
- ret, err := s.Range([]byte("foo"), []byte("goo"), ro)
- if err != nil {
- t.Errorf("#%d: err = %v, want nil", i, err)
- }
- if w := []mvccpb.KeyValue{kv}; !reflect.DeepEqual(ret.KVs, w) {
- t.Errorf("#%d: kvs = %+v, want %+v", i, ret.KVs, w)
- }
- if ret.Rev != wrev {
- t.Errorf("#%d: rev = %d, want %d", i, ret.Rev, wrev)
- }
-
- wstart := newRevBytes()
- revToBytes(tt.idxr.revs[0], wstart)
- wact := []testutil.Action{
- {"range", []interface{}{keyBucketName, wstart, []byte(nil), int64(0)}},
- }
- if g := b.tx.Action(); !reflect.DeepEqual(g, wact) {
- t.Errorf("#%d: tx action = %+v, want %+v", i, g, wact)
- }
- wact = []testutil.Action{
- {"range", []interface{}{[]byte("foo"), []byte("goo"), wrev}},
- }
- if g := fi.Action(); !reflect.DeepEqual(g, wact) {
- t.Errorf("#%d: index action = %+v, want %+v", i, g, wact)
- }
- if s.currentRev != 2 {
- t.Errorf("#%d: current rev = %+v, want %+v", i, s.currentRev, 2)
- }
-
- s.Close()
- }
-}
-
-func TestStoreDeleteRange(t *testing.T) {
- key := newTestKeyBytes(revision{2, 0}, false)
- kv := mvccpb.KeyValue{
- Key: []byte("foo"),
- Value: []byte("bar"),
- CreateRevision: 1,
- ModRevision: 2,
- Version: 1,
- }
- kvb, err := kv.Marshal()
- if err != nil {
- t.Fatal(err)
- }
-
- tests := []struct {
- rev revision
- r indexRangeResp
- rr rangeResp
-
- wkey []byte
- wrev revision
- wrrev int64
- wdelrev revision
- }{
- {
- revision{2, 0},
- indexRangeResp{[][]byte{[]byte("foo")}, []revision{{2, 0}}},
- rangeResp{[][]byte{key}, [][]byte{kvb}},
-
- newTestKeyBytes(revision{3, 0}, true),
- revision{3, 0},
- 2,
- revision{3, 0},
- },
- }
- for i, tt := range tests {
- s := newFakeStore()
- b := s.b.(*fakeBackend)
- fi := s.kvindex.(*fakeIndex)
-
- s.currentRev = tt.rev.main
- fi.indexRangeRespc <- tt.r
- b.tx.rangeRespc <- tt.rr
-
- n, _ := s.DeleteRange([]byte("foo"), []byte("goo"))
- if n != 1 {
- t.Errorf("#%d: n = %d, want 1", i, n)
- }
-
- data, err := (&mvccpb.KeyValue{
- Key: []byte("foo"),
- }).Marshal()
- if err != nil {
- t.Errorf("#%d: marshal err = %v, want nil", i, err)
- }
- wact := []testutil.Action{
- {"seqput", []interface{}{keyBucketName, tt.wkey, data}},
- }
- if g := b.tx.Action(); !reflect.DeepEqual(g, wact) {
- t.Errorf("#%d: tx action = %+v, want %+v", i, g, wact)
- }
- wact = []testutil.Action{
- {"range", []interface{}{[]byte("foo"), []byte("goo"), tt.wrrev}},
- {"tombstone", []interface{}{[]byte("foo"), tt.wdelrev}},
- }
- if g := fi.Action(); !reflect.DeepEqual(g, wact) {
- t.Errorf("#%d: index action = %+v, want %+v", i, g, wact)
- }
- if s.currentRev != tt.wrev.main {
- t.Errorf("#%d: rev = %+v, want %+v", i, s.currentRev, tt.wrev)
- }
- }
-}
-
-func TestStoreCompact(t *testing.T) {
- s := newFakeStore()
- defer s.Close()
- b := s.b.(*fakeBackend)
- fi := s.kvindex.(*fakeIndex)
-
- s.currentRev = 3
- fi.indexCompactRespc <- map[revision]struct{}{{1, 0}: {}}
- key1 := newTestKeyBytes(revision{1, 0}, false)
- key2 := newTestKeyBytes(revision{2, 0}, false)
- b.tx.rangeRespc <- rangeResp{[][]byte{key1, key2}, nil}
-
- s.Compact(3)
- s.fifoSched.WaitFinish(1)
-
- if s.compactMainRev != 3 {
- t.Errorf("compact main rev = %d, want 3", s.compactMainRev)
- }
- end := make([]byte, 8)
- binary.BigEndian.PutUint64(end, uint64(4))
- wact := []testutil.Action{
- {"put", []interface{}{metaBucketName, scheduledCompactKeyName, newTestRevBytes(revision{3, 0})}},
- {"range", []interface{}{keyBucketName, make([]byte, 17), end, int64(10000)}},
- {"delete", []interface{}{keyBucketName, key2}},
- {"put", []interface{}{metaBucketName, finishedCompactKeyName, newTestRevBytes(revision{3, 0})}},
- }
- if g := b.tx.Action(); !reflect.DeepEqual(g, wact) {
- t.Errorf("tx actions = %+v, want %+v", g, wact)
- }
- wact = []testutil.Action{
- {"compact", []interface{}{int64(3)}},
- }
- if g := fi.Action(); !reflect.DeepEqual(g, wact) {
- t.Errorf("index action = %+v, want %+v", g, wact)
- }
-}
-
-func TestStoreRestore(t *testing.T) {
- s := newFakeStore()
- b := s.b.(*fakeBackend)
- fi := s.kvindex.(*fakeIndex)
-
- putkey := newTestKeyBytes(revision{3, 0}, false)
- putkv := mvccpb.KeyValue{
- Key: []byte("foo"),
- Value: []byte("bar"),
- CreateRevision: 4,
- ModRevision: 4,
- Version: 1,
- }
- putkvb, err := putkv.Marshal()
- if err != nil {
- t.Fatal(err)
- }
- delkey := newTestKeyBytes(revision{5, 0}, true)
- delkv := mvccpb.KeyValue{
- Key: []byte("foo"),
- }
- delkvb, err := delkv.Marshal()
- if err != nil {
- t.Fatal(err)
- }
- b.tx.rangeRespc <- rangeResp{[][]byte{finishedCompactKeyName}, [][]byte{newTestRevBytes(revision{3, 0})}}
- b.tx.rangeRespc <- rangeResp{[][]byte{scheduledCompactKeyName}, [][]byte{newTestRevBytes(revision{3, 0})}}
-
- b.tx.rangeRespc <- rangeResp{[][]byte{putkey, delkey}, [][]byte{putkvb, delkvb}}
- b.tx.rangeRespc <- rangeResp{nil, nil}
-
- s.restore()
-
- if s.compactMainRev != 3 {
- t.Errorf("compact rev = %d, want 5", s.compactMainRev)
- }
- if s.currentRev != 5 {
- t.Errorf("current rev = %v, want 5", s.currentRev)
- }
- wact := []testutil.Action{
- {"range", []interface{}{metaBucketName, finishedCompactKeyName, []byte(nil), int64(0)}},
- {"range", []interface{}{metaBucketName, scheduledCompactKeyName, []byte(nil), int64(0)}},
- {"range", []interface{}{keyBucketName, newTestRevBytes(revision{1, 0}), newTestRevBytes(revision{math.MaxInt64, math.MaxInt64}), int64(restoreChunkKeys)}},
- }
- if g := b.tx.Action(); !reflect.DeepEqual(g, wact) {
- t.Errorf("tx actions = %+v, want %+v", g, wact)
- }
-
- gens := []generation{
- {created: revision{4, 0}, ver: 2, revs: []revision{{3, 0}, {5, 0}}},
- {created: revision{0, 0}, ver: 0, revs: nil},
- }
- ki := &keyIndex{key: []byte("foo"), modified: revision{5, 0}, generations: gens}
- wact = []testutil.Action{
- {"keyIndex", []interface{}{ki}},
- {"insert", []interface{}{ki}},
- }
- if g := fi.Action(); !reflect.DeepEqual(g, wact) {
- t.Errorf("index action = %+v, want %+v", g, wact)
- }
-}
-
-func TestRestoreDelete(t *testing.T) {
- oldChunk := restoreChunkKeys
- restoreChunkKeys = mrand.Intn(3) + 2
- defer func() { restoreChunkKeys = oldChunk }()
-
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(b, &lease.FakeLessor{}, nil)
- defer os.Remove(tmpPath)
-
- keys := make(map[string]struct{})
- for i := 0; i < 20; i++ {
- ks := fmt.Sprintf("foo-%d", i)
- k := []byte(ks)
- s.Put(k, []byte("bar"), lease.NoLease)
- keys[ks] = struct{}{}
- switch mrand.Intn(3) {
- case 0:
- // put random key from past via random range on map
- ks = fmt.Sprintf("foo-%d", mrand.Intn(i+1))
- s.Put([]byte(ks), []byte("baz"), lease.NoLease)
- keys[ks] = struct{}{}
- case 1:
- // delete random key via random range on map
- for k := range keys {
- s.DeleteRange([]byte(k), nil)
- delete(keys, k)
- break
- }
- }
- }
- s.Close()
-
- s = NewStore(b, &lease.FakeLessor{}, nil)
- defer s.Close()
- for i := 0; i < 20; i++ {
- ks := fmt.Sprintf("foo-%d", i)
- r, err := s.Range([]byte(ks), nil, RangeOptions{})
- if err != nil {
- t.Fatal(err)
- }
- if _, ok := keys[ks]; ok {
- if len(r.KVs) == 0 {
- t.Errorf("#%d: expected %q, got deleted", i, ks)
- }
- } else if len(r.KVs) != 0 {
- t.Errorf("#%d: expected deleted, got %q", i, ks)
- }
- }
-}
-
-func TestRestoreContinueUnfinishedCompaction(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s0 := NewStore(b, &lease.FakeLessor{}, nil)
- defer os.Remove(tmpPath)
-
- s0.Put([]byte("foo"), []byte("bar"), lease.NoLease)
- s0.Put([]byte("foo"), []byte("bar1"), lease.NoLease)
- s0.Put([]byte("foo"), []byte("bar2"), lease.NoLease)
-
- // write scheduled compaction, but not do compaction
- rbytes := newRevBytes()
- revToBytes(revision{main: 2}, rbytes)
- tx := s0.b.BatchTx()
- tx.Lock()
- tx.UnsafePut(metaBucketName, scheduledCompactKeyName, rbytes)
- tx.Unlock()
-
- s0.Close()
-
- s1 := NewStore(b, &lease.FakeLessor{}, nil)
-
- // wait for scheduled compaction to be finished
- time.Sleep(100 * time.Millisecond)
-
- if _, err := s1.Range([]byte("foo"), nil, RangeOptions{Rev: 1}); err != ErrCompacted {
- t.Errorf("range on compacted rev error = %v, want %v", err, ErrCompacted)
- }
- // check the key in backend is deleted
- revbytes := newRevBytes()
- revToBytes(revision{main: 1}, revbytes)
-
- // The disk compaction is done asynchronously and requires more time on slow disk.
- // try 5 times for CI with slow IO.
- for i := 0; i < 5; i++ {
- tx = s1.b.BatchTx()
- tx.Lock()
- ks, _ := tx.UnsafeRange(keyBucketName, revbytes, nil, 0)
- tx.Unlock()
- if len(ks) != 0 {
- time.Sleep(100 * time.Millisecond)
- continue
- }
- return
- }
-
- t.Errorf("key for rev %+v still exists, want deleted", bytesToRev(revbytes))
-}
-
-type hashKVResult struct {
- hash uint32
- compactRev int64
-}
-
-// TestHashKVWhenCompacting ensures that HashKV returns correct hash when compacting.
-func TestHashKVWhenCompacting(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(b, &lease.FakeLessor{}, nil)
- defer os.Remove(tmpPath)
-
- rev := 10000
- for i := 2; i <= rev; i++ {
- s.Put([]byte("foo"), []byte(fmt.Sprintf("bar%d", i)), lease.NoLease)
- }
-
- hashCompactc := make(chan hashKVResult, 1)
-
- donec := make(chan struct{})
- var wg sync.WaitGroup
- for i := 0; i < 10; i++ {
- wg.Add(1)
- go func() {
- defer wg.Done()
- for {
- hash, _, compactRev, err := s.HashByRev(int64(rev))
- if err != nil {
- t.Fatal(err)
- }
- select {
- case <-donec:
- return
- case hashCompactc <- hashKVResult{hash, compactRev}:
- }
- }
- }()
- }
-
- go func() {
- defer close(donec)
- revHash := make(map[int64]uint32)
- for round := 0; round < 1000; round++ {
- r := <-hashCompactc
- if revHash[r.compactRev] == 0 {
- revHash[r.compactRev] = r.hash
- }
- if r.hash != revHash[r.compactRev] {
- t.Fatalf("Hashes differ (current %v) != (saved %v)", r.hash, revHash[r.compactRev])
- }
- }
- }()
-
- wg.Add(1)
- go func() {
- defer wg.Done()
- for i := 100; i >= 0; i-- {
- _, err := s.Compact(int64(rev - 1 - i))
- if err != nil {
- t.Fatal(err)
- }
- time.Sleep(10 * time.Millisecond)
- }
- }()
-
- select {
- case <-donec:
- wg.Wait()
- case <-time.After(10 * time.Second):
- testutil.FatalStack(t, "timeout")
- }
-}
-
-// TestHashKVZeroRevision ensures that "HashByRev(0)" computes
-// correct hash value with latest revision.
-func TestHashKVZeroRevision(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(b, &lease.FakeLessor{}, nil)
- defer os.Remove(tmpPath)
-
- rev := 1000
- for i := 2; i <= rev; i++ {
- s.Put([]byte("foo"), []byte(fmt.Sprintf("bar%d", i)), lease.NoLease)
- }
- if _, err := s.Compact(int64(rev / 2)); err != nil {
- t.Fatal(err)
- }
-
- hash1, _, _, err := s.HashByRev(int64(rev))
- if err != nil {
- t.Fatal(err)
- }
- var hash2 uint32
- hash2, _, _, err = s.HashByRev(0)
- if err != nil {
- t.Fatal(err)
- }
- if hash1 != hash2 {
- t.Errorf("hash %d (rev %d) != hash %d (rev 0)", hash1, rev, hash2)
- }
-}
-
-func TestTxnPut(t *testing.T) {
- // assign arbitrary size
- bytesN := 30
- sliceN := 100
- keys := createBytesSlice(bytesN, sliceN)
- vals := createBytesSlice(bytesN, sliceN)
-
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(b, &lease.FakeLessor{}, nil)
- defer cleanup(s, b, tmpPath)
-
- for i := 0; i < sliceN; i++ {
- txn := s.Write()
- base := int64(i + 2)
- if rev := txn.Put(keys[i], vals[i], lease.NoLease); rev != base {
- t.Errorf("#%d: rev = %d, want %d", i, rev, base)
- }
- txn.End()
- }
-}
-
-func TestTxnBlockBackendForceCommit(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(b, &lease.FakeLessor{}, nil)
- defer os.Remove(tmpPath)
-
- txn := s.Read()
-
- done := make(chan struct{})
- go func() {
- s.b.ForceCommit()
- done <- struct{}{}
- }()
- select {
- case <-done:
- t.Fatalf("failed to block ForceCommit")
- case <-time.After(100 * time.Millisecond):
- }
-
- txn.End()
- select {
- case <-done:
- case <-time.After(5 * time.Second): // wait 5 seconds for CI with slow IO
- testutil.FatalStack(t, "failed to execute ForceCommit")
- }
-}
-
-// TODO: test attach key to lessor
-
-func newTestRevBytes(rev revision) []byte {
- bytes := newRevBytes()
- revToBytes(rev, bytes)
- return bytes
-}
-
-func newTestKeyBytes(rev revision, tombstone bool) []byte {
- bytes := newRevBytes()
- revToBytes(rev, bytes)
- if tombstone {
- bytes = appendMarkTombstone(bytes)
- }
- return bytes
-}
-
-func newFakeStore() *store {
- b := &fakeBackend{&fakeBatchTx{
- Recorder: &testutil.RecorderBuffered{},
- rangeRespc: make(chan rangeResp, 5)}}
- fi := &fakeIndex{
- Recorder: &testutil.RecorderBuffered{},
- indexGetRespc: make(chan indexGetResp, 1),
- indexRangeRespc: make(chan indexRangeResp, 1),
- indexRangeEventsRespc: make(chan indexRangeEventsResp, 1),
- indexCompactRespc: make(chan map[revision]struct{}, 1),
- }
- s := &store{
- b: b,
- le: &lease.FakeLessor{},
- kvindex: fi,
- currentRev: 0,
- compactMainRev: -1,
- fifoSched: schedule.NewFIFOScheduler(),
- stopc: make(chan struct{}),
- }
- s.ReadView, s.WriteView = &readView{s}, &writeView{s}
- return s
-}
-
-type rangeResp struct {
- keys [][]byte
- vals [][]byte
-}
-
-type fakeBatchTx struct {
- testutil.Recorder
- rangeRespc chan rangeResp
-}
-
-func (b *fakeBatchTx) Lock() {}
-func (b *fakeBatchTx) Unlock() {}
-func (b *fakeBatchTx) UnsafeCreateBucket(name []byte) {}
-func (b *fakeBatchTx) UnsafePut(bucketName []byte, key []byte, value []byte) {
- b.Recorder.Record(testutil.Action{Name: "put", Params: []interface{}{bucketName, key, value}})
-}
-func (b *fakeBatchTx) UnsafeSeqPut(bucketName []byte, key []byte, value []byte) {
- b.Recorder.Record(testutil.Action{Name: "seqput", Params: []interface{}{bucketName, key, value}})
-}
-func (b *fakeBatchTx) UnsafeRange(bucketName []byte, key, endKey []byte, limit int64) (keys [][]byte, vals [][]byte) {
- b.Recorder.Record(testutil.Action{Name: "range", Params: []interface{}{bucketName, key, endKey, limit}})
- r := <-b.rangeRespc
- return r.keys, r.vals
-}
-func (b *fakeBatchTx) UnsafeDelete(bucketName []byte, key []byte) {
- b.Recorder.Record(testutil.Action{Name: "delete", Params: []interface{}{bucketName, key}})
-}
-func (b *fakeBatchTx) UnsafeForEach(bucketName []byte, visitor func(k, v []byte) error) error {
- return nil
-}
-func (b *fakeBatchTx) Commit() {}
-func (b *fakeBatchTx) CommitAndStop() {}
-
-type fakeBackend struct {
- tx *fakeBatchTx
-}
-
-func (b *fakeBackend) BatchTx() backend.BatchTx { return b.tx }
-func (b *fakeBackend) ReadTx() backend.ReadTx { return b.tx }
-func (b *fakeBackend) Hash(ignores map[backend.IgnoreKey]struct{}) (uint32, error) { return 0, nil }
-func (b *fakeBackend) Size() int64 { return 0 }
-func (b *fakeBackend) Snapshot() backend.Snapshot { return nil }
-func (b *fakeBackend) ForceCommit() {}
-func (b *fakeBackend) Defrag() error { return nil }
-func (b *fakeBackend) Close() error { return nil }
-
-type indexGetResp struct {
- rev revision
- created revision
- ver int64
- err error
-}
-
-type indexRangeResp struct {
- keys [][]byte
- revs []revision
-}
-
-type indexRangeEventsResp struct {
- revs []revision
-}
-
-type fakeIndex struct {
- testutil.Recorder
- indexGetRespc chan indexGetResp
- indexRangeRespc chan indexRangeResp
- indexRangeEventsRespc chan indexRangeEventsResp
- indexCompactRespc chan map[revision]struct{}
-}
-
-func (i *fakeIndex) Revisions(key, end []byte, atRev int64) []revision {
- _, rev := i.Range(key, end, atRev)
- return rev
-}
-
-func (i *fakeIndex) Get(key []byte, atRev int64) (rev, created revision, ver int64, err error) {
- i.Recorder.Record(testutil.Action{Name: "get", Params: []interface{}{key, atRev}})
- r := <-i.indexGetRespc
- return r.rev, r.created, r.ver, r.err
-}
-func (i *fakeIndex) Range(key, end []byte, atRev int64) ([][]byte, []revision) {
- i.Recorder.Record(testutil.Action{Name: "range", Params: []interface{}{key, end, atRev}})
- r := <-i.indexRangeRespc
- return r.keys, r.revs
-}
-func (i *fakeIndex) Put(key []byte, rev revision) {
- i.Recorder.Record(testutil.Action{Name: "put", Params: []interface{}{key, rev}})
-}
-func (i *fakeIndex) Tombstone(key []byte, rev revision) error {
- i.Recorder.Record(testutil.Action{Name: "tombstone", Params: []interface{}{key, rev}})
- return nil
-}
-func (i *fakeIndex) RangeSince(key, end []byte, rev int64) []revision {
- i.Recorder.Record(testutil.Action{Name: "rangeEvents", Params: []interface{}{key, end, rev}})
- r := <-i.indexRangeEventsRespc
- return r.revs
-}
-func (i *fakeIndex) Compact(rev int64) map[revision]struct{} {
- i.Recorder.Record(testutil.Action{Name: "compact", Params: []interface{}{rev}})
- return <-i.indexCompactRespc
-}
-func (i *fakeIndex) Keep(rev int64) map[revision]struct{} {
- i.Recorder.Record(testutil.Action{Name: "keep", Params: []interface{}{rev}})
- return <-i.indexCompactRespc
-}
-func (i *fakeIndex) Equal(b index) bool { return false }
-
-func (i *fakeIndex) Insert(ki *keyIndex) {
- i.Recorder.Record(testutil.Action{Name: "insert", Params: []interface{}{ki}})
-}
-
-func (i *fakeIndex) KeyIndex(ki *keyIndex) *keyIndex {
- i.Recorder.Record(testutil.Action{Name: "keyIndex", Params: []interface{}{ki}})
- return nil
-}
-
-func createBytesSlice(bytesN, sliceN int) [][]byte {
- rs := [][]byte{}
- for len(rs) != sliceN {
- v := make([]byte, bytesN)
- if _, err := rand.Read(v); err != nil {
- panic(err)
- }
- rs = append(rs, v)
- }
- return rs
-}
diff --git a/vendor/github.com/coreos/etcd/mvcc/revision_test.go b/vendor/github.com/coreos/etcd/mvcc/revision_test.go
deleted file mode 100644
index 46fcb483c..000000000
--- a/vendor/github.com/coreos/etcd/mvcc/revision_test.go
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package mvcc
-
-import (
- "bytes"
- "math"
- "reflect"
- "testing"
-)
-
-// TestRevision tests that revision could be encoded to and decoded from
-// bytes slice. Moreover, the lexicographical order of its byte slice representation
-// follows the order of (main, sub).
-func TestRevision(t *testing.T) {
- tests := []revision{
- // order in (main, sub)
- {},
- {main: 1, sub: 0},
- {main: 1, sub: 1},
- {main: 2, sub: 0},
- {main: math.MaxInt64, sub: math.MaxInt64},
- }
-
- bs := make([][]byte, len(tests))
- for i, tt := range tests {
- b := newRevBytes()
- revToBytes(tt, b)
- bs[i] = b
-
- if grev := bytesToRev(b); !reflect.DeepEqual(grev, tt) {
- t.Errorf("#%d: revision = %+v, want %+v", i, grev, tt)
- }
- }
-
- for i := 0; i < len(tests)-1; i++ {
- if bytes.Compare(bs[i], bs[i+1]) >= 0 {
- t.Errorf("#%d: %v (%+v) should be smaller than %v (%+v)", i, bs[i], tests[i], bs[i+1], tests[i+1])
- }
- }
-}
diff --git a/vendor/github.com/coreos/etcd/mvcc/watchable_store_bench_test.go b/vendor/github.com/coreos/etcd/mvcc/watchable_store_bench_test.go
deleted file mode 100644
index 769d1bc38..000000000
--- a/vendor/github.com/coreos/etcd/mvcc/watchable_store_bench_test.go
+++ /dev/null
@@ -1,200 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package mvcc
-
-import (
- "math/rand"
- "os"
- "testing"
-
- "github.com/coreos/etcd/lease"
- "github.com/coreos/etcd/mvcc/backend"
-)
-
-func BenchmarkWatchableStorePut(b *testing.B) {
- be, tmpPath := backend.NewDefaultTmpBackend()
- s := New(be, &lease.FakeLessor{}, nil)
- defer cleanup(s, be, tmpPath)
-
- // arbitrary number of bytes
- bytesN := 64
- keys := createBytesSlice(bytesN, b.N)
- vals := createBytesSlice(bytesN, b.N)
-
- b.ResetTimer()
- b.ReportAllocs()
- for i := 0; i < b.N; i++ {
- s.Put(keys[i], vals[i], lease.NoLease)
- }
-}
-
-// BenchmarkWatchableStoreTxnPut benchmarks the Put operation
-// with transaction begin and end, where transaction involves
-// some synchronization operations, such as mutex locking.
-func BenchmarkWatchableStoreTxnPut(b *testing.B) {
- var i fakeConsistentIndex
- be, tmpPath := backend.NewDefaultTmpBackend()
- s := New(be, &lease.FakeLessor{}, &i)
- defer cleanup(s, be, tmpPath)
-
- // arbitrary number of bytes
- bytesN := 64
- keys := createBytesSlice(bytesN, b.N)
- vals := createBytesSlice(bytesN, b.N)
-
- b.ResetTimer()
- b.ReportAllocs()
- for i := 0; i < b.N; i++ {
- txn := s.Write()
- txn.Put(keys[i], vals[i], lease.NoLease)
- txn.End()
- }
-}
-
-// BenchmarkWatchableStoreWatchSyncPut benchmarks the case of
-// many synced watchers receiving a Put notification.
-func BenchmarkWatchableStoreWatchSyncPut(b *testing.B) {
- be, tmpPath := backend.NewDefaultTmpBackend()
- s := newWatchableStore(be, &lease.FakeLessor{}, nil)
- defer cleanup(s, be, tmpPath)
-
- k := []byte("testkey")
- v := []byte("testval")
-
- w := s.NewWatchStream()
- defer w.Close()
- watchIDs := make([]WatchID, b.N)
- for i := range watchIDs {
- // non-0 value to keep watchers in unsynced
- watchIDs[i] = w.Watch(k, nil, 1)
- }
-
- b.ResetTimer()
- b.ReportAllocs()
-
- // trigger watchers
- s.Put(k, v, lease.NoLease)
- for range watchIDs {
- <-w.Chan()
- }
- select {
- case wc := <-w.Chan():
- b.Fatalf("unexpected data %v", wc)
- default:
- }
-}
-
-// Benchmarks on cancel function performance for unsynced watchers
-// in a WatchableStore. It creates k*N watchers to populate unsynced
-// with a reasonably large number of watchers. And measures the time it
-// takes to cancel N watchers out of k*N watchers. The performance is
-// expected to differ depending on the unsynced member implementation.
-// TODO: k is an arbitrary constant. We need to figure out what factor
-// we should put to simulate the real-world use cases.
-func BenchmarkWatchableStoreUnsyncedCancel(b *testing.B) {
- be, tmpPath := backend.NewDefaultTmpBackend()
- s := NewStore(be, &lease.FakeLessor{}, nil)
-
- // manually create watchableStore instead of newWatchableStore
- // because newWatchableStore periodically calls syncWatchersLoop
- // method to sync watchers in unsynced map. We want to keep watchers
- // in unsynced for this benchmark.
- ws := &watchableStore{
- store: s,
- unsynced: newWatcherGroup(),
-
- // to make the test not crash from assigning to nil map.
- // 'synced' doesn't get populated in this test.
- synced: newWatcherGroup(),
- }
-
- defer func() {
- ws.store.Close()
- os.Remove(tmpPath)
- }()
-
- // Put a key so that we can spawn watchers on that key
- // (testKey in this test). This increases the rev to 1,
- // and later we can we set the watcher's startRev to 1,
- // and force watchers to be in unsynced.
- testKey := []byte("foo")
- testValue := []byte("bar")
- s.Put(testKey, testValue, lease.NoLease)
-
- w := ws.NewWatchStream()
-
- const k int = 2
- benchSampleN := b.N
- watcherN := k * benchSampleN
-
- watchIDs := make([]WatchID, watcherN)
- for i := 0; i < watcherN; i++ {
- // non-0 value to keep watchers in unsynced
- watchIDs[i] = w.Watch(testKey, nil, 1)
- }
-
- // random-cancel N watchers to make it not biased towards
- // data structures with an order, such as slice.
- ix := rand.Perm(watcherN)
-
- b.ResetTimer()
- b.ReportAllocs()
-
- // cancel N watchers
- for _, idx := range ix[:benchSampleN] {
- if err := w.Cancel(watchIDs[idx]); err != nil {
- b.Error(err)
- }
- }
-}
-
-func BenchmarkWatchableStoreSyncedCancel(b *testing.B) {
- be, tmpPath := backend.NewDefaultTmpBackend()
- s := newWatchableStore(be, &lease.FakeLessor{}, nil)
-
- defer func() {
- s.store.Close()
- os.Remove(tmpPath)
- }()
-
- // Put a key so that we can spawn watchers on that key
- testKey := []byte("foo")
- testValue := []byte("bar")
- s.Put(testKey, testValue, lease.NoLease)
-
- w := s.NewWatchStream()
-
- // put 1 million watchers on the same key
- const watcherN = 1000000
-
- watchIDs := make([]WatchID, watcherN)
- for i := 0; i < watcherN; i++ {
- // 0 for startRev to keep watchers in synced
- watchIDs[i] = w.Watch(testKey, nil, 0)
- }
-
- // randomly cancel watchers to make it not biased towards
- // data structures with an order, such as slice.
- ix := rand.Perm(watcherN)
-
- b.ResetTimer()
- b.ReportAllocs()
-
- for _, idx := range ix {
- if err := w.Cancel(watchIDs[idx]); err != nil {
- b.Error(err)
- }
- }
-}
diff --git a/vendor/github.com/coreos/etcd/mvcc/watchable_store_test.go b/vendor/github.com/coreos/etcd/mvcc/watchable_store_test.go
deleted file mode 100644
index dc96d5336..000000000
--- a/vendor/github.com/coreos/etcd/mvcc/watchable_store_test.go
+++ /dev/null
@@ -1,652 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package mvcc
-
-import (
- "bytes"
- "fmt"
- "os"
- "reflect"
- "sync"
- "testing"
- "time"
-
- "github.com/coreos/etcd/lease"
- "github.com/coreos/etcd/mvcc/backend"
- "github.com/coreos/etcd/mvcc/mvccpb"
-)
-
-func TestWatch(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := newWatchableStore(b, &lease.FakeLessor{}, nil)
-
- defer func() {
- s.store.Close()
- os.Remove(tmpPath)
- }()
-
- testKey := []byte("foo")
- testValue := []byte("bar")
- s.Put(testKey, testValue, lease.NoLease)
-
- w := s.NewWatchStream()
- w.Watch(testKey, nil, 0)
-
- if !s.synced.contains(string(testKey)) {
- // the key must have had an entry in synced
- t.Errorf("existence = false, want true")
- }
-}
-
-func TestNewWatcherCancel(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := newWatchableStore(b, &lease.FakeLessor{}, nil)
-
- defer func() {
- s.store.Close()
- os.Remove(tmpPath)
- }()
- testKey := []byte("foo")
- testValue := []byte("bar")
- s.Put(testKey, testValue, lease.NoLease)
-
- w := s.NewWatchStream()
- wt := w.Watch(testKey, nil, 0)
-
- if err := w.Cancel(wt); err != nil {
- t.Error(err)
- }
-
- if s.synced.contains(string(testKey)) {
- // the key shoud have been deleted
- t.Errorf("existence = true, want false")
- }
-}
-
-// TestCancelUnsynced tests if running CancelFunc removes watchers from unsynced.
-func TestCancelUnsynced(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
-
- // manually create watchableStore instead of newWatchableStore
- // because newWatchableStore automatically calls syncWatchers
- // method to sync watchers in unsynced map. We want to keep watchers
- // in unsynced to test if syncWatchers works as expected.
- s := &watchableStore{
- store: NewStore(b, &lease.FakeLessor{}, nil),
- unsynced: newWatcherGroup(),
-
- // to make the test not crash from assigning to nil map.
- // 'synced' doesn't get populated in this test.
- synced: newWatcherGroup(),
- }
-
- defer func() {
- s.store.Close()
- os.Remove(tmpPath)
- }()
-
- // Put a key so that we can spawn watchers on that key.
- // (testKey in this test). This increases the rev to 1,
- // and later we can we set the watcher's startRev to 1,
- // and force watchers to be in unsynced.
- testKey := []byte("foo")
- testValue := []byte("bar")
- s.Put(testKey, testValue, lease.NoLease)
-
- w := s.NewWatchStream()
-
- // arbitrary number for watchers
- watcherN := 100
-
- // create watcherN of watch ids to cancel
- watchIDs := make([]WatchID, watcherN)
- for i := 0; i < watcherN; i++ {
- // use 1 to keep watchers in unsynced
- watchIDs[i] = w.Watch(testKey, nil, 1)
- }
-
- for _, idx := range watchIDs {
- if err := w.Cancel(idx); err != nil {
- t.Error(err)
- }
- }
-
- // After running CancelFunc
- //
- // unsynced should be empty
- // because cancel removes watcher from unsynced
- if size := s.unsynced.size(); size != 0 {
- t.Errorf("unsynced size = %d, want 0", size)
- }
-}
-
-// TestSyncWatchers populates unsynced watcher map and tests syncWatchers
-// method to see if it correctly sends events to channel of unsynced watchers
-// and moves these watchers to synced.
-func TestSyncWatchers(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
-
- s := &watchableStore{
- store: NewStore(b, &lease.FakeLessor{}, nil),
- unsynced: newWatcherGroup(),
- synced: newWatcherGroup(),
- }
-
- defer func() {
- s.store.Close()
- os.Remove(tmpPath)
- }()
-
- testKey := []byte("foo")
- testValue := []byte("bar")
- s.Put(testKey, testValue, lease.NoLease)
-
- w := s.NewWatchStream()
-
- // arbitrary number for watchers
- watcherN := 100
-
- for i := 0; i < watcherN; i++ {
- // specify rev as 1 to keep watchers in unsynced
- w.Watch(testKey, nil, 1)
- }
-
- // Before running s.syncWatchers() synced should be empty because we manually
- // populate unsynced only
- sws := s.synced.watcherSetByKey(string(testKey))
- uws := s.unsynced.watcherSetByKey(string(testKey))
-
- if len(sws) != 0 {
- t.Fatalf("synced[string(testKey)] size = %d, want 0", len(sws))
- }
- // unsynced should not be empty because we manually populated unsynced only
- if len(uws) != watcherN {
- t.Errorf("unsynced size = %d, want %d", len(uws), watcherN)
- }
-
- // this should move all unsynced watchers to synced ones
- s.syncWatchers()
-
- sws = s.synced.watcherSetByKey(string(testKey))
- uws = s.unsynced.watcherSetByKey(string(testKey))
-
- // After running s.syncWatchers(), synced should not be empty because syncwatchers
- // populates synced in this test case
- if len(sws) != watcherN {
- t.Errorf("synced[string(testKey)] size = %d, want %d", len(sws), watcherN)
- }
-
- // unsynced should be empty because syncwatchers is expected to move all watchers
- // from unsynced to synced in this test case
- if len(uws) != 0 {
- t.Errorf("unsynced size = %d, want 0", len(uws))
- }
-
- for w := range sws {
- if w.minRev != s.Rev()+1 {
- t.Errorf("w.minRev = %d, want %d", w.minRev, s.Rev()+1)
- }
- }
-
- if len(w.(*watchStream).ch) != watcherN {
- t.Errorf("watched event size = %d, want %d", len(w.(*watchStream).ch), watcherN)
- }
-
- evs := (<-w.(*watchStream).ch).Events
- if len(evs) != 1 {
- t.Errorf("len(evs) got = %d, want = 1", len(evs))
- }
- if evs[0].Type != mvccpb.PUT {
- t.Errorf("got = %v, want = %v", evs[0].Type, mvccpb.PUT)
- }
- if !bytes.Equal(evs[0].Kv.Key, testKey) {
- t.Errorf("got = %s, want = %s", evs[0].Kv.Key, testKey)
- }
- if !bytes.Equal(evs[0].Kv.Value, testValue) {
- t.Errorf("got = %s, want = %s", evs[0].Kv.Value, testValue)
- }
-}
-
-// TestWatchCompacted tests a watcher that watches on a compacted revision.
-func TestWatchCompacted(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := newWatchableStore(b, &lease.FakeLessor{}, nil)
-
- defer func() {
- s.store.Close()
- os.Remove(tmpPath)
- }()
- testKey := []byte("foo")
- testValue := []byte("bar")
-
- maxRev := 10
- compactRev := int64(5)
- for i := 0; i < maxRev; i++ {
- s.Put(testKey, testValue, lease.NoLease)
- }
- _, err := s.Compact(compactRev)
- if err != nil {
- t.Fatalf("failed to compact kv (%v)", err)
- }
-
- w := s.NewWatchStream()
- wt := w.Watch(testKey, nil, compactRev-1)
-
- select {
- case resp := <-w.Chan():
- if resp.WatchID != wt {
- t.Errorf("resp.WatchID = %x, want %x", resp.WatchID, wt)
- }
- if resp.CompactRevision == 0 {
- t.Errorf("resp.Compacted = %v, want %v", resp.CompactRevision, compactRev)
- }
- case <-time.After(1 * time.Second):
- t.Fatalf("failed to receive response (timeout)")
- }
-}
-
-func TestWatchFutureRev(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := newWatchableStore(b, &lease.FakeLessor{}, nil)
-
- defer func() {
- s.store.Close()
- os.Remove(tmpPath)
- }()
-
- testKey := []byte("foo")
- testValue := []byte("bar")
-
- w := s.NewWatchStream()
- wrev := int64(10)
- w.Watch(testKey, nil, wrev)
-
- for i := 0; i < 10; i++ {
- rev := s.Put(testKey, testValue, lease.NoLease)
- if rev >= wrev {
- break
- }
- }
-
- select {
- case resp := <-w.Chan():
- if resp.Revision != wrev {
- t.Fatalf("rev = %d, want %d", resp.Revision, wrev)
- }
- if len(resp.Events) != 1 {
- t.Fatalf("failed to get events from the response")
- }
- if resp.Events[0].Kv.ModRevision != wrev {
- t.Fatalf("kv.rev = %d, want %d", resp.Events[0].Kv.ModRevision, wrev)
- }
- case <-time.After(time.Second):
- t.Fatal("failed to receive event in 1 second.")
- }
-}
-
-func TestWatchRestore(t *testing.T) {
- test := func(delay time.Duration) func(t *testing.T) {
- return func(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := newWatchableStore(b, &lease.FakeLessor{}, nil)
- defer cleanup(s, b, tmpPath)
-
- testKey := []byte("foo")
- testValue := []byte("bar")
- rev := s.Put(testKey, testValue, lease.NoLease)
-
- newBackend, newPath := backend.NewDefaultTmpBackend()
- newStore := newWatchableStore(newBackend, &lease.FakeLessor{}, nil)
- defer cleanup(newStore, newBackend, newPath)
-
- w := newStore.NewWatchStream()
- w.Watch(testKey, nil, rev-1)
-
- time.Sleep(delay)
-
- newStore.Restore(b)
- select {
- case resp := <-w.Chan():
- if resp.Revision != rev {
- t.Fatalf("rev = %d, want %d", resp.Revision, rev)
- }
- if len(resp.Events) != 1 {
- t.Fatalf("failed to get events from the response")
- }
- if resp.Events[0].Kv.ModRevision != rev {
- t.Fatalf("kv.rev = %d, want %d", resp.Events[0].Kv.ModRevision, rev)
- }
- case <-time.After(time.Second):
- t.Fatal("failed to receive event in 1 second.")
- }
- }
- }
-
- t.Run("Normal", test(0))
- t.Run("RunSyncWatchLoopBeforeRestore", test(time.Millisecond*120)) // longer than default waitDuration
-}
-
-// TestWatchRestoreSyncedWatcher tests such a case that:
-// 1. watcher is created with a future revision "math.MaxInt64 - 2"
-// 2. watcher with a future revision is added to "synced" watcher group
-// 3. restore/overwrite storage with snapshot of a higher lasat revision
-// 4. restore operation moves "synced" to "unsynced" watcher group
-// 5. choose the watcher from step 1, without panic
-func TestWatchRestoreSyncedWatcher(t *testing.T) {
- b1, b1Path := backend.NewDefaultTmpBackend()
- s1 := newWatchableStore(b1, &lease.FakeLessor{}, nil)
- defer cleanup(s1, b1, b1Path)
-
- b2, b2Path := backend.NewDefaultTmpBackend()
- s2 := newWatchableStore(b2, &lease.FakeLessor{}, nil)
- defer cleanup(s2, b2, b2Path)
-
- testKey, testValue := []byte("foo"), []byte("bar")
- rev := s1.Put(testKey, testValue, lease.NoLease)
- startRev := rev + 2
-
- // create a watcher with a future revision
- // add to "synced" watcher group (startRev > s.store.currentRev)
- w1 := s1.NewWatchStream()
- w1.Watch(testKey, nil, startRev)
-
- // make "s2" ends up with a higher last revision
- s2.Put(testKey, testValue, lease.NoLease)
- s2.Put(testKey, testValue, lease.NoLease)
-
- // overwrite storage with higher revisions
- if err := s1.Restore(b2); err != nil {
- t.Fatal(err)
- }
-
- // wait for next "syncWatchersLoop" iteration
- // and the unsynced watcher should be chosen
- time.Sleep(2 * time.Second)
-
- // trigger events for "startRev"
- s1.Put(testKey, testValue, lease.NoLease)
-
- select {
- case resp := <-w1.Chan():
- if resp.Revision != startRev {
- t.Fatalf("resp.Revision expect %d, got %d", startRev, resp.Revision)
- }
- if len(resp.Events) != 1 {
- t.Fatalf("len(resp.Events) expect 1, got %d", len(resp.Events))
- }
- if resp.Events[0].Kv.ModRevision != startRev {
- t.Fatalf("resp.Events[0].Kv.ModRevision expect %d, got %d", startRev, resp.Events[0].Kv.ModRevision)
- }
- case <-time.After(time.Second):
- t.Fatal("failed to receive event in 1 second")
- }
-}
-
-// TestWatchBatchUnsynced tests batching on unsynced watchers
-func TestWatchBatchUnsynced(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := newWatchableStore(b, &lease.FakeLessor{}, nil)
-
- oldMaxRevs := watchBatchMaxRevs
- defer func() {
- watchBatchMaxRevs = oldMaxRevs
- s.store.Close()
- os.Remove(tmpPath)
- }()
- batches := 3
- watchBatchMaxRevs = 4
-
- v := []byte("foo")
- for i := 0; i < watchBatchMaxRevs*batches; i++ {
- s.Put(v, v, lease.NoLease)
- }
-
- w := s.NewWatchStream()
- w.Watch(v, nil, 1)
- for i := 0; i < batches; i++ {
- if resp := <-w.Chan(); len(resp.Events) != watchBatchMaxRevs {
- t.Fatalf("len(events) = %d, want %d", len(resp.Events), watchBatchMaxRevs)
- }
- }
-
- s.store.revMu.Lock()
- defer s.store.revMu.Unlock()
- if size := s.synced.size(); size != 1 {
- t.Errorf("synced size = %d, want 1", size)
- }
-}
-
-func TestNewMapwatcherToEventMap(t *testing.T) {
- k0, k1, k2 := []byte("foo0"), []byte("foo1"), []byte("foo2")
- v0, v1, v2 := []byte("bar0"), []byte("bar1"), []byte("bar2")
-
- ws := []*watcher{{key: k0}, {key: k1}, {key: k2}}
-
- evs := []mvccpb.Event{
- {
- Type: mvccpb.PUT,
- Kv: &mvccpb.KeyValue{Key: k0, Value: v0},
- },
- {
- Type: mvccpb.PUT,
- Kv: &mvccpb.KeyValue{Key: k1, Value: v1},
- },
- {
- Type: mvccpb.PUT,
- Kv: &mvccpb.KeyValue{Key: k2, Value: v2},
- },
- }
-
- tests := []struct {
- sync []*watcher
- evs []mvccpb.Event
-
- wwe map[*watcher][]mvccpb.Event
- }{
- // no watcher in sync, some events should return empty wwe
- {
- nil,
- evs,
- map[*watcher][]mvccpb.Event{},
- },
-
- // one watcher in sync, one event that does not match the key of that
- // watcher should return empty wwe
- {
- []*watcher{ws[2]},
- evs[:1],
- map[*watcher][]mvccpb.Event{},
- },
-
- // one watcher in sync, one event that matches the key of that
- // watcher should return wwe with that matching watcher
- {
- []*watcher{ws[1]},
- evs[1:2],
- map[*watcher][]mvccpb.Event{
- ws[1]: evs[1:2],
- },
- },
-
- // two watchers in sync that watches two different keys, one event
- // that matches the key of only one of the watcher should return wwe
- // with the matching watcher
- {
- []*watcher{ws[0], ws[2]},
- evs[2:],
- map[*watcher][]mvccpb.Event{
- ws[2]: evs[2:],
- },
- },
-
- // two watchers in sync that watches the same key, two events that
- // match the keys should return wwe with those two watchers
- {
- []*watcher{ws[0], ws[1]},
- evs[:2],
- map[*watcher][]mvccpb.Event{
- ws[0]: evs[:1],
- ws[1]: evs[1:2],
- },
- },
- }
-
- for i, tt := range tests {
- wg := newWatcherGroup()
- for _, w := range tt.sync {
- wg.add(w)
- }
-
- gwe := newWatcherBatch(&wg, tt.evs)
- if len(gwe) != len(tt.wwe) {
- t.Errorf("#%d: len(gwe) got = %d, want = %d", i, len(gwe), len(tt.wwe))
- }
- // compare gwe and tt.wwe
- for w, eb := range gwe {
- if len(eb.evs) != len(tt.wwe[w]) {
- t.Errorf("#%d: len(eb.evs) got = %d, want = %d", i, len(eb.evs), len(tt.wwe[w]))
- }
- if !reflect.DeepEqual(eb.evs, tt.wwe[w]) {
- t.Errorf("#%d: reflect.DeepEqual events got = %v, want = true", i, false)
- }
- }
- }
-}
-
-// TestWatchVictims tests that watchable store delivers watch events
-// when the watch channel is temporarily clogged with too many events.
-func TestWatchVictims(t *testing.T) {
- oldChanBufLen, oldMaxWatchersPerSync := chanBufLen, maxWatchersPerSync
-
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := newWatchableStore(b, &lease.FakeLessor{}, nil)
-
- defer func() {
- s.store.Close()
- os.Remove(tmpPath)
- chanBufLen, maxWatchersPerSync = oldChanBufLen, oldMaxWatchersPerSync
- }()
-
- chanBufLen, maxWatchersPerSync = 1, 2
- numPuts := chanBufLen * 64
- testKey, testValue := []byte("foo"), []byte("bar")
-
- var wg sync.WaitGroup
- numWatches := maxWatchersPerSync * 128
- errc := make(chan error, numWatches)
- wg.Add(numWatches)
- for i := 0; i < numWatches; i++ {
- go func() {
- w := s.NewWatchStream()
- w.Watch(testKey, nil, 1)
- defer func() {
- w.Close()
- wg.Done()
- }()
- tc := time.After(10 * time.Second)
- evs, nextRev := 0, int64(2)
- for evs < numPuts {
- select {
- case <-tc:
- errc <- fmt.Errorf("time out")
- return
- case wr := <-w.Chan():
- evs += len(wr.Events)
- for _, ev := range wr.Events {
- if ev.Kv.ModRevision != nextRev {
- errc <- fmt.Errorf("expected rev=%d, got %d", nextRev, ev.Kv.ModRevision)
- return
- }
- nextRev++
- }
- time.Sleep(time.Millisecond)
- }
- }
- if evs != numPuts {
- errc <- fmt.Errorf("expected %d events, got %d", numPuts, evs)
- return
- }
- select {
- case <-w.Chan():
- errc <- fmt.Errorf("unexpected response")
- default:
- }
- }()
- time.Sleep(time.Millisecond)
- }
-
- var wgPut sync.WaitGroup
- wgPut.Add(numPuts)
- for i := 0; i < numPuts; i++ {
- go func() {
- defer wgPut.Done()
- s.Put(testKey, testValue, lease.NoLease)
- }()
- }
- wgPut.Wait()
-
- wg.Wait()
- select {
- case err := <-errc:
- t.Fatal(err)
- default:
- }
-}
-
-// TestStressWatchCancelClose tests closing a watch stream while
-// canceling its watches.
-func TestStressWatchCancelClose(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := newWatchableStore(b, &lease.FakeLessor{}, nil)
-
- defer func() {
- s.store.Close()
- os.Remove(tmpPath)
- }()
-
- testKey, testValue := []byte("foo"), []byte("bar")
- var wg sync.WaitGroup
- readyc := make(chan struct{})
- wg.Add(100)
- for i := 0; i < 100; i++ {
- go func() {
- defer wg.Done()
- w := s.NewWatchStream()
- ids := make([]WatchID, 10)
- for i := range ids {
- ids[i] = w.Watch(testKey, nil, 0)
- }
- <-readyc
- wg.Add(1 + len(ids)/2)
- for i := range ids[:len(ids)/2] {
- go func(n int) {
- defer wg.Done()
- w.Cancel(ids[n])
- }(i)
- }
- go func() {
- defer wg.Done()
- w.Close()
- }()
- }()
- }
-
- close(readyc)
- for i := 0; i < 100; i++ {
- s.Put(testKey, testValue, lease.NoLease)
- }
-
- wg.Wait()
-}
diff --git a/vendor/github.com/coreos/etcd/mvcc/watcher_bench_test.go b/vendor/github.com/coreos/etcd/mvcc/watcher_bench_test.go
deleted file mode 100644
index 8a4242f3f..000000000
--- a/vendor/github.com/coreos/etcd/mvcc/watcher_bench_test.go
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package mvcc
-
-import (
- "fmt"
- "testing"
-
- "github.com/coreos/etcd/lease"
- "github.com/coreos/etcd/mvcc/backend"
-)
-
-func BenchmarkKVWatcherMemoryUsage(b *testing.B) {
- be, tmpPath := backend.NewDefaultTmpBackend()
- watchable := newWatchableStore(be, &lease.FakeLessor{}, nil)
-
- defer cleanup(watchable, be, tmpPath)
-
- w := watchable.NewWatchStream()
-
- b.ReportAllocs()
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- w.Watch([]byte(fmt.Sprint("foo", i)), nil, 0)
- }
-}
diff --git a/vendor/github.com/coreos/etcd/mvcc/watcher_test.go b/vendor/github.com/coreos/etcd/mvcc/watcher_test.go
deleted file mode 100644
index 3d259d1f1..000000000
--- a/vendor/github.com/coreos/etcd/mvcc/watcher_test.go
+++ /dev/null
@@ -1,344 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package mvcc
-
-import (
- "bytes"
- "fmt"
- "os"
- "reflect"
- "testing"
- "time"
-
- "github.com/coreos/etcd/lease"
- "github.com/coreos/etcd/mvcc/backend"
- "github.com/coreos/etcd/mvcc/mvccpb"
-)
-
-// TestWatcherWatchID tests that each watcher provides unique watchID,
-// and the watched event attaches the correct watchID.
-func TestWatcherWatchID(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := WatchableKV(newWatchableStore(b, &lease.FakeLessor{}, nil))
- defer cleanup(s, b, tmpPath)
-
- w := s.NewWatchStream()
- defer w.Close()
-
- idm := make(map[WatchID]struct{})
-
- for i := 0; i < 10; i++ {
- id := w.Watch([]byte("foo"), nil, 0)
- if _, ok := idm[id]; ok {
- t.Errorf("#%d: id %d exists", i, id)
- }
- idm[id] = struct{}{}
-
- s.Put([]byte("foo"), []byte("bar"), lease.NoLease)
-
- resp := <-w.Chan()
- if resp.WatchID != id {
- t.Errorf("#%d: watch id in event = %d, want %d", i, resp.WatchID, id)
- }
-
- if err := w.Cancel(id); err != nil {
- t.Error(err)
- }
- }
-
- s.Put([]byte("foo2"), []byte("bar"), lease.NoLease)
-
- // unsynced watchers
- for i := 10; i < 20; i++ {
- id := w.Watch([]byte("foo2"), nil, 1)
- if _, ok := idm[id]; ok {
- t.Errorf("#%d: id %d exists", i, id)
- }
- idm[id] = struct{}{}
-
- resp := <-w.Chan()
- if resp.WatchID != id {
- t.Errorf("#%d: watch id in event = %d, want %d", i, resp.WatchID, id)
- }
-
- if err := w.Cancel(id); err != nil {
- t.Error(err)
- }
- }
-}
-
-// TestWatcherWatchPrefix tests if Watch operation correctly watches
-// and returns events with matching prefixes.
-func TestWatcherWatchPrefix(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := WatchableKV(newWatchableStore(b, &lease.FakeLessor{}, nil))
- defer cleanup(s, b, tmpPath)
-
- w := s.NewWatchStream()
- defer w.Close()
-
- idm := make(map[WatchID]struct{})
-
- val := []byte("bar")
- keyWatch, keyEnd, keyPut := []byte("foo"), []byte("fop"), []byte("foobar")
-
- for i := 0; i < 10; i++ {
- id := w.Watch(keyWatch, keyEnd, 0)
- if _, ok := idm[id]; ok {
- t.Errorf("#%d: unexpected duplicated id %x", i, id)
- }
- idm[id] = struct{}{}
-
- s.Put(keyPut, val, lease.NoLease)
-
- resp := <-w.Chan()
- if resp.WatchID != id {
- t.Errorf("#%d: watch id in event = %d, want %d", i, resp.WatchID, id)
- }
-
- if err := w.Cancel(id); err != nil {
- t.Errorf("#%d: unexpected cancel error %v", i, err)
- }
-
- if len(resp.Events) != 1 {
- t.Errorf("#%d: len(resp.Events) got = %d, want = 1", i, len(resp.Events))
- }
- if len(resp.Events) == 1 {
- if !bytes.Equal(resp.Events[0].Kv.Key, keyPut) {
- t.Errorf("#%d: resp.Events got = %s, want = %s", i, resp.Events[0].Kv.Key, keyPut)
- }
- }
- }
-
- keyWatch1, keyEnd1, keyPut1 := []byte("foo1"), []byte("foo2"), []byte("foo1bar")
- s.Put(keyPut1, val, lease.NoLease)
-
- // unsynced watchers
- for i := 10; i < 15; i++ {
- id := w.Watch(keyWatch1, keyEnd1, 1)
- if _, ok := idm[id]; ok {
- t.Errorf("#%d: id %d exists", i, id)
- }
- idm[id] = struct{}{}
-
- resp := <-w.Chan()
- if resp.WatchID != id {
- t.Errorf("#%d: watch id in event = %d, want %d", i, resp.WatchID, id)
- }
-
- if err := w.Cancel(id); err != nil {
- t.Error(err)
- }
-
- if len(resp.Events) != 1 {
- t.Errorf("#%d: len(resp.Events) got = %d, want = 1", i, len(resp.Events))
- }
- if len(resp.Events) == 1 {
- if !bytes.Equal(resp.Events[0].Kv.Key, keyPut1) {
- t.Errorf("#%d: resp.Events got = %s, want = %s", i, resp.Events[0].Kv.Key, keyPut1)
- }
- }
- }
-}
-
-// TestWatcherWatchWrongRange ensures that watcher with wrong 'end' range
-// does not create watcher, which panics when canceling in range tree.
-func TestWatcherWatchWrongRange(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := WatchableKV(newWatchableStore(b, &lease.FakeLessor{}, nil))
- defer cleanup(s, b, tmpPath)
-
- w := s.NewWatchStream()
- defer w.Close()
-
- if id := w.Watch([]byte("foa"), []byte("foa"), 1); id != -1 {
- t.Fatalf("key == end range given; id expected -1, got %d", id)
- }
- if id := w.Watch([]byte("fob"), []byte("foa"), 1); id != -1 {
- t.Fatalf("key > end range given; id expected -1, got %d", id)
- }
- // watch request with 'WithFromKey' has empty-byte range end
- if id := w.Watch([]byte("foo"), []byte{}, 1); id != 0 {
- t.Fatalf("\x00 is range given; id expected 0, got %d", id)
- }
-}
-
-func TestWatchDeleteRange(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := newWatchableStore(b, &lease.FakeLessor{}, nil)
-
- defer func() {
- s.store.Close()
- os.Remove(tmpPath)
- }()
-
- testKeyPrefix := []byte("foo")
-
- for i := 0; i < 3; i++ {
- s.Put([]byte(fmt.Sprintf("%s_%d", testKeyPrefix, i)), []byte("bar"), lease.NoLease)
- }
-
- w := s.NewWatchStream()
- from, to := []byte(testKeyPrefix), []byte(fmt.Sprintf("%s_%d", testKeyPrefix, 99))
- w.Watch(from, to, 0)
-
- s.DeleteRange(from, to)
-
- we := []mvccpb.Event{
- {Type: mvccpb.DELETE, Kv: &mvccpb.KeyValue{Key: []byte("foo_0"), ModRevision: 5}},
- {Type: mvccpb.DELETE, Kv: &mvccpb.KeyValue{Key: []byte("foo_1"), ModRevision: 5}},
- {Type: mvccpb.DELETE, Kv: &mvccpb.KeyValue{Key: []byte("foo_2"), ModRevision: 5}},
- }
-
- select {
- case r := <-w.Chan():
- if !reflect.DeepEqual(r.Events, we) {
- t.Errorf("event = %v, want %v", r.Events, we)
- }
- case <-time.After(10 * time.Second):
- t.Fatal("failed to receive event after 10 seconds!")
- }
-}
-
-// TestWatchStreamCancelWatcherByID ensures cancel calls the cancel func of the watcher
-// with given id inside watchStream.
-func TestWatchStreamCancelWatcherByID(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := WatchableKV(newWatchableStore(b, &lease.FakeLessor{}, nil))
- defer cleanup(s, b, tmpPath)
-
- w := s.NewWatchStream()
- defer w.Close()
-
- id := w.Watch([]byte("foo"), nil, 0)
-
- tests := []struct {
- cancelID WatchID
- werr error
- }{
- // no error should be returned when cancel the created watcher.
- {id, nil},
- // not exist error should be returned when cancel again.
- {id, ErrWatcherNotExist},
- // not exist error should be returned when cancel a bad id.
- {id + 1, ErrWatcherNotExist},
- }
-
- for i, tt := range tests {
- gerr := w.Cancel(tt.cancelID)
-
- if gerr != tt.werr {
- t.Errorf("#%d: err = %v, want %v", i, gerr, tt.werr)
- }
- }
-
- if l := len(w.(*watchStream).cancels); l != 0 {
- t.Errorf("cancels = %d, want 0", l)
- }
-}
-
-// TestWatcherRequestProgress ensures synced watcher can correctly
-// report its correct progress.
-func TestWatcherRequestProgress(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
-
- // manually create watchableStore instead of newWatchableStore
- // because newWatchableStore automatically calls syncWatchers
- // method to sync watchers in unsynced map. We want to keep watchers
- // in unsynced to test if syncWatchers works as expected.
- s := &watchableStore{
- store: NewStore(b, &lease.FakeLessor{}, nil),
- unsynced: newWatcherGroup(),
- synced: newWatcherGroup(),
- }
-
- defer func() {
- s.store.Close()
- os.Remove(tmpPath)
- }()
-
- testKey := []byte("foo")
- notTestKey := []byte("bad")
- testValue := []byte("bar")
- s.Put(testKey, testValue, lease.NoLease)
-
- w := s.NewWatchStream()
-
- badID := WatchID(1000)
- w.RequestProgress(badID)
- select {
- case resp := <-w.Chan():
- t.Fatalf("unexpected %+v", resp)
- default:
- }
-
- id := w.Watch(notTestKey, nil, 1)
- w.RequestProgress(id)
- select {
- case resp := <-w.Chan():
- t.Fatalf("unexpected %+v", resp)
- default:
- }
-
- s.syncWatchers()
-
- w.RequestProgress(id)
- wrs := WatchResponse{WatchID: 0, Revision: 2}
- select {
- case resp := <-w.Chan():
- if !reflect.DeepEqual(resp, wrs) {
- t.Fatalf("got %+v, expect %+v", resp, wrs)
- }
- case <-time.After(time.Second):
- t.Fatal("failed to receive progress")
- }
-}
-
-func TestWatcherWatchWithFilter(t *testing.T) {
- b, tmpPath := backend.NewDefaultTmpBackend()
- s := WatchableKV(newWatchableStore(b, &lease.FakeLessor{}, nil))
- defer cleanup(s, b, tmpPath)
-
- w := s.NewWatchStream()
- defer w.Close()
-
- filterPut := func(e mvccpb.Event) bool {
- return e.Type == mvccpb.PUT
- }
-
- w.Watch([]byte("foo"), nil, 0, filterPut)
- done := make(chan struct{})
-
- go func() {
- <-w.Chan()
- done <- struct{}{}
- }()
-
- s.Put([]byte("foo"), []byte("bar"), 0)
-
- select {
- case <-done:
- t.Fatal("failed to filter put request")
- case <-time.After(100 * time.Millisecond):
- }
-
- s.DeleteRange([]byte("foo"), nil)
-
- select {
- case <-done:
- case <-time.After(100 * time.Millisecond):
- t.Fatal("failed to receive delete request")
- }
-}
diff --git a/vendor/github.com/coreos/etcd/pkg/types/id_test.go b/vendor/github.com/coreos/etcd/pkg/types/id_test.go
deleted file mode 100644
index bec285343..000000000
--- a/vendor/github.com/coreos/etcd/pkg/types/id_test.go
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package types
-
-import (
- "reflect"
- "sort"
- "testing"
-)
-
-func TestIDString(t *testing.T) {
- tests := []struct {
- input ID
- want string
- }{
- {
- input: 12,
- want: "c",
- },
- {
- input: 4918257920282737594,
- want: "444129853c343bba",
- },
- }
-
- for i, tt := range tests {
- got := tt.input.String()
- if tt.want != got {
- t.Errorf("#%d: ID.String failure: want=%v, got=%v", i, tt.want, got)
- }
- }
-}
-
-func TestIDFromString(t *testing.T) {
- tests := []struct {
- input string
- want ID
- }{
- {
- input: "17",
- want: 23,
- },
- {
- input: "612840dae127353",
- want: 437557308098245459,
- },
- }
-
- for i, tt := range tests {
- got, err := IDFromString(tt.input)
- if err != nil {
- t.Errorf("#%d: IDFromString failure: err=%v", i, err)
- continue
- }
- if tt.want != got {
- t.Errorf("#%d: IDFromString failure: want=%v, got=%v", i, tt.want, got)
- }
- }
-}
-
-func TestIDFromStringFail(t *testing.T) {
- tests := []string{
- "",
- "XXX",
- "612840dae127353612840dae127353",
- }
-
- for i, tt := range tests {
- _, err := IDFromString(tt)
- if err == nil {
- t.Fatalf("#%d: IDFromString expected error, but err=nil", i)
- }
- }
-}
-
-func TestIDSlice(t *testing.T) {
- g := []ID{10, 500, 5, 1, 100, 25}
- w := []ID{1, 5, 10, 25, 100, 500}
- sort.Sort(IDSlice(g))
- if !reflect.DeepEqual(g, w) {
- t.Errorf("slice after sort = %#v, want %#v", g, w)
- }
-}
diff --git a/vendor/github.com/coreos/etcd/pkg/types/set_test.go b/vendor/github.com/coreos/etcd/pkg/types/set_test.go
deleted file mode 100644
index 7596577e9..000000000
--- a/vendor/github.com/coreos/etcd/pkg/types/set_test.go
+++ /dev/null
@@ -1,186 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package types
-
-import (
- "reflect"
- "sort"
- "testing"
-)
-
-func TestUnsafeSet(t *testing.T) {
- driveSetTests(t, NewUnsafeSet())
-}
-
-func TestThreadsafeSet(t *testing.T) {
- driveSetTests(t, NewThreadsafeSet())
-}
-
-// Check that two slices contents are equal; order is irrelevant
-func equal(a, b []string) bool {
- as := sort.StringSlice(a)
- bs := sort.StringSlice(b)
- as.Sort()
- bs.Sort()
- return reflect.DeepEqual(as, bs)
-}
-
-func driveSetTests(t *testing.T, s Set) {
- // Verify operations on an empty set
- eValues := []string{}
- values := s.Values()
- if !reflect.DeepEqual(values, eValues) {
- t.Fatalf("Expect values=%v got %v", eValues, values)
- }
- if l := s.Length(); l != 0 {
- t.Fatalf("Expected length=0, got %d", l)
- }
- for _, v := range []string{"foo", "bar", "baz"} {
- if s.Contains(v) {
- t.Fatalf("Expect s.Contains(%q) to be fale, got true", v)
- }
- }
-
- // Add three items, ensure they show up
- s.Add("foo")
- s.Add("bar")
- s.Add("baz")
-
- eValues = []string{"foo", "bar", "baz"}
- values = s.Values()
- if !equal(values, eValues) {
- t.Fatalf("Expect values=%v got %v", eValues, values)
- }
-
- for _, v := range eValues {
- if !s.Contains(v) {
- t.Fatalf("Expect s.Contains(%q) to be true, got false", v)
- }
- }
-
- if l := s.Length(); l != 3 {
- t.Fatalf("Expected length=3, got %d", l)
- }
-
- // Add the same item a second time, ensuring it is not duplicated
- s.Add("foo")
-
- values = s.Values()
- if !equal(values, eValues) {
- t.Fatalf("Expect values=%v got %v", eValues, values)
- }
- if l := s.Length(); l != 3 {
- t.Fatalf("Expected length=3, got %d", l)
- }
-
- // Remove all items, ensure they are gone
- s.Remove("foo")
- s.Remove("bar")
- s.Remove("baz")
-
- eValues = []string{}
- values = s.Values()
- if !equal(values, eValues) {
- t.Fatalf("Expect values=%v got %v", eValues, values)
- }
-
- if l := s.Length(); l != 0 {
- t.Fatalf("Expected length=0, got %d", l)
- }
-
- // Create new copies of the set, and ensure they are unlinked to the
- // original Set by making modifications
- s.Add("foo")
- s.Add("bar")
- cp1 := s.Copy()
- cp2 := s.Copy()
- s.Remove("foo")
- cp3 := s.Copy()
- cp1.Add("baz")
-
- for i, tt := range []struct {
- want []string
- got []string
- }{
- {[]string{"bar"}, s.Values()},
- {[]string{"foo", "bar", "baz"}, cp1.Values()},
- {[]string{"foo", "bar"}, cp2.Values()},
- {[]string{"bar"}, cp3.Values()},
- } {
- if !equal(tt.want, tt.got) {
- t.Fatalf("case %d: expect values=%v got %v", i, tt.want, tt.got)
- }
- }
-
- for i, tt := range []struct {
- want bool
- got bool
- }{
- {true, s.Equals(cp3)},
- {true, cp3.Equals(s)},
- {false, s.Equals(cp2)},
- {false, s.Equals(cp1)},
- {false, cp1.Equals(s)},
- {false, cp2.Equals(s)},
- {false, cp2.Equals(cp1)},
- } {
- if tt.got != tt.want {
- t.Fatalf("case %d: want %t, got %t", i, tt.want, tt.got)
-
- }
- }
-
- // Subtract values from a Set, ensuring a new Set is created and
- // the original Sets are unmodified
- sub1 := cp1.Sub(s)
- sub2 := cp2.Sub(cp1)
-
- for i, tt := range []struct {
- want []string
- got []string
- }{
- {[]string{"foo", "bar", "baz"}, cp1.Values()},
- {[]string{"foo", "bar"}, cp2.Values()},
- {[]string{"bar"}, s.Values()},
- {[]string{"foo", "baz"}, sub1.Values()},
- {[]string{}, sub2.Values()},
- } {
- if !equal(tt.want, tt.got) {
- t.Fatalf("case %d: expect values=%v got %v", i, tt.want, tt.got)
- }
- }
-}
-
-func TestUnsafeSetContainsAll(t *testing.T) {
- vals := []string{"foo", "bar", "baz"}
- s := NewUnsafeSet(vals...)
-
- tests := []struct {
- strs []string
- wcontain bool
- }{
- {[]string{}, true},
- {vals[:1], true},
- {vals[:2], true},
- {vals, true},
- {[]string{"cuz"}, false},
- {[]string{vals[0], "cuz"}, false},
- }
- for i, tt := range tests {
- if g := s.ContainsAll(tt.strs); g != tt.wcontain {
- t.Errorf("#%d: ok = %v, want %v", i, g, tt.wcontain)
- }
- }
-}
diff --git a/vendor/github.com/coreos/etcd/pkg/types/slice_test.go b/vendor/github.com/coreos/etcd/pkg/types/slice_test.go
deleted file mode 100644
index 8d8a4d0ea..000000000
--- a/vendor/github.com/coreos/etcd/pkg/types/slice_test.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package types
-
-import (
- "reflect"
- "sort"
- "testing"
-)
-
-func TestUint64Slice(t *testing.T) {
- g := Uint64Slice{10, 500, 5, 1, 100, 25}
- w := Uint64Slice{1, 5, 10, 25, 100, 500}
- sort.Sort(g)
- if !reflect.DeepEqual(g, w) {
- t.Errorf("slice after sort = %#v, want %#v", g, w)
- }
-}
diff --git a/vendor/github.com/coreos/etcd/pkg/types/urls_test.go b/vendor/github.com/coreos/etcd/pkg/types/urls_test.go
deleted file mode 100644
index b91d1a926..000000000
--- a/vendor/github.com/coreos/etcd/pkg/types/urls_test.go
+++ /dev/null
@@ -1,169 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package types
-
-import (
- "reflect"
- "testing"
-
- "github.com/coreos/etcd/pkg/testutil"
-)
-
-func TestNewURLs(t *testing.T) {
- tests := []struct {
- strs []string
- wurls URLs
- }{
- {
- []string{"http://127.0.0.1:2379"},
- testutil.MustNewURLs(t, []string{"http://127.0.0.1:2379"}),
- },
- // it can trim space
- {
- []string{" http://127.0.0.1:2379 "},
- testutil.MustNewURLs(t, []string{"http://127.0.0.1:2379"}),
- },
- // it does sort
- {
- []string{
- "http://127.0.0.2:2379",
- "http://127.0.0.1:2379",
- },
- testutil.MustNewURLs(t, []string{
- "http://127.0.0.1:2379",
- "http://127.0.0.2:2379",
- }),
- },
- }
- for i, tt := range tests {
- urls, _ := NewURLs(tt.strs)
- if !reflect.DeepEqual(urls, tt.wurls) {
- t.Errorf("#%d: urls = %+v, want %+v", i, urls, tt.wurls)
- }
- }
-}
-
-func TestURLsString(t *testing.T) {
- tests := []struct {
- us URLs
- wstr string
- }{
- {
- URLs{},
- "",
- },
- {
- testutil.MustNewURLs(t, []string{"http://127.0.0.1:2379"}),
- "http://127.0.0.1:2379",
- },
- {
- testutil.MustNewURLs(t, []string{
- "http://127.0.0.1:2379",
- "http://127.0.0.2:2379",
- }),
- "http://127.0.0.1:2379,http://127.0.0.2:2379",
- },
- {
- testutil.MustNewURLs(t, []string{
- "http://127.0.0.2:2379",
- "http://127.0.0.1:2379",
- }),
- "http://127.0.0.2:2379,http://127.0.0.1:2379",
- },
- }
- for i, tt := range tests {
- g := tt.us.String()
- if g != tt.wstr {
- t.Errorf("#%d: string = %s, want %s", i, g, tt.wstr)
- }
- }
-}
-
-func TestURLsSort(t *testing.T) {
- g := testutil.MustNewURLs(t, []string{
- "http://127.0.0.4:2379",
- "http://127.0.0.2:2379",
- "http://127.0.0.1:2379",
- "http://127.0.0.3:2379",
- })
- w := testutil.MustNewURLs(t, []string{
- "http://127.0.0.1:2379",
- "http://127.0.0.2:2379",
- "http://127.0.0.3:2379",
- "http://127.0.0.4:2379",
- })
- gurls := URLs(g)
- gurls.Sort()
- if !reflect.DeepEqual(g, w) {
- t.Errorf("URLs after sort = %#v, want %#v", g, w)
- }
-}
-
-func TestURLsStringSlice(t *testing.T) {
- tests := []struct {
- us URLs
- wstr []string
- }{
- {
- URLs{},
- []string{},
- },
- {
- testutil.MustNewURLs(t, []string{"http://127.0.0.1:2379"}),
- []string{"http://127.0.0.1:2379"},
- },
- {
- testutil.MustNewURLs(t, []string{
- "http://127.0.0.1:2379",
- "http://127.0.0.2:2379",
- }),
- []string{"http://127.0.0.1:2379", "http://127.0.0.2:2379"},
- },
- {
- testutil.MustNewURLs(t, []string{
- "http://127.0.0.2:2379",
- "http://127.0.0.1:2379",
- }),
- []string{"http://127.0.0.2:2379", "http://127.0.0.1:2379"},
- },
- }
- for i, tt := range tests {
- g := tt.us.StringSlice()
- if !reflect.DeepEqual(g, tt.wstr) {
- t.Errorf("#%d: string slice = %+v, want %+v", i, g, tt.wstr)
- }
- }
-}
-
-func TestNewURLsFail(t *testing.T) {
- tests := [][]string{
- // no urls given
- {},
- // missing protocol scheme
- {"://127.0.0.1:2379"},
- // unsupported scheme
- {"mailto://127.0.0.1:2379"},
- // not conform to host:port
- {"http://127.0.0.1"},
- // contain a path
- {"http://127.0.0.1:2379/path"},
- }
- for i, tt := range tests {
- _, err := NewURLs(tt)
- if err == nil {
- t.Errorf("#%d: err = nil, but error", i)
- }
- }
-}
diff --git a/vendor/github.com/coreos/etcd/pkg/types/urlsmap_test.go b/vendor/github.com/coreos/etcd/pkg/types/urlsmap_test.go
deleted file mode 100644
index 6f58765c0..000000000
--- a/vendor/github.com/coreos/etcd/pkg/types/urlsmap_test.go
+++ /dev/null
@@ -1,155 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package types
-
-import (
- "github.com/coreos/etcd/pkg/testutil"
- "reflect"
- "testing"
-)
-
-func TestParseInitialCluster(t *testing.T) {
- c, err := NewURLsMap("mem1=http://10.0.0.1:2379,mem1=http://128.193.4.20:2379,mem2=http://10.0.0.2:2379,default=http://127.0.0.1:2379")
- if err != nil {
- t.Fatalf("unexpected parse error: %v", err)
- }
- wc := URLsMap(map[string]URLs{
- "mem1": testutil.MustNewURLs(t, []string{"http://10.0.0.1:2379", "http://128.193.4.20:2379"}),
- "mem2": testutil.MustNewURLs(t, []string{"http://10.0.0.2:2379"}),
- "default": testutil.MustNewURLs(t, []string{"http://127.0.0.1:2379"}),
- })
- if !reflect.DeepEqual(c, wc) {
- t.Errorf("cluster = %+v, want %+v", c, wc)
- }
-}
-
-func TestParseInitialClusterBad(t *testing.T) {
- tests := []string{
- // invalid URL
- "%^",
- // no URL defined for member
- "mem1=,mem2=http://128.193.4.20:2379,mem3=http://10.0.0.2:2379",
- "mem1,mem2=http://128.193.4.20:2379,mem3=http://10.0.0.2:2379",
- // bad URL for member
- "default=http://localhost/",
- }
- for i, tt := range tests {
- if _, err := NewURLsMap(tt); err == nil {
- t.Errorf("#%d: unexpected successful parse, want err", i)
- }
- }
-}
-
-func TestNameURLPairsString(t *testing.T) {
- cls := URLsMap(map[string]URLs{
- "abc": testutil.MustNewURLs(t, []string{"http://1.1.1.1:1111", "http://0.0.0.0:0000"}),
- "def": testutil.MustNewURLs(t, []string{"http://2.2.2.2:2222"}),
- "ghi": testutil.MustNewURLs(t, []string{"http://3.3.3.3:1234", "http://127.0.0.1:2380"}),
- // no PeerURLs = not included
- "four": testutil.MustNewURLs(t, []string{}),
- "five": testutil.MustNewURLs(t, nil),
- })
- w := "abc=http://0.0.0.0:0000,abc=http://1.1.1.1:1111,def=http://2.2.2.2:2222,ghi=http://127.0.0.1:2380,ghi=http://3.3.3.3:1234"
- if g := cls.String(); g != w {
- t.Fatalf("NameURLPairs.String():\ngot %#v\nwant %#v", g, w)
- }
-}
-
-func TestParse(t *testing.T) {
- tests := []struct {
- s string
- wm map[string][]string
- }{
- {
- "",
- map[string][]string{},
- },
- {
- "a=b",
- map[string][]string{"a": {"b"}},
- },
- {
- "a=b,a=c",
- map[string][]string{"a": {"b", "c"}},
- },
- {
- "a=b,a1=c",
- map[string][]string{"a": {"b"}, "a1": {"c"}},
- },
- }
- for i, tt := range tests {
- m := parse(tt.s)
- if !reflect.DeepEqual(m, tt.wm) {
- t.Errorf("#%d: m = %+v, want %+v", i, m, tt.wm)
- }
- }
-}
-
-// TestNewURLsMapIPV6 is only tested in Go1.5+ because Go1.4 doesn't support literal IPv6 address with zone in
-// URI (https://github.com/golang/go/issues/6530).
-func TestNewURLsMapIPV6(t *testing.T) {
- c, err := NewURLsMap("mem1=http://[2001:db8::1]:2380,mem1=http://[fe80::6e40:8ff:feb1:58e4%25en0]:2380,mem2=http://[fe80::92e2:baff:fe7c:3224%25ext0]:2380")
- if err != nil {
- t.Fatalf("unexpected parse error: %v", err)
- }
- wc := URLsMap(map[string]URLs{
- "mem1": testutil.MustNewURLs(t, []string{"http://[2001:db8::1]:2380", "http://[fe80::6e40:8ff:feb1:58e4%25en0]:2380"}),
- "mem2": testutil.MustNewURLs(t, []string{"http://[fe80::92e2:baff:fe7c:3224%25ext0]:2380"}),
- })
- if !reflect.DeepEqual(c, wc) {
- t.Errorf("cluster = %#v, want %#v", c, wc)
- }
-}
-
-func TestNewURLsMapFromStringMapEmpty(t *testing.T) {
- mss := make(map[string]string)
- urlsMap, err := NewURLsMapFromStringMap(mss, ",")
- if err != nil {
- t.Errorf("Unexpected error: %v", err)
- }
- s := ""
- um, err := NewURLsMap(s)
- if err != nil {
- t.Errorf("Unexpected error: %v", err)
- }
-
- if um.String() != urlsMap.String() {
- t.Errorf("Expected:\n%+v\ngot:\n%+v", um, urlsMap)
- }
-}
-
-func TestNewURLsMapFromStringMapNormal(t *testing.T) {
- mss := make(map[string]string)
- mss["host0"] = "http://127.0.0.1:2379,http://127.0.0.1:2380"
- mss["host1"] = "http://127.0.0.1:2381,http://127.0.0.1:2382"
- mss["host2"] = "http://127.0.0.1:2383,http://127.0.0.1:2384"
- mss["host3"] = "http://127.0.0.1:2385,http://127.0.0.1:2386"
- urlsMap, err := NewURLsMapFromStringMap(mss, ",")
- if err != nil {
- t.Errorf("Unexpected error: %v", err)
- }
- s := "host0=http://127.0.0.1:2379,host0=http://127.0.0.1:2380," +
- "host1=http://127.0.0.1:2381,host1=http://127.0.0.1:2382," +
- "host2=http://127.0.0.1:2383,host2=http://127.0.0.1:2384," +
- "host3=http://127.0.0.1:2385,host3=http://127.0.0.1:2386"
- um, err := NewURLsMap(s)
- if err != nil {
- t.Errorf("Unexpected error: %v", err)
- }
-
- if um.String() != urlsMap.String() {
- t.Errorf("Expected:\n%+v\ngot:\n%+v", um, urlsMap)
- }
-}
diff --git a/vendor/github.com/davecgh/go-spew/spew/common_test.go b/vendor/github.com/davecgh/go-spew/spew/common_test.go
deleted file mode 100644
index 0f5ce47dc..000000000
--- a/vendor/github.com/davecgh/go-spew/spew/common_test.go
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-package spew_test
-
-import (
- "fmt"
- "reflect"
- "testing"
-
- "github.com/davecgh/go-spew/spew"
-)
-
-// custom type to test Stinger interface on non-pointer receiver.
-type stringer string
-
-// String implements the Stringer interface for testing invocation of custom
-// stringers on types with non-pointer receivers.
-func (s stringer) String() string {
- return "stringer " + string(s)
-}
-
-// custom type to test Stinger interface on pointer receiver.
-type pstringer string
-
-// String implements the Stringer interface for testing invocation of custom
-// stringers on types with only pointer receivers.
-func (s *pstringer) String() string {
- return "stringer " + string(*s)
-}
-
-// xref1 and xref2 are cross referencing structs for testing circular reference
-// detection.
-type xref1 struct {
- ps2 *xref2
-}
-type xref2 struct {
- ps1 *xref1
-}
-
-// indirCir1, indirCir2, and indirCir3 are used to generate an indirect circular
-// reference for testing detection.
-type indirCir1 struct {
- ps2 *indirCir2
-}
-type indirCir2 struct {
- ps3 *indirCir3
-}
-type indirCir3 struct {
- ps1 *indirCir1
-}
-
-// embed is used to test embedded structures.
-type embed struct {
- a string
-}
-
-// embedwrap is used to test embedded structures.
-type embedwrap struct {
- *embed
- e *embed
-}
-
-// panicer is used to intentionally cause a panic for testing spew properly
-// handles them
-type panicer int
-
-func (p panicer) String() string {
- panic("test panic")
-}
-
-// customError is used to test custom error interface invocation.
-type customError int
-
-func (e customError) Error() string {
- return fmt.Sprintf("error: %d", int(e))
-}
-
-// stringizeWants converts a slice of wanted test output into a format suitable
-// for a test error message.
-func stringizeWants(wants []string) string {
- s := ""
- for i, want := range wants {
- if i > 0 {
- s += fmt.Sprintf("want%d: %s", i+1, want)
- } else {
- s += "want: " + want
- }
- }
- return s
-}
-
-// testFailed returns whether or not a test failed by checking if the result
-// of the test is in the slice of wanted strings.
-func testFailed(result string, wants []string) bool {
- for _, want := range wants {
- if result == want {
- return false
- }
- }
- return true
-}
-
-type sortableStruct struct {
- x int
-}
-
-func (ss sortableStruct) String() string {
- return fmt.Sprintf("ss.%d", ss.x)
-}
-
-type unsortableStruct struct {
- x int
-}
-
-type sortTestCase struct {
- input []reflect.Value
- expected []reflect.Value
-}
-
-func helpTestSortValues(tests []sortTestCase, cs *spew.ConfigState, t *testing.T) {
- getInterfaces := func(values []reflect.Value) []interface{} {
- interfaces := []interface{}{}
- for _, v := range values {
- interfaces = append(interfaces, v.Interface())
- }
- return interfaces
- }
-
- for _, test := range tests {
- spew.SortValues(test.input, cs)
- // reflect.DeepEqual cannot really make sense of reflect.Value,
- // probably because of all the pointer tricks. For instance,
- // v(2.0) != v(2.0) on a 32-bits system. Turn them into interface{}
- // instead.
- input := getInterfaces(test.input)
- expected := getInterfaces(test.expected)
- if !reflect.DeepEqual(input, expected) {
- t.Errorf("Sort mismatch:\n %v != %v", input, expected)
- }
- }
-}
-
-// TestSortValues ensures the sort functionality for relect.Value based sorting
-// works as intended.
-func TestSortValues(t *testing.T) {
- v := reflect.ValueOf
-
- a := v("a")
- b := v("b")
- c := v("c")
- embedA := v(embed{"a"})
- embedB := v(embed{"b"})
- embedC := v(embed{"c"})
- tests := []sortTestCase{
- // No values.
- {
- []reflect.Value{},
- []reflect.Value{},
- },
- // Bools.
- {
- []reflect.Value{v(false), v(true), v(false)},
- []reflect.Value{v(false), v(false), v(true)},
- },
- // Ints.
- {
- []reflect.Value{v(2), v(1), v(3)},
- []reflect.Value{v(1), v(2), v(3)},
- },
- // Uints.
- {
- []reflect.Value{v(uint8(2)), v(uint8(1)), v(uint8(3))},
- []reflect.Value{v(uint8(1)), v(uint8(2)), v(uint8(3))},
- },
- // Floats.
- {
- []reflect.Value{v(2.0), v(1.0), v(3.0)},
- []reflect.Value{v(1.0), v(2.0), v(3.0)},
- },
- // Strings.
- {
- []reflect.Value{b, a, c},
- []reflect.Value{a, b, c},
- },
- // Array
- {
- []reflect.Value{v([3]int{3, 2, 1}), v([3]int{1, 3, 2}), v([3]int{1, 2, 3})},
- []reflect.Value{v([3]int{1, 2, 3}), v([3]int{1, 3, 2}), v([3]int{3, 2, 1})},
- },
- // Uintptrs.
- {
- []reflect.Value{v(uintptr(2)), v(uintptr(1)), v(uintptr(3))},
- []reflect.Value{v(uintptr(1)), v(uintptr(2)), v(uintptr(3))},
- },
- // SortableStructs.
- {
- // Note: not sorted - DisableMethods is set.
- []reflect.Value{v(sortableStruct{2}), v(sortableStruct{1}), v(sortableStruct{3})},
- []reflect.Value{v(sortableStruct{2}), v(sortableStruct{1}), v(sortableStruct{3})},
- },
- // UnsortableStructs.
- {
- // Note: not sorted - SpewKeys is false.
- []reflect.Value{v(unsortableStruct{2}), v(unsortableStruct{1}), v(unsortableStruct{3})},
- []reflect.Value{v(unsortableStruct{2}), v(unsortableStruct{1}), v(unsortableStruct{3})},
- },
- // Invalid.
- {
- []reflect.Value{embedB, embedA, embedC},
- []reflect.Value{embedB, embedA, embedC},
- },
- }
- cs := spew.ConfigState{DisableMethods: true, SpewKeys: false}
- helpTestSortValues(tests, &cs, t)
-}
-
-// TestSortValuesWithMethods ensures the sort functionality for relect.Value
-// based sorting works as intended when using string methods.
-func TestSortValuesWithMethods(t *testing.T) {
- v := reflect.ValueOf
-
- a := v("a")
- b := v("b")
- c := v("c")
- tests := []sortTestCase{
- // Ints.
- {
- []reflect.Value{v(2), v(1), v(3)},
- []reflect.Value{v(1), v(2), v(3)},
- },
- // Strings.
- {
- []reflect.Value{b, a, c},
- []reflect.Value{a, b, c},
- },
- // SortableStructs.
- {
- []reflect.Value{v(sortableStruct{2}), v(sortableStruct{1}), v(sortableStruct{3})},
- []reflect.Value{v(sortableStruct{1}), v(sortableStruct{2}), v(sortableStruct{3})},
- },
- // UnsortableStructs.
- {
- // Note: not sorted - SpewKeys is false.
- []reflect.Value{v(unsortableStruct{2}), v(unsortableStruct{1}), v(unsortableStruct{3})},
- []reflect.Value{v(unsortableStruct{2}), v(unsortableStruct{1}), v(unsortableStruct{3})},
- },
- }
- cs := spew.ConfigState{DisableMethods: false, SpewKeys: false}
- helpTestSortValues(tests, &cs, t)
-}
-
-// TestSortValuesWithSpew ensures the sort functionality for relect.Value
-// based sorting works as intended when using spew to stringify keys.
-func TestSortValuesWithSpew(t *testing.T) {
- v := reflect.ValueOf
-
- a := v("a")
- b := v("b")
- c := v("c")
- tests := []sortTestCase{
- // Ints.
- {
- []reflect.Value{v(2), v(1), v(3)},
- []reflect.Value{v(1), v(2), v(3)},
- },
- // Strings.
- {
- []reflect.Value{b, a, c},
- []reflect.Value{a, b, c},
- },
- // SortableStructs.
- {
- []reflect.Value{v(sortableStruct{2}), v(sortableStruct{1}), v(sortableStruct{3})},
- []reflect.Value{v(sortableStruct{1}), v(sortableStruct{2}), v(sortableStruct{3})},
- },
- // UnsortableStructs.
- {
- []reflect.Value{v(unsortableStruct{2}), v(unsortableStruct{1}), v(unsortableStruct{3})},
- []reflect.Value{v(unsortableStruct{1}), v(unsortableStruct{2}), v(unsortableStruct{3})},
- },
- }
- cs := spew.ConfigState{DisableMethods: true, SpewKeys: true}
- helpTestSortValues(tests, &cs, t)
-}
diff --git a/vendor/github.com/davecgh/go-spew/spew/dump_test.go b/vendor/github.com/davecgh/go-spew/spew/dump_test.go
deleted file mode 100644
index 5aad9c7af..000000000
--- a/vendor/github.com/davecgh/go-spew/spew/dump_test.go
+++ /dev/null
@@ -1,1042 +0,0 @@
-/*
- * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
-Test Summary:
-NOTE: For each test, a nil pointer, a single pointer and double pointer to the
-base test element are also tested to ensure proper indirection across all types.
-
-- Max int8, int16, int32, int64, int
-- Max uint8, uint16, uint32, uint64, uint
-- Boolean true and false
-- Standard complex64 and complex128
-- Array containing standard ints
-- Array containing type with custom formatter on pointer receiver only
-- Array containing interfaces
-- Array containing bytes
-- Slice containing standard float32 values
-- Slice containing type with custom formatter on pointer receiver only
-- Slice containing interfaces
-- Slice containing bytes
-- Nil slice
-- Standard string
-- Nil interface
-- Sub-interface
-- Map with string keys and int vals
-- Map with custom formatter type on pointer receiver only keys and vals
-- Map with interface keys and values
-- Map with nil interface value
-- Struct with primitives
-- Struct that contains another struct
-- Struct that contains custom type with Stringer pointer interface via both
- exported and unexported fields
-- Struct that contains embedded struct and field to same struct
-- Uintptr to 0 (null pointer)
-- Uintptr address of real variable
-- Unsafe.Pointer to 0 (null pointer)
-- Unsafe.Pointer to address of real variable
-- Nil channel
-- Standard int channel
-- Function with no params and no returns
-- Function with param and no returns
-- Function with multiple params and multiple returns
-- Struct that is circular through self referencing
-- Structs that are circular through cross referencing
-- Structs that are indirectly circular
-- Type that panics in its Stringer interface
-*/
-
-package spew_test
-
-import (
- "bytes"
- "fmt"
- "testing"
- "unsafe"
-
- "github.com/davecgh/go-spew/spew"
-)
-
-// dumpTest is used to describe a test to be performed against the Dump method.
-type dumpTest struct {
- in interface{}
- wants []string
-}
-
-// dumpTests houses all of the tests to be performed against the Dump method.
-var dumpTests = make([]dumpTest, 0)
-
-// addDumpTest is a helper method to append the passed input and desired result
-// to dumpTests
-func addDumpTest(in interface{}, wants ...string) {
- test := dumpTest{in, wants}
- dumpTests = append(dumpTests, test)
-}
-
-func addIntDumpTests() {
- // Max int8.
- v := int8(127)
- nv := (*int8)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "int8"
- vs := "127"
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*"+vt+")(<nil>)\n")
-
- // Max int16.
- v2 := int16(32767)
- nv2 := (*int16)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "int16"
- v2s := "32767"
- addDumpTest(v2, "("+v2t+") "+v2s+"\n")
- addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
- addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
- addDumpTest(nv2, "(*"+v2t+")(<nil>)\n")
-
- // Max int32.
- v3 := int32(2147483647)
- nv3 := (*int32)(nil)
- pv3 := &v3
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "int32"
- v3s := "2147483647"
- addDumpTest(v3, "("+v3t+") "+v3s+"\n")
- addDumpTest(pv3, "(*"+v3t+")("+v3Addr+")("+v3s+")\n")
- addDumpTest(&pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")("+v3s+")\n")
- addDumpTest(nv3, "(*"+v3t+")(<nil>)\n")
-
- // Max int64.
- v4 := int64(9223372036854775807)
- nv4 := (*int64)(nil)
- pv4 := &v4
- v4Addr := fmt.Sprintf("%p", pv4)
- pv4Addr := fmt.Sprintf("%p", &pv4)
- v4t := "int64"
- v4s := "9223372036854775807"
- addDumpTest(v4, "("+v4t+") "+v4s+"\n")
- addDumpTest(pv4, "(*"+v4t+")("+v4Addr+")("+v4s+")\n")
- addDumpTest(&pv4, "(**"+v4t+")("+pv4Addr+"->"+v4Addr+")("+v4s+")\n")
- addDumpTest(nv4, "(*"+v4t+")(<nil>)\n")
-
- // Max int.
- v5 := int(2147483647)
- nv5 := (*int)(nil)
- pv5 := &v5
- v5Addr := fmt.Sprintf("%p", pv5)
- pv5Addr := fmt.Sprintf("%p", &pv5)
- v5t := "int"
- v5s := "2147483647"
- addDumpTest(v5, "("+v5t+") "+v5s+"\n")
- addDumpTest(pv5, "(*"+v5t+")("+v5Addr+")("+v5s+")\n")
- addDumpTest(&pv5, "(**"+v5t+")("+pv5Addr+"->"+v5Addr+")("+v5s+")\n")
- addDumpTest(nv5, "(*"+v5t+")(<nil>)\n")
-}
-
-func addUintDumpTests() {
- // Max uint8.
- v := uint8(255)
- nv := (*uint8)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "uint8"
- vs := "255"
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*"+vt+")(<nil>)\n")
-
- // Max uint16.
- v2 := uint16(65535)
- nv2 := (*uint16)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "uint16"
- v2s := "65535"
- addDumpTest(v2, "("+v2t+") "+v2s+"\n")
- addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
- addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
- addDumpTest(nv2, "(*"+v2t+")(<nil>)\n")
-
- // Max uint32.
- v3 := uint32(4294967295)
- nv3 := (*uint32)(nil)
- pv3 := &v3
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "uint32"
- v3s := "4294967295"
- addDumpTest(v3, "("+v3t+") "+v3s+"\n")
- addDumpTest(pv3, "(*"+v3t+")("+v3Addr+")("+v3s+")\n")
- addDumpTest(&pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")("+v3s+")\n")
- addDumpTest(nv3, "(*"+v3t+")(<nil>)\n")
-
- // Max uint64.
- v4 := uint64(18446744073709551615)
- nv4 := (*uint64)(nil)
- pv4 := &v4
- v4Addr := fmt.Sprintf("%p", pv4)
- pv4Addr := fmt.Sprintf("%p", &pv4)
- v4t := "uint64"
- v4s := "18446744073709551615"
- addDumpTest(v4, "("+v4t+") "+v4s+"\n")
- addDumpTest(pv4, "(*"+v4t+")("+v4Addr+")("+v4s+")\n")
- addDumpTest(&pv4, "(**"+v4t+")("+pv4Addr+"->"+v4Addr+")("+v4s+")\n")
- addDumpTest(nv4, "(*"+v4t+")(<nil>)\n")
-
- // Max uint.
- v5 := uint(4294967295)
- nv5 := (*uint)(nil)
- pv5 := &v5
- v5Addr := fmt.Sprintf("%p", pv5)
- pv5Addr := fmt.Sprintf("%p", &pv5)
- v5t := "uint"
- v5s := "4294967295"
- addDumpTest(v5, "("+v5t+") "+v5s+"\n")
- addDumpTest(pv5, "(*"+v5t+")("+v5Addr+")("+v5s+")\n")
- addDumpTest(&pv5, "(**"+v5t+")("+pv5Addr+"->"+v5Addr+")("+v5s+")\n")
- addDumpTest(nv5, "(*"+v5t+")(<nil>)\n")
-}
-
-func addBoolDumpTests() {
- // Boolean true.
- v := bool(true)
- nv := (*bool)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "bool"
- vs := "true"
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*"+vt+")(<nil>)\n")
-
- // Boolean false.
- v2 := bool(false)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "bool"
- v2s := "false"
- addDumpTest(v2, "("+v2t+") "+v2s+"\n")
- addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
- addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
-}
-
-func addFloatDumpTests() {
- // Standard float32.
- v := float32(3.1415)
- nv := (*float32)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "float32"
- vs := "3.1415"
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*"+vt+")(<nil>)\n")
-
- // Standard float64.
- v2 := float64(3.1415926)
- nv2 := (*float64)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "float64"
- v2s := "3.1415926"
- addDumpTest(v2, "("+v2t+") "+v2s+"\n")
- addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
- addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
- addDumpTest(nv2, "(*"+v2t+")(<nil>)\n")
-}
-
-func addComplexDumpTests() {
- // Standard complex64.
- v := complex(float32(6), -2)
- nv := (*complex64)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "complex64"
- vs := "(6-2i)"
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*"+vt+")(<nil>)\n")
-
- // Standard complex128.
- v2 := complex(float64(-6), 2)
- nv2 := (*complex128)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "complex128"
- v2s := "(-6+2i)"
- addDumpTest(v2, "("+v2t+") "+v2s+"\n")
- addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
- addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
- addDumpTest(nv2, "(*"+v2t+")(<nil>)\n")
-}
-
-func addArrayDumpTests() {
- // Array containing standard ints.
- v := [3]int{1, 2, 3}
- vLen := fmt.Sprintf("%d", len(v))
- vCap := fmt.Sprintf("%d", cap(v))
- nv := (*[3]int)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "int"
- vs := "(len=" + vLen + " cap=" + vCap + ") {\n (" + vt + ") 1,\n (" +
- vt + ") 2,\n (" + vt + ") 3\n}"
- addDumpTest(v, "([3]"+vt+") "+vs+"\n")
- addDumpTest(pv, "(*[3]"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**[3]"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*[3]"+vt+")(<nil>)\n")
-
- // Array containing type with custom formatter on pointer receiver only.
- v2i0 := pstringer("1")
- v2i1 := pstringer("2")
- v2i2 := pstringer("3")
- v2 := [3]pstringer{v2i0, v2i1, v2i2}
- v2i0Len := fmt.Sprintf("%d", len(v2i0))
- v2i1Len := fmt.Sprintf("%d", len(v2i1))
- v2i2Len := fmt.Sprintf("%d", len(v2i2))
- v2Len := fmt.Sprintf("%d", len(v2))
- v2Cap := fmt.Sprintf("%d", cap(v2))
- nv2 := (*[3]pstringer)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "spew_test.pstringer"
- v2sp := "(len=" + v2Len + " cap=" + v2Cap + ") {\n (" + v2t +
- ") (len=" + v2i0Len + ") stringer 1,\n (" + v2t +
- ") (len=" + v2i1Len + ") stringer 2,\n (" + v2t +
- ") (len=" + v2i2Len + ") " + "stringer 3\n}"
- v2s := v2sp
- if spew.UnsafeDisabled {
- v2s = "(len=" + v2Len + " cap=" + v2Cap + ") {\n (" + v2t +
- ") (len=" + v2i0Len + ") \"1\",\n (" + v2t + ") (len=" +
- v2i1Len + ") \"2\",\n (" + v2t + ") (len=" + v2i2Len +
- ") " + "\"3\"\n}"
- }
- addDumpTest(v2, "([3]"+v2t+") "+v2s+"\n")
- addDumpTest(pv2, "(*[3]"+v2t+")("+v2Addr+")("+v2sp+")\n")
- addDumpTest(&pv2, "(**[3]"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2sp+")\n")
- addDumpTest(nv2, "(*[3]"+v2t+")(<nil>)\n")
-
- // Array containing interfaces.
- v3i0 := "one"
- v3 := [3]interface{}{v3i0, int(2), uint(3)}
- v3i0Len := fmt.Sprintf("%d", len(v3i0))
- v3Len := fmt.Sprintf("%d", len(v3))
- v3Cap := fmt.Sprintf("%d", cap(v3))
- nv3 := (*[3]interface{})(nil)
- pv3 := &v3
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "[3]interface {}"
- v3t2 := "string"
- v3t3 := "int"
- v3t4 := "uint"
- v3s := "(len=" + v3Len + " cap=" + v3Cap + ") {\n (" + v3t2 + ") " +
- "(len=" + v3i0Len + ") \"one\",\n (" + v3t3 + ") 2,\n (" +
- v3t4 + ") 3\n}"
- addDumpTest(v3, "("+v3t+") "+v3s+"\n")
- addDumpTest(pv3, "(*"+v3t+")("+v3Addr+")("+v3s+")\n")
- addDumpTest(&pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")("+v3s+")\n")
- addDumpTest(nv3, "(*"+v3t+")(<nil>)\n")
-
- // Array containing bytes.
- v4 := [34]byte{
- 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
- 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
- 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
- 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
- 0x31, 0x32,
- }
- v4Len := fmt.Sprintf("%d", len(v4))
- v4Cap := fmt.Sprintf("%d", cap(v4))
- nv4 := (*[34]byte)(nil)
- pv4 := &v4
- v4Addr := fmt.Sprintf("%p", pv4)
- pv4Addr := fmt.Sprintf("%p", &pv4)
- v4t := "[34]uint8"
- v4s := "(len=" + v4Len + " cap=" + v4Cap + ") " +
- "{\n 00000000 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20" +
- " |............... |\n" +
- " 00000010 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30" +
- " |!\"#$%&'()*+,-./0|\n" +
- " 00000020 31 32 " +
- " |12|\n}"
- addDumpTest(v4, "("+v4t+") "+v4s+"\n")
- addDumpTest(pv4, "(*"+v4t+")("+v4Addr+")("+v4s+")\n")
- addDumpTest(&pv4, "(**"+v4t+")("+pv4Addr+"->"+v4Addr+")("+v4s+")\n")
- addDumpTest(nv4, "(*"+v4t+")(<nil>)\n")
-}
-
-func addSliceDumpTests() {
- // Slice containing standard float32 values.
- v := []float32{3.14, 6.28, 12.56}
- vLen := fmt.Sprintf("%d", len(v))
- vCap := fmt.Sprintf("%d", cap(v))
- nv := (*[]float32)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "float32"
- vs := "(len=" + vLen + " cap=" + vCap + ") {\n (" + vt + ") 3.14,\n (" +
- vt + ") 6.28,\n (" + vt + ") 12.56\n}"
- addDumpTest(v, "([]"+vt+") "+vs+"\n")
- addDumpTest(pv, "(*[]"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**[]"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*[]"+vt+")(<nil>)\n")
-
- // Slice containing type with custom formatter on pointer receiver only.
- v2i0 := pstringer("1")
- v2i1 := pstringer("2")
- v2i2 := pstringer("3")
- v2 := []pstringer{v2i0, v2i1, v2i2}
- v2i0Len := fmt.Sprintf("%d", len(v2i0))
- v2i1Len := fmt.Sprintf("%d", len(v2i1))
- v2i2Len := fmt.Sprintf("%d", len(v2i2))
- v2Len := fmt.Sprintf("%d", len(v2))
- v2Cap := fmt.Sprintf("%d", cap(v2))
- nv2 := (*[]pstringer)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "spew_test.pstringer"
- v2s := "(len=" + v2Len + " cap=" + v2Cap + ") {\n (" + v2t + ") (len=" +
- v2i0Len + ") stringer 1,\n (" + v2t + ") (len=" + v2i1Len +
- ") stringer 2,\n (" + v2t + ") (len=" + v2i2Len + ") " +
- "stringer 3\n}"
- addDumpTest(v2, "([]"+v2t+") "+v2s+"\n")
- addDumpTest(pv2, "(*[]"+v2t+")("+v2Addr+")("+v2s+")\n")
- addDumpTest(&pv2, "(**[]"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
- addDumpTest(nv2, "(*[]"+v2t+")(<nil>)\n")
-
- // Slice containing interfaces.
- v3i0 := "one"
- v3 := []interface{}{v3i0, int(2), uint(3), nil}
- v3i0Len := fmt.Sprintf("%d", len(v3i0))
- v3Len := fmt.Sprintf("%d", len(v3))
- v3Cap := fmt.Sprintf("%d", cap(v3))
- nv3 := (*[]interface{})(nil)
- pv3 := &v3
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "[]interface {}"
- v3t2 := "string"
- v3t3 := "int"
- v3t4 := "uint"
- v3t5 := "interface {}"
- v3s := "(len=" + v3Len + " cap=" + v3Cap + ") {\n (" + v3t2 + ") " +
- "(len=" + v3i0Len + ") \"one\",\n (" + v3t3 + ") 2,\n (" +
- v3t4 + ") 3,\n (" + v3t5 + ") <nil>\n}"
- addDumpTest(v3, "("+v3t+") "+v3s+"\n")
- addDumpTest(pv3, "(*"+v3t+")("+v3Addr+")("+v3s+")\n")
- addDumpTest(&pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")("+v3s+")\n")
- addDumpTest(nv3, "(*"+v3t+")(<nil>)\n")
-
- // Slice containing bytes.
- v4 := []byte{
- 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
- 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
- 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
- 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
- 0x31, 0x32,
- }
- v4Len := fmt.Sprintf("%d", len(v4))
- v4Cap := fmt.Sprintf("%d", cap(v4))
- nv4 := (*[]byte)(nil)
- pv4 := &v4
- v4Addr := fmt.Sprintf("%p", pv4)
- pv4Addr := fmt.Sprintf("%p", &pv4)
- v4t := "[]uint8"
- v4s := "(len=" + v4Len + " cap=" + v4Cap + ") " +
- "{\n 00000000 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20" +
- " |............... |\n" +
- " 00000010 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30" +
- " |!\"#$%&'()*+,-./0|\n" +
- " 00000020 31 32 " +
- " |12|\n}"
- addDumpTest(v4, "("+v4t+") "+v4s+"\n")
- addDumpTest(pv4, "(*"+v4t+")("+v4Addr+")("+v4s+")\n")
- addDumpTest(&pv4, "(**"+v4t+")("+pv4Addr+"->"+v4Addr+")("+v4s+")\n")
- addDumpTest(nv4, "(*"+v4t+")(<nil>)\n")
-
- // Nil slice.
- v5 := []int(nil)
- nv5 := (*[]int)(nil)
- pv5 := &v5
- v5Addr := fmt.Sprintf("%p", pv5)
- pv5Addr := fmt.Sprintf("%p", &pv5)
- v5t := "[]int"
- v5s := "<nil>"
- addDumpTest(v5, "("+v5t+") "+v5s+"\n")
- addDumpTest(pv5, "(*"+v5t+")("+v5Addr+")("+v5s+")\n")
- addDumpTest(&pv5, "(**"+v5t+")("+pv5Addr+"->"+v5Addr+")("+v5s+")\n")
- addDumpTest(nv5, "(*"+v5t+")(<nil>)\n")
-}
-
-func addStringDumpTests() {
- // Standard string.
- v := "test"
- vLen := fmt.Sprintf("%d", len(v))
- nv := (*string)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "string"
- vs := "(len=" + vLen + ") \"test\""
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*"+vt+")(<nil>)\n")
-}
-
-func addInterfaceDumpTests() {
- // Nil interface.
- var v interface{}
- nv := (*interface{})(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "interface {}"
- vs := "<nil>"
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*"+vt+")(<nil>)\n")
-
- // Sub-interface.
- v2 := interface{}(uint16(65535))
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "uint16"
- v2s := "65535"
- addDumpTest(v2, "("+v2t+") "+v2s+"\n")
- addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
- addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
-}
-
-func addMapDumpTests() {
- // Map with string keys and int vals.
- k := "one"
- kk := "two"
- m := map[string]int{k: 1, kk: 2}
- klen := fmt.Sprintf("%d", len(k)) // not kLen to shut golint up
- kkLen := fmt.Sprintf("%d", len(kk))
- mLen := fmt.Sprintf("%d", len(m))
- nilMap := map[string]int(nil)
- nm := (*map[string]int)(nil)
- pm := &m
- mAddr := fmt.Sprintf("%p", pm)
- pmAddr := fmt.Sprintf("%p", &pm)
- mt := "map[string]int"
- mt1 := "string"
- mt2 := "int"
- ms := "(len=" + mLen + ") {\n (" + mt1 + ") (len=" + klen + ") " +
- "\"one\": (" + mt2 + ") 1,\n (" + mt1 + ") (len=" + kkLen +
- ") \"two\": (" + mt2 + ") 2\n}"
- ms2 := "(len=" + mLen + ") {\n (" + mt1 + ") (len=" + kkLen + ") " +
- "\"two\": (" + mt2 + ") 2,\n (" + mt1 + ") (len=" + klen +
- ") \"one\": (" + mt2 + ") 1\n}"
- addDumpTest(m, "("+mt+") "+ms+"\n", "("+mt+") "+ms2+"\n")
- addDumpTest(pm, "(*"+mt+")("+mAddr+")("+ms+")\n",
- "(*"+mt+")("+mAddr+")("+ms2+")\n")
- addDumpTest(&pm, "(**"+mt+")("+pmAddr+"->"+mAddr+")("+ms+")\n",
- "(**"+mt+")("+pmAddr+"->"+mAddr+")("+ms2+")\n")
- addDumpTest(nm, "(*"+mt+")(<nil>)\n")
- addDumpTest(nilMap, "("+mt+") <nil>\n")
-
- // Map with custom formatter type on pointer receiver only keys and vals.
- k2 := pstringer("one")
- v2 := pstringer("1")
- m2 := map[pstringer]pstringer{k2: v2}
- k2Len := fmt.Sprintf("%d", len(k2))
- v2Len := fmt.Sprintf("%d", len(v2))
- m2Len := fmt.Sprintf("%d", len(m2))
- nilMap2 := map[pstringer]pstringer(nil)
- nm2 := (*map[pstringer]pstringer)(nil)
- pm2 := &m2
- m2Addr := fmt.Sprintf("%p", pm2)
- pm2Addr := fmt.Sprintf("%p", &pm2)
- m2t := "map[spew_test.pstringer]spew_test.pstringer"
- m2t1 := "spew_test.pstringer"
- m2t2 := "spew_test.pstringer"
- m2s := "(len=" + m2Len + ") {\n (" + m2t1 + ") (len=" + k2Len + ") " +
- "stringer one: (" + m2t2 + ") (len=" + v2Len + ") stringer 1\n}"
- if spew.UnsafeDisabled {
- m2s = "(len=" + m2Len + ") {\n (" + m2t1 + ") (len=" + k2Len +
- ") " + "\"one\": (" + m2t2 + ") (len=" + v2Len +
- ") \"1\"\n}"
- }
- addDumpTest(m2, "("+m2t+") "+m2s+"\n")
- addDumpTest(pm2, "(*"+m2t+")("+m2Addr+")("+m2s+")\n")
- addDumpTest(&pm2, "(**"+m2t+")("+pm2Addr+"->"+m2Addr+")("+m2s+")\n")
- addDumpTest(nm2, "(*"+m2t+")(<nil>)\n")
- addDumpTest(nilMap2, "("+m2t+") <nil>\n")
-
- // Map with interface keys and values.
- k3 := "one"
- k3Len := fmt.Sprintf("%d", len(k3))
- m3 := map[interface{}]interface{}{k3: 1}
- m3Len := fmt.Sprintf("%d", len(m3))
- nilMap3 := map[interface{}]interface{}(nil)
- nm3 := (*map[interface{}]interface{})(nil)
- pm3 := &m3
- m3Addr := fmt.Sprintf("%p", pm3)
- pm3Addr := fmt.Sprintf("%p", &pm3)
- m3t := "map[interface {}]interface {}"
- m3t1 := "string"
- m3t2 := "int"
- m3s := "(len=" + m3Len + ") {\n (" + m3t1 + ") (len=" + k3Len + ") " +
- "\"one\": (" + m3t2 + ") 1\n}"
- addDumpTest(m3, "("+m3t+") "+m3s+"\n")
- addDumpTest(pm3, "(*"+m3t+")("+m3Addr+")("+m3s+")\n")
- addDumpTest(&pm3, "(**"+m3t+")("+pm3Addr+"->"+m3Addr+")("+m3s+")\n")
- addDumpTest(nm3, "(*"+m3t+")(<nil>)\n")
- addDumpTest(nilMap3, "("+m3t+") <nil>\n")
-
- // Map with nil interface value.
- k4 := "nil"
- k4Len := fmt.Sprintf("%d", len(k4))
- m4 := map[string]interface{}{k4: nil}
- m4Len := fmt.Sprintf("%d", len(m4))
- nilMap4 := map[string]interface{}(nil)
- nm4 := (*map[string]interface{})(nil)
- pm4 := &m4
- m4Addr := fmt.Sprintf("%p", pm4)
- pm4Addr := fmt.Sprintf("%p", &pm4)
- m4t := "map[string]interface {}"
- m4t1 := "string"
- m4t2 := "interface {}"
- m4s := "(len=" + m4Len + ") {\n (" + m4t1 + ") (len=" + k4Len + ")" +
- " \"nil\": (" + m4t2 + ") <nil>\n}"
- addDumpTest(m4, "("+m4t+") "+m4s+"\n")
- addDumpTest(pm4, "(*"+m4t+")("+m4Addr+")("+m4s+")\n")
- addDumpTest(&pm4, "(**"+m4t+")("+pm4Addr+"->"+m4Addr+")("+m4s+")\n")
- addDumpTest(nm4, "(*"+m4t+")(<nil>)\n")
- addDumpTest(nilMap4, "("+m4t+") <nil>\n")
-}
-
-func addStructDumpTests() {
- // Struct with primitives.
- type s1 struct {
- a int8
- b uint8
- }
- v := s1{127, 255}
- nv := (*s1)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "spew_test.s1"
- vt2 := "int8"
- vt3 := "uint8"
- vs := "{\n a: (" + vt2 + ") 127,\n b: (" + vt3 + ") 255\n}"
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*"+vt+")(<nil>)\n")
-
- // Struct that contains another struct.
- type s2 struct {
- s1 s1
- b bool
- }
- v2 := s2{s1{127, 255}, true}
- nv2 := (*s2)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "spew_test.s2"
- v2t2 := "spew_test.s1"
- v2t3 := "int8"
- v2t4 := "uint8"
- v2t5 := "bool"
- v2s := "{\n s1: (" + v2t2 + ") {\n a: (" + v2t3 + ") 127,\n b: (" +
- v2t4 + ") 255\n },\n b: (" + v2t5 + ") true\n}"
- addDumpTest(v2, "("+v2t+") "+v2s+"\n")
- addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
- addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
- addDumpTest(nv2, "(*"+v2t+")(<nil>)\n")
-
- // Struct that contains custom type with Stringer pointer interface via both
- // exported and unexported fields.
- type s3 struct {
- s pstringer
- S pstringer
- }
- v3 := s3{"test", "test2"}
- nv3 := (*s3)(nil)
- pv3 := &v3
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "spew_test.s3"
- v3t2 := "spew_test.pstringer"
- v3s := "{\n s: (" + v3t2 + ") (len=4) stringer test,\n S: (" + v3t2 +
- ") (len=5) stringer test2\n}"
- v3sp := v3s
- if spew.UnsafeDisabled {
- v3s = "{\n s: (" + v3t2 + ") (len=4) \"test\",\n S: (" +
- v3t2 + ") (len=5) \"test2\"\n}"
- v3sp = "{\n s: (" + v3t2 + ") (len=4) \"test\",\n S: (" +
- v3t2 + ") (len=5) stringer test2\n}"
- }
- addDumpTest(v3, "("+v3t+") "+v3s+"\n")
- addDumpTest(pv3, "(*"+v3t+")("+v3Addr+")("+v3sp+")\n")
- addDumpTest(&pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")("+v3sp+")\n")
- addDumpTest(nv3, "(*"+v3t+")(<nil>)\n")
-
- // Struct that contains embedded struct and field to same struct.
- e := embed{"embedstr"}
- eLen := fmt.Sprintf("%d", len("embedstr"))
- v4 := embedwrap{embed: &e, e: &e}
- nv4 := (*embedwrap)(nil)
- pv4 := &v4
- eAddr := fmt.Sprintf("%p", &e)
- v4Addr := fmt.Sprintf("%p", pv4)
- pv4Addr := fmt.Sprintf("%p", &pv4)
- v4t := "spew_test.embedwrap"
- v4t2 := "spew_test.embed"
- v4t3 := "string"
- v4s := "{\n embed: (*" + v4t2 + ")(" + eAddr + ")({\n a: (" + v4t3 +
- ") (len=" + eLen + ") \"embedstr\"\n }),\n e: (*" + v4t2 +
- ")(" + eAddr + ")({\n a: (" + v4t3 + ") (len=" + eLen + ")" +
- " \"embedstr\"\n })\n}"
- addDumpTest(v4, "("+v4t+") "+v4s+"\n")
- addDumpTest(pv4, "(*"+v4t+")("+v4Addr+")("+v4s+")\n")
- addDumpTest(&pv4, "(**"+v4t+")("+pv4Addr+"->"+v4Addr+")("+v4s+")\n")
- addDumpTest(nv4, "(*"+v4t+")(<nil>)\n")
-}
-
-func addUintptrDumpTests() {
- // Null pointer.
- v := uintptr(0)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "uintptr"
- vs := "<nil>"
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
-
- // Address of real variable.
- i := 1
- v2 := uintptr(unsafe.Pointer(&i))
- nv2 := (*uintptr)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "uintptr"
- v2s := fmt.Sprintf("%p", &i)
- addDumpTest(v2, "("+v2t+") "+v2s+"\n")
- addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
- addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
- addDumpTest(nv2, "(*"+v2t+")(<nil>)\n")
-}
-
-func addUnsafePointerDumpTests() {
- // Null pointer.
- v := unsafe.Pointer(uintptr(0))
- nv := (*unsafe.Pointer)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "unsafe.Pointer"
- vs := "<nil>"
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*"+vt+")(<nil>)\n")
-
- // Address of real variable.
- i := 1
- v2 := unsafe.Pointer(&i)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "unsafe.Pointer"
- v2s := fmt.Sprintf("%p", &i)
- addDumpTest(v2, "("+v2t+") "+v2s+"\n")
- addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
- addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
- addDumpTest(nv, "(*"+vt+")(<nil>)\n")
-}
-
-func addChanDumpTests() {
- // Nil channel.
- var v chan int
- pv := &v
- nv := (*chan int)(nil)
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "chan int"
- vs := "<nil>"
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*"+vt+")(<nil>)\n")
-
- // Real channel.
- v2 := make(chan int)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "chan int"
- v2s := fmt.Sprintf("%p", v2)
- addDumpTest(v2, "("+v2t+") "+v2s+"\n")
- addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
- addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
-}
-
-func addFuncDumpTests() {
- // Function with no params and no returns.
- v := addIntDumpTests
- nv := (*func())(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "func()"
- vs := fmt.Sprintf("%p", v)
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*"+vt+")(<nil>)\n")
-
- // Function with param and no returns.
- v2 := TestDump
- nv2 := (*func(*testing.T))(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "func(*testing.T)"
- v2s := fmt.Sprintf("%p", v2)
- addDumpTest(v2, "("+v2t+") "+v2s+"\n")
- addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
- addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
- addDumpTest(nv2, "(*"+v2t+")(<nil>)\n")
-
- // Function with multiple params and multiple returns.
- var v3 = func(i int, s string) (b bool, err error) {
- return true, nil
- }
- nv3 := (*func(int, string) (bool, error))(nil)
- pv3 := &v3
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "func(int, string) (bool, error)"
- v3s := fmt.Sprintf("%p", v3)
- addDumpTest(v3, "("+v3t+") "+v3s+"\n")
- addDumpTest(pv3, "(*"+v3t+")("+v3Addr+")("+v3s+")\n")
- addDumpTest(&pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")("+v3s+")\n")
- addDumpTest(nv3, "(*"+v3t+")(<nil>)\n")
-}
-
-func addCircularDumpTests() {
- // Struct that is circular through self referencing.
- type circular struct {
- c *circular
- }
- v := circular{nil}
- v.c = &v
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "spew_test.circular"
- vs := "{\n c: (*" + vt + ")(" + vAddr + ")({\n c: (*" + vt + ")(" +
- vAddr + ")(<already shown>)\n })\n}"
- vs2 := "{\n c: (*" + vt + ")(" + vAddr + ")(<already shown>)\n}"
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs2+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs2+")\n")
-
- // Structs that are circular through cross referencing.
- v2 := xref1{nil}
- ts2 := xref2{&v2}
- v2.ps2 = &ts2
- pv2 := &v2
- ts2Addr := fmt.Sprintf("%p", &ts2)
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "spew_test.xref1"
- v2t2 := "spew_test.xref2"
- v2s := "{\n ps2: (*" + v2t2 + ")(" + ts2Addr + ")({\n ps1: (*" + v2t +
- ")(" + v2Addr + ")({\n ps2: (*" + v2t2 + ")(" + ts2Addr +
- ")(<already shown>)\n })\n })\n}"
- v2s2 := "{\n ps2: (*" + v2t2 + ")(" + ts2Addr + ")({\n ps1: (*" + v2t +
- ")(" + v2Addr + ")(<already shown>)\n })\n}"
- addDumpTest(v2, "("+v2t+") "+v2s+"\n")
- addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s2+")\n")
- addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s2+")\n")
-
- // Structs that are indirectly circular.
- v3 := indirCir1{nil}
- tic2 := indirCir2{nil}
- tic3 := indirCir3{&v3}
- tic2.ps3 = &tic3
- v3.ps2 = &tic2
- pv3 := &v3
- tic2Addr := fmt.Sprintf("%p", &tic2)
- tic3Addr := fmt.Sprintf("%p", &tic3)
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "spew_test.indirCir1"
- v3t2 := "spew_test.indirCir2"
- v3t3 := "spew_test.indirCir3"
- v3s := "{\n ps2: (*" + v3t2 + ")(" + tic2Addr + ")({\n ps3: (*" + v3t3 +
- ")(" + tic3Addr + ")({\n ps1: (*" + v3t + ")(" + v3Addr +
- ")({\n ps2: (*" + v3t2 + ")(" + tic2Addr +
- ")(<already shown>)\n })\n })\n })\n}"
- v3s2 := "{\n ps2: (*" + v3t2 + ")(" + tic2Addr + ")({\n ps3: (*" + v3t3 +
- ")(" + tic3Addr + ")({\n ps1: (*" + v3t + ")(" + v3Addr +
- ")(<already shown>)\n })\n })\n}"
- addDumpTest(v3, "("+v3t+") "+v3s+"\n")
- addDumpTest(pv3, "(*"+v3t+")("+v3Addr+")("+v3s2+")\n")
- addDumpTest(&pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")("+v3s2+")\n")
-}
-
-func addPanicDumpTests() {
- // Type that panics in its Stringer interface.
- v := panicer(127)
- nv := (*panicer)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "spew_test.panicer"
- vs := "(PANIC=test panic)127"
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*"+vt+")(<nil>)\n")
-}
-
-func addErrorDumpTests() {
- // Type that has a custom Error interface.
- v := customError(127)
- nv := (*customError)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "spew_test.customError"
- vs := "error: 127"
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*"+vt+")(<nil>)\n")
-}
-
-// TestDump executes all of the tests described by dumpTests.
-func TestDump(t *testing.T) {
- // Setup tests.
- addIntDumpTests()
- addUintDumpTests()
- addBoolDumpTests()
- addFloatDumpTests()
- addComplexDumpTests()
- addArrayDumpTests()
- addSliceDumpTests()
- addStringDumpTests()
- addInterfaceDumpTests()
- addMapDumpTests()
- addStructDumpTests()
- addUintptrDumpTests()
- addUnsafePointerDumpTests()
- addChanDumpTests()
- addFuncDumpTests()
- addCircularDumpTests()
- addPanicDumpTests()
- addErrorDumpTests()
- addCgoDumpTests()
-
- t.Logf("Running %d tests", len(dumpTests))
- for i, test := range dumpTests {
- buf := new(bytes.Buffer)
- spew.Fdump(buf, test.in)
- s := buf.String()
- if testFailed(s, test.wants) {
- t.Errorf("Dump #%d\n got: %s %s", i, s, stringizeWants(test.wants))
- continue
- }
- }
-}
-
-func TestDumpSortedKeys(t *testing.T) {
- cfg := spew.ConfigState{SortKeys: true}
- s := cfg.Sdump(map[int]string{1: "1", 3: "3", 2: "2"})
- expected := "(map[int]string) (len=3) {\n(int) 1: (string) (len=1) " +
- "\"1\",\n(int) 2: (string) (len=1) \"2\",\n(int) 3: (string) " +
- "(len=1) \"3\"\n" +
- "}\n"
- if s != expected {
- t.Errorf("Sorted keys mismatch:\n %v %v", s, expected)
- }
-
- s = cfg.Sdump(map[stringer]int{"1": 1, "3": 3, "2": 2})
- expected = "(map[spew_test.stringer]int) (len=3) {\n" +
- "(spew_test.stringer) (len=1) stringer 1: (int) 1,\n" +
- "(spew_test.stringer) (len=1) stringer 2: (int) 2,\n" +
- "(spew_test.stringer) (len=1) stringer 3: (int) 3\n" +
- "}\n"
- if s != expected {
- t.Errorf("Sorted keys mismatch:\n %v %v", s, expected)
- }
-
- s = cfg.Sdump(map[pstringer]int{pstringer("1"): 1, pstringer("3"): 3, pstringer("2"): 2})
- expected = "(map[spew_test.pstringer]int) (len=3) {\n" +
- "(spew_test.pstringer) (len=1) stringer 1: (int) 1,\n" +
- "(spew_test.pstringer) (len=1) stringer 2: (int) 2,\n" +
- "(spew_test.pstringer) (len=1) stringer 3: (int) 3\n" +
- "}\n"
- if spew.UnsafeDisabled {
- expected = "(map[spew_test.pstringer]int) (len=3) {\n" +
- "(spew_test.pstringer) (len=1) \"1\": (int) 1,\n" +
- "(spew_test.pstringer) (len=1) \"2\": (int) 2,\n" +
- "(spew_test.pstringer) (len=1) \"3\": (int) 3\n" +
- "}\n"
- }
- if s != expected {
- t.Errorf("Sorted keys mismatch:\n %v %v", s, expected)
- }
-
- s = cfg.Sdump(map[customError]int{customError(1): 1, customError(3): 3, customError(2): 2})
- expected = "(map[spew_test.customError]int) (len=3) {\n" +
- "(spew_test.customError) error: 1: (int) 1,\n" +
- "(spew_test.customError) error: 2: (int) 2,\n" +
- "(spew_test.customError) error: 3: (int) 3\n" +
- "}\n"
- if s != expected {
- t.Errorf("Sorted keys mismatch:\n %v %v", s, expected)
- }
-
-}
diff --git a/vendor/github.com/davecgh/go-spew/spew/dumpcgo_test.go b/vendor/github.com/davecgh/go-spew/spew/dumpcgo_test.go
deleted file mode 100644
index 6ab180809..000000000
--- a/vendor/github.com/davecgh/go-spew/spew/dumpcgo_test.go
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
-//
-// Permission to use, copy, modify, and distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-// NOTE: Due to the following build constraints, this file will only be compiled
-// when both cgo is supported and "-tags testcgo" is added to the go test
-// command line. This means the cgo tests are only added (and hence run) when
-// specifially requested. This configuration is used because spew itself
-// does not require cgo to run even though it does handle certain cgo types
-// specially. Rather than forcing all clients to require cgo and an external
-// C compiler just to run the tests, this scheme makes them optional.
-// +build cgo,testcgo
-
-package spew_test
-
-import (
- "fmt"
-
- "github.com/davecgh/go-spew/spew/testdata"
-)
-
-func addCgoDumpTests() {
- // C char pointer.
- v := testdata.GetCgoCharPointer()
- nv := testdata.GetCgoNullCharPointer()
- pv := &v
- vcAddr := fmt.Sprintf("%p", v)
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "*testdata._Ctype_char"
- vs := "116"
- addDumpTest(v, "("+vt+")("+vcAddr+")("+vs+")\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+"->"+vcAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+"->"+vcAddr+")("+vs+")\n")
- addDumpTest(nv, "("+vt+")(<nil>)\n")
-
- // C char array.
- v2, v2l, v2c := testdata.GetCgoCharArray()
- v2Len := fmt.Sprintf("%d", v2l)
- v2Cap := fmt.Sprintf("%d", v2c)
- v2t := "[6]testdata._Ctype_char"
- v2s := "(len=" + v2Len + " cap=" + v2Cap + ") " +
- "{\n 00000000 74 65 73 74 32 00 " +
- " |test2.|\n}"
- addDumpTest(v2, "("+v2t+") "+v2s+"\n")
-
- // C unsigned char array.
- v3, v3l, v3c := testdata.GetCgoUnsignedCharArray()
- v3Len := fmt.Sprintf("%d", v3l)
- v3Cap := fmt.Sprintf("%d", v3c)
- v3t := "[6]testdata._Ctype_unsignedchar"
- v3t2 := "[6]testdata._Ctype_uchar"
- v3s := "(len=" + v3Len + " cap=" + v3Cap + ") " +
- "{\n 00000000 74 65 73 74 33 00 " +
- " |test3.|\n}"
- addDumpTest(v3, "("+v3t+") "+v3s+"\n", "("+v3t2+") "+v3s+"\n")
-
- // C signed char array.
- v4, v4l, v4c := testdata.GetCgoSignedCharArray()
- v4Len := fmt.Sprintf("%d", v4l)
- v4Cap := fmt.Sprintf("%d", v4c)
- v4t := "[6]testdata._Ctype_schar"
- v4t2 := "testdata._Ctype_schar"
- v4s := "(len=" + v4Len + " cap=" + v4Cap + ") " +
- "{\n (" + v4t2 + ") 116,\n (" + v4t2 + ") 101,\n (" + v4t2 +
- ") 115,\n (" + v4t2 + ") 116,\n (" + v4t2 + ") 52,\n (" + v4t2 +
- ") 0\n}"
- addDumpTest(v4, "("+v4t+") "+v4s+"\n")
-
- // C uint8_t array.
- v5, v5l, v5c := testdata.GetCgoUint8tArray()
- v5Len := fmt.Sprintf("%d", v5l)
- v5Cap := fmt.Sprintf("%d", v5c)
- v5t := "[6]testdata._Ctype_uint8_t"
- v5s := "(len=" + v5Len + " cap=" + v5Cap + ") " +
- "{\n 00000000 74 65 73 74 35 00 " +
- " |test5.|\n}"
- addDumpTest(v5, "("+v5t+") "+v5s+"\n")
-
- // C typedefed unsigned char array.
- v6, v6l, v6c := testdata.GetCgoTypdefedUnsignedCharArray()
- v6Len := fmt.Sprintf("%d", v6l)
- v6Cap := fmt.Sprintf("%d", v6c)
- v6t := "[6]testdata._Ctype_custom_uchar_t"
- v6s := "(len=" + v6Len + " cap=" + v6Cap + ") " +
- "{\n 00000000 74 65 73 74 36 00 " +
- " |test6.|\n}"
- addDumpTest(v6, "("+v6t+") "+v6s+"\n")
-}
diff --git a/vendor/github.com/davecgh/go-spew/spew/dumpnocgo_test.go b/vendor/github.com/davecgh/go-spew/spew/dumpnocgo_test.go
deleted file mode 100644
index 52a0971fb..000000000
--- a/vendor/github.com/davecgh/go-spew/spew/dumpnocgo_test.go
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2013 Dave Collins <dave@davec.name>
-//
-// Permission to use, copy, modify, and distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-// NOTE: Due to the following build constraints, this file will only be compiled
-// when either cgo is not supported or "-tags testcgo" is not added to the go
-// test command line. This file intentionally does not setup any cgo tests in
-// this scenario.
-// +build !cgo !testcgo
-
-package spew_test
-
-func addCgoDumpTests() {
- // Don't add any tests for cgo since this file is only compiled when
- // there should not be any cgo tests.
-}
diff --git a/vendor/github.com/davecgh/go-spew/spew/example_test.go b/vendor/github.com/davecgh/go-spew/spew/example_test.go
deleted file mode 100644
index c6ec8c6d5..000000000
--- a/vendor/github.com/davecgh/go-spew/spew/example_test.go
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-package spew_test
-
-import (
- "fmt"
-
- "github.com/davecgh/go-spew/spew"
-)
-
-type Flag int
-
-const (
- flagOne Flag = iota
- flagTwo
-)
-
-var flagStrings = map[Flag]string{
- flagOne: "flagOne",
- flagTwo: "flagTwo",
-}
-
-func (f Flag) String() string {
- if s, ok := flagStrings[f]; ok {
- return s
- }
- return fmt.Sprintf("Unknown flag (%d)", int(f))
-}
-
-type Bar struct {
- data uintptr
-}
-
-type Foo struct {
- unexportedField Bar
- ExportedField map[interface{}]interface{}
-}
-
-// This example demonstrates how to use Dump to dump variables to stdout.
-func ExampleDump() {
- // The following package level declarations are assumed for this example:
- /*
- type Flag int
-
- const (
- flagOne Flag = iota
- flagTwo
- )
-
- var flagStrings = map[Flag]string{
- flagOne: "flagOne",
- flagTwo: "flagTwo",
- }
-
- func (f Flag) String() string {
- if s, ok := flagStrings[f]; ok {
- return s
- }
- return fmt.Sprintf("Unknown flag (%d)", int(f))
- }
-
- type Bar struct {
- data uintptr
- }
-
- type Foo struct {
- unexportedField Bar
- ExportedField map[interface{}]interface{}
- }
- */
-
- // Setup some sample data structures for the example.
- bar := Bar{uintptr(0)}
- s1 := Foo{bar, map[interface{}]interface{}{"one": true}}
- f := Flag(5)
- b := []byte{
- 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
- 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
- 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
- 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
- 0x31, 0x32,
- }
-
- // Dump!
- spew.Dump(s1, f, b)
-
- // Output:
- // (spew_test.Foo) {
- // unexportedField: (spew_test.Bar) {
- // data: (uintptr) <nil>
- // },
- // ExportedField: (map[interface {}]interface {}) (len=1) {
- // (string) (len=3) "one": (bool) true
- // }
- // }
- // (spew_test.Flag) Unknown flag (5)
- // ([]uint8) (len=34 cap=34) {
- // 00000000 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 |............... |
- // 00000010 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 |!"#$%&'()*+,-./0|
- // 00000020 31 32 |12|
- // }
- //
-}
-
-// This example demonstrates how to use Printf to display a variable with a
-// format string and inline formatting.
-func ExamplePrintf() {
- // Create a double pointer to a uint 8.
- ui8 := uint8(5)
- pui8 := &ui8
- ppui8 := &pui8
-
- // Create a circular data type.
- type circular struct {
- ui8 uint8
- c *circular
- }
- c := circular{ui8: 1}
- c.c = &c
-
- // Print!
- spew.Printf("ppui8: %v\n", ppui8)
- spew.Printf("circular: %v\n", c)
-
- // Output:
- // ppui8: <**>5
- // circular: {1 <*>{1 <*><shown>}}
-}
-
-// This example demonstrates how to use a ConfigState.
-func ExampleConfigState() {
- // Modify the indent level of the ConfigState only. The global
- // configuration is not modified.
- scs := spew.ConfigState{Indent: "\t"}
-
- // Output using the ConfigState instance.
- v := map[string]int{"one": 1}
- scs.Printf("v: %v\n", v)
- scs.Dump(v)
-
- // Output:
- // v: map[one:1]
- // (map[string]int) (len=1) {
- // (string) (len=3) "one": (int) 1
- // }
-}
-
-// This example demonstrates how to use ConfigState.Dump to dump variables to
-// stdout
-func ExampleConfigState_Dump() {
- // See the top-level Dump example for details on the types used in this
- // example.
-
- // Create two ConfigState instances with different indentation.
- scs := spew.ConfigState{Indent: "\t"}
- scs2 := spew.ConfigState{Indent: " "}
-
- // Setup some sample data structures for the example.
- bar := Bar{uintptr(0)}
- s1 := Foo{bar, map[interface{}]interface{}{"one": true}}
-
- // Dump using the ConfigState instances.
- scs.Dump(s1)
- scs2.Dump(s1)
-
- // Output:
- // (spew_test.Foo) {
- // unexportedField: (spew_test.Bar) {
- // data: (uintptr) <nil>
- // },
- // ExportedField: (map[interface {}]interface {}) (len=1) {
- // (string) (len=3) "one": (bool) true
- // }
- // }
- // (spew_test.Foo) {
- // unexportedField: (spew_test.Bar) {
- // data: (uintptr) <nil>
- // },
- // ExportedField: (map[interface {}]interface {}) (len=1) {
- // (string) (len=3) "one": (bool) true
- // }
- // }
- //
-}
-
-// This example demonstrates how to use ConfigState.Printf to display a variable
-// with a format string and inline formatting.
-func ExampleConfigState_Printf() {
- // See the top-level Dump example for details on the types used in this
- // example.
-
- // Create two ConfigState instances and modify the method handling of the
- // first ConfigState only.
- scs := spew.NewDefaultConfig()
- scs2 := spew.NewDefaultConfig()
- scs.DisableMethods = true
-
- // Alternatively
- // scs := spew.ConfigState{Indent: " ", DisableMethods: true}
- // scs2 := spew.ConfigState{Indent: " "}
-
- // This is of type Flag which implements a Stringer and has raw value 1.
- f := flagTwo
-
- // Dump using the ConfigState instances.
- scs.Printf("f: %v\n", f)
- scs2.Printf("f: %v\n", f)
-
- // Output:
- // f: 1
- // f: flagTwo
-}
diff --git a/vendor/github.com/davecgh/go-spew/spew/format_test.go b/vendor/github.com/davecgh/go-spew/spew/format_test.go
deleted file mode 100644
index f9b93abe8..000000000
--- a/vendor/github.com/davecgh/go-spew/spew/format_test.go
+++ /dev/null
@@ -1,1558 +0,0 @@
-/*
- * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
-Test Summary:
-NOTE: For each test, a nil pointer, a single pointer and double pointer to the
-base test element are also tested to ensure proper indirection across all types.
-
-- Max int8, int16, int32, int64, int
-- Max uint8, uint16, uint32, uint64, uint
-- Boolean true and false
-- Standard complex64 and complex128
-- Array containing standard ints
-- Array containing type with custom formatter on pointer receiver only
-- Array containing interfaces
-- Slice containing standard float32 values
-- Slice containing type with custom formatter on pointer receiver only
-- Slice containing interfaces
-- Nil slice
-- Standard string
-- Nil interface
-- Sub-interface
-- Map with string keys and int vals
-- Map with custom formatter type on pointer receiver only keys and vals
-- Map with interface keys and values
-- Map with nil interface value
-- Struct with primitives
-- Struct that contains another struct
-- Struct that contains custom type with Stringer pointer interface via both
- exported and unexported fields
-- Struct that contains embedded struct and field to same struct
-- Uintptr to 0 (null pointer)
-- Uintptr address of real variable
-- Unsafe.Pointer to 0 (null pointer)
-- Unsafe.Pointer to address of real variable
-- Nil channel
-- Standard int channel
-- Function with no params and no returns
-- Function with param and no returns
-- Function with multiple params and multiple returns
-- Struct that is circular through self referencing
-- Structs that are circular through cross referencing
-- Structs that are indirectly circular
-- Type that panics in its Stringer interface
-- Type that has a custom Error interface
-- %x passthrough with uint
-- %#x passthrough with uint
-- %f passthrough with precision
-- %f passthrough with width and precision
-- %d passthrough with width
-- %q passthrough with string
-*/
-
-package spew_test
-
-import (
- "bytes"
- "fmt"
- "testing"
- "unsafe"
-
- "github.com/davecgh/go-spew/spew"
-)
-
-// formatterTest is used to describe a test to be performed against NewFormatter.
-type formatterTest struct {
- format string
- in interface{}
- wants []string
-}
-
-// formatterTests houses all of the tests to be performed against NewFormatter.
-var formatterTests = make([]formatterTest, 0)
-
-// addFormatterTest is a helper method to append the passed input and desired
-// result to formatterTests.
-func addFormatterTest(format string, in interface{}, wants ...string) {
- test := formatterTest{format, in, wants}
- formatterTests = append(formatterTests, test)
-}
-
-func addIntFormatterTests() {
- // Max int8.
- v := int8(127)
- nv := (*int8)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "int8"
- vs := "127"
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%v", nv, "<nil>")
- addFormatterTest("%+v", v, vs)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%+v", nv, "<nil>")
- addFormatterTest("%#v", v, "("+vt+")"+vs)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"<nil>")
- addFormatterTest("%#+v", v, "("+vt+")"+vs)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"<nil>")
-
- // Max int16.
- v2 := int16(32767)
- nv2 := (*int16)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "int16"
- v2s := "32767"
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s)
- addFormatterTest("%v", &pv2, "<**>"+v2s)
- addFormatterTest("%v", nv2, "<nil>")
- addFormatterTest("%+v", v2, v2s)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%+v", nv2, "<nil>")
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s)
- addFormatterTest("%#v", nv2, "(*"+v2t+")"+"<nil>")
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%#+v", nv2, "(*"+v2t+")"+"<nil>")
-
- // Max int32.
- v3 := int32(2147483647)
- nv3 := (*int32)(nil)
- pv3 := &v3
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "int32"
- v3s := "2147483647"
- addFormatterTest("%v", v3, v3s)
- addFormatterTest("%v", pv3, "<*>"+v3s)
- addFormatterTest("%v", &pv3, "<**>"+v3s)
- addFormatterTest("%v", nv3, "<nil>")
- addFormatterTest("%+v", v3, v3s)
- addFormatterTest("%+v", pv3, "<*>("+v3Addr+")"+v3s)
- addFormatterTest("%+v", &pv3, "<**>("+pv3Addr+"->"+v3Addr+")"+v3s)
- addFormatterTest("%+v", nv3, "<nil>")
- addFormatterTest("%#v", v3, "("+v3t+")"+v3s)
- addFormatterTest("%#v", pv3, "(*"+v3t+")"+v3s)
- addFormatterTest("%#v", &pv3, "(**"+v3t+")"+v3s)
- addFormatterTest("%#v", nv3, "(*"+v3t+")"+"<nil>")
- addFormatterTest("%#+v", v3, "("+v3t+")"+v3s)
- addFormatterTest("%#+v", pv3, "(*"+v3t+")("+v3Addr+")"+v3s)
- addFormatterTest("%#+v", &pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")"+v3s)
- addFormatterTest("%#v", nv3, "(*"+v3t+")"+"<nil>")
-
- // Max int64.
- v4 := int64(9223372036854775807)
- nv4 := (*int64)(nil)
- pv4 := &v4
- v4Addr := fmt.Sprintf("%p", pv4)
- pv4Addr := fmt.Sprintf("%p", &pv4)
- v4t := "int64"
- v4s := "9223372036854775807"
- addFormatterTest("%v", v4, v4s)
- addFormatterTest("%v", pv4, "<*>"+v4s)
- addFormatterTest("%v", &pv4, "<**>"+v4s)
- addFormatterTest("%v", nv4, "<nil>")
- addFormatterTest("%+v", v4, v4s)
- addFormatterTest("%+v", pv4, "<*>("+v4Addr+")"+v4s)
- addFormatterTest("%+v", &pv4, "<**>("+pv4Addr+"->"+v4Addr+")"+v4s)
- addFormatterTest("%+v", nv4, "<nil>")
- addFormatterTest("%#v", v4, "("+v4t+")"+v4s)
- addFormatterTest("%#v", pv4, "(*"+v4t+")"+v4s)
- addFormatterTest("%#v", &pv4, "(**"+v4t+")"+v4s)
- addFormatterTest("%#v", nv4, "(*"+v4t+")"+"<nil>")
- addFormatterTest("%#+v", v4, "("+v4t+")"+v4s)
- addFormatterTest("%#+v", pv4, "(*"+v4t+")("+v4Addr+")"+v4s)
- addFormatterTest("%#+v", &pv4, "(**"+v4t+")("+pv4Addr+"->"+v4Addr+")"+v4s)
- addFormatterTest("%#+v", nv4, "(*"+v4t+")"+"<nil>")
-
- // Max int.
- v5 := int(2147483647)
- nv5 := (*int)(nil)
- pv5 := &v5
- v5Addr := fmt.Sprintf("%p", pv5)
- pv5Addr := fmt.Sprintf("%p", &pv5)
- v5t := "int"
- v5s := "2147483647"
- addFormatterTest("%v", v5, v5s)
- addFormatterTest("%v", pv5, "<*>"+v5s)
- addFormatterTest("%v", &pv5, "<**>"+v5s)
- addFormatterTest("%v", nv5, "<nil>")
- addFormatterTest("%+v", v5, v5s)
- addFormatterTest("%+v", pv5, "<*>("+v5Addr+")"+v5s)
- addFormatterTest("%+v", &pv5, "<**>("+pv5Addr+"->"+v5Addr+")"+v5s)
- addFormatterTest("%+v", nv5, "<nil>")
- addFormatterTest("%#v", v5, "("+v5t+")"+v5s)
- addFormatterTest("%#v", pv5, "(*"+v5t+")"+v5s)
- addFormatterTest("%#v", &pv5, "(**"+v5t+")"+v5s)
- addFormatterTest("%#v", nv5, "(*"+v5t+")"+"<nil>")
- addFormatterTest("%#+v", v5, "("+v5t+")"+v5s)
- addFormatterTest("%#+v", pv5, "(*"+v5t+")("+v5Addr+")"+v5s)
- addFormatterTest("%#+v", &pv5, "(**"+v5t+")("+pv5Addr+"->"+v5Addr+")"+v5s)
- addFormatterTest("%#+v", nv5, "(*"+v5t+")"+"<nil>")
-}
-
-func addUintFormatterTests() {
- // Max uint8.
- v := uint8(255)
- nv := (*uint8)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "uint8"
- vs := "255"
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%v", nv, "<nil>")
- addFormatterTest("%+v", v, vs)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%+v", nv, "<nil>")
- addFormatterTest("%#v", v, "("+vt+")"+vs)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"<nil>")
- addFormatterTest("%#+v", v, "("+vt+")"+vs)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"<nil>")
-
- // Max uint16.
- v2 := uint16(65535)
- nv2 := (*uint16)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "uint16"
- v2s := "65535"
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s)
- addFormatterTest("%v", &pv2, "<**>"+v2s)
- addFormatterTest("%v", nv2, "<nil>")
- addFormatterTest("%+v", v2, v2s)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%+v", nv2, "<nil>")
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s)
- addFormatterTest("%#v", nv2, "(*"+v2t+")"+"<nil>")
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%#+v", nv2, "(*"+v2t+")"+"<nil>")
-
- // Max uint32.
- v3 := uint32(4294967295)
- nv3 := (*uint32)(nil)
- pv3 := &v3
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "uint32"
- v3s := "4294967295"
- addFormatterTest("%v", v3, v3s)
- addFormatterTest("%v", pv3, "<*>"+v3s)
- addFormatterTest("%v", &pv3, "<**>"+v3s)
- addFormatterTest("%v", nv3, "<nil>")
- addFormatterTest("%+v", v3, v3s)
- addFormatterTest("%+v", pv3, "<*>("+v3Addr+")"+v3s)
- addFormatterTest("%+v", &pv3, "<**>("+pv3Addr+"->"+v3Addr+")"+v3s)
- addFormatterTest("%+v", nv3, "<nil>")
- addFormatterTest("%#v", v3, "("+v3t+")"+v3s)
- addFormatterTest("%#v", pv3, "(*"+v3t+")"+v3s)
- addFormatterTest("%#v", &pv3, "(**"+v3t+")"+v3s)
- addFormatterTest("%#v", nv3, "(*"+v3t+")"+"<nil>")
- addFormatterTest("%#+v", v3, "("+v3t+")"+v3s)
- addFormatterTest("%#+v", pv3, "(*"+v3t+")("+v3Addr+")"+v3s)
- addFormatterTest("%#+v", &pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")"+v3s)
- addFormatterTest("%#v", nv3, "(*"+v3t+")"+"<nil>")
-
- // Max uint64.
- v4 := uint64(18446744073709551615)
- nv4 := (*uint64)(nil)
- pv4 := &v4
- v4Addr := fmt.Sprintf("%p", pv4)
- pv4Addr := fmt.Sprintf("%p", &pv4)
- v4t := "uint64"
- v4s := "18446744073709551615"
- addFormatterTest("%v", v4, v4s)
- addFormatterTest("%v", pv4, "<*>"+v4s)
- addFormatterTest("%v", &pv4, "<**>"+v4s)
- addFormatterTest("%v", nv4, "<nil>")
- addFormatterTest("%+v", v4, v4s)
- addFormatterTest("%+v", pv4, "<*>("+v4Addr+")"+v4s)
- addFormatterTest("%+v", &pv4, "<**>("+pv4Addr+"->"+v4Addr+")"+v4s)
- addFormatterTest("%+v", nv4, "<nil>")
- addFormatterTest("%#v", v4, "("+v4t+")"+v4s)
- addFormatterTest("%#v", pv4, "(*"+v4t+")"+v4s)
- addFormatterTest("%#v", &pv4, "(**"+v4t+")"+v4s)
- addFormatterTest("%#v", nv4, "(*"+v4t+")"+"<nil>")
- addFormatterTest("%#+v", v4, "("+v4t+")"+v4s)
- addFormatterTest("%#+v", pv4, "(*"+v4t+")("+v4Addr+")"+v4s)
- addFormatterTest("%#+v", &pv4, "(**"+v4t+")("+pv4Addr+"->"+v4Addr+")"+v4s)
- addFormatterTest("%#+v", nv4, "(*"+v4t+")"+"<nil>")
-
- // Max uint.
- v5 := uint(4294967295)
- nv5 := (*uint)(nil)
- pv5 := &v5
- v5Addr := fmt.Sprintf("%p", pv5)
- pv5Addr := fmt.Sprintf("%p", &pv5)
- v5t := "uint"
- v5s := "4294967295"
- addFormatterTest("%v", v5, v5s)
- addFormatterTest("%v", pv5, "<*>"+v5s)
- addFormatterTest("%v", &pv5, "<**>"+v5s)
- addFormatterTest("%v", nv5, "<nil>")
- addFormatterTest("%+v", v5, v5s)
- addFormatterTest("%+v", pv5, "<*>("+v5Addr+")"+v5s)
- addFormatterTest("%+v", &pv5, "<**>("+pv5Addr+"->"+v5Addr+")"+v5s)
- addFormatterTest("%+v", nv5, "<nil>")
- addFormatterTest("%#v", v5, "("+v5t+")"+v5s)
- addFormatterTest("%#v", pv5, "(*"+v5t+")"+v5s)
- addFormatterTest("%#v", &pv5, "(**"+v5t+")"+v5s)
- addFormatterTest("%#v", nv5, "(*"+v5t+")"+"<nil>")
- addFormatterTest("%#+v", v5, "("+v5t+")"+v5s)
- addFormatterTest("%#+v", pv5, "(*"+v5t+")("+v5Addr+")"+v5s)
- addFormatterTest("%#+v", &pv5, "(**"+v5t+")("+pv5Addr+"->"+v5Addr+")"+v5s)
- addFormatterTest("%#v", nv5, "(*"+v5t+")"+"<nil>")
-}
-
-func addBoolFormatterTests() {
- // Boolean true.
- v := bool(true)
- nv := (*bool)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "bool"
- vs := "true"
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%v", nv, "<nil>")
- addFormatterTest("%+v", v, vs)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%+v", nv, "<nil>")
- addFormatterTest("%#v", v, "("+vt+")"+vs)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"<nil>")
- addFormatterTest("%#+v", v, "("+vt+")"+vs)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"<nil>")
-
- // Boolean false.
- v2 := bool(false)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "bool"
- v2s := "false"
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s)
- addFormatterTest("%v", &pv2, "<**>"+v2s)
- addFormatterTest("%+v", v2, v2s)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s)
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s)
-}
-
-func addFloatFormatterTests() {
- // Standard float32.
- v := float32(3.1415)
- nv := (*float32)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "float32"
- vs := "3.1415"
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%v", nv, "<nil>")
- addFormatterTest("%+v", v, vs)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%+v", nv, "<nil>")
- addFormatterTest("%#v", v, "("+vt+")"+vs)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"<nil>")
- addFormatterTest("%#+v", v, "("+vt+")"+vs)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"<nil>")
-
- // Standard float64.
- v2 := float64(3.1415926)
- nv2 := (*float64)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "float64"
- v2s := "3.1415926"
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s)
- addFormatterTest("%v", &pv2, "<**>"+v2s)
- addFormatterTest("%+v", nv2, "<nil>")
- addFormatterTest("%+v", v2, v2s)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%+v", nv2, "<nil>")
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s)
- addFormatterTest("%#v", nv2, "(*"+v2t+")"+"<nil>")
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%#+v", nv2, "(*"+v2t+")"+"<nil>")
-}
-
-func addComplexFormatterTests() {
- // Standard complex64.
- v := complex(float32(6), -2)
- nv := (*complex64)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "complex64"
- vs := "(6-2i)"
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%+v", nv, "<nil>")
- addFormatterTest("%+v", v, vs)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%+v", nv, "<nil>")
- addFormatterTest("%#v", v, "("+vt+")"+vs)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"<nil>")
- addFormatterTest("%#+v", v, "("+vt+")"+vs)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"<nil>")
-
- // Standard complex128.
- v2 := complex(float64(-6), 2)
- nv2 := (*complex128)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "complex128"
- v2s := "(-6+2i)"
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s)
- addFormatterTest("%v", &pv2, "<**>"+v2s)
- addFormatterTest("%+v", nv2, "<nil>")
- addFormatterTest("%+v", v2, v2s)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%+v", nv2, "<nil>")
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s)
- addFormatterTest("%#v", nv2, "(*"+v2t+")"+"<nil>")
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%#+v", nv2, "(*"+v2t+")"+"<nil>")
-}
-
-func addArrayFormatterTests() {
- // Array containing standard ints.
- v := [3]int{1, 2, 3}
- nv := (*[3]int)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "[3]int"
- vs := "[1 2 3]"
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%+v", nv, "<nil>")
- addFormatterTest("%+v", v, vs)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%+v", nv, "<nil>")
- addFormatterTest("%#v", v, "("+vt+")"+vs)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"<nil>")
- addFormatterTest("%#+v", v, "("+vt+")"+vs)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"<nil>")
-
- // Array containing type with custom formatter on pointer receiver only.
- v2 := [3]pstringer{"1", "2", "3"}
- nv2 := (*[3]pstringer)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "[3]spew_test.pstringer"
- v2sp := "[stringer 1 stringer 2 stringer 3]"
- v2s := v2sp
- if spew.UnsafeDisabled {
- v2s = "[1 2 3]"
- }
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2sp)
- addFormatterTest("%v", &pv2, "<**>"+v2sp)
- addFormatterTest("%+v", nv2, "<nil>")
- addFormatterTest("%+v", v2, v2s)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2sp)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2sp)
- addFormatterTest("%+v", nv2, "<nil>")
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2sp)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2sp)
- addFormatterTest("%#v", nv2, "(*"+v2t+")"+"<nil>")
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2sp)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2sp)
- addFormatterTest("%#+v", nv2, "(*"+v2t+")"+"<nil>")
-
- // Array containing interfaces.
- v3 := [3]interface{}{"one", int(2), uint(3)}
- nv3 := (*[3]interface{})(nil)
- pv3 := &v3
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "[3]interface {}"
- v3t2 := "string"
- v3t3 := "int"
- v3t4 := "uint"
- v3s := "[one 2 3]"
- v3s2 := "[(" + v3t2 + ")one (" + v3t3 + ")2 (" + v3t4 + ")3]"
- addFormatterTest("%v", v3, v3s)
- addFormatterTest("%v", pv3, "<*>"+v3s)
- addFormatterTest("%v", &pv3, "<**>"+v3s)
- addFormatterTest("%+v", nv3, "<nil>")
- addFormatterTest("%+v", v3, v3s)
- addFormatterTest("%+v", pv3, "<*>("+v3Addr+")"+v3s)
- addFormatterTest("%+v", &pv3, "<**>("+pv3Addr+"->"+v3Addr+")"+v3s)
- addFormatterTest("%+v", nv3, "<nil>")
- addFormatterTest("%#v", v3, "("+v3t+")"+v3s2)
- addFormatterTest("%#v", pv3, "(*"+v3t+")"+v3s2)
- addFormatterTest("%#v", &pv3, "(**"+v3t+")"+v3s2)
- addFormatterTest("%#v", nv3, "(*"+v3t+")"+"<nil>")
- addFormatterTest("%#+v", v3, "("+v3t+")"+v3s2)
- addFormatterTest("%#+v", pv3, "(*"+v3t+")("+v3Addr+")"+v3s2)
- addFormatterTest("%#+v", &pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")"+v3s2)
- addFormatterTest("%#+v", nv3, "(*"+v3t+")"+"<nil>")
-}
-
-func addSliceFormatterTests() {
- // Slice containing standard float32 values.
- v := []float32{3.14, 6.28, 12.56}
- nv := (*[]float32)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "[]float32"
- vs := "[3.14 6.28 12.56]"
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%+v", nv, "<nil>")
- addFormatterTest("%+v", v, vs)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%+v", nv, "<nil>")
- addFormatterTest("%#v", v, "("+vt+")"+vs)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"<nil>")
- addFormatterTest("%#+v", v, "("+vt+")"+vs)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"<nil>")
-
- // Slice containing type with custom formatter on pointer receiver only.
- v2 := []pstringer{"1", "2", "3"}
- nv2 := (*[]pstringer)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "[]spew_test.pstringer"
- v2s := "[stringer 1 stringer 2 stringer 3]"
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s)
- addFormatterTest("%v", &pv2, "<**>"+v2s)
- addFormatterTest("%+v", nv2, "<nil>")
- addFormatterTest("%+v", v2, v2s)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%+v", nv2, "<nil>")
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s)
- addFormatterTest("%#v", nv2, "(*"+v2t+")"+"<nil>")
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%#+v", nv2, "(*"+v2t+")"+"<nil>")
-
- // Slice containing interfaces.
- v3 := []interface{}{"one", int(2), uint(3), nil}
- nv3 := (*[]interface{})(nil)
- pv3 := &v3
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "[]interface {}"
- v3t2 := "string"
- v3t3 := "int"
- v3t4 := "uint"
- v3t5 := "interface {}"
- v3s := "[one 2 3 <nil>]"
- v3s2 := "[(" + v3t2 + ")one (" + v3t3 + ")2 (" + v3t4 + ")3 (" + v3t5 +
- ")<nil>]"
- addFormatterTest("%v", v3, v3s)
- addFormatterTest("%v", pv3, "<*>"+v3s)
- addFormatterTest("%v", &pv3, "<**>"+v3s)
- addFormatterTest("%+v", nv3, "<nil>")
- addFormatterTest("%+v", v3, v3s)
- addFormatterTest("%+v", pv3, "<*>("+v3Addr+")"+v3s)
- addFormatterTest("%+v", &pv3, "<**>("+pv3Addr+"->"+v3Addr+")"+v3s)
- addFormatterTest("%+v", nv3, "<nil>")
- addFormatterTest("%#v", v3, "("+v3t+")"+v3s2)
- addFormatterTest("%#v", pv3, "(*"+v3t+")"+v3s2)
- addFormatterTest("%#v", &pv3, "(**"+v3t+")"+v3s2)
- addFormatterTest("%#v", nv3, "(*"+v3t+")"+"<nil>")
- addFormatterTest("%#+v", v3, "("+v3t+")"+v3s2)
- addFormatterTest("%#+v", pv3, "(*"+v3t+")("+v3Addr+")"+v3s2)
- addFormatterTest("%#+v", &pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")"+v3s2)
- addFormatterTest("%#+v", nv3, "(*"+v3t+")"+"<nil>")
-
- // Nil slice.
- var v4 []int
- nv4 := (*[]int)(nil)
- pv4 := &v4
- v4Addr := fmt.Sprintf("%p", pv4)
- pv4Addr := fmt.Sprintf("%p", &pv4)
- v4t := "[]int"
- v4s := "<nil>"
- addFormatterTest("%v", v4, v4s)
- addFormatterTest("%v", pv4, "<*>"+v4s)
- addFormatterTest("%v", &pv4, "<**>"+v4s)
- addFormatterTest("%+v", nv4, "<nil>")
- addFormatterTest("%+v", v4, v4s)
- addFormatterTest("%+v", pv4, "<*>("+v4Addr+")"+v4s)
- addFormatterTest("%+v", &pv4, "<**>("+pv4Addr+"->"+v4Addr+")"+v4s)
- addFormatterTest("%+v", nv4, "<nil>")
- addFormatterTest("%#v", v4, "("+v4t+")"+v4s)
- addFormatterTest("%#v", pv4, "(*"+v4t+")"+v4s)
- addFormatterTest("%#v", &pv4, "(**"+v4t+")"+v4s)
- addFormatterTest("%#v", nv4, "(*"+v4t+")"+"<nil>")
- addFormatterTest("%#+v", v4, "("+v4t+")"+v4s)
- addFormatterTest("%#+v", pv4, "(*"+v4t+")("+v4Addr+")"+v4s)
- addFormatterTest("%#+v", &pv4, "(**"+v4t+")("+pv4Addr+"->"+v4Addr+")"+v4s)
- addFormatterTest("%#+v", nv4, "(*"+v4t+")"+"<nil>")
-}
-
-func addStringFormatterTests() {
- // Standard string.
- v := "test"
- nv := (*string)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "string"
- vs := "test"
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%+v", nv, "<nil>")
- addFormatterTest("%+v", v, vs)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%+v", nv, "<nil>")
- addFormatterTest("%#v", v, "("+vt+")"+vs)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"<nil>")
- addFormatterTest("%#+v", v, "("+vt+")"+vs)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"<nil>")
-}
-
-func addInterfaceFormatterTests() {
- // Nil interface.
- var v interface{}
- nv := (*interface{})(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "interface {}"
- vs := "<nil>"
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%+v", nv, "<nil>")
- addFormatterTest("%+v", v, vs)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%+v", nv, "<nil>")
- addFormatterTest("%#v", v, "("+vt+")"+vs)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"<nil>")
- addFormatterTest("%#+v", v, "("+vt+")"+vs)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"<nil>")
-
- // Sub-interface.
- v2 := interface{}(uint16(65535))
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "uint16"
- v2s := "65535"
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s)
- addFormatterTest("%v", &pv2, "<**>"+v2s)
- addFormatterTest("%+v", v2, v2s)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s)
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s)
-}
-
-func addMapFormatterTests() {
- // Map with string keys and int vals.
- v := map[string]int{"one": 1, "two": 2}
- nilMap := map[string]int(nil)
- nv := (*map[string]int)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "map[string]int"
- vs := "map[one:1 two:2]"
- vs2 := "map[two:2 one:1]"
- addFormatterTest("%v", v, vs, vs2)
- addFormatterTest("%v", pv, "<*>"+vs, "<*>"+vs2)
- addFormatterTest("%v", &pv, "<**>"+vs, "<**>"+vs2)
- addFormatterTest("%+v", nilMap, "<nil>")
- addFormatterTest("%+v", nv, "<nil>")
- addFormatterTest("%+v", v, vs, vs2)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs, "<*>("+vAddr+")"+vs2)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs,
- "<**>("+pvAddr+"->"+vAddr+")"+vs2)
- addFormatterTest("%+v", nilMap, "<nil>")
- addFormatterTest("%+v", nv, "<nil>")
- addFormatterTest("%#v", v, "("+vt+")"+vs, "("+vt+")"+vs2)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs, "(*"+vt+")"+vs2)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs, "(**"+vt+")"+vs2)
- addFormatterTest("%#v", nilMap, "("+vt+")"+"<nil>")
- addFormatterTest("%#v", nv, "(*"+vt+")"+"<nil>")
- addFormatterTest("%#+v", v, "("+vt+")"+vs, "("+vt+")"+vs2)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs,
- "(*"+vt+")("+vAddr+")"+vs2)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs,
- "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs2)
- addFormatterTest("%#+v", nilMap, "("+vt+")"+"<nil>")
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"<nil>")
-
- // Map with custom formatter type on pointer receiver only keys and vals.
- v2 := map[pstringer]pstringer{"one": "1"}
- nv2 := (*map[pstringer]pstringer)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "map[spew_test.pstringer]spew_test.pstringer"
- v2s := "map[stringer one:stringer 1]"
- if spew.UnsafeDisabled {
- v2s = "map[one:1]"
- }
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s)
- addFormatterTest("%v", &pv2, "<**>"+v2s)
- addFormatterTest("%+v", nv2, "<nil>")
- addFormatterTest("%+v", v2, v2s)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%+v", nv2, "<nil>")
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s)
- addFormatterTest("%#v", nv2, "(*"+v2t+")"+"<nil>")
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%#+v", nv2, "(*"+v2t+")"+"<nil>")
-
- // Map with interface keys and values.
- v3 := map[interface{}]interface{}{"one": 1}
- nv3 := (*map[interface{}]interface{})(nil)
- pv3 := &v3
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "map[interface {}]interface {}"
- v3t1 := "string"
- v3t2 := "int"
- v3s := "map[one:1]"
- v3s2 := "map[(" + v3t1 + ")one:(" + v3t2 + ")1]"
- addFormatterTest("%v", v3, v3s)
- addFormatterTest("%v", pv3, "<*>"+v3s)
- addFormatterTest("%v", &pv3, "<**>"+v3s)
- addFormatterTest("%+v", nv3, "<nil>")
- addFormatterTest("%+v", v3, v3s)
- addFormatterTest("%+v", pv3, "<*>("+v3Addr+")"+v3s)
- addFormatterTest("%+v", &pv3, "<**>("+pv3Addr+"->"+v3Addr+")"+v3s)
- addFormatterTest("%+v", nv3, "<nil>")
- addFormatterTest("%#v", v3, "("+v3t+")"+v3s2)
- addFormatterTest("%#v", pv3, "(*"+v3t+")"+v3s2)
- addFormatterTest("%#v", &pv3, "(**"+v3t+")"+v3s2)
- addFormatterTest("%#v", nv3, "(*"+v3t+")"+"<nil>")
- addFormatterTest("%#+v", v3, "("+v3t+")"+v3s2)
- addFormatterTest("%#+v", pv3, "(*"+v3t+")("+v3Addr+")"+v3s2)
- addFormatterTest("%#+v", &pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")"+v3s2)
- addFormatterTest("%#+v", nv3, "(*"+v3t+")"+"<nil>")
-
- // Map with nil interface value
- v4 := map[string]interface{}{"nil": nil}
- nv4 := (*map[string]interface{})(nil)
- pv4 := &v4
- v4Addr := fmt.Sprintf("%p", pv4)
- pv4Addr := fmt.Sprintf("%p", &pv4)
- v4t := "map[string]interface {}"
- v4t1 := "interface {}"
- v4s := "map[nil:<nil>]"
- v4s2 := "map[nil:(" + v4t1 + ")<nil>]"
- addFormatterTest("%v", v4, v4s)
- addFormatterTest("%v", pv4, "<*>"+v4s)
- addFormatterTest("%v", &pv4, "<**>"+v4s)
- addFormatterTest("%+v", nv4, "<nil>")
- addFormatterTest("%+v", v4, v4s)
- addFormatterTest("%+v", pv4, "<*>("+v4Addr+")"+v4s)
- addFormatterTest("%+v", &pv4, "<**>("+pv4Addr+"->"+v4Addr+")"+v4s)
- addFormatterTest("%+v", nv4, "<nil>")
- addFormatterTest("%#v", v4, "("+v4t+")"+v4s2)
- addFormatterTest("%#v", pv4, "(*"+v4t+")"+v4s2)
- addFormatterTest("%#v", &pv4, "(**"+v4t+")"+v4s2)
- addFormatterTest("%#v", nv4, "(*"+v4t+")"+"<nil>")
- addFormatterTest("%#+v", v4, "("+v4t+")"+v4s2)
- addFormatterTest("%#+v", pv4, "(*"+v4t+")("+v4Addr+")"+v4s2)
- addFormatterTest("%#+v", &pv4, "(**"+v4t+")("+pv4Addr+"->"+v4Addr+")"+v4s2)
- addFormatterTest("%#+v", nv4, "(*"+v4t+")"+"<nil>")
-}
-
-func addStructFormatterTests() {
- // Struct with primitives.
- type s1 struct {
- a int8
- b uint8
- }
- v := s1{127, 255}
- nv := (*s1)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "spew_test.s1"
- vt2 := "int8"
- vt3 := "uint8"
- vs := "{127 255}"
- vs2 := "{a:127 b:255}"
- vs3 := "{a:(" + vt2 + ")127 b:(" + vt3 + ")255}"
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%+v", nv, "<nil>")
- addFormatterTest("%+v", v, vs2)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs2)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs2)
- addFormatterTest("%+v", nv, "<nil>")
- addFormatterTest("%#v", v, "("+vt+")"+vs3)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs3)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs3)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"<nil>")
- addFormatterTest("%#+v", v, "("+vt+")"+vs3)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs3)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs3)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"<nil>")
-
- // Struct that contains another struct.
- type s2 struct {
- s1 s1
- b bool
- }
- v2 := s2{s1{127, 255}, true}
- nv2 := (*s2)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "spew_test.s2"
- v2t2 := "spew_test.s1"
- v2t3 := "int8"
- v2t4 := "uint8"
- v2t5 := "bool"
- v2s := "{{127 255} true}"
- v2s2 := "{s1:{a:127 b:255} b:true}"
- v2s3 := "{s1:(" + v2t2 + "){a:(" + v2t3 + ")127 b:(" + v2t4 + ")255} b:(" +
- v2t5 + ")true}"
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s)
- addFormatterTest("%v", &pv2, "<**>"+v2s)
- addFormatterTest("%+v", nv2, "<nil>")
- addFormatterTest("%+v", v2, v2s2)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s2)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s2)
- addFormatterTest("%+v", nv2, "<nil>")
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s3)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s3)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s3)
- addFormatterTest("%#v", nv2, "(*"+v2t+")"+"<nil>")
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s3)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s3)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s3)
- addFormatterTest("%#+v", nv2, "(*"+v2t+")"+"<nil>")
-
- // Struct that contains custom type with Stringer pointer interface via both
- // exported and unexported fields.
- type s3 struct {
- s pstringer
- S pstringer
- }
- v3 := s3{"test", "test2"}
- nv3 := (*s3)(nil)
- pv3 := &v3
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "spew_test.s3"
- v3t2 := "spew_test.pstringer"
- v3s := "{stringer test stringer test2}"
- v3sp := v3s
- v3s2 := "{s:stringer test S:stringer test2}"
- v3s2p := v3s2
- v3s3 := "{s:(" + v3t2 + ")stringer test S:(" + v3t2 + ")stringer test2}"
- v3s3p := v3s3
- if spew.UnsafeDisabled {
- v3s = "{test test2}"
- v3sp = "{test stringer test2}"
- v3s2 = "{s:test S:test2}"
- v3s2p = "{s:test S:stringer test2}"
- v3s3 = "{s:(" + v3t2 + ")test S:(" + v3t2 + ")test2}"
- v3s3p = "{s:(" + v3t2 + ")test S:(" + v3t2 + ")stringer test2}"
- }
- addFormatterTest("%v", v3, v3s)
- addFormatterTest("%v", pv3, "<*>"+v3sp)
- addFormatterTest("%v", &pv3, "<**>"+v3sp)
- addFormatterTest("%+v", nv3, "<nil>")
- addFormatterTest("%+v", v3, v3s2)
- addFormatterTest("%+v", pv3, "<*>("+v3Addr+")"+v3s2p)
- addFormatterTest("%+v", &pv3, "<**>("+pv3Addr+"->"+v3Addr+")"+v3s2p)
- addFormatterTest("%+v", nv3, "<nil>")
- addFormatterTest("%#v", v3, "("+v3t+")"+v3s3)
- addFormatterTest("%#v", pv3, "(*"+v3t+")"+v3s3p)
- addFormatterTest("%#v", &pv3, "(**"+v3t+")"+v3s3p)
- addFormatterTest("%#v", nv3, "(*"+v3t+")"+"<nil>")
- addFormatterTest("%#+v", v3, "("+v3t+")"+v3s3)
- addFormatterTest("%#+v", pv3, "(*"+v3t+")("+v3Addr+")"+v3s3p)
- addFormatterTest("%#+v", &pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")"+v3s3p)
- addFormatterTest("%#+v", nv3, "(*"+v3t+")"+"<nil>")
-
- // Struct that contains embedded struct and field to same struct.
- e := embed{"embedstr"}
- v4 := embedwrap{embed: &e, e: &e}
- nv4 := (*embedwrap)(nil)
- pv4 := &v4
- eAddr := fmt.Sprintf("%p", &e)
- v4Addr := fmt.Sprintf("%p", pv4)
- pv4Addr := fmt.Sprintf("%p", &pv4)
- v4t := "spew_test.embedwrap"
- v4t2 := "spew_test.embed"
- v4t3 := "string"
- v4s := "{<*>{embedstr} <*>{embedstr}}"
- v4s2 := "{embed:<*>(" + eAddr + "){a:embedstr} e:<*>(" + eAddr +
- "){a:embedstr}}"
- v4s3 := "{embed:(*" + v4t2 + "){a:(" + v4t3 + ")embedstr} e:(*" + v4t2 +
- "){a:(" + v4t3 + ")embedstr}}"
- v4s4 := "{embed:(*" + v4t2 + ")(" + eAddr + "){a:(" + v4t3 +
- ")embedstr} e:(*" + v4t2 + ")(" + eAddr + "){a:(" + v4t3 + ")embedstr}}"
- addFormatterTest("%v", v4, v4s)
- addFormatterTest("%v", pv4, "<*>"+v4s)
- addFormatterTest("%v", &pv4, "<**>"+v4s)
- addFormatterTest("%+v", nv4, "<nil>")
- addFormatterTest("%+v", v4, v4s2)
- addFormatterTest("%+v", pv4, "<*>("+v4Addr+")"+v4s2)
- addFormatterTest("%+v", &pv4, "<**>("+pv4Addr+"->"+v4Addr+")"+v4s2)
- addFormatterTest("%+v", nv4, "<nil>")
- addFormatterTest("%#v", v4, "("+v4t+")"+v4s3)
- addFormatterTest("%#v", pv4, "(*"+v4t+")"+v4s3)
- addFormatterTest("%#v", &pv4, "(**"+v4t+")"+v4s3)
- addFormatterTest("%#v", nv4, "(*"+v4t+")"+"<nil>")
- addFormatterTest("%#+v", v4, "("+v4t+")"+v4s4)
- addFormatterTest("%#+v", pv4, "(*"+v4t+")("+v4Addr+")"+v4s4)
- addFormatterTest("%#+v", &pv4, "(**"+v4t+")("+pv4Addr+"->"+v4Addr+")"+v4s4)
- addFormatterTest("%#+v", nv4, "(*"+v4t+")"+"<nil>")
-}
-
-func addUintptrFormatterTests() {
- // Null pointer.
- v := uintptr(0)
- nv := (*uintptr)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "uintptr"
- vs := "<nil>"
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%+v", nv, "<nil>")
- addFormatterTest("%+v", v, vs)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%+v", nv, "<nil>")
- addFormatterTest("%#v", v, "("+vt+")"+vs)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"<nil>")
- addFormatterTest("%#+v", v, "("+vt+")"+vs)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"<nil>")
-
- // Address of real variable.
- i := 1
- v2 := uintptr(unsafe.Pointer(&i))
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "uintptr"
- v2s := fmt.Sprintf("%p", &i)
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s)
- addFormatterTest("%v", &pv2, "<**>"+v2s)
- addFormatterTest("%+v", v2, v2s)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s)
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s)
-}
-
-func addUnsafePointerFormatterTests() {
- // Null pointer.
- v := unsafe.Pointer(uintptr(0))
- nv := (*unsafe.Pointer)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "unsafe.Pointer"
- vs := "<nil>"
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%+v", nv, "<nil>")
- addFormatterTest("%+v", v, vs)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%+v", nv, "<nil>")
- addFormatterTest("%#v", v, "("+vt+")"+vs)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"<nil>")
- addFormatterTest("%#+v", v, "("+vt+")"+vs)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"<nil>")
-
- // Address of real variable.
- i := 1
- v2 := unsafe.Pointer(&i)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "unsafe.Pointer"
- v2s := fmt.Sprintf("%p", &i)
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s)
- addFormatterTest("%v", &pv2, "<**>"+v2s)
- addFormatterTest("%+v", v2, v2s)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s)
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s)
-}
-
-func addChanFormatterTests() {
- // Nil channel.
- var v chan int
- pv := &v
- nv := (*chan int)(nil)
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "chan int"
- vs := "<nil>"
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%+v", nv, "<nil>")
- addFormatterTest("%+v", v, vs)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%+v", nv, "<nil>")
- addFormatterTest("%#v", v, "("+vt+")"+vs)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"<nil>")
- addFormatterTest("%#+v", v, "("+vt+")"+vs)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"<nil>")
-
- // Real channel.
- v2 := make(chan int)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "chan int"
- v2s := fmt.Sprintf("%p", v2)
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s)
- addFormatterTest("%v", &pv2, "<**>"+v2s)
- addFormatterTest("%+v", v2, v2s)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s)
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s)
-}
-
-func addFuncFormatterTests() {
- // Function with no params and no returns.
- v := addIntFormatterTests
- nv := (*func())(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "func()"
- vs := fmt.Sprintf("%p", v)
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%+v", nv, "<nil>")
- addFormatterTest("%+v", v, vs)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%+v", nv, "<nil>")
- addFormatterTest("%#v", v, "("+vt+")"+vs)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"<nil>")
- addFormatterTest("%#+v", v, "("+vt+")"+vs)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"<nil>")
-
- // Function with param and no returns.
- v2 := TestFormatter
- nv2 := (*func(*testing.T))(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "func(*testing.T)"
- v2s := fmt.Sprintf("%p", v2)
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s)
- addFormatterTest("%v", &pv2, "<**>"+v2s)
- addFormatterTest("%+v", nv2, "<nil>")
- addFormatterTest("%+v", v2, v2s)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%+v", nv2, "<nil>")
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s)
- addFormatterTest("%#v", nv2, "(*"+v2t+")"+"<nil>")
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%#+v", nv2, "(*"+v2t+")"+"<nil>")
-
- // Function with multiple params and multiple returns.
- var v3 = func(i int, s string) (b bool, err error) {
- return true, nil
- }
- nv3 := (*func(int, string) (bool, error))(nil)
- pv3 := &v3
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "func(int, string) (bool, error)"
- v3s := fmt.Sprintf("%p", v3)
- addFormatterTest("%v", v3, v3s)
- addFormatterTest("%v", pv3, "<*>"+v3s)
- addFormatterTest("%v", &pv3, "<**>"+v3s)
- addFormatterTest("%+v", nv3, "<nil>")
- addFormatterTest("%+v", v3, v3s)
- addFormatterTest("%+v", pv3, "<*>("+v3Addr+")"+v3s)
- addFormatterTest("%+v", &pv3, "<**>("+pv3Addr+"->"+v3Addr+")"+v3s)
- addFormatterTest("%+v", nv3, "<nil>")
- addFormatterTest("%#v", v3, "("+v3t+")"+v3s)
- addFormatterTest("%#v", pv3, "(*"+v3t+")"+v3s)
- addFormatterTest("%#v", &pv3, "(**"+v3t+")"+v3s)
- addFormatterTest("%#v", nv3, "(*"+v3t+")"+"<nil>")
- addFormatterTest("%#+v", v3, "("+v3t+")"+v3s)
- addFormatterTest("%#+v", pv3, "(*"+v3t+")("+v3Addr+")"+v3s)
- addFormatterTest("%#+v", &pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")"+v3s)
- addFormatterTest("%#+v", nv3, "(*"+v3t+")"+"<nil>")
-}
-
-func addCircularFormatterTests() {
- // Struct that is circular through self referencing.
- type circular struct {
- c *circular
- }
- v := circular{nil}
- v.c = &v
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "spew_test.circular"
- vs := "{<*>{<*><shown>}}"
- vs2 := "{<*><shown>}"
- vs3 := "{c:<*>(" + vAddr + "){c:<*>(" + vAddr + ")<shown>}}"
- vs4 := "{c:<*>(" + vAddr + ")<shown>}"
- vs5 := "{c:(*" + vt + "){c:(*" + vt + ")<shown>}}"
- vs6 := "{c:(*" + vt + ")<shown>}"
- vs7 := "{c:(*" + vt + ")(" + vAddr + "){c:(*" + vt + ")(" + vAddr +
- ")<shown>}}"
- vs8 := "{c:(*" + vt + ")(" + vAddr + ")<shown>}"
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs2)
- addFormatterTest("%v", &pv, "<**>"+vs2)
- addFormatterTest("%+v", v, vs3)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs4)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs4)
- addFormatterTest("%#v", v, "("+vt+")"+vs5)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs6)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs6)
- addFormatterTest("%#+v", v, "("+vt+")"+vs7)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs8)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs8)
-
- // Structs that are circular through cross referencing.
- v2 := xref1{nil}
- ts2 := xref2{&v2}
- v2.ps2 = &ts2
- pv2 := &v2
- ts2Addr := fmt.Sprintf("%p", &ts2)
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "spew_test.xref1"
- v2t2 := "spew_test.xref2"
- v2s := "{<*>{<*>{<*><shown>}}}"
- v2s2 := "{<*>{<*><shown>}}"
- v2s3 := "{ps2:<*>(" + ts2Addr + "){ps1:<*>(" + v2Addr + "){ps2:<*>(" +
- ts2Addr + ")<shown>}}}"
- v2s4 := "{ps2:<*>(" + ts2Addr + "){ps1:<*>(" + v2Addr + ")<shown>}}"
- v2s5 := "{ps2:(*" + v2t2 + "){ps1:(*" + v2t + "){ps2:(*" + v2t2 +
- ")<shown>}}}"
- v2s6 := "{ps2:(*" + v2t2 + "){ps1:(*" + v2t + ")<shown>}}"
- v2s7 := "{ps2:(*" + v2t2 + ")(" + ts2Addr + "){ps1:(*" + v2t +
- ")(" + v2Addr + "){ps2:(*" + v2t2 + ")(" + ts2Addr +
- ")<shown>}}}"
- v2s8 := "{ps2:(*" + v2t2 + ")(" + ts2Addr + "){ps1:(*" + v2t +
- ")(" + v2Addr + ")<shown>}}"
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s2)
- addFormatterTest("%v", &pv2, "<**>"+v2s2)
- addFormatterTest("%+v", v2, v2s3)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s4)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s4)
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s5)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s6)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s6)
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s7)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s8)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s8)
-
- // Structs that are indirectly circular.
- v3 := indirCir1{nil}
- tic2 := indirCir2{nil}
- tic3 := indirCir3{&v3}
- tic2.ps3 = &tic3
- v3.ps2 = &tic2
- pv3 := &v3
- tic2Addr := fmt.Sprintf("%p", &tic2)
- tic3Addr := fmt.Sprintf("%p", &tic3)
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "spew_test.indirCir1"
- v3t2 := "spew_test.indirCir2"
- v3t3 := "spew_test.indirCir3"
- v3s := "{<*>{<*>{<*>{<*><shown>}}}}"
- v3s2 := "{<*>{<*>{<*><shown>}}}"
- v3s3 := "{ps2:<*>(" + tic2Addr + "){ps3:<*>(" + tic3Addr + "){ps1:<*>(" +
- v3Addr + "){ps2:<*>(" + tic2Addr + ")<shown>}}}}"
- v3s4 := "{ps2:<*>(" + tic2Addr + "){ps3:<*>(" + tic3Addr + "){ps1:<*>(" +
- v3Addr + ")<shown>}}}"
- v3s5 := "{ps2:(*" + v3t2 + "){ps3:(*" + v3t3 + "){ps1:(*" + v3t +
- "){ps2:(*" + v3t2 + ")<shown>}}}}"
- v3s6 := "{ps2:(*" + v3t2 + "){ps3:(*" + v3t3 + "){ps1:(*" + v3t +
- ")<shown>}}}"
- v3s7 := "{ps2:(*" + v3t2 + ")(" + tic2Addr + "){ps3:(*" + v3t3 + ")(" +
- tic3Addr + "){ps1:(*" + v3t + ")(" + v3Addr + "){ps2:(*" + v3t2 +
- ")(" + tic2Addr + ")<shown>}}}}"
- v3s8 := "{ps2:(*" + v3t2 + ")(" + tic2Addr + "){ps3:(*" + v3t3 + ")(" +
- tic3Addr + "){ps1:(*" + v3t + ")(" + v3Addr + ")<shown>}}}"
- addFormatterTest("%v", v3, v3s)
- addFormatterTest("%v", pv3, "<*>"+v3s2)
- addFormatterTest("%v", &pv3, "<**>"+v3s2)
- addFormatterTest("%+v", v3, v3s3)
- addFormatterTest("%+v", pv3, "<*>("+v3Addr+")"+v3s4)
- addFormatterTest("%+v", &pv3, "<**>("+pv3Addr+"->"+v3Addr+")"+v3s4)
- addFormatterTest("%#v", v3, "("+v3t+")"+v3s5)
- addFormatterTest("%#v", pv3, "(*"+v3t+")"+v3s6)
- addFormatterTest("%#v", &pv3, "(**"+v3t+")"+v3s6)
- addFormatterTest("%#+v", v3, "("+v3t+")"+v3s7)
- addFormatterTest("%#+v", pv3, "(*"+v3t+")("+v3Addr+")"+v3s8)
- addFormatterTest("%#+v", &pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")"+v3s8)
-}
-
-func addPanicFormatterTests() {
- // Type that panics in its Stringer interface.
- v := panicer(127)
- nv := (*panicer)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "spew_test.panicer"
- vs := "(PANIC=test panic)127"
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%v", nv, "<nil>")
- addFormatterTest("%+v", v, vs)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%+v", nv, "<nil>")
- addFormatterTest("%#v", v, "("+vt+")"+vs)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"<nil>")
- addFormatterTest("%#+v", v, "("+vt+")"+vs)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"<nil>")
-}
-
-func addErrorFormatterTests() {
- // Type that has a custom Error interface.
- v := customError(127)
- nv := (*customError)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "spew_test.customError"
- vs := "error: 127"
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%v", nv, "<nil>")
- addFormatterTest("%+v", v, vs)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%+v", nv, "<nil>")
- addFormatterTest("%#v", v, "("+vt+")"+vs)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"<nil>")
- addFormatterTest("%#+v", v, "("+vt+")"+vs)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"<nil>")
-}
-
-func addPassthroughFormatterTests() {
- // %x passthrough with uint.
- v := uint(4294967295)
- pv := &v
- vAddr := fmt.Sprintf("%x", pv)
- pvAddr := fmt.Sprintf("%x", &pv)
- vs := "ffffffff"
- addFormatterTest("%x", v, vs)
- addFormatterTest("%x", pv, vAddr)
- addFormatterTest("%x", &pv, pvAddr)
-
- // %#x passthrough with uint.
- v2 := int(2147483647)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%#x", pv2)
- pv2Addr := fmt.Sprintf("%#x", &pv2)
- v2s := "0x7fffffff"
- addFormatterTest("%#x", v2, v2s)
- addFormatterTest("%#x", pv2, v2Addr)
- addFormatterTest("%#x", &pv2, pv2Addr)
-
- // %f passthrough with precision.
- addFormatterTest("%.2f", 3.1415, "3.14")
- addFormatterTest("%.3f", 3.1415, "3.142")
- addFormatterTest("%.4f", 3.1415, "3.1415")
-
- // %f passthrough with width and precision.
- addFormatterTest("%5.2f", 3.1415, " 3.14")
- addFormatterTest("%6.3f", 3.1415, " 3.142")
- addFormatterTest("%7.4f", 3.1415, " 3.1415")
-
- // %d passthrough with width.
- addFormatterTest("%3d", 127, "127")
- addFormatterTest("%4d", 127, " 127")
- addFormatterTest("%5d", 127, " 127")
-
- // %q passthrough with string.
- addFormatterTest("%q", "test", "\"test\"")
-}
-
-// TestFormatter executes all of the tests described by formatterTests.
-func TestFormatter(t *testing.T) {
- // Setup tests.
- addIntFormatterTests()
- addUintFormatterTests()
- addBoolFormatterTests()
- addFloatFormatterTests()
- addComplexFormatterTests()
- addArrayFormatterTests()
- addSliceFormatterTests()
- addStringFormatterTests()
- addInterfaceFormatterTests()
- addMapFormatterTests()
- addStructFormatterTests()
- addUintptrFormatterTests()
- addUnsafePointerFormatterTests()
- addChanFormatterTests()
- addFuncFormatterTests()
- addCircularFormatterTests()
- addPanicFormatterTests()
- addErrorFormatterTests()
- addPassthroughFormatterTests()
-
- t.Logf("Running %d tests", len(formatterTests))
- for i, test := range formatterTests {
- buf := new(bytes.Buffer)
- spew.Fprintf(buf, test.format, test.in)
- s := buf.String()
- if testFailed(s, test.wants) {
- t.Errorf("Formatter #%d format: %s got: %s %s", i, test.format, s,
- stringizeWants(test.wants))
- continue
- }
- }
-}
-
-type testStruct struct {
- x int
-}
-
-func (ts testStruct) String() string {
- return fmt.Sprintf("ts.%d", ts.x)
-}
-
-type testStructP struct {
- x int
-}
-
-func (ts *testStructP) String() string {
- return fmt.Sprintf("ts.%d", ts.x)
-}
-
-func TestPrintSortedKeys(t *testing.T) {
- cfg := spew.ConfigState{SortKeys: true}
- s := cfg.Sprint(map[int]string{1: "1", 3: "3", 2: "2"})
- expected := "map[1:1 2:2 3:3]"
- if s != expected {
- t.Errorf("Sorted keys mismatch 1:\n %v %v", s, expected)
- }
-
- s = cfg.Sprint(map[stringer]int{"1": 1, "3": 3, "2": 2})
- expected = "map[stringer 1:1 stringer 2:2 stringer 3:3]"
- if s != expected {
- t.Errorf("Sorted keys mismatch 2:\n %v %v", s, expected)
- }
-
- s = cfg.Sprint(map[pstringer]int{pstringer("1"): 1, pstringer("3"): 3, pstringer("2"): 2})
- expected = "map[stringer 1:1 stringer 2:2 stringer 3:3]"
- if spew.UnsafeDisabled {
- expected = "map[1:1 2:2 3:3]"
- }
- if s != expected {
- t.Errorf("Sorted keys mismatch 3:\n %v %v", s, expected)
- }
-
- s = cfg.Sprint(map[testStruct]int{testStruct{1}: 1, testStruct{3}: 3, testStruct{2}: 2})
- expected = "map[ts.1:1 ts.2:2 ts.3:3]"
- if s != expected {
- t.Errorf("Sorted keys mismatch 4:\n %v %v", s, expected)
- }
-
- if !spew.UnsafeDisabled {
- s = cfg.Sprint(map[testStructP]int{testStructP{1}: 1, testStructP{3}: 3, testStructP{2}: 2})
- expected = "map[ts.1:1 ts.2:2 ts.3:3]"
- if s != expected {
- t.Errorf("Sorted keys mismatch 5:\n %v %v", s, expected)
- }
- }
-
- s = cfg.Sprint(map[customError]int{customError(1): 1, customError(3): 3, customError(2): 2})
- expected = "map[error: 1:1 error: 2:2 error: 3:3]"
- if s != expected {
- t.Errorf("Sorted keys mismatch 6:\n %v %v", s, expected)
- }
-}
diff --git a/vendor/github.com/davecgh/go-spew/spew/internal_test.go b/vendor/github.com/davecgh/go-spew/spew/internal_test.go
deleted file mode 100644
index 20a9cfefc..000000000
--- a/vendor/github.com/davecgh/go-spew/spew/internal_test.go
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
-This test file is part of the spew package rather than than the spew_test
-package because it needs access to internals to properly test certain cases
-which are not possible via the public interface since they should never happen.
-*/
-
-package spew
-
-import (
- "bytes"
- "reflect"
- "testing"
-)
-
-// dummyFmtState implements a fake fmt.State to use for testing invalid
-// reflect.Value handling. This is necessary because the fmt package catches
-// invalid values before invoking the formatter on them.
-type dummyFmtState struct {
- bytes.Buffer
-}
-
-func (dfs *dummyFmtState) Flag(f int) bool {
- if f == int('+') {
- return true
- }
- return false
-}
-
-func (dfs *dummyFmtState) Precision() (int, bool) {
- return 0, false
-}
-
-func (dfs *dummyFmtState) Width() (int, bool) {
- return 0, false
-}
-
-// TestInvalidReflectValue ensures the dump and formatter code handles an
-// invalid reflect value properly. This needs access to internal state since it
-// should never happen in real code and therefore can't be tested via the public
-// API.
-func TestInvalidReflectValue(t *testing.T) {
- i := 1
-
- // Dump invalid reflect value.
- v := new(reflect.Value)
- buf := new(bytes.Buffer)
- d := dumpState{w: buf, cs: &Config}
- d.dump(*v)
- s := buf.String()
- want := "<invalid>"
- if s != want {
- t.Errorf("InvalidReflectValue #%d\n got: %s want: %s", i, s, want)
- }
- i++
-
- // Formatter invalid reflect value.
- buf2 := new(dummyFmtState)
- f := formatState{value: *v, cs: &Config, fs: buf2}
- f.format(*v)
- s = buf2.String()
- want = "<invalid>"
- if s != want {
- t.Errorf("InvalidReflectValue #%d got: %s want: %s", i, s, want)
- }
-}
-
-// SortValues makes the internal sortValues function available to the test
-// package.
-func SortValues(values []reflect.Value, cs *ConfigState) {
- sortValues(values, cs)
-}
diff --git a/vendor/github.com/davecgh/go-spew/spew/internalunsafe_test.go b/vendor/github.com/davecgh/go-spew/spew/internalunsafe_test.go
deleted file mode 100644
index a0c612ec3..000000000
--- a/vendor/github.com/davecgh/go-spew/spew/internalunsafe_test.go
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
-
-// Permission to use, copy, modify, and distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-// NOTE: Due to the following build constraints, this file will only be compiled
-// when the code is not running on Google App Engine, compiled by GopherJS, and
-// "-tags safe" is not added to the go build command line. The "disableunsafe"
-// tag is deprecated and thus should not be used.
-// +build !js,!appengine,!safe,!disableunsafe
-
-/*
-This test file is part of the spew package rather than than the spew_test
-package because it needs access to internals to properly test certain cases
-which are not possible via the public interface since they should never happen.
-*/
-
-package spew
-
-import (
- "bytes"
- "reflect"
- "testing"
- "unsafe"
-)
-
-// changeKind uses unsafe to intentionally change the kind of a reflect.Value to
-// the maximum kind value which does not exist. This is needed to test the
-// fallback code which punts to the standard fmt library for new types that
-// might get added to the language.
-func changeKind(v *reflect.Value, readOnly bool) {
- rvf := (*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(v)) + offsetFlag))
- *rvf = *rvf | ((1<<flagKindWidth - 1) << flagKindShift)
- if readOnly {
- *rvf |= flagRO
- } else {
- *rvf &= ^uintptr(flagRO)
- }
-}
-
-// TestAddedReflectValue tests functionaly of the dump and formatter code which
-// falls back to the standard fmt library for new types that might get added to
-// the language.
-func TestAddedReflectValue(t *testing.T) {
- i := 1
-
- // Dump using a reflect.Value that is exported.
- v := reflect.ValueOf(int8(5))
- changeKind(&v, false)
- buf := new(bytes.Buffer)
- d := dumpState{w: buf, cs: &Config}
- d.dump(v)
- s := buf.String()
- want := "(int8) 5"
- if s != want {
- t.Errorf("TestAddedReflectValue #%d\n got: %s want: %s", i, s, want)
- }
- i++
-
- // Dump using a reflect.Value that is not exported.
- changeKind(&v, true)
- buf.Reset()
- d.dump(v)
- s = buf.String()
- want = "(int8) <int8 Value>"
- if s != want {
- t.Errorf("TestAddedReflectValue #%d\n got: %s want: %s", i, s, want)
- }
- i++
-
- // Formatter using a reflect.Value that is exported.
- changeKind(&v, false)
- buf2 := new(dummyFmtState)
- f := formatState{value: v, cs: &Config, fs: buf2}
- f.format(v)
- s = buf2.String()
- want = "5"
- if s != want {
- t.Errorf("TestAddedReflectValue #%d got: %s want: %s", i, s, want)
- }
- i++
-
- // Formatter using a reflect.Value that is not exported.
- changeKind(&v, true)
- buf2.Reset()
- f = formatState{value: v, cs: &Config, fs: buf2}
- f.format(v)
- s = buf2.String()
- want = "<int8 Value>"
- if s != want {
- t.Errorf("TestAddedReflectValue #%d got: %s want: %s", i, s, want)
- }
-}
diff --git a/vendor/github.com/davecgh/go-spew/spew/spew_test.go b/vendor/github.com/davecgh/go-spew/spew/spew_test.go
deleted file mode 100644
index b70466c69..000000000
--- a/vendor/github.com/davecgh/go-spew/spew/spew_test.go
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-package spew_test
-
-import (
- "bytes"
- "fmt"
- "io/ioutil"
- "os"
- "testing"
-
- "github.com/davecgh/go-spew/spew"
-)
-
-// spewFunc is used to identify which public function of the spew package or
-// ConfigState a test applies to.
-type spewFunc int
-
-const (
- fCSFdump spewFunc = iota
- fCSFprint
- fCSFprintf
- fCSFprintln
- fCSPrint
- fCSPrintln
- fCSSdump
- fCSSprint
- fCSSprintf
- fCSSprintln
- fCSErrorf
- fCSNewFormatter
- fErrorf
- fFprint
- fFprintln
- fPrint
- fPrintln
- fSdump
- fSprint
- fSprintf
- fSprintln
-)
-
-// Map of spewFunc values to names for pretty printing.
-var spewFuncStrings = map[spewFunc]string{
- fCSFdump: "ConfigState.Fdump",
- fCSFprint: "ConfigState.Fprint",
- fCSFprintf: "ConfigState.Fprintf",
- fCSFprintln: "ConfigState.Fprintln",
- fCSSdump: "ConfigState.Sdump",
- fCSPrint: "ConfigState.Print",
- fCSPrintln: "ConfigState.Println",
- fCSSprint: "ConfigState.Sprint",
- fCSSprintf: "ConfigState.Sprintf",
- fCSSprintln: "ConfigState.Sprintln",
- fCSErrorf: "ConfigState.Errorf",
- fCSNewFormatter: "ConfigState.NewFormatter",
- fErrorf: "spew.Errorf",
- fFprint: "spew.Fprint",
- fFprintln: "spew.Fprintln",
- fPrint: "spew.Print",
- fPrintln: "spew.Println",
- fSdump: "spew.Sdump",
- fSprint: "spew.Sprint",
- fSprintf: "spew.Sprintf",
- fSprintln: "spew.Sprintln",
-}
-
-func (f spewFunc) String() string {
- if s, ok := spewFuncStrings[f]; ok {
- return s
- }
- return fmt.Sprintf("Unknown spewFunc (%d)", int(f))
-}
-
-// spewTest is used to describe a test to be performed against the public
-// functions of the spew package or ConfigState.
-type spewTest struct {
- cs *spew.ConfigState
- f spewFunc
- format string
- in interface{}
- want string
-}
-
-// spewTests houses the tests to be performed against the public functions of
-// the spew package and ConfigState.
-//
-// These tests are only intended to ensure the public functions are exercised
-// and are intentionally not exhaustive of types. The exhaustive type
-// tests are handled in the dump and format tests.
-var spewTests []spewTest
-
-// redirStdout is a helper function to return the standard output from f as a
-// byte slice.
-func redirStdout(f func()) ([]byte, error) {
- tempFile, err := ioutil.TempFile("", "ss-test")
- if err != nil {
- return nil, err
- }
- fileName := tempFile.Name()
- defer os.Remove(fileName) // Ignore error
-
- origStdout := os.Stdout
- os.Stdout = tempFile
- f()
- os.Stdout = origStdout
- tempFile.Close()
-
- return ioutil.ReadFile(fileName)
-}
-
-func initSpewTests() {
- // Config states with various settings.
- scsDefault := spew.NewDefaultConfig()
- scsNoMethods := &spew.ConfigState{Indent: " ", DisableMethods: true}
- scsNoPmethods := &spew.ConfigState{Indent: " ", DisablePointerMethods: true}
- scsMaxDepth := &spew.ConfigState{Indent: " ", MaxDepth: 1}
- scsContinue := &spew.ConfigState{Indent: " ", ContinueOnMethod: true}
- scsNoPtrAddr := &spew.ConfigState{DisablePointerAddresses: true}
- scsNoCap := &spew.ConfigState{DisableCapacities: true}
-
- // Variables for tests on types which implement Stringer interface with and
- // without a pointer receiver.
- ts := stringer("test")
- tps := pstringer("test")
-
- type ptrTester struct {
- s *struct{}
- }
- tptr := &ptrTester{s: &struct{}{}}
-
- // depthTester is used to test max depth handling for structs, array, slices
- // and maps.
- type depthTester struct {
- ic indirCir1
- arr [1]string
- slice []string
- m map[string]int
- }
- dt := depthTester{indirCir1{nil}, [1]string{"arr"}, []string{"slice"},
- map[string]int{"one": 1}}
-
- // Variable for tests on types which implement error interface.
- te := customError(10)
-
- spewTests = []spewTest{
- {scsDefault, fCSFdump, "", int8(127), "(int8) 127\n"},
- {scsDefault, fCSFprint, "", int16(32767), "32767"},
- {scsDefault, fCSFprintf, "%v", int32(2147483647), "2147483647"},
- {scsDefault, fCSFprintln, "", int(2147483647), "2147483647\n"},
- {scsDefault, fCSPrint, "", int64(9223372036854775807), "9223372036854775807"},
- {scsDefault, fCSPrintln, "", uint8(255), "255\n"},
- {scsDefault, fCSSdump, "", uint8(64), "(uint8) 64\n"},
- {scsDefault, fCSSprint, "", complex(1, 2), "(1+2i)"},
- {scsDefault, fCSSprintf, "%v", complex(float32(3), 4), "(3+4i)"},
- {scsDefault, fCSSprintln, "", complex(float64(5), 6), "(5+6i)\n"},
- {scsDefault, fCSErrorf, "%#v", uint16(65535), "(uint16)65535"},
- {scsDefault, fCSNewFormatter, "%v", uint32(4294967295), "4294967295"},
- {scsDefault, fErrorf, "%v", uint64(18446744073709551615), "18446744073709551615"},
- {scsDefault, fFprint, "", float32(3.14), "3.14"},
- {scsDefault, fFprintln, "", float64(6.28), "6.28\n"},
- {scsDefault, fPrint, "", true, "true"},
- {scsDefault, fPrintln, "", false, "false\n"},
- {scsDefault, fSdump, "", complex(-10, -20), "(complex128) (-10-20i)\n"},
- {scsDefault, fSprint, "", complex(-1, -2), "(-1-2i)"},
- {scsDefault, fSprintf, "%v", complex(float32(-3), -4), "(-3-4i)"},
- {scsDefault, fSprintln, "", complex(float64(-5), -6), "(-5-6i)\n"},
- {scsNoMethods, fCSFprint, "", ts, "test"},
- {scsNoMethods, fCSFprint, "", &ts, "<*>test"},
- {scsNoMethods, fCSFprint, "", tps, "test"},
- {scsNoMethods, fCSFprint, "", &tps, "<*>test"},
- {scsNoPmethods, fCSFprint, "", ts, "stringer test"},
- {scsNoPmethods, fCSFprint, "", &ts, "<*>stringer test"},
- {scsNoPmethods, fCSFprint, "", tps, "test"},
- {scsNoPmethods, fCSFprint, "", &tps, "<*>stringer test"},
- {scsMaxDepth, fCSFprint, "", dt, "{{<max>} [<max>] [<max>] map[<max>]}"},
- {scsMaxDepth, fCSFdump, "", dt, "(spew_test.depthTester) {\n" +
- " ic: (spew_test.indirCir1) {\n <max depth reached>\n },\n" +
- " arr: ([1]string) (len=1 cap=1) {\n <max depth reached>\n },\n" +
- " slice: ([]string) (len=1 cap=1) {\n <max depth reached>\n },\n" +
- " m: (map[string]int) (len=1) {\n <max depth reached>\n }\n}\n"},
- {scsContinue, fCSFprint, "", ts, "(stringer test) test"},
- {scsContinue, fCSFdump, "", ts, "(spew_test.stringer) " +
- "(len=4) (stringer test) \"test\"\n"},
- {scsContinue, fCSFprint, "", te, "(error: 10) 10"},
- {scsContinue, fCSFdump, "", te, "(spew_test.customError) " +
- "(error: 10) 10\n"},
- {scsNoPtrAddr, fCSFprint, "", tptr, "<*>{<*>{}}"},
- {scsNoPtrAddr, fCSSdump, "", tptr, "(*spew_test.ptrTester)({\ns: (*struct {})({\n})\n})\n"},
- {scsNoCap, fCSSdump, "", make([]string, 0, 10), "([]string) {\n}\n"},
- {scsNoCap, fCSSdump, "", make([]string, 1, 10), "([]string) (len=1) {\n(string) \"\"\n}\n"},
- }
-}
-
-// TestSpew executes all of the tests described by spewTests.
-func TestSpew(t *testing.T) {
- initSpewTests()
-
- t.Logf("Running %d tests", len(spewTests))
- for i, test := range spewTests {
- buf := new(bytes.Buffer)
- switch test.f {
- case fCSFdump:
- test.cs.Fdump(buf, test.in)
-
- case fCSFprint:
- test.cs.Fprint(buf, test.in)
-
- case fCSFprintf:
- test.cs.Fprintf(buf, test.format, test.in)
-
- case fCSFprintln:
- test.cs.Fprintln(buf, test.in)
-
- case fCSPrint:
- b, err := redirStdout(func() { test.cs.Print(test.in) })
- if err != nil {
- t.Errorf("%v #%d %v", test.f, i, err)
- continue
- }
- buf.Write(b)
-
- case fCSPrintln:
- b, err := redirStdout(func() { test.cs.Println(test.in) })
- if err != nil {
- t.Errorf("%v #%d %v", test.f, i, err)
- continue
- }
- buf.Write(b)
-
- case fCSSdump:
- str := test.cs.Sdump(test.in)
- buf.WriteString(str)
-
- case fCSSprint:
- str := test.cs.Sprint(test.in)
- buf.WriteString(str)
-
- case fCSSprintf:
- str := test.cs.Sprintf(test.format, test.in)
- buf.WriteString(str)
-
- case fCSSprintln:
- str := test.cs.Sprintln(test.in)
- buf.WriteString(str)
-
- case fCSErrorf:
- err := test.cs.Errorf(test.format, test.in)
- buf.WriteString(err.Error())
-
- case fCSNewFormatter:
- fmt.Fprintf(buf, test.format, test.cs.NewFormatter(test.in))
-
- case fErrorf:
- err := spew.Errorf(test.format, test.in)
- buf.WriteString(err.Error())
-
- case fFprint:
- spew.Fprint(buf, test.in)
-
- case fFprintln:
- spew.Fprintln(buf, test.in)
-
- case fPrint:
- b, err := redirStdout(func() { spew.Print(test.in) })
- if err != nil {
- t.Errorf("%v #%d %v", test.f, i, err)
- continue
- }
- buf.Write(b)
-
- case fPrintln:
- b, err := redirStdout(func() { spew.Println(test.in) })
- if err != nil {
- t.Errorf("%v #%d %v", test.f, i, err)
- continue
- }
- buf.Write(b)
-
- case fSdump:
- str := spew.Sdump(test.in)
- buf.WriteString(str)
-
- case fSprint:
- str := spew.Sprint(test.in)
- buf.WriteString(str)
-
- case fSprintf:
- str := spew.Sprintf(test.format, test.in)
- buf.WriteString(str)
-
- case fSprintln:
- str := spew.Sprintln(test.in)
- buf.WriteString(str)
-
- default:
- t.Errorf("%v #%d unrecognized function", test.f, i)
- continue
- }
- s := buf.String()
- if test.want != s {
- t.Errorf("ConfigState #%d\n got: %s want: %s", i, s, test.want)
- continue
- }
- }
-}
diff --git a/vendor/github.com/eapache/go-resiliency/breaker/breaker_test.go b/vendor/github.com/eapache/go-resiliency/breaker/breaker_test.go
deleted file mode 100644
index b41308db6..000000000
--- a/vendor/github.com/eapache/go-resiliency/breaker/breaker_test.go
+++ /dev/null
@@ -1,196 +0,0 @@
-package breaker
-
-import (
- "errors"
- "testing"
- "time"
-)
-
-var errSomeError = errors.New("errSomeError")
-
-func alwaysPanics() error {
- panic("foo")
-}
-
-func returnsError() error {
- return errSomeError
-}
-
-func returnsSuccess() error {
- return nil
-}
-
-func TestBreakerErrorExpiry(t *testing.T) {
- breaker := New(2, 1, 1*time.Second)
-
- for i := 0; i < 3; i++ {
- if err := breaker.Run(returnsError); err != errSomeError {
- t.Error(err)
- }
- time.Sleep(1 * time.Second)
- }
-
- for i := 0; i < 3; i++ {
- if err := breaker.Go(returnsError); err != nil {
- t.Error(err)
- }
- time.Sleep(1 * time.Second)
- }
-}
-
-func TestBreakerPanicsCountAsErrors(t *testing.T) {
- breaker := New(3, 2, 1*time.Second)
-
- // three errors opens the breaker
- for i := 0; i < 3; i++ {
- func() {
- defer func() {
- val := recover()
- if val.(string) != "foo" {
- t.Error("incorrect panic")
- }
- }()
- if err := breaker.Run(alwaysPanics); err != nil {
- t.Error(err)
- }
- t.Error("shouldn't get here")
- }()
- }
-
- // breaker is open
- for i := 0; i < 5; i++ {
- if err := breaker.Run(returnsError); err != ErrBreakerOpen {
- t.Error(err)
- }
- }
-}
-
-func TestBreakerStateTransitions(t *testing.T) {
- breaker := New(3, 2, 1*time.Second)
-
- // three errors opens the breaker
- for i := 0; i < 3; i++ {
- if err := breaker.Run(returnsError); err != errSomeError {
- t.Error(err)
- }
- }
-
- // breaker is open
- for i := 0; i < 5; i++ {
- if err := breaker.Run(returnsError); err != ErrBreakerOpen {
- t.Error(err)
- }
- }
-
- // wait for it to half-close
- time.Sleep(2 * time.Second)
- // one success works, but is not enough to fully close
- if err := breaker.Run(returnsSuccess); err != nil {
- t.Error(err)
- }
- // error works, but re-opens immediately
- if err := breaker.Run(returnsError); err != errSomeError {
- t.Error(err)
- }
- // breaker is open
- if err := breaker.Run(returnsError); err != ErrBreakerOpen {
- t.Error(err)
- }
-
- // wait for it to half-close
- time.Sleep(2 * time.Second)
- // two successes is enough to close it for good
- for i := 0; i < 2; i++ {
- if err := breaker.Run(returnsSuccess); err != nil {
- t.Error(err)
- }
- }
- // error works
- if err := breaker.Run(returnsError); err != errSomeError {
- t.Error(err)
- }
- // breaker is still closed
- if err := breaker.Run(returnsSuccess); err != nil {
- t.Error(err)
- }
-}
-
-func TestBreakerAsyncStateTransitions(t *testing.T) {
- breaker := New(3, 2, 1*time.Second)
-
- // three errors opens the breaker
- for i := 0; i < 3; i++ {
- if err := breaker.Go(returnsError); err != nil {
- t.Error(err)
- }
- }
-
- // just enough to yield the scheduler and let the goroutines work off
- time.Sleep(1 * time.Millisecond)
-
- // breaker is open
- for i := 0; i < 5; i++ {
- if err := breaker.Go(returnsError); err != ErrBreakerOpen {
- t.Error(err)
- }
- }
-
- // wait for it to half-close
- time.Sleep(2 * time.Second)
- // one success works, but is not enough to fully close
- if err := breaker.Go(returnsSuccess); err != nil {
- t.Error(err)
- }
- // error works, but re-opens immediately
- if err := breaker.Go(returnsError); err != nil {
- t.Error(err)
- }
- // just enough to yield the scheduler and let the goroutines work off
- time.Sleep(1 * time.Millisecond)
- // breaker is open
- if err := breaker.Go(returnsError); err != ErrBreakerOpen {
- t.Error(err)
- }
-
- // wait for it to half-close
- time.Sleep(2 * time.Second)
- // two successes is enough to close it for good
- for i := 0; i < 2; i++ {
- if err := breaker.Go(returnsSuccess); err != nil {
- t.Error(err)
- }
- }
- // just enough to yield the scheduler and let the goroutines work off
- time.Sleep(1 * time.Millisecond)
- // error works
- if err := breaker.Go(returnsError); err != nil {
- t.Error(err)
- }
- // just enough to yield the scheduler and let the goroutines work off
- time.Sleep(1 * time.Millisecond)
- // breaker is still closed
- if err := breaker.Go(returnsSuccess); err != nil {
- t.Error(err)
- }
-}
-
-func ExampleBreaker() {
- breaker := New(3, 1, 5*time.Second)
-
- for {
- result := breaker.Run(func() error {
- // communicate with some external service and
- // return an error if the communication failed
- return nil
- })
-
- switch result {
- case nil:
- // success!
- case ErrBreakerOpen:
- // our function wasn't run because the breaker was open
- default:
- // some other error
- }
- }
-}
diff --git a/vendor/github.com/eapache/go-xerial-snappy/snappy_test.go b/vendor/github.com/eapache/go-xerial-snappy/snappy_test.go
deleted file mode 100644
index e94f635df..000000000
--- a/vendor/github.com/eapache/go-xerial-snappy/snappy_test.go
+++ /dev/null
@@ -1,49 +0,0 @@
-package snappy
-
-import (
- "bytes"
- "testing"
-)
-
-var snappyTestCases = map[string][]byte{
- "REPEATREPEATREPEATREPEATREPEATREPEAT": {36, 20, 82, 69, 80, 69, 65, 84, 118, 6, 0},
- "REALLY SHORT": {12, 44, 82, 69, 65, 76, 76, 89, 32, 83, 72, 79, 82, 84},
- "AXBXCXDXEXFX": {12, 44, 65, 88, 66, 88, 67, 88, 68, 88, 69, 88, 70, 88},
-}
-
-var snappyStreamTestCases = map[string][]byte{
- "PLAINDATA": {130, 83, 78, 65, 80, 80, 89, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 11, 9, 32, 80, 76, 65, 73, 78, 68, 65, 84, 65},
- `{"a":"UtaitILHMDAAAAfU","b":"日本"}`: {130, 83, 78, 65, 80, 80, 89, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 39, 37, 144, 123, 34, 97, 34, 58, 34, 85, 116, 97, 105, 116, 73, 76, 72, 77, 68, 65, 65, 65, 65, 102, 85, 34, 44, 34, 98, 34, 58, 34, 230, 151, 165, 230, 156, 172, 34, 125},
- `Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias except`: {130, 83, 78, 65, 80, 80, 89, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 3, 89, 128, 8, 240, 90, 83, 101, 100, 32, 117, 116, 32, 112, 101, 114, 115, 112, 105, 99, 105, 97, 116, 105, 115, 32, 117, 110, 100, 101, 32, 111, 109, 110, 105, 115, 32, 105, 115, 116, 101, 32, 110, 97, 116, 117, 115, 32, 101, 114, 114, 111, 114, 32, 115, 105, 116, 32, 118, 111, 108, 117, 112, 116, 97, 116, 101, 109, 32, 97, 99, 99, 117, 115, 97, 110, 116, 105, 117, 109, 32, 100, 111, 108, 111, 114, 101, 109, 113, 117, 101, 32, 108, 97, 117, 100, 97, 5, 22, 240, 60, 44, 32, 116, 111, 116, 97, 109, 32, 114, 101, 109, 32, 97, 112, 101, 114, 105, 97, 109, 44, 32, 101, 97, 113, 117, 101, 32, 105, 112, 115, 97, 32, 113, 117, 97, 101, 32, 97, 98, 32, 105, 108, 108, 111, 32, 105, 110, 118, 101, 110, 116, 111, 114, 101, 32, 118, 101, 114, 105, 116, 97, 1, 141, 4, 101, 116, 1, 36, 88, 115, 105, 32, 97, 114, 99, 104, 105, 116, 101, 99, 116, 111, 32, 98, 101, 97, 116, 97, 101, 32, 118, 105, 1, 6, 120, 100, 105, 99, 116, 97, 32, 115, 117, 110, 116, 32, 101, 120, 112, 108, 105, 99, 97, 98, 111, 46, 32, 78, 101, 109, 111, 32, 101, 110, 105, 109, 5, 103, 0, 109, 46, 180, 0, 12, 113, 117, 105, 97, 17, 16, 0, 115, 5, 209, 72, 97, 115, 112, 101, 114, 110, 97, 116, 117, 114, 32, 97, 117, 116, 32, 111, 100, 105, 116, 5, 9, 36, 102, 117, 103, 105, 116, 44, 32, 115, 101, 100, 9, 53, 32, 99, 111, 110, 115, 101, 113, 117, 117, 110, 1, 42, 20, 109, 97, 103, 110, 105, 32, 9, 245, 16, 115, 32, 101, 111, 115, 1, 36, 28, 32, 114, 97, 116, 105, 111, 110, 101, 17, 96, 33, 36, 1, 51, 36, 105, 32, 110, 101, 115, 99, 105, 117, 110, 116, 1, 155, 1, 254, 16, 112, 111, 114, 114, 111, 1, 51, 36, 115, 113, 117, 97, 109, 32, 101, 115, 116, 44, 1, 14, 13, 81, 5, 183, 4, 117, 109, 1, 18, 0, 97, 9, 19, 4, 32, 115, 1, 149, 12, 109, 101, 116, 44, 9, 135, 76, 99, 116, 101, 116, 117, 114, 44, 32, 97, 100, 105, 112, 105, 115, 99, 105, 32, 118, 101, 108, 50, 173, 0, 24, 110, 111, 110, 32, 110, 117, 109, 9, 94, 84, 105, 117, 115, 32, 109, 111, 100, 105, 32, 116, 101, 109, 112, 111, 114, 97, 32, 105, 110, 99, 105, 100, 33, 52, 20, 117, 116, 32, 108, 97, 98, 33, 116, 4, 101, 116, 9, 106, 0, 101, 5, 219, 20, 97, 109, 32, 97, 108, 105, 5, 62, 33, 164, 8, 114, 97, 116, 29, 212, 12, 46, 32, 85, 116, 41, 94, 52, 97, 100, 32, 109, 105, 110, 105, 109, 97, 32, 118, 101, 110, 105, 33, 221, 72, 113, 117, 105, 115, 32, 110, 111, 115, 116, 114, 117, 109, 32, 101, 120, 101, 114, 99, 105, 33, 202, 104, 111, 110, 101, 109, 32, 117, 108, 108, 97, 109, 32, 99, 111, 114, 112, 111, 114, 105, 115, 32, 115, 117, 115, 99, 105, 112, 105, 13, 130, 8, 105, 111, 115, 1, 64, 12, 110, 105, 115, 105, 1, 150, 5, 126, 44, 105, 100, 32, 101, 120, 32, 101, 97, 32, 99, 111, 109, 5, 192, 0, 99, 41, 131, 33, 172, 8, 63, 32, 81, 1, 107, 4, 97, 117, 33, 101, 96, 118, 101, 108, 32, 101, 117, 109, 32, 105, 117, 114, 101, 32, 114, 101, 112, 114, 101, 104, 101, 110, 100, 101, 114, 105, 65, 63, 12, 105, 32, 105, 110, 1, 69, 16, 118, 111, 108, 117, 112, 65, 185, 1, 47, 24, 105, 116, 32, 101, 115, 115, 101, 1, 222, 64, 109, 32, 110, 105, 104, 105, 108, 32, 109, 111, 108, 101, 115, 116, 105, 97, 101, 46, 103, 0, 0, 44, 1, 45, 16, 32, 105, 108, 108, 117, 37, 143, 45, 36, 0, 109, 5, 110, 65, 33, 20, 97, 116, 32, 113, 117, 111, 17, 92, 44, 115, 32, 110, 117, 108, 108, 97, 32, 112, 97, 114, 105, 9, 165, 24, 65, 116, 32, 118, 101, 114, 111, 69, 34, 44, 101, 116, 32, 97, 99, 99, 117, 115, 97, 109, 117, 115, 1, 13, 104, 105, 117, 115, 116, 111, 32, 111, 100, 105, 111, 32, 100, 105, 103, 110, 105, 115, 115, 105, 109, 111, 115, 32, 100, 117, 99, 105, 1, 34, 80, 113, 117, 105, 32, 98, 108, 97, 110, 100, 105, 116, 105, 105, 115, 32, 112, 114, 97, 101, 115, 101, 101, 87, 17, 111, 56, 116, 117, 109, 32, 100, 101, 108, 101, 110, 105, 116, 105, 32, 97, 116, 65, 89, 28, 99, 111, 114, 114, 117, 112, 116, 105, 1, 150, 0, 115, 13, 174, 5, 109, 8, 113, 117, 97, 65, 5, 52, 108, 101, 115, 116, 105, 97, 115, 32, 101, 120, 99, 101, 112, 116, 0, 0, 0, 1, 0},
-}
-
-func TestSnappyEncode(t *testing.T) {
- for src, exp := range snappyTestCases {
- dst := Encode([]byte(src))
- if !bytes.Equal(dst, exp) {
- t.Errorf("Expected %s to generate %v, but was %v", src, exp, dst)
- }
- }
-}
-
-func TestSnappyDecode(t *testing.T) {
- for exp, src := range snappyTestCases {
- dst, err := Decode(src)
- if err != nil {
- t.Error("Encoding error: ", err)
- } else if !bytes.Equal(dst, []byte(exp)) {
- t.Errorf("Expected %s to be generated from %v, but was %s", exp, src, string(dst))
- }
- }
-}
-
-func TestSnappyDecodeStreams(t *testing.T) {
- for exp, src := range snappyStreamTestCases {
- dst, err := Decode(src)
- if err != nil {
- t.Error("Encoding error: ", err)
- } else if !bytes.Equal(dst, []byte(exp)) {
- t.Errorf("Expected %s to be generated from [%d]byte, but was %s", exp, len(src), string(dst))
- }
- }
-}
diff --git a/vendor/github.com/eapache/queue/queue_test.go b/vendor/github.com/eapache/queue/queue_test.go
deleted file mode 100644
index a87584883..000000000
--- a/vendor/github.com/eapache/queue/queue_test.go
+++ /dev/null
@@ -1,178 +0,0 @@
-package queue
-
-import "testing"
-
-func TestQueueSimple(t *testing.T) {
- q := New()
-
- for i := 0; i < minQueueLen; i++ {
- q.Add(i)
- }
- for i := 0; i < minQueueLen; i++ {
- if q.Peek().(int) != i {
- t.Error("peek", i, "had value", q.Peek())
- }
- x := q.Remove()
- if x != i {
- t.Error("remove", i, "had value", x)
- }
- }
-}
-
-func TestQueueWrapping(t *testing.T) {
- q := New()
-
- for i := 0; i < minQueueLen; i++ {
- q.Add(i)
- }
- for i := 0; i < 3; i++ {
- q.Remove()
- q.Add(minQueueLen + i)
- }
-
- for i := 0; i < minQueueLen; i++ {
- if q.Peek().(int) != i+3 {
- t.Error("peek", i, "had value", q.Peek())
- }
- q.Remove()
- }
-}
-
-func TestQueueLength(t *testing.T) {
- q := New()
-
- if q.Length() != 0 {
- t.Error("empty queue length not 0")
- }
-
- for i := 0; i < 1000; i++ {
- q.Add(i)
- if q.Length() != i+1 {
- t.Error("adding: queue with", i, "elements has length", q.Length())
- }
- }
- for i := 0; i < 1000; i++ {
- q.Remove()
- if q.Length() != 1000-i-1 {
- t.Error("removing: queue with", 1000-i-i, "elements has length", q.Length())
- }
- }
-}
-
-func TestQueueGet(t *testing.T) {
- q := New()
-
- for i := 0; i < 1000; i++ {
- q.Add(i)
- for j := 0; j < q.Length(); j++ {
- if q.Get(j).(int) != j {
- t.Errorf("index %d doesn't contain %d", j, j)
- }
- }
- }
-}
-
-func TestQueueGetNegative(t *testing.T) {
- q := New()
-
- for i := 0; i < 1000; i++ {
- q.Add(i)
- for j := 1; j <= q.Length(); j++ {
- if q.Get(-j).(int) != q.Length()-j {
- t.Errorf("index %d doesn't contain %d", -j, q.Length()-j)
- }
- }
- }
-}
-
-func TestQueueGetOutOfRangePanics(t *testing.T) {
- q := New()
-
- q.Add(1)
- q.Add(2)
- q.Add(3)
-
- assertPanics(t, "should panic when negative index", func() {
- q.Get(-4)
- })
-
- assertPanics(t, "should panic when index greater than length", func() {
- q.Get(4)
- })
-}
-
-func TestQueuePeekOutOfRangePanics(t *testing.T) {
- q := New()
-
- assertPanics(t, "should panic when peeking empty queue", func() {
- q.Peek()
- })
-
- q.Add(1)
- q.Remove()
-
- assertPanics(t, "should panic when peeking emptied queue", func() {
- q.Peek()
- })
-}
-
-func TestQueueRemoveOutOfRangePanics(t *testing.T) {
- q := New()
-
- assertPanics(t, "should panic when removing empty queue", func() {
- q.Remove()
- })
-
- q.Add(1)
- q.Remove()
-
- assertPanics(t, "should panic when removing emptied queue", func() {
- q.Remove()
- })
-}
-
-func assertPanics(t *testing.T, name string, f func()) {
- defer func() {
- if r := recover(); r == nil {
- t.Errorf("%s: didn't panic as expected", name)
- }
- }()
-
- f()
-}
-
-// General warning: Go's benchmark utility (go test -bench .) increases the number of
-// iterations until the benchmarks take a reasonable amount of time to run; memory usage
-// is *NOT* considered. On my machine, these benchmarks hit around ~1GB before they've had
-// enough, but if you have less than that available and start swapping, then all bets are off.
-
-func BenchmarkQueueSerial(b *testing.B) {
- q := New()
- for i := 0; i < b.N; i++ {
- q.Add(nil)
- }
- for i := 0; i < b.N; i++ {
- q.Peek()
- q.Remove()
- }
-}
-
-func BenchmarkQueueGet(b *testing.B) {
- q := New()
- for i := 0; i < b.N; i++ {
- q.Add(i)
- }
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- q.Get(i)
- }
-}
-
-func BenchmarkQueueTickTock(b *testing.B) {
- q := New()
- for i := 0; i < b.N; i++ {
- q.Add(nil)
- q.Peek()
- q.Remove()
- }
-}
diff --git a/vendor/github.com/farsightsec/golang-framestream/framestream_test.go b/vendor/github.com/farsightsec/golang-framestream/framestream_test.go
deleted file mode 100644
index 28e8bd82c..000000000
--- a/vendor/github.com/farsightsec/golang-framestream/framestream_test.go
+++ /dev/null
@@ -1,185 +0,0 @@
-package framestream_test
-
-import (
- "bytes"
- "net"
- "sync"
- "testing"
- "time"
-
- framestream "github.com/farsightsec/golang-framestream"
-)
-
-func testDecoder(t *testing.T, dec *framestream.Decoder, nframes int) {
- i := 1
- for {
- tf, err := dec.Decode()
- if err != nil {
- if i < nframes+1 {
- t.Fatalf("testDecoder(%d): %v", i, err)
- }
- if err != framestream.EOF {
- t.Fatalf("unexpected error: %v != EOF", err)
- }
- return
- }
- if i > nframes {
- t.Errorf("extra frame received: %d", i)
- }
- f := make([]byte, i)
- if bytes.Compare(tf, f) != 0 {
- t.Errorf("testDecoder: received %v != %v", tf, f)
- }
- i++
- }
-}
-
-func TestUnidirectional(t *testing.T) {
- buf := new(bytes.Buffer)
- enc, err := framestream.NewEncoder(buf, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- for i := 1; i < 10; i++ {
- b := make([]byte, i)
- if _, err = enc.Write(b); err != nil {
- t.Error(err)
- }
- }
- enc.Close()
-
- dec, err := framestream.NewDecoder(buf, nil)
- if err != nil {
- t.Fatal(err)
- }
- testDecoder(t, dec, 9)
-}
-
-func TestBidirectional(t *testing.T) {
- client, server := net.Pipe()
-
- go func() {
- dec, err := framestream.NewDecoder(server,
- &framestream.DecoderOptions{
- Bidirectional: true,
- })
-
- if err != nil {
- t.Fatal(err)
- }
- testDecoder(t, dec, 9)
- }()
-
- enc, err := framestream.NewEncoder(client,
- &framestream.EncoderOptions{
- Bidirectional: true,
- })
- if err != nil {
- t.Fatal(err)
- }
-
- for i := 1; i < 10; i++ {
- b := make([]byte, i)
- if _, err := enc.Write(b); err != nil {
- t.Error(err)
- }
- }
- enc.Close()
-}
-
-func TestContentTypeMismatch(t *testing.T) {
- buf := new(bytes.Buffer)
-
- enc, err := framestream.NewEncoder(buf,
- &framestream.EncoderOptions{
- ContentType: []byte("test"),
- })
- if err != nil {
- t.Fatal(err)
- }
- enc.Write([]byte("hello, world"))
- enc.Close()
-
- _, err = framestream.NewDecoder(buf,
- &framestream.DecoderOptions{
- ContentType: []byte("wrong"),
- })
- if err != framestream.ErrContentTypeMismatch {
- t.Error("expected %v, received %v",
- framestream.ErrContentTypeMismatch,
- err)
- }
-}
-
-func TestOversizeFrame(t *testing.T) {
- buf := new(bytes.Buffer)
- enc, err := framestream.NewEncoder(buf, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- enc.Write(make([]byte, 15))
- enc.Close()
-
- dec, err := framestream.NewDecoder(buf,
- &framestream.DecoderOptions{
- MaxPayloadSize: 10,
- })
- if err != nil {
- t.Fatal(err)
- }
- _, err = dec.Decode()
- if err != framestream.ErrDataFrameTooLarge {
- t.Error("data frame too large, received %v", err)
- }
-}
-
-func testNew(t *testing.T, bidirectional bool) {
- client, server := net.Pipe()
- wg := &sync.WaitGroup{}
- wg.Add(2)
- done := make(chan bool)
-
- go func() {
- _, err := framestream.NewDecoder(server,
- &framestream.DecoderOptions{
- Bidirectional: bidirectional,
- })
-
- if err != nil {
- t.Fatal(err)
- }
- wg.Done()
- }()
-
- go func() {
- _, err := framestream.NewEncoder(client,
- &framestream.EncoderOptions{
- Bidirectional: bidirectional,
- })
- if err != nil {
- t.Fatal(err)
- }
- wg.Done()
- }()
-
- go func() {
- wg.Wait()
- close(done)
- }()
-
- select {
- case <-done:
- case <-time.After(1 * time.Second):
- t.Fatal("Time's up.")
- }
-}
-
-func TestNewBidirectional(t *testing.T) {
- testNew(t, true)
-}
-
-func TestNewUnidirectional(t *testing.T) {
- testNew(t, false)
-}
diff --git a/vendor/github.com/ghodss/yaml/yaml_test.go b/vendor/github.com/ghodss/yaml/yaml_test.go
deleted file mode 100644
index 505af4530..000000000
--- a/vendor/github.com/ghodss/yaml/yaml_test.go
+++ /dev/null
@@ -1,287 +0,0 @@
-package yaml
-
-import (
- "fmt"
- "math"
- "reflect"
- "strconv"
- "testing"
-)
-
-type MarshalTest struct {
- A string
- B int64
- // Would like to test float64, but it's not supported in go-yaml.
- // (See https://github.com/go-yaml/yaml/issues/83.)
- C float32
-}
-
-func TestMarshal(t *testing.T) {
- f32String := strconv.FormatFloat(math.MaxFloat32, 'g', -1, 32)
- s := MarshalTest{"a", math.MaxInt64, math.MaxFloat32}
- e := []byte(fmt.Sprintf("A: a\nB: %d\nC: %s\n", math.MaxInt64, f32String))
-
- y, err := Marshal(s)
- if err != nil {
- t.Errorf("error marshaling YAML: %v", err)
- }
-
- if !reflect.DeepEqual(y, e) {
- t.Errorf("marshal YAML was unsuccessful, expected: %#v, got: %#v",
- string(e), string(y))
- }
-}
-
-type UnmarshalString struct {
- A string
- True string
-}
-
-type UnmarshalStringMap struct {
- A map[string]string
-}
-
-type UnmarshalNestedString struct {
- A NestedString
-}
-
-type NestedString struct {
- A string
-}
-
-type UnmarshalSlice struct {
- A []NestedSlice
-}
-
-type NestedSlice struct {
- B string
- C *string
-}
-
-func TestUnmarshal(t *testing.T) {
- y := []byte("a: 1")
- s1 := UnmarshalString{}
- e1 := UnmarshalString{A: "1"}
- unmarshal(t, y, &s1, &e1)
-
- y = []byte("a: true")
- s1 = UnmarshalString{}
- e1 = UnmarshalString{A: "true"}
- unmarshal(t, y, &s1, &e1)
-
- y = []byte("true: 1")
- s1 = UnmarshalString{}
- e1 = UnmarshalString{True: "1"}
- unmarshal(t, y, &s1, &e1)
-
- y = []byte("a:\n a: 1")
- s2 := UnmarshalNestedString{}
- e2 := UnmarshalNestedString{NestedString{"1"}}
- unmarshal(t, y, &s2, &e2)
-
- y = []byte("a:\n - b: abc\n c: def\n - b: 123\n c: 456\n")
- s3 := UnmarshalSlice{}
- e3 := UnmarshalSlice{[]NestedSlice{NestedSlice{"abc", strPtr("def")}, NestedSlice{"123", strPtr("456")}}}
- unmarshal(t, y, &s3, &e3)
-
- y = []byte("a:\n b: 1")
- s4 := UnmarshalStringMap{}
- e4 := UnmarshalStringMap{map[string]string{"b": "1"}}
- unmarshal(t, y, &s4, &e4)
-
- y = []byte(`
-a:
- name: TestA
-b:
- name: TestB
-`)
- type NamedThing struct {
- Name string `json:"name"`
- }
- s5 := map[string]*NamedThing{}
- e5 := map[string]*NamedThing{
- "a": &NamedThing{Name: "TestA"},
- "b": &NamedThing{Name: "TestB"},
- }
- unmarshal(t, y, &s5, &e5)
-}
-
-func unmarshal(t *testing.T, y []byte, s, e interface{}) {
- err := Unmarshal(y, s)
- if err != nil {
- t.Errorf("error unmarshaling YAML: %v", err)
- }
-
- if !reflect.DeepEqual(s, e) {
- t.Errorf("unmarshal YAML was unsuccessful, expected: %+#v, got: %+#v",
- e, s)
- }
-}
-
-type Case struct {
- input string
- output string
- // By default we test that reversing the output == input. But if there is a
- // difference in the reversed output, you can optionally specify it here.
- reverse *string
-}
-
-type RunType int
-
-const (
- RunTypeJSONToYAML RunType = iota
- RunTypeYAMLToJSON
-)
-
-func TestJSONToYAML(t *testing.T) {
- cases := []Case{
- {
- `{"t":"a"}`,
- "t: a\n",
- nil,
- }, {
- `{"t":null}`,
- "t: null\n",
- nil,
- },
- }
-
- runCases(t, RunTypeJSONToYAML, cases)
-}
-
-func TestYAMLToJSON(t *testing.T) {
- cases := []Case{
- {
- "t: a\n",
- `{"t":"a"}`,
- nil,
- }, {
- "t: \n",
- `{"t":null}`,
- strPtr("t: null\n"),
- }, {
- "t: null\n",
- `{"t":null}`,
- nil,
- }, {
- "1: a\n",
- `{"1":"a"}`,
- strPtr("\"1\": a\n"),
- }, {
- "1000000000000000000000000000000000000: a\n",
- `{"1e+36":"a"}`,
- strPtr("\"1e+36\": a\n"),
- }, {
- "1e+36: a\n",
- `{"1e+36":"a"}`,
- strPtr("\"1e+36\": a\n"),
- }, {
- "\"1e+36\": a\n",
- `{"1e+36":"a"}`,
- nil,
- }, {
- "\"1.2\": a\n",
- `{"1.2":"a"}`,
- nil,
- }, {
- "- t: a\n",
- `[{"t":"a"}]`,
- nil,
- }, {
- "- t: a\n" +
- "- t:\n" +
- " b: 1\n" +
- " c: 2\n",
- `[{"t":"a"},{"t":{"b":1,"c":2}}]`,
- nil,
- }, {
- `[{t: a}, {t: {b: 1, c: 2}}]`,
- `[{"t":"a"},{"t":{"b":1,"c":2}}]`,
- strPtr("- t: a\n" +
- "- t:\n" +
- " b: 1\n" +
- " c: 2\n"),
- }, {
- "- t: \n",
- `[{"t":null}]`,
- strPtr("- t: null\n"),
- }, {
- "- t: null\n",
- `[{"t":null}]`,
- nil,
- },
- }
-
- // Cases that should produce errors.
- _ = []Case{
- {
- "~: a",
- `{"null":"a"}`,
- nil,
- }, {
- "a: !!binary gIGC\n",
- "{\"a\":\"\x80\x81\x82\"}",
- nil,
- },
- }
-
- runCases(t, RunTypeYAMLToJSON, cases)
-}
-
-func runCases(t *testing.T, runType RunType, cases []Case) {
- var f func([]byte) ([]byte, error)
- var invF func([]byte) ([]byte, error)
- var msg string
- var invMsg string
- if runType == RunTypeJSONToYAML {
- f = JSONToYAML
- invF = YAMLToJSON
- msg = "JSON to YAML"
- invMsg = "YAML back to JSON"
- } else {
- f = YAMLToJSON
- invF = JSONToYAML
- msg = "YAML to JSON"
- invMsg = "JSON back to YAML"
- }
-
- for _, c := range cases {
- // Convert the string.
- t.Logf("converting %s\n", c.input)
- output, err := f([]byte(c.input))
- if err != nil {
- t.Errorf("Failed to convert %s, input: `%s`, err: %v", msg, c.input, err)
- }
-
- // Check it against the expected output.
- if string(output) != c.output {
- t.Errorf("Failed to convert %s, input: `%s`, expected `%s`, got `%s`",
- msg, c.input, c.output, string(output))
- }
-
- // Set the string that we will compare the reversed output to.
- reverse := c.input
- // If a special reverse string was specified, use that instead.
- if c.reverse != nil {
- reverse = *c.reverse
- }
-
- // Reverse the output.
- input, err := invF(output)
- if err != nil {
- t.Errorf("Failed to convert %s, input: `%s`, err: %v", invMsg, string(output), err)
- }
-
- // Check the reverse is equal to the input (or to *c.reverse).
- if string(input) != reverse {
- t.Errorf("Failed to convert %s, input: `%s`, expected `%s`, got `%s`",
- invMsg, string(output), reverse, string(input))
- }
- }
-
-}
-
-// To be able to easily fill in the *Case.reverse string above.
-func strPtr(s string) *string {
- return &s
-}
diff --git a/vendor/github.com/go-ini/ini/bench_test.go b/vendor/github.com/go-ini/ini/bench_test.go
deleted file mode 100644
index fc1802469..000000000
--- a/vendor/github.com/go-ini/ini/bench_test.go
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright 2017 Unknwon
-//
-// Licensed under the Apache License, Version 2.0 (the "License"): you may
-// not use this file except in compliance with the License. You may obtain
-// a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations
-// under the License.
-
-package ini_test
-
-import (
- "testing"
-
- "gopkg.in/ini.v1"
-)
-
-func newTestFile(block bool) *ini.File {
- c, _ := ini.Load([]byte(_CONF_DATA))
- c.BlockMode = block
- return c
-}
-
-func Benchmark_Key_Value(b *testing.B) {
- c := newTestFile(true)
- for i := 0; i < b.N; i++ {
- c.Section("").Key("NAME").Value()
- }
-}
-
-func Benchmark_Key_Value_NonBlock(b *testing.B) {
- c := newTestFile(false)
- for i := 0; i < b.N; i++ {
- c.Section("").Key("NAME").Value()
- }
-}
-
-func Benchmark_Key_Value_ViaSection(b *testing.B) {
- c := newTestFile(true)
- sec := c.Section("")
- for i := 0; i < b.N; i++ {
- sec.Key("NAME").Value()
- }
-}
-
-func Benchmark_Key_Value_ViaSection_NonBlock(b *testing.B) {
- c := newTestFile(false)
- sec := c.Section("")
- for i := 0; i < b.N; i++ {
- sec.Key("NAME").Value()
- }
-}
-
-func Benchmark_Key_Value_Direct(b *testing.B) {
- c := newTestFile(true)
- key := c.Section("").Key("NAME")
- for i := 0; i < b.N; i++ {
- key.Value()
- }
-}
-
-func Benchmark_Key_Value_Direct_NonBlock(b *testing.B) {
- c := newTestFile(false)
- key := c.Section("").Key("NAME")
- for i := 0; i < b.N; i++ {
- key.Value()
- }
-}
-
-func Benchmark_Key_String(b *testing.B) {
- c := newTestFile(true)
- for i := 0; i < b.N; i++ {
- _ = c.Section("").Key("NAME").String()
- }
-}
-
-func Benchmark_Key_String_NonBlock(b *testing.B) {
- c := newTestFile(false)
- for i := 0; i < b.N; i++ {
- _ = c.Section("").Key("NAME").String()
- }
-}
-
-func Benchmark_Key_String_ViaSection(b *testing.B) {
- c := newTestFile(true)
- sec := c.Section("")
- for i := 0; i < b.N; i++ {
- _ = sec.Key("NAME").String()
- }
-}
-
-func Benchmark_Key_String_ViaSection_NonBlock(b *testing.B) {
- c := newTestFile(false)
- sec := c.Section("")
- for i := 0; i < b.N; i++ {
- _ = sec.Key("NAME").String()
- }
-}
-
-func Benchmark_Key_SetValue(b *testing.B) {
- c := newTestFile(true)
- for i := 0; i < b.N; i++ {
- c.Section("").Key("NAME").SetValue("10")
- }
-}
-
-func Benchmark_Key_SetValue_VisSection(b *testing.B) {
- c := newTestFile(true)
- sec := c.Section("")
- for i := 0; i < b.N; i++ {
- sec.Key("NAME").SetValue("10")
- }
-}
diff --git a/vendor/github.com/go-ini/ini/file_test.go b/vendor/github.com/go-ini/ini/file_test.go
deleted file mode 100644
index 2a0ca7c75..000000000
--- a/vendor/github.com/go-ini/ini/file_test.go
+++ /dev/null
@@ -1,294 +0,0 @@
-// Copyright 2017 Unknwon
-//
-// Licensed under the Apache License, Version 2.0 (the "License"): you may
-// not use this file except in compliance with the License. You may obtain
-// a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations
-// under the License.
-
-package ini_test
-
-import (
- "bytes"
- "io/ioutil"
- "testing"
-
- . "github.com/smartystreets/goconvey/convey"
- "gopkg.in/ini.v1"
-)
-
-func TestEmpty(t *testing.T) {
- Convey("Create an empty object", t, func() {
- f := ini.Empty()
- So(f, ShouldNotBeNil)
-
- // Should only have the default section
- So(len(f.Sections()), ShouldEqual, 1)
-
- // Default section should not contain any key
- So(len(f.Section("").Keys()), ShouldBeZeroValue)
- })
-}
-
-func TestFile_NewSection(t *testing.T) {
- Convey("Create a new section", t, func() {
- f := ini.Empty()
- So(f, ShouldNotBeNil)
-
- sec, err := f.NewSection("author")
- So(err, ShouldBeNil)
- So(sec, ShouldNotBeNil)
- So(sec.Name(), ShouldEqual, "author")
-
- So(f.SectionStrings(), ShouldResemble, []string{ini.DEFAULT_SECTION, "author"})
-
- Convey("With duplicated name", func() {
- sec, err := f.NewSection("author")
- So(err, ShouldBeNil)
- So(sec, ShouldNotBeNil)
-
- // Does nothing if section already exists
- So(f.SectionStrings(), ShouldResemble, []string{ini.DEFAULT_SECTION, "author"})
- })
-
- Convey("With empty string", func() {
- _, err := f.NewSection("")
- So(err, ShouldNotBeNil)
- })
- })
-}
-
-func TestFile_NewRawSection(t *testing.T) {
- Convey("Create a new raw section", t, func() {
- f := ini.Empty()
- So(f, ShouldNotBeNil)
-
- sec, err := f.NewRawSection("comments", `1111111111111111111000000000000000001110000
-111111111111111111100000000000111000000000`)
- So(err, ShouldBeNil)
- So(sec, ShouldNotBeNil)
- So(sec.Name(), ShouldEqual, "comments")
-
- So(f.SectionStrings(), ShouldResemble, []string{ini.DEFAULT_SECTION, "comments"})
- So(f.Section("comments").Body(), ShouldEqual, `1111111111111111111000000000000000001110000
-111111111111111111100000000000111000000000`)
-
- Convey("With duplicated name", func() {
- sec, err := f.NewRawSection("comments", `1111111111111111111000000000000000001110000`)
- So(err, ShouldBeNil)
- So(sec, ShouldNotBeNil)
- So(f.SectionStrings(), ShouldResemble, []string{ini.DEFAULT_SECTION, "comments"})
-
- // Overwrite previous existed section
- So(f.Section("comments").Body(), ShouldEqual, `1111111111111111111000000000000000001110000`)
- })
-
- Convey("With empty string", func() {
- _, err := f.NewRawSection("", "")
- So(err, ShouldNotBeNil)
- })
- })
-}
-
-func TestFile_NewSections(t *testing.T) {
- Convey("Create new sections", t, func() {
- f := ini.Empty()
- So(f, ShouldNotBeNil)
-
- So(f.NewSections("package", "author"), ShouldBeNil)
- So(f.SectionStrings(), ShouldResemble, []string{ini.DEFAULT_SECTION, "package", "author"})
-
- Convey("With duplicated name", func() {
- So(f.NewSections("author", "features"), ShouldBeNil)
-
- // Ignore section already exists
- So(f.SectionStrings(), ShouldResemble, []string{ini.DEFAULT_SECTION, "package", "author", "features"})
- })
-
- Convey("With empty string", func() {
- So(f.NewSections("", ""), ShouldNotBeNil)
- })
- })
-}
-
-func TestFile_GetSection(t *testing.T) {
- Convey("Get a section", t, func() {
- f, err := ini.Load(_FULL_CONF)
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- sec, err := f.GetSection("author")
- So(err, ShouldBeNil)
- So(sec, ShouldNotBeNil)
- So(sec.Name(), ShouldEqual, "author")
-
- Convey("Section not exists", func() {
- _, err := f.GetSection("404")
- So(err, ShouldNotBeNil)
- })
- })
-}
-
-func TestFile_Section(t *testing.T) {
- Convey("Get a section", t, func() {
- f, err := ini.Load(_FULL_CONF)
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- sec := f.Section("author")
- So(sec, ShouldNotBeNil)
- So(sec.Name(), ShouldEqual, "author")
-
- Convey("Section not exists", func() {
- sec := f.Section("404")
- So(sec, ShouldNotBeNil)
- So(sec.Name(), ShouldEqual, "404")
- })
- })
-
- Convey("Get default section in lower case with insensitive load", t, func() {
- f, err := ini.InsensitiveLoad([]byte(`
-[default]
-NAME = ini
-VERSION = v1`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("").Key("name").String(), ShouldEqual, "ini")
- So(f.Section("").Key("version").String(), ShouldEqual, "v1")
- })
-}
-
-func TestFile_Sections(t *testing.T) {
- Convey("Get all sections", t, func() {
- f, err := ini.Load(_FULL_CONF)
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- secs := f.Sections()
- names := []string{ini.DEFAULT_SECTION, "author", "package", "package.sub", "features", "types", "array", "note", "comments", "string escapes", "advance"}
- So(len(secs), ShouldEqual, len(names))
- for i, name := range names {
- So(secs[i].Name(), ShouldEqual, name)
- }
- })
-}
-
-func TestFile_ChildSections(t *testing.T) {
- Convey("Get child sections by parent name", t, func() {
- f, err := ini.Load([]byte(`
-[node]
-[node.biz1]
-[node.biz2]
-[node.biz3]
-[node.bizN]
-`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- children := f.ChildSections("node")
- names := []string{"node.biz1", "node.biz2", "node.biz3", "node.bizN"}
- So(len(children), ShouldEqual, len(names))
- for i, name := range names {
- So(children[i].Name(), ShouldEqual, name)
- }
- })
-}
-
-func TestFile_SectionStrings(t *testing.T) {
- Convey("Get all section names", t, func() {
- f, err := ini.Load(_FULL_CONF)
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.SectionStrings(), ShouldResemble, []string{ini.DEFAULT_SECTION, "author", "package", "package.sub", "features", "types", "array", "note", "comments", "string escapes", "advance"})
- })
-}
-
-func TestFile_DeleteSection(t *testing.T) {
- Convey("Delete a section", t, func() {
- f := ini.Empty()
- So(f, ShouldNotBeNil)
-
- f.NewSections("author", "package", "features")
- f.DeleteSection("features")
- f.DeleteSection("")
- So(f.SectionStrings(), ShouldResemble, []string{"author", "package"})
- })
-}
-
-func TestFile_Append(t *testing.T) {
- Convey("Append a data source", t, func() {
- f := ini.Empty()
- So(f, ShouldNotBeNil)
-
- So(f.Append(_MINIMAL_CONF, []byte(`
-[author]
-NAME = Unknwon`)), ShouldBeNil)
-
- Convey("With bad input", func() {
- So(f.Append(123), ShouldNotBeNil)
- So(f.Append(_MINIMAL_CONF, 123), ShouldNotBeNil)
- })
- })
-}
-
-func TestFile_WriteTo(t *testing.T) {
- Convey("Write content to somewhere", t, func() {
- f, err := ini.Load(_FULL_CONF)
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- f.Section("author").Comment = `Information about package author
-# Bio can be written in multiple lines.`
- f.Section("author").Key("NAME").Comment = "This is author name"
- f.Section("note").NewBooleanKey("boolean_key")
- f.Section("note").NewKey("more", "notes")
-
- var buf bytes.Buffer
- _, err = f.WriteTo(&buf)
- So(err, ShouldBeNil)
-
- golden := "testdata/TestFile_WriteTo.golden"
- if *update {
- ioutil.WriteFile(golden, buf.Bytes(), 0644)
- }
-
- expected, err := ioutil.ReadFile(golden)
- So(err, ShouldBeNil)
- So(buf.String(), ShouldEqual, string(expected))
- })
-
- Convey("Support multiline comments", t, func() {
- f := ini.Empty()
- f.Section("").Key("test").Comment = "Multiline\nComment"
-
- var buf bytes.Buffer
- _, err := f.WriteTo(&buf)
- So(err, ShouldBeNil)
-
- So(buf.String(), ShouldEqual, `; Multiline
-; Comment
-test =
-
-`)
-
- })
-}
-
-func TestFile_SaveTo(t *testing.T) {
- Convey("Write content to somewhere", t, func() {
- f, err := ini.Load(_FULL_CONF)
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.SaveTo("testdata/conf_out.ini"), ShouldBeNil)
- So(f.SaveToIndent("testdata/conf_out.ini", "\t"), ShouldBeNil)
- })
-}
diff --git a/vendor/github.com/go-ini/ini/ini_internal_test.go b/vendor/github.com/go-ini/ini/ini_internal_test.go
deleted file mode 100644
index 257ef1ebb..000000000
--- a/vendor/github.com/go-ini/ini/ini_internal_test.go
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2017 Unknwon
-//
-// Licensed under the Apache License, Version 2.0 (the "License"): you may
-// not use this file except in compliance with the License. You may obtain
-// a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations
-// under the License.
-
-package ini
-
-import (
- "testing"
-
- . "github.com/smartystreets/goconvey/convey"
-)
-
-func Test_Version(t *testing.T) {
- Convey("Get version", t, func() {
- So(Version(), ShouldEqual, _VERSION)
- })
-}
-
-func Test_isSlice(t *testing.T) {
- Convey("Check if a string is in the slice", t, func() {
- ss := []string{"a", "b", "c"}
- So(inSlice("a", ss), ShouldBeTrue)
- So(inSlice("d", ss), ShouldBeFalse)
- })
-}
diff --git a/vendor/github.com/go-ini/ini/ini_test.go b/vendor/github.com/go-ini/ini/ini_test.go
deleted file mode 100644
index d68c7caa3..000000000
--- a/vendor/github.com/go-ini/ini/ini_test.go
+++ /dev/null
@@ -1,1210 +0,0 @@
-// Copyright 2014 Unknwon
-//
-// Licensed under the Apache License, Version 2.0 (the "License"): you may
-// not use this file except in compliance with the License. You may obtain
-// a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations
-// under the License.
-
-package ini_test
-
-import (
- "bytes"
- "flag"
- "io/ioutil"
- "testing"
-
- . "github.com/smartystreets/goconvey/convey"
- "gopkg.in/ini.v1"
-)
-
-const (
- _CONF_DATA = `
- ; Package name
- NAME = ini
- ; Package version
- VERSION = v1
- ; Package import path
- IMPORT_PATH = gopkg.in/%(NAME)s.%(VERSION)s
-
- # Information about package author
- # Bio can be written in multiple lines.
- [author]
- NAME = Unknwon ; Succeeding comment
- E-MAIL = fake@localhost
- GITHUB = https://github.com/%(NAME)s
- BIO = """Gopher.
- Coding addict.
- Good man.
- """ # Succeeding comment`
- _MINIMAL_CONF = "testdata/minimal.ini"
- _FULL_CONF = "testdata/full.ini"
- _NOT_FOUND_CONF = "testdata/404.ini"
-)
-
-var update = flag.Bool("update", false, "Update .golden files")
-
-func TestLoad(t *testing.T) {
- Convey("Load from good data sources", t, func() {
- f, err := ini.Load([]byte(`
-NAME = ini
-VERSION = v1
-IMPORT_PATH = gopkg.in/%(NAME)s.%(VERSION)s`),
- "testdata/minimal.ini",
- ioutil.NopCloser(bytes.NewReader([]byte(`
-[author]
-NAME = Unknwon
-`))),
- )
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- // Validate values make sure all sources are loaded correctly
- sec := f.Section("")
- So(sec.Key("NAME").String(), ShouldEqual, "ini")
- So(sec.Key("VERSION").String(), ShouldEqual, "v1")
- So(sec.Key("IMPORT_PATH").String(), ShouldEqual, "gopkg.in/ini.v1")
-
- sec = f.Section("author")
- So(sec.Key("NAME").String(), ShouldEqual, "Unknwon")
- So(sec.Key("E-MAIL").String(), ShouldEqual, "u@gogs.io")
- })
-
- Convey("Load from bad data sources", t, func() {
- Convey("Invalid input", func() {
- _, err := ini.Load(_NOT_FOUND_CONF)
- So(err, ShouldNotBeNil)
- })
-
- Convey("Unsupported type", func() {
- _, err := ini.Load(123)
- So(err, ShouldNotBeNil)
- })
- })
-
- Convey("Can't properly parse INI files containing `#` or `;` in value", t, func() {
- f, err := ini.Load([]byte(`
- [author]
- NAME = U#n#k#n#w#o#n
- GITHUB = U;n;k;n;w;o;n
- `))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- sec := f.Section("author")
- nameValue := sec.Key("NAME").String()
- githubValue := sec.Key("GITHUB").String()
- So(nameValue, ShouldEqual, "U")
- So(githubValue, ShouldEqual, "U")
- })
-
- Convey("Can't parse small python-compatible INI files", t, func() {
- f, err := ini.Load([]byte(`
-[long]
-long_rsa_private_key = -----BEGIN RSA PRIVATE KEY-----
- foo
- bar
- foobar
- barfoo
- -----END RSA PRIVATE KEY-----
-`))
- So(err, ShouldNotBeNil)
- So(f, ShouldBeNil)
- So(err.Error(), ShouldEqual, "key-value delimiter not found: foo\n")
- })
-
- Convey("Can't parse big python-compatible INI files", t, func() {
- f, err := ini.Load([]byte(`
-[long]
-long_rsa_private_key = -----BEGIN RSA PRIVATE KEY-----
- 1foo
- 2bar
- 3foobar
- 4barfoo
- 5foo
- 6bar
- 7foobar
- 8barfoo
- 9foo
- 10bar
- 11foobar
- 12barfoo
- 13foo
- 14bar
- 15foobar
- 16barfoo
- 17foo
- 18bar
- 19foobar
- 20barfoo
- 21foo
- 22bar
- 23foobar
- 24barfoo
- 25foo
- 26bar
- 27foobar
- 28barfoo
- 29foo
- 30bar
- 31foobar
- 32barfoo
- 33foo
- 34bar
- 35foobar
- 36barfoo
- 37foo
- 38bar
- 39foobar
- 40barfoo
- 41foo
- 42bar
- 43foobar
- 44barfoo
- 45foo
- 46bar
- 47foobar
- 48barfoo
- 49foo
- 50bar
- 51foobar
- 52barfoo
- 53foo
- 54bar
- 55foobar
- 56barfoo
- 57foo
- 58bar
- 59foobar
- 60barfoo
- 61foo
- 62bar
- 63foobar
- 64barfoo
- 65foo
- 66bar
- 67foobar
- 68barfoo
- 69foo
- 70bar
- 71foobar
- 72barfoo
- 73foo
- 74bar
- 75foobar
- 76barfoo
- 77foo
- 78bar
- 79foobar
- 80barfoo
- 81foo
- 82bar
- 83foobar
- 84barfoo
- 85foo
- 86bar
- 87foobar
- 88barfoo
- 89foo
- 90bar
- 91foobar
- 92barfoo
- 93foo
- 94bar
- 95foobar
- 96barfoo
- -----END RSA PRIVATE KEY-----
-`))
- So(err, ShouldNotBeNil)
- So(f, ShouldBeNil)
- So(err.Error(), ShouldEqual, "key-value delimiter not found: 1foo\n")
- })
-}
-
-func TestLooseLoad(t *testing.T) {
- Convey("Load from data sources with option `Loose` true", t, func() {
- f, err := ini.LoadSources(ini.LoadOptions{Loose: true}, _NOT_FOUND_CONF, _MINIMAL_CONF)
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- Convey("Inverse case", func() {
- _, err = ini.Load(_NOT_FOUND_CONF)
- So(err, ShouldNotBeNil)
- })
- })
-}
-
-func TestInsensitiveLoad(t *testing.T) {
- Convey("Insensitive to section and key names", t, func() {
- f, err := ini.InsensitiveLoad(_MINIMAL_CONF)
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("Author").Key("e-mail").String(), ShouldEqual, "u@gogs.io")
-
- Convey("Write out", func() {
- var buf bytes.Buffer
- _, err := f.WriteTo(&buf)
- So(err, ShouldBeNil)
- So(buf.String(), ShouldEqual, `[author]
-e-mail = u@gogs.io
-
-`)
- })
-
- Convey("Inverse case", func() {
- f, err := ini.Load(_MINIMAL_CONF)
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("Author").Key("e-mail").String(), ShouldBeEmpty)
- })
- })
-}
-
-func TestLoadSources(t *testing.T) {
- Convey("Load from data sources with options", t, func() {
- Convey("with true `AllowPythonMultilineValues`", func() {
- Convey("Ignore nonexistent files", func() {
- f, err := ini.LoadSources(ini.LoadOptions{AllowPythonMultilineValues: true, Loose: true}, _NOT_FOUND_CONF, _MINIMAL_CONF)
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- Convey("Inverse case", func() {
- _, err = ini.LoadSources(ini.LoadOptions{AllowPythonMultilineValues: true}, _NOT_FOUND_CONF)
- So(err, ShouldNotBeNil)
- })
- })
-
- Convey("Insensitive to section and key names", func() {
- f, err := ini.LoadSources(ini.LoadOptions{AllowPythonMultilineValues: true, Insensitive: true}, _MINIMAL_CONF)
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("Author").Key("e-mail").String(), ShouldEqual, "u@gogs.io")
-
- Convey("Write out", func() {
- var buf bytes.Buffer
- _, err := f.WriteTo(&buf)
- So(err, ShouldBeNil)
- So(buf.String(), ShouldEqual, `[author]
-e-mail = u@gogs.io
-
-`)
- })
-
- Convey("Inverse case", func() {
- f, err := ini.LoadSources(ini.LoadOptions{AllowPythonMultilineValues: true}, _MINIMAL_CONF)
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("Author").Key("e-mail").String(), ShouldBeEmpty)
- })
- })
-
- Convey("Ignore continuation lines", func() {
- f, err := ini.LoadSources(ini.LoadOptions{
- AllowPythonMultilineValues: true,
- IgnoreContinuation: true,
- }, []byte(`
-key1=a\b\
-key2=c\d\
-key3=value`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("").Key("key1").String(), ShouldEqual, `a\b\`)
- So(f.Section("").Key("key2").String(), ShouldEqual, `c\d\`)
- So(f.Section("").Key("key3").String(), ShouldEqual, "value")
-
- Convey("Inverse case", func() {
- f, err := ini.LoadSources(ini.LoadOptions{AllowPythonMultilineValues: true}, []byte(`
-key1=a\b\
-key2=c\d\`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("").Key("key1").String(), ShouldEqual, `a\bkey2=c\d`)
- })
- })
-
- Convey("Ignore inline comments", func() {
- f, err := ini.LoadSources(ini.LoadOptions{
- AllowPythonMultilineValues: true,
- IgnoreInlineComment: true,
- }, []byte(`
-key1=value ;comment
-key2=value2 #comment2
-key3=val#ue #comment3`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("").Key("key1").String(), ShouldEqual, `value ;comment`)
- So(f.Section("").Key("key2").String(), ShouldEqual, `value2 #comment2`)
- So(f.Section("").Key("key3").String(), ShouldEqual, `val#ue #comment3`)
-
- Convey("Inverse case", func() {
- f, err := ini.LoadSources(ini.LoadOptions{AllowPythonMultilineValues: true}, []byte(`
-key1=value ;comment
-key2=value2 #comment2`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("").Key("key1").String(), ShouldEqual, `value`)
- So(f.Section("").Key("key1").Comment, ShouldEqual, `;comment`)
- So(f.Section("").Key("key2").String(), ShouldEqual, `value2`)
- So(f.Section("").Key("key2").Comment, ShouldEqual, `#comment2`)
- })
- })
-
- Convey("Allow boolean type keys", func() {
- f, err := ini.LoadSources(ini.LoadOptions{
- AllowPythonMultilineValues: true,
- AllowBooleanKeys: true,
- }, []byte(`
-key1=hello
-#key2
-key3`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("").KeyStrings(), ShouldResemble, []string{"key1", "key3"})
- So(f.Section("").Key("key3").MustBool(false), ShouldBeTrue)
-
- Convey("Write out", func() {
- var buf bytes.Buffer
- _, err := f.WriteTo(&buf)
- So(err, ShouldBeNil)
- So(buf.String(), ShouldEqual, `key1 = hello
-# key2
-key3
-`)
- })
-
- Convey("Inverse case", func() {
- _, err := ini.LoadSources(ini.LoadOptions{AllowPythonMultilineValues: true}, []byte(`
-key1=hello
-#key2
-key3`))
- So(err, ShouldNotBeNil)
- })
- })
-
- Convey("Allow shadow keys", func() {
- f, err := ini.LoadSources(ini.LoadOptions{AllowShadows: true, AllowPythonMultilineValues: true}, []byte(`
-[remote "origin"]
-url = https://github.com/Antergone/test1.git
-url = https://github.com/Antergone/test2.git
-fetch = +refs/heads/*:refs/remotes/origin/*`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section(`remote "origin"`).Key("url").String(), ShouldEqual, "https://github.com/Antergone/test1.git")
- So(f.Section(`remote "origin"`).Key("url").ValueWithShadows(), ShouldResemble, []string{
- "https://github.com/Antergone/test1.git",
- "https://github.com/Antergone/test2.git",
- })
- So(f.Section(`remote "origin"`).Key("fetch").String(), ShouldEqual, "+refs/heads/*:refs/remotes/origin/*")
-
- Convey("Write out", func() {
- var buf bytes.Buffer
- _, err := f.WriteTo(&buf)
- So(err, ShouldBeNil)
- So(buf.String(), ShouldEqual, `[remote "origin"]
-url = https://github.com/Antergone/test1.git
-url = https://github.com/Antergone/test2.git
-fetch = +refs/heads/*:refs/remotes/origin/*
-
-`)
- })
-
- Convey("Inverse case", func() {
- f, err := ini.LoadSources(ini.LoadOptions{AllowPythonMultilineValues: true}, []byte(`
-[remote "origin"]
-url = https://github.com/Antergone/test1.git
-url = https://github.com/Antergone/test2.git`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section(`remote "origin"`).Key("url").String(), ShouldEqual, "https://github.com/Antergone/test2.git")
- })
- })
-
- Convey("Unescape double quotes inside value", func() {
- f, err := ini.LoadSources(ini.LoadOptions{
- AllowPythonMultilineValues: true,
- UnescapeValueDoubleQuotes: true,
- }, []byte(`
-create_repo="创建了仓库 <a href=\"%s\">%s</a>"`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("").Key("create_repo").String(), ShouldEqual, `创建了仓库 <a href="%s">%s</a>`)
-
- Convey("Inverse case", func() {
- f, err := ini.LoadSources(ini.LoadOptions{AllowPythonMultilineValues: true}, []byte(`
-create_repo="创建了仓库 <a href=\"%s\">%s</a>"`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("").Key("create_repo").String(), ShouldEqual, `"创建了仓库 <a href=\"%s\">%s</a>"`)
- })
- })
-
- Convey("Unescape comment symbols inside value", func() {
- f, err := ini.LoadSources(ini.LoadOptions{
- AllowPythonMultilineValues: true,
- IgnoreInlineComment: true,
- UnescapeValueCommentSymbols: true,
- }, []byte(`
-key = test value <span style="color: %s\; background: %s">more text</span>
-`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("").Key("key").String(), ShouldEqual, `test value <span style="color: %s; background: %s">more text</span>`)
- })
-
- Convey("Can parse small python-compatible INI files", func() {
- f, err := ini.LoadSources(ini.LoadOptions{
- AllowPythonMultilineValues: true,
- Insensitive: true,
- UnparseableSections: []string{"core_lesson", "comments"},
- }, []byte(`
-[long]
-long_rsa_private_key = -----BEGIN RSA PRIVATE KEY-----
- foo
- bar
- foobar
- barfoo
- -----END RSA PRIVATE KEY-----
-`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("long").Key("long_rsa_private_key").String(), ShouldEqual, "-----BEGIN RSA PRIVATE KEY-----\nfoo\nbar\nfoobar\nbarfoo\n-----END RSA PRIVATE KEY-----")
- })
-
- Convey("Can parse big python-compatible INI files", func() {
- f, err := ini.LoadSources(ini.LoadOptions{
- AllowPythonMultilineValues: true,
- Insensitive: true,
- UnparseableSections: []string{"core_lesson", "comments"},
- }, []byte(`
-[long]
-long_rsa_private_key = -----BEGIN RSA PRIVATE KEY-----
- 1foo
- 2bar
- 3foobar
- 4barfoo
- 5foo
- 6bar
- 7foobar
- 8barfoo
- 9foo
- 10bar
- 11foobar
- 12barfoo
- 13foo
- 14bar
- 15foobar
- 16barfoo
- 17foo
- 18bar
- 19foobar
- 20barfoo
- 21foo
- 22bar
- 23foobar
- 24barfoo
- 25foo
- 26bar
- 27foobar
- 28barfoo
- 29foo
- 30bar
- 31foobar
- 32barfoo
- 33foo
- 34bar
- 35foobar
- 36barfoo
- 37foo
- 38bar
- 39foobar
- 40barfoo
- 41foo
- 42bar
- 43foobar
- 44barfoo
- 45foo
- 46bar
- 47foobar
- 48barfoo
- 49foo
- 50bar
- 51foobar
- 52barfoo
- 53foo
- 54bar
- 55foobar
- 56barfoo
- 57foo
- 58bar
- 59foobar
- 60barfoo
- 61foo
- 62bar
- 63foobar
- 64barfoo
- 65foo
- 66bar
- 67foobar
- 68barfoo
- 69foo
- 70bar
- 71foobar
- 72barfoo
- 73foo
- 74bar
- 75foobar
- 76barfoo
- 77foo
- 78bar
- 79foobar
- 80barfoo
- 81foo
- 82bar
- 83foobar
- 84barfoo
- 85foo
- 86bar
- 87foobar
- 88barfoo
- 89foo
- 90bar
- 91foobar
- 92barfoo
- 93foo
- 94bar
- 95foobar
- 96barfoo
- -----END RSA PRIVATE KEY-----
-`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("long").Key("long_rsa_private_key").String(), ShouldEqual, `-----BEGIN RSA PRIVATE KEY-----
-1foo
-2bar
-3foobar
-4barfoo
-5foo
-6bar
-7foobar
-8barfoo
-9foo
-10bar
-11foobar
-12barfoo
-13foo
-14bar
-15foobar
-16barfoo
-17foo
-18bar
-19foobar
-20barfoo
-21foo
-22bar
-23foobar
-24barfoo
-25foo
-26bar
-27foobar
-28barfoo
-29foo
-30bar
-31foobar
-32barfoo
-33foo
-34bar
-35foobar
-36barfoo
-37foo
-38bar
-39foobar
-40barfoo
-41foo
-42bar
-43foobar
-44barfoo
-45foo
-46bar
-47foobar
-48barfoo
-49foo
-50bar
-51foobar
-52barfoo
-53foo
-54bar
-55foobar
-56barfoo
-57foo
-58bar
-59foobar
-60barfoo
-61foo
-62bar
-63foobar
-64barfoo
-65foo
-66bar
-67foobar
-68barfoo
-69foo
-70bar
-71foobar
-72barfoo
-73foo
-74bar
-75foobar
-76barfoo
-77foo
-78bar
-79foobar
-80barfoo
-81foo
-82bar
-83foobar
-84barfoo
-85foo
-86bar
-87foobar
-88barfoo
-89foo
-90bar
-91foobar
-92barfoo
-93foo
-94bar
-95foobar
-96barfoo
------END RSA PRIVATE KEY-----`)
- })
-
- Convey("Allow unparsable sections", func() {
- f, err := ini.LoadSources(ini.LoadOptions{
- AllowPythonMultilineValues: true,
- Insensitive: true,
- UnparseableSections: []string{"core_lesson", "comments"},
- }, []byte(`
-Lesson_Location = 87
-Lesson_Status = C
-Score = 3
-Time = 00:02:30
-
-[CORE_LESSON]
-my lesson state data – 1111111111111111111000000000000000001110000
-111111111111111111100000000000111000000000 – end my lesson state data
-
-[COMMENTS]
-<1><L.Slide#2> This slide has the fuel listed in the wrong units <e.1>`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("").Key("score").String(), ShouldEqual, "3")
- So(f.Section("").Body(), ShouldBeEmpty)
- So(f.Section("core_lesson").Body(), ShouldEqual, `my lesson state data – 1111111111111111111000000000000000001110000
-111111111111111111100000000000111000000000 – end my lesson state data`)
- So(f.Section("comments").Body(), ShouldEqual, `<1><L.Slide#2> This slide has the fuel listed in the wrong units <e.1>`)
-
- Convey("Write out", func() {
- var buf bytes.Buffer
- _, err := f.WriteTo(&buf)
- So(err, ShouldBeNil)
- So(buf.String(), ShouldEqual, `lesson_location = 87
-lesson_status = C
-score = 3
-time = 00:02:30
-
-[core_lesson]
-my lesson state data – 1111111111111111111000000000000000001110000
-111111111111111111100000000000111000000000 – end my lesson state data
-
-[comments]
-<1><L.Slide#2> This slide has the fuel listed in the wrong units <e.1>
-`)
- })
-
- Convey("Inverse case", func() {
- _, err := ini.LoadSources(ini.LoadOptions{AllowPythonMultilineValues: true}, []byte(`
-[CORE_LESSON]
-my lesson state data – 1111111111111111111000000000000000001110000
-111111111111111111100000000000111000000000 – end my lesson state data`))
- So(err, ShouldNotBeNil)
- })
- })
-
- Convey("And false `SpaceBeforeInlineComment`", func() {
- Convey("Can't parse INI files containing `#` or `;` in value", func() {
- f, err := ini.LoadSources(
- ini.LoadOptions{AllowPythonMultilineValues: false, SpaceBeforeInlineComment: false},
- []byte(`
-[author]
-NAME = U#n#k#n#w#o#n
-GITHUB = U;n;k;n;w;o;n
-`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
- sec := f.Section("author")
- nameValue := sec.Key("NAME").String()
- githubValue := sec.Key("GITHUB").String()
- So(nameValue, ShouldEqual, "U")
- So(githubValue, ShouldEqual, "U")
- })
- })
-
- Convey("And true `SpaceBeforeInlineComment`", func() {
- Convey("Can parse INI files containing `#` or `;` in value", func() {
- f, err := ini.LoadSources(
- ini.LoadOptions{AllowPythonMultilineValues: false, SpaceBeforeInlineComment: true},
- []byte(`
-[author]
-NAME = U#n#k#n#w#o#n
-GITHUB = U;n;k;n;w;o;n
-`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
- sec := f.Section("author")
- nameValue := sec.Key("NAME").String()
- githubValue := sec.Key("GITHUB").String()
- So(nameValue, ShouldEqual, "U#n#k#n#w#o#n")
- So(githubValue, ShouldEqual, "U;n;k;n;w;o;n")
- })
- })
- })
-
- Convey("with false `AllowPythonMultilineValues`", func() {
- Convey("Ignore nonexistent files", func() {
- f, err := ini.LoadSources(ini.LoadOptions{AllowPythonMultilineValues: false, Loose: true}, _NOT_FOUND_CONF, _MINIMAL_CONF)
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- Convey("Inverse case", func() {
- _, err = ini.LoadSources(ini.LoadOptions{AllowPythonMultilineValues: false}, _NOT_FOUND_CONF)
- So(err, ShouldNotBeNil)
- })
- })
-
- Convey("Insensitive to section and key names", func() {
- f, err := ini.LoadSources(ini.LoadOptions{AllowPythonMultilineValues: false, Insensitive: true}, _MINIMAL_CONF)
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("Author").Key("e-mail").String(), ShouldEqual, "u@gogs.io")
-
- Convey("Write out", func() {
- var buf bytes.Buffer
- _, err := f.WriteTo(&buf)
- So(err, ShouldBeNil)
- So(buf.String(), ShouldEqual, `[author]
-e-mail = u@gogs.io
-
-`)
- })
-
- Convey("Inverse case", func() {
- f, err := ini.LoadSources(ini.LoadOptions{AllowPythonMultilineValues: false}, _MINIMAL_CONF)
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("Author").Key("e-mail").String(), ShouldBeEmpty)
- })
- })
-
- Convey("Ignore continuation lines", func() {
- f, err := ini.LoadSources(ini.LoadOptions{
- AllowPythonMultilineValues: false,
- IgnoreContinuation: true,
- }, []byte(`
-key1=a\b\
-key2=c\d\
-key3=value`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("").Key("key1").String(), ShouldEqual, `a\b\`)
- So(f.Section("").Key("key2").String(), ShouldEqual, `c\d\`)
- So(f.Section("").Key("key3").String(), ShouldEqual, "value")
-
- Convey("Inverse case", func() {
- f, err := ini.LoadSources(ini.LoadOptions{AllowPythonMultilineValues: false}, []byte(`
-key1=a\b\
-key2=c\d\`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("").Key("key1").String(), ShouldEqual, `a\bkey2=c\d`)
- })
- })
-
- Convey("Ignore inline comments", func() {
- f, err := ini.LoadSources(ini.LoadOptions{
- AllowPythonMultilineValues: false,
- IgnoreInlineComment: true,
- }, []byte(`
-key1=value ;comment
-key2=value2 #comment2
-key3=val#ue #comment3`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("").Key("key1").String(), ShouldEqual, `value ;comment`)
- So(f.Section("").Key("key2").String(), ShouldEqual, `value2 #comment2`)
- So(f.Section("").Key("key3").String(), ShouldEqual, `val#ue #comment3`)
-
- Convey("Inverse case", func() {
- f, err := ini.LoadSources(ini.LoadOptions{AllowPythonMultilineValues: false}, []byte(`
-key1=value ;comment
-key2=value2 #comment2`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("").Key("key1").String(), ShouldEqual, `value`)
- So(f.Section("").Key("key1").Comment, ShouldEqual, `;comment`)
- So(f.Section("").Key("key2").String(), ShouldEqual, `value2`)
- So(f.Section("").Key("key2").Comment, ShouldEqual, `#comment2`)
- })
- })
-
- Convey("Allow boolean type keys", func() {
- f, err := ini.LoadSources(ini.LoadOptions{
- AllowPythonMultilineValues: false,
- AllowBooleanKeys: true,
- }, []byte(`
-key1=hello
-#key2
-key3`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("").KeyStrings(), ShouldResemble, []string{"key1", "key3"})
- So(f.Section("").Key("key3").MustBool(false), ShouldBeTrue)
-
- Convey("Write out", func() {
- var buf bytes.Buffer
- _, err := f.WriteTo(&buf)
- So(err, ShouldBeNil)
- So(buf.String(), ShouldEqual, `key1 = hello
-# key2
-key3
-`)
- })
-
- Convey("Inverse case", func() {
- _, err := ini.LoadSources(ini.LoadOptions{AllowPythonMultilineValues: false}, []byte(`
-key1=hello
-#key2
-key3`))
- So(err, ShouldNotBeNil)
- })
- })
-
- Convey("Allow shadow keys", func() {
- f, err := ini.LoadSources(ini.LoadOptions{AllowPythonMultilineValues: false, AllowShadows: true}, []byte(`
-[remote "origin"]
-url = https://github.com/Antergone/test1.git
-url = https://github.com/Antergone/test2.git
-fetch = +refs/heads/*:refs/remotes/origin/*`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section(`remote "origin"`).Key("url").String(), ShouldEqual, "https://github.com/Antergone/test1.git")
- So(f.Section(`remote "origin"`).Key("url").ValueWithShadows(), ShouldResemble, []string{
- "https://github.com/Antergone/test1.git",
- "https://github.com/Antergone/test2.git",
- })
- So(f.Section(`remote "origin"`).Key("fetch").String(), ShouldEqual, "+refs/heads/*:refs/remotes/origin/*")
-
- Convey("Write out", func() {
- var buf bytes.Buffer
- _, err := f.WriteTo(&buf)
- So(err, ShouldBeNil)
- So(buf.String(), ShouldEqual, `[remote "origin"]
-url = https://github.com/Antergone/test1.git
-url = https://github.com/Antergone/test2.git
-fetch = +refs/heads/*:refs/remotes/origin/*
-
-`)
- })
-
- Convey("Inverse case", func() {
- f, err := ini.LoadSources(ini.LoadOptions{AllowPythonMultilineValues: false}, []byte(`
-[remote "origin"]
-url = https://github.com/Antergone/test1.git
-url = https://github.com/Antergone/test2.git`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section(`remote "origin"`).Key("url").String(), ShouldEqual, "https://github.com/Antergone/test2.git")
- })
- })
-
- Convey("Unescape double quotes inside value", func() {
- f, err := ini.LoadSources(ini.LoadOptions{
- AllowPythonMultilineValues: false,
- UnescapeValueDoubleQuotes: true,
- }, []byte(`
-create_repo="创建了仓库 <a href=\"%s\">%s</a>"`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("").Key("create_repo").String(), ShouldEqual, `创建了仓库 <a href="%s">%s</a>`)
-
- Convey("Inverse case", func() {
- f, err := ini.LoadSources(ini.LoadOptions{AllowPythonMultilineValues: false}, []byte(`
-create_repo="创建了仓库 <a href=\"%s\">%s</a>"`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("").Key("create_repo").String(), ShouldEqual, `"创建了仓库 <a href=\"%s\">%s</a>"`)
- })
- })
-
- Convey("Unescape comment symbols inside value", func() {
- f, err := ini.LoadSources(ini.LoadOptions{
- AllowPythonMultilineValues: false,
- IgnoreInlineComment: true,
- UnescapeValueCommentSymbols: true,
- }, []byte(`
-key = test value <span style="color: %s\; background: %s">more text</span>
-`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("").Key("key").String(), ShouldEqual, `test value <span style="color: %s; background: %s">more text</span>`)
- })
-
- Convey("Can't parse small python-compatible INI files", func() {
- f, err := ini.LoadSources(ini.LoadOptions{AllowPythonMultilineValues: false}, []byte(`
-[long]
-long_rsa_private_key = -----BEGIN RSA PRIVATE KEY-----
- foo
- bar
- foobar
- barfoo
- -----END RSA PRIVATE KEY-----
-`))
- So(err, ShouldNotBeNil)
- So(f, ShouldBeNil)
- So(err.Error(), ShouldEqual, "key-value delimiter not found: foo\n")
- })
-
- Convey("Can't parse big python-compatible INI files", func() {
- f, err := ini.LoadSources(ini.LoadOptions{AllowPythonMultilineValues: false}, []byte(`
-[long]
-long_rsa_private_key = -----BEGIN RSA PRIVATE KEY-----
- 1foo
- 2bar
- 3foobar
- 4barfoo
- 5foo
- 6bar
- 7foobar
- 8barfoo
- 9foo
- 10bar
- 11foobar
- 12barfoo
- 13foo
- 14bar
- 15foobar
- 16barfoo
- 17foo
- 18bar
- 19foobar
- 20barfoo
- 21foo
- 22bar
- 23foobar
- 24barfoo
- 25foo
- 26bar
- 27foobar
- 28barfoo
- 29foo
- 30bar
- 31foobar
- 32barfoo
- 33foo
- 34bar
- 35foobar
- 36barfoo
- 37foo
- 38bar
- 39foobar
- 40barfoo
- 41foo
- 42bar
- 43foobar
- 44barfoo
- 45foo
- 46bar
- 47foobar
- 48barfoo
- 49foo
- 50bar
- 51foobar
- 52barfoo
- 53foo
- 54bar
- 55foobar
- 56barfoo
- 57foo
- 58bar
- 59foobar
- 60barfoo
- 61foo
- 62bar
- 63foobar
- 64barfoo
- 65foo
- 66bar
- 67foobar
- 68barfoo
- 69foo
- 70bar
- 71foobar
- 72barfoo
- 73foo
- 74bar
- 75foobar
- 76barfoo
- 77foo
- 78bar
- 79foobar
- 80barfoo
- 81foo
- 82bar
- 83foobar
- 84barfoo
- 85foo
- 86bar
- 87foobar
- 88barfoo
- 89foo
- 90bar
- 91foobar
- 92barfoo
- 93foo
- 94bar
- 95foobar
- 96barfoo
- -----END RSA PRIVATE KEY-----
-`))
- So(err, ShouldNotBeNil)
- So(f, ShouldBeNil)
- So(err.Error(), ShouldEqual, "key-value delimiter not found: 1foo\n")
- })
-
- Convey("Allow unparsable sections", func() {
- f, err := ini.LoadSources(ini.LoadOptions{
- AllowPythonMultilineValues: false,
- Insensitive: true,
- UnparseableSections: []string{"core_lesson", "comments"},
- }, []byte(`
-Lesson_Location = 87
-Lesson_Status = C
-Score = 3
-Time = 00:02:30
-
-[CORE_LESSON]
-my lesson state data – 1111111111111111111000000000000000001110000
-111111111111111111100000000000111000000000 – end my lesson state data
-
-[COMMENTS]
-<1><L.Slide#2> This slide has the fuel listed in the wrong units <e.1>`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("").Key("score").String(), ShouldEqual, "3")
- So(f.Section("").Body(), ShouldBeEmpty)
- So(f.Section("core_lesson").Body(), ShouldEqual, `my lesson state data – 1111111111111111111000000000000000001110000
-111111111111111111100000000000111000000000 – end my lesson state data`)
- So(f.Section("comments").Body(), ShouldEqual, `<1><L.Slide#2> This slide has the fuel listed in the wrong units <e.1>`)
-
- Convey("Write out", func() {
- var buf bytes.Buffer
- _, err := f.WriteTo(&buf)
- So(err, ShouldBeNil)
- So(buf.String(), ShouldEqual, `lesson_location = 87
-lesson_status = C
-score = 3
-time = 00:02:30
-
-[core_lesson]
-my lesson state data – 1111111111111111111000000000000000001110000
-111111111111111111100000000000111000000000 – end my lesson state data
-
-[comments]
-<1><L.Slide#2> This slide has the fuel listed in the wrong units <e.1>
-`)
- })
-
- Convey("Inverse case", func() {
- _, err := ini.LoadSources(ini.LoadOptions{AllowPythonMultilineValues: false}, []byte(`
-[CORE_LESSON]
-my lesson state data – 1111111111111111111000000000000000001110000
-111111111111111111100000000000111000000000 – end my lesson state data`))
- So(err, ShouldNotBeNil)
- })
- })
-
- Convey("And false `SpaceBeforeInlineComment`", func() {
- Convey("Can't parse INI files containing `#` or `;` in value", func() {
- f, err := ini.LoadSources(
- ini.LoadOptions{AllowPythonMultilineValues: true, SpaceBeforeInlineComment: false},
- []byte(`
-[author]
-NAME = U#n#k#n#w#o#n
-GITHUB = U;n;k;n;w;o;n
-`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
- sec := f.Section("author")
- nameValue := sec.Key("NAME").String()
- githubValue := sec.Key("GITHUB").String()
- So(nameValue, ShouldEqual, "U")
- So(githubValue, ShouldEqual, "U")
- })
- })
-
- Convey("And true `SpaceBeforeInlineComment`", func() {
- Convey("Can parse INI files containing `#` or `;` in value", func() {
- f, err := ini.LoadSources(
- ini.LoadOptions{AllowPythonMultilineValues: true, SpaceBeforeInlineComment: true},
- []byte(`
-[author]
-NAME = U#n#k#n#w#o#n
-GITHUB = U;n;k;n;w;o;n
-`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
- sec := f.Section("author")
- nameValue := sec.Key("NAME").String()
- githubValue := sec.Key("GITHUB").String()
- So(nameValue, ShouldEqual, "U#n#k#n#w#o#n")
- So(githubValue, ShouldEqual, "U;n;k;n;w;o;n")
- })
- })
- })
- })
-}
diff --git a/vendor/github.com/go-ini/ini/key_test.go b/vendor/github.com/go-ini/ini/key_test.go
deleted file mode 100644
index a13ad95fa..000000000
--- a/vendor/github.com/go-ini/ini/key_test.go
+++ /dev/null
@@ -1,523 +0,0 @@
-// Copyright 2014 Unknwon
-//
-// Licensed under the Apache License, Version 2.0 (the "License"): you may
-// not use this file except in compliance with the License. You may obtain
-// a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations
-// under the License.
-
-package ini_test
-
-import (
- "bytes"
- "fmt"
- "strings"
- "testing"
- "time"
-
- . "github.com/smartystreets/goconvey/convey"
- "gopkg.in/ini.v1"
-)
-
-func TestKey_AddShadow(t *testing.T) {
- Convey("Add shadow to a key", t, func() {
- f, err := ini.ShadowLoad([]byte(`
-[notes]
--: note1`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- k, err := f.Section("").NewKey("NAME", "ini")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
-
- So(k.AddShadow("ini.v1"), ShouldBeNil)
- So(k.ValueWithShadows(), ShouldResemble, []string{"ini", "ini.v1"})
-
- Convey("Add shadow to boolean key", func() {
- k, err := f.Section("").NewBooleanKey("published")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
- So(k.AddShadow("beta"), ShouldNotBeNil)
- })
-
- Convey("Add shadow to auto-increment key", func() {
- So(f.Section("notes").Key("#1").AddShadow("beta"), ShouldNotBeNil)
- })
- })
-
- Convey("Shadow is not allowed", t, func() {
- f := ini.Empty()
- So(f, ShouldNotBeNil)
-
- k, err := f.Section("").NewKey("NAME", "ini")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
-
- So(k.AddShadow("ini.v1"), ShouldNotBeNil)
- })
-}
-
-// Helpers for slice tests.
-func float64sEqual(values []float64, expected ...float64) {
- So(values, ShouldHaveLength, len(expected))
- for i, v := range expected {
- So(values[i], ShouldEqual, v)
- }
-}
-
-func intsEqual(values []int, expected ...int) {
- So(values, ShouldHaveLength, len(expected))
- for i, v := range expected {
- So(values[i], ShouldEqual, v)
- }
-}
-
-func int64sEqual(values []int64, expected ...int64) {
- So(values, ShouldHaveLength, len(expected))
- for i, v := range expected {
- So(values[i], ShouldEqual, v)
- }
-}
-
-func uintsEqual(values []uint, expected ...uint) {
- So(values, ShouldHaveLength, len(expected))
- for i, v := range expected {
- So(values[i], ShouldEqual, v)
- }
-}
-
-func uint64sEqual(values []uint64, expected ...uint64) {
- So(values, ShouldHaveLength, len(expected))
- for i, v := range expected {
- So(values[i], ShouldEqual, v)
- }
-}
-
-func timesEqual(values []time.Time, expected ...time.Time) {
- So(values, ShouldHaveLength, len(expected))
- for i, v := range expected {
- So(values[i].String(), ShouldEqual, v.String())
- }
-}
-
-func TestKey_Helpers(t *testing.T) {
- Convey("Getting and setting values", t, func() {
- f, err := ini.Load(_FULL_CONF)
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- Convey("Get string representation", func() {
- sec := f.Section("")
- So(sec, ShouldNotBeNil)
- So(sec.Key("NAME").Value(), ShouldEqual, "ini")
- So(sec.Key("NAME").String(), ShouldEqual, "ini")
- So(sec.Key("NAME").Validate(func(in string) string {
- return in
- }), ShouldEqual, "ini")
- So(sec.Key("NAME").Comment, ShouldEqual, "; Package name")
- So(sec.Key("IMPORT_PATH").String(), ShouldEqual, "gopkg.in/ini.v1")
-
- Convey("With ValueMapper", func() {
- f.ValueMapper = func(in string) string {
- if in == "gopkg.in/%(NAME)s.%(VERSION)s" {
- return "github.com/go-ini/ini"
- }
- return in
- }
- So(sec.Key("IMPORT_PATH").String(), ShouldEqual, "github.com/go-ini/ini")
- })
- })
-
- Convey("Get values in non-default section", func() {
- sec := f.Section("author")
- So(sec, ShouldNotBeNil)
- So(sec.Key("NAME").String(), ShouldEqual, "Unknwon")
- So(sec.Key("GITHUB").String(), ShouldEqual, "https://github.com/Unknwon")
-
- sec = f.Section("package")
- So(sec, ShouldNotBeNil)
- So(sec.Key("CLONE_URL").String(), ShouldEqual, "https://gopkg.in/ini.v1")
- })
-
- Convey("Get auto-increment key names", func() {
- keys := f.Section("features").Keys()
- for i, k := range keys {
- So(k.Name(), ShouldEqual, fmt.Sprintf("#%d", i+1))
- }
- })
-
- Convey("Get parent-keys that are available to the child section", func() {
- parentKeys := f.Section("package.sub").ParentKeys()
- for _, k := range parentKeys {
- So(k.Name(), ShouldEqual, "CLONE_URL")
- }
- })
-
- Convey("Get overwrite value", func() {
- So(f.Section("author").Key("E-MAIL").String(), ShouldEqual, "u@gogs.io")
- })
-
- Convey("Get sections", func() {
- sections := f.Sections()
- for i, name := range []string{ini.DEFAULT_SECTION, "author", "package", "package.sub", "features", "types", "array", "note", "comments", "string escapes", "advance"} {
- So(sections[i].Name(), ShouldEqual, name)
- }
- })
-
- Convey("Get parent section value", func() {
- So(f.Section("package.sub").Key("CLONE_URL").String(), ShouldEqual, "https://gopkg.in/ini.v1")
- So(f.Section("package.fake.sub").Key("CLONE_URL").String(), ShouldEqual, "https://gopkg.in/ini.v1")
- })
-
- Convey("Get multiple line value", func() {
- So(f.Section("author").Key("BIO").String(), ShouldEqual, "Gopher.\nCoding addict.\nGood man.\n")
- })
-
- Convey("Get values with type", func() {
- sec := f.Section("types")
- v1, err := sec.Key("BOOL").Bool()
- So(err, ShouldBeNil)
- So(v1, ShouldBeTrue)
-
- v1, err = sec.Key("BOOL_FALSE").Bool()
- So(err, ShouldBeNil)
- So(v1, ShouldBeFalse)
-
- v2, err := sec.Key("FLOAT64").Float64()
- So(err, ShouldBeNil)
- So(v2, ShouldEqual, 1.25)
-
- v3, err := sec.Key("INT").Int()
- So(err, ShouldBeNil)
- So(v3, ShouldEqual, 10)
-
- v4, err := sec.Key("INT").Int64()
- So(err, ShouldBeNil)
- So(v4, ShouldEqual, 10)
-
- v5, err := sec.Key("UINT").Uint()
- So(err, ShouldBeNil)
- So(v5, ShouldEqual, 3)
-
- v6, err := sec.Key("UINT").Uint64()
- So(err, ShouldBeNil)
- So(v6, ShouldEqual, 3)
-
- t, err := time.Parse(time.RFC3339, "2015-01-01T20:17:05Z")
- So(err, ShouldBeNil)
- v7, err := sec.Key("TIME").Time()
- So(err, ShouldBeNil)
- So(v7.String(), ShouldEqual, t.String())
-
- Convey("Must get values with type", func() {
- So(sec.Key("STRING").MustString("404"), ShouldEqual, "str")
- So(sec.Key("BOOL").MustBool(), ShouldBeTrue)
- So(sec.Key("FLOAT64").MustFloat64(), ShouldEqual, 1.25)
- So(sec.Key("INT").MustInt(), ShouldEqual, 10)
- So(sec.Key("INT").MustInt64(), ShouldEqual, 10)
- So(sec.Key("UINT").MustUint(), ShouldEqual, 3)
- So(sec.Key("UINT").MustUint64(), ShouldEqual, 3)
- So(sec.Key("TIME").MustTime().String(), ShouldEqual, t.String())
-
- dur, err := time.ParseDuration("2h45m")
- So(err, ShouldBeNil)
- So(sec.Key("DURATION").MustDuration().Seconds(), ShouldEqual, dur.Seconds())
-
- Convey("Must get values with default value", func() {
- So(sec.Key("STRING_404").MustString("404"), ShouldEqual, "404")
- So(sec.Key("BOOL_404").MustBool(true), ShouldBeTrue)
- So(sec.Key("FLOAT64_404").MustFloat64(2.5), ShouldEqual, 2.5)
- So(sec.Key("INT_404").MustInt(15), ShouldEqual, 15)
- So(sec.Key("INT64_404").MustInt64(15), ShouldEqual, 15)
- So(sec.Key("UINT_404").MustUint(6), ShouldEqual, 6)
- So(sec.Key("UINT64_404").MustUint64(6), ShouldEqual, 6)
-
- t, err := time.Parse(time.RFC3339, "2014-01-01T20:17:05Z")
- So(err, ShouldBeNil)
- So(sec.Key("TIME_404").MustTime(t).String(), ShouldEqual, t.String())
-
- So(sec.Key("DURATION_404").MustDuration(dur).Seconds(), ShouldEqual, dur.Seconds())
-
- Convey("Must should set default as key value", func() {
- So(sec.Key("STRING_404").String(), ShouldEqual, "404")
- So(sec.Key("BOOL_404").String(), ShouldEqual, "true")
- So(sec.Key("FLOAT64_404").String(), ShouldEqual, "2.5")
- So(sec.Key("INT_404").String(), ShouldEqual, "15")
- So(sec.Key("INT64_404").String(), ShouldEqual, "15")
- So(sec.Key("UINT_404").String(), ShouldEqual, "6")
- So(sec.Key("UINT64_404").String(), ShouldEqual, "6")
- So(sec.Key("TIME_404").String(), ShouldEqual, "2014-01-01T20:17:05Z")
- So(sec.Key("DURATION_404").String(), ShouldEqual, "2h45m0s")
- })
- })
- })
- })
-
- Convey("Get value with candidates", func() {
- sec := f.Section("types")
- So(sec.Key("STRING").In("", []string{"str", "arr", "types"}), ShouldEqual, "str")
- So(sec.Key("FLOAT64").InFloat64(0, []float64{1.25, 2.5, 3.75}), ShouldEqual, 1.25)
- So(sec.Key("INT").InInt(0, []int{10, 20, 30}), ShouldEqual, 10)
- So(sec.Key("INT").InInt64(0, []int64{10, 20, 30}), ShouldEqual, 10)
- So(sec.Key("UINT").InUint(0, []uint{3, 6, 9}), ShouldEqual, 3)
- So(sec.Key("UINT").InUint64(0, []uint64{3, 6, 9}), ShouldEqual, 3)
-
- zt, err := time.Parse(time.RFC3339, "0001-01-01T01:00:00Z")
- So(err, ShouldBeNil)
- t, err := time.Parse(time.RFC3339, "2015-01-01T20:17:05Z")
- So(err, ShouldBeNil)
- So(sec.Key("TIME").InTime(zt, []time.Time{t, time.Now(), time.Now().Add(1 * time.Second)}).String(), ShouldEqual, t.String())
-
- Convey("Get value with candidates and default value", func() {
- So(sec.Key("STRING_404").In("str", []string{"str", "arr", "types"}), ShouldEqual, "str")
- So(sec.Key("FLOAT64_404").InFloat64(1.25, []float64{1.25, 2.5, 3.75}), ShouldEqual, 1.25)
- So(sec.Key("INT_404").InInt(10, []int{10, 20, 30}), ShouldEqual, 10)
- So(sec.Key("INT64_404").InInt64(10, []int64{10, 20, 30}), ShouldEqual, 10)
- So(sec.Key("UINT_404").InUint(3, []uint{3, 6, 9}), ShouldEqual, 3)
- So(sec.Key("UINT_404").InUint64(3, []uint64{3, 6, 9}), ShouldEqual, 3)
- So(sec.Key("TIME_404").InTime(t, []time.Time{time.Now(), time.Now(), time.Now().Add(1 * time.Second)}).String(), ShouldEqual, t.String())
- })
- })
-
- Convey("Get values in range", func() {
- sec := f.Section("types")
- So(sec.Key("FLOAT64").RangeFloat64(0, 1, 2), ShouldEqual, 1.25)
- So(sec.Key("INT").RangeInt(0, 10, 20), ShouldEqual, 10)
- So(sec.Key("INT").RangeInt64(0, 10, 20), ShouldEqual, 10)
-
- minT, err := time.Parse(time.RFC3339, "0001-01-01T01:00:00Z")
- So(err, ShouldBeNil)
- midT, err := time.Parse(time.RFC3339, "2013-01-01T01:00:00Z")
- So(err, ShouldBeNil)
- maxT, err := time.Parse(time.RFC3339, "9999-01-01T01:00:00Z")
- So(err, ShouldBeNil)
- t, err := time.Parse(time.RFC3339, "2015-01-01T20:17:05Z")
- So(err, ShouldBeNil)
- So(sec.Key("TIME").RangeTime(t, minT, maxT).String(), ShouldEqual, t.String())
-
- Convey("Get value in range with default value", func() {
- So(sec.Key("FLOAT64").RangeFloat64(5, 0, 1), ShouldEqual, 5)
- So(sec.Key("INT").RangeInt(7, 0, 5), ShouldEqual, 7)
- So(sec.Key("INT").RangeInt64(7, 0, 5), ShouldEqual, 7)
- So(sec.Key("TIME").RangeTime(t, minT, midT).String(), ShouldEqual, t.String())
- })
- })
-
- Convey("Get values into slice", func() {
- sec := f.Section("array")
- So(strings.Join(sec.Key("STRINGS").Strings(","), ","), ShouldEqual, "en,zh,de")
- So(len(sec.Key("STRINGS_404").Strings(",")), ShouldEqual, 0)
-
- vals1 := sec.Key("FLOAT64S").Float64s(",")
- float64sEqual(vals1, 1.1, 2.2, 3.3)
-
- vals2 := sec.Key("INTS").Ints(",")
- intsEqual(vals2, 1, 2, 3)
-
- vals3 := sec.Key("INTS").Int64s(",")
- int64sEqual(vals3, 1, 2, 3)
-
- vals4 := sec.Key("UINTS").Uints(",")
- uintsEqual(vals4, 1, 2, 3)
-
- vals5 := sec.Key("UINTS").Uint64s(",")
- uint64sEqual(vals5, 1, 2, 3)
-
- t, err := time.Parse(time.RFC3339, "2015-01-01T20:17:05Z")
- So(err, ShouldBeNil)
- vals6 := sec.Key("TIMES").Times(",")
- timesEqual(vals6, t, t, t)
- })
-
- Convey("Test string slice escapes", func() {
- sec := f.Section("string escapes")
- So(sec.Key("key1").Strings(","), ShouldResemble, []string{"value1", "value2", "value3"})
- So(sec.Key("key2").Strings(","), ShouldResemble, []string{"value1, value2"})
- So(sec.Key("key3").Strings(","), ShouldResemble, []string{`val\ue1`, "value2"})
- So(sec.Key("key4").Strings(","), ShouldResemble, []string{`value1\`, `value\\2`})
- So(sec.Key("key5").Strings(",,"), ShouldResemble, []string{"value1,, value2"})
- So(sec.Key("key6").Strings(" "), ShouldResemble, []string{"aaa", "bbb and space", "ccc"})
- })
-
- Convey("Get valid values into slice", func() {
- sec := f.Section("array")
- vals1 := sec.Key("FLOAT64S").ValidFloat64s(",")
- float64sEqual(vals1, 1.1, 2.2, 3.3)
-
- vals2 := sec.Key("INTS").ValidInts(",")
- intsEqual(vals2, 1, 2, 3)
-
- vals3 := sec.Key("INTS").ValidInt64s(",")
- int64sEqual(vals3, 1, 2, 3)
-
- vals4 := sec.Key("UINTS").ValidUints(",")
- uintsEqual(vals4, 1, 2, 3)
-
- vals5 := sec.Key("UINTS").ValidUint64s(",")
- uint64sEqual(vals5, 1, 2, 3)
-
- t, err := time.Parse(time.RFC3339, "2015-01-01T20:17:05Z")
- So(err, ShouldBeNil)
- vals6 := sec.Key("TIMES").ValidTimes(",")
- timesEqual(vals6, t, t, t)
- })
-
- Convey("Get values one type into slice of another type", func() {
- sec := f.Section("array")
- vals1 := sec.Key("STRINGS").ValidFloat64s(",")
- So(vals1, ShouldBeEmpty)
-
- vals2 := sec.Key("STRINGS").ValidInts(",")
- So(vals2, ShouldBeEmpty)
-
- vals3 := sec.Key("STRINGS").ValidInt64s(",")
- So(vals3, ShouldBeEmpty)
-
- vals4 := sec.Key("STRINGS").ValidUints(",")
- So(vals4, ShouldBeEmpty)
-
- vals5 := sec.Key("STRINGS").ValidUint64s(",")
- So(vals5, ShouldBeEmpty)
-
- vals6 := sec.Key("STRINGS").ValidTimes(",")
- So(vals6, ShouldBeEmpty)
- })
-
- Convey("Get valid values into slice without errors", func() {
- sec := f.Section("array")
- vals1, err := sec.Key("FLOAT64S").StrictFloat64s(",")
- So(err, ShouldBeNil)
- float64sEqual(vals1, 1.1, 2.2, 3.3)
-
- vals2, err := sec.Key("INTS").StrictInts(",")
- So(err, ShouldBeNil)
- intsEqual(vals2, 1, 2, 3)
-
- vals3, err := sec.Key("INTS").StrictInt64s(",")
- So(err, ShouldBeNil)
- int64sEqual(vals3, 1, 2, 3)
-
- vals4, err := sec.Key("UINTS").StrictUints(",")
- So(err, ShouldBeNil)
- uintsEqual(vals4, 1, 2, 3)
-
- vals5, err := sec.Key("UINTS").StrictUint64s(",")
- So(err, ShouldBeNil)
- uint64sEqual(vals5, 1, 2, 3)
-
- t, err := time.Parse(time.RFC3339, "2015-01-01T20:17:05Z")
- So(err, ShouldBeNil)
- vals6, err := sec.Key("TIMES").StrictTimes(",")
- So(err, ShouldBeNil)
- timesEqual(vals6, t, t, t)
- })
-
- Convey("Get invalid values into slice", func() {
- sec := f.Section("array")
- vals1, err := sec.Key("STRINGS").StrictFloat64s(",")
- So(vals1, ShouldBeEmpty)
- So(err, ShouldNotBeNil)
-
- vals2, err := sec.Key("STRINGS").StrictInts(",")
- So(vals2, ShouldBeEmpty)
- So(err, ShouldNotBeNil)
-
- vals3, err := sec.Key("STRINGS").StrictInt64s(",")
- So(vals3, ShouldBeEmpty)
- So(err, ShouldNotBeNil)
-
- vals4, err := sec.Key("STRINGS").StrictUints(",")
- So(vals4, ShouldBeEmpty)
- So(err, ShouldNotBeNil)
-
- vals5, err := sec.Key("STRINGS").StrictUint64s(",")
- So(vals5, ShouldBeEmpty)
- So(err, ShouldNotBeNil)
-
- vals6, err := sec.Key("STRINGS").StrictTimes(",")
- So(vals6, ShouldBeEmpty)
- So(err, ShouldNotBeNil)
- })
- })
-}
-
-func TestKey_StringsWithShadows(t *testing.T) {
- Convey("Get strings of shadows of a key", t, func() {
- f, err := ini.ShadowLoad([]byte(""))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- k, err := f.Section("").NewKey("NUMS", "1,2")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
- k, err = f.Section("").NewKey("NUMS", "4,5,6")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
-
- So(k.StringsWithShadows(","), ShouldResemble, []string{"1", "2", "4", "5", "6"})
- })
-}
-
-func TestKey_SetValue(t *testing.T) {
- Convey("Set value of key", t, func() {
- f := ini.Empty()
- So(f, ShouldNotBeNil)
-
- k, err := f.Section("").NewKey("NAME", "ini")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
- So(k.Value(), ShouldEqual, "ini")
-
- k.SetValue("ini.v1")
- So(k.Value(), ShouldEqual, "ini.v1")
- })
-}
-
-func TestKey_NestedValues(t *testing.T) {
- Convey("Read and write nested values", t, func() {
- f, err := ini.LoadSources(ini.LoadOptions{
- AllowNestedValues: true,
- }, []byte(`
-aws_access_key_id = foo
-aws_secret_access_key = bar
-region = us-west-2
-s3 =
- max_concurrent_requests=10
- max_queue_size=1000`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("").Key("s3").NestedValues(), ShouldResemble, []string{"max_concurrent_requests=10", "max_queue_size=1000"})
-
- var buf bytes.Buffer
- _, err = f.WriteTo(&buf)
- So(err, ShouldBeNil)
- So(buf.String(), ShouldEqual, `aws_access_key_id = foo
-aws_secret_access_key = bar
-region = us-west-2
-s3 =
- max_concurrent_requests=10
- max_queue_size=1000
-
-`)
- })
-}
-
-func TestRecursiveValues(t *testing.T) {
- Convey("Recursive values should not reflect on same key", t, func() {
- f, err := ini.Load([]byte(`
-NAME = ini
-[package]
-NAME = %(NAME)s`))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
- So(f.Section("package").Key("NAME").String(), ShouldEqual, "ini")
- })
-}
diff --git a/vendor/github.com/go-ini/ini/parser_test.go b/vendor/github.com/go-ini/ini/parser_test.go
deleted file mode 100644
index bb0f2665e..000000000
--- a/vendor/github.com/go-ini/ini/parser_test.go
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2016 Unknwon
-//
-// Licensed under the Apache License, Version 2.0 (the "License"): you may
-// not use this file except in compliance with the License. You may obtain
-// a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations
-// under the License.
-
-package ini_test
-
-import (
- "testing"
-
- . "github.com/smartystreets/goconvey/convey"
- "gopkg.in/ini.v1"
-)
-
-func TestBOM(t *testing.T) {
- Convey("Test handling BOM", t, func() {
- Convey("UTF-8-BOM", func() {
- f, err := ini.Load("testdata/UTF-8-BOM.ini")
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.Section("author").Key("E-MAIL").String(), ShouldEqual, "u@gogs.io")
- })
-
- Convey("UTF-16-LE-BOM", func() {
- f, err := ini.Load("testdata/UTF-16-LE-BOM.ini")
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
- })
-
- Convey("UTF-16-BE-BOM", func() {
- })
- })
-}
-
-func TestBadLoad(t *testing.T) {
- Convey("Load with bad data", t, func() {
- Convey("Bad section name", func() {
- _, err := ini.Load([]byte("[]"))
- So(err, ShouldNotBeNil)
-
- _, err = ini.Load([]byte("["))
- So(err, ShouldNotBeNil)
- })
-
- Convey("Bad keys", func() {
- _, err := ini.Load([]byte(`"""name`))
- So(err, ShouldNotBeNil)
-
- _, err = ini.Load([]byte(`"""name"""`))
- So(err, ShouldNotBeNil)
-
- _, err = ini.Load([]byte(`""=1`))
- So(err, ShouldNotBeNil)
-
- _, err = ini.Load([]byte(`=`))
- So(err, ShouldNotBeNil)
-
- _, err = ini.Load([]byte(`name`))
- So(err, ShouldNotBeNil)
- })
-
- Convey("Bad values", func() {
- _, err := ini.Load([]byte(`name="""Unknwon`))
- So(err, ShouldNotBeNil)
- })
- })
-}
diff --git a/vendor/github.com/go-ini/ini/section_test.go b/vendor/github.com/go-ini/ini/section_test.go
deleted file mode 100644
index e9c347881..000000000
--- a/vendor/github.com/go-ini/ini/section_test.go
+++ /dev/null
@@ -1,313 +0,0 @@
-// Copyright 2014 Unknwon
-//
-// Licensed under the Apache License, Version 2.0 (the "License"): you may
-// not use this file except in compliance with the License. You may obtain
-// a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations
-// under the License.
-
-package ini_test
-
-import (
- "testing"
-
- . "github.com/smartystreets/goconvey/convey"
- "gopkg.in/ini.v1"
-)
-
-func TestSection_SetBody(t *testing.T) {
- Convey("Set body of raw section", t, func() {
- f := ini.Empty()
- So(f, ShouldNotBeNil)
-
- sec, err := f.NewRawSection("comments", `1111111111111111111000000000000000001110000
-111111111111111111100000000000111000000000`)
- So(err, ShouldBeNil)
- So(sec, ShouldNotBeNil)
- So(sec.Body(), ShouldEqual, `1111111111111111111000000000000000001110000
-111111111111111111100000000000111000000000`)
-
- sec.SetBody("1111111111111111111000000000000000001110000")
- So(sec.Body(), ShouldEqual, `1111111111111111111000000000000000001110000`)
-
- Convey("Set for non-raw section", func() {
- sec, err := f.NewSection("author")
- So(err, ShouldBeNil)
- So(sec, ShouldNotBeNil)
- So(sec.Body(), ShouldBeEmpty)
-
- sec.SetBody("1111111111111111111000000000000000001110000")
- So(sec.Body(), ShouldBeEmpty)
- })
- })
-}
-
-func TestSection_NewKey(t *testing.T) {
- Convey("Create a new key", t, func() {
- f := ini.Empty()
- So(f, ShouldNotBeNil)
-
- k, err := f.Section("").NewKey("NAME", "ini")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
- So(k.Name(), ShouldEqual, "NAME")
- So(k.Value(), ShouldEqual, "ini")
-
- Convey("With duplicated name", func() {
- k, err := f.Section("").NewKey("NAME", "ini.v1")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
-
- // Overwrite previous existed key
- So(k.Value(), ShouldEqual, "ini.v1")
- })
-
- Convey("With empty string", func() {
- _, err := f.Section("").NewKey("", "")
- So(err, ShouldNotBeNil)
- })
- })
-
- Convey("Create keys with same name and allow shadow", t, func() {
- f, err := ini.ShadowLoad([]byte(""))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- k, err := f.Section("").NewKey("NAME", "ini")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
- k, err = f.Section("").NewKey("NAME", "ini.v1")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
-
- So(k.ValueWithShadows(), ShouldResemble, []string{"ini", "ini.v1"})
- })
-}
-
-func TestSection_NewBooleanKey(t *testing.T) {
- Convey("Create a new boolean key", t, func() {
- f := ini.Empty()
- So(f, ShouldNotBeNil)
-
- k, err := f.Section("").NewBooleanKey("start-ssh-server")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
- So(k.Name(), ShouldEqual, "start-ssh-server")
- So(k.Value(), ShouldEqual, "true")
-
- Convey("With empty string", func() {
- _, err := f.Section("").NewBooleanKey("")
- So(err, ShouldNotBeNil)
- })
- })
-}
-
-func TestSection_GetKey(t *testing.T) {
- Convey("Get a key", t, func() {
- f := ini.Empty()
- So(f, ShouldNotBeNil)
-
- k, err := f.Section("").NewKey("NAME", "ini")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
-
- k, err = f.Section("").GetKey("NAME")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
- So(k.Name(), ShouldEqual, "NAME")
- So(k.Value(), ShouldEqual, "ini")
-
- Convey("Key not exists", func() {
- _, err := f.Section("").GetKey("404")
- So(err, ShouldNotBeNil)
- })
-
- Convey("Key exists in parent section", func() {
- k, err := f.Section("parent").NewKey("AGE", "18")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
-
- k, err = f.Section("parent.child.son").GetKey("AGE")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
- So(k.Value(), ShouldEqual, "18")
- })
- })
-}
-
-func TestSection_HasKey(t *testing.T) {
- Convey("Check if a key exists", t, func() {
- f := ini.Empty()
- So(f, ShouldNotBeNil)
-
- k, err := f.Section("").NewKey("NAME", "ini")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
-
- So(f.Section("").HasKey("NAME"), ShouldBeTrue)
- So(f.Section("").Haskey("NAME"), ShouldBeTrue)
- So(f.Section("").HasKey("404"), ShouldBeFalse)
- So(f.Section("").Haskey("404"), ShouldBeFalse)
- })
-}
-
-func TestSection_HasValue(t *testing.T) {
- Convey("Check if contains a value in any key", t, func() {
- f := ini.Empty()
- So(f, ShouldNotBeNil)
-
- k, err := f.Section("").NewKey("NAME", "ini")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
-
- So(f.Section("").HasValue("ini"), ShouldBeTrue)
- So(f.Section("").HasValue("404"), ShouldBeFalse)
- })
-}
-
-func TestSection_Key(t *testing.T) {
- Convey("Get a key", t, func() {
- f := ini.Empty()
- So(f, ShouldNotBeNil)
-
- k, err := f.Section("").NewKey("NAME", "ini")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
-
- k = f.Section("").Key("NAME")
- So(k, ShouldNotBeNil)
- So(k.Name(), ShouldEqual, "NAME")
- So(k.Value(), ShouldEqual, "ini")
-
- Convey("Key not exists", func() {
- k := f.Section("").Key("404")
- So(k, ShouldNotBeNil)
- So(k.Name(), ShouldEqual, "404")
- })
-
- Convey("Key exists in parent section", func() {
- k, err := f.Section("parent").NewKey("AGE", "18")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
-
- k = f.Section("parent.child.son").Key("AGE")
- So(k, ShouldNotBeNil)
- So(k.Value(), ShouldEqual, "18")
- })
- })
-}
-
-func TestSection_Keys(t *testing.T) {
- Convey("Get all keys in a section", t, func() {
- f := ini.Empty()
- So(f, ShouldNotBeNil)
-
- k, err := f.Section("").NewKey("NAME", "ini")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
- k, err = f.Section("").NewKey("VERSION", "v1")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
- k, err = f.Section("").NewKey("IMPORT_PATH", "gopkg.in/ini.v1")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
-
- keys := f.Section("").Keys()
- names := []string{"NAME", "VERSION", "IMPORT_PATH"}
- So(len(keys), ShouldEqual, len(names))
- for i, name := range names {
- So(keys[i].Name(), ShouldEqual, name)
- }
- })
-}
-
-func TestSection_ParentKeys(t *testing.T) {
- Convey("Get all keys of parent sections", t, func() {
- f := ini.Empty()
- So(f, ShouldNotBeNil)
-
- k, err := f.Section("package").NewKey("NAME", "ini")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
- k, err = f.Section("package").NewKey("VERSION", "v1")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
- k, err = f.Section("package").NewKey("IMPORT_PATH", "gopkg.in/ini.v1")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
-
- keys := f.Section("package.sub.sub2").ParentKeys()
- names := []string{"NAME", "VERSION", "IMPORT_PATH"}
- So(len(keys), ShouldEqual, len(names))
- for i, name := range names {
- So(keys[i].Name(), ShouldEqual, name)
- }
- })
-}
-
-func TestSection_KeyStrings(t *testing.T) {
- Convey("Get all key names in a section", t, func() {
- f := ini.Empty()
- So(f, ShouldNotBeNil)
-
- k, err := f.Section("").NewKey("NAME", "ini")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
- k, err = f.Section("").NewKey("VERSION", "v1")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
- k, err = f.Section("").NewKey("IMPORT_PATH", "gopkg.in/ini.v1")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
-
- So(f.Section("").KeyStrings(), ShouldResemble, []string{"NAME", "VERSION", "IMPORT_PATH"})
- })
-}
-
-func TestSection_KeyHash(t *testing.T) {
- Convey("Get clone of key hash", t, func() {
- f := ini.Empty()
- So(f, ShouldNotBeNil)
-
- k, err := f.Section("").NewKey("NAME", "ini")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
- k, err = f.Section("").NewKey("VERSION", "v1")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
- k, err = f.Section("").NewKey("IMPORT_PATH", "gopkg.in/ini.v1")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
-
- hash := f.Section("").KeysHash()
- relation := map[string]string{
- "NAME": "ini",
- "VERSION": "v1",
- "IMPORT_PATH": "gopkg.in/ini.v1",
- }
- for k, v := range hash {
- So(v, ShouldEqual, relation[k])
- }
- })
-}
-
-func TestSection_DeleteKey(t *testing.T) {
- Convey("Delete a key", t, func() {
- f := ini.Empty()
- So(f, ShouldNotBeNil)
-
- k, err := f.Section("").NewKey("NAME", "ini")
- So(err, ShouldBeNil)
- So(k, ShouldNotBeNil)
-
- So(f.Section("").HasKey("NAME"), ShouldBeTrue)
- f.Section("").DeleteKey("NAME")
- So(f.Section("").HasKey("NAME"), ShouldBeFalse)
- })
-}
diff --git a/vendor/github.com/go-ini/ini/struct_test.go b/vendor/github.com/go-ini/ini/struct_test.go
deleted file mode 100644
index 0dbbef22d..000000000
--- a/vendor/github.com/go-ini/ini/struct_test.go
+++ /dev/null
@@ -1,387 +0,0 @@
-// Copyright 2014 Unknwon
-//
-// Licensed under the Apache License, Version 2.0 (the "License"): you may
-// not use this file except in compliance with the License. You may obtain
-// a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations
-// under the License.
-
-package ini_test
-
-import (
- "bytes"
- "fmt"
- "strings"
- "testing"
- "time"
-
- . "github.com/smartystreets/goconvey/convey"
- "gopkg.in/ini.v1"
-)
-
-type testNested struct {
- Cities []string `delim:"|"`
- Visits []time.Time
- Years []int
- Numbers []int64
- Ages []uint
- Populations []uint64
- Coordinates []float64
- Note string
- Unused int `ini:"-"`
-}
-
-type TestEmbeded struct {
- GPA float64
-}
-
-type testStruct struct {
- Name string `ini:"NAME"`
- Age int
- Male bool
- Money float64
- Born time.Time
- Time time.Duration `ini:"Duration"`
- Others testNested
- *TestEmbeded `ini:"grade"`
- Unused int `ini:"-"`
- Unsigned uint
- Omitted bool `ini:"omitthis,omitempty"`
- Shadows []string `ini:",,allowshadow"`
- ShadowInts []int `ini:"Shadows,,allowshadow"`
-}
-
-const _CONF_DATA_STRUCT = `
-NAME = Unknwon
-Age = 21
-Male = true
-Money = 1.25
-Born = 1993-10-07T20:17:05Z
-Duration = 2h45m
-Unsigned = 3
-omitthis = true
-Shadows = 1, 2
-Shadows = 3, 4
-
-[Others]
-Cities = HangZhou|Boston
-Visits = 1993-10-07T20:17:05Z, 1993-10-07T20:17:05Z
-Years = 1993,1994
-Numbers = 10010,10086
-Ages = 18,19
-Populations = 12345678,98765432
-Coordinates = 192.168,10.11
-Note = Hello world!
-
-[grade]
-GPA = 2.8
-
-[foo.bar]
-Here = there
-When = then
-`
-
-type unsupport struct {
- Byte byte
-}
-
-type unsupport2 struct {
- Others struct {
- Cities byte
- }
-}
-
-type Unsupport3 struct {
- Cities byte
-}
-
-type unsupport4 struct {
- *Unsupport3 `ini:"Others"`
-}
-
-type defaultValue struct {
- Name string
- Age int
- Male bool
- Money float64
- Born time.Time
- Cities []string
-}
-
-type fooBar struct {
- Here, When string
-}
-
-const _INVALID_DATA_CONF_STRUCT = `
-Name =
-Age = age
-Male = 123
-Money = money
-Born = nil
-Cities =
-`
-
-func Test_MapToStruct(t *testing.T) {
- Convey("Map to struct", t, func() {
- Convey("Map file to struct", func() {
- ts := new(testStruct)
- So(ini.MapTo(ts, []byte(_CONF_DATA_STRUCT)), ShouldBeNil)
-
- So(ts.Name, ShouldEqual, "Unknwon")
- So(ts.Age, ShouldEqual, 21)
- So(ts.Male, ShouldBeTrue)
- So(ts.Money, ShouldEqual, 1.25)
- So(ts.Unsigned, ShouldEqual, 3)
-
- t, err := time.Parse(time.RFC3339, "1993-10-07T20:17:05Z")
- So(err, ShouldBeNil)
- So(ts.Born.String(), ShouldEqual, t.String())
-
- dur, err := time.ParseDuration("2h45m")
- So(err, ShouldBeNil)
- So(ts.Time.Seconds(), ShouldEqual, dur.Seconds())
-
- So(strings.Join(ts.Others.Cities, ","), ShouldEqual, "HangZhou,Boston")
- So(ts.Others.Visits[0].String(), ShouldEqual, t.String())
- So(fmt.Sprint(ts.Others.Years), ShouldEqual, "[1993 1994]")
- So(fmt.Sprint(ts.Others.Numbers), ShouldEqual, "[10010 10086]")
- So(fmt.Sprint(ts.Others.Ages), ShouldEqual, "[18 19]")
- So(fmt.Sprint(ts.Others.Populations), ShouldEqual, "[12345678 98765432]")
- So(fmt.Sprint(ts.Others.Coordinates), ShouldEqual, "[192.168 10.11]")
- So(ts.Others.Note, ShouldEqual, "Hello world!")
- So(ts.TestEmbeded.GPA, ShouldEqual, 2.8)
- })
-
- Convey("Map section to struct", func() {
- foobar := new(fooBar)
- f, err := ini.Load([]byte(_CONF_DATA_STRUCT))
- So(err, ShouldBeNil)
-
- So(f.Section("foo.bar").MapTo(foobar), ShouldBeNil)
- So(foobar.Here, ShouldEqual, "there")
- So(foobar.When, ShouldEqual, "then")
- })
-
- Convey("Map to non-pointer struct", func() {
- f, err := ini.Load([]byte(_CONF_DATA_STRUCT))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- So(f.MapTo(testStruct{}), ShouldNotBeNil)
- })
-
- Convey("Map to unsupported type", func() {
- f, err := ini.Load([]byte(_CONF_DATA_STRUCT))
- So(err, ShouldBeNil)
- So(f, ShouldNotBeNil)
-
- f.NameMapper = func(raw string) string {
- if raw == "Byte" {
- return "NAME"
- }
- return raw
- }
- So(f.MapTo(&unsupport{}), ShouldNotBeNil)
- So(f.MapTo(&unsupport2{}), ShouldNotBeNil)
- So(f.MapTo(&unsupport4{}), ShouldNotBeNil)
- })
-
- Convey("Map to omitempty field", func() {
- ts := new(testStruct)
- So(ini.MapTo(ts, []byte(_CONF_DATA_STRUCT)), ShouldBeNil)
-
- So(ts.Omitted, ShouldEqual, true)
- })
-
- Convey("Map with shadows", func() {
- f, err := ini.LoadSources(ini.LoadOptions{AllowShadows: true}, []byte(_CONF_DATA_STRUCT))
- So(err, ShouldBeNil)
- ts := new(testStruct)
- So(f.MapTo(ts), ShouldBeNil)
-
- So(strings.Join(ts.Shadows, " "), ShouldEqual, "1 2 3 4")
- So(fmt.Sprintf("%v", ts.ShadowInts), ShouldEqual, "[1 2 3 4]")
- })
-
- Convey("Map from invalid data source", func() {
- So(ini.MapTo(&testStruct{}, "hi"), ShouldNotBeNil)
- })
-
- Convey("Map to wrong types and gain default values", func() {
- f, err := ini.Load([]byte(_INVALID_DATA_CONF_STRUCT))
- So(err, ShouldBeNil)
-
- t, err := time.Parse(time.RFC3339, "1993-10-07T20:17:05Z")
- So(err, ShouldBeNil)
- dv := &defaultValue{"Joe", 10, true, 1.25, t, []string{"HangZhou", "Boston"}}
- So(f.MapTo(dv), ShouldBeNil)
- So(dv.Name, ShouldEqual, "Joe")
- So(dv.Age, ShouldEqual, 10)
- So(dv.Male, ShouldBeTrue)
- So(dv.Money, ShouldEqual, 1.25)
- So(dv.Born.String(), ShouldEqual, t.String())
- So(strings.Join(dv.Cities, ","), ShouldEqual, "HangZhou,Boston")
- })
- })
-
- Convey("Map to struct in strict mode", t, func() {
- f, err := ini.Load([]byte(`
-name=bruce
-age=a30`))
- So(err, ShouldBeNil)
-
- type Strict struct {
- Name string `ini:"name"`
- Age int `ini:"age"`
- }
- s := new(Strict)
-
- So(f.Section("").StrictMapTo(s), ShouldNotBeNil)
- })
-
- Convey("Map slice in strict mode", t, func() {
- f, err := ini.Load([]byte(`
-names=alice, bruce`))
- So(err, ShouldBeNil)
-
- type Strict struct {
- Names []string `ini:"names"`
- }
- s := new(Strict)
-
- So(f.Section("").StrictMapTo(s), ShouldBeNil)
- So(fmt.Sprint(s.Names), ShouldEqual, "[alice bruce]")
- })
-}
-
-func Test_ReflectFromStruct(t *testing.T) {
- Convey("Reflect from struct", t, func() {
- type Embeded struct {
- Dates []time.Time `delim:"|" comment:"Time data"`
- Places []string
- Years []int
- Numbers []int64
- Ages []uint
- Populations []uint64
- Coordinates []float64
- None []int
- }
- type Author struct {
- Name string `ini:"NAME"`
- Male bool
- Age int `comment:"Author's age"`
- Height uint
- GPA float64
- Date time.Time
- NeverMind string `ini:"-"`
- *Embeded `ini:"infos" comment:"Embeded section"`
- }
-
- t, err := time.Parse(time.RFC3339, "1993-10-07T20:17:05Z")
- So(err, ShouldBeNil)
- a := &Author{"Unknwon", true, 21, 100, 2.8, t, "",
- &Embeded{
- []time.Time{t, t},
- []string{"HangZhou", "Boston"},
- []int{1993, 1994},
- []int64{10010, 10086},
- []uint{18, 19},
- []uint64{12345678, 98765432},
- []float64{192.168, 10.11},
- []int{},
- }}
- cfg := ini.Empty()
- So(ini.ReflectFrom(cfg, a), ShouldBeNil)
-
- var buf bytes.Buffer
- _, err = cfg.WriteTo(&buf)
- So(err, ShouldBeNil)
- So(buf.String(), ShouldEqual, `NAME = Unknwon
-Male = true
-; Author's age
-Age = 21
-Height = 100
-GPA = 2.8
-Date = 1993-10-07T20:17:05Z
-
-; Embeded section
-[infos]
-; Time data
-Dates = 1993-10-07T20:17:05Z|1993-10-07T20:17:05Z
-Places = HangZhou,Boston
-Years = 1993,1994
-Numbers = 10010,10086
-Ages = 18,19
-Populations = 12345678,98765432
-Coordinates = 192.168,10.11
-None =
-
-`)
-
- Convey("Reflect from non-point struct", func() {
- So(ini.ReflectFrom(cfg, Author{}), ShouldNotBeNil)
- })
-
- Convey("Reflect from struct with omitempty", func() {
- cfg := ini.Empty()
- type SpecialStruct struct {
- FirstName string `ini:"first_name"`
- LastName string `ini:"last_name"`
- JustOmitMe string `ini:"omitempty"`
- LastLogin time.Time `ini:"last_login,omitempty"`
- LastLogin2 time.Time `ini:",omitempty"`
- NotEmpty int `ini:"omitempty"`
- }
-
- So(ini.ReflectFrom(cfg, &SpecialStruct{FirstName: "John", LastName: "Doe", NotEmpty: 9}), ShouldBeNil)
-
- var buf bytes.Buffer
- _, err = cfg.WriteTo(&buf)
- So(buf.String(), ShouldEqual, `first_name = John
-last_name = Doe
-omitempty = 9
-
-`)
- })
- })
-}
-
-type testMapper struct {
- PackageName string
-}
-
-func Test_NameGetter(t *testing.T) {
- Convey("Test name mappers", t, func() {
- So(ini.MapToWithMapper(&testMapper{}, ini.TitleUnderscore, []byte("packag_name=ini")), ShouldBeNil)
-
- cfg, err := ini.Load([]byte("PACKAGE_NAME=ini"))
- So(err, ShouldBeNil)
- So(cfg, ShouldNotBeNil)
-
- cfg.NameMapper = ini.AllCapsUnderscore
- tg := new(testMapper)
- So(cfg.MapTo(tg), ShouldBeNil)
- So(tg.PackageName, ShouldEqual, "ini")
- })
-}
-
-type testDurationStruct struct {
- Duration time.Duration `ini:"Duration"`
-}
-
-func Test_Duration(t *testing.T) {
- Convey("Duration less than 16m50s", t, func() {
- ds := new(testDurationStruct)
- So(ini.MapTo(ds, []byte("Duration=16m49s")), ShouldBeNil)
-
- dur, err := time.ParseDuration("16m49s")
- So(err, ShouldBeNil)
- So(ds.Duration.Seconds(), ShouldEqual, dur.Seconds())
- })
-}
diff --git a/vendor/github.com/go-logfmt/logfmt/decode-bench_test.go b/vendor/github.com/go-logfmt/logfmt/decode-bench_test.go
deleted file mode 100644
index f66dc25a4..000000000
--- a/vendor/github.com/go-logfmt/logfmt/decode-bench_test.go
+++ /dev/null
@@ -1,75 +0,0 @@
-package logfmt
-
-import (
- "bufio"
- "bytes"
- "testing"
-
- kr "github.com/kr/logfmt"
-)
-
-func BenchmarkDecodeKeyval(b *testing.B) {
- const rows = 10000
- data := []byte{}
- for i := 0; i < rows; i++ {
- data = append(data, "a=1 b=\"bar\" ƒ=2h3s r=\"esc\\tmore stuff\" d x=sf \n"...)
- }
-
- b.SetBytes(int64(len(data)))
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- var (
- dec = NewDecoder(bytes.NewReader(data))
- j = 0
- )
- for dec.ScanRecord() {
- for dec.ScanKeyval() {
- }
- j++
- }
- if err := dec.Err(); err != nil {
- b.Errorf("got %v, want %v", err, nil)
- }
- if j != rows {
- b.Errorf("got %v, want %v", j, rows)
- }
- }
-}
-
-func BenchmarkKRDecode(b *testing.B) {
- const rows = 10000
- data := []byte{}
- for i := 0; i < rows; i++ {
- data = append(data, "a=1 b=\"bar\" ƒ=2h3s r=\"esc\\tmore stuff\" d x=sf \n"...)
- }
-
- b.SetBytes(int64(len(data)))
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- var (
- s = bufio.NewScanner(bytes.NewReader(data))
- err error
- j = 0
- dh discardHandler
- )
- for err == nil && s.Scan() {
- err = kr.Unmarshal(s.Bytes(), &dh)
- j++
- }
- if err == nil {
- err = s.Err()
- }
- if err != nil {
- b.Errorf("got %v, want %v", err, nil)
- }
- if j != rows {
- b.Errorf("got %v, want %v", j, rows)
- }
- }
-}
-
-type discardHandler struct{}
-
-func (discardHandler) HandleLogfmt(key, val []byte) error {
- return nil
-}
diff --git a/vendor/github.com/go-logfmt/logfmt/decode_test.go b/vendor/github.com/go-logfmt/logfmt/decode_test.go
deleted file mode 100644
index 363152daf..000000000
--- a/vendor/github.com/go-logfmt/logfmt/decode_test.go
+++ /dev/null
@@ -1,184 +0,0 @@
-package logfmt
-
-import (
- "bytes"
- "fmt"
- "reflect"
- "strings"
- "testing"
-)
-
-type kv struct {
- k, v []byte
-}
-
-func (s kv) String() string {
- return fmt.Sprintf("{k:%q v:%q}", s.k, s.v)
-}
-
-func TestDecoder_scan(t *testing.T) {
- tests := []struct {
- data string
- want [][]kv
- }{
- {"", nil},
- {"\n\n", [][]kv{nil, nil}},
- {`x= `, [][]kv{{{[]byte("x"), nil}}}},
- {`y=`, [][]kv{{{[]byte("y"), nil}}}},
- {`y`, [][]kv{{{[]byte("y"), nil}}}},
- {`y=f`, [][]kv{{{[]byte("y"), []byte("f")}}}},
- {"y=\"\\tf\"", [][]kv{{{[]byte("y"), []byte("\tf")}}}},
- {"a=1\n", [][]kv{{{[]byte("a"), []byte("1")}}}},
- {
- `a=1 b="bar" ƒ=2h3s r="esc\t" d x=sf `,
- [][]kv{{
- {[]byte("a"), []byte("1")},
- {[]byte("b"), []byte("bar")},
- {[]byte("ƒ"), []byte("2h3s")},
- {[]byte("r"), []byte("esc\t")},
- {[]byte("d"), nil},
- {[]byte("x"), []byte("sf")},
- }},
- },
- {
- "y=f\ny=g",
- [][]kv{
- {{[]byte("y"), []byte("f")}},
- {{[]byte("y"), []byte("g")}},
- },
- },
- {
- "y=f \n\x1e y=g",
- [][]kv{
- {{[]byte("y"), []byte("f")}},
- {{[]byte("y"), []byte("g")}},
- },
- },
- {
- "y= d y=g",
- [][]kv{{
- {[]byte("y"), nil},
- {[]byte("d"), nil},
- {[]byte("y"), []byte("g")},
- }},
- },
- {
- "y=\"f\"\ny=g",
- [][]kv{
- {{[]byte("y"), []byte("f")}},
- {{[]byte("y"), []byte("g")}},
- },
- },
- {
- "y=\"f\\n\"y=g",
- [][]kv{{
- {[]byte("y"), []byte("f\n")},
- {[]byte("y"), []byte("g")},
- }},
- },
- }
-
- for _, test := range tests {
- var got [][]kv
- dec := NewDecoder(strings.NewReader(test.data))
-
- for dec.ScanRecord() {
- var kvs []kv
- for dec.ScanKeyval() {
- k := dec.Key()
- v := dec.Value()
- if k != nil {
- kvs = append(kvs, kv{k, v})
- }
- }
- got = append(got, kvs)
- }
- if err := dec.Err(); err != nil {
- t.Errorf("got err: %v", err)
- }
- if !reflect.DeepEqual(got, test.want) {
- t.Errorf("\n in: %q\n got: %+v\nwant: %+v", test.data, got, test.want)
- }
- }
-}
-
-func TestDecoder_errors(t *testing.T) {
- tests := []struct {
- data string
- want error
- }{
- {"a=1\n=bar", &SyntaxError{Msg: "unexpected '='", Line: 2, Pos: 1}},
- {"a=1\n\"k\"=bar", &SyntaxError{Msg: "unexpected '\"'", Line: 2, Pos: 1}},
- {"a=1\nk\"ey=bar", &SyntaxError{Msg: "unexpected '\"'", Line: 2, Pos: 2}},
- {"a=1\nk=b\"ar", &SyntaxError{Msg: "unexpected '\"'", Line: 2, Pos: 4}},
- {"a=1\nk=b =ar", &SyntaxError{Msg: "unexpected '='", Line: 2, Pos: 5}},
- {"a==", &SyntaxError{Msg: "unexpected '='", Line: 1, Pos: 3}},
- {"a=1\nk=b=ar", &SyntaxError{Msg: "unexpected '='", Line: 2, Pos: 4}},
- {"a=\"1", &SyntaxError{Msg: "unterminated quoted value", Line: 1, Pos: 5}},
- {"a=\"1\\", &SyntaxError{Msg: "unterminated quoted value", Line: 1, Pos: 6}},
- {"a=\"\\t1", &SyntaxError{Msg: "unterminated quoted value", Line: 1, Pos: 7}},
- {"a=\"\\u1\"", &SyntaxError{Msg: "invalid quoted value", Line: 1, Pos: 8}},
- {"a\ufffd=bar", &SyntaxError{Msg: "invalid key", Line: 1, Pos: 5}},
- {"\x80=bar", &SyntaxError{Msg: "invalid key", Line: 1, Pos: 2}},
- {"\x80", &SyntaxError{Msg: "invalid key", Line: 1, Pos: 2}},
- }
-
- for _, test := range tests {
- dec := NewDecoder(strings.NewReader(test.data))
-
- for dec.ScanRecord() {
- for dec.ScanKeyval() {
- }
- }
- if got, want := dec.Err(), test.want; !reflect.DeepEqual(got, want) {
- t.Errorf("got: %v, want: %v", got, want)
- }
- }
-}
-
-func TestDecoder_decode_encode(t *testing.T) {
- tests := []struct {
- in, out string
- }{
- {"", ""},
- {"\n", "\n"},
- {"\n \n", "\n\n"},
- {
- "a=1\nb=2\n",
- "a=1\nb=2\n",
- },
- {
- "a=1 b=\"bar\" ƒ=2h3s r=\"esc\\t\" d x=sf ",
- "a=1 b=bar ƒ=2h3s r=\"esc\\t\" d= x=sf\n",
- },
- }
-
- for _, test := range tests {
- dec := NewDecoder(strings.NewReader(test.in))
- buf := bytes.Buffer{}
- enc := NewEncoder(&buf)
-
- var err error
- loop:
- for dec.ScanRecord() && err == nil {
- for dec.ScanKeyval() {
- if dec.Key() == nil {
- continue
- }
- if err = enc.EncodeKeyval(dec.Key(), dec.Value()); err != nil {
- break loop
- }
- }
- enc.EndRecord()
- }
- if err == nil {
- err = dec.Err()
- }
- if err != nil {
- t.Errorf("got err: %v", err)
- }
- if got, want := buf.String(), test.out; got != want {
- t.Errorf("\n got: %q\nwant: %q", got, want)
- }
- }
-}
diff --git a/vendor/github.com/go-logfmt/logfmt/encode_internal_test.go b/vendor/github.com/go-logfmt/logfmt/encode_internal_test.go
deleted file mode 100644
index 6271ce8ac..000000000
--- a/vendor/github.com/go-logfmt/logfmt/encode_internal_test.go
+++ /dev/null
@@ -1,233 +0,0 @@
-package logfmt
-
-import (
- "bytes"
- "errors"
- "fmt"
- "reflect"
- "testing"
-)
-
-func TestSafeString(t *testing.T) {
- _, ok := safeString((*stringStringer)(nil))
- if got, want := ok, false; got != want {
- t.Errorf(" got %v, want %v", got, want)
- }
-}
-
-func TestSafeMarshal(t *testing.T) {
- kb, err := safeMarshal((*stringMarshaler)(nil))
- if got := kb; got != nil {
- t.Errorf(" got %v, want nil", got)
- }
- if got, want := err, error(nil); got != want {
- t.Errorf(" got %v, want %v", got, want)
- }
-}
-
-func TestWriteKeyStrings(t *testing.T) {
- keygen := []func(string) interface{}{
- func(s string) interface{} { return s },
- func(s string) interface{} { return stringData(s) },
- func(s string) interface{} { return stringStringer(s) },
- func(s string) interface{} { return stringMarshaler(s) },
- }
-
- data := []struct {
- key string
- want string
- err error
- }{
- {key: "k", want: "k"},
- {key: `\`, want: `\`},
- {key: "\n", err: ErrInvalidKey},
- {key: "\x00", err: ErrInvalidKey},
- {key: "\x10", err: ErrInvalidKey},
- {key: "\x1F", err: ErrInvalidKey},
- {key: "", err: ErrInvalidKey},
- {key: " ", err: ErrInvalidKey},
- {key: "=", err: ErrInvalidKey},
- {key: `"`, err: ErrInvalidKey},
- }
-
- for _, g := range keygen {
- for _, d := range data {
- w := &bytes.Buffer{}
- key := g(d.key)
- err := writeKey(w, key)
- if err != d.err {
- t.Errorf("%#v (%[1]T): got error: %v, want error: %v", key, err, d.err)
- }
- if err != nil {
- continue
- }
- if got, want := w.String(), d.want; got != want {
- t.Errorf("%#v (%[1]T): got '%s', want '%s'", key, got, want)
- }
- }
- }
-}
-
-func TestWriteKey(t *testing.T) {
- var (
- nilPtr *int
- one = 1
- ptr = &one
- )
-
- data := []struct {
- key interface{}
- want string
- err error
- }{
- {key: nil, err: ErrNilKey},
- {key: nilPtr, err: ErrNilKey},
- {key: (*stringStringer)(nil), err: ErrNilKey},
- {key: (*stringMarshaler)(nil), err: ErrNilKey},
- {key: (*stringerMarshaler)(nil), err: ErrNilKey},
- {key: ptr, want: "1"},
-
- {key: errorMarshaler{}, err: &MarshalerError{Type: reflect.TypeOf(errorMarshaler{}), Err: errMarshaling}},
- {key: make(chan int), err: ErrUnsupportedKeyType},
- {key: []int{}, err: ErrUnsupportedKeyType},
- {key: map[int]int{}, err: ErrUnsupportedKeyType},
- {key: [2]int{}, err: ErrUnsupportedKeyType},
- {key: struct{}{}, err: ErrUnsupportedKeyType},
- {key: fmt.Sprint, err: ErrUnsupportedKeyType},
- }
-
- for _, d := range data {
- w := &bytes.Buffer{}
- err := writeKey(w, d.key)
- if !reflect.DeepEqual(err, d.err) {
- t.Errorf("%#v: got error: %v, want error: %v", d.key, err, d.err)
- }
- if err != nil {
- continue
- }
- if got, want := w.String(), d.want; got != want {
- t.Errorf("%#v: got '%s', want '%s'", d.key, got, want)
- }
- }
-}
-
-func TestWriteValueStrings(t *testing.T) {
- keygen := []func(string) interface{}{
- func(s string) interface{} { return s },
- func(s string) interface{} { return errors.New(s) },
- func(s string) interface{} { return stringData(s) },
- func(s string) interface{} { return stringStringer(s) },
- func(s string) interface{} { return stringMarshaler(s) },
- }
-
- data := []struct {
- value string
- want string
- err error
- }{
- {value: "", want: ""},
- {value: "v", want: "v"},
- {value: " ", want: `" "`},
- {value: "=", want: `"="`},
- {value: `\`, want: `\`},
- {value: `"`, want: `"\""`},
- {value: `\"`, want: `"\\\""`},
- {value: "\n", want: `"\n"`},
- {value: "\x00", want: `"\u0000"`},
- {value: "\x10", want: `"\u0010"`},
- {value: "\x1F", want: `"\u001f"`},
- {value: "µ", want: `µ`},
- }
-
- for _, g := range keygen {
- for _, d := range data {
- w := &bytes.Buffer{}
- value := g(d.value)
- err := writeValue(w, value)
- if err != d.err {
- t.Errorf("%#v (%[1]T): got error: %v, want error: %v", value, err, d.err)
- }
- if err != nil {
- continue
- }
- if got, want := w.String(), d.want; got != want {
- t.Errorf("%#v (%[1]T): got '%s', want '%s'", value, got, want)
- }
- }
- }
-}
-
-func TestWriteValue(t *testing.T) {
- var (
- nilPtr *int
- one = 1
- ptr = &one
- )
-
- data := []struct {
- value interface{}
- want string
- err error
- }{
- {value: nil, want: "null"},
- {value: nilPtr, want: "null"},
- {value: (*stringStringer)(nil), want: "null"},
- {value: (*stringMarshaler)(nil), want: "null"},
- {value: (*stringerMarshaler)(nil), want: "null"},
- {value: ptr, want: "1"},
-
- {value: errorMarshaler{}, err: &MarshalerError{Type: reflect.TypeOf(errorMarshaler{}), Err: errMarshaling}},
- {value: make(chan int), err: ErrUnsupportedValueType},
- {value: []int{}, err: ErrUnsupportedValueType},
- {value: map[int]int{}, err: ErrUnsupportedValueType},
- {value: [2]int{}, err: ErrUnsupportedValueType},
- {value: struct{}{}, err: ErrUnsupportedValueType},
- {value: fmt.Sprint, err: ErrUnsupportedValueType},
- }
-
- for _, d := range data {
- w := &bytes.Buffer{}
- err := writeValue(w, d.value)
- if !reflect.DeepEqual(err, d.err) {
- t.Errorf("%#v: got error: %v, want error: %v", d.value, err, d.err)
- }
- if err != nil {
- continue
- }
- if got, want := w.String(), d.want; got != want {
- t.Errorf("%#v: got '%s', want '%s'", d.value, got, want)
- }
- }
-}
-
-type stringData string
-
-type stringStringer string
-
-func (s stringStringer) String() string {
- return string(s)
-}
-
-type stringMarshaler string
-
-func (s stringMarshaler) MarshalText() ([]byte, error) {
- return []byte(s), nil
-}
-
-type stringerMarshaler string
-
-func (s stringerMarshaler) String() string {
- return "String() called"
-}
-
-func (s stringerMarshaler) MarshalText() ([]byte, error) {
- return []byte(s), nil
-}
-
-var errMarshaling = errors.New("marshal error")
-
-type errorMarshaler struct{}
-
-func (errorMarshaler) MarshalText() ([]byte, error) {
- return nil, errMarshaling
-}
diff --git a/vendor/github.com/go-logfmt/logfmt/encode_test.go b/vendor/github.com/go-logfmt/logfmt/encode_test.go
deleted file mode 100644
index ebebaae61..000000000
--- a/vendor/github.com/go-logfmt/logfmt/encode_test.go
+++ /dev/null
@@ -1,206 +0,0 @@
-package logfmt_test
-
-import (
- "bytes"
- "errors"
- "fmt"
- "io/ioutil"
- "reflect"
- "testing"
- "time"
-
- "github.com/go-logfmt/logfmt"
-)
-
-func TestEncodeKeyval(t *testing.T) {
- data := []struct {
- key, value interface{}
- want string
- err error
- }{
- {key: "k", value: "v", want: "k=v"},
- {key: "k", value: nil, want: "k=null"},
- {key: `\`, value: "v", want: `\=v`},
- {key: "k", value: "", want: "k="},
- {key: "k", value: "null", want: `k="null"`},
- {key: "k", value: "<nil>", want: `k=<nil>`},
- {key: "k", value: true, want: "k=true"},
- {key: "k", value: 1, want: "k=1"},
- {key: "k", value: 1.025, want: "k=1.025"},
- {key: "k", value: 1e-3, want: "k=0.001"},
- {key: "k", value: 3.5 + 2i, want: "k=(3.5+2i)"},
- {key: "k", value: "v v", want: `k="v v"`},
- {key: "k", value: " ", want: `k=" "`},
- {key: "k", value: `"`, want: `k="\""`},
- {key: "k", value: `=`, want: `k="="`},
- {key: "k", value: `\`, want: `k=\`},
- {key: "k", value: `=\`, want: `k="=\\"`},
- {key: "k", value: `\"`, want: `k="\\\""`},
- {key: "k", value: [2]int{2, 19}, err: logfmt.ErrUnsupportedValueType},
- {key: "k", value: []string{"e1", "e 2"}, err: logfmt.ErrUnsupportedValueType},
- {key: "k", value: structData{"a a", 9}, err: logfmt.ErrUnsupportedValueType},
- {key: "k", value: decimalMarshaler{5, 9}, want: "k=5.9"},
- {key: "k", value: (*decimalMarshaler)(nil), want: "k=null"},
- {key: "k", value: decimalStringer{5, 9}, want: "k=5.9"},
- {key: "k", value: (*decimalStringer)(nil), want: "k=null"},
- {key: "k", value: marshalerStringer{5, 9}, want: "k=5.9"},
- {key: "k", value: (*marshalerStringer)(nil), want: "k=null"},
- {key: "k", value: new(nilMarshaler), want: "k=notnilmarshaler"},
- {key: "k", value: (*nilMarshaler)(nil), want: "k=nilmarshaler"},
- {key: (*marshalerStringer)(nil), value: "v", err: logfmt.ErrNilKey},
- {key: decimalMarshaler{5, 9}, value: "v", want: "5.9=v"},
- {key: (*decimalMarshaler)(nil), value: "v", err: logfmt.ErrNilKey},
- {key: decimalStringer{5, 9}, value: "v", want: "5.9=v"},
- {key: (*decimalStringer)(nil), value: "v", err: logfmt.ErrNilKey},
- {key: marshalerStringer{5, 9}, value: "v", want: "5.9=v"},
- {key: "k", value: "\xbd", want: `k="\ufffd"`},
- {key: "k", value: "\ufffd\x00", want: `k="\ufffd\u0000"`},
- {key: "k", value: "\ufffd", want: `k="\ufffd"`},
- {key: "k", value: []byte("\ufffd\x00"), want: `k="\ufffd\u0000"`},
- {key: "k", value: []byte("\ufffd"), want: `k="\ufffd"`},
- }
-
- for _, d := range data {
- w := &bytes.Buffer{}
- enc := logfmt.NewEncoder(w)
- err := enc.EncodeKeyval(d.key, d.value)
- if err != d.err {
- t.Errorf("%#v, %#v: got error: %v, want error: %v", d.key, d.value, err, d.err)
- }
- if got, want := w.String(), d.want; got != want {
- t.Errorf("%#v, %#v: got '%s', want '%s'", d.key, d.value, got, want)
- }
- }
-}
-
-func TestMarshalKeyvals(t *testing.T) {
- one := 1
- ptr := &one
- nilPtr := (*int)(nil)
-
- data := []struct {
- in []interface{}
- want []byte
- err error
- }{
- {in: nil, want: nil},
- {in: kv(), want: nil},
- {in: kv(nil, "v"), err: logfmt.ErrNilKey},
- {in: kv(nilPtr, "v"), err: logfmt.ErrNilKey},
- {in: kv("\ufffd"), err: logfmt.ErrInvalidKey},
- {in: kv("\xbd"), err: logfmt.ErrInvalidKey},
- {in: kv("k"), want: []byte("k=null")},
- {in: kv("k", nil), want: []byte("k=null")},
- {in: kv("k", ""), want: []byte("k=")},
- {in: kv("k", "null"), want: []byte(`k="null"`)},
- {in: kv("k", "v"), want: []byte("k=v")},
- {in: kv("k", true), want: []byte("k=true")},
- {in: kv("k", 1), want: []byte("k=1")},
- {in: kv("k", ptr), want: []byte("k=1")},
- {in: kv("k", nilPtr), want: []byte("k=null")},
- {in: kv("k", 1.025), want: []byte("k=1.025")},
- {in: kv("k", 1e-3), want: []byte("k=0.001")},
- {in: kv("k", "v v"), want: []byte(`k="v v"`)},
- {in: kv("k", `"`), want: []byte(`k="\""`)},
- {in: kv("k", `=`), want: []byte(`k="="`)},
- {in: kv("k", `\`), want: []byte(`k=\`)},
- {in: kv("k", `=\`), want: []byte(`k="=\\"`)},
- {in: kv("k", `\"`), want: []byte(`k="\\\""`)},
- {in: kv("k1", "v1", "k2", "v2"), want: []byte("k1=v1 k2=v2")},
- {in: kv("k1", "v1", "k2", [2]int{}), want: []byte("k1=v1 k2=\"unsupported value type\"")},
- {in: kv([2]int{}, "v1", "k2", "v2"), want: []byte("k2=v2")},
- {in: kv("k", time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC)), want: []byte("k=2009-11-10T23:00:00Z")},
- {in: kv("k", errorMarshaler{}), want: []byte("k=\"error marshaling value of type logfmt_test.errorMarshaler: marshal error\"")},
- {in: kv("k", decimalMarshaler{5, 9}), want: []byte("k=5.9")},
- {in: kv("k", (*decimalMarshaler)(nil)), want: []byte("k=null")},
- {in: kv("k", decimalStringer{5, 9}), want: []byte("k=5.9")},
- {in: kv("k", (*decimalStringer)(nil)), want: []byte("k=null")},
- {in: kv("k", marshalerStringer{5, 9}), want: []byte("k=5.9")},
- {in: kv("k", (*marshalerStringer)(nil)), want: []byte("k=null")},
- {in: kv(one, "v"), want: []byte("1=v")},
- {in: kv(ptr, "v"), want: []byte("1=v")},
- {in: kv((*marshalerStringer)(nil), "v"), err: logfmt.ErrNilKey},
- {in: kv(decimalMarshaler{5, 9}, "v"), want: []byte("5.9=v")},
- {in: kv((*decimalMarshaler)(nil), "v"), err: logfmt.ErrNilKey},
- {in: kv(decimalStringer{5, 9}, "v"), want: []byte("5.9=v")},
- {in: kv((*decimalStringer)(nil), "v"), err: logfmt.ErrNilKey},
- {in: kv(marshalerStringer{5, 9}, "v"), want: []byte("5.9=v")},
- }
-
- for _, d := range data {
- got, err := logfmt.MarshalKeyvals(d.in...)
- if err != d.err {
- t.Errorf("%#v: got error: %v, want error: %v", d.in, err, d.err)
- }
- if !reflect.DeepEqual(got, d.want) {
- t.Errorf("%#v: got '%s', want '%s'", d.in, got, d.want)
- }
- }
-}
-
-func kv(keyvals ...interface{}) []interface{} {
- return keyvals
-}
-
-type structData struct {
- A string `logfmt:"fieldA"`
- B int
-}
-
-type nilMarshaler int
-
-func (m *nilMarshaler) MarshalText() ([]byte, error) {
- if m == nil {
- return []byte("nilmarshaler"), nil
- }
- return []byte("notnilmarshaler"), nil
-}
-
-type decimalMarshaler struct {
- a, b int
-}
-
-func (t decimalMarshaler) MarshalText() ([]byte, error) {
- buf := &bytes.Buffer{}
- fmt.Fprintf(buf, "%d.%d", t.a, t.b)
- return buf.Bytes(), nil
-}
-
-type decimalStringer struct {
- a, b int
-}
-
-func (s decimalStringer) String() string {
- return fmt.Sprintf("%d.%d", s.a, s.b)
-}
-
-type marshalerStringer struct {
- a, b int
-}
-
-func (t marshalerStringer) MarshalText() ([]byte, error) {
- buf := &bytes.Buffer{}
- fmt.Fprintf(buf, "%d.%d", t.a, t.b)
- return buf.Bytes(), nil
-}
-
-func (t marshalerStringer) String() string {
- return fmt.Sprint(t.a + t.b)
-}
-
-var errMarshal = errors.New("marshal error")
-
-type errorMarshaler struct{}
-
-func (errorMarshaler) MarshalText() ([]byte, error) {
- return nil, errMarshal
-}
-
-func BenchmarkEncodeKeyval(b *testing.B) {
- b.ReportAllocs()
- enc := logfmt.NewEncoder(ioutil.Discard)
- for i := 0; i < b.N; i++ {
- enc.EncodeKeyval("sk", "10")
- enc.EncodeKeyval("some-key", "a rather long string with spaces")
- }
-}
diff --git a/vendor/github.com/go-logfmt/logfmt/example_test.go b/vendor/github.com/go-logfmt/logfmt/example_test.go
deleted file mode 100644
index 829dbd567..000000000
--- a/vendor/github.com/go-logfmt/logfmt/example_test.go
+++ /dev/null
@@ -1,60 +0,0 @@
-package logfmt_test
-
-import (
- "errors"
- "fmt"
- "os"
- "strings"
- "time"
-
- "github.com/go-logfmt/logfmt"
-)
-
-func ExampleEncoder() {
- check := func(err error) {
- if err != nil {
- panic(err)
- }
- }
-
- e := logfmt.NewEncoder(os.Stdout)
-
- check(e.EncodeKeyval("id", 1))
- check(e.EncodeKeyval("dur", time.Second+time.Millisecond))
- check(e.EndRecord())
-
- check(e.EncodeKeyval("id", 1))
- check(e.EncodeKeyval("path", "/path/to/file"))
- check(e.EncodeKeyval("err", errors.New("file not found")))
- check(e.EndRecord())
-
- // Output:
- // id=1 dur=1.001s
- // id=1 path=/path/to/file err="file not found"
-}
-
-func ExampleDecoder() {
- in := `
-id=1 dur=1.001s
-id=1 path=/path/to/file err="file not found"
-`
-
- d := logfmt.NewDecoder(strings.NewReader(in))
- for d.ScanRecord() {
- for d.ScanKeyval() {
- fmt.Printf("k: %s v: %s\n", d.Key(), d.Value())
- }
- fmt.Println()
- }
- if d.Err() != nil {
- panic(d.Err())
- }
-
- // Output:
- // k: id v: 1
- // k: dur v: 1.001s
- //
- // k: id v: 1
- // k: path v: /path/to/file
- // k: err v: file not found
-}
diff --git a/vendor/github.com/gogo/protobuf/proto/all_test.go b/vendor/github.com/gogo/protobuf/proto/all_test.go
deleted file mode 100644
index b5f8709d8..000000000
--- a/vendor/github.com/gogo/protobuf/proto/all_test.go
+++ /dev/null
@@ -1,2278 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto_test
-
-import (
- "bytes"
- "encoding/json"
- "errors"
- "fmt"
- "math"
- "math/rand"
- "reflect"
- "runtime/debug"
- "strings"
- "testing"
- "time"
-
- . "github.com/gogo/protobuf/proto"
- . "github.com/gogo/protobuf/proto/testdata"
-)
-
-var globalO *Buffer
-
-func old() *Buffer {
- if globalO == nil {
- globalO = NewBuffer(nil)
- }
- globalO.Reset()
- return globalO
-}
-
-func equalbytes(b1, b2 []byte, t *testing.T) {
- if len(b1) != len(b2) {
- t.Errorf("wrong lengths: 2*%d != %d", len(b1), len(b2))
- return
- }
- for i := 0; i < len(b1); i++ {
- if b1[i] != b2[i] {
- t.Errorf("bad byte[%d]:%x %x: %s %s", i, b1[i], b2[i], b1, b2)
- }
- }
-}
-
-func initGoTestField() *GoTestField {
- f := new(GoTestField)
- f.Label = String("label")
- f.Type = String("type")
- return f
-}
-
-// These are all structurally equivalent but the tag numbers differ.
-// (It's remarkable that required, optional, and repeated all have
-// 8 letters.)
-func initGoTest_RequiredGroup() *GoTest_RequiredGroup {
- return &GoTest_RequiredGroup{
- RequiredField: String("required"),
- }
-}
-
-func initGoTest_OptionalGroup() *GoTest_OptionalGroup {
- return &GoTest_OptionalGroup{
- RequiredField: String("optional"),
- }
-}
-
-func initGoTest_RepeatedGroup() *GoTest_RepeatedGroup {
- return &GoTest_RepeatedGroup{
- RequiredField: String("repeated"),
- }
-}
-
-func initGoTest(setdefaults bool) *GoTest {
- pb := new(GoTest)
- if setdefaults {
- pb.F_BoolDefaulted = Bool(Default_GoTest_F_BoolDefaulted)
- pb.F_Int32Defaulted = Int32(Default_GoTest_F_Int32Defaulted)
- pb.F_Int64Defaulted = Int64(Default_GoTest_F_Int64Defaulted)
- pb.F_Fixed32Defaulted = Uint32(Default_GoTest_F_Fixed32Defaulted)
- pb.F_Fixed64Defaulted = Uint64(Default_GoTest_F_Fixed64Defaulted)
- pb.F_Uint32Defaulted = Uint32(Default_GoTest_F_Uint32Defaulted)
- pb.F_Uint64Defaulted = Uint64(Default_GoTest_F_Uint64Defaulted)
- pb.F_FloatDefaulted = Float32(Default_GoTest_F_FloatDefaulted)
- pb.F_DoubleDefaulted = Float64(Default_GoTest_F_DoubleDefaulted)
- pb.F_StringDefaulted = String(Default_GoTest_F_StringDefaulted)
- pb.F_BytesDefaulted = Default_GoTest_F_BytesDefaulted
- pb.F_Sint32Defaulted = Int32(Default_GoTest_F_Sint32Defaulted)
- pb.F_Sint64Defaulted = Int64(Default_GoTest_F_Sint64Defaulted)
- }
-
- pb.Kind = GoTest_TIME.Enum()
- pb.RequiredField = initGoTestField()
- pb.F_BoolRequired = Bool(true)
- pb.F_Int32Required = Int32(3)
- pb.F_Int64Required = Int64(6)
- pb.F_Fixed32Required = Uint32(32)
- pb.F_Fixed64Required = Uint64(64)
- pb.F_Uint32Required = Uint32(3232)
- pb.F_Uint64Required = Uint64(6464)
- pb.F_FloatRequired = Float32(3232)
- pb.F_DoubleRequired = Float64(6464)
- pb.F_StringRequired = String("string")
- pb.F_BytesRequired = []byte("bytes")
- pb.F_Sint32Required = Int32(-32)
- pb.F_Sint64Required = Int64(-64)
- pb.Requiredgroup = initGoTest_RequiredGroup()
-
- return pb
-}
-
-func fail(msg string, b *bytes.Buffer, s string, t *testing.T) {
- data := b.Bytes()
- ld := len(data)
- ls := len(s) / 2
-
- fmt.Printf("fail %s ld=%d ls=%d\n", msg, ld, ls)
-
- // find the interesting spot - n
- n := ls
- if ld < ls {
- n = ld
- }
- j := 0
- for i := 0; i < n; i++ {
- bs := hex(s[j])*16 + hex(s[j+1])
- j += 2
- if data[i] == bs {
- continue
- }
- n = i
- break
- }
- l := n - 10
- if l < 0 {
- l = 0
- }
- h := n + 10
-
- // find the interesting spot - n
- fmt.Printf("is[%d]:", l)
- for i := l; i < h; i++ {
- if i >= ld {
- fmt.Printf(" --")
- continue
- }
- fmt.Printf(" %.2x", data[i])
- }
- fmt.Printf("\n")
-
- fmt.Printf("sb[%d]:", l)
- for i := l; i < h; i++ {
- if i >= ls {
- fmt.Printf(" --")
- continue
- }
- bs := hex(s[j])*16 + hex(s[j+1])
- j += 2
- fmt.Printf(" %.2x", bs)
- }
- fmt.Printf("\n")
-
- t.Fail()
-
- // t.Errorf("%s: \ngood: %s\nbad: %x", msg, s, b.Bytes())
- // Print the output in a partially-decoded format; can
- // be helpful when updating the test. It produces the output
- // that is pasted, with minor edits, into the argument to verify().
- // data := b.Bytes()
- // nesting := 0
- // for b.Len() > 0 {
- // start := len(data) - b.Len()
- // var u uint64
- // u, err := DecodeVarint(b)
- // if err != nil {
- // fmt.Printf("decode error on varint:", err)
- // return
- // }
- // wire := u & 0x7
- // tag := u >> 3
- // switch wire {
- // case WireVarint:
- // v, err := DecodeVarint(b)
- // if err != nil {
- // fmt.Printf("decode error on varint:", err)
- // return
- // }
- // fmt.Printf("\t\t\"%x\" // field %d, encoding %d, value %d\n",
- // data[start:len(data)-b.Len()], tag, wire, v)
- // case WireFixed32:
- // v, err := DecodeFixed32(b)
- // if err != nil {
- // fmt.Printf("decode error on fixed32:", err)
- // return
- // }
- // fmt.Printf("\t\t\"%x\" // field %d, encoding %d, value %d\n",
- // data[start:len(data)-b.Len()], tag, wire, v)
- // case WireFixed64:
- // v, err := DecodeFixed64(b)
- // if err != nil {
- // fmt.Printf("decode error on fixed64:", err)
- // return
- // }
- // fmt.Printf("\t\t\"%x\" // field %d, encoding %d, value %d\n",
- // data[start:len(data)-b.Len()], tag, wire, v)
- // case WireBytes:
- // nb, err := DecodeVarint(b)
- // if err != nil {
- // fmt.Printf("decode error on bytes:", err)
- // return
- // }
- // after_tag := len(data) - b.Len()
- // str := make([]byte, nb)
- // _, err = b.Read(str)
- // if err != nil {
- // fmt.Printf("decode error on bytes:", err)
- // return
- // }
- // fmt.Printf("\t\t\"%x\" \"%x\" // field %d, encoding %d (FIELD)\n",
- // data[start:after_tag], str, tag, wire)
- // case WireStartGroup:
- // nesting++
- // fmt.Printf("\t\t\"%x\"\t\t// start group field %d level %d\n",
- // data[start:len(data)-b.Len()], tag, nesting)
- // case WireEndGroup:
- // fmt.Printf("\t\t\"%x\"\t\t// end group field %d level %d\n",
- // data[start:len(data)-b.Len()], tag, nesting)
- // nesting--
- // default:
- // fmt.Printf("unrecognized wire type %d\n", wire)
- // return
- // }
- // }
-}
-
-func hex(c uint8) uint8 {
- if '0' <= c && c <= '9' {
- return c - '0'
- }
- if 'a' <= c && c <= 'f' {
- return 10 + c - 'a'
- }
- if 'A' <= c && c <= 'F' {
- return 10 + c - 'A'
- }
- return 0
-}
-
-func equal(b []byte, s string, t *testing.T) bool {
- if 2*len(b) != len(s) {
- // fail(fmt.Sprintf("wrong lengths: 2*%d != %d", len(b), len(s)), b, s, t)
- fmt.Printf("wrong lengths: 2*%d != %d\n", len(b), len(s))
- return false
- }
- for i, j := 0, 0; i < len(b); i, j = i+1, j+2 {
- x := hex(s[j])*16 + hex(s[j+1])
- if b[i] != x {
- // fail(fmt.Sprintf("bad byte[%d]:%x %x", i, b[i], x), b, s, t)
- fmt.Printf("bad byte[%d]:%x %x", i, b[i], x)
- return false
- }
- }
- return true
-}
-
-func overify(t *testing.T, pb *GoTest, expected string) {
- o := old()
- err := o.Marshal(pb)
- if err != nil {
- fmt.Printf("overify marshal-1 err = %v", err)
- o.DebugPrint("", o.Bytes())
- t.Fatalf("expected = %s", expected)
- }
- if !equal(o.Bytes(), expected, t) {
- o.DebugPrint("overify neq 1", o.Bytes())
- t.Fatalf("expected = %s", expected)
- }
-
- // Now test Unmarshal by recreating the original buffer.
- pbd := new(GoTest)
- err = o.Unmarshal(pbd)
- if err != nil {
- t.Fatalf("overify unmarshal err = %v", err)
- o.DebugPrint("", o.Bytes())
- t.Fatalf("string = %s", expected)
- }
- o.Reset()
- err = o.Marshal(pbd)
- if err != nil {
- t.Errorf("overify marshal-2 err = %v", err)
- o.DebugPrint("", o.Bytes())
- t.Fatalf("string = %s", expected)
- }
- if !equal(o.Bytes(), expected, t) {
- o.DebugPrint("overify neq 2", o.Bytes())
- t.Fatalf("string = %s", expected)
- }
-}
-
-// Simple tests for numeric encode/decode primitives (varint, etc.)
-func TestNumericPrimitives(t *testing.T) {
- for i := uint64(0); i < 1e6; i += 111 {
- o := old()
- if o.EncodeVarint(i) != nil {
- t.Error("EncodeVarint")
- break
- }
- x, e := o.DecodeVarint()
- if e != nil {
- t.Fatal("DecodeVarint")
- }
- if x != i {
- t.Fatal("varint decode fail:", i, x)
- }
-
- o = old()
- if o.EncodeFixed32(i) != nil {
- t.Fatal("encFixed32")
- }
- x, e = o.DecodeFixed32()
- if e != nil {
- t.Fatal("decFixed32")
- }
- if x != i {
- t.Fatal("fixed32 decode fail:", i, x)
- }
-
- o = old()
- if o.EncodeFixed64(i*1234567) != nil {
- t.Error("encFixed64")
- break
- }
- x, e = o.DecodeFixed64()
- if e != nil {
- t.Error("decFixed64")
- break
- }
- if x != i*1234567 {
- t.Error("fixed64 decode fail:", i*1234567, x)
- break
- }
-
- o = old()
- i32 := int32(i - 12345)
- if o.EncodeZigzag32(uint64(i32)) != nil {
- t.Fatal("EncodeZigzag32")
- }
- x, e = o.DecodeZigzag32()
- if e != nil {
- t.Fatal("DecodeZigzag32")
- }
- if x != uint64(uint32(i32)) {
- t.Fatal("zigzag32 decode fail:", i32, x)
- }
-
- o = old()
- i64 := int64(i - 12345)
- if o.EncodeZigzag64(uint64(i64)) != nil {
- t.Fatal("EncodeZigzag64")
- }
- x, e = o.DecodeZigzag64()
- if e != nil {
- t.Fatal("DecodeZigzag64")
- }
- if x != uint64(i64) {
- t.Fatal("zigzag64 decode fail:", i64, x)
- }
- }
-}
-
-// fakeMarshaler is a simple struct implementing Marshaler and Message interfaces.
-type fakeMarshaler struct {
- b []byte
- err error
-}
-
-func (f *fakeMarshaler) Marshal() ([]byte, error) { return f.b, f.err }
-func (f *fakeMarshaler) String() string { return fmt.Sprintf("Bytes: %v Error: %v", f.b, f.err) }
-func (f *fakeMarshaler) ProtoMessage() {}
-func (f *fakeMarshaler) Reset() {}
-
-type msgWithFakeMarshaler struct {
- M *fakeMarshaler `protobuf:"bytes,1,opt,name=fake"`
-}
-
-func (m *msgWithFakeMarshaler) String() string { return CompactTextString(m) }
-func (m *msgWithFakeMarshaler) ProtoMessage() {}
-func (m *msgWithFakeMarshaler) Reset() {}
-
-// Simple tests for proto messages that implement the Marshaler interface.
-func TestMarshalerEncoding(t *testing.T) {
- tests := []struct {
- name string
- m Message
- want []byte
- errType reflect.Type
- }{
- {
- name: "Marshaler that fails",
- m: &fakeMarshaler{
- err: errors.New("some marshal err"),
- b: []byte{5, 6, 7},
- },
- // Since the Marshal method returned bytes, they should be written to the
- // buffer. (For efficiency, we assume that Marshal implementations are
- // always correct w.r.t. RequiredNotSetError and output.)
- want: []byte{5, 6, 7},
- errType: reflect.TypeOf(errors.New("some marshal err")),
- },
- {
- name: "Marshaler that fails with RequiredNotSetError",
- m: &msgWithFakeMarshaler{
- M: &fakeMarshaler{
- err: &RequiredNotSetError{},
- b: []byte{5, 6, 7},
- },
- },
- // Since there's an error that can be continued after,
- // the buffer should be written.
- want: []byte{
- 10, 3, // for &msgWithFakeMarshaler
- 5, 6, 7, // for &fakeMarshaler
- },
- errType: reflect.TypeOf(&RequiredNotSetError{}),
- },
- {
- name: "Marshaler that succeeds",
- m: &fakeMarshaler{
- b: []byte{0, 1, 2, 3, 4, 127, 255},
- },
- want: []byte{0, 1, 2, 3, 4, 127, 255},
- },
- }
- for _, test := range tests {
- b := NewBuffer(nil)
- err := b.Marshal(test.m)
- if reflect.TypeOf(err) != test.errType {
- t.Errorf("%s: got err %T(%v) wanted %T", test.name, err, err, test.errType)
- }
- if !reflect.DeepEqual(test.want, b.Bytes()) {
- t.Errorf("%s: got bytes %v wanted %v", test.name, b.Bytes(), test.want)
- }
- if size := Size(test.m); size != len(b.Bytes()) {
- t.Errorf("%s: Size(_) = %v, but marshaled to %v bytes", test.name, size, len(b.Bytes()))
- }
-
- m, mErr := Marshal(test.m)
- if !bytes.Equal(b.Bytes(), m) {
- t.Errorf("%s: Marshal returned %v, but (*Buffer).Marshal wrote %v", test.name, m, b.Bytes())
- }
- if !reflect.DeepEqual(err, mErr) {
- t.Errorf("%s: Marshal err = %q, but (*Buffer).Marshal returned %q",
- test.name, fmt.Sprint(mErr), fmt.Sprint(err))
- }
- }
-}
-
-// Simple tests for bytes
-func TestBytesPrimitives(t *testing.T) {
- o := old()
- bytes := []byte{'n', 'o', 'w', ' ', 'i', 's', ' ', 't', 'h', 'e', ' ', 't', 'i', 'm', 'e'}
- if o.EncodeRawBytes(bytes) != nil {
- t.Error("EncodeRawBytes")
- }
- decb, e := o.DecodeRawBytes(false)
- if e != nil {
- t.Error("DecodeRawBytes")
- }
- equalbytes(bytes, decb, t)
-}
-
-// Simple tests for strings
-func TestStringPrimitives(t *testing.T) {
- o := old()
- s := "now is the time"
- if o.EncodeStringBytes(s) != nil {
- t.Error("enc_string")
- }
- decs, e := o.DecodeStringBytes()
- if e != nil {
- t.Error("dec_string")
- }
- if s != decs {
- t.Error("string encode/decode fail:", s, decs)
- }
-}
-
-// Do we catch the "required bit not set" case?
-func TestRequiredBit(t *testing.T) {
- o := old()
- pb := new(GoTest)
- err := o.Marshal(pb)
- if err == nil {
- t.Error("did not catch missing required fields")
- } else if strings.Index(err.Error(), "Kind") < 0 {
- t.Error("wrong error type:", err)
- }
-}
-
-// Check that all fields are nil.
-// Clearly silly, and a residue from a more interesting test with an earlier,
-// different initialization property, but it once caught a compiler bug so
-// it lives.
-func checkInitialized(pb *GoTest, t *testing.T) {
- if pb.F_BoolDefaulted != nil {
- t.Error("New or Reset did not set boolean:", *pb.F_BoolDefaulted)
- }
- if pb.F_Int32Defaulted != nil {
- t.Error("New or Reset did not set int32:", *pb.F_Int32Defaulted)
- }
- if pb.F_Int64Defaulted != nil {
- t.Error("New or Reset did not set int64:", *pb.F_Int64Defaulted)
- }
- if pb.F_Fixed32Defaulted != nil {
- t.Error("New or Reset did not set fixed32:", *pb.F_Fixed32Defaulted)
- }
- if pb.F_Fixed64Defaulted != nil {
- t.Error("New or Reset did not set fixed64:", *pb.F_Fixed64Defaulted)
- }
- if pb.F_Uint32Defaulted != nil {
- t.Error("New or Reset did not set uint32:", *pb.F_Uint32Defaulted)
- }
- if pb.F_Uint64Defaulted != nil {
- t.Error("New or Reset did not set uint64:", *pb.F_Uint64Defaulted)
- }
- if pb.F_FloatDefaulted != nil {
- t.Error("New or Reset did not set float:", *pb.F_FloatDefaulted)
- }
- if pb.F_DoubleDefaulted != nil {
- t.Error("New or Reset did not set double:", *pb.F_DoubleDefaulted)
- }
- if pb.F_StringDefaulted != nil {
- t.Error("New or Reset did not set string:", *pb.F_StringDefaulted)
- }
- if pb.F_BytesDefaulted != nil {
- t.Error("New or Reset did not set bytes:", string(pb.F_BytesDefaulted))
- }
- if pb.F_Sint32Defaulted != nil {
- t.Error("New or Reset did not set int32:", *pb.F_Sint32Defaulted)
- }
- if pb.F_Sint64Defaulted != nil {
- t.Error("New or Reset did not set int64:", *pb.F_Sint64Defaulted)
- }
-}
-
-// Does Reset() reset?
-func TestReset(t *testing.T) {
- pb := initGoTest(true)
- // muck with some values
- pb.F_BoolDefaulted = Bool(false)
- pb.F_Int32Defaulted = Int32(237)
- pb.F_Int64Defaulted = Int64(12346)
- pb.F_Fixed32Defaulted = Uint32(32000)
- pb.F_Fixed64Defaulted = Uint64(666)
- pb.F_Uint32Defaulted = Uint32(323232)
- pb.F_Uint64Defaulted = nil
- pb.F_FloatDefaulted = nil
- pb.F_DoubleDefaulted = Float64(0)
- pb.F_StringDefaulted = String("gotcha")
- pb.F_BytesDefaulted = []byte("asdfasdf")
- pb.F_Sint32Defaulted = Int32(123)
- pb.F_Sint64Defaulted = Int64(789)
- pb.Reset()
- checkInitialized(pb, t)
-}
-
-// All required fields set, no defaults provided.
-func TestEncodeDecode1(t *testing.T) {
- pb := initGoTest(false)
- overify(t, pb,
- "0807"+ // field 1, encoding 0, value 7
- "220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField)
- "5001"+ // field 10, encoding 0, value 1
- "5803"+ // field 11, encoding 0, value 3
- "6006"+ // field 12, encoding 0, value 6
- "6d20000000"+ // field 13, encoding 5, value 0x20
- "714000000000000000"+ // field 14, encoding 1, value 0x40
- "78a019"+ // field 15, encoding 0, value 0xca0 = 3232
- "8001c032"+ // field 16, encoding 0, value 0x1940 = 6464
- "8d0100004a45"+ // field 17, encoding 5, value 3232.0
- "9101000000000040b940"+ // field 18, encoding 1, value 6464.0
- "9a0106"+"737472696e67"+ // field 19, encoding 2, string "string"
- "b304"+ // field 70, encoding 3, start group
- "ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required"
- "b404"+ // field 70, encoding 4, end group
- "aa0605"+"6279746573"+ // field 101, encoding 2, string "bytes"
- "b0063f"+ // field 102, encoding 0, 0x3f zigzag32
- "b8067f") // field 103, encoding 0, 0x7f zigzag64
-}
-
-// All required fields set, defaults provided.
-func TestEncodeDecode2(t *testing.T) {
- pb := initGoTest(true)
- overify(t, pb,
- "0807"+ // field 1, encoding 0, value 7
- "220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField)
- "5001"+ // field 10, encoding 0, value 1
- "5803"+ // field 11, encoding 0, value 3
- "6006"+ // field 12, encoding 0, value 6
- "6d20000000"+ // field 13, encoding 5, value 32
- "714000000000000000"+ // field 14, encoding 1, value 64
- "78a019"+ // field 15, encoding 0, value 3232
- "8001c032"+ // field 16, encoding 0, value 6464
- "8d0100004a45"+ // field 17, encoding 5, value 3232.0
- "9101000000000040b940"+ // field 18, encoding 1, value 6464.0
- "9a0106"+"737472696e67"+ // field 19, encoding 2 string "string"
- "c00201"+ // field 40, encoding 0, value 1
- "c80220"+ // field 41, encoding 0, value 32
- "d00240"+ // field 42, encoding 0, value 64
- "dd0240010000"+ // field 43, encoding 5, value 320
- "e1028002000000000000"+ // field 44, encoding 1, value 640
- "e8028019"+ // field 45, encoding 0, value 3200
- "f0028032"+ // field 46, encoding 0, value 6400
- "fd02e0659948"+ // field 47, encoding 5, value 314159.0
- "81030000000050971041"+ // field 48, encoding 1, value 271828.0
- "8a0310"+"68656c6c6f2c2022776f726c6421220a"+ // field 49, encoding 2 string "hello, \"world!\"\n"
- "b304"+ // start group field 70 level 1
- "ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required"
- "b404"+ // end group field 70 level 1
- "aa0605"+"6279746573"+ // field 101, encoding 2 string "bytes"
- "b0063f"+ // field 102, encoding 0, 0x3f zigzag32
- "b8067f"+ // field 103, encoding 0, 0x7f zigzag64
- "8a1907"+"4269676e6f7365"+ // field 401, encoding 2, string "Bignose"
- "90193f"+ // field 402, encoding 0, value 63
- "98197f") // field 403, encoding 0, value 127
-
-}
-
-// All default fields set to their default value by hand
-func TestEncodeDecode3(t *testing.T) {
- pb := initGoTest(false)
- pb.F_BoolDefaulted = Bool(true)
- pb.F_Int32Defaulted = Int32(32)
- pb.F_Int64Defaulted = Int64(64)
- pb.F_Fixed32Defaulted = Uint32(320)
- pb.F_Fixed64Defaulted = Uint64(640)
- pb.F_Uint32Defaulted = Uint32(3200)
- pb.F_Uint64Defaulted = Uint64(6400)
- pb.F_FloatDefaulted = Float32(314159)
- pb.F_DoubleDefaulted = Float64(271828)
- pb.F_StringDefaulted = String("hello, \"world!\"\n")
- pb.F_BytesDefaulted = []byte("Bignose")
- pb.F_Sint32Defaulted = Int32(-32)
- pb.F_Sint64Defaulted = Int64(-64)
-
- overify(t, pb,
- "0807"+ // field 1, encoding 0, value 7
- "220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField)
- "5001"+ // field 10, encoding 0, value 1
- "5803"+ // field 11, encoding 0, value 3
- "6006"+ // field 12, encoding 0, value 6
- "6d20000000"+ // field 13, encoding 5, value 32
- "714000000000000000"+ // field 14, encoding 1, value 64
- "78a019"+ // field 15, encoding 0, value 3232
- "8001c032"+ // field 16, encoding 0, value 6464
- "8d0100004a45"+ // field 17, encoding 5, value 3232.0
- "9101000000000040b940"+ // field 18, encoding 1, value 6464.0
- "9a0106"+"737472696e67"+ // field 19, encoding 2 string "string"
- "c00201"+ // field 40, encoding 0, value 1
- "c80220"+ // field 41, encoding 0, value 32
- "d00240"+ // field 42, encoding 0, value 64
- "dd0240010000"+ // field 43, encoding 5, value 320
- "e1028002000000000000"+ // field 44, encoding 1, value 640
- "e8028019"+ // field 45, encoding 0, value 3200
- "f0028032"+ // field 46, encoding 0, value 6400
- "fd02e0659948"+ // field 47, encoding 5, value 314159.0
- "81030000000050971041"+ // field 48, encoding 1, value 271828.0
- "8a0310"+"68656c6c6f2c2022776f726c6421220a"+ // field 49, encoding 2 string "hello, \"world!\"\n"
- "b304"+ // start group field 70 level 1
- "ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required"
- "b404"+ // end group field 70 level 1
- "aa0605"+"6279746573"+ // field 101, encoding 2 string "bytes"
- "b0063f"+ // field 102, encoding 0, 0x3f zigzag32
- "b8067f"+ // field 103, encoding 0, 0x7f zigzag64
- "8a1907"+"4269676e6f7365"+ // field 401, encoding 2, string "Bignose"
- "90193f"+ // field 402, encoding 0, value 63
- "98197f") // field 403, encoding 0, value 127
-
-}
-
-// All required fields set, defaults provided, all non-defaulted optional fields have values.
-func TestEncodeDecode4(t *testing.T) {
- pb := initGoTest(true)
- pb.Table = String("hello")
- pb.Param = Int32(7)
- pb.OptionalField = initGoTestField()
- pb.F_BoolOptional = Bool(true)
- pb.F_Int32Optional = Int32(32)
- pb.F_Int64Optional = Int64(64)
- pb.F_Fixed32Optional = Uint32(3232)
- pb.F_Fixed64Optional = Uint64(6464)
- pb.F_Uint32Optional = Uint32(323232)
- pb.F_Uint64Optional = Uint64(646464)
- pb.F_FloatOptional = Float32(32.)
- pb.F_DoubleOptional = Float64(64.)
- pb.F_StringOptional = String("hello")
- pb.F_BytesOptional = []byte("Bignose")
- pb.F_Sint32Optional = Int32(-32)
- pb.F_Sint64Optional = Int64(-64)
- pb.Optionalgroup = initGoTest_OptionalGroup()
-
- overify(t, pb,
- "0807"+ // field 1, encoding 0, value 7
- "1205"+"68656c6c6f"+ // field 2, encoding 2, string "hello"
- "1807"+ // field 3, encoding 0, value 7
- "220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField)
- "320d"+"0a056c6162656c120474797065"+ // field 6, encoding 2 (GoTestField)
- "5001"+ // field 10, encoding 0, value 1
- "5803"+ // field 11, encoding 0, value 3
- "6006"+ // field 12, encoding 0, value 6
- "6d20000000"+ // field 13, encoding 5, value 32
- "714000000000000000"+ // field 14, encoding 1, value 64
- "78a019"+ // field 15, encoding 0, value 3232
- "8001c032"+ // field 16, encoding 0, value 6464
- "8d0100004a45"+ // field 17, encoding 5, value 3232.0
- "9101000000000040b940"+ // field 18, encoding 1, value 6464.0
- "9a0106"+"737472696e67"+ // field 19, encoding 2 string "string"
- "f00101"+ // field 30, encoding 0, value 1
- "f80120"+ // field 31, encoding 0, value 32
- "800240"+ // field 32, encoding 0, value 64
- "8d02a00c0000"+ // field 33, encoding 5, value 3232
- "91024019000000000000"+ // field 34, encoding 1, value 6464
- "9802a0dd13"+ // field 35, encoding 0, value 323232
- "a002c0ba27"+ // field 36, encoding 0, value 646464
- "ad0200000042"+ // field 37, encoding 5, value 32.0
- "b1020000000000005040"+ // field 38, encoding 1, value 64.0
- "ba0205"+"68656c6c6f"+ // field 39, encoding 2, string "hello"
- "c00201"+ // field 40, encoding 0, value 1
- "c80220"+ // field 41, encoding 0, value 32
- "d00240"+ // field 42, encoding 0, value 64
- "dd0240010000"+ // field 43, encoding 5, value 320
- "e1028002000000000000"+ // field 44, encoding 1, value 640
- "e8028019"+ // field 45, encoding 0, value 3200
- "f0028032"+ // field 46, encoding 0, value 6400
- "fd02e0659948"+ // field 47, encoding 5, value 314159.0
- "81030000000050971041"+ // field 48, encoding 1, value 271828.0
- "8a0310"+"68656c6c6f2c2022776f726c6421220a"+ // field 49, encoding 2 string "hello, \"world!\"\n"
- "b304"+ // start group field 70 level 1
- "ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required"
- "b404"+ // end group field 70 level 1
- "d305"+ // start group field 90 level 1
- "da0508"+"6f7074696f6e616c"+ // field 91, encoding 2, string "optional"
- "d405"+ // end group field 90 level 1
- "aa0605"+"6279746573"+ // field 101, encoding 2 string "bytes"
- "b0063f"+ // field 102, encoding 0, 0x3f zigzag32
- "b8067f"+ // field 103, encoding 0, 0x7f zigzag64
- "ea1207"+"4269676e6f7365"+ // field 301, encoding 2, string "Bignose"
- "f0123f"+ // field 302, encoding 0, value 63
- "f8127f"+ // field 303, encoding 0, value 127
- "8a1907"+"4269676e6f7365"+ // field 401, encoding 2, string "Bignose"
- "90193f"+ // field 402, encoding 0, value 63
- "98197f") // field 403, encoding 0, value 127
-
-}
-
-// All required fields set, defaults provided, all repeated fields given two values.
-func TestEncodeDecode5(t *testing.T) {
- pb := initGoTest(true)
- pb.RepeatedField = []*GoTestField{initGoTestField(), initGoTestField()}
- pb.F_BoolRepeated = []bool{false, true}
- pb.F_Int32Repeated = []int32{32, 33}
- pb.F_Int64Repeated = []int64{64, 65}
- pb.F_Fixed32Repeated = []uint32{3232, 3333}
- pb.F_Fixed64Repeated = []uint64{6464, 6565}
- pb.F_Uint32Repeated = []uint32{323232, 333333}
- pb.F_Uint64Repeated = []uint64{646464, 656565}
- pb.F_FloatRepeated = []float32{32., 33.}
- pb.F_DoubleRepeated = []float64{64., 65.}
- pb.F_StringRepeated = []string{"hello", "sailor"}
- pb.F_BytesRepeated = [][]byte{[]byte("big"), []byte("nose")}
- pb.F_Sint32Repeated = []int32{32, -32}
- pb.F_Sint64Repeated = []int64{64, -64}
- pb.Repeatedgroup = []*GoTest_RepeatedGroup{initGoTest_RepeatedGroup(), initGoTest_RepeatedGroup()}
-
- overify(t, pb,
- "0807"+ // field 1, encoding 0, value 7
- "220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField)
- "2a0d"+"0a056c6162656c120474797065"+ // field 5, encoding 2 (GoTestField)
- "2a0d"+"0a056c6162656c120474797065"+ // field 5, encoding 2 (GoTestField)
- "5001"+ // field 10, encoding 0, value 1
- "5803"+ // field 11, encoding 0, value 3
- "6006"+ // field 12, encoding 0, value 6
- "6d20000000"+ // field 13, encoding 5, value 32
- "714000000000000000"+ // field 14, encoding 1, value 64
- "78a019"+ // field 15, encoding 0, value 3232
- "8001c032"+ // field 16, encoding 0, value 6464
- "8d0100004a45"+ // field 17, encoding 5, value 3232.0
- "9101000000000040b940"+ // field 18, encoding 1, value 6464.0
- "9a0106"+"737472696e67"+ // field 19, encoding 2 string "string"
- "a00100"+ // field 20, encoding 0, value 0
- "a00101"+ // field 20, encoding 0, value 1
- "a80120"+ // field 21, encoding 0, value 32
- "a80121"+ // field 21, encoding 0, value 33
- "b00140"+ // field 22, encoding 0, value 64
- "b00141"+ // field 22, encoding 0, value 65
- "bd01a00c0000"+ // field 23, encoding 5, value 3232
- "bd01050d0000"+ // field 23, encoding 5, value 3333
- "c1014019000000000000"+ // field 24, encoding 1, value 6464
- "c101a519000000000000"+ // field 24, encoding 1, value 6565
- "c801a0dd13"+ // field 25, encoding 0, value 323232
- "c80195ac14"+ // field 25, encoding 0, value 333333
- "d001c0ba27"+ // field 26, encoding 0, value 646464
- "d001b58928"+ // field 26, encoding 0, value 656565
- "dd0100000042"+ // field 27, encoding 5, value 32.0
- "dd0100000442"+ // field 27, encoding 5, value 33.0
- "e1010000000000005040"+ // field 28, encoding 1, value 64.0
- "e1010000000000405040"+ // field 28, encoding 1, value 65.0
- "ea0105"+"68656c6c6f"+ // field 29, encoding 2, string "hello"
- "ea0106"+"7361696c6f72"+ // field 29, encoding 2, string "sailor"
- "c00201"+ // field 40, encoding 0, value 1
- "c80220"+ // field 41, encoding 0, value 32
- "d00240"+ // field 42, encoding 0, value 64
- "dd0240010000"+ // field 43, encoding 5, value 320
- "e1028002000000000000"+ // field 44, encoding 1, value 640
- "e8028019"+ // field 45, encoding 0, value 3200
- "f0028032"+ // field 46, encoding 0, value 6400
- "fd02e0659948"+ // field 47, encoding 5, value 314159.0
- "81030000000050971041"+ // field 48, encoding 1, value 271828.0
- "8a0310"+"68656c6c6f2c2022776f726c6421220a"+ // field 49, encoding 2 string "hello, \"world!\"\n"
- "b304"+ // start group field 70 level 1
- "ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required"
- "b404"+ // end group field 70 level 1
- "8305"+ // start group field 80 level 1
- "8a0508"+"7265706561746564"+ // field 81, encoding 2, string "repeated"
- "8405"+ // end group field 80 level 1
- "8305"+ // start group field 80 level 1
- "8a0508"+"7265706561746564"+ // field 81, encoding 2, string "repeated"
- "8405"+ // end group field 80 level 1
- "aa0605"+"6279746573"+ // field 101, encoding 2 string "bytes"
- "b0063f"+ // field 102, encoding 0, 0x3f zigzag32
- "b8067f"+ // field 103, encoding 0, 0x7f zigzag64
- "ca0c03"+"626967"+ // field 201, encoding 2, string "big"
- "ca0c04"+"6e6f7365"+ // field 201, encoding 2, string "nose"
- "d00c40"+ // field 202, encoding 0, value 32
- "d00c3f"+ // field 202, encoding 0, value -32
- "d80c8001"+ // field 203, encoding 0, value 64
- "d80c7f"+ // field 203, encoding 0, value -64
- "8a1907"+"4269676e6f7365"+ // field 401, encoding 2, string "Bignose"
- "90193f"+ // field 402, encoding 0, value 63
- "98197f") // field 403, encoding 0, value 127
-
-}
-
-// All required fields set, all packed repeated fields given two values.
-func TestEncodeDecode6(t *testing.T) {
- pb := initGoTest(false)
- pb.F_BoolRepeatedPacked = []bool{false, true}
- pb.F_Int32RepeatedPacked = []int32{32, 33}
- pb.F_Int64RepeatedPacked = []int64{64, 65}
- pb.F_Fixed32RepeatedPacked = []uint32{3232, 3333}
- pb.F_Fixed64RepeatedPacked = []uint64{6464, 6565}
- pb.F_Uint32RepeatedPacked = []uint32{323232, 333333}
- pb.F_Uint64RepeatedPacked = []uint64{646464, 656565}
- pb.F_FloatRepeatedPacked = []float32{32., 33.}
- pb.F_DoubleRepeatedPacked = []float64{64., 65.}
- pb.F_Sint32RepeatedPacked = []int32{32, -32}
- pb.F_Sint64RepeatedPacked = []int64{64, -64}
-
- overify(t, pb,
- "0807"+ // field 1, encoding 0, value 7
- "220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField)
- "5001"+ // field 10, encoding 0, value 1
- "5803"+ // field 11, encoding 0, value 3
- "6006"+ // field 12, encoding 0, value 6
- "6d20000000"+ // field 13, encoding 5, value 32
- "714000000000000000"+ // field 14, encoding 1, value 64
- "78a019"+ // field 15, encoding 0, value 3232
- "8001c032"+ // field 16, encoding 0, value 6464
- "8d0100004a45"+ // field 17, encoding 5, value 3232.0
- "9101000000000040b940"+ // field 18, encoding 1, value 6464.0
- "9a0106"+"737472696e67"+ // field 19, encoding 2 string "string"
- "9203020001"+ // field 50, encoding 2, 2 bytes, value 0, value 1
- "9a03022021"+ // field 51, encoding 2, 2 bytes, value 32, value 33
- "a203024041"+ // field 52, encoding 2, 2 bytes, value 64, value 65
- "aa0308"+ // field 53, encoding 2, 8 bytes
- "a00c0000050d0000"+ // value 3232, value 3333
- "b20310"+ // field 54, encoding 2, 16 bytes
- "4019000000000000a519000000000000"+ // value 6464, value 6565
- "ba0306"+ // field 55, encoding 2, 6 bytes
- "a0dd1395ac14"+ // value 323232, value 333333
- "c20306"+ // field 56, encoding 2, 6 bytes
- "c0ba27b58928"+ // value 646464, value 656565
- "ca0308"+ // field 57, encoding 2, 8 bytes
- "0000004200000442"+ // value 32.0, value 33.0
- "d20310"+ // field 58, encoding 2, 16 bytes
- "00000000000050400000000000405040"+ // value 64.0, value 65.0
- "b304"+ // start group field 70 level 1
- "ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required"
- "b404"+ // end group field 70 level 1
- "aa0605"+"6279746573"+ // field 101, encoding 2 string "bytes"
- "b0063f"+ // field 102, encoding 0, 0x3f zigzag32
- "b8067f"+ // field 103, encoding 0, 0x7f zigzag64
- "b21f02"+ // field 502, encoding 2, 2 bytes
- "403f"+ // value 32, value -32
- "ba1f03"+ // field 503, encoding 2, 3 bytes
- "80017f") // value 64, value -64
-}
-
-// Test that we can encode empty bytes fields.
-func TestEncodeDecodeBytes1(t *testing.T) {
- pb := initGoTest(false)
-
- // Create our bytes
- pb.F_BytesRequired = []byte{}
- pb.F_BytesRepeated = [][]byte{{}}
- pb.F_BytesOptional = []byte{}
-
- d, err := Marshal(pb)
- if err != nil {
- t.Error(err)
- }
-
- pbd := new(GoTest)
- if err := Unmarshal(d, pbd); err != nil {
- t.Error(err)
- }
-
- if pbd.F_BytesRequired == nil || len(pbd.F_BytesRequired) != 0 {
- t.Error("required empty bytes field is incorrect")
- }
- if pbd.F_BytesRepeated == nil || len(pbd.F_BytesRepeated) == 1 && pbd.F_BytesRepeated[0] == nil {
- t.Error("repeated empty bytes field is incorrect")
- }
- if pbd.F_BytesOptional == nil || len(pbd.F_BytesOptional) != 0 {
- t.Error("optional empty bytes field is incorrect")
- }
-}
-
-// Test that we encode nil-valued fields of a repeated bytes field correctly.
-// Since entries in a repeated field cannot be nil, nil must mean empty value.
-func TestEncodeDecodeBytes2(t *testing.T) {
- pb := initGoTest(false)
-
- // Create our bytes
- pb.F_BytesRepeated = [][]byte{nil}
-
- d, err := Marshal(pb)
- if err != nil {
- t.Error(err)
- }
-
- pbd := new(GoTest)
- if err := Unmarshal(d, pbd); err != nil {
- t.Error(err)
- }
-
- if len(pbd.F_BytesRepeated) != 1 || pbd.F_BytesRepeated[0] == nil {
- t.Error("Unexpected value for repeated bytes field")
- }
-}
-
-// All required fields set, defaults provided, all repeated fields given two values.
-func TestSkippingUnrecognizedFields(t *testing.T) {
- o := old()
- pb := initGoTestField()
-
- // Marshal it normally.
- o.Marshal(pb)
-
- // Now new a GoSkipTest record.
- skip := &GoSkipTest{
- SkipInt32: Int32(32),
- SkipFixed32: Uint32(3232),
- SkipFixed64: Uint64(6464),
- SkipString: String("skipper"),
- Skipgroup: &GoSkipTest_SkipGroup{
- GroupInt32: Int32(75),
- GroupString: String("wxyz"),
- },
- }
-
- // Marshal it into same buffer.
- o.Marshal(skip)
-
- pbd := new(GoTestField)
- o.Unmarshal(pbd)
-
- // The __unrecognized field should be a marshaling of GoSkipTest
- skipd := new(GoSkipTest)
-
- o.SetBuf(pbd.XXX_unrecognized)
- o.Unmarshal(skipd)
-
- if *skipd.SkipInt32 != *skip.SkipInt32 {
- t.Error("skip int32", skipd.SkipInt32)
- }
- if *skipd.SkipFixed32 != *skip.SkipFixed32 {
- t.Error("skip fixed32", skipd.SkipFixed32)
- }
- if *skipd.SkipFixed64 != *skip.SkipFixed64 {
- t.Error("skip fixed64", skipd.SkipFixed64)
- }
- if *skipd.SkipString != *skip.SkipString {
- t.Error("skip string", *skipd.SkipString)
- }
- if *skipd.Skipgroup.GroupInt32 != *skip.Skipgroup.GroupInt32 {
- t.Error("skip group int32", skipd.Skipgroup.GroupInt32)
- }
- if *skipd.Skipgroup.GroupString != *skip.Skipgroup.GroupString {
- t.Error("skip group string", *skipd.Skipgroup.GroupString)
- }
-}
-
-// Check that unrecognized fields of a submessage are preserved.
-func TestSubmessageUnrecognizedFields(t *testing.T) {
- nm := &NewMessage{
- Nested: &NewMessage_Nested{
- Name: String("Nigel"),
- FoodGroup: String("carbs"),
- },
- }
- b, err := Marshal(nm)
- if err != nil {
- t.Fatalf("Marshal of NewMessage: %v", err)
- }
-
- // Unmarshal into an OldMessage.
- om := new(OldMessage)
- if err = Unmarshal(b, om); err != nil {
- t.Fatalf("Unmarshal to OldMessage: %v", err)
- }
- exp := &OldMessage{
- Nested: &OldMessage_Nested{
- Name: String("Nigel"),
- // normal protocol buffer users should not do this
- XXX_unrecognized: []byte("\x12\x05carbs"),
- },
- }
- if !Equal(om, exp) {
- t.Errorf("om = %v, want %v", om, exp)
- }
-
- // Clone the OldMessage.
- om = Clone(om).(*OldMessage)
- if !Equal(om, exp) {
- t.Errorf("Clone(om) = %v, want %v", om, exp)
- }
-
- // Marshal the OldMessage, then unmarshal it into an empty NewMessage.
- if b, err = Marshal(om); err != nil {
- t.Fatalf("Marshal of OldMessage: %v", err)
- }
- t.Logf("Marshal(%v) -> %q", om, b)
- nm2 := new(NewMessage)
- if err := Unmarshal(b, nm2); err != nil {
- t.Fatalf("Unmarshal to NewMessage: %v", err)
- }
- if !Equal(nm, nm2) {
- t.Errorf("NewMessage round-trip: %v => %v", nm, nm2)
- }
-}
-
-// Check that an int32 field can be upgraded to an int64 field.
-func TestNegativeInt32(t *testing.T) {
- om := &OldMessage{
- Num: Int32(-1),
- }
- b, err := Marshal(om)
- if err != nil {
- t.Fatalf("Marshal of OldMessage: %v", err)
- }
-
- // Check the size. It should be 11 bytes;
- // 1 for the field/wire type, and 10 for the negative number.
- if len(b) != 11 {
- t.Errorf("%v marshaled as %q, wanted 11 bytes", om, b)
- }
-
- // Unmarshal into a NewMessage.
- nm := new(NewMessage)
- if err := Unmarshal(b, nm); err != nil {
- t.Fatalf("Unmarshal to NewMessage: %v", err)
- }
- want := &NewMessage{
- Num: Int64(-1),
- }
- if !Equal(nm, want) {
- t.Errorf("nm = %v, want %v", nm, want)
- }
-}
-
-// Check that we can grow an array (repeated field) to have many elements.
-// This test doesn't depend only on our encoding; for variety, it makes sure
-// we create, encode, and decode the correct contents explicitly. It's therefore
-// a bit messier.
-// This test also uses (and hence tests) the Marshal/Unmarshal functions
-// instead of the methods.
-func TestBigRepeated(t *testing.T) {
- pb := initGoTest(true)
-
- // Create the arrays
- const N = 50 // Internally the library starts much smaller.
- pb.Repeatedgroup = make([]*GoTest_RepeatedGroup, N)
- pb.F_Sint64Repeated = make([]int64, N)
- pb.F_Sint32Repeated = make([]int32, N)
- pb.F_BytesRepeated = make([][]byte, N)
- pb.F_StringRepeated = make([]string, N)
- pb.F_DoubleRepeated = make([]float64, N)
- pb.F_FloatRepeated = make([]float32, N)
- pb.F_Uint64Repeated = make([]uint64, N)
- pb.F_Uint32Repeated = make([]uint32, N)
- pb.F_Fixed64Repeated = make([]uint64, N)
- pb.F_Fixed32Repeated = make([]uint32, N)
- pb.F_Int64Repeated = make([]int64, N)
- pb.F_Int32Repeated = make([]int32, N)
- pb.F_BoolRepeated = make([]bool, N)
- pb.RepeatedField = make([]*GoTestField, N)
-
- // Fill in the arrays with checkable values.
- igtf := initGoTestField()
- igtrg := initGoTest_RepeatedGroup()
- for i := 0; i < N; i++ {
- pb.Repeatedgroup[i] = igtrg
- pb.F_Sint64Repeated[i] = int64(i)
- pb.F_Sint32Repeated[i] = int32(i)
- s := fmt.Sprint(i)
- pb.F_BytesRepeated[i] = []byte(s)
- pb.F_StringRepeated[i] = s
- pb.F_DoubleRepeated[i] = float64(i)
- pb.F_FloatRepeated[i] = float32(i)
- pb.F_Uint64Repeated[i] = uint64(i)
- pb.F_Uint32Repeated[i] = uint32(i)
- pb.F_Fixed64Repeated[i] = uint64(i)
- pb.F_Fixed32Repeated[i] = uint32(i)
- pb.F_Int64Repeated[i] = int64(i)
- pb.F_Int32Repeated[i] = int32(i)
- pb.F_BoolRepeated[i] = i%2 == 0
- pb.RepeatedField[i] = igtf
- }
-
- // Marshal.
- buf, _ := Marshal(pb)
-
- // Now test Unmarshal by recreating the original buffer.
- pbd := new(GoTest)
- Unmarshal(buf, pbd)
-
- // Check the checkable values
- for i := uint64(0); i < N; i++ {
- if pbd.Repeatedgroup[i] == nil { // TODO: more checking?
- t.Error("pbd.Repeatedgroup bad")
- }
- var x uint64
- x = uint64(pbd.F_Sint64Repeated[i])
- if x != i {
- t.Error("pbd.F_Sint64Repeated bad", x, i)
- }
- x = uint64(pbd.F_Sint32Repeated[i])
- if x != i {
- t.Error("pbd.F_Sint32Repeated bad", x, i)
- }
- s := fmt.Sprint(i)
- equalbytes(pbd.F_BytesRepeated[i], []byte(s), t)
- if pbd.F_StringRepeated[i] != s {
- t.Error("pbd.F_Sint32Repeated bad", pbd.F_StringRepeated[i], i)
- }
- x = uint64(pbd.F_DoubleRepeated[i])
- if x != i {
- t.Error("pbd.F_DoubleRepeated bad", x, i)
- }
- x = uint64(pbd.F_FloatRepeated[i])
- if x != i {
- t.Error("pbd.F_FloatRepeated bad", x, i)
- }
- x = pbd.F_Uint64Repeated[i]
- if x != i {
- t.Error("pbd.F_Uint64Repeated bad", x, i)
- }
- x = uint64(pbd.F_Uint32Repeated[i])
- if x != i {
- t.Error("pbd.F_Uint32Repeated bad", x, i)
- }
- x = pbd.F_Fixed64Repeated[i]
- if x != i {
- t.Error("pbd.F_Fixed64Repeated bad", x, i)
- }
- x = uint64(pbd.F_Fixed32Repeated[i])
- if x != i {
- t.Error("pbd.F_Fixed32Repeated bad", x, i)
- }
- x = uint64(pbd.F_Int64Repeated[i])
- if x != i {
- t.Error("pbd.F_Int64Repeated bad", x, i)
- }
- x = uint64(pbd.F_Int32Repeated[i])
- if x != i {
- t.Error("pbd.F_Int32Repeated bad", x, i)
- }
- if pbd.F_BoolRepeated[i] != (i%2 == 0) {
- t.Error("pbd.F_BoolRepeated bad", x, i)
- }
- if pbd.RepeatedField[i] == nil { // TODO: more checking?
- t.Error("pbd.RepeatedField bad")
- }
- }
-}
-
-// Verify we give a useful message when decoding to the wrong structure type.
-func TestTypeMismatch(t *testing.T) {
- pb1 := initGoTest(true)
-
- // Marshal
- o := old()
- o.Marshal(pb1)
-
- // Now Unmarshal it to the wrong type.
- pb2 := initGoTestField()
- err := o.Unmarshal(pb2)
- if err == nil {
- t.Error("expected error, got no error")
- } else if !strings.Contains(err.Error(), "bad wiretype") {
- t.Error("expected bad wiretype error, got", err)
- }
-}
-
-func encodeDecode(t *testing.T, in, out Message, msg string) {
- buf, err := Marshal(in)
- if err != nil {
- t.Fatalf("failed marshaling %v: %v", msg, err)
- }
- if err := Unmarshal(buf, out); err != nil {
- t.Fatalf("failed unmarshaling %v: %v", msg, err)
- }
-}
-
-func TestPackedNonPackedDecoderSwitching(t *testing.T) {
- np, p := new(NonPackedTest), new(PackedTest)
-
- // non-packed -> packed
- np.A = []int32{0, 1, 1, 2, 3, 5}
- encodeDecode(t, np, p, "non-packed -> packed")
- if !reflect.DeepEqual(np.A, p.B) {
- t.Errorf("failed non-packed -> packed; np.A=%+v, p.B=%+v", np.A, p.B)
- }
-
- // packed -> non-packed
- np.Reset()
- p.B = []int32{3, 1, 4, 1, 5, 9}
- encodeDecode(t, p, np, "packed -> non-packed")
- if !reflect.DeepEqual(p.B, np.A) {
- t.Errorf("failed packed -> non-packed; p.B=%+v, np.A=%+v", p.B, np.A)
- }
-}
-
-func TestProto1RepeatedGroup(t *testing.T) {
- pb := &MessageList{
- Message: []*MessageList_Message{
- {
- Name: String("blah"),
- Count: Int32(7),
- },
- // NOTE: pb.Message[1] is a nil
- nil,
- },
- }
-
- o := old()
- err := o.Marshal(pb)
- if err == nil || !strings.Contains(err.Error(), "repeated field Message has nil") {
- t.Fatalf("unexpected or no error when marshaling: %v", err)
- }
-}
-
-// Test that enums work. Checks for a bug introduced by making enums
-// named types instead of int32: newInt32FromUint64 would crash with
-// a type mismatch in reflect.PointTo.
-func TestEnum(t *testing.T) {
- pb := new(GoEnum)
- pb.Foo = FOO_FOO1.Enum()
- o := old()
- if err := o.Marshal(pb); err != nil {
- t.Fatal("error encoding enum:", err)
- }
- pb1 := new(GoEnum)
- if err := o.Unmarshal(pb1); err != nil {
- t.Fatal("error decoding enum:", err)
- }
- if *pb1.Foo != FOO_FOO1 {
- t.Error("expected 7 but got ", *pb1.Foo)
- }
-}
-
-// Enum types have String methods. Check that enum fields can be printed.
-// We don't care what the value actually is, just as long as it doesn't crash.
-func TestPrintingNilEnumFields(t *testing.T) {
- pb := new(GoEnum)
- _ = fmt.Sprintf("%+v", pb)
-}
-
-// Verify that absent required fields cause Marshal/Unmarshal to return errors.
-func TestRequiredFieldEnforcement(t *testing.T) {
- pb := new(GoTestField)
- _, err := Marshal(pb)
- if err == nil {
- t.Error("marshal: expected error, got nil")
- } else if _, ok := err.(*RequiredNotSetError); !ok || !strings.Contains(err.Error(), "Label") {
- t.Errorf("marshal: bad error type: %v", err)
- }
-
- // A slightly sneaky, yet valid, proto. It encodes the same required field twice,
- // so simply counting the required fields is insufficient.
- // field 1, encoding 2, value "hi"
- buf := []byte("\x0A\x02hi\x0A\x02hi")
- err = Unmarshal(buf, pb)
- if err == nil {
- t.Error("unmarshal: expected error, got nil")
- } else if _, ok := err.(*RequiredNotSetError); !ok || !strings.Contains(err.Error(), "{Unknown}") {
- t.Errorf("unmarshal: bad error type: %v", err)
- }
-}
-
-// Verify that absent required fields in groups cause Marshal/Unmarshal to return errors.
-func TestRequiredFieldEnforcementGroups(t *testing.T) {
- pb := &GoTestRequiredGroupField{Group: &GoTestRequiredGroupField_Group{}}
- if _, err := Marshal(pb); err == nil {
- t.Error("marshal: expected error, got nil")
- } else if _, ok := err.(*RequiredNotSetError); !ok || !strings.Contains(err.Error(), "Group.Field") {
- t.Errorf("marshal: bad error type: %v", err)
- }
-
- buf := []byte{11, 12}
- if err := Unmarshal(buf, pb); err == nil {
- t.Error("unmarshal: expected error, got nil")
- } else if _, ok := err.(*RequiredNotSetError); !ok || !strings.Contains(err.Error(), "Group.{Unknown}") {
- t.Errorf("unmarshal: bad error type: %v", err)
- }
-}
-
-func TestTypedNilMarshal(t *testing.T) {
- // A typed nil should return ErrNil and not crash.
- {
- var m *GoEnum
- if _, err := Marshal(m); err != ErrNil {
- t.Errorf("Marshal(%#v): got %v, want ErrNil", m, err)
- }
- }
-
- {
- m := &Communique{Union: &Communique_Msg{Msg: nil}}
- if _, err := Marshal(m); err == nil || err == ErrNil {
- t.Errorf("Marshal(%#v): got %v, want errOneofHasNil", m, err)
- }
- }
-}
-
-// A type that implements the Marshaler interface, but is not nillable.
-type nonNillableInt uint64
-
-func (nni nonNillableInt) Marshal() ([]byte, error) {
- return EncodeVarint(uint64(nni)), nil
-}
-
-type NNIMessage struct {
- nni nonNillableInt
-}
-
-func (*NNIMessage) Reset() {}
-func (*NNIMessage) String() string { return "" }
-func (*NNIMessage) ProtoMessage() {}
-
-// A type that implements the Marshaler interface and is nillable.
-type nillableMessage struct {
- x uint64
-}
-
-func (nm *nillableMessage) Marshal() ([]byte, error) {
- return EncodeVarint(nm.x), nil
-}
-
-type NMMessage struct {
- nm *nillableMessage
-}
-
-func (*NMMessage) Reset() {}
-func (*NMMessage) String() string { return "" }
-func (*NMMessage) ProtoMessage() {}
-
-// Verify a type that uses the Marshaler interface, but has a nil pointer.
-func TestNilMarshaler(t *testing.T) {
- // Try a struct with a Marshaler field that is nil.
- // It should be directly marshable.
- nmm := new(NMMessage)
- if _, err := Marshal(nmm); err != nil {
- t.Error("unexpected error marshaling nmm: ", err)
- }
-
- // Try a struct with a Marshaler field that is not nillable.
- nnim := new(NNIMessage)
- nnim.nni = 7
- var _ Marshaler = nnim.nni // verify it is truly a Marshaler
- if _, err := Marshal(nnim); err != nil {
- t.Error("unexpected error marshaling nnim: ", err)
- }
-}
-
-func TestAllSetDefaults(t *testing.T) {
- // Exercise SetDefaults with all scalar field types.
- m := &Defaults{
- // NaN != NaN, so override that here.
- F_Nan: Float32(1.7),
- }
- expected := &Defaults{
- F_Bool: Bool(true),
- F_Int32: Int32(32),
- F_Int64: Int64(64),
- F_Fixed32: Uint32(320),
- F_Fixed64: Uint64(640),
- F_Uint32: Uint32(3200),
- F_Uint64: Uint64(6400),
- F_Float: Float32(314159),
- F_Double: Float64(271828),
- F_String: String(`hello, "world!"` + "\n"),
- F_Bytes: []byte("Bignose"),
- F_Sint32: Int32(-32),
- F_Sint64: Int64(-64),
- F_Enum: Defaults_GREEN.Enum(),
- F_Pinf: Float32(float32(math.Inf(1))),
- F_Ninf: Float32(float32(math.Inf(-1))),
- F_Nan: Float32(1.7),
- StrZero: String(""),
- }
- SetDefaults(m)
- if !Equal(m, expected) {
- t.Errorf("SetDefaults failed\n got %v\nwant %v", m, expected)
- }
-}
-
-func TestSetDefaultsWithSetField(t *testing.T) {
- // Check that a set value is not overridden.
- m := &Defaults{
- F_Int32: Int32(12),
- }
- SetDefaults(m)
- if v := m.GetF_Int32(); v != 12 {
- t.Errorf("m.FInt32 = %v, want 12", v)
- }
-}
-
-func TestSetDefaultsWithSubMessage(t *testing.T) {
- m := &OtherMessage{
- Key: Int64(123),
- Inner: &InnerMessage{
- Host: String("gopher"),
- },
- }
- expected := &OtherMessage{
- Key: Int64(123),
- Inner: &InnerMessage{
- Host: String("gopher"),
- Port: Int32(4000),
- },
- }
- SetDefaults(m)
- if !Equal(m, expected) {
- t.Errorf("\n got %v\nwant %v", m, expected)
- }
-}
-
-func TestSetDefaultsWithRepeatedSubMessage(t *testing.T) {
- m := &MyMessage{
- RepInner: []*InnerMessage{{}},
- }
- expected := &MyMessage{
- RepInner: []*InnerMessage{{
- Port: Int32(4000),
- }},
- }
- SetDefaults(m)
- if !Equal(m, expected) {
- t.Errorf("\n got %v\nwant %v", m, expected)
- }
-}
-
-func TestSetDefaultWithRepeatedNonMessage(t *testing.T) {
- m := &MyMessage{
- Pet: []string{"turtle", "wombat"},
- }
- expected := Clone(m)
- SetDefaults(m)
- if !Equal(m, expected) {
- t.Errorf("\n got %v\nwant %v", m, expected)
- }
-}
-
-func TestMaximumTagNumber(t *testing.T) {
- m := &MaxTag{
- LastField: String("natural goat essence"),
- }
- buf, err := Marshal(m)
- if err != nil {
- t.Fatalf("proto.Marshal failed: %v", err)
- }
- m2 := new(MaxTag)
- if err := Unmarshal(buf, m2); err != nil {
- t.Fatalf("proto.Unmarshal failed: %v", err)
- }
- if got, want := m2.GetLastField(), *m.LastField; got != want {
- t.Errorf("got %q, want %q", got, want)
- }
-}
-
-func TestJSON(t *testing.T) {
- m := &MyMessage{
- Count: Int32(4),
- Pet: []string{"bunny", "kitty"},
- Inner: &InnerMessage{
- Host: String("cauchy"),
- },
- Bikeshed: MyMessage_GREEN.Enum(),
- }
- const expected = `{"count":4,"pet":["bunny","kitty"],"inner":{"host":"cauchy"},"bikeshed":1}`
-
- b, err := json.Marshal(m)
- if err != nil {
- t.Fatalf("json.Marshal failed: %v", err)
- }
- s := string(b)
- if s != expected {
- t.Errorf("got %s\nwant %s", s, expected)
- }
-
- received := new(MyMessage)
- if err := json.Unmarshal(b, received); err != nil {
- t.Fatalf("json.Unmarshal failed: %v", err)
- }
- if !Equal(received, m) {
- t.Fatalf("got %s, want %s", received, m)
- }
-
- // Test unmarshalling of JSON with symbolic enum name.
- const old = `{"count":4,"pet":["bunny","kitty"],"inner":{"host":"cauchy"},"bikeshed":"GREEN"}`
- received.Reset()
- if err := json.Unmarshal([]byte(old), received); err != nil {
- t.Fatalf("json.Unmarshal failed: %v", err)
- }
- if !Equal(received, m) {
- t.Fatalf("got %s, want %s", received, m)
- }
-}
-
-func TestBadWireType(t *testing.T) {
- b := []byte{7<<3 | 6} // field 7, wire type 6
- pb := new(OtherMessage)
- if err := Unmarshal(b, pb); err == nil {
- t.Errorf("Unmarshal did not fail")
- } else if !strings.Contains(err.Error(), "unknown wire type") {
- t.Errorf("wrong error: %v", err)
- }
-}
-
-func TestBytesWithInvalidLength(t *testing.T) {
- // If a byte sequence has an invalid (negative) length, Unmarshal should not panic.
- b := []byte{2<<3 | WireBytes, 0xff, 0xff, 0xff, 0xff, 0xff, 0}
- Unmarshal(b, new(MyMessage))
-}
-
-func TestLengthOverflow(t *testing.T) {
- // Overflowing a length should not panic.
- b := []byte{2<<3 | WireBytes, 1, 1, 3<<3 | WireBytes, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x01}
- Unmarshal(b, new(MyMessage))
-}
-
-func TestVarintOverflow(t *testing.T) {
- // Overflowing a 64-bit length should not be allowed.
- b := []byte{1<<3 | WireVarint, 0x01, 3<<3 | WireBytes, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x01}
- if err := Unmarshal(b, new(MyMessage)); err == nil {
- t.Fatalf("Overflowed uint64 length without error")
- }
-}
-
-func TestUnmarshalFuzz(t *testing.T) {
- const N = 1000
- seed := time.Now().UnixNano()
- t.Logf("RNG seed is %d", seed)
- rng := rand.New(rand.NewSource(seed))
- buf := make([]byte, 20)
- for i := 0; i < N; i++ {
- for j := range buf {
- buf[j] = byte(rng.Intn(256))
- }
- fuzzUnmarshal(t, buf)
- }
-}
-
-func TestMergeMessages(t *testing.T) {
- pb := &MessageList{Message: []*MessageList_Message{{Name: String("x"), Count: Int32(1)}}}
- data, err := Marshal(pb)
- if err != nil {
- t.Fatalf("Marshal: %v", err)
- }
-
- pb1 := new(MessageList)
- if err := Unmarshal(data, pb1); err != nil {
- t.Fatalf("first Unmarshal: %v", err)
- }
- if err := Unmarshal(data, pb1); err != nil {
- t.Fatalf("second Unmarshal: %v", err)
- }
- if len(pb1.Message) != 1 {
- t.Errorf("two Unmarshals produced %d Messages, want 1", len(pb1.Message))
- }
-
- pb2 := new(MessageList)
- if err := UnmarshalMerge(data, pb2); err != nil {
- t.Fatalf("first UnmarshalMerge: %v", err)
- }
- if err := UnmarshalMerge(data, pb2); err != nil {
- t.Fatalf("second UnmarshalMerge: %v", err)
- }
- if len(pb2.Message) != 2 {
- t.Errorf("two UnmarshalMerges produced %d Messages, want 2", len(pb2.Message))
- }
-}
-
-func TestExtensionMarshalOrder(t *testing.T) {
- m := &MyMessage{Count: Int(123)}
- if err := SetExtension(m, E_Ext_More, &Ext{Data: String("alpha")}); err != nil {
- t.Fatalf("SetExtension: %v", err)
- }
- if err := SetExtension(m, E_Ext_Text, String("aleph")); err != nil {
- t.Fatalf("SetExtension: %v", err)
- }
- if err := SetExtension(m, E_Ext_Number, Int32(1)); err != nil {
- t.Fatalf("SetExtension: %v", err)
- }
-
- // Serialize m several times, and check we get the same bytes each time.
- var orig []byte
- for i := 0; i < 100; i++ {
- b, err := Marshal(m)
- if err != nil {
- t.Fatalf("Marshal: %v", err)
- }
- if i == 0 {
- orig = b
- continue
- }
- if !bytes.Equal(b, orig) {
- t.Errorf("Bytes differ on attempt #%d", i)
- }
- }
-}
-
-// Many extensions, because small maps might not iterate differently on each iteration.
-var exts = []*ExtensionDesc{
- E_X201,
- E_X202,
- E_X203,
- E_X204,
- E_X205,
- E_X206,
- E_X207,
- E_X208,
- E_X209,
- E_X210,
- E_X211,
- E_X212,
- E_X213,
- E_X214,
- E_X215,
- E_X216,
- E_X217,
- E_X218,
- E_X219,
- E_X220,
- E_X221,
- E_X222,
- E_X223,
- E_X224,
- E_X225,
- E_X226,
- E_X227,
- E_X228,
- E_X229,
- E_X230,
- E_X231,
- E_X232,
- E_X233,
- E_X234,
- E_X235,
- E_X236,
- E_X237,
- E_X238,
- E_X239,
- E_X240,
- E_X241,
- E_X242,
- E_X243,
- E_X244,
- E_X245,
- E_X246,
- E_X247,
- E_X248,
- E_X249,
- E_X250,
-}
-
-func TestMessageSetMarshalOrder(t *testing.T) {
- m := &MyMessageSet{}
- for _, x := range exts {
- if err := SetExtension(m, x, &Empty{}); err != nil {
- t.Fatalf("SetExtension: %v", err)
- }
- }
-
- buf, err := Marshal(m)
- if err != nil {
- t.Fatalf("Marshal: %v", err)
- }
-
- // Serialize m several times, and check we get the same bytes each time.
- for i := 0; i < 10; i++ {
- b1, err := Marshal(m)
- if err != nil {
- t.Fatalf("Marshal: %v", err)
- }
- if !bytes.Equal(b1, buf) {
- t.Errorf("Bytes differ on re-Marshal #%d", i)
- }
-
- m2 := &MyMessageSet{}
- if err = Unmarshal(buf, m2); err != nil {
- t.Errorf("Unmarshal: %v", err)
- }
- b2, err := Marshal(m2)
- if err != nil {
- t.Errorf("re-Marshal: %v", err)
- }
- if !bytes.Equal(b2, buf) {
- t.Errorf("Bytes differ on round-trip #%d", i)
- }
- }
-}
-
-func TestUnmarshalMergesMessages(t *testing.T) {
- // If a nested message occurs twice in the input,
- // the fields should be merged when decoding.
- a := &OtherMessage{
- Key: Int64(123),
- Inner: &InnerMessage{
- Host: String("polhode"),
- Port: Int32(1234),
- },
- }
- aData, err := Marshal(a)
- if err != nil {
- t.Fatalf("Marshal(a): %v", err)
- }
- b := &OtherMessage{
- Weight: Float32(1.2),
- Inner: &InnerMessage{
- Host: String("herpolhode"),
- Connected: Bool(true),
- },
- }
- bData, err := Marshal(b)
- if err != nil {
- t.Fatalf("Marshal(b): %v", err)
- }
- want := &OtherMessage{
- Key: Int64(123),
- Weight: Float32(1.2),
- Inner: &InnerMessage{
- Host: String("herpolhode"),
- Port: Int32(1234),
- Connected: Bool(true),
- },
- }
- got := new(OtherMessage)
- if err := Unmarshal(append(aData, bData...), got); err != nil {
- t.Fatalf("Unmarshal: %v", err)
- }
- if !Equal(got, want) {
- t.Errorf("\n got %v\nwant %v", got, want)
- }
-}
-
-func TestEncodingSizes(t *testing.T) {
- tests := []struct {
- m Message
- n int
- }{
- {&Defaults{F_Int32: Int32(math.MaxInt32)}, 6},
- {&Defaults{F_Int32: Int32(math.MinInt32)}, 11},
- {&Defaults{F_Uint32: Uint32(uint32(math.MaxInt32) + 1)}, 6},
- {&Defaults{F_Uint32: Uint32(math.MaxUint32)}, 6},
- }
- for _, test := range tests {
- b, err := Marshal(test.m)
- if err != nil {
- t.Errorf("Marshal(%v): %v", test.m, err)
- continue
- }
- if len(b) != test.n {
- t.Errorf("Marshal(%v) yielded %d bytes, want %d bytes", test.m, len(b), test.n)
- }
- }
-}
-
-func TestRequiredNotSetError(t *testing.T) {
- pb := initGoTest(false)
- pb.RequiredField.Label = nil
- pb.F_Int32Required = nil
- pb.F_Int64Required = nil
-
- expected := "0807" + // field 1, encoding 0, value 7
- "2206" + "120474797065" + // field 4, encoding 2 (GoTestField)
- "5001" + // field 10, encoding 0, value 1
- "6d20000000" + // field 13, encoding 5, value 0x20
- "714000000000000000" + // field 14, encoding 1, value 0x40
- "78a019" + // field 15, encoding 0, value 0xca0 = 3232
- "8001c032" + // field 16, encoding 0, value 0x1940 = 6464
- "8d0100004a45" + // field 17, encoding 5, value 3232.0
- "9101000000000040b940" + // field 18, encoding 1, value 6464.0
- "9a0106" + "737472696e67" + // field 19, encoding 2, string "string"
- "b304" + // field 70, encoding 3, start group
- "ba0408" + "7265717569726564" + // field 71, encoding 2, string "required"
- "b404" + // field 70, encoding 4, end group
- "aa0605" + "6279746573" + // field 101, encoding 2, string "bytes"
- "b0063f" + // field 102, encoding 0, 0x3f zigzag32
- "b8067f" // field 103, encoding 0, 0x7f zigzag64
-
- o := old()
- mbytes, err := Marshal(pb)
- if _, ok := err.(*RequiredNotSetError); !ok {
- fmt.Printf("marshal-1 err = %v, want *RequiredNotSetError", err)
- o.DebugPrint("", mbytes)
- t.Fatalf("expected = %s", expected)
- }
- if strings.Index(err.Error(), "RequiredField.Label") < 0 {
- t.Errorf("marshal-1 wrong err msg: %v", err)
- }
- if !equal(mbytes, expected, t) {
- o.DebugPrint("neq 1", mbytes)
- t.Fatalf("expected = %s", expected)
- }
-
- // Now test Unmarshal by recreating the original buffer.
- pbd := new(GoTest)
- err = Unmarshal(mbytes, pbd)
- if _, ok := err.(*RequiredNotSetError); !ok {
- t.Fatalf("unmarshal err = %v, want *RequiredNotSetError", err)
- o.DebugPrint("", mbytes)
- t.Fatalf("string = %s", expected)
- }
- if strings.Index(err.Error(), "RequiredField.{Unknown}") < 0 {
- t.Errorf("unmarshal wrong err msg: %v", err)
- }
- mbytes, err = Marshal(pbd)
- if _, ok := err.(*RequiredNotSetError); !ok {
- t.Errorf("marshal-2 err = %v, want *RequiredNotSetError", err)
- o.DebugPrint("", mbytes)
- t.Fatalf("string = %s", expected)
- }
- if strings.Index(err.Error(), "RequiredField.Label") < 0 {
- t.Errorf("marshal-2 wrong err msg: %v", err)
- }
- if !equal(mbytes, expected, t) {
- o.DebugPrint("neq 2", mbytes)
- t.Fatalf("string = %s", expected)
- }
-}
-
-func fuzzUnmarshal(t *testing.T, data []byte) {
- defer func() {
- if e := recover(); e != nil {
- t.Errorf("These bytes caused a panic: %+v", data)
- t.Logf("Stack:\n%s", debug.Stack())
- t.FailNow()
- }
- }()
-
- pb := new(MyMessage)
- Unmarshal(data, pb)
-}
-
-func TestMapFieldMarshal(t *testing.T) {
- m := &MessageWithMap{
- NameMapping: map[int32]string{
- 1: "Rob",
- 4: "Ian",
- 8: "Dave",
- },
- }
- b, err := Marshal(m)
- if err != nil {
- t.Fatalf("Marshal: %v", err)
- }
-
- // b should be the concatenation of these three byte sequences in some order.
- parts := []string{
- "\n\a\b\x01\x12\x03Rob",
- "\n\a\b\x04\x12\x03Ian",
- "\n\b\b\x08\x12\x04Dave",
- }
- ok := false
- for i := range parts {
- for j := range parts {
- if j == i {
- continue
- }
- for k := range parts {
- if k == i || k == j {
- continue
- }
- try := parts[i] + parts[j] + parts[k]
- if bytes.Equal(b, []byte(try)) {
- ok = true
- break
- }
- }
- }
- }
- if !ok {
- t.Fatalf("Incorrect Marshal output.\n got %q\nwant %q (or a permutation of that)", b, parts[0]+parts[1]+parts[2])
- }
- t.Logf("FYI b: %q", b)
-
- (new(Buffer)).DebugPrint("Dump of b", b)
-}
-
-func TestMapFieldRoundTrips(t *testing.T) {
- m := &MessageWithMap{
- NameMapping: map[int32]string{
- 1: "Rob",
- 4: "Ian",
- 8: "Dave",
- },
- MsgMapping: map[int64]*FloatingPoint{
- 0x7001: {F: Float64(2.0)},
- },
- ByteMapping: map[bool][]byte{
- false: []byte("that's not right!"),
- true: []byte("aye, 'tis true!"),
- },
- }
- b, err := Marshal(m)
- if err != nil {
- t.Fatalf("Marshal: %v", err)
- }
- t.Logf("FYI b: %q", b)
- m2 := new(MessageWithMap)
- if err := Unmarshal(b, m2); err != nil {
- t.Fatalf("Unmarshal: %v", err)
- }
- for _, pair := range [][2]interface{}{
- {m.NameMapping, m2.NameMapping},
- {m.MsgMapping, m2.MsgMapping},
- {m.ByteMapping, m2.ByteMapping},
- } {
- if !reflect.DeepEqual(pair[0], pair[1]) {
- t.Errorf("Map did not survive a round trip.\ninitial: %v\n final: %v", pair[0], pair[1])
- }
- }
-}
-
-func TestMapFieldWithNil(t *testing.T) {
- m1 := &MessageWithMap{
- MsgMapping: map[int64]*FloatingPoint{
- 1: nil,
- },
- }
- b, err := Marshal(m1)
- if err != nil {
- t.Fatalf("Marshal: %v", err)
- }
- m2 := new(MessageWithMap)
- if err := Unmarshal(b, m2); err != nil {
- t.Fatalf("Unmarshal: %v, got these bytes: %v", err, b)
- }
- if v, ok := m2.MsgMapping[1]; !ok {
- t.Error("msg_mapping[1] not present")
- } else if v != nil {
- t.Errorf("msg_mapping[1] not nil: %v", v)
- }
-}
-
-func TestMapFieldWithNilBytes(t *testing.T) {
- m1 := &MessageWithMap{
- ByteMapping: map[bool][]byte{
- false: {},
- true: nil,
- },
- }
- n := Size(m1)
- b, err := Marshal(m1)
- if err != nil {
- t.Fatalf("Marshal: %v", err)
- }
- if n != len(b) {
- t.Errorf("Size(m1) = %d; want len(Marshal(m1)) = %d", n, len(b))
- }
- m2 := new(MessageWithMap)
- if err := Unmarshal(b, m2); err != nil {
- t.Fatalf("Unmarshal: %v, got these bytes: %v", err, b)
- }
- if v, ok := m2.ByteMapping[false]; !ok {
- t.Error("byte_mapping[false] not present")
- } else if len(v) != 0 {
- t.Errorf("byte_mapping[false] not empty: %#v", v)
- }
- if v, ok := m2.ByteMapping[true]; !ok {
- t.Error("byte_mapping[true] not present")
- } else if len(v) != 0 {
- t.Errorf("byte_mapping[true] not empty: %#v", v)
- }
-}
-
-func TestDecodeMapFieldMissingKey(t *testing.T) {
- b := []byte{
- 0x0A, 0x03, // message, tag 1 (name_mapping), of length 3 bytes
- // no key
- 0x12, 0x01, 0x6D, // string value of length 1 byte, value "m"
- }
- got := &MessageWithMap{}
- err := Unmarshal(b, got)
- if err != nil {
- t.Fatalf("failed to marshal map with missing key: %v", err)
- }
- want := &MessageWithMap{NameMapping: map[int32]string{0: "m"}}
- if !Equal(got, want) {
- t.Errorf("Unmarshaled map with no key was not as expected. got: %v, want %v", got, want)
- }
-}
-
-func TestDecodeMapFieldMissingValue(t *testing.T) {
- b := []byte{
- 0x0A, 0x02, // message, tag 1 (name_mapping), of length 2 bytes
- 0x08, 0x01, // varint key, value 1
- // no value
- }
- got := &MessageWithMap{}
- err := Unmarshal(b, got)
- if err != nil {
- t.Fatalf("failed to marshal map with missing value: %v", err)
- }
- want := &MessageWithMap{NameMapping: map[int32]string{1: ""}}
- if !Equal(got, want) {
- t.Errorf("Unmarshaled map with no value was not as expected. got: %v, want %v", got, want)
- }
-}
-
-func TestOneof(t *testing.T) {
- m := &Communique{}
- b, err := Marshal(m)
- if err != nil {
- t.Fatalf("Marshal of empty message with oneof: %v", err)
- }
- if len(b) != 0 {
- t.Errorf("Marshal of empty message yielded too many bytes: %v", b)
- }
-
- m = &Communique{
- Union: &Communique_Name{Name: "Barry"},
- }
-
- // Round-trip.
- b, err = Marshal(m)
- if err != nil {
- t.Fatalf("Marshal of message with oneof: %v", err)
- }
- if len(b) != 7 { // name tag/wire (1) + name len (1) + name (5)
- t.Errorf("Incorrect marshal of message with oneof: %v", b)
- }
- m.Reset()
- if err = Unmarshal(b, m); err != nil {
- t.Fatalf("Unmarshal of message with oneof: %v", err)
- }
- if x, ok := m.Union.(*Communique_Name); !ok || x.Name != "Barry" {
- t.Errorf("After round trip, Union = %+v", m.Union)
- }
- if name := m.GetName(); name != "Barry" {
- t.Errorf("After round trip, GetName = %q, want %q", name, "Barry")
- }
-
- // Let's try with a message in the oneof.
- m.Union = &Communique_Msg{Msg: &Strings{StringField: String("deep deep string")}}
- b, err = Marshal(m)
- if err != nil {
- t.Fatalf("Marshal of message with oneof set to message: %v", err)
- }
- if len(b) != 20 { // msg tag/wire (1) + msg len (1) + msg (1 + 1 + 16)
- t.Errorf("Incorrect marshal of message with oneof set to message: %v", b)
- }
- m.Reset()
- if err := Unmarshal(b, m); err != nil {
- t.Fatalf("Unmarshal of message with oneof set to message: %v", err)
- }
- ss, ok := m.Union.(*Communique_Msg)
- if !ok || ss.Msg.GetStringField() != "deep deep string" {
- t.Errorf("After round trip with oneof set to message, Union = %+v", m.Union)
- }
-}
-
-func TestInefficientPackedBool(t *testing.T) {
- // https://github.com/golang/protobuf/issues/76
- inp := []byte{
- 0x12, 0x02, // 0x12 = 2<<3|2; 2 bytes
- // Usually a bool should take a single byte,
- // but it is permitted to be any varint.
- 0xb9, 0x30,
- }
- if err := Unmarshal(inp, new(MoreRepeated)); err != nil {
- t.Error(err)
- }
-}
-
-// Benchmarks
-
-func testMsg() *GoTest {
- pb := initGoTest(true)
- const N = 1000 // Internally the library starts much smaller.
- pb.F_Int32Repeated = make([]int32, N)
- pb.F_DoubleRepeated = make([]float64, N)
- for i := 0; i < N; i++ {
- pb.F_Int32Repeated[i] = int32(i)
- pb.F_DoubleRepeated[i] = float64(i)
- }
- return pb
-}
-
-func bytesMsg() *GoTest {
- pb := initGoTest(true)
- buf := make([]byte, 4000)
- for i := range buf {
- buf[i] = byte(i)
- }
- pb.F_BytesDefaulted = buf
- return pb
-}
-
-func benchmarkMarshal(b *testing.B, pb Message, marshal func(Message) ([]byte, error)) {
- d, _ := marshal(pb)
- b.SetBytes(int64(len(d)))
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- marshal(pb)
- }
-}
-
-func benchmarkBufferMarshal(b *testing.B, pb Message) {
- p := NewBuffer(nil)
- benchmarkMarshal(b, pb, func(pb0 Message) ([]byte, error) {
- p.Reset()
- err := p.Marshal(pb0)
- return p.Bytes(), err
- })
-}
-
-func benchmarkSize(b *testing.B, pb Message) {
- benchmarkMarshal(b, pb, func(pb0 Message) ([]byte, error) {
- Size(pb)
- return nil, nil
- })
-}
-
-func newOf(pb Message) Message {
- in := reflect.ValueOf(pb)
- if in.IsNil() {
- return pb
- }
- return reflect.New(in.Type().Elem()).Interface().(Message)
-}
-
-func benchmarkUnmarshal(b *testing.B, pb Message, unmarshal func([]byte, Message) error) {
- d, _ := Marshal(pb)
- b.SetBytes(int64(len(d)))
- pbd := newOf(pb)
-
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- unmarshal(d, pbd)
- }
-}
-
-func benchmarkBufferUnmarshal(b *testing.B, pb Message) {
- p := NewBuffer(nil)
- benchmarkUnmarshal(b, pb, func(d []byte, pb0 Message) error {
- p.SetBuf(d)
- return p.Unmarshal(pb0)
- })
-}
-
-// Benchmark{Marshal,BufferMarshal,Size,Unmarshal,BufferUnmarshal}{,Bytes}
-
-func BenchmarkMarshal(b *testing.B) {
- benchmarkMarshal(b, testMsg(), Marshal)
-}
-
-func BenchmarkBufferMarshal(b *testing.B) {
- benchmarkBufferMarshal(b, testMsg())
-}
-
-func BenchmarkSize(b *testing.B) {
- benchmarkSize(b, testMsg())
-}
-
-func BenchmarkUnmarshal(b *testing.B) {
- benchmarkUnmarshal(b, testMsg(), Unmarshal)
-}
-
-func BenchmarkBufferUnmarshal(b *testing.B) {
- benchmarkBufferUnmarshal(b, testMsg())
-}
-
-func BenchmarkMarshalBytes(b *testing.B) {
- benchmarkMarshal(b, bytesMsg(), Marshal)
-}
-
-func BenchmarkBufferMarshalBytes(b *testing.B) {
- benchmarkBufferMarshal(b, bytesMsg())
-}
-
-func BenchmarkSizeBytes(b *testing.B) {
- benchmarkSize(b, bytesMsg())
-}
-
-func BenchmarkUnmarshalBytes(b *testing.B) {
- benchmarkUnmarshal(b, bytesMsg(), Unmarshal)
-}
-
-func BenchmarkBufferUnmarshalBytes(b *testing.B) {
- benchmarkBufferUnmarshal(b, bytesMsg())
-}
-
-func BenchmarkUnmarshalUnrecognizedFields(b *testing.B) {
- b.StopTimer()
- pb := initGoTestField()
- skip := &GoSkipTest{
- SkipInt32: Int32(32),
- SkipFixed32: Uint32(3232),
- SkipFixed64: Uint64(6464),
- SkipString: String("skipper"),
- Skipgroup: &GoSkipTest_SkipGroup{
- GroupInt32: Int32(75),
- GroupString: String("wxyz"),
- },
- }
-
- pbd := new(GoTestField)
- p := NewBuffer(nil)
- p.Marshal(pb)
- p.Marshal(skip)
- p2 := NewBuffer(nil)
-
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- p2.SetBuf(p.Bytes())
- p2.Unmarshal(pbd)
- }
-}
diff --git a/vendor/github.com/gogo/protobuf/proto/any_test.go b/vendor/github.com/gogo/protobuf/proto/any_test.go
deleted file mode 100644
index f098d8287..000000000
--- a/vendor/github.com/gogo/protobuf/proto/any_test.go
+++ /dev/null
@@ -1,300 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2016 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto_test
-
-import (
- "strings"
- "testing"
-
- "github.com/gogo/protobuf/proto"
-
- pb "github.com/gogo/protobuf/proto/proto3_proto"
- testpb "github.com/gogo/protobuf/proto/testdata"
- "github.com/gogo/protobuf/types"
-)
-
-var (
- expandedMarshaler = proto.TextMarshaler{ExpandAny: true}
- expandedCompactMarshaler = proto.TextMarshaler{Compact: true, ExpandAny: true}
-)
-
-// anyEqual reports whether two messages which may be google.protobuf.Any or may
-// contain google.protobuf.Any fields are equal. We can't use proto.Equal for
-// comparison, because semantically equivalent messages may be marshaled to
-// binary in different tag order. Instead, trust that TextMarshaler with
-// ExpandAny option works and compare the text marshaling results.
-func anyEqual(got, want proto.Message) bool {
- // if messages are proto.Equal, no need to marshal.
- if proto.Equal(got, want) {
- return true
- }
- g := expandedMarshaler.Text(got)
- w := expandedMarshaler.Text(want)
- return g == w
-}
-
-type golden struct {
- m proto.Message
- t, c string
-}
-
-var goldenMessages = makeGolden()
-
-func makeGolden() []golden {
- nested := &pb.Nested{Bunny: "Monty"}
- nb, err := proto.Marshal(nested)
- if err != nil {
- panic(err)
- }
- m1 := &pb.Message{
- Name: "David",
- ResultCount: 47,
- Anything: &types.Any{TypeUrl: "type.googleapis.com/" + proto.MessageName(nested), Value: nb},
- }
- m2 := &pb.Message{
- Name: "David",
- ResultCount: 47,
- Anything: &types.Any{TypeUrl: "http://[::1]/type.googleapis.com/" + proto.MessageName(nested), Value: nb},
- }
- m3 := &pb.Message{
- Name: "David",
- ResultCount: 47,
- Anything: &types.Any{TypeUrl: `type.googleapis.com/"/` + proto.MessageName(nested), Value: nb},
- }
- m4 := &pb.Message{
- Name: "David",
- ResultCount: 47,
- Anything: &types.Any{TypeUrl: "type.googleapis.com/a/path/" + proto.MessageName(nested), Value: nb},
- }
- m5 := &types.Any{TypeUrl: "type.googleapis.com/" + proto.MessageName(nested), Value: nb}
-
- any1 := &testpb.MyMessage{Count: proto.Int32(47), Name: proto.String("David")}
- proto.SetExtension(any1, testpb.E_Ext_More, &testpb.Ext{Data: proto.String("foo")})
- proto.SetExtension(any1, testpb.E_Ext_Text, proto.String("bar"))
- any1b, err := proto.Marshal(any1)
- if err != nil {
- panic(err)
- }
- any2 := &testpb.MyMessage{Count: proto.Int32(42), Bikeshed: testpb.MyMessage_GREEN.Enum(), RepBytes: [][]byte{[]byte("roboto")}}
- proto.SetExtension(any2, testpb.E_Ext_More, &testpb.Ext{Data: proto.String("baz")})
- any2b, err := proto.Marshal(any2)
- if err != nil {
- panic(err)
- }
- m6 := &pb.Message{
- Name: "David",
- ResultCount: 47,
- Anything: &types.Any{TypeUrl: "type.googleapis.com/" + proto.MessageName(any1), Value: any1b},
- ManyThings: []*types.Any{
- {TypeUrl: "type.googleapis.com/" + proto.MessageName(any2), Value: any2b},
- {TypeUrl: "type.googleapis.com/" + proto.MessageName(any1), Value: any1b},
- },
- }
-
- const (
- m1Golden = `
-name: "David"
-result_count: 47
-anything: <
- [type.googleapis.com/proto3_proto.Nested]: <
- bunny: "Monty"
- >
->
-`
- m2Golden = `
-name: "David"
-result_count: 47
-anything: <
- ["http://[::1]/type.googleapis.com/proto3_proto.Nested"]: <
- bunny: "Monty"
- >
->
-`
- m3Golden = `
-name: "David"
-result_count: 47
-anything: <
- ["type.googleapis.com/\"/proto3_proto.Nested"]: <
- bunny: "Monty"
- >
->
-`
- m4Golden = `
-name: "David"
-result_count: 47
-anything: <
- [type.googleapis.com/a/path/proto3_proto.Nested]: <
- bunny: "Monty"
- >
->
-`
- m5Golden = `
-[type.googleapis.com/proto3_proto.Nested]: <
- bunny: "Monty"
->
-`
- m6Golden = `
-name: "David"
-result_count: 47
-anything: <
- [type.googleapis.com/testdata.MyMessage]: <
- count: 47
- name: "David"
- [testdata.Ext.more]: <
- data: "foo"
- >
- [testdata.Ext.text]: "bar"
- >
->
-many_things: <
- [type.googleapis.com/testdata.MyMessage]: <
- count: 42
- bikeshed: GREEN
- rep_bytes: "roboto"
- [testdata.Ext.more]: <
- data: "baz"
- >
- >
->
-many_things: <
- [type.googleapis.com/testdata.MyMessage]: <
- count: 47
- name: "David"
- [testdata.Ext.more]: <
- data: "foo"
- >
- [testdata.Ext.text]: "bar"
- >
->
-`
- )
- return []golden{
- {m1, strings.TrimSpace(m1Golden) + "\n", strings.TrimSpace(compact(m1Golden)) + " "},
- {m2, strings.TrimSpace(m2Golden) + "\n", strings.TrimSpace(compact(m2Golden)) + " "},
- {m3, strings.TrimSpace(m3Golden) + "\n", strings.TrimSpace(compact(m3Golden)) + " "},
- {m4, strings.TrimSpace(m4Golden) + "\n", strings.TrimSpace(compact(m4Golden)) + " "},
- {m5, strings.TrimSpace(m5Golden) + "\n", strings.TrimSpace(compact(m5Golden)) + " "},
- {m6, strings.TrimSpace(m6Golden) + "\n", strings.TrimSpace(compact(m6Golden)) + " "},
- }
-}
-
-func TestMarshalGolden(t *testing.T) {
- for _, tt := range goldenMessages {
- if got, want := expandedMarshaler.Text(tt.m), tt.t; got != want {
- t.Errorf("message %v: got:\n%s\nwant:\n%s", tt.m, got, want)
- }
- if got, want := expandedCompactMarshaler.Text(tt.m), tt.c; got != want {
- t.Errorf("message %v: got:\n`%s`\nwant:\n`%s`", tt.m, got, want)
- }
- }
-}
-
-func TestUnmarshalGolden(t *testing.T) {
- for _, tt := range goldenMessages {
- want := tt.m
- got := proto.Clone(tt.m)
- got.Reset()
- if err := proto.UnmarshalText(tt.t, got); err != nil {
- t.Errorf("failed to unmarshal\n%s\nerror: %v", tt.t, err)
- }
- if !anyEqual(got, want) {
- t.Errorf("message:\n%s\ngot:\n%s\nwant:\n%s", tt.t, got, want)
- }
- got.Reset()
- if err := proto.UnmarshalText(tt.c, got); err != nil {
- t.Errorf("failed to unmarshal\n%s\nerror: %v", tt.c, err)
- }
- if !anyEqual(got, want) {
- t.Errorf("message:\n%s\ngot:\n%s\nwant:\n%s", tt.c, got, want)
- }
- }
-}
-
-func TestMarshalUnknownAny(t *testing.T) {
- m := &pb.Message{
- Anything: &types.Any{
- TypeUrl: "foo",
- Value: []byte("bar"),
- },
- }
- want := `anything: <
- type_url: "foo"
- value: "bar"
->
-`
- got := expandedMarshaler.Text(m)
- if got != want {
- t.Errorf("got\n`%s`\nwant\n`%s`", got, want)
- }
-}
-
-func TestAmbiguousAny(t *testing.T) {
- pb := &types.Any{}
- err := proto.UnmarshalText(`
- type_url: "ttt/proto3_proto.Nested"
- value: "\n\x05Monty"
- `, pb)
- t.Logf("result: %v (error: %v)", expandedMarshaler.Text(pb), err)
- if err != nil {
- t.Errorf("failed to parse ambiguous Any message: %v", err)
- }
-}
-
-func TestUnmarshalOverwriteAny(t *testing.T) {
- pb := &types.Any{}
- err := proto.UnmarshalText(`
- [type.googleapis.com/a/path/proto3_proto.Nested]: <
- bunny: "Monty"
- >
- [type.googleapis.com/a/path/proto3_proto.Nested]: <
- bunny: "Rabbit of Caerbannog"
- >
- `, pb)
- want := `line 7: Any message unpacked multiple times, or "type_url" already set`
- if err.Error() != want {
- t.Errorf("incorrect error.\nHave: %v\nWant: %v", err.Error(), want)
- }
-}
-
-func TestUnmarshalAnyMixAndMatch(t *testing.T) {
- pb := &types.Any{}
- err := proto.UnmarshalText(`
- value: "\n\x05Monty"
- [type.googleapis.com/a/path/proto3_proto.Nested]: <
- bunny: "Rabbit of Caerbannog"
- >
- `, pb)
- want := `line 5: Any message unpacked multiple times, or "value" already set`
- if err.Error() != want {
- t.Errorf("incorrect error.\nHave: %v\nWant: %v", err.Error(), want)
- }
-}
diff --git a/vendor/github.com/gogo/protobuf/proto/clone_test.go b/vendor/github.com/gogo/protobuf/proto/clone_test.go
deleted file mode 100644
index 1a16eb554..000000000
--- a/vendor/github.com/gogo/protobuf/proto/clone_test.go
+++ /dev/null
@@ -1,300 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2011 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto_test
-
-import (
- "testing"
-
- "github.com/gogo/protobuf/proto"
-
- proto3pb "github.com/gogo/protobuf/proto/proto3_proto"
- pb "github.com/gogo/protobuf/proto/testdata"
-)
-
-var cloneTestMessage = &pb.MyMessage{
- Count: proto.Int32(42),
- Name: proto.String("Dave"),
- Pet: []string{"bunny", "kitty", "horsey"},
- Inner: &pb.InnerMessage{
- Host: proto.String("niles"),
- Port: proto.Int32(9099),
- Connected: proto.Bool(true),
- },
- Others: []*pb.OtherMessage{
- {
- Value: []byte("some bytes"),
- },
- },
- Somegroup: &pb.MyMessage_SomeGroup{
- GroupField: proto.Int32(6),
- },
- RepBytes: [][]byte{[]byte("sham"), []byte("wow")},
-}
-
-func init() {
- ext := &pb.Ext{
- Data: proto.String("extension"),
- }
- if err := proto.SetExtension(cloneTestMessage, pb.E_Ext_More, ext); err != nil {
- panic("SetExtension: " + err.Error())
- }
-}
-
-func TestClone(t *testing.T) {
- m := proto.Clone(cloneTestMessage).(*pb.MyMessage)
- if !proto.Equal(m, cloneTestMessage) {
- t.Errorf("Clone(%v) = %v", cloneTestMessage, m)
- }
-
- // Verify it was a deep copy.
- *m.Inner.Port++
- if proto.Equal(m, cloneTestMessage) {
- t.Error("Mutating clone changed the original")
- }
- // Byte fields and repeated fields should be copied.
- if &m.Pet[0] == &cloneTestMessage.Pet[0] {
- t.Error("Pet: repeated field not copied")
- }
- if &m.Others[0] == &cloneTestMessage.Others[0] {
- t.Error("Others: repeated field not copied")
- }
- if &m.Others[0].Value[0] == &cloneTestMessage.Others[0].Value[0] {
- t.Error("Others[0].Value: bytes field not copied")
- }
- if &m.RepBytes[0] == &cloneTestMessage.RepBytes[0] {
- t.Error("RepBytes: repeated field not copied")
- }
- if &m.RepBytes[0][0] == &cloneTestMessage.RepBytes[0][0] {
- t.Error("RepBytes[0]: bytes field not copied")
- }
-}
-
-func TestCloneNil(t *testing.T) {
- var m *pb.MyMessage
- if c := proto.Clone(m); !proto.Equal(m, c) {
- t.Errorf("Clone(%v) = %v", m, c)
- }
-}
-
-var mergeTests = []struct {
- src, dst, want proto.Message
-}{
- {
- src: &pb.MyMessage{
- Count: proto.Int32(42),
- },
- dst: &pb.MyMessage{
- Name: proto.String("Dave"),
- },
- want: &pb.MyMessage{
- Count: proto.Int32(42),
- Name: proto.String("Dave"),
- },
- },
- {
- src: &pb.MyMessage{
- Inner: &pb.InnerMessage{
- Host: proto.String("hey"),
- Connected: proto.Bool(true),
- },
- Pet: []string{"horsey"},
- Others: []*pb.OtherMessage{
- {
- Value: []byte("some bytes"),
- },
- },
- },
- dst: &pb.MyMessage{
- Inner: &pb.InnerMessage{
- Host: proto.String("niles"),
- Port: proto.Int32(9099),
- },
- Pet: []string{"bunny", "kitty"},
- Others: []*pb.OtherMessage{
- {
- Key: proto.Int64(31415926535),
- },
- {
- // Explicitly test a src=nil field
- Inner: nil,
- },
- },
- },
- want: &pb.MyMessage{
- Inner: &pb.InnerMessage{
- Host: proto.String("hey"),
- Connected: proto.Bool(true),
- Port: proto.Int32(9099),
- },
- Pet: []string{"bunny", "kitty", "horsey"},
- Others: []*pb.OtherMessage{
- {
- Key: proto.Int64(31415926535),
- },
- {},
- {
- Value: []byte("some bytes"),
- },
- },
- },
- },
- {
- src: &pb.MyMessage{
- RepBytes: [][]byte{[]byte("wow")},
- },
- dst: &pb.MyMessage{
- Somegroup: &pb.MyMessage_SomeGroup{
- GroupField: proto.Int32(6),
- },
- RepBytes: [][]byte{[]byte("sham")},
- },
- want: &pb.MyMessage{
- Somegroup: &pb.MyMessage_SomeGroup{
- GroupField: proto.Int32(6),
- },
- RepBytes: [][]byte{[]byte("sham"), []byte("wow")},
- },
- },
- // Check that a scalar bytes field replaces rather than appends.
- {
- src: &pb.OtherMessage{Value: []byte("foo")},
- dst: &pb.OtherMessage{Value: []byte("bar")},
- want: &pb.OtherMessage{Value: []byte("foo")},
- },
- {
- src: &pb.MessageWithMap{
- NameMapping: map[int32]string{6: "Nigel"},
- MsgMapping: map[int64]*pb.FloatingPoint{
- 0x4001: {F: proto.Float64(2.0)},
- 0x4002: {
- F: proto.Float64(2.0),
- },
- },
- ByteMapping: map[bool][]byte{true: []byte("wowsa")},
- },
- dst: &pb.MessageWithMap{
- NameMapping: map[int32]string{
- 6: "Bruce", // should be overwritten
- 7: "Andrew",
- },
- MsgMapping: map[int64]*pb.FloatingPoint{
- 0x4002: {
- F: proto.Float64(3.0),
- Exact: proto.Bool(true),
- }, // the entire message should be overwritten
- },
- },
- want: &pb.MessageWithMap{
- NameMapping: map[int32]string{
- 6: "Nigel",
- 7: "Andrew",
- },
- MsgMapping: map[int64]*pb.FloatingPoint{
- 0x4001: {F: proto.Float64(2.0)},
- 0x4002: {
- F: proto.Float64(2.0),
- },
- },
- ByteMapping: map[bool][]byte{true: []byte("wowsa")},
- },
- },
- // proto3 shouldn't merge zero values,
- // in the same way that proto2 shouldn't merge nils.
- {
- src: &proto3pb.Message{
- Name: "Aaron",
- Data: []byte(""), // zero value, but not nil
- },
- dst: &proto3pb.Message{
- HeightInCm: 176,
- Data: []byte("texas!"),
- },
- want: &proto3pb.Message{
- Name: "Aaron",
- HeightInCm: 176,
- Data: []byte("texas!"),
- },
- },
- // Oneof fields should merge by assignment.
- {
- src: &pb.Communique{
- Union: &pb.Communique_Number{Number: 41},
- },
- dst: &pb.Communique{
- Union: &pb.Communique_Name{Name: "Bobby Tables"},
- },
- want: &pb.Communique{
- Union: &pb.Communique_Number{Number: 41},
- },
- },
- // Oneof nil is the same as not set.
- {
- src: &pb.Communique{},
- dst: &pb.Communique{
- Union: &pb.Communique_Name{Name: "Bobby Tables"},
- },
- want: &pb.Communique{
- Union: &pb.Communique_Name{Name: "Bobby Tables"},
- },
- },
- {
- src: &proto3pb.Message{
- Terrain: map[string]*proto3pb.Nested{
- "kay_a": {Cute: true}, // replace
- "kay_b": {Bunny: "rabbit"}, // insert
- },
- },
- dst: &proto3pb.Message{
- Terrain: map[string]*proto3pb.Nested{
- "kay_a": {Bunny: "lost"}, // replaced
- "kay_c": {Bunny: "bunny"}, // keep
- },
- },
- want: &proto3pb.Message{
- Terrain: map[string]*proto3pb.Nested{
- "kay_a": {Cute: true},
- "kay_b": {Bunny: "rabbit"},
- "kay_c": {Bunny: "bunny"},
- },
- },
- },
-}
-
-func TestMerge(t *testing.T) {
- for _, m := range mergeTests {
- got := proto.Clone(m.dst)
- proto.Merge(got, m.src)
- if !proto.Equal(got, m.want) {
- t.Errorf("Merge(%v, %v)\n got %v\nwant %v\n", m.dst, m.src, got, m.want)
- }
- }
-}
diff --git a/vendor/github.com/gogo/protobuf/proto/decode_test.go b/vendor/github.com/gogo/protobuf/proto/decode_test.go
deleted file mode 100644
index 64d4decd9..000000000
--- a/vendor/github.com/gogo/protobuf/proto/decode_test.go
+++ /dev/null
@@ -1,262 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// +build go1.7
-
-package proto_test
-
-import (
- "testing"
-
- "github.com/gogo/protobuf/proto"
- tpb "github.com/gogo/protobuf/proto/proto3_proto"
-)
-
-var (
- bytesBlackhole []byte
- msgBlackhole = new(tpb.Message)
-)
-
-// Disabled this Benchmark because it is using features (b.Run) from go1.7 and gogoprotobuf still have compatibility with go1.5
-// BenchmarkVarint32ArraySmall shows the performance on an array of small int32 fields (1 and
-// 2 bytes long).
-// func BenchmarkVarint32ArraySmall(b *testing.B) {
-// for i := uint(1); i <= 10; i++ {
-// dist := genInt32Dist([7]int{0, 3, 1}, 1<<i)
-// raw, err := proto.Marshal(&tpb.Message{
-// ShortKey: dist,
-// })
-// if err != nil {
-// b.Error("wrong encode", err)
-// }
-// b.Run(fmt.Sprintf("Len%v", len(dist)), func(b *testing.B) {
-// scratchBuf := proto.NewBuffer(nil)
-// b.ResetTimer()
-// for k := 0; k < b.N; k++ {
-// scratchBuf.SetBuf(raw)
-// msgBlackhole.Reset()
-// if err := scratchBuf.Unmarshal(msgBlackhole); err != nil {
-// b.Error("wrong decode", err)
-// }
-// }
-// })
-// }
-// }
-
-// Disabled this Benchmark because it is using features (b.Run) from go1.7 and gogoprotobuf still have compatibility with go1.5
-// BenchmarkVarint32ArrayLarge shows the performance on an array of large int32 fields (3 and
-// 4 bytes long, with a small number of 1, 2, 5 and 10 byte long versions).
-// func BenchmarkVarint32ArrayLarge(b *testing.B) {
-// for i := uint(1); i <= 10; i++ {
-// dist := genInt32Dist([7]int{0, 1, 2, 4, 8, 1, 1}, 1<<i)
-// raw, err := proto.Marshal(&tpb.Message{
-// ShortKey: dist,
-// })
-// if err != nil {
-// b.Error("wrong encode", err)
-// }
-// b.Run(fmt.Sprintf("Len%v", len(dist)), func(b *testing.B) {
-// scratchBuf := proto.NewBuffer(nil)
-// b.ResetTimer()
-// for k := 0; k < b.N; k++ {
-// scratchBuf.SetBuf(raw)
-// msgBlackhole.Reset()
-// if err := scratchBuf.Unmarshal(msgBlackhole); err != nil {
-// b.Error("wrong decode", err)
-// }
-// }
-// })
-// }
-// }
-
-// Disabled this Benchmark because it is using features (b.Run) from go1.7 and gogoprotobuf still have compatibility with go1.5
-// BenchmarkVarint64ArraySmall shows the performance on an array of small int64 fields (1 and
-// 2 bytes long).
-// func BenchmarkVarint64ArraySmall(b *testing.B) {
-// for i := uint(1); i <= 10; i++ {
-// dist := genUint64Dist([11]int{0, 3, 1}, 1<<i)
-// raw, err := proto.Marshal(&tpb.Message{
-// Key: dist,
-// })
-// if err != nil {
-// b.Error("wrong encode", err)
-// }
-// b.Run(fmt.Sprintf("Len%v", len(dist)), func(b *testing.B) {
-// scratchBuf := proto.NewBuffer(nil)
-// b.ResetTimer()
-// for k := 0; k < b.N; k++ {
-// scratchBuf.SetBuf(raw)
-// msgBlackhole.Reset()
-// if err := scratchBuf.Unmarshal(msgBlackhole); err != nil {
-// b.Error("wrong decode", err)
-// }
-// }
-// })
-// }
-// }
-
-// Disabled this Benchmark because it is using features (b.Run) from go1.7 and gogoprotobuf still have compatibility with go1.5
-// BenchmarkVarint64ArrayLarge shows the performance on an array of large int64 fields (6, 7,
-// and 8 bytes long with a small number of the other sizes).
-// func BenchmarkVarint64ArrayLarge(b *testing.B) {
-// for i := uint(1); i <= 10; i++ {
-// dist := genUint64Dist([11]int{0, 1, 1, 2, 4, 8, 16, 32, 16, 1, 1}, 1<<i)
-// raw, err := proto.Marshal(&tpb.Message{
-// Key: dist,
-// })
-// if err != nil {
-// b.Error("wrong encode", err)
-// }
-// b.Run(fmt.Sprintf("Len%v", len(dist)), func(b *testing.B) {
-// scratchBuf := proto.NewBuffer(nil)
-// b.ResetTimer()
-// for k := 0; k < b.N; k++ {
-// scratchBuf.SetBuf(raw)
-// msgBlackhole.Reset()
-// if err := scratchBuf.Unmarshal(msgBlackhole); err != nil {
-// b.Error("wrong decode", err)
-// }
-// }
-// })
-// }
-// }
-
-// Disabled this Benchmark because it is using features (b.Run) from go1.7 and gogoprotobuf still have compatibility with go1.5
-// BenchmarkVarint64ArrayMixed shows the performance of lots of small messages, each
-// containing a small number of large (3, 4, and 5 byte) repeated int64s.
-// func BenchmarkVarint64ArrayMixed(b *testing.B) {
-// for i := uint(1); i <= 1<<5; i <<= 1 {
-// dist := genUint64Dist([11]int{0, 0, 0, 4, 6, 4, 0, 0, 0, 0, 0}, int(i))
-// // number of sub fields
-// for k := uint(1); k <= 1<<10; k <<= 2 {
-// msg := &tpb.Message{}
-// for m := uint(0); m < k; m++ {
-// msg.Children = append(msg.Children, &tpb.Message{
-// Key: dist,
-// })
-// }
-// raw, err := proto.Marshal(msg)
-// if err != nil {
-// b.Error("wrong encode", err)
-// }
-// b.Run(fmt.Sprintf("Fields%vLen%v", k, i), func(b *testing.B) {
-// scratchBuf := proto.NewBuffer(nil)
-// b.ResetTimer()
-// for k := 0; k < b.N; k++ {
-// scratchBuf.SetBuf(raw)
-// msgBlackhole.Reset()
-// if err := scratchBuf.Unmarshal(msgBlackhole); err != nil {
-// b.Error("wrong decode", err)
-// }
-// }
-// })
-// }
-// }
-// }
-
-// genInt32Dist generates a slice of ints that will match the size distribution of dist.
-// A size of 6 corresponds to a max length varint32, which is 10 bytes. The distribution
-// is 1-indexed. (i.e. the value at index 1 is how many 1 byte ints to create).
-func genInt32Dist(dist [7]int, count int) (dest []int32) {
- for i := 0; i < count; i++ {
- for k := 0; k < len(dist); k++ {
- var num int32
- switch k {
- case 1:
- num = 1<<7 - 1
- case 2:
- num = 1<<14 - 1
- case 3:
- num = 1<<21 - 1
- case 4:
- num = 1<<28 - 1
- case 5:
- num = 1<<29 - 1
- case 6:
- num = -1
- }
- for m := 0; m < dist[k]; m++ {
- dest = append(dest, num)
- }
- }
- }
- return
-}
-
-// genUint64Dist generates a slice of ints that will match the size distribution of dist.
-// The distribution is 1-indexed. (i.e. the value at index 1 is how many 1 byte ints to create).
-func genUint64Dist(dist [11]int, count int) (dest []uint64) {
- for i := 0; i < count; i++ {
- for k := 0; k < len(dist); k++ {
- var num uint64
- switch k {
- case 1:
- num = 1<<7 - 1
- case 2:
- num = 1<<14 - 1
- case 3:
- num = 1<<21 - 1
- case 4:
- num = 1<<28 - 1
- case 5:
- num = 1<<35 - 1
- case 6:
- num = 1<<42 - 1
- case 7:
- num = 1<<49 - 1
- case 8:
- num = 1<<56 - 1
- case 9:
- num = 1<<63 - 1
- case 10:
- num = 1<<64 - 1
- }
- for m := 0; m < dist[k]; m++ {
- dest = append(dest, num)
- }
- }
- }
- return
-}
-
-// BenchmarkDecodeEmpty measures the overhead of doing the minimal possible decode.
-func BenchmarkDecodeEmpty(b *testing.B) {
- raw, err := proto.Marshal(&tpb.Message{})
- if err != nil {
- b.Error("wrong encode", err)
- }
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- if err := proto.Unmarshal(raw, msgBlackhole); err != nil {
- b.Error("wrong decode", err)
- }
- }
-}
diff --git a/vendor/github.com/gogo/protobuf/proto/encode_test.go b/vendor/github.com/gogo/protobuf/proto/encode_test.go
deleted file mode 100644
index 2176b894d..000000000
--- a/vendor/github.com/gogo/protobuf/proto/encode_test.go
+++ /dev/null
@@ -1,84 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// +build go1.7
-
-package proto_test
-
-import (
- "testing"
-
- "github.com/gogo/protobuf/proto"
- tpb "github.com/gogo/protobuf/proto/proto3_proto"
-)
-
-var (
- blackhole []byte
-)
-
-// Disabled this Benchmark because it is using features (b.Run) from go1.7 and gogoprotobuf still have compatibility with go1.5
-// BenchmarkAny creates increasingly large arbitrary Any messages. The type is always the
-// same.
-// func BenchmarkAny(b *testing.B) {
-// data := make([]byte, 1<<20)
-// quantum := 1 << 10
-// for i := uint(0); i <= 10; i++ {
-// b.Run(strconv.Itoa(quantum<<i), func(b *testing.B) {
-// for k := 0; k < b.N; k++ {
-// inner := &tpb.Message{
-// Data: data[:quantum<<i],
-// }
-// outer, err := types.MarshalAny(inner)
-// if err != nil {
-// b.Error("wrong encode", err)
-// }
-// raw, err := proto.Marshal(&tpb.Message{
-// Anything: outer,
-// })
-// if err != nil {
-// b.Error("wrong encode", err)
-// }
-// blackhole = raw
-// }
-// })
-// }
-// }
-
-// BenchmarkEmpy measures the overhead of doing the minimal possible encode.
-func BenchmarkEmpy(b *testing.B) {
- for i := 0; i < b.N; i++ {
- raw, err := proto.Marshal(&tpb.Message{})
- if err != nil {
- b.Error("wrong encode", err)
- }
- blackhole = raw
- }
-}
diff --git a/vendor/github.com/gogo/protobuf/proto/equal_test.go b/vendor/github.com/gogo/protobuf/proto/equal_test.go
deleted file mode 100644
index 980f451fc..000000000
--- a/vendor/github.com/gogo/protobuf/proto/equal_test.go
+++ /dev/null
@@ -1,224 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2011 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto_test
-
-import (
- "testing"
-
- . "github.com/gogo/protobuf/proto"
- proto3pb "github.com/gogo/protobuf/proto/proto3_proto"
- pb "github.com/gogo/protobuf/proto/testdata"
-)
-
-// Four identical base messages.
-// The init function adds extensions to some of them.
-var messageWithoutExtension = &pb.MyMessage{Count: Int32(7)}
-var messageWithExtension1a = &pb.MyMessage{Count: Int32(7)}
-var messageWithExtension1b = &pb.MyMessage{Count: Int32(7)}
-var messageWithExtension2 = &pb.MyMessage{Count: Int32(7)}
-
-// Two messages with non-message extensions.
-var messageWithInt32Extension1 = &pb.MyMessage{Count: Int32(8)}
-var messageWithInt32Extension2 = &pb.MyMessage{Count: Int32(8)}
-
-func init() {
- ext1 := &pb.Ext{Data: String("Kirk")}
- ext2 := &pb.Ext{Data: String("Picard")}
-
- // messageWithExtension1a has ext1, but never marshals it.
- if err := SetExtension(messageWithExtension1a, pb.E_Ext_More, ext1); err != nil {
- panic("SetExtension on 1a failed: " + err.Error())
- }
-
- // messageWithExtension1b is the unmarshaled form of messageWithExtension1a.
- if err := SetExtension(messageWithExtension1b, pb.E_Ext_More, ext1); err != nil {
- panic("SetExtension on 1b failed: " + err.Error())
- }
- buf, err := Marshal(messageWithExtension1b)
- if err != nil {
- panic("Marshal of 1b failed: " + err.Error())
- }
- messageWithExtension1b.Reset()
- if err := Unmarshal(buf, messageWithExtension1b); err != nil {
- panic("Unmarshal of 1b failed: " + err.Error())
- }
-
- // messageWithExtension2 has ext2.
- if err := SetExtension(messageWithExtension2, pb.E_Ext_More, ext2); err != nil {
- panic("SetExtension on 2 failed: " + err.Error())
- }
-
- if err := SetExtension(messageWithInt32Extension1, pb.E_Ext_Number, Int32(23)); err != nil {
- panic("SetExtension on Int32-1 failed: " + err.Error())
- }
- if err := SetExtension(messageWithInt32Extension1, pb.E_Ext_Number, Int32(24)); err != nil {
- panic("SetExtension on Int32-2 failed: " + err.Error())
- }
-}
-
-var EqualTests = []struct {
- desc string
- a, b Message
- exp bool
-}{
- {"different types", &pb.GoEnum{}, &pb.GoTestField{}, false},
- {"equal empty", &pb.GoEnum{}, &pb.GoEnum{}, true},
- {"nil vs nil", nil, nil, true},
- {"typed nil vs typed nil", (*pb.GoEnum)(nil), (*pb.GoEnum)(nil), true},
- {"typed nil vs empty", (*pb.GoEnum)(nil), &pb.GoEnum{}, false},
- {"different typed nil", (*pb.GoEnum)(nil), (*pb.GoTestField)(nil), false},
-
- {"one set field, one unset field", &pb.GoTestField{Label: String("foo")}, &pb.GoTestField{}, false},
- {"one set field zero, one unset field", &pb.GoTest{Param: Int32(0)}, &pb.GoTest{}, false},
- {"different set fields", &pb.GoTestField{Label: String("foo")}, &pb.GoTestField{Label: String("bar")}, false},
- {"equal set", &pb.GoTestField{Label: String("foo")}, &pb.GoTestField{Label: String("foo")}, true},
-
- {"repeated, one set", &pb.GoTest{F_Int32Repeated: []int32{2, 3}}, &pb.GoTest{}, false},
- {"repeated, different length", &pb.GoTest{F_Int32Repeated: []int32{2, 3}}, &pb.GoTest{F_Int32Repeated: []int32{2}}, false},
- {"repeated, different value", &pb.GoTest{F_Int32Repeated: []int32{2}}, &pb.GoTest{F_Int32Repeated: []int32{3}}, false},
- {"repeated, equal", &pb.GoTest{F_Int32Repeated: []int32{2, 4}}, &pb.GoTest{F_Int32Repeated: []int32{2, 4}}, true},
- {"repeated, nil equal nil", &pb.GoTest{F_Int32Repeated: nil}, &pb.GoTest{F_Int32Repeated: nil}, true},
- {"repeated, nil equal empty", &pb.GoTest{F_Int32Repeated: nil}, &pb.GoTest{F_Int32Repeated: []int32{}}, true},
- {"repeated, empty equal nil", &pb.GoTest{F_Int32Repeated: []int32{}}, &pb.GoTest{F_Int32Repeated: nil}, true},
-
- {
- "nested, different",
- &pb.GoTest{RequiredField: &pb.GoTestField{Label: String("foo")}},
- &pb.GoTest{RequiredField: &pb.GoTestField{Label: String("bar")}},
- false,
- },
- {
- "nested, equal",
- &pb.GoTest{RequiredField: &pb.GoTestField{Label: String("wow")}},
- &pb.GoTest{RequiredField: &pb.GoTestField{Label: String("wow")}},
- true,
- },
-
- {"bytes", &pb.OtherMessage{Value: []byte("foo")}, &pb.OtherMessage{Value: []byte("foo")}, true},
- {"bytes, empty", &pb.OtherMessage{Value: []byte{}}, &pb.OtherMessage{Value: []byte{}}, true},
- {"bytes, empty vs nil", &pb.OtherMessage{Value: []byte{}}, &pb.OtherMessage{Value: nil}, false},
- {
- "repeated bytes",
- &pb.MyMessage{RepBytes: [][]byte{[]byte("sham"), []byte("wow")}},
- &pb.MyMessage{RepBytes: [][]byte{[]byte("sham"), []byte("wow")}},
- true,
- },
- // In proto3, []byte{} and []byte(nil) are equal.
- {"proto3 bytes, empty vs nil", &proto3pb.Message{Data: []byte{}}, &proto3pb.Message{Data: nil}, true},
-
- {"extension vs. no extension", messageWithoutExtension, messageWithExtension1a, false},
- {"extension vs. same extension", messageWithExtension1a, messageWithExtension1b, true},
- {"extension vs. different extension", messageWithExtension1a, messageWithExtension2, false},
-
- {"int32 extension vs. itself", messageWithInt32Extension1, messageWithInt32Extension1, true},
- {"int32 extension vs. a different int32", messageWithInt32Extension1, messageWithInt32Extension2, false},
-
- {
- "message with group",
- &pb.MyMessage{
- Count: Int32(1),
- Somegroup: &pb.MyMessage_SomeGroup{
- GroupField: Int32(5),
- },
- },
- &pb.MyMessage{
- Count: Int32(1),
- Somegroup: &pb.MyMessage_SomeGroup{
- GroupField: Int32(5),
- },
- },
- true,
- },
-
- {
- "map same",
- &pb.MessageWithMap{NameMapping: map[int32]string{1: "Ken"}},
- &pb.MessageWithMap{NameMapping: map[int32]string{1: "Ken"}},
- true,
- },
- {
- "map different entry",
- &pb.MessageWithMap{NameMapping: map[int32]string{1: "Ken"}},
- &pb.MessageWithMap{NameMapping: map[int32]string{2: "Rob"}},
- false,
- },
- {
- "map different key only",
- &pb.MessageWithMap{NameMapping: map[int32]string{1: "Ken"}},
- &pb.MessageWithMap{NameMapping: map[int32]string{2: "Ken"}},
- false,
- },
- {
- "map different value only",
- &pb.MessageWithMap{NameMapping: map[int32]string{1: "Ken"}},
- &pb.MessageWithMap{NameMapping: map[int32]string{1: "Rob"}},
- false,
- },
- {
- "zero-length maps same",
- &pb.MessageWithMap{NameMapping: map[int32]string{}},
- &pb.MessageWithMap{NameMapping: nil},
- true,
- },
- {
- "orders in map don't matter",
- &pb.MessageWithMap{NameMapping: map[int32]string{1: "Ken", 2: "Rob"}},
- &pb.MessageWithMap{NameMapping: map[int32]string{2: "Rob", 1: "Ken"}},
- true,
- },
- {
- "oneof same",
- &pb.Communique{Union: &pb.Communique_Number{Number: 41}},
- &pb.Communique{Union: &pb.Communique_Number{Number: 41}},
- true,
- },
- {
- "oneof one nil",
- &pb.Communique{Union: &pb.Communique_Number{Number: 41}},
- &pb.Communique{},
- false,
- },
- {
- "oneof different",
- &pb.Communique{Union: &pb.Communique_Number{Number: 41}},
- &pb.Communique{Union: &pb.Communique_Name{Name: "Bobby Tables"}},
- false,
- },
-}
-
-func TestEqual(t *testing.T) {
- for _, tc := range EqualTests {
- if res := Equal(tc.a, tc.b); res != tc.exp {
- t.Errorf("%v: Equal(%v, %v) = %v, want %v", tc.desc, tc.a, tc.b, res, tc.exp)
- }
- }
-}
diff --git a/vendor/github.com/gogo/protobuf/proto/extensions_test.go b/vendor/github.com/gogo/protobuf/proto/extensions_test.go
deleted file mode 100644
index 15c76a36d..000000000
--- a/vendor/github.com/gogo/protobuf/proto/extensions_test.go
+++ /dev/null
@@ -1,538 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2014 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto_test
-
-import (
- "bytes"
- "fmt"
- "reflect"
- "sort"
- "testing"
-
- "github.com/gogo/protobuf/proto"
- pb "github.com/gogo/protobuf/proto/testdata"
-)
-
-func TestGetExtensionsWithMissingExtensions(t *testing.T) {
- msg := &pb.MyMessage{}
- ext1 := &pb.Ext{}
- if err := proto.SetExtension(msg, pb.E_Ext_More, ext1); err != nil {
- t.Fatalf("Could not set ext1: %s", err)
- }
- exts, err := proto.GetExtensions(msg, []*proto.ExtensionDesc{
- pb.E_Ext_More,
- pb.E_Ext_Text,
- })
- if err != nil {
- t.Fatalf("GetExtensions() failed: %s", err)
- }
- if exts[0] != ext1 {
- t.Errorf("ext1 not in returned extensions: %T %v", exts[0], exts[0])
- }
- if exts[1] != nil {
- t.Errorf("ext2 in returned extensions: %T %v", exts[1], exts[1])
- }
-}
-
-func TestExtensionDescsWithMissingExtensions(t *testing.T) {
- msg := &pb.MyMessage{Count: proto.Int32(0)}
- extdesc1 := pb.E_Ext_More
- if descs, err := proto.ExtensionDescs(msg); len(descs) != 0 || err != nil {
- t.Errorf("proto.ExtensionDescs: got %d descs, error %v; want 0, nil", len(descs), err)
- }
-
- ext1 := &pb.Ext{}
- if err := proto.SetExtension(msg, extdesc1, ext1); err != nil {
- t.Fatalf("Could not set ext1: %s", err)
- }
- extdesc2 := &proto.ExtensionDesc{
- ExtendedType: (*pb.MyMessage)(nil),
- ExtensionType: (*bool)(nil),
- Field: 123456789,
- Name: "a.b",
- Tag: "varint,123456789,opt",
- }
- ext2 := proto.Bool(false)
- if err := proto.SetExtension(msg, extdesc2, ext2); err != nil {
- t.Fatalf("Could not set ext2: %s", err)
- }
-
- b, err := proto.Marshal(msg)
- if err != nil {
- t.Fatalf("Could not marshal msg: %v", err)
- }
- if err = proto.Unmarshal(b, msg); err != nil {
- t.Fatalf("Could not unmarshal into msg: %v", err)
- }
-
- descs, err := proto.ExtensionDescs(msg)
- if err != nil {
- t.Fatalf("proto.ExtensionDescs: got error %v", err)
- }
- sortExtDescs(descs)
- wantDescs := []*proto.ExtensionDesc{extdesc1, {Field: extdesc2.Field}}
- if !reflect.DeepEqual(descs, wantDescs) {
- t.Errorf("proto.ExtensionDescs(msg) sorted extension ids: got %+v, want %+v", descs, wantDescs)
- }
-}
-
-type ExtensionDescSlice []*proto.ExtensionDesc
-
-func (s ExtensionDescSlice) Len() int { return len(s) }
-func (s ExtensionDescSlice) Less(i, j int) bool { return s[i].Field < s[j].Field }
-func (s ExtensionDescSlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
-
-func sortExtDescs(s []*proto.ExtensionDesc) {
- sort.Sort(ExtensionDescSlice(s))
-}
-
-func TestGetExtensionStability(t *testing.T) {
- check := func(m *pb.MyMessage) bool {
- ext1, err := proto.GetExtension(m, pb.E_Ext_More)
- if err != nil {
- t.Fatalf("GetExtension() failed: %s", err)
- }
- ext2, err := proto.GetExtension(m, pb.E_Ext_More)
- if err != nil {
- t.Fatalf("GetExtension() failed: %s", err)
- }
- return ext1 == ext2
- }
- msg := &pb.MyMessage{Count: proto.Int32(4)}
- ext0 := &pb.Ext{}
- if err := proto.SetExtension(msg, pb.E_Ext_More, ext0); err != nil {
- t.Fatalf("Could not set ext1: %s", ext0)
- }
- if !check(msg) {
- t.Errorf("GetExtension() not stable before marshaling")
- }
- bb, err := proto.Marshal(msg)
- if err != nil {
- t.Fatalf("Marshal() failed: %s", err)
- }
- msg1 := &pb.MyMessage{}
- err = proto.Unmarshal(bb, msg1)
- if err != nil {
- t.Fatalf("Unmarshal() failed: %s", err)
- }
- if !check(msg1) {
- t.Errorf("GetExtension() not stable after unmarshaling")
- }
-}
-
-func TestGetExtensionDefaults(t *testing.T) {
- var setFloat64 float64 = 1
- var setFloat32 float32 = 2
- var setInt32 int32 = 3
- var setInt64 int64 = 4
- var setUint32 uint32 = 5
- var setUint64 uint64 = 6
- var setBool = true
- var setBool2 = false
- var setString = "Goodnight string"
- var setBytes = []byte("Goodnight bytes")
- var setEnum = pb.DefaultsMessage_TWO
-
- type testcase struct {
- ext *proto.ExtensionDesc // Extension we are testing.
- want interface{} // Expected value of extension, or nil (meaning that GetExtension will fail).
- def interface{} // Expected value of extension after ClearExtension().
- }
- tests := []testcase{
- {pb.E_NoDefaultDouble, setFloat64, nil},
- {pb.E_NoDefaultFloat, setFloat32, nil},
- {pb.E_NoDefaultInt32, setInt32, nil},
- {pb.E_NoDefaultInt64, setInt64, nil},
- {pb.E_NoDefaultUint32, setUint32, nil},
- {pb.E_NoDefaultUint64, setUint64, nil},
- {pb.E_NoDefaultSint32, setInt32, nil},
- {pb.E_NoDefaultSint64, setInt64, nil},
- {pb.E_NoDefaultFixed32, setUint32, nil},
- {pb.E_NoDefaultFixed64, setUint64, nil},
- {pb.E_NoDefaultSfixed32, setInt32, nil},
- {pb.E_NoDefaultSfixed64, setInt64, nil},
- {pb.E_NoDefaultBool, setBool, nil},
- {pb.E_NoDefaultBool, setBool2, nil},
- {pb.E_NoDefaultString, setString, nil},
- {pb.E_NoDefaultBytes, setBytes, nil},
- {pb.E_NoDefaultEnum, setEnum, nil},
- {pb.E_DefaultDouble, setFloat64, float64(3.1415)},
- {pb.E_DefaultFloat, setFloat32, float32(3.14)},
- {pb.E_DefaultInt32, setInt32, int32(42)},
- {pb.E_DefaultInt64, setInt64, int64(43)},
- {pb.E_DefaultUint32, setUint32, uint32(44)},
- {pb.E_DefaultUint64, setUint64, uint64(45)},
- {pb.E_DefaultSint32, setInt32, int32(46)},
- {pb.E_DefaultSint64, setInt64, int64(47)},
- {pb.E_DefaultFixed32, setUint32, uint32(48)},
- {pb.E_DefaultFixed64, setUint64, uint64(49)},
- {pb.E_DefaultSfixed32, setInt32, int32(50)},
- {pb.E_DefaultSfixed64, setInt64, int64(51)},
- {pb.E_DefaultBool, setBool, true},
- {pb.E_DefaultBool, setBool2, true},
- {pb.E_DefaultString, setString, "Hello, string"},
- {pb.E_DefaultBytes, setBytes, []byte("Hello, bytes")},
- {pb.E_DefaultEnum, setEnum, pb.DefaultsMessage_ONE},
- }
-
- checkVal := func(test testcase, msg *pb.DefaultsMessage, valWant interface{}) error {
- val, err := proto.GetExtension(msg, test.ext)
- if err != nil {
- if valWant != nil {
- return fmt.Errorf("GetExtension(): %s", err)
- }
- if want := proto.ErrMissingExtension; err != want {
- return fmt.Errorf("Unexpected error: got %v, want %v", err, want)
- }
- return nil
- }
-
- // All proto2 extension values are either a pointer to a value or a slice of values.
- ty := reflect.TypeOf(val)
- tyWant := reflect.TypeOf(test.ext.ExtensionType)
- if got, want := ty, tyWant; got != want {
- return fmt.Errorf("unexpected reflect.TypeOf(): got %v want %v", got, want)
- }
- tye := ty.Elem()
- tyeWant := tyWant.Elem()
- if got, want := tye, tyeWant; got != want {
- return fmt.Errorf("unexpected reflect.TypeOf().Elem(): got %v want %v", got, want)
- }
-
- // Check the name of the type of the value.
- // If it is an enum it will be type int32 with the name of the enum.
- if got, want := tye.Name(), tye.Name(); got != want {
- return fmt.Errorf("unexpected reflect.TypeOf().Elem().Name(): got %v want %v", got, want)
- }
-
- // Check that value is what we expect.
- // If we have a pointer in val, get the value it points to.
- valExp := val
- if ty.Kind() == reflect.Ptr {
- valExp = reflect.ValueOf(val).Elem().Interface()
- }
- if got, want := valExp, valWant; !reflect.DeepEqual(got, want) {
- return fmt.Errorf("unexpected reflect.DeepEqual(): got %v want %v", got, want)
- }
-
- return nil
- }
-
- setTo := func(test testcase) interface{} {
- setTo := reflect.ValueOf(test.want)
- if typ := reflect.TypeOf(test.ext.ExtensionType); typ.Kind() == reflect.Ptr {
- setTo = reflect.New(typ).Elem()
- setTo.Set(reflect.New(setTo.Type().Elem()))
- setTo.Elem().Set(reflect.ValueOf(test.want))
- }
- return setTo.Interface()
- }
-
- for _, test := range tests {
- msg := &pb.DefaultsMessage{}
- name := test.ext.Name
-
- // Check the initial value.
- if err := checkVal(test, msg, test.def); err != nil {
- t.Errorf("%s: %v", name, err)
- }
-
- // Set the per-type value and check value.
- name = fmt.Sprintf("%s (set to %T %v)", name, test.want, test.want)
- if err := proto.SetExtension(msg, test.ext, setTo(test)); err != nil {
- t.Errorf("%s: SetExtension(): %v", name, err)
- continue
- }
- if err := checkVal(test, msg, test.want); err != nil {
- t.Errorf("%s: %v", name, err)
- continue
- }
-
- // Set and check the value.
- name += " (cleared)"
- proto.ClearExtension(msg, test.ext)
- if err := checkVal(test, msg, test.def); err != nil {
- t.Errorf("%s: %v", name, err)
- }
- }
-}
-
-func TestExtensionsRoundTrip(t *testing.T) {
- msg := &pb.MyMessage{}
- ext1 := &pb.Ext{
- Data: proto.String("hi"),
- }
- ext2 := &pb.Ext{
- Data: proto.String("there"),
- }
- exists := proto.HasExtension(msg, pb.E_Ext_More)
- if exists {
- t.Error("Extension More present unexpectedly")
- }
- if err := proto.SetExtension(msg, pb.E_Ext_More, ext1); err != nil {
- t.Error(err)
- }
- if err := proto.SetExtension(msg, pb.E_Ext_More, ext2); err != nil {
- t.Error(err)
- }
- e, err := proto.GetExtension(msg, pb.E_Ext_More)
- if err != nil {
- t.Error(err)
- }
- x, ok := e.(*pb.Ext)
- if !ok {
- t.Errorf("e has type %T, expected testdata.Ext", e)
- } else if *x.Data != "there" {
- t.Errorf("SetExtension failed to overwrite, got %+v, not 'there'", x)
- }
- proto.ClearExtension(msg, pb.E_Ext_More)
- if _, err = proto.GetExtension(msg, pb.E_Ext_More); err != proto.ErrMissingExtension {
- t.Errorf("got %v, expected ErrMissingExtension", e)
- }
- if _, err := proto.GetExtension(msg, pb.E_X215); err == nil {
- t.Error("expected bad extension error, got nil")
- }
- if err := proto.SetExtension(msg, pb.E_X215, 12); err == nil {
- t.Error("expected extension err")
- }
- if err := proto.SetExtension(msg, pb.E_Ext_More, 12); err == nil {
- t.Error("expected some sort of type mismatch error, got nil")
- }
-}
-
-func TestNilExtension(t *testing.T) {
- msg := &pb.MyMessage{
- Count: proto.Int32(1),
- }
- if err := proto.SetExtension(msg, pb.E_Ext_Text, proto.String("hello")); err != nil {
- t.Fatal(err)
- }
- if err := proto.SetExtension(msg, pb.E_Ext_More, (*pb.Ext)(nil)); err == nil {
- t.Error("expected SetExtension to fail due to a nil extension")
- } else if want := "proto: SetExtension called with nil value of type *testdata.Ext"; err.Error() != want {
- t.Errorf("expected error %v, got %v", want, err)
- }
- // Note: if the behavior of Marshal is ever changed to ignore nil extensions, update
- // this test to verify that E_Ext_Text is properly propagated through marshal->unmarshal.
-}
-
-func TestMarshalUnmarshalRepeatedExtension(t *testing.T) {
- // Add a repeated extension to the result.
- tests := []struct {
- name string
- ext []*pb.ComplexExtension
- }{
- {
- "two fields",
- []*pb.ComplexExtension{
- {First: proto.Int32(7)},
- {Second: proto.Int32(11)},
- },
- },
- {
- "repeated field",
- []*pb.ComplexExtension{
- {Third: []int32{1000}},
- {Third: []int32{2000}},
- },
- },
- {
- "two fields and repeated field",
- []*pb.ComplexExtension{
- {Third: []int32{1000}},
- {First: proto.Int32(9)},
- {Second: proto.Int32(21)},
- {Third: []int32{2000}},
- },
- },
- }
- for _, test := range tests {
- // Marshal message with a repeated extension.
- msg1 := new(pb.OtherMessage)
- err := proto.SetExtension(msg1, pb.E_RComplex, test.ext)
- if err != nil {
- t.Fatalf("[%s] Error setting extension: %v", test.name, err)
- }
- b, err := proto.Marshal(msg1)
- if err != nil {
- t.Fatalf("[%s] Error marshaling message: %v", test.name, err)
- }
-
- // Unmarshal and read the merged proto.
- msg2 := new(pb.OtherMessage)
- err = proto.Unmarshal(b, msg2)
- if err != nil {
- t.Fatalf("[%s] Error unmarshaling message: %v", test.name, err)
- }
- e, err := proto.GetExtension(msg2, pb.E_RComplex)
- if err != nil {
- t.Fatalf("[%s] Error getting extension: %v", test.name, err)
- }
- ext := e.([]*pb.ComplexExtension)
- if ext == nil {
- t.Fatalf("[%s] Invalid extension", test.name)
- }
- if !reflect.DeepEqual(ext, test.ext) {
- t.Errorf("[%s] Wrong value for ComplexExtension: got: %v want: %v\n", test.name, ext, test.ext)
- }
- }
-}
-
-func TestUnmarshalRepeatingNonRepeatedExtension(t *testing.T) {
- // We may see multiple instances of the same extension in the wire
- // format. For example, the proto compiler may encode custom options in
- // this way. Here, we verify that we merge the extensions together.
- tests := []struct {
- name string
- ext []*pb.ComplexExtension
- }{
- {
- "two fields",
- []*pb.ComplexExtension{
- {First: proto.Int32(7)},
- {Second: proto.Int32(11)},
- },
- },
- {
- "repeated field",
- []*pb.ComplexExtension{
- {Third: []int32{1000}},
- {Third: []int32{2000}},
- },
- },
- {
- "two fields and repeated field",
- []*pb.ComplexExtension{
- {Third: []int32{1000}},
- {First: proto.Int32(9)},
- {Second: proto.Int32(21)},
- {Third: []int32{2000}},
- },
- },
- }
- for _, test := range tests {
- var buf bytes.Buffer
- var want pb.ComplexExtension
-
- // Generate a serialized representation of a repeated extension
- // by catenating bytes together.
- for i, e := range test.ext {
- // Merge to create the wanted proto.
- proto.Merge(&want, e)
-
- // serialize the message
- msg := new(pb.OtherMessage)
- err := proto.SetExtension(msg, pb.E_Complex, e)
- if err != nil {
- t.Fatalf("[%s] Error setting extension %d: %v", test.name, i, err)
- }
- b, err := proto.Marshal(msg)
- if err != nil {
- t.Fatalf("[%s] Error marshaling message %d: %v", test.name, i, err)
- }
- buf.Write(b)
- }
-
- // Unmarshal and read the merged proto.
- msg2 := new(pb.OtherMessage)
- err := proto.Unmarshal(buf.Bytes(), msg2)
- if err != nil {
- t.Fatalf("[%s] Error unmarshaling message: %v", test.name, err)
- }
- e, err := proto.GetExtension(msg2, pb.E_Complex)
- if err != nil {
- t.Fatalf("[%s] Error getting extension: %v", test.name, err)
- }
- ext := e.(*pb.ComplexExtension)
- if ext == nil {
- t.Fatalf("[%s] Invalid extension", test.name)
- }
- if !reflect.DeepEqual(*ext, want) {
- t.Errorf("[%s] Wrong value for ComplexExtension: got: %v want: %v\n", test.name, ext, want)
- }
- }
-}
-
-func TestClearAllExtensions(t *testing.T) {
- // unregistered extension
- desc := &proto.ExtensionDesc{
- ExtendedType: (*pb.MyMessage)(nil),
- ExtensionType: (*bool)(nil),
- Field: 101010100,
- Name: "emptyextension",
- Tag: "varint,0,opt",
- }
- m := &pb.MyMessage{}
- if proto.HasExtension(m, desc) {
- t.Errorf("proto.HasExtension(%s): got true, want false", proto.MarshalTextString(m))
- }
- if err := proto.SetExtension(m, desc, proto.Bool(true)); err != nil {
- t.Errorf("proto.SetExtension(m, desc, true): got error %q, want nil", err)
- }
- if !proto.HasExtension(m, desc) {
- t.Errorf("proto.HasExtension(%s): got false, want true", proto.MarshalTextString(m))
- }
- proto.ClearAllExtensions(m)
- if proto.HasExtension(m, desc) {
- t.Errorf("proto.HasExtension(%s): got true, want false", proto.MarshalTextString(m))
- }
-}
-
-func TestMarshalRace(t *testing.T) {
- // unregistered extension
- desc := &proto.ExtensionDesc{
- ExtendedType: (*pb.MyMessage)(nil),
- ExtensionType: (*bool)(nil),
- Field: 101010100,
- Name: "emptyextension",
- Tag: "varint,0,opt",
- }
-
- m := &pb.MyMessage{Count: proto.Int32(4)}
- if err := proto.SetExtension(m, desc, proto.Bool(true)); err != nil {
- t.Errorf("proto.SetExtension(m, desc, true): got error %q, want nil", err)
- }
-
- errChan := make(chan error, 3)
- for n := 3; n > 0; n-- {
- go func() {
- _, err := proto.Marshal(m)
- errChan <- err
- }()
- }
- for i := 0; i < 3; i++ {
- err := <-errChan
- if err != nil {
- t.Fatal(err)
- }
- }
-}
diff --git a/vendor/github.com/gogo/protobuf/proto/map_test.go b/vendor/github.com/gogo/protobuf/proto/map_test.go
deleted file mode 100644
index 18b946d00..000000000
--- a/vendor/github.com/gogo/protobuf/proto/map_test.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package proto_test
-
-import (
- "fmt"
- "testing"
-
- "github.com/gogo/protobuf/proto"
- ppb "github.com/gogo/protobuf/proto/proto3_proto"
-)
-
-func marshalled() []byte {
- m := &ppb.IntMaps{}
- for i := 0; i < 1000; i++ {
- m.Maps = append(m.Maps, &ppb.IntMap{
- Rtt: map[int32]int32{1: 2},
- })
- }
- b, err := proto.Marshal(m)
- if err != nil {
- panic(fmt.Sprintf("Can't marshal %+v: %v", m, err))
- }
- return b
-}
-
-func BenchmarkConcurrentMapUnmarshal(b *testing.B) {
- in := marshalled()
- b.RunParallel(func(pb *testing.PB) {
- for pb.Next() {
- var out ppb.IntMaps
- if err := proto.Unmarshal(in, &out); err != nil {
- b.Errorf("Can't unmarshal ppb.IntMaps: %v", err)
- }
- }
- })
-}
-
-func BenchmarkSequentialMapUnmarshal(b *testing.B) {
- in := marshalled()
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- var out ppb.IntMaps
- if err := proto.Unmarshal(in, &out); err != nil {
- b.Errorf("Can't unmarshal ppb.IntMaps: %v", err)
- }
- }
-}
diff --git a/vendor/github.com/gogo/protobuf/proto/message_set_test.go b/vendor/github.com/gogo/protobuf/proto/message_set_test.go
deleted file mode 100644
index 353a3ea76..000000000
--- a/vendor/github.com/gogo/protobuf/proto/message_set_test.go
+++ /dev/null
@@ -1,66 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2014 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-import (
- "bytes"
- "testing"
-)
-
-func TestUnmarshalMessageSetWithDuplicate(t *testing.T) {
- // Check that a repeated message set entry will be concatenated.
- in := &messageSet{
- Item: []*_MessageSet_Item{
- {TypeId: Int32(12345), Message: []byte("hoo")},
- {TypeId: Int32(12345), Message: []byte("hah")},
- },
- }
- b, err := Marshal(in)
- if err != nil {
- t.Fatalf("Marshal: %v", err)
- }
- t.Logf("Marshaled bytes: %q", b)
-
- var extensions XXX_InternalExtensions
- if err := UnmarshalMessageSet(b, &extensions); err != nil {
- t.Fatalf("UnmarshalMessageSet: %v", err)
- }
- ext, ok := extensions.p.extensionMap[12345]
- if !ok {
- t.Fatalf("Didn't retrieve extension 12345; map is %v", extensions.p.extensionMap)
- }
- // Skip wire type/field number and length varints.
- got := skipVarint(skipVarint(ext.enc))
- if want := []byte("hoohah"); !bytes.Equal(got, want) {
- t.Errorf("Combined extension is %q, want %q", got, want)
- }
-}
diff --git a/vendor/github.com/gogo/protobuf/proto/proto3_test.go b/vendor/github.com/gogo/protobuf/proto/proto3_test.go
deleted file mode 100644
index 75b66c179..000000000
--- a/vendor/github.com/gogo/protobuf/proto/proto3_test.go
+++ /dev/null
@@ -1,135 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2014 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto_test
-
-import (
- "testing"
-
- "github.com/gogo/protobuf/proto"
- pb "github.com/gogo/protobuf/proto/proto3_proto"
- tpb "github.com/gogo/protobuf/proto/testdata"
-)
-
-func TestProto3ZeroValues(t *testing.T) {
- tests := []struct {
- desc string
- m proto.Message
- }{
- {"zero message", &pb.Message{}},
- {"empty bytes field", &pb.Message{Data: []byte{}}},
- }
- for _, test := range tests {
- b, err := proto.Marshal(test.m)
- if err != nil {
- t.Errorf("%s: proto.Marshal: %v", test.desc, err)
- continue
- }
- if len(b) > 0 {
- t.Errorf("%s: Encoding is non-empty: %q", test.desc, b)
- }
- }
-}
-
-func TestRoundTripProto3(t *testing.T) {
- m := &pb.Message{
- Name: "David", // (2 | 1<<3): 0x0a 0x05 "David"
- Hilarity: pb.Message_PUNS, // (0 | 2<<3): 0x10 0x01
- HeightInCm: 178, // (0 | 3<<3): 0x18 0xb2 0x01
- Data: []byte("roboto"), // (2 | 4<<3): 0x20 0x06 "roboto"
- ResultCount: 47, // (0 | 7<<3): 0x38 0x2f
- TrueScotsman: true, // (0 | 8<<3): 0x40 0x01
- Score: 8.1, // (5 | 9<<3): 0x4d <8.1>
-
- Key: []uint64{1, 0xdeadbeef},
- Nested: &pb.Nested{
- Bunny: "Monty",
- },
- }
- t.Logf(" m: %v", m)
-
- b, err := proto.Marshal(m)
- if err != nil {
- t.Fatalf("proto.Marshal: %v", err)
- }
- t.Logf(" b: %q", b)
-
- m2 := new(pb.Message)
- if err := proto.Unmarshal(b, m2); err != nil {
- t.Fatalf("proto.Unmarshal: %v", err)
- }
- t.Logf("m2: %v", m2)
-
- if !proto.Equal(m, m2) {
- t.Errorf("proto.Equal returned false:\n m: %v\nm2: %v", m, m2)
- }
-}
-
-func TestGettersForBasicTypesExist(t *testing.T) {
- var m pb.Message
- if got := m.GetNested().GetBunny(); got != "" {
- t.Errorf("m.GetNested().GetBunny() = %q, want empty string", got)
- }
- if got := m.GetNested().GetCute(); got {
- t.Errorf("m.GetNested().GetCute() = %t, want false", got)
- }
-}
-
-func TestProto3SetDefaults(t *testing.T) {
- in := &pb.Message{
- Terrain: map[string]*pb.Nested{
- "meadow": new(pb.Nested),
- },
- Proto2Field: new(tpb.SubDefaults),
- Proto2Value: map[string]*tpb.SubDefaults{
- "badlands": new(tpb.SubDefaults),
- },
- }
-
- got := proto.Clone(in).(*pb.Message)
- proto.SetDefaults(got)
-
- // There are no defaults in proto3. Everything should be the zero value, but
- // we need to remember to set defaults for nested proto2 messages.
- want := &pb.Message{
- Terrain: map[string]*pb.Nested{
- "meadow": new(pb.Nested),
- },
- Proto2Field: &tpb.SubDefaults{N: proto.Int64(7)},
- Proto2Value: map[string]*tpb.SubDefaults{
- "badlands": {N: proto.Int64(7)},
- },
- }
-
- if !proto.Equal(got, want) {
- t.Errorf("with in = %v\nproto.SetDefaults(in) =>\ngot %v\nwant %v", in, got, want)
- }
-}
diff --git a/vendor/github.com/gogo/protobuf/proto/size2_test.go b/vendor/github.com/gogo/protobuf/proto/size2_test.go
deleted file mode 100644
index a2729c39a..000000000
--- a/vendor/github.com/gogo/protobuf/proto/size2_test.go
+++ /dev/null
@@ -1,63 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2012 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-import (
- "testing"
-)
-
-// This is a separate file and package from size_test.go because that one uses
-// generated messages and thus may not be in package proto without having a circular
-// dependency, whereas this file tests unexported details of size.go.
-
-func TestVarintSize(t *testing.T) {
- // Check the edge cases carefully.
- testCases := []struct {
- n uint64
- size int
- }{
- {0, 1},
- {1, 1},
- {127, 1},
- {128, 2},
- {16383, 2},
- {16384, 3},
- {1<<63 - 1, 9},
- {1 << 63, 10},
- }
- for _, tc := range testCases {
- size := sizeVarint(tc.n)
- if size != tc.size {
- t.Errorf("sizeVarint(%d) = %d, want %d", tc.n, size, tc.size)
- }
- }
-}
diff --git a/vendor/github.com/gogo/protobuf/proto/size_test.go b/vendor/github.com/gogo/protobuf/proto/size_test.go
deleted file mode 100644
index 0a6c1772b..000000000
--- a/vendor/github.com/gogo/protobuf/proto/size_test.go
+++ /dev/null
@@ -1,164 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2012 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto_test
-
-import (
- "log"
- "strings"
- "testing"
-
- . "github.com/gogo/protobuf/proto"
- proto3pb "github.com/gogo/protobuf/proto/proto3_proto"
- pb "github.com/gogo/protobuf/proto/testdata"
-)
-
-var messageWithExtension1 = &pb.MyMessage{Count: Int32(7)}
-
-// messageWithExtension2 is in equal_test.go.
-var messageWithExtension3 = &pb.MyMessage{Count: Int32(8)}
-
-func init() {
- if err := SetExtension(messageWithExtension1, pb.E_Ext_More, &pb.Ext{Data: String("Abbott")}); err != nil {
- log.Panicf("SetExtension: %v", err)
- }
- if err := SetExtension(messageWithExtension3, pb.E_Ext_More, &pb.Ext{Data: String("Costello")}); err != nil {
- log.Panicf("SetExtension: %v", err)
- }
-
- // Force messageWithExtension3 to have the extension encoded.
- Marshal(messageWithExtension3)
-
-}
-
-var SizeTests = []struct {
- desc string
- pb Message
-}{
- {"empty", &pb.OtherMessage{}},
- // Basic types.
- {"bool", &pb.Defaults{F_Bool: Bool(true)}},
- {"int32", &pb.Defaults{F_Int32: Int32(12)}},
- {"negative int32", &pb.Defaults{F_Int32: Int32(-1)}},
- {"small int64", &pb.Defaults{F_Int64: Int64(1)}},
- {"big int64", &pb.Defaults{F_Int64: Int64(1 << 20)}},
- {"negative int64", &pb.Defaults{F_Int64: Int64(-1)}},
- {"fixed32", &pb.Defaults{F_Fixed32: Uint32(71)}},
- {"fixed64", &pb.Defaults{F_Fixed64: Uint64(72)}},
- {"uint32", &pb.Defaults{F_Uint32: Uint32(123)}},
- {"uint64", &pb.Defaults{F_Uint64: Uint64(124)}},
- {"float", &pb.Defaults{F_Float: Float32(12.6)}},
- {"double", &pb.Defaults{F_Double: Float64(13.9)}},
- {"string", &pb.Defaults{F_String: String("niles")}},
- {"bytes", &pb.Defaults{F_Bytes: []byte("wowsa")}},
- {"bytes, empty", &pb.Defaults{F_Bytes: []byte{}}},
- {"sint32", &pb.Defaults{F_Sint32: Int32(65)}},
- {"sint64", &pb.Defaults{F_Sint64: Int64(67)}},
- {"enum", &pb.Defaults{F_Enum: pb.Defaults_BLUE.Enum()}},
- // Repeated.
- {"empty repeated bool", &pb.MoreRepeated{Bools: []bool{}}},
- {"repeated bool", &pb.MoreRepeated{Bools: []bool{false, true, true, false}}},
- {"packed repeated bool", &pb.MoreRepeated{BoolsPacked: []bool{false, true, true, false, true, true, true}}},
- {"repeated int32", &pb.MoreRepeated{Ints: []int32{1, 12203, 1729, -1}}},
- {"repeated int32 packed", &pb.MoreRepeated{IntsPacked: []int32{1, 12203, 1729}}},
- {"repeated int64 packed", &pb.MoreRepeated{Int64SPacked: []int64{
- // Need enough large numbers to verify that the header is counting the number of bytes
- // for the field, not the number of elements.
- 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62,
- 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62,
- }}},
- {"repeated string", &pb.MoreRepeated{Strings: []string{"r", "ken", "gri"}}},
- {"repeated fixed", &pb.MoreRepeated{Fixeds: []uint32{1, 2, 3, 4}}},
- // Nested.
- {"nested", &pb.OldMessage{Nested: &pb.OldMessage_Nested{Name: String("whatever")}}},
- {"group", &pb.GroupOld{G: &pb.GroupOld_G{X: Int32(12345)}}},
- // Other things.
- {"unrecognized", &pb.MoreRepeated{XXX_unrecognized: []byte{13<<3 | 0, 4}}},
- {"extension (unencoded)", messageWithExtension1},
- {"extension (encoded)", messageWithExtension3},
- // proto3 message
- {"proto3 empty", &proto3pb.Message{}},
- {"proto3 bool", &proto3pb.Message{TrueScotsman: true}},
- {"proto3 int64", &proto3pb.Message{ResultCount: 1}},
- {"proto3 uint32", &proto3pb.Message{HeightInCm: 123}},
- {"proto3 float", &proto3pb.Message{Score: 12.6}},
- {"proto3 string", &proto3pb.Message{Name: "Snezana"}},
- {"proto3 bytes", &proto3pb.Message{Data: []byte("wowsa")}},
- {"proto3 bytes, empty", &proto3pb.Message{Data: []byte{}}},
- {"proto3 enum", &proto3pb.Message{Hilarity: proto3pb.Message_PUNS}},
- {"proto3 map field with empty bytes", &proto3pb.MessageWithMap{ByteMapping: map[bool][]byte{false: {}}}},
-
- {"map field", &pb.MessageWithMap{NameMapping: map[int32]string{1: "Rob", 7: "Andrew"}}},
- {"map field with message", &pb.MessageWithMap{MsgMapping: map[int64]*pb.FloatingPoint{0x7001: {F: Float64(2.0)}}}},
- {"map field with bytes", &pb.MessageWithMap{ByteMapping: map[bool][]byte{true: []byte("this time for sure")}}},
- {"map field with empty bytes", &pb.MessageWithMap{ByteMapping: map[bool][]byte{true: {}}}},
-
- {"map field with big entry", &pb.MessageWithMap{NameMapping: map[int32]string{8: strings.Repeat("x", 125)}}},
- {"map field with big key and val", &pb.MessageWithMap{StrToStr: map[string]string{strings.Repeat("x", 70): strings.Repeat("y", 70)}}},
- {"map field with big numeric key", &pb.MessageWithMap{NameMapping: map[int32]string{0xf00d: "om nom nom"}}},
-
- {"oneof not set", &pb.Oneof{}},
- {"oneof bool", &pb.Oneof{Union: &pb.Oneof_F_Bool{F_Bool: true}}},
- {"oneof zero int32", &pb.Oneof{Union: &pb.Oneof_F_Int32{F_Int32: 0}}},
- {"oneof big int32", &pb.Oneof{Union: &pb.Oneof_F_Int32{F_Int32: 1 << 20}}},
- {"oneof int64", &pb.Oneof{Union: &pb.Oneof_F_Int64{F_Int64: 42}}},
- {"oneof fixed32", &pb.Oneof{Union: &pb.Oneof_F_Fixed32{F_Fixed32: 43}}},
- {"oneof fixed64", &pb.Oneof{Union: &pb.Oneof_F_Fixed64{F_Fixed64: 44}}},
- {"oneof uint32", &pb.Oneof{Union: &pb.Oneof_F_Uint32{F_Uint32: 45}}},
- {"oneof uint64", &pb.Oneof{Union: &pb.Oneof_F_Uint64{F_Uint64: 46}}},
- {"oneof float", &pb.Oneof{Union: &pb.Oneof_F_Float{F_Float: 47.1}}},
- {"oneof double", &pb.Oneof{Union: &pb.Oneof_F_Double{F_Double: 48.9}}},
- {"oneof string", &pb.Oneof{Union: &pb.Oneof_F_String{F_String: "Rhythmic Fman"}}},
- {"oneof bytes", &pb.Oneof{Union: &pb.Oneof_F_Bytes{F_Bytes: []byte("let go")}}},
- {"oneof sint32", &pb.Oneof{Union: &pb.Oneof_F_Sint32{F_Sint32: 50}}},
- {"oneof sint64", &pb.Oneof{Union: &pb.Oneof_F_Sint64{F_Sint64: 51}}},
- {"oneof enum", &pb.Oneof{Union: &pb.Oneof_F_Enum{F_Enum: pb.MyMessage_BLUE}}},
- {"message for oneof", &pb.GoTestField{Label: String("k"), Type: String("v")}},
- {"oneof message", &pb.Oneof{Union: &pb.Oneof_F_Message{F_Message: &pb.GoTestField{Label: String("k"), Type: String("v")}}}},
- {"oneof group", &pb.Oneof{Union: &pb.Oneof_FGroup{FGroup: &pb.Oneof_F_Group{X: Int32(52)}}}},
- {"oneof largest tag", &pb.Oneof{Union: &pb.Oneof_F_Largest_Tag{F_Largest_Tag: 1}}},
- {"multiple oneofs", &pb.Oneof{Union: &pb.Oneof_F_Int32{F_Int32: 1}, Tormato: &pb.Oneof_Value{Value: 2}}},
-}
-
-func TestSize(t *testing.T) {
- for _, tc := range SizeTests {
- size := Size(tc.pb)
- b, err := Marshal(tc.pb)
- if err != nil {
- t.Errorf("%v: Marshal failed: %v", tc.desc, err)
- continue
- }
- if size != len(b) {
- t.Errorf("%v: Size(%v) = %d, want %d", tc.desc, tc.pb, size, len(b))
- t.Logf("%v: bytes: %#v", tc.desc, b)
- }
- }
-}
diff --git a/vendor/github.com/gogo/protobuf/proto/text_parser_test.go b/vendor/github.com/gogo/protobuf/proto/text_parser_test.go
deleted file mode 100644
index 9a3a447ce..000000000
--- a/vendor/github.com/gogo/protobuf/proto/text_parser_test.go
+++ /dev/null
@@ -1,673 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto_test
-
-import (
- "math"
- "reflect"
- "testing"
-
- . "github.com/gogo/protobuf/proto"
- proto3pb "github.com/gogo/protobuf/proto/proto3_proto"
- . "github.com/gogo/protobuf/proto/testdata"
-)
-
-type UnmarshalTextTest struct {
- in string
- err string // if "", no error expected
- out *MyMessage
-}
-
-func buildExtStructTest(text string) UnmarshalTextTest {
- msg := &MyMessage{
- Count: Int32(42),
- }
- SetExtension(msg, E_Ext_More, &Ext{
- Data: String("Hello, world!"),
- })
- return UnmarshalTextTest{in: text, out: msg}
-}
-
-func buildExtDataTest(text string) UnmarshalTextTest {
- msg := &MyMessage{
- Count: Int32(42),
- }
- SetExtension(msg, E_Ext_Text, String("Hello, world!"))
- SetExtension(msg, E_Ext_Number, Int32(1729))
- return UnmarshalTextTest{in: text, out: msg}
-}
-
-func buildExtRepStringTest(text string) UnmarshalTextTest {
- msg := &MyMessage{
- Count: Int32(42),
- }
- if err := SetExtension(msg, E_Greeting, []string{"bula", "hola"}); err != nil {
- panic(err)
- }
- return UnmarshalTextTest{in: text, out: msg}
-}
-
-var unMarshalTextTests = []UnmarshalTextTest{
- // Basic
- {
- in: " count:42\n name:\"Dave\" ",
- out: &MyMessage{
- Count: Int32(42),
- Name: String("Dave"),
- },
- },
-
- // Empty quoted string
- {
- in: `count:42 name:""`,
- out: &MyMessage{
- Count: Int32(42),
- Name: String(""),
- },
- },
-
- // Quoted string concatenation with double quotes
- {
- in: `count:42 name: "My name is "` + "\n" + `"elsewhere"`,
- out: &MyMessage{
- Count: Int32(42),
- Name: String("My name is elsewhere"),
- },
- },
-
- // Quoted string concatenation with single quotes
- {
- in: "count:42 name: 'My name is '\n'elsewhere'",
- out: &MyMessage{
- Count: Int32(42),
- Name: String("My name is elsewhere"),
- },
- },
-
- // Quoted string concatenations with mixed quotes
- {
- in: "count:42 name: 'My name is '\n\"elsewhere\"",
- out: &MyMessage{
- Count: Int32(42),
- Name: String("My name is elsewhere"),
- },
- },
- {
- in: "count:42 name: \"My name is \"\n'elsewhere'",
- out: &MyMessage{
- Count: Int32(42),
- Name: String("My name is elsewhere"),
- },
- },
-
- // Quoted string with escaped apostrophe
- {
- in: `count:42 name: "HOLIDAY - New Year\'s Day"`,
- out: &MyMessage{
- Count: Int32(42),
- Name: String("HOLIDAY - New Year's Day"),
- },
- },
-
- // Quoted string with single quote
- {
- in: `count:42 name: 'Roger "The Ramster" Ramjet'`,
- out: &MyMessage{
- Count: Int32(42),
- Name: String(`Roger "The Ramster" Ramjet`),
- },
- },
-
- // Quoted string with all the accepted special characters from the C++ test
- {
- in: `count:42 name: ` + "\"\\\"A string with \\' characters \\n and \\r newlines and \\t tabs and \\001 slashes \\\\ and multiple spaces\"",
- out: &MyMessage{
- Count: Int32(42),
- Name: String("\"A string with ' characters \n and \r newlines and \t tabs and \001 slashes \\ and multiple spaces"),
- },
- },
-
- // Quoted string with quoted backslash
- {
- in: `count:42 name: "\\'xyz"`,
- out: &MyMessage{
- Count: Int32(42),
- Name: String(`\'xyz`),
- },
- },
-
- // Quoted string with UTF-8 bytes.
- {
- in: "count:42 name: '\303\277\302\201\xAB'",
- out: &MyMessage{
- Count: Int32(42),
- Name: String("\303\277\302\201\xAB"),
- },
- },
-
- // Bad quoted string
- {
- in: `inner: < host: "\0" >` + "\n",
- err: `line 1.15: invalid quoted string "\0": \0 requires 2 following digits`,
- },
-
- // Number too large for int64
- {
- in: "count: 1 others { key: 123456789012345678901 }",
- err: "line 1.23: invalid int64: 123456789012345678901",
- },
-
- // Number too large for int32
- {
- in: "count: 1234567890123",
- err: "line 1.7: invalid int32: 1234567890123",
- },
-
- // Number in hexadecimal
- {
- in: "count: 0x2beef",
- out: &MyMessage{
- Count: Int32(0x2beef),
- },
- },
-
- // Number in octal
- {
- in: "count: 024601",
- out: &MyMessage{
- Count: Int32(024601),
- },
- },
-
- // Floating point number with "f" suffix
- {
- in: "count: 4 others:< weight: 17.0f >",
- out: &MyMessage{
- Count: Int32(4),
- Others: []*OtherMessage{
- {
- Weight: Float32(17),
- },
- },
- },
- },
-
- // Floating point positive infinity
- {
- in: "count: 4 bigfloat: inf",
- out: &MyMessage{
- Count: Int32(4),
- Bigfloat: Float64(math.Inf(1)),
- },
- },
-
- // Floating point negative infinity
- {
- in: "count: 4 bigfloat: -inf",
- out: &MyMessage{
- Count: Int32(4),
- Bigfloat: Float64(math.Inf(-1)),
- },
- },
-
- // Number too large for float32
- {
- in: "others:< weight: 12345678901234567890123456789012345678901234567890 >",
- err: "line 1.17: invalid float32: 12345678901234567890123456789012345678901234567890",
- },
-
- // Number posing as a quoted string
- {
- in: `inner: < host: 12 >` + "\n",
- err: `line 1.15: invalid string: 12`,
- },
-
- // Quoted string posing as int32
- {
- in: `count: "12"`,
- err: `line 1.7: invalid int32: "12"`,
- },
-
- // Quoted string posing a float32
- {
- in: `others:< weight: "17.4" >`,
- err: `line 1.17: invalid float32: "17.4"`,
- },
-
- // Enum
- {
- in: `count:42 bikeshed: BLUE`,
- out: &MyMessage{
- Count: Int32(42),
- Bikeshed: MyMessage_BLUE.Enum(),
- },
- },
-
- // Repeated field
- {
- in: `count:42 pet: "horsey" pet:"bunny"`,
- out: &MyMessage{
- Count: Int32(42),
- Pet: []string{"horsey", "bunny"},
- },
- },
-
- // Repeated field with list notation
- {
- in: `count:42 pet: ["horsey", "bunny"]`,
- out: &MyMessage{
- Count: Int32(42),
- Pet: []string{"horsey", "bunny"},
- },
- },
-
- // Repeated message with/without colon and <>/{}
- {
- in: `count:42 others:{} others{} others:<> others:{}`,
- out: &MyMessage{
- Count: Int32(42),
- Others: []*OtherMessage{
- {},
- {},
- {},
- {},
- },
- },
- },
-
- // Missing colon for inner message
- {
- in: `count:42 inner < host: "cauchy.syd" >`,
- out: &MyMessage{
- Count: Int32(42),
- Inner: &InnerMessage{
- Host: String("cauchy.syd"),
- },
- },
- },
-
- // Missing colon for string field
- {
- in: `name "Dave"`,
- err: `line 1.5: expected ':', found "\"Dave\""`,
- },
-
- // Missing colon for int32 field
- {
- in: `count 42`,
- err: `line 1.6: expected ':', found "42"`,
- },
-
- // Missing required field
- {
- in: `name: "Pawel"`,
- err: `proto: required field "testdata.MyMessage.count" not set`,
- out: &MyMessage{
- Name: String("Pawel"),
- },
- },
-
- // Missing required field in a required submessage
- {
- in: `count: 42 we_must_go_deeper < leo_finally_won_an_oscar <> >`,
- err: `proto: required field "testdata.InnerMessage.host" not set`,
- out: &MyMessage{
- Count: Int32(42),
- WeMustGoDeeper: &RequiredInnerMessage{LeoFinallyWonAnOscar: &InnerMessage{}},
- },
- },
-
- // Repeated non-repeated field
- {
- in: `name: "Rob" name: "Russ"`,
- err: `line 1.12: non-repeated field "name" was repeated`,
- },
-
- // Group
- {
- in: `count: 17 SomeGroup { group_field: 12 }`,
- out: &MyMessage{
- Count: Int32(17),
- Somegroup: &MyMessage_SomeGroup{
- GroupField: Int32(12),
- },
- },
- },
-
- // Semicolon between fields
- {
- in: `count:3;name:"Calvin"`,
- out: &MyMessage{
- Count: Int32(3),
- Name: String("Calvin"),
- },
- },
- // Comma between fields
- {
- in: `count:4,name:"Ezekiel"`,
- out: &MyMessage{
- Count: Int32(4),
- Name: String("Ezekiel"),
- },
- },
-
- // Boolean false
- {
- in: `count:42 inner { host: "example.com" connected: false }`,
- out: &MyMessage{
- Count: Int32(42),
- Inner: &InnerMessage{
- Host: String("example.com"),
- Connected: Bool(false),
- },
- },
- },
- // Boolean true
- {
- in: `count:42 inner { host: "example.com" connected: true }`,
- out: &MyMessage{
- Count: Int32(42),
- Inner: &InnerMessage{
- Host: String("example.com"),
- Connected: Bool(true),
- },
- },
- },
- // Boolean 0
- {
- in: `count:42 inner { host: "example.com" connected: 0 }`,
- out: &MyMessage{
- Count: Int32(42),
- Inner: &InnerMessage{
- Host: String("example.com"),
- Connected: Bool(false),
- },
- },
- },
- // Boolean 1
- {
- in: `count:42 inner { host: "example.com" connected: 1 }`,
- out: &MyMessage{
- Count: Int32(42),
- Inner: &InnerMessage{
- Host: String("example.com"),
- Connected: Bool(true),
- },
- },
- },
- // Boolean f
- {
- in: `count:42 inner { host: "example.com" connected: f }`,
- out: &MyMessage{
- Count: Int32(42),
- Inner: &InnerMessage{
- Host: String("example.com"),
- Connected: Bool(false),
- },
- },
- },
- // Boolean t
- {
- in: `count:42 inner { host: "example.com" connected: t }`,
- out: &MyMessage{
- Count: Int32(42),
- Inner: &InnerMessage{
- Host: String("example.com"),
- Connected: Bool(true),
- },
- },
- },
- // Boolean False
- {
- in: `count:42 inner { host: "example.com" connected: False }`,
- out: &MyMessage{
- Count: Int32(42),
- Inner: &InnerMessage{
- Host: String("example.com"),
- Connected: Bool(false),
- },
- },
- },
- // Boolean True
- {
- in: `count:42 inner { host: "example.com" connected: True }`,
- out: &MyMessage{
- Count: Int32(42),
- Inner: &InnerMessage{
- Host: String("example.com"),
- Connected: Bool(true),
- },
- },
- },
-
- // Extension
- buildExtStructTest(`count: 42 [testdata.Ext.more]:<data:"Hello, world!" >`),
- buildExtStructTest(`count: 42 [testdata.Ext.more] {data:"Hello, world!"}`),
- buildExtDataTest(`count: 42 [testdata.Ext.text]:"Hello, world!" [testdata.Ext.number]:1729`),
- buildExtRepStringTest(`count: 42 [testdata.greeting]:"bula" [testdata.greeting]:"hola"`),
-
- // Big all-in-one
- {
- in: "count:42 # Meaning\n" +
- `name:"Dave" ` +
- `quote:"\"I didn't want to go.\"" ` +
- `pet:"bunny" ` +
- `pet:"kitty" ` +
- `pet:"horsey" ` +
- `inner:<` +
- ` host:"footrest.syd" ` +
- ` port:7001 ` +
- ` connected:true ` +
- `> ` +
- `others:<` +
- ` key:3735928559 ` +
- ` value:"\x01A\a\f" ` +
- `> ` +
- `others:<` +
- " weight:58.9 # Atomic weight of Co\n" +
- ` inner:<` +
- ` host:"lesha.mtv" ` +
- ` port:8002 ` +
- ` >` +
- `>`,
- out: &MyMessage{
- Count: Int32(42),
- Name: String("Dave"),
- Quote: String(`"I didn't want to go."`),
- Pet: []string{"bunny", "kitty", "horsey"},
- Inner: &InnerMessage{
- Host: String("footrest.syd"),
- Port: Int32(7001),
- Connected: Bool(true),
- },
- Others: []*OtherMessage{
- {
- Key: Int64(3735928559),
- Value: []byte{0x1, 'A', '\a', '\f'},
- },
- {
- Weight: Float32(58.9),
- Inner: &InnerMessage{
- Host: String("lesha.mtv"),
- Port: Int32(8002),
- },
- },
- },
- },
- },
-}
-
-func TestUnmarshalText(t *testing.T) {
- for i, test := range unMarshalTextTests {
- pb := new(MyMessage)
- err := UnmarshalText(test.in, pb)
- if test.err == "" {
- // We don't expect failure.
- if err != nil {
- t.Errorf("Test %d: Unexpected error: %v", i, err)
- } else if !reflect.DeepEqual(pb, test.out) {
- t.Errorf("Test %d: Incorrect populated \nHave: %v\nWant: %v",
- i, pb, test.out)
- }
- } else {
- // We do expect failure.
- if err == nil {
- t.Errorf("Test %d: Didn't get expected error: %v", i, test.err)
- } else if err.Error() != test.err {
- t.Errorf("Test %d: Incorrect error.\nHave: %v\nWant: %v",
- i, err.Error(), test.err)
- } else if _, ok := err.(*RequiredNotSetError); ok && test.out != nil && !reflect.DeepEqual(pb, test.out) {
- t.Errorf("Test %d: Incorrect populated \nHave: %v\nWant: %v",
- i, pb, test.out)
- }
- }
- }
-}
-
-func TestUnmarshalTextCustomMessage(t *testing.T) {
- msg := &textMessage{}
- if err := UnmarshalText("custom", msg); err != nil {
- t.Errorf("Unexpected error from custom unmarshal: %v", err)
- }
- if UnmarshalText("not custom", msg) == nil {
- t.Errorf("Didn't get expected error from custom unmarshal")
- }
-}
-
-// Regression test; this caused a panic.
-func TestRepeatedEnum(t *testing.T) {
- pb := new(RepeatedEnum)
- if err := UnmarshalText("color: RED", pb); err != nil {
- t.Fatal(err)
- }
- exp := &RepeatedEnum{
- Color: []RepeatedEnum_Color{RepeatedEnum_RED},
- }
- if !Equal(pb, exp) {
- t.Errorf("Incorrect populated \nHave: %v\nWant: %v", pb, exp)
- }
-}
-
-func TestProto3TextParsing(t *testing.T) {
- m := new(proto3pb.Message)
- const in = `name: "Wallace" true_scotsman: true`
- want := &proto3pb.Message{
- Name: "Wallace",
- TrueScotsman: true,
- }
- if err := UnmarshalText(in, m); err != nil {
- t.Fatal(err)
- }
- if !Equal(m, want) {
- t.Errorf("\n got %v\nwant %v", m, want)
- }
-}
-
-func TestMapParsing(t *testing.T) {
- m := new(MessageWithMap)
- const in = `name_mapping:<key:1234 value:"Feist"> name_mapping:<key:1 value:"Beatles">` +
- `msg_mapping:<key:-4, value:<f: 2.0>,>` + // separating commas are okay
- `msg_mapping<key:-2 value<f: 4.0>>` + // no colon after "value"
- `msg_mapping:<value:<f: 5.0>>` + // omitted key
- `msg_mapping:<key:1>` + // omitted value
- `byte_mapping:<key:true value:"so be it">` +
- `byte_mapping:<>` // omitted key and value
- want := &MessageWithMap{
- NameMapping: map[int32]string{
- 1: "Beatles",
- 1234: "Feist",
- },
- MsgMapping: map[int64]*FloatingPoint{
- -4: {F: Float64(2.0)},
- -2: {F: Float64(4.0)},
- 0: {F: Float64(5.0)},
- 1: nil,
- },
- ByteMapping: map[bool][]byte{
- false: nil,
- true: []byte("so be it"),
- },
- }
- if err := UnmarshalText(in, m); err != nil {
- t.Fatal(err)
- }
- if !Equal(m, want) {
- t.Errorf("\n got %v\nwant %v", m, want)
- }
-}
-
-func TestOneofParsing(t *testing.T) {
- const in = `name:"Shrek"`
- m := new(Communique)
- want := &Communique{Union: &Communique_Name{Name: "Shrek"}}
- if err := UnmarshalText(in, m); err != nil {
- t.Fatal(err)
- }
- if !Equal(m, want) {
- t.Errorf("\n got %v\nwant %v", m, want)
- }
-
- const inOverwrite = `name:"Shrek" number:42`
- m = new(Communique)
- testErr := "line 1.13: field 'number' would overwrite already parsed oneof 'Union'"
- if err := UnmarshalText(inOverwrite, m); err == nil {
- t.Errorf("TestOneofParsing: Didn't get expected error: %v", testErr)
- } else if err.Error() != testErr {
- t.Errorf("TestOneofParsing: Incorrect error.\nHave: %v\nWant: %v",
- err.Error(), testErr)
- }
-
-}
-
-var benchInput string
-
-func init() {
- benchInput = "count: 4\n"
- for i := 0; i < 1000; i++ {
- benchInput += "pet: \"fido\"\n"
- }
-
- // Check it is valid input.
- pb := new(MyMessage)
- err := UnmarshalText(benchInput, pb)
- if err != nil {
- panic("Bad benchmark input: " + err.Error())
- }
-}
-
-func BenchmarkUnmarshalText(b *testing.B) {
- pb := new(MyMessage)
- for i := 0; i < b.N; i++ {
- UnmarshalText(benchInput, pb)
- }
- b.SetBytes(int64(len(benchInput)))
-}
diff --git a/vendor/github.com/gogo/protobuf/proto/text_test.go b/vendor/github.com/gogo/protobuf/proto/text_test.go
deleted file mode 100644
index 27df6cb9b..000000000
--- a/vendor/github.com/gogo/protobuf/proto/text_test.go
+++ /dev/null
@@ -1,474 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto_test
-
-import (
- "bytes"
- "errors"
- "io/ioutil"
- "math"
- "strings"
- "testing"
-
- "github.com/gogo/protobuf/proto"
-
- proto3pb "github.com/gogo/protobuf/proto/proto3_proto"
- pb "github.com/gogo/protobuf/proto/testdata"
-)
-
-// textMessage implements the methods that allow it to marshal and unmarshal
-// itself as text.
-type textMessage struct {
-}
-
-func (*textMessage) MarshalText() ([]byte, error) {
- return []byte("custom"), nil
-}
-
-func (*textMessage) UnmarshalText(bytes []byte) error {
- if string(bytes) != "custom" {
- return errors.New("expected 'custom'")
- }
- return nil
-}
-
-func (*textMessage) Reset() {}
-func (*textMessage) String() string { return "" }
-func (*textMessage) ProtoMessage() {}
-
-func newTestMessage() *pb.MyMessage {
- msg := &pb.MyMessage{
- Count: proto.Int32(42),
- Name: proto.String("Dave"),
- Quote: proto.String(`"I didn't want to go."`),
- Pet: []string{"bunny", "kitty", "horsey"},
- Inner: &pb.InnerMessage{
- Host: proto.String("footrest.syd"),
- Port: proto.Int32(7001),
- Connected: proto.Bool(true),
- },
- Others: []*pb.OtherMessage{
- {
- Key: proto.Int64(0xdeadbeef),
- Value: []byte{1, 65, 7, 12},
- },
- {
- Weight: proto.Float32(6.022),
- Inner: &pb.InnerMessage{
- Host: proto.String("lesha.mtv"),
- Port: proto.Int32(8002),
- },
- },
- },
- Bikeshed: pb.MyMessage_BLUE.Enum(),
- Somegroup: &pb.MyMessage_SomeGroup{
- GroupField: proto.Int32(8),
- },
- // One normally wouldn't do this.
- // This is an undeclared tag 13, as a varint (wire type 0) with value 4.
- XXX_unrecognized: []byte{13<<3 | 0, 4},
- }
- ext := &pb.Ext{
- Data: proto.String("Big gobs for big rats"),
- }
- if err := proto.SetExtension(msg, pb.E_Ext_More, ext); err != nil {
- panic(err)
- }
- greetings := []string{"adg", "easy", "cow"}
- if err := proto.SetExtension(msg, pb.E_Greeting, greetings); err != nil {
- panic(err)
- }
-
- // Add an unknown extension. We marshal a pb.Ext, and fake the ID.
- b, err := proto.Marshal(&pb.Ext{Data: proto.String("3G skiing")})
- if err != nil {
- panic(err)
- }
- b = append(proto.EncodeVarint(201<<3|proto.WireBytes), b...)
- proto.SetRawExtension(msg, 201, b)
-
- // Extensions can be plain fields, too, so let's test that.
- b = append(proto.EncodeVarint(202<<3|proto.WireVarint), 19)
- proto.SetRawExtension(msg, 202, b)
-
- return msg
-}
-
-const text = `count: 42
-name: "Dave"
-quote: "\"I didn't want to go.\""
-pet: "bunny"
-pet: "kitty"
-pet: "horsey"
-inner: <
- host: "footrest.syd"
- port: 7001
- connected: true
->
-others: <
- key: 3735928559
- value: "\001A\007\014"
->
-others: <
- weight: 6.022
- inner: <
- host: "lesha.mtv"
- port: 8002
- >
->
-bikeshed: BLUE
-SomeGroup {
- group_field: 8
-}
-/* 2 unknown bytes */
-13: 4
-[testdata.Ext.more]: <
- data: "Big gobs for big rats"
->
-[testdata.greeting]: "adg"
-[testdata.greeting]: "easy"
-[testdata.greeting]: "cow"
-/* 13 unknown bytes */
-201: "\t3G skiing"
-/* 3 unknown bytes */
-202: 19
-`
-
-func TestMarshalText(t *testing.T) {
- buf := new(bytes.Buffer)
- if err := proto.MarshalText(buf, newTestMessage()); err != nil {
- t.Fatalf("proto.MarshalText: %v", err)
- }
- s := buf.String()
- if s != text {
- t.Errorf("Got:\n===\n%v===\nExpected:\n===\n%v===\n", s, text)
- }
-}
-
-func TestMarshalTextCustomMessage(t *testing.T) {
- buf := new(bytes.Buffer)
- if err := proto.MarshalText(buf, &textMessage{}); err != nil {
- t.Fatalf("proto.MarshalText: %v", err)
- }
- s := buf.String()
- if s != "custom" {
- t.Errorf("Got %q, expected %q", s, "custom")
- }
-}
-func TestMarshalTextNil(t *testing.T) {
- want := "<nil>"
- tests := []proto.Message{nil, (*pb.MyMessage)(nil)}
- for i, test := range tests {
- buf := new(bytes.Buffer)
- if err := proto.MarshalText(buf, test); err != nil {
- t.Fatal(err)
- }
- if got := buf.String(); got != want {
- t.Errorf("%d: got %q want %q", i, got, want)
- }
- }
-}
-
-func TestMarshalTextUnknownEnum(t *testing.T) {
- // The Color enum only specifies values 0-2.
- m := &pb.MyMessage{Bikeshed: pb.MyMessage_Color(3).Enum()}
- got := m.String()
- const want = `bikeshed:3 `
- if got != want {
- t.Errorf("\n got %q\nwant %q", got, want)
- }
-}
-
-func TestTextOneof(t *testing.T) {
- tests := []struct {
- m proto.Message
- want string
- }{
- // zero message
- {&pb.Communique{}, ``},
- // scalar field
- {&pb.Communique{Union: &pb.Communique_Number{Number: 4}}, `number:4`},
- // message field
- {&pb.Communique{Union: &pb.Communique_Msg{
- Msg: &pb.Strings{StringField: proto.String("why hello!")},
- }}, `msg:<string_field:"why hello!" >`},
- // bad oneof (should not panic)
- {&pb.Communique{Union: &pb.Communique_Msg{Msg: nil}}, `msg:/* nil */`},
- }
- for _, test := range tests {
- got := strings.TrimSpace(test.m.String())
- if got != test.want {
- t.Errorf("\n got %s\nwant %s", got, test.want)
- }
- }
-}
-
-func BenchmarkMarshalTextBuffered(b *testing.B) {
- buf := new(bytes.Buffer)
- m := newTestMessage()
- for i := 0; i < b.N; i++ {
- buf.Reset()
- proto.MarshalText(buf, m)
- }
-}
-
-func BenchmarkMarshalTextUnbuffered(b *testing.B) {
- w := ioutil.Discard
- m := newTestMessage()
- for i := 0; i < b.N; i++ {
- proto.MarshalText(w, m)
- }
-}
-
-func compact(src string) string {
- // s/[ \n]+/ /g; s/ $//;
- dst := make([]byte, len(src))
- space, comment := false, false
- j := 0
- for i := 0; i < len(src); i++ {
- if strings.HasPrefix(src[i:], "/*") {
- comment = true
- i++
- continue
- }
- if comment && strings.HasPrefix(src[i:], "*/") {
- comment = false
- i++
- continue
- }
- if comment {
- continue
- }
- c := src[i]
- if c == ' ' || c == '\n' {
- space = true
- continue
- }
- if j > 0 && (dst[j-1] == ':' || dst[j-1] == '<' || dst[j-1] == '{') {
- space = false
- }
- if c == '{' {
- space = false
- }
- if space {
- dst[j] = ' '
- j++
- space = false
- }
- dst[j] = c
- j++
- }
- if space {
- dst[j] = ' '
- j++
- }
- return string(dst[0:j])
-}
-
-var compactText = compact(text)
-
-func TestCompactText(t *testing.T) {
- s := proto.CompactTextString(newTestMessage())
- if s != compactText {
- t.Errorf("Got:\n===\n%v===\nExpected:\n===\n%v\n===\n", s, compactText)
- }
-}
-
-func TestStringEscaping(t *testing.T) {
- testCases := []struct {
- in *pb.Strings
- out string
- }{
- {
- // Test data from C++ test (TextFormatTest.StringEscape).
- // Single divergence: we don't escape apostrophes.
- &pb.Strings{StringField: proto.String("\"A string with ' characters \n and \r newlines and \t tabs and \001 slashes \\ and multiple spaces")},
- "string_field: \"\\\"A string with ' characters \\n and \\r newlines and \\t tabs and \\001 slashes \\\\ and multiple spaces\"\n",
- },
- {
- // Test data from the same C++ test.
- &pb.Strings{StringField: proto.String("\350\260\267\346\255\214")},
- "string_field: \"\\350\\260\\267\\346\\255\\214\"\n",
- },
- {
- // Some UTF-8.
- &pb.Strings{StringField: proto.String("\x00\x01\xff\x81")},
- `string_field: "\000\001\377\201"` + "\n",
- },
- }
-
- for i, tc := range testCases {
- var buf bytes.Buffer
- if err := proto.MarshalText(&buf, tc.in); err != nil {
- t.Errorf("proto.MarsalText: %v", err)
- continue
- }
- s := buf.String()
- if s != tc.out {
- t.Errorf("#%d: Got:\n%s\nExpected:\n%s\n", i, s, tc.out)
- continue
- }
-
- // Check round-trip.
- pbStrings := new(pb.Strings)
- if err := proto.UnmarshalText(s, pbStrings); err != nil {
- t.Errorf("#%d: UnmarshalText: %v", i, err)
- continue
- }
- if !proto.Equal(pbStrings, tc.in) {
- t.Errorf("#%d: Round-trip failed:\nstart: %v\n end: %v", i, tc.in, pbStrings)
- }
- }
-}
-
-// A limitedWriter accepts some output before it fails.
-// This is a proxy for something like a nearly-full or imminently-failing disk,
-// or a network connection that is about to die.
-type limitedWriter struct {
- b bytes.Buffer
- limit int
-}
-
-var outOfSpace = errors.New("proto: insufficient space")
-
-func (w *limitedWriter) Write(p []byte) (n int, err error) {
- var avail = w.limit - w.b.Len()
- if avail <= 0 {
- return 0, outOfSpace
- }
- if len(p) <= avail {
- return w.b.Write(p)
- }
- n, _ = w.b.Write(p[:avail])
- return n, outOfSpace
-}
-
-func TestMarshalTextFailing(t *testing.T) {
- // Try lots of different sizes to exercise more error code-paths.
- for lim := 0; lim < len(text); lim++ {
- buf := new(limitedWriter)
- buf.limit = lim
- err := proto.MarshalText(buf, newTestMessage())
- // We expect a certain error, but also some partial results in the buffer.
- if err != outOfSpace {
- t.Errorf("Got:\n===\n%v===\nExpected:\n===\n%v===\n", err, outOfSpace)
- }
- s := buf.b.String()
- x := text[:buf.limit]
- if s != x {
- t.Errorf("Got:\n===\n%v===\nExpected:\n===\n%v===\n", s, x)
- }
- }
-}
-
-func TestFloats(t *testing.T) {
- tests := []struct {
- f float64
- want string
- }{
- {0, "0"},
- {4.7, "4.7"},
- {math.Inf(1), "inf"},
- {math.Inf(-1), "-inf"},
- {math.NaN(), "nan"},
- }
- for _, test := range tests {
- msg := &pb.FloatingPoint{F: &test.f}
- got := strings.TrimSpace(msg.String())
- want := `f:` + test.want
- if got != want {
- t.Errorf("f=%f: got %q, want %q", test.f, got, want)
- }
- }
-}
-
-func TestRepeatedNilText(t *testing.T) {
- m := &pb.MessageList{
- Message: []*pb.MessageList_Message{
- nil,
- {
- Name: proto.String("Horse"),
- },
- nil,
- },
- }
- want := `Message <nil>
-Message {
- name: "Horse"
-}
-Message <nil>
-`
- if s := proto.MarshalTextString(m); s != want {
- t.Errorf(" got: %s\nwant: %s", s, want)
- }
-}
-
-func TestProto3Text(t *testing.T) {
- tests := []struct {
- m proto.Message
- want string
- }{
- // zero message
- {&proto3pb.Message{}, ``},
- // zero message except for an empty byte slice
- {&proto3pb.Message{Data: []byte{}}, ``},
- // trivial case
- {&proto3pb.Message{Name: "Rob", HeightInCm: 175}, `name:"Rob" height_in_cm:175`},
- // empty map
- {&pb.MessageWithMap{}, ``},
- // non-empty map; map format is the same as a repeated struct,
- // and they are sorted by key (numerically for numeric keys).
- {
- &pb.MessageWithMap{NameMapping: map[int32]string{
- -1: "Negatory",
- 7: "Lucky",
- 1234: "Feist",
- 6345789: "Otis",
- }},
- `name_mapping:<key:-1 value:"Negatory" > ` +
- `name_mapping:<key:7 value:"Lucky" > ` +
- `name_mapping:<key:1234 value:"Feist" > ` +
- `name_mapping:<key:6345789 value:"Otis" >`,
- },
- // map with nil value; not well-defined, but we shouldn't crash
- {
- &pb.MessageWithMap{MsgMapping: map[int64]*pb.FloatingPoint{7: nil}},
- `msg_mapping:<key:7 >`,
- },
- }
- for _, test := range tests {
- got := strings.TrimSpace(test.m.String())
- if got != test.want {
- t.Errorf("\n got %s\nwant %s", got, test.want)
- }
- }
-}
diff --git a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor_test.go b/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor_test.go
deleted file mode 100644
index d4248b483..000000000
--- a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor_test.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package descriptor_test
-
-import (
- "fmt"
- "testing"
-
- tpb "github.com/gogo/protobuf/proto/testdata"
- "github.com/gogo/protobuf/protoc-gen-gogo/descriptor"
-)
-
-func TestMessage(t *testing.T) {
- var msg *descriptor.DescriptorProto
- fd, md := descriptor.ForMessage(msg)
- if pkg, want := fd.GetPackage(), "google.protobuf"; pkg != want {
- t.Errorf("descriptor.ForMessage(%T).GetPackage() = %q; want %q", msg, pkg, want)
- }
- if name, want := md.GetName(), "DescriptorProto"; name != want {
- t.Fatalf("descriptor.ForMessage(%T).GetName() = %q; want %q", msg, name, want)
- }
-}
-
-func Example_Options() {
- var msg *tpb.MyMessageSet
- _, md := descriptor.ForMessage(msg)
- if md.GetOptions().GetMessageSetWireFormat() {
- fmt.Printf("%v uses option message_set_wire_format.\n", md.GetName())
- }
-
- // Output:
- // MyMessageSet uses option message_set_wire_format.
-}
diff --git a/vendor/github.com/golang/glog/glog_test.go b/vendor/github.com/golang/glog/glog_test.go
deleted file mode 100644
index 0fb376e1f..000000000
--- a/vendor/github.com/golang/glog/glog_test.go
+++ /dev/null
@@ -1,415 +0,0 @@
-// Go support for leveled logs, analogous to https://code.google.com/p/google-glog/
-//
-// Copyright 2013 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package glog
-
-import (
- "bytes"
- "fmt"
- stdLog "log"
- "path/filepath"
- "runtime"
- "strconv"
- "strings"
- "testing"
- "time"
-)
-
-// Test that shortHostname works as advertised.
-func TestShortHostname(t *testing.T) {
- for hostname, expect := range map[string]string{
- "": "",
- "host": "host",
- "host.google.com": "host",
- } {
- if got := shortHostname(hostname); expect != got {
- t.Errorf("shortHostname(%q): expected %q, got %q", hostname, expect, got)
- }
- }
-}
-
-// flushBuffer wraps a bytes.Buffer to satisfy flushSyncWriter.
-type flushBuffer struct {
- bytes.Buffer
-}
-
-func (f *flushBuffer) Flush() error {
- return nil
-}
-
-func (f *flushBuffer) Sync() error {
- return nil
-}
-
-// swap sets the log writers and returns the old array.
-func (l *loggingT) swap(writers [numSeverity]flushSyncWriter) (old [numSeverity]flushSyncWriter) {
- l.mu.Lock()
- defer l.mu.Unlock()
- old = l.file
- for i, w := range writers {
- logging.file[i] = w
- }
- return
-}
-
-// newBuffers sets the log writers to all new byte buffers and returns the old array.
-func (l *loggingT) newBuffers() [numSeverity]flushSyncWriter {
- return l.swap([numSeverity]flushSyncWriter{new(flushBuffer), new(flushBuffer), new(flushBuffer), new(flushBuffer)})
-}
-
-// contents returns the specified log value as a string.
-func contents(s severity) string {
- return logging.file[s].(*flushBuffer).String()
-}
-
-// contains reports whether the string is contained in the log.
-func contains(s severity, str string, t *testing.T) bool {
- return strings.Contains(contents(s), str)
-}
-
-// setFlags configures the logging flags how the test expects them.
-func setFlags() {
- logging.toStderr = false
-}
-
-// Test that Info works as advertised.
-func TestInfo(t *testing.T) {
- setFlags()
- defer logging.swap(logging.newBuffers())
- Info("test")
- if !contains(infoLog, "I", t) {
- t.Errorf("Info has wrong character: %q", contents(infoLog))
- }
- if !contains(infoLog, "test", t) {
- t.Error("Info failed")
- }
-}
-
-func TestInfoDepth(t *testing.T) {
- setFlags()
- defer logging.swap(logging.newBuffers())
-
- f := func() { InfoDepth(1, "depth-test1") }
-
- // The next three lines must stay together
- _, _, wantLine, _ := runtime.Caller(0)
- InfoDepth(0, "depth-test0")
- f()
-
- msgs := strings.Split(strings.TrimSuffix(contents(infoLog), "\n"), "\n")
- if len(msgs) != 2 {
- t.Fatalf("Got %d lines, expected 2", len(msgs))
- }
-
- for i, m := range msgs {
- if !strings.HasPrefix(m, "I") {
- t.Errorf("InfoDepth[%d] has wrong character: %q", i, m)
- }
- w := fmt.Sprintf("depth-test%d", i)
- if !strings.Contains(m, w) {
- t.Errorf("InfoDepth[%d] missing %q: %q", i, w, m)
- }
-
- // pull out the line number (between : and ])
- msg := m[strings.LastIndex(m, ":")+1:]
- x := strings.Index(msg, "]")
- if x < 0 {
- t.Errorf("InfoDepth[%d]: missing ']': %q", i, m)
- continue
- }
- line, err := strconv.Atoi(msg[:x])
- if err != nil {
- t.Errorf("InfoDepth[%d]: bad line number: %q", i, m)
- continue
- }
- wantLine++
- if wantLine != line {
- t.Errorf("InfoDepth[%d]: got line %d, want %d", i, line, wantLine)
- }
- }
-}
-
-func init() {
- CopyStandardLogTo("INFO")
-}
-
-// Test that CopyStandardLogTo panics on bad input.
-func TestCopyStandardLogToPanic(t *testing.T) {
- defer func() {
- if s, ok := recover().(string); !ok || !strings.Contains(s, "LOG") {
- t.Errorf(`CopyStandardLogTo("LOG") should have panicked: %v`, s)
- }
- }()
- CopyStandardLogTo("LOG")
-}
-
-// Test that using the standard log package logs to INFO.
-func TestStandardLog(t *testing.T) {
- setFlags()
- defer logging.swap(logging.newBuffers())
- stdLog.Print("test")
- if !contains(infoLog, "I", t) {
- t.Errorf("Info has wrong character: %q", contents(infoLog))
- }
- if !contains(infoLog, "test", t) {
- t.Error("Info failed")
- }
-}
-
-// Test that the header has the correct format.
-func TestHeader(t *testing.T) {
- setFlags()
- defer logging.swap(logging.newBuffers())
- defer func(previous func() time.Time) { timeNow = previous }(timeNow)
- timeNow = func() time.Time {
- return time.Date(2006, 1, 2, 15, 4, 5, .067890e9, time.Local)
- }
- pid = 1234
- Info("test")
- var line int
- format := "I0102 15:04:05.067890 1234 glog_test.go:%d] test\n"
- n, err := fmt.Sscanf(contents(infoLog), format, &line)
- if n != 1 || err != nil {
- t.Errorf("log format error: %d elements, error %s:\n%s", n, err, contents(infoLog))
- }
- // Scanf treats multiple spaces as equivalent to a single space,
- // so check for correct space-padding also.
- want := fmt.Sprintf(format, line)
- if contents(infoLog) != want {
- t.Errorf("log format error: got:\n\t%q\nwant:\t%q", contents(infoLog), want)
- }
-}
-
-// Test that an Error log goes to Warning and Info.
-// Even in the Info log, the source character will be E, so the data should
-// all be identical.
-func TestError(t *testing.T) {
- setFlags()
- defer logging.swap(logging.newBuffers())
- Error("test")
- if !contains(errorLog, "E", t) {
- t.Errorf("Error has wrong character: %q", contents(errorLog))
- }
- if !contains(errorLog, "test", t) {
- t.Error("Error failed")
- }
- str := contents(errorLog)
- if !contains(warningLog, str, t) {
- t.Error("Warning failed")
- }
- if !contains(infoLog, str, t) {
- t.Error("Info failed")
- }
-}
-
-// Test that a Warning log goes to Info.
-// Even in the Info log, the source character will be W, so the data should
-// all be identical.
-func TestWarning(t *testing.T) {
- setFlags()
- defer logging.swap(logging.newBuffers())
- Warning("test")
- if !contains(warningLog, "W", t) {
- t.Errorf("Warning has wrong character: %q", contents(warningLog))
- }
- if !contains(warningLog, "test", t) {
- t.Error("Warning failed")
- }
- str := contents(warningLog)
- if !contains(infoLog, str, t) {
- t.Error("Info failed")
- }
-}
-
-// Test that a V log goes to Info.
-func TestV(t *testing.T) {
- setFlags()
- defer logging.swap(logging.newBuffers())
- logging.verbosity.Set("2")
- defer logging.verbosity.Set("0")
- V(2).Info("test")
- if !contains(infoLog, "I", t) {
- t.Errorf("Info has wrong character: %q", contents(infoLog))
- }
- if !contains(infoLog, "test", t) {
- t.Error("Info failed")
- }
-}
-
-// Test that a vmodule enables a log in this file.
-func TestVmoduleOn(t *testing.T) {
- setFlags()
- defer logging.swap(logging.newBuffers())
- logging.vmodule.Set("glog_test=2")
- defer logging.vmodule.Set("")
- if !V(1) {
- t.Error("V not enabled for 1")
- }
- if !V(2) {
- t.Error("V not enabled for 2")
- }
- if V(3) {
- t.Error("V enabled for 3")
- }
- V(2).Info("test")
- if !contains(infoLog, "I", t) {
- t.Errorf("Info has wrong character: %q", contents(infoLog))
- }
- if !contains(infoLog, "test", t) {
- t.Error("Info failed")
- }
-}
-
-// Test that a vmodule of another file does not enable a log in this file.
-func TestVmoduleOff(t *testing.T) {
- setFlags()
- defer logging.swap(logging.newBuffers())
- logging.vmodule.Set("notthisfile=2")
- defer logging.vmodule.Set("")
- for i := 1; i <= 3; i++ {
- if V(Level(i)) {
- t.Errorf("V enabled for %d", i)
- }
- }
- V(2).Info("test")
- if contents(infoLog) != "" {
- t.Error("V logged incorrectly")
- }
-}
-
-// vGlobs are patterns that match/don't match this file at V=2.
-var vGlobs = map[string]bool{
- // Easy to test the numeric match here.
- "glog_test=1": false, // If -vmodule sets V to 1, V(2) will fail.
- "glog_test=2": true,
- "glog_test=3": true, // If -vmodule sets V to 1, V(3) will succeed.
- // These all use 2 and check the patterns. All are true.
- "*=2": true,
- "?l*=2": true,
- "????_*=2": true,
- "??[mno]?_*t=2": true,
- // These all use 2 and check the patterns. All are false.
- "*x=2": false,
- "m*=2": false,
- "??_*=2": false,
- "?[abc]?_*t=2": false,
-}
-
-// Test that vmodule globbing works as advertised.
-func testVmoduleGlob(pat string, match bool, t *testing.T) {
- setFlags()
- defer logging.swap(logging.newBuffers())
- defer logging.vmodule.Set("")
- logging.vmodule.Set(pat)
- if V(2) != Verbose(match) {
- t.Errorf("incorrect match for %q: got %t expected %t", pat, V(2), match)
- }
-}
-
-// Test that a vmodule globbing works as advertised.
-func TestVmoduleGlob(t *testing.T) {
- for glob, match := range vGlobs {
- testVmoduleGlob(glob, match, t)
- }
-}
-
-func TestRollover(t *testing.T) {
- setFlags()
- var err error
- defer func(previous func(error)) { logExitFunc = previous }(logExitFunc)
- logExitFunc = func(e error) {
- err = e
- }
- defer func(previous uint64) { MaxSize = previous }(MaxSize)
- MaxSize = 512
-
- Info("x") // Be sure we have a file.
- info, ok := logging.file[infoLog].(*syncBuffer)
- if !ok {
- t.Fatal("info wasn't created")
- }
- if err != nil {
- t.Fatalf("info has initial error: %v", err)
- }
- fname0 := info.file.Name()
- Info(strings.Repeat("x", int(MaxSize))) // force a rollover
- if err != nil {
- t.Fatalf("info has error after big write: %v", err)
- }
-
- // Make sure the next log file gets a file name with a different
- // time stamp.
- //
- // TODO: determine whether we need to support subsecond log
- // rotation. C++ does not appear to handle this case (nor does it
- // handle Daylight Savings Time properly).
- time.Sleep(1 * time.Second)
-
- Info("x") // create a new file
- if err != nil {
- t.Fatalf("error after rotation: %v", err)
- }
- fname1 := info.file.Name()
- if fname0 == fname1 {
- t.Errorf("info.f.Name did not change: %v", fname0)
- }
- if info.nbytes >= MaxSize {
- t.Errorf("file size was not reset: %d", info.nbytes)
- }
-}
-
-func TestLogBacktraceAt(t *testing.T) {
- setFlags()
- defer logging.swap(logging.newBuffers())
- // The peculiar style of this code simplifies line counting and maintenance of the
- // tracing block below.
- var infoLine string
- setTraceLocation := func(file string, line int, ok bool, delta int) {
- if !ok {
- t.Fatal("could not get file:line")
- }
- _, file = filepath.Split(file)
- infoLine = fmt.Sprintf("%s:%d", file, line+delta)
- err := logging.traceLocation.Set(infoLine)
- if err != nil {
- t.Fatal("error setting log_backtrace_at: ", err)
- }
- }
- {
- // Start of tracing block. These lines know about each other's relative position.
- _, file, line, ok := runtime.Caller(0)
- setTraceLocation(file, line, ok, +2) // Two lines between Caller and Info calls.
- Info("we want a stack trace here")
- }
- numAppearances := strings.Count(contents(infoLog), infoLine)
- if numAppearances < 2 {
- // Need 2 appearances, one in the log header and one in the trace:
- // log_test.go:281: I0511 16:36:06.952398 02238 log_test.go:280] we want a stack trace here
- // ...
- // github.com/glog/glog_test.go:280 (0x41ba91)
- // ...
- // We could be more precise but that would require knowing the details
- // of the traceback format, which may not be dependable.
- t.Fatal("got no trace back; log is ", contents(infoLog))
- }
-}
-
-func BenchmarkHeader(b *testing.B) {
- for i := 0; i < b.N; i++ {
- buf, _, _ := logging.header(infoLog, 0)
- logging.putBuffer(buf)
- }
-}
diff --git a/vendor/github.com/golang/protobuf/proto/all_test.go b/vendor/github.com/golang/protobuf/proto/all_test.go
deleted file mode 100644
index 361f72fbd..000000000
--- a/vendor/github.com/golang/protobuf/proto/all_test.go
+++ /dev/null
@@ -1,2410 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto_test
-
-import (
- "bytes"
- "encoding/json"
- "errors"
- "fmt"
- "math"
- "math/rand"
- "reflect"
- "runtime/debug"
- "strings"
- "sync"
- "testing"
- "time"
-
- . "github.com/golang/protobuf/proto"
- . "github.com/golang/protobuf/proto/test_proto"
-)
-
-var globalO *Buffer
-
-func old() *Buffer {
- if globalO == nil {
- globalO = NewBuffer(nil)
- }
- globalO.Reset()
- return globalO
-}
-
-func equalbytes(b1, b2 []byte, t *testing.T) {
- if len(b1) != len(b2) {
- t.Errorf("wrong lengths: 2*%d != %d", len(b1), len(b2))
- return
- }
- for i := 0; i < len(b1); i++ {
- if b1[i] != b2[i] {
- t.Errorf("bad byte[%d]:%x %x: %s %s", i, b1[i], b2[i], b1, b2)
- }
- }
-}
-
-func initGoTestField() *GoTestField {
- f := new(GoTestField)
- f.Label = String("label")
- f.Type = String("type")
- return f
-}
-
-// These are all structurally equivalent but the tag numbers differ.
-// (It's remarkable that required, optional, and repeated all have
-// 8 letters.)
-func initGoTest_RequiredGroup() *GoTest_RequiredGroup {
- return &GoTest_RequiredGroup{
- RequiredField: String("required"),
- }
-}
-
-func initGoTest_OptionalGroup() *GoTest_OptionalGroup {
- return &GoTest_OptionalGroup{
- RequiredField: String("optional"),
- }
-}
-
-func initGoTest_RepeatedGroup() *GoTest_RepeatedGroup {
- return &GoTest_RepeatedGroup{
- RequiredField: String("repeated"),
- }
-}
-
-func initGoTest(setdefaults bool) *GoTest {
- pb := new(GoTest)
- if setdefaults {
- pb.F_BoolDefaulted = Bool(Default_GoTest_F_BoolDefaulted)
- pb.F_Int32Defaulted = Int32(Default_GoTest_F_Int32Defaulted)
- pb.F_Int64Defaulted = Int64(Default_GoTest_F_Int64Defaulted)
- pb.F_Fixed32Defaulted = Uint32(Default_GoTest_F_Fixed32Defaulted)
- pb.F_Fixed64Defaulted = Uint64(Default_GoTest_F_Fixed64Defaulted)
- pb.F_Uint32Defaulted = Uint32(Default_GoTest_F_Uint32Defaulted)
- pb.F_Uint64Defaulted = Uint64(Default_GoTest_F_Uint64Defaulted)
- pb.F_FloatDefaulted = Float32(Default_GoTest_F_FloatDefaulted)
- pb.F_DoubleDefaulted = Float64(Default_GoTest_F_DoubleDefaulted)
- pb.F_StringDefaulted = String(Default_GoTest_F_StringDefaulted)
- pb.F_BytesDefaulted = Default_GoTest_F_BytesDefaulted
- pb.F_Sint32Defaulted = Int32(Default_GoTest_F_Sint32Defaulted)
- pb.F_Sint64Defaulted = Int64(Default_GoTest_F_Sint64Defaulted)
- pb.F_Sfixed32Defaulted = Int32(Default_GoTest_F_Sfixed32Defaulted)
- pb.F_Sfixed64Defaulted = Int64(Default_GoTest_F_Sfixed64Defaulted)
- }
-
- pb.Kind = GoTest_TIME.Enum()
- pb.RequiredField = initGoTestField()
- pb.F_BoolRequired = Bool(true)
- pb.F_Int32Required = Int32(3)
- pb.F_Int64Required = Int64(6)
- pb.F_Fixed32Required = Uint32(32)
- pb.F_Fixed64Required = Uint64(64)
- pb.F_Uint32Required = Uint32(3232)
- pb.F_Uint64Required = Uint64(6464)
- pb.F_FloatRequired = Float32(3232)
- pb.F_DoubleRequired = Float64(6464)
- pb.F_StringRequired = String("string")
- pb.F_BytesRequired = []byte("bytes")
- pb.F_Sint32Required = Int32(-32)
- pb.F_Sint64Required = Int64(-64)
- pb.F_Sfixed32Required = Int32(-32)
- pb.F_Sfixed64Required = Int64(-64)
- pb.Requiredgroup = initGoTest_RequiredGroup()
-
- return pb
-}
-
-func hex(c uint8) uint8 {
- if '0' <= c && c <= '9' {
- return c - '0'
- }
- if 'a' <= c && c <= 'f' {
- return 10 + c - 'a'
- }
- if 'A' <= c && c <= 'F' {
- return 10 + c - 'A'
- }
- return 0
-}
-
-func equal(b []byte, s string, t *testing.T) bool {
- if 2*len(b) != len(s) {
- // fail(fmt.Sprintf("wrong lengths: 2*%d != %d", len(b), len(s)), b, s, t)
- fmt.Printf("wrong lengths: 2*%d != %d\n", len(b), len(s))
- return false
- }
- for i, j := 0, 0; i < len(b); i, j = i+1, j+2 {
- x := hex(s[j])*16 + hex(s[j+1])
- if b[i] != x {
- // fail(fmt.Sprintf("bad byte[%d]:%x %x", i, b[i], x), b, s, t)
- fmt.Printf("bad byte[%d]:%x %x", i, b[i], x)
- return false
- }
- }
- return true
-}
-
-func overify(t *testing.T, pb *GoTest, expected string) {
- o := old()
- err := o.Marshal(pb)
- if err != nil {
- fmt.Printf("overify marshal-1 err = %v", err)
- o.DebugPrint("", o.Bytes())
- t.Fatalf("expected = %s", expected)
- }
- if !equal(o.Bytes(), expected, t) {
- o.DebugPrint("overify neq 1", o.Bytes())
- t.Fatalf("expected = %s", expected)
- }
-
- // Now test Unmarshal by recreating the original buffer.
- pbd := new(GoTest)
- err = o.Unmarshal(pbd)
- if err != nil {
- t.Fatalf("overify unmarshal err = %v", err)
- o.DebugPrint("", o.Bytes())
- t.Fatalf("string = %s", expected)
- }
- o.Reset()
- err = o.Marshal(pbd)
- if err != nil {
- t.Errorf("overify marshal-2 err = %v", err)
- o.DebugPrint("", o.Bytes())
- t.Fatalf("string = %s", expected)
- }
- if !equal(o.Bytes(), expected, t) {
- o.DebugPrint("overify neq 2", o.Bytes())
- t.Fatalf("string = %s", expected)
- }
-}
-
-// Simple tests for numeric encode/decode primitives (varint, etc.)
-func TestNumericPrimitives(t *testing.T) {
- for i := uint64(0); i < 1e6; i += 111 {
- o := old()
- if o.EncodeVarint(i) != nil {
- t.Error("EncodeVarint")
- break
- }
- x, e := o.DecodeVarint()
- if e != nil {
- t.Fatal("DecodeVarint")
- }
- if x != i {
- t.Fatal("varint decode fail:", i, x)
- }
-
- o = old()
- if o.EncodeFixed32(i) != nil {
- t.Fatal("encFixed32")
- }
- x, e = o.DecodeFixed32()
- if e != nil {
- t.Fatal("decFixed32")
- }
- if x != i {
- t.Fatal("fixed32 decode fail:", i, x)
- }
-
- o = old()
- if o.EncodeFixed64(i*1234567) != nil {
- t.Error("encFixed64")
- break
- }
- x, e = o.DecodeFixed64()
- if e != nil {
- t.Error("decFixed64")
- break
- }
- if x != i*1234567 {
- t.Error("fixed64 decode fail:", i*1234567, x)
- break
- }
-
- o = old()
- i32 := int32(i - 12345)
- if o.EncodeZigzag32(uint64(i32)) != nil {
- t.Fatal("EncodeZigzag32")
- }
- x, e = o.DecodeZigzag32()
- if e != nil {
- t.Fatal("DecodeZigzag32")
- }
- if x != uint64(uint32(i32)) {
- t.Fatal("zigzag32 decode fail:", i32, x)
- }
-
- o = old()
- i64 := int64(i - 12345)
- if o.EncodeZigzag64(uint64(i64)) != nil {
- t.Fatal("EncodeZigzag64")
- }
- x, e = o.DecodeZigzag64()
- if e != nil {
- t.Fatal("DecodeZigzag64")
- }
- if x != uint64(i64) {
- t.Fatal("zigzag64 decode fail:", i64, x)
- }
- }
-}
-
-// fakeMarshaler is a simple struct implementing Marshaler and Message interfaces.
-type fakeMarshaler struct {
- b []byte
- err error
-}
-
-func (f *fakeMarshaler) Marshal() ([]byte, error) { return f.b, f.err }
-func (f *fakeMarshaler) String() string { return fmt.Sprintf("Bytes: %v Error: %v", f.b, f.err) }
-func (f *fakeMarshaler) ProtoMessage() {}
-func (f *fakeMarshaler) Reset() {}
-
-type msgWithFakeMarshaler struct {
- M *fakeMarshaler `protobuf:"bytes,1,opt,name=fake"`
-}
-
-func (m *msgWithFakeMarshaler) String() string { return CompactTextString(m) }
-func (m *msgWithFakeMarshaler) ProtoMessage() {}
-func (m *msgWithFakeMarshaler) Reset() {}
-
-// Simple tests for proto messages that implement the Marshaler interface.
-func TestMarshalerEncoding(t *testing.T) {
- tests := []struct {
- name string
- m Message
- want []byte
- errType reflect.Type
- }{
- {
- name: "Marshaler that fails",
- m: &fakeMarshaler{
- err: errors.New("some marshal err"),
- b: []byte{5, 6, 7},
- },
- // Since the Marshal method returned bytes, they should be written to the
- // buffer. (For efficiency, we assume that Marshal implementations are
- // always correct w.r.t. RequiredNotSetError and output.)
- want: []byte{5, 6, 7},
- errType: reflect.TypeOf(errors.New("some marshal err")),
- },
- {
- name: "Marshaler that fails with RequiredNotSetError",
- m: &msgWithFakeMarshaler{
- M: &fakeMarshaler{
- err: &RequiredNotSetError{},
- b: []byte{5, 6, 7},
- },
- },
- // Since there's an error that can be continued after,
- // the buffer should be written.
- want: []byte{
- 10, 3, // for &msgWithFakeMarshaler
- 5, 6, 7, // for &fakeMarshaler
- },
- errType: reflect.TypeOf(&RequiredNotSetError{}),
- },
- {
- name: "Marshaler that succeeds",
- m: &fakeMarshaler{
- b: []byte{0, 1, 2, 3, 4, 127, 255},
- },
- want: []byte{0, 1, 2, 3, 4, 127, 255},
- },
- }
- for _, test := range tests {
- b := NewBuffer(nil)
- err := b.Marshal(test.m)
- if reflect.TypeOf(err) != test.errType {
- t.Errorf("%s: got err %T(%v) wanted %T", test.name, err, err, test.errType)
- }
- if !reflect.DeepEqual(test.want, b.Bytes()) {
- t.Errorf("%s: got bytes %v wanted %v", test.name, b.Bytes(), test.want)
- }
- if size := Size(test.m); size != len(b.Bytes()) {
- t.Errorf("%s: Size(_) = %v, but marshaled to %v bytes", test.name, size, len(b.Bytes()))
- }
-
- m, mErr := Marshal(test.m)
- if !bytes.Equal(b.Bytes(), m) {
- t.Errorf("%s: Marshal returned %v, but (*Buffer).Marshal wrote %v", test.name, m, b.Bytes())
- }
- if !reflect.DeepEqual(err, mErr) {
- t.Errorf("%s: Marshal err = %q, but (*Buffer).Marshal returned %q",
- test.name, fmt.Sprint(mErr), fmt.Sprint(err))
- }
- }
-}
-
-// Ensure that Buffer.Marshal uses O(N) memory for N messages
-func TestBufferMarshalAllocs(t *testing.T) {
- value := &OtherMessage{Key: Int64(1)}
- msg := &MyMessage{Count: Int32(1), Others: []*OtherMessage{value}}
-
- reallocSize := func(t *testing.T, items int, prealloc int) (int64, int64) {
- var b Buffer
- b.SetBuf(make([]byte, 0, prealloc))
-
- var allocSpace int64
- prevCap := cap(b.Bytes())
- for i := 0; i < items; i++ {
- err := b.Marshal(msg)
- if err != nil {
- t.Errorf("Marshal err = %q", err)
- break
- }
- if c := cap(b.Bytes()); prevCap != c {
- allocSpace += int64(c)
- prevCap = c
- }
- }
- needSpace := int64(len(b.Bytes()))
- return allocSpace, needSpace
- }
-
- for _, prealloc := range []int{0, 100, 10000} {
- for _, items := range []int{1, 2, 5, 10, 20, 50, 100, 200, 500, 1000} {
- runtimeSpace, need := reallocSize(t, items, prealloc)
- totalSpace := int64(prealloc) + runtimeSpace
-
- runtimeRatio := float64(runtimeSpace) / float64(need)
- totalRatio := float64(totalSpace) / float64(need)
-
- if totalRatio < 1 || runtimeRatio > 4 {
- t.Errorf("needed %dB, allocated %dB total (ratio %.1f), allocated %dB at runtime (ratio %.1f)",
- need, totalSpace, totalRatio, runtimeSpace, runtimeRatio)
- }
- }
- }
-}
-
-// Simple tests for bytes
-func TestBytesPrimitives(t *testing.T) {
- o := old()
- bytes := []byte{'n', 'o', 'w', ' ', 'i', 's', ' ', 't', 'h', 'e', ' ', 't', 'i', 'm', 'e'}
- if o.EncodeRawBytes(bytes) != nil {
- t.Error("EncodeRawBytes")
- }
- decb, e := o.DecodeRawBytes(false)
- if e != nil {
- t.Error("DecodeRawBytes")
- }
- equalbytes(bytes, decb, t)
-}
-
-// Simple tests for strings
-func TestStringPrimitives(t *testing.T) {
- o := old()
- s := "now is the time"
- if o.EncodeStringBytes(s) != nil {
- t.Error("enc_string")
- }
- decs, e := o.DecodeStringBytes()
- if e != nil {
- t.Error("dec_string")
- }
- if s != decs {
- t.Error("string encode/decode fail:", s, decs)
- }
-}
-
-// Do we catch the "required bit not set" case?
-func TestRequiredBit(t *testing.T) {
- o := old()
- pb := new(GoTest)
- err := o.Marshal(pb)
- if err == nil {
- t.Error("did not catch missing required fields")
- } else if !strings.Contains(err.Error(), "Kind") {
- t.Error("wrong error type:", err)
- }
-}
-
-// Check that all fields are nil.
-// Clearly silly, and a residue from a more interesting test with an earlier,
-// different initialization property, but it once caught a compiler bug so
-// it lives.
-func checkInitialized(pb *GoTest, t *testing.T) {
- if pb.F_BoolDefaulted != nil {
- t.Error("New or Reset did not set boolean:", *pb.F_BoolDefaulted)
- }
- if pb.F_Int32Defaulted != nil {
- t.Error("New or Reset did not set int32:", *pb.F_Int32Defaulted)
- }
- if pb.F_Int64Defaulted != nil {
- t.Error("New or Reset did not set int64:", *pb.F_Int64Defaulted)
- }
- if pb.F_Fixed32Defaulted != nil {
- t.Error("New or Reset did not set fixed32:", *pb.F_Fixed32Defaulted)
- }
- if pb.F_Fixed64Defaulted != nil {
- t.Error("New or Reset did not set fixed64:", *pb.F_Fixed64Defaulted)
- }
- if pb.F_Uint32Defaulted != nil {
- t.Error("New or Reset did not set uint32:", *pb.F_Uint32Defaulted)
- }
- if pb.F_Uint64Defaulted != nil {
- t.Error("New or Reset did not set uint64:", *pb.F_Uint64Defaulted)
- }
- if pb.F_FloatDefaulted != nil {
- t.Error("New or Reset did not set float:", *pb.F_FloatDefaulted)
- }
- if pb.F_DoubleDefaulted != nil {
- t.Error("New or Reset did not set double:", *pb.F_DoubleDefaulted)
- }
- if pb.F_StringDefaulted != nil {
- t.Error("New or Reset did not set string:", *pb.F_StringDefaulted)
- }
- if pb.F_BytesDefaulted != nil {
- t.Error("New or Reset did not set bytes:", string(pb.F_BytesDefaulted))
- }
- if pb.F_Sint32Defaulted != nil {
- t.Error("New or Reset did not set int32:", *pb.F_Sint32Defaulted)
- }
- if pb.F_Sint64Defaulted != nil {
- t.Error("New or Reset did not set int64:", *pb.F_Sint64Defaulted)
- }
-}
-
-// Does Reset() reset?
-func TestReset(t *testing.T) {
- pb := initGoTest(true)
- // muck with some values
- pb.F_BoolDefaulted = Bool(false)
- pb.F_Int32Defaulted = Int32(237)
- pb.F_Int64Defaulted = Int64(12346)
- pb.F_Fixed32Defaulted = Uint32(32000)
- pb.F_Fixed64Defaulted = Uint64(666)
- pb.F_Uint32Defaulted = Uint32(323232)
- pb.F_Uint64Defaulted = nil
- pb.F_FloatDefaulted = nil
- pb.F_DoubleDefaulted = Float64(0)
- pb.F_StringDefaulted = String("gotcha")
- pb.F_BytesDefaulted = []byte("asdfasdf")
- pb.F_Sint32Defaulted = Int32(123)
- pb.F_Sint64Defaulted = Int64(789)
- pb.Reset()
- checkInitialized(pb, t)
-}
-
-// All required fields set, no defaults provided.
-func TestEncodeDecode1(t *testing.T) {
- pb := initGoTest(false)
- overify(t, pb,
- "0807"+ // field 1, encoding 0, value 7
- "220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField)
- "5001"+ // field 10, encoding 0, value 1
- "5803"+ // field 11, encoding 0, value 3
- "6006"+ // field 12, encoding 0, value 6
- "6d20000000"+ // field 13, encoding 5, value 0x20
- "714000000000000000"+ // field 14, encoding 1, value 0x40
- "78a019"+ // field 15, encoding 0, value 0xca0 = 3232
- "8001c032"+ // field 16, encoding 0, value 0x1940 = 6464
- "8d0100004a45"+ // field 17, encoding 5, value 3232.0
- "9101000000000040b940"+ // field 18, encoding 1, value 6464.0
- "9a0106"+"737472696e67"+ // field 19, encoding 2, string "string"
- "b304"+ // field 70, encoding 3, start group
- "ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required"
- "b404"+ // field 70, encoding 4, end group
- "aa0605"+"6279746573"+ // field 101, encoding 2, string "bytes"
- "b0063f"+ // field 102, encoding 0, 0x3f zigzag32
- "b8067f"+ // field 103, encoding 0, 0x7f zigzag64
- "c506e0ffffff"+ // field 104, encoding 5, -32 fixed32
- "c906c0ffffffffffffff") // field 105, encoding 1, -64 fixed64
-}
-
-// All required fields set, defaults provided.
-func TestEncodeDecode2(t *testing.T) {
- pb := initGoTest(true)
- overify(t, pb,
- "0807"+ // field 1, encoding 0, value 7
- "220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField)
- "5001"+ // field 10, encoding 0, value 1
- "5803"+ // field 11, encoding 0, value 3
- "6006"+ // field 12, encoding 0, value 6
- "6d20000000"+ // field 13, encoding 5, value 32
- "714000000000000000"+ // field 14, encoding 1, value 64
- "78a019"+ // field 15, encoding 0, value 3232
- "8001c032"+ // field 16, encoding 0, value 6464
- "8d0100004a45"+ // field 17, encoding 5, value 3232.0
- "9101000000000040b940"+ // field 18, encoding 1, value 6464.0
- "9a0106"+"737472696e67"+ // field 19, encoding 2 string "string"
- "c00201"+ // field 40, encoding 0, value 1
- "c80220"+ // field 41, encoding 0, value 32
- "d00240"+ // field 42, encoding 0, value 64
- "dd0240010000"+ // field 43, encoding 5, value 320
- "e1028002000000000000"+ // field 44, encoding 1, value 640
- "e8028019"+ // field 45, encoding 0, value 3200
- "f0028032"+ // field 46, encoding 0, value 6400
- "fd02e0659948"+ // field 47, encoding 5, value 314159.0
- "81030000000050971041"+ // field 48, encoding 1, value 271828.0
- "8a0310"+"68656c6c6f2c2022776f726c6421220a"+ // field 49, encoding 2 string "hello, \"world!\"\n"
- "b304"+ // start group field 70 level 1
- "ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required"
- "b404"+ // end group field 70 level 1
- "aa0605"+"6279746573"+ // field 101, encoding 2 string "bytes"
- "b0063f"+ // field 102, encoding 0, 0x3f zigzag32
- "b8067f"+ // field 103, encoding 0, 0x7f zigzag64
- "c506e0ffffff"+ // field 104, encoding 5, -32 fixed32
- "c906c0ffffffffffffff"+ // field 105, encoding 1, -64 fixed64
- "8a1907"+"4269676e6f7365"+ // field 401, encoding 2, string "Bignose"
- "90193f"+ // field 402, encoding 0, value 63
- "98197f"+ // field 403, encoding 0, value 127
- "a519e0ffffff"+ // field 404, encoding 5, -32 fixed32
- "a919c0ffffffffffffff") // field 405, encoding 1, -64 fixed64
-
-}
-
-// All default fields set to their default value by hand
-func TestEncodeDecode3(t *testing.T) {
- pb := initGoTest(false)
- pb.F_BoolDefaulted = Bool(true)
- pb.F_Int32Defaulted = Int32(32)
- pb.F_Int64Defaulted = Int64(64)
- pb.F_Fixed32Defaulted = Uint32(320)
- pb.F_Fixed64Defaulted = Uint64(640)
- pb.F_Uint32Defaulted = Uint32(3200)
- pb.F_Uint64Defaulted = Uint64(6400)
- pb.F_FloatDefaulted = Float32(314159)
- pb.F_DoubleDefaulted = Float64(271828)
- pb.F_StringDefaulted = String("hello, \"world!\"\n")
- pb.F_BytesDefaulted = []byte("Bignose")
- pb.F_Sint32Defaulted = Int32(-32)
- pb.F_Sint64Defaulted = Int64(-64)
- pb.F_Sfixed32Defaulted = Int32(-32)
- pb.F_Sfixed64Defaulted = Int64(-64)
-
- overify(t, pb,
- "0807"+ // field 1, encoding 0, value 7
- "220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField)
- "5001"+ // field 10, encoding 0, value 1
- "5803"+ // field 11, encoding 0, value 3
- "6006"+ // field 12, encoding 0, value 6
- "6d20000000"+ // field 13, encoding 5, value 32
- "714000000000000000"+ // field 14, encoding 1, value 64
- "78a019"+ // field 15, encoding 0, value 3232
- "8001c032"+ // field 16, encoding 0, value 6464
- "8d0100004a45"+ // field 17, encoding 5, value 3232.0
- "9101000000000040b940"+ // field 18, encoding 1, value 6464.0
- "9a0106"+"737472696e67"+ // field 19, encoding 2 string "string"
- "c00201"+ // field 40, encoding 0, value 1
- "c80220"+ // field 41, encoding 0, value 32
- "d00240"+ // field 42, encoding 0, value 64
- "dd0240010000"+ // field 43, encoding 5, value 320
- "e1028002000000000000"+ // field 44, encoding 1, value 640
- "e8028019"+ // field 45, encoding 0, value 3200
- "f0028032"+ // field 46, encoding 0, value 6400
- "fd02e0659948"+ // field 47, encoding 5, value 314159.0
- "81030000000050971041"+ // field 48, encoding 1, value 271828.0
- "8a0310"+"68656c6c6f2c2022776f726c6421220a"+ // field 49, encoding 2 string "hello, \"world!\"\n"
- "b304"+ // start group field 70 level 1
- "ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required"
- "b404"+ // end group field 70 level 1
- "aa0605"+"6279746573"+ // field 101, encoding 2 string "bytes"
- "b0063f"+ // field 102, encoding 0, 0x3f zigzag32
- "b8067f"+ // field 103, encoding 0, 0x7f zigzag64
- "c506e0ffffff"+ // field 104, encoding 5, -32 fixed32
- "c906c0ffffffffffffff"+ // field 105, encoding 1, -64 fixed64
- "8a1907"+"4269676e6f7365"+ // field 401, encoding 2, string "Bignose"
- "90193f"+ // field 402, encoding 0, value 63
- "98197f"+ // field 403, encoding 0, value 127
- "a519e0ffffff"+ // field 404, encoding 5, -32 fixed32
- "a919c0ffffffffffffff") // field 405, encoding 1, -64 fixed64
-
-}
-
-// All required fields set, defaults provided, all non-defaulted optional fields have values.
-func TestEncodeDecode4(t *testing.T) {
- pb := initGoTest(true)
- pb.Table = String("hello")
- pb.Param = Int32(7)
- pb.OptionalField = initGoTestField()
- pb.F_BoolOptional = Bool(true)
- pb.F_Int32Optional = Int32(32)
- pb.F_Int64Optional = Int64(64)
- pb.F_Fixed32Optional = Uint32(3232)
- pb.F_Fixed64Optional = Uint64(6464)
- pb.F_Uint32Optional = Uint32(323232)
- pb.F_Uint64Optional = Uint64(646464)
- pb.F_FloatOptional = Float32(32.)
- pb.F_DoubleOptional = Float64(64.)
- pb.F_StringOptional = String("hello")
- pb.F_BytesOptional = []byte("Bignose")
- pb.F_Sint32Optional = Int32(-32)
- pb.F_Sint64Optional = Int64(-64)
- pb.F_Sfixed32Optional = Int32(-32)
- pb.F_Sfixed64Optional = Int64(-64)
- pb.Optionalgroup = initGoTest_OptionalGroup()
-
- overify(t, pb,
- "0807"+ // field 1, encoding 0, value 7
- "1205"+"68656c6c6f"+ // field 2, encoding 2, string "hello"
- "1807"+ // field 3, encoding 0, value 7
- "220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField)
- "320d"+"0a056c6162656c120474797065"+ // field 6, encoding 2 (GoTestField)
- "5001"+ // field 10, encoding 0, value 1
- "5803"+ // field 11, encoding 0, value 3
- "6006"+ // field 12, encoding 0, value 6
- "6d20000000"+ // field 13, encoding 5, value 32
- "714000000000000000"+ // field 14, encoding 1, value 64
- "78a019"+ // field 15, encoding 0, value 3232
- "8001c032"+ // field 16, encoding 0, value 6464
- "8d0100004a45"+ // field 17, encoding 5, value 3232.0
- "9101000000000040b940"+ // field 18, encoding 1, value 6464.0
- "9a0106"+"737472696e67"+ // field 19, encoding 2 string "string"
- "f00101"+ // field 30, encoding 0, value 1
- "f80120"+ // field 31, encoding 0, value 32
- "800240"+ // field 32, encoding 0, value 64
- "8d02a00c0000"+ // field 33, encoding 5, value 3232
- "91024019000000000000"+ // field 34, encoding 1, value 6464
- "9802a0dd13"+ // field 35, encoding 0, value 323232
- "a002c0ba27"+ // field 36, encoding 0, value 646464
- "ad0200000042"+ // field 37, encoding 5, value 32.0
- "b1020000000000005040"+ // field 38, encoding 1, value 64.0
- "ba0205"+"68656c6c6f"+ // field 39, encoding 2, string "hello"
- "c00201"+ // field 40, encoding 0, value 1
- "c80220"+ // field 41, encoding 0, value 32
- "d00240"+ // field 42, encoding 0, value 64
- "dd0240010000"+ // field 43, encoding 5, value 320
- "e1028002000000000000"+ // field 44, encoding 1, value 640
- "e8028019"+ // field 45, encoding 0, value 3200
- "f0028032"+ // field 46, encoding 0, value 6400
- "fd02e0659948"+ // field 47, encoding 5, value 314159.0
- "81030000000050971041"+ // field 48, encoding 1, value 271828.0
- "8a0310"+"68656c6c6f2c2022776f726c6421220a"+ // field 49, encoding 2 string "hello, \"world!\"\n"
- "b304"+ // start group field 70 level 1
- "ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required"
- "b404"+ // end group field 70 level 1
- "d305"+ // start group field 90 level 1
- "da0508"+"6f7074696f6e616c"+ // field 91, encoding 2, string "optional"
- "d405"+ // end group field 90 level 1
- "aa0605"+"6279746573"+ // field 101, encoding 2 string "bytes"
- "b0063f"+ // field 102, encoding 0, 0x3f zigzag32
- "b8067f"+ // field 103, encoding 0, 0x7f zigzag64
- "c506e0ffffff"+ // field 104, encoding 5, -32 fixed32
- "c906c0ffffffffffffff"+ // field 105, encoding 1, -64 fixed64
- "ea1207"+"4269676e6f7365"+ // field 301, encoding 2, string "Bignose"
- "f0123f"+ // field 302, encoding 0, value 63
- "f8127f"+ // field 303, encoding 0, value 127
- "8513e0ffffff"+ // field 304, encoding 5, -32 fixed32
- "8913c0ffffffffffffff"+ // field 305, encoding 1, -64 fixed64
- "8a1907"+"4269676e6f7365"+ // field 401, encoding 2, string "Bignose"
- "90193f"+ // field 402, encoding 0, value 63
- "98197f"+ // field 403, encoding 0, value 127
- "a519e0ffffff"+ // field 404, encoding 5, -32 fixed32
- "a919c0ffffffffffffff") // field 405, encoding 1, -64 fixed64
-
-}
-
-// All required fields set, defaults provided, all repeated fields given two values.
-func TestEncodeDecode5(t *testing.T) {
- pb := initGoTest(true)
- pb.RepeatedField = []*GoTestField{initGoTestField(), initGoTestField()}
- pb.F_BoolRepeated = []bool{false, true}
- pb.F_Int32Repeated = []int32{32, 33}
- pb.F_Int64Repeated = []int64{64, 65}
- pb.F_Fixed32Repeated = []uint32{3232, 3333}
- pb.F_Fixed64Repeated = []uint64{6464, 6565}
- pb.F_Uint32Repeated = []uint32{323232, 333333}
- pb.F_Uint64Repeated = []uint64{646464, 656565}
- pb.F_FloatRepeated = []float32{32., 33.}
- pb.F_DoubleRepeated = []float64{64., 65.}
- pb.F_StringRepeated = []string{"hello", "sailor"}
- pb.F_BytesRepeated = [][]byte{[]byte("big"), []byte("nose")}
- pb.F_Sint32Repeated = []int32{32, -32}
- pb.F_Sint64Repeated = []int64{64, -64}
- pb.F_Sfixed32Repeated = []int32{32, -32}
- pb.F_Sfixed64Repeated = []int64{64, -64}
- pb.Repeatedgroup = []*GoTest_RepeatedGroup{initGoTest_RepeatedGroup(), initGoTest_RepeatedGroup()}
-
- overify(t, pb,
- "0807"+ // field 1, encoding 0, value 7
- "220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField)
- "2a0d"+"0a056c6162656c120474797065"+ // field 5, encoding 2 (GoTestField)
- "2a0d"+"0a056c6162656c120474797065"+ // field 5, encoding 2 (GoTestField)
- "5001"+ // field 10, encoding 0, value 1
- "5803"+ // field 11, encoding 0, value 3
- "6006"+ // field 12, encoding 0, value 6
- "6d20000000"+ // field 13, encoding 5, value 32
- "714000000000000000"+ // field 14, encoding 1, value 64
- "78a019"+ // field 15, encoding 0, value 3232
- "8001c032"+ // field 16, encoding 0, value 6464
- "8d0100004a45"+ // field 17, encoding 5, value 3232.0
- "9101000000000040b940"+ // field 18, encoding 1, value 6464.0
- "9a0106"+"737472696e67"+ // field 19, encoding 2 string "string"
- "a00100"+ // field 20, encoding 0, value 0
- "a00101"+ // field 20, encoding 0, value 1
- "a80120"+ // field 21, encoding 0, value 32
- "a80121"+ // field 21, encoding 0, value 33
- "b00140"+ // field 22, encoding 0, value 64
- "b00141"+ // field 22, encoding 0, value 65
- "bd01a00c0000"+ // field 23, encoding 5, value 3232
- "bd01050d0000"+ // field 23, encoding 5, value 3333
- "c1014019000000000000"+ // field 24, encoding 1, value 6464
- "c101a519000000000000"+ // field 24, encoding 1, value 6565
- "c801a0dd13"+ // field 25, encoding 0, value 323232
- "c80195ac14"+ // field 25, encoding 0, value 333333
- "d001c0ba27"+ // field 26, encoding 0, value 646464
- "d001b58928"+ // field 26, encoding 0, value 656565
- "dd0100000042"+ // field 27, encoding 5, value 32.0
- "dd0100000442"+ // field 27, encoding 5, value 33.0
- "e1010000000000005040"+ // field 28, encoding 1, value 64.0
- "e1010000000000405040"+ // field 28, encoding 1, value 65.0
- "ea0105"+"68656c6c6f"+ // field 29, encoding 2, string "hello"
- "ea0106"+"7361696c6f72"+ // field 29, encoding 2, string "sailor"
- "c00201"+ // field 40, encoding 0, value 1
- "c80220"+ // field 41, encoding 0, value 32
- "d00240"+ // field 42, encoding 0, value 64
- "dd0240010000"+ // field 43, encoding 5, value 320
- "e1028002000000000000"+ // field 44, encoding 1, value 640
- "e8028019"+ // field 45, encoding 0, value 3200
- "f0028032"+ // field 46, encoding 0, value 6400
- "fd02e0659948"+ // field 47, encoding 5, value 314159.0
- "81030000000050971041"+ // field 48, encoding 1, value 271828.0
- "8a0310"+"68656c6c6f2c2022776f726c6421220a"+ // field 49, encoding 2 string "hello, \"world!\"\n"
- "b304"+ // start group field 70 level 1
- "ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required"
- "b404"+ // end group field 70 level 1
- "8305"+ // start group field 80 level 1
- "8a0508"+"7265706561746564"+ // field 81, encoding 2, string "repeated"
- "8405"+ // end group field 80 level 1
- "8305"+ // start group field 80 level 1
- "8a0508"+"7265706561746564"+ // field 81, encoding 2, string "repeated"
- "8405"+ // end group field 80 level 1
- "aa0605"+"6279746573"+ // field 101, encoding 2 string "bytes"
- "b0063f"+ // field 102, encoding 0, 0x3f zigzag32
- "b8067f"+ // field 103, encoding 0, 0x7f zigzag64
- "c506e0ffffff"+ // field 104, encoding 5, -32 fixed32
- "c906c0ffffffffffffff"+ // field 105, encoding 1, -64 fixed64
- "ca0c03"+"626967"+ // field 201, encoding 2, string "big"
- "ca0c04"+"6e6f7365"+ // field 201, encoding 2, string "nose"
- "d00c40"+ // field 202, encoding 0, value 32
- "d00c3f"+ // field 202, encoding 0, value -32
- "d80c8001"+ // field 203, encoding 0, value 64
- "d80c7f"+ // field 203, encoding 0, value -64
- "e50c20000000"+ // field 204, encoding 5, 32 fixed32
- "e50ce0ffffff"+ // field 204, encoding 5, -32 fixed32
- "e90c4000000000000000"+ // field 205, encoding 1, 64 fixed64
- "e90cc0ffffffffffffff"+ // field 205, encoding 1, -64 fixed64
- "8a1907"+"4269676e6f7365"+ // field 401, encoding 2, string "Bignose"
- "90193f"+ // field 402, encoding 0, value 63
- "98197f"+ // field 403, encoding 0, value 127
- "a519e0ffffff"+ // field 404, encoding 5, -32 fixed32
- "a919c0ffffffffffffff") // field 405, encoding 1, -64 fixed64
-
-}
-
-// All required fields set, all packed repeated fields given two values.
-func TestEncodeDecode6(t *testing.T) {
- pb := initGoTest(false)
- pb.F_BoolRepeatedPacked = []bool{false, true}
- pb.F_Int32RepeatedPacked = []int32{32, 33}
- pb.F_Int64RepeatedPacked = []int64{64, 65}
- pb.F_Fixed32RepeatedPacked = []uint32{3232, 3333}
- pb.F_Fixed64RepeatedPacked = []uint64{6464, 6565}
- pb.F_Uint32RepeatedPacked = []uint32{323232, 333333}
- pb.F_Uint64RepeatedPacked = []uint64{646464, 656565}
- pb.F_FloatRepeatedPacked = []float32{32., 33.}
- pb.F_DoubleRepeatedPacked = []float64{64., 65.}
- pb.F_Sint32RepeatedPacked = []int32{32, -32}
- pb.F_Sint64RepeatedPacked = []int64{64, -64}
- pb.F_Sfixed32RepeatedPacked = []int32{32, -32}
- pb.F_Sfixed64RepeatedPacked = []int64{64, -64}
-
- overify(t, pb,
- "0807"+ // field 1, encoding 0, value 7
- "220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField)
- "5001"+ // field 10, encoding 0, value 1
- "5803"+ // field 11, encoding 0, value 3
- "6006"+ // field 12, encoding 0, value 6
- "6d20000000"+ // field 13, encoding 5, value 32
- "714000000000000000"+ // field 14, encoding 1, value 64
- "78a019"+ // field 15, encoding 0, value 3232
- "8001c032"+ // field 16, encoding 0, value 6464
- "8d0100004a45"+ // field 17, encoding 5, value 3232.0
- "9101000000000040b940"+ // field 18, encoding 1, value 6464.0
- "9a0106"+"737472696e67"+ // field 19, encoding 2 string "string"
- "9203020001"+ // field 50, encoding 2, 2 bytes, value 0, value 1
- "9a03022021"+ // field 51, encoding 2, 2 bytes, value 32, value 33
- "a203024041"+ // field 52, encoding 2, 2 bytes, value 64, value 65
- "aa0308"+ // field 53, encoding 2, 8 bytes
- "a00c0000050d0000"+ // value 3232, value 3333
- "b20310"+ // field 54, encoding 2, 16 bytes
- "4019000000000000a519000000000000"+ // value 6464, value 6565
- "ba0306"+ // field 55, encoding 2, 6 bytes
- "a0dd1395ac14"+ // value 323232, value 333333
- "c20306"+ // field 56, encoding 2, 6 bytes
- "c0ba27b58928"+ // value 646464, value 656565
- "ca0308"+ // field 57, encoding 2, 8 bytes
- "0000004200000442"+ // value 32.0, value 33.0
- "d20310"+ // field 58, encoding 2, 16 bytes
- "00000000000050400000000000405040"+ // value 64.0, value 65.0
- "b304"+ // start group field 70 level 1
- "ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required"
- "b404"+ // end group field 70 level 1
- "aa0605"+"6279746573"+ // field 101, encoding 2 string "bytes"
- "b0063f"+ // field 102, encoding 0, 0x3f zigzag32
- "b8067f"+ // field 103, encoding 0, 0x7f zigzag64
- "c506e0ffffff"+ // field 104, encoding 5, -32 fixed32
- "c906c0ffffffffffffff"+ // field 105, encoding 1, -64 fixed64
- "b21f02"+ // field 502, encoding 2, 2 bytes
- "403f"+ // value 32, value -32
- "ba1f03"+ // field 503, encoding 2, 3 bytes
- "80017f"+ // value 64, value -64
- "c21f08"+ // field 504, encoding 2, 8 bytes
- "20000000e0ffffff"+ // value 32, value -32
- "ca1f10"+ // field 505, encoding 2, 16 bytes
- "4000000000000000c0ffffffffffffff") // value 64, value -64
-
-}
-
-// Test that we can encode empty bytes fields.
-func TestEncodeDecodeBytes1(t *testing.T) {
- pb := initGoTest(false)
-
- // Create our bytes
- pb.F_BytesRequired = []byte{}
- pb.F_BytesRepeated = [][]byte{{}}
- pb.F_BytesOptional = []byte{}
-
- d, err := Marshal(pb)
- if err != nil {
- t.Error(err)
- }
-
- pbd := new(GoTest)
- if err := Unmarshal(d, pbd); err != nil {
- t.Error(err)
- }
-
- if pbd.F_BytesRequired == nil || len(pbd.F_BytesRequired) != 0 {
- t.Error("required empty bytes field is incorrect")
- }
- if pbd.F_BytesRepeated == nil || len(pbd.F_BytesRepeated) == 1 && pbd.F_BytesRepeated[0] == nil {
- t.Error("repeated empty bytes field is incorrect")
- }
- if pbd.F_BytesOptional == nil || len(pbd.F_BytesOptional) != 0 {
- t.Error("optional empty bytes field is incorrect")
- }
-}
-
-// Test that we encode nil-valued fields of a repeated bytes field correctly.
-// Since entries in a repeated field cannot be nil, nil must mean empty value.
-func TestEncodeDecodeBytes2(t *testing.T) {
- pb := initGoTest(false)
-
- // Create our bytes
- pb.F_BytesRepeated = [][]byte{nil}
-
- d, err := Marshal(pb)
- if err != nil {
- t.Error(err)
- }
-
- pbd := new(GoTest)
- if err := Unmarshal(d, pbd); err != nil {
- t.Error(err)
- }
-
- if len(pbd.F_BytesRepeated) != 1 || pbd.F_BytesRepeated[0] == nil {
- t.Error("Unexpected value for repeated bytes field")
- }
-}
-
-// All required fields set, defaults provided, all repeated fields given two values.
-func TestSkippingUnrecognizedFields(t *testing.T) {
- o := old()
- pb := initGoTestField()
-
- // Marshal it normally.
- o.Marshal(pb)
-
- // Now new a GoSkipTest record.
- skip := &GoSkipTest{
- SkipInt32: Int32(32),
- SkipFixed32: Uint32(3232),
- SkipFixed64: Uint64(6464),
- SkipString: String("skipper"),
- Skipgroup: &GoSkipTest_SkipGroup{
- GroupInt32: Int32(75),
- GroupString: String("wxyz"),
- },
- }
-
- // Marshal it into same buffer.
- o.Marshal(skip)
-
- pbd := new(GoTestField)
- o.Unmarshal(pbd)
-
- // The __unrecognized field should be a marshaling of GoSkipTest
- skipd := new(GoSkipTest)
-
- o.SetBuf(pbd.XXX_unrecognized)
- o.Unmarshal(skipd)
-
- if *skipd.SkipInt32 != *skip.SkipInt32 {
- t.Error("skip int32", skipd.SkipInt32)
- }
- if *skipd.SkipFixed32 != *skip.SkipFixed32 {
- t.Error("skip fixed32", skipd.SkipFixed32)
- }
- if *skipd.SkipFixed64 != *skip.SkipFixed64 {
- t.Error("skip fixed64", skipd.SkipFixed64)
- }
- if *skipd.SkipString != *skip.SkipString {
- t.Error("skip string", *skipd.SkipString)
- }
- if *skipd.Skipgroup.GroupInt32 != *skip.Skipgroup.GroupInt32 {
- t.Error("skip group int32", skipd.Skipgroup.GroupInt32)
- }
- if *skipd.Skipgroup.GroupString != *skip.Skipgroup.GroupString {
- t.Error("skip group string", *skipd.Skipgroup.GroupString)
- }
-}
-
-// Check that unrecognized fields of a submessage are preserved.
-func TestSubmessageUnrecognizedFields(t *testing.T) {
- nm := &NewMessage{
- Nested: &NewMessage_Nested{
- Name: String("Nigel"),
- FoodGroup: String("carbs"),
- },
- }
- b, err := Marshal(nm)
- if err != nil {
- t.Fatalf("Marshal of NewMessage: %v", err)
- }
-
- // Unmarshal into an OldMessage.
- om := new(OldMessage)
- if err := Unmarshal(b, om); err != nil {
- t.Fatalf("Unmarshal to OldMessage: %v", err)
- }
- exp := &OldMessage{
- Nested: &OldMessage_Nested{
- Name: String("Nigel"),
- // normal protocol buffer users should not do this
- XXX_unrecognized: []byte("\x12\x05carbs"),
- },
- }
- if !Equal(om, exp) {
- t.Errorf("om = %v, want %v", om, exp)
- }
-
- // Clone the OldMessage.
- om = Clone(om).(*OldMessage)
- if !Equal(om, exp) {
- t.Errorf("Clone(om) = %v, want %v", om, exp)
- }
-
- // Marshal the OldMessage, then unmarshal it into an empty NewMessage.
- if b, err = Marshal(om); err != nil {
- t.Fatalf("Marshal of OldMessage: %v", err)
- }
- t.Logf("Marshal(%v) -> %q", om, b)
- nm2 := new(NewMessage)
- if err := Unmarshal(b, nm2); err != nil {
- t.Fatalf("Unmarshal to NewMessage: %v", err)
- }
- if !Equal(nm, nm2) {
- t.Errorf("NewMessage round-trip: %v => %v", nm, nm2)
- }
-}
-
-// Check that an int32 field can be upgraded to an int64 field.
-func TestNegativeInt32(t *testing.T) {
- om := &OldMessage{
- Num: Int32(-1),
- }
- b, err := Marshal(om)
- if err != nil {
- t.Fatalf("Marshal of OldMessage: %v", err)
- }
-
- // Check the size. It should be 11 bytes;
- // 1 for the field/wire type, and 10 for the negative number.
- if len(b) != 11 {
- t.Errorf("%v marshaled as %q, wanted 11 bytes", om, b)
- }
-
- // Unmarshal into a NewMessage.
- nm := new(NewMessage)
- if err := Unmarshal(b, nm); err != nil {
- t.Fatalf("Unmarshal to NewMessage: %v", err)
- }
- want := &NewMessage{
- Num: Int64(-1),
- }
- if !Equal(nm, want) {
- t.Errorf("nm = %v, want %v", nm, want)
- }
-}
-
-// Check that we can grow an array (repeated field) to have many elements.
-// This test doesn't depend only on our encoding; for variety, it makes sure
-// we create, encode, and decode the correct contents explicitly. It's therefore
-// a bit messier.
-// This test also uses (and hence tests) the Marshal/Unmarshal functions
-// instead of the methods.
-func TestBigRepeated(t *testing.T) {
- pb := initGoTest(true)
-
- // Create the arrays
- const N = 50 // Internally the library starts much smaller.
- pb.Repeatedgroup = make([]*GoTest_RepeatedGroup, N)
- pb.F_Sint64Repeated = make([]int64, N)
- pb.F_Sint32Repeated = make([]int32, N)
- pb.F_BytesRepeated = make([][]byte, N)
- pb.F_StringRepeated = make([]string, N)
- pb.F_DoubleRepeated = make([]float64, N)
- pb.F_FloatRepeated = make([]float32, N)
- pb.F_Uint64Repeated = make([]uint64, N)
- pb.F_Uint32Repeated = make([]uint32, N)
- pb.F_Fixed64Repeated = make([]uint64, N)
- pb.F_Fixed32Repeated = make([]uint32, N)
- pb.F_Int64Repeated = make([]int64, N)
- pb.F_Int32Repeated = make([]int32, N)
- pb.F_BoolRepeated = make([]bool, N)
- pb.RepeatedField = make([]*GoTestField, N)
-
- // Fill in the arrays with checkable values.
- igtf := initGoTestField()
- igtrg := initGoTest_RepeatedGroup()
- for i := 0; i < N; i++ {
- pb.Repeatedgroup[i] = igtrg
- pb.F_Sint64Repeated[i] = int64(i)
- pb.F_Sint32Repeated[i] = int32(i)
- s := fmt.Sprint(i)
- pb.F_BytesRepeated[i] = []byte(s)
- pb.F_StringRepeated[i] = s
- pb.F_DoubleRepeated[i] = float64(i)
- pb.F_FloatRepeated[i] = float32(i)
- pb.F_Uint64Repeated[i] = uint64(i)
- pb.F_Uint32Repeated[i] = uint32(i)
- pb.F_Fixed64Repeated[i] = uint64(i)
- pb.F_Fixed32Repeated[i] = uint32(i)
- pb.F_Int64Repeated[i] = int64(i)
- pb.F_Int32Repeated[i] = int32(i)
- pb.F_BoolRepeated[i] = i%2 == 0
- pb.RepeatedField[i] = igtf
- }
-
- // Marshal.
- buf, _ := Marshal(pb)
-
- // Now test Unmarshal by recreating the original buffer.
- pbd := new(GoTest)
- Unmarshal(buf, pbd)
-
- // Check the checkable values
- for i := uint64(0); i < N; i++ {
- if pbd.Repeatedgroup[i] == nil { // TODO: more checking?
- t.Error("pbd.Repeatedgroup bad")
- }
- if x := uint64(pbd.F_Sint64Repeated[i]); x != i {
- t.Error("pbd.F_Sint64Repeated bad", x, i)
- }
- if x := uint64(pbd.F_Sint32Repeated[i]); x != i {
- t.Error("pbd.F_Sint32Repeated bad", x, i)
- }
- s := fmt.Sprint(i)
- equalbytes(pbd.F_BytesRepeated[i], []byte(s), t)
- if pbd.F_StringRepeated[i] != s {
- t.Error("pbd.F_Sint32Repeated bad", pbd.F_StringRepeated[i], i)
- }
- if x := uint64(pbd.F_DoubleRepeated[i]); x != i {
- t.Error("pbd.F_DoubleRepeated bad", x, i)
- }
- if x := uint64(pbd.F_FloatRepeated[i]); x != i {
- t.Error("pbd.F_FloatRepeated bad", x, i)
- }
- if x := pbd.F_Uint64Repeated[i]; x != i {
- t.Error("pbd.F_Uint64Repeated bad", x, i)
- }
- if x := uint64(pbd.F_Uint32Repeated[i]); x != i {
- t.Error("pbd.F_Uint32Repeated bad", x, i)
- }
- if x := pbd.F_Fixed64Repeated[i]; x != i {
- t.Error("pbd.F_Fixed64Repeated bad", x, i)
- }
- if x := uint64(pbd.F_Fixed32Repeated[i]); x != i {
- t.Error("pbd.F_Fixed32Repeated bad", x, i)
- }
- if x := uint64(pbd.F_Int64Repeated[i]); x != i {
- t.Error("pbd.F_Int64Repeated bad", x, i)
- }
- if x := uint64(pbd.F_Int32Repeated[i]); x != i {
- t.Error("pbd.F_Int32Repeated bad", x, i)
- }
- if x := pbd.F_BoolRepeated[i]; x != (i%2 == 0) {
- t.Error("pbd.F_BoolRepeated bad", x, i)
- }
- if pbd.RepeatedField[i] == nil { // TODO: more checking?
- t.Error("pbd.RepeatedField bad")
- }
- }
-}
-
-func TestBadWireTypeUnknown(t *testing.T) {
- var b []byte
- fmt.Sscanf("0a01780d00000000080b101612036161611521000000202c220362626225370000002203636363214200000000000000584d5a036464645900000000000056405d63000000", "%x", &b)
-
- m := new(MyMessage)
- if err := Unmarshal(b, m); err != nil {
- t.Errorf("unexpected Unmarshal error: %v", err)
- }
-
- var unknown []byte
- fmt.Sscanf("0a01780d0000000010161521000000202c2537000000214200000000000000584d5a036464645d63000000", "%x", &unknown)
- if !bytes.Equal(m.XXX_unrecognized, unknown) {
- t.Errorf("unknown bytes mismatch:\ngot %x\nwant %x", m.XXX_unrecognized, unknown)
- }
- DiscardUnknown(m)
-
- want := &MyMessage{Count: Int32(11), Name: String("aaa"), Pet: []string{"bbb", "ccc"}, Bigfloat: Float64(88)}
- if !Equal(m, want) {
- t.Errorf("message mismatch:\ngot %v\nwant %v", m, want)
- }
-}
-
-func encodeDecode(t *testing.T, in, out Message, msg string) {
- buf, err := Marshal(in)
- if err != nil {
- t.Fatalf("failed marshaling %v: %v", msg, err)
- }
- if err := Unmarshal(buf, out); err != nil {
- t.Fatalf("failed unmarshaling %v: %v", msg, err)
- }
-}
-
-func TestPackedNonPackedDecoderSwitching(t *testing.T) {
- np, p := new(NonPackedTest), new(PackedTest)
-
- // non-packed -> packed
- np.A = []int32{0, 1, 1, 2, 3, 5}
- encodeDecode(t, np, p, "non-packed -> packed")
- if !reflect.DeepEqual(np.A, p.B) {
- t.Errorf("failed non-packed -> packed; np.A=%+v, p.B=%+v", np.A, p.B)
- }
-
- // packed -> non-packed
- np.Reset()
- p.B = []int32{3, 1, 4, 1, 5, 9}
- encodeDecode(t, p, np, "packed -> non-packed")
- if !reflect.DeepEqual(p.B, np.A) {
- t.Errorf("failed packed -> non-packed; p.B=%+v, np.A=%+v", p.B, np.A)
- }
-}
-
-func TestProto1RepeatedGroup(t *testing.T) {
- pb := &MessageList{
- Message: []*MessageList_Message{
- {
- Name: String("blah"),
- Count: Int32(7),
- },
- // NOTE: pb.Message[1] is a nil
- nil,
- },
- }
-
- o := old()
- err := o.Marshal(pb)
- if err == nil || !strings.Contains(err.Error(), "repeated field Message has nil") {
- t.Fatalf("unexpected or no error when marshaling: %v", err)
- }
-}
-
-// Test that enums work. Checks for a bug introduced by making enums
-// named types instead of int32: newInt32FromUint64 would crash with
-// a type mismatch in reflect.PointTo.
-func TestEnum(t *testing.T) {
- pb := new(GoEnum)
- pb.Foo = FOO_FOO1.Enum()
- o := old()
- if err := o.Marshal(pb); err != nil {
- t.Fatal("error encoding enum:", err)
- }
- pb1 := new(GoEnum)
- if err := o.Unmarshal(pb1); err != nil {
- t.Fatal("error decoding enum:", err)
- }
- if *pb1.Foo != FOO_FOO1 {
- t.Error("expected 7 but got ", *pb1.Foo)
- }
-}
-
-// Enum types have String methods. Check that enum fields can be printed.
-// We don't care what the value actually is, just as long as it doesn't crash.
-func TestPrintingNilEnumFields(t *testing.T) {
- pb := new(GoEnum)
- _ = fmt.Sprintf("%+v", pb)
-}
-
-// Verify that absent required fields cause Marshal/Unmarshal to return errors.
-func TestRequiredFieldEnforcement(t *testing.T) {
- pb := new(GoTestField)
- _, err := Marshal(pb)
- if err == nil {
- t.Error("marshal: expected error, got nil")
- } else if _, ok := err.(*RequiredNotSetError); !ok || !strings.Contains(err.Error(), "Label") {
- t.Errorf("marshal: bad error type: %v", err)
- }
-
- // A slightly sneaky, yet valid, proto. It encodes the same required field twice,
- // so simply counting the required fields is insufficient.
- // field 1, encoding 2, value "hi"
- buf := []byte("\x0A\x02hi\x0A\x02hi")
- err = Unmarshal(buf, pb)
- if err == nil {
- t.Error("unmarshal: expected error, got nil")
- } else if _, ok := err.(*RequiredNotSetError); !ok || !strings.Contains(err.Error(), "Type") && !strings.Contains(err.Error(), "{Unknown}") {
- // TODO: remove unknown cases once we commit to the new unmarshaler.
- t.Errorf("unmarshal: bad error type: %v", err)
- }
-}
-
-// Verify that absent required fields in groups cause Marshal/Unmarshal to return errors.
-func TestRequiredFieldEnforcementGroups(t *testing.T) {
- pb := &GoTestRequiredGroupField{Group: &GoTestRequiredGroupField_Group{}}
- if _, err := Marshal(pb); err == nil {
- t.Error("marshal: expected error, got nil")
- } else if _, ok := err.(*RequiredNotSetError); !ok || !strings.Contains(err.Error(), "Group.Field") {
- t.Errorf("marshal: bad error type: %v", err)
- }
-
- buf := []byte{11, 12}
- if err := Unmarshal(buf, pb); err == nil {
- t.Error("unmarshal: expected error, got nil")
- } else if _, ok := err.(*RequiredNotSetError); !ok || !strings.Contains(err.Error(), "Group.Field") && !strings.Contains(err.Error(), "Group.{Unknown}") {
- t.Errorf("unmarshal: bad error type: %v", err)
- }
-}
-
-func TestTypedNilMarshal(t *testing.T) {
- // A typed nil should return ErrNil and not crash.
- {
- var m *GoEnum
- if _, err := Marshal(m); err != ErrNil {
- t.Errorf("Marshal(%#v): got %v, want ErrNil", m, err)
- }
- }
-
- {
- m := &Communique{Union: &Communique_Msg{nil}}
- if _, err := Marshal(m); err == nil || err == ErrNil {
- t.Errorf("Marshal(%#v): got %v, want errOneofHasNil", m, err)
- }
- }
-}
-
-// A type that implements the Marshaler interface, but is not nillable.
-type nonNillableInt uint64
-
-func (nni nonNillableInt) Marshal() ([]byte, error) {
- return EncodeVarint(uint64(nni)), nil
-}
-
-type NNIMessage struct {
- nni nonNillableInt
-}
-
-func (*NNIMessage) Reset() {}
-func (*NNIMessage) String() string { return "" }
-func (*NNIMessage) ProtoMessage() {}
-
-type NMMessage struct{}
-
-func (*NMMessage) Reset() {}
-func (*NMMessage) String() string { return "" }
-func (*NMMessage) ProtoMessage() {}
-
-// Verify a type that uses the Marshaler interface, but has a nil pointer.
-func TestNilMarshaler(t *testing.T) {
- // Try a struct with a Marshaler field that is nil.
- // It should be directly marshable.
- nmm := new(NMMessage)
- if _, err := Marshal(nmm); err != nil {
- t.Error("unexpected error marshaling nmm: ", err)
- }
-
- // Try a struct with a Marshaler field that is not nillable.
- nnim := new(NNIMessage)
- nnim.nni = 7
- var _ Marshaler = nnim.nni // verify it is truly a Marshaler
- if _, err := Marshal(nnim); err != nil {
- t.Error("unexpected error marshaling nnim: ", err)
- }
-}
-
-func TestAllSetDefaults(t *testing.T) {
- // Exercise SetDefaults with all scalar field types.
- m := &Defaults{
- // NaN != NaN, so override that here.
- F_Nan: Float32(1.7),
- }
- expected := &Defaults{
- F_Bool: Bool(true),
- F_Int32: Int32(32),
- F_Int64: Int64(64),
- F_Fixed32: Uint32(320),
- F_Fixed64: Uint64(640),
- F_Uint32: Uint32(3200),
- F_Uint64: Uint64(6400),
- F_Float: Float32(314159),
- F_Double: Float64(271828),
- F_String: String(`hello, "world!"` + "\n"),
- F_Bytes: []byte("Bignose"),
- F_Sint32: Int32(-32),
- F_Sint64: Int64(-64),
- F_Enum: Defaults_GREEN.Enum(),
- F_Pinf: Float32(float32(math.Inf(1))),
- F_Ninf: Float32(float32(math.Inf(-1))),
- F_Nan: Float32(1.7),
- StrZero: String(""),
- }
- SetDefaults(m)
- if !Equal(m, expected) {
- t.Errorf("SetDefaults failed\n got %v\nwant %v", m, expected)
- }
-}
-
-func TestSetDefaultsWithSetField(t *testing.T) {
- // Check that a set value is not overridden.
- m := &Defaults{
- F_Int32: Int32(12),
- }
- SetDefaults(m)
- if v := m.GetF_Int32(); v != 12 {
- t.Errorf("m.FInt32 = %v, want 12", v)
- }
-}
-
-func TestSetDefaultsWithSubMessage(t *testing.T) {
- m := &OtherMessage{
- Key: Int64(123),
- Inner: &InnerMessage{
- Host: String("gopher"),
- },
- }
- expected := &OtherMessage{
- Key: Int64(123),
- Inner: &InnerMessage{
- Host: String("gopher"),
- Port: Int32(4000),
- },
- }
- SetDefaults(m)
- if !Equal(m, expected) {
- t.Errorf("\n got %v\nwant %v", m, expected)
- }
-}
-
-func TestSetDefaultsWithRepeatedSubMessage(t *testing.T) {
- m := &MyMessage{
- RepInner: []*InnerMessage{{}},
- }
- expected := &MyMessage{
- RepInner: []*InnerMessage{{
- Port: Int32(4000),
- }},
- }
- SetDefaults(m)
- if !Equal(m, expected) {
- t.Errorf("\n got %v\nwant %v", m, expected)
- }
-}
-
-func TestSetDefaultWithRepeatedNonMessage(t *testing.T) {
- m := &MyMessage{
- Pet: []string{"turtle", "wombat"},
- }
- expected := Clone(m)
- SetDefaults(m)
- if !Equal(m, expected) {
- t.Errorf("\n got %v\nwant %v", m, expected)
- }
-}
-
-func TestMaximumTagNumber(t *testing.T) {
- m := &MaxTag{
- LastField: String("natural goat essence"),
- }
- buf, err := Marshal(m)
- if err != nil {
- t.Fatalf("proto.Marshal failed: %v", err)
- }
- m2 := new(MaxTag)
- if err := Unmarshal(buf, m2); err != nil {
- t.Fatalf("proto.Unmarshal failed: %v", err)
- }
- if got, want := m2.GetLastField(), *m.LastField; got != want {
- t.Errorf("got %q, want %q", got, want)
- }
-}
-
-func TestJSON(t *testing.T) {
- m := &MyMessage{
- Count: Int32(4),
- Pet: []string{"bunny", "kitty"},
- Inner: &InnerMessage{
- Host: String("cauchy"),
- },
- Bikeshed: MyMessage_GREEN.Enum(),
- }
- const expected = `{"count":4,"pet":["bunny","kitty"],"inner":{"host":"cauchy"},"bikeshed":1}`
-
- b, err := json.Marshal(m)
- if err != nil {
- t.Fatalf("json.Marshal failed: %v", err)
- }
- s := string(b)
- if s != expected {
- t.Errorf("got %s\nwant %s", s, expected)
- }
-
- received := new(MyMessage)
- if err := json.Unmarshal(b, received); err != nil {
- t.Fatalf("json.Unmarshal failed: %v", err)
- }
- if !Equal(received, m) {
- t.Fatalf("got %s, want %s", received, m)
- }
-
- // Test unmarshalling of JSON with symbolic enum name.
- const old = `{"count":4,"pet":["bunny","kitty"],"inner":{"host":"cauchy"},"bikeshed":"GREEN"}`
- received.Reset()
- if err := json.Unmarshal([]byte(old), received); err != nil {
- t.Fatalf("json.Unmarshal failed: %v", err)
- }
- if !Equal(received, m) {
- t.Fatalf("got %s, want %s", received, m)
- }
-}
-
-func TestBadWireType(t *testing.T) {
- b := []byte{7<<3 | 6} // field 7, wire type 6
- pb := new(OtherMessage)
- if err := Unmarshal(b, pb); err == nil {
- t.Errorf("Unmarshal did not fail")
- } else if !strings.Contains(err.Error(), "unknown wire type") {
- t.Errorf("wrong error: %v", err)
- }
-}
-
-func TestBytesWithInvalidLength(t *testing.T) {
- // If a byte sequence has an invalid (negative) length, Unmarshal should not panic.
- b := []byte{2<<3 | WireBytes, 0xff, 0xff, 0xff, 0xff, 0xff, 0}
- Unmarshal(b, new(MyMessage))
-}
-
-func TestLengthOverflow(t *testing.T) {
- // Overflowing a length should not panic.
- b := []byte{2<<3 | WireBytes, 1, 1, 3<<3 | WireBytes, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x01}
- Unmarshal(b, new(MyMessage))
-}
-
-func TestVarintOverflow(t *testing.T) {
- // Overflowing a 64-bit length should not be allowed.
- b := []byte{1<<3 | WireVarint, 0x01, 3<<3 | WireBytes, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x01}
- if err := Unmarshal(b, new(MyMessage)); err == nil {
- t.Fatalf("Overflowed uint64 length without error")
- }
-}
-
-func TestBytesWithInvalidLengthInGroup(t *testing.T) {
- // Overflowing a 64-bit length should not be allowed.
- b := []byte{0xbb, 0x30, 0xb2, 0x30, 0xb0, 0xb2, 0x83, 0xf1, 0xb0, 0xb2, 0xef, 0xbf, 0xbd, 0x01}
- if err := Unmarshal(b, new(MyMessage)); err == nil {
- t.Fatalf("Overflowed uint64 length without error")
- }
-}
-
-func TestUnmarshalFuzz(t *testing.T) {
- const N = 1000
- seed := time.Now().UnixNano()
- t.Logf("RNG seed is %d", seed)
- rng := rand.New(rand.NewSource(seed))
- buf := make([]byte, 20)
- for i := 0; i < N; i++ {
- for j := range buf {
- buf[j] = byte(rng.Intn(256))
- }
- fuzzUnmarshal(t, buf)
- }
-}
-
-func TestMergeMessages(t *testing.T) {
- pb := &MessageList{Message: []*MessageList_Message{{Name: String("x"), Count: Int32(1)}}}
- data, err := Marshal(pb)
- if err != nil {
- t.Fatalf("Marshal: %v", err)
- }
-
- pb1 := new(MessageList)
- if err := Unmarshal(data, pb1); err != nil {
- t.Fatalf("first Unmarshal: %v", err)
- }
- if err := Unmarshal(data, pb1); err != nil {
- t.Fatalf("second Unmarshal: %v", err)
- }
- if len(pb1.Message) != 1 {
- t.Errorf("two Unmarshals produced %d Messages, want 1", len(pb1.Message))
- }
-
- pb2 := new(MessageList)
- if err := UnmarshalMerge(data, pb2); err != nil {
- t.Fatalf("first UnmarshalMerge: %v", err)
- }
- if err := UnmarshalMerge(data, pb2); err != nil {
- t.Fatalf("second UnmarshalMerge: %v", err)
- }
- if len(pb2.Message) != 2 {
- t.Errorf("two UnmarshalMerges produced %d Messages, want 2", len(pb2.Message))
- }
-}
-
-func TestExtensionMarshalOrder(t *testing.T) {
- m := &MyMessage{Count: Int(123)}
- if err := SetExtension(m, E_Ext_More, &Ext{Data: String("alpha")}); err != nil {
- t.Fatalf("SetExtension: %v", err)
- }
- if err := SetExtension(m, E_Ext_Text, String("aleph")); err != nil {
- t.Fatalf("SetExtension: %v", err)
- }
- if err := SetExtension(m, E_Ext_Number, Int32(1)); err != nil {
- t.Fatalf("SetExtension: %v", err)
- }
-
- // Serialize m several times, and check we get the same bytes each time.
- var orig []byte
- for i := 0; i < 100; i++ {
- b, err := Marshal(m)
- if err != nil {
- t.Fatalf("Marshal: %v", err)
- }
- if i == 0 {
- orig = b
- continue
- }
- if !bytes.Equal(b, orig) {
- t.Errorf("Bytes differ on attempt #%d", i)
- }
- }
-}
-
-func TestExtensionMapFieldMarshalDeterministic(t *testing.T) {
- m := &MyMessage{Count: Int(123)}
- if err := SetExtension(m, E_Ext_More, &Ext{MapField: map[int32]int32{1: 1, 2: 2, 3: 3, 4: 4}}); err != nil {
- t.Fatalf("SetExtension: %v", err)
- }
- marshal := func(m Message) []byte {
- var b Buffer
- b.SetDeterministic(true)
- if err := b.Marshal(m); err != nil {
- t.Fatalf("Marshal failed: %v", err)
- }
- return b.Bytes()
- }
-
- want := marshal(m)
- for i := 0; i < 100; i++ {
- if got := marshal(m); !bytes.Equal(got, want) {
- t.Errorf("Marshal produced inconsistent output with determinism enabled (pass %d).\n got %v\nwant %v", i, got, want)
- }
- }
-}
-
-// Many extensions, because small maps might not iterate differently on each iteration.
-var exts = []*ExtensionDesc{
- E_X201,
- E_X202,
- E_X203,
- E_X204,
- E_X205,
- E_X206,
- E_X207,
- E_X208,
- E_X209,
- E_X210,
- E_X211,
- E_X212,
- E_X213,
- E_X214,
- E_X215,
- E_X216,
- E_X217,
- E_X218,
- E_X219,
- E_X220,
- E_X221,
- E_X222,
- E_X223,
- E_X224,
- E_X225,
- E_X226,
- E_X227,
- E_X228,
- E_X229,
- E_X230,
- E_X231,
- E_X232,
- E_X233,
- E_X234,
- E_X235,
- E_X236,
- E_X237,
- E_X238,
- E_X239,
- E_X240,
- E_X241,
- E_X242,
- E_X243,
- E_X244,
- E_X245,
- E_X246,
- E_X247,
- E_X248,
- E_X249,
- E_X250,
-}
-
-func TestMessageSetMarshalOrder(t *testing.T) {
- m := &MyMessageSet{}
- for _, x := range exts {
- if err := SetExtension(m, x, &Empty{}); err != nil {
- t.Fatalf("SetExtension: %v", err)
- }
- }
-
- buf, err := Marshal(m)
- if err != nil {
- t.Fatalf("Marshal: %v", err)
- }
-
- // Serialize m several times, and check we get the same bytes each time.
- for i := 0; i < 10; i++ {
- b1, err := Marshal(m)
- if err != nil {
- t.Fatalf("Marshal: %v", err)
- }
- if !bytes.Equal(b1, buf) {
- t.Errorf("Bytes differ on re-Marshal #%d", i)
- }
-
- m2 := &MyMessageSet{}
- if err := Unmarshal(buf, m2); err != nil {
- t.Errorf("Unmarshal: %v", err)
- }
- b2, err := Marshal(m2)
- if err != nil {
- t.Errorf("re-Marshal: %v", err)
- }
- if !bytes.Equal(b2, buf) {
- t.Errorf("Bytes differ on round-trip #%d", i)
- }
- }
-}
-
-func TestUnmarshalMergesMessages(t *testing.T) {
- // If a nested message occurs twice in the input,
- // the fields should be merged when decoding.
- a := &OtherMessage{
- Key: Int64(123),
- Inner: &InnerMessage{
- Host: String("polhode"),
- Port: Int32(1234),
- },
- }
- aData, err := Marshal(a)
- if err != nil {
- t.Fatalf("Marshal(a): %v", err)
- }
- b := &OtherMessage{
- Weight: Float32(1.2),
- Inner: &InnerMessage{
- Host: String("herpolhode"),
- Connected: Bool(true),
- },
- }
- bData, err := Marshal(b)
- if err != nil {
- t.Fatalf("Marshal(b): %v", err)
- }
- want := &OtherMessage{
- Key: Int64(123),
- Weight: Float32(1.2),
- Inner: &InnerMessage{
- Host: String("herpolhode"),
- Port: Int32(1234),
- Connected: Bool(true),
- },
- }
- got := new(OtherMessage)
- if err := Unmarshal(append(aData, bData...), got); err != nil {
- t.Fatalf("Unmarshal: %v", err)
- }
- if !Equal(got, want) {
- t.Errorf("\n got %v\nwant %v", got, want)
- }
-}
-
-func TestUnmarshalMergesGroups(t *testing.T) {
- // If a nested group occurs twice in the input,
- // the fields should be merged when decoding.
- a := &GroupNew{
- G: &GroupNew_G{
- X: Int32(7),
- Y: Int32(8),
- },
- }
- aData, err := Marshal(a)
- if err != nil {
- t.Fatalf("Marshal(a): %v", err)
- }
- b := &GroupNew{
- G: &GroupNew_G{
- X: Int32(9),
- },
- }
- bData, err := Marshal(b)
- if err != nil {
- t.Fatalf("Marshal(b): %v", err)
- }
- want := &GroupNew{
- G: &GroupNew_G{
- X: Int32(9),
- Y: Int32(8),
- },
- }
- got := new(GroupNew)
- if err := Unmarshal(append(aData, bData...), got); err != nil {
- t.Fatalf("Unmarshal: %v", err)
- }
- if !Equal(got, want) {
- t.Errorf("\n got %v\nwant %v", got, want)
- }
-}
-
-func TestEncodingSizes(t *testing.T) {
- tests := []struct {
- m Message
- n int
- }{
- {&Defaults{F_Int32: Int32(math.MaxInt32)}, 6},
- {&Defaults{F_Int32: Int32(math.MinInt32)}, 11},
- {&Defaults{F_Uint32: Uint32(uint32(math.MaxInt32) + 1)}, 6},
- {&Defaults{F_Uint32: Uint32(math.MaxUint32)}, 6},
- }
- for _, test := range tests {
- b, err := Marshal(test.m)
- if err != nil {
- t.Errorf("Marshal(%v): %v", test.m, err)
- continue
- }
- if len(b) != test.n {
- t.Errorf("Marshal(%v) yielded %d bytes, want %d bytes", test.m, len(b), test.n)
- }
- }
-}
-
-func TestRequiredNotSetError(t *testing.T) {
- pb := initGoTest(false)
- pb.RequiredField.Label = nil
- pb.F_Int32Required = nil
- pb.F_Int64Required = nil
-
- expected := "0807" + // field 1, encoding 0, value 7
- "2206" + "120474797065" + // field 4, encoding 2 (GoTestField)
- "5001" + // field 10, encoding 0, value 1
- "6d20000000" + // field 13, encoding 5, value 0x20
- "714000000000000000" + // field 14, encoding 1, value 0x40
- "78a019" + // field 15, encoding 0, value 0xca0 = 3232
- "8001c032" + // field 16, encoding 0, value 0x1940 = 6464
- "8d0100004a45" + // field 17, encoding 5, value 3232.0
- "9101000000000040b940" + // field 18, encoding 1, value 6464.0
- "9a0106" + "737472696e67" + // field 19, encoding 2, string "string"
- "b304" + // field 70, encoding 3, start group
- "ba0408" + "7265717569726564" + // field 71, encoding 2, string "required"
- "b404" + // field 70, encoding 4, end group
- "aa0605" + "6279746573" + // field 101, encoding 2, string "bytes"
- "b0063f" + // field 102, encoding 0, 0x3f zigzag32
- "b8067f" + // field 103, encoding 0, 0x7f zigzag64
- "c506e0ffffff" + // field 104, encoding 5, -32 fixed32
- "c906c0ffffffffffffff" // field 105, encoding 1, -64 fixed64
-
- o := old()
- bytes, err := Marshal(pb)
- if _, ok := err.(*RequiredNotSetError); !ok {
- fmt.Printf("marshal-1 err = %v, want *RequiredNotSetError", err)
- o.DebugPrint("", bytes)
- t.Fatalf("expected = %s", expected)
- }
- if !strings.Contains(err.Error(), "RequiredField.Label") {
- t.Errorf("marshal-1 wrong err msg: %v", err)
- }
- if !equal(bytes, expected, t) {
- o.DebugPrint("neq 1", bytes)
- t.Fatalf("expected = %s", expected)
- }
-
- // Now test Unmarshal by recreating the original buffer.
- pbd := new(GoTest)
- err = Unmarshal(bytes, pbd)
- if _, ok := err.(*RequiredNotSetError); !ok {
- t.Fatalf("unmarshal err = %v, want *RequiredNotSetError", err)
- o.DebugPrint("", bytes)
- t.Fatalf("string = %s", expected)
- }
- if !strings.Contains(err.Error(), "RequiredField.Label") && !strings.Contains(err.Error(), "RequiredField.{Unknown}") {
- t.Errorf("unmarshal wrong err msg: %v", err)
- }
- bytes, err = Marshal(pbd)
- if _, ok := err.(*RequiredNotSetError); !ok {
- t.Errorf("marshal-2 err = %v, want *RequiredNotSetError", err)
- o.DebugPrint("", bytes)
- t.Fatalf("string = %s", expected)
- }
- if !strings.Contains(err.Error(), "RequiredField.Label") {
- t.Errorf("marshal-2 wrong err msg: %v", err)
- }
- if !equal(bytes, expected, t) {
- o.DebugPrint("neq 2", bytes)
- t.Fatalf("string = %s", expected)
- }
-}
-
-func TestRequiredNotSetErrorWithBadWireTypes(t *testing.T) {
- // Required field expects a varint, and properly found a varint.
- if err := Unmarshal([]byte{0x08, 0x00}, new(GoEnum)); err != nil {
- t.Errorf("Unmarshal = %v, want nil", err)
- }
- // Required field expects a varint, but found a fixed32 instead.
- if err := Unmarshal([]byte{0x0d, 0x00, 0x00, 0x00, 0x00}, new(GoEnum)); err == nil {
- t.Errorf("Unmarshal = nil, want RequiredNotSetError")
- }
- // Required field expects a varint, and found both a varint and fixed32 (ignored).
- m := new(GoEnum)
- if err := Unmarshal([]byte{0x08, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00}, m); err != nil {
- t.Errorf("Unmarshal = %v, want nil", err)
- }
- if !bytes.Equal(m.XXX_unrecognized, []byte{0x0d, 0x00, 0x00, 0x00, 0x00}) {
- t.Errorf("expected fixed32 to appear as unknown bytes: %x", m.XXX_unrecognized)
- }
-}
-
-func fuzzUnmarshal(t *testing.T, data []byte) {
- defer func() {
- if e := recover(); e != nil {
- t.Errorf("These bytes caused a panic: %+v", data)
- t.Logf("Stack:\n%s", debug.Stack())
- t.FailNow()
- }
- }()
-
- pb := new(MyMessage)
- Unmarshal(data, pb)
-}
-
-func TestMapFieldMarshal(t *testing.T) {
- m := &MessageWithMap{
- NameMapping: map[int32]string{
- 1: "Rob",
- 4: "Ian",
- 8: "Dave",
- },
- }
- b, err := Marshal(m)
- if err != nil {
- t.Fatalf("Marshal: %v", err)
- }
-
- // b should be the concatenation of these three byte sequences in some order.
- parts := []string{
- "\n\a\b\x01\x12\x03Rob",
- "\n\a\b\x04\x12\x03Ian",
- "\n\b\b\x08\x12\x04Dave",
- }
- ok := false
- for i := range parts {
- for j := range parts {
- if j == i {
- continue
- }
- for k := range parts {
- if k == i || k == j {
- continue
- }
- try := parts[i] + parts[j] + parts[k]
- if bytes.Equal(b, []byte(try)) {
- ok = true
- break
- }
- }
- }
- }
- if !ok {
- t.Fatalf("Incorrect Marshal output.\n got %q\nwant %q (or a permutation of that)", b, parts[0]+parts[1]+parts[2])
- }
- t.Logf("FYI b: %q", b)
-
- (new(Buffer)).DebugPrint("Dump of b", b)
-}
-
-func TestMapFieldDeterministicMarshal(t *testing.T) {
- m := &MessageWithMap{
- NameMapping: map[int32]string{
- 1: "Rob",
- 4: "Ian",
- 8: "Dave",
- },
- }
-
- marshal := func(m Message) []byte {
- var b Buffer
- b.SetDeterministic(true)
- if err := b.Marshal(m); err != nil {
- t.Fatalf("Marshal failed: %v", err)
- }
- return b.Bytes()
- }
-
- want := marshal(m)
- for i := 0; i < 10; i++ {
- if got := marshal(m); !bytes.Equal(got, want) {
- t.Errorf("Marshal produced inconsistent output with determinism enabled (pass %d).\n got %v\nwant %v", i, got, want)
- }
- }
-}
-
-func TestMapFieldRoundTrips(t *testing.T) {
- m := &MessageWithMap{
- NameMapping: map[int32]string{
- 1: "Rob",
- 4: "Ian",
- 8: "Dave",
- },
- MsgMapping: map[int64]*FloatingPoint{
- 0x7001: {F: Float64(2.0)},
- },
- ByteMapping: map[bool][]byte{
- false: []byte("that's not right!"),
- true: []byte("aye, 'tis true!"),
- },
- }
- b, err := Marshal(m)
- if err != nil {
- t.Fatalf("Marshal: %v", err)
- }
- t.Logf("FYI b: %q", b)
- m2 := new(MessageWithMap)
- if err := Unmarshal(b, m2); err != nil {
- t.Fatalf("Unmarshal: %v", err)
- }
- if !Equal(m, m2) {
- t.Errorf("Map did not survive a round trip.\ninitial: %v\n final: %v", m, m2)
- }
-}
-
-func TestMapFieldWithNil(t *testing.T) {
- m1 := &MessageWithMap{
- MsgMapping: map[int64]*FloatingPoint{
- 1: nil,
- },
- }
- b, err := Marshal(m1)
- if err != nil {
- t.Fatalf("Marshal: %v", err)
- }
- m2 := new(MessageWithMap)
- if err := Unmarshal(b, m2); err != nil {
- t.Fatalf("Unmarshal: %v, got these bytes: %v", err, b)
- }
- if v, ok := m2.MsgMapping[1]; !ok {
- t.Error("msg_mapping[1] not present")
- } else if v != nil {
- t.Errorf("msg_mapping[1] not nil: %v", v)
- }
-}
-
-func TestMapFieldWithNilBytes(t *testing.T) {
- m1 := &MessageWithMap{
- ByteMapping: map[bool][]byte{
- false: {},
- true: nil,
- },
- }
- n := Size(m1)
- b, err := Marshal(m1)
- if err != nil {
- t.Fatalf("Marshal: %v", err)
- }
- if n != len(b) {
- t.Errorf("Size(m1) = %d; want len(Marshal(m1)) = %d", n, len(b))
- }
- m2 := new(MessageWithMap)
- if err := Unmarshal(b, m2); err != nil {
- t.Fatalf("Unmarshal: %v, got these bytes: %v", err, b)
- }
- if v, ok := m2.ByteMapping[false]; !ok {
- t.Error("byte_mapping[false] not present")
- } else if len(v) != 0 {
- t.Errorf("byte_mapping[false] not empty: %#v", v)
- }
- if v, ok := m2.ByteMapping[true]; !ok {
- t.Error("byte_mapping[true] not present")
- } else if len(v) != 0 {
- t.Errorf("byte_mapping[true] not empty: %#v", v)
- }
-}
-
-func TestDecodeMapFieldMissingKey(t *testing.T) {
- b := []byte{
- 0x0A, 0x03, // message, tag 1 (name_mapping), of length 3 bytes
- // no key
- 0x12, 0x01, 0x6D, // string value of length 1 byte, value "m"
- }
- got := &MessageWithMap{}
- err := Unmarshal(b, got)
- if err != nil {
- t.Fatalf("failed to marshal map with missing key: %v", err)
- }
- want := &MessageWithMap{NameMapping: map[int32]string{0: "m"}}
- if !Equal(got, want) {
- t.Errorf("Unmarshaled map with no key was not as expected. got: %v, want %v", got, want)
- }
-}
-
-func TestDecodeMapFieldMissingValue(t *testing.T) {
- b := []byte{
- 0x0A, 0x02, // message, tag 1 (name_mapping), of length 2 bytes
- 0x08, 0x01, // varint key, value 1
- // no value
- }
- got := &MessageWithMap{}
- err := Unmarshal(b, got)
- if err != nil {
- t.Fatalf("failed to marshal map with missing value: %v", err)
- }
- want := &MessageWithMap{NameMapping: map[int32]string{1: ""}}
- if !Equal(got, want) {
- t.Errorf("Unmarshaled map with no value was not as expected. got: %v, want %v", got, want)
- }
-}
-
-func TestOneof(t *testing.T) {
- m := &Communique{}
- b, err := Marshal(m)
- if err != nil {
- t.Fatalf("Marshal of empty message with oneof: %v", err)
- }
- if len(b) != 0 {
- t.Errorf("Marshal of empty message yielded too many bytes: %v", b)
- }
-
- m = &Communique{
- Union: &Communique_Name{"Barry"},
- }
-
- // Round-trip.
- b, err = Marshal(m)
- if err != nil {
- t.Fatalf("Marshal of message with oneof: %v", err)
- }
- if len(b) != 7 { // name tag/wire (1) + name len (1) + name (5)
- t.Errorf("Incorrect marshal of message with oneof: %v", b)
- }
- m.Reset()
- if err := Unmarshal(b, m); err != nil {
- t.Fatalf("Unmarshal of message with oneof: %v", err)
- }
- if x, ok := m.Union.(*Communique_Name); !ok || x.Name != "Barry" {
- t.Errorf("After round trip, Union = %+v", m.Union)
- }
- if name := m.GetName(); name != "Barry" {
- t.Errorf("After round trip, GetName = %q, want %q", name, "Barry")
- }
-
- // Let's try with a message in the oneof.
- m.Union = &Communique_Msg{&Strings{StringField: String("deep deep string")}}
- b, err = Marshal(m)
- if err != nil {
- t.Fatalf("Marshal of message with oneof set to message: %v", err)
- }
- if len(b) != 20 { // msg tag/wire (1) + msg len (1) + msg (1 + 1 + 16)
- t.Errorf("Incorrect marshal of message with oneof set to message: %v", b)
- }
- m.Reset()
- if err := Unmarshal(b, m); err != nil {
- t.Fatalf("Unmarshal of message with oneof set to message: %v", err)
- }
- ss, ok := m.Union.(*Communique_Msg)
- if !ok || ss.Msg.GetStringField() != "deep deep string" {
- t.Errorf("After round trip with oneof set to message, Union = %+v", m.Union)
- }
-}
-
-func TestOneofNilBytes(t *testing.T) {
- // A oneof with nil byte slice should marshal to tag + 0 (size), with no error.
- m := &Communique{Union: &Communique_Data{Data: nil}}
- b, err := Marshal(m)
- if err != nil {
- t.Fatalf("Marshal failed: %v", err)
- }
- want := []byte{
- 7<<3 | 2, // tag 7, wire type 2
- 0, // size
- }
- if !bytes.Equal(b, want) {
- t.Errorf("Wrong result of Marshal: got %x, want %x", b, want)
- }
-}
-
-func TestInefficientPackedBool(t *testing.T) {
- // https://github.com/golang/protobuf/issues/76
- inp := []byte{
- 0x12, 0x02, // 0x12 = 2<<3|2; 2 bytes
- // Usually a bool should take a single byte,
- // but it is permitted to be any varint.
- 0xb9, 0x30,
- }
- if err := Unmarshal(inp, new(MoreRepeated)); err != nil {
- t.Error(err)
- }
-}
-
-// Make sure pure-reflect-based implementation handles
-// []int32-[]enum conversion correctly.
-func TestRepeatedEnum2(t *testing.T) {
- pb := &RepeatedEnum{
- Color: []RepeatedEnum_Color{RepeatedEnum_RED},
- }
- b, err := Marshal(pb)
- if err != nil {
- t.Fatalf("Marshal failed: %v", err)
- }
- x := new(RepeatedEnum)
- err = Unmarshal(b, x)
- if err != nil {
- t.Fatalf("Unmarshal failed: %v", err)
- }
- if !Equal(pb, x) {
- t.Errorf("Incorrect result: want: %v got: %v", pb, x)
- }
-}
-
-// TestConcurrentMarshal makes sure that it is safe to marshal
-// same message in multiple goroutines concurrently.
-func TestConcurrentMarshal(t *testing.T) {
- pb := initGoTest(true)
- const N = 100
- b := make([][]byte, N)
-
- var wg sync.WaitGroup
- for i := 0; i < N; i++ {
- wg.Add(1)
- go func(i int) {
- defer wg.Done()
- var err error
- b[i], err = Marshal(pb)
- if err != nil {
- t.Errorf("marshal error: %v", err)
- }
- }(i)
- }
-
- wg.Wait()
- for i := 1; i < N; i++ {
- if !bytes.Equal(b[0], b[i]) {
- t.Errorf("concurrent marshal result not same: b[0] = %v, b[%d] = %v", b[0], i, b[i])
- }
- }
-}
-
-func TestInvalidUTF8(t *testing.T) {
- const wire = "\x12\x04\xde\xea\xca\xfe"
-
- var m GoTest
- if err := Unmarshal([]byte(wire), &m); err == nil {
- t.Errorf("Unmarshal error: got nil, want non-nil")
- }
-
- m.Reset()
- m.Table = String(wire[2:])
- if _, err := Marshal(&m); err == nil {
- t.Errorf("Marshal error: got nil, want non-nil")
- }
-}
-
-// Benchmarks
-
-func testMsg() *GoTest {
- pb := initGoTest(true)
- const N = 1000 // Internally the library starts much smaller.
- pb.F_Int32Repeated = make([]int32, N)
- pb.F_DoubleRepeated = make([]float64, N)
- for i := 0; i < N; i++ {
- pb.F_Int32Repeated[i] = int32(i)
- pb.F_DoubleRepeated[i] = float64(i)
- }
- return pb
-}
-
-func bytesMsg() *GoTest {
- pb := initGoTest(true)
- buf := make([]byte, 4000)
- for i := range buf {
- buf[i] = byte(i)
- }
- pb.F_BytesDefaulted = buf
- return pb
-}
-
-func benchmarkMarshal(b *testing.B, pb Message, marshal func(Message) ([]byte, error)) {
- d, _ := marshal(pb)
- b.SetBytes(int64(len(d)))
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- marshal(pb)
- }
-}
-
-func benchmarkBufferMarshal(b *testing.B, pb Message) {
- p := NewBuffer(nil)
- benchmarkMarshal(b, pb, func(pb0 Message) ([]byte, error) {
- p.Reset()
- err := p.Marshal(pb0)
- return p.Bytes(), err
- })
-}
-
-func benchmarkSize(b *testing.B, pb Message) {
- benchmarkMarshal(b, pb, func(pb0 Message) ([]byte, error) {
- Size(pb)
- return nil, nil
- })
-}
-
-func newOf(pb Message) Message {
- in := reflect.ValueOf(pb)
- if in.IsNil() {
- return pb
- }
- return reflect.New(in.Type().Elem()).Interface().(Message)
-}
-
-func benchmarkUnmarshal(b *testing.B, pb Message, unmarshal func([]byte, Message) error) {
- d, _ := Marshal(pb)
- b.SetBytes(int64(len(d)))
- pbd := newOf(pb)
-
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- unmarshal(d, pbd)
- }
-}
-
-func benchmarkBufferUnmarshal(b *testing.B, pb Message) {
- p := NewBuffer(nil)
- benchmarkUnmarshal(b, pb, func(d []byte, pb0 Message) error {
- p.SetBuf(d)
- return p.Unmarshal(pb0)
- })
-}
-
-// Benchmark{Marshal,BufferMarshal,Size,Unmarshal,BufferUnmarshal}{,Bytes}
-
-func BenchmarkMarshal(b *testing.B) {
- benchmarkMarshal(b, testMsg(), Marshal)
-}
-
-func BenchmarkBufferMarshal(b *testing.B) {
- benchmarkBufferMarshal(b, testMsg())
-}
-
-func BenchmarkSize(b *testing.B) {
- benchmarkSize(b, testMsg())
-}
-
-func BenchmarkUnmarshal(b *testing.B) {
- benchmarkUnmarshal(b, testMsg(), Unmarshal)
-}
-
-func BenchmarkBufferUnmarshal(b *testing.B) {
- benchmarkBufferUnmarshal(b, testMsg())
-}
-
-func BenchmarkMarshalBytes(b *testing.B) {
- benchmarkMarshal(b, bytesMsg(), Marshal)
-}
-
-func BenchmarkBufferMarshalBytes(b *testing.B) {
- benchmarkBufferMarshal(b, bytesMsg())
-}
-
-func BenchmarkSizeBytes(b *testing.B) {
- benchmarkSize(b, bytesMsg())
-}
-
-func BenchmarkUnmarshalBytes(b *testing.B) {
- benchmarkUnmarshal(b, bytesMsg(), Unmarshal)
-}
-
-func BenchmarkBufferUnmarshalBytes(b *testing.B) {
- benchmarkBufferUnmarshal(b, bytesMsg())
-}
-
-func BenchmarkUnmarshalUnrecognizedFields(b *testing.B) {
- b.StopTimer()
- pb := initGoTestField()
- skip := &GoSkipTest{
- SkipInt32: Int32(32),
- SkipFixed32: Uint32(3232),
- SkipFixed64: Uint64(6464),
- SkipString: String("skipper"),
- Skipgroup: &GoSkipTest_SkipGroup{
- GroupInt32: Int32(75),
- GroupString: String("wxyz"),
- },
- }
-
- pbd := new(GoTestField)
- p := NewBuffer(nil)
- p.Marshal(pb)
- p.Marshal(skip)
- p2 := NewBuffer(nil)
-
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- p2.SetBuf(p.Bytes())
- p2.Unmarshal(pbd)
- }
-}
diff --git a/vendor/github.com/golang/protobuf/proto/any_test.go b/vendor/github.com/golang/protobuf/proto/any_test.go
deleted file mode 100644
index 56fc97c11..000000000
--- a/vendor/github.com/golang/protobuf/proto/any_test.go
+++ /dev/null
@@ -1,300 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2016 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto_test
-
-import (
- "strings"
- "testing"
-
- "github.com/golang/protobuf/proto"
-
- pb "github.com/golang/protobuf/proto/proto3_proto"
- testpb "github.com/golang/protobuf/proto/test_proto"
- anypb "github.com/golang/protobuf/ptypes/any"
-)
-
-var (
- expandedMarshaler = proto.TextMarshaler{ExpandAny: true}
- expandedCompactMarshaler = proto.TextMarshaler{Compact: true, ExpandAny: true}
-)
-
-// anyEqual reports whether two messages which may be google.protobuf.Any or may
-// contain google.protobuf.Any fields are equal. We can't use proto.Equal for
-// comparison, because semantically equivalent messages may be marshaled to
-// binary in different tag order. Instead, trust that TextMarshaler with
-// ExpandAny option works and compare the text marshaling results.
-func anyEqual(got, want proto.Message) bool {
- // if messages are proto.Equal, no need to marshal.
- if proto.Equal(got, want) {
- return true
- }
- g := expandedMarshaler.Text(got)
- w := expandedMarshaler.Text(want)
- return g == w
-}
-
-type golden struct {
- m proto.Message
- t, c string
-}
-
-var goldenMessages = makeGolden()
-
-func makeGolden() []golden {
- nested := &pb.Nested{Bunny: "Monty"}
- nb, err := proto.Marshal(nested)
- if err != nil {
- panic(err)
- }
- m1 := &pb.Message{
- Name: "David",
- ResultCount: 47,
- Anything: &anypb.Any{TypeUrl: "type.googleapis.com/" + proto.MessageName(nested), Value: nb},
- }
- m2 := &pb.Message{
- Name: "David",
- ResultCount: 47,
- Anything: &anypb.Any{TypeUrl: "http://[::1]/type.googleapis.com/" + proto.MessageName(nested), Value: nb},
- }
- m3 := &pb.Message{
- Name: "David",
- ResultCount: 47,
- Anything: &anypb.Any{TypeUrl: `type.googleapis.com/"/` + proto.MessageName(nested), Value: nb},
- }
- m4 := &pb.Message{
- Name: "David",
- ResultCount: 47,
- Anything: &anypb.Any{TypeUrl: "type.googleapis.com/a/path/" + proto.MessageName(nested), Value: nb},
- }
- m5 := &anypb.Any{TypeUrl: "type.googleapis.com/" + proto.MessageName(nested), Value: nb}
-
- any1 := &testpb.MyMessage{Count: proto.Int32(47), Name: proto.String("David")}
- proto.SetExtension(any1, testpb.E_Ext_More, &testpb.Ext{Data: proto.String("foo")})
- proto.SetExtension(any1, testpb.E_Ext_Text, proto.String("bar"))
- any1b, err := proto.Marshal(any1)
- if err != nil {
- panic(err)
- }
- any2 := &testpb.MyMessage{Count: proto.Int32(42), Bikeshed: testpb.MyMessage_GREEN.Enum(), RepBytes: [][]byte{[]byte("roboto")}}
- proto.SetExtension(any2, testpb.E_Ext_More, &testpb.Ext{Data: proto.String("baz")})
- any2b, err := proto.Marshal(any2)
- if err != nil {
- panic(err)
- }
- m6 := &pb.Message{
- Name: "David",
- ResultCount: 47,
- Anything: &anypb.Any{TypeUrl: "type.googleapis.com/" + proto.MessageName(any1), Value: any1b},
- ManyThings: []*anypb.Any{
- &anypb.Any{TypeUrl: "type.googleapis.com/" + proto.MessageName(any2), Value: any2b},
- &anypb.Any{TypeUrl: "type.googleapis.com/" + proto.MessageName(any1), Value: any1b},
- },
- }
-
- const (
- m1Golden = `
-name: "David"
-result_count: 47
-anything: <
- [type.googleapis.com/proto3_proto.Nested]: <
- bunny: "Monty"
- >
->
-`
- m2Golden = `
-name: "David"
-result_count: 47
-anything: <
- ["http://[::1]/type.googleapis.com/proto3_proto.Nested"]: <
- bunny: "Monty"
- >
->
-`
- m3Golden = `
-name: "David"
-result_count: 47
-anything: <
- ["type.googleapis.com/\"/proto3_proto.Nested"]: <
- bunny: "Monty"
- >
->
-`
- m4Golden = `
-name: "David"
-result_count: 47
-anything: <
- [type.googleapis.com/a/path/proto3_proto.Nested]: <
- bunny: "Monty"
- >
->
-`
- m5Golden = `
-[type.googleapis.com/proto3_proto.Nested]: <
- bunny: "Monty"
->
-`
- m6Golden = `
-name: "David"
-result_count: 47
-anything: <
- [type.googleapis.com/test_proto.MyMessage]: <
- count: 47
- name: "David"
- [test_proto.Ext.more]: <
- data: "foo"
- >
- [test_proto.Ext.text]: "bar"
- >
->
-many_things: <
- [type.googleapis.com/test_proto.MyMessage]: <
- count: 42
- bikeshed: GREEN
- rep_bytes: "roboto"
- [test_proto.Ext.more]: <
- data: "baz"
- >
- >
->
-many_things: <
- [type.googleapis.com/test_proto.MyMessage]: <
- count: 47
- name: "David"
- [test_proto.Ext.more]: <
- data: "foo"
- >
- [test_proto.Ext.text]: "bar"
- >
->
-`
- )
- return []golden{
- {m1, strings.TrimSpace(m1Golden) + "\n", strings.TrimSpace(compact(m1Golden)) + " "},
- {m2, strings.TrimSpace(m2Golden) + "\n", strings.TrimSpace(compact(m2Golden)) + " "},
- {m3, strings.TrimSpace(m3Golden) + "\n", strings.TrimSpace(compact(m3Golden)) + " "},
- {m4, strings.TrimSpace(m4Golden) + "\n", strings.TrimSpace(compact(m4Golden)) + " "},
- {m5, strings.TrimSpace(m5Golden) + "\n", strings.TrimSpace(compact(m5Golden)) + " "},
- {m6, strings.TrimSpace(m6Golden) + "\n", strings.TrimSpace(compact(m6Golden)) + " "},
- }
-}
-
-func TestMarshalGolden(t *testing.T) {
- for _, tt := range goldenMessages {
- if got, want := expandedMarshaler.Text(tt.m), tt.t; got != want {
- t.Errorf("message %v: got:\n%s\nwant:\n%s", tt.m, got, want)
- }
- if got, want := expandedCompactMarshaler.Text(tt.m), tt.c; got != want {
- t.Errorf("message %v: got:\n`%s`\nwant:\n`%s`", tt.m, got, want)
- }
- }
-}
-
-func TestUnmarshalGolden(t *testing.T) {
- for _, tt := range goldenMessages {
- want := tt.m
- got := proto.Clone(tt.m)
- got.Reset()
- if err := proto.UnmarshalText(tt.t, got); err != nil {
- t.Errorf("failed to unmarshal\n%s\nerror: %v", tt.t, err)
- }
- if !anyEqual(got, want) {
- t.Errorf("message:\n%s\ngot:\n%s\nwant:\n%s", tt.t, got, want)
- }
- got.Reset()
- if err := proto.UnmarshalText(tt.c, got); err != nil {
- t.Errorf("failed to unmarshal\n%s\nerror: %v", tt.c, err)
- }
- if !anyEqual(got, want) {
- t.Errorf("message:\n%s\ngot:\n%s\nwant:\n%s", tt.c, got, want)
- }
- }
-}
-
-func TestMarshalUnknownAny(t *testing.T) {
- m := &pb.Message{
- Anything: &anypb.Any{
- TypeUrl: "foo",
- Value: []byte("bar"),
- },
- }
- want := `anything: <
- type_url: "foo"
- value: "bar"
->
-`
- got := expandedMarshaler.Text(m)
- if got != want {
- t.Errorf("got\n`%s`\nwant\n`%s`", got, want)
- }
-}
-
-func TestAmbiguousAny(t *testing.T) {
- pb := &anypb.Any{}
- err := proto.UnmarshalText(`
- type_url: "ttt/proto3_proto.Nested"
- value: "\n\x05Monty"
- `, pb)
- t.Logf("result: %v (error: %v)", expandedMarshaler.Text(pb), err)
- if err != nil {
- t.Errorf("failed to parse ambiguous Any message: %v", err)
- }
-}
-
-func TestUnmarshalOverwriteAny(t *testing.T) {
- pb := &anypb.Any{}
- err := proto.UnmarshalText(`
- [type.googleapis.com/a/path/proto3_proto.Nested]: <
- bunny: "Monty"
- >
- [type.googleapis.com/a/path/proto3_proto.Nested]: <
- bunny: "Rabbit of Caerbannog"
- >
- `, pb)
- want := `line 7: Any message unpacked multiple times, or "type_url" already set`
- if err.Error() != want {
- t.Errorf("incorrect error.\nHave: %v\nWant: %v", err.Error(), want)
- }
-}
-
-func TestUnmarshalAnyMixAndMatch(t *testing.T) {
- pb := &anypb.Any{}
- err := proto.UnmarshalText(`
- value: "\n\x05Monty"
- [type.googleapis.com/a/path/proto3_proto.Nested]: <
- bunny: "Rabbit of Caerbannog"
- >
- `, pb)
- want := `line 5: Any message unpacked multiple times, or "value" already set`
- if err.Error() != want {
- t.Errorf("incorrect error.\nHave: %v\nWant: %v", err.Error(), want)
- }
-}
diff --git a/vendor/github.com/golang/protobuf/proto/clone_test.go b/vendor/github.com/golang/protobuf/proto/clone_test.go
deleted file mode 100644
index 0d3b12737..000000000
--- a/vendor/github.com/golang/protobuf/proto/clone_test.go
+++ /dev/null
@@ -1,390 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2011 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto_test
-
-import (
- "testing"
-
- "github.com/golang/protobuf/proto"
-
- proto3pb "github.com/golang/protobuf/proto/proto3_proto"
- pb "github.com/golang/protobuf/proto/test_proto"
-)
-
-var cloneTestMessage = &pb.MyMessage{
- Count: proto.Int32(42),
- Name: proto.String("Dave"),
- Pet: []string{"bunny", "kitty", "horsey"},
- Inner: &pb.InnerMessage{
- Host: proto.String("niles"),
- Port: proto.Int32(9099),
- Connected: proto.Bool(true),
- },
- Others: []*pb.OtherMessage{
- {
- Value: []byte("some bytes"),
- },
- },
- Somegroup: &pb.MyMessage_SomeGroup{
- GroupField: proto.Int32(6),
- },
- RepBytes: [][]byte{[]byte("sham"), []byte("wow")},
-}
-
-func init() {
- ext := &pb.Ext{
- Data: proto.String("extension"),
- }
- if err := proto.SetExtension(cloneTestMessage, pb.E_Ext_More, ext); err != nil {
- panic("SetExtension: " + err.Error())
- }
-}
-
-func TestClone(t *testing.T) {
- m := proto.Clone(cloneTestMessage).(*pb.MyMessage)
- if !proto.Equal(m, cloneTestMessage) {
- t.Fatalf("Clone(%v) = %v", cloneTestMessage, m)
- }
-
- // Verify it was a deep copy.
- *m.Inner.Port++
- if proto.Equal(m, cloneTestMessage) {
- t.Error("Mutating clone changed the original")
- }
- // Byte fields and repeated fields should be copied.
- if &m.Pet[0] == &cloneTestMessage.Pet[0] {
- t.Error("Pet: repeated field not copied")
- }
- if &m.Others[0] == &cloneTestMessage.Others[0] {
- t.Error("Others: repeated field not copied")
- }
- if &m.Others[0].Value[0] == &cloneTestMessage.Others[0].Value[0] {
- t.Error("Others[0].Value: bytes field not copied")
- }
- if &m.RepBytes[0] == &cloneTestMessage.RepBytes[0] {
- t.Error("RepBytes: repeated field not copied")
- }
- if &m.RepBytes[0][0] == &cloneTestMessage.RepBytes[0][0] {
- t.Error("RepBytes[0]: bytes field not copied")
- }
-}
-
-func TestCloneNil(t *testing.T) {
- var m *pb.MyMessage
- if c := proto.Clone(m); !proto.Equal(m, c) {
- t.Errorf("Clone(%v) = %v", m, c)
- }
-}
-
-var mergeTests = []struct {
- src, dst, want proto.Message
-}{
- {
- src: &pb.MyMessage{
- Count: proto.Int32(42),
- },
- dst: &pb.MyMessage{
- Name: proto.String("Dave"),
- },
- want: &pb.MyMessage{
- Count: proto.Int32(42),
- Name: proto.String("Dave"),
- },
- },
- {
- src: &pb.MyMessage{
- Inner: &pb.InnerMessage{
- Host: proto.String("hey"),
- Connected: proto.Bool(true),
- },
- Pet: []string{"horsey"},
- Others: []*pb.OtherMessage{
- {
- Value: []byte("some bytes"),
- },
- },
- },
- dst: &pb.MyMessage{
- Inner: &pb.InnerMessage{
- Host: proto.String("niles"),
- Port: proto.Int32(9099),
- },
- Pet: []string{"bunny", "kitty"},
- Others: []*pb.OtherMessage{
- {
- Key: proto.Int64(31415926535),
- },
- {
- // Explicitly test a src=nil field
- Inner: nil,
- },
- },
- },
- want: &pb.MyMessage{
- Inner: &pb.InnerMessage{
- Host: proto.String("hey"),
- Connected: proto.Bool(true),
- Port: proto.Int32(9099),
- },
- Pet: []string{"bunny", "kitty", "horsey"},
- Others: []*pb.OtherMessage{
- {
- Key: proto.Int64(31415926535),
- },
- {},
- {
- Value: []byte("some bytes"),
- },
- },
- },
- },
- {
- src: &pb.MyMessage{
- RepBytes: [][]byte{[]byte("wow")},
- },
- dst: &pb.MyMessage{
- Somegroup: &pb.MyMessage_SomeGroup{
- GroupField: proto.Int32(6),
- },
- RepBytes: [][]byte{[]byte("sham")},
- },
- want: &pb.MyMessage{
- Somegroup: &pb.MyMessage_SomeGroup{
- GroupField: proto.Int32(6),
- },
- RepBytes: [][]byte{[]byte("sham"), []byte("wow")},
- },
- },
- // Check that a scalar bytes field replaces rather than appends.
- {
- src: &pb.OtherMessage{Value: []byte("foo")},
- dst: &pb.OtherMessage{Value: []byte("bar")},
- want: &pb.OtherMessage{Value: []byte("foo")},
- },
- {
- src: &pb.MessageWithMap{
- NameMapping: map[int32]string{6: "Nigel"},
- MsgMapping: map[int64]*pb.FloatingPoint{
- 0x4001: &pb.FloatingPoint{F: proto.Float64(2.0)},
- 0x4002: &pb.FloatingPoint{
- F: proto.Float64(2.0),
- },
- },
- ByteMapping: map[bool][]byte{true: []byte("wowsa")},
- },
- dst: &pb.MessageWithMap{
- NameMapping: map[int32]string{
- 6: "Bruce", // should be overwritten
- 7: "Andrew",
- },
- MsgMapping: map[int64]*pb.FloatingPoint{
- 0x4002: &pb.FloatingPoint{
- F: proto.Float64(3.0),
- Exact: proto.Bool(true),
- }, // the entire message should be overwritten
- },
- },
- want: &pb.MessageWithMap{
- NameMapping: map[int32]string{
- 6: "Nigel",
- 7: "Andrew",
- },
- MsgMapping: map[int64]*pb.FloatingPoint{
- 0x4001: &pb.FloatingPoint{F: proto.Float64(2.0)},
- 0x4002: &pb.FloatingPoint{
- F: proto.Float64(2.0),
- },
- },
- ByteMapping: map[bool][]byte{true: []byte("wowsa")},
- },
- },
- // proto3 shouldn't merge zero values,
- // in the same way that proto2 shouldn't merge nils.
- {
- src: &proto3pb.Message{
- Name: "Aaron",
- Data: []byte(""), // zero value, but not nil
- },
- dst: &proto3pb.Message{
- HeightInCm: 176,
- Data: []byte("texas!"),
- },
- want: &proto3pb.Message{
- Name: "Aaron",
- HeightInCm: 176,
- Data: []byte("texas!"),
- },
- },
- { // Oneof fields should merge by assignment.
- src: &pb.Communique{Union: &pb.Communique_Number{41}},
- dst: &pb.Communique{Union: &pb.Communique_Name{"Bobby Tables"}},
- want: &pb.Communique{Union: &pb.Communique_Number{41}},
- },
- { // Oneof nil is the same as not set.
- src: &pb.Communique{},
- dst: &pb.Communique{Union: &pb.Communique_Name{"Bobby Tables"}},
- want: &pb.Communique{Union: &pb.Communique_Name{"Bobby Tables"}},
- },
- {
- src: &pb.Communique{Union: &pb.Communique_Number{1337}},
- dst: &pb.Communique{},
- want: &pb.Communique{Union: &pb.Communique_Number{1337}},
- },
- {
- src: &pb.Communique{Union: &pb.Communique_Col{pb.MyMessage_RED}},
- dst: &pb.Communique{},
- want: &pb.Communique{Union: &pb.Communique_Col{pb.MyMessage_RED}},
- },
- {
- src: &pb.Communique{Union: &pb.Communique_Data{[]byte("hello")}},
- dst: &pb.Communique{},
- want: &pb.Communique{Union: &pb.Communique_Data{[]byte("hello")}},
- },
- {
- src: &pb.Communique{Union: &pb.Communique_Msg{&pb.Strings{BytesField: []byte{1, 2, 3}}}},
- dst: &pb.Communique{},
- want: &pb.Communique{Union: &pb.Communique_Msg{&pb.Strings{BytesField: []byte{1, 2, 3}}}},
- },
- {
- src: &pb.Communique{Union: &pb.Communique_Msg{}},
- dst: &pb.Communique{},
- want: &pb.Communique{Union: &pb.Communique_Msg{}},
- },
- {
- src: &pb.Communique{Union: &pb.Communique_Msg{&pb.Strings{StringField: proto.String("123")}}},
- dst: &pb.Communique{Union: &pb.Communique_Msg{&pb.Strings{BytesField: []byte{1, 2, 3}}}},
- want: &pb.Communique{Union: &pb.Communique_Msg{&pb.Strings{StringField: proto.String("123"), BytesField: []byte{1, 2, 3}}}},
- },
- {
- src: &proto3pb.Message{
- Terrain: map[string]*proto3pb.Nested{
- "kay_a": &proto3pb.Nested{Cute: true}, // replace
- "kay_b": &proto3pb.Nested{Bunny: "rabbit"}, // insert
- },
- },
- dst: &proto3pb.Message{
- Terrain: map[string]*proto3pb.Nested{
- "kay_a": &proto3pb.Nested{Bunny: "lost"}, // replaced
- "kay_c": &proto3pb.Nested{Bunny: "bunny"}, // keep
- },
- },
- want: &proto3pb.Message{
- Terrain: map[string]*proto3pb.Nested{
- "kay_a": &proto3pb.Nested{Cute: true},
- "kay_b": &proto3pb.Nested{Bunny: "rabbit"},
- "kay_c": &proto3pb.Nested{Bunny: "bunny"},
- },
- },
- },
- {
- src: &pb.GoTest{
- F_BoolRepeated: []bool{},
- F_Int32Repeated: []int32{},
- F_Int64Repeated: []int64{},
- F_Uint32Repeated: []uint32{},
- F_Uint64Repeated: []uint64{},
- F_FloatRepeated: []float32{},
- F_DoubleRepeated: []float64{},
- F_StringRepeated: []string{},
- F_BytesRepeated: [][]byte{},
- },
- dst: &pb.GoTest{},
- want: &pb.GoTest{
- F_BoolRepeated: []bool{},
- F_Int32Repeated: []int32{},
- F_Int64Repeated: []int64{},
- F_Uint32Repeated: []uint32{},
- F_Uint64Repeated: []uint64{},
- F_FloatRepeated: []float32{},
- F_DoubleRepeated: []float64{},
- F_StringRepeated: []string{},
- F_BytesRepeated: [][]byte{},
- },
- },
- {
- src: &pb.GoTest{},
- dst: &pb.GoTest{
- F_BoolRepeated: []bool{},
- F_Int32Repeated: []int32{},
- F_Int64Repeated: []int64{},
- F_Uint32Repeated: []uint32{},
- F_Uint64Repeated: []uint64{},
- F_FloatRepeated: []float32{},
- F_DoubleRepeated: []float64{},
- F_StringRepeated: []string{},
- F_BytesRepeated: [][]byte{},
- },
- want: &pb.GoTest{
- F_BoolRepeated: []bool{},
- F_Int32Repeated: []int32{},
- F_Int64Repeated: []int64{},
- F_Uint32Repeated: []uint32{},
- F_Uint64Repeated: []uint64{},
- F_FloatRepeated: []float32{},
- F_DoubleRepeated: []float64{},
- F_StringRepeated: []string{},
- F_BytesRepeated: [][]byte{},
- },
- },
- {
- src: &pb.GoTest{
- F_BytesRepeated: [][]byte{nil, []byte{}, []byte{0}},
- },
- dst: &pb.GoTest{},
- want: &pb.GoTest{
- F_BytesRepeated: [][]byte{nil, []byte{}, []byte{0}},
- },
- },
- {
- src: &pb.MyMessage{
- Others: []*pb.OtherMessage{},
- },
- dst: &pb.MyMessage{},
- want: &pb.MyMessage{
- Others: []*pb.OtherMessage{},
- },
- },
-}
-
-func TestMerge(t *testing.T) {
- for _, m := range mergeTests {
- got := proto.Clone(m.dst)
- if !proto.Equal(got, m.dst) {
- t.Errorf("Clone()\ngot %v\nwant %v", got, m.dst)
- continue
- }
- proto.Merge(got, m.src)
- if !proto.Equal(got, m.want) {
- t.Errorf("Merge(%v, %v)\ngot %v\nwant %v", m.dst, m.src, got, m.want)
- }
- }
-}
diff --git a/vendor/github.com/golang/protobuf/proto/decode_test.go b/vendor/github.com/golang/protobuf/proto/decode_test.go
deleted file mode 100644
index 949be3abd..000000000
--- a/vendor/github.com/golang/protobuf/proto/decode_test.go
+++ /dev/null
@@ -1,255 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// +build go1.7
-
-package proto_test
-
-import (
- "fmt"
- "testing"
-
- "github.com/golang/protobuf/proto"
- tpb "github.com/golang/protobuf/proto/proto3_proto"
-)
-
-var msgBlackhole = new(tpb.Message)
-
-// BenchmarkVarint32ArraySmall shows the performance on an array of small int32 fields (1 and
-// 2 bytes long).
-func BenchmarkVarint32ArraySmall(b *testing.B) {
- for i := uint(1); i <= 10; i++ {
- dist := genInt32Dist([7]int{0, 3, 1}, 1<<i)
- raw, err := proto.Marshal(&tpb.Message{
- ShortKey: dist,
- })
- if err != nil {
- b.Error("wrong encode", err)
- }
- b.Run(fmt.Sprintf("Len%v", len(dist)), func(b *testing.B) {
- scratchBuf := proto.NewBuffer(nil)
- b.ResetTimer()
- for k := 0; k < b.N; k++ {
- scratchBuf.SetBuf(raw)
- msgBlackhole.Reset()
- if err := scratchBuf.Unmarshal(msgBlackhole); err != nil {
- b.Error("wrong decode", err)
- }
- }
- })
- }
-}
-
-// BenchmarkVarint32ArrayLarge shows the performance on an array of large int32 fields (3 and
-// 4 bytes long, with a small number of 1, 2, 5 and 10 byte long versions).
-func BenchmarkVarint32ArrayLarge(b *testing.B) {
- for i := uint(1); i <= 10; i++ {
- dist := genInt32Dist([7]int{0, 1, 2, 4, 8, 1, 1}, 1<<i)
- raw, err := proto.Marshal(&tpb.Message{
- ShortKey: dist,
- })
- if err != nil {
- b.Error("wrong encode", err)
- }
- b.Run(fmt.Sprintf("Len%v", len(dist)), func(b *testing.B) {
- scratchBuf := proto.NewBuffer(nil)
- b.ResetTimer()
- for k := 0; k < b.N; k++ {
- scratchBuf.SetBuf(raw)
- msgBlackhole.Reset()
- if err := scratchBuf.Unmarshal(msgBlackhole); err != nil {
- b.Error("wrong decode", err)
- }
- }
- })
- }
-}
-
-// BenchmarkVarint64ArraySmall shows the performance on an array of small int64 fields (1 and
-// 2 bytes long).
-func BenchmarkVarint64ArraySmall(b *testing.B) {
- for i := uint(1); i <= 10; i++ {
- dist := genUint64Dist([11]int{0, 3, 1}, 1<<i)
- raw, err := proto.Marshal(&tpb.Message{
- Key: dist,
- })
- if err != nil {
- b.Error("wrong encode", err)
- }
- b.Run(fmt.Sprintf("Len%v", len(dist)), func(b *testing.B) {
- scratchBuf := proto.NewBuffer(nil)
- b.ResetTimer()
- for k := 0; k < b.N; k++ {
- scratchBuf.SetBuf(raw)
- msgBlackhole.Reset()
- if err := scratchBuf.Unmarshal(msgBlackhole); err != nil {
- b.Error("wrong decode", err)
- }
- }
- })
- }
-}
-
-// BenchmarkVarint64ArrayLarge shows the performance on an array of large int64 fields (6, 7,
-// and 8 bytes long with a small number of the other sizes).
-func BenchmarkVarint64ArrayLarge(b *testing.B) {
- for i := uint(1); i <= 10; i++ {
- dist := genUint64Dist([11]int{0, 1, 1, 2, 4, 8, 16, 32, 16, 1, 1}, 1<<i)
- raw, err := proto.Marshal(&tpb.Message{
- Key: dist,
- })
- if err != nil {
- b.Error("wrong encode", err)
- }
- b.Run(fmt.Sprintf("Len%v", len(dist)), func(b *testing.B) {
- scratchBuf := proto.NewBuffer(nil)
- b.ResetTimer()
- for k := 0; k < b.N; k++ {
- scratchBuf.SetBuf(raw)
- msgBlackhole.Reset()
- if err := scratchBuf.Unmarshal(msgBlackhole); err != nil {
- b.Error("wrong decode", err)
- }
- }
- })
- }
-}
-
-// BenchmarkVarint64ArrayMixed shows the performance of lots of small messages, each
-// containing a small number of large (3, 4, and 5 byte) repeated int64s.
-func BenchmarkVarint64ArrayMixed(b *testing.B) {
- for i := uint(1); i <= 1<<5; i <<= 1 {
- dist := genUint64Dist([11]int{0, 0, 0, 4, 6, 4, 0, 0, 0, 0, 0}, int(i))
- // number of sub fields
- for k := uint(1); k <= 1<<10; k <<= 2 {
- msg := &tpb.Message{}
- for m := uint(0); m < k; m++ {
- msg.Children = append(msg.Children, &tpb.Message{
- Key: dist,
- })
- }
- raw, err := proto.Marshal(msg)
- if err != nil {
- b.Error("wrong encode", err)
- }
- b.Run(fmt.Sprintf("Fields%vLen%v", k, i), func(b *testing.B) {
- scratchBuf := proto.NewBuffer(nil)
- b.ResetTimer()
- for k := 0; k < b.N; k++ {
- scratchBuf.SetBuf(raw)
- msgBlackhole.Reset()
- if err := scratchBuf.Unmarshal(msgBlackhole); err != nil {
- b.Error("wrong decode", err)
- }
- }
- })
- }
- }
-}
-
-// genInt32Dist generates a slice of ints that will match the size distribution of dist.
-// A size of 6 corresponds to a max length varint32, which is 10 bytes. The distribution
-// is 1-indexed. (i.e. the value at index 1 is how many 1 byte ints to create).
-func genInt32Dist(dist [7]int, count int) (dest []int32) {
- for i := 0; i < count; i++ {
- for k := 0; k < len(dist); k++ {
- var num int32
- switch k {
- case 1:
- num = 1<<7 - 1
- case 2:
- num = 1<<14 - 1
- case 3:
- num = 1<<21 - 1
- case 4:
- num = 1<<28 - 1
- case 5:
- num = 1<<29 - 1
- case 6:
- num = -1
- }
- for m := 0; m < dist[k]; m++ {
- dest = append(dest, num)
- }
- }
- }
- return
-}
-
-// genUint64Dist generates a slice of ints that will match the size distribution of dist.
-// The distribution is 1-indexed. (i.e. the value at index 1 is how many 1 byte ints to create).
-func genUint64Dist(dist [11]int, count int) (dest []uint64) {
- for i := 0; i < count; i++ {
- for k := 0; k < len(dist); k++ {
- var num uint64
- switch k {
- case 1:
- num = 1<<7 - 1
- case 2:
- num = 1<<14 - 1
- case 3:
- num = 1<<21 - 1
- case 4:
- num = 1<<28 - 1
- case 5:
- num = 1<<35 - 1
- case 6:
- num = 1<<42 - 1
- case 7:
- num = 1<<49 - 1
- case 8:
- num = 1<<56 - 1
- case 9:
- num = 1<<63 - 1
- case 10:
- num = 1<<64 - 1
- }
- for m := 0; m < dist[k]; m++ {
- dest = append(dest, num)
- }
- }
- }
- return
-}
-
-// BenchmarkDecodeEmpty measures the overhead of doing the minimal possible decode.
-func BenchmarkDecodeEmpty(b *testing.B) {
- raw, err := proto.Marshal(&tpb.Message{})
- if err != nil {
- b.Error("wrong encode", err)
- }
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- if err := proto.Unmarshal(raw, msgBlackhole); err != nil {
- b.Error("wrong decode", err)
- }
- }
-}
diff --git a/vendor/github.com/golang/protobuf/proto/discard_test.go b/vendor/github.com/golang/protobuf/proto/discard_test.go
deleted file mode 100644
index a2ff5509d..000000000
--- a/vendor/github.com/golang/protobuf/proto/discard_test.go
+++ /dev/null
@@ -1,170 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2017 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto_test
-
-import (
- "testing"
-
- "github.com/golang/protobuf/proto"
-
- proto3pb "github.com/golang/protobuf/proto/proto3_proto"
- pb "github.com/golang/protobuf/proto/test_proto"
-)
-
-func TestDiscardUnknown(t *testing.T) {
- tests := []struct {
- desc string
- in, want proto.Message
- }{{
- desc: "Nil",
- in: nil, want: nil, // Should not panic
- }, {
- desc: "NilPtr",
- in: (*proto3pb.Message)(nil), want: (*proto3pb.Message)(nil), // Should not panic
- }, {
- desc: "Nested",
- in: &proto3pb.Message{
- Name: "Aaron",
- Nested: &proto3pb.Nested{Cute: true, XXX_unrecognized: []byte("blah")},
- XXX_unrecognized: []byte("blah"),
- },
- want: &proto3pb.Message{
- Name: "Aaron",
- Nested: &proto3pb.Nested{Cute: true},
- },
- }, {
- desc: "Slice",
- in: &proto3pb.Message{
- Name: "Aaron",
- Children: []*proto3pb.Message{
- {Name: "Sarah", XXX_unrecognized: []byte("blah")},
- {Name: "Abraham", XXX_unrecognized: []byte("blah")},
- },
- XXX_unrecognized: []byte("blah"),
- },
- want: &proto3pb.Message{
- Name: "Aaron",
- Children: []*proto3pb.Message{
- {Name: "Sarah"},
- {Name: "Abraham"},
- },
- },
- }, {
- desc: "OneOf",
- in: &pb.Communique{
- Union: &pb.Communique_Msg{&pb.Strings{
- StringField: proto.String("123"),
- XXX_unrecognized: []byte("blah"),
- }},
- XXX_unrecognized: []byte("blah"),
- },
- want: &pb.Communique{
- Union: &pb.Communique_Msg{&pb.Strings{StringField: proto.String("123")}},
- },
- }, {
- desc: "Map",
- in: &pb.MessageWithMap{MsgMapping: map[int64]*pb.FloatingPoint{
- 0x4002: &pb.FloatingPoint{
- Exact: proto.Bool(true),
- XXX_unrecognized: []byte("blah"),
- },
- }},
- want: &pb.MessageWithMap{MsgMapping: map[int64]*pb.FloatingPoint{
- 0x4002: &pb.FloatingPoint{Exact: proto.Bool(true)},
- }},
- }, {
- desc: "Extension",
- in: func() proto.Message {
- m := &pb.MyMessage{
- Count: proto.Int32(42),
- Somegroup: &pb.MyMessage_SomeGroup{
- GroupField: proto.Int32(6),
- XXX_unrecognized: []byte("blah"),
- },
- XXX_unrecognized: []byte("blah"),
- }
- proto.SetExtension(m, pb.E_Ext_More, &pb.Ext{
- Data: proto.String("extension"),
- XXX_unrecognized: []byte("blah"),
- })
- return m
- }(),
- want: func() proto.Message {
- m := &pb.MyMessage{
- Count: proto.Int32(42),
- Somegroup: &pb.MyMessage_SomeGroup{GroupField: proto.Int32(6)},
- }
- proto.SetExtension(m, pb.E_Ext_More, &pb.Ext{Data: proto.String("extension")})
- return m
- }(),
- }}
-
- // Test the legacy code path.
- for _, tt := range tests {
- // Clone the input so that we don't alter the original.
- in := tt.in
- if in != nil {
- in = proto.Clone(tt.in)
- }
-
- var m LegacyMessage
- m.Message, _ = in.(*proto3pb.Message)
- m.Communique, _ = in.(*pb.Communique)
- m.MessageWithMap, _ = in.(*pb.MessageWithMap)
- m.MyMessage, _ = in.(*pb.MyMessage)
- proto.DiscardUnknown(&m)
- if !proto.Equal(in, tt.want) {
- t.Errorf("test %s/Legacy, expected unknown fields to be discarded\ngot %v\nwant %v", tt.desc, in, tt.want)
- }
- }
-
- for _, tt := range tests {
- proto.DiscardUnknown(tt.in)
- if !proto.Equal(tt.in, tt.want) {
- t.Errorf("test %s, expected unknown fields to be discarded\ngot %v\nwant %v", tt.desc, tt.in, tt.want)
- }
- }
-}
-
-// LegacyMessage is a proto.Message that has several nested messages.
-// This does not have the XXX_DiscardUnknown method and so forces DiscardUnknown
-// to use the legacy fallback logic.
-type LegacyMessage struct {
- Message *proto3pb.Message
- Communique *pb.Communique
- MessageWithMap *pb.MessageWithMap
- MyMessage *pb.MyMessage
-}
-
-func (m *LegacyMessage) Reset() { *m = LegacyMessage{} }
-func (m *LegacyMessage) String() string { return proto.CompactTextString(m) }
-func (*LegacyMessage) ProtoMessage() {}
diff --git a/vendor/github.com/golang/protobuf/proto/encode_test.go b/vendor/github.com/golang/protobuf/proto/encode_test.go
deleted file mode 100644
index a7209475f..000000000
--- a/vendor/github.com/golang/protobuf/proto/encode_test.go
+++ /dev/null
@@ -1,85 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// +build go1.7
-
-package proto_test
-
-import (
- "strconv"
- "testing"
-
- "github.com/golang/protobuf/proto"
- tpb "github.com/golang/protobuf/proto/proto3_proto"
- "github.com/golang/protobuf/ptypes"
-)
-
-var (
- blackhole []byte
-)
-
-// BenchmarkAny creates increasingly large arbitrary Any messages. The type is always the
-// same.
-func BenchmarkAny(b *testing.B) {
- data := make([]byte, 1<<20)
- quantum := 1 << 10
- for i := uint(0); i <= 10; i++ {
- b.Run(strconv.Itoa(quantum<<i), func(b *testing.B) {
- for k := 0; k < b.N; k++ {
- inner := &tpb.Message{
- Data: data[:quantum<<i],
- }
- outer, err := ptypes.MarshalAny(inner)
- if err != nil {
- b.Error("wrong encode", err)
- }
- raw, err := proto.Marshal(&tpb.Message{
- Anything: outer,
- })
- if err != nil {
- b.Error("wrong encode", err)
- }
- blackhole = raw
- }
- })
- }
-}
-
-// BenchmarkEmpy measures the overhead of doing the minimal possible encode.
-func BenchmarkEmpy(b *testing.B) {
- for i := 0; i < b.N; i++ {
- raw, err := proto.Marshal(&tpb.Message{})
- if err != nil {
- b.Error("wrong encode", err)
- }
- blackhole = raw
- }
-}
diff --git a/vendor/github.com/golang/protobuf/proto/equal_test.go b/vendor/github.com/golang/protobuf/proto/equal_test.go
deleted file mode 100644
index 93ff88f3a..000000000
--- a/vendor/github.com/golang/protobuf/proto/equal_test.go
+++ /dev/null
@@ -1,244 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2011 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto_test
-
-import (
- "testing"
-
- . "github.com/golang/protobuf/proto"
- proto3pb "github.com/golang/protobuf/proto/proto3_proto"
- pb "github.com/golang/protobuf/proto/test_proto"
-)
-
-// Four identical base messages.
-// The init function adds extensions to some of them.
-var messageWithoutExtension = &pb.MyMessage{Count: Int32(7)}
-var messageWithExtension1a = &pb.MyMessage{Count: Int32(7)}
-var messageWithExtension1b = &pb.MyMessage{Count: Int32(7)}
-var messageWithExtension2 = &pb.MyMessage{Count: Int32(7)}
-var messageWithExtension3a = &pb.MyMessage{Count: Int32(7)}
-var messageWithExtension3b = &pb.MyMessage{Count: Int32(7)}
-var messageWithExtension3c = &pb.MyMessage{Count: Int32(7)}
-
-// Two messages with non-message extensions.
-var messageWithInt32Extension1 = &pb.MyMessage{Count: Int32(8)}
-var messageWithInt32Extension2 = &pb.MyMessage{Count: Int32(8)}
-
-func init() {
- ext1 := &pb.Ext{Data: String("Kirk")}
- ext2 := &pb.Ext{Data: String("Picard")}
-
- // messageWithExtension1a has ext1, but never marshals it.
- if err := SetExtension(messageWithExtension1a, pb.E_Ext_More, ext1); err != nil {
- panic("SetExtension on 1a failed: " + err.Error())
- }
-
- // messageWithExtension1b is the unmarshaled form of messageWithExtension1a.
- if err := SetExtension(messageWithExtension1b, pb.E_Ext_More, ext1); err != nil {
- panic("SetExtension on 1b failed: " + err.Error())
- }
- buf, err := Marshal(messageWithExtension1b)
- if err != nil {
- panic("Marshal of 1b failed: " + err.Error())
- }
- messageWithExtension1b.Reset()
- if err := Unmarshal(buf, messageWithExtension1b); err != nil {
- panic("Unmarshal of 1b failed: " + err.Error())
- }
-
- // messageWithExtension2 has ext2.
- if err := SetExtension(messageWithExtension2, pb.E_Ext_More, ext2); err != nil {
- panic("SetExtension on 2 failed: " + err.Error())
- }
-
- if err := SetExtension(messageWithInt32Extension1, pb.E_Ext_Number, Int32(23)); err != nil {
- panic("SetExtension on Int32-1 failed: " + err.Error())
- }
- if err := SetExtension(messageWithInt32Extension1, pb.E_Ext_Number, Int32(24)); err != nil {
- panic("SetExtension on Int32-2 failed: " + err.Error())
- }
-
- // messageWithExtension3{a,b,c} has unregistered extension.
- if RegisteredExtensions(messageWithExtension3a)[200] != nil {
- panic("expect extension 200 unregistered")
- }
- bytes := []byte{
- 0xc0, 0x0c, 0x01, // id=200, wiretype=0 (varint), data=1
- }
- bytes2 := []byte{
- 0xc0, 0x0c, 0x02, // id=200, wiretype=0 (varint), data=2
- }
- SetRawExtension(messageWithExtension3a, 200, bytes)
- SetRawExtension(messageWithExtension3b, 200, bytes)
- SetRawExtension(messageWithExtension3c, 200, bytes2)
-}
-
-var EqualTests = []struct {
- desc string
- a, b Message
- exp bool
-}{
- {"different types", &pb.GoEnum{}, &pb.GoTestField{}, false},
- {"equal empty", &pb.GoEnum{}, &pb.GoEnum{}, true},
- {"nil vs nil", nil, nil, true},
- {"typed nil vs typed nil", (*pb.GoEnum)(nil), (*pb.GoEnum)(nil), true},
- {"typed nil vs empty", (*pb.GoEnum)(nil), &pb.GoEnum{}, false},
- {"different typed nil", (*pb.GoEnum)(nil), (*pb.GoTestField)(nil), false},
-
- {"one set field, one unset field", &pb.GoTestField{Label: String("foo")}, &pb.GoTestField{}, false},
- {"one set field zero, one unset field", &pb.GoTest{Param: Int32(0)}, &pb.GoTest{}, false},
- {"different set fields", &pb.GoTestField{Label: String("foo")}, &pb.GoTestField{Label: String("bar")}, false},
- {"equal set", &pb.GoTestField{Label: String("foo")}, &pb.GoTestField{Label: String("foo")}, true},
-
- {"repeated, one set", &pb.GoTest{F_Int32Repeated: []int32{2, 3}}, &pb.GoTest{}, false},
- {"repeated, different length", &pb.GoTest{F_Int32Repeated: []int32{2, 3}}, &pb.GoTest{F_Int32Repeated: []int32{2}}, false},
- {"repeated, different value", &pb.GoTest{F_Int32Repeated: []int32{2}}, &pb.GoTest{F_Int32Repeated: []int32{3}}, false},
- {"repeated, equal", &pb.GoTest{F_Int32Repeated: []int32{2, 4}}, &pb.GoTest{F_Int32Repeated: []int32{2, 4}}, true},
- {"repeated, nil equal nil", &pb.GoTest{F_Int32Repeated: nil}, &pb.GoTest{F_Int32Repeated: nil}, true},
- {"repeated, nil equal empty", &pb.GoTest{F_Int32Repeated: nil}, &pb.GoTest{F_Int32Repeated: []int32{}}, true},
- {"repeated, empty equal nil", &pb.GoTest{F_Int32Repeated: []int32{}}, &pb.GoTest{F_Int32Repeated: nil}, true},
-
- {
- "nested, different",
- &pb.GoTest{RequiredField: &pb.GoTestField{Label: String("foo")}},
- &pb.GoTest{RequiredField: &pb.GoTestField{Label: String("bar")}},
- false,
- },
- {
- "nested, equal",
- &pb.GoTest{RequiredField: &pb.GoTestField{Label: String("wow")}},
- &pb.GoTest{RequiredField: &pb.GoTestField{Label: String("wow")}},
- true,
- },
-
- {"bytes", &pb.OtherMessage{Value: []byte("foo")}, &pb.OtherMessage{Value: []byte("foo")}, true},
- {"bytes, empty", &pb.OtherMessage{Value: []byte{}}, &pb.OtherMessage{Value: []byte{}}, true},
- {"bytes, empty vs nil", &pb.OtherMessage{Value: []byte{}}, &pb.OtherMessage{Value: nil}, false},
- {
- "repeated bytes",
- &pb.MyMessage{RepBytes: [][]byte{[]byte("sham"), []byte("wow")}},
- &pb.MyMessage{RepBytes: [][]byte{[]byte("sham"), []byte("wow")}},
- true,
- },
- // In proto3, []byte{} and []byte(nil) are equal.
- {"proto3 bytes, empty vs nil", &proto3pb.Message{Data: []byte{}}, &proto3pb.Message{Data: nil}, true},
-
- {"extension vs. no extension", messageWithoutExtension, messageWithExtension1a, false},
- {"extension vs. same extension", messageWithExtension1a, messageWithExtension1b, true},
- {"extension vs. different extension", messageWithExtension1a, messageWithExtension2, false},
-
- {"int32 extension vs. itself", messageWithInt32Extension1, messageWithInt32Extension1, true},
- {"int32 extension vs. a different int32", messageWithInt32Extension1, messageWithInt32Extension2, false},
-
- {"unregistered extension same", messageWithExtension3a, messageWithExtension3b, true},
- {"unregistered extension different", messageWithExtension3a, messageWithExtension3c, false},
-
- {
- "message with group",
- &pb.MyMessage{
- Count: Int32(1),
- Somegroup: &pb.MyMessage_SomeGroup{
- GroupField: Int32(5),
- },
- },
- &pb.MyMessage{
- Count: Int32(1),
- Somegroup: &pb.MyMessage_SomeGroup{
- GroupField: Int32(5),
- },
- },
- true,
- },
-
- {
- "map same",
- &pb.MessageWithMap{NameMapping: map[int32]string{1: "Ken"}},
- &pb.MessageWithMap{NameMapping: map[int32]string{1: "Ken"}},
- true,
- },
- {
- "map different entry",
- &pb.MessageWithMap{NameMapping: map[int32]string{1: "Ken"}},
- &pb.MessageWithMap{NameMapping: map[int32]string{2: "Rob"}},
- false,
- },
- {
- "map different key only",
- &pb.MessageWithMap{NameMapping: map[int32]string{1: "Ken"}},
- &pb.MessageWithMap{NameMapping: map[int32]string{2: "Ken"}},
- false,
- },
- {
- "map different value only",
- &pb.MessageWithMap{NameMapping: map[int32]string{1: "Ken"}},
- &pb.MessageWithMap{NameMapping: map[int32]string{1: "Rob"}},
- false,
- },
- {
- "zero-length maps same",
- &pb.MessageWithMap{NameMapping: map[int32]string{}},
- &pb.MessageWithMap{NameMapping: nil},
- true,
- },
- {
- "orders in map don't matter",
- &pb.MessageWithMap{NameMapping: map[int32]string{1: "Ken", 2: "Rob"}},
- &pb.MessageWithMap{NameMapping: map[int32]string{2: "Rob", 1: "Ken"}},
- true,
- },
- {
- "oneof same",
- &pb.Communique{Union: &pb.Communique_Number{41}},
- &pb.Communique{Union: &pb.Communique_Number{41}},
- true,
- },
- {
- "oneof one nil",
- &pb.Communique{Union: &pb.Communique_Number{41}},
- &pb.Communique{},
- false,
- },
- {
- "oneof different",
- &pb.Communique{Union: &pb.Communique_Number{41}},
- &pb.Communique{Union: &pb.Communique_Name{"Bobby Tables"}},
- false,
- },
-}
-
-func TestEqual(t *testing.T) {
- for _, tc := range EqualTests {
- if res := Equal(tc.a, tc.b); res != tc.exp {
- t.Errorf("%v: Equal(%v, %v) = %v, want %v", tc.desc, tc.a, tc.b, res, tc.exp)
- }
- }
-}
diff --git a/vendor/github.com/golang/protobuf/proto/extensions_test.go b/vendor/github.com/golang/protobuf/proto/extensions_test.go
deleted file mode 100644
index dc69fe971..000000000
--- a/vendor/github.com/golang/protobuf/proto/extensions_test.go
+++ /dev/null
@@ -1,688 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2014 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto_test
-
-import (
- "bytes"
- "fmt"
- "io"
- "reflect"
- "sort"
- "strings"
- "testing"
-
- "github.com/golang/protobuf/proto"
- pb "github.com/golang/protobuf/proto/test_proto"
- "golang.org/x/sync/errgroup"
-)
-
-func TestGetExtensionsWithMissingExtensions(t *testing.T) {
- msg := &pb.MyMessage{}
- ext1 := &pb.Ext{}
- if err := proto.SetExtension(msg, pb.E_Ext_More, ext1); err != nil {
- t.Fatalf("Could not set ext1: %s", err)
- }
- exts, err := proto.GetExtensions(msg, []*proto.ExtensionDesc{
- pb.E_Ext_More,
- pb.E_Ext_Text,
- })
- if err != nil {
- t.Fatalf("GetExtensions() failed: %s", err)
- }
- if exts[0] != ext1 {
- t.Errorf("ext1 not in returned extensions: %T %v", exts[0], exts[0])
- }
- if exts[1] != nil {
- t.Errorf("ext2 in returned extensions: %T %v", exts[1], exts[1])
- }
-}
-
-func TestGetExtensionWithEmptyBuffer(t *testing.T) {
- // Make sure that GetExtension returns an error if its
- // undecoded buffer is empty.
- msg := &pb.MyMessage{}
- proto.SetRawExtension(msg, pb.E_Ext_More.Field, []byte{})
- _, err := proto.GetExtension(msg, pb.E_Ext_More)
- if want := io.ErrUnexpectedEOF; err != want {
- t.Errorf("unexpected error in GetExtension from empty buffer: got %v, want %v", err, want)
- }
-}
-
-func TestGetExtensionForIncompleteDesc(t *testing.T) {
- msg := &pb.MyMessage{Count: proto.Int32(0)}
- extdesc1 := &proto.ExtensionDesc{
- ExtendedType: (*pb.MyMessage)(nil),
- ExtensionType: (*bool)(nil),
- Field: 123456789,
- Name: "a.b",
- Tag: "varint,123456789,opt",
- }
- ext1 := proto.Bool(true)
- if err := proto.SetExtension(msg, extdesc1, ext1); err != nil {
- t.Fatalf("Could not set ext1: %s", err)
- }
- extdesc2 := &proto.ExtensionDesc{
- ExtendedType: (*pb.MyMessage)(nil),
- ExtensionType: ([]byte)(nil),
- Field: 123456790,
- Name: "a.c",
- Tag: "bytes,123456790,opt",
- }
- ext2 := []byte{0, 1, 2, 3, 4, 5, 6, 7}
- if err := proto.SetExtension(msg, extdesc2, ext2); err != nil {
- t.Fatalf("Could not set ext2: %s", err)
- }
- extdesc3 := &proto.ExtensionDesc{
- ExtendedType: (*pb.MyMessage)(nil),
- ExtensionType: (*pb.Ext)(nil),
- Field: 123456791,
- Name: "a.d",
- Tag: "bytes,123456791,opt",
- }
- ext3 := &pb.Ext{Data: proto.String("foo")}
- if err := proto.SetExtension(msg, extdesc3, ext3); err != nil {
- t.Fatalf("Could not set ext3: %s", err)
- }
-
- b, err := proto.Marshal(msg)
- if err != nil {
- t.Fatalf("Could not marshal msg: %v", err)
- }
- if err := proto.Unmarshal(b, msg); err != nil {
- t.Fatalf("Could not unmarshal into msg: %v", err)
- }
-
- var expected proto.Buffer
- if err := expected.EncodeVarint(uint64((extdesc1.Field << 3) | proto.WireVarint)); err != nil {
- t.Fatalf("failed to compute expected prefix for ext1: %s", err)
- }
- if err := expected.EncodeVarint(1 /* bool true */); err != nil {
- t.Fatalf("failed to compute expected value for ext1: %s", err)
- }
-
- if b, err := proto.GetExtension(msg, &proto.ExtensionDesc{Field: extdesc1.Field}); err != nil {
- t.Fatalf("Failed to get raw value for ext1: %s", err)
- } else if !reflect.DeepEqual(b, expected.Bytes()) {
- t.Fatalf("Raw value for ext1: got %v, want %v", b, expected.Bytes())
- }
-
- expected = proto.Buffer{} // reset
- if err := expected.EncodeVarint(uint64((extdesc2.Field << 3) | proto.WireBytes)); err != nil {
- t.Fatalf("failed to compute expected prefix for ext2: %s", err)
- }
- if err := expected.EncodeRawBytes(ext2); err != nil {
- t.Fatalf("failed to compute expected value for ext2: %s", err)
- }
-
- if b, err := proto.GetExtension(msg, &proto.ExtensionDesc{Field: extdesc2.Field}); err != nil {
- t.Fatalf("Failed to get raw value for ext2: %s", err)
- } else if !reflect.DeepEqual(b, expected.Bytes()) {
- t.Fatalf("Raw value for ext2: got %v, want %v", b, expected.Bytes())
- }
-
- expected = proto.Buffer{} // reset
- if err := expected.EncodeVarint(uint64((extdesc3.Field << 3) | proto.WireBytes)); err != nil {
- t.Fatalf("failed to compute expected prefix for ext3: %s", err)
- }
- if b, err := proto.Marshal(ext3); err != nil {
- t.Fatalf("failed to compute expected value for ext3: %s", err)
- } else if err := expected.EncodeRawBytes(b); err != nil {
- t.Fatalf("failed to compute expected value for ext3: %s", err)
- }
-
- if b, err := proto.GetExtension(msg, &proto.ExtensionDesc{Field: extdesc3.Field}); err != nil {
- t.Fatalf("Failed to get raw value for ext3: %s", err)
- } else if !reflect.DeepEqual(b, expected.Bytes()) {
- t.Fatalf("Raw value for ext3: got %v, want %v", b, expected.Bytes())
- }
-}
-
-func TestExtensionDescsWithUnregisteredExtensions(t *testing.T) {
- msg := &pb.MyMessage{Count: proto.Int32(0)}
- extdesc1 := pb.E_Ext_More
- if descs, err := proto.ExtensionDescs(msg); len(descs) != 0 || err != nil {
- t.Errorf("proto.ExtensionDescs: got %d descs, error %v; want 0, nil", len(descs), err)
- }
-
- ext1 := &pb.Ext{}
- if err := proto.SetExtension(msg, extdesc1, ext1); err != nil {
- t.Fatalf("Could not set ext1: %s", err)
- }
- extdesc2 := &proto.ExtensionDesc{
- ExtendedType: (*pb.MyMessage)(nil),
- ExtensionType: (*bool)(nil),
- Field: 123456789,
- Name: "a.b",
- Tag: "varint,123456789,opt",
- }
- ext2 := proto.Bool(false)
- if err := proto.SetExtension(msg, extdesc2, ext2); err != nil {
- t.Fatalf("Could not set ext2: %s", err)
- }
-
- b, err := proto.Marshal(msg)
- if err != nil {
- t.Fatalf("Could not marshal msg: %v", err)
- }
- if err := proto.Unmarshal(b, msg); err != nil {
- t.Fatalf("Could not unmarshal into msg: %v", err)
- }
-
- descs, err := proto.ExtensionDescs(msg)
- if err != nil {
- t.Fatalf("proto.ExtensionDescs: got error %v", err)
- }
- sortExtDescs(descs)
- wantDescs := []*proto.ExtensionDesc{extdesc1, {Field: extdesc2.Field}}
- if !reflect.DeepEqual(descs, wantDescs) {
- t.Errorf("proto.ExtensionDescs(msg) sorted extension ids: got %+v, want %+v", descs, wantDescs)
- }
-}
-
-type ExtensionDescSlice []*proto.ExtensionDesc
-
-func (s ExtensionDescSlice) Len() int { return len(s) }
-func (s ExtensionDescSlice) Less(i, j int) bool { return s[i].Field < s[j].Field }
-func (s ExtensionDescSlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
-
-func sortExtDescs(s []*proto.ExtensionDesc) {
- sort.Sort(ExtensionDescSlice(s))
-}
-
-func TestGetExtensionStability(t *testing.T) {
- check := func(m *pb.MyMessage) bool {
- ext1, err := proto.GetExtension(m, pb.E_Ext_More)
- if err != nil {
- t.Fatalf("GetExtension() failed: %s", err)
- }
- ext2, err := proto.GetExtension(m, pb.E_Ext_More)
- if err != nil {
- t.Fatalf("GetExtension() failed: %s", err)
- }
- return ext1 == ext2
- }
- msg := &pb.MyMessage{Count: proto.Int32(4)}
- ext0 := &pb.Ext{}
- if err := proto.SetExtension(msg, pb.E_Ext_More, ext0); err != nil {
- t.Fatalf("Could not set ext1: %s", ext0)
- }
- if !check(msg) {
- t.Errorf("GetExtension() not stable before marshaling")
- }
- bb, err := proto.Marshal(msg)
- if err != nil {
- t.Fatalf("Marshal() failed: %s", err)
- }
- msg1 := &pb.MyMessage{}
- err = proto.Unmarshal(bb, msg1)
- if err != nil {
- t.Fatalf("Unmarshal() failed: %s", err)
- }
- if !check(msg1) {
- t.Errorf("GetExtension() not stable after unmarshaling")
- }
-}
-
-func TestGetExtensionDefaults(t *testing.T) {
- var setFloat64 float64 = 1
- var setFloat32 float32 = 2
- var setInt32 int32 = 3
- var setInt64 int64 = 4
- var setUint32 uint32 = 5
- var setUint64 uint64 = 6
- var setBool = true
- var setBool2 = false
- var setString = "Goodnight string"
- var setBytes = []byte("Goodnight bytes")
- var setEnum = pb.DefaultsMessage_TWO
-
- type testcase struct {
- ext *proto.ExtensionDesc // Extension we are testing.
- want interface{} // Expected value of extension, or nil (meaning that GetExtension will fail).
- def interface{} // Expected value of extension after ClearExtension().
- }
- tests := []testcase{
- {pb.E_NoDefaultDouble, setFloat64, nil},
- {pb.E_NoDefaultFloat, setFloat32, nil},
- {pb.E_NoDefaultInt32, setInt32, nil},
- {pb.E_NoDefaultInt64, setInt64, nil},
- {pb.E_NoDefaultUint32, setUint32, nil},
- {pb.E_NoDefaultUint64, setUint64, nil},
- {pb.E_NoDefaultSint32, setInt32, nil},
- {pb.E_NoDefaultSint64, setInt64, nil},
- {pb.E_NoDefaultFixed32, setUint32, nil},
- {pb.E_NoDefaultFixed64, setUint64, nil},
- {pb.E_NoDefaultSfixed32, setInt32, nil},
- {pb.E_NoDefaultSfixed64, setInt64, nil},
- {pb.E_NoDefaultBool, setBool, nil},
- {pb.E_NoDefaultBool, setBool2, nil},
- {pb.E_NoDefaultString, setString, nil},
- {pb.E_NoDefaultBytes, setBytes, nil},
- {pb.E_NoDefaultEnum, setEnum, nil},
- {pb.E_DefaultDouble, setFloat64, float64(3.1415)},
- {pb.E_DefaultFloat, setFloat32, float32(3.14)},
- {pb.E_DefaultInt32, setInt32, int32(42)},
- {pb.E_DefaultInt64, setInt64, int64(43)},
- {pb.E_DefaultUint32, setUint32, uint32(44)},
- {pb.E_DefaultUint64, setUint64, uint64(45)},
- {pb.E_DefaultSint32, setInt32, int32(46)},
- {pb.E_DefaultSint64, setInt64, int64(47)},
- {pb.E_DefaultFixed32, setUint32, uint32(48)},
- {pb.E_DefaultFixed64, setUint64, uint64(49)},
- {pb.E_DefaultSfixed32, setInt32, int32(50)},
- {pb.E_DefaultSfixed64, setInt64, int64(51)},
- {pb.E_DefaultBool, setBool, true},
- {pb.E_DefaultBool, setBool2, true},
- {pb.E_DefaultString, setString, "Hello, string,def=foo"},
- {pb.E_DefaultBytes, setBytes, []byte("Hello, bytes")},
- {pb.E_DefaultEnum, setEnum, pb.DefaultsMessage_ONE},
- }
-
- checkVal := func(test testcase, msg *pb.DefaultsMessage, valWant interface{}) error {
- val, err := proto.GetExtension(msg, test.ext)
- if err != nil {
- if valWant != nil {
- return fmt.Errorf("GetExtension(): %s", err)
- }
- if want := proto.ErrMissingExtension; err != want {
- return fmt.Errorf("Unexpected error: got %v, want %v", err, want)
- }
- return nil
- }
-
- // All proto2 extension values are either a pointer to a value or a slice of values.
- ty := reflect.TypeOf(val)
- tyWant := reflect.TypeOf(test.ext.ExtensionType)
- if got, want := ty, tyWant; got != want {
- return fmt.Errorf("unexpected reflect.TypeOf(): got %v want %v", got, want)
- }
- tye := ty.Elem()
- tyeWant := tyWant.Elem()
- if got, want := tye, tyeWant; got != want {
- return fmt.Errorf("unexpected reflect.TypeOf().Elem(): got %v want %v", got, want)
- }
-
- // Check the name of the type of the value.
- // If it is an enum it will be type int32 with the name of the enum.
- if got, want := tye.Name(), tye.Name(); got != want {
- return fmt.Errorf("unexpected reflect.TypeOf().Elem().Name(): got %v want %v", got, want)
- }
-
- // Check that value is what we expect.
- // If we have a pointer in val, get the value it points to.
- valExp := val
- if ty.Kind() == reflect.Ptr {
- valExp = reflect.ValueOf(val).Elem().Interface()
- }
- if got, want := valExp, valWant; !reflect.DeepEqual(got, want) {
- return fmt.Errorf("unexpected reflect.DeepEqual(): got %v want %v", got, want)
- }
-
- return nil
- }
-
- setTo := func(test testcase) interface{} {
- setTo := reflect.ValueOf(test.want)
- if typ := reflect.TypeOf(test.ext.ExtensionType); typ.Kind() == reflect.Ptr {
- setTo = reflect.New(typ).Elem()
- setTo.Set(reflect.New(setTo.Type().Elem()))
- setTo.Elem().Set(reflect.ValueOf(test.want))
- }
- return setTo.Interface()
- }
-
- for _, test := range tests {
- msg := &pb.DefaultsMessage{}
- name := test.ext.Name
-
- // Check the initial value.
- if err := checkVal(test, msg, test.def); err != nil {
- t.Errorf("%s: %v", name, err)
- }
-
- // Set the per-type value and check value.
- name = fmt.Sprintf("%s (set to %T %v)", name, test.want, test.want)
- if err := proto.SetExtension(msg, test.ext, setTo(test)); err != nil {
- t.Errorf("%s: SetExtension(): %v", name, err)
- continue
- }
- if err := checkVal(test, msg, test.want); err != nil {
- t.Errorf("%s: %v", name, err)
- continue
- }
-
- // Set and check the value.
- name += " (cleared)"
- proto.ClearExtension(msg, test.ext)
- if err := checkVal(test, msg, test.def); err != nil {
- t.Errorf("%s: %v", name, err)
- }
- }
-}
-
-func TestNilMessage(t *testing.T) {
- name := "nil interface"
- if got, err := proto.GetExtension(nil, pb.E_Ext_More); err == nil {
- t.Errorf("%s: got %T %v, expected to fail", name, got, got)
- } else if !strings.Contains(err.Error(), "extendable") {
- t.Errorf("%s: got error %v, expected not-extendable error", name, err)
- }
-
- // Regression tests: all functions of the Extension API
- // used to panic when passed (*M)(nil), where M is a concrete message
- // type. Now they handle this gracefully as a no-op or reported error.
- var nilMsg *pb.MyMessage
- desc := pb.E_Ext_More
-
- isNotExtendable := func(err error) bool {
- return strings.Contains(fmt.Sprint(err), "not extendable")
- }
-
- if proto.HasExtension(nilMsg, desc) {
- t.Error("HasExtension(nil) = true")
- }
-
- if _, err := proto.GetExtensions(nilMsg, []*proto.ExtensionDesc{desc}); !isNotExtendable(err) {
- t.Errorf("GetExtensions(nil) = %q (wrong error)", err)
- }
-
- if _, err := proto.ExtensionDescs(nilMsg); !isNotExtendable(err) {
- t.Errorf("ExtensionDescs(nil) = %q (wrong error)", err)
- }
-
- if err := proto.SetExtension(nilMsg, desc, nil); !isNotExtendable(err) {
- t.Errorf("SetExtension(nil) = %q (wrong error)", err)
- }
-
- proto.ClearExtension(nilMsg, desc) // no-op
- proto.ClearAllExtensions(nilMsg) // no-op
-}
-
-func TestExtensionsRoundTrip(t *testing.T) {
- msg := &pb.MyMessage{}
- ext1 := &pb.Ext{
- Data: proto.String("hi"),
- }
- ext2 := &pb.Ext{
- Data: proto.String("there"),
- }
- exists := proto.HasExtension(msg, pb.E_Ext_More)
- if exists {
- t.Error("Extension More present unexpectedly")
- }
- if err := proto.SetExtension(msg, pb.E_Ext_More, ext1); err != nil {
- t.Error(err)
- }
- if err := proto.SetExtension(msg, pb.E_Ext_More, ext2); err != nil {
- t.Error(err)
- }
- e, err := proto.GetExtension(msg, pb.E_Ext_More)
- if err != nil {
- t.Error(err)
- }
- x, ok := e.(*pb.Ext)
- if !ok {
- t.Errorf("e has type %T, expected test_proto.Ext", e)
- } else if *x.Data != "there" {
- t.Errorf("SetExtension failed to overwrite, got %+v, not 'there'", x)
- }
- proto.ClearExtension(msg, pb.E_Ext_More)
- if _, err = proto.GetExtension(msg, pb.E_Ext_More); err != proto.ErrMissingExtension {
- t.Errorf("got %v, expected ErrMissingExtension", e)
- }
- if _, err := proto.GetExtension(msg, pb.E_X215); err == nil {
- t.Error("expected bad extension error, got nil")
- }
- if err := proto.SetExtension(msg, pb.E_X215, 12); err == nil {
- t.Error("expected extension err")
- }
- if err := proto.SetExtension(msg, pb.E_Ext_More, 12); err == nil {
- t.Error("expected some sort of type mismatch error, got nil")
- }
-}
-
-func TestNilExtension(t *testing.T) {
- msg := &pb.MyMessage{
- Count: proto.Int32(1),
- }
- if err := proto.SetExtension(msg, pb.E_Ext_Text, proto.String("hello")); err != nil {
- t.Fatal(err)
- }
- if err := proto.SetExtension(msg, pb.E_Ext_More, (*pb.Ext)(nil)); err == nil {
- t.Error("expected SetExtension to fail due to a nil extension")
- } else if want := fmt.Sprintf("proto: SetExtension called with nil value of type %T", new(pb.Ext)); err.Error() != want {
- t.Errorf("expected error %v, got %v", want, err)
- }
- // Note: if the behavior of Marshal is ever changed to ignore nil extensions, update
- // this test to verify that E_Ext_Text is properly propagated through marshal->unmarshal.
-}
-
-func TestMarshalUnmarshalRepeatedExtension(t *testing.T) {
- // Add a repeated extension to the result.
- tests := []struct {
- name string
- ext []*pb.ComplexExtension
- }{
- {
- "two fields",
- []*pb.ComplexExtension{
- {First: proto.Int32(7)},
- {Second: proto.Int32(11)},
- },
- },
- {
- "repeated field",
- []*pb.ComplexExtension{
- {Third: []int32{1000}},
- {Third: []int32{2000}},
- },
- },
- {
- "two fields and repeated field",
- []*pb.ComplexExtension{
- {Third: []int32{1000}},
- {First: proto.Int32(9)},
- {Second: proto.Int32(21)},
- {Third: []int32{2000}},
- },
- },
- }
- for _, test := range tests {
- // Marshal message with a repeated extension.
- msg1 := new(pb.OtherMessage)
- err := proto.SetExtension(msg1, pb.E_RComplex, test.ext)
- if err != nil {
- t.Fatalf("[%s] Error setting extension: %v", test.name, err)
- }
- b, err := proto.Marshal(msg1)
- if err != nil {
- t.Fatalf("[%s] Error marshaling message: %v", test.name, err)
- }
-
- // Unmarshal and read the merged proto.
- msg2 := new(pb.OtherMessage)
- err = proto.Unmarshal(b, msg2)
- if err != nil {
- t.Fatalf("[%s] Error unmarshaling message: %v", test.name, err)
- }
- e, err := proto.GetExtension(msg2, pb.E_RComplex)
- if err != nil {
- t.Fatalf("[%s] Error getting extension: %v", test.name, err)
- }
- ext := e.([]*pb.ComplexExtension)
- if ext == nil {
- t.Fatalf("[%s] Invalid extension", test.name)
- }
- if len(ext) != len(test.ext) {
- t.Errorf("[%s] Wrong length of ComplexExtension: got: %v want: %v\n", test.name, len(ext), len(test.ext))
- }
- for i := range test.ext {
- if !proto.Equal(ext[i], test.ext[i]) {
- t.Errorf("[%s] Wrong value for ComplexExtension[%d]: got: %v want: %v\n", test.name, i, ext[i], test.ext[i])
- }
- }
- }
-}
-
-func TestUnmarshalRepeatingNonRepeatedExtension(t *testing.T) {
- // We may see multiple instances of the same extension in the wire
- // format. For example, the proto compiler may encode custom options in
- // this way. Here, we verify that we merge the extensions together.
- tests := []struct {
- name string
- ext []*pb.ComplexExtension
- }{
- {
- "two fields",
- []*pb.ComplexExtension{
- {First: proto.Int32(7)},
- {Second: proto.Int32(11)},
- },
- },
- {
- "repeated field",
- []*pb.ComplexExtension{
- {Third: []int32{1000}},
- {Third: []int32{2000}},
- },
- },
- {
- "two fields and repeated field",
- []*pb.ComplexExtension{
- {Third: []int32{1000}},
- {First: proto.Int32(9)},
- {Second: proto.Int32(21)},
- {Third: []int32{2000}},
- },
- },
- }
- for _, test := range tests {
- var buf bytes.Buffer
- var want pb.ComplexExtension
-
- // Generate a serialized representation of a repeated extension
- // by catenating bytes together.
- for i, e := range test.ext {
- // Merge to create the wanted proto.
- proto.Merge(&want, e)
-
- // serialize the message
- msg := new(pb.OtherMessage)
- err := proto.SetExtension(msg, pb.E_Complex, e)
- if err != nil {
- t.Fatalf("[%s] Error setting extension %d: %v", test.name, i, err)
- }
- b, err := proto.Marshal(msg)
- if err != nil {
- t.Fatalf("[%s] Error marshaling message %d: %v", test.name, i, err)
- }
- buf.Write(b)
- }
-
- // Unmarshal and read the merged proto.
- msg2 := new(pb.OtherMessage)
- err := proto.Unmarshal(buf.Bytes(), msg2)
- if err != nil {
- t.Fatalf("[%s] Error unmarshaling message: %v", test.name, err)
- }
- e, err := proto.GetExtension(msg2, pb.E_Complex)
- if err != nil {
- t.Fatalf("[%s] Error getting extension: %v", test.name, err)
- }
- ext := e.(*pb.ComplexExtension)
- if ext == nil {
- t.Fatalf("[%s] Invalid extension", test.name)
- }
- if !proto.Equal(ext, &want) {
- t.Errorf("[%s] Wrong value for ComplexExtension: got: %s want: %s\n", test.name, ext, &want)
- }
- }
-}
-
-func TestClearAllExtensions(t *testing.T) {
- // unregistered extension
- desc := &proto.ExtensionDesc{
- ExtendedType: (*pb.MyMessage)(nil),
- ExtensionType: (*bool)(nil),
- Field: 101010100,
- Name: "emptyextension",
- Tag: "varint,0,opt",
- }
- m := &pb.MyMessage{}
- if proto.HasExtension(m, desc) {
- t.Errorf("proto.HasExtension(%s): got true, want false", proto.MarshalTextString(m))
- }
- if err := proto.SetExtension(m, desc, proto.Bool(true)); err != nil {
- t.Errorf("proto.SetExtension(m, desc, true): got error %q, want nil", err)
- }
- if !proto.HasExtension(m, desc) {
- t.Errorf("proto.HasExtension(%s): got false, want true", proto.MarshalTextString(m))
- }
- proto.ClearAllExtensions(m)
- if proto.HasExtension(m, desc) {
- t.Errorf("proto.HasExtension(%s): got true, want false", proto.MarshalTextString(m))
- }
-}
-
-func TestMarshalRace(t *testing.T) {
- ext := &pb.Ext{}
- m := &pb.MyMessage{Count: proto.Int32(4)}
- if err := proto.SetExtension(m, pb.E_Ext_More, ext); err != nil {
- t.Fatalf("proto.SetExtension(m, desc, true): got error %q, want nil", err)
- }
-
- b, err := proto.Marshal(m)
- if err != nil {
- t.Fatalf("Could not marshal message: %v", err)
- }
- if err := proto.Unmarshal(b, m); err != nil {
- t.Fatalf("Could not unmarshal message: %v", err)
- }
- // after Unmarshal, the extension is in undecoded form.
- // GetExtension will decode it lazily. Make sure this does
- // not race against Marshal.
-
- var g errgroup.Group
- for n := 3; n > 0; n-- {
- g.Go(func() error {
- _, err := proto.Marshal(m)
- return err
- })
- g.Go(func() error {
- _, err := proto.GetExtension(m, pb.E_Ext_More)
- return err
- })
- }
- if err := g.Wait(); err != nil {
- t.Fatal(err)
- }
-}
diff --git a/vendor/github.com/golang/protobuf/proto/map_test.go b/vendor/github.com/golang/protobuf/proto/map_test.go
deleted file mode 100644
index b1e1529ee..000000000
--- a/vendor/github.com/golang/protobuf/proto/map_test.go
+++ /dev/null
@@ -1,70 +0,0 @@
-package proto_test
-
-import (
- "fmt"
- "reflect"
- "testing"
-
- "github.com/golang/protobuf/proto"
- ppb "github.com/golang/protobuf/proto/proto3_proto"
-)
-
-func TestMap(t *testing.T) {
- var b []byte
- fmt.Sscanf("a2010c0a044b657931120456616c31a201130a044b657932120556616c3261120456616c32a201240a044b6579330d05000000120556616c33621a0556616c3361120456616c331505000000a20100a201260a044b657934130a07536f6d6555524c1209536f6d655469746c651a08536e69707065743114", "%x", &b)
-
- var m ppb.Message
- if err := proto.Unmarshal(b, &m); err != nil {
- t.Fatalf("proto.Unmarshal error: %v", err)
- }
-
- got := m.StringMap
- want := map[string]string{
- "": "",
- "Key1": "Val1",
- "Key2": "Val2",
- "Key3": "Val3",
- "Key4": "",
- }
-
- if !reflect.DeepEqual(got, want) {
- t.Errorf("maps differ:\ngot %#v\nwant %#v", got, want)
- }
-}
-
-func marshalled() []byte {
- m := &ppb.IntMaps{}
- for i := 0; i < 1000; i++ {
- m.Maps = append(m.Maps, &ppb.IntMap{
- Rtt: map[int32]int32{1: 2},
- })
- }
- b, err := proto.Marshal(m)
- if err != nil {
- panic(fmt.Sprintf("Can't marshal %+v: %v", m, err))
- }
- return b
-}
-
-func BenchmarkConcurrentMapUnmarshal(b *testing.B) {
- in := marshalled()
- b.RunParallel(func(pb *testing.PB) {
- for pb.Next() {
- var out ppb.IntMaps
- if err := proto.Unmarshal(in, &out); err != nil {
- b.Errorf("Can't unmarshal ppb.IntMaps: %v", err)
- }
- }
- })
-}
-
-func BenchmarkSequentialMapUnmarshal(b *testing.B) {
- in := marshalled()
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- var out ppb.IntMaps
- if err := proto.Unmarshal(in, &out); err != nil {
- b.Errorf("Can't unmarshal ppb.IntMaps: %v", err)
- }
- }
-}
diff --git a/vendor/github.com/golang/protobuf/proto/message_set_test.go b/vendor/github.com/golang/protobuf/proto/message_set_test.go
deleted file mode 100644
index 2c170c5f2..000000000
--- a/vendor/github.com/golang/protobuf/proto/message_set_test.go
+++ /dev/null
@@ -1,77 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2014 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-import (
- "bytes"
- "testing"
-)
-
-func TestUnmarshalMessageSetWithDuplicate(t *testing.T) {
- // Check that a repeated message set entry will be concatenated.
- in := &messageSet{
- Item: []*_MessageSet_Item{
- {TypeId: Int32(12345), Message: []byte("hoo")},
- {TypeId: Int32(12345), Message: []byte("hah")},
- },
- }
- b, err := Marshal(in)
- if err != nil {
- t.Fatalf("Marshal: %v", err)
- }
- t.Logf("Marshaled bytes: %q", b)
-
- var extensions XXX_InternalExtensions
- if err := UnmarshalMessageSet(b, &extensions); err != nil {
- t.Fatalf("UnmarshalMessageSet: %v", err)
- }
- ext, ok := extensions.p.extensionMap[12345]
- if !ok {
- t.Fatalf("Didn't retrieve extension 12345; map is %v", extensions.p.extensionMap)
- }
- // Skip wire type/field number and length varints.
- got := skipVarint(skipVarint(ext.enc))
- if want := []byte("hoohah"); !bytes.Equal(got, want) {
- t.Errorf("Combined extension is %q, want %q", got, want)
- }
-}
-
-func TestMarshalMessageSetJSON_UnknownType(t *testing.T) {
- extMap := map[int32]Extension{12345: Extension{}}
- got, err := MarshalMessageSetJSON(extMap)
- if err != nil {
- t.Fatalf("MarshalMessageSetJSON: %v", err)
- }
- if want := []byte("{}"); !bytes.Equal(got, want) {
- t.Errorf("MarshalMessageSetJSON(%v) = %q, want %q", extMap, got, want)
- }
-}
diff --git a/vendor/github.com/golang/protobuf/proto/proto3_test.go b/vendor/github.com/golang/protobuf/proto/proto3_test.go
deleted file mode 100644
index 73eed6c0b..000000000
--- a/vendor/github.com/golang/protobuf/proto/proto3_test.go
+++ /dev/null
@@ -1,151 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2014 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto_test
-
-import (
- "bytes"
- "testing"
-
- "github.com/golang/protobuf/proto"
- pb "github.com/golang/protobuf/proto/proto3_proto"
- tpb "github.com/golang/protobuf/proto/test_proto"
-)
-
-func TestProto3ZeroValues(t *testing.T) {
- tests := []struct {
- desc string
- m proto.Message
- }{
- {"zero message", &pb.Message{}},
- {"empty bytes field", &pb.Message{Data: []byte{}}},
- }
- for _, test := range tests {
- b, err := proto.Marshal(test.m)
- if err != nil {
- t.Errorf("%s: proto.Marshal: %v", test.desc, err)
- continue
- }
- if len(b) > 0 {
- t.Errorf("%s: Encoding is non-empty: %q", test.desc, b)
- }
- }
-}
-
-func TestRoundTripProto3(t *testing.T) {
- m := &pb.Message{
- Name: "David", // (2 | 1<<3): 0x0a 0x05 "David"
- Hilarity: pb.Message_PUNS, // (0 | 2<<3): 0x10 0x01
- HeightInCm: 178, // (0 | 3<<3): 0x18 0xb2 0x01
- Data: []byte("roboto"), // (2 | 4<<3): 0x20 0x06 "roboto"
- ResultCount: 47, // (0 | 7<<3): 0x38 0x2f
- TrueScotsman: true, // (0 | 8<<3): 0x40 0x01
- Score: 8.1, // (5 | 9<<3): 0x4d <8.1>
-
- Key: []uint64{1, 0xdeadbeef},
- Nested: &pb.Nested{
- Bunny: "Monty",
- },
- }
- t.Logf(" m: %v", m)
-
- b, err := proto.Marshal(m)
- if err != nil {
- t.Fatalf("proto.Marshal: %v", err)
- }
- t.Logf(" b: %q", b)
-
- m2 := new(pb.Message)
- if err := proto.Unmarshal(b, m2); err != nil {
- t.Fatalf("proto.Unmarshal: %v", err)
- }
- t.Logf("m2: %v", m2)
-
- if !proto.Equal(m, m2) {
- t.Errorf("proto.Equal returned false:\n m: %v\nm2: %v", m, m2)
- }
-}
-
-func TestGettersForBasicTypesExist(t *testing.T) {
- var m pb.Message
- if got := m.GetNested().GetBunny(); got != "" {
- t.Errorf("m.GetNested().GetBunny() = %q, want empty string", got)
- }
- if got := m.GetNested().GetCute(); got {
- t.Errorf("m.GetNested().GetCute() = %t, want false", got)
- }
-}
-
-func TestProto3SetDefaults(t *testing.T) {
- in := &pb.Message{
- Terrain: map[string]*pb.Nested{
- "meadow": new(pb.Nested),
- },
- Proto2Field: new(tpb.SubDefaults),
- Proto2Value: map[string]*tpb.SubDefaults{
- "badlands": new(tpb.SubDefaults),
- },
- }
-
- got := proto.Clone(in).(*pb.Message)
- proto.SetDefaults(got)
-
- // There are no defaults in proto3. Everything should be the zero value, but
- // we need to remember to set defaults for nested proto2 messages.
- want := &pb.Message{
- Terrain: map[string]*pb.Nested{
- "meadow": new(pb.Nested),
- },
- Proto2Field: &tpb.SubDefaults{N: proto.Int64(7)},
- Proto2Value: map[string]*tpb.SubDefaults{
- "badlands": &tpb.SubDefaults{N: proto.Int64(7)},
- },
- }
-
- if !proto.Equal(got, want) {
- t.Errorf("with in = %v\nproto.SetDefaults(in) =>\ngot %v\nwant %v", in, got, want)
- }
-}
-
-func TestUnknownFieldPreservation(t *testing.T) {
- b1 := "\x0a\x05David" // Known tag 1
- b2 := "\xc2\x0c\x06Google" // Unknown tag 200
- b := []byte(b1 + b2)
-
- m := new(pb.Message)
- if err := proto.Unmarshal(b, m); err != nil {
- t.Fatalf("proto.Unmarshal: %v", err)
- }
-
- if !bytes.Equal(m.XXX_unrecognized, []byte(b2)) {
- t.Fatalf("mismatching unknown fields:\ngot %q\nwant %q", m.XXX_unrecognized, b2)
- }
-}
diff --git a/vendor/github.com/golang/protobuf/proto/size2_test.go b/vendor/github.com/golang/protobuf/proto/size2_test.go
deleted file mode 100644
index 7846b0617..000000000
--- a/vendor/github.com/golang/protobuf/proto/size2_test.go
+++ /dev/null
@@ -1,63 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2012 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-import (
- "testing"
-)
-
-// This is a separate file and package from size_test.go because that one uses
-// generated messages and thus may not be in package proto without having a circular
-// dependency, whereas this file tests unexported details of size.go.
-
-func TestVarintSize(t *testing.T) {
- // Check the edge cases carefully.
- testCases := []struct {
- n uint64
- size int
- }{
- {0, 1},
- {1, 1},
- {127, 1},
- {128, 2},
- {16383, 2},
- {16384, 3},
- {1<<63 - 1, 9},
- {1 << 63, 10},
- }
- for _, tc := range testCases {
- size := SizeVarint(tc.n)
- if size != tc.size {
- t.Errorf("sizeVarint(%d) = %d, want %d", tc.n, size, tc.size)
- }
- }
-}
diff --git a/vendor/github.com/golang/protobuf/proto/size_test.go b/vendor/github.com/golang/protobuf/proto/size_test.go
deleted file mode 100644
index 3abac418a..000000000
--- a/vendor/github.com/golang/protobuf/proto/size_test.go
+++ /dev/null
@@ -1,191 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2012 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto_test
-
-import (
- "log"
- "strings"
- "testing"
-
- . "github.com/golang/protobuf/proto"
- proto3pb "github.com/golang/protobuf/proto/proto3_proto"
- pb "github.com/golang/protobuf/proto/test_proto"
-)
-
-var messageWithExtension1 = &pb.MyMessage{Count: Int32(7)}
-
-// messageWithExtension2 is in equal_test.go.
-var messageWithExtension3 = &pb.MyMessage{Count: Int32(8)}
-
-func init() {
- if err := SetExtension(messageWithExtension1, pb.E_Ext_More, &pb.Ext{Data: String("Abbott")}); err != nil {
- log.Panicf("SetExtension: %v", err)
- }
- if err := SetExtension(messageWithExtension3, pb.E_Ext_More, &pb.Ext{Data: String("Costello")}); err != nil {
- log.Panicf("SetExtension: %v", err)
- }
-
- // Force messageWithExtension3 to have the extension encoded.
- Marshal(messageWithExtension3)
-
-}
-
-// non-pointer custom message
-type nonptrMessage struct{}
-
-func (m nonptrMessage) ProtoMessage() {}
-func (m nonptrMessage) Reset() {}
-func (m nonptrMessage) String() string { return "" }
-
-func (m nonptrMessage) Marshal() ([]byte, error) {
- return []byte{42}, nil
-}
-
-// custom message embedding a proto.Message
-type messageWithEmbedding struct {
- *pb.OtherMessage
-}
-
-func (m *messageWithEmbedding) ProtoMessage() {}
-func (m *messageWithEmbedding) Reset() {}
-func (m *messageWithEmbedding) String() string { return "" }
-
-func (m *messageWithEmbedding) Marshal() ([]byte, error) {
- return []byte{42}, nil
-}
-
-var SizeTests = []struct {
- desc string
- pb Message
-}{
- {"empty", &pb.OtherMessage{}},
- // Basic types.
- {"bool", &pb.Defaults{F_Bool: Bool(true)}},
- {"int32", &pb.Defaults{F_Int32: Int32(12)}},
- {"negative int32", &pb.Defaults{F_Int32: Int32(-1)}},
- {"small int64", &pb.Defaults{F_Int64: Int64(1)}},
- {"big int64", &pb.Defaults{F_Int64: Int64(1 << 20)}},
- {"negative int64", &pb.Defaults{F_Int64: Int64(-1)}},
- {"fixed32", &pb.Defaults{F_Fixed32: Uint32(71)}},
- {"fixed64", &pb.Defaults{F_Fixed64: Uint64(72)}},
- {"uint32", &pb.Defaults{F_Uint32: Uint32(123)}},
- {"uint64", &pb.Defaults{F_Uint64: Uint64(124)}},
- {"float", &pb.Defaults{F_Float: Float32(12.6)}},
- {"double", &pb.Defaults{F_Double: Float64(13.9)}},
- {"string", &pb.Defaults{F_String: String("niles")}},
- {"bytes", &pb.Defaults{F_Bytes: []byte("wowsa")}},
- {"bytes, empty", &pb.Defaults{F_Bytes: []byte{}}},
- {"sint32", &pb.Defaults{F_Sint32: Int32(65)}},
- {"sint64", &pb.Defaults{F_Sint64: Int64(67)}},
- {"enum", &pb.Defaults{F_Enum: pb.Defaults_BLUE.Enum()}},
- // Repeated.
- {"empty repeated bool", &pb.MoreRepeated{Bools: []bool{}}},
- {"repeated bool", &pb.MoreRepeated{Bools: []bool{false, true, true, false}}},
- {"packed repeated bool", &pb.MoreRepeated{BoolsPacked: []bool{false, true, true, false, true, true, true}}},
- {"repeated int32", &pb.MoreRepeated{Ints: []int32{1, 12203, 1729, -1}}},
- {"repeated int32 packed", &pb.MoreRepeated{IntsPacked: []int32{1, 12203, 1729}}},
- {"repeated int64 packed", &pb.MoreRepeated{Int64SPacked: []int64{
- // Need enough large numbers to verify that the header is counting the number of bytes
- // for the field, not the number of elements.
- 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62,
- 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62,
- }}},
- {"repeated string", &pb.MoreRepeated{Strings: []string{"r", "ken", "gri"}}},
- {"repeated fixed", &pb.MoreRepeated{Fixeds: []uint32{1, 2, 3, 4}}},
- // Nested.
- {"nested", &pb.OldMessage{Nested: &pb.OldMessage_Nested{Name: String("whatever")}}},
- {"group", &pb.GroupOld{G: &pb.GroupOld_G{X: Int32(12345)}}},
- // Other things.
- {"unrecognized", &pb.MoreRepeated{XXX_unrecognized: []byte{13<<3 | 0, 4}}},
- {"extension (unencoded)", messageWithExtension1},
- {"extension (encoded)", messageWithExtension3},
- // proto3 message
- {"proto3 empty", &proto3pb.Message{}},
- {"proto3 bool", &proto3pb.Message{TrueScotsman: true}},
- {"proto3 int64", &proto3pb.Message{ResultCount: 1}},
- {"proto3 uint32", &proto3pb.Message{HeightInCm: 123}},
- {"proto3 float", &proto3pb.Message{Score: 12.6}},
- {"proto3 string", &proto3pb.Message{Name: "Snezana"}},
- {"proto3 bytes", &proto3pb.Message{Data: []byte("wowsa")}},
- {"proto3 bytes, empty", &proto3pb.Message{Data: []byte{}}},
- {"proto3 enum", &proto3pb.Message{Hilarity: proto3pb.Message_PUNS}},
- {"proto3 map field with empty bytes", &proto3pb.MessageWithMap{ByteMapping: map[bool][]byte{false: []byte{}}}},
-
- {"map field", &pb.MessageWithMap{NameMapping: map[int32]string{1: "Rob", 7: "Andrew"}}},
- {"map field with message", &pb.MessageWithMap{MsgMapping: map[int64]*pb.FloatingPoint{0x7001: &pb.FloatingPoint{F: Float64(2.0)}}}},
- {"map field with bytes", &pb.MessageWithMap{ByteMapping: map[bool][]byte{true: []byte("this time for sure")}}},
- {"map field with empty bytes", &pb.MessageWithMap{ByteMapping: map[bool][]byte{true: []byte{}}}},
-
- {"map field with big entry", &pb.MessageWithMap{NameMapping: map[int32]string{8: strings.Repeat("x", 125)}}},
- {"map field with big key and val", &pb.MessageWithMap{StrToStr: map[string]string{strings.Repeat("x", 70): strings.Repeat("y", 70)}}},
- {"map field with big numeric key", &pb.MessageWithMap{NameMapping: map[int32]string{0xf00d: "om nom nom"}}},
-
- {"oneof not set", &pb.Oneof{}},
- {"oneof bool", &pb.Oneof{Union: &pb.Oneof_F_Bool{true}}},
- {"oneof zero int32", &pb.Oneof{Union: &pb.Oneof_F_Int32{0}}},
- {"oneof big int32", &pb.Oneof{Union: &pb.Oneof_F_Int32{1 << 20}}},
- {"oneof int64", &pb.Oneof{Union: &pb.Oneof_F_Int64{42}}},
- {"oneof fixed32", &pb.Oneof{Union: &pb.Oneof_F_Fixed32{43}}},
- {"oneof fixed64", &pb.Oneof{Union: &pb.Oneof_F_Fixed64{44}}},
- {"oneof uint32", &pb.Oneof{Union: &pb.Oneof_F_Uint32{45}}},
- {"oneof uint64", &pb.Oneof{Union: &pb.Oneof_F_Uint64{46}}},
- {"oneof float", &pb.Oneof{Union: &pb.Oneof_F_Float{47.1}}},
- {"oneof double", &pb.Oneof{Union: &pb.Oneof_F_Double{48.9}}},
- {"oneof string", &pb.Oneof{Union: &pb.Oneof_F_String{"Rhythmic Fman"}}},
- {"oneof bytes", &pb.Oneof{Union: &pb.Oneof_F_Bytes{[]byte("let go")}}},
- {"oneof sint32", &pb.Oneof{Union: &pb.Oneof_F_Sint32{50}}},
- {"oneof sint64", &pb.Oneof{Union: &pb.Oneof_F_Sint64{51}}},
- {"oneof enum", &pb.Oneof{Union: &pb.Oneof_F_Enum{pb.MyMessage_BLUE}}},
- {"message for oneof", &pb.GoTestField{Label: String("k"), Type: String("v")}},
- {"oneof message", &pb.Oneof{Union: &pb.Oneof_F_Message{&pb.GoTestField{Label: String("k"), Type: String("v")}}}},
- {"oneof group", &pb.Oneof{Union: &pb.Oneof_FGroup{&pb.Oneof_F_Group{X: Int32(52)}}}},
- {"oneof largest tag", &pb.Oneof{Union: &pb.Oneof_F_Largest_Tag{1}}},
- {"multiple oneofs", &pb.Oneof{Union: &pb.Oneof_F_Int32{1}, Tormato: &pb.Oneof_Value{2}}},
-
- {"non-pointer message", nonptrMessage{}},
- {"custom message with embedding", &messageWithEmbedding{&pb.OtherMessage{}}},
-}
-
-func TestSize(t *testing.T) {
- for _, tc := range SizeTests {
- size := Size(tc.pb)
- b, err := Marshal(tc.pb)
- if err != nil {
- t.Errorf("%v: Marshal failed: %v", tc.desc, err)
- continue
- }
- if size != len(b) {
- t.Errorf("%v: Size(%v) = %d, want %d", tc.desc, tc.pb, size, len(b))
- t.Logf("%v: bytes: %#v", tc.desc, b)
- }
- }
-}
diff --git a/vendor/github.com/golang/protobuf/proto/text_parser_test.go b/vendor/github.com/golang/protobuf/proto/text_parser_test.go
deleted file mode 100644
index a81980879..000000000
--- a/vendor/github.com/golang/protobuf/proto/text_parser_test.go
+++ /dev/null
@@ -1,706 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto_test
-
-import (
- "fmt"
- "math"
- "testing"
-
- . "github.com/golang/protobuf/proto"
- proto3pb "github.com/golang/protobuf/proto/proto3_proto"
- . "github.com/golang/protobuf/proto/test_proto"
-)
-
-type UnmarshalTextTest struct {
- in string
- err string // if "", no error expected
- out *MyMessage
-}
-
-func buildExtStructTest(text string) UnmarshalTextTest {
- msg := &MyMessage{
- Count: Int32(42),
- }
- SetExtension(msg, E_Ext_More, &Ext{
- Data: String("Hello, world!"),
- })
- return UnmarshalTextTest{in: text, out: msg}
-}
-
-func buildExtDataTest(text string) UnmarshalTextTest {
- msg := &MyMessage{
- Count: Int32(42),
- }
- SetExtension(msg, E_Ext_Text, String("Hello, world!"))
- SetExtension(msg, E_Ext_Number, Int32(1729))
- return UnmarshalTextTest{in: text, out: msg}
-}
-
-func buildExtRepStringTest(text string) UnmarshalTextTest {
- msg := &MyMessage{
- Count: Int32(42),
- }
- if err := SetExtension(msg, E_Greeting, []string{"bula", "hola"}); err != nil {
- panic(err)
- }
- return UnmarshalTextTest{in: text, out: msg}
-}
-
-var unMarshalTextTests = []UnmarshalTextTest{
- // Basic
- {
- in: " count:42\n name:\"Dave\" ",
- out: &MyMessage{
- Count: Int32(42),
- Name: String("Dave"),
- },
- },
-
- // Empty quoted string
- {
- in: `count:42 name:""`,
- out: &MyMessage{
- Count: Int32(42),
- Name: String(""),
- },
- },
-
- // Quoted string concatenation with double quotes
- {
- in: `count:42 name: "My name is "` + "\n" + `"elsewhere"`,
- out: &MyMessage{
- Count: Int32(42),
- Name: String("My name is elsewhere"),
- },
- },
-
- // Quoted string concatenation with single quotes
- {
- in: "count:42 name: 'My name is '\n'elsewhere'",
- out: &MyMessage{
- Count: Int32(42),
- Name: String("My name is elsewhere"),
- },
- },
-
- // Quoted string concatenations with mixed quotes
- {
- in: "count:42 name: 'My name is '\n\"elsewhere\"",
- out: &MyMessage{
- Count: Int32(42),
- Name: String("My name is elsewhere"),
- },
- },
- {
- in: "count:42 name: \"My name is \"\n'elsewhere'",
- out: &MyMessage{
- Count: Int32(42),
- Name: String("My name is elsewhere"),
- },
- },
-
- // Quoted string with escaped apostrophe
- {
- in: `count:42 name: "HOLIDAY - New Year\'s Day"`,
- out: &MyMessage{
- Count: Int32(42),
- Name: String("HOLIDAY - New Year's Day"),
- },
- },
-
- // Quoted string with single quote
- {
- in: `count:42 name: 'Roger "The Ramster" Ramjet'`,
- out: &MyMessage{
- Count: Int32(42),
- Name: String(`Roger "The Ramster" Ramjet`),
- },
- },
-
- // Quoted string with all the accepted special characters from the C++ test
- {
- in: `count:42 name: ` + "\"\\\"A string with \\' characters \\n and \\r newlines and \\t tabs and \\001 slashes \\\\ and multiple spaces\"",
- out: &MyMessage{
- Count: Int32(42),
- Name: String("\"A string with ' characters \n and \r newlines and \t tabs and \001 slashes \\ and multiple spaces"),
- },
- },
-
- // Quoted string with quoted backslash
- {
- in: `count:42 name: "\\'xyz"`,
- out: &MyMessage{
- Count: Int32(42),
- Name: String(`\'xyz`),
- },
- },
-
- // Quoted string with UTF-8 bytes.
- {
- in: "count:42 name: '\303\277\302\201\x00\xAB\xCD\xEF'",
- out: &MyMessage{
- Count: Int32(42),
- Name: String("\303\277\302\201\x00\xAB\xCD\xEF"),
- },
- },
-
- // Quoted string with unicode escapes.
- {
- in: `count: 42 name: "\u0047\U00000047\uffff\U0010ffff"`,
- out: &MyMessage{
- Count: Int32(42),
- Name: String("GG\uffff\U0010ffff"),
- },
- },
-
- // Bad quoted string
- {
- in: `inner: < host: "\0" >` + "\n",
- err: `line 1.15: invalid quoted string "\0": \0 requires 2 following digits`,
- },
-
- // Bad \u escape
- {
- in: `count: 42 name: "\u000"`,
- err: `line 1.16: invalid quoted string "\u000": \u requires 4 following digits`,
- },
-
- // Bad \U escape
- {
- in: `count: 42 name: "\U0000000"`,
- err: `line 1.16: invalid quoted string "\U0000000": \U requires 8 following digits`,
- },
-
- // Bad \U escape
- {
- in: `count: 42 name: "\xxx"`,
- err: `line 1.16: invalid quoted string "\xxx": \xxx contains non-hexadecimal digits`,
- },
-
- // Number too large for int64
- {
- in: "count: 1 others { key: 123456789012345678901 }",
- err: "line 1.23: invalid int64: 123456789012345678901",
- },
-
- // Number too large for int32
- {
- in: "count: 1234567890123",
- err: "line 1.7: invalid int32: 1234567890123",
- },
-
- // Number in hexadecimal
- {
- in: "count: 0x2beef",
- out: &MyMessage{
- Count: Int32(0x2beef),
- },
- },
-
- // Number in octal
- {
- in: "count: 024601",
- out: &MyMessage{
- Count: Int32(024601),
- },
- },
-
- // Floating point number with "f" suffix
- {
- in: "count: 4 others:< weight: 17.0f >",
- out: &MyMessage{
- Count: Int32(4),
- Others: []*OtherMessage{
- {
- Weight: Float32(17),
- },
- },
- },
- },
-
- // Floating point positive infinity
- {
- in: "count: 4 bigfloat: inf",
- out: &MyMessage{
- Count: Int32(4),
- Bigfloat: Float64(math.Inf(1)),
- },
- },
-
- // Floating point negative infinity
- {
- in: "count: 4 bigfloat: -inf",
- out: &MyMessage{
- Count: Int32(4),
- Bigfloat: Float64(math.Inf(-1)),
- },
- },
-
- // Number too large for float32
- {
- in: "others:< weight: 12345678901234567890123456789012345678901234567890 >",
- err: "line 1.17: invalid float32: 12345678901234567890123456789012345678901234567890",
- },
-
- // Number posing as a quoted string
- {
- in: `inner: < host: 12 >` + "\n",
- err: `line 1.15: invalid string: 12`,
- },
-
- // Quoted string posing as int32
- {
- in: `count: "12"`,
- err: `line 1.7: invalid int32: "12"`,
- },
-
- // Quoted string posing a float32
- {
- in: `others:< weight: "17.4" >`,
- err: `line 1.17: invalid float32: "17.4"`,
- },
-
- // unclosed bracket doesn't cause infinite loop
- {
- in: `[`,
- err: `line 1.0: unclosed type_url or extension name`,
- },
-
- // Enum
- {
- in: `count:42 bikeshed: BLUE`,
- out: &MyMessage{
- Count: Int32(42),
- Bikeshed: MyMessage_BLUE.Enum(),
- },
- },
-
- // Repeated field
- {
- in: `count:42 pet: "horsey" pet:"bunny"`,
- out: &MyMessage{
- Count: Int32(42),
- Pet: []string{"horsey", "bunny"},
- },
- },
-
- // Repeated field with list notation
- {
- in: `count:42 pet: ["horsey", "bunny"]`,
- out: &MyMessage{
- Count: Int32(42),
- Pet: []string{"horsey", "bunny"},
- },
- },
-
- // Repeated message with/without colon and <>/{}
- {
- in: `count:42 others:{} others{} others:<> others:{}`,
- out: &MyMessage{
- Count: Int32(42),
- Others: []*OtherMessage{
- {},
- {},
- {},
- {},
- },
- },
- },
-
- // Missing colon for inner message
- {
- in: `count:42 inner < host: "cauchy.syd" >`,
- out: &MyMessage{
- Count: Int32(42),
- Inner: &InnerMessage{
- Host: String("cauchy.syd"),
- },
- },
- },
-
- // Missing colon for string field
- {
- in: `name "Dave"`,
- err: `line 1.5: expected ':', found "\"Dave\""`,
- },
-
- // Missing colon for int32 field
- {
- in: `count 42`,
- err: `line 1.6: expected ':', found "42"`,
- },
-
- // Missing required field
- {
- in: `name: "Pawel"`,
- err: fmt.Sprintf(`proto: required field "%T.count" not set`, MyMessage{}),
- out: &MyMessage{
- Name: String("Pawel"),
- },
- },
-
- // Missing required field in a required submessage
- {
- in: `count: 42 we_must_go_deeper < leo_finally_won_an_oscar <> >`,
- err: fmt.Sprintf(`proto: required field "%T.host" not set`, InnerMessage{}),
- out: &MyMessage{
- Count: Int32(42),
- WeMustGoDeeper: &RequiredInnerMessage{LeoFinallyWonAnOscar: &InnerMessage{}},
- },
- },
-
- // Repeated non-repeated field
- {
- in: `name: "Rob" name: "Russ"`,
- err: `line 1.12: non-repeated field "name" was repeated`,
- },
-
- // Group
- {
- in: `count: 17 SomeGroup { group_field: 12 }`,
- out: &MyMessage{
- Count: Int32(17),
- Somegroup: &MyMessage_SomeGroup{
- GroupField: Int32(12),
- },
- },
- },
-
- // Semicolon between fields
- {
- in: `count:3;name:"Calvin"`,
- out: &MyMessage{
- Count: Int32(3),
- Name: String("Calvin"),
- },
- },
- // Comma between fields
- {
- in: `count:4,name:"Ezekiel"`,
- out: &MyMessage{
- Count: Int32(4),
- Name: String("Ezekiel"),
- },
- },
-
- // Boolean false
- {
- in: `count:42 inner { host: "example.com" connected: false }`,
- out: &MyMessage{
- Count: Int32(42),
- Inner: &InnerMessage{
- Host: String("example.com"),
- Connected: Bool(false),
- },
- },
- },
- // Boolean true
- {
- in: `count:42 inner { host: "example.com" connected: true }`,
- out: &MyMessage{
- Count: Int32(42),
- Inner: &InnerMessage{
- Host: String("example.com"),
- Connected: Bool(true),
- },
- },
- },
- // Boolean 0
- {
- in: `count:42 inner { host: "example.com" connected: 0 }`,
- out: &MyMessage{
- Count: Int32(42),
- Inner: &InnerMessage{
- Host: String("example.com"),
- Connected: Bool(false),
- },
- },
- },
- // Boolean 1
- {
- in: `count:42 inner { host: "example.com" connected: 1 }`,
- out: &MyMessage{
- Count: Int32(42),
- Inner: &InnerMessage{
- Host: String("example.com"),
- Connected: Bool(true),
- },
- },
- },
- // Boolean f
- {
- in: `count:42 inner { host: "example.com" connected: f }`,
- out: &MyMessage{
- Count: Int32(42),
- Inner: &InnerMessage{
- Host: String("example.com"),
- Connected: Bool(false),
- },
- },
- },
- // Boolean t
- {
- in: `count:42 inner { host: "example.com" connected: t }`,
- out: &MyMessage{
- Count: Int32(42),
- Inner: &InnerMessage{
- Host: String("example.com"),
- Connected: Bool(true),
- },
- },
- },
- // Boolean False
- {
- in: `count:42 inner { host: "example.com" connected: False }`,
- out: &MyMessage{
- Count: Int32(42),
- Inner: &InnerMessage{
- Host: String("example.com"),
- Connected: Bool(false),
- },
- },
- },
- // Boolean True
- {
- in: `count:42 inner { host: "example.com" connected: True }`,
- out: &MyMessage{
- Count: Int32(42),
- Inner: &InnerMessage{
- Host: String("example.com"),
- Connected: Bool(true),
- },
- },
- },
-
- // Extension
- buildExtStructTest(`count: 42 [test_proto.Ext.more]:<data:"Hello, world!" >`),
- buildExtStructTest(`count: 42 [test_proto.Ext.more] {data:"Hello, world!"}`),
- buildExtDataTest(`count: 42 [test_proto.Ext.text]:"Hello, world!" [test_proto.Ext.number]:1729`),
- buildExtRepStringTest(`count: 42 [test_proto.greeting]:"bula" [test_proto.greeting]:"hola"`),
-
- // Big all-in-one
- {
- in: "count:42 # Meaning\n" +
- `name:"Dave" ` +
- `quote:"\"I didn't want to go.\"" ` +
- `pet:"bunny" ` +
- `pet:"kitty" ` +
- `pet:"horsey" ` +
- `inner:<` +
- ` host:"footrest.syd" ` +
- ` port:7001 ` +
- ` connected:true ` +
- `> ` +
- `others:<` +
- ` key:3735928559 ` +
- ` value:"\x01A\a\f" ` +
- `> ` +
- `others:<` +
- " weight:58.9 # Atomic weight of Co\n" +
- ` inner:<` +
- ` host:"lesha.mtv" ` +
- ` port:8002 ` +
- ` >` +
- `>`,
- out: &MyMessage{
- Count: Int32(42),
- Name: String("Dave"),
- Quote: String(`"I didn't want to go."`),
- Pet: []string{"bunny", "kitty", "horsey"},
- Inner: &InnerMessage{
- Host: String("footrest.syd"),
- Port: Int32(7001),
- Connected: Bool(true),
- },
- Others: []*OtherMessage{
- {
- Key: Int64(3735928559),
- Value: []byte{0x1, 'A', '\a', '\f'},
- },
- {
- Weight: Float32(58.9),
- Inner: &InnerMessage{
- Host: String("lesha.mtv"),
- Port: Int32(8002),
- },
- },
- },
- },
- },
-}
-
-func TestUnmarshalText(t *testing.T) {
- for i, test := range unMarshalTextTests {
- pb := new(MyMessage)
- err := UnmarshalText(test.in, pb)
- if test.err == "" {
- // We don't expect failure.
- if err != nil {
- t.Errorf("Test %d: Unexpected error: %v", i, err)
- } else if !Equal(pb, test.out) {
- t.Errorf("Test %d: Incorrect populated \nHave: %v\nWant: %v",
- i, pb, test.out)
- }
- } else {
- // We do expect failure.
- if err == nil {
- t.Errorf("Test %d: Didn't get expected error: %v", i, test.err)
- } else if err.Error() != test.err {
- t.Errorf("Test %d: Incorrect error.\nHave: %v\nWant: %v",
- i, err.Error(), test.err)
- } else if _, ok := err.(*RequiredNotSetError); ok && test.out != nil && !Equal(pb, test.out) {
- t.Errorf("Test %d: Incorrect populated \nHave: %v\nWant: %v",
- i, pb, test.out)
- }
- }
- }
-}
-
-func TestUnmarshalTextCustomMessage(t *testing.T) {
- msg := &textMessage{}
- if err := UnmarshalText("custom", msg); err != nil {
- t.Errorf("Unexpected error from custom unmarshal: %v", err)
- }
- if UnmarshalText("not custom", msg) == nil {
- t.Errorf("Didn't get expected error from custom unmarshal")
- }
-}
-
-// Regression test; this caused a panic.
-func TestRepeatedEnum(t *testing.T) {
- pb := new(RepeatedEnum)
- if err := UnmarshalText("color: RED", pb); err != nil {
- t.Fatal(err)
- }
- exp := &RepeatedEnum{
- Color: []RepeatedEnum_Color{RepeatedEnum_RED},
- }
- if !Equal(pb, exp) {
- t.Errorf("Incorrect populated \nHave: %v\nWant: %v", pb, exp)
- }
-}
-
-func TestProto3TextParsing(t *testing.T) {
- m := new(proto3pb.Message)
- const in = `name: "Wallace" true_scotsman: true`
- want := &proto3pb.Message{
- Name: "Wallace",
- TrueScotsman: true,
- }
- if err := UnmarshalText(in, m); err != nil {
- t.Fatal(err)
- }
- if !Equal(m, want) {
- t.Errorf("\n got %v\nwant %v", m, want)
- }
-}
-
-func TestMapParsing(t *testing.T) {
- m := new(MessageWithMap)
- const in = `name_mapping:<key:1234 value:"Feist"> name_mapping:<key:1 value:"Beatles">` +
- `msg_mapping:<key:-4, value:<f: 2.0>,>` + // separating commas are okay
- `msg_mapping<key:-2 value<f: 4.0>>` + // no colon after "value"
- `msg_mapping:<value:<f: 5.0>>` + // omitted key
- `msg_mapping:<key:1>` + // omitted value
- `byte_mapping:<key:true value:"so be it">` +
- `byte_mapping:<>` // omitted key and value
- want := &MessageWithMap{
- NameMapping: map[int32]string{
- 1: "Beatles",
- 1234: "Feist",
- },
- MsgMapping: map[int64]*FloatingPoint{
- -4: {F: Float64(2.0)},
- -2: {F: Float64(4.0)},
- 0: {F: Float64(5.0)},
- 1: nil,
- },
- ByteMapping: map[bool][]byte{
- false: nil,
- true: []byte("so be it"),
- },
- }
- if err := UnmarshalText(in, m); err != nil {
- t.Fatal(err)
- }
- if !Equal(m, want) {
- t.Errorf("\n got %v\nwant %v", m, want)
- }
-}
-
-func TestOneofParsing(t *testing.T) {
- const in = `name:"Shrek"`
- m := new(Communique)
- want := &Communique{Union: &Communique_Name{"Shrek"}}
- if err := UnmarshalText(in, m); err != nil {
- t.Fatal(err)
- }
- if !Equal(m, want) {
- t.Errorf("\n got %v\nwant %v", m, want)
- }
-
- const inOverwrite = `name:"Shrek" number:42`
- m = new(Communique)
- testErr := "line 1.13: field 'number' would overwrite already parsed oneof 'Union'"
- if err := UnmarshalText(inOverwrite, m); err == nil {
- t.Errorf("TestOneofParsing: Didn't get expected error: %v", testErr)
- } else if err.Error() != testErr {
- t.Errorf("TestOneofParsing: Incorrect error.\nHave: %v\nWant: %v",
- err.Error(), testErr)
- }
-
-}
-
-var benchInput string
-
-func init() {
- benchInput = "count: 4\n"
- for i := 0; i < 1000; i++ {
- benchInput += "pet: \"fido\"\n"
- }
-
- // Check it is valid input.
- pb := new(MyMessage)
- err := UnmarshalText(benchInput, pb)
- if err != nil {
- panic("Bad benchmark input: " + err.Error())
- }
-}
-
-func BenchmarkUnmarshalText(b *testing.B) {
- pb := new(MyMessage)
- for i := 0; i < b.N; i++ {
- UnmarshalText(benchInput, pb)
- }
- b.SetBytes(int64(len(benchInput)))
-}
diff --git a/vendor/github.com/golang/protobuf/proto/text_test.go b/vendor/github.com/golang/protobuf/proto/text_test.go
deleted file mode 100644
index 3c8b033c0..000000000
--- a/vendor/github.com/golang/protobuf/proto/text_test.go
+++ /dev/null
@@ -1,518 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto_test
-
-import (
- "bytes"
- "errors"
- "io/ioutil"
- "math"
- "strings"
- "sync"
- "testing"
-
- "github.com/golang/protobuf/proto"
-
- proto3pb "github.com/golang/protobuf/proto/proto3_proto"
- pb "github.com/golang/protobuf/proto/test_proto"
- anypb "github.com/golang/protobuf/ptypes/any"
-)
-
-// textMessage implements the methods that allow it to marshal and unmarshal
-// itself as text.
-type textMessage struct {
-}
-
-func (*textMessage) MarshalText() ([]byte, error) {
- return []byte("custom"), nil
-}
-
-func (*textMessage) UnmarshalText(bytes []byte) error {
- if string(bytes) != "custom" {
- return errors.New("expected 'custom'")
- }
- return nil
-}
-
-func (*textMessage) Reset() {}
-func (*textMessage) String() string { return "" }
-func (*textMessage) ProtoMessage() {}
-
-func newTestMessage() *pb.MyMessage {
- msg := &pb.MyMessage{
- Count: proto.Int32(42),
- Name: proto.String("Dave"),
- Quote: proto.String(`"I didn't want to go."`),
- Pet: []string{"bunny", "kitty", "horsey"},
- Inner: &pb.InnerMessage{
- Host: proto.String("footrest.syd"),
- Port: proto.Int32(7001),
- Connected: proto.Bool(true),
- },
- Others: []*pb.OtherMessage{
- {
- Key: proto.Int64(0xdeadbeef),
- Value: []byte{1, 65, 7, 12},
- },
- {
- Weight: proto.Float32(6.022),
- Inner: &pb.InnerMessage{
- Host: proto.String("lesha.mtv"),
- Port: proto.Int32(8002),
- },
- },
- },
- Bikeshed: pb.MyMessage_BLUE.Enum(),
- Somegroup: &pb.MyMessage_SomeGroup{
- GroupField: proto.Int32(8),
- },
- // One normally wouldn't do this.
- // This is an undeclared tag 13, as a varint (wire type 0) with value 4.
- XXX_unrecognized: []byte{13<<3 | 0, 4},
- }
- ext := &pb.Ext{
- Data: proto.String("Big gobs for big rats"),
- }
- if err := proto.SetExtension(msg, pb.E_Ext_More, ext); err != nil {
- panic(err)
- }
- greetings := []string{"adg", "easy", "cow"}
- if err := proto.SetExtension(msg, pb.E_Greeting, greetings); err != nil {
- panic(err)
- }
-
- // Add an unknown extension. We marshal a pb.Ext, and fake the ID.
- b, err := proto.Marshal(&pb.Ext{Data: proto.String("3G skiing")})
- if err != nil {
- panic(err)
- }
- b = append(proto.EncodeVarint(201<<3|proto.WireBytes), b...)
- proto.SetRawExtension(msg, 201, b)
-
- // Extensions can be plain fields, too, so let's test that.
- b = append(proto.EncodeVarint(202<<3|proto.WireVarint), 19)
- proto.SetRawExtension(msg, 202, b)
-
- return msg
-}
-
-const text = `count: 42
-name: "Dave"
-quote: "\"I didn't want to go.\""
-pet: "bunny"
-pet: "kitty"
-pet: "horsey"
-inner: <
- host: "footrest.syd"
- port: 7001
- connected: true
->
-others: <
- key: 3735928559
- value: "\001A\007\014"
->
-others: <
- weight: 6.022
- inner: <
- host: "lesha.mtv"
- port: 8002
- >
->
-bikeshed: BLUE
-SomeGroup {
- group_field: 8
-}
-/* 2 unknown bytes */
-13: 4
-[test_proto.Ext.more]: <
- data: "Big gobs for big rats"
->
-[test_proto.greeting]: "adg"
-[test_proto.greeting]: "easy"
-[test_proto.greeting]: "cow"
-/* 13 unknown bytes */
-201: "\t3G skiing"
-/* 3 unknown bytes */
-202: 19
-`
-
-func TestMarshalText(t *testing.T) {
- buf := new(bytes.Buffer)
- if err := proto.MarshalText(buf, newTestMessage()); err != nil {
- t.Fatalf("proto.MarshalText: %v", err)
- }
- s := buf.String()
- if s != text {
- t.Errorf("Got:\n===\n%v===\nExpected:\n===\n%v===\n", s, text)
- }
-}
-
-func TestMarshalTextCustomMessage(t *testing.T) {
- buf := new(bytes.Buffer)
- if err := proto.MarshalText(buf, &textMessage{}); err != nil {
- t.Fatalf("proto.MarshalText: %v", err)
- }
- s := buf.String()
- if s != "custom" {
- t.Errorf("Got %q, expected %q", s, "custom")
- }
-}
-func TestMarshalTextNil(t *testing.T) {
- want := "<nil>"
- tests := []proto.Message{nil, (*pb.MyMessage)(nil)}
- for i, test := range tests {
- buf := new(bytes.Buffer)
- if err := proto.MarshalText(buf, test); err != nil {
- t.Fatal(err)
- }
- if got := buf.String(); got != want {
- t.Errorf("%d: got %q want %q", i, got, want)
- }
- }
-}
-
-func TestMarshalTextUnknownEnum(t *testing.T) {
- // The Color enum only specifies values 0-2.
- m := &pb.MyMessage{Bikeshed: pb.MyMessage_Color(3).Enum()}
- got := m.String()
- const want = `bikeshed:3 `
- if got != want {
- t.Errorf("\n got %q\nwant %q", got, want)
- }
-}
-
-func TestTextOneof(t *testing.T) {
- tests := []struct {
- m proto.Message
- want string
- }{
- // zero message
- {&pb.Communique{}, ``},
- // scalar field
- {&pb.Communique{Union: &pb.Communique_Number{4}}, `number:4`},
- // message field
- {&pb.Communique{Union: &pb.Communique_Msg{
- &pb.Strings{StringField: proto.String("why hello!")},
- }}, `msg:<string_field:"why hello!" >`},
- // bad oneof (should not panic)
- {&pb.Communique{Union: &pb.Communique_Msg{nil}}, `msg:/* nil */`},
- }
- for _, test := range tests {
- got := strings.TrimSpace(test.m.String())
- if got != test.want {
- t.Errorf("\n got %s\nwant %s", got, test.want)
- }
- }
-}
-
-func BenchmarkMarshalTextBuffered(b *testing.B) {
- buf := new(bytes.Buffer)
- m := newTestMessage()
- for i := 0; i < b.N; i++ {
- buf.Reset()
- proto.MarshalText(buf, m)
- }
-}
-
-func BenchmarkMarshalTextUnbuffered(b *testing.B) {
- w := ioutil.Discard
- m := newTestMessage()
- for i := 0; i < b.N; i++ {
- proto.MarshalText(w, m)
- }
-}
-
-func compact(src string) string {
- // s/[ \n]+/ /g; s/ $//;
- dst := make([]byte, len(src))
- space, comment := false, false
- j := 0
- for i := 0; i < len(src); i++ {
- if strings.HasPrefix(src[i:], "/*") {
- comment = true
- i++
- continue
- }
- if comment && strings.HasPrefix(src[i:], "*/") {
- comment = false
- i++
- continue
- }
- if comment {
- continue
- }
- c := src[i]
- if c == ' ' || c == '\n' {
- space = true
- continue
- }
- if j > 0 && (dst[j-1] == ':' || dst[j-1] == '<' || dst[j-1] == '{') {
- space = false
- }
- if c == '{' {
- space = false
- }
- if space {
- dst[j] = ' '
- j++
- space = false
- }
- dst[j] = c
- j++
- }
- if space {
- dst[j] = ' '
- j++
- }
- return string(dst[0:j])
-}
-
-var compactText = compact(text)
-
-func TestCompactText(t *testing.T) {
- s := proto.CompactTextString(newTestMessage())
- if s != compactText {
- t.Errorf("Got:\n===\n%v===\nExpected:\n===\n%v\n===\n", s, compactText)
- }
-}
-
-func TestStringEscaping(t *testing.T) {
- testCases := []struct {
- in *pb.Strings
- out string
- }{
- {
- // Test data from C++ test (TextFormatTest.StringEscape).
- // Single divergence: we don't escape apostrophes.
- &pb.Strings{StringField: proto.String("\"A string with ' characters \n and \r newlines and \t tabs and \001 slashes \\ and multiple spaces")},
- "string_field: \"\\\"A string with ' characters \\n and \\r newlines and \\t tabs and \\001 slashes \\\\ and multiple spaces\"\n",
- },
- {
- // Test data from the same C++ test.
- &pb.Strings{StringField: proto.String("\350\260\267\346\255\214")},
- "string_field: \"\\350\\260\\267\\346\\255\\214\"\n",
- },
- {
- // Some UTF-8.
- &pb.Strings{StringField: proto.String("\x00\x01\xff\x81")},
- `string_field: "\000\001\377\201"` + "\n",
- },
- }
-
- for i, tc := range testCases {
- var buf bytes.Buffer
- if err := proto.MarshalText(&buf, tc.in); err != nil {
- t.Errorf("proto.MarsalText: %v", err)
- continue
- }
- s := buf.String()
- if s != tc.out {
- t.Errorf("#%d: Got:\n%s\nExpected:\n%s\n", i, s, tc.out)
- continue
- }
-
- // Check round-trip.
- pb := new(pb.Strings)
- if err := proto.UnmarshalText(s, pb); err != nil {
- t.Errorf("#%d: UnmarshalText: %v", i, err)
- continue
- }
- if !proto.Equal(pb, tc.in) {
- t.Errorf("#%d: Round-trip failed:\nstart: %v\n end: %v", i, tc.in, pb)
- }
- }
-}
-
-// A limitedWriter accepts some output before it fails.
-// This is a proxy for something like a nearly-full or imminently-failing disk,
-// or a network connection that is about to die.
-type limitedWriter struct {
- b bytes.Buffer
- limit int
-}
-
-var outOfSpace = errors.New("proto: insufficient space")
-
-func (w *limitedWriter) Write(p []byte) (n int, err error) {
- var avail = w.limit - w.b.Len()
- if avail <= 0 {
- return 0, outOfSpace
- }
- if len(p) <= avail {
- return w.b.Write(p)
- }
- n, _ = w.b.Write(p[:avail])
- return n, outOfSpace
-}
-
-func TestMarshalTextFailing(t *testing.T) {
- // Try lots of different sizes to exercise more error code-paths.
- for lim := 0; lim < len(text); lim++ {
- buf := new(limitedWriter)
- buf.limit = lim
- err := proto.MarshalText(buf, newTestMessage())
- // We expect a certain error, but also some partial results in the buffer.
- if err != outOfSpace {
- t.Errorf("Got:\n===\n%v===\nExpected:\n===\n%v===\n", err, outOfSpace)
- }
- s := buf.b.String()
- x := text[:buf.limit]
- if s != x {
- t.Errorf("Got:\n===\n%v===\nExpected:\n===\n%v===\n", s, x)
- }
- }
-}
-
-func TestFloats(t *testing.T) {
- tests := []struct {
- f float64
- want string
- }{
- {0, "0"},
- {4.7, "4.7"},
- {math.Inf(1), "inf"},
- {math.Inf(-1), "-inf"},
- {math.NaN(), "nan"},
- }
- for _, test := range tests {
- msg := &pb.FloatingPoint{F: &test.f}
- got := strings.TrimSpace(msg.String())
- want := `f:` + test.want
- if got != want {
- t.Errorf("f=%f: got %q, want %q", test.f, got, want)
- }
- }
-}
-
-func TestRepeatedNilText(t *testing.T) {
- m := &pb.MessageList{
- Message: []*pb.MessageList_Message{
- nil,
- &pb.MessageList_Message{
- Name: proto.String("Horse"),
- },
- nil,
- },
- }
- want := `Message <nil>
-Message {
- name: "Horse"
-}
-Message <nil>
-`
- if s := proto.MarshalTextString(m); s != want {
- t.Errorf(" got: %s\nwant: %s", s, want)
- }
-}
-
-func TestProto3Text(t *testing.T) {
- tests := []struct {
- m proto.Message
- want string
- }{
- // zero message
- {&proto3pb.Message{}, ``},
- // zero message except for an empty byte slice
- {&proto3pb.Message{Data: []byte{}}, ``},
- // trivial case
- {&proto3pb.Message{Name: "Rob", HeightInCm: 175}, `name:"Rob" height_in_cm:175`},
- // empty map
- {&pb.MessageWithMap{}, ``},
- // non-empty map; map format is the same as a repeated struct,
- // and they are sorted by key (numerically for numeric keys).
- {
- &pb.MessageWithMap{NameMapping: map[int32]string{
- -1: "Negatory",
- 7: "Lucky",
- 1234: "Feist",
- 6345789: "Otis",
- }},
- `name_mapping:<key:-1 value:"Negatory" > ` +
- `name_mapping:<key:7 value:"Lucky" > ` +
- `name_mapping:<key:1234 value:"Feist" > ` +
- `name_mapping:<key:6345789 value:"Otis" >`,
- },
- // map with nil value; not well-defined, but we shouldn't crash
- {
- &pb.MessageWithMap{MsgMapping: map[int64]*pb.FloatingPoint{7: nil}},
- `msg_mapping:<key:7 >`,
- },
- }
- for _, test := range tests {
- got := strings.TrimSpace(test.m.String())
- if got != test.want {
- t.Errorf("\n got %s\nwant %s", got, test.want)
- }
- }
-}
-
-func TestRacyMarshal(t *testing.T) {
- // This test should be run with the race detector.
-
- any := &pb.MyMessage{Count: proto.Int32(47), Name: proto.String("David")}
- proto.SetExtension(any, pb.E_Ext_Text, proto.String("bar"))
- b, err := proto.Marshal(any)
- if err != nil {
- panic(err)
- }
- m := &proto3pb.Message{
- Name: "David",
- ResultCount: 47,
- Anything: &anypb.Any{TypeUrl: "type.googleapis.com/" + proto.MessageName(any), Value: b},
- }
-
- wantText := proto.MarshalTextString(m)
- wantBytes, err := proto.Marshal(m)
- if err != nil {
- t.Fatalf("proto.Marshal error: %v", err)
- }
-
- var wg sync.WaitGroup
- defer wg.Wait()
- wg.Add(20)
- for i := 0; i < 10; i++ {
- go func() {
- defer wg.Done()
- got := proto.MarshalTextString(m)
- if got != wantText {
- t.Errorf("proto.MarshalTextString = %q, want %q", got, wantText)
- }
- }()
- go func() {
- defer wg.Done()
- got, err := proto.Marshal(m)
- if !bytes.Equal(got, wantBytes) || err != nil {
- t.Errorf("proto.Marshal = (%x, %v), want (%x, nil)", got, err, wantBytes)
- }
- }()
- }
-}
diff --git a/vendor/github.com/golang/protobuf/ptypes/any_test.go b/vendor/github.com/golang/protobuf/ptypes/any_test.go
deleted file mode 100644
index ed675b489..000000000
--- a/vendor/github.com/golang/protobuf/ptypes/any_test.go
+++ /dev/null
@@ -1,113 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2016 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package ptypes
-
-import (
- "testing"
-
- "github.com/golang/protobuf/proto"
- pb "github.com/golang/protobuf/protoc-gen-go/descriptor"
- "github.com/golang/protobuf/ptypes/any"
-)
-
-func TestMarshalUnmarshal(t *testing.T) {
- orig := &any.Any{Value: []byte("test")}
-
- packed, err := MarshalAny(orig)
- if err != nil {
- t.Errorf("MarshalAny(%+v): got: _, %v exp: _, nil", orig, err)
- }
-
- unpacked := &any.Any{}
- err = UnmarshalAny(packed, unpacked)
- if err != nil || !proto.Equal(unpacked, orig) {
- t.Errorf("got: %v, %+v; want nil, %+v", err, unpacked, orig)
- }
-}
-
-func TestIs(t *testing.T) {
- a, err := MarshalAny(&pb.FileDescriptorProto{})
- if err != nil {
- t.Fatal(err)
- }
- if Is(a, &pb.DescriptorProto{}) {
- t.Error("FileDescriptorProto is not a DescriptorProto, but Is says it is")
- }
- if !Is(a, &pb.FileDescriptorProto{}) {
- t.Error("FileDescriptorProto is indeed a FileDescriptorProto, but Is says it is not")
- }
-}
-
-func TestIsDifferentUrlPrefixes(t *testing.T) {
- m := &pb.FileDescriptorProto{}
- a := &any.Any{TypeUrl: "foo/bar/" + proto.MessageName(m)}
- if !Is(a, m) {
- t.Errorf("message with type url %q didn't satisfy Is for type %q", a.TypeUrl, proto.MessageName(m))
- }
-}
-
-func TestUnmarshalDynamic(t *testing.T) {
- want := &pb.FileDescriptorProto{Name: proto.String("foo")}
- a, err := MarshalAny(want)
- if err != nil {
- t.Fatal(err)
- }
- var got DynamicAny
- if err := UnmarshalAny(a, &got); err != nil {
- t.Fatal(err)
- }
- if !proto.Equal(got.Message, want) {
- t.Errorf("invalid result from UnmarshalAny, got %q want %q", got.Message, want)
- }
-}
-
-func TestEmpty(t *testing.T) {
- want := &pb.FileDescriptorProto{}
- a, err := MarshalAny(want)
- if err != nil {
- t.Fatal(err)
- }
- got, err := Empty(a)
- if err != nil {
- t.Fatal(err)
- }
- if !proto.Equal(got, want) {
- t.Errorf("unequal empty message, got %q, want %q", got, want)
- }
-
- // that's a valid type_url for a message which shouldn't be linked into this
- // test binary. We want an error.
- a.TypeUrl = "type.googleapis.com/google.protobuf.FieldMask"
- if _, err := Empty(a); err == nil {
- t.Errorf("got no error for an attempt to create a message of type %q, which shouldn't be linked in", a.TypeUrl)
- }
-}
diff --git a/vendor/github.com/golang/protobuf/ptypes/duration_test.go b/vendor/github.com/golang/protobuf/ptypes/duration_test.go
deleted file mode 100644
index e00491a34..000000000
--- a/vendor/github.com/golang/protobuf/ptypes/duration_test.go
+++ /dev/null
@@ -1,121 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2016 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package ptypes
-
-import (
- "math"
- "testing"
- "time"
-
- "github.com/golang/protobuf/proto"
- durpb "github.com/golang/protobuf/ptypes/duration"
-)
-
-const (
- minGoSeconds = math.MinInt64 / int64(1e9)
- maxGoSeconds = math.MaxInt64 / int64(1e9)
-)
-
-var durationTests = []struct {
- proto *durpb.Duration
- isValid bool
- inRange bool
- dur time.Duration
-}{
- // The zero duration.
- {&durpb.Duration{Seconds: 0, Nanos: 0}, true, true, 0},
- // Some ordinary non-zero durations.
- {&durpb.Duration{Seconds: 100, Nanos: 0}, true, true, 100 * time.Second},
- {&durpb.Duration{Seconds: -100, Nanos: 0}, true, true, -100 * time.Second},
- {&durpb.Duration{Seconds: 100, Nanos: 987}, true, true, 100*time.Second + 987},
- {&durpb.Duration{Seconds: -100, Nanos: -987}, true, true, -(100*time.Second + 987)},
- // The largest duration representable in Go.
- {&durpb.Duration{Seconds: maxGoSeconds, Nanos: int32(math.MaxInt64 - 1e9*maxGoSeconds)}, true, true, math.MaxInt64},
- // The smallest duration representable in Go.
- {&durpb.Duration{Seconds: minGoSeconds, Nanos: int32(math.MinInt64 - 1e9*minGoSeconds)}, true, true, math.MinInt64},
- {nil, false, false, 0},
- {&durpb.Duration{Seconds: -100, Nanos: 987}, false, false, 0},
- {&durpb.Duration{Seconds: 100, Nanos: -987}, false, false, 0},
- {&durpb.Duration{Seconds: math.MinInt64, Nanos: 0}, false, false, 0},
- {&durpb.Duration{Seconds: math.MaxInt64, Nanos: 0}, false, false, 0},
- // The largest valid duration.
- {&durpb.Duration{Seconds: maxSeconds, Nanos: 1e9 - 1}, true, false, 0},
- // The smallest valid duration.
- {&durpb.Duration{Seconds: minSeconds, Nanos: -(1e9 - 1)}, true, false, 0},
- // The smallest invalid duration above the valid range.
- {&durpb.Duration{Seconds: maxSeconds + 1, Nanos: 0}, false, false, 0},
- // The largest invalid duration below the valid range.
- {&durpb.Duration{Seconds: minSeconds - 1, Nanos: -(1e9 - 1)}, false, false, 0},
- // One nanosecond past the largest duration representable in Go.
- {&durpb.Duration{Seconds: maxGoSeconds, Nanos: int32(math.MaxInt64-1e9*maxGoSeconds) + 1}, true, false, 0},
- // One nanosecond past the smallest duration representable in Go.
- {&durpb.Duration{Seconds: minGoSeconds, Nanos: int32(math.MinInt64-1e9*minGoSeconds) - 1}, true, false, 0},
- // One second past the largest duration representable in Go.
- {&durpb.Duration{Seconds: maxGoSeconds + 1, Nanos: int32(math.MaxInt64 - 1e9*maxGoSeconds)}, true, false, 0},
- // One second past the smallest duration representable in Go.
- {&durpb.Duration{Seconds: minGoSeconds - 1, Nanos: int32(math.MinInt64 - 1e9*minGoSeconds)}, true, false, 0},
-}
-
-func TestValidateDuration(t *testing.T) {
- for _, test := range durationTests {
- err := validateDuration(test.proto)
- gotValid := (err == nil)
- if gotValid != test.isValid {
- t.Errorf("validateDuration(%v) = %t, want %t", test.proto, gotValid, test.isValid)
- }
- }
-}
-
-func TestDuration(t *testing.T) {
- for _, test := range durationTests {
- got, err := Duration(test.proto)
- gotOK := (err == nil)
- wantOK := test.isValid && test.inRange
- if gotOK != wantOK {
- t.Errorf("Duration(%v) ok = %t, want %t", test.proto, gotOK, wantOK)
- }
- if err == nil && got != test.dur {
- t.Errorf("Duration(%v) = %v, want %v", test.proto, got, test.dur)
- }
- }
-}
-
-func TestDurationProto(t *testing.T) {
- for _, test := range durationTests {
- if test.isValid && test.inRange {
- got := DurationProto(test.dur)
- if !proto.Equal(got, test.proto) {
- t.Errorf("DurationProto(%v) = %v, want %v", test.dur, got, test.proto)
- }
- }
- }
-}
diff --git a/vendor/github.com/golang/protobuf/ptypes/timestamp_test.go b/vendor/github.com/golang/protobuf/ptypes/timestamp_test.go
deleted file mode 100644
index 6e3c969b9..000000000
--- a/vendor/github.com/golang/protobuf/ptypes/timestamp_test.go
+++ /dev/null
@@ -1,153 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2016 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package ptypes
-
-import (
- "math"
- "testing"
- "time"
-
- "github.com/golang/protobuf/proto"
- tspb "github.com/golang/protobuf/ptypes/timestamp"
-)
-
-var tests = []struct {
- ts *tspb.Timestamp
- valid bool
- t time.Time
-}{
- // The timestamp representing the Unix epoch date.
- {&tspb.Timestamp{Seconds: 0, Nanos: 0}, true, utcDate(1970, 1, 1)},
- // The smallest representable timestamp.
- {&tspb.Timestamp{Seconds: math.MinInt64, Nanos: math.MinInt32}, false,
- time.Unix(math.MinInt64, math.MinInt32).UTC()},
- // The smallest representable timestamp with non-negative nanos.
- {&tspb.Timestamp{Seconds: math.MinInt64, Nanos: 0}, false, time.Unix(math.MinInt64, 0).UTC()},
- // The earliest valid timestamp.
- {&tspb.Timestamp{Seconds: minValidSeconds, Nanos: 0}, true, utcDate(1, 1, 1)},
- //"0001-01-01T00:00:00Z"},
- // The largest representable timestamp.
- {&tspb.Timestamp{Seconds: math.MaxInt64, Nanos: math.MaxInt32}, false,
- time.Unix(math.MaxInt64, math.MaxInt32).UTC()},
- // The largest representable timestamp with nanos in range.
- {&tspb.Timestamp{Seconds: math.MaxInt64, Nanos: 1e9 - 1}, false,
- time.Unix(math.MaxInt64, 1e9-1).UTC()},
- // The largest valid timestamp.
- {&tspb.Timestamp{Seconds: maxValidSeconds - 1, Nanos: 1e9 - 1}, true,
- time.Date(9999, 12, 31, 23, 59, 59, 1e9-1, time.UTC)},
- // The smallest invalid timestamp that is larger than the valid range.
- {&tspb.Timestamp{Seconds: maxValidSeconds, Nanos: 0}, false, time.Unix(maxValidSeconds, 0).UTC()},
- // A date before the epoch.
- {&tspb.Timestamp{Seconds: -281836800, Nanos: 0}, true, utcDate(1961, 1, 26)},
- // A date after the epoch.
- {&tspb.Timestamp{Seconds: 1296000000, Nanos: 0}, true, utcDate(2011, 1, 26)},
- // A date after the epoch, in the middle of the day.
- {&tspb.Timestamp{Seconds: 1296012345, Nanos: 940483}, true,
- time.Date(2011, 1, 26, 3, 25, 45, 940483, time.UTC)},
-}
-
-func TestValidateTimestamp(t *testing.T) {
- for _, s := range tests {
- got := validateTimestamp(s.ts)
- if (got == nil) != s.valid {
- t.Errorf("validateTimestamp(%v) = %v, want %v", s.ts, got, s.valid)
- }
- }
-}
-
-func TestTimestamp(t *testing.T) {
- for _, s := range tests {
- got, err := Timestamp(s.ts)
- if (err == nil) != s.valid {
- t.Errorf("Timestamp(%v) error = %v, but valid = %t", s.ts, err, s.valid)
- } else if s.valid && got != s.t {
- t.Errorf("Timestamp(%v) = %v, want %v", s.ts, got, s.t)
- }
- }
- // Special case: a nil Timestamp is an error, but returns the 0 Unix time.
- got, err := Timestamp(nil)
- want := time.Unix(0, 0).UTC()
- if got != want {
- t.Errorf("Timestamp(nil) = %v, want %v", got, want)
- }
- if err == nil {
- t.Errorf("Timestamp(nil) error = nil, expected error")
- }
-}
-
-func TestTimestampProto(t *testing.T) {
- for _, s := range tests {
- got, err := TimestampProto(s.t)
- if (err == nil) != s.valid {
- t.Errorf("TimestampProto(%v) error = %v, but valid = %t", s.t, err, s.valid)
- } else if s.valid && !proto.Equal(got, s.ts) {
- t.Errorf("TimestampProto(%v) = %v, want %v", s.t, got, s.ts)
- }
- }
- // No corresponding special case here: no time.Time results in a nil Timestamp.
-}
-
-func TestTimestampString(t *testing.T) {
- for _, test := range []struct {
- ts *tspb.Timestamp
- want string
- }{
- // Not much testing needed because presumably time.Format is
- // well-tested.
- {&tspb.Timestamp{Seconds: 0, Nanos: 0}, "1970-01-01T00:00:00Z"},
- {&tspb.Timestamp{Seconds: minValidSeconds - 1, Nanos: 0}, "(timestamp: seconds:-62135596801 before 0001-01-01)"},
- } {
- got := TimestampString(test.ts)
- if got != test.want {
- t.Errorf("TimestampString(%v) = %q, want %q", test.ts, got, test.want)
- }
- }
-}
-
-func utcDate(year, month, day int) time.Time {
- return time.Date(year, time.Month(month), day, 0, 0, 0, 0, time.UTC)
-}
-
-func TestTimestampNow(t *testing.T) {
- // Bracket the expected time.
- before := time.Now()
- ts := TimestampNow()
- after := time.Now()
-
- tm, err := Timestamp(ts)
- if err != nil {
- t.Errorf("between %v and %v\nTimestampNow() = %v\nwhich is invalid (%v)", before, after, ts, err)
- }
- if tm.Before(before) || tm.After(after) {
- t.Errorf("between %v and %v\nTimestamp(TimestampNow()) = %v", before, after, tm)
- }
-}
diff --git a/vendor/github.com/golang/snappy/golden_test.go b/vendor/github.com/golang/snappy/golden_test.go
deleted file mode 100644
index e4496f92e..000000000
--- a/vendor/github.com/golang/snappy/golden_test.go
+++ /dev/null
@@ -1,1965 +0,0 @@
-// Copyright 2016 The Snappy-Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package snappy
-
-// extendMatchGoldenTestCases is the i and j arguments, and the returned value,
-// for every extendMatch call issued when encoding the
-// testdata/Mark.Twain-Tom.Sawyer.txt file. It is used to benchmark the
-// extendMatch implementation.
-//
-// It was generated manually by adding some print statements to the (pure Go)
-// extendMatch implementation:
-//
-// func extendMatch(src []byte, i, j int) int {
-// i0, j0 := i, j
-// for ; j < len(src) && src[i] == src[j]; i, j = i+1, j+1 {
-// }
-// println("{", i0, ",", j0, ",", j, "},")
-// return j
-// }
-//
-// and running "go test -test.run=EncodeGoldenInput -tags=noasm".
-var extendMatchGoldenTestCases = []struct {
- i, j, want int
-}{
- {11, 61, 62},
- {80, 81, 82},
- {86, 87, 101},
- {85, 133, 149},
- {152, 153, 162},
- {133, 168, 193},
- {168, 207, 225},
- {81, 255, 275},
- {278, 279, 283},
- {306, 417, 417},
- {373, 428, 430},
- {389, 444, 447},
- {474, 510, 512},
- {465, 533, 533},
- {47, 547, 547},
- {307, 551, 554},
- {420, 582, 587},
- {309, 604, 604},
- {604, 625, 625},
- {538, 629, 629},
- {328, 640, 640},
- {573, 645, 645},
- {319, 657, 657},
- {30, 664, 664},
- {45, 679, 680},
- {621, 684, 684},
- {376, 700, 700},
- {33, 707, 708},
- {601, 733, 733},
- {334, 744, 745},
- {625, 758, 759},
- {382, 763, 763},
- {550, 769, 771},
- {533, 789, 789},
- {804, 813, 813},
- {342, 841, 842},
- {742, 847, 847},
- {74, 852, 852},
- {810, 864, 864},
- {758, 868, 869},
- {714, 883, 883},
- {582, 889, 891},
- {61, 934, 935},
- {894, 942, 942},
- {939, 949, 949},
- {785, 956, 957},
- {886, 978, 978},
- {792, 998, 998},
- {998, 1005, 1005},
- {572, 1032, 1032},
- {698, 1051, 1053},
- {599, 1067, 1069},
- {1056, 1079, 1079},
- {942, 1089, 1090},
- {831, 1094, 1096},
- {1088, 1100, 1103},
- {732, 1113, 1114},
- {1037, 1118, 1118},
- {872, 1128, 1130},
- {1079, 1140, 1142},
- {332, 1162, 1162},
- {207, 1168, 1186},
- {1189, 1190, 1225},
- {105, 1229, 1230},
- {79, 1256, 1257},
- {1190, 1261, 1283},
- {255, 1306, 1306},
- {1319, 1339, 1358},
- {364, 1370, 1370},
- {955, 1378, 1380},
- {122, 1403, 1403},
- {1325, 1407, 1419},
- {664, 1423, 1424},
- {941, 1461, 1463},
- {867, 1477, 1478},
- {757, 1488, 1489},
- {1140, 1499, 1499},
- {31, 1506, 1506},
- {1487, 1510, 1512},
- {1089, 1520, 1521},
- {1467, 1525, 1529},
- {1394, 1537, 1537},
- {1499, 1541, 1541},
- {367, 1558, 1558},
- {1475, 1564, 1564},
- {1525, 1568, 1571},
- {1541, 1582, 1583},
- {864, 1587, 1588},
- {704, 1597, 1597},
- {336, 1602, 1602},
- {1383, 1613, 1613},
- {1498, 1617, 1618},
- {1051, 1623, 1625},
- {401, 1643, 1645},
- {1072, 1654, 1655},
- {1067, 1667, 1669},
- {699, 1673, 1674},
- {1587, 1683, 1684},
- {920, 1696, 1696},
- {1505, 1710, 1710},
- {1550, 1723, 1723},
- {996, 1727, 1727},
- {833, 1733, 1734},
- {1638, 1739, 1740},
- {1654, 1744, 1744},
- {753, 1761, 1761},
- {1548, 1773, 1773},
- {1568, 1777, 1780},
- {1683, 1793, 1794},
- {948, 1801, 1801},
- {1666, 1805, 1808},
- {1502, 1814, 1814},
- {1696, 1822, 1822},
- {502, 1836, 1837},
- {917, 1843, 1843},
- {1733, 1854, 1855},
- {970, 1859, 1859},
- {310, 1863, 1863},
- {657, 1872, 1872},
- {1005, 1876, 1876},
- {1662, 1880, 1880},
- {904, 1892, 1892},
- {1427, 1910, 1910},
- {1772, 1929, 1930},
- {1822, 1937, 1940},
- {1858, 1949, 1950},
- {1602, 1956, 1956},
- {1150, 1962, 1962},
- {1504, 1966, 1967},
- {51, 1971, 1971},
- {1605, 1979, 1979},
- {1458, 1983, 1988},
- {1536, 2001, 2006},
- {1373, 2014, 2018},
- {1494, 2025, 2025},
- {1667, 2029, 2031},
- {1592, 2035, 2035},
- {330, 2045, 2045},
- {1376, 2053, 2053},
- {1991, 2058, 2059},
- {1635, 2065, 2065},
- {1992, 2073, 2074},
- {2014, 2080, 2081},
- {1546, 2085, 2087},
- {59, 2099, 2099},
- {1996, 2106, 2106},
- {1836, 2110, 2110},
- {2068, 2114, 2114},
- {1338, 2122, 2122},
- {1562, 2128, 2130},
- {1934, 2134, 2134},
- {2114, 2141, 2142},
- {977, 2149, 2150},
- {956, 2154, 2155},
- {1407, 2162, 2162},
- {1773, 2166, 2166},
- {883, 2171, 2171},
- {623, 2175, 2178},
- {1520, 2191, 2192},
- {1162, 2200, 2200},
- {912, 2204, 2204},
- {733, 2208, 2208},
- {1777, 2212, 2215},
- {1532, 2219, 2219},
- {718, 2223, 2225},
- {2069, 2229, 2229},
- {2207, 2245, 2246},
- {1139, 2264, 2264},
- {677, 2274, 2274},
- {2099, 2279, 2279},
- {1863, 2283, 2283},
- {1966, 2305, 2306},
- {2279, 2313, 2313},
- {1628, 2319, 2319},
- {755, 2329, 2329},
- {1461, 2334, 2334},
- {2117, 2340, 2340},
- {2313, 2349, 2349},
- {1859, 2353, 2353},
- {1048, 2362, 2362},
- {895, 2366, 2366},
- {2278, 2373, 2373},
- {1884, 2377, 2377},
- {1402, 2387, 2392},
- {700, 2398, 2398},
- {1971, 2402, 2402},
- {2009, 2419, 2419},
- {1441, 2426, 2428},
- {2208, 2432, 2432},
- {2038, 2436, 2436},
- {932, 2443, 2443},
- {1759, 2447, 2448},
- {744, 2452, 2452},
- {1875, 2458, 2458},
- {2405, 2468, 2468},
- {1596, 2472, 2473},
- {1953, 2480, 2482},
- {736, 2487, 2487},
- {1913, 2493, 2493},
- {774, 2497, 2497},
- {1484, 2506, 2508},
- {2432, 2512, 2512},
- {752, 2519, 2519},
- {2497, 2523, 2523},
- {2409, 2528, 2529},
- {2122, 2533, 2533},
- {2396, 2537, 2538},
- {2410, 2547, 2548},
- {1093, 2555, 2560},
- {551, 2564, 2565},
- {2268, 2569, 2569},
- {1362, 2580, 2580},
- {1916, 2584, 2585},
- {994, 2589, 2590},
- {1979, 2596, 2596},
- {1041, 2602, 2602},
- {2104, 2614, 2616},
- {2609, 2621, 2628},
- {2329, 2638, 2638},
- {2211, 2657, 2658},
- {2638, 2662, 2667},
- {2578, 2676, 2679},
- {2153, 2685, 2686},
- {2608, 2696, 2697},
- {598, 2712, 2712},
- {2620, 2719, 2720},
- {1888, 2724, 2728},
- {2709, 2732, 2732},
- {1365, 2739, 2739},
- {784, 2747, 2748},
- {424, 2753, 2753},
- {2204, 2759, 2759},
- {812, 2768, 2769},
- {2455, 2773, 2773},
- {1722, 2781, 2781},
- {1917, 2792, 2792},
- {2705, 2799, 2799},
- {2685, 2806, 2807},
- {2742, 2811, 2811},
- {1370, 2818, 2818},
- {2641, 2830, 2830},
- {2512, 2837, 2837},
- {2457, 2841, 2841},
- {2756, 2845, 2845},
- {2719, 2855, 2855},
- {1423, 2859, 2859},
- {2849, 2863, 2865},
- {1474, 2871, 2871},
- {1161, 2875, 2876},
- {2282, 2880, 2881},
- {2746, 2888, 2888},
- {1783, 2893, 2893},
- {2401, 2899, 2900},
- {2632, 2920, 2923},
- {2422, 2928, 2930},
- {2715, 2939, 2939},
- {2162, 2943, 2943},
- {2859, 2947, 2947},
- {1910, 2951, 2951},
- {1431, 2955, 2956},
- {1439, 2964, 2964},
- {2501, 2968, 2969},
- {2029, 2973, 2976},
- {689, 2983, 2984},
- {1658, 2988, 2988},
- {1031, 2996, 2996},
- {2149, 3001, 3002},
- {25, 3009, 3013},
- {2964, 3023, 3023},
- {953, 3027, 3028},
- {2359, 3036, 3036},
- {3023, 3049, 3049},
- {2880, 3055, 3056},
- {2973, 3076, 3077},
- {2874, 3090, 3090},
- {2871, 3094, 3094},
- {2532, 3100, 3100},
- {2938, 3107, 3108},
- {350, 3115, 3115},
- {2196, 3119, 3121},
- {1133, 3127, 3129},
- {1797, 3134, 3150},
- {3032, 3158, 3158},
- {3016, 3172, 3172},
- {2533, 3179, 3179},
- {3055, 3187, 3188},
- {1384, 3192, 3193},
- {2799, 3199, 3199},
- {2126, 3203, 3207},
- {2334, 3215, 3215},
- {2105, 3220, 3221},
- {3199, 3229, 3229},
- {2891, 3233, 3233},
- {855, 3240, 3240},
- {1852, 3253, 3256},
- {2140, 3263, 3263},
- {1682, 3268, 3270},
- {3243, 3274, 3274},
- {924, 3279, 3279},
- {2212, 3283, 3283},
- {2596, 3287, 3287},
- {2999, 3291, 3291},
- {2353, 3295, 3295},
- {2480, 3302, 3304},
- {1959, 3308, 3311},
- {3000, 3318, 3318},
- {845, 3330, 3330},
- {2283, 3334, 3334},
- {2519, 3342, 3342},
- {3325, 3346, 3348},
- {2397, 3353, 3354},
- {2763, 3358, 3358},
- {3198, 3363, 3364},
- {3211, 3368, 3372},
- {2950, 3376, 3377},
- {3245, 3388, 3391},
- {2264, 3398, 3398},
- {795, 3403, 3403},
- {3287, 3407, 3407},
- {3358, 3411, 3411},
- {3317, 3415, 3415},
- {3232, 3431, 3431},
- {2128, 3435, 3437},
- {3236, 3441, 3441},
- {3398, 3445, 3446},
- {2814, 3450, 3450},
- {3394, 3466, 3466},
- {2425, 3470, 3470},
- {3330, 3476, 3476},
- {1612, 3480, 3480},
- {1004, 3485, 3486},
- {2732, 3490, 3490},
- {1117, 3494, 3495},
- {629, 3501, 3501},
- {3087, 3514, 3514},
- {684, 3518, 3518},
- {3489, 3522, 3524},
- {1760, 3529, 3529},
- {617, 3537, 3537},
- {3431, 3541, 3541},
- {997, 3547, 3547},
- {882, 3552, 3553},
- {2419, 3558, 3558},
- {610, 3562, 3563},
- {1903, 3567, 3569},
- {3005, 3575, 3575},
- {3076, 3585, 3586},
- {3541, 3590, 3590},
- {3490, 3594, 3594},
- {1899, 3599, 3599},
- {3545, 3606, 3606},
- {3290, 3614, 3615},
- {2056, 3619, 3620},
- {3556, 3625, 3625},
- {3294, 3632, 3633},
- {637, 3643, 3644},
- {3609, 3648, 3650},
- {3175, 3658, 3658},
- {3498, 3665, 3665},
- {1597, 3669, 3669},
- {1983, 3673, 3673},
- {3215, 3682, 3682},
- {3544, 3689, 3689},
- {3694, 3698, 3698},
- {3228, 3715, 3716},
- {2594, 3720, 3722},
- {3573, 3726, 3726},
- {2479, 3732, 3735},
- {3191, 3741, 3742},
- {1113, 3746, 3747},
- {2844, 3751, 3751},
- {3445, 3756, 3757},
- {3755, 3766, 3766},
- {3421, 3775, 3780},
- {3593, 3784, 3786},
- {3263, 3796, 3796},
- {3469, 3806, 3806},
- {2602, 3815, 3815},
- {723, 3819, 3821},
- {1608, 3826, 3826},
- {3334, 3830, 3830},
- {2198, 3835, 3835},
- {2635, 3840, 3840},
- {3702, 3852, 3853},
- {3406, 3858, 3859},
- {3681, 3867, 3870},
- {3407, 3880, 3880},
- {340, 3889, 3889},
- {3772, 3893, 3893},
- {593, 3897, 3897},
- {2563, 3914, 3916},
- {2981, 3929, 3929},
- {1835, 3933, 3934},
- {3906, 3951, 3951},
- {1459, 3958, 3958},
- {3889, 3974, 3974},
- {2188, 3982, 3982},
- {3220, 3986, 3987},
- {3585, 3991, 3993},
- {3712, 3997, 4001},
- {2805, 4007, 4007},
- {1879, 4012, 4013},
- {3618, 4018, 4018},
- {1145, 4031, 4032},
- {3901, 4037, 4037},
- {2772, 4046, 4047},
- {2802, 4053, 4054},
- {3299, 4058, 4058},
- {3725, 4066, 4066},
- {2271, 4070, 4070},
- {385, 4075, 4076},
- {3624, 4089, 4090},
- {3745, 4096, 4098},
- {1563, 4102, 4102},
- {4045, 4106, 4111},
- {3696, 4115, 4119},
- {3376, 4125, 4126},
- {1880, 4130, 4130},
- {2048, 4140, 4141},
- {2724, 4149, 4149},
- {1767, 4156, 4156},
- {2601, 4164, 4164},
- {2757, 4168, 4168},
- {3974, 4172, 4172},
- {3914, 4178, 4178},
- {516, 4185, 4185},
- {1032, 4189, 4190},
- {3462, 4197, 4198},
- {3805, 4202, 4203},
- {3910, 4207, 4212},
- {3075, 4221, 4221},
- {3756, 4225, 4226},
- {1872, 4236, 4237},
- {3844, 4241, 4241},
- {3991, 4245, 4249},
- {2203, 4258, 4258},
- {3903, 4267, 4268},
- {705, 4272, 4272},
- {1896, 4276, 4276},
- {1955, 4285, 4288},
- {3746, 4302, 4303},
- {2672, 4311, 4311},
- {3969, 4317, 4317},
- {3883, 4322, 4322},
- {1920, 4339, 4340},
- {3527, 4344, 4346},
- {1160, 4358, 4358},
- {3648, 4364, 4366},
- {2711, 4387, 4387},
- {3619, 4391, 4392},
- {1944, 4396, 4396},
- {4369, 4400, 4400},
- {2736, 4404, 4407},
- {2546, 4411, 4412},
- {4390, 4422, 4422},
- {3610, 4426, 4427},
- {4058, 4431, 4431},
- {4374, 4435, 4435},
- {3463, 4445, 4446},
- {1813, 4452, 4452},
- {3669, 4456, 4456},
- {3830, 4460, 4460},
- {421, 4464, 4465},
- {1719, 4471, 4471},
- {3880, 4475, 4475},
- {1834, 4485, 4487},
- {3590, 4491, 4491},
- {442, 4496, 4497},
- {4435, 4501, 4501},
- {3814, 4509, 4509},
- {987, 4513, 4513},
- {4494, 4518, 4521},
- {3218, 4526, 4529},
- {4221, 4537, 4537},
- {2778, 4543, 4545},
- {4422, 4552, 4552},
- {4031, 4558, 4559},
- {4178, 4563, 4563},
- {3726, 4567, 4574},
- {4027, 4578, 4578},
- {4339, 4585, 4587},
- {3796, 4592, 4595},
- {543, 4600, 4613},
- {2855, 4620, 4621},
- {2795, 4627, 4627},
- {3440, 4631, 4632},
- {4279, 4636, 4639},
- {4245, 4643, 4645},
- {4516, 4649, 4650},
- {3133, 4654, 4654},
- {4042, 4658, 4659},
- {3422, 4663, 4663},
- {4046, 4667, 4668},
- {4267, 4672, 4672},
- {4004, 4676, 4677},
- {2490, 4682, 4682},
- {2451, 4697, 4697},
- {3027, 4705, 4705},
- {4028, 4717, 4717},
- {4460, 4721, 4721},
- {2471, 4725, 4727},
- {3090, 4735, 4735},
- {3192, 4739, 4740},
- {3835, 4760, 4760},
- {4540, 4764, 4764},
- {4007, 4772, 4774},
- {619, 4784, 4784},
- {3561, 4789, 4791},
- {3367, 4805, 4805},
- {4490, 4810, 4811},
- {2402, 4815, 4815},
- {3352, 4819, 4822},
- {2773, 4828, 4828},
- {4552, 4832, 4832},
- {2522, 4840, 4841},
- {316, 4847, 4852},
- {4715, 4858, 4858},
- {2959, 4862, 4862},
- {4858, 4868, 4869},
- {2134, 4873, 4873},
- {578, 4878, 4878},
- {4189, 4889, 4890},
- {2229, 4894, 4894},
- {4501, 4898, 4898},
- {2297, 4903, 4903},
- {2933, 4909, 4909},
- {3008, 4913, 4913},
- {3153, 4917, 4917},
- {4819, 4921, 4921},
- {4921, 4932, 4933},
- {4920, 4944, 4945},
- {4814, 4954, 4955},
- {576, 4966, 4966},
- {1854, 4970, 4971},
- {1374, 4975, 4976},
- {3307, 4980, 4980},
- {974, 4984, 4988},
- {4721, 4992, 4992},
- {4898, 4996, 4996},
- {4475, 5006, 5006},
- {3819, 5012, 5012},
- {1948, 5019, 5021},
- {4954, 5027, 5029},
- {3740, 5038, 5040},
- {4763, 5044, 5045},
- {1936, 5051, 5051},
- {4844, 5055, 5060},
- {4215, 5069, 5072},
- {1146, 5076, 5076},
- {3845, 5082, 5082},
- {4865, 5090, 5090},
- {4624, 5094, 5094},
- {4815, 5098, 5098},
- {5006, 5105, 5105},
- {4980, 5109, 5109},
- {4795, 5113, 5115},
- {5043, 5119, 5121},
- {4782, 5129, 5129},
- {3826, 5139, 5139},
- {3876, 5156, 5156},
- {3111, 5167, 5171},
- {1470, 5177, 5177},
- {4431, 5181, 5181},
- {546, 5189, 5189},
- {4225, 5193, 5193},
- {1672, 5199, 5201},
- {4207, 5205, 5209},
- {4220, 5216, 5217},
- {4658, 5224, 5225},
- {3295, 5235, 5235},
- {2436, 5239, 5239},
- {2349, 5246, 5246},
- {2175, 5250, 5250},
- {5180, 5257, 5258},
- {3161, 5263, 5263},
- {5105, 5272, 5272},
- {3552, 5282, 5282},
- {4944, 5299, 5300},
- {4130, 5312, 5313},
- {902, 5323, 5323},
- {913, 5327, 5327},
- {2987, 5333, 5334},
- {5150, 5344, 5344},
- {5249, 5348, 5348},
- {1965, 5358, 5359},
- {5330, 5364, 5364},
- {2012, 5373, 5377},
- {712, 5384, 5386},
- {5235, 5390, 5390},
- {5044, 5398, 5399},
- {564, 5406, 5406},
- {39, 5410, 5410},
- {4642, 5422, 5425},
- {4421, 5437, 5438},
- {2347, 5449, 5449},
- {5333, 5453, 5454},
- {4136, 5458, 5459},
- {3793, 5468, 5468},
- {2243, 5480, 5480},
- {4889, 5492, 5493},
- {4295, 5504, 5504},
- {2785, 5511, 5511},
- {2377, 5518, 5518},
- {3662, 5525, 5525},
- {5097, 5529, 5530},
- {4781, 5537, 5538},
- {4697, 5547, 5548},
- {436, 5552, 5553},
- {5542, 5558, 5558},
- {3692, 5562, 5562},
- {2696, 5568, 5569},
- {4620, 5578, 5578},
- {2898, 5590, 5590},
- {5557, 5596, 5618},
- {2797, 5623, 5625},
- {2792, 5629, 5629},
- {5243, 5633, 5633},
- {5348, 5637, 5637},
- {5547, 5643, 5643},
- {4296, 5654, 5655},
- {5568, 5662, 5662},
- {3001, 5670, 5671},
- {3794, 5679, 5679},
- {4006, 5685, 5686},
- {4969, 5690, 5692},
- {687, 5704, 5704},
- {4563, 5708, 5708},
- {1723, 5738, 5738},
- {649, 5742, 5742},
- {5163, 5748, 5755},
- {3907, 5759, 5759},
- {3074, 5764, 5764},
- {5326, 5771, 5771},
- {2951, 5776, 5776},
- {5181, 5780, 5780},
- {2614, 5785, 5788},
- {4709, 5794, 5794},
- {2784, 5799, 5799},
- {5518, 5803, 5803},
- {4155, 5812, 5815},
- {921, 5819, 5819},
- {5224, 5823, 5824},
- {2853, 5830, 5836},
- {5776, 5840, 5840},
- {2955, 5844, 5845},
- {5745, 5853, 5853},
- {3291, 5857, 5857},
- {2988, 5861, 5861},
- {2647, 5865, 5865},
- {5398, 5869, 5870},
- {1085, 5874, 5875},
- {4906, 5881, 5881},
- {802, 5886, 5886},
- {5119, 5890, 5893},
- {5802, 5899, 5900},
- {3415, 5904, 5904},
- {5629, 5908, 5908},
- {3714, 5912, 5914},
- {5558, 5921, 5921},
- {2710, 5927, 5928},
- {1094, 5932, 5934},
- {2653, 5940, 5941},
- {4735, 5954, 5954},
- {5861, 5958, 5958},
- {1040, 5971, 5971},
- {5514, 5977, 5977},
- {5048, 5981, 5982},
- {5953, 5992, 5993},
- {3751, 5997, 5997},
- {4991, 6001, 6002},
- {5885, 6006, 6007},
- {5529, 6011, 6012},
- {4974, 6019, 6020},
- {5857, 6024, 6024},
- {3483, 6032, 6032},
- {3594, 6036, 6036},
- {1997, 6040, 6040},
- {5997, 6044, 6047},
- {5197, 6051, 6051},
- {1764, 6055, 6055},
- {6050, 6059, 6059},
- {5239, 6063, 6063},
- {5049, 6067, 6067},
- {5957, 6073, 6074},
- {1022, 6078, 6078},
- {3414, 6083, 6084},
- {3809, 6090, 6090},
- {4562, 6095, 6096},
- {5878, 6104, 6104},
- {594, 6108, 6109},
- {3353, 6115, 6116},
- {4992, 6120, 6121},
- {2424, 6125, 6125},
- {4484, 6130, 6130},
- {3900, 6134, 6135},
- {5793, 6139, 6141},
- {3562, 6145, 6145},
- {1438, 6152, 6153},
- {6058, 6157, 6158},
- {4411, 6162, 6163},
- {4590, 6167, 6171},
- {4748, 6175, 6175},
- {5517, 6183, 6184},
- {6095, 6191, 6192},
- {1471, 6203, 6203},
- {2643, 6209, 6210},
- {450, 6220, 6220},
- {5266, 6226, 6226},
- {2576, 6233, 6233},
- {2607, 6239, 6240},
- {5164, 6244, 6251},
- {6054, 6255, 6255},
- {1789, 6260, 6261},
- {5250, 6265, 6265},
- {6062, 6273, 6278},
- {5990, 6282, 6282},
- {3283, 6286, 6286},
- {5436, 6290, 6290},
- {6059, 6294, 6294},
- {5668, 6298, 6300},
- {3072, 6324, 6329},
- {3132, 6338, 6339},
- {3246, 6343, 6344},
- {28, 6348, 6349},
- {1503, 6353, 6355},
- {6067, 6359, 6359},
- {3384, 6364, 6364},
- {545, 6375, 6376},
- {5803, 6380, 6380},
- {5522, 6384, 6385},
- {5908, 6389, 6389},
- {2796, 6393, 6396},
- {4831, 6403, 6404},
- {6388, 6412, 6412},
- {6005, 6417, 6420},
- {4450, 6430, 6430},
- {4050, 6435, 6435},
- {5372, 6441, 6441},
- {4378, 6447, 6447},
- {6199, 6452, 6452},
- {3026, 6456, 6456},
- {2642, 6460, 6462},
- {6392, 6470, 6470},
- {6459, 6474, 6474},
- {2829, 6487, 6488},
- {2942, 6499, 6504},
- {5069, 6508, 6511},
- {5341, 6515, 6516},
- {5853, 6521, 6525},
- {6104, 6531, 6531},
- {5759, 6535, 6538},
- {4672, 6542, 6543},
- {2443, 6550, 6550},
- {5109, 6554, 6554},
- {6494, 6558, 6560},
- {6006, 6570, 6572},
- {6424, 6576, 6580},
- {4693, 6591, 6592},
- {6439, 6596, 6597},
- {3179, 6601, 6601},
- {5299, 6606, 6607},
- {4148, 6612, 6613},
- {3774, 6617, 6617},
- {3537, 6623, 6624},
- {4975, 6628, 6629},
- {3848, 6636, 6636},
- {856, 6640, 6640},
- {5724, 6645, 6645},
- {6632, 6651, 6651},
- {4630, 6656, 6658},
- {1440, 6662, 6662},
- {4281, 6666, 6667},
- {4302, 6671, 6672},
- {2589, 6676, 6677},
- {5647, 6681, 6687},
- {6082, 6691, 6693},
- {6144, 6698, 6698},
- {6103, 6709, 6710},
- {3710, 6714, 6714},
- {4253, 6718, 6721},
- {2467, 6730, 6730},
- {4778, 6734, 6734},
- {6528, 6738, 6738},
- {4358, 6747, 6747},
- {5889, 6753, 6753},
- {5193, 6757, 6757},
- {5797, 6761, 6761},
- {3858, 6765, 6766},
- {5951, 6776, 6776},
- {6487, 6781, 6782},
- {3282, 6786, 6787},
- {4667, 6797, 6799},
- {1927, 6803, 6806},
- {6583, 6810, 6810},
- {4937, 6814, 6814},
- {6099, 6824, 6824},
- {4415, 6835, 6836},
- {6332, 6840, 6841},
- {5160, 6850, 6850},
- {4764, 6854, 6854},
- {6814, 6858, 6859},
- {3018, 6864, 6864},
- {6293, 6868, 6869},
- {6359, 6877, 6877},
- {3047, 6884, 6886},
- {5262, 6890, 6891},
- {5471, 6900, 6900},
- {3268, 6910, 6912},
- {1047, 6916, 6916},
- {5904, 6923, 6923},
- {5798, 6933, 6938},
- {4149, 6942, 6942},
- {1821, 6946, 6946},
- {3599, 6952, 6952},
- {6470, 6957, 6957},
- {5562, 6961, 6961},
- {6268, 6965, 6967},
- {6389, 6971, 6971},
- {6596, 6975, 6976},
- {6553, 6980, 6981},
- {6576, 6985, 6989},
- {1375, 6993, 6993},
- {652, 6998, 6998},
- {4876, 7002, 7003},
- {5768, 7011, 7013},
- {3973, 7017, 7017},
- {6802, 7025, 7025},
- {6955, 7034, 7036},
- {6974, 7040, 7040},
- {5944, 7044, 7044},
- {6992, 7048, 7054},
- {6872, 7059, 7059},
- {2943, 7063, 7063},
- {6923, 7067, 7067},
- {5094, 7071, 7071},
- {4873, 7075, 7075},
- {5819, 7079, 7079},
- {5945, 7085, 7085},
- {1540, 7090, 7091},
- {2090, 7095, 7095},
- {5024, 7104, 7105},
- {6900, 7109, 7109},
- {6024, 7113, 7114},
- {6000, 7118, 7120},
- {2187, 7124, 7125},
- {6760, 7129, 7130},
- {5898, 7134, 7136},
- {7032, 7144, 7144},
- {4271, 7148, 7148},
- {3706, 7152, 7152},
- {6970, 7156, 7157},
- {7088, 7161, 7163},
- {2718, 7168, 7169},
- {5674, 7175, 7175},
- {4631, 7182, 7182},
- {7070, 7188, 7189},
- {6220, 7196, 7196},
- {3458, 7201, 7202},
- {2041, 7211, 7212},
- {1454, 7216, 7216},
- {5199, 7225, 7227},
- {3529, 7234, 7234},
- {6890, 7238, 7238},
- {3815, 7242, 7243},
- {5490, 7250, 7253},
- {6554, 7257, 7263},
- {5890, 7267, 7269},
- {6877, 7273, 7273},
- {4877, 7277, 7277},
- {2502, 7285, 7285},
- {1483, 7289, 7295},
- {7210, 7304, 7308},
- {6845, 7313, 7316},
- {7219, 7320, 7320},
- {7001, 7325, 7329},
- {6853, 7333, 7334},
- {6120, 7338, 7338},
- {6606, 7342, 7343},
- {7020, 7348, 7350},
- {3509, 7354, 7354},
- {7133, 7359, 7363},
- {3434, 7371, 7374},
- {2787, 7384, 7384},
- {7044, 7388, 7388},
- {6960, 7394, 7395},
- {6676, 7399, 7400},
- {7161, 7404, 7404},
- {7285, 7417, 7418},
- {4558, 7425, 7426},
- {4828, 7430, 7430},
- {6063, 7436, 7436},
- {3597, 7442, 7442},
- {914, 7446, 7446},
- {7320, 7452, 7454},
- {7267, 7458, 7460},
- {5076, 7464, 7464},
- {7430, 7468, 7469},
- {6273, 7473, 7474},
- {7440, 7478, 7487},
- {7348, 7491, 7494},
- {1021, 7510, 7510},
- {7473, 7515, 7515},
- {2823, 7519, 7519},
- {6264, 7527, 7527},
- {7302, 7531, 7531},
- {7089, 7535, 7535},
- {7342, 7540, 7541},
- {3688, 7547, 7551},
- {3054, 7558, 7560},
- {4177, 7566, 7567},
- {6691, 7574, 7575},
- {7156, 7585, 7586},
- {7147, 7590, 7592},
- {7407, 7598, 7598},
- {7403, 7602, 7603},
- {6868, 7607, 7607},
- {6636, 7611, 7611},
- {4805, 7617, 7617},
- {5779, 7623, 7623},
- {7063, 7627, 7627},
- {5079, 7632, 7632},
- {7377, 7637, 7637},
- {7337, 7641, 7642},
- {6738, 7655, 7655},
- {7338, 7659, 7659},
- {6541, 7669, 7671},
- {595, 7675, 7675},
- {7658, 7679, 7680},
- {7647, 7685, 7686},
- {2477, 7690, 7690},
- {5823, 7694, 7694},
- {4156, 7699, 7699},
- {5931, 7703, 7706},
- {6854, 7712, 7712},
- {4931, 7718, 7718},
- {6979, 7722, 7722},
- {5085, 7727, 7727},
- {6965, 7732, 7732},
- {7201, 7736, 7737},
- {3639, 7741, 7743},
- {7534, 7749, 7749},
- {4292, 7753, 7753},
- {3427, 7759, 7763},
- {7273, 7767, 7767},
- {940, 7778, 7778},
- {4838, 7782, 7785},
- {4216, 7790, 7792},
- {922, 7800, 7801},
- {7256, 7810, 7811},
- {7789, 7815, 7819},
- {7225, 7823, 7825},
- {7531, 7829, 7829},
- {6997, 7833, 7833},
- {7757, 7837, 7838},
- {4129, 7842, 7842},
- {7333, 7848, 7849},
- {6776, 7855, 7855},
- {7527, 7859, 7859},
- {4370, 7863, 7863},
- {4512, 7868, 7868},
- {5679, 7880, 7880},
- {3162, 7884, 7885},
- {3933, 7892, 7894},
- {7804, 7899, 7902},
- {6363, 7906, 7907},
- {7848, 7911, 7912},
- {5584, 7917, 7921},
- {874, 7926, 7926},
- {3342, 7930, 7930},
- {4507, 7935, 7937},
- {3672, 7943, 7944},
- {7911, 7948, 7949},
- {6402, 7956, 7956},
- {7940, 7960, 7960},
- {7113, 7964, 7964},
- {1073, 7968, 7968},
- {7740, 7974, 7974},
- {7601, 7978, 7982},
- {6797, 7987, 7988},
- {3528, 7994, 7995},
- {5483, 7999, 7999},
- {5717, 8011, 8011},
- {5480, 8017, 8017},
- {7770, 8023, 8030},
- {2452, 8034, 8034},
- {5282, 8047, 8047},
- {7967, 8051, 8051},
- {1128, 8058, 8066},
- {6348, 8070, 8070},
- {8055, 8077, 8077},
- {7925, 8081, 8086},
- {6810, 8090, 8090},
- {5051, 8101, 8101},
- {4696, 8109, 8110},
- {5129, 8119, 8119},
- {4449, 8123, 8123},
- {7222, 8127, 8127},
- {4649, 8131, 8134},
- {7994, 8138, 8138},
- {5954, 8148, 8148},
- {475, 8152, 8153},
- {7906, 8157, 8157},
- {7458, 8164, 8166},
- {7632, 8171, 8173},
- {3874, 8177, 8183},
- {4391, 8187, 8187},
- {561, 8191, 8191},
- {2417, 8195, 8195},
- {2357, 8204, 8204},
- {2269, 8216, 8218},
- {3968, 8222, 8222},
- {2200, 8226, 8227},
- {3453, 8247, 8247},
- {2439, 8251, 8252},
- {7175, 8257, 8257},
- {976, 8262, 8264},
- {4953, 8273, 8273},
- {4219, 8278, 8278},
- {6, 8285, 8291},
- {5703, 8295, 8296},
- {5272, 8300, 8300},
- {8037, 8304, 8304},
- {8186, 8314, 8314},
- {8304, 8318, 8318},
- {8051, 8326, 8326},
- {8318, 8330, 8330},
- {2671, 8334, 8335},
- {2662, 8339, 8339},
- {8081, 8349, 8350},
- {3328, 8356, 8356},
- {2879, 8360, 8362},
- {8050, 8370, 8371},
- {8330, 8375, 8376},
- {8375, 8386, 8386},
- {4961, 8390, 8390},
- {1017, 8403, 8405},
- {3533, 8416, 8416},
- {4555, 8422, 8422},
- {6445, 8426, 8426},
- {8169, 8432, 8432},
- {990, 8436, 8436},
- {4102, 8440, 8440},
- {7398, 8444, 8446},
- {3480, 8450, 8450},
- {6324, 8462, 8462},
- {7948, 8466, 8467},
- {5950, 8471, 8471},
- {5189, 8476, 8476},
- {4026, 8490, 8490},
- {8374, 8494, 8495},
- {4682, 8501, 8501},
- {7387, 8506, 8506},
- {8164, 8510, 8515},
- {4079, 8524, 8524},
- {8360, 8529, 8531},
- {7446, 8540, 8543},
- {7971, 8547, 8548},
- {4311, 8552, 8552},
- {5204, 8556, 8557},
- {7968, 8562, 8562},
- {7847, 8571, 8573},
- {8547, 8577, 8577},
- {5320, 8581, 8581},
- {8556, 8585, 8586},
- {8504, 8590, 8590},
- {7669, 8602, 8604},
- {5874, 8608, 8609},
- {5828, 8613, 8613},
- {7998, 8617, 8617},
- {8519, 8625, 8625},
- {7250, 8637, 8637},
- {426, 8641, 8641},
- {8436, 8645, 8645},
- {5986, 8649, 8656},
- {8157, 8660, 8660},
- {7182, 8665, 8665},
- {8421, 8675, 8675},
- {8509, 8681, 8681},
- {5137, 8688, 8689},
- {8625, 8694, 8695},
- {5228, 8701, 8702},
- {6661, 8714, 8714},
- {1010, 8719, 8719},
- {6648, 8723, 8723},
- {3500, 8728, 8728},
- {2442, 8735, 8735},
- {8494, 8740, 8741},
- {8171, 8753, 8755},
- {7242, 8763, 8764},
- {4739, 8768, 8769},
- {7079, 8773, 8773},
- {8386, 8777, 8777},
- {8624, 8781, 8787},
- {661, 8791, 8794},
- {8631, 8801, 8801},
- {7753, 8805, 8805},
- {4783, 8809, 8810},
- {1673, 8814, 8815},
- {6623, 8819, 8819},
- {4404, 8823, 8823},
- {8089, 8827, 8828},
- {8773, 8832, 8832},
- {5394, 8836, 8836},
- {6231, 8841, 8843},
- {1015, 8852, 8853},
- {6873, 8857, 8857},
- {6289, 8865, 8865},
- {8577, 8869, 8869},
- {8114, 8873, 8875},
- {8534, 8883, 8883},
- {3007, 8887, 8888},
- {8827, 8892, 8893},
- {4788, 8897, 8900},
- {5698, 8906, 8907},
- {7690, 8911, 8911},
- {6643, 8919, 8919},
- {7206, 8923, 8924},
- {7866, 8929, 8931},
- {8880, 8942, 8942},
- {8630, 8951, 8952},
- {6027, 8958, 8958},
- {7749, 8966, 8967},
- {4932, 8972, 8973},
- {8892, 8980, 8981},
- {634, 9003, 9003},
- {8109, 9007, 9008},
- {8777, 9012, 9012},
- {3981, 9016, 9017},
- {5723, 9025, 9025},
- {7662, 9034, 9038},
- {8955, 9042, 9042},
- {8070, 9060, 9062},
- {8910, 9066, 9066},
- {5363, 9070, 9071},
- {7699, 9075, 9076},
- {8991, 9081, 9081},
- {6850, 9085, 9085},
- {5811, 9092, 9094},
- {9079, 9098, 9102},
- {6456, 9106, 9106},
- {2259, 9111, 9111},
- {4752, 9116, 9116},
- {9060, 9120, 9123},
- {8090, 9127, 9127},
- {5305, 9131, 9132},
- {8623, 9137, 9137},
- {7417, 9141, 9141},
- {6564, 9148, 9149},
- {9126, 9157, 9158},
- {4285, 9169, 9170},
- {8698, 9174, 9174},
- {8869, 9178, 9178},
- {2572, 9182, 9183},
- {6482, 9188, 9190},
- {9181, 9201, 9201},
- {2968, 9208, 9209},
- {2506, 9213, 9215},
- {9127, 9219, 9219},
- {7910, 9225, 9227},
- {5422, 9235, 9239},
- {8813, 9244, 9246},
- {9178, 9250, 9250},
- {8748, 9255, 9255},
- {7354, 9265, 9265},
- {7767, 9269, 9269},
- {7710, 9281, 9283},
- {8826, 9288, 9290},
- {861, 9295, 9295},
- {4482, 9301, 9301},
- {9264, 9305, 9306},
- {8805, 9310, 9310},
- {4995, 9314, 9314},
- {6730, 9318, 9318},
- {7457, 9328, 9328},
- {2547, 9335, 9336},
- {6298, 9340, 9343},
- {9305, 9353, 9354},
- {9269, 9358, 9358},
- {6338, 9370, 9370},
- {7289, 9376, 9379},
- {5780, 9383, 9383},
- {7607, 9387, 9387},
- {2065, 9392, 9392},
- {7238, 9396, 9396},
- {8856, 9400, 9400},
- {8069, 9412, 9413},
- {611, 9420, 9420},
- {7071, 9424, 9424},
- {3089, 9430, 9431},
- {7117, 9435, 9438},
- {1976, 9445, 9445},
- {6640, 9449, 9449},
- {5488, 9453, 9453},
- {8739, 9457, 9459},
- {5958, 9466, 9466},
- {7985, 9470, 9470},
- {8735, 9475, 9475},
- {5009, 9479, 9479},
- {8073, 9483, 9484},
- {2328, 9490, 9491},
- {9250, 9495, 9495},
- {4043, 9502, 9502},
- {7712, 9506, 9506},
- {9012, 9510, 9510},
- {9028, 9514, 9515},
- {2190, 9521, 9524},
- {9029, 9528, 9528},
- {9519, 9532, 9532},
- {9495, 9536, 9536},
- {8527, 9540, 9540},
- {2137, 9550, 9550},
- {8419, 9557, 9557},
- {9383, 9561, 9562},
- {8970, 9575, 9578},
- {8911, 9582, 9582},
- {7828, 9595, 9596},
- {6180, 9600, 9600},
- {8738, 9604, 9607},
- {7540, 9611, 9612},
- {9599, 9616, 9618},
- {9187, 9623, 9623},
- {9294, 9628, 9629},
- {4536, 9639, 9639},
- {3867, 9643, 9643},
- {6305, 9648, 9648},
- {1617, 9654, 9657},
- {5762, 9666, 9666},
- {8314, 9670, 9670},
- {9666, 9674, 9675},
- {9506, 9679, 9679},
- {9669, 9685, 9686},
- {9683, 9690, 9690},
- {8763, 9697, 9698},
- {7468, 9702, 9702},
- {460, 9707, 9707},
- {3115, 9712, 9712},
- {9424, 9716, 9717},
- {7359, 9721, 9724},
- {7547, 9728, 9729},
- {7151, 9733, 9738},
- {7627, 9742, 9742},
- {2822, 9747, 9747},
- {8247, 9751, 9753},
- {9550, 9758, 9758},
- {7585, 9762, 9763},
- {1002, 9767, 9767},
- {7168, 9772, 9773},
- {6941, 9777, 9780},
- {9728, 9784, 9786},
- {9770, 9792, 9796},
- {6411, 9801, 9802},
- {3689, 9806, 9808},
- {9575, 9814, 9816},
- {7025, 9820, 9821},
- {2776, 9826, 9826},
- {9806, 9830, 9830},
- {9820, 9834, 9835},
- {9800, 9839, 9847},
- {9834, 9851, 9852},
- {9829, 9856, 9862},
- {1400, 9866, 9866},
- {3197, 9870, 9871},
- {9851, 9875, 9876},
- {9742, 9883, 9884},
- {3362, 9888, 9889},
- {9883, 9893, 9893},
- {5711, 9899, 9910},
- {7806, 9915, 9915},
- {9120, 9919, 9919},
- {9715, 9925, 9934},
- {2580, 9938, 9938},
- {4907, 9942, 9944},
- {6239, 9953, 9954},
- {6961, 9963, 9963},
- {5295, 9967, 9968},
- {1915, 9972, 9973},
- {3426, 9983, 9985},
- {9875, 9994, 9995},
- {6942, 9999, 9999},
- {6621, 10005, 10005},
- {7589, 10010, 10012},
- {9286, 10020, 10020},
- {838, 10024, 10024},
- {9980, 10028, 10031},
- {9994, 10035, 10041},
- {2702, 10048, 10051},
- {2621, 10059, 10059},
- {10054, 10065, 10065},
- {8612, 10073, 10074},
- {7033, 10078, 10078},
- {916, 10082, 10082},
- {10035, 10086, 10087},
- {8613, 10097, 10097},
- {9919, 10107, 10108},
- {6133, 10114, 10115},
- {10059, 10119, 10119},
- {10065, 10126, 10127},
- {7732, 10131, 10131},
- {7155, 10135, 10136},
- {6728, 10140, 10140},
- {6162, 10144, 10145},
- {4724, 10150, 10150},
- {1665, 10154, 10154},
- {10126, 10163, 10163},
- {9783, 10168, 10168},
- {1715, 10172, 10173},
- {7152, 10177, 10182},
- {8760, 10187, 10187},
- {7829, 10191, 10191},
- {9679, 10196, 10196},
- {9369, 10201, 10201},
- {2928, 10206, 10208},
- {6951, 10214, 10217},
- {5633, 10221, 10221},
- {7199, 10225, 10225},
- {10118, 10230, 10231},
- {9999, 10235, 10236},
- {10045, 10240, 10249},
- {5565, 10256, 10256},
- {9866, 10261, 10261},
- {10163, 10268, 10268},
- {9869, 10272, 10272},
- {9789, 10276, 10283},
- {10235, 10287, 10288},
- {10214, 10298, 10299},
- {6971, 10303, 10303},
- {3346, 10307, 10307},
- {10185, 10311, 10312},
- {9993, 10318, 10320},
- {2779, 10332, 10334},
- {1726, 10338, 10338},
- {741, 10354, 10360},
- {10230, 10372, 10373},
- {10260, 10384, 10385},
- {10131, 10389, 10398},
- {6946, 10406, 10409},
- {10158, 10413, 10420},
- {10123, 10424, 10424},
- {6157, 10428, 10429},
- {4518, 10434, 10434},
- {9893, 10438, 10438},
- {9865, 10442, 10446},
- {7558, 10454, 10454},
- {10434, 10460, 10460},
- {10064, 10466, 10468},
- {2703, 10472, 10474},
- {9751, 10478, 10479},
- {6714, 10485, 10485},
- {8020, 10490, 10490},
- {10303, 10494, 10494},
- {3521, 10499, 10500},
- {9281, 10513, 10515},
- {6028, 10519, 10523},
- {9387, 10527, 10527},
- {7614, 10531, 10531},
- {3611, 10536, 10536},
- {9162, 10540, 10540},
- {10081, 10546, 10547},
- {10034, 10560, 10562},
- {6726, 10567, 10571},
- {8237, 10575, 10575},
- {10438, 10579, 10583},
- {10140, 10587, 10587},
- {5784, 10592, 10592},
- {9819, 10597, 10600},
- {10567, 10604, 10608},
- {9335, 10613, 10613},
- {8300, 10617, 10617},
- {10575, 10621, 10621},
- {9678, 10625, 10626},
- {9962, 10632, 10633},
- {10535, 10637, 10638},
- {8199, 10642, 10642},
- {10372, 10647, 10648},
- {10637, 10656, 10657},
- {10579, 10667, 10668},
- {10465, 10677, 10680},
- {6702, 10684, 10685},
- {10073, 10691, 10692},
- {4505, 10696, 10697},
- {9042, 10701, 10701},
- {6460, 10705, 10706},
- {10010, 10714, 10716},
- {10656, 10720, 10722},
- {7282, 10727, 10729},
- {2327, 10733, 10733},
- {2491, 10740, 10741},
- {10704, 10748, 10750},
- {6465, 10754, 10754},
- {10647, 10758, 10759},
- {10424, 10763, 10763},
- {10748, 10776, 10776},
- {10546, 10780, 10781},
- {10758, 10785, 10786},
- {10287, 10790, 10797},
- {10785, 10801, 10807},
- {10240, 10811, 10826},
- {9509, 10830, 10830},
- {2579, 10836, 10838},
- {9801, 10843, 10845},
- {7555, 10849, 10850},
- {10776, 10860, 10865},
- {8023, 10869, 10869},
- {10046, 10876, 10884},
- {10253, 10888, 10892},
- {9941, 10897, 10897},
- {7898, 10901, 10905},
- {6725, 10909, 10913},
- {10757, 10921, 10923},
- {10160, 10931, 10931},
- {10916, 10935, 10942},
- {10261, 10946, 10946},
- {10318, 10952, 10954},
- {5911, 10959, 10961},
- {10801, 10965, 10966},
- {10946, 10970, 10977},
- {10592, 10982, 10984},
- {9913, 10988, 10990},
- {8510, 10994, 10996},
- {9419, 11000, 11001},
- {6765, 11006, 11007},
- {10725, 11011, 11011},
- {5537, 11017, 11019},
- {9208, 11024, 11025},
- {5850, 11030, 11030},
- {9610, 11034, 11036},
- {8846, 11041, 11047},
- {9697, 11051, 11051},
- {1622, 11055, 11058},
- {2370, 11062, 11062},
- {8393, 11067, 11067},
- {9756, 11071, 11071},
- {10172, 11076, 11076},
- {27, 11081, 11081},
- {7357, 11087, 11092},
- {8151, 11104, 11106},
- {6115, 11110, 11110},
- {10667, 11114, 11115},
- {11099, 11121, 11123},
- {10705, 11127, 11127},
- {8938, 11131, 11131},
- {11114, 11135, 11136},
- {1390, 11140, 11141},
- {10964, 11146, 11148},
- {11140, 11152, 11155},
- {9813, 11159, 11166},
- {624, 11171, 11172},
- {3118, 11177, 11179},
- {11029, 11184, 11186},
- {10186, 11190, 11190},
- {10306, 11196, 11196},
- {8665, 11201, 11201},
- {7382, 11205, 11205},
- {1100, 11210, 11210},
- {2337, 11216, 11217},
- {1609, 11221, 11223},
- {5763, 11228, 11229},
- {5220, 11233, 11233},
- {11061, 11241, 11241},
- {10617, 11246, 11246},
- {11190, 11250, 11251},
- {10144, 11255, 11256},
- {11232, 11260, 11260},
- {857, 11264, 11265},
- {10994, 11269, 11271},
- {3879, 11280, 11281},
- {11184, 11287, 11289},
- {9611, 11293, 11295},
- {11250, 11299, 11299},
- {4495, 11304, 11304},
- {7574, 11308, 11309},
- {9814, 11315, 11317},
- {1713, 11321, 11324},
- {1905, 11328, 11328},
- {8745, 11335, 11340},
- {8883, 11351, 11351},
- {8119, 11358, 11358},
- {1842, 11363, 11364},
- {11237, 11368, 11368},
- {8814, 11373, 11374},
- {5684, 11378, 11378},
- {11011, 11382, 11382},
- {6520, 11389, 11389},
- {11183, 11393, 11396},
- {1790, 11404, 11404},
- {9536, 11408, 11408},
- {11298, 11418, 11419},
- {3929, 11425, 11425},
- {5588, 11429, 11429},
- {8476, 11436, 11436},
- {4096, 11440, 11442},
- {11084, 11446, 11454},
- {10603, 11458, 11463},
- {7332, 11472, 11474},
- {7611, 11483, 11486},
- {4836, 11490, 11491},
- {10024, 11495, 11495},
- {4917, 11501, 11506},
- {6486, 11510, 11512},
- {11269, 11516, 11518},
- {3603, 11522, 11525},
- {11126, 11535, 11535},
- {11418, 11539, 11541},
- {11408, 11545, 11545},
- {9021, 11549, 11552},
- {6745, 11557, 11557},
- {5118, 11561, 11564},
- {7590, 11568, 11569},
- {4426, 11573, 11578},
- {9790, 11582, 11583},
- {6447, 11587, 11587},
- {10229, 11591, 11594},
- {10457, 11598, 11598},
- {10168, 11604, 11604},
- {10543, 11608, 11608},
- {7404, 11612, 11612},
- {11127, 11616, 11616},
- {3337, 11620, 11620},
- {11501, 11624, 11628},
- {4543, 11633, 11635},
- {8449, 11642, 11642},
- {4943, 11646, 11648},
- {10526, 11652, 11654},
- {11620, 11659, 11659},
- {8927, 11664, 11669},
- {532, 11673, 11673},
- {10513, 11677, 11679},
- {10428, 11683, 11683},
- {10999, 11689, 11690},
- {9469, 11695, 11695},
- {3606, 11699, 11699},
- {9560, 11708, 11709},
- {1564, 11714, 11714},
- {10527, 11718, 11718},
- {3071, 11723, 11726},
- {11590, 11731, 11732},
- {6605, 11737, 11737},
- {11624, 11741, 11745},
- {7822, 11749, 11752},
- {5269, 11757, 11758},
- {1339, 11767, 11767},
- {1363, 11771, 11773},
- {3704, 11777, 11777},
- {10952, 11781, 11783},
- {6764, 11793, 11795},
- {8675, 11800, 11800},
- {9963, 11804, 11804},
- {11573, 11808, 11809},
- {9548, 11813, 11813},
- {11591, 11817, 11818},
- {11446, 11822, 11822},
- {9224, 11828, 11828},
- {3158, 11836, 11836},
- {10830, 11840, 11840},
- {7234, 11846, 11846},
- {11299, 11850, 11850},
- {11544, 11854, 11855},
- {11498, 11859, 11859},
- {10993, 11865, 11868},
- {9720, 11872, 11878},
- {10489, 11882, 11890},
- {11712, 11898, 11904},
- {11516, 11908, 11910},
- {11568, 11914, 11915},
- {10177, 11919, 11924},
- {11363, 11928, 11929},
- {10494, 11933, 11933},
- {9870, 11937, 11938},
- {9427, 11942, 11942},
- {11481, 11949, 11949},
- {6030, 11955, 11957},
- {11718, 11961, 11961},
- {10531, 11965, 11983},
- {5126, 11987, 11987},
- {7515, 11991, 11991},
- {10646, 11996, 11997},
- {2947, 12001, 12001},
- {9582, 12009, 12010},
- {6202, 12017, 12018},
- {11714, 12022, 12022},
- {9235, 12033, 12037},
- {9721, 12041, 12044},
- {11932, 12051, 12052},
- {12040, 12056, 12056},
- {12051, 12060, 12060},
- {11601, 12066, 12066},
- {8426, 12070, 12070},
- {4053, 12077, 12077},
- {4262, 12081, 12081},
- {9761, 12086, 12088},
- {11582, 12092, 12093},
- {10965, 12097, 12098},
- {11803, 12103, 12104},
- {11933, 12108, 12109},
- {10688, 12117, 12117},
- {12107, 12125, 12126},
- {6774, 12130, 12132},
- {6286, 12137, 12137},
- {9543, 12141, 12141},
- {12097, 12145, 12146},
- {10790, 12150, 12150},
- {10125, 12154, 12156},
- {12125, 12164, 12164},
- {12064, 12168, 12172},
- {10811, 12178, 12188},
- {12092, 12192, 12193},
- {10058, 12197, 12198},
- {11611, 12211, 12212},
- {3459, 12216, 12216},
- {10291, 12225, 12228},
- {12191, 12232, 12234},
- {12145, 12238, 12238},
- {12001, 12242, 12250},
- {3840, 12255, 12255},
- {12216, 12259, 12259},
- {674, 12272, 12272},
- {12141, 12276, 12276},
- {10766, 12280, 12280},
- {11545, 12284, 12284},
- {6496, 12290, 12290},
- {11381, 12294, 12295},
- {603, 12302, 12303},
- {12276, 12308, 12308},
- {11850, 12313, 12314},
- {565, 12319, 12319},
- {9351, 12324, 12324},
- {11822, 12328, 12328},
- {2691, 12333, 12334},
- {11840, 12338, 12338},
- {11070, 12343, 12343},
- {9510, 12347, 12347},
- {11024, 12352, 12353},
- {7173, 12359, 12359},
- {517, 12363, 12363},
- {6311, 12367, 12368},
- {11367, 12372, 12373},
- {12008, 12377, 12377},
- {11372, 12382, 12384},
- {11358, 12391, 12392},
- {11382, 12396, 12396},
- {6882, 12400, 12401},
- {11246, 12405, 12405},
- {8359, 12409, 12412},
- {10154, 12418, 12418},
- {12016, 12425, 12426},
- {8972, 12434, 12435},
- {10478, 12439, 12440},
- {12395, 12449, 12449},
- {11612, 12454, 12454},
- {12347, 12458, 12458},
- {10700, 12466, 12467},
- {3637, 12471, 12476},
- {1042, 12480, 12481},
- {6747, 12488, 12488},
- {12396, 12492, 12493},
- {9420, 12497, 12497},
- {11285, 12501, 12510},
- {4470, 12515, 12515},
- {9374, 12519, 12519},
- {11293, 12528, 12528},
- {2058, 12534, 12535},
- {6521, 12539, 12539},
- {12492, 12543, 12543},
- {3043, 12547, 12547},
- {2982, 12551, 12553},
- {11030, 12557, 12563},
- {7636, 12568, 12568},
- {9639, 12572, 12572},
- {12543, 12576, 12576},
- {5989, 12580, 12583},
- {11051, 12587, 12587},
- {1061, 12592, 12594},
- {12313, 12599, 12601},
- {11846, 12605, 12605},
- {12576, 12609, 12609},
- {11040, 12618, 12625},
- {12479, 12629, 12629},
- {6903, 12633, 12633},
- {12322, 12639, 12639},
- {12253, 12643, 12645},
- {5594, 12651, 12651},
- {12522, 12655, 12655},
- {11703, 12659, 12659},
- {1377, 12665, 12665},
- {8022, 12669, 12669},
- {12280, 12674, 12674},
- {9023, 12680, 12681},
- {12328, 12685, 12685},
- {3085, 12689, 12693},
- {4700, 12698, 12698},
- {10224, 12702, 12702},
- {8781, 12706, 12706},
- {1651, 12710, 12710},
- {12458, 12714, 12714},
- {12005, 12718, 12721},
- {11908, 12725, 12726},
- {8202, 12733, 12733},
- {11708, 12739, 12740},
- {12599, 12744, 12745},
- {12284, 12749, 12749},
- {5285, 12756, 12756},
- {12055, 12775, 12777},
- {6919, 12782, 12782},
- {12242, 12786, 12786},
- {12009, 12790, 12790},
- {9628, 12794, 12796},
- {11354, 12801, 12802},
- {10225, 12806, 12807},
- {579, 12813, 12813},
- {8935, 12817, 12822},
- {8753, 12827, 12829},
- {11006, 12835, 12835},
- {858, 12841, 12845},
- {476, 12849, 12849},
- {7667, 12854, 12854},
- {12760, 12860, 12871},
- {11677, 12875, 12877},
- {12714, 12881, 12881},
- {12731, 12885, 12890},
- {7108, 12894, 12896},
- {1165, 12900, 12900},
- {4021, 12906, 12906},
- {10829, 12910, 12911},
- {12331, 12915, 12915},
- {8887, 12919, 12921},
- {11639, 12925, 12925},
- {7964, 12929, 12929},
- {12528, 12937, 12937},
- {8148, 12941, 12941},
- {12770, 12948, 12950},
- {12609, 12954, 12954},
- {12685, 12958, 12958},
- {2803, 12962, 12962},
- {9561, 12966, 12966},
- {6671, 12972, 12973},
- {12056, 12977, 12977},
- {6380, 12981, 12981},
- {12048, 12985, 12985},
- {11961, 12989, 12993},
- {3368, 12997, 12999},
- {6634, 13004, 13004},
- {6775, 13009, 13010},
- {12136, 13014, 13019},
- {10341, 13023, 13023},
- {13002, 13027, 13027},
- {10587, 13031, 13031},
- {10307, 13035, 13035},
- {12736, 13039, 13039},
- {12744, 13043, 13044},
- {6175, 13048, 13048},
- {9702, 13053, 13054},
- {662, 13059, 13061},
- {12718, 13065, 13068},
- {12893, 13072, 13075},
- {8299, 13086, 13091},
- {12604, 13095, 13096},
- {12848, 13100, 13101},
- {12749, 13105, 13105},
- {12526, 13109, 13114},
- {9173, 13122, 13122},
- {12769, 13128, 13128},
- {13038, 13132, 13132},
- {12725, 13136, 13137},
- {12639, 13146, 13146},
- {9711, 13150, 13151},
- {12137, 13155, 13155},
- {13039, 13159, 13159},
- {4681, 13163, 13164},
- {12954, 13168, 13168},
- {13158, 13175, 13176},
- {13105, 13180, 13180},
- {10754, 13184, 13184},
- {13167, 13188, 13188},
- {12658, 13192, 13192},
- {4294, 13199, 13200},
- {11682, 13204, 13205},
- {11695, 13209, 13209},
- {11076, 13214, 13214},
- {12232, 13218, 13218},
- {9399, 13223, 13224},
- {12880, 13228, 13229},
- {13048, 13234, 13234},
- {9701, 13238, 13239},
- {13209, 13243, 13243},
- {3658, 13248, 13248},
- {3698, 13252, 13254},
- {12237, 13260, 13260},
- {8872, 13266, 13266},
- {12957, 13272, 13273},
- {1393, 13281, 13281},
- {2013, 13285, 13288},
- {4244, 13296, 13299},
- {9428, 13303, 13303},
- {12702, 13307, 13307},
- {13078, 13311, 13311},
- {6071, 13315, 13315},
- {3061, 13319, 13319},
- {2051, 13324, 13324},
- {11560, 13328, 13331},
- {6584, 13336, 13336},
- {8482, 13340, 13340},
- {5331, 13344, 13344},
- {4171, 13348, 13348},
- {8501, 13352, 13352},
- {9219, 13356, 13356},
- {9473, 13360, 13363},
- {12881, 13367, 13367},
- {13065, 13371, 13375},
- {2979, 13379, 13384},
- {1518, 13388, 13388},
- {11177, 13392, 13392},
- {9457, 13398, 13398},
- {12293, 13407, 13410},
- {3697, 13414, 13417},
- {10338, 13425, 13425},
- {13367, 13429, 13429},
- {11074, 13433, 13437},
- {4201, 13441, 13443},
- {1812, 13447, 13448},
- {13360, 13452, 13456},
- {13188, 13463, 13463},
- {9732, 13470, 13470},
- {11332, 13477, 13477},
- {9918, 13487, 13487},
- {6337, 13497, 13497},
- {13429, 13501, 13501},
- {11413, 13505, 13505},
- {4685, 13512, 13513},
- {13136, 13517, 13519},
- {7416, 13528, 13530},
- {12929, 13534, 13534},
- {11110, 13539, 13539},
- {11521, 13543, 13543},
- {12825, 13553, 13553},
- {13447, 13557, 13558},
- {12299, 13562, 13563},
- {9003, 13570, 13570},
- {12500, 13577, 13577},
- {13501, 13581, 13581},
- {9392, 13586, 13586},
- {12454, 13590, 13590},
- {6189, 13595, 13595},
- {13053, 13599, 13599},
- {11881, 13604, 13604},
- {13159, 13608, 13608},
- {4894, 13612, 13612},
- {13221, 13621, 13621},
- {8950, 13625, 13625},
- {13533, 13629, 13629},
- {9633, 13633, 13633},
- {7892, 13637, 13639},
- {13581, 13643, 13643},
- {13616, 13647, 13649},
- {12794, 13653, 13654},
- {8919, 13659, 13659},
- {9674, 13663, 13663},
- {13577, 13668, 13668},
- {12966, 13672, 13672},
- {12659, 13676, 13683},
- {6124, 13688, 13688},
- {9225, 13693, 13695},
- {11833, 13702, 13702},
- {12904, 13709, 13717},
- {13647, 13721, 13722},
- {11687, 13726, 13727},
- {12434, 13731, 13732},
- {12689, 13736, 13742},
- {13168, 13746, 13746},
- {6151, 13751, 13752},
- {11821, 13756, 13757},
- {6467, 13764, 13764},
- {5730, 13769, 13769},
- {5136, 13780, 13780},
- {724, 13784, 13785},
- {13517, 13789, 13791},
- {640, 13795, 13796},
- {7721, 13800, 13802},
- {11121, 13806, 13807},
- {5791, 13811, 13815},
- {12894, 13819, 13819},
- {11100, 13824, 13824},
- {7011, 13830, 13830},
- {7129, 13834, 13837},
- {13833, 13841, 13841},
- {11276, 13847, 13847},
- {13621, 13853, 13853},
- {13589, 13862, 13863},
- {12989, 13867, 13867},
- {12789, 13871, 13871},
- {1239, 13875, 13875},
- {4675, 13879, 13881},
- {4686, 13885, 13885},
- {707, 13889, 13889},
- {5449, 13897, 13898},
- {13867, 13902, 13903},
- {10613, 13908, 13908},
- {13789, 13912, 13914},
- {4451, 13918, 13919},
- {9200, 13924, 13924},
- {2011, 13930, 13930},
- {11433, 13934, 13936},
- {4695, 13942, 13943},
- {9435, 13948, 13951},
- {13688, 13955, 13957},
- {11694, 13961, 13962},
- {5712, 13966, 13966},
- {5991, 13970, 13972},
- {13477, 13976, 13976},
- {10213, 13987, 13987},
- {11839, 13991, 13993},
- {12272, 13997, 13997},
- {6206, 14001, 14001},
- {13179, 14006, 14007},
- {2939, 14011, 14011},
- {12972, 14016, 14017},
- {13918, 14021, 14022},
- {7436, 14026, 14027},
- {7678, 14032, 14034},
- {13586, 14040, 14040},
- {13347, 14044, 14044},
- {13109, 14048, 14051},
- {9244, 14055, 14057},
- {13315, 14061, 14061},
- {13276, 14067, 14067},
- {11435, 14073, 14074},
- {13853, 14078, 14078},
- {13452, 14082, 14082},
- {14044, 14087, 14087},
- {4440, 14091, 14095},
- {4479, 14100, 14103},
- {9395, 14107, 14109},
- {6834, 14119, 14119},
- {10458, 14123, 14124},
- {1429, 14129, 14129},
- {8443, 14135, 14135},
- {10365, 14140, 14140},
- {5267, 14145, 14145},
- {11834, 14151, 14153},
-}
diff --git a/vendor/github.com/golang/snappy/snappy_test.go b/vendor/github.com/golang/snappy/snappy_test.go
deleted file mode 100644
index 2712710df..000000000
--- a/vendor/github.com/golang/snappy/snappy_test.go
+++ /dev/null
@@ -1,1353 +0,0 @@
-// Copyright 2011 The Snappy-Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package snappy
-
-import (
- "bytes"
- "encoding/binary"
- "flag"
- "fmt"
- "io"
- "io/ioutil"
- "math/rand"
- "net/http"
- "os"
- "os/exec"
- "path/filepath"
- "runtime"
- "strings"
- "testing"
-)
-
-var (
- download = flag.Bool("download", false, "If true, download any missing files before running benchmarks")
- testdataDir = flag.String("testdataDir", "testdata", "Directory containing the test data")
- benchdataDir = flag.String("benchdataDir", "testdata/bench", "Directory containing the benchmark data")
-)
-
-// goEncoderShouldMatchCppEncoder is whether to test that the algorithm used by
-// Go's encoder matches byte-for-byte what the C++ snappy encoder produces, on
-// this GOARCH. There is more than one valid encoding of any given input, and
-// there is more than one good algorithm along the frontier of trading off
-// throughput for output size. Nonetheless, we presume that the C++ encoder's
-// algorithm is a good one and has been tested on a wide range of inputs, so
-// matching that exactly should mean that the Go encoder's algorithm is also
-// good, without needing to gather our own corpus of test data.
-//
-// The exact algorithm used by the C++ code is potentially endian dependent, as
-// it puns a byte pointer to a uint32 pointer to load, hash and compare 4 bytes
-// at a time. The Go implementation is endian agnostic, in that its output is
-// the same (as little-endian C++ code), regardless of the CPU's endianness.
-//
-// Thus, when comparing Go's output to C++ output generated beforehand, such as
-// the "testdata/pi.txt.rawsnappy" file generated by C++ code on a little-
-// endian system, we can run that test regardless of the runtime.GOARCH value.
-//
-// When comparing Go's output to dynamically generated C++ output, i.e. the
-// result of fork/exec'ing a C++ program, we can run that test only on
-// little-endian systems, because the C++ output might be different on
-// big-endian systems. The runtime package doesn't export endianness per se,
-// but we can restrict this match-C++ test to common little-endian systems.
-const goEncoderShouldMatchCppEncoder = runtime.GOARCH == "386" || runtime.GOARCH == "amd64" || runtime.GOARCH == "arm"
-
-func TestMaxEncodedLenOfMaxBlockSize(t *testing.T) {
- got := maxEncodedLenOfMaxBlockSize
- want := MaxEncodedLen(maxBlockSize)
- if got != want {
- t.Fatalf("got %d, want %d", got, want)
- }
-}
-
-func cmp(a, b []byte) error {
- if bytes.Equal(a, b) {
- return nil
- }
- if len(a) != len(b) {
- return fmt.Errorf("got %d bytes, want %d", len(a), len(b))
- }
- for i := range a {
- if a[i] != b[i] {
- return fmt.Errorf("byte #%d: got 0x%02x, want 0x%02x", i, a[i], b[i])
- }
- }
- return nil
-}
-
-func roundtrip(b, ebuf, dbuf []byte) error {
- d, err := Decode(dbuf, Encode(ebuf, b))
- if err != nil {
- return fmt.Errorf("decoding error: %v", err)
- }
- if err := cmp(d, b); err != nil {
- return fmt.Errorf("roundtrip mismatch: %v", err)
- }
- return nil
-}
-
-func TestEmpty(t *testing.T) {
- if err := roundtrip(nil, nil, nil); err != nil {
- t.Fatal(err)
- }
-}
-
-func TestSmallCopy(t *testing.T) {
- for _, ebuf := range [][]byte{nil, make([]byte, 20), make([]byte, 64)} {
- for _, dbuf := range [][]byte{nil, make([]byte, 20), make([]byte, 64)} {
- for i := 0; i < 32; i++ {
- s := "aaaa" + strings.Repeat("b", i) + "aaaabbbb"
- if err := roundtrip([]byte(s), ebuf, dbuf); err != nil {
- t.Errorf("len(ebuf)=%d, len(dbuf)=%d, i=%d: %v", len(ebuf), len(dbuf), i, err)
- }
- }
- }
- }
-}
-
-func TestSmallRand(t *testing.T) {
- rng := rand.New(rand.NewSource(1))
- for n := 1; n < 20000; n += 23 {
- b := make([]byte, n)
- for i := range b {
- b[i] = uint8(rng.Intn(256))
- }
- if err := roundtrip(b, nil, nil); err != nil {
- t.Fatal(err)
- }
- }
-}
-
-func TestSmallRegular(t *testing.T) {
- for n := 1; n < 20000; n += 23 {
- b := make([]byte, n)
- for i := range b {
- b[i] = uint8(i%10 + 'a')
- }
- if err := roundtrip(b, nil, nil); err != nil {
- t.Fatal(err)
- }
- }
-}
-
-func TestInvalidVarint(t *testing.T) {
- testCases := []struct {
- desc string
- input string
- }{{
- "invalid varint, final byte has continuation bit set",
- "\xff",
- }, {
- "invalid varint, value overflows uint64",
- "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00",
- }, {
- // https://github.com/google/snappy/blob/master/format_description.txt
- // says that "the stream starts with the uncompressed length [as a
- // varint] (up to a maximum of 2^32 - 1)".
- "valid varint (as uint64), but value overflows uint32",
- "\x80\x80\x80\x80\x10",
- }}
-
- for _, tc := range testCases {
- input := []byte(tc.input)
- if _, err := DecodedLen(input); err != ErrCorrupt {
- t.Errorf("%s: DecodedLen: got %v, want ErrCorrupt", tc.desc, err)
- }
- if _, err := Decode(nil, input); err != ErrCorrupt {
- t.Errorf("%s: Decode: got %v, want ErrCorrupt", tc.desc, err)
- }
- }
-}
-
-func TestDecode(t *testing.T) {
- lit40Bytes := make([]byte, 40)
- for i := range lit40Bytes {
- lit40Bytes[i] = byte(i)
- }
- lit40 := string(lit40Bytes)
-
- testCases := []struct {
- desc string
- input string
- want string
- wantErr error
- }{{
- `decodedLen=0; valid input`,
- "\x00",
- "",
- nil,
- }, {
- `decodedLen=3; tagLiteral, 0-byte length; length=3; valid input`,
- "\x03" + "\x08\xff\xff\xff",
- "\xff\xff\xff",
- nil,
- }, {
- `decodedLen=2; tagLiteral, 0-byte length; length=3; not enough dst bytes`,
- "\x02" + "\x08\xff\xff\xff",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=3; tagLiteral, 0-byte length; length=3; not enough src bytes`,
- "\x03" + "\x08\xff\xff",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=40; tagLiteral, 0-byte length; length=40; valid input`,
- "\x28" + "\x9c" + lit40,
- lit40,
- nil,
- }, {
- `decodedLen=1; tagLiteral, 1-byte length; not enough length bytes`,
- "\x01" + "\xf0",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=3; tagLiteral, 1-byte length; length=3; valid input`,
- "\x03" + "\xf0\x02\xff\xff\xff",
- "\xff\xff\xff",
- nil,
- }, {
- `decodedLen=1; tagLiteral, 2-byte length; not enough length bytes`,
- "\x01" + "\xf4\x00",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=3; tagLiteral, 2-byte length; length=3; valid input`,
- "\x03" + "\xf4\x02\x00\xff\xff\xff",
- "\xff\xff\xff",
- nil,
- }, {
- `decodedLen=1; tagLiteral, 3-byte length; not enough length bytes`,
- "\x01" + "\xf8\x00\x00",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=3; tagLiteral, 3-byte length; length=3; valid input`,
- "\x03" + "\xf8\x02\x00\x00\xff\xff\xff",
- "\xff\xff\xff",
- nil,
- }, {
- `decodedLen=1; tagLiteral, 4-byte length; not enough length bytes`,
- "\x01" + "\xfc\x00\x00\x00",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=1; tagLiteral, 4-byte length; length=3; not enough dst bytes`,
- "\x01" + "\xfc\x02\x00\x00\x00\xff\xff\xff",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=4; tagLiteral, 4-byte length; length=3; not enough src bytes`,
- "\x04" + "\xfc\x02\x00\x00\x00\xff",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=3; tagLiteral, 4-byte length; length=3; valid input`,
- "\x03" + "\xfc\x02\x00\x00\x00\xff\xff\xff",
- "\xff\xff\xff",
- nil,
- }, {
- `decodedLen=4; tagCopy1, 1 extra length|offset byte; not enough extra bytes`,
- "\x04" + "\x01",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=4; tagCopy2, 2 extra length|offset bytes; not enough extra bytes`,
- "\x04" + "\x02\x00",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=4; tagCopy4, 4 extra length|offset bytes; not enough extra bytes`,
- "\x04" + "\x03\x00\x00\x00",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=4; tagLiteral (4 bytes "abcd"); valid input`,
- "\x04" + "\x0cabcd",
- "abcd",
- nil,
- }, {
- `decodedLen=13; tagLiteral (4 bytes "abcd"); tagCopy1; length=9 offset=4; valid input`,
- "\x0d" + "\x0cabcd" + "\x15\x04",
- "abcdabcdabcda",
- nil,
- }, {
- `decodedLen=8; tagLiteral (4 bytes "abcd"); tagCopy1; length=4 offset=4; valid input`,
- "\x08" + "\x0cabcd" + "\x01\x04",
- "abcdabcd",
- nil,
- }, {
- `decodedLen=8; tagLiteral (4 bytes "abcd"); tagCopy1; length=4 offset=2; valid input`,
- "\x08" + "\x0cabcd" + "\x01\x02",
- "abcdcdcd",
- nil,
- }, {
- `decodedLen=8; tagLiteral (4 bytes "abcd"); tagCopy1; length=4 offset=1; valid input`,
- "\x08" + "\x0cabcd" + "\x01\x01",
- "abcddddd",
- nil,
- }, {
- `decodedLen=8; tagLiteral (4 bytes "abcd"); tagCopy1; length=4 offset=0; zero offset`,
- "\x08" + "\x0cabcd" + "\x01\x00",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=9; tagLiteral (4 bytes "abcd"); tagCopy1; length=4 offset=4; inconsistent dLen`,
- "\x09" + "\x0cabcd" + "\x01\x04",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=8; tagLiteral (4 bytes "abcd"); tagCopy1; length=4 offset=5; offset too large`,
- "\x08" + "\x0cabcd" + "\x01\x05",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=7; tagLiteral (4 bytes "abcd"); tagCopy1; length=4 offset=4; length too large`,
- "\x07" + "\x0cabcd" + "\x01\x04",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=6; tagLiteral (4 bytes "abcd"); tagCopy2; length=2 offset=3; valid input`,
- "\x06" + "\x0cabcd" + "\x06\x03\x00",
- "abcdbc",
- nil,
- }, {
- `decodedLen=6; tagLiteral (4 bytes "abcd"); tagCopy4; length=2 offset=3; valid input`,
- "\x06" + "\x0cabcd" + "\x07\x03\x00\x00\x00",
- "abcdbc",
- nil,
- }}
-
- const (
- // notPresentXxx defines a range of byte values [0xa0, 0xc5) that are
- // not present in either the input or the output. It is written to dBuf
- // to check that Decode does not write bytes past the end of
- // dBuf[:dLen].
- //
- // The magic number 37 was chosen because it is prime. A more 'natural'
- // number like 32 might lead to a false negative if, for example, a
- // byte was incorrectly copied 4*8 bytes later.
- notPresentBase = 0xa0
- notPresentLen = 37
- )
-
- var dBuf [100]byte
-loop:
- for i, tc := range testCases {
- input := []byte(tc.input)
- for _, x := range input {
- if notPresentBase <= x && x < notPresentBase+notPresentLen {
- t.Errorf("#%d (%s): input shouldn't contain %#02x\ninput: % x", i, tc.desc, x, input)
- continue loop
- }
- }
-
- dLen, n := binary.Uvarint(input)
- if n <= 0 {
- t.Errorf("#%d (%s): invalid varint-encoded dLen", i, tc.desc)
- continue
- }
- if dLen > uint64(len(dBuf)) {
- t.Errorf("#%d (%s): dLen %d is too large", i, tc.desc, dLen)
- continue
- }
-
- for j := range dBuf {
- dBuf[j] = byte(notPresentBase + j%notPresentLen)
- }
- g, gotErr := Decode(dBuf[:], input)
- if got := string(g); got != tc.want || gotErr != tc.wantErr {
- t.Errorf("#%d (%s):\ngot %q, %v\nwant %q, %v",
- i, tc.desc, got, gotErr, tc.want, tc.wantErr)
- continue
- }
- for j, x := range dBuf {
- if uint64(j) < dLen {
- continue
- }
- if w := byte(notPresentBase + j%notPresentLen); x != w {
- t.Errorf("#%d (%s): Decode overrun: dBuf[%d] was modified: got %#02x, want %#02x\ndBuf: % x",
- i, tc.desc, j, x, w, dBuf)
- continue loop
- }
- }
- }
-}
-
-func TestDecodeCopy4(t *testing.T) {
- dots := strings.Repeat(".", 65536)
-
- input := strings.Join([]string{
- "\x89\x80\x04", // decodedLen = 65545.
- "\x0cpqrs", // 4-byte literal "pqrs".
- "\xf4\xff\xff" + dots, // 65536-byte literal dots.
- "\x13\x04\x00\x01\x00", // tagCopy4; length=5 offset=65540.
- }, "")
-
- gotBytes, err := Decode(nil, []byte(input))
- if err != nil {
- t.Fatal(err)
- }
- got := string(gotBytes)
- want := "pqrs" + dots + "pqrs."
- if len(got) != len(want) {
- t.Fatalf("got %d bytes, want %d", len(got), len(want))
- }
- if got != want {
- for i := 0; i < len(got); i++ {
- if g, w := got[i], want[i]; g != w {
- t.Fatalf("byte #%d: got %#02x, want %#02x", i, g, w)
- }
- }
- }
-}
-
-// TestDecodeLengthOffset tests decoding an encoding of the form literal +
-// copy-length-offset + literal. For example: "abcdefghijkl" + "efghij" + "AB".
-func TestDecodeLengthOffset(t *testing.T) {
- const (
- prefix = "abcdefghijklmnopqr"
- suffix = "ABCDEFGHIJKLMNOPQR"
-
- // notPresentXxx defines a range of byte values [0xa0, 0xc5) that are
- // not present in either the input or the output. It is written to
- // gotBuf to check that Decode does not write bytes past the end of
- // gotBuf[:totalLen].
- //
- // The magic number 37 was chosen because it is prime. A more 'natural'
- // number like 32 might lead to a false negative if, for example, a
- // byte was incorrectly copied 4*8 bytes later.
- notPresentBase = 0xa0
- notPresentLen = 37
- )
- var gotBuf, wantBuf, inputBuf [128]byte
- for length := 1; length <= 18; length++ {
- for offset := 1; offset <= 18; offset++ {
- loop:
- for suffixLen := 0; suffixLen <= 18; suffixLen++ {
- totalLen := len(prefix) + length + suffixLen
-
- inputLen := binary.PutUvarint(inputBuf[:], uint64(totalLen))
- inputBuf[inputLen] = tagLiteral + 4*byte(len(prefix)-1)
- inputLen++
- inputLen += copy(inputBuf[inputLen:], prefix)
- inputBuf[inputLen+0] = tagCopy2 + 4*byte(length-1)
- inputBuf[inputLen+1] = byte(offset)
- inputBuf[inputLen+2] = 0x00
- inputLen += 3
- if suffixLen > 0 {
- inputBuf[inputLen] = tagLiteral + 4*byte(suffixLen-1)
- inputLen++
- inputLen += copy(inputBuf[inputLen:], suffix[:suffixLen])
- }
- input := inputBuf[:inputLen]
-
- for i := range gotBuf {
- gotBuf[i] = byte(notPresentBase + i%notPresentLen)
- }
- got, err := Decode(gotBuf[:], input)
- if err != nil {
- t.Errorf("length=%d, offset=%d; suffixLen=%d: %v", length, offset, suffixLen, err)
- continue
- }
-
- wantLen := 0
- wantLen += copy(wantBuf[wantLen:], prefix)
- for i := 0; i < length; i++ {
- wantBuf[wantLen] = wantBuf[wantLen-offset]
- wantLen++
- }
- wantLen += copy(wantBuf[wantLen:], suffix[:suffixLen])
- want := wantBuf[:wantLen]
-
- for _, x := range input {
- if notPresentBase <= x && x < notPresentBase+notPresentLen {
- t.Errorf("length=%d, offset=%d; suffixLen=%d: input shouldn't contain %#02x\ninput: % x",
- length, offset, suffixLen, x, input)
- continue loop
- }
- }
- for i, x := range gotBuf {
- if i < totalLen {
- continue
- }
- if w := byte(notPresentBase + i%notPresentLen); x != w {
- t.Errorf("length=%d, offset=%d; suffixLen=%d; totalLen=%d: "+
- "Decode overrun: gotBuf[%d] was modified: got %#02x, want %#02x\ngotBuf: % x",
- length, offset, suffixLen, totalLen, i, x, w, gotBuf)
- continue loop
- }
- }
- for _, x := range want {
- if notPresentBase <= x && x < notPresentBase+notPresentLen {
- t.Errorf("length=%d, offset=%d; suffixLen=%d: want shouldn't contain %#02x\nwant: % x",
- length, offset, suffixLen, x, want)
- continue loop
- }
- }
-
- if !bytes.Equal(got, want) {
- t.Errorf("length=%d, offset=%d; suffixLen=%d:\ninput % x\ngot % x\nwant % x",
- length, offset, suffixLen, input, got, want)
- continue
- }
- }
- }
- }
-}
-
-const (
- goldenText = "Mark.Twain-Tom.Sawyer.txt"
- goldenCompressed = goldenText + ".rawsnappy"
-)
-
-func TestDecodeGoldenInput(t *testing.T) {
- tDir := filepath.FromSlash(*testdataDir)
- src, err := ioutil.ReadFile(filepath.Join(tDir, goldenCompressed))
- if err != nil {
- t.Fatalf("ReadFile: %v", err)
- }
- got, err := Decode(nil, src)
- if err != nil {
- t.Fatalf("Decode: %v", err)
- }
- want, err := ioutil.ReadFile(filepath.Join(tDir, goldenText))
- if err != nil {
- t.Fatalf("ReadFile: %v", err)
- }
- if err := cmp(got, want); err != nil {
- t.Fatal(err)
- }
-}
-
-func TestEncodeGoldenInput(t *testing.T) {
- tDir := filepath.FromSlash(*testdataDir)
- src, err := ioutil.ReadFile(filepath.Join(tDir, goldenText))
- if err != nil {
- t.Fatalf("ReadFile: %v", err)
- }
- got := Encode(nil, src)
- want, err := ioutil.ReadFile(filepath.Join(tDir, goldenCompressed))
- if err != nil {
- t.Fatalf("ReadFile: %v", err)
- }
- if err := cmp(got, want); err != nil {
- t.Fatal(err)
- }
-}
-
-func TestExtendMatchGoldenInput(t *testing.T) {
- tDir := filepath.FromSlash(*testdataDir)
- src, err := ioutil.ReadFile(filepath.Join(tDir, goldenText))
- if err != nil {
- t.Fatalf("ReadFile: %v", err)
- }
- for i, tc := range extendMatchGoldenTestCases {
- got := extendMatch(src, tc.i, tc.j)
- if got != tc.want {
- t.Errorf("test #%d: i, j = %5d, %5d: got %5d (= j + %6d), want %5d (= j + %6d)",
- i, tc.i, tc.j, got, got-tc.j, tc.want, tc.want-tc.j)
- }
- }
-}
-
-func TestExtendMatch(t *testing.T) {
- // ref is a simple, reference implementation of extendMatch.
- ref := func(src []byte, i, j int) int {
- for ; j < len(src) && src[i] == src[j]; i, j = i+1, j+1 {
- }
- return j
- }
-
- nums := []int{0, 1, 2, 7, 8, 9, 29, 30, 31, 32, 33, 34, 38, 39, 40}
- for yIndex := 40; yIndex > 30; yIndex-- {
- xxx := bytes.Repeat([]byte("x"), 40)
- if yIndex < len(xxx) {
- xxx[yIndex] = 'y'
- }
- for _, i := range nums {
- for _, j := range nums {
- if i >= j {
- continue
- }
- got := extendMatch(xxx, i, j)
- want := ref(xxx, i, j)
- if got != want {
- t.Errorf("yIndex=%d, i=%d, j=%d: got %d, want %d", yIndex, i, j, got, want)
- }
- }
- }
- }
-}
-
-const snappytoolCmdName = "cmd/snappytool/snappytool"
-
-func skipTestSameEncodingAsCpp() (msg string) {
- if !goEncoderShouldMatchCppEncoder {
- return fmt.Sprintf("skipping testing that the encoding is byte-for-byte identical to C++: GOARCH=%s", runtime.GOARCH)
- }
- if _, err := os.Stat(snappytoolCmdName); err != nil {
- return fmt.Sprintf("could not find snappytool: %v", err)
- }
- return ""
-}
-
-func runTestSameEncodingAsCpp(src []byte) error {
- got := Encode(nil, src)
-
- cmd := exec.Command(snappytoolCmdName, "-e")
- cmd.Stdin = bytes.NewReader(src)
- want, err := cmd.Output()
- if err != nil {
- return fmt.Errorf("could not run snappytool: %v", err)
- }
- return cmp(got, want)
-}
-
-func TestSameEncodingAsCppShortCopies(t *testing.T) {
- if msg := skipTestSameEncodingAsCpp(); msg != "" {
- t.Skip(msg)
- }
- src := bytes.Repeat([]byte{'a'}, 20)
- for i := 0; i <= len(src); i++ {
- if err := runTestSameEncodingAsCpp(src[:i]); err != nil {
- t.Errorf("i=%d: %v", i, err)
- }
- }
-}
-
-func TestSameEncodingAsCppLongFiles(t *testing.T) {
- if msg := skipTestSameEncodingAsCpp(); msg != "" {
- t.Skip(msg)
- }
- bDir := filepath.FromSlash(*benchdataDir)
- failed := false
- for i, tf := range testFiles {
- if err := downloadBenchmarkFiles(t, tf.filename); err != nil {
- t.Fatalf("failed to download testdata: %s", err)
- }
- data := readFile(t, filepath.Join(bDir, tf.filename))
- if n := tf.sizeLimit; 0 < n && n < len(data) {
- data = data[:n]
- }
- if err := runTestSameEncodingAsCpp(data); err != nil {
- t.Errorf("i=%d: %v", i, err)
- failed = true
- }
- }
- if failed {
- t.Errorf("was the snappytool program built against the C++ snappy library version " +
- "d53de187 or later, commited on 2016-04-05? See " +
- "https://github.com/google/snappy/commit/d53de18799418e113e44444252a39b12a0e4e0cc")
- }
-}
-
-// TestSlowForwardCopyOverrun tests the "expand the pattern" algorithm
-// described in decode_amd64.s and its claim of a 10 byte overrun worst case.
-func TestSlowForwardCopyOverrun(t *testing.T) {
- const base = 100
-
- for length := 1; length < 18; length++ {
- for offset := 1; offset < 18; offset++ {
- highWaterMark := base
- d := base
- l := length
- o := offset
-
- // makeOffsetAtLeast8
- for o < 8 {
- if end := d + 8; highWaterMark < end {
- highWaterMark = end
- }
- l -= o
- d += o
- o += o
- }
-
- // fixUpSlowForwardCopy
- a := d
- d += l
-
- // finishSlowForwardCopy
- for l > 0 {
- if end := a + 8; highWaterMark < end {
- highWaterMark = end
- }
- a += 8
- l -= 8
- }
-
- dWant := base + length
- overrun := highWaterMark - dWant
- if d != dWant || overrun < 0 || 10 < overrun {
- t.Errorf("length=%d, offset=%d: d and overrun: got (%d, %d), want (%d, something in [0, 10])",
- length, offset, d, overrun, dWant)
- }
- }
- }
-}
-
-// TestEncodeNoiseThenRepeats encodes input for which the first half is very
-// incompressible and the second half is very compressible. The encoded form's
-// length should be closer to 50% of the original length than 100%.
-func TestEncodeNoiseThenRepeats(t *testing.T) {
- for _, origLen := range []int{256 * 1024, 2048 * 1024} {
- src := make([]byte, origLen)
- rng := rand.New(rand.NewSource(1))
- firstHalf, secondHalf := src[:origLen/2], src[origLen/2:]
- for i := range firstHalf {
- firstHalf[i] = uint8(rng.Intn(256))
- }
- for i := range secondHalf {
- secondHalf[i] = uint8(i >> 8)
- }
- dst := Encode(nil, src)
- if got, want := len(dst), origLen*3/4; got >= want {
- t.Errorf("origLen=%d: got %d encoded bytes, want less than %d", origLen, got, want)
- }
- }
-}
-
-func TestFramingFormat(t *testing.T) {
- // src is comprised of alternating 1e5-sized sequences of random
- // (incompressible) bytes and repeated (compressible) bytes. 1e5 was chosen
- // because it is larger than maxBlockSize (64k).
- src := make([]byte, 1e6)
- rng := rand.New(rand.NewSource(1))
- for i := 0; i < 10; i++ {
- if i%2 == 0 {
- for j := 0; j < 1e5; j++ {
- src[1e5*i+j] = uint8(rng.Intn(256))
- }
- } else {
- for j := 0; j < 1e5; j++ {
- src[1e5*i+j] = uint8(i)
- }
- }
- }
-
- buf := new(bytes.Buffer)
- if _, err := NewWriter(buf).Write(src); err != nil {
- t.Fatalf("Write: encoding: %v", err)
- }
- dst, err := ioutil.ReadAll(NewReader(buf))
- if err != nil {
- t.Fatalf("ReadAll: decoding: %v", err)
- }
- if err := cmp(dst, src); err != nil {
- t.Fatal(err)
- }
-}
-
-func TestWriterGoldenOutput(t *testing.T) {
- buf := new(bytes.Buffer)
- w := NewBufferedWriter(buf)
- defer w.Close()
- w.Write([]byte("abcd")) // Not compressible.
- w.Flush()
- w.Write(bytes.Repeat([]byte{'A'}, 150)) // Compressible.
- w.Flush()
- // The next chunk is also compressible, but a naive, greedy encoding of the
- // overall length 67 copy as a length 64 copy (the longest expressible as a
- // tagCopy1 or tagCopy2) plus a length 3 remainder would be two 3-byte
- // tagCopy2 tags (6 bytes), since the minimum length for a tagCopy1 is 4
- // bytes. Instead, we could do it shorter, in 5 bytes: a 3-byte tagCopy2
- // (of length 60) and a 2-byte tagCopy1 (of length 7).
- w.Write(bytes.Repeat([]byte{'B'}, 68))
- w.Write([]byte("efC")) // Not compressible.
- w.Write(bytes.Repeat([]byte{'C'}, 20)) // Compressible.
- w.Write(bytes.Repeat([]byte{'B'}, 20)) // Compressible.
- w.Write([]byte("g")) // Not compressible.
- w.Flush()
-
- got := buf.String()
- want := strings.Join([]string{
- magicChunk,
- "\x01\x08\x00\x00", // Uncompressed chunk, 8 bytes long (including 4 byte checksum).
- "\x68\x10\xe6\xb6", // Checksum.
- "\x61\x62\x63\x64", // Uncompressed payload: "abcd".
- "\x00\x11\x00\x00", // Compressed chunk, 17 bytes long (including 4 byte checksum).
- "\x5f\xeb\xf2\x10", // Checksum.
- "\x96\x01", // Compressed payload: Uncompressed length (varint encoded): 150.
- "\x00\x41", // Compressed payload: tagLiteral, length=1, "A".
- "\xfe\x01\x00", // Compressed payload: tagCopy2, length=64, offset=1.
- "\xfe\x01\x00", // Compressed payload: tagCopy2, length=64, offset=1.
- "\x52\x01\x00", // Compressed payload: tagCopy2, length=21, offset=1.
- "\x00\x18\x00\x00", // Compressed chunk, 24 bytes long (including 4 byte checksum).
- "\x30\x85\x69\xeb", // Checksum.
- "\x70", // Compressed payload: Uncompressed length (varint encoded): 112.
- "\x00\x42", // Compressed payload: tagLiteral, length=1, "B".
- "\xee\x01\x00", // Compressed payload: tagCopy2, length=60, offset=1.
- "\x0d\x01", // Compressed payload: tagCopy1, length=7, offset=1.
- "\x08\x65\x66\x43", // Compressed payload: tagLiteral, length=3, "efC".
- "\x4e\x01\x00", // Compressed payload: tagCopy2, length=20, offset=1.
- "\x4e\x5a\x00", // Compressed payload: tagCopy2, length=20, offset=90.
- "\x00\x67", // Compressed payload: tagLiteral, length=1, "g".
- }, "")
- if got != want {
- t.Fatalf("\ngot: % x\nwant: % x", got, want)
- }
-}
-
-func TestEmitLiteral(t *testing.T) {
- testCases := []struct {
- length int
- want string
- }{
- {1, "\x00"},
- {2, "\x04"},
- {59, "\xe8"},
- {60, "\xec"},
- {61, "\xf0\x3c"},
- {62, "\xf0\x3d"},
- {254, "\xf0\xfd"},
- {255, "\xf0\xfe"},
- {256, "\xf0\xff"},
- {257, "\xf4\x00\x01"},
- {65534, "\xf4\xfd\xff"},
- {65535, "\xf4\xfe\xff"},
- {65536, "\xf4\xff\xff"},
- }
-
- dst := make([]byte, 70000)
- nines := bytes.Repeat([]byte{0x99}, 65536)
- for _, tc := range testCases {
- lit := nines[:tc.length]
- n := emitLiteral(dst, lit)
- if !bytes.HasSuffix(dst[:n], lit) {
- t.Errorf("length=%d: did not end with that many literal bytes", tc.length)
- continue
- }
- got := string(dst[:n-tc.length])
- if got != tc.want {
- t.Errorf("length=%d:\ngot % x\nwant % x", tc.length, got, tc.want)
- continue
- }
- }
-}
-
-func TestEmitCopy(t *testing.T) {
- testCases := []struct {
- offset int
- length int
- want string
- }{
- {8, 04, "\x01\x08"},
- {8, 11, "\x1d\x08"},
- {8, 12, "\x2e\x08\x00"},
- {8, 13, "\x32\x08\x00"},
- {8, 59, "\xea\x08\x00"},
- {8, 60, "\xee\x08\x00"},
- {8, 61, "\xf2\x08\x00"},
- {8, 62, "\xf6\x08\x00"},
- {8, 63, "\xfa\x08\x00"},
- {8, 64, "\xfe\x08\x00"},
- {8, 65, "\xee\x08\x00\x05\x08"},
- {8, 66, "\xee\x08\x00\x09\x08"},
- {8, 67, "\xee\x08\x00\x0d\x08"},
- {8, 68, "\xfe\x08\x00\x01\x08"},
- {8, 69, "\xfe\x08\x00\x05\x08"},
- {8, 80, "\xfe\x08\x00\x3e\x08\x00"},
-
- {256, 04, "\x21\x00"},
- {256, 11, "\x3d\x00"},
- {256, 12, "\x2e\x00\x01"},
- {256, 13, "\x32\x00\x01"},
- {256, 59, "\xea\x00\x01"},
- {256, 60, "\xee\x00\x01"},
- {256, 61, "\xf2\x00\x01"},
- {256, 62, "\xf6\x00\x01"},
- {256, 63, "\xfa\x00\x01"},
- {256, 64, "\xfe\x00\x01"},
- {256, 65, "\xee\x00\x01\x25\x00"},
- {256, 66, "\xee\x00\x01\x29\x00"},
- {256, 67, "\xee\x00\x01\x2d\x00"},
- {256, 68, "\xfe\x00\x01\x21\x00"},
- {256, 69, "\xfe\x00\x01\x25\x00"},
- {256, 80, "\xfe\x00\x01\x3e\x00\x01"},
-
- {2048, 04, "\x0e\x00\x08"},
- {2048, 11, "\x2a\x00\x08"},
- {2048, 12, "\x2e\x00\x08"},
- {2048, 13, "\x32\x00\x08"},
- {2048, 59, "\xea\x00\x08"},
- {2048, 60, "\xee\x00\x08"},
- {2048, 61, "\xf2\x00\x08"},
- {2048, 62, "\xf6\x00\x08"},
- {2048, 63, "\xfa\x00\x08"},
- {2048, 64, "\xfe\x00\x08"},
- {2048, 65, "\xee\x00\x08\x12\x00\x08"},
- {2048, 66, "\xee\x00\x08\x16\x00\x08"},
- {2048, 67, "\xee\x00\x08\x1a\x00\x08"},
- {2048, 68, "\xfe\x00\x08\x0e\x00\x08"},
- {2048, 69, "\xfe\x00\x08\x12\x00\x08"},
- {2048, 80, "\xfe\x00\x08\x3e\x00\x08"},
- }
-
- dst := make([]byte, 1024)
- for _, tc := range testCases {
- n := emitCopy(dst, tc.offset, tc.length)
- got := string(dst[:n])
- if got != tc.want {
- t.Errorf("offset=%d, length=%d:\ngot % x\nwant % x", tc.offset, tc.length, got, tc.want)
- }
- }
-}
-
-func TestNewBufferedWriter(t *testing.T) {
- // Test all 32 possible sub-sequences of these 5 input slices.
- //
- // Their lengths sum to 400,000, which is over 6 times the Writer ibuf
- // capacity: 6 * maxBlockSize is 393,216.
- inputs := [][]byte{
- bytes.Repeat([]byte{'a'}, 40000),
- bytes.Repeat([]byte{'b'}, 150000),
- bytes.Repeat([]byte{'c'}, 60000),
- bytes.Repeat([]byte{'d'}, 120000),
- bytes.Repeat([]byte{'e'}, 30000),
- }
-loop:
- for i := 0; i < 1<<uint(len(inputs)); i++ {
- var want []byte
- buf := new(bytes.Buffer)
- w := NewBufferedWriter(buf)
- for j, input := range inputs {
- if i&(1<<uint(j)) == 0 {
- continue
- }
- if _, err := w.Write(input); err != nil {
- t.Errorf("i=%#02x: j=%d: Write: %v", i, j, err)
- continue loop
- }
- want = append(want, input...)
- }
- if err := w.Close(); err != nil {
- t.Errorf("i=%#02x: Close: %v", i, err)
- continue
- }
- got, err := ioutil.ReadAll(NewReader(buf))
- if err != nil {
- t.Errorf("i=%#02x: ReadAll: %v", i, err)
- continue
- }
- if err := cmp(got, want); err != nil {
- t.Errorf("i=%#02x: %v", i, err)
- continue
- }
- }
-}
-
-func TestFlush(t *testing.T) {
- buf := new(bytes.Buffer)
- w := NewBufferedWriter(buf)
- defer w.Close()
- if _, err := w.Write(bytes.Repeat([]byte{'x'}, 20)); err != nil {
- t.Fatalf("Write: %v", err)
- }
- if n := buf.Len(); n != 0 {
- t.Fatalf("before Flush: %d bytes were written to the underlying io.Writer, want 0", n)
- }
- if err := w.Flush(); err != nil {
- t.Fatalf("Flush: %v", err)
- }
- if n := buf.Len(); n == 0 {
- t.Fatalf("after Flush: %d bytes were written to the underlying io.Writer, want non-0", n)
- }
-}
-
-func TestReaderUncompressedDataOK(t *testing.T) {
- r := NewReader(strings.NewReader(magicChunk +
- "\x01\x08\x00\x00" + // Uncompressed chunk, 8 bytes long (including 4 byte checksum).
- "\x68\x10\xe6\xb6" + // Checksum.
- "\x61\x62\x63\x64", // Uncompressed payload: "abcd".
- ))
- g, err := ioutil.ReadAll(r)
- if err != nil {
- t.Fatal(err)
- }
- if got, want := string(g), "abcd"; got != want {
- t.Fatalf("got %q, want %q", got, want)
- }
-}
-
-func TestReaderUncompressedDataNoPayload(t *testing.T) {
- r := NewReader(strings.NewReader(magicChunk +
- "\x01\x04\x00\x00" + // Uncompressed chunk, 4 bytes long.
- "", // No payload; corrupt input.
- ))
- if _, err := ioutil.ReadAll(r); err != ErrCorrupt {
- t.Fatalf("got %v, want %v", err, ErrCorrupt)
- }
-}
-
-func TestReaderUncompressedDataTooLong(t *testing.T) {
- // https://github.com/google/snappy/blob/master/framing_format.txt section
- // 4.3 says that "the maximum legal chunk length... is 65540", or 0x10004.
- const n = 0x10005
-
- r := NewReader(strings.NewReader(magicChunk +
- "\x01\x05\x00\x01" + // Uncompressed chunk, n bytes long.
- strings.Repeat("\x00", n),
- ))
- if _, err := ioutil.ReadAll(r); err != ErrCorrupt {
- t.Fatalf("got %v, want %v", err, ErrCorrupt)
- }
-}
-
-func TestReaderReset(t *testing.T) {
- gold := bytes.Repeat([]byte("All that is gold does not glitter,\n"), 10000)
- buf := new(bytes.Buffer)
- if _, err := NewWriter(buf).Write(gold); err != nil {
- t.Fatalf("Write: %v", err)
- }
- encoded, invalid, partial := buf.String(), "invalid", "partial"
- r := NewReader(nil)
- for i, s := range []string{encoded, invalid, partial, encoded, partial, invalid, encoded, encoded} {
- if s == partial {
- r.Reset(strings.NewReader(encoded))
- if _, err := r.Read(make([]byte, 101)); err != nil {
- t.Errorf("#%d: %v", i, err)
- continue
- }
- continue
- }
- r.Reset(strings.NewReader(s))
- got, err := ioutil.ReadAll(r)
- switch s {
- case encoded:
- if err != nil {
- t.Errorf("#%d: %v", i, err)
- continue
- }
- if err := cmp(got, gold); err != nil {
- t.Errorf("#%d: %v", i, err)
- continue
- }
- case invalid:
- if err == nil {
- t.Errorf("#%d: got nil error, want non-nil", i)
- continue
- }
- }
- }
-}
-
-func TestWriterReset(t *testing.T) {
- gold := bytes.Repeat([]byte("Not all those who wander are lost;\n"), 10000)
- const n = 20
- for _, buffered := range []bool{false, true} {
- var w *Writer
- if buffered {
- w = NewBufferedWriter(nil)
- defer w.Close()
- } else {
- w = NewWriter(nil)
- }
-
- var gots, wants [][]byte
- failed := false
- for i := 0; i <= n; i++ {
- buf := new(bytes.Buffer)
- w.Reset(buf)
- want := gold[:len(gold)*i/n]
- if _, err := w.Write(want); err != nil {
- t.Errorf("#%d: Write: %v", i, err)
- failed = true
- continue
- }
- if buffered {
- if err := w.Flush(); err != nil {
- t.Errorf("#%d: Flush: %v", i, err)
- failed = true
- continue
- }
- }
- got, err := ioutil.ReadAll(NewReader(buf))
- if err != nil {
- t.Errorf("#%d: ReadAll: %v", i, err)
- failed = true
- continue
- }
- gots = append(gots, got)
- wants = append(wants, want)
- }
- if failed {
- continue
- }
- for i := range gots {
- if err := cmp(gots[i], wants[i]); err != nil {
- t.Errorf("#%d: %v", i, err)
- }
- }
- }
-}
-
-func TestWriterResetWithoutFlush(t *testing.T) {
- buf0 := new(bytes.Buffer)
- buf1 := new(bytes.Buffer)
- w := NewBufferedWriter(buf0)
- if _, err := w.Write([]byte("xxx")); err != nil {
- t.Fatalf("Write #0: %v", err)
- }
- // Note that we don't Flush the Writer before calling Reset.
- w.Reset(buf1)
- if _, err := w.Write([]byte("yyy")); err != nil {
- t.Fatalf("Write #1: %v", err)
- }
- if err := w.Flush(); err != nil {
- t.Fatalf("Flush: %v", err)
- }
- got, err := ioutil.ReadAll(NewReader(buf1))
- if err != nil {
- t.Fatalf("ReadAll: %v", err)
- }
- if err := cmp(got, []byte("yyy")); err != nil {
- t.Fatal(err)
- }
-}
-
-type writeCounter int
-
-func (c *writeCounter) Write(p []byte) (int, error) {
- *c++
- return len(p), nil
-}
-
-// TestNumUnderlyingWrites tests that each Writer flush only makes one or two
-// Write calls on its underlying io.Writer, depending on whether or not the
-// flushed buffer was compressible.
-func TestNumUnderlyingWrites(t *testing.T) {
- testCases := []struct {
- input []byte
- want int
- }{
- {bytes.Repeat([]byte{'x'}, 100), 1},
- {bytes.Repeat([]byte{'y'}, 100), 1},
- {[]byte("ABCDEFGHIJKLMNOPQRST"), 2},
- }
-
- var c writeCounter
- w := NewBufferedWriter(&c)
- defer w.Close()
- for i, tc := range testCases {
- c = 0
- if _, err := w.Write(tc.input); err != nil {
- t.Errorf("#%d: Write: %v", i, err)
- continue
- }
- if err := w.Flush(); err != nil {
- t.Errorf("#%d: Flush: %v", i, err)
- continue
- }
- if int(c) != tc.want {
- t.Errorf("#%d: got %d underlying writes, want %d", i, c, tc.want)
- continue
- }
- }
-}
-
-func benchDecode(b *testing.B, src []byte) {
- encoded := Encode(nil, src)
- // Bandwidth is in amount of uncompressed data.
- b.SetBytes(int64(len(src)))
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- Decode(src, encoded)
- }
-}
-
-func benchEncode(b *testing.B, src []byte) {
- // Bandwidth is in amount of uncompressed data.
- b.SetBytes(int64(len(src)))
- dst := make([]byte, MaxEncodedLen(len(src)))
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- Encode(dst, src)
- }
-}
-
-func testOrBenchmark(b testing.TB) string {
- if _, ok := b.(*testing.B); ok {
- return "benchmark"
- }
- return "test"
-}
-
-func readFile(b testing.TB, filename string) []byte {
- src, err := ioutil.ReadFile(filename)
- if err != nil {
- b.Skipf("skipping %s: %v", testOrBenchmark(b), err)
- }
- if len(src) == 0 {
- b.Fatalf("%s has zero length", filename)
- }
- return src
-}
-
-// expand returns a slice of length n containing repeated copies of src.
-func expand(src []byte, n int) []byte {
- dst := make([]byte, n)
- for x := dst; len(x) > 0; {
- i := copy(x, src)
- x = x[i:]
- }
- return dst
-}
-
-func benchWords(b *testing.B, n int, decode bool) {
- // Note: the file is OS-language dependent so the resulting values are not
- // directly comparable for non-US-English OS installations.
- data := expand(readFile(b, "/usr/share/dict/words"), n)
- if decode {
- benchDecode(b, data)
- } else {
- benchEncode(b, data)
- }
-}
-
-func BenchmarkWordsDecode1e1(b *testing.B) { benchWords(b, 1e1, true) }
-func BenchmarkWordsDecode1e2(b *testing.B) { benchWords(b, 1e2, true) }
-func BenchmarkWordsDecode1e3(b *testing.B) { benchWords(b, 1e3, true) }
-func BenchmarkWordsDecode1e4(b *testing.B) { benchWords(b, 1e4, true) }
-func BenchmarkWordsDecode1e5(b *testing.B) { benchWords(b, 1e5, true) }
-func BenchmarkWordsDecode1e6(b *testing.B) { benchWords(b, 1e6, true) }
-func BenchmarkWordsEncode1e1(b *testing.B) { benchWords(b, 1e1, false) }
-func BenchmarkWordsEncode1e2(b *testing.B) { benchWords(b, 1e2, false) }
-func BenchmarkWordsEncode1e3(b *testing.B) { benchWords(b, 1e3, false) }
-func BenchmarkWordsEncode1e4(b *testing.B) { benchWords(b, 1e4, false) }
-func BenchmarkWordsEncode1e5(b *testing.B) { benchWords(b, 1e5, false) }
-func BenchmarkWordsEncode1e6(b *testing.B) { benchWords(b, 1e6, false) }
-
-func BenchmarkRandomEncode(b *testing.B) {
- rng := rand.New(rand.NewSource(1))
- data := make([]byte, 1<<20)
- for i := range data {
- data[i] = uint8(rng.Intn(256))
- }
- benchEncode(b, data)
-}
-
-// testFiles' values are copied directly from
-// https://raw.githubusercontent.com/google/snappy/master/snappy_unittest.cc
-// The label field is unused in snappy-go.
-var testFiles = []struct {
- label string
- filename string
- sizeLimit int
-}{
- {"html", "html", 0},
- {"urls", "urls.10K", 0},
- {"jpg", "fireworks.jpeg", 0},
- {"jpg_200", "fireworks.jpeg", 200},
- {"pdf", "paper-100k.pdf", 0},
- {"html4", "html_x_4", 0},
- {"txt1", "alice29.txt", 0},
- {"txt2", "asyoulik.txt", 0},
- {"txt3", "lcet10.txt", 0},
- {"txt4", "plrabn12.txt", 0},
- {"pb", "geo.protodata", 0},
- {"gaviota", "kppkn.gtb", 0},
-}
-
-const (
- // The benchmark data files are at this canonical URL.
- benchURL = "https://raw.githubusercontent.com/google/snappy/master/testdata/"
-)
-
-func downloadBenchmarkFiles(b testing.TB, basename string) (errRet error) {
- bDir := filepath.FromSlash(*benchdataDir)
- filename := filepath.Join(bDir, basename)
- if stat, err := os.Stat(filename); err == nil && stat.Size() != 0 {
- return nil
- }
-
- if !*download {
- b.Skipf("test data not found; skipping %s without the -download flag", testOrBenchmark(b))
- }
- // Download the official snappy C++ implementation reference test data
- // files for benchmarking.
- if err := os.MkdirAll(bDir, 0777); err != nil && !os.IsExist(err) {
- return fmt.Errorf("failed to create %s: %s", bDir, err)
- }
-
- f, err := os.Create(filename)
- if err != nil {
- return fmt.Errorf("failed to create %s: %s", filename, err)
- }
- defer f.Close()
- defer func() {
- if errRet != nil {
- os.Remove(filename)
- }
- }()
- url := benchURL + basename
- resp, err := http.Get(url)
- if err != nil {
- return fmt.Errorf("failed to download %s: %s", url, err)
- }
- defer resp.Body.Close()
- if s := resp.StatusCode; s != http.StatusOK {
- return fmt.Errorf("downloading %s: HTTP status code %d (%s)", url, s, http.StatusText(s))
- }
- _, err = io.Copy(f, resp.Body)
- if err != nil {
- return fmt.Errorf("failed to download %s to %s: %s", url, filename, err)
- }
- return nil
-}
-
-func benchFile(b *testing.B, i int, decode bool) {
- if err := downloadBenchmarkFiles(b, testFiles[i].filename); err != nil {
- b.Fatalf("failed to download testdata: %s", err)
- }
- bDir := filepath.FromSlash(*benchdataDir)
- data := readFile(b, filepath.Join(bDir, testFiles[i].filename))
- if n := testFiles[i].sizeLimit; 0 < n && n < len(data) {
- data = data[:n]
- }
- if decode {
- benchDecode(b, data)
- } else {
- benchEncode(b, data)
- }
-}
-
-// Naming convention is kept similar to what snappy's C++ implementation uses.
-func Benchmark_UFlat0(b *testing.B) { benchFile(b, 0, true) }
-func Benchmark_UFlat1(b *testing.B) { benchFile(b, 1, true) }
-func Benchmark_UFlat2(b *testing.B) { benchFile(b, 2, true) }
-func Benchmark_UFlat3(b *testing.B) { benchFile(b, 3, true) }
-func Benchmark_UFlat4(b *testing.B) { benchFile(b, 4, true) }
-func Benchmark_UFlat5(b *testing.B) { benchFile(b, 5, true) }
-func Benchmark_UFlat6(b *testing.B) { benchFile(b, 6, true) }
-func Benchmark_UFlat7(b *testing.B) { benchFile(b, 7, true) }
-func Benchmark_UFlat8(b *testing.B) { benchFile(b, 8, true) }
-func Benchmark_UFlat9(b *testing.B) { benchFile(b, 9, true) }
-func Benchmark_UFlat10(b *testing.B) { benchFile(b, 10, true) }
-func Benchmark_UFlat11(b *testing.B) { benchFile(b, 11, true) }
-func Benchmark_ZFlat0(b *testing.B) { benchFile(b, 0, false) }
-func Benchmark_ZFlat1(b *testing.B) { benchFile(b, 1, false) }
-func Benchmark_ZFlat2(b *testing.B) { benchFile(b, 2, false) }
-func Benchmark_ZFlat3(b *testing.B) { benchFile(b, 3, false) }
-func Benchmark_ZFlat4(b *testing.B) { benchFile(b, 4, false) }
-func Benchmark_ZFlat5(b *testing.B) { benchFile(b, 5, false) }
-func Benchmark_ZFlat6(b *testing.B) { benchFile(b, 6, false) }
-func Benchmark_ZFlat7(b *testing.B) { benchFile(b, 7, false) }
-func Benchmark_ZFlat8(b *testing.B) { benchFile(b, 8, false) }
-func Benchmark_ZFlat9(b *testing.B) { benchFile(b, 9, false) }
-func Benchmark_ZFlat10(b *testing.B) { benchFile(b, 10, false) }
-func Benchmark_ZFlat11(b *testing.B) { benchFile(b, 11, false) }
-
-func BenchmarkExtendMatch(b *testing.B) {
- tDir := filepath.FromSlash(*testdataDir)
- src, err := ioutil.ReadFile(filepath.Join(tDir, goldenText))
- if err != nil {
- b.Fatalf("ReadFile: %v", err)
- }
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- for _, tc := range extendMatchGoldenTestCases {
- extendMatch(src, tc.i, tc.j)
- }
- }
-}
diff --git a/vendor/github.com/google/btree/btree_test.go b/vendor/github.com/google/btree/btree_test.go
deleted file mode 100644
index 9eeb136a5..000000000
--- a/vendor/github.com/google/btree/btree_test.go
+++ /dev/null
@@ -1,770 +0,0 @@
-// Copyright 2014 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package btree
-
-import (
- "flag"
- "fmt"
- "math/rand"
- "reflect"
- "sort"
- "sync"
- "testing"
- "time"
-)
-
-func init() {
- seed := time.Now().Unix()
- fmt.Println(seed)
- rand.Seed(seed)
-}
-
-// perm returns a random permutation of n Int items in the range [0, n).
-func perm(n int) (out []Item) {
- for _, v := range rand.Perm(n) {
- out = append(out, Int(v))
- }
- return
-}
-
-// rang returns an ordered list of Int items in the range [0, n).
-func rang(n int) (out []Item) {
- for i := 0; i < n; i++ {
- out = append(out, Int(i))
- }
- return
-}
-
-// all extracts all items from a tree in order as a slice.
-func all(t *BTree) (out []Item) {
- t.Ascend(func(a Item) bool {
- out = append(out, a)
- return true
- })
- return
-}
-
-// rangerev returns a reversed ordered list of Int items in the range [0, n).
-func rangrev(n int) (out []Item) {
- for i := n - 1; i >= 0; i-- {
- out = append(out, Int(i))
- }
- return
-}
-
-// allrev extracts all items from a tree in reverse order as a slice.
-func allrev(t *BTree) (out []Item) {
- t.Descend(func(a Item) bool {
- out = append(out, a)
- return true
- })
- return
-}
-
-var btreeDegree = flag.Int("degree", 32, "B-Tree degree")
-
-func TestBTree(t *testing.T) {
- tr := New(*btreeDegree)
- const treeSize = 10000
- for i := 0; i < 10; i++ {
- if min := tr.Min(); min != nil {
- t.Fatalf("empty min, got %+v", min)
- }
- if max := tr.Max(); max != nil {
- t.Fatalf("empty max, got %+v", max)
- }
- for _, item := range perm(treeSize) {
- if x := tr.ReplaceOrInsert(item); x != nil {
- t.Fatal("insert found item", item)
- }
- }
- for _, item := range perm(treeSize) {
- if x := tr.ReplaceOrInsert(item); x == nil {
- t.Fatal("insert didn't find item", item)
- }
- }
- if min, want := tr.Min(), Item(Int(0)); min != want {
- t.Fatalf("min: want %+v, got %+v", want, min)
- }
- if max, want := tr.Max(), Item(Int(treeSize-1)); max != want {
- t.Fatalf("max: want %+v, got %+v", want, max)
- }
- got := all(tr)
- want := rang(treeSize)
- if !reflect.DeepEqual(got, want) {
- t.Fatalf("mismatch:\n got: %v\nwant: %v", got, want)
- }
-
- gotrev := allrev(tr)
- wantrev := rangrev(treeSize)
- if !reflect.DeepEqual(gotrev, wantrev) {
- t.Fatalf("mismatch:\n got: %v\nwant: %v", got, want)
- }
-
- for _, item := range perm(treeSize) {
- if x := tr.Delete(item); x == nil {
- t.Fatalf("didn't find %v", item)
- }
- }
- if got = all(tr); len(got) > 0 {
- t.Fatalf("some left!: %v", got)
- }
- }
-}
-
-func ExampleBTree() {
- tr := New(*btreeDegree)
- for i := Int(0); i < 10; i++ {
- tr.ReplaceOrInsert(i)
- }
- fmt.Println("len: ", tr.Len())
- fmt.Println("get3: ", tr.Get(Int(3)))
- fmt.Println("get100: ", tr.Get(Int(100)))
- fmt.Println("del4: ", tr.Delete(Int(4)))
- fmt.Println("del100: ", tr.Delete(Int(100)))
- fmt.Println("replace5: ", tr.ReplaceOrInsert(Int(5)))
- fmt.Println("replace100:", tr.ReplaceOrInsert(Int(100)))
- fmt.Println("min: ", tr.Min())
- fmt.Println("delmin: ", tr.DeleteMin())
- fmt.Println("max: ", tr.Max())
- fmt.Println("delmax: ", tr.DeleteMax())
- fmt.Println("len: ", tr.Len())
- // Output:
- // len: 10
- // get3: 3
- // get100: <nil>
- // del4: 4
- // del100: <nil>
- // replace5: 5
- // replace100: <nil>
- // min: 0
- // delmin: 0
- // max: 100
- // delmax: 100
- // len: 8
-}
-
-func TestDeleteMin(t *testing.T) {
- tr := New(3)
- for _, v := range perm(100) {
- tr.ReplaceOrInsert(v)
- }
- var got []Item
- for v := tr.DeleteMin(); v != nil; v = tr.DeleteMin() {
- got = append(got, v)
- }
- if want := rang(100); !reflect.DeepEqual(got, want) {
- t.Fatalf("ascendrange:\n got: %v\nwant: %v", got, want)
- }
-}
-
-func TestDeleteMax(t *testing.T) {
- tr := New(3)
- for _, v := range perm(100) {
- tr.ReplaceOrInsert(v)
- }
- var got []Item
- for v := tr.DeleteMax(); v != nil; v = tr.DeleteMax() {
- got = append(got, v)
- }
- // Reverse our list.
- for i := 0; i < len(got)/2; i++ {
- got[i], got[len(got)-i-1] = got[len(got)-i-1], got[i]
- }
- if want := rang(100); !reflect.DeepEqual(got, want) {
- t.Fatalf("ascendrange:\n got: %v\nwant: %v", got, want)
- }
-}
-
-func TestAscendRange(t *testing.T) {
- tr := New(2)
- for _, v := range perm(100) {
- tr.ReplaceOrInsert(v)
- }
- var got []Item
- tr.AscendRange(Int(40), Int(60), func(a Item) bool {
- got = append(got, a)
- return true
- })
- if want := rang(100)[40:60]; !reflect.DeepEqual(got, want) {
- t.Fatalf("ascendrange:\n got: %v\nwant: %v", got, want)
- }
- got = got[:0]
- tr.AscendRange(Int(40), Int(60), func(a Item) bool {
- if a.(Int) > 50 {
- return false
- }
- got = append(got, a)
- return true
- })
- if want := rang(100)[40:51]; !reflect.DeepEqual(got, want) {
- t.Fatalf("ascendrange:\n got: %v\nwant: %v", got, want)
- }
-}
-
-func TestDescendRange(t *testing.T) {
- tr := New(2)
- for _, v := range perm(100) {
- tr.ReplaceOrInsert(v)
- }
- var got []Item
- tr.DescendRange(Int(60), Int(40), func(a Item) bool {
- got = append(got, a)
- return true
- })
- if want := rangrev(100)[39:59]; !reflect.DeepEqual(got, want) {
- t.Fatalf("descendrange:\n got: %v\nwant: %v", got, want)
- }
- got = got[:0]
- tr.DescendRange(Int(60), Int(40), func(a Item) bool {
- if a.(Int) < 50 {
- return false
- }
- got = append(got, a)
- return true
- })
- if want := rangrev(100)[39:50]; !reflect.DeepEqual(got, want) {
- t.Fatalf("descendrange:\n got: %v\nwant: %v", got, want)
- }
-}
-func TestAscendLessThan(t *testing.T) {
- tr := New(*btreeDegree)
- for _, v := range perm(100) {
- tr.ReplaceOrInsert(v)
- }
- var got []Item
- tr.AscendLessThan(Int(60), func(a Item) bool {
- got = append(got, a)
- return true
- })
- if want := rang(100)[:60]; !reflect.DeepEqual(got, want) {
- t.Fatalf("ascendrange:\n got: %v\nwant: %v", got, want)
- }
- got = got[:0]
- tr.AscendLessThan(Int(60), func(a Item) bool {
- if a.(Int) > 50 {
- return false
- }
- got = append(got, a)
- return true
- })
- if want := rang(100)[:51]; !reflect.DeepEqual(got, want) {
- t.Fatalf("ascendrange:\n got: %v\nwant: %v", got, want)
- }
-}
-
-func TestDescendLessOrEqual(t *testing.T) {
- tr := New(*btreeDegree)
- for _, v := range perm(100) {
- tr.ReplaceOrInsert(v)
- }
- var got []Item
- tr.DescendLessOrEqual(Int(40), func(a Item) bool {
- got = append(got, a)
- return true
- })
- if want := rangrev(100)[59:]; !reflect.DeepEqual(got, want) {
- t.Fatalf("descendlessorequal:\n got: %v\nwant: %v", got, want)
- }
- got = got[:0]
- tr.DescendLessOrEqual(Int(60), func(a Item) bool {
- if a.(Int) < 50 {
- return false
- }
- got = append(got, a)
- return true
- })
- if want := rangrev(100)[39:50]; !reflect.DeepEqual(got, want) {
- t.Fatalf("descendlessorequal:\n got: %v\nwant: %v", got, want)
- }
-}
-func TestAscendGreaterOrEqual(t *testing.T) {
- tr := New(*btreeDegree)
- for _, v := range perm(100) {
- tr.ReplaceOrInsert(v)
- }
- var got []Item
- tr.AscendGreaterOrEqual(Int(40), func(a Item) bool {
- got = append(got, a)
- return true
- })
- if want := rang(100)[40:]; !reflect.DeepEqual(got, want) {
- t.Fatalf("ascendrange:\n got: %v\nwant: %v", got, want)
- }
- got = got[:0]
- tr.AscendGreaterOrEqual(Int(40), func(a Item) bool {
- if a.(Int) > 50 {
- return false
- }
- got = append(got, a)
- return true
- })
- if want := rang(100)[40:51]; !reflect.DeepEqual(got, want) {
- t.Fatalf("ascendrange:\n got: %v\nwant: %v", got, want)
- }
-}
-
-func TestDescendGreaterThan(t *testing.T) {
- tr := New(*btreeDegree)
- for _, v := range perm(100) {
- tr.ReplaceOrInsert(v)
- }
- var got []Item
- tr.DescendGreaterThan(Int(40), func(a Item) bool {
- got = append(got, a)
- return true
- })
- if want := rangrev(100)[:59]; !reflect.DeepEqual(got, want) {
- t.Fatalf("descendgreaterthan:\n got: %v\nwant: %v", got, want)
- }
- got = got[:0]
- tr.DescendGreaterThan(Int(40), func(a Item) bool {
- if a.(Int) < 50 {
- return false
- }
- got = append(got, a)
- return true
- })
- if want := rangrev(100)[:50]; !reflect.DeepEqual(got, want) {
- t.Fatalf("descendgreaterthan:\n got: %v\nwant: %v", got, want)
- }
-}
-
-const benchmarkTreeSize = 10000
-
-func BenchmarkInsert(b *testing.B) {
- b.StopTimer()
- insertP := perm(benchmarkTreeSize)
- b.StartTimer()
- i := 0
- for i < b.N {
- tr := New(*btreeDegree)
- for _, item := range insertP {
- tr.ReplaceOrInsert(item)
- i++
- if i >= b.N {
- return
- }
- }
- }
-}
-
-func BenchmarkDeleteInsert(b *testing.B) {
- b.StopTimer()
- insertP := perm(benchmarkTreeSize)
- tr := New(*btreeDegree)
- for _, item := range insertP {
- tr.ReplaceOrInsert(item)
- }
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- tr.Delete(insertP[i%benchmarkTreeSize])
- tr.ReplaceOrInsert(insertP[i%benchmarkTreeSize])
- }
-}
-
-func BenchmarkDeleteInsertCloneOnce(b *testing.B) {
- b.StopTimer()
- insertP := perm(benchmarkTreeSize)
- tr := New(*btreeDegree)
- for _, item := range insertP {
- tr.ReplaceOrInsert(item)
- }
- tr = tr.Clone()
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- tr.Delete(insertP[i%benchmarkTreeSize])
- tr.ReplaceOrInsert(insertP[i%benchmarkTreeSize])
- }
-}
-
-func BenchmarkDeleteInsertCloneEachTime(b *testing.B) {
- b.StopTimer()
- insertP := perm(benchmarkTreeSize)
- tr := New(*btreeDegree)
- for _, item := range insertP {
- tr.ReplaceOrInsert(item)
- }
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- tr = tr.Clone()
- tr.Delete(insertP[i%benchmarkTreeSize])
- tr.ReplaceOrInsert(insertP[i%benchmarkTreeSize])
- }
-}
-
-func BenchmarkDelete(b *testing.B) {
- b.StopTimer()
- insertP := perm(benchmarkTreeSize)
- removeP := perm(benchmarkTreeSize)
- b.StartTimer()
- i := 0
- for i < b.N {
- b.StopTimer()
- tr := New(*btreeDegree)
- for _, v := range insertP {
- tr.ReplaceOrInsert(v)
- }
- b.StartTimer()
- for _, item := range removeP {
- tr.Delete(item)
- i++
- if i >= b.N {
- return
- }
- }
- if tr.Len() > 0 {
- panic(tr.Len())
- }
- }
-}
-
-func BenchmarkGet(b *testing.B) {
- b.StopTimer()
- insertP := perm(benchmarkTreeSize)
- removeP := perm(benchmarkTreeSize)
- b.StartTimer()
- i := 0
- for i < b.N {
- b.StopTimer()
- tr := New(*btreeDegree)
- for _, v := range insertP {
- tr.ReplaceOrInsert(v)
- }
- b.StartTimer()
- for _, item := range removeP {
- tr.Get(item)
- i++
- if i >= b.N {
- return
- }
- }
- }
-}
-
-func BenchmarkGetCloneEachTime(b *testing.B) {
- b.StopTimer()
- insertP := perm(benchmarkTreeSize)
- removeP := perm(benchmarkTreeSize)
- b.StartTimer()
- i := 0
- for i < b.N {
- b.StopTimer()
- tr := New(*btreeDegree)
- for _, v := range insertP {
- tr.ReplaceOrInsert(v)
- }
- b.StartTimer()
- for _, item := range removeP {
- tr = tr.Clone()
- tr.Get(item)
- i++
- if i >= b.N {
- return
- }
- }
- }
-}
-
-type byInts []Item
-
-func (a byInts) Len() int {
- return len(a)
-}
-
-func (a byInts) Less(i, j int) bool {
- return a[i].(Int) < a[j].(Int)
-}
-
-func (a byInts) Swap(i, j int) {
- a[i], a[j] = a[j], a[i]
-}
-
-func BenchmarkAscend(b *testing.B) {
- arr := perm(benchmarkTreeSize)
- tr := New(*btreeDegree)
- for _, v := range arr {
- tr.ReplaceOrInsert(v)
- }
- sort.Sort(byInts(arr))
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- j := 0
- tr.Ascend(func(item Item) bool {
- if item.(Int) != arr[j].(Int) {
- b.Fatalf("mismatch: expected: %v, got %v", arr[j].(Int), item.(Int))
- }
- j++
- return true
- })
- }
-}
-
-func BenchmarkDescend(b *testing.B) {
- arr := perm(benchmarkTreeSize)
- tr := New(*btreeDegree)
- for _, v := range arr {
- tr.ReplaceOrInsert(v)
- }
- sort.Sort(byInts(arr))
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- j := len(arr) - 1
- tr.Descend(func(item Item) bool {
- if item.(Int) != arr[j].(Int) {
- b.Fatalf("mismatch: expected: %v, got %v", arr[j].(Int), item.(Int))
- }
- j--
- return true
- })
- }
-}
-func BenchmarkAscendRange(b *testing.B) {
- arr := perm(benchmarkTreeSize)
- tr := New(*btreeDegree)
- for _, v := range arr {
- tr.ReplaceOrInsert(v)
- }
- sort.Sort(byInts(arr))
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- j := 100
- tr.AscendRange(Int(100), arr[len(arr)-100], func(item Item) bool {
- if item.(Int) != arr[j].(Int) {
- b.Fatalf("mismatch: expected: %v, got %v", arr[j].(Int), item.(Int))
- }
- j++
- return true
- })
- if j != len(arr)-100 {
- b.Fatalf("expected: %v, got %v", len(arr)-100, j)
- }
- }
-}
-
-func BenchmarkDescendRange(b *testing.B) {
- arr := perm(benchmarkTreeSize)
- tr := New(*btreeDegree)
- for _, v := range arr {
- tr.ReplaceOrInsert(v)
- }
- sort.Sort(byInts(arr))
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- j := len(arr) - 100
- tr.DescendRange(arr[len(arr)-100], Int(100), func(item Item) bool {
- if item.(Int) != arr[j].(Int) {
- b.Fatalf("mismatch: expected: %v, got %v", arr[j].(Int), item.(Int))
- }
- j--
- return true
- })
- if j != 100 {
- b.Fatalf("expected: %v, got %v", len(arr)-100, j)
- }
- }
-}
-func BenchmarkAscendGreaterOrEqual(b *testing.B) {
- arr := perm(benchmarkTreeSize)
- tr := New(*btreeDegree)
- for _, v := range arr {
- tr.ReplaceOrInsert(v)
- }
- sort.Sort(byInts(arr))
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- j := 100
- k := 0
- tr.AscendGreaterOrEqual(Int(100), func(item Item) bool {
- if item.(Int) != arr[j].(Int) {
- b.Fatalf("mismatch: expected: %v, got %v", arr[j].(Int), item.(Int))
- }
- j++
- k++
- return true
- })
- if j != len(arr) {
- b.Fatalf("expected: %v, got %v", len(arr), j)
- }
- if k != len(arr)-100 {
- b.Fatalf("expected: %v, got %v", len(arr)-100, k)
- }
- }
-}
-func BenchmarkDescendLessOrEqual(b *testing.B) {
- arr := perm(benchmarkTreeSize)
- tr := New(*btreeDegree)
- for _, v := range arr {
- tr.ReplaceOrInsert(v)
- }
- sort.Sort(byInts(arr))
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- j := len(arr) - 100
- k := len(arr)
- tr.DescendLessOrEqual(arr[len(arr)-100], func(item Item) bool {
- if item.(Int) != arr[j].(Int) {
- b.Fatalf("mismatch: expected: %v, got %v", arr[j].(Int), item.(Int))
- }
- j--
- k--
- return true
- })
- if j != -1 {
- b.Fatalf("expected: %v, got %v", -1, j)
- }
- if k != 99 {
- b.Fatalf("expected: %v, got %v", 99, k)
- }
- }
-}
-
-const cloneTestSize = 10000
-
-func cloneTest(t *testing.T, b *BTree, start int, p []Item, wg *sync.WaitGroup, trees *[]*BTree) {
- t.Logf("Starting new clone at %v", start)
- *trees = append(*trees, b)
- for i := start; i < cloneTestSize; i++ {
- b.ReplaceOrInsert(p[i])
- if i%(cloneTestSize/5) == 0 {
- wg.Add(1)
- go cloneTest(t, b.Clone(), i+1, p, wg, trees)
- }
- }
- wg.Done()
-}
-
-func TestCloneConcurrentOperations(t *testing.T) {
- b := New(*btreeDegree)
- trees := []*BTree{}
- p := perm(cloneTestSize)
- var wg sync.WaitGroup
- wg.Add(1)
- go cloneTest(t, b, 0, p, &wg, &trees)
- wg.Wait()
- want := rang(cloneTestSize)
- t.Logf("Starting equality checks on %d trees", len(trees))
- for i, tree := range trees {
- if !reflect.DeepEqual(want, all(tree)) {
- t.Errorf("tree %v mismatch", i)
- }
- }
- t.Log("Removing half from first half")
- toRemove := rang(cloneTestSize)[cloneTestSize/2:]
- for i := 0; i < len(trees)/2; i++ {
- tree := trees[i]
- wg.Add(1)
- go func() {
- for _, item := range toRemove {
- tree.Delete(item)
- }
- wg.Done()
- }()
- }
- wg.Wait()
- t.Log("Checking all values again")
- for i, tree := range trees {
- var wantpart []Item
- if i < len(trees)/2 {
- wantpart = want[:cloneTestSize/2]
- } else {
- wantpart = want
- }
- if got := all(tree); !reflect.DeepEqual(wantpart, got) {
- t.Errorf("tree %v mismatch, want %v got %v", i, len(want), len(got))
- }
- }
-}
-
-func BenchmarkDeleteAndRestore(b *testing.B) {
- items := perm(16392)
- b.ResetTimer()
- b.Run(`CopyBigFreeList`, func(b *testing.B) {
- fl := NewFreeList(16392)
- tr := NewWithFreeList(*btreeDegree, fl)
- for _, v := range items {
- tr.ReplaceOrInsert(v)
- }
- b.ReportAllocs()
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- dels := make([]Item, 0, tr.Len())
- tr.Ascend(ItemIterator(func(b Item) bool {
- dels = append(dels, b)
- return true
- }))
- for _, del := range dels {
- tr.Delete(del)
- }
- // tr is now empty, we make a new empty copy of it.
- tr = NewWithFreeList(*btreeDegree, fl)
- for _, v := range items {
- tr.ReplaceOrInsert(v)
- }
- }
- })
- b.Run(`Copy`, func(b *testing.B) {
- tr := New(*btreeDegree)
- for _, v := range items {
- tr.ReplaceOrInsert(v)
- }
- b.ReportAllocs()
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- dels := make([]Item, 0, tr.Len())
- tr.Ascend(ItemIterator(func(b Item) bool {
- dels = append(dels, b)
- return true
- }))
- for _, del := range dels {
- tr.Delete(del)
- }
- // tr is now empty, we make a new empty copy of it.
- tr = New(*btreeDegree)
- for _, v := range items {
- tr.ReplaceOrInsert(v)
- }
- }
- })
- b.Run(`ClearBigFreelist`, func(b *testing.B) {
- fl := NewFreeList(16392)
- tr := NewWithFreeList(*btreeDegree, fl)
- for _, v := range items {
- tr.ReplaceOrInsert(v)
- }
- b.ReportAllocs()
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- tr.Clear(true)
- for _, v := range items {
- tr.ReplaceOrInsert(v)
- }
- }
- })
- b.Run(`Clear`, func(b *testing.B) {
- tr := New(*btreeDegree)
- for _, v := range items {
- tr.ReplaceOrInsert(v)
- }
- b.ReportAllocs()
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- tr.Clear(true)
- for _, v := range items {
- tr.ReplaceOrInsert(v)
- }
- }
- })
-}
diff --git a/vendor/github.com/google/gofuzz/example_test.go b/vendor/github.com/google/gofuzz/example_test.go
deleted file mode 100644
index 792707a3a..000000000
--- a/vendor/github.com/google/gofuzz/example_test.go
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
-Copyright 2014 Google Inc. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package fuzz_test
-
-import (
- "encoding/json"
- "fmt"
- "math/rand"
-
- "github.com/google/gofuzz"
-)
-
-func ExampleSimple() {
- type MyType struct {
- A string
- B string
- C int
- D struct {
- E float64
- }
- }
-
- f := fuzz.New()
- object := MyType{}
-
- uniqueObjects := map[MyType]int{}
-
- for i := 0; i < 1000; i++ {
- f.Fuzz(&object)
- uniqueObjects[object]++
- }
- fmt.Printf("Got %v unique objects.\n", len(uniqueObjects))
- // Output:
- // Got 1000 unique objects.
-}
-
-func ExampleCustom() {
- type MyType struct {
- A int
- B string
- }
-
- counter := 0
- f := fuzz.New().Funcs(
- func(i *int, c fuzz.Continue) {
- *i = counter
- counter++
- },
- )
- object := MyType{}
-
- uniqueObjects := map[MyType]int{}
-
- for i := 0; i < 100; i++ {
- f.Fuzz(&object)
- if object.A != i {
- fmt.Printf("Unexpected value: %#v\n", object)
- }
- uniqueObjects[object]++
- }
- fmt.Printf("Got %v unique objects.\n", len(uniqueObjects))
- // Output:
- // Got 100 unique objects.
-}
-
-func ExampleComplex() {
- type OtherType struct {
- A string
- B string
- }
- type MyType struct {
- Pointer *OtherType
- Map map[string]OtherType
- PointerMap *map[string]OtherType
- Slice []OtherType
- SlicePointer []*OtherType
- PointerSlicePointer *[]*OtherType
- }
-
- f := fuzz.New().RandSource(rand.NewSource(0)).NilChance(0).NumElements(1, 1).Funcs(
- func(o *OtherType, c fuzz.Continue) {
- o.A = "Foo"
- o.B = "Bar"
- },
- func(op **OtherType, c fuzz.Continue) {
- *op = &OtherType{"A", "B"}
- },
- func(m map[string]OtherType, c fuzz.Continue) {
- m["Works Because"] = OtherType{
- "Fuzzer",
- "Preallocated",
- }
- },
- )
- object := MyType{}
- f.Fuzz(&object)
- bytes, err := json.MarshalIndent(&object, "", " ")
- if err != nil {
- fmt.Printf("error: %v\n", err)
- }
- fmt.Printf("%s\n", string(bytes))
- // Output:
- // {
- // "Pointer": {
- // "A": "A",
- // "B": "B"
- // },
- // "Map": {
- // "Works Because": {
- // "A": "Fuzzer",
- // "B": "Preallocated"
- // }
- // },
- // "PointerMap": {
- // "Works Because": {
- // "A": "Fuzzer",
- // "B": "Preallocated"
- // }
- // },
- // "Slice": [
- // {
- // "A": "Foo",
- // "B": "Bar"
- // }
- // ],
- // "SlicePointer": [
- // {
- // "A": "A",
- // "B": "B"
- // }
- // ],
- // "PointerSlicePointer": [
- // {
- // "A": "A",
- // "B": "B"
- // }
- // ]
- // }
-}
-
-func ExampleMap() {
- f := fuzz.New().NilChance(0).NumElements(1, 1)
- var myMap map[struct{ A, B, C int }]string
- f.Fuzz(&myMap)
- fmt.Printf("myMap has %v element(s).\n", len(myMap))
- // Output:
- // myMap has 1 element(s).
-}
-
-func ExampleSingle() {
- f := fuzz.New()
- var i int
- f.Fuzz(&i)
-
- // Technically, we'd expect this to fail one out of 2 billion attempts...
- fmt.Printf("(i == 0) == %v", i == 0)
- // Output:
- // (i == 0) == false
-}
-
-func ExampleEnum() {
- type MyEnum string
- const (
- A MyEnum = "A"
- B MyEnum = "B"
- )
- type MyInfo struct {
- Type MyEnum
- AInfo *string
- BInfo *string
- }
-
- f := fuzz.New().NilChance(0).Funcs(
- func(e *MyInfo, c fuzz.Continue) {
- // Note c's embedded Rand allows for direct use.
- // We could also use c.RandBool() here.
- switch c.Intn(2) {
- case 0:
- e.Type = A
- c.Fuzz(&e.AInfo)
- case 1:
- e.Type = B
- c.Fuzz(&e.BInfo)
- }
- },
- )
-
- for i := 0; i < 100; i++ {
- var myObject MyInfo
- f.Fuzz(&myObject)
- switch myObject.Type {
- case A:
- if myObject.AInfo == nil {
- fmt.Println("AInfo should have been set!")
- }
- if myObject.BInfo != nil {
- fmt.Println("BInfo should NOT have been set!")
- }
- case B:
- if myObject.BInfo == nil {
- fmt.Println("BInfo should have been set!")
- }
- if myObject.AInfo != nil {
- fmt.Println("AInfo should NOT have been set!")
- }
- default:
- fmt.Println("Invalid enum value!")
- }
- }
- // Output:
-}
diff --git a/vendor/github.com/google/gofuzz/fuzz_test.go b/vendor/github.com/google/gofuzz/fuzz_test.go
deleted file mode 100644
index 4059ea6fe..000000000
--- a/vendor/github.com/google/gofuzz/fuzz_test.go
+++ /dev/null
@@ -1,472 +0,0 @@
-/*
-Copyright 2014 Google Inc. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package fuzz
-
-import (
- "reflect"
- "testing"
- "time"
-)
-
-func TestFuzz_basic(t *testing.T) {
- obj := &struct {
- I int
- I8 int8
- I16 int16
- I32 int32
- I64 int64
- U uint
- U8 uint8
- U16 uint16
- U32 uint32
- U64 uint64
- Uptr uintptr
- S string
- B bool
- T time.Time
- }{}
-
- failed := map[string]int{}
- for i := 0; i < 10; i++ {
- New().Fuzz(obj)
-
- if n, v := "i", obj.I; v == 0 {
- failed[n] = failed[n] + 1
- }
- if n, v := "i8", obj.I8; v == 0 {
- failed[n] = failed[n] + 1
- }
- if n, v := "i16", obj.I16; v == 0 {
- failed[n] = failed[n] + 1
- }
- if n, v := "i32", obj.I32; v == 0 {
- failed[n] = failed[n] + 1
- }
- if n, v := "i64", obj.I64; v == 0 {
- failed[n] = failed[n] + 1
- }
- if n, v := "u", obj.U; v == 0 {
- failed[n] = failed[n] + 1
- }
- if n, v := "u8", obj.U8; v == 0 {
- failed[n] = failed[n] + 1
- }
- if n, v := "u16", obj.U16; v == 0 {
- failed[n] = failed[n] + 1
- }
- if n, v := "u32", obj.U32; v == 0 {
- failed[n] = failed[n] + 1
- }
- if n, v := "u64", obj.U64; v == 0 {
- failed[n] = failed[n] + 1
- }
- if n, v := "uptr", obj.Uptr; v == 0 {
- failed[n] = failed[n] + 1
- }
- if n, v := "s", obj.S; v == "" {
- failed[n] = failed[n] + 1
- }
- if n, v := "b", obj.B; v == false {
- failed[n] = failed[n] + 1
- }
- if n, v := "t", obj.T; v.IsZero() {
- failed[n] = failed[n] + 1
- }
- }
- checkFailed(t, failed)
-}
-
-func checkFailed(t *testing.T, failed map[string]int) {
- for k, v := range failed {
- if v > 8 {
- t.Errorf("%v seems to not be getting set, was zero value %v times", k, v)
- }
- }
-}
-
-func TestFuzz_structptr(t *testing.T) {
- obj := &struct {
- A *struct {
- S string
- }
- }{}
-
- f := New().NilChance(.5)
- failed := map[string]int{}
- for i := 0; i < 10; i++ {
- f.Fuzz(obj)
-
- if n, v := "a not nil", obj.A; v == nil {
- failed[n] = failed[n] + 1
- }
- if n, v := "a nil", obj.A; v != nil {
- failed[n] = failed[n] + 1
- }
- if n, v := "as", obj.A; v == nil || v.S == "" {
- failed[n] = failed[n] + 1
- }
- }
- checkFailed(t, failed)
-}
-
-// tryFuzz tries fuzzing up to 20 times. Fail if check() never passes, report the highest
-// stage it ever got to.
-func tryFuzz(t *testing.T, f *Fuzzer, obj interface{}, check func() (stage int, passed bool)) {
- maxStage := 0
- for i := 0; i < 20; i++ {
- f.Fuzz(obj)
- stage, passed := check()
- if stage > maxStage {
- maxStage = stage
- }
- if passed {
- return
- }
- }
- t.Errorf("Only ever got to stage %v", maxStage)
-}
-
-func TestFuzz_structmap(t *testing.T) {
- obj := &struct {
- A map[struct {
- S string
- }]struct {
- S2 string
- }
- B map[string]string
- }{}
-
- tryFuzz(t, New(), obj, func() (int, bool) {
- if obj.A == nil {
- return 1, false
- }
- if len(obj.A) == 0 {
- return 2, false
- }
- for k, v := range obj.A {
- if k.S == "" {
- return 3, false
- }
- if v.S2 == "" {
- return 4, false
- }
- }
-
- if obj.B == nil {
- return 5, false
- }
- if len(obj.B) == 0 {
- return 6, false
- }
- for k, v := range obj.B {
- if k == "" {
- return 7, false
- }
- if v == "" {
- return 8, false
- }
- }
- return 9, true
- })
-}
-
-func TestFuzz_structslice(t *testing.T) {
- obj := &struct {
- A []struct {
- S string
- }
- B []string
- }{}
-
- tryFuzz(t, New(), obj, func() (int, bool) {
- if obj.A == nil {
- return 1, false
- }
- if len(obj.A) == 0 {
- return 2, false
- }
- for _, v := range obj.A {
- if v.S == "" {
- return 3, false
- }
- }
-
- if obj.B == nil {
- return 4, false
- }
- if len(obj.B) == 0 {
- return 5, false
- }
- for _, v := range obj.B {
- if v == "" {
- return 6, false
- }
- }
- return 7, true
- })
-}
-
-func TestFuzz_structarray(t *testing.T) {
- obj := &struct {
- A [3]struct {
- S string
- }
- B [2]int
- }{}
-
- tryFuzz(t, New(), obj, func() (int, bool) {
- for _, v := range obj.A {
- if v.S == "" {
- return 1, false
- }
- }
-
- for _, v := range obj.B {
- if v == 0 {
- return 2, false
- }
- }
- return 3, true
- })
-}
-
-func TestFuzz_custom(t *testing.T) {
- obj := &struct {
- A string
- B *string
- C map[string]string
- D *map[string]string
- }{}
-
- testPhrase := "gotcalled"
- testMap := map[string]string{"C": "D"}
- f := New().Funcs(
- func(s *string, c Continue) {
- *s = testPhrase
- },
- func(m map[string]string, c Continue) {
- m["C"] = "D"
- },
- )
-
- tryFuzz(t, f, obj, func() (int, bool) {
- if obj.A != testPhrase {
- return 1, false
- }
- if obj.B == nil {
- return 2, false
- }
- if *obj.B != testPhrase {
- return 3, false
- }
- if e, a := testMap, obj.C; !reflect.DeepEqual(e, a) {
- return 4, false
- }
- if obj.D == nil {
- return 5, false
- }
- if e, a := testMap, *obj.D; !reflect.DeepEqual(e, a) {
- return 6, false
- }
- return 7, true
- })
-}
-
-type SelfFuzzer string
-
-// Implement fuzz.Interface.
-func (sf *SelfFuzzer) Fuzz(c Continue) {
- *sf = selfFuzzerTestPhrase
-}
-
-const selfFuzzerTestPhrase = "was fuzzed"
-
-func TestFuzz_interface(t *testing.T) {
- f := New()
-
- var obj1 SelfFuzzer
- tryFuzz(t, f, &obj1, func() (int, bool) {
- if obj1 != selfFuzzerTestPhrase {
- return 1, false
- }
- return 1, true
- })
-
- var obj2 map[int]SelfFuzzer
- tryFuzz(t, f, &obj2, func() (int, bool) {
- for _, v := range obj2 {
- if v != selfFuzzerTestPhrase {
- return 1, false
- }
- }
- return 1, true
- })
-}
-
-func TestFuzz_interfaceAndFunc(t *testing.T) {
- const privateTestPhrase = "private phrase"
- f := New().Funcs(
- // This should take precedence over SelfFuzzer.Fuzz().
- func(s *SelfFuzzer, c Continue) {
- *s = privateTestPhrase
- },
- )
-
- var obj1 SelfFuzzer
- tryFuzz(t, f, &obj1, func() (int, bool) {
- if obj1 != privateTestPhrase {
- return 1, false
- }
- return 1, true
- })
-
- var obj2 map[int]SelfFuzzer
- tryFuzz(t, f, &obj2, func() (int, bool) {
- for _, v := range obj2 {
- if v != privateTestPhrase {
- return 1, false
- }
- }
- return 1, true
- })
-}
-
-func TestFuzz_noCustom(t *testing.T) {
- type Inner struct {
- Str string
- }
- type Outer struct {
- Str string
- In Inner
- }
-
- testPhrase := "gotcalled"
- f := New().Funcs(
- func(outer *Outer, c Continue) {
- outer.Str = testPhrase
- c.Fuzz(&outer.In)
- },
- func(inner *Inner, c Continue) {
- inner.Str = testPhrase
- },
- )
- c := Continue{fc: &fuzzerContext{fuzzer: f}, Rand: f.r}
-
- // Fuzzer.Fuzz()
- obj1 := Outer{}
- f.Fuzz(&obj1)
- if obj1.Str != testPhrase {
- t.Errorf("expected Outer custom function to have been called")
- }
- if obj1.In.Str != testPhrase {
- t.Errorf("expected Inner custom function to have been called")
- }
-
- // Continue.Fuzz()
- obj2 := Outer{}
- c.Fuzz(&obj2)
- if obj2.Str != testPhrase {
- t.Errorf("expected Outer custom function to have been called")
- }
- if obj2.In.Str != testPhrase {
- t.Errorf("expected Inner custom function to have been called")
- }
-
- // Fuzzer.FuzzNoCustom()
- obj3 := Outer{}
- f.FuzzNoCustom(&obj3)
- if obj3.Str == testPhrase {
- t.Errorf("expected Outer custom function to not have been called")
- }
- if obj3.In.Str != testPhrase {
- t.Errorf("expected Inner custom function to have been called")
- }
-
- // Continue.FuzzNoCustom()
- obj4 := Outer{}
- c.FuzzNoCustom(&obj4)
- if obj4.Str == testPhrase {
- t.Errorf("expected Outer custom function to not have been called")
- }
- if obj4.In.Str != testPhrase {
- t.Errorf("expected Inner custom function to have been called")
- }
-}
-
-func TestFuzz_NumElements(t *testing.T) {
- f := New().NilChance(0).NumElements(0, 1)
- obj := &struct {
- A []int
- }{}
-
- tryFuzz(t, f, obj, func() (int, bool) {
- if obj.A == nil {
- return 1, false
- }
- return 2, len(obj.A) == 0
- })
- tryFuzz(t, f, obj, func() (int, bool) {
- if obj.A == nil {
- return 3, false
- }
- return 4, len(obj.A) == 1
- })
-}
-
-func TestFuzz_Maxdepth(t *testing.T) {
- type S struct {
- S *S
- }
-
- f := New().NilChance(0)
-
- f.MaxDepth(1)
- for i := 0; i < 100; i++ {
- obj := S{}
- f.Fuzz(&obj)
-
- if obj.S != nil {
- t.Errorf("Expected nil")
- }
- }
-
- f.MaxDepth(3) // field, ptr
- for i := 0; i < 100; i++ {
- obj := S{}
- f.Fuzz(&obj)
-
- if obj.S == nil {
- t.Errorf("Expected obj.S not nil")
- } else if obj.S.S != nil {
- t.Errorf("Expected obj.S.S nil")
- }
- }
-
- f.MaxDepth(5) // field, ptr, field, ptr
- for i := 0; i < 100; i++ {
- obj := S{}
- f.Fuzz(&obj)
-
- if obj.S == nil {
- t.Errorf("Expected obj.S not nil")
- } else if obj.S.S == nil {
- t.Errorf("Expected obj.S.S not nil")
- } else if obj.S.S.S != nil {
- t.Errorf("Expected obj.S.S.S nil")
- }
- }
-}
diff --git a/vendor/github.com/googleapis/gnostic/gnostic_test.go b/vendor/github.com/googleapis/gnostic/gnostic_test.go
deleted file mode 100644
index 22eaee827..000000000
--- a/vendor/github.com/googleapis/gnostic/gnostic_test.go
+++ /dev/null
@@ -1,453 +0,0 @@
-package main
-
-import (
- "io/ioutil"
- "os"
- "os/exec"
- "path/filepath"
- "strings"
- "testing"
-)
-
-func testCompiler(t *testing.T, inputFile string, referenceFile string, expectErrors bool) {
- textFile := strings.Replace(filepath.Base(inputFile), filepath.Ext(inputFile), ".text", 1)
- errorsFile := strings.Replace(filepath.Base(inputFile), filepath.Ext(inputFile), ".errors", 1)
- // remove any preexisting output files
- os.Remove(textFile)
- os.Remove(errorsFile)
- // run the compiler
- var err error
- var cmd = exec.Command(
- "gnostic",
- inputFile,
- "--text-out=.",
- "--errors-out=.",
- "--resolve-refs")
- //t.Log(cmd.Args)
- err = cmd.Run()
- if err != nil && !expectErrors {
- t.Logf("Compile failed: %+v", err)
- t.FailNow()
- }
- // verify the output against a reference
- var outputFile string
- if expectErrors {
- outputFile = errorsFile
- } else {
- outputFile = textFile
- }
- err = exec.Command("diff", outputFile, referenceFile).Run()
- if err != nil {
- t.Logf("Diff failed: %+v", err)
- t.FailNow()
- } else {
- // if the test succeeded, clean up
- os.Remove(textFile)
- os.Remove(errorsFile)
- }
-}
-
-func testNormal(t *testing.T, inputFile string, referenceFile string) {
- testCompiler(t, inputFile, referenceFile, false)
-}
-
-func testErrors(t *testing.T, inputFile string, referenceFile string) {
- testCompiler(t, inputFile, referenceFile, true)
-}
-
-func TestPetstoreJSON(t *testing.T) {
- testNormal(t,
- "examples/v2.0/json/petstore.json",
- "test/v2.0/petstore.text")
-}
-
-func TestPetstoreYAML(t *testing.T) {
- testNormal(t,
- "examples/v2.0/yaml/petstore.yaml",
- "test/v2.0/petstore.text")
-}
-
-func TestSeparateYAML(t *testing.T) {
- testNormal(t,
- "examples/v2.0/yaml/petstore-separate/spec/swagger.yaml",
- "test/v2.0/yaml/petstore-separate/spec/swagger.text")
-}
-
-func TestSeparateJSON(t *testing.T) {
- testNormal(t,
- "examples/v2.0/json/petstore-separate/spec/swagger.json",
- "test/v2.0/yaml/petstore-separate/spec/swagger.text") // yaml and json results should be identical
-}
-
-func TestRemotePetstoreJSON(t *testing.T) {
- testNormal(t,
- "https://raw.githubusercontent.com/googleapis/openapi-compiler/master/examples/v2.0/json/petstore.json",
- "test/v2.0/petstore.text")
-}
-
-func TestRemotePetstoreYAML(t *testing.T) {
- testNormal(t,
- "https://raw.githubusercontent.com/googleapis/openapi-compiler/master/examples/v2.0/yaml/petstore.yaml",
- "test/v2.0/petstore.text")
-}
-
-func TestRemoteSeparateYAML(t *testing.T) {
- testNormal(t,
- "https://raw.githubusercontent.com/googleapis/openapi-compiler/master/examples/v2.0/yaml/petstore-separate/spec/swagger.yaml",
- "test/v2.0/yaml/petstore-separate/spec/swagger.text")
-}
-
-func TestRemoteSeparateJSON(t *testing.T) {
- testNormal(t,
- "https://raw.githubusercontent.com/googleapis/openapi-compiler/master/examples/v2.0/json/petstore-separate/spec/swagger.json",
- "test/v2.0/yaml/petstore-separate/spec/swagger.text")
-}
-
-func TestErrorBadProperties(t *testing.T) {
- testErrors(t,
- "examples/errors/petstore-badproperties.yaml",
- "test/errors/petstore-badproperties.errors")
-}
-
-func TestErrorUnresolvedRefs(t *testing.T) {
- testErrors(t,
- "examples/errors/petstore-unresolvedrefs.yaml",
- "test/errors/petstore-unresolvedrefs.errors")
-}
-
-func TestErrorMissingVersion(t *testing.T) {
- testErrors(t,
- "examples/errors/petstore-missingversion.yaml",
- "test/errors/petstore-missingversion.errors")
-}
-
-func testPlugin(t *testing.T, plugin string, inputFile string, outputFile string, referenceFile string) {
- // remove any preexisting output files
- os.Remove(outputFile)
- // run the compiler
- var err error
- output, err := exec.Command(
- "gnostic",
- "--"+plugin+"-out=-",
- inputFile).Output()
- if err != nil {
- t.Logf("Compile failed: %+v", err)
- t.FailNow()
- }
- _ = ioutil.WriteFile(outputFile, output, 0644)
- err = exec.Command("diff", outputFile, referenceFile).Run()
- if err != nil {
- t.Logf("Diff failed: %+v", err)
- t.FailNow()
- } else {
- // if the test succeeded, clean up
- os.Remove(outputFile)
- }
-}
-
-func TestSamplePluginWithPetstore(t *testing.T) {
- testPlugin(t,
- "summary",
- "examples/v2.0/yaml/petstore.yaml",
- "sample-petstore.out",
- "test/v2.0/yaml/sample-petstore.out")
-}
-
-func TestErrorInvalidPluginInvocations(t *testing.T) {
- var err error
- output, err := exec.Command(
- "gnostic",
- "examples/v2.0/yaml/petstore.yaml",
- "--errors-out=-",
- "--plugin-out=foo=bar,:abc",
- "--plugin-out=,foo=bar:abc",
- "--plugin-out=foo=:abc",
- "--plugin-out==bar:abc",
- "--plugin-out=,,:abc",
- "--plugin-out=foo=bar=baz:abc",
- ).Output()
- if err == nil {
- t.Logf("Invalid invocations were accepted")
- t.FailNow()
- }
- outputFile := "invalid-plugin-invocation.errors"
- _ = ioutil.WriteFile(outputFile, output, 0644)
- err = exec.Command("diff", outputFile, "test/errors/invalid-plugin-invocation.errors").Run()
- if err != nil {
- t.Logf("Diff failed: %+v", err)
- t.FailNow()
- } else {
- // if the test succeeded, clean up
- os.Remove(outputFile)
- }
-}
-
-func TestValidPluginInvocations(t *testing.T) {
- var err error
- output, err := exec.Command(
- "gnostic",
- "examples/v2.0/yaml/petstore.yaml",
- "--errors-out=-",
- // verify an invocation with no parameters
- "--summary-out=!", // "!" indicates that no output should be generated
- // verify single pair of parameters
- "--summary-out=a=b:!",
- // verify multiple parameters
- "--summary-out=a=b,c=123,xyz=alphabetagammadelta:!",
- // verify that special characters / . - _ can be included in parameter keys and values
- "--summary-out=a/b/c=x/y/z:!",
- "--summary-out=a.b.c=x.y.z:!",
- "--summary-out=a-b-c=x-y-z:!",
- "--summary-out=a_b_c=x_y_z:!",
- ).Output()
- if len(output) != 0 {
- t.Logf("Valid invocations generated invalid errors\n%s", string(output))
- t.FailNow()
- }
- if err != nil {
- t.Logf("Valid invocations were not accepted")
- t.FailNow()
- }
-}
-
-func TestExtensionHandlerWithLibraryExample(t *testing.T) {
- outputFile := "library-example-with-ext.text.out"
- inputFile := "test/library-example-with-ext.json"
- referenceFile := "test/library-example-with-ext.text.out"
-
- os.Remove(outputFile)
- // run the compiler
- var err error
-
- command := exec.Command(
- "gnostic",
- "--x-sampleone",
- "--x-sampletwo",
- "--text-out="+outputFile,
- "--resolve-refs",
- inputFile)
-
- _, err = command.Output()
- if err != nil {
- t.Logf("Compile failed for command %v: %+v", command, err)
- t.FailNow()
- }
- //_ = ioutil.WriteFile(outputFile, output, 0644)
- err = exec.Command("diff", outputFile, referenceFile).Run()
- if err != nil {
- t.Logf("Diff failed: %+v", err)
- t.FailNow()
- } else {
- // if the test succeeded, clean up
- os.Remove(outputFile)
- }
-}
-
-func TestJSONOutput(t *testing.T) {
- inputFile := "test/library-example-with-ext.json"
-
- textFile := "sample.text"
- jsonFile := "sample.json"
- textFile2 := "sample2.text"
- jsonFile2 := "sample2.json"
-
- os.Remove(textFile)
- os.Remove(jsonFile)
- os.Remove(textFile2)
- os.Remove(jsonFile2)
-
- var err error
-
- // Run the compiler once.
- command := exec.Command(
- "gnostic",
- "--text-out="+textFile,
- "--json-out="+jsonFile,
- inputFile)
- _, err = command.Output()
- if err != nil {
- t.Logf("Compile failed for command %v: %+v", command, err)
- t.FailNow()
- }
-
- // Run the compiler again, this time on the generated output.
- command = exec.Command(
- "gnostic",
- "--text-out="+textFile2,
- "--json-out="+jsonFile2,
- jsonFile)
- _, err = command.Output()
- if err != nil {
- t.Logf("Compile failed for command %v: %+v", command, err)
- t.FailNow()
- }
-
- // Verify that both models have the same internal representation.
- err = exec.Command("diff", textFile, textFile2).Run()
- if err != nil {
- t.Logf("Diff failed: %+v", err)
- t.FailNow()
- } else {
- // if the test succeeded, clean up
- os.Remove(textFile)
- os.Remove(jsonFile)
- os.Remove(textFile2)
- os.Remove(jsonFile2)
- }
-}
-
-func TestYAMLOutput(t *testing.T) {
- inputFile := "test/library-example-with-ext.json"
-
- textFile := "sample.text"
- yamlFile := "sample.yaml"
- textFile2 := "sample2.text"
- yamlFile2 := "sample2.yaml"
-
- os.Remove(textFile)
- os.Remove(yamlFile)
- os.Remove(textFile2)
- os.Remove(yamlFile2)
-
- var err error
-
- // Run the compiler once.
- command := exec.Command(
- "gnostic",
- "--text-out="+textFile,
- "--yaml-out="+yamlFile,
- inputFile)
- _, err = command.Output()
- if err != nil {
- t.Logf("Compile failed for command %v: %+v", command, err)
- t.FailNow()
- }
-
- // Run the compiler again, this time on the generated output.
- command = exec.Command(
- "gnostic",
- "--text-out="+textFile2,
- "--yaml-out="+yamlFile2,
- yamlFile)
- _, err = command.Output()
- if err != nil {
- t.Logf("Compile failed for command %v: %+v", command, err)
- t.FailNow()
- }
-
- // Verify that both models have the same internal representation.
- err = exec.Command("diff", textFile, textFile2).Run()
- if err != nil {
- t.Logf("Diff failed: %+v", err)
- t.FailNow()
- } else {
- // if the test succeeded, clean up
- os.Remove(textFile)
- os.Remove(yamlFile)
- os.Remove(textFile2)
- os.Remove(yamlFile2)
- }
-}
-
-func testBuilder(version string, t *testing.T) {
- var err error
-
- pbFile := "petstore-" + version + ".pb"
- yamlFile := "petstore.yaml"
- jsonFile := "petstore.json"
- textFile := "petstore.text"
- textReference := "test/" + version + ".0/petstore.text"
-
- os.Remove(pbFile)
- os.Remove(textFile)
- os.Remove(yamlFile)
- os.Remove(jsonFile)
-
- // Generate petstore.pb.
- command := exec.Command(
- "petstore-builder",
- "--"+version)
- _, err = command.Output()
- if err != nil {
- t.Logf("Command %v failed: %+v", command, err)
- t.FailNow()
- }
-
- // Convert petstore.pb to yaml and json.
- command = exec.Command(
- "gnostic",
- pbFile,
- "--json-out="+jsonFile,
- "--yaml-out="+yamlFile)
- _, err = command.Output()
- if err != nil {
- t.Logf("Command %v failed: %+v", command, err)
- t.FailNow()
- }
-
- // Read petstore.yaml, resolve references, and export text.
- command = exec.Command(
- "gnostic",
- yamlFile,
- "--resolve-refs",
- "--text-out="+textFile)
- _, err = command.Output()
- if err != nil {
- t.Logf("Command %v failed: %+v", command, err)
- t.FailNow()
- }
-
- // Verify that the generated text matches our reference.
- err = exec.Command("diff", textFile, textReference).Run()
- if err != nil {
- t.Logf("Diff failed: %+v", err)
- t.FailNow()
- }
-
- // Read petstore.json, resolve references, and export text.
- command = exec.Command(
- "gnostic",
- jsonFile,
- "--resolve-refs",
- "--text-out="+textFile)
- _, err = command.Output()
- if err != nil {
- t.Logf("Command %v failed: %+v", command, err)
- t.FailNow()
- }
-
- // Verify that the generated text matches our reference.
- err = exec.Command("diff", textFile, textReference).Run()
- if err != nil {
- t.Logf("Diff failed: %+v", err)
- t.FailNow()
- }
-
- // if the test succeeded, clean up
- os.Remove(pbFile)
- os.Remove(textFile)
- os.Remove(yamlFile)
- os.Remove(jsonFile)
-}
-
-func TestBuilderV2(t *testing.T) {
- testBuilder("v2", t)
-}
-
-func TestBuilderV3(t *testing.T) {
- testBuilder("v3", t)
-}
-
-// OpenAPI 3.0 tests
-
-func TestPetstoreYAML_30(t *testing.T) {
- testNormal(t,
- "examples/v3.0/yaml/petstore.yaml",
- "test/v3.0/petstore.text")
-}
-
-func TestPetstoreJSON_30(t *testing.T) {
- testNormal(t,
- "examples/v3.0/json/petstore.json",
- "test/v3.0/petstore.text")
-}
diff --git a/vendor/github.com/gregjones/httpcache/diskcache/diskcache_test.go b/vendor/github.com/gregjones/httpcache/diskcache/diskcache_test.go
deleted file mode 100644
index 35c76cbd1..000000000
--- a/vendor/github.com/gregjones/httpcache/diskcache/diskcache_test.go
+++ /dev/null
@@ -1,42 +0,0 @@
-package diskcache
-
-import (
- "bytes"
- "io/ioutil"
- "os"
- "testing"
-)
-
-func TestDiskCache(t *testing.T) {
- tempDir, err := ioutil.TempDir("", "httpcache")
- if err != nil {
- t.Fatalf("TempDir: %v", err)
- }
- defer os.RemoveAll(tempDir)
-
- cache := New(tempDir)
-
- key := "testKey"
- _, ok := cache.Get(key)
- if ok {
- t.Fatal("retrieved key before adding it")
- }
-
- val := []byte("some bytes")
- cache.Set(key, val)
-
- retVal, ok := cache.Get(key)
- if !ok {
- t.Fatal("could not retrieve an element we just added")
- }
- if !bytes.Equal(retVal, val) {
- t.Fatal("retrieved a different value than what we put in")
- }
-
- cache.Delete(key)
-
- _, ok = cache.Get(key)
- if ok {
- t.Fatal("deleted key still present")
- }
-}
diff --git a/vendor/github.com/gregjones/httpcache/httpcache_test.go b/vendor/github.com/gregjones/httpcache/httpcache_test.go
deleted file mode 100644
index a50464180..000000000
--- a/vendor/github.com/gregjones/httpcache/httpcache_test.go
+++ /dev/null
@@ -1,1475 +0,0 @@
-package httpcache
-
-import (
- "bytes"
- "errors"
- "flag"
- "io"
- "io/ioutil"
- "net/http"
- "net/http/httptest"
- "os"
- "strconv"
- "testing"
- "time"
-)
-
-var s struct {
- server *httptest.Server
- client http.Client
- transport *Transport
- done chan struct{} // Closed to unlock infinite handlers.
-}
-
-type fakeClock struct {
- elapsed time.Duration
-}
-
-func (c *fakeClock) since(t time.Time) time.Duration {
- return c.elapsed
-}
-
-func TestMain(m *testing.M) {
- flag.Parse()
- setup()
- code := m.Run()
- teardown()
- os.Exit(code)
-}
-
-func setup() {
- tp := NewMemoryCacheTransport()
- client := http.Client{Transport: tp}
- s.transport = tp
- s.client = client
- s.done = make(chan struct{})
-
- mux := http.NewServeMux()
- s.server = httptest.NewServer(mux)
-
- mux.HandleFunc("/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Cache-Control", "max-age=3600")
- }))
-
- mux.HandleFunc("/method", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Cache-Control", "max-age=3600")
- w.Write([]byte(r.Method))
- }))
-
- mux.HandleFunc("/range", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- lm := "Fri, 14 Dec 2010 01:01:50 GMT"
- if r.Header.Get("if-modified-since") == lm {
- w.WriteHeader(http.StatusNotModified)
- return
- }
- w.Header().Set("last-modified", lm)
- if r.Header.Get("range") == "bytes=4-9" {
- w.WriteHeader(http.StatusPartialContent)
- w.Write([]byte(" text "))
- return
- }
- w.Write([]byte("Some text content"))
- }))
-
- mux.HandleFunc("/nostore", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Cache-Control", "no-store")
- }))
-
- mux.HandleFunc("/etag", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- etag := "124567"
- if r.Header.Get("if-none-match") == etag {
- w.WriteHeader(http.StatusNotModified)
- return
- }
- w.Header().Set("etag", etag)
- }))
-
- mux.HandleFunc("/lastmodified", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- lm := "Fri, 14 Dec 2010 01:01:50 GMT"
- if r.Header.Get("if-modified-since") == lm {
- w.WriteHeader(http.StatusNotModified)
- return
- }
- w.Header().Set("last-modified", lm)
- }))
-
- mux.HandleFunc("/varyaccept", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Cache-Control", "max-age=3600")
- w.Header().Set("Content-Type", "text/plain")
- w.Header().Set("Vary", "Accept")
- w.Write([]byte("Some text content"))
- }))
-
- mux.HandleFunc("/doublevary", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Cache-Control", "max-age=3600")
- w.Header().Set("Content-Type", "text/plain")
- w.Header().Set("Vary", "Accept, Accept-Language")
- w.Write([]byte("Some text content"))
- }))
- mux.HandleFunc("/2varyheaders", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Cache-Control", "max-age=3600")
- w.Header().Set("Content-Type", "text/plain")
- w.Header().Add("Vary", "Accept")
- w.Header().Add("Vary", "Accept-Language")
- w.Write([]byte("Some text content"))
- }))
- mux.HandleFunc("/varyunused", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Cache-Control", "max-age=3600")
- w.Header().Set("Content-Type", "text/plain")
- w.Header().Set("Vary", "X-Madeup-Header")
- w.Write([]byte("Some text content"))
- }))
-
- mux.HandleFunc("/cachederror", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- etag := "abc"
- if r.Header.Get("if-none-match") == etag {
- w.WriteHeader(http.StatusNotModified)
- return
- }
- w.Header().Set("etag", etag)
- w.WriteHeader(http.StatusNotFound)
- w.Write([]byte("Not found"))
- }))
-
- updateFieldsCounter := 0
- mux.HandleFunc("/updatefields", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("X-Counter", strconv.Itoa(updateFieldsCounter))
- w.Header().Set("Etag", `"e"`)
- updateFieldsCounter++
- if r.Header.Get("if-none-match") != "" {
- w.WriteHeader(http.StatusNotModified)
- return
- }
- w.Write([]byte("Some text content"))
- }))
-
- // Take 3 seconds to return 200 OK (for testing client timeouts).
- mux.HandleFunc("/3seconds", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- time.Sleep(3 * time.Second)
- }))
-
- mux.HandleFunc("/infinite", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- for {
- select {
- case <-s.done:
- return
- default:
- w.Write([]byte{0})
- }
- }
- }))
-}
-
-func teardown() {
- close(s.done)
- s.server.Close()
-}
-
-func resetTest() {
- s.transport.Cache = NewMemoryCache()
- clock = &realClock{}
-}
-
-// TestCacheableMethod ensures that uncacheable method does not get stored
-// in cache and get incorrectly used for a following cacheable method request.
-func TestCacheableMethod(t *testing.T) {
- resetTest()
- {
- req, err := http.NewRequest("POST", s.server.URL+"/method", nil)
- if err != nil {
- t.Fatal(err)
- }
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- var buf bytes.Buffer
- _, err = io.Copy(&buf, resp.Body)
- if err != nil {
- t.Fatal(err)
- }
- err = resp.Body.Close()
- if err != nil {
- t.Fatal(err)
- }
- if got, want := buf.String(), "POST"; got != want {
- t.Errorf("got %q, want %q", got, want)
- }
- if resp.StatusCode != http.StatusOK {
- t.Errorf("response status code isn't 200 OK: %v", resp.StatusCode)
- }
- }
- {
- req, err := http.NewRequest("GET", s.server.URL+"/method", nil)
- if err != nil {
- t.Fatal(err)
- }
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- var buf bytes.Buffer
- _, err = io.Copy(&buf, resp.Body)
- if err != nil {
- t.Fatal(err)
- }
- err = resp.Body.Close()
- if err != nil {
- t.Fatal(err)
- }
- if got, want := buf.String(), "GET"; got != want {
- t.Errorf("got wrong body %q, want %q", got, want)
- }
- if resp.StatusCode != http.StatusOK {
- t.Errorf("response status code isn't 200 OK: %v", resp.StatusCode)
- }
- if resp.Header.Get(XFromCache) != "" {
- t.Errorf("XFromCache header isn't blank")
- }
- }
-}
-
-func TestDontServeHeadResponseToGetRequest(t *testing.T) {
- resetTest()
- url := s.server.URL + "/"
- req, err := http.NewRequest(http.MethodHead, url, nil)
- if err != nil {
- t.Fatal(err)
- }
- _, err = s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- req, err = http.NewRequest(http.MethodGet, url, nil)
- if err != nil {
- t.Fatal(err)
- }
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- if resp.Header.Get(XFromCache) != "" {
- t.Errorf("Cache should not match")
- }
-}
-
-func TestDontStorePartialRangeInCache(t *testing.T) {
- resetTest()
- {
- req, err := http.NewRequest("GET", s.server.URL+"/range", nil)
- if err != nil {
- t.Fatal(err)
- }
- req.Header.Set("range", "bytes=4-9")
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- var buf bytes.Buffer
- _, err = io.Copy(&buf, resp.Body)
- if err != nil {
- t.Fatal(err)
- }
- err = resp.Body.Close()
- if err != nil {
- t.Fatal(err)
- }
- if got, want := buf.String(), " text "; got != want {
- t.Errorf("got %q, want %q", got, want)
- }
- if resp.StatusCode != http.StatusPartialContent {
- t.Errorf("response status code isn't 206 Partial Content: %v", resp.StatusCode)
- }
- }
- {
- req, err := http.NewRequest("GET", s.server.URL+"/range", nil)
- if err != nil {
- t.Fatal(err)
- }
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- var buf bytes.Buffer
- _, err = io.Copy(&buf, resp.Body)
- if err != nil {
- t.Fatal(err)
- }
- err = resp.Body.Close()
- if err != nil {
- t.Fatal(err)
- }
- if got, want := buf.String(), "Some text content"; got != want {
- t.Errorf("got %q, want %q", got, want)
- }
- if resp.StatusCode != http.StatusOK {
- t.Errorf("response status code isn't 200 OK: %v", resp.StatusCode)
- }
- if resp.Header.Get(XFromCache) != "" {
- t.Error("XFromCache header isn't blank")
- }
- }
- {
- req, err := http.NewRequest("GET", s.server.URL+"/range", nil)
- if err != nil {
- t.Fatal(err)
- }
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- var buf bytes.Buffer
- _, err = io.Copy(&buf, resp.Body)
- if err != nil {
- t.Fatal(err)
- }
- err = resp.Body.Close()
- if err != nil {
- t.Fatal(err)
- }
- if got, want := buf.String(), "Some text content"; got != want {
- t.Errorf("got %q, want %q", got, want)
- }
- if resp.StatusCode != http.StatusOK {
- t.Errorf("response status code isn't 200 OK: %v", resp.StatusCode)
- }
- if resp.Header.Get(XFromCache) != "1" {
- t.Errorf(`XFromCache header isn't "1": %v`, resp.Header.Get(XFromCache))
- }
- }
- {
- req, err := http.NewRequest("GET", s.server.URL+"/range", nil)
- if err != nil {
- t.Fatal(err)
- }
- req.Header.Set("range", "bytes=4-9")
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- var buf bytes.Buffer
- _, err = io.Copy(&buf, resp.Body)
- if err != nil {
- t.Fatal(err)
- }
- err = resp.Body.Close()
- if err != nil {
- t.Fatal(err)
- }
- if got, want := buf.String(), " text "; got != want {
- t.Errorf("got %q, want %q", got, want)
- }
- if resp.StatusCode != http.StatusPartialContent {
- t.Errorf("response status code isn't 206 Partial Content: %v", resp.StatusCode)
- }
- }
-}
-
-func TestCacheOnlyIfBodyRead(t *testing.T) {
- resetTest()
- {
- req, err := http.NewRequest("GET", s.server.URL, nil)
- if err != nil {
- t.Fatal(err)
- }
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- if resp.Header.Get(XFromCache) != "" {
- t.Fatal("XFromCache header isn't blank")
- }
- // We do not read the body
- resp.Body.Close()
- }
- {
- req, err := http.NewRequest("GET", s.server.URL, nil)
- if err != nil {
- t.Fatal(err)
- }
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get(XFromCache) != "" {
- t.Fatalf("XFromCache header isn't blank")
- }
- }
-}
-
-func TestOnlyReadBodyOnDemand(t *testing.T) {
- resetTest()
-
- req, err := http.NewRequest("GET", s.server.URL+"/infinite", nil)
- if err != nil {
- t.Fatal(err)
- }
- resp, err := s.client.Do(req) // This shouldn't hang forever.
- if err != nil {
- t.Fatal(err)
- }
- buf := make([]byte, 10) // Only partially read the body.
- _, err = resp.Body.Read(buf)
- if err != nil {
- t.Fatal(err)
- }
- resp.Body.Close()
-}
-
-func TestGetOnlyIfCachedHit(t *testing.T) {
- resetTest()
- {
- req, err := http.NewRequest("GET", s.server.URL, nil)
- if err != nil {
- t.Fatal(err)
- }
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get(XFromCache) != "" {
- t.Fatal("XFromCache header isn't blank")
- }
- _, err = ioutil.ReadAll(resp.Body)
- if err != nil {
- t.Fatal(err)
- }
- }
- {
- req, err := http.NewRequest("GET", s.server.URL, nil)
- if err != nil {
- t.Fatal(err)
- }
- req.Header.Add("cache-control", "only-if-cached")
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get(XFromCache) != "1" {
- t.Fatalf(`XFromCache header isn't "1": %v`, resp.Header.Get(XFromCache))
- }
- if resp.StatusCode != http.StatusOK {
- t.Fatalf("response status code isn't 200 OK: %v", resp.StatusCode)
- }
- }
-}
-
-func TestGetOnlyIfCachedMiss(t *testing.T) {
- resetTest()
- req, err := http.NewRequest("GET", s.server.URL, nil)
- if err != nil {
- t.Fatal(err)
- }
- req.Header.Add("cache-control", "only-if-cached")
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get(XFromCache) != "" {
- t.Fatal("XFromCache header isn't blank")
- }
- if resp.StatusCode != http.StatusGatewayTimeout {
- t.Fatalf("response status code isn't 504 GatewayTimeout: %v", resp.StatusCode)
- }
-}
-
-func TestGetNoStoreRequest(t *testing.T) {
- resetTest()
- req, err := http.NewRequest("GET", s.server.URL, nil)
- if err != nil {
- t.Fatal(err)
- }
- req.Header.Add("Cache-Control", "no-store")
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get(XFromCache) != "" {
- t.Fatal("XFromCache header isn't blank")
- }
- }
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get(XFromCache) != "" {
- t.Fatal("XFromCache header isn't blank")
- }
- }
-}
-
-func TestGetNoStoreResponse(t *testing.T) {
- resetTest()
- req, err := http.NewRequest("GET", s.server.URL+"/nostore", nil)
- if err != nil {
- t.Fatal(err)
- }
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get(XFromCache) != "" {
- t.Fatal("XFromCache header isn't blank")
- }
- }
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get(XFromCache) != "" {
- t.Fatal("XFromCache header isn't blank")
- }
- }
-}
-
-func TestGetWithEtag(t *testing.T) {
- resetTest()
- req, err := http.NewRequest("GET", s.server.URL+"/etag", nil)
- if err != nil {
- t.Fatal(err)
- }
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get(XFromCache) != "" {
- t.Fatal("XFromCache header isn't blank")
- }
- _, err = ioutil.ReadAll(resp.Body)
- if err != nil {
- t.Fatal(err)
- }
-
- }
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get(XFromCache) != "1" {
- t.Fatalf(`XFromCache header isn't "1": %v`, resp.Header.Get(XFromCache))
- }
- // additional assertions to verify that 304 response is converted properly
- if resp.StatusCode != http.StatusOK {
- t.Fatalf("response status code isn't 200 OK: %v", resp.StatusCode)
- }
- if _, ok := resp.Header["Connection"]; ok {
- t.Fatalf("Connection header isn't absent")
- }
- }
-}
-
-func TestGetWithLastModified(t *testing.T) {
- resetTest()
- req, err := http.NewRequest("GET", s.server.URL+"/lastmodified", nil)
- if err != nil {
- t.Fatal(err)
- }
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get(XFromCache) != "" {
- t.Fatal("XFromCache header isn't blank")
- }
- _, err = ioutil.ReadAll(resp.Body)
- if err != nil {
- t.Fatal(err)
- }
- }
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get(XFromCache) != "1" {
- t.Fatalf(`XFromCache header isn't "1": %v`, resp.Header.Get(XFromCache))
- }
- }
-}
-
-func TestGetWithVary(t *testing.T) {
- resetTest()
- req, err := http.NewRequest("GET", s.server.URL+"/varyaccept", nil)
- if err != nil {
- t.Fatal(err)
- }
- req.Header.Set("Accept", "text/plain")
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get("Vary") != "Accept" {
- t.Fatalf(`Vary header isn't "Accept": %v`, resp.Header.Get("Vary"))
- }
- _, err = ioutil.ReadAll(resp.Body)
- if err != nil {
- t.Fatal(err)
- }
- }
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get(XFromCache) != "1" {
- t.Fatalf(`XFromCache header isn't "1": %v`, resp.Header.Get(XFromCache))
- }
- }
- req.Header.Set("Accept", "text/html")
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get(XFromCache) != "" {
- t.Fatal("XFromCache header isn't blank")
- }
- }
- req.Header.Set("Accept", "")
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get(XFromCache) != "" {
- t.Fatal("XFromCache header isn't blank")
- }
- }
-}
-
-func TestGetWithDoubleVary(t *testing.T) {
- resetTest()
- req, err := http.NewRequest("GET", s.server.URL+"/doublevary", nil)
- if err != nil {
- t.Fatal(err)
- }
- req.Header.Set("Accept", "text/plain")
- req.Header.Set("Accept-Language", "da, en-gb;q=0.8, en;q=0.7")
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get("Vary") == "" {
- t.Fatalf(`Vary header is blank`)
- }
- _, err = ioutil.ReadAll(resp.Body)
- if err != nil {
- t.Fatal(err)
- }
- }
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get(XFromCache) != "1" {
- t.Fatalf(`XFromCache header isn't "1": %v`, resp.Header.Get(XFromCache))
- }
- }
- req.Header.Set("Accept-Language", "")
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get(XFromCache) != "" {
- t.Fatal("XFromCache header isn't blank")
- }
- }
- req.Header.Set("Accept-Language", "da")
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get(XFromCache) != "" {
- t.Fatal("XFromCache header isn't blank")
- }
- }
-}
-
-func TestGetWith2VaryHeaders(t *testing.T) {
- resetTest()
- // Tests that multiple Vary headers' comma-separated lists are
- // merged. See https://github.com/gregjones/httpcache/issues/27.
- const (
- accept = "text/plain"
- acceptLanguage = "da, en-gb;q=0.8, en;q=0.7"
- )
- req, err := http.NewRequest("GET", s.server.URL+"/2varyheaders", nil)
- if err != nil {
- t.Fatal(err)
- }
- req.Header.Set("Accept", accept)
- req.Header.Set("Accept-Language", acceptLanguage)
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get("Vary") == "" {
- t.Fatalf(`Vary header is blank`)
- }
- _, err = ioutil.ReadAll(resp.Body)
- if err != nil {
- t.Fatal(err)
- }
- }
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get(XFromCache) != "1" {
- t.Fatalf(`XFromCache header isn't "1": %v`, resp.Header.Get(XFromCache))
- }
- }
- req.Header.Set("Accept-Language", "")
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get(XFromCache) != "" {
- t.Fatal("XFromCache header isn't blank")
- }
- }
- req.Header.Set("Accept-Language", "da")
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get(XFromCache) != "" {
- t.Fatal("XFromCache header isn't blank")
- }
- }
- req.Header.Set("Accept-Language", acceptLanguage)
- req.Header.Set("Accept", "")
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get(XFromCache) != "" {
- t.Fatal("XFromCache header isn't blank")
- }
- }
- req.Header.Set("Accept", "image/png")
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get(XFromCache) != "" {
- t.Fatal("XFromCache header isn't blank")
- }
- _, err = ioutil.ReadAll(resp.Body)
- if err != nil {
- t.Fatal(err)
- }
- }
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get(XFromCache) != "1" {
- t.Fatalf(`XFromCache header isn't "1": %v`, resp.Header.Get(XFromCache))
- }
- }
-}
-
-func TestGetVaryUnused(t *testing.T) {
- resetTest()
- req, err := http.NewRequest("GET", s.server.URL+"/varyunused", nil)
- if err != nil {
- t.Fatal(err)
- }
- req.Header.Set("Accept", "text/plain")
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get("Vary") == "" {
- t.Fatalf(`Vary header is blank`)
- }
- _, err = ioutil.ReadAll(resp.Body)
- if err != nil {
- t.Fatal(err)
- }
- }
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get(XFromCache) != "1" {
- t.Fatalf(`XFromCache header isn't "1": %v`, resp.Header.Get(XFromCache))
- }
- }
-}
-
-func TestUpdateFields(t *testing.T) {
- resetTest()
- req, err := http.NewRequest("GET", s.server.URL+"/updatefields", nil)
- if err != nil {
- t.Fatal(err)
- }
- var counter, counter2 string
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- counter = resp.Header.Get("x-counter")
- _, err = ioutil.ReadAll(resp.Body)
- if err != nil {
- t.Fatal(err)
- }
- }
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.Header.Get(XFromCache) != "1" {
- t.Fatalf(`XFromCache header isn't "1": %v`, resp.Header.Get(XFromCache))
- }
- counter2 = resp.Header.Get("x-counter")
- }
- if counter == counter2 {
- t.Fatalf(`both "x-counter" values are equal: %v %v`, counter, counter2)
- }
-}
-
-// This tests the fix for https://github.com/gregjones/httpcache/issues/74.
-// Previously, after validating a cached response, its StatusCode
-// was incorrectly being replaced.
-func TestCachedErrorsKeepStatus(t *testing.T) {
- resetTest()
- req, err := http.NewRequest("GET", s.server.URL+"/cachederror", nil)
- if err != nil {
- t.Fatal(err)
- }
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- io.Copy(ioutil.Discard, resp.Body)
- }
- {
- resp, err := s.client.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.StatusCode != http.StatusNotFound {
- t.Fatalf("Status code isn't 404: %d", resp.StatusCode)
- }
- }
-}
-
-func TestParseCacheControl(t *testing.T) {
- resetTest()
- h := http.Header{}
- for range parseCacheControl(h) {
- t.Fatal("cacheControl should be empty")
- }
-
- h.Set("cache-control", "no-cache")
- {
- cc := parseCacheControl(h)
- if _, ok := cc["foo"]; ok {
- t.Error(`Value "foo" shouldn't exist`)
- }
- noCache, ok := cc["no-cache"]
- if !ok {
- t.Fatalf(`"no-cache" value isn't set`)
- }
- if noCache != "" {
- t.Fatalf(`"no-cache" value isn't blank: %v`, noCache)
- }
- }
- h.Set("cache-control", "no-cache, max-age=3600")
- {
- cc := parseCacheControl(h)
- noCache, ok := cc["no-cache"]
- if !ok {
- t.Fatalf(`"no-cache" value isn't set`)
- }
- if noCache != "" {
- t.Fatalf(`"no-cache" value isn't blank: %v`, noCache)
- }
- if cc["max-age"] != "3600" {
- t.Fatalf(`"max-age" value isn't "3600": %v`, cc["max-age"])
- }
- }
-}
-
-func TestNoCacheRequestExpiration(t *testing.T) {
- resetTest()
- respHeaders := http.Header{}
- respHeaders.Set("Cache-Control", "max-age=7200")
-
- reqHeaders := http.Header{}
- reqHeaders.Set("Cache-Control", "no-cache")
- if getFreshness(respHeaders, reqHeaders) != transparent {
- t.Fatal("freshness isn't transparent")
- }
-}
-
-func TestNoCacheResponseExpiration(t *testing.T) {
- resetTest()
- respHeaders := http.Header{}
- respHeaders.Set("Cache-Control", "no-cache")
- respHeaders.Set("Expires", "Wed, 19 Apr 3000 11:43:00 GMT")
-
- reqHeaders := http.Header{}
- if getFreshness(respHeaders, reqHeaders) != stale {
- t.Fatal("freshness isn't stale")
- }
-}
-
-func TestReqMustRevalidate(t *testing.T) {
- resetTest()
- // not paying attention to request setting max-stale means never returning stale
- // responses, so always acting as if must-revalidate is set
- respHeaders := http.Header{}
-
- reqHeaders := http.Header{}
- reqHeaders.Set("Cache-Control", "must-revalidate")
- if getFreshness(respHeaders, reqHeaders) != stale {
- t.Fatal("freshness isn't stale")
- }
-}
-
-func TestRespMustRevalidate(t *testing.T) {
- resetTest()
- respHeaders := http.Header{}
- respHeaders.Set("Cache-Control", "must-revalidate")
-
- reqHeaders := http.Header{}
- if getFreshness(respHeaders, reqHeaders) != stale {
- t.Fatal("freshness isn't stale")
- }
-}
-
-func TestFreshExpiration(t *testing.T) {
- resetTest()
- now := time.Now()
- respHeaders := http.Header{}
- respHeaders.Set("date", now.Format(time.RFC1123))
- respHeaders.Set("expires", now.Add(time.Duration(2)*time.Second).Format(time.RFC1123))
-
- reqHeaders := http.Header{}
- if getFreshness(respHeaders, reqHeaders) != fresh {
- t.Fatal("freshness isn't fresh")
- }
-
- clock = &fakeClock{elapsed: 3 * time.Second}
- if getFreshness(respHeaders, reqHeaders) != stale {
- t.Fatal("freshness isn't stale")
- }
-}
-
-func TestMaxAge(t *testing.T) {
- resetTest()
- now := time.Now()
- respHeaders := http.Header{}
- respHeaders.Set("date", now.Format(time.RFC1123))
- respHeaders.Set("cache-control", "max-age=2")
-
- reqHeaders := http.Header{}
- if getFreshness(respHeaders, reqHeaders) != fresh {
- t.Fatal("freshness isn't fresh")
- }
-
- clock = &fakeClock{elapsed: 3 * time.Second}
- if getFreshness(respHeaders, reqHeaders) != stale {
- t.Fatal("freshness isn't stale")
- }
-}
-
-func TestMaxAgeZero(t *testing.T) {
- resetTest()
- now := time.Now()
- respHeaders := http.Header{}
- respHeaders.Set("date", now.Format(time.RFC1123))
- respHeaders.Set("cache-control", "max-age=0")
-
- reqHeaders := http.Header{}
- if getFreshness(respHeaders, reqHeaders) != stale {
- t.Fatal("freshness isn't stale")
- }
-}
-
-func TestBothMaxAge(t *testing.T) {
- resetTest()
- now := time.Now()
- respHeaders := http.Header{}
- respHeaders.Set("date", now.Format(time.RFC1123))
- respHeaders.Set("cache-control", "max-age=2")
-
- reqHeaders := http.Header{}
- reqHeaders.Set("cache-control", "max-age=0")
- if getFreshness(respHeaders, reqHeaders) != stale {
- t.Fatal("freshness isn't stale")
- }
-}
-
-func TestMinFreshWithExpires(t *testing.T) {
- resetTest()
- now := time.Now()
- respHeaders := http.Header{}
- respHeaders.Set("date", now.Format(time.RFC1123))
- respHeaders.Set("expires", now.Add(time.Duration(2)*time.Second).Format(time.RFC1123))
-
- reqHeaders := http.Header{}
- reqHeaders.Set("cache-control", "min-fresh=1")
- if getFreshness(respHeaders, reqHeaders) != fresh {
- t.Fatal("freshness isn't fresh")
- }
-
- reqHeaders = http.Header{}
- reqHeaders.Set("cache-control", "min-fresh=2")
- if getFreshness(respHeaders, reqHeaders) != stale {
- t.Fatal("freshness isn't stale")
- }
-}
-
-func TestEmptyMaxStale(t *testing.T) {
- resetTest()
- now := time.Now()
- respHeaders := http.Header{}
- respHeaders.Set("date", now.Format(time.RFC1123))
- respHeaders.Set("cache-control", "max-age=20")
-
- reqHeaders := http.Header{}
- reqHeaders.Set("cache-control", "max-stale")
- clock = &fakeClock{elapsed: 10 * time.Second}
- if getFreshness(respHeaders, reqHeaders) != fresh {
- t.Fatal("freshness isn't fresh")
- }
-
- clock = &fakeClock{elapsed: 60 * time.Second}
- if getFreshness(respHeaders, reqHeaders) != fresh {
- t.Fatal("freshness isn't fresh")
- }
-}
-
-func TestMaxStaleValue(t *testing.T) {
- resetTest()
- now := time.Now()
- respHeaders := http.Header{}
- respHeaders.Set("date", now.Format(time.RFC1123))
- respHeaders.Set("cache-control", "max-age=10")
-
- reqHeaders := http.Header{}
- reqHeaders.Set("cache-control", "max-stale=20")
- clock = &fakeClock{elapsed: 5 * time.Second}
- if getFreshness(respHeaders, reqHeaders) != fresh {
- t.Fatal("freshness isn't fresh")
- }
-
- clock = &fakeClock{elapsed: 15 * time.Second}
- if getFreshness(respHeaders, reqHeaders) != fresh {
- t.Fatal("freshness isn't fresh")
- }
-
- clock = &fakeClock{elapsed: 30 * time.Second}
- if getFreshness(respHeaders, reqHeaders) != stale {
- t.Fatal("freshness isn't stale")
- }
-}
-
-func containsHeader(headers []string, header string) bool {
- for _, v := range headers {
- if http.CanonicalHeaderKey(v) == http.CanonicalHeaderKey(header) {
- return true
- }
- }
- return false
-}
-
-func TestGetEndToEndHeaders(t *testing.T) {
- resetTest()
- var (
- headers http.Header
- end2end []string
- )
-
- headers = http.Header{}
- headers.Set("content-type", "text/html")
- headers.Set("te", "deflate")
-
- end2end = getEndToEndHeaders(headers)
- if !containsHeader(end2end, "content-type") {
- t.Fatal(`doesn't contain "content-type" header`)
- }
- if containsHeader(end2end, "te") {
- t.Fatal(`doesn't contain "te" header`)
- }
-
- headers = http.Header{}
- headers.Set("connection", "content-type")
- headers.Set("content-type", "text/csv")
- headers.Set("te", "deflate")
- end2end = getEndToEndHeaders(headers)
- if containsHeader(end2end, "connection") {
- t.Fatal(`doesn't contain "connection" header`)
- }
- if containsHeader(end2end, "content-type") {
- t.Fatal(`doesn't contain "content-type" header`)
- }
- if containsHeader(end2end, "te") {
- t.Fatal(`doesn't contain "te" header`)
- }
-
- headers = http.Header{}
- end2end = getEndToEndHeaders(headers)
- if len(end2end) != 0 {
- t.Fatal(`non-zero end2end headers`)
- }
-
- headers = http.Header{}
- headers.Set("connection", "content-type")
- end2end = getEndToEndHeaders(headers)
- if len(end2end) != 0 {
- t.Fatal(`non-zero end2end headers`)
- }
-}
-
-type transportMock struct {
- response *http.Response
- err error
-}
-
-func (t transportMock) RoundTrip(req *http.Request) (resp *http.Response, err error) {
- return t.response, t.err
-}
-
-func TestStaleIfErrorRequest(t *testing.T) {
- resetTest()
- now := time.Now()
- tmock := transportMock{
- response: &http.Response{
- Status: http.StatusText(http.StatusOK),
- StatusCode: http.StatusOK,
- Header: http.Header{
- "Date": []string{now.Format(time.RFC1123)},
- "Cache-Control": []string{"no-cache"},
- },
- Body: ioutil.NopCloser(bytes.NewBuffer([]byte("some data"))),
- },
- err: nil,
- }
- tp := NewMemoryCacheTransport()
- tp.Transport = &tmock
-
- // First time, response is cached on success
- r, _ := http.NewRequest("GET", "http://somewhere.com/", nil)
- r.Header.Set("Cache-Control", "stale-if-error")
- resp, err := tp.RoundTrip(r)
- if err != nil {
- t.Fatal(err)
- }
- if resp == nil {
- t.Fatal("resp is nil")
- }
- _, err = ioutil.ReadAll(resp.Body)
- if err != nil {
- t.Fatal(err)
- }
-
- // On failure, response is returned from the cache
- tmock.response = nil
- tmock.err = errors.New("some error")
- resp, err = tp.RoundTrip(r)
- if err != nil {
- t.Fatal(err)
- }
- if resp == nil {
- t.Fatal("resp is nil")
- }
-}
-
-func TestStaleIfErrorRequestLifetime(t *testing.T) {
- resetTest()
- now := time.Now()
- tmock := transportMock{
- response: &http.Response{
- Status: http.StatusText(http.StatusOK),
- StatusCode: http.StatusOK,
- Header: http.Header{
- "Date": []string{now.Format(time.RFC1123)},
- "Cache-Control": []string{"no-cache"},
- },
- Body: ioutil.NopCloser(bytes.NewBuffer([]byte("some data"))),
- },
- err: nil,
- }
- tp := NewMemoryCacheTransport()
- tp.Transport = &tmock
-
- // First time, response is cached on success
- r, _ := http.NewRequest("GET", "http://somewhere.com/", nil)
- r.Header.Set("Cache-Control", "stale-if-error=100")
- resp, err := tp.RoundTrip(r)
- if err != nil {
- t.Fatal(err)
- }
- if resp == nil {
- t.Fatal("resp is nil")
- }
- _, err = ioutil.ReadAll(resp.Body)
- if err != nil {
- t.Fatal(err)
- }
-
- // On failure, response is returned from the cache
- tmock.response = nil
- tmock.err = errors.New("some error")
- resp, err = tp.RoundTrip(r)
- if err != nil {
- t.Fatal(err)
- }
- if resp == nil {
- t.Fatal("resp is nil")
- }
-
- // Same for http errors
- tmock.response = &http.Response{StatusCode: http.StatusInternalServerError}
- tmock.err = nil
- resp, err = tp.RoundTrip(r)
- if err != nil {
- t.Fatal(err)
- }
- if resp == nil {
- t.Fatal("resp is nil")
- }
-
- // If failure last more than max stale, error is returned
- clock = &fakeClock{elapsed: 200 * time.Second}
- _, err = tp.RoundTrip(r)
- if err != tmock.err {
- t.Fatalf("got err %v, want %v", err, tmock.err)
- }
-}
-
-func TestStaleIfErrorResponse(t *testing.T) {
- resetTest()
- now := time.Now()
- tmock := transportMock{
- response: &http.Response{
- Status: http.StatusText(http.StatusOK),
- StatusCode: http.StatusOK,
- Header: http.Header{
- "Date": []string{now.Format(time.RFC1123)},
- "Cache-Control": []string{"no-cache, stale-if-error"},
- },
- Body: ioutil.NopCloser(bytes.NewBuffer([]byte("some data"))),
- },
- err: nil,
- }
- tp := NewMemoryCacheTransport()
- tp.Transport = &tmock
-
- // First time, response is cached on success
- r, _ := http.NewRequest("GET", "http://somewhere.com/", nil)
- resp, err := tp.RoundTrip(r)
- if err != nil {
- t.Fatal(err)
- }
- if resp == nil {
- t.Fatal("resp is nil")
- }
- _, err = ioutil.ReadAll(resp.Body)
- if err != nil {
- t.Fatal(err)
- }
-
- // On failure, response is returned from the cache
- tmock.response = nil
- tmock.err = errors.New("some error")
- resp, err = tp.RoundTrip(r)
- if err != nil {
- t.Fatal(err)
- }
- if resp == nil {
- t.Fatal("resp is nil")
- }
-}
-
-func TestStaleIfErrorResponseLifetime(t *testing.T) {
- resetTest()
- now := time.Now()
- tmock := transportMock{
- response: &http.Response{
- Status: http.StatusText(http.StatusOK),
- StatusCode: http.StatusOK,
- Header: http.Header{
- "Date": []string{now.Format(time.RFC1123)},
- "Cache-Control": []string{"no-cache, stale-if-error=100"},
- },
- Body: ioutil.NopCloser(bytes.NewBuffer([]byte("some data"))),
- },
- err: nil,
- }
- tp := NewMemoryCacheTransport()
- tp.Transport = &tmock
-
- // First time, response is cached on success
- r, _ := http.NewRequest("GET", "http://somewhere.com/", nil)
- resp, err := tp.RoundTrip(r)
- if err != nil {
- t.Fatal(err)
- }
- if resp == nil {
- t.Fatal("resp is nil")
- }
- _, err = ioutil.ReadAll(resp.Body)
- if err != nil {
- t.Fatal(err)
- }
-
- // On failure, response is returned from the cache
- tmock.response = nil
- tmock.err = errors.New("some error")
- resp, err = tp.RoundTrip(r)
- if err != nil {
- t.Fatal(err)
- }
- if resp == nil {
- t.Fatal("resp is nil")
- }
-
- // If failure last more than max stale, error is returned
- clock = &fakeClock{elapsed: 200 * time.Second}
- _, err = tp.RoundTrip(r)
- if err != tmock.err {
- t.Fatalf("got err %v, want %v", err, tmock.err)
- }
-}
-
-// This tests the fix for https://github.com/gregjones/httpcache/issues/74.
-// Previously, after a stale response was used after encountering an error,
-// its StatusCode was being incorrectly replaced.
-func TestStaleIfErrorKeepsStatus(t *testing.T) {
- resetTest()
- now := time.Now()
- tmock := transportMock{
- response: &http.Response{
- Status: http.StatusText(http.StatusNotFound),
- StatusCode: http.StatusNotFound,
- Header: http.Header{
- "Date": []string{now.Format(time.RFC1123)},
- "Cache-Control": []string{"no-cache"},
- },
- Body: ioutil.NopCloser(bytes.NewBuffer([]byte("some data"))),
- },
- err: nil,
- }
- tp := NewMemoryCacheTransport()
- tp.Transport = &tmock
-
- // First time, response is cached on success
- r, _ := http.NewRequest("GET", "http://somewhere.com/", nil)
- r.Header.Set("Cache-Control", "stale-if-error")
- resp, err := tp.RoundTrip(r)
- if err != nil {
- t.Fatal(err)
- }
- if resp == nil {
- t.Fatal("resp is nil")
- }
- _, err = ioutil.ReadAll(resp.Body)
- if err != nil {
- t.Fatal(err)
- }
-
- // On failure, response is returned from the cache
- tmock.response = nil
- tmock.err = errors.New("some error")
- resp, err = tp.RoundTrip(r)
- if err != nil {
- t.Fatal(err)
- }
- if resp == nil {
- t.Fatal("resp is nil")
- }
- if resp.StatusCode != http.StatusNotFound {
- t.Fatalf("Status wasn't 404: %d", resp.StatusCode)
- }
-}
-
-// Test that http.Client.Timeout is respected when cache transport is used.
-// That is so as long as request cancellation is propagated correctly.
-// In the past, that required CancelRequest to be implemented correctly,
-// but modern http.Client uses Request.Cancel (or request context) instead,
-// so we don't have to do anything.
-func TestClientTimeout(t *testing.T) {
- if testing.Short() {
- t.Skip("skipping timeout test in short mode") // Because it takes at least 3 seconds to run.
- }
- resetTest()
- client := &http.Client{
- Transport: NewMemoryCacheTransport(),
- Timeout: time.Second,
- }
- started := time.Now()
- resp, err := client.Get(s.server.URL + "/3seconds")
- taken := time.Since(started)
- if err == nil {
- t.Error("got nil error, want timeout error")
- }
- if resp != nil {
- t.Error("got non-nil resp, want nil resp")
- }
- if taken >= 2*time.Second {
- t.Error("client.Do took 2+ seconds, want < 2 seconds")
- }
-}
diff --git a/vendor/github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc/errors_test.go b/vendor/github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc/errors_test.go
deleted file mode 100644
index 9ad1d1946..000000000
--- a/vendor/github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc/errors_test.go
+++ /dev/null
@@ -1,57 +0,0 @@
-package otgrpc
-
-import (
- "testing"
-
- "github.com/stretchr/testify/assert"
-
- "github.com/opentracing/opentracing-go/mocktracer"
- "google.golang.org/grpc/codes"
- "google.golang.org/grpc/status"
-)
-
-const (
- firstCode = codes.OK
- lastCode = codes.DataLoss
-)
-
-func TestSpanTags(t *testing.T) {
- tracer := mocktracer.New()
- for code := firstCode; code <= lastCode; code++ {
- // Client error
- tracer.Reset()
- span := tracer.StartSpan("test-trace-client")
- err := status.Error(code, "")
- SetSpanTags(span, err, true)
- span.Finish()
-
- // Assert added tags
- rawSpan := tracer.FinishedSpans()[0]
- expectedTags := map[string]interface{}{
- "response_code": code,
- "response_class": ErrorClass(err),
- }
- if err != nil {
- expectedTags["error"] = true
- }
- assert.Equal(t, expectedTags, rawSpan.Tags())
-
- // Server error
- tracer.Reset()
- span = tracer.StartSpan("test-trace-server")
- err = status.Error(code, "")
- SetSpanTags(span, err, false)
- span.Finish()
-
- // Assert added tags
- rawSpan = tracer.FinishedSpans()[0]
- expectedTags = map[string]interface{}{
- "response_code": code,
- "response_class": ErrorClass(err),
- }
- if err != nil && ErrorClass(err) == ServerError {
- expectedTags["error"] = true
- }
- assert.Equal(t, expectedTags, rawSpan.Tags())
- }
-}
diff --git a/vendor/github.com/hashicorp/golang-lru/2q_test.go b/vendor/github.com/hashicorp/golang-lru/2q_test.go
deleted file mode 100644
index 1b0f35181..000000000
--- a/vendor/github.com/hashicorp/golang-lru/2q_test.go
+++ /dev/null
@@ -1,306 +0,0 @@
-package lru
-
-import (
- "math/rand"
- "testing"
-)
-
-func Benchmark2Q_Rand(b *testing.B) {
- l, err := New2Q(8192)
- if err != nil {
- b.Fatalf("err: %v", err)
- }
-
- trace := make([]int64, b.N*2)
- for i := 0; i < b.N*2; i++ {
- trace[i] = rand.Int63() % 32768
- }
-
- b.ResetTimer()
-
- var hit, miss int
- for i := 0; i < 2*b.N; i++ {
- if i%2 == 0 {
- l.Add(trace[i], trace[i])
- } else {
- _, ok := l.Get(trace[i])
- if ok {
- hit++
- } else {
- miss++
- }
- }
- }
- b.Logf("hit: %d miss: %d ratio: %f", hit, miss, float64(hit)/float64(miss))
-}
-
-func Benchmark2Q_Freq(b *testing.B) {
- l, err := New2Q(8192)
- if err != nil {
- b.Fatalf("err: %v", err)
- }
-
- trace := make([]int64, b.N*2)
- for i := 0; i < b.N*2; i++ {
- if i%2 == 0 {
- trace[i] = rand.Int63() % 16384
- } else {
- trace[i] = rand.Int63() % 32768
- }
- }
-
- b.ResetTimer()
-
- for i := 0; i < b.N; i++ {
- l.Add(trace[i], trace[i])
- }
- var hit, miss int
- for i := 0; i < b.N; i++ {
- _, ok := l.Get(trace[i])
- if ok {
- hit++
- } else {
- miss++
- }
- }
- b.Logf("hit: %d miss: %d ratio: %f", hit, miss, float64(hit)/float64(miss))
-}
-
-func Test2Q_RandomOps(t *testing.T) {
- size := 128
- l, err := New2Q(128)
- if err != nil {
- t.Fatalf("err: %v", err)
- }
-
- n := 200000
- for i := 0; i < n; i++ {
- key := rand.Int63() % 512
- r := rand.Int63()
- switch r % 3 {
- case 0:
- l.Add(key, key)
- case 1:
- l.Get(key)
- case 2:
- l.Remove(key)
- }
-
- if l.recent.Len()+l.frequent.Len() > size {
- t.Fatalf("bad: recent: %d freq: %d",
- l.recent.Len(), l.frequent.Len())
- }
- }
-}
-
-func Test2Q_Get_RecentToFrequent(t *testing.T) {
- l, err := New2Q(128)
- if err != nil {
- t.Fatalf("err: %v", err)
- }
-
- // Touch all the entries, should be in t1
- for i := 0; i < 128; i++ {
- l.Add(i, i)
- }
- if n := l.recent.Len(); n != 128 {
- t.Fatalf("bad: %d", n)
- }
- if n := l.frequent.Len(); n != 0 {
- t.Fatalf("bad: %d", n)
- }
-
- // Get should upgrade to t2
- for i := 0; i < 128; i++ {
- _, ok := l.Get(i)
- if !ok {
- t.Fatalf("missing: %d", i)
- }
- }
- if n := l.recent.Len(); n != 0 {
- t.Fatalf("bad: %d", n)
- }
- if n := l.frequent.Len(); n != 128 {
- t.Fatalf("bad: %d", n)
- }
-
- // Get be from t2
- for i := 0; i < 128; i++ {
- _, ok := l.Get(i)
- if !ok {
- t.Fatalf("missing: %d", i)
- }
- }
- if n := l.recent.Len(); n != 0 {
- t.Fatalf("bad: %d", n)
- }
- if n := l.frequent.Len(); n != 128 {
- t.Fatalf("bad: %d", n)
- }
-}
-
-func Test2Q_Add_RecentToFrequent(t *testing.T) {
- l, err := New2Q(128)
- if err != nil {
- t.Fatalf("err: %v", err)
- }
-
- // Add initially to recent
- l.Add(1, 1)
- if n := l.recent.Len(); n != 1 {
- t.Fatalf("bad: %d", n)
- }
- if n := l.frequent.Len(); n != 0 {
- t.Fatalf("bad: %d", n)
- }
-
- // Add should upgrade to frequent
- l.Add(1, 1)
- if n := l.recent.Len(); n != 0 {
- t.Fatalf("bad: %d", n)
- }
- if n := l.frequent.Len(); n != 1 {
- t.Fatalf("bad: %d", n)
- }
-
- // Add should remain in frequent
- l.Add(1, 1)
- if n := l.recent.Len(); n != 0 {
- t.Fatalf("bad: %d", n)
- }
- if n := l.frequent.Len(); n != 1 {
- t.Fatalf("bad: %d", n)
- }
-}
-
-func Test2Q_Add_RecentEvict(t *testing.T) {
- l, err := New2Q(4)
- if err != nil {
- t.Fatalf("err: %v", err)
- }
-
- // Add 1,2,3,4,5 -> Evict 1
- l.Add(1, 1)
- l.Add(2, 2)
- l.Add(3, 3)
- l.Add(4, 4)
- l.Add(5, 5)
- if n := l.recent.Len(); n != 4 {
- t.Fatalf("bad: %d", n)
- }
- if n := l.recentEvict.Len(); n != 1 {
- t.Fatalf("bad: %d", n)
- }
- if n := l.frequent.Len(); n != 0 {
- t.Fatalf("bad: %d", n)
- }
-
- // Pull in the recently evicted
- l.Add(1, 1)
- if n := l.recent.Len(); n != 3 {
- t.Fatalf("bad: %d", n)
- }
- if n := l.recentEvict.Len(); n != 1 {
- t.Fatalf("bad: %d", n)
- }
- if n := l.frequent.Len(); n != 1 {
- t.Fatalf("bad: %d", n)
- }
-
- // Add 6, should cause another recent evict
- l.Add(6, 6)
- if n := l.recent.Len(); n != 3 {
- t.Fatalf("bad: %d", n)
- }
- if n := l.recentEvict.Len(); n != 2 {
- t.Fatalf("bad: %d", n)
- }
- if n := l.frequent.Len(); n != 1 {
- t.Fatalf("bad: %d", n)
- }
-}
-
-func Test2Q(t *testing.T) {
- l, err := New2Q(128)
- if err != nil {
- t.Fatalf("err: %v", err)
- }
-
- for i := 0; i < 256; i++ {
- l.Add(i, i)
- }
- if l.Len() != 128 {
- t.Fatalf("bad len: %v", l.Len())
- }
-
- for i, k := range l.Keys() {
- if v, ok := l.Get(k); !ok || v != k || v != i+128 {
- t.Fatalf("bad key: %v", k)
- }
- }
- for i := 0; i < 128; i++ {
- _, ok := l.Get(i)
- if ok {
- t.Fatalf("should be evicted")
- }
- }
- for i := 128; i < 256; i++ {
- _, ok := l.Get(i)
- if !ok {
- t.Fatalf("should not be evicted")
- }
- }
- for i := 128; i < 192; i++ {
- l.Remove(i)
- _, ok := l.Get(i)
- if ok {
- t.Fatalf("should be deleted")
- }
- }
-
- l.Purge()
- if l.Len() != 0 {
- t.Fatalf("bad len: %v", l.Len())
- }
- if _, ok := l.Get(200); ok {
- t.Fatalf("should contain nothing")
- }
-}
-
-// Test that Contains doesn't update recent-ness
-func Test2Q_Contains(t *testing.T) {
- l, err := New2Q(2)
- if err != nil {
- t.Fatalf("err: %v", err)
- }
-
- l.Add(1, 1)
- l.Add(2, 2)
- if !l.Contains(1) {
- t.Errorf("1 should be contained")
- }
-
- l.Add(3, 3)
- if l.Contains(1) {
- t.Errorf("Contains should not have updated recent-ness of 1")
- }
-}
-
-// Test that Peek doesn't update recent-ness
-func Test2Q_Peek(t *testing.T) {
- l, err := New2Q(2)
- if err != nil {
- t.Fatalf("err: %v", err)
- }
-
- l.Add(1, 1)
- l.Add(2, 2)
- if v, ok := l.Peek(1); !ok || v != 1 {
- t.Errorf("1 should be set to 1: %v, %v", v, ok)
- }
-
- l.Add(3, 3)
- if l.Contains(1) {
- t.Errorf("should not have updated recent-ness of 1")
- }
-}
diff --git a/vendor/github.com/hashicorp/golang-lru/arc_test.go b/vendor/github.com/hashicorp/golang-lru/arc_test.go
deleted file mode 100644
index e2d9b68c6..000000000
--- a/vendor/github.com/hashicorp/golang-lru/arc_test.go
+++ /dev/null
@@ -1,377 +0,0 @@
-package lru
-
-import (
- "math/rand"
- "testing"
- "time"
-)
-
-func init() {
- rand.Seed(time.Now().Unix())
-}
-
-func BenchmarkARC_Rand(b *testing.B) {
- l, err := NewARC(8192)
- if err != nil {
- b.Fatalf("err: %v", err)
- }
-
- trace := make([]int64, b.N*2)
- for i := 0; i < b.N*2; i++ {
- trace[i] = rand.Int63() % 32768
- }
-
- b.ResetTimer()
-
- var hit, miss int
- for i := 0; i < 2*b.N; i++ {
- if i%2 == 0 {
- l.Add(trace[i], trace[i])
- } else {
- _, ok := l.Get(trace[i])
- if ok {
- hit++
- } else {
- miss++
- }
- }
- }
- b.Logf("hit: %d miss: %d ratio: %f", hit, miss, float64(hit)/float64(miss))
-}
-
-func BenchmarkARC_Freq(b *testing.B) {
- l, err := NewARC(8192)
- if err != nil {
- b.Fatalf("err: %v", err)
- }
-
- trace := make([]int64, b.N*2)
- for i := 0; i < b.N*2; i++ {
- if i%2 == 0 {
- trace[i] = rand.Int63() % 16384
- } else {
- trace[i] = rand.Int63() % 32768
- }
- }
-
- b.ResetTimer()
-
- for i := 0; i < b.N; i++ {
- l.Add(trace[i], trace[i])
- }
- var hit, miss int
- for i := 0; i < b.N; i++ {
- _, ok := l.Get(trace[i])
- if ok {
- hit++
- } else {
- miss++
- }
- }
- b.Logf("hit: %d miss: %d ratio: %f", hit, miss, float64(hit)/float64(miss))
-}
-
-func TestARC_RandomOps(t *testing.T) {
- size := 128
- l, err := NewARC(128)
- if err != nil {
- t.Fatalf("err: %v", err)
- }
-
- n := 200000
- for i := 0; i < n; i++ {
- key := rand.Int63() % 512
- r := rand.Int63()
- switch r % 3 {
- case 0:
- l.Add(key, key)
- case 1:
- l.Get(key)
- case 2:
- l.Remove(key)
- }
-
- if l.t1.Len()+l.t2.Len() > size {
- t.Fatalf("bad: t1: %d t2: %d b1: %d b2: %d p: %d",
- l.t1.Len(), l.t2.Len(), l.b1.Len(), l.b2.Len(), l.p)
- }
- if l.b1.Len()+l.b2.Len() > size {
- t.Fatalf("bad: t1: %d t2: %d b1: %d b2: %d p: %d",
- l.t1.Len(), l.t2.Len(), l.b1.Len(), l.b2.Len(), l.p)
- }
- }
-}
-
-func TestARC_Get_RecentToFrequent(t *testing.T) {
- l, err := NewARC(128)
- if err != nil {
- t.Fatalf("err: %v", err)
- }
-
- // Touch all the entries, should be in t1
- for i := 0; i < 128; i++ {
- l.Add(i, i)
- }
- if n := l.t1.Len(); n != 128 {
- t.Fatalf("bad: %d", n)
- }
- if n := l.t2.Len(); n != 0 {
- t.Fatalf("bad: %d", n)
- }
-
- // Get should upgrade to t2
- for i := 0; i < 128; i++ {
- _, ok := l.Get(i)
- if !ok {
- t.Fatalf("missing: %d", i)
- }
- }
- if n := l.t1.Len(); n != 0 {
- t.Fatalf("bad: %d", n)
- }
- if n := l.t2.Len(); n != 128 {
- t.Fatalf("bad: %d", n)
- }
-
- // Get be from t2
- for i := 0; i < 128; i++ {
- _, ok := l.Get(i)
- if !ok {
- t.Fatalf("missing: %d", i)
- }
- }
- if n := l.t1.Len(); n != 0 {
- t.Fatalf("bad: %d", n)
- }
- if n := l.t2.Len(); n != 128 {
- t.Fatalf("bad: %d", n)
- }
-}
-
-func TestARC_Add_RecentToFrequent(t *testing.T) {
- l, err := NewARC(128)
- if err != nil {
- t.Fatalf("err: %v", err)
- }
-
- // Add initially to t1
- l.Add(1, 1)
- if n := l.t1.Len(); n != 1 {
- t.Fatalf("bad: %d", n)
- }
- if n := l.t2.Len(); n != 0 {
- t.Fatalf("bad: %d", n)
- }
-
- // Add should upgrade to t2
- l.Add(1, 1)
- if n := l.t1.Len(); n != 0 {
- t.Fatalf("bad: %d", n)
- }
- if n := l.t2.Len(); n != 1 {
- t.Fatalf("bad: %d", n)
- }
-
- // Add should remain in t2
- l.Add(1, 1)
- if n := l.t1.Len(); n != 0 {
- t.Fatalf("bad: %d", n)
- }
- if n := l.t2.Len(); n != 1 {
- t.Fatalf("bad: %d", n)
- }
-}
-
-func TestARC_Adaptive(t *testing.T) {
- l, err := NewARC(4)
- if err != nil {
- t.Fatalf("err: %v", err)
- }
-
- // Fill t1
- for i := 0; i < 4; i++ {
- l.Add(i, i)
- }
- if n := l.t1.Len(); n != 4 {
- t.Fatalf("bad: %d", n)
- }
-
- // Move to t2
- l.Get(0)
- l.Get(1)
- if n := l.t2.Len(); n != 2 {
- t.Fatalf("bad: %d", n)
- }
-
- // Evict from t1
- l.Add(4, 4)
- if n := l.b1.Len(); n != 1 {
- t.Fatalf("bad: %d", n)
- }
-
- // Current state
- // t1 : (MRU) [4, 3] (LRU)
- // t2 : (MRU) [1, 0] (LRU)
- // b1 : (MRU) [2] (LRU)
- // b2 : (MRU) [] (LRU)
-
- // Add 2, should cause hit on b1
- l.Add(2, 2)
- if n := l.b1.Len(); n != 1 {
- t.Fatalf("bad: %d", n)
- }
- if l.p != 1 {
- t.Fatalf("bad: %d", l.p)
- }
- if n := l.t2.Len(); n != 3 {
- t.Fatalf("bad: %d", n)
- }
-
- // Current state
- // t1 : (MRU) [4] (LRU)
- // t2 : (MRU) [2, 1, 0] (LRU)
- // b1 : (MRU) [3] (LRU)
- // b2 : (MRU) [] (LRU)
-
- // Add 4, should migrate to t2
- l.Add(4, 4)
- if n := l.t1.Len(); n != 0 {
- t.Fatalf("bad: %d", n)
- }
- if n := l.t2.Len(); n != 4 {
- t.Fatalf("bad: %d", n)
- }
-
- // Current state
- // t1 : (MRU) [] (LRU)
- // t2 : (MRU) [4, 2, 1, 0] (LRU)
- // b1 : (MRU) [3] (LRU)
- // b2 : (MRU) [] (LRU)
-
- // Add 4, should evict to b2
- l.Add(5, 5)
- if n := l.t1.Len(); n != 1 {
- t.Fatalf("bad: %d", n)
- }
- if n := l.t2.Len(); n != 3 {
- t.Fatalf("bad: %d", n)
- }
- if n := l.b2.Len(); n != 1 {
- t.Fatalf("bad: %d", n)
- }
-
- // Current state
- // t1 : (MRU) [5] (LRU)
- // t2 : (MRU) [4, 2, 1] (LRU)
- // b1 : (MRU) [3] (LRU)
- // b2 : (MRU) [0] (LRU)
-
- // Add 0, should decrease p
- l.Add(0, 0)
- if n := l.t1.Len(); n != 0 {
- t.Fatalf("bad: %d", n)
- }
- if n := l.t2.Len(); n != 4 {
- t.Fatalf("bad: %d", n)
- }
- if n := l.b1.Len(); n != 2 {
- t.Fatalf("bad: %d", n)
- }
- if n := l.b2.Len(); n != 0 {
- t.Fatalf("bad: %d", n)
- }
- if l.p != 0 {
- t.Fatalf("bad: %d", l.p)
- }
-
- // Current state
- // t1 : (MRU) [] (LRU)
- // t2 : (MRU) [0, 4, 2, 1] (LRU)
- // b1 : (MRU) [5, 3] (LRU)
- // b2 : (MRU) [0] (LRU)
-}
-
-func TestARC(t *testing.T) {
- l, err := NewARC(128)
- if err != nil {
- t.Fatalf("err: %v", err)
- }
-
- for i := 0; i < 256; i++ {
- l.Add(i, i)
- }
- if l.Len() != 128 {
- t.Fatalf("bad len: %v", l.Len())
- }
-
- for i, k := range l.Keys() {
- if v, ok := l.Get(k); !ok || v != k || v != i+128 {
- t.Fatalf("bad key: %v", k)
- }
- }
- for i := 0; i < 128; i++ {
- _, ok := l.Get(i)
- if ok {
- t.Fatalf("should be evicted")
- }
- }
- for i := 128; i < 256; i++ {
- _, ok := l.Get(i)
- if !ok {
- t.Fatalf("should not be evicted")
- }
- }
- for i := 128; i < 192; i++ {
- l.Remove(i)
- _, ok := l.Get(i)
- if ok {
- t.Fatalf("should be deleted")
- }
- }
-
- l.Purge()
- if l.Len() != 0 {
- t.Fatalf("bad len: %v", l.Len())
- }
- if _, ok := l.Get(200); ok {
- t.Fatalf("should contain nothing")
- }
-}
-
-// Test that Contains doesn't update recent-ness
-func TestARC_Contains(t *testing.T) {
- l, err := NewARC(2)
- if err != nil {
- t.Fatalf("err: %v", err)
- }
-
- l.Add(1, 1)
- l.Add(2, 2)
- if !l.Contains(1) {
- t.Errorf("1 should be contained")
- }
-
- l.Add(3, 3)
- if l.Contains(1) {
- t.Errorf("Contains should not have updated recent-ness of 1")
- }
-}
-
-// Test that Peek doesn't update recent-ness
-func TestARC_Peek(t *testing.T) {
- l, err := NewARC(2)
- if err != nil {
- t.Fatalf("err: %v", err)
- }
-
- l.Add(1, 1)
- l.Add(2, 2)
- if v, ok := l.Peek(1); !ok || v != 1 {
- t.Errorf("1 should be set to 1: %v, %v", v, ok)
- }
-
- l.Add(3, 3)
- if l.Contains(1) {
- t.Errorf("should not have updated recent-ness of 1")
- }
-}
diff --git a/vendor/github.com/hashicorp/golang-lru/lru_test.go b/vendor/github.com/hashicorp/golang-lru/lru_test.go
deleted file mode 100644
index e7e23505e..000000000
--- a/vendor/github.com/hashicorp/golang-lru/lru_test.go
+++ /dev/null
@@ -1,221 +0,0 @@
-package lru
-
-import (
- "math/rand"
- "testing"
-)
-
-func BenchmarkLRU_Rand(b *testing.B) {
- l, err := New(8192)
- if err != nil {
- b.Fatalf("err: %v", err)
- }
-
- trace := make([]int64, b.N*2)
- for i := 0; i < b.N*2; i++ {
- trace[i] = rand.Int63() % 32768
- }
-
- b.ResetTimer()
-
- var hit, miss int
- for i := 0; i < 2*b.N; i++ {
- if i%2 == 0 {
- l.Add(trace[i], trace[i])
- } else {
- _, ok := l.Get(trace[i])
- if ok {
- hit++
- } else {
- miss++
- }
- }
- }
- b.Logf("hit: %d miss: %d ratio: %f", hit, miss, float64(hit)/float64(miss))
-}
-
-func BenchmarkLRU_Freq(b *testing.B) {
- l, err := New(8192)
- if err != nil {
- b.Fatalf("err: %v", err)
- }
-
- trace := make([]int64, b.N*2)
- for i := 0; i < b.N*2; i++ {
- if i%2 == 0 {
- trace[i] = rand.Int63() % 16384
- } else {
- trace[i] = rand.Int63() % 32768
- }
- }
-
- b.ResetTimer()
-
- for i := 0; i < b.N; i++ {
- l.Add(trace[i], trace[i])
- }
- var hit, miss int
- for i := 0; i < b.N; i++ {
- _, ok := l.Get(trace[i])
- if ok {
- hit++
- } else {
- miss++
- }
- }
- b.Logf("hit: %d miss: %d ratio: %f", hit, miss, float64(hit)/float64(miss))
-}
-
-func TestLRU(t *testing.T) {
- evictCounter := 0
- onEvicted := func(k interface{}, v interface{}) {
- if k != v {
- t.Fatalf("Evict values not equal (%v!=%v)", k, v)
- }
- evictCounter++
- }
- l, err := NewWithEvict(128, onEvicted)
- if err != nil {
- t.Fatalf("err: %v", err)
- }
-
- for i := 0; i < 256; i++ {
- l.Add(i, i)
- }
- if l.Len() != 128 {
- t.Fatalf("bad len: %v", l.Len())
- }
-
- if evictCounter != 128 {
- t.Fatalf("bad evict count: %v", evictCounter)
- }
-
- for i, k := range l.Keys() {
- if v, ok := l.Get(k); !ok || v != k || v != i+128 {
- t.Fatalf("bad key: %v", k)
- }
- }
- for i := 0; i < 128; i++ {
- _, ok := l.Get(i)
- if ok {
- t.Fatalf("should be evicted")
- }
- }
- for i := 128; i < 256; i++ {
- _, ok := l.Get(i)
- if !ok {
- t.Fatalf("should not be evicted")
- }
- }
- for i := 128; i < 192; i++ {
- l.Remove(i)
- _, ok := l.Get(i)
- if ok {
- t.Fatalf("should be deleted")
- }
- }
-
- l.Get(192) // expect 192 to be last key in l.Keys()
-
- for i, k := range l.Keys() {
- if (i < 63 && k != i+193) || (i == 63 && k != 192) {
- t.Fatalf("out of order key: %v", k)
- }
- }
-
- l.Purge()
- if l.Len() != 0 {
- t.Fatalf("bad len: %v", l.Len())
- }
- if _, ok := l.Get(200); ok {
- t.Fatalf("should contain nothing")
- }
-}
-
-// test that Add returns true/false if an eviction occurred
-func TestLRUAdd(t *testing.T) {
- evictCounter := 0
- onEvicted := func(k interface{}, v interface{}) {
- evictCounter++
- }
-
- l, err := NewWithEvict(1, onEvicted)
- if err != nil {
- t.Fatalf("err: %v", err)
- }
-
- if l.Add(1, 1) == true || evictCounter != 0 {
- t.Errorf("should not have an eviction")
- }
- if l.Add(2, 2) == false || evictCounter != 1 {
- t.Errorf("should have an eviction")
- }
-}
-
-// test that Contains doesn't update recent-ness
-func TestLRUContains(t *testing.T) {
- l, err := New(2)
- if err != nil {
- t.Fatalf("err: %v", err)
- }
-
- l.Add(1, 1)
- l.Add(2, 2)
- if !l.Contains(1) {
- t.Errorf("1 should be contained")
- }
-
- l.Add(3, 3)
- if l.Contains(1) {
- t.Errorf("Contains should not have updated recent-ness of 1")
- }
-}
-
-// test that Contains doesn't update recent-ness
-func TestLRUContainsOrAdd(t *testing.T) {
- l, err := New(2)
- if err != nil {
- t.Fatalf("err: %v", err)
- }
-
- l.Add(1, 1)
- l.Add(2, 2)
- contains, evict := l.ContainsOrAdd(1, 1)
- if !contains {
- t.Errorf("1 should be contained")
- }
- if evict {
- t.Errorf("nothing should be evicted here")
- }
-
- l.Add(3, 3)
- contains, evict = l.ContainsOrAdd(1, 1)
- if contains {
- t.Errorf("1 should not have been contained")
- }
- if !evict {
- t.Errorf("an eviction should have occurred")
- }
- if !l.Contains(1) {
- t.Errorf("now 1 should be contained")
- }
-}
-
-// test that Peek doesn't update recent-ness
-func TestLRUPeek(t *testing.T) {
- l, err := New(2)
- if err != nil {
- t.Fatalf("err: %v", err)
- }
-
- l.Add(1, 1)
- l.Add(2, 2)
- if v, ok := l.Peek(1); !ok || v != 1 {
- t.Errorf("1 should be set to 1: %v, %v", v, ok)
- }
-
- l.Add(3, 3)
- if l.Contains(1) {
- t.Errorf("should not have updated recent-ness of 1")
- }
-}
diff --git a/vendor/github.com/hashicorp/golang-lru/simplelru/lru_test.go b/vendor/github.com/hashicorp/golang-lru/simplelru/lru_test.go
deleted file mode 100644
index ca5676e1e..000000000
--- a/vendor/github.com/hashicorp/golang-lru/simplelru/lru_test.go
+++ /dev/null
@@ -1,167 +0,0 @@
-package simplelru
-
-import "testing"
-
-func TestLRU(t *testing.T) {
- evictCounter := 0
- onEvicted := func(k interface{}, v interface{}) {
- if k != v {
- t.Fatalf("Evict values not equal (%v!=%v)", k, v)
- }
- evictCounter++
- }
- l, err := NewLRU(128, onEvicted)
- if err != nil {
- t.Fatalf("err: %v", err)
- }
-
- for i := 0; i < 256; i++ {
- l.Add(i, i)
- }
- if l.Len() != 128 {
- t.Fatalf("bad len: %v", l.Len())
- }
-
- if evictCounter != 128 {
- t.Fatalf("bad evict count: %v", evictCounter)
- }
-
- for i, k := range l.Keys() {
- if v, ok := l.Get(k); !ok || v != k || v != i+128 {
- t.Fatalf("bad key: %v", k)
- }
- }
- for i := 0; i < 128; i++ {
- _, ok := l.Get(i)
- if ok {
- t.Fatalf("should be evicted")
- }
- }
- for i := 128; i < 256; i++ {
- _, ok := l.Get(i)
- if !ok {
- t.Fatalf("should not be evicted")
- }
- }
- for i := 128; i < 192; i++ {
- ok := l.Remove(i)
- if !ok {
- t.Fatalf("should be contained")
- }
- ok = l.Remove(i)
- if ok {
- t.Fatalf("should not be contained")
- }
- _, ok = l.Get(i)
- if ok {
- t.Fatalf("should be deleted")
- }
- }
-
- l.Get(192) // expect 192 to be last key in l.Keys()
-
- for i, k := range l.Keys() {
- if (i < 63 && k != i+193) || (i == 63 && k != 192) {
- t.Fatalf("out of order key: %v", k)
- }
- }
-
- l.Purge()
- if l.Len() != 0 {
- t.Fatalf("bad len: %v", l.Len())
- }
- if _, ok := l.Get(200); ok {
- t.Fatalf("should contain nothing")
- }
-}
-
-func TestLRU_GetOldest_RemoveOldest(t *testing.T) {
- l, err := NewLRU(128, nil)
- if err != nil {
- t.Fatalf("err: %v", err)
- }
- for i := 0; i < 256; i++ {
- l.Add(i, i)
- }
- k, _, ok := l.GetOldest()
- if !ok {
- t.Fatalf("missing")
- }
- if k.(int) != 128 {
- t.Fatalf("bad: %v", k)
- }
-
- k, _, ok = l.RemoveOldest()
- if !ok {
- t.Fatalf("missing")
- }
- if k.(int) != 128 {
- t.Fatalf("bad: %v", k)
- }
-
- k, _, ok = l.RemoveOldest()
- if !ok {
- t.Fatalf("missing")
- }
- if k.(int) != 129 {
- t.Fatalf("bad: %v", k)
- }
-}
-
-// Test that Add returns true/false if an eviction occurred
-func TestLRU_Add(t *testing.T) {
- evictCounter := 0
- onEvicted := func(k interface{}, v interface{}) {
- evictCounter++
- }
-
- l, err := NewLRU(1, onEvicted)
- if err != nil {
- t.Fatalf("err: %v", err)
- }
-
- if l.Add(1, 1) == true || evictCounter != 0 {
- t.Errorf("should not have an eviction")
- }
- if l.Add(2, 2) == false || evictCounter != 1 {
- t.Errorf("should have an eviction")
- }
-}
-
-// Test that Contains doesn't update recent-ness
-func TestLRU_Contains(t *testing.T) {
- l, err := NewLRU(2, nil)
- if err != nil {
- t.Fatalf("err: %v", err)
- }
-
- l.Add(1, 1)
- l.Add(2, 2)
- if !l.Contains(1) {
- t.Errorf("1 should be contained")
- }
-
- l.Add(3, 3)
- if l.Contains(1) {
- t.Errorf("Contains should not have updated recent-ness of 1")
- }
-}
-
-// Test that Peek doesn't update recent-ness
-func TestLRU_Peek(t *testing.T) {
- l, err := NewLRU(2, nil)
- if err != nil {
- t.Fatalf("err: %v", err)
- }
-
- l.Add(1, 1)
- l.Add(2, 2)
- if v, ok := l.Peek(1); !ok || v != 1 {
- t.Errorf("1 should be set to 1: %v, %v", v, ok)
- }
-
- l.Add(3, 3)
- if l.Contains(1) {
- t.Errorf("should not have updated recent-ness of 1")
- }
-}
diff --git a/vendor/github.com/imdario/mergo/issue17_test.go b/vendor/github.com/imdario/mergo/issue17_test.go
deleted file mode 100644
index f9de805ab..000000000
--- a/vendor/github.com/imdario/mergo/issue17_test.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package mergo
-
-import (
- "encoding/json"
- "testing"
-)
-
-var (
- request = `{"timestamp":null, "name": "foo"}`
- maprequest = map[string]interface{}{
- "timestamp": nil,
- "name": "foo",
- "newStuff": "foo",
- }
-)
-
-func TestIssue17MergeWithOverwrite(t *testing.T) {
- var something map[string]interface{}
- if err := json.Unmarshal([]byte(request), &something); err != nil {
- t.Errorf("Error while Unmarshalling maprequest: %s", err)
- }
- if err := MergeWithOverwrite(&something, maprequest); err != nil {
- t.Errorf("Error while merging: %s", err)
- }
-}
diff --git a/vendor/github.com/imdario/mergo/issue23_test.go b/vendor/github.com/imdario/mergo/issue23_test.go
deleted file mode 100644
index 283f8c6a3..000000000
--- a/vendor/github.com/imdario/mergo/issue23_test.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package mergo
-
-import (
- "testing"
- "time"
-)
-
-type document struct {
- Created *time.Time
-}
-
-func TestIssue23MergeWithOverwrite(t *testing.T) {
- now := time.Now()
- dst := document{
- &now,
- }
- expected := time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC)
- src := document{
- &expected,
- }
- if err := MergeWithOverwrite(&dst, src); err != nil {
- t.Errorf("Error while merging %s", err)
- }
- if !dst.Created.Equal(*src.Created) { //--> https://golang.org/pkg/time/#pkg-overview
- t.Fatalf("Created not merged in properly: dst.Created(%v) != src.Created(%v)", dst.Created, src.Created)
- }
-}
diff --git a/vendor/github.com/imdario/mergo/issue33_test.go b/vendor/github.com/imdario/mergo/issue33_test.go
deleted file mode 100644
index ae55ae236..000000000
--- a/vendor/github.com/imdario/mergo/issue33_test.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package mergo
-
-import (
- "testing"
-)
-
-type Foo struct {
- Str string
- Bslice []byte
-}
-
-func TestIssue33Merge(t *testing.T) {
- dest := Foo{Str: "a"}
- toMerge := Foo{
- Str: "b",
- Bslice: []byte{1, 2},
- }
- if err := Merge(&dest, toMerge); err != nil {
- t.Errorf("Error while merging: %s", err)
- }
- // Merge doesn't overwrite an attribute if in destination it doesn't have a zero value.
- // In this case, Str isn't a zero value string.
- if dest.Str != "a" {
- t.Errorf("dest.Str should have not been override as it has a non-zero value: dest.Str(%v) != 'a'", dest.Str)
- }
- // If we want to override, we must use MergeWithOverwrite or Merge using WithOverride.
- if err := Merge(&dest, toMerge, WithOverride); err != nil {
- t.Errorf("Error while merging: %s", err)
- }
- if dest.Str != toMerge.Str {
- t.Errorf("dest.Str should have been override: dest.Str(%v) != toMerge.Str(%v)", dest.Str, toMerge.Str)
- }
-}
diff --git a/vendor/github.com/imdario/mergo/issue38_test.go b/vendor/github.com/imdario/mergo/issue38_test.go
deleted file mode 100644
index 286b68cb1..000000000
--- a/vendor/github.com/imdario/mergo/issue38_test.go
+++ /dev/null
@@ -1,59 +0,0 @@
-package mergo
-
-import (
- "testing"
- "time"
-)
-
-type structWithoutTimePointer struct {
- Created time.Time
-}
-
-func TestIssue38Merge(t *testing.T) {
- dst := structWithoutTimePointer{
- time.Now(),
- }
-
- expected := time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC)
- src := structWithoutTimePointer{
- expected,
- }
- if err := Merge(&dst, src); err != nil {
- t.Errorf("Error while merging %s", err)
- }
- if dst.Created == src.Created {
- t.Fatalf("Created merged unexpectedly: dst.Created(%v) == src.Created(%v)", dst.Created, src.Created)
- }
-}
-
-func TestIssue38MergeEmptyStruct(t *testing.T) {
- dst := structWithoutTimePointer{}
-
- expected := time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC)
- src := structWithoutTimePointer{
- expected,
- }
- if err := Merge(&dst, src); err != nil {
- t.Errorf("Error while merging %s", err)
- }
- if dst.Created == src.Created {
- t.Fatalf("Created merged unexpectedly: dst.Created(%v) == src.Created(%v)", dst.Created, src.Created)
- }
-}
-
-func TestIssue38MergeWithOverwrite(t *testing.T) {
- dst := structWithoutTimePointer{
- time.Now(),
- }
-
- expected := time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC)
- src := structWithoutTimePointer{
- expected,
- }
- if err := MergeWithOverwrite(&dst, src); err != nil {
- t.Errorf("Error while merging %s", err)
- }
- if dst.Created != src.Created {
- t.Fatalf("Created not merged in properly: dst.Created(%v) != src.Created(%v)", dst.Created, src.Created)
- }
-}
diff --git a/vendor/github.com/imdario/mergo/issue50_test.go b/vendor/github.com/imdario/mergo/issue50_test.go
deleted file mode 100644
index 89aa36345..000000000
--- a/vendor/github.com/imdario/mergo/issue50_test.go
+++ /dev/null
@@ -1,18 +0,0 @@
-package mergo
-
-import (
- "testing"
- "time"
-)
-
-type testStruct struct {
- time.Duration
-}
-
-func TestIssue50Merge(t *testing.T) {
- to := testStruct{}
- from := testStruct{}
- if err := Merge(&to, from); err != nil {
- t.Fail()
- }
-}
diff --git a/vendor/github.com/imdario/mergo/issue52_test.go b/vendor/github.com/imdario/mergo/issue52_test.go
deleted file mode 100644
index 62cd9fa7c..000000000
--- a/vendor/github.com/imdario/mergo/issue52_test.go
+++ /dev/null
@@ -1,99 +0,0 @@
-package mergo
-
-import (
- "reflect"
- "testing"
- "time"
-)
-
-type structWithTime struct {
- Birth time.Time
-}
-
-type timeTransfomer struct {
- overwrite bool
-}
-
-func (t timeTransfomer) Transformer(typ reflect.Type) func(dst, src reflect.Value) error {
- if typ == reflect.TypeOf(time.Time{}) {
- return func(dst, src reflect.Value) error {
- if dst.CanSet() {
- if t.overwrite {
- isZero := src.MethodByName("IsZero")
- result := isZero.Call([]reflect.Value{})
- if !result[0].Bool() {
- dst.Set(src)
- }
- } else {
- isZero := dst.MethodByName("IsZero")
- result := isZero.Call([]reflect.Value{})
- if result[0].Bool() {
- dst.Set(src)
- }
- }
- }
- return nil
- }
- }
- return nil
-}
-
-func TestOverwriteZeroSrcTime(t *testing.T) {
- now := time.Now()
- dst := structWithTime{now}
- src := structWithTime{}
- if err := MergeWithOverwrite(&dst, src); err != nil {
- t.FailNow()
- }
- if !dst.Birth.IsZero() {
- t.Fatalf("dst should have been overwritten: dst.Birth(%v) != now(%v)", dst.Birth, now)
- }
-}
-
-func TestOverwriteZeroSrcTimeWithTransformer(t *testing.T) {
- now := time.Now()
- dst := structWithTime{now}
- src := structWithTime{}
- if err := MergeWithOverwrite(&dst, src, WithTransformers(timeTransfomer{true})); err != nil {
- t.FailNow()
- }
- if dst.Birth.IsZero() {
- t.Fatalf("dst should not have been overwritten: dst.Birth(%v) != now(%v)", dst.Birth, now)
- }
-}
-
-func TestOverwriteZeroDstTime(t *testing.T) {
- now := time.Now()
- dst := structWithTime{}
- src := structWithTime{now}
- if err := MergeWithOverwrite(&dst, src); err != nil {
- t.FailNow()
- }
- if dst.Birth.IsZero() {
- t.Fatalf("dst should have been overwritten: dst.Birth(%v) != zero(%v)", dst.Birth, time.Time{})
- }
-}
-
-func TestZeroDstTime(t *testing.T) {
- now := time.Now()
- dst := structWithTime{}
- src := structWithTime{now}
- if err := Merge(&dst, src); err != nil {
- t.FailNow()
- }
- if !dst.Birth.IsZero() {
- t.Fatalf("dst should not have been overwritten: dst.Birth(%v) != zero(%v)", dst.Birth, time.Time{})
- }
-}
-
-func TestZeroDstTimeWithTransformer(t *testing.T) {
- now := time.Now()
- dst := structWithTime{}
- src := structWithTime{now}
- if err := Merge(&dst, src, WithTransformers(timeTransfomer{})); err != nil {
- t.FailNow()
- }
- if dst.Birth.IsZero() {
- t.Fatalf("dst should have been overwritten: dst.Birth(%v) != now(%v)", dst.Birth, now)
- }
-}
diff --git a/vendor/github.com/imdario/mergo/issue61_test.go b/vendor/github.com/imdario/mergo/issue61_test.go
deleted file mode 100644
index 8efa5e457..000000000
--- a/vendor/github.com/imdario/mergo/issue61_test.go
+++ /dev/null
@@ -1,20 +0,0 @@
-package mergo
-
-import (
- "reflect"
- "testing"
-)
-
-func TestIssue61MergeNilMap(t *testing.T) {
- type T struct {
- I map[string][]string
- }
- t1 := T{}
- t2 := T{I: map[string][]string{"hi": {"there"}}}
- if err := Merge(&t1, t2); err != nil {
- t.Fail()
- }
- if !reflect.DeepEqual(t2, T{I: map[string][]string{"hi": {"there"}}}) {
- t.FailNow()
- }
-}
diff --git a/vendor/github.com/imdario/mergo/issue64_test.go b/vendor/github.com/imdario/mergo/issue64_test.go
deleted file mode 100644
index 32382bef1..000000000
--- a/vendor/github.com/imdario/mergo/issue64_test.go
+++ /dev/null
@@ -1,38 +0,0 @@
-package mergo
-
-import (
- "testing"
-)
-
-type Student struct {
- Name string
- Books []string
-}
-
-var testData = []struct {
- S1 Student
- S2 Student
- ExpectedSlice []string
-}{
- {Student{"Jack", []string{"a", "B"}}, Student{"Tom", []string{"1"}}, []string{"a", "B"}},
- {Student{"Jack", []string{"a", "B"}}, Student{"Tom", []string{}}, []string{"a", "B"}},
- {Student{"Jack", []string{}}, Student{"Tom", []string{"1"}}, []string{"1"}},
- {Student{"Jack", []string{}}, Student{"Tom", []string{}}, []string{}},
-}
-
-func TestIssue64MergeSliceWithOverride(t *testing.T) {
- for _, data := range testData {
- err := Merge(&data.S2, data.S1, WithOverride)
- if err != nil {
- t.Errorf("Error while merging %s", err)
- }
- if len(data.S2.Books) != len(data.ExpectedSlice) {
- t.Fatalf("Got %d elements in slice, but expected %d", len(data.S2.Books), len(data.ExpectedSlice))
- }
- for i, val := range data.S2.Books {
- if val != data.ExpectedSlice[i] {
- t.Fatalf("Expected %s, but got %s while merging slice with override", data.ExpectedSlice[i], val)
- }
- }
- }
-}
diff --git a/vendor/github.com/imdario/mergo/issue66_test.go b/vendor/github.com/imdario/mergo/issue66_test.go
deleted file mode 100644
index 9e4bccedc..000000000
--- a/vendor/github.com/imdario/mergo/issue66_test.go
+++ /dev/null
@@ -1,48 +0,0 @@
-package mergo
-
-import (
- "testing"
-)
-
-type PrivateSliceTest66 struct {
- PublicStrings []string
- privateStrings []string
-}
-
-func TestPrivateSlice(t *testing.T) {
- p1 := PrivateSliceTest66{
- PublicStrings: []string{"one", "two", "three"},
- privateStrings: []string{"four", "five"},
- }
- p2 := PrivateSliceTest66{
- PublicStrings: []string{"six", "seven"},
- }
- if err := Merge(&p1, p2); err != nil {
- t.Fatalf("Error during the merge: %v", err)
- }
- if len(p1.PublicStrings) != 3 {
- t.Error("5 elements should be in 'PublicStrings' field")
- }
- if len(p1.privateStrings) != 2 {
- t.Error("2 elements should be in 'privateStrings' field")
- }
-}
-
-func TestPrivateSliceWithAppendSlice(t *testing.T) {
- p1 := PrivateSliceTest66{
- PublicStrings: []string{"one", "two", "three"},
- privateStrings: []string{"four", "five"},
- }
- p2 := PrivateSliceTest66{
- PublicStrings: []string{"six", "seven"},
- }
- if err := Merge(&p1, p2, WithAppendSlice); err != nil {
- t.Fatalf("Error during the merge: %v", err)
- }
- if len(p1.PublicStrings) != 5 {
- t.Error("5 elements should be in 'PublicStrings' field")
- }
- if len(p1.privateStrings) != 2 {
- t.Error("2 elements should be in 'privateStrings' field")
- }
-}
diff --git a/vendor/github.com/imdario/mergo/merge_appendslice_test.go b/vendor/github.com/imdario/mergo/merge_appendslice_test.go
deleted file mode 100644
index a780f34a3..000000000
--- a/vendor/github.com/imdario/mergo/merge_appendslice_test.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package mergo
-
-import (
- "testing"
-)
-
-var testDataS = []struct {
- S1 Student
- S2 Student
- ExpectedSlice []string
-}{
- {Student{"Jack", []string{"a", "B"}}, Student{"Tom", []string{"1"}}, []string{"1", "a", "B"}},
- {Student{"Jack", []string{"a", "B"}}, Student{"Tom", []string{}}, []string{"a", "B"}},
- {Student{"Jack", []string{}}, Student{"Tom", []string{"1"}}, []string{"1"}},
- {Student{"Jack", []string{}}, Student{"Tom", []string{}}, []string{}},
-}
-
-func TestMergeSliceWithOverrideWithAppendSlice(t *testing.T) {
- for _, data := range testDataS {
- err := Merge(&data.S2, data.S1, WithOverride, WithAppendSlice)
- if err != nil {
- t.Errorf("Error while merging %s", err)
- }
- if len(data.S2.Books) != len(data.ExpectedSlice) {
- t.Fatalf("Got %d elements in slice, but expected %d", len(data.S2.Books), len(data.ExpectedSlice))
- }
- for i, val := range data.S2.Books {
- if val != data.ExpectedSlice[i] {
- t.Fatalf("Expected %s, but got %s while merging slice with override", data.ExpectedSlice[i], val)
- }
- }
- }
-}
diff --git a/vendor/github.com/imdario/mergo/merge_test.go b/vendor/github.com/imdario/mergo/merge_test.go
deleted file mode 100644
index 5bf808a78..000000000
--- a/vendor/github.com/imdario/mergo/merge_test.go
+++ /dev/null
@@ -1,50 +0,0 @@
-package mergo
-
-import (
- "reflect"
- "testing"
-)
-
-type transformer struct {
- m map[reflect.Type]func(dst, src reflect.Value) error
-}
-
-func (s *transformer) Transformer(t reflect.Type) func(dst, src reflect.Value) error {
- if fn, ok := s.m[t]; ok {
- return fn
- }
- return nil
-}
-
-type foo struct {
- s string
- Bar *bar
-}
-
-type bar struct {
- i int
- s map[string]string
-}
-
-func TestMergeWithTransformerNilStruct(t *testing.T) {
- a := foo{s: "foo"}
- b := foo{Bar: &bar{i: 2, s: map[string]string{"foo": "bar"}}}
- if err := Merge(&a, &b, WithOverride, WithTransformers(&transformer{
- m: map[reflect.Type]func(dst, src reflect.Value) error{
- reflect.TypeOf(&bar{}): func(dst, src reflect.Value) error {
- // Do sthg with Elem
- t.Log(dst.Elem().FieldByName("i"))
- t.Log(src.Elem())
- return nil
- },
- },
- })); err != nil {
- t.Fatal(err)
- }
- if a.s != "foo" {
- t.Fatalf("b not merged in properly: a.s.Value(%s) != expected(%s)", a.s, "foo")
- }
- if a.Bar == nil {
- t.Fatalf("b not merged in properly: a.Bar shouldn't be nil")
- }
-}
diff --git a/vendor/github.com/imdario/mergo/mergo_test.go b/vendor/github.com/imdario/mergo/mergo_test.go
deleted file mode 100644
index d77753843..000000000
--- a/vendor/github.com/imdario/mergo/mergo_test.go
+++ /dev/null
@@ -1,733 +0,0 @@
-// Copyright 2013 Dario Castañé. All rights reserved.
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package mergo
-
-import (
- "io/ioutil"
- "reflect"
- "testing"
- "time"
-
- "gopkg.in/yaml.v2"
-)
-
-type simpleTest struct {
- Value int
-}
-
-type complexTest struct {
- St simpleTest
- sz int
- ID string
-}
-
-type mapTest struct {
- M map[int]int
-}
-
-type ifcTest struct {
- I interface{}
-}
-
-type moreComplextText struct {
- Ct complexTest
- St simpleTest
- Nt simpleTest
-}
-
-type pointerTest struct {
- C *simpleTest
-}
-
-type sliceTest struct {
- S []int
-}
-
-func TestKb(t *testing.T) {
- type testStruct struct {
- Name string
- KeyValue map[string]interface{}
- }
-
- akv := make(map[string]interface{})
- akv["Key1"] = "not value 1"
- akv["Key2"] = "value2"
- a := testStruct{}
- a.Name = "A"
- a.KeyValue = akv
-
- bkv := make(map[string]interface{})
- bkv["Key1"] = "value1"
- bkv["Key3"] = "value3"
- b := testStruct{}
- b.Name = "B"
- b.KeyValue = bkv
-
- ekv := make(map[string]interface{})
- ekv["Key1"] = "value1"
- ekv["Key2"] = "value2"
- ekv["Key3"] = "value3"
- expected := testStruct{}
- expected.Name = "B"
- expected.KeyValue = ekv
-
- Merge(&b, a)
-
- if !reflect.DeepEqual(b, expected) {
- t.Errorf("Actual: %#v did not match \nExpected: %#v", b, expected)
- }
-}
-
-func TestNil(t *testing.T) {
- if err := Merge(nil, nil); err != ErrNilArguments {
- t.Fail()
- }
-}
-
-func TestDifferentTypes(t *testing.T) {
- a := simpleTest{42}
- b := 42
- if err := Merge(&a, b); err != ErrDifferentArgumentsTypes {
- t.Fail()
- }
-}
-
-func TestSimpleStruct(t *testing.T) {
- a := simpleTest{}
- b := simpleTest{42}
- if err := Merge(&a, b); err != nil {
- t.FailNow()
- }
- if a.Value != 42 {
- t.Fatalf("b not merged in properly: a.Value(%d) != b.Value(%d)", a.Value, b.Value)
- }
- if !reflect.DeepEqual(a, b) {
- t.FailNow()
- }
-}
-
-func TestComplexStruct(t *testing.T) {
- a := complexTest{}
- a.ID = "athing"
- b := complexTest{simpleTest{42}, 1, "bthing"}
- if err := Merge(&a, b); err != nil {
- t.FailNow()
- }
- if a.St.Value != 42 {
- t.Fatalf("b not merged in properly: a.St.Value(%d) != b.St.Value(%d)", a.St.Value, b.St.Value)
- }
- if a.sz == 1 {
- t.Fatalf("a's private field sz not preserved from merge: a.sz(%d) == b.sz(%d)", a.sz, b.sz)
- }
- if a.ID == b.ID {
- t.Fatalf("a's field ID merged unexpectedly: a.ID(%s) == b.ID(%s)", a.ID, b.ID)
- }
-}
-
-func TestComplexStructWithOverwrite(t *testing.T) {
- a := complexTest{simpleTest{1}, 1, "do-not-overwrite-with-empty-value"}
- b := complexTest{simpleTest{42}, 2, ""}
-
- expect := complexTest{simpleTest{42}, 1, "do-not-overwrite-with-empty-value"}
- if err := MergeWithOverwrite(&a, b); err != nil {
- t.FailNow()
- }
-
- if !reflect.DeepEqual(a, expect) {
- t.Fatalf("Test failed:\ngot :\n%#v\n\nwant :\n%#v\n\n", a, expect)
- }
-}
-
-func TestPointerStruct(t *testing.T) {
- s1 := simpleTest{}
- s2 := simpleTest{19}
- a := pointerTest{&s1}
- b := pointerTest{&s2}
- if err := Merge(&a, b); err != nil {
- t.FailNow()
- }
- if a.C.Value != b.C.Value {
- t.Fatalf("b not merged in properly: a.C.Value(%d) != b.C.Value(%d)", a.C.Value, b.C.Value)
- }
-}
-
-type embeddingStruct struct {
- embeddedStruct
-}
-
-type embeddedStruct struct {
- A string
-}
-
-func TestEmbeddedStruct(t *testing.T) {
- tests := []struct {
- src embeddingStruct
- dst embeddingStruct
- expected embeddingStruct
- }{
- {
- src: embeddingStruct{
- embeddedStruct{"foo"},
- },
- dst: embeddingStruct{
- embeddedStruct{""},
- },
- expected: embeddingStruct{
- embeddedStruct{"foo"},
- },
- },
- {
- src: embeddingStruct{
- embeddedStruct{""},
- },
- dst: embeddingStruct{
- embeddedStruct{"bar"},
- },
- expected: embeddingStruct{
- embeddedStruct{"bar"},
- },
- },
- {
- src: embeddingStruct{
- embeddedStruct{"foo"},
- },
- dst: embeddingStruct{
- embeddedStruct{"bar"},
- },
- expected: embeddingStruct{
- embeddedStruct{"bar"},
- },
- },
- }
-
- for _, test := range tests {
- err := Merge(&test.dst, test.src)
- if err != nil {
- t.Errorf("unexpected error: %v", err)
- continue
- }
- if !reflect.DeepEqual(test.dst, test.expected) {
- t.Errorf("unexpected output\nexpected:\n%+v\nsaw:\n%+v\n", test.expected, test.dst)
- }
- }
-}
-
-func TestPointerStructNil(t *testing.T) {
- a := pointerTest{nil}
- b := pointerTest{&simpleTest{19}}
- if err := Merge(&a, b); err != nil {
- t.FailNow()
- }
- if a.C.Value != b.C.Value {
- t.Fatalf("b not merged in a properly: a.C.Value(%d) != b.C.Value(%d)", a.C.Value, b.C.Value)
- }
-}
-
-func testSlice(t *testing.T, a []int, b []int, e []int, opts ...func(*Config)) {
- t.Helper()
- bc := b
-
- sa := sliceTest{a}
- sb := sliceTest{b}
- if err := Merge(&sa, sb, opts...); err != nil {
- t.FailNow()
- }
- if !reflect.DeepEqual(sb.S, bc) {
- t.Fatalf("Source slice was modified %d != %d", sb.S, bc)
- }
- if !reflect.DeepEqual(sa.S, e) {
- t.Fatalf("b not merged in a proper way %d != %d", sa.S, e)
- }
-
- ma := map[string][]int{"S": a}
- mb := map[string][]int{"S": b}
- if err := Merge(&ma, mb, opts...); err != nil {
- t.FailNow()
- }
- if !reflect.DeepEqual(mb["S"], bc) {
- t.Fatalf("map value: Source slice was modified %d != %d", mb["S"], bc)
- }
- if !reflect.DeepEqual(ma["S"], e) {
- t.Fatalf("map value: b not merged in a proper way %d != %d", ma["S"], e)
- }
-
- if a == nil {
- // test case with missing dst key
- ma := map[string][]int{}
- mb := map[string][]int{"S": b}
- if err := Merge(&ma, mb); err != nil {
- t.FailNow()
- }
- if !reflect.DeepEqual(mb["S"], bc) {
- t.Fatalf("missing dst key: Source slice was modified %d != %d", mb["S"], bc)
- }
- if !reflect.DeepEqual(ma["S"], e) {
- t.Fatalf("missing dst key: b not merged in a proper way %d != %d", ma["S"], e)
- }
- }
-
- if b == nil {
- // test case with missing src key
- ma := map[string][]int{"S": a}
- mb := map[string][]int{}
- if err := Merge(&ma, mb); err != nil {
- t.FailNow()
- }
- if !reflect.DeepEqual(mb["S"], bc) {
- t.Fatalf("missing src key: Source slice was modified %d != %d", mb["S"], bc)
- }
- if !reflect.DeepEqual(ma["S"], e) {
- t.Fatalf("missing src key: b not merged in a proper way %d != %d", ma["S"], e)
- }
- }
-}
-
-func TestSlice(t *testing.T) {
- testSlice(t, nil, []int{1, 2, 3}, []int{1, 2, 3})
- testSlice(t, []int{}, []int{1, 2, 3}, []int{1, 2, 3})
- testSlice(t, []int{1}, []int{2, 3}, []int{1})
- testSlice(t, []int{1}, []int{}, []int{1})
- testSlice(t, []int{1}, nil, []int{1})
- testSlice(t, nil, []int{1, 2, 3}, []int{1, 2, 3}, WithAppendSlice)
- testSlice(t, []int{}, []int{1, 2, 3}, []int{1, 2, 3}, WithAppendSlice)
- testSlice(t, []int{1}, []int{2, 3}, []int{1, 2, 3}, WithAppendSlice)
- testSlice(t, []int{1}, []int{}, []int{1}, WithAppendSlice)
- testSlice(t, []int{1}, nil, []int{1}, WithAppendSlice)
-}
-
-func TestEmptyMaps(t *testing.T) {
- a := mapTest{}
- b := mapTest{
- map[int]int{},
- }
- if err := Merge(&a, b); err != nil {
- t.Fail()
- }
- if !reflect.DeepEqual(a, b) {
- t.FailNow()
- }
-}
-
-func TestEmptyToEmptyMaps(t *testing.T) {
- a := mapTest{}
- b := mapTest{}
- if err := Merge(&a, b); err != nil {
- t.Fail()
- }
- if !reflect.DeepEqual(a, b) {
- t.FailNow()
- }
-}
-
-func TestEmptyToNotEmptyMaps(t *testing.T) {
- a := mapTest{map[int]int{
- 1: 2,
- 3: 4,
- }}
- aa := mapTest{map[int]int{
- 1: 2,
- 3: 4,
- }}
- b := mapTest{
- map[int]int{},
- }
- if err := Merge(&a, b); err != nil {
- t.Fail()
- }
- if !reflect.DeepEqual(a, aa) {
- t.FailNow()
- }
-}
-
-func TestMapsWithOverwrite(t *testing.T) {
- m := map[string]simpleTest{
- "a": {}, // overwritten by 16
- "b": {42}, // not overwritten by empty value
- "c": {13}, // overwritten by 12
- "d": {61},
- }
- n := map[string]simpleTest{
- "a": {16},
- "b": {},
- "c": {12},
- "e": {14},
- }
- expect := map[string]simpleTest{
- "a": {16},
- "b": {},
- "c": {12},
- "d": {61},
- "e": {14},
- }
-
- if err := MergeWithOverwrite(&m, n); err != nil {
- t.Fatalf(err.Error())
- }
-
- if !reflect.DeepEqual(m, expect) {
- t.Fatalf("Test failed:\ngot :\n%#v\n\nwant :\n%#v\n\n", m, expect)
- }
-}
-
-func TestMaps(t *testing.T) {
- m := map[string]simpleTest{
- "a": {},
- "b": {42},
- "c": {13},
- "d": {61},
- }
- n := map[string]simpleTest{
- "a": {16},
- "b": {},
- "c": {12},
- "e": {14},
- }
- expect := map[string]simpleTest{
- "a": {0},
- "b": {42},
- "c": {13},
- "d": {61},
- "e": {14},
- }
-
- if err := Merge(&m, n); err != nil {
- t.Fatalf(err.Error())
- }
-
- if !reflect.DeepEqual(m, expect) {
- t.Fatalf("Test failed:\ngot :\n%#v\n\nwant :\n%#v\n\n", m, expect)
- }
- if m["a"].Value != 0 {
- t.Fatalf(`n merged in m because I solved non-addressable map values TODO: m["a"].Value(%d) != n["a"].Value(%d)`, m["a"].Value, n["a"].Value)
- }
- if m["b"].Value != 42 {
- t.Fatalf(`n wrongly merged in m: m["b"].Value(%d) != n["b"].Value(%d)`, m["b"].Value, n["b"].Value)
- }
- if m["c"].Value != 13 {
- t.Fatalf(`n overwritten in m: m["c"].Value(%d) != n["c"].Value(%d)`, m["c"].Value, n["c"].Value)
- }
-}
-
-func TestMapsWithNilPointer(t *testing.T) {
- m := map[string]*simpleTest{
- "a": nil,
- "b": nil,
- }
- n := map[string]*simpleTest{
- "b": nil,
- "c": nil,
- }
- expect := map[string]*simpleTest{
- "a": nil,
- "b": nil,
- "c": nil,
- }
-
- if err := Merge(&m, n, WithOverride); err != nil {
- t.Fatalf(err.Error())
- }
-
- if !reflect.DeepEqual(m, expect) {
- t.Fatalf("Test failed:\ngot :\n%#v\n\nwant :\n%#v\n\n", m, expect)
- }
-}
-
-func TestYAMLMaps(t *testing.T) {
- thing := loadYAML("testdata/thing.yml")
- license := loadYAML("testdata/license.yml")
- ft := thing["fields"].(map[interface{}]interface{})
- fl := license["fields"].(map[interface{}]interface{})
- // license has one extra field (site) and another already existing in thing (author) that Mergo won't override.
- expectedLength := len(ft) + len(fl) - 1
- if err := Merge(&license, thing); err != nil {
- t.Fatal(err.Error())
- }
- currentLength := len(license["fields"].(map[interface{}]interface{}))
- if currentLength != expectedLength {
- t.Fatalf(`thing not merged in license properly, license must have %d elements instead of %d`, expectedLength, currentLength)
- }
- fields := license["fields"].(map[interface{}]interface{})
- if _, ok := fields["id"]; !ok {
- t.Fatalf(`thing not merged in license properly, license must have a new id field from thing`)
- }
-}
-
-func TestTwoPointerValues(t *testing.T) {
- a := &simpleTest{}
- b := &simpleTest{42}
- if err := Merge(a, b); err != nil {
- t.Fatalf(`Boom. You crossed the streams: %s`, err)
- }
-}
-
-func TestMap(t *testing.T) {
- a := complexTest{}
- a.ID = "athing"
- c := moreComplextText{a, simpleTest{}, simpleTest{}}
- b := map[string]interface{}{
- "ct": map[string]interface{}{
- "st": map[string]interface{}{
- "value": 42,
- },
- "sz": 1,
- "id": "bthing",
- },
- "st": &simpleTest{144}, // Mapping a reference
- "zt": simpleTest{299}, // Mapping a missing field (zt doesn't exist)
- "nt": simpleTest{3},
- }
- if err := Map(&c, b); err != nil {
- t.FailNow()
- }
- m := b["ct"].(map[string]interface{})
- n := m["st"].(map[string]interface{})
- o := b["st"].(*simpleTest)
- p := b["nt"].(simpleTest)
- if c.Ct.St.Value != 42 {
- t.Fatalf("b not merged in properly: c.Ct.St.Value(%d) != b.Ct.St.Value(%d)", c.Ct.St.Value, n["value"])
- }
- if c.St.Value != 144 {
- t.Fatalf("b not merged in properly: c.St.Value(%d) != b.St.Value(%d)", c.St.Value, o.Value)
- }
- if c.Nt.Value != 3 {
- t.Fatalf("b not merged in properly: c.Nt.Value(%d) != b.Nt.Value(%d)", c.St.Value, p.Value)
- }
- if c.Ct.sz == 1 {
- t.Fatalf("a's private field sz not preserved from merge: c.Ct.sz(%d) == b.Ct.sz(%d)", c.Ct.sz, m["sz"])
- }
- if c.Ct.ID == m["id"] {
- t.Fatalf("a's field ID merged unexpectedly: c.Ct.ID(%s) == b.Ct.ID(%s)", c.Ct.ID, m["id"])
- }
-}
-
-func TestSimpleMap(t *testing.T) {
- a := simpleTest{}
- b := map[string]interface{}{
- "value": 42,
- }
- if err := Map(&a, b); err != nil {
- t.FailNow()
- }
- if a.Value != 42 {
- t.Fatalf("b not merged in properly: a.Value(%d) != b.Value(%v)", a.Value, b["value"])
- }
-}
-
-func TestIfcMap(t *testing.T) {
- a := ifcTest{}
- b := ifcTest{42}
- if err := Map(&a, b); err != nil {
- t.FailNow()
- }
- if a.I != 42 {
- t.Fatalf("b not merged in properly: a.I(%d) != b.I(%d)", a.I, b.I)
- }
- if !reflect.DeepEqual(a, b) {
- t.FailNow()
- }
-}
-
-func TestIfcMapNoOverwrite(t *testing.T) {
- a := ifcTest{13}
- b := ifcTest{42}
- if err := Map(&a, b); err != nil {
- t.FailNow()
- }
- if a.I != 13 {
- t.Fatalf("a not left alone: a.I(%d) == b.I(%d)", a.I, b.I)
- }
-}
-
-func TestIfcMapWithOverwrite(t *testing.T) {
- a := ifcTest{13}
- b := ifcTest{42}
- if err := MapWithOverwrite(&a, b); err != nil {
- t.FailNow()
- }
- if a.I != 42 {
- t.Fatalf("b not merged in properly: a.I(%d) != b.I(%d)", a.I, b.I)
- }
- if !reflect.DeepEqual(a, b) {
- t.FailNow()
- }
-}
-
-type pointerMapTest struct {
- A int
- hidden int
- B *simpleTest
-}
-
-func TestBackAndForth(t *testing.T) {
- pt := pointerMapTest{42, 1, &simpleTest{66}}
- m := make(map[string]interface{})
- if err := Map(&m, pt); err != nil {
- t.FailNow()
- }
- var (
- v interface{}
- ok bool
- )
- if v, ok = m["a"]; v.(int) != pt.A || !ok {
- t.Fatalf("pt not merged in properly: m[`a`](%d) != pt.A(%d)", v, pt.A)
- }
- if v, ok = m["b"]; !ok {
- t.Fatalf("pt not merged in properly: B is missing in m")
- }
- var st *simpleTest
- if st = v.(*simpleTest); st.Value != 66 {
- t.Fatalf("something went wrong while mapping pt on m, B wasn't copied")
- }
- bpt := pointerMapTest{}
- if err := Map(&bpt, m); err != nil {
- t.Fatal(err)
- }
- if bpt.A != pt.A {
- t.Fatalf("pt not merged in properly: bpt.A(%d) != pt.A(%d)", bpt.A, pt.A)
- }
- if bpt.hidden == pt.hidden {
- t.Fatalf("pt unexpectedly merged: bpt.hidden(%d) == pt.hidden(%d)", bpt.hidden, pt.hidden)
- }
- if bpt.B.Value != pt.B.Value {
- t.Fatalf("pt not merged in properly: bpt.B.Value(%d) != pt.B.Value(%d)", bpt.B.Value, pt.B.Value)
- }
-}
-
-func TestEmbeddedPointerUnpacking(t *testing.T) {
- tests := []struct{ input pointerMapTest }{
- {pointerMapTest{42, 1, nil}},
- {pointerMapTest{42, 1, &simpleTest{66}}},
- }
- newValue := 77
- m := map[string]interface{}{
- "b": map[string]interface{}{
- "value": newValue,
- },
- }
- for _, test := range tests {
- pt := test.input
- if err := MapWithOverwrite(&pt, m); err != nil {
- t.FailNow()
- }
- if pt.B.Value != newValue {
- t.Fatalf("pt not mapped properly: pt.A.Value(%d) != m[`b`][`value`](%d)", pt.B.Value, newValue)
- }
-
- }
-}
-
-type structWithTimePointer struct {
- Birth *time.Time
-}
-
-func TestTime(t *testing.T) {
- now := time.Now()
- dataStruct := structWithTimePointer{
- Birth: &now,
- }
- dataMap := map[string]interface{}{
- "Birth": &now,
- }
- b := structWithTimePointer{}
- if err := Merge(&b, dataStruct); err != nil {
- t.FailNow()
- }
- if b.Birth.IsZero() {
- t.Fatalf("time.Time not merged in properly: b.Birth(%v) != dataStruct['Birth'](%v)", b.Birth, dataStruct.Birth)
- }
- if b.Birth != dataStruct.Birth {
- t.Fatalf("time.Time not merged in properly: b.Birth(%v) != dataStruct['Birth'](%v)", b.Birth, dataStruct.Birth)
- }
- b = structWithTimePointer{}
- if err := Map(&b, dataMap); err != nil {
- t.FailNow()
- }
- if b.Birth.IsZero() {
- t.Fatalf("time.Time not merged in properly: b.Birth(%v) != dataMap['Birth'](%v)", b.Birth, dataMap["Birth"])
- }
-}
-
-type simpleNested struct {
- A int
-}
-
-type structWithNestedPtrValueMap struct {
- NestedPtrValue map[string]*simpleNested
-}
-
-func TestNestedPtrValueInMap(t *testing.T) {
- src := &structWithNestedPtrValueMap{
- NestedPtrValue: map[string]*simpleNested{
- "x": {
- A: 1,
- },
- },
- }
- dst := &structWithNestedPtrValueMap{
- NestedPtrValue: map[string]*simpleNested{
- "x": {},
- },
- }
- if err := Map(dst, src); err != nil {
- t.FailNow()
- }
- if dst.NestedPtrValue["x"].A == 0 {
- t.Fatalf("Nested Ptr value not merged in properly: dst.NestedPtrValue[\"x\"].A(%v) != src.NestedPtrValue[\"x\"].A(%v)", dst.NestedPtrValue["x"].A, src.NestedPtrValue["x"].A)
- }
-}
-
-func loadYAML(path string) (m map[string]interface{}) {
- m = make(map[string]interface{})
- raw, _ := ioutil.ReadFile(path)
- _ = yaml.Unmarshal(raw, &m)
- return
-}
-
-type structWithMap struct {
- m map[string]structWithUnexportedProperty
-}
-
-type structWithUnexportedProperty struct {
- s string
-}
-
-func TestUnexportedProperty(t *testing.T) {
- a := structWithMap{map[string]structWithUnexportedProperty{
- "key": {"hello"},
- }}
- b := structWithMap{map[string]structWithUnexportedProperty{
- "key": {"hi"},
- }}
- defer func() {
- if r := recover(); r != nil {
- t.Errorf("Should not have panicked")
- }
- }()
- Merge(&a, b)
-}
-
-type structWithBoolPointer struct {
- C *bool
-}
-
-func TestBooleanPointer(t *testing.T) {
- bt, bf := true, false
- src := structWithBoolPointer{
- &bt,
- }
- dst := structWithBoolPointer{
- &bf,
- }
- if err := Merge(&dst, src); err != nil {
- t.FailNow()
- }
- if dst.C == src.C {
- t.Fatalf("dst.C should be a different pointer than src.C")
- }
- if *dst.C != *src.C {
- t.Fatalf("dst.C should be true")
- }
-}
diff --git a/vendor/github.com/imdario/mergo/pr80_test.go b/vendor/github.com/imdario/mergo/pr80_test.go
deleted file mode 100644
index 0b3220f3b..000000000
--- a/vendor/github.com/imdario/mergo/pr80_test.go
+++ /dev/null
@@ -1,18 +0,0 @@
-package mergo
-
-import (
- "testing"
-)
-
-type mapInterface map[string]interface{}
-
-func TestMergeMapsEmptyString(t *testing.T) {
- a := mapInterface{"s": ""}
- b := mapInterface{"s": "foo"}
- if err := Merge(&a, b); err != nil {
- t.Fatal(err)
- }
- if a["s"] != "foo" {
- t.Fatalf("b not merged in properly: a.s.Value(%s) != expected(%s)", a["s"], "foo")
- }
-}
diff --git a/vendor/github.com/imdario/mergo/pr81_test.go b/vendor/github.com/imdario/mergo/pr81_test.go
deleted file mode 100644
index e90e923fe..000000000
--- a/vendor/github.com/imdario/mergo/pr81_test.go
+++ /dev/null
@@ -1,42 +0,0 @@
-package mergo
-
-import (
- "testing"
-)
-
-func TestMapInterfaceWithMultipleLayer(t *testing.T) {
- m1 := map[string]interface{}{
- "k1": map[string]interface{}{
- "k1.1": "v1",
- },
- }
-
- m2 := map[string]interface{}{
- "k1": map[string]interface{}{
- "k1.1": "v2",
- "k1.2": "v3",
- },
- }
-
- if err := Map(&m1, m2, WithOverride); err != nil {
- t.Fatalf("Error merging: %v", err)
- }
-
- // Check overwrite of sub map works
- expected := "v2"
- actual := m1["k1"].(map[string]interface{})["k1.1"].(string)
- if actual != expected {
- t.Fatalf("Expected %v but got %v",
- expected,
- actual)
- }
-
- // Check new key is merged
- expected = "v3"
- actual = m1["k1"].(map[string]interface{})["k1.2"].(string)
- if actual != expected {
- t.Fatalf("Expected %v but got %v",
- expected,
- actual)
- }
-}
diff --git a/vendor/github.com/jmespath/go-jmespath/api_test.go b/vendor/github.com/jmespath/go-jmespath/api_test.go
deleted file mode 100644
index b0b106d3d..000000000
--- a/vendor/github.com/jmespath/go-jmespath/api_test.go
+++ /dev/null
@@ -1,32 +0,0 @@
-package jmespath
-
-import (
- "testing"
-
- "github.com/stretchr/testify/assert"
-)
-
-func TestValidPrecompiledExpressionSearches(t *testing.T) {
- assert := assert.New(t)
- data := make(map[string]interface{})
- data["foo"] = "bar"
- precompiled, err := Compile("foo")
- assert.Nil(err)
- result, err := precompiled.Search(data)
- assert.Nil(err)
- assert.Equal("bar", result)
-}
-
-func TestInvalidPrecompileErrors(t *testing.T) {
- assert := assert.New(t)
- _, err := Compile("not a valid expression")
- assert.NotNil(err)
-}
-
-func TestInvalidMustCompilePanics(t *testing.T) {
- defer func() {
- r := recover()
- assert.NotNil(t, r)
- }()
- MustCompile("not a valid expression")
-}
diff --git a/vendor/github.com/jmespath/go-jmespath/compliance_test.go b/vendor/github.com/jmespath/go-jmespath/compliance_test.go
deleted file mode 100644
index 4ee9c959d..000000000
--- a/vendor/github.com/jmespath/go-jmespath/compliance_test.go
+++ /dev/null
@@ -1,123 +0,0 @@
-package jmespath
-
-import (
- "encoding/json"
- "fmt"
- "io/ioutil"
- "os"
- "path/filepath"
- "testing"
-
- "github.com/stretchr/testify/assert"
-)
-
-type TestSuite struct {
- Given interface{}
- TestCases []TestCase `json:"cases"`
- Comment string
-}
-type TestCase struct {
- Comment string
- Expression string
- Result interface{}
- Error string
-}
-
-var whiteListed = []string{
- "compliance/basic.json",
- "compliance/current.json",
- "compliance/escape.json",
- "compliance/filters.json",
- "compliance/functions.json",
- "compliance/identifiers.json",
- "compliance/indices.json",
- "compliance/literal.json",
- "compliance/multiselect.json",
- "compliance/ormatch.json",
- "compliance/pipe.json",
- "compliance/slice.json",
- "compliance/syntax.json",
- "compliance/unicode.json",
- "compliance/wildcard.json",
- "compliance/boolean.json",
-}
-
-func allowed(path string) bool {
- for _, el := range whiteListed {
- if el == path {
- return true
- }
- }
- return false
-}
-
-func TestCompliance(t *testing.T) {
- assert := assert.New(t)
-
- var complianceFiles []string
- err := filepath.Walk("compliance", func(path string, _ os.FileInfo, _ error) error {
- //if strings.HasSuffix(path, ".json") {
- if allowed(path) {
- complianceFiles = append(complianceFiles, path)
- }
- return nil
- })
- if assert.Nil(err) {
- for _, filename := range complianceFiles {
- runComplianceTest(assert, filename)
- }
- }
-}
-
-func runComplianceTest(assert *assert.Assertions, filename string) {
- var testSuites []TestSuite
- data, err := ioutil.ReadFile(filename)
- if assert.Nil(err) {
- err := json.Unmarshal(data, &testSuites)
- if assert.Nil(err) {
- for _, testsuite := range testSuites {
- runTestSuite(assert, testsuite, filename)
- }
- }
- }
-}
-
-func runTestSuite(assert *assert.Assertions, testsuite TestSuite, filename string) {
- for _, testcase := range testsuite.TestCases {
- if testcase.Error != "" {
- // This is a test case that verifies we error out properly.
- runSyntaxTestCase(assert, testsuite.Given, testcase, filename)
- } else {
- runTestCase(assert, testsuite.Given, testcase, filename)
- }
- }
-}
-
-func runSyntaxTestCase(assert *assert.Assertions, given interface{}, testcase TestCase, filename string) {
- // Anything with an .Error means that we expect that JMESPath should return
- // an error when we try to evaluate the expression.
- _, err := Search(testcase.Expression, given)
- assert.NotNil(err, fmt.Sprintf("Expression: %s", testcase.Expression))
-}
-
-func runTestCase(assert *assert.Assertions, given interface{}, testcase TestCase, filename string) {
- lexer := NewLexer()
- var err error
- _, err = lexer.tokenize(testcase.Expression)
- if err != nil {
- errMsg := fmt.Sprintf("(%s) Could not lex expression: %s -- %s", filename, testcase.Expression, err.Error())
- assert.Fail(errMsg)
- return
- }
- parser := NewParser()
- _, err = parser.Parse(testcase.Expression)
- if err != nil {
- errMsg := fmt.Sprintf("(%s) Could not parse expression: %s -- %s", filename, testcase.Expression, err.Error())
- assert.Fail(errMsg)
- return
- }
- actual, err := Search(testcase.Expression, given)
- if assert.Nil(err, fmt.Sprintf("Expression: %s", testcase.Expression)) {
- assert.Equal(testcase.Result, actual, fmt.Sprintf("Expression: %s", testcase.Expression))
- }
-}
diff --git a/vendor/github.com/jmespath/go-jmespath/interpreter_test.go b/vendor/github.com/jmespath/go-jmespath/interpreter_test.go
deleted file mode 100644
index 11c6d0aa0..000000000
--- a/vendor/github.com/jmespath/go-jmespath/interpreter_test.go
+++ /dev/null
@@ -1,221 +0,0 @@
-package jmespath
-
-import (
- "encoding/json"
- "testing"
-
- "github.com/stretchr/testify/assert"
-)
-
-type scalars struct {
- Foo string
- Bar string
-}
-
-type sliceType struct {
- A string
- B []scalars
- C []*scalars
-}
-
-type benchmarkStruct struct {
- Fooasdfasdfasdfasdf string
-}
-
-type benchmarkNested struct {
- Fooasdfasdfasdfasdf nestedA
-}
-
-type nestedA struct {
- Fooasdfasdfasdfasdf nestedB
-}
-
-type nestedB struct {
- Fooasdfasdfasdfasdf nestedC
-}
-
-type nestedC struct {
- Fooasdfasdfasdfasdf string
-}
-
-type nestedSlice struct {
- A []sliceType
-}
-
-func TestCanSupportEmptyInterface(t *testing.T) {
- assert := assert.New(t)
- data := make(map[string]interface{})
- data["foo"] = "bar"
- result, err := Search("foo", data)
- assert.Nil(err)
- assert.Equal("bar", result)
-}
-
-func TestCanSupportUserDefinedStructsValue(t *testing.T) {
- assert := assert.New(t)
- s := scalars{Foo: "one", Bar: "bar"}
- result, err := Search("Foo", s)
- assert.Nil(err)
- assert.Equal("one", result)
-}
-
-func TestCanSupportUserDefinedStructsRef(t *testing.T) {
- assert := assert.New(t)
- s := scalars{Foo: "one", Bar: "bar"}
- result, err := Search("Foo", &s)
- assert.Nil(err)
- assert.Equal("one", result)
-}
-
-func TestCanSupportStructWithSliceAll(t *testing.T) {
- assert := assert.New(t)
- data := sliceType{A: "foo", B: []scalars{{"f1", "b1"}, {"correct", "b2"}}}
- result, err := Search("B[].Foo", data)
- assert.Nil(err)
- assert.Equal([]interface{}{"f1", "correct"}, result)
-}
-
-func TestCanSupportStructWithSlicingExpression(t *testing.T) {
- assert := assert.New(t)
- data := sliceType{A: "foo", B: []scalars{{"f1", "b1"}, {"correct", "b2"}}}
- result, err := Search("B[:].Foo", data)
- assert.Nil(err)
- assert.Equal([]interface{}{"f1", "correct"}, result)
-}
-
-func TestCanSupportStructWithFilterProjection(t *testing.T) {
- assert := assert.New(t)
- data := sliceType{A: "foo", B: []scalars{{"f1", "b1"}, {"correct", "b2"}}}
- result, err := Search("B[? `true` ].Foo", data)
- assert.Nil(err)
- assert.Equal([]interface{}{"f1", "correct"}, result)
-}
-
-func TestCanSupportStructWithSlice(t *testing.T) {
- assert := assert.New(t)
- data := sliceType{A: "foo", B: []scalars{{"f1", "b1"}, {"correct", "b2"}}}
- result, err := Search("B[-1].Foo", data)
- assert.Nil(err)
- assert.Equal("correct", result)
-}
-
-func TestCanSupportStructWithOrExpressions(t *testing.T) {
- assert := assert.New(t)
- data := sliceType{A: "foo", C: nil}
- result, err := Search("C || A", data)
- assert.Nil(err)
- assert.Equal("foo", result)
-}
-
-func TestCanSupportStructWithSlicePointer(t *testing.T) {
- assert := assert.New(t)
- data := sliceType{A: "foo", C: []*scalars{{"f1", "b1"}, {"correct", "b2"}}}
- result, err := Search("C[-1].Foo", data)
- assert.Nil(err)
- assert.Equal("correct", result)
-}
-
-func TestWillAutomaticallyCapitalizeFieldNames(t *testing.T) {
- assert := assert.New(t)
- s := scalars{Foo: "one", Bar: "bar"}
- // Note that there's a lower cased "foo" instead of "Foo",
- // but it should still correspond to the Foo field in the
- // scalars struct
- result, err := Search("foo", &s)
- assert.Nil(err)
- assert.Equal("one", result)
-}
-
-func TestCanSupportStructWithSliceLowerCased(t *testing.T) {
- assert := assert.New(t)
- data := sliceType{A: "foo", B: []scalars{{"f1", "b1"}, {"correct", "b2"}}}
- result, err := Search("b[-1].foo", data)
- assert.Nil(err)
- assert.Equal("correct", result)
-}
-
-func TestCanSupportStructWithNestedPointers(t *testing.T) {
- assert := assert.New(t)
- data := struct{ A *struct{ B int } }{}
- result, err := Search("A.B", data)
- assert.Nil(err)
- assert.Nil(result)
-}
-
-func TestCanSupportFlattenNestedSlice(t *testing.T) {
- assert := assert.New(t)
- data := nestedSlice{A: []sliceType{
- {B: []scalars{{Foo: "f1a"}, {Foo: "f1b"}}},
- {B: []scalars{{Foo: "f2a"}, {Foo: "f2b"}}},
- }}
- result, err := Search("A[].B[].Foo", data)
- assert.Nil(err)
- assert.Equal([]interface{}{"f1a", "f1b", "f2a", "f2b"}, result)
-}
-
-func TestCanSupportFlattenNestedEmptySlice(t *testing.T) {
- assert := assert.New(t)
- data := nestedSlice{A: []sliceType{
- {}, {B: []scalars{{Foo: "a"}}},
- }}
- result, err := Search("A[].B[].Foo", data)
- assert.Nil(err)
- assert.Equal([]interface{}{"a"}, result)
-}
-
-func TestCanSupportProjectionsWithStructs(t *testing.T) {
- assert := assert.New(t)
- data := nestedSlice{A: []sliceType{
- {A: "first"}, {A: "second"}, {A: "third"},
- }}
- result, err := Search("A[*].A", data)
- assert.Nil(err)
- assert.Equal([]interface{}{"first", "second", "third"}, result)
-}
-
-func TestCanSupportSliceOfStructsWithFunctions(t *testing.T) {
- assert := assert.New(t)
- data := []scalars{scalars{"a1", "b1"}, scalars{"a2", "b2"}}
- result, err := Search("length(@)", data)
- assert.Nil(err)
- assert.Equal(result.(float64), 2.0)
-}
-
-func BenchmarkInterpretSingleFieldStruct(b *testing.B) {
- intr := newInterpreter()
- parser := NewParser()
- ast, _ := parser.Parse("fooasdfasdfasdfasdf")
- data := benchmarkStruct{"foobarbazqux"}
- for i := 0; i < b.N; i++ {
- intr.Execute(ast, &data)
- }
-}
-
-func BenchmarkInterpretNestedStruct(b *testing.B) {
- intr := newInterpreter()
- parser := NewParser()
- ast, _ := parser.Parse("fooasdfasdfasdfasdf.fooasdfasdfasdfasdf.fooasdfasdfasdfasdf.fooasdfasdfasdfasdf")
- data := benchmarkNested{
- nestedA{
- nestedB{
- nestedC{"foobarbazqux"},
- },
- },
- }
- for i := 0; i < b.N; i++ {
- intr.Execute(ast, &data)
- }
-}
-
-func BenchmarkInterpretNestedMaps(b *testing.B) {
- jsonData := []byte(`{"fooasdfasdfasdfasdf": {"fooasdfasdfasdfasdf": {"fooasdfasdfasdfasdf": {"fooasdfasdfasdfasdf": "foobarbazqux"}}}}`)
- var data interface{}
- json.Unmarshal(jsonData, &data)
-
- intr := newInterpreter()
- parser := NewParser()
- ast, _ := parser.Parse("fooasdfasdfasdfasdf.fooasdfasdfasdfasdf.fooasdfasdfasdfasdf.fooasdfasdfasdfasdf")
- for i := 0; i < b.N; i++ {
- intr.Execute(ast, data)
- }
-}
diff --git a/vendor/github.com/jmespath/go-jmespath/lexer_test.go b/vendor/github.com/jmespath/go-jmespath/lexer_test.go
deleted file mode 100644
index d13a042da..000000000
--- a/vendor/github.com/jmespath/go-jmespath/lexer_test.go
+++ /dev/null
@@ -1,161 +0,0 @@
-package jmespath
-
-import (
- "fmt"
- "testing"
-
- "github.com/stretchr/testify/assert"
-)
-
-var lexingTests = []struct {
- expression string
- expected []token
-}{
- {"*", []token{{tStar, "*", 0, 1}}},
- {".", []token{{tDot, ".", 0, 1}}},
- {"[?", []token{{tFilter, "[?", 0, 2}}},
- {"[]", []token{{tFlatten, "[]", 0, 2}}},
- {"(", []token{{tLparen, "(", 0, 1}}},
- {")", []token{{tRparen, ")", 0, 1}}},
- {"[", []token{{tLbracket, "[", 0, 1}}},
- {"]", []token{{tRbracket, "]", 0, 1}}},
- {"{", []token{{tLbrace, "{", 0, 1}}},
- {"}", []token{{tRbrace, "}", 0, 1}}},
- {"||", []token{{tOr, "||", 0, 2}}},
- {"|", []token{{tPipe, "|", 0, 1}}},
- {"29", []token{{tNumber, "29", 0, 2}}},
- {"2", []token{{tNumber, "2", 0, 1}}},
- {"0", []token{{tNumber, "0", 0, 1}}},
- {"-20", []token{{tNumber, "-20", 0, 3}}},
- {"foo", []token{{tUnquotedIdentifier, "foo", 0, 3}}},
- {`"bar"`, []token{{tQuotedIdentifier, "bar", 0, 3}}},
- // Escaping the delimiter
- {`"bar\"baz"`, []token{{tQuotedIdentifier, `bar"baz`, 0, 7}}},
- {",", []token{{tComma, ",", 0, 1}}},
- {":", []token{{tColon, ":", 0, 1}}},
- {"<", []token{{tLT, "<", 0, 1}}},
- {"<=", []token{{tLTE, "<=", 0, 2}}},
- {">", []token{{tGT, ">", 0, 1}}},
- {">=", []token{{tGTE, ">=", 0, 2}}},
- {"==", []token{{tEQ, "==", 0, 2}}},
- {"!=", []token{{tNE, "!=", 0, 2}}},
- {"`[0, 1, 2]`", []token{{tJSONLiteral, "[0, 1, 2]", 1, 9}}},
- {"'foo'", []token{{tStringLiteral, "foo", 1, 3}}},
- {"'a'", []token{{tStringLiteral, "a", 1, 1}}},
- {`'foo\'bar'`, []token{{tStringLiteral, "foo'bar", 1, 7}}},
- {"@", []token{{tCurrent, "@", 0, 1}}},
- {"&", []token{{tExpref, "&", 0, 1}}},
- // Quoted identifier unicode escape sequences
- {`"\u2713"`, []token{{tQuotedIdentifier, "✓", 0, 3}}},
- {`"\\"`, []token{{tQuotedIdentifier, `\`, 0, 1}}},
- {"`\"foo\"`", []token{{tJSONLiteral, "\"foo\"", 1, 5}}},
- // Combinations of tokens.
- {"foo.bar", []token{
- {tUnquotedIdentifier, "foo", 0, 3},
- {tDot, ".", 3, 1},
- {tUnquotedIdentifier, "bar", 4, 3},
- }},
- {"foo[0]", []token{
- {tUnquotedIdentifier, "foo", 0, 3},
- {tLbracket, "[", 3, 1},
- {tNumber, "0", 4, 1},
- {tRbracket, "]", 5, 1},
- }},
- {"foo[?a<b]", []token{
- {tUnquotedIdentifier, "foo", 0, 3},
- {tFilter, "[?", 3, 2},
- {tUnquotedIdentifier, "a", 5, 1},
- {tLT, "<", 6, 1},
- {tUnquotedIdentifier, "b", 7, 1},
- {tRbracket, "]", 8, 1},
- }},
-}
-
-func TestCanLexTokens(t *testing.T) {
- assert := assert.New(t)
- lexer := NewLexer()
- for _, tt := range lexingTests {
- tokens, err := lexer.tokenize(tt.expression)
- if assert.Nil(err) {
- errMsg := fmt.Sprintf("Mismatch expected number of tokens: (expected: %s, actual: %s)",
- tt.expected, tokens)
- tt.expected = append(tt.expected, token{tEOF, "", len(tt.expression), 0})
- if assert.Equal(len(tt.expected), len(tokens), errMsg) {
- for i, token := range tokens {
- expected := tt.expected[i]
- assert.Equal(expected, token, "Token not equal")
- }
- }
- }
- }
-}
-
-var lexingErrorTests = []struct {
- expression string
- msg string
-}{
- {"'foo", "Missing closing single quote"},
- {"[?foo==bar?]", "Unknown char '?'"},
-}
-
-func TestLexingErrors(t *testing.T) {
- assert := assert.New(t)
- lexer := NewLexer()
- for _, tt := range lexingErrorTests {
- _, err := lexer.tokenize(tt.expression)
- assert.NotNil(err, fmt.Sprintf("Expected lexing error: %s", tt.msg))
- }
-}
-
-var exprIdentifier = "abcdefghijklmnopqrstuvwxyz"
-var exprSubexpr = "abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz"
-var deeplyNested50 = "j49.j48.j47.j46.j45.j44.j43.j42.j41.j40.j39.j38.j37.j36.j35.j34.j33.j32.j31.j30.j29.j28.j27.j26.j25.j24.j23.j22.j21.j20.j19.j18.j17.j16.j15.j14.j13.j12.j11.j10.j9.j8.j7.j6.j5.j4.j3.j2.j1.j0"
-var deeplyNested50Pipe = "j49|j48|j47|j46|j45|j44|j43|j42|j41|j40|j39|j38|j37|j36|j35|j34|j33|j32|j31|j30|j29|j28|j27|j26|j25|j24|j23|j22|j21|j20|j19|j18|j17|j16|j15|j14|j13|j12|j11|j10|j9|j8|j7|j6|j5|j4|j3|j2|j1|j0"
-var deeplyNested50Index = "[49][48][47][46][45][44][43][42][41][40][39][38][37][36][35][34][33][32][31][30][29][28][27][26][25][24][23][22][21][20][19][18][17][16][15][14][13][12][11][10][9][8][7][6][5][4][3][2][1][0]"
-var deepProjection104 = "a[*].b[*].c[*].d[*].e[*].f[*].g[*].h[*].i[*].j[*].k[*].l[*].m[*].n[*].o[*].p[*].q[*].r[*].s[*].t[*].u[*].v[*].w[*].x[*].y[*].z[*].a[*].b[*].c[*].d[*].e[*].f[*].g[*].h[*].i[*].j[*].k[*].l[*].m[*].n[*].o[*].p[*].q[*].r[*].s[*].t[*].u[*].v[*].w[*].x[*].y[*].z[*].a[*].b[*].c[*].d[*].e[*].f[*].g[*].h[*].i[*].j[*].k[*].l[*].m[*].n[*].o[*].p[*].q[*].r[*].s[*].t[*].u[*].v[*].w[*].x[*].y[*].z[*].a[*].b[*].c[*].d[*].e[*].f[*].g[*].h[*].i[*].j[*].k[*].l[*].m[*].n[*].o[*].p[*].q[*].r[*].s[*].t[*].u[*].v[*].w[*].x[*].y[*].z[*]"
-var exprQuotedIdentifier = `"abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz"`
-var quotedIdentifierEscapes = `"\n\r\b\t\n\r\b\t\n\r\b\t\n\r\b\t\n\r\b\t\n\r\b\t\n\r\b\t"`
-var rawStringLiteral = `'abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz'`
-
-func BenchmarkLexIdentifier(b *testing.B) {
- runLexBenchmark(b, exprIdentifier)
-}
-
-func BenchmarkLexSubexpression(b *testing.B) {
- runLexBenchmark(b, exprSubexpr)
-}
-
-func BenchmarkLexDeeplyNested50(b *testing.B) {
- runLexBenchmark(b, deeplyNested50)
-}
-
-func BenchmarkLexDeepNested50Pipe(b *testing.B) {
- runLexBenchmark(b, deeplyNested50Pipe)
-}
-
-func BenchmarkLexDeepNested50Index(b *testing.B) {
- runLexBenchmark(b, deeplyNested50Index)
-}
-
-func BenchmarkLexQuotedIdentifier(b *testing.B) {
- runLexBenchmark(b, exprQuotedIdentifier)
-}
-
-func BenchmarkLexQuotedIdentifierEscapes(b *testing.B) {
- runLexBenchmark(b, quotedIdentifierEscapes)
-}
-
-func BenchmarkLexRawStringLiteral(b *testing.B) {
- runLexBenchmark(b, rawStringLiteral)
-}
-
-func BenchmarkLexDeepProjection104(b *testing.B) {
- runLexBenchmark(b, deepProjection104)
-}
-
-func runLexBenchmark(b *testing.B, expression string) {
- lexer := NewLexer()
- for i := 0; i < b.N; i++ {
- lexer.tokenize(expression)
- }
-}
diff --git a/vendor/github.com/jmespath/go-jmespath/parser_test.go b/vendor/github.com/jmespath/go-jmespath/parser_test.go
deleted file mode 100644
index 997a0f4d7..000000000
--- a/vendor/github.com/jmespath/go-jmespath/parser_test.go
+++ /dev/null
@@ -1,136 +0,0 @@
-package jmespath
-
-import (
- "fmt"
- "testing"
-
- "github.com/stretchr/testify/assert"
-)
-
-var parsingErrorTests = []struct {
- expression string
- msg string
-}{
- {"foo.", "Incopmlete expression"},
- {"[foo", "Incopmlete expression"},
- {"]", "Invalid"},
- {")", "Invalid"},
- {"}", "Invalid"},
- {"foo..bar", "Invalid"},
- {`foo."bar`, "Forwards lexer errors"},
- {`{foo: bar`, "Incomplete expression"},
- {`{foo bar}`, "Invalid"},
- {`[foo bar]`, "Invalid"},
- {`foo@`, "Invalid"},
- {`&&&&&&&&&&&&t(`, "Invalid"},
- {`[*][`, "Invalid"},
-}
-
-func TestParsingErrors(t *testing.T) {
- assert := assert.New(t)
- parser := NewParser()
- for _, tt := range parsingErrorTests {
- _, err := parser.Parse(tt.expression)
- assert.NotNil(err, fmt.Sprintf("Expected parsing error: %s, for expression: %s", tt.msg, tt.expression))
- }
-}
-
-var prettyPrinted = `ASTProjection {
- children: {
- ASTField {
- value: "foo"
- }
- ASTSubexpression {
- children: {
- ASTSubexpression {
- children: {
- ASTField {
- value: "bar"
- }
- ASTField {
- value: "baz"
- }
- }
- ASTField {
- value: "qux"
- }
- }
-}
-`
-
-var prettyPrintedCompNode = `ASTFilterProjection {
- children: {
- ASTField {
- value: "a"
- }
- ASTIdentity {
- }
- ASTComparator {
- value: tLTE
- children: {
- ASTField {
- value: "b"
- }
- ASTField {
- value: "c"
- }
- }
-}
-`
-
-func TestPrettyPrintedAST(t *testing.T) {
- assert := assert.New(t)
- parser := NewParser()
- parsed, _ := parser.Parse("foo[*].bar.baz.qux")
- assert.Equal(parsed.PrettyPrint(0), prettyPrinted)
-}
-
-func TestPrettyPrintedCompNode(t *testing.T) {
- assert := assert.New(t)
- parser := NewParser()
- parsed, _ := parser.Parse("a[?b<=c]")
- assert.Equal(parsed.PrettyPrint(0), prettyPrintedCompNode)
-}
-
-func BenchmarkParseIdentifier(b *testing.B) {
- runParseBenchmark(b, exprIdentifier)
-}
-
-func BenchmarkParseSubexpression(b *testing.B) {
- runParseBenchmark(b, exprSubexpr)
-}
-
-func BenchmarkParseDeeplyNested50(b *testing.B) {
- runParseBenchmark(b, deeplyNested50)
-}
-
-func BenchmarkParseDeepNested50Pipe(b *testing.B) {
- runParseBenchmark(b, deeplyNested50Pipe)
-}
-
-func BenchmarkParseDeepNested50Index(b *testing.B) {
- runParseBenchmark(b, deeplyNested50Index)
-}
-
-func BenchmarkParseQuotedIdentifier(b *testing.B) {
- runParseBenchmark(b, exprQuotedIdentifier)
-}
-
-func BenchmarkParseQuotedIdentifierEscapes(b *testing.B) {
- runParseBenchmark(b, quotedIdentifierEscapes)
-}
-
-func BenchmarkParseRawStringLiteral(b *testing.B) {
- runParseBenchmark(b, rawStringLiteral)
-}
-
-func BenchmarkParseDeepProjection104(b *testing.B) {
- runParseBenchmark(b, deepProjection104)
-}
-
-func runParseBenchmark(b *testing.B, expression string) {
- parser := NewParser()
- for i := 0; i < b.N; i++ {
- parser.Parse(expression)
- }
-}
diff --git a/vendor/github.com/jmespath/go-jmespath/util_test.go b/vendor/github.com/jmespath/go-jmespath/util_test.go
deleted file mode 100644
index 1754b5d3f..000000000
--- a/vendor/github.com/jmespath/go-jmespath/util_test.go
+++ /dev/null
@@ -1,73 +0,0 @@
-package jmespath
-
-import (
- "github.com/stretchr/testify/assert"
- "testing"
-)
-
-func TestSlicePositiveStep(t *testing.T) {
- assert := assert.New(t)
- input := make([]interface{}, 5)
- input[0] = 0
- input[1] = 1
- input[2] = 2
- input[3] = 3
- input[4] = 4
- result, err := slice(input, []sliceParam{{0, true}, {3, true}, {1, true}})
- assert.Nil(err)
- assert.Equal(input[:3], result)
-}
-
-func TestIsFalseJSONTypes(t *testing.T) {
- assert := assert.New(t)
- assert.True(isFalse(false))
- assert.True(isFalse(""))
- var empty []interface{}
- assert.True(isFalse(empty))
- m := make(map[string]interface{})
- assert.True(isFalse(m))
- assert.True(isFalse(nil))
-
-}
-
-func TestIsFalseWithUserDefinedStructs(t *testing.T) {
- assert := assert.New(t)
- type nilStructType struct {
- SliceOfPointers []*string
- }
- nilStruct := nilStructType{SliceOfPointers: nil}
- assert.True(isFalse(nilStruct.SliceOfPointers))
-
- // A user defined struct will never be false though,
- // even if it's fields are the zero type.
- assert.False(isFalse(nilStruct))
-}
-
-func TestIsFalseWithNilInterface(t *testing.T) {
- assert := assert.New(t)
- var a *int = nil
- var nilInterface interface{}
- nilInterface = a
- assert.True(isFalse(nilInterface))
-}
-
-func TestIsFalseWithMapOfUserStructs(t *testing.T) {
- assert := assert.New(t)
- type foo struct {
- Bar string
- Baz string
- }
- m := make(map[int]foo)
- assert.True(isFalse(m))
-}
-
-func TestObjsEqual(t *testing.T) {
- assert := assert.New(t)
- assert.True(objsEqual("foo", "foo"))
- assert.True(objsEqual(20, 20))
- assert.True(objsEqual([]int{1, 2, 3}, []int{1, 2, 3}))
- assert.True(objsEqual(nil, nil))
- assert.True(!objsEqual(nil, "foo"))
- assert.True(objsEqual([]int{}, []int{}))
- assert.True(!objsEqual([]int{}, nil))
-}
diff --git a/vendor/github.com/json-iterator/go/example_test.go b/vendor/github.com/json-iterator/go/example_test.go
deleted file mode 100644
index 7f521a300..000000000
--- a/vendor/github.com/json-iterator/go/example_test.go
+++ /dev/null
@@ -1,121 +0,0 @@
-package jsoniter
-
-import (
- "fmt"
- "os"
- "strings"
-)
-
-func ExampleMarshal() {
- type ColorGroup struct {
- ID int
- Name string
- Colors []string
- }
- group := ColorGroup{
- ID: 1,
- Name: "Reds",
- Colors: []string{"Crimson", "Red", "Ruby", "Maroon"},
- }
- b, err := Marshal(group)
- if err != nil {
- fmt.Println("error:", err)
- }
- os.Stdout.Write(b)
- // Output:
- // {"ID":1,"Name":"Reds","Colors":["Crimson","Red","Ruby","Maroon"]}
-}
-
-func ExampleUnmarshal() {
- var jsonBlob = []byte(`[
- {"Name": "Platypus", "Order": "Monotremata"},
- {"Name": "Quoll", "Order": "Dasyuromorphia"}
- ]`)
- type Animal struct {
- Name string
- Order string
- }
- var animals []Animal
- err := Unmarshal(jsonBlob, &animals)
- if err != nil {
- fmt.Println("error:", err)
- }
- fmt.Printf("%+v", animals)
- // Output:
- // [{Name:Platypus Order:Monotremata} {Name:Quoll Order:Dasyuromorphia}]
-}
-
-func ExampleConfigFastest_Marshal() {
- type ColorGroup struct {
- ID int
- Name string
- Colors []string
- }
- group := ColorGroup{
- ID: 1,
- Name: "Reds",
- Colors: []string{"Crimson", "Red", "Ruby", "Maroon"},
- }
- stream := ConfigFastest.BorrowStream(nil)
- defer ConfigFastest.ReturnStream(stream)
- stream.WriteVal(group)
- if stream.Error != nil {
- fmt.Println("error:", stream.Error)
- }
- os.Stdout.Write(stream.Buffer())
- // Output:
- // {"ID":1,"Name":"Reds","Colors":["Crimson","Red","Ruby","Maroon"]}
-}
-
-func ExampleConfigFastest_Unmarshal() {
- var jsonBlob = []byte(`[
- {"Name": "Platypus", "Order": "Monotremata"},
- {"Name": "Quoll", "Order": "Dasyuromorphia"}
- ]`)
- type Animal struct {
- Name string
- Order string
- }
- var animals []Animal
- iter := ConfigFastest.BorrowIterator(jsonBlob)
- defer ConfigFastest.ReturnIterator(iter)
- iter.ReadVal(&animals)
- if iter.Error != nil {
- fmt.Println("error:", iter.Error)
- }
- fmt.Printf("%+v", animals)
- // Output:
- // [{Name:Platypus Order:Monotremata} {Name:Quoll Order:Dasyuromorphia}]
-}
-
-func ExampleGet() {
- val := []byte(`{"ID":1,"Name":"Reds","Colors":["Crimson","Red","Ruby","Maroon"]}`)
- fmt.Printf(Get(val, "Colors", 0).ToString())
- // Output:
- // Crimson
-}
-
-func ExampleMapKey() {
- hello := MyKey("hello")
- output, _ := Marshal(map[*MyKey]string{&hello: "world"})
- fmt.Println(string(output))
- obj := map[*MyKey]string{}
- Unmarshal(output, &obj)
- for k, v := range obj {
- fmt.Println(*k, v)
- }
- // Output:
- // {"Hello":"world"}
- // Hel world
-}
-
-type MyKey string
-
-func (m *MyKey) MarshalText() ([]byte, error) {
- return []byte(strings.Replace(string(*m), "h", "H", -1)), nil
-}
-
-func (m *MyKey) UnmarshalText(text []byte) error {
- *m = MyKey(text[:3])
- return nil
-}
diff --git a/vendor/github.com/json-iterator/go/iter_skip_sloppy_test.go b/vendor/github.com/json-iterator/go/iter_skip_sloppy_test.go
deleted file mode 100644
index bcb491fe6..000000000
--- a/vendor/github.com/json-iterator/go/iter_skip_sloppy_test.go
+++ /dev/null
@@ -1,162 +0,0 @@
-//+build jsoniter_sloppy
-
-package jsoniter
-
-import (
- "github.com/stretchr/testify/require"
- "io"
- "testing"
-)
-
-func Test_string_end(t *testing.T) {
- end, escaped := ParseString(ConfigDefault, `abc"`).findStringEnd()
- if end != 4 {
- t.Fatal(end)
- }
- if escaped != false {
- t.Fatal(escaped)
- }
- end, escaped = ParseString(ConfigDefault, `abc\\"`).findStringEnd()
- if end != 6 {
- t.Fatal(end)
- }
- if escaped != true {
- t.Fatal(escaped)
- }
- end, escaped = ParseString(ConfigDefault, `abc\\\\"`).findStringEnd()
- if end != 8 {
- t.Fatal(end)
- }
- if escaped != true {
- t.Fatal(escaped)
- }
- end, escaped = ParseString(ConfigDefault, `abc\"`).findStringEnd()
- if end != -1 {
- t.Fatal(end)
- }
- if escaped != false {
- t.Fatal(escaped)
- }
- end, escaped = ParseString(ConfigDefault, `abc\`).findStringEnd()
- if end != -1 {
- t.Fatal(end)
- }
- if escaped != true {
- t.Fatal(escaped)
- }
- end, escaped = ParseString(ConfigDefault, `abc\\`).findStringEnd()
- if end != -1 {
- t.Fatal(end)
- }
- if escaped != false {
- t.Fatal(escaped)
- }
- end, escaped = ParseString(ConfigDefault, `\\`).findStringEnd()
- if end != -1 {
- t.Fatal(end)
- }
- if escaped != false {
- t.Fatal(escaped)
- }
- end, escaped = ParseString(ConfigDefault, `\`).findStringEnd()
- if end != -1 {
- t.Fatal(end)
- }
- if escaped != true {
- t.Fatal(escaped)
- }
-}
-
-type StagedReader struct {
- r1 string
- r2 string
- r3 string
- r int
-}
-
-func (reader *StagedReader) Read(p []byte) (n int, err error) {
- reader.r++
- switch reader.r {
- case 1:
- copy(p, []byte(reader.r1))
- return len(reader.r1), nil
- case 2:
- copy(p, []byte(reader.r2))
- return len(reader.r2), nil
- case 3:
- copy(p, []byte(reader.r3))
- return len(reader.r3), nil
- default:
- return 0, io.EOF
- }
-}
-
-func Test_skip_string(t *testing.T) {
- should := require.New(t)
- iter := ParseString(ConfigDefault, `"abc`)
- iter.skipString()
- should.Equal(1, iter.head)
- iter = ParseString(ConfigDefault, `\""abc`)
- iter.skipString()
- should.Equal(3, iter.head)
- reader := &StagedReader{
- r1: `abc`,
- r2: `"`,
- }
- iter = Parse(ConfigDefault, reader, 4096)
- iter.skipString()
- should.Equal(1, iter.head)
- reader = &StagedReader{
- r1: `abc`,
- r2: `1"`,
- }
- iter = Parse(ConfigDefault, reader, 4096)
- iter.skipString()
- should.Equal(2, iter.head)
- reader = &StagedReader{
- r1: `abc\`,
- r2: `"`,
- }
- iter = Parse(ConfigDefault, reader, 4096)
- iter.skipString()
- should.NotNil(iter.Error)
- reader = &StagedReader{
- r1: `abc\`,
- r2: `""`,
- }
- iter = Parse(ConfigDefault, reader, 4096)
- iter.skipString()
- should.Equal(2, iter.head)
-}
-
-func Test_skip_object(t *testing.T) {
- iter := ParseString(ConfigDefault, `}`)
- iter.skipObject()
- if iter.head != 1 {
- t.Fatal(iter.head)
- }
- iter = ParseString(ConfigDefault, `a}`)
- iter.skipObject()
- if iter.head != 2 {
- t.Fatal(iter.head)
- }
- iter = ParseString(ConfigDefault, `{}}a`)
- iter.skipObject()
- if iter.head != 3 {
- t.Fatal(iter.head)
- }
- reader := &StagedReader{
- r1: `{`,
- r2: `}}a`,
- }
- iter = Parse(ConfigDefault, reader, 4096)
- iter.skipObject()
- if iter.head != 2 {
- t.Fatal(iter.head)
- }
- iter = ParseString(ConfigDefault, `"}"}a`)
- iter.skipObject()
- if iter.head != 4 {
- t.Fatal(iter.head)
- }
-}
diff --git a/vendor/github.com/json-iterator/go/stream_test.go b/vendor/github.com/json-iterator/go/stream_test.go
deleted file mode 100644
index d407c7ab7..000000000
--- a/vendor/github.com/json-iterator/go/stream_test.go
+++ /dev/null
@@ -1,69 +0,0 @@
-package jsoniter
-
-import (
- "github.com/stretchr/testify/require"
- "testing"
-)
-
-func Test_writeByte_should_grow_buffer(t *testing.T) {
- should := require.New(t)
- stream := NewStream(ConfigDefault, nil, 1)
- stream.writeByte('1')
- should.Equal("1", string(stream.Buffer()))
- should.Equal(1, len(stream.buf))
- stream.writeByte('2')
- should.Equal("12", string(stream.Buffer()))
- should.Equal(2, len(stream.buf))
- stream.writeThreeBytes('3', '4', '5')
- should.Equal("12345", string(stream.Buffer()))
-}
-
-func Test_writeBytes_should_grow_buffer(t *testing.T) {
- should := require.New(t)
- stream := NewStream(ConfigDefault, nil, 1)
- stream.Write([]byte{'1', '2'})
- should.Equal("12", string(stream.Buffer()))
- should.Equal(2, len(stream.buf))
- stream.Write([]byte{'3', '4', '5', '6', '7'})
- should.Equal("1234567", string(stream.Buffer()))
- should.Equal(7, len(stream.buf))
-}
-
-func Test_writeIndention_should_grow_buffer(t *testing.T) {
- should := require.New(t)
- stream := NewStream(Config{IndentionStep: 2}.Froze(), nil, 1)
- stream.WriteVal([]int{1, 2, 3})
- should.Equal("[\n 1,\n 2,\n 3\n]", string(stream.Buffer()))
-}
-
-func Test_writeRaw_should_grow_buffer(t *testing.T) {
- should := require.New(t)
- stream := NewStream(ConfigDefault, nil, 1)
- stream.WriteRaw("123")
- should.Nil(stream.Error)
- should.Equal("123", string(stream.Buffer()))
-}
-
-func Test_writeString_should_grow_buffer(t *testing.T) {
- should := require.New(t)
- stream := NewStream(ConfigDefault, nil, 0)
- stream.WriteString("123")
- should.Nil(stream.Error)
- should.Equal(`"123"`, string(stream.Buffer()))
-}
-
-type NopWriter struct {
- bufferSize int
-}
-
-func (w *NopWriter) Write(p []byte) (n int, err error) {
- w.bufferSize = cap(p)
- return len(p), nil
-}
-
-func Test_flush_buffer_should_stop_grow_buffer(t *testing.T) {
- writer := new(NopWriter)
- NewEncoder(writer).Encode(make([]int, 10000000))
- should := require.New(t)
- should.Equal(8, writer.bufferSize)
-}
diff --git a/vendor/github.com/kr/logfmt/bench_test.go b/vendor/github.com/kr/logfmt/bench_test.go
deleted file mode 100644
index 27c61f1a7..000000000
--- a/vendor/github.com/kr/logfmt/bench_test.go
+++ /dev/null
@@ -1,59 +0,0 @@
-package logfmt
-
-import (
- "testing"
- "time"
-)
-
-func BenchmarkScanner(b *testing.B) {
- b.StopTimer()
- data := []byte("measure.test=1 measure.foo=bar measure.time=2h measure=\"foo\"")
- h := new(nopHandler)
- b.SetBytes(int64(len(data)))
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- if err := gotoScanner(data, h); err != nil {
- panic(err)
- }
- }
-}
-
-type nopHandler struct {
- called bool
-}
-
-func (h *nopHandler) HandleLogfmt(key, val []byte) error {
- h.called = true
- return nil
-}
-
-func BenchmarkDecodeCustom(b *testing.B) {
- data := []byte(`a=foo b=10ms c=cat E="123" d foo= emp=`)
-
- h := new(nopHandler)
- for i := 0; i < b.N; i++ {
- if err := Unmarshal(data, h); err != nil {
- panic(err)
- }
- }
- if !h.called {
- panic("handler not called")
- }
-}
-
-func BenchmarkDecodeDefault(b *testing.B) {
- data := []byte(`a=foo b=10ms c=cat E="123" d foo= emp=`)
- var g struct {
- A string
- B time.Duration
- C *string
- E string
- D bool
- }
-
- for i := 0; i < b.N; i++ {
- if err := Unmarshal(data, &g); err != nil {
- panic(err)
- }
- }
-}
diff --git a/vendor/github.com/kr/logfmt/decode_test.go b/vendor/github.com/kr/logfmt/decode_test.go
deleted file mode 100644
index bd120c0aa..000000000
--- a/vendor/github.com/kr/logfmt/decode_test.go
+++ /dev/null
@@ -1,110 +0,0 @@
-package logfmt
-
-import (
- "reflect"
- "testing"
- "time"
-)
-
-type pair struct {
- k, v string
-}
-
-type coll struct {
- a []pair
-}
-
-func (c *coll) HandleLogfmt(key, val []byte) error {
- c.a = append(c.a, pair{string(key), string(val)})
- return nil
-}
-
-func TestDecodeCustom(t *testing.T) {
- data := []byte(`a=foo b=10ms c=cat E="123" d foo= emp=`)
-
- g := new(coll)
- if err := Unmarshal(data, g); err != nil {
- t.Fatal(err)
- }
-
- w := []pair{
- {"a", "foo"},
- {"b", "10ms"},
- {"c", "cat"},
- {"E", "123"},
- {"d", ""},
- {"foo", ""},
- {"emp", ""},
- }
-
- if !reflect.DeepEqual(w, g.a) {
- t.Errorf("\nwant %v\n got %v", w, g)
- }
-}
-
-func TestDecodeDefault(t *testing.T) {
- var g struct {
- Float float64
- NFloat *float64
- String string
- Int int
- D time.Duration
- NB *[]byte
- Here bool
- This int `logfmt:"that"`
- }
-
- em, err := NewStructHandler(&g)
- if err != nil {
- t.Fatal(err)
- }
-
- var tests = []struct {
- name string
- val string
- want interface{}
- }{
- {"float", "3.14", 3.14},
- {"nfloat", "123", float64(123)},
- {"string", "foobar", "foobar"},
- {"inT", "10", 10},
- {"d", "1h", 1 * time.Hour},
- {"nb", "bytes!", []byte("bytes!")},
- {"here", "", true},
- {"that", "5", 5},
- }
-
- rv := reflect.Indirect(reflect.ValueOf(&g))
- for i, test := range tests {
- err = em.HandleLogfmt([]byte(test.name), []byte(test.val))
- if err != nil {
- t.Error(err)
- continue
- }
-
- fv := reflect.Indirect(rv.Field(i))
- if !fv.IsValid() {
- ft := rv.Type().Field(i)
- t.Errorf("%s is invalid", ft.Name)
- continue
- }
-
- gv := fv.Interface()
- if !reflect.DeepEqual(gv, test.want) {
- t.Errorf("want %T %#v, got %T %#v", test.want, test.want, gv, gv)
- }
- }
-
- if g.Float != 3.14 {
- t.Errorf("want %v, got %v", 3.14, g.Float)
- }
-
- err = em.HandleLogfmt([]byte("nfloat"), []byte("123"))
- if err != nil {
- t.Fatal(err)
- }
-
- if g.NFloat == nil || *g.NFloat != 123 {
- t.Errorf("want %v, got %v", 123, *g.NFloat)
- }
-}
diff --git a/vendor/github.com/kr/logfmt/example_test.go b/vendor/github.com/kr/logfmt/example_test.go
deleted file mode 100644
index d608d3e0d..000000000
--- a/vendor/github.com/kr/logfmt/example_test.go
+++ /dev/null
@@ -1,59 +0,0 @@
-package logfmt_test
-
-import (
- "bytes"
- "fmt"
- "github.com/kr/logfmt"
- "log"
- "strconv"
-)
-
-type Measurement struct {
- Key string
- Val float64
- Unit string // (e.g. ms, MB, etc)
-}
-
-type Measurements []*Measurement
-
-var measurePrefix = []byte("measure.")
-
-func (mm *Measurements) HandleLogfmt(key, val []byte) error {
- if !bytes.HasPrefix(key, measurePrefix) {
- return nil
- }
- i := bytes.LastIndexFunc(val, isDigit)
- v, err := strconv.ParseFloat(string(val[:i+1]), 10)
- if err != nil {
- return err
- }
- m := &Measurement{
- Key: string(key[len(measurePrefix):]),
- Val: v,
- Unit: string(val[i+1:]),
- }
- *mm = append(*mm, m)
- return nil
-}
-
-// return true if r is an ASCII digit only, as opposed to unicode.IsDigit.
-func isDigit(r rune) bool {
- return '0' <= r && r <= '9'
-}
-
-func Example_customHandler() {
- var data = []byte("measure.a=1ms measure.b=10 measure.c=100MB measure.d=1s garbage")
-
- mm := make(Measurements, 0)
- if err := logfmt.Unmarshal(data, &mm); err != nil {
- log.Fatalf("err=%q", err)
- }
- for _, m := range mm {
- fmt.Printf("%v\n", *m)
- }
- // Output:
- // {a 1 ms}
- // {b 10 }
- // {c 100 MB}
- // {d 1 s}
-}
diff --git a/vendor/github.com/kr/logfmt/scanner_test.go b/vendor/github.com/kr/logfmt/scanner_test.go
deleted file mode 100644
index ac9b2f05a..000000000
--- a/vendor/github.com/kr/logfmt/scanner_test.go
+++ /dev/null
@@ -1,67 +0,0 @@
-package logfmt
-
-import (
- "reflect"
- "testing"
-)
-
-func TestScannerSimple(t *testing.T) {
- type T struct {
- k string
- v string
- }
-
- tests := []struct {
- data string
- want []T
- }{
- {
- `a=1 b="bar" ƒ=2h3s r="esc\t" d x=sf `,
- []T{
- {"a", "1"},
- {"b", "bar"},
- {"ƒ", "2h3s"},
- {"r", "esc\t"},
- {"d", ""},
- {"x", "sf"},
- },
- },
- {`x= `, []T{{"x", ""}}},
- {`y=`, []T{{"y", ""}}},
- {`y`, []T{{"y", ""}}},
- {`y=f`, []T{{"y", "f"}}},
- }
-
- for _, test := range tests {
- var got []T
- h := func(key, val []byte) error {
- got = append(got, T{string(key), string(val)})
- return nil
- }
- gotoScanner([]byte(test.data), HandlerFunc(h))
- if !reflect.DeepEqual(test.want, got) {
- t.Errorf("want %q, got %q", test.want, got)
- }
- }
-
- var called bool
- h := func(key, val []byte) error { called = true; return nil }
- err := gotoScanner([]byte(`foo="b`), HandlerFunc(h))
- if err != ErrUnterminatedString {
- t.Errorf("want %v, got %v", ErrUnterminatedString, err)
- }
- if called {
- t.Error("did not expect call to handler")
- }
-}
-
-func TestScannerAllocs(t *testing.T) {
- data := []byte(`a=1 b="bar" ƒ=2h3s r="esc\t" d x=sf `)
- h := func(key, val []byte) error { return nil }
- allocs := testing.AllocsPerRun(1000, func() {
- gotoScanner(data, HandlerFunc(h))
- })
- if allocs > 1 {
- t.Errorf("got %f, want <=1", allocs)
- }
-}
diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/all_test.go b/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/all_test.go
deleted file mode 100644
index a793c8856..000000000
--- a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/all_test.go
+++ /dev/null
@@ -1,178 +0,0 @@
-// Copyright 2013 Matt T. Proud
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package pbutil
-
-import (
- "bytes"
- "testing"
-
- "github.com/golang/protobuf/proto"
-
- . "github.com/matttproud/golang_protobuf_extensions/testdata"
-)
-
-func TestWriteDelimited(t *testing.T) {
- t.Parallel()
- for _, test := range []struct {
- msg proto.Message
- buf []byte
- n int
- err error
- }{
- {
- msg: &Empty{},
- n: 1,
- buf: []byte{0},
- },
- {
- msg: &GoEnum{Foo: FOO_FOO1.Enum()},
- n: 3,
- buf: []byte{2, 8, 1},
- },
- {
- msg: &Strings{
- StringField: proto.String(`This is my gigantic, unhappy string. It exceeds
-the encoding size of a single byte varint. We are using it to fuzz test the
-correctness of the header decoding mechanisms, which may prove problematic.
-I expect it may. Let's hope you enjoy testing as much as we do.`),
- },
- n: 271,
- buf: []byte{141, 2, 10, 138, 2, 84, 104, 105, 115, 32, 105, 115, 32, 109,
- 121, 32, 103, 105, 103, 97, 110, 116, 105, 99, 44, 32, 117, 110, 104,
- 97, 112, 112, 121, 32, 115, 116, 114, 105, 110, 103, 46, 32, 32, 73,
- 116, 32, 101, 120, 99, 101, 101, 100, 115, 10, 116, 104, 101, 32, 101,
- 110, 99, 111, 100, 105, 110, 103, 32, 115, 105, 122, 101, 32, 111, 102,
- 32, 97, 32, 115, 105, 110, 103, 108, 101, 32, 98, 121, 116, 101, 32,
- 118, 97, 114, 105, 110, 116, 46, 32, 32, 87, 101, 32, 97, 114, 101, 32,
- 117, 115, 105, 110, 103, 32, 105, 116, 32, 116, 111, 32, 102, 117, 122,
- 122, 32, 116, 101, 115, 116, 32, 116, 104, 101, 10, 99, 111, 114, 114,
- 101, 99, 116, 110, 101, 115, 115, 32, 111, 102, 32, 116, 104, 101, 32,
- 104, 101, 97, 100, 101, 114, 32, 100, 101, 99, 111, 100, 105, 110, 103,
- 32, 109, 101, 99, 104, 97, 110, 105, 115, 109, 115, 44, 32, 119, 104,
- 105, 99, 104, 32, 109, 97, 121, 32, 112, 114, 111, 118, 101, 32, 112,
- 114, 111, 98, 108, 101, 109, 97, 116, 105, 99, 46, 10, 73, 32, 101, 120,
- 112, 101, 99, 116, 32, 105, 116, 32, 109, 97, 121, 46, 32, 32, 76, 101,
- 116, 39, 115, 32, 104, 111, 112, 101, 32, 121, 111, 117, 32, 101, 110,
- 106, 111, 121, 32, 116, 101, 115, 116, 105, 110, 103, 32, 97, 115, 32,
- 109, 117, 99, 104, 32, 97, 115, 32, 119, 101, 32, 100, 111, 46},
- },
- } {
- var buf bytes.Buffer
- if n, err := WriteDelimited(&buf, test.msg); n != test.n || err != test.err {
- t.Fatalf("WriteDelimited(buf, %#v) = %v, %v; want %v, %v", test.msg, n, err, test.n, test.err)
- }
- if out := buf.Bytes(); !bytes.Equal(out, test.buf) {
- t.Fatalf("WriteDelimited(buf, %#v); buf = %v; want %v", test.msg, out, test.buf)
- }
- }
-}
-
-func TestReadDelimited(t *testing.T) {
- t.Parallel()
- for _, test := range []struct {
- buf []byte
- msg proto.Message
- n int
- err error
- }{
- {
- buf: []byte{0},
- msg: &Empty{},
- n: 1,
- },
- {
- n: 3,
- buf: []byte{2, 8, 1},
- msg: &GoEnum{Foo: FOO_FOO1.Enum()},
- },
- {
- buf: []byte{141, 2, 10, 138, 2, 84, 104, 105, 115, 32, 105, 115, 32, 109,
- 121, 32, 103, 105, 103, 97, 110, 116, 105, 99, 44, 32, 117, 110, 104,
- 97, 112, 112, 121, 32, 115, 116, 114, 105, 110, 103, 46, 32, 32, 73,
- 116, 32, 101, 120, 99, 101, 101, 100, 115, 10, 116, 104, 101, 32, 101,
- 110, 99, 111, 100, 105, 110, 103, 32, 115, 105, 122, 101, 32, 111, 102,
- 32, 97, 32, 115, 105, 110, 103, 108, 101, 32, 98, 121, 116, 101, 32,
- 118, 97, 114, 105, 110, 116, 46, 32, 32, 87, 101, 32, 97, 114, 101, 32,
- 117, 115, 105, 110, 103, 32, 105, 116, 32, 116, 111, 32, 102, 117, 122,
- 122, 32, 116, 101, 115, 116, 32, 116, 104, 101, 10, 99, 111, 114, 114,
- 101, 99, 116, 110, 101, 115, 115, 32, 111, 102, 32, 116, 104, 101, 32,
- 104, 101, 97, 100, 101, 114, 32, 100, 101, 99, 111, 100, 105, 110, 103,
- 32, 109, 101, 99, 104, 97, 110, 105, 115, 109, 115, 44, 32, 119, 104,
- 105, 99, 104, 32, 109, 97, 121, 32, 112, 114, 111, 118, 101, 32, 112,
- 114, 111, 98, 108, 101, 109, 97, 116, 105, 99, 46, 10, 73, 32, 101, 120,
- 112, 101, 99, 116, 32, 105, 116, 32, 109, 97, 121, 46, 32, 32, 76, 101,
- 116, 39, 115, 32, 104, 111, 112, 101, 32, 121, 111, 117, 32, 101, 110,
- 106, 111, 121, 32, 116, 101, 115, 116, 105, 110, 103, 32, 97, 115, 32,
- 109, 117, 99, 104, 32, 97, 115, 32, 119, 101, 32, 100, 111, 46},
- msg: &Strings{
- StringField: proto.String(`This is my gigantic, unhappy string. It exceeds
-the encoding size of a single byte varint. We are using it to fuzz test the
-correctness of the header decoding mechanisms, which may prove problematic.
-I expect it may. Let's hope you enjoy testing as much as we do.`),
- },
- n: 271,
- },
- } {
- msg := proto.Clone(test.msg)
- msg.Reset()
- if n, err := ReadDelimited(bytes.NewBuffer(test.buf), msg); n != test.n || err != test.err {
- t.Fatalf("ReadDelimited(%v, msg) = %v, %v; want %v, %v", test.buf, n, err, test.n, test.err)
- }
- if !proto.Equal(msg, test.msg) {
- t.Fatalf("ReadDelimited(%v, msg); msg = %v; want %v", test.buf, msg, test.msg)
- }
- }
-}
-
-func TestEndToEndValid(t *testing.T) {
- t.Parallel()
- for _, test := range [][]proto.Message{
- {&Empty{}},
- {&GoEnum{Foo: FOO_FOO1.Enum()}, &Empty{}, &GoEnum{Foo: FOO_FOO1.Enum()}},
- {&GoEnum{Foo: FOO_FOO1.Enum()}},
- {&Strings{
- StringField: proto.String(`This is my gigantic, unhappy string. It exceeds
-the encoding size of a single byte varint. We are using it to fuzz test the
-correctness of the header decoding mechanisms, which may prove problematic.
-I expect it may. Let's hope you enjoy testing as much as we do.`),
- }},
- } {
- var buf bytes.Buffer
- var written int
- for i, msg := range test {
- n, err := WriteDelimited(&buf, msg)
- if err != nil {
- // Assumption: TestReadDelimited and TestWriteDelimited are sufficient
- // and inputs for this test are explicitly exercised there.
- t.Fatalf("WriteDelimited(buf, %v[%d]) = ?, %v; wanted ?, nil", test, i, err)
- }
- written += n
- }
- var read int
- for i, msg := range test {
- out := proto.Clone(msg)
- out.Reset()
- n, _ := ReadDelimited(&buf, out)
- // Decide to do EOF checking?
- read += n
- if !proto.Equal(out, msg) {
- t.Fatalf("out = %v; want %v[%d] = %#v", out, test, i, msg)
- }
- }
- if read != written {
- t.Fatalf("%v read = %d; want %d", test, read, written)
- }
- }
-}
diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode_test.go b/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode_test.go
deleted file mode 100644
index 364a7b799..000000000
--- a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode_test.go
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright 2016 Matt T. Proud
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package pbutil
-
-import (
- "bytes"
- "io"
- "testing"
- "testing/iotest"
-)
-
-func TestReadDelimitedIllegalVarint(t *testing.T) {
- t.Parallel()
- var tests = []struct {
- in []byte
- n int
- err error
- }{
- {
- in: []byte{255, 255, 255, 255, 255},
- n: 5,
- err: errInvalidVarint,
- },
- {
- in: []byte{255, 255, 255, 255, 255, 255},
- n: 5,
- err: errInvalidVarint,
- },
- }
- for _, test := range tests {
- n, err := ReadDelimited(bytes.NewReader(test.in), nil)
- if got, want := n, test.n; got != want {
- t.Errorf("ReadDelimited(%#v, nil) = %#v, ?; want = %v#, ?", test.in, got, want)
- }
- if got, want := err, test.err; got != want {
- t.Errorf("ReadDelimited(%#v, nil) = ?, %#v; want = ?, %#v", test.in, got, want)
- }
- }
-}
-
-func TestReadDelimitedPrematureHeader(t *testing.T) {
- t.Parallel()
- var data = []byte{128, 5} // 256 + 256 + 128
- n, err := ReadDelimited(bytes.NewReader(data[0:1]), nil)
- if got, want := n, 1; got != want {
- t.Errorf("ReadDelimited(%#v, nil) = %#v, ?; want = %v#, ?", data[0:1], got, want)
- }
- if got, want := err, io.EOF; got != want {
- t.Errorf("ReadDelimited(%#v, nil) = ?, %#v; want = ?, %#v", data[0:1], got, want)
- }
-}
-
-func TestReadDelimitedPrematureBody(t *testing.T) {
- t.Parallel()
- var data = []byte{128, 5, 0, 0, 0} // 256 + 256 + 128
- n, err := ReadDelimited(bytes.NewReader(data[:]), nil)
- if got, want := n, 5; got != want {
- t.Errorf("ReadDelimited(%#v, nil) = %#v, ?; want = %v#, ?", data, got, want)
- }
- if got, want := err, io.ErrUnexpectedEOF; got != want {
- t.Errorf("ReadDelimited(%#v, nil) = ?, %#v; want = ?, %#v", data, got, want)
- }
-}
-
-func TestReadDelimitedPrematureHeaderIncremental(t *testing.T) {
- t.Parallel()
- var data = []byte{128, 5} // 256 + 256 + 128
- n, err := ReadDelimited(iotest.OneByteReader(bytes.NewReader(data[0:1])), nil)
- if got, want := n, 1; got != want {
- t.Errorf("ReadDelimited(%#v, nil) = %#v, ?; want = %v#, ?", data[0:1], got, want)
- }
- if got, want := err, io.EOF; got != want {
- t.Errorf("ReadDelimited(%#v, nil) = ?, %#v; want = ?, %#v", data[0:1], got, want)
- }
-}
-
-func TestReadDelimitedPrematureBodyIncremental(t *testing.T) {
- t.Parallel()
- var data = []byte{128, 5, 0, 0, 0} // 256 + 256 + 128
- n, err := ReadDelimited(iotest.OneByteReader(bytes.NewReader(data[:])), nil)
- if got, want := n, 5; got != want {
- t.Errorf("ReadDelimited(%#v, nil) = %#v, ?; want = %v#, ?", data, got, want)
- }
- if got, want := err, io.ErrUnexpectedEOF; got != want {
- t.Errorf("ReadDelimited(%#v, nil) = ?, %#v; want = ?, %#v", data, got, want)
- }
-}
diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode_test.go b/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode_test.go
deleted file mode 100644
index f92632b0b..000000000
--- a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode_test.go
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2016 Matt T. Proud
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package pbutil
-
-import (
- "bytes"
- "errors"
- "testing"
-
- "github.com/golang/protobuf/proto"
-)
-
-var errMarshal = errors.New("pbutil: can't marshal")
-
-type cantMarshal struct{ proto.Message }
-
-func (cantMarshal) Marshal() ([]byte, error) { return nil, errMarshal }
-
-var _ proto.Message = cantMarshal{}
-
-func TestWriteDelimitedMarshalErr(t *testing.T) {
- t.Parallel()
- var data cantMarshal
- var buf bytes.Buffer
- n, err := WriteDelimited(&buf, data)
- if got, want := n, 0; got != want {
- t.Errorf("WriteDelimited(buf, %#v) = %#v, ?; want = %v#, ?", data, got, want)
- }
- if got, want := err, errMarshal; got != want {
- t.Errorf("WriteDelimited(buf, %#v) = ?, %#v; want = ?, %#v", data, got, want)
- }
-}
-
-type canMarshal struct{ proto.Message }
-
-func (canMarshal) Marshal() ([]byte, error) { return []byte{0, 1, 2, 3, 4, 5}, nil }
-
-var errWrite = errors.New("pbutil: can't write")
-
-type cantWrite struct{}
-
-func (cantWrite) Write([]byte) (int, error) { return 0, errWrite }
-
-func TestWriteDelimitedWriteErr(t *testing.T) {
- t.Parallel()
- var data canMarshal
- var buf cantWrite
- n, err := WriteDelimited(buf, data)
- if got, want := n, 0; got != want {
- t.Errorf("WriteDelimited(buf, %#v) = %#v, ?; want = %v#, ?", data, got, want)
- }
- if got, want := err, errWrite; got != want {
- t.Errorf("WriteDelimited(buf, %#v) = ?, %#v; want = ?, %#v", data, got, want)
- }
-}
diff --git a/vendor/github.com/modern-go/concurrent/map_test.go b/vendor/github.com/modern-go/concurrent/map_test.go
deleted file mode 100644
index 16ba3e5f7..000000000
--- a/vendor/github.com/modern-go/concurrent/map_test.go
+++ /dev/null
@@ -1,18 +0,0 @@
-package concurrent_test
-
-import (
- "github.com/modern-go/concurrent"
- "testing"
-)
-
-func TestMap_Load(t *testing.T) {
- m := concurrent.NewMap()
- m.Store("hello", "world")
- value, found := m.Load("hello")
- if !found {
- t.Fail()
- }
- if value != "world" {
- t.Fail()
- }
-}
diff --git a/vendor/github.com/modern-go/concurrent/unbounded_executor_test.go b/vendor/github.com/modern-go/concurrent/unbounded_executor_test.go
deleted file mode 100644
index fe86e84a3..000000000
--- a/vendor/github.com/modern-go/concurrent/unbounded_executor_test.go
+++ /dev/null
@@ -1,54 +0,0 @@
-package concurrent_test
-
-import (
- "context"
- "fmt"
- "time"
- "github.com/modern-go/concurrent"
-)
-
-func ExampleUnboundedExecutor_Go() {
- executor := concurrent.NewUnboundedExecutor()
- executor.Go(func(ctx context.Context) {
- fmt.Println("abc")
- })
- time.Sleep(time.Second)
- // output: abc
-}
-
-func ExampleUnboundedExecutor_StopAndWaitForever() {
- executor := concurrent.NewUnboundedExecutor()
- executor.Go(func(ctx context.Context) {
- everyMillisecond := time.NewTicker(time.Millisecond)
- for {
- select {
- case <-ctx.Done():
- fmt.Println("goroutine exited")
- return
- case <-everyMillisecond.C:
- // do something
- }
- }
- })
- time.Sleep(time.Second)
- executor.StopAndWaitForever()
- fmt.Println("executor stopped")
- // output:
- // goroutine exited
- // executor stopped
-}
-
-func ExampleUnboundedExecutor_Go_panic() {
- concurrent.HandlePanic = func(recovered interface{}, funcName string) {
- fmt.Println(funcName)
- }
- executor := concurrent.NewUnboundedExecutor()
- executor.Go(willPanic)
- time.Sleep(time.Second)
- // output:
- // github.com/modern-go/concurrent_test.willPanic
-}
-
-func willPanic(ctx context.Context) {
- panic("!!!")
-}
diff --git a/vendor/github.com/opentracing/opentracing-go/ext/tags_test.go b/vendor/github.com/opentracing/opentracing-go/ext/tags_test.go
deleted file mode 100644
index ea9af335c..000000000
--- a/vendor/github.com/opentracing/opentracing-go/ext/tags_test.go
+++ /dev/null
@@ -1,148 +0,0 @@
-package ext_test
-
-import (
- "testing"
-
- "github.com/stretchr/testify/assert"
-
- "github.com/opentracing/opentracing-go"
- "github.com/opentracing/opentracing-go/ext"
- "github.com/opentracing/opentracing-go/mocktracer"
-)
-
-func TestPeerTags(t *testing.T) {
- if ext.PeerService != "peer.service" {
- t.Fatalf("Invalid PeerService %v", ext.PeerService)
- }
- tracer := mocktracer.New()
- span := tracer.StartSpan("my-trace")
- ext.PeerService.Set(span, "my-service")
- ext.PeerAddress.Set(span, "my-hostname:8080")
- ext.PeerHostname.Set(span, "my-hostname")
- ext.PeerHostIPv4.Set(span, uint32(127<<24|1))
- ext.PeerHostIPv6.Set(span, "::")
- ext.PeerPort.Set(span, uint16(8080))
- ext.SamplingPriority.Set(span, uint16(1))
- ext.SpanKind.Set(span, ext.SpanKindRPCServerEnum)
- ext.SpanKindRPCClient.Set(span)
- span.Finish()
-
- rawSpan := tracer.FinishedSpans()[0]
- assert.Equal(t, map[string]interface{}{
- "peer.service": "my-service",
- "peer.address": "my-hostname:8080",
- "peer.hostname": "my-hostname",
- "peer.ipv4": uint32(127<<24 | 1),
- "peer.ipv6": "::",
- "peer.port": uint16(8080),
- "span.kind": ext.SpanKindRPCClientEnum,
- }, rawSpan.Tags())
- assert.True(t, span.Context().(mocktracer.MockSpanContext).Sampled)
- ext.SamplingPriority.Set(span, uint16(0))
- assert.False(t, span.Context().(mocktracer.MockSpanContext).Sampled)
-}
-
-func TestHTTPTags(t *testing.T) {
- tracer := mocktracer.New()
- span := tracer.StartSpan("my-trace", ext.SpanKindRPCServer)
- ext.HTTPUrl.Set(span, "test.biz/uri?protocol=false")
- ext.HTTPMethod.Set(span, "GET")
- ext.HTTPStatusCode.Set(span, 301)
- span.Finish()
-
- rawSpan := tracer.FinishedSpans()[0]
- assert.Equal(t, map[string]interface{}{
- "http.url": "test.biz/uri?protocol=false",
- "http.method": "GET",
- "http.status_code": uint16(301),
- "span.kind": ext.SpanKindRPCServerEnum,
- }, rawSpan.Tags())
-}
-
-func TestDBTags(t *testing.T) {
- tracer := mocktracer.New()
- span := tracer.StartSpan("my-trace", ext.SpanKindRPCClient)
- ext.DBInstance.Set(span, "127.0.0.1:3306/customers")
- ext.DBStatement.Set(span, "SELECT * FROM user_table")
- ext.DBType.Set(span, "sql")
- ext.DBUser.Set(span, "customer_user")
- span.Finish()
-
- rawSpan := tracer.FinishedSpans()[0]
- assert.Equal(t, map[string]interface{}{
- "db.instance": "127.0.0.1:3306/customers",
- "db.statement": "SELECT * FROM user_table",
- "db.type": "sql",
- "db.user": "customer_user",
- "span.kind": ext.SpanKindRPCClientEnum,
- }, rawSpan.Tags())
-}
-
-func TestMiscTags(t *testing.T) {
- tracer := mocktracer.New()
- span := tracer.StartSpan("my-trace")
- ext.Component.Set(span, "my-awesome-library")
- ext.SamplingPriority.Set(span, 1)
- ext.Error.Set(span, true)
-
- span.Finish()
-
- rawSpan := tracer.FinishedSpans()[0]
- assert.Equal(t, map[string]interface{}{
- "component": "my-awesome-library",
- "error": true,
- }, rawSpan.Tags())
-}
-
-func TestRPCServerOption(t *testing.T) {
- tracer := mocktracer.New()
- parent := tracer.StartSpan("my-trace")
- parent.SetBaggageItem("bag", "gage")
-
- carrier := opentracing.HTTPHeadersCarrier{}
- err := tracer.Inject(parent.Context(), opentracing.HTTPHeaders, carrier)
- if err != nil {
- t.Fatal(err)
- }
-
- parCtx, err := tracer.Extract(opentracing.HTTPHeaders, carrier)
- if err != nil {
- t.Fatal(err)
- }
-
- tracer.StartSpan("my-child", ext.RPCServerOption(parCtx)).Finish()
-
- rawSpan := tracer.FinishedSpans()[0]
- assert.Equal(t, map[string]interface{}{
- "span.kind": ext.SpanKindRPCServerEnum,
- }, rawSpan.Tags())
- assert.Equal(t, map[string]string{
- "bag": "gage",
- }, rawSpan.Context().(mocktracer.MockSpanContext).Baggage)
-}
-
-func TestMessageBusProducerTags(t *testing.T) {
- tracer := mocktracer.New()
- span := tracer.StartSpan("my-trace", ext.SpanKindProducer)
- ext.MessageBusDestination.Set(span, "topic name")
- span.Finish()
-
- rawSpan := tracer.FinishedSpans()[0]
- assert.Equal(t, map[string]interface{}{
- "message_bus.destination": "topic name",
- "span.kind": ext.SpanKindProducerEnum,
- }, rawSpan.Tags())
-}
-
-func TestMessageBusConsumerTags(t *testing.T) {
- tracer := mocktracer.New()
- span := tracer.StartSpan("my-trace", ext.SpanKindConsumer)
- ext.MessageBusDestination.Set(span, "topic name")
- span.Finish()
-
- rawSpan := tracer.FinishedSpans()[0]
- assert.Equal(t, map[string]interface{}{
- "message_bus.destination": "topic name",
- "span.kind": ext.SpanKindConsumerEnum,
- }, rawSpan.Tags())
-}
diff --git a/vendor/github.com/opentracing/opentracing-go/gocontext_test.go b/vendor/github.com/opentracing/opentracing-go/gocontext_test.go
deleted file mode 100644
index 65c013086..000000000
--- a/vendor/github.com/opentracing/opentracing-go/gocontext_test.go
+++ /dev/null
@@ -1,81 +0,0 @@
-package opentracing
-
-import (
- "testing"
- "time"
-
- "github.com/stretchr/testify/assert"
- "golang.org/x/net/context"
-)
-
-func TestContextWithSpan(t *testing.T) {
- span := &noopSpan{}
- ctx := ContextWithSpan(context.Background(), span)
- span2 := SpanFromContext(ctx)
- if span != span2 {
- t.Errorf("Not the same span returned from context, expected=%+v, actual=%+v", span, span2)
- }
-
- ctx = context.Background()
- span2 = SpanFromContext(ctx)
- if span2 != nil {
- t.Errorf("Expected nil span, found %+v", span2)
- }
-
- ctx = ContextWithSpan(ctx, span)
- span2 = SpanFromContext(ctx)
- if span != span2 {
- t.Errorf("Not the same span returned from context, expected=%+v, actual=%+v", span, span2)
- }
-}
-
-func TestStartSpanFromContext(t *testing.T) {
- testTracer := testTracer{}
-
- // Test the case where there *is* a Span in the Context.
- {
- parentSpan := &testSpan{}
- parentCtx := ContextWithSpan(context.Background(), parentSpan)
- childSpan, childCtx := startSpanFromContextWithTracer(parentCtx, testTracer, "child")
- if !childSpan.Context().(testSpanContext).HasParent {
- t.Errorf("Failed to find parent: %v", childSpan)
- }
- if !childSpan.(testSpan).Equal(SpanFromContext(childCtx)) {
- t.Errorf("Unable to find child span in context: %v", childCtx)
- }
- }
-
- // Test the case where there *is not* a Span in the Context.
- {
- emptyCtx := context.Background()
- childSpan, childCtx := startSpanFromContextWithTracer(emptyCtx, testTracer, "child")
- if childSpan.Context().(testSpanContext).HasParent {
- t.Errorf("Should not have found parent: %v", childSpan)
- }
- if !childSpan.(testSpan).Equal(SpanFromContext(childCtx)) {
- t.Errorf("Unable to find child span in context: %v", childCtx)
- }
- }
-}
-
-func TestStartSpanFromContextOptions(t *testing.T) {
- testTracer := testTracer{}
-
- // Test options are passed to tracer
-
- startTime := time.Now().Add(-10 * time.Second) // ten seconds ago
- span, ctx := startSpanFromContextWithTracer(
- context.Background(), testTracer, "parent", StartTime(startTime), Tag{"component", "test"})
-
- assert.Equal(t, "test", span.(testSpan).Tags["component"])
- assert.Equal(t, startTime, span.(testSpan).StartTime)
-
- // Test it also works for a child span
-
- childStartTime := startTime.Add(3 * time.Second)
- childSpan, _ := startSpanFromContextWithTracer(
- ctx, testTracer, "child", StartTime(childStartTime))
-
- assert.Equal(t, childSpan.(testSpan).Tags["component"], nil)
- assert.Equal(t, childSpan.(testSpan).StartTime, childStartTime)
-}
diff --git a/vendor/github.com/opentracing/opentracing-go/log/field_test.go b/vendor/github.com/opentracing/opentracing-go/log/field_test.go
deleted file mode 100644
index 8304f1820..000000000
--- a/vendor/github.com/opentracing/opentracing-go/log/field_test.go
+++ /dev/null
@@ -1,39 +0,0 @@
-package log
-
-import (
- "fmt"
- "testing"
-)
-
-func TestFieldString(t *testing.T) {
- testCases := []struct {
- field Field
- expected string
- }{
- {
- field: String("key", "value"),
- expected: "key:value",
- },
- {
- field: Bool("key", true),
- expected: "key:true",
- },
- {
- field: Int("key", 5),
- expected: "key:5",
- },
- {
- field: Error(fmt.Errorf("err msg")),
- expected: "error:err msg",
- },
- {
- field: Error(nil),
- expected: "error:<nil>",
- },
- }
- for i, tc := range testCases {
- if str := tc.field.String(); str != tc.expected {
- t.Errorf("%d: expected '%s', got '%s'", i, tc.expected, str)
- }
- }
-}
diff --git a/vendor/github.com/opentracing/opentracing-go/options_test.go b/vendor/github.com/opentracing/opentracing-go/options_test.go
deleted file mode 100644
index 56a543bfe..000000000
--- a/vendor/github.com/opentracing/opentracing-go/options_test.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package opentracing
-
-import (
- "testing"
-
- "github.com/stretchr/testify/require"
-)
-
-func TestChildOfAndFollowsFrom(t *testing.T) {
- tests := []struct {
- newOpt func(SpanContext) SpanReference
- refType SpanReferenceType
- name string
- }{
- {ChildOf, ChildOfRef, "ChildOf"},
- {FollowsFrom, FollowsFromRef, "FollowsFrom"},
- }
-
- for _, test := range tests {
- opts := new(StartSpanOptions)
-
- test.newOpt(nil).Apply(opts)
- require.Nil(t, opts.References, "%s(nil) must not append a reference", test.name)
-
- ctx := new(noopSpanContext)
- test.newOpt(ctx).Apply(opts)
- require.Equal(t, []SpanReference{
- SpanReference{ReferencedContext: ctx, Type: test.refType},
- }, opts.References, "%s(ctx) must append a reference", test.name)
- }
-}
diff --git a/vendor/github.com/opentracing/opentracing-go/propagation_test.go b/vendor/github.com/opentracing/opentracing-go/propagation_test.go
deleted file mode 100644
index e3dad5597..000000000
--- a/vendor/github.com/opentracing/opentracing-go/propagation_test.go
+++ /dev/null
@@ -1,93 +0,0 @@
-package opentracing
-
-import (
- "net/http"
- "strconv"
- "testing"
-)
-
-const testHeaderPrefix = "testprefix-"
-
-func TestTextMapCarrierInject(t *testing.T) {
- m := make(map[string]string)
- m["NotOT"] = "blah"
- m["opname"] = "AlsoNotOT"
- tracer := testTracer{}
- span := tracer.StartSpan("someSpan")
- fakeID := span.Context().(testSpanContext).FakeID
-
- carrier := TextMapCarrier(m)
- if err := span.Tracer().Inject(span.Context(), TextMap, carrier); err != nil {
- t.Fatal(err)
- }
-
- if len(m) != 3 {
- t.Errorf("Unexpected header length: %v", len(m))
- }
- // The prefix comes from just above; the suffix comes from
- // testTracer.Inject().
- if m["testprefix-fakeid"] != strconv.Itoa(fakeID) {
- t.Errorf("Could not find fakeid at expected key")
- }
-}
-
-func TestTextMapCarrierExtract(t *testing.T) {
- m := make(map[string]string)
- m["NotOT"] = "blah"
- m["opname"] = "AlsoNotOT"
- m["testprefix-fakeid"] = "42"
- tracer := testTracer{}
-
- carrier := TextMapCarrier(m)
- extractedContext, err := tracer.Extract(TextMap, carrier)
- if err != nil {
- t.Fatal(err)
- }
-
- if extractedContext.(testSpanContext).FakeID != 42 {
- t.Errorf("Failed to read testprefix-fakeid correctly")
- }
-}
-
-func TestHTTPHeaderInject(t *testing.T) {
- h := http.Header{}
- h.Add("NotOT", "blah")
- h.Add("opname", "AlsoNotOT")
- tracer := testTracer{}
- span := tracer.StartSpan("someSpan")
- fakeID := span.Context().(testSpanContext).FakeID
-
- // Use HTTPHeadersCarrier to wrap around `h`.
- carrier := HTTPHeadersCarrier(h)
- if err := span.Tracer().Inject(span.Context(), HTTPHeaders, carrier); err != nil {
- t.Fatal(err)
- }
-
- if len(h) != 3 {
- t.Errorf("Unexpected header length: %v", len(h))
- }
- // The prefix comes from just above; the suffix comes from
- // testTracer.Inject().
- if h.Get("testprefix-fakeid") != strconv.Itoa(fakeID) {
- t.Errorf("Could not find fakeid at expected key")
- }
-}
-
-func TestHTTPHeaderExtract(t *testing.T) {
- h := http.Header{}
- h.Add("NotOT", "blah")
- h.Add("opname", "AlsoNotOT")
- h.Add("testprefix-fakeid", "42")
- tracer := testTracer{}
-
- // Use HTTPHeadersCarrier to wrap around `h`.
- carrier := HTTPHeadersCarrier(h)
- spanContext, err := tracer.Extract(HTTPHeaders, carrier)
- if err != nil {
- t.Fatal(err)
- }
-
- if spanContext.(testSpanContext).FakeID != 42 {
- t.Errorf("Failed to read testprefix-fakeid correctly")
- }
-}
diff --git a/vendor/github.com/opentracing/opentracing-go/testtracer_test.go b/vendor/github.com/opentracing/opentracing-go/testtracer_test.go
deleted file mode 100644
index dd13788cf..000000000
--- a/vendor/github.com/opentracing/opentracing-go/testtracer_test.go
+++ /dev/null
@@ -1,138 +0,0 @@
-package opentracing
-
-import (
- "strconv"
- "strings"
- "time"
-
- "github.com/opentracing/opentracing-go/log"
-)
-
-const testHTTPHeaderPrefix = "testprefix-"
-
-// testTracer is a most-noop Tracer implementation that makes it possible for
-// unittests to verify whether certain methods were / were not called.
-type testTracer struct{}
-
-var fakeIDSource = 1
-
-func nextFakeID() int {
- fakeIDSource++
- return fakeIDSource
-}
-
-type testSpanContext struct {
- HasParent bool
- FakeID int
-}
-
-func (n testSpanContext) ForeachBaggageItem(handler func(k, v string) bool) {}
-
-type testSpan struct {
- spanContext testSpanContext
- OperationName string
- StartTime time.Time
- Tags map[string]interface{}
-}
-
-func (n testSpan) Equal(os Span) bool {
- other, ok := os.(testSpan)
- if !ok {
- return false
- }
- if n.spanContext != other.spanContext {
- return false
- }
- if n.OperationName != other.OperationName {
- return false
- }
- if !n.StartTime.Equal(other.StartTime) {
- return false
- }
- if len(n.Tags) != len(other.Tags) {
- return false
- }
-
- for k, v := range n.Tags {
- if ov, ok := other.Tags[k]; !ok || ov != v {
- return false
- }
- }
-
- return true
-}
-
-// testSpan:
-func (n testSpan) Context() SpanContext { return n.spanContext }
-func (n testSpan) SetTag(key string, value interface{}) Span { return n }
-func (n testSpan) Finish() {}
-func (n testSpan) FinishWithOptions(opts FinishOptions) {}
-func (n testSpan) LogFields(fields ...log.Field) {}
-func (n testSpan) LogKV(kvs ...interface{}) {}
-func (n testSpan) SetOperationName(operationName string) Span { return n }
-func (n testSpan) Tracer() Tracer { return testTracer{} }
-func (n testSpan) SetBaggageItem(key, val string) Span { return n }
-func (n testSpan) BaggageItem(key string) string { return "" }
-func (n testSpan) LogEvent(event string) {}
-func (n testSpan) LogEventWithPayload(event string, payload interface{}) {}
-func (n testSpan) Log(data LogData) {}
-
-// StartSpan belongs to the Tracer interface.
-func (n testTracer) StartSpan(operationName string, opts ...StartSpanOption) Span {
- sso := StartSpanOptions{}
- for _, o := range opts {
- o.Apply(&sso)
- }
- return n.startSpanWithOptions(operationName, sso)
-}
-
-func (n testTracer) startSpanWithOptions(name string, opts StartSpanOptions) Span {
- fakeID := nextFakeID()
- if len(opts.References) > 0 {
- fakeID = opts.References[0].ReferencedContext.(testSpanContext).FakeID
- }
-
- return testSpan{
- OperationName: name,
- StartTime: opts.StartTime,
- Tags: opts.Tags,
- spanContext: testSpanContext{
- HasParent: len(opts.References) > 0,
- FakeID: fakeID,
- },
- }
-}
-
-// Inject belongs to the Tracer interface.
-func (n testTracer) Inject(sp SpanContext, format interface{}, carrier interface{}) error {
- spanContext := sp.(testSpanContext)
- switch format {
- case HTTPHeaders, TextMap:
- carrier.(TextMapWriter).Set(testHTTPHeaderPrefix+"fakeid", strconv.Itoa(spanContext.FakeID))
- return nil
- }
- return ErrUnsupportedFormat
-}
-
-// Extract belongs to the Tracer interface.
-func (n testTracer) Extract(format interface{}, carrier interface{}) (SpanContext, error) {
- switch format {
- case HTTPHeaders, TextMap:
- // Just for testing purposes... generally not a worthwhile thing to
- // propagate.
- sm := testSpanContext{}
- err := carrier.(TextMapReader).ForeachKey(func(key, val string) error {
- switch strings.ToLower(key) {
- case testHTTPHeaderPrefix + "fakeid":
- i, err := strconv.Atoi(val)
- if err != nil {
- return err
- }
- sm.FakeID = i
- }
- return nil
- })
- return sm, err
- }
- return nil, ErrSpanContextNotFound
-}
diff --git a/vendor/github.com/openzipkin/zipkin-go-opentracing/bench_test.go b/vendor/github.com/openzipkin/zipkin-go-opentracing/bench_test.go
deleted file mode 100644
index c16012054..000000000
--- a/vendor/github.com/openzipkin/zipkin-go-opentracing/bench_test.go
+++ /dev/null
@@ -1,197 +0,0 @@
-package zipkintracer
-
-import (
- "bytes"
- "fmt"
- "net/http"
- "testing"
-
- opentracing "github.com/opentracing/opentracing-go"
-)
-
-var tags []string
-
-func init() {
- tags = make([]string, 1000)
- for j := 0; j < len(tags); j++ {
- tags[j] = fmt.Sprintf("%d", randomID())
- }
-}
-
-func executeOps(sp opentracing.Span, numEvent, numTag, numItems int) {
- for j := 0; j < numEvent; j++ {
- sp.LogEvent("event")
- }
- for j := 0; j < numTag; j++ {
- sp.SetTag(tags[j], nil)
- }
- for j := 0; j < numItems; j++ {
- sp.SetBaggageItem(tags[j], tags[j])
- }
-}
-
-func benchmarkWithOps(b *testing.B, numEvent, numTag, numItems int) {
- var r CountingRecorder
- t, err := NewTracer(&r)
- if err != nil {
- b.Fatalf("Unable to create Tracer: %+v", err)
- }
- benchmarkWithOpsAndCB(b, func() opentracing.Span {
- return t.StartSpan("test")
- }, numEvent, numTag, numItems)
- if int(r) != b.N {
- b.Fatalf("missing traces: expected %d, got %d", b.N, r)
- }
-}
-
-func benchmarkWithOpsAndCB(b *testing.B, create func() opentracing.Span,
- numEvent, numTag, numItems int) {
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- sp := create()
- executeOps(sp, numEvent, numTag, numItems)
- sp.Finish()
- }
- b.StopTimer()
-}
-
-func BenchmarkSpan_Empty(b *testing.B) {
- benchmarkWithOps(b, 0, 0, 0)
-}
-
-func BenchmarkSpan_100Events(b *testing.B) {
- benchmarkWithOps(b, 100, 0, 0)
-}
-
-func BenchmarkSpan_1000Events(b *testing.B) {
- benchmarkWithOps(b, 1000, 0, 0)
-}
-
-func BenchmarkSpan_100Tags(b *testing.B) {
- benchmarkWithOps(b, 0, 100, 0)
-}
-
-func BenchmarkSpan_1000Tags(b *testing.B) {
- benchmarkWithOps(b, 0, 1000, 0)
-}
-
-func BenchmarkSpan_100BaggageItems(b *testing.B) {
- benchmarkWithOps(b, 0, 0, 100)
-}
-
-func BenchmarkTrimmedSpan_100Events_100Tags_100BaggageItems(b *testing.B) {
- var r CountingRecorder
- t, err := NewTracer(
- &r,
- TrimUnsampledSpans(true),
- WithSampler(neverSample),
- TraceID128Bit(true),
- )
- if err != nil {
- b.Fatalf("Unable to create Tracer: %+v", err)
- }
- benchmarkWithOpsAndCB(b, func() opentracing.Span {
- sp := t.StartSpan("test")
- return sp
- }, 100, 100, 100)
- if int(r) != b.N {
- b.Fatalf("missing traces: expected %d, got %d", b.N, r)
- }
-}
-
-func benchmarkInject(b *testing.B, format opentracing.BuiltinFormat, numItems int) {
- var r CountingRecorder
- tracer, err := NewTracer(&r)
- if err != nil {
- b.Fatalf("Unable to create Tracer: %+v", err)
- }
- sp := tracer.StartSpan("testing")
- executeOps(sp, 0, 0, numItems)
- var carrier interface{}
- switch format {
- case opentracing.TextMap, opentracing.HTTPHeaders:
- carrier = opentracing.HTTPHeadersCarrier(http.Header{})
- case opentracing.Binary:
- carrier = &bytes.Buffer{}
- default:
- b.Fatalf("unhandled format %d", format)
- }
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- err := tracer.Inject(sp.Context(), format, carrier)
- if err != nil {
- b.Fatal(err)
- }
- }
-}
-
-func benchmarkExtract(b *testing.B, format opentracing.BuiltinFormat, numItems int) {
- var r CountingRecorder
- tracer, err := NewTracer(&r)
- if err != nil {
- b.Fatalf("Unable to create Tracer: %+v", err)
- }
- sp := tracer.StartSpan("testing")
- executeOps(sp, 0, 0, numItems)
- var carrier interface{}
- switch format {
- case opentracing.TextMap, opentracing.HTTPHeaders:
- carrier = opentracing.HTTPHeadersCarrier(http.Header{})
- case opentracing.Binary:
- carrier = &bytes.Buffer{}
- default:
- b.Fatalf("unhandled format %d", format)
- }
- if err := tracer.Inject(sp.Context(), format, carrier); err != nil {
- b.Fatal(err)
- }
-
- // We create a new bytes.Buffer every time for tracer.Extract() to keep
- // this benchmark realistic.
- var rawBinaryBytes []byte
- if format == opentracing.Binary {
- rawBinaryBytes = carrier.(*bytes.Buffer).Bytes()
- }
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- if format == opentracing.Binary {
- carrier = bytes.NewBuffer(rawBinaryBytes)
- }
- _, err := tracer.Extract(format, carrier)
- if err != nil {
- b.Fatal(err)
- }
- }
-}
-
-func BenchmarkInject_TextMap_Empty(b *testing.B) {
- benchmarkInject(b, opentracing.TextMap, 0)
-}
-
-func BenchmarkInject_TextMap_100BaggageItems(b *testing.B) {
- benchmarkInject(b, opentracing.TextMap, 100)
-}
-
-func BenchmarkInject_Binary_Empty(b *testing.B) {
- benchmarkInject(b, opentracing.Binary, 0)
-}
-
-func BenchmarkInject_Binary_100BaggageItems(b *testing.B) {
- benchmarkInject(b, opentracing.Binary, 100)
-}
-
-func BenchmarkExtract_TextMap_Empty(b *testing.B) {
- benchmarkExtract(b, opentracing.TextMap, 0)
-}
-
-func BenchmarkExtract_TextMap_100BaggageItems(b *testing.B) {
- benchmarkExtract(b, opentracing.TextMap, 100)
-}
-
-func BenchmarkExtract_Binary_Empty(b *testing.B) {
- benchmarkExtract(b, opentracing.Binary, 0)
-}
-
-func BenchmarkExtract_Binary_100BaggageItems(b *testing.B) {
- benchmarkExtract(b, opentracing.Binary, 100)
-}
diff --git a/vendor/github.com/openzipkin/zipkin-go-opentracing/collector-http_test.go b/vendor/github.com/openzipkin/zipkin-go-opentracing/collector-http_test.go
deleted file mode 100644
index d3d2cfae1..000000000
--- a/vendor/github.com/openzipkin/zipkin-go-opentracing/collector-http_test.go
+++ /dev/null
@@ -1,382 +0,0 @@
-package zipkintracer
-
-import (
- "fmt"
- "io/ioutil"
- "net/http"
- "strings"
- "sync"
- "testing"
- "time"
-
- "github.com/apache/thrift/lib/go/thrift"
-
- "github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/zipkincore"
-)
-
-const (
- interval = 10 * time.Millisecond
- serverSleep = 100 * time.Millisecond
-)
-
-func TestHttpCollector(t *testing.T) {
- t.Parallel()
-
- port := 10000
- server := newHTTPServer(t, port)
- c, err := NewHTTPCollector(fmt.Sprintf("http://localhost:%d/api/v1/spans", port))
- if err != nil {
- t.Fatal(err)
- }
-
- var (
- serviceName = "service"
- methodName = "method"
- traceID = int64(123)
- spanID = int64(456)
- parentSpanID = int64(0)
- value = "foo"
- )
-
- span := makeNewSpan("1.2.3.4:1234", serviceName, methodName, traceID, spanID, parentSpanID, true)
- annotate(span, time.Now(), value, nil)
- if err := c.Collect(span); err != nil {
- t.Errorf("error during collection: %v", err)
- }
- if err := c.Close(); err != nil {
- t.Fatalf("error during collection: %v", err)
- }
- if want, have := 1, len(server.spans()); want != have {
- t.Fatal("never received a span")
- }
-
- gotSpan := server.spans()[0]
- if want, have := methodName, gotSpan.GetName(); want != have {
- t.Errorf("want %q, have %q", want, have)
- }
- if want, have := traceID, gotSpan.TraceID; want != have {
- t.Errorf("want %d, have %d", want, have)
- }
- if want, have := spanID, gotSpan.ID; want != have {
- t.Errorf("want %d, have %d", want, have)
- }
- if want, have := parentSpanID, *gotSpan.ParentID; want != have {
- t.Errorf("want %d, have %d", want, have)
- }
-
- if want, have := 1, len(gotSpan.GetAnnotations()); want != have {
- t.Fatalf("want %d, have %d", want, have)
- }
-
- gotAnnotation := gotSpan.GetAnnotations()[0]
- if want, have := value, gotAnnotation.GetValue(); want != have {
- t.Errorf("want %q, have %q", want, have)
- }
-
-}
-
-func TestHttpCollector_Batch(t *testing.T) {
- t.Parallel()
-
- port := 10001
- server := newHTTPServer(t, port)
-
- var (
- batchSize = 5
- spanTimeout = 100 * time.Millisecond
- )
-
- c, err := NewHTTPCollector(fmt.Sprintf("http://localhost:%d/api/v1/spans", port),
- HTTPBatchSize(batchSize),
- HTTPBatchInterval(time.Duration(2*batchSize)*spanTimeout), // Make sure timeout won't cause this test to pass
- )
- if err != nil {
- t.Fatal(err)
- }
-
- for i := 0; i < batchSize-1; i++ {
- if err := c.Collect(&zipkincore.Span{}); err != nil {
- t.Errorf("error during collection: %v", err)
- }
- }
-
- err = consistently(func() bool { return len(server.spans()) == 0 }, spanTimeout)
- if err != nil {
- t.Fatal("Client sent spans before batch size")
- }
-
- if err := c.Collect(&zipkincore.Span{}); err != nil {
- t.Errorf("error during collection: %v", err)
- }
-
- err = eventually(func() bool { return len(server.spans()) != batchSize }, time.Duration(batchSize)*time.Millisecond)
- if err != nil {
- t.Fatal("Client did not send spans when batch size reached")
- }
-}
-
-func TestHttpCollector_BatchInterval(t *testing.T) {
- t.Parallel()
-
- port := 10002
- server := newHTTPServer(t, port)
-
- var (
- batchSize = 5
- batchInterval = 100 * time.Millisecond
- )
-
- start := time.Now()
- c, err := NewHTTPCollector(fmt.Sprintf("http://localhost:%d/api/v1/spans", port),
- HTTPBatchSize(batchSize), // Make sure batch won't make this test pass
- HTTPBatchInterval(batchInterval),
- )
- if err != nil {
- t.Fatal(err)
- }
-
- // send less spans than batchSize in the background
- lessThanBatchSize := batchSize - 1
- go func() {
- for i := 0; i < lessThanBatchSize; i++ {
- if err := c.Collect(&zipkincore.Span{}); err != nil {
- t.Errorf("error during collection: %v", err)
- }
- }
- }()
-
- beforeInterval := batchInterval - (2 * interval) - time.Now().Sub(start)
- err = consistently(func() bool { return len(server.spans()) == 0 }, beforeInterval)
- if err != nil {
- t.Fatal("Client sent spans before timeout")
- }
-
- afterInterval := batchInterval * 2
- err = eventually(func() bool { return len(server.spans()) == lessThanBatchSize }, afterInterval)
- if err != nil {
- t.Fatal("Client did not send spans after timeout")
- }
-}
-
-// TestHttpCollector_NonBlockCollect tests that the Collect
-// function is non-blocking, even when the server is slow.
-// Use of the /api/v1/sleep endpoint registered in the server.
-func TestHttpCollector_NonBlockCollect(t *testing.T) {
- t.Parallel()
-
- port := 10003
- newHTTPServer(t, port)
-
- c, err := NewHTTPCollector(fmt.Sprintf("http://localhost:%d/api/v1/sleep", port))
- if err != nil {
- t.Fatal(err)
- }
-
- start := time.Now()
- if err := c.Collect(&zipkincore.Span{}); err != nil {
- t.Errorf("error during collection: %v", err)
- }
-
- if time.Now().Sub(start) >= serverSleep {
- t.Fatal("Collect is blocking")
- }
-
-}
-
-func TestHttpCollector_MaxBatchSize(t *testing.T) {
- t.Parallel()
-
- port := 10004
- server := newHTTPServer(t, port)
-
- var (
- maxBacklog = 5
- batchSize = maxBacklog * 2 // make backsize bigger than backlog enable testing backlog disposal
- )
-
- c, err := NewHTTPCollector(fmt.Sprintf("http://localhost:%d/api/v1/spans", port),
- HTTPMaxBacklog(maxBacklog),
- HTTPBatchSize(batchSize),
- )
- if err != nil {
- t.Fatal(err)
- }
-
- for i := 0; i < batchSize; i++ {
- c.Collect(makeNewSpan("", "", "", 0, int64(i), 0, false))
- }
- c.Close()
-
- for i, s := range server.spans() {
- if want, have := int64(i+maxBacklog), s.ID; want != have {
- t.Errorf("Span ID is wrong. want %d, have %d", want, have)
- }
- }
-
-}
-
-func TestHTTPCollector_RequestCallback(t *testing.T) {
- t.Parallel()
-
- var (
- err error
- port = 10005
- server = newHTTPServer(t, port)
- hdrKey = "test-key"
- hdrValue = "test-value"
- )
-
- c, err := NewHTTPCollector(
- fmt.Sprintf("http://localhost:%d/api/v1/spans", port),
- HTTPRequestCallback(func(r *http.Request) {
- r.Header.Add(hdrKey, hdrValue)
- }),
- )
- if err != nil {
- t.Fatal(err)
- }
- if err = c.Collect(&zipkincore.Span{}); err != nil {
- t.Fatal(err)
- }
- if err = c.Close(); err != nil {
- t.Fatal(err)
- }
-
- if want, have := 1, len(server.spans()); want != have {
- t.Fatal("never received a span")
- }
-
- headers := server.headers()
- if len(headers) == 0 {
- t.Fatalf("Collect request was not handled")
- }
- testHeader := headers.Get(hdrKey)
- if !strings.EqualFold(testHeader, hdrValue) {
- t.Errorf("Custom header not received. want %s, have %s", testHeader, hdrValue)
- }
- server.clearHeaders()
-}
-
-type httpServer struct {
- t *testing.T
- zipkinSpans []*zipkincore.Span
- zipkinHeader http.Header
- mutex sync.RWMutex
-}
-
-func (s *httpServer) spans() []*zipkincore.Span {
- s.mutex.RLock()
- defer s.mutex.RUnlock()
- return s.zipkinSpans
-}
-
-func (s *httpServer) clearSpans() {
- s.mutex.Lock()
- defer s.mutex.Unlock()
- s.zipkinSpans = s.zipkinSpans[:0]
-}
-
-func (s *httpServer) headers() http.Header {
- s.mutex.RLock()
- defer s.mutex.RUnlock()
- return s.zipkinHeader
-}
-
-func (s *httpServer) clearHeaders() {
- s.mutex.Lock()
- defer s.mutex.Unlock()
- s.zipkinHeader = make(http.Header, 0)
-}
-
-func newHTTPServer(t *testing.T, port int) *httpServer {
- server := &httpServer{
- t: t,
- zipkinSpans: make([]*zipkincore.Span, 0),
- mutex: sync.RWMutex{},
- }
-
- handler := http.NewServeMux()
-
- handler.HandleFunc("/api/v1/spans", func(w http.ResponseWriter, r *http.Request) {
- contextType := r.Header.Get("Content-Type")
- if contextType != "application/x-thrift" {
- t.Fatalf(
- "except Content-Type should be application/x-thrift, but is %s",
- contextType)
- }
-
- // clone headers from request
- headers := make(http.Header, len(r.Header))
- for k, vv := range r.Header {
- vv2 := make([]string, len(vv))
- copy(vv2, vv)
- headers[k] = vv2
- }
-
- body, err := ioutil.ReadAll(r.Body)
- if err != nil {
- t.Fatal(err)
- }
- buffer := thrift.NewTMemoryBuffer()
- if _, err = buffer.Write(body); err != nil {
- t.Error(err)
- return
- }
- transport := thrift.NewTBinaryProtocolTransport(buffer)
- _, size, err := transport.ReadListBegin()
- if err != nil {
- t.Error(err)
- return
- }
- var spans []*zipkincore.Span
- for i := 0; i < size; i++ {
- zs := &zipkincore.Span{}
- if err = zs.Read(transport); err != nil {
- t.Error(err)
- return
- }
- spans = append(spans, zs)
- }
- err = transport.ReadListEnd()
- if err != nil {
- t.Error(err)
- return
- }
- server.mutex.Lock()
- defer server.mutex.Unlock()
- server.zipkinSpans = append(server.zipkinSpans, spans...)
- server.zipkinHeader = headers
- })
-
- handler.HandleFunc("/api/v1/sleep", func(w http.ResponseWriter, r *http.Request) {
- time.Sleep(serverSleep)
- })
-
- go func() {
- http.ListenAndServe(fmt.Sprintf(":%d", port), handler)
- }()
-
- return server
-}
-
-func consistently(assertion func() bool, atList time.Duration) error {
- deadline := time.Now().Add(atList)
- for time.Now().Before(deadline) {
- if !assertion() {
- return fmt.Errorf("failed")
- }
- time.Sleep(interval)
- }
- return nil
-}
-
-func eventually(assertion func() bool, timeout time.Duration) error {
- deadline := time.Now().Add(timeout)
- for time.Now().Before(deadline) {
- if assertion() {
- return nil
- }
- time.Sleep(interval)
- }
- return fmt.Errorf("failed")
-}
diff --git a/vendor/github.com/openzipkin/zipkin-go-opentracing/collector-kafka_test.go b/vendor/github.com/openzipkin/zipkin-go-opentracing/collector-kafka_test.go
deleted file mode 100644
index c2c90f392..000000000
--- a/vendor/github.com/openzipkin/zipkin-go-opentracing/collector-kafka_test.go
+++ /dev/null
@@ -1,194 +0,0 @@
-package zipkintracer
-
-import (
- "context"
- "errors"
- "testing"
- "time"
-
- "github.com/Shopify/sarama"
- "github.com/apache/thrift/lib/go/thrift"
-
- "github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/zipkincore"
-)
-
-type stubProducer struct {
- in chan *sarama.ProducerMessage
- err chan *sarama.ProducerError
- kdown bool
- closed bool
-}
-
-func (p *stubProducer) AsyncClose() {}
-func (p *stubProducer) Close() error {
- if p.kdown {
- return errors.New("Kafka is down")
- }
- p.closed = true
- return nil
-}
-func (p *stubProducer) Input() chan<- *sarama.ProducerMessage { return p.in }
-func (p *stubProducer) Successes() <-chan *sarama.ProducerMessage { return nil }
-func (p *stubProducer) Errors() <-chan *sarama.ProducerError { return p.err }
-
-func newStubProducer(kdown bool) *stubProducer {
- return &stubProducer{
- make(chan *sarama.ProducerMessage),
- make(chan *sarama.ProducerError),
- kdown,
- false,
- }
-}
-
-var spans = []*zipkincore.Span{
- makeNewSpan("203.0.113.10:1234", "service1", "avg", 123, 456, 0, true),
- makeNewSpan("203.0.113.10:1234", "service2", "sum", 123, 789, 456, true),
- makeNewSpan("203.0.113.10:1234", "service2", "div", 123, 101112, 456, true),
-}
-
-func TestKafkaProduce(t *testing.T) {
- p := newStubProducer(false)
- c, err := NewKafkaCollector(
- []string{"192.0.2.10:9092"}, KafkaProducer(p),
- )
- if err != nil {
- t.Fatal(err)
- }
-
- for _, want := range spans {
- m := collectSpan(t, c, p, want)
- testMetadata(t, m)
- got := deserializeSpan(t, m.Value)
- testEqual(t, want, got)
- }
-}
-
-func TestKafkaClose(t *testing.T) {
- p := newStubProducer(false)
- c, err := NewKafkaCollector(
- []string{"192.0.2.10:9092"}, KafkaProducer(p),
- )
- if err != nil {
- t.Fatal(err)
- }
- if err = c.Close(); err != nil {
- t.Fatal(err)
- }
- if !p.closed {
- t.Fatal("producer not closed")
- }
-}
-
-func TestKafkaCloseError(t *testing.T) {
- p := newStubProducer(true)
- c, err := NewKafkaCollector(
- []string{"192.0.2.10:9092"}, KafkaProducer(p),
- )
- if err != nil {
- t.Fatal(err)
- }
- if err = c.Close(); err == nil {
- t.Error("no error on close")
- }
-}
-
-func TestKafkaErrors(t *testing.T) {
- p := newStubProducer(true)
- errs := make(chan []interface{}, len(spans))
- lg := Logger(LoggerFunc(func(keyvals ...interface{}) error {
- for i := 0; i < len(keyvals); i += 2 {
- if keyvals[i] == "result" && keyvals[i+1] == "failed to produce msg" {
- errs <- keyvals
- }
- }
- return nil
- }))
- c, err := NewKafkaCollector(
- []string{"192.0.2.10:9092"},
- KafkaProducer(p),
- KafkaLogger(lg),
- )
- if err != nil {
- t.Fatal(err)
- }
- for _, want := range spans {
- _ = collectSpan(t, c, p, want)
- }
-
- for i := 0; i < len(spans); i++ {
- select {
- case <-errs:
- case <-time.After(100 * time.Millisecond):
- t.Fatalf("errors not logged. got %d, wanted %d", i, len(spans))
- }
- }
-}
-
-func collectSpan(t *testing.T, c Collector, p *stubProducer, s *zipkincore.Span) *sarama.ProducerMessage {
- var m *sarama.ProducerMessage
- rcvd := make(chan bool, 1)
- go func() {
- select {
- case m = <-p.in:
- rcvd <- true
- if p.kdown {
- p.err <- &sarama.ProducerError{
- Msg: m,
- Err: errors.New("kafka is down"),
- }
- }
- case <-time.After(100 * time.Millisecond):
- rcvd <- false
- }
- }()
-
- if err := c.Collect(s); err != nil {
- t.Errorf("error during collection: %v", err)
- }
- if !<-rcvd {
- t.Fatal("span message was not produced")
- }
- return m
-}
-
-func testMetadata(t *testing.T, m *sarama.ProducerMessage) {
- if m.Topic != "zipkin" {
- t.Errorf("produced to topic %q, want %q", m.Topic, "zipkin")
- }
- if m.Key != nil {
- t.Errorf("produced with key %q, want nil", m.Key)
- }
-}
-
-func deserializeSpan(t *testing.T, e sarama.Encoder) *zipkincore.Span {
- bytes, err := e.Encode()
- if err != nil {
- t.Errorf("error in encoding: %v", err)
- }
- s := zipkincore.NewSpan()
- mb := thrift.NewTMemoryBufferLen(len(bytes))
- _, _ = mb.Write(bytes)
- _ = mb.Flush(context.Background())
- pt := thrift.NewTBinaryProtocolTransport(mb)
- err = s.Read(pt)
- if err != nil {
- t.Errorf("error in decoding: %v", err)
- }
- return s
-}
-
-func testEqual(t *testing.T, want *zipkincore.Span, got *zipkincore.Span) {
- if got.TraceID != want.TraceID {
- t.Errorf("trace_id %d, want %d", got.TraceID, want.TraceID)
- }
- if got.ID != want.ID {
- t.Errorf("id %d, want %d", got.ID, want.ID)
- }
- if got.ParentID == nil {
- if want.ParentID != nil {
- t.Errorf("parent_id %d, want %d", got.ParentID, want.ParentID)
- }
- } else if *got.ParentID != *want.ParentID {
- t.Errorf("parent_id %d, want %d", got.ParentID, want.ParentID)
- }
-}
diff --git a/vendor/github.com/openzipkin/zipkin-go-opentracing/collector-scribe_test.go b/vendor/github.com/openzipkin/zipkin-go-opentracing/collector-scribe_test.go
deleted file mode 100644
index d38e0ddb2..000000000
--- a/vendor/github.com/openzipkin/zipkin-go-opentracing/collector-scribe_test.go
+++ /dev/null
@@ -1,189 +0,0 @@
-package zipkintracer
-
-import (
- "context"
- "encoding/base64"
- "fmt"
- "math/rand"
- "net"
- "sync"
- "testing"
- "time"
-
- "github.com/apache/thrift/lib/go/thrift"
-
- "github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/scribe"
- "github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/zipkincore"
-)
-
-func TestScribeCollector(t *testing.T) {
- server := newScribeServer(t)
-
- timeout := time.Second
- batchInterval := time.Millisecond
- c, err := NewScribeCollector(server.addr(), timeout, ScribeBatchSize(0), ScribeBatchInterval(batchInterval))
- if err != nil {
- t.Fatal(err)
- }
-
- var (
- serviceName = "service"
- methodName = "method"
- traceID = int64(123)
- spanID = int64(456)
- parentSpanID = int64(0)
- value = "foo"
- )
-
- span := makeNewSpan("1.2.3.4:1234", serviceName, methodName, traceID, spanID, parentSpanID, true)
- annotate(span, time.Now(), "foo", nil)
- if err := c.Collect(span); err != nil {
- t.Errorf("error during collection: %v", err)
- }
- if err := c.Close(); err != nil {
- t.Fatalf("error during collection: %v", err)
- }
- if want, have := 1, len(server.spans()); want != have {
- t.Fatalf("never received a span")
- }
-
- gotSpan := server.spans()[0]
- if want, have := methodName, gotSpan.GetName(); want != have {
- t.Errorf("want %q, have %q", want, have)
- }
- if want, have := traceID, gotSpan.TraceID; want != have {
- t.Errorf("want %d, have %d", want, have)
- }
- if want, have := spanID, gotSpan.ID; want != have {
- t.Errorf("want %d, have %d", want, have)
- }
- if want, have := parentSpanID, *gotSpan.ParentID; want != have {
- t.Errorf("want %d, have %d", want, have)
- }
-
- if want, have := 1, len(gotSpan.GetAnnotations()); want != have {
- t.Fatalf("want %d, have %d", want, have)
- }
-
- gotAnnotation := gotSpan.GetAnnotations()[0]
- if want, have := value, gotAnnotation.GetValue(); want != have {
- t.Errorf("want %q, have %q", want, have)
- }
-}
-
-type scribeServer struct {
- t *testing.T
- transport *thrift.TServerSocket
- address string
- server *thrift.TSimpleServer
- handler *scribeHandler
-}
-
-func newScribeServer(t *testing.T) *scribeServer {
- protocolFactory := thrift.NewTBinaryProtocolFactoryDefault()
- transportFactory := thrift.NewTFramedTransportFactory(thrift.NewTTransportFactory())
-
- var port int
- var transport *thrift.TServerSocket
- var err error
- for i := 0; i < 10; i++ {
- port = 10000 + rand.Intn(10000)
- transport, err = thrift.NewTServerSocket(fmt.Sprintf(":%d", port))
- if err != nil {
- t.Logf("port %d: %v", port, err)
- continue
- }
- break
- }
- if err != nil {
- t.Fatal(err)
- }
-
- handler := newScribeHandler(t)
- server := thrift.NewTSimpleServer4(
- scribe.NewScribeProcessor(handler),
- transport,
- transportFactory,
- protocolFactory,
- )
-
- go func() {
- _ = server.Serve()
- }()
-
- deadline := time.Now().Add(time.Second)
- for !canConnect(port) {
- if time.Now().After(deadline) {
- t.Fatal("server never started")
- }
- time.Sleep(time.Millisecond)
- }
-
- return &scribeServer{
- transport: transport,
- address: fmt.Sprintf("127.0.0.1:%d", port),
- handler: handler,
- }
-}
-
-func (s *scribeServer) addr() string {
- return s.address
-}
-
-func (s *scribeServer) spans() []*zipkincore.Span {
- return s.handler.spans()
-}
-
-type scribeHandler struct {
- t *testing.T
- sync.RWMutex
- entries []*scribe.LogEntry
-}
-
-func newScribeHandler(t *testing.T) *scribeHandler {
- return &scribeHandler{t: t}
-}
-
-func (h *scribeHandler) Log(ctx context.Context, messages []*scribe.LogEntry) (scribe.ResultCode, error) {
- h.Lock()
- defer h.Unlock()
- for _, m := range messages {
- h.entries = append(h.entries, m)
- }
- return scribe.ResultCode_OK, nil
-}
-
-func (h *scribeHandler) spans() []*zipkincore.Span {
- h.RLock()
- defer h.RUnlock()
- spans := []*zipkincore.Span{}
- for _, m := range h.entries {
- decoded, err := base64.StdEncoding.DecodeString(m.GetMessage())
- if err != nil {
- h.t.Error(err)
- continue
- }
- buffer := thrift.NewTMemoryBuffer()
- if _, err := buffer.Write(decoded); err != nil {
- h.t.Error(err)
- continue
- }
- transport := thrift.NewTBinaryProtocolTransport(buffer)
- zs := &zipkincore.Span{}
- if err := zs.Read(transport); err != nil {
- h.t.Error(err)
- continue
- }
- spans = append(spans, zs)
- }
- return spans
-}
-
-func canConnect(port int) bool {
- c, err := net.Dial("tcp", fmt.Sprintf("127.0.0.1:%d", port))
- if err != nil {
- return false
- }
- _ = c.Close()
- return true
-}
diff --git a/vendor/github.com/openzipkin/zipkin-go-opentracing/collector_test.go b/vendor/github.com/openzipkin/zipkin-go-opentracing/collector_test.go
deleted file mode 100644
index e0d155489..000000000
--- a/vendor/github.com/openzipkin/zipkin-go-opentracing/collector_test.go
+++ /dev/null
@@ -1,110 +0,0 @@
-package zipkintracer
-
-import (
- "fmt"
- "testing"
- "time"
-
- "github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/zipkincore"
-)
-
-var s = makeNewSpan("203.0.113.10:1234", "service1", "avg", 123, 456, 0, true)
-
-func TestNopCollector(t *testing.T) {
- c := NopCollector{}
- if err := c.Collect(s); err != nil {
- t.Error(err)
- }
- if err := c.Close(); err != nil {
- t.Error(err)
- }
-}
-
-type stubCollector struct {
- errid int
- collected bool
- closed bool
-}
-
-func (c *stubCollector) Collect(*zipkincore.Span) error {
- c.collected = true
- if c.errid != 0 {
- return fmt.Errorf("error %d", c.errid)
- }
- return nil
-}
-
-func (c *stubCollector) Close() error {
- c.closed = true
- if c.errid != 0 {
- return fmt.Errorf("error %d", c.errid)
- }
- return nil
-}
-
-func TestMultiCollector(t *testing.T) {
- cs := MultiCollector{
- &stubCollector{errid: 1},
- &stubCollector{},
- &stubCollector{errid: 2},
- }
- err := cs.Collect(s)
- if err == nil {
- t.Fatal("wanted error, got none")
- }
- if want, have := "error 1; error 2", err.Error(); want != have {
- t.Errorf("want %q, have %q", want, have)
- }
- collectionError := err.(CollectionError).GetErrors()
- if want, have := 3, len(collectionError); want != have {
- t.Fatalf("want %d, have %d", want, have)
- }
- if want, have := cs[0].Collect(s).Error(), collectionError[0].Error(); want != have {
- t.Errorf("want %q, have %q", want, have)
- }
- if want, have := cs[1].Collect(s), collectionError[1]; want != have {
- t.Errorf("want %q, have %q", want, have)
- }
- if want, have := cs[2].Collect(s).Error(), collectionError[2].Error(); want != have {
- t.Errorf("want %q, have %q", want, have)
- }
-
- for _, c := range cs {
- if !c.(*stubCollector).collected {
- t.Error("collect not called")
- }
- }
-}
-
-func TestMultiCollectorClose(t *testing.T) {
- cs := MultiCollector{
- &stubCollector{errid: 1},
- &stubCollector{},
- &stubCollector{errid: 2},
- }
- err := cs.Close()
- if err == nil {
- t.Fatal("wanted error, got none")
- }
- if want, have := "error 1; error 2", err.Error(); want != have {
- t.Errorf("want %q, have %q", want, have)
- }
-
- for _, c := range cs {
- if !c.(*stubCollector).closed {
- t.Error("close not called")
- }
- }
-}
-
-func makeNewSpan(hostPort, serviceName, methodName string, traceID, spanID, parentSpanID int64, debug bool) *zipkincore.Span {
- timestamp := time.Now().UnixNano() / 1e3
- return &zipkincore.Span{
- TraceID: traceID,
- Name: methodName,
- ID: spanID,
- ParentID: &parentSpanID,
- Debug: debug,
- Timestamp: &timestamp,
- }
-}
diff --git a/vendor/github.com/openzipkin/zipkin-go-opentracing/concurrency_test.go b/vendor/github.com/openzipkin/zipkin-go-opentracing/concurrency_test.go
deleted file mode 100644
index 1558d3bcf..000000000
--- a/vendor/github.com/openzipkin/zipkin-go-opentracing/concurrency_test.go
+++ /dev/null
@@ -1,134 +0,0 @@
-package zipkintracer
-
-import (
- "strings"
- "sync"
- "testing"
-
- opentracing "github.com/opentracing/opentracing-go"
-)
-
-const op = "test"
-
-func TestDebugAssertSingleGoroutine(t *testing.T) {
- tracer, err := NewTracer(
- NewInMemoryRecorder(),
- EnableSpanPool(true),
- DebugAssertSingleGoroutine(true),
- TraceID128Bit(true),
- )
- if err != nil {
- t.Fatalf("Unable to create Tracer: %+v", err)
- }
- sp := tracer.StartSpan(op)
- sp.LogEvent("something on my goroutine")
- wait := make(chan struct{})
- var panicked bool
- go func() {
- defer func() {
- if r := recover(); r != nil {
- _, panicked = r.(*errAssertionFailed)
- }
- close(wait)
- }()
- sp.LogEvent("something on your goroutine")
- }()
- <-wait
- if !panicked {
- t.Fatal("expected a panic")
- }
-}
-
-func TestDebugAssertUseAfterFinish(t *testing.T) {
- tracer, err := NewTracer(
- NewInMemoryRecorder(),
- EnableSpanPool(true),
- DebugAssertUseAfterFinish(true),
- TraceID128Bit(true),
- )
- if err != nil {
- t.Fatalf("Unable to create Tracer: %+v", err)
- }
- const msg = "I shall be finished"
- for _, double := range []bool{false, true} {
- sp := tracer.StartSpan(op)
- sp.Log(opentracing.LogData{Event: msg})
- if double {
- sp.Finish()
- }
- var panicked bool
- func() {
- defer func() {
- r := recover()
- var assertionErr error
- assertionErr, panicked = r.(*errAssertionFailed)
- if !panicked && r != nil {
- panic(r)
- }
- if panicked && !strings.Contains(assertionErr.Error(), msg) {
- t.Fatalf("debug output did not contain log message '%s': %+v", msg, assertionErr)
- }
- spImpl := sp.(*spanImpl)
- // The panic should leave the Mutex unlocked.
- spImpl.Mutex.Lock()
- spImpl.Mutex.Unlock()
- }()
- sp.Finish()
- }()
- if panicked != double {
- t.Errorf("finished double = %t, but panicked = %t", double, panicked)
- }
- }
-}
-
-func TestConcurrentUsage(t *testing.T) {
- var cr CountingRecorder
- tracer, err := NewTracer(
- &cr,
- EnableSpanPool(true),
- DebugAssertSingleGoroutine(true),
- TraceID128Bit(true),
- )
- if err != nil {
- t.Fatalf("Unable to create Tracer: %+v", err)
- }
- var wg sync.WaitGroup
- const num = 100
- wg.Add(num)
- for i := 0; i < num; i++ {
- go func() {
- defer wg.Done()
- for j := 0; j < num; j++ {
- sp := tracer.StartSpan(op)
- sp.LogEvent("test event")
- sp.SetTag("foo", "bar")
- sp.SetBaggageItem("boo", "far")
- sp.SetOperationName("x")
- csp := tracer.StartSpan(
- "csp",
- opentracing.ChildOf(sp.Context()))
- csp.Finish()
- defer sp.Finish()
- }
- }()
- }
- wg.Wait()
-}
-
-func TestDisableSpanPool(t *testing.T) {
- var cr CountingRecorder
- tracer, err := NewTracer(
- &cr,
- )
- if err != nil {
- t.Fatalf("Unable to create Tracer: %+v", err)
- }
-
- parent := tracer.StartSpan("parent")
- parent.Finish()
- // This shouldn't panic.
- child := tracer.StartSpan(
- "child",
- opentracing.ChildOf(parent.Context()))
- child.Finish()
-}
diff --git a/vendor/github.com/openzipkin/zipkin-go-opentracing/log-materializers_test.go b/vendor/github.com/openzipkin/zipkin-go-opentracing/log-materializers_test.go
deleted file mode 100644
index 8c779d849..000000000
--- a/vendor/github.com/openzipkin/zipkin-go-opentracing/log-materializers_test.go
+++ /dev/null
@@ -1,74 +0,0 @@
-package zipkintracer
-
-import (
- "errors"
- "testing"
-
- "github.com/opentracing/opentracing-go/log"
-)
-
-type obj struct {
- a int
- b string
-}
-
-func getLogFields() []log.Field {
- lazy := func(fv log.Encoder) {
- fv.EmitString("lazy", "logger")
- }
- return []log.Field{
- log.Bool("bool", true),
- log.String("string", "value"),
- log.Error(errors.New("an error")),
- log.Float32("float32", 32.123),
- log.Float64("float64", 64.123),
- log.Int("int", 42),
- log.Int32("int32", 32),
- log.Int64("int64", 64),
- log.Uint32("uint32", 32),
- log.Uint64("uint64", 64),
- log.Object("object", obj{a: 42, b: "string"}),
- log.Lazy(lazy),
- log.String("event", "EventValue"),
- }
-}
-
-func TestMaterializeWithJSON(t *testing.T) {
- logFields := getLogFields()
- want := `{"bool":"true","error":"an error","event":"EventValue","float32":"32.123001","float64":"64.123000","int":"42","int32":"32","int64":"64","lazy":"logger","object":"{a:42 b:string}","string":"value","uint32":"32","uint64":"64"}`
- have, err := MaterializeWithJSON(logFields)
- if err != nil {
- t.Fatalf("expected json string, got error %+v", err)
- }
- if want != string(have) {
- t.Errorf("want:\n%s\nhave\n%s", want, have)
- }
-}
-
-func TestMaterializeWithLogFmt(t *testing.T) {
- logFields := getLogFields()
- want := `bool=true string=value error="an error" float32=32.123 float64=64.123 int=42 int32=32 int64=64 uint32=32 uint64=64 object="unsupported value type" event=EventValue`
- have, err := MaterializeWithLogFmt(logFields)
- if err != nil {
- t.Fatalf("expected logfmt string, got error %+v", err)
- }
- if want != string(have) {
- t.Errorf("want:\n%s\nhave\n%s", want, have)
- }
-}
-
-func TestStrictZipkinMaterializer(t *testing.T) {
- logFields := getLogFields()
- want := `EventValue`
- have, err := StrictZipkinMaterializer(logFields)
- if err != nil {
- t.Fatalf("expected string got error %+v", err)
- }
- if want != string(have) {
- t.Errorf("want:\n%s\nhave\n%s", want, have)
- }
- logFields = []log.Field{log.String("SomeKey", "SomeValue")}
- if _, err = StrictZipkinMaterializer(logFields); err == nil {
- t.Errorf("expected error: %s, got nil", errEventLogNotFound)
- }
-}
diff --git a/vendor/github.com/openzipkin/zipkin-go-opentracing/propagation_test.go b/vendor/github.com/openzipkin/zipkin-go-opentracing/propagation_test.go
deleted file mode 100644
index 77a3d07b4..000000000
--- a/vendor/github.com/openzipkin/zipkin-go-opentracing/propagation_test.go
+++ /dev/null
@@ -1,171 +0,0 @@
-package zipkintracer_test
-
-import (
- "bytes"
- "net/http"
- "reflect"
- "testing"
- "time"
-
- "github.com/davecgh/go-spew/spew"
- opentracing "github.com/opentracing/opentracing-go"
-
- zipkintracer "github.com/openzipkin/zipkin-go-opentracing"
- "github.com/openzipkin/zipkin-go-opentracing/flag"
- "github.com/openzipkin/zipkin-go-opentracing/types"
-)
-
-type verbatimCarrier struct {
- zipkintracer.SpanContext
- b map[string]string
-}
-
-var _ zipkintracer.DelegatingCarrier = &verbatimCarrier{}
-
-func (vc *verbatimCarrier) SetBaggageItem(k, v string) {
- vc.b[k] = v
-}
-
-func (vc *verbatimCarrier) GetBaggage(f func(string, string)) {
- for k, v := range vc.b {
- f(k, v)
- }
-}
-
-func (vc *verbatimCarrier) SetState(tID types.TraceID, sID uint64, pID *uint64, sampled bool, flags flag.Flags) {
- vc.SpanContext = zipkintracer.SpanContext{
- TraceID: tID,
- SpanID: sID,
- ParentSpanID: pID,
- Sampled: sampled,
- Flags: flags,
- }
-}
-
-func (vc *verbatimCarrier) State() (traceID types.TraceID, spanID uint64, parentSpanID *uint64, sampled bool, flags flag.Flags) {
- return vc.SpanContext.TraceID, vc.SpanContext.SpanID, vc.SpanContext.ParentSpanID, vc.SpanContext.Sampled, vc.SpanContext.Flags
-}
-
-func TestSpanPropagator(t *testing.T) {
- const op = "test"
- recorder := zipkintracer.NewInMemoryRecorder()
- tracer, err := zipkintracer.NewTracer(
- recorder,
- zipkintracer.ClientServerSameSpan(true),
- zipkintracer.DebugMode(true),
- zipkintracer.TraceID128Bit(true),
- )
- if err != nil {
- t.Fatalf("Unable to create Tracer: %+v", err)
- }
-
- // create root span so propagation test will include parentSpanID
- ps := tracer.StartSpan("root")
- defer ps.Finish()
-
- // client side span with parent span 'ps'
- sp := tracer.StartSpan(op, opentracing.ChildOf(ps.Context()))
- sp.SetBaggageItem("foo", "bar")
- tmc := opentracing.HTTPHeadersCarrier(http.Header{})
- tests := []struct {
- typ, carrier interface{}
- }{
- {zipkintracer.Delegator, zipkintracer.DelegatingCarrier(&verbatimCarrier{b: map[string]string{}})},
- {opentracing.Binary, &bytes.Buffer{}},
- {opentracing.HTTPHeaders, tmc},
- {opentracing.TextMap, tmc},
- }
-
- for i, test := range tests {
- if err := tracer.Inject(sp.Context(), test.typ, test.carrier); err != nil {
- t.Fatalf("%d: %v", i, err)
- }
- injectedContext, err := tracer.Extract(test.typ, test.carrier)
- if err != nil {
- t.Fatalf("%d: %v", i, err)
- }
- child := tracer.StartSpan(
- op,
- opentracing.ChildOf(injectedContext))
- child.Finish()
- }
- sp.Finish()
-
- spans := recorder.GetSpans()
- if a, e := len(spans), len(tests)+1; a != e {
- t.Fatalf("expected %d spans, got %d", e, a)
- }
-
- // The last span is the original one.
- exp, spans := spans[len(spans)-1], spans[:len(spans)-1]
- exp.Duration = time.Duration(123)
- exp.Start = time.Time{}.Add(1)
-
- for i, sp := range spans {
- if a, e := *sp.Context.ParentSpanID, exp.Context.SpanID; a != e {
- t.Fatalf("%d: ParentSpanID %d does not match expectation %d", i, a, e)
- } else {
- // Prepare for comparison.
- sp.Context.Flags &= flag.Debug // other flags then Debug should be discarded in comparison
- exp.Context.Flags &= flag.Debug // other flags then Debug should be discarded in comparison
- sp.Context.SpanID, sp.Context.ParentSpanID = exp.Context.SpanID, exp.Context.ParentSpanID
- sp.Duration, sp.Start = exp.Duration, exp.Start
- }
- if a, e := sp.Context.TraceID, exp.Context.TraceID; a != e {
- t.Fatalf("%d: TraceID changed from %d to %d", i, e, a)
- }
- if exp.Context.ParentSpanID == nil {
- t.Fatalf("%d: Expected a ParentSpanID, got nil", i)
- }
- if p, c := sp.Context.ParentSpanID, exp.Context.ParentSpanID; p != c {
- t.Fatalf("%d: ParentSpanID changed from %d to %d", i, p, c)
- }
- if !reflect.DeepEqual(exp, sp) {
- t.Fatalf("%d: wanted %+v, got %+v", i, spew.Sdump(exp), spew.Sdump(sp))
- }
- }
-}
-
-func TestInvalidCarrier(t *testing.T) {
- recorder := zipkintracer.NewInMemoryRecorder()
- tracer, err := zipkintracer.NewTracer(
- recorder,
- zipkintracer.ClientServerSameSpan(true),
- zipkintracer.DebugMode(true),
- zipkintracer.TraceID128Bit(true),
- )
- if err != nil {
- t.Fatalf("Unable to create Tracer: %+v", err)
- }
-
- if _, err = tracer.Extract(zipkintracer.Delegator, "invalid carrier"); err == nil {
- t.Fatalf("Expected: %s, got nil", opentracing.ErrInvalidCarrier)
- }
-}
-
-func TestB3Hex(t *testing.T) {
- recorder := zipkintracer.NewInMemoryRecorder()
- tracer, err := zipkintracer.NewTracer(
- recorder,
- zipkintracer.TraceID128Bit(true),
- )
- if err != nil {
- t.Fatalf("Unable to create Tracer: %+v", err)
- }
-
- for i := 0; i < 1000; i++ {
- headers := http.Header{}
- tmc := opentracing.HTTPHeadersCarrier(headers)
- span := tracer.StartSpan("dummy")
- if err := tracer.Inject(span.Context(), opentracing.TextMap, tmc); err != nil {
- t.Fatalf("Expected nil, got error %+v", err)
- }
- if want1, want2, have := 32, 16, len(headers["X-B3-Traceid"][0]); want1 != have && want2 != have {
- t.Errorf("X-B3-TraceId hex length expected %d or %d, got %d", want1, want2, have)
- }
- if want, have := 16, len(headers["X-B3-Spanid"][0]); want != have {
- t.Errorf("X-B3-SpanId hex length expected %d, got %d", want, have)
- }
- span.Finish()
- }
-}
diff --git a/vendor/github.com/openzipkin/zipkin-go-opentracing/recorder_test.go b/vendor/github.com/openzipkin/zipkin-go-opentracing/recorder_test.go
deleted file mode 100644
index d70b11506..000000000
--- a/vendor/github.com/openzipkin/zipkin-go-opentracing/recorder_test.go
+++ /dev/null
@@ -1,29 +0,0 @@
-package zipkintracer
-
-import (
- "sync/atomic"
- "testing"
- "time"
-
- "github.com/stretchr/testify/assert"
-)
-
-func TestInMemoryRecorderSpans(t *testing.T) {
- recorder := NewInMemoryRecorder()
- var apiRecorder SpanRecorder = recorder
- span := RawSpan{
- Context: SpanContext{},
- Operation: "test-span",
- Start: time.Now(),
- Duration: -1,
- }
- apiRecorder.RecordSpan(span)
- assert.Equal(t, []RawSpan{span}, recorder.GetSpans())
- assert.Equal(t, []RawSpan{}, recorder.GetSampledSpans())
-}
-
-type CountingRecorder int32
-
-func (c *CountingRecorder) RecordSpan(r RawSpan) {
- atomic.AddInt32((*int32)(c), 1)
-}
diff --git a/vendor/github.com/openzipkin/zipkin-go-opentracing/sample_test.go b/vendor/github.com/openzipkin/zipkin-go-opentracing/sample_test.go
deleted file mode 100644
index ec6dd8dbc..000000000
--- a/vendor/github.com/openzipkin/zipkin-go-opentracing/sample_test.go
+++ /dev/null
@@ -1,52 +0,0 @@
-package zipkintracer_test
-
-import (
- "testing"
-
- zipkin "github.com/openzipkin/zipkin-go-opentracing"
-)
-
-func TestBoundarySampler(t *testing.T) {
- type triple struct {
- id uint64
- salt int64
- rate float64
- }
- for input, want := range map[triple]bool{
- {123, 456, 1.0}: true,
- {123, 456, 999}: true,
- {123, 456, 0.0}: false,
- {123, 456, -42}: false,
- {1229998, 0, 0.01}: false,
- {1229999, 0, 0.01}: false,
- {1230000, 0, 0.01}: true,
- {1230001, 0, 0.01}: true,
- {1230098, 0, 0.01}: true,
- {1230099, 0, 0.01}: true,
- {1230100, 0, 0.01}: false,
- {1230101, 0, 0.01}: false,
- {1, 9999999, 0.01}: false,
- {999, 0, 0.99}: true,
- {9999, 0, 0.99}: false,
- } {
- sampler := zipkin.NewBoundarySampler(input.rate, input.salt)
- if have := sampler(input.id); want != have {
- t.Errorf("%#+v: want %v, have %v", input, want, have)
- }
- }
-}
-
-func TestCountingSampler(t *testing.T) {
- for n := 1; n < 100; n++ {
- sampler := zipkin.NewCountingSampler(float64(n) / 100)
- found := 0
- for i := 0; i < 100; i++ {
- if sampler(1) {
- found++
- }
- }
- if found != n {
- t.Errorf("want %d, have %d\n", n, found)
- }
- }
-}
diff --git a/vendor/github.com/openzipkin/zipkin-go-opentracing/span_test.go b/vendor/github.com/openzipkin/zipkin-go-opentracing/span_test.go
deleted file mode 100644
index 5aded2a62..000000000
--- a/vendor/github.com/openzipkin/zipkin-go-opentracing/span_test.go
+++ /dev/null
@@ -1,252 +0,0 @@
-package zipkintracer
-
-import (
- "reflect"
- "strconv"
- "testing"
-
- opentracing "github.com/opentracing/opentracing-go"
- "github.com/opentracing/opentracing-go/ext"
- "github.com/opentracing/opentracing-go/log"
- "github.com/stretchr/testify/assert"
-)
-
-func TestSpan_Baggage(t *testing.T) {
- recorder := NewInMemoryRecorder()
- tracer, err := NewTracer(
- recorder,
- WithSampler(func(_ uint64) bool { return true }),
- WithLogger(&nopLogger{}),
- )
- if err != nil {
- t.Fatalf("Unable to create Tracer: %+v", err)
- }
-
- span := tracer.StartSpan("x")
- span.SetBaggageItem("x", "y")
- assert.Equal(t, "y", span.BaggageItem("x"))
- span.Finish()
- spans := recorder.GetSpans()
- assert.Equal(t, 1, len(spans))
- assert.Equal(t, map[string]string{"x": "y"}, spans[0].Context.Baggage)
-
- recorder.Reset()
- span = tracer.StartSpan("x")
- span.SetBaggageItem("x", "y")
- baggage := make(map[string]string)
- span.Context().ForeachBaggageItem(func(k, v string) bool {
- baggage[k] = v
- return true
- })
- assert.Equal(t, map[string]string{"x": "y"}, baggage)
-
- span.SetBaggageItem("a", "b")
- baggage = make(map[string]string)
- span.Context().ForeachBaggageItem(func(k, v string) bool {
- baggage[k] = v
- return false // exit early
- })
- assert.Equal(t, 1, len(baggage))
- span.Finish()
- spans = recorder.GetSpans()
- assert.Equal(t, 1, len(spans))
- assert.Equal(t, 2, len(spans[0].Context.Baggage))
-}
-
-func TestSpan_Sampling(t *testing.T) {
- recorder := NewInMemoryRecorder()
- tracer, err := NewTracer(
- recorder,
- WithSampler(func(_ uint64) bool { return true }),
- )
- if err != nil {
- t.Fatalf("Unable to create Tracer: %+v", err)
- }
-
- span := tracer.StartSpan("x")
- span.Finish()
- assert.Equal(t, 1, len(recorder.GetSampledSpans()), "by default span should be sampled")
-
- recorder.Reset()
- span = tracer.StartSpan("x")
- ext.SamplingPriority.Set(span, 0)
- span.Finish()
- assert.Equal(t, 0, len(recorder.GetSampledSpans()), "SamplingPriority=0 should turn off sampling")
-
- tracer, err = NewTracer(
- recorder,
- WithSampler(func(_ uint64) bool { return false }),
- )
- if err != nil {
- t.Fatalf("Unable to create Tracer: %+v", err)
- }
-
- recorder.Reset()
- span = tracer.StartSpan("x")
- span.Finish()
- assert.Equal(t, 0, len(recorder.GetSampledSpans()), "by default span should not be sampled")
-
- recorder.Reset()
- span = tracer.StartSpan("x")
- ext.SamplingPriority.Set(span, 1)
- span.Finish()
- assert.Equal(t, 1, len(recorder.GetSampledSpans()), "SamplingPriority=1 should turn on sampling")
-}
-
-func TestSpan_SingleLoggedTaggedSpan(t *testing.T) {
- recorder := NewInMemoryRecorder()
- tracer, err := NewTracer(
- recorder,
- WithSampler(func(_ uint64) bool { return true }),
- )
- if err != nil {
- t.Fatalf("Unable to create Tracer: %+v", err)
- }
-
- span := tracer.StartSpan("x")
- span.LogEventWithPayload("event", "payload")
- span.LogFields(log.String("key_str", "value"), log.Uint32("32bit", 4294967295))
- span.SetTag("tag", "value")
- span.Finish()
- spans := recorder.GetSpans()
- assert.Equal(t, 1, len(spans))
- assert.Equal(t, "x", spans[0].Operation)
- assert.Equal(t, 2, len(spans[0].Logs))
- assert.Equal(t, opentracing.Tags{"tag": "value"}, spans[0].Tags)
- fv := NewLogFieldValidator(t, spans[0].Logs[0].Fields)
- fv.
- ExpectNextFieldEquals("event", reflect.String, "event").
- ExpectNextFieldEquals("payload", reflect.Interface, "payload")
- fv = NewLogFieldValidator(t, spans[0].Logs[1].Fields)
- fv.
- ExpectNextFieldEquals("key_str", reflect.String, "value").
- ExpectNextFieldEquals("32bit", reflect.Uint32, "4294967295")
-}
-
-func TestSpan_TrimUnsampledSpans(t *testing.T) {
- recorder := NewInMemoryRecorder()
- // Tracer that trims only unsampled but always samples
- tracer, err := NewTracer(
- recorder,
- WithSampler(func(_ uint64) bool { return true }),
- TrimUnsampledSpans(true),
- )
- if err != nil {
- t.Fatalf("Unable to create Tracer: %+v", err)
- }
-
- span := tracer.StartSpan("x")
- span.LogFields(log.String("key_str", "value"), log.Uint32("32bit", 4294967295))
- span.SetTag("tag", "value")
- span.Finish()
- spans := recorder.GetSpans()
- assert.Equal(t, 1, len(spans))
- assert.Equal(t, 1, len(spans[0].Logs))
- assert.Equal(t, opentracing.Tags{"tag": "value"}, spans[0].Tags)
- fv := NewLogFieldValidator(t, spans[0].Logs[0].Fields)
- fv.
- ExpectNextFieldEquals("key_str", reflect.String, "value").
- ExpectNextFieldEquals("32bit", reflect.Uint32, "4294967295")
-
- recorder.Reset()
- // Tracer that trims only unsampled and never samples
- tracer, err = NewTracer(
- recorder,
- WithSampler(func(_ uint64) bool { return false }),
- TrimUnsampledSpans(true),
- )
- if err != nil {
- t.Fatalf("Unable to create Tracer: %+v", err)
- }
-
- span = tracer.StartSpan("x")
- span.LogFields(log.String("key_str", "value"), log.Uint32("32bit", 4294967295))
- span.SetTag("tag", "value")
- span.Finish()
- spans = recorder.GetSpans()
- assert.Equal(t, 1, len(spans))
- assert.Equal(t, 0, len(spans[0].Logs))
- assert.Equal(t, 0, len(spans[0].Tags))
-}
-
-func TestSpan_DropAllLogs(t *testing.T) {
- recorder := NewInMemoryRecorder()
- // Tracer that drops logs
- tracer, err := NewTracer(
- recorder,
- WithSampler(func(_ uint64) bool { return true }),
- DropAllLogs(true),
- )
- if err != nil {
- t.Fatalf("Unable to create Tracer: %+v", err)
- }
-
- span := tracer.StartSpan("x")
- span.LogFields(log.String("key_str", "value"), log.Uint32("32bit", 4294967295))
- span.SetTag("tag", "value")
- span.Finish()
- spans := recorder.GetSpans()
- assert.Equal(t, 1, len(spans))
- assert.Equal(t, "x", spans[0].Operation)
- assert.Equal(t, opentracing.Tags{"tag": "value"}, spans[0].Tags)
- // Only logs are dropped
- assert.Equal(t, 0, len(spans[0].Logs))
-}
-
-func TestSpan_MaxLogSperSpan(t *testing.T) {
- for _, limit := range []int{5, 10, 15, 20, 30, 40, 50} {
- for _, numLogs := range []int{5, 10, 15, 20, 30, 40, 50, 60, 70, 80} {
- recorder := NewInMemoryRecorder()
- // Tracer that only retains the last <limit> logs.
- tracer, err := NewTracer(
- recorder,
- WithSampler(func(_ uint64) bool { return true }),
- WithMaxLogsPerSpan(limit),
- )
- if err != nil {
- t.Fatalf("Unable to create Tracer: %+v", err)
- }
-
- span := tracer.StartSpan("x")
- for i := 0; i < numLogs; i++ {
- span.LogKV("eventIdx", i)
- }
- span.Finish()
-
- spans := recorder.GetSpans()
- assert.Equal(t, 1, len(spans))
- assert.Equal(t, "x", spans[0].Operation)
-
- logs := spans[0].Logs
- var firstLogs, lastLogs []opentracing.LogRecord
- if numLogs <= limit {
- assert.Equal(t, numLogs, len(logs))
- firstLogs = logs
- } else {
- assert.Equal(t, limit, len(logs))
- if len(logs) > 0 {
- numOld := (len(logs) - 1) / 2
- firstLogs = logs[:numOld]
- lastLogs = logs[numOld+1:]
-
- fv := NewLogFieldValidator(t, logs[numOld].Fields)
- fv = fv.ExpectNextFieldEquals("event", reflect.String, "dropped Span logs")
- fv = fv.ExpectNextFieldEquals(
- "dropped_log_count", reflect.Int, strconv.Itoa(numLogs-limit+1),
- )
- fv.ExpectNextFieldEquals("component", reflect.String, "zipkintracer")
- }
- }
-
- for i, lr := range firstLogs {
- fv := NewLogFieldValidator(t, lr.Fields)
- fv.ExpectNextFieldEquals("eventIdx", reflect.Int, strconv.Itoa(i))
- }
-
- for i, lr := range lastLogs {
- fv := NewLogFieldValidator(t, lr.Fields)
- fv.ExpectNextFieldEquals("eventIdx", reflect.Int, strconv.Itoa(numLogs-len(lastLogs)+i))
- }
- }
- }
-}
diff --git a/vendor/github.com/openzipkin/zipkin-go-opentracing/testutil_test.go b/vendor/github.com/openzipkin/zipkin-go-opentracing/testutil_test.go
deleted file mode 100644
index c1e7c3c74..000000000
--- a/vendor/github.com/openzipkin/zipkin-go-opentracing/testutil_test.go
+++ /dev/null
@@ -1,125 +0,0 @@
-package zipkintracer
-
-import (
- "fmt"
- "reflect"
- "runtime"
- "testing"
-
- "github.com/opentracing/opentracing-go/log"
-)
-
-// LogFieldValidator facilitates testing of Span.Log*() implementations.
-//
-// Usage:
-//
-// fv := log.NewLogFieldValidator(t, someLogStructure.Fields)
-// fv.
-// ExpectNextFieldEquals("key1", reflect.String, "some string value").
-// ExpectNextFieldEquals("key2", reflect.Uint32, "4294967295")
-//
-// LogFieldValidator satisfies the log.Encoder interface and thus is able to
-// marshal log.Field instances (which it takes advantage of internally).
-type LogFieldValidator struct {
- t *testing.T
- fieldIdx int
- fields []log.Field
- nextKey string
- nextKind reflect.Kind
- nextValAsString string
-}
-
-// NewLogFieldValidator returns a new validator that will test the contents of
-// `fields`.
-func NewLogFieldValidator(t *testing.T, fields []log.Field) *LogFieldValidator {
- return &LogFieldValidator{
- t: t,
- fields: fields,
- }
-}
-
-// ExpectNextFieldEquals facilitates a fluent way of testing the contents
-// []Field slices.
-func (fv *LogFieldValidator) ExpectNextFieldEquals(key string, kind reflect.Kind, valAsString string) *LogFieldValidator {
- if len(fv.fields) < fv.fieldIdx {
- _, file, line, _ := runtime.Caller(1)
- fv.t.Errorf("%s:%d Expecting more than the %v Fields we have", file, line, len(fv.fields))
- }
- fv.nextKey = key
- fv.nextKind = kind
- fv.nextValAsString = valAsString
- fv.fields[fv.fieldIdx].Marshal(fv)
- fv.fieldIdx++
- return fv
-}
-
-// EmitString satisfies the Encoder interface
-func (fv *LogFieldValidator) EmitString(key, value string) {
- fv.validateNextField(key, reflect.String, value)
-}
-
-// EmitBool satisfies the Encoder interface
-func (fv *LogFieldValidator) EmitBool(key string, value bool) {
- fv.validateNextField(key, reflect.Bool, value)
-}
-
-// EmitInt satisfies the Encoder interface
-func (fv *LogFieldValidator) EmitInt(key string, value int) {
- fv.validateNextField(key, reflect.Int, value)
-}
-
-// EmitInt32 satisfies the Encoder interface
-func (fv *LogFieldValidator) EmitInt32(key string, value int32) {
- fv.validateNextField(key, reflect.Int32, value)
-}
-
-// EmitInt64 satisfies the Encoder interface
-func (fv *LogFieldValidator) EmitInt64(key string, value int64) {
- fv.validateNextField(key, reflect.Int64, value)
-}
-
-// EmitUint32 satisfies the Encoder interface
-func (fv *LogFieldValidator) EmitUint32(key string, value uint32) {
- fv.validateNextField(key, reflect.Uint32, value)
-}
-
-// EmitUint64 satisfies the Encoder interface
-func (fv *LogFieldValidator) EmitUint64(key string, value uint64) {
- fv.validateNextField(key, reflect.Uint64, value)
-}
-
-// EmitFloat32 satisfies the Encoder interface
-func (fv *LogFieldValidator) EmitFloat32(key string, value float32) {
- fv.validateNextField(key, reflect.Float32, value)
-}
-
-// EmitFloat64 satisfies the Encoder interface
-func (fv *LogFieldValidator) EmitFloat64(key string, value float64) {
- fv.validateNextField(key, reflect.Float64, value)
-}
-
-// EmitObject satisfies the Encoder interface
-func (fv *LogFieldValidator) EmitObject(key string, value interface{}) {
- fv.validateNextField(key, reflect.Interface, value)
-}
-
-// EmitLazyLogger satisfies the Encoder interface
-func (fv *LogFieldValidator) EmitLazyLogger(value log.LazyLogger) {
- fv.t.Error("Test infrastructure does not support EmitLazyLogger yet")
-}
-
-func (fv *LogFieldValidator) validateNextField(key string, actualKind reflect.Kind, value interface{}) {
- // Reference the ExpectNextField caller in error messages.
- _, file, line, _ := runtime.Caller(4)
- if fv.nextKey != key {
- fv.t.Errorf("%s:%d Bad key: expected %q, found %q", file, line, fv.nextKey, key)
- }
- if fv.nextKind != actualKind {
- fv.t.Errorf("%s:%d Bad reflect.Kind: expected %v, found %v", file, line, fv.nextKind, actualKind)
- return
- }
- if fv.nextValAsString != fmt.Sprint(value) {
- fv.t.Errorf("%s:%d Bad value: expected %q, found %q", file, line, fv.nextValAsString, fmt.Sprint(value))
- }
- // All good.
-}
diff --git a/vendor/github.com/openzipkin/zipkin-go-opentracing/types/traceid_test.go b/vendor/github.com/openzipkin/zipkin-go-opentracing/types/traceid_test.go
deleted file mode 100644
index 6d7c2306e..000000000
--- a/vendor/github.com/openzipkin/zipkin-go-opentracing/types/traceid_test.go
+++ /dev/null
@@ -1,13 +0,0 @@
-package types
-
-import "testing"
-
-func TestTraceID(t *testing.T) {
-
- traceID := TraceID{High: 1, Low: 2}
-
- if len(traceID.ToHex()) != 32 {
- t.Errorf("Expected zero-padded TraceID to have 32 characters")
- }
-
-}
diff --git a/vendor/github.com/openzipkin/zipkin-go-opentracing/wire/carrier_test.go b/vendor/github.com/openzipkin/zipkin-go-opentracing/wire/carrier_test.go
deleted file mode 100644
index 4bb922d6c..000000000
--- a/vendor/github.com/openzipkin/zipkin-go-opentracing/wire/carrier_test.go
+++ /dev/null
@@ -1,50 +0,0 @@
-package wire_test
-
-import (
- "testing"
-
- "github.com/openzipkin/zipkin-go-opentracing"
- "github.com/openzipkin/zipkin-go-opentracing/flag"
- "github.com/openzipkin/zipkin-go-opentracing/types"
- "github.com/openzipkin/zipkin-go-opentracing/wire"
-)
-
-func TestProtobufCarrier(t *testing.T) {
- var carrier zipkintracer.DelegatingCarrier = &wire.ProtobufCarrier{}
-
- traceID := types.TraceID{High: 1, Low: 2}
- var spanID, parentSpanID uint64 = 3, 0
- sampled := true
- flags := flag.Debug | flag.Sampled | flag.SamplingSet
- baggageKey, expVal := "key1", "val1"
-
- carrier.SetState(traceID, spanID, &parentSpanID, sampled, flags)
- carrier.SetBaggageItem(baggageKey, expVal)
- gotTraceID, gotSpanID, gotParentSpanId, gotSampled, gotFlags := carrier.State()
-
- if gotParentSpanId == nil {
- t.Errorf("Expected a valid parentSpanID of 0 got nil (no parent)")
- }
-
- if gotFlags&flag.IsRoot == flag.IsRoot {
- t.Errorf("Expected a child span with a valid parent span with id 0 got IsRoot flag")
- }
-
- if traceID != gotTraceID || spanID != gotSpanID || parentSpanID != *gotParentSpanId || sampled != gotSampled || flags != gotFlags {
- t.Errorf("Wanted state %d %d %d %t %d, got %d %d %d %t %d", spanID, traceID, parentSpanID, sampled, flags, gotTraceID, gotSpanID, *gotParentSpanId, gotSampled, gotFlags)
- }
-
- gotBaggage := map[string]string{}
- f := func(k, v string) {
- gotBaggage[k] = v
- }
-
- carrier.GetBaggage(f)
- value, ok := gotBaggage[baggageKey]
- if !ok {
- t.Errorf("Expected baggage item %s to exist", baggageKey)
- }
- if value != expVal {
- t.Errorf("Expected key %s to be %s, got %s", baggageKey, expVal, value)
- }
-}
diff --git a/vendor/github.com/petar/GoLLRB/llrb/iterator_test.go b/vendor/github.com/petar/GoLLRB/llrb/iterator_test.go
deleted file mode 100644
index db5e12c92..000000000
--- a/vendor/github.com/petar/GoLLRB/llrb/iterator_test.go
+++ /dev/null
@@ -1,76 +0,0 @@
-package llrb
-
-import (
- "reflect"
- "testing"
-)
-
-func TestAscendGreaterOrEqual(t *testing.T) {
- tree := New()
- tree.InsertNoReplace(Int(4))
- tree.InsertNoReplace(Int(6))
- tree.InsertNoReplace(Int(1))
- tree.InsertNoReplace(Int(3))
- var ary []Item
- tree.AscendGreaterOrEqual(Int(-1), func(i Item) bool {
- ary = append(ary, i)
- return true
- })
- expected := []Item{Int(1), Int(3), Int(4), Int(6)}
- if !reflect.DeepEqual(ary, expected) {
- t.Errorf("expected %v but got %v", expected, ary)
- }
- ary = nil
- tree.AscendGreaterOrEqual(Int(3), func(i Item) bool {
- ary = append(ary, i)
- return true
- })
- expected = []Item{Int(3), Int(4), Int(6)}
- if !reflect.DeepEqual(ary, expected) {
- t.Errorf("expected %v but got %v", expected, ary)
- }
- ary = nil
- tree.AscendGreaterOrEqual(Int(2), func(i Item) bool {
- ary = append(ary, i)
- return true
- })
- expected = []Item{Int(3), Int(4), Int(6)}
- if !reflect.DeepEqual(ary, expected) {
- t.Errorf("expected %v but got %v", expected, ary)
- }
-}
-
-func TestDescendLessOrEqual(t *testing.T) {
- tree := New()
- tree.InsertNoReplace(Int(4))
- tree.InsertNoReplace(Int(6))
- tree.InsertNoReplace(Int(1))
- tree.InsertNoReplace(Int(3))
- var ary []Item
- tree.DescendLessOrEqual(Int(10), func(i Item) bool {
- ary = append(ary, i)
- return true
- })
- expected := []Item{Int(6), Int(4), Int(3), Int(1)}
- if !reflect.DeepEqual(ary, expected) {
- t.Errorf("expected %v but got %v", expected, ary)
- }
- ary = nil
- tree.DescendLessOrEqual(Int(4), func(i Item) bool {
- ary = append(ary, i)
- return true
- })
- expected = []Item{Int(4), Int(3), Int(1)}
- if !reflect.DeepEqual(ary, expected) {
- t.Errorf("expected %v but got %v", expected, ary)
- }
- ary = nil
- tree.DescendLessOrEqual(Int(5), func(i Item) bool {
- ary = append(ary, i)
- return true
- })
- expected = []Item{Int(4), Int(3), Int(1)}
- if !reflect.DeepEqual(ary, expected) {
- t.Errorf("expected %v but got %v", expected, ary)
- }
-}
diff --git a/vendor/github.com/petar/GoLLRB/llrb/llrb_test.go b/vendor/github.com/petar/GoLLRB/llrb/llrb_test.go
deleted file mode 100644
index b7bc97800..000000000
--- a/vendor/github.com/petar/GoLLRB/llrb/llrb_test.go
+++ /dev/null
@@ -1,239 +0,0 @@
-// Copyright 2010 Petar Maymounkov. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package llrb
-
-import (
- "math"
- "math/rand"
- "testing"
-)
-
-func TestCases(t *testing.T) {
- tree := New()
- tree.ReplaceOrInsert(Int(1))
- tree.ReplaceOrInsert(Int(1))
- if tree.Len() != 1 {
- t.Errorf("expecting len 1")
- }
- if !tree.Has(Int(1)) {
- t.Errorf("expecting to find key=1")
- }
-
- tree.Delete(Int(1))
- if tree.Len() != 0 {
- t.Errorf("expecting len 0")
- }
- if tree.Has(Int(1)) {
- t.Errorf("not expecting to find key=1")
- }
-
- tree.Delete(Int(1))
- if tree.Len() != 0 {
- t.Errorf("expecting len 0")
- }
- if tree.Has(Int(1)) {
- t.Errorf("not expecting to find key=1")
- }
-}
-
-func TestReverseInsertOrder(t *testing.T) {
- tree := New()
- n := 100
- for i := 0; i < n; i++ {
- tree.ReplaceOrInsert(Int(n - i))
- }
- i := 0
- tree.AscendGreaterOrEqual(Int(0), func(item Item) bool {
- i++
- if item.(Int) != Int(i) {
- t.Errorf("bad order: got %d, expect %d", item.(Int), i)
- }
- return true
- })
-}
-
-func TestRange(t *testing.T) {
- tree := New()
- order := []String{
- "ab", "aba", "abc", "a", "aa", "aaa", "b", "a-", "a!",
- }
- for _, i := range order {
- tree.ReplaceOrInsert(i)
- }
- k := 0
- tree.AscendRange(String("ab"), String("ac"), func(item Item) bool {
- if k > 3 {
- t.Fatalf("returned more items than expected")
- }
- i1 := order[k]
- i2 := item.(String)
- if i1 != i2 {
- t.Errorf("expecting %s, got %s", i1, i2)
- }
- k++
- return true
- })
-}
-
-func TestRandomInsertOrder(t *testing.T) {
- tree := New()
- n := 1000
- perm := rand.Perm(n)
- for i := 0; i < n; i++ {
- tree.ReplaceOrInsert(Int(perm[i]))
- }
- j := 0
- tree.AscendGreaterOrEqual(Int(0), func(item Item) bool {
- if item.(Int) != Int(j) {
- t.Fatalf("bad order")
- }
- j++
- return true
- })
-}
-
-func TestRandomReplace(t *testing.T) {
- tree := New()
- n := 100
- perm := rand.Perm(n)
- for i := 0; i < n; i++ {
- tree.ReplaceOrInsert(Int(perm[i]))
- }
- perm = rand.Perm(n)
- for i := 0; i < n; i++ {
- if replaced := tree.ReplaceOrInsert(Int(perm[i])); replaced == nil || replaced.(Int) != Int(perm[i]) {
- t.Errorf("error replacing")
- }
- }
-}
-
-func TestRandomInsertSequentialDelete(t *testing.T) {
- tree := New()
- n := 1000
- perm := rand.Perm(n)
- for i := 0; i < n; i++ {
- tree.ReplaceOrInsert(Int(perm[i]))
- }
- for i := 0; i < n; i++ {
- tree.Delete(Int(i))
- }
-}
-
-func TestRandomInsertDeleteNonExistent(t *testing.T) {
- tree := New()
- n := 100
- perm := rand.Perm(n)
- for i := 0; i < n; i++ {
- tree.ReplaceOrInsert(Int(perm[i]))
- }
- if tree.Delete(Int(200)) != nil {
- t.Errorf("deleted non-existent item")
- }
- if tree.Delete(Int(-2)) != nil {
- t.Errorf("deleted non-existent item")
- }
- for i := 0; i < n; i++ {
- if u := tree.Delete(Int(i)); u == nil || u.(Int) != Int(i) {
- t.Errorf("delete failed")
- }
- }
- if tree.Delete(Int(200)) != nil {
- t.Errorf("deleted non-existent item")
- }
- if tree.Delete(Int(-2)) != nil {
- t.Errorf("deleted non-existent item")
- }
-}
-
-func TestRandomInsertPartialDeleteOrder(t *testing.T) {
- tree := New()
- n := 100
- perm := rand.Perm(n)
- for i := 0; i < n; i++ {
- tree.ReplaceOrInsert(Int(perm[i]))
- }
- for i := 1; i < n-1; i++ {
- tree.Delete(Int(i))
- }
- j := 0
- tree.AscendGreaterOrEqual(Int(0), func(item Item) bool {
- switch j {
- case 0:
- if item.(Int) != Int(0) {
- t.Errorf("expecting 0")
- }
- case 1:
- if item.(Int) != Int(n-1) {
- t.Errorf("expecting %d", n-1)
- }
- }
- j++
- return true
- })
-}
-
-func TestRandomInsertStats(t *testing.T) {
- tree := New()
- n := 100000
- perm := rand.Perm(n)
- for i := 0; i < n; i++ {
- tree.ReplaceOrInsert(Int(perm[i]))
- }
- avg, _ := tree.HeightStats()
- expAvg := math.Log2(float64(n)) - 1.5
- if math.Abs(avg-expAvg) >= 2.0 {
- t.Errorf("too much deviation from expected average height")
- }
-}
-
-func BenchmarkInsert(b *testing.B) {
- tree := New()
- for i := 0; i < b.N; i++ {
- tree.ReplaceOrInsert(Int(b.N - i))
- }
-}
-
-func BenchmarkDelete(b *testing.B) {
- b.StopTimer()
- tree := New()
- for i := 0; i < b.N; i++ {
- tree.ReplaceOrInsert(Int(b.N - i))
- }
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- tree.Delete(Int(i))
- }
-}
-
-func BenchmarkDeleteMin(b *testing.B) {
- b.StopTimer()
- tree := New()
- for i := 0; i < b.N; i++ {
- tree.ReplaceOrInsert(Int(b.N - i))
- }
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- tree.DeleteMin()
- }
-}
-
-func TestInsertNoReplace(t *testing.T) {
- tree := New()
- n := 1000
- for q := 0; q < 2; q++ {
- perm := rand.Perm(n)
- for i := 0; i < n; i++ {
- tree.InsertNoReplace(Int(perm[i]))
- }
- }
- j := 0
- tree.AscendGreaterOrEqual(Int(0), func(item Item) bool {
- if item.(Int) != Int(j/2) {
- t.Fatalf("bad order")
- }
- j++
- return true
- })
-}
diff --git a/vendor/github.com/peterbourgon/diskv/basic_test.go b/vendor/github.com/peterbourgon/diskv/basic_test.go
deleted file mode 100644
index 0ef0b17fe..000000000
--- a/vendor/github.com/peterbourgon/diskv/basic_test.go
+++ /dev/null
@@ -1,336 +0,0 @@
-package diskv
-
-import (
- "bytes"
- "errors"
- "testing"
- "time"
-)
-
-func cmpBytes(a, b []byte) bool {
- if len(a) != len(b) {
- return false
- }
- for i := 0; i < len(a); i++ {
- if a[i] != b[i] {
- return false
- }
- }
- return true
-}
-
-func (d *Diskv) isCached(key string) bool {
- d.mu.RLock()
- defer d.mu.RUnlock()
- _, ok := d.cache[key]
- return ok
-}
-
-func TestWriteReadErase(t *testing.T) {
- d := New(Options{
- BasePath: "test-data",
- CacheSizeMax: 1024,
- })
- defer d.EraseAll()
- k, v := "a", []byte{'b'}
- if err := d.Write(k, v); err != nil {
- t.Fatalf("write: %s", err)
- }
- if readVal, err := d.Read(k); err != nil {
- t.Fatalf("read: %s", err)
- } else if bytes.Compare(v, readVal) != 0 {
- t.Fatalf("read: expected %s, got %s", v, readVal)
- }
- if err := d.Erase(k); err != nil {
- t.Fatalf("erase: %s", err)
- }
-}
-
-func TestWRECache(t *testing.T) {
- d := New(Options{
- BasePath: "test-data",
- CacheSizeMax: 1024,
- })
- defer d.EraseAll()
- k, v := "xxx", []byte{' ', ' ', ' '}
- if d.isCached(k) {
- t.Fatalf("key cached before Write and Read")
- }
- if err := d.Write(k, v); err != nil {
- t.Fatalf("write: %s", err)
- }
- if d.isCached(k) {
- t.Fatalf("key cached before Read")
- }
- if readVal, err := d.Read(k); err != nil {
- t.Fatalf("read: %s", err)
- } else if bytes.Compare(v, readVal) != 0 {
- t.Fatalf("read: expected %s, got %s", v, readVal)
- }
- for i := 0; i < 10 && !d.isCached(k); i++ {
- time.Sleep(10 * time.Millisecond)
- }
- if !d.isCached(k) {
- t.Fatalf("key not cached after Read")
- }
- if err := d.Erase(k); err != nil {
- t.Fatalf("erase: %s", err)
- }
- if d.isCached(k) {
- t.Fatalf("key cached after Erase")
- }
-}
-
-func TestStrings(t *testing.T) {
- d := New(Options{
- BasePath: "test-data",
- CacheSizeMax: 1024,
- })
- defer d.EraseAll()
-
- keys := map[string]bool{"a": false, "b": false, "c": false, "d": false}
- v := []byte{'1'}
- for k := range keys {
- if err := d.Write(k, v); err != nil {
- t.Fatalf("write: %s: %s", k, err)
- }
- }
-
- for k := range d.Keys(nil) {
- if _, present := keys[k]; present {
- t.Logf("got: %s", k)
- keys[k] = true
- } else {
- t.Fatalf("strings() returns unknown key: %s", k)
- }
- }
-
- for k, found := range keys {
- if !found {
- t.Errorf("never got %s", k)
- }
- }
-}
-
-func TestZeroByteCache(t *testing.T) {
- d := New(Options{
- BasePath: "test-data",
- CacheSizeMax: 0,
- })
- defer d.EraseAll()
-
- k, v := "a", []byte{'1', '2', '3'}
- if err := d.Write(k, v); err != nil {
- t.Fatalf("Write: %s", err)
- }
-
- if d.isCached(k) {
- t.Fatalf("key cached, expected not-cached")
- }
-
- if _, err := d.Read(k); err != nil {
- t.Fatalf("Read: %s", err)
- }
-
- if d.isCached(k) {
- t.Fatalf("key cached, expected not-cached")
- }
-}
-
-func TestOneByteCache(t *testing.T) {
- d := New(Options{
- BasePath: "test-data",
- CacheSizeMax: 1,
- })
- defer d.EraseAll()
-
- k1, k2, v1, v2 := "a", "b", []byte{'1'}, []byte{'1', '2'}
- if err := d.Write(k1, v1); err != nil {
- t.Fatal(err)
- }
-
- if v, err := d.Read(k1); err != nil {
- t.Fatal(err)
- } else if !cmpBytes(v, v1) {
- t.Fatalf("Read: expected %s, got %s", string(v1), string(v))
- }
-
- for i := 0; i < 10 && !d.isCached(k1); i++ {
- time.Sleep(10 * time.Millisecond)
- }
- if !d.isCached(k1) {
- t.Fatalf("expected 1-byte value to be cached, but it wasn't")
- }
-
- if err := d.Write(k2, v2); err != nil {
- t.Fatal(err)
- }
- if _, err := d.Read(k2); err != nil {
- t.Fatalf("--> %s", err)
- }
-
- for i := 0; i < 10 && (!d.isCached(k1) || d.isCached(k2)); i++ {
- time.Sleep(10 * time.Millisecond) // just wait for lazy-cache
- }
- if !d.isCached(k1) {
- t.Fatalf("1-byte value was uncached for no reason")
- }
-
- if d.isCached(k2) {
- t.Fatalf("2-byte value was cached, but cache max size is 1")
- }
-}
-
-func TestStaleCache(t *testing.T) {
- d := New(Options{
- BasePath: "test-data",
- CacheSizeMax: 1,
- })
- defer d.EraseAll()
-
- k, first, second := "a", "first", "second"
- if err := d.Write(k, []byte(first)); err != nil {
- t.Fatal(err)
- }
-
- v, err := d.Read(k)
- if err != nil {
- t.Fatal(err)
- }
- if string(v) != first {
- t.Errorf("expected '%s', got '%s'", first, v)
- }
-
- if err := d.Write(k, []byte(second)); err != nil {
- t.Fatal(err)
- }
-
- v, err = d.Read(k)
- if err != nil {
- t.Fatal(err)
- }
-
- if string(v) != second {
- t.Errorf("expected '%s', got '%s'", second, v)
- }
-}
-
-func TestHas(t *testing.T) {
- d := New(Options{
- BasePath: "test-data",
- CacheSizeMax: 1024,
- })
- defer d.EraseAll()
-
- for k, v := range map[string]string{
- "a": "1",
- "foo": "2",
- "012345": "3",
- } {
- d.Write(k, []byte(v))
- }
-
- d.Read("foo") // cache one of them
- if !d.isCached("foo") {
- t.Errorf("'foo' didn't get cached")
- }
-
- for _, tuple := range []struct {
- key string
- expected bool
- }{
- {"a", true},
- {"b", false},
- {"foo", true},
- {"bar", false},
- {"01234", false},
- {"012345", true},
- {"0123456", false},
- } {
- if expected, got := tuple.expected, d.Has(tuple.key); expected != got {
- t.Errorf("Has(%s): expected %v, got %v", tuple.key, expected, got)
- }
- }
-}
-
-type BrokenReader struct{}
-
-func (BrokenReader) Read(p []byte) (n int, err error) {
- return 0, errors.New("failed to read")
-}
-
-func TestRemovesIncompleteFiles(t *testing.T) {
- opts := Options{
- BasePath: "test-data",
- CacheSizeMax: 1024,
- }
- d := New(opts)
- defer d.EraseAll()
-
- key, stream, sync := "key", BrokenReader{}, false
-
- if err := d.WriteStream(key, stream, sync); err == nil {
- t.Fatalf("Expected i/o copy error, none received.")
- }
-
- if _, err := d.Read(key); err == nil {
- t.Fatal("Could read the key, but it shouldn't exist")
- }
-}
-
-func TestTempDir(t *testing.T) {
- opts := Options{
- BasePath: "test-data",
- TempDir: "test-data-temp",
- CacheSizeMax: 1024,
- }
- d := New(opts)
- defer d.EraseAll()
-
- k, v := "a", []byte{'b'}
- if err := d.Write(k, v); err != nil {
- t.Fatalf("write: %s", err)
- }
- if readVal, err := d.Read(k); err != nil {
- t.Fatalf("read: %s", err)
- } else if bytes.Compare(v, readVal) != 0 {
- t.Fatalf("read: expected %s, got %s", v, readVal)
- }
- if err := d.Erase(k); err != nil {
- t.Fatalf("erase: %s", err)
- }
-}
-
-type CrashingReader struct{}
-
-func (CrashingReader) Read(p []byte) (n int, err error) {
- panic("System has crashed while reading the stream")
-}
-
-func TestAtomicWrite(t *testing.T) {
- opts := Options{
- BasePath: "test-data",
- // Test would fail if TempDir is not set here.
- TempDir: "test-data-temp",
- CacheSizeMax: 1024,
- }
- d := New(opts)
- defer d.EraseAll()
-
- key := "key"
- func() {
- defer func() {
- recover() // Ignore panicking error
- }()
-
- stream := CrashingReader{}
- d.WriteStream(key, stream, false)
- }()
-
- if d.Has(key) {
- t.Fatal("Has key, but it shouldn't exist")
- }
- if _, ok := <-d.Keys(nil); ok {
- t.Fatal("Store isn't empty")
- }
-}
diff --git a/vendor/github.com/peterbourgon/diskv/compression_test.go b/vendor/github.com/peterbourgon/diskv/compression_test.go
deleted file mode 100644
index 2d6142037..000000000
--- a/vendor/github.com/peterbourgon/diskv/compression_test.go
+++ /dev/null
@@ -1,72 +0,0 @@
-package diskv
-
-import (
- "compress/flate"
- "fmt"
- "math/rand"
- "os"
- "testing"
- "time"
-)
-
-func init() {
- rand.Seed(time.Now().UnixNano())
-}
-
-func testCompressionWith(t *testing.T, c Compression, name string) {
- d := New(Options{
- BasePath: "compression-test",
- CacheSizeMax: 0,
- Compression: c,
- })
- defer d.EraseAll()
-
- sz := 4096
- val := make([]byte, sz)
- for i := 0; i < sz; i++ {
- val[i] = byte('a' + rand.Intn(26)) // {a-z}; should compress some
- }
-
- key := "a"
- if err := d.Write(key, val); err != nil {
- t.Fatalf("write failed: %s", err)
- }
-
- targetFile := fmt.Sprintf("%s%c%s", d.BasePath, os.PathSeparator, key)
- fi, err := os.Stat(targetFile)
- if err != nil {
- t.Fatalf("%s: %s", targetFile, err)
- }
-
- if fi.Size() >= int64(sz) {
- t.Fatalf("%s: size=%d, expected smaller", targetFile, fi.Size())
- }
- t.Logf("%s compressed %d to %d", name, sz, fi.Size())
-
- readVal, err := d.Read(key)
- if len(readVal) != sz {
- t.Fatalf("read: expected size=%d, got size=%d", sz, len(readVal))
- }
-
- for i := 0; i < sz; i++ {
- if readVal[i] != val[i] {
- t.Fatalf("i=%d: expected %v, got %v", i, val[i], readVal[i])
- }
- }
-}
-
-func TestGzipDefault(t *testing.T) {
- testCompressionWith(t, NewGzipCompression(), "gzip")
-}
-
-func TestGzipBestCompression(t *testing.T) {
- testCompressionWith(t, NewGzipCompressionLevel(flate.BestCompression), "gzip-max")
-}
-
-func TestGzipBestSpeed(t *testing.T) {
- testCompressionWith(t, NewGzipCompressionLevel(flate.BestSpeed), "gzip-min")
-}
-
-func TestZlib(t *testing.T) {
- testCompressionWith(t, NewZlibCompression(), "zlib")
-}
diff --git a/vendor/github.com/peterbourgon/diskv/import_test.go b/vendor/github.com/peterbourgon/diskv/import_test.go
deleted file mode 100644
index a08ac7c70..000000000
--- a/vendor/github.com/peterbourgon/diskv/import_test.go
+++ /dev/null
@@ -1,76 +0,0 @@
-package diskv_test
-
-import (
- "bytes"
- "io/ioutil"
- "os"
-
- "github.com/peterbourgon/diskv"
-
- "testing"
-)
-
-func TestImportMove(t *testing.T) {
- b := []byte(`0123456789`)
- f, err := ioutil.TempFile("", "temp-test")
- if err != nil {
- t.Fatal(err)
- }
- if _, err := f.Write(b); err != nil {
- t.Fatal(err)
- }
- f.Close()
-
- d := diskv.New(diskv.Options{
- BasePath: "test-import-move",
- })
- defer d.EraseAll()
-
- key := "key"
-
- if err := d.Write(key, []byte(`TBD`)); err != nil {
- t.Fatal(err)
- }
-
- if err := d.Import(f.Name(), key, true); err != nil {
- t.Fatal(err)
- }
-
- if _, err := os.Stat(f.Name()); err == nil || !os.IsNotExist(err) {
- t.Errorf("expected temp file to be gone, but err = %v", err)
- }
-
- if !d.Has(key) {
- t.Errorf("%q not present", key)
- }
-
- if buf, err := d.Read(key); err != nil || bytes.Compare(b, buf) != 0 {
- t.Errorf("want %q, have %q (err = %v)", string(b), string(buf), err)
- }
-}
-
-func TestImportCopy(t *testing.T) {
- b := []byte(`¡åéîòü!`)
-
- f, err := ioutil.TempFile("", "temp-test")
- if err != nil {
- t.Fatal(err)
- }
- if _, err := f.Write(b); err != nil {
- t.Fatal(err)
- }
- f.Close()
-
- d := diskv.New(diskv.Options{
- BasePath: "test-import-copy",
- })
- defer d.EraseAll()
-
- if err := d.Import(f.Name(), "key", false); err != nil {
- t.Fatal(err)
- }
-
- if _, err := os.Stat(f.Name()); err != nil {
- t.Errorf("expected temp file to remain, but got err = %v", err)
- }
-}
diff --git a/vendor/github.com/peterbourgon/diskv/index_test.go b/vendor/github.com/peterbourgon/diskv/index_test.go
deleted file mode 100644
index 72f52a9ff..000000000
--- a/vendor/github.com/peterbourgon/diskv/index_test.go
+++ /dev/null
@@ -1,148 +0,0 @@
-package diskv
-
-import (
- "bytes"
- "reflect"
- "testing"
- "time"
-)
-
-func strLess(a, b string) bool { return a < b }
-
-func cmpStrings(a, b []string) bool {
- if len(a) != len(b) {
- return false
- }
- for i := 0; i < len(a); i++ {
- if a[i] != b[i] {
- return false
- }
- }
- return true
-}
-
-func (d *Diskv) isIndexed(key string) bool {
- if d.Index == nil {
- return false
- }
-
- for _, got := range d.Index.Keys("", 1000) {
- if got == key {
- return true
- }
- }
- return false
-}
-
-func TestIndexOrder(t *testing.T) {
- d := New(Options{
- BasePath: "index-test",
- Transform: func(string) []string { return []string{} },
- CacheSizeMax: 1024,
- Index: &BTreeIndex{},
- IndexLess: strLess,
- })
- defer d.EraseAll()
-
- v := []byte{'1', '2', '3'}
- d.Write("a", v)
- if !d.isIndexed("a") {
- t.Fatalf("'a' not indexed after write")
- }
- d.Write("1", v)
- d.Write("m", v)
- d.Write("-", v)
- d.Write("A", v)
-
- expectedKeys := []string{"-", "1", "A", "a", "m"}
- keys := []string{}
- for _, key := range d.Index.Keys("", 100) {
- keys = append(keys, key)
- }
-
- if !cmpStrings(keys, expectedKeys) {
- t.Fatalf("got %s, expected %s", keys, expectedKeys)
- }
-}
-
-func TestIndexLoad(t *testing.T) {
- d1 := New(Options{
- BasePath: "index-test",
- Transform: func(string) []string { return []string{} },
- CacheSizeMax: 1024,
- })
- defer d1.EraseAll()
-
- val := []byte{'1', '2', '3'}
- keys := []string{"a", "b", "c", "d", "e", "f", "g"}
- for _, key := range keys {
- d1.Write(key, val)
- }
-
- d2 := New(Options{
- BasePath: "index-test",
- Transform: func(string) []string { return []string{} },
- CacheSizeMax: 1024,
- Index: &BTreeIndex{},
- IndexLess: strLess,
- })
- defer d2.EraseAll()
-
- // check d2 has properly loaded existing d1 data
- for _, key := range keys {
- if !d2.isIndexed(key) {
- t.Fatalf("key '%s' not indexed on secondary", key)
- }
- }
-
- // cache one
- if readValue, err := d2.Read(keys[0]); err != nil {
- t.Fatalf("%s", err)
- } else if bytes.Compare(val, readValue) != 0 {
- t.Fatalf("%s: got %s, expected %s", keys[0], readValue, val)
- }
-
- // make sure it got cached
- for i := 0; i < 10 && !d2.isCached(keys[0]); i++ {
- time.Sleep(10 * time.Millisecond)
- }
- if !d2.isCached(keys[0]) {
- t.Fatalf("key '%s' not cached", keys[0])
- }
-
- // kill the disk
- d1.EraseAll()
-
- // cached value should still be there in the second
- if readValue, err := d2.Read(keys[0]); err != nil {
- t.Fatalf("%s", err)
- } else if bytes.Compare(val, readValue) != 0 {
- t.Fatalf("%s: got %s, expected %s", keys[0], readValue, val)
- }
-
- // but not in the original
- if _, err := d1.Read(keys[0]); err == nil {
- t.Fatalf("expected error reading from flushed store")
- }
-}
-
-func TestIndexKeysEmptyFrom(t *testing.T) {
- d := New(Options{
- BasePath: "index-test",
- Transform: func(string) []string { return []string{} },
- CacheSizeMax: 1024,
- Index: &BTreeIndex{},
- IndexLess: strLess,
- })
- defer d.EraseAll()
-
- for _, k := range []string{"a", "c", "z", "b", "x", "b", "y"} {
- d.Write(k, []byte("1"))
- }
-
- want := []string{"a", "b", "c", "x", "y", "z"}
- have := d.Index.Keys("", 99)
- if !reflect.DeepEqual(want, have) {
- t.Errorf("want %v, have %v", want, have)
- }
-}
diff --git a/vendor/github.com/peterbourgon/diskv/issues_test.go b/vendor/github.com/peterbourgon/diskv/issues_test.go
deleted file mode 100644
index 0b0b10908..000000000
--- a/vendor/github.com/peterbourgon/diskv/issues_test.go
+++ /dev/null
@@ -1,121 +0,0 @@
-package diskv
-
-import (
- "bytes"
- "io/ioutil"
- "sync"
- "testing"
- "time"
-)
-
-// ReadStream from cache shouldn't panic on a nil dereference from a nonexistent
-// Compression :)
-func TestIssue2A(t *testing.T) {
- d := New(Options{
- BasePath: "test-issue-2a",
- Transform: func(string) []string { return []string{} },
- CacheSizeMax: 1024,
- })
- defer d.EraseAll()
-
- input := "abcdefghijklmnopqrstuvwxy"
- key, writeBuf, sync := "a", bytes.NewBufferString(input), false
- if err := d.WriteStream(key, writeBuf, sync); err != nil {
- t.Fatal(err)
- }
-
- for i := 0; i < 2; i++ {
- began := time.Now()
- rc, err := d.ReadStream(key, false)
- if err != nil {
- t.Fatal(err)
- }
- buf, err := ioutil.ReadAll(rc)
- if err != nil {
- t.Fatal(err)
- }
- if !cmpBytes(buf, []byte(input)) {
- t.Fatalf("read #%d: '%s' != '%s'", i+1, string(buf), input)
- }
- rc.Close()
- t.Logf("read #%d in %s", i+1, time.Since(began))
- }
-}
-
-// ReadStream on a key that resolves to a directory should return an error.
-func TestIssue2B(t *testing.T) {
- blockTransform := func(s string) []string {
- transformBlockSize := 3
- sliceSize := len(s) / transformBlockSize
- pathSlice := make([]string, sliceSize)
- for i := 0; i < sliceSize; i++ {
- from, to := i*transformBlockSize, (i*transformBlockSize)+transformBlockSize
- pathSlice[i] = s[from:to]
- }
- return pathSlice
- }
-
- d := New(Options{
- BasePath: "test-issue-2b",
- Transform: blockTransform,
- CacheSizeMax: 0,
- })
- defer d.EraseAll()
-
- v := []byte{'1', '2', '3'}
- if err := d.Write("abcabc", v); err != nil {
- t.Fatal(err)
- }
-
- _, err := d.ReadStream("abc", false)
- if err == nil {
- t.Fatal("ReadStream('abc') should return error")
- }
- t.Logf("ReadStream('abc') returned error: %v", err)
-}
-
-// Ensure ReadStream with direct=true isn't racy.
-func TestIssue17(t *testing.T) {
- var (
- basePath = "test-data"
- )
-
- dWrite := New(Options{
- BasePath: basePath,
- CacheSizeMax: 0,
- })
- defer dWrite.EraseAll()
-
- dRead := New(Options{
- BasePath: basePath,
- CacheSizeMax: 50,
- })
-
- cases := map[string]string{
- "a": `1234567890`,
- "b": `2345678901`,
- "c": `3456789012`,
- "d": `4567890123`,
- "e": `5678901234`,
- }
-
- for k, v := range cases {
- if err := dWrite.Write(k, []byte(v)); err != nil {
- t.Fatalf("during write: %s", err)
- }
- dRead.Read(k) // ensure it's added to cache
- }
-
- var wg sync.WaitGroup
- start := make(chan struct{})
- for k, v := range cases {
- wg.Add(1)
- go func(k, v string) {
- <-start
- dRead.ReadStream(k, true)
- wg.Done()
- }(k, v)
- }
- close(start)
- wg.Wait()
-}
diff --git a/vendor/github.com/peterbourgon/diskv/keys_test.go b/vendor/github.com/peterbourgon/diskv/keys_test.go
deleted file mode 100644
index 222e1c444..000000000
--- a/vendor/github.com/peterbourgon/diskv/keys_test.go
+++ /dev/null
@@ -1,231 +0,0 @@
-package diskv_test
-
-import (
- "reflect"
- "runtime"
- "strings"
- "testing"
-
- "github.com/peterbourgon/diskv"
-)
-
-var (
- keysTestData = map[string]string{
- "ab01cd01": "When we started building CoreOS",
- "ab01cd02": "we looked at all the various components available to us",
- "ab01cd03": "re-using the best tools",
- "ef01gh04": "and building the ones that did not exist",
- "ef02gh05": "We believe strongly in the Unix philosophy",
- "xxxxxxxx": "tools should be independently useful",
- }
-
- prefixes = []string{
- "", // all
- "a",
- "ab",
- "ab0",
- "ab01",
- "ab01cd0",
- "ab01cd01",
- "ab01cd01x", // none
- "b", // none
- "b0", // none
- "0", // none
- "01", // none
- "e",
- "ef",
- "efx", // none
- "ef01gh0",
- "ef01gh04",
- "ef01gh05",
- "ef01gh06", // none
- }
-)
-
-func TestKeysFlat(t *testing.T) {
- transform := func(s string) []string {
- if s == "" {
- t.Fatalf(`transform should not be called with ""`)
- }
- return []string{}
- }
- d := diskv.New(diskv.Options{
- BasePath: "test-data",
- Transform: transform,
- })
- defer d.EraseAll()
-
- for k, v := range keysTestData {
- d.Write(k, []byte(v))
- }
-
- checkKeys(t, d.Keys(nil), keysTestData)
-}
-
-func TestKeysNested(t *testing.T) {
- d := diskv.New(diskv.Options{
- BasePath: "test-data",
- Transform: blockTransform(2),
- })
- defer d.EraseAll()
-
- for k, v := range keysTestData {
- d.Write(k, []byte(v))
- }
-
- checkKeys(t, d.Keys(nil), keysTestData)
-}
-
-func TestKeysPrefixFlat(t *testing.T) {
- d := diskv.New(diskv.Options{
- BasePath: "test-data",
- })
- defer d.EraseAll()
-
- for k, v := range keysTestData {
- d.Write(k, []byte(v))
- }
-
- for _, prefix := range prefixes {
- checkKeys(t, d.KeysPrefix(prefix, nil), filterPrefix(keysTestData, prefix))
- }
-}
-
-func TestKeysPrefixNested(t *testing.T) {
- d := diskv.New(diskv.Options{
- BasePath: "test-data",
- Transform: blockTransform(2),
- })
- defer d.EraseAll()
-
- for k, v := range keysTestData {
- d.Write(k, []byte(v))
- }
-
- for _, prefix := range prefixes {
- checkKeys(t, d.KeysPrefix(prefix, nil), filterPrefix(keysTestData, prefix))
- }
-}
-
-func TestKeysCancel(t *testing.T) {
- d := diskv.New(diskv.Options{
- BasePath: "test-data",
- })
- defer d.EraseAll()
-
- for k, v := range keysTestData {
- d.Write(k, []byte(v))
- }
-
- var (
- cancel = make(chan struct{})
- received = 0
- cancelAfter = len(keysTestData) / 2
- )
-
- for key := range d.Keys(cancel) {
- received++
-
- if received >= cancelAfter {
- close(cancel)
- runtime.Gosched() // allow walker to detect cancel
- }
-
- t.Logf("received %d: %q", received, key)
- }
-
- if want, have := cancelAfter, received; want != have {
- t.Errorf("want %d, have %d")
- }
-}
-
-func checkKeys(t *testing.T, c <-chan string, want map[string]string) {
- for k := range c {
- if _, ok := want[k]; !ok {
- t.Errorf("%q yielded but not expected", k)
- continue
- }
-
- delete(want, k)
- t.Logf("%q yielded OK", k)
- }
-
- if len(want) != 0 {
- t.Errorf("%d expected key(s) not yielded: %s", len(want), strings.Join(flattenKeys(want), ", "))
- }
-}
-
-func blockTransform(blockSize int) func(string) []string {
- return func(s string) []string {
- var (
- sliceSize = len(s) / blockSize
- pathSlice = make([]string, sliceSize)
- )
- for i := 0; i < sliceSize; i++ {
- from, to := i*blockSize, (i*blockSize)+blockSize
- pathSlice[i] = s[from:to]
- }
- return pathSlice
- }
-}
-
-func filterPrefix(in map[string]string, prefix string) map[string]string {
- out := map[string]string{}
- for k, v := range in {
- if strings.HasPrefix(k, prefix) {
- out[k] = v
- }
- }
- return out
-}
-
-func TestFilterPrefix(t *testing.T) {
- input := map[string]string{
- "all": "",
- "and": "",
- "at": "",
- "available": "",
- "best": "",
- "building": "",
- "components": "",
- "coreos": "",
- "did": "",
- "exist": "",
- "looked": "",
- "not": "",
- "ones": "",
- "re-using": "",
- "started": "",
- "that": "",
- "the": "",
- "to": "",
- "tools": "",
- "us": "",
- "various": "",
- "we": "",
- "when": "",
- }
-
- for prefix, want := range map[string]map[string]string{
- "a": map[string]string{"all": "", "and": "", "at": "", "available": ""},
- "al": map[string]string{"all": ""},
- "all": map[string]string{"all": ""},
- "alll": map[string]string{},
- "c": map[string]string{"components": "", "coreos": ""},
- "co": map[string]string{"components": "", "coreos": ""},
- "com": map[string]string{"components": ""},
- } {
- have := filterPrefix(input, prefix)
- if !reflect.DeepEqual(want, have) {
- t.Errorf("%q: want %v, have %v", prefix, flattenKeys(want), flattenKeys(have))
- }
- }
-}
-
-func flattenKeys(m map[string]string) []string {
- a := make([]string, 0, len(m))
- for k := range m {
- a = append(a, k)
- }
- return a
-}
diff --git a/vendor/github.com/peterbourgon/diskv/speed_test.go b/vendor/github.com/peterbourgon/diskv/speed_test.go
deleted file mode 100644
index 67d05ff27..000000000
--- a/vendor/github.com/peterbourgon/diskv/speed_test.go
+++ /dev/null
@@ -1,153 +0,0 @@
-package diskv
-
-import (
- "fmt"
- "math/rand"
- "testing"
-)
-
-func shuffle(keys []string) {
- ints := rand.Perm(len(keys))
- for i := range keys {
- keys[i], keys[ints[i]] = keys[ints[i]], keys[i]
- }
-}
-
-func genValue(size int) []byte {
- v := make([]byte, size)
- for i := 0; i < size; i++ {
- v[i] = uint8((rand.Int() % 26) + 97) // a-z
- }
- return v
-}
-
-const (
- keyCount = 1000
-)
-
-func genKeys() []string {
- keys := make([]string, keyCount)
- for i := 0; i < keyCount; i++ {
- keys[i] = fmt.Sprintf("%d", i)
- }
- return keys
-}
-
-func (d *Diskv) load(keys []string, val []byte) {
- for _, key := range keys {
- d.Write(key, val)
- }
-}
-
-func benchRead(b *testing.B, size, cachesz int) {
- b.StopTimer()
- d := New(Options{
- BasePath: "speed-test",
- Transform: func(string) []string { return []string{} },
- CacheSizeMax: uint64(cachesz),
- })
- defer d.EraseAll()
-
- keys := genKeys()
- value := genValue(size)
- d.load(keys, value)
- shuffle(keys)
- b.SetBytes(int64(size))
-
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- _, _ = d.Read(keys[i%len(keys)])
- }
- b.StopTimer()
-}
-
-func benchWrite(b *testing.B, size int, withIndex bool) {
- b.StopTimer()
-
- options := Options{
- BasePath: "speed-test",
- Transform: func(string) []string { return []string{} },
- CacheSizeMax: 0,
- }
- if withIndex {
- options.Index = &BTreeIndex{}
- options.IndexLess = strLess
- }
-
- d := New(options)
- defer d.EraseAll()
- keys := genKeys()
- value := genValue(size)
- shuffle(keys)
- b.SetBytes(int64(size))
-
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- d.Write(keys[i%len(keys)], value)
- }
- b.StopTimer()
-}
-
-func BenchmarkWrite__32B_NoIndex(b *testing.B) {
- benchWrite(b, 32, false)
-}
-
-func BenchmarkWrite__1KB_NoIndex(b *testing.B) {
- benchWrite(b, 1024, false)
-}
-
-func BenchmarkWrite__4KB_NoIndex(b *testing.B) {
- benchWrite(b, 4096, false)
-}
-
-func BenchmarkWrite_10KB_NoIndex(b *testing.B) {
- benchWrite(b, 10240, false)
-}
-
-func BenchmarkWrite__32B_WithIndex(b *testing.B) {
- benchWrite(b, 32, true)
-}
-
-func BenchmarkWrite__1KB_WithIndex(b *testing.B) {
- benchWrite(b, 1024, true)
-}
-
-func BenchmarkWrite__4KB_WithIndex(b *testing.B) {
- benchWrite(b, 4096, true)
-}
-
-func BenchmarkWrite_10KB_WithIndex(b *testing.B) {
- benchWrite(b, 10240, true)
-}
-
-func BenchmarkRead__32B_NoCache(b *testing.B) {
- benchRead(b, 32, 0)
-}
-
-func BenchmarkRead__1KB_NoCache(b *testing.B) {
- benchRead(b, 1024, 0)
-}
-
-func BenchmarkRead__4KB_NoCache(b *testing.B) {
- benchRead(b, 4096, 0)
-}
-
-func BenchmarkRead_10KB_NoCache(b *testing.B) {
- benchRead(b, 10240, 0)
-}
-
-func BenchmarkRead__32B_WithCache(b *testing.B) {
- benchRead(b, 32, keyCount*32*2)
-}
-
-func BenchmarkRead__1KB_WithCache(b *testing.B) {
- benchRead(b, 1024, keyCount*1024*2)
-}
-
-func BenchmarkRead__4KB_WithCache(b *testing.B) {
- benchRead(b, 4096, keyCount*4096*2)
-}
-
-func BenchmarkRead_10KB_WithCache(b *testing.B) {
- benchRead(b, 10240, keyCount*4096*2)
-}
diff --git a/vendor/github.com/peterbourgon/diskv/stream_test.go b/vendor/github.com/peterbourgon/diskv/stream_test.go
deleted file mode 100644
index 7991dbff2..000000000
--- a/vendor/github.com/peterbourgon/diskv/stream_test.go
+++ /dev/null
@@ -1,117 +0,0 @@
-package diskv
-
-import (
- "bytes"
- "io/ioutil"
- "testing"
-)
-
-func TestBasicStreamCaching(t *testing.T) {
- d := New(Options{
- BasePath: "test-data",
- CacheSizeMax: 1024,
- })
- defer d.EraseAll()
-
- input := "a1b2c3"
- key, writeBuf, sync := "a", bytes.NewBufferString(input), true
- if err := d.WriteStream(key, writeBuf, sync); err != nil {
- t.Fatal(err)
- }
-
- if d.isCached(key) {
- t.Fatalf("'%s' cached, but shouldn't be (yet)", key)
- }
-
- rc, err := d.ReadStream(key, false)
- if err != nil {
- t.Fatal(err)
- }
-
- readBuf, err := ioutil.ReadAll(rc)
- if err != nil {
- t.Fatal(err)
- }
-
- if !cmpBytes(readBuf, []byte(input)) {
- t.Fatalf("'%s' != '%s'", string(readBuf), input)
- }
-
- if !d.isCached(key) {
- t.Fatalf("'%s' isn't cached, but should be", key)
- }
-}
-
-func TestReadStreamDirect(t *testing.T) {
- var (
- basePath = "test-data"
- )
- dWrite := New(Options{
- BasePath: basePath,
- CacheSizeMax: 0,
- })
- defer dWrite.EraseAll()
- dRead := New(Options{
- BasePath: basePath,
- CacheSizeMax: 1024,
- })
-
- // Write
- key, val1, val2 := "a", []byte(`1234567890`), []byte(`aaaaaaaaaa`)
- if err := dWrite.Write(key, val1); err != nil {
- t.Fatalf("during first write: %s", err)
- }
-
- // First, caching read.
- val, err := dRead.Read(key)
- if err != nil {
- t.Fatalf("during initial read: %s", err)
- }
- t.Logf("read 1: %s => %s", key, string(val))
- if !cmpBytes(val1, val) {
- t.Errorf("expected %q, got %q", string(val1), string(val))
- }
- if !dRead.isCached(key) {
- t.Errorf("%q should be cached, but isn't", key)
- }
-
- // Write a different value.
- if err := dWrite.Write(key, val2); err != nil {
- t.Fatalf("during second write: %s", err)
- }
-
- // Second read, should hit cache and get the old value.
- val, err = dRead.Read(key)
- if err != nil {
- t.Fatalf("during second (cache-hit) read: %s", err)
- }
- t.Logf("read 2: %s => %s", key, string(val))
- if !cmpBytes(val1, val) {
- t.Errorf("expected %q, got %q", string(val1), string(val))
- }
-
- // Third, direct read, should get the updated value.
- rc, err := dRead.ReadStream(key, true)
- if err != nil {
- t.Fatalf("during third (direct) read, ReadStream: %s", err)
- }
- defer rc.Close()
- val, err = ioutil.ReadAll(rc)
- if err != nil {
- t.Fatalf("during third (direct) read, ReadAll: %s", err)
- }
- t.Logf("read 3: %s => %s", key, string(val))
- if !cmpBytes(val2, val) {
- t.Errorf("expected %q, got %q", string(val1), string(val))
- }
-
- // Fourth read, should hit cache and get the new value.
- val, err = dRead.Read(key)
- if err != nil {
- t.Fatalf("during fourth (cache-hit) read: %s", err)
- }
- t.Logf("read 4: %s => %s", key, string(val))
- if !cmpBytes(val2, val) {
- t.Errorf("expected %q, got %q", string(val1), string(val))
- }
-}
diff --git a/vendor/github.com/pierrec/lz4/bench_test.go b/vendor/github.com/pierrec/lz4/bench_test.go
deleted file mode 100644
index 72f1eaaef..000000000
--- a/vendor/github.com/pierrec/lz4/bench_test.go
+++ /dev/null
@@ -1,119 +0,0 @@
-package lz4_test
-
-import (
- "bytes"
- "io"
- "io/ioutil"
- "testing"
-
- "github.com/pierrec/lz4"
-)
-
-func BenchmarkCompress(b *testing.B) {
- var hashTable [1 << 16]int
- buf := make([]byte, len(pg1661))
-
- b.ReportAllocs()
- b.ResetTimer()
-
- for i := 0; i < b.N; i++ {
- lz4.CompressBlock(pg1661, buf, hashTable[:])
- }
-}
-
-func BenchmarkCompressHC(b *testing.B) {
- buf := make([]byte, len(pg1661))
-
- b.ReportAllocs()
- b.ResetTimer()
-
- for i := 0; i < b.N; i++ {
- lz4.CompressBlockHC(pg1661, buf, 16)
- }
-}
-
-func BenchmarkUncompress(b *testing.B) {
- buf := make([]byte, len(pg1661))
-
- b.ReportAllocs()
- b.ResetTimer()
-
- for i := 0; i < b.N; i++ {
- lz4.UncompressBlock(pg1661LZ4, buf)
- }
-}
-
-func mustLoadFile(f string) []byte {
- b, err := ioutil.ReadFile(f)
- if err != nil {
- panic(err)
- }
- return b
-}
-
-var (
- pg1661 = mustLoadFile("testdata/pg1661.txt")
- digits = mustLoadFile("testdata/e.txt")
- twain = mustLoadFile("testdata/Mark.Twain-Tom.Sawyer.txt")
- random = mustLoadFile("testdata/random.data")
- pg1661LZ4 = mustLoadFile("testdata/pg1661.txt.lz4")
- digitsLZ4 = mustLoadFile("testdata/e.txt.lz4")
- twainLZ4 = mustLoadFile("testdata/Mark.Twain-Tom.Sawyer.txt.lz4")
- randomLZ4 = mustLoadFile("testdata/random.data.lz4")
-)
-
-func benchmarkUncompress(b *testing.B, compressed []byte) {
- r := bytes.NewReader(compressed)
- zr := lz4.NewReader(r)
-
- // Determine the uncompressed size of testfile.
- uncompressedSize, err := io.Copy(ioutil.Discard, zr)
- if err != nil {
- b.Fatal(err)
- }
-
- b.SetBytes(uncompressedSize)
- b.ReportAllocs()
- b.ResetTimer()
-
- for i := 0; i < b.N; i++ {
- r.Reset(compressed)
- zr.Reset(r)
- io.Copy(ioutil.Discard, zr)
- }
-}
-
-func BenchmarkUncompressPg1661(b *testing.B) { benchmarkUncompress(b, pg1661LZ4) }
-func BenchmarkUncompressDigits(b *testing.B) { benchmarkUncompress(b, digitsLZ4) }
-func BenchmarkUncompressTwain(b *testing.B) { benchmarkUncompress(b, twainLZ4) }
-func BenchmarkUncompressRand(b *testing.B) { benchmarkUncompress(b, randomLZ4) }
-
-func benchmarkCompress(b *testing.B, uncompressed []byte) {
- w := bytes.NewBuffer(nil)
- zw := lz4.NewWriter(w)
- r := bytes.NewReader(uncompressed)
-
- // Determine the compressed size of testfile.
- compressedSize, err := io.Copy(zw, r)
- if err != nil {
- b.Fatal(err)
- }
- if err := zw.Close(); err != nil {
- b.Fatal(err)
- }
-
- b.SetBytes(compressedSize)
- b.ReportAllocs()
- b.ResetTimer()
-
- for i := 0; i < b.N; i++ {
- r.Reset(uncompressed)
- zw.Reset(w)
- io.Copy(zw, r)
- }
-}
-
-func BenchmarkCompressPg1661(b *testing.B) { benchmarkCompress(b, pg1661) }
-func BenchmarkCompressDigits(b *testing.B) { benchmarkCompress(b, digits) }
-func BenchmarkCompressTwain(b *testing.B) { benchmarkCompress(b, twain) }
-func BenchmarkCompressRand(b *testing.B) { benchmarkCompress(b, random) }
diff --git a/vendor/github.com/pierrec/lz4/block_test.go b/vendor/github.com/pierrec/lz4/block_test.go
deleted file mode 100644
index 312160bb5..000000000
--- a/vendor/github.com/pierrec/lz4/block_test.go
+++ /dev/null
@@ -1,98 +0,0 @@
-//+build go1.9
-
-package lz4_test
-
-import (
- "fmt"
- "io/ioutil"
- "reflect"
- "testing"
-
- "github.com/pierrec/lz4"
-)
-
-type testcase struct {
- file string
- compressible bool
- src []byte
-}
-
-var rawFiles = []testcase{
- // {"testdata/207326ba-36f8-11e7-954a-aca46ba8ca73.png", true, nil},
- {"testdata/e.txt", true, nil},
- {"testdata/gettysburg.txt", true, nil},
- {"testdata/Mark.Twain-Tom.Sawyer.txt", true, nil},
- {"testdata/pg1661.txt", true, nil},
- {"testdata/pi.txt", true, nil},
- {"testdata/random.data", false, nil},
- {"testdata/repeat.txt", true, nil},
-}
-
-func TestCompressUncompressBlock(t *testing.T) {
- type compressor func(s, d []byte) (int, error)
-
- run := func(tc testcase, compress compressor) int {
- t.Helper()
- src := tc.src
-
- // Compress the data.
- zbuf := make([]byte, lz4.CompressBlockBound(len(src)))
- n, err := compress(src, zbuf)
- if err != nil {
- t.Error(err)
- return 0
- }
- zbuf = zbuf[:n]
-
- // Make sure that it was actually compressed unless not compressible.
- if !tc.compressible {
- return 0
- }
-
- if n == 0 || n >= len(src) {
- t.Errorf("data not compressed: %d/%d", n, len(src))
- return 0
- }
-
- // Uncompress the data.
- buf := make([]byte, len(src))
- n, err = lz4.UncompressBlock(zbuf, buf)
- if err != nil {
- t.Fatal(err)
- }
- buf = buf[:n]
- if !reflect.DeepEqual(src, buf) {
- t.Error("uncompressed compressed data not matching initial input")
- return 0
- }
-
- return len(zbuf)
- }
-
- for _, tc := range rawFiles {
- src, err := ioutil.ReadFile(tc.file)
- if err != nil {
- t.Fatal(err)
- }
- tc.src = src
-
- var n, nhc int
- t.Run("", func(t *testing.T) {
- tc := tc
- t.Run(tc.file, func(t *testing.T) {
- t.Parallel()
- n = run(tc, func(src, dst []byte) (int, error) {
- var ht [1 << 16]int
- return lz4.CompressBlock(src, dst, ht[:])
- })
- })
- t.Run(fmt.Sprintf("%s HC", tc.file), func(t *testing.T) {
- t.Parallel()
- nhc = run(tc, func(src, dst []byte) (int, error) {
- return lz4.CompressBlockHC(src, dst, -1)
- })
- })
- })
- fmt.Printf("%-40s: %8d / %8d / %8d\n", tc.file, n, nhc, len(src))
- }
-}
diff --git a/vendor/github.com/pierrec/lz4/export_test.go b/vendor/github.com/pierrec/lz4/export_test.go
deleted file mode 100644
index 3052506d1..000000000
--- a/vendor/github.com/pierrec/lz4/export_test.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// Expose some internals for testing purposes
-package lz4
-
-// expose the possible block max sizes
-var BlockMaxSizeItems []int
-
-func init() {
- for s := range bsMapValue {
- BlockMaxSizeItems = append(BlockMaxSizeItems, s)
- }
-}
-
-var FrameSkipMagic = frameSkipMagic
diff --git a/vendor/github.com/pierrec/lz4/internal/xxh32/xxh32zero_test.go b/vendor/github.com/pierrec/lz4/internal/xxh32/xxh32zero_test.go
deleted file mode 100644
index afec7ab1e..000000000
--- a/vendor/github.com/pierrec/lz4/internal/xxh32/xxh32zero_test.go
+++ /dev/null
@@ -1,161 +0,0 @@
-package xxh32_test
-
-import (
- "encoding/binary"
- "hash/crc32"
- "hash/fnv"
- "testing"
-
- "github.com/pierrec/lz4/internal/xxh32"
-)
-
-type test struct {
- sum uint32
- data, printable string
-}
-
-var testdata = []test{
- // {0x02cc5d05, "", ""},
- // {0x550d7456, "a", ""},
- // {0x4999fc53, "ab", ""},
- // {0x32d153ff, "abc", ""},
- // {0xa3643705, "abcd", ""},
- // {0x9738f19b, "abcde", ""},
- // {0x8b7cd587, "abcdef", ""},
- // {0x9dd093b3, "abcdefg", ""},
- // {0x0bb3c6bb, "abcdefgh", ""},
- // {0xd03c13fd, "abcdefghi", ""},
- // {0x8b988cfe, "abcdefghij", ""},
- {0x9d2d8b62, "abcdefghijklmnop", ""},
- // {0x42ae804d, "abcdefghijklmnopqrstuvwxyz0123456789", ""},
- // {0x62b4ed00, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", ""},
-}
-
-func init() {
- for i := range testdata {
- d := &testdata[i]
- if len(d.data) > 20 {
- d.printable = d.data[:20]
- } else {
- d.printable = d.data
- }
- }
-}
-
-func TestZeroBlockSize(t *testing.T) {
- var xxh xxh32.XXHZero
- if s := xxh.BlockSize(); s <= 0 {
- t.Errorf("invalid BlockSize: %d", s)
- }
-}
-
-func TestZeroSize(t *testing.T) {
- var xxh xxh32.XXHZero
- if s := xxh.Size(); s != 4 {
- t.Errorf("invalid Size: got %d expected 4", s)
- }
-}
-
-func TestZeroData(t *testing.T) {
- for i, td := range testdata {
- var xxh xxh32.XXHZero
- data := []byte(td.data)
- xxh.Write(data)
- if h := xxh.Sum32(); h != td.sum {
- t.Errorf("test %d: xxh32(%s)=0x%x expected 0x%x", i, td.printable, h, td.sum)
- t.FailNow()
- }
- if h := xxh32.ChecksumZero(data); h != td.sum {
- t.Errorf("test %d: xxh32(%s)=0x%x expected 0x%x", i, td.printable, h, td.sum)
- t.FailNow()
- }
- }
-}
-
-func TestZeroSplitData(t *testing.T) {
- for i, td := range testdata {
- var xxh xxh32.XXHZero
- data := []byte(td.data)
- l := len(data) / 2
- xxh.Write(data[0:l])
- xxh.Write(data[l:])
- h := xxh.Sum32()
- if h != td.sum {
- t.Errorf("test %d: xxh32(%s)=0x%x expected 0x%x", i, td.printable, h, td.sum)
- t.FailNow()
- }
- }
-}
-
-func TestZeroSum(t *testing.T) {
- for i, td := range testdata {
- var xxh xxh32.XXHZero
- data := []byte(td.data)
- xxh.Write(data)
- b := xxh.Sum(data)
- if h := binary.LittleEndian.Uint32(b[len(data):]); h != td.sum {
- t.Errorf("test %d: xxh32(%s)=0x%x expected 0x%x", i, td.printable, h, td.sum)
- t.FailNow()
- }
- }
-}
-
-func TestZeroChecksum(t *testing.T) {
- for i, td := range testdata {
- data := []byte(td.data)
- h := xxh32.ChecksumZero(data)
- if h != td.sum {
- t.Errorf("test %d: xxh32(%s)=0x%x expected 0x%x", i, td.printable, h, td.sum)
- t.FailNow()
- }
- }
-}
-
-func TestZeroReset(t *testing.T) {
- var xxh xxh32.XXHZero
- for i, td := range testdata {
- xxh.Write([]byte(td.data))
- h := xxh.Sum32()
- if h != td.sum {
- t.Errorf("test %d: xxh32(%s)=0x%x expected 0x%x", i, td.data[:40], h, td.sum)
- t.FailNow()
- }
- xxh.Reset()
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Benchmarks
-//
-var testdata1 = []byte(testdata[len(testdata)-1].data)
-
-func Benchmark_XXH32(b *testing.B) {
- var h xxh32.XXHZero
- for n := 0; n < b.N; n++ {
- h.Write(testdata1)
- h.Sum32()
- h.Reset()
- }
-}
-
-func Benchmark_XXH32_Checksum(b *testing.B) {
- for n := 0; n < b.N; n++ {
- xxh32.ChecksumZero(testdata1)
- }
-}
-
-func Benchmark_CRC32(b *testing.B) {
- t := crc32.MakeTable(0)
- for i := 0; i < b.N; i++ {
- crc32.Checksum(testdata1, t)
- }
-}
-
-func Benchmark_Fnv32(b *testing.B) {
- h := fnv.New32()
- for i := 0; i < b.N; i++ {
- h.Write(testdata1)
- h.Sum32()
- h.Reset()
- }
-}
diff --git a/vendor/github.com/pierrec/lz4/reader_test.go b/vendor/github.com/pierrec/lz4/reader_test.go
deleted file mode 100644
index 9165b51f7..000000000
--- a/vendor/github.com/pierrec/lz4/reader_test.go
+++ /dev/null
@@ -1,59 +0,0 @@
-package lz4_test
-
-import (
- "bytes"
- "io"
- "io/ioutil"
- "os"
- "reflect"
- "strings"
- "testing"
-
- "github.com/pierrec/lz4"
-)
-
-func TestReader(t *testing.T) {
- goldenFiles := []string{
- "testdata/e.txt.lz4",
- "testdata/gettysburg.txt.lz4",
- "testdata/Mark.Twain-Tom.Sawyer.txt.lz4",
- "testdata/pg1661.txt.lz4",
- "testdata/pi.txt.lz4",
- "testdata/random.data.lz4",
- "testdata/repeat.txt.lz4",
- }
-
- for _, fname := range goldenFiles {
- t.Run(fname, func(t *testing.T) {
- fname := fname
- t.Parallel()
-
- f, err := os.Open(fname)
- if err != nil {
- t.Fatal(err)
- }
- defer f.Close()
-
- rawfile := strings.TrimSuffix(fname, ".lz4")
- raw, err := ioutil.ReadFile(rawfile)
- if err != nil {
- t.Fatal(err)
- }
-
- var out bytes.Buffer
- zr := lz4.NewReader(f)
- n, err := io.Copy(&out, zr)
- if err != nil {
- t.Fatal(err)
- }
-
- if got, want := int(n), len(raw); got != want {
- t.Errorf("invalid sizes: got %d; want %d", got, want)
- }
-
- if got, want := out.Bytes(), raw; !reflect.DeepEqual(got, want) {
- t.Fatal("uncompressed data does not match original")
- }
- })
- }
-}
diff --git a/vendor/github.com/pierrec/lz4/writer_test.go b/vendor/github.com/pierrec/lz4/writer_test.go
deleted file mode 100644
index 57fc4583d..000000000
--- a/vendor/github.com/pierrec/lz4/writer_test.go
+++ /dev/null
@@ -1,78 +0,0 @@
-package lz4_test
-
-import (
- "bytes"
- "fmt"
- "io"
- "io/ioutil"
- "reflect"
- "testing"
-
- "github.com/pierrec/lz4"
-)
-
-func TestWriter(t *testing.T) {
- goldenFiles := []string{
- "testdata/e.txt",
- "testdata/gettysburg.txt",
- "testdata/Mark.Twain-Tom.Sawyer.txt",
- "testdata/pg1661.txt",
- "testdata/pi.txt",
- "testdata/random.data",
- "testdata/repeat.txt",
- }
-
- for _, fname := range goldenFiles {
- for _, header := range []lz4.Header{
- {}, // Default header.
- {BlockChecksum: true},
- {NoChecksum: true},
- {BlockMaxSize: 64 << 10}, // 64Kb
- {CompressionLevel: 10},
- {Size: 123},
- } {
- label := fmt.Sprintf("%s/%s", fname, header)
- t.Run(label, func(t *testing.T) {
- fname := fname
- header := header
- t.Parallel()
-
- raw, err := ioutil.ReadFile(fname)
- if err != nil {
- t.Fatal(err)
- }
- r := bytes.NewReader(raw)
-
- // Compress.
- var zout bytes.Buffer
- zw := lz4.NewWriter(&zout)
- zw.Header = header
- _, err = io.Copy(zw, r)
- if err != nil {
- t.Fatal(err)
- }
- err = zw.Close()
- if err != nil {
- t.Fatal(err)
- }
-
- // Uncompress.
- var out bytes.Buffer
- zr := lz4.NewReader(&zout)
- n, err := io.Copy(&out, zr)
- if err != nil {
- t.Fatal(err)
- }
-
- // The uncompressed data must be the same as the initial input.
- if got, want := int(n), len(raw); got != want {
- t.Errorf("invalid sizes: got %d; want %d", got, want)
- }
-
- if got, want := out.Bytes(), raw; !reflect.DeepEqual(got, want) {
- t.Fatal("uncompressed data does not match original")
- }
- })
- }
- }
-}
diff --git a/vendor/github.com/prometheus/common/expfmt/bench_test.go b/vendor/github.com/prometheus/common/expfmt/bench_test.go
deleted file mode 100644
index e539bfc13..000000000
--- a/vendor/github.com/prometheus/common/expfmt/bench_test.go
+++ /dev/null
@@ -1,167 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package expfmt
-
-import (
- "bytes"
- "compress/gzip"
- "io"
- "io/ioutil"
- "testing"
-
- "github.com/matttproud/golang_protobuf_extensions/pbutil"
-
- dto "github.com/prometheus/client_model/go"
-)
-
-var parser TextParser
-
-// Benchmarks to show how much penalty text format parsing actually inflicts.
-//
-// Example results on Linux 3.13.0, Intel(R) Core(TM) i7-4700MQ CPU @ 2.40GHz, go1.4.
-//
-// BenchmarkParseText 1000 1188535 ns/op 205085 B/op 6135 allocs/op
-// BenchmarkParseTextGzip 1000 1376567 ns/op 246224 B/op 6151 allocs/op
-// BenchmarkParseProto 10000 172790 ns/op 52258 B/op 1160 allocs/op
-// BenchmarkParseProtoGzip 5000 324021 ns/op 94931 B/op 1211 allocs/op
-// BenchmarkParseProtoMap 10000 187946 ns/op 58714 B/op 1203 allocs/op
-//
-// CONCLUSION: The overhead for the map is negligible. Text format needs ~5x more allocations.
-// Without compression, it needs ~7x longer, but with compression (the more relevant scenario),
-// the difference becomes less relevant, only ~4x.
-//
-// The test data contains 248 samples.
-
-// BenchmarkParseText benchmarks the parsing of a text-format scrape into metric
-// family DTOs.
-func BenchmarkParseText(b *testing.B) {
- b.StopTimer()
- data, err := ioutil.ReadFile("testdata/text")
- if err != nil {
- b.Fatal(err)
- }
- b.StartTimer()
-
- for i := 0; i < b.N; i++ {
- if _, err := parser.TextToMetricFamilies(bytes.NewReader(data)); err != nil {
- b.Fatal(err)
- }
- }
-}
-
-// BenchmarkParseTextGzip benchmarks the parsing of a gzipped text-format scrape
-// into metric family DTOs.
-func BenchmarkParseTextGzip(b *testing.B) {
- b.StopTimer()
- data, err := ioutil.ReadFile("testdata/text.gz")
- if err != nil {
- b.Fatal(err)
- }
- b.StartTimer()
-
- for i := 0; i < b.N; i++ {
- in, err := gzip.NewReader(bytes.NewReader(data))
- if err != nil {
- b.Fatal(err)
- }
- if _, err := parser.TextToMetricFamilies(in); err != nil {
- b.Fatal(err)
- }
- }
-}
-
-// BenchmarkParseProto benchmarks the parsing of a protobuf-format scrape into
-// metric family DTOs. Note that this does not build a map of metric families
-// (as the text version does), because it is not required for Prometheus
-// ingestion either. (However, it is required for the text-format parsing, as
-// the metric family might be sprinkled all over the text, while the
-// protobuf-format guarantees bundling at one place.)
-func BenchmarkParseProto(b *testing.B) {
- b.StopTimer()
- data, err := ioutil.ReadFile("testdata/protobuf")
- if err != nil {
- b.Fatal(err)
- }
- b.StartTimer()
-
- for i := 0; i < b.N; i++ {
- family := &dto.MetricFamily{}
- in := bytes.NewReader(data)
- for {
- family.Reset()
- if _, err := pbutil.ReadDelimited(in, family); err != nil {
- if err == io.EOF {
- break
- }
- b.Fatal(err)
- }
- }
- }
-}
-
-// BenchmarkParseProtoGzip is like BenchmarkParseProto above, but parses gzipped
-// protobuf format.
-func BenchmarkParseProtoGzip(b *testing.B) {
- b.StopTimer()
- data, err := ioutil.ReadFile("testdata/protobuf.gz")
- if err != nil {
- b.Fatal(err)
- }
- b.StartTimer()
-
- for i := 0; i < b.N; i++ {
- family := &dto.MetricFamily{}
- in, err := gzip.NewReader(bytes.NewReader(data))
- if err != nil {
- b.Fatal(err)
- }
- for {
- family.Reset()
- if _, err := pbutil.ReadDelimited(in, family); err != nil {
- if err == io.EOF {
- break
- }
- b.Fatal(err)
- }
- }
- }
-}
-
-// BenchmarkParseProtoMap is like BenchmarkParseProto but DOES put the parsed
-// metric family DTOs into a map. This is not happening during Prometheus
-// ingestion. It is just here to measure the overhead of that map creation and
-// separate it from the overhead of the text format parsing.
-func BenchmarkParseProtoMap(b *testing.B) {
- b.StopTimer()
- data, err := ioutil.ReadFile("testdata/protobuf")
- if err != nil {
- b.Fatal(err)
- }
- b.StartTimer()
-
- for i := 0; i < b.N; i++ {
- families := map[string]*dto.MetricFamily{}
- in := bytes.NewReader(data)
- for {
- family := &dto.MetricFamily{}
- if _, err := pbutil.ReadDelimited(in, family); err != nil {
- if err == io.EOF {
- break
- }
- b.Fatal(err)
- }
- families[family.GetName()] = family
- }
- }
-}
diff --git a/vendor/github.com/prometheus/common/expfmt/decode_test.go b/vendor/github.com/prometheus/common/expfmt/decode_test.go
deleted file mode 100644
index 82c1130c9..000000000
--- a/vendor/github.com/prometheus/common/expfmt/decode_test.go
+++ /dev/null
@@ -1,435 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package expfmt
-
-import (
- "io"
- "net/http"
- "reflect"
- "sort"
- "strings"
- "testing"
-
- "github.com/golang/protobuf/proto"
- dto "github.com/prometheus/client_model/go"
-
- "github.com/prometheus/common/model"
-)
-
-func TestTextDecoder(t *testing.T) {
- var (
- ts = model.Now()
- in = `
-# Only a quite simple scenario with two metric families.
-# More complicated tests of the parser itself can be found in the text package.
-# TYPE mf2 counter
-mf2 3
-mf1{label="value1"} -3.14 123456
-mf1{label="value2"} 42
-mf2 4
-`
- out = model.Vector{
- &model.Sample{
- Metric: model.Metric{
- model.MetricNameLabel: "mf1",
- "label": "value1",
- },
- Value: -3.14,
- Timestamp: 123456,
- },
- &model.Sample{
- Metric: model.Metric{
- model.MetricNameLabel: "mf1",
- "label": "value2",
- },
- Value: 42,
- Timestamp: ts,
- },
- &model.Sample{
- Metric: model.Metric{
- model.MetricNameLabel: "mf2",
- },
- Value: 3,
- Timestamp: ts,
- },
- &model.Sample{
- Metric: model.Metric{
- model.MetricNameLabel: "mf2",
- },
- Value: 4,
- Timestamp: ts,
- },
- }
- )
-
- dec := &SampleDecoder{
- Dec: &textDecoder{r: strings.NewReader(in)},
- Opts: &DecodeOptions{
- Timestamp: ts,
- },
- }
- var all model.Vector
- for {
- var smpls model.Vector
- err := dec.Decode(&smpls)
- if err == io.EOF {
- break
- }
- if err != nil {
- t.Fatal(err)
- }
- all = append(all, smpls...)
- }
- sort.Sort(all)
- sort.Sort(out)
- if !reflect.DeepEqual(all, out) {
- t.Fatalf("output does not match")
- }
-}
-
-func TestProtoDecoder(t *testing.T) {
-
- var testTime = model.Now()
-
- scenarios := []struct {
- in string
- expected model.Vector
- fail bool
- }{
- {
- in: "",
- },
- {
- in: "\x8f\x01\n\rrequest_count\x12\x12Number of requests\x18\x00\"0\n#\n\x0fsome_!abel_name\x12\x10some_label_value\x1a\t\t\x00\x00\x00\x00\x00\x00E\xc0\"6\n)\n\x12another_label_name\x12\x13another_label_value\x1a\t\t\x00\x00\x00\x00\x00\x00U@",
- fail: true,
- },
- {
- in: "\x8f\x01\n\rrequest_count\x12\x12Number of requests\x18\x00\"0\n#\n\x0fsome_label_name\x12\x10some_label_value\x1a\t\t\x00\x00\x00\x00\x00\x00E\xc0\"6\n)\n\x12another_label_name\x12\x13another_label_value\x1a\t\t\x00\x00\x00\x00\x00\x00U@",
- expected: model.Vector{
- &model.Sample{
- Metric: model.Metric{
- model.MetricNameLabel: "request_count",
- "some_label_name": "some_label_value",
- },
- Value: -42,
- Timestamp: testTime,
- },
- &model.Sample{
- Metric: model.Metric{
- model.MetricNameLabel: "request_count",
- "another_label_name": "another_label_value",
- },
- Value: 84,
- Timestamp: testTime,
- },
- },
- },
- {
- in: "\xb9\x01\n\rrequest_count\x12\x12Number of requests\x18\x02\"O\n#\n\x0fsome_label_name\x12\x10some_label_value\"(\x1a\x12\t\xaeG\xe1z\x14\xae\xef?\x11\x00\x00\x00\x00\x00\x00E\xc0\x1a\x12\t+\x87\x16\xd9\xce\xf7\xef?\x11\x00\x00\x00\x00\x00\x00U\xc0\"A\n)\n\x12another_label_name\x12\x13another_label_value\"\x14\x1a\x12\t\x00\x00\x00\x00\x00\x00\xe0?\x11\x00\x00\x00\x00\x00\x00$@",
- expected: model.Vector{
- &model.Sample{
- Metric: model.Metric{
- model.MetricNameLabel: "request_count_count",
- "some_label_name": "some_label_value",
- },
- Value: 0,
- Timestamp: testTime,
- },
- &model.Sample{
- Metric: model.Metric{
- model.MetricNameLabel: "request_count_sum",
- "some_label_name": "some_label_value",
- },
- Value: 0,
- Timestamp: testTime,
- },
- &model.Sample{
- Metric: model.Metric{
- model.MetricNameLabel: "request_count",
- "some_label_name": "some_label_value",
- "quantile": "0.99",
- },
- Value: -42,
- Timestamp: testTime,
- },
- &model.Sample{
- Metric: model.Metric{
- model.MetricNameLabel: "request_count",
- "some_label_name": "some_label_value",
- "quantile": "0.999",
- },
- Value: -84,
- Timestamp: testTime,
- },
- &model.Sample{
- Metric: model.Metric{
- model.MetricNameLabel: "request_count_count",
- "another_label_name": "another_label_value",
- },
- Value: 0,
- Timestamp: testTime,
- },
- &model.Sample{
- Metric: model.Metric{
- model.MetricNameLabel: "request_count_sum",
- "another_label_name": "another_label_value",
- },
- Value: 0,
- Timestamp: testTime,
- },
- &model.Sample{
- Metric: model.Metric{
- model.MetricNameLabel: "request_count",
- "another_label_name": "another_label_value",
- "quantile": "0.5",
- },
- Value: 10,
- Timestamp: testTime,
- },
- },
- },
- {
- in: "\x8d\x01\n\x1drequest_duration_microseconds\x12\x15The response latency.\x18\x04\"S:Q\b\x85\x15\x11\xcd\xcc\xccL\x8f\xcb:A\x1a\v\b{\x11\x00\x00\x00\x00\x00\x00Y@\x1a\f\b\x9c\x03\x11\x00\x00\x00\x00\x00\x00^@\x1a\f\b\xd0\x04\x11\x00\x00\x00\x00\x00\x00b@\x1a\f\b\xf4\v\x11\x9a\x99\x99\x99\x99\x99e@\x1a\f\b\x85\x15\x11\x00\x00\x00\x00\x00\x00\xf0\u007f",
- expected: model.Vector{
- &model.Sample{
- Metric: model.Metric{
- model.MetricNameLabel: "request_duration_microseconds_bucket",
- "le": "100",
- },
- Value: 123,
- Timestamp: testTime,
- },
- &model.Sample{
- Metric: model.Metric{
- model.MetricNameLabel: "request_duration_microseconds_bucket",
- "le": "120",
- },
- Value: 412,
- Timestamp: testTime,
- },
- &model.Sample{
- Metric: model.Metric{
- model.MetricNameLabel: "request_duration_microseconds_bucket",
- "le": "144",
- },
- Value: 592,
- Timestamp: testTime,
- },
- &model.Sample{
- Metric: model.Metric{
- model.MetricNameLabel: "request_duration_microseconds_bucket",
- "le": "172.8",
- },
- Value: 1524,
- Timestamp: testTime,
- },
- &model.Sample{
- Metric: model.Metric{
- model.MetricNameLabel: "request_duration_microseconds_bucket",
- "le": "+Inf",
- },
- Value: 2693,
- Timestamp: testTime,
- },
- &model.Sample{
- Metric: model.Metric{
- model.MetricNameLabel: "request_duration_microseconds_sum",
- },
- Value: 1756047.3,
- Timestamp: testTime,
- },
- &model.Sample{
- Metric: model.Metric{
- model.MetricNameLabel: "request_duration_microseconds_count",
- },
- Value: 2693,
- Timestamp: testTime,
- },
- },
- },
- {
- // The metric type is unset in this protobuf, which needs to be handled
- // correctly by the decoder.
- in: "\x1c\n\rrequest_count\"\v\x1a\t\t\x00\x00\x00\x00\x00\x00\xf0?",
- expected: model.Vector{
- &model.Sample{
- Metric: model.Metric{
- model.MetricNameLabel: "request_count",
- },
- Value: 1,
- Timestamp: testTime,
- },
- },
- },
- }
-
- for i, scenario := range scenarios {
- dec := &SampleDecoder{
- Dec: &protoDecoder{r: strings.NewReader(scenario.in)},
- Opts: &DecodeOptions{
- Timestamp: testTime,
- },
- }
-
- var all model.Vector
- for {
- var smpls model.Vector
- err := dec.Decode(&smpls)
- if err == io.EOF {
- break
- }
- if scenario.fail {
- if err == nil {
- t.Fatal("Expected error but got none")
- }
- break
- }
- if err != nil {
- t.Fatal(err)
- }
- all = append(all, smpls...)
- }
- sort.Sort(all)
- sort.Sort(scenario.expected)
- if !reflect.DeepEqual(all, scenario.expected) {
- t.Fatalf("%d. output does not match, want: %#v, got %#v", i, scenario.expected, all)
- }
- }
-}
-
-func testDiscriminatorHTTPHeader(t testing.TB) {
- var scenarios = []struct {
- input map[string]string
- output Format
- err error
- }{
- {
- input: map[string]string{"Content-Type": `application/vnd.google.protobuf; proto="io.prometheus.client.MetricFamily"; encoding="delimited"`},
- output: FmtProtoDelim,
- },
- {
- input: map[string]string{"Content-Type": `application/vnd.google.protobuf; proto="illegal"; encoding="delimited"`},
- output: FmtUnknown,
- },
- {
- input: map[string]string{"Content-Type": `application/vnd.google.protobuf; proto="io.prometheus.client.MetricFamily"; encoding="illegal"`},
- output: FmtUnknown,
- },
- {
- input: map[string]string{"Content-Type": `text/plain; version=0.0.4`},
- output: FmtText,
- },
- {
- input: map[string]string{"Content-Type": `text/plain`},
- output: FmtText,
- },
- {
- input: map[string]string{"Content-Type": `text/plain; version=0.0.3`},
- output: FmtUnknown,
- },
- }
-
- for i, scenario := range scenarios {
- var header http.Header
-
- if len(scenario.input) > 0 {
- header = http.Header{}
- }
-
- for key, value := range scenario.input {
- header.Add(key, value)
- }
-
- actual := ResponseFormat(header)
-
- if scenario.output != actual {
- t.Errorf("%d. expected %s, got %s", i, scenario.output, actual)
- }
- }
-}
-
-func TestDiscriminatorHTTPHeader(t *testing.T) {
- testDiscriminatorHTTPHeader(t)
-}
-
-func BenchmarkDiscriminatorHTTPHeader(b *testing.B) {
- for i := 0; i < b.N; i++ {
- testDiscriminatorHTTPHeader(b)
- }
-}
-
-func TestExtractSamples(t *testing.T) {
- var (
- goodMetricFamily1 = &dto.MetricFamily{
- Name: proto.String("foo"),
- Help: proto.String("Help for foo."),
- Type: dto.MetricType_COUNTER.Enum(),
- Metric: []*dto.Metric{
- &dto.Metric{
- Counter: &dto.Counter{
- Value: proto.Float64(4711),
- },
- },
- },
- }
- goodMetricFamily2 = &dto.MetricFamily{
- Name: proto.String("bar"),
- Help: proto.String("Help for bar."),
- Type: dto.MetricType_GAUGE.Enum(),
- Metric: []*dto.Metric{
- &dto.Metric{
- Gauge: &dto.Gauge{
- Value: proto.Float64(3.14),
- },
- },
- },
- }
- badMetricFamily = &dto.MetricFamily{
- Name: proto.String("bad"),
- Help: proto.String("Help for bad."),
- Type: dto.MetricType(42).Enum(),
- Metric: []*dto.Metric{
- &dto.Metric{
- Gauge: &dto.Gauge{
- Value: proto.Float64(2.7),
- },
- },
- },
- }
-
- opts = &DecodeOptions{
- Timestamp: 42,
- }
- )
-
- got, err := ExtractSamples(opts, goodMetricFamily1, goodMetricFamily2)
- if err != nil {
- t.Error("Unexpected error from ExtractSamples:", err)
- }
- want := model.Vector{
- &model.Sample{Metric: model.Metric{model.MetricNameLabel: "foo"}, Value: 4711, Timestamp: 42},
- &model.Sample{Metric: model.Metric{model.MetricNameLabel: "bar"}, Value: 3.14, Timestamp: 42},
- }
- if !reflect.DeepEqual(got, want) {
- t.Errorf("unexpected samples extracted, got: %v, want: %v", got, want)
- }
-
- got, err = ExtractSamples(opts, goodMetricFamily1, badMetricFamily, goodMetricFamily2)
- if err == nil {
- t.Error("Expected error from ExtractSamples")
- }
- if !reflect.DeepEqual(got, want) {
- t.Errorf("unexpected samples extracted, got: %v, want: %v", got, want)
- }
-}
diff --git a/vendor/github.com/prometheus/common/expfmt/text_create_test.go b/vendor/github.com/prometheus/common/expfmt/text_create_test.go
deleted file mode 100644
index e4cc5d803..000000000
--- a/vendor/github.com/prometheus/common/expfmt/text_create_test.go
+++ /dev/null
@@ -1,443 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package expfmt
-
-import (
- "bytes"
- "math"
- "strings"
- "testing"
-
- "github.com/golang/protobuf/proto"
-
- dto "github.com/prometheus/client_model/go"
-)
-
-func testCreate(t testing.TB) {
- var scenarios = []struct {
- in *dto.MetricFamily
- out string
- }{
- // 0: Counter, NaN as value, timestamp given.
- {
- in: &dto.MetricFamily{
- Name: proto.String("name"),
- Help: proto.String("two-line\n doc str\\ing"),
- Type: dto.MetricType_COUNTER.Enum(),
- Metric: []*dto.Metric{
- &dto.Metric{
- Label: []*dto.LabelPair{
- &dto.LabelPair{
- Name: proto.String("labelname"),
- Value: proto.String("val1"),
- },
- &dto.LabelPair{
- Name: proto.String("basename"),
- Value: proto.String("basevalue"),
- },
- },
- Counter: &dto.Counter{
- Value: proto.Float64(math.NaN()),
- },
- },
- &dto.Metric{
- Label: []*dto.LabelPair{
- &dto.LabelPair{
- Name: proto.String("labelname"),
- Value: proto.String("val2"),
- },
- &dto.LabelPair{
- Name: proto.String("basename"),
- Value: proto.String("basevalue"),
- },
- },
- Counter: &dto.Counter{
- Value: proto.Float64(.23),
- },
- TimestampMs: proto.Int64(1234567890),
- },
- },
- },
- out: `# HELP name two-line\n doc str\\ing
-# TYPE name counter
-name{labelname="val1",basename="basevalue"} NaN
-name{labelname="val2",basename="basevalue"} 0.23 1234567890
-`,
- },
- // 1: Gauge, some escaping required, +Inf as value, multi-byte characters in label values.
- {
- in: &dto.MetricFamily{
- Name: proto.String("gauge_name"),
- Help: proto.String("gauge\ndoc\nstr\"ing"),
- Type: dto.MetricType_GAUGE.Enum(),
- Metric: []*dto.Metric{
- &dto.Metric{
- Label: []*dto.LabelPair{
- &dto.LabelPair{
- Name: proto.String("name_1"),
- Value: proto.String("val with\nnew line"),
- },
- &dto.LabelPair{
- Name: proto.String("name_2"),
- Value: proto.String("val with \\backslash and \"quotes\""),
- },
- },
- Gauge: &dto.Gauge{
- Value: proto.Float64(math.Inf(+1)),
- },
- },
- &dto.Metric{
- Label: []*dto.LabelPair{
- &dto.LabelPair{
- Name: proto.String("name_1"),
- Value: proto.String("Björn"),
- },
- &dto.LabelPair{
- Name: proto.String("name_2"),
- Value: proto.String("佖佥"),
- },
- },
- Gauge: &dto.Gauge{
- Value: proto.Float64(3.14E42),
- },
- },
- },
- },
- out: `# HELP gauge_name gauge\ndoc\nstr"ing
-# TYPE gauge_name gauge
-gauge_name{name_1="val with\nnew line",name_2="val with \\backslash and \"quotes\""} +Inf
-gauge_name{name_1="Björn",name_2="佖佥"} 3.14e+42
-`,
- },
- // 2: Untyped, no help, one sample with no labels and -Inf as value, another sample with one label.
- {
- in: &dto.MetricFamily{
- Name: proto.String("untyped_name"),
- Type: dto.MetricType_UNTYPED.Enum(),
- Metric: []*dto.Metric{
- &dto.Metric{
- Untyped: &dto.Untyped{
- Value: proto.Float64(math.Inf(-1)),
- },
- },
- &dto.Metric{
- Label: []*dto.LabelPair{
- &dto.LabelPair{
- Name: proto.String("name_1"),
- Value: proto.String("value 1"),
- },
- },
- Untyped: &dto.Untyped{
- Value: proto.Float64(-1.23e-45),
- },
- },
- },
- },
- out: `# TYPE untyped_name untyped
-untyped_name -Inf
-untyped_name{name_1="value 1"} -1.23e-45
-`,
- },
- // 3: Summary.
- {
- in: &dto.MetricFamily{
- Name: proto.String("summary_name"),
- Help: proto.String("summary docstring"),
- Type: dto.MetricType_SUMMARY.Enum(),
- Metric: []*dto.Metric{
- &dto.Metric{
- Summary: &dto.Summary{
- SampleCount: proto.Uint64(42),
- SampleSum: proto.Float64(-3.4567),
- Quantile: []*dto.Quantile{
- &dto.Quantile{
- Quantile: proto.Float64(0.5),
- Value: proto.Float64(-1.23),
- },
- &dto.Quantile{
- Quantile: proto.Float64(0.9),
- Value: proto.Float64(.2342354),
- },
- &dto.Quantile{
- Quantile: proto.Float64(0.99),
- Value: proto.Float64(0),
- },
- },
- },
- },
- &dto.Metric{
- Label: []*dto.LabelPair{
- &dto.LabelPair{
- Name: proto.String("name_1"),
- Value: proto.String("value 1"),
- },
- &dto.LabelPair{
- Name: proto.String("name_2"),
- Value: proto.String("value 2"),
- },
- },
- Summary: &dto.Summary{
- SampleCount: proto.Uint64(4711),
- SampleSum: proto.Float64(2010.1971),
- Quantile: []*dto.Quantile{
- &dto.Quantile{
- Quantile: proto.Float64(0.5),
- Value: proto.Float64(1),
- },
- &dto.Quantile{
- Quantile: proto.Float64(0.9),
- Value: proto.Float64(2),
- },
- &dto.Quantile{
- Quantile: proto.Float64(0.99),
- Value: proto.Float64(3),
- },
- },
- },
- },
- },
- },
- out: `# HELP summary_name summary docstring
-# TYPE summary_name summary
-summary_name{quantile="0.5"} -1.23
-summary_name{quantile="0.9"} 0.2342354
-summary_name{quantile="0.99"} 0
-summary_name_sum -3.4567
-summary_name_count 42
-summary_name{name_1="value 1",name_2="value 2",quantile="0.5"} 1
-summary_name{name_1="value 1",name_2="value 2",quantile="0.9"} 2
-summary_name{name_1="value 1",name_2="value 2",quantile="0.99"} 3
-summary_name_sum{name_1="value 1",name_2="value 2"} 2010.1971
-summary_name_count{name_1="value 1",name_2="value 2"} 4711
-`,
- },
- // 4: Histogram
- {
- in: &dto.MetricFamily{
- Name: proto.String("request_duration_microseconds"),
- Help: proto.String("The response latency."),
- Type: dto.MetricType_HISTOGRAM.Enum(),
- Metric: []*dto.Metric{
- &dto.Metric{
- Histogram: &dto.Histogram{
- SampleCount: proto.Uint64(2693),
- SampleSum: proto.Float64(1756047.3),
- Bucket: []*dto.Bucket{
- &dto.Bucket{
- UpperBound: proto.Float64(100),
- CumulativeCount: proto.Uint64(123),
- },
- &dto.Bucket{
- UpperBound: proto.Float64(120),
- CumulativeCount: proto.Uint64(412),
- },
- &dto.Bucket{
- UpperBound: proto.Float64(144),
- CumulativeCount: proto.Uint64(592),
- },
- &dto.Bucket{
- UpperBound: proto.Float64(172.8),
- CumulativeCount: proto.Uint64(1524),
- },
- &dto.Bucket{
- UpperBound: proto.Float64(math.Inf(+1)),
- CumulativeCount: proto.Uint64(2693),
- },
- },
- },
- },
- },
- },
- out: `# HELP request_duration_microseconds The response latency.
-# TYPE request_duration_microseconds histogram
-request_duration_microseconds_bucket{le="100"} 123
-request_duration_microseconds_bucket{le="120"} 412
-request_duration_microseconds_bucket{le="144"} 592
-request_duration_microseconds_bucket{le="172.8"} 1524
-request_duration_microseconds_bucket{le="+Inf"} 2693
-request_duration_microseconds_sum 1.7560473e+06
-request_duration_microseconds_count 2693
-`,
- },
- // 5: Histogram with missing +Inf bucket.
- {
- in: &dto.MetricFamily{
- Name: proto.String("request_duration_microseconds"),
- Help: proto.String("The response latency."),
- Type: dto.MetricType_HISTOGRAM.Enum(),
- Metric: []*dto.Metric{
- &dto.Metric{
- Histogram: &dto.Histogram{
- SampleCount: proto.Uint64(2693),
- SampleSum: proto.Float64(1756047.3),
- Bucket: []*dto.Bucket{
- &dto.Bucket{
- UpperBound: proto.Float64(100),
- CumulativeCount: proto.Uint64(123),
- },
- &dto.Bucket{
- UpperBound: proto.Float64(120),
- CumulativeCount: proto.Uint64(412),
- },
- &dto.Bucket{
- UpperBound: proto.Float64(144),
- CumulativeCount: proto.Uint64(592),
- },
- &dto.Bucket{
- UpperBound: proto.Float64(172.8),
- CumulativeCount: proto.Uint64(1524),
- },
- },
- },
- },
- },
- },
- out: `# HELP request_duration_microseconds The response latency.
-# TYPE request_duration_microseconds histogram
-request_duration_microseconds_bucket{le="100"} 123
-request_duration_microseconds_bucket{le="120"} 412
-request_duration_microseconds_bucket{le="144"} 592
-request_duration_microseconds_bucket{le="172.8"} 1524
-request_duration_microseconds_bucket{le="+Inf"} 2693
-request_duration_microseconds_sum 1.7560473e+06
-request_duration_microseconds_count 2693
-`,
- },
- // 6: No metric type, should result in default type Counter.
- {
- in: &dto.MetricFamily{
- Name: proto.String("name"),
- Help: proto.String("doc string"),
- Metric: []*dto.Metric{
- &dto.Metric{
- Counter: &dto.Counter{
- Value: proto.Float64(math.Inf(-1)),
- },
- },
- },
- },
- out: `# HELP name doc string
-# TYPE name counter
-name -Inf
-`,
- },
- }
-
- for i, scenario := range scenarios {
- out := bytes.NewBuffer(make([]byte, 0, len(scenario.out)))
- n, err := MetricFamilyToText(out, scenario.in)
- if err != nil {
- t.Errorf("%d. error: %s", i, err)
- continue
- }
- if expected, got := len(scenario.out), n; expected != got {
- t.Errorf(
- "%d. expected %d bytes written, got %d",
- i, expected, got,
- )
- }
- if expected, got := scenario.out, out.String(); expected != got {
- t.Errorf(
- "%d. expected out=%q, got %q",
- i, expected, got,
- )
- }
- }
-
-}
-
-func TestCreate(t *testing.T) {
- testCreate(t)
-}
-
-func BenchmarkCreate(b *testing.B) {
- for i := 0; i < b.N; i++ {
- testCreate(b)
- }
-}
-
-func testCreateError(t testing.TB) {
- var scenarios = []struct {
- in *dto.MetricFamily
- err string
- }{
- // 0: No metric.
- {
- in: &dto.MetricFamily{
- Name: proto.String("name"),
- Help: proto.String("doc string"),
- Type: dto.MetricType_COUNTER.Enum(),
- Metric: []*dto.Metric{},
- },
- err: "MetricFamily has no metrics",
- },
- // 1: No metric name.
- {
- in: &dto.MetricFamily{
- Help: proto.String("doc string"),
- Type: dto.MetricType_UNTYPED.Enum(),
- Metric: []*dto.Metric{
- &dto.Metric{
- Untyped: &dto.Untyped{
- Value: proto.Float64(math.Inf(-1)),
- },
- },
- },
- },
- err: "MetricFamily has no name",
- },
- // 2: Wrong type.
- {
- in: &dto.MetricFamily{
- Name: proto.String("name"),
- Help: proto.String("doc string"),
- Type: dto.MetricType_COUNTER.Enum(),
- Metric: []*dto.Metric{
- &dto.Metric{
- Untyped: &dto.Untyped{
- Value: proto.Float64(math.Inf(-1)),
- },
- },
- },
- },
- err: "expected counter in metric",
- },
- }
-
- for i, scenario := range scenarios {
- var out bytes.Buffer
- _, err := MetricFamilyToText(&out, scenario.in)
- if err == nil {
- t.Errorf("%d. expected error, got nil", i)
- continue
- }
- if expected, got := scenario.err, err.Error(); strings.Index(got, expected) != 0 {
- t.Errorf(
- "%d. expected error starting with %q, got %q",
- i, expected, got,
- )
- }
- }
-
-}
-
-func TestCreateError(t *testing.T) {
- testCreateError(t)
-}
-
-func BenchmarkCreateError(b *testing.B) {
- for i := 0; i < b.N; i++ {
- testCreateError(b)
- }
-}
diff --git a/vendor/github.com/prometheus/common/expfmt/text_parse_test.go b/vendor/github.com/prometheus/common/expfmt/text_parse_test.go
deleted file mode 100644
index 76c951185..000000000
--- a/vendor/github.com/prometheus/common/expfmt/text_parse_test.go
+++ /dev/null
@@ -1,593 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package expfmt
-
-import (
- "math"
- "strings"
- "testing"
-
- "github.com/golang/protobuf/proto"
- dto "github.com/prometheus/client_model/go"
-)
-
-func testTextParse(t testing.TB) {
- var scenarios = []struct {
- in string
- out []*dto.MetricFamily
- }{
- // 0: Empty lines as input.
- {
- in: `
-
-`,
- out: []*dto.MetricFamily{},
- },
- // 1: Minimal case.
- {
- in: `
-minimal_metric 1.234
-another_metric -3e3 103948
-# Even that:
-no_labels{} 3
-# HELP line for non-existing metric will be ignored.
-`,
- out: []*dto.MetricFamily{
- &dto.MetricFamily{
- Name: proto.String("minimal_metric"),
- Type: dto.MetricType_UNTYPED.Enum(),
- Metric: []*dto.Metric{
- &dto.Metric{
- Untyped: &dto.Untyped{
- Value: proto.Float64(1.234),
- },
- },
- },
- },
- &dto.MetricFamily{
- Name: proto.String("another_metric"),
- Type: dto.MetricType_UNTYPED.Enum(),
- Metric: []*dto.Metric{
- &dto.Metric{
- Untyped: &dto.Untyped{
- Value: proto.Float64(-3e3),
- },
- TimestampMs: proto.Int64(103948),
- },
- },
- },
- &dto.MetricFamily{
- Name: proto.String("no_labels"),
- Type: dto.MetricType_UNTYPED.Enum(),
- Metric: []*dto.Metric{
- &dto.Metric{
- Untyped: &dto.Untyped{
- Value: proto.Float64(3),
- },
- },
- },
- },
- },
- },
- // 2: Counters & gauges, docstrings, various whitespace, escape sequences.
- {
- in: `
-# A normal comment.
-#
-# TYPE name counter
-name{labelname="val1",basename="basevalue"} NaN
-name {labelname="val2",basename="base\"v\\al\nue"} 0.23 1234567890
-# HELP name two-line\n doc str\\ing
-
- # HELP name2 doc str"ing 2
- # TYPE name2 gauge
-name2{labelname="val2" ,basename = "basevalue2" } +Inf 54321
-name2{ labelname = "val1" , }-Inf
-`,
- out: []*dto.MetricFamily{
- &dto.MetricFamily{
- Name: proto.String("name"),
- Help: proto.String("two-line\n doc str\\ing"),
- Type: dto.MetricType_COUNTER.Enum(),
- Metric: []*dto.Metric{
- &dto.Metric{
- Label: []*dto.LabelPair{
- &dto.LabelPair{
- Name: proto.String("labelname"),
- Value: proto.String("val1"),
- },
- &dto.LabelPair{
- Name: proto.String("basename"),
- Value: proto.String("basevalue"),
- },
- },
- Counter: &dto.Counter{
- Value: proto.Float64(math.NaN()),
- },
- },
- &dto.Metric{
- Label: []*dto.LabelPair{
- &dto.LabelPair{
- Name: proto.String("labelname"),
- Value: proto.String("val2"),
- },
- &dto.LabelPair{
- Name: proto.String("basename"),
- Value: proto.String("base\"v\\al\nue"),
- },
- },
- Counter: &dto.Counter{
- Value: proto.Float64(.23),
- },
- TimestampMs: proto.Int64(1234567890),
- },
- },
- },
- &dto.MetricFamily{
- Name: proto.String("name2"),
- Help: proto.String("doc str\"ing 2"),
- Type: dto.MetricType_GAUGE.Enum(),
- Metric: []*dto.Metric{
- &dto.Metric{
- Label: []*dto.LabelPair{
- &dto.LabelPair{
- Name: proto.String("labelname"),
- Value: proto.String("val2"),
- },
- &dto.LabelPair{
- Name: proto.String("basename"),
- Value: proto.String("basevalue2"),
- },
- },
- Gauge: &dto.Gauge{
- Value: proto.Float64(math.Inf(+1)),
- },
- TimestampMs: proto.Int64(54321),
- },
- &dto.Metric{
- Label: []*dto.LabelPair{
- &dto.LabelPair{
- Name: proto.String("labelname"),
- Value: proto.String("val1"),
- },
- },
- Gauge: &dto.Gauge{
- Value: proto.Float64(math.Inf(-1)),
- },
- },
- },
- },
- },
- },
- // 3: The evil summary, mixed with other types and funny comments.
- {
- in: `
-# TYPE my_summary summary
-my_summary{n1="val1",quantile="0.5"} 110
-decoy -1 -2
-my_summary{n1="val1",quantile="0.9"} 140 1
-my_summary_count{n1="val1"} 42
-# Latest timestamp wins in case of a summary.
-my_summary_sum{n1="val1"} 4711 2
-fake_sum{n1="val1"} 2001
-# TYPE another_summary summary
-another_summary_count{n2="val2",n1="val1"} 20
-my_summary_count{n2="val2",n1="val1"} 5 5
-another_summary{n1="val1",n2="val2",quantile=".3"} -1.2
-my_summary_sum{n1="val2"} 08 15
-my_summary{n1="val3", quantile="0.2"} 4711
- my_summary{n1="val1",n2="val2",quantile="-12.34",} NaN
-# some
-# funny comments
-# HELP
-# HELP
-# HELP my_summary
-# HELP my_summary
-`,
- out: []*dto.MetricFamily{
- &dto.MetricFamily{
- Name: proto.String("fake_sum"),
- Type: dto.MetricType_UNTYPED.Enum(),
- Metric: []*dto.Metric{
- &dto.Metric{
- Label: []*dto.LabelPair{
- &dto.LabelPair{
- Name: proto.String("n1"),
- Value: proto.String("val1"),
- },
- },
- Untyped: &dto.Untyped{
- Value: proto.Float64(2001),
- },
- },
- },
- },
- &dto.MetricFamily{
- Name: proto.String("decoy"),
- Type: dto.MetricType_UNTYPED.Enum(),
- Metric: []*dto.Metric{
- &dto.Metric{
- Untyped: &dto.Untyped{
- Value: proto.Float64(-1),
- },
- TimestampMs: proto.Int64(-2),
- },
- },
- },
- &dto.MetricFamily{
- Name: proto.String("my_summary"),
- Type: dto.MetricType_SUMMARY.Enum(),
- Metric: []*dto.Metric{
- &dto.Metric{
- Label: []*dto.LabelPair{
- &dto.LabelPair{
- Name: proto.String("n1"),
- Value: proto.String("val1"),
- },
- },
- Summary: &dto.Summary{
- SampleCount: proto.Uint64(42),
- SampleSum: proto.Float64(4711),
- Quantile: []*dto.Quantile{
- &dto.Quantile{
- Quantile: proto.Float64(0.5),
- Value: proto.Float64(110),
- },
- &dto.Quantile{
- Quantile: proto.Float64(0.9),
- Value: proto.Float64(140),
- },
- },
- },
- TimestampMs: proto.Int64(2),
- },
- &dto.Metric{
- Label: []*dto.LabelPair{
- &dto.LabelPair{
- Name: proto.String("n2"),
- Value: proto.String("val2"),
- },
- &dto.LabelPair{
- Name: proto.String("n1"),
- Value: proto.String("val1"),
- },
- },
- Summary: &dto.Summary{
- SampleCount: proto.Uint64(5),
- Quantile: []*dto.Quantile{
- &dto.Quantile{
- Quantile: proto.Float64(-12.34),
- Value: proto.Float64(math.NaN()),
- },
- },
- },
- TimestampMs: proto.Int64(5),
- },
- &dto.Metric{
- Label: []*dto.LabelPair{
- &dto.LabelPair{
- Name: proto.String("n1"),
- Value: proto.String("val2"),
- },
- },
- Summary: &dto.Summary{
- SampleSum: proto.Float64(8),
- },
- TimestampMs: proto.Int64(15),
- },
- &dto.Metric{
- Label: []*dto.LabelPair{
- &dto.LabelPair{
- Name: proto.String("n1"),
- Value: proto.String("val3"),
- },
- },
- Summary: &dto.Summary{
- Quantile: []*dto.Quantile{
- &dto.Quantile{
- Quantile: proto.Float64(0.2),
- Value: proto.Float64(4711),
- },
- },
- },
- },
- },
- },
- &dto.MetricFamily{
- Name: proto.String("another_summary"),
- Type: dto.MetricType_SUMMARY.Enum(),
- Metric: []*dto.Metric{
- &dto.Metric{
- Label: []*dto.LabelPair{
- &dto.LabelPair{
- Name: proto.String("n2"),
- Value: proto.String("val2"),
- },
- &dto.LabelPair{
- Name: proto.String("n1"),
- Value: proto.String("val1"),
- },
- },
- Summary: &dto.Summary{
- SampleCount: proto.Uint64(20),
- Quantile: []*dto.Quantile{
- &dto.Quantile{
- Quantile: proto.Float64(0.3),
- Value: proto.Float64(-1.2),
- },
- },
- },
- },
- },
- },
- },
- },
- // 4: The histogram.
- {
- in: `
-# HELP request_duration_microseconds The response latency.
-# TYPE request_duration_microseconds histogram
-request_duration_microseconds_bucket{le="100"} 123
-request_duration_microseconds_bucket{le="120"} 412
-request_duration_microseconds_bucket{le="144"} 592
-request_duration_microseconds_bucket{le="172.8"} 1524
-request_duration_microseconds_bucket{le="+Inf"} 2693
-request_duration_microseconds_sum 1.7560473e+06
-request_duration_microseconds_count 2693
-`,
- out: []*dto.MetricFamily{
- {
- Name: proto.String("request_duration_microseconds"),
- Help: proto.String("The response latency."),
- Type: dto.MetricType_HISTOGRAM.Enum(),
- Metric: []*dto.Metric{
- &dto.Metric{
- Histogram: &dto.Histogram{
- SampleCount: proto.Uint64(2693),
- SampleSum: proto.Float64(1756047.3),
- Bucket: []*dto.Bucket{
- &dto.Bucket{
- UpperBound: proto.Float64(100),
- CumulativeCount: proto.Uint64(123),
- },
- &dto.Bucket{
- UpperBound: proto.Float64(120),
- CumulativeCount: proto.Uint64(412),
- },
- &dto.Bucket{
- UpperBound: proto.Float64(144),
- CumulativeCount: proto.Uint64(592),
- },
- &dto.Bucket{
- UpperBound: proto.Float64(172.8),
- CumulativeCount: proto.Uint64(1524),
- },
- &dto.Bucket{
- UpperBound: proto.Float64(math.Inf(+1)),
- CumulativeCount: proto.Uint64(2693),
- },
- },
- },
- },
- },
- },
- },
- },
- }
-
- for i, scenario := range scenarios {
- out, err := parser.TextToMetricFamilies(strings.NewReader(scenario.in))
- if err != nil {
- t.Errorf("%d. error: %s", i, err)
- continue
- }
- if expected, got := len(scenario.out), len(out); expected != got {
- t.Errorf(
- "%d. expected %d MetricFamilies, got %d",
- i, expected, got,
- )
- }
- for _, expected := range scenario.out {
- got, ok := out[expected.GetName()]
- if !ok {
- t.Errorf(
- "%d. expected MetricFamily %q, found none",
- i, expected.GetName(),
- )
- continue
- }
- if expected.String() != got.String() {
- t.Errorf(
- "%d. expected MetricFamily %s, got %s",
- i, expected, got,
- )
- }
- }
- }
-}
-
-func TestTextParse(t *testing.T) {
- testTextParse(t)
-}
-
-func BenchmarkTextParse(b *testing.B) {
- for i := 0; i < b.N; i++ {
- testTextParse(b)
- }
-}
-
-func testTextParseError(t testing.TB) {
- var scenarios = []struct {
- in string
- err string
- }{
- // 0: No new-line at end of input.
- {
- in: `
-bla 3.14
-blubber 42`,
- err: "text format parsing error in line 3: unexpected end of input stream",
- },
- // 1: Invalid escape sequence in label value.
- {
- in: `metric{label="\t"} 3.14`,
- err: "text format parsing error in line 1: invalid escape sequence",
- },
- // 2: Newline in label value.
- {
- in: `
-metric{label="new
-line"} 3.14
-`,
- err: `text format parsing error in line 2: label value "new" contains unescaped new-line`,
- },
- // 3:
- {
- in: `metric{@="bla"} 3.14`,
- err: "text format parsing error in line 1: invalid label name for metric",
- },
- // 4:
- {
- in: `metric{__name__="bla"} 3.14`,
- err: `text format parsing error in line 1: label name "__name__" is reserved`,
- },
- // 5:
- {
- in: `metric{label+="bla"} 3.14`,
- err: "text format parsing error in line 1: expected '=' after label name",
- },
- // 6:
- {
- in: `metric{label=bla} 3.14`,
- err: "text format parsing error in line 1: expected '\"' at start of label value",
- },
- // 7:
- {
- in: `
-# TYPE metric summary
-metric{quantile="bla"} 3.14
-`,
- err: "text format parsing error in line 3: expected float as value for 'quantile' label",
- },
- // 8:
- {
- in: `metric{label="bla"+} 3.14`,
- err: "text format parsing error in line 1: unexpected end of label value",
- },
- // 9:
- {
- in: `metric{label="bla"} 3.14 2.72
-`,
- err: "text format parsing error in line 1: expected integer as timestamp",
- },
- // 10:
- {
- in: `metric{label="bla"} 3.14 2 3
-`,
- err: "text format parsing error in line 1: spurious string after timestamp",
- },
- // 11:
- {
- in: `metric{label="bla"} blubb
-`,
- err: "text format parsing error in line 1: expected float as value",
- },
- // 12:
- {
- in: `
-# HELP metric one
-# HELP metric two
-`,
- err: "text format parsing error in line 3: second HELP line for metric name",
- },
- // 13:
- {
- in: `
-# TYPE metric counter
-# TYPE metric untyped
-`,
- err: `text format parsing error in line 3: second TYPE line for metric name "metric", or TYPE reported after samples`,
- },
- // 14:
- {
- in: `
-metric 4.12
-# TYPE metric counter
-`,
- err: `text format parsing error in line 3: second TYPE line for metric name "metric", or TYPE reported after samples`,
- },
- // 14:
- {
- in: `
-# TYPE metric bla
-`,
- err: "text format parsing error in line 2: unknown metric type",
- },
- // 15:
- {
- in: `
-# TYPE met-ric
-`,
- err: "text format parsing error in line 2: invalid metric name in comment",
- },
- // 16:
- {
- in: `@invalidmetric{label="bla"} 3.14 2`,
- err: "text format parsing error in line 1: invalid metric name",
- },
- // 17:
- {
- in: `{label="bla"} 3.14 2`,
- err: "text format parsing error in line 1: invalid metric name",
- },
- // 18:
- {
- in: `
-# TYPE metric histogram
-metric_bucket{le="bla"} 3.14
-`,
- err: "text format parsing error in line 3: expected float as value for 'le' label",
- },
- // 19: Invalid UTF-8 in label value.
- {
- in: "metric{l=\"\xbd\"} 3.14\n",
- err: "text format parsing error in line 1: invalid label value \"\\xbd\"",
- },
- }
-
- for i, scenario := range scenarios {
- _, err := parser.TextToMetricFamilies(strings.NewReader(scenario.in))
- if err == nil {
- t.Errorf("%d. expected error, got nil", i)
- continue
- }
- if expected, got := scenario.err, err.Error(); strings.Index(got, expected) != 0 {
- t.Errorf(
- "%d. expected error starting with %q, got %q",
- i, expected, got,
- )
- }
- }
-
-}
-
-func TestTextParseError(t *testing.T) {
- testTextParseError(t)
-}
-
-func BenchmarkParseError(b *testing.B) {
- for i := 0; i < b.N; i++ {
- testTextParseError(b)
- }
-}
diff --git a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg_test.go b/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg_test.go
deleted file mode 100644
index 41d328f1d..000000000
--- a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg_test.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package goautoneg
-
-import (
- "testing"
-)
-
-var chrome = "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"
-
-func TestParseAccept(t *testing.T) {
- alternatives := []string{"text/html", "image/png"}
- content_type := Negotiate(chrome, alternatives)
- if content_type != "image/png" {
- t.Errorf("got %s expected image/png", content_type)
- }
-
- alternatives = []string{"text/html", "text/plain", "text/n3"}
- content_type = Negotiate(chrome, alternatives)
- if content_type != "text/html" {
- t.Errorf("got %s expected text/html", content_type)
- }
-
- alternatives = []string{"text/n3", "text/plain"}
- content_type = Negotiate(chrome, alternatives)
- if content_type != "text/plain" {
- t.Errorf("got %s expected text/plain", content_type)
- }
-
- alternatives = []string{"text/n3", "application/rdf+xml"}
- content_type = Negotiate(chrome, alternatives)
- if content_type != "text/n3" {
- t.Errorf("got %s expected text/n3", content_type)
- }
-}
diff --git a/vendor/github.com/prometheus/common/model/alert_test.go b/vendor/github.com/prometheus/common/model/alert_test.go
deleted file mode 100644
index 9692bca21..000000000
--- a/vendor/github.com/prometheus/common/model/alert_test.go
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "strings"
- "testing"
- "time"
-)
-
-func TestAlertValidate(t *testing.T) {
- ts := time.Now()
-
- var cases = []struct {
- alert *Alert
- err string
- }{
- {
- alert: &Alert{
- Labels: LabelSet{"a": "b"},
- StartsAt: ts,
- },
- },
- {
- alert: &Alert{
- Labels: LabelSet{"a": "b"},
- },
- err: "start time missing",
- },
- {
- alert: &Alert{
- Labels: LabelSet{"a": "b"},
- StartsAt: ts,
- EndsAt: ts,
- },
- },
- {
- alert: &Alert{
- Labels: LabelSet{"a": "b"},
- StartsAt: ts,
- EndsAt: ts.Add(1 * time.Minute),
- },
- },
- {
- alert: &Alert{
- Labels: LabelSet{"a": "b"},
- StartsAt: ts,
- EndsAt: ts.Add(-1 * time.Minute),
- },
- err: "start time must be before end time",
- },
- {
- alert: &Alert{
- StartsAt: ts,
- },
- err: "at least one label pair required",
- },
- {
- alert: &Alert{
- Labels: LabelSet{"a": "b", "!bad": "label"},
- StartsAt: ts,
- },
- err: "invalid label set: invalid name",
- },
- {
- alert: &Alert{
- Labels: LabelSet{"a": "b", "bad": "\xfflabel"},
- StartsAt: ts,
- },
- err: "invalid label set: invalid value",
- },
- {
- alert: &Alert{
- Labels: LabelSet{"a": "b"},
- Annotations: LabelSet{"!bad": "label"},
- StartsAt: ts,
- },
- err: "invalid annotations: invalid name",
- },
- {
- alert: &Alert{
- Labels: LabelSet{"a": "b"},
- Annotations: LabelSet{"bad": "\xfflabel"},
- StartsAt: ts,
- },
- err: "invalid annotations: invalid value",
- },
- }
-
- for i, c := range cases {
- err := c.alert.Validate()
- if err == nil {
- if c.err == "" {
- continue
- }
- t.Errorf("%d. Expected error %q but got none", i, c.err)
- continue
- }
- if c.err == "" && err != nil {
- t.Errorf("%d. Expected no error but got %q", i, err)
- continue
- }
- if !strings.Contains(err.Error(), c.err) {
- t.Errorf("%d. Expected error to contain %q but got %q", i, c.err, err)
- }
- }
-}
diff --git a/vendor/github.com/prometheus/common/model/labels_test.go b/vendor/github.com/prometheus/common/model/labels_test.go
deleted file mode 100644
index e8df28ffa..000000000
--- a/vendor/github.com/prometheus/common/model/labels_test.go
+++ /dev/null
@@ -1,140 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "sort"
- "testing"
-)
-
-func testLabelNames(t testing.TB) {
- var scenarios = []struct {
- in LabelNames
- out LabelNames
- }{
- {
- in: LabelNames{"ZZZ", "zzz"},
- out: LabelNames{"ZZZ", "zzz"},
- },
- {
- in: LabelNames{"aaa", "AAA"},
- out: LabelNames{"AAA", "aaa"},
- },
- }
-
- for i, scenario := range scenarios {
- sort.Sort(scenario.in)
-
- for j, expected := range scenario.out {
- if expected != scenario.in[j] {
- t.Errorf("%d.%d expected %s, got %s", i, j, expected, scenario.in[j])
- }
- }
- }
-}
-
-func TestLabelNames(t *testing.T) {
- testLabelNames(t)
-}
-
-func BenchmarkLabelNames(b *testing.B) {
- for i := 0; i < b.N; i++ {
- testLabelNames(b)
- }
-}
-
-func testLabelValues(t testing.TB) {
- var scenarios = []struct {
- in LabelValues
- out LabelValues
- }{
- {
- in: LabelValues{"ZZZ", "zzz"},
- out: LabelValues{"ZZZ", "zzz"},
- },
- {
- in: LabelValues{"aaa", "AAA"},
- out: LabelValues{"AAA", "aaa"},
- },
- }
-
- for i, scenario := range scenarios {
- sort.Sort(scenario.in)
-
- for j, expected := range scenario.out {
- if expected != scenario.in[j] {
- t.Errorf("%d.%d expected %s, got %s", i, j, expected, scenario.in[j])
- }
- }
- }
-}
-
-func TestLabelValues(t *testing.T) {
- testLabelValues(t)
-}
-
-func BenchmarkLabelValues(b *testing.B) {
- for i := 0; i < b.N; i++ {
- testLabelValues(b)
- }
-}
-
-func TestLabelNameIsValid(t *testing.T) {
- var scenarios = []struct {
- ln LabelName
- valid bool
- }{
- {
- ln: "Avalid_23name",
- valid: true,
- },
- {
- ln: "_Avalid_23name",
- valid: true,
- },
- {
- ln: "1valid_23name",
- valid: false,
- },
- {
- ln: "avalid_23name",
- valid: true,
- },
- {
- ln: "Ava:lid_23name",
- valid: false,
- },
- {
- ln: "a lid_23name",
- valid: false,
- },
- {
- ln: ":leading_colon",
- valid: false,
- },
- {
- ln: "colon:in:the:middle",
- valid: false,
- },
- }
-
- for _, s := range scenarios {
- if s.ln.IsValid() != s.valid {
- t.Errorf("Expected %v for %q using IsValid method", s.valid, s.ln)
- }
- if LabelNameRE.MatchString(string(s.ln)) != s.valid {
- t.Errorf("Expected %v for %q using regexp match", s.valid, s.ln)
- }
- }
-}
diff --git a/vendor/github.com/prometheus/common/model/metric_test.go b/vendor/github.com/prometheus/common/model/metric_test.go
deleted file mode 100644
index 06f9de525..000000000
--- a/vendor/github.com/prometheus/common/model/metric_test.go
+++ /dev/null
@@ -1,132 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import "testing"
-
-func testMetric(t testing.TB) {
- var scenarios = []struct {
- input LabelSet
- fingerprint Fingerprint
- fastFingerprint Fingerprint
- }{
- {
- input: LabelSet{},
- fingerprint: 14695981039346656037,
- fastFingerprint: 14695981039346656037,
- },
- {
- input: LabelSet{
- "first_name": "electro",
- "occupation": "robot",
- "manufacturer": "westinghouse",
- },
- fingerprint: 5911716720268894962,
- fastFingerprint: 11310079640881077873,
- },
- {
- input: LabelSet{
- "x": "y",
- },
- fingerprint: 8241431561484471700,
- fastFingerprint: 13948396922932177635,
- },
- {
- input: LabelSet{
- "a": "bb",
- "b": "c",
- },
- fingerprint: 3016285359649981711,
- fastFingerprint: 3198632812309449502,
- },
- {
- input: LabelSet{
- "a": "b",
- "bb": "c",
- },
- fingerprint: 7122421792099404749,
- fastFingerprint: 5774953389407657638,
- },
- }
-
- for i, scenario := range scenarios {
- input := Metric(scenario.input)
-
- if scenario.fingerprint != input.Fingerprint() {
- t.Errorf("%d. expected %d, got %d", i, scenario.fingerprint, input.Fingerprint())
- }
- if scenario.fastFingerprint != input.FastFingerprint() {
- t.Errorf("%d. expected %d, got %d", i, scenario.fastFingerprint, input.FastFingerprint())
- }
- }
-}
-
-func TestMetric(t *testing.T) {
- testMetric(t)
-}
-
-func BenchmarkMetric(b *testing.B) {
- for i := 0; i < b.N; i++ {
- testMetric(b)
- }
-}
-
-func TestMetricNameIsValid(t *testing.T) {
- var scenarios = []struct {
- mn LabelValue
- valid bool
- }{
- {
- mn: "Avalid_23name",
- valid: true,
- },
- {
- mn: "_Avalid_23name",
- valid: true,
- },
- {
- mn: "1valid_23name",
- valid: false,
- },
- {
- mn: "avalid_23name",
- valid: true,
- },
- {
- mn: "Ava:lid_23name",
- valid: true,
- },
- {
- mn: "a lid_23name",
- valid: false,
- },
- {
- mn: ":leading_colon",
- valid: true,
- },
- {
- mn: "colon:in:the:middle",
- valid: true,
- },
- }
-
- for _, s := range scenarios {
- if IsValidMetricName(s.mn) != s.valid {
- t.Errorf("Expected %v for %q using IsValidMetricName function", s.valid, s.mn)
- }
- if MetricNameRE.MatchString(string(s.mn)) != s.valid {
- t.Errorf("Expected %v for %q using regexp matching", s.valid, s.mn)
- }
- }
-}
diff --git a/vendor/github.com/prometheus/common/model/signature_test.go b/vendor/github.com/prometheus/common/model/signature_test.go
deleted file mode 100644
index d59c8a8c3..000000000
--- a/vendor/github.com/prometheus/common/model/signature_test.go
+++ /dev/null
@@ -1,314 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "runtime"
- "sync"
- "testing"
-)
-
-func TestLabelsToSignature(t *testing.T) {
- var scenarios = []struct {
- in map[string]string
- out uint64
- }{
- {
- in: map[string]string{},
- out: 14695981039346656037,
- },
- {
- in: map[string]string{"name": "garland, briggs", "fear": "love is not enough"},
- out: 5799056148416392346,
- },
- }
-
- for i, scenario := range scenarios {
- actual := LabelsToSignature(scenario.in)
-
- if actual != scenario.out {
- t.Errorf("%d. expected %d, got %d", i, scenario.out, actual)
- }
- }
-}
-
-func TestMetricToFingerprint(t *testing.T) {
- var scenarios = []struct {
- in LabelSet
- out Fingerprint
- }{
- {
- in: LabelSet{},
- out: 14695981039346656037,
- },
- {
- in: LabelSet{"name": "garland, briggs", "fear": "love is not enough"},
- out: 5799056148416392346,
- },
- }
-
- for i, scenario := range scenarios {
- actual := labelSetToFingerprint(scenario.in)
-
- if actual != scenario.out {
- t.Errorf("%d. expected %d, got %d", i, scenario.out, actual)
- }
- }
-}
-
-func TestMetricToFastFingerprint(t *testing.T) {
- var scenarios = []struct {
- in LabelSet
- out Fingerprint
- }{
- {
- in: LabelSet{},
- out: 14695981039346656037,
- },
- {
- in: LabelSet{"name": "garland, briggs", "fear": "love is not enough"},
- out: 12952432476264840823,
- },
- }
-
- for i, scenario := range scenarios {
- actual := labelSetToFastFingerprint(scenario.in)
-
- if actual != scenario.out {
- t.Errorf("%d. expected %d, got %d", i, scenario.out, actual)
- }
- }
-}
-
-func TestSignatureForLabels(t *testing.T) {
- var scenarios = []struct {
- in Metric
- labels LabelNames
- out uint64
- }{
- {
- in: Metric{},
- labels: nil,
- out: 14695981039346656037,
- },
- {
- in: Metric{},
- labels: LabelNames{"empty"},
- out: 7187873163539638612,
- },
- {
- in: Metric{"name": "garland, briggs", "fear": "love is not enough"},
- labels: LabelNames{"empty"},
- out: 7187873163539638612,
- },
- {
- in: Metric{"name": "garland, briggs", "fear": "love is not enough"},
- labels: LabelNames{"fear", "name"},
- out: 5799056148416392346,
- },
- {
- in: Metric{"name": "garland, briggs", "fear": "love is not enough", "foo": "bar"},
- labels: LabelNames{"fear", "name"},
- out: 5799056148416392346,
- },
- {
- in: Metric{"name": "garland, briggs", "fear": "love is not enough"},
- labels: LabelNames{},
- out: 14695981039346656037,
- },
- {
- in: Metric{"name": "garland, briggs", "fear": "love is not enough"},
- labels: nil,
- out: 14695981039346656037,
- },
- }
-
- for i, scenario := range scenarios {
- actual := SignatureForLabels(scenario.in, scenario.labels...)
-
- if actual != scenario.out {
- t.Errorf("%d. expected %d, got %d", i, scenario.out, actual)
- }
- }
-}
-
-func TestSignatureWithoutLabels(t *testing.T) {
- var scenarios = []struct {
- in Metric
- labels map[LabelName]struct{}
- out uint64
- }{
- {
- in: Metric{},
- labels: nil,
- out: 14695981039346656037,
- },
- {
- in: Metric{"name": "garland, briggs", "fear": "love is not enough"},
- labels: map[LabelName]struct{}{"fear": struct{}{}, "name": struct{}{}},
- out: 14695981039346656037,
- },
- {
- in: Metric{"name": "garland, briggs", "fear": "love is not enough", "foo": "bar"},
- labels: map[LabelName]struct{}{"foo": struct{}{}},
- out: 5799056148416392346,
- },
- {
- in: Metric{"name": "garland, briggs", "fear": "love is not enough"},
- labels: map[LabelName]struct{}{},
- out: 5799056148416392346,
- },
- {
- in: Metric{"name": "garland, briggs", "fear": "love is not enough"},
- labels: nil,
- out: 5799056148416392346,
- },
- }
-
- for i, scenario := range scenarios {
- actual := SignatureWithoutLabels(scenario.in, scenario.labels)
-
- if actual != scenario.out {
- t.Errorf("%d. expected %d, got %d", i, scenario.out, actual)
- }
- }
-}
-
-func benchmarkLabelToSignature(b *testing.B, l map[string]string, e uint64) {
- for i := 0; i < b.N; i++ {
- if a := LabelsToSignature(l); a != e {
- b.Fatalf("expected signature of %d for %s, got %d", e, l, a)
- }
- }
-}
-
-func BenchmarkLabelToSignatureScalar(b *testing.B) {
- benchmarkLabelToSignature(b, nil, 14695981039346656037)
-}
-
-func BenchmarkLabelToSignatureSingle(b *testing.B) {
- benchmarkLabelToSignature(b, map[string]string{"first-label": "first-label-value"}, 5146282821936882169)
-}
-
-func BenchmarkLabelToSignatureDouble(b *testing.B) {
- benchmarkLabelToSignature(b, map[string]string{"first-label": "first-label-value", "second-label": "second-label-value"}, 3195800080984914717)
-}
-
-func BenchmarkLabelToSignatureTriple(b *testing.B) {
- benchmarkLabelToSignature(b, map[string]string{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 13843036195897128121)
-}
-
-func benchmarkMetricToFingerprint(b *testing.B, ls LabelSet, e Fingerprint) {
- for i := 0; i < b.N; i++ {
- if a := labelSetToFingerprint(ls); a != e {
- b.Fatalf("expected signature of %d for %s, got %d", e, ls, a)
- }
- }
-}
-
-func BenchmarkMetricToFingerprintScalar(b *testing.B) {
- benchmarkMetricToFingerprint(b, nil, 14695981039346656037)
-}
-
-func BenchmarkMetricToFingerprintSingle(b *testing.B) {
- benchmarkMetricToFingerprint(b, LabelSet{"first-label": "first-label-value"}, 5146282821936882169)
-}
-
-func BenchmarkMetricToFingerprintDouble(b *testing.B) {
- benchmarkMetricToFingerprint(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value"}, 3195800080984914717)
-}
-
-func BenchmarkMetricToFingerprintTriple(b *testing.B) {
- benchmarkMetricToFingerprint(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 13843036195897128121)
-}
-
-func benchmarkMetricToFastFingerprint(b *testing.B, ls LabelSet, e Fingerprint) {
- for i := 0; i < b.N; i++ {
- if a := labelSetToFastFingerprint(ls); a != e {
- b.Fatalf("expected signature of %d for %s, got %d", e, ls, a)
- }
- }
-}
-
-func BenchmarkMetricToFastFingerprintScalar(b *testing.B) {
- benchmarkMetricToFastFingerprint(b, nil, 14695981039346656037)
-}
-
-func BenchmarkMetricToFastFingerprintSingle(b *testing.B) {
- benchmarkMetricToFastFingerprint(b, LabelSet{"first-label": "first-label-value"}, 5147259542624943964)
-}
-
-func BenchmarkMetricToFastFingerprintDouble(b *testing.B) {
- benchmarkMetricToFastFingerprint(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value"}, 18269973311206963528)
-}
-
-func BenchmarkMetricToFastFingerprintTriple(b *testing.B) {
- benchmarkMetricToFastFingerprint(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 15738406913934009676)
-}
-
-func BenchmarkEmptyLabelSignature(b *testing.B) {
- input := []map[string]string{nil, {}}
-
- var ms runtime.MemStats
- runtime.ReadMemStats(&ms)
-
- alloc := ms.Alloc
-
- for _, labels := range input {
- LabelsToSignature(labels)
- }
-
- runtime.ReadMemStats(&ms)
-
- if got := ms.Alloc; alloc != got {
- b.Fatal("expected LabelsToSignature with empty labels not to perform allocations")
- }
-}
-
-func benchmarkMetricToFastFingerprintConc(b *testing.B, ls LabelSet, e Fingerprint, concLevel int) {
- var start, end sync.WaitGroup
- start.Add(1)
- end.Add(concLevel)
-
- for i := 0; i < concLevel; i++ {
- go func() {
- start.Wait()
- for j := b.N / concLevel; j >= 0; j-- {
- if a := labelSetToFastFingerprint(ls); a != e {
- b.Fatalf("expected signature of %d for %s, got %d", e, ls, a)
- }
- }
- end.Done()
- }()
- }
- b.ResetTimer()
- start.Done()
- end.Wait()
-}
-
-func BenchmarkMetricToFastFingerprintTripleConc1(b *testing.B) {
- benchmarkMetricToFastFingerprintConc(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 15738406913934009676, 1)
-}
-
-func BenchmarkMetricToFastFingerprintTripleConc2(b *testing.B) {
- benchmarkMetricToFastFingerprintConc(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 15738406913934009676, 2)
-}
-
-func BenchmarkMetricToFastFingerprintTripleConc4(b *testing.B) {
- benchmarkMetricToFastFingerprintConc(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 15738406913934009676, 4)
-}
-
-func BenchmarkMetricToFastFingerprintTripleConc8(b *testing.B) {
- benchmarkMetricToFastFingerprintConc(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 15738406913934009676, 8)
-}
diff --git a/vendor/github.com/prometheus/common/model/silence_test.go b/vendor/github.com/prometheus/common/model/silence_test.go
deleted file mode 100644
index 8eaaf0744..000000000
--- a/vendor/github.com/prometheus/common/model/silence_test.go
+++ /dev/null
@@ -1,228 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "strings"
- "testing"
- "time"
-)
-
-func TestMatcherValidate(t *testing.T) {
- var cases = []struct {
- matcher *Matcher
- err string
- }{
- {
- matcher: &Matcher{
- Name: "name",
- Value: "value",
- },
- },
- {
- matcher: &Matcher{
- Name: "name",
- Value: "value",
- IsRegex: true,
- },
- },
- {
- matcher: &Matcher{
- Name: "name!",
- Value: "value",
- },
- err: "invalid name",
- },
- {
- matcher: &Matcher{
- Name: "",
- Value: "value",
- },
- err: "invalid name",
- },
- {
- matcher: &Matcher{
- Name: "name",
- Value: "value\xff",
- },
- err: "invalid value",
- },
- {
- matcher: &Matcher{
- Name: "name",
- Value: "",
- },
- err: "invalid value",
- },
- }
-
- for i, c := range cases {
- err := c.matcher.Validate()
- if err == nil {
- if c.err == "" {
- continue
- }
- t.Errorf("%d. Expected error %q but got none", i, c.err)
- continue
- }
- if c.err == "" && err != nil {
- t.Errorf("%d. Expected no error but got %q", i, err)
- continue
- }
- if !strings.Contains(err.Error(), c.err) {
- t.Errorf("%d. Expected error to contain %q but got %q", i, c.err, err)
- }
- }
-}
-
-func TestSilenceValidate(t *testing.T) {
- ts := time.Now()
-
- var cases = []struct {
- sil *Silence
- err string
- }{
- {
- sil: &Silence{
- Matchers: []*Matcher{
- {Name: "name", Value: "value"},
- },
- StartsAt: ts,
- EndsAt: ts,
- CreatedAt: ts,
- CreatedBy: "name",
- Comment: "comment",
- },
- },
- {
- sil: &Silence{
- Matchers: []*Matcher{
- {Name: "name", Value: "value"},
- {Name: "name", Value: "value"},
- {Name: "name", Value: "value"},
- {Name: "name", Value: "value", IsRegex: true},
- },
- StartsAt: ts,
- EndsAt: ts,
- CreatedAt: ts,
- CreatedBy: "name",
- Comment: "comment",
- },
- },
- {
- sil: &Silence{
- Matchers: []*Matcher{
- {Name: "name", Value: "value"},
- },
- StartsAt: ts,
- EndsAt: ts.Add(-1 * time.Minute),
- CreatedAt: ts,
- CreatedBy: "name",
- Comment: "comment",
- },
- err: "start time must be before end time",
- },
- {
- sil: &Silence{
- Matchers: []*Matcher{
- {Name: "name", Value: "value"},
- },
- StartsAt: ts,
- CreatedAt: ts,
- CreatedBy: "name",
- Comment: "comment",
- },
- err: "end time missing",
- },
- {
- sil: &Silence{
- Matchers: []*Matcher{
- {Name: "name", Value: "value"},
- },
- EndsAt: ts,
- CreatedAt: ts,
- CreatedBy: "name",
- Comment: "comment",
- },
- err: "start time missing",
- },
- {
- sil: &Silence{
- Matchers: []*Matcher{
- {Name: "!name", Value: "value"},
- },
- StartsAt: ts,
- EndsAt: ts,
- CreatedAt: ts,
- CreatedBy: "name",
- Comment: "comment",
- },
- err: "invalid matcher",
- },
- {
- sil: &Silence{
- Matchers: []*Matcher{
- {Name: "name", Value: "value"},
- },
- StartsAt: ts,
- EndsAt: ts,
- CreatedAt: ts,
- CreatedBy: "name",
- },
- err: "comment missing",
- },
- {
- sil: &Silence{
- Matchers: []*Matcher{
- {Name: "name", Value: "value"},
- },
- StartsAt: ts,
- EndsAt: ts,
- CreatedBy: "name",
- Comment: "comment",
- },
- err: "creation timestamp missing",
- },
- {
- sil: &Silence{
- Matchers: []*Matcher{
- {Name: "name", Value: "value"},
- },
- StartsAt: ts,
- EndsAt: ts,
- CreatedAt: ts,
- Comment: "comment",
- },
- err: "creator information missing",
- },
- }
-
- for i, c := range cases {
- err := c.sil.Validate()
- if err == nil {
- if c.err == "" {
- continue
- }
- t.Errorf("%d. Expected error %q but got none", i, c.err)
- continue
- }
- if c.err == "" && err != nil {
- t.Errorf("%d. Expected no error but got %q", i, err)
- continue
- }
- if !strings.Contains(err.Error(), c.err) {
- t.Errorf("%d. Expected error to contain %q but got %q", i, c.err, err)
- }
- }
-}
diff --git a/vendor/github.com/prometheus/common/model/time_test.go b/vendor/github.com/prometheus/common/model/time_test.go
deleted file mode 100644
index 3efdd65ff..000000000
--- a/vendor/github.com/prometheus/common/model/time_test.go
+++ /dev/null
@@ -1,132 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "testing"
- "time"
-)
-
-func TestComparators(t *testing.T) {
- t1a := TimeFromUnix(0)
- t1b := TimeFromUnix(0)
- t2 := TimeFromUnix(2*second - 1)
-
- if !t1a.Equal(t1b) {
- t.Fatalf("Expected %s to be equal to %s", t1a, t1b)
- }
- if t1a.Equal(t2) {
- t.Fatalf("Expected %s to not be equal to %s", t1a, t2)
- }
-
- if !t1a.Before(t2) {
- t.Fatalf("Expected %s to be before %s", t1a, t2)
- }
- if t1a.Before(t1b) {
- t.Fatalf("Expected %s to not be before %s", t1a, t1b)
- }
-
- if !t2.After(t1a) {
- t.Fatalf("Expected %s to be after %s", t2, t1a)
- }
- if t1b.After(t1a) {
- t.Fatalf("Expected %s to not be after %s", t1b, t1a)
- }
-}
-
-func TestTimeConversions(t *testing.T) {
- unixSecs := int64(1136239445)
- unixNsecs := int64(123456789)
- unixNano := unixSecs*1e9 + unixNsecs
-
- t1 := time.Unix(unixSecs, unixNsecs-unixNsecs%nanosPerTick)
- t2 := time.Unix(unixSecs, unixNsecs)
-
- ts := TimeFromUnixNano(unixNano)
- if !ts.Time().Equal(t1) {
- t.Fatalf("Expected %s, got %s", t1, ts.Time())
- }
-
- // Test available precision.
- ts = TimeFromUnixNano(t2.UnixNano())
- if !ts.Time().Equal(t1) {
- t.Fatalf("Expected %s, got %s", t1, ts.Time())
- }
-
- if ts.UnixNano() != unixNano-unixNano%nanosPerTick {
- t.Fatalf("Expected %d, got %d", unixNano, ts.UnixNano())
- }
-}
-
-func TestDuration(t *testing.T) {
- duration := time.Second + time.Minute + time.Hour
- goTime := time.Unix(1136239445, 0)
-
- ts := TimeFromUnix(goTime.Unix())
- if !goTime.Add(duration).Equal(ts.Add(duration).Time()) {
- t.Fatalf("Expected %s to be equal to %s", goTime.Add(duration), ts.Add(duration))
- }
-
- earlier := ts.Add(-duration)
- delta := ts.Sub(earlier)
- if delta != duration {
- t.Fatalf("Expected %s to be equal to %s", delta, duration)
- }
-}
-
-func TestParseDuration(t *testing.T) {
- var cases = []struct {
- in string
- out time.Duration
- }{
- {
- in: "0s",
- out: 0,
- }, {
- in: "324ms",
- out: 324 * time.Millisecond,
- }, {
- in: "3s",
- out: 3 * time.Second,
- }, {
- in: "5m",
- out: 5 * time.Minute,
- }, {
- in: "1h",
- out: time.Hour,
- }, {
- in: "4d",
- out: 4 * 24 * time.Hour,
- }, {
- in: "3w",
- out: 3 * 7 * 24 * time.Hour,
- }, {
- in: "10y",
- out: 10 * 365 * 24 * time.Hour,
- },
- }
-
- for _, c := range cases {
- d, err := ParseDuration(c.in)
- if err != nil {
- t.Errorf("Unexpected error on input %q", c.in)
- }
- if time.Duration(d) != c.out {
- t.Errorf("Expected %v but got %v", c.out, d)
- }
- if d.String() != c.in {
- t.Errorf("Expected duration string %q but got %q", c.in, d.String())
- }
- }
-}
diff --git a/vendor/github.com/prometheus/common/model/value_test.go b/vendor/github.com/prometheus/common/model/value_test.go
deleted file mode 100644
index b97dcf84c..000000000
--- a/vendor/github.com/prometheus/common/model/value_test.go
+++ /dev/null
@@ -1,468 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "encoding/json"
- "math"
- "reflect"
- "sort"
- "testing"
-)
-
-func TestEqualValues(t *testing.T) {
- tests := map[string]struct {
- in1, in2 SampleValue
- want bool
- }{
- "equal floats": {
- in1: 3.14,
- in2: 3.14,
- want: true,
- },
- "unequal floats": {
- in1: 3.14,
- in2: 3.1415,
- want: false,
- },
- "positive inifinities": {
- in1: SampleValue(math.Inf(+1)),
- in2: SampleValue(math.Inf(+1)),
- want: true,
- },
- "negative inifinities": {
- in1: SampleValue(math.Inf(-1)),
- in2: SampleValue(math.Inf(-1)),
- want: true,
- },
- "different inifinities": {
- in1: SampleValue(math.Inf(+1)),
- in2: SampleValue(math.Inf(-1)),
- want: false,
- },
- "number and infinity": {
- in1: 42,
- in2: SampleValue(math.Inf(+1)),
- want: false,
- },
- "number and NaN": {
- in1: 42,
- in2: SampleValue(math.NaN()),
- want: false,
- },
- "NaNs": {
- in1: SampleValue(math.NaN()),
- in2: SampleValue(math.NaN()),
- want: true, // !!!
- },
- }
-
- for name, test := range tests {
- got := test.in1.Equal(test.in2)
- if got != test.want {
- t.Errorf("Comparing %s, %f and %f: got %t, want %t", name, test.in1, test.in2, got, test.want)
- }
- }
-}
-
-func TestEqualSamples(t *testing.T) {
- testSample := &Sample{}
-
- tests := map[string]struct {
- in1, in2 *Sample
- want bool
- }{
- "equal pointers": {
- in1: testSample,
- in2: testSample,
- want: true,
- },
- "different metrics": {
- in1: &Sample{Metric: Metric{"foo": "bar"}},
- in2: &Sample{Metric: Metric{"foo": "biz"}},
- want: false,
- },
- "different timestamp": {
- in1: &Sample{Timestamp: 0},
- in2: &Sample{Timestamp: 1},
- want: false,
- },
- "different value": {
- in1: &Sample{Value: 0},
- in2: &Sample{Value: 1},
- want: false,
- },
- "equal samples": {
- in1: &Sample{
- Metric: Metric{"foo": "bar"},
- Timestamp: 0,
- Value: 1,
- },
- in2: &Sample{
- Metric: Metric{"foo": "bar"},
- Timestamp: 0,
- Value: 1,
- },
- want: true,
- },
- }
-
- for name, test := range tests {
- got := test.in1.Equal(test.in2)
- if got != test.want {
- t.Errorf("Comparing %s, %v and %v: got %t, want %t", name, test.in1, test.in2, got, test.want)
- }
- }
-
-}
-
-func TestSamplePairJSON(t *testing.T) {
- input := []struct {
- plain string
- value SamplePair
- }{
- {
- plain: `[1234.567,"123.1"]`,
- value: SamplePair{
- Value: 123.1,
- Timestamp: 1234567,
- },
- },
- }
-
- for _, test := range input {
- b, err := json.Marshal(test.value)
- if err != nil {
- t.Error(err)
- continue
- }
-
- if string(b) != test.plain {
- t.Errorf("encoding error: expected %q, got %q", test.plain, b)
- continue
- }
-
- var sp SamplePair
- err = json.Unmarshal(b, &sp)
- if err != nil {
- t.Error(err)
- continue
- }
-
- if sp != test.value {
- t.Errorf("decoding error: expected %v, got %v", test.value, sp)
- }
- }
-}
-
-func TestSampleJSON(t *testing.T) {
- input := []struct {
- plain string
- value Sample
- }{
- {
- plain: `{"metric":{"__name__":"test_metric"},"value":[1234.567,"123.1"]}`,
- value: Sample{
- Metric: Metric{
- MetricNameLabel: "test_metric",
- },
- Value: 123.1,
- Timestamp: 1234567,
- },
- },
- }
-
- for _, test := range input {
- b, err := json.Marshal(test.value)
- if err != nil {
- t.Error(err)
- continue
- }
-
- if string(b) != test.plain {
- t.Errorf("encoding error: expected %q, got %q", test.plain, b)
- continue
- }
-
- var sv Sample
- err = json.Unmarshal(b, &sv)
- if err != nil {
- t.Error(err)
- continue
- }
-
- if !reflect.DeepEqual(sv, test.value) {
- t.Errorf("decoding error: expected %v, got %v", test.value, sv)
- }
- }
-}
-
-func TestVectorJSON(t *testing.T) {
- input := []struct {
- plain string
- value Vector
- }{
- {
- plain: `[]`,
- value: Vector{},
- },
- {
- plain: `[{"metric":{"__name__":"test_metric"},"value":[1234.567,"123.1"]}]`,
- value: Vector{&Sample{
- Metric: Metric{
- MetricNameLabel: "test_metric",
- },
- Value: 123.1,
- Timestamp: 1234567,
- }},
- },
- {
- plain: `[{"metric":{"__name__":"test_metric"},"value":[1234.567,"123.1"]},{"metric":{"foo":"bar"},"value":[1.234,"+Inf"]}]`,
- value: Vector{
- &Sample{
- Metric: Metric{
- MetricNameLabel: "test_metric",
- },
- Value: 123.1,
- Timestamp: 1234567,
- },
- &Sample{
- Metric: Metric{
- "foo": "bar",
- },
- Value: SampleValue(math.Inf(1)),
- Timestamp: 1234,
- },
- },
- },
- }
-
- for _, test := range input {
- b, err := json.Marshal(test.value)
- if err != nil {
- t.Error(err)
- continue
- }
-
- if string(b) != test.plain {
- t.Errorf("encoding error: expected %q, got %q", test.plain, b)
- continue
- }
-
- var vec Vector
- err = json.Unmarshal(b, &vec)
- if err != nil {
- t.Error(err)
- continue
- }
-
- if !reflect.DeepEqual(vec, test.value) {
- t.Errorf("decoding error: expected %v, got %v", test.value, vec)
- }
- }
-}
-
-func TestScalarJSON(t *testing.T) {
- input := []struct {
- plain string
- value Scalar
- }{
- {
- plain: `[123.456,"456"]`,
- value: Scalar{
- Timestamp: 123456,
- Value: 456,
- },
- },
- {
- plain: `[123123.456,"+Inf"]`,
- value: Scalar{
- Timestamp: 123123456,
- Value: SampleValue(math.Inf(1)),
- },
- },
- {
- plain: `[123123.456,"-Inf"]`,
- value: Scalar{
- Timestamp: 123123456,
- Value: SampleValue(math.Inf(-1)),
- },
- },
- }
-
- for _, test := range input {
- b, err := json.Marshal(test.value)
- if err != nil {
- t.Error(err)
- continue
- }
-
- if string(b) != test.plain {
- t.Errorf("encoding error: expected %q, got %q", test.plain, b)
- continue
- }
-
- var sv Scalar
- err = json.Unmarshal(b, &sv)
- if err != nil {
- t.Error(err)
- continue
- }
-
- if sv != test.value {
- t.Errorf("decoding error: expected %v, got %v", test.value, sv)
- }
- }
-}
-
-func TestStringJSON(t *testing.T) {
- input := []struct {
- plain string
- value String
- }{
- {
- plain: `[123.456,"test"]`,
- value: String{
- Timestamp: 123456,
- Value: "test",
- },
- },
- {
- plain: `[123123.456,"台北"]`,
- value: String{
- Timestamp: 123123456,
- Value: "台北",
- },
- },
- }
-
- for _, test := range input {
- b, err := json.Marshal(test.value)
- if err != nil {
- t.Error(err)
- continue
- }
-
- if string(b) != test.plain {
- t.Errorf("encoding error: expected %q, got %q", test.plain, b)
- continue
- }
-
- var sv String
- err = json.Unmarshal(b, &sv)
- if err != nil {
- t.Error(err)
- continue
- }
-
- if sv != test.value {
- t.Errorf("decoding error: expected %v, got %v", test.value, sv)
- }
- }
-}
-
-func TestVectorSort(t *testing.T) {
- input := Vector{
- &Sample{
- Metric: Metric{
- MetricNameLabel: "A",
- },
- Timestamp: 1,
- },
- &Sample{
- Metric: Metric{
- MetricNameLabel: "A",
- },
- Timestamp: 2,
- },
- &Sample{
- Metric: Metric{
- MetricNameLabel: "C",
- },
- Timestamp: 1,
- },
- &Sample{
- Metric: Metric{
- MetricNameLabel: "C",
- },
- Timestamp: 2,
- },
- &Sample{
- Metric: Metric{
- MetricNameLabel: "B",
- },
- Timestamp: 1,
- },
- &Sample{
- Metric: Metric{
- MetricNameLabel: "B",
- },
- Timestamp: 2,
- },
- }
-
- expected := Vector{
- &Sample{
- Metric: Metric{
- MetricNameLabel: "A",
- },
- Timestamp: 1,
- },
- &Sample{
- Metric: Metric{
- MetricNameLabel: "A",
- },
- Timestamp: 2,
- },
- &Sample{
- Metric: Metric{
- MetricNameLabel: "B",
- },
- Timestamp: 1,
- },
- &Sample{
- Metric: Metric{
- MetricNameLabel: "B",
- },
- Timestamp: 2,
- },
- &Sample{
- Metric: Metric{
- MetricNameLabel: "C",
- },
- Timestamp: 1,
- },
- &Sample{
- Metric: Metric{
- MetricNameLabel: "C",
- },
- Timestamp: 2,
- },
- }
-
- sort.Sort(input)
-
- for i, actual := range input {
- actualFp := actual.Metric.Fingerprint()
- expectedFp := expected[i].Metric.Fingerprint()
-
- if actualFp != expectedFp {
- t.Fatalf("%d. Incorrect fingerprint. Got %s; want %s", i, actualFp.String(), expectedFp.String())
- }
-
- if actual.Timestamp != expected[i].Timestamp {
- t.Fatalf("%d. Incorrect timestamp. Got %s; want %s", i, actual.Timestamp, expected[i].Timestamp)
- }
- }
-}
diff --git a/vendor/github.com/rcrowley/go-metrics/counter_test.go b/vendor/github.com/rcrowley/go-metrics/counter_test.go
deleted file mode 100644
index dfb03b4e8..000000000
--- a/vendor/github.com/rcrowley/go-metrics/counter_test.go
+++ /dev/null
@@ -1,77 +0,0 @@
-package metrics
-
-import "testing"
-
-func BenchmarkCounter(b *testing.B) {
- c := NewCounter()
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- c.Inc(1)
- }
-}
-
-func TestCounterClear(t *testing.T) {
- c := NewCounter()
- c.Inc(1)
- c.Clear()
- if count := c.Count(); 0 != count {
- t.Errorf("c.Count(): 0 != %v\n", count)
- }
-}
-
-func TestCounterDec1(t *testing.T) {
- c := NewCounter()
- c.Dec(1)
- if count := c.Count(); -1 != count {
- t.Errorf("c.Count(): -1 != %v\n", count)
- }
-}
-
-func TestCounterDec2(t *testing.T) {
- c := NewCounter()
- c.Dec(2)
- if count := c.Count(); -2 != count {
- t.Errorf("c.Count(): -2 != %v\n", count)
- }
-}
-
-func TestCounterInc1(t *testing.T) {
- c := NewCounter()
- c.Inc(1)
- if count := c.Count(); 1 != count {
- t.Errorf("c.Count(): 1 != %v\n", count)
- }
-}
-
-func TestCounterInc2(t *testing.T) {
- c := NewCounter()
- c.Inc(2)
- if count := c.Count(); 2 != count {
- t.Errorf("c.Count(): 2 != %v\n", count)
- }
-}
-
-func TestCounterSnapshot(t *testing.T) {
- c := NewCounter()
- c.Inc(1)
- snapshot := c.Snapshot()
- c.Inc(1)
- if count := snapshot.Count(); 1 != count {
- t.Errorf("c.Count(): 1 != %v\n", count)
- }
-}
-
-func TestCounterZero(t *testing.T) {
- c := NewCounter()
- if count := c.Count(); 0 != count {
- t.Errorf("c.Count(): 0 != %v\n", count)
- }
-}
-
-func TestGetOrRegisterCounter(t *testing.T) {
- r := NewRegistry()
- NewRegisteredCounter("foo", r).Inc(47)
- if c := GetOrRegisterCounter("foo", r); 47 != c.Count() {
- t.Fatal(c)
- }
-}
diff --git a/vendor/github.com/rcrowley/go-metrics/debug_test.go b/vendor/github.com/rcrowley/go-metrics/debug_test.go
deleted file mode 100644
index 07eb86784..000000000
--- a/vendor/github.com/rcrowley/go-metrics/debug_test.go
+++ /dev/null
@@ -1,48 +0,0 @@
-package metrics
-
-import (
- "runtime"
- "runtime/debug"
- "testing"
- "time"
-)
-
-func BenchmarkDebugGCStats(b *testing.B) {
- r := NewRegistry()
- RegisterDebugGCStats(r)
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- CaptureDebugGCStatsOnce(r)
- }
-}
-
-func TestDebugGCStatsBlocking(t *testing.T) {
- if g := runtime.GOMAXPROCS(0); g < 2 {
- t.Skipf("skipping TestDebugGCMemStatsBlocking with GOMAXPROCS=%d\n", g)
- return
- }
- ch := make(chan int)
- go testDebugGCStatsBlocking(ch)
- var gcStats debug.GCStats
- t0 := time.Now()
- debug.ReadGCStats(&gcStats)
- t1 := time.Now()
- t.Log("i++ during debug.ReadGCStats:", <-ch)
- go testDebugGCStatsBlocking(ch)
- d := t1.Sub(t0)
- t.Log(d)
- time.Sleep(d)
- t.Log("i++ during time.Sleep:", <-ch)
-}
-
-func testDebugGCStatsBlocking(ch chan int) {
- i := 0
- for {
- select {
- case ch <- i:
- return
- default:
- i++
- }
- }
-}
diff --git a/vendor/github.com/rcrowley/go-metrics/ewma_test.go b/vendor/github.com/rcrowley/go-metrics/ewma_test.go
deleted file mode 100644
index 058ae2d98..000000000
--- a/vendor/github.com/rcrowley/go-metrics/ewma_test.go
+++ /dev/null
@@ -1,258 +0,0 @@
-package metrics
-
-import (
- "math/rand"
- "sync"
- "testing"
- "time"
-)
-
-func BenchmarkEWMA(b *testing.B) {
- a := NewEWMA1()
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- a.Update(1)
- a.Tick()
- }
-}
-
-func BenchmarkEWMAParallel(b *testing.B) {
- a := NewEWMA1()
- b.ResetTimer()
-
- b.RunParallel(func(pb *testing.PB) {
- for pb.Next() {
- a.Update(1)
- a.Tick()
- }
- })
-}
-
-// exercise race detector
-func TestEWMAConcurrency(t *testing.T) {
- rand.Seed(time.Now().Unix())
- a := NewEWMA1()
- wg := &sync.WaitGroup{}
- reps := 100
- for i := 0; i < reps; i++ {
- wg.Add(1)
- go func(ewma EWMA, wg *sync.WaitGroup) {
- a.Update(rand.Int63())
- wg.Done()
- }(a, wg)
- }
- wg.Wait()
-}
-
-func TestEWMA1(t *testing.T) {
- a := NewEWMA1()
- a.Update(3)
- a.Tick()
- if rate := a.Rate(); 0.6 != rate {
- t.Errorf("initial a.Rate(): 0.6 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.22072766470286553 != rate {
- t.Errorf("1 minute a.Rate(): 0.22072766470286553 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.08120116994196772 != rate {
- t.Errorf("2 minute a.Rate(): 0.08120116994196772 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.029872241020718428 != rate {
- t.Errorf("3 minute a.Rate(): 0.029872241020718428 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.01098938333324054 != rate {
- t.Errorf("4 minute a.Rate(): 0.01098938333324054 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.004042768199451294 != rate {
- t.Errorf("5 minute a.Rate(): 0.004042768199451294 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.0014872513059998212 != rate {
- t.Errorf("6 minute a.Rate(): 0.0014872513059998212 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.0005471291793327122 != rate {
- t.Errorf("7 minute a.Rate(): 0.0005471291793327122 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.00020127757674150815 != rate {
- t.Errorf("8 minute a.Rate(): 0.00020127757674150815 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 7.404588245200814e-05 != rate {
- t.Errorf("9 minute a.Rate(): 7.404588245200814e-05 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 2.7239957857491083e-05 != rate {
- t.Errorf("10 minute a.Rate(): 2.7239957857491083e-05 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 1.0021020474147462e-05 != rate {
- t.Errorf("11 minute a.Rate(): 1.0021020474147462e-05 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 3.6865274119969525e-06 != rate {
- t.Errorf("12 minute a.Rate(): 3.6865274119969525e-06 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 1.3561976441886433e-06 != rate {
- t.Errorf("13 minute a.Rate(): 1.3561976441886433e-06 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 4.989172314621449e-07 != rate {
- t.Errorf("14 minute a.Rate(): 4.989172314621449e-07 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 1.8354139230109722e-07 != rate {
- t.Errorf("15 minute a.Rate(): 1.8354139230109722e-07 != %v\n", rate)
- }
-}
-
-func TestEWMA5(t *testing.T) {
- a := NewEWMA5()
- a.Update(3)
- a.Tick()
- if rate := a.Rate(); 0.6 != rate {
- t.Errorf("initial a.Rate(): 0.6 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.49123845184678905 != rate {
- t.Errorf("1 minute a.Rate(): 0.49123845184678905 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.4021920276213837 != rate {
- t.Errorf("2 minute a.Rate(): 0.4021920276213837 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.32928698165641596 != rate {
- t.Errorf("3 minute a.Rate(): 0.32928698165641596 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.269597378470333 != rate {
- t.Errorf("4 minute a.Rate(): 0.269597378470333 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.2207276647028654 != rate {
- t.Errorf("5 minute a.Rate(): 0.2207276647028654 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.18071652714732128 != rate {
- t.Errorf("6 minute a.Rate(): 0.18071652714732128 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.14795817836496392 != rate {
- t.Errorf("7 minute a.Rate(): 0.14795817836496392 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.12113791079679326 != rate {
- t.Errorf("8 minute a.Rate(): 0.12113791079679326 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.09917933293295193 != rate {
- t.Errorf("9 minute a.Rate(): 0.09917933293295193 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.08120116994196763 != rate {
- t.Errorf("10 minute a.Rate(): 0.08120116994196763 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.06648189501740036 != rate {
- t.Errorf("11 minute a.Rate(): 0.06648189501740036 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.05443077197364752 != rate {
- t.Errorf("12 minute a.Rate(): 0.05443077197364752 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.04456414692860035 != rate {
- t.Errorf("13 minute a.Rate(): 0.04456414692860035 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.03648603757513079 != rate {
- t.Errorf("14 minute a.Rate(): 0.03648603757513079 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.0298722410207183831020718428 != rate {
- t.Errorf("15 minute a.Rate(): 0.0298722410207183831020718428 != %v\n", rate)
- }
-}
-
-func TestEWMA15(t *testing.T) {
- a := NewEWMA15()
- a.Update(3)
- a.Tick()
- if rate := a.Rate(); 0.6 != rate {
- t.Errorf("initial a.Rate(): 0.6 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.5613041910189706 != rate {
- t.Errorf("1 minute a.Rate(): 0.5613041910189706 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.5251039914257684 != rate {
- t.Errorf("2 minute a.Rate(): 0.5251039914257684 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.4912384518467888184678905 != rate {
- t.Errorf("3 minute a.Rate(): 0.4912384518467888184678905 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.459557003018789 != rate {
- t.Errorf("4 minute a.Rate(): 0.459557003018789 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.4299187863442732 != rate {
- t.Errorf("5 minute a.Rate(): 0.4299187863442732 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.4021920276213831 != rate {
- t.Errorf("6 minute a.Rate(): 0.4021920276213831 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.37625345116383313 != rate {
- t.Errorf("7 minute a.Rate(): 0.37625345116383313 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.3519877317060185 != rate {
- t.Errorf("8 minute a.Rate(): 0.3519877317060185 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.3292869816564153165641596 != rate {
- t.Errorf("9 minute a.Rate(): 0.3292869816564153165641596 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.3080502714195546 != rate {
- t.Errorf("10 minute a.Rate(): 0.3080502714195546 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.2881831806538789 != rate {
- t.Errorf("11 minute a.Rate(): 0.2881831806538789 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.26959737847033216 != rate {
- t.Errorf("12 minute a.Rate(): 0.26959737847033216 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.2522102307052083 != rate {
- t.Errorf("13 minute a.Rate(): 0.2522102307052083 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.23594443252115815 != rate {
- t.Errorf("14 minute a.Rate(): 0.23594443252115815 != %v\n", rate)
- }
- elapseMinute(a)
- if rate := a.Rate(); 0.2207276647028646247028654470286553 != rate {
- t.Errorf("15 minute a.Rate(): 0.2207276647028646247028654470286553 != %v\n", rate)
- }
-}
-
-func elapseMinute(a EWMA) {
- for i := 0; i < 12; i++ {
- a.Tick()
- }
-}
diff --git a/vendor/github.com/rcrowley/go-metrics/gauge_float64_test.go b/vendor/github.com/rcrowley/go-metrics/gauge_float64_test.go
deleted file mode 100644
index 6769b95f7..000000000
--- a/vendor/github.com/rcrowley/go-metrics/gauge_float64_test.go
+++ /dev/null
@@ -1,69 +0,0 @@
-package metrics
-
-import "testing"
-
-func BenchmarkGuageFloat64(b *testing.B) {
- g := NewGaugeFloat64()
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- g.Update(float64(i))
- }
-}
-
-func BenchmarkGuageFloat64Parallel(b *testing.B) {
- g := NewGaugeFloat64()
- b.ResetTimer()
- b.RunParallel(func(pb *testing.PB) {
- for pb.Next() {
- g.Update(float64(1))
- }
- })
-}
-
-func TestGaugeFloat64(t *testing.T) {
- g := NewGaugeFloat64()
- g.Update(float64(47.0))
- if v := g.Value(); float64(47.0) != v {
- t.Errorf("g.Value(): 47.0 != %v\n", v)
- }
-}
-
-func TestGaugeFloat64Snapshot(t *testing.T) {
- g := NewGaugeFloat64()
- g.Update(float64(47.0))
- snapshot := g.Snapshot()
- g.Update(float64(0))
- if v := snapshot.Value(); float64(47.0) != v {
- t.Errorf("g.Value(): 47.0 != %v\n", v)
- }
-}
-
-func TestGetOrRegisterGaugeFloat64(t *testing.T) {
- r := NewRegistry()
- NewRegisteredGaugeFloat64("foo", r).Update(float64(47.0))
- t.Logf("registry: %v", r)
- if g := GetOrRegisterGaugeFloat64("foo", r); float64(47.0) != g.Value() {
- t.Fatal(g)
- }
-}
-
-func TestFunctionalGaugeFloat64(t *testing.T) {
- var counter float64
- fg := NewFunctionalGaugeFloat64(func() float64 {
- counter++
- return counter
- })
- fg.Value()
- fg.Value()
- if counter != 2 {
- t.Error("counter != 2")
- }
-}
-
-func TestGetOrRegisterFunctionalGaugeFloat64(t *testing.T) {
- r := NewRegistry()
- NewRegisteredFunctionalGaugeFloat64("foo", r, func() float64 { return 47 })
- if g := GetOrRegisterGaugeFloat64("foo", r); 47 != g.Value() {
- t.Fatal(g)
- }
-}
diff --git a/vendor/github.com/rcrowley/go-metrics/gauge_test.go b/vendor/github.com/rcrowley/go-metrics/gauge_test.go
deleted file mode 100644
index d54d6f1c1..000000000
--- a/vendor/github.com/rcrowley/go-metrics/gauge_test.go
+++ /dev/null
@@ -1,87 +0,0 @@
-package metrics
-
-import (
- "fmt"
- "math/rand"
- "sync"
- "testing"
- "time"
-)
-
-func BenchmarkGuage(b *testing.B) {
- g := NewGauge()
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- g.Update(int64(i))
- }
-}
-
-// exercise race detector
-func TestGaugeConcurrency(t *testing.T) {
- rand.Seed(time.Now().Unix())
- g := NewGauge()
- wg := &sync.WaitGroup{}
- reps := 100
- for i := 0; i < reps; i++ {
- wg.Add(1)
- go func(g Gauge, wg *sync.WaitGroup) {
- g.Update(rand.Int63())
- wg.Done()
- }(g, wg)
- }
- wg.Wait()
-}
-
-func TestGauge(t *testing.T) {
- g := NewGauge()
- g.Update(int64(47))
- if v := g.Value(); 47 != v {
- t.Errorf("g.Value(): 47 != %v\n", v)
- }
-}
-
-func TestGaugeSnapshot(t *testing.T) {
- g := NewGauge()
- g.Update(int64(47))
- snapshot := g.Snapshot()
- g.Update(int64(0))
- if v := snapshot.Value(); 47 != v {
- t.Errorf("g.Value(): 47 != %v\n", v)
- }
-}
-
-func TestGetOrRegisterGauge(t *testing.T) {
- r := NewRegistry()
- NewRegisteredGauge("foo", r).Update(47)
- if g := GetOrRegisterGauge("foo", r); 47 != g.Value() {
- t.Fatal(g)
- }
-}
-
-func TestFunctionalGauge(t *testing.T) {
- var counter int64
- fg := NewFunctionalGauge(func() int64 {
- counter++
- return counter
- })
- fg.Value()
- fg.Value()
- if counter != 2 {
- t.Error("counter != 2")
- }
-}
-
-func TestGetOrRegisterFunctionalGauge(t *testing.T) {
- r := NewRegistry()
- NewRegisteredFunctionalGauge("foo", r, func() int64 { return 47 })
- if g := GetOrRegisterGauge("foo", r); 47 != g.Value() {
- t.Fatal(g)
- }
-}
-
-func ExampleGetOrRegisterGauge() {
- m := "server.bytes_sent"
- g := GetOrRegisterGauge(m, nil)
- g.Update(47)
- fmt.Println(g.Value()) // Output: 47
-}
diff --git a/vendor/github.com/rcrowley/go-metrics/graphite_test.go b/vendor/github.com/rcrowley/go-metrics/graphite_test.go
deleted file mode 100644
index c797c781d..000000000
--- a/vendor/github.com/rcrowley/go-metrics/graphite_test.go
+++ /dev/null
@@ -1,22 +0,0 @@
-package metrics
-
-import (
- "net"
- "time"
-)
-
-func ExampleGraphite() {
- addr, _ := net.ResolveTCPAddr("net", ":2003")
- go Graphite(DefaultRegistry, 1*time.Second, "some.prefix", addr)
-}
-
-func ExampleGraphiteWithConfig() {
- addr, _ := net.ResolveTCPAddr("net", ":2003")
- go GraphiteWithConfig(GraphiteConfig{
- Addr: addr,
- Registry: DefaultRegistry,
- FlushInterval: 1 * time.Second,
- DurationUnit: time.Millisecond,
- Percentiles: []float64{0.5, 0.75, 0.99, 0.999},
- })
-}
diff --git a/vendor/github.com/rcrowley/go-metrics/histogram_test.go b/vendor/github.com/rcrowley/go-metrics/histogram_test.go
deleted file mode 100644
index d7f4f0171..000000000
--- a/vendor/github.com/rcrowley/go-metrics/histogram_test.go
+++ /dev/null
@@ -1,95 +0,0 @@
-package metrics
-
-import "testing"
-
-func BenchmarkHistogram(b *testing.B) {
- h := NewHistogram(NewUniformSample(100))
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- h.Update(int64(i))
- }
-}
-
-func TestGetOrRegisterHistogram(t *testing.T) {
- r := NewRegistry()
- s := NewUniformSample(100)
- NewRegisteredHistogram("foo", r, s).Update(47)
- if h := GetOrRegisterHistogram("foo", r, s); 1 != h.Count() {
- t.Fatal(h)
- }
-}
-
-func TestHistogram10000(t *testing.T) {
- h := NewHistogram(NewUniformSample(100000))
- for i := 1; i <= 10000; i++ {
- h.Update(int64(i))
- }
- testHistogram10000(t, h)
-}
-
-func TestHistogramEmpty(t *testing.T) {
- h := NewHistogram(NewUniformSample(100))
- if count := h.Count(); 0 != count {
- t.Errorf("h.Count(): 0 != %v\n", count)
- }
- if min := h.Min(); 0 != min {
- t.Errorf("h.Min(): 0 != %v\n", min)
- }
- if max := h.Max(); 0 != max {
- t.Errorf("h.Max(): 0 != %v\n", max)
- }
- if mean := h.Mean(); 0.0 != mean {
- t.Errorf("h.Mean(): 0.0 != %v\n", mean)
- }
- if stdDev := h.StdDev(); 0.0 != stdDev {
- t.Errorf("h.StdDev(): 0.0 != %v\n", stdDev)
- }
- ps := h.Percentiles([]float64{0.5, 0.75, 0.99})
- if 0.0 != ps[0] {
- t.Errorf("median: 0.0 != %v\n", ps[0])
- }
- if 0.0 != ps[1] {
- t.Errorf("75th percentile: 0.0 != %v\n", ps[1])
- }
- if 0.0 != ps[2] {
- t.Errorf("99th percentile: 0.0 != %v\n", ps[2])
- }
-}
-
-func TestHistogramSnapshot(t *testing.T) {
- h := NewHistogram(NewUniformSample(100000))
- for i := 1; i <= 10000; i++ {
- h.Update(int64(i))
- }
- snapshot := h.Snapshot()
- h.Update(0)
- testHistogram10000(t, snapshot)
-}
-
-func testHistogram10000(t *testing.T, h Histogram) {
- if count := h.Count(); 10000 != count {
- t.Errorf("h.Count(): 10000 != %v\n", count)
- }
- if min := h.Min(); 1 != min {
- t.Errorf("h.Min(): 1 != %v\n", min)
- }
- if max := h.Max(); 10000 != max {
- t.Errorf("h.Max(): 10000 != %v\n", max)
- }
- if mean := h.Mean(); 5000.5 != mean {
- t.Errorf("h.Mean(): 5000.5 != %v\n", mean)
- }
- if stdDev := h.StdDev(); 2886.751331514372 != stdDev {
- t.Errorf("h.StdDev(): 2886.751331514372 != %v\n", stdDev)
- }
- ps := h.Percentiles([]float64{0.5, 0.75, 0.99})
- if 5000.5 != ps[0] {
- t.Errorf("median: 5000.5 != %v\n", ps[0])
- }
- if 7500.75 != ps[1] {
- t.Errorf("75th percentile: 7500.75 != %v\n", ps[1])
- }
- if 9900.99 != ps[2] {
- t.Errorf("99th percentile: 9900.99 != %v\n", ps[2])
- }
-}
diff --git a/vendor/github.com/rcrowley/go-metrics/json_test.go b/vendor/github.com/rcrowley/go-metrics/json_test.go
deleted file mode 100644
index cf70051f7..000000000
--- a/vendor/github.com/rcrowley/go-metrics/json_test.go
+++ /dev/null
@@ -1,28 +0,0 @@
-package metrics
-
-import (
- "bytes"
- "encoding/json"
- "testing"
-)
-
-func TestRegistryMarshallJSON(t *testing.T) {
- b := &bytes.Buffer{}
- enc := json.NewEncoder(b)
- r := NewRegistry()
- r.Register("counter", NewCounter())
- enc.Encode(r)
- if s := b.String(); "{\"counter\":{\"count\":0}}\n" != s {
- t.Fatalf(s)
- }
-}
-
-func TestRegistryWriteJSONOnce(t *testing.T) {
- r := NewRegistry()
- r.Register("counter", NewCounter())
- b := &bytes.Buffer{}
- WriteJSONOnce(r, b)
- if s := b.String(); s != "{\"counter\":{\"count\":0}}\n" {
- t.Fail()
- }
-}
diff --git a/vendor/github.com/rcrowley/go-metrics/meter_test.go b/vendor/github.com/rcrowley/go-metrics/meter_test.go
deleted file mode 100644
index 4235ca241..000000000
--- a/vendor/github.com/rcrowley/go-metrics/meter_test.go
+++ /dev/null
@@ -1,107 +0,0 @@
-package metrics
-
-import (
- "math/rand"
- "sync"
- "testing"
- "time"
-)
-
-func BenchmarkMeter(b *testing.B) {
- m := NewMeter()
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- m.Mark(1)
- }
-}
-
-func BenchmarkMeterParallel(b *testing.B) {
- m := NewMeter()
- b.ResetTimer()
- b.RunParallel(func(pb *testing.PB) {
- for pb.Next() {
- m.Mark(1)
- }
- })
-}
-
-// exercise race detector
-func TestMeterConcurrency(t *testing.T) {
- rand.Seed(time.Now().Unix())
- ma := meterArbiter{
- ticker: time.NewTicker(time.Millisecond),
- meters: make(map[*StandardMeter]struct{}),
- }
- m := newStandardMeter()
- ma.meters[m] = struct{}{}
- go ma.tick()
- wg := &sync.WaitGroup{}
- reps := 100
- for i := 0; i < reps; i++ {
- wg.Add(1)
- go func(m Meter, wg *sync.WaitGroup) {
- m.Mark(1)
- wg.Done()
- }(m, wg)
- }
- wg.Wait()
-}
-
-func TestGetOrRegisterMeter(t *testing.T) {
- r := NewRegistry()
- NewRegisteredMeter("foo", r).Mark(47)
- if m := GetOrRegisterMeter("foo", r); 47 != m.Count() {
- t.Fatal(m)
- }
-}
-
-func TestMeterDecay(t *testing.T) {
- ma := meterArbiter{
- ticker: time.NewTicker(time.Millisecond),
- meters: make(map[*StandardMeter]struct{}),
- }
- m := newStandardMeter()
- ma.meters[m] = struct{}{}
- go ma.tick()
- m.Mark(1)
- rateMean := m.RateMean()
- time.Sleep(100 * time.Millisecond)
- if m.RateMean() >= rateMean {
- t.Error("m.RateMean() didn't decrease")
- }
-}
-
-func TestMeterNonzero(t *testing.T) {
- m := NewMeter()
- m.Mark(3)
- if count := m.Count(); 3 != count {
- t.Errorf("m.Count(): 3 != %v\n", count)
- }
-}
-
-func TestMeterStop(t *testing.T) {
- l := len(arbiter.meters)
- m := NewMeter()
- if len(arbiter.meters) != l+1 {
- t.Errorf("arbiter.meters: %d != %d\n", l+1, len(arbiter.meters))
- }
- m.Stop()
- if len(arbiter.meters) != l {
- t.Errorf("arbiter.meters: %d != %d\n", l, len(arbiter.meters))
- }
-}
-
-func TestMeterSnapshot(t *testing.T) {
- m := NewMeter()
- m.Mark(1)
- if snapshot := m.Snapshot(); m.RateMean() != snapshot.RateMean() {
- t.Fatal(snapshot)
- }
-}
-
-func TestMeterZero(t *testing.T) {
- m := NewMeter()
- if count := m.Count(); 0 != count {
- t.Errorf("m.Count(): 0 != %v\n", count)
- }
-}
diff --git a/vendor/github.com/rcrowley/go-metrics/metrics_test.go b/vendor/github.com/rcrowley/go-metrics/metrics_test.go
deleted file mode 100644
index 726fba347..000000000
--- a/vendor/github.com/rcrowley/go-metrics/metrics_test.go
+++ /dev/null
@@ -1,124 +0,0 @@
-package metrics
-
-import (
- "fmt"
- "io/ioutil"
- "log"
- "sync"
- "testing"
-)
-
-const FANOUT = 128
-
-// Stop the compiler from complaining during debugging.
-var (
- _ = ioutil.Discard
- _ = log.LstdFlags
-)
-
-func BenchmarkMetrics(b *testing.B) {
- r := NewRegistry()
- c := NewRegisteredCounter("counter", r)
- g := NewRegisteredGauge("gauge", r)
- gf := NewRegisteredGaugeFloat64("gaugefloat64", r)
- h := NewRegisteredHistogram("histogram", r, NewUniformSample(100))
- m := NewRegisteredMeter("meter", r)
- t := NewRegisteredTimer("timer", r)
- RegisterDebugGCStats(r)
- RegisterRuntimeMemStats(r)
- b.ResetTimer()
- ch := make(chan bool)
-
- wgD := &sync.WaitGroup{}
- /*
- wgD.Add(1)
- go func() {
- defer wgD.Done()
- //log.Println("go CaptureDebugGCStats")
- for {
- select {
- case <-ch:
- //log.Println("done CaptureDebugGCStats")
- return
- default:
- CaptureDebugGCStatsOnce(r)
- }
- }
- }()
- //*/
-
- wgR := &sync.WaitGroup{}
- //*
- wgR.Add(1)
- go func() {
- defer wgR.Done()
- //log.Println("go CaptureRuntimeMemStats")
- for {
- select {
- case <-ch:
- //log.Println("done CaptureRuntimeMemStats")
- return
- default:
- CaptureRuntimeMemStatsOnce(r)
- }
- }
- }()
- //*/
-
- wgW := &sync.WaitGroup{}
- /*
- wgW.Add(1)
- go func() {
- defer wgW.Done()
- //log.Println("go Write")
- for {
- select {
- case <-ch:
- //log.Println("done Write")
- return
- default:
- WriteOnce(r, ioutil.Discard)
- }
- }
- }()
- //*/
-
- wg := &sync.WaitGroup{}
- wg.Add(FANOUT)
- for i := 0; i < FANOUT; i++ {
- go func(i int) {
- defer wg.Done()
- //log.Println("go", i)
- for i := 0; i < b.N; i++ {
- c.Inc(1)
- g.Update(int64(i))
- gf.Update(float64(i))
- h.Update(int64(i))
- m.Mark(1)
- t.Update(1)
- }
- //log.Println("done", i)
- }(i)
- }
- wg.Wait()
- close(ch)
- wgD.Wait()
- wgR.Wait()
- wgW.Wait()
-}
-
-func Example() {
- c := NewCounter()
- Register("money", c)
- c.Inc(17)
-
- // Threadsafe registration
- t := GetOrRegisterTimer("db.get.latency", nil)
- t.Time(func() {})
- t.Update(1)
-
- fmt.Println(c.Count())
- fmt.Println(t.Min())
- // Output: 17
- // 1
-}
diff --git a/vendor/github.com/rcrowley/go-metrics/opentsdb_test.go b/vendor/github.com/rcrowley/go-metrics/opentsdb_test.go
deleted file mode 100644
index c43728960..000000000
--- a/vendor/github.com/rcrowley/go-metrics/opentsdb_test.go
+++ /dev/null
@@ -1,21 +0,0 @@
-package metrics
-
-import (
- "net"
- "time"
-)
-
-func ExampleOpenTSDB() {
- addr, _ := net.ResolveTCPAddr("net", ":2003")
- go OpenTSDB(DefaultRegistry, 1*time.Second, "some.prefix", addr)
-}
-
-func ExampleOpenTSDBWithConfig() {
- addr, _ := net.ResolveTCPAddr("net", ":2003")
- go OpenTSDBWithConfig(OpenTSDBConfig{
- Addr: addr,
- Registry: DefaultRegistry,
- FlushInterval: 1 * time.Second,
- DurationUnit: time.Millisecond,
- })
-}
diff --git a/vendor/github.com/rcrowley/go-metrics/registry_test.go b/vendor/github.com/rcrowley/go-metrics/registry_test.go
deleted file mode 100644
index 762fe22fa..000000000
--- a/vendor/github.com/rcrowley/go-metrics/registry_test.go
+++ /dev/null
@@ -1,363 +0,0 @@
-package metrics
-
-import (
- "sync"
- "testing"
-)
-
-func BenchmarkRegistry(b *testing.B) {
- r := NewRegistry()
- r.Register("foo", NewCounter())
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- r.Each(func(string, interface{}) {})
- }
-}
-
-func BenchmarkRegistryParallel(b *testing.B) {
- r := NewRegistry()
- b.ResetTimer()
- b.RunParallel(func(pb *testing.PB) {
- for pb.Next() {
- r.GetOrRegister("foo", NewCounter())
- }
- })
-}
-
-func TestRegistry(t *testing.T) {
- r := NewRegistry()
- r.Register("foo", NewCounter())
- i := 0
- r.Each(func(name string, iface interface{}) {
- i++
- if "foo" != name {
- t.Fatal(name)
- }
- if _, ok := iface.(Counter); !ok {
- t.Fatal(iface)
- }
- })
- if 1 != i {
- t.Fatal(i)
- }
- r.Unregister("foo")
- i = 0
- r.Each(func(string, interface{}) { i++ })
- if 0 != i {
- t.Fatal(i)
- }
-}
-
-func TestRegistryDuplicate(t *testing.T) {
- r := NewRegistry()
- if err := r.Register("foo", NewCounter()); nil != err {
- t.Fatal(err)
- }
- if err := r.Register("foo", NewGauge()); nil == err {
- t.Fatal(err)
- }
- i := 0
- r.Each(func(name string, iface interface{}) {
- i++
- if _, ok := iface.(Counter); !ok {
- t.Fatal(iface)
- }
- })
- if 1 != i {
- t.Fatal(i)
- }
-}
-
-func TestRegistryGet(t *testing.T) {
- r := NewRegistry()
- r.Register("foo", NewCounter())
- if count := r.Get("foo").(Counter).Count(); 0 != count {
- t.Fatal(count)
- }
- r.Get("foo").(Counter).Inc(1)
- if count := r.Get("foo").(Counter).Count(); 1 != count {
- t.Fatal(count)
- }
-}
-
-func TestRegistryGetOrRegister(t *testing.T) {
- r := NewRegistry()
-
- // First metric wins with GetOrRegister
- _ = r.GetOrRegister("foo", NewCounter())
- m := r.GetOrRegister("foo", NewGauge())
- if _, ok := m.(Counter); !ok {
- t.Fatal(m)
- }
-
- i := 0
- r.Each(func(name string, iface interface{}) {
- i++
- if name != "foo" {
- t.Fatal(name)
- }
- if _, ok := iface.(Counter); !ok {
- t.Fatal(iface)
- }
- })
- if i != 1 {
- t.Fatal(i)
- }
-}
-
-func TestRegistryGetOrRegisterWithLazyInstantiation(t *testing.T) {
- r := NewRegistry()
-
- // First metric wins with GetOrRegister
- _ = r.GetOrRegister("foo", NewCounter)
- m := r.GetOrRegister("foo", NewGauge)
- if _, ok := m.(Counter); !ok {
- t.Fatal(m)
- }
-
- i := 0
- r.Each(func(name string, iface interface{}) {
- i++
- if name != "foo" {
- t.Fatal(name)
- }
- if _, ok := iface.(Counter); !ok {
- t.Fatal(iface)
- }
- })
- if i != 1 {
- t.Fatal(i)
- }
-}
-
-func TestRegistryUnregister(t *testing.T) {
- l := len(arbiter.meters)
- r := NewRegistry()
- r.Register("foo", NewCounter())
- r.Register("bar", NewMeter())
- r.Register("baz", NewTimer())
- if len(arbiter.meters) != l+2 {
- t.Errorf("arbiter.meters: %d != %d\n", l+2, len(arbiter.meters))
- }
- r.Unregister("foo")
- r.Unregister("bar")
- r.Unregister("baz")
- if len(arbiter.meters) != l {
- t.Errorf("arbiter.meters: %d != %d\n", l+2, len(arbiter.meters))
- }
-}
-
-func TestPrefixedChildRegistryGetOrRegister(t *testing.T) {
- r := NewRegistry()
- pr := NewPrefixedChildRegistry(r, "prefix.")
-
- _ = pr.GetOrRegister("foo", NewCounter())
-
- i := 0
- r.Each(func(name string, m interface{}) {
- i++
- if name != "prefix.foo" {
- t.Fatal(name)
- }
- })
- if i != 1 {
- t.Fatal(i)
- }
-}
-
-func TestPrefixedRegistryGetOrRegister(t *testing.T) {
- r := NewPrefixedRegistry("prefix.")
-
- _ = r.GetOrRegister("foo", NewCounter())
-
- i := 0
- r.Each(func(name string, m interface{}) {
- i++
- if name != "prefix.foo" {
- t.Fatal(name)
- }
- })
- if i != 1 {
- t.Fatal(i)
- }
-}
-
-func TestPrefixedRegistryRegister(t *testing.T) {
- r := NewPrefixedRegistry("prefix.")
- err := r.Register("foo", NewCounter())
- c := NewCounter()
- Register("bar", c)
- if err != nil {
- t.Fatal(err.Error())
- }
-
- i := 0
- r.Each(func(name string, m interface{}) {
- i++
- if name != "prefix.foo" {
- t.Fatal(name)
- }
- })
- if i != 1 {
- t.Fatal(i)
- }
-}
-
-func TestPrefixedRegistryUnregister(t *testing.T) {
- r := NewPrefixedRegistry("prefix.")
-
- _ = r.Register("foo", NewCounter())
-
- i := 0
- r.Each(func(name string, m interface{}) {
- i++
- if name != "prefix.foo" {
- t.Fatal(name)
- }
- })
- if i != 1 {
- t.Fatal(i)
- }
-
- r.Unregister("foo")
-
- i = 0
- r.Each(func(name string, m interface{}) {
- i++
- })
-
- if i != 0 {
- t.Fatal(i)
- }
-}
-
-func TestPrefixedRegistryGet(t *testing.T) {
- pr := NewPrefixedRegistry("prefix.")
- name := "foo"
- pr.Register(name, NewCounter())
-
- fooCounter := pr.Get(name)
- if fooCounter == nil {
- t.Fatal(name)
- }
-}
-
-func TestPrefixedChildRegistryGet(t *testing.T) {
- r := NewRegistry()
- pr := NewPrefixedChildRegistry(r, "prefix.")
- name := "foo"
- pr.Register(name, NewCounter())
- fooCounter := pr.Get(name)
- if fooCounter == nil {
- t.Fatal(name)
- }
-}
-
-func TestChildPrefixedRegistryRegister(t *testing.T) {
- r := NewPrefixedChildRegistry(DefaultRegistry, "prefix.")
- err := r.Register("foo", NewCounter())
- c := NewCounter()
- Register("bar", c)
- if err != nil {
- t.Fatal(err.Error())
- }
-
- i := 0
- r.Each(func(name string, m interface{}) {
- i++
- if name != "prefix.foo" {
- t.Fatal(name)
- }
- })
- if i != 1 {
- t.Fatal(i)
- }
-}
-
-func TestChildPrefixedRegistryOfChildRegister(t *testing.T) {
- r := NewPrefixedChildRegistry(NewRegistry(), "prefix.")
- r2 := NewPrefixedChildRegistry(r, "prefix2.")
- err := r.Register("foo2", NewCounter())
- if err != nil {
- t.Fatal(err.Error())
- }
- err = r2.Register("baz", NewCounter())
- c := NewCounter()
- Register("bars", c)
-
- i := 0
- r2.Each(func(name string, m interface{}) {
- i++
- if name != "prefix.prefix2.baz" {
- //t.Fatal(name)
- }
- })
- if i != 1 {
- t.Fatal(i)
- }
-}
-
-func TestWalkRegistries(t *testing.T) {
- r := NewPrefixedChildRegistry(NewRegistry(), "prefix.")
- r2 := NewPrefixedChildRegistry(r, "prefix2.")
- err := r.Register("foo2", NewCounter())
- if err != nil {
- t.Fatal(err.Error())
- }
- err = r2.Register("baz", NewCounter())
- c := NewCounter()
- Register("bars", c)
-
- _, prefix := findPrefix(r2, "")
- if "prefix.prefix2." != prefix {
- t.Fatal(prefix)
- }
-}
-
-func TestConcurrentRegistryAccess(t *testing.T) {
- r := NewRegistry()
-
- counter := NewCounter()
-
- signalChan := make(chan struct{})
-
- var wg sync.WaitGroup
- for i := 0; i < 10; i++ {
- wg.Add(1)
- go func(dowork chan struct{}) {
- defer wg.Done()
- iface := r.GetOrRegister("foo", counter)
- retCounter, ok := iface.(Counter)
- if !ok {
- t.Fatal("Expected a Counter type")
- }
- if retCounter != counter {
- t.Fatal("Counter references don't match")
- }
- }(signalChan)
- }
-
- close(signalChan) // Closing will cause all go routines to execute at the same time
- wg.Wait() // Wait for all go routines to do their work
-
- // At the end of the test we should still only have a single "foo" Counter
- i := 0
- r.Each(func(name string, iface interface{}) {
- i++
- if "foo" != name {
- t.Fatal(name)
- }
- if _, ok := iface.(Counter); !ok {
- t.Fatal(iface)
- }
- })
- if 1 != i {
- t.Fatal(i)
- }
- r.Unregister("foo")
- i = 0
- r.Each(func(string, interface{}) { i++ })
- if 0 != i {
- t.Fatal(i)
- }
-}
diff --git a/vendor/github.com/rcrowley/go-metrics/runtime_test.go b/vendor/github.com/rcrowley/go-metrics/runtime_test.go
deleted file mode 100644
index ebbfd501a..000000000
--- a/vendor/github.com/rcrowley/go-metrics/runtime_test.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package metrics
-
-import (
- "runtime"
- "testing"
- "time"
-)
-
-func BenchmarkRuntimeMemStats(b *testing.B) {
- r := NewRegistry()
- RegisterRuntimeMemStats(r)
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- CaptureRuntimeMemStatsOnce(r)
- }
-}
-
-func TestRuntimeMemStats(t *testing.T) {
- r := NewRegistry()
- RegisterRuntimeMemStats(r)
- CaptureRuntimeMemStatsOnce(r)
- zero := runtimeMetrics.MemStats.PauseNs.Count() // Get a "zero" since GC may have run before these tests.
- runtime.GC()
- CaptureRuntimeMemStatsOnce(r)
- if count := runtimeMetrics.MemStats.PauseNs.Count(); 1 != count-zero {
- t.Fatal(count - zero)
- }
- runtime.GC()
- runtime.GC()
- CaptureRuntimeMemStatsOnce(r)
- if count := runtimeMetrics.MemStats.PauseNs.Count(); 3 != count-zero {
- t.Fatal(count - zero)
- }
- for i := 0; i < 256; i++ {
- runtime.GC()
- }
- CaptureRuntimeMemStatsOnce(r)
- if count := runtimeMetrics.MemStats.PauseNs.Count(); 259 != count-zero {
- t.Fatal(count - zero)
- }
- for i := 0; i < 257; i++ {
- runtime.GC()
- }
- CaptureRuntimeMemStatsOnce(r)
- if count := runtimeMetrics.MemStats.PauseNs.Count(); 515 != count-zero { // We lost one because there were too many GCs between captures.
- t.Fatal(count - zero)
- }
-}
-
-func TestRuntimeMemStatsNumThread(t *testing.T) {
- r := NewRegistry()
- RegisterRuntimeMemStats(r)
- CaptureRuntimeMemStatsOnce(r)
-
- if value := runtimeMetrics.NumThread.Value(); value < 1 {
- t.Fatalf("got NumThread: %d, wanted at least 1", value)
- }
-}
-
-func TestRuntimeMemStatsBlocking(t *testing.T) {
- if g := runtime.GOMAXPROCS(0); g < 2 {
- t.Skipf("skipping TestRuntimeMemStatsBlocking with GOMAXPROCS=%d\n", g)
- }
- ch := make(chan int)
- go testRuntimeMemStatsBlocking(ch)
- var memStats runtime.MemStats
- t0 := time.Now()
- runtime.ReadMemStats(&memStats)
- t1 := time.Now()
- t.Log("i++ during runtime.ReadMemStats:", <-ch)
- go testRuntimeMemStatsBlocking(ch)
- d := t1.Sub(t0)
- t.Log(d)
- time.Sleep(d)
- t.Log("i++ during time.Sleep:", <-ch)
-}
-
-func testRuntimeMemStatsBlocking(ch chan int) {
- i := 0
- for {
- select {
- case ch <- i:
- return
- default:
- i++
- }
- }
-}
diff --git a/vendor/github.com/rcrowley/go-metrics/sample_test.go b/vendor/github.com/rcrowley/go-metrics/sample_test.go
deleted file mode 100644
index d60e99c5b..000000000
--- a/vendor/github.com/rcrowley/go-metrics/sample_test.go
+++ /dev/null
@@ -1,363 +0,0 @@
-package metrics
-
-import (
- "math/rand"
- "runtime"
- "testing"
- "time"
-)
-
-// Benchmark{Compute,Copy}{1000,1000000} demonstrate that, even for relatively
-// expensive computations like Variance, the cost of copying the Sample, as
-// approximated by a make and copy, is much greater than the cost of the
-// computation for small samples and only slightly less for large samples.
-func BenchmarkCompute1000(b *testing.B) {
- s := make([]int64, 1000)
- for i := 0; i < len(s); i++ {
- s[i] = int64(i)
- }
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- SampleVariance(s)
- }
-}
-func BenchmarkCompute1000000(b *testing.B) {
- s := make([]int64, 1000000)
- for i := 0; i < len(s); i++ {
- s[i] = int64(i)
- }
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- SampleVariance(s)
- }
-}
-func BenchmarkCopy1000(b *testing.B) {
- s := make([]int64, 1000)
- for i := 0; i < len(s); i++ {
- s[i] = int64(i)
- }
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- sCopy := make([]int64, len(s))
- copy(sCopy, s)
- }
-}
-func BenchmarkCopy1000000(b *testing.B) {
- s := make([]int64, 1000000)
- for i := 0; i < len(s); i++ {
- s[i] = int64(i)
- }
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- sCopy := make([]int64, len(s))
- copy(sCopy, s)
- }
-}
-
-func BenchmarkExpDecaySample257(b *testing.B) {
- benchmarkSample(b, NewExpDecaySample(257, 0.015))
-}
-
-func BenchmarkExpDecaySample514(b *testing.B) {
- benchmarkSample(b, NewExpDecaySample(514, 0.015))
-}
-
-func BenchmarkExpDecaySample1028(b *testing.B) {
- benchmarkSample(b, NewExpDecaySample(1028, 0.015))
-}
-
-func BenchmarkUniformSample257(b *testing.B) {
- benchmarkSample(b, NewUniformSample(257))
-}
-
-func BenchmarkUniformSample514(b *testing.B) {
- benchmarkSample(b, NewUniformSample(514))
-}
-
-func BenchmarkUniformSample1028(b *testing.B) {
- benchmarkSample(b, NewUniformSample(1028))
-}
-
-func TestExpDecaySample10(t *testing.T) {
- rand.Seed(1)
- s := NewExpDecaySample(100, 0.99)
- for i := 0; i < 10; i++ {
- s.Update(int64(i))
- }
- if size := s.Count(); 10 != size {
- t.Errorf("s.Count(): 10 != %v\n", size)
- }
- if size := s.Size(); 10 != size {
- t.Errorf("s.Size(): 10 != %v\n", size)
- }
- if l := len(s.Values()); 10 != l {
- t.Errorf("len(s.Values()): 10 != %v\n", l)
- }
- for _, v := range s.Values() {
- if v > 10 || v < 0 {
- t.Errorf("out of range [0, 10): %v\n", v)
- }
- }
-}
-
-func TestExpDecaySample100(t *testing.T) {
- rand.Seed(1)
- s := NewExpDecaySample(1000, 0.01)
- for i := 0; i < 100; i++ {
- s.Update(int64(i))
- }
- if size := s.Count(); 100 != size {
- t.Errorf("s.Count(): 100 != %v\n", size)
- }
- if size := s.Size(); 100 != size {
- t.Errorf("s.Size(): 100 != %v\n", size)
- }
- if l := len(s.Values()); 100 != l {
- t.Errorf("len(s.Values()): 100 != %v\n", l)
- }
- for _, v := range s.Values() {
- if v > 100 || v < 0 {
- t.Errorf("out of range [0, 100): %v\n", v)
- }
- }
-}
-
-func TestExpDecaySample1000(t *testing.T) {
- rand.Seed(1)
- s := NewExpDecaySample(100, 0.99)
- for i := 0; i < 1000; i++ {
- s.Update(int64(i))
- }
- if size := s.Count(); 1000 != size {
- t.Errorf("s.Count(): 1000 != %v\n", size)
- }
- if size := s.Size(); 100 != size {
- t.Errorf("s.Size(): 100 != %v\n", size)
- }
- if l := len(s.Values()); 100 != l {
- t.Errorf("len(s.Values()): 100 != %v\n", l)
- }
- for _, v := range s.Values() {
- if v > 1000 || v < 0 {
- t.Errorf("out of range [0, 1000): %v\n", v)
- }
- }
-}
-
-// This test makes sure that the sample's priority is not amplified by using
-// nanosecond duration since start rather than second duration since start.
-// The priority becomes +Inf quickly after starting if this is done,
-// effectively freezing the set of samples until a rescale step happens.
-func TestExpDecaySampleNanosecondRegression(t *testing.T) {
- rand.Seed(1)
- s := NewExpDecaySample(100, 0.99)
- for i := 0; i < 100; i++ {
- s.Update(10)
- }
- time.Sleep(1 * time.Millisecond)
- for i := 0; i < 100; i++ {
- s.Update(20)
- }
- v := s.Values()
- avg := float64(0)
- for i := 0; i < len(v); i++ {
- avg += float64(v[i])
- }
- avg /= float64(len(v))
- if avg > 16 || avg < 14 {
- t.Errorf("out of range [14, 16]: %v\n", avg)
- }
-}
-
-func TestExpDecaySampleRescale(t *testing.T) {
- s := NewExpDecaySample(2, 0.001).(*ExpDecaySample)
- s.update(time.Now(), 1)
- s.update(time.Now().Add(time.Hour+time.Microsecond), 1)
- for _, v := range s.values.Values() {
- if v.k == 0.0 {
- t.Fatal("v.k == 0.0")
- }
- }
-}
-
-func TestExpDecaySampleSnapshot(t *testing.T) {
- now := time.Now()
- rand.Seed(1)
- s := NewExpDecaySample(100, 0.99)
- for i := 1; i <= 10000; i++ {
- s.(*ExpDecaySample).update(now.Add(time.Duration(i)), int64(i))
- }
- snapshot := s.Snapshot()
- s.Update(1)
- testExpDecaySampleStatistics(t, snapshot)
-}
-
-func TestExpDecaySampleStatistics(t *testing.T) {
- now := time.Now()
- rand.Seed(1)
- s := NewExpDecaySample(100, 0.99)
- for i := 1; i <= 10000; i++ {
- s.(*ExpDecaySample).update(now.Add(time.Duration(i)), int64(i))
- }
- testExpDecaySampleStatistics(t, s)
-}
-
-func TestUniformSample(t *testing.T) {
- rand.Seed(1)
- s := NewUniformSample(100)
- for i := 0; i < 1000; i++ {
- s.Update(int64(i))
- }
- if size := s.Count(); 1000 != size {
- t.Errorf("s.Count(): 1000 != %v\n", size)
- }
- if size := s.Size(); 100 != size {
- t.Errorf("s.Size(): 100 != %v\n", size)
- }
- if l := len(s.Values()); 100 != l {
- t.Errorf("len(s.Values()): 100 != %v\n", l)
- }
- for _, v := range s.Values() {
- if v > 1000 || v < 0 {
- t.Errorf("out of range [0, 100): %v\n", v)
- }
- }
-}
-
-func TestUniformSampleIncludesTail(t *testing.T) {
- rand.Seed(1)
- s := NewUniformSample(100)
- max := 100
- for i := 0; i < max; i++ {
- s.Update(int64(i))
- }
- v := s.Values()
- sum := 0
- exp := (max - 1) * max / 2
- for i := 0; i < len(v); i++ {
- sum += int(v[i])
- }
- if exp != sum {
- t.Errorf("sum: %v != %v\n", exp, sum)
- }
-}
-
-func TestUniformSampleSnapshot(t *testing.T) {
- s := NewUniformSample(100)
- for i := 1; i <= 10000; i++ {
- s.Update(int64(i))
- }
- snapshot := s.Snapshot()
- s.Update(1)
- testUniformSampleStatistics(t, snapshot)
-}
-
-func TestUniformSampleStatistics(t *testing.T) {
- rand.Seed(1)
- s := NewUniformSample(100)
- for i := 1; i <= 10000; i++ {
- s.Update(int64(i))
- }
- testUniformSampleStatistics(t, s)
-}
-
-func benchmarkSample(b *testing.B, s Sample) {
- var memStats runtime.MemStats
- runtime.ReadMemStats(&memStats)
- pauseTotalNs := memStats.PauseTotalNs
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- s.Update(1)
- }
- b.StopTimer()
- runtime.GC()
- runtime.ReadMemStats(&memStats)
- b.Logf("GC cost: %d ns/op", int(memStats.PauseTotalNs-pauseTotalNs)/b.N)
-}
-
-func testExpDecaySampleStatistics(t *testing.T, s Sample) {
- if count := s.Count(); 10000 != count {
- t.Errorf("s.Count(): 10000 != %v\n", count)
- }
- if min := s.Min(); 107 != min {
- t.Errorf("s.Min(): 107 != %v\n", min)
- }
- if max := s.Max(); 10000 != max {
- t.Errorf("s.Max(): 10000 != %v\n", max)
- }
- if mean := s.Mean(); 4965.98 != mean {
- t.Errorf("s.Mean(): 4965.98 != %v\n", mean)
- }
- if stdDev := s.StdDev(); 2959.825156930727 != stdDev {
- t.Errorf("s.StdDev(): 2959.825156930727 != %v\n", stdDev)
- }
- ps := s.Percentiles([]float64{0.5, 0.75, 0.99})
- if 4615 != ps[0] {
- t.Errorf("median: 4615 != %v\n", ps[0])
- }
- if 7672 != ps[1] {
- t.Errorf("75th percentile: 7672 != %v\n", ps[1])
- }
- if 9998.99 != ps[2] {
- t.Errorf("99th percentile: 9998.99 != %v\n", ps[2])
- }
-}
-
-func testUniformSampleStatistics(t *testing.T, s Sample) {
- if count := s.Count(); 10000 != count {
- t.Errorf("s.Count(): 10000 != %v\n", count)
- }
- if min := s.Min(); 37 != min {
- t.Errorf("s.Min(): 37 != %v\n", min)
- }
- if max := s.Max(); 9989 != max {
- t.Errorf("s.Max(): 9989 != %v\n", max)
- }
- if mean := s.Mean(); 4748.14 != mean {
- t.Errorf("s.Mean(): 4748.14 != %v\n", mean)
- }
- if stdDev := s.StdDev(); 2826.684117548333 != stdDev {
- t.Errorf("s.StdDev(): 2826.684117548333 != %v\n", stdDev)
- }
- ps := s.Percentiles([]float64{0.5, 0.75, 0.99})
- if 4599 != ps[0] {
- t.Errorf("median: 4599 != %v\n", ps[0])
- }
- if 7380.5 != ps[1] {
- t.Errorf("75th percentile: 7380.5 != %v\n", ps[1])
- }
- if 9986.429999999998 != ps[2] {
- t.Errorf("99th percentile: 9986.429999999998 != %v\n", ps[2])
- }
-}
-
-// TestUniformSampleConcurrentUpdateCount would expose data race problems with
-// concurrent Update and Count calls on Sample when test is called with -race
-// argument
-func TestUniformSampleConcurrentUpdateCount(t *testing.T) {
- if testing.Short() {
- t.Skip("skipping in short mode")
- }
- s := NewUniformSample(100)
- for i := 0; i < 100; i++ {
- s.Update(int64(i))
- }
- quit := make(chan struct{})
- go func() {
- t := time.NewTicker(10 * time.Millisecond)
- for {
- select {
- case <-t.C:
- s.Update(rand.Int63())
- case <-quit:
- t.Stop()
- return
- }
- }
- }()
- for i := 0; i < 1000; i++ {
- s.Count()
- time.Sleep(5 * time.Millisecond)
- }
- quit <- struct{}{}
-}
diff --git a/vendor/github.com/rcrowley/go-metrics/timer_test.go b/vendor/github.com/rcrowley/go-metrics/timer_test.go
deleted file mode 100644
index f85c9b803..000000000
--- a/vendor/github.com/rcrowley/go-metrics/timer_test.go
+++ /dev/null
@@ -1,101 +0,0 @@
-package metrics
-
-import (
- "fmt"
- "math"
- "testing"
- "time"
-)
-
-func BenchmarkTimer(b *testing.B) {
- tm := NewTimer()
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- tm.Update(1)
- }
-}
-
-func TestGetOrRegisterTimer(t *testing.T) {
- r := NewRegistry()
- NewRegisteredTimer("foo", r).Update(47)
- if tm := GetOrRegisterTimer("foo", r); 1 != tm.Count() {
- t.Fatal(tm)
- }
-}
-
-func TestTimerExtremes(t *testing.T) {
- tm := NewTimer()
- tm.Update(math.MaxInt64)
- tm.Update(0)
- if stdDev := tm.StdDev(); 4.611686018427388e+18 != stdDev {
- t.Errorf("tm.StdDev(): 4.611686018427388e+18 != %v\n", stdDev)
- }
-}
-
-func TestTimerStop(t *testing.T) {
- l := len(arbiter.meters)
- tm := NewTimer()
- if len(arbiter.meters) != l+1 {
- t.Errorf("arbiter.meters: %d != %d\n", l+1, len(arbiter.meters))
- }
- tm.Stop()
- if len(arbiter.meters) != l {
- t.Errorf("arbiter.meters: %d != %d\n", l, len(arbiter.meters))
- }
-}
-
-func TestTimerFunc(t *testing.T) {
- tm := NewTimer()
- tm.Time(func() { time.Sleep(50e6) })
- if max := tm.Max(); 45e6 > max || max > 55e6 {
- t.Errorf("tm.Max(): 45e6 > %v || %v > 55e6\n", max, max)
- }
-}
-
-func TestTimerZero(t *testing.T) {
- tm := NewTimer()
- if count := tm.Count(); 0 != count {
- t.Errorf("tm.Count(): 0 != %v\n", count)
- }
- if min := tm.Min(); 0 != min {
- t.Errorf("tm.Min(): 0 != %v\n", min)
- }
- if max := tm.Max(); 0 != max {
- t.Errorf("tm.Max(): 0 != %v\n", max)
- }
- if mean := tm.Mean(); 0.0 != mean {
- t.Errorf("tm.Mean(): 0.0 != %v\n", mean)
- }
- if stdDev := tm.StdDev(); 0.0 != stdDev {
- t.Errorf("tm.StdDev(): 0.0 != %v\n", stdDev)
- }
- ps := tm.Percentiles([]float64{0.5, 0.75, 0.99})
- if 0.0 != ps[0] {
- t.Errorf("median: 0.0 != %v\n", ps[0])
- }
- if 0.0 != ps[1] {
- t.Errorf("75th percentile: 0.0 != %v\n", ps[1])
- }
- if 0.0 != ps[2] {
- t.Errorf("99th percentile: 0.0 != %v\n", ps[2])
- }
- if rate1 := tm.Rate1(); 0.0 != rate1 {
- t.Errorf("tm.Rate1(): 0.0 != %v\n", rate1)
- }
- if rate5 := tm.Rate5(); 0.0 != rate5 {
- t.Errorf("tm.Rate5(): 0.0 != %v\n", rate5)
- }
- if rate15 := tm.Rate15(); 0.0 != rate15 {
- t.Errorf("tm.Rate15(): 0.0 != %v\n", rate15)
- }
- if rateMean := tm.RateMean(); 0.0 != rateMean {
- t.Errorf("tm.RateMean(): 0.0 != %v\n", rateMean)
- }
-}
-
-func ExampleGetOrRegisterTimer() {
- m := "account.create.latency"
- t := GetOrRegisterTimer(m, nil)
- t.Update(47)
- fmt.Println(t.Max()) // Output: 47
-}
diff --git a/vendor/github.com/rcrowley/go-metrics/writer_test.go b/vendor/github.com/rcrowley/go-metrics/writer_test.go
deleted file mode 100644
index 1aacc2871..000000000
--- a/vendor/github.com/rcrowley/go-metrics/writer_test.go
+++ /dev/null
@@ -1,22 +0,0 @@
-package metrics
-
-import (
- "sort"
- "testing"
-)
-
-func TestMetricsSorting(t *testing.T) {
- var namedMetrics = namedMetricSlice{
- {name: "zzz"},
- {name: "bbb"},
- {name: "fff"},
- {name: "ggg"},
- }
-
- sort.Sort(namedMetrics)
- for i, name := range []string{"bbb", "fff", "ggg", "zzz"} {
- if namedMetrics[i].name != name {
- t.Fail()
- }
- }
-}
diff --git a/vendor/github.com/spf13/pflag/bool_slice_test.go b/vendor/github.com/spf13/pflag/bool_slice_test.go
deleted file mode 100644
index b617dd237..000000000
--- a/vendor/github.com/spf13/pflag/bool_slice_test.go
+++ /dev/null
@@ -1,215 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "strconv"
- "strings"
- "testing"
-)
-
-func setUpBSFlagSet(bsp *[]bool) *FlagSet {
- f := NewFlagSet("test", ContinueOnError)
- f.BoolSliceVar(bsp, "bs", []bool{}, "Command separated list!")
- return f
-}
-
-func setUpBSFlagSetWithDefault(bsp *[]bool) *FlagSet {
- f := NewFlagSet("test", ContinueOnError)
- f.BoolSliceVar(bsp, "bs", []bool{false, true}, "Command separated list!")
- return f
-}
-
-func TestEmptyBS(t *testing.T) {
- var bs []bool
- f := setUpBSFlagSet(&bs)
- err := f.Parse([]string{})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
-
- getBS, err := f.GetBoolSlice("bs")
- if err != nil {
- t.Fatal("got an error from GetBoolSlice():", err)
- }
- if len(getBS) != 0 {
- t.Fatalf("got bs %v with len=%d but expected length=0", getBS, len(getBS))
- }
-}
-
-func TestBS(t *testing.T) {
- var bs []bool
- f := setUpBSFlagSet(&bs)
-
- vals := []string{"1", "F", "TRUE", "0"}
- arg := fmt.Sprintf("--bs=%s", strings.Join(vals, ","))
- err := f.Parse([]string{arg})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- for i, v := range bs {
- b, err := strconv.ParseBool(vals[i])
- if err != nil {
- t.Fatalf("got error: %v", err)
- }
- if b != v {
- t.Fatalf("expected is[%d] to be %s but got: %t", i, vals[i], v)
- }
- }
- getBS, err := f.GetBoolSlice("bs")
- if err != nil {
- t.Fatalf("got error: %v", err)
- }
- for i, v := range getBS {
- b, err := strconv.ParseBool(vals[i])
- if err != nil {
- t.Fatalf("got error: %v", err)
- }
- if b != v {
- t.Fatalf("expected bs[%d] to be %s but got: %t from GetBoolSlice", i, vals[i], v)
- }
- }
-}
-
-func TestBSDefault(t *testing.T) {
- var bs []bool
- f := setUpBSFlagSetWithDefault(&bs)
-
- vals := []string{"false", "T"}
-
- err := f.Parse([]string{})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- for i, v := range bs {
- b, err := strconv.ParseBool(vals[i])
- if err != nil {
- t.Fatalf("got error: %v", err)
- }
- if b != v {
- t.Fatalf("expected bs[%d] to be %t from GetBoolSlice but got: %t", i, b, v)
- }
- }
-
- getBS, err := f.GetBoolSlice("bs")
- if err != nil {
- t.Fatal("got an error from GetBoolSlice():", err)
- }
- for i, v := range getBS {
- b, err := strconv.ParseBool(vals[i])
- if err != nil {
- t.Fatal("got an error from GetBoolSlice():", err)
- }
- if b != v {
- t.Fatalf("expected bs[%d] to be %t from GetBoolSlice but got: %t", i, b, v)
- }
- }
-}
-
-func TestBSWithDefault(t *testing.T) {
- var bs []bool
- f := setUpBSFlagSetWithDefault(&bs)
-
- vals := []string{"FALSE", "1"}
- arg := fmt.Sprintf("--bs=%s", strings.Join(vals, ","))
- err := f.Parse([]string{arg})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- for i, v := range bs {
- b, err := strconv.ParseBool(vals[i])
- if err != nil {
- t.Fatalf("got error: %v", err)
- }
- if b != v {
- t.Fatalf("expected bs[%d] to be %t but got: %t", i, b, v)
- }
- }
-
- getBS, err := f.GetBoolSlice("bs")
- if err != nil {
- t.Fatal("got an error from GetBoolSlice():", err)
- }
- for i, v := range getBS {
- b, err := strconv.ParseBool(vals[i])
- if err != nil {
- t.Fatalf("got error: %v", err)
- }
- if b != v {
- t.Fatalf("expected bs[%d] to be %t from GetBoolSlice but got: %t", i, b, v)
- }
- }
-}
-
-func TestBSCalledTwice(t *testing.T) {
- var bs []bool
- f := setUpBSFlagSet(&bs)
-
- in := []string{"T,F", "T"}
- expected := []bool{true, false, true}
- argfmt := "--bs=%s"
- arg1 := fmt.Sprintf(argfmt, in[0])
- arg2 := fmt.Sprintf(argfmt, in[1])
- err := f.Parse([]string{arg1, arg2})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- for i, v := range bs {
- if expected[i] != v {
- t.Fatalf("expected bs[%d] to be %t but got %t", i, expected[i], v)
- }
- }
-}
-
-func TestBSBadQuoting(t *testing.T) {
-
- tests := []struct {
- Want []bool
- FlagArg []string
- }{
- {
- Want: []bool{true, false, true},
- FlagArg: []string{"1", "0", "true"},
- },
- {
- Want: []bool{true, false},
- FlagArg: []string{"True", "F"},
- },
- {
- Want: []bool{true, false},
- FlagArg: []string{"T", "0"},
- },
- {
- Want: []bool{true, false},
- FlagArg: []string{"1", "0"},
- },
- {
- Want: []bool{true, false, false},
- FlagArg: []string{"true,false", "false"},
- },
- {
- Want: []bool{true, false, false, true, false, true, false},
- FlagArg: []string{`"true,false,false,1,0, T"`, " false "},
- },
- {
- Want: []bool{false, false, true, false, true, false, true},
- FlagArg: []string{`"0, False, T,false , true,F"`, "true"},
- },
- }
-
- for i, test := range tests {
-
- var bs []bool
- f := setUpBSFlagSet(&bs)
-
- if err := f.Parse([]string{fmt.Sprintf("--bs=%s", strings.Join(test.FlagArg, ","))}); err != nil {
- t.Fatalf("flag parsing failed with error: %s\nparsing:\t%#v\nwant:\t\t%#v",
- err, test.FlagArg, test.Want[i])
- }
-
- for j, b := range bs {
- if b != test.Want[j] {
- t.Fatalf("bad value parsed for test %d on bool %d:\nwant:\t%t\ngot:\t%t", i, j, test.Want[j], b)
- }
- }
- }
-}
diff --git a/vendor/github.com/spf13/pflag/bool_test.go b/vendor/github.com/spf13/pflag/bool_test.go
deleted file mode 100644
index a4319e79f..000000000
--- a/vendor/github.com/spf13/pflag/bool_test.go
+++ /dev/null
@@ -1,179 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package pflag
-
-import (
- "bytes"
- "strconv"
- "testing"
-)
-
-// This value can be a boolean ("true", "false") or "maybe"
-type triStateValue int
-
-const (
- triStateFalse triStateValue = 0
- triStateTrue triStateValue = 1
- triStateMaybe triStateValue = 2
-)
-
-const strTriStateMaybe = "maybe"
-
-func (v *triStateValue) IsBoolFlag() bool {
- return true
-}
-
-func (v *triStateValue) Get() interface{} {
- return triStateValue(*v)
-}
-
-func (v *triStateValue) Set(s string) error {
- if s == strTriStateMaybe {
- *v = triStateMaybe
- return nil
- }
- boolVal, err := strconv.ParseBool(s)
- if boolVal {
- *v = triStateTrue
- } else {
- *v = triStateFalse
- }
- return err
-}
-
-func (v *triStateValue) String() string {
- if *v == triStateMaybe {
- return strTriStateMaybe
- }
- return strconv.FormatBool(*v == triStateTrue)
-}
-
-// The type of the flag as required by the pflag.Value interface
-func (v *triStateValue) Type() string {
- return "version"
-}
-
-func setUpFlagSet(tristate *triStateValue) *FlagSet {
- f := NewFlagSet("test", ContinueOnError)
- *tristate = triStateFalse
- flag := f.VarPF(tristate, "tristate", "t", "tristate value (true, maybe or false)")
- flag.NoOptDefVal = "true"
- return f
-}
-
-func TestExplicitTrue(t *testing.T) {
- var tristate triStateValue
- f := setUpFlagSet(&tristate)
- err := f.Parse([]string{"--tristate=true"})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- if tristate != triStateTrue {
- t.Fatal("expected", triStateTrue, "(triStateTrue) but got", tristate, "instead")
- }
-}
-
-func TestImplicitTrue(t *testing.T) {
- var tristate triStateValue
- f := setUpFlagSet(&tristate)
- err := f.Parse([]string{"--tristate"})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- if tristate != triStateTrue {
- t.Fatal("expected", triStateTrue, "(triStateTrue) but got", tristate, "instead")
- }
-}
-
-func TestShortFlag(t *testing.T) {
- var tristate triStateValue
- f := setUpFlagSet(&tristate)
- err := f.Parse([]string{"-t"})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- if tristate != triStateTrue {
- t.Fatal("expected", triStateTrue, "(triStateTrue) but got", tristate, "instead")
- }
-}
-
-func TestShortFlagExtraArgument(t *testing.T) {
- var tristate triStateValue
- f := setUpFlagSet(&tristate)
- // The"maybe"turns into an arg, since short boolean options will only do true/false
- err := f.Parse([]string{"-t", "maybe"})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- if tristate != triStateTrue {
- t.Fatal("expected", triStateTrue, "(triStateTrue) but got", tristate, "instead")
- }
- args := f.Args()
- if len(args) != 1 || args[0] != "maybe" {
- t.Fatal("expected an extra 'maybe' argument to stick around")
- }
-}
-
-func TestExplicitMaybe(t *testing.T) {
- var tristate triStateValue
- f := setUpFlagSet(&tristate)
- err := f.Parse([]string{"--tristate=maybe"})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- if tristate != triStateMaybe {
- t.Fatal("expected", triStateMaybe, "(triStateMaybe) but got", tristate, "instead")
- }
-}
-
-func TestExplicitFalse(t *testing.T) {
- var tristate triStateValue
- f := setUpFlagSet(&tristate)
- err := f.Parse([]string{"--tristate=false"})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- if tristate != triStateFalse {
- t.Fatal("expected", triStateFalse, "(triStateFalse) but got", tristate, "instead")
- }
-}
-
-func TestImplicitFalse(t *testing.T) {
- var tristate triStateValue
- f := setUpFlagSet(&tristate)
- err := f.Parse([]string{})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- if tristate != triStateFalse {
- t.Fatal("expected", triStateFalse, "(triStateFalse) but got", tristate, "instead")
- }
-}
-
-func TestInvalidValue(t *testing.T) {
- var tristate triStateValue
- f := setUpFlagSet(&tristate)
- var buf bytes.Buffer
- f.SetOutput(&buf)
- err := f.Parse([]string{"--tristate=invalid"})
- if err == nil {
- t.Fatal("expected an error but did not get any, tristate has value", tristate)
- }
-}
-
-func TestBoolP(t *testing.T) {
- b := BoolP("bool", "b", false, "bool value in CommandLine")
- c := BoolP("c", "c", false, "other bool value")
- args := []string{"--bool"}
- if err := CommandLine.Parse(args); err != nil {
- t.Error("expected no error, got ", err)
- }
- if *b != true {
- t.Errorf("expected b=true got b=%v", *b)
- }
- if *c != false {
- t.Errorf("expect c=false got c=%v", *c)
- }
-}
diff --git a/vendor/github.com/spf13/pflag/bytes_test.go b/vendor/github.com/spf13/pflag/bytes_test.go
deleted file mode 100644
index cc4a769d9..000000000
--- a/vendor/github.com/spf13/pflag/bytes_test.go
+++ /dev/null
@@ -1,72 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "os"
- "testing"
-)
-
-func setUpBytesHex(bytesHex *[]byte) *FlagSet {
- f := NewFlagSet("test", ContinueOnError)
- f.BytesHexVar(bytesHex, "bytes", []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0}, "Some bytes in HEX")
- f.BytesHexVarP(bytesHex, "bytes2", "B", []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0}, "Some bytes in HEX")
- return f
-}
-
-func TestBytesHex(t *testing.T) {
- testCases := []struct {
- input string
- success bool
- expected string
- }{
- /// Positive cases
- {"", true, ""}, // Is empty string OK ?
- {"01", true, "01"},
- {"0101", true, "0101"},
- {"1234567890abcdef", true, "1234567890ABCDEF"},
- {"1234567890ABCDEF", true, "1234567890ABCDEF"},
-
- // Negative cases
- {"0", false, ""}, // Short string
- {"000", false, ""}, /// Odd-length string
- {"qq", false, ""}, /// non-hex character
- }
-
- devnull, _ := os.Open(os.DevNull)
- os.Stderr = devnull
-
- for i := range testCases {
- var bytesHex []byte
- f := setUpBytesHex(&bytesHex)
-
- tc := &testCases[i]
-
- // --bytes
- args := []string{
- fmt.Sprintf("--bytes=%s", tc.input),
- fmt.Sprintf("-B %s", tc.input),
- fmt.Sprintf("--bytes2=%s", tc.input),
- }
-
- for _, arg := range args {
- err := f.Parse([]string{arg})
-
- if err != nil && tc.success == true {
- t.Errorf("expected success, got %q", err)
- continue
- } else if err == nil && tc.success == false {
- // bytesHex, err := f.GetBytesHex("bytes")
- t.Errorf("expected failure while processing %q", tc.input)
- continue
- } else if tc.success {
- bytesHex, err := f.GetBytesHex("bytes")
- if err != nil {
- t.Errorf("Got error trying to fetch the IP flag: %v", err)
- }
- if fmt.Sprintf("%X", bytesHex) != tc.expected {
- t.Errorf("expected %q, got '%X'", tc.expected, bytesHex)
- }
- }
- }
- }
-}
diff --git a/vendor/github.com/spf13/pflag/count_test.go b/vendor/github.com/spf13/pflag/count_test.go
deleted file mode 100644
index 3785d375a..000000000
--- a/vendor/github.com/spf13/pflag/count_test.go
+++ /dev/null
@@ -1,56 +0,0 @@
-package pflag
-
-import (
- "os"
- "testing"
-)
-
-func setUpCount(c *int) *FlagSet {
- f := NewFlagSet("test", ContinueOnError)
- f.CountVarP(c, "verbose", "v", "a counter")
- return f
-}
-
-func TestCount(t *testing.T) {
- testCases := []struct {
- input []string
- success bool
- expected int
- }{
- {[]string{}, true, 0},
- {[]string{"-v"}, true, 1},
- {[]string{"-vvv"}, true, 3},
- {[]string{"-v", "-v", "-v"}, true, 3},
- {[]string{"-v", "--verbose", "-v"}, true, 3},
- {[]string{"-v=3", "-v"}, true, 4},
- {[]string{"--verbose=0"}, true, 0},
- {[]string{"-v=0"}, true, 0},
- {[]string{"-v=a"}, false, 0},
- }
-
- devnull, _ := os.Open(os.DevNull)
- os.Stderr = devnull
- for i := range testCases {
- var count int
- f := setUpCount(&count)
-
- tc := &testCases[i]
-
- err := f.Parse(tc.input)
- if err != nil && tc.success == true {
- t.Errorf("expected success, got %q", err)
- continue
- } else if err == nil && tc.success == false {
- t.Errorf("expected failure, got success")
- continue
- } else if tc.success {
- c, err := f.GetCount("verbose")
- if err != nil {
- t.Errorf("Got error trying to fetch the counter flag")
- }
- if c != tc.expected {
- t.Errorf("expected %d, got %d", tc.expected, c)
- }
- }
- }
-}
diff --git a/vendor/github.com/spf13/pflag/duration_slice_test.go b/vendor/github.com/spf13/pflag/duration_slice_test.go
deleted file mode 100644
index 489b012ff..000000000
--- a/vendor/github.com/spf13/pflag/duration_slice_test.go
+++ /dev/null
@@ -1,165 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code ds governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package pflag
-
-import (
- "fmt"
- "strings"
- "testing"
- "time"
-)
-
-func setUpDSFlagSet(dsp *[]time.Duration) *FlagSet {
- f := NewFlagSet("test", ContinueOnError)
- f.DurationSliceVar(dsp, "ds", []time.Duration{}, "Command separated list!")
- return f
-}
-
-func setUpDSFlagSetWithDefault(dsp *[]time.Duration) *FlagSet {
- f := NewFlagSet("test", ContinueOnError)
- f.DurationSliceVar(dsp, "ds", []time.Duration{0, 1}, "Command separated list!")
- return f
-}
-
-func TestEmptyDS(t *testing.T) {
- var ds []time.Duration
- f := setUpDSFlagSet(&ds)
- err := f.Parse([]string{})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
-
- getDS, err := f.GetDurationSlice("ds")
- if err != nil {
- t.Fatal("got an error from GetDurationSlice():", err)
- }
- if len(getDS) != 0 {
- t.Fatalf("got ds %v with len=%d but expected length=0", getDS, len(getDS))
- }
-}
-
-func TestDS(t *testing.T) {
- var ds []time.Duration
- f := setUpDSFlagSet(&ds)
-
- vals := []string{"1ns", "2ms", "3m", "4h"}
- arg := fmt.Sprintf("--ds=%s", strings.Join(vals, ","))
- err := f.Parse([]string{arg})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- for i, v := range ds {
- d, err := time.ParseDuration(vals[i])
- if err != nil {
- t.Fatalf("got error: %v", err)
- }
- if d != v {
- t.Fatalf("expected ds[%d] to be %s but got: %d", i, vals[i], v)
- }
- }
- getDS, err := f.GetDurationSlice("ds")
- if err != nil {
- t.Fatalf("got error: %v", err)
- }
- for i, v := range getDS {
- d, err := time.ParseDuration(vals[i])
- if err != nil {
- t.Fatalf("got error: %v", err)
- }
- if d != v {
- t.Fatalf("expected ds[%d] to be %s but got: %d from GetDurationSlice", i, vals[i], v)
- }
- }
-}
-
-func TestDSDefault(t *testing.T) {
- var ds []time.Duration
- f := setUpDSFlagSetWithDefault(&ds)
-
- vals := []string{"0s", "1ns"}
-
- err := f.Parse([]string{})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- for i, v := range ds {
- d, err := time.ParseDuration(vals[i])
- if err != nil {
- t.Fatalf("got error: %v", err)
- }
- if d != v {
- t.Fatalf("expected ds[%d] to be %d but got: %d", i, d, v)
- }
- }
-
- getDS, err := f.GetDurationSlice("ds")
- if err != nil {
- t.Fatal("got an error from GetDurationSlice():", err)
- }
- for i, v := range getDS {
- d, err := time.ParseDuration(vals[i])
- if err != nil {
- t.Fatal("got an error from GetDurationSlice():", err)
- }
- if d != v {
- t.Fatalf("expected ds[%d] to be %d from GetDurationSlice but got: %d", i, d, v)
- }
- }
-}
-
-func TestDSWithDefault(t *testing.T) {
- var ds []time.Duration
- f := setUpDSFlagSetWithDefault(&ds)
-
- vals := []string{"1ns", "2ns"}
- arg := fmt.Sprintf("--ds=%s", strings.Join(vals, ","))
- err := f.Parse([]string{arg})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- for i, v := range ds {
- d, err := time.ParseDuration(vals[i])
- if err != nil {
- t.Fatalf("got error: %v", err)
- }
- if d != v {
- t.Fatalf("expected ds[%d] to be %d but got: %d", i, d, v)
- }
- }
-
- getDS, err := f.GetDurationSlice("ds")
- if err != nil {
- t.Fatal("got an error from GetDurationSlice():", err)
- }
- for i, v := range getDS {
- d, err := time.ParseDuration(vals[i])
- if err != nil {
- t.Fatalf("got error: %v", err)
- }
- if d != v {
- t.Fatalf("expected ds[%d] to be %d from GetDurationSlice but got: %d", i, d, v)
- }
- }
-}
-
-func TestDSCalledTwice(t *testing.T) {
- var ds []time.Duration
- f := setUpDSFlagSet(&ds)
-
- in := []string{"1ns,2ns", "3ns"}
- expected := []time.Duration{1, 2, 3}
- argfmt := "--ds=%s"
- arg1 := fmt.Sprintf(argfmt, in[0])
- arg2 := fmt.Sprintf(argfmt, in[1])
- err := f.Parse([]string{arg1, arg2})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- for i, v := range ds {
- if expected[i] != v {
- t.Fatalf("expected ds[%d] to be %d but got: %d", i, expected[i], v)
- }
- }
-}
diff --git a/vendor/github.com/spf13/pflag/example_test.go b/vendor/github.com/spf13/pflag/example_test.go
deleted file mode 100644
index abd7806fa..000000000
--- a/vendor/github.com/spf13/pflag/example_test.go
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package pflag_test
-
-import (
- "fmt"
-
- "github.com/spf13/pflag"
-)
-
-func ExampleShorthandLookup() {
- name := "verbose"
- short := name[:1]
-
- pflag.BoolP(name, short, false, "verbose output")
-
- // len(short) must be == 1
- flag := pflag.ShorthandLookup(short)
-
- fmt.Println(flag.Name)
-}
-
-func ExampleFlagSet_ShorthandLookup() {
- name := "verbose"
- short := name[:1]
-
- fs := pflag.NewFlagSet("Example", pflag.ContinueOnError)
- fs.BoolP(name, short, false, "verbose output")
-
- // len(short) must be == 1
- flag := fs.ShorthandLookup(short)
-
- fmt.Println(flag.Name)
-}
diff --git a/vendor/github.com/spf13/pflag/export_test.go b/vendor/github.com/spf13/pflag/export_test.go
deleted file mode 100644
index 9318fee00..000000000
--- a/vendor/github.com/spf13/pflag/export_test.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package pflag
-
-import (
- "io/ioutil"
- "os"
-)
-
-// Additional routines compiled into the package only during testing.
-
-// ResetForTesting clears all flag state and sets the usage function as directed.
-// After calling ResetForTesting, parse errors in flag handling will not
-// exit the program.
-func ResetForTesting(usage func()) {
- CommandLine = &FlagSet{
- name: os.Args[0],
- errorHandling: ContinueOnError,
- output: ioutil.Discard,
- }
- Usage = usage
-}
-
-// GetCommandLine returns the default FlagSet.
-func GetCommandLine() *FlagSet {
- return CommandLine
-}
diff --git a/vendor/github.com/spf13/pflag/flag_test.go b/vendor/github.com/spf13/pflag/flag_test.go
deleted file mode 100644
index f600f0aeb..000000000
--- a/vendor/github.com/spf13/pflag/flag_test.go
+++ /dev/null
@@ -1,1259 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package pflag
-
-import (
- "bytes"
- "fmt"
- "io"
- "io/ioutil"
- "net"
- "os"
- "reflect"
- "sort"
- "strconv"
- "strings"
- "testing"
- "time"
-)
-
-var (
- testBool = Bool("test_bool", false, "bool value")
- testInt = Int("test_int", 0, "int value")
- testInt64 = Int64("test_int64", 0, "int64 value")
- testUint = Uint("test_uint", 0, "uint value")
- testUint64 = Uint64("test_uint64", 0, "uint64 value")
- testString = String("test_string", "0", "string value")
- testFloat = Float64("test_float64", 0, "float64 value")
- testDuration = Duration("test_duration", 0, "time.Duration value")
- testOptionalInt = Int("test_optional_int", 0, "optional int value")
- normalizeFlagNameInvocations = 0
-)
-
-func boolString(s string) string {
- if s == "0" {
- return "false"
- }
- return "true"
-}
-
-func TestEverything(t *testing.T) {
- m := make(map[string]*Flag)
- desired := "0"
- visitor := func(f *Flag) {
- if len(f.Name) > 5 && f.Name[0:5] == "test_" {
- m[f.Name] = f
- ok := false
- switch {
- case f.Value.String() == desired:
- ok = true
- case f.Name == "test_bool" && f.Value.String() == boolString(desired):
- ok = true
- case f.Name == "test_duration" && f.Value.String() == desired+"s":
- ok = true
- }
- if !ok {
- t.Error("Visit: bad value", f.Value.String(), "for", f.Name)
- }
- }
- }
- VisitAll(visitor)
- if len(m) != 9 {
- t.Error("VisitAll misses some flags")
- for k, v := range m {
- t.Log(k, *v)
- }
- }
- m = make(map[string]*Flag)
- Visit(visitor)
- if len(m) != 0 {
- t.Errorf("Visit sees unset flags")
- for k, v := range m {
- t.Log(k, *v)
- }
- }
- // Now set all flags
- Set("test_bool", "true")
- Set("test_int", "1")
- Set("test_int64", "1")
- Set("test_uint", "1")
- Set("test_uint64", "1")
- Set("test_string", "1")
- Set("test_float64", "1")
- Set("test_duration", "1s")
- Set("test_optional_int", "1")
- desired = "1"
- Visit(visitor)
- if len(m) != 9 {
- t.Error("Visit fails after set")
- for k, v := range m {
- t.Log(k, *v)
- }
- }
- // Now test they're visited in sort order.
- var flagNames []string
- Visit(func(f *Flag) { flagNames = append(flagNames, f.Name) })
- if !sort.StringsAreSorted(flagNames) {
- t.Errorf("flag names not sorted: %v", flagNames)
- }
-}
-
-func TestUsage(t *testing.T) {
- called := false
- ResetForTesting(func() { called = true })
- if GetCommandLine().Parse([]string{"--x"}) == nil {
- t.Error("parse did not fail for unknown flag")
- }
- if called {
- t.Error("did call Usage while using ContinueOnError")
- }
-}
-
-func TestAddFlagSet(t *testing.T) {
- oldSet := NewFlagSet("old", ContinueOnError)
- newSet := NewFlagSet("new", ContinueOnError)
-
- oldSet.String("flag1", "flag1", "flag1")
- oldSet.String("flag2", "flag2", "flag2")
-
- newSet.String("flag2", "flag2", "flag2")
- newSet.String("flag3", "flag3", "flag3")
-
- oldSet.AddFlagSet(newSet)
-
- if len(oldSet.formal) != 3 {
- t.Errorf("Unexpected result adding a FlagSet to a FlagSet %v", oldSet)
- }
-}
-
-func TestAnnotation(t *testing.T) {
- f := NewFlagSet("shorthand", ContinueOnError)
-
- if err := f.SetAnnotation("missing-flag", "key", nil); err == nil {
- t.Errorf("Expected error setting annotation on non-existent flag")
- }
-
- f.StringP("stringa", "a", "", "string value")
- if err := f.SetAnnotation("stringa", "key", nil); err != nil {
- t.Errorf("Unexpected error setting new nil annotation: %v", err)
- }
- if annotation := f.Lookup("stringa").Annotations["key"]; annotation != nil {
- t.Errorf("Unexpected annotation: %v", annotation)
- }
-
- f.StringP("stringb", "b", "", "string2 value")
- if err := f.SetAnnotation("stringb", "key", []string{"value1"}); err != nil {
- t.Errorf("Unexpected error setting new annotation: %v", err)
- }
- if annotation := f.Lookup("stringb").Annotations["key"]; !reflect.DeepEqual(annotation, []string{"value1"}) {
- t.Errorf("Unexpected annotation: %v", annotation)
- }
-
- if err := f.SetAnnotation("stringb", "key", []string{"value2"}); err != nil {
- t.Errorf("Unexpected error updating annotation: %v", err)
- }
- if annotation := f.Lookup("stringb").Annotations["key"]; !reflect.DeepEqual(annotation, []string{"value2"}) {
- t.Errorf("Unexpected annotation: %v", annotation)
- }
-}
-
-func testParse(f *FlagSet, t *testing.T) {
- if f.Parsed() {
- t.Error("f.Parse() = true before Parse")
- }
- boolFlag := f.Bool("bool", false, "bool value")
- bool2Flag := f.Bool("bool2", false, "bool2 value")
- bool3Flag := f.Bool("bool3", false, "bool3 value")
- intFlag := f.Int("int", 0, "int value")
- int8Flag := f.Int8("int8", 0, "int value")
- int16Flag := f.Int16("int16", 0, "int value")
- int32Flag := f.Int32("int32", 0, "int value")
- int64Flag := f.Int64("int64", 0, "int64 value")
- uintFlag := f.Uint("uint", 0, "uint value")
- uint8Flag := f.Uint8("uint8", 0, "uint value")
- uint16Flag := f.Uint16("uint16", 0, "uint value")
- uint32Flag := f.Uint32("uint32", 0, "uint value")
- uint64Flag := f.Uint64("uint64", 0, "uint64 value")
- stringFlag := f.String("string", "0", "string value")
- float32Flag := f.Float32("float32", 0, "float32 value")
- float64Flag := f.Float64("float64", 0, "float64 value")
- ipFlag := f.IP("ip", net.ParseIP("127.0.0.1"), "ip value")
- maskFlag := f.IPMask("mask", ParseIPv4Mask("0.0.0.0"), "mask value")
- durationFlag := f.Duration("duration", 5*time.Second, "time.Duration value")
- optionalIntNoValueFlag := f.Int("optional-int-no-value", 0, "int value")
- f.Lookup("optional-int-no-value").NoOptDefVal = "9"
- optionalIntWithValueFlag := f.Int("optional-int-with-value", 0, "int value")
- f.Lookup("optional-int-no-value").NoOptDefVal = "9"
- extra := "one-extra-argument"
- args := []string{
- "--bool",
- "--bool2=true",
- "--bool3=false",
- "--int=22",
- "--int8=-8",
- "--int16=-16",
- "--int32=-32",
- "--int64=0x23",
- "--uint", "24",
- "--uint8=8",
- "--uint16=16",
- "--uint32=32",
- "--uint64=25",
- "--string=hello",
- "--float32=-172e12",
- "--float64=2718e28",
- "--ip=10.11.12.13",
- "--mask=255.255.255.0",
- "--duration=2m",
- "--optional-int-no-value",
- "--optional-int-with-value=42",
- extra,
- }
- if err := f.Parse(args); err != nil {
- t.Fatal(err)
- }
- if !f.Parsed() {
- t.Error("f.Parse() = false after Parse")
- }
- if *boolFlag != true {
- t.Error("bool flag should be true, is ", *boolFlag)
- }
- if v, err := f.GetBool("bool"); err != nil || v != *boolFlag {
- t.Error("GetBool does not work.")
- }
- if *bool2Flag != true {
- t.Error("bool2 flag should be true, is ", *bool2Flag)
- }
- if *bool3Flag != false {
- t.Error("bool3 flag should be false, is ", *bool2Flag)
- }
- if *intFlag != 22 {
- t.Error("int flag should be 22, is ", *intFlag)
- }
- if v, err := f.GetInt("int"); err != nil || v != *intFlag {
- t.Error("GetInt does not work.")
- }
- if *int8Flag != -8 {
- t.Error("int8 flag should be 0x23, is ", *int8Flag)
- }
- if *int16Flag != -16 {
- t.Error("int16 flag should be -16, is ", *int16Flag)
- }
- if v, err := f.GetInt8("int8"); err != nil || v != *int8Flag {
- t.Error("GetInt8 does not work.")
- }
- if v, err := f.GetInt16("int16"); err != nil || v != *int16Flag {
- t.Error("GetInt16 does not work.")
- }
- if *int32Flag != -32 {
- t.Error("int32 flag should be 0x23, is ", *int32Flag)
- }
- if v, err := f.GetInt32("int32"); err != nil || v != *int32Flag {
- t.Error("GetInt32 does not work.")
- }
- if *int64Flag != 0x23 {
- t.Error("int64 flag should be 0x23, is ", *int64Flag)
- }
- if v, err := f.GetInt64("int64"); err != nil || v != *int64Flag {
- t.Error("GetInt64 does not work.")
- }
- if *uintFlag != 24 {
- t.Error("uint flag should be 24, is ", *uintFlag)
- }
- if v, err := f.GetUint("uint"); err != nil || v != *uintFlag {
- t.Error("GetUint does not work.")
- }
- if *uint8Flag != 8 {
- t.Error("uint8 flag should be 8, is ", *uint8Flag)
- }
- if v, err := f.GetUint8("uint8"); err != nil || v != *uint8Flag {
- t.Error("GetUint8 does not work.")
- }
- if *uint16Flag != 16 {
- t.Error("uint16 flag should be 16, is ", *uint16Flag)
- }
- if v, err := f.GetUint16("uint16"); err != nil || v != *uint16Flag {
- t.Error("GetUint16 does not work.")
- }
- if *uint32Flag != 32 {
- t.Error("uint32 flag should be 32, is ", *uint32Flag)
- }
- if v, err := f.GetUint32("uint32"); err != nil || v != *uint32Flag {
- t.Error("GetUint32 does not work.")
- }
- if *uint64Flag != 25 {
- t.Error("uint64 flag should be 25, is ", *uint64Flag)
- }
- if v, err := f.GetUint64("uint64"); err != nil || v != *uint64Flag {
- t.Error("GetUint64 does not work.")
- }
- if *stringFlag != "hello" {
- t.Error("string flag should be `hello`, is ", *stringFlag)
- }
- if v, err := f.GetString("string"); err != nil || v != *stringFlag {
- t.Error("GetString does not work.")
- }
- if *float32Flag != -172e12 {
- t.Error("float32 flag should be -172e12, is ", *float32Flag)
- }
- if v, err := f.GetFloat32("float32"); err != nil || v != *float32Flag {
- t.Errorf("GetFloat32 returned %v but float32Flag was %v", v, *float32Flag)
- }
- if *float64Flag != 2718e28 {
- t.Error("float64 flag should be 2718e28, is ", *float64Flag)
- }
- if v, err := f.GetFloat64("float64"); err != nil || v != *float64Flag {
- t.Errorf("GetFloat64 returned %v but float64Flag was %v", v, *float64Flag)
- }
- if !(*ipFlag).Equal(net.ParseIP("10.11.12.13")) {
- t.Error("ip flag should be 10.11.12.13, is ", *ipFlag)
- }
- if v, err := f.GetIP("ip"); err != nil || !v.Equal(*ipFlag) {
- t.Errorf("GetIP returned %v but ipFlag was %v", v, *ipFlag)
- }
- if (*maskFlag).String() != ParseIPv4Mask("255.255.255.0").String() {
- t.Error("mask flag should be 255.255.255.0, is ", (*maskFlag).String())
- }
- if v, err := f.GetIPv4Mask("mask"); err != nil || v.String() != (*maskFlag).String() {
- t.Errorf("GetIP returned %v maskFlag was %v error was %v", v, *maskFlag, err)
- }
- if *durationFlag != 2*time.Minute {
- t.Error("duration flag should be 2m, is ", *durationFlag)
- }
- if v, err := f.GetDuration("duration"); err != nil || v != *durationFlag {
- t.Error("GetDuration does not work.")
- }
- if _, err := f.GetInt("duration"); err == nil {
- t.Error("GetInt parsed a time.Duration?!?!")
- }
- if *optionalIntNoValueFlag != 9 {
- t.Error("optional int flag should be the default value, is ", *optionalIntNoValueFlag)
- }
- if *optionalIntWithValueFlag != 42 {
- t.Error("optional int flag should be 42, is ", *optionalIntWithValueFlag)
- }
- if len(f.Args()) != 1 {
- t.Error("expected one argument, got", len(f.Args()))
- } else if f.Args()[0] != extra {
- t.Errorf("expected argument %q got %q", extra, f.Args()[0])
- }
-}
-
-func testParseAll(f *FlagSet, t *testing.T) {
- if f.Parsed() {
- t.Error("f.Parse() = true before Parse")
- }
- f.BoolP("boola", "a", false, "bool value")
- f.BoolP("boolb", "b", false, "bool2 value")
- f.BoolP("boolc", "c", false, "bool3 value")
- f.BoolP("boold", "d", false, "bool4 value")
- f.StringP("stringa", "s", "0", "string value")
- f.StringP("stringz", "z", "0", "string value")
- f.StringP("stringx", "x", "0", "string value")
- f.StringP("stringy", "y", "0", "string value")
- f.Lookup("stringx").NoOptDefVal = "1"
- args := []string{
- "-ab",
- "-cs=xx",
- "--stringz=something",
- "-d=true",
- "-x",
- "-y",
- "ee",
- }
- want := []string{
- "boola", "true",
- "boolb", "true",
- "boolc", "true",
- "stringa", "xx",
- "stringz", "something",
- "boold", "true",
- "stringx", "1",
- "stringy", "ee",
- }
- got := []string{}
- store := func(flag *Flag, value string) error {
- got = append(got, flag.Name)
- if len(value) > 0 {
- got = append(got, value)
- }
- return nil
- }
- if err := f.ParseAll(args, store); err != nil {
- t.Errorf("expected no error, got %s", err)
- }
- if !f.Parsed() {
- t.Errorf("f.Parse() = false after Parse")
- }
- if !reflect.DeepEqual(got, want) {
- t.Errorf("f.ParseAll() fail to restore the args")
- t.Errorf("Got: %v", got)
- t.Errorf("Want: %v", want)
- }
-}
-
-func testParseWithUnknownFlags(f *FlagSet, t *testing.T) {
- if f.Parsed() {
- t.Error("f.Parse() = true before Parse")
- }
- f.ParseErrorsWhitelist.UnknownFlags = true
-
- f.BoolP("boola", "a", false, "bool value")
- f.BoolP("boolb", "b", false, "bool2 value")
- f.BoolP("boolc", "c", false, "bool3 value")
- f.BoolP("boold", "d", false, "bool4 value")
- f.BoolP("boole", "e", false, "bool4 value")
- f.StringP("stringa", "s", "0", "string value")
- f.StringP("stringz", "z", "0", "string value")
- f.StringP("stringx", "x", "0", "string value")
- f.StringP("stringy", "y", "0", "string value")
- f.StringP("stringo", "o", "0", "string value")
- f.Lookup("stringx").NoOptDefVal = "1"
- args := []string{
- "-ab",
- "-cs=xx",
- "--stringz=something",
- "--unknown1",
- "unknown1Value",
- "-d=true",
- "-x",
- "--unknown2=unknown2Value",
- "-u=unknown3Value",
- "-p",
- "unknown4Value",
- "-q", //another unknown with bool value
- "-y",
- "ee",
- "--unknown7=unknown7value",
- "--stringo=ovalue",
- "--unknown8=unknown8value",
- "--boole",
- "--unknown6",
- }
- want := []string{
- "boola", "true",
- "boolb", "true",
- "boolc", "true",
- "stringa", "xx",
- "stringz", "something",
- "boold", "true",
- "stringx", "1",
- "stringy", "ee",
- "stringo", "ovalue",
- "boole", "true",
- }
- got := []string{}
- store := func(flag *Flag, value string) error {
- got = append(got, flag.Name)
- if len(value) > 0 {
- got = append(got, value)
- }
- return nil
- }
- if err := f.ParseAll(args, store); err != nil {
- t.Errorf("expected no error, got %s", err)
- }
- if !f.Parsed() {
- t.Errorf("f.Parse() = false after Parse")
- }
- if !reflect.DeepEqual(got, want) {
- t.Errorf("f.ParseAll() fail to restore the args")
- t.Errorf("Got: %v", got)
- t.Errorf("Want: %v", want)
- }
-}
-
-func TestShorthand(t *testing.T) {
- f := NewFlagSet("shorthand", ContinueOnError)
- if f.Parsed() {
- t.Error("f.Parse() = true before Parse")
- }
- boolaFlag := f.BoolP("boola", "a", false, "bool value")
- boolbFlag := f.BoolP("boolb", "b", false, "bool2 value")
- boolcFlag := f.BoolP("boolc", "c", false, "bool3 value")
- booldFlag := f.BoolP("boold", "d", false, "bool4 value")
- stringaFlag := f.StringP("stringa", "s", "0", "string value")
- stringzFlag := f.StringP("stringz", "z", "0", "string value")
- extra := "interspersed-argument"
- notaflag := "--i-look-like-a-flag"
- args := []string{
- "-ab",
- extra,
- "-cs",
- "hello",
- "-z=something",
- "-d=true",
- "--",
- notaflag,
- }
- f.SetOutput(ioutil.Discard)
- if err := f.Parse(args); err != nil {
- t.Error("expected no error, got ", err)
- }
- if !f.Parsed() {
- t.Error("f.Parse() = false after Parse")
- }
- if *boolaFlag != true {
- t.Error("boola flag should be true, is ", *boolaFlag)
- }
- if *boolbFlag != true {
- t.Error("boolb flag should be true, is ", *boolbFlag)
- }
- if *boolcFlag != true {
- t.Error("boolc flag should be true, is ", *boolcFlag)
- }
- if *booldFlag != true {
- t.Error("boold flag should be true, is ", *booldFlag)
- }
- if *stringaFlag != "hello" {
- t.Error("stringa flag should be `hello`, is ", *stringaFlag)
- }
- if *stringzFlag != "something" {
- t.Error("stringz flag should be `something`, is ", *stringzFlag)
- }
- if len(f.Args()) != 2 {
- t.Error("expected one argument, got", len(f.Args()))
- } else if f.Args()[0] != extra {
- t.Errorf("expected argument %q got %q", extra, f.Args()[0])
- } else if f.Args()[1] != notaflag {
- t.Errorf("expected argument %q got %q", notaflag, f.Args()[1])
- }
- if f.ArgsLenAtDash() != 1 {
- t.Errorf("expected argsLenAtDash %d got %d", f.ArgsLenAtDash(), 1)
- }
-}
-
-func TestShorthandLookup(t *testing.T) {
- f := NewFlagSet("shorthand", ContinueOnError)
- if f.Parsed() {
- t.Error("f.Parse() = true before Parse")
- }
- f.BoolP("boola", "a", false, "bool value")
- f.BoolP("boolb", "b", false, "bool2 value")
- args := []string{
- "-ab",
- }
- f.SetOutput(ioutil.Discard)
- if err := f.Parse(args); err != nil {
- t.Error("expected no error, got ", err)
- }
- if !f.Parsed() {
- t.Error("f.Parse() = false after Parse")
- }
- flag := f.ShorthandLookup("a")
- if flag == nil {
- t.Errorf("f.ShorthandLookup(\"a\") returned nil")
- }
- if flag.Name != "boola" {
- t.Errorf("f.ShorthandLookup(\"a\") found %q instead of \"boola\"", flag.Name)
- }
- flag = f.ShorthandLookup("")
- if flag != nil {
- t.Errorf("f.ShorthandLookup(\"\") did not return nil")
- }
- defer func() {
- recover()
- }()
- flag = f.ShorthandLookup("ab")
- // should NEVER get here. lookup should panic. defer'd func should recover it.
- t.Errorf("f.ShorthandLookup(\"ab\") did not panic")
-}
-
-func TestParse(t *testing.T) {
- ResetForTesting(func() { t.Error("bad parse") })
- testParse(GetCommandLine(), t)
-}
-
-func TestParseAll(t *testing.T) {
- ResetForTesting(func() { t.Error("bad parse") })
- testParseAll(GetCommandLine(), t)
-}
-
-func TestIgnoreUnknownFlags(t *testing.T) {
- ResetForTesting(func() { t.Error("bad parse") })
- testParseWithUnknownFlags(GetCommandLine(), t)
-}
-
-func TestFlagSetParse(t *testing.T) {
- testParse(NewFlagSet("test", ContinueOnError), t)
-}
-
-func TestChangedHelper(t *testing.T) {
- f := NewFlagSet("changedtest", ContinueOnError)
- f.Bool("changed", false, "changed bool")
- f.Bool("settrue", true, "true to true")
- f.Bool("setfalse", false, "false to false")
- f.Bool("unchanged", false, "unchanged bool")
-
- args := []string{"--changed", "--settrue", "--setfalse=false"}
- if err := f.Parse(args); err != nil {
- t.Error("f.Parse() = false after Parse")
- }
- if !f.Changed("changed") {
- t.Errorf("--changed wasn't changed!")
- }
- if !f.Changed("settrue") {
- t.Errorf("--settrue wasn't changed!")
- }
- if !f.Changed("setfalse") {
- t.Errorf("--setfalse wasn't changed!")
- }
- if f.Changed("unchanged") {
- t.Errorf("--unchanged was changed!")
- }
- if f.Changed("invalid") {
- t.Errorf("--invalid was changed!")
- }
- if f.ArgsLenAtDash() != -1 {
- t.Errorf("Expected argsLenAtDash: %d but got %d", -1, f.ArgsLenAtDash())
- }
-}
-
-func replaceSeparators(name string, from []string, to string) string {
- result := name
- for _, sep := range from {
- result = strings.Replace(result, sep, to, -1)
- }
- // Type convert to indicate normalization has been done.
- return result
-}
-
-func wordSepNormalizeFunc(f *FlagSet, name string) NormalizedName {
- seps := []string{"-", "_"}
- name = replaceSeparators(name, seps, ".")
- normalizeFlagNameInvocations++
-
- return NormalizedName(name)
-}
-
-func testWordSepNormalizedNames(args []string, t *testing.T) {
- f := NewFlagSet("normalized", ContinueOnError)
- if f.Parsed() {
- t.Error("f.Parse() = true before Parse")
- }
- withDashFlag := f.Bool("with-dash-flag", false, "bool value")
- // Set this after some flags have been added and before others.
- f.SetNormalizeFunc(wordSepNormalizeFunc)
- withUnderFlag := f.Bool("with_under_flag", false, "bool value")
- withBothFlag := f.Bool("with-both_flag", false, "bool value")
- if err := f.Parse(args); err != nil {
- t.Fatal(err)
- }
- if !f.Parsed() {
- t.Error("f.Parse() = false after Parse")
- }
- if *withDashFlag != true {
- t.Error("withDashFlag flag should be true, is ", *withDashFlag)
- }
- if *withUnderFlag != true {
- t.Error("withUnderFlag flag should be true, is ", *withUnderFlag)
- }
- if *withBothFlag != true {
- t.Error("withBothFlag flag should be true, is ", *withBothFlag)
- }
-}
-
-func TestWordSepNormalizedNames(t *testing.T) {
- args := []string{
- "--with-dash-flag",
- "--with-under-flag",
- "--with-both-flag",
- }
- testWordSepNormalizedNames(args, t)
-
- args = []string{
- "--with_dash_flag",
- "--with_under_flag",
- "--with_both_flag",
- }
- testWordSepNormalizedNames(args, t)
-
- args = []string{
- "--with-dash_flag",
- "--with-under_flag",
- "--with-both_flag",
- }
- testWordSepNormalizedNames(args, t)
-}
-
-func aliasAndWordSepFlagNames(f *FlagSet, name string) NormalizedName {
- seps := []string{"-", "_"}
-
- oldName := replaceSeparators("old-valid_flag", seps, ".")
- newName := replaceSeparators("valid-flag", seps, ".")
-
- name = replaceSeparators(name, seps, ".")
- switch name {
- case oldName:
- name = newName
- }
-
- return NormalizedName(name)
-}
-
-func TestCustomNormalizedNames(t *testing.T) {
- f := NewFlagSet("normalized", ContinueOnError)
- if f.Parsed() {
- t.Error("f.Parse() = true before Parse")
- }
-
- validFlag := f.Bool("valid-flag", false, "bool value")
- f.SetNormalizeFunc(aliasAndWordSepFlagNames)
- someOtherFlag := f.Bool("some-other-flag", false, "bool value")
-
- args := []string{"--old_valid_flag", "--some-other_flag"}
- if err := f.Parse(args); err != nil {
- t.Fatal(err)
- }
-
- if *validFlag != true {
- t.Errorf("validFlag is %v even though we set the alias --old_valid_falg", *validFlag)
- }
- if *someOtherFlag != true {
- t.Error("someOtherFlag should be true, is ", *someOtherFlag)
- }
-}
-
-// Every flag we add, the name (displayed also in usage) should normalized
-func TestNormalizationFuncShouldChangeFlagName(t *testing.T) {
- // Test normalization after addition
- f := NewFlagSet("normalized", ContinueOnError)
-
- f.Bool("valid_flag", false, "bool value")
- if f.Lookup("valid_flag").Name != "valid_flag" {
- t.Error("The new flag should have the name 'valid_flag' instead of ", f.Lookup("valid_flag").Name)
- }
-
- f.SetNormalizeFunc(wordSepNormalizeFunc)
- if f.Lookup("valid_flag").Name != "valid.flag" {
- t.Error("The new flag should have the name 'valid.flag' instead of ", f.Lookup("valid_flag").Name)
- }
-
- // Test normalization before addition
- f = NewFlagSet("normalized", ContinueOnError)
- f.SetNormalizeFunc(wordSepNormalizeFunc)
-
- f.Bool("valid_flag", false, "bool value")
- if f.Lookup("valid_flag").Name != "valid.flag" {
- t.Error("The new flag should have the name 'valid.flag' instead of ", f.Lookup("valid_flag").Name)
- }
-}
-
-// Related to https://github.com/spf13/cobra/issues/521.
-func TestNormalizationSharedFlags(t *testing.T) {
- f := NewFlagSet("set f", ContinueOnError)
- g := NewFlagSet("set g", ContinueOnError)
- nfunc := wordSepNormalizeFunc
- testName := "valid_flag"
- normName := nfunc(nil, testName)
- if testName == string(normName) {
- t.Error("TestNormalizationSharedFlags meaningless: the original and normalized flag names are identical:", testName)
- }
-
- f.Bool(testName, false, "bool value")
- g.AddFlagSet(f)
-
- f.SetNormalizeFunc(nfunc)
- g.SetNormalizeFunc(nfunc)
-
- if len(f.formal) != 1 {
- t.Error("Normalizing flags should not result in duplications in the flag set:", f.formal)
- }
- if f.orderedFormal[0].Name != string(normName) {
- t.Error("Flag name not normalized")
- }
- for k := range f.formal {
- if k != "valid.flag" {
- t.Errorf("The key in the flag map should have been normalized: wanted \"%s\", got \"%s\" instead", normName, k)
- }
- }
-
- if !reflect.DeepEqual(f.formal, g.formal) || !reflect.DeepEqual(f.orderedFormal, g.orderedFormal) {
- t.Error("Two flag sets sharing the same flags should stay consistent after being normalized. Original set:", f.formal, "Duplicate set:", g.formal)
- }
-}
-
-func TestNormalizationSetFlags(t *testing.T) {
- f := NewFlagSet("normalized", ContinueOnError)
- nfunc := wordSepNormalizeFunc
- testName := "valid_flag"
- normName := nfunc(nil, testName)
- if testName == string(normName) {
- t.Error("TestNormalizationSetFlags meaningless: the original and normalized flag names are identical:", testName)
- }
-
- f.Bool(testName, false, "bool value")
- f.Set(testName, "true")
- f.SetNormalizeFunc(nfunc)
-
- if len(f.formal) != 1 {
- t.Error("Normalizing flags should not result in duplications in the flag set:", f.formal)
- }
- if f.orderedFormal[0].Name != string(normName) {
- t.Error("Flag name not normalized")
- }
- for k := range f.formal {
- if k != "valid.flag" {
- t.Errorf("The key in the flag map should have been normalized: wanted \"%s\", got \"%s\" instead", normName, k)
- }
- }
-
- if !reflect.DeepEqual(f.formal, f.actual) {
- t.Error("The map of set flags should get normalized. Formal:", f.formal, "Actual:", f.actual)
- }
-}
-
-// Declare a user-defined flag type.
-type flagVar []string
-
-func (f *flagVar) String() string {
- return fmt.Sprint([]string(*f))
-}
-
-func (f *flagVar) Set(value string) error {
- *f = append(*f, value)
- return nil
-}
-
-func (f *flagVar) Type() string {
- return "flagVar"
-}
-
-func TestUserDefined(t *testing.T) {
- var flags FlagSet
- flags.Init("test", ContinueOnError)
- var v flagVar
- flags.VarP(&v, "v", "v", "usage")
- if err := flags.Parse([]string{"--v=1", "-v2", "-v", "3"}); err != nil {
- t.Error(err)
- }
- if len(v) != 3 {
- t.Fatal("expected 3 args; got ", len(v))
- }
- expect := "[1 2 3]"
- if v.String() != expect {
- t.Errorf("expected value %q got %q", expect, v.String())
- }
-}
-
-func TestSetOutput(t *testing.T) {
- var flags FlagSet
- var buf bytes.Buffer
- flags.SetOutput(&buf)
- flags.Init("test", ContinueOnError)
- flags.Parse([]string{"--unknown"})
- if out := buf.String(); !strings.Contains(out, "--unknown") {
- t.Logf("expected output mentioning unknown; got %q", out)
- }
-}
-
-// This tests that one can reset the flags. This still works but not well, and is
-// superseded by FlagSet.
-func TestChangingArgs(t *testing.T) {
- ResetForTesting(func() { t.Fatal("bad parse") })
- oldArgs := os.Args
- defer func() { os.Args = oldArgs }()
- os.Args = []string{"cmd", "--before", "subcmd"}
- before := Bool("before", false, "")
- if err := GetCommandLine().Parse(os.Args[1:]); err != nil {
- t.Fatal(err)
- }
- cmd := Arg(0)
- os.Args = []string{"subcmd", "--after", "args"}
- after := Bool("after", false, "")
- Parse()
- args := Args()
-
- if !*before || cmd != "subcmd" || !*after || len(args) != 1 || args[0] != "args" {
- t.Fatalf("expected true subcmd true [args] got %v %v %v %v", *before, cmd, *after, args)
- }
-}
-
-// Test that -help invokes the usage message and returns ErrHelp.
-func TestHelp(t *testing.T) {
- var helpCalled = false
- fs := NewFlagSet("help test", ContinueOnError)
- fs.Usage = func() { helpCalled = true }
- var flag bool
- fs.BoolVar(&flag, "flag", false, "regular flag")
- // Regular flag invocation should work
- err := fs.Parse([]string{"--flag=true"})
- if err != nil {
- t.Fatal("expected no error; got ", err)
- }
- if !flag {
- t.Error("flag was not set by --flag")
- }
- if helpCalled {
- t.Error("help called for regular flag")
- helpCalled = false // reset for next test
- }
- // Help flag should work as expected.
- err = fs.Parse([]string{"--help"})
- if err == nil {
- t.Fatal("error expected")
- }
- if err != ErrHelp {
- t.Fatal("expected ErrHelp; got ", err)
- }
- if !helpCalled {
- t.Fatal("help was not called")
- }
- // If we define a help flag, that should override.
- var help bool
- fs.BoolVar(&help, "help", false, "help flag")
- helpCalled = false
- err = fs.Parse([]string{"--help"})
- if err != nil {
- t.Fatal("expected no error for defined --help; got ", err)
- }
- if helpCalled {
- t.Fatal("help was called; should not have been for defined help flag")
- }
-}
-
-func TestNoInterspersed(t *testing.T) {
- f := NewFlagSet("test", ContinueOnError)
- f.SetInterspersed(false)
- f.Bool("true", true, "always true")
- f.Bool("false", false, "always false")
- err := f.Parse([]string{"--true", "break", "--false"})
- if err != nil {
- t.Fatal("expected no error; got ", err)
- }
- args := f.Args()
- if len(args) != 2 || args[0] != "break" || args[1] != "--false" {
- t.Fatal("expected interspersed options/non-options to fail")
- }
-}
-
-func TestTermination(t *testing.T) {
- f := NewFlagSet("termination", ContinueOnError)
- boolFlag := f.BoolP("bool", "l", false, "bool value")
- if f.Parsed() {
- t.Error("f.Parse() = true before Parse")
- }
- arg1 := "ls"
- arg2 := "-l"
- args := []string{
- "--",
- arg1,
- arg2,
- }
- f.SetOutput(ioutil.Discard)
- if err := f.Parse(args); err != nil {
- t.Fatal("expected no error; got ", err)
- }
- if !f.Parsed() {
- t.Error("f.Parse() = false after Parse")
- }
- if *boolFlag {
- t.Error("expected boolFlag=false, got true")
- }
- if len(f.Args()) != 2 {
- t.Errorf("expected 2 arguments, got %d: %v", len(f.Args()), f.Args())
- }
- if f.Args()[0] != arg1 {
- t.Errorf("expected argument %q got %q", arg1, f.Args()[0])
- }
- if f.Args()[1] != arg2 {
- t.Errorf("expected argument %q got %q", arg2, f.Args()[1])
- }
- if f.ArgsLenAtDash() != 0 {
- t.Errorf("expected argsLenAtDash %d got %d", 0, f.ArgsLenAtDash())
- }
-}
-
-func getDeprecatedFlagSet() *FlagSet {
- f := NewFlagSet("bob", ContinueOnError)
- f.Bool("badflag", true, "always true")
- f.MarkDeprecated("badflag", "use --good-flag instead")
- return f
-}
-func TestDeprecatedFlagInDocs(t *testing.T) {
- f := getDeprecatedFlagSet()
-
- out := new(bytes.Buffer)
- f.SetOutput(out)
- f.PrintDefaults()
-
- if strings.Contains(out.String(), "badflag") {
- t.Errorf("found deprecated flag in usage!")
- }
-}
-
-func TestUnHiddenDeprecatedFlagInDocs(t *testing.T) {
- f := getDeprecatedFlagSet()
- flg := f.Lookup("badflag")
- if flg == nil {
- t.Fatalf("Unable to lookup 'bob' in TestUnHiddenDeprecatedFlagInDocs")
- }
- flg.Hidden = false
-
- out := new(bytes.Buffer)
- f.SetOutput(out)
- f.PrintDefaults()
-
- defaults := out.String()
- if !strings.Contains(defaults, "badflag") {
- t.Errorf("Did not find deprecated flag in usage!")
- }
- if !strings.Contains(defaults, "use --good-flag instead") {
- t.Errorf("Did not find 'use --good-flag instead' in defaults")
- }
-}
-
-func TestDeprecatedFlagShorthandInDocs(t *testing.T) {
- f := NewFlagSet("bob", ContinueOnError)
- name := "noshorthandflag"
- f.BoolP(name, "n", true, "always true")
- f.MarkShorthandDeprecated("noshorthandflag", fmt.Sprintf("use --%s instead", name))
-
- out := new(bytes.Buffer)
- f.SetOutput(out)
- f.PrintDefaults()
-
- if strings.Contains(out.String(), "-n,") {
- t.Errorf("found deprecated flag shorthand in usage!")
- }
-}
-
-func parseReturnStderr(t *testing.T, f *FlagSet, args []string) (string, error) {
- oldStderr := os.Stderr
- r, w, _ := os.Pipe()
- os.Stderr = w
-
- err := f.Parse(args)
-
- outC := make(chan string)
- // copy the output in a separate goroutine so printing can't block indefinitely
- go func() {
- var buf bytes.Buffer
- io.Copy(&buf, r)
- outC <- buf.String()
- }()
-
- w.Close()
- os.Stderr = oldStderr
- out := <-outC
-
- return out, err
-}
-
-func TestDeprecatedFlagUsage(t *testing.T) {
- f := NewFlagSet("bob", ContinueOnError)
- f.Bool("badflag", true, "always true")
- usageMsg := "use --good-flag instead"
- f.MarkDeprecated("badflag", usageMsg)
-
- args := []string{"--badflag"}
- out, err := parseReturnStderr(t, f, args)
- if err != nil {
- t.Fatal("expected no error; got ", err)
- }
-
- if !strings.Contains(out, usageMsg) {
- t.Errorf("usageMsg not printed when using a deprecated flag!")
- }
-}
-
-func TestDeprecatedFlagShorthandUsage(t *testing.T) {
- f := NewFlagSet("bob", ContinueOnError)
- name := "noshorthandflag"
- f.BoolP(name, "n", true, "always true")
- usageMsg := fmt.Sprintf("use --%s instead", name)
- f.MarkShorthandDeprecated(name, usageMsg)
-
- args := []string{"-n"}
- out, err := parseReturnStderr(t, f, args)
- if err != nil {
- t.Fatal("expected no error; got ", err)
- }
-
- if !strings.Contains(out, usageMsg) {
- t.Errorf("usageMsg not printed when using a deprecated flag!")
- }
-}
-
-func TestDeprecatedFlagUsageNormalized(t *testing.T) {
- f := NewFlagSet("bob", ContinueOnError)
- f.Bool("bad-double_flag", true, "always true")
- f.SetNormalizeFunc(wordSepNormalizeFunc)
- usageMsg := "use --good-flag instead"
- f.MarkDeprecated("bad_double-flag", usageMsg)
-
- args := []string{"--bad_double_flag"}
- out, err := parseReturnStderr(t, f, args)
- if err != nil {
- t.Fatal("expected no error; got ", err)
- }
-
- if !strings.Contains(out, usageMsg) {
- t.Errorf("usageMsg not printed when using a deprecated flag!")
- }
-}
-
-// Name normalization function should be called only once on flag addition
-func TestMultipleNormalizeFlagNameInvocations(t *testing.T) {
- normalizeFlagNameInvocations = 0
-
- f := NewFlagSet("normalized", ContinueOnError)
- f.SetNormalizeFunc(wordSepNormalizeFunc)
- f.Bool("with_under_flag", false, "bool value")
-
- if normalizeFlagNameInvocations != 1 {
- t.Fatal("Expected normalizeFlagNameInvocations to be 1; got ", normalizeFlagNameInvocations)
- }
-}
-
-//
-func TestHiddenFlagInUsage(t *testing.T) {
- f := NewFlagSet("bob", ContinueOnError)
- f.Bool("secretFlag", true, "shhh")
- f.MarkHidden("secretFlag")
-
- out := new(bytes.Buffer)
- f.SetOutput(out)
- f.PrintDefaults()
-
- if strings.Contains(out.String(), "secretFlag") {
- t.Errorf("found hidden flag in usage!")
- }
-}
-
-//
-func TestHiddenFlagUsage(t *testing.T) {
- f := NewFlagSet("bob", ContinueOnError)
- f.Bool("secretFlag", true, "shhh")
- f.MarkHidden("secretFlag")
-
- args := []string{"--secretFlag"}
- out, err := parseReturnStderr(t, f, args)
- if err != nil {
- t.Fatal("expected no error; got ", err)
- }
-
- if strings.Contains(out, "shhh") {
- t.Errorf("usage message printed when using a hidden flag!")
- }
-}
-
-const defaultOutput = ` --A for bootstrapping, allow 'any' type
- --Alongflagname disable bounds checking
- -C, --CCC a boolean defaulting to true (default true)
- --D path set relative path for local imports
- -E, --EEE num[=1234] a num with NoOptDefVal (default 4321)
- --F number a non-zero number (default 2.7)
- --G float a float that defaults to zero
- --IP ip IP address with no default
- --IPMask ipMask Netmask address with no default
- --IPNet ipNet IP network with no default
- --Ints ints int slice with zero default
- --N int a non-zero int (default 27)
- --ND1 string[="bar"] a string with NoOptDefVal (default "foo")
- --ND2 num[=4321] a num with NoOptDefVal (default 1234)
- --StringArray stringArray string array with zero default
- --StringSlice strings string slice with zero default
- --Z int an int that defaults to zero
- --custom custom custom Value implementation
- --customP custom a VarP with default (default 10)
- --maxT timeout set timeout for dial
- -v, --verbose count verbosity
-`
-
-// Custom value that satisfies the Value interface.
-type customValue int
-
-func (cv *customValue) String() string { return fmt.Sprintf("%v", *cv) }
-
-func (cv *customValue) Set(s string) error {
- v, err := strconv.ParseInt(s, 0, 64)
- *cv = customValue(v)
- return err
-}
-
-func (cv *customValue) Type() string { return "custom" }
-
-func TestPrintDefaults(t *testing.T) {
- fs := NewFlagSet("print defaults test", ContinueOnError)
- var buf bytes.Buffer
- fs.SetOutput(&buf)
- fs.Bool("A", false, "for bootstrapping, allow 'any' type")
- fs.Bool("Alongflagname", false, "disable bounds checking")
- fs.BoolP("CCC", "C", true, "a boolean defaulting to true")
- fs.String("D", "", "set relative `path` for local imports")
- fs.Float64("F", 2.7, "a non-zero `number`")
- fs.Float64("G", 0, "a float that defaults to zero")
- fs.Int("N", 27, "a non-zero int")
- fs.IntSlice("Ints", []int{}, "int slice with zero default")
- fs.IP("IP", nil, "IP address with no default")
- fs.IPMask("IPMask", nil, "Netmask address with no default")
- fs.IPNet("IPNet", net.IPNet{}, "IP network with no default")
- fs.Int("Z", 0, "an int that defaults to zero")
- fs.Duration("maxT", 0, "set `timeout` for dial")
- fs.String("ND1", "foo", "a string with NoOptDefVal")
- fs.Lookup("ND1").NoOptDefVal = "bar"
- fs.Int("ND2", 1234, "a `num` with NoOptDefVal")
- fs.Lookup("ND2").NoOptDefVal = "4321"
- fs.IntP("EEE", "E", 4321, "a `num` with NoOptDefVal")
- fs.ShorthandLookup("E").NoOptDefVal = "1234"
- fs.StringSlice("StringSlice", []string{}, "string slice with zero default")
- fs.StringArray("StringArray", []string{}, "string array with zero default")
- fs.CountP("verbose", "v", "verbosity")
-
- var cv customValue
- fs.Var(&cv, "custom", "custom Value implementation")
-
- cv2 := customValue(10)
- fs.VarP(&cv2, "customP", "", "a VarP with default")
-
- fs.PrintDefaults()
- got := buf.String()
- if got != defaultOutput {
- fmt.Println("\n" + got)
- fmt.Println("\n" + defaultOutput)
- t.Errorf("got %q want %q\n", got, defaultOutput)
- }
-}
-
-func TestVisitAllFlagOrder(t *testing.T) {
- fs := NewFlagSet("TestVisitAllFlagOrder", ContinueOnError)
- fs.SortFlags = false
- // https://github.com/spf13/pflag/issues/120
- fs.SetNormalizeFunc(func(f *FlagSet, name string) NormalizedName {
- return NormalizedName(name)
- })
-
- names := []string{"C", "B", "A", "D"}
- for _, name := range names {
- fs.Bool(name, false, "")
- }
-
- i := 0
- fs.VisitAll(func(f *Flag) {
- if names[i] != f.Name {
- t.Errorf("Incorrect order. Expected %v, got %v", names[i], f.Name)
- }
- i++
- })
-}
-
-func TestVisitFlagOrder(t *testing.T) {
- fs := NewFlagSet("TestVisitFlagOrder", ContinueOnError)
- fs.SortFlags = false
- names := []string{"C", "B", "A", "D"}
- for _, name := range names {
- fs.Bool(name, false, "")
- fs.Set(name, "true")
- }
-
- i := 0
- fs.Visit(func(f *Flag) {
- if names[i] != f.Name {
- t.Errorf("Incorrect order. Expected %v, got %v", names[i], f.Name)
- }
- i++
- })
-}
diff --git a/vendor/github.com/spf13/pflag/golangflag_test.go b/vendor/github.com/spf13/pflag/golangflag_test.go
deleted file mode 100644
index 5bd831bf9..000000000
--- a/vendor/github.com/spf13/pflag/golangflag_test.go
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package pflag
-
-import (
- goflag "flag"
- "testing"
-)
-
-func TestGoflags(t *testing.T) {
- goflag.String("stringFlag", "stringFlag", "stringFlag")
- goflag.Bool("boolFlag", false, "boolFlag")
-
- f := NewFlagSet("test", ContinueOnError)
-
- f.AddGoFlagSet(goflag.CommandLine)
- err := f.Parse([]string{"--stringFlag=bob", "--boolFlag"})
- if err != nil {
- t.Fatal("expected no error; get", err)
- }
-
- getString, err := f.GetString("stringFlag")
- if err != nil {
- t.Fatal("expected no error; get", err)
- }
- if getString != "bob" {
- t.Fatalf("expected getString=bob but got getString=%s", getString)
- }
-
- getBool, err := f.GetBool("boolFlag")
- if err != nil {
- t.Fatal("expected no error; get", err)
- }
- if getBool != true {
- t.Fatalf("expected getBool=true but got getBool=%v", getBool)
- }
- if !f.Parsed() {
- t.Fatal("f.Parsed() return false after f.Parse() called")
- }
-
- // in fact it is useless. because `go test` called flag.Parse()
- if !goflag.CommandLine.Parsed() {
- t.Fatal("goflag.CommandLine.Parsed() return false after f.Parse() called")
- }
-}
diff --git a/vendor/github.com/spf13/pflag/int_slice_test.go b/vendor/github.com/spf13/pflag/int_slice_test.go
deleted file mode 100644
index 745aecb95..000000000
--- a/vendor/github.com/spf13/pflag/int_slice_test.go
+++ /dev/null
@@ -1,165 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package pflag
-
-import (
- "fmt"
- "strconv"
- "strings"
- "testing"
-)
-
-func setUpISFlagSet(isp *[]int) *FlagSet {
- f := NewFlagSet("test", ContinueOnError)
- f.IntSliceVar(isp, "is", []int{}, "Command separated list!")
- return f
-}
-
-func setUpISFlagSetWithDefault(isp *[]int) *FlagSet {
- f := NewFlagSet("test", ContinueOnError)
- f.IntSliceVar(isp, "is", []int{0, 1}, "Command separated list!")
- return f
-}
-
-func TestEmptyIS(t *testing.T) {
- var is []int
- f := setUpISFlagSet(&is)
- err := f.Parse([]string{})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
-
- getIS, err := f.GetIntSlice("is")
- if err != nil {
- t.Fatal("got an error from GetIntSlice():", err)
- }
- if len(getIS) != 0 {
- t.Fatalf("got is %v with len=%d but expected length=0", getIS, len(getIS))
- }
-}
-
-func TestIS(t *testing.T) {
- var is []int
- f := setUpISFlagSet(&is)
-
- vals := []string{"1", "2", "4", "3"}
- arg := fmt.Sprintf("--is=%s", strings.Join(vals, ","))
- err := f.Parse([]string{arg})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- for i, v := range is {
- d, err := strconv.Atoi(vals[i])
- if err != nil {
- t.Fatalf("got error: %v", err)
- }
- if d != v {
- t.Fatalf("expected is[%d] to be %s but got: %d", i, vals[i], v)
- }
- }
- getIS, err := f.GetIntSlice("is")
- if err != nil {
- t.Fatalf("got error: %v", err)
- }
- for i, v := range getIS {
- d, err := strconv.Atoi(vals[i])
- if err != nil {
- t.Fatalf("got error: %v", err)
- }
- if d != v {
- t.Fatalf("expected is[%d] to be %s but got: %d from GetIntSlice", i, vals[i], v)
- }
- }
-}
-
-func TestISDefault(t *testing.T) {
- var is []int
- f := setUpISFlagSetWithDefault(&is)
-
- vals := []string{"0", "1"}
-
- err := f.Parse([]string{})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- for i, v := range is {
- d, err := strconv.Atoi(vals[i])
- if err != nil {
- t.Fatalf("got error: %v", err)
- }
- if d != v {
- t.Fatalf("expected is[%d] to be %d but got: %d", i, d, v)
- }
- }
-
- getIS, err := f.GetIntSlice("is")
- if err != nil {
- t.Fatal("got an error from GetIntSlice():", err)
- }
- for i, v := range getIS {
- d, err := strconv.Atoi(vals[i])
- if err != nil {
- t.Fatal("got an error from GetIntSlice():", err)
- }
- if d != v {
- t.Fatalf("expected is[%d] to be %d from GetIntSlice but got: %d", i, d, v)
- }
- }
-}
-
-func TestISWithDefault(t *testing.T) {
- var is []int
- f := setUpISFlagSetWithDefault(&is)
-
- vals := []string{"1", "2"}
- arg := fmt.Sprintf("--is=%s", strings.Join(vals, ","))
- err := f.Parse([]string{arg})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- for i, v := range is {
- d, err := strconv.Atoi(vals[i])
- if err != nil {
- t.Fatalf("got error: %v", err)
- }
- if d != v {
- t.Fatalf("expected is[%d] to be %d but got: %d", i, d, v)
- }
- }
-
- getIS, err := f.GetIntSlice("is")
- if err != nil {
- t.Fatal("got an error from GetIntSlice():", err)
- }
- for i, v := range getIS {
- d, err := strconv.Atoi(vals[i])
- if err != nil {
- t.Fatalf("got error: %v", err)
- }
- if d != v {
- t.Fatalf("expected is[%d] to be %d from GetIntSlice but got: %d", i, d, v)
- }
- }
-}
-
-func TestISCalledTwice(t *testing.T) {
- var is []int
- f := setUpISFlagSet(&is)
-
- in := []string{"1,2", "3"}
- expected := []int{1, 2, 3}
- argfmt := "--is=%s"
- arg1 := fmt.Sprintf(argfmt, in[0])
- arg2 := fmt.Sprintf(argfmt, in[1])
- err := f.Parse([]string{arg1, arg2})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- for i, v := range is {
- if expected[i] != v {
- t.Fatalf("expected is[%d] to be %d but got: %d", i, expected[i], v)
- }
- }
-}
diff --git a/vendor/github.com/spf13/pflag/ip_slice_test.go b/vendor/github.com/spf13/pflag/ip_slice_test.go
deleted file mode 100644
index b0c681c5b..000000000
--- a/vendor/github.com/spf13/pflag/ip_slice_test.go
+++ /dev/null
@@ -1,222 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "net"
- "strings"
- "testing"
-)
-
-func setUpIPSFlagSet(ipsp *[]net.IP) *FlagSet {
- f := NewFlagSet("test", ContinueOnError)
- f.IPSliceVar(ipsp, "ips", []net.IP{}, "Command separated list!")
- return f
-}
-
-func setUpIPSFlagSetWithDefault(ipsp *[]net.IP) *FlagSet {
- f := NewFlagSet("test", ContinueOnError)
- f.IPSliceVar(ipsp, "ips",
- []net.IP{
- net.ParseIP("192.168.1.1"),
- net.ParseIP("0:0:0:0:0:0:0:1"),
- },
- "Command separated list!")
- return f
-}
-
-func TestEmptyIP(t *testing.T) {
- var ips []net.IP
- f := setUpIPSFlagSet(&ips)
- err := f.Parse([]string{})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
-
- getIPS, err := f.GetIPSlice("ips")
- if err != nil {
- t.Fatal("got an error from GetIPSlice():", err)
- }
- if len(getIPS) != 0 {
- t.Fatalf("got ips %v with len=%d but expected length=0", getIPS, len(getIPS))
- }
-}
-
-func TestIPS(t *testing.T) {
- var ips []net.IP
- f := setUpIPSFlagSet(&ips)
-
- vals := []string{"192.168.1.1", "10.0.0.1", "0:0:0:0:0:0:0:2"}
- arg := fmt.Sprintf("--ips=%s", strings.Join(vals, ","))
- err := f.Parse([]string{arg})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- for i, v := range ips {
- if ip := net.ParseIP(vals[i]); ip == nil {
- t.Fatalf("invalid string being converted to IP address: %s", vals[i])
- } else if !ip.Equal(v) {
- t.Fatalf("expected ips[%d] to be %s but got: %s from GetIPSlice", i, vals[i], v)
- }
- }
-}
-
-func TestIPSDefault(t *testing.T) {
- var ips []net.IP
- f := setUpIPSFlagSetWithDefault(&ips)
-
- vals := []string{"192.168.1.1", "0:0:0:0:0:0:0:1"}
- err := f.Parse([]string{})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- for i, v := range ips {
- if ip := net.ParseIP(vals[i]); ip == nil {
- t.Fatalf("invalid string being converted to IP address: %s", vals[i])
- } else if !ip.Equal(v) {
- t.Fatalf("expected ips[%d] to be %s but got: %s", i, vals[i], v)
- }
- }
-
- getIPS, err := f.GetIPSlice("ips")
- if err != nil {
- t.Fatal("got an error from GetIPSlice")
- }
- for i, v := range getIPS {
- if ip := net.ParseIP(vals[i]); ip == nil {
- t.Fatalf("invalid string being converted to IP address: %s", vals[i])
- } else if !ip.Equal(v) {
- t.Fatalf("expected ips[%d] to be %s but got: %s", i, vals[i], v)
- }
- }
-}
-
-func TestIPSWithDefault(t *testing.T) {
- var ips []net.IP
- f := setUpIPSFlagSetWithDefault(&ips)
-
- vals := []string{"192.168.1.1", "0:0:0:0:0:0:0:1"}
- arg := fmt.Sprintf("--ips=%s", strings.Join(vals, ","))
- err := f.Parse([]string{arg})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- for i, v := range ips {
- if ip := net.ParseIP(vals[i]); ip == nil {
- t.Fatalf("invalid string being converted to IP address: %s", vals[i])
- } else if !ip.Equal(v) {
- t.Fatalf("expected ips[%d] to be %s but got: %s", i, vals[i], v)
- }
- }
-
- getIPS, err := f.GetIPSlice("ips")
- if err != nil {
- t.Fatal("got an error from GetIPSlice")
- }
- for i, v := range getIPS {
- if ip := net.ParseIP(vals[i]); ip == nil {
- t.Fatalf("invalid string being converted to IP address: %s", vals[i])
- } else if !ip.Equal(v) {
- t.Fatalf("expected ips[%d] to be %s but got: %s", i, vals[i], v)
- }
- }
-}
-
-func TestIPSCalledTwice(t *testing.T) {
- var ips []net.IP
- f := setUpIPSFlagSet(&ips)
-
- in := []string{"192.168.1.2,0:0:0:0:0:0:0:1", "10.0.0.1"}
- expected := []net.IP{net.ParseIP("192.168.1.2"), net.ParseIP("0:0:0:0:0:0:0:1"), net.ParseIP("10.0.0.1")}
- argfmt := "ips=%s"
- arg1 := fmt.Sprintf(argfmt, in[0])
- arg2 := fmt.Sprintf(argfmt, in[1])
- err := f.Parse([]string{arg1, arg2})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- for i, v := range ips {
- if !expected[i].Equal(v) {
- t.Fatalf("expected ips[%d] to be %s but got: %s", i, expected[i], v)
- }
- }
-}
-
-func TestIPSBadQuoting(t *testing.T) {
-
- tests := []struct {
- Want []net.IP
- FlagArg []string
- }{
- {
- Want: []net.IP{
- net.ParseIP("a4ab:61d:f03e:5d7d:fad7:d4c2:a1a5:568"),
- net.ParseIP("203.107.49.208"),
- net.ParseIP("14.57.204.90"),
- },
- FlagArg: []string{
- "a4ab:61d:f03e:5d7d:fad7:d4c2:a1a5:568",
- "203.107.49.208",
- "14.57.204.90",
- },
- },
- {
- Want: []net.IP{
- net.ParseIP("204.228.73.195"),
- net.ParseIP("86.141.15.94"),
- },
- FlagArg: []string{
- "204.228.73.195",
- "86.141.15.94",
- },
- },
- {
- Want: []net.IP{
- net.ParseIP("c70c:db36:3001:890f:c6ea:3f9b:7a39:cc3f"),
- net.ParseIP("4d17:1d6e:e699:bd7a:88c5:5e7e:ac6a:4472"),
- },
- FlagArg: []string{
- "c70c:db36:3001:890f:c6ea:3f9b:7a39:cc3f",
- "4d17:1d6e:e699:bd7a:88c5:5e7e:ac6a:4472",
- },
- },
- {
- Want: []net.IP{
- net.ParseIP("5170:f971:cfac:7be3:512a:af37:952c:bc33"),
- net.ParseIP("93.21.145.140"),
- net.ParseIP("2cac:61d3:c5ff:6caf:73e0:1b1a:c336:c1ca"),
- },
- FlagArg: []string{
- " 5170:f971:cfac:7be3:512a:af37:952c:bc33 , 93.21.145.140 ",
- "2cac:61d3:c5ff:6caf:73e0:1b1a:c336:c1ca",
- },
- },
- {
- Want: []net.IP{
- net.ParseIP("2e5e:66b2:6441:848:5b74:76ea:574c:3a7b"),
- net.ParseIP("2e5e:66b2:6441:848:5b74:76ea:574c:3a7b"),
- net.ParseIP("2e5e:66b2:6441:848:5b74:76ea:574c:3a7b"),
- net.ParseIP("2e5e:66b2:6441:848:5b74:76ea:574c:3a7b"),
- },
- FlagArg: []string{
- `"2e5e:66b2:6441:848:5b74:76ea:574c:3a7b, 2e5e:66b2:6441:848:5b74:76ea:574c:3a7b,2e5e:66b2:6441:848:5b74:76ea:574c:3a7b "`,
- " 2e5e:66b2:6441:848:5b74:76ea:574c:3a7b"},
- },
- }
-
- for i, test := range tests {
-
- var ips []net.IP
- f := setUpIPSFlagSet(&ips)
-
- if err := f.Parse([]string{fmt.Sprintf("--ips=%s", strings.Join(test.FlagArg, ","))}); err != nil {
- t.Fatalf("flag parsing failed with error: %s\nparsing:\t%#v\nwant:\t\t%s",
- err, test.FlagArg, test.Want[i])
- }
-
- for j, b := range ips {
- if !b.Equal(test.Want[j]) {
- t.Fatalf("bad value parsed for test %d on net.IP %d:\nwant:\t%s\ngot:\t%s", i, j, test.Want[j], b)
- }
- }
- }
-}
diff --git a/vendor/github.com/spf13/pflag/ip_test.go b/vendor/github.com/spf13/pflag/ip_test.go
deleted file mode 100644
index 1fec50e42..000000000
--- a/vendor/github.com/spf13/pflag/ip_test.go
+++ /dev/null
@@ -1,63 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "net"
- "os"
- "testing"
-)
-
-func setUpIP(ip *net.IP) *FlagSet {
- f := NewFlagSet("test", ContinueOnError)
- f.IPVar(ip, "address", net.ParseIP("0.0.0.0"), "IP Address")
- return f
-}
-
-func TestIP(t *testing.T) {
- testCases := []struct {
- input string
- success bool
- expected string
- }{
- {"0.0.0.0", true, "0.0.0.0"},
- {" 0.0.0.0 ", true, "0.0.0.0"},
- {"1.2.3.4", true, "1.2.3.4"},
- {"127.0.0.1", true, "127.0.0.1"},
- {"255.255.255.255", true, "255.255.255.255"},
- {"", false, ""},
- {"0", false, ""},
- {"localhost", false, ""},
- {"0.0.0", false, ""},
- {"0.0.0.", false, ""},
- {"0.0.0.0.", false, ""},
- {"0.0.0.256", false, ""},
- {"0 . 0 . 0 . 0", false, ""},
- }
-
- devnull, _ := os.Open(os.DevNull)
- os.Stderr = devnull
- for i := range testCases {
- var addr net.IP
- f := setUpIP(&addr)
-
- tc := &testCases[i]
-
- arg := fmt.Sprintf("--address=%s", tc.input)
- err := f.Parse([]string{arg})
- if err != nil && tc.success == true {
- t.Errorf("expected success, got %q", err)
- continue
- } else if err == nil && tc.success == false {
- t.Errorf("expected failure")
- continue
- } else if tc.success {
- ip, err := f.GetIP("address")
- if err != nil {
- t.Errorf("Got error trying to fetch the IP flag: %v", err)
- }
- if ip.String() != tc.expected {
- t.Errorf("expected %q, got %q", tc.expected, ip.String())
- }
- }
- }
-}
diff --git a/vendor/github.com/spf13/pflag/ipnet_test.go b/vendor/github.com/spf13/pflag/ipnet_test.go
deleted file mode 100644
index 335b6fa15..000000000
--- a/vendor/github.com/spf13/pflag/ipnet_test.go
+++ /dev/null
@@ -1,70 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "net"
- "os"
- "testing"
-)
-
-func setUpIPNet(ip *net.IPNet) *FlagSet {
- f := NewFlagSet("test", ContinueOnError)
- _, def, _ := net.ParseCIDR("0.0.0.0/0")
- f.IPNetVar(ip, "address", *def, "IP Address")
- return f
-}
-
-func TestIPNet(t *testing.T) {
- testCases := []struct {
- input string
- success bool
- expected string
- }{
- {"0.0.0.0/0", true, "0.0.0.0/0"},
- {" 0.0.0.0/0 ", true, "0.0.0.0/0"},
- {"1.2.3.4/8", true, "1.0.0.0/8"},
- {"127.0.0.1/16", true, "127.0.0.0/16"},
- {"255.255.255.255/19", true, "255.255.224.0/19"},
- {"255.255.255.255/32", true, "255.255.255.255/32"},
- {"", false, ""},
- {"/0", false, ""},
- {"0", false, ""},
- {"0/0", false, ""},
- {"localhost/0", false, ""},
- {"0.0.0/4", false, ""},
- {"0.0.0./8", false, ""},
- {"0.0.0.0./12", false, ""},
- {"0.0.0.256/16", false, ""},
- {"0.0.0.0 /20", false, ""},
- {"0.0.0.0/ 24", false, ""},
- {"0 . 0 . 0 . 0 / 28", false, ""},
- {"0.0.0.0/33", false, ""},
- }
-
- devnull, _ := os.Open(os.DevNull)
- os.Stderr = devnull
- for i := range testCases {
- var addr net.IPNet
- f := setUpIPNet(&addr)
-
- tc := &testCases[i]
-
- arg := fmt.Sprintf("--address=%s", tc.input)
- err := f.Parse([]string{arg})
- if err != nil && tc.success == true {
- t.Errorf("expected success, got %q", err)
- continue
- } else if err == nil && tc.success == false {
- t.Errorf("expected failure")
- continue
- } else if tc.success {
- ip, err := f.GetIPNet("address")
- if err != nil {
- t.Errorf("Got error trying to fetch the IP flag: %v", err)
- }
- if ip.String() != tc.expected {
- t.Errorf("expected %q, got %q", tc.expected, ip.String())
- }
- }
- }
-}
diff --git a/vendor/github.com/spf13/pflag/printusage_test.go b/vendor/github.com/spf13/pflag/printusage_test.go
deleted file mode 100644
index df982aab4..000000000
--- a/vendor/github.com/spf13/pflag/printusage_test.go
+++ /dev/null
@@ -1,74 +0,0 @@
-package pflag
-
-import (
- "bytes"
- "io"
- "testing"
-)
-
-const expectedOutput = ` --long-form Some description
- --long-form2 Some description
- with multiline
- -s, --long-name Some description
- -t, --long-name2 Some description with
- multiline
-`
-
-func setUpPFlagSet(buf io.Writer) *FlagSet {
- f := NewFlagSet("test", ExitOnError)
- f.Bool("long-form", false, "Some description")
- f.Bool("long-form2", false, "Some description\n with multiline")
- f.BoolP("long-name", "s", false, "Some description")
- f.BoolP("long-name2", "t", false, "Some description with\n multiline")
- f.SetOutput(buf)
- return f
-}
-
-func TestPrintUsage(t *testing.T) {
- buf := bytes.Buffer{}
- f := setUpPFlagSet(&buf)
- f.PrintDefaults()
- res := buf.String()
- if res != expectedOutput {
- t.Errorf("Expected \n%s \nActual \n%s", expectedOutput, res)
- }
-}
-
-func setUpPFlagSet2(buf io.Writer) *FlagSet {
- f := NewFlagSet("test", ExitOnError)
- f.Bool("long-form", false, "Some description")
- f.Bool("long-form2", false, "Some description\n with multiline")
- f.BoolP("long-name", "s", false, "Some description")
- f.BoolP("long-name2", "t", false, "Some description with\n multiline")
- f.StringP("some-very-long-arg", "l", "test", "Some very long description having break the limit")
- f.StringP("other-very-long-arg", "o", "long-default-value", "Some very long description having break the limit")
- f.String("some-very-long-arg2", "very long default value", "Some very long description\nwith line break\nmultiple")
- f.SetOutput(buf)
- return f
-}
-
-const expectedOutput2 = ` --long-form Some description
- --long-form2 Some description
- with multiline
- -s, --long-name Some description
- -t, --long-name2 Some description with
- multiline
- -o, --other-very-long-arg string Some very long description having
- break the limit (default
- "long-default-value")
- -l, --some-very-long-arg string Some very long description having
- break the limit (default "test")
- --some-very-long-arg2 string Some very long description
- with line break
- multiple (default "very long default
- value")
-`
-
-func TestPrintUsage_2(t *testing.T) {
- buf := bytes.Buffer{}
- f := setUpPFlagSet2(&buf)
- res := f.FlagUsagesWrapped(80)
- if res != expectedOutput2 {
- t.Errorf("Expected \n%q \nActual \n%q", expectedOutput2, res)
- }
-}
diff --git a/vendor/github.com/spf13/pflag/string_array_test.go b/vendor/github.com/spf13/pflag/string_array_test.go
deleted file mode 100644
index 1ceac8c6c..000000000
--- a/vendor/github.com/spf13/pflag/string_array_test.go
+++ /dev/null
@@ -1,233 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package pflag
-
-import (
- "fmt"
- "testing"
-)
-
-func setUpSAFlagSet(sap *[]string) *FlagSet {
- f := NewFlagSet("test", ContinueOnError)
- f.StringArrayVar(sap, "sa", []string{}, "Command separated list!")
- return f
-}
-
-func setUpSAFlagSetWithDefault(sap *[]string) *FlagSet {
- f := NewFlagSet("test", ContinueOnError)
- f.StringArrayVar(sap, "sa", []string{"default", "values"}, "Command separated list!")
- return f
-}
-
-func TestEmptySA(t *testing.T) {
- var sa []string
- f := setUpSAFlagSet(&sa)
- err := f.Parse([]string{})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
-
- getSA, err := f.GetStringArray("sa")
- if err != nil {
- t.Fatal("got an error from GetStringArray():", err)
- }
- if len(getSA) != 0 {
- t.Fatalf("got sa %v with len=%d but expected length=0", getSA, len(getSA))
- }
-}
-
-func TestEmptySAValue(t *testing.T) {
- var sa []string
- f := setUpSAFlagSet(&sa)
- err := f.Parse([]string{"--sa="})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
-
- getSA, err := f.GetStringArray("sa")
- if err != nil {
- t.Fatal("got an error from GetStringArray():", err)
- }
- if len(getSA) != 0 {
- t.Fatalf("got sa %v with len=%d but expected length=0", getSA, len(getSA))
- }
-}
-
-func TestSADefault(t *testing.T) {
- var sa []string
- f := setUpSAFlagSetWithDefault(&sa)
-
- vals := []string{"default", "values"}
-
- err := f.Parse([]string{})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- for i, v := range sa {
- if vals[i] != v {
- t.Fatalf("expected sa[%d] to be %s but got: %s", i, vals[i], v)
- }
- }
-
- getSA, err := f.GetStringArray("sa")
- if err != nil {
- t.Fatal("got an error from GetStringArray():", err)
- }
- for i, v := range getSA {
- if vals[i] != v {
- t.Fatalf("expected sa[%d] to be %s from GetStringArray but got: %s", i, vals[i], v)
- }
- }
-}
-
-func TestSAWithDefault(t *testing.T) {
- var sa []string
- f := setUpSAFlagSetWithDefault(&sa)
-
- val := "one"
- arg := fmt.Sprintf("--sa=%s", val)
- err := f.Parse([]string{arg})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
-
- if len(sa) != 1 {
- t.Fatalf("expected number of values to be %d but %d", 1, len(sa))
- }
-
- if sa[0] != val {
- t.Fatalf("expected value to be %s but got: %s", sa[0], val)
- }
-
- getSA, err := f.GetStringArray("sa")
- if err != nil {
- t.Fatal("got an error from GetStringArray():", err)
- }
-
- if len(getSA) != 1 {
- t.Fatalf("expected number of values to be %d but %d", 1, len(getSA))
- }
-
- if getSA[0] != val {
- t.Fatalf("expected value to be %s but got: %s", getSA[0], val)
- }
-}
-
-func TestSACalledTwice(t *testing.T) {
- var sa []string
- f := setUpSAFlagSet(&sa)
-
- in := []string{"one", "two"}
- expected := []string{"one", "two"}
- argfmt := "--sa=%s"
- arg1 := fmt.Sprintf(argfmt, in[0])
- arg2 := fmt.Sprintf(argfmt, in[1])
- err := f.Parse([]string{arg1, arg2})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
-
- if len(expected) != len(sa) {
- t.Fatalf("expected number of sa to be %d but got: %d", len(expected), len(sa))
- }
- for i, v := range sa {
- if expected[i] != v {
- t.Fatalf("expected sa[%d] to be %s but got: %s", i, expected[i], v)
- }
- }
-
- values, err := f.GetStringArray("sa")
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
-
- if len(expected) != len(values) {
- t.Fatalf("expected number of values to be %d but got: %d", len(expected), len(sa))
- }
- for i, v := range values {
- if expected[i] != v {
- t.Fatalf("expected got sa[%d] to be %s but got: %s", i, expected[i], v)
- }
- }
-}
-
-func TestSAWithSpecialChar(t *testing.T) {
- var sa []string
- f := setUpSAFlagSet(&sa)
-
- in := []string{"one,two", `"three"`, `"four,five",six`, "seven eight"}
- expected := []string{"one,two", `"three"`, `"four,five",six`, "seven eight"}
- argfmt := "--sa=%s"
- arg1 := fmt.Sprintf(argfmt, in[0])
- arg2 := fmt.Sprintf(argfmt, in[1])
- arg3 := fmt.Sprintf(argfmt, in[2])
- arg4 := fmt.Sprintf(argfmt, in[3])
- err := f.Parse([]string{arg1, arg2, arg3, arg4})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
-
- if len(expected) != len(sa) {
- t.Fatalf("expected number of sa to be %d but got: %d", len(expected), len(sa))
- }
- for i, v := range sa {
- if expected[i] != v {
- t.Fatalf("expected sa[%d] to be %s but got: %s", i, expected[i], v)
- }
- }
-
- values, err := f.GetStringArray("sa")
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
-
- if len(expected) != len(values) {
- t.Fatalf("expected number of values to be %d but got: %d", len(expected), len(values))
- }
- for i, v := range values {
- if expected[i] != v {
- t.Fatalf("expected got sa[%d] to be %s but got: %s", i, expected[i], v)
- }
- }
-}
-
-func TestSAWithSquareBrackets(t *testing.T) {
- var sa []string
- f := setUpSAFlagSet(&sa)
-
- in := []string{"][]-[", "[a-z]", "[a-z]+"}
- expected := []string{"][]-[", "[a-z]", "[a-z]+"}
- argfmt := "--sa=%s"
- arg1 := fmt.Sprintf(argfmt, in[0])
- arg2 := fmt.Sprintf(argfmt, in[1])
- arg3 := fmt.Sprintf(argfmt, in[2])
- err := f.Parse([]string{arg1, arg2, arg3})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
-
- if len(expected) != len(sa) {
- t.Fatalf("expected number of sa to be %d but got: %d", len(expected), len(sa))
- }
- for i, v := range sa {
- if expected[i] != v {
- t.Fatalf("expected sa[%d] to be %s but got: %s", i, expected[i], v)
- }
- }
-
- values, err := f.GetStringArray("sa")
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
-
- if len(expected) != len(values) {
- t.Fatalf("expected number of values to be %d but got: %d", len(expected), len(values))
- }
- for i, v := range values {
- if expected[i] != v {
- t.Fatalf("expected got sa[%d] to be %s but got: %s", i, expected[i], v)
- }
- }
-}
diff --git a/vendor/github.com/spf13/pflag/string_slice_test.go b/vendor/github.com/spf13/pflag/string_slice_test.go
deleted file mode 100644
index c41f3bd66..000000000
--- a/vendor/github.com/spf13/pflag/string_slice_test.go
+++ /dev/null
@@ -1,253 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package pflag
-
-import (
- "fmt"
- "strings"
- "testing"
-)
-
-func setUpSSFlagSet(ssp *[]string) *FlagSet {
- f := NewFlagSet("test", ContinueOnError)
- f.StringSliceVar(ssp, "ss", []string{}, "Command separated list!")
- return f
-}
-
-func setUpSSFlagSetWithDefault(ssp *[]string) *FlagSet {
- f := NewFlagSet("test", ContinueOnError)
- f.StringSliceVar(ssp, "ss", []string{"default", "values"}, "Command separated list!")
- return f
-}
-
-func TestEmptySS(t *testing.T) {
- var ss []string
- f := setUpSSFlagSet(&ss)
- err := f.Parse([]string{})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
-
- getSS, err := f.GetStringSlice("ss")
- if err != nil {
- t.Fatal("got an error from GetStringSlice():", err)
- }
- if len(getSS) != 0 {
- t.Fatalf("got ss %v with len=%d but expected length=0", getSS, len(getSS))
- }
-}
-
-func TestEmptySSValue(t *testing.T) {
- var ss []string
- f := setUpSSFlagSet(&ss)
- err := f.Parse([]string{"--ss="})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
-
- getSS, err := f.GetStringSlice("ss")
- if err != nil {
- t.Fatal("got an error from GetStringSlice():", err)
- }
- if len(getSS) != 0 {
- t.Fatalf("got ss %v with len=%d but expected length=0", getSS, len(getSS))
- }
-}
-
-func TestSS(t *testing.T) {
- var ss []string
- f := setUpSSFlagSet(&ss)
-
- vals := []string{"one", "two", "4", "3"}
- arg := fmt.Sprintf("--ss=%s", strings.Join(vals, ","))
- err := f.Parse([]string{arg})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- for i, v := range ss {
- if vals[i] != v {
- t.Fatalf("expected ss[%d] to be %s but got: %s", i, vals[i], v)
- }
- }
-
- getSS, err := f.GetStringSlice("ss")
- if err != nil {
- t.Fatal("got an error from GetStringSlice():", err)
- }
- for i, v := range getSS {
- if vals[i] != v {
- t.Fatalf("expected ss[%d] to be %s from GetStringSlice but got: %s", i, vals[i], v)
- }
- }
-}
-
-func TestSSDefault(t *testing.T) {
- var ss []string
- f := setUpSSFlagSetWithDefault(&ss)
-
- vals := []string{"default", "values"}
-
- err := f.Parse([]string{})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- for i, v := range ss {
- if vals[i] != v {
- t.Fatalf("expected ss[%d] to be %s but got: %s", i, vals[i], v)
- }
- }
-
- getSS, err := f.GetStringSlice("ss")
- if err != nil {
- t.Fatal("got an error from GetStringSlice():", err)
- }
- for i, v := range getSS {
- if vals[i] != v {
- t.Fatalf("expected ss[%d] to be %s from GetStringSlice but got: %s", i, vals[i], v)
- }
- }
-}
-
-func TestSSWithDefault(t *testing.T) {
- var ss []string
- f := setUpSSFlagSetWithDefault(&ss)
-
- vals := []string{"one", "two", "4", "3"}
- arg := fmt.Sprintf("--ss=%s", strings.Join(vals, ","))
- err := f.Parse([]string{arg})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- for i, v := range ss {
- if vals[i] != v {
- t.Fatalf("expected ss[%d] to be %s but got: %s", i, vals[i], v)
- }
- }
-
- getSS, err := f.GetStringSlice("ss")
- if err != nil {
- t.Fatal("got an error from GetStringSlice():", err)
- }
- for i, v := range getSS {
- if vals[i] != v {
- t.Fatalf("expected ss[%d] to be %s from GetStringSlice but got: %s", i, vals[i], v)
- }
- }
-}
-
-func TestSSCalledTwice(t *testing.T) {
- var ss []string
- f := setUpSSFlagSet(&ss)
-
- in := []string{"one,two", "three"}
- expected := []string{"one", "two", "three"}
- argfmt := "--ss=%s"
- arg1 := fmt.Sprintf(argfmt, in[0])
- arg2 := fmt.Sprintf(argfmt, in[1])
- err := f.Parse([]string{arg1, arg2})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
-
- if len(expected) != len(ss) {
- t.Fatalf("expected number of ss to be %d but got: %d", len(expected), len(ss))
- }
- for i, v := range ss {
- if expected[i] != v {
- t.Fatalf("expected ss[%d] to be %s but got: %s", i, expected[i], v)
- }
- }
-
- values, err := f.GetStringSlice("ss")
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
-
- if len(expected) != len(values) {
- t.Fatalf("expected number of values to be %d but got: %d", len(expected), len(ss))
- }
- for i, v := range values {
- if expected[i] != v {
- t.Fatalf("expected got ss[%d] to be %s but got: %s", i, expected[i], v)
- }
- }
-}
-
-func TestSSWithComma(t *testing.T) {
- var ss []string
- f := setUpSSFlagSet(&ss)
-
- in := []string{`"one,two"`, `"three"`, `"four,five",six`}
- expected := []string{"one,two", "three", "four,five", "six"}
- argfmt := "--ss=%s"
- arg1 := fmt.Sprintf(argfmt, in[0])
- arg2 := fmt.Sprintf(argfmt, in[1])
- arg3 := fmt.Sprintf(argfmt, in[2])
- err := f.Parse([]string{arg1, arg2, arg3})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
-
- if len(expected) != len(ss) {
- t.Fatalf("expected number of ss to be %d but got: %d", len(expected), len(ss))
- }
- for i, v := range ss {
- if expected[i] != v {
- t.Fatalf("expected ss[%d] to be %s but got: %s", i, expected[i], v)
- }
- }
-
- values, err := f.GetStringSlice("ss")
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
-
- if len(expected) != len(values) {
- t.Fatalf("expected number of values to be %d but got: %d", len(expected), len(values))
- }
- for i, v := range values {
- if expected[i] != v {
- t.Fatalf("expected got ss[%d] to be %s but got: %s", i, expected[i], v)
- }
- }
-}
-
-func TestSSWithSquareBrackets(t *testing.T) {
- var ss []string
- f := setUpSSFlagSet(&ss)
-
- in := []string{`"[a-z]"`, `"[a-z]+"`}
- expected := []string{"[a-z]", "[a-z]+"}
- argfmt := "--ss=%s"
- arg1 := fmt.Sprintf(argfmt, in[0])
- arg2 := fmt.Sprintf(argfmt, in[1])
- err := f.Parse([]string{arg1, arg2})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
-
- if len(expected) != len(ss) {
- t.Fatalf("expected number of ss to be %d but got: %d", len(expected), len(ss))
- }
- for i, v := range ss {
- if expected[i] != v {
- t.Fatalf("expected ss[%d] to be %s but got: %s", i, expected[i], v)
- }
- }
-
- values, err := f.GetStringSlice("ss")
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
-
- if len(expected) != len(values) {
- t.Fatalf("expected number of values to be %d but got: %d", len(expected), len(values))
- }
- for i, v := range values {
- if expected[i] != v {
- t.Fatalf("expected got ss[%d] to be %s but got: %s", i, expected[i], v)
- }
- }
-}
diff --git a/vendor/github.com/spf13/pflag/uint_slice_test.go b/vendor/github.com/spf13/pflag/uint_slice_test.go
deleted file mode 100644
index db1a19dc2..000000000
--- a/vendor/github.com/spf13/pflag/uint_slice_test.go
+++ /dev/null
@@ -1,161 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "strconv"
- "strings"
- "testing"
-)
-
-func setUpUISFlagSet(uisp *[]uint) *FlagSet {
- f := NewFlagSet("test", ContinueOnError)
- f.UintSliceVar(uisp, "uis", []uint{}, "Command separated list!")
- return f
-}
-
-func setUpUISFlagSetWithDefault(uisp *[]uint) *FlagSet {
- f := NewFlagSet("test", ContinueOnError)
- f.UintSliceVar(uisp, "uis", []uint{0, 1}, "Command separated list!")
- return f
-}
-
-func TestEmptyUIS(t *testing.T) {
- var uis []uint
- f := setUpUISFlagSet(&uis)
- err := f.Parse([]string{})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
-
- getUIS, err := f.GetUintSlice("uis")
- if err != nil {
- t.Fatal("got an error from GetUintSlice():", err)
- }
- if len(getUIS) != 0 {
- t.Fatalf("got is %v with len=%d but expected length=0", getUIS, len(getUIS))
- }
-}
-
-func TestUIS(t *testing.T) {
- var uis []uint
- f := setUpUISFlagSet(&uis)
-
- vals := []string{"1", "2", "4", "3"}
- arg := fmt.Sprintf("--uis=%s", strings.Join(vals, ","))
- err := f.Parse([]string{arg})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- for i, v := range uis {
- u, err := strconv.ParseUint(vals[i], 10, 0)
- if err != nil {
- t.Fatalf("got error: %v", err)
- }
- if uint(u) != v {
- t.Fatalf("expected uis[%d] to be %s but got %d", i, vals[i], v)
- }
- }
- getUIS, err := f.GetUintSlice("uis")
- if err != nil {
- t.Fatalf("got error: %v", err)
- }
- for i, v := range getUIS {
- u, err := strconv.ParseUint(vals[i], 10, 0)
- if err != nil {
- t.Fatalf("got error: %v", err)
- }
- if uint(u) != v {
- t.Fatalf("expected uis[%d] to be %s but got: %d from GetUintSlice", i, vals[i], v)
- }
- }
-}
-
-func TestUISDefault(t *testing.T) {
- var uis []uint
- f := setUpUISFlagSetWithDefault(&uis)
-
- vals := []string{"0", "1"}
-
- err := f.Parse([]string{})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- for i, v := range uis {
- u, err := strconv.ParseUint(vals[i], 10, 0)
- if err != nil {
- t.Fatalf("got error: %v", err)
- }
- if uint(u) != v {
- t.Fatalf("expect uis[%d] to be %d but got: %d", i, u, v)
- }
- }
-
- getUIS, err := f.GetUintSlice("uis")
- if err != nil {
- t.Fatal("got an error from GetUintSlice():", err)
- }
- for i, v := range getUIS {
- u, err := strconv.ParseUint(vals[i], 10, 0)
- if err != nil {
- t.Fatal("got an error from GetIntSlice():", err)
- }
- if uint(u) != v {
- t.Fatalf("expected uis[%d] to be %d from GetUintSlice but got: %d", i, u, v)
- }
- }
-}
-
-func TestUISWithDefault(t *testing.T) {
- var uis []uint
- f := setUpUISFlagSetWithDefault(&uis)
-
- vals := []string{"1", "2"}
- arg := fmt.Sprintf("--uis=%s", strings.Join(vals, ","))
- err := f.Parse([]string{arg})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- for i, v := range uis {
- u, err := strconv.ParseUint(vals[i], 10, 0)
- if err != nil {
- t.Fatalf("got error: %v", err)
- }
- if uint(u) != v {
- t.Fatalf("expected uis[%d] to be %d from GetUintSlice but got: %d", i, u, v)
- }
- }
-
- getUIS, err := f.GetUintSlice("uis")
- if err != nil {
- t.Fatal("got an error from GetUintSlice():", err)
- }
- for i, v := range getUIS {
- u, err := strconv.ParseUint(vals[i], 10, 0)
- if err != nil {
- t.Fatalf("got error: %v", err)
- }
- if uint(u) != v {
- t.Fatalf("expected uis[%d] to be %d from GetUintSlice but got: %d", i, u, v)
- }
- }
-}
-
-func TestUISCalledTwice(t *testing.T) {
- var uis []uint
- f := setUpUISFlagSet(&uis)
-
- in := []string{"1,2", "3"}
- expected := []int{1, 2, 3}
- argfmt := "--uis=%s"
- arg1 := fmt.Sprintf(argfmt, in[0])
- arg2 := fmt.Sprintf(argfmt, in[1])
- err := f.Parse([]string{arg1, arg2})
- if err != nil {
- t.Fatal("expected no error; got", err)
- }
- for i, v := range uis {
- if uint(expected[i]) != v {
- t.Fatalf("expected uis[%d] to be %d but got: %d", i, expected[i], v)
- }
- }
-}
diff --git a/vendor/github.com/ugorji/go/codec/cbor_test.go b/vendor/github.com/ugorji/go/codec/cbor_test.go
deleted file mode 100644
index 611ddffd3..000000000
--- a/vendor/github.com/ugorji/go/codec/cbor_test.go
+++ /dev/null
@@ -1,230 +0,0 @@
-// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-import (
- "bufio"
- "bytes"
- "encoding/hex"
- "math"
- "os"
- "regexp"
- "strings"
- "testing"
-)
-
-func TestCborIndefiniteLength(t *testing.T) {
- oldMapType := testCborH.MapType
- defer func() {
- testCborH.MapType = oldMapType
- }()
- testCborH.MapType = testMapStrIntfTyp
- // var (
- // M1 map[string][]byte
- // M2 map[uint64]bool
- // L1 []interface{}
- // S1 []string
- // B1 []byte
- // )
- var v, vv interface{}
- // define it (v), encode it using indefinite lengths, decode it (vv), compare v to vv
- v = map[string]interface{}{
- "one-byte-key": []byte{1, 2, 3, 4, 5, 6},
- "two-string-key": "two-value",
- "three-list-key": []interface{}{true, false, uint64(1), int64(-1)},
- }
- var buf bytes.Buffer
- // buf.Reset()
- e := NewEncoder(&buf, testCborH)
- buf.WriteByte(cborBdIndefiniteMap)
- //----
- buf.WriteByte(cborBdIndefiniteString)
- e.MustEncode("one-")
- e.MustEncode("byte-")
- e.MustEncode("key")
- buf.WriteByte(cborBdBreak)
-
- buf.WriteByte(cborBdIndefiniteBytes)
- e.MustEncode([]byte{1, 2, 3})
- e.MustEncode([]byte{4, 5, 6})
- buf.WriteByte(cborBdBreak)
-
- //----
- buf.WriteByte(cborBdIndefiniteString)
- e.MustEncode("two-")
- e.MustEncode("string-")
- e.MustEncode("key")
- buf.WriteByte(cborBdBreak)
-
- buf.WriteByte(cborBdIndefiniteString)
- e.MustEncode([]byte("two-")) // encode as bytes, to check robustness of code
- e.MustEncode([]byte("value"))
- buf.WriteByte(cborBdBreak)
-
- //----
- buf.WriteByte(cborBdIndefiniteString)
- e.MustEncode("three-")
- e.MustEncode("list-")
- e.MustEncode("key")
- buf.WriteByte(cborBdBreak)
-
- buf.WriteByte(cborBdIndefiniteArray)
- e.MustEncode(true)
- e.MustEncode(false)
- e.MustEncode(uint64(1))
- e.MustEncode(int64(-1))
- buf.WriteByte(cborBdBreak)
-
- buf.WriteByte(cborBdBreak) // close map
-
- NewDecoderBytes(buf.Bytes(), testCborH).MustDecode(&vv)
- if err := deepEqual(v, vv); err != nil {
- logT(t, "-------- Before and After marshal do not match: Error: %v", err)
- logT(t, " ....... GOLDEN: (%T) %#v", v, v)
- logT(t, " ....... DECODED: (%T) %#v", vv, vv)
- failT(t)
- }
-}
-
-type testCborGolden struct {
- Base64 string `codec:"cbor"`
- Hex string `codec:"hex"`
- Roundtrip bool `codec:"roundtrip"`
- Decoded interface{} `codec:"decoded"`
- Diagnostic string `codec:"diagnostic"`
- Skip bool `codec:"skip"`
-}
-
-// Some tests are skipped because they include numbers outside the range of int64/uint64
-func TestCborGoldens(t *testing.T) {
- oldMapType := testCborH.MapType
- defer func() {
- testCborH.MapType = oldMapType
- }()
- testCborH.MapType = testMapStrIntfTyp
- // decode test-cbor-goldens.json into a list of []*testCborGolden
- // for each one,
- // - decode hex into []byte bs
- // - decode bs into interface{} v
- // - compare both using deepequal
- // - for any miss, record it
- var gs []*testCborGolden
- f, err := os.Open("test-cbor-goldens.json")
- if err != nil {
- logT(t, "error opening test-cbor-goldens.json: %v", err)
- failT(t)
- }
- defer f.Close()
- jh := new(JsonHandle)
- jh.MapType = testMapStrIntfTyp
- // d := NewDecoder(f, jh)
- d := NewDecoder(bufio.NewReader(f), jh)
- // err = d.Decode(&gs)
- d.MustDecode(&gs)
- if err != nil {
- logT(t, "error json decoding test-cbor-goldens.json: %v", err)
- failT(t)
- }
-
- tagregex := regexp.MustCompile(`[\d]+\(.+?\)`)
- hexregex := regexp.MustCompile(`h'([0-9a-fA-F]*)'`)
- for i, g := range gs {
- // fmt.Printf("%v, skip: %v, isTag: %v, %s\n", i, g.Skip, tagregex.MatchString(g.Diagnostic), g.Diagnostic)
- // skip tags or simple or those with prefix, as we can't verify them.
- if g.Skip || strings.HasPrefix(g.Diagnostic, "simple(") || tagregex.MatchString(g.Diagnostic) {
- // fmt.Printf("%v: skipped\n", i)
- logT(t, "[%v] skipping because skip=true OR unsupported simple value or Tag Value", i)
- continue
- }
- // println("++++++++++++", i, "g.Diagnostic", g.Diagnostic)
- if hexregex.MatchString(g.Diagnostic) {
- // println(i, "g.Diagnostic matched hex")
- if s2 := g.Diagnostic[2 : len(g.Diagnostic)-1]; s2 == "" {
- g.Decoded = zeroByteSlice
- } else if bs2, err2 := hex.DecodeString(s2); err2 == nil {
- g.Decoded = bs2
- }
- // fmt.Printf("%v: hex: %v\n", i, g.Decoded)
- }
- bs, err := hex.DecodeString(g.Hex)
- if err != nil {
- logT(t, "[%v] error hex decoding %s [%v]: %v", i, g.Hex, err)
- failT(t)
- }
- var v interface{}
- NewDecoderBytes(bs, testCborH).MustDecode(&v)
- if _, ok := v.(RawExt); ok {
- continue
- }
- // check the diagnostics to compare
- switch g.Diagnostic {
- case "Infinity":
- b := math.IsInf(v.(float64), 1)
- testCborError(t, i, math.Inf(1), v, nil, &b)
- case "-Infinity":
- b := math.IsInf(v.(float64), -1)
- testCborError(t, i, math.Inf(-1), v, nil, &b)
- case "NaN":
- // println(i, "checking NaN")
- b := math.IsNaN(v.(float64))
- testCborError(t, i, math.NaN(), v, nil, &b)
- case "undefined":
- b := v == nil
- testCborError(t, i, nil, v, nil, &b)
- default:
- v0 := g.Decoded
- // testCborCoerceJsonNumber(reflect.ValueOf(&v0))
- testCborError(t, i, v0, v, deepEqual(v0, v), nil)
- }
- }
-}
-
-func testCborError(t *testing.T, i int, v0, v1 interface{}, err error, equal *bool) {
- if err == nil && equal == nil {
- // fmt.Printf("%v testCborError passed (err and equal nil)\n", i)
- return
- }
- if err != nil {
- logT(t, "[%v] deepEqual error: %v", i, err)
- logT(t, " ....... GOLDEN: (%T) %#v", v0, v0)
- logT(t, " ....... DECODED: (%T) %#v", v1, v1)
- failT(t)
- }
- if equal != nil && !*equal {
- logT(t, "[%v] values not equal", i)
- logT(t, " ....... GOLDEN: (%T) %#v", v0, v0)
- logT(t, " ....... DECODED: (%T) %#v", v1, v1)
- failT(t)
- }
- // fmt.Printf("%v testCborError passed (checks passed)\n", i)
-}
-
-func TestCborHalfFloat(t *testing.T) {
- m := map[uint16]float64{
- // using examples from
- // https://en.wikipedia.org/wiki/Half-precision_floating-point_format
- 0x3c00: 1,
- 0x3c01: 1 + math.Pow(2, -10),
- 0xc000: -2,
- 0x7bff: 65504,
- 0x0400: math.Pow(2, -14),
- 0x03ff: math.Pow(2, -14) - math.Pow(2, -24),
- 0x0001: math.Pow(2, -24),
- 0x0000: 0,
- 0x8000: -0.0,
- }
- var ba [3]byte
- ba[0] = cborBdFloat16
- var res float64
- for k, v := range m {
- res = 0
- bigen.PutUint16(ba[1:], k)
- testUnmarshalErr(&res, ba[:3], testCborH, t, "-")
- if res == v {
- logT(t, "equal floats: from %x %b, %v", k, k, v)
- } else {
- failT(t, "unequal floats: from %x %b, %v != %v", k, k, res, v)
- }
- }
-}
diff --git a/vendor/github.com/ugorji/go/codec/codec_test.go b/vendor/github.com/ugorji/go/codec/codec_test.go
deleted file mode 100644
index 2bd9dc5c9..000000000
--- a/vendor/github.com/ugorji/go/codec/codec_test.go
+++ /dev/null
@@ -1,3008 +0,0 @@
-// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-import (
- "bufio"
- "bytes"
- "encoding/gob"
- "fmt"
- "io"
- "io/ioutil"
- "math"
- "math/rand"
- "net"
- "net/rpc"
- "os"
- "os/exec"
- "path/filepath"
- "reflect"
- "runtime"
- "strconv"
- "strings"
- "sync/atomic"
- "testing"
- "time"
-)
-
-func init() {
- testPreInitFns = append(testPreInitFns, testInit)
- // fmt.Printf("sizeof: Decoder: %v, Encoder: %v, decNaked: %v\n",
- // reflect.TypeOf((*Decoder)(nil)).Elem().Size(),
- // reflect.TypeOf((*Encoder)(nil)).Elem().Size(),
- // reflect.TypeOf((*decNaked)(nil)).Elem().Size(),
- // )
-}
-
-type testCustomStringT string
-
-// make this a mapbyslice
-type testMbsT []interface{}
-
-func (testMbsT) MapBySlice() {}
-
-type testMbsCustStrT []testCustomStringT
-
-func (testMbsCustStrT) MapBySlice() {}
-
-type testIntfMapI interface {
- GetIntfMapV() string
-}
-
-type testIntfMapT1 struct {
- IntfMapV string
-}
-
-func (x *testIntfMapT1) GetIntfMapV() string { return x.IntfMapV }
-
-type testIntfMapT2 struct {
- IntfMapV string
-}
-
-func (x testIntfMapT2) GetIntfMapV() string { return x.IntfMapV }
-
-// ----
-
-type testVerifyFlag uint8
-
-const (
- _ testVerifyFlag = 1 << iota
- testVerifyMapTypeSame
- testVerifyMapTypeStrIntf
- testVerifyMapTypeIntfIntf
- // testVerifySliceIntf
- testVerifyForPython
- testVerifyDoNil
- testVerifyTimeAsInteger
-)
-
-func (f testVerifyFlag) isset(v testVerifyFlag) bool {
- return f&v == v
-}
-
-// const testSkipRPCTests = false
-
-var (
- testTableNumPrimitives int
- testTableIdxTime int
- testTableNumMaps int
-
- // set this when running using bufio, etc
- testSkipRPCTests = false
-)
-
-var (
- skipVerifyVal interface{} = &(struct{}{})
-
- testMapStrIntfTyp = reflect.TypeOf(map[string]interface{}(nil))
-
- // For Go Time, do not use a descriptive timezone.
- // It's unnecessary, and makes it harder to do a reflect.DeepEqual.
- // The Offset already tells what the offset should be, if not on UTC and unknown zone name.
- timeLoc = time.FixedZone("", -8*60*60) // UTC-08:00 //time.UTC-8
- timeToCompare1 = time.Date(2012, 2, 2, 2, 2, 2, 2000, timeLoc).UTC()
- timeToCompare2 = time.Date(1900, 2, 2, 2, 2, 2, 2000, timeLoc).UTC()
- timeToCompare3 = time.Unix(0, 270).UTC() // use value that must be encoded as uint64 for nanoseconds (for cbor/msgpack comparison)
- //timeToCompare4 = time.Time{}.UTC() // does not work well with simple cbor time encoding (overflow)
- timeToCompare4 = time.Unix(-2013855848, 4223).UTC()
-
- table []interface{} // main items we encode
- // will encode a float32 as float64, or large int as uint
- testRpcInt = new(TestRpcInt)
-)
-
-var wrapInt64Typ = reflect.TypeOf(wrapInt64(0))
-var wrapBytesTyp = reflect.TypeOf(wrapBytes(nil))
-
-func testByteBuf(in []byte) *bytes.Buffer {
- return bytes.NewBuffer(in)
-}
-
-type TestABC struct {
- A, B, C string
-}
-
-func (x *TestABC) MarshalBinary() ([]byte, error) {
- return []byte(fmt.Sprintf("%s %s %s", x.A, x.B, x.C)), nil
-}
-func (x *TestABC) MarshalText() ([]byte, error) {
- return []byte(fmt.Sprintf("%s %s %s", x.A, x.B, x.C)), nil
-}
-func (x *TestABC) MarshalJSON() ([]byte, error) {
- return []byte(fmt.Sprintf(`"%s %s %s"`, x.A, x.B, x.C)), nil
-}
-
-func (x *TestABC) UnmarshalBinary(data []byte) (err error) {
- ss := strings.Split(string(data), " ")
- x.A, x.B, x.C = ss[0], ss[1], ss[2]
- return
-}
-func (x *TestABC) UnmarshalText(data []byte) (err error) {
- return x.UnmarshalBinary(data)
-}
-func (x *TestABC) UnmarshalJSON(data []byte) (err error) {
- return x.UnmarshalBinary(data[1 : len(data)-1])
-}
-
-type TestABC2 struct {
- A, B, C string
-}
-
-func (x TestABC2) MarshalText() ([]byte, error) {
- return []byte(fmt.Sprintf("%s %s %s", x.A, x.B, x.C)), nil
-}
-func (x *TestABC2) UnmarshalText(data []byte) (err error) {
- ss := strings.Split(string(data), " ")
- x.A, x.B, x.C = ss[0], ss[1], ss[2]
- return
- // _, err = fmt.Sscanf(string(data), "%s %s %s", &x.A, &x.B, &x.C)
-}
-
-type TestSimplish struct {
- Ii int
- Ss string
- Ar [2]*TestSimplish
- Sl []*TestSimplish
- Mm map[string]*TestSimplish
-}
-
-type TestRpcABC struct {
- A, B, C string
-}
-
-type TestRpcInt struct {
- i int
-}
-
-func (r *TestRpcInt) Update(n int, res *int) error { r.i = n; *res = r.i; return nil }
-func (r *TestRpcInt) Square(ignore int, res *int) error { *res = r.i * r.i; return nil }
-func (r *TestRpcInt) Mult(n int, res *int) error { *res = r.i * n; return nil }
-func (r *TestRpcInt) EchoStruct(arg TestRpcABC, res *string) error {
- *res = fmt.Sprintf("%#v", arg)
- return nil
-}
-func (r *TestRpcInt) Echo123(args []string, res *string) error {
- *res = fmt.Sprintf("%#v", args)
- return nil
-}
-
-type TestRawValue struct {
- R Raw
- I int
-}
-
-// ----
-
-type testUnixNanoTimeExt struct {
- // keep timestamp here, so that do not incur interface-conversion costs
- // ts int64
-}
-
-func (x *testUnixNanoTimeExt) WriteExt(v interface{}) []byte {
- v2 := v.(*time.Time)
- bs := make([]byte, 8)
- bigen.PutUint64(bs, uint64(v2.UnixNano()))
- return bs
-}
-func (x *testUnixNanoTimeExt) ReadExt(v interface{}, bs []byte) {
- v2 := v.(*time.Time)
- ui := bigen.Uint64(bs)
- *v2 = time.Unix(0, int64(ui)).UTC()
-}
-func (x *testUnixNanoTimeExt) ConvertExt(v interface{}) interface{} {
- v2 := v.(*time.Time) // structs are encoded by passing the ptr
- return v2.UTC().UnixNano()
-}
-
-func (x *testUnixNanoTimeExt) UpdateExt(dest interface{}, v interface{}) {
- tt := dest.(*time.Time)
- switch v2 := v.(type) {
- case int64:
- *tt = time.Unix(0, v2).UTC()
- case uint64:
- *tt = time.Unix(0, int64(v2)).UTC()
- //case float64:
- //case string:
- default:
- panic(fmt.Sprintf("unsupported format for time conversion: expecting int64/uint64; got %T", v))
- }
-}
-
-// ----
-
-type wrapInt64Ext int64
-
-func (x *wrapInt64Ext) WriteExt(v interface{}) []byte {
- v2 := uint64(int64(v.(wrapInt64)))
- bs := make([]byte, 8)
- bigen.PutUint64(bs, v2)
- return bs
-}
-func (x *wrapInt64Ext) ReadExt(v interface{}, bs []byte) {
- v2 := v.(*wrapInt64)
- ui := bigen.Uint64(bs)
- *v2 = wrapInt64(int64(ui))
-}
-func (x *wrapInt64Ext) ConvertExt(v interface{}) interface{} {
- return int64(v.(wrapInt64))
-}
-func (x *wrapInt64Ext) UpdateExt(dest interface{}, v interface{}) {
- v2 := dest.(*wrapInt64)
- *v2 = wrapInt64(v.(int64))
-}
-
-// ----
-
-type wrapBytesExt struct{}
-
-func (x *wrapBytesExt) WriteExt(v interface{}) []byte {
- return ([]byte)(v.(wrapBytes))
-}
-func (x *wrapBytesExt) ReadExt(v interface{}, bs []byte) {
- v2 := v.(*wrapBytes)
- *v2 = wrapBytes(bs)
-}
-func (x *wrapBytesExt) ConvertExt(v interface{}) interface{} {
- return ([]byte)(v.(wrapBytes))
-}
-func (x *wrapBytesExt) UpdateExt(dest interface{}, v interface{}) {
- v2 := dest.(*wrapBytes)
- // some formats (e.g. json) cannot nakedly determine []byte from string, so expect both
- switch v3 := v.(type) {
- case []byte:
- *v2 = wrapBytes(v3)
- case string:
- *v2 = wrapBytes([]byte(v3))
- default:
- panic("UpdateExt for wrapBytesExt expects string or []byte")
- }
- // *v2 = wrapBytes(v.([]byte))
-}
-
-// ----
-
-// timeExt is an extension handler for time.Time, that uses binc model for encoding/decoding time.
-// we used binc model, as that is the only custom time representation that we designed ourselves.
-type timeExt struct{}
-
-func (x timeExt) WriteExt(v interface{}) (bs []byte) {
- switch v2 := v.(type) {
- case time.Time:
- bs = bincEncodeTime(v2)
- case *time.Time:
- bs = bincEncodeTime(*v2)
- default:
- panic(fmt.Errorf("unsupported format for time conversion: expecting time.Time; got %T", v2))
- }
- return
-}
-func (x timeExt) ReadExt(v interface{}, bs []byte) {
- tt, err := bincDecodeTime(bs)
- if err != nil {
- panic(err)
- }
- *(v.(*time.Time)) = tt
-}
-
-func (x timeExt) ConvertExt(v interface{}) interface{} {
- return x.WriteExt(v)
-}
-func (x timeExt) UpdateExt(v interface{}, src interface{}) {
- x.ReadExt(v, src.([]byte))
-}
-
-// ----
-
-func testCodecEncode(ts interface{}, bsIn []byte,
- fn func([]byte) *bytes.Buffer, h Handle) (bs []byte, err error) {
- return sTestCodecEncode(ts, bsIn, fn, h, h.getBasicHandle())
-}
-
-func testCodecDecode(bs []byte, ts interface{}, h Handle) (err error) {
- return sTestCodecDecode(bs, ts, h, h.getBasicHandle())
-}
-
-func checkErrT(t *testing.T, err error) {
- if err != nil {
- failT(t, err.Error())
- }
-}
-
-func checkEqualT(t *testing.T, v1 interface{}, v2 interface{}, desc string) {
- if err := deepEqual(v1, v2); err != nil {
- failT(t, "Not Equal: %s: %v. v1: %v, v2: %v", desc, err, v1, v2)
- }
-}
-
-func failT(t *testing.T, args ...interface{}) {
- if len(args) > 0 {
- if format, isstr := args[0].(string); isstr {
- logT(t, format, args[1:]...)
- }
- }
- t.FailNow()
-}
-
-func testInit() {
- gob.Register(new(TestStrucFlex))
- if testInitDebug {
- ts0 := newTestStrucFlex(2, testNumRepeatString, false, !testSkipIntf, false)
- logT(nil, "====> depth: %v, ts: %#v\n", 2, ts0)
- }
-
- for _, v := range testHandles {
- bh := v.getBasicHandle()
- // pre-fill them first
- bh.EncodeOptions = testEncodeOptions
- bh.DecodeOptions = testDecodeOptions
- // bh.InterfaceReset = true
- // bh.PreferArrayOverSlice = true
- // modify from flag'ish things
- bh.InternString = testInternStr
- bh.Canonical = testCanonical
- bh.CheckCircularRef = testCheckCircRef
- bh.StructToArray = testStructToArray
- bh.MaxInitLen = testMaxInitLen
- }
-
- testMsgpackH.RawToString = true
-
- var tTimeExt timeExt
- var tBytesExt wrapBytesExt
- var tI64Ext wrapInt64Ext
-
- // create legacy functions suitable for deprecated AddExt functionality,
- // and use on some places for testSimpleH e.g. for time.Time and wrapInt64
- var (
- myExtEncFn = func(x BytesExt, rv reflect.Value) (bs []byte, err error) {
- defer panicToErr(errstrDecoratorDef{}, &err)
- bs = x.WriteExt(rv.Interface())
- return
- }
- myExtDecFn = func(x BytesExt, rv reflect.Value, bs []byte) (err error) {
- defer panicToErr(errstrDecoratorDef{}, &err)
- x.ReadExt(rv.Interface(), bs)
- return
- }
- timeExtEncFn = func(rv reflect.Value) (bs []byte, err error) { return myExtEncFn(tTimeExt, rv) }
- timeExtDecFn = func(rv reflect.Value, bs []byte) (err error) { return myExtDecFn(tTimeExt, rv, bs) }
- wrapInt64ExtEncFn = func(rv reflect.Value) (bs []byte, err error) { return myExtEncFn(&tI64Ext, rv) }
- wrapInt64ExtDecFn = func(rv reflect.Value, bs []byte) (err error) { return myExtDecFn(&tI64Ext, rv, bs) }
- )
-
- chkErr := func(err error) {
- if err != nil {
- panic(err)
- }
- }
-
- // time.Time is a native type, so extensions will have no effect.
- // However, we add these here to ensure nothing happens.
- chkErr(testSimpleH.AddExt(timeTyp, 1, timeExtEncFn, timeExtDecFn))
- // testBincH.SetBytesExt(timeTyp, 1, timeExt{}) // time is builtin for binc
- chkErr(testMsgpackH.SetBytesExt(timeTyp, 1, timeExt{}))
- chkErr(testCborH.SetInterfaceExt(timeTyp, 1, &testUnixNanoTimeExt{}))
- // testJsonH.SetInterfaceExt(timeTyp, 1, &testUnixNanoTimeExt{})
-
- // Now, add extensions for the type wrapInt64 and wrapBytes,
- // so we can execute the Encode/Decode Ext paths.
-
- chkErr(testSimpleH.SetBytesExt(wrapBytesTyp, 32, &tBytesExt))
- chkErr(testMsgpackH.SetBytesExt(wrapBytesTyp, 32, &tBytesExt))
- chkErr(testBincH.SetBytesExt(wrapBytesTyp, 32, &tBytesExt))
- chkErr(testJsonH.SetInterfaceExt(wrapBytesTyp, 32, &tBytesExt))
- chkErr(testCborH.SetInterfaceExt(wrapBytesTyp, 32, &tBytesExt))
-
- chkErr(testSimpleH.AddExt(wrapInt64Typ, 16, wrapInt64ExtEncFn, wrapInt64ExtDecFn))
- // chkErr(testSimpleH.SetBytesExt(wrapInt64Typ, 16, &tI64Ext))
- chkErr(testMsgpackH.SetBytesExt(wrapInt64Typ, 16, &tI64Ext))
- chkErr(testBincH.SetBytesExt(wrapInt64Typ, 16, &tI64Ext))
- chkErr(testJsonH.SetInterfaceExt(wrapInt64Typ, 16, &tI64Ext))
- chkErr(testCborH.SetInterfaceExt(wrapInt64Typ, 16, &tI64Ext))
-
- // primitives MUST be an even number, so it can be used as a mapBySlice also.
- primitives := []interface{}{
- int8(-8),
- int16(-1616),
- int32(-32323232),
- int64(-6464646464646464),
- uint8(192),
- uint16(1616),
- uint32(32323232),
- uint64(6464646464646464),
- byte(192),
- float32(-3232.0),
- float64(-6464646464.0),
- float32(3232.0),
- float64(6464.0),
- float64(6464646464.0),
- false,
- true,
- "null",
- nil,
- "some&day>some<day",
- timeToCompare1,
- "",
- timeToCompare2,
- "bytestring",
- timeToCompare3,
- "none",
- timeToCompare4,
- }
-
- maps := []interface{}{
- map[string]bool{
- "true": true,
- "false": false,
- },
- map[string]interface{}{
- "true": "True",
- "false": false,
- "uint16(1616)": uint16(1616),
- },
- //add a complex combo map in here. (map has list which has map)
- //note that after the first thing, everything else should be generic.
- map[string]interface{}{
- "list": []interface{}{
- int16(1616),
- int32(32323232),
- true,
- float32(-3232.0),
- map[string]interface{}{
- "TRUE": true,
- "FALSE": false,
- },
- []interface{}{true, false},
- },
- "int32": int32(32323232),
- "bool": true,
- "LONG STRING": `
-1234567890 1234567890
-1234567890 1234567890
-1234567890 1234567890
-ABCDEDFGHIJKLMNOPQRSTUVWXYZ
-abcdedfghijklmnopqrstuvwxyz
-ABCDEDFGHIJKLMNOPQRSTUVWXYZ
-abcdedfghijklmnopqrstuvwxyz
-"ABCDEDFGHIJKLMNOPQRSTUVWXYZ"
-' a tab '
-\a\b\c\d\e
-\b\f\n\r\t all literally
-ugorji
-`,
- "SHORT STRING": "1234567890",
- },
- map[interface{}]interface{}{
- true: "true",
- uint8(138): false,
- false: uint8(200),
- },
- }
-
- testTableNumPrimitives = len(primitives)
- testTableIdxTime = testTableNumPrimitives - 8
- testTableNumMaps = len(maps)
-
- table = []interface{}{}
- table = append(table, primitives...)
- table = append(table, primitives)
- table = append(table, testMbsT(primitives))
- table = append(table, maps...)
- table = append(table, newTestStrucFlex(0, testNumRepeatString, false, !testSkipIntf, false))
-
-}
-
-func testTableVerify(f testVerifyFlag, h Handle) (av []interface{}) {
- av = make([]interface{}, len(table))
- lp := testTableNumPrimitives + 4
- // doNil := f & testVerifyDoNil == testVerifyDoNil
- // doPython := f & testVerifyForPython == testVerifyForPython
- switch {
- case f.isset(testVerifyForPython):
- for i, v := range table {
- if i == testTableNumPrimitives+1 || i > lp { // testTableNumPrimitives+1 is the mapBySlice
- av[i] = skipVerifyVal
- continue
- }
- av[i] = testVerifyVal(v, f, h)
- }
- // only do the python verify up to the maps, skipping the last 2 maps.
- av = av[:testTableNumPrimitives+2+testTableNumMaps-2]
- case f.isset(testVerifyDoNil):
- for i, v := range table {
- if i > lp {
- av[i] = skipVerifyVal
- continue
- }
- av[i] = testVerifyVal(v, f, h)
- }
- default:
- for i, v := range table {
- if i == lp {
- av[i] = skipVerifyVal
- continue
- }
- //av[i] = testVerifyVal(v, testVerifyMapTypeSame)
- switch v.(type) {
- case []interface{}:
- av[i] = testVerifyVal(v, f, h)
- case testMbsT:
- av[i] = testVerifyVal(v, f, h)
- case map[string]interface{}:
- av[i] = testVerifyVal(v, f, h)
- case map[interface{}]interface{}:
- av[i] = testVerifyVal(v, f, h)
- case time.Time:
- av[i] = testVerifyVal(v, f, h)
- default:
- av[i] = v
- }
- }
- }
- return
-}
-
-func testVerifyValInt(v int64, isMsgp bool) (v2 interface{}) {
- if isMsgp {
- if v >= 0 && v <= 127 {
- v2 = uint64(v)
- } else {
- v2 = int64(v)
- }
- } else if v >= 0 {
- v2 = uint64(v)
- } else {
- v2 = int64(v)
- }
- return
-}
-
-func testVerifyVal(v interface{}, f testVerifyFlag, h Handle) (v2 interface{}) {
- //for python msgpack,
- // - all positive integers are unsigned 64-bit ints
- // - all floats are float64
- _, isMsgp := h.(*MsgpackHandle)
- _, isCbor := h.(*CborHandle)
- switch iv := v.(type) {
- case int8:
- v2 = testVerifyValInt(int64(iv), isMsgp)
- // fmt.Printf(">>>> is msgp: %v, v: %T, %v ==> v2: %T, %v\n", isMsgp, v, v, v2, v2)
- case int16:
- v2 = testVerifyValInt(int64(iv), isMsgp)
- case int32:
- v2 = testVerifyValInt(int64(iv), isMsgp)
- case int64:
- v2 = testVerifyValInt(int64(iv), isMsgp)
- case uint8:
- v2 = uint64(iv)
- case uint16:
- v2 = uint64(iv)
- case uint32:
- v2 = uint64(iv)
- case uint64:
- v2 = uint64(iv)
- case float32:
- v2 = float64(iv)
- case float64:
- v2 = float64(iv)
- case []interface{}:
- m2 := make([]interface{}, len(iv))
- for j, vj := range iv {
- m2[j] = testVerifyVal(vj, f, h)
- }
- v2 = m2
- case testMbsT:
- m2 := make([]interface{}, len(iv))
- for j, vj := range iv {
- m2[j] = testVerifyVal(vj, f, h)
- }
- v2 = testMbsT(m2)
- case map[string]bool:
- switch {
- case f.isset(testVerifyMapTypeSame):
- m2 := make(map[string]bool)
- for kj, kv := range iv {
- m2[kj] = kv
- }
- v2 = m2
- case f.isset(testVerifyMapTypeStrIntf):
- m2 := make(map[string]interface{})
- for kj, kv := range iv {
- m2[kj] = kv
- }
- v2 = m2
- case f.isset(testVerifyMapTypeIntfIntf):
- m2 := make(map[interface{}]interface{})
- for kj, kv := range iv {
- m2[kj] = kv
- }
- v2 = m2
- }
- case map[string]interface{}:
- switch {
- case f.isset(testVerifyMapTypeSame):
- m2 := make(map[string]interface{})
- for kj, kv := range iv {
- m2[kj] = testVerifyVal(kv, f, h)
- }
- v2 = m2
- case f.isset(testVerifyMapTypeStrIntf):
- m2 := make(map[string]interface{})
- for kj, kv := range iv {
- m2[kj] = testVerifyVal(kv, f, h)
- }
- v2 = m2
- case f.isset(testVerifyMapTypeIntfIntf):
- m2 := make(map[interface{}]interface{})
- for kj, kv := range iv {
- m2[kj] = testVerifyVal(kv, f, h)
- }
- v2 = m2
- }
- case map[interface{}]interface{}:
- m2 := make(map[interface{}]interface{})
- for kj, kv := range iv {
- m2[testVerifyVal(kj, f, h)] = testVerifyVal(kv, f, h)
- }
- v2 = m2
- case time.Time:
- switch {
- case f.isset(testVerifyTimeAsInteger):
- if iv2 := iv.UnixNano(); iv2 >= 0 {
- v2 = uint64(iv2)
- } else {
- v2 = int64(iv2)
- }
- case isMsgp:
- v2 = iv.UTC()
- case isCbor:
- // fmt.Printf("%%%% cbor verifier\n")
- v2 = iv.UTC().Round(time.Microsecond)
- default:
- v2 = v
- }
- default:
- v2 = v
- }
- return
-}
-
-func testUnmarshal(v interface{}, data []byte, h Handle) (err error) {
- return testCodecDecode(data, v, h)
-}
-
-func testMarshal(v interface{}, h Handle) (bs []byte, err error) {
- return testCodecEncode(v, nil, testByteBuf, h)
-}
-
-func testMarshalErr(v interface{}, h Handle, t *testing.T, name string) (bs []byte) {
- bs, err := testMarshal(v, h)
- if err != nil {
- failT(t, "Error encoding %s: %v, Err: %v", name, v, err)
- }
- return
-}
-
-func testUnmarshalErr(v interface{}, data []byte, h Handle, t *testing.T, name string) {
- if err := testUnmarshal(v, data, h); err != nil {
- failT(t, "Error Decoding into %s: %v, Err: %v", name, v, err)
- }
-}
-
-func testDeepEqualErr(v1, v2 interface{}, t *testing.T, name string) {
- if err := deepEqual(v1, v2); err == nil {
- logT(t, "%s: values equal", name)
- } else {
- failT(t, "%s: values not equal: %v. 1: %v, 2: %v", name, err, v1, v2)
- }
-}
-
-func testReadWriteCloser(c io.ReadWriteCloser) io.ReadWriteCloser {
- if testRpcBufsize <= 0 && rand.Int63()%2 == 0 {
- return c
- }
- return struct {
- io.Closer
- *bufio.Reader
- *bufio.Writer
- }{c, bufio.NewReaderSize(c, testRpcBufsize), bufio.NewWriterSize(c, testRpcBufsize)}
-}
-
-// doTestCodecTableOne allows us test for different variations based on arguments passed.
-func doTestCodecTableOne(t *testing.T, testNil bool, h Handle,
- vs []interface{}, vsVerify []interface{}) {
- //if testNil, then just test for when a pointer to a nil interface{} is passed. It should work.
- //Current setup allows us test (at least manually) the nil interface or typed interface.
- logT(t, "================ TestNil: %v ================\n", testNil)
- for i, v0 := range vs {
- logT(t, "..............................................")
- logT(t, " Testing: #%d:, %T, %#v\n", i, v0, v0)
- b0 := testMarshalErr(v0, h, t, "v0")
- var b1 = b0
- if len(b1) > 256 {
- b1 = b1[:256]
- }
- if h.isBinary() {
- logT(t, " Encoded bytes: len: %v, %v\n", len(b0), b1)
- } else {
- logT(t, " Encoded string: len: %v, %v\n", len(b0), string(b1))
- // println("########### encoded string: " + string(b0))
- }
- var v1 interface{}
- var err error
- if testNil {
- err = testUnmarshal(&v1, b0, h)
- } else {
- if v0 != nil {
- v0rt := reflect.TypeOf(v0) // ptr
- if v0rt.Kind() == reflect.Ptr {
- err = testUnmarshal(v0, b0, h)
- v1 = v0
- } else {
- rv1 := reflect.New(v0rt)
- err = testUnmarshal(rv1.Interface(), b0, h)
- v1 = rv1.Elem().Interface()
- // v1 = reflect.Indirect(reflect.ValueOf(v1)).Interface()
- }
- }
- }
-
- logT(t, " v1 returned: %T, %v %#v", v1, v1, v1)
- // if v1 != nil {
- // logT(t, " v1 returned: %T, %#v", v1, v1)
- // //we always indirect, because ptr to typed value may be passed (if not testNil)
- // v1 = reflect.Indirect(reflect.ValueOf(v1)).Interface()
- // }
- if err != nil {
- failT(t, "-------- Error: %v. Partial return: %v", err, v1)
- }
- v0check := vsVerify[i]
- if v0check == skipVerifyVal {
- logT(t, " Nil Check skipped: Decoded: %T, %#v\n", v1, v1)
- continue
- }
-
- if err = deepEqual(v0check, v1); err == nil {
- logT(t, "++++++++ Before and After marshal matched\n")
- } else {
- // logT(t, "-------- Before and After marshal do not match: Error: %v"+
- // " ====> GOLDEN: (%T) %#v, DECODED: (%T) %#v\n", err, v0check, v0check, v1, v1)
- logT(t, "-------- FAIL: Before and After marshal do not match: Error: %v", err)
- logT(t, " ....... GOLDEN: (%T) %v %#v", v0check, v0check, v0check)
- logT(t, " ....... DECODED: (%T) %v %#v", v1, v1, v1)
- failT(t)
- }
- }
-}
-
-func testCodecTableOne(t *testing.T, h Handle) {
- testOnce.Do(testInitAll)
- // func TestMsgpackAllExperimental(t *testing.T) {
- // dopts := testDecOpts(nil, nil, false, true, true),
-
- numPrim, numMap, idxTime, idxMap := testTableNumPrimitives, testTableNumMaps, testTableIdxTime, testTableNumPrimitives+2
-
- //println("#################")
- tableVerify := testTableVerify(testVerifyMapTypeSame, h)
- tableTestNilVerify := testTableVerify(testVerifyDoNil|testVerifyMapTypeStrIntf, h)
- switch v := h.(type) {
- case *MsgpackHandle:
- var oldWriteExt, oldRawToString bool
- _, _ = oldWriteExt, oldRawToString
- oldWriteExt, v.WriteExt = v.WriteExt, true
- oldRawToString, v.RawToString = v.RawToString, true
- // defer func() { v.WriteExt, v.RawToString = oldWriteExt, oldRawToString }()
- doTestCodecTableOne(t, false, h, table, tableVerify)
- v.WriteExt = oldWriteExt
- v.RawToString = oldRawToString
- case *JsonHandle:
- //skip []interface{} containing time.Time, as it encodes as a number, but cannot decode back to time.Time.
- //As there is no real support for extension tags in json, this must be skipped.
- doTestCodecTableOne(t, false, h, table[:numPrim], tableVerify[:numPrim])
- doTestCodecTableOne(t, false, h, table[idxMap:], tableVerify[idxMap:])
- default:
- doTestCodecTableOne(t, false, h, table, tableVerify)
- }
- // func TestMsgpackAll(t *testing.T) {
-
- // //skip []interface{} containing time.Time
- // doTestCodecTableOne(t, false, h, table[:numPrim], tableVerify[:numPrim])
- // doTestCodecTableOne(t, false, h, table[numPrim+1:], tableVerify[numPrim+1:])
- // func TestMsgpackNilStringMap(t *testing.T) {
- var oldMapType reflect.Type
- v := h.getBasicHandle()
-
- oldMapType, v.MapType = v.MapType, testMapStrIntfTyp
- // defer func() { v.MapType = oldMapType }()
- //skip time.Time, []interface{} containing time.Time, last map, and newStruc
- doTestCodecTableOne(t, true, h, table[:idxTime], tableTestNilVerify[:idxTime])
- doTestCodecTableOne(t, true, h, table[idxMap:idxMap+numMap-1], tableTestNilVerify[idxMap:idxMap+numMap-1]) // failing one for msgpack
- v.MapType = oldMapType
- // func TestMsgpackNilIntf(t *testing.T) {
-
- //do last map and newStruc
- idx2 := idxMap + numMap - 1
- doTestCodecTableOne(t, true, h, table[idx2:], tableTestNilVerify[idx2:])
- //TODO? What is this one?
- //doTestCodecTableOne(t, true, h, table[17:18], tableTestNilVerify[17:18])
-}
-
-func testCodecMiscOne(t *testing.T, h Handle) {
- var err error
- testOnce.Do(testInitAll)
- b := testMarshalErr(32, h, t, "32")
- // Cannot do this nil one, because faster type assertion decoding will panic
- // var i *int32
- // if err = testUnmarshal(b, i, nil); err == nil {
- // logT(t, "------- Expecting error because we cannot unmarshal to int32 nil ptr")
- // failT(t)
- // }
- var i2 int32
- testUnmarshalErr(&i2, b, h, t, "int32-ptr")
- if i2 != int32(32) {
- logT(t, "------- didn't unmarshal to 32: Received: %d", i2)
- failT(t)
- }
-
- // func TestMsgpackDecodePtr(t *testing.T) {
- ts := newTestStrucFlex(testDepth, testNumRepeatString, false, !testSkipIntf, false)
- b = testMarshalErr(ts, h, t, "pointer-to-struct")
- if len(b) < 40 {
- logT(t, "------- Size must be > 40. Size: %d", len(b))
- failT(t)
- }
- var b1 = b
- if len(b1) > 256 {
- b1 = b1[:256]
- }
- if h.isBinary() {
- logT(t, "------- b: size: %v, value: %v", len(b), b1)
- } else {
- logT(t, "------- b: size: %v, value: %s", len(b), b1)
- }
- ts2 := emptyTestStrucFlex()
- testUnmarshalErr(ts2, b, h, t, "pointer-to-struct")
- if ts2.I64 != math.MaxInt64*2/3 {
- logT(t, "------- Unmarshal wrong. Expect I64 = 64. Got: %v", ts2.I64)
- failT(t)
- }
-
- // func TestMsgpackIntfDecode(t *testing.T) {
- m := map[string]int{"A": 2, "B": 3}
- p := []interface{}{m}
- bs := testMarshalErr(p, h, t, "p")
-
- m2 := map[string]int{}
- p2 := []interface{}{m2}
- testUnmarshalErr(&p2, bs, h, t, "&p2")
-
- if m2["A"] != 2 || m2["B"] != 3 {
- logT(t, "FAIL: m2 not as expected: expecting: %v, got: %v", m, m2)
- failT(t)
- }
-
- // log("m: %v, m2: %v, p: %v, p2: %v", m, m2, p, p2)
- checkEqualT(t, p, p2, "p=p2")
- checkEqualT(t, m, m2, "m=m2")
- if err = deepEqual(p, p2); err == nil {
- logT(t, "p and p2 match")
- } else {
- logT(t, "Not Equal: %v. p: %v, p2: %v", err, p, p2)
- failT(t)
- }
- if err = deepEqual(m, m2); err == nil {
- logT(t, "m and m2 match")
- } else {
- logT(t, "Not Equal: %v. m: %v, m2: %v", err, m, m2)
- failT(t)
- }
-
- // func TestMsgpackDecodeStructSubset(t *testing.T) {
- // test that we can decode a subset of the stream
- mm := map[string]interface{}{"A": 5, "B": 99, "C": 333}
- bs = testMarshalErr(mm, h, t, "mm")
- type ttt struct {
- A uint8
- C int32
- }
- var t2 ttt
- testUnmarshalErr(&t2, bs, h, t, "t2")
- t3 := ttt{5, 333}
- checkEqualT(t, t2, t3, "t2=t3")
-
- // println(">>>>>")
- // test simple arrays, non-addressable arrays, slices
- type tarr struct {
- A int64
- B [3]int64
- C []byte
- D [3]byte
- }
- var tarr0 = tarr{1, [3]int64{2, 3, 4}, []byte{4, 5, 6}, [3]byte{7, 8, 9}}
- // test both pointer and non-pointer (value)
- for _, tarr1 := range []interface{}{tarr0, &tarr0} {
- bs = testMarshalErr(tarr1, h, t, "tarr1")
- if _, ok := h.(*JsonHandle); ok {
- logT(t, "Marshal as: %s", bs)
- }
- var tarr2 tarr
- testUnmarshalErr(&tarr2, bs, h, t, "tarr2")
- checkEqualT(t, tarr0, tarr2, "tarr0=tarr2")
- }
-
- // test byte array, even if empty (msgpack only)
- if h == testMsgpackH {
- type ystruct struct {
- Anarray []byte
- }
- var ya = ystruct{}
- testUnmarshalErr(&ya, []byte{0x91, 0x90}, h, t, "ya")
- }
-
- var tt1, tt2 time.Time
- tt2 = time.Now()
- bs = testMarshalErr(tt1, h, t, "zero-time-enc")
- testUnmarshalErr(&tt2, bs, h, t, "zero-time-dec")
- testDeepEqualErr(tt1, tt2, t, "zero-time-eq")
-
- // test encoding a slice of byte (but not []byte) and decoding into a []byte
- var sw = []wrapUint8{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'}
- var bw []byte // ("ABCDEFGHIJ")
- bs = testMarshalErr(sw, h, t, "wrap-bytes-enc")
- testUnmarshalErr(&bw, bs, h, t, "wrap-bytes-dec")
- testDeepEqualErr(bw, []byte("ABCDEFGHIJ"), t, "wrap-bytes-eq")
-}
-
-func testCodecEmbeddedPointer(t *testing.T, h Handle) {
- testOnce.Do(testInitAll)
- type Z int
- type A struct {
- AnInt int
- }
- type B struct {
- *Z
- *A
- MoreInt int
- }
- var z Z = 4
- x1 := &B{&z, &A{5}, 6}
- bs := testMarshalErr(x1, h, t, "x1")
- var x2 = new(B)
- testUnmarshalErr(x2, bs, h, t, "x2")
- checkEqualT(t, x1, x2, "x1=x2")
-}
-
-func testCodecUnderlyingType(t *testing.T, h Handle) {
- testOnce.Do(testInitAll)
- // Manual Test.
- // Run by hand, with accompanying print statements in fast-path.go
- // to ensure that the fast functions are called.
- type T1 map[string]string
- v := T1{"1": "1s", "2": "2s"}
- var bs []byte
- var err error
- NewEncoderBytes(&bs, h).MustEncode(v)
- if err != nil {
- logT(t, "Error during encode: %v", err)
- failT(t)
- }
- var v2 T1
- NewDecoderBytes(bs, h).MustDecode(&v2)
- if err != nil {
- logT(t, "Error during decode: %v", err)
- failT(t)
- }
-}
-
-func testCodecChan(t *testing.T, h Handle) {
- testOnce.Do(testInitAll)
- // - send a slice []*int64 (sl1) into an chan (ch1) with cap > len(s1)
- // - encode ch1 as a stream array
- // - decode a chan (ch2), with cap > len(s1) from the stream array
- // - receive from ch2 into slice sl2
- // - compare sl1 and sl2
- // - do this for codecs: json, cbor (covers all types)
-
- if true {
- logT(t, "*int64")
- sl1 := make([]*int64, 4)
- for i := range sl1 {
- var j int64 = int64(i)
- sl1[i] = &j
- }
- ch1 := make(chan *int64, 4)
- for _, j := range sl1 {
- ch1 <- j
- }
- var bs []byte
- NewEncoderBytes(&bs, h).MustEncode(ch1)
- ch2 := make(chan *int64, 8)
- NewDecoderBytes(bs, h).MustDecode(&ch2)
- close(ch2)
- var sl2 []*int64
- for j := range ch2 {
- sl2 = append(sl2, j)
- }
- if err := deepEqual(sl1, sl2); err != nil {
- logT(t, "FAIL: Not Match: %v; len: %v, %v", err, len(sl1), len(sl2))
- failT(t)
- }
- }
-
- if true {
- logT(t, "testBytesT []byte - input []byte")
- type testBytesT []byte
- sl1 := make([]testBytesT, 4)
- for i := range sl1 {
- var j = []byte(strings.Repeat(strconv.FormatInt(int64(i), 10), i))
- sl1[i] = j
- }
- ch1 := make(chan testBytesT, 4)
- for _, j := range sl1 {
- ch1 <- j
- }
- var bs []byte
- NewEncoderBytes(&bs, h).MustEncode(ch1)
- ch2 := make(chan testBytesT, 8)
- NewDecoderBytes(bs, h).MustDecode(&ch2)
- close(ch2)
- var sl2 []testBytesT
- for j := range ch2 {
- // logT(t, ">>>> from chan: is nil? %v, %v", j == nil, j)
- sl2 = append(sl2, j)
- }
- if err := deepEqual(sl1, sl2); err != nil {
- logT(t, "FAIL: Not Match: %v; len: %v, %v", err, len(sl1), len(sl2))
- failT(t)
- }
- }
- if true {
- logT(t, "testBytesT byte - input string/testBytesT")
- type testBytesT byte
- sl1 := make([]testBytesT, 4)
- for i := range sl1 {
- var j = strconv.FormatInt(int64(i), 10)[0]
- sl1[i] = testBytesT(j)
- }
- ch1 := make(chan testBytesT, 4)
- for _, j := range sl1 {
- ch1 <- j
- }
- var bs []byte
- NewEncoderBytes(&bs, h).MustEncode(ch1)
- ch2 := make(chan testBytesT, 8)
- NewDecoderBytes(bs, h).MustDecode(&ch2)
- close(ch2)
- var sl2 []testBytesT
- for j := range ch2 {
- sl2 = append(sl2, j)
- }
- if err := deepEqual(sl1, sl2); err != nil {
- logT(t, "FAIL: Not Match: %v; len: %v, %v", err, len(sl1), len(sl2))
- failT(t)
- }
- }
-
- if true {
- logT(t, "*[]byte")
- sl1 := make([]byte, 4)
- for i := range sl1 {
- var j = strconv.FormatInt(int64(i), 10)[0]
- sl1[i] = byte(j)
- }
- ch1 := make(chan byte, 4)
- for _, j := range sl1 {
- ch1 <- j
- }
- var bs []byte
- NewEncoderBytes(&bs, h).MustEncode(ch1)
- ch2 := make(chan byte, 8)
- NewDecoderBytes(bs, h).MustDecode(&ch2)
- close(ch2)
- var sl2 []byte
- for j := range ch2 {
- sl2 = append(sl2, j)
- }
- if err := deepEqual(sl1, sl2); err != nil {
- logT(t, "FAIL: Not Match: %v; len: %v, %v", err, len(sl1), len(sl2))
- failT(t)
- }
- }
-
-}
-
-func testCodecRpcOne(t *testing.T, rr Rpc, h Handle, doRequest bool, exitSleepMs time.Duration,
-) (port int) {
- testOnce.Do(testInitAll)
- if testSkipRPCTests {
- return
- }
- // rpc needs EOF, which is sent via a panic, and so must be recovered.
- if !recoverPanicToErr {
- logT(t, "EXPECTED. set recoverPanicToErr=true, since rpc needs EOF")
- failT(t)
- }
-
- if jsonH, ok := h.(*JsonHandle); ok && !jsonH.TermWhitespace {
- jsonH.TermWhitespace = true
- defer func() { jsonH.TermWhitespace = false }()
- }
- srv := rpc.NewServer()
- srv.Register(testRpcInt)
- ln, err := net.Listen("tcp", "127.0.0.1:0")
- // log("listener: %v", ln.Addr())
- checkErrT(t, err)
- port = (ln.Addr().(*net.TCPAddr)).Port
- // var opts *DecoderOptions
- // opts := testDecOpts
- // opts.MapType = mapStrIntfTyp
- // opts.RawToString = false
- serverExitChan := make(chan bool, 1)
- var serverExitFlag uint64
- serverFn := func() {
- for {
- conn1, err1 := ln.Accept()
- // if err1 != nil {
- // //fmt.Printf("accept err1: %v\n", err1)
- // continue
- // }
- if atomic.LoadUint64(&serverExitFlag) == 1 {
- serverExitChan <- true
- conn1.Close()
- return // exit serverFn goroutine
- }
- if err1 == nil {
- sc := rr.ServerCodec(testReadWriteCloser(conn1), h)
- srv.ServeCodec(sc)
- }
- }
- }
-
- clientFn := func(cc rpc.ClientCodec) {
- cl := rpc.NewClientWithCodec(cc)
- defer cl.Close()
- // defer func() { println("##### client closing"); cl.Close() }()
- var up, sq, mult int
- var rstr string
- // log("Calling client")
- checkErrT(t, cl.Call("TestRpcInt.Update", 5, &up))
- // log("Called TestRpcInt.Update")
- checkEqualT(t, testRpcInt.i, 5, "testRpcInt.i=5")
- checkEqualT(t, up, 5, "up=5")
- checkErrT(t, cl.Call("TestRpcInt.Square", 1, &sq))
- checkEqualT(t, sq, 25, "sq=25")
- checkErrT(t, cl.Call("TestRpcInt.Mult", 20, &mult))
- checkEqualT(t, mult, 100, "mult=100")
- checkErrT(t, cl.Call("TestRpcInt.EchoStruct", TestRpcABC{"Aa", "Bb", "Cc"}, &rstr))
- checkEqualT(t, rstr, fmt.Sprintf("%#v", TestRpcABC{"Aa", "Bb", "Cc"}), "rstr=")
- checkErrT(t, cl.Call("TestRpcInt.Echo123", []string{"A1", "B2", "C3"}, &rstr))
- checkEqualT(t, rstr, fmt.Sprintf("%#v", []string{"A1", "B2", "C3"}), "rstr=")
- }
-
- connFn := func() (bs net.Conn) {
- // log("calling f1")
- bs, err2 := net.Dial(ln.Addr().Network(), ln.Addr().String())
- checkErrT(t, err2)
- return
- }
-
- exitFn := func() {
- atomic.StoreUint64(&serverExitFlag, 1)
- bs := connFn()
- <-serverExitChan
- bs.Close()
- // serverExitChan <- true
- }
-
- go serverFn()
- runtime.Gosched()
- //time.Sleep(100 * time.Millisecond)
- if exitSleepMs == 0 {
- defer ln.Close()
- defer exitFn()
- }
- if doRequest {
- bs := connFn()
- cc := rr.ClientCodec(testReadWriteCloser(bs), h)
- clientFn(cc)
- }
- if exitSleepMs != 0 {
- go func() {
- defer ln.Close()
- time.Sleep(exitSleepMs)
- exitFn()
- }()
- }
- return
-}
-
-func doTestMapEncodeForCanonical(t *testing.T, name string, h Handle) {
- testOnce.Do(testInitAll)
- // println("doTestMapEncodeForCanonical")
- v1 := map[stringUint64T]interface{}{
- {"a", 1}: 1,
- {"b", 2}: "hello",
- {"c", 3}: map[string]interface{}{
- "c/a": 1,
- "c/b": "world",
- "c/c": []int{1, 2, 3, 4},
- "c/d": map[string]interface{}{
- "c/d/a": "fdisajfoidsajfopdjsaopfjdsapofda",
- "c/d/b": "fdsafjdposakfodpsakfopdsakfpodsakfpodksaopfkdsopafkdopsa",
- "c/d/c": "poir02 ir30qif4p03qir0pogjfpoaerfgjp ofke[padfk[ewapf kdp[afep[aw",
- "c/d/d": "fdsopafkd[sa f-32qor-=4qeof -afo-erfo r-eafo 4e- o r4-qwo ag",
- "c/d/e": "kfep[a sfkr0[paf[a foe-[wq ewpfao-q ro3-q ro-4qof4-qor 3-e orfkropzjbvoisdb",
- "c/d/f": "",
- },
- "c/e": map[int]string{
- 1: "1",
- 22: "22",
- 333: "333",
- 4444: "4444",
- 55555: "55555",
- },
- "c/f": map[string]int{
- "1": 1,
- "22": 22,
- "333": 333,
- "4444": 4444,
- "55555": 55555,
- },
- "c/g": map[bool]int{
- false: 0,
- true: 1,
- },
- },
- }
- var v2 map[stringUint64T]interface{}
- var b1, b2, b3 []byte
-
- // encode v1 into b1, decode b1 into v2, encode v2 into b2, and compare b1 and b2.
- // OR
- // encode v1 into b1, decode b1 into v2, encode v2 into b2 and b3, and compare b2 and b3.
- // e.g. when doing cbor indefinite, we may haveto use out-of-band encoding
- // where each key is encoded as an indefinite length string, which makes it not the same
- // order as the strings were lexicographically ordered before.
-
- var cborIndef bool
- if ch, ok := h.(*CborHandle); ok {
- cborIndef = ch.IndefiniteLength
- }
- bh := h.getBasicHandle()
- if !bh.Canonical {
- bh.Canonical = true
- defer func() { bh.Canonical = false }()
- }
-
- e1 := NewEncoderBytes(&b1, h)
- e1.MustEncode(v1)
- d1 := NewDecoderBytes(b1, h)
- d1.MustDecode(&v2)
- // testDeepEqualErr(v1, v2, t, "huh?")
- e2 := NewEncoderBytes(&b2, h)
- e2.MustEncode(v2)
- var b1t, b2t = b1, b2
- if cborIndef {
- e2 = NewEncoderBytes(&b3, h)
- e2.MustEncode(v2)
- b1t, b2t = b2, b3
- }
-
- if !bytes.Equal(b1t, b2t) {
- logT(t, "Unequal bytes: %v VS %v", b1t, b2t)
- failT(t)
- }
-}
-
-func doTestStdEncIntf(t *testing.T, name string, h Handle) {
- testOnce.Do(testInitAll)
- args := [][2]interface{}{
- {&TestABC{"A", "BB", "CCC"}, new(TestABC)},
- {&TestABC2{"AAA", "BB", "C"}, new(TestABC2)},
- }
- for _, a := range args {
- var b []byte
- e := NewEncoderBytes(&b, h)
- e.MustEncode(a[0])
- d := NewDecoderBytes(b, h)
- d.MustDecode(a[1])
- if err := deepEqual(a[0], a[1]); err == nil {
- logT(t, "++++ Objects match")
- } else {
- logT(t, "---- FAIL: Objects do not match: y1: %v, err: %v", a[1], err)
- failT(t)
- }
- }
-}
-
-func doTestEncCircularRef(t *testing.T, name string, h Handle) {
- testOnce.Do(testInitAll)
- type T1 struct {
- S string
- B bool
- T interface{}
- }
- type T2 struct {
- S string
- T *T1
- }
- type T3 struct {
- S string
- T *T2
- }
- t1 := T1{"t1", true, nil}
- t2 := T2{"t2", &t1}
- t3 := T3{"t3", &t2}
- t1.T = &t3
-
- var bs []byte
- var err error
-
- bh := h.getBasicHandle()
- if !bh.CheckCircularRef {
- bh.CheckCircularRef = true
- defer func() { bh.CheckCircularRef = false }()
- }
- err = NewEncoderBytes(&bs, h).Encode(&t3)
- if err == nil {
- logT(t, "expecting error due to circular reference. found none")
- failT(t)
- }
- if x := err.Error(); strings.Contains(x, "circular") || strings.Contains(x, "cyclic") {
- logT(t, "error detected as expected: %v", x)
- } else {
- logT(t, "FAIL: error detected was not as expected: %v", x)
- failT(t)
- }
-}
-
-// TestAnonCycleT{1,2,3} types are used to test anonymous cycles.
-// They are top-level, so that they can have circular references.
-type (
- TestAnonCycleT1 struct {
- S string
- TestAnonCycleT2
- }
- TestAnonCycleT2 struct {
- S2 string
- TestAnonCycleT3
- }
- TestAnonCycleT3 struct {
- *TestAnonCycleT1
- }
-)
-
-func doTestAnonCycle(t *testing.T, name string, h Handle) {
- testOnce.Do(testInitAll)
- var x TestAnonCycleT1
- x.S = "hello"
- x.TestAnonCycleT2.S2 = "hello.2"
- x.TestAnonCycleT2.TestAnonCycleT3.TestAnonCycleT1 = &x
-
- // just check that you can get typeInfo for T1
- rt := reflect.TypeOf((*TestAnonCycleT1)(nil)).Elem()
- rtid := rt2id(rt)
- pti := h.getBasicHandle().getTypeInfo(rtid, rt)
- logT(t, "pti: %v", pti)
-}
-
-func doTestJsonLargeInteger(t *testing.T, v interface{}, ias uint8) {
- testOnce.Do(testInitAll)
- logT(t, "Running doTestJsonLargeInteger: v: %#v, ias: %c", v, ias)
- oldIAS := testJsonH.IntegerAsString
- defer func() { testJsonH.IntegerAsString = oldIAS }()
- testJsonH.IntegerAsString = ias
-
- var vu uint
- var vi int
- var vb bool
- var b []byte
- e := NewEncoderBytes(&b, testJsonH)
- e.MustEncode(v)
- e.MustEncode(true)
- d := NewDecoderBytes(b, testJsonH)
- // below, we validate that the json string or number was encoded,
- // then decode, and validate that the correct value was decoded.
- fnStrChk := func() {
- // check that output started with ", and ended with "true
- if !(b[0] == '"' && string(b[len(b)-5:]) == `"true`) {
- logT(t, "Expecting a JSON string, got: %s", b)
- failT(t)
- }
- }
-
- switch ias {
- case 'L':
- switch v2 := v.(type) {
- case int:
- v2n := int64(v2) // done to work with 32-bit OS
- if v2n > 1<<53 || (v2n < 0 && -v2n > 1<<53) {
- fnStrChk()
- }
- case uint:
- v2n := uint64(v2) // done to work with 32-bit OS
- if v2n > 1<<53 {
- fnStrChk()
- }
- }
- case 'A':
- fnStrChk()
- default:
- // check that output doesn't contain " at all
- for _, i := range b {
- if i == '"' {
- logT(t, "Expecting a JSON Number without quotation: got: %s", b)
- failT(t)
- }
- }
- }
- switch v2 := v.(type) {
- case int:
- d.MustDecode(&vi)
- d.MustDecode(&vb)
- // check that vb = true, and vi == v2
- if !(vb && vi == v2) {
- logT(t, "Expecting equal values from %s: got golden: %v, decoded: %v", b, v2, vi)
- failT(t)
- }
- case uint:
- d.MustDecode(&vu)
- d.MustDecode(&vb)
- // check that vb = true, and vi == v2
- if !(vb && vu == v2) {
- logT(t, "Expecting equal values from %s: got golden: %v, decoded: %v", b, v2, vu)
- failT(t)
- }
- }
-}
-
-func doTestRawValue(t *testing.T, name string, h Handle) {
- testOnce.Do(testInitAll)
- bh := h.getBasicHandle()
- if !bh.Raw {
- bh.Raw = true
- defer func() { bh.Raw = false }()
- }
-
- var i, i2 int
- var v, v2 TestRawValue
- var bs, bs2 []byte
-
- i = 1234 //1234567890
- v = TestRawValue{I: i}
- e := NewEncoderBytes(&bs, h)
- e.MustEncode(v.I)
- logT(t, ">>> raw: %v\n", bs)
-
- v.R = Raw(bs)
- e.ResetBytes(&bs2)
- e.MustEncode(v)
-
- logT(t, ">>> bs2: %v\n", bs2)
- d := NewDecoderBytes(bs2, h)
- d.MustDecode(&v2)
- d.ResetBytes(v2.R)
- logT(t, ">>> v2.R: %v\n", ([]byte)(v2.R))
- d.MustDecode(&i2)
-
- logT(t, ">>> Encoded %v, decoded %v\n", i, i2)
- // logT(t, "Encoded %v, decoded %v", i, i2)
- if i != i2 {
- logT(t, "Error: encoded %v, decoded %v", i, i2)
- failT(t)
- }
-}
-
-// Comprehensive testing that generates data encoded from python handle (cbor, msgpack),
-// and validates that our code can read and write it out accordingly.
-// We keep this unexported here, and put actual test in ext_dep_test.go.
-// This way, it can be excluded by excluding file completely.
-func doTestPythonGenStreams(t *testing.T, name string, h Handle) {
- testOnce.Do(testInitAll)
- logT(t, "TestPythonGenStreams-%v", name)
- tmpdir, err := ioutil.TempDir("", "golang-"+name+"-test")
- if err != nil {
- logT(t, "-------- Unable to create temp directory\n")
- failT(t)
- }
- defer os.RemoveAll(tmpdir)
- logT(t, "tmpdir: %v", tmpdir)
- cmd := exec.Command("python", "test.py", "testdata", tmpdir)
- //cmd.Stdin = strings.NewReader("some input")
- //cmd.Stdout = &out
- var cmdout []byte
- if cmdout, err = cmd.CombinedOutput(); err != nil {
- logT(t, "-------- Error running test.py testdata. Err: %v", err)
- logT(t, " %v", string(cmdout))
- failT(t)
- }
-
- bh := h.getBasicHandle()
-
- oldMapType := bh.MapType
- tablePythonVerify := testTableVerify(testVerifyForPython|testVerifyTimeAsInteger|testVerifyMapTypeStrIntf, h)
- for i, v := range tablePythonVerify {
- // if v == uint64(0) && h == testMsgpackH {
- // v = int64(0)
- // }
- bh.MapType = oldMapType
- //load up the golden file based on number
- //decode it
- //compare to in-mem object
- //encode it again
- //compare to output stream
- logT(t, "..............................................")
- logT(t, " Testing: #%d: %T, %#v\n", i, v, v)
- var bss []byte
- bss, err = ioutil.ReadFile(filepath.Join(tmpdir, strconv.Itoa(i)+"."+name+".golden"))
- if err != nil {
- logT(t, "-------- Error reading golden file: %d. Err: %v", i, err)
- failT(t)
- continue
- }
- bh.MapType = testMapStrIntfTyp
-
- var v1 interface{}
- if err = testUnmarshal(&v1, bss, h); err != nil {
- logT(t, "-------- Error decoding stream: %d: Err: %v", i, err)
- failT(t)
- continue
- }
- if v == skipVerifyVal {
- continue
- }
- //no need to indirect, because we pass a nil ptr, so we already have the value
- //if v1 != nil { v1 = reflect.Indirect(reflect.ValueOf(v1)).Interface() }
- if err = deepEqual(v, v1); err == nil {
- logT(t, "++++++++ Objects match: %T, %v", v, v)
- } else {
- logT(t, "-------- FAIL: Objects do not match: %v. Source: %T. Decoded: %T", err, v, v1)
- logT(t, "-------- GOLDEN: %#v", v)
- // logT(t, "-------- DECODED: %#v <====> %#v", v1, reflect.Indirect(reflect.ValueOf(v1)).Interface())
- logT(t, "-------- DECODED: %#v <====> %#v", v1, reflect.Indirect(reflect.ValueOf(v1)).Interface())
- failT(t)
- }
- bsb, err := testMarshal(v1, h)
- if err != nil {
- logT(t, "Error encoding to stream: %d: Err: %v", i, err)
- failT(t)
- continue
- }
- if err = deepEqual(bsb, bss); err == nil {
- logT(t, "++++++++ Bytes match")
- } else {
- logT(t, "???????? FAIL: Bytes do not match. %v.", err)
- xs := "--------"
- if reflect.ValueOf(v).Kind() == reflect.Map {
- xs = " "
- logT(t, "%s It's a map. Ok that they don't match (dependent on ordering).", xs)
- } else {
- logT(t, "%s It's not a map. They should match.", xs)
- failT(t)
- }
- logT(t, "%s FROM_FILE: %4d] %v", xs, len(bss), bss)
- logT(t, "%s ENCODED: %4d] %v", xs, len(bsb), bsb)
- }
- }
- bh.MapType = oldMapType
-}
-
-// To test MsgpackSpecRpc, we test 3 scenarios:
-// - Go Client to Go RPC Service (contained within TestMsgpackRpcSpec)
-// - Go client to Python RPC Service (contained within doTestMsgpackRpcSpecGoClientToPythonSvc)
-// - Python Client to Go RPC Service (contained within doTestMsgpackRpcSpecPythonClientToGoSvc)
-//
-// This allows us test the different calling conventions
-// - Go Service requires only one argument
-// - Python Service allows multiple arguments
-
-func doTestMsgpackRpcSpecGoClientToPythonSvc(t *testing.T) {
- if testSkipRPCTests {
- return
- }
- testOnce.Do(testInitAll)
- // openPorts are between 6700 and 6800
- r := rand.New(rand.NewSource(time.Now().UnixNano()))
- openPort := strconv.FormatInt(6700+r.Int63n(99), 10)
- // openPort := "6792"
- cmd := exec.Command("python", "test.py", "rpc-server", openPort, "4")
- checkErrT(t, cmd.Start())
- bs, err2 := net.Dial("tcp", ":"+openPort)
- for i := 0; i < 10 && err2 != nil; i++ {
- time.Sleep(50 * time.Millisecond) // time for python rpc server to start
- bs, err2 = net.Dial("tcp", ":"+openPort)
- }
- checkErrT(t, err2)
- cc := MsgpackSpecRpc.ClientCodec(testReadWriteCloser(bs), testMsgpackH)
- cl := rpc.NewClientWithCodec(cc)
- defer cl.Close()
- var rstr string
- checkErrT(t, cl.Call("EchoStruct", TestRpcABC{"Aa", "Bb", "Cc"}, &rstr))
- //checkEqualT(t, rstr, "{'A': 'Aa', 'B': 'Bb', 'C': 'Cc'}")
- var mArgs MsgpackSpecRpcMultiArgs = []interface{}{"A1", "B2", "C3"}
- checkErrT(t, cl.Call("Echo123", mArgs, &rstr))
- checkEqualT(t, rstr, "1:A1 2:B2 3:C3", "rstr=")
- cmd.Process.Kill()
-}
-
-func doTestMsgpackRpcSpecPythonClientToGoSvc(t *testing.T) {
- if testSkipRPCTests {
- return
- }
- testOnce.Do(testInitAll)
- port := testCodecRpcOne(t, MsgpackSpecRpc, testMsgpackH, false, 1*time.Second)
- //time.Sleep(1000 * time.Millisecond)
- cmd := exec.Command("python", "test.py", "rpc-client-go-service", strconv.Itoa(port))
- var cmdout []byte
- var err error
- if cmdout, err = cmd.CombinedOutput(); err != nil {
- logT(t, "-------- Error running test.py rpc-client-go-service. Err: %v", err)
- logT(t, " %v", string(cmdout))
- failT(t)
- }
- checkEqualT(t, string(cmdout),
- fmt.Sprintf("%#v\n%#v\n", []string{"A1", "B2", "C3"}, TestRpcABC{"Aa", "Bb", "Cc"}), "cmdout=")
-}
-
-func doTestSwallowAndZero(t *testing.T, h Handle) {
- testOnce.Do(testInitAll)
- v1 := newTestStrucFlex(testDepth, testNumRepeatString, false, false, false)
- var b1 []byte
-
- e1 := NewEncoderBytes(&b1, h)
- e1.MustEncode(v1)
- d1 := NewDecoderBytes(b1, h)
- d1.swallow()
- if d1.r.numread() != len(b1) {
- logT(t, "swallow didn't consume all encoded bytes: %v out of %v", d1.r.numread(), len(b1))
- failT(t)
- }
- setZero(v1)
- testDeepEqualErr(v1, &TestStrucFlex{}, t, "filled-and-zeroed")
-}
-
-func doTestRawExt(t *testing.T, h Handle) {
- testOnce.Do(testInitAll)
- var b []byte
- var v RawExt // interface{}
- _, isJson := h.(*JsonHandle)
- _, isCbor := h.(*CborHandle)
- bh := h.getBasicHandle()
- // isValuer := isJson || isCbor
- // _ = isValuer
- for _, r := range []RawExt{
- {Tag: 99, Value: "9999", Data: []byte("9999")},
- } {
- e := NewEncoderBytes(&b, h)
- e.MustEncode(&r)
- // fmt.Printf(">>>> rawext: isnil? %v, %d - %v\n", b == nil, len(b), b)
- d := NewDecoderBytes(b, h)
- d.MustDecode(&v)
- var r2 = r
- switch {
- case isJson:
- r2.Tag = 0
- r2.Data = nil
- case isCbor:
- r2.Data = nil
- default:
- r2.Value = nil
- }
- testDeepEqualErr(v, r2, t, "rawext-default")
- // switch h.(type) {
- // case *JsonHandle:
- // testDeepEqualErr(r.Value, v, t, "rawext-json")
- // default:
- // var r2 = r
- // if isValuer {
- // r2.Data = nil
- // } else {
- // r2.Value = nil
- // }
- // testDeepEqualErr(v, r2, t, "rawext-default")
- // }
- }
-
- // Add testing for Raw also
- if b != nil {
- b = b[:0]
- }
- oldRawMode := bh.Raw
- defer func() { bh.Raw = oldRawMode }()
- bh.Raw = true
-
- var v2 Raw
- for _, s := range []string{
- "goodbye",
- "hello",
- } {
- e := NewEncoderBytes(&b, h)
- e.MustEncode(&s)
- // fmt.Printf(">>>> rawext: isnil? %v, %d - %v\n", b == nil, len(b), b)
- var r Raw = make([]byte, len(b))
- copy(r, b)
- d := NewDecoderBytes(b, h)
- d.MustDecode(&v2)
- testDeepEqualErr(v2, r, t, "raw-default")
- }
-
-}
-
-// func doTestTimeExt(t *testing.T, h Handle) {
-// var t = time.Now()
-// // add time ext to the handle
-// }
-
-func doTestMapStructKey(t *testing.T, h Handle) {
- testOnce.Do(testInitAll)
- var b []byte
- var v interface{} // map[stringUint64T]wrapUint64Slice // interface{}
- bh := h.getBasicHandle()
- m := map[stringUint64T]wrapUint64Slice{
- {"55555", 55555}: []wrapUint64{12345},
- {"333", 333}: []wrapUint64{123},
- }
- oldCanonical := bh.Canonical
- oldMapType := bh.MapType
- defer func() {
- bh.Canonical = oldCanonical
- bh.MapType = oldMapType
- }()
-
- bh.MapType = reflect.TypeOf((*map[stringUint64T]wrapUint64Slice)(nil)).Elem()
- for _, bv := range [2]bool{true, false} {
- b, v = nil, nil
- bh.Canonical = bv
- e := NewEncoderBytes(&b, h)
- e.MustEncode(m)
- d := NewDecoderBytes(b, h)
- d.MustDecode(&v)
- testDeepEqualErr(v, m, t, "map-structkey")
- }
-}
-
-func doTestDecodeNilMapValue(t *testing.T, handle Handle) {
- testOnce.Do(testInitAll)
- type Struct struct {
- Field map[uint16]map[uint32]struct{}
- }
-
- bh := handle.getBasicHandle()
- oldMapType := bh.MapType
- oldDeleteOnNilMapValue := bh.DeleteOnNilMapValue
- defer func() {
- bh.MapType = oldMapType
- bh.DeleteOnNilMapValue = oldDeleteOnNilMapValue
- }()
- bh.MapType = reflect.TypeOf(map[interface{}]interface{}(nil))
- bh.DeleteOnNilMapValue = false
-
- _, isJsonHandle := handle.(*JsonHandle)
-
- toEncode := Struct{Field: map[uint16]map[uint32]struct{}{
- 1: nil,
- }}
-
- bs, err := testMarshal(toEncode, handle)
- if err != nil {
- logT(t, "Error encoding: %v, Err: %v", toEncode, err)
- failT(t)
- }
- if isJsonHandle {
- logT(t, "json encoded: %s\n", bs)
- }
-
- var decoded Struct
- err = testUnmarshal(&decoded, bs, handle)
- if err != nil {
- logT(t, "Error decoding: %v", err)
- failT(t)
- }
- if !reflect.DeepEqual(decoded, toEncode) {
- logT(t, "Decoded value %#v != %#v", decoded, toEncode)
- failT(t)
- }
-}
-
-func doTestEmbeddedFieldPrecedence(t *testing.T, h Handle) {
- testOnce.Do(testInitAll)
- type Embedded struct {
- Field byte
- }
- type Struct struct {
- Field byte
- Embedded
- }
- toEncode := Struct{
- Field: 1,
- Embedded: Embedded{Field: 2},
- }
- _, isJsonHandle := h.(*JsonHandle)
- handle := h.getBasicHandle()
- oldMapType := handle.MapType
- defer func() { handle.MapType = oldMapType }()
-
- handle.MapType = reflect.TypeOf(map[interface{}]interface{}(nil))
-
- bs, err := testMarshal(toEncode, h)
- if err != nil {
- logT(t, "Error encoding: %v, Err: %v", toEncode, err)
- failT(t)
- }
-
- var decoded Struct
- err = testUnmarshal(&decoded, bs, h)
- if err != nil {
- logT(t, "Error decoding: %v", err)
- failT(t)
- }
-
- if decoded.Field != toEncode.Field {
- logT(t, "Decoded result %v != %v", decoded.Field, toEncode.Field) // hex to look at what was encoded
- if isJsonHandle {
- logT(t, "JSON encoded as: %s", bs) // hex to look at what was encoded
- }
- failT(t)
- }
-}
-
-func doTestLargeContainerLen(t *testing.T, h Handle) {
- testOnce.Do(testInitAll)
- m := make(map[int][]struct{})
- for i := range []int{
- 0, 1,
- math.MaxInt8, math.MaxInt8 + 4, math.MaxInt8 - 4,
- math.MaxInt16, math.MaxInt16 + 4, math.MaxInt16 - 4,
- math.MaxInt32, math.MaxInt32 - 4,
- // math.MaxInt32 + 4, // bombs on 32-bit
- // math.MaxInt64, math.MaxInt64 - 4, // bombs on 32-bit
-
- math.MaxUint8, math.MaxUint8 + 4, math.MaxUint8 - 4,
- math.MaxUint16, math.MaxUint16 + 4, math.MaxUint16 - 4,
- // math.MaxUint32, math.MaxUint32 + 4, math.MaxUint32 - 4, // bombs on 32-bit
- } {
- m[i] = make([]struct{}, i)
- }
- bs := testMarshalErr(m, h, t, "-")
- var m2 = make(map[int][]struct{})
- testUnmarshalErr(m2, bs, h, t, "-")
- testDeepEqualErr(m, m2, t, "-")
-
- // do same tests for large strings (encoded as symbols or not)
- // skip if 32-bit or not using unsafe mode
- if safeMode || (32<<(^uint(0)>>63)) < 64 {
- return
- }
-
- // now, want to do tests for large strings, which
- // could be encoded as symbols.
- // to do this, we create a simple one-field struct,
- // use use flags to switch from symbols to non-symbols
-
- hbinc, okbinc := h.(*BincHandle)
- if okbinc {
- oldAsSymbols := hbinc.AsSymbols
- defer func() { hbinc.AsSymbols = oldAsSymbols }()
- }
- var out []byte = make([]byte, 0, math.MaxUint16*3/2)
- var in []byte = make([]byte, math.MaxUint16*3/2)
- for i := range in {
- in[i] = 'A'
- }
- e := NewEncoder(nil, h)
- for _, i := range []int{
- 0, 1, 4, 8, 12, 16, 28, 32, 36,
- math.MaxInt8, math.MaxInt8 + 4, math.MaxInt8 - 4,
- math.MaxInt16, math.MaxInt16 + 4, math.MaxInt16 - 4,
-
- math.MaxUint8, math.MaxUint8 + 4, math.MaxUint8 - 4,
- math.MaxUint16, math.MaxUint16 + 4, math.MaxUint16 - 4,
- } {
- var m1, m2 map[string]bool
- m1 = make(map[string]bool, 1)
- var s1 = stringView(in[:i])
- // fmt.Printf("testcontainerlen: large string: i: %v, |%s|\n", i, s1)
- m1[s1] = true
-
- if okbinc {
- hbinc.AsSymbols = 2
- }
- out = out[:0]
- e.ResetBytes(&out)
- e.MustEncode(m1)
- // bs, _ = testMarshalErr(m1, h, t, "-")
- m2 = make(map[string]bool, 1)
- testUnmarshalErr(m2, out, h, t, "no-symbols")
- testDeepEqualErr(m1, m2, t, "no-symbols")
-
- if okbinc {
- // now, do as symbols
- hbinc.AsSymbols = 1
- out = out[:0]
- e.ResetBytes(&out)
- e.MustEncode(m1)
- // bs, _ = testMarshalErr(m1, h, t, "-")
- m2 = make(map[string]bool, 1)
- testUnmarshalErr(m2, out, h, t, "symbols")
- testDeepEqualErr(m1, m2, t, "symbols")
- }
- }
-
-}
-
-func testRandomFillRV(v reflect.Value) {
- testOnce.Do(testInitAll)
- fneg := func() int64 {
- i := rand.Intn(1)
- if i == 1 {
- return 1
- }
- return -1
- }
-
- switch v.Kind() {
- case reflect.Invalid:
- case reflect.Ptr:
- if v.IsNil() {
- v.Set(reflect.New(v.Type().Elem()))
- }
- testRandomFillRV(v.Elem())
- case reflect.Interface:
- if v.IsNil() {
- v.Set(reflect.ValueOf("nothing"))
- } else {
- testRandomFillRV(v.Elem())
- }
- case reflect.Struct:
- for i, n := 0, v.NumField(); i < n; i++ {
- testRandomFillRV(v.Field(i))
- }
- case reflect.Slice:
- if v.IsNil() {
- v.Set(reflect.MakeSlice(v.Type(), 4, 4))
- }
- fallthrough
- case reflect.Array:
- for i, n := 0, v.Len(); i < n; i++ {
- testRandomFillRV(v.Index(i))
- }
- case reflect.Map:
- if v.IsNil() {
- v.Set(reflect.MakeMap(v.Type()))
- }
- if v.Len() == 0 {
- kt, vt := v.Type().Key(), v.Type().Elem()
- for i := 0; i < 4; i++ {
- k0 := reflect.New(kt).Elem()
- v0 := reflect.New(vt).Elem()
- testRandomFillRV(k0)
- testRandomFillRV(v0)
- v.SetMapIndex(k0, v0)
- }
- } else {
- for _, k := range v.MapKeys() {
- testRandomFillRV(v.MapIndex(k))
- }
- }
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- v.SetInt(fneg() * rand.Int63n(127))
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- v.SetUint(uint64(rand.Int63n(255)))
- case reflect.Bool:
- v.SetBool(fneg() == 1)
- case reflect.Float32, reflect.Float64:
- v.SetFloat(float64(fneg()) * float64(rand.Float32()))
- case reflect.String:
- // ensure this string can test the extent of json string decoding
- v.SetString(strings.Repeat(strconv.FormatInt(rand.Int63n(99), 10), rand.Intn(8)) +
- "- ABC \x41=\x42 \u2318 - \r \b \f - \u2028 and \u2029 .")
- default:
- panic(fmt.Errorf("testRandomFillRV: unsupported type: %v", v.Kind()))
- }
-}
-
-func testMammoth(t *testing.T, name string, h Handle) {
- testOnce.Do(testInitAll)
- var b []byte
-
- var m, m2 TestMammoth
- testRandomFillRV(reflect.ValueOf(&m).Elem())
- b = testMarshalErr(&m, h, t, "mammoth-"+name)
- testUnmarshalErr(&m2, b, h, t, "mammoth-"+name)
- testDeepEqualErr(&m, &m2, t, "mammoth-"+name)
-
- var mm, mm2 TestMammoth2Wrapper
- testRandomFillRV(reflect.ValueOf(&mm).Elem())
- b = testMarshalErr(&mm, h, t, "mammoth2-"+name)
- testUnmarshalErr(&mm2, b, h, t, "mammoth2-"+name)
- testDeepEqualErr(&mm, &mm2, t, "mammoth2-"+name)
- // testMammoth2(t, name, h)
-}
-
-func testTime(t *testing.T, name string, h Handle) {
- testOnce.Do(testInitAll)
- // test time which uses the time.go implementation (ie Binc)
- var tt, tt2 time.Time
- // time in 1990
- tt = time.Unix(20*366*24*60*60, 1000*900).In(time.FixedZone("UGO", -5*60*60))
- // fmt.Printf("time tt: %v\n", tt)
- b := testMarshalErr(tt, h, t, "time-"+name)
- testUnmarshalErr(&tt2, b, h, t, "time-"+name)
- // per go documentation, test time with .Equal not ==
- if !tt2.Equal(tt) {
- logT(t, "%s: values not equal: 1: %v, 2: %v", name, tt2, tt)
- failT(t)
- }
- // testDeepEqualErr(tt.UTC(), tt2, t, "time-"+name)
-}
-
-func testUintToInt(t *testing.T, name string, h Handle) {
- testOnce.Do(testInitAll)
- var golden = [...]int64{
- 0, 1, 22, 333, 4444, 55555, 666666,
- // msgpack ones
- 24, 128,
- // standard ones
- math.MaxUint8, math.MaxUint8 + 4, math.MaxUint8 - 4,
- math.MaxUint16, math.MaxUint16 + 4, math.MaxUint16 - 4,
- math.MaxUint32, math.MaxUint32 + 4, math.MaxUint32 - 4,
- math.MaxInt8, math.MaxInt8 + 4, math.MaxInt8 - 4,
- math.MaxInt16, math.MaxInt16 + 4, math.MaxInt16 - 4,
- math.MaxInt32, math.MaxInt32 + 4, math.MaxInt32 - 4,
- math.MaxInt64, math.MaxInt64 - 4,
- }
- var ui uint64
- var fi float64
- var b []byte
- for _, i := range golden {
- ui = 0
- b = testMarshalErr(i, h, t, "int2uint-"+name)
- testUnmarshalErr(&ui, b, h, t, "int2uint-"+name)
- if ui != uint64(i) {
- logT(t, "%s: values not equal: %v, %v", name, ui, uint64(i))
- failT(t)
- }
- i = 0
- b = testMarshalErr(ui, h, t, "uint2int-"+name)
- testUnmarshalErr(&i, b, h, t, "uint2int-"+name)
- if i != int64(ui) {
- logT(t, "%s: values not equal: %v, %v", name, i, int64(ui))
- failT(t)
- }
- fi = 0
- b = testMarshalErr(i, h, t, "int2float-"+name)
- testUnmarshalErr(&fi, b, h, t, "int2float-"+name)
- if fi != float64(i) {
- logT(t, "%s: values not equal: %v, %v", name, fi, float64(i))
- failT(t)
- }
- }
-}
-
-func doTestDifferentMapOrSliceType(t *testing.T, name string, h Handle) {
- testOnce.Do(testInitAll)
-
- // - maptype, slicetype: diff from map[string]intf, map[intf]intf or []intf, etc
- // include map[interface{}]string where some keys are []byte.
- // To test, take a sequence of []byte and string, and decode into []string and []interface.
- // Also, decode into map[string]string, map[string]interface{}, map[interface{}]string
-
- bh := h.getBasicHandle()
- oldM, oldS := bh.MapType, bh.SliceType
- defer func() { bh.MapType, bh.SliceType = oldM, oldS }()
-
- var b []byte
-
- var vi = []interface{}{
- "hello 1",
- []byte("hello 2"),
- "hello 3",
- []byte("hello 4"),
- "hello 5",
- }
- var vs []string
- var v2i, v2s testMbsT
- var v2ss testMbsCustStrT
- // encode it as a map or as a slice
- for i, v := range vi {
- vv, ok := v.(string)
- if !ok {
- vv = string(v.([]byte))
- }
- vs = append(vs, vv)
- v2i = append(v2i, v, strconv.FormatInt(int64(i+1), 10))
- v2s = append(v2s, vv, strconv.FormatInt(int64(i+1), 10))
- v2ss = append(v2ss, testCustomStringT(vv), testCustomStringT(strconv.FormatInt(int64(i+1), 10)))
- }
-
- var v2d interface{}
-
- // encode vs as a list, and decode into a list and compare
- var goldSliceS = []string{"hello 1", "hello 2", "hello 3", "hello 4", "hello 5"}
- var goldSliceI = []interface{}{"hello 1", "hello 2", "hello 3", "hello 4", "hello 5"}
- var goldSlice = []interface{}{goldSliceS, goldSliceI}
- for j, g := range goldSlice {
- bh.SliceType = reflect.TypeOf(g)
- name := fmt.Sprintf("slice-%s-%v", name, j+1)
- b = testMarshalErr(vs, h, t, name)
- v2d = nil
- // v2d = reflect.New(bh.SliceType).Elem().Interface()
- testUnmarshalErr(&v2d, b, h, t, name)
- testDeepEqualErr(v2d, goldSlice[j], t, name)
- }
-
- // to ensure that we do not use fast-path for map[intf]string, use a custom string type (for goldMapIS).
- // this will allow us to test out the path that sees a []byte where a map has an interface{} type,
- // and convert it to a string for the decoded map key.
-
- // encode v2i as a map, and decode into a map and compare
- var goldMapSS = map[string]string{"hello 1": "1", "hello 2": "2", "hello 3": "3", "hello 4": "4", "hello 5": "5"}
- var goldMapSI = map[string]interface{}{"hello 1": "1", "hello 2": "2", "hello 3": "3", "hello 4": "4", "hello 5": "5"}
- var goldMapIS = map[interface{}]testCustomStringT{"hello 1": "1", "hello 2": "2", "hello 3": "3", "hello 4": "4", "hello 5": "5"}
- var goldMap = []interface{}{goldMapSS, goldMapSI, goldMapIS}
- for j, g := range goldMap {
- bh.MapType = reflect.TypeOf(g)
- name := fmt.Sprintf("map-%s-%v", name, j+1)
- // for formats that clearly differentiate binary from string, use v2i
- // else use the v2s (with all strings, no []byte)
- v2d = nil
- // v2d = reflect.New(bh.MapType).Elem().Interface()
- switch h.(type) {
- case *MsgpackHandle, *BincHandle, *CborHandle:
- b = testMarshalErr(v2i, h, t, name)
- testUnmarshalErr(&v2d, b, h, t, name)
- testDeepEqualErr(v2d, goldMap[j], t, name)
- default:
- b = testMarshalErr(v2s, h, t, name)
- testUnmarshalErr(&v2d, b, h, t, name)
- testDeepEqualErr(v2d, goldMap[j], t, name)
- b = testMarshalErr(v2ss, h, t, name)
- v2d = nil
- testUnmarshalErr(&v2d, b, h, t, name)
- testDeepEqualErr(v2d, goldMap[j], t, name)
- }
- }
-
-}
-
-func doTestScalars(t *testing.T, name string, h Handle) {
- testOnce.Do(testInitAll)
-
- // for each scalar:
- // - encode its ptr
- // - encode it (non-ptr)
- // - check that bytes are same
- // - make a copy (using reflect)
- // - check that same
- // - set zero on it
- // - check that its equal to 0 value
- // - decode into new
- // - compare to original
-
- bh := h.getBasicHandle()
- if !bh.Canonical {
- bh.Canonical = true
- defer func() { bh.Canonical = false }()
- }
-
- vi := []interface{}{
- int(0),
- int8(0),
- int16(0),
- int32(0),
- int64(0),
- uint(0),
- uint8(0),
- uint16(0),
- uint32(0),
- uint64(0),
- uintptr(0),
- float32(0),
- float64(0),
- bool(false),
- string(""),
- []byte(nil),
- }
- for _, v := range fastpathAV {
- vi = append(vi, reflect.Zero(v.rt).Interface())
- }
- for _, v := range vi {
- rv := reflect.New(reflect.TypeOf(v)).Elem()
- testRandomFillRV(rv)
- v = rv.Interface()
-
- rv2 := reflect.New(rv.Type())
- rv2.Elem().Set(rv)
- vp := rv2.Interface()
-
- var tname string
- switch rv.Kind() {
- case reflect.Map:
- tname = "map[" + rv.Type().Key().Name() + "]" + rv.Type().Elem().Name()
- case reflect.Slice:
- tname = "[]" + rv.Type().Elem().Name()
- default:
- tname = rv.Type().Name()
- }
-
- var b, b1, b2 []byte
- b1 = testMarshalErr(v, h, t, tname+"-enc")
- // store b1 into b, as b1 slice is reused for next marshal
- b = make([]byte, len(b1))
- copy(b, b1)
- b2 = testMarshalErr(vp, h, t, tname+"-enc-ptr")
- testDeepEqualErr(b1, b2, t, tname+"-enc-eq")
- setZero(vp)
- testDeepEqualErr(rv2.Elem().Interface(), reflect.Zero(rv.Type()).Interface(), t, tname+"-enc-eq-zero-ref")
-
- vp = rv2.Interface()
- testUnmarshalErr(vp, b, h, t, tname+"-dec")
- testDeepEqualErr(rv2.Elem().Interface(), v, t, tname+"-dec-eq")
- }
-}
-
-func doTestIntfMapping(t *testing.T, name string, h Handle) {
- testOnce.Do(testInitAll)
- rti := reflect.TypeOf((*testIntfMapI)(nil)).Elem()
- defer func() { h.getBasicHandle().Intf2Impl(rti, nil) }()
-
- type T9 struct {
- I testIntfMapI
- }
-
- for i, v := range []testIntfMapI{
- // Use a valid string to test some extents of json string decoding
- &testIntfMapT1{"ABC \x41=\x42 \u2318 - \r \b \f - \u2028 and \u2029 ."},
- testIntfMapT2{"DEF"},
- } {
- if err := h.getBasicHandle().Intf2Impl(rti, reflect.TypeOf(v)); err != nil {
- failT(t, "Error mapping %v to %T", rti, v)
- }
- var v1, v2 T9
- v1 = T9{v}
- b := testMarshalErr(v1, h, t, name+"-enc-"+strconv.Itoa(i))
- testUnmarshalErr(&v2, b, h, t, name+"-dec-"+strconv.Itoa(i))
- testDeepEqualErr(v1, v2, t, name+"-dec-eq-"+strconv.Itoa(i))
- }
-}
-
-func doTestOmitempty(t *testing.T, name string, h Handle) {
- testOnce.Do(testInitAll)
- if h.getBasicHandle().StructToArray {
- t.Skipf("Skipping OmitEmpty test when StructToArray=true")
- }
- type T1 struct {
- A int `codec:"a"`
- B *int `codec:"b,omitempty"`
- C int `codec:"c,omitempty"`
- }
- type T2 struct {
- A int `codec:"a"`
- }
- var v1 T1
- var v2 T2
- b1 := testMarshalErr(v1, h, t, name+"-omitempty")
- b2 := testMarshalErr(v2, h, t, name+"-no-omitempty-trunc")
- testDeepEqualErr(b1, b2, t, name+"-omitempty-cmp")
-}
-
-// -----------------
-
-func TestJsonDecodeNonStringScalarInStringContext(t *testing.T) {
- testOnce.Do(testInitAll)
- var b = `{"s.true": "true", "b.true": true, "s.false": "false", "b.false": false, "s.10": "10", "i.10": 10, "i.-10": -10}`
- var golden = map[string]string{"s.true": "true", "b.true": "true", "s.false": "false", "b.false": "false", "s.10": "10", "i.10": "10", "i.-10": "-10"}
-
- var m map[string]string
- d := NewDecoderBytes([]byte(b), testJsonH)
- d.MustDecode(&m)
- if err := deepEqual(golden, m); err == nil {
- logT(t, "++++ match: decoded: %#v", m)
- } else {
- logT(t, "---- mismatch: %v ==> golden: %#v, decoded: %#v", err, golden, m)
- failT(t)
- }
-}
-
-func TestJsonEncodeIndent(t *testing.T) {
- testOnce.Do(testInitAll)
- v := TestSimplish{
- Ii: -794,
- Ss: `A Man is
-after the new line
- after new line and tab
-`,
- }
- v2 := v
- v.Mm = make(map[string]*TestSimplish)
- for i := 0; i < len(v.Ar); i++ {
- v3 := v2
- v3.Ii += (i * 4)
- v3.Ss = fmt.Sprintf("%d - %s", v3.Ii, v3.Ss)
- if i%2 == 0 {
- v.Ar[i] = &v3
- }
- // v3 = v2
- v.Sl = append(v.Sl, &v3)
- v.Mm[strconv.FormatInt(int64(i), 10)] = &v3
- }
- oldcan := testJsonH.Canonical
- oldIndent := testJsonH.Indent
- oldS2A := testJsonH.StructToArray
- defer func() {
- testJsonH.Canonical = oldcan
- testJsonH.Indent = oldIndent
- testJsonH.StructToArray = oldS2A
- }()
- testJsonH.Canonical = true
- testJsonH.Indent = -1
- testJsonH.StructToArray = false
- var bs []byte
- NewEncoderBytes(&bs, testJsonH).MustEncode(&v)
- txt1Tab := string(bs)
- bs = nil
- testJsonH.Indent = 120
- NewEncoderBytes(&bs, testJsonH).MustEncode(&v)
- txtSpaces := string(bs)
- // fmt.Printf("\n-----------\n%s\n------------\n%s\n-------------\n", txt1Tab, txtSpaces)
-
- goldenResultTab := `{
- "Ar": [
- {
- "Ar": [
- null,
- null
- ],
- "Ii": -794,
- "Mm": null,
- "Sl": null,
- "Ss": "-794 - A Man is\nafter the new line\n\tafter new line and tab\n"
- },
- null
- ],
- "Ii": -794,
- "Mm": {
- "0": {
- "Ar": [
- null,
- null
- ],
- "Ii": -794,
- "Mm": null,
- "Sl": null,
- "Ss": "-794 - A Man is\nafter the new line\n\tafter new line and tab\n"
- },
- "1": {
- "Ar": [
- null,
- null
- ],
- "Ii": -790,
- "Mm": null,
- "Sl": null,
- "Ss": "-790 - A Man is\nafter the new line\n\tafter new line and tab\n"
- }
- },
- "Sl": [
- {
- "Ar": [
- null,
- null
- ],
- "Ii": -794,
- "Mm": null,
- "Sl": null,
- "Ss": "-794 - A Man is\nafter the new line\n\tafter new line and tab\n"
- },
- {
- "Ar": [
- null,
- null
- ],
- "Ii": -790,
- "Mm": null,
- "Sl": null,
- "Ss": "-790 - A Man is\nafter the new line\n\tafter new line and tab\n"
- }
- ],
- "Ss": "A Man is\nafter the new line\n\tafter new line and tab\n"
-}`
-
- if txt1Tab != goldenResultTab {
- logT(t, "decoded indented with tabs != expected: \nexpected: %s\nencoded: %s", goldenResultTab, txt1Tab)
- failT(t)
- }
- if txtSpaces != strings.Replace(goldenResultTab, "\t", strings.Repeat(" ", 120), -1) {
- logT(t, "decoded indented with spaces != expected: \nexpected: %s\nencoded: %s", goldenResultTab, txtSpaces)
- failT(t)
- }
-}
-
-func TestBufioDecReader(t *testing.T) {
- testOnce.Do(testInitAll)
- // try to read 85 bytes in chunks of 7 at a time.
- var s = strings.Repeat("01234'56789 ", 5)
- // fmt.Printf("s: %s\n", s)
- var r = strings.NewReader(s)
- var br = &bufioDecReader{r: r, buf: make([]byte, 0, 13)}
- b, err := ioutil.ReadAll(br)
- if err != nil {
- panic(err)
- }
- var s2 = string(b)
- // fmt.Printf("s==s2: %v, len(s): %v, len(b): %v, len(s2): %v\n", s == s2, len(s), len(b), len(s2))
- if s != s2 {
- logT(t, "not equal: \ns: %s\ns2: %s", s, s2)
- failT(t)
- }
- // Now, test search functions for skip, readTo and readUntil
- // readUntil ', readTo ', skip whitespace. 3 times in a loop, each time compare the token and/or outs
- // readUntil: see: 56789
- var out []byte
- var token byte
- br = &bufioDecReader{r: strings.NewReader(s), buf: make([]byte, 0, 7)}
- // println()
- for _, v2 := range [...]string{
- `01234'`,
- `56789 01234'`,
- `56789 01234'`,
- `56789 01234'`,
- } {
- out = br.readUntil(nil, '\'')
- testDeepEqualErr(string(out), v2, t, "-")
- // fmt.Printf("readUntil: out: `%s`\n", out)
- }
- br = &bufioDecReader{r: strings.NewReader(s), buf: make([]byte, 0, 7)}
- // println()
- for range [4]struct{}{} {
- out = br.readTo(nil, &jsonNumSet)
- testDeepEqualErr(string(out), `01234`, t, "-")
- // fmt.Printf("readTo: out: `%s`\n", out)
- out = br.readUntil(nil, '\'')
- testDeepEqualErr(string(out), "'", t, "-")
- // fmt.Printf("readUntil: out: `%s`\n", out)
- out = br.readTo(nil, &jsonNumSet)
- testDeepEqualErr(string(out), `56789`, t, "-")
- // fmt.Printf("readTo: out: `%s`\n", out)
- out = br.readUntil(nil, '0')
- testDeepEqualErr(string(out), ` 0`, t, "-")
- // fmt.Printf("readUntil: out: `%s`\n", out)
- br.UnreadByte()
- }
- br = &bufioDecReader{r: strings.NewReader(s), buf: make([]byte, 0, 7)}
- // println()
- for range [4]struct{}{} {
- out = br.readUntil(nil, ' ')
- testDeepEqualErr(string(out), `01234'56789 `, t, "-")
- // fmt.Printf("readUntil: out: |%s|\n", out)
- token = br.skip(&jsonCharWhitespaceSet)
- testDeepEqualErr(token, byte('0'), t, "-")
- // fmt.Printf("skip: token: '%c'\n", token)
- br.UnreadByte()
- }
- // println()
-}
-
-// -----------
-
-func TestJsonLargeInteger(t *testing.T) {
- testOnce.Do(testInitAll)
- for _, i := range []uint8{'L', 'A', 0} {
- for _, j := range []interface{}{
- int64(1 << 60),
- -int64(1 << 60),
- 0,
- 1 << 20,
- -(1 << 20),
- uint64(1 << 60),
- uint(0),
- uint(1 << 20),
- } {
- doTestJsonLargeInteger(t, j, i)
- }
- }
-}
-
-func TestJsonInvalidUnicode(t *testing.T) {
- testOnce.Do(testInitAll)
- var m = map[string]string{
- `"\udc49\u0430abc"`: "\uFFFDabc",
- `"\udc49\u0430"`: "\uFFFD",
- `"\udc49abc"`: "\uFFFDabc",
- `"\udc49"`: "\uFFFD",
- `"\udZ49\u0430abc"`: "\uFFFD\u0430abc",
- `"\udcG9\u0430"`: "\uFFFD\u0430",
- `"\uHc49abc"`: "\uFFFDabc",
- `"\uKc49"`: "\uFFFD",
- // ``: "",
- }
- for k, v := range m {
- // println("k = ", k)
- var s string
- testUnmarshalErr(&s, []byte(k), testJsonH, t, "-")
- if s != v {
- logT(t, "not equal: %q, %q", v, s)
- failT(t)
- }
- }
-}
-
-// ----------
-
-func TestBincCodecsTable(t *testing.T) {
- testCodecTableOne(t, testBincH)
-}
-
-func TestBincCodecsMisc(t *testing.T) {
- testCodecMiscOne(t, testBincH)
-}
-
-func TestBincCodecsEmbeddedPointer(t *testing.T) {
- testCodecEmbeddedPointer(t, testBincH)
-}
-
-func TestBincStdEncIntf(t *testing.T) {
- doTestStdEncIntf(t, "binc", testBincH)
-}
-
-func TestBincMammoth(t *testing.T) {
- testMammoth(t, "binc", testBincH)
-}
-
-func TestSimpleCodecsTable(t *testing.T) {
- testCodecTableOne(t, testSimpleH)
-}
-
-func TestSimpleCodecsMisc(t *testing.T) {
- testCodecMiscOne(t, testSimpleH)
-}
-
-func TestSimpleCodecsEmbeddedPointer(t *testing.T) {
- testCodecEmbeddedPointer(t, testSimpleH)
-}
-
-func TestSimpleStdEncIntf(t *testing.T) {
- doTestStdEncIntf(t, "simple", testSimpleH)
-}
-
-func TestSimpleMammoth(t *testing.T) {
- testMammoth(t, "simple", testSimpleH)
-}
-
-func TestMsgpackCodecsTable(t *testing.T) {
- testCodecTableOne(t, testMsgpackH)
-}
-
-func TestMsgpackCodecsMisc(t *testing.T) {
- testCodecMiscOne(t, testMsgpackH)
-}
-
-func TestMsgpackCodecsEmbeddedPointer(t *testing.T) {
- testCodecEmbeddedPointer(t, testMsgpackH)
-}
-
-func TestMsgpackStdEncIntf(t *testing.T) {
- doTestStdEncIntf(t, "msgpack", testMsgpackH)
-}
-
-func TestMsgpackMammoth(t *testing.T) {
- testMammoth(t, "msgpack", testMsgpackH)
-}
-
-func TestCborCodecsTable(t *testing.T) {
- testCodecTableOne(t, testCborH)
-}
-
-func TestCborCodecsMisc(t *testing.T) {
- testCodecMiscOne(t, testCborH)
-}
-
-func TestCborCodecsEmbeddedPointer(t *testing.T) {
- testCodecEmbeddedPointer(t, testCborH)
-}
-
-func TestCborMapEncodeForCanonical(t *testing.T) {
- doTestMapEncodeForCanonical(t, "cbor", testCborH)
-}
-
-func TestCborCodecChan(t *testing.T) {
- testCodecChan(t, testCborH)
-}
-
-func TestCborStdEncIntf(t *testing.T) {
- doTestStdEncIntf(t, "cbor", testCborH)
-}
-
-func TestCborMammoth(t *testing.T) {
- testMammoth(t, "cbor", testCborH)
-}
-
-func TestJsonCodecsTable(t *testing.T) {
- testCodecTableOne(t, testJsonH)
-}
-
-func TestJsonCodecsMisc(t *testing.T) {
- testCodecMiscOne(t, testJsonH)
-}
-
-func TestJsonCodecsEmbeddedPointer(t *testing.T) {
- testCodecEmbeddedPointer(t, testJsonH)
-}
-
-func TestJsonCodecChan(t *testing.T) {
- testCodecChan(t, testJsonH)
-}
-
-func TestJsonStdEncIntf(t *testing.T) {
- doTestStdEncIntf(t, "json", testJsonH)
-}
-
-func TestJsonMammoth(t *testing.T) {
- testMammoth(t, "json", testJsonH)
-}
-
-// ----- Raw ---------
-func TestJsonRaw(t *testing.T) {
- doTestRawValue(t, "json", testJsonH)
-}
-func TestBincRaw(t *testing.T) {
- doTestRawValue(t, "binc", testBincH)
-}
-func TestMsgpackRaw(t *testing.T) {
- doTestRawValue(t, "msgpack", testMsgpackH)
-}
-func TestSimpleRaw(t *testing.T) {
- doTestRawValue(t, "simple", testSimpleH)
-}
-func TestCborRaw(t *testing.T) {
- doTestRawValue(t, "cbor", testCborH)
-}
-
-// ----- ALL (framework based) -----
-
-func TestAllEncCircularRef(t *testing.T) {
- doTestEncCircularRef(t, "cbor", testCborH)
-}
-
-func TestAllAnonCycle(t *testing.T) {
- doTestAnonCycle(t, "cbor", testCborH)
-}
-
-// ----- RPC -----
-
-func TestBincRpcGo(t *testing.T) {
- testCodecRpcOne(t, GoRpc, testBincH, true, 0)
-}
-
-func TestSimpleRpcGo(t *testing.T) {
- testCodecRpcOne(t, GoRpc, testSimpleH, true, 0)
-}
-
-func TestMsgpackRpcGo(t *testing.T) {
- testCodecRpcOne(t, GoRpc, testMsgpackH, true, 0)
-}
-
-func TestCborRpcGo(t *testing.T) {
- testCodecRpcOne(t, GoRpc, testCborH, true, 0)
-}
-
-func TestJsonRpcGo(t *testing.T) {
- testCodecRpcOne(t, GoRpc, testJsonH, true, 0)
-}
-
-func TestMsgpackRpcSpec(t *testing.T) {
- testCodecRpcOne(t, MsgpackSpecRpc, testMsgpackH, true, 0)
-}
-
-func TestBincUnderlyingType(t *testing.T) {
- testCodecUnderlyingType(t, testBincH)
-}
-
-func TestJsonSwallowAndZero(t *testing.T) {
- doTestSwallowAndZero(t, testJsonH)
-}
-
-func TestCborSwallowAndZero(t *testing.T) {
- doTestSwallowAndZero(t, testCborH)
-}
-
-func TestMsgpackSwallowAndZero(t *testing.T) {
- doTestSwallowAndZero(t, testMsgpackH)
-}
-
-func TestBincSwallowAndZero(t *testing.T) {
- doTestSwallowAndZero(t, testBincH)
-}
-
-func TestSimpleSwallowAndZero(t *testing.T) {
- doTestSwallowAndZero(t, testSimpleH)
-}
-
-func TestJsonRawExt(t *testing.T) {
- doTestRawExt(t, testJsonH)
-}
-
-func TestCborRawExt(t *testing.T) {
- doTestRawExt(t, testCborH)
-}
-
-func TestMsgpackRawExt(t *testing.T) {
- doTestRawExt(t, testMsgpackH)
-}
-
-func TestBincRawExt(t *testing.T) {
- doTestRawExt(t, testBincH)
-}
-
-func TestSimpleRawExt(t *testing.T) {
- doTestRawExt(t, testSimpleH)
-}
-
-func TestJsonMapStructKey(t *testing.T) {
- doTestMapStructKey(t, testJsonH)
-}
-
-func TestCborMapStructKey(t *testing.T) {
- doTestMapStructKey(t, testCborH)
-}
-
-func TestMsgpackMapStructKey(t *testing.T) {
- doTestMapStructKey(t, testMsgpackH)
-}
-
-func TestBincMapStructKey(t *testing.T) {
- doTestMapStructKey(t, testBincH)
-}
-
-func TestSimpleMapStructKey(t *testing.T) {
- doTestMapStructKey(t, testSimpleH)
-}
-
-func TestJsonDecodeNilMapValue(t *testing.T) {
- doTestDecodeNilMapValue(t, testJsonH)
-}
-
-func TestCborDecodeNilMapValue(t *testing.T) {
- doTestDecodeNilMapValue(t, testCborH)
-}
-
-func TestMsgpackDecodeNilMapValue(t *testing.T) {
- doTestDecodeNilMapValue(t, testMsgpackH)
-}
-
-func TestBincDecodeNilMapValue(t *testing.T) {
- doTestDecodeNilMapValue(t, testBincH)
-}
-
-func TestSimpleDecodeNilMapValue(t *testing.T) {
- doTestDecodeNilMapValue(t, testSimpleH)
-}
-
-func TestJsonEmbeddedFieldPrecedence(t *testing.T) {
- doTestEmbeddedFieldPrecedence(t, testJsonH)
-}
-
-func TestCborEmbeddedFieldPrecedence(t *testing.T) {
- doTestEmbeddedFieldPrecedence(t, testCborH)
-}
-
-func TestMsgpackEmbeddedFieldPrecedence(t *testing.T) {
- doTestEmbeddedFieldPrecedence(t, testMsgpackH)
-}
-
-func TestBincEmbeddedFieldPrecedence(t *testing.T) {
- doTestEmbeddedFieldPrecedence(t, testBincH)
-}
-
-func TestSimpleEmbeddedFieldPrecedence(t *testing.T) {
- doTestEmbeddedFieldPrecedence(t, testSimpleH)
-}
-
-func TestJsonLargeContainerLen(t *testing.T) {
- doTestLargeContainerLen(t, testJsonH)
-}
-
-func TestCborLargeContainerLen(t *testing.T) {
- doTestLargeContainerLen(t, testCborH)
-}
-
-func TestMsgpackLargeContainerLen(t *testing.T) {
- doTestLargeContainerLen(t, testMsgpackH)
-}
-
-func TestBincLargeContainerLen(t *testing.T) {
- doTestLargeContainerLen(t, testBincH)
-}
-
-func TestSimpleLargeContainerLen(t *testing.T) {
- doTestLargeContainerLen(t, testSimpleH)
-}
-
-func TestJsonMammothMapsAndSlices(t *testing.T) {
- doTestMammothMapsAndSlices(t, testJsonH)
-}
-
-func TestCborMammothMapsAndSlices(t *testing.T) {
- doTestMammothMapsAndSlices(t, testCborH)
-}
-
-func TestMsgpackMammothMapsAndSlices(t *testing.T) {
- old1, old2 := testMsgpackH.RawToString, testMsgpackH.WriteExt
- defer func() { testMsgpackH.RawToString, testMsgpackH.WriteExt = old1, old2 }()
- testMsgpackH.RawToString = true
- testMsgpackH.WriteExt = true
-
- doTestMammothMapsAndSlices(t, testMsgpackH)
-}
-
-func TestBincMammothMapsAndSlices(t *testing.T) {
- doTestMammothMapsAndSlices(t, testBincH)
-}
-
-func TestSimpleMammothMapsAndSlices(t *testing.T) {
- doTestMammothMapsAndSlices(t, testSimpleH)
-}
-
-func TestJsonTime(t *testing.T) {
- testTime(t, "json", testJsonH)
-}
-
-func TestCborTime(t *testing.T) {
- testTime(t, "cbor", testCborH)
-}
-
-func TestMsgpackTime(t *testing.T) {
- testTime(t, "msgpack", testMsgpackH)
-}
-
-func TestBincTime(t *testing.T) {
- testTime(t, "binc", testBincH)
-}
-
-func TestSimpleTime(t *testing.T) {
- testTime(t, "simple", testSimpleH)
-}
-
-func TestJsonUintToInt(t *testing.T) {
- testUintToInt(t, "json", testJsonH)
-}
-
-func TestCborUintToInt(t *testing.T) {
- testUintToInt(t, "cbor", testCborH)
-}
-
-func TestMsgpackUintToInt(t *testing.T) {
- testUintToInt(t, "msgpack", testMsgpackH)
-}
-
-func TestBincUintToInt(t *testing.T) {
- testUintToInt(t, "binc", testBincH)
-}
-
-func TestSimpleUintToInt(t *testing.T) {
- testUintToInt(t, "simple", testSimpleH)
-}
-
-func TestJsonDifferentMapOrSliceType(t *testing.T) {
- doTestDifferentMapOrSliceType(t, "json", testJsonH)
-}
-
-func TestCborDifferentMapOrSliceType(t *testing.T) {
- doTestDifferentMapOrSliceType(t, "cbor", testCborH)
-}
-
-func TestMsgpackDifferentMapOrSliceType(t *testing.T) {
- doTestDifferentMapOrSliceType(t, "msgpack", testMsgpackH)
-}
-
-func TestBincDifferentMapOrSliceType(t *testing.T) {
- doTestDifferentMapOrSliceType(t, "binc", testBincH)
-}
-
-func TestSimpleDifferentMapOrSliceType(t *testing.T) {
- doTestDifferentMapOrSliceType(t, "simple", testSimpleH)
-}
-
-func TestJsonScalars(t *testing.T) {
- doTestScalars(t, "json", testJsonH)
-}
-
-func TestCborScalars(t *testing.T) {
- doTestScalars(t, "cbor", testCborH)
-}
-
-func TestMsgpackScalars(t *testing.T) {
- doTestScalars(t, "msgpack", testMsgpackH)
-}
-
-func TestBincScalars(t *testing.T) {
- doTestScalars(t, "binc", testBincH)
-}
-
-func TestSimpleScalars(t *testing.T) {
- doTestScalars(t, "simple", testSimpleH)
-}
-
-func TestJsonOmitempty(t *testing.T) {
- doTestOmitempty(t, "json", testJsonH)
-}
-
-func TestCborOmitempty(t *testing.T) {
- doTestOmitempty(t, "cbor", testCborH)
-}
-
-func TestMsgpackOmitempty(t *testing.T) {
- doTestOmitempty(t, "msgpack", testMsgpackH)
-}
-
-func TestBincOmitempty(t *testing.T) {
- doTestOmitempty(t, "binc", testBincH)
-}
-
-func TestSimpleOmitempty(t *testing.T) {
- doTestOmitempty(t, "simple", testSimpleH)
-}
-
-func TestJsonIntfMapping(t *testing.T) {
- doTestIntfMapping(t, "json", testJsonH)
-}
-
-func TestCborIntfMapping(t *testing.T) {
- doTestIntfMapping(t, "cbor", testCborH)
-}
-
-func TestMsgpackIntfMapping(t *testing.T) {
- doTestIntfMapping(t, "msgpack", testMsgpackH)
-}
-
-func TestBincIntfMapping(t *testing.T) {
- doTestIntfMapping(t, "binc", testBincH)
-}
-
-func TestSimpleIntfMapping(t *testing.T) {
- doTestIntfMapping(t, "simple", testSimpleH)
-}
-
-// TODO:
-//
-// Add Tests for:
-// - struct tags: on anonymous fields, _struct (all fields), etc
-// - chan to encode and decode (with support for codecgen also)
-//
-// Add negative tests for failure conditions:
-// - bad input with large array length prefix
-//
-// decode.go (standalone)
-// - UnreadByte: only 2 states (z.ls = 2 and z.ls = 1) (0 --> 2 --> 1)
-// - track: z.trb: track, stop track, check
-// - PreferArrayOverSlice???
-// - InterfaceReset
-// - (chan byte) to decode []byte (with mapbyslice track)
-// - decode slice of len 6, 16 into slice of (len 4, cap 8) and (len ) with maxinitlen=6, 8, 16
-// - DeleteOnNilMapValue
-// - decnaked: n.l == nil
-// - ensureDecodeable (try to decode into a non-decodeable thing e.g. a nil interface{},
-//
-// encode.go (standalone)
-// - nil and 0-len slices and maps for non-fastpath things
diff --git a/vendor/github.com/ugorji/go/codec/helper_test.go b/vendor/github.com/ugorji/go/codec/helper_test.go
deleted file mode 100644
index a765fd4a4..000000000
--- a/vendor/github.com/ugorji/go/codec/helper_test.go
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-// All non-std package dependencies related to testing live in this file,
-// so porting to different environment is easy (just update functions).
-
-import (
- "errors"
- "reflect"
-)
-
-// --- these functions are used by both benchmarks and tests
-
-func deepEqual(v1, v2 interface{}) (err error) {
- if !reflect.DeepEqual(v1, v2) {
- err = errors.New("Not Match")
- }
- return
-}
-
-func approxDataSize(rv reflect.Value) (sum int) {
- switch rk := rv.Kind(); rk {
- case reflect.Invalid:
- case reflect.Ptr, reflect.Interface:
- sum += int(rv.Type().Size())
- sum += approxDataSize(rv.Elem())
- case reflect.Slice:
- sum += int(rv.Type().Size())
- for j := 0; j < rv.Len(); j++ {
- sum += approxDataSize(rv.Index(j))
- }
- case reflect.String:
- sum += int(rv.Type().Size())
- sum += rv.Len()
- case reflect.Map:
- sum += int(rv.Type().Size())
- for _, mk := range rv.MapKeys() {
- sum += approxDataSize(mk)
- sum += approxDataSize(rv.MapIndex(mk))
- }
- case reflect.Struct:
- //struct size already includes the full data size.
- //sum += int(rv.Type().Size())
- for j := 0; j < rv.NumField(); j++ {
- sum += approxDataSize(rv.Field(j))
- }
- default:
- //pure value types
- sum += int(rv.Type().Size())
- }
- return
-}
diff --git a/vendor/github.com/ugorji/go/codec/mammoth2_codecgen_generated_test.go b/vendor/github.com/ugorji/go/codec/mammoth2_codecgen_generated_test.go
deleted file mode 100644
index b3813bcf4..000000000
--- a/vendor/github.com/ugorji/go/codec/mammoth2_codecgen_generated_test.go
+++ /dev/null
@@ -1,38474 +0,0 @@
-// +build !notfastpath
-
-// Code generated by codecgen - DO NOT EDIT.
-
-package codec
-
-import (
- "errors"
- "runtime"
- "strconv"
-)
-
-const (
- // ----- content types ----
- codecSelferCcUTF819781 = 1
- codecSelferCcRAW19781 = 0
- // ----- value types used ----
- codecSelferValueTypeArray19781 = 10
- codecSelferValueTypeMap19781 = 9
- codecSelferValueTypeString19781 = 6
- codecSelferValueTypeInt19781 = 2
- codecSelferValueTypeUint19781 = 3
- codecSelferValueTypeFloat19781 = 4
- codecSelferBitsize19781 = uint8(32 << (^uint(0) >> 63))
-)
-
-var (
- errCodecSelferOnlyMapOrArrayEncodeToStruct19781 = errors.New(`only encoded map or array can be decoded into a struct`)
-)
-
-type codecSelfer19781 struct{}
-
-func init() {
- if GenVersion != 8 {
- _, file, _, _ := runtime.Caller(0)
- panic("codecgen version mismatch: current: 8, need " + strconv.FormatInt(int64(GenVersion), 10) + ". Re-generate file: " + file)
- }
- if false { // reference the types, but skip this branch at build/run time
- }
-}
-
-func (x *TestMammoth2) CodecEncodeSelf(e *Encoder) {
- var h codecSelfer19781
- z, r := GenHelperEncoder(e)
- _, _, _ = h, z, r
- if x == nil {
- r.EncodeNil()
- } else {
- if false {
- } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil {
- z.EncExtension(x, yyxt1)
- } else {
- yysep2 := !z.EncBinary()
- yy2arr2 := z.EncBasicHandle().StructToArray
- _, _ = yysep2, yy2arr2
- const yyr2 bool = false // struct tag has 'toArray'
- if yyr2 || yy2arr2 {
- r.WriteArrayStart(576)
- } else {
- r.WriteMapStart(576)
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FIntf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.EncFallback(x.FIntf)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FIntf`)
- r.WriteMapElemValue()
- if x.FIntf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.EncFallback(x.FIntf)
- }
- }
- }
- var yyn6 bool
- if x.FptrIntf == nil {
- yyn6 = true
- goto LABEL6
- }
- LABEL6:
- if yyr2 || yy2arr2 {
- if yyn6 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrIntf == nil {
- r.EncodeNil()
- } else {
- yy7 := *x.FptrIntf
- if false {
- } else {
- z.EncFallback(yy7)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrIntf`)
- r.WriteMapElemValue()
- if yyn6 {
- r.EncodeNil()
- } else {
- if x.FptrIntf == nil {
- r.EncodeNil()
- } else {
- yy9 := *x.FptrIntf
- if false {
- } else {
- z.EncFallback(yy9)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if false {
- } else {
- r.EncodeString(codecSelferCcUTF819781, string(x.FString))
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FString`)
- r.WriteMapElemValue()
- if false {
- } else {
- r.EncodeString(codecSelferCcUTF819781, string(x.FString))
- }
- }
- var yyn14 bool
- if x.FptrString == nil {
- yyn14 = true
- goto LABEL14
- }
- LABEL14:
- if yyr2 || yy2arr2 {
- if yyn14 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrString == nil {
- r.EncodeNil()
- } else {
- yy15 := *x.FptrString
- if false {
- } else {
- r.EncodeString(codecSelferCcUTF819781, string(yy15))
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrString`)
- r.WriteMapElemValue()
- if yyn14 {
- r.EncodeNil()
- } else {
- if x.FptrString == nil {
- r.EncodeNil()
- } else {
- yy17 := *x.FptrString
- if false {
- } else {
- r.EncodeString(codecSelferCcUTF819781, string(yy17))
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if false {
- } else {
- r.EncodeFloat32(float32(x.FFloat32))
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FFloat32`)
- r.WriteMapElemValue()
- if false {
- } else {
- r.EncodeFloat32(float32(x.FFloat32))
- }
- }
- var yyn22 bool
- if x.FptrFloat32 == nil {
- yyn22 = true
- goto LABEL22
- }
- LABEL22:
- if yyr2 || yy2arr2 {
- if yyn22 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrFloat32 == nil {
- r.EncodeNil()
- } else {
- yy23 := *x.FptrFloat32
- if false {
- } else {
- r.EncodeFloat32(float32(yy23))
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrFloat32`)
- r.WriteMapElemValue()
- if yyn22 {
- r.EncodeNil()
- } else {
- if x.FptrFloat32 == nil {
- r.EncodeNil()
- } else {
- yy25 := *x.FptrFloat32
- if false {
- } else {
- r.EncodeFloat32(float32(yy25))
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if false {
- } else {
- r.EncodeFloat64(float64(x.FFloat64))
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FFloat64`)
- r.WriteMapElemValue()
- if false {
- } else {
- r.EncodeFloat64(float64(x.FFloat64))
- }
- }
- var yyn30 bool
- if x.FptrFloat64 == nil {
- yyn30 = true
- goto LABEL30
- }
- LABEL30:
- if yyr2 || yy2arr2 {
- if yyn30 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrFloat64 == nil {
- r.EncodeNil()
- } else {
- yy31 := *x.FptrFloat64
- if false {
- } else {
- r.EncodeFloat64(float64(yy31))
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrFloat64`)
- r.WriteMapElemValue()
- if yyn30 {
- r.EncodeNil()
- } else {
- if x.FptrFloat64 == nil {
- r.EncodeNil()
- } else {
- yy33 := *x.FptrFloat64
- if false {
- } else {
- r.EncodeFloat64(float64(yy33))
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if false {
- } else {
- r.EncodeUint(uint64(x.FUint))
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FUint`)
- r.WriteMapElemValue()
- if false {
- } else {
- r.EncodeUint(uint64(x.FUint))
- }
- }
- var yyn38 bool
- if x.FptrUint == nil {
- yyn38 = true
- goto LABEL38
- }
- LABEL38:
- if yyr2 || yy2arr2 {
- if yyn38 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrUint == nil {
- r.EncodeNil()
- } else {
- yy39 := *x.FptrUint
- if false {
- } else {
- r.EncodeUint(uint64(yy39))
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrUint`)
- r.WriteMapElemValue()
- if yyn38 {
- r.EncodeNil()
- } else {
- if x.FptrUint == nil {
- r.EncodeNil()
- } else {
- yy41 := *x.FptrUint
- if false {
- } else {
- r.EncodeUint(uint64(yy41))
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if false {
- } else {
- r.EncodeUint(uint64(x.FUint8))
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FUint8`)
- r.WriteMapElemValue()
- if false {
- } else {
- r.EncodeUint(uint64(x.FUint8))
- }
- }
- var yyn46 bool
- if x.FptrUint8 == nil {
- yyn46 = true
- goto LABEL46
- }
- LABEL46:
- if yyr2 || yy2arr2 {
- if yyn46 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrUint8 == nil {
- r.EncodeNil()
- } else {
- yy47 := *x.FptrUint8
- if false {
- } else {
- r.EncodeUint(uint64(yy47))
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrUint8`)
- r.WriteMapElemValue()
- if yyn46 {
- r.EncodeNil()
- } else {
- if x.FptrUint8 == nil {
- r.EncodeNil()
- } else {
- yy49 := *x.FptrUint8
- if false {
- } else {
- r.EncodeUint(uint64(yy49))
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if false {
- } else {
- r.EncodeUint(uint64(x.FUint16))
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FUint16`)
- r.WriteMapElemValue()
- if false {
- } else {
- r.EncodeUint(uint64(x.FUint16))
- }
- }
- var yyn54 bool
- if x.FptrUint16 == nil {
- yyn54 = true
- goto LABEL54
- }
- LABEL54:
- if yyr2 || yy2arr2 {
- if yyn54 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrUint16 == nil {
- r.EncodeNil()
- } else {
- yy55 := *x.FptrUint16
- if false {
- } else {
- r.EncodeUint(uint64(yy55))
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrUint16`)
- r.WriteMapElemValue()
- if yyn54 {
- r.EncodeNil()
- } else {
- if x.FptrUint16 == nil {
- r.EncodeNil()
- } else {
- yy57 := *x.FptrUint16
- if false {
- } else {
- r.EncodeUint(uint64(yy57))
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if false {
- } else {
- r.EncodeUint(uint64(x.FUint32))
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FUint32`)
- r.WriteMapElemValue()
- if false {
- } else {
- r.EncodeUint(uint64(x.FUint32))
- }
- }
- var yyn62 bool
- if x.FptrUint32 == nil {
- yyn62 = true
- goto LABEL62
- }
- LABEL62:
- if yyr2 || yy2arr2 {
- if yyn62 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrUint32 == nil {
- r.EncodeNil()
- } else {
- yy63 := *x.FptrUint32
- if false {
- } else {
- r.EncodeUint(uint64(yy63))
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrUint32`)
- r.WriteMapElemValue()
- if yyn62 {
- r.EncodeNil()
- } else {
- if x.FptrUint32 == nil {
- r.EncodeNil()
- } else {
- yy65 := *x.FptrUint32
- if false {
- } else {
- r.EncodeUint(uint64(yy65))
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if false {
- } else {
- r.EncodeUint(uint64(x.FUint64))
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FUint64`)
- r.WriteMapElemValue()
- if false {
- } else {
- r.EncodeUint(uint64(x.FUint64))
- }
- }
- var yyn70 bool
- if x.FptrUint64 == nil {
- yyn70 = true
- goto LABEL70
- }
- LABEL70:
- if yyr2 || yy2arr2 {
- if yyn70 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrUint64 == nil {
- r.EncodeNil()
- } else {
- yy71 := *x.FptrUint64
- if false {
- } else {
- r.EncodeUint(uint64(yy71))
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrUint64`)
- r.WriteMapElemValue()
- if yyn70 {
- r.EncodeNil()
- } else {
- if x.FptrUint64 == nil {
- r.EncodeNil()
- } else {
- yy73 := *x.FptrUint64
- if false {
- } else {
- r.EncodeUint(uint64(yy73))
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if false {
- } else {
- r.EncodeUint(uint64(x.FUintptr))
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FUintptr`)
- r.WriteMapElemValue()
- if false {
- } else {
- r.EncodeUint(uint64(x.FUintptr))
- }
- }
- var yyn78 bool
- if x.FptrUintptr == nil {
- yyn78 = true
- goto LABEL78
- }
- LABEL78:
- if yyr2 || yy2arr2 {
- if yyn78 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrUintptr == nil {
- r.EncodeNil()
- } else {
- yy79 := *x.FptrUintptr
- if false {
- } else {
- r.EncodeUint(uint64(yy79))
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrUintptr`)
- r.WriteMapElemValue()
- if yyn78 {
- r.EncodeNil()
- } else {
- if x.FptrUintptr == nil {
- r.EncodeNil()
- } else {
- yy81 := *x.FptrUintptr
- if false {
- } else {
- r.EncodeUint(uint64(yy81))
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if false {
- } else {
- r.EncodeInt(int64(x.FInt))
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FInt`)
- r.WriteMapElemValue()
- if false {
- } else {
- r.EncodeInt(int64(x.FInt))
- }
- }
- var yyn86 bool
- if x.FptrInt == nil {
- yyn86 = true
- goto LABEL86
- }
- LABEL86:
- if yyr2 || yy2arr2 {
- if yyn86 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrInt == nil {
- r.EncodeNil()
- } else {
- yy87 := *x.FptrInt
- if false {
- } else {
- r.EncodeInt(int64(yy87))
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrInt`)
- r.WriteMapElemValue()
- if yyn86 {
- r.EncodeNil()
- } else {
- if x.FptrInt == nil {
- r.EncodeNil()
- } else {
- yy89 := *x.FptrInt
- if false {
- } else {
- r.EncodeInt(int64(yy89))
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if false {
- } else {
- r.EncodeInt(int64(x.FInt8))
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FInt8`)
- r.WriteMapElemValue()
- if false {
- } else {
- r.EncodeInt(int64(x.FInt8))
- }
- }
- var yyn94 bool
- if x.FptrInt8 == nil {
- yyn94 = true
- goto LABEL94
- }
- LABEL94:
- if yyr2 || yy2arr2 {
- if yyn94 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrInt8 == nil {
- r.EncodeNil()
- } else {
- yy95 := *x.FptrInt8
- if false {
- } else {
- r.EncodeInt(int64(yy95))
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrInt8`)
- r.WriteMapElemValue()
- if yyn94 {
- r.EncodeNil()
- } else {
- if x.FptrInt8 == nil {
- r.EncodeNil()
- } else {
- yy97 := *x.FptrInt8
- if false {
- } else {
- r.EncodeInt(int64(yy97))
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if false {
- } else {
- r.EncodeInt(int64(x.FInt16))
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FInt16`)
- r.WriteMapElemValue()
- if false {
- } else {
- r.EncodeInt(int64(x.FInt16))
- }
- }
- var yyn102 bool
- if x.FptrInt16 == nil {
- yyn102 = true
- goto LABEL102
- }
- LABEL102:
- if yyr2 || yy2arr2 {
- if yyn102 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrInt16 == nil {
- r.EncodeNil()
- } else {
- yy103 := *x.FptrInt16
- if false {
- } else {
- r.EncodeInt(int64(yy103))
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrInt16`)
- r.WriteMapElemValue()
- if yyn102 {
- r.EncodeNil()
- } else {
- if x.FptrInt16 == nil {
- r.EncodeNil()
- } else {
- yy105 := *x.FptrInt16
- if false {
- } else {
- r.EncodeInt(int64(yy105))
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if false {
- } else {
- r.EncodeInt(int64(x.FInt32))
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FInt32`)
- r.WriteMapElemValue()
- if false {
- } else {
- r.EncodeInt(int64(x.FInt32))
- }
- }
- var yyn110 bool
- if x.FptrInt32 == nil {
- yyn110 = true
- goto LABEL110
- }
- LABEL110:
- if yyr2 || yy2arr2 {
- if yyn110 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrInt32 == nil {
- r.EncodeNil()
- } else {
- yy111 := *x.FptrInt32
- if false {
- } else {
- r.EncodeInt(int64(yy111))
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrInt32`)
- r.WriteMapElemValue()
- if yyn110 {
- r.EncodeNil()
- } else {
- if x.FptrInt32 == nil {
- r.EncodeNil()
- } else {
- yy113 := *x.FptrInt32
- if false {
- } else {
- r.EncodeInt(int64(yy113))
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if false {
- } else {
- r.EncodeInt(int64(x.FInt64))
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FInt64`)
- r.WriteMapElemValue()
- if false {
- } else {
- r.EncodeInt(int64(x.FInt64))
- }
- }
- var yyn118 bool
- if x.FptrInt64 == nil {
- yyn118 = true
- goto LABEL118
- }
- LABEL118:
- if yyr2 || yy2arr2 {
- if yyn118 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrInt64 == nil {
- r.EncodeNil()
- } else {
- yy119 := *x.FptrInt64
- if false {
- } else {
- r.EncodeInt(int64(yy119))
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrInt64`)
- r.WriteMapElemValue()
- if yyn118 {
- r.EncodeNil()
- } else {
- if x.FptrInt64 == nil {
- r.EncodeNil()
- } else {
- yy121 := *x.FptrInt64
- if false {
- } else {
- r.EncodeInt(int64(yy121))
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if false {
- } else {
- r.EncodeBool(bool(x.FBool))
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FBool`)
- r.WriteMapElemValue()
- if false {
- } else {
- r.EncodeBool(bool(x.FBool))
- }
- }
- var yyn126 bool
- if x.FptrBool == nil {
- yyn126 = true
- goto LABEL126
- }
- LABEL126:
- if yyr2 || yy2arr2 {
- if yyn126 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrBool == nil {
- r.EncodeNil()
- } else {
- yy127 := *x.FptrBool
- if false {
- } else {
- r.EncodeBool(bool(yy127))
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrBool`)
- r.WriteMapElemValue()
- if yyn126 {
- r.EncodeNil()
- } else {
- if x.FptrBool == nil {
- r.EncodeNil()
- } else {
- yy129 := *x.FptrBool
- if false {
- } else {
- r.EncodeBool(bool(yy129))
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FSliceIntf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceIntfV(x.FSliceIntf, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FSliceIntf`)
- r.WriteMapElemValue()
- if x.FSliceIntf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceIntfV(x.FSliceIntf, e)
- }
- }
- }
- var yyn134 bool
- if x.FptrSliceIntf == nil {
- yyn134 = true
- goto LABEL134
- }
- LABEL134:
- if yyr2 || yy2arr2 {
- if yyn134 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrSliceIntf == nil {
- r.EncodeNil()
- } else {
- yy135 := *x.FptrSliceIntf
- if false {
- } else {
- z.F.EncSliceIntfV(yy135, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrSliceIntf`)
- r.WriteMapElemValue()
- if yyn134 {
- r.EncodeNil()
- } else {
- if x.FptrSliceIntf == nil {
- r.EncodeNil()
- } else {
- yy137 := *x.FptrSliceIntf
- if false {
- } else {
- z.F.EncSliceIntfV(yy137, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FSliceString == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceStringV(x.FSliceString, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FSliceString`)
- r.WriteMapElemValue()
- if x.FSliceString == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceStringV(x.FSliceString, e)
- }
- }
- }
- var yyn142 bool
- if x.FptrSliceString == nil {
- yyn142 = true
- goto LABEL142
- }
- LABEL142:
- if yyr2 || yy2arr2 {
- if yyn142 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrSliceString == nil {
- r.EncodeNil()
- } else {
- yy143 := *x.FptrSliceString
- if false {
- } else {
- z.F.EncSliceStringV(yy143, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrSliceString`)
- r.WriteMapElemValue()
- if yyn142 {
- r.EncodeNil()
- } else {
- if x.FptrSliceString == nil {
- r.EncodeNil()
- } else {
- yy145 := *x.FptrSliceString
- if false {
- } else {
- z.F.EncSliceStringV(yy145, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FSliceFloat32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceFloat32V(x.FSliceFloat32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FSliceFloat32`)
- r.WriteMapElemValue()
- if x.FSliceFloat32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceFloat32V(x.FSliceFloat32, e)
- }
- }
- }
- var yyn150 bool
- if x.FptrSliceFloat32 == nil {
- yyn150 = true
- goto LABEL150
- }
- LABEL150:
- if yyr2 || yy2arr2 {
- if yyn150 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrSliceFloat32 == nil {
- r.EncodeNil()
- } else {
- yy151 := *x.FptrSliceFloat32
- if false {
- } else {
- z.F.EncSliceFloat32V(yy151, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrSliceFloat32`)
- r.WriteMapElemValue()
- if yyn150 {
- r.EncodeNil()
- } else {
- if x.FptrSliceFloat32 == nil {
- r.EncodeNil()
- } else {
- yy153 := *x.FptrSliceFloat32
- if false {
- } else {
- z.F.EncSliceFloat32V(yy153, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FSliceFloat64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceFloat64V(x.FSliceFloat64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FSliceFloat64`)
- r.WriteMapElemValue()
- if x.FSliceFloat64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceFloat64V(x.FSliceFloat64, e)
- }
- }
- }
- var yyn158 bool
- if x.FptrSliceFloat64 == nil {
- yyn158 = true
- goto LABEL158
- }
- LABEL158:
- if yyr2 || yy2arr2 {
- if yyn158 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrSliceFloat64 == nil {
- r.EncodeNil()
- } else {
- yy159 := *x.FptrSliceFloat64
- if false {
- } else {
- z.F.EncSliceFloat64V(yy159, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrSliceFloat64`)
- r.WriteMapElemValue()
- if yyn158 {
- r.EncodeNil()
- } else {
- if x.FptrSliceFloat64 == nil {
- r.EncodeNil()
- } else {
- yy161 := *x.FptrSliceFloat64
- if false {
- } else {
- z.F.EncSliceFloat64V(yy161, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FSliceUint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceUintV(x.FSliceUint, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FSliceUint`)
- r.WriteMapElemValue()
- if x.FSliceUint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceUintV(x.FSliceUint, e)
- }
- }
- }
- var yyn166 bool
- if x.FptrSliceUint == nil {
- yyn166 = true
- goto LABEL166
- }
- LABEL166:
- if yyr2 || yy2arr2 {
- if yyn166 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrSliceUint == nil {
- r.EncodeNil()
- } else {
- yy167 := *x.FptrSliceUint
- if false {
- } else {
- z.F.EncSliceUintV(yy167, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrSliceUint`)
- r.WriteMapElemValue()
- if yyn166 {
- r.EncodeNil()
- } else {
- if x.FptrSliceUint == nil {
- r.EncodeNil()
- } else {
- yy169 := *x.FptrSliceUint
- if false {
- } else {
- z.F.EncSliceUintV(yy169, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FSliceUint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- r.EncodeStringBytes(codecSelferCcRAW19781, []byte(x.FSliceUint8))
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FSliceUint8`)
- r.WriteMapElemValue()
- if x.FSliceUint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- r.EncodeStringBytes(codecSelferCcRAW19781, []byte(x.FSliceUint8))
- }
- }
- }
- var yyn174 bool
- if x.FptrSliceUint8 == nil {
- yyn174 = true
- goto LABEL174
- }
- LABEL174:
- if yyr2 || yy2arr2 {
- if yyn174 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrSliceUint8 == nil {
- r.EncodeNil()
- } else {
- yy175 := *x.FptrSliceUint8
- if false {
- } else {
- r.EncodeStringBytes(codecSelferCcRAW19781, []byte(yy175))
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrSliceUint8`)
- r.WriteMapElemValue()
- if yyn174 {
- r.EncodeNil()
- } else {
- if x.FptrSliceUint8 == nil {
- r.EncodeNil()
- } else {
- yy177 := *x.FptrSliceUint8
- if false {
- } else {
- r.EncodeStringBytes(codecSelferCcRAW19781, []byte(yy177))
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FSliceUint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceUint16V(x.FSliceUint16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FSliceUint16`)
- r.WriteMapElemValue()
- if x.FSliceUint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceUint16V(x.FSliceUint16, e)
- }
- }
- }
- var yyn182 bool
- if x.FptrSliceUint16 == nil {
- yyn182 = true
- goto LABEL182
- }
- LABEL182:
- if yyr2 || yy2arr2 {
- if yyn182 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrSliceUint16 == nil {
- r.EncodeNil()
- } else {
- yy183 := *x.FptrSliceUint16
- if false {
- } else {
- z.F.EncSliceUint16V(yy183, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrSliceUint16`)
- r.WriteMapElemValue()
- if yyn182 {
- r.EncodeNil()
- } else {
- if x.FptrSliceUint16 == nil {
- r.EncodeNil()
- } else {
- yy185 := *x.FptrSliceUint16
- if false {
- } else {
- z.F.EncSliceUint16V(yy185, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FSliceUint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceUint32V(x.FSliceUint32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FSliceUint32`)
- r.WriteMapElemValue()
- if x.FSliceUint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceUint32V(x.FSliceUint32, e)
- }
- }
- }
- var yyn190 bool
- if x.FptrSliceUint32 == nil {
- yyn190 = true
- goto LABEL190
- }
- LABEL190:
- if yyr2 || yy2arr2 {
- if yyn190 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrSliceUint32 == nil {
- r.EncodeNil()
- } else {
- yy191 := *x.FptrSliceUint32
- if false {
- } else {
- z.F.EncSliceUint32V(yy191, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrSliceUint32`)
- r.WriteMapElemValue()
- if yyn190 {
- r.EncodeNil()
- } else {
- if x.FptrSliceUint32 == nil {
- r.EncodeNil()
- } else {
- yy193 := *x.FptrSliceUint32
- if false {
- } else {
- z.F.EncSliceUint32V(yy193, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FSliceUint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceUint64V(x.FSliceUint64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FSliceUint64`)
- r.WriteMapElemValue()
- if x.FSliceUint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceUint64V(x.FSliceUint64, e)
- }
- }
- }
- var yyn198 bool
- if x.FptrSliceUint64 == nil {
- yyn198 = true
- goto LABEL198
- }
- LABEL198:
- if yyr2 || yy2arr2 {
- if yyn198 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrSliceUint64 == nil {
- r.EncodeNil()
- } else {
- yy199 := *x.FptrSliceUint64
- if false {
- } else {
- z.F.EncSliceUint64V(yy199, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrSliceUint64`)
- r.WriteMapElemValue()
- if yyn198 {
- r.EncodeNil()
- } else {
- if x.FptrSliceUint64 == nil {
- r.EncodeNil()
- } else {
- yy201 := *x.FptrSliceUint64
- if false {
- } else {
- z.F.EncSliceUint64V(yy201, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FSliceUintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceUintptrV(x.FSliceUintptr, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FSliceUintptr`)
- r.WriteMapElemValue()
- if x.FSliceUintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceUintptrV(x.FSliceUintptr, e)
- }
- }
- }
- var yyn206 bool
- if x.FptrSliceUintptr == nil {
- yyn206 = true
- goto LABEL206
- }
- LABEL206:
- if yyr2 || yy2arr2 {
- if yyn206 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrSliceUintptr == nil {
- r.EncodeNil()
- } else {
- yy207 := *x.FptrSliceUintptr
- if false {
- } else {
- z.F.EncSliceUintptrV(yy207, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrSliceUintptr`)
- r.WriteMapElemValue()
- if yyn206 {
- r.EncodeNil()
- } else {
- if x.FptrSliceUintptr == nil {
- r.EncodeNil()
- } else {
- yy209 := *x.FptrSliceUintptr
- if false {
- } else {
- z.F.EncSliceUintptrV(yy209, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FSliceInt == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceIntV(x.FSliceInt, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FSliceInt`)
- r.WriteMapElemValue()
- if x.FSliceInt == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceIntV(x.FSliceInt, e)
- }
- }
- }
- var yyn214 bool
- if x.FptrSliceInt == nil {
- yyn214 = true
- goto LABEL214
- }
- LABEL214:
- if yyr2 || yy2arr2 {
- if yyn214 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrSliceInt == nil {
- r.EncodeNil()
- } else {
- yy215 := *x.FptrSliceInt
- if false {
- } else {
- z.F.EncSliceIntV(yy215, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrSliceInt`)
- r.WriteMapElemValue()
- if yyn214 {
- r.EncodeNil()
- } else {
- if x.FptrSliceInt == nil {
- r.EncodeNil()
- } else {
- yy217 := *x.FptrSliceInt
- if false {
- } else {
- z.F.EncSliceIntV(yy217, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FSliceInt8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceInt8V(x.FSliceInt8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FSliceInt8`)
- r.WriteMapElemValue()
- if x.FSliceInt8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceInt8V(x.FSliceInt8, e)
- }
- }
- }
- var yyn222 bool
- if x.FptrSliceInt8 == nil {
- yyn222 = true
- goto LABEL222
- }
- LABEL222:
- if yyr2 || yy2arr2 {
- if yyn222 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrSliceInt8 == nil {
- r.EncodeNil()
- } else {
- yy223 := *x.FptrSliceInt8
- if false {
- } else {
- z.F.EncSliceInt8V(yy223, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrSliceInt8`)
- r.WriteMapElemValue()
- if yyn222 {
- r.EncodeNil()
- } else {
- if x.FptrSliceInt8 == nil {
- r.EncodeNil()
- } else {
- yy225 := *x.FptrSliceInt8
- if false {
- } else {
- z.F.EncSliceInt8V(yy225, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FSliceInt16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceInt16V(x.FSliceInt16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FSliceInt16`)
- r.WriteMapElemValue()
- if x.FSliceInt16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceInt16V(x.FSliceInt16, e)
- }
- }
- }
- var yyn230 bool
- if x.FptrSliceInt16 == nil {
- yyn230 = true
- goto LABEL230
- }
- LABEL230:
- if yyr2 || yy2arr2 {
- if yyn230 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrSliceInt16 == nil {
- r.EncodeNil()
- } else {
- yy231 := *x.FptrSliceInt16
- if false {
- } else {
- z.F.EncSliceInt16V(yy231, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrSliceInt16`)
- r.WriteMapElemValue()
- if yyn230 {
- r.EncodeNil()
- } else {
- if x.FptrSliceInt16 == nil {
- r.EncodeNil()
- } else {
- yy233 := *x.FptrSliceInt16
- if false {
- } else {
- z.F.EncSliceInt16V(yy233, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FSliceInt32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceInt32V(x.FSliceInt32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FSliceInt32`)
- r.WriteMapElemValue()
- if x.FSliceInt32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceInt32V(x.FSliceInt32, e)
- }
- }
- }
- var yyn238 bool
- if x.FptrSliceInt32 == nil {
- yyn238 = true
- goto LABEL238
- }
- LABEL238:
- if yyr2 || yy2arr2 {
- if yyn238 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrSliceInt32 == nil {
- r.EncodeNil()
- } else {
- yy239 := *x.FptrSliceInt32
- if false {
- } else {
- z.F.EncSliceInt32V(yy239, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrSliceInt32`)
- r.WriteMapElemValue()
- if yyn238 {
- r.EncodeNil()
- } else {
- if x.FptrSliceInt32 == nil {
- r.EncodeNil()
- } else {
- yy241 := *x.FptrSliceInt32
- if false {
- } else {
- z.F.EncSliceInt32V(yy241, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FSliceInt64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceInt64V(x.FSliceInt64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FSliceInt64`)
- r.WriteMapElemValue()
- if x.FSliceInt64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceInt64V(x.FSliceInt64, e)
- }
- }
- }
- var yyn246 bool
- if x.FptrSliceInt64 == nil {
- yyn246 = true
- goto LABEL246
- }
- LABEL246:
- if yyr2 || yy2arr2 {
- if yyn246 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrSliceInt64 == nil {
- r.EncodeNil()
- } else {
- yy247 := *x.FptrSliceInt64
- if false {
- } else {
- z.F.EncSliceInt64V(yy247, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrSliceInt64`)
- r.WriteMapElemValue()
- if yyn246 {
- r.EncodeNil()
- } else {
- if x.FptrSliceInt64 == nil {
- r.EncodeNil()
- } else {
- yy249 := *x.FptrSliceInt64
- if false {
- } else {
- z.F.EncSliceInt64V(yy249, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FSliceBool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceBoolV(x.FSliceBool, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FSliceBool`)
- r.WriteMapElemValue()
- if x.FSliceBool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncSliceBoolV(x.FSliceBool, e)
- }
- }
- }
- var yyn254 bool
- if x.FptrSliceBool == nil {
- yyn254 = true
- goto LABEL254
- }
- LABEL254:
- if yyr2 || yy2arr2 {
- if yyn254 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrSliceBool == nil {
- r.EncodeNil()
- } else {
- yy255 := *x.FptrSliceBool
- if false {
- } else {
- z.F.EncSliceBoolV(yy255, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrSliceBool`)
- r.WriteMapElemValue()
- if yyn254 {
- r.EncodeNil()
- } else {
- if x.FptrSliceBool == nil {
- r.EncodeNil()
- } else {
- yy257 := *x.FptrSliceBool
- if false {
- } else {
- z.F.EncSliceBoolV(yy257, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntfIntf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfIntfV(x.FMapIntfIntf, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntfIntf`)
- r.WriteMapElemValue()
- if x.FMapIntfIntf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfIntfV(x.FMapIntfIntf, e)
- }
- }
- }
- var yyn262 bool
- if x.FptrMapIntfIntf == nil {
- yyn262 = true
- goto LABEL262
- }
- LABEL262:
- if yyr2 || yy2arr2 {
- if yyn262 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntfIntf == nil {
- r.EncodeNil()
- } else {
- yy263 := *x.FptrMapIntfIntf
- if false {
- } else {
- z.F.EncMapIntfIntfV(yy263, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfIntf`)
- r.WriteMapElemValue()
- if yyn262 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntfIntf == nil {
- r.EncodeNil()
- } else {
- yy265 := *x.FptrMapIntfIntf
- if false {
- } else {
- z.F.EncMapIntfIntfV(yy265, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntfString == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfStringV(x.FMapIntfString, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntfString`)
- r.WriteMapElemValue()
- if x.FMapIntfString == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfStringV(x.FMapIntfString, e)
- }
- }
- }
- var yyn270 bool
- if x.FptrMapIntfString == nil {
- yyn270 = true
- goto LABEL270
- }
- LABEL270:
- if yyr2 || yy2arr2 {
- if yyn270 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntfString == nil {
- r.EncodeNil()
- } else {
- yy271 := *x.FptrMapIntfString
- if false {
- } else {
- z.F.EncMapIntfStringV(yy271, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfString`)
- r.WriteMapElemValue()
- if yyn270 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntfString == nil {
- r.EncodeNil()
- } else {
- yy273 := *x.FptrMapIntfString
- if false {
- } else {
- z.F.EncMapIntfStringV(yy273, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntfUint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfUintV(x.FMapIntfUint, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntfUint`)
- r.WriteMapElemValue()
- if x.FMapIntfUint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfUintV(x.FMapIntfUint, e)
- }
- }
- }
- var yyn278 bool
- if x.FptrMapIntfUint == nil {
- yyn278 = true
- goto LABEL278
- }
- LABEL278:
- if yyr2 || yy2arr2 {
- if yyn278 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntfUint == nil {
- r.EncodeNil()
- } else {
- yy279 := *x.FptrMapIntfUint
- if false {
- } else {
- z.F.EncMapIntfUintV(yy279, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfUint`)
- r.WriteMapElemValue()
- if yyn278 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntfUint == nil {
- r.EncodeNil()
- } else {
- yy281 := *x.FptrMapIntfUint
- if false {
- } else {
- z.F.EncMapIntfUintV(yy281, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntfUint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfUint8V(x.FMapIntfUint8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntfUint8`)
- r.WriteMapElemValue()
- if x.FMapIntfUint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfUint8V(x.FMapIntfUint8, e)
- }
- }
- }
- var yyn286 bool
- if x.FptrMapIntfUint8 == nil {
- yyn286 = true
- goto LABEL286
- }
- LABEL286:
- if yyr2 || yy2arr2 {
- if yyn286 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntfUint8 == nil {
- r.EncodeNil()
- } else {
- yy287 := *x.FptrMapIntfUint8
- if false {
- } else {
- z.F.EncMapIntfUint8V(yy287, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfUint8`)
- r.WriteMapElemValue()
- if yyn286 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntfUint8 == nil {
- r.EncodeNil()
- } else {
- yy289 := *x.FptrMapIntfUint8
- if false {
- } else {
- z.F.EncMapIntfUint8V(yy289, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntfUint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfUint16V(x.FMapIntfUint16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntfUint16`)
- r.WriteMapElemValue()
- if x.FMapIntfUint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfUint16V(x.FMapIntfUint16, e)
- }
- }
- }
- var yyn294 bool
- if x.FptrMapIntfUint16 == nil {
- yyn294 = true
- goto LABEL294
- }
- LABEL294:
- if yyr2 || yy2arr2 {
- if yyn294 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntfUint16 == nil {
- r.EncodeNil()
- } else {
- yy295 := *x.FptrMapIntfUint16
- if false {
- } else {
- z.F.EncMapIntfUint16V(yy295, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfUint16`)
- r.WriteMapElemValue()
- if yyn294 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntfUint16 == nil {
- r.EncodeNil()
- } else {
- yy297 := *x.FptrMapIntfUint16
- if false {
- } else {
- z.F.EncMapIntfUint16V(yy297, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntfUint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfUint32V(x.FMapIntfUint32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntfUint32`)
- r.WriteMapElemValue()
- if x.FMapIntfUint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfUint32V(x.FMapIntfUint32, e)
- }
- }
- }
- var yyn302 bool
- if x.FptrMapIntfUint32 == nil {
- yyn302 = true
- goto LABEL302
- }
- LABEL302:
- if yyr2 || yy2arr2 {
- if yyn302 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntfUint32 == nil {
- r.EncodeNil()
- } else {
- yy303 := *x.FptrMapIntfUint32
- if false {
- } else {
- z.F.EncMapIntfUint32V(yy303, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfUint32`)
- r.WriteMapElemValue()
- if yyn302 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntfUint32 == nil {
- r.EncodeNil()
- } else {
- yy305 := *x.FptrMapIntfUint32
- if false {
- } else {
- z.F.EncMapIntfUint32V(yy305, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntfUint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfUint64V(x.FMapIntfUint64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntfUint64`)
- r.WriteMapElemValue()
- if x.FMapIntfUint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfUint64V(x.FMapIntfUint64, e)
- }
- }
- }
- var yyn310 bool
- if x.FptrMapIntfUint64 == nil {
- yyn310 = true
- goto LABEL310
- }
- LABEL310:
- if yyr2 || yy2arr2 {
- if yyn310 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntfUint64 == nil {
- r.EncodeNil()
- } else {
- yy311 := *x.FptrMapIntfUint64
- if false {
- } else {
- z.F.EncMapIntfUint64V(yy311, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfUint64`)
- r.WriteMapElemValue()
- if yyn310 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntfUint64 == nil {
- r.EncodeNil()
- } else {
- yy313 := *x.FptrMapIntfUint64
- if false {
- } else {
- z.F.EncMapIntfUint64V(yy313, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntfUintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfUintptrV(x.FMapIntfUintptr, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntfUintptr`)
- r.WriteMapElemValue()
- if x.FMapIntfUintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfUintptrV(x.FMapIntfUintptr, e)
- }
- }
- }
- var yyn318 bool
- if x.FptrMapIntfUintptr == nil {
- yyn318 = true
- goto LABEL318
- }
- LABEL318:
- if yyr2 || yy2arr2 {
- if yyn318 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntfUintptr == nil {
- r.EncodeNil()
- } else {
- yy319 := *x.FptrMapIntfUintptr
- if false {
- } else {
- z.F.EncMapIntfUintptrV(yy319, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfUintptr`)
- r.WriteMapElemValue()
- if yyn318 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntfUintptr == nil {
- r.EncodeNil()
- } else {
- yy321 := *x.FptrMapIntfUintptr
- if false {
- } else {
- z.F.EncMapIntfUintptrV(yy321, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntfInt == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfIntV(x.FMapIntfInt, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntfInt`)
- r.WriteMapElemValue()
- if x.FMapIntfInt == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfIntV(x.FMapIntfInt, e)
- }
- }
- }
- var yyn326 bool
- if x.FptrMapIntfInt == nil {
- yyn326 = true
- goto LABEL326
- }
- LABEL326:
- if yyr2 || yy2arr2 {
- if yyn326 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntfInt == nil {
- r.EncodeNil()
- } else {
- yy327 := *x.FptrMapIntfInt
- if false {
- } else {
- z.F.EncMapIntfIntV(yy327, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfInt`)
- r.WriteMapElemValue()
- if yyn326 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntfInt == nil {
- r.EncodeNil()
- } else {
- yy329 := *x.FptrMapIntfInt
- if false {
- } else {
- z.F.EncMapIntfIntV(yy329, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntfInt8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfInt8V(x.FMapIntfInt8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntfInt8`)
- r.WriteMapElemValue()
- if x.FMapIntfInt8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfInt8V(x.FMapIntfInt8, e)
- }
- }
- }
- var yyn334 bool
- if x.FptrMapIntfInt8 == nil {
- yyn334 = true
- goto LABEL334
- }
- LABEL334:
- if yyr2 || yy2arr2 {
- if yyn334 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntfInt8 == nil {
- r.EncodeNil()
- } else {
- yy335 := *x.FptrMapIntfInt8
- if false {
- } else {
- z.F.EncMapIntfInt8V(yy335, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfInt8`)
- r.WriteMapElemValue()
- if yyn334 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntfInt8 == nil {
- r.EncodeNil()
- } else {
- yy337 := *x.FptrMapIntfInt8
- if false {
- } else {
- z.F.EncMapIntfInt8V(yy337, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntfInt16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfInt16V(x.FMapIntfInt16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntfInt16`)
- r.WriteMapElemValue()
- if x.FMapIntfInt16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfInt16V(x.FMapIntfInt16, e)
- }
- }
- }
- var yyn342 bool
- if x.FptrMapIntfInt16 == nil {
- yyn342 = true
- goto LABEL342
- }
- LABEL342:
- if yyr2 || yy2arr2 {
- if yyn342 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntfInt16 == nil {
- r.EncodeNil()
- } else {
- yy343 := *x.FptrMapIntfInt16
- if false {
- } else {
- z.F.EncMapIntfInt16V(yy343, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfInt16`)
- r.WriteMapElemValue()
- if yyn342 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntfInt16 == nil {
- r.EncodeNil()
- } else {
- yy345 := *x.FptrMapIntfInt16
- if false {
- } else {
- z.F.EncMapIntfInt16V(yy345, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntfInt32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfInt32V(x.FMapIntfInt32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntfInt32`)
- r.WriteMapElemValue()
- if x.FMapIntfInt32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfInt32V(x.FMapIntfInt32, e)
- }
- }
- }
- var yyn350 bool
- if x.FptrMapIntfInt32 == nil {
- yyn350 = true
- goto LABEL350
- }
- LABEL350:
- if yyr2 || yy2arr2 {
- if yyn350 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntfInt32 == nil {
- r.EncodeNil()
- } else {
- yy351 := *x.FptrMapIntfInt32
- if false {
- } else {
- z.F.EncMapIntfInt32V(yy351, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfInt32`)
- r.WriteMapElemValue()
- if yyn350 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntfInt32 == nil {
- r.EncodeNil()
- } else {
- yy353 := *x.FptrMapIntfInt32
- if false {
- } else {
- z.F.EncMapIntfInt32V(yy353, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntfInt64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfInt64V(x.FMapIntfInt64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntfInt64`)
- r.WriteMapElemValue()
- if x.FMapIntfInt64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfInt64V(x.FMapIntfInt64, e)
- }
- }
- }
- var yyn358 bool
- if x.FptrMapIntfInt64 == nil {
- yyn358 = true
- goto LABEL358
- }
- LABEL358:
- if yyr2 || yy2arr2 {
- if yyn358 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntfInt64 == nil {
- r.EncodeNil()
- } else {
- yy359 := *x.FptrMapIntfInt64
- if false {
- } else {
- z.F.EncMapIntfInt64V(yy359, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfInt64`)
- r.WriteMapElemValue()
- if yyn358 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntfInt64 == nil {
- r.EncodeNil()
- } else {
- yy361 := *x.FptrMapIntfInt64
- if false {
- } else {
- z.F.EncMapIntfInt64V(yy361, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntfFloat32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfFloat32V(x.FMapIntfFloat32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntfFloat32`)
- r.WriteMapElemValue()
- if x.FMapIntfFloat32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfFloat32V(x.FMapIntfFloat32, e)
- }
- }
- }
- var yyn366 bool
- if x.FptrMapIntfFloat32 == nil {
- yyn366 = true
- goto LABEL366
- }
- LABEL366:
- if yyr2 || yy2arr2 {
- if yyn366 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntfFloat32 == nil {
- r.EncodeNil()
- } else {
- yy367 := *x.FptrMapIntfFloat32
- if false {
- } else {
- z.F.EncMapIntfFloat32V(yy367, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfFloat32`)
- r.WriteMapElemValue()
- if yyn366 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntfFloat32 == nil {
- r.EncodeNil()
- } else {
- yy369 := *x.FptrMapIntfFloat32
- if false {
- } else {
- z.F.EncMapIntfFloat32V(yy369, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntfFloat64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfFloat64V(x.FMapIntfFloat64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntfFloat64`)
- r.WriteMapElemValue()
- if x.FMapIntfFloat64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfFloat64V(x.FMapIntfFloat64, e)
- }
- }
- }
- var yyn374 bool
- if x.FptrMapIntfFloat64 == nil {
- yyn374 = true
- goto LABEL374
- }
- LABEL374:
- if yyr2 || yy2arr2 {
- if yyn374 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntfFloat64 == nil {
- r.EncodeNil()
- } else {
- yy375 := *x.FptrMapIntfFloat64
- if false {
- } else {
- z.F.EncMapIntfFloat64V(yy375, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfFloat64`)
- r.WriteMapElemValue()
- if yyn374 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntfFloat64 == nil {
- r.EncodeNil()
- } else {
- yy377 := *x.FptrMapIntfFloat64
- if false {
- } else {
- z.F.EncMapIntfFloat64V(yy377, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntfBool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfBoolV(x.FMapIntfBool, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntfBool`)
- r.WriteMapElemValue()
- if x.FMapIntfBool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntfBoolV(x.FMapIntfBool, e)
- }
- }
- }
- var yyn382 bool
- if x.FptrMapIntfBool == nil {
- yyn382 = true
- goto LABEL382
- }
- LABEL382:
- if yyr2 || yy2arr2 {
- if yyn382 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntfBool == nil {
- r.EncodeNil()
- } else {
- yy383 := *x.FptrMapIntfBool
- if false {
- } else {
- z.F.EncMapIntfBoolV(yy383, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfBool`)
- r.WriteMapElemValue()
- if yyn382 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntfBool == nil {
- r.EncodeNil()
- } else {
- yy385 := *x.FptrMapIntfBool
- if false {
- } else {
- z.F.EncMapIntfBoolV(yy385, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapStringIntf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringIntfV(x.FMapStringIntf, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapStringIntf`)
- r.WriteMapElemValue()
- if x.FMapStringIntf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringIntfV(x.FMapStringIntf, e)
- }
- }
- }
- var yyn390 bool
- if x.FptrMapStringIntf == nil {
- yyn390 = true
- goto LABEL390
- }
- LABEL390:
- if yyr2 || yy2arr2 {
- if yyn390 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapStringIntf == nil {
- r.EncodeNil()
- } else {
- yy391 := *x.FptrMapStringIntf
- if false {
- } else {
- z.F.EncMapStringIntfV(yy391, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapStringIntf`)
- r.WriteMapElemValue()
- if yyn390 {
- r.EncodeNil()
- } else {
- if x.FptrMapStringIntf == nil {
- r.EncodeNil()
- } else {
- yy393 := *x.FptrMapStringIntf
- if false {
- } else {
- z.F.EncMapStringIntfV(yy393, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapStringString == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringStringV(x.FMapStringString, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapStringString`)
- r.WriteMapElemValue()
- if x.FMapStringString == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringStringV(x.FMapStringString, e)
- }
- }
- }
- var yyn398 bool
- if x.FptrMapStringString == nil {
- yyn398 = true
- goto LABEL398
- }
- LABEL398:
- if yyr2 || yy2arr2 {
- if yyn398 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapStringString == nil {
- r.EncodeNil()
- } else {
- yy399 := *x.FptrMapStringString
- if false {
- } else {
- z.F.EncMapStringStringV(yy399, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapStringString`)
- r.WriteMapElemValue()
- if yyn398 {
- r.EncodeNil()
- } else {
- if x.FptrMapStringString == nil {
- r.EncodeNil()
- } else {
- yy401 := *x.FptrMapStringString
- if false {
- } else {
- z.F.EncMapStringStringV(yy401, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapStringUint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringUintV(x.FMapStringUint, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapStringUint`)
- r.WriteMapElemValue()
- if x.FMapStringUint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringUintV(x.FMapStringUint, e)
- }
- }
- }
- var yyn406 bool
- if x.FptrMapStringUint == nil {
- yyn406 = true
- goto LABEL406
- }
- LABEL406:
- if yyr2 || yy2arr2 {
- if yyn406 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapStringUint == nil {
- r.EncodeNil()
- } else {
- yy407 := *x.FptrMapStringUint
- if false {
- } else {
- z.F.EncMapStringUintV(yy407, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapStringUint`)
- r.WriteMapElemValue()
- if yyn406 {
- r.EncodeNil()
- } else {
- if x.FptrMapStringUint == nil {
- r.EncodeNil()
- } else {
- yy409 := *x.FptrMapStringUint
- if false {
- } else {
- z.F.EncMapStringUintV(yy409, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapStringUint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringUint8V(x.FMapStringUint8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapStringUint8`)
- r.WriteMapElemValue()
- if x.FMapStringUint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringUint8V(x.FMapStringUint8, e)
- }
- }
- }
- var yyn414 bool
- if x.FptrMapStringUint8 == nil {
- yyn414 = true
- goto LABEL414
- }
- LABEL414:
- if yyr2 || yy2arr2 {
- if yyn414 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapStringUint8 == nil {
- r.EncodeNil()
- } else {
- yy415 := *x.FptrMapStringUint8
- if false {
- } else {
- z.F.EncMapStringUint8V(yy415, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapStringUint8`)
- r.WriteMapElemValue()
- if yyn414 {
- r.EncodeNil()
- } else {
- if x.FptrMapStringUint8 == nil {
- r.EncodeNil()
- } else {
- yy417 := *x.FptrMapStringUint8
- if false {
- } else {
- z.F.EncMapStringUint8V(yy417, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapStringUint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringUint16V(x.FMapStringUint16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapStringUint16`)
- r.WriteMapElemValue()
- if x.FMapStringUint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringUint16V(x.FMapStringUint16, e)
- }
- }
- }
- var yyn422 bool
- if x.FptrMapStringUint16 == nil {
- yyn422 = true
- goto LABEL422
- }
- LABEL422:
- if yyr2 || yy2arr2 {
- if yyn422 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapStringUint16 == nil {
- r.EncodeNil()
- } else {
- yy423 := *x.FptrMapStringUint16
- if false {
- } else {
- z.F.EncMapStringUint16V(yy423, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapStringUint16`)
- r.WriteMapElemValue()
- if yyn422 {
- r.EncodeNil()
- } else {
- if x.FptrMapStringUint16 == nil {
- r.EncodeNil()
- } else {
- yy425 := *x.FptrMapStringUint16
- if false {
- } else {
- z.F.EncMapStringUint16V(yy425, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapStringUint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringUint32V(x.FMapStringUint32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapStringUint32`)
- r.WriteMapElemValue()
- if x.FMapStringUint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringUint32V(x.FMapStringUint32, e)
- }
- }
- }
- var yyn430 bool
- if x.FptrMapStringUint32 == nil {
- yyn430 = true
- goto LABEL430
- }
- LABEL430:
- if yyr2 || yy2arr2 {
- if yyn430 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapStringUint32 == nil {
- r.EncodeNil()
- } else {
- yy431 := *x.FptrMapStringUint32
- if false {
- } else {
- z.F.EncMapStringUint32V(yy431, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapStringUint32`)
- r.WriteMapElemValue()
- if yyn430 {
- r.EncodeNil()
- } else {
- if x.FptrMapStringUint32 == nil {
- r.EncodeNil()
- } else {
- yy433 := *x.FptrMapStringUint32
- if false {
- } else {
- z.F.EncMapStringUint32V(yy433, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapStringUint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringUint64V(x.FMapStringUint64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapStringUint64`)
- r.WriteMapElemValue()
- if x.FMapStringUint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringUint64V(x.FMapStringUint64, e)
- }
- }
- }
- var yyn438 bool
- if x.FptrMapStringUint64 == nil {
- yyn438 = true
- goto LABEL438
- }
- LABEL438:
- if yyr2 || yy2arr2 {
- if yyn438 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapStringUint64 == nil {
- r.EncodeNil()
- } else {
- yy439 := *x.FptrMapStringUint64
- if false {
- } else {
- z.F.EncMapStringUint64V(yy439, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapStringUint64`)
- r.WriteMapElemValue()
- if yyn438 {
- r.EncodeNil()
- } else {
- if x.FptrMapStringUint64 == nil {
- r.EncodeNil()
- } else {
- yy441 := *x.FptrMapStringUint64
- if false {
- } else {
- z.F.EncMapStringUint64V(yy441, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapStringUintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringUintptrV(x.FMapStringUintptr, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapStringUintptr`)
- r.WriteMapElemValue()
- if x.FMapStringUintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringUintptrV(x.FMapStringUintptr, e)
- }
- }
- }
- var yyn446 bool
- if x.FptrMapStringUintptr == nil {
- yyn446 = true
- goto LABEL446
- }
- LABEL446:
- if yyr2 || yy2arr2 {
- if yyn446 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapStringUintptr == nil {
- r.EncodeNil()
- } else {
- yy447 := *x.FptrMapStringUintptr
- if false {
- } else {
- z.F.EncMapStringUintptrV(yy447, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapStringUintptr`)
- r.WriteMapElemValue()
- if yyn446 {
- r.EncodeNil()
- } else {
- if x.FptrMapStringUintptr == nil {
- r.EncodeNil()
- } else {
- yy449 := *x.FptrMapStringUintptr
- if false {
- } else {
- z.F.EncMapStringUintptrV(yy449, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapStringInt == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringIntV(x.FMapStringInt, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapStringInt`)
- r.WriteMapElemValue()
- if x.FMapStringInt == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringIntV(x.FMapStringInt, e)
- }
- }
- }
- var yyn454 bool
- if x.FptrMapStringInt == nil {
- yyn454 = true
- goto LABEL454
- }
- LABEL454:
- if yyr2 || yy2arr2 {
- if yyn454 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapStringInt == nil {
- r.EncodeNil()
- } else {
- yy455 := *x.FptrMapStringInt
- if false {
- } else {
- z.F.EncMapStringIntV(yy455, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapStringInt`)
- r.WriteMapElemValue()
- if yyn454 {
- r.EncodeNil()
- } else {
- if x.FptrMapStringInt == nil {
- r.EncodeNil()
- } else {
- yy457 := *x.FptrMapStringInt
- if false {
- } else {
- z.F.EncMapStringIntV(yy457, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapStringInt8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringInt8V(x.FMapStringInt8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapStringInt8`)
- r.WriteMapElemValue()
- if x.FMapStringInt8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringInt8V(x.FMapStringInt8, e)
- }
- }
- }
- var yyn462 bool
- if x.FptrMapStringInt8 == nil {
- yyn462 = true
- goto LABEL462
- }
- LABEL462:
- if yyr2 || yy2arr2 {
- if yyn462 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapStringInt8 == nil {
- r.EncodeNil()
- } else {
- yy463 := *x.FptrMapStringInt8
- if false {
- } else {
- z.F.EncMapStringInt8V(yy463, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapStringInt8`)
- r.WriteMapElemValue()
- if yyn462 {
- r.EncodeNil()
- } else {
- if x.FptrMapStringInt8 == nil {
- r.EncodeNil()
- } else {
- yy465 := *x.FptrMapStringInt8
- if false {
- } else {
- z.F.EncMapStringInt8V(yy465, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapStringInt16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringInt16V(x.FMapStringInt16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapStringInt16`)
- r.WriteMapElemValue()
- if x.FMapStringInt16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringInt16V(x.FMapStringInt16, e)
- }
- }
- }
- var yyn470 bool
- if x.FptrMapStringInt16 == nil {
- yyn470 = true
- goto LABEL470
- }
- LABEL470:
- if yyr2 || yy2arr2 {
- if yyn470 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapStringInt16 == nil {
- r.EncodeNil()
- } else {
- yy471 := *x.FptrMapStringInt16
- if false {
- } else {
- z.F.EncMapStringInt16V(yy471, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapStringInt16`)
- r.WriteMapElemValue()
- if yyn470 {
- r.EncodeNil()
- } else {
- if x.FptrMapStringInt16 == nil {
- r.EncodeNil()
- } else {
- yy473 := *x.FptrMapStringInt16
- if false {
- } else {
- z.F.EncMapStringInt16V(yy473, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapStringInt32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringInt32V(x.FMapStringInt32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapStringInt32`)
- r.WriteMapElemValue()
- if x.FMapStringInt32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringInt32V(x.FMapStringInt32, e)
- }
- }
- }
- var yyn478 bool
- if x.FptrMapStringInt32 == nil {
- yyn478 = true
- goto LABEL478
- }
- LABEL478:
- if yyr2 || yy2arr2 {
- if yyn478 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapStringInt32 == nil {
- r.EncodeNil()
- } else {
- yy479 := *x.FptrMapStringInt32
- if false {
- } else {
- z.F.EncMapStringInt32V(yy479, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapStringInt32`)
- r.WriteMapElemValue()
- if yyn478 {
- r.EncodeNil()
- } else {
- if x.FptrMapStringInt32 == nil {
- r.EncodeNil()
- } else {
- yy481 := *x.FptrMapStringInt32
- if false {
- } else {
- z.F.EncMapStringInt32V(yy481, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapStringInt64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringInt64V(x.FMapStringInt64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapStringInt64`)
- r.WriteMapElemValue()
- if x.FMapStringInt64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringInt64V(x.FMapStringInt64, e)
- }
- }
- }
- var yyn486 bool
- if x.FptrMapStringInt64 == nil {
- yyn486 = true
- goto LABEL486
- }
- LABEL486:
- if yyr2 || yy2arr2 {
- if yyn486 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapStringInt64 == nil {
- r.EncodeNil()
- } else {
- yy487 := *x.FptrMapStringInt64
- if false {
- } else {
- z.F.EncMapStringInt64V(yy487, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapStringInt64`)
- r.WriteMapElemValue()
- if yyn486 {
- r.EncodeNil()
- } else {
- if x.FptrMapStringInt64 == nil {
- r.EncodeNil()
- } else {
- yy489 := *x.FptrMapStringInt64
- if false {
- } else {
- z.F.EncMapStringInt64V(yy489, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapStringFloat32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringFloat32V(x.FMapStringFloat32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapStringFloat32`)
- r.WriteMapElemValue()
- if x.FMapStringFloat32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringFloat32V(x.FMapStringFloat32, e)
- }
- }
- }
- var yyn494 bool
- if x.FptrMapStringFloat32 == nil {
- yyn494 = true
- goto LABEL494
- }
- LABEL494:
- if yyr2 || yy2arr2 {
- if yyn494 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapStringFloat32 == nil {
- r.EncodeNil()
- } else {
- yy495 := *x.FptrMapStringFloat32
- if false {
- } else {
- z.F.EncMapStringFloat32V(yy495, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapStringFloat32`)
- r.WriteMapElemValue()
- if yyn494 {
- r.EncodeNil()
- } else {
- if x.FptrMapStringFloat32 == nil {
- r.EncodeNil()
- } else {
- yy497 := *x.FptrMapStringFloat32
- if false {
- } else {
- z.F.EncMapStringFloat32V(yy497, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapStringFloat64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringFloat64V(x.FMapStringFloat64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapStringFloat64`)
- r.WriteMapElemValue()
- if x.FMapStringFloat64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringFloat64V(x.FMapStringFloat64, e)
- }
- }
- }
- var yyn502 bool
- if x.FptrMapStringFloat64 == nil {
- yyn502 = true
- goto LABEL502
- }
- LABEL502:
- if yyr2 || yy2arr2 {
- if yyn502 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapStringFloat64 == nil {
- r.EncodeNil()
- } else {
- yy503 := *x.FptrMapStringFloat64
- if false {
- } else {
- z.F.EncMapStringFloat64V(yy503, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapStringFloat64`)
- r.WriteMapElemValue()
- if yyn502 {
- r.EncodeNil()
- } else {
- if x.FptrMapStringFloat64 == nil {
- r.EncodeNil()
- } else {
- yy505 := *x.FptrMapStringFloat64
- if false {
- } else {
- z.F.EncMapStringFloat64V(yy505, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapStringBool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringBoolV(x.FMapStringBool, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapStringBool`)
- r.WriteMapElemValue()
- if x.FMapStringBool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapStringBoolV(x.FMapStringBool, e)
- }
- }
- }
- var yyn510 bool
- if x.FptrMapStringBool == nil {
- yyn510 = true
- goto LABEL510
- }
- LABEL510:
- if yyr2 || yy2arr2 {
- if yyn510 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapStringBool == nil {
- r.EncodeNil()
- } else {
- yy511 := *x.FptrMapStringBool
- if false {
- } else {
- z.F.EncMapStringBoolV(yy511, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapStringBool`)
- r.WriteMapElemValue()
- if yyn510 {
- r.EncodeNil()
- } else {
- if x.FptrMapStringBool == nil {
- r.EncodeNil()
- } else {
- yy513 := *x.FptrMapStringBool
- if false {
- } else {
- z.F.EncMapStringBoolV(yy513, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat32Intf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32IntfV(x.FMapFloat32Intf, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Intf`)
- r.WriteMapElemValue()
- if x.FMapFloat32Intf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32IntfV(x.FMapFloat32Intf, e)
- }
- }
- }
- var yyn518 bool
- if x.FptrMapFloat32Intf == nil {
- yyn518 = true
- goto LABEL518
- }
- LABEL518:
- if yyr2 || yy2arr2 {
- if yyn518 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat32Intf == nil {
- r.EncodeNil()
- } else {
- yy519 := *x.FptrMapFloat32Intf
- if false {
- } else {
- z.F.EncMapFloat32IntfV(yy519, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Intf`)
- r.WriteMapElemValue()
- if yyn518 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat32Intf == nil {
- r.EncodeNil()
- } else {
- yy521 := *x.FptrMapFloat32Intf
- if false {
- } else {
- z.F.EncMapFloat32IntfV(yy521, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat32String == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32StringV(x.FMapFloat32String, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat32String`)
- r.WriteMapElemValue()
- if x.FMapFloat32String == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32StringV(x.FMapFloat32String, e)
- }
- }
- }
- var yyn526 bool
- if x.FptrMapFloat32String == nil {
- yyn526 = true
- goto LABEL526
- }
- LABEL526:
- if yyr2 || yy2arr2 {
- if yyn526 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat32String == nil {
- r.EncodeNil()
- } else {
- yy527 := *x.FptrMapFloat32String
- if false {
- } else {
- z.F.EncMapFloat32StringV(yy527, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32String`)
- r.WriteMapElemValue()
- if yyn526 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat32String == nil {
- r.EncodeNil()
- } else {
- yy529 := *x.FptrMapFloat32String
- if false {
- } else {
- z.F.EncMapFloat32StringV(yy529, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat32Uint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32UintV(x.FMapFloat32Uint, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Uint`)
- r.WriteMapElemValue()
- if x.FMapFloat32Uint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32UintV(x.FMapFloat32Uint, e)
- }
- }
- }
- var yyn534 bool
- if x.FptrMapFloat32Uint == nil {
- yyn534 = true
- goto LABEL534
- }
- LABEL534:
- if yyr2 || yy2arr2 {
- if yyn534 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat32Uint == nil {
- r.EncodeNil()
- } else {
- yy535 := *x.FptrMapFloat32Uint
- if false {
- } else {
- z.F.EncMapFloat32UintV(yy535, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Uint`)
- r.WriteMapElemValue()
- if yyn534 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat32Uint == nil {
- r.EncodeNil()
- } else {
- yy537 := *x.FptrMapFloat32Uint
- if false {
- } else {
- z.F.EncMapFloat32UintV(yy537, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat32Uint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32Uint8V(x.FMapFloat32Uint8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Uint8`)
- r.WriteMapElemValue()
- if x.FMapFloat32Uint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32Uint8V(x.FMapFloat32Uint8, e)
- }
- }
- }
- var yyn542 bool
- if x.FptrMapFloat32Uint8 == nil {
- yyn542 = true
- goto LABEL542
- }
- LABEL542:
- if yyr2 || yy2arr2 {
- if yyn542 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat32Uint8 == nil {
- r.EncodeNil()
- } else {
- yy543 := *x.FptrMapFloat32Uint8
- if false {
- } else {
- z.F.EncMapFloat32Uint8V(yy543, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Uint8`)
- r.WriteMapElemValue()
- if yyn542 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat32Uint8 == nil {
- r.EncodeNil()
- } else {
- yy545 := *x.FptrMapFloat32Uint8
- if false {
- } else {
- z.F.EncMapFloat32Uint8V(yy545, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat32Uint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32Uint16V(x.FMapFloat32Uint16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Uint16`)
- r.WriteMapElemValue()
- if x.FMapFloat32Uint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32Uint16V(x.FMapFloat32Uint16, e)
- }
- }
- }
- var yyn550 bool
- if x.FptrMapFloat32Uint16 == nil {
- yyn550 = true
- goto LABEL550
- }
- LABEL550:
- if yyr2 || yy2arr2 {
- if yyn550 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat32Uint16 == nil {
- r.EncodeNil()
- } else {
- yy551 := *x.FptrMapFloat32Uint16
- if false {
- } else {
- z.F.EncMapFloat32Uint16V(yy551, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Uint16`)
- r.WriteMapElemValue()
- if yyn550 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat32Uint16 == nil {
- r.EncodeNil()
- } else {
- yy553 := *x.FptrMapFloat32Uint16
- if false {
- } else {
- z.F.EncMapFloat32Uint16V(yy553, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat32Uint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32Uint32V(x.FMapFloat32Uint32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Uint32`)
- r.WriteMapElemValue()
- if x.FMapFloat32Uint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32Uint32V(x.FMapFloat32Uint32, e)
- }
- }
- }
- var yyn558 bool
- if x.FptrMapFloat32Uint32 == nil {
- yyn558 = true
- goto LABEL558
- }
- LABEL558:
- if yyr2 || yy2arr2 {
- if yyn558 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat32Uint32 == nil {
- r.EncodeNil()
- } else {
- yy559 := *x.FptrMapFloat32Uint32
- if false {
- } else {
- z.F.EncMapFloat32Uint32V(yy559, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Uint32`)
- r.WriteMapElemValue()
- if yyn558 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat32Uint32 == nil {
- r.EncodeNil()
- } else {
- yy561 := *x.FptrMapFloat32Uint32
- if false {
- } else {
- z.F.EncMapFloat32Uint32V(yy561, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat32Uint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32Uint64V(x.FMapFloat32Uint64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Uint64`)
- r.WriteMapElemValue()
- if x.FMapFloat32Uint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32Uint64V(x.FMapFloat32Uint64, e)
- }
- }
- }
- var yyn566 bool
- if x.FptrMapFloat32Uint64 == nil {
- yyn566 = true
- goto LABEL566
- }
- LABEL566:
- if yyr2 || yy2arr2 {
- if yyn566 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat32Uint64 == nil {
- r.EncodeNil()
- } else {
- yy567 := *x.FptrMapFloat32Uint64
- if false {
- } else {
- z.F.EncMapFloat32Uint64V(yy567, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Uint64`)
- r.WriteMapElemValue()
- if yyn566 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat32Uint64 == nil {
- r.EncodeNil()
- } else {
- yy569 := *x.FptrMapFloat32Uint64
- if false {
- } else {
- z.F.EncMapFloat32Uint64V(yy569, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat32Uintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32UintptrV(x.FMapFloat32Uintptr, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Uintptr`)
- r.WriteMapElemValue()
- if x.FMapFloat32Uintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32UintptrV(x.FMapFloat32Uintptr, e)
- }
- }
- }
- var yyn574 bool
- if x.FptrMapFloat32Uintptr == nil {
- yyn574 = true
- goto LABEL574
- }
- LABEL574:
- if yyr2 || yy2arr2 {
- if yyn574 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat32Uintptr == nil {
- r.EncodeNil()
- } else {
- yy575 := *x.FptrMapFloat32Uintptr
- if false {
- } else {
- z.F.EncMapFloat32UintptrV(yy575, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Uintptr`)
- r.WriteMapElemValue()
- if yyn574 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat32Uintptr == nil {
- r.EncodeNil()
- } else {
- yy577 := *x.FptrMapFloat32Uintptr
- if false {
- } else {
- z.F.EncMapFloat32UintptrV(yy577, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat32Int == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32IntV(x.FMapFloat32Int, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Int`)
- r.WriteMapElemValue()
- if x.FMapFloat32Int == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32IntV(x.FMapFloat32Int, e)
- }
- }
- }
- var yyn582 bool
- if x.FptrMapFloat32Int == nil {
- yyn582 = true
- goto LABEL582
- }
- LABEL582:
- if yyr2 || yy2arr2 {
- if yyn582 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat32Int == nil {
- r.EncodeNil()
- } else {
- yy583 := *x.FptrMapFloat32Int
- if false {
- } else {
- z.F.EncMapFloat32IntV(yy583, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Int`)
- r.WriteMapElemValue()
- if yyn582 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat32Int == nil {
- r.EncodeNil()
- } else {
- yy585 := *x.FptrMapFloat32Int
- if false {
- } else {
- z.F.EncMapFloat32IntV(yy585, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat32Int8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32Int8V(x.FMapFloat32Int8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Int8`)
- r.WriteMapElemValue()
- if x.FMapFloat32Int8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32Int8V(x.FMapFloat32Int8, e)
- }
- }
- }
- var yyn590 bool
- if x.FptrMapFloat32Int8 == nil {
- yyn590 = true
- goto LABEL590
- }
- LABEL590:
- if yyr2 || yy2arr2 {
- if yyn590 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat32Int8 == nil {
- r.EncodeNil()
- } else {
- yy591 := *x.FptrMapFloat32Int8
- if false {
- } else {
- z.F.EncMapFloat32Int8V(yy591, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Int8`)
- r.WriteMapElemValue()
- if yyn590 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat32Int8 == nil {
- r.EncodeNil()
- } else {
- yy593 := *x.FptrMapFloat32Int8
- if false {
- } else {
- z.F.EncMapFloat32Int8V(yy593, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat32Int16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32Int16V(x.FMapFloat32Int16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Int16`)
- r.WriteMapElemValue()
- if x.FMapFloat32Int16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32Int16V(x.FMapFloat32Int16, e)
- }
- }
- }
- var yyn598 bool
- if x.FptrMapFloat32Int16 == nil {
- yyn598 = true
- goto LABEL598
- }
- LABEL598:
- if yyr2 || yy2arr2 {
- if yyn598 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat32Int16 == nil {
- r.EncodeNil()
- } else {
- yy599 := *x.FptrMapFloat32Int16
- if false {
- } else {
- z.F.EncMapFloat32Int16V(yy599, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Int16`)
- r.WriteMapElemValue()
- if yyn598 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat32Int16 == nil {
- r.EncodeNil()
- } else {
- yy601 := *x.FptrMapFloat32Int16
- if false {
- } else {
- z.F.EncMapFloat32Int16V(yy601, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat32Int32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32Int32V(x.FMapFloat32Int32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Int32`)
- r.WriteMapElemValue()
- if x.FMapFloat32Int32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32Int32V(x.FMapFloat32Int32, e)
- }
- }
- }
- var yyn606 bool
- if x.FptrMapFloat32Int32 == nil {
- yyn606 = true
- goto LABEL606
- }
- LABEL606:
- if yyr2 || yy2arr2 {
- if yyn606 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat32Int32 == nil {
- r.EncodeNil()
- } else {
- yy607 := *x.FptrMapFloat32Int32
- if false {
- } else {
- z.F.EncMapFloat32Int32V(yy607, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Int32`)
- r.WriteMapElemValue()
- if yyn606 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat32Int32 == nil {
- r.EncodeNil()
- } else {
- yy609 := *x.FptrMapFloat32Int32
- if false {
- } else {
- z.F.EncMapFloat32Int32V(yy609, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat32Int64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32Int64V(x.FMapFloat32Int64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Int64`)
- r.WriteMapElemValue()
- if x.FMapFloat32Int64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32Int64V(x.FMapFloat32Int64, e)
- }
- }
- }
- var yyn614 bool
- if x.FptrMapFloat32Int64 == nil {
- yyn614 = true
- goto LABEL614
- }
- LABEL614:
- if yyr2 || yy2arr2 {
- if yyn614 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat32Int64 == nil {
- r.EncodeNil()
- } else {
- yy615 := *x.FptrMapFloat32Int64
- if false {
- } else {
- z.F.EncMapFloat32Int64V(yy615, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Int64`)
- r.WriteMapElemValue()
- if yyn614 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat32Int64 == nil {
- r.EncodeNil()
- } else {
- yy617 := *x.FptrMapFloat32Int64
- if false {
- } else {
- z.F.EncMapFloat32Int64V(yy617, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat32Float32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32Float32V(x.FMapFloat32Float32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Float32`)
- r.WriteMapElemValue()
- if x.FMapFloat32Float32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32Float32V(x.FMapFloat32Float32, e)
- }
- }
- }
- var yyn622 bool
- if x.FptrMapFloat32Float32 == nil {
- yyn622 = true
- goto LABEL622
- }
- LABEL622:
- if yyr2 || yy2arr2 {
- if yyn622 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat32Float32 == nil {
- r.EncodeNil()
- } else {
- yy623 := *x.FptrMapFloat32Float32
- if false {
- } else {
- z.F.EncMapFloat32Float32V(yy623, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Float32`)
- r.WriteMapElemValue()
- if yyn622 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat32Float32 == nil {
- r.EncodeNil()
- } else {
- yy625 := *x.FptrMapFloat32Float32
- if false {
- } else {
- z.F.EncMapFloat32Float32V(yy625, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat32Float64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32Float64V(x.FMapFloat32Float64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Float64`)
- r.WriteMapElemValue()
- if x.FMapFloat32Float64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32Float64V(x.FMapFloat32Float64, e)
- }
- }
- }
- var yyn630 bool
- if x.FptrMapFloat32Float64 == nil {
- yyn630 = true
- goto LABEL630
- }
- LABEL630:
- if yyr2 || yy2arr2 {
- if yyn630 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat32Float64 == nil {
- r.EncodeNil()
- } else {
- yy631 := *x.FptrMapFloat32Float64
- if false {
- } else {
- z.F.EncMapFloat32Float64V(yy631, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Float64`)
- r.WriteMapElemValue()
- if yyn630 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat32Float64 == nil {
- r.EncodeNil()
- } else {
- yy633 := *x.FptrMapFloat32Float64
- if false {
- } else {
- z.F.EncMapFloat32Float64V(yy633, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat32Bool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32BoolV(x.FMapFloat32Bool, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Bool`)
- r.WriteMapElemValue()
- if x.FMapFloat32Bool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat32BoolV(x.FMapFloat32Bool, e)
- }
- }
- }
- var yyn638 bool
- if x.FptrMapFloat32Bool == nil {
- yyn638 = true
- goto LABEL638
- }
- LABEL638:
- if yyr2 || yy2arr2 {
- if yyn638 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat32Bool == nil {
- r.EncodeNil()
- } else {
- yy639 := *x.FptrMapFloat32Bool
- if false {
- } else {
- z.F.EncMapFloat32BoolV(yy639, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Bool`)
- r.WriteMapElemValue()
- if yyn638 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat32Bool == nil {
- r.EncodeNil()
- } else {
- yy641 := *x.FptrMapFloat32Bool
- if false {
- } else {
- z.F.EncMapFloat32BoolV(yy641, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat64Intf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64IntfV(x.FMapFloat64Intf, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Intf`)
- r.WriteMapElemValue()
- if x.FMapFloat64Intf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64IntfV(x.FMapFloat64Intf, e)
- }
- }
- }
- var yyn646 bool
- if x.FptrMapFloat64Intf == nil {
- yyn646 = true
- goto LABEL646
- }
- LABEL646:
- if yyr2 || yy2arr2 {
- if yyn646 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat64Intf == nil {
- r.EncodeNil()
- } else {
- yy647 := *x.FptrMapFloat64Intf
- if false {
- } else {
- z.F.EncMapFloat64IntfV(yy647, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Intf`)
- r.WriteMapElemValue()
- if yyn646 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat64Intf == nil {
- r.EncodeNil()
- } else {
- yy649 := *x.FptrMapFloat64Intf
- if false {
- } else {
- z.F.EncMapFloat64IntfV(yy649, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat64String == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64StringV(x.FMapFloat64String, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat64String`)
- r.WriteMapElemValue()
- if x.FMapFloat64String == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64StringV(x.FMapFloat64String, e)
- }
- }
- }
- var yyn654 bool
- if x.FptrMapFloat64String == nil {
- yyn654 = true
- goto LABEL654
- }
- LABEL654:
- if yyr2 || yy2arr2 {
- if yyn654 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat64String == nil {
- r.EncodeNil()
- } else {
- yy655 := *x.FptrMapFloat64String
- if false {
- } else {
- z.F.EncMapFloat64StringV(yy655, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64String`)
- r.WriteMapElemValue()
- if yyn654 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat64String == nil {
- r.EncodeNil()
- } else {
- yy657 := *x.FptrMapFloat64String
- if false {
- } else {
- z.F.EncMapFloat64StringV(yy657, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat64Uint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64UintV(x.FMapFloat64Uint, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Uint`)
- r.WriteMapElemValue()
- if x.FMapFloat64Uint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64UintV(x.FMapFloat64Uint, e)
- }
- }
- }
- var yyn662 bool
- if x.FptrMapFloat64Uint == nil {
- yyn662 = true
- goto LABEL662
- }
- LABEL662:
- if yyr2 || yy2arr2 {
- if yyn662 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat64Uint == nil {
- r.EncodeNil()
- } else {
- yy663 := *x.FptrMapFloat64Uint
- if false {
- } else {
- z.F.EncMapFloat64UintV(yy663, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Uint`)
- r.WriteMapElemValue()
- if yyn662 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat64Uint == nil {
- r.EncodeNil()
- } else {
- yy665 := *x.FptrMapFloat64Uint
- if false {
- } else {
- z.F.EncMapFloat64UintV(yy665, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat64Uint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64Uint8V(x.FMapFloat64Uint8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Uint8`)
- r.WriteMapElemValue()
- if x.FMapFloat64Uint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64Uint8V(x.FMapFloat64Uint8, e)
- }
- }
- }
- var yyn670 bool
- if x.FptrMapFloat64Uint8 == nil {
- yyn670 = true
- goto LABEL670
- }
- LABEL670:
- if yyr2 || yy2arr2 {
- if yyn670 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat64Uint8 == nil {
- r.EncodeNil()
- } else {
- yy671 := *x.FptrMapFloat64Uint8
- if false {
- } else {
- z.F.EncMapFloat64Uint8V(yy671, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Uint8`)
- r.WriteMapElemValue()
- if yyn670 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat64Uint8 == nil {
- r.EncodeNil()
- } else {
- yy673 := *x.FptrMapFloat64Uint8
- if false {
- } else {
- z.F.EncMapFloat64Uint8V(yy673, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat64Uint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64Uint16V(x.FMapFloat64Uint16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Uint16`)
- r.WriteMapElemValue()
- if x.FMapFloat64Uint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64Uint16V(x.FMapFloat64Uint16, e)
- }
- }
- }
- var yyn678 bool
- if x.FptrMapFloat64Uint16 == nil {
- yyn678 = true
- goto LABEL678
- }
- LABEL678:
- if yyr2 || yy2arr2 {
- if yyn678 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat64Uint16 == nil {
- r.EncodeNil()
- } else {
- yy679 := *x.FptrMapFloat64Uint16
- if false {
- } else {
- z.F.EncMapFloat64Uint16V(yy679, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Uint16`)
- r.WriteMapElemValue()
- if yyn678 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat64Uint16 == nil {
- r.EncodeNil()
- } else {
- yy681 := *x.FptrMapFloat64Uint16
- if false {
- } else {
- z.F.EncMapFloat64Uint16V(yy681, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat64Uint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64Uint32V(x.FMapFloat64Uint32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Uint32`)
- r.WriteMapElemValue()
- if x.FMapFloat64Uint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64Uint32V(x.FMapFloat64Uint32, e)
- }
- }
- }
- var yyn686 bool
- if x.FptrMapFloat64Uint32 == nil {
- yyn686 = true
- goto LABEL686
- }
- LABEL686:
- if yyr2 || yy2arr2 {
- if yyn686 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat64Uint32 == nil {
- r.EncodeNil()
- } else {
- yy687 := *x.FptrMapFloat64Uint32
- if false {
- } else {
- z.F.EncMapFloat64Uint32V(yy687, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Uint32`)
- r.WriteMapElemValue()
- if yyn686 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat64Uint32 == nil {
- r.EncodeNil()
- } else {
- yy689 := *x.FptrMapFloat64Uint32
- if false {
- } else {
- z.F.EncMapFloat64Uint32V(yy689, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat64Uint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64Uint64V(x.FMapFloat64Uint64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Uint64`)
- r.WriteMapElemValue()
- if x.FMapFloat64Uint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64Uint64V(x.FMapFloat64Uint64, e)
- }
- }
- }
- var yyn694 bool
- if x.FptrMapFloat64Uint64 == nil {
- yyn694 = true
- goto LABEL694
- }
- LABEL694:
- if yyr2 || yy2arr2 {
- if yyn694 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat64Uint64 == nil {
- r.EncodeNil()
- } else {
- yy695 := *x.FptrMapFloat64Uint64
- if false {
- } else {
- z.F.EncMapFloat64Uint64V(yy695, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Uint64`)
- r.WriteMapElemValue()
- if yyn694 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat64Uint64 == nil {
- r.EncodeNil()
- } else {
- yy697 := *x.FptrMapFloat64Uint64
- if false {
- } else {
- z.F.EncMapFloat64Uint64V(yy697, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat64Uintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64UintptrV(x.FMapFloat64Uintptr, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Uintptr`)
- r.WriteMapElemValue()
- if x.FMapFloat64Uintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64UintptrV(x.FMapFloat64Uintptr, e)
- }
- }
- }
- var yyn702 bool
- if x.FptrMapFloat64Uintptr == nil {
- yyn702 = true
- goto LABEL702
- }
- LABEL702:
- if yyr2 || yy2arr2 {
- if yyn702 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat64Uintptr == nil {
- r.EncodeNil()
- } else {
- yy703 := *x.FptrMapFloat64Uintptr
- if false {
- } else {
- z.F.EncMapFloat64UintptrV(yy703, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Uintptr`)
- r.WriteMapElemValue()
- if yyn702 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat64Uintptr == nil {
- r.EncodeNil()
- } else {
- yy705 := *x.FptrMapFloat64Uintptr
- if false {
- } else {
- z.F.EncMapFloat64UintptrV(yy705, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat64Int == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64IntV(x.FMapFloat64Int, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Int`)
- r.WriteMapElemValue()
- if x.FMapFloat64Int == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64IntV(x.FMapFloat64Int, e)
- }
- }
- }
- var yyn710 bool
- if x.FptrMapFloat64Int == nil {
- yyn710 = true
- goto LABEL710
- }
- LABEL710:
- if yyr2 || yy2arr2 {
- if yyn710 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat64Int == nil {
- r.EncodeNil()
- } else {
- yy711 := *x.FptrMapFloat64Int
- if false {
- } else {
- z.F.EncMapFloat64IntV(yy711, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Int`)
- r.WriteMapElemValue()
- if yyn710 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat64Int == nil {
- r.EncodeNil()
- } else {
- yy713 := *x.FptrMapFloat64Int
- if false {
- } else {
- z.F.EncMapFloat64IntV(yy713, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat64Int8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64Int8V(x.FMapFloat64Int8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Int8`)
- r.WriteMapElemValue()
- if x.FMapFloat64Int8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64Int8V(x.FMapFloat64Int8, e)
- }
- }
- }
- var yyn718 bool
- if x.FptrMapFloat64Int8 == nil {
- yyn718 = true
- goto LABEL718
- }
- LABEL718:
- if yyr2 || yy2arr2 {
- if yyn718 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat64Int8 == nil {
- r.EncodeNil()
- } else {
- yy719 := *x.FptrMapFloat64Int8
- if false {
- } else {
- z.F.EncMapFloat64Int8V(yy719, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Int8`)
- r.WriteMapElemValue()
- if yyn718 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat64Int8 == nil {
- r.EncodeNil()
- } else {
- yy721 := *x.FptrMapFloat64Int8
- if false {
- } else {
- z.F.EncMapFloat64Int8V(yy721, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat64Int16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64Int16V(x.FMapFloat64Int16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Int16`)
- r.WriteMapElemValue()
- if x.FMapFloat64Int16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64Int16V(x.FMapFloat64Int16, e)
- }
- }
- }
- var yyn726 bool
- if x.FptrMapFloat64Int16 == nil {
- yyn726 = true
- goto LABEL726
- }
- LABEL726:
- if yyr2 || yy2arr2 {
- if yyn726 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat64Int16 == nil {
- r.EncodeNil()
- } else {
- yy727 := *x.FptrMapFloat64Int16
- if false {
- } else {
- z.F.EncMapFloat64Int16V(yy727, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Int16`)
- r.WriteMapElemValue()
- if yyn726 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat64Int16 == nil {
- r.EncodeNil()
- } else {
- yy729 := *x.FptrMapFloat64Int16
- if false {
- } else {
- z.F.EncMapFloat64Int16V(yy729, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat64Int32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64Int32V(x.FMapFloat64Int32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Int32`)
- r.WriteMapElemValue()
- if x.FMapFloat64Int32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64Int32V(x.FMapFloat64Int32, e)
- }
- }
- }
- var yyn734 bool
- if x.FptrMapFloat64Int32 == nil {
- yyn734 = true
- goto LABEL734
- }
- LABEL734:
- if yyr2 || yy2arr2 {
- if yyn734 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat64Int32 == nil {
- r.EncodeNil()
- } else {
- yy735 := *x.FptrMapFloat64Int32
- if false {
- } else {
- z.F.EncMapFloat64Int32V(yy735, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Int32`)
- r.WriteMapElemValue()
- if yyn734 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat64Int32 == nil {
- r.EncodeNil()
- } else {
- yy737 := *x.FptrMapFloat64Int32
- if false {
- } else {
- z.F.EncMapFloat64Int32V(yy737, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat64Int64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64Int64V(x.FMapFloat64Int64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Int64`)
- r.WriteMapElemValue()
- if x.FMapFloat64Int64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64Int64V(x.FMapFloat64Int64, e)
- }
- }
- }
- var yyn742 bool
- if x.FptrMapFloat64Int64 == nil {
- yyn742 = true
- goto LABEL742
- }
- LABEL742:
- if yyr2 || yy2arr2 {
- if yyn742 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat64Int64 == nil {
- r.EncodeNil()
- } else {
- yy743 := *x.FptrMapFloat64Int64
- if false {
- } else {
- z.F.EncMapFloat64Int64V(yy743, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Int64`)
- r.WriteMapElemValue()
- if yyn742 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat64Int64 == nil {
- r.EncodeNil()
- } else {
- yy745 := *x.FptrMapFloat64Int64
- if false {
- } else {
- z.F.EncMapFloat64Int64V(yy745, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat64Float32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64Float32V(x.FMapFloat64Float32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Float32`)
- r.WriteMapElemValue()
- if x.FMapFloat64Float32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64Float32V(x.FMapFloat64Float32, e)
- }
- }
- }
- var yyn750 bool
- if x.FptrMapFloat64Float32 == nil {
- yyn750 = true
- goto LABEL750
- }
- LABEL750:
- if yyr2 || yy2arr2 {
- if yyn750 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat64Float32 == nil {
- r.EncodeNil()
- } else {
- yy751 := *x.FptrMapFloat64Float32
- if false {
- } else {
- z.F.EncMapFloat64Float32V(yy751, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Float32`)
- r.WriteMapElemValue()
- if yyn750 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat64Float32 == nil {
- r.EncodeNil()
- } else {
- yy753 := *x.FptrMapFloat64Float32
- if false {
- } else {
- z.F.EncMapFloat64Float32V(yy753, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat64Float64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64Float64V(x.FMapFloat64Float64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Float64`)
- r.WriteMapElemValue()
- if x.FMapFloat64Float64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64Float64V(x.FMapFloat64Float64, e)
- }
- }
- }
- var yyn758 bool
- if x.FptrMapFloat64Float64 == nil {
- yyn758 = true
- goto LABEL758
- }
- LABEL758:
- if yyr2 || yy2arr2 {
- if yyn758 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat64Float64 == nil {
- r.EncodeNil()
- } else {
- yy759 := *x.FptrMapFloat64Float64
- if false {
- } else {
- z.F.EncMapFloat64Float64V(yy759, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Float64`)
- r.WriteMapElemValue()
- if yyn758 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat64Float64 == nil {
- r.EncodeNil()
- } else {
- yy761 := *x.FptrMapFloat64Float64
- if false {
- } else {
- z.F.EncMapFloat64Float64V(yy761, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapFloat64Bool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64BoolV(x.FMapFloat64Bool, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Bool`)
- r.WriteMapElemValue()
- if x.FMapFloat64Bool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapFloat64BoolV(x.FMapFloat64Bool, e)
- }
- }
- }
- var yyn766 bool
- if x.FptrMapFloat64Bool == nil {
- yyn766 = true
- goto LABEL766
- }
- LABEL766:
- if yyr2 || yy2arr2 {
- if yyn766 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapFloat64Bool == nil {
- r.EncodeNil()
- } else {
- yy767 := *x.FptrMapFloat64Bool
- if false {
- } else {
- z.F.EncMapFloat64BoolV(yy767, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Bool`)
- r.WriteMapElemValue()
- if yyn766 {
- r.EncodeNil()
- } else {
- if x.FptrMapFloat64Bool == nil {
- r.EncodeNil()
- } else {
- yy769 := *x.FptrMapFloat64Bool
- if false {
- } else {
- z.F.EncMapFloat64BoolV(yy769, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintIntf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintIntfV(x.FMapUintIntf, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintIntf`)
- r.WriteMapElemValue()
- if x.FMapUintIntf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintIntfV(x.FMapUintIntf, e)
- }
- }
- }
- var yyn774 bool
- if x.FptrMapUintIntf == nil {
- yyn774 = true
- goto LABEL774
- }
- LABEL774:
- if yyr2 || yy2arr2 {
- if yyn774 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintIntf == nil {
- r.EncodeNil()
- } else {
- yy775 := *x.FptrMapUintIntf
- if false {
- } else {
- z.F.EncMapUintIntfV(yy775, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintIntf`)
- r.WriteMapElemValue()
- if yyn774 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintIntf == nil {
- r.EncodeNil()
- } else {
- yy777 := *x.FptrMapUintIntf
- if false {
- } else {
- z.F.EncMapUintIntfV(yy777, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintString == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintStringV(x.FMapUintString, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintString`)
- r.WriteMapElemValue()
- if x.FMapUintString == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintStringV(x.FMapUintString, e)
- }
- }
- }
- var yyn782 bool
- if x.FptrMapUintString == nil {
- yyn782 = true
- goto LABEL782
- }
- LABEL782:
- if yyr2 || yy2arr2 {
- if yyn782 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintString == nil {
- r.EncodeNil()
- } else {
- yy783 := *x.FptrMapUintString
- if false {
- } else {
- z.F.EncMapUintStringV(yy783, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintString`)
- r.WriteMapElemValue()
- if yyn782 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintString == nil {
- r.EncodeNil()
- } else {
- yy785 := *x.FptrMapUintString
- if false {
- } else {
- z.F.EncMapUintStringV(yy785, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintUint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintUintV(x.FMapUintUint, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintUint`)
- r.WriteMapElemValue()
- if x.FMapUintUint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintUintV(x.FMapUintUint, e)
- }
- }
- }
- var yyn790 bool
- if x.FptrMapUintUint == nil {
- yyn790 = true
- goto LABEL790
- }
- LABEL790:
- if yyr2 || yy2arr2 {
- if yyn790 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintUint == nil {
- r.EncodeNil()
- } else {
- yy791 := *x.FptrMapUintUint
- if false {
- } else {
- z.F.EncMapUintUintV(yy791, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintUint`)
- r.WriteMapElemValue()
- if yyn790 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintUint == nil {
- r.EncodeNil()
- } else {
- yy793 := *x.FptrMapUintUint
- if false {
- } else {
- z.F.EncMapUintUintV(yy793, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintUint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintUint8V(x.FMapUintUint8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintUint8`)
- r.WriteMapElemValue()
- if x.FMapUintUint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintUint8V(x.FMapUintUint8, e)
- }
- }
- }
- var yyn798 bool
- if x.FptrMapUintUint8 == nil {
- yyn798 = true
- goto LABEL798
- }
- LABEL798:
- if yyr2 || yy2arr2 {
- if yyn798 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintUint8 == nil {
- r.EncodeNil()
- } else {
- yy799 := *x.FptrMapUintUint8
- if false {
- } else {
- z.F.EncMapUintUint8V(yy799, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintUint8`)
- r.WriteMapElemValue()
- if yyn798 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintUint8 == nil {
- r.EncodeNil()
- } else {
- yy801 := *x.FptrMapUintUint8
- if false {
- } else {
- z.F.EncMapUintUint8V(yy801, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintUint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintUint16V(x.FMapUintUint16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintUint16`)
- r.WriteMapElemValue()
- if x.FMapUintUint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintUint16V(x.FMapUintUint16, e)
- }
- }
- }
- var yyn806 bool
- if x.FptrMapUintUint16 == nil {
- yyn806 = true
- goto LABEL806
- }
- LABEL806:
- if yyr2 || yy2arr2 {
- if yyn806 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintUint16 == nil {
- r.EncodeNil()
- } else {
- yy807 := *x.FptrMapUintUint16
- if false {
- } else {
- z.F.EncMapUintUint16V(yy807, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintUint16`)
- r.WriteMapElemValue()
- if yyn806 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintUint16 == nil {
- r.EncodeNil()
- } else {
- yy809 := *x.FptrMapUintUint16
- if false {
- } else {
- z.F.EncMapUintUint16V(yy809, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintUint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintUint32V(x.FMapUintUint32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintUint32`)
- r.WriteMapElemValue()
- if x.FMapUintUint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintUint32V(x.FMapUintUint32, e)
- }
- }
- }
- var yyn814 bool
- if x.FptrMapUintUint32 == nil {
- yyn814 = true
- goto LABEL814
- }
- LABEL814:
- if yyr2 || yy2arr2 {
- if yyn814 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintUint32 == nil {
- r.EncodeNil()
- } else {
- yy815 := *x.FptrMapUintUint32
- if false {
- } else {
- z.F.EncMapUintUint32V(yy815, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintUint32`)
- r.WriteMapElemValue()
- if yyn814 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintUint32 == nil {
- r.EncodeNil()
- } else {
- yy817 := *x.FptrMapUintUint32
- if false {
- } else {
- z.F.EncMapUintUint32V(yy817, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintUint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintUint64V(x.FMapUintUint64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintUint64`)
- r.WriteMapElemValue()
- if x.FMapUintUint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintUint64V(x.FMapUintUint64, e)
- }
- }
- }
- var yyn822 bool
- if x.FptrMapUintUint64 == nil {
- yyn822 = true
- goto LABEL822
- }
- LABEL822:
- if yyr2 || yy2arr2 {
- if yyn822 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintUint64 == nil {
- r.EncodeNil()
- } else {
- yy823 := *x.FptrMapUintUint64
- if false {
- } else {
- z.F.EncMapUintUint64V(yy823, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintUint64`)
- r.WriteMapElemValue()
- if yyn822 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintUint64 == nil {
- r.EncodeNil()
- } else {
- yy825 := *x.FptrMapUintUint64
- if false {
- } else {
- z.F.EncMapUintUint64V(yy825, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintUintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintUintptrV(x.FMapUintUintptr, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintUintptr`)
- r.WriteMapElemValue()
- if x.FMapUintUintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintUintptrV(x.FMapUintUintptr, e)
- }
- }
- }
- var yyn830 bool
- if x.FptrMapUintUintptr == nil {
- yyn830 = true
- goto LABEL830
- }
- LABEL830:
- if yyr2 || yy2arr2 {
- if yyn830 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintUintptr == nil {
- r.EncodeNil()
- } else {
- yy831 := *x.FptrMapUintUintptr
- if false {
- } else {
- z.F.EncMapUintUintptrV(yy831, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintUintptr`)
- r.WriteMapElemValue()
- if yyn830 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintUintptr == nil {
- r.EncodeNil()
- } else {
- yy833 := *x.FptrMapUintUintptr
- if false {
- } else {
- z.F.EncMapUintUintptrV(yy833, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintInt == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintIntV(x.FMapUintInt, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintInt`)
- r.WriteMapElemValue()
- if x.FMapUintInt == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintIntV(x.FMapUintInt, e)
- }
- }
- }
- var yyn838 bool
- if x.FptrMapUintInt == nil {
- yyn838 = true
- goto LABEL838
- }
- LABEL838:
- if yyr2 || yy2arr2 {
- if yyn838 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintInt == nil {
- r.EncodeNil()
- } else {
- yy839 := *x.FptrMapUintInt
- if false {
- } else {
- z.F.EncMapUintIntV(yy839, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintInt`)
- r.WriteMapElemValue()
- if yyn838 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintInt == nil {
- r.EncodeNil()
- } else {
- yy841 := *x.FptrMapUintInt
- if false {
- } else {
- z.F.EncMapUintIntV(yy841, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintInt8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintInt8V(x.FMapUintInt8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintInt8`)
- r.WriteMapElemValue()
- if x.FMapUintInt8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintInt8V(x.FMapUintInt8, e)
- }
- }
- }
- var yyn846 bool
- if x.FptrMapUintInt8 == nil {
- yyn846 = true
- goto LABEL846
- }
- LABEL846:
- if yyr2 || yy2arr2 {
- if yyn846 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintInt8 == nil {
- r.EncodeNil()
- } else {
- yy847 := *x.FptrMapUintInt8
- if false {
- } else {
- z.F.EncMapUintInt8V(yy847, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintInt8`)
- r.WriteMapElemValue()
- if yyn846 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintInt8 == nil {
- r.EncodeNil()
- } else {
- yy849 := *x.FptrMapUintInt8
- if false {
- } else {
- z.F.EncMapUintInt8V(yy849, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintInt16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintInt16V(x.FMapUintInt16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintInt16`)
- r.WriteMapElemValue()
- if x.FMapUintInt16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintInt16V(x.FMapUintInt16, e)
- }
- }
- }
- var yyn854 bool
- if x.FptrMapUintInt16 == nil {
- yyn854 = true
- goto LABEL854
- }
- LABEL854:
- if yyr2 || yy2arr2 {
- if yyn854 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintInt16 == nil {
- r.EncodeNil()
- } else {
- yy855 := *x.FptrMapUintInt16
- if false {
- } else {
- z.F.EncMapUintInt16V(yy855, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintInt16`)
- r.WriteMapElemValue()
- if yyn854 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintInt16 == nil {
- r.EncodeNil()
- } else {
- yy857 := *x.FptrMapUintInt16
- if false {
- } else {
- z.F.EncMapUintInt16V(yy857, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintInt32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintInt32V(x.FMapUintInt32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintInt32`)
- r.WriteMapElemValue()
- if x.FMapUintInt32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintInt32V(x.FMapUintInt32, e)
- }
- }
- }
- var yyn862 bool
- if x.FptrMapUintInt32 == nil {
- yyn862 = true
- goto LABEL862
- }
- LABEL862:
- if yyr2 || yy2arr2 {
- if yyn862 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintInt32 == nil {
- r.EncodeNil()
- } else {
- yy863 := *x.FptrMapUintInt32
- if false {
- } else {
- z.F.EncMapUintInt32V(yy863, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintInt32`)
- r.WriteMapElemValue()
- if yyn862 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintInt32 == nil {
- r.EncodeNil()
- } else {
- yy865 := *x.FptrMapUintInt32
- if false {
- } else {
- z.F.EncMapUintInt32V(yy865, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintInt64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintInt64V(x.FMapUintInt64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintInt64`)
- r.WriteMapElemValue()
- if x.FMapUintInt64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintInt64V(x.FMapUintInt64, e)
- }
- }
- }
- var yyn870 bool
- if x.FptrMapUintInt64 == nil {
- yyn870 = true
- goto LABEL870
- }
- LABEL870:
- if yyr2 || yy2arr2 {
- if yyn870 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintInt64 == nil {
- r.EncodeNil()
- } else {
- yy871 := *x.FptrMapUintInt64
- if false {
- } else {
- z.F.EncMapUintInt64V(yy871, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintInt64`)
- r.WriteMapElemValue()
- if yyn870 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintInt64 == nil {
- r.EncodeNil()
- } else {
- yy873 := *x.FptrMapUintInt64
- if false {
- } else {
- z.F.EncMapUintInt64V(yy873, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintFloat32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintFloat32V(x.FMapUintFloat32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintFloat32`)
- r.WriteMapElemValue()
- if x.FMapUintFloat32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintFloat32V(x.FMapUintFloat32, e)
- }
- }
- }
- var yyn878 bool
- if x.FptrMapUintFloat32 == nil {
- yyn878 = true
- goto LABEL878
- }
- LABEL878:
- if yyr2 || yy2arr2 {
- if yyn878 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintFloat32 == nil {
- r.EncodeNil()
- } else {
- yy879 := *x.FptrMapUintFloat32
- if false {
- } else {
- z.F.EncMapUintFloat32V(yy879, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintFloat32`)
- r.WriteMapElemValue()
- if yyn878 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintFloat32 == nil {
- r.EncodeNil()
- } else {
- yy881 := *x.FptrMapUintFloat32
- if false {
- } else {
- z.F.EncMapUintFloat32V(yy881, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintFloat64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintFloat64V(x.FMapUintFloat64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintFloat64`)
- r.WriteMapElemValue()
- if x.FMapUintFloat64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintFloat64V(x.FMapUintFloat64, e)
- }
- }
- }
- var yyn886 bool
- if x.FptrMapUintFloat64 == nil {
- yyn886 = true
- goto LABEL886
- }
- LABEL886:
- if yyr2 || yy2arr2 {
- if yyn886 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintFloat64 == nil {
- r.EncodeNil()
- } else {
- yy887 := *x.FptrMapUintFloat64
- if false {
- } else {
- z.F.EncMapUintFloat64V(yy887, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintFloat64`)
- r.WriteMapElemValue()
- if yyn886 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintFloat64 == nil {
- r.EncodeNil()
- } else {
- yy889 := *x.FptrMapUintFloat64
- if false {
- } else {
- z.F.EncMapUintFloat64V(yy889, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintBool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintBoolV(x.FMapUintBool, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintBool`)
- r.WriteMapElemValue()
- if x.FMapUintBool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintBoolV(x.FMapUintBool, e)
- }
- }
- }
- var yyn894 bool
- if x.FptrMapUintBool == nil {
- yyn894 = true
- goto LABEL894
- }
- LABEL894:
- if yyr2 || yy2arr2 {
- if yyn894 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintBool == nil {
- r.EncodeNil()
- } else {
- yy895 := *x.FptrMapUintBool
- if false {
- } else {
- z.F.EncMapUintBoolV(yy895, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintBool`)
- r.WriteMapElemValue()
- if yyn894 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintBool == nil {
- r.EncodeNil()
- } else {
- yy897 := *x.FptrMapUintBool
- if false {
- } else {
- z.F.EncMapUintBoolV(yy897, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint8Intf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8IntfV(x.FMapUint8Intf, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint8Intf`)
- r.WriteMapElemValue()
- if x.FMapUint8Intf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8IntfV(x.FMapUint8Intf, e)
- }
- }
- }
- var yyn902 bool
- if x.FptrMapUint8Intf == nil {
- yyn902 = true
- goto LABEL902
- }
- LABEL902:
- if yyr2 || yy2arr2 {
- if yyn902 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint8Intf == nil {
- r.EncodeNil()
- } else {
- yy903 := *x.FptrMapUint8Intf
- if false {
- } else {
- z.F.EncMapUint8IntfV(yy903, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Intf`)
- r.WriteMapElemValue()
- if yyn902 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint8Intf == nil {
- r.EncodeNil()
- } else {
- yy905 := *x.FptrMapUint8Intf
- if false {
- } else {
- z.F.EncMapUint8IntfV(yy905, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint8String == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8StringV(x.FMapUint8String, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint8String`)
- r.WriteMapElemValue()
- if x.FMapUint8String == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8StringV(x.FMapUint8String, e)
- }
- }
- }
- var yyn910 bool
- if x.FptrMapUint8String == nil {
- yyn910 = true
- goto LABEL910
- }
- LABEL910:
- if yyr2 || yy2arr2 {
- if yyn910 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint8String == nil {
- r.EncodeNil()
- } else {
- yy911 := *x.FptrMapUint8String
- if false {
- } else {
- z.F.EncMapUint8StringV(yy911, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8String`)
- r.WriteMapElemValue()
- if yyn910 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint8String == nil {
- r.EncodeNil()
- } else {
- yy913 := *x.FptrMapUint8String
- if false {
- } else {
- z.F.EncMapUint8StringV(yy913, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint8Uint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8UintV(x.FMapUint8Uint, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint8Uint`)
- r.WriteMapElemValue()
- if x.FMapUint8Uint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8UintV(x.FMapUint8Uint, e)
- }
- }
- }
- var yyn918 bool
- if x.FptrMapUint8Uint == nil {
- yyn918 = true
- goto LABEL918
- }
- LABEL918:
- if yyr2 || yy2arr2 {
- if yyn918 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint8Uint == nil {
- r.EncodeNil()
- } else {
- yy919 := *x.FptrMapUint8Uint
- if false {
- } else {
- z.F.EncMapUint8UintV(yy919, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Uint`)
- r.WriteMapElemValue()
- if yyn918 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint8Uint == nil {
- r.EncodeNil()
- } else {
- yy921 := *x.FptrMapUint8Uint
- if false {
- } else {
- z.F.EncMapUint8UintV(yy921, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint8Uint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8Uint8V(x.FMapUint8Uint8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint8Uint8`)
- r.WriteMapElemValue()
- if x.FMapUint8Uint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8Uint8V(x.FMapUint8Uint8, e)
- }
- }
- }
- var yyn926 bool
- if x.FptrMapUint8Uint8 == nil {
- yyn926 = true
- goto LABEL926
- }
- LABEL926:
- if yyr2 || yy2arr2 {
- if yyn926 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint8Uint8 == nil {
- r.EncodeNil()
- } else {
- yy927 := *x.FptrMapUint8Uint8
- if false {
- } else {
- z.F.EncMapUint8Uint8V(yy927, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Uint8`)
- r.WriteMapElemValue()
- if yyn926 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint8Uint8 == nil {
- r.EncodeNil()
- } else {
- yy929 := *x.FptrMapUint8Uint8
- if false {
- } else {
- z.F.EncMapUint8Uint8V(yy929, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint8Uint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8Uint16V(x.FMapUint8Uint16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint8Uint16`)
- r.WriteMapElemValue()
- if x.FMapUint8Uint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8Uint16V(x.FMapUint8Uint16, e)
- }
- }
- }
- var yyn934 bool
- if x.FptrMapUint8Uint16 == nil {
- yyn934 = true
- goto LABEL934
- }
- LABEL934:
- if yyr2 || yy2arr2 {
- if yyn934 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint8Uint16 == nil {
- r.EncodeNil()
- } else {
- yy935 := *x.FptrMapUint8Uint16
- if false {
- } else {
- z.F.EncMapUint8Uint16V(yy935, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Uint16`)
- r.WriteMapElemValue()
- if yyn934 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint8Uint16 == nil {
- r.EncodeNil()
- } else {
- yy937 := *x.FptrMapUint8Uint16
- if false {
- } else {
- z.F.EncMapUint8Uint16V(yy937, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint8Uint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8Uint32V(x.FMapUint8Uint32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint8Uint32`)
- r.WriteMapElemValue()
- if x.FMapUint8Uint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8Uint32V(x.FMapUint8Uint32, e)
- }
- }
- }
- var yyn942 bool
- if x.FptrMapUint8Uint32 == nil {
- yyn942 = true
- goto LABEL942
- }
- LABEL942:
- if yyr2 || yy2arr2 {
- if yyn942 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint8Uint32 == nil {
- r.EncodeNil()
- } else {
- yy943 := *x.FptrMapUint8Uint32
- if false {
- } else {
- z.F.EncMapUint8Uint32V(yy943, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Uint32`)
- r.WriteMapElemValue()
- if yyn942 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint8Uint32 == nil {
- r.EncodeNil()
- } else {
- yy945 := *x.FptrMapUint8Uint32
- if false {
- } else {
- z.F.EncMapUint8Uint32V(yy945, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint8Uint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8Uint64V(x.FMapUint8Uint64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint8Uint64`)
- r.WriteMapElemValue()
- if x.FMapUint8Uint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8Uint64V(x.FMapUint8Uint64, e)
- }
- }
- }
- var yyn950 bool
- if x.FptrMapUint8Uint64 == nil {
- yyn950 = true
- goto LABEL950
- }
- LABEL950:
- if yyr2 || yy2arr2 {
- if yyn950 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint8Uint64 == nil {
- r.EncodeNil()
- } else {
- yy951 := *x.FptrMapUint8Uint64
- if false {
- } else {
- z.F.EncMapUint8Uint64V(yy951, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Uint64`)
- r.WriteMapElemValue()
- if yyn950 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint8Uint64 == nil {
- r.EncodeNil()
- } else {
- yy953 := *x.FptrMapUint8Uint64
- if false {
- } else {
- z.F.EncMapUint8Uint64V(yy953, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint8Uintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8UintptrV(x.FMapUint8Uintptr, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint8Uintptr`)
- r.WriteMapElemValue()
- if x.FMapUint8Uintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8UintptrV(x.FMapUint8Uintptr, e)
- }
- }
- }
- var yyn958 bool
- if x.FptrMapUint8Uintptr == nil {
- yyn958 = true
- goto LABEL958
- }
- LABEL958:
- if yyr2 || yy2arr2 {
- if yyn958 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint8Uintptr == nil {
- r.EncodeNil()
- } else {
- yy959 := *x.FptrMapUint8Uintptr
- if false {
- } else {
- z.F.EncMapUint8UintptrV(yy959, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Uintptr`)
- r.WriteMapElemValue()
- if yyn958 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint8Uintptr == nil {
- r.EncodeNil()
- } else {
- yy961 := *x.FptrMapUint8Uintptr
- if false {
- } else {
- z.F.EncMapUint8UintptrV(yy961, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint8Int == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8IntV(x.FMapUint8Int, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint8Int`)
- r.WriteMapElemValue()
- if x.FMapUint8Int == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8IntV(x.FMapUint8Int, e)
- }
- }
- }
- var yyn966 bool
- if x.FptrMapUint8Int == nil {
- yyn966 = true
- goto LABEL966
- }
- LABEL966:
- if yyr2 || yy2arr2 {
- if yyn966 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint8Int == nil {
- r.EncodeNil()
- } else {
- yy967 := *x.FptrMapUint8Int
- if false {
- } else {
- z.F.EncMapUint8IntV(yy967, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Int`)
- r.WriteMapElemValue()
- if yyn966 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint8Int == nil {
- r.EncodeNil()
- } else {
- yy969 := *x.FptrMapUint8Int
- if false {
- } else {
- z.F.EncMapUint8IntV(yy969, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint8Int8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8Int8V(x.FMapUint8Int8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint8Int8`)
- r.WriteMapElemValue()
- if x.FMapUint8Int8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8Int8V(x.FMapUint8Int8, e)
- }
- }
- }
- var yyn974 bool
- if x.FptrMapUint8Int8 == nil {
- yyn974 = true
- goto LABEL974
- }
- LABEL974:
- if yyr2 || yy2arr2 {
- if yyn974 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint8Int8 == nil {
- r.EncodeNil()
- } else {
- yy975 := *x.FptrMapUint8Int8
- if false {
- } else {
- z.F.EncMapUint8Int8V(yy975, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Int8`)
- r.WriteMapElemValue()
- if yyn974 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint8Int8 == nil {
- r.EncodeNil()
- } else {
- yy977 := *x.FptrMapUint8Int8
- if false {
- } else {
- z.F.EncMapUint8Int8V(yy977, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint8Int16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8Int16V(x.FMapUint8Int16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint8Int16`)
- r.WriteMapElemValue()
- if x.FMapUint8Int16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8Int16V(x.FMapUint8Int16, e)
- }
- }
- }
- var yyn982 bool
- if x.FptrMapUint8Int16 == nil {
- yyn982 = true
- goto LABEL982
- }
- LABEL982:
- if yyr2 || yy2arr2 {
- if yyn982 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint8Int16 == nil {
- r.EncodeNil()
- } else {
- yy983 := *x.FptrMapUint8Int16
- if false {
- } else {
- z.F.EncMapUint8Int16V(yy983, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Int16`)
- r.WriteMapElemValue()
- if yyn982 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint8Int16 == nil {
- r.EncodeNil()
- } else {
- yy985 := *x.FptrMapUint8Int16
- if false {
- } else {
- z.F.EncMapUint8Int16V(yy985, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint8Int32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8Int32V(x.FMapUint8Int32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint8Int32`)
- r.WriteMapElemValue()
- if x.FMapUint8Int32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8Int32V(x.FMapUint8Int32, e)
- }
- }
- }
- var yyn990 bool
- if x.FptrMapUint8Int32 == nil {
- yyn990 = true
- goto LABEL990
- }
- LABEL990:
- if yyr2 || yy2arr2 {
- if yyn990 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint8Int32 == nil {
- r.EncodeNil()
- } else {
- yy991 := *x.FptrMapUint8Int32
- if false {
- } else {
- z.F.EncMapUint8Int32V(yy991, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Int32`)
- r.WriteMapElemValue()
- if yyn990 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint8Int32 == nil {
- r.EncodeNil()
- } else {
- yy993 := *x.FptrMapUint8Int32
- if false {
- } else {
- z.F.EncMapUint8Int32V(yy993, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint8Int64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8Int64V(x.FMapUint8Int64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint8Int64`)
- r.WriteMapElemValue()
- if x.FMapUint8Int64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8Int64V(x.FMapUint8Int64, e)
- }
- }
- }
- var yyn998 bool
- if x.FptrMapUint8Int64 == nil {
- yyn998 = true
- goto LABEL998
- }
- LABEL998:
- if yyr2 || yy2arr2 {
- if yyn998 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint8Int64 == nil {
- r.EncodeNil()
- } else {
- yy999 := *x.FptrMapUint8Int64
- if false {
- } else {
- z.F.EncMapUint8Int64V(yy999, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Int64`)
- r.WriteMapElemValue()
- if yyn998 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint8Int64 == nil {
- r.EncodeNil()
- } else {
- yy1001 := *x.FptrMapUint8Int64
- if false {
- } else {
- z.F.EncMapUint8Int64V(yy1001, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint8Float32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8Float32V(x.FMapUint8Float32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint8Float32`)
- r.WriteMapElemValue()
- if x.FMapUint8Float32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8Float32V(x.FMapUint8Float32, e)
- }
- }
- }
- var yyn1006 bool
- if x.FptrMapUint8Float32 == nil {
- yyn1006 = true
- goto LABEL1006
- }
- LABEL1006:
- if yyr2 || yy2arr2 {
- if yyn1006 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint8Float32 == nil {
- r.EncodeNil()
- } else {
- yy1007 := *x.FptrMapUint8Float32
- if false {
- } else {
- z.F.EncMapUint8Float32V(yy1007, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Float32`)
- r.WriteMapElemValue()
- if yyn1006 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint8Float32 == nil {
- r.EncodeNil()
- } else {
- yy1009 := *x.FptrMapUint8Float32
- if false {
- } else {
- z.F.EncMapUint8Float32V(yy1009, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint8Float64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8Float64V(x.FMapUint8Float64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint8Float64`)
- r.WriteMapElemValue()
- if x.FMapUint8Float64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8Float64V(x.FMapUint8Float64, e)
- }
- }
- }
- var yyn1014 bool
- if x.FptrMapUint8Float64 == nil {
- yyn1014 = true
- goto LABEL1014
- }
- LABEL1014:
- if yyr2 || yy2arr2 {
- if yyn1014 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint8Float64 == nil {
- r.EncodeNil()
- } else {
- yy1015 := *x.FptrMapUint8Float64
- if false {
- } else {
- z.F.EncMapUint8Float64V(yy1015, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Float64`)
- r.WriteMapElemValue()
- if yyn1014 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint8Float64 == nil {
- r.EncodeNil()
- } else {
- yy1017 := *x.FptrMapUint8Float64
- if false {
- } else {
- z.F.EncMapUint8Float64V(yy1017, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint8Bool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8BoolV(x.FMapUint8Bool, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint8Bool`)
- r.WriteMapElemValue()
- if x.FMapUint8Bool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint8BoolV(x.FMapUint8Bool, e)
- }
- }
- }
- var yyn1022 bool
- if x.FptrMapUint8Bool == nil {
- yyn1022 = true
- goto LABEL1022
- }
- LABEL1022:
- if yyr2 || yy2arr2 {
- if yyn1022 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint8Bool == nil {
- r.EncodeNil()
- } else {
- yy1023 := *x.FptrMapUint8Bool
- if false {
- } else {
- z.F.EncMapUint8BoolV(yy1023, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Bool`)
- r.WriteMapElemValue()
- if yyn1022 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint8Bool == nil {
- r.EncodeNil()
- } else {
- yy1025 := *x.FptrMapUint8Bool
- if false {
- } else {
- z.F.EncMapUint8BoolV(yy1025, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint16Intf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16IntfV(x.FMapUint16Intf, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint16Intf`)
- r.WriteMapElemValue()
- if x.FMapUint16Intf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16IntfV(x.FMapUint16Intf, e)
- }
- }
- }
- var yyn1030 bool
- if x.FptrMapUint16Intf == nil {
- yyn1030 = true
- goto LABEL1030
- }
- LABEL1030:
- if yyr2 || yy2arr2 {
- if yyn1030 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint16Intf == nil {
- r.EncodeNil()
- } else {
- yy1031 := *x.FptrMapUint16Intf
- if false {
- } else {
- z.F.EncMapUint16IntfV(yy1031, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Intf`)
- r.WriteMapElemValue()
- if yyn1030 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint16Intf == nil {
- r.EncodeNil()
- } else {
- yy1033 := *x.FptrMapUint16Intf
- if false {
- } else {
- z.F.EncMapUint16IntfV(yy1033, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint16String == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16StringV(x.FMapUint16String, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint16String`)
- r.WriteMapElemValue()
- if x.FMapUint16String == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16StringV(x.FMapUint16String, e)
- }
- }
- }
- var yyn1038 bool
- if x.FptrMapUint16String == nil {
- yyn1038 = true
- goto LABEL1038
- }
- LABEL1038:
- if yyr2 || yy2arr2 {
- if yyn1038 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint16String == nil {
- r.EncodeNil()
- } else {
- yy1039 := *x.FptrMapUint16String
- if false {
- } else {
- z.F.EncMapUint16StringV(yy1039, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16String`)
- r.WriteMapElemValue()
- if yyn1038 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint16String == nil {
- r.EncodeNil()
- } else {
- yy1041 := *x.FptrMapUint16String
- if false {
- } else {
- z.F.EncMapUint16StringV(yy1041, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint16Uint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16UintV(x.FMapUint16Uint, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint16Uint`)
- r.WriteMapElemValue()
- if x.FMapUint16Uint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16UintV(x.FMapUint16Uint, e)
- }
- }
- }
- var yyn1046 bool
- if x.FptrMapUint16Uint == nil {
- yyn1046 = true
- goto LABEL1046
- }
- LABEL1046:
- if yyr2 || yy2arr2 {
- if yyn1046 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint16Uint == nil {
- r.EncodeNil()
- } else {
- yy1047 := *x.FptrMapUint16Uint
- if false {
- } else {
- z.F.EncMapUint16UintV(yy1047, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Uint`)
- r.WriteMapElemValue()
- if yyn1046 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint16Uint == nil {
- r.EncodeNil()
- } else {
- yy1049 := *x.FptrMapUint16Uint
- if false {
- } else {
- z.F.EncMapUint16UintV(yy1049, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint16Uint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16Uint8V(x.FMapUint16Uint8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint16Uint8`)
- r.WriteMapElemValue()
- if x.FMapUint16Uint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16Uint8V(x.FMapUint16Uint8, e)
- }
- }
- }
- var yyn1054 bool
- if x.FptrMapUint16Uint8 == nil {
- yyn1054 = true
- goto LABEL1054
- }
- LABEL1054:
- if yyr2 || yy2arr2 {
- if yyn1054 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint16Uint8 == nil {
- r.EncodeNil()
- } else {
- yy1055 := *x.FptrMapUint16Uint8
- if false {
- } else {
- z.F.EncMapUint16Uint8V(yy1055, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Uint8`)
- r.WriteMapElemValue()
- if yyn1054 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint16Uint8 == nil {
- r.EncodeNil()
- } else {
- yy1057 := *x.FptrMapUint16Uint8
- if false {
- } else {
- z.F.EncMapUint16Uint8V(yy1057, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint16Uint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16Uint16V(x.FMapUint16Uint16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint16Uint16`)
- r.WriteMapElemValue()
- if x.FMapUint16Uint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16Uint16V(x.FMapUint16Uint16, e)
- }
- }
- }
- var yyn1062 bool
- if x.FptrMapUint16Uint16 == nil {
- yyn1062 = true
- goto LABEL1062
- }
- LABEL1062:
- if yyr2 || yy2arr2 {
- if yyn1062 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint16Uint16 == nil {
- r.EncodeNil()
- } else {
- yy1063 := *x.FptrMapUint16Uint16
- if false {
- } else {
- z.F.EncMapUint16Uint16V(yy1063, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Uint16`)
- r.WriteMapElemValue()
- if yyn1062 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint16Uint16 == nil {
- r.EncodeNil()
- } else {
- yy1065 := *x.FptrMapUint16Uint16
- if false {
- } else {
- z.F.EncMapUint16Uint16V(yy1065, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint16Uint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16Uint32V(x.FMapUint16Uint32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint16Uint32`)
- r.WriteMapElemValue()
- if x.FMapUint16Uint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16Uint32V(x.FMapUint16Uint32, e)
- }
- }
- }
- var yyn1070 bool
- if x.FptrMapUint16Uint32 == nil {
- yyn1070 = true
- goto LABEL1070
- }
- LABEL1070:
- if yyr2 || yy2arr2 {
- if yyn1070 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint16Uint32 == nil {
- r.EncodeNil()
- } else {
- yy1071 := *x.FptrMapUint16Uint32
- if false {
- } else {
- z.F.EncMapUint16Uint32V(yy1071, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Uint32`)
- r.WriteMapElemValue()
- if yyn1070 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint16Uint32 == nil {
- r.EncodeNil()
- } else {
- yy1073 := *x.FptrMapUint16Uint32
- if false {
- } else {
- z.F.EncMapUint16Uint32V(yy1073, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint16Uint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16Uint64V(x.FMapUint16Uint64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint16Uint64`)
- r.WriteMapElemValue()
- if x.FMapUint16Uint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16Uint64V(x.FMapUint16Uint64, e)
- }
- }
- }
- var yyn1078 bool
- if x.FptrMapUint16Uint64 == nil {
- yyn1078 = true
- goto LABEL1078
- }
- LABEL1078:
- if yyr2 || yy2arr2 {
- if yyn1078 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint16Uint64 == nil {
- r.EncodeNil()
- } else {
- yy1079 := *x.FptrMapUint16Uint64
- if false {
- } else {
- z.F.EncMapUint16Uint64V(yy1079, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Uint64`)
- r.WriteMapElemValue()
- if yyn1078 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint16Uint64 == nil {
- r.EncodeNil()
- } else {
- yy1081 := *x.FptrMapUint16Uint64
- if false {
- } else {
- z.F.EncMapUint16Uint64V(yy1081, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint16Uintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16UintptrV(x.FMapUint16Uintptr, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint16Uintptr`)
- r.WriteMapElemValue()
- if x.FMapUint16Uintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16UintptrV(x.FMapUint16Uintptr, e)
- }
- }
- }
- var yyn1086 bool
- if x.FptrMapUint16Uintptr == nil {
- yyn1086 = true
- goto LABEL1086
- }
- LABEL1086:
- if yyr2 || yy2arr2 {
- if yyn1086 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint16Uintptr == nil {
- r.EncodeNil()
- } else {
- yy1087 := *x.FptrMapUint16Uintptr
- if false {
- } else {
- z.F.EncMapUint16UintptrV(yy1087, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Uintptr`)
- r.WriteMapElemValue()
- if yyn1086 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint16Uintptr == nil {
- r.EncodeNil()
- } else {
- yy1089 := *x.FptrMapUint16Uintptr
- if false {
- } else {
- z.F.EncMapUint16UintptrV(yy1089, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint16Int == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16IntV(x.FMapUint16Int, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint16Int`)
- r.WriteMapElemValue()
- if x.FMapUint16Int == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16IntV(x.FMapUint16Int, e)
- }
- }
- }
- var yyn1094 bool
- if x.FptrMapUint16Int == nil {
- yyn1094 = true
- goto LABEL1094
- }
- LABEL1094:
- if yyr2 || yy2arr2 {
- if yyn1094 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint16Int == nil {
- r.EncodeNil()
- } else {
- yy1095 := *x.FptrMapUint16Int
- if false {
- } else {
- z.F.EncMapUint16IntV(yy1095, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Int`)
- r.WriteMapElemValue()
- if yyn1094 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint16Int == nil {
- r.EncodeNil()
- } else {
- yy1097 := *x.FptrMapUint16Int
- if false {
- } else {
- z.F.EncMapUint16IntV(yy1097, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint16Int8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16Int8V(x.FMapUint16Int8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint16Int8`)
- r.WriteMapElemValue()
- if x.FMapUint16Int8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16Int8V(x.FMapUint16Int8, e)
- }
- }
- }
- var yyn1102 bool
- if x.FptrMapUint16Int8 == nil {
- yyn1102 = true
- goto LABEL1102
- }
- LABEL1102:
- if yyr2 || yy2arr2 {
- if yyn1102 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint16Int8 == nil {
- r.EncodeNil()
- } else {
- yy1103 := *x.FptrMapUint16Int8
- if false {
- } else {
- z.F.EncMapUint16Int8V(yy1103, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Int8`)
- r.WriteMapElemValue()
- if yyn1102 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint16Int8 == nil {
- r.EncodeNil()
- } else {
- yy1105 := *x.FptrMapUint16Int8
- if false {
- } else {
- z.F.EncMapUint16Int8V(yy1105, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint16Int16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16Int16V(x.FMapUint16Int16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint16Int16`)
- r.WriteMapElemValue()
- if x.FMapUint16Int16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16Int16V(x.FMapUint16Int16, e)
- }
- }
- }
- var yyn1110 bool
- if x.FptrMapUint16Int16 == nil {
- yyn1110 = true
- goto LABEL1110
- }
- LABEL1110:
- if yyr2 || yy2arr2 {
- if yyn1110 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint16Int16 == nil {
- r.EncodeNil()
- } else {
- yy1111 := *x.FptrMapUint16Int16
- if false {
- } else {
- z.F.EncMapUint16Int16V(yy1111, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Int16`)
- r.WriteMapElemValue()
- if yyn1110 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint16Int16 == nil {
- r.EncodeNil()
- } else {
- yy1113 := *x.FptrMapUint16Int16
- if false {
- } else {
- z.F.EncMapUint16Int16V(yy1113, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint16Int32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16Int32V(x.FMapUint16Int32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint16Int32`)
- r.WriteMapElemValue()
- if x.FMapUint16Int32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16Int32V(x.FMapUint16Int32, e)
- }
- }
- }
- var yyn1118 bool
- if x.FptrMapUint16Int32 == nil {
- yyn1118 = true
- goto LABEL1118
- }
- LABEL1118:
- if yyr2 || yy2arr2 {
- if yyn1118 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint16Int32 == nil {
- r.EncodeNil()
- } else {
- yy1119 := *x.FptrMapUint16Int32
- if false {
- } else {
- z.F.EncMapUint16Int32V(yy1119, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Int32`)
- r.WriteMapElemValue()
- if yyn1118 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint16Int32 == nil {
- r.EncodeNil()
- } else {
- yy1121 := *x.FptrMapUint16Int32
- if false {
- } else {
- z.F.EncMapUint16Int32V(yy1121, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint16Int64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16Int64V(x.FMapUint16Int64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint16Int64`)
- r.WriteMapElemValue()
- if x.FMapUint16Int64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16Int64V(x.FMapUint16Int64, e)
- }
- }
- }
- var yyn1126 bool
- if x.FptrMapUint16Int64 == nil {
- yyn1126 = true
- goto LABEL1126
- }
- LABEL1126:
- if yyr2 || yy2arr2 {
- if yyn1126 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint16Int64 == nil {
- r.EncodeNil()
- } else {
- yy1127 := *x.FptrMapUint16Int64
- if false {
- } else {
- z.F.EncMapUint16Int64V(yy1127, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Int64`)
- r.WriteMapElemValue()
- if yyn1126 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint16Int64 == nil {
- r.EncodeNil()
- } else {
- yy1129 := *x.FptrMapUint16Int64
- if false {
- } else {
- z.F.EncMapUint16Int64V(yy1129, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint16Float32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16Float32V(x.FMapUint16Float32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint16Float32`)
- r.WriteMapElemValue()
- if x.FMapUint16Float32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16Float32V(x.FMapUint16Float32, e)
- }
- }
- }
- var yyn1134 bool
- if x.FptrMapUint16Float32 == nil {
- yyn1134 = true
- goto LABEL1134
- }
- LABEL1134:
- if yyr2 || yy2arr2 {
- if yyn1134 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint16Float32 == nil {
- r.EncodeNil()
- } else {
- yy1135 := *x.FptrMapUint16Float32
- if false {
- } else {
- z.F.EncMapUint16Float32V(yy1135, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Float32`)
- r.WriteMapElemValue()
- if yyn1134 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint16Float32 == nil {
- r.EncodeNil()
- } else {
- yy1137 := *x.FptrMapUint16Float32
- if false {
- } else {
- z.F.EncMapUint16Float32V(yy1137, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint16Float64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16Float64V(x.FMapUint16Float64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint16Float64`)
- r.WriteMapElemValue()
- if x.FMapUint16Float64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16Float64V(x.FMapUint16Float64, e)
- }
- }
- }
- var yyn1142 bool
- if x.FptrMapUint16Float64 == nil {
- yyn1142 = true
- goto LABEL1142
- }
- LABEL1142:
- if yyr2 || yy2arr2 {
- if yyn1142 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint16Float64 == nil {
- r.EncodeNil()
- } else {
- yy1143 := *x.FptrMapUint16Float64
- if false {
- } else {
- z.F.EncMapUint16Float64V(yy1143, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Float64`)
- r.WriteMapElemValue()
- if yyn1142 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint16Float64 == nil {
- r.EncodeNil()
- } else {
- yy1145 := *x.FptrMapUint16Float64
- if false {
- } else {
- z.F.EncMapUint16Float64V(yy1145, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint16Bool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16BoolV(x.FMapUint16Bool, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint16Bool`)
- r.WriteMapElemValue()
- if x.FMapUint16Bool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint16BoolV(x.FMapUint16Bool, e)
- }
- }
- }
- var yyn1150 bool
- if x.FptrMapUint16Bool == nil {
- yyn1150 = true
- goto LABEL1150
- }
- LABEL1150:
- if yyr2 || yy2arr2 {
- if yyn1150 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint16Bool == nil {
- r.EncodeNil()
- } else {
- yy1151 := *x.FptrMapUint16Bool
- if false {
- } else {
- z.F.EncMapUint16BoolV(yy1151, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Bool`)
- r.WriteMapElemValue()
- if yyn1150 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint16Bool == nil {
- r.EncodeNil()
- } else {
- yy1153 := *x.FptrMapUint16Bool
- if false {
- } else {
- z.F.EncMapUint16BoolV(yy1153, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint32Intf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32IntfV(x.FMapUint32Intf, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint32Intf`)
- r.WriteMapElemValue()
- if x.FMapUint32Intf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32IntfV(x.FMapUint32Intf, e)
- }
- }
- }
- var yyn1158 bool
- if x.FptrMapUint32Intf == nil {
- yyn1158 = true
- goto LABEL1158
- }
- LABEL1158:
- if yyr2 || yy2arr2 {
- if yyn1158 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint32Intf == nil {
- r.EncodeNil()
- } else {
- yy1159 := *x.FptrMapUint32Intf
- if false {
- } else {
- z.F.EncMapUint32IntfV(yy1159, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Intf`)
- r.WriteMapElemValue()
- if yyn1158 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint32Intf == nil {
- r.EncodeNil()
- } else {
- yy1161 := *x.FptrMapUint32Intf
- if false {
- } else {
- z.F.EncMapUint32IntfV(yy1161, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint32String == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32StringV(x.FMapUint32String, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint32String`)
- r.WriteMapElemValue()
- if x.FMapUint32String == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32StringV(x.FMapUint32String, e)
- }
- }
- }
- var yyn1166 bool
- if x.FptrMapUint32String == nil {
- yyn1166 = true
- goto LABEL1166
- }
- LABEL1166:
- if yyr2 || yy2arr2 {
- if yyn1166 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint32String == nil {
- r.EncodeNil()
- } else {
- yy1167 := *x.FptrMapUint32String
- if false {
- } else {
- z.F.EncMapUint32StringV(yy1167, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32String`)
- r.WriteMapElemValue()
- if yyn1166 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint32String == nil {
- r.EncodeNil()
- } else {
- yy1169 := *x.FptrMapUint32String
- if false {
- } else {
- z.F.EncMapUint32StringV(yy1169, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint32Uint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32UintV(x.FMapUint32Uint, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint32Uint`)
- r.WriteMapElemValue()
- if x.FMapUint32Uint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32UintV(x.FMapUint32Uint, e)
- }
- }
- }
- var yyn1174 bool
- if x.FptrMapUint32Uint == nil {
- yyn1174 = true
- goto LABEL1174
- }
- LABEL1174:
- if yyr2 || yy2arr2 {
- if yyn1174 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint32Uint == nil {
- r.EncodeNil()
- } else {
- yy1175 := *x.FptrMapUint32Uint
- if false {
- } else {
- z.F.EncMapUint32UintV(yy1175, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Uint`)
- r.WriteMapElemValue()
- if yyn1174 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint32Uint == nil {
- r.EncodeNil()
- } else {
- yy1177 := *x.FptrMapUint32Uint
- if false {
- } else {
- z.F.EncMapUint32UintV(yy1177, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint32Uint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32Uint8V(x.FMapUint32Uint8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint32Uint8`)
- r.WriteMapElemValue()
- if x.FMapUint32Uint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32Uint8V(x.FMapUint32Uint8, e)
- }
- }
- }
- var yyn1182 bool
- if x.FptrMapUint32Uint8 == nil {
- yyn1182 = true
- goto LABEL1182
- }
- LABEL1182:
- if yyr2 || yy2arr2 {
- if yyn1182 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint32Uint8 == nil {
- r.EncodeNil()
- } else {
- yy1183 := *x.FptrMapUint32Uint8
- if false {
- } else {
- z.F.EncMapUint32Uint8V(yy1183, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Uint8`)
- r.WriteMapElemValue()
- if yyn1182 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint32Uint8 == nil {
- r.EncodeNil()
- } else {
- yy1185 := *x.FptrMapUint32Uint8
- if false {
- } else {
- z.F.EncMapUint32Uint8V(yy1185, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint32Uint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32Uint16V(x.FMapUint32Uint16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint32Uint16`)
- r.WriteMapElemValue()
- if x.FMapUint32Uint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32Uint16V(x.FMapUint32Uint16, e)
- }
- }
- }
- var yyn1190 bool
- if x.FptrMapUint32Uint16 == nil {
- yyn1190 = true
- goto LABEL1190
- }
- LABEL1190:
- if yyr2 || yy2arr2 {
- if yyn1190 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint32Uint16 == nil {
- r.EncodeNil()
- } else {
- yy1191 := *x.FptrMapUint32Uint16
- if false {
- } else {
- z.F.EncMapUint32Uint16V(yy1191, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Uint16`)
- r.WriteMapElemValue()
- if yyn1190 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint32Uint16 == nil {
- r.EncodeNil()
- } else {
- yy1193 := *x.FptrMapUint32Uint16
- if false {
- } else {
- z.F.EncMapUint32Uint16V(yy1193, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint32Uint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32Uint32V(x.FMapUint32Uint32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint32Uint32`)
- r.WriteMapElemValue()
- if x.FMapUint32Uint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32Uint32V(x.FMapUint32Uint32, e)
- }
- }
- }
- var yyn1198 bool
- if x.FptrMapUint32Uint32 == nil {
- yyn1198 = true
- goto LABEL1198
- }
- LABEL1198:
- if yyr2 || yy2arr2 {
- if yyn1198 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint32Uint32 == nil {
- r.EncodeNil()
- } else {
- yy1199 := *x.FptrMapUint32Uint32
- if false {
- } else {
- z.F.EncMapUint32Uint32V(yy1199, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Uint32`)
- r.WriteMapElemValue()
- if yyn1198 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint32Uint32 == nil {
- r.EncodeNil()
- } else {
- yy1201 := *x.FptrMapUint32Uint32
- if false {
- } else {
- z.F.EncMapUint32Uint32V(yy1201, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint32Uint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32Uint64V(x.FMapUint32Uint64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint32Uint64`)
- r.WriteMapElemValue()
- if x.FMapUint32Uint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32Uint64V(x.FMapUint32Uint64, e)
- }
- }
- }
- var yyn1206 bool
- if x.FptrMapUint32Uint64 == nil {
- yyn1206 = true
- goto LABEL1206
- }
- LABEL1206:
- if yyr2 || yy2arr2 {
- if yyn1206 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint32Uint64 == nil {
- r.EncodeNil()
- } else {
- yy1207 := *x.FptrMapUint32Uint64
- if false {
- } else {
- z.F.EncMapUint32Uint64V(yy1207, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Uint64`)
- r.WriteMapElemValue()
- if yyn1206 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint32Uint64 == nil {
- r.EncodeNil()
- } else {
- yy1209 := *x.FptrMapUint32Uint64
- if false {
- } else {
- z.F.EncMapUint32Uint64V(yy1209, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint32Uintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32UintptrV(x.FMapUint32Uintptr, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint32Uintptr`)
- r.WriteMapElemValue()
- if x.FMapUint32Uintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32UintptrV(x.FMapUint32Uintptr, e)
- }
- }
- }
- var yyn1214 bool
- if x.FptrMapUint32Uintptr == nil {
- yyn1214 = true
- goto LABEL1214
- }
- LABEL1214:
- if yyr2 || yy2arr2 {
- if yyn1214 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint32Uintptr == nil {
- r.EncodeNil()
- } else {
- yy1215 := *x.FptrMapUint32Uintptr
- if false {
- } else {
- z.F.EncMapUint32UintptrV(yy1215, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Uintptr`)
- r.WriteMapElemValue()
- if yyn1214 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint32Uintptr == nil {
- r.EncodeNil()
- } else {
- yy1217 := *x.FptrMapUint32Uintptr
- if false {
- } else {
- z.F.EncMapUint32UintptrV(yy1217, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint32Int == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32IntV(x.FMapUint32Int, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint32Int`)
- r.WriteMapElemValue()
- if x.FMapUint32Int == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32IntV(x.FMapUint32Int, e)
- }
- }
- }
- var yyn1222 bool
- if x.FptrMapUint32Int == nil {
- yyn1222 = true
- goto LABEL1222
- }
- LABEL1222:
- if yyr2 || yy2arr2 {
- if yyn1222 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint32Int == nil {
- r.EncodeNil()
- } else {
- yy1223 := *x.FptrMapUint32Int
- if false {
- } else {
- z.F.EncMapUint32IntV(yy1223, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Int`)
- r.WriteMapElemValue()
- if yyn1222 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint32Int == nil {
- r.EncodeNil()
- } else {
- yy1225 := *x.FptrMapUint32Int
- if false {
- } else {
- z.F.EncMapUint32IntV(yy1225, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint32Int8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32Int8V(x.FMapUint32Int8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint32Int8`)
- r.WriteMapElemValue()
- if x.FMapUint32Int8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32Int8V(x.FMapUint32Int8, e)
- }
- }
- }
- var yyn1230 bool
- if x.FptrMapUint32Int8 == nil {
- yyn1230 = true
- goto LABEL1230
- }
- LABEL1230:
- if yyr2 || yy2arr2 {
- if yyn1230 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint32Int8 == nil {
- r.EncodeNil()
- } else {
- yy1231 := *x.FptrMapUint32Int8
- if false {
- } else {
- z.F.EncMapUint32Int8V(yy1231, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Int8`)
- r.WriteMapElemValue()
- if yyn1230 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint32Int8 == nil {
- r.EncodeNil()
- } else {
- yy1233 := *x.FptrMapUint32Int8
- if false {
- } else {
- z.F.EncMapUint32Int8V(yy1233, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint32Int16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32Int16V(x.FMapUint32Int16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint32Int16`)
- r.WriteMapElemValue()
- if x.FMapUint32Int16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32Int16V(x.FMapUint32Int16, e)
- }
- }
- }
- var yyn1238 bool
- if x.FptrMapUint32Int16 == nil {
- yyn1238 = true
- goto LABEL1238
- }
- LABEL1238:
- if yyr2 || yy2arr2 {
- if yyn1238 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint32Int16 == nil {
- r.EncodeNil()
- } else {
- yy1239 := *x.FptrMapUint32Int16
- if false {
- } else {
- z.F.EncMapUint32Int16V(yy1239, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Int16`)
- r.WriteMapElemValue()
- if yyn1238 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint32Int16 == nil {
- r.EncodeNil()
- } else {
- yy1241 := *x.FptrMapUint32Int16
- if false {
- } else {
- z.F.EncMapUint32Int16V(yy1241, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint32Int32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32Int32V(x.FMapUint32Int32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint32Int32`)
- r.WriteMapElemValue()
- if x.FMapUint32Int32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32Int32V(x.FMapUint32Int32, e)
- }
- }
- }
- var yyn1246 bool
- if x.FptrMapUint32Int32 == nil {
- yyn1246 = true
- goto LABEL1246
- }
- LABEL1246:
- if yyr2 || yy2arr2 {
- if yyn1246 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint32Int32 == nil {
- r.EncodeNil()
- } else {
- yy1247 := *x.FptrMapUint32Int32
- if false {
- } else {
- z.F.EncMapUint32Int32V(yy1247, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Int32`)
- r.WriteMapElemValue()
- if yyn1246 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint32Int32 == nil {
- r.EncodeNil()
- } else {
- yy1249 := *x.FptrMapUint32Int32
- if false {
- } else {
- z.F.EncMapUint32Int32V(yy1249, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint32Int64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32Int64V(x.FMapUint32Int64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint32Int64`)
- r.WriteMapElemValue()
- if x.FMapUint32Int64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32Int64V(x.FMapUint32Int64, e)
- }
- }
- }
- var yyn1254 bool
- if x.FptrMapUint32Int64 == nil {
- yyn1254 = true
- goto LABEL1254
- }
- LABEL1254:
- if yyr2 || yy2arr2 {
- if yyn1254 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint32Int64 == nil {
- r.EncodeNil()
- } else {
- yy1255 := *x.FptrMapUint32Int64
- if false {
- } else {
- z.F.EncMapUint32Int64V(yy1255, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Int64`)
- r.WriteMapElemValue()
- if yyn1254 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint32Int64 == nil {
- r.EncodeNil()
- } else {
- yy1257 := *x.FptrMapUint32Int64
- if false {
- } else {
- z.F.EncMapUint32Int64V(yy1257, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint32Float32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32Float32V(x.FMapUint32Float32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint32Float32`)
- r.WriteMapElemValue()
- if x.FMapUint32Float32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32Float32V(x.FMapUint32Float32, e)
- }
- }
- }
- var yyn1262 bool
- if x.FptrMapUint32Float32 == nil {
- yyn1262 = true
- goto LABEL1262
- }
- LABEL1262:
- if yyr2 || yy2arr2 {
- if yyn1262 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint32Float32 == nil {
- r.EncodeNil()
- } else {
- yy1263 := *x.FptrMapUint32Float32
- if false {
- } else {
- z.F.EncMapUint32Float32V(yy1263, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Float32`)
- r.WriteMapElemValue()
- if yyn1262 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint32Float32 == nil {
- r.EncodeNil()
- } else {
- yy1265 := *x.FptrMapUint32Float32
- if false {
- } else {
- z.F.EncMapUint32Float32V(yy1265, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint32Float64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32Float64V(x.FMapUint32Float64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint32Float64`)
- r.WriteMapElemValue()
- if x.FMapUint32Float64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32Float64V(x.FMapUint32Float64, e)
- }
- }
- }
- var yyn1270 bool
- if x.FptrMapUint32Float64 == nil {
- yyn1270 = true
- goto LABEL1270
- }
- LABEL1270:
- if yyr2 || yy2arr2 {
- if yyn1270 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint32Float64 == nil {
- r.EncodeNil()
- } else {
- yy1271 := *x.FptrMapUint32Float64
- if false {
- } else {
- z.F.EncMapUint32Float64V(yy1271, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Float64`)
- r.WriteMapElemValue()
- if yyn1270 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint32Float64 == nil {
- r.EncodeNil()
- } else {
- yy1273 := *x.FptrMapUint32Float64
- if false {
- } else {
- z.F.EncMapUint32Float64V(yy1273, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint32Bool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32BoolV(x.FMapUint32Bool, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint32Bool`)
- r.WriteMapElemValue()
- if x.FMapUint32Bool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint32BoolV(x.FMapUint32Bool, e)
- }
- }
- }
- var yyn1278 bool
- if x.FptrMapUint32Bool == nil {
- yyn1278 = true
- goto LABEL1278
- }
- LABEL1278:
- if yyr2 || yy2arr2 {
- if yyn1278 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint32Bool == nil {
- r.EncodeNil()
- } else {
- yy1279 := *x.FptrMapUint32Bool
- if false {
- } else {
- z.F.EncMapUint32BoolV(yy1279, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Bool`)
- r.WriteMapElemValue()
- if yyn1278 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint32Bool == nil {
- r.EncodeNil()
- } else {
- yy1281 := *x.FptrMapUint32Bool
- if false {
- } else {
- z.F.EncMapUint32BoolV(yy1281, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint64Intf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64IntfV(x.FMapUint64Intf, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint64Intf`)
- r.WriteMapElemValue()
- if x.FMapUint64Intf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64IntfV(x.FMapUint64Intf, e)
- }
- }
- }
- var yyn1286 bool
- if x.FptrMapUint64Intf == nil {
- yyn1286 = true
- goto LABEL1286
- }
- LABEL1286:
- if yyr2 || yy2arr2 {
- if yyn1286 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint64Intf == nil {
- r.EncodeNil()
- } else {
- yy1287 := *x.FptrMapUint64Intf
- if false {
- } else {
- z.F.EncMapUint64IntfV(yy1287, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Intf`)
- r.WriteMapElemValue()
- if yyn1286 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint64Intf == nil {
- r.EncodeNil()
- } else {
- yy1289 := *x.FptrMapUint64Intf
- if false {
- } else {
- z.F.EncMapUint64IntfV(yy1289, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint64String == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64StringV(x.FMapUint64String, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint64String`)
- r.WriteMapElemValue()
- if x.FMapUint64String == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64StringV(x.FMapUint64String, e)
- }
- }
- }
- var yyn1294 bool
- if x.FptrMapUint64String == nil {
- yyn1294 = true
- goto LABEL1294
- }
- LABEL1294:
- if yyr2 || yy2arr2 {
- if yyn1294 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint64String == nil {
- r.EncodeNil()
- } else {
- yy1295 := *x.FptrMapUint64String
- if false {
- } else {
- z.F.EncMapUint64StringV(yy1295, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64String`)
- r.WriteMapElemValue()
- if yyn1294 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint64String == nil {
- r.EncodeNil()
- } else {
- yy1297 := *x.FptrMapUint64String
- if false {
- } else {
- z.F.EncMapUint64StringV(yy1297, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint64Uint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64UintV(x.FMapUint64Uint, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint64Uint`)
- r.WriteMapElemValue()
- if x.FMapUint64Uint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64UintV(x.FMapUint64Uint, e)
- }
- }
- }
- var yyn1302 bool
- if x.FptrMapUint64Uint == nil {
- yyn1302 = true
- goto LABEL1302
- }
- LABEL1302:
- if yyr2 || yy2arr2 {
- if yyn1302 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint64Uint == nil {
- r.EncodeNil()
- } else {
- yy1303 := *x.FptrMapUint64Uint
- if false {
- } else {
- z.F.EncMapUint64UintV(yy1303, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Uint`)
- r.WriteMapElemValue()
- if yyn1302 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint64Uint == nil {
- r.EncodeNil()
- } else {
- yy1305 := *x.FptrMapUint64Uint
- if false {
- } else {
- z.F.EncMapUint64UintV(yy1305, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint64Uint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64Uint8V(x.FMapUint64Uint8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint64Uint8`)
- r.WriteMapElemValue()
- if x.FMapUint64Uint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64Uint8V(x.FMapUint64Uint8, e)
- }
- }
- }
- var yyn1310 bool
- if x.FptrMapUint64Uint8 == nil {
- yyn1310 = true
- goto LABEL1310
- }
- LABEL1310:
- if yyr2 || yy2arr2 {
- if yyn1310 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint64Uint8 == nil {
- r.EncodeNil()
- } else {
- yy1311 := *x.FptrMapUint64Uint8
- if false {
- } else {
- z.F.EncMapUint64Uint8V(yy1311, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Uint8`)
- r.WriteMapElemValue()
- if yyn1310 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint64Uint8 == nil {
- r.EncodeNil()
- } else {
- yy1313 := *x.FptrMapUint64Uint8
- if false {
- } else {
- z.F.EncMapUint64Uint8V(yy1313, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint64Uint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64Uint16V(x.FMapUint64Uint16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint64Uint16`)
- r.WriteMapElemValue()
- if x.FMapUint64Uint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64Uint16V(x.FMapUint64Uint16, e)
- }
- }
- }
- var yyn1318 bool
- if x.FptrMapUint64Uint16 == nil {
- yyn1318 = true
- goto LABEL1318
- }
- LABEL1318:
- if yyr2 || yy2arr2 {
- if yyn1318 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint64Uint16 == nil {
- r.EncodeNil()
- } else {
- yy1319 := *x.FptrMapUint64Uint16
- if false {
- } else {
- z.F.EncMapUint64Uint16V(yy1319, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Uint16`)
- r.WriteMapElemValue()
- if yyn1318 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint64Uint16 == nil {
- r.EncodeNil()
- } else {
- yy1321 := *x.FptrMapUint64Uint16
- if false {
- } else {
- z.F.EncMapUint64Uint16V(yy1321, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint64Uint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64Uint32V(x.FMapUint64Uint32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint64Uint32`)
- r.WriteMapElemValue()
- if x.FMapUint64Uint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64Uint32V(x.FMapUint64Uint32, e)
- }
- }
- }
- var yyn1326 bool
- if x.FptrMapUint64Uint32 == nil {
- yyn1326 = true
- goto LABEL1326
- }
- LABEL1326:
- if yyr2 || yy2arr2 {
- if yyn1326 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint64Uint32 == nil {
- r.EncodeNil()
- } else {
- yy1327 := *x.FptrMapUint64Uint32
- if false {
- } else {
- z.F.EncMapUint64Uint32V(yy1327, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Uint32`)
- r.WriteMapElemValue()
- if yyn1326 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint64Uint32 == nil {
- r.EncodeNil()
- } else {
- yy1329 := *x.FptrMapUint64Uint32
- if false {
- } else {
- z.F.EncMapUint64Uint32V(yy1329, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint64Uint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64Uint64V(x.FMapUint64Uint64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint64Uint64`)
- r.WriteMapElemValue()
- if x.FMapUint64Uint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64Uint64V(x.FMapUint64Uint64, e)
- }
- }
- }
- var yyn1334 bool
- if x.FptrMapUint64Uint64 == nil {
- yyn1334 = true
- goto LABEL1334
- }
- LABEL1334:
- if yyr2 || yy2arr2 {
- if yyn1334 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint64Uint64 == nil {
- r.EncodeNil()
- } else {
- yy1335 := *x.FptrMapUint64Uint64
- if false {
- } else {
- z.F.EncMapUint64Uint64V(yy1335, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Uint64`)
- r.WriteMapElemValue()
- if yyn1334 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint64Uint64 == nil {
- r.EncodeNil()
- } else {
- yy1337 := *x.FptrMapUint64Uint64
- if false {
- } else {
- z.F.EncMapUint64Uint64V(yy1337, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint64Uintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64UintptrV(x.FMapUint64Uintptr, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint64Uintptr`)
- r.WriteMapElemValue()
- if x.FMapUint64Uintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64UintptrV(x.FMapUint64Uintptr, e)
- }
- }
- }
- var yyn1342 bool
- if x.FptrMapUint64Uintptr == nil {
- yyn1342 = true
- goto LABEL1342
- }
- LABEL1342:
- if yyr2 || yy2arr2 {
- if yyn1342 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint64Uintptr == nil {
- r.EncodeNil()
- } else {
- yy1343 := *x.FptrMapUint64Uintptr
- if false {
- } else {
- z.F.EncMapUint64UintptrV(yy1343, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Uintptr`)
- r.WriteMapElemValue()
- if yyn1342 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint64Uintptr == nil {
- r.EncodeNil()
- } else {
- yy1345 := *x.FptrMapUint64Uintptr
- if false {
- } else {
- z.F.EncMapUint64UintptrV(yy1345, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint64Int == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64IntV(x.FMapUint64Int, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint64Int`)
- r.WriteMapElemValue()
- if x.FMapUint64Int == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64IntV(x.FMapUint64Int, e)
- }
- }
- }
- var yyn1350 bool
- if x.FptrMapUint64Int == nil {
- yyn1350 = true
- goto LABEL1350
- }
- LABEL1350:
- if yyr2 || yy2arr2 {
- if yyn1350 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint64Int == nil {
- r.EncodeNil()
- } else {
- yy1351 := *x.FptrMapUint64Int
- if false {
- } else {
- z.F.EncMapUint64IntV(yy1351, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Int`)
- r.WriteMapElemValue()
- if yyn1350 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint64Int == nil {
- r.EncodeNil()
- } else {
- yy1353 := *x.FptrMapUint64Int
- if false {
- } else {
- z.F.EncMapUint64IntV(yy1353, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint64Int8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64Int8V(x.FMapUint64Int8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint64Int8`)
- r.WriteMapElemValue()
- if x.FMapUint64Int8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64Int8V(x.FMapUint64Int8, e)
- }
- }
- }
- var yyn1358 bool
- if x.FptrMapUint64Int8 == nil {
- yyn1358 = true
- goto LABEL1358
- }
- LABEL1358:
- if yyr2 || yy2arr2 {
- if yyn1358 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint64Int8 == nil {
- r.EncodeNil()
- } else {
- yy1359 := *x.FptrMapUint64Int8
- if false {
- } else {
- z.F.EncMapUint64Int8V(yy1359, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Int8`)
- r.WriteMapElemValue()
- if yyn1358 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint64Int8 == nil {
- r.EncodeNil()
- } else {
- yy1361 := *x.FptrMapUint64Int8
- if false {
- } else {
- z.F.EncMapUint64Int8V(yy1361, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint64Int16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64Int16V(x.FMapUint64Int16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint64Int16`)
- r.WriteMapElemValue()
- if x.FMapUint64Int16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64Int16V(x.FMapUint64Int16, e)
- }
- }
- }
- var yyn1366 bool
- if x.FptrMapUint64Int16 == nil {
- yyn1366 = true
- goto LABEL1366
- }
- LABEL1366:
- if yyr2 || yy2arr2 {
- if yyn1366 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint64Int16 == nil {
- r.EncodeNil()
- } else {
- yy1367 := *x.FptrMapUint64Int16
- if false {
- } else {
- z.F.EncMapUint64Int16V(yy1367, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Int16`)
- r.WriteMapElemValue()
- if yyn1366 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint64Int16 == nil {
- r.EncodeNil()
- } else {
- yy1369 := *x.FptrMapUint64Int16
- if false {
- } else {
- z.F.EncMapUint64Int16V(yy1369, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint64Int32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64Int32V(x.FMapUint64Int32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint64Int32`)
- r.WriteMapElemValue()
- if x.FMapUint64Int32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64Int32V(x.FMapUint64Int32, e)
- }
- }
- }
- var yyn1374 bool
- if x.FptrMapUint64Int32 == nil {
- yyn1374 = true
- goto LABEL1374
- }
- LABEL1374:
- if yyr2 || yy2arr2 {
- if yyn1374 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint64Int32 == nil {
- r.EncodeNil()
- } else {
- yy1375 := *x.FptrMapUint64Int32
- if false {
- } else {
- z.F.EncMapUint64Int32V(yy1375, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Int32`)
- r.WriteMapElemValue()
- if yyn1374 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint64Int32 == nil {
- r.EncodeNil()
- } else {
- yy1377 := *x.FptrMapUint64Int32
- if false {
- } else {
- z.F.EncMapUint64Int32V(yy1377, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint64Int64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64Int64V(x.FMapUint64Int64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint64Int64`)
- r.WriteMapElemValue()
- if x.FMapUint64Int64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64Int64V(x.FMapUint64Int64, e)
- }
- }
- }
- var yyn1382 bool
- if x.FptrMapUint64Int64 == nil {
- yyn1382 = true
- goto LABEL1382
- }
- LABEL1382:
- if yyr2 || yy2arr2 {
- if yyn1382 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint64Int64 == nil {
- r.EncodeNil()
- } else {
- yy1383 := *x.FptrMapUint64Int64
- if false {
- } else {
- z.F.EncMapUint64Int64V(yy1383, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Int64`)
- r.WriteMapElemValue()
- if yyn1382 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint64Int64 == nil {
- r.EncodeNil()
- } else {
- yy1385 := *x.FptrMapUint64Int64
- if false {
- } else {
- z.F.EncMapUint64Int64V(yy1385, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint64Float32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64Float32V(x.FMapUint64Float32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint64Float32`)
- r.WriteMapElemValue()
- if x.FMapUint64Float32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64Float32V(x.FMapUint64Float32, e)
- }
- }
- }
- var yyn1390 bool
- if x.FptrMapUint64Float32 == nil {
- yyn1390 = true
- goto LABEL1390
- }
- LABEL1390:
- if yyr2 || yy2arr2 {
- if yyn1390 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint64Float32 == nil {
- r.EncodeNil()
- } else {
- yy1391 := *x.FptrMapUint64Float32
- if false {
- } else {
- z.F.EncMapUint64Float32V(yy1391, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Float32`)
- r.WriteMapElemValue()
- if yyn1390 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint64Float32 == nil {
- r.EncodeNil()
- } else {
- yy1393 := *x.FptrMapUint64Float32
- if false {
- } else {
- z.F.EncMapUint64Float32V(yy1393, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint64Float64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64Float64V(x.FMapUint64Float64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint64Float64`)
- r.WriteMapElemValue()
- if x.FMapUint64Float64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64Float64V(x.FMapUint64Float64, e)
- }
- }
- }
- var yyn1398 bool
- if x.FptrMapUint64Float64 == nil {
- yyn1398 = true
- goto LABEL1398
- }
- LABEL1398:
- if yyr2 || yy2arr2 {
- if yyn1398 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint64Float64 == nil {
- r.EncodeNil()
- } else {
- yy1399 := *x.FptrMapUint64Float64
- if false {
- } else {
- z.F.EncMapUint64Float64V(yy1399, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Float64`)
- r.WriteMapElemValue()
- if yyn1398 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint64Float64 == nil {
- r.EncodeNil()
- } else {
- yy1401 := *x.FptrMapUint64Float64
- if false {
- } else {
- z.F.EncMapUint64Float64V(yy1401, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUint64Bool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64BoolV(x.FMapUint64Bool, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUint64Bool`)
- r.WriteMapElemValue()
- if x.FMapUint64Bool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUint64BoolV(x.FMapUint64Bool, e)
- }
- }
- }
- var yyn1406 bool
- if x.FptrMapUint64Bool == nil {
- yyn1406 = true
- goto LABEL1406
- }
- LABEL1406:
- if yyr2 || yy2arr2 {
- if yyn1406 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUint64Bool == nil {
- r.EncodeNil()
- } else {
- yy1407 := *x.FptrMapUint64Bool
- if false {
- } else {
- z.F.EncMapUint64BoolV(yy1407, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Bool`)
- r.WriteMapElemValue()
- if yyn1406 {
- r.EncodeNil()
- } else {
- if x.FptrMapUint64Bool == nil {
- r.EncodeNil()
- } else {
- yy1409 := *x.FptrMapUint64Bool
- if false {
- } else {
- z.F.EncMapUint64BoolV(yy1409, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintptrIntf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrIntfV(x.FMapUintptrIntf, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintptrIntf`)
- r.WriteMapElemValue()
- if x.FMapUintptrIntf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrIntfV(x.FMapUintptrIntf, e)
- }
- }
- }
- var yyn1414 bool
- if x.FptrMapUintptrIntf == nil {
- yyn1414 = true
- goto LABEL1414
- }
- LABEL1414:
- if yyr2 || yy2arr2 {
- if yyn1414 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintptrIntf == nil {
- r.EncodeNil()
- } else {
- yy1415 := *x.FptrMapUintptrIntf
- if false {
- } else {
- z.F.EncMapUintptrIntfV(yy1415, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrIntf`)
- r.WriteMapElemValue()
- if yyn1414 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintptrIntf == nil {
- r.EncodeNil()
- } else {
- yy1417 := *x.FptrMapUintptrIntf
- if false {
- } else {
- z.F.EncMapUintptrIntfV(yy1417, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintptrString == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrStringV(x.FMapUintptrString, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintptrString`)
- r.WriteMapElemValue()
- if x.FMapUintptrString == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrStringV(x.FMapUintptrString, e)
- }
- }
- }
- var yyn1422 bool
- if x.FptrMapUintptrString == nil {
- yyn1422 = true
- goto LABEL1422
- }
- LABEL1422:
- if yyr2 || yy2arr2 {
- if yyn1422 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintptrString == nil {
- r.EncodeNil()
- } else {
- yy1423 := *x.FptrMapUintptrString
- if false {
- } else {
- z.F.EncMapUintptrStringV(yy1423, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrString`)
- r.WriteMapElemValue()
- if yyn1422 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintptrString == nil {
- r.EncodeNil()
- } else {
- yy1425 := *x.FptrMapUintptrString
- if false {
- } else {
- z.F.EncMapUintptrStringV(yy1425, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintptrUint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrUintV(x.FMapUintptrUint, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintptrUint`)
- r.WriteMapElemValue()
- if x.FMapUintptrUint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrUintV(x.FMapUintptrUint, e)
- }
- }
- }
- var yyn1430 bool
- if x.FptrMapUintptrUint == nil {
- yyn1430 = true
- goto LABEL1430
- }
- LABEL1430:
- if yyr2 || yy2arr2 {
- if yyn1430 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintptrUint == nil {
- r.EncodeNil()
- } else {
- yy1431 := *x.FptrMapUintptrUint
- if false {
- } else {
- z.F.EncMapUintptrUintV(yy1431, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrUint`)
- r.WriteMapElemValue()
- if yyn1430 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintptrUint == nil {
- r.EncodeNil()
- } else {
- yy1433 := *x.FptrMapUintptrUint
- if false {
- } else {
- z.F.EncMapUintptrUintV(yy1433, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintptrUint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrUint8V(x.FMapUintptrUint8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintptrUint8`)
- r.WriteMapElemValue()
- if x.FMapUintptrUint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrUint8V(x.FMapUintptrUint8, e)
- }
- }
- }
- var yyn1438 bool
- if x.FptrMapUintptrUint8 == nil {
- yyn1438 = true
- goto LABEL1438
- }
- LABEL1438:
- if yyr2 || yy2arr2 {
- if yyn1438 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintptrUint8 == nil {
- r.EncodeNil()
- } else {
- yy1439 := *x.FptrMapUintptrUint8
- if false {
- } else {
- z.F.EncMapUintptrUint8V(yy1439, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrUint8`)
- r.WriteMapElemValue()
- if yyn1438 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintptrUint8 == nil {
- r.EncodeNil()
- } else {
- yy1441 := *x.FptrMapUintptrUint8
- if false {
- } else {
- z.F.EncMapUintptrUint8V(yy1441, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintptrUint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrUint16V(x.FMapUintptrUint16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintptrUint16`)
- r.WriteMapElemValue()
- if x.FMapUintptrUint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrUint16V(x.FMapUintptrUint16, e)
- }
- }
- }
- var yyn1446 bool
- if x.FptrMapUintptrUint16 == nil {
- yyn1446 = true
- goto LABEL1446
- }
- LABEL1446:
- if yyr2 || yy2arr2 {
- if yyn1446 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintptrUint16 == nil {
- r.EncodeNil()
- } else {
- yy1447 := *x.FptrMapUintptrUint16
- if false {
- } else {
- z.F.EncMapUintptrUint16V(yy1447, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrUint16`)
- r.WriteMapElemValue()
- if yyn1446 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintptrUint16 == nil {
- r.EncodeNil()
- } else {
- yy1449 := *x.FptrMapUintptrUint16
- if false {
- } else {
- z.F.EncMapUintptrUint16V(yy1449, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintptrUint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrUint32V(x.FMapUintptrUint32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintptrUint32`)
- r.WriteMapElemValue()
- if x.FMapUintptrUint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrUint32V(x.FMapUintptrUint32, e)
- }
- }
- }
- var yyn1454 bool
- if x.FptrMapUintptrUint32 == nil {
- yyn1454 = true
- goto LABEL1454
- }
- LABEL1454:
- if yyr2 || yy2arr2 {
- if yyn1454 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintptrUint32 == nil {
- r.EncodeNil()
- } else {
- yy1455 := *x.FptrMapUintptrUint32
- if false {
- } else {
- z.F.EncMapUintptrUint32V(yy1455, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrUint32`)
- r.WriteMapElemValue()
- if yyn1454 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintptrUint32 == nil {
- r.EncodeNil()
- } else {
- yy1457 := *x.FptrMapUintptrUint32
- if false {
- } else {
- z.F.EncMapUintptrUint32V(yy1457, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintptrUint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrUint64V(x.FMapUintptrUint64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintptrUint64`)
- r.WriteMapElemValue()
- if x.FMapUintptrUint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrUint64V(x.FMapUintptrUint64, e)
- }
- }
- }
- var yyn1462 bool
- if x.FptrMapUintptrUint64 == nil {
- yyn1462 = true
- goto LABEL1462
- }
- LABEL1462:
- if yyr2 || yy2arr2 {
- if yyn1462 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintptrUint64 == nil {
- r.EncodeNil()
- } else {
- yy1463 := *x.FptrMapUintptrUint64
- if false {
- } else {
- z.F.EncMapUintptrUint64V(yy1463, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrUint64`)
- r.WriteMapElemValue()
- if yyn1462 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintptrUint64 == nil {
- r.EncodeNil()
- } else {
- yy1465 := *x.FptrMapUintptrUint64
- if false {
- } else {
- z.F.EncMapUintptrUint64V(yy1465, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintptrUintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrUintptrV(x.FMapUintptrUintptr, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintptrUintptr`)
- r.WriteMapElemValue()
- if x.FMapUintptrUintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrUintptrV(x.FMapUintptrUintptr, e)
- }
- }
- }
- var yyn1470 bool
- if x.FptrMapUintptrUintptr == nil {
- yyn1470 = true
- goto LABEL1470
- }
- LABEL1470:
- if yyr2 || yy2arr2 {
- if yyn1470 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintptrUintptr == nil {
- r.EncodeNil()
- } else {
- yy1471 := *x.FptrMapUintptrUintptr
- if false {
- } else {
- z.F.EncMapUintptrUintptrV(yy1471, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrUintptr`)
- r.WriteMapElemValue()
- if yyn1470 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintptrUintptr == nil {
- r.EncodeNil()
- } else {
- yy1473 := *x.FptrMapUintptrUintptr
- if false {
- } else {
- z.F.EncMapUintptrUintptrV(yy1473, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintptrInt == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrIntV(x.FMapUintptrInt, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintptrInt`)
- r.WriteMapElemValue()
- if x.FMapUintptrInt == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrIntV(x.FMapUintptrInt, e)
- }
- }
- }
- var yyn1478 bool
- if x.FptrMapUintptrInt == nil {
- yyn1478 = true
- goto LABEL1478
- }
- LABEL1478:
- if yyr2 || yy2arr2 {
- if yyn1478 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintptrInt == nil {
- r.EncodeNil()
- } else {
- yy1479 := *x.FptrMapUintptrInt
- if false {
- } else {
- z.F.EncMapUintptrIntV(yy1479, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrInt`)
- r.WriteMapElemValue()
- if yyn1478 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintptrInt == nil {
- r.EncodeNil()
- } else {
- yy1481 := *x.FptrMapUintptrInt
- if false {
- } else {
- z.F.EncMapUintptrIntV(yy1481, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintptrInt8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrInt8V(x.FMapUintptrInt8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintptrInt8`)
- r.WriteMapElemValue()
- if x.FMapUintptrInt8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrInt8V(x.FMapUintptrInt8, e)
- }
- }
- }
- var yyn1486 bool
- if x.FptrMapUintptrInt8 == nil {
- yyn1486 = true
- goto LABEL1486
- }
- LABEL1486:
- if yyr2 || yy2arr2 {
- if yyn1486 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintptrInt8 == nil {
- r.EncodeNil()
- } else {
- yy1487 := *x.FptrMapUintptrInt8
- if false {
- } else {
- z.F.EncMapUintptrInt8V(yy1487, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrInt8`)
- r.WriteMapElemValue()
- if yyn1486 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintptrInt8 == nil {
- r.EncodeNil()
- } else {
- yy1489 := *x.FptrMapUintptrInt8
- if false {
- } else {
- z.F.EncMapUintptrInt8V(yy1489, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintptrInt16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrInt16V(x.FMapUintptrInt16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintptrInt16`)
- r.WriteMapElemValue()
- if x.FMapUintptrInt16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrInt16V(x.FMapUintptrInt16, e)
- }
- }
- }
- var yyn1494 bool
- if x.FptrMapUintptrInt16 == nil {
- yyn1494 = true
- goto LABEL1494
- }
- LABEL1494:
- if yyr2 || yy2arr2 {
- if yyn1494 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintptrInt16 == nil {
- r.EncodeNil()
- } else {
- yy1495 := *x.FptrMapUintptrInt16
- if false {
- } else {
- z.F.EncMapUintptrInt16V(yy1495, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrInt16`)
- r.WriteMapElemValue()
- if yyn1494 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintptrInt16 == nil {
- r.EncodeNil()
- } else {
- yy1497 := *x.FptrMapUintptrInt16
- if false {
- } else {
- z.F.EncMapUintptrInt16V(yy1497, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintptrInt32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrInt32V(x.FMapUintptrInt32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintptrInt32`)
- r.WriteMapElemValue()
- if x.FMapUintptrInt32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrInt32V(x.FMapUintptrInt32, e)
- }
- }
- }
- var yyn1502 bool
- if x.FptrMapUintptrInt32 == nil {
- yyn1502 = true
- goto LABEL1502
- }
- LABEL1502:
- if yyr2 || yy2arr2 {
- if yyn1502 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintptrInt32 == nil {
- r.EncodeNil()
- } else {
- yy1503 := *x.FptrMapUintptrInt32
- if false {
- } else {
- z.F.EncMapUintptrInt32V(yy1503, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrInt32`)
- r.WriteMapElemValue()
- if yyn1502 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintptrInt32 == nil {
- r.EncodeNil()
- } else {
- yy1505 := *x.FptrMapUintptrInt32
- if false {
- } else {
- z.F.EncMapUintptrInt32V(yy1505, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintptrInt64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrInt64V(x.FMapUintptrInt64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintptrInt64`)
- r.WriteMapElemValue()
- if x.FMapUintptrInt64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrInt64V(x.FMapUintptrInt64, e)
- }
- }
- }
- var yyn1510 bool
- if x.FptrMapUintptrInt64 == nil {
- yyn1510 = true
- goto LABEL1510
- }
- LABEL1510:
- if yyr2 || yy2arr2 {
- if yyn1510 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintptrInt64 == nil {
- r.EncodeNil()
- } else {
- yy1511 := *x.FptrMapUintptrInt64
- if false {
- } else {
- z.F.EncMapUintptrInt64V(yy1511, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrInt64`)
- r.WriteMapElemValue()
- if yyn1510 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintptrInt64 == nil {
- r.EncodeNil()
- } else {
- yy1513 := *x.FptrMapUintptrInt64
- if false {
- } else {
- z.F.EncMapUintptrInt64V(yy1513, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintptrFloat32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrFloat32V(x.FMapUintptrFloat32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintptrFloat32`)
- r.WriteMapElemValue()
- if x.FMapUintptrFloat32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrFloat32V(x.FMapUintptrFloat32, e)
- }
- }
- }
- var yyn1518 bool
- if x.FptrMapUintptrFloat32 == nil {
- yyn1518 = true
- goto LABEL1518
- }
- LABEL1518:
- if yyr2 || yy2arr2 {
- if yyn1518 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintptrFloat32 == nil {
- r.EncodeNil()
- } else {
- yy1519 := *x.FptrMapUintptrFloat32
- if false {
- } else {
- z.F.EncMapUintptrFloat32V(yy1519, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrFloat32`)
- r.WriteMapElemValue()
- if yyn1518 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintptrFloat32 == nil {
- r.EncodeNil()
- } else {
- yy1521 := *x.FptrMapUintptrFloat32
- if false {
- } else {
- z.F.EncMapUintptrFloat32V(yy1521, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintptrFloat64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrFloat64V(x.FMapUintptrFloat64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintptrFloat64`)
- r.WriteMapElemValue()
- if x.FMapUintptrFloat64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrFloat64V(x.FMapUintptrFloat64, e)
- }
- }
- }
- var yyn1526 bool
- if x.FptrMapUintptrFloat64 == nil {
- yyn1526 = true
- goto LABEL1526
- }
- LABEL1526:
- if yyr2 || yy2arr2 {
- if yyn1526 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintptrFloat64 == nil {
- r.EncodeNil()
- } else {
- yy1527 := *x.FptrMapUintptrFloat64
- if false {
- } else {
- z.F.EncMapUintptrFloat64V(yy1527, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrFloat64`)
- r.WriteMapElemValue()
- if yyn1526 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintptrFloat64 == nil {
- r.EncodeNil()
- } else {
- yy1529 := *x.FptrMapUintptrFloat64
- if false {
- } else {
- z.F.EncMapUintptrFloat64V(yy1529, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapUintptrBool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrBoolV(x.FMapUintptrBool, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapUintptrBool`)
- r.WriteMapElemValue()
- if x.FMapUintptrBool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapUintptrBoolV(x.FMapUintptrBool, e)
- }
- }
- }
- var yyn1534 bool
- if x.FptrMapUintptrBool == nil {
- yyn1534 = true
- goto LABEL1534
- }
- LABEL1534:
- if yyr2 || yy2arr2 {
- if yyn1534 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapUintptrBool == nil {
- r.EncodeNil()
- } else {
- yy1535 := *x.FptrMapUintptrBool
- if false {
- } else {
- z.F.EncMapUintptrBoolV(yy1535, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrBool`)
- r.WriteMapElemValue()
- if yyn1534 {
- r.EncodeNil()
- } else {
- if x.FptrMapUintptrBool == nil {
- r.EncodeNil()
- } else {
- yy1537 := *x.FptrMapUintptrBool
- if false {
- } else {
- z.F.EncMapUintptrBoolV(yy1537, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntIntf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntIntfV(x.FMapIntIntf, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntIntf`)
- r.WriteMapElemValue()
- if x.FMapIntIntf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntIntfV(x.FMapIntIntf, e)
- }
- }
- }
- var yyn1542 bool
- if x.FptrMapIntIntf == nil {
- yyn1542 = true
- goto LABEL1542
- }
- LABEL1542:
- if yyr2 || yy2arr2 {
- if yyn1542 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntIntf == nil {
- r.EncodeNil()
- } else {
- yy1543 := *x.FptrMapIntIntf
- if false {
- } else {
- z.F.EncMapIntIntfV(yy1543, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntIntf`)
- r.WriteMapElemValue()
- if yyn1542 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntIntf == nil {
- r.EncodeNil()
- } else {
- yy1545 := *x.FptrMapIntIntf
- if false {
- } else {
- z.F.EncMapIntIntfV(yy1545, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntString == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntStringV(x.FMapIntString, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntString`)
- r.WriteMapElemValue()
- if x.FMapIntString == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntStringV(x.FMapIntString, e)
- }
- }
- }
- var yyn1550 bool
- if x.FptrMapIntString == nil {
- yyn1550 = true
- goto LABEL1550
- }
- LABEL1550:
- if yyr2 || yy2arr2 {
- if yyn1550 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntString == nil {
- r.EncodeNil()
- } else {
- yy1551 := *x.FptrMapIntString
- if false {
- } else {
- z.F.EncMapIntStringV(yy1551, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntString`)
- r.WriteMapElemValue()
- if yyn1550 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntString == nil {
- r.EncodeNil()
- } else {
- yy1553 := *x.FptrMapIntString
- if false {
- } else {
- z.F.EncMapIntStringV(yy1553, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntUint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntUintV(x.FMapIntUint, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntUint`)
- r.WriteMapElemValue()
- if x.FMapIntUint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntUintV(x.FMapIntUint, e)
- }
- }
- }
- var yyn1558 bool
- if x.FptrMapIntUint == nil {
- yyn1558 = true
- goto LABEL1558
- }
- LABEL1558:
- if yyr2 || yy2arr2 {
- if yyn1558 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntUint == nil {
- r.EncodeNil()
- } else {
- yy1559 := *x.FptrMapIntUint
- if false {
- } else {
- z.F.EncMapIntUintV(yy1559, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntUint`)
- r.WriteMapElemValue()
- if yyn1558 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntUint == nil {
- r.EncodeNil()
- } else {
- yy1561 := *x.FptrMapIntUint
- if false {
- } else {
- z.F.EncMapIntUintV(yy1561, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntUint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntUint8V(x.FMapIntUint8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntUint8`)
- r.WriteMapElemValue()
- if x.FMapIntUint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntUint8V(x.FMapIntUint8, e)
- }
- }
- }
- var yyn1566 bool
- if x.FptrMapIntUint8 == nil {
- yyn1566 = true
- goto LABEL1566
- }
- LABEL1566:
- if yyr2 || yy2arr2 {
- if yyn1566 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntUint8 == nil {
- r.EncodeNil()
- } else {
- yy1567 := *x.FptrMapIntUint8
- if false {
- } else {
- z.F.EncMapIntUint8V(yy1567, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntUint8`)
- r.WriteMapElemValue()
- if yyn1566 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntUint8 == nil {
- r.EncodeNil()
- } else {
- yy1569 := *x.FptrMapIntUint8
- if false {
- } else {
- z.F.EncMapIntUint8V(yy1569, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntUint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntUint16V(x.FMapIntUint16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntUint16`)
- r.WriteMapElemValue()
- if x.FMapIntUint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntUint16V(x.FMapIntUint16, e)
- }
- }
- }
- var yyn1574 bool
- if x.FptrMapIntUint16 == nil {
- yyn1574 = true
- goto LABEL1574
- }
- LABEL1574:
- if yyr2 || yy2arr2 {
- if yyn1574 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntUint16 == nil {
- r.EncodeNil()
- } else {
- yy1575 := *x.FptrMapIntUint16
- if false {
- } else {
- z.F.EncMapIntUint16V(yy1575, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntUint16`)
- r.WriteMapElemValue()
- if yyn1574 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntUint16 == nil {
- r.EncodeNil()
- } else {
- yy1577 := *x.FptrMapIntUint16
- if false {
- } else {
- z.F.EncMapIntUint16V(yy1577, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntUint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntUint32V(x.FMapIntUint32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntUint32`)
- r.WriteMapElemValue()
- if x.FMapIntUint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntUint32V(x.FMapIntUint32, e)
- }
- }
- }
- var yyn1582 bool
- if x.FptrMapIntUint32 == nil {
- yyn1582 = true
- goto LABEL1582
- }
- LABEL1582:
- if yyr2 || yy2arr2 {
- if yyn1582 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntUint32 == nil {
- r.EncodeNil()
- } else {
- yy1583 := *x.FptrMapIntUint32
- if false {
- } else {
- z.F.EncMapIntUint32V(yy1583, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntUint32`)
- r.WriteMapElemValue()
- if yyn1582 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntUint32 == nil {
- r.EncodeNil()
- } else {
- yy1585 := *x.FptrMapIntUint32
- if false {
- } else {
- z.F.EncMapIntUint32V(yy1585, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntUint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntUint64V(x.FMapIntUint64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntUint64`)
- r.WriteMapElemValue()
- if x.FMapIntUint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntUint64V(x.FMapIntUint64, e)
- }
- }
- }
- var yyn1590 bool
- if x.FptrMapIntUint64 == nil {
- yyn1590 = true
- goto LABEL1590
- }
- LABEL1590:
- if yyr2 || yy2arr2 {
- if yyn1590 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntUint64 == nil {
- r.EncodeNil()
- } else {
- yy1591 := *x.FptrMapIntUint64
- if false {
- } else {
- z.F.EncMapIntUint64V(yy1591, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntUint64`)
- r.WriteMapElemValue()
- if yyn1590 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntUint64 == nil {
- r.EncodeNil()
- } else {
- yy1593 := *x.FptrMapIntUint64
- if false {
- } else {
- z.F.EncMapIntUint64V(yy1593, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntUintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntUintptrV(x.FMapIntUintptr, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntUintptr`)
- r.WriteMapElemValue()
- if x.FMapIntUintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntUintptrV(x.FMapIntUintptr, e)
- }
- }
- }
- var yyn1598 bool
- if x.FptrMapIntUintptr == nil {
- yyn1598 = true
- goto LABEL1598
- }
- LABEL1598:
- if yyr2 || yy2arr2 {
- if yyn1598 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntUintptr == nil {
- r.EncodeNil()
- } else {
- yy1599 := *x.FptrMapIntUintptr
- if false {
- } else {
- z.F.EncMapIntUintptrV(yy1599, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntUintptr`)
- r.WriteMapElemValue()
- if yyn1598 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntUintptr == nil {
- r.EncodeNil()
- } else {
- yy1601 := *x.FptrMapIntUintptr
- if false {
- } else {
- z.F.EncMapIntUintptrV(yy1601, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntInt == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntIntV(x.FMapIntInt, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntInt`)
- r.WriteMapElemValue()
- if x.FMapIntInt == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntIntV(x.FMapIntInt, e)
- }
- }
- }
- var yyn1606 bool
- if x.FptrMapIntInt == nil {
- yyn1606 = true
- goto LABEL1606
- }
- LABEL1606:
- if yyr2 || yy2arr2 {
- if yyn1606 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntInt == nil {
- r.EncodeNil()
- } else {
- yy1607 := *x.FptrMapIntInt
- if false {
- } else {
- z.F.EncMapIntIntV(yy1607, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntInt`)
- r.WriteMapElemValue()
- if yyn1606 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntInt == nil {
- r.EncodeNil()
- } else {
- yy1609 := *x.FptrMapIntInt
- if false {
- } else {
- z.F.EncMapIntIntV(yy1609, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntInt8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntInt8V(x.FMapIntInt8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntInt8`)
- r.WriteMapElemValue()
- if x.FMapIntInt8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntInt8V(x.FMapIntInt8, e)
- }
- }
- }
- var yyn1614 bool
- if x.FptrMapIntInt8 == nil {
- yyn1614 = true
- goto LABEL1614
- }
- LABEL1614:
- if yyr2 || yy2arr2 {
- if yyn1614 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntInt8 == nil {
- r.EncodeNil()
- } else {
- yy1615 := *x.FptrMapIntInt8
- if false {
- } else {
- z.F.EncMapIntInt8V(yy1615, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntInt8`)
- r.WriteMapElemValue()
- if yyn1614 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntInt8 == nil {
- r.EncodeNil()
- } else {
- yy1617 := *x.FptrMapIntInt8
- if false {
- } else {
- z.F.EncMapIntInt8V(yy1617, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntInt16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntInt16V(x.FMapIntInt16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntInt16`)
- r.WriteMapElemValue()
- if x.FMapIntInt16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntInt16V(x.FMapIntInt16, e)
- }
- }
- }
- var yyn1622 bool
- if x.FptrMapIntInt16 == nil {
- yyn1622 = true
- goto LABEL1622
- }
- LABEL1622:
- if yyr2 || yy2arr2 {
- if yyn1622 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntInt16 == nil {
- r.EncodeNil()
- } else {
- yy1623 := *x.FptrMapIntInt16
- if false {
- } else {
- z.F.EncMapIntInt16V(yy1623, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntInt16`)
- r.WriteMapElemValue()
- if yyn1622 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntInt16 == nil {
- r.EncodeNil()
- } else {
- yy1625 := *x.FptrMapIntInt16
- if false {
- } else {
- z.F.EncMapIntInt16V(yy1625, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntInt32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntInt32V(x.FMapIntInt32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntInt32`)
- r.WriteMapElemValue()
- if x.FMapIntInt32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntInt32V(x.FMapIntInt32, e)
- }
- }
- }
- var yyn1630 bool
- if x.FptrMapIntInt32 == nil {
- yyn1630 = true
- goto LABEL1630
- }
- LABEL1630:
- if yyr2 || yy2arr2 {
- if yyn1630 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntInt32 == nil {
- r.EncodeNil()
- } else {
- yy1631 := *x.FptrMapIntInt32
- if false {
- } else {
- z.F.EncMapIntInt32V(yy1631, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntInt32`)
- r.WriteMapElemValue()
- if yyn1630 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntInt32 == nil {
- r.EncodeNil()
- } else {
- yy1633 := *x.FptrMapIntInt32
- if false {
- } else {
- z.F.EncMapIntInt32V(yy1633, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntInt64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntInt64V(x.FMapIntInt64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntInt64`)
- r.WriteMapElemValue()
- if x.FMapIntInt64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntInt64V(x.FMapIntInt64, e)
- }
- }
- }
- var yyn1638 bool
- if x.FptrMapIntInt64 == nil {
- yyn1638 = true
- goto LABEL1638
- }
- LABEL1638:
- if yyr2 || yy2arr2 {
- if yyn1638 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntInt64 == nil {
- r.EncodeNil()
- } else {
- yy1639 := *x.FptrMapIntInt64
- if false {
- } else {
- z.F.EncMapIntInt64V(yy1639, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntInt64`)
- r.WriteMapElemValue()
- if yyn1638 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntInt64 == nil {
- r.EncodeNil()
- } else {
- yy1641 := *x.FptrMapIntInt64
- if false {
- } else {
- z.F.EncMapIntInt64V(yy1641, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntFloat32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntFloat32V(x.FMapIntFloat32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntFloat32`)
- r.WriteMapElemValue()
- if x.FMapIntFloat32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntFloat32V(x.FMapIntFloat32, e)
- }
- }
- }
- var yyn1646 bool
- if x.FptrMapIntFloat32 == nil {
- yyn1646 = true
- goto LABEL1646
- }
- LABEL1646:
- if yyr2 || yy2arr2 {
- if yyn1646 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntFloat32 == nil {
- r.EncodeNil()
- } else {
- yy1647 := *x.FptrMapIntFloat32
- if false {
- } else {
- z.F.EncMapIntFloat32V(yy1647, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntFloat32`)
- r.WriteMapElemValue()
- if yyn1646 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntFloat32 == nil {
- r.EncodeNil()
- } else {
- yy1649 := *x.FptrMapIntFloat32
- if false {
- } else {
- z.F.EncMapIntFloat32V(yy1649, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntFloat64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntFloat64V(x.FMapIntFloat64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntFloat64`)
- r.WriteMapElemValue()
- if x.FMapIntFloat64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntFloat64V(x.FMapIntFloat64, e)
- }
- }
- }
- var yyn1654 bool
- if x.FptrMapIntFloat64 == nil {
- yyn1654 = true
- goto LABEL1654
- }
- LABEL1654:
- if yyr2 || yy2arr2 {
- if yyn1654 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntFloat64 == nil {
- r.EncodeNil()
- } else {
- yy1655 := *x.FptrMapIntFloat64
- if false {
- } else {
- z.F.EncMapIntFloat64V(yy1655, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntFloat64`)
- r.WriteMapElemValue()
- if yyn1654 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntFloat64 == nil {
- r.EncodeNil()
- } else {
- yy1657 := *x.FptrMapIntFloat64
- if false {
- } else {
- z.F.EncMapIntFloat64V(yy1657, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapIntBool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntBoolV(x.FMapIntBool, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapIntBool`)
- r.WriteMapElemValue()
- if x.FMapIntBool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapIntBoolV(x.FMapIntBool, e)
- }
- }
- }
- var yyn1662 bool
- if x.FptrMapIntBool == nil {
- yyn1662 = true
- goto LABEL1662
- }
- LABEL1662:
- if yyr2 || yy2arr2 {
- if yyn1662 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapIntBool == nil {
- r.EncodeNil()
- } else {
- yy1663 := *x.FptrMapIntBool
- if false {
- } else {
- z.F.EncMapIntBoolV(yy1663, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapIntBool`)
- r.WriteMapElemValue()
- if yyn1662 {
- r.EncodeNil()
- } else {
- if x.FptrMapIntBool == nil {
- r.EncodeNil()
- } else {
- yy1665 := *x.FptrMapIntBool
- if false {
- } else {
- z.F.EncMapIntBoolV(yy1665, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt8Intf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8IntfV(x.FMapInt8Intf, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt8Intf`)
- r.WriteMapElemValue()
- if x.FMapInt8Intf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8IntfV(x.FMapInt8Intf, e)
- }
- }
- }
- var yyn1670 bool
- if x.FptrMapInt8Intf == nil {
- yyn1670 = true
- goto LABEL1670
- }
- LABEL1670:
- if yyr2 || yy2arr2 {
- if yyn1670 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt8Intf == nil {
- r.EncodeNil()
- } else {
- yy1671 := *x.FptrMapInt8Intf
- if false {
- } else {
- z.F.EncMapInt8IntfV(yy1671, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Intf`)
- r.WriteMapElemValue()
- if yyn1670 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt8Intf == nil {
- r.EncodeNil()
- } else {
- yy1673 := *x.FptrMapInt8Intf
- if false {
- } else {
- z.F.EncMapInt8IntfV(yy1673, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt8String == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8StringV(x.FMapInt8String, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt8String`)
- r.WriteMapElemValue()
- if x.FMapInt8String == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8StringV(x.FMapInt8String, e)
- }
- }
- }
- var yyn1678 bool
- if x.FptrMapInt8String == nil {
- yyn1678 = true
- goto LABEL1678
- }
- LABEL1678:
- if yyr2 || yy2arr2 {
- if yyn1678 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt8String == nil {
- r.EncodeNil()
- } else {
- yy1679 := *x.FptrMapInt8String
- if false {
- } else {
- z.F.EncMapInt8StringV(yy1679, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8String`)
- r.WriteMapElemValue()
- if yyn1678 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt8String == nil {
- r.EncodeNil()
- } else {
- yy1681 := *x.FptrMapInt8String
- if false {
- } else {
- z.F.EncMapInt8StringV(yy1681, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt8Uint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8UintV(x.FMapInt8Uint, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt8Uint`)
- r.WriteMapElemValue()
- if x.FMapInt8Uint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8UintV(x.FMapInt8Uint, e)
- }
- }
- }
- var yyn1686 bool
- if x.FptrMapInt8Uint == nil {
- yyn1686 = true
- goto LABEL1686
- }
- LABEL1686:
- if yyr2 || yy2arr2 {
- if yyn1686 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt8Uint == nil {
- r.EncodeNil()
- } else {
- yy1687 := *x.FptrMapInt8Uint
- if false {
- } else {
- z.F.EncMapInt8UintV(yy1687, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Uint`)
- r.WriteMapElemValue()
- if yyn1686 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt8Uint == nil {
- r.EncodeNil()
- } else {
- yy1689 := *x.FptrMapInt8Uint
- if false {
- } else {
- z.F.EncMapInt8UintV(yy1689, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt8Uint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8Uint8V(x.FMapInt8Uint8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt8Uint8`)
- r.WriteMapElemValue()
- if x.FMapInt8Uint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8Uint8V(x.FMapInt8Uint8, e)
- }
- }
- }
- var yyn1694 bool
- if x.FptrMapInt8Uint8 == nil {
- yyn1694 = true
- goto LABEL1694
- }
- LABEL1694:
- if yyr2 || yy2arr2 {
- if yyn1694 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt8Uint8 == nil {
- r.EncodeNil()
- } else {
- yy1695 := *x.FptrMapInt8Uint8
- if false {
- } else {
- z.F.EncMapInt8Uint8V(yy1695, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Uint8`)
- r.WriteMapElemValue()
- if yyn1694 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt8Uint8 == nil {
- r.EncodeNil()
- } else {
- yy1697 := *x.FptrMapInt8Uint8
- if false {
- } else {
- z.F.EncMapInt8Uint8V(yy1697, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt8Uint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8Uint16V(x.FMapInt8Uint16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt8Uint16`)
- r.WriteMapElemValue()
- if x.FMapInt8Uint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8Uint16V(x.FMapInt8Uint16, e)
- }
- }
- }
- var yyn1702 bool
- if x.FptrMapInt8Uint16 == nil {
- yyn1702 = true
- goto LABEL1702
- }
- LABEL1702:
- if yyr2 || yy2arr2 {
- if yyn1702 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt8Uint16 == nil {
- r.EncodeNil()
- } else {
- yy1703 := *x.FptrMapInt8Uint16
- if false {
- } else {
- z.F.EncMapInt8Uint16V(yy1703, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Uint16`)
- r.WriteMapElemValue()
- if yyn1702 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt8Uint16 == nil {
- r.EncodeNil()
- } else {
- yy1705 := *x.FptrMapInt8Uint16
- if false {
- } else {
- z.F.EncMapInt8Uint16V(yy1705, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt8Uint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8Uint32V(x.FMapInt8Uint32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt8Uint32`)
- r.WriteMapElemValue()
- if x.FMapInt8Uint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8Uint32V(x.FMapInt8Uint32, e)
- }
- }
- }
- var yyn1710 bool
- if x.FptrMapInt8Uint32 == nil {
- yyn1710 = true
- goto LABEL1710
- }
- LABEL1710:
- if yyr2 || yy2arr2 {
- if yyn1710 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt8Uint32 == nil {
- r.EncodeNil()
- } else {
- yy1711 := *x.FptrMapInt8Uint32
- if false {
- } else {
- z.F.EncMapInt8Uint32V(yy1711, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Uint32`)
- r.WriteMapElemValue()
- if yyn1710 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt8Uint32 == nil {
- r.EncodeNil()
- } else {
- yy1713 := *x.FptrMapInt8Uint32
- if false {
- } else {
- z.F.EncMapInt8Uint32V(yy1713, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt8Uint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8Uint64V(x.FMapInt8Uint64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt8Uint64`)
- r.WriteMapElemValue()
- if x.FMapInt8Uint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8Uint64V(x.FMapInt8Uint64, e)
- }
- }
- }
- var yyn1718 bool
- if x.FptrMapInt8Uint64 == nil {
- yyn1718 = true
- goto LABEL1718
- }
- LABEL1718:
- if yyr2 || yy2arr2 {
- if yyn1718 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt8Uint64 == nil {
- r.EncodeNil()
- } else {
- yy1719 := *x.FptrMapInt8Uint64
- if false {
- } else {
- z.F.EncMapInt8Uint64V(yy1719, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Uint64`)
- r.WriteMapElemValue()
- if yyn1718 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt8Uint64 == nil {
- r.EncodeNil()
- } else {
- yy1721 := *x.FptrMapInt8Uint64
- if false {
- } else {
- z.F.EncMapInt8Uint64V(yy1721, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt8Uintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8UintptrV(x.FMapInt8Uintptr, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt8Uintptr`)
- r.WriteMapElemValue()
- if x.FMapInt8Uintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8UintptrV(x.FMapInt8Uintptr, e)
- }
- }
- }
- var yyn1726 bool
- if x.FptrMapInt8Uintptr == nil {
- yyn1726 = true
- goto LABEL1726
- }
- LABEL1726:
- if yyr2 || yy2arr2 {
- if yyn1726 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt8Uintptr == nil {
- r.EncodeNil()
- } else {
- yy1727 := *x.FptrMapInt8Uintptr
- if false {
- } else {
- z.F.EncMapInt8UintptrV(yy1727, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Uintptr`)
- r.WriteMapElemValue()
- if yyn1726 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt8Uintptr == nil {
- r.EncodeNil()
- } else {
- yy1729 := *x.FptrMapInt8Uintptr
- if false {
- } else {
- z.F.EncMapInt8UintptrV(yy1729, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt8Int == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8IntV(x.FMapInt8Int, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt8Int`)
- r.WriteMapElemValue()
- if x.FMapInt8Int == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8IntV(x.FMapInt8Int, e)
- }
- }
- }
- var yyn1734 bool
- if x.FptrMapInt8Int == nil {
- yyn1734 = true
- goto LABEL1734
- }
- LABEL1734:
- if yyr2 || yy2arr2 {
- if yyn1734 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt8Int == nil {
- r.EncodeNil()
- } else {
- yy1735 := *x.FptrMapInt8Int
- if false {
- } else {
- z.F.EncMapInt8IntV(yy1735, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Int`)
- r.WriteMapElemValue()
- if yyn1734 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt8Int == nil {
- r.EncodeNil()
- } else {
- yy1737 := *x.FptrMapInt8Int
- if false {
- } else {
- z.F.EncMapInt8IntV(yy1737, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt8Int8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8Int8V(x.FMapInt8Int8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt8Int8`)
- r.WriteMapElemValue()
- if x.FMapInt8Int8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8Int8V(x.FMapInt8Int8, e)
- }
- }
- }
- var yyn1742 bool
- if x.FptrMapInt8Int8 == nil {
- yyn1742 = true
- goto LABEL1742
- }
- LABEL1742:
- if yyr2 || yy2arr2 {
- if yyn1742 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt8Int8 == nil {
- r.EncodeNil()
- } else {
- yy1743 := *x.FptrMapInt8Int8
- if false {
- } else {
- z.F.EncMapInt8Int8V(yy1743, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Int8`)
- r.WriteMapElemValue()
- if yyn1742 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt8Int8 == nil {
- r.EncodeNil()
- } else {
- yy1745 := *x.FptrMapInt8Int8
- if false {
- } else {
- z.F.EncMapInt8Int8V(yy1745, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt8Int16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8Int16V(x.FMapInt8Int16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt8Int16`)
- r.WriteMapElemValue()
- if x.FMapInt8Int16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8Int16V(x.FMapInt8Int16, e)
- }
- }
- }
- var yyn1750 bool
- if x.FptrMapInt8Int16 == nil {
- yyn1750 = true
- goto LABEL1750
- }
- LABEL1750:
- if yyr2 || yy2arr2 {
- if yyn1750 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt8Int16 == nil {
- r.EncodeNil()
- } else {
- yy1751 := *x.FptrMapInt8Int16
- if false {
- } else {
- z.F.EncMapInt8Int16V(yy1751, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Int16`)
- r.WriteMapElemValue()
- if yyn1750 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt8Int16 == nil {
- r.EncodeNil()
- } else {
- yy1753 := *x.FptrMapInt8Int16
- if false {
- } else {
- z.F.EncMapInt8Int16V(yy1753, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt8Int32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8Int32V(x.FMapInt8Int32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt8Int32`)
- r.WriteMapElemValue()
- if x.FMapInt8Int32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8Int32V(x.FMapInt8Int32, e)
- }
- }
- }
- var yyn1758 bool
- if x.FptrMapInt8Int32 == nil {
- yyn1758 = true
- goto LABEL1758
- }
- LABEL1758:
- if yyr2 || yy2arr2 {
- if yyn1758 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt8Int32 == nil {
- r.EncodeNil()
- } else {
- yy1759 := *x.FptrMapInt8Int32
- if false {
- } else {
- z.F.EncMapInt8Int32V(yy1759, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Int32`)
- r.WriteMapElemValue()
- if yyn1758 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt8Int32 == nil {
- r.EncodeNil()
- } else {
- yy1761 := *x.FptrMapInt8Int32
- if false {
- } else {
- z.F.EncMapInt8Int32V(yy1761, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt8Int64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8Int64V(x.FMapInt8Int64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt8Int64`)
- r.WriteMapElemValue()
- if x.FMapInt8Int64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8Int64V(x.FMapInt8Int64, e)
- }
- }
- }
- var yyn1766 bool
- if x.FptrMapInt8Int64 == nil {
- yyn1766 = true
- goto LABEL1766
- }
- LABEL1766:
- if yyr2 || yy2arr2 {
- if yyn1766 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt8Int64 == nil {
- r.EncodeNil()
- } else {
- yy1767 := *x.FptrMapInt8Int64
- if false {
- } else {
- z.F.EncMapInt8Int64V(yy1767, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Int64`)
- r.WriteMapElemValue()
- if yyn1766 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt8Int64 == nil {
- r.EncodeNil()
- } else {
- yy1769 := *x.FptrMapInt8Int64
- if false {
- } else {
- z.F.EncMapInt8Int64V(yy1769, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt8Float32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8Float32V(x.FMapInt8Float32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt8Float32`)
- r.WriteMapElemValue()
- if x.FMapInt8Float32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8Float32V(x.FMapInt8Float32, e)
- }
- }
- }
- var yyn1774 bool
- if x.FptrMapInt8Float32 == nil {
- yyn1774 = true
- goto LABEL1774
- }
- LABEL1774:
- if yyr2 || yy2arr2 {
- if yyn1774 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt8Float32 == nil {
- r.EncodeNil()
- } else {
- yy1775 := *x.FptrMapInt8Float32
- if false {
- } else {
- z.F.EncMapInt8Float32V(yy1775, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Float32`)
- r.WriteMapElemValue()
- if yyn1774 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt8Float32 == nil {
- r.EncodeNil()
- } else {
- yy1777 := *x.FptrMapInt8Float32
- if false {
- } else {
- z.F.EncMapInt8Float32V(yy1777, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt8Float64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8Float64V(x.FMapInt8Float64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt8Float64`)
- r.WriteMapElemValue()
- if x.FMapInt8Float64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8Float64V(x.FMapInt8Float64, e)
- }
- }
- }
- var yyn1782 bool
- if x.FptrMapInt8Float64 == nil {
- yyn1782 = true
- goto LABEL1782
- }
- LABEL1782:
- if yyr2 || yy2arr2 {
- if yyn1782 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt8Float64 == nil {
- r.EncodeNil()
- } else {
- yy1783 := *x.FptrMapInt8Float64
- if false {
- } else {
- z.F.EncMapInt8Float64V(yy1783, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Float64`)
- r.WriteMapElemValue()
- if yyn1782 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt8Float64 == nil {
- r.EncodeNil()
- } else {
- yy1785 := *x.FptrMapInt8Float64
- if false {
- } else {
- z.F.EncMapInt8Float64V(yy1785, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt8Bool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8BoolV(x.FMapInt8Bool, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt8Bool`)
- r.WriteMapElemValue()
- if x.FMapInt8Bool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt8BoolV(x.FMapInt8Bool, e)
- }
- }
- }
- var yyn1790 bool
- if x.FptrMapInt8Bool == nil {
- yyn1790 = true
- goto LABEL1790
- }
- LABEL1790:
- if yyr2 || yy2arr2 {
- if yyn1790 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt8Bool == nil {
- r.EncodeNil()
- } else {
- yy1791 := *x.FptrMapInt8Bool
- if false {
- } else {
- z.F.EncMapInt8BoolV(yy1791, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Bool`)
- r.WriteMapElemValue()
- if yyn1790 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt8Bool == nil {
- r.EncodeNil()
- } else {
- yy1793 := *x.FptrMapInt8Bool
- if false {
- } else {
- z.F.EncMapInt8BoolV(yy1793, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt16Intf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16IntfV(x.FMapInt16Intf, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt16Intf`)
- r.WriteMapElemValue()
- if x.FMapInt16Intf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16IntfV(x.FMapInt16Intf, e)
- }
- }
- }
- var yyn1798 bool
- if x.FptrMapInt16Intf == nil {
- yyn1798 = true
- goto LABEL1798
- }
- LABEL1798:
- if yyr2 || yy2arr2 {
- if yyn1798 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt16Intf == nil {
- r.EncodeNil()
- } else {
- yy1799 := *x.FptrMapInt16Intf
- if false {
- } else {
- z.F.EncMapInt16IntfV(yy1799, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Intf`)
- r.WriteMapElemValue()
- if yyn1798 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt16Intf == nil {
- r.EncodeNil()
- } else {
- yy1801 := *x.FptrMapInt16Intf
- if false {
- } else {
- z.F.EncMapInt16IntfV(yy1801, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt16String == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16StringV(x.FMapInt16String, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt16String`)
- r.WriteMapElemValue()
- if x.FMapInt16String == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16StringV(x.FMapInt16String, e)
- }
- }
- }
- var yyn1806 bool
- if x.FptrMapInt16String == nil {
- yyn1806 = true
- goto LABEL1806
- }
- LABEL1806:
- if yyr2 || yy2arr2 {
- if yyn1806 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt16String == nil {
- r.EncodeNil()
- } else {
- yy1807 := *x.FptrMapInt16String
- if false {
- } else {
- z.F.EncMapInt16StringV(yy1807, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16String`)
- r.WriteMapElemValue()
- if yyn1806 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt16String == nil {
- r.EncodeNil()
- } else {
- yy1809 := *x.FptrMapInt16String
- if false {
- } else {
- z.F.EncMapInt16StringV(yy1809, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt16Uint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16UintV(x.FMapInt16Uint, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt16Uint`)
- r.WriteMapElemValue()
- if x.FMapInt16Uint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16UintV(x.FMapInt16Uint, e)
- }
- }
- }
- var yyn1814 bool
- if x.FptrMapInt16Uint == nil {
- yyn1814 = true
- goto LABEL1814
- }
- LABEL1814:
- if yyr2 || yy2arr2 {
- if yyn1814 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt16Uint == nil {
- r.EncodeNil()
- } else {
- yy1815 := *x.FptrMapInt16Uint
- if false {
- } else {
- z.F.EncMapInt16UintV(yy1815, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Uint`)
- r.WriteMapElemValue()
- if yyn1814 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt16Uint == nil {
- r.EncodeNil()
- } else {
- yy1817 := *x.FptrMapInt16Uint
- if false {
- } else {
- z.F.EncMapInt16UintV(yy1817, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt16Uint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16Uint8V(x.FMapInt16Uint8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt16Uint8`)
- r.WriteMapElemValue()
- if x.FMapInt16Uint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16Uint8V(x.FMapInt16Uint8, e)
- }
- }
- }
- var yyn1822 bool
- if x.FptrMapInt16Uint8 == nil {
- yyn1822 = true
- goto LABEL1822
- }
- LABEL1822:
- if yyr2 || yy2arr2 {
- if yyn1822 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt16Uint8 == nil {
- r.EncodeNil()
- } else {
- yy1823 := *x.FptrMapInt16Uint8
- if false {
- } else {
- z.F.EncMapInt16Uint8V(yy1823, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Uint8`)
- r.WriteMapElemValue()
- if yyn1822 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt16Uint8 == nil {
- r.EncodeNil()
- } else {
- yy1825 := *x.FptrMapInt16Uint8
- if false {
- } else {
- z.F.EncMapInt16Uint8V(yy1825, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt16Uint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16Uint16V(x.FMapInt16Uint16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt16Uint16`)
- r.WriteMapElemValue()
- if x.FMapInt16Uint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16Uint16V(x.FMapInt16Uint16, e)
- }
- }
- }
- var yyn1830 bool
- if x.FptrMapInt16Uint16 == nil {
- yyn1830 = true
- goto LABEL1830
- }
- LABEL1830:
- if yyr2 || yy2arr2 {
- if yyn1830 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt16Uint16 == nil {
- r.EncodeNil()
- } else {
- yy1831 := *x.FptrMapInt16Uint16
- if false {
- } else {
- z.F.EncMapInt16Uint16V(yy1831, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Uint16`)
- r.WriteMapElemValue()
- if yyn1830 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt16Uint16 == nil {
- r.EncodeNil()
- } else {
- yy1833 := *x.FptrMapInt16Uint16
- if false {
- } else {
- z.F.EncMapInt16Uint16V(yy1833, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt16Uint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16Uint32V(x.FMapInt16Uint32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt16Uint32`)
- r.WriteMapElemValue()
- if x.FMapInt16Uint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16Uint32V(x.FMapInt16Uint32, e)
- }
- }
- }
- var yyn1838 bool
- if x.FptrMapInt16Uint32 == nil {
- yyn1838 = true
- goto LABEL1838
- }
- LABEL1838:
- if yyr2 || yy2arr2 {
- if yyn1838 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt16Uint32 == nil {
- r.EncodeNil()
- } else {
- yy1839 := *x.FptrMapInt16Uint32
- if false {
- } else {
- z.F.EncMapInt16Uint32V(yy1839, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Uint32`)
- r.WriteMapElemValue()
- if yyn1838 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt16Uint32 == nil {
- r.EncodeNil()
- } else {
- yy1841 := *x.FptrMapInt16Uint32
- if false {
- } else {
- z.F.EncMapInt16Uint32V(yy1841, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt16Uint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16Uint64V(x.FMapInt16Uint64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt16Uint64`)
- r.WriteMapElemValue()
- if x.FMapInt16Uint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16Uint64V(x.FMapInt16Uint64, e)
- }
- }
- }
- var yyn1846 bool
- if x.FptrMapInt16Uint64 == nil {
- yyn1846 = true
- goto LABEL1846
- }
- LABEL1846:
- if yyr2 || yy2arr2 {
- if yyn1846 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt16Uint64 == nil {
- r.EncodeNil()
- } else {
- yy1847 := *x.FptrMapInt16Uint64
- if false {
- } else {
- z.F.EncMapInt16Uint64V(yy1847, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Uint64`)
- r.WriteMapElemValue()
- if yyn1846 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt16Uint64 == nil {
- r.EncodeNil()
- } else {
- yy1849 := *x.FptrMapInt16Uint64
- if false {
- } else {
- z.F.EncMapInt16Uint64V(yy1849, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt16Uintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16UintptrV(x.FMapInt16Uintptr, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt16Uintptr`)
- r.WriteMapElemValue()
- if x.FMapInt16Uintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16UintptrV(x.FMapInt16Uintptr, e)
- }
- }
- }
- var yyn1854 bool
- if x.FptrMapInt16Uintptr == nil {
- yyn1854 = true
- goto LABEL1854
- }
- LABEL1854:
- if yyr2 || yy2arr2 {
- if yyn1854 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt16Uintptr == nil {
- r.EncodeNil()
- } else {
- yy1855 := *x.FptrMapInt16Uintptr
- if false {
- } else {
- z.F.EncMapInt16UintptrV(yy1855, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Uintptr`)
- r.WriteMapElemValue()
- if yyn1854 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt16Uintptr == nil {
- r.EncodeNil()
- } else {
- yy1857 := *x.FptrMapInt16Uintptr
- if false {
- } else {
- z.F.EncMapInt16UintptrV(yy1857, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt16Int == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16IntV(x.FMapInt16Int, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt16Int`)
- r.WriteMapElemValue()
- if x.FMapInt16Int == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16IntV(x.FMapInt16Int, e)
- }
- }
- }
- var yyn1862 bool
- if x.FptrMapInt16Int == nil {
- yyn1862 = true
- goto LABEL1862
- }
- LABEL1862:
- if yyr2 || yy2arr2 {
- if yyn1862 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt16Int == nil {
- r.EncodeNil()
- } else {
- yy1863 := *x.FptrMapInt16Int
- if false {
- } else {
- z.F.EncMapInt16IntV(yy1863, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Int`)
- r.WriteMapElemValue()
- if yyn1862 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt16Int == nil {
- r.EncodeNil()
- } else {
- yy1865 := *x.FptrMapInt16Int
- if false {
- } else {
- z.F.EncMapInt16IntV(yy1865, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt16Int8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16Int8V(x.FMapInt16Int8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt16Int8`)
- r.WriteMapElemValue()
- if x.FMapInt16Int8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16Int8V(x.FMapInt16Int8, e)
- }
- }
- }
- var yyn1870 bool
- if x.FptrMapInt16Int8 == nil {
- yyn1870 = true
- goto LABEL1870
- }
- LABEL1870:
- if yyr2 || yy2arr2 {
- if yyn1870 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt16Int8 == nil {
- r.EncodeNil()
- } else {
- yy1871 := *x.FptrMapInt16Int8
- if false {
- } else {
- z.F.EncMapInt16Int8V(yy1871, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Int8`)
- r.WriteMapElemValue()
- if yyn1870 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt16Int8 == nil {
- r.EncodeNil()
- } else {
- yy1873 := *x.FptrMapInt16Int8
- if false {
- } else {
- z.F.EncMapInt16Int8V(yy1873, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt16Int16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16Int16V(x.FMapInt16Int16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt16Int16`)
- r.WriteMapElemValue()
- if x.FMapInt16Int16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16Int16V(x.FMapInt16Int16, e)
- }
- }
- }
- var yyn1878 bool
- if x.FptrMapInt16Int16 == nil {
- yyn1878 = true
- goto LABEL1878
- }
- LABEL1878:
- if yyr2 || yy2arr2 {
- if yyn1878 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt16Int16 == nil {
- r.EncodeNil()
- } else {
- yy1879 := *x.FptrMapInt16Int16
- if false {
- } else {
- z.F.EncMapInt16Int16V(yy1879, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Int16`)
- r.WriteMapElemValue()
- if yyn1878 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt16Int16 == nil {
- r.EncodeNil()
- } else {
- yy1881 := *x.FptrMapInt16Int16
- if false {
- } else {
- z.F.EncMapInt16Int16V(yy1881, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt16Int32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16Int32V(x.FMapInt16Int32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt16Int32`)
- r.WriteMapElemValue()
- if x.FMapInt16Int32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16Int32V(x.FMapInt16Int32, e)
- }
- }
- }
- var yyn1886 bool
- if x.FptrMapInt16Int32 == nil {
- yyn1886 = true
- goto LABEL1886
- }
- LABEL1886:
- if yyr2 || yy2arr2 {
- if yyn1886 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt16Int32 == nil {
- r.EncodeNil()
- } else {
- yy1887 := *x.FptrMapInt16Int32
- if false {
- } else {
- z.F.EncMapInt16Int32V(yy1887, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Int32`)
- r.WriteMapElemValue()
- if yyn1886 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt16Int32 == nil {
- r.EncodeNil()
- } else {
- yy1889 := *x.FptrMapInt16Int32
- if false {
- } else {
- z.F.EncMapInt16Int32V(yy1889, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt16Int64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16Int64V(x.FMapInt16Int64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt16Int64`)
- r.WriteMapElemValue()
- if x.FMapInt16Int64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16Int64V(x.FMapInt16Int64, e)
- }
- }
- }
- var yyn1894 bool
- if x.FptrMapInt16Int64 == nil {
- yyn1894 = true
- goto LABEL1894
- }
- LABEL1894:
- if yyr2 || yy2arr2 {
- if yyn1894 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt16Int64 == nil {
- r.EncodeNil()
- } else {
- yy1895 := *x.FptrMapInt16Int64
- if false {
- } else {
- z.F.EncMapInt16Int64V(yy1895, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Int64`)
- r.WriteMapElemValue()
- if yyn1894 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt16Int64 == nil {
- r.EncodeNil()
- } else {
- yy1897 := *x.FptrMapInt16Int64
- if false {
- } else {
- z.F.EncMapInt16Int64V(yy1897, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt16Float32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16Float32V(x.FMapInt16Float32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt16Float32`)
- r.WriteMapElemValue()
- if x.FMapInt16Float32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16Float32V(x.FMapInt16Float32, e)
- }
- }
- }
- var yyn1902 bool
- if x.FptrMapInt16Float32 == nil {
- yyn1902 = true
- goto LABEL1902
- }
- LABEL1902:
- if yyr2 || yy2arr2 {
- if yyn1902 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt16Float32 == nil {
- r.EncodeNil()
- } else {
- yy1903 := *x.FptrMapInt16Float32
- if false {
- } else {
- z.F.EncMapInt16Float32V(yy1903, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Float32`)
- r.WriteMapElemValue()
- if yyn1902 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt16Float32 == nil {
- r.EncodeNil()
- } else {
- yy1905 := *x.FptrMapInt16Float32
- if false {
- } else {
- z.F.EncMapInt16Float32V(yy1905, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt16Float64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16Float64V(x.FMapInt16Float64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt16Float64`)
- r.WriteMapElemValue()
- if x.FMapInt16Float64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16Float64V(x.FMapInt16Float64, e)
- }
- }
- }
- var yyn1910 bool
- if x.FptrMapInt16Float64 == nil {
- yyn1910 = true
- goto LABEL1910
- }
- LABEL1910:
- if yyr2 || yy2arr2 {
- if yyn1910 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt16Float64 == nil {
- r.EncodeNil()
- } else {
- yy1911 := *x.FptrMapInt16Float64
- if false {
- } else {
- z.F.EncMapInt16Float64V(yy1911, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Float64`)
- r.WriteMapElemValue()
- if yyn1910 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt16Float64 == nil {
- r.EncodeNil()
- } else {
- yy1913 := *x.FptrMapInt16Float64
- if false {
- } else {
- z.F.EncMapInt16Float64V(yy1913, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt16Bool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16BoolV(x.FMapInt16Bool, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt16Bool`)
- r.WriteMapElemValue()
- if x.FMapInt16Bool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt16BoolV(x.FMapInt16Bool, e)
- }
- }
- }
- var yyn1918 bool
- if x.FptrMapInt16Bool == nil {
- yyn1918 = true
- goto LABEL1918
- }
- LABEL1918:
- if yyr2 || yy2arr2 {
- if yyn1918 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt16Bool == nil {
- r.EncodeNil()
- } else {
- yy1919 := *x.FptrMapInt16Bool
- if false {
- } else {
- z.F.EncMapInt16BoolV(yy1919, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Bool`)
- r.WriteMapElemValue()
- if yyn1918 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt16Bool == nil {
- r.EncodeNil()
- } else {
- yy1921 := *x.FptrMapInt16Bool
- if false {
- } else {
- z.F.EncMapInt16BoolV(yy1921, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt32Intf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32IntfV(x.FMapInt32Intf, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt32Intf`)
- r.WriteMapElemValue()
- if x.FMapInt32Intf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32IntfV(x.FMapInt32Intf, e)
- }
- }
- }
- var yyn1926 bool
- if x.FptrMapInt32Intf == nil {
- yyn1926 = true
- goto LABEL1926
- }
- LABEL1926:
- if yyr2 || yy2arr2 {
- if yyn1926 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt32Intf == nil {
- r.EncodeNil()
- } else {
- yy1927 := *x.FptrMapInt32Intf
- if false {
- } else {
- z.F.EncMapInt32IntfV(yy1927, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Intf`)
- r.WriteMapElemValue()
- if yyn1926 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt32Intf == nil {
- r.EncodeNil()
- } else {
- yy1929 := *x.FptrMapInt32Intf
- if false {
- } else {
- z.F.EncMapInt32IntfV(yy1929, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt32String == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32StringV(x.FMapInt32String, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt32String`)
- r.WriteMapElemValue()
- if x.FMapInt32String == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32StringV(x.FMapInt32String, e)
- }
- }
- }
- var yyn1934 bool
- if x.FptrMapInt32String == nil {
- yyn1934 = true
- goto LABEL1934
- }
- LABEL1934:
- if yyr2 || yy2arr2 {
- if yyn1934 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt32String == nil {
- r.EncodeNil()
- } else {
- yy1935 := *x.FptrMapInt32String
- if false {
- } else {
- z.F.EncMapInt32StringV(yy1935, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32String`)
- r.WriteMapElemValue()
- if yyn1934 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt32String == nil {
- r.EncodeNil()
- } else {
- yy1937 := *x.FptrMapInt32String
- if false {
- } else {
- z.F.EncMapInt32StringV(yy1937, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt32Uint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32UintV(x.FMapInt32Uint, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt32Uint`)
- r.WriteMapElemValue()
- if x.FMapInt32Uint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32UintV(x.FMapInt32Uint, e)
- }
- }
- }
- var yyn1942 bool
- if x.FptrMapInt32Uint == nil {
- yyn1942 = true
- goto LABEL1942
- }
- LABEL1942:
- if yyr2 || yy2arr2 {
- if yyn1942 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt32Uint == nil {
- r.EncodeNil()
- } else {
- yy1943 := *x.FptrMapInt32Uint
- if false {
- } else {
- z.F.EncMapInt32UintV(yy1943, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Uint`)
- r.WriteMapElemValue()
- if yyn1942 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt32Uint == nil {
- r.EncodeNil()
- } else {
- yy1945 := *x.FptrMapInt32Uint
- if false {
- } else {
- z.F.EncMapInt32UintV(yy1945, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt32Uint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32Uint8V(x.FMapInt32Uint8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt32Uint8`)
- r.WriteMapElemValue()
- if x.FMapInt32Uint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32Uint8V(x.FMapInt32Uint8, e)
- }
- }
- }
- var yyn1950 bool
- if x.FptrMapInt32Uint8 == nil {
- yyn1950 = true
- goto LABEL1950
- }
- LABEL1950:
- if yyr2 || yy2arr2 {
- if yyn1950 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt32Uint8 == nil {
- r.EncodeNil()
- } else {
- yy1951 := *x.FptrMapInt32Uint8
- if false {
- } else {
- z.F.EncMapInt32Uint8V(yy1951, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Uint8`)
- r.WriteMapElemValue()
- if yyn1950 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt32Uint8 == nil {
- r.EncodeNil()
- } else {
- yy1953 := *x.FptrMapInt32Uint8
- if false {
- } else {
- z.F.EncMapInt32Uint8V(yy1953, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt32Uint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32Uint16V(x.FMapInt32Uint16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt32Uint16`)
- r.WriteMapElemValue()
- if x.FMapInt32Uint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32Uint16V(x.FMapInt32Uint16, e)
- }
- }
- }
- var yyn1958 bool
- if x.FptrMapInt32Uint16 == nil {
- yyn1958 = true
- goto LABEL1958
- }
- LABEL1958:
- if yyr2 || yy2arr2 {
- if yyn1958 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt32Uint16 == nil {
- r.EncodeNil()
- } else {
- yy1959 := *x.FptrMapInt32Uint16
- if false {
- } else {
- z.F.EncMapInt32Uint16V(yy1959, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Uint16`)
- r.WriteMapElemValue()
- if yyn1958 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt32Uint16 == nil {
- r.EncodeNil()
- } else {
- yy1961 := *x.FptrMapInt32Uint16
- if false {
- } else {
- z.F.EncMapInt32Uint16V(yy1961, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt32Uint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32Uint32V(x.FMapInt32Uint32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt32Uint32`)
- r.WriteMapElemValue()
- if x.FMapInt32Uint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32Uint32V(x.FMapInt32Uint32, e)
- }
- }
- }
- var yyn1966 bool
- if x.FptrMapInt32Uint32 == nil {
- yyn1966 = true
- goto LABEL1966
- }
- LABEL1966:
- if yyr2 || yy2arr2 {
- if yyn1966 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt32Uint32 == nil {
- r.EncodeNil()
- } else {
- yy1967 := *x.FptrMapInt32Uint32
- if false {
- } else {
- z.F.EncMapInt32Uint32V(yy1967, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Uint32`)
- r.WriteMapElemValue()
- if yyn1966 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt32Uint32 == nil {
- r.EncodeNil()
- } else {
- yy1969 := *x.FptrMapInt32Uint32
- if false {
- } else {
- z.F.EncMapInt32Uint32V(yy1969, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt32Uint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32Uint64V(x.FMapInt32Uint64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt32Uint64`)
- r.WriteMapElemValue()
- if x.FMapInt32Uint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32Uint64V(x.FMapInt32Uint64, e)
- }
- }
- }
- var yyn1974 bool
- if x.FptrMapInt32Uint64 == nil {
- yyn1974 = true
- goto LABEL1974
- }
- LABEL1974:
- if yyr2 || yy2arr2 {
- if yyn1974 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt32Uint64 == nil {
- r.EncodeNil()
- } else {
- yy1975 := *x.FptrMapInt32Uint64
- if false {
- } else {
- z.F.EncMapInt32Uint64V(yy1975, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Uint64`)
- r.WriteMapElemValue()
- if yyn1974 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt32Uint64 == nil {
- r.EncodeNil()
- } else {
- yy1977 := *x.FptrMapInt32Uint64
- if false {
- } else {
- z.F.EncMapInt32Uint64V(yy1977, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt32Uintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32UintptrV(x.FMapInt32Uintptr, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt32Uintptr`)
- r.WriteMapElemValue()
- if x.FMapInt32Uintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32UintptrV(x.FMapInt32Uintptr, e)
- }
- }
- }
- var yyn1982 bool
- if x.FptrMapInt32Uintptr == nil {
- yyn1982 = true
- goto LABEL1982
- }
- LABEL1982:
- if yyr2 || yy2arr2 {
- if yyn1982 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt32Uintptr == nil {
- r.EncodeNil()
- } else {
- yy1983 := *x.FptrMapInt32Uintptr
- if false {
- } else {
- z.F.EncMapInt32UintptrV(yy1983, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Uintptr`)
- r.WriteMapElemValue()
- if yyn1982 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt32Uintptr == nil {
- r.EncodeNil()
- } else {
- yy1985 := *x.FptrMapInt32Uintptr
- if false {
- } else {
- z.F.EncMapInt32UintptrV(yy1985, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt32Int == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32IntV(x.FMapInt32Int, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt32Int`)
- r.WriteMapElemValue()
- if x.FMapInt32Int == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32IntV(x.FMapInt32Int, e)
- }
- }
- }
- var yyn1990 bool
- if x.FptrMapInt32Int == nil {
- yyn1990 = true
- goto LABEL1990
- }
- LABEL1990:
- if yyr2 || yy2arr2 {
- if yyn1990 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt32Int == nil {
- r.EncodeNil()
- } else {
- yy1991 := *x.FptrMapInt32Int
- if false {
- } else {
- z.F.EncMapInt32IntV(yy1991, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Int`)
- r.WriteMapElemValue()
- if yyn1990 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt32Int == nil {
- r.EncodeNil()
- } else {
- yy1993 := *x.FptrMapInt32Int
- if false {
- } else {
- z.F.EncMapInt32IntV(yy1993, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt32Int8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32Int8V(x.FMapInt32Int8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt32Int8`)
- r.WriteMapElemValue()
- if x.FMapInt32Int8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32Int8V(x.FMapInt32Int8, e)
- }
- }
- }
- var yyn1998 bool
- if x.FptrMapInt32Int8 == nil {
- yyn1998 = true
- goto LABEL1998
- }
- LABEL1998:
- if yyr2 || yy2arr2 {
- if yyn1998 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt32Int8 == nil {
- r.EncodeNil()
- } else {
- yy1999 := *x.FptrMapInt32Int8
- if false {
- } else {
- z.F.EncMapInt32Int8V(yy1999, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Int8`)
- r.WriteMapElemValue()
- if yyn1998 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt32Int8 == nil {
- r.EncodeNil()
- } else {
- yy2001 := *x.FptrMapInt32Int8
- if false {
- } else {
- z.F.EncMapInt32Int8V(yy2001, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt32Int16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32Int16V(x.FMapInt32Int16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt32Int16`)
- r.WriteMapElemValue()
- if x.FMapInt32Int16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32Int16V(x.FMapInt32Int16, e)
- }
- }
- }
- var yyn2006 bool
- if x.FptrMapInt32Int16 == nil {
- yyn2006 = true
- goto LABEL2006
- }
- LABEL2006:
- if yyr2 || yy2arr2 {
- if yyn2006 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt32Int16 == nil {
- r.EncodeNil()
- } else {
- yy2007 := *x.FptrMapInt32Int16
- if false {
- } else {
- z.F.EncMapInt32Int16V(yy2007, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Int16`)
- r.WriteMapElemValue()
- if yyn2006 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt32Int16 == nil {
- r.EncodeNil()
- } else {
- yy2009 := *x.FptrMapInt32Int16
- if false {
- } else {
- z.F.EncMapInt32Int16V(yy2009, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt32Int32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32Int32V(x.FMapInt32Int32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt32Int32`)
- r.WriteMapElemValue()
- if x.FMapInt32Int32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32Int32V(x.FMapInt32Int32, e)
- }
- }
- }
- var yyn2014 bool
- if x.FptrMapInt32Int32 == nil {
- yyn2014 = true
- goto LABEL2014
- }
- LABEL2014:
- if yyr2 || yy2arr2 {
- if yyn2014 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt32Int32 == nil {
- r.EncodeNil()
- } else {
- yy2015 := *x.FptrMapInt32Int32
- if false {
- } else {
- z.F.EncMapInt32Int32V(yy2015, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Int32`)
- r.WriteMapElemValue()
- if yyn2014 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt32Int32 == nil {
- r.EncodeNil()
- } else {
- yy2017 := *x.FptrMapInt32Int32
- if false {
- } else {
- z.F.EncMapInt32Int32V(yy2017, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt32Int64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32Int64V(x.FMapInt32Int64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt32Int64`)
- r.WriteMapElemValue()
- if x.FMapInt32Int64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32Int64V(x.FMapInt32Int64, e)
- }
- }
- }
- var yyn2022 bool
- if x.FptrMapInt32Int64 == nil {
- yyn2022 = true
- goto LABEL2022
- }
- LABEL2022:
- if yyr2 || yy2arr2 {
- if yyn2022 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt32Int64 == nil {
- r.EncodeNil()
- } else {
- yy2023 := *x.FptrMapInt32Int64
- if false {
- } else {
- z.F.EncMapInt32Int64V(yy2023, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Int64`)
- r.WriteMapElemValue()
- if yyn2022 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt32Int64 == nil {
- r.EncodeNil()
- } else {
- yy2025 := *x.FptrMapInt32Int64
- if false {
- } else {
- z.F.EncMapInt32Int64V(yy2025, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt32Float32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32Float32V(x.FMapInt32Float32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt32Float32`)
- r.WriteMapElemValue()
- if x.FMapInt32Float32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32Float32V(x.FMapInt32Float32, e)
- }
- }
- }
- var yyn2030 bool
- if x.FptrMapInt32Float32 == nil {
- yyn2030 = true
- goto LABEL2030
- }
- LABEL2030:
- if yyr2 || yy2arr2 {
- if yyn2030 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt32Float32 == nil {
- r.EncodeNil()
- } else {
- yy2031 := *x.FptrMapInt32Float32
- if false {
- } else {
- z.F.EncMapInt32Float32V(yy2031, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Float32`)
- r.WriteMapElemValue()
- if yyn2030 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt32Float32 == nil {
- r.EncodeNil()
- } else {
- yy2033 := *x.FptrMapInt32Float32
- if false {
- } else {
- z.F.EncMapInt32Float32V(yy2033, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt32Float64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32Float64V(x.FMapInt32Float64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt32Float64`)
- r.WriteMapElemValue()
- if x.FMapInt32Float64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32Float64V(x.FMapInt32Float64, e)
- }
- }
- }
- var yyn2038 bool
- if x.FptrMapInt32Float64 == nil {
- yyn2038 = true
- goto LABEL2038
- }
- LABEL2038:
- if yyr2 || yy2arr2 {
- if yyn2038 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt32Float64 == nil {
- r.EncodeNil()
- } else {
- yy2039 := *x.FptrMapInt32Float64
- if false {
- } else {
- z.F.EncMapInt32Float64V(yy2039, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Float64`)
- r.WriteMapElemValue()
- if yyn2038 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt32Float64 == nil {
- r.EncodeNil()
- } else {
- yy2041 := *x.FptrMapInt32Float64
- if false {
- } else {
- z.F.EncMapInt32Float64V(yy2041, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt32Bool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32BoolV(x.FMapInt32Bool, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt32Bool`)
- r.WriteMapElemValue()
- if x.FMapInt32Bool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt32BoolV(x.FMapInt32Bool, e)
- }
- }
- }
- var yyn2046 bool
- if x.FptrMapInt32Bool == nil {
- yyn2046 = true
- goto LABEL2046
- }
- LABEL2046:
- if yyr2 || yy2arr2 {
- if yyn2046 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt32Bool == nil {
- r.EncodeNil()
- } else {
- yy2047 := *x.FptrMapInt32Bool
- if false {
- } else {
- z.F.EncMapInt32BoolV(yy2047, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Bool`)
- r.WriteMapElemValue()
- if yyn2046 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt32Bool == nil {
- r.EncodeNil()
- } else {
- yy2049 := *x.FptrMapInt32Bool
- if false {
- } else {
- z.F.EncMapInt32BoolV(yy2049, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt64Intf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64IntfV(x.FMapInt64Intf, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt64Intf`)
- r.WriteMapElemValue()
- if x.FMapInt64Intf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64IntfV(x.FMapInt64Intf, e)
- }
- }
- }
- var yyn2054 bool
- if x.FptrMapInt64Intf == nil {
- yyn2054 = true
- goto LABEL2054
- }
- LABEL2054:
- if yyr2 || yy2arr2 {
- if yyn2054 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt64Intf == nil {
- r.EncodeNil()
- } else {
- yy2055 := *x.FptrMapInt64Intf
- if false {
- } else {
- z.F.EncMapInt64IntfV(yy2055, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Intf`)
- r.WriteMapElemValue()
- if yyn2054 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt64Intf == nil {
- r.EncodeNil()
- } else {
- yy2057 := *x.FptrMapInt64Intf
- if false {
- } else {
- z.F.EncMapInt64IntfV(yy2057, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt64String == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64StringV(x.FMapInt64String, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt64String`)
- r.WriteMapElemValue()
- if x.FMapInt64String == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64StringV(x.FMapInt64String, e)
- }
- }
- }
- var yyn2062 bool
- if x.FptrMapInt64String == nil {
- yyn2062 = true
- goto LABEL2062
- }
- LABEL2062:
- if yyr2 || yy2arr2 {
- if yyn2062 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt64String == nil {
- r.EncodeNil()
- } else {
- yy2063 := *x.FptrMapInt64String
- if false {
- } else {
- z.F.EncMapInt64StringV(yy2063, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64String`)
- r.WriteMapElemValue()
- if yyn2062 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt64String == nil {
- r.EncodeNil()
- } else {
- yy2065 := *x.FptrMapInt64String
- if false {
- } else {
- z.F.EncMapInt64StringV(yy2065, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt64Uint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64UintV(x.FMapInt64Uint, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt64Uint`)
- r.WriteMapElemValue()
- if x.FMapInt64Uint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64UintV(x.FMapInt64Uint, e)
- }
- }
- }
- var yyn2070 bool
- if x.FptrMapInt64Uint == nil {
- yyn2070 = true
- goto LABEL2070
- }
- LABEL2070:
- if yyr2 || yy2arr2 {
- if yyn2070 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt64Uint == nil {
- r.EncodeNil()
- } else {
- yy2071 := *x.FptrMapInt64Uint
- if false {
- } else {
- z.F.EncMapInt64UintV(yy2071, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Uint`)
- r.WriteMapElemValue()
- if yyn2070 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt64Uint == nil {
- r.EncodeNil()
- } else {
- yy2073 := *x.FptrMapInt64Uint
- if false {
- } else {
- z.F.EncMapInt64UintV(yy2073, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt64Uint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64Uint8V(x.FMapInt64Uint8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt64Uint8`)
- r.WriteMapElemValue()
- if x.FMapInt64Uint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64Uint8V(x.FMapInt64Uint8, e)
- }
- }
- }
- var yyn2078 bool
- if x.FptrMapInt64Uint8 == nil {
- yyn2078 = true
- goto LABEL2078
- }
- LABEL2078:
- if yyr2 || yy2arr2 {
- if yyn2078 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt64Uint8 == nil {
- r.EncodeNil()
- } else {
- yy2079 := *x.FptrMapInt64Uint8
- if false {
- } else {
- z.F.EncMapInt64Uint8V(yy2079, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Uint8`)
- r.WriteMapElemValue()
- if yyn2078 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt64Uint8 == nil {
- r.EncodeNil()
- } else {
- yy2081 := *x.FptrMapInt64Uint8
- if false {
- } else {
- z.F.EncMapInt64Uint8V(yy2081, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt64Uint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64Uint16V(x.FMapInt64Uint16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt64Uint16`)
- r.WriteMapElemValue()
- if x.FMapInt64Uint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64Uint16V(x.FMapInt64Uint16, e)
- }
- }
- }
- var yyn2086 bool
- if x.FptrMapInt64Uint16 == nil {
- yyn2086 = true
- goto LABEL2086
- }
- LABEL2086:
- if yyr2 || yy2arr2 {
- if yyn2086 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt64Uint16 == nil {
- r.EncodeNil()
- } else {
- yy2087 := *x.FptrMapInt64Uint16
- if false {
- } else {
- z.F.EncMapInt64Uint16V(yy2087, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Uint16`)
- r.WriteMapElemValue()
- if yyn2086 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt64Uint16 == nil {
- r.EncodeNil()
- } else {
- yy2089 := *x.FptrMapInt64Uint16
- if false {
- } else {
- z.F.EncMapInt64Uint16V(yy2089, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt64Uint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64Uint32V(x.FMapInt64Uint32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt64Uint32`)
- r.WriteMapElemValue()
- if x.FMapInt64Uint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64Uint32V(x.FMapInt64Uint32, e)
- }
- }
- }
- var yyn2094 bool
- if x.FptrMapInt64Uint32 == nil {
- yyn2094 = true
- goto LABEL2094
- }
- LABEL2094:
- if yyr2 || yy2arr2 {
- if yyn2094 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt64Uint32 == nil {
- r.EncodeNil()
- } else {
- yy2095 := *x.FptrMapInt64Uint32
- if false {
- } else {
- z.F.EncMapInt64Uint32V(yy2095, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Uint32`)
- r.WriteMapElemValue()
- if yyn2094 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt64Uint32 == nil {
- r.EncodeNil()
- } else {
- yy2097 := *x.FptrMapInt64Uint32
- if false {
- } else {
- z.F.EncMapInt64Uint32V(yy2097, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt64Uint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64Uint64V(x.FMapInt64Uint64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt64Uint64`)
- r.WriteMapElemValue()
- if x.FMapInt64Uint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64Uint64V(x.FMapInt64Uint64, e)
- }
- }
- }
- var yyn2102 bool
- if x.FptrMapInt64Uint64 == nil {
- yyn2102 = true
- goto LABEL2102
- }
- LABEL2102:
- if yyr2 || yy2arr2 {
- if yyn2102 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt64Uint64 == nil {
- r.EncodeNil()
- } else {
- yy2103 := *x.FptrMapInt64Uint64
- if false {
- } else {
- z.F.EncMapInt64Uint64V(yy2103, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Uint64`)
- r.WriteMapElemValue()
- if yyn2102 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt64Uint64 == nil {
- r.EncodeNil()
- } else {
- yy2105 := *x.FptrMapInt64Uint64
- if false {
- } else {
- z.F.EncMapInt64Uint64V(yy2105, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt64Uintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64UintptrV(x.FMapInt64Uintptr, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt64Uintptr`)
- r.WriteMapElemValue()
- if x.FMapInt64Uintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64UintptrV(x.FMapInt64Uintptr, e)
- }
- }
- }
- var yyn2110 bool
- if x.FptrMapInt64Uintptr == nil {
- yyn2110 = true
- goto LABEL2110
- }
- LABEL2110:
- if yyr2 || yy2arr2 {
- if yyn2110 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt64Uintptr == nil {
- r.EncodeNil()
- } else {
- yy2111 := *x.FptrMapInt64Uintptr
- if false {
- } else {
- z.F.EncMapInt64UintptrV(yy2111, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Uintptr`)
- r.WriteMapElemValue()
- if yyn2110 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt64Uintptr == nil {
- r.EncodeNil()
- } else {
- yy2113 := *x.FptrMapInt64Uintptr
- if false {
- } else {
- z.F.EncMapInt64UintptrV(yy2113, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt64Int == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64IntV(x.FMapInt64Int, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt64Int`)
- r.WriteMapElemValue()
- if x.FMapInt64Int == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64IntV(x.FMapInt64Int, e)
- }
- }
- }
- var yyn2118 bool
- if x.FptrMapInt64Int == nil {
- yyn2118 = true
- goto LABEL2118
- }
- LABEL2118:
- if yyr2 || yy2arr2 {
- if yyn2118 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt64Int == nil {
- r.EncodeNil()
- } else {
- yy2119 := *x.FptrMapInt64Int
- if false {
- } else {
- z.F.EncMapInt64IntV(yy2119, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Int`)
- r.WriteMapElemValue()
- if yyn2118 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt64Int == nil {
- r.EncodeNil()
- } else {
- yy2121 := *x.FptrMapInt64Int
- if false {
- } else {
- z.F.EncMapInt64IntV(yy2121, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt64Int8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64Int8V(x.FMapInt64Int8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt64Int8`)
- r.WriteMapElemValue()
- if x.FMapInt64Int8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64Int8V(x.FMapInt64Int8, e)
- }
- }
- }
- var yyn2126 bool
- if x.FptrMapInt64Int8 == nil {
- yyn2126 = true
- goto LABEL2126
- }
- LABEL2126:
- if yyr2 || yy2arr2 {
- if yyn2126 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt64Int8 == nil {
- r.EncodeNil()
- } else {
- yy2127 := *x.FptrMapInt64Int8
- if false {
- } else {
- z.F.EncMapInt64Int8V(yy2127, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Int8`)
- r.WriteMapElemValue()
- if yyn2126 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt64Int8 == nil {
- r.EncodeNil()
- } else {
- yy2129 := *x.FptrMapInt64Int8
- if false {
- } else {
- z.F.EncMapInt64Int8V(yy2129, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt64Int16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64Int16V(x.FMapInt64Int16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt64Int16`)
- r.WriteMapElemValue()
- if x.FMapInt64Int16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64Int16V(x.FMapInt64Int16, e)
- }
- }
- }
- var yyn2134 bool
- if x.FptrMapInt64Int16 == nil {
- yyn2134 = true
- goto LABEL2134
- }
- LABEL2134:
- if yyr2 || yy2arr2 {
- if yyn2134 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt64Int16 == nil {
- r.EncodeNil()
- } else {
- yy2135 := *x.FptrMapInt64Int16
- if false {
- } else {
- z.F.EncMapInt64Int16V(yy2135, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Int16`)
- r.WriteMapElemValue()
- if yyn2134 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt64Int16 == nil {
- r.EncodeNil()
- } else {
- yy2137 := *x.FptrMapInt64Int16
- if false {
- } else {
- z.F.EncMapInt64Int16V(yy2137, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt64Int32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64Int32V(x.FMapInt64Int32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt64Int32`)
- r.WriteMapElemValue()
- if x.FMapInt64Int32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64Int32V(x.FMapInt64Int32, e)
- }
- }
- }
- var yyn2142 bool
- if x.FptrMapInt64Int32 == nil {
- yyn2142 = true
- goto LABEL2142
- }
- LABEL2142:
- if yyr2 || yy2arr2 {
- if yyn2142 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt64Int32 == nil {
- r.EncodeNil()
- } else {
- yy2143 := *x.FptrMapInt64Int32
- if false {
- } else {
- z.F.EncMapInt64Int32V(yy2143, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Int32`)
- r.WriteMapElemValue()
- if yyn2142 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt64Int32 == nil {
- r.EncodeNil()
- } else {
- yy2145 := *x.FptrMapInt64Int32
- if false {
- } else {
- z.F.EncMapInt64Int32V(yy2145, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt64Int64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64Int64V(x.FMapInt64Int64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt64Int64`)
- r.WriteMapElemValue()
- if x.FMapInt64Int64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64Int64V(x.FMapInt64Int64, e)
- }
- }
- }
- var yyn2150 bool
- if x.FptrMapInt64Int64 == nil {
- yyn2150 = true
- goto LABEL2150
- }
- LABEL2150:
- if yyr2 || yy2arr2 {
- if yyn2150 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt64Int64 == nil {
- r.EncodeNil()
- } else {
- yy2151 := *x.FptrMapInt64Int64
- if false {
- } else {
- z.F.EncMapInt64Int64V(yy2151, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Int64`)
- r.WriteMapElemValue()
- if yyn2150 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt64Int64 == nil {
- r.EncodeNil()
- } else {
- yy2153 := *x.FptrMapInt64Int64
- if false {
- } else {
- z.F.EncMapInt64Int64V(yy2153, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt64Float32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64Float32V(x.FMapInt64Float32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt64Float32`)
- r.WriteMapElemValue()
- if x.FMapInt64Float32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64Float32V(x.FMapInt64Float32, e)
- }
- }
- }
- var yyn2158 bool
- if x.FptrMapInt64Float32 == nil {
- yyn2158 = true
- goto LABEL2158
- }
- LABEL2158:
- if yyr2 || yy2arr2 {
- if yyn2158 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt64Float32 == nil {
- r.EncodeNil()
- } else {
- yy2159 := *x.FptrMapInt64Float32
- if false {
- } else {
- z.F.EncMapInt64Float32V(yy2159, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Float32`)
- r.WriteMapElemValue()
- if yyn2158 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt64Float32 == nil {
- r.EncodeNil()
- } else {
- yy2161 := *x.FptrMapInt64Float32
- if false {
- } else {
- z.F.EncMapInt64Float32V(yy2161, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt64Float64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64Float64V(x.FMapInt64Float64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt64Float64`)
- r.WriteMapElemValue()
- if x.FMapInt64Float64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64Float64V(x.FMapInt64Float64, e)
- }
- }
- }
- var yyn2166 bool
- if x.FptrMapInt64Float64 == nil {
- yyn2166 = true
- goto LABEL2166
- }
- LABEL2166:
- if yyr2 || yy2arr2 {
- if yyn2166 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt64Float64 == nil {
- r.EncodeNil()
- } else {
- yy2167 := *x.FptrMapInt64Float64
- if false {
- } else {
- z.F.EncMapInt64Float64V(yy2167, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Float64`)
- r.WriteMapElemValue()
- if yyn2166 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt64Float64 == nil {
- r.EncodeNil()
- } else {
- yy2169 := *x.FptrMapInt64Float64
- if false {
- } else {
- z.F.EncMapInt64Float64V(yy2169, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapInt64Bool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64BoolV(x.FMapInt64Bool, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapInt64Bool`)
- r.WriteMapElemValue()
- if x.FMapInt64Bool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapInt64BoolV(x.FMapInt64Bool, e)
- }
- }
- }
- var yyn2174 bool
- if x.FptrMapInt64Bool == nil {
- yyn2174 = true
- goto LABEL2174
- }
- LABEL2174:
- if yyr2 || yy2arr2 {
- if yyn2174 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapInt64Bool == nil {
- r.EncodeNil()
- } else {
- yy2175 := *x.FptrMapInt64Bool
- if false {
- } else {
- z.F.EncMapInt64BoolV(yy2175, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Bool`)
- r.WriteMapElemValue()
- if yyn2174 {
- r.EncodeNil()
- } else {
- if x.FptrMapInt64Bool == nil {
- r.EncodeNil()
- } else {
- yy2177 := *x.FptrMapInt64Bool
- if false {
- } else {
- z.F.EncMapInt64BoolV(yy2177, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapBoolIntf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolIntfV(x.FMapBoolIntf, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapBoolIntf`)
- r.WriteMapElemValue()
- if x.FMapBoolIntf == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolIntfV(x.FMapBoolIntf, e)
- }
- }
- }
- var yyn2182 bool
- if x.FptrMapBoolIntf == nil {
- yyn2182 = true
- goto LABEL2182
- }
- LABEL2182:
- if yyr2 || yy2arr2 {
- if yyn2182 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapBoolIntf == nil {
- r.EncodeNil()
- } else {
- yy2183 := *x.FptrMapBoolIntf
- if false {
- } else {
- z.F.EncMapBoolIntfV(yy2183, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolIntf`)
- r.WriteMapElemValue()
- if yyn2182 {
- r.EncodeNil()
- } else {
- if x.FptrMapBoolIntf == nil {
- r.EncodeNil()
- } else {
- yy2185 := *x.FptrMapBoolIntf
- if false {
- } else {
- z.F.EncMapBoolIntfV(yy2185, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapBoolString == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolStringV(x.FMapBoolString, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapBoolString`)
- r.WriteMapElemValue()
- if x.FMapBoolString == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolStringV(x.FMapBoolString, e)
- }
- }
- }
- var yyn2190 bool
- if x.FptrMapBoolString == nil {
- yyn2190 = true
- goto LABEL2190
- }
- LABEL2190:
- if yyr2 || yy2arr2 {
- if yyn2190 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapBoolString == nil {
- r.EncodeNil()
- } else {
- yy2191 := *x.FptrMapBoolString
- if false {
- } else {
- z.F.EncMapBoolStringV(yy2191, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolString`)
- r.WriteMapElemValue()
- if yyn2190 {
- r.EncodeNil()
- } else {
- if x.FptrMapBoolString == nil {
- r.EncodeNil()
- } else {
- yy2193 := *x.FptrMapBoolString
- if false {
- } else {
- z.F.EncMapBoolStringV(yy2193, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapBoolUint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolUintV(x.FMapBoolUint, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapBoolUint`)
- r.WriteMapElemValue()
- if x.FMapBoolUint == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolUintV(x.FMapBoolUint, e)
- }
- }
- }
- var yyn2198 bool
- if x.FptrMapBoolUint == nil {
- yyn2198 = true
- goto LABEL2198
- }
- LABEL2198:
- if yyr2 || yy2arr2 {
- if yyn2198 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapBoolUint == nil {
- r.EncodeNil()
- } else {
- yy2199 := *x.FptrMapBoolUint
- if false {
- } else {
- z.F.EncMapBoolUintV(yy2199, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolUint`)
- r.WriteMapElemValue()
- if yyn2198 {
- r.EncodeNil()
- } else {
- if x.FptrMapBoolUint == nil {
- r.EncodeNil()
- } else {
- yy2201 := *x.FptrMapBoolUint
- if false {
- } else {
- z.F.EncMapBoolUintV(yy2201, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapBoolUint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolUint8V(x.FMapBoolUint8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapBoolUint8`)
- r.WriteMapElemValue()
- if x.FMapBoolUint8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolUint8V(x.FMapBoolUint8, e)
- }
- }
- }
- var yyn2206 bool
- if x.FptrMapBoolUint8 == nil {
- yyn2206 = true
- goto LABEL2206
- }
- LABEL2206:
- if yyr2 || yy2arr2 {
- if yyn2206 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapBoolUint8 == nil {
- r.EncodeNil()
- } else {
- yy2207 := *x.FptrMapBoolUint8
- if false {
- } else {
- z.F.EncMapBoolUint8V(yy2207, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolUint8`)
- r.WriteMapElemValue()
- if yyn2206 {
- r.EncodeNil()
- } else {
- if x.FptrMapBoolUint8 == nil {
- r.EncodeNil()
- } else {
- yy2209 := *x.FptrMapBoolUint8
- if false {
- } else {
- z.F.EncMapBoolUint8V(yy2209, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapBoolUint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolUint16V(x.FMapBoolUint16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapBoolUint16`)
- r.WriteMapElemValue()
- if x.FMapBoolUint16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolUint16V(x.FMapBoolUint16, e)
- }
- }
- }
- var yyn2214 bool
- if x.FptrMapBoolUint16 == nil {
- yyn2214 = true
- goto LABEL2214
- }
- LABEL2214:
- if yyr2 || yy2arr2 {
- if yyn2214 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapBoolUint16 == nil {
- r.EncodeNil()
- } else {
- yy2215 := *x.FptrMapBoolUint16
- if false {
- } else {
- z.F.EncMapBoolUint16V(yy2215, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolUint16`)
- r.WriteMapElemValue()
- if yyn2214 {
- r.EncodeNil()
- } else {
- if x.FptrMapBoolUint16 == nil {
- r.EncodeNil()
- } else {
- yy2217 := *x.FptrMapBoolUint16
- if false {
- } else {
- z.F.EncMapBoolUint16V(yy2217, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapBoolUint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolUint32V(x.FMapBoolUint32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapBoolUint32`)
- r.WriteMapElemValue()
- if x.FMapBoolUint32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolUint32V(x.FMapBoolUint32, e)
- }
- }
- }
- var yyn2222 bool
- if x.FptrMapBoolUint32 == nil {
- yyn2222 = true
- goto LABEL2222
- }
- LABEL2222:
- if yyr2 || yy2arr2 {
- if yyn2222 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapBoolUint32 == nil {
- r.EncodeNil()
- } else {
- yy2223 := *x.FptrMapBoolUint32
- if false {
- } else {
- z.F.EncMapBoolUint32V(yy2223, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolUint32`)
- r.WriteMapElemValue()
- if yyn2222 {
- r.EncodeNil()
- } else {
- if x.FptrMapBoolUint32 == nil {
- r.EncodeNil()
- } else {
- yy2225 := *x.FptrMapBoolUint32
- if false {
- } else {
- z.F.EncMapBoolUint32V(yy2225, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapBoolUint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolUint64V(x.FMapBoolUint64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapBoolUint64`)
- r.WriteMapElemValue()
- if x.FMapBoolUint64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolUint64V(x.FMapBoolUint64, e)
- }
- }
- }
- var yyn2230 bool
- if x.FptrMapBoolUint64 == nil {
- yyn2230 = true
- goto LABEL2230
- }
- LABEL2230:
- if yyr2 || yy2arr2 {
- if yyn2230 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapBoolUint64 == nil {
- r.EncodeNil()
- } else {
- yy2231 := *x.FptrMapBoolUint64
- if false {
- } else {
- z.F.EncMapBoolUint64V(yy2231, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolUint64`)
- r.WriteMapElemValue()
- if yyn2230 {
- r.EncodeNil()
- } else {
- if x.FptrMapBoolUint64 == nil {
- r.EncodeNil()
- } else {
- yy2233 := *x.FptrMapBoolUint64
- if false {
- } else {
- z.F.EncMapBoolUint64V(yy2233, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapBoolUintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolUintptrV(x.FMapBoolUintptr, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapBoolUintptr`)
- r.WriteMapElemValue()
- if x.FMapBoolUintptr == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolUintptrV(x.FMapBoolUintptr, e)
- }
- }
- }
- var yyn2238 bool
- if x.FptrMapBoolUintptr == nil {
- yyn2238 = true
- goto LABEL2238
- }
- LABEL2238:
- if yyr2 || yy2arr2 {
- if yyn2238 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapBoolUintptr == nil {
- r.EncodeNil()
- } else {
- yy2239 := *x.FptrMapBoolUintptr
- if false {
- } else {
- z.F.EncMapBoolUintptrV(yy2239, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolUintptr`)
- r.WriteMapElemValue()
- if yyn2238 {
- r.EncodeNil()
- } else {
- if x.FptrMapBoolUintptr == nil {
- r.EncodeNil()
- } else {
- yy2241 := *x.FptrMapBoolUintptr
- if false {
- } else {
- z.F.EncMapBoolUintptrV(yy2241, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapBoolInt == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolIntV(x.FMapBoolInt, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapBoolInt`)
- r.WriteMapElemValue()
- if x.FMapBoolInt == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolIntV(x.FMapBoolInt, e)
- }
- }
- }
- var yyn2246 bool
- if x.FptrMapBoolInt == nil {
- yyn2246 = true
- goto LABEL2246
- }
- LABEL2246:
- if yyr2 || yy2arr2 {
- if yyn2246 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapBoolInt == nil {
- r.EncodeNil()
- } else {
- yy2247 := *x.FptrMapBoolInt
- if false {
- } else {
- z.F.EncMapBoolIntV(yy2247, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolInt`)
- r.WriteMapElemValue()
- if yyn2246 {
- r.EncodeNil()
- } else {
- if x.FptrMapBoolInt == nil {
- r.EncodeNil()
- } else {
- yy2249 := *x.FptrMapBoolInt
- if false {
- } else {
- z.F.EncMapBoolIntV(yy2249, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapBoolInt8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolInt8V(x.FMapBoolInt8, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapBoolInt8`)
- r.WriteMapElemValue()
- if x.FMapBoolInt8 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolInt8V(x.FMapBoolInt8, e)
- }
- }
- }
- var yyn2254 bool
- if x.FptrMapBoolInt8 == nil {
- yyn2254 = true
- goto LABEL2254
- }
- LABEL2254:
- if yyr2 || yy2arr2 {
- if yyn2254 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapBoolInt8 == nil {
- r.EncodeNil()
- } else {
- yy2255 := *x.FptrMapBoolInt8
- if false {
- } else {
- z.F.EncMapBoolInt8V(yy2255, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolInt8`)
- r.WriteMapElemValue()
- if yyn2254 {
- r.EncodeNil()
- } else {
- if x.FptrMapBoolInt8 == nil {
- r.EncodeNil()
- } else {
- yy2257 := *x.FptrMapBoolInt8
- if false {
- } else {
- z.F.EncMapBoolInt8V(yy2257, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapBoolInt16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolInt16V(x.FMapBoolInt16, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapBoolInt16`)
- r.WriteMapElemValue()
- if x.FMapBoolInt16 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolInt16V(x.FMapBoolInt16, e)
- }
- }
- }
- var yyn2262 bool
- if x.FptrMapBoolInt16 == nil {
- yyn2262 = true
- goto LABEL2262
- }
- LABEL2262:
- if yyr2 || yy2arr2 {
- if yyn2262 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapBoolInt16 == nil {
- r.EncodeNil()
- } else {
- yy2263 := *x.FptrMapBoolInt16
- if false {
- } else {
- z.F.EncMapBoolInt16V(yy2263, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolInt16`)
- r.WriteMapElemValue()
- if yyn2262 {
- r.EncodeNil()
- } else {
- if x.FptrMapBoolInt16 == nil {
- r.EncodeNil()
- } else {
- yy2265 := *x.FptrMapBoolInt16
- if false {
- } else {
- z.F.EncMapBoolInt16V(yy2265, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapBoolInt32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolInt32V(x.FMapBoolInt32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapBoolInt32`)
- r.WriteMapElemValue()
- if x.FMapBoolInt32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolInt32V(x.FMapBoolInt32, e)
- }
- }
- }
- var yyn2270 bool
- if x.FptrMapBoolInt32 == nil {
- yyn2270 = true
- goto LABEL2270
- }
- LABEL2270:
- if yyr2 || yy2arr2 {
- if yyn2270 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapBoolInt32 == nil {
- r.EncodeNil()
- } else {
- yy2271 := *x.FptrMapBoolInt32
- if false {
- } else {
- z.F.EncMapBoolInt32V(yy2271, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolInt32`)
- r.WriteMapElemValue()
- if yyn2270 {
- r.EncodeNil()
- } else {
- if x.FptrMapBoolInt32 == nil {
- r.EncodeNil()
- } else {
- yy2273 := *x.FptrMapBoolInt32
- if false {
- } else {
- z.F.EncMapBoolInt32V(yy2273, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapBoolInt64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolInt64V(x.FMapBoolInt64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapBoolInt64`)
- r.WriteMapElemValue()
- if x.FMapBoolInt64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolInt64V(x.FMapBoolInt64, e)
- }
- }
- }
- var yyn2278 bool
- if x.FptrMapBoolInt64 == nil {
- yyn2278 = true
- goto LABEL2278
- }
- LABEL2278:
- if yyr2 || yy2arr2 {
- if yyn2278 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapBoolInt64 == nil {
- r.EncodeNil()
- } else {
- yy2279 := *x.FptrMapBoolInt64
- if false {
- } else {
- z.F.EncMapBoolInt64V(yy2279, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolInt64`)
- r.WriteMapElemValue()
- if yyn2278 {
- r.EncodeNil()
- } else {
- if x.FptrMapBoolInt64 == nil {
- r.EncodeNil()
- } else {
- yy2281 := *x.FptrMapBoolInt64
- if false {
- } else {
- z.F.EncMapBoolInt64V(yy2281, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapBoolFloat32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolFloat32V(x.FMapBoolFloat32, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapBoolFloat32`)
- r.WriteMapElemValue()
- if x.FMapBoolFloat32 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolFloat32V(x.FMapBoolFloat32, e)
- }
- }
- }
- var yyn2286 bool
- if x.FptrMapBoolFloat32 == nil {
- yyn2286 = true
- goto LABEL2286
- }
- LABEL2286:
- if yyr2 || yy2arr2 {
- if yyn2286 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapBoolFloat32 == nil {
- r.EncodeNil()
- } else {
- yy2287 := *x.FptrMapBoolFloat32
- if false {
- } else {
- z.F.EncMapBoolFloat32V(yy2287, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolFloat32`)
- r.WriteMapElemValue()
- if yyn2286 {
- r.EncodeNil()
- } else {
- if x.FptrMapBoolFloat32 == nil {
- r.EncodeNil()
- } else {
- yy2289 := *x.FptrMapBoolFloat32
- if false {
- } else {
- z.F.EncMapBoolFloat32V(yy2289, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapBoolFloat64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolFloat64V(x.FMapBoolFloat64, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapBoolFloat64`)
- r.WriteMapElemValue()
- if x.FMapBoolFloat64 == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolFloat64V(x.FMapBoolFloat64, e)
- }
- }
- }
- var yyn2294 bool
- if x.FptrMapBoolFloat64 == nil {
- yyn2294 = true
- goto LABEL2294
- }
- LABEL2294:
- if yyr2 || yy2arr2 {
- if yyn2294 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapBoolFloat64 == nil {
- r.EncodeNil()
- } else {
- yy2295 := *x.FptrMapBoolFloat64
- if false {
- } else {
- z.F.EncMapBoolFloat64V(yy2295, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolFloat64`)
- r.WriteMapElemValue()
- if yyn2294 {
- r.EncodeNil()
- } else {
- if x.FptrMapBoolFloat64 == nil {
- r.EncodeNil()
- } else {
- yy2297 := *x.FptrMapBoolFloat64
- if false {
- } else {
- z.F.EncMapBoolFloat64V(yy2297, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.FMapBoolBool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolBoolV(x.FMapBoolBool, e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FMapBoolBool`)
- r.WriteMapElemValue()
- if x.FMapBoolBool == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- z.F.EncMapBoolBoolV(x.FMapBoolBool, e)
- }
- }
- }
- var yyn2302 bool
- if x.FptrMapBoolBool == nil {
- yyn2302 = true
- goto LABEL2302
- }
- LABEL2302:
- if yyr2 || yy2arr2 {
- if yyn2302 {
- r.WriteArrayElem()
- r.EncodeNil()
- } else {
- r.WriteArrayElem()
- if x.FptrMapBoolBool == nil {
- r.EncodeNil()
- } else {
- yy2303 := *x.FptrMapBoolBool
- if false {
- } else {
- z.F.EncMapBoolBoolV(yy2303, e)
- }
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolBool`)
- r.WriteMapElemValue()
- if yyn2302 {
- r.EncodeNil()
- } else {
- if x.FptrMapBoolBool == nil {
- r.EncodeNil()
- } else {
- yy2305 := *x.FptrMapBoolBool
- if false {
- } else {
- z.F.EncMapBoolBoolV(yy2305, e)
- }
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayEnd()
- } else {
- r.WriteMapEnd()
- }
- }
- }
-}
-
-func (x *TestMammoth2) CodecDecodeSelf(d *Decoder) {
- var h codecSelfer19781
- z, r := GenHelperDecoder(d)
- _, _, _ = h, z, r
- if false {
- } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil {
- z.DecExtension(x, yyxt1)
- } else {
- yyct2 := r.ContainerType()
- if yyct2 == codecSelferValueTypeMap19781 {
- yyl2 := r.ReadMapStart()
- if yyl2 == 0 {
- r.ReadMapEnd()
- } else {
- x.codecDecodeSelfFromMap(yyl2, d)
- }
- } else if yyct2 == codecSelferValueTypeArray19781 {
- yyl2 := r.ReadArrayStart()
- if yyl2 == 0 {
- r.ReadArrayEnd()
- } else {
- x.codecDecodeSelfFromArray(yyl2, d)
- }
- } else {
- panic(errCodecSelferOnlyMapOrArrayEncodeToStruct19781)
- }
- }
-}
-
-func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) {
- var h codecSelfer19781
- z, r := GenHelperDecoder(d)
- _, _, _ = h, z, r
- var yyhl3 bool = l >= 0
- for yyj3 := 0; ; yyj3++ {
- if yyhl3 {
- if yyj3 >= l {
- break
- }
- } else {
- if r.CheckBreak() {
- break
- }
- }
- r.ReadMapElemKey()
- yys3 := z.StringView(r.DecodeStringAsBytes())
- r.ReadMapElemValue()
- switch yys3 {
- case "FIntf":
- if r.TryDecodeAsNil() {
- x.FIntf = nil
- } else {
- if false {
- } else {
- z.DecFallback(&x.FIntf, true)
- }
- }
- case "FptrIntf":
- if r.TryDecodeAsNil() {
- if true && x.FptrIntf != nil {
- x.FptrIntf = nil
- }
- } else {
- if x.FptrIntf == nil {
- x.FptrIntf = new(interface{})
- }
-
- if false {
- } else {
- z.DecFallback(x.FptrIntf, true)
- }
- }
- case "FString":
- if r.TryDecodeAsNil() {
- x.FString = ""
- } else {
- x.FString = (string)(r.DecodeString())
- }
- case "FptrString":
- if r.TryDecodeAsNil() {
- if true && x.FptrString != nil {
- x.FptrString = nil
- }
- } else {
- if x.FptrString == nil {
- x.FptrString = new(string)
- }
-
- if false {
- } else {
- *x.FptrString = (string)(r.DecodeString())
- }
- }
- case "FFloat32":
- if r.TryDecodeAsNil() {
- x.FFloat32 = 0
- } else {
- x.FFloat32 = (float32)(r.DecodeFloat32As64())
- }
- case "FptrFloat32":
- if r.TryDecodeAsNil() {
- if true && x.FptrFloat32 != nil {
- x.FptrFloat32 = nil
- }
- } else {
- if x.FptrFloat32 == nil {
- x.FptrFloat32 = new(float32)
- }
-
- if false {
- } else {
- *x.FptrFloat32 = (float32)(r.DecodeFloat32As64())
- }
- }
- case "FFloat64":
- if r.TryDecodeAsNil() {
- x.FFloat64 = 0
- } else {
- x.FFloat64 = (float64)(r.DecodeFloat64())
- }
- case "FptrFloat64":
- if r.TryDecodeAsNil() {
- if true && x.FptrFloat64 != nil {
- x.FptrFloat64 = nil
- }
- } else {
- if x.FptrFloat64 == nil {
- x.FptrFloat64 = new(float64)
- }
-
- if false {
- } else {
- *x.FptrFloat64 = (float64)(r.DecodeFloat64())
- }
- }
- case "FUint":
- if r.TryDecodeAsNil() {
- x.FUint = 0
- } else {
- x.FUint = (uint)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize19781))
- }
- case "FptrUint":
- if r.TryDecodeAsNil() {
- if true && x.FptrUint != nil {
- x.FptrUint = nil
- }
- } else {
- if x.FptrUint == nil {
- x.FptrUint = new(uint)
- }
-
- if false {
- } else {
- *x.FptrUint = (uint)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize19781))
- }
- }
- case "FUint8":
- if r.TryDecodeAsNil() {
- x.FUint8 = 0
- } else {
- x.FUint8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8))
- }
- case "FptrUint8":
- if r.TryDecodeAsNil() {
- if true && x.FptrUint8 != nil {
- x.FptrUint8 = nil
- }
- } else {
- if x.FptrUint8 == nil {
- x.FptrUint8 = new(uint8)
- }
-
- if false {
- } else {
- *x.FptrUint8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8))
- }
- }
- case "FUint16":
- if r.TryDecodeAsNil() {
- x.FUint16 = 0
- } else {
- x.FUint16 = (uint16)(z.C.UintV(r.DecodeUint64(), 16))
- }
- case "FptrUint16":
- if r.TryDecodeAsNil() {
- if true && x.FptrUint16 != nil {
- x.FptrUint16 = nil
- }
- } else {
- if x.FptrUint16 == nil {
- x.FptrUint16 = new(uint16)
- }
-
- if false {
- } else {
- *x.FptrUint16 = (uint16)(z.C.UintV(r.DecodeUint64(), 16))
- }
- }
- case "FUint32":
- if r.TryDecodeAsNil() {
- x.FUint32 = 0
- } else {
- x.FUint32 = (uint32)(z.C.UintV(r.DecodeUint64(), 32))
- }
- case "FptrUint32":
- if r.TryDecodeAsNil() {
- if true && x.FptrUint32 != nil {
- x.FptrUint32 = nil
- }
- } else {
- if x.FptrUint32 == nil {
- x.FptrUint32 = new(uint32)
- }
-
- if false {
- } else {
- *x.FptrUint32 = (uint32)(z.C.UintV(r.DecodeUint64(), 32))
- }
- }
- case "FUint64":
- if r.TryDecodeAsNil() {
- x.FUint64 = 0
- } else {
- x.FUint64 = (uint64)(r.DecodeUint64())
- }
- case "FptrUint64":
- if r.TryDecodeAsNil() {
- if true && x.FptrUint64 != nil {
- x.FptrUint64 = nil
- }
- } else {
- if x.FptrUint64 == nil {
- x.FptrUint64 = new(uint64)
- }
-
- if false {
- } else {
- *x.FptrUint64 = (uint64)(r.DecodeUint64())
- }
- }
- case "FUintptr":
- if r.TryDecodeAsNil() {
- x.FUintptr = 0
- } else {
- x.FUintptr = (uintptr)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize19781))
- }
- case "FptrUintptr":
- if r.TryDecodeAsNil() {
- if true && x.FptrUintptr != nil {
- x.FptrUintptr = nil
- }
- } else {
- if x.FptrUintptr == nil {
- x.FptrUintptr = new(uintptr)
- }
-
- if false {
- } else {
- *x.FptrUintptr = (uintptr)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize19781))
- }
- }
- case "FInt":
- if r.TryDecodeAsNil() {
- x.FInt = 0
- } else {
- x.FInt = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19781))
- }
- case "FptrInt":
- if r.TryDecodeAsNil() {
- if true && x.FptrInt != nil {
- x.FptrInt = nil
- }
- } else {
- if x.FptrInt == nil {
- x.FptrInt = new(int)
- }
-
- if false {
- } else {
- *x.FptrInt = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19781))
- }
- }
- case "FInt8":
- if r.TryDecodeAsNil() {
- x.FInt8 = 0
- } else {
- x.FInt8 = (int8)(z.C.IntV(r.DecodeInt64(), 8))
- }
- case "FptrInt8":
- if r.TryDecodeAsNil() {
- if true && x.FptrInt8 != nil {
- x.FptrInt8 = nil
- }
- } else {
- if x.FptrInt8 == nil {
- x.FptrInt8 = new(int8)
- }
-
- if false {
- } else {
- *x.FptrInt8 = (int8)(z.C.IntV(r.DecodeInt64(), 8))
- }
- }
- case "FInt16":
- if r.TryDecodeAsNil() {
- x.FInt16 = 0
- } else {
- x.FInt16 = (int16)(z.C.IntV(r.DecodeInt64(), 16))
- }
- case "FptrInt16":
- if r.TryDecodeAsNil() {
- if true && x.FptrInt16 != nil {
- x.FptrInt16 = nil
- }
- } else {
- if x.FptrInt16 == nil {
- x.FptrInt16 = new(int16)
- }
-
- if false {
- } else {
- *x.FptrInt16 = (int16)(z.C.IntV(r.DecodeInt64(), 16))
- }
- }
- case "FInt32":
- if r.TryDecodeAsNil() {
- x.FInt32 = 0
- } else {
- x.FInt32 = (int32)(z.C.IntV(r.DecodeInt64(), 32))
- }
- case "FptrInt32":
- if r.TryDecodeAsNil() {
- if true && x.FptrInt32 != nil {
- x.FptrInt32 = nil
- }
- } else {
- if x.FptrInt32 == nil {
- x.FptrInt32 = new(int32)
- }
-
- if false {
- } else {
- *x.FptrInt32 = (int32)(z.C.IntV(r.DecodeInt64(), 32))
- }
- }
- case "FInt64":
- if r.TryDecodeAsNil() {
- x.FInt64 = 0
- } else {
- x.FInt64 = (int64)(r.DecodeInt64())
- }
- case "FptrInt64":
- if r.TryDecodeAsNil() {
- if true && x.FptrInt64 != nil {
- x.FptrInt64 = nil
- }
- } else {
- if x.FptrInt64 == nil {
- x.FptrInt64 = new(int64)
- }
-
- if false {
- } else {
- *x.FptrInt64 = (int64)(r.DecodeInt64())
- }
- }
- case "FBool":
- if r.TryDecodeAsNil() {
- x.FBool = false
- } else {
- x.FBool = (bool)(r.DecodeBool())
- }
- case "FptrBool":
- if r.TryDecodeAsNil() {
- if true && x.FptrBool != nil {
- x.FptrBool = nil
- }
- } else {
- if x.FptrBool == nil {
- x.FptrBool = new(bool)
- }
-
- if false {
- } else {
- *x.FptrBool = (bool)(r.DecodeBool())
- }
- }
- case "FSliceIntf":
- if r.TryDecodeAsNil() {
- x.FSliceIntf = nil
- } else {
- if false {
- } else {
- z.F.DecSliceIntfX(&x.FSliceIntf, d)
- }
- }
- case "FptrSliceIntf":
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceIntf != nil {
- x.FptrSliceIntf = nil
- }
- } else {
- if x.FptrSliceIntf == nil {
- x.FptrSliceIntf = new([]interface{})
- }
-
- if false {
- } else {
- z.F.DecSliceIntfX(x.FptrSliceIntf, d)
- }
- }
- case "FSliceString":
- if r.TryDecodeAsNil() {
- x.FSliceString = nil
- } else {
- if false {
- } else {
- z.F.DecSliceStringX(&x.FSliceString, d)
- }
- }
- case "FptrSliceString":
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceString != nil {
- x.FptrSliceString = nil
- }
- } else {
- if x.FptrSliceString == nil {
- x.FptrSliceString = new([]string)
- }
-
- if false {
- } else {
- z.F.DecSliceStringX(x.FptrSliceString, d)
- }
- }
- case "FSliceFloat32":
- if r.TryDecodeAsNil() {
- x.FSliceFloat32 = nil
- } else {
- if false {
- } else {
- z.F.DecSliceFloat32X(&x.FSliceFloat32, d)
- }
- }
- case "FptrSliceFloat32":
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceFloat32 != nil {
- x.FptrSliceFloat32 = nil
- }
- } else {
- if x.FptrSliceFloat32 == nil {
- x.FptrSliceFloat32 = new([]float32)
- }
-
- if false {
- } else {
- z.F.DecSliceFloat32X(x.FptrSliceFloat32, d)
- }
- }
- case "FSliceFloat64":
- if r.TryDecodeAsNil() {
- x.FSliceFloat64 = nil
- } else {
- if false {
- } else {
- z.F.DecSliceFloat64X(&x.FSliceFloat64, d)
- }
- }
- case "FptrSliceFloat64":
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceFloat64 != nil {
- x.FptrSliceFloat64 = nil
- }
- } else {
- if x.FptrSliceFloat64 == nil {
- x.FptrSliceFloat64 = new([]float64)
- }
-
- if false {
- } else {
- z.F.DecSliceFloat64X(x.FptrSliceFloat64, d)
- }
- }
- case "FSliceUint":
- if r.TryDecodeAsNil() {
- x.FSliceUint = nil
- } else {
- if false {
- } else {
- z.F.DecSliceUintX(&x.FSliceUint, d)
- }
- }
- case "FptrSliceUint":
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceUint != nil {
- x.FptrSliceUint = nil
- }
- } else {
- if x.FptrSliceUint == nil {
- x.FptrSliceUint = new([]uint)
- }
-
- if false {
- } else {
- z.F.DecSliceUintX(x.FptrSliceUint, d)
- }
- }
- case "FSliceUint8":
- if r.TryDecodeAsNil() {
- x.FSliceUint8 = nil
- } else {
- if false {
- } else {
- x.FSliceUint8 = r.DecodeBytes(([]byte)(x.FSliceUint8), false)
- }
- }
- case "FptrSliceUint8":
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceUint8 != nil {
- x.FptrSliceUint8 = nil
- }
- } else {
- if x.FptrSliceUint8 == nil {
- x.FptrSliceUint8 = new([]uint8)
- }
-
- if false {
- } else {
- *x.FptrSliceUint8 = r.DecodeBytes(*(*[]byte)(x.FptrSliceUint8), false)
- }
- }
- case "FSliceUint16":
- if r.TryDecodeAsNil() {
- x.FSliceUint16 = nil
- } else {
- if false {
- } else {
- z.F.DecSliceUint16X(&x.FSliceUint16, d)
- }
- }
- case "FptrSliceUint16":
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceUint16 != nil {
- x.FptrSliceUint16 = nil
- }
- } else {
- if x.FptrSliceUint16 == nil {
- x.FptrSliceUint16 = new([]uint16)
- }
-
- if false {
- } else {
- z.F.DecSliceUint16X(x.FptrSliceUint16, d)
- }
- }
- case "FSliceUint32":
- if r.TryDecodeAsNil() {
- x.FSliceUint32 = nil
- } else {
- if false {
- } else {
- z.F.DecSliceUint32X(&x.FSliceUint32, d)
- }
- }
- case "FptrSliceUint32":
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceUint32 != nil {
- x.FptrSliceUint32 = nil
- }
- } else {
- if x.FptrSliceUint32 == nil {
- x.FptrSliceUint32 = new([]uint32)
- }
-
- if false {
- } else {
- z.F.DecSliceUint32X(x.FptrSliceUint32, d)
- }
- }
- case "FSliceUint64":
- if r.TryDecodeAsNil() {
- x.FSliceUint64 = nil
- } else {
- if false {
- } else {
- z.F.DecSliceUint64X(&x.FSliceUint64, d)
- }
- }
- case "FptrSliceUint64":
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceUint64 != nil {
- x.FptrSliceUint64 = nil
- }
- } else {
- if x.FptrSliceUint64 == nil {
- x.FptrSliceUint64 = new([]uint64)
- }
-
- if false {
- } else {
- z.F.DecSliceUint64X(x.FptrSliceUint64, d)
- }
- }
- case "FSliceUintptr":
- if r.TryDecodeAsNil() {
- x.FSliceUintptr = nil
- } else {
- if false {
- } else {
- z.F.DecSliceUintptrX(&x.FSliceUintptr, d)
- }
- }
- case "FptrSliceUintptr":
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceUintptr != nil {
- x.FptrSliceUintptr = nil
- }
- } else {
- if x.FptrSliceUintptr == nil {
- x.FptrSliceUintptr = new([]uintptr)
- }
-
- if false {
- } else {
- z.F.DecSliceUintptrX(x.FptrSliceUintptr, d)
- }
- }
- case "FSliceInt":
- if r.TryDecodeAsNil() {
- x.FSliceInt = nil
- } else {
- if false {
- } else {
- z.F.DecSliceIntX(&x.FSliceInt, d)
- }
- }
- case "FptrSliceInt":
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceInt != nil {
- x.FptrSliceInt = nil
- }
- } else {
- if x.FptrSliceInt == nil {
- x.FptrSliceInt = new([]int)
- }
-
- if false {
- } else {
- z.F.DecSliceIntX(x.FptrSliceInt, d)
- }
- }
- case "FSliceInt8":
- if r.TryDecodeAsNil() {
- x.FSliceInt8 = nil
- } else {
- if false {
- } else {
- z.F.DecSliceInt8X(&x.FSliceInt8, d)
- }
- }
- case "FptrSliceInt8":
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceInt8 != nil {
- x.FptrSliceInt8 = nil
- }
- } else {
- if x.FptrSliceInt8 == nil {
- x.FptrSliceInt8 = new([]int8)
- }
-
- if false {
- } else {
- z.F.DecSliceInt8X(x.FptrSliceInt8, d)
- }
- }
- case "FSliceInt16":
- if r.TryDecodeAsNil() {
- x.FSliceInt16 = nil
- } else {
- if false {
- } else {
- z.F.DecSliceInt16X(&x.FSliceInt16, d)
- }
- }
- case "FptrSliceInt16":
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceInt16 != nil {
- x.FptrSliceInt16 = nil
- }
- } else {
- if x.FptrSliceInt16 == nil {
- x.FptrSliceInt16 = new([]int16)
- }
-
- if false {
- } else {
- z.F.DecSliceInt16X(x.FptrSliceInt16, d)
- }
- }
- case "FSliceInt32":
- if r.TryDecodeAsNil() {
- x.FSliceInt32 = nil
- } else {
- if false {
- } else {
- z.F.DecSliceInt32X(&x.FSliceInt32, d)
- }
- }
- case "FptrSliceInt32":
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceInt32 != nil {
- x.FptrSliceInt32 = nil
- }
- } else {
- if x.FptrSliceInt32 == nil {
- x.FptrSliceInt32 = new([]int32)
- }
-
- if false {
- } else {
- z.F.DecSliceInt32X(x.FptrSliceInt32, d)
- }
- }
- case "FSliceInt64":
- if r.TryDecodeAsNil() {
- x.FSliceInt64 = nil
- } else {
- if false {
- } else {
- z.F.DecSliceInt64X(&x.FSliceInt64, d)
- }
- }
- case "FptrSliceInt64":
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceInt64 != nil {
- x.FptrSliceInt64 = nil
- }
- } else {
- if x.FptrSliceInt64 == nil {
- x.FptrSliceInt64 = new([]int64)
- }
-
- if false {
- } else {
- z.F.DecSliceInt64X(x.FptrSliceInt64, d)
- }
- }
- case "FSliceBool":
- if r.TryDecodeAsNil() {
- x.FSliceBool = nil
- } else {
- if false {
- } else {
- z.F.DecSliceBoolX(&x.FSliceBool, d)
- }
- }
- case "FptrSliceBool":
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceBool != nil {
- x.FptrSliceBool = nil
- }
- } else {
- if x.FptrSliceBool == nil {
- x.FptrSliceBool = new([]bool)
- }
-
- if false {
- } else {
- z.F.DecSliceBoolX(x.FptrSliceBool, d)
- }
- }
- case "FMapIntfIntf":
- if r.TryDecodeAsNil() {
- x.FMapIntfIntf = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfIntfX(&x.FMapIntfIntf, d)
- }
- }
- case "FptrMapIntfIntf":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfIntf != nil {
- x.FptrMapIntfIntf = nil
- }
- } else {
- if x.FptrMapIntfIntf == nil {
- x.FptrMapIntfIntf = new(map[interface{}]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapIntfIntfX(x.FptrMapIntfIntf, d)
- }
- }
- case "FMapIntfString":
- if r.TryDecodeAsNil() {
- x.FMapIntfString = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfStringX(&x.FMapIntfString, d)
- }
- }
- case "FptrMapIntfString":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfString != nil {
- x.FptrMapIntfString = nil
- }
- } else {
- if x.FptrMapIntfString == nil {
- x.FptrMapIntfString = new(map[interface{}]string)
- }
-
- if false {
- } else {
- z.F.DecMapIntfStringX(x.FptrMapIntfString, d)
- }
- }
- case "FMapIntfUint":
- if r.TryDecodeAsNil() {
- x.FMapIntfUint = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfUintX(&x.FMapIntfUint, d)
- }
- }
- case "FptrMapIntfUint":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfUint != nil {
- x.FptrMapIntfUint = nil
- }
- } else {
- if x.FptrMapIntfUint == nil {
- x.FptrMapIntfUint = new(map[interface{}]uint)
- }
-
- if false {
- } else {
- z.F.DecMapIntfUintX(x.FptrMapIntfUint, d)
- }
- }
- case "FMapIntfUint8":
- if r.TryDecodeAsNil() {
- x.FMapIntfUint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfUint8X(&x.FMapIntfUint8, d)
- }
- }
- case "FptrMapIntfUint8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfUint8 != nil {
- x.FptrMapIntfUint8 = nil
- }
- } else {
- if x.FptrMapIntfUint8 == nil {
- x.FptrMapIntfUint8 = new(map[interface{}]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapIntfUint8X(x.FptrMapIntfUint8, d)
- }
- }
- case "FMapIntfUint16":
- if r.TryDecodeAsNil() {
- x.FMapIntfUint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfUint16X(&x.FMapIntfUint16, d)
- }
- }
- case "FptrMapIntfUint16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfUint16 != nil {
- x.FptrMapIntfUint16 = nil
- }
- } else {
- if x.FptrMapIntfUint16 == nil {
- x.FptrMapIntfUint16 = new(map[interface{}]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapIntfUint16X(x.FptrMapIntfUint16, d)
- }
- }
- case "FMapIntfUint32":
- if r.TryDecodeAsNil() {
- x.FMapIntfUint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfUint32X(&x.FMapIntfUint32, d)
- }
- }
- case "FptrMapIntfUint32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfUint32 != nil {
- x.FptrMapIntfUint32 = nil
- }
- } else {
- if x.FptrMapIntfUint32 == nil {
- x.FptrMapIntfUint32 = new(map[interface{}]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapIntfUint32X(x.FptrMapIntfUint32, d)
- }
- }
- case "FMapIntfUint64":
- if r.TryDecodeAsNil() {
- x.FMapIntfUint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfUint64X(&x.FMapIntfUint64, d)
- }
- }
- case "FptrMapIntfUint64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfUint64 != nil {
- x.FptrMapIntfUint64 = nil
- }
- } else {
- if x.FptrMapIntfUint64 == nil {
- x.FptrMapIntfUint64 = new(map[interface{}]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapIntfUint64X(x.FptrMapIntfUint64, d)
- }
- }
- case "FMapIntfUintptr":
- if r.TryDecodeAsNil() {
- x.FMapIntfUintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfUintptrX(&x.FMapIntfUintptr, d)
- }
- }
- case "FptrMapIntfUintptr":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfUintptr != nil {
- x.FptrMapIntfUintptr = nil
- }
- } else {
- if x.FptrMapIntfUintptr == nil {
- x.FptrMapIntfUintptr = new(map[interface{}]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapIntfUintptrX(x.FptrMapIntfUintptr, d)
- }
- }
- case "FMapIntfInt":
- if r.TryDecodeAsNil() {
- x.FMapIntfInt = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfIntX(&x.FMapIntfInt, d)
- }
- }
- case "FptrMapIntfInt":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfInt != nil {
- x.FptrMapIntfInt = nil
- }
- } else {
- if x.FptrMapIntfInt == nil {
- x.FptrMapIntfInt = new(map[interface{}]int)
- }
-
- if false {
- } else {
- z.F.DecMapIntfIntX(x.FptrMapIntfInt, d)
- }
- }
- case "FMapIntfInt8":
- if r.TryDecodeAsNil() {
- x.FMapIntfInt8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfInt8X(&x.FMapIntfInt8, d)
- }
- }
- case "FptrMapIntfInt8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfInt8 != nil {
- x.FptrMapIntfInt8 = nil
- }
- } else {
- if x.FptrMapIntfInt8 == nil {
- x.FptrMapIntfInt8 = new(map[interface{}]int8)
- }
-
- if false {
- } else {
- z.F.DecMapIntfInt8X(x.FptrMapIntfInt8, d)
- }
- }
- case "FMapIntfInt16":
- if r.TryDecodeAsNil() {
- x.FMapIntfInt16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfInt16X(&x.FMapIntfInt16, d)
- }
- }
- case "FptrMapIntfInt16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfInt16 != nil {
- x.FptrMapIntfInt16 = nil
- }
- } else {
- if x.FptrMapIntfInt16 == nil {
- x.FptrMapIntfInt16 = new(map[interface{}]int16)
- }
-
- if false {
- } else {
- z.F.DecMapIntfInt16X(x.FptrMapIntfInt16, d)
- }
- }
- case "FMapIntfInt32":
- if r.TryDecodeAsNil() {
- x.FMapIntfInt32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfInt32X(&x.FMapIntfInt32, d)
- }
- }
- case "FptrMapIntfInt32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfInt32 != nil {
- x.FptrMapIntfInt32 = nil
- }
- } else {
- if x.FptrMapIntfInt32 == nil {
- x.FptrMapIntfInt32 = new(map[interface{}]int32)
- }
-
- if false {
- } else {
- z.F.DecMapIntfInt32X(x.FptrMapIntfInt32, d)
- }
- }
- case "FMapIntfInt64":
- if r.TryDecodeAsNil() {
- x.FMapIntfInt64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfInt64X(&x.FMapIntfInt64, d)
- }
- }
- case "FptrMapIntfInt64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfInt64 != nil {
- x.FptrMapIntfInt64 = nil
- }
- } else {
- if x.FptrMapIntfInt64 == nil {
- x.FptrMapIntfInt64 = new(map[interface{}]int64)
- }
-
- if false {
- } else {
- z.F.DecMapIntfInt64X(x.FptrMapIntfInt64, d)
- }
- }
- case "FMapIntfFloat32":
- if r.TryDecodeAsNil() {
- x.FMapIntfFloat32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfFloat32X(&x.FMapIntfFloat32, d)
- }
- }
- case "FptrMapIntfFloat32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfFloat32 != nil {
- x.FptrMapIntfFloat32 = nil
- }
- } else {
- if x.FptrMapIntfFloat32 == nil {
- x.FptrMapIntfFloat32 = new(map[interface{}]float32)
- }
-
- if false {
- } else {
- z.F.DecMapIntfFloat32X(x.FptrMapIntfFloat32, d)
- }
- }
- case "FMapIntfFloat64":
- if r.TryDecodeAsNil() {
- x.FMapIntfFloat64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfFloat64X(&x.FMapIntfFloat64, d)
- }
- }
- case "FptrMapIntfFloat64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfFloat64 != nil {
- x.FptrMapIntfFloat64 = nil
- }
- } else {
- if x.FptrMapIntfFloat64 == nil {
- x.FptrMapIntfFloat64 = new(map[interface{}]float64)
- }
-
- if false {
- } else {
- z.F.DecMapIntfFloat64X(x.FptrMapIntfFloat64, d)
- }
- }
- case "FMapIntfBool":
- if r.TryDecodeAsNil() {
- x.FMapIntfBool = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfBoolX(&x.FMapIntfBool, d)
- }
- }
- case "FptrMapIntfBool":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfBool != nil {
- x.FptrMapIntfBool = nil
- }
- } else {
- if x.FptrMapIntfBool == nil {
- x.FptrMapIntfBool = new(map[interface{}]bool)
- }
-
- if false {
- } else {
- z.F.DecMapIntfBoolX(x.FptrMapIntfBool, d)
- }
- }
- case "FMapStringIntf":
- if r.TryDecodeAsNil() {
- x.FMapStringIntf = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringIntfX(&x.FMapStringIntf, d)
- }
- }
- case "FptrMapStringIntf":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringIntf != nil {
- x.FptrMapStringIntf = nil
- }
- } else {
- if x.FptrMapStringIntf == nil {
- x.FptrMapStringIntf = new(map[string]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapStringIntfX(x.FptrMapStringIntf, d)
- }
- }
- case "FMapStringString":
- if r.TryDecodeAsNil() {
- x.FMapStringString = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringStringX(&x.FMapStringString, d)
- }
- }
- case "FptrMapStringString":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringString != nil {
- x.FptrMapStringString = nil
- }
- } else {
- if x.FptrMapStringString == nil {
- x.FptrMapStringString = new(map[string]string)
- }
-
- if false {
- } else {
- z.F.DecMapStringStringX(x.FptrMapStringString, d)
- }
- }
- case "FMapStringUint":
- if r.TryDecodeAsNil() {
- x.FMapStringUint = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringUintX(&x.FMapStringUint, d)
- }
- }
- case "FptrMapStringUint":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringUint != nil {
- x.FptrMapStringUint = nil
- }
- } else {
- if x.FptrMapStringUint == nil {
- x.FptrMapStringUint = new(map[string]uint)
- }
-
- if false {
- } else {
- z.F.DecMapStringUintX(x.FptrMapStringUint, d)
- }
- }
- case "FMapStringUint8":
- if r.TryDecodeAsNil() {
- x.FMapStringUint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringUint8X(&x.FMapStringUint8, d)
- }
- }
- case "FptrMapStringUint8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringUint8 != nil {
- x.FptrMapStringUint8 = nil
- }
- } else {
- if x.FptrMapStringUint8 == nil {
- x.FptrMapStringUint8 = new(map[string]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapStringUint8X(x.FptrMapStringUint8, d)
- }
- }
- case "FMapStringUint16":
- if r.TryDecodeAsNil() {
- x.FMapStringUint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringUint16X(&x.FMapStringUint16, d)
- }
- }
- case "FptrMapStringUint16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringUint16 != nil {
- x.FptrMapStringUint16 = nil
- }
- } else {
- if x.FptrMapStringUint16 == nil {
- x.FptrMapStringUint16 = new(map[string]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapStringUint16X(x.FptrMapStringUint16, d)
- }
- }
- case "FMapStringUint32":
- if r.TryDecodeAsNil() {
- x.FMapStringUint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringUint32X(&x.FMapStringUint32, d)
- }
- }
- case "FptrMapStringUint32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringUint32 != nil {
- x.FptrMapStringUint32 = nil
- }
- } else {
- if x.FptrMapStringUint32 == nil {
- x.FptrMapStringUint32 = new(map[string]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapStringUint32X(x.FptrMapStringUint32, d)
- }
- }
- case "FMapStringUint64":
- if r.TryDecodeAsNil() {
- x.FMapStringUint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringUint64X(&x.FMapStringUint64, d)
- }
- }
- case "FptrMapStringUint64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringUint64 != nil {
- x.FptrMapStringUint64 = nil
- }
- } else {
- if x.FptrMapStringUint64 == nil {
- x.FptrMapStringUint64 = new(map[string]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapStringUint64X(x.FptrMapStringUint64, d)
- }
- }
- case "FMapStringUintptr":
- if r.TryDecodeAsNil() {
- x.FMapStringUintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringUintptrX(&x.FMapStringUintptr, d)
- }
- }
- case "FptrMapStringUintptr":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringUintptr != nil {
- x.FptrMapStringUintptr = nil
- }
- } else {
- if x.FptrMapStringUintptr == nil {
- x.FptrMapStringUintptr = new(map[string]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapStringUintptrX(x.FptrMapStringUintptr, d)
- }
- }
- case "FMapStringInt":
- if r.TryDecodeAsNil() {
- x.FMapStringInt = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringIntX(&x.FMapStringInt, d)
- }
- }
- case "FptrMapStringInt":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringInt != nil {
- x.FptrMapStringInt = nil
- }
- } else {
- if x.FptrMapStringInt == nil {
- x.FptrMapStringInt = new(map[string]int)
- }
-
- if false {
- } else {
- z.F.DecMapStringIntX(x.FptrMapStringInt, d)
- }
- }
- case "FMapStringInt8":
- if r.TryDecodeAsNil() {
- x.FMapStringInt8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringInt8X(&x.FMapStringInt8, d)
- }
- }
- case "FptrMapStringInt8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringInt8 != nil {
- x.FptrMapStringInt8 = nil
- }
- } else {
- if x.FptrMapStringInt8 == nil {
- x.FptrMapStringInt8 = new(map[string]int8)
- }
-
- if false {
- } else {
- z.F.DecMapStringInt8X(x.FptrMapStringInt8, d)
- }
- }
- case "FMapStringInt16":
- if r.TryDecodeAsNil() {
- x.FMapStringInt16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringInt16X(&x.FMapStringInt16, d)
- }
- }
- case "FptrMapStringInt16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringInt16 != nil {
- x.FptrMapStringInt16 = nil
- }
- } else {
- if x.FptrMapStringInt16 == nil {
- x.FptrMapStringInt16 = new(map[string]int16)
- }
-
- if false {
- } else {
- z.F.DecMapStringInt16X(x.FptrMapStringInt16, d)
- }
- }
- case "FMapStringInt32":
- if r.TryDecodeAsNil() {
- x.FMapStringInt32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringInt32X(&x.FMapStringInt32, d)
- }
- }
- case "FptrMapStringInt32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringInt32 != nil {
- x.FptrMapStringInt32 = nil
- }
- } else {
- if x.FptrMapStringInt32 == nil {
- x.FptrMapStringInt32 = new(map[string]int32)
- }
-
- if false {
- } else {
- z.F.DecMapStringInt32X(x.FptrMapStringInt32, d)
- }
- }
- case "FMapStringInt64":
- if r.TryDecodeAsNil() {
- x.FMapStringInt64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringInt64X(&x.FMapStringInt64, d)
- }
- }
- case "FptrMapStringInt64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringInt64 != nil {
- x.FptrMapStringInt64 = nil
- }
- } else {
- if x.FptrMapStringInt64 == nil {
- x.FptrMapStringInt64 = new(map[string]int64)
- }
-
- if false {
- } else {
- z.F.DecMapStringInt64X(x.FptrMapStringInt64, d)
- }
- }
- case "FMapStringFloat32":
- if r.TryDecodeAsNil() {
- x.FMapStringFloat32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringFloat32X(&x.FMapStringFloat32, d)
- }
- }
- case "FptrMapStringFloat32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringFloat32 != nil {
- x.FptrMapStringFloat32 = nil
- }
- } else {
- if x.FptrMapStringFloat32 == nil {
- x.FptrMapStringFloat32 = new(map[string]float32)
- }
-
- if false {
- } else {
- z.F.DecMapStringFloat32X(x.FptrMapStringFloat32, d)
- }
- }
- case "FMapStringFloat64":
- if r.TryDecodeAsNil() {
- x.FMapStringFloat64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringFloat64X(&x.FMapStringFloat64, d)
- }
- }
- case "FptrMapStringFloat64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringFloat64 != nil {
- x.FptrMapStringFloat64 = nil
- }
- } else {
- if x.FptrMapStringFloat64 == nil {
- x.FptrMapStringFloat64 = new(map[string]float64)
- }
-
- if false {
- } else {
- z.F.DecMapStringFloat64X(x.FptrMapStringFloat64, d)
- }
- }
- case "FMapStringBool":
- if r.TryDecodeAsNil() {
- x.FMapStringBool = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringBoolX(&x.FMapStringBool, d)
- }
- }
- case "FptrMapStringBool":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringBool != nil {
- x.FptrMapStringBool = nil
- }
- } else {
- if x.FptrMapStringBool == nil {
- x.FptrMapStringBool = new(map[string]bool)
- }
-
- if false {
- } else {
- z.F.DecMapStringBoolX(x.FptrMapStringBool, d)
- }
- }
- case "FMapFloat32Intf":
- if r.TryDecodeAsNil() {
- x.FMapFloat32Intf = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32IntfX(&x.FMapFloat32Intf, d)
- }
- }
- case "FptrMapFloat32Intf":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Intf != nil {
- x.FptrMapFloat32Intf = nil
- }
- } else {
- if x.FptrMapFloat32Intf == nil {
- x.FptrMapFloat32Intf = new(map[float32]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapFloat32IntfX(x.FptrMapFloat32Intf, d)
- }
- }
- case "FMapFloat32String":
- if r.TryDecodeAsNil() {
- x.FMapFloat32String = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32StringX(&x.FMapFloat32String, d)
- }
- }
- case "FptrMapFloat32String":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32String != nil {
- x.FptrMapFloat32String = nil
- }
- } else {
- if x.FptrMapFloat32String == nil {
- x.FptrMapFloat32String = new(map[float32]string)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32StringX(x.FptrMapFloat32String, d)
- }
- }
- case "FMapFloat32Uint":
- if r.TryDecodeAsNil() {
- x.FMapFloat32Uint = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32UintX(&x.FMapFloat32Uint, d)
- }
- }
- case "FptrMapFloat32Uint":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Uint != nil {
- x.FptrMapFloat32Uint = nil
- }
- } else {
- if x.FptrMapFloat32Uint == nil {
- x.FptrMapFloat32Uint = new(map[float32]uint)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32UintX(x.FptrMapFloat32Uint, d)
- }
- }
- case "FMapFloat32Uint8":
- if r.TryDecodeAsNil() {
- x.FMapFloat32Uint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32Uint8X(&x.FMapFloat32Uint8, d)
- }
- }
- case "FptrMapFloat32Uint8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Uint8 != nil {
- x.FptrMapFloat32Uint8 = nil
- }
- } else {
- if x.FptrMapFloat32Uint8 == nil {
- x.FptrMapFloat32Uint8 = new(map[float32]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32Uint8X(x.FptrMapFloat32Uint8, d)
- }
- }
- case "FMapFloat32Uint16":
- if r.TryDecodeAsNil() {
- x.FMapFloat32Uint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32Uint16X(&x.FMapFloat32Uint16, d)
- }
- }
- case "FptrMapFloat32Uint16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Uint16 != nil {
- x.FptrMapFloat32Uint16 = nil
- }
- } else {
- if x.FptrMapFloat32Uint16 == nil {
- x.FptrMapFloat32Uint16 = new(map[float32]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32Uint16X(x.FptrMapFloat32Uint16, d)
- }
- }
- case "FMapFloat32Uint32":
- if r.TryDecodeAsNil() {
- x.FMapFloat32Uint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32Uint32X(&x.FMapFloat32Uint32, d)
- }
- }
- case "FptrMapFloat32Uint32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Uint32 != nil {
- x.FptrMapFloat32Uint32 = nil
- }
- } else {
- if x.FptrMapFloat32Uint32 == nil {
- x.FptrMapFloat32Uint32 = new(map[float32]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32Uint32X(x.FptrMapFloat32Uint32, d)
- }
- }
- case "FMapFloat32Uint64":
- if r.TryDecodeAsNil() {
- x.FMapFloat32Uint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32Uint64X(&x.FMapFloat32Uint64, d)
- }
- }
- case "FptrMapFloat32Uint64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Uint64 != nil {
- x.FptrMapFloat32Uint64 = nil
- }
- } else {
- if x.FptrMapFloat32Uint64 == nil {
- x.FptrMapFloat32Uint64 = new(map[float32]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32Uint64X(x.FptrMapFloat32Uint64, d)
- }
- }
- case "FMapFloat32Uintptr":
- if r.TryDecodeAsNil() {
- x.FMapFloat32Uintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32UintptrX(&x.FMapFloat32Uintptr, d)
- }
- }
- case "FptrMapFloat32Uintptr":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Uintptr != nil {
- x.FptrMapFloat32Uintptr = nil
- }
- } else {
- if x.FptrMapFloat32Uintptr == nil {
- x.FptrMapFloat32Uintptr = new(map[float32]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32UintptrX(x.FptrMapFloat32Uintptr, d)
- }
- }
- case "FMapFloat32Int":
- if r.TryDecodeAsNil() {
- x.FMapFloat32Int = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32IntX(&x.FMapFloat32Int, d)
- }
- }
- case "FptrMapFloat32Int":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Int != nil {
- x.FptrMapFloat32Int = nil
- }
- } else {
- if x.FptrMapFloat32Int == nil {
- x.FptrMapFloat32Int = new(map[float32]int)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32IntX(x.FptrMapFloat32Int, d)
- }
- }
- case "FMapFloat32Int8":
- if r.TryDecodeAsNil() {
- x.FMapFloat32Int8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32Int8X(&x.FMapFloat32Int8, d)
- }
- }
- case "FptrMapFloat32Int8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Int8 != nil {
- x.FptrMapFloat32Int8 = nil
- }
- } else {
- if x.FptrMapFloat32Int8 == nil {
- x.FptrMapFloat32Int8 = new(map[float32]int8)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32Int8X(x.FptrMapFloat32Int8, d)
- }
- }
- case "FMapFloat32Int16":
- if r.TryDecodeAsNil() {
- x.FMapFloat32Int16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32Int16X(&x.FMapFloat32Int16, d)
- }
- }
- case "FptrMapFloat32Int16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Int16 != nil {
- x.FptrMapFloat32Int16 = nil
- }
- } else {
- if x.FptrMapFloat32Int16 == nil {
- x.FptrMapFloat32Int16 = new(map[float32]int16)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32Int16X(x.FptrMapFloat32Int16, d)
- }
- }
- case "FMapFloat32Int32":
- if r.TryDecodeAsNil() {
- x.FMapFloat32Int32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32Int32X(&x.FMapFloat32Int32, d)
- }
- }
- case "FptrMapFloat32Int32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Int32 != nil {
- x.FptrMapFloat32Int32 = nil
- }
- } else {
- if x.FptrMapFloat32Int32 == nil {
- x.FptrMapFloat32Int32 = new(map[float32]int32)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32Int32X(x.FptrMapFloat32Int32, d)
- }
- }
- case "FMapFloat32Int64":
- if r.TryDecodeAsNil() {
- x.FMapFloat32Int64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32Int64X(&x.FMapFloat32Int64, d)
- }
- }
- case "FptrMapFloat32Int64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Int64 != nil {
- x.FptrMapFloat32Int64 = nil
- }
- } else {
- if x.FptrMapFloat32Int64 == nil {
- x.FptrMapFloat32Int64 = new(map[float32]int64)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32Int64X(x.FptrMapFloat32Int64, d)
- }
- }
- case "FMapFloat32Float32":
- if r.TryDecodeAsNil() {
- x.FMapFloat32Float32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32Float32X(&x.FMapFloat32Float32, d)
- }
- }
- case "FptrMapFloat32Float32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Float32 != nil {
- x.FptrMapFloat32Float32 = nil
- }
- } else {
- if x.FptrMapFloat32Float32 == nil {
- x.FptrMapFloat32Float32 = new(map[float32]float32)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32Float32X(x.FptrMapFloat32Float32, d)
- }
- }
- case "FMapFloat32Float64":
- if r.TryDecodeAsNil() {
- x.FMapFloat32Float64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32Float64X(&x.FMapFloat32Float64, d)
- }
- }
- case "FptrMapFloat32Float64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Float64 != nil {
- x.FptrMapFloat32Float64 = nil
- }
- } else {
- if x.FptrMapFloat32Float64 == nil {
- x.FptrMapFloat32Float64 = new(map[float32]float64)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32Float64X(x.FptrMapFloat32Float64, d)
- }
- }
- case "FMapFloat32Bool":
- if r.TryDecodeAsNil() {
- x.FMapFloat32Bool = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32BoolX(&x.FMapFloat32Bool, d)
- }
- }
- case "FptrMapFloat32Bool":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Bool != nil {
- x.FptrMapFloat32Bool = nil
- }
- } else {
- if x.FptrMapFloat32Bool == nil {
- x.FptrMapFloat32Bool = new(map[float32]bool)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32BoolX(x.FptrMapFloat32Bool, d)
- }
- }
- case "FMapFloat64Intf":
- if r.TryDecodeAsNil() {
- x.FMapFloat64Intf = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64IntfX(&x.FMapFloat64Intf, d)
- }
- }
- case "FptrMapFloat64Intf":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Intf != nil {
- x.FptrMapFloat64Intf = nil
- }
- } else {
- if x.FptrMapFloat64Intf == nil {
- x.FptrMapFloat64Intf = new(map[float64]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapFloat64IntfX(x.FptrMapFloat64Intf, d)
- }
- }
- case "FMapFloat64String":
- if r.TryDecodeAsNil() {
- x.FMapFloat64String = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64StringX(&x.FMapFloat64String, d)
- }
- }
- case "FptrMapFloat64String":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64String != nil {
- x.FptrMapFloat64String = nil
- }
- } else {
- if x.FptrMapFloat64String == nil {
- x.FptrMapFloat64String = new(map[float64]string)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64StringX(x.FptrMapFloat64String, d)
- }
- }
- case "FMapFloat64Uint":
- if r.TryDecodeAsNil() {
- x.FMapFloat64Uint = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64UintX(&x.FMapFloat64Uint, d)
- }
- }
- case "FptrMapFloat64Uint":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Uint != nil {
- x.FptrMapFloat64Uint = nil
- }
- } else {
- if x.FptrMapFloat64Uint == nil {
- x.FptrMapFloat64Uint = new(map[float64]uint)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64UintX(x.FptrMapFloat64Uint, d)
- }
- }
- case "FMapFloat64Uint8":
- if r.TryDecodeAsNil() {
- x.FMapFloat64Uint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64Uint8X(&x.FMapFloat64Uint8, d)
- }
- }
- case "FptrMapFloat64Uint8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Uint8 != nil {
- x.FptrMapFloat64Uint8 = nil
- }
- } else {
- if x.FptrMapFloat64Uint8 == nil {
- x.FptrMapFloat64Uint8 = new(map[float64]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64Uint8X(x.FptrMapFloat64Uint8, d)
- }
- }
- case "FMapFloat64Uint16":
- if r.TryDecodeAsNil() {
- x.FMapFloat64Uint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64Uint16X(&x.FMapFloat64Uint16, d)
- }
- }
- case "FptrMapFloat64Uint16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Uint16 != nil {
- x.FptrMapFloat64Uint16 = nil
- }
- } else {
- if x.FptrMapFloat64Uint16 == nil {
- x.FptrMapFloat64Uint16 = new(map[float64]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64Uint16X(x.FptrMapFloat64Uint16, d)
- }
- }
- case "FMapFloat64Uint32":
- if r.TryDecodeAsNil() {
- x.FMapFloat64Uint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64Uint32X(&x.FMapFloat64Uint32, d)
- }
- }
- case "FptrMapFloat64Uint32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Uint32 != nil {
- x.FptrMapFloat64Uint32 = nil
- }
- } else {
- if x.FptrMapFloat64Uint32 == nil {
- x.FptrMapFloat64Uint32 = new(map[float64]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64Uint32X(x.FptrMapFloat64Uint32, d)
- }
- }
- case "FMapFloat64Uint64":
- if r.TryDecodeAsNil() {
- x.FMapFloat64Uint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64Uint64X(&x.FMapFloat64Uint64, d)
- }
- }
- case "FptrMapFloat64Uint64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Uint64 != nil {
- x.FptrMapFloat64Uint64 = nil
- }
- } else {
- if x.FptrMapFloat64Uint64 == nil {
- x.FptrMapFloat64Uint64 = new(map[float64]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64Uint64X(x.FptrMapFloat64Uint64, d)
- }
- }
- case "FMapFloat64Uintptr":
- if r.TryDecodeAsNil() {
- x.FMapFloat64Uintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64UintptrX(&x.FMapFloat64Uintptr, d)
- }
- }
- case "FptrMapFloat64Uintptr":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Uintptr != nil {
- x.FptrMapFloat64Uintptr = nil
- }
- } else {
- if x.FptrMapFloat64Uintptr == nil {
- x.FptrMapFloat64Uintptr = new(map[float64]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64UintptrX(x.FptrMapFloat64Uintptr, d)
- }
- }
- case "FMapFloat64Int":
- if r.TryDecodeAsNil() {
- x.FMapFloat64Int = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64IntX(&x.FMapFloat64Int, d)
- }
- }
- case "FptrMapFloat64Int":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Int != nil {
- x.FptrMapFloat64Int = nil
- }
- } else {
- if x.FptrMapFloat64Int == nil {
- x.FptrMapFloat64Int = new(map[float64]int)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64IntX(x.FptrMapFloat64Int, d)
- }
- }
- case "FMapFloat64Int8":
- if r.TryDecodeAsNil() {
- x.FMapFloat64Int8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64Int8X(&x.FMapFloat64Int8, d)
- }
- }
- case "FptrMapFloat64Int8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Int8 != nil {
- x.FptrMapFloat64Int8 = nil
- }
- } else {
- if x.FptrMapFloat64Int8 == nil {
- x.FptrMapFloat64Int8 = new(map[float64]int8)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64Int8X(x.FptrMapFloat64Int8, d)
- }
- }
- case "FMapFloat64Int16":
- if r.TryDecodeAsNil() {
- x.FMapFloat64Int16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64Int16X(&x.FMapFloat64Int16, d)
- }
- }
- case "FptrMapFloat64Int16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Int16 != nil {
- x.FptrMapFloat64Int16 = nil
- }
- } else {
- if x.FptrMapFloat64Int16 == nil {
- x.FptrMapFloat64Int16 = new(map[float64]int16)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64Int16X(x.FptrMapFloat64Int16, d)
- }
- }
- case "FMapFloat64Int32":
- if r.TryDecodeAsNil() {
- x.FMapFloat64Int32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64Int32X(&x.FMapFloat64Int32, d)
- }
- }
- case "FptrMapFloat64Int32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Int32 != nil {
- x.FptrMapFloat64Int32 = nil
- }
- } else {
- if x.FptrMapFloat64Int32 == nil {
- x.FptrMapFloat64Int32 = new(map[float64]int32)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64Int32X(x.FptrMapFloat64Int32, d)
- }
- }
- case "FMapFloat64Int64":
- if r.TryDecodeAsNil() {
- x.FMapFloat64Int64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64Int64X(&x.FMapFloat64Int64, d)
- }
- }
- case "FptrMapFloat64Int64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Int64 != nil {
- x.FptrMapFloat64Int64 = nil
- }
- } else {
- if x.FptrMapFloat64Int64 == nil {
- x.FptrMapFloat64Int64 = new(map[float64]int64)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64Int64X(x.FptrMapFloat64Int64, d)
- }
- }
- case "FMapFloat64Float32":
- if r.TryDecodeAsNil() {
- x.FMapFloat64Float32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64Float32X(&x.FMapFloat64Float32, d)
- }
- }
- case "FptrMapFloat64Float32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Float32 != nil {
- x.FptrMapFloat64Float32 = nil
- }
- } else {
- if x.FptrMapFloat64Float32 == nil {
- x.FptrMapFloat64Float32 = new(map[float64]float32)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64Float32X(x.FptrMapFloat64Float32, d)
- }
- }
- case "FMapFloat64Float64":
- if r.TryDecodeAsNil() {
- x.FMapFloat64Float64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64Float64X(&x.FMapFloat64Float64, d)
- }
- }
- case "FptrMapFloat64Float64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Float64 != nil {
- x.FptrMapFloat64Float64 = nil
- }
- } else {
- if x.FptrMapFloat64Float64 == nil {
- x.FptrMapFloat64Float64 = new(map[float64]float64)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64Float64X(x.FptrMapFloat64Float64, d)
- }
- }
- case "FMapFloat64Bool":
- if r.TryDecodeAsNil() {
- x.FMapFloat64Bool = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64BoolX(&x.FMapFloat64Bool, d)
- }
- }
- case "FptrMapFloat64Bool":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Bool != nil {
- x.FptrMapFloat64Bool = nil
- }
- } else {
- if x.FptrMapFloat64Bool == nil {
- x.FptrMapFloat64Bool = new(map[float64]bool)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64BoolX(x.FptrMapFloat64Bool, d)
- }
- }
- case "FMapUintIntf":
- if r.TryDecodeAsNil() {
- x.FMapUintIntf = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintIntfX(&x.FMapUintIntf, d)
- }
- }
- case "FptrMapUintIntf":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintIntf != nil {
- x.FptrMapUintIntf = nil
- }
- } else {
- if x.FptrMapUintIntf == nil {
- x.FptrMapUintIntf = new(map[uint]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapUintIntfX(x.FptrMapUintIntf, d)
- }
- }
- case "FMapUintString":
- if r.TryDecodeAsNil() {
- x.FMapUintString = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintStringX(&x.FMapUintString, d)
- }
- }
- case "FptrMapUintString":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintString != nil {
- x.FptrMapUintString = nil
- }
- } else {
- if x.FptrMapUintString == nil {
- x.FptrMapUintString = new(map[uint]string)
- }
-
- if false {
- } else {
- z.F.DecMapUintStringX(x.FptrMapUintString, d)
- }
- }
- case "FMapUintUint":
- if r.TryDecodeAsNil() {
- x.FMapUintUint = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintUintX(&x.FMapUintUint, d)
- }
- }
- case "FptrMapUintUint":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintUint != nil {
- x.FptrMapUintUint = nil
- }
- } else {
- if x.FptrMapUintUint == nil {
- x.FptrMapUintUint = new(map[uint]uint)
- }
-
- if false {
- } else {
- z.F.DecMapUintUintX(x.FptrMapUintUint, d)
- }
- }
- case "FMapUintUint8":
- if r.TryDecodeAsNil() {
- x.FMapUintUint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintUint8X(&x.FMapUintUint8, d)
- }
- }
- case "FptrMapUintUint8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintUint8 != nil {
- x.FptrMapUintUint8 = nil
- }
- } else {
- if x.FptrMapUintUint8 == nil {
- x.FptrMapUintUint8 = new(map[uint]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapUintUint8X(x.FptrMapUintUint8, d)
- }
- }
- case "FMapUintUint16":
- if r.TryDecodeAsNil() {
- x.FMapUintUint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintUint16X(&x.FMapUintUint16, d)
- }
- }
- case "FptrMapUintUint16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintUint16 != nil {
- x.FptrMapUintUint16 = nil
- }
- } else {
- if x.FptrMapUintUint16 == nil {
- x.FptrMapUintUint16 = new(map[uint]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapUintUint16X(x.FptrMapUintUint16, d)
- }
- }
- case "FMapUintUint32":
- if r.TryDecodeAsNil() {
- x.FMapUintUint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintUint32X(&x.FMapUintUint32, d)
- }
- }
- case "FptrMapUintUint32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintUint32 != nil {
- x.FptrMapUintUint32 = nil
- }
- } else {
- if x.FptrMapUintUint32 == nil {
- x.FptrMapUintUint32 = new(map[uint]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapUintUint32X(x.FptrMapUintUint32, d)
- }
- }
- case "FMapUintUint64":
- if r.TryDecodeAsNil() {
- x.FMapUintUint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintUint64X(&x.FMapUintUint64, d)
- }
- }
- case "FptrMapUintUint64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintUint64 != nil {
- x.FptrMapUintUint64 = nil
- }
- } else {
- if x.FptrMapUintUint64 == nil {
- x.FptrMapUintUint64 = new(map[uint]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapUintUint64X(x.FptrMapUintUint64, d)
- }
- }
- case "FMapUintUintptr":
- if r.TryDecodeAsNil() {
- x.FMapUintUintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintUintptrX(&x.FMapUintUintptr, d)
- }
- }
- case "FptrMapUintUintptr":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintUintptr != nil {
- x.FptrMapUintUintptr = nil
- }
- } else {
- if x.FptrMapUintUintptr == nil {
- x.FptrMapUintUintptr = new(map[uint]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapUintUintptrX(x.FptrMapUintUintptr, d)
- }
- }
- case "FMapUintInt":
- if r.TryDecodeAsNil() {
- x.FMapUintInt = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintIntX(&x.FMapUintInt, d)
- }
- }
- case "FptrMapUintInt":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintInt != nil {
- x.FptrMapUintInt = nil
- }
- } else {
- if x.FptrMapUintInt == nil {
- x.FptrMapUintInt = new(map[uint]int)
- }
-
- if false {
- } else {
- z.F.DecMapUintIntX(x.FptrMapUintInt, d)
- }
- }
- case "FMapUintInt8":
- if r.TryDecodeAsNil() {
- x.FMapUintInt8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintInt8X(&x.FMapUintInt8, d)
- }
- }
- case "FptrMapUintInt8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintInt8 != nil {
- x.FptrMapUintInt8 = nil
- }
- } else {
- if x.FptrMapUintInt8 == nil {
- x.FptrMapUintInt8 = new(map[uint]int8)
- }
-
- if false {
- } else {
- z.F.DecMapUintInt8X(x.FptrMapUintInt8, d)
- }
- }
- case "FMapUintInt16":
- if r.TryDecodeAsNil() {
- x.FMapUintInt16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintInt16X(&x.FMapUintInt16, d)
- }
- }
- case "FptrMapUintInt16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintInt16 != nil {
- x.FptrMapUintInt16 = nil
- }
- } else {
- if x.FptrMapUintInt16 == nil {
- x.FptrMapUintInt16 = new(map[uint]int16)
- }
-
- if false {
- } else {
- z.F.DecMapUintInt16X(x.FptrMapUintInt16, d)
- }
- }
- case "FMapUintInt32":
- if r.TryDecodeAsNil() {
- x.FMapUintInt32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintInt32X(&x.FMapUintInt32, d)
- }
- }
- case "FptrMapUintInt32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintInt32 != nil {
- x.FptrMapUintInt32 = nil
- }
- } else {
- if x.FptrMapUintInt32 == nil {
- x.FptrMapUintInt32 = new(map[uint]int32)
- }
-
- if false {
- } else {
- z.F.DecMapUintInt32X(x.FptrMapUintInt32, d)
- }
- }
- case "FMapUintInt64":
- if r.TryDecodeAsNil() {
- x.FMapUintInt64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintInt64X(&x.FMapUintInt64, d)
- }
- }
- case "FptrMapUintInt64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintInt64 != nil {
- x.FptrMapUintInt64 = nil
- }
- } else {
- if x.FptrMapUintInt64 == nil {
- x.FptrMapUintInt64 = new(map[uint]int64)
- }
-
- if false {
- } else {
- z.F.DecMapUintInt64X(x.FptrMapUintInt64, d)
- }
- }
- case "FMapUintFloat32":
- if r.TryDecodeAsNil() {
- x.FMapUintFloat32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintFloat32X(&x.FMapUintFloat32, d)
- }
- }
- case "FptrMapUintFloat32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintFloat32 != nil {
- x.FptrMapUintFloat32 = nil
- }
- } else {
- if x.FptrMapUintFloat32 == nil {
- x.FptrMapUintFloat32 = new(map[uint]float32)
- }
-
- if false {
- } else {
- z.F.DecMapUintFloat32X(x.FptrMapUintFloat32, d)
- }
- }
- case "FMapUintFloat64":
- if r.TryDecodeAsNil() {
- x.FMapUintFloat64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintFloat64X(&x.FMapUintFloat64, d)
- }
- }
- case "FptrMapUintFloat64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintFloat64 != nil {
- x.FptrMapUintFloat64 = nil
- }
- } else {
- if x.FptrMapUintFloat64 == nil {
- x.FptrMapUintFloat64 = new(map[uint]float64)
- }
-
- if false {
- } else {
- z.F.DecMapUintFloat64X(x.FptrMapUintFloat64, d)
- }
- }
- case "FMapUintBool":
- if r.TryDecodeAsNil() {
- x.FMapUintBool = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintBoolX(&x.FMapUintBool, d)
- }
- }
- case "FptrMapUintBool":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintBool != nil {
- x.FptrMapUintBool = nil
- }
- } else {
- if x.FptrMapUintBool == nil {
- x.FptrMapUintBool = new(map[uint]bool)
- }
-
- if false {
- } else {
- z.F.DecMapUintBoolX(x.FptrMapUintBool, d)
- }
- }
- case "FMapUint8Intf":
- if r.TryDecodeAsNil() {
- x.FMapUint8Intf = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8IntfX(&x.FMapUint8Intf, d)
- }
- }
- case "FptrMapUint8Intf":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Intf != nil {
- x.FptrMapUint8Intf = nil
- }
- } else {
- if x.FptrMapUint8Intf == nil {
- x.FptrMapUint8Intf = new(map[uint8]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapUint8IntfX(x.FptrMapUint8Intf, d)
- }
- }
- case "FMapUint8String":
- if r.TryDecodeAsNil() {
- x.FMapUint8String = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8StringX(&x.FMapUint8String, d)
- }
- }
- case "FptrMapUint8String":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8String != nil {
- x.FptrMapUint8String = nil
- }
- } else {
- if x.FptrMapUint8String == nil {
- x.FptrMapUint8String = new(map[uint8]string)
- }
-
- if false {
- } else {
- z.F.DecMapUint8StringX(x.FptrMapUint8String, d)
- }
- }
- case "FMapUint8Uint":
- if r.TryDecodeAsNil() {
- x.FMapUint8Uint = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8UintX(&x.FMapUint8Uint, d)
- }
- }
- case "FptrMapUint8Uint":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Uint != nil {
- x.FptrMapUint8Uint = nil
- }
- } else {
- if x.FptrMapUint8Uint == nil {
- x.FptrMapUint8Uint = new(map[uint8]uint)
- }
-
- if false {
- } else {
- z.F.DecMapUint8UintX(x.FptrMapUint8Uint, d)
- }
- }
- case "FMapUint8Uint8":
- if r.TryDecodeAsNil() {
- x.FMapUint8Uint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8Uint8X(&x.FMapUint8Uint8, d)
- }
- }
- case "FptrMapUint8Uint8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Uint8 != nil {
- x.FptrMapUint8Uint8 = nil
- }
- } else {
- if x.FptrMapUint8Uint8 == nil {
- x.FptrMapUint8Uint8 = new(map[uint8]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapUint8Uint8X(x.FptrMapUint8Uint8, d)
- }
- }
- case "FMapUint8Uint16":
- if r.TryDecodeAsNil() {
- x.FMapUint8Uint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8Uint16X(&x.FMapUint8Uint16, d)
- }
- }
- case "FptrMapUint8Uint16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Uint16 != nil {
- x.FptrMapUint8Uint16 = nil
- }
- } else {
- if x.FptrMapUint8Uint16 == nil {
- x.FptrMapUint8Uint16 = new(map[uint8]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapUint8Uint16X(x.FptrMapUint8Uint16, d)
- }
- }
- case "FMapUint8Uint32":
- if r.TryDecodeAsNil() {
- x.FMapUint8Uint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8Uint32X(&x.FMapUint8Uint32, d)
- }
- }
- case "FptrMapUint8Uint32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Uint32 != nil {
- x.FptrMapUint8Uint32 = nil
- }
- } else {
- if x.FptrMapUint8Uint32 == nil {
- x.FptrMapUint8Uint32 = new(map[uint8]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapUint8Uint32X(x.FptrMapUint8Uint32, d)
- }
- }
- case "FMapUint8Uint64":
- if r.TryDecodeAsNil() {
- x.FMapUint8Uint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8Uint64X(&x.FMapUint8Uint64, d)
- }
- }
- case "FptrMapUint8Uint64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Uint64 != nil {
- x.FptrMapUint8Uint64 = nil
- }
- } else {
- if x.FptrMapUint8Uint64 == nil {
- x.FptrMapUint8Uint64 = new(map[uint8]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapUint8Uint64X(x.FptrMapUint8Uint64, d)
- }
- }
- case "FMapUint8Uintptr":
- if r.TryDecodeAsNil() {
- x.FMapUint8Uintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8UintptrX(&x.FMapUint8Uintptr, d)
- }
- }
- case "FptrMapUint8Uintptr":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Uintptr != nil {
- x.FptrMapUint8Uintptr = nil
- }
- } else {
- if x.FptrMapUint8Uintptr == nil {
- x.FptrMapUint8Uintptr = new(map[uint8]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapUint8UintptrX(x.FptrMapUint8Uintptr, d)
- }
- }
- case "FMapUint8Int":
- if r.TryDecodeAsNil() {
- x.FMapUint8Int = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8IntX(&x.FMapUint8Int, d)
- }
- }
- case "FptrMapUint8Int":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Int != nil {
- x.FptrMapUint8Int = nil
- }
- } else {
- if x.FptrMapUint8Int == nil {
- x.FptrMapUint8Int = new(map[uint8]int)
- }
-
- if false {
- } else {
- z.F.DecMapUint8IntX(x.FptrMapUint8Int, d)
- }
- }
- case "FMapUint8Int8":
- if r.TryDecodeAsNil() {
- x.FMapUint8Int8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8Int8X(&x.FMapUint8Int8, d)
- }
- }
- case "FptrMapUint8Int8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Int8 != nil {
- x.FptrMapUint8Int8 = nil
- }
- } else {
- if x.FptrMapUint8Int8 == nil {
- x.FptrMapUint8Int8 = new(map[uint8]int8)
- }
-
- if false {
- } else {
- z.F.DecMapUint8Int8X(x.FptrMapUint8Int8, d)
- }
- }
- case "FMapUint8Int16":
- if r.TryDecodeAsNil() {
- x.FMapUint8Int16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8Int16X(&x.FMapUint8Int16, d)
- }
- }
- case "FptrMapUint8Int16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Int16 != nil {
- x.FptrMapUint8Int16 = nil
- }
- } else {
- if x.FptrMapUint8Int16 == nil {
- x.FptrMapUint8Int16 = new(map[uint8]int16)
- }
-
- if false {
- } else {
- z.F.DecMapUint8Int16X(x.FptrMapUint8Int16, d)
- }
- }
- case "FMapUint8Int32":
- if r.TryDecodeAsNil() {
- x.FMapUint8Int32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8Int32X(&x.FMapUint8Int32, d)
- }
- }
- case "FptrMapUint8Int32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Int32 != nil {
- x.FptrMapUint8Int32 = nil
- }
- } else {
- if x.FptrMapUint8Int32 == nil {
- x.FptrMapUint8Int32 = new(map[uint8]int32)
- }
-
- if false {
- } else {
- z.F.DecMapUint8Int32X(x.FptrMapUint8Int32, d)
- }
- }
- case "FMapUint8Int64":
- if r.TryDecodeAsNil() {
- x.FMapUint8Int64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8Int64X(&x.FMapUint8Int64, d)
- }
- }
- case "FptrMapUint8Int64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Int64 != nil {
- x.FptrMapUint8Int64 = nil
- }
- } else {
- if x.FptrMapUint8Int64 == nil {
- x.FptrMapUint8Int64 = new(map[uint8]int64)
- }
-
- if false {
- } else {
- z.F.DecMapUint8Int64X(x.FptrMapUint8Int64, d)
- }
- }
- case "FMapUint8Float32":
- if r.TryDecodeAsNil() {
- x.FMapUint8Float32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8Float32X(&x.FMapUint8Float32, d)
- }
- }
- case "FptrMapUint8Float32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Float32 != nil {
- x.FptrMapUint8Float32 = nil
- }
- } else {
- if x.FptrMapUint8Float32 == nil {
- x.FptrMapUint8Float32 = new(map[uint8]float32)
- }
-
- if false {
- } else {
- z.F.DecMapUint8Float32X(x.FptrMapUint8Float32, d)
- }
- }
- case "FMapUint8Float64":
- if r.TryDecodeAsNil() {
- x.FMapUint8Float64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8Float64X(&x.FMapUint8Float64, d)
- }
- }
- case "FptrMapUint8Float64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Float64 != nil {
- x.FptrMapUint8Float64 = nil
- }
- } else {
- if x.FptrMapUint8Float64 == nil {
- x.FptrMapUint8Float64 = new(map[uint8]float64)
- }
-
- if false {
- } else {
- z.F.DecMapUint8Float64X(x.FptrMapUint8Float64, d)
- }
- }
- case "FMapUint8Bool":
- if r.TryDecodeAsNil() {
- x.FMapUint8Bool = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8BoolX(&x.FMapUint8Bool, d)
- }
- }
- case "FptrMapUint8Bool":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Bool != nil {
- x.FptrMapUint8Bool = nil
- }
- } else {
- if x.FptrMapUint8Bool == nil {
- x.FptrMapUint8Bool = new(map[uint8]bool)
- }
-
- if false {
- } else {
- z.F.DecMapUint8BoolX(x.FptrMapUint8Bool, d)
- }
- }
- case "FMapUint16Intf":
- if r.TryDecodeAsNil() {
- x.FMapUint16Intf = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16IntfX(&x.FMapUint16Intf, d)
- }
- }
- case "FptrMapUint16Intf":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Intf != nil {
- x.FptrMapUint16Intf = nil
- }
- } else {
- if x.FptrMapUint16Intf == nil {
- x.FptrMapUint16Intf = new(map[uint16]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapUint16IntfX(x.FptrMapUint16Intf, d)
- }
- }
- case "FMapUint16String":
- if r.TryDecodeAsNil() {
- x.FMapUint16String = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16StringX(&x.FMapUint16String, d)
- }
- }
- case "FptrMapUint16String":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16String != nil {
- x.FptrMapUint16String = nil
- }
- } else {
- if x.FptrMapUint16String == nil {
- x.FptrMapUint16String = new(map[uint16]string)
- }
-
- if false {
- } else {
- z.F.DecMapUint16StringX(x.FptrMapUint16String, d)
- }
- }
- case "FMapUint16Uint":
- if r.TryDecodeAsNil() {
- x.FMapUint16Uint = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16UintX(&x.FMapUint16Uint, d)
- }
- }
- case "FptrMapUint16Uint":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Uint != nil {
- x.FptrMapUint16Uint = nil
- }
- } else {
- if x.FptrMapUint16Uint == nil {
- x.FptrMapUint16Uint = new(map[uint16]uint)
- }
-
- if false {
- } else {
- z.F.DecMapUint16UintX(x.FptrMapUint16Uint, d)
- }
- }
- case "FMapUint16Uint8":
- if r.TryDecodeAsNil() {
- x.FMapUint16Uint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16Uint8X(&x.FMapUint16Uint8, d)
- }
- }
- case "FptrMapUint16Uint8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Uint8 != nil {
- x.FptrMapUint16Uint8 = nil
- }
- } else {
- if x.FptrMapUint16Uint8 == nil {
- x.FptrMapUint16Uint8 = new(map[uint16]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapUint16Uint8X(x.FptrMapUint16Uint8, d)
- }
- }
- case "FMapUint16Uint16":
- if r.TryDecodeAsNil() {
- x.FMapUint16Uint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16Uint16X(&x.FMapUint16Uint16, d)
- }
- }
- case "FptrMapUint16Uint16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Uint16 != nil {
- x.FptrMapUint16Uint16 = nil
- }
- } else {
- if x.FptrMapUint16Uint16 == nil {
- x.FptrMapUint16Uint16 = new(map[uint16]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapUint16Uint16X(x.FptrMapUint16Uint16, d)
- }
- }
- case "FMapUint16Uint32":
- if r.TryDecodeAsNil() {
- x.FMapUint16Uint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16Uint32X(&x.FMapUint16Uint32, d)
- }
- }
- case "FptrMapUint16Uint32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Uint32 != nil {
- x.FptrMapUint16Uint32 = nil
- }
- } else {
- if x.FptrMapUint16Uint32 == nil {
- x.FptrMapUint16Uint32 = new(map[uint16]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapUint16Uint32X(x.FptrMapUint16Uint32, d)
- }
- }
- case "FMapUint16Uint64":
- if r.TryDecodeAsNil() {
- x.FMapUint16Uint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16Uint64X(&x.FMapUint16Uint64, d)
- }
- }
- case "FptrMapUint16Uint64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Uint64 != nil {
- x.FptrMapUint16Uint64 = nil
- }
- } else {
- if x.FptrMapUint16Uint64 == nil {
- x.FptrMapUint16Uint64 = new(map[uint16]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapUint16Uint64X(x.FptrMapUint16Uint64, d)
- }
- }
- case "FMapUint16Uintptr":
- if r.TryDecodeAsNil() {
- x.FMapUint16Uintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16UintptrX(&x.FMapUint16Uintptr, d)
- }
- }
- case "FptrMapUint16Uintptr":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Uintptr != nil {
- x.FptrMapUint16Uintptr = nil
- }
- } else {
- if x.FptrMapUint16Uintptr == nil {
- x.FptrMapUint16Uintptr = new(map[uint16]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapUint16UintptrX(x.FptrMapUint16Uintptr, d)
- }
- }
- case "FMapUint16Int":
- if r.TryDecodeAsNil() {
- x.FMapUint16Int = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16IntX(&x.FMapUint16Int, d)
- }
- }
- case "FptrMapUint16Int":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Int != nil {
- x.FptrMapUint16Int = nil
- }
- } else {
- if x.FptrMapUint16Int == nil {
- x.FptrMapUint16Int = new(map[uint16]int)
- }
-
- if false {
- } else {
- z.F.DecMapUint16IntX(x.FptrMapUint16Int, d)
- }
- }
- case "FMapUint16Int8":
- if r.TryDecodeAsNil() {
- x.FMapUint16Int8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16Int8X(&x.FMapUint16Int8, d)
- }
- }
- case "FptrMapUint16Int8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Int8 != nil {
- x.FptrMapUint16Int8 = nil
- }
- } else {
- if x.FptrMapUint16Int8 == nil {
- x.FptrMapUint16Int8 = new(map[uint16]int8)
- }
-
- if false {
- } else {
- z.F.DecMapUint16Int8X(x.FptrMapUint16Int8, d)
- }
- }
- case "FMapUint16Int16":
- if r.TryDecodeAsNil() {
- x.FMapUint16Int16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16Int16X(&x.FMapUint16Int16, d)
- }
- }
- case "FptrMapUint16Int16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Int16 != nil {
- x.FptrMapUint16Int16 = nil
- }
- } else {
- if x.FptrMapUint16Int16 == nil {
- x.FptrMapUint16Int16 = new(map[uint16]int16)
- }
-
- if false {
- } else {
- z.F.DecMapUint16Int16X(x.FptrMapUint16Int16, d)
- }
- }
- case "FMapUint16Int32":
- if r.TryDecodeAsNil() {
- x.FMapUint16Int32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16Int32X(&x.FMapUint16Int32, d)
- }
- }
- case "FptrMapUint16Int32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Int32 != nil {
- x.FptrMapUint16Int32 = nil
- }
- } else {
- if x.FptrMapUint16Int32 == nil {
- x.FptrMapUint16Int32 = new(map[uint16]int32)
- }
-
- if false {
- } else {
- z.F.DecMapUint16Int32X(x.FptrMapUint16Int32, d)
- }
- }
- case "FMapUint16Int64":
- if r.TryDecodeAsNil() {
- x.FMapUint16Int64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16Int64X(&x.FMapUint16Int64, d)
- }
- }
- case "FptrMapUint16Int64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Int64 != nil {
- x.FptrMapUint16Int64 = nil
- }
- } else {
- if x.FptrMapUint16Int64 == nil {
- x.FptrMapUint16Int64 = new(map[uint16]int64)
- }
-
- if false {
- } else {
- z.F.DecMapUint16Int64X(x.FptrMapUint16Int64, d)
- }
- }
- case "FMapUint16Float32":
- if r.TryDecodeAsNil() {
- x.FMapUint16Float32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16Float32X(&x.FMapUint16Float32, d)
- }
- }
- case "FptrMapUint16Float32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Float32 != nil {
- x.FptrMapUint16Float32 = nil
- }
- } else {
- if x.FptrMapUint16Float32 == nil {
- x.FptrMapUint16Float32 = new(map[uint16]float32)
- }
-
- if false {
- } else {
- z.F.DecMapUint16Float32X(x.FptrMapUint16Float32, d)
- }
- }
- case "FMapUint16Float64":
- if r.TryDecodeAsNil() {
- x.FMapUint16Float64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16Float64X(&x.FMapUint16Float64, d)
- }
- }
- case "FptrMapUint16Float64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Float64 != nil {
- x.FptrMapUint16Float64 = nil
- }
- } else {
- if x.FptrMapUint16Float64 == nil {
- x.FptrMapUint16Float64 = new(map[uint16]float64)
- }
-
- if false {
- } else {
- z.F.DecMapUint16Float64X(x.FptrMapUint16Float64, d)
- }
- }
- case "FMapUint16Bool":
- if r.TryDecodeAsNil() {
- x.FMapUint16Bool = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16BoolX(&x.FMapUint16Bool, d)
- }
- }
- case "FptrMapUint16Bool":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Bool != nil {
- x.FptrMapUint16Bool = nil
- }
- } else {
- if x.FptrMapUint16Bool == nil {
- x.FptrMapUint16Bool = new(map[uint16]bool)
- }
-
- if false {
- } else {
- z.F.DecMapUint16BoolX(x.FptrMapUint16Bool, d)
- }
- }
- case "FMapUint32Intf":
- if r.TryDecodeAsNil() {
- x.FMapUint32Intf = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32IntfX(&x.FMapUint32Intf, d)
- }
- }
- case "FptrMapUint32Intf":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Intf != nil {
- x.FptrMapUint32Intf = nil
- }
- } else {
- if x.FptrMapUint32Intf == nil {
- x.FptrMapUint32Intf = new(map[uint32]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapUint32IntfX(x.FptrMapUint32Intf, d)
- }
- }
- case "FMapUint32String":
- if r.TryDecodeAsNil() {
- x.FMapUint32String = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32StringX(&x.FMapUint32String, d)
- }
- }
- case "FptrMapUint32String":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32String != nil {
- x.FptrMapUint32String = nil
- }
- } else {
- if x.FptrMapUint32String == nil {
- x.FptrMapUint32String = new(map[uint32]string)
- }
-
- if false {
- } else {
- z.F.DecMapUint32StringX(x.FptrMapUint32String, d)
- }
- }
- case "FMapUint32Uint":
- if r.TryDecodeAsNil() {
- x.FMapUint32Uint = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32UintX(&x.FMapUint32Uint, d)
- }
- }
- case "FptrMapUint32Uint":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Uint != nil {
- x.FptrMapUint32Uint = nil
- }
- } else {
- if x.FptrMapUint32Uint == nil {
- x.FptrMapUint32Uint = new(map[uint32]uint)
- }
-
- if false {
- } else {
- z.F.DecMapUint32UintX(x.FptrMapUint32Uint, d)
- }
- }
- case "FMapUint32Uint8":
- if r.TryDecodeAsNil() {
- x.FMapUint32Uint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32Uint8X(&x.FMapUint32Uint8, d)
- }
- }
- case "FptrMapUint32Uint8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Uint8 != nil {
- x.FptrMapUint32Uint8 = nil
- }
- } else {
- if x.FptrMapUint32Uint8 == nil {
- x.FptrMapUint32Uint8 = new(map[uint32]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapUint32Uint8X(x.FptrMapUint32Uint8, d)
- }
- }
- case "FMapUint32Uint16":
- if r.TryDecodeAsNil() {
- x.FMapUint32Uint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32Uint16X(&x.FMapUint32Uint16, d)
- }
- }
- case "FptrMapUint32Uint16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Uint16 != nil {
- x.FptrMapUint32Uint16 = nil
- }
- } else {
- if x.FptrMapUint32Uint16 == nil {
- x.FptrMapUint32Uint16 = new(map[uint32]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapUint32Uint16X(x.FptrMapUint32Uint16, d)
- }
- }
- case "FMapUint32Uint32":
- if r.TryDecodeAsNil() {
- x.FMapUint32Uint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32Uint32X(&x.FMapUint32Uint32, d)
- }
- }
- case "FptrMapUint32Uint32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Uint32 != nil {
- x.FptrMapUint32Uint32 = nil
- }
- } else {
- if x.FptrMapUint32Uint32 == nil {
- x.FptrMapUint32Uint32 = new(map[uint32]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapUint32Uint32X(x.FptrMapUint32Uint32, d)
- }
- }
- case "FMapUint32Uint64":
- if r.TryDecodeAsNil() {
- x.FMapUint32Uint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32Uint64X(&x.FMapUint32Uint64, d)
- }
- }
- case "FptrMapUint32Uint64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Uint64 != nil {
- x.FptrMapUint32Uint64 = nil
- }
- } else {
- if x.FptrMapUint32Uint64 == nil {
- x.FptrMapUint32Uint64 = new(map[uint32]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapUint32Uint64X(x.FptrMapUint32Uint64, d)
- }
- }
- case "FMapUint32Uintptr":
- if r.TryDecodeAsNil() {
- x.FMapUint32Uintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32UintptrX(&x.FMapUint32Uintptr, d)
- }
- }
- case "FptrMapUint32Uintptr":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Uintptr != nil {
- x.FptrMapUint32Uintptr = nil
- }
- } else {
- if x.FptrMapUint32Uintptr == nil {
- x.FptrMapUint32Uintptr = new(map[uint32]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapUint32UintptrX(x.FptrMapUint32Uintptr, d)
- }
- }
- case "FMapUint32Int":
- if r.TryDecodeAsNil() {
- x.FMapUint32Int = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32IntX(&x.FMapUint32Int, d)
- }
- }
- case "FptrMapUint32Int":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Int != nil {
- x.FptrMapUint32Int = nil
- }
- } else {
- if x.FptrMapUint32Int == nil {
- x.FptrMapUint32Int = new(map[uint32]int)
- }
-
- if false {
- } else {
- z.F.DecMapUint32IntX(x.FptrMapUint32Int, d)
- }
- }
- case "FMapUint32Int8":
- if r.TryDecodeAsNil() {
- x.FMapUint32Int8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32Int8X(&x.FMapUint32Int8, d)
- }
- }
- case "FptrMapUint32Int8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Int8 != nil {
- x.FptrMapUint32Int8 = nil
- }
- } else {
- if x.FptrMapUint32Int8 == nil {
- x.FptrMapUint32Int8 = new(map[uint32]int8)
- }
-
- if false {
- } else {
- z.F.DecMapUint32Int8X(x.FptrMapUint32Int8, d)
- }
- }
- case "FMapUint32Int16":
- if r.TryDecodeAsNil() {
- x.FMapUint32Int16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32Int16X(&x.FMapUint32Int16, d)
- }
- }
- case "FptrMapUint32Int16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Int16 != nil {
- x.FptrMapUint32Int16 = nil
- }
- } else {
- if x.FptrMapUint32Int16 == nil {
- x.FptrMapUint32Int16 = new(map[uint32]int16)
- }
-
- if false {
- } else {
- z.F.DecMapUint32Int16X(x.FptrMapUint32Int16, d)
- }
- }
- case "FMapUint32Int32":
- if r.TryDecodeAsNil() {
- x.FMapUint32Int32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32Int32X(&x.FMapUint32Int32, d)
- }
- }
- case "FptrMapUint32Int32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Int32 != nil {
- x.FptrMapUint32Int32 = nil
- }
- } else {
- if x.FptrMapUint32Int32 == nil {
- x.FptrMapUint32Int32 = new(map[uint32]int32)
- }
-
- if false {
- } else {
- z.F.DecMapUint32Int32X(x.FptrMapUint32Int32, d)
- }
- }
- case "FMapUint32Int64":
- if r.TryDecodeAsNil() {
- x.FMapUint32Int64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32Int64X(&x.FMapUint32Int64, d)
- }
- }
- case "FptrMapUint32Int64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Int64 != nil {
- x.FptrMapUint32Int64 = nil
- }
- } else {
- if x.FptrMapUint32Int64 == nil {
- x.FptrMapUint32Int64 = new(map[uint32]int64)
- }
-
- if false {
- } else {
- z.F.DecMapUint32Int64X(x.FptrMapUint32Int64, d)
- }
- }
- case "FMapUint32Float32":
- if r.TryDecodeAsNil() {
- x.FMapUint32Float32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32Float32X(&x.FMapUint32Float32, d)
- }
- }
- case "FptrMapUint32Float32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Float32 != nil {
- x.FptrMapUint32Float32 = nil
- }
- } else {
- if x.FptrMapUint32Float32 == nil {
- x.FptrMapUint32Float32 = new(map[uint32]float32)
- }
-
- if false {
- } else {
- z.F.DecMapUint32Float32X(x.FptrMapUint32Float32, d)
- }
- }
- case "FMapUint32Float64":
- if r.TryDecodeAsNil() {
- x.FMapUint32Float64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32Float64X(&x.FMapUint32Float64, d)
- }
- }
- case "FptrMapUint32Float64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Float64 != nil {
- x.FptrMapUint32Float64 = nil
- }
- } else {
- if x.FptrMapUint32Float64 == nil {
- x.FptrMapUint32Float64 = new(map[uint32]float64)
- }
-
- if false {
- } else {
- z.F.DecMapUint32Float64X(x.FptrMapUint32Float64, d)
- }
- }
- case "FMapUint32Bool":
- if r.TryDecodeAsNil() {
- x.FMapUint32Bool = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32BoolX(&x.FMapUint32Bool, d)
- }
- }
- case "FptrMapUint32Bool":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Bool != nil {
- x.FptrMapUint32Bool = nil
- }
- } else {
- if x.FptrMapUint32Bool == nil {
- x.FptrMapUint32Bool = new(map[uint32]bool)
- }
-
- if false {
- } else {
- z.F.DecMapUint32BoolX(x.FptrMapUint32Bool, d)
- }
- }
- case "FMapUint64Intf":
- if r.TryDecodeAsNil() {
- x.FMapUint64Intf = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64IntfX(&x.FMapUint64Intf, d)
- }
- }
- case "FptrMapUint64Intf":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Intf != nil {
- x.FptrMapUint64Intf = nil
- }
- } else {
- if x.FptrMapUint64Intf == nil {
- x.FptrMapUint64Intf = new(map[uint64]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapUint64IntfX(x.FptrMapUint64Intf, d)
- }
- }
- case "FMapUint64String":
- if r.TryDecodeAsNil() {
- x.FMapUint64String = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64StringX(&x.FMapUint64String, d)
- }
- }
- case "FptrMapUint64String":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64String != nil {
- x.FptrMapUint64String = nil
- }
- } else {
- if x.FptrMapUint64String == nil {
- x.FptrMapUint64String = new(map[uint64]string)
- }
-
- if false {
- } else {
- z.F.DecMapUint64StringX(x.FptrMapUint64String, d)
- }
- }
- case "FMapUint64Uint":
- if r.TryDecodeAsNil() {
- x.FMapUint64Uint = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64UintX(&x.FMapUint64Uint, d)
- }
- }
- case "FptrMapUint64Uint":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Uint != nil {
- x.FptrMapUint64Uint = nil
- }
- } else {
- if x.FptrMapUint64Uint == nil {
- x.FptrMapUint64Uint = new(map[uint64]uint)
- }
-
- if false {
- } else {
- z.F.DecMapUint64UintX(x.FptrMapUint64Uint, d)
- }
- }
- case "FMapUint64Uint8":
- if r.TryDecodeAsNil() {
- x.FMapUint64Uint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64Uint8X(&x.FMapUint64Uint8, d)
- }
- }
- case "FptrMapUint64Uint8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Uint8 != nil {
- x.FptrMapUint64Uint8 = nil
- }
- } else {
- if x.FptrMapUint64Uint8 == nil {
- x.FptrMapUint64Uint8 = new(map[uint64]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapUint64Uint8X(x.FptrMapUint64Uint8, d)
- }
- }
- case "FMapUint64Uint16":
- if r.TryDecodeAsNil() {
- x.FMapUint64Uint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64Uint16X(&x.FMapUint64Uint16, d)
- }
- }
- case "FptrMapUint64Uint16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Uint16 != nil {
- x.FptrMapUint64Uint16 = nil
- }
- } else {
- if x.FptrMapUint64Uint16 == nil {
- x.FptrMapUint64Uint16 = new(map[uint64]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapUint64Uint16X(x.FptrMapUint64Uint16, d)
- }
- }
- case "FMapUint64Uint32":
- if r.TryDecodeAsNil() {
- x.FMapUint64Uint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64Uint32X(&x.FMapUint64Uint32, d)
- }
- }
- case "FptrMapUint64Uint32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Uint32 != nil {
- x.FptrMapUint64Uint32 = nil
- }
- } else {
- if x.FptrMapUint64Uint32 == nil {
- x.FptrMapUint64Uint32 = new(map[uint64]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapUint64Uint32X(x.FptrMapUint64Uint32, d)
- }
- }
- case "FMapUint64Uint64":
- if r.TryDecodeAsNil() {
- x.FMapUint64Uint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64Uint64X(&x.FMapUint64Uint64, d)
- }
- }
- case "FptrMapUint64Uint64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Uint64 != nil {
- x.FptrMapUint64Uint64 = nil
- }
- } else {
- if x.FptrMapUint64Uint64 == nil {
- x.FptrMapUint64Uint64 = new(map[uint64]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapUint64Uint64X(x.FptrMapUint64Uint64, d)
- }
- }
- case "FMapUint64Uintptr":
- if r.TryDecodeAsNil() {
- x.FMapUint64Uintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64UintptrX(&x.FMapUint64Uintptr, d)
- }
- }
- case "FptrMapUint64Uintptr":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Uintptr != nil {
- x.FptrMapUint64Uintptr = nil
- }
- } else {
- if x.FptrMapUint64Uintptr == nil {
- x.FptrMapUint64Uintptr = new(map[uint64]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapUint64UintptrX(x.FptrMapUint64Uintptr, d)
- }
- }
- case "FMapUint64Int":
- if r.TryDecodeAsNil() {
- x.FMapUint64Int = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64IntX(&x.FMapUint64Int, d)
- }
- }
- case "FptrMapUint64Int":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Int != nil {
- x.FptrMapUint64Int = nil
- }
- } else {
- if x.FptrMapUint64Int == nil {
- x.FptrMapUint64Int = new(map[uint64]int)
- }
-
- if false {
- } else {
- z.F.DecMapUint64IntX(x.FptrMapUint64Int, d)
- }
- }
- case "FMapUint64Int8":
- if r.TryDecodeAsNil() {
- x.FMapUint64Int8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64Int8X(&x.FMapUint64Int8, d)
- }
- }
- case "FptrMapUint64Int8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Int8 != nil {
- x.FptrMapUint64Int8 = nil
- }
- } else {
- if x.FptrMapUint64Int8 == nil {
- x.FptrMapUint64Int8 = new(map[uint64]int8)
- }
-
- if false {
- } else {
- z.F.DecMapUint64Int8X(x.FptrMapUint64Int8, d)
- }
- }
- case "FMapUint64Int16":
- if r.TryDecodeAsNil() {
- x.FMapUint64Int16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64Int16X(&x.FMapUint64Int16, d)
- }
- }
- case "FptrMapUint64Int16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Int16 != nil {
- x.FptrMapUint64Int16 = nil
- }
- } else {
- if x.FptrMapUint64Int16 == nil {
- x.FptrMapUint64Int16 = new(map[uint64]int16)
- }
-
- if false {
- } else {
- z.F.DecMapUint64Int16X(x.FptrMapUint64Int16, d)
- }
- }
- case "FMapUint64Int32":
- if r.TryDecodeAsNil() {
- x.FMapUint64Int32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64Int32X(&x.FMapUint64Int32, d)
- }
- }
- case "FptrMapUint64Int32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Int32 != nil {
- x.FptrMapUint64Int32 = nil
- }
- } else {
- if x.FptrMapUint64Int32 == nil {
- x.FptrMapUint64Int32 = new(map[uint64]int32)
- }
-
- if false {
- } else {
- z.F.DecMapUint64Int32X(x.FptrMapUint64Int32, d)
- }
- }
- case "FMapUint64Int64":
- if r.TryDecodeAsNil() {
- x.FMapUint64Int64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64Int64X(&x.FMapUint64Int64, d)
- }
- }
- case "FptrMapUint64Int64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Int64 != nil {
- x.FptrMapUint64Int64 = nil
- }
- } else {
- if x.FptrMapUint64Int64 == nil {
- x.FptrMapUint64Int64 = new(map[uint64]int64)
- }
-
- if false {
- } else {
- z.F.DecMapUint64Int64X(x.FptrMapUint64Int64, d)
- }
- }
- case "FMapUint64Float32":
- if r.TryDecodeAsNil() {
- x.FMapUint64Float32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64Float32X(&x.FMapUint64Float32, d)
- }
- }
- case "FptrMapUint64Float32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Float32 != nil {
- x.FptrMapUint64Float32 = nil
- }
- } else {
- if x.FptrMapUint64Float32 == nil {
- x.FptrMapUint64Float32 = new(map[uint64]float32)
- }
-
- if false {
- } else {
- z.F.DecMapUint64Float32X(x.FptrMapUint64Float32, d)
- }
- }
- case "FMapUint64Float64":
- if r.TryDecodeAsNil() {
- x.FMapUint64Float64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64Float64X(&x.FMapUint64Float64, d)
- }
- }
- case "FptrMapUint64Float64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Float64 != nil {
- x.FptrMapUint64Float64 = nil
- }
- } else {
- if x.FptrMapUint64Float64 == nil {
- x.FptrMapUint64Float64 = new(map[uint64]float64)
- }
-
- if false {
- } else {
- z.F.DecMapUint64Float64X(x.FptrMapUint64Float64, d)
- }
- }
- case "FMapUint64Bool":
- if r.TryDecodeAsNil() {
- x.FMapUint64Bool = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64BoolX(&x.FMapUint64Bool, d)
- }
- }
- case "FptrMapUint64Bool":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Bool != nil {
- x.FptrMapUint64Bool = nil
- }
- } else {
- if x.FptrMapUint64Bool == nil {
- x.FptrMapUint64Bool = new(map[uint64]bool)
- }
-
- if false {
- } else {
- z.F.DecMapUint64BoolX(x.FptrMapUint64Bool, d)
- }
- }
- case "FMapUintptrIntf":
- if r.TryDecodeAsNil() {
- x.FMapUintptrIntf = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrIntfX(&x.FMapUintptrIntf, d)
- }
- }
- case "FptrMapUintptrIntf":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrIntf != nil {
- x.FptrMapUintptrIntf = nil
- }
- } else {
- if x.FptrMapUintptrIntf == nil {
- x.FptrMapUintptrIntf = new(map[uintptr]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapUintptrIntfX(x.FptrMapUintptrIntf, d)
- }
- }
- case "FMapUintptrString":
- if r.TryDecodeAsNil() {
- x.FMapUintptrString = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrStringX(&x.FMapUintptrString, d)
- }
- }
- case "FptrMapUintptrString":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrString != nil {
- x.FptrMapUintptrString = nil
- }
- } else {
- if x.FptrMapUintptrString == nil {
- x.FptrMapUintptrString = new(map[uintptr]string)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrStringX(x.FptrMapUintptrString, d)
- }
- }
- case "FMapUintptrUint":
- if r.TryDecodeAsNil() {
- x.FMapUintptrUint = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrUintX(&x.FMapUintptrUint, d)
- }
- }
- case "FptrMapUintptrUint":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrUint != nil {
- x.FptrMapUintptrUint = nil
- }
- } else {
- if x.FptrMapUintptrUint == nil {
- x.FptrMapUintptrUint = new(map[uintptr]uint)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrUintX(x.FptrMapUintptrUint, d)
- }
- }
- case "FMapUintptrUint8":
- if r.TryDecodeAsNil() {
- x.FMapUintptrUint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrUint8X(&x.FMapUintptrUint8, d)
- }
- }
- case "FptrMapUintptrUint8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrUint8 != nil {
- x.FptrMapUintptrUint8 = nil
- }
- } else {
- if x.FptrMapUintptrUint8 == nil {
- x.FptrMapUintptrUint8 = new(map[uintptr]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrUint8X(x.FptrMapUintptrUint8, d)
- }
- }
- case "FMapUintptrUint16":
- if r.TryDecodeAsNil() {
- x.FMapUintptrUint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrUint16X(&x.FMapUintptrUint16, d)
- }
- }
- case "FptrMapUintptrUint16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrUint16 != nil {
- x.FptrMapUintptrUint16 = nil
- }
- } else {
- if x.FptrMapUintptrUint16 == nil {
- x.FptrMapUintptrUint16 = new(map[uintptr]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrUint16X(x.FptrMapUintptrUint16, d)
- }
- }
- case "FMapUintptrUint32":
- if r.TryDecodeAsNil() {
- x.FMapUintptrUint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrUint32X(&x.FMapUintptrUint32, d)
- }
- }
- case "FptrMapUintptrUint32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrUint32 != nil {
- x.FptrMapUintptrUint32 = nil
- }
- } else {
- if x.FptrMapUintptrUint32 == nil {
- x.FptrMapUintptrUint32 = new(map[uintptr]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrUint32X(x.FptrMapUintptrUint32, d)
- }
- }
- case "FMapUintptrUint64":
- if r.TryDecodeAsNil() {
- x.FMapUintptrUint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrUint64X(&x.FMapUintptrUint64, d)
- }
- }
- case "FptrMapUintptrUint64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrUint64 != nil {
- x.FptrMapUintptrUint64 = nil
- }
- } else {
- if x.FptrMapUintptrUint64 == nil {
- x.FptrMapUintptrUint64 = new(map[uintptr]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrUint64X(x.FptrMapUintptrUint64, d)
- }
- }
- case "FMapUintptrUintptr":
- if r.TryDecodeAsNil() {
- x.FMapUintptrUintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrUintptrX(&x.FMapUintptrUintptr, d)
- }
- }
- case "FptrMapUintptrUintptr":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrUintptr != nil {
- x.FptrMapUintptrUintptr = nil
- }
- } else {
- if x.FptrMapUintptrUintptr == nil {
- x.FptrMapUintptrUintptr = new(map[uintptr]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrUintptrX(x.FptrMapUintptrUintptr, d)
- }
- }
- case "FMapUintptrInt":
- if r.TryDecodeAsNil() {
- x.FMapUintptrInt = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrIntX(&x.FMapUintptrInt, d)
- }
- }
- case "FptrMapUintptrInt":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrInt != nil {
- x.FptrMapUintptrInt = nil
- }
- } else {
- if x.FptrMapUintptrInt == nil {
- x.FptrMapUintptrInt = new(map[uintptr]int)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrIntX(x.FptrMapUintptrInt, d)
- }
- }
- case "FMapUintptrInt8":
- if r.TryDecodeAsNil() {
- x.FMapUintptrInt8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrInt8X(&x.FMapUintptrInt8, d)
- }
- }
- case "FptrMapUintptrInt8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrInt8 != nil {
- x.FptrMapUintptrInt8 = nil
- }
- } else {
- if x.FptrMapUintptrInt8 == nil {
- x.FptrMapUintptrInt8 = new(map[uintptr]int8)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrInt8X(x.FptrMapUintptrInt8, d)
- }
- }
- case "FMapUintptrInt16":
- if r.TryDecodeAsNil() {
- x.FMapUintptrInt16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrInt16X(&x.FMapUintptrInt16, d)
- }
- }
- case "FptrMapUintptrInt16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrInt16 != nil {
- x.FptrMapUintptrInt16 = nil
- }
- } else {
- if x.FptrMapUintptrInt16 == nil {
- x.FptrMapUintptrInt16 = new(map[uintptr]int16)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrInt16X(x.FptrMapUintptrInt16, d)
- }
- }
- case "FMapUintptrInt32":
- if r.TryDecodeAsNil() {
- x.FMapUintptrInt32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrInt32X(&x.FMapUintptrInt32, d)
- }
- }
- case "FptrMapUintptrInt32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrInt32 != nil {
- x.FptrMapUintptrInt32 = nil
- }
- } else {
- if x.FptrMapUintptrInt32 == nil {
- x.FptrMapUintptrInt32 = new(map[uintptr]int32)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrInt32X(x.FptrMapUintptrInt32, d)
- }
- }
- case "FMapUintptrInt64":
- if r.TryDecodeAsNil() {
- x.FMapUintptrInt64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrInt64X(&x.FMapUintptrInt64, d)
- }
- }
- case "FptrMapUintptrInt64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrInt64 != nil {
- x.FptrMapUintptrInt64 = nil
- }
- } else {
- if x.FptrMapUintptrInt64 == nil {
- x.FptrMapUintptrInt64 = new(map[uintptr]int64)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrInt64X(x.FptrMapUintptrInt64, d)
- }
- }
- case "FMapUintptrFloat32":
- if r.TryDecodeAsNil() {
- x.FMapUintptrFloat32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrFloat32X(&x.FMapUintptrFloat32, d)
- }
- }
- case "FptrMapUintptrFloat32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrFloat32 != nil {
- x.FptrMapUintptrFloat32 = nil
- }
- } else {
- if x.FptrMapUintptrFloat32 == nil {
- x.FptrMapUintptrFloat32 = new(map[uintptr]float32)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrFloat32X(x.FptrMapUintptrFloat32, d)
- }
- }
- case "FMapUintptrFloat64":
- if r.TryDecodeAsNil() {
- x.FMapUintptrFloat64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrFloat64X(&x.FMapUintptrFloat64, d)
- }
- }
- case "FptrMapUintptrFloat64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrFloat64 != nil {
- x.FptrMapUintptrFloat64 = nil
- }
- } else {
- if x.FptrMapUintptrFloat64 == nil {
- x.FptrMapUintptrFloat64 = new(map[uintptr]float64)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrFloat64X(x.FptrMapUintptrFloat64, d)
- }
- }
- case "FMapUintptrBool":
- if r.TryDecodeAsNil() {
- x.FMapUintptrBool = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrBoolX(&x.FMapUintptrBool, d)
- }
- }
- case "FptrMapUintptrBool":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrBool != nil {
- x.FptrMapUintptrBool = nil
- }
- } else {
- if x.FptrMapUintptrBool == nil {
- x.FptrMapUintptrBool = new(map[uintptr]bool)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrBoolX(x.FptrMapUintptrBool, d)
- }
- }
- case "FMapIntIntf":
- if r.TryDecodeAsNil() {
- x.FMapIntIntf = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntIntfX(&x.FMapIntIntf, d)
- }
- }
- case "FptrMapIntIntf":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntIntf != nil {
- x.FptrMapIntIntf = nil
- }
- } else {
- if x.FptrMapIntIntf == nil {
- x.FptrMapIntIntf = new(map[int]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapIntIntfX(x.FptrMapIntIntf, d)
- }
- }
- case "FMapIntString":
- if r.TryDecodeAsNil() {
- x.FMapIntString = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntStringX(&x.FMapIntString, d)
- }
- }
- case "FptrMapIntString":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntString != nil {
- x.FptrMapIntString = nil
- }
- } else {
- if x.FptrMapIntString == nil {
- x.FptrMapIntString = new(map[int]string)
- }
-
- if false {
- } else {
- z.F.DecMapIntStringX(x.FptrMapIntString, d)
- }
- }
- case "FMapIntUint":
- if r.TryDecodeAsNil() {
- x.FMapIntUint = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntUintX(&x.FMapIntUint, d)
- }
- }
- case "FptrMapIntUint":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntUint != nil {
- x.FptrMapIntUint = nil
- }
- } else {
- if x.FptrMapIntUint == nil {
- x.FptrMapIntUint = new(map[int]uint)
- }
-
- if false {
- } else {
- z.F.DecMapIntUintX(x.FptrMapIntUint, d)
- }
- }
- case "FMapIntUint8":
- if r.TryDecodeAsNil() {
- x.FMapIntUint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntUint8X(&x.FMapIntUint8, d)
- }
- }
- case "FptrMapIntUint8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntUint8 != nil {
- x.FptrMapIntUint8 = nil
- }
- } else {
- if x.FptrMapIntUint8 == nil {
- x.FptrMapIntUint8 = new(map[int]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapIntUint8X(x.FptrMapIntUint8, d)
- }
- }
- case "FMapIntUint16":
- if r.TryDecodeAsNil() {
- x.FMapIntUint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntUint16X(&x.FMapIntUint16, d)
- }
- }
- case "FptrMapIntUint16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntUint16 != nil {
- x.FptrMapIntUint16 = nil
- }
- } else {
- if x.FptrMapIntUint16 == nil {
- x.FptrMapIntUint16 = new(map[int]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapIntUint16X(x.FptrMapIntUint16, d)
- }
- }
- case "FMapIntUint32":
- if r.TryDecodeAsNil() {
- x.FMapIntUint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntUint32X(&x.FMapIntUint32, d)
- }
- }
- case "FptrMapIntUint32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntUint32 != nil {
- x.FptrMapIntUint32 = nil
- }
- } else {
- if x.FptrMapIntUint32 == nil {
- x.FptrMapIntUint32 = new(map[int]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapIntUint32X(x.FptrMapIntUint32, d)
- }
- }
- case "FMapIntUint64":
- if r.TryDecodeAsNil() {
- x.FMapIntUint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntUint64X(&x.FMapIntUint64, d)
- }
- }
- case "FptrMapIntUint64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntUint64 != nil {
- x.FptrMapIntUint64 = nil
- }
- } else {
- if x.FptrMapIntUint64 == nil {
- x.FptrMapIntUint64 = new(map[int]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapIntUint64X(x.FptrMapIntUint64, d)
- }
- }
- case "FMapIntUintptr":
- if r.TryDecodeAsNil() {
- x.FMapIntUintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntUintptrX(&x.FMapIntUintptr, d)
- }
- }
- case "FptrMapIntUintptr":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntUintptr != nil {
- x.FptrMapIntUintptr = nil
- }
- } else {
- if x.FptrMapIntUintptr == nil {
- x.FptrMapIntUintptr = new(map[int]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapIntUintptrX(x.FptrMapIntUintptr, d)
- }
- }
- case "FMapIntInt":
- if r.TryDecodeAsNil() {
- x.FMapIntInt = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntIntX(&x.FMapIntInt, d)
- }
- }
- case "FptrMapIntInt":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntInt != nil {
- x.FptrMapIntInt = nil
- }
- } else {
- if x.FptrMapIntInt == nil {
- x.FptrMapIntInt = new(map[int]int)
- }
-
- if false {
- } else {
- z.F.DecMapIntIntX(x.FptrMapIntInt, d)
- }
- }
- case "FMapIntInt8":
- if r.TryDecodeAsNil() {
- x.FMapIntInt8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntInt8X(&x.FMapIntInt8, d)
- }
- }
- case "FptrMapIntInt8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntInt8 != nil {
- x.FptrMapIntInt8 = nil
- }
- } else {
- if x.FptrMapIntInt8 == nil {
- x.FptrMapIntInt8 = new(map[int]int8)
- }
-
- if false {
- } else {
- z.F.DecMapIntInt8X(x.FptrMapIntInt8, d)
- }
- }
- case "FMapIntInt16":
- if r.TryDecodeAsNil() {
- x.FMapIntInt16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntInt16X(&x.FMapIntInt16, d)
- }
- }
- case "FptrMapIntInt16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntInt16 != nil {
- x.FptrMapIntInt16 = nil
- }
- } else {
- if x.FptrMapIntInt16 == nil {
- x.FptrMapIntInt16 = new(map[int]int16)
- }
-
- if false {
- } else {
- z.F.DecMapIntInt16X(x.FptrMapIntInt16, d)
- }
- }
- case "FMapIntInt32":
- if r.TryDecodeAsNil() {
- x.FMapIntInt32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntInt32X(&x.FMapIntInt32, d)
- }
- }
- case "FptrMapIntInt32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntInt32 != nil {
- x.FptrMapIntInt32 = nil
- }
- } else {
- if x.FptrMapIntInt32 == nil {
- x.FptrMapIntInt32 = new(map[int]int32)
- }
-
- if false {
- } else {
- z.F.DecMapIntInt32X(x.FptrMapIntInt32, d)
- }
- }
- case "FMapIntInt64":
- if r.TryDecodeAsNil() {
- x.FMapIntInt64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntInt64X(&x.FMapIntInt64, d)
- }
- }
- case "FptrMapIntInt64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntInt64 != nil {
- x.FptrMapIntInt64 = nil
- }
- } else {
- if x.FptrMapIntInt64 == nil {
- x.FptrMapIntInt64 = new(map[int]int64)
- }
-
- if false {
- } else {
- z.F.DecMapIntInt64X(x.FptrMapIntInt64, d)
- }
- }
- case "FMapIntFloat32":
- if r.TryDecodeAsNil() {
- x.FMapIntFloat32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntFloat32X(&x.FMapIntFloat32, d)
- }
- }
- case "FptrMapIntFloat32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntFloat32 != nil {
- x.FptrMapIntFloat32 = nil
- }
- } else {
- if x.FptrMapIntFloat32 == nil {
- x.FptrMapIntFloat32 = new(map[int]float32)
- }
-
- if false {
- } else {
- z.F.DecMapIntFloat32X(x.FptrMapIntFloat32, d)
- }
- }
- case "FMapIntFloat64":
- if r.TryDecodeAsNil() {
- x.FMapIntFloat64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntFloat64X(&x.FMapIntFloat64, d)
- }
- }
- case "FptrMapIntFloat64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntFloat64 != nil {
- x.FptrMapIntFloat64 = nil
- }
- } else {
- if x.FptrMapIntFloat64 == nil {
- x.FptrMapIntFloat64 = new(map[int]float64)
- }
-
- if false {
- } else {
- z.F.DecMapIntFloat64X(x.FptrMapIntFloat64, d)
- }
- }
- case "FMapIntBool":
- if r.TryDecodeAsNil() {
- x.FMapIntBool = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntBoolX(&x.FMapIntBool, d)
- }
- }
- case "FptrMapIntBool":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntBool != nil {
- x.FptrMapIntBool = nil
- }
- } else {
- if x.FptrMapIntBool == nil {
- x.FptrMapIntBool = new(map[int]bool)
- }
-
- if false {
- } else {
- z.F.DecMapIntBoolX(x.FptrMapIntBool, d)
- }
- }
- case "FMapInt8Intf":
- if r.TryDecodeAsNil() {
- x.FMapInt8Intf = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8IntfX(&x.FMapInt8Intf, d)
- }
- }
- case "FptrMapInt8Intf":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Intf != nil {
- x.FptrMapInt8Intf = nil
- }
- } else {
- if x.FptrMapInt8Intf == nil {
- x.FptrMapInt8Intf = new(map[int8]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapInt8IntfX(x.FptrMapInt8Intf, d)
- }
- }
- case "FMapInt8String":
- if r.TryDecodeAsNil() {
- x.FMapInt8String = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8StringX(&x.FMapInt8String, d)
- }
- }
- case "FptrMapInt8String":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8String != nil {
- x.FptrMapInt8String = nil
- }
- } else {
- if x.FptrMapInt8String == nil {
- x.FptrMapInt8String = new(map[int8]string)
- }
-
- if false {
- } else {
- z.F.DecMapInt8StringX(x.FptrMapInt8String, d)
- }
- }
- case "FMapInt8Uint":
- if r.TryDecodeAsNil() {
- x.FMapInt8Uint = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8UintX(&x.FMapInt8Uint, d)
- }
- }
- case "FptrMapInt8Uint":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Uint != nil {
- x.FptrMapInt8Uint = nil
- }
- } else {
- if x.FptrMapInt8Uint == nil {
- x.FptrMapInt8Uint = new(map[int8]uint)
- }
-
- if false {
- } else {
- z.F.DecMapInt8UintX(x.FptrMapInt8Uint, d)
- }
- }
- case "FMapInt8Uint8":
- if r.TryDecodeAsNil() {
- x.FMapInt8Uint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8Uint8X(&x.FMapInt8Uint8, d)
- }
- }
- case "FptrMapInt8Uint8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Uint8 != nil {
- x.FptrMapInt8Uint8 = nil
- }
- } else {
- if x.FptrMapInt8Uint8 == nil {
- x.FptrMapInt8Uint8 = new(map[int8]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapInt8Uint8X(x.FptrMapInt8Uint8, d)
- }
- }
- case "FMapInt8Uint16":
- if r.TryDecodeAsNil() {
- x.FMapInt8Uint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8Uint16X(&x.FMapInt8Uint16, d)
- }
- }
- case "FptrMapInt8Uint16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Uint16 != nil {
- x.FptrMapInt8Uint16 = nil
- }
- } else {
- if x.FptrMapInt8Uint16 == nil {
- x.FptrMapInt8Uint16 = new(map[int8]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapInt8Uint16X(x.FptrMapInt8Uint16, d)
- }
- }
- case "FMapInt8Uint32":
- if r.TryDecodeAsNil() {
- x.FMapInt8Uint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8Uint32X(&x.FMapInt8Uint32, d)
- }
- }
- case "FptrMapInt8Uint32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Uint32 != nil {
- x.FptrMapInt8Uint32 = nil
- }
- } else {
- if x.FptrMapInt8Uint32 == nil {
- x.FptrMapInt8Uint32 = new(map[int8]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapInt8Uint32X(x.FptrMapInt8Uint32, d)
- }
- }
- case "FMapInt8Uint64":
- if r.TryDecodeAsNil() {
- x.FMapInt8Uint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8Uint64X(&x.FMapInt8Uint64, d)
- }
- }
- case "FptrMapInt8Uint64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Uint64 != nil {
- x.FptrMapInt8Uint64 = nil
- }
- } else {
- if x.FptrMapInt8Uint64 == nil {
- x.FptrMapInt8Uint64 = new(map[int8]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapInt8Uint64X(x.FptrMapInt8Uint64, d)
- }
- }
- case "FMapInt8Uintptr":
- if r.TryDecodeAsNil() {
- x.FMapInt8Uintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8UintptrX(&x.FMapInt8Uintptr, d)
- }
- }
- case "FptrMapInt8Uintptr":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Uintptr != nil {
- x.FptrMapInt8Uintptr = nil
- }
- } else {
- if x.FptrMapInt8Uintptr == nil {
- x.FptrMapInt8Uintptr = new(map[int8]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapInt8UintptrX(x.FptrMapInt8Uintptr, d)
- }
- }
- case "FMapInt8Int":
- if r.TryDecodeAsNil() {
- x.FMapInt8Int = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8IntX(&x.FMapInt8Int, d)
- }
- }
- case "FptrMapInt8Int":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Int != nil {
- x.FptrMapInt8Int = nil
- }
- } else {
- if x.FptrMapInt8Int == nil {
- x.FptrMapInt8Int = new(map[int8]int)
- }
-
- if false {
- } else {
- z.F.DecMapInt8IntX(x.FptrMapInt8Int, d)
- }
- }
- case "FMapInt8Int8":
- if r.TryDecodeAsNil() {
- x.FMapInt8Int8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8Int8X(&x.FMapInt8Int8, d)
- }
- }
- case "FptrMapInt8Int8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Int8 != nil {
- x.FptrMapInt8Int8 = nil
- }
- } else {
- if x.FptrMapInt8Int8 == nil {
- x.FptrMapInt8Int8 = new(map[int8]int8)
- }
-
- if false {
- } else {
- z.F.DecMapInt8Int8X(x.FptrMapInt8Int8, d)
- }
- }
- case "FMapInt8Int16":
- if r.TryDecodeAsNil() {
- x.FMapInt8Int16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8Int16X(&x.FMapInt8Int16, d)
- }
- }
- case "FptrMapInt8Int16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Int16 != nil {
- x.FptrMapInt8Int16 = nil
- }
- } else {
- if x.FptrMapInt8Int16 == nil {
- x.FptrMapInt8Int16 = new(map[int8]int16)
- }
-
- if false {
- } else {
- z.F.DecMapInt8Int16X(x.FptrMapInt8Int16, d)
- }
- }
- case "FMapInt8Int32":
- if r.TryDecodeAsNil() {
- x.FMapInt8Int32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8Int32X(&x.FMapInt8Int32, d)
- }
- }
- case "FptrMapInt8Int32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Int32 != nil {
- x.FptrMapInt8Int32 = nil
- }
- } else {
- if x.FptrMapInt8Int32 == nil {
- x.FptrMapInt8Int32 = new(map[int8]int32)
- }
-
- if false {
- } else {
- z.F.DecMapInt8Int32X(x.FptrMapInt8Int32, d)
- }
- }
- case "FMapInt8Int64":
- if r.TryDecodeAsNil() {
- x.FMapInt8Int64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8Int64X(&x.FMapInt8Int64, d)
- }
- }
- case "FptrMapInt8Int64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Int64 != nil {
- x.FptrMapInt8Int64 = nil
- }
- } else {
- if x.FptrMapInt8Int64 == nil {
- x.FptrMapInt8Int64 = new(map[int8]int64)
- }
-
- if false {
- } else {
- z.F.DecMapInt8Int64X(x.FptrMapInt8Int64, d)
- }
- }
- case "FMapInt8Float32":
- if r.TryDecodeAsNil() {
- x.FMapInt8Float32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8Float32X(&x.FMapInt8Float32, d)
- }
- }
- case "FptrMapInt8Float32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Float32 != nil {
- x.FptrMapInt8Float32 = nil
- }
- } else {
- if x.FptrMapInt8Float32 == nil {
- x.FptrMapInt8Float32 = new(map[int8]float32)
- }
-
- if false {
- } else {
- z.F.DecMapInt8Float32X(x.FptrMapInt8Float32, d)
- }
- }
- case "FMapInt8Float64":
- if r.TryDecodeAsNil() {
- x.FMapInt8Float64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8Float64X(&x.FMapInt8Float64, d)
- }
- }
- case "FptrMapInt8Float64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Float64 != nil {
- x.FptrMapInt8Float64 = nil
- }
- } else {
- if x.FptrMapInt8Float64 == nil {
- x.FptrMapInt8Float64 = new(map[int8]float64)
- }
-
- if false {
- } else {
- z.F.DecMapInt8Float64X(x.FptrMapInt8Float64, d)
- }
- }
- case "FMapInt8Bool":
- if r.TryDecodeAsNil() {
- x.FMapInt8Bool = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8BoolX(&x.FMapInt8Bool, d)
- }
- }
- case "FptrMapInt8Bool":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Bool != nil {
- x.FptrMapInt8Bool = nil
- }
- } else {
- if x.FptrMapInt8Bool == nil {
- x.FptrMapInt8Bool = new(map[int8]bool)
- }
-
- if false {
- } else {
- z.F.DecMapInt8BoolX(x.FptrMapInt8Bool, d)
- }
- }
- case "FMapInt16Intf":
- if r.TryDecodeAsNil() {
- x.FMapInt16Intf = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16IntfX(&x.FMapInt16Intf, d)
- }
- }
- case "FptrMapInt16Intf":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Intf != nil {
- x.FptrMapInt16Intf = nil
- }
- } else {
- if x.FptrMapInt16Intf == nil {
- x.FptrMapInt16Intf = new(map[int16]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapInt16IntfX(x.FptrMapInt16Intf, d)
- }
- }
- case "FMapInt16String":
- if r.TryDecodeAsNil() {
- x.FMapInt16String = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16StringX(&x.FMapInt16String, d)
- }
- }
- case "FptrMapInt16String":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16String != nil {
- x.FptrMapInt16String = nil
- }
- } else {
- if x.FptrMapInt16String == nil {
- x.FptrMapInt16String = new(map[int16]string)
- }
-
- if false {
- } else {
- z.F.DecMapInt16StringX(x.FptrMapInt16String, d)
- }
- }
- case "FMapInt16Uint":
- if r.TryDecodeAsNil() {
- x.FMapInt16Uint = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16UintX(&x.FMapInt16Uint, d)
- }
- }
- case "FptrMapInt16Uint":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Uint != nil {
- x.FptrMapInt16Uint = nil
- }
- } else {
- if x.FptrMapInt16Uint == nil {
- x.FptrMapInt16Uint = new(map[int16]uint)
- }
-
- if false {
- } else {
- z.F.DecMapInt16UintX(x.FptrMapInt16Uint, d)
- }
- }
- case "FMapInt16Uint8":
- if r.TryDecodeAsNil() {
- x.FMapInt16Uint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16Uint8X(&x.FMapInt16Uint8, d)
- }
- }
- case "FptrMapInt16Uint8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Uint8 != nil {
- x.FptrMapInt16Uint8 = nil
- }
- } else {
- if x.FptrMapInt16Uint8 == nil {
- x.FptrMapInt16Uint8 = new(map[int16]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapInt16Uint8X(x.FptrMapInt16Uint8, d)
- }
- }
- case "FMapInt16Uint16":
- if r.TryDecodeAsNil() {
- x.FMapInt16Uint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16Uint16X(&x.FMapInt16Uint16, d)
- }
- }
- case "FptrMapInt16Uint16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Uint16 != nil {
- x.FptrMapInt16Uint16 = nil
- }
- } else {
- if x.FptrMapInt16Uint16 == nil {
- x.FptrMapInt16Uint16 = new(map[int16]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapInt16Uint16X(x.FptrMapInt16Uint16, d)
- }
- }
- case "FMapInt16Uint32":
- if r.TryDecodeAsNil() {
- x.FMapInt16Uint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16Uint32X(&x.FMapInt16Uint32, d)
- }
- }
- case "FptrMapInt16Uint32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Uint32 != nil {
- x.FptrMapInt16Uint32 = nil
- }
- } else {
- if x.FptrMapInt16Uint32 == nil {
- x.FptrMapInt16Uint32 = new(map[int16]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapInt16Uint32X(x.FptrMapInt16Uint32, d)
- }
- }
- case "FMapInt16Uint64":
- if r.TryDecodeAsNil() {
- x.FMapInt16Uint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16Uint64X(&x.FMapInt16Uint64, d)
- }
- }
- case "FptrMapInt16Uint64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Uint64 != nil {
- x.FptrMapInt16Uint64 = nil
- }
- } else {
- if x.FptrMapInt16Uint64 == nil {
- x.FptrMapInt16Uint64 = new(map[int16]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapInt16Uint64X(x.FptrMapInt16Uint64, d)
- }
- }
- case "FMapInt16Uintptr":
- if r.TryDecodeAsNil() {
- x.FMapInt16Uintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16UintptrX(&x.FMapInt16Uintptr, d)
- }
- }
- case "FptrMapInt16Uintptr":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Uintptr != nil {
- x.FptrMapInt16Uintptr = nil
- }
- } else {
- if x.FptrMapInt16Uintptr == nil {
- x.FptrMapInt16Uintptr = new(map[int16]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapInt16UintptrX(x.FptrMapInt16Uintptr, d)
- }
- }
- case "FMapInt16Int":
- if r.TryDecodeAsNil() {
- x.FMapInt16Int = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16IntX(&x.FMapInt16Int, d)
- }
- }
- case "FptrMapInt16Int":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Int != nil {
- x.FptrMapInt16Int = nil
- }
- } else {
- if x.FptrMapInt16Int == nil {
- x.FptrMapInt16Int = new(map[int16]int)
- }
-
- if false {
- } else {
- z.F.DecMapInt16IntX(x.FptrMapInt16Int, d)
- }
- }
- case "FMapInt16Int8":
- if r.TryDecodeAsNil() {
- x.FMapInt16Int8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16Int8X(&x.FMapInt16Int8, d)
- }
- }
- case "FptrMapInt16Int8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Int8 != nil {
- x.FptrMapInt16Int8 = nil
- }
- } else {
- if x.FptrMapInt16Int8 == nil {
- x.FptrMapInt16Int8 = new(map[int16]int8)
- }
-
- if false {
- } else {
- z.F.DecMapInt16Int8X(x.FptrMapInt16Int8, d)
- }
- }
- case "FMapInt16Int16":
- if r.TryDecodeAsNil() {
- x.FMapInt16Int16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16Int16X(&x.FMapInt16Int16, d)
- }
- }
- case "FptrMapInt16Int16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Int16 != nil {
- x.FptrMapInt16Int16 = nil
- }
- } else {
- if x.FptrMapInt16Int16 == nil {
- x.FptrMapInt16Int16 = new(map[int16]int16)
- }
-
- if false {
- } else {
- z.F.DecMapInt16Int16X(x.FptrMapInt16Int16, d)
- }
- }
- case "FMapInt16Int32":
- if r.TryDecodeAsNil() {
- x.FMapInt16Int32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16Int32X(&x.FMapInt16Int32, d)
- }
- }
- case "FptrMapInt16Int32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Int32 != nil {
- x.FptrMapInt16Int32 = nil
- }
- } else {
- if x.FptrMapInt16Int32 == nil {
- x.FptrMapInt16Int32 = new(map[int16]int32)
- }
-
- if false {
- } else {
- z.F.DecMapInt16Int32X(x.FptrMapInt16Int32, d)
- }
- }
- case "FMapInt16Int64":
- if r.TryDecodeAsNil() {
- x.FMapInt16Int64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16Int64X(&x.FMapInt16Int64, d)
- }
- }
- case "FptrMapInt16Int64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Int64 != nil {
- x.FptrMapInt16Int64 = nil
- }
- } else {
- if x.FptrMapInt16Int64 == nil {
- x.FptrMapInt16Int64 = new(map[int16]int64)
- }
-
- if false {
- } else {
- z.F.DecMapInt16Int64X(x.FptrMapInt16Int64, d)
- }
- }
- case "FMapInt16Float32":
- if r.TryDecodeAsNil() {
- x.FMapInt16Float32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16Float32X(&x.FMapInt16Float32, d)
- }
- }
- case "FptrMapInt16Float32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Float32 != nil {
- x.FptrMapInt16Float32 = nil
- }
- } else {
- if x.FptrMapInt16Float32 == nil {
- x.FptrMapInt16Float32 = new(map[int16]float32)
- }
-
- if false {
- } else {
- z.F.DecMapInt16Float32X(x.FptrMapInt16Float32, d)
- }
- }
- case "FMapInt16Float64":
- if r.TryDecodeAsNil() {
- x.FMapInt16Float64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16Float64X(&x.FMapInt16Float64, d)
- }
- }
- case "FptrMapInt16Float64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Float64 != nil {
- x.FptrMapInt16Float64 = nil
- }
- } else {
- if x.FptrMapInt16Float64 == nil {
- x.FptrMapInt16Float64 = new(map[int16]float64)
- }
-
- if false {
- } else {
- z.F.DecMapInt16Float64X(x.FptrMapInt16Float64, d)
- }
- }
- case "FMapInt16Bool":
- if r.TryDecodeAsNil() {
- x.FMapInt16Bool = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16BoolX(&x.FMapInt16Bool, d)
- }
- }
- case "FptrMapInt16Bool":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Bool != nil {
- x.FptrMapInt16Bool = nil
- }
- } else {
- if x.FptrMapInt16Bool == nil {
- x.FptrMapInt16Bool = new(map[int16]bool)
- }
-
- if false {
- } else {
- z.F.DecMapInt16BoolX(x.FptrMapInt16Bool, d)
- }
- }
- case "FMapInt32Intf":
- if r.TryDecodeAsNil() {
- x.FMapInt32Intf = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32IntfX(&x.FMapInt32Intf, d)
- }
- }
- case "FptrMapInt32Intf":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Intf != nil {
- x.FptrMapInt32Intf = nil
- }
- } else {
- if x.FptrMapInt32Intf == nil {
- x.FptrMapInt32Intf = new(map[int32]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapInt32IntfX(x.FptrMapInt32Intf, d)
- }
- }
- case "FMapInt32String":
- if r.TryDecodeAsNil() {
- x.FMapInt32String = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32StringX(&x.FMapInt32String, d)
- }
- }
- case "FptrMapInt32String":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32String != nil {
- x.FptrMapInt32String = nil
- }
- } else {
- if x.FptrMapInt32String == nil {
- x.FptrMapInt32String = new(map[int32]string)
- }
-
- if false {
- } else {
- z.F.DecMapInt32StringX(x.FptrMapInt32String, d)
- }
- }
- case "FMapInt32Uint":
- if r.TryDecodeAsNil() {
- x.FMapInt32Uint = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32UintX(&x.FMapInt32Uint, d)
- }
- }
- case "FptrMapInt32Uint":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Uint != nil {
- x.FptrMapInt32Uint = nil
- }
- } else {
- if x.FptrMapInt32Uint == nil {
- x.FptrMapInt32Uint = new(map[int32]uint)
- }
-
- if false {
- } else {
- z.F.DecMapInt32UintX(x.FptrMapInt32Uint, d)
- }
- }
- case "FMapInt32Uint8":
- if r.TryDecodeAsNil() {
- x.FMapInt32Uint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32Uint8X(&x.FMapInt32Uint8, d)
- }
- }
- case "FptrMapInt32Uint8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Uint8 != nil {
- x.FptrMapInt32Uint8 = nil
- }
- } else {
- if x.FptrMapInt32Uint8 == nil {
- x.FptrMapInt32Uint8 = new(map[int32]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapInt32Uint8X(x.FptrMapInt32Uint8, d)
- }
- }
- case "FMapInt32Uint16":
- if r.TryDecodeAsNil() {
- x.FMapInt32Uint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32Uint16X(&x.FMapInt32Uint16, d)
- }
- }
- case "FptrMapInt32Uint16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Uint16 != nil {
- x.FptrMapInt32Uint16 = nil
- }
- } else {
- if x.FptrMapInt32Uint16 == nil {
- x.FptrMapInt32Uint16 = new(map[int32]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapInt32Uint16X(x.FptrMapInt32Uint16, d)
- }
- }
- case "FMapInt32Uint32":
- if r.TryDecodeAsNil() {
- x.FMapInt32Uint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32Uint32X(&x.FMapInt32Uint32, d)
- }
- }
- case "FptrMapInt32Uint32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Uint32 != nil {
- x.FptrMapInt32Uint32 = nil
- }
- } else {
- if x.FptrMapInt32Uint32 == nil {
- x.FptrMapInt32Uint32 = new(map[int32]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapInt32Uint32X(x.FptrMapInt32Uint32, d)
- }
- }
- case "FMapInt32Uint64":
- if r.TryDecodeAsNil() {
- x.FMapInt32Uint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32Uint64X(&x.FMapInt32Uint64, d)
- }
- }
- case "FptrMapInt32Uint64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Uint64 != nil {
- x.FptrMapInt32Uint64 = nil
- }
- } else {
- if x.FptrMapInt32Uint64 == nil {
- x.FptrMapInt32Uint64 = new(map[int32]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapInt32Uint64X(x.FptrMapInt32Uint64, d)
- }
- }
- case "FMapInt32Uintptr":
- if r.TryDecodeAsNil() {
- x.FMapInt32Uintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32UintptrX(&x.FMapInt32Uintptr, d)
- }
- }
- case "FptrMapInt32Uintptr":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Uintptr != nil {
- x.FptrMapInt32Uintptr = nil
- }
- } else {
- if x.FptrMapInt32Uintptr == nil {
- x.FptrMapInt32Uintptr = new(map[int32]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapInt32UintptrX(x.FptrMapInt32Uintptr, d)
- }
- }
- case "FMapInt32Int":
- if r.TryDecodeAsNil() {
- x.FMapInt32Int = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32IntX(&x.FMapInt32Int, d)
- }
- }
- case "FptrMapInt32Int":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Int != nil {
- x.FptrMapInt32Int = nil
- }
- } else {
- if x.FptrMapInt32Int == nil {
- x.FptrMapInt32Int = new(map[int32]int)
- }
-
- if false {
- } else {
- z.F.DecMapInt32IntX(x.FptrMapInt32Int, d)
- }
- }
- case "FMapInt32Int8":
- if r.TryDecodeAsNil() {
- x.FMapInt32Int8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32Int8X(&x.FMapInt32Int8, d)
- }
- }
- case "FptrMapInt32Int8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Int8 != nil {
- x.FptrMapInt32Int8 = nil
- }
- } else {
- if x.FptrMapInt32Int8 == nil {
- x.FptrMapInt32Int8 = new(map[int32]int8)
- }
-
- if false {
- } else {
- z.F.DecMapInt32Int8X(x.FptrMapInt32Int8, d)
- }
- }
- case "FMapInt32Int16":
- if r.TryDecodeAsNil() {
- x.FMapInt32Int16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32Int16X(&x.FMapInt32Int16, d)
- }
- }
- case "FptrMapInt32Int16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Int16 != nil {
- x.FptrMapInt32Int16 = nil
- }
- } else {
- if x.FptrMapInt32Int16 == nil {
- x.FptrMapInt32Int16 = new(map[int32]int16)
- }
-
- if false {
- } else {
- z.F.DecMapInt32Int16X(x.FptrMapInt32Int16, d)
- }
- }
- case "FMapInt32Int32":
- if r.TryDecodeAsNil() {
- x.FMapInt32Int32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32Int32X(&x.FMapInt32Int32, d)
- }
- }
- case "FptrMapInt32Int32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Int32 != nil {
- x.FptrMapInt32Int32 = nil
- }
- } else {
- if x.FptrMapInt32Int32 == nil {
- x.FptrMapInt32Int32 = new(map[int32]int32)
- }
-
- if false {
- } else {
- z.F.DecMapInt32Int32X(x.FptrMapInt32Int32, d)
- }
- }
- case "FMapInt32Int64":
- if r.TryDecodeAsNil() {
- x.FMapInt32Int64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32Int64X(&x.FMapInt32Int64, d)
- }
- }
- case "FptrMapInt32Int64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Int64 != nil {
- x.FptrMapInt32Int64 = nil
- }
- } else {
- if x.FptrMapInt32Int64 == nil {
- x.FptrMapInt32Int64 = new(map[int32]int64)
- }
-
- if false {
- } else {
- z.F.DecMapInt32Int64X(x.FptrMapInt32Int64, d)
- }
- }
- case "FMapInt32Float32":
- if r.TryDecodeAsNil() {
- x.FMapInt32Float32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32Float32X(&x.FMapInt32Float32, d)
- }
- }
- case "FptrMapInt32Float32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Float32 != nil {
- x.FptrMapInt32Float32 = nil
- }
- } else {
- if x.FptrMapInt32Float32 == nil {
- x.FptrMapInt32Float32 = new(map[int32]float32)
- }
-
- if false {
- } else {
- z.F.DecMapInt32Float32X(x.FptrMapInt32Float32, d)
- }
- }
- case "FMapInt32Float64":
- if r.TryDecodeAsNil() {
- x.FMapInt32Float64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32Float64X(&x.FMapInt32Float64, d)
- }
- }
- case "FptrMapInt32Float64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Float64 != nil {
- x.FptrMapInt32Float64 = nil
- }
- } else {
- if x.FptrMapInt32Float64 == nil {
- x.FptrMapInt32Float64 = new(map[int32]float64)
- }
-
- if false {
- } else {
- z.F.DecMapInt32Float64X(x.FptrMapInt32Float64, d)
- }
- }
- case "FMapInt32Bool":
- if r.TryDecodeAsNil() {
- x.FMapInt32Bool = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32BoolX(&x.FMapInt32Bool, d)
- }
- }
- case "FptrMapInt32Bool":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Bool != nil {
- x.FptrMapInt32Bool = nil
- }
- } else {
- if x.FptrMapInt32Bool == nil {
- x.FptrMapInt32Bool = new(map[int32]bool)
- }
-
- if false {
- } else {
- z.F.DecMapInt32BoolX(x.FptrMapInt32Bool, d)
- }
- }
- case "FMapInt64Intf":
- if r.TryDecodeAsNil() {
- x.FMapInt64Intf = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64IntfX(&x.FMapInt64Intf, d)
- }
- }
- case "FptrMapInt64Intf":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Intf != nil {
- x.FptrMapInt64Intf = nil
- }
- } else {
- if x.FptrMapInt64Intf == nil {
- x.FptrMapInt64Intf = new(map[int64]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapInt64IntfX(x.FptrMapInt64Intf, d)
- }
- }
- case "FMapInt64String":
- if r.TryDecodeAsNil() {
- x.FMapInt64String = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64StringX(&x.FMapInt64String, d)
- }
- }
- case "FptrMapInt64String":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64String != nil {
- x.FptrMapInt64String = nil
- }
- } else {
- if x.FptrMapInt64String == nil {
- x.FptrMapInt64String = new(map[int64]string)
- }
-
- if false {
- } else {
- z.F.DecMapInt64StringX(x.FptrMapInt64String, d)
- }
- }
- case "FMapInt64Uint":
- if r.TryDecodeAsNil() {
- x.FMapInt64Uint = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64UintX(&x.FMapInt64Uint, d)
- }
- }
- case "FptrMapInt64Uint":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Uint != nil {
- x.FptrMapInt64Uint = nil
- }
- } else {
- if x.FptrMapInt64Uint == nil {
- x.FptrMapInt64Uint = new(map[int64]uint)
- }
-
- if false {
- } else {
- z.F.DecMapInt64UintX(x.FptrMapInt64Uint, d)
- }
- }
- case "FMapInt64Uint8":
- if r.TryDecodeAsNil() {
- x.FMapInt64Uint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64Uint8X(&x.FMapInt64Uint8, d)
- }
- }
- case "FptrMapInt64Uint8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Uint8 != nil {
- x.FptrMapInt64Uint8 = nil
- }
- } else {
- if x.FptrMapInt64Uint8 == nil {
- x.FptrMapInt64Uint8 = new(map[int64]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapInt64Uint8X(x.FptrMapInt64Uint8, d)
- }
- }
- case "FMapInt64Uint16":
- if r.TryDecodeAsNil() {
- x.FMapInt64Uint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64Uint16X(&x.FMapInt64Uint16, d)
- }
- }
- case "FptrMapInt64Uint16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Uint16 != nil {
- x.FptrMapInt64Uint16 = nil
- }
- } else {
- if x.FptrMapInt64Uint16 == nil {
- x.FptrMapInt64Uint16 = new(map[int64]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapInt64Uint16X(x.FptrMapInt64Uint16, d)
- }
- }
- case "FMapInt64Uint32":
- if r.TryDecodeAsNil() {
- x.FMapInt64Uint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64Uint32X(&x.FMapInt64Uint32, d)
- }
- }
- case "FptrMapInt64Uint32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Uint32 != nil {
- x.FptrMapInt64Uint32 = nil
- }
- } else {
- if x.FptrMapInt64Uint32 == nil {
- x.FptrMapInt64Uint32 = new(map[int64]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapInt64Uint32X(x.FptrMapInt64Uint32, d)
- }
- }
- case "FMapInt64Uint64":
- if r.TryDecodeAsNil() {
- x.FMapInt64Uint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64Uint64X(&x.FMapInt64Uint64, d)
- }
- }
- case "FptrMapInt64Uint64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Uint64 != nil {
- x.FptrMapInt64Uint64 = nil
- }
- } else {
- if x.FptrMapInt64Uint64 == nil {
- x.FptrMapInt64Uint64 = new(map[int64]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapInt64Uint64X(x.FptrMapInt64Uint64, d)
- }
- }
- case "FMapInt64Uintptr":
- if r.TryDecodeAsNil() {
- x.FMapInt64Uintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64UintptrX(&x.FMapInt64Uintptr, d)
- }
- }
- case "FptrMapInt64Uintptr":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Uintptr != nil {
- x.FptrMapInt64Uintptr = nil
- }
- } else {
- if x.FptrMapInt64Uintptr == nil {
- x.FptrMapInt64Uintptr = new(map[int64]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapInt64UintptrX(x.FptrMapInt64Uintptr, d)
- }
- }
- case "FMapInt64Int":
- if r.TryDecodeAsNil() {
- x.FMapInt64Int = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64IntX(&x.FMapInt64Int, d)
- }
- }
- case "FptrMapInt64Int":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Int != nil {
- x.FptrMapInt64Int = nil
- }
- } else {
- if x.FptrMapInt64Int == nil {
- x.FptrMapInt64Int = new(map[int64]int)
- }
-
- if false {
- } else {
- z.F.DecMapInt64IntX(x.FptrMapInt64Int, d)
- }
- }
- case "FMapInt64Int8":
- if r.TryDecodeAsNil() {
- x.FMapInt64Int8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64Int8X(&x.FMapInt64Int8, d)
- }
- }
- case "FptrMapInt64Int8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Int8 != nil {
- x.FptrMapInt64Int8 = nil
- }
- } else {
- if x.FptrMapInt64Int8 == nil {
- x.FptrMapInt64Int8 = new(map[int64]int8)
- }
-
- if false {
- } else {
- z.F.DecMapInt64Int8X(x.FptrMapInt64Int8, d)
- }
- }
- case "FMapInt64Int16":
- if r.TryDecodeAsNil() {
- x.FMapInt64Int16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64Int16X(&x.FMapInt64Int16, d)
- }
- }
- case "FptrMapInt64Int16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Int16 != nil {
- x.FptrMapInt64Int16 = nil
- }
- } else {
- if x.FptrMapInt64Int16 == nil {
- x.FptrMapInt64Int16 = new(map[int64]int16)
- }
-
- if false {
- } else {
- z.F.DecMapInt64Int16X(x.FptrMapInt64Int16, d)
- }
- }
- case "FMapInt64Int32":
- if r.TryDecodeAsNil() {
- x.FMapInt64Int32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64Int32X(&x.FMapInt64Int32, d)
- }
- }
- case "FptrMapInt64Int32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Int32 != nil {
- x.FptrMapInt64Int32 = nil
- }
- } else {
- if x.FptrMapInt64Int32 == nil {
- x.FptrMapInt64Int32 = new(map[int64]int32)
- }
-
- if false {
- } else {
- z.F.DecMapInt64Int32X(x.FptrMapInt64Int32, d)
- }
- }
- case "FMapInt64Int64":
- if r.TryDecodeAsNil() {
- x.FMapInt64Int64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64Int64X(&x.FMapInt64Int64, d)
- }
- }
- case "FptrMapInt64Int64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Int64 != nil {
- x.FptrMapInt64Int64 = nil
- }
- } else {
- if x.FptrMapInt64Int64 == nil {
- x.FptrMapInt64Int64 = new(map[int64]int64)
- }
-
- if false {
- } else {
- z.F.DecMapInt64Int64X(x.FptrMapInt64Int64, d)
- }
- }
- case "FMapInt64Float32":
- if r.TryDecodeAsNil() {
- x.FMapInt64Float32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64Float32X(&x.FMapInt64Float32, d)
- }
- }
- case "FptrMapInt64Float32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Float32 != nil {
- x.FptrMapInt64Float32 = nil
- }
- } else {
- if x.FptrMapInt64Float32 == nil {
- x.FptrMapInt64Float32 = new(map[int64]float32)
- }
-
- if false {
- } else {
- z.F.DecMapInt64Float32X(x.FptrMapInt64Float32, d)
- }
- }
- case "FMapInt64Float64":
- if r.TryDecodeAsNil() {
- x.FMapInt64Float64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64Float64X(&x.FMapInt64Float64, d)
- }
- }
- case "FptrMapInt64Float64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Float64 != nil {
- x.FptrMapInt64Float64 = nil
- }
- } else {
- if x.FptrMapInt64Float64 == nil {
- x.FptrMapInt64Float64 = new(map[int64]float64)
- }
-
- if false {
- } else {
- z.F.DecMapInt64Float64X(x.FptrMapInt64Float64, d)
- }
- }
- case "FMapInt64Bool":
- if r.TryDecodeAsNil() {
- x.FMapInt64Bool = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64BoolX(&x.FMapInt64Bool, d)
- }
- }
- case "FptrMapInt64Bool":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Bool != nil {
- x.FptrMapInt64Bool = nil
- }
- } else {
- if x.FptrMapInt64Bool == nil {
- x.FptrMapInt64Bool = new(map[int64]bool)
- }
-
- if false {
- } else {
- z.F.DecMapInt64BoolX(x.FptrMapInt64Bool, d)
- }
- }
- case "FMapBoolIntf":
- if r.TryDecodeAsNil() {
- x.FMapBoolIntf = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolIntfX(&x.FMapBoolIntf, d)
- }
- }
- case "FptrMapBoolIntf":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolIntf != nil {
- x.FptrMapBoolIntf = nil
- }
- } else {
- if x.FptrMapBoolIntf == nil {
- x.FptrMapBoolIntf = new(map[bool]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapBoolIntfX(x.FptrMapBoolIntf, d)
- }
- }
- case "FMapBoolString":
- if r.TryDecodeAsNil() {
- x.FMapBoolString = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolStringX(&x.FMapBoolString, d)
- }
- }
- case "FptrMapBoolString":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolString != nil {
- x.FptrMapBoolString = nil
- }
- } else {
- if x.FptrMapBoolString == nil {
- x.FptrMapBoolString = new(map[bool]string)
- }
-
- if false {
- } else {
- z.F.DecMapBoolStringX(x.FptrMapBoolString, d)
- }
- }
- case "FMapBoolUint":
- if r.TryDecodeAsNil() {
- x.FMapBoolUint = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolUintX(&x.FMapBoolUint, d)
- }
- }
- case "FptrMapBoolUint":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolUint != nil {
- x.FptrMapBoolUint = nil
- }
- } else {
- if x.FptrMapBoolUint == nil {
- x.FptrMapBoolUint = new(map[bool]uint)
- }
-
- if false {
- } else {
- z.F.DecMapBoolUintX(x.FptrMapBoolUint, d)
- }
- }
- case "FMapBoolUint8":
- if r.TryDecodeAsNil() {
- x.FMapBoolUint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolUint8X(&x.FMapBoolUint8, d)
- }
- }
- case "FptrMapBoolUint8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolUint8 != nil {
- x.FptrMapBoolUint8 = nil
- }
- } else {
- if x.FptrMapBoolUint8 == nil {
- x.FptrMapBoolUint8 = new(map[bool]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapBoolUint8X(x.FptrMapBoolUint8, d)
- }
- }
- case "FMapBoolUint16":
- if r.TryDecodeAsNil() {
- x.FMapBoolUint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolUint16X(&x.FMapBoolUint16, d)
- }
- }
- case "FptrMapBoolUint16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolUint16 != nil {
- x.FptrMapBoolUint16 = nil
- }
- } else {
- if x.FptrMapBoolUint16 == nil {
- x.FptrMapBoolUint16 = new(map[bool]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapBoolUint16X(x.FptrMapBoolUint16, d)
- }
- }
- case "FMapBoolUint32":
- if r.TryDecodeAsNil() {
- x.FMapBoolUint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolUint32X(&x.FMapBoolUint32, d)
- }
- }
- case "FptrMapBoolUint32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolUint32 != nil {
- x.FptrMapBoolUint32 = nil
- }
- } else {
- if x.FptrMapBoolUint32 == nil {
- x.FptrMapBoolUint32 = new(map[bool]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapBoolUint32X(x.FptrMapBoolUint32, d)
- }
- }
- case "FMapBoolUint64":
- if r.TryDecodeAsNil() {
- x.FMapBoolUint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolUint64X(&x.FMapBoolUint64, d)
- }
- }
- case "FptrMapBoolUint64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolUint64 != nil {
- x.FptrMapBoolUint64 = nil
- }
- } else {
- if x.FptrMapBoolUint64 == nil {
- x.FptrMapBoolUint64 = new(map[bool]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapBoolUint64X(x.FptrMapBoolUint64, d)
- }
- }
- case "FMapBoolUintptr":
- if r.TryDecodeAsNil() {
- x.FMapBoolUintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolUintptrX(&x.FMapBoolUintptr, d)
- }
- }
- case "FptrMapBoolUintptr":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolUintptr != nil {
- x.FptrMapBoolUintptr = nil
- }
- } else {
- if x.FptrMapBoolUintptr == nil {
- x.FptrMapBoolUintptr = new(map[bool]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapBoolUintptrX(x.FptrMapBoolUintptr, d)
- }
- }
- case "FMapBoolInt":
- if r.TryDecodeAsNil() {
- x.FMapBoolInt = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolIntX(&x.FMapBoolInt, d)
- }
- }
- case "FptrMapBoolInt":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolInt != nil {
- x.FptrMapBoolInt = nil
- }
- } else {
- if x.FptrMapBoolInt == nil {
- x.FptrMapBoolInt = new(map[bool]int)
- }
-
- if false {
- } else {
- z.F.DecMapBoolIntX(x.FptrMapBoolInt, d)
- }
- }
- case "FMapBoolInt8":
- if r.TryDecodeAsNil() {
- x.FMapBoolInt8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolInt8X(&x.FMapBoolInt8, d)
- }
- }
- case "FptrMapBoolInt8":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolInt8 != nil {
- x.FptrMapBoolInt8 = nil
- }
- } else {
- if x.FptrMapBoolInt8 == nil {
- x.FptrMapBoolInt8 = new(map[bool]int8)
- }
-
- if false {
- } else {
- z.F.DecMapBoolInt8X(x.FptrMapBoolInt8, d)
- }
- }
- case "FMapBoolInt16":
- if r.TryDecodeAsNil() {
- x.FMapBoolInt16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolInt16X(&x.FMapBoolInt16, d)
- }
- }
- case "FptrMapBoolInt16":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolInt16 != nil {
- x.FptrMapBoolInt16 = nil
- }
- } else {
- if x.FptrMapBoolInt16 == nil {
- x.FptrMapBoolInt16 = new(map[bool]int16)
- }
-
- if false {
- } else {
- z.F.DecMapBoolInt16X(x.FptrMapBoolInt16, d)
- }
- }
- case "FMapBoolInt32":
- if r.TryDecodeAsNil() {
- x.FMapBoolInt32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolInt32X(&x.FMapBoolInt32, d)
- }
- }
- case "FptrMapBoolInt32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolInt32 != nil {
- x.FptrMapBoolInt32 = nil
- }
- } else {
- if x.FptrMapBoolInt32 == nil {
- x.FptrMapBoolInt32 = new(map[bool]int32)
- }
-
- if false {
- } else {
- z.F.DecMapBoolInt32X(x.FptrMapBoolInt32, d)
- }
- }
- case "FMapBoolInt64":
- if r.TryDecodeAsNil() {
- x.FMapBoolInt64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolInt64X(&x.FMapBoolInt64, d)
- }
- }
- case "FptrMapBoolInt64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolInt64 != nil {
- x.FptrMapBoolInt64 = nil
- }
- } else {
- if x.FptrMapBoolInt64 == nil {
- x.FptrMapBoolInt64 = new(map[bool]int64)
- }
-
- if false {
- } else {
- z.F.DecMapBoolInt64X(x.FptrMapBoolInt64, d)
- }
- }
- case "FMapBoolFloat32":
- if r.TryDecodeAsNil() {
- x.FMapBoolFloat32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolFloat32X(&x.FMapBoolFloat32, d)
- }
- }
- case "FptrMapBoolFloat32":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolFloat32 != nil {
- x.FptrMapBoolFloat32 = nil
- }
- } else {
- if x.FptrMapBoolFloat32 == nil {
- x.FptrMapBoolFloat32 = new(map[bool]float32)
- }
-
- if false {
- } else {
- z.F.DecMapBoolFloat32X(x.FptrMapBoolFloat32, d)
- }
- }
- case "FMapBoolFloat64":
- if r.TryDecodeAsNil() {
- x.FMapBoolFloat64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolFloat64X(&x.FMapBoolFloat64, d)
- }
- }
- case "FptrMapBoolFloat64":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolFloat64 != nil {
- x.FptrMapBoolFloat64 = nil
- }
- } else {
- if x.FptrMapBoolFloat64 == nil {
- x.FptrMapBoolFloat64 = new(map[bool]float64)
- }
-
- if false {
- } else {
- z.F.DecMapBoolFloat64X(x.FptrMapBoolFloat64, d)
- }
- }
- case "FMapBoolBool":
- if r.TryDecodeAsNil() {
- x.FMapBoolBool = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolBoolX(&x.FMapBoolBool, d)
- }
- }
- case "FptrMapBoolBool":
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolBool != nil {
- x.FptrMapBoolBool = nil
- }
- } else {
- if x.FptrMapBoolBool == nil {
- x.FptrMapBoolBool = new(map[bool]bool)
- }
-
- if false {
- } else {
- z.F.DecMapBoolBoolX(x.FptrMapBoolBool, d)
- }
- }
- default:
- z.DecStructFieldNotFound(-1, yys3)
- } // end switch yys3
- } // end for yyj3
- r.ReadMapEnd()
-}
-
-func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) {
- var h codecSelfer19781
- z, r := GenHelperDecoder(d)
- _, _, _ = h, z, r
- var yyj1141 int
- var yyb1141 bool
- var yyhl1141 bool = l >= 0
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FIntf = nil
- } else {
- if false {
- } else {
- z.DecFallback(&x.FIntf, true)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrIntf != nil {
- x.FptrIntf = nil
- }
- } else {
- if x.FptrIntf == nil {
- x.FptrIntf = new(interface{})
- }
-
- if false {
- } else {
- z.DecFallback(x.FptrIntf, true)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FString = ""
- } else {
- x.FString = (string)(r.DecodeString())
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrString != nil {
- x.FptrString = nil
- }
- } else {
- if x.FptrString == nil {
- x.FptrString = new(string)
- }
-
- if false {
- } else {
- *x.FptrString = (string)(r.DecodeString())
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FFloat32 = 0
- } else {
- x.FFloat32 = (float32)(r.DecodeFloat32As64())
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrFloat32 != nil {
- x.FptrFloat32 = nil
- }
- } else {
- if x.FptrFloat32 == nil {
- x.FptrFloat32 = new(float32)
- }
-
- if false {
- } else {
- *x.FptrFloat32 = (float32)(r.DecodeFloat32As64())
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FFloat64 = 0
- } else {
- x.FFloat64 = (float64)(r.DecodeFloat64())
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrFloat64 != nil {
- x.FptrFloat64 = nil
- }
- } else {
- if x.FptrFloat64 == nil {
- x.FptrFloat64 = new(float64)
- }
-
- if false {
- } else {
- *x.FptrFloat64 = (float64)(r.DecodeFloat64())
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FUint = 0
- } else {
- x.FUint = (uint)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize19781))
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrUint != nil {
- x.FptrUint = nil
- }
- } else {
- if x.FptrUint == nil {
- x.FptrUint = new(uint)
- }
-
- if false {
- } else {
- *x.FptrUint = (uint)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize19781))
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FUint8 = 0
- } else {
- x.FUint8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8))
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrUint8 != nil {
- x.FptrUint8 = nil
- }
- } else {
- if x.FptrUint8 == nil {
- x.FptrUint8 = new(uint8)
- }
-
- if false {
- } else {
- *x.FptrUint8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8))
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FUint16 = 0
- } else {
- x.FUint16 = (uint16)(z.C.UintV(r.DecodeUint64(), 16))
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrUint16 != nil {
- x.FptrUint16 = nil
- }
- } else {
- if x.FptrUint16 == nil {
- x.FptrUint16 = new(uint16)
- }
-
- if false {
- } else {
- *x.FptrUint16 = (uint16)(z.C.UintV(r.DecodeUint64(), 16))
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FUint32 = 0
- } else {
- x.FUint32 = (uint32)(z.C.UintV(r.DecodeUint64(), 32))
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrUint32 != nil {
- x.FptrUint32 = nil
- }
- } else {
- if x.FptrUint32 == nil {
- x.FptrUint32 = new(uint32)
- }
-
- if false {
- } else {
- *x.FptrUint32 = (uint32)(z.C.UintV(r.DecodeUint64(), 32))
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FUint64 = 0
- } else {
- x.FUint64 = (uint64)(r.DecodeUint64())
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrUint64 != nil {
- x.FptrUint64 = nil
- }
- } else {
- if x.FptrUint64 == nil {
- x.FptrUint64 = new(uint64)
- }
-
- if false {
- } else {
- *x.FptrUint64 = (uint64)(r.DecodeUint64())
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FUintptr = 0
- } else {
- x.FUintptr = (uintptr)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize19781))
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrUintptr != nil {
- x.FptrUintptr = nil
- }
- } else {
- if x.FptrUintptr == nil {
- x.FptrUintptr = new(uintptr)
- }
-
- if false {
- } else {
- *x.FptrUintptr = (uintptr)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize19781))
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FInt = 0
- } else {
- x.FInt = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19781))
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrInt != nil {
- x.FptrInt = nil
- }
- } else {
- if x.FptrInt == nil {
- x.FptrInt = new(int)
- }
-
- if false {
- } else {
- *x.FptrInt = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19781))
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FInt8 = 0
- } else {
- x.FInt8 = (int8)(z.C.IntV(r.DecodeInt64(), 8))
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrInt8 != nil {
- x.FptrInt8 = nil
- }
- } else {
- if x.FptrInt8 == nil {
- x.FptrInt8 = new(int8)
- }
-
- if false {
- } else {
- *x.FptrInt8 = (int8)(z.C.IntV(r.DecodeInt64(), 8))
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FInt16 = 0
- } else {
- x.FInt16 = (int16)(z.C.IntV(r.DecodeInt64(), 16))
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrInt16 != nil {
- x.FptrInt16 = nil
- }
- } else {
- if x.FptrInt16 == nil {
- x.FptrInt16 = new(int16)
- }
-
- if false {
- } else {
- *x.FptrInt16 = (int16)(z.C.IntV(r.DecodeInt64(), 16))
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FInt32 = 0
- } else {
- x.FInt32 = (int32)(z.C.IntV(r.DecodeInt64(), 32))
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrInt32 != nil {
- x.FptrInt32 = nil
- }
- } else {
- if x.FptrInt32 == nil {
- x.FptrInt32 = new(int32)
- }
-
- if false {
- } else {
- *x.FptrInt32 = (int32)(z.C.IntV(r.DecodeInt64(), 32))
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FInt64 = 0
- } else {
- x.FInt64 = (int64)(r.DecodeInt64())
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrInt64 != nil {
- x.FptrInt64 = nil
- }
- } else {
- if x.FptrInt64 == nil {
- x.FptrInt64 = new(int64)
- }
-
- if false {
- } else {
- *x.FptrInt64 = (int64)(r.DecodeInt64())
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FBool = false
- } else {
- x.FBool = (bool)(r.DecodeBool())
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrBool != nil {
- x.FptrBool = nil
- }
- } else {
- if x.FptrBool == nil {
- x.FptrBool = new(bool)
- }
-
- if false {
- } else {
- *x.FptrBool = (bool)(r.DecodeBool())
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FSliceIntf = nil
- } else {
- if false {
- } else {
- z.F.DecSliceIntfX(&x.FSliceIntf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceIntf != nil {
- x.FptrSliceIntf = nil
- }
- } else {
- if x.FptrSliceIntf == nil {
- x.FptrSliceIntf = new([]interface{})
- }
-
- if false {
- } else {
- z.F.DecSliceIntfX(x.FptrSliceIntf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FSliceString = nil
- } else {
- if false {
- } else {
- z.F.DecSliceStringX(&x.FSliceString, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceString != nil {
- x.FptrSliceString = nil
- }
- } else {
- if x.FptrSliceString == nil {
- x.FptrSliceString = new([]string)
- }
-
- if false {
- } else {
- z.F.DecSliceStringX(x.FptrSliceString, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FSliceFloat32 = nil
- } else {
- if false {
- } else {
- z.F.DecSliceFloat32X(&x.FSliceFloat32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceFloat32 != nil {
- x.FptrSliceFloat32 = nil
- }
- } else {
- if x.FptrSliceFloat32 == nil {
- x.FptrSliceFloat32 = new([]float32)
- }
-
- if false {
- } else {
- z.F.DecSliceFloat32X(x.FptrSliceFloat32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FSliceFloat64 = nil
- } else {
- if false {
- } else {
- z.F.DecSliceFloat64X(&x.FSliceFloat64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceFloat64 != nil {
- x.FptrSliceFloat64 = nil
- }
- } else {
- if x.FptrSliceFloat64 == nil {
- x.FptrSliceFloat64 = new([]float64)
- }
-
- if false {
- } else {
- z.F.DecSliceFloat64X(x.FptrSliceFloat64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FSliceUint = nil
- } else {
- if false {
- } else {
- z.F.DecSliceUintX(&x.FSliceUint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceUint != nil {
- x.FptrSliceUint = nil
- }
- } else {
- if x.FptrSliceUint == nil {
- x.FptrSliceUint = new([]uint)
- }
-
- if false {
- } else {
- z.F.DecSliceUintX(x.FptrSliceUint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FSliceUint8 = nil
- } else {
- if false {
- } else {
- x.FSliceUint8 = r.DecodeBytes(([]byte)(x.FSliceUint8), false)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceUint8 != nil {
- x.FptrSliceUint8 = nil
- }
- } else {
- if x.FptrSliceUint8 == nil {
- x.FptrSliceUint8 = new([]uint8)
- }
-
- if false {
- } else {
- *x.FptrSliceUint8 = r.DecodeBytes(*(*[]byte)(x.FptrSliceUint8), false)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FSliceUint16 = nil
- } else {
- if false {
- } else {
- z.F.DecSliceUint16X(&x.FSliceUint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceUint16 != nil {
- x.FptrSliceUint16 = nil
- }
- } else {
- if x.FptrSliceUint16 == nil {
- x.FptrSliceUint16 = new([]uint16)
- }
-
- if false {
- } else {
- z.F.DecSliceUint16X(x.FptrSliceUint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FSliceUint32 = nil
- } else {
- if false {
- } else {
- z.F.DecSliceUint32X(&x.FSliceUint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceUint32 != nil {
- x.FptrSliceUint32 = nil
- }
- } else {
- if x.FptrSliceUint32 == nil {
- x.FptrSliceUint32 = new([]uint32)
- }
-
- if false {
- } else {
- z.F.DecSliceUint32X(x.FptrSliceUint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FSliceUint64 = nil
- } else {
- if false {
- } else {
- z.F.DecSliceUint64X(&x.FSliceUint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceUint64 != nil {
- x.FptrSliceUint64 = nil
- }
- } else {
- if x.FptrSliceUint64 == nil {
- x.FptrSliceUint64 = new([]uint64)
- }
-
- if false {
- } else {
- z.F.DecSliceUint64X(x.FptrSliceUint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FSliceUintptr = nil
- } else {
- if false {
- } else {
- z.F.DecSliceUintptrX(&x.FSliceUintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceUintptr != nil {
- x.FptrSliceUintptr = nil
- }
- } else {
- if x.FptrSliceUintptr == nil {
- x.FptrSliceUintptr = new([]uintptr)
- }
-
- if false {
- } else {
- z.F.DecSliceUintptrX(x.FptrSliceUintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FSliceInt = nil
- } else {
- if false {
- } else {
- z.F.DecSliceIntX(&x.FSliceInt, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceInt != nil {
- x.FptrSliceInt = nil
- }
- } else {
- if x.FptrSliceInt == nil {
- x.FptrSliceInt = new([]int)
- }
-
- if false {
- } else {
- z.F.DecSliceIntX(x.FptrSliceInt, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FSliceInt8 = nil
- } else {
- if false {
- } else {
- z.F.DecSliceInt8X(&x.FSliceInt8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceInt8 != nil {
- x.FptrSliceInt8 = nil
- }
- } else {
- if x.FptrSliceInt8 == nil {
- x.FptrSliceInt8 = new([]int8)
- }
-
- if false {
- } else {
- z.F.DecSliceInt8X(x.FptrSliceInt8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FSliceInt16 = nil
- } else {
- if false {
- } else {
- z.F.DecSliceInt16X(&x.FSliceInt16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceInt16 != nil {
- x.FptrSliceInt16 = nil
- }
- } else {
- if x.FptrSliceInt16 == nil {
- x.FptrSliceInt16 = new([]int16)
- }
-
- if false {
- } else {
- z.F.DecSliceInt16X(x.FptrSliceInt16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FSliceInt32 = nil
- } else {
- if false {
- } else {
- z.F.DecSliceInt32X(&x.FSliceInt32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceInt32 != nil {
- x.FptrSliceInt32 = nil
- }
- } else {
- if x.FptrSliceInt32 == nil {
- x.FptrSliceInt32 = new([]int32)
- }
-
- if false {
- } else {
- z.F.DecSliceInt32X(x.FptrSliceInt32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FSliceInt64 = nil
- } else {
- if false {
- } else {
- z.F.DecSliceInt64X(&x.FSliceInt64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceInt64 != nil {
- x.FptrSliceInt64 = nil
- }
- } else {
- if x.FptrSliceInt64 == nil {
- x.FptrSliceInt64 = new([]int64)
- }
-
- if false {
- } else {
- z.F.DecSliceInt64X(x.FptrSliceInt64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FSliceBool = nil
- } else {
- if false {
- } else {
- z.F.DecSliceBoolX(&x.FSliceBool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrSliceBool != nil {
- x.FptrSliceBool = nil
- }
- } else {
- if x.FptrSliceBool == nil {
- x.FptrSliceBool = new([]bool)
- }
-
- if false {
- } else {
- z.F.DecSliceBoolX(x.FptrSliceBool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntfIntf = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfIntfX(&x.FMapIntfIntf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfIntf != nil {
- x.FptrMapIntfIntf = nil
- }
- } else {
- if x.FptrMapIntfIntf == nil {
- x.FptrMapIntfIntf = new(map[interface{}]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapIntfIntfX(x.FptrMapIntfIntf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntfString = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfStringX(&x.FMapIntfString, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfString != nil {
- x.FptrMapIntfString = nil
- }
- } else {
- if x.FptrMapIntfString == nil {
- x.FptrMapIntfString = new(map[interface{}]string)
- }
-
- if false {
- } else {
- z.F.DecMapIntfStringX(x.FptrMapIntfString, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntfUint = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfUintX(&x.FMapIntfUint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfUint != nil {
- x.FptrMapIntfUint = nil
- }
- } else {
- if x.FptrMapIntfUint == nil {
- x.FptrMapIntfUint = new(map[interface{}]uint)
- }
-
- if false {
- } else {
- z.F.DecMapIntfUintX(x.FptrMapIntfUint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntfUint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfUint8X(&x.FMapIntfUint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfUint8 != nil {
- x.FptrMapIntfUint8 = nil
- }
- } else {
- if x.FptrMapIntfUint8 == nil {
- x.FptrMapIntfUint8 = new(map[interface{}]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapIntfUint8X(x.FptrMapIntfUint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntfUint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfUint16X(&x.FMapIntfUint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfUint16 != nil {
- x.FptrMapIntfUint16 = nil
- }
- } else {
- if x.FptrMapIntfUint16 == nil {
- x.FptrMapIntfUint16 = new(map[interface{}]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapIntfUint16X(x.FptrMapIntfUint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntfUint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfUint32X(&x.FMapIntfUint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfUint32 != nil {
- x.FptrMapIntfUint32 = nil
- }
- } else {
- if x.FptrMapIntfUint32 == nil {
- x.FptrMapIntfUint32 = new(map[interface{}]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapIntfUint32X(x.FptrMapIntfUint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntfUint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfUint64X(&x.FMapIntfUint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfUint64 != nil {
- x.FptrMapIntfUint64 = nil
- }
- } else {
- if x.FptrMapIntfUint64 == nil {
- x.FptrMapIntfUint64 = new(map[interface{}]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapIntfUint64X(x.FptrMapIntfUint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntfUintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfUintptrX(&x.FMapIntfUintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfUintptr != nil {
- x.FptrMapIntfUintptr = nil
- }
- } else {
- if x.FptrMapIntfUintptr == nil {
- x.FptrMapIntfUintptr = new(map[interface{}]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapIntfUintptrX(x.FptrMapIntfUintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntfInt = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfIntX(&x.FMapIntfInt, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfInt != nil {
- x.FptrMapIntfInt = nil
- }
- } else {
- if x.FptrMapIntfInt == nil {
- x.FptrMapIntfInt = new(map[interface{}]int)
- }
-
- if false {
- } else {
- z.F.DecMapIntfIntX(x.FptrMapIntfInt, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntfInt8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfInt8X(&x.FMapIntfInt8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfInt8 != nil {
- x.FptrMapIntfInt8 = nil
- }
- } else {
- if x.FptrMapIntfInt8 == nil {
- x.FptrMapIntfInt8 = new(map[interface{}]int8)
- }
-
- if false {
- } else {
- z.F.DecMapIntfInt8X(x.FptrMapIntfInt8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntfInt16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfInt16X(&x.FMapIntfInt16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfInt16 != nil {
- x.FptrMapIntfInt16 = nil
- }
- } else {
- if x.FptrMapIntfInt16 == nil {
- x.FptrMapIntfInt16 = new(map[interface{}]int16)
- }
-
- if false {
- } else {
- z.F.DecMapIntfInt16X(x.FptrMapIntfInt16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntfInt32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfInt32X(&x.FMapIntfInt32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfInt32 != nil {
- x.FptrMapIntfInt32 = nil
- }
- } else {
- if x.FptrMapIntfInt32 == nil {
- x.FptrMapIntfInt32 = new(map[interface{}]int32)
- }
-
- if false {
- } else {
- z.F.DecMapIntfInt32X(x.FptrMapIntfInt32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntfInt64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfInt64X(&x.FMapIntfInt64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfInt64 != nil {
- x.FptrMapIntfInt64 = nil
- }
- } else {
- if x.FptrMapIntfInt64 == nil {
- x.FptrMapIntfInt64 = new(map[interface{}]int64)
- }
-
- if false {
- } else {
- z.F.DecMapIntfInt64X(x.FptrMapIntfInt64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntfFloat32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfFloat32X(&x.FMapIntfFloat32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfFloat32 != nil {
- x.FptrMapIntfFloat32 = nil
- }
- } else {
- if x.FptrMapIntfFloat32 == nil {
- x.FptrMapIntfFloat32 = new(map[interface{}]float32)
- }
-
- if false {
- } else {
- z.F.DecMapIntfFloat32X(x.FptrMapIntfFloat32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntfFloat64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfFloat64X(&x.FMapIntfFloat64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfFloat64 != nil {
- x.FptrMapIntfFloat64 = nil
- }
- } else {
- if x.FptrMapIntfFloat64 == nil {
- x.FptrMapIntfFloat64 = new(map[interface{}]float64)
- }
-
- if false {
- } else {
- z.F.DecMapIntfFloat64X(x.FptrMapIntfFloat64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntfBool = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntfBoolX(&x.FMapIntfBool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntfBool != nil {
- x.FptrMapIntfBool = nil
- }
- } else {
- if x.FptrMapIntfBool == nil {
- x.FptrMapIntfBool = new(map[interface{}]bool)
- }
-
- if false {
- } else {
- z.F.DecMapIntfBoolX(x.FptrMapIntfBool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapStringIntf = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringIntfX(&x.FMapStringIntf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringIntf != nil {
- x.FptrMapStringIntf = nil
- }
- } else {
- if x.FptrMapStringIntf == nil {
- x.FptrMapStringIntf = new(map[string]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapStringIntfX(x.FptrMapStringIntf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapStringString = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringStringX(&x.FMapStringString, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringString != nil {
- x.FptrMapStringString = nil
- }
- } else {
- if x.FptrMapStringString == nil {
- x.FptrMapStringString = new(map[string]string)
- }
-
- if false {
- } else {
- z.F.DecMapStringStringX(x.FptrMapStringString, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapStringUint = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringUintX(&x.FMapStringUint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringUint != nil {
- x.FptrMapStringUint = nil
- }
- } else {
- if x.FptrMapStringUint == nil {
- x.FptrMapStringUint = new(map[string]uint)
- }
-
- if false {
- } else {
- z.F.DecMapStringUintX(x.FptrMapStringUint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapStringUint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringUint8X(&x.FMapStringUint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringUint8 != nil {
- x.FptrMapStringUint8 = nil
- }
- } else {
- if x.FptrMapStringUint8 == nil {
- x.FptrMapStringUint8 = new(map[string]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapStringUint8X(x.FptrMapStringUint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapStringUint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringUint16X(&x.FMapStringUint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringUint16 != nil {
- x.FptrMapStringUint16 = nil
- }
- } else {
- if x.FptrMapStringUint16 == nil {
- x.FptrMapStringUint16 = new(map[string]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapStringUint16X(x.FptrMapStringUint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapStringUint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringUint32X(&x.FMapStringUint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringUint32 != nil {
- x.FptrMapStringUint32 = nil
- }
- } else {
- if x.FptrMapStringUint32 == nil {
- x.FptrMapStringUint32 = new(map[string]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapStringUint32X(x.FptrMapStringUint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapStringUint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringUint64X(&x.FMapStringUint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringUint64 != nil {
- x.FptrMapStringUint64 = nil
- }
- } else {
- if x.FptrMapStringUint64 == nil {
- x.FptrMapStringUint64 = new(map[string]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapStringUint64X(x.FptrMapStringUint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapStringUintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringUintptrX(&x.FMapStringUintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringUintptr != nil {
- x.FptrMapStringUintptr = nil
- }
- } else {
- if x.FptrMapStringUintptr == nil {
- x.FptrMapStringUintptr = new(map[string]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapStringUintptrX(x.FptrMapStringUintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapStringInt = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringIntX(&x.FMapStringInt, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringInt != nil {
- x.FptrMapStringInt = nil
- }
- } else {
- if x.FptrMapStringInt == nil {
- x.FptrMapStringInt = new(map[string]int)
- }
-
- if false {
- } else {
- z.F.DecMapStringIntX(x.FptrMapStringInt, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapStringInt8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringInt8X(&x.FMapStringInt8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringInt8 != nil {
- x.FptrMapStringInt8 = nil
- }
- } else {
- if x.FptrMapStringInt8 == nil {
- x.FptrMapStringInt8 = new(map[string]int8)
- }
-
- if false {
- } else {
- z.F.DecMapStringInt8X(x.FptrMapStringInt8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapStringInt16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringInt16X(&x.FMapStringInt16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringInt16 != nil {
- x.FptrMapStringInt16 = nil
- }
- } else {
- if x.FptrMapStringInt16 == nil {
- x.FptrMapStringInt16 = new(map[string]int16)
- }
-
- if false {
- } else {
- z.F.DecMapStringInt16X(x.FptrMapStringInt16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapStringInt32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringInt32X(&x.FMapStringInt32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringInt32 != nil {
- x.FptrMapStringInt32 = nil
- }
- } else {
- if x.FptrMapStringInt32 == nil {
- x.FptrMapStringInt32 = new(map[string]int32)
- }
-
- if false {
- } else {
- z.F.DecMapStringInt32X(x.FptrMapStringInt32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapStringInt64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringInt64X(&x.FMapStringInt64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringInt64 != nil {
- x.FptrMapStringInt64 = nil
- }
- } else {
- if x.FptrMapStringInt64 == nil {
- x.FptrMapStringInt64 = new(map[string]int64)
- }
-
- if false {
- } else {
- z.F.DecMapStringInt64X(x.FptrMapStringInt64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapStringFloat32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringFloat32X(&x.FMapStringFloat32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringFloat32 != nil {
- x.FptrMapStringFloat32 = nil
- }
- } else {
- if x.FptrMapStringFloat32 == nil {
- x.FptrMapStringFloat32 = new(map[string]float32)
- }
-
- if false {
- } else {
- z.F.DecMapStringFloat32X(x.FptrMapStringFloat32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapStringFloat64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringFloat64X(&x.FMapStringFloat64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringFloat64 != nil {
- x.FptrMapStringFloat64 = nil
- }
- } else {
- if x.FptrMapStringFloat64 == nil {
- x.FptrMapStringFloat64 = new(map[string]float64)
- }
-
- if false {
- } else {
- z.F.DecMapStringFloat64X(x.FptrMapStringFloat64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapStringBool = nil
- } else {
- if false {
- } else {
- z.F.DecMapStringBoolX(&x.FMapStringBool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapStringBool != nil {
- x.FptrMapStringBool = nil
- }
- } else {
- if x.FptrMapStringBool == nil {
- x.FptrMapStringBool = new(map[string]bool)
- }
-
- if false {
- } else {
- z.F.DecMapStringBoolX(x.FptrMapStringBool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat32Intf = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32IntfX(&x.FMapFloat32Intf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Intf != nil {
- x.FptrMapFloat32Intf = nil
- }
- } else {
- if x.FptrMapFloat32Intf == nil {
- x.FptrMapFloat32Intf = new(map[float32]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapFloat32IntfX(x.FptrMapFloat32Intf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat32String = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32StringX(&x.FMapFloat32String, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32String != nil {
- x.FptrMapFloat32String = nil
- }
- } else {
- if x.FptrMapFloat32String == nil {
- x.FptrMapFloat32String = new(map[float32]string)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32StringX(x.FptrMapFloat32String, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat32Uint = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32UintX(&x.FMapFloat32Uint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Uint != nil {
- x.FptrMapFloat32Uint = nil
- }
- } else {
- if x.FptrMapFloat32Uint == nil {
- x.FptrMapFloat32Uint = new(map[float32]uint)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32UintX(x.FptrMapFloat32Uint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat32Uint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32Uint8X(&x.FMapFloat32Uint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Uint8 != nil {
- x.FptrMapFloat32Uint8 = nil
- }
- } else {
- if x.FptrMapFloat32Uint8 == nil {
- x.FptrMapFloat32Uint8 = new(map[float32]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32Uint8X(x.FptrMapFloat32Uint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat32Uint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32Uint16X(&x.FMapFloat32Uint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Uint16 != nil {
- x.FptrMapFloat32Uint16 = nil
- }
- } else {
- if x.FptrMapFloat32Uint16 == nil {
- x.FptrMapFloat32Uint16 = new(map[float32]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32Uint16X(x.FptrMapFloat32Uint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat32Uint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32Uint32X(&x.FMapFloat32Uint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Uint32 != nil {
- x.FptrMapFloat32Uint32 = nil
- }
- } else {
- if x.FptrMapFloat32Uint32 == nil {
- x.FptrMapFloat32Uint32 = new(map[float32]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32Uint32X(x.FptrMapFloat32Uint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat32Uint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32Uint64X(&x.FMapFloat32Uint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Uint64 != nil {
- x.FptrMapFloat32Uint64 = nil
- }
- } else {
- if x.FptrMapFloat32Uint64 == nil {
- x.FptrMapFloat32Uint64 = new(map[float32]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32Uint64X(x.FptrMapFloat32Uint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat32Uintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32UintptrX(&x.FMapFloat32Uintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Uintptr != nil {
- x.FptrMapFloat32Uintptr = nil
- }
- } else {
- if x.FptrMapFloat32Uintptr == nil {
- x.FptrMapFloat32Uintptr = new(map[float32]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32UintptrX(x.FptrMapFloat32Uintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat32Int = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32IntX(&x.FMapFloat32Int, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Int != nil {
- x.FptrMapFloat32Int = nil
- }
- } else {
- if x.FptrMapFloat32Int == nil {
- x.FptrMapFloat32Int = new(map[float32]int)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32IntX(x.FptrMapFloat32Int, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat32Int8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32Int8X(&x.FMapFloat32Int8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Int8 != nil {
- x.FptrMapFloat32Int8 = nil
- }
- } else {
- if x.FptrMapFloat32Int8 == nil {
- x.FptrMapFloat32Int8 = new(map[float32]int8)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32Int8X(x.FptrMapFloat32Int8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat32Int16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32Int16X(&x.FMapFloat32Int16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Int16 != nil {
- x.FptrMapFloat32Int16 = nil
- }
- } else {
- if x.FptrMapFloat32Int16 == nil {
- x.FptrMapFloat32Int16 = new(map[float32]int16)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32Int16X(x.FptrMapFloat32Int16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat32Int32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32Int32X(&x.FMapFloat32Int32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Int32 != nil {
- x.FptrMapFloat32Int32 = nil
- }
- } else {
- if x.FptrMapFloat32Int32 == nil {
- x.FptrMapFloat32Int32 = new(map[float32]int32)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32Int32X(x.FptrMapFloat32Int32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat32Int64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32Int64X(&x.FMapFloat32Int64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Int64 != nil {
- x.FptrMapFloat32Int64 = nil
- }
- } else {
- if x.FptrMapFloat32Int64 == nil {
- x.FptrMapFloat32Int64 = new(map[float32]int64)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32Int64X(x.FptrMapFloat32Int64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat32Float32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32Float32X(&x.FMapFloat32Float32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Float32 != nil {
- x.FptrMapFloat32Float32 = nil
- }
- } else {
- if x.FptrMapFloat32Float32 == nil {
- x.FptrMapFloat32Float32 = new(map[float32]float32)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32Float32X(x.FptrMapFloat32Float32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat32Float64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32Float64X(&x.FMapFloat32Float64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Float64 != nil {
- x.FptrMapFloat32Float64 = nil
- }
- } else {
- if x.FptrMapFloat32Float64 == nil {
- x.FptrMapFloat32Float64 = new(map[float32]float64)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32Float64X(x.FptrMapFloat32Float64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat32Bool = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat32BoolX(&x.FMapFloat32Bool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat32Bool != nil {
- x.FptrMapFloat32Bool = nil
- }
- } else {
- if x.FptrMapFloat32Bool == nil {
- x.FptrMapFloat32Bool = new(map[float32]bool)
- }
-
- if false {
- } else {
- z.F.DecMapFloat32BoolX(x.FptrMapFloat32Bool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat64Intf = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64IntfX(&x.FMapFloat64Intf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Intf != nil {
- x.FptrMapFloat64Intf = nil
- }
- } else {
- if x.FptrMapFloat64Intf == nil {
- x.FptrMapFloat64Intf = new(map[float64]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapFloat64IntfX(x.FptrMapFloat64Intf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat64String = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64StringX(&x.FMapFloat64String, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64String != nil {
- x.FptrMapFloat64String = nil
- }
- } else {
- if x.FptrMapFloat64String == nil {
- x.FptrMapFloat64String = new(map[float64]string)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64StringX(x.FptrMapFloat64String, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat64Uint = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64UintX(&x.FMapFloat64Uint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Uint != nil {
- x.FptrMapFloat64Uint = nil
- }
- } else {
- if x.FptrMapFloat64Uint == nil {
- x.FptrMapFloat64Uint = new(map[float64]uint)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64UintX(x.FptrMapFloat64Uint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat64Uint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64Uint8X(&x.FMapFloat64Uint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Uint8 != nil {
- x.FptrMapFloat64Uint8 = nil
- }
- } else {
- if x.FptrMapFloat64Uint8 == nil {
- x.FptrMapFloat64Uint8 = new(map[float64]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64Uint8X(x.FptrMapFloat64Uint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat64Uint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64Uint16X(&x.FMapFloat64Uint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Uint16 != nil {
- x.FptrMapFloat64Uint16 = nil
- }
- } else {
- if x.FptrMapFloat64Uint16 == nil {
- x.FptrMapFloat64Uint16 = new(map[float64]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64Uint16X(x.FptrMapFloat64Uint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat64Uint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64Uint32X(&x.FMapFloat64Uint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Uint32 != nil {
- x.FptrMapFloat64Uint32 = nil
- }
- } else {
- if x.FptrMapFloat64Uint32 == nil {
- x.FptrMapFloat64Uint32 = new(map[float64]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64Uint32X(x.FptrMapFloat64Uint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat64Uint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64Uint64X(&x.FMapFloat64Uint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Uint64 != nil {
- x.FptrMapFloat64Uint64 = nil
- }
- } else {
- if x.FptrMapFloat64Uint64 == nil {
- x.FptrMapFloat64Uint64 = new(map[float64]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64Uint64X(x.FptrMapFloat64Uint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat64Uintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64UintptrX(&x.FMapFloat64Uintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Uintptr != nil {
- x.FptrMapFloat64Uintptr = nil
- }
- } else {
- if x.FptrMapFloat64Uintptr == nil {
- x.FptrMapFloat64Uintptr = new(map[float64]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64UintptrX(x.FptrMapFloat64Uintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat64Int = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64IntX(&x.FMapFloat64Int, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Int != nil {
- x.FptrMapFloat64Int = nil
- }
- } else {
- if x.FptrMapFloat64Int == nil {
- x.FptrMapFloat64Int = new(map[float64]int)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64IntX(x.FptrMapFloat64Int, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat64Int8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64Int8X(&x.FMapFloat64Int8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Int8 != nil {
- x.FptrMapFloat64Int8 = nil
- }
- } else {
- if x.FptrMapFloat64Int8 == nil {
- x.FptrMapFloat64Int8 = new(map[float64]int8)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64Int8X(x.FptrMapFloat64Int8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat64Int16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64Int16X(&x.FMapFloat64Int16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Int16 != nil {
- x.FptrMapFloat64Int16 = nil
- }
- } else {
- if x.FptrMapFloat64Int16 == nil {
- x.FptrMapFloat64Int16 = new(map[float64]int16)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64Int16X(x.FptrMapFloat64Int16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat64Int32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64Int32X(&x.FMapFloat64Int32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Int32 != nil {
- x.FptrMapFloat64Int32 = nil
- }
- } else {
- if x.FptrMapFloat64Int32 == nil {
- x.FptrMapFloat64Int32 = new(map[float64]int32)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64Int32X(x.FptrMapFloat64Int32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat64Int64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64Int64X(&x.FMapFloat64Int64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Int64 != nil {
- x.FptrMapFloat64Int64 = nil
- }
- } else {
- if x.FptrMapFloat64Int64 == nil {
- x.FptrMapFloat64Int64 = new(map[float64]int64)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64Int64X(x.FptrMapFloat64Int64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat64Float32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64Float32X(&x.FMapFloat64Float32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Float32 != nil {
- x.FptrMapFloat64Float32 = nil
- }
- } else {
- if x.FptrMapFloat64Float32 == nil {
- x.FptrMapFloat64Float32 = new(map[float64]float32)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64Float32X(x.FptrMapFloat64Float32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat64Float64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64Float64X(&x.FMapFloat64Float64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Float64 != nil {
- x.FptrMapFloat64Float64 = nil
- }
- } else {
- if x.FptrMapFloat64Float64 == nil {
- x.FptrMapFloat64Float64 = new(map[float64]float64)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64Float64X(x.FptrMapFloat64Float64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapFloat64Bool = nil
- } else {
- if false {
- } else {
- z.F.DecMapFloat64BoolX(&x.FMapFloat64Bool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapFloat64Bool != nil {
- x.FptrMapFloat64Bool = nil
- }
- } else {
- if x.FptrMapFloat64Bool == nil {
- x.FptrMapFloat64Bool = new(map[float64]bool)
- }
-
- if false {
- } else {
- z.F.DecMapFloat64BoolX(x.FptrMapFloat64Bool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintIntf = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintIntfX(&x.FMapUintIntf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintIntf != nil {
- x.FptrMapUintIntf = nil
- }
- } else {
- if x.FptrMapUintIntf == nil {
- x.FptrMapUintIntf = new(map[uint]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapUintIntfX(x.FptrMapUintIntf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintString = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintStringX(&x.FMapUintString, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintString != nil {
- x.FptrMapUintString = nil
- }
- } else {
- if x.FptrMapUintString == nil {
- x.FptrMapUintString = new(map[uint]string)
- }
-
- if false {
- } else {
- z.F.DecMapUintStringX(x.FptrMapUintString, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintUint = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintUintX(&x.FMapUintUint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintUint != nil {
- x.FptrMapUintUint = nil
- }
- } else {
- if x.FptrMapUintUint == nil {
- x.FptrMapUintUint = new(map[uint]uint)
- }
-
- if false {
- } else {
- z.F.DecMapUintUintX(x.FptrMapUintUint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintUint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintUint8X(&x.FMapUintUint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintUint8 != nil {
- x.FptrMapUintUint8 = nil
- }
- } else {
- if x.FptrMapUintUint8 == nil {
- x.FptrMapUintUint8 = new(map[uint]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapUintUint8X(x.FptrMapUintUint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintUint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintUint16X(&x.FMapUintUint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintUint16 != nil {
- x.FptrMapUintUint16 = nil
- }
- } else {
- if x.FptrMapUintUint16 == nil {
- x.FptrMapUintUint16 = new(map[uint]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapUintUint16X(x.FptrMapUintUint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintUint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintUint32X(&x.FMapUintUint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintUint32 != nil {
- x.FptrMapUintUint32 = nil
- }
- } else {
- if x.FptrMapUintUint32 == nil {
- x.FptrMapUintUint32 = new(map[uint]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapUintUint32X(x.FptrMapUintUint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintUint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintUint64X(&x.FMapUintUint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintUint64 != nil {
- x.FptrMapUintUint64 = nil
- }
- } else {
- if x.FptrMapUintUint64 == nil {
- x.FptrMapUintUint64 = new(map[uint]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapUintUint64X(x.FptrMapUintUint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintUintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintUintptrX(&x.FMapUintUintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintUintptr != nil {
- x.FptrMapUintUintptr = nil
- }
- } else {
- if x.FptrMapUintUintptr == nil {
- x.FptrMapUintUintptr = new(map[uint]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapUintUintptrX(x.FptrMapUintUintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintInt = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintIntX(&x.FMapUintInt, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintInt != nil {
- x.FptrMapUintInt = nil
- }
- } else {
- if x.FptrMapUintInt == nil {
- x.FptrMapUintInt = new(map[uint]int)
- }
-
- if false {
- } else {
- z.F.DecMapUintIntX(x.FptrMapUintInt, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintInt8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintInt8X(&x.FMapUintInt8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintInt8 != nil {
- x.FptrMapUintInt8 = nil
- }
- } else {
- if x.FptrMapUintInt8 == nil {
- x.FptrMapUintInt8 = new(map[uint]int8)
- }
-
- if false {
- } else {
- z.F.DecMapUintInt8X(x.FptrMapUintInt8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintInt16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintInt16X(&x.FMapUintInt16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintInt16 != nil {
- x.FptrMapUintInt16 = nil
- }
- } else {
- if x.FptrMapUintInt16 == nil {
- x.FptrMapUintInt16 = new(map[uint]int16)
- }
-
- if false {
- } else {
- z.F.DecMapUintInt16X(x.FptrMapUintInt16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintInt32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintInt32X(&x.FMapUintInt32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintInt32 != nil {
- x.FptrMapUintInt32 = nil
- }
- } else {
- if x.FptrMapUintInt32 == nil {
- x.FptrMapUintInt32 = new(map[uint]int32)
- }
-
- if false {
- } else {
- z.F.DecMapUintInt32X(x.FptrMapUintInt32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintInt64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintInt64X(&x.FMapUintInt64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintInt64 != nil {
- x.FptrMapUintInt64 = nil
- }
- } else {
- if x.FptrMapUintInt64 == nil {
- x.FptrMapUintInt64 = new(map[uint]int64)
- }
-
- if false {
- } else {
- z.F.DecMapUintInt64X(x.FptrMapUintInt64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintFloat32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintFloat32X(&x.FMapUintFloat32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintFloat32 != nil {
- x.FptrMapUintFloat32 = nil
- }
- } else {
- if x.FptrMapUintFloat32 == nil {
- x.FptrMapUintFloat32 = new(map[uint]float32)
- }
-
- if false {
- } else {
- z.F.DecMapUintFloat32X(x.FptrMapUintFloat32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintFloat64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintFloat64X(&x.FMapUintFloat64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintFloat64 != nil {
- x.FptrMapUintFloat64 = nil
- }
- } else {
- if x.FptrMapUintFloat64 == nil {
- x.FptrMapUintFloat64 = new(map[uint]float64)
- }
-
- if false {
- } else {
- z.F.DecMapUintFloat64X(x.FptrMapUintFloat64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintBool = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintBoolX(&x.FMapUintBool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintBool != nil {
- x.FptrMapUintBool = nil
- }
- } else {
- if x.FptrMapUintBool == nil {
- x.FptrMapUintBool = new(map[uint]bool)
- }
-
- if false {
- } else {
- z.F.DecMapUintBoolX(x.FptrMapUintBool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint8Intf = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8IntfX(&x.FMapUint8Intf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Intf != nil {
- x.FptrMapUint8Intf = nil
- }
- } else {
- if x.FptrMapUint8Intf == nil {
- x.FptrMapUint8Intf = new(map[uint8]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapUint8IntfX(x.FptrMapUint8Intf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint8String = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8StringX(&x.FMapUint8String, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8String != nil {
- x.FptrMapUint8String = nil
- }
- } else {
- if x.FptrMapUint8String == nil {
- x.FptrMapUint8String = new(map[uint8]string)
- }
-
- if false {
- } else {
- z.F.DecMapUint8StringX(x.FptrMapUint8String, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint8Uint = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8UintX(&x.FMapUint8Uint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Uint != nil {
- x.FptrMapUint8Uint = nil
- }
- } else {
- if x.FptrMapUint8Uint == nil {
- x.FptrMapUint8Uint = new(map[uint8]uint)
- }
-
- if false {
- } else {
- z.F.DecMapUint8UintX(x.FptrMapUint8Uint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint8Uint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8Uint8X(&x.FMapUint8Uint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Uint8 != nil {
- x.FptrMapUint8Uint8 = nil
- }
- } else {
- if x.FptrMapUint8Uint8 == nil {
- x.FptrMapUint8Uint8 = new(map[uint8]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapUint8Uint8X(x.FptrMapUint8Uint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint8Uint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8Uint16X(&x.FMapUint8Uint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Uint16 != nil {
- x.FptrMapUint8Uint16 = nil
- }
- } else {
- if x.FptrMapUint8Uint16 == nil {
- x.FptrMapUint8Uint16 = new(map[uint8]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapUint8Uint16X(x.FptrMapUint8Uint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint8Uint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8Uint32X(&x.FMapUint8Uint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Uint32 != nil {
- x.FptrMapUint8Uint32 = nil
- }
- } else {
- if x.FptrMapUint8Uint32 == nil {
- x.FptrMapUint8Uint32 = new(map[uint8]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapUint8Uint32X(x.FptrMapUint8Uint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint8Uint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8Uint64X(&x.FMapUint8Uint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Uint64 != nil {
- x.FptrMapUint8Uint64 = nil
- }
- } else {
- if x.FptrMapUint8Uint64 == nil {
- x.FptrMapUint8Uint64 = new(map[uint8]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapUint8Uint64X(x.FptrMapUint8Uint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint8Uintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8UintptrX(&x.FMapUint8Uintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Uintptr != nil {
- x.FptrMapUint8Uintptr = nil
- }
- } else {
- if x.FptrMapUint8Uintptr == nil {
- x.FptrMapUint8Uintptr = new(map[uint8]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapUint8UintptrX(x.FptrMapUint8Uintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint8Int = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8IntX(&x.FMapUint8Int, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Int != nil {
- x.FptrMapUint8Int = nil
- }
- } else {
- if x.FptrMapUint8Int == nil {
- x.FptrMapUint8Int = new(map[uint8]int)
- }
-
- if false {
- } else {
- z.F.DecMapUint8IntX(x.FptrMapUint8Int, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint8Int8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8Int8X(&x.FMapUint8Int8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Int8 != nil {
- x.FptrMapUint8Int8 = nil
- }
- } else {
- if x.FptrMapUint8Int8 == nil {
- x.FptrMapUint8Int8 = new(map[uint8]int8)
- }
-
- if false {
- } else {
- z.F.DecMapUint8Int8X(x.FptrMapUint8Int8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint8Int16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8Int16X(&x.FMapUint8Int16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Int16 != nil {
- x.FptrMapUint8Int16 = nil
- }
- } else {
- if x.FptrMapUint8Int16 == nil {
- x.FptrMapUint8Int16 = new(map[uint8]int16)
- }
-
- if false {
- } else {
- z.F.DecMapUint8Int16X(x.FptrMapUint8Int16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint8Int32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8Int32X(&x.FMapUint8Int32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Int32 != nil {
- x.FptrMapUint8Int32 = nil
- }
- } else {
- if x.FptrMapUint8Int32 == nil {
- x.FptrMapUint8Int32 = new(map[uint8]int32)
- }
-
- if false {
- } else {
- z.F.DecMapUint8Int32X(x.FptrMapUint8Int32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint8Int64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8Int64X(&x.FMapUint8Int64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Int64 != nil {
- x.FptrMapUint8Int64 = nil
- }
- } else {
- if x.FptrMapUint8Int64 == nil {
- x.FptrMapUint8Int64 = new(map[uint8]int64)
- }
-
- if false {
- } else {
- z.F.DecMapUint8Int64X(x.FptrMapUint8Int64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint8Float32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8Float32X(&x.FMapUint8Float32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Float32 != nil {
- x.FptrMapUint8Float32 = nil
- }
- } else {
- if x.FptrMapUint8Float32 == nil {
- x.FptrMapUint8Float32 = new(map[uint8]float32)
- }
-
- if false {
- } else {
- z.F.DecMapUint8Float32X(x.FptrMapUint8Float32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint8Float64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8Float64X(&x.FMapUint8Float64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Float64 != nil {
- x.FptrMapUint8Float64 = nil
- }
- } else {
- if x.FptrMapUint8Float64 == nil {
- x.FptrMapUint8Float64 = new(map[uint8]float64)
- }
-
- if false {
- } else {
- z.F.DecMapUint8Float64X(x.FptrMapUint8Float64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint8Bool = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint8BoolX(&x.FMapUint8Bool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint8Bool != nil {
- x.FptrMapUint8Bool = nil
- }
- } else {
- if x.FptrMapUint8Bool == nil {
- x.FptrMapUint8Bool = new(map[uint8]bool)
- }
-
- if false {
- } else {
- z.F.DecMapUint8BoolX(x.FptrMapUint8Bool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint16Intf = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16IntfX(&x.FMapUint16Intf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Intf != nil {
- x.FptrMapUint16Intf = nil
- }
- } else {
- if x.FptrMapUint16Intf == nil {
- x.FptrMapUint16Intf = new(map[uint16]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapUint16IntfX(x.FptrMapUint16Intf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint16String = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16StringX(&x.FMapUint16String, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16String != nil {
- x.FptrMapUint16String = nil
- }
- } else {
- if x.FptrMapUint16String == nil {
- x.FptrMapUint16String = new(map[uint16]string)
- }
-
- if false {
- } else {
- z.F.DecMapUint16StringX(x.FptrMapUint16String, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint16Uint = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16UintX(&x.FMapUint16Uint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Uint != nil {
- x.FptrMapUint16Uint = nil
- }
- } else {
- if x.FptrMapUint16Uint == nil {
- x.FptrMapUint16Uint = new(map[uint16]uint)
- }
-
- if false {
- } else {
- z.F.DecMapUint16UintX(x.FptrMapUint16Uint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint16Uint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16Uint8X(&x.FMapUint16Uint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Uint8 != nil {
- x.FptrMapUint16Uint8 = nil
- }
- } else {
- if x.FptrMapUint16Uint8 == nil {
- x.FptrMapUint16Uint8 = new(map[uint16]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapUint16Uint8X(x.FptrMapUint16Uint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint16Uint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16Uint16X(&x.FMapUint16Uint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Uint16 != nil {
- x.FptrMapUint16Uint16 = nil
- }
- } else {
- if x.FptrMapUint16Uint16 == nil {
- x.FptrMapUint16Uint16 = new(map[uint16]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapUint16Uint16X(x.FptrMapUint16Uint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint16Uint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16Uint32X(&x.FMapUint16Uint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Uint32 != nil {
- x.FptrMapUint16Uint32 = nil
- }
- } else {
- if x.FptrMapUint16Uint32 == nil {
- x.FptrMapUint16Uint32 = new(map[uint16]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapUint16Uint32X(x.FptrMapUint16Uint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint16Uint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16Uint64X(&x.FMapUint16Uint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Uint64 != nil {
- x.FptrMapUint16Uint64 = nil
- }
- } else {
- if x.FptrMapUint16Uint64 == nil {
- x.FptrMapUint16Uint64 = new(map[uint16]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapUint16Uint64X(x.FptrMapUint16Uint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint16Uintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16UintptrX(&x.FMapUint16Uintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Uintptr != nil {
- x.FptrMapUint16Uintptr = nil
- }
- } else {
- if x.FptrMapUint16Uintptr == nil {
- x.FptrMapUint16Uintptr = new(map[uint16]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapUint16UintptrX(x.FptrMapUint16Uintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint16Int = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16IntX(&x.FMapUint16Int, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Int != nil {
- x.FptrMapUint16Int = nil
- }
- } else {
- if x.FptrMapUint16Int == nil {
- x.FptrMapUint16Int = new(map[uint16]int)
- }
-
- if false {
- } else {
- z.F.DecMapUint16IntX(x.FptrMapUint16Int, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint16Int8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16Int8X(&x.FMapUint16Int8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Int8 != nil {
- x.FptrMapUint16Int8 = nil
- }
- } else {
- if x.FptrMapUint16Int8 == nil {
- x.FptrMapUint16Int8 = new(map[uint16]int8)
- }
-
- if false {
- } else {
- z.F.DecMapUint16Int8X(x.FptrMapUint16Int8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint16Int16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16Int16X(&x.FMapUint16Int16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Int16 != nil {
- x.FptrMapUint16Int16 = nil
- }
- } else {
- if x.FptrMapUint16Int16 == nil {
- x.FptrMapUint16Int16 = new(map[uint16]int16)
- }
-
- if false {
- } else {
- z.F.DecMapUint16Int16X(x.FptrMapUint16Int16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint16Int32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16Int32X(&x.FMapUint16Int32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Int32 != nil {
- x.FptrMapUint16Int32 = nil
- }
- } else {
- if x.FptrMapUint16Int32 == nil {
- x.FptrMapUint16Int32 = new(map[uint16]int32)
- }
-
- if false {
- } else {
- z.F.DecMapUint16Int32X(x.FptrMapUint16Int32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint16Int64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16Int64X(&x.FMapUint16Int64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Int64 != nil {
- x.FptrMapUint16Int64 = nil
- }
- } else {
- if x.FptrMapUint16Int64 == nil {
- x.FptrMapUint16Int64 = new(map[uint16]int64)
- }
-
- if false {
- } else {
- z.F.DecMapUint16Int64X(x.FptrMapUint16Int64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint16Float32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16Float32X(&x.FMapUint16Float32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Float32 != nil {
- x.FptrMapUint16Float32 = nil
- }
- } else {
- if x.FptrMapUint16Float32 == nil {
- x.FptrMapUint16Float32 = new(map[uint16]float32)
- }
-
- if false {
- } else {
- z.F.DecMapUint16Float32X(x.FptrMapUint16Float32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint16Float64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16Float64X(&x.FMapUint16Float64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Float64 != nil {
- x.FptrMapUint16Float64 = nil
- }
- } else {
- if x.FptrMapUint16Float64 == nil {
- x.FptrMapUint16Float64 = new(map[uint16]float64)
- }
-
- if false {
- } else {
- z.F.DecMapUint16Float64X(x.FptrMapUint16Float64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint16Bool = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint16BoolX(&x.FMapUint16Bool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint16Bool != nil {
- x.FptrMapUint16Bool = nil
- }
- } else {
- if x.FptrMapUint16Bool == nil {
- x.FptrMapUint16Bool = new(map[uint16]bool)
- }
-
- if false {
- } else {
- z.F.DecMapUint16BoolX(x.FptrMapUint16Bool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint32Intf = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32IntfX(&x.FMapUint32Intf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Intf != nil {
- x.FptrMapUint32Intf = nil
- }
- } else {
- if x.FptrMapUint32Intf == nil {
- x.FptrMapUint32Intf = new(map[uint32]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapUint32IntfX(x.FptrMapUint32Intf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint32String = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32StringX(&x.FMapUint32String, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32String != nil {
- x.FptrMapUint32String = nil
- }
- } else {
- if x.FptrMapUint32String == nil {
- x.FptrMapUint32String = new(map[uint32]string)
- }
-
- if false {
- } else {
- z.F.DecMapUint32StringX(x.FptrMapUint32String, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint32Uint = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32UintX(&x.FMapUint32Uint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Uint != nil {
- x.FptrMapUint32Uint = nil
- }
- } else {
- if x.FptrMapUint32Uint == nil {
- x.FptrMapUint32Uint = new(map[uint32]uint)
- }
-
- if false {
- } else {
- z.F.DecMapUint32UintX(x.FptrMapUint32Uint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint32Uint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32Uint8X(&x.FMapUint32Uint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Uint8 != nil {
- x.FptrMapUint32Uint8 = nil
- }
- } else {
- if x.FptrMapUint32Uint8 == nil {
- x.FptrMapUint32Uint8 = new(map[uint32]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapUint32Uint8X(x.FptrMapUint32Uint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint32Uint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32Uint16X(&x.FMapUint32Uint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Uint16 != nil {
- x.FptrMapUint32Uint16 = nil
- }
- } else {
- if x.FptrMapUint32Uint16 == nil {
- x.FptrMapUint32Uint16 = new(map[uint32]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapUint32Uint16X(x.FptrMapUint32Uint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint32Uint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32Uint32X(&x.FMapUint32Uint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Uint32 != nil {
- x.FptrMapUint32Uint32 = nil
- }
- } else {
- if x.FptrMapUint32Uint32 == nil {
- x.FptrMapUint32Uint32 = new(map[uint32]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapUint32Uint32X(x.FptrMapUint32Uint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint32Uint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32Uint64X(&x.FMapUint32Uint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Uint64 != nil {
- x.FptrMapUint32Uint64 = nil
- }
- } else {
- if x.FptrMapUint32Uint64 == nil {
- x.FptrMapUint32Uint64 = new(map[uint32]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapUint32Uint64X(x.FptrMapUint32Uint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint32Uintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32UintptrX(&x.FMapUint32Uintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Uintptr != nil {
- x.FptrMapUint32Uintptr = nil
- }
- } else {
- if x.FptrMapUint32Uintptr == nil {
- x.FptrMapUint32Uintptr = new(map[uint32]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapUint32UintptrX(x.FptrMapUint32Uintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint32Int = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32IntX(&x.FMapUint32Int, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Int != nil {
- x.FptrMapUint32Int = nil
- }
- } else {
- if x.FptrMapUint32Int == nil {
- x.FptrMapUint32Int = new(map[uint32]int)
- }
-
- if false {
- } else {
- z.F.DecMapUint32IntX(x.FptrMapUint32Int, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint32Int8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32Int8X(&x.FMapUint32Int8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Int8 != nil {
- x.FptrMapUint32Int8 = nil
- }
- } else {
- if x.FptrMapUint32Int8 == nil {
- x.FptrMapUint32Int8 = new(map[uint32]int8)
- }
-
- if false {
- } else {
- z.F.DecMapUint32Int8X(x.FptrMapUint32Int8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint32Int16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32Int16X(&x.FMapUint32Int16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Int16 != nil {
- x.FptrMapUint32Int16 = nil
- }
- } else {
- if x.FptrMapUint32Int16 == nil {
- x.FptrMapUint32Int16 = new(map[uint32]int16)
- }
-
- if false {
- } else {
- z.F.DecMapUint32Int16X(x.FptrMapUint32Int16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint32Int32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32Int32X(&x.FMapUint32Int32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Int32 != nil {
- x.FptrMapUint32Int32 = nil
- }
- } else {
- if x.FptrMapUint32Int32 == nil {
- x.FptrMapUint32Int32 = new(map[uint32]int32)
- }
-
- if false {
- } else {
- z.F.DecMapUint32Int32X(x.FptrMapUint32Int32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint32Int64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32Int64X(&x.FMapUint32Int64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Int64 != nil {
- x.FptrMapUint32Int64 = nil
- }
- } else {
- if x.FptrMapUint32Int64 == nil {
- x.FptrMapUint32Int64 = new(map[uint32]int64)
- }
-
- if false {
- } else {
- z.F.DecMapUint32Int64X(x.FptrMapUint32Int64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint32Float32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32Float32X(&x.FMapUint32Float32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Float32 != nil {
- x.FptrMapUint32Float32 = nil
- }
- } else {
- if x.FptrMapUint32Float32 == nil {
- x.FptrMapUint32Float32 = new(map[uint32]float32)
- }
-
- if false {
- } else {
- z.F.DecMapUint32Float32X(x.FptrMapUint32Float32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint32Float64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32Float64X(&x.FMapUint32Float64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Float64 != nil {
- x.FptrMapUint32Float64 = nil
- }
- } else {
- if x.FptrMapUint32Float64 == nil {
- x.FptrMapUint32Float64 = new(map[uint32]float64)
- }
-
- if false {
- } else {
- z.F.DecMapUint32Float64X(x.FptrMapUint32Float64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint32Bool = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint32BoolX(&x.FMapUint32Bool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint32Bool != nil {
- x.FptrMapUint32Bool = nil
- }
- } else {
- if x.FptrMapUint32Bool == nil {
- x.FptrMapUint32Bool = new(map[uint32]bool)
- }
-
- if false {
- } else {
- z.F.DecMapUint32BoolX(x.FptrMapUint32Bool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint64Intf = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64IntfX(&x.FMapUint64Intf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Intf != nil {
- x.FptrMapUint64Intf = nil
- }
- } else {
- if x.FptrMapUint64Intf == nil {
- x.FptrMapUint64Intf = new(map[uint64]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapUint64IntfX(x.FptrMapUint64Intf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint64String = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64StringX(&x.FMapUint64String, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64String != nil {
- x.FptrMapUint64String = nil
- }
- } else {
- if x.FptrMapUint64String == nil {
- x.FptrMapUint64String = new(map[uint64]string)
- }
-
- if false {
- } else {
- z.F.DecMapUint64StringX(x.FptrMapUint64String, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint64Uint = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64UintX(&x.FMapUint64Uint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Uint != nil {
- x.FptrMapUint64Uint = nil
- }
- } else {
- if x.FptrMapUint64Uint == nil {
- x.FptrMapUint64Uint = new(map[uint64]uint)
- }
-
- if false {
- } else {
- z.F.DecMapUint64UintX(x.FptrMapUint64Uint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint64Uint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64Uint8X(&x.FMapUint64Uint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Uint8 != nil {
- x.FptrMapUint64Uint8 = nil
- }
- } else {
- if x.FptrMapUint64Uint8 == nil {
- x.FptrMapUint64Uint8 = new(map[uint64]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapUint64Uint8X(x.FptrMapUint64Uint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint64Uint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64Uint16X(&x.FMapUint64Uint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Uint16 != nil {
- x.FptrMapUint64Uint16 = nil
- }
- } else {
- if x.FptrMapUint64Uint16 == nil {
- x.FptrMapUint64Uint16 = new(map[uint64]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapUint64Uint16X(x.FptrMapUint64Uint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint64Uint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64Uint32X(&x.FMapUint64Uint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Uint32 != nil {
- x.FptrMapUint64Uint32 = nil
- }
- } else {
- if x.FptrMapUint64Uint32 == nil {
- x.FptrMapUint64Uint32 = new(map[uint64]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapUint64Uint32X(x.FptrMapUint64Uint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint64Uint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64Uint64X(&x.FMapUint64Uint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Uint64 != nil {
- x.FptrMapUint64Uint64 = nil
- }
- } else {
- if x.FptrMapUint64Uint64 == nil {
- x.FptrMapUint64Uint64 = new(map[uint64]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapUint64Uint64X(x.FptrMapUint64Uint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint64Uintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64UintptrX(&x.FMapUint64Uintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Uintptr != nil {
- x.FptrMapUint64Uintptr = nil
- }
- } else {
- if x.FptrMapUint64Uintptr == nil {
- x.FptrMapUint64Uintptr = new(map[uint64]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapUint64UintptrX(x.FptrMapUint64Uintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint64Int = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64IntX(&x.FMapUint64Int, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Int != nil {
- x.FptrMapUint64Int = nil
- }
- } else {
- if x.FptrMapUint64Int == nil {
- x.FptrMapUint64Int = new(map[uint64]int)
- }
-
- if false {
- } else {
- z.F.DecMapUint64IntX(x.FptrMapUint64Int, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint64Int8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64Int8X(&x.FMapUint64Int8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Int8 != nil {
- x.FptrMapUint64Int8 = nil
- }
- } else {
- if x.FptrMapUint64Int8 == nil {
- x.FptrMapUint64Int8 = new(map[uint64]int8)
- }
-
- if false {
- } else {
- z.F.DecMapUint64Int8X(x.FptrMapUint64Int8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint64Int16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64Int16X(&x.FMapUint64Int16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Int16 != nil {
- x.FptrMapUint64Int16 = nil
- }
- } else {
- if x.FptrMapUint64Int16 == nil {
- x.FptrMapUint64Int16 = new(map[uint64]int16)
- }
-
- if false {
- } else {
- z.F.DecMapUint64Int16X(x.FptrMapUint64Int16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint64Int32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64Int32X(&x.FMapUint64Int32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Int32 != nil {
- x.FptrMapUint64Int32 = nil
- }
- } else {
- if x.FptrMapUint64Int32 == nil {
- x.FptrMapUint64Int32 = new(map[uint64]int32)
- }
-
- if false {
- } else {
- z.F.DecMapUint64Int32X(x.FptrMapUint64Int32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint64Int64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64Int64X(&x.FMapUint64Int64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Int64 != nil {
- x.FptrMapUint64Int64 = nil
- }
- } else {
- if x.FptrMapUint64Int64 == nil {
- x.FptrMapUint64Int64 = new(map[uint64]int64)
- }
-
- if false {
- } else {
- z.F.DecMapUint64Int64X(x.FptrMapUint64Int64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint64Float32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64Float32X(&x.FMapUint64Float32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Float32 != nil {
- x.FptrMapUint64Float32 = nil
- }
- } else {
- if x.FptrMapUint64Float32 == nil {
- x.FptrMapUint64Float32 = new(map[uint64]float32)
- }
-
- if false {
- } else {
- z.F.DecMapUint64Float32X(x.FptrMapUint64Float32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint64Float64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64Float64X(&x.FMapUint64Float64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Float64 != nil {
- x.FptrMapUint64Float64 = nil
- }
- } else {
- if x.FptrMapUint64Float64 == nil {
- x.FptrMapUint64Float64 = new(map[uint64]float64)
- }
-
- if false {
- } else {
- z.F.DecMapUint64Float64X(x.FptrMapUint64Float64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUint64Bool = nil
- } else {
- if false {
- } else {
- z.F.DecMapUint64BoolX(&x.FMapUint64Bool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUint64Bool != nil {
- x.FptrMapUint64Bool = nil
- }
- } else {
- if x.FptrMapUint64Bool == nil {
- x.FptrMapUint64Bool = new(map[uint64]bool)
- }
-
- if false {
- } else {
- z.F.DecMapUint64BoolX(x.FptrMapUint64Bool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintptrIntf = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrIntfX(&x.FMapUintptrIntf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrIntf != nil {
- x.FptrMapUintptrIntf = nil
- }
- } else {
- if x.FptrMapUintptrIntf == nil {
- x.FptrMapUintptrIntf = new(map[uintptr]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapUintptrIntfX(x.FptrMapUintptrIntf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintptrString = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrStringX(&x.FMapUintptrString, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrString != nil {
- x.FptrMapUintptrString = nil
- }
- } else {
- if x.FptrMapUintptrString == nil {
- x.FptrMapUintptrString = new(map[uintptr]string)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrStringX(x.FptrMapUintptrString, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintptrUint = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrUintX(&x.FMapUintptrUint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrUint != nil {
- x.FptrMapUintptrUint = nil
- }
- } else {
- if x.FptrMapUintptrUint == nil {
- x.FptrMapUintptrUint = new(map[uintptr]uint)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrUintX(x.FptrMapUintptrUint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintptrUint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrUint8X(&x.FMapUintptrUint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrUint8 != nil {
- x.FptrMapUintptrUint8 = nil
- }
- } else {
- if x.FptrMapUintptrUint8 == nil {
- x.FptrMapUintptrUint8 = new(map[uintptr]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrUint8X(x.FptrMapUintptrUint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintptrUint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrUint16X(&x.FMapUintptrUint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrUint16 != nil {
- x.FptrMapUintptrUint16 = nil
- }
- } else {
- if x.FptrMapUintptrUint16 == nil {
- x.FptrMapUintptrUint16 = new(map[uintptr]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrUint16X(x.FptrMapUintptrUint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintptrUint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrUint32X(&x.FMapUintptrUint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrUint32 != nil {
- x.FptrMapUintptrUint32 = nil
- }
- } else {
- if x.FptrMapUintptrUint32 == nil {
- x.FptrMapUintptrUint32 = new(map[uintptr]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrUint32X(x.FptrMapUintptrUint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintptrUint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrUint64X(&x.FMapUintptrUint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrUint64 != nil {
- x.FptrMapUintptrUint64 = nil
- }
- } else {
- if x.FptrMapUintptrUint64 == nil {
- x.FptrMapUintptrUint64 = new(map[uintptr]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrUint64X(x.FptrMapUintptrUint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintptrUintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrUintptrX(&x.FMapUintptrUintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrUintptr != nil {
- x.FptrMapUintptrUintptr = nil
- }
- } else {
- if x.FptrMapUintptrUintptr == nil {
- x.FptrMapUintptrUintptr = new(map[uintptr]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrUintptrX(x.FptrMapUintptrUintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintptrInt = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrIntX(&x.FMapUintptrInt, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrInt != nil {
- x.FptrMapUintptrInt = nil
- }
- } else {
- if x.FptrMapUintptrInt == nil {
- x.FptrMapUintptrInt = new(map[uintptr]int)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrIntX(x.FptrMapUintptrInt, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintptrInt8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrInt8X(&x.FMapUintptrInt8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrInt8 != nil {
- x.FptrMapUintptrInt8 = nil
- }
- } else {
- if x.FptrMapUintptrInt8 == nil {
- x.FptrMapUintptrInt8 = new(map[uintptr]int8)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrInt8X(x.FptrMapUintptrInt8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintptrInt16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrInt16X(&x.FMapUintptrInt16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrInt16 != nil {
- x.FptrMapUintptrInt16 = nil
- }
- } else {
- if x.FptrMapUintptrInt16 == nil {
- x.FptrMapUintptrInt16 = new(map[uintptr]int16)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrInt16X(x.FptrMapUintptrInt16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintptrInt32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrInt32X(&x.FMapUintptrInt32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrInt32 != nil {
- x.FptrMapUintptrInt32 = nil
- }
- } else {
- if x.FptrMapUintptrInt32 == nil {
- x.FptrMapUintptrInt32 = new(map[uintptr]int32)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrInt32X(x.FptrMapUintptrInt32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintptrInt64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrInt64X(&x.FMapUintptrInt64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrInt64 != nil {
- x.FptrMapUintptrInt64 = nil
- }
- } else {
- if x.FptrMapUintptrInt64 == nil {
- x.FptrMapUintptrInt64 = new(map[uintptr]int64)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrInt64X(x.FptrMapUintptrInt64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintptrFloat32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrFloat32X(&x.FMapUintptrFloat32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrFloat32 != nil {
- x.FptrMapUintptrFloat32 = nil
- }
- } else {
- if x.FptrMapUintptrFloat32 == nil {
- x.FptrMapUintptrFloat32 = new(map[uintptr]float32)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrFloat32X(x.FptrMapUintptrFloat32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintptrFloat64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrFloat64X(&x.FMapUintptrFloat64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrFloat64 != nil {
- x.FptrMapUintptrFloat64 = nil
- }
- } else {
- if x.FptrMapUintptrFloat64 == nil {
- x.FptrMapUintptrFloat64 = new(map[uintptr]float64)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrFloat64X(x.FptrMapUintptrFloat64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapUintptrBool = nil
- } else {
- if false {
- } else {
- z.F.DecMapUintptrBoolX(&x.FMapUintptrBool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapUintptrBool != nil {
- x.FptrMapUintptrBool = nil
- }
- } else {
- if x.FptrMapUintptrBool == nil {
- x.FptrMapUintptrBool = new(map[uintptr]bool)
- }
-
- if false {
- } else {
- z.F.DecMapUintptrBoolX(x.FptrMapUintptrBool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntIntf = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntIntfX(&x.FMapIntIntf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntIntf != nil {
- x.FptrMapIntIntf = nil
- }
- } else {
- if x.FptrMapIntIntf == nil {
- x.FptrMapIntIntf = new(map[int]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapIntIntfX(x.FptrMapIntIntf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntString = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntStringX(&x.FMapIntString, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntString != nil {
- x.FptrMapIntString = nil
- }
- } else {
- if x.FptrMapIntString == nil {
- x.FptrMapIntString = new(map[int]string)
- }
-
- if false {
- } else {
- z.F.DecMapIntStringX(x.FptrMapIntString, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntUint = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntUintX(&x.FMapIntUint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntUint != nil {
- x.FptrMapIntUint = nil
- }
- } else {
- if x.FptrMapIntUint == nil {
- x.FptrMapIntUint = new(map[int]uint)
- }
-
- if false {
- } else {
- z.F.DecMapIntUintX(x.FptrMapIntUint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntUint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntUint8X(&x.FMapIntUint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntUint8 != nil {
- x.FptrMapIntUint8 = nil
- }
- } else {
- if x.FptrMapIntUint8 == nil {
- x.FptrMapIntUint8 = new(map[int]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapIntUint8X(x.FptrMapIntUint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntUint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntUint16X(&x.FMapIntUint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntUint16 != nil {
- x.FptrMapIntUint16 = nil
- }
- } else {
- if x.FptrMapIntUint16 == nil {
- x.FptrMapIntUint16 = new(map[int]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapIntUint16X(x.FptrMapIntUint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntUint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntUint32X(&x.FMapIntUint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntUint32 != nil {
- x.FptrMapIntUint32 = nil
- }
- } else {
- if x.FptrMapIntUint32 == nil {
- x.FptrMapIntUint32 = new(map[int]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapIntUint32X(x.FptrMapIntUint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntUint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntUint64X(&x.FMapIntUint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntUint64 != nil {
- x.FptrMapIntUint64 = nil
- }
- } else {
- if x.FptrMapIntUint64 == nil {
- x.FptrMapIntUint64 = new(map[int]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapIntUint64X(x.FptrMapIntUint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntUintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntUintptrX(&x.FMapIntUintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntUintptr != nil {
- x.FptrMapIntUintptr = nil
- }
- } else {
- if x.FptrMapIntUintptr == nil {
- x.FptrMapIntUintptr = new(map[int]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapIntUintptrX(x.FptrMapIntUintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntInt = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntIntX(&x.FMapIntInt, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntInt != nil {
- x.FptrMapIntInt = nil
- }
- } else {
- if x.FptrMapIntInt == nil {
- x.FptrMapIntInt = new(map[int]int)
- }
-
- if false {
- } else {
- z.F.DecMapIntIntX(x.FptrMapIntInt, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntInt8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntInt8X(&x.FMapIntInt8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntInt8 != nil {
- x.FptrMapIntInt8 = nil
- }
- } else {
- if x.FptrMapIntInt8 == nil {
- x.FptrMapIntInt8 = new(map[int]int8)
- }
-
- if false {
- } else {
- z.F.DecMapIntInt8X(x.FptrMapIntInt8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntInt16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntInt16X(&x.FMapIntInt16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntInt16 != nil {
- x.FptrMapIntInt16 = nil
- }
- } else {
- if x.FptrMapIntInt16 == nil {
- x.FptrMapIntInt16 = new(map[int]int16)
- }
-
- if false {
- } else {
- z.F.DecMapIntInt16X(x.FptrMapIntInt16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntInt32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntInt32X(&x.FMapIntInt32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntInt32 != nil {
- x.FptrMapIntInt32 = nil
- }
- } else {
- if x.FptrMapIntInt32 == nil {
- x.FptrMapIntInt32 = new(map[int]int32)
- }
-
- if false {
- } else {
- z.F.DecMapIntInt32X(x.FptrMapIntInt32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntInt64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntInt64X(&x.FMapIntInt64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntInt64 != nil {
- x.FptrMapIntInt64 = nil
- }
- } else {
- if x.FptrMapIntInt64 == nil {
- x.FptrMapIntInt64 = new(map[int]int64)
- }
-
- if false {
- } else {
- z.F.DecMapIntInt64X(x.FptrMapIntInt64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntFloat32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntFloat32X(&x.FMapIntFloat32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntFloat32 != nil {
- x.FptrMapIntFloat32 = nil
- }
- } else {
- if x.FptrMapIntFloat32 == nil {
- x.FptrMapIntFloat32 = new(map[int]float32)
- }
-
- if false {
- } else {
- z.F.DecMapIntFloat32X(x.FptrMapIntFloat32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntFloat64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntFloat64X(&x.FMapIntFloat64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntFloat64 != nil {
- x.FptrMapIntFloat64 = nil
- }
- } else {
- if x.FptrMapIntFloat64 == nil {
- x.FptrMapIntFloat64 = new(map[int]float64)
- }
-
- if false {
- } else {
- z.F.DecMapIntFloat64X(x.FptrMapIntFloat64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapIntBool = nil
- } else {
- if false {
- } else {
- z.F.DecMapIntBoolX(&x.FMapIntBool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapIntBool != nil {
- x.FptrMapIntBool = nil
- }
- } else {
- if x.FptrMapIntBool == nil {
- x.FptrMapIntBool = new(map[int]bool)
- }
-
- if false {
- } else {
- z.F.DecMapIntBoolX(x.FptrMapIntBool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt8Intf = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8IntfX(&x.FMapInt8Intf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Intf != nil {
- x.FptrMapInt8Intf = nil
- }
- } else {
- if x.FptrMapInt8Intf == nil {
- x.FptrMapInt8Intf = new(map[int8]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapInt8IntfX(x.FptrMapInt8Intf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt8String = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8StringX(&x.FMapInt8String, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8String != nil {
- x.FptrMapInt8String = nil
- }
- } else {
- if x.FptrMapInt8String == nil {
- x.FptrMapInt8String = new(map[int8]string)
- }
-
- if false {
- } else {
- z.F.DecMapInt8StringX(x.FptrMapInt8String, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt8Uint = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8UintX(&x.FMapInt8Uint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Uint != nil {
- x.FptrMapInt8Uint = nil
- }
- } else {
- if x.FptrMapInt8Uint == nil {
- x.FptrMapInt8Uint = new(map[int8]uint)
- }
-
- if false {
- } else {
- z.F.DecMapInt8UintX(x.FptrMapInt8Uint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt8Uint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8Uint8X(&x.FMapInt8Uint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Uint8 != nil {
- x.FptrMapInt8Uint8 = nil
- }
- } else {
- if x.FptrMapInt8Uint8 == nil {
- x.FptrMapInt8Uint8 = new(map[int8]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapInt8Uint8X(x.FptrMapInt8Uint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt8Uint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8Uint16X(&x.FMapInt8Uint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Uint16 != nil {
- x.FptrMapInt8Uint16 = nil
- }
- } else {
- if x.FptrMapInt8Uint16 == nil {
- x.FptrMapInt8Uint16 = new(map[int8]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapInt8Uint16X(x.FptrMapInt8Uint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt8Uint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8Uint32X(&x.FMapInt8Uint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Uint32 != nil {
- x.FptrMapInt8Uint32 = nil
- }
- } else {
- if x.FptrMapInt8Uint32 == nil {
- x.FptrMapInt8Uint32 = new(map[int8]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapInt8Uint32X(x.FptrMapInt8Uint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt8Uint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8Uint64X(&x.FMapInt8Uint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Uint64 != nil {
- x.FptrMapInt8Uint64 = nil
- }
- } else {
- if x.FptrMapInt8Uint64 == nil {
- x.FptrMapInt8Uint64 = new(map[int8]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapInt8Uint64X(x.FptrMapInt8Uint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt8Uintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8UintptrX(&x.FMapInt8Uintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Uintptr != nil {
- x.FptrMapInt8Uintptr = nil
- }
- } else {
- if x.FptrMapInt8Uintptr == nil {
- x.FptrMapInt8Uintptr = new(map[int8]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapInt8UintptrX(x.FptrMapInt8Uintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt8Int = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8IntX(&x.FMapInt8Int, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Int != nil {
- x.FptrMapInt8Int = nil
- }
- } else {
- if x.FptrMapInt8Int == nil {
- x.FptrMapInt8Int = new(map[int8]int)
- }
-
- if false {
- } else {
- z.F.DecMapInt8IntX(x.FptrMapInt8Int, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt8Int8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8Int8X(&x.FMapInt8Int8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Int8 != nil {
- x.FptrMapInt8Int8 = nil
- }
- } else {
- if x.FptrMapInt8Int8 == nil {
- x.FptrMapInt8Int8 = new(map[int8]int8)
- }
-
- if false {
- } else {
- z.F.DecMapInt8Int8X(x.FptrMapInt8Int8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt8Int16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8Int16X(&x.FMapInt8Int16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Int16 != nil {
- x.FptrMapInt8Int16 = nil
- }
- } else {
- if x.FptrMapInt8Int16 == nil {
- x.FptrMapInt8Int16 = new(map[int8]int16)
- }
-
- if false {
- } else {
- z.F.DecMapInt8Int16X(x.FptrMapInt8Int16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt8Int32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8Int32X(&x.FMapInt8Int32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Int32 != nil {
- x.FptrMapInt8Int32 = nil
- }
- } else {
- if x.FptrMapInt8Int32 == nil {
- x.FptrMapInt8Int32 = new(map[int8]int32)
- }
-
- if false {
- } else {
- z.F.DecMapInt8Int32X(x.FptrMapInt8Int32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt8Int64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8Int64X(&x.FMapInt8Int64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Int64 != nil {
- x.FptrMapInt8Int64 = nil
- }
- } else {
- if x.FptrMapInt8Int64 == nil {
- x.FptrMapInt8Int64 = new(map[int8]int64)
- }
-
- if false {
- } else {
- z.F.DecMapInt8Int64X(x.FptrMapInt8Int64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt8Float32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8Float32X(&x.FMapInt8Float32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Float32 != nil {
- x.FptrMapInt8Float32 = nil
- }
- } else {
- if x.FptrMapInt8Float32 == nil {
- x.FptrMapInt8Float32 = new(map[int8]float32)
- }
-
- if false {
- } else {
- z.F.DecMapInt8Float32X(x.FptrMapInt8Float32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt8Float64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8Float64X(&x.FMapInt8Float64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Float64 != nil {
- x.FptrMapInt8Float64 = nil
- }
- } else {
- if x.FptrMapInt8Float64 == nil {
- x.FptrMapInt8Float64 = new(map[int8]float64)
- }
-
- if false {
- } else {
- z.F.DecMapInt8Float64X(x.FptrMapInt8Float64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt8Bool = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt8BoolX(&x.FMapInt8Bool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt8Bool != nil {
- x.FptrMapInt8Bool = nil
- }
- } else {
- if x.FptrMapInt8Bool == nil {
- x.FptrMapInt8Bool = new(map[int8]bool)
- }
-
- if false {
- } else {
- z.F.DecMapInt8BoolX(x.FptrMapInt8Bool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt16Intf = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16IntfX(&x.FMapInt16Intf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Intf != nil {
- x.FptrMapInt16Intf = nil
- }
- } else {
- if x.FptrMapInt16Intf == nil {
- x.FptrMapInt16Intf = new(map[int16]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapInt16IntfX(x.FptrMapInt16Intf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt16String = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16StringX(&x.FMapInt16String, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16String != nil {
- x.FptrMapInt16String = nil
- }
- } else {
- if x.FptrMapInt16String == nil {
- x.FptrMapInt16String = new(map[int16]string)
- }
-
- if false {
- } else {
- z.F.DecMapInt16StringX(x.FptrMapInt16String, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt16Uint = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16UintX(&x.FMapInt16Uint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Uint != nil {
- x.FptrMapInt16Uint = nil
- }
- } else {
- if x.FptrMapInt16Uint == nil {
- x.FptrMapInt16Uint = new(map[int16]uint)
- }
-
- if false {
- } else {
- z.F.DecMapInt16UintX(x.FptrMapInt16Uint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt16Uint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16Uint8X(&x.FMapInt16Uint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Uint8 != nil {
- x.FptrMapInt16Uint8 = nil
- }
- } else {
- if x.FptrMapInt16Uint8 == nil {
- x.FptrMapInt16Uint8 = new(map[int16]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapInt16Uint8X(x.FptrMapInt16Uint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt16Uint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16Uint16X(&x.FMapInt16Uint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Uint16 != nil {
- x.FptrMapInt16Uint16 = nil
- }
- } else {
- if x.FptrMapInt16Uint16 == nil {
- x.FptrMapInt16Uint16 = new(map[int16]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapInt16Uint16X(x.FptrMapInt16Uint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt16Uint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16Uint32X(&x.FMapInt16Uint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Uint32 != nil {
- x.FptrMapInt16Uint32 = nil
- }
- } else {
- if x.FptrMapInt16Uint32 == nil {
- x.FptrMapInt16Uint32 = new(map[int16]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapInt16Uint32X(x.FptrMapInt16Uint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt16Uint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16Uint64X(&x.FMapInt16Uint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Uint64 != nil {
- x.FptrMapInt16Uint64 = nil
- }
- } else {
- if x.FptrMapInt16Uint64 == nil {
- x.FptrMapInt16Uint64 = new(map[int16]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapInt16Uint64X(x.FptrMapInt16Uint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt16Uintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16UintptrX(&x.FMapInt16Uintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Uintptr != nil {
- x.FptrMapInt16Uintptr = nil
- }
- } else {
- if x.FptrMapInt16Uintptr == nil {
- x.FptrMapInt16Uintptr = new(map[int16]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapInt16UintptrX(x.FptrMapInt16Uintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt16Int = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16IntX(&x.FMapInt16Int, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Int != nil {
- x.FptrMapInt16Int = nil
- }
- } else {
- if x.FptrMapInt16Int == nil {
- x.FptrMapInt16Int = new(map[int16]int)
- }
-
- if false {
- } else {
- z.F.DecMapInt16IntX(x.FptrMapInt16Int, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt16Int8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16Int8X(&x.FMapInt16Int8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Int8 != nil {
- x.FptrMapInt16Int8 = nil
- }
- } else {
- if x.FptrMapInt16Int8 == nil {
- x.FptrMapInt16Int8 = new(map[int16]int8)
- }
-
- if false {
- } else {
- z.F.DecMapInt16Int8X(x.FptrMapInt16Int8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt16Int16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16Int16X(&x.FMapInt16Int16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Int16 != nil {
- x.FptrMapInt16Int16 = nil
- }
- } else {
- if x.FptrMapInt16Int16 == nil {
- x.FptrMapInt16Int16 = new(map[int16]int16)
- }
-
- if false {
- } else {
- z.F.DecMapInt16Int16X(x.FptrMapInt16Int16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt16Int32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16Int32X(&x.FMapInt16Int32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Int32 != nil {
- x.FptrMapInt16Int32 = nil
- }
- } else {
- if x.FptrMapInt16Int32 == nil {
- x.FptrMapInt16Int32 = new(map[int16]int32)
- }
-
- if false {
- } else {
- z.F.DecMapInt16Int32X(x.FptrMapInt16Int32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt16Int64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16Int64X(&x.FMapInt16Int64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Int64 != nil {
- x.FptrMapInt16Int64 = nil
- }
- } else {
- if x.FptrMapInt16Int64 == nil {
- x.FptrMapInt16Int64 = new(map[int16]int64)
- }
-
- if false {
- } else {
- z.F.DecMapInt16Int64X(x.FptrMapInt16Int64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt16Float32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16Float32X(&x.FMapInt16Float32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Float32 != nil {
- x.FptrMapInt16Float32 = nil
- }
- } else {
- if x.FptrMapInt16Float32 == nil {
- x.FptrMapInt16Float32 = new(map[int16]float32)
- }
-
- if false {
- } else {
- z.F.DecMapInt16Float32X(x.FptrMapInt16Float32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt16Float64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16Float64X(&x.FMapInt16Float64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Float64 != nil {
- x.FptrMapInt16Float64 = nil
- }
- } else {
- if x.FptrMapInt16Float64 == nil {
- x.FptrMapInt16Float64 = new(map[int16]float64)
- }
-
- if false {
- } else {
- z.F.DecMapInt16Float64X(x.FptrMapInt16Float64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt16Bool = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt16BoolX(&x.FMapInt16Bool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt16Bool != nil {
- x.FptrMapInt16Bool = nil
- }
- } else {
- if x.FptrMapInt16Bool == nil {
- x.FptrMapInt16Bool = new(map[int16]bool)
- }
-
- if false {
- } else {
- z.F.DecMapInt16BoolX(x.FptrMapInt16Bool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt32Intf = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32IntfX(&x.FMapInt32Intf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Intf != nil {
- x.FptrMapInt32Intf = nil
- }
- } else {
- if x.FptrMapInt32Intf == nil {
- x.FptrMapInt32Intf = new(map[int32]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapInt32IntfX(x.FptrMapInt32Intf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt32String = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32StringX(&x.FMapInt32String, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32String != nil {
- x.FptrMapInt32String = nil
- }
- } else {
- if x.FptrMapInt32String == nil {
- x.FptrMapInt32String = new(map[int32]string)
- }
-
- if false {
- } else {
- z.F.DecMapInt32StringX(x.FptrMapInt32String, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt32Uint = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32UintX(&x.FMapInt32Uint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Uint != nil {
- x.FptrMapInt32Uint = nil
- }
- } else {
- if x.FptrMapInt32Uint == nil {
- x.FptrMapInt32Uint = new(map[int32]uint)
- }
-
- if false {
- } else {
- z.F.DecMapInt32UintX(x.FptrMapInt32Uint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt32Uint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32Uint8X(&x.FMapInt32Uint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Uint8 != nil {
- x.FptrMapInt32Uint8 = nil
- }
- } else {
- if x.FptrMapInt32Uint8 == nil {
- x.FptrMapInt32Uint8 = new(map[int32]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapInt32Uint8X(x.FptrMapInt32Uint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt32Uint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32Uint16X(&x.FMapInt32Uint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Uint16 != nil {
- x.FptrMapInt32Uint16 = nil
- }
- } else {
- if x.FptrMapInt32Uint16 == nil {
- x.FptrMapInt32Uint16 = new(map[int32]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapInt32Uint16X(x.FptrMapInt32Uint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt32Uint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32Uint32X(&x.FMapInt32Uint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Uint32 != nil {
- x.FptrMapInt32Uint32 = nil
- }
- } else {
- if x.FptrMapInt32Uint32 == nil {
- x.FptrMapInt32Uint32 = new(map[int32]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapInt32Uint32X(x.FptrMapInt32Uint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt32Uint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32Uint64X(&x.FMapInt32Uint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Uint64 != nil {
- x.FptrMapInt32Uint64 = nil
- }
- } else {
- if x.FptrMapInt32Uint64 == nil {
- x.FptrMapInt32Uint64 = new(map[int32]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapInt32Uint64X(x.FptrMapInt32Uint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt32Uintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32UintptrX(&x.FMapInt32Uintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Uintptr != nil {
- x.FptrMapInt32Uintptr = nil
- }
- } else {
- if x.FptrMapInt32Uintptr == nil {
- x.FptrMapInt32Uintptr = new(map[int32]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapInt32UintptrX(x.FptrMapInt32Uintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt32Int = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32IntX(&x.FMapInt32Int, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Int != nil {
- x.FptrMapInt32Int = nil
- }
- } else {
- if x.FptrMapInt32Int == nil {
- x.FptrMapInt32Int = new(map[int32]int)
- }
-
- if false {
- } else {
- z.F.DecMapInt32IntX(x.FptrMapInt32Int, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt32Int8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32Int8X(&x.FMapInt32Int8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Int8 != nil {
- x.FptrMapInt32Int8 = nil
- }
- } else {
- if x.FptrMapInt32Int8 == nil {
- x.FptrMapInt32Int8 = new(map[int32]int8)
- }
-
- if false {
- } else {
- z.F.DecMapInt32Int8X(x.FptrMapInt32Int8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt32Int16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32Int16X(&x.FMapInt32Int16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Int16 != nil {
- x.FptrMapInt32Int16 = nil
- }
- } else {
- if x.FptrMapInt32Int16 == nil {
- x.FptrMapInt32Int16 = new(map[int32]int16)
- }
-
- if false {
- } else {
- z.F.DecMapInt32Int16X(x.FptrMapInt32Int16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt32Int32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32Int32X(&x.FMapInt32Int32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Int32 != nil {
- x.FptrMapInt32Int32 = nil
- }
- } else {
- if x.FptrMapInt32Int32 == nil {
- x.FptrMapInt32Int32 = new(map[int32]int32)
- }
-
- if false {
- } else {
- z.F.DecMapInt32Int32X(x.FptrMapInt32Int32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt32Int64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32Int64X(&x.FMapInt32Int64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Int64 != nil {
- x.FptrMapInt32Int64 = nil
- }
- } else {
- if x.FptrMapInt32Int64 == nil {
- x.FptrMapInt32Int64 = new(map[int32]int64)
- }
-
- if false {
- } else {
- z.F.DecMapInt32Int64X(x.FptrMapInt32Int64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt32Float32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32Float32X(&x.FMapInt32Float32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Float32 != nil {
- x.FptrMapInt32Float32 = nil
- }
- } else {
- if x.FptrMapInt32Float32 == nil {
- x.FptrMapInt32Float32 = new(map[int32]float32)
- }
-
- if false {
- } else {
- z.F.DecMapInt32Float32X(x.FptrMapInt32Float32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt32Float64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32Float64X(&x.FMapInt32Float64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Float64 != nil {
- x.FptrMapInt32Float64 = nil
- }
- } else {
- if x.FptrMapInt32Float64 == nil {
- x.FptrMapInt32Float64 = new(map[int32]float64)
- }
-
- if false {
- } else {
- z.F.DecMapInt32Float64X(x.FptrMapInt32Float64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt32Bool = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt32BoolX(&x.FMapInt32Bool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt32Bool != nil {
- x.FptrMapInt32Bool = nil
- }
- } else {
- if x.FptrMapInt32Bool == nil {
- x.FptrMapInt32Bool = new(map[int32]bool)
- }
-
- if false {
- } else {
- z.F.DecMapInt32BoolX(x.FptrMapInt32Bool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt64Intf = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64IntfX(&x.FMapInt64Intf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Intf != nil {
- x.FptrMapInt64Intf = nil
- }
- } else {
- if x.FptrMapInt64Intf == nil {
- x.FptrMapInt64Intf = new(map[int64]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapInt64IntfX(x.FptrMapInt64Intf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt64String = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64StringX(&x.FMapInt64String, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64String != nil {
- x.FptrMapInt64String = nil
- }
- } else {
- if x.FptrMapInt64String == nil {
- x.FptrMapInt64String = new(map[int64]string)
- }
-
- if false {
- } else {
- z.F.DecMapInt64StringX(x.FptrMapInt64String, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt64Uint = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64UintX(&x.FMapInt64Uint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Uint != nil {
- x.FptrMapInt64Uint = nil
- }
- } else {
- if x.FptrMapInt64Uint == nil {
- x.FptrMapInt64Uint = new(map[int64]uint)
- }
-
- if false {
- } else {
- z.F.DecMapInt64UintX(x.FptrMapInt64Uint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt64Uint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64Uint8X(&x.FMapInt64Uint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Uint8 != nil {
- x.FptrMapInt64Uint8 = nil
- }
- } else {
- if x.FptrMapInt64Uint8 == nil {
- x.FptrMapInt64Uint8 = new(map[int64]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapInt64Uint8X(x.FptrMapInt64Uint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt64Uint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64Uint16X(&x.FMapInt64Uint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Uint16 != nil {
- x.FptrMapInt64Uint16 = nil
- }
- } else {
- if x.FptrMapInt64Uint16 == nil {
- x.FptrMapInt64Uint16 = new(map[int64]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapInt64Uint16X(x.FptrMapInt64Uint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt64Uint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64Uint32X(&x.FMapInt64Uint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Uint32 != nil {
- x.FptrMapInt64Uint32 = nil
- }
- } else {
- if x.FptrMapInt64Uint32 == nil {
- x.FptrMapInt64Uint32 = new(map[int64]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapInt64Uint32X(x.FptrMapInt64Uint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt64Uint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64Uint64X(&x.FMapInt64Uint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Uint64 != nil {
- x.FptrMapInt64Uint64 = nil
- }
- } else {
- if x.FptrMapInt64Uint64 == nil {
- x.FptrMapInt64Uint64 = new(map[int64]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapInt64Uint64X(x.FptrMapInt64Uint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt64Uintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64UintptrX(&x.FMapInt64Uintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Uintptr != nil {
- x.FptrMapInt64Uintptr = nil
- }
- } else {
- if x.FptrMapInt64Uintptr == nil {
- x.FptrMapInt64Uintptr = new(map[int64]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapInt64UintptrX(x.FptrMapInt64Uintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt64Int = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64IntX(&x.FMapInt64Int, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Int != nil {
- x.FptrMapInt64Int = nil
- }
- } else {
- if x.FptrMapInt64Int == nil {
- x.FptrMapInt64Int = new(map[int64]int)
- }
-
- if false {
- } else {
- z.F.DecMapInt64IntX(x.FptrMapInt64Int, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt64Int8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64Int8X(&x.FMapInt64Int8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Int8 != nil {
- x.FptrMapInt64Int8 = nil
- }
- } else {
- if x.FptrMapInt64Int8 == nil {
- x.FptrMapInt64Int8 = new(map[int64]int8)
- }
-
- if false {
- } else {
- z.F.DecMapInt64Int8X(x.FptrMapInt64Int8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt64Int16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64Int16X(&x.FMapInt64Int16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Int16 != nil {
- x.FptrMapInt64Int16 = nil
- }
- } else {
- if x.FptrMapInt64Int16 == nil {
- x.FptrMapInt64Int16 = new(map[int64]int16)
- }
-
- if false {
- } else {
- z.F.DecMapInt64Int16X(x.FptrMapInt64Int16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt64Int32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64Int32X(&x.FMapInt64Int32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Int32 != nil {
- x.FptrMapInt64Int32 = nil
- }
- } else {
- if x.FptrMapInt64Int32 == nil {
- x.FptrMapInt64Int32 = new(map[int64]int32)
- }
-
- if false {
- } else {
- z.F.DecMapInt64Int32X(x.FptrMapInt64Int32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt64Int64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64Int64X(&x.FMapInt64Int64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Int64 != nil {
- x.FptrMapInt64Int64 = nil
- }
- } else {
- if x.FptrMapInt64Int64 == nil {
- x.FptrMapInt64Int64 = new(map[int64]int64)
- }
-
- if false {
- } else {
- z.F.DecMapInt64Int64X(x.FptrMapInt64Int64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt64Float32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64Float32X(&x.FMapInt64Float32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Float32 != nil {
- x.FptrMapInt64Float32 = nil
- }
- } else {
- if x.FptrMapInt64Float32 == nil {
- x.FptrMapInt64Float32 = new(map[int64]float32)
- }
-
- if false {
- } else {
- z.F.DecMapInt64Float32X(x.FptrMapInt64Float32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt64Float64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64Float64X(&x.FMapInt64Float64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Float64 != nil {
- x.FptrMapInt64Float64 = nil
- }
- } else {
- if x.FptrMapInt64Float64 == nil {
- x.FptrMapInt64Float64 = new(map[int64]float64)
- }
-
- if false {
- } else {
- z.F.DecMapInt64Float64X(x.FptrMapInt64Float64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapInt64Bool = nil
- } else {
- if false {
- } else {
- z.F.DecMapInt64BoolX(&x.FMapInt64Bool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapInt64Bool != nil {
- x.FptrMapInt64Bool = nil
- }
- } else {
- if x.FptrMapInt64Bool == nil {
- x.FptrMapInt64Bool = new(map[int64]bool)
- }
-
- if false {
- } else {
- z.F.DecMapInt64BoolX(x.FptrMapInt64Bool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapBoolIntf = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolIntfX(&x.FMapBoolIntf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolIntf != nil {
- x.FptrMapBoolIntf = nil
- }
- } else {
- if x.FptrMapBoolIntf == nil {
- x.FptrMapBoolIntf = new(map[bool]interface{})
- }
-
- if false {
- } else {
- z.F.DecMapBoolIntfX(x.FptrMapBoolIntf, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapBoolString = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolStringX(&x.FMapBoolString, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolString != nil {
- x.FptrMapBoolString = nil
- }
- } else {
- if x.FptrMapBoolString == nil {
- x.FptrMapBoolString = new(map[bool]string)
- }
-
- if false {
- } else {
- z.F.DecMapBoolStringX(x.FptrMapBoolString, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapBoolUint = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolUintX(&x.FMapBoolUint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolUint != nil {
- x.FptrMapBoolUint = nil
- }
- } else {
- if x.FptrMapBoolUint == nil {
- x.FptrMapBoolUint = new(map[bool]uint)
- }
-
- if false {
- } else {
- z.F.DecMapBoolUintX(x.FptrMapBoolUint, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapBoolUint8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolUint8X(&x.FMapBoolUint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolUint8 != nil {
- x.FptrMapBoolUint8 = nil
- }
- } else {
- if x.FptrMapBoolUint8 == nil {
- x.FptrMapBoolUint8 = new(map[bool]uint8)
- }
-
- if false {
- } else {
- z.F.DecMapBoolUint8X(x.FptrMapBoolUint8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapBoolUint16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolUint16X(&x.FMapBoolUint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolUint16 != nil {
- x.FptrMapBoolUint16 = nil
- }
- } else {
- if x.FptrMapBoolUint16 == nil {
- x.FptrMapBoolUint16 = new(map[bool]uint16)
- }
-
- if false {
- } else {
- z.F.DecMapBoolUint16X(x.FptrMapBoolUint16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapBoolUint32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolUint32X(&x.FMapBoolUint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolUint32 != nil {
- x.FptrMapBoolUint32 = nil
- }
- } else {
- if x.FptrMapBoolUint32 == nil {
- x.FptrMapBoolUint32 = new(map[bool]uint32)
- }
-
- if false {
- } else {
- z.F.DecMapBoolUint32X(x.FptrMapBoolUint32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapBoolUint64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolUint64X(&x.FMapBoolUint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolUint64 != nil {
- x.FptrMapBoolUint64 = nil
- }
- } else {
- if x.FptrMapBoolUint64 == nil {
- x.FptrMapBoolUint64 = new(map[bool]uint64)
- }
-
- if false {
- } else {
- z.F.DecMapBoolUint64X(x.FptrMapBoolUint64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapBoolUintptr = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolUintptrX(&x.FMapBoolUintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolUintptr != nil {
- x.FptrMapBoolUintptr = nil
- }
- } else {
- if x.FptrMapBoolUintptr == nil {
- x.FptrMapBoolUintptr = new(map[bool]uintptr)
- }
-
- if false {
- } else {
- z.F.DecMapBoolUintptrX(x.FptrMapBoolUintptr, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapBoolInt = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolIntX(&x.FMapBoolInt, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolInt != nil {
- x.FptrMapBoolInt = nil
- }
- } else {
- if x.FptrMapBoolInt == nil {
- x.FptrMapBoolInt = new(map[bool]int)
- }
-
- if false {
- } else {
- z.F.DecMapBoolIntX(x.FptrMapBoolInt, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapBoolInt8 = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolInt8X(&x.FMapBoolInt8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolInt8 != nil {
- x.FptrMapBoolInt8 = nil
- }
- } else {
- if x.FptrMapBoolInt8 == nil {
- x.FptrMapBoolInt8 = new(map[bool]int8)
- }
-
- if false {
- } else {
- z.F.DecMapBoolInt8X(x.FptrMapBoolInt8, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapBoolInt16 = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolInt16X(&x.FMapBoolInt16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolInt16 != nil {
- x.FptrMapBoolInt16 = nil
- }
- } else {
- if x.FptrMapBoolInt16 == nil {
- x.FptrMapBoolInt16 = new(map[bool]int16)
- }
-
- if false {
- } else {
- z.F.DecMapBoolInt16X(x.FptrMapBoolInt16, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapBoolInt32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolInt32X(&x.FMapBoolInt32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolInt32 != nil {
- x.FptrMapBoolInt32 = nil
- }
- } else {
- if x.FptrMapBoolInt32 == nil {
- x.FptrMapBoolInt32 = new(map[bool]int32)
- }
-
- if false {
- } else {
- z.F.DecMapBoolInt32X(x.FptrMapBoolInt32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapBoolInt64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolInt64X(&x.FMapBoolInt64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolInt64 != nil {
- x.FptrMapBoolInt64 = nil
- }
- } else {
- if x.FptrMapBoolInt64 == nil {
- x.FptrMapBoolInt64 = new(map[bool]int64)
- }
-
- if false {
- } else {
- z.F.DecMapBoolInt64X(x.FptrMapBoolInt64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapBoolFloat32 = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolFloat32X(&x.FMapBoolFloat32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolFloat32 != nil {
- x.FptrMapBoolFloat32 = nil
- }
- } else {
- if x.FptrMapBoolFloat32 == nil {
- x.FptrMapBoolFloat32 = new(map[bool]float32)
- }
-
- if false {
- } else {
- z.F.DecMapBoolFloat32X(x.FptrMapBoolFloat32, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapBoolFloat64 = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolFloat64X(&x.FMapBoolFloat64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolFloat64 != nil {
- x.FptrMapBoolFloat64 = nil
- }
- } else {
- if x.FptrMapBoolFloat64 == nil {
- x.FptrMapBoolFloat64 = new(map[bool]float64)
- }
-
- if false {
- } else {
- z.F.DecMapBoolFloat64X(x.FptrMapBoolFloat64, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.FMapBoolBool = nil
- } else {
- if false {
- } else {
- z.F.DecMapBoolBoolX(&x.FMapBoolBool, d)
- }
- }
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- if true && x.FptrMapBoolBool != nil {
- x.FptrMapBoolBool = nil
- }
- } else {
- if x.FptrMapBoolBool == nil {
- x.FptrMapBoolBool = new(map[bool]bool)
- }
-
- if false {
- } else {
- z.F.DecMapBoolBoolX(x.FptrMapBoolBool, d)
- }
- }
- for {
- yyj1141++
- if yyhl1141 {
- yyb1141 = yyj1141 > l
- } else {
- yyb1141 = r.CheckBreak()
- }
- if yyb1141 {
- break
- }
- r.ReadArrayElem()
- z.DecStructFieldNotFound(yyj1141-1, "")
- }
- r.ReadArrayEnd()
-}
-
-func (x testMammoth2Binary) CodecEncodeSelf(e *Encoder) {
- var h codecSelfer19781
- z, r := GenHelperEncoder(e)
- _, _, _ = h, z, r
- if false {
- } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil {
- z.EncExtension(x, yyxt1)
- } else if z.EncBinary() {
- z.EncBinaryMarshal(x)
- } else {
- r.EncodeUint(uint64(x))
- }
-}
-
-func (x *testMammoth2Binary) CodecDecodeSelf(d *Decoder) {
- var h codecSelfer19781
- z, r := GenHelperDecoder(d)
- _, _, _ = h, z, r
- if false {
- } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil {
- z.DecExtension(x, yyxt1)
- } else if z.DecBinary() {
- z.DecBinaryUnmarshal(x)
- } else {
- *x = (testMammoth2Binary)(r.DecodeUint64())
- }
-}
-
-func (x testMammoth2Text) CodecEncodeSelf(e *Encoder) {
- var h codecSelfer19781
- z, r := GenHelperEncoder(e)
- _, _, _ = h, z, r
- if false {
- } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil {
- z.EncExtension(x, yyxt1)
- } else if !z.EncBinary() {
- z.EncTextMarshal(x)
- } else {
- r.EncodeUint(uint64(x))
- }
-}
-
-func (x *testMammoth2Text) CodecDecodeSelf(d *Decoder) {
- var h codecSelfer19781
- z, r := GenHelperDecoder(d)
- _, _, _ = h, z, r
- if false {
- } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil {
- z.DecExtension(x, yyxt1)
- } else if !z.DecBinary() {
- z.DecTextUnmarshal(x)
- } else {
- *x = (testMammoth2Text)(r.DecodeUint64())
- }
-}
-
-func (x testMammoth2Json) CodecEncodeSelf(e *Encoder) {
- var h codecSelfer19781
- z, r := GenHelperEncoder(e)
- _, _, _ = h, z, r
- if false {
- } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil {
- z.EncExtension(x, yyxt1)
- } else if !z.EncBinary() && z.IsJSONHandle() {
- z.EncJSONMarshal(x)
- } else {
- r.EncodeUint(uint64(x))
- }
-}
-
-func (x *testMammoth2Json) CodecDecodeSelf(d *Decoder) {
- var h codecSelfer19781
- z, r := GenHelperDecoder(d)
- _, _, _ = h, z, r
- if false {
- } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil {
- z.DecExtension(x, yyxt1)
- } else if !z.DecBinary() && z.IsJSONHandle() {
- z.DecJSONUnmarshal(x)
- } else {
- *x = (testMammoth2Json)(r.DecodeUint64())
- }
-}
-
-func (x *testMammoth2Basic) CodecEncodeSelf(e *Encoder) {
- var h codecSelfer19781
- z, r := GenHelperEncoder(e)
- _, _, _ = h, z, r
- if x == nil {
- r.EncodeNil()
- } else {
- if false {
- } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil {
- z.EncExtension(x, yyxt1)
- } else {
- h.enctestMammoth2Basic((*testMammoth2Basic)(x), e)
- }
- }
-}
-
-func (x *testMammoth2Basic) CodecDecodeSelf(d *Decoder) {
- var h codecSelfer19781
- z, r := GenHelperDecoder(d)
- _, _, _ = h, z, r
- if false {
- } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil {
- z.DecExtension(x, yyxt1)
- } else {
- h.dectestMammoth2Basic((*testMammoth2Basic)(x), d)
- }
-}
-
-func (x *TestMammoth2Wrapper) CodecEncodeSelf(e *Encoder) {
- var h codecSelfer19781
- z, r := GenHelperEncoder(e)
- _, _, _ = h, z, r
- if x == nil {
- r.EncodeNil()
- } else {
- if false {
- } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil {
- z.EncExtension(x, yyxt1)
- } else {
- yysep2 := !z.EncBinary()
- yy2arr2 := z.EncBasicHandle().StructToArray
- _, _ = yysep2, yy2arr2
- const yyr2 bool = false // struct tag has 'toArray'
- if yyr2 || yy2arr2 {
- r.WriteArrayStart(8)
- } else {
- r.WriteMapStart(8)
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- yy4 := &x.V
- yy4.CodecEncodeSelf(e)
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `V`)
- r.WriteMapElemValue()
- yy6 := &x.V
- yy6.CodecEncodeSelf(e)
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- x.T.CodecEncodeSelf(e)
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `T`)
- r.WriteMapElemValue()
- x.T.CodecEncodeSelf(e)
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- x.B.CodecEncodeSelf(e)
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `B`)
- r.WriteMapElemValue()
- x.B.CodecEncodeSelf(e)
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- x.J.CodecEncodeSelf(e)
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `J`)
- r.WriteMapElemValue()
- x.J.CodecEncodeSelf(e)
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- yy18 := &x.C
- yy18.CodecEncodeSelf(e)
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `C`)
- r.WriteMapElemValue()
- yy20 := &x.C
- yy20.CodecEncodeSelf(e)
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.M == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- h.encMaptestMammoth2BasicTestMammoth2((map[testMammoth2Basic]TestMammoth2)(x.M), e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `M`)
- r.WriteMapElemValue()
- if x.M == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- h.encMaptestMammoth2BasicTestMammoth2((map[testMammoth2Basic]TestMammoth2)(x.M), e)
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- if x.L == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- h.encSliceTestMammoth2(([]TestMammoth2)(x.L), e)
- }
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `L`)
- r.WriteMapElemValue()
- if x.L == nil {
- r.EncodeNil()
- } else {
- if false {
- } else {
- h.encSliceTestMammoth2(([]TestMammoth2)(x.L), e)
- }
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayElem()
- yy29 := &x.A
- if false {
- } else {
- h.encArray4int64((*[4]int64)(yy29), e)
- }
- } else {
- r.WriteMapElemKey()
- r.EncodeString(codecSelferCcUTF819781, `A`)
- r.WriteMapElemValue()
- yy31 := &x.A
- if false {
- } else {
- h.encArray4int64((*[4]int64)(yy31), e)
- }
- }
- if yyr2 || yy2arr2 {
- r.WriteArrayEnd()
- } else {
- r.WriteMapEnd()
- }
- }
- }
-}
-
-func (x *TestMammoth2Wrapper) CodecDecodeSelf(d *Decoder) {
- var h codecSelfer19781
- z, r := GenHelperDecoder(d)
- _, _, _ = h, z, r
- if false {
- } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil {
- z.DecExtension(x, yyxt1)
- } else {
- yyct2 := r.ContainerType()
- if yyct2 == codecSelferValueTypeMap19781 {
- yyl2 := r.ReadMapStart()
- if yyl2 == 0 {
- r.ReadMapEnd()
- } else {
- x.codecDecodeSelfFromMap(yyl2, d)
- }
- } else if yyct2 == codecSelferValueTypeArray19781 {
- yyl2 := r.ReadArrayStart()
- if yyl2 == 0 {
- r.ReadArrayEnd()
- } else {
- x.codecDecodeSelfFromArray(yyl2, d)
- }
- } else {
- panic(errCodecSelferOnlyMapOrArrayEncodeToStruct19781)
- }
- }
-}
-
-func (x *TestMammoth2Wrapper) codecDecodeSelfFromMap(l int, d *Decoder) {
- var h codecSelfer19781
- z, r := GenHelperDecoder(d)
- _, _, _ = h, z, r
- var yyhl3 bool = l >= 0
- for yyj3 := 0; ; yyj3++ {
- if yyhl3 {
- if yyj3 >= l {
- break
- }
- } else {
- if r.CheckBreak() {
- break
- }
- }
- r.ReadMapElemKey()
- yys3 := z.StringView(r.DecodeStringAsBytes())
- r.ReadMapElemValue()
- switch yys3 {
- case "V":
- if r.TryDecodeAsNil() {
- x.V = TestMammoth2{}
- } else {
- x.V.CodecDecodeSelf(d)
- }
- case "T":
- if r.TryDecodeAsNil() {
- x.T = 0
- } else {
- x.T.CodecDecodeSelf(d)
- }
- case "B":
- if r.TryDecodeAsNil() {
- x.B = 0
- } else {
- x.B.CodecDecodeSelf(d)
- }
- case "J":
- if r.TryDecodeAsNil() {
- x.J = 0
- } else {
- x.J.CodecDecodeSelf(d)
- }
- case "C":
- if r.TryDecodeAsNil() {
- x.C = testMammoth2Basic{}
- } else {
- x.C.CodecDecodeSelf(d)
- }
- case "M":
- if r.TryDecodeAsNil() {
- x.M = nil
- } else {
- if false {
- } else {
- h.decMaptestMammoth2BasicTestMammoth2((*map[testMammoth2Basic]TestMammoth2)(&x.M), d)
- }
- }
- case "L":
- if r.TryDecodeAsNil() {
- x.L = nil
- } else {
- if false {
- } else {
- h.decSliceTestMammoth2((*[]TestMammoth2)(&x.L), d)
- }
- }
- case "A":
- if r.TryDecodeAsNil() {
- x.A = [4]int64{}
- } else {
- if false {
- } else {
- h.decArray4int64((*[4]int64)(&x.A), d)
- }
- }
- default:
- z.DecStructFieldNotFound(-1, yys3)
- } // end switch yys3
- } // end for yyj3
- r.ReadMapEnd()
-}
-
-func (x *TestMammoth2Wrapper) codecDecodeSelfFromArray(l int, d *Decoder) {
- var h codecSelfer19781
- z, r := GenHelperDecoder(d)
- _, _, _ = h, z, r
- var yyj15 int
- var yyb15 bool
- var yyhl15 bool = l >= 0
- yyj15++
- if yyhl15 {
- yyb15 = yyj15 > l
- } else {
- yyb15 = r.CheckBreak()
- }
- if yyb15 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.V = TestMammoth2{}
- } else {
- x.V.CodecDecodeSelf(d)
- }
- yyj15++
- if yyhl15 {
- yyb15 = yyj15 > l
- } else {
- yyb15 = r.CheckBreak()
- }
- if yyb15 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.T = 0
- } else {
- x.T.CodecDecodeSelf(d)
- }
- yyj15++
- if yyhl15 {
- yyb15 = yyj15 > l
- } else {
- yyb15 = r.CheckBreak()
- }
- if yyb15 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.B = 0
- } else {
- x.B.CodecDecodeSelf(d)
- }
- yyj15++
- if yyhl15 {
- yyb15 = yyj15 > l
- } else {
- yyb15 = r.CheckBreak()
- }
- if yyb15 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.J = 0
- } else {
- x.J.CodecDecodeSelf(d)
- }
- yyj15++
- if yyhl15 {
- yyb15 = yyj15 > l
- } else {
- yyb15 = r.CheckBreak()
- }
- if yyb15 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.C = testMammoth2Basic{}
- } else {
- x.C.CodecDecodeSelf(d)
- }
- yyj15++
- if yyhl15 {
- yyb15 = yyj15 > l
- } else {
- yyb15 = r.CheckBreak()
- }
- if yyb15 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.M = nil
- } else {
- if false {
- } else {
- h.decMaptestMammoth2BasicTestMammoth2((*map[testMammoth2Basic]TestMammoth2)(&x.M), d)
- }
- }
- yyj15++
- if yyhl15 {
- yyb15 = yyj15 > l
- } else {
- yyb15 = r.CheckBreak()
- }
- if yyb15 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.L = nil
- } else {
- if false {
- } else {
- h.decSliceTestMammoth2((*[]TestMammoth2)(&x.L), d)
- }
- }
- yyj15++
- if yyhl15 {
- yyb15 = yyj15 > l
- } else {
- yyb15 = r.CheckBreak()
- }
- if yyb15 {
- r.ReadArrayEnd()
- return
- }
- r.ReadArrayElem()
- if r.TryDecodeAsNil() {
- x.A = [4]int64{}
- } else {
- if false {
- } else {
- h.decArray4int64((*[4]int64)(&x.A), d)
- }
- }
- for {
- yyj15++
- if yyhl15 {
- yyb15 = yyj15 > l
- } else {
- yyb15 = r.CheckBreak()
- }
- if yyb15 {
- break
- }
- r.ReadArrayElem()
- z.DecStructFieldNotFound(yyj15-1, "")
- }
- r.ReadArrayEnd()
-}
-
-func (x codecSelfer19781) enctestMammoth2Basic(v *testMammoth2Basic, e *Encoder) {
- var h codecSelfer19781
- z, r := GenHelperEncoder(e)
- _, _, _ = h, z, r
- r.WriteArrayStart(len(v))
- for _, yyv1 := range v {
- r.WriteArrayElem()
- if false {
- } else {
- r.EncodeUint(uint64(yyv1))
- }
- }
- r.WriteArrayEnd()
-}
-
-func (x codecSelfer19781) dectestMammoth2Basic(v *testMammoth2Basic, d *Decoder) {
- var h codecSelfer19781
- z, r := GenHelperDecoder(d)
- _, _, _ = h, z, r
-
- yyv1 := v
- yyh1, yyl1 := z.DecSliceHelperStart()
- if yyl1 == 0 {
-
- } else {
- yyhl1 := yyl1 > 0
- var yyrl1 int
- _ = yyrl1
-
- var yyj1 int
- // var yydn1 bool
- for ; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ {
-
- yyh1.ElemContainerState(yyj1)
-
- var yydb1 bool
- if yyj1 >= len(yyv1) {
- z.DecArrayCannotExpand(len(v), yyj1+1)
- yydb1 = true
-
- }
- if yydb1 {
- z.DecSwallow()
- } else {
- if r.TryDecodeAsNil() {
- yyv1[yyj1] = 0
- } else {
- yyv1[yyj1] = (uint64)(r.DecodeUint64())
- }
-
- }
-
- }
-
- }
- yyh1.End()
-
-}
-
-func (x codecSelfer19781) encMaptestMammoth2BasicTestMammoth2(v map[testMammoth2Basic]TestMammoth2, e *Encoder) {
- var h codecSelfer19781
- z, r := GenHelperEncoder(e)
- _, _, _ = h, z, r
- r.WriteMapStart(len(v))
- for yyk1, yyv1 := range v {
- r.WriteMapElemKey()
- yy2 := &yyk1
- yy2.CodecEncodeSelf(e)
- r.WriteMapElemValue()
- yy4 := &yyv1
- yy4.CodecEncodeSelf(e)
- }
- r.WriteMapEnd()
-}
-
-func (x codecSelfer19781) decMaptestMammoth2BasicTestMammoth2(v *map[testMammoth2Basic]TestMammoth2, d *Decoder) {
- var h codecSelfer19781
- z, r := GenHelperDecoder(d)
- _, _, _ = h, z, r
-
- yyv1 := *v
- yyl1 := r.ReadMapStart()
- yybh1 := z.DecBasicHandle()
- if yyv1 == nil {
- yyrl1 := z.DecInferLen(yyl1, yybh1.MaxInitLen, 4912)
- yyv1 = make(map[testMammoth2Basic]TestMammoth2, yyrl1)
- *v = yyv1
- }
- var yymk1 testMammoth2Basic
- var yymv1 TestMammoth2
- var yymg1, yymdn1 bool
- if yybh1.MapValueReset {
- yymg1 = true
- }
- if yyl1 != 0 {
- yyhl1 := yyl1 > 0
- for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ {
- r.ReadMapElemKey()
- if r.TryDecodeAsNil() {
- yymk1 = testMammoth2Basic{}
- } else {
- yymk1.CodecDecodeSelf(d)
- }
-
- if yymg1 {
- yymv1 = yyv1[yymk1]
- } else {
- yymv1 = TestMammoth2{}
- }
- r.ReadMapElemValue()
- yymdn1 = false
- if r.TryDecodeAsNil() {
- yymdn1 = true
- } else {
- yymv1.CodecDecodeSelf(d)
- }
-
- if yymdn1 {
- if yybh1.DeleteOnNilMapValue {
- delete(yyv1, yymk1)
- } else {
- yyv1[yymk1] = TestMammoth2{}
- }
- } else if yyv1 != nil {
- yyv1[yymk1] = yymv1
- }
- }
- } // else len==0: TODO: Should we clear map entries?
- r.ReadMapEnd()
-}
-
-func (x codecSelfer19781) encSliceTestMammoth2(v []TestMammoth2, e *Encoder) {
- var h codecSelfer19781
- z, r := GenHelperEncoder(e)
- _, _, _ = h, z, r
- r.WriteArrayStart(len(v))
- for _, yyv1 := range v {
- r.WriteArrayElem()
- yy2 := &yyv1
- yy2.CodecEncodeSelf(e)
- }
- r.WriteArrayEnd()
-}
-
-func (x codecSelfer19781) decSliceTestMammoth2(v *[]TestMammoth2, d *Decoder) {
- var h codecSelfer19781
- z, r := GenHelperDecoder(d)
- _, _, _ = h, z, r
-
- yyv1 := *v
- yyh1, yyl1 := z.DecSliceHelperStart()
- var yyc1 bool
- _ = yyc1
- if yyl1 == 0 {
- if yyv1 == nil {
- yyv1 = []TestMammoth2{}
- yyc1 = true
- } else if len(yyv1) != 0 {
- yyv1 = yyv1[:0]
- yyc1 = true
- }
- } else {
- yyhl1 := yyl1 > 0
- var yyrl1 int
- _ = yyrl1
- if yyhl1 {
- if yyl1 > cap(yyv1) {
- yyrl1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 4880)
- if yyrl1 <= cap(yyv1) {
- yyv1 = yyv1[:yyrl1]
- } else {
- yyv1 = make([]TestMammoth2, yyrl1)
- }
- yyc1 = true
- } else if yyl1 != len(yyv1) {
- yyv1 = yyv1[:yyl1]
- yyc1 = true
- }
- }
- var yyj1 int
- // var yydn1 bool
- for ; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ {
- if yyj1 == 0 && yyv1 == nil {
- if yyhl1 {
- yyrl1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 4880)
- } else {
- yyrl1 = 8
- }
- yyv1 = make([]TestMammoth2, yyrl1)
- yyc1 = true
- }
- yyh1.ElemContainerState(yyj1)
-
- var yydb1 bool
- if yyj1 >= len(yyv1) {
- yyv1 = append(yyv1, TestMammoth2{})
- yyc1 = true
-
- }
- if yydb1 {
- z.DecSwallow()
- } else {
- if r.TryDecodeAsNil() {
- yyv1[yyj1] = TestMammoth2{}
- } else {
- yyv1[yyj1].CodecDecodeSelf(d)
- }
-
- }
-
- }
- if yyj1 < len(yyv1) {
- yyv1 = yyv1[:yyj1]
- yyc1 = true
- } else if yyj1 == 0 && yyv1 == nil {
- yyv1 = make([]TestMammoth2, 0)
- yyc1 = true
- }
- }
- yyh1.End()
- if yyc1 {
- *v = yyv1
- }
-}
-
-func (x codecSelfer19781) encArray4int64(v *[4]int64, e *Encoder) {
- var h codecSelfer19781
- z, r := GenHelperEncoder(e)
- _, _, _ = h, z, r
- r.WriteArrayStart(len(v))
- for _, yyv1 := range v {
- r.WriteArrayElem()
- if false {
- } else {
- r.EncodeInt(int64(yyv1))
- }
- }
- r.WriteArrayEnd()
-}
-
-func (x codecSelfer19781) decArray4int64(v *[4]int64, d *Decoder) {
- var h codecSelfer19781
- z, r := GenHelperDecoder(d)
- _, _, _ = h, z, r
-
- yyv1 := v
- yyh1, yyl1 := z.DecSliceHelperStart()
- if yyl1 == 0 {
-
- } else {
- yyhl1 := yyl1 > 0
- var yyrl1 int
- _ = yyrl1
-
- var yyj1 int
- // var yydn1 bool
- for ; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ {
-
- yyh1.ElemContainerState(yyj1)
-
- var yydb1 bool
- if yyj1 >= len(yyv1) {
- z.DecArrayCannotExpand(len(v), yyj1+1)
- yydb1 = true
-
- }
- if yydb1 {
- z.DecSwallow()
- } else {
- if r.TryDecodeAsNil() {
- yyv1[yyj1] = 0
- } else {
- yyv1[yyj1] = (int64)(r.DecodeInt64())
- }
-
- }
-
- }
-
- }
- yyh1.End()
-
-}
diff --git a/vendor/github.com/ugorji/go/codec/mammoth2_generated_test.go b/vendor/github.com/ugorji/go/codec/mammoth2_generated_test.go
deleted file mode 100644
index 4c62dffe0..000000000
--- a/vendor/github.com/ugorji/go/codec/mammoth2_generated_test.go
+++ /dev/null
@@ -1,658 +0,0 @@
-// +build !notfastpath
-
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-// Code generated from mammoth2-test.go.tmpl - DO NOT EDIT.
-
-package codec
-
-// Increase codecoverage by covering all the codecgen paths, in fast-path and gen-helper.go....
-//
-// Add:
-// - test file for creating a mammoth generated file as _mammoth_generated.go
-// - generate a second mammoth files in a different file: mammoth2_generated_test.go
-// - mammoth-test.go.tmpl will do this
-// - run codecgen on it, into mammoth2_codecgen_generated_test.go (no build tags)
-// - as part of TestMammoth, run it also
-// - this will cover all the codecgen, gen-helper, etc in one full run
-// - check in mammoth* files into github also
-// - then
-//
-// Now, add some types:
-// - some that implement BinaryMarshal, TextMarshal, JSONMarshal, and one that implements none of it
-// - create a wrapper type that includes TestMammoth2, with it in slices, and maps, and the custom types
-// - this wrapper object is what we work encode/decode (so that the codecgen methods are called)
-
-// import "encoding/binary"
-import "fmt"
-
-type TestMammoth2 struct {
- FIntf interface{}
- FptrIntf *interface{}
- FString string
- FptrString *string
- FFloat32 float32
- FptrFloat32 *float32
- FFloat64 float64
- FptrFloat64 *float64
- FUint uint
- FptrUint *uint
- FUint8 uint8
- FptrUint8 *uint8
- FUint16 uint16
- FptrUint16 *uint16
- FUint32 uint32
- FptrUint32 *uint32
- FUint64 uint64
- FptrUint64 *uint64
- FUintptr uintptr
- FptrUintptr *uintptr
- FInt int
- FptrInt *int
- FInt8 int8
- FptrInt8 *int8
- FInt16 int16
- FptrInt16 *int16
- FInt32 int32
- FptrInt32 *int32
- FInt64 int64
- FptrInt64 *int64
- FBool bool
- FptrBool *bool
-
- FSliceIntf []interface{}
- FptrSliceIntf *[]interface{}
- FSliceString []string
- FptrSliceString *[]string
- FSliceFloat32 []float32
- FptrSliceFloat32 *[]float32
- FSliceFloat64 []float64
- FptrSliceFloat64 *[]float64
- FSliceUint []uint
- FptrSliceUint *[]uint
- FSliceUint8 []uint8
- FptrSliceUint8 *[]uint8
- FSliceUint16 []uint16
- FptrSliceUint16 *[]uint16
- FSliceUint32 []uint32
- FptrSliceUint32 *[]uint32
- FSliceUint64 []uint64
- FptrSliceUint64 *[]uint64
- FSliceUintptr []uintptr
- FptrSliceUintptr *[]uintptr
- FSliceInt []int
- FptrSliceInt *[]int
- FSliceInt8 []int8
- FptrSliceInt8 *[]int8
- FSliceInt16 []int16
- FptrSliceInt16 *[]int16
- FSliceInt32 []int32
- FptrSliceInt32 *[]int32
- FSliceInt64 []int64
- FptrSliceInt64 *[]int64
- FSliceBool []bool
- FptrSliceBool *[]bool
-
- FMapIntfIntf map[interface{}]interface{}
- FptrMapIntfIntf *map[interface{}]interface{}
- FMapIntfString map[interface{}]string
- FptrMapIntfString *map[interface{}]string
- FMapIntfUint map[interface{}]uint
- FptrMapIntfUint *map[interface{}]uint
- FMapIntfUint8 map[interface{}]uint8
- FptrMapIntfUint8 *map[interface{}]uint8
- FMapIntfUint16 map[interface{}]uint16
- FptrMapIntfUint16 *map[interface{}]uint16
- FMapIntfUint32 map[interface{}]uint32
- FptrMapIntfUint32 *map[interface{}]uint32
- FMapIntfUint64 map[interface{}]uint64
- FptrMapIntfUint64 *map[interface{}]uint64
- FMapIntfUintptr map[interface{}]uintptr
- FptrMapIntfUintptr *map[interface{}]uintptr
- FMapIntfInt map[interface{}]int
- FptrMapIntfInt *map[interface{}]int
- FMapIntfInt8 map[interface{}]int8
- FptrMapIntfInt8 *map[interface{}]int8
- FMapIntfInt16 map[interface{}]int16
- FptrMapIntfInt16 *map[interface{}]int16
- FMapIntfInt32 map[interface{}]int32
- FptrMapIntfInt32 *map[interface{}]int32
- FMapIntfInt64 map[interface{}]int64
- FptrMapIntfInt64 *map[interface{}]int64
- FMapIntfFloat32 map[interface{}]float32
- FptrMapIntfFloat32 *map[interface{}]float32
- FMapIntfFloat64 map[interface{}]float64
- FptrMapIntfFloat64 *map[interface{}]float64
- FMapIntfBool map[interface{}]bool
- FptrMapIntfBool *map[interface{}]bool
- FMapStringIntf map[string]interface{}
- FptrMapStringIntf *map[string]interface{}
- FMapStringString map[string]string
- FptrMapStringString *map[string]string
- FMapStringUint map[string]uint
- FptrMapStringUint *map[string]uint
- FMapStringUint8 map[string]uint8
- FptrMapStringUint8 *map[string]uint8
- FMapStringUint16 map[string]uint16
- FptrMapStringUint16 *map[string]uint16
- FMapStringUint32 map[string]uint32
- FptrMapStringUint32 *map[string]uint32
- FMapStringUint64 map[string]uint64
- FptrMapStringUint64 *map[string]uint64
- FMapStringUintptr map[string]uintptr
- FptrMapStringUintptr *map[string]uintptr
- FMapStringInt map[string]int
- FptrMapStringInt *map[string]int
- FMapStringInt8 map[string]int8
- FptrMapStringInt8 *map[string]int8
- FMapStringInt16 map[string]int16
- FptrMapStringInt16 *map[string]int16
- FMapStringInt32 map[string]int32
- FptrMapStringInt32 *map[string]int32
- FMapStringInt64 map[string]int64
- FptrMapStringInt64 *map[string]int64
- FMapStringFloat32 map[string]float32
- FptrMapStringFloat32 *map[string]float32
- FMapStringFloat64 map[string]float64
- FptrMapStringFloat64 *map[string]float64
- FMapStringBool map[string]bool
- FptrMapStringBool *map[string]bool
- FMapFloat32Intf map[float32]interface{}
- FptrMapFloat32Intf *map[float32]interface{}
- FMapFloat32String map[float32]string
- FptrMapFloat32String *map[float32]string
- FMapFloat32Uint map[float32]uint
- FptrMapFloat32Uint *map[float32]uint
- FMapFloat32Uint8 map[float32]uint8
- FptrMapFloat32Uint8 *map[float32]uint8
- FMapFloat32Uint16 map[float32]uint16
- FptrMapFloat32Uint16 *map[float32]uint16
- FMapFloat32Uint32 map[float32]uint32
- FptrMapFloat32Uint32 *map[float32]uint32
- FMapFloat32Uint64 map[float32]uint64
- FptrMapFloat32Uint64 *map[float32]uint64
- FMapFloat32Uintptr map[float32]uintptr
- FptrMapFloat32Uintptr *map[float32]uintptr
- FMapFloat32Int map[float32]int
- FptrMapFloat32Int *map[float32]int
- FMapFloat32Int8 map[float32]int8
- FptrMapFloat32Int8 *map[float32]int8
- FMapFloat32Int16 map[float32]int16
- FptrMapFloat32Int16 *map[float32]int16
- FMapFloat32Int32 map[float32]int32
- FptrMapFloat32Int32 *map[float32]int32
- FMapFloat32Int64 map[float32]int64
- FptrMapFloat32Int64 *map[float32]int64
- FMapFloat32Float32 map[float32]float32
- FptrMapFloat32Float32 *map[float32]float32
- FMapFloat32Float64 map[float32]float64
- FptrMapFloat32Float64 *map[float32]float64
- FMapFloat32Bool map[float32]bool
- FptrMapFloat32Bool *map[float32]bool
- FMapFloat64Intf map[float64]interface{}
- FptrMapFloat64Intf *map[float64]interface{}
- FMapFloat64String map[float64]string
- FptrMapFloat64String *map[float64]string
- FMapFloat64Uint map[float64]uint
- FptrMapFloat64Uint *map[float64]uint
- FMapFloat64Uint8 map[float64]uint8
- FptrMapFloat64Uint8 *map[float64]uint8
- FMapFloat64Uint16 map[float64]uint16
- FptrMapFloat64Uint16 *map[float64]uint16
- FMapFloat64Uint32 map[float64]uint32
- FptrMapFloat64Uint32 *map[float64]uint32
- FMapFloat64Uint64 map[float64]uint64
- FptrMapFloat64Uint64 *map[float64]uint64
- FMapFloat64Uintptr map[float64]uintptr
- FptrMapFloat64Uintptr *map[float64]uintptr
- FMapFloat64Int map[float64]int
- FptrMapFloat64Int *map[float64]int
- FMapFloat64Int8 map[float64]int8
- FptrMapFloat64Int8 *map[float64]int8
- FMapFloat64Int16 map[float64]int16
- FptrMapFloat64Int16 *map[float64]int16
- FMapFloat64Int32 map[float64]int32
- FptrMapFloat64Int32 *map[float64]int32
- FMapFloat64Int64 map[float64]int64
- FptrMapFloat64Int64 *map[float64]int64
- FMapFloat64Float32 map[float64]float32
- FptrMapFloat64Float32 *map[float64]float32
- FMapFloat64Float64 map[float64]float64
- FptrMapFloat64Float64 *map[float64]float64
- FMapFloat64Bool map[float64]bool
- FptrMapFloat64Bool *map[float64]bool
- FMapUintIntf map[uint]interface{}
- FptrMapUintIntf *map[uint]interface{}
- FMapUintString map[uint]string
- FptrMapUintString *map[uint]string
- FMapUintUint map[uint]uint
- FptrMapUintUint *map[uint]uint
- FMapUintUint8 map[uint]uint8
- FptrMapUintUint8 *map[uint]uint8
- FMapUintUint16 map[uint]uint16
- FptrMapUintUint16 *map[uint]uint16
- FMapUintUint32 map[uint]uint32
- FptrMapUintUint32 *map[uint]uint32
- FMapUintUint64 map[uint]uint64
- FptrMapUintUint64 *map[uint]uint64
- FMapUintUintptr map[uint]uintptr
- FptrMapUintUintptr *map[uint]uintptr
- FMapUintInt map[uint]int
- FptrMapUintInt *map[uint]int
- FMapUintInt8 map[uint]int8
- FptrMapUintInt8 *map[uint]int8
- FMapUintInt16 map[uint]int16
- FptrMapUintInt16 *map[uint]int16
- FMapUintInt32 map[uint]int32
- FptrMapUintInt32 *map[uint]int32
- FMapUintInt64 map[uint]int64
- FptrMapUintInt64 *map[uint]int64
- FMapUintFloat32 map[uint]float32
- FptrMapUintFloat32 *map[uint]float32
- FMapUintFloat64 map[uint]float64
- FptrMapUintFloat64 *map[uint]float64
- FMapUintBool map[uint]bool
- FptrMapUintBool *map[uint]bool
- FMapUint8Intf map[uint8]interface{}
- FptrMapUint8Intf *map[uint8]interface{}
- FMapUint8String map[uint8]string
- FptrMapUint8String *map[uint8]string
- FMapUint8Uint map[uint8]uint
- FptrMapUint8Uint *map[uint8]uint
- FMapUint8Uint8 map[uint8]uint8
- FptrMapUint8Uint8 *map[uint8]uint8
- FMapUint8Uint16 map[uint8]uint16
- FptrMapUint8Uint16 *map[uint8]uint16
- FMapUint8Uint32 map[uint8]uint32
- FptrMapUint8Uint32 *map[uint8]uint32
- FMapUint8Uint64 map[uint8]uint64
- FptrMapUint8Uint64 *map[uint8]uint64
- FMapUint8Uintptr map[uint8]uintptr
- FptrMapUint8Uintptr *map[uint8]uintptr
- FMapUint8Int map[uint8]int
- FptrMapUint8Int *map[uint8]int
- FMapUint8Int8 map[uint8]int8
- FptrMapUint8Int8 *map[uint8]int8
- FMapUint8Int16 map[uint8]int16
- FptrMapUint8Int16 *map[uint8]int16
- FMapUint8Int32 map[uint8]int32
- FptrMapUint8Int32 *map[uint8]int32
- FMapUint8Int64 map[uint8]int64
- FptrMapUint8Int64 *map[uint8]int64
- FMapUint8Float32 map[uint8]float32
- FptrMapUint8Float32 *map[uint8]float32
- FMapUint8Float64 map[uint8]float64
- FptrMapUint8Float64 *map[uint8]float64
- FMapUint8Bool map[uint8]bool
- FptrMapUint8Bool *map[uint8]bool
- FMapUint16Intf map[uint16]interface{}
- FptrMapUint16Intf *map[uint16]interface{}
- FMapUint16String map[uint16]string
- FptrMapUint16String *map[uint16]string
- FMapUint16Uint map[uint16]uint
- FptrMapUint16Uint *map[uint16]uint
- FMapUint16Uint8 map[uint16]uint8
- FptrMapUint16Uint8 *map[uint16]uint8
- FMapUint16Uint16 map[uint16]uint16
- FptrMapUint16Uint16 *map[uint16]uint16
- FMapUint16Uint32 map[uint16]uint32
- FptrMapUint16Uint32 *map[uint16]uint32
- FMapUint16Uint64 map[uint16]uint64
- FptrMapUint16Uint64 *map[uint16]uint64
- FMapUint16Uintptr map[uint16]uintptr
- FptrMapUint16Uintptr *map[uint16]uintptr
- FMapUint16Int map[uint16]int
- FptrMapUint16Int *map[uint16]int
- FMapUint16Int8 map[uint16]int8
- FptrMapUint16Int8 *map[uint16]int8
- FMapUint16Int16 map[uint16]int16
- FptrMapUint16Int16 *map[uint16]int16
- FMapUint16Int32 map[uint16]int32
- FptrMapUint16Int32 *map[uint16]int32
- FMapUint16Int64 map[uint16]int64
- FptrMapUint16Int64 *map[uint16]int64
- FMapUint16Float32 map[uint16]float32
- FptrMapUint16Float32 *map[uint16]float32
- FMapUint16Float64 map[uint16]float64
- FptrMapUint16Float64 *map[uint16]float64
- FMapUint16Bool map[uint16]bool
- FptrMapUint16Bool *map[uint16]bool
- FMapUint32Intf map[uint32]interface{}
- FptrMapUint32Intf *map[uint32]interface{}
- FMapUint32String map[uint32]string
- FptrMapUint32String *map[uint32]string
- FMapUint32Uint map[uint32]uint
- FptrMapUint32Uint *map[uint32]uint
- FMapUint32Uint8 map[uint32]uint8
- FptrMapUint32Uint8 *map[uint32]uint8
- FMapUint32Uint16 map[uint32]uint16
- FptrMapUint32Uint16 *map[uint32]uint16
- FMapUint32Uint32 map[uint32]uint32
- FptrMapUint32Uint32 *map[uint32]uint32
- FMapUint32Uint64 map[uint32]uint64
- FptrMapUint32Uint64 *map[uint32]uint64
- FMapUint32Uintptr map[uint32]uintptr
- FptrMapUint32Uintptr *map[uint32]uintptr
- FMapUint32Int map[uint32]int
- FptrMapUint32Int *map[uint32]int
- FMapUint32Int8 map[uint32]int8
- FptrMapUint32Int8 *map[uint32]int8
- FMapUint32Int16 map[uint32]int16
- FptrMapUint32Int16 *map[uint32]int16
- FMapUint32Int32 map[uint32]int32
- FptrMapUint32Int32 *map[uint32]int32
- FMapUint32Int64 map[uint32]int64
- FptrMapUint32Int64 *map[uint32]int64
- FMapUint32Float32 map[uint32]float32
- FptrMapUint32Float32 *map[uint32]float32
- FMapUint32Float64 map[uint32]float64
- FptrMapUint32Float64 *map[uint32]float64
- FMapUint32Bool map[uint32]bool
- FptrMapUint32Bool *map[uint32]bool
- FMapUint64Intf map[uint64]interface{}
- FptrMapUint64Intf *map[uint64]interface{}
- FMapUint64String map[uint64]string
- FptrMapUint64String *map[uint64]string
- FMapUint64Uint map[uint64]uint
- FptrMapUint64Uint *map[uint64]uint
- FMapUint64Uint8 map[uint64]uint8
- FptrMapUint64Uint8 *map[uint64]uint8
- FMapUint64Uint16 map[uint64]uint16
- FptrMapUint64Uint16 *map[uint64]uint16
- FMapUint64Uint32 map[uint64]uint32
- FptrMapUint64Uint32 *map[uint64]uint32
- FMapUint64Uint64 map[uint64]uint64
- FptrMapUint64Uint64 *map[uint64]uint64
- FMapUint64Uintptr map[uint64]uintptr
- FptrMapUint64Uintptr *map[uint64]uintptr
- FMapUint64Int map[uint64]int
- FptrMapUint64Int *map[uint64]int
- FMapUint64Int8 map[uint64]int8
- FptrMapUint64Int8 *map[uint64]int8
- FMapUint64Int16 map[uint64]int16
- FptrMapUint64Int16 *map[uint64]int16
- FMapUint64Int32 map[uint64]int32
- FptrMapUint64Int32 *map[uint64]int32
- FMapUint64Int64 map[uint64]int64
- FptrMapUint64Int64 *map[uint64]int64
- FMapUint64Float32 map[uint64]float32
- FptrMapUint64Float32 *map[uint64]float32
- FMapUint64Float64 map[uint64]float64
- FptrMapUint64Float64 *map[uint64]float64
- FMapUint64Bool map[uint64]bool
- FptrMapUint64Bool *map[uint64]bool
- FMapUintptrIntf map[uintptr]interface{}
- FptrMapUintptrIntf *map[uintptr]interface{}
- FMapUintptrString map[uintptr]string
- FptrMapUintptrString *map[uintptr]string
- FMapUintptrUint map[uintptr]uint
- FptrMapUintptrUint *map[uintptr]uint
- FMapUintptrUint8 map[uintptr]uint8
- FptrMapUintptrUint8 *map[uintptr]uint8
- FMapUintptrUint16 map[uintptr]uint16
- FptrMapUintptrUint16 *map[uintptr]uint16
- FMapUintptrUint32 map[uintptr]uint32
- FptrMapUintptrUint32 *map[uintptr]uint32
- FMapUintptrUint64 map[uintptr]uint64
- FptrMapUintptrUint64 *map[uintptr]uint64
- FMapUintptrUintptr map[uintptr]uintptr
- FptrMapUintptrUintptr *map[uintptr]uintptr
- FMapUintptrInt map[uintptr]int
- FptrMapUintptrInt *map[uintptr]int
- FMapUintptrInt8 map[uintptr]int8
- FptrMapUintptrInt8 *map[uintptr]int8
- FMapUintptrInt16 map[uintptr]int16
- FptrMapUintptrInt16 *map[uintptr]int16
- FMapUintptrInt32 map[uintptr]int32
- FptrMapUintptrInt32 *map[uintptr]int32
- FMapUintptrInt64 map[uintptr]int64
- FptrMapUintptrInt64 *map[uintptr]int64
- FMapUintptrFloat32 map[uintptr]float32
- FptrMapUintptrFloat32 *map[uintptr]float32
- FMapUintptrFloat64 map[uintptr]float64
- FptrMapUintptrFloat64 *map[uintptr]float64
- FMapUintptrBool map[uintptr]bool
- FptrMapUintptrBool *map[uintptr]bool
- FMapIntIntf map[int]interface{}
- FptrMapIntIntf *map[int]interface{}
- FMapIntString map[int]string
- FptrMapIntString *map[int]string
- FMapIntUint map[int]uint
- FptrMapIntUint *map[int]uint
- FMapIntUint8 map[int]uint8
- FptrMapIntUint8 *map[int]uint8
- FMapIntUint16 map[int]uint16
- FptrMapIntUint16 *map[int]uint16
- FMapIntUint32 map[int]uint32
- FptrMapIntUint32 *map[int]uint32
- FMapIntUint64 map[int]uint64
- FptrMapIntUint64 *map[int]uint64
- FMapIntUintptr map[int]uintptr
- FptrMapIntUintptr *map[int]uintptr
- FMapIntInt map[int]int
- FptrMapIntInt *map[int]int
- FMapIntInt8 map[int]int8
- FptrMapIntInt8 *map[int]int8
- FMapIntInt16 map[int]int16
- FptrMapIntInt16 *map[int]int16
- FMapIntInt32 map[int]int32
- FptrMapIntInt32 *map[int]int32
- FMapIntInt64 map[int]int64
- FptrMapIntInt64 *map[int]int64
- FMapIntFloat32 map[int]float32
- FptrMapIntFloat32 *map[int]float32
- FMapIntFloat64 map[int]float64
- FptrMapIntFloat64 *map[int]float64
- FMapIntBool map[int]bool
- FptrMapIntBool *map[int]bool
- FMapInt8Intf map[int8]interface{}
- FptrMapInt8Intf *map[int8]interface{}
- FMapInt8String map[int8]string
- FptrMapInt8String *map[int8]string
- FMapInt8Uint map[int8]uint
- FptrMapInt8Uint *map[int8]uint
- FMapInt8Uint8 map[int8]uint8
- FptrMapInt8Uint8 *map[int8]uint8
- FMapInt8Uint16 map[int8]uint16
- FptrMapInt8Uint16 *map[int8]uint16
- FMapInt8Uint32 map[int8]uint32
- FptrMapInt8Uint32 *map[int8]uint32
- FMapInt8Uint64 map[int8]uint64
- FptrMapInt8Uint64 *map[int8]uint64
- FMapInt8Uintptr map[int8]uintptr
- FptrMapInt8Uintptr *map[int8]uintptr
- FMapInt8Int map[int8]int
- FptrMapInt8Int *map[int8]int
- FMapInt8Int8 map[int8]int8
- FptrMapInt8Int8 *map[int8]int8
- FMapInt8Int16 map[int8]int16
- FptrMapInt8Int16 *map[int8]int16
- FMapInt8Int32 map[int8]int32
- FptrMapInt8Int32 *map[int8]int32
- FMapInt8Int64 map[int8]int64
- FptrMapInt8Int64 *map[int8]int64
- FMapInt8Float32 map[int8]float32
- FptrMapInt8Float32 *map[int8]float32
- FMapInt8Float64 map[int8]float64
- FptrMapInt8Float64 *map[int8]float64
- FMapInt8Bool map[int8]bool
- FptrMapInt8Bool *map[int8]bool
- FMapInt16Intf map[int16]interface{}
- FptrMapInt16Intf *map[int16]interface{}
- FMapInt16String map[int16]string
- FptrMapInt16String *map[int16]string
- FMapInt16Uint map[int16]uint
- FptrMapInt16Uint *map[int16]uint
- FMapInt16Uint8 map[int16]uint8
- FptrMapInt16Uint8 *map[int16]uint8
- FMapInt16Uint16 map[int16]uint16
- FptrMapInt16Uint16 *map[int16]uint16
- FMapInt16Uint32 map[int16]uint32
- FptrMapInt16Uint32 *map[int16]uint32
- FMapInt16Uint64 map[int16]uint64
- FptrMapInt16Uint64 *map[int16]uint64
- FMapInt16Uintptr map[int16]uintptr
- FptrMapInt16Uintptr *map[int16]uintptr
- FMapInt16Int map[int16]int
- FptrMapInt16Int *map[int16]int
- FMapInt16Int8 map[int16]int8
- FptrMapInt16Int8 *map[int16]int8
- FMapInt16Int16 map[int16]int16
- FptrMapInt16Int16 *map[int16]int16
- FMapInt16Int32 map[int16]int32
- FptrMapInt16Int32 *map[int16]int32
- FMapInt16Int64 map[int16]int64
- FptrMapInt16Int64 *map[int16]int64
- FMapInt16Float32 map[int16]float32
- FptrMapInt16Float32 *map[int16]float32
- FMapInt16Float64 map[int16]float64
- FptrMapInt16Float64 *map[int16]float64
- FMapInt16Bool map[int16]bool
- FptrMapInt16Bool *map[int16]bool
- FMapInt32Intf map[int32]interface{}
- FptrMapInt32Intf *map[int32]interface{}
- FMapInt32String map[int32]string
- FptrMapInt32String *map[int32]string
- FMapInt32Uint map[int32]uint
- FptrMapInt32Uint *map[int32]uint
- FMapInt32Uint8 map[int32]uint8
- FptrMapInt32Uint8 *map[int32]uint8
- FMapInt32Uint16 map[int32]uint16
- FptrMapInt32Uint16 *map[int32]uint16
- FMapInt32Uint32 map[int32]uint32
- FptrMapInt32Uint32 *map[int32]uint32
- FMapInt32Uint64 map[int32]uint64
- FptrMapInt32Uint64 *map[int32]uint64
- FMapInt32Uintptr map[int32]uintptr
- FptrMapInt32Uintptr *map[int32]uintptr
- FMapInt32Int map[int32]int
- FptrMapInt32Int *map[int32]int
- FMapInt32Int8 map[int32]int8
- FptrMapInt32Int8 *map[int32]int8
- FMapInt32Int16 map[int32]int16
- FptrMapInt32Int16 *map[int32]int16
- FMapInt32Int32 map[int32]int32
- FptrMapInt32Int32 *map[int32]int32
- FMapInt32Int64 map[int32]int64
- FptrMapInt32Int64 *map[int32]int64
- FMapInt32Float32 map[int32]float32
- FptrMapInt32Float32 *map[int32]float32
- FMapInt32Float64 map[int32]float64
- FptrMapInt32Float64 *map[int32]float64
- FMapInt32Bool map[int32]bool
- FptrMapInt32Bool *map[int32]bool
- FMapInt64Intf map[int64]interface{}
- FptrMapInt64Intf *map[int64]interface{}
- FMapInt64String map[int64]string
- FptrMapInt64String *map[int64]string
- FMapInt64Uint map[int64]uint
- FptrMapInt64Uint *map[int64]uint
- FMapInt64Uint8 map[int64]uint8
- FptrMapInt64Uint8 *map[int64]uint8
- FMapInt64Uint16 map[int64]uint16
- FptrMapInt64Uint16 *map[int64]uint16
- FMapInt64Uint32 map[int64]uint32
- FptrMapInt64Uint32 *map[int64]uint32
- FMapInt64Uint64 map[int64]uint64
- FptrMapInt64Uint64 *map[int64]uint64
- FMapInt64Uintptr map[int64]uintptr
- FptrMapInt64Uintptr *map[int64]uintptr
- FMapInt64Int map[int64]int
- FptrMapInt64Int *map[int64]int
- FMapInt64Int8 map[int64]int8
- FptrMapInt64Int8 *map[int64]int8
- FMapInt64Int16 map[int64]int16
- FptrMapInt64Int16 *map[int64]int16
- FMapInt64Int32 map[int64]int32
- FptrMapInt64Int32 *map[int64]int32
- FMapInt64Int64 map[int64]int64
- FptrMapInt64Int64 *map[int64]int64
- FMapInt64Float32 map[int64]float32
- FptrMapInt64Float32 *map[int64]float32
- FMapInt64Float64 map[int64]float64
- FptrMapInt64Float64 *map[int64]float64
- FMapInt64Bool map[int64]bool
- FptrMapInt64Bool *map[int64]bool
- FMapBoolIntf map[bool]interface{}
- FptrMapBoolIntf *map[bool]interface{}
- FMapBoolString map[bool]string
- FptrMapBoolString *map[bool]string
- FMapBoolUint map[bool]uint
- FptrMapBoolUint *map[bool]uint
- FMapBoolUint8 map[bool]uint8
- FptrMapBoolUint8 *map[bool]uint8
- FMapBoolUint16 map[bool]uint16
- FptrMapBoolUint16 *map[bool]uint16
- FMapBoolUint32 map[bool]uint32
- FptrMapBoolUint32 *map[bool]uint32
- FMapBoolUint64 map[bool]uint64
- FptrMapBoolUint64 *map[bool]uint64
- FMapBoolUintptr map[bool]uintptr
- FptrMapBoolUintptr *map[bool]uintptr
- FMapBoolInt map[bool]int
- FptrMapBoolInt *map[bool]int
- FMapBoolInt8 map[bool]int8
- FptrMapBoolInt8 *map[bool]int8
- FMapBoolInt16 map[bool]int16
- FptrMapBoolInt16 *map[bool]int16
- FMapBoolInt32 map[bool]int32
- FptrMapBoolInt32 *map[bool]int32
- FMapBoolInt64 map[bool]int64
- FptrMapBoolInt64 *map[bool]int64
- FMapBoolFloat32 map[bool]float32
- FptrMapBoolFloat32 *map[bool]float32
- FMapBoolFloat64 map[bool]float64
- FptrMapBoolFloat64 *map[bool]float64
- FMapBoolBool map[bool]bool
- FptrMapBoolBool *map[bool]bool
-}
-
-// -----------
-
-type testMammoth2Binary uint64
-
-func (x testMammoth2Binary) MarshalBinary() (data []byte, err error) {
- data = make([]byte, 8)
- bigen.PutUint64(data, uint64(x))
- return
-}
-func (x *testMammoth2Binary) UnmarshalBinary(data []byte) (err error) {
- *x = testMammoth2Binary(bigen.Uint64(data))
- return
-}
-
-type testMammoth2Text uint64
-
-func (x testMammoth2Text) MarshalText() (data []byte, err error) {
- data = []byte(fmt.Sprintf("%b", uint64(x)))
- return
-}
-func (x *testMammoth2Text) UnmarshalText(data []byte) (err error) {
- _, err = fmt.Sscanf(string(data), "%b", (*uint64)(x))
- return
-}
-
-type testMammoth2Json uint64
-
-func (x testMammoth2Json) MarshalJSON() (data []byte, err error) {
- data = []byte(fmt.Sprintf("%v", uint64(x)))
- return
-}
-func (x *testMammoth2Json) UnmarshalJSON(data []byte) (err error) {
- _, err = fmt.Sscanf(string(data), "%v", (*uint64)(x))
- return
-}
-
-type testMammoth2Basic [4]uint64
-
-type TestMammoth2Wrapper struct {
- V TestMammoth2
- T testMammoth2Text
- B testMammoth2Binary
- J testMammoth2Json
- C testMammoth2Basic
- M map[testMammoth2Basic]TestMammoth2
- L []TestMammoth2
- A [4]int64
-}
diff --git a/vendor/github.com/ugorji/go/codec/mammoth_generated_test.go b/vendor/github.com/ugorji/go/codec/mammoth_generated_test.go
deleted file mode 100644
index 3e15832cb..000000000
--- a/vendor/github.com/ugorji/go/codec/mammoth_generated_test.go
+++ /dev/null
@@ -1,13188 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-// Code generated from mammoth-test.go.tmpl - DO NOT EDIT.
-
-package codec
-
-import "testing"
-import "fmt"
-import "reflect"
-
-// TestMammoth has all the different paths optimized in fast-path
-// It has all the primitives, slices and maps.
-//
-// For each of those types, it has a pointer and a non-pointer field.
-
-func init() { _ = fmt.Printf } // so we can include fmt as needed
-
-type TestMammoth struct {
- FIntf interface{}
- FptrIntf *interface{}
- FString string
- FptrString *string
- FFloat32 float32
- FptrFloat32 *float32
- FFloat64 float64
- FptrFloat64 *float64
- FUint uint
- FptrUint *uint
- FUint8 uint8
- FptrUint8 *uint8
- FUint16 uint16
- FptrUint16 *uint16
- FUint32 uint32
- FptrUint32 *uint32
- FUint64 uint64
- FptrUint64 *uint64
- FUintptr uintptr
- FptrUintptr *uintptr
- FInt int
- FptrInt *int
- FInt8 int8
- FptrInt8 *int8
- FInt16 int16
- FptrInt16 *int16
- FInt32 int32
- FptrInt32 *int32
- FInt64 int64
- FptrInt64 *int64
- FBool bool
- FptrBool *bool
-
- FSliceIntf []interface{}
- FptrSliceIntf *[]interface{}
- FSliceString []string
- FptrSliceString *[]string
- FSliceFloat32 []float32
- FptrSliceFloat32 *[]float32
- FSliceFloat64 []float64
- FptrSliceFloat64 *[]float64
- FSliceUint []uint
- FptrSliceUint *[]uint
- FSliceUint8 []uint8
- FptrSliceUint8 *[]uint8
- FSliceUint16 []uint16
- FptrSliceUint16 *[]uint16
- FSliceUint32 []uint32
- FptrSliceUint32 *[]uint32
- FSliceUint64 []uint64
- FptrSliceUint64 *[]uint64
- FSliceUintptr []uintptr
- FptrSliceUintptr *[]uintptr
- FSliceInt []int
- FptrSliceInt *[]int
- FSliceInt8 []int8
- FptrSliceInt8 *[]int8
- FSliceInt16 []int16
- FptrSliceInt16 *[]int16
- FSliceInt32 []int32
- FptrSliceInt32 *[]int32
- FSliceInt64 []int64
- FptrSliceInt64 *[]int64
- FSliceBool []bool
- FptrSliceBool *[]bool
-
- FMapIntfIntf map[interface{}]interface{}
- FptrMapIntfIntf *map[interface{}]interface{}
- FMapIntfString map[interface{}]string
- FptrMapIntfString *map[interface{}]string
- FMapIntfUint map[interface{}]uint
- FptrMapIntfUint *map[interface{}]uint
- FMapIntfUint8 map[interface{}]uint8
- FptrMapIntfUint8 *map[interface{}]uint8
- FMapIntfUint16 map[interface{}]uint16
- FptrMapIntfUint16 *map[interface{}]uint16
- FMapIntfUint32 map[interface{}]uint32
- FptrMapIntfUint32 *map[interface{}]uint32
- FMapIntfUint64 map[interface{}]uint64
- FptrMapIntfUint64 *map[interface{}]uint64
- FMapIntfUintptr map[interface{}]uintptr
- FptrMapIntfUintptr *map[interface{}]uintptr
- FMapIntfInt map[interface{}]int
- FptrMapIntfInt *map[interface{}]int
- FMapIntfInt8 map[interface{}]int8
- FptrMapIntfInt8 *map[interface{}]int8
- FMapIntfInt16 map[interface{}]int16
- FptrMapIntfInt16 *map[interface{}]int16
- FMapIntfInt32 map[interface{}]int32
- FptrMapIntfInt32 *map[interface{}]int32
- FMapIntfInt64 map[interface{}]int64
- FptrMapIntfInt64 *map[interface{}]int64
- FMapIntfFloat32 map[interface{}]float32
- FptrMapIntfFloat32 *map[interface{}]float32
- FMapIntfFloat64 map[interface{}]float64
- FptrMapIntfFloat64 *map[interface{}]float64
- FMapIntfBool map[interface{}]bool
- FptrMapIntfBool *map[interface{}]bool
- FMapStringIntf map[string]interface{}
- FptrMapStringIntf *map[string]interface{}
- FMapStringString map[string]string
- FptrMapStringString *map[string]string
- FMapStringUint map[string]uint
- FptrMapStringUint *map[string]uint
- FMapStringUint8 map[string]uint8
- FptrMapStringUint8 *map[string]uint8
- FMapStringUint16 map[string]uint16
- FptrMapStringUint16 *map[string]uint16
- FMapStringUint32 map[string]uint32
- FptrMapStringUint32 *map[string]uint32
- FMapStringUint64 map[string]uint64
- FptrMapStringUint64 *map[string]uint64
- FMapStringUintptr map[string]uintptr
- FptrMapStringUintptr *map[string]uintptr
- FMapStringInt map[string]int
- FptrMapStringInt *map[string]int
- FMapStringInt8 map[string]int8
- FptrMapStringInt8 *map[string]int8
- FMapStringInt16 map[string]int16
- FptrMapStringInt16 *map[string]int16
- FMapStringInt32 map[string]int32
- FptrMapStringInt32 *map[string]int32
- FMapStringInt64 map[string]int64
- FptrMapStringInt64 *map[string]int64
- FMapStringFloat32 map[string]float32
- FptrMapStringFloat32 *map[string]float32
- FMapStringFloat64 map[string]float64
- FptrMapStringFloat64 *map[string]float64
- FMapStringBool map[string]bool
- FptrMapStringBool *map[string]bool
- FMapFloat32Intf map[float32]interface{}
- FptrMapFloat32Intf *map[float32]interface{}
- FMapFloat32String map[float32]string
- FptrMapFloat32String *map[float32]string
- FMapFloat32Uint map[float32]uint
- FptrMapFloat32Uint *map[float32]uint
- FMapFloat32Uint8 map[float32]uint8
- FptrMapFloat32Uint8 *map[float32]uint8
- FMapFloat32Uint16 map[float32]uint16
- FptrMapFloat32Uint16 *map[float32]uint16
- FMapFloat32Uint32 map[float32]uint32
- FptrMapFloat32Uint32 *map[float32]uint32
- FMapFloat32Uint64 map[float32]uint64
- FptrMapFloat32Uint64 *map[float32]uint64
- FMapFloat32Uintptr map[float32]uintptr
- FptrMapFloat32Uintptr *map[float32]uintptr
- FMapFloat32Int map[float32]int
- FptrMapFloat32Int *map[float32]int
- FMapFloat32Int8 map[float32]int8
- FptrMapFloat32Int8 *map[float32]int8
- FMapFloat32Int16 map[float32]int16
- FptrMapFloat32Int16 *map[float32]int16
- FMapFloat32Int32 map[float32]int32
- FptrMapFloat32Int32 *map[float32]int32
- FMapFloat32Int64 map[float32]int64
- FptrMapFloat32Int64 *map[float32]int64
- FMapFloat32Float32 map[float32]float32
- FptrMapFloat32Float32 *map[float32]float32
- FMapFloat32Float64 map[float32]float64
- FptrMapFloat32Float64 *map[float32]float64
- FMapFloat32Bool map[float32]bool
- FptrMapFloat32Bool *map[float32]bool
- FMapFloat64Intf map[float64]interface{}
- FptrMapFloat64Intf *map[float64]interface{}
- FMapFloat64String map[float64]string
- FptrMapFloat64String *map[float64]string
- FMapFloat64Uint map[float64]uint
- FptrMapFloat64Uint *map[float64]uint
- FMapFloat64Uint8 map[float64]uint8
- FptrMapFloat64Uint8 *map[float64]uint8
- FMapFloat64Uint16 map[float64]uint16
- FptrMapFloat64Uint16 *map[float64]uint16
- FMapFloat64Uint32 map[float64]uint32
- FptrMapFloat64Uint32 *map[float64]uint32
- FMapFloat64Uint64 map[float64]uint64
- FptrMapFloat64Uint64 *map[float64]uint64
- FMapFloat64Uintptr map[float64]uintptr
- FptrMapFloat64Uintptr *map[float64]uintptr
- FMapFloat64Int map[float64]int
- FptrMapFloat64Int *map[float64]int
- FMapFloat64Int8 map[float64]int8
- FptrMapFloat64Int8 *map[float64]int8
- FMapFloat64Int16 map[float64]int16
- FptrMapFloat64Int16 *map[float64]int16
- FMapFloat64Int32 map[float64]int32
- FptrMapFloat64Int32 *map[float64]int32
- FMapFloat64Int64 map[float64]int64
- FptrMapFloat64Int64 *map[float64]int64
- FMapFloat64Float32 map[float64]float32
- FptrMapFloat64Float32 *map[float64]float32
- FMapFloat64Float64 map[float64]float64
- FptrMapFloat64Float64 *map[float64]float64
- FMapFloat64Bool map[float64]bool
- FptrMapFloat64Bool *map[float64]bool
- FMapUintIntf map[uint]interface{}
- FptrMapUintIntf *map[uint]interface{}
- FMapUintString map[uint]string
- FptrMapUintString *map[uint]string
- FMapUintUint map[uint]uint
- FptrMapUintUint *map[uint]uint
- FMapUintUint8 map[uint]uint8
- FptrMapUintUint8 *map[uint]uint8
- FMapUintUint16 map[uint]uint16
- FptrMapUintUint16 *map[uint]uint16
- FMapUintUint32 map[uint]uint32
- FptrMapUintUint32 *map[uint]uint32
- FMapUintUint64 map[uint]uint64
- FptrMapUintUint64 *map[uint]uint64
- FMapUintUintptr map[uint]uintptr
- FptrMapUintUintptr *map[uint]uintptr
- FMapUintInt map[uint]int
- FptrMapUintInt *map[uint]int
- FMapUintInt8 map[uint]int8
- FptrMapUintInt8 *map[uint]int8
- FMapUintInt16 map[uint]int16
- FptrMapUintInt16 *map[uint]int16
- FMapUintInt32 map[uint]int32
- FptrMapUintInt32 *map[uint]int32
- FMapUintInt64 map[uint]int64
- FptrMapUintInt64 *map[uint]int64
- FMapUintFloat32 map[uint]float32
- FptrMapUintFloat32 *map[uint]float32
- FMapUintFloat64 map[uint]float64
- FptrMapUintFloat64 *map[uint]float64
- FMapUintBool map[uint]bool
- FptrMapUintBool *map[uint]bool
- FMapUint8Intf map[uint8]interface{}
- FptrMapUint8Intf *map[uint8]interface{}
- FMapUint8String map[uint8]string
- FptrMapUint8String *map[uint8]string
- FMapUint8Uint map[uint8]uint
- FptrMapUint8Uint *map[uint8]uint
- FMapUint8Uint8 map[uint8]uint8
- FptrMapUint8Uint8 *map[uint8]uint8
- FMapUint8Uint16 map[uint8]uint16
- FptrMapUint8Uint16 *map[uint8]uint16
- FMapUint8Uint32 map[uint8]uint32
- FptrMapUint8Uint32 *map[uint8]uint32
- FMapUint8Uint64 map[uint8]uint64
- FptrMapUint8Uint64 *map[uint8]uint64
- FMapUint8Uintptr map[uint8]uintptr
- FptrMapUint8Uintptr *map[uint8]uintptr
- FMapUint8Int map[uint8]int
- FptrMapUint8Int *map[uint8]int
- FMapUint8Int8 map[uint8]int8
- FptrMapUint8Int8 *map[uint8]int8
- FMapUint8Int16 map[uint8]int16
- FptrMapUint8Int16 *map[uint8]int16
- FMapUint8Int32 map[uint8]int32
- FptrMapUint8Int32 *map[uint8]int32
- FMapUint8Int64 map[uint8]int64
- FptrMapUint8Int64 *map[uint8]int64
- FMapUint8Float32 map[uint8]float32
- FptrMapUint8Float32 *map[uint8]float32
- FMapUint8Float64 map[uint8]float64
- FptrMapUint8Float64 *map[uint8]float64
- FMapUint8Bool map[uint8]bool
- FptrMapUint8Bool *map[uint8]bool
- FMapUint16Intf map[uint16]interface{}
- FptrMapUint16Intf *map[uint16]interface{}
- FMapUint16String map[uint16]string
- FptrMapUint16String *map[uint16]string
- FMapUint16Uint map[uint16]uint
- FptrMapUint16Uint *map[uint16]uint
- FMapUint16Uint8 map[uint16]uint8
- FptrMapUint16Uint8 *map[uint16]uint8
- FMapUint16Uint16 map[uint16]uint16
- FptrMapUint16Uint16 *map[uint16]uint16
- FMapUint16Uint32 map[uint16]uint32
- FptrMapUint16Uint32 *map[uint16]uint32
- FMapUint16Uint64 map[uint16]uint64
- FptrMapUint16Uint64 *map[uint16]uint64
- FMapUint16Uintptr map[uint16]uintptr
- FptrMapUint16Uintptr *map[uint16]uintptr
- FMapUint16Int map[uint16]int
- FptrMapUint16Int *map[uint16]int
- FMapUint16Int8 map[uint16]int8
- FptrMapUint16Int8 *map[uint16]int8
- FMapUint16Int16 map[uint16]int16
- FptrMapUint16Int16 *map[uint16]int16
- FMapUint16Int32 map[uint16]int32
- FptrMapUint16Int32 *map[uint16]int32
- FMapUint16Int64 map[uint16]int64
- FptrMapUint16Int64 *map[uint16]int64
- FMapUint16Float32 map[uint16]float32
- FptrMapUint16Float32 *map[uint16]float32
- FMapUint16Float64 map[uint16]float64
- FptrMapUint16Float64 *map[uint16]float64
- FMapUint16Bool map[uint16]bool
- FptrMapUint16Bool *map[uint16]bool
- FMapUint32Intf map[uint32]interface{}
- FptrMapUint32Intf *map[uint32]interface{}
- FMapUint32String map[uint32]string
- FptrMapUint32String *map[uint32]string
- FMapUint32Uint map[uint32]uint
- FptrMapUint32Uint *map[uint32]uint
- FMapUint32Uint8 map[uint32]uint8
- FptrMapUint32Uint8 *map[uint32]uint8
- FMapUint32Uint16 map[uint32]uint16
- FptrMapUint32Uint16 *map[uint32]uint16
- FMapUint32Uint32 map[uint32]uint32
- FptrMapUint32Uint32 *map[uint32]uint32
- FMapUint32Uint64 map[uint32]uint64
- FptrMapUint32Uint64 *map[uint32]uint64
- FMapUint32Uintptr map[uint32]uintptr
- FptrMapUint32Uintptr *map[uint32]uintptr
- FMapUint32Int map[uint32]int
- FptrMapUint32Int *map[uint32]int
- FMapUint32Int8 map[uint32]int8
- FptrMapUint32Int8 *map[uint32]int8
- FMapUint32Int16 map[uint32]int16
- FptrMapUint32Int16 *map[uint32]int16
- FMapUint32Int32 map[uint32]int32
- FptrMapUint32Int32 *map[uint32]int32
- FMapUint32Int64 map[uint32]int64
- FptrMapUint32Int64 *map[uint32]int64
- FMapUint32Float32 map[uint32]float32
- FptrMapUint32Float32 *map[uint32]float32
- FMapUint32Float64 map[uint32]float64
- FptrMapUint32Float64 *map[uint32]float64
- FMapUint32Bool map[uint32]bool
- FptrMapUint32Bool *map[uint32]bool
- FMapUint64Intf map[uint64]interface{}
- FptrMapUint64Intf *map[uint64]interface{}
- FMapUint64String map[uint64]string
- FptrMapUint64String *map[uint64]string
- FMapUint64Uint map[uint64]uint
- FptrMapUint64Uint *map[uint64]uint
- FMapUint64Uint8 map[uint64]uint8
- FptrMapUint64Uint8 *map[uint64]uint8
- FMapUint64Uint16 map[uint64]uint16
- FptrMapUint64Uint16 *map[uint64]uint16
- FMapUint64Uint32 map[uint64]uint32
- FptrMapUint64Uint32 *map[uint64]uint32
- FMapUint64Uint64 map[uint64]uint64
- FptrMapUint64Uint64 *map[uint64]uint64
- FMapUint64Uintptr map[uint64]uintptr
- FptrMapUint64Uintptr *map[uint64]uintptr
- FMapUint64Int map[uint64]int
- FptrMapUint64Int *map[uint64]int
- FMapUint64Int8 map[uint64]int8
- FptrMapUint64Int8 *map[uint64]int8
- FMapUint64Int16 map[uint64]int16
- FptrMapUint64Int16 *map[uint64]int16
- FMapUint64Int32 map[uint64]int32
- FptrMapUint64Int32 *map[uint64]int32
- FMapUint64Int64 map[uint64]int64
- FptrMapUint64Int64 *map[uint64]int64
- FMapUint64Float32 map[uint64]float32
- FptrMapUint64Float32 *map[uint64]float32
- FMapUint64Float64 map[uint64]float64
- FptrMapUint64Float64 *map[uint64]float64
- FMapUint64Bool map[uint64]bool
- FptrMapUint64Bool *map[uint64]bool
- FMapUintptrIntf map[uintptr]interface{}
- FptrMapUintptrIntf *map[uintptr]interface{}
- FMapUintptrString map[uintptr]string
- FptrMapUintptrString *map[uintptr]string
- FMapUintptrUint map[uintptr]uint
- FptrMapUintptrUint *map[uintptr]uint
- FMapUintptrUint8 map[uintptr]uint8
- FptrMapUintptrUint8 *map[uintptr]uint8
- FMapUintptrUint16 map[uintptr]uint16
- FptrMapUintptrUint16 *map[uintptr]uint16
- FMapUintptrUint32 map[uintptr]uint32
- FptrMapUintptrUint32 *map[uintptr]uint32
- FMapUintptrUint64 map[uintptr]uint64
- FptrMapUintptrUint64 *map[uintptr]uint64
- FMapUintptrUintptr map[uintptr]uintptr
- FptrMapUintptrUintptr *map[uintptr]uintptr
- FMapUintptrInt map[uintptr]int
- FptrMapUintptrInt *map[uintptr]int
- FMapUintptrInt8 map[uintptr]int8
- FptrMapUintptrInt8 *map[uintptr]int8
- FMapUintptrInt16 map[uintptr]int16
- FptrMapUintptrInt16 *map[uintptr]int16
- FMapUintptrInt32 map[uintptr]int32
- FptrMapUintptrInt32 *map[uintptr]int32
- FMapUintptrInt64 map[uintptr]int64
- FptrMapUintptrInt64 *map[uintptr]int64
- FMapUintptrFloat32 map[uintptr]float32
- FptrMapUintptrFloat32 *map[uintptr]float32
- FMapUintptrFloat64 map[uintptr]float64
- FptrMapUintptrFloat64 *map[uintptr]float64
- FMapUintptrBool map[uintptr]bool
- FptrMapUintptrBool *map[uintptr]bool
- FMapIntIntf map[int]interface{}
- FptrMapIntIntf *map[int]interface{}
- FMapIntString map[int]string
- FptrMapIntString *map[int]string
- FMapIntUint map[int]uint
- FptrMapIntUint *map[int]uint
- FMapIntUint8 map[int]uint8
- FptrMapIntUint8 *map[int]uint8
- FMapIntUint16 map[int]uint16
- FptrMapIntUint16 *map[int]uint16
- FMapIntUint32 map[int]uint32
- FptrMapIntUint32 *map[int]uint32
- FMapIntUint64 map[int]uint64
- FptrMapIntUint64 *map[int]uint64
- FMapIntUintptr map[int]uintptr
- FptrMapIntUintptr *map[int]uintptr
- FMapIntInt map[int]int
- FptrMapIntInt *map[int]int
- FMapIntInt8 map[int]int8
- FptrMapIntInt8 *map[int]int8
- FMapIntInt16 map[int]int16
- FptrMapIntInt16 *map[int]int16
- FMapIntInt32 map[int]int32
- FptrMapIntInt32 *map[int]int32
- FMapIntInt64 map[int]int64
- FptrMapIntInt64 *map[int]int64
- FMapIntFloat32 map[int]float32
- FptrMapIntFloat32 *map[int]float32
- FMapIntFloat64 map[int]float64
- FptrMapIntFloat64 *map[int]float64
- FMapIntBool map[int]bool
- FptrMapIntBool *map[int]bool
- FMapInt8Intf map[int8]interface{}
- FptrMapInt8Intf *map[int8]interface{}
- FMapInt8String map[int8]string
- FptrMapInt8String *map[int8]string
- FMapInt8Uint map[int8]uint
- FptrMapInt8Uint *map[int8]uint
- FMapInt8Uint8 map[int8]uint8
- FptrMapInt8Uint8 *map[int8]uint8
- FMapInt8Uint16 map[int8]uint16
- FptrMapInt8Uint16 *map[int8]uint16
- FMapInt8Uint32 map[int8]uint32
- FptrMapInt8Uint32 *map[int8]uint32
- FMapInt8Uint64 map[int8]uint64
- FptrMapInt8Uint64 *map[int8]uint64
- FMapInt8Uintptr map[int8]uintptr
- FptrMapInt8Uintptr *map[int8]uintptr
- FMapInt8Int map[int8]int
- FptrMapInt8Int *map[int8]int
- FMapInt8Int8 map[int8]int8
- FptrMapInt8Int8 *map[int8]int8
- FMapInt8Int16 map[int8]int16
- FptrMapInt8Int16 *map[int8]int16
- FMapInt8Int32 map[int8]int32
- FptrMapInt8Int32 *map[int8]int32
- FMapInt8Int64 map[int8]int64
- FptrMapInt8Int64 *map[int8]int64
- FMapInt8Float32 map[int8]float32
- FptrMapInt8Float32 *map[int8]float32
- FMapInt8Float64 map[int8]float64
- FptrMapInt8Float64 *map[int8]float64
- FMapInt8Bool map[int8]bool
- FptrMapInt8Bool *map[int8]bool
- FMapInt16Intf map[int16]interface{}
- FptrMapInt16Intf *map[int16]interface{}
- FMapInt16String map[int16]string
- FptrMapInt16String *map[int16]string
- FMapInt16Uint map[int16]uint
- FptrMapInt16Uint *map[int16]uint
- FMapInt16Uint8 map[int16]uint8
- FptrMapInt16Uint8 *map[int16]uint8
- FMapInt16Uint16 map[int16]uint16
- FptrMapInt16Uint16 *map[int16]uint16
- FMapInt16Uint32 map[int16]uint32
- FptrMapInt16Uint32 *map[int16]uint32
- FMapInt16Uint64 map[int16]uint64
- FptrMapInt16Uint64 *map[int16]uint64
- FMapInt16Uintptr map[int16]uintptr
- FptrMapInt16Uintptr *map[int16]uintptr
- FMapInt16Int map[int16]int
- FptrMapInt16Int *map[int16]int
- FMapInt16Int8 map[int16]int8
- FptrMapInt16Int8 *map[int16]int8
- FMapInt16Int16 map[int16]int16
- FptrMapInt16Int16 *map[int16]int16
- FMapInt16Int32 map[int16]int32
- FptrMapInt16Int32 *map[int16]int32
- FMapInt16Int64 map[int16]int64
- FptrMapInt16Int64 *map[int16]int64
- FMapInt16Float32 map[int16]float32
- FptrMapInt16Float32 *map[int16]float32
- FMapInt16Float64 map[int16]float64
- FptrMapInt16Float64 *map[int16]float64
- FMapInt16Bool map[int16]bool
- FptrMapInt16Bool *map[int16]bool
- FMapInt32Intf map[int32]interface{}
- FptrMapInt32Intf *map[int32]interface{}
- FMapInt32String map[int32]string
- FptrMapInt32String *map[int32]string
- FMapInt32Uint map[int32]uint
- FptrMapInt32Uint *map[int32]uint
- FMapInt32Uint8 map[int32]uint8
- FptrMapInt32Uint8 *map[int32]uint8
- FMapInt32Uint16 map[int32]uint16
- FptrMapInt32Uint16 *map[int32]uint16
- FMapInt32Uint32 map[int32]uint32
- FptrMapInt32Uint32 *map[int32]uint32
- FMapInt32Uint64 map[int32]uint64
- FptrMapInt32Uint64 *map[int32]uint64
- FMapInt32Uintptr map[int32]uintptr
- FptrMapInt32Uintptr *map[int32]uintptr
- FMapInt32Int map[int32]int
- FptrMapInt32Int *map[int32]int
- FMapInt32Int8 map[int32]int8
- FptrMapInt32Int8 *map[int32]int8
- FMapInt32Int16 map[int32]int16
- FptrMapInt32Int16 *map[int32]int16
- FMapInt32Int32 map[int32]int32
- FptrMapInt32Int32 *map[int32]int32
- FMapInt32Int64 map[int32]int64
- FptrMapInt32Int64 *map[int32]int64
- FMapInt32Float32 map[int32]float32
- FptrMapInt32Float32 *map[int32]float32
- FMapInt32Float64 map[int32]float64
- FptrMapInt32Float64 *map[int32]float64
- FMapInt32Bool map[int32]bool
- FptrMapInt32Bool *map[int32]bool
- FMapInt64Intf map[int64]interface{}
- FptrMapInt64Intf *map[int64]interface{}
- FMapInt64String map[int64]string
- FptrMapInt64String *map[int64]string
- FMapInt64Uint map[int64]uint
- FptrMapInt64Uint *map[int64]uint
- FMapInt64Uint8 map[int64]uint8
- FptrMapInt64Uint8 *map[int64]uint8
- FMapInt64Uint16 map[int64]uint16
- FptrMapInt64Uint16 *map[int64]uint16
- FMapInt64Uint32 map[int64]uint32
- FptrMapInt64Uint32 *map[int64]uint32
- FMapInt64Uint64 map[int64]uint64
- FptrMapInt64Uint64 *map[int64]uint64
- FMapInt64Uintptr map[int64]uintptr
- FptrMapInt64Uintptr *map[int64]uintptr
- FMapInt64Int map[int64]int
- FptrMapInt64Int *map[int64]int
- FMapInt64Int8 map[int64]int8
- FptrMapInt64Int8 *map[int64]int8
- FMapInt64Int16 map[int64]int16
- FptrMapInt64Int16 *map[int64]int16
- FMapInt64Int32 map[int64]int32
- FptrMapInt64Int32 *map[int64]int32
- FMapInt64Int64 map[int64]int64
- FptrMapInt64Int64 *map[int64]int64
- FMapInt64Float32 map[int64]float32
- FptrMapInt64Float32 *map[int64]float32
- FMapInt64Float64 map[int64]float64
- FptrMapInt64Float64 *map[int64]float64
- FMapInt64Bool map[int64]bool
- FptrMapInt64Bool *map[int64]bool
- FMapBoolIntf map[bool]interface{}
- FptrMapBoolIntf *map[bool]interface{}
- FMapBoolString map[bool]string
- FptrMapBoolString *map[bool]string
- FMapBoolUint map[bool]uint
- FptrMapBoolUint *map[bool]uint
- FMapBoolUint8 map[bool]uint8
- FptrMapBoolUint8 *map[bool]uint8
- FMapBoolUint16 map[bool]uint16
- FptrMapBoolUint16 *map[bool]uint16
- FMapBoolUint32 map[bool]uint32
- FptrMapBoolUint32 *map[bool]uint32
- FMapBoolUint64 map[bool]uint64
- FptrMapBoolUint64 *map[bool]uint64
- FMapBoolUintptr map[bool]uintptr
- FptrMapBoolUintptr *map[bool]uintptr
- FMapBoolInt map[bool]int
- FptrMapBoolInt *map[bool]int
- FMapBoolInt8 map[bool]int8
- FptrMapBoolInt8 *map[bool]int8
- FMapBoolInt16 map[bool]int16
- FptrMapBoolInt16 *map[bool]int16
- FMapBoolInt32 map[bool]int32
- FptrMapBoolInt32 *map[bool]int32
- FMapBoolInt64 map[bool]int64
- FptrMapBoolInt64 *map[bool]int64
- FMapBoolFloat32 map[bool]float32
- FptrMapBoolFloat32 *map[bool]float32
- FMapBoolFloat64 map[bool]float64
- FptrMapBoolFloat64 *map[bool]float64
- FMapBoolBool map[bool]bool
- FptrMapBoolBool *map[bool]bool
-}
-
-type typMbsSliceIntf []interface{}
-
-func (_ typMbsSliceIntf) MapBySlice() {}
-
-type typMbsSliceString []string
-
-func (_ typMbsSliceString) MapBySlice() {}
-
-type typMbsSliceFloat32 []float32
-
-func (_ typMbsSliceFloat32) MapBySlice() {}
-
-type typMbsSliceFloat64 []float64
-
-func (_ typMbsSliceFloat64) MapBySlice() {}
-
-type typMbsSliceUint []uint
-
-func (_ typMbsSliceUint) MapBySlice() {}
-
-type typMbsSliceUint8 []uint8
-
-func (_ typMbsSliceUint8) MapBySlice() {}
-
-type typMbsSliceUint16 []uint16
-
-func (_ typMbsSliceUint16) MapBySlice() {}
-
-type typMbsSliceUint32 []uint32
-
-func (_ typMbsSliceUint32) MapBySlice() {}
-
-type typMbsSliceUint64 []uint64
-
-func (_ typMbsSliceUint64) MapBySlice() {}
-
-type typMbsSliceUintptr []uintptr
-
-func (_ typMbsSliceUintptr) MapBySlice() {}
-
-type typMbsSliceInt []int
-
-func (_ typMbsSliceInt) MapBySlice() {}
-
-type typMbsSliceInt8 []int8
-
-func (_ typMbsSliceInt8) MapBySlice() {}
-
-type typMbsSliceInt16 []int16
-
-func (_ typMbsSliceInt16) MapBySlice() {}
-
-type typMbsSliceInt32 []int32
-
-func (_ typMbsSliceInt32) MapBySlice() {}
-
-type typMbsSliceInt64 []int64
-
-func (_ typMbsSliceInt64) MapBySlice() {}
-
-type typMbsSliceBool []bool
-
-func (_ typMbsSliceBool) MapBySlice() {}
-
-type typMapMapIntfIntf map[interface{}]interface{}
-type typMapMapIntfString map[interface{}]string
-type typMapMapIntfUint map[interface{}]uint
-type typMapMapIntfUint8 map[interface{}]uint8
-type typMapMapIntfUint16 map[interface{}]uint16
-type typMapMapIntfUint32 map[interface{}]uint32
-type typMapMapIntfUint64 map[interface{}]uint64
-type typMapMapIntfUintptr map[interface{}]uintptr
-type typMapMapIntfInt map[interface{}]int
-type typMapMapIntfInt8 map[interface{}]int8
-type typMapMapIntfInt16 map[interface{}]int16
-type typMapMapIntfInt32 map[interface{}]int32
-type typMapMapIntfInt64 map[interface{}]int64
-type typMapMapIntfFloat32 map[interface{}]float32
-type typMapMapIntfFloat64 map[interface{}]float64
-type typMapMapIntfBool map[interface{}]bool
-type typMapMapStringIntf map[string]interface{}
-type typMapMapStringString map[string]string
-type typMapMapStringUint map[string]uint
-type typMapMapStringUint8 map[string]uint8
-type typMapMapStringUint16 map[string]uint16
-type typMapMapStringUint32 map[string]uint32
-type typMapMapStringUint64 map[string]uint64
-type typMapMapStringUintptr map[string]uintptr
-type typMapMapStringInt map[string]int
-type typMapMapStringInt8 map[string]int8
-type typMapMapStringInt16 map[string]int16
-type typMapMapStringInt32 map[string]int32
-type typMapMapStringInt64 map[string]int64
-type typMapMapStringFloat32 map[string]float32
-type typMapMapStringFloat64 map[string]float64
-type typMapMapStringBool map[string]bool
-type typMapMapFloat32Intf map[float32]interface{}
-type typMapMapFloat32String map[float32]string
-type typMapMapFloat32Uint map[float32]uint
-type typMapMapFloat32Uint8 map[float32]uint8
-type typMapMapFloat32Uint16 map[float32]uint16
-type typMapMapFloat32Uint32 map[float32]uint32
-type typMapMapFloat32Uint64 map[float32]uint64
-type typMapMapFloat32Uintptr map[float32]uintptr
-type typMapMapFloat32Int map[float32]int
-type typMapMapFloat32Int8 map[float32]int8
-type typMapMapFloat32Int16 map[float32]int16
-type typMapMapFloat32Int32 map[float32]int32
-type typMapMapFloat32Int64 map[float32]int64
-type typMapMapFloat32Float32 map[float32]float32
-type typMapMapFloat32Float64 map[float32]float64
-type typMapMapFloat32Bool map[float32]bool
-type typMapMapFloat64Intf map[float64]interface{}
-type typMapMapFloat64String map[float64]string
-type typMapMapFloat64Uint map[float64]uint
-type typMapMapFloat64Uint8 map[float64]uint8
-type typMapMapFloat64Uint16 map[float64]uint16
-type typMapMapFloat64Uint32 map[float64]uint32
-type typMapMapFloat64Uint64 map[float64]uint64
-type typMapMapFloat64Uintptr map[float64]uintptr
-type typMapMapFloat64Int map[float64]int
-type typMapMapFloat64Int8 map[float64]int8
-type typMapMapFloat64Int16 map[float64]int16
-type typMapMapFloat64Int32 map[float64]int32
-type typMapMapFloat64Int64 map[float64]int64
-type typMapMapFloat64Float32 map[float64]float32
-type typMapMapFloat64Float64 map[float64]float64
-type typMapMapFloat64Bool map[float64]bool
-type typMapMapUintIntf map[uint]interface{}
-type typMapMapUintString map[uint]string
-type typMapMapUintUint map[uint]uint
-type typMapMapUintUint8 map[uint]uint8
-type typMapMapUintUint16 map[uint]uint16
-type typMapMapUintUint32 map[uint]uint32
-type typMapMapUintUint64 map[uint]uint64
-type typMapMapUintUintptr map[uint]uintptr
-type typMapMapUintInt map[uint]int
-type typMapMapUintInt8 map[uint]int8
-type typMapMapUintInt16 map[uint]int16
-type typMapMapUintInt32 map[uint]int32
-type typMapMapUintInt64 map[uint]int64
-type typMapMapUintFloat32 map[uint]float32
-type typMapMapUintFloat64 map[uint]float64
-type typMapMapUintBool map[uint]bool
-type typMapMapUint8Intf map[uint8]interface{}
-type typMapMapUint8String map[uint8]string
-type typMapMapUint8Uint map[uint8]uint
-type typMapMapUint8Uint8 map[uint8]uint8
-type typMapMapUint8Uint16 map[uint8]uint16
-type typMapMapUint8Uint32 map[uint8]uint32
-type typMapMapUint8Uint64 map[uint8]uint64
-type typMapMapUint8Uintptr map[uint8]uintptr
-type typMapMapUint8Int map[uint8]int
-type typMapMapUint8Int8 map[uint8]int8
-type typMapMapUint8Int16 map[uint8]int16
-type typMapMapUint8Int32 map[uint8]int32
-type typMapMapUint8Int64 map[uint8]int64
-type typMapMapUint8Float32 map[uint8]float32
-type typMapMapUint8Float64 map[uint8]float64
-type typMapMapUint8Bool map[uint8]bool
-type typMapMapUint16Intf map[uint16]interface{}
-type typMapMapUint16String map[uint16]string
-type typMapMapUint16Uint map[uint16]uint
-type typMapMapUint16Uint8 map[uint16]uint8
-type typMapMapUint16Uint16 map[uint16]uint16
-type typMapMapUint16Uint32 map[uint16]uint32
-type typMapMapUint16Uint64 map[uint16]uint64
-type typMapMapUint16Uintptr map[uint16]uintptr
-type typMapMapUint16Int map[uint16]int
-type typMapMapUint16Int8 map[uint16]int8
-type typMapMapUint16Int16 map[uint16]int16
-type typMapMapUint16Int32 map[uint16]int32
-type typMapMapUint16Int64 map[uint16]int64
-type typMapMapUint16Float32 map[uint16]float32
-type typMapMapUint16Float64 map[uint16]float64
-type typMapMapUint16Bool map[uint16]bool
-type typMapMapUint32Intf map[uint32]interface{}
-type typMapMapUint32String map[uint32]string
-type typMapMapUint32Uint map[uint32]uint
-type typMapMapUint32Uint8 map[uint32]uint8
-type typMapMapUint32Uint16 map[uint32]uint16
-type typMapMapUint32Uint32 map[uint32]uint32
-type typMapMapUint32Uint64 map[uint32]uint64
-type typMapMapUint32Uintptr map[uint32]uintptr
-type typMapMapUint32Int map[uint32]int
-type typMapMapUint32Int8 map[uint32]int8
-type typMapMapUint32Int16 map[uint32]int16
-type typMapMapUint32Int32 map[uint32]int32
-type typMapMapUint32Int64 map[uint32]int64
-type typMapMapUint32Float32 map[uint32]float32
-type typMapMapUint32Float64 map[uint32]float64
-type typMapMapUint32Bool map[uint32]bool
-type typMapMapUint64Intf map[uint64]interface{}
-type typMapMapUint64String map[uint64]string
-type typMapMapUint64Uint map[uint64]uint
-type typMapMapUint64Uint8 map[uint64]uint8
-type typMapMapUint64Uint16 map[uint64]uint16
-type typMapMapUint64Uint32 map[uint64]uint32
-type typMapMapUint64Uint64 map[uint64]uint64
-type typMapMapUint64Uintptr map[uint64]uintptr
-type typMapMapUint64Int map[uint64]int
-type typMapMapUint64Int8 map[uint64]int8
-type typMapMapUint64Int16 map[uint64]int16
-type typMapMapUint64Int32 map[uint64]int32
-type typMapMapUint64Int64 map[uint64]int64
-type typMapMapUint64Float32 map[uint64]float32
-type typMapMapUint64Float64 map[uint64]float64
-type typMapMapUint64Bool map[uint64]bool
-type typMapMapUintptrIntf map[uintptr]interface{}
-type typMapMapUintptrString map[uintptr]string
-type typMapMapUintptrUint map[uintptr]uint
-type typMapMapUintptrUint8 map[uintptr]uint8
-type typMapMapUintptrUint16 map[uintptr]uint16
-type typMapMapUintptrUint32 map[uintptr]uint32
-type typMapMapUintptrUint64 map[uintptr]uint64
-type typMapMapUintptrUintptr map[uintptr]uintptr
-type typMapMapUintptrInt map[uintptr]int
-type typMapMapUintptrInt8 map[uintptr]int8
-type typMapMapUintptrInt16 map[uintptr]int16
-type typMapMapUintptrInt32 map[uintptr]int32
-type typMapMapUintptrInt64 map[uintptr]int64
-type typMapMapUintptrFloat32 map[uintptr]float32
-type typMapMapUintptrFloat64 map[uintptr]float64
-type typMapMapUintptrBool map[uintptr]bool
-type typMapMapIntIntf map[int]interface{}
-type typMapMapIntString map[int]string
-type typMapMapIntUint map[int]uint
-type typMapMapIntUint8 map[int]uint8
-type typMapMapIntUint16 map[int]uint16
-type typMapMapIntUint32 map[int]uint32
-type typMapMapIntUint64 map[int]uint64
-type typMapMapIntUintptr map[int]uintptr
-type typMapMapIntInt map[int]int
-type typMapMapIntInt8 map[int]int8
-type typMapMapIntInt16 map[int]int16
-type typMapMapIntInt32 map[int]int32
-type typMapMapIntInt64 map[int]int64
-type typMapMapIntFloat32 map[int]float32
-type typMapMapIntFloat64 map[int]float64
-type typMapMapIntBool map[int]bool
-type typMapMapInt8Intf map[int8]interface{}
-type typMapMapInt8String map[int8]string
-type typMapMapInt8Uint map[int8]uint
-type typMapMapInt8Uint8 map[int8]uint8
-type typMapMapInt8Uint16 map[int8]uint16
-type typMapMapInt8Uint32 map[int8]uint32
-type typMapMapInt8Uint64 map[int8]uint64
-type typMapMapInt8Uintptr map[int8]uintptr
-type typMapMapInt8Int map[int8]int
-type typMapMapInt8Int8 map[int8]int8
-type typMapMapInt8Int16 map[int8]int16
-type typMapMapInt8Int32 map[int8]int32
-type typMapMapInt8Int64 map[int8]int64
-type typMapMapInt8Float32 map[int8]float32
-type typMapMapInt8Float64 map[int8]float64
-type typMapMapInt8Bool map[int8]bool
-type typMapMapInt16Intf map[int16]interface{}
-type typMapMapInt16String map[int16]string
-type typMapMapInt16Uint map[int16]uint
-type typMapMapInt16Uint8 map[int16]uint8
-type typMapMapInt16Uint16 map[int16]uint16
-type typMapMapInt16Uint32 map[int16]uint32
-type typMapMapInt16Uint64 map[int16]uint64
-type typMapMapInt16Uintptr map[int16]uintptr
-type typMapMapInt16Int map[int16]int
-type typMapMapInt16Int8 map[int16]int8
-type typMapMapInt16Int16 map[int16]int16
-type typMapMapInt16Int32 map[int16]int32
-type typMapMapInt16Int64 map[int16]int64
-type typMapMapInt16Float32 map[int16]float32
-type typMapMapInt16Float64 map[int16]float64
-type typMapMapInt16Bool map[int16]bool
-type typMapMapInt32Intf map[int32]interface{}
-type typMapMapInt32String map[int32]string
-type typMapMapInt32Uint map[int32]uint
-type typMapMapInt32Uint8 map[int32]uint8
-type typMapMapInt32Uint16 map[int32]uint16
-type typMapMapInt32Uint32 map[int32]uint32
-type typMapMapInt32Uint64 map[int32]uint64
-type typMapMapInt32Uintptr map[int32]uintptr
-type typMapMapInt32Int map[int32]int
-type typMapMapInt32Int8 map[int32]int8
-type typMapMapInt32Int16 map[int32]int16
-type typMapMapInt32Int32 map[int32]int32
-type typMapMapInt32Int64 map[int32]int64
-type typMapMapInt32Float32 map[int32]float32
-type typMapMapInt32Float64 map[int32]float64
-type typMapMapInt32Bool map[int32]bool
-type typMapMapInt64Intf map[int64]interface{}
-type typMapMapInt64String map[int64]string
-type typMapMapInt64Uint map[int64]uint
-type typMapMapInt64Uint8 map[int64]uint8
-type typMapMapInt64Uint16 map[int64]uint16
-type typMapMapInt64Uint32 map[int64]uint32
-type typMapMapInt64Uint64 map[int64]uint64
-type typMapMapInt64Uintptr map[int64]uintptr
-type typMapMapInt64Int map[int64]int
-type typMapMapInt64Int8 map[int64]int8
-type typMapMapInt64Int16 map[int64]int16
-type typMapMapInt64Int32 map[int64]int32
-type typMapMapInt64Int64 map[int64]int64
-type typMapMapInt64Float32 map[int64]float32
-type typMapMapInt64Float64 map[int64]float64
-type typMapMapInt64Bool map[int64]bool
-type typMapMapBoolIntf map[bool]interface{}
-type typMapMapBoolString map[bool]string
-type typMapMapBoolUint map[bool]uint
-type typMapMapBoolUint8 map[bool]uint8
-type typMapMapBoolUint16 map[bool]uint16
-type typMapMapBoolUint32 map[bool]uint32
-type typMapMapBoolUint64 map[bool]uint64
-type typMapMapBoolUintptr map[bool]uintptr
-type typMapMapBoolInt map[bool]int
-type typMapMapBoolInt8 map[bool]int8
-type typMapMapBoolInt16 map[bool]int16
-type typMapMapBoolInt32 map[bool]int32
-type typMapMapBoolInt64 map[bool]int64
-type typMapMapBoolFloat32 map[bool]float32
-type typMapMapBoolFloat64 map[bool]float64
-type typMapMapBoolBool map[bool]bool
-
-func doTestMammothSlices(t *testing.T, h Handle) {
-
- var v1va [8]interface{}
- for _, v := range [][]interface{}{nil, {}, {"string-is-an-interface-2", nil, nil, "string-is-an-interface"}} {
- var v1v1, v1v2 []interface{}
- v1v1 = v
- bs1 := testMarshalErr(v1v1, h, t, "enc-slice-v1")
- if v == nil {
- v1v2 = nil
- } else {
- v1v2 = make([]interface{}, len(v))
- }
- testUnmarshalErr(v1v2, bs1, h, t, "dec-slice-v1")
- testDeepEqualErr(v1v1, v1v2, t, "equal-slice-v1")
- if v == nil {
- v1v2 = nil
- } else {
- v1v2 = make([]interface{}, len(v))
- }
- testUnmarshalErr(reflect.ValueOf(v1v2), bs1, h, t, "dec-slice-v1-noaddr") // non-addressable value
- testDeepEqualErr(v1v1, v1v2, t, "equal-slice-v1-noaddr")
- // ...
- bs1 = testMarshalErr(&v1v1, h, t, "enc-slice-v1-p")
- v1v2 = nil
- testUnmarshalErr(&v1v2, bs1, h, t, "dec-slice-v1-p")
- testDeepEqualErr(v1v1, v1v2, t, "equal-slice-v1-p")
- v1va = [8]interface{}{} // clear the array
- v1v2 = v1va[:1:1]
- testUnmarshalErr(&v1v2, bs1, h, t, "dec-slice-v1-p-1")
- testDeepEqualErr(v1v1, v1v2, t, "equal-slice-v1-p-1")
- v1va = [8]interface{}{} // clear the array
- v1v2 = v1va[:len(v1v1):len(v1v1)]
- testUnmarshalErr(&v1v2, bs1, h, t, "dec-slice-v1-p-len")
- testDeepEqualErr(v1v1, v1v2, t, "equal-slice-v1-p-len")
- v1va = [8]interface{}{} // clear the array
- v1v2 = v1va[:]
- testUnmarshalErr(&v1v2, bs1, h, t, "dec-slice-v1-p-cap")
- testDeepEqualErr(v1v1, v1v2, t, "equal-slice-v1-p-cap")
- if len(v1v1) > 1 {
- v1va = [8]interface{}{} // clear the array
- testUnmarshalErr((&v1va)[:len(v1v1)], bs1, h, t, "dec-slice-v1-p-len-noaddr")
- testDeepEqualErr(v1v1, v1va[:len(v1v1)], t, "equal-slice-v1-p-len-noaddr")
- v1va = [8]interface{}{} // clear the array
- testUnmarshalErr((&v1va)[:], bs1, h, t, "dec-slice-v1-p-cap-noaddr")
- testDeepEqualErr(v1v1, v1va[:len(v1v1)], t, "equal-slice-v1-p-cap-noaddr")
- }
- // ...
- var v1v3, v1v4 typMbsSliceIntf
- v1v2 = nil
- if v != nil {
- v1v2 = make([]interface{}, len(v))
- }
- v1v3 = typMbsSliceIntf(v1v1)
- v1v4 = typMbsSliceIntf(v1v2)
- bs1 = testMarshalErr(v1v3, h, t, "enc-slice-v1-custom")
- testUnmarshalErr(v1v4, bs1, h, t, "dec-slice-v1-custom")
- testDeepEqualErr(v1v3, v1v4, t, "equal-slice-v1-custom")
- bs1 = testMarshalErr(&v1v3, h, t, "enc-slice-v1-custom-p")
- v1v2 = nil
- v1v4 = typMbsSliceIntf(v1v2)
- testUnmarshalErr(&v1v4, bs1, h, t, "dec-slice-v1-custom-p")
- testDeepEqualErr(v1v3, v1v4, t, "equal-slice-v1-custom-p")
- }
-
- var v19va [8]string
- for _, v := range [][]string{nil, {}, {"some-string-2", "", "", "some-string"}} {
- var v19v1, v19v2 []string
- v19v1 = v
- bs19 := testMarshalErr(v19v1, h, t, "enc-slice-v19")
- if v == nil {
- v19v2 = nil
- } else {
- v19v2 = make([]string, len(v))
- }
- testUnmarshalErr(v19v2, bs19, h, t, "dec-slice-v19")
- testDeepEqualErr(v19v1, v19v2, t, "equal-slice-v19")
- if v == nil {
- v19v2 = nil
- } else {
- v19v2 = make([]string, len(v))
- }
- testUnmarshalErr(reflect.ValueOf(v19v2), bs19, h, t, "dec-slice-v19-noaddr") // non-addressable value
- testDeepEqualErr(v19v1, v19v2, t, "equal-slice-v19-noaddr")
- // ...
- bs19 = testMarshalErr(&v19v1, h, t, "enc-slice-v19-p")
- v19v2 = nil
- testUnmarshalErr(&v19v2, bs19, h, t, "dec-slice-v19-p")
- testDeepEqualErr(v19v1, v19v2, t, "equal-slice-v19-p")
- v19va = [8]string{} // clear the array
- v19v2 = v19va[:1:1]
- testUnmarshalErr(&v19v2, bs19, h, t, "dec-slice-v19-p-1")
- testDeepEqualErr(v19v1, v19v2, t, "equal-slice-v19-p-1")
- v19va = [8]string{} // clear the array
- v19v2 = v19va[:len(v19v1):len(v19v1)]
- testUnmarshalErr(&v19v2, bs19, h, t, "dec-slice-v19-p-len")
- testDeepEqualErr(v19v1, v19v2, t, "equal-slice-v19-p-len")
- v19va = [8]string{} // clear the array
- v19v2 = v19va[:]
- testUnmarshalErr(&v19v2, bs19, h, t, "dec-slice-v19-p-cap")
- testDeepEqualErr(v19v1, v19v2, t, "equal-slice-v19-p-cap")
- if len(v19v1) > 1 {
- v19va = [8]string{} // clear the array
- testUnmarshalErr((&v19va)[:len(v19v1)], bs19, h, t, "dec-slice-v19-p-len-noaddr")
- testDeepEqualErr(v19v1, v19va[:len(v19v1)], t, "equal-slice-v19-p-len-noaddr")
- v19va = [8]string{} // clear the array
- testUnmarshalErr((&v19va)[:], bs19, h, t, "dec-slice-v19-p-cap-noaddr")
- testDeepEqualErr(v19v1, v19va[:len(v19v1)], t, "equal-slice-v19-p-cap-noaddr")
- }
- // ...
- var v19v3, v19v4 typMbsSliceString
- v19v2 = nil
- if v != nil {
- v19v2 = make([]string, len(v))
- }
- v19v3 = typMbsSliceString(v19v1)
- v19v4 = typMbsSliceString(v19v2)
- bs19 = testMarshalErr(v19v3, h, t, "enc-slice-v19-custom")
- testUnmarshalErr(v19v4, bs19, h, t, "dec-slice-v19-custom")
- testDeepEqualErr(v19v3, v19v4, t, "equal-slice-v19-custom")
- bs19 = testMarshalErr(&v19v3, h, t, "enc-slice-v19-custom-p")
- v19v2 = nil
- v19v4 = typMbsSliceString(v19v2)
- testUnmarshalErr(&v19v4, bs19, h, t, "dec-slice-v19-custom-p")
- testDeepEqualErr(v19v3, v19v4, t, "equal-slice-v19-custom-p")
- }
-
- var v37va [8]float32
- for _, v := range [][]float32{nil, {}, {22.2, 0, 0, 11.1}} {
- var v37v1, v37v2 []float32
- v37v1 = v
- bs37 := testMarshalErr(v37v1, h, t, "enc-slice-v37")
- if v == nil {
- v37v2 = nil
- } else {
- v37v2 = make([]float32, len(v))
- }
- testUnmarshalErr(v37v2, bs37, h, t, "dec-slice-v37")
- testDeepEqualErr(v37v1, v37v2, t, "equal-slice-v37")
- if v == nil {
- v37v2 = nil
- } else {
- v37v2 = make([]float32, len(v))
- }
- testUnmarshalErr(reflect.ValueOf(v37v2), bs37, h, t, "dec-slice-v37-noaddr") // non-addressable value
- testDeepEqualErr(v37v1, v37v2, t, "equal-slice-v37-noaddr")
- // ...
- bs37 = testMarshalErr(&v37v1, h, t, "enc-slice-v37-p")
- v37v2 = nil
- testUnmarshalErr(&v37v2, bs37, h, t, "dec-slice-v37-p")
- testDeepEqualErr(v37v1, v37v2, t, "equal-slice-v37-p")
- v37va = [8]float32{} // clear the array
- v37v2 = v37va[:1:1]
- testUnmarshalErr(&v37v2, bs37, h, t, "dec-slice-v37-p-1")
- testDeepEqualErr(v37v1, v37v2, t, "equal-slice-v37-p-1")
- v37va = [8]float32{} // clear the array
- v37v2 = v37va[:len(v37v1):len(v37v1)]
- testUnmarshalErr(&v37v2, bs37, h, t, "dec-slice-v37-p-len")
- testDeepEqualErr(v37v1, v37v2, t, "equal-slice-v37-p-len")
- v37va = [8]float32{} // clear the array
- v37v2 = v37va[:]
- testUnmarshalErr(&v37v2, bs37, h, t, "dec-slice-v37-p-cap")
- testDeepEqualErr(v37v1, v37v2, t, "equal-slice-v37-p-cap")
- if len(v37v1) > 1 {
- v37va = [8]float32{} // clear the array
- testUnmarshalErr((&v37va)[:len(v37v1)], bs37, h, t, "dec-slice-v37-p-len-noaddr")
- testDeepEqualErr(v37v1, v37va[:len(v37v1)], t, "equal-slice-v37-p-len-noaddr")
- v37va = [8]float32{} // clear the array
- testUnmarshalErr((&v37va)[:], bs37, h, t, "dec-slice-v37-p-cap-noaddr")
- testDeepEqualErr(v37v1, v37va[:len(v37v1)], t, "equal-slice-v37-p-cap-noaddr")
- }
- // ...
- var v37v3, v37v4 typMbsSliceFloat32
- v37v2 = nil
- if v != nil {
- v37v2 = make([]float32, len(v))
- }
- v37v3 = typMbsSliceFloat32(v37v1)
- v37v4 = typMbsSliceFloat32(v37v2)
- bs37 = testMarshalErr(v37v3, h, t, "enc-slice-v37-custom")
- testUnmarshalErr(v37v4, bs37, h, t, "dec-slice-v37-custom")
- testDeepEqualErr(v37v3, v37v4, t, "equal-slice-v37-custom")
- bs37 = testMarshalErr(&v37v3, h, t, "enc-slice-v37-custom-p")
- v37v2 = nil
- v37v4 = typMbsSliceFloat32(v37v2)
- testUnmarshalErr(&v37v4, bs37, h, t, "dec-slice-v37-custom-p")
- testDeepEqualErr(v37v3, v37v4, t, "equal-slice-v37-custom-p")
- }
-
- var v55va [8]float64
- for _, v := range [][]float64{nil, {}, {22.2, 0, 0, 11.1}} {
- var v55v1, v55v2 []float64
- v55v1 = v
- bs55 := testMarshalErr(v55v1, h, t, "enc-slice-v55")
- if v == nil {
- v55v2 = nil
- } else {
- v55v2 = make([]float64, len(v))
- }
- testUnmarshalErr(v55v2, bs55, h, t, "dec-slice-v55")
- testDeepEqualErr(v55v1, v55v2, t, "equal-slice-v55")
- if v == nil {
- v55v2 = nil
- } else {
- v55v2 = make([]float64, len(v))
- }
- testUnmarshalErr(reflect.ValueOf(v55v2), bs55, h, t, "dec-slice-v55-noaddr") // non-addressable value
- testDeepEqualErr(v55v1, v55v2, t, "equal-slice-v55-noaddr")
- // ...
- bs55 = testMarshalErr(&v55v1, h, t, "enc-slice-v55-p")
- v55v2 = nil
- testUnmarshalErr(&v55v2, bs55, h, t, "dec-slice-v55-p")
- testDeepEqualErr(v55v1, v55v2, t, "equal-slice-v55-p")
- v55va = [8]float64{} // clear the array
- v55v2 = v55va[:1:1]
- testUnmarshalErr(&v55v2, bs55, h, t, "dec-slice-v55-p-1")
- testDeepEqualErr(v55v1, v55v2, t, "equal-slice-v55-p-1")
- v55va = [8]float64{} // clear the array
- v55v2 = v55va[:len(v55v1):len(v55v1)]
- testUnmarshalErr(&v55v2, bs55, h, t, "dec-slice-v55-p-len")
- testDeepEqualErr(v55v1, v55v2, t, "equal-slice-v55-p-len")
- v55va = [8]float64{} // clear the array
- v55v2 = v55va[:]
- testUnmarshalErr(&v55v2, bs55, h, t, "dec-slice-v55-p-cap")
- testDeepEqualErr(v55v1, v55v2, t, "equal-slice-v55-p-cap")
- if len(v55v1) > 1 {
- v55va = [8]float64{} // clear the array
- testUnmarshalErr((&v55va)[:len(v55v1)], bs55, h, t, "dec-slice-v55-p-len-noaddr")
- testDeepEqualErr(v55v1, v55va[:len(v55v1)], t, "equal-slice-v55-p-len-noaddr")
- v55va = [8]float64{} // clear the array
- testUnmarshalErr((&v55va)[:], bs55, h, t, "dec-slice-v55-p-cap-noaddr")
- testDeepEqualErr(v55v1, v55va[:len(v55v1)], t, "equal-slice-v55-p-cap-noaddr")
- }
- // ...
- var v55v3, v55v4 typMbsSliceFloat64
- v55v2 = nil
- if v != nil {
- v55v2 = make([]float64, len(v))
- }
- v55v3 = typMbsSliceFloat64(v55v1)
- v55v4 = typMbsSliceFloat64(v55v2)
- bs55 = testMarshalErr(v55v3, h, t, "enc-slice-v55-custom")
- testUnmarshalErr(v55v4, bs55, h, t, "dec-slice-v55-custom")
- testDeepEqualErr(v55v3, v55v4, t, "equal-slice-v55-custom")
- bs55 = testMarshalErr(&v55v3, h, t, "enc-slice-v55-custom-p")
- v55v2 = nil
- v55v4 = typMbsSliceFloat64(v55v2)
- testUnmarshalErr(&v55v4, bs55, h, t, "dec-slice-v55-custom-p")
- testDeepEqualErr(v55v3, v55v4, t, "equal-slice-v55-custom-p")
- }
-
- var v73va [8]uint
- for _, v := range [][]uint{nil, {}, {44, 0, 0, 33}} {
- var v73v1, v73v2 []uint
- v73v1 = v
- bs73 := testMarshalErr(v73v1, h, t, "enc-slice-v73")
- if v == nil {
- v73v2 = nil
- } else {
- v73v2 = make([]uint, len(v))
- }
- testUnmarshalErr(v73v2, bs73, h, t, "dec-slice-v73")
- testDeepEqualErr(v73v1, v73v2, t, "equal-slice-v73")
- if v == nil {
- v73v2 = nil
- } else {
- v73v2 = make([]uint, len(v))
- }
- testUnmarshalErr(reflect.ValueOf(v73v2), bs73, h, t, "dec-slice-v73-noaddr") // non-addressable value
- testDeepEqualErr(v73v1, v73v2, t, "equal-slice-v73-noaddr")
- // ...
- bs73 = testMarshalErr(&v73v1, h, t, "enc-slice-v73-p")
- v73v2 = nil
- testUnmarshalErr(&v73v2, bs73, h, t, "dec-slice-v73-p")
- testDeepEqualErr(v73v1, v73v2, t, "equal-slice-v73-p")
- v73va = [8]uint{} // clear the array
- v73v2 = v73va[:1:1]
- testUnmarshalErr(&v73v2, bs73, h, t, "dec-slice-v73-p-1")
- testDeepEqualErr(v73v1, v73v2, t, "equal-slice-v73-p-1")
- v73va = [8]uint{} // clear the array
- v73v2 = v73va[:len(v73v1):len(v73v1)]
- testUnmarshalErr(&v73v2, bs73, h, t, "dec-slice-v73-p-len")
- testDeepEqualErr(v73v1, v73v2, t, "equal-slice-v73-p-len")
- v73va = [8]uint{} // clear the array
- v73v2 = v73va[:]
- testUnmarshalErr(&v73v2, bs73, h, t, "dec-slice-v73-p-cap")
- testDeepEqualErr(v73v1, v73v2, t, "equal-slice-v73-p-cap")
- if len(v73v1) > 1 {
- v73va = [8]uint{} // clear the array
- testUnmarshalErr((&v73va)[:len(v73v1)], bs73, h, t, "dec-slice-v73-p-len-noaddr")
- testDeepEqualErr(v73v1, v73va[:len(v73v1)], t, "equal-slice-v73-p-len-noaddr")
- v73va = [8]uint{} // clear the array
- testUnmarshalErr((&v73va)[:], bs73, h, t, "dec-slice-v73-p-cap-noaddr")
- testDeepEqualErr(v73v1, v73va[:len(v73v1)], t, "equal-slice-v73-p-cap-noaddr")
- }
- // ...
- var v73v3, v73v4 typMbsSliceUint
- v73v2 = nil
- if v != nil {
- v73v2 = make([]uint, len(v))
- }
- v73v3 = typMbsSliceUint(v73v1)
- v73v4 = typMbsSliceUint(v73v2)
- bs73 = testMarshalErr(v73v3, h, t, "enc-slice-v73-custom")
- testUnmarshalErr(v73v4, bs73, h, t, "dec-slice-v73-custom")
- testDeepEqualErr(v73v3, v73v4, t, "equal-slice-v73-custom")
- bs73 = testMarshalErr(&v73v3, h, t, "enc-slice-v73-custom-p")
- v73v2 = nil
- v73v4 = typMbsSliceUint(v73v2)
- testUnmarshalErr(&v73v4, bs73, h, t, "dec-slice-v73-custom-p")
- testDeepEqualErr(v73v3, v73v4, t, "equal-slice-v73-custom-p")
- }
-
- var v91va [8]uint8
- for _, v := range [][]uint8{nil, {}, {44, 0, 0, 33}} {
- var v91v1, v91v2 []uint8
- v91v1 = v
- bs91 := testMarshalErr(v91v1, h, t, "enc-slice-v91")
- if v == nil {
- v91v2 = nil
- } else {
- v91v2 = make([]uint8, len(v))
- }
- testUnmarshalErr(v91v2, bs91, h, t, "dec-slice-v91")
- testDeepEqualErr(v91v1, v91v2, t, "equal-slice-v91")
- if v == nil {
- v91v2 = nil
- } else {
- v91v2 = make([]uint8, len(v))
- }
- testUnmarshalErr(reflect.ValueOf(v91v2), bs91, h, t, "dec-slice-v91-noaddr") // non-addressable value
- testDeepEqualErr(v91v1, v91v2, t, "equal-slice-v91-noaddr")
- // ...
- bs91 = testMarshalErr(&v91v1, h, t, "enc-slice-v91-p")
- v91v2 = nil
- testUnmarshalErr(&v91v2, bs91, h, t, "dec-slice-v91-p")
- testDeepEqualErr(v91v1, v91v2, t, "equal-slice-v91-p")
- v91va = [8]uint8{} // clear the array
- v91v2 = v91va[:1:1]
- testUnmarshalErr(&v91v2, bs91, h, t, "dec-slice-v91-p-1")
- testDeepEqualErr(v91v1, v91v2, t, "equal-slice-v91-p-1")
- v91va = [8]uint8{} // clear the array
- v91v2 = v91va[:len(v91v1):len(v91v1)]
- testUnmarshalErr(&v91v2, bs91, h, t, "dec-slice-v91-p-len")
- testDeepEqualErr(v91v1, v91v2, t, "equal-slice-v91-p-len")
- v91va = [8]uint8{} // clear the array
- v91v2 = v91va[:]
- testUnmarshalErr(&v91v2, bs91, h, t, "dec-slice-v91-p-cap")
- testDeepEqualErr(v91v1, v91v2, t, "equal-slice-v91-p-cap")
- if len(v91v1) > 1 {
- v91va = [8]uint8{} // clear the array
- testUnmarshalErr((&v91va)[:len(v91v1)], bs91, h, t, "dec-slice-v91-p-len-noaddr")
- testDeepEqualErr(v91v1, v91va[:len(v91v1)], t, "equal-slice-v91-p-len-noaddr")
- v91va = [8]uint8{} // clear the array
- testUnmarshalErr((&v91va)[:], bs91, h, t, "dec-slice-v91-p-cap-noaddr")
- testDeepEqualErr(v91v1, v91va[:len(v91v1)], t, "equal-slice-v91-p-cap-noaddr")
- }
- // ...
- var v91v3, v91v4 typMbsSliceUint8
- v91v2 = nil
- if v != nil {
- v91v2 = make([]uint8, len(v))
- }
- v91v3 = typMbsSliceUint8(v91v1)
- v91v4 = typMbsSliceUint8(v91v2)
- bs91 = testMarshalErr(v91v3, h, t, "enc-slice-v91-custom")
- testUnmarshalErr(v91v4, bs91, h, t, "dec-slice-v91-custom")
- testDeepEqualErr(v91v3, v91v4, t, "equal-slice-v91-custom")
- bs91 = testMarshalErr(&v91v3, h, t, "enc-slice-v91-custom-p")
- v91v2 = nil
- v91v4 = typMbsSliceUint8(v91v2)
- testUnmarshalErr(&v91v4, bs91, h, t, "dec-slice-v91-custom-p")
- testDeepEqualErr(v91v3, v91v4, t, "equal-slice-v91-custom-p")
- }
-
- var v109va [8]uint16
- for _, v := range [][]uint16{nil, {}, {44, 0, 0, 33}} {
- var v109v1, v109v2 []uint16
- v109v1 = v
- bs109 := testMarshalErr(v109v1, h, t, "enc-slice-v109")
- if v == nil {
- v109v2 = nil
- } else {
- v109v2 = make([]uint16, len(v))
- }
- testUnmarshalErr(v109v2, bs109, h, t, "dec-slice-v109")
- testDeepEqualErr(v109v1, v109v2, t, "equal-slice-v109")
- if v == nil {
- v109v2 = nil
- } else {
- v109v2 = make([]uint16, len(v))
- }
- testUnmarshalErr(reflect.ValueOf(v109v2), bs109, h, t, "dec-slice-v109-noaddr") // non-addressable value
- testDeepEqualErr(v109v1, v109v2, t, "equal-slice-v109-noaddr")
- // ...
- bs109 = testMarshalErr(&v109v1, h, t, "enc-slice-v109-p")
- v109v2 = nil
- testUnmarshalErr(&v109v2, bs109, h, t, "dec-slice-v109-p")
- testDeepEqualErr(v109v1, v109v2, t, "equal-slice-v109-p")
- v109va = [8]uint16{} // clear the array
- v109v2 = v109va[:1:1]
- testUnmarshalErr(&v109v2, bs109, h, t, "dec-slice-v109-p-1")
- testDeepEqualErr(v109v1, v109v2, t, "equal-slice-v109-p-1")
- v109va = [8]uint16{} // clear the array
- v109v2 = v109va[:len(v109v1):len(v109v1)]
- testUnmarshalErr(&v109v2, bs109, h, t, "dec-slice-v109-p-len")
- testDeepEqualErr(v109v1, v109v2, t, "equal-slice-v109-p-len")
- v109va = [8]uint16{} // clear the array
- v109v2 = v109va[:]
- testUnmarshalErr(&v109v2, bs109, h, t, "dec-slice-v109-p-cap")
- testDeepEqualErr(v109v1, v109v2, t, "equal-slice-v109-p-cap")
- if len(v109v1) > 1 {
- v109va = [8]uint16{} // clear the array
- testUnmarshalErr((&v109va)[:len(v109v1)], bs109, h, t, "dec-slice-v109-p-len-noaddr")
- testDeepEqualErr(v109v1, v109va[:len(v109v1)], t, "equal-slice-v109-p-len-noaddr")
- v109va = [8]uint16{} // clear the array
- testUnmarshalErr((&v109va)[:], bs109, h, t, "dec-slice-v109-p-cap-noaddr")
- testDeepEqualErr(v109v1, v109va[:len(v109v1)], t, "equal-slice-v109-p-cap-noaddr")
- }
- // ...
- var v109v3, v109v4 typMbsSliceUint16
- v109v2 = nil
- if v != nil {
- v109v2 = make([]uint16, len(v))
- }
- v109v3 = typMbsSliceUint16(v109v1)
- v109v4 = typMbsSliceUint16(v109v2)
- bs109 = testMarshalErr(v109v3, h, t, "enc-slice-v109-custom")
- testUnmarshalErr(v109v4, bs109, h, t, "dec-slice-v109-custom")
- testDeepEqualErr(v109v3, v109v4, t, "equal-slice-v109-custom")
- bs109 = testMarshalErr(&v109v3, h, t, "enc-slice-v109-custom-p")
- v109v2 = nil
- v109v4 = typMbsSliceUint16(v109v2)
- testUnmarshalErr(&v109v4, bs109, h, t, "dec-slice-v109-custom-p")
- testDeepEqualErr(v109v3, v109v4, t, "equal-slice-v109-custom-p")
- }
-
- var v127va [8]uint32
- for _, v := range [][]uint32{nil, {}, {44, 0, 0, 33}} {
- var v127v1, v127v2 []uint32
- v127v1 = v
- bs127 := testMarshalErr(v127v1, h, t, "enc-slice-v127")
- if v == nil {
- v127v2 = nil
- } else {
- v127v2 = make([]uint32, len(v))
- }
- testUnmarshalErr(v127v2, bs127, h, t, "dec-slice-v127")
- testDeepEqualErr(v127v1, v127v2, t, "equal-slice-v127")
- if v == nil {
- v127v2 = nil
- } else {
- v127v2 = make([]uint32, len(v))
- }
- testUnmarshalErr(reflect.ValueOf(v127v2), bs127, h, t, "dec-slice-v127-noaddr") // non-addressable value
- testDeepEqualErr(v127v1, v127v2, t, "equal-slice-v127-noaddr")
- // ...
- bs127 = testMarshalErr(&v127v1, h, t, "enc-slice-v127-p")
- v127v2 = nil
- testUnmarshalErr(&v127v2, bs127, h, t, "dec-slice-v127-p")
- testDeepEqualErr(v127v1, v127v2, t, "equal-slice-v127-p")
- v127va = [8]uint32{} // clear the array
- v127v2 = v127va[:1:1]
- testUnmarshalErr(&v127v2, bs127, h, t, "dec-slice-v127-p-1")
- testDeepEqualErr(v127v1, v127v2, t, "equal-slice-v127-p-1")
- v127va = [8]uint32{} // clear the array
- v127v2 = v127va[:len(v127v1):len(v127v1)]
- testUnmarshalErr(&v127v2, bs127, h, t, "dec-slice-v127-p-len")
- testDeepEqualErr(v127v1, v127v2, t, "equal-slice-v127-p-len")
- v127va = [8]uint32{} // clear the array
- v127v2 = v127va[:]
- testUnmarshalErr(&v127v2, bs127, h, t, "dec-slice-v127-p-cap")
- testDeepEqualErr(v127v1, v127v2, t, "equal-slice-v127-p-cap")
- if len(v127v1) > 1 {
- v127va = [8]uint32{} // clear the array
- testUnmarshalErr((&v127va)[:len(v127v1)], bs127, h, t, "dec-slice-v127-p-len-noaddr")
- testDeepEqualErr(v127v1, v127va[:len(v127v1)], t, "equal-slice-v127-p-len-noaddr")
- v127va = [8]uint32{} // clear the array
- testUnmarshalErr((&v127va)[:], bs127, h, t, "dec-slice-v127-p-cap-noaddr")
- testDeepEqualErr(v127v1, v127va[:len(v127v1)], t, "equal-slice-v127-p-cap-noaddr")
- }
- // ...
- var v127v3, v127v4 typMbsSliceUint32
- v127v2 = nil
- if v != nil {
- v127v2 = make([]uint32, len(v))
- }
- v127v3 = typMbsSliceUint32(v127v1)
- v127v4 = typMbsSliceUint32(v127v2)
- bs127 = testMarshalErr(v127v3, h, t, "enc-slice-v127-custom")
- testUnmarshalErr(v127v4, bs127, h, t, "dec-slice-v127-custom")
- testDeepEqualErr(v127v3, v127v4, t, "equal-slice-v127-custom")
- bs127 = testMarshalErr(&v127v3, h, t, "enc-slice-v127-custom-p")
- v127v2 = nil
- v127v4 = typMbsSliceUint32(v127v2)
- testUnmarshalErr(&v127v4, bs127, h, t, "dec-slice-v127-custom-p")
- testDeepEqualErr(v127v3, v127v4, t, "equal-slice-v127-custom-p")
- }
-
- var v145va [8]uint64
- for _, v := range [][]uint64{nil, {}, {44, 0, 0, 33}} {
- var v145v1, v145v2 []uint64
- v145v1 = v
- bs145 := testMarshalErr(v145v1, h, t, "enc-slice-v145")
- if v == nil {
- v145v2 = nil
- } else {
- v145v2 = make([]uint64, len(v))
- }
- testUnmarshalErr(v145v2, bs145, h, t, "dec-slice-v145")
- testDeepEqualErr(v145v1, v145v2, t, "equal-slice-v145")
- if v == nil {
- v145v2 = nil
- } else {
- v145v2 = make([]uint64, len(v))
- }
- testUnmarshalErr(reflect.ValueOf(v145v2), bs145, h, t, "dec-slice-v145-noaddr") // non-addressable value
- testDeepEqualErr(v145v1, v145v2, t, "equal-slice-v145-noaddr")
- // ...
- bs145 = testMarshalErr(&v145v1, h, t, "enc-slice-v145-p")
- v145v2 = nil
- testUnmarshalErr(&v145v2, bs145, h, t, "dec-slice-v145-p")
- testDeepEqualErr(v145v1, v145v2, t, "equal-slice-v145-p")
- v145va = [8]uint64{} // clear the array
- v145v2 = v145va[:1:1]
- testUnmarshalErr(&v145v2, bs145, h, t, "dec-slice-v145-p-1")
- testDeepEqualErr(v145v1, v145v2, t, "equal-slice-v145-p-1")
- v145va = [8]uint64{} // clear the array
- v145v2 = v145va[:len(v145v1):len(v145v1)]
- testUnmarshalErr(&v145v2, bs145, h, t, "dec-slice-v145-p-len")
- testDeepEqualErr(v145v1, v145v2, t, "equal-slice-v145-p-len")
- v145va = [8]uint64{} // clear the array
- v145v2 = v145va[:]
- testUnmarshalErr(&v145v2, bs145, h, t, "dec-slice-v145-p-cap")
- testDeepEqualErr(v145v1, v145v2, t, "equal-slice-v145-p-cap")
- if len(v145v1) > 1 {
- v145va = [8]uint64{} // clear the array
- testUnmarshalErr((&v145va)[:len(v145v1)], bs145, h, t, "dec-slice-v145-p-len-noaddr")
- testDeepEqualErr(v145v1, v145va[:len(v145v1)], t, "equal-slice-v145-p-len-noaddr")
- v145va = [8]uint64{} // clear the array
- testUnmarshalErr((&v145va)[:], bs145, h, t, "dec-slice-v145-p-cap-noaddr")
- testDeepEqualErr(v145v1, v145va[:len(v145v1)], t, "equal-slice-v145-p-cap-noaddr")
- }
- // ...
- var v145v3, v145v4 typMbsSliceUint64
- v145v2 = nil
- if v != nil {
- v145v2 = make([]uint64, len(v))
- }
- v145v3 = typMbsSliceUint64(v145v1)
- v145v4 = typMbsSliceUint64(v145v2)
- bs145 = testMarshalErr(v145v3, h, t, "enc-slice-v145-custom")
- testUnmarshalErr(v145v4, bs145, h, t, "dec-slice-v145-custom")
- testDeepEqualErr(v145v3, v145v4, t, "equal-slice-v145-custom")
- bs145 = testMarshalErr(&v145v3, h, t, "enc-slice-v145-custom-p")
- v145v2 = nil
- v145v4 = typMbsSliceUint64(v145v2)
- testUnmarshalErr(&v145v4, bs145, h, t, "dec-slice-v145-custom-p")
- testDeepEqualErr(v145v3, v145v4, t, "equal-slice-v145-custom-p")
- }
-
- var v163va [8]uintptr
- for _, v := range [][]uintptr{nil, {}, {44, 0, 0, 33}} {
- var v163v1, v163v2 []uintptr
- v163v1 = v
- bs163 := testMarshalErr(v163v1, h, t, "enc-slice-v163")
- if v == nil {
- v163v2 = nil
- } else {
- v163v2 = make([]uintptr, len(v))
- }
- testUnmarshalErr(v163v2, bs163, h, t, "dec-slice-v163")
- testDeepEqualErr(v163v1, v163v2, t, "equal-slice-v163")
- if v == nil {
- v163v2 = nil
- } else {
- v163v2 = make([]uintptr, len(v))
- }
- testUnmarshalErr(reflect.ValueOf(v163v2), bs163, h, t, "dec-slice-v163-noaddr") // non-addressable value
- testDeepEqualErr(v163v1, v163v2, t, "equal-slice-v163-noaddr")
- // ...
- bs163 = testMarshalErr(&v163v1, h, t, "enc-slice-v163-p")
- v163v2 = nil
- testUnmarshalErr(&v163v2, bs163, h, t, "dec-slice-v163-p")
- testDeepEqualErr(v163v1, v163v2, t, "equal-slice-v163-p")
- v163va = [8]uintptr{} // clear the array
- v163v2 = v163va[:1:1]
- testUnmarshalErr(&v163v2, bs163, h, t, "dec-slice-v163-p-1")
- testDeepEqualErr(v163v1, v163v2, t, "equal-slice-v163-p-1")
- v163va = [8]uintptr{} // clear the array
- v163v2 = v163va[:len(v163v1):len(v163v1)]
- testUnmarshalErr(&v163v2, bs163, h, t, "dec-slice-v163-p-len")
- testDeepEqualErr(v163v1, v163v2, t, "equal-slice-v163-p-len")
- v163va = [8]uintptr{} // clear the array
- v163v2 = v163va[:]
- testUnmarshalErr(&v163v2, bs163, h, t, "dec-slice-v163-p-cap")
- testDeepEqualErr(v163v1, v163v2, t, "equal-slice-v163-p-cap")
- if len(v163v1) > 1 {
- v163va = [8]uintptr{} // clear the array
- testUnmarshalErr((&v163va)[:len(v163v1)], bs163, h, t, "dec-slice-v163-p-len-noaddr")
- testDeepEqualErr(v163v1, v163va[:len(v163v1)], t, "equal-slice-v163-p-len-noaddr")
- v163va = [8]uintptr{} // clear the array
- testUnmarshalErr((&v163va)[:], bs163, h, t, "dec-slice-v163-p-cap-noaddr")
- testDeepEqualErr(v163v1, v163va[:len(v163v1)], t, "equal-slice-v163-p-cap-noaddr")
- }
- // ...
- var v163v3, v163v4 typMbsSliceUintptr
- v163v2 = nil
- if v != nil {
- v163v2 = make([]uintptr, len(v))
- }
- v163v3 = typMbsSliceUintptr(v163v1)
- v163v4 = typMbsSliceUintptr(v163v2)
- bs163 = testMarshalErr(v163v3, h, t, "enc-slice-v163-custom")
- testUnmarshalErr(v163v4, bs163, h, t, "dec-slice-v163-custom")
- testDeepEqualErr(v163v3, v163v4, t, "equal-slice-v163-custom")
- bs163 = testMarshalErr(&v163v3, h, t, "enc-slice-v163-custom-p")
- v163v2 = nil
- v163v4 = typMbsSliceUintptr(v163v2)
- testUnmarshalErr(&v163v4, bs163, h, t, "dec-slice-v163-custom-p")
- testDeepEqualErr(v163v3, v163v4, t, "equal-slice-v163-custom-p")
- }
-
- var v181va [8]int
- for _, v := range [][]int{nil, {}, {44, 0, 0, 33}} {
- var v181v1, v181v2 []int
- v181v1 = v
- bs181 := testMarshalErr(v181v1, h, t, "enc-slice-v181")
- if v == nil {
- v181v2 = nil
- } else {
- v181v2 = make([]int, len(v))
- }
- testUnmarshalErr(v181v2, bs181, h, t, "dec-slice-v181")
- testDeepEqualErr(v181v1, v181v2, t, "equal-slice-v181")
- if v == nil {
- v181v2 = nil
- } else {
- v181v2 = make([]int, len(v))
- }
- testUnmarshalErr(reflect.ValueOf(v181v2), bs181, h, t, "dec-slice-v181-noaddr") // non-addressable value
- testDeepEqualErr(v181v1, v181v2, t, "equal-slice-v181-noaddr")
- // ...
- bs181 = testMarshalErr(&v181v1, h, t, "enc-slice-v181-p")
- v181v2 = nil
- testUnmarshalErr(&v181v2, bs181, h, t, "dec-slice-v181-p")
- testDeepEqualErr(v181v1, v181v2, t, "equal-slice-v181-p")
- v181va = [8]int{} // clear the array
- v181v2 = v181va[:1:1]
- testUnmarshalErr(&v181v2, bs181, h, t, "dec-slice-v181-p-1")
- testDeepEqualErr(v181v1, v181v2, t, "equal-slice-v181-p-1")
- v181va = [8]int{} // clear the array
- v181v2 = v181va[:len(v181v1):len(v181v1)]
- testUnmarshalErr(&v181v2, bs181, h, t, "dec-slice-v181-p-len")
- testDeepEqualErr(v181v1, v181v2, t, "equal-slice-v181-p-len")
- v181va = [8]int{} // clear the array
- v181v2 = v181va[:]
- testUnmarshalErr(&v181v2, bs181, h, t, "dec-slice-v181-p-cap")
- testDeepEqualErr(v181v1, v181v2, t, "equal-slice-v181-p-cap")
- if len(v181v1) > 1 {
- v181va = [8]int{} // clear the array
- testUnmarshalErr((&v181va)[:len(v181v1)], bs181, h, t, "dec-slice-v181-p-len-noaddr")
- testDeepEqualErr(v181v1, v181va[:len(v181v1)], t, "equal-slice-v181-p-len-noaddr")
- v181va = [8]int{} // clear the array
- testUnmarshalErr((&v181va)[:], bs181, h, t, "dec-slice-v181-p-cap-noaddr")
- testDeepEqualErr(v181v1, v181va[:len(v181v1)], t, "equal-slice-v181-p-cap-noaddr")
- }
- // ...
- var v181v3, v181v4 typMbsSliceInt
- v181v2 = nil
- if v != nil {
- v181v2 = make([]int, len(v))
- }
- v181v3 = typMbsSliceInt(v181v1)
- v181v4 = typMbsSliceInt(v181v2)
- bs181 = testMarshalErr(v181v3, h, t, "enc-slice-v181-custom")
- testUnmarshalErr(v181v4, bs181, h, t, "dec-slice-v181-custom")
- testDeepEqualErr(v181v3, v181v4, t, "equal-slice-v181-custom")
- bs181 = testMarshalErr(&v181v3, h, t, "enc-slice-v181-custom-p")
- v181v2 = nil
- v181v4 = typMbsSliceInt(v181v2)
- testUnmarshalErr(&v181v4, bs181, h, t, "dec-slice-v181-custom-p")
- testDeepEqualErr(v181v3, v181v4, t, "equal-slice-v181-custom-p")
- }
-
- var v199va [8]int8
- for _, v := range [][]int8{nil, {}, {44, 0, 0, 33}} {
- var v199v1, v199v2 []int8
- v199v1 = v
- bs199 := testMarshalErr(v199v1, h, t, "enc-slice-v199")
- if v == nil {
- v199v2 = nil
- } else {
- v199v2 = make([]int8, len(v))
- }
- testUnmarshalErr(v199v2, bs199, h, t, "dec-slice-v199")
- testDeepEqualErr(v199v1, v199v2, t, "equal-slice-v199")
- if v == nil {
- v199v2 = nil
- } else {
- v199v2 = make([]int8, len(v))
- }
- testUnmarshalErr(reflect.ValueOf(v199v2), bs199, h, t, "dec-slice-v199-noaddr") // non-addressable value
- testDeepEqualErr(v199v1, v199v2, t, "equal-slice-v199-noaddr")
- // ...
- bs199 = testMarshalErr(&v199v1, h, t, "enc-slice-v199-p")
- v199v2 = nil
- testUnmarshalErr(&v199v2, bs199, h, t, "dec-slice-v199-p")
- testDeepEqualErr(v199v1, v199v2, t, "equal-slice-v199-p")
- v199va = [8]int8{} // clear the array
- v199v2 = v199va[:1:1]
- testUnmarshalErr(&v199v2, bs199, h, t, "dec-slice-v199-p-1")
- testDeepEqualErr(v199v1, v199v2, t, "equal-slice-v199-p-1")
- v199va = [8]int8{} // clear the array
- v199v2 = v199va[:len(v199v1):len(v199v1)]
- testUnmarshalErr(&v199v2, bs199, h, t, "dec-slice-v199-p-len")
- testDeepEqualErr(v199v1, v199v2, t, "equal-slice-v199-p-len")
- v199va = [8]int8{} // clear the array
- v199v2 = v199va[:]
- testUnmarshalErr(&v199v2, bs199, h, t, "dec-slice-v199-p-cap")
- testDeepEqualErr(v199v1, v199v2, t, "equal-slice-v199-p-cap")
- if len(v199v1) > 1 {
- v199va = [8]int8{} // clear the array
- testUnmarshalErr((&v199va)[:len(v199v1)], bs199, h, t, "dec-slice-v199-p-len-noaddr")
- testDeepEqualErr(v199v1, v199va[:len(v199v1)], t, "equal-slice-v199-p-len-noaddr")
- v199va = [8]int8{} // clear the array
- testUnmarshalErr((&v199va)[:], bs199, h, t, "dec-slice-v199-p-cap-noaddr")
- testDeepEqualErr(v199v1, v199va[:len(v199v1)], t, "equal-slice-v199-p-cap-noaddr")
- }
- // ...
- var v199v3, v199v4 typMbsSliceInt8
- v199v2 = nil
- if v != nil {
- v199v2 = make([]int8, len(v))
- }
- v199v3 = typMbsSliceInt8(v199v1)
- v199v4 = typMbsSliceInt8(v199v2)
- bs199 = testMarshalErr(v199v3, h, t, "enc-slice-v199-custom")
- testUnmarshalErr(v199v4, bs199, h, t, "dec-slice-v199-custom")
- testDeepEqualErr(v199v3, v199v4, t, "equal-slice-v199-custom")
- bs199 = testMarshalErr(&v199v3, h, t, "enc-slice-v199-custom-p")
- v199v2 = nil
- v199v4 = typMbsSliceInt8(v199v2)
- testUnmarshalErr(&v199v4, bs199, h, t, "dec-slice-v199-custom-p")
- testDeepEqualErr(v199v3, v199v4, t, "equal-slice-v199-custom-p")
- }
-
- var v217va [8]int16
- for _, v := range [][]int16{nil, {}, {44, 0, 0, 33}} {
- var v217v1, v217v2 []int16
- v217v1 = v
- bs217 := testMarshalErr(v217v1, h, t, "enc-slice-v217")
- if v == nil {
- v217v2 = nil
- } else {
- v217v2 = make([]int16, len(v))
- }
- testUnmarshalErr(v217v2, bs217, h, t, "dec-slice-v217")
- testDeepEqualErr(v217v1, v217v2, t, "equal-slice-v217")
- if v == nil {
- v217v2 = nil
- } else {
- v217v2 = make([]int16, len(v))
- }
- testUnmarshalErr(reflect.ValueOf(v217v2), bs217, h, t, "dec-slice-v217-noaddr") // non-addressable value
- testDeepEqualErr(v217v1, v217v2, t, "equal-slice-v217-noaddr")
- // ...
- bs217 = testMarshalErr(&v217v1, h, t, "enc-slice-v217-p")
- v217v2 = nil
- testUnmarshalErr(&v217v2, bs217, h, t, "dec-slice-v217-p")
- testDeepEqualErr(v217v1, v217v2, t, "equal-slice-v217-p")
- v217va = [8]int16{} // clear the array
- v217v2 = v217va[:1:1]
- testUnmarshalErr(&v217v2, bs217, h, t, "dec-slice-v217-p-1")
- testDeepEqualErr(v217v1, v217v2, t, "equal-slice-v217-p-1")
- v217va = [8]int16{} // clear the array
- v217v2 = v217va[:len(v217v1):len(v217v1)]
- testUnmarshalErr(&v217v2, bs217, h, t, "dec-slice-v217-p-len")
- testDeepEqualErr(v217v1, v217v2, t, "equal-slice-v217-p-len")
- v217va = [8]int16{} // clear the array
- v217v2 = v217va[:]
- testUnmarshalErr(&v217v2, bs217, h, t, "dec-slice-v217-p-cap")
- testDeepEqualErr(v217v1, v217v2, t, "equal-slice-v217-p-cap")
- if len(v217v1) > 1 {
- v217va = [8]int16{} // clear the array
- testUnmarshalErr((&v217va)[:len(v217v1)], bs217, h, t, "dec-slice-v217-p-len-noaddr")
- testDeepEqualErr(v217v1, v217va[:len(v217v1)], t, "equal-slice-v217-p-len-noaddr")
- v217va = [8]int16{} // clear the array
- testUnmarshalErr((&v217va)[:], bs217, h, t, "dec-slice-v217-p-cap-noaddr")
- testDeepEqualErr(v217v1, v217va[:len(v217v1)], t, "equal-slice-v217-p-cap-noaddr")
- }
- // ...
- var v217v3, v217v4 typMbsSliceInt16
- v217v2 = nil
- if v != nil {
- v217v2 = make([]int16, len(v))
- }
- v217v3 = typMbsSliceInt16(v217v1)
- v217v4 = typMbsSliceInt16(v217v2)
- bs217 = testMarshalErr(v217v3, h, t, "enc-slice-v217-custom")
- testUnmarshalErr(v217v4, bs217, h, t, "dec-slice-v217-custom")
- testDeepEqualErr(v217v3, v217v4, t, "equal-slice-v217-custom")
- bs217 = testMarshalErr(&v217v3, h, t, "enc-slice-v217-custom-p")
- v217v2 = nil
- v217v4 = typMbsSliceInt16(v217v2)
- testUnmarshalErr(&v217v4, bs217, h, t, "dec-slice-v217-custom-p")
- testDeepEqualErr(v217v3, v217v4, t, "equal-slice-v217-custom-p")
- }
-
- var v235va [8]int32
- for _, v := range [][]int32{nil, {}, {44, 0, 0, 33}} {
- var v235v1, v235v2 []int32
- v235v1 = v
- bs235 := testMarshalErr(v235v1, h, t, "enc-slice-v235")
- if v == nil {
- v235v2 = nil
- } else {
- v235v2 = make([]int32, len(v))
- }
- testUnmarshalErr(v235v2, bs235, h, t, "dec-slice-v235")
- testDeepEqualErr(v235v1, v235v2, t, "equal-slice-v235")
- if v == nil {
- v235v2 = nil
- } else {
- v235v2 = make([]int32, len(v))
- }
- testUnmarshalErr(reflect.ValueOf(v235v2), bs235, h, t, "dec-slice-v235-noaddr") // non-addressable value
- testDeepEqualErr(v235v1, v235v2, t, "equal-slice-v235-noaddr")
- // ...
- bs235 = testMarshalErr(&v235v1, h, t, "enc-slice-v235-p")
- v235v2 = nil
- testUnmarshalErr(&v235v2, bs235, h, t, "dec-slice-v235-p")
- testDeepEqualErr(v235v1, v235v2, t, "equal-slice-v235-p")
- v235va = [8]int32{} // clear the array
- v235v2 = v235va[:1:1]
- testUnmarshalErr(&v235v2, bs235, h, t, "dec-slice-v235-p-1")
- testDeepEqualErr(v235v1, v235v2, t, "equal-slice-v235-p-1")
- v235va = [8]int32{} // clear the array
- v235v2 = v235va[:len(v235v1):len(v235v1)]
- testUnmarshalErr(&v235v2, bs235, h, t, "dec-slice-v235-p-len")
- testDeepEqualErr(v235v1, v235v2, t, "equal-slice-v235-p-len")
- v235va = [8]int32{} // clear the array
- v235v2 = v235va[:]
- testUnmarshalErr(&v235v2, bs235, h, t, "dec-slice-v235-p-cap")
- testDeepEqualErr(v235v1, v235v2, t, "equal-slice-v235-p-cap")
- if len(v235v1) > 1 {
- v235va = [8]int32{} // clear the array
- testUnmarshalErr((&v235va)[:len(v235v1)], bs235, h, t, "dec-slice-v235-p-len-noaddr")
- testDeepEqualErr(v235v1, v235va[:len(v235v1)], t, "equal-slice-v235-p-len-noaddr")
- v235va = [8]int32{} // clear the array
- testUnmarshalErr((&v235va)[:], bs235, h, t, "dec-slice-v235-p-cap-noaddr")
- testDeepEqualErr(v235v1, v235va[:len(v235v1)], t, "equal-slice-v235-p-cap-noaddr")
- }
- // ...
- var v235v3, v235v4 typMbsSliceInt32
- v235v2 = nil
- if v != nil {
- v235v2 = make([]int32, len(v))
- }
- v235v3 = typMbsSliceInt32(v235v1)
- v235v4 = typMbsSliceInt32(v235v2)
- bs235 = testMarshalErr(v235v3, h, t, "enc-slice-v235-custom")
- testUnmarshalErr(v235v4, bs235, h, t, "dec-slice-v235-custom")
- testDeepEqualErr(v235v3, v235v4, t, "equal-slice-v235-custom")
- bs235 = testMarshalErr(&v235v3, h, t, "enc-slice-v235-custom-p")
- v235v2 = nil
- v235v4 = typMbsSliceInt32(v235v2)
- testUnmarshalErr(&v235v4, bs235, h, t, "dec-slice-v235-custom-p")
- testDeepEqualErr(v235v3, v235v4, t, "equal-slice-v235-custom-p")
- }
-
- var v253va [8]int64
- for _, v := range [][]int64{nil, {}, {44, 0, 0, 33}} {
- var v253v1, v253v2 []int64
- v253v1 = v
- bs253 := testMarshalErr(v253v1, h, t, "enc-slice-v253")
- if v == nil {
- v253v2 = nil
- } else {
- v253v2 = make([]int64, len(v))
- }
- testUnmarshalErr(v253v2, bs253, h, t, "dec-slice-v253")
- testDeepEqualErr(v253v1, v253v2, t, "equal-slice-v253")
- if v == nil {
- v253v2 = nil
- } else {
- v253v2 = make([]int64, len(v))
- }
- testUnmarshalErr(reflect.ValueOf(v253v2), bs253, h, t, "dec-slice-v253-noaddr") // non-addressable value
- testDeepEqualErr(v253v1, v253v2, t, "equal-slice-v253-noaddr")
- // ...
- bs253 = testMarshalErr(&v253v1, h, t, "enc-slice-v253-p")
- v253v2 = nil
- testUnmarshalErr(&v253v2, bs253, h, t, "dec-slice-v253-p")
- testDeepEqualErr(v253v1, v253v2, t, "equal-slice-v253-p")
- v253va = [8]int64{} // clear the array
- v253v2 = v253va[:1:1]
- testUnmarshalErr(&v253v2, bs253, h, t, "dec-slice-v253-p-1")
- testDeepEqualErr(v253v1, v253v2, t, "equal-slice-v253-p-1")
- v253va = [8]int64{} // clear the array
- v253v2 = v253va[:len(v253v1):len(v253v1)]
- testUnmarshalErr(&v253v2, bs253, h, t, "dec-slice-v253-p-len")
- testDeepEqualErr(v253v1, v253v2, t, "equal-slice-v253-p-len")
- v253va = [8]int64{} // clear the array
- v253v2 = v253va[:]
- testUnmarshalErr(&v253v2, bs253, h, t, "dec-slice-v253-p-cap")
- testDeepEqualErr(v253v1, v253v2, t, "equal-slice-v253-p-cap")
- if len(v253v1) > 1 {
- v253va = [8]int64{} // clear the array
- testUnmarshalErr((&v253va)[:len(v253v1)], bs253, h, t, "dec-slice-v253-p-len-noaddr")
- testDeepEqualErr(v253v1, v253va[:len(v253v1)], t, "equal-slice-v253-p-len-noaddr")
- v253va = [8]int64{} // clear the array
- testUnmarshalErr((&v253va)[:], bs253, h, t, "dec-slice-v253-p-cap-noaddr")
- testDeepEqualErr(v253v1, v253va[:len(v253v1)], t, "equal-slice-v253-p-cap-noaddr")
- }
- // ...
- var v253v3, v253v4 typMbsSliceInt64
- v253v2 = nil
- if v != nil {
- v253v2 = make([]int64, len(v))
- }
- v253v3 = typMbsSliceInt64(v253v1)
- v253v4 = typMbsSliceInt64(v253v2)
- bs253 = testMarshalErr(v253v3, h, t, "enc-slice-v253-custom")
- testUnmarshalErr(v253v4, bs253, h, t, "dec-slice-v253-custom")
- testDeepEqualErr(v253v3, v253v4, t, "equal-slice-v253-custom")
- bs253 = testMarshalErr(&v253v3, h, t, "enc-slice-v253-custom-p")
- v253v2 = nil
- v253v4 = typMbsSliceInt64(v253v2)
- testUnmarshalErr(&v253v4, bs253, h, t, "dec-slice-v253-custom-p")
- testDeepEqualErr(v253v3, v253v4, t, "equal-slice-v253-custom-p")
- }
-
- var v271va [8]bool
- for _, v := range [][]bool{nil, {}, {true, false, false, true}} {
- var v271v1, v271v2 []bool
- v271v1 = v
- bs271 := testMarshalErr(v271v1, h, t, "enc-slice-v271")
- if v == nil {
- v271v2 = nil
- } else {
- v271v2 = make([]bool, len(v))
- }
- testUnmarshalErr(v271v2, bs271, h, t, "dec-slice-v271")
- testDeepEqualErr(v271v1, v271v2, t, "equal-slice-v271")
- if v == nil {
- v271v2 = nil
- } else {
- v271v2 = make([]bool, len(v))
- }
- testUnmarshalErr(reflect.ValueOf(v271v2), bs271, h, t, "dec-slice-v271-noaddr") // non-addressable value
- testDeepEqualErr(v271v1, v271v2, t, "equal-slice-v271-noaddr")
- // ...
- bs271 = testMarshalErr(&v271v1, h, t, "enc-slice-v271-p")
- v271v2 = nil
- testUnmarshalErr(&v271v2, bs271, h, t, "dec-slice-v271-p")
- testDeepEqualErr(v271v1, v271v2, t, "equal-slice-v271-p")
- v271va = [8]bool{} // clear the array
- v271v2 = v271va[:1:1]
- testUnmarshalErr(&v271v2, bs271, h, t, "dec-slice-v271-p-1")
- testDeepEqualErr(v271v1, v271v2, t, "equal-slice-v271-p-1")
- v271va = [8]bool{} // clear the array
- v271v2 = v271va[:len(v271v1):len(v271v1)]
- testUnmarshalErr(&v271v2, bs271, h, t, "dec-slice-v271-p-len")
- testDeepEqualErr(v271v1, v271v2, t, "equal-slice-v271-p-len")
- v271va = [8]bool{} // clear the array
- v271v2 = v271va[:]
- testUnmarshalErr(&v271v2, bs271, h, t, "dec-slice-v271-p-cap")
- testDeepEqualErr(v271v1, v271v2, t, "equal-slice-v271-p-cap")
- if len(v271v1) > 1 {
- v271va = [8]bool{} // clear the array
- testUnmarshalErr((&v271va)[:len(v271v1)], bs271, h, t, "dec-slice-v271-p-len-noaddr")
- testDeepEqualErr(v271v1, v271va[:len(v271v1)], t, "equal-slice-v271-p-len-noaddr")
- v271va = [8]bool{} // clear the array
- testUnmarshalErr((&v271va)[:], bs271, h, t, "dec-slice-v271-p-cap-noaddr")
- testDeepEqualErr(v271v1, v271va[:len(v271v1)], t, "equal-slice-v271-p-cap-noaddr")
- }
- // ...
- var v271v3, v271v4 typMbsSliceBool
- v271v2 = nil
- if v != nil {
- v271v2 = make([]bool, len(v))
- }
- v271v3 = typMbsSliceBool(v271v1)
- v271v4 = typMbsSliceBool(v271v2)
- bs271 = testMarshalErr(v271v3, h, t, "enc-slice-v271-custom")
- testUnmarshalErr(v271v4, bs271, h, t, "dec-slice-v271-custom")
- testDeepEqualErr(v271v3, v271v4, t, "equal-slice-v271-custom")
- bs271 = testMarshalErr(&v271v3, h, t, "enc-slice-v271-custom-p")
- v271v2 = nil
- v271v4 = typMbsSliceBool(v271v2)
- testUnmarshalErr(&v271v4, bs271, h, t, "dec-slice-v271-custom-p")
- testDeepEqualErr(v271v3, v271v4, t, "equal-slice-v271-custom-p")
- }
-
-}
-
-func doTestMammothMaps(t *testing.T, h Handle) {
-
- for _, v := range []map[interface{}]interface{}{nil, {}, {"string-is-an-interface-2": nil, "string-is-an-interface": "string-is-an-interface-2"}} {
- // fmt.Printf(">>>> running mammoth map v2: %v\n", v)
- var v2v1, v2v2 map[interface{}]interface{}
- v2v1 = v
- bs2 := testMarshalErr(v2v1, h, t, "enc-map-v2")
- if v == nil {
- v2v2 = nil
- } else {
- v2v2 = make(map[interface{}]interface{}, len(v))
- } // reset map
- testUnmarshalErr(v2v2, bs2, h, t, "dec-map-v2")
- testDeepEqualErr(v2v1, v2v2, t, "equal-map-v2")
- if v == nil {
- v2v2 = nil
- } else {
- v2v2 = make(map[interface{}]interface{}, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v2v2), bs2, h, t, "dec-map-v2-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v2v1, v2v2, t, "equal-map-v2-noaddr")
- if v == nil {
- v2v2 = nil
- } else {
- v2v2 = make(map[interface{}]interface{}, len(v))
- } // reset map
- testUnmarshalErr(&v2v2, bs2, h, t, "dec-map-v2-p-len")
- testDeepEqualErr(v2v1, v2v2, t, "equal-map-v2-p-len")
- bs2 = testMarshalErr(&v2v1, h, t, "enc-map-v2-p")
- v2v2 = nil
- testUnmarshalErr(&v2v2, bs2, h, t, "dec-map-v2-p-nil")
- testDeepEqualErr(v2v1, v2v2, t, "equal-map-v2-p-nil")
- // ...
- if v == nil {
- v2v2 = nil
- } else {
- v2v2 = make(map[interface{}]interface{}, len(v))
- } // reset map
- var v2v3, v2v4 typMapMapIntfIntf
- v2v3 = typMapMapIntfIntf(v2v1)
- v2v4 = typMapMapIntfIntf(v2v2)
- bs2 = testMarshalErr(v2v3, h, t, "enc-map-v2-custom")
- testUnmarshalErr(v2v4, bs2, h, t, "dec-map-v2-p-len")
- testDeepEqualErr(v2v3, v2v4, t, "equal-map-v2-p-len")
- }
-
- for _, v := range []map[interface{}]string{nil, {}, {"string-is-an-interface": "", "string-is-an-interface-2": "some-string-2"}} {
- // fmt.Printf(">>>> running mammoth map v3: %v\n", v)
- var v3v1, v3v2 map[interface{}]string
- v3v1 = v
- bs3 := testMarshalErr(v3v1, h, t, "enc-map-v3")
- if v == nil {
- v3v2 = nil
- } else {
- v3v2 = make(map[interface{}]string, len(v))
- } // reset map
- testUnmarshalErr(v3v2, bs3, h, t, "dec-map-v3")
- testDeepEqualErr(v3v1, v3v2, t, "equal-map-v3")
- if v == nil {
- v3v2 = nil
- } else {
- v3v2 = make(map[interface{}]string, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v3v2), bs3, h, t, "dec-map-v3-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v3v1, v3v2, t, "equal-map-v3-noaddr")
- if v == nil {
- v3v2 = nil
- } else {
- v3v2 = make(map[interface{}]string, len(v))
- } // reset map
- testUnmarshalErr(&v3v2, bs3, h, t, "dec-map-v3-p-len")
- testDeepEqualErr(v3v1, v3v2, t, "equal-map-v3-p-len")
- bs3 = testMarshalErr(&v3v1, h, t, "enc-map-v3-p")
- v3v2 = nil
- testUnmarshalErr(&v3v2, bs3, h, t, "dec-map-v3-p-nil")
- testDeepEqualErr(v3v1, v3v2, t, "equal-map-v3-p-nil")
- // ...
- if v == nil {
- v3v2 = nil
- } else {
- v3v2 = make(map[interface{}]string, len(v))
- } // reset map
- var v3v3, v3v4 typMapMapIntfString
- v3v3 = typMapMapIntfString(v3v1)
- v3v4 = typMapMapIntfString(v3v2)
- bs3 = testMarshalErr(v3v3, h, t, "enc-map-v3-custom")
- testUnmarshalErr(v3v4, bs3, h, t, "dec-map-v3-p-len")
- testDeepEqualErr(v3v3, v3v4, t, "equal-map-v3-p-len")
- }
-
- for _, v := range []map[interface{}]uint{nil, {}, {"string-is-an-interface": 0, "string-is-an-interface-2": 44}} {
- // fmt.Printf(">>>> running mammoth map v4: %v\n", v)
- var v4v1, v4v2 map[interface{}]uint
- v4v1 = v
- bs4 := testMarshalErr(v4v1, h, t, "enc-map-v4")
- if v == nil {
- v4v2 = nil
- } else {
- v4v2 = make(map[interface{}]uint, len(v))
- } // reset map
- testUnmarshalErr(v4v2, bs4, h, t, "dec-map-v4")
- testDeepEqualErr(v4v1, v4v2, t, "equal-map-v4")
- if v == nil {
- v4v2 = nil
- } else {
- v4v2 = make(map[interface{}]uint, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v4v2), bs4, h, t, "dec-map-v4-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v4v1, v4v2, t, "equal-map-v4-noaddr")
- if v == nil {
- v4v2 = nil
- } else {
- v4v2 = make(map[interface{}]uint, len(v))
- } // reset map
- testUnmarshalErr(&v4v2, bs4, h, t, "dec-map-v4-p-len")
- testDeepEqualErr(v4v1, v4v2, t, "equal-map-v4-p-len")
- bs4 = testMarshalErr(&v4v1, h, t, "enc-map-v4-p")
- v4v2 = nil
- testUnmarshalErr(&v4v2, bs4, h, t, "dec-map-v4-p-nil")
- testDeepEqualErr(v4v1, v4v2, t, "equal-map-v4-p-nil")
- // ...
- if v == nil {
- v4v2 = nil
- } else {
- v4v2 = make(map[interface{}]uint, len(v))
- } // reset map
- var v4v3, v4v4 typMapMapIntfUint
- v4v3 = typMapMapIntfUint(v4v1)
- v4v4 = typMapMapIntfUint(v4v2)
- bs4 = testMarshalErr(v4v3, h, t, "enc-map-v4-custom")
- testUnmarshalErr(v4v4, bs4, h, t, "dec-map-v4-p-len")
- testDeepEqualErr(v4v3, v4v4, t, "equal-map-v4-p-len")
- }
-
- for _, v := range []map[interface{}]uint8{nil, {}, {"string-is-an-interface": 0, "string-is-an-interface-2": 33}} {
- // fmt.Printf(">>>> running mammoth map v5: %v\n", v)
- var v5v1, v5v2 map[interface{}]uint8
- v5v1 = v
- bs5 := testMarshalErr(v5v1, h, t, "enc-map-v5")
- if v == nil {
- v5v2 = nil
- } else {
- v5v2 = make(map[interface{}]uint8, len(v))
- } // reset map
- testUnmarshalErr(v5v2, bs5, h, t, "dec-map-v5")
- testDeepEqualErr(v5v1, v5v2, t, "equal-map-v5")
- if v == nil {
- v5v2 = nil
- } else {
- v5v2 = make(map[interface{}]uint8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v5v2), bs5, h, t, "dec-map-v5-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v5v1, v5v2, t, "equal-map-v5-noaddr")
- if v == nil {
- v5v2 = nil
- } else {
- v5v2 = make(map[interface{}]uint8, len(v))
- } // reset map
- testUnmarshalErr(&v5v2, bs5, h, t, "dec-map-v5-p-len")
- testDeepEqualErr(v5v1, v5v2, t, "equal-map-v5-p-len")
- bs5 = testMarshalErr(&v5v1, h, t, "enc-map-v5-p")
- v5v2 = nil
- testUnmarshalErr(&v5v2, bs5, h, t, "dec-map-v5-p-nil")
- testDeepEqualErr(v5v1, v5v2, t, "equal-map-v5-p-nil")
- // ...
- if v == nil {
- v5v2 = nil
- } else {
- v5v2 = make(map[interface{}]uint8, len(v))
- } // reset map
- var v5v3, v5v4 typMapMapIntfUint8
- v5v3 = typMapMapIntfUint8(v5v1)
- v5v4 = typMapMapIntfUint8(v5v2)
- bs5 = testMarshalErr(v5v3, h, t, "enc-map-v5-custom")
- testUnmarshalErr(v5v4, bs5, h, t, "dec-map-v5-p-len")
- testDeepEqualErr(v5v3, v5v4, t, "equal-map-v5-p-len")
- }
-
- for _, v := range []map[interface{}]uint16{nil, {}, {"string-is-an-interface": 0, "string-is-an-interface-2": 44}} {
- // fmt.Printf(">>>> running mammoth map v6: %v\n", v)
- var v6v1, v6v2 map[interface{}]uint16
- v6v1 = v
- bs6 := testMarshalErr(v6v1, h, t, "enc-map-v6")
- if v == nil {
- v6v2 = nil
- } else {
- v6v2 = make(map[interface{}]uint16, len(v))
- } // reset map
- testUnmarshalErr(v6v2, bs6, h, t, "dec-map-v6")
- testDeepEqualErr(v6v1, v6v2, t, "equal-map-v6")
- if v == nil {
- v6v2 = nil
- } else {
- v6v2 = make(map[interface{}]uint16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v6v2), bs6, h, t, "dec-map-v6-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v6v1, v6v2, t, "equal-map-v6-noaddr")
- if v == nil {
- v6v2 = nil
- } else {
- v6v2 = make(map[interface{}]uint16, len(v))
- } // reset map
- testUnmarshalErr(&v6v2, bs6, h, t, "dec-map-v6-p-len")
- testDeepEqualErr(v6v1, v6v2, t, "equal-map-v6-p-len")
- bs6 = testMarshalErr(&v6v1, h, t, "enc-map-v6-p")
- v6v2 = nil
- testUnmarshalErr(&v6v2, bs6, h, t, "dec-map-v6-p-nil")
- testDeepEqualErr(v6v1, v6v2, t, "equal-map-v6-p-nil")
- // ...
- if v == nil {
- v6v2 = nil
- } else {
- v6v2 = make(map[interface{}]uint16, len(v))
- } // reset map
- var v6v3, v6v4 typMapMapIntfUint16
- v6v3 = typMapMapIntfUint16(v6v1)
- v6v4 = typMapMapIntfUint16(v6v2)
- bs6 = testMarshalErr(v6v3, h, t, "enc-map-v6-custom")
- testUnmarshalErr(v6v4, bs6, h, t, "dec-map-v6-p-len")
- testDeepEqualErr(v6v3, v6v4, t, "equal-map-v6-p-len")
- }
-
- for _, v := range []map[interface{}]uint32{nil, {}, {"string-is-an-interface": 0, "string-is-an-interface-2": 33}} {
- // fmt.Printf(">>>> running mammoth map v7: %v\n", v)
- var v7v1, v7v2 map[interface{}]uint32
- v7v1 = v
- bs7 := testMarshalErr(v7v1, h, t, "enc-map-v7")
- if v == nil {
- v7v2 = nil
- } else {
- v7v2 = make(map[interface{}]uint32, len(v))
- } // reset map
- testUnmarshalErr(v7v2, bs7, h, t, "dec-map-v7")
- testDeepEqualErr(v7v1, v7v2, t, "equal-map-v7")
- if v == nil {
- v7v2 = nil
- } else {
- v7v2 = make(map[interface{}]uint32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v7v2), bs7, h, t, "dec-map-v7-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v7v1, v7v2, t, "equal-map-v7-noaddr")
- if v == nil {
- v7v2 = nil
- } else {
- v7v2 = make(map[interface{}]uint32, len(v))
- } // reset map
- testUnmarshalErr(&v7v2, bs7, h, t, "dec-map-v7-p-len")
- testDeepEqualErr(v7v1, v7v2, t, "equal-map-v7-p-len")
- bs7 = testMarshalErr(&v7v1, h, t, "enc-map-v7-p")
- v7v2 = nil
- testUnmarshalErr(&v7v2, bs7, h, t, "dec-map-v7-p-nil")
- testDeepEqualErr(v7v1, v7v2, t, "equal-map-v7-p-nil")
- // ...
- if v == nil {
- v7v2 = nil
- } else {
- v7v2 = make(map[interface{}]uint32, len(v))
- } // reset map
- var v7v3, v7v4 typMapMapIntfUint32
- v7v3 = typMapMapIntfUint32(v7v1)
- v7v4 = typMapMapIntfUint32(v7v2)
- bs7 = testMarshalErr(v7v3, h, t, "enc-map-v7-custom")
- testUnmarshalErr(v7v4, bs7, h, t, "dec-map-v7-p-len")
- testDeepEqualErr(v7v3, v7v4, t, "equal-map-v7-p-len")
- }
-
- for _, v := range []map[interface{}]uint64{nil, {}, {"string-is-an-interface": 0, "string-is-an-interface-2": 44}} {
- // fmt.Printf(">>>> running mammoth map v8: %v\n", v)
- var v8v1, v8v2 map[interface{}]uint64
- v8v1 = v
- bs8 := testMarshalErr(v8v1, h, t, "enc-map-v8")
- if v == nil {
- v8v2 = nil
- } else {
- v8v2 = make(map[interface{}]uint64, len(v))
- } // reset map
- testUnmarshalErr(v8v2, bs8, h, t, "dec-map-v8")
- testDeepEqualErr(v8v1, v8v2, t, "equal-map-v8")
- if v == nil {
- v8v2 = nil
- } else {
- v8v2 = make(map[interface{}]uint64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v8v2), bs8, h, t, "dec-map-v8-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v8v1, v8v2, t, "equal-map-v8-noaddr")
- if v == nil {
- v8v2 = nil
- } else {
- v8v2 = make(map[interface{}]uint64, len(v))
- } // reset map
- testUnmarshalErr(&v8v2, bs8, h, t, "dec-map-v8-p-len")
- testDeepEqualErr(v8v1, v8v2, t, "equal-map-v8-p-len")
- bs8 = testMarshalErr(&v8v1, h, t, "enc-map-v8-p")
- v8v2 = nil
- testUnmarshalErr(&v8v2, bs8, h, t, "dec-map-v8-p-nil")
- testDeepEqualErr(v8v1, v8v2, t, "equal-map-v8-p-nil")
- // ...
- if v == nil {
- v8v2 = nil
- } else {
- v8v2 = make(map[interface{}]uint64, len(v))
- } // reset map
- var v8v3, v8v4 typMapMapIntfUint64
- v8v3 = typMapMapIntfUint64(v8v1)
- v8v4 = typMapMapIntfUint64(v8v2)
- bs8 = testMarshalErr(v8v3, h, t, "enc-map-v8-custom")
- testUnmarshalErr(v8v4, bs8, h, t, "dec-map-v8-p-len")
- testDeepEqualErr(v8v3, v8v4, t, "equal-map-v8-p-len")
- }
-
- for _, v := range []map[interface{}]uintptr{nil, {}, {"string-is-an-interface": 0, "string-is-an-interface-2": 33}} {
- // fmt.Printf(">>>> running mammoth map v9: %v\n", v)
- var v9v1, v9v2 map[interface{}]uintptr
- v9v1 = v
- bs9 := testMarshalErr(v9v1, h, t, "enc-map-v9")
- if v == nil {
- v9v2 = nil
- } else {
- v9v2 = make(map[interface{}]uintptr, len(v))
- } // reset map
- testUnmarshalErr(v9v2, bs9, h, t, "dec-map-v9")
- testDeepEqualErr(v9v1, v9v2, t, "equal-map-v9")
- if v == nil {
- v9v2 = nil
- } else {
- v9v2 = make(map[interface{}]uintptr, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v9v2), bs9, h, t, "dec-map-v9-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v9v1, v9v2, t, "equal-map-v9-noaddr")
- if v == nil {
- v9v2 = nil
- } else {
- v9v2 = make(map[interface{}]uintptr, len(v))
- } // reset map
- testUnmarshalErr(&v9v2, bs9, h, t, "dec-map-v9-p-len")
- testDeepEqualErr(v9v1, v9v2, t, "equal-map-v9-p-len")
- bs9 = testMarshalErr(&v9v1, h, t, "enc-map-v9-p")
- v9v2 = nil
- testUnmarshalErr(&v9v2, bs9, h, t, "dec-map-v9-p-nil")
- testDeepEqualErr(v9v1, v9v2, t, "equal-map-v9-p-nil")
- // ...
- if v == nil {
- v9v2 = nil
- } else {
- v9v2 = make(map[interface{}]uintptr, len(v))
- } // reset map
- var v9v3, v9v4 typMapMapIntfUintptr
- v9v3 = typMapMapIntfUintptr(v9v1)
- v9v4 = typMapMapIntfUintptr(v9v2)
- bs9 = testMarshalErr(v9v3, h, t, "enc-map-v9-custom")
- testUnmarshalErr(v9v4, bs9, h, t, "dec-map-v9-p-len")
- testDeepEqualErr(v9v3, v9v4, t, "equal-map-v9-p-len")
- }
-
- for _, v := range []map[interface{}]int{nil, {}, {"string-is-an-interface": 0, "string-is-an-interface-2": 44}} {
- // fmt.Printf(">>>> running mammoth map v10: %v\n", v)
- var v10v1, v10v2 map[interface{}]int
- v10v1 = v
- bs10 := testMarshalErr(v10v1, h, t, "enc-map-v10")
- if v == nil {
- v10v2 = nil
- } else {
- v10v2 = make(map[interface{}]int, len(v))
- } // reset map
- testUnmarshalErr(v10v2, bs10, h, t, "dec-map-v10")
- testDeepEqualErr(v10v1, v10v2, t, "equal-map-v10")
- if v == nil {
- v10v2 = nil
- } else {
- v10v2 = make(map[interface{}]int, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v10v2), bs10, h, t, "dec-map-v10-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v10v1, v10v2, t, "equal-map-v10-noaddr")
- if v == nil {
- v10v2 = nil
- } else {
- v10v2 = make(map[interface{}]int, len(v))
- } // reset map
- testUnmarshalErr(&v10v2, bs10, h, t, "dec-map-v10-p-len")
- testDeepEqualErr(v10v1, v10v2, t, "equal-map-v10-p-len")
- bs10 = testMarshalErr(&v10v1, h, t, "enc-map-v10-p")
- v10v2 = nil
- testUnmarshalErr(&v10v2, bs10, h, t, "dec-map-v10-p-nil")
- testDeepEqualErr(v10v1, v10v2, t, "equal-map-v10-p-nil")
- // ...
- if v == nil {
- v10v2 = nil
- } else {
- v10v2 = make(map[interface{}]int, len(v))
- } // reset map
- var v10v3, v10v4 typMapMapIntfInt
- v10v3 = typMapMapIntfInt(v10v1)
- v10v4 = typMapMapIntfInt(v10v2)
- bs10 = testMarshalErr(v10v3, h, t, "enc-map-v10-custom")
- testUnmarshalErr(v10v4, bs10, h, t, "dec-map-v10-p-len")
- testDeepEqualErr(v10v3, v10v4, t, "equal-map-v10-p-len")
- }
-
- for _, v := range []map[interface{}]int8{nil, {}, {"string-is-an-interface": 0, "string-is-an-interface-2": 33}} {
- // fmt.Printf(">>>> running mammoth map v11: %v\n", v)
- var v11v1, v11v2 map[interface{}]int8
- v11v1 = v
- bs11 := testMarshalErr(v11v1, h, t, "enc-map-v11")
- if v == nil {
- v11v2 = nil
- } else {
- v11v2 = make(map[interface{}]int8, len(v))
- } // reset map
- testUnmarshalErr(v11v2, bs11, h, t, "dec-map-v11")
- testDeepEqualErr(v11v1, v11v2, t, "equal-map-v11")
- if v == nil {
- v11v2 = nil
- } else {
- v11v2 = make(map[interface{}]int8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v11v2), bs11, h, t, "dec-map-v11-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v11v1, v11v2, t, "equal-map-v11-noaddr")
- if v == nil {
- v11v2 = nil
- } else {
- v11v2 = make(map[interface{}]int8, len(v))
- } // reset map
- testUnmarshalErr(&v11v2, bs11, h, t, "dec-map-v11-p-len")
- testDeepEqualErr(v11v1, v11v2, t, "equal-map-v11-p-len")
- bs11 = testMarshalErr(&v11v1, h, t, "enc-map-v11-p")
- v11v2 = nil
- testUnmarshalErr(&v11v2, bs11, h, t, "dec-map-v11-p-nil")
- testDeepEqualErr(v11v1, v11v2, t, "equal-map-v11-p-nil")
- // ...
- if v == nil {
- v11v2 = nil
- } else {
- v11v2 = make(map[interface{}]int8, len(v))
- } // reset map
- var v11v3, v11v4 typMapMapIntfInt8
- v11v3 = typMapMapIntfInt8(v11v1)
- v11v4 = typMapMapIntfInt8(v11v2)
- bs11 = testMarshalErr(v11v3, h, t, "enc-map-v11-custom")
- testUnmarshalErr(v11v4, bs11, h, t, "dec-map-v11-p-len")
- testDeepEqualErr(v11v3, v11v4, t, "equal-map-v11-p-len")
- }
-
- for _, v := range []map[interface{}]int16{nil, {}, {"string-is-an-interface": 0, "string-is-an-interface-2": 44}} {
- // fmt.Printf(">>>> running mammoth map v12: %v\n", v)
- var v12v1, v12v2 map[interface{}]int16
- v12v1 = v
- bs12 := testMarshalErr(v12v1, h, t, "enc-map-v12")
- if v == nil {
- v12v2 = nil
- } else {
- v12v2 = make(map[interface{}]int16, len(v))
- } // reset map
- testUnmarshalErr(v12v2, bs12, h, t, "dec-map-v12")
- testDeepEqualErr(v12v1, v12v2, t, "equal-map-v12")
- if v == nil {
- v12v2 = nil
- } else {
- v12v2 = make(map[interface{}]int16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v12v2), bs12, h, t, "dec-map-v12-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v12v1, v12v2, t, "equal-map-v12-noaddr")
- if v == nil {
- v12v2 = nil
- } else {
- v12v2 = make(map[interface{}]int16, len(v))
- } // reset map
- testUnmarshalErr(&v12v2, bs12, h, t, "dec-map-v12-p-len")
- testDeepEqualErr(v12v1, v12v2, t, "equal-map-v12-p-len")
- bs12 = testMarshalErr(&v12v1, h, t, "enc-map-v12-p")
- v12v2 = nil
- testUnmarshalErr(&v12v2, bs12, h, t, "dec-map-v12-p-nil")
- testDeepEqualErr(v12v1, v12v2, t, "equal-map-v12-p-nil")
- // ...
- if v == nil {
- v12v2 = nil
- } else {
- v12v2 = make(map[interface{}]int16, len(v))
- } // reset map
- var v12v3, v12v4 typMapMapIntfInt16
- v12v3 = typMapMapIntfInt16(v12v1)
- v12v4 = typMapMapIntfInt16(v12v2)
- bs12 = testMarshalErr(v12v3, h, t, "enc-map-v12-custom")
- testUnmarshalErr(v12v4, bs12, h, t, "dec-map-v12-p-len")
- testDeepEqualErr(v12v3, v12v4, t, "equal-map-v12-p-len")
- }
-
- for _, v := range []map[interface{}]int32{nil, {}, {"string-is-an-interface": 0, "string-is-an-interface-2": 33}} {
- // fmt.Printf(">>>> running mammoth map v13: %v\n", v)
- var v13v1, v13v2 map[interface{}]int32
- v13v1 = v
- bs13 := testMarshalErr(v13v1, h, t, "enc-map-v13")
- if v == nil {
- v13v2 = nil
- } else {
- v13v2 = make(map[interface{}]int32, len(v))
- } // reset map
- testUnmarshalErr(v13v2, bs13, h, t, "dec-map-v13")
- testDeepEqualErr(v13v1, v13v2, t, "equal-map-v13")
- if v == nil {
- v13v2 = nil
- } else {
- v13v2 = make(map[interface{}]int32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v13v2), bs13, h, t, "dec-map-v13-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v13v1, v13v2, t, "equal-map-v13-noaddr")
- if v == nil {
- v13v2 = nil
- } else {
- v13v2 = make(map[interface{}]int32, len(v))
- } // reset map
- testUnmarshalErr(&v13v2, bs13, h, t, "dec-map-v13-p-len")
- testDeepEqualErr(v13v1, v13v2, t, "equal-map-v13-p-len")
- bs13 = testMarshalErr(&v13v1, h, t, "enc-map-v13-p")
- v13v2 = nil
- testUnmarshalErr(&v13v2, bs13, h, t, "dec-map-v13-p-nil")
- testDeepEqualErr(v13v1, v13v2, t, "equal-map-v13-p-nil")
- // ...
- if v == nil {
- v13v2 = nil
- } else {
- v13v2 = make(map[interface{}]int32, len(v))
- } // reset map
- var v13v3, v13v4 typMapMapIntfInt32
- v13v3 = typMapMapIntfInt32(v13v1)
- v13v4 = typMapMapIntfInt32(v13v2)
- bs13 = testMarshalErr(v13v3, h, t, "enc-map-v13-custom")
- testUnmarshalErr(v13v4, bs13, h, t, "dec-map-v13-p-len")
- testDeepEqualErr(v13v3, v13v4, t, "equal-map-v13-p-len")
- }
-
- for _, v := range []map[interface{}]int64{nil, {}, {"string-is-an-interface": 0, "string-is-an-interface-2": 44}} {
- // fmt.Printf(">>>> running mammoth map v14: %v\n", v)
- var v14v1, v14v2 map[interface{}]int64
- v14v1 = v
- bs14 := testMarshalErr(v14v1, h, t, "enc-map-v14")
- if v == nil {
- v14v2 = nil
- } else {
- v14v2 = make(map[interface{}]int64, len(v))
- } // reset map
- testUnmarshalErr(v14v2, bs14, h, t, "dec-map-v14")
- testDeepEqualErr(v14v1, v14v2, t, "equal-map-v14")
- if v == nil {
- v14v2 = nil
- } else {
- v14v2 = make(map[interface{}]int64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v14v2), bs14, h, t, "dec-map-v14-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v14v1, v14v2, t, "equal-map-v14-noaddr")
- if v == nil {
- v14v2 = nil
- } else {
- v14v2 = make(map[interface{}]int64, len(v))
- } // reset map
- testUnmarshalErr(&v14v2, bs14, h, t, "dec-map-v14-p-len")
- testDeepEqualErr(v14v1, v14v2, t, "equal-map-v14-p-len")
- bs14 = testMarshalErr(&v14v1, h, t, "enc-map-v14-p")
- v14v2 = nil
- testUnmarshalErr(&v14v2, bs14, h, t, "dec-map-v14-p-nil")
- testDeepEqualErr(v14v1, v14v2, t, "equal-map-v14-p-nil")
- // ...
- if v == nil {
- v14v2 = nil
- } else {
- v14v2 = make(map[interface{}]int64, len(v))
- } // reset map
- var v14v3, v14v4 typMapMapIntfInt64
- v14v3 = typMapMapIntfInt64(v14v1)
- v14v4 = typMapMapIntfInt64(v14v2)
- bs14 = testMarshalErr(v14v3, h, t, "enc-map-v14-custom")
- testUnmarshalErr(v14v4, bs14, h, t, "dec-map-v14-p-len")
- testDeepEqualErr(v14v3, v14v4, t, "equal-map-v14-p-len")
- }
-
- for _, v := range []map[interface{}]float32{nil, {}, {"string-is-an-interface": 0, "string-is-an-interface-2": 22.2}} {
- // fmt.Printf(">>>> running mammoth map v15: %v\n", v)
- var v15v1, v15v2 map[interface{}]float32
- v15v1 = v
- bs15 := testMarshalErr(v15v1, h, t, "enc-map-v15")
- if v == nil {
- v15v2 = nil
- } else {
- v15v2 = make(map[interface{}]float32, len(v))
- } // reset map
- testUnmarshalErr(v15v2, bs15, h, t, "dec-map-v15")
- testDeepEqualErr(v15v1, v15v2, t, "equal-map-v15")
- if v == nil {
- v15v2 = nil
- } else {
- v15v2 = make(map[interface{}]float32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v15v2), bs15, h, t, "dec-map-v15-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v15v1, v15v2, t, "equal-map-v15-noaddr")
- if v == nil {
- v15v2 = nil
- } else {
- v15v2 = make(map[interface{}]float32, len(v))
- } // reset map
- testUnmarshalErr(&v15v2, bs15, h, t, "dec-map-v15-p-len")
- testDeepEqualErr(v15v1, v15v2, t, "equal-map-v15-p-len")
- bs15 = testMarshalErr(&v15v1, h, t, "enc-map-v15-p")
- v15v2 = nil
- testUnmarshalErr(&v15v2, bs15, h, t, "dec-map-v15-p-nil")
- testDeepEqualErr(v15v1, v15v2, t, "equal-map-v15-p-nil")
- // ...
- if v == nil {
- v15v2 = nil
- } else {
- v15v2 = make(map[interface{}]float32, len(v))
- } // reset map
- var v15v3, v15v4 typMapMapIntfFloat32
- v15v3 = typMapMapIntfFloat32(v15v1)
- v15v4 = typMapMapIntfFloat32(v15v2)
- bs15 = testMarshalErr(v15v3, h, t, "enc-map-v15-custom")
- testUnmarshalErr(v15v4, bs15, h, t, "dec-map-v15-p-len")
- testDeepEqualErr(v15v3, v15v4, t, "equal-map-v15-p-len")
- }
-
- for _, v := range []map[interface{}]float64{nil, {}, {"string-is-an-interface": 0, "string-is-an-interface-2": 11.1}} {
- // fmt.Printf(">>>> running mammoth map v16: %v\n", v)
- var v16v1, v16v2 map[interface{}]float64
- v16v1 = v
- bs16 := testMarshalErr(v16v1, h, t, "enc-map-v16")
- if v == nil {
- v16v2 = nil
- } else {
- v16v2 = make(map[interface{}]float64, len(v))
- } // reset map
- testUnmarshalErr(v16v2, bs16, h, t, "dec-map-v16")
- testDeepEqualErr(v16v1, v16v2, t, "equal-map-v16")
- if v == nil {
- v16v2 = nil
- } else {
- v16v2 = make(map[interface{}]float64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v16v2), bs16, h, t, "dec-map-v16-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v16v1, v16v2, t, "equal-map-v16-noaddr")
- if v == nil {
- v16v2 = nil
- } else {
- v16v2 = make(map[interface{}]float64, len(v))
- } // reset map
- testUnmarshalErr(&v16v2, bs16, h, t, "dec-map-v16-p-len")
- testDeepEqualErr(v16v1, v16v2, t, "equal-map-v16-p-len")
- bs16 = testMarshalErr(&v16v1, h, t, "enc-map-v16-p")
- v16v2 = nil
- testUnmarshalErr(&v16v2, bs16, h, t, "dec-map-v16-p-nil")
- testDeepEqualErr(v16v1, v16v2, t, "equal-map-v16-p-nil")
- // ...
- if v == nil {
- v16v2 = nil
- } else {
- v16v2 = make(map[interface{}]float64, len(v))
- } // reset map
- var v16v3, v16v4 typMapMapIntfFloat64
- v16v3 = typMapMapIntfFloat64(v16v1)
- v16v4 = typMapMapIntfFloat64(v16v2)
- bs16 = testMarshalErr(v16v3, h, t, "enc-map-v16-custom")
- testUnmarshalErr(v16v4, bs16, h, t, "dec-map-v16-p-len")
- testDeepEqualErr(v16v3, v16v4, t, "equal-map-v16-p-len")
- }
-
- for _, v := range []map[interface{}]bool{nil, {}, {"string-is-an-interface": false, "string-is-an-interface-2": true}} {
- // fmt.Printf(">>>> running mammoth map v17: %v\n", v)
- var v17v1, v17v2 map[interface{}]bool
- v17v1 = v
- bs17 := testMarshalErr(v17v1, h, t, "enc-map-v17")
- if v == nil {
- v17v2 = nil
- } else {
- v17v2 = make(map[interface{}]bool, len(v))
- } // reset map
- testUnmarshalErr(v17v2, bs17, h, t, "dec-map-v17")
- testDeepEqualErr(v17v1, v17v2, t, "equal-map-v17")
- if v == nil {
- v17v2 = nil
- } else {
- v17v2 = make(map[interface{}]bool, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v17v2), bs17, h, t, "dec-map-v17-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v17v1, v17v2, t, "equal-map-v17-noaddr")
- if v == nil {
- v17v2 = nil
- } else {
- v17v2 = make(map[interface{}]bool, len(v))
- } // reset map
- testUnmarshalErr(&v17v2, bs17, h, t, "dec-map-v17-p-len")
- testDeepEqualErr(v17v1, v17v2, t, "equal-map-v17-p-len")
- bs17 = testMarshalErr(&v17v1, h, t, "enc-map-v17-p")
- v17v2 = nil
- testUnmarshalErr(&v17v2, bs17, h, t, "dec-map-v17-p-nil")
- testDeepEqualErr(v17v1, v17v2, t, "equal-map-v17-p-nil")
- // ...
- if v == nil {
- v17v2 = nil
- } else {
- v17v2 = make(map[interface{}]bool, len(v))
- } // reset map
- var v17v3, v17v4 typMapMapIntfBool
- v17v3 = typMapMapIntfBool(v17v1)
- v17v4 = typMapMapIntfBool(v17v2)
- bs17 = testMarshalErr(v17v3, h, t, "enc-map-v17-custom")
- testUnmarshalErr(v17v4, bs17, h, t, "dec-map-v17-p-len")
- testDeepEqualErr(v17v3, v17v4, t, "equal-map-v17-p-len")
- }
-
- for _, v := range []map[string]interface{}{nil, {}, {"some-string": nil, "some-string-2": "string-is-an-interface"}} {
- // fmt.Printf(">>>> running mammoth map v20: %v\n", v)
- var v20v1, v20v2 map[string]interface{}
- v20v1 = v
- bs20 := testMarshalErr(v20v1, h, t, "enc-map-v20")
- if v == nil {
- v20v2 = nil
- } else {
- v20v2 = make(map[string]interface{}, len(v))
- } // reset map
- testUnmarshalErr(v20v2, bs20, h, t, "dec-map-v20")
- testDeepEqualErr(v20v1, v20v2, t, "equal-map-v20")
- if v == nil {
- v20v2 = nil
- } else {
- v20v2 = make(map[string]interface{}, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v20v2), bs20, h, t, "dec-map-v20-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v20v1, v20v2, t, "equal-map-v20-noaddr")
- if v == nil {
- v20v2 = nil
- } else {
- v20v2 = make(map[string]interface{}, len(v))
- } // reset map
- testUnmarshalErr(&v20v2, bs20, h, t, "dec-map-v20-p-len")
- testDeepEqualErr(v20v1, v20v2, t, "equal-map-v20-p-len")
- bs20 = testMarshalErr(&v20v1, h, t, "enc-map-v20-p")
- v20v2 = nil
- testUnmarshalErr(&v20v2, bs20, h, t, "dec-map-v20-p-nil")
- testDeepEqualErr(v20v1, v20v2, t, "equal-map-v20-p-nil")
- // ...
- if v == nil {
- v20v2 = nil
- } else {
- v20v2 = make(map[string]interface{}, len(v))
- } // reset map
- var v20v3, v20v4 typMapMapStringIntf
- v20v3 = typMapMapStringIntf(v20v1)
- v20v4 = typMapMapStringIntf(v20v2)
- bs20 = testMarshalErr(v20v3, h, t, "enc-map-v20-custom")
- testUnmarshalErr(v20v4, bs20, h, t, "dec-map-v20-p-len")
- testDeepEqualErr(v20v3, v20v4, t, "equal-map-v20-p-len")
- }
-
- for _, v := range []map[string]string{nil, {}, {"some-string": "", "some-string-2": "some-string"}} {
- // fmt.Printf(">>>> running mammoth map v21: %v\n", v)
- var v21v1, v21v2 map[string]string
- v21v1 = v
- bs21 := testMarshalErr(v21v1, h, t, "enc-map-v21")
- if v == nil {
- v21v2 = nil
- } else {
- v21v2 = make(map[string]string, len(v))
- } // reset map
- testUnmarshalErr(v21v2, bs21, h, t, "dec-map-v21")
- testDeepEqualErr(v21v1, v21v2, t, "equal-map-v21")
- if v == nil {
- v21v2 = nil
- } else {
- v21v2 = make(map[string]string, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v21v2), bs21, h, t, "dec-map-v21-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v21v1, v21v2, t, "equal-map-v21-noaddr")
- if v == nil {
- v21v2 = nil
- } else {
- v21v2 = make(map[string]string, len(v))
- } // reset map
- testUnmarshalErr(&v21v2, bs21, h, t, "dec-map-v21-p-len")
- testDeepEqualErr(v21v1, v21v2, t, "equal-map-v21-p-len")
- bs21 = testMarshalErr(&v21v1, h, t, "enc-map-v21-p")
- v21v2 = nil
- testUnmarshalErr(&v21v2, bs21, h, t, "dec-map-v21-p-nil")
- testDeepEqualErr(v21v1, v21v2, t, "equal-map-v21-p-nil")
- // ...
- if v == nil {
- v21v2 = nil
- } else {
- v21v2 = make(map[string]string, len(v))
- } // reset map
- var v21v3, v21v4 typMapMapStringString
- v21v3 = typMapMapStringString(v21v1)
- v21v4 = typMapMapStringString(v21v2)
- bs21 = testMarshalErr(v21v3, h, t, "enc-map-v21-custom")
- testUnmarshalErr(v21v4, bs21, h, t, "dec-map-v21-p-len")
- testDeepEqualErr(v21v3, v21v4, t, "equal-map-v21-p-len")
- }
-
- for _, v := range []map[string]uint{nil, {}, {"some-string-2": 0, "some-string": 33}} {
- // fmt.Printf(">>>> running mammoth map v22: %v\n", v)
- var v22v1, v22v2 map[string]uint
- v22v1 = v
- bs22 := testMarshalErr(v22v1, h, t, "enc-map-v22")
- if v == nil {
- v22v2 = nil
- } else {
- v22v2 = make(map[string]uint, len(v))
- } // reset map
- testUnmarshalErr(v22v2, bs22, h, t, "dec-map-v22")
- testDeepEqualErr(v22v1, v22v2, t, "equal-map-v22")
- if v == nil {
- v22v2 = nil
- } else {
- v22v2 = make(map[string]uint, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v22v2), bs22, h, t, "dec-map-v22-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v22v1, v22v2, t, "equal-map-v22-noaddr")
- if v == nil {
- v22v2 = nil
- } else {
- v22v2 = make(map[string]uint, len(v))
- } // reset map
- testUnmarshalErr(&v22v2, bs22, h, t, "dec-map-v22-p-len")
- testDeepEqualErr(v22v1, v22v2, t, "equal-map-v22-p-len")
- bs22 = testMarshalErr(&v22v1, h, t, "enc-map-v22-p")
- v22v2 = nil
- testUnmarshalErr(&v22v2, bs22, h, t, "dec-map-v22-p-nil")
- testDeepEqualErr(v22v1, v22v2, t, "equal-map-v22-p-nil")
- // ...
- if v == nil {
- v22v2 = nil
- } else {
- v22v2 = make(map[string]uint, len(v))
- } // reset map
- var v22v3, v22v4 typMapMapStringUint
- v22v3 = typMapMapStringUint(v22v1)
- v22v4 = typMapMapStringUint(v22v2)
- bs22 = testMarshalErr(v22v3, h, t, "enc-map-v22-custom")
- testUnmarshalErr(v22v4, bs22, h, t, "dec-map-v22-p-len")
- testDeepEqualErr(v22v3, v22v4, t, "equal-map-v22-p-len")
- }
-
- for _, v := range []map[string]uint8{nil, {}, {"some-string-2": 0, "some-string": 44}} {
- // fmt.Printf(">>>> running mammoth map v23: %v\n", v)
- var v23v1, v23v2 map[string]uint8
- v23v1 = v
- bs23 := testMarshalErr(v23v1, h, t, "enc-map-v23")
- if v == nil {
- v23v2 = nil
- } else {
- v23v2 = make(map[string]uint8, len(v))
- } // reset map
- testUnmarshalErr(v23v2, bs23, h, t, "dec-map-v23")
- testDeepEqualErr(v23v1, v23v2, t, "equal-map-v23")
- if v == nil {
- v23v2 = nil
- } else {
- v23v2 = make(map[string]uint8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v23v2), bs23, h, t, "dec-map-v23-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v23v1, v23v2, t, "equal-map-v23-noaddr")
- if v == nil {
- v23v2 = nil
- } else {
- v23v2 = make(map[string]uint8, len(v))
- } // reset map
- testUnmarshalErr(&v23v2, bs23, h, t, "dec-map-v23-p-len")
- testDeepEqualErr(v23v1, v23v2, t, "equal-map-v23-p-len")
- bs23 = testMarshalErr(&v23v1, h, t, "enc-map-v23-p")
- v23v2 = nil
- testUnmarshalErr(&v23v2, bs23, h, t, "dec-map-v23-p-nil")
- testDeepEqualErr(v23v1, v23v2, t, "equal-map-v23-p-nil")
- // ...
- if v == nil {
- v23v2 = nil
- } else {
- v23v2 = make(map[string]uint8, len(v))
- } // reset map
- var v23v3, v23v4 typMapMapStringUint8
- v23v3 = typMapMapStringUint8(v23v1)
- v23v4 = typMapMapStringUint8(v23v2)
- bs23 = testMarshalErr(v23v3, h, t, "enc-map-v23-custom")
- testUnmarshalErr(v23v4, bs23, h, t, "dec-map-v23-p-len")
- testDeepEqualErr(v23v3, v23v4, t, "equal-map-v23-p-len")
- }
-
- for _, v := range []map[string]uint16{nil, {}, {"some-string-2": 0, "some-string": 33}} {
- // fmt.Printf(">>>> running mammoth map v24: %v\n", v)
- var v24v1, v24v2 map[string]uint16
- v24v1 = v
- bs24 := testMarshalErr(v24v1, h, t, "enc-map-v24")
- if v == nil {
- v24v2 = nil
- } else {
- v24v2 = make(map[string]uint16, len(v))
- } // reset map
- testUnmarshalErr(v24v2, bs24, h, t, "dec-map-v24")
- testDeepEqualErr(v24v1, v24v2, t, "equal-map-v24")
- if v == nil {
- v24v2 = nil
- } else {
- v24v2 = make(map[string]uint16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v24v2), bs24, h, t, "dec-map-v24-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v24v1, v24v2, t, "equal-map-v24-noaddr")
- if v == nil {
- v24v2 = nil
- } else {
- v24v2 = make(map[string]uint16, len(v))
- } // reset map
- testUnmarshalErr(&v24v2, bs24, h, t, "dec-map-v24-p-len")
- testDeepEqualErr(v24v1, v24v2, t, "equal-map-v24-p-len")
- bs24 = testMarshalErr(&v24v1, h, t, "enc-map-v24-p")
- v24v2 = nil
- testUnmarshalErr(&v24v2, bs24, h, t, "dec-map-v24-p-nil")
- testDeepEqualErr(v24v1, v24v2, t, "equal-map-v24-p-nil")
- // ...
- if v == nil {
- v24v2 = nil
- } else {
- v24v2 = make(map[string]uint16, len(v))
- } // reset map
- var v24v3, v24v4 typMapMapStringUint16
- v24v3 = typMapMapStringUint16(v24v1)
- v24v4 = typMapMapStringUint16(v24v2)
- bs24 = testMarshalErr(v24v3, h, t, "enc-map-v24-custom")
- testUnmarshalErr(v24v4, bs24, h, t, "dec-map-v24-p-len")
- testDeepEqualErr(v24v3, v24v4, t, "equal-map-v24-p-len")
- }
-
- for _, v := range []map[string]uint32{nil, {}, {"some-string-2": 0, "some-string": 44}} {
- // fmt.Printf(">>>> running mammoth map v25: %v\n", v)
- var v25v1, v25v2 map[string]uint32
- v25v1 = v
- bs25 := testMarshalErr(v25v1, h, t, "enc-map-v25")
- if v == nil {
- v25v2 = nil
- } else {
- v25v2 = make(map[string]uint32, len(v))
- } // reset map
- testUnmarshalErr(v25v2, bs25, h, t, "dec-map-v25")
- testDeepEqualErr(v25v1, v25v2, t, "equal-map-v25")
- if v == nil {
- v25v2 = nil
- } else {
- v25v2 = make(map[string]uint32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v25v2), bs25, h, t, "dec-map-v25-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v25v1, v25v2, t, "equal-map-v25-noaddr")
- if v == nil {
- v25v2 = nil
- } else {
- v25v2 = make(map[string]uint32, len(v))
- } // reset map
- testUnmarshalErr(&v25v2, bs25, h, t, "dec-map-v25-p-len")
- testDeepEqualErr(v25v1, v25v2, t, "equal-map-v25-p-len")
- bs25 = testMarshalErr(&v25v1, h, t, "enc-map-v25-p")
- v25v2 = nil
- testUnmarshalErr(&v25v2, bs25, h, t, "dec-map-v25-p-nil")
- testDeepEqualErr(v25v1, v25v2, t, "equal-map-v25-p-nil")
- // ...
- if v == nil {
- v25v2 = nil
- } else {
- v25v2 = make(map[string]uint32, len(v))
- } // reset map
- var v25v3, v25v4 typMapMapStringUint32
- v25v3 = typMapMapStringUint32(v25v1)
- v25v4 = typMapMapStringUint32(v25v2)
- bs25 = testMarshalErr(v25v3, h, t, "enc-map-v25-custom")
- testUnmarshalErr(v25v4, bs25, h, t, "dec-map-v25-p-len")
- testDeepEqualErr(v25v3, v25v4, t, "equal-map-v25-p-len")
- }
-
- for _, v := range []map[string]uint64{nil, {}, {"some-string-2": 0, "some-string": 33}} {
- // fmt.Printf(">>>> running mammoth map v26: %v\n", v)
- var v26v1, v26v2 map[string]uint64
- v26v1 = v
- bs26 := testMarshalErr(v26v1, h, t, "enc-map-v26")
- if v == nil {
- v26v2 = nil
- } else {
- v26v2 = make(map[string]uint64, len(v))
- } // reset map
- testUnmarshalErr(v26v2, bs26, h, t, "dec-map-v26")
- testDeepEqualErr(v26v1, v26v2, t, "equal-map-v26")
- if v == nil {
- v26v2 = nil
- } else {
- v26v2 = make(map[string]uint64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v26v2), bs26, h, t, "dec-map-v26-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v26v1, v26v2, t, "equal-map-v26-noaddr")
- if v == nil {
- v26v2 = nil
- } else {
- v26v2 = make(map[string]uint64, len(v))
- } // reset map
- testUnmarshalErr(&v26v2, bs26, h, t, "dec-map-v26-p-len")
- testDeepEqualErr(v26v1, v26v2, t, "equal-map-v26-p-len")
- bs26 = testMarshalErr(&v26v1, h, t, "enc-map-v26-p")
- v26v2 = nil
- testUnmarshalErr(&v26v2, bs26, h, t, "dec-map-v26-p-nil")
- testDeepEqualErr(v26v1, v26v2, t, "equal-map-v26-p-nil")
- // ...
- if v == nil {
- v26v2 = nil
- } else {
- v26v2 = make(map[string]uint64, len(v))
- } // reset map
- var v26v3, v26v4 typMapMapStringUint64
- v26v3 = typMapMapStringUint64(v26v1)
- v26v4 = typMapMapStringUint64(v26v2)
- bs26 = testMarshalErr(v26v3, h, t, "enc-map-v26-custom")
- testUnmarshalErr(v26v4, bs26, h, t, "dec-map-v26-p-len")
- testDeepEqualErr(v26v3, v26v4, t, "equal-map-v26-p-len")
- }
-
- for _, v := range []map[string]uintptr{nil, {}, {"some-string-2": 0, "some-string": 44}} {
- // fmt.Printf(">>>> running mammoth map v27: %v\n", v)
- var v27v1, v27v2 map[string]uintptr
- v27v1 = v
- bs27 := testMarshalErr(v27v1, h, t, "enc-map-v27")
- if v == nil {
- v27v2 = nil
- } else {
- v27v2 = make(map[string]uintptr, len(v))
- } // reset map
- testUnmarshalErr(v27v2, bs27, h, t, "dec-map-v27")
- testDeepEqualErr(v27v1, v27v2, t, "equal-map-v27")
- if v == nil {
- v27v2 = nil
- } else {
- v27v2 = make(map[string]uintptr, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v27v2), bs27, h, t, "dec-map-v27-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v27v1, v27v2, t, "equal-map-v27-noaddr")
- if v == nil {
- v27v2 = nil
- } else {
- v27v2 = make(map[string]uintptr, len(v))
- } // reset map
- testUnmarshalErr(&v27v2, bs27, h, t, "dec-map-v27-p-len")
- testDeepEqualErr(v27v1, v27v2, t, "equal-map-v27-p-len")
- bs27 = testMarshalErr(&v27v1, h, t, "enc-map-v27-p")
- v27v2 = nil
- testUnmarshalErr(&v27v2, bs27, h, t, "dec-map-v27-p-nil")
- testDeepEqualErr(v27v1, v27v2, t, "equal-map-v27-p-nil")
- // ...
- if v == nil {
- v27v2 = nil
- } else {
- v27v2 = make(map[string]uintptr, len(v))
- } // reset map
- var v27v3, v27v4 typMapMapStringUintptr
- v27v3 = typMapMapStringUintptr(v27v1)
- v27v4 = typMapMapStringUintptr(v27v2)
- bs27 = testMarshalErr(v27v3, h, t, "enc-map-v27-custom")
- testUnmarshalErr(v27v4, bs27, h, t, "dec-map-v27-p-len")
- testDeepEqualErr(v27v3, v27v4, t, "equal-map-v27-p-len")
- }
-
- for _, v := range []map[string]int{nil, {}, {"some-string-2": 0, "some-string": 33}} {
- // fmt.Printf(">>>> running mammoth map v28: %v\n", v)
- var v28v1, v28v2 map[string]int
- v28v1 = v
- bs28 := testMarshalErr(v28v1, h, t, "enc-map-v28")
- if v == nil {
- v28v2 = nil
- } else {
- v28v2 = make(map[string]int, len(v))
- } // reset map
- testUnmarshalErr(v28v2, bs28, h, t, "dec-map-v28")
- testDeepEqualErr(v28v1, v28v2, t, "equal-map-v28")
- if v == nil {
- v28v2 = nil
- } else {
- v28v2 = make(map[string]int, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v28v2), bs28, h, t, "dec-map-v28-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v28v1, v28v2, t, "equal-map-v28-noaddr")
- if v == nil {
- v28v2 = nil
- } else {
- v28v2 = make(map[string]int, len(v))
- } // reset map
- testUnmarshalErr(&v28v2, bs28, h, t, "dec-map-v28-p-len")
- testDeepEqualErr(v28v1, v28v2, t, "equal-map-v28-p-len")
- bs28 = testMarshalErr(&v28v1, h, t, "enc-map-v28-p")
- v28v2 = nil
- testUnmarshalErr(&v28v2, bs28, h, t, "dec-map-v28-p-nil")
- testDeepEqualErr(v28v1, v28v2, t, "equal-map-v28-p-nil")
- // ...
- if v == nil {
- v28v2 = nil
- } else {
- v28v2 = make(map[string]int, len(v))
- } // reset map
- var v28v3, v28v4 typMapMapStringInt
- v28v3 = typMapMapStringInt(v28v1)
- v28v4 = typMapMapStringInt(v28v2)
- bs28 = testMarshalErr(v28v3, h, t, "enc-map-v28-custom")
- testUnmarshalErr(v28v4, bs28, h, t, "dec-map-v28-p-len")
- testDeepEqualErr(v28v3, v28v4, t, "equal-map-v28-p-len")
- }
-
- for _, v := range []map[string]int8{nil, {}, {"some-string-2": 0, "some-string": 44}} {
- // fmt.Printf(">>>> running mammoth map v29: %v\n", v)
- var v29v1, v29v2 map[string]int8
- v29v1 = v
- bs29 := testMarshalErr(v29v1, h, t, "enc-map-v29")
- if v == nil {
- v29v2 = nil
- } else {
- v29v2 = make(map[string]int8, len(v))
- } // reset map
- testUnmarshalErr(v29v2, bs29, h, t, "dec-map-v29")
- testDeepEqualErr(v29v1, v29v2, t, "equal-map-v29")
- if v == nil {
- v29v2 = nil
- } else {
- v29v2 = make(map[string]int8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v29v2), bs29, h, t, "dec-map-v29-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v29v1, v29v2, t, "equal-map-v29-noaddr")
- if v == nil {
- v29v2 = nil
- } else {
- v29v2 = make(map[string]int8, len(v))
- } // reset map
- testUnmarshalErr(&v29v2, bs29, h, t, "dec-map-v29-p-len")
- testDeepEqualErr(v29v1, v29v2, t, "equal-map-v29-p-len")
- bs29 = testMarshalErr(&v29v1, h, t, "enc-map-v29-p")
- v29v2 = nil
- testUnmarshalErr(&v29v2, bs29, h, t, "dec-map-v29-p-nil")
- testDeepEqualErr(v29v1, v29v2, t, "equal-map-v29-p-nil")
- // ...
- if v == nil {
- v29v2 = nil
- } else {
- v29v2 = make(map[string]int8, len(v))
- } // reset map
- var v29v3, v29v4 typMapMapStringInt8
- v29v3 = typMapMapStringInt8(v29v1)
- v29v4 = typMapMapStringInt8(v29v2)
- bs29 = testMarshalErr(v29v3, h, t, "enc-map-v29-custom")
- testUnmarshalErr(v29v4, bs29, h, t, "dec-map-v29-p-len")
- testDeepEqualErr(v29v3, v29v4, t, "equal-map-v29-p-len")
- }
-
- for _, v := range []map[string]int16{nil, {}, {"some-string-2": 0, "some-string": 33}} {
- // fmt.Printf(">>>> running mammoth map v30: %v\n", v)
- var v30v1, v30v2 map[string]int16
- v30v1 = v
- bs30 := testMarshalErr(v30v1, h, t, "enc-map-v30")
- if v == nil {
- v30v2 = nil
- } else {
- v30v2 = make(map[string]int16, len(v))
- } // reset map
- testUnmarshalErr(v30v2, bs30, h, t, "dec-map-v30")
- testDeepEqualErr(v30v1, v30v2, t, "equal-map-v30")
- if v == nil {
- v30v2 = nil
- } else {
- v30v2 = make(map[string]int16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v30v2), bs30, h, t, "dec-map-v30-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v30v1, v30v2, t, "equal-map-v30-noaddr")
- if v == nil {
- v30v2 = nil
- } else {
- v30v2 = make(map[string]int16, len(v))
- } // reset map
- testUnmarshalErr(&v30v2, bs30, h, t, "dec-map-v30-p-len")
- testDeepEqualErr(v30v1, v30v2, t, "equal-map-v30-p-len")
- bs30 = testMarshalErr(&v30v1, h, t, "enc-map-v30-p")
- v30v2 = nil
- testUnmarshalErr(&v30v2, bs30, h, t, "dec-map-v30-p-nil")
- testDeepEqualErr(v30v1, v30v2, t, "equal-map-v30-p-nil")
- // ...
- if v == nil {
- v30v2 = nil
- } else {
- v30v2 = make(map[string]int16, len(v))
- } // reset map
- var v30v3, v30v4 typMapMapStringInt16
- v30v3 = typMapMapStringInt16(v30v1)
- v30v4 = typMapMapStringInt16(v30v2)
- bs30 = testMarshalErr(v30v3, h, t, "enc-map-v30-custom")
- testUnmarshalErr(v30v4, bs30, h, t, "dec-map-v30-p-len")
- testDeepEqualErr(v30v3, v30v4, t, "equal-map-v30-p-len")
- }
-
- for _, v := range []map[string]int32{nil, {}, {"some-string-2": 0, "some-string": 44}} {
- // fmt.Printf(">>>> running mammoth map v31: %v\n", v)
- var v31v1, v31v2 map[string]int32
- v31v1 = v
- bs31 := testMarshalErr(v31v1, h, t, "enc-map-v31")
- if v == nil {
- v31v2 = nil
- } else {
- v31v2 = make(map[string]int32, len(v))
- } // reset map
- testUnmarshalErr(v31v2, bs31, h, t, "dec-map-v31")
- testDeepEqualErr(v31v1, v31v2, t, "equal-map-v31")
- if v == nil {
- v31v2 = nil
- } else {
- v31v2 = make(map[string]int32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v31v2), bs31, h, t, "dec-map-v31-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v31v1, v31v2, t, "equal-map-v31-noaddr")
- if v == nil {
- v31v2 = nil
- } else {
- v31v2 = make(map[string]int32, len(v))
- } // reset map
- testUnmarshalErr(&v31v2, bs31, h, t, "dec-map-v31-p-len")
- testDeepEqualErr(v31v1, v31v2, t, "equal-map-v31-p-len")
- bs31 = testMarshalErr(&v31v1, h, t, "enc-map-v31-p")
- v31v2 = nil
- testUnmarshalErr(&v31v2, bs31, h, t, "dec-map-v31-p-nil")
- testDeepEqualErr(v31v1, v31v2, t, "equal-map-v31-p-nil")
- // ...
- if v == nil {
- v31v2 = nil
- } else {
- v31v2 = make(map[string]int32, len(v))
- } // reset map
- var v31v3, v31v4 typMapMapStringInt32
- v31v3 = typMapMapStringInt32(v31v1)
- v31v4 = typMapMapStringInt32(v31v2)
- bs31 = testMarshalErr(v31v3, h, t, "enc-map-v31-custom")
- testUnmarshalErr(v31v4, bs31, h, t, "dec-map-v31-p-len")
- testDeepEqualErr(v31v3, v31v4, t, "equal-map-v31-p-len")
- }
-
- for _, v := range []map[string]int64{nil, {}, {"some-string-2": 0, "some-string": 33}} {
- // fmt.Printf(">>>> running mammoth map v32: %v\n", v)
- var v32v1, v32v2 map[string]int64
- v32v1 = v
- bs32 := testMarshalErr(v32v1, h, t, "enc-map-v32")
- if v == nil {
- v32v2 = nil
- } else {
- v32v2 = make(map[string]int64, len(v))
- } // reset map
- testUnmarshalErr(v32v2, bs32, h, t, "dec-map-v32")
- testDeepEqualErr(v32v1, v32v2, t, "equal-map-v32")
- if v == nil {
- v32v2 = nil
- } else {
- v32v2 = make(map[string]int64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v32v2), bs32, h, t, "dec-map-v32-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v32v1, v32v2, t, "equal-map-v32-noaddr")
- if v == nil {
- v32v2 = nil
- } else {
- v32v2 = make(map[string]int64, len(v))
- } // reset map
- testUnmarshalErr(&v32v2, bs32, h, t, "dec-map-v32-p-len")
- testDeepEqualErr(v32v1, v32v2, t, "equal-map-v32-p-len")
- bs32 = testMarshalErr(&v32v1, h, t, "enc-map-v32-p")
- v32v2 = nil
- testUnmarshalErr(&v32v2, bs32, h, t, "dec-map-v32-p-nil")
- testDeepEqualErr(v32v1, v32v2, t, "equal-map-v32-p-nil")
- // ...
- if v == nil {
- v32v2 = nil
- } else {
- v32v2 = make(map[string]int64, len(v))
- } // reset map
- var v32v3, v32v4 typMapMapStringInt64
- v32v3 = typMapMapStringInt64(v32v1)
- v32v4 = typMapMapStringInt64(v32v2)
- bs32 = testMarshalErr(v32v3, h, t, "enc-map-v32-custom")
- testUnmarshalErr(v32v4, bs32, h, t, "dec-map-v32-p-len")
- testDeepEqualErr(v32v3, v32v4, t, "equal-map-v32-p-len")
- }
-
- for _, v := range []map[string]float32{nil, {}, {"some-string-2": 0, "some-string": 22.2}} {
- // fmt.Printf(">>>> running mammoth map v33: %v\n", v)
- var v33v1, v33v2 map[string]float32
- v33v1 = v
- bs33 := testMarshalErr(v33v1, h, t, "enc-map-v33")
- if v == nil {
- v33v2 = nil
- } else {
- v33v2 = make(map[string]float32, len(v))
- } // reset map
- testUnmarshalErr(v33v2, bs33, h, t, "dec-map-v33")
- testDeepEqualErr(v33v1, v33v2, t, "equal-map-v33")
- if v == nil {
- v33v2 = nil
- } else {
- v33v2 = make(map[string]float32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v33v2), bs33, h, t, "dec-map-v33-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v33v1, v33v2, t, "equal-map-v33-noaddr")
- if v == nil {
- v33v2 = nil
- } else {
- v33v2 = make(map[string]float32, len(v))
- } // reset map
- testUnmarshalErr(&v33v2, bs33, h, t, "dec-map-v33-p-len")
- testDeepEqualErr(v33v1, v33v2, t, "equal-map-v33-p-len")
- bs33 = testMarshalErr(&v33v1, h, t, "enc-map-v33-p")
- v33v2 = nil
- testUnmarshalErr(&v33v2, bs33, h, t, "dec-map-v33-p-nil")
- testDeepEqualErr(v33v1, v33v2, t, "equal-map-v33-p-nil")
- // ...
- if v == nil {
- v33v2 = nil
- } else {
- v33v2 = make(map[string]float32, len(v))
- } // reset map
- var v33v3, v33v4 typMapMapStringFloat32
- v33v3 = typMapMapStringFloat32(v33v1)
- v33v4 = typMapMapStringFloat32(v33v2)
- bs33 = testMarshalErr(v33v3, h, t, "enc-map-v33-custom")
- testUnmarshalErr(v33v4, bs33, h, t, "dec-map-v33-p-len")
- testDeepEqualErr(v33v3, v33v4, t, "equal-map-v33-p-len")
- }
-
- for _, v := range []map[string]float64{nil, {}, {"some-string-2": 0, "some-string": 11.1}} {
- // fmt.Printf(">>>> running mammoth map v34: %v\n", v)
- var v34v1, v34v2 map[string]float64
- v34v1 = v
- bs34 := testMarshalErr(v34v1, h, t, "enc-map-v34")
- if v == nil {
- v34v2 = nil
- } else {
- v34v2 = make(map[string]float64, len(v))
- } // reset map
- testUnmarshalErr(v34v2, bs34, h, t, "dec-map-v34")
- testDeepEqualErr(v34v1, v34v2, t, "equal-map-v34")
- if v == nil {
- v34v2 = nil
- } else {
- v34v2 = make(map[string]float64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v34v2), bs34, h, t, "dec-map-v34-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v34v1, v34v2, t, "equal-map-v34-noaddr")
- if v == nil {
- v34v2 = nil
- } else {
- v34v2 = make(map[string]float64, len(v))
- } // reset map
- testUnmarshalErr(&v34v2, bs34, h, t, "dec-map-v34-p-len")
- testDeepEqualErr(v34v1, v34v2, t, "equal-map-v34-p-len")
- bs34 = testMarshalErr(&v34v1, h, t, "enc-map-v34-p")
- v34v2 = nil
- testUnmarshalErr(&v34v2, bs34, h, t, "dec-map-v34-p-nil")
- testDeepEqualErr(v34v1, v34v2, t, "equal-map-v34-p-nil")
- // ...
- if v == nil {
- v34v2 = nil
- } else {
- v34v2 = make(map[string]float64, len(v))
- } // reset map
- var v34v3, v34v4 typMapMapStringFloat64
- v34v3 = typMapMapStringFloat64(v34v1)
- v34v4 = typMapMapStringFloat64(v34v2)
- bs34 = testMarshalErr(v34v3, h, t, "enc-map-v34-custom")
- testUnmarshalErr(v34v4, bs34, h, t, "dec-map-v34-p-len")
- testDeepEqualErr(v34v3, v34v4, t, "equal-map-v34-p-len")
- }
-
- for _, v := range []map[string]bool{nil, {}, {"some-string-2": false, "some-string": true}} {
- // fmt.Printf(">>>> running mammoth map v35: %v\n", v)
- var v35v1, v35v2 map[string]bool
- v35v1 = v
- bs35 := testMarshalErr(v35v1, h, t, "enc-map-v35")
- if v == nil {
- v35v2 = nil
- } else {
- v35v2 = make(map[string]bool, len(v))
- } // reset map
- testUnmarshalErr(v35v2, bs35, h, t, "dec-map-v35")
- testDeepEqualErr(v35v1, v35v2, t, "equal-map-v35")
- if v == nil {
- v35v2 = nil
- } else {
- v35v2 = make(map[string]bool, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v35v2), bs35, h, t, "dec-map-v35-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v35v1, v35v2, t, "equal-map-v35-noaddr")
- if v == nil {
- v35v2 = nil
- } else {
- v35v2 = make(map[string]bool, len(v))
- } // reset map
- testUnmarshalErr(&v35v2, bs35, h, t, "dec-map-v35-p-len")
- testDeepEqualErr(v35v1, v35v2, t, "equal-map-v35-p-len")
- bs35 = testMarshalErr(&v35v1, h, t, "enc-map-v35-p")
- v35v2 = nil
- testUnmarshalErr(&v35v2, bs35, h, t, "dec-map-v35-p-nil")
- testDeepEqualErr(v35v1, v35v2, t, "equal-map-v35-p-nil")
- // ...
- if v == nil {
- v35v2 = nil
- } else {
- v35v2 = make(map[string]bool, len(v))
- } // reset map
- var v35v3, v35v4 typMapMapStringBool
- v35v3 = typMapMapStringBool(v35v1)
- v35v4 = typMapMapStringBool(v35v2)
- bs35 = testMarshalErr(v35v3, h, t, "enc-map-v35-custom")
- testUnmarshalErr(v35v4, bs35, h, t, "dec-map-v35-p-len")
- testDeepEqualErr(v35v3, v35v4, t, "equal-map-v35-p-len")
- }
-
- for _, v := range []map[float32]interface{}{nil, {}, {22.2: nil, 11.1: "string-is-an-interface-2"}} {
- // fmt.Printf(">>>> running mammoth map v38: %v\n", v)
- var v38v1, v38v2 map[float32]interface{}
- v38v1 = v
- bs38 := testMarshalErr(v38v1, h, t, "enc-map-v38")
- if v == nil {
- v38v2 = nil
- } else {
- v38v2 = make(map[float32]interface{}, len(v))
- } // reset map
- testUnmarshalErr(v38v2, bs38, h, t, "dec-map-v38")
- testDeepEqualErr(v38v1, v38v2, t, "equal-map-v38")
- if v == nil {
- v38v2 = nil
- } else {
- v38v2 = make(map[float32]interface{}, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v38v2), bs38, h, t, "dec-map-v38-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v38v1, v38v2, t, "equal-map-v38-noaddr")
- if v == nil {
- v38v2 = nil
- } else {
- v38v2 = make(map[float32]interface{}, len(v))
- } // reset map
- testUnmarshalErr(&v38v2, bs38, h, t, "dec-map-v38-p-len")
- testDeepEqualErr(v38v1, v38v2, t, "equal-map-v38-p-len")
- bs38 = testMarshalErr(&v38v1, h, t, "enc-map-v38-p")
- v38v2 = nil
- testUnmarshalErr(&v38v2, bs38, h, t, "dec-map-v38-p-nil")
- testDeepEqualErr(v38v1, v38v2, t, "equal-map-v38-p-nil")
- // ...
- if v == nil {
- v38v2 = nil
- } else {
- v38v2 = make(map[float32]interface{}, len(v))
- } // reset map
- var v38v3, v38v4 typMapMapFloat32Intf
- v38v3 = typMapMapFloat32Intf(v38v1)
- v38v4 = typMapMapFloat32Intf(v38v2)
- bs38 = testMarshalErr(v38v3, h, t, "enc-map-v38-custom")
- testUnmarshalErr(v38v4, bs38, h, t, "dec-map-v38-p-len")
- testDeepEqualErr(v38v3, v38v4, t, "equal-map-v38-p-len")
- }
-
- for _, v := range []map[float32]string{nil, {}, {22.2: "", 11.1: "some-string-2"}} {
- // fmt.Printf(">>>> running mammoth map v39: %v\n", v)
- var v39v1, v39v2 map[float32]string
- v39v1 = v
- bs39 := testMarshalErr(v39v1, h, t, "enc-map-v39")
- if v == nil {
- v39v2 = nil
- } else {
- v39v2 = make(map[float32]string, len(v))
- } // reset map
- testUnmarshalErr(v39v2, bs39, h, t, "dec-map-v39")
- testDeepEqualErr(v39v1, v39v2, t, "equal-map-v39")
- if v == nil {
- v39v2 = nil
- } else {
- v39v2 = make(map[float32]string, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v39v2), bs39, h, t, "dec-map-v39-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v39v1, v39v2, t, "equal-map-v39-noaddr")
- if v == nil {
- v39v2 = nil
- } else {
- v39v2 = make(map[float32]string, len(v))
- } // reset map
- testUnmarshalErr(&v39v2, bs39, h, t, "dec-map-v39-p-len")
- testDeepEqualErr(v39v1, v39v2, t, "equal-map-v39-p-len")
- bs39 = testMarshalErr(&v39v1, h, t, "enc-map-v39-p")
- v39v2 = nil
- testUnmarshalErr(&v39v2, bs39, h, t, "dec-map-v39-p-nil")
- testDeepEqualErr(v39v1, v39v2, t, "equal-map-v39-p-nil")
- // ...
- if v == nil {
- v39v2 = nil
- } else {
- v39v2 = make(map[float32]string, len(v))
- } // reset map
- var v39v3, v39v4 typMapMapFloat32String
- v39v3 = typMapMapFloat32String(v39v1)
- v39v4 = typMapMapFloat32String(v39v2)
- bs39 = testMarshalErr(v39v3, h, t, "enc-map-v39-custom")
- testUnmarshalErr(v39v4, bs39, h, t, "dec-map-v39-p-len")
- testDeepEqualErr(v39v3, v39v4, t, "equal-map-v39-p-len")
- }
-
- for _, v := range []map[float32]uint{nil, {}, {22.2: 0, 11.1: 44}} {
- // fmt.Printf(">>>> running mammoth map v40: %v\n", v)
- var v40v1, v40v2 map[float32]uint
- v40v1 = v
- bs40 := testMarshalErr(v40v1, h, t, "enc-map-v40")
- if v == nil {
- v40v2 = nil
- } else {
- v40v2 = make(map[float32]uint, len(v))
- } // reset map
- testUnmarshalErr(v40v2, bs40, h, t, "dec-map-v40")
- testDeepEqualErr(v40v1, v40v2, t, "equal-map-v40")
- if v == nil {
- v40v2 = nil
- } else {
- v40v2 = make(map[float32]uint, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v40v2), bs40, h, t, "dec-map-v40-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v40v1, v40v2, t, "equal-map-v40-noaddr")
- if v == nil {
- v40v2 = nil
- } else {
- v40v2 = make(map[float32]uint, len(v))
- } // reset map
- testUnmarshalErr(&v40v2, bs40, h, t, "dec-map-v40-p-len")
- testDeepEqualErr(v40v1, v40v2, t, "equal-map-v40-p-len")
- bs40 = testMarshalErr(&v40v1, h, t, "enc-map-v40-p")
- v40v2 = nil
- testUnmarshalErr(&v40v2, bs40, h, t, "dec-map-v40-p-nil")
- testDeepEqualErr(v40v1, v40v2, t, "equal-map-v40-p-nil")
- // ...
- if v == nil {
- v40v2 = nil
- } else {
- v40v2 = make(map[float32]uint, len(v))
- } // reset map
- var v40v3, v40v4 typMapMapFloat32Uint
- v40v3 = typMapMapFloat32Uint(v40v1)
- v40v4 = typMapMapFloat32Uint(v40v2)
- bs40 = testMarshalErr(v40v3, h, t, "enc-map-v40-custom")
- testUnmarshalErr(v40v4, bs40, h, t, "dec-map-v40-p-len")
- testDeepEqualErr(v40v3, v40v4, t, "equal-map-v40-p-len")
- }
-
- for _, v := range []map[float32]uint8{nil, {}, {22.2: 0, 11.1: 33}} {
- // fmt.Printf(">>>> running mammoth map v41: %v\n", v)
- var v41v1, v41v2 map[float32]uint8
- v41v1 = v
- bs41 := testMarshalErr(v41v1, h, t, "enc-map-v41")
- if v == nil {
- v41v2 = nil
- } else {
- v41v2 = make(map[float32]uint8, len(v))
- } // reset map
- testUnmarshalErr(v41v2, bs41, h, t, "dec-map-v41")
- testDeepEqualErr(v41v1, v41v2, t, "equal-map-v41")
- if v == nil {
- v41v2 = nil
- } else {
- v41v2 = make(map[float32]uint8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v41v2), bs41, h, t, "dec-map-v41-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v41v1, v41v2, t, "equal-map-v41-noaddr")
- if v == nil {
- v41v2 = nil
- } else {
- v41v2 = make(map[float32]uint8, len(v))
- } // reset map
- testUnmarshalErr(&v41v2, bs41, h, t, "dec-map-v41-p-len")
- testDeepEqualErr(v41v1, v41v2, t, "equal-map-v41-p-len")
- bs41 = testMarshalErr(&v41v1, h, t, "enc-map-v41-p")
- v41v2 = nil
- testUnmarshalErr(&v41v2, bs41, h, t, "dec-map-v41-p-nil")
- testDeepEqualErr(v41v1, v41v2, t, "equal-map-v41-p-nil")
- // ...
- if v == nil {
- v41v2 = nil
- } else {
- v41v2 = make(map[float32]uint8, len(v))
- } // reset map
- var v41v3, v41v4 typMapMapFloat32Uint8
- v41v3 = typMapMapFloat32Uint8(v41v1)
- v41v4 = typMapMapFloat32Uint8(v41v2)
- bs41 = testMarshalErr(v41v3, h, t, "enc-map-v41-custom")
- testUnmarshalErr(v41v4, bs41, h, t, "dec-map-v41-p-len")
- testDeepEqualErr(v41v3, v41v4, t, "equal-map-v41-p-len")
- }
-
- for _, v := range []map[float32]uint16{nil, {}, {22.2: 0, 11.1: 44}} {
- // fmt.Printf(">>>> running mammoth map v42: %v\n", v)
- var v42v1, v42v2 map[float32]uint16
- v42v1 = v
- bs42 := testMarshalErr(v42v1, h, t, "enc-map-v42")
- if v == nil {
- v42v2 = nil
- } else {
- v42v2 = make(map[float32]uint16, len(v))
- } // reset map
- testUnmarshalErr(v42v2, bs42, h, t, "dec-map-v42")
- testDeepEqualErr(v42v1, v42v2, t, "equal-map-v42")
- if v == nil {
- v42v2 = nil
- } else {
- v42v2 = make(map[float32]uint16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v42v2), bs42, h, t, "dec-map-v42-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v42v1, v42v2, t, "equal-map-v42-noaddr")
- if v == nil {
- v42v2 = nil
- } else {
- v42v2 = make(map[float32]uint16, len(v))
- } // reset map
- testUnmarshalErr(&v42v2, bs42, h, t, "dec-map-v42-p-len")
- testDeepEqualErr(v42v1, v42v2, t, "equal-map-v42-p-len")
- bs42 = testMarshalErr(&v42v1, h, t, "enc-map-v42-p")
- v42v2 = nil
- testUnmarshalErr(&v42v2, bs42, h, t, "dec-map-v42-p-nil")
- testDeepEqualErr(v42v1, v42v2, t, "equal-map-v42-p-nil")
- // ...
- if v == nil {
- v42v2 = nil
- } else {
- v42v2 = make(map[float32]uint16, len(v))
- } // reset map
- var v42v3, v42v4 typMapMapFloat32Uint16
- v42v3 = typMapMapFloat32Uint16(v42v1)
- v42v4 = typMapMapFloat32Uint16(v42v2)
- bs42 = testMarshalErr(v42v3, h, t, "enc-map-v42-custom")
- testUnmarshalErr(v42v4, bs42, h, t, "dec-map-v42-p-len")
- testDeepEqualErr(v42v3, v42v4, t, "equal-map-v42-p-len")
- }
-
- for _, v := range []map[float32]uint32{nil, {}, {22.2: 0, 11.1: 33}} {
- // fmt.Printf(">>>> running mammoth map v43: %v\n", v)
- var v43v1, v43v2 map[float32]uint32
- v43v1 = v
- bs43 := testMarshalErr(v43v1, h, t, "enc-map-v43")
- if v == nil {
- v43v2 = nil
- } else {
- v43v2 = make(map[float32]uint32, len(v))
- } // reset map
- testUnmarshalErr(v43v2, bs43, h, t, "dec-map-v43")
- testDeepEqualErr(v43v1, v43v2, t, "equal-map-v43")
- if v == nil {
- v43v2 = nil
- } else {
- v43v2 = make(map[float32]uint32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v43v2), bs43, h, t, "dec-map-v43-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v43v1, v43v2, t, "equal-map-v43-noaddr")
- if v == nil {
- v43v2 = nil
- } else {
- v43v2 = make(map[float32]uint32, len(v))
- } // reset map
- testUnmarshalErr(&v43v2, bs43, h, t, "dec-map-v43-p-len")
- testDeepEqualErr(v43v1, v43v2, t, "equal-map-v43-p-len")
- bs43 = testMarshalErr(&v43v1, h, t, "enc-map-v43-p")
- v43v2 = nil
- testUnmarshalErr(&v43v2, bs43, h, t, "dec-map-v43-p-nil")
- testDeepEqualErr(v43v1, v43v2, t, "equal-map-v43-p-nil")
- // ...
- if v == nil {
- v43v2 = nil
- } else {
- v43v2 = make(map[float32]uint32, len(v))
- } // reset map
- var v43v3, v43v4 typMapMapFloat32Uint32
- v43v3 = typMapMapFloat32Uint32(v43v1)
- v43v4 = typMapMapFloat32Uint32(v43v2)
- bs43 = testMarshalErr(v43v3, h, t, "enc-map-v43-custom")
- testUnmarshalErr(v43v4, bs43, h, t, "dec-map-v43-p-len")
- testDeepEqualErr(v43v3, v43v4, t, "equal-map-v43-p-len")
- }
-
- for _, v := range []map[float32]uint64{nil, {}, {22.2: 0, 11.1: 44}} {
- // fmt.Printf(">>>> running mammoth map v44: %v\n", v)
- var v44v1, v44v2 map[float32]uint64
- v44v1 = v
- bs44 := testMarshalErr(v44v1, h, t, "enc-map-v44")
- if v == nil {
- v44v2 = nil
- } else {
- v44v2 = make(map[float32]uint64, len(v))
- } // reset map
- testUnmarshalErr(v44v2, bs44, h, t, "dec-map-v44")
- testDeepEqualErr(v44v1, v44v2, t, "equal-map-v44")
- if v == nil {
- v44v2 = nil
- } else {
- v44v2 = make(map[float32]uint64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v44v2), bs44, h, t, "dec-map-v44-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v44v1, v44v2, t, "equal-map-v44-noaddr")
- if v == nil {
- v44v2 = nil
- } else {
- v44v2 = make(map[float32]uint64, len(v))
- } // reset map
- testUnmarshalErr(&v44v2, bs44, h, t, "dec-map-v44-p-len")
- testDeepEqualErr(v44v1, v44v2, t, "equal-map-v44-p-len")
- bs44 = testMarshalErr(&v44v1, h, t, "enc-map-v44-p")
- v44v2 = nil
- testUnmarshalErr(&v44v2, bs44, h, t, "dec-map-v44-p-nil")
- testDeepEqualErr(v44v1, v44v2, t, "equal-map-v44-p-nil")
- // ...
- if v == nil {
- v44v2 = nil
- } else {
- v44v2 = make(map[float32]uint64, len(v))
- } // reset map
- var v44v3, v44v4 typMapMapFloat32Uint64
- v44v3 = typMapMapFloat32Uint64(v44v1)
- v44v4 = typMapMapFloat32Uint64(v44v2)
- bs44 = testMarshalErr(v44v3, h, t, "enc-map-v44-custom")
- testUnmarshalErr(v44v4, bs44, h, t, "dec-map-v44-p-len")
- testDeepEqualErr(v44v3, v44v4, t, "equal-map-v44-p-len")
- }
-
- for _, v := range []map[float32]uintptr{nil, {}, {22.2: 0, 11.1: 33}} {
- // fmt.Printf(">>>> running mammoth map v45: %v\n", v)
- var v45v1, v45v2 map[float32]uintptr
- v45v1 = v
- bs45 := testMarshalErr(v45v1, h, t, "enc-map-v45")
- if v == nil {
- v45v2 = nil
- } else {
- v45v2 = make(map[float32]uintptr, len(v))
- } // reset map
- testUnmarshalErr(v45v2, bs45, h, t, "dec-map-v45")
- testDeepEqualErr(v45v1, v45v2, t, "equal-map-v45")
- if v == nil {
- v45v2 = nil
- } else {
- v45v2 = make(map[float32]uintptr, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v45v2), bs45, h, t, "dec-map-v45-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v45v1, v45v2, t, "equal-map-v45-noaddr")
- if v == nil {
- v45v2 = nil
- } else {
- v45v2 = make(map[float32]uintptr, len(v))
- } // reset map
- testUnmarshalErr(&v45v2, bs45, h, t, "dec-map-v45-p-len")
- testDeepEqualErr(v45v1, v45v2, t, "equal-map-v45-p-len")
- bs45 = testMarshalErr(&v45v1, h, t, "enc-map-v45-p")
- v45v2 = nil
- testUnmarshalErr(&v45v2, bs45, h, t, "dec-map-v45-p-nil")
- testDeepEqualErr(v45v1, v45v2, t, "equal-map-v45-p-nil")
- // ...
- if v == nil {
- v45v2 = nil
- } else {
- v45v2 = make(map[float32]uintptr, len(v))
- } // reset map
- var v45v3, v45v4 typMapMapFloat32Uintptr
- v45v3 = typMapMapFloat32Uintptr(v45v1)
- v45v4 = typMapMapFloat32Uintptr(v45v2)
- bs45 = testMarshalErr(v45v3, h, t, "enc-map-v45-custom")
- testUnmarshalErr(v45v4, bs45, h, t, "dec-map-v45-p-len")
- testDeepEqualErr(v45v3, v45v4, t, "equal-map-v45-p-len")
- }
-
- for _, v := range []map[float32]int{nil, {}, {22.2: 0, 11.1: 44}} {
- // fmt.Printf(">>>> running mammoth map v46: %v\n", v)
- var v46v1, v46v2 map[float32]int
- v46v1 = v
- bs46 := testMarshalErr(v46v1, h, t, "enc-map-v46")
- if v == nil {
- v46v2 = nil
- } else {
- v46v2 = make(map[float32]int, len(v))
- } // reset map
- testUnmarshalErr(v46v2, bs46, h, t, "dec-map-v46")
- testDeepEqualErr(v46v1, v46v2, t, "equal-map-v46")
- if v == nil {
- v46v2 = nil
- } else {
- v46v2 = make(map[float32]int, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v46v2), bs46, h, t, "dec-map-v46-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v46v1, v46v2, t, "equal-map-v46-noaddr")
- if v == nil {
- v46v2 = nil
- } else {
- v46v2 = make(map[float32]int, len(v))
- } // reset map
- testUnmarshalErr(&v46v2, bs46, h, t, "dec-map-v46-p-len")
- testDeepEqualErr(v46v1, v46v2, t, "equal-map-v46-p-len")
- bs46 = testMarshalErr(&v46v1, h, t, "enc-map-v46-p")
- v46v2 = nil
- testUnmarshalErr(&v46v2, bs46, h, t, "dec-map-v46-p-nil")
- testDeepEqualErr(v46v1, v46v2, t, "equal-map-v46-p-nil")
- // ...
- if v == nil {
- v46v2 = nil
- } else {
- v46v2 = make(map[float32]int, len(v))
- } // reset map
- var v46v3, v46v4 typMapMapFloat32Int
- v46v3 = typMapMapFloat32Int(v46v1)
- v46v4 = typMapMapFloat32Int(v46v2)
- bs46 = testMarshalErr(v46v3, h, t, "enc-map-v46-custom")
- testUnmarshalErr(v46v4, bs46, h, t, "dec-map-v46-p-len")
- testDeepEqualErr(v46v3, v46v4, t, "equal-map-v46-p-len")
- }
-
- for _, v := range []map[float32]int8{nil, {}, {22.2: 0, 11.1: 33}} {
- // fmt.Printf(">>>> running mammoth map v47: %v\n", v)
- var v47v1, v47v2 map[float32]int8
- v47v1 = v
- bs47 := testMarshalErr(v47v1, h, t, "enc-map-v47")
- if v == nil {
- v47v2 = nil
- } else {
- v47v2 = make(map[float32]int8, len(v))
- } // reset map
- testUnmarshalErr(v47v2, bs47, h, t, "dec-map-v47")
- testDeepEqualErr(v47v1, v47v2, t, "equal-map-v47")
- if v == nil {
- v47v2 = nil
- } else {
- v47v2 = make(map[float32]int8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v47v2), bs47, h, t, "dec-map-v47-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v47v1, v47v2, t, "equal-map-v47-noaddr")
- if v == nil {
- v47v2 = nil
- } else {
- v47v2 = make(map[float32]int8, len(v))
- } // reset map
- testUnmarshalErr(&v47v2, bs47, h, t, "dec-map-v47-p-len")
- testDeepEqualErr(v47v1, v47v2, t, "equal-map-v47-p-len")
- bs47 = testMarshalErr(&v47v1, h, t, "enc-map-v47-p")
- v47v2 = nil
- testUnmarshalErr(&v47v2, bs47, h, t, "dec-map-v47-p-nil")
- testDeepEqualErr(v47v1, v47v2, t, "equal-map-v47-p-nil")
- // ...
- if v == nil {
- v47v2 = nil
- } else {
- v47v2 = make(map[float32]int8, len(v))
- } // reset map
- var v47v3, v47v4 typMapMapFloat32Int8
- v47v3 = typMapMapFloat32Int8(v47v1)
- v47v4 = typMapMapFloat32Int8(v47v2)
- bs47 = testMarshalErr(v47v3, h, t, "enc-map-v47-custom")
- testUnmarshalErr(v47v4, bs47, h, t, "dec-map-v47-p-len")
- testDeepEqualErr(v47v3, v47v4, t, "equal-map-v47-p-len")
- }
-
- for _, v := range []map[float32]int16{nil, {}, {22.2: 0, 11.1: 44}} {
- // fmt.Printf(">>>> running mammoth map v48: %v\n", v)
- var v48v1, v48v2 map[float32]int16
- v48v1 = v
- bs48 := testMarshalErr(v48v1, h, t, "enc-map-v48")
- if v == nil {
- v48v2 = nil
- } else {
- v48v2 = make(map[float32]int16, len(v))
- } // reset map
- testUnmarshalErr(v48v2, bs48, h, t, "dec-map-v48")
- testDeepEqualErr(v48v1, v48v2, t, "equal-map-v48")
- if v == nil {
- v48v2 = nil
- } else {
- v48v2 = make(map[float32]int16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v48v2), bs48, h, t, "dec-map-v48-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v48v1, v48v2, t, "equal-map-v48-noaddr")
- if v == nil {
- v48v2 = nil
- } else {
- v48v2 = make(map[float32]int16, len(v))
- } // reset map
- testUnmarshalErr(&v48v2, bs48, h, t, "dec-map-v48-p-len")
- testDeepEqualErr(v48v1, v48v2, t, "equal-map-v48-p-len")
- bs48 = testMarshalErr(&v48v1, h, t, "enc-map-v48-p")
- v48v2 = nil
- testUnmarshalErr(&v48v2, bs48, h, t, "dec-map-v48-p-nil")
- testDeepEqualErr(v48v1, v48v2, t, "equal-map-v48-p-nil")
- // ...
- if v == nil {
- v48v2 = nil
- } else {
- v48v2 = make(map[float32]int16, len(v))
- } // reset map
- var v48v3, v48v4 typMapMapFloat32Int16
- v48v3 = typMapMapFloat32Int16(v48v1)
- v48v4 = typMapMapFloat32Int16(v48v2)
- bs48 = testMarshalErr(v48v3, h, t, "enc-map-v48-custom")
- testUnmarshalErr(v48v4, bs48, h, t, "dec-map-v48-p-len")
- testDeepEqualErr(v48v3, v48v4, t, "equal-map-v48-p-len")
- }
-
- for _, v := range []map[float32]int32{nil, {}, {22.2: 0, 11.1: 33}} {
- // fmt.Printf(">>>> running mammoth map v49: %v\n", v)
- var v49v1, v49v2 map[float32]int32
- v49v1 = v
- bs49 := testMarshalErr(v49v1, h, t, "enc-map-v49")
- if v == nil {
- v49v2 = nil
- } else {
- v49v2 = make(map[float32]int32, len(v))
- } // reset map
- testUnmarshalErr(v49v2, bs49, h, t, "dec-map-v49")
- testDeepEqualErr(v49v1, v49v2, t, "equal-map-v49")
- if v == nil {
- v49v2 = nil
- } else {
- v49v2 = make(map[float32]int32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v49v2), bs49, h, t, "dec-map-v49-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v49v1, v49v2, t, "equal-map-v49-noaddr")
- if v == nil {
- v49v2 = nil
- } else {
- v49v2 = make(map[float32]int32, len(v))
- } // reset map
- testUnmarshalErr(&v49v2, bs49, h, t, "dec-map-v49-p-len")
- testDeepEqualErr(v49v1, v49v2, t, "equal-map-v49-p-len")
- bs49 = testMarshalErr(&v49v1, h, t, "enc-map-v49-p")
- v49v2 = nil
- testUnmarshalErr(&v49v2, bs49, h, t, "dec-map-v49-p-nil")
- testDeepEqualErr(v49v1, v49v2, t, "equal-map-v49-p-nil")
- // ...
- if v == nil {
- v49v2 = nil
- } else {
- v49v2 = make(map[float32]int32, len(v))
- } // reset map
- var v49v3, v49v4 typMapMapFloat32Int32
- v49v3 = typMapMapFloat32Int32(v49v1)
- v49v4 = typMapMapFloat32Int32(v49v2)
- bs49 = testMarshalErr(v49v3, h, t, "enc-map-v49-custom")
- testUnmarshalErr(v49v4, bs49, h, t, "dec-map-v49-p-len")
- testDeepEqualErr(v49v3, v49v4, t, "equal-map-v49-p-len")
- }
-
- for _, v := range []map[float32]int64{nil, {}, {22.2: 0, 11.1: 44}} {
- // fmt.Printf(">>>> running mammoth map v50: %v\n", v)
- var v50v1, v50v2 map[float32]int64
- v50v1 = v
- bs50 := testMarshalErr(v50v1, h, t, "enc-map-v50")
- if v == nil {
- v50v2 = nil
- } else {
- v50v2 = make(map[float32]int64, len(v))
- } // reset map
- testUnmarshalErr(v50v2, bs50, h, t, "dec-map-v50")
- testDeepEqualErr(v50v1, v50v2, t, "equal-map-v50")
- if v == nil {
- v50v2 = nil
- } else {
- v50v2 = make(map[float32]int64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v50v2), bs50, h, t, "dec-map-v50-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v50v1, v50v2, t, "equal-map-v50-noaddr")
- if v == nil {
- v50v2 = nil
- } else {
- v50v2 = make(map[float32]int64, len(v))
- } // reset map
- testUnmarshalErr(&v50v2, bs50, h, t, "dec-map-v50-p-len")
- testDeepEqualErr(v50v1, v50v2, t, "equal-map-v50-p-len")
- bs50 = testMarshalErr(&v50v1, h, t, "enc-map-v50-p")
- v50v2 = nil
- testUnmarshalErr(&v50v2, bs50, h, t, "dec-map-v50-p-nil")
- testDeepEqualErr(v50v1, v50v2, t, "equal-map-v50-p-nil")
- // ...
- if v == nil {
- v50v2 = nil
- } else {
- v50v2 = make(map[float32]int64, len(v))
- } // reset map
- var v50v3, v50v4 typMapMapFloat32Int64
- v50v3 = typMapMapFloat32Int64(v50v1)
- v50v4 = typMapMapFloat32Int64(v50v2)
- bs50 = testMarshalErr(v50v3, h, t, "enc-map-v50-custom")
- testUnmarshalErr(v50v4, bs50, h, t, "dec-map-v50-p-len")
- testDeepEqualErr(v50v3, v50v4, t, "equal-map-v50-p-len")
- }
-
- for _, v := range []map[float32]float32{nil, {}, {22.2: 0, 11.1: 22.2}} {
- // fmt.Printf(">>>> running mammoth map v51: %v\n", v)
- var v51v1, v51v2 map[float32]float32
- v51v1 = v
- bs51 := testMarshalErr(v51v1, h, t, "enc-map-v51")
- if v == nil {
- v51v2 = nil
- } else {
- v51v2 = make(map[float32]float32, len(v))
- } // reset map
- testUnmarshalErr(v51v2, bs51, h, t, "dec-map-v51")
- testDeepEqualErr(v51v1, v51v2, t, "equal-map-v51")
- if v == nil {
- v51v2 = nil
- } else {
- v51v2 = make(map[float32]float32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v51v2), bs51, h, t, "dec-map-v51-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v51v1, v51v2, t, "equal-map-v51-noaddr")
- if v == nil {
- v51v2 = nil
- } else {
- v51v2 = make(map[float32]float32, len(v))
- } // reset map
- testUnmarshalErr(&v51v2, bs51, h, t, "dec-map-v51-p-len")
- testDeepEqualErr(v51v1, v51v2, t, "equal-map-v51-p-len")
- bs51 = testMarshalErr(&v51v1, h, t, "enc-map-v51-p")
- v51v2 = nil
- testUnmarshalErr(&v51v2, bs51, h, t, "dec-map-v51-p-nil")
- testDeepEqualErr(v51v1, v51v2, t, "equal-map-v51-p-nil")
- // ...
- if v == nil {
- v51v2 = nil
- } else {
- v51v2 = make(map[float32]float32, len(v))
- } // reset map
- var v51v3, v51v4 typMapMapFloat32Float32
- v51v3 = typMapMapFloat32Float32(v51v1)
- v51v4 = typMapMapFloat32Float32(v51v2)
- bs51 = testMarshalErr(v51v3, h, t, "enc-map-v51-custom")
- testUnmarshalErr(v51v4, bs51, h, t, "dec-map-v51-p-len")
- testDeepEqualErr(v51v3, v51v4, t, "equal-map-v51-p-len")
- }
-
- for _, v := range []map[float32]float64{nil, {}, {11.1: 0, 22.2: 11.1}} {
- // fmt.Printf(">>>> running mammoth map v52: %v\n", v)
- var v52v1, v52v2 map[float32]float64
- v52v1 = v
- bs52 := testMarshalErr(v52v1, h, t, "enc-map-v52")
- if v == nil {
- v52v2 = nil
- } else {
- v52v2 = make(map[float32]float64, len(v))
- } // reset map
- testUnmarshalErr(v52v2, bs52, h, t, "dec-map-v52")
- testDeepEqualErr(v52v1, v52v2, t, "equal-map-v52")
- if v == nil {
- v52v2 = nil
- } else {
- v52v2 = make(map[float32]float64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v52v2), bs52, h, t, "dec-map-v52-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v52v1, v52v2, t, "equal-map-v52-noaddr")
- if v == nil {
- v52v2 = nil
- } else {
- v52v2 = make(map[float32]float64, len(v))
- } // reset map
- testUnmarshalErr(&v52v2, bs52, h, t, "dec-map-v52-p-len")
- testDeepEqualErr(v52v1, v52v2, t, "equal-map-v52-p-len")
- bs52 = testMarshalErr(&v52v1, h, t, "enc-map-v52-p")
- v52v2 = nil
- testUnmarshalErr(&v52v2, bs52, h, t, "dec-map-v52-p-nil")
- testDeepEqualErr(v52v1, v52v2, t, "equal-map-v52-p-nil")
- // ...
- if v == nil {
- v52v2 = nil
- } else {
- v52v2 = make(map[float32]float64, len(v))
- } // reset map
- var v52v3, v52v4 typMapMapFloat32Float64
- v52v3 = typMapMapFloat32Float64(v52v1)
- v52v4 = typMapMapFloat32Float64(v52v2)
- bs52 = testMarshalErr(v52v3, h, t, "enc-map-v52-custom")
- testUnmarshalErr(v52v4, bs52, h, t, "dec-map-v52-p-len")
- testDeepEqualErr(v52v3, v52v4, t, "equal-map-v52-p-len")
- }
-
- for _, v := range []map[float32]bool{nil, {}, {22.2: false, 11.1: true}} {
- // fmt.Printf(">>>> running mammoth map v53: %v\n", v)
- var v53v1, v53v2 map[float32]bool
- v53v1 = v
- bs53 := testMarshalErr(v53v1, h, t, "enc-map-v53")
- if v == nil {
- v53v2 = nil
- } else {
- v53v2 = make(map[float32]bool, len(v))
- } // reset map
- testUnmarshalErr(v53v2, bs53, h, t, "dec-map-v53")
- testDeepEqualErr(v53v1, v53v2, t, "equal-map-v53")
- if v == nil {
- v53v2 = nil
- } else {
- v53v2 = make(map[float32]bool, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v53v2), bs53, h, t, "dec-map-v53-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v53v1, v53v2, t, "equal-map-v53-noaddr")
- if v == nil {
- v53v2 = nil
- } else {
- v53v2 = make(map[float32]bool, len(v))
- } // reset map
- testUnmarshalErr(&v53v2, bs53, h, t, "dec-map-v53-p-len")
- testDeepEqualErr(v53v1, v53v2, t, "equal-map-v53-p-len")
- bs53 = testMarshalErr(&v53v1, h, t, "enc-map-v53-p")
- v53v2 = nil
- testUnmarshalErr(&v53v2, bs53, h, t, "dec-map-v53-p-nil")
- testDeepEqualErr(v53v1, v53v2, t, "equal-map-v53-p-nil")
- // ...
- if v == nil {
- v53v2 = nil
- } else {
- v53v2 = make(map[float32]bool, len(v))
- } // reset map
- var v53v3, v53v4 typMapMapFloat32Bool
- v53v3 = typMapMapFloat32Bool(v53v1)
- v53v4 = typMapMapFloat32Bool(v53v2)
- bs53 = testMarshalErr(v53v3, h, t, "enc-map-v53-custom")
- testUnmarshalErr(v53v4, bs53, h, t, "dec-map-v53-p-len")
- testDeepEqualErr(v53v3, v53v4, t, "equal-map-v53-p-len")
- }
-
- for _, v := range []map[float64]interface{}{nil, {}, {22.2: nil, 11.1: "string-is-an-interface"}} {
- // fmt.Printf(">>>> running mammoth map v56: %v\n", v)
- var v56v1, v56v2 map[float64]interface{}
- v56v1 = v
- bs56 := testMarshalErr(v56v1, h, t, "enc-map-v56")
- if v == nil {
- v56v2 = nil
- } else {
- v56v2 = make(map[float64]interface{}, len(v))
- } // reset map
- testUnmarshalErr(v56v2, bs56, h, t, "dec-map-v56")
- testDeepEqualErr(v56v1, v56v2, t, "equal-map-v56")
- if v == nil {
- v56v2 = nil
- } else {
- v56v2 = make(map[float64]interface{}, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v56v2), bs56, h, t, "dec-map-v56-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v56v1, v56v2, t, "equal-map-v56-noaddr")
- if v == nil {
- v56v2 = nil
- } else {
- v56v2 = make(map[float64]interface{}, len(v))
- } // reset map
- testUnmarshalErr(&v56v2, bs56, h, t, "dec-map-v56-p-len")
- testDeepEqualErr(v56v1, v56v2, t, "equal-map-v56-p-len")
- bs56 = testMarshalErr(&v56v1, h, t, "enc-map-v56-p")
- v56v2 = nil
- testUnmarshalErr(&v56v2, bs56, h, t, "dec-map-v56-p-nil")
- testDeepEqualErr(v56v1, v56v2, t, "equal-map-v56-p-nil")
- // ...
- if v == nil {
- v56v2 = nil
- } else {
- v56v2 = make(map[float64]interface{}, len(v))
- } // reset map
- var v56v3, v56v4 typMapMapFloat64Intf
- v56v3 = typMapMapFloat64Intf(v56v1)
- v56v4 = typMapMapFloat64Intf(v56v2)
- bs56 = testMarshalErr(v56v3, h, t, "enc-map-v56-custom")
- testUnmarshalErr(v56v4, bs56, h, t, "dec-map-v56-p-len")
- testDeepEqualErr(v56v3, v56v4, t, "equal-map-v56-p-len")
- }
-
- for _, v := range []map[float64]string{nil, {}, {22.2: "", 11.1: "some-string"}} {
- // fmt.Printf(">>>> running mammoth map v57: %v\n", v)
- var v57v1, v57v2 map[float64]string
- v57v1 = v
- bs57 := testMarshalErr(v57v1, h, t, "enc-map-v57")
- if v == nil {
- v57v2 = nil
- } else {
- v57v2 = make(map[float64]string, len(v))
- } // reset map
- testUnmarshalErr(v57v2, bs57, h, t, "dec-map-v57")
- testDeepEqualErr(v57v1, v57v2, t, "equal-map-v57")
- if v == nil {
- v57v2 = nil
- } else {
- v57v2 = make(map[float64]string, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v57v2), bs57, h, t, "dec-map-v57-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v57v1, v57v2, t, "equal-map-v57-noaddr")
- if v == nil {
- v57v2 = nil
- } else {
- v57v2 = make(map[float64]string, len(v))
- } // reset map
- testUnmarshalErr(&v57v2, bs57, h, t, "dec-map-v57-p-len")
- testDeepEqualErr(v57v1, v57v2, t, "equal-map-v57-p-len")
- bs57 = testMarshalErr(&v57v1, h, t, "enc-map-v57-p")
- v57v2 = nil
- testUnmarshalErr(&v57v2, bs57, h, t, "dec-map-v57-p-nil")
- testDeepEqualErr(v57v1, v57v2, t, "equal-map-v57-p-nil")
- // ...
- if v == nil {
- v57v2 = nil
- } else {
- v57v2 = make(map[float64]string, len(v))
- } // reset map
- var v57v3, v57v4 typMapMapFloat64String
- v57v3 = typMapMapFloat64String(v57v1)
- v57v4 = typMapMapFloat64String(v57v2)
- bs57 = testMarshalErr(v57v3, h, t, "enc-map-v57-custom")
- testUnmarshalErr(v57v4, bs57, h, t, "dec-map-v57-p-len")
- testDeepEqualErr(v57v3, v57v4, t, "equal-map-v57-p-len")
- }
-
- for _, v := range []map[float64]uint{nil, {}, {22.2: 0, 11.1: 33}} {
- // fmt.Printf(">>>> running mammoth map v58: %v\n", v)
- var v58v1, v58v2 map[float64]uint
- v58v1 = v
- bs58 := testMarshalErr(v58v1, h, t, "enc-map-v58")
- if v == nil {
- v58v2 = nil
- } else {
- v58v2 = make(map[float64]uint, len(v))
- } // reset map
- testUnmarshalErr(v58v2, bs58, h, t, "dec-map-v58")
- testDeepEqualErr(v58v1, v58v2, t, "equal-map-v58")
- if v == nil {
- v58v2 = nil
- } else {
- v58v2 = make(map[float64]uint, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v58v2), bs58, h, t, "dec-map-v58-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v58v1, v58v2, t, "equal-map-v58-noaddr")
- if v == nil {
- v58v2 = nil
- } else {
- v58v2 = make(map[float64]uint, len(v))
- } // reset map
- testUnmarshalErr(&v58v2, bs58, h, t, "dec-map-v58-p-len")
- testDeepEqualErr(v58v1, v58v2, t, "equal-map-v58-p-len")
- bs58 = testMarshalErr(&v58v1, h, t, "enc-map-v58-p")
- v58v2 = nil
- testUnmarshalErr(&v58v2, bs58, h, t, "dec-map-v58-p-nil")
- testDeepEqualErr(v58v1, v58v2, t, "equal-map-v58-p-nil")
- // ...
- if v == nil {
- v58v2 = nil
- } else {
- v58v2 = make(map[float64]uint, len(v))
- } // reset map
- var v58v3, v58v4 typMapMapFloat64Uint
- v58v3 = typMapMapFloat64Uint(v58v1)
- v58v4 = typMapMapFloat64Uint(v58v2)
- bs58 = testMarshalErr(v58v3, h, t, "enc-map-v58-custom")
- testUnmarshalErr(v58v4, bs58, h, t, "dec-map-v58-p-len")
- testDeepEqualErr(v58v3, v58v4, t, "equal-map-v58-p-len")
- }
-
- for _, v := range []map[float64]uint8{nil, {}, {22.2: 0, 11.1: 44}} {
- // fmt.Printf(">>>> running mammoth map v59: %v\n", v)
- var v59v1, v59v2 map[float64]uint8
- v59v1 = v
- bs59 := testMarshalErr(v59v1, h, t, "enc-map-v59")
- if v == nil {
- v59v2 = nil
- } else {
- v59v2 = make(map[float64]uint8, len(v))
- } // reset map
- testUnmarshalErr(v59v2, bs59, h, t, "dec-map-v59")
- testDeepEqualErr(v59v1, v59v2, t, "equal-map-v59")
- if v == nil {
- v59v2 = nil
- } else {
- v59v2 = make(map[float64]uint8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v59v2), bs59, h, t, "dec-map-v59-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v59v1, v59v2, t, "equal-map-v59-noaddr")
- if v == nil {
- v59v2 = nil
- } else {
- v59v2 = make(map[float64]uint8, len(v))
- } // reset map
- testUnmarshalErr(&v59v2, bs59, h, t, "dec-map-v59-p-len")
- testDeepEqualErr(v59v1, v59v2, t, "equal-map-v59-p-len")
- bs59 = testMarshalErr(&v59v1, h, t, "enc-map-v59-p")
- v59v2 = nil
- testUnmarshalErr(&v59v2, bs59, h, t, "dec-map-v59-p-nil")
- testDeepEqualErr(v59v1, v59v2, t, "equal-map-v59-p-nil")
- // ...
- if v == nil {
- v59v2 = nil
- } else {
- v59v2 = make(map[float64]uint8, len(v))
- } // reset map
- var v59v3, v59v4 typMapMapFloat64Uint8
- v59v3 = typMapMapFloat64Uint8(v59v1)
- v59v4 = typMapMapFloat64Uint8(v59v2)
- bs59 = testMarshalErr(v59v3, h, t, "enc-map-v59-custom")
- testUnmarshalErr(v59v4, bs59, h, t, "dec-map-v59-p-len")
- testDeepEqualErr(v59v3, v59v4, t, "equal-map-v59-p-len")
- }
-
- for _, v := range []map[float64]uint16{nil, {}, {22.2: 0, 11.1: 33}} {
- // fmt.Printf(">>>> running mammoth map v60: %v\n", v)
- var v60v1, v60v2 map[float64]uint16
- v60v1 = v
- bs60 := testMarshalErr(v60v1, h, t, "enc-map-v60")
- if v == nil {
- v60v2 = nil
- } else {
- v60v2 = make(map[float64]uint16, len(v))
- } // reset map
- testUnmarshalErr(v60v2, bs60, h, t, "dec-map-v60")
- testDeepEqualErr(v60v1, v60v2, t, "equal-map-v60")
- if v == nil {
- v60v2 = nil
- } else {
- v60v2 = make(map[float64]uint16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v60v2), bs60, h, t, "dec-map-v60-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v60v1, v60v2, t, "equal-map-v60-noaddr")
- if v == nil {
- v60v2 = nil
- } else {
- v60v2 = make(map[float64]uint16, len(v))
- } // reset map
- testUnmarshalErr(&v60v2, bs60, h, t, "dec-map-v60-p-len")
- testDeepEqualErr(v60v1, v60v2, t, "equal-map-v60-p-len")
- bs60 = testMarshalErr(&v60v1, h, t, "enc-map-v60-p")
- v60v2 = nil
- testUnmarshalErr(&v60v2, bs60, h, t, "dec-map-v60-p-nil")
- testDeepEqualErr(v60v1, v60v2, t, "equal-map-v60-p-nil")
- // ...
- if v == nil {
- v60v2 = nil
- } else {
- v60v2 = make(map[float64]uint16, len(v))
- } // reset map
- var v60v3, v60v4 typMapMapFloat64Uint16
- v60v3 = typMapMapFloat64Uint16(v60v1)
- v60v4 = typMapMapFloat64Uint16(v60v2)
- bs60 = testMarshalErr(v60v3, h, t, "enc-map-v60-custom")
- testUnmarshalErr(v60v4, bs60, h, t, "dec-map-v60-p-len")
- testDeepEqualErr(v60v3, v60v4, t, "equal-map-v60-p-len")
- }
-
- for _, v := range []map[float64]uint32{nil, {}, {22.2: 0, 11.1: 44}} {
- // fmt.Printf(">>>> running mammoth map v61: %v\n", v)
- var v61v1, v61v2 map[float64]uint32
- v61v1 = v
- bs61 := testMarshalErr(v61v1, h, t, "enc-map-v61")
- if v == nil {
- v61v2 = nil
- } else {
- v61v2 = make(map[float64]uint32, len(v))
- } // reset map
- testUnmarshalErr(v61v2, bs61, h, t, "dec-map-v61")
- testDeepEqualErr(v61v1, v61v2, t, "equal-map-v61")
- if v == nil {
- v61v2 = nil
- } else {
- v61v2 = make(map[float64]uint32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v61v2), bs61, h, t, "dec-map-v61-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v61v1, v61v2, t, "equal-map-v61-noaddr")
- if v == nil {
- v61v2 = nil
- } else {
- v61v2 = make(map[float64]uint32, len(v))
- } // reset map
- testUnmarshalErr(&v61v2, bs61, h, t, "dec-map-v61-p-len")
- testDeepEqualErr(v61v1, v61v2, t, "equal-map-v61-p-len")
- bs61 = testMarshalErr(&v61v1, h, t, "enc-map-v61-p")
- v61v2 = nil
- testUnmarshalErr(&v61v2, bs61, h, t, "dec-map-v61-p-nil")
- testDeepEqualErr(v61v1, v61v2, t, "equal-map-v61-p-nil")
- // ...
- if v == nil {
- v61v2 = nil
- } else {
- v61v2 = make(map[float64]uint32, len(v))
- } // reset map
- var v61v3, v61v4 typMapMapFloat64Uint32
- v61v3 = typMapMapFloat64Uint32(v61v1)
- v61v4 = typMapMapFloat64Uint32(v61v2)
- bs61 = testMarshalErr(v61v3, h, t, "enc-map-v61-custom")
- testUnmarshalErr(v61v4, bs61, h, t, "dec-map-v61-p-len")
- testDeepEqualErr(v61v3, v61v4, t, "equal-map-v61-p-len")
- }
-
- for _, v := range []map[float64]uint64{nil, {}, {22.2: 0, 11.1: 33}} {
- // fmt.Printf(">>>> running mammoth map v62: %v\n", v)
- var v62v1, v62v2 map[float64]uint64
- v62v1 = v
- bs62 := testMarshalErr(v62v1, h, t, "enc-map-v62")
- if v == nil {
- v62v2 = nil
- } else {
- v62v2 = make(map[float64]uint64, len(v))
- } // reset map
- testUnmarshalErr(v62v2, bs62, h, t, "dec-map-v62")
- testDeepEqualErr(v62v1, v62v2, t, "equal-map-v62")
- if v == nil {
- v62v2 = nil
- } else {
- v62v2 = make(map[float64]uint64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v62v2), bs62, h, t, "dec-map-v62-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v62v1, v62v2, t, "equal-map-v62-noaddr")
- if v == nil {
- v62v2 = nil
- } else {
- v62v2 = make(map[float64]uint64, len(v))
- } // reset map
- testUnmarshalErr(&v62v2, bs62, h, t, "dec-map-v62-p-len")
- testDeepEqualErr(v62v1, v62v2, t, "equal-map-v62-p-len")
- bs62 = testMarshalErr(&v62v1, h, t, "enc-map-v62-p")
- v62v2 = nil
- testUnmarshalErr(&v62v2, bs62, h, t, "dec-map-v62-p-nil")
- testDeepEqualErr(v62v1, v62v2, t, "equal-map-v62-p-nil")
- // ...
- if v == nil {
- v62v2 = nil
- } else {
- v62v2 = make(map[float64]uint64, len(v))
- } // reset map
- var v62v3, v62v4 typMapMapFloat64Uint64
- v62v3 = typMapMapFloat64Uint64(v62v1)
- v62v4 = typMapMapFloat64Uint64(v62v2)
- bs62 = testMarshalErr(v62v3, h, t, "enc-map-v62-custom")
- testUnmarshalErr(v62v4, bs62, h, t, "dec-map-v62-p-len")
- testDeepEqualErr(v62v3, v62v4, t, "equal-map-v62-p-len")
- }
-
- for _, v := range []map[float64]uintptr{nil, {}, {22.2: 0, 11.1: 44}} {
- // fmt.Printf(">>>> running mammoth map v63: %v\n", v)
- var v63v1, v63v2 map[float64]uintptr
- v63v1 = v
- bs63 := testMarshalErr(v63v1, h, t, "enc-map-v63")
- if v == nil {
- v63v2 = nil
- } else {
- v63v2 = make(map[float64]uintptr, len(v))
- } // reset map
- testUnmarshalErr(v63v2, bs63, h, t, "dec-map-v63")
- testDeepEqualErr(v63v1, v63v2, t, "equal-map-v63")
- if v == nil {
- v63v2 = nil
- } else {
- v63v2 = make(map[float64]uintptr, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v63v2), bs63, h, t, "dec-map-v63-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v63v1, v63v2, t, "equal-map-v63-noaddr")
- if v == nil {
- v63v2 = nil
- } else {
- v63v2 = make(map[float64]uintptr, len(v))
- } // reset map
- testUnmarshalErr(&v63v2, bs63, h, t, "dec-map-v63-p-len")
- testDeepEqualErr(v63v1, v63v2, t, "equal-map-v63-p-len")
- bs63 = testMarshalErr(&v63v1, h, t, "enc-map-v63-p")
- v63v2 = nil
- testUnmarshalErr(&v63v2, bs63, h, t, "dec-map-v63-p-nil")
- testDeepEqualErr(v63v1, v63v2, t, "equal-map-v63-p-nil")
- // ...
- if v == nil {
- v63v2 = nil
- } else {
- v63v2 = make(map[float64]uintptr, len(v))
- } // reset map
- var v63v3, v63v4 typMapMapFloat64Uintptr
- v63v3 = typMapMapFloat64Uintptr(v63v1)
- v63v4 = typMapMapFloat64Uintptr(v63v2)
- bs63 = testMarshalErr(v63v3, h, t, "enc-map-v63-custom")
- testUnmarshalErr(v63v4, bs63, h, t, "dec-map-v63-p-len")
- testDeepEqualErr(v63v3, v63v4, t, "equal-map-v63-p-len")
- }
-
- for _, v := range []map[float64]int{nil, {}, {22.2: 0, 11.1: 33}} {
- // fmt.Printf(">>>> running mammoth map v64: %v\n", v)
- var v64v1, v64v2 map[float64]int
- v64v1 = v
- bs64 := testMarshalErr(v64v1, h, t, "enc-map-v64")
- if v == nil {
- v64v2 = nil
- } else {
- v64v2 = make(map[float64]int, len(v))
- } // reset map
- testUnmarshalErr(v64v2, bs64, h, t, "dec-map-v64")
- testDeepEqualErr(v64v1, v64v2, t, "equal-map-v64")
- if v == nil {
- v64v2 = nil
- } else {
- v64v2 = make(map[float64]int, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v64v2), bs64, h, t, "dec-map-v64-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v64v1, v64v2, t, "equal-map-v64-noaddr")
- if v == nil {
- v64v2 = nil
- } else {
- v64v2 = make(map[float64]int, len(v))
- } // reset map
- testUnmarshalErr(&v64v2, bs64, h, t, "dec-map-v64-p-len")
- testDeepEqualErr(v64v1, v64v2, t, "equal-map-v64-p-len")
- bs64 = testMarshalErr(&v64v1, h, t, "enc-map-v64-p")
- v64v2 = nil
- testUnmarshalErr(&v64v2, bs64, h, t, "dec-map-v64-p-nil")
- testDeepEqualErr(v64v1, v64v2, t, "equal-map-v64-p-nil")
- // ...
- if v == nil {
- v64v2 = nil
- } else {
- v64v2 = make(map[float64]int, len(v))
- } // reset map
- var v64v3, v64v4 typMapMapFloat64Int
- v64v3 = typMapMapFloat64Int(v64v1)
- v64v4 = typMapMapFloat64Int(v64v2)
- bs64 = testMarshalErr(v64v3, h, t, "enc-map-v64-custom")
- testUnmarshalErr(v64v4, bs64, h, t, "dec-map-v64-p-len")
- testDeepEqualErr(v64v3, v64v4, t, "equal-map-v64-p-len")
- }
-
- for _, v := range []map[float64]int8{nil, {}, {22.2: 0, 11.1: 44}} {
- // fmt.Printf(">>>> running mammoth map v65: %v\n", v)
- var v65v1, v65v2 map[float64]int8
- v65v1 = v
- bs65 := testMarshalErr(v65v1, h, t, "enc-map-v65")
- if v == nil {
- v65v2 = nil
- } else {
- v65v2 = make(map[float64]int8, len(v))
- } // reset map
- testUnmarshalErr(v65v2, bs65, h, t, "dec-map-v65")
- testDeepEqualErr(v65v1, v65v2, t, "equal-map-v65")
- if v == nil {
- v65v2 = nil
- } else {
- v65v2 = make(map[float64]int8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v65v2), bs65, h, t, "dec-map-v65-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v65v1, v65v2, t, "equal-map-v65-noaddr")
- if v == nil {
- v65v2 = nil
- } else {
- v65v2 = make(map[float64]int8, len(v))
- } // reset map
- testUnmarshalErr(&v65v2, bs65, h, t, "dec-map-v65-p-len")
- testDeepEqualErr(v65v1, v65v2, t, "equal-map-v65-p-len")
- bs65 = testMarshalErr(&v65v1, h, t, "enc-map-v65-p")
- v65v2 = nil
- testUnmarshalErr(&v65v2, bs65, h, t, "dec-map-v65-p-nil")
- testDeepEqualErr(v65v1, v65v2, t, "equal-map-v65-p-nil")
- // ...
- if v == nil {
- v65v2 = nil
- } else {
- v65v2 = make(map[float64]int8, len(v))
- } // reset map
- var v65v3, v65v4 typMapMapFloat64Int8
- v65v3 = typMapMapFloat64Int8(v65v1)
- v65v4 = typMapMapFloat64Int8(v65v2)
- bs65 = testMarshalErr(v65v3, h, t, "enc-map-v65-custom")
- testUnmarshalErr(v65v4, bs65, h, t, "dec-map-v65-p-len")
- testDeepEqualErr(v65v3, v65v4, t, "equal-map-v65-p-len")
- }
-
- for _, v := range []map[float64]int16{nil, {}, {22.2: 0, 11.1: 33}} {
- // fmt.Printf(">>>> running mammoth map v66: %v\n", v)
- var v66v1, v66v2 map[float64]int16
- v66v1 = v
- bs66 := testMarshalErr(v66v1, h, t, "enc-map-v66")
- if v == nil {
- v66v2 = nil
- } else {
- v66v2 = make(map[float64]int16, len(v))
- } // reset map
- testUnmarshalErr(v66v2, bs66, h, t, "dec-map-v66")
- testDeepEqualErr(v66v1, v66v2, t, "equal-map-v66")
- if v == nil {
- v66v2 = nil
- } else {
- v66v2 = make(map[float64]int16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v66v2), bs66, h, t, "dec-map-v66-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v66v1, v66v2, t, "equal-map-v66-noaddr")
- if v == nil {
- v66v2 = nil
- } else {
- v66v2 = make(map[float64]int16, len(v))
- } // reset map
- testUnmarshalErr(&v66v2, bs66, h, t, "dec-map-v66-p-len")
- testDeepEqualErr(v66v1, v66v2, t, "equal-map-v66-p-len")
- bs66 = testMarshalErr(&v66v1, h, t, "enc-map-v66-p")
- v66v2 = nil
- testUnmarshalErr(&v66v2, bs66, h, t, "dec-map-v66-p-nil")
- testDeepEqualErr(v66v1, v66v2, t, "equal-map-v66-p-nil")
- // ...
- if v == nil {
- v66v2 = nil
- } else {
- v66v2 = make(map[float64]int16, len(v))
- } // reset map
- var v66v3, v66v4 typMapMapFloat64Int16
- v66v3 = typMapMapFloat64Int16(v66v1)
- v66v4 = typMapMapFloat64Int16(v66v2)
- bs66 = testMarshalErr(v66v3, h, t, "enc-map-v66-custom")
- testUnmarshalErr(v66v4, bs66, h, t, "dec-map-v66-p-len")
- testDeepEqualErr(v66v3, v66v4, t, "equal-map-v66-p-len")
- }
-
- for _, v := range []map[float64]int32{nil, {}, {22.2: 0, 11.1: 44}} {
- // fmt.Printf(">>>> running mammoth map v67: %v\n", v)
- var v67v1, v67v2 map[float64]int32
- v67v1 = v
- bs67 := testMarshalErr(v67v1, h, t, "enc-map-v67")
- if v == nil {
- v67v2 = nil
- } else {
- v67v2 = make(map[float64]int32, len(v))
- } // reset map
- testUnmarshalErr(v67v2, bs67, h, t, "dec-map-v67")
- testDeepEqualErr(v67v1, v67v2, t, "equal-map-v67")
- if v == nil {
- v67v2 = nil
- } else {
- v67v2 = make(map[float64]int32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v67v2), bs67, h, t, "dec-map-v67-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v67v1, v67v2, t, "equal-map-v67-noaddr")
- if v == nil {
- v67v2 = nil
- } else {
- v67v2 = make(map[float64]int32, len(v))
- } // reset map
- testUnmarshalErr(&v67v2, bs67, h, t, "dec-map-v67-p-len")
- testDeepEqualErr(v67v1, v67v2, t, "equal-map-v67-p-len")
- bs67 = testMarshalErr(&v67v1, h, t, "enc-map-v67-p")
- v67v2 = nil
- testUnmarshalErr(&v67v2, bs67, h, t, "dec-map-v67-p-nil")
- testDeepEqualErr(v67v1, v67v2, t, "equal-map-v67-p-nil")
- // ...
- if v == nil {
- v67v2 = nil
- } else {
- v67v2 = make(map[float64]int32, len(v))
- } // reset map
- var v67v3, v67v4 typMapMapFloat64Int32
- v67v3 = typMapMapFloat64Int32(v67v1)
- v67v4 = typMapMapFloat64Int32(v67v2)
- bs67 = testMarshalErr(v67v3, h, t, "enc-map-v67-custom")
- testUnmarshalErr(v67v4, bs67, h, t, "dec-map-v67-p-len")
- testDeepEqualErr(v67v3, v67v4, t, "equal-map-v67-p-len")
- }
-
- for _, v := range []map[float64]int64{nil, {}, {22.2: 0, 11.1: 33}} {
- // fmt.Printf(">>>> running mammoth map v68: %v\n", v)
- var v68v1, v68v2 map[float64]int64
- v68v1 = v
- bs68 := testMarshalErr(v68v1, h, t, "enc-map-v68")
- if v == nil {
- v68v2 = nil
- } else {
- v68v2 = make(map[float64]int64, len(v))
- } // reset map
- testUnmarshalErr(v68v2, bs68, h, t, "dec-map-v68")
- testDeepEqualErr(v68v1, v68v2, t, "equal-map-v68")
- if v == nil {
- v68v2 = nil
- } else {
- v68v2 = make(map[float64]int64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v68v2), bs68, h, t, "dec-map-v68-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v68v1, v68v2, t, "equal-map-v68-noaddr")
- if v == nil {
- v68v2 = nil
- } else {
- v68v2 = make(map[float64]int64, len(v))
- } // reset map
- testUnmarshalErr(&v68v2, bs68, h, t, "dec-map-v68-p-len")
- testDeepEqualErr(v68v1, v68v2, t, "equal-map-v68-p-len")
- bs68 = testMarshalErr(&v68v1, h, t, "enc-map-v68-p")
- v68v2 = nil
- testUnmarshalErr(&v68v2, bs68, h, t, "dec-map-v68-p-nil")
- testDeepEqualErr(v68v1, v68v2, t, "equal-map-v68-p-nil")
- // ...
- if v == nil {
- v68v2 = nil
- } else {
- v68v2 = make(map[float64]int64, len(v))
- } // reset map
- var v68v3, v68v4 typMapMapFloat64Int64
- v68v3 = typMapMapFloat64Int64(v68v1)
- v68v4 = typMapMapFloat64Int64(v68v2)
- bs68 = testMarshalErr(v68v3, h, t, "enc-map-v68-custom")
- testUnmarshalErr(v68v4, bs68, h, t, "dec-map-v68-p-len")
- testDeepEqualErr(v68v3, v68v4, t, "equal-map-v68-p-len")
- }
-
- for _, v := range []map[float64]float32{nil, {}, {22.2: 0, 11.1: 22.2}} {
- // fmt.Printf(">>>> running mammoth map v69: %v\n", v)
- var v69v1, v69v2 map[float64]float32
- v69v1 = v
- bs69 := testMarshalErr(v69v1, h, t, "enc-map-v69")
- if v == nil {
- v69v2 = nil
- } else {
- v69v2 = make(map[float64]float32, len(v))
- } // reset map
- testUnmarshalErr(v69v2, bs69, h, t, "dec-map-v69")
- testDeepEqualErr(v69v1, v69v2, t, "equal-map-v69")
- if v == nil {
- v69v2 = nil
- } else {
- v69v2 = make(map[float64]float32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v69v2), bs69, h, t, "dec-map-v69-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v69v1, v69v2, t, "equal-map-v69-noaddr")
- if v == nil {
- v69v2 = nil
- } else {
- v69v2 = make(map[float64]float32, len(v))
- } // reset map
- testUnmarshalErr(&v69v2, bs69, h, t, "dec-map-v69-p-len")
- testDeepEqualErr(v69v1, v69v2, t, "equal-map-v69-p-len")
- bs69 = testMarshalErr(&v69v1, h, t, "enc-map-v69-p")
- v69v2 = nil
- testUnmarshalErr(&v69v2, bs69, h, t, "dec-map-v69-p-nil")
- testDeepEqualErr(v69v1, v69v2, t, "equal-map-v69-p-nil")
- // ...
- if v == nil {
- v69v2 = nil
- } else {
- v69v2 = make(map[float64]float32, len(v))
- } // reset map
- var v69v3, v69v4 typMapMapFloat64Float32
- v69v3 = typMapMapFloat64Float32(v69v1)
- v69v4 = typMapMapFloat64Float32(v69v2)
- bs69 = testMarshalErr(v69v3, h, t, "enc-map-v69-custom")
- testUnmarshalErr(v69v4, bs69, h, t, "dec-map-v69-p-len")
- testDeepEqualErr(v69v3, v69v4, t, "equal-map-v69-p-len")
- }
-
- for _, v := range []map[float64]float64{nil, {}, {11.1: 0, 22.2: 11.1}} {
- // fmt.Printf(">>>> running mammoth map v70: %v\n", v)
- var v70v1, v70v2 map[float64]float64
- v70v1 = v
- bs70 := testMarshalErr(v70v1, h, t, "enc-map-v70")
- if v == nil {
- v70v2 = nil
- } else {
- v70v2 = make(map[float64]float64, len(v))
- } // reset map
- testUnmarshalErr(v70v2, bs70, h, t, "dec-map-v70")
- testDeepEqualErr(v70v1, v70v2, t, "equal-map-v70")
- if v == nil {
- v70v2 = nil
- } else {
- v70v2 = make(map[float64]float64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v70v2), bs70, h, t, "dec-map-v70-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v70v1, v70v2, t, "equal-map-v70-noaddr")
- if v == nil {
- v70v2 = nil
- } else {
- v70v2 = make(map[float64]float64, len(v))
- } // reset map
- testUnmarshalErr(&v70v2, bs70, h, t, "dec-map-v70-p-len")
- testDeepEqualErr(v70v1, v70v2, t, "equal-map-v70-p-len")
- bs70 = testMarshalErr(&v70v1, h, t, "enc-map-v70-p")
- v70v2 = nil
- testUnmarshalErr(&v70v2, bs70, h, t, "dec-map-v70-p-nil")
- testDeepEqualErr(v70v1, v70v2, t, "equal-map-v70-p-nil")
- // ...
- if v == nil {
- v70v2 = nil
- } else {
- v70v2 = make(map[float64]float64, len(v))
- } // reset map
- var v70v3, v70v4 typMapMapFloat64Float64
- v70v3 = typMapMapFloat64Float64(v70v1)
- v70v4 = typMapMapFloat64Float64(v70v2)
- bs70 = testMarshalErr(v70v3, h, t, "enc-map-v70-custom")
- testUnmarshalErr(v70v4, bs70, h, t, "dec-map-v70-p-len")
- testDeepEqualErr(v70v3, v70v4, t, "equal-map-v70-p-len")
- }
-
- for _, v := range []map[float64]bool{nil, {}, {22.2: false, 11.1: true}} {
- // fmt.Printf(">>>> running mammoth map v71: %v\n", v)
- var v71v1, v71v2 map[float64]bool
- v71v1 = v
- bs71 := testMarshalErr(v71v1, h, t, "enc-map-v71")
- if v == nil {
- v71v2 = nil
- } else {
- v71v2 = make(map[float64]bool, len(v))
- } // reset map
- testUnmarshalErr(v71v2, bs71, h, t, "dec-map-v71")
- testDeepEqualErr(v71v1, v71v2, t, "equal-map-v71")
- if v == nil {
- v71v2 = nil
- } else {
- v71v2 = make(map[float64]bool, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v71v2), bs71, h, t, "dec-map-v71-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v71v1, v71v2, t, "equal-map-v71-noaddr")
- if v == nil {
- v71v2 = nil
- } else {
- v71v2 = make(map[float64]bool, len(v))
- } // reset map
- testUnmarshalErr(&v71v2, bs71, h, t, "dec-map-v71-p-len")
- testDeepEqualErr(v71v1, v71v2, t, "equal-map-v71-p-len")
- bs71 = testMarshalErr(&v71v1, h, t, "enc-map-v71-p")
- v71v2 = nil
- testUnmarshalErr(&v71v2, bs71, h, t, "dec-map-v71-p-nil")
- testDeepEqualErr(v71v1, v71v2, t, "equal-map-v71-p-nil")
- // ...
- if v == nil {
- v71v2 = nil
- } else {
- v71v2 = make(map[float64]bool, len(v))
- } // reset map
- var v71v3, v71v4 typMapMapFloat64Bool
- v71v3 = typMapMapFloat64Bool(v71v1)
- v71v4 = typMapMapFloat64Bool(v71v2)
- bs71 = testMarshalErr(v71v3, h, t, "enc-map-v71-custom")
- testUnmarshalErr(v71v4, bs71, h, t, "dec-map-v71-p-len")
- testDeepEqualErr(v71v3, v71v4, t, "equal-map-v71-p-len")
- }
-
- for _, v := range []map[uint]interface{}{nil, {}, {44: nil, 33: "string-is-an-interface-2"}} {
- // fmt.Printf(">>>> running mammoth map v74: %v\n", v)
- var v74v1, v74v2 map[uint]interface{}
- v74v1 = v
- bs74 := testMarshalErr(v74v1, h, t, "enc-map-v74")
- if v == nil {
- v74v2 = nil
- } else {
- v74v2 = make(map[uint]interface{}, len(v))
- } // reset map
- testUnmarshalErr(v74v2, bs74, h, t, "dec-map-v74")
- testDeepEqualErr(v74v1, v74v2, t, "equal-map-v74")
- if v == nil {
- v74v2 = nil
- } else {
- v74v2 = make(map[uint]interface{}, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v74v2), bs74, h, t, "dec-map-v74-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v74v1, v74v2, t, "equal-map-v74-noaddr")
- if v == nil {
- v74v2 = nil
- } else {
- v74v2 = make(map[uint]interface{}, len(v))
- } // reset map
- testUnmarshalErr(&v74v2, bs74, h, t, "dec-map-v74-p-len")
- testDeepEqualErr(v74v1, v74v2, t, "equal-map-v74-p-len")
- bs74 = testMarshalErr(&v74v1, h, t, "enc-map-v74-p")
- v74v2 = nil
- testUnmarshalErr(&v74v2, bs74, h, t, "dec-map-v74-p-nil")
- testDeepEqualErr(v74v1, v74v2, t, "equal-map-v74-p-nil")
- // ...
- if v == nil {
- v74v2 = nil
- } else {
- v74v2 = make(map[uint]interface{}, len(v))
- } // reset map
- var v74v3, v74v4 typMapMapUintIntf
- v74v3 = typMapMapUintIntf(v74v1)
- v74v4 = typMapMapUintIntf(v74v2)
- bs74 = testMarshalErr(v74v3, h, t, "enc-map-v74-custom")
- testUnmarshalErr(v74v4, bs74, h, t, "dec-map-v74-p-len")
- testDeepEqualErr(v74v3, v74v4, t, "equal-map-v74-p-len")
- }
-
- for _, v := range []map[uint]string{nil, {}, {44: "", 33: "some-string-2"}} {
- // fmt.Printf(">>>> running mammoth map v75: %v\n", v)
- var v75v1, v75v2 map[uint]string
- v75v1 = v
- bs75 := testMarshalErr(v75v1, h, t, "enc-map-v75")
- if v == nil {
- v75v2 = nil
- } else {
- v75v2 = make(map[uint]string, len(v))
- } // reset map
- testUnmarshalErr(v75v2, bs75, h, t, "dec-map-v75")
- testDeepEqualErr(v75v1, v75v2, t, "equal-map-v75")
- if v == nil {
- v75v2 = nil
- } else {
- v75v2 = make(map[uint]string, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v75v2), bs75, h, t, "dec-map-v75-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v75v1, v75v2, t, "equal-map-v75-noaddr")
- if v == nil {
- v75v2 = nil
- } else {
- v75v2 = make(map[uint]string, len(v))
- } // reset map
- testUnmarshalErr(&v75v2, bs75, h, t, "dec-map-v75-p-len")
- testDeepEqualErr(v75v1, v75v2, t, "equal-map-v75-p-len")
- bs75 = testMarshalErr(&v75v1, h, t, "enc-map-v75-p")
- v75v2 = nil
- testUnmarshalErr(&v75v2, bs75, h, t, "dec-map-v75-p-nil")
- testDeepEqualErr(v75v1, v75v2, t, "equal-map-v75-p-nil")
- // ...
- if v == nil {
- v75v2 = nil
- } else {
- v75v2 = make(map[uint]string, len(v))
- } // reset map
- var v75v3, v75v4 typMapMapUintString
- v75v3 = typMapMapUintString(v75v1)
- v75v4 = typMapMapUintString(v75v2)
- bs75 = testMarshalErr(v75v3, h, t, "enc-map-v75-custom")
- testUnmarshalErr(v75v4, bs75, h, t, "dec-map-v75-p-len")
- testDeepEqualErr(v75v3, v75v4, t, "equal-map-v75-p-len")
- }
-
- for _, v := range []map[uint]uint{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v76: %v\n", v)
- var v76v1, v76v2 map[uint]uint
- v76v1 = v
- bs76 := testMarshalErr(v76v1, h, t, "enc-map-v76")
- if v == nil {
- v76v2 = nil
- } else {
- v76v2 = make(map[uint]uint, len(v))
- } // reset map
- testUnmarshalErr(v76v2, bs76, h, t, "dec-map-v76")
- testDeepEqualErr(v76v1, v76v2, t, "equal-map-v76")
- if v == nil {
- v76v2 = nil
- } else {
- v76v2 = make(map[uint]uint, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v76v2), bs76, h, t, "dec-map-v76-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v76v1, v76v2, t, "equal-map-v76-noaddr")
- if v == nil {
- v76v2 = nil
- } else {
- v76v2 = make(map[uint]uint, len(v))
- } // reset map
- testUnmarshalErr(&v76v2, bs76, h, t, "dec-map-v76-p-len")
- testDeepEqualErr(v76v1, v76v2, t, "equal-map-v76-p-len")
- bs76 = testMarshalErr(&v76v1, h, t, "enc-map-v76-p")
- v76v2 = nil
- testUnmarshalErr(&v76v2, bs76, h, t, "dec-map-v76-p-nil")
- testDeepEqualErr(v76v1, v76v2, t, "equal-map-v76-p-nil")
- // ...
- if v == nil {
- v76v2 = nil
- } else {
- v76v2 = make(map[uint]uint, len(v))
- } // reset map
- var v76v3, v76v4 typMapMapUintUint
- v76v3 = typMapMapUintUint(v76v1)
- v76v4 = typMapMapUintUint(v76v2)
- bs76 = testMarshalErr(v76v3, h, t, "enc-map-v76-custom")
- testUnmarshalErr(v76v4, bs76, h, t, "dec-map-v76-p-len")
- testDeepEqualErr(v76v3, v76v4, t, "equal-map-v76-p-len")
- }
-
- for _, v := range []map[uint]uint8{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v77: %v\n", v)
- var v77v1, v77v2 map[uint]uint8
- v77v1 = v
- bs77 := testMarshalErr(v77v1, h, t, "enc-map-v77")
- if v == nil {
- v77v2 = nil
- } else {
- v77v2 = make(map[uint]uint8, len(v))
- } // reset map
- testUnmarshalErr(v77v2, bs77, h, t, "dec-map-v77")
- testDeepEqualErr(v77v1, v77v2, t, "equal-map-v77")
- if v == nil {
- v77v2 = nil
- } else {
- v77v2 = make(map[uint]uint8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v77v2), bs77, h, t, "dec-map-v77-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v77v1, v77v2, t, "equal-map-v77-noaddr")
- if v == nil {
- v77v2 = nil
- } else {
- v77v2 = make(map[uint]uint8, len(v))
- } // reset map
- testUnmarshalErr(&v77v2, bs77, h, t, "dec-map-v77-p-len")
- testDeepEqualErr(v77v1, v77v2, t, "equal-map-v77-p-len")
- bs77 = testMarshalErr(&v77v1, h, t, "enc-map-v77-p")
- v77v2 = nil
- testUnmarshalErr(&v77v2, bs77, h, t, "dec-map-v77-p-nil")
- testDeepEqualErr(v77v1, v77v2, t, "equal-map-v77-p-nil")
- // ...
- if v == nil {
- v77v2 = nil
- } else {
- v77v2 = make(map[uint]uint8, len(v))
- } // reset map
- var v77v3, v77v4 typMapMapUintUint8
- v77v3 = typMapMapUintUint8(v77v1)
- v77v4 = typMapMapUintUint8(v77v2)
- bs77 = testMarshalErr(v77v3, h, t, "enc-map-v77-custom")
- testUnmarshalErr(v77v4, bs77, h, t, "dec-map-v77-p-len")
- testDeepEqualErr(v77v3, v77v4, t, "equal-map-v77-p-len")
- }
-
- for _, v := range []map[uint]uint16{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v78: %v\n", v)
- var v78v1, v78v2 map[uint]uint16
- v78v1 = v
- bs78 := testMarshalErr(v78v1, h, t, "enc-map-v78")
- if v == nil {
- v78v2 = nil
- } else {
- v78v2 = make(map[uint]uint16, len(v))
- } // reset map
- testUnmarshalErr(v78v2, bs78, h, t, "dec-map-v78")
- testDeepEqualErr(v78v1, v78v2, t, "equal-map-v78")
- if v == nil {
- v78v2 = nil
- } else {
- v78v2 = make(map[uint]uint16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v78v2), bs78, h, t, "dec-map-v78-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v78v1, v78v2, t, "equal-map-v78-noaddr")
- if v == nil {
- v78v2 = nil
- } else {
- v78v2 = make(map[uint]uint16, len(v))
- } // reset map
- testUnmarshalErr(&v78v2, bs78, h, t, "dec-map-v78-p-len")
- testDeepEqualErr(v78v1, v78v2, t, "equal-map-v78-p-len")
- bs78 = testMarshalErr(&v78v1, h, t, "enc-map-v78-p")
- v78v2 = nil
- testUnmarshalErr(&v78v2, bs78, h, t, "dec-map-v78-p-nil")
- testDeepEqualErr(v78v1, v78v2, t, "equal-map-v78-p-nil")
- // ...
- if v == nil {
- v78v2 = nil
- } else {
- v78v2 = make(map[uint]uint16, len(v))
- } // reset map
- var v78v3, v78v4 typMapMapUintUint16
- v78v3 = typMapMapUintUint16(v78v1)
- v78v4 = typMapMapUintUint16(v78v2)
- bs78 = testMarshalErr(v78v3, h, t, "enc-map-v78-custom")
- testUnmarshalErr(v78v4, bs78, h, t, "dec-map-v78-p-len")
- testDeepEqualErr(v78v3, v78v4, t, "equal-map-v78-p-len")
- }
-
- for _, v := range []map[uint]uint32{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v79: %v\n", v)
- var v79v1, v79v2 map[uint]uint32
- v79v1 = v
- bs79 := testMarshalErr(v79v1, h, t, "enc-map-v79")
- if v == nil {
- v79v2 = nil
- } else {
- v79v2 = make(map[uint]uint32, len(v))
- } // reset map
- testUnmarshalErr(v79v2, bs79, h, t, "dec-map-v79")
- testDeepEqualErr(v79v1, v79v2, t, "equal-map-v79")
- if v == nil {
- v79v2 = nil
- } else {
- v79v2 = make(map[uint]uint32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v79v2), bs79, h, t, "dec-map-v79-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v79v1, v79v2, t, "equal-map-v79-noaddr")
- if v == nil {
- v79v2 = nil
- } else {
- v79v2 = make(map[uint]uint32, len(v))
- } // reset map
- testUnmarshalErr(&v79v2, bs79, h, t, "dec-map-v79-p-len")
- testDeepEqualErr(v79v1, v79v2, t, "equal-map-v79-p-len")
- bs79 = testMarshalErr(&v79v1, h, t, "enc-map-v79-p")
- v79v2 = nil
- testUnmarshalErr(&v79v2, bs79, h, t, "dec-map-v79-p-nil")
- testDeepEqualErr(v79v1, v79v2, t, "equal-map-v79-p-nil")
- // ...
- if v == nil {
- v79v2 = nil
- } else {
- v79v2 = make(map[uint]uint32, len(v))
- } // reset map
- var v79v3, v79v4 typMapMapUintUint32
- v79v3 = typMapMapUintUint32(v79v1)
- v79v4 = typMapMapUintUint32(v79v2)
- bs79 = testMarshalErr(v79v3, h, t, "enc-map-v79-custom")
- testUnmarshalErr(v79v4, bs79, h, t, "dec-map-v79-p-len")
- testDeepEqualErr(v79v3, v79v4, t, "equal-map-v79-p-len")
- }
-
- for _, v := range []map[uint]uint64{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v80: %v\n", v)
- var v80v1, v80v2 map[uint]uint64
- v80v1 = v
- bs80 := testMarshalErr(v80v1, h, t, "enc-map-v80")
- if v == nil {
- v80v2 = nil
- } else {
- v80v2 = make(map[uint]uint64, len(v))
- } // reset map
- testUnmarshalErr(v80v2, bs80, h, t, "dec-map-v80")
- testDeepEqualErr(v80v1, v80v2, t, "equal-map-v80")
- if v == nil {
- v80v2 = nil
- } else {
- v80v2 = make(map[uint]uint64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v80v2), bs80, h, t, "dec-map-v80-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v80v1, v80v2, t, "equal-map-v80-noaddr")
- if v == nil {
- v80v2 = nil
- } else {
- v80v2 = make(map[uint]uint64, len(v))
- } // reset map
- testUnmarshalErr(&v80v2, bs80, h, t, "dec-map-v80-p-len")
- testDeepEqualErr(v80v1, v80v2, t, "equal-map-v80-p-len")
- bs80 = testMarshalErr(&v80v1, h, t, "enc-map-v80-p")
- v80v2 = nil
- testUnmarshalErr(&v80v2, bs80, h, t, "dec-map-v80-p-nil")
- testDeepEqualErr(v80v1, v80v2, t, "equal-map-v80-p-nil")
- // ...
- if v == nil {
- v80v2 = nil
- } else {
- v80v2 = make(map[uint]uint64, len(v))
- } // reset map
- var v80v3, v80v4 typMapMapUintUint64
- v80v3 = typMapMapUintUint64(v80v1)
- v80v4 = typMapMapUintUint64(v80v2)
- bs80 = testMarshalErr(v80v3, h, t, "enc-map-v80-custom")
- testUnmarshalErr(v80v4, bs80, h, t, "dec-map-v80-p-len")
- testDeepEqualErr(v80v3, v80v4, t, "equal-map-v80-p-len")
- }
-
- for _, v := range []map[uint]uintptr{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v81: %v\n", v)
- var v81v1, v81v2 map[uint]uintptr
- v81v1 = v
- bs81 := testMarshalErr(v81v1, h, t, "enc-map-v81")
- if v == nil {
- v81v2 = nil
- } else {
- v81v2 = make(map[uint]uintptr, len(v))
- } // reset map
- testUnmarshalErr(v81v2, bs81, h, t, "dec-map-v81")
- testDeepEqualErr(v81v1, v81v2, t, "equal-map-v81")
- if v == nil {
- v81v2 = nil
- } else {
- v81v2 = make(map[uint]uintptr, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v81v2), bs81, h, t, "dec-map-v81-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v81v1, v81v2, t, "equal-map-v81-noaddr")
- if v == nil {
- v81v2 = nil
- } else {
- v81v2 = make(map[uint]uintptr, len(v))
- } // reset map
- testUnmarshalErr(&v81v2, bs81, h, t, "dec-map-v81-p-len")
- testDeepEqualErr(v81v1, v81v2, t, "equal-map-v81-p-len")
- bs81 = testMarshalErr(&v81v1, h, t, "enc-map-v81-p")
- v81v2 = nil
- testUnmarshalErr(&v81v2, bs81, h, t, "dec-map-v81-p-nil")
- testDeepEqualErr(v81v1, v81v2, t, "equal-map-v81-p-nil")
- // ...
- if v == nil {
- v81v2 = nil
- } else {
- v81v2 = make(map[uint]uintptr, len(v))
- } // reset map
- var v81v3, v81v4 typMapMapUintUintptr
- v81v3 = typMapMapUintUintptr(v81v1)
- v81v4 = typMapMapUintUintptr(v81v2)
- bs81 = testMarshalErr(v81v3, h, t, "enc-map-v81-custom")
- testUnmarshalErr(v81v4, bs81, h, t, "dec-map-v81-p-len")
- testDeepEqualErr(v81v3, v81v4, t, "equal-map-v81-p-len")
- }
-
- for _, v := range []map[uint]int{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v82: %v\n", v)
- var v82v1, v82v2 map[uint]int
- v82v1 = v
- bs82 := testMarshalErr(v82v1, h, t, "enc-map-v82")
- if v == nil {
- v82v2 = nil
- } else {
- v82v2 = make(map[uint]int, len(v))
- } // reset map
- testUnmarshalErr(v82v2, bs82, h, t, "dec-map-v82")
- testDeepEqualErr(v82v1, v82v2, t, "equal-map-v82")
- if v == nil {
- v82v2 = nil
- } else {
- v82v2 = make(map[uint]int, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v82v2), bs82, h, t, "dec-map-v82-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v82v1, v82v2, t, "equal-map-v82-noaddr")
- if v == nil {
- v82v2 = nil
- } else {
- v82v2 = make(map[uint]int, len(v))
- } // reset map
- testUnmarshalErr(&v82v2, bs82, h, t, "dec-map-v82-p-len")
- testDeepEqualErr(v82v1, v82v2, t, "equal-map-v82-p-len")
- bs82 = testMarshalErr(&v82v1, h, t, "enc-map-v82-p")
- v82v2 = nil
- testUnmarshalErr(&v82v2, bs82, h, t, "dec-map-v82-p-nil")
- testDeepEqualErr(v82v1, v82v2, t, "equal-map-v82-p-nil")
- // ...
- if v == nil {
- v82v2 = nil
- } else {
- v82v2 = make(map[uint]int, len(v))
- } // reset map
- var v82v3, v82v4 typMapMapUintInt
- v82v3 = typMapMapUintInt(v82v1)
- v82v4 = typMapMapUintInt(v82v2)
- bs82 = testMarshalErr(v82v3, h, t, "enc-map-v82-custom")
- testUnmarshalErr(v82v4, bs82, h, t, "dec-map-v82-p-len")
- testDeepEqualErr(v82v3, v82v4, t, "equal-map-v82-p-len")
- }
-
- for _, v := range []map[uint]int8{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v83: %v\n", v)
- var v83v1, v83v2 map[uint]int8
- v83v1 = v
- bs83 := testMarshalErr(v83v1, h, t, "enc-map-v83")
- if v == nil {
- v83v2 = nil
- } else {
- v83v2 = make(map[uint]int8, len(v))
- } // reset map
- testUnmarshalErr(v83v2, bs83, h, t, "dec-map-v83")
- testDeepEqualErr(v83v1, v83v2, t, "equal-map-v83")
- if v == nil {
- v83v2 = nil
- } else {
- v83v2 = make(map[uint]int8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v83v2), bs83, h, t, "dec-map-v83-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v83v1, v83v2, t, "equal-map-v83-noaddr")
- if v == nil {
- v83v2 = nil
- } else {
- v83v2 = make(map[uint]int8, len(v))
- } // reset map
- testUnmarshalErr(&v83v2, bs83, h, t, "dec-map-v83-p-len")
- testDeepEqualErr(v83v1, v83v2, t, "equal-map-v83-p-len")
- bs83 = testMarshalErr(&v83v1, h, t, "enc-map-v83-p")
- v83v2 = nil
- testUnmarshalErr(&v83v2, bs83, h, t, "dec-map-v83-p-nil")
- testDeepEqualErr(v83v1, v83v2, t, "equal-map-v83-p-nil")
- // ...
- if v == nil {
- v83v2 = nil
- } else {
- v83v2 = make(map[uint]int8, len(v))
- } // reset map
- var v83v3, v83v4 typMapMapUintInt8
- v83v3 = typMapMapUintInt8(v83v1)
- v83v4 = typMapMapUintInt8(v83v2)
- bs83 = testMarshalErr(v83v3, h, t, "enc-map-v83-custom")
- testUnmarshalErr(v83v4, bs83, h, t, "dec-map-v83-p-len")
- testDeepEqualErr(v83v3, v83v4, t, "equal-map-v83-p-len")
- }
-
- for _, v := range []map[uint]int16{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v84: %v\n", v)
- var v84v1, v84v2 map[uint]int16
- v84v1 = v
- bs84 := testMarshalErr(v84v1, h, t, "enc-map-v84")
- if v == nil {
- v84v2 = nil
- } else {
- v84v2 = make(map[uint]int16, len(v))
- } // reset map
- testUnmarshalErr(v84v2, bs84, h, t, "dec-map-v84")
- testDeepEqualErr(v84v1, v84v2, t, "equal-map-v84")
- if v == nil {
- v84v2 = nil
- } else {
- v84v2 = make(map[uint]int16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v84v2), bs84, h, t, "dec-map-v84-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v84v1, v84v2, t, "equal-map-v84-noaddr")
- if v == nil {
- v84v2 = nil
- } else {
- v84v2 = make(map[uint]int16, len(v))
- } // reset map
- testUnmarshalErr(&v84v2, bs84, h, t, "dec-map-v84-p-len")
- testDeepEqualErr(v84v1, v84v2, t, "equal-map-v84-p-len")
- bs84 = testMarshalErr(&v84v1, h, t, "enc-map-v84-p")
- v84v2 = nil
- testUnmarshalErr(&v84v2, bs84, h, t, "dec-map-v84-p-nil")
- testDeepEqualErr(v84v1, v84v2, t, "equal-map-v84-p-nil")
- // ...
- if v == nil {
- v84v2 = nil
- } else {
- v84v2 = make(map[uint]int16, len(v))
- } // reset map
- var v84v3, v84v4 typMapMapUintInt16
- v84v3 = typMapMapUintInt16(v84v1)
- v84v4 = typMapMapUintInt16(v84v2)
- bs84 = testMarshalErr(v84v3, h, t, "enc-map-v84-custom")
- testUnmarshalErr(v84v4, bs84, h, t, "dec-map-v84-p-len")
- testDeepEqualErr(v84v3, v84v4, t, "equal-map-v84-p-len")
- }
-
- for _, v := range []map[uint]int32{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v85: %v\n", v)
- var v85v1, v85v2 map[uint]int32
- v85v1 = v
- bs85 := testMarshalErr(v85v1, h, t, "enc-map-v85")
- if v == nil {
- v85v2 = nil
- } else {
- v85v2 = make(map[uint]int32, len(v))
- } // reset map
- testUnmarshalErr(v85v2, bs85, h, t, "dec-map-v85")
- testDeepEqualErr(v85v1, v85v2, t, "equal-map-v85")
- if v == nil {
- v85v2 = nil
- } else {
- v85v2 = make(map[uint]int32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v85v2), bs85, h, t, "dec-map-v85-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v85v1, v85v2, t, "equal-map-v85-noaddr")
- if v == nil {
- v85v2 = nil
- } else {
- v85v2 = make(map[uint]int32, len(v))
- } // reset map
- testUnmarshalErr(&v85v2, bs85, h, t, "dec-map-v85-p-len")
- testDeepEqualErr(v85v1, v85v2, t, "equal-map-v85-p-len")
- bs85 = testMarshalErr(&v85v1, h, t, "enc-map-v85-p")
- v85v2 = nil
- testUnmarshalErr(&v85v2, bs85, h, t, "dec-map-v85-p-nil")
- testDeepEqualErr(v85v1, v85v2, t, "equal-map-v85-p-nil")
- // ...
- if v == nil {
- v85v2 = nil
- } else {
- v85v2 = make(map[uint]int32, len(v))
- } // reset map
- var v85v3, v85v4 typMapMapUintInt32
- v85v3 = typMapMapUintInt32(v85v1)
- v85v4 = typMapMapUintInt32(v85v2)
- bs85 = testMarshalErr(v85v3, h, t, "enc-map-v85-custom")
- testUnmarshalErr(v85v4, bs85, h, t, "dec-map-v85-p-len")
- testDeepEqualErr(v85v3, v85v4, t, "equal-map-v85-p-len")
- }
-
- for _, v := range []map[uint]int64{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v86: %v\n", v)
- var v86v1, v86v2 map[uint]int64
- v86v1 = v
- bs86 := testMarshalErr(v86v1, h, t, "enc-map-v86")
- if v == nil {
- v86v2 = nil
- } else {
- v86v2 = make(map[uint]int64, len(v))
- } // reset map
- testUnmarshalErr(v86v2, bs86, h, t, "dec-map-v86")
- testDeepEqualErr(v86v1, v86v2, t, "equal-map-v86")
- if v == nil {
- v86v2 = nil
- } else {
- v86v2 = make(map[uint]int64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v86v2), bs86, h, t, "dec-map-v86-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v86v1, v86v2, t, "equal-map-v86-noaddr")
- if v == nil {
- v86v2 = nil
- } else {
- v86v2 = make(map[uint]int64, len(v))
- } // reset map
- testUnmarshalErr(&v86v2, bs86, h, t, "dec-map-v86-p-len")
- testDeepEqualErr(v86v1, v86v2, t, "equal-map-v86-p-len")
- bs86 = testMarshalErr(&v86v1, h, t, "enc-map-v86-p")
- v86v2 = nil
- testUnmarshalErr(&v86v2, bs86, h, t, "dec-map-v86-p-nil")
- testDeepEqualErr(v86v1, v86v2, t, "equal-map-v86-p-nil")
- // ...
- if v == nil {
- v86v2 = nil
- } else {
- v86v2 = make(map[uint]int64, len(v))
- } // reset map
- var v86v3, v86v4 typMapMapUintInt64
- v86v3 = typMapMapUintInt64(v86v1)
- v86v4 = typMapMapUintInt64(v86v2)
- bs86 = testMarshalErr(v86v3, h, t, "enc-map-v86-custom")
- testUnmarshalErr(v86v4, bs86, h, t, "dec-map-v86-p-len")
- testDeepEqualErr(v86v3, v86v4, t, "equal-map-v86-p-len")
- }
-
- for _, v := range []map[uint]float32{nil, {}, {33: 0, 44: 22.2}} {
- // fmt.Printf(">>>> running mammoth map v87: %v\n", v)
- var v87v1, v87v2 map[uint]float32
- v87v1 = v
- bs87 := testMarshalErr(v87v1, h, t, "enc-map-v87")
- if v == nil {
- v87v2 = nil
- } else {
- v87v2 = make(map[uint]float32, len(v))
- } // reset map
- testUnmarshalErr(v87v2, bs87, h, t, "dec-map-v87")
- testDeepEqualErr(v87v1, v87v2, t, "equal-map-v87")
- if v == nil {
- v87v2 = nil
- } else {
- v87v2 = make(map[uint]float32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v87v2), bs87, h, t, "dec-map-v87-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v87v1, v87v2, t, "equal-map-v87-noaddr")
- if v == nil {
- v87v2 = nil
- } else {
- v87v2 = make(map[uint]float32, len(v))
- } // reset map
- testUnmarshalErr(&v87v2, bs87, h, t, "dec-map-v87-p-len")
- testDeepEqualErr(v87v1, v87v2, t, "equal-map-v87-p-len")
- bs87 = testMarshalErr(&v87v1, h, t, "enc-map-v87-p")
- v87v2 = nil
- testUnmarshalErr(&v87v2, bs87, h, t, "dec-map-v87-p-nil")
- testDeepEqualErr(v87v1, v87v2, t, "equal-map-v87-p-nil")
- // ...
- if v == nil {
- v87v2 = nil
- } else {
- v87v2 = make(map[uint]float32, len(v))
- } // reset map
- var v87v3, v87v4 typMapMapUintFloat32
- v87v3 = typMapMapUintFloat32(v87v1)
- v87v4 = typMapMapUintFloat32(v87v2)
- bs87 = testMarshalErr(v87v3, h, t, "enc-map-v87-custom")
- testUnmarshalErr(v87v4, bs87, h, t, "dec-map-v87-p-len")
- testDeepEqualErr(v87v3, v87v4, t, "equal-map-v87-p-len")
- }
-
- for _, v := range []map[uint]float64{nil, {}, {33: 0, 44: 11.1}} {
- // fmt.Printf(">>>> running mammoth map v88: %v\n", v)
- var v88v1, v88v2 map[uint]float64
- v88v1 = v
- bs88 := testMarshalErr(v88v1, h, t, "enc-map-v88")
- if v == nil {
- v88v2 = nil
- } else {
- v88v2 = make(map[uint]float64, len(v))
- } // reset map
- testUnmarshalErr(v88v2, bs88, h, t, "dec-map-v88")
- testDeepEqualErr(v88v1, v88v2, t, "equal-map-v88")
- if v == nil {
- v88v2 = nil
- } else {
- v88v2 = make(map[uint]float64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v88v2), bs88, h, t, "dec-map-v88-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v88v1, v88v2, t, "equal-map-v88-noaddr")
- if v == nil {
- v88v2 = nil
- } else {
- v88v2 = make(map[uint]float64, len(v))
- } // reset map
- testUnmarshalErr(&v88v2, bs88, h, t, "dec-map-v88-p-len")
- testDeepEqualErr(v88v1, v88v2, t, "equal-map-v88-p-len")
- bs88 = testMarshalErr(&v88v1, h, t, "enc-map-v88-p")
- v88v2 = nil
- testUnmarshalErr(&v88v2, bs88, h, t, "dec-map-v88-p-nil")
- testDeepEqualErr(v88v1, v88v2, t, "equal-map-v88-p-nil")
- // ...
- if v == nil {
- v88v2 = nil
- } else {
- v88v2 = make(map[uint]float64, len(v))
- } // reset map
- var v88v3, v88v4 typMapMapUintFloat64
- v88v3 = typMapMapUintFloat64(v88v1)
- v88v4 = typMapMapUintFloat64(v88v2)
- bs88 = testMarshalErr(v88v3, h, t, "enc-map-v88-custom")
- testUnmarshalErr(v88v4, bs88, h, t, "dec-map-v88-p-len")
- testDeepEqualErr(v88v3, v88v4, t, "equal-map-v88-p-len")
- }
-
- for _, v := range []map[uint]bool{nil, {}, {33: false, 44: true}} {
- // fmt.Printf(">>>> running mammoth map v89: %v\n", v)
- var v89v1, v89v2 map[uint]bool
- v89v1 = v
- bs89 := testMarshalErr(v89v1, h, t, "enc-map-v89")
- if v == nil {
- v89v2 = nil
- } else {
- v89v2 = make(map[uint]bool, len(v))
- } // reset map
- testUnmarshalErr(v89v2, bs89, h, t, "dec-map-v89")
- testDeepEqualErr(v89v1, v89v2, t, "equal-map-v89")
- if v == nil {
- v89v2 = nil
- } else {
- v89v2 = make(map[uint]bool, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v89v2), bs89, h, t, "dec-map-v89-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v89v1, v89v2, t, "equal-map-v89-noaddr")
- if v == nil {
- v89v2 = nil
- } else {
- v89v2 = make(map[uint]bool, len(v))
- } // reset map
- testUnmarshalErr(&v89v2, bs89, h, t, "dec-map-v89-p-len")
- testDeepEqualErr(v89v1, v89v2, t, "equal-map-v89-p-len")
- bs89 = testMarshalErr(&v89v1, h, t, "enc-map-v89-p")
- v89v2 = nil
- testUnmarshalErr(&v89v2, bs89, h, t, "dec-map-v89-p-nil")
- testDeepEqualErr(v89v1, v89v2, t, "equal-map-v89-p-nil")
- // ...
- if v == nil {
- v89v2 = nil
- } else {
- v89v2 = make(map[uint]bool, len(v))
- } // reset map
- var v89v3, v89v4 typMapMapUintBool
- v89v3 = typMapMapUintBool(v89v1)
- v89v4 = typMapMapUintBool(v89v2)
- bs89 = testMarshalErr(v89v3, h, t, "enc-map-v89-custom")
- testUnmarshalErr(v89v4, bs89, h, t, "dec-map-v89-p-len")
- testDeepEqualErr(v89v3, v89v4, t, "equal-map-v89-p-len")
- }
-
- for _, v := range []map[uint8]interface{}{nil, {}, {33: nil, 44: "string-is-an-interface"}} {
- // fmt.Printf(">>>> running mammoth map v92: %v\n", v)
- var v92v1, v92v2 map[uint8]interface{}
- v92v1 = v
- bs92 := testMarshalErr(v92v1, h, t, "enc-map-v92")
- if v == nil {
- v92v2 = nil
- } else {
- v92v2 = make(map[uint8]interface{}, len(v))
- } // reset map
- testUnmarshalErr(v92v2, bs92, h, t, "dec-map-v92")
- testDeepEqualErr(v92v1, v92v2, t, "equal-map-v92")
- if v == nil {
- v92v2 = nil
- } else {
- v92v2 = make(map[uint8]interface{}, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v92v2), bs92, h, t, "dec-map-v92-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v92v1, v92v2, t, "equal-map-v92-noaddr")
- if v == nil {
- v92v2 = nil
- } else {
- v92v2 = make(map[uint8]interface{}, len(v))
- } // reset map
- testUnmarshalErr(&v92v2, bs92, h, t, "dec-map-v92-p-len")
- testDeepEqualErr(v92v1, v92v2, t, "equal-map-v92-p-len")
- bs92 = testMarshalErr(&v92v1, h, t, "enc-map-v92-p")
- v92v2 = nil
- testUnmarshalErr(&v92v2, bs92, h, t, "dec-map-v92-p-nil")
- testDeepEqualErr(v92v1, v92v2, t, "equal-map-v92-p-nil")
- // ...
- if v == nil {
- v92v2 = nil
- } else {
- v92v2 = make(map[uint8]interface{}, len(v))
- } // reset map
- var v92v3, v92v4 typMapMapUint8Intf
- v92v3 = typMapMapUint8Intf(v92v1)
- v92v4 = typMapMapUint8Intf(v92v2)
- bs92 = testMarshalErr(v92v3, h, t, "enc-map-v92-custom")
- testUnmarshalErr(v92v4, bs92, h, t, "dec-map-v92-p-len")
- testDeepEqualErr(v92v3, v92v4, t, "equal-map-v92-p-len")
- }
-
- for _, v := range []map[uint8]string{nil, {}, {33: "", 44: "some-string"}} {
- // fmt.Printf(">>>> running mammoth map v93: %v\n", v)
- var v93v1, v93v2 map[uint8]string
- v93v1 = v
- bs93 := testMarshalErr(v93v1, h, t, "enc-map-v93")
- if v == nil {
- v93v2 = nil
- } else {
- v93v2 = make(map[uint8]string, len(v))
- } // reset map
- testUnmarshalErr(v93v2, bs93, h, t, "dec-map-v93")
- testDeepEqualErr(v93v1, v93v2, t, "equal-map-v93")
- if v == nil {
- v93v2 = nil
- } else {
- v93v2 = make(map[uint8]string, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v93v2), bs93, h, t, "dec-map-v93-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v93v1, v93v2, t, "equal-map-v93-noaddr")
- if v == nil {
- v93v2 = nil
- } else {
- v93v2 = make(map[uint8]string, len(v))
- } // reset map
- testUnmarshalErr(&v93v2, bs93, h, t, "dec-map-v93-p-len")
- testDeepEqualErr(v93v1, v93v2, t, "equal-map-v93-p-len")
- bs93 = testMarshalErr(&v93v1, h, t, "enc-map-v93-p")
- v93v2 = nil
- testUnmarshalErr(&v93v2, bs93, h, t, "dec-map-v93-p-nil")
- testDeepEqualErr(v93v1, v93v2, t, "equal-map-v93-p-nil")
- // ...
- if v == nil {
- v93v2 = nil
- } else {
- v93v2 = make(map[uint8]string, len(v))
- } // reset map
- var v93v3, v93v4 typMapMapUint8String
- v93v3 = typMapMapUint8String(v93v1)
- v93v4 = typMapMapUint8String(v93v2)
- bs93 = testMarshalErr(v93v3, h, t, "enc-map-v93-custom")
- testUnmarshalErr(v93v4, bs93, h, t, "dec-map-v93-p-len")
- testDeepEqualErr(v93v3, v93v4, t, "equal-map-v93-p-len")
- }
-
- for _, v := range []map[uint8]uint{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v94: %v\n", v)
- var v94v1, v94v2 map[uint8]uint
- v94v1 = v
- bs94 := testMarshalErr(v94v1, h, t, "enc-map-v94")
- if v == nil {
- v94v2 = nil
- } else {
- v94v2 = make(map[uint8]uint, len(v))
- } // reset map
- testUnmarshalErr(v94v2, bs94, h, t, "dec-map-v94")
- testDeepEqualErr(v94v1, v94v2, t, "equal-map-v94")
- if v == nil {
- v94v2 = nil
- } else {
- v94v2 = make(map[uint8]uint, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v94v2), bs94, h, t, "dec-map-v94-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v94v1, v94v2, t, "equal-map-v94-noaddr")
- if v == nil {
- v94v2 = nil
- } else {
- v94v2 = make(map[uint8]uint, len(v))
- } // reset map
- testUnmarshalErr(&v94v2, bs94, h, t, "dec-map-v94-p-len")
- testDeepEqualErr(v94v1, v94v2, t, "equal-map-v94-p-len")
- bs94 = testMarshalErr(&v94v1, h, t, "enc-map-v94-p")
- v94v2 = nil
- testUnmarshalErr(&v94v2, bs94, h, t, "dec-map-v94-p-nil")
- testDeepEqualErr(v94v1, v94v2, t, "equal-map-v94-p-nil")
- // ...
- if v == nil {
- v94v2 = nil
- } else {
- v94v2 = make(map[uint8]uint, len(v))
- } // reset map
- var v94v3, v94v4 typMapMapUint8Uint
- v94v3 = typMapMapUint8Uint(v94v1)
- v94v4 = typMapMapUint8Uint(v94v2)
- bs94 = testMarshalErr(v94v3, h, t, "enc-map-v94-custom")
- testUnmarshalErr(v94v4, bs94, h, t, "dec-map-v94-p-len")
- testDeepEqualErr(v94v3, v94v4, t, "equal-map-v94-p-len")
- }
-
- for _, v := range []map[uint8]uint8{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v95: %v\n", v)
- var v95v1, v95v2 map[uint8]uint8
- v95v1 = v
- bs95 := testMarshalErr(v95v1, h, t, "enc-map-v95")
- if v == nil {
- v95v2 = nil
- } else {
- v95v2 = make(map[uint8]uint8, len(v))
- } // reset map
- testUnmarshalErr(v95v2, bs95, h, t, "dec-map-v95")
- testDeepEqualErr(v95v1, v95v2, t, "equal-map-v95")
- if v == nil {
- v95v2 = nil
- } else {
- v95v2 = make(map[uint8]uint8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v95v2), bs95, h, t, "dec-map-v95-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v95v1, v95v2, t, "equal-map-v95-noaddr")
- if v == nil {
- v95v2 = nil
- } else {
- v95v2 = make(map[uint8]uint8, len(v))
- } // reset map
- testUnmarshalErr(&v95v2, bs95, h, t, "dec-map-v95-p-len")
- testDeepEqualErr(v95v1, v95v2, t, "equal-map-v95-p-len")
- bs95 = testMarshalErr(&v95v1, h, t, "enc-map-v95-p")
- v95v2 = nil
- testUnmarshalErr(&v95v2, bs95, h, t, "dec-map-v95-p-nil")
- testDeepEqualErr(v95v1, v95v2, t, "equal-map-v95-p-nil")
- // ...
- if v == nil {
- v95v2 = nil
- } else {
- v95v2 = make(map[uint8]uint8, len(v))
- } // reset map
- var v95v3, v95v4 typMapMapUint8Uint8
- v95v3 = typMapMapUint8Uint8(v95v1)
- v95v4 = typMapMapUint8Uint8(v95v2)
- bs95 = testMarshalErr(v95v3, h, t, "enc-map-v95-custom")
- testUnmarshalErr(v95v4, bs95, h, t, "dec-map-v95-p-len")
- testDeepEqualErr(v95v3, v95v4, t, "equal-map-v95-p-len")
- }
-
- for _, v := range []map[uint8]uint16{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v96: %v\n", v)
- var v96v1, v96v2 map[uint8]uint16
- v96v1 = v
- bs96 := testMarshalErr(v96v1, h, t, "enc-map-v96")
- if v == nil {
- v96v2 = nil
- } else {
- v96v2 = make(map[uint8]uint16, len(v))
- } // reset map
- testUnmarshalErr(v96v2, bs96, h, t, "dec-map-v96")
- testDeepEqualErr(v96v1, v96v2, t, "equal-map-v96")
- if v == nil {
- v96v2 = nil
- } else {
- v96v2 = make(map[uint8]uint16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v96v2), bs96, h, t, "dec-map-v96-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v96v1, v96v2, t, "equal-map-v96-noaddr")
- if v == nil {
- v96v2 = nil
- } else {
- v96v2 = make(map[uint8]uint16, len(v))
- } // reset map
- testUnmarshalErr(&v96v2, bs96, h, t, "dec-map-v96-p-len")
- testDeepEqualErr(v96v1, v96v2, t, "equal-map-v96-p-len")
- bs96 = testMarshalErr(&v96v1, h, t, "enc-map-v96-p")
- v96v2 = nil
- testUnmarshalErr(&v96v2, bs96, h, t, "dec-map-v96-p-nil")
- testDeepEqualErr(v96v1, v96v2, t, "equal-map-v96-p-nil")
- // ...
- if v == nil {
- v96v2 = nil
- } else {
- v96v2 = make(map[uint8]uint16, len(v))
- } // reset map
- var v96v3, v96v4 typMapMapUint8Uint16
- v96v3 = typMapMapUint8Uint16(v96v1)
- v96v4 = typMapMapUint8Uint16(v96v2)
- bs96 = testMarshalErr(v96v3, h, t, "enc-map-v96-custom")
- testUnmarshalErr(v96v4, bs96, h, t, "dec-map-v96-p-len")
- testDeepEqualErr(v96v3, v96v4, t, "equal-map-v96-p-len")
- }
-
- for _, v := range []map[uint8]uint32{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v97: %v\n", v)
- var v97v1, v97v2 map[uint8]uint32
- v97v1 = v
- bs97 := testMarshalErr(v97v1, h, t, "enc-map-v97")
- if v == nil {
- v97v2 = nil
- } else {
- v97v2 = make(map[uint8]uint32, len(v))
- } // reset map
- testUnmarshalErr(v97v2, bs97, h, t, "dec-map-v97")
- testDeepEqualErr(v97v1, v97v2, t, "equal-map-v97")
- if v == nil {
- v97v2 = nil
- } else {
- v97v2 = make(map[uint8]uint32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v97v2), bs97, h, t, "dec-map-v97-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v97v1, v97v2, t, "equal-map-v97-noaddr")
- if v == nil {
- v97v2 = nil
- } else {
- v97v2 = make(map[uint8]uint32, len(v))
- } // reset map
- testUnmarshalErr(&v97v2, bs97, h, t, "dec-map-v97-p-len")
- testDeepEqualErr(v97v1, v97v2, t, "equal-map-v97-p-len")
- bs97 = testMarshalErr(&v97v1, h, t, "enc-map-v97-p")
- v97v2 = nil
- testUnmarshalErr(&v97v2, bs97, h, t, "dec-map-v97-p-nil")
- testDeepEqualErr(v97v1, v97v2, t, "equal-map-v97-p-nil")
- // ...
- if v == nil {
- v97v2 = nil
- } else {
- v97v2 = make(map[uint8]uint32, len(v))
- } // reset map
- var v97v3, v97v4 typMapMapUint8Uint32
- v97v3 = typMapMapUint8Uint32(v97v1)
- v97v4 = typMapMapUint8Uint32(v97v2)
- bs97 = testMarshalErr(v97v3, h, t, "enc-map-v97-custom")
- testUnmarshalErr(v97v4, bs97, h, t, "dec-map-v97-p-len")
- testDeepEqualErr(v97v3, v97v4, t, "equal-map-v97-p-len")
- }
-
- for _, v := range []map[uint8]uint64{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v98: %v\n", v)
- var v98v1, v98v2 map[uint8]uint64
- v98v1 = v
- bs98 := testMarshalErr(v98v1, h, t, "enc-map-v98")
- if v == nil {
- v98v2 = nil
- } else {
- v98v2 = make(map[uint8]uint64, len(v))
- } // reset map
- testUnmarshalErr(v98v2, bs98, h, t, "dec-map-v98")
- testDeepEqualErr(v98v1, v98v2, t, "equal-map-v98")
- if v == nil {
- v98v2 = nil
- } else {
- v98v2 = make(map[uint8]uint64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v98v2), bs98, h, t, "dec-map-v98-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v98v1, v98v2, t, "equal-map-v98-noaddr")
- if v == nil {
- v98v2 = nil
- } else {
- v98v2 = make(map[uint8]uint64, len(v))
- } // reset map
- testUnmarshalErr(&v98v2, bs98, h, t, "dec-map-v98-p-len")
- testDeepEqualErr(v98v1, v98v2, t, "equal-map-v98-p-len")
- bs98 = testMarshalErr(&v98v1, h, t, "enc-map-v98-p")
- v98v2 = nil
- testUnmarshalErr(&v98v2, bs98, h, t, "dec-map-v98-p-nil")
- testDeepEqualErr(v98v1, v98v2, t, "equal-map-v98-p-nil")
- // ...
- if v == nil {
- v98v2 = nil
- } else {
- v98v2 = make(map[uint8]uint64, len(v))
- } // reset map
- var v98v3, v98v4 typMapMapUint8Uint64
- v98v3 = typMapMapUint8Uint64(v98v1)
- v98v4 = typMapMapUint8Uint64(v98v2)
- bs98 = testMarshalErr(v98v3, h, t, "enc-map-v98-custom")
- testUnmarshalErr(v98v4, bs98, h, t, "dec-map-v98-p-len")
- testDeepEqualErr(v98v3, v98v4, t, "equal-map-v98-p-len")
- }
-
- for _, v := range []map[uint8]uintptr{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v99: %v\n", v)
- var v99v1, v99v2 map[uint8]uintptr
- v99v1 = v
- bs99 := testMarshalErr(v99v1, h, t, "enc-map-v99")
- if v == nil {
- v99v2 = nil
- } else {
- v99v2 = make(map[uint8]uintptr, len(v))
- } // reset map
- testUnmarshalErr(v99v2, bs99, h, t, "dec-map-v99")
- testDeepEqualErr(v99v1, v99v2, t, "equal-map-v99")
- if v == nil {
- v99v2 = nil
- } else {
- v99v2 = make(map[uint8]uintptr, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v99v2), bs99, h, t, "dec-map-v99-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v99v1, v99v2, t, "equal-map-v99-noaddr")
- if v == nil {
- v99v2 = nil
- } else {
- v99v2 = make(map[uint8]uintptr, len(v))
- } // reset map
- testUnmarshalErr(&v99v2, bs99, h, t, "dec-map-v99-p-len")
- testDeepEqualErr(v99v1, v99v2, t, "equal-map-v99-p-len")
- bs99 = testMarshalErr(&v99v1, h, t, "enc-map-v99-p")
- v99v2 = nil
- testUnmarshalErr(&v99v2, bs99, h, t, "dec-map-v99-p-nil")
- testDeepEqualErr(v99v1, v99v2, t, "equal-map-v99-p-nil")
- // ...
- if v == nil {
- v99v2 = nil
- } else {
- v99v2 = make(map[uint8]uintptr, len(v))
- } // reset map
- var v99v3, v99v4 typMapMapUint8Uintptr
- v99v3 = typMapMapUint8Uintptr(v99v1)
- v99v4 = typMapMapUint8Uintptr(v99v2)
- bs99 = testMarshalErr(v99v3, h, t, "enc-map-v99-custom")
- testUnmarshalErr(v99v4, bs99, h, t, "dec-map-v99-p-len")
- testDeepEqualErr(v99v3, v99v4, t, "equal-map-v99-p-len")
- }
-
- for _, v := range []map[uint8]int{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v100: %v\n", v)
- var v100v1, v100v2 map[uint8]int
- v100v1 = v
- bs100 := testMarshalErr(v100v1, h, t, "enc-map-v100")
- if v == nil {
- v100v2 = nil
- } else {
- v100v2 = make(map[uint8]int, len(v))
- } // reset map
- testUnmarshalErr(v100v2, bs100, h, t, "dec-map-v100")
- testDeepEqualErr(v100v1, v100v2, t, "equal-map-v100")
- if v == nil {
- v100v2 = nil
- } else {
- v100v2 = make(map[uint8]int, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v100v2), bs100, h, t, "dec-map-v100-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v100v1, v100v2, t, "equal-map-v100-noaddr")
- if v == nil {
- v100v2 = nil
- } else {
- v100v2 = make(map[uint8]int, len(v))
- } // reset map
- testUnmarshalErr(&v100v2, bs100, h, t, "dec-map-v100-p-len")
- testDeepEqualErr(v100v1, v100v2, t, "equal-map-v100-p-len")
- bs100 = testMarshalErr(&v100v1, h, t, "enc-map-v100-p")
- v100v2 = nil
- testUnmarshalErr(&v100v2, bs100, h, t, "dec-map-v100-p-nil")
- testDeepEqualErr(v100v1, v100v2, t, "equal-map-v100-p-nil")
- // ...
- if v == nil {
- v100v2 = nil
- } else {
- v100v2 = make(map[uint8]int, len(v))
- } // reset map
- var v100v3, v100v4 typMapMapUint8Int
- v100v3 = typMapMapUint8Int(v100v1)
- v100v4 = typMapMapUint8Int(v100v2)
- bs100 = testMarshalErr(v100v3, h, t, "enc-map-v100-custom")
- testUnmarshalErr(v100v4, bs100, h, t, "dec-map-v100-p-len")
- testDeepEqualErr(v100v3, v100v4, t, "equal-map-v100-p-len")
- }
-
- for _, v := range []map[uint8]int8{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v101: %v\n", v)
- var v101v1, v101v2 map[uint8]int8
- v101v1 = v
- bs101 := testMarshalErr(v101v1, h, t, "enc-map-v101")
- if v == nil {
- v101v2 = nil
- } else {
- v101v2 = make(map[uint8]int8, len(v))
- } // reset map
- testUnmarshalErr(v101v2, bs101, h, t, "dec-map-v101")
- testDeepEqualErr(v101v1, v101v2, t, "equal-map-v101")
- if v == nil {
- v101v2 = nil
- } else {
- v101v2 = make(map[uint8]int8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v101v2), bs101, h, t, "dec-map-v101-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v101v1, v101v2, t, "equal-map-v101-noaddr")
- if v == nil {
- v101v2 = nil
- } else {
- v101v2 = make(map[uint8]int8, len(v))
- } // reset map
- testUnmarshalErr(&v101v2, bs101, h, t, "dec-map-v101-p-len")
- testDeepEqualErr(v101v1, v101v2, t, "equal-map-v101-p-len")
- bs101 = testMarshalErr(&v101v1, h, t, "enc-map-v101-p")
- v101v2 = nil
- testUnmarshalErr(&v101v2, bs101, h, t, "dec-map-v101-p-nil")
- testDeepEqualErr(v101v1, v101v2, t, "equal-map-v101-p-nil")
- // ...
- if v == nil {
- v101v2 = nil
- } else {
- v101v2 = make(map[uint8]int8, len(v))
- } // reset map
- var v101v3, v101v4 typMapMapUint8Int8
- v101v3 = typMapMapUint8Int8(v101v1)
- v101v4 = typMapMapUint8Int8(v101v2)
- bs101 = testMarshalErr(v101v3, h, t, "enc-map-v101-custom")
- testUnmarshalErr(v101v4, bs101, h, t, "dec-map-v101-p-len")
- testDeepEqualErr(v101v3, v101v4, t, "equal-map-v101-p-len")
- }
-
- for _, v := range []map[uint8]int16{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v102: %v\n", v)
- var v102v1, v102v2 map[uint8]int16
- v102v1 = v
- bs102 := testMarshalErr(v102v1, h, t, "enc-map-v102")
- if v == nil {
- v102v2 = nil
- } else {
- v102v2 = make(map[uint8]int16, len(v))
- } // reset map
- testUnmarshalErr(v102v2, bs102, h, t, "dec-map-v102")
- testDeepEqualErr(v102v1, v102v2, t, "equal-map-v102")
- if v == nil {
- v102v2 = nil
- } else {
- v102v2 = make(map[uint8]int16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v102v2), bs102, h, t, "dec-map-v102-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v102v1, v102v2, t, "equal-map-v102-noaddr")
- if v == nil {
- v102v2 = nil
- } else {
- v102v2 = make(map[uint8]int16, len(v))
- } // reset map
- testUnmarshalErr(&v102v2, bs102, h, t, "dec-map-v102-p-len")
- testDeepEqualErr(v102v1, v102v2, t, "equal-map-v102-p-len")
- bs102 = testMarshalErr(&v102v1, h, t, "enc-map-v102-p")
- v102v2 = nil
- testUnmarshalErr(&v102v2, bs102, h, t, "dec-map-v102-p-nil")
- testDeepEqualErr(v102v1, v102v2, t, "equal-map-v102-p-nil")
- // ...
- if v == nil {
- v102v2 = nil
- } else {
- v102v2 = make(map[uint8]int16, len(v))
- } // reset map
- var v102v3, v102v4 typMapMapUint8Int16
- v102v3 = typMapMapUint8Int16(v102v1)
- v102v4 = typMapMapUint8Int16(v102v2)
- bs102 = testMarshalErr(v102v3, h, t, "enc-map-v102-custom")
- testUnmarshalErr(v102v4, bs102, h, t, "dec-map-v102-p-len")
- testDeepEqualErr(v102v3, v102v4, t, "equal-map-v102-p-len")
- }
-
- for _, v := range []map[uint8]int32{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v103: %v\n", v)
- var v103v1, v103v2 map[uint8]int32
- v103v1 = v
- bs103 := testMarshalErr(v103v1, h, t, "enc-map-v103")
- if v == nil {
- v103v2 = nil
- } else {
- v103v2 = make(map[uint8]int32, len(v))
- } // reset map
- testUnmarshalErr(v103v2, bs103, h, t, "dec-map-v103")
- testDeepEqualErr(v103v1, v103v2, t, "equal-map-v103")
- if v == nil {
- v103v2 = nil
- } else {
- v103v2 = make(map[uint8]int32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v103v2), bs103, h, t, "dec-map-v103-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v103v1, v103v2, t, "equal-map-v103-noaddr")
- if v == nil {
- v103v2 = nil
- } else {
- v103v2 = make(map[uint8]int32, len(v))
- } // reset map
- testUnmarshalErr(&v103v2, bs103, h, t, "dec-map-v103-p-len")
- testDeepEqualErr(v103v1, v103v2, t, "equal-map-v103-p-len")
- bs103 = testMarshalErr(&v103v1, h, t, "enc-map-v103-p")
- v103v2 = nil
- testUnmarshalErr(&v103v2, bs103, h, t, "dec-map-v103-p-nil")
- testDeepEqualErr(v103v1, v103v2, t, "equal-map-v103-p-nil")
- // ...
- if v == nil {
- v103v2 = nil
- } else {
- v103v2 = make(map[uint8]int32, len(v))
- } // reset map
- var v103v3, v103v4 typMapMapUint8Int32
- v103v3 = typMapMapUint8Int32(v103v1)
- v103v4 = typMapMapUint8Int32(v103v2)
- bs103 = testMarshalErr(v103v3, h, t, "enc-map-v103-custom")
- testUnmarshalErr(v103v4, bs103, h, t, "dec-map-v103-p-len")
- testDeepEqualErr(v103v3, v103v4, t, "equal-map-v103-p-len")
- }
-
- for _, v := range []map[uint8]int64{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v104: %v\n", v)
- var v104v1, v104v2 map[uint8]int64
- v104v1 = v
- bs104 := testMarshalErr(v104v1, h, t, "enc-map-v104")
- if v == nil {
- v104v2 = nil
- } else {
- v104v2 = make(map[uint8]int64, len(v))
- } // reset map
- testUnmarshalErr(v104v2, bs104, h, t, "dec-map-v104")
- testDeepEqualErr(v104v1, v104v2, t, "equal-map-v104")
- if v == nil {
- v104v2 = nil
- } else {
- v104v2 = make(map[uint8]int64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v104v2), bs104, h, t, "dec-map-v104-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v104v1, v104v2, t, "equal-map-v104-noaddr")
- if v == nil {
- v104v2 = nil
- } else {
- v104v2 = make(map[uint8]int64, len(v))
- } // reset map
- testUnmarshalErr(&v104v2, bs104, h, t, "dec-map-v104-p-len")
- testDeepEqualErr(v104v1, v104v2, t, "equal-map-v104-p-len")
- bs104 = testMarshalErr(&v104v1, h, t, "enc-map-v104-p")
- v104v2 = nil
- testUnmarshalErr(&v104v2, bs104, h, t, "dec-map-v104-p-nil")
- testDeepEqualErr(v104v1, v104v2, t, "equal-map-v104-p-nil")
- // ...
- if v == nil {
- v104v2 = nil
- } else {
- v104v2 = make(map[uint8]int64, len(v))
- } // reset map
- var v104v3, v104v4 typMapMapUint8Int64
- v104v3 = typMapMapUint8Int64(v104v1)
- v104v4 = typMapMapUint8Int64(v104v2)
- bs104 = testMarshalErr(v104v3, h, t, "enc-map-v104-custom")
- testUnmarshalErr(v104v4, bs104, h, t, "dec-map-v104-p-len")
- testDeepEqualErr(v104v3, v104v4, t, "equal-map-v104-p-len")
- }
-
- for _, v := range []map[uint8]float32{nil, {}, {44: 0, 33: 22.2}} {
- // fmt.Printf(">>>> running mammoth map v105: %v\n", v)
- var v105v1, v105v2 map[uint8]float32
- v105v1 = v
- bs105 := testMarshalErr(v105v1, h, t, "enc-map-v105")
- if v == nil {
- v105v2 = nil
- } else {
- v105v2 = make(map[uint8]float32, len(v))
- } // reset map
- testUnmarshalErr(v105v2, bs105, h, t, "dec-map-v105")
- testDeepEqualErr(v105v1, v105v2, t, "equal-map-v105")
- if v == nil {
- v105v2 = nil
- } else {
- v105v2 = make(map[uint8]float32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v105v2), bs105, h, t, "dec-map-v105-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v105v1, v105v2, t, "equal-map-v105-noaddr")
- if v == nil {
- v105v2 = nil
- } else {
- v105v2 = make(map[uint8]float32, len(v))
- } // reset map
- testUnmarshalErr(&v105v2, bs105, h, t, "dec-map-v105-p-len")
- testDeepEqualErr(v105v1, v105v2, t, "equal-map-v105-p-len")
- bs105 = testMarshalErr(&v105v1, h, t, "enc-map-v105-p")
- v105v2 = nil
- testUnmarshalErr(&v105v2, bs105, h, t, "dec-map-v105-p-nil")
- testDeepEqualErr(v105v1, v105v2, t, "equal-map-v105-p-nil")
- // ...
- if v == nil {
- v105v2 = nil
- } else {
- v105v2 = make(map[uint8]float32, len(v))
- } // reset map
- var v105v3, v105v4 typMapMapUint8Float32
- v105v3 = typMapMapUint8Float32(v105v1)
- v105v4 = typMapMapUint8Float32(v105v2)
- bs105 = testMarshalErr(v105v3, h, t, "enc-map-v105-custom")
- testUnmarshalErr(v105v4, bs105, h, t, "dec-map-v105-p-len")
- testDeepEqualErr(v105v3, v105v4, t, "equal-map-v105-p-len")
- }
-
- for _, v := range []map[uint8]float64{nil, {}, {44: 0, 33: 11.1}} {
- // fmt.Printf(">>>> running mammoth map v106: %v\n", v)
- var v106v1, v106v2 map[uint8]float64
- v106v1 = v
- bs106 := testMarshalErr(v106v1, h, t, "enc-map-v106")
- if v == nil {
- v106v2 = nil
- } else {
- v106v2 = make(map[uint8]float64, len(v))
- } // reset map
- testUnmarshalErr(v106v2, bs106, h, t, "dec-map-v106")
- testDeepEqualErr(v106v1, v106v2, t, "equal-map-v106")
- if v == nil {
- v106v2 = nil
- } else {
- v106v2 = make(map[uint8]float64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v106v2), bs106, h, t, "dec-map-v106-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v106v1, v106v2, t, "equal-map-v106-noaddr")
- if v == nil {
- v106v2 = nil
- } else {
- v106v2 = make(map[uint8]float64, len(v))
- } // reset map
- testUnmarshalErr(&v106v2, bs106, h, t, "dec-map-v106-p-len")
- testDeepEqualErr(v106v1, v106v2, t, "equal-map-v106-p-len")
- bs106 = testMarshalErr(&v106v1, h, t, "enc-map-v106-p")
- v106v2 = nil
- testUnmarshalErr(&v106v2, bs106, h, t, "dec-map-v106-p-nil")
- testDeepEqualErr(v106v1, v106v2, t, "equal-map-v106-p-nil")
- // ...
- if v == nil {
- v106v2 = nil
- } else {
- v106v2 = make(map[uint8]float64, len(v))
- } // reset map
- var v106v3, v106v4 typMapMapUint8Float64
- v106v3 = typMapMapUint8Float64(v106v1)
- v106v4 = typMapMapUint8Float64(v106v2)
- bs106 = testMarshalErr(v106v3, h, t, "enc-map-v106-custom")
- testUnmarshalErr(v106v4, bs106, h, t, "dec-map-v106-p-len")
- testDeepEqualErr(v106v3, v106v4, t, "equal-map-v106-p-len")
- }
-
- for _, v := range []map[uint8]bool{nil, {}, {44: false, 33: true}} {
- // fmt.Printf(">>>> running mammoth map v107: %v\n", v)
- var v107v1, v107v2 map[uint8]bool
- v107v1 = v
- bs107 := testMarshalErr(v107v1, h, t, "enc-map-v107")
- if v == nil {
- v107v2 = nil
- } else {
- v107v2 = make(map[uint8]bool, len(v))
- } // reset map
- testUnmarshalErr(v107v2, bs107, h, t, "dec-map-v107")
- testDeepEqualErr(v107v1, v107v2, t, "equal-map-v107")
- if v == nil {
- v107v2 = nil
- } else {
- v107v2 = make(map[uint8]bool, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v107v2), bs107, h, t, "dec-map-v107-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v107v1, v107v2, t, "equal-map-v107-noaddr")
- if v == nil {
- v107v2 = nil
- } else {
- v107v2 = make(map[uint8]bool, len(v))
- } // reset map
- testUnmarshalErr(&v107v2, bs107, h, t, "dec-map-v107-p-len")
- testDeepEqualErr(v107v1, v107v2, t, "equal-map-v107-p-len")
- bs107 = testMarshalErr(&v107v1, h, t, "enc-map-v107-p")
- v107v2 = nil
- testUnmarshalErr(&v107v2, bs107, h, t, "dec-map-v107-p-nil")
- testDeepEqualErr(v107v1, v107v2, t, "equal-map-v107-p-nil")
- // ...
- if v == nil {
- v107v2 = nil
- } else {
- v107v2 = make(map[uint8]bool, len(v))
- } // reset map
- var v107v3, v107v4 typMapMapUint8Bool
- v107v3 = typMapMapUint8Bool(v107v1)
- v107v4 = typMapMapUint8Bool(v107v2)
- bs107 = testMarshalErr(v107v3, h, t, "enc-map-v107-custom")
- testUnmarshalErr(v107v4, bs107, h, t, "dec-map-v107-p-len")
- testDeepEqualErr(v107v3, v107v4, t, "equal-map-v107-p-len")
- }
-
- for _, v := range []map[uint16]interface{}{nil, {}, {44: nil, 33: "string-is-an-interface-2"}} {
- // fmt.Printf(">>>> running mammoth map v110: %v\n", v)
- var v110v1, v110v2 map[uint16]interface{}
- v110v1 = v
- bs110 := testMarshalErr(v110v1, h, t, "enc-map-v110")
- if v == nil {
- v110v2 = nil
- } else {
- v110v2 = make(map[uint16]interface{}, len(v))
- } // reset map
- testUnmarshalErr(v110v2, bs110, h, t, "dec-map-v110")
- testDeepEqualErr(v110v1, v110v2, t, "equal-map-v110")
- if v == nil {
- v110v2 = nil
- } else {
- v110v2 = make(map[uint16]interface{}, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v110v2), bs110, h, t, "dec-map-v110-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v110v1, v110v2, t, "equal-map-v110-noaddr")
- if v == nil {
- v110v2 = nil
- } else {
- v110v2 = make(map[uint16]interface{}, len(v))
- } // reset map
- testUnmarshalErr(&v110v2, bs110, h, t, "dec-map-v110-p-len")
- testDeepEqualErr(v110v1, v110v2, t, "equal-map-v110-p-len")
- bs110 = testMarshalErr(&v110v1, h, t, "enc-map-v110-p")
- v110v2 = nil
- testUnmarshalErr(&v110v2, bs110, h, t, "dec-map-v110-p-nil")
- testDeepEqualErr(v110v1, v110v2, t, "equal-map-v110-p-nil")
- // ...
- if v == nil {
- v110v2 = nil
- } else {
- v110v2 = make(map[uint16]interface{}, len(v))
- } // reset map
- var v110v3, v110v4 typMapMapUint16Intf
- v110v3 = typMapMapUint16Intf(v110v1)
- v110v4 = typMapMapUint16Intf(v110v2)
- bs110 = testMarshalErr(v110v3, h, t, "enc-map-v110-custom")
- testUnmarshalErr(v110v4, bs110, h, t, "dec-map-v110-p-len")
- testDeepEqualErr(v110v3, v110v4, t, "equal-map-v110-p-len")
- }
-
- for _, v := range []map[uint16]string{nil, {}, {44: "", 33: "some-string-2"}} {
- // fmt.Printf(">>>> running mammoth map v111: %v\n", v)
- var v111v1, v111v2 map[uint16]string
- v111v1 = v
- bs111 := testMarshalErr(v111v1, h, t, "enc-map-v111")
- if v == nil {
- v111v2 = nil
- } else {
- v111v2 = make(map[uint16]string, len(v))
- } // reset map
- testUnmarshalErr(v111v2, bs111, h, t, "dec-map-v111")
- testDeepEqualErr(v111v1, v111v2, t, "equal-map-v111")
- if v == nil {
- v111v2 = nil
- } else {
- v111v2 = make(map[uint16]string, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v111v2), bs111, h, t, "dec-map-v111-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v111v1, v111v2, t, "equal-map-v111-noaddr")
- if v == nil {
- v111v2 = nil
- } else {
- v111v2 = make(map[uint16]string, len(v))
- } // reset map
- testUnmarshalErr(&v111v2, bs111, h, t, "dec-map-v111-p-len")
- testDeepEqualErr(v111v1, v111v2, t, "equal-map-v111-p-len")
- bs111 = testMarshalErr(&v111v1, h, t, "enc-map-v111-p")
- v111v2 = nil
- testUnmarshalErr(&v111v2, bs111, h, t, "dec-map-v111-p-nil")
- testDeepEqualErr(v111v1, v111v2, t, "equal-map-v111-p-nil")
- // ...
- if v == nil {
- v111v2 = nil
- } else {
- v111v2 = make(map[uint16]string, len(v))
- } // reset map
- var v111v3, v111v4 typMapMapUint16String
- v111v3 = typMapMapUint16String(v111v1)
- v111v4 = typMapMapUint16String(v111v2)
- bs111 = testMarshalErr(v111v3, h, t, "enc-map-v111-custom")
- testUnmarshalErr(v111v4, bs111, h, t, "dec-map-v111-p-len")
- testDeepEqualErr(v111v3, v111v4, t, "equal-map-v111-p-len")
- }
-
- for _, v := range []map[uint16]uint{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v112: %v\n", v)
- var v112v1, v112v2 map[uint16]uint
- v112v1 = v
- bs112 := testMarshalErr(v112v1, h, t, "enc-map-v112")
- if v == nil {
- v112v2 = nil
- } else {
- v112v2 = make(map[uint16]uint, len(v))
- } // reset map
- testUnmarshalErr(v112v2, bs112, h, t, "dec-map-v112")
- testDeepEqualErr(v112v1, v112v2, t, "equal-map-v112")
- if v == nil {
- v112v2 = nil
- } else {
- v112v2 = make(map[uint16]uint, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v112v2), bs112, h, t, "dec-map-v112-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v112v1, v112v2, t, "equal-map-v112-noaddr")
- if v == nil {
- v112v2 = nil
- } else {
- v112v2 = make(map[uint16]uint, len(v))
- } // reset map
- testUnmarshalErr(&v112v2, bs112, h, t, "dec-map-v112-p-len")
- testDeepEqualErr(v112v1, v112v2, t, "equal-map-v112-p-len")
- bs112 = testMarshalErr(&v112v1, h, t, "enc-map-v112-p")
- v112v2 = nil
- testUnmarshalErr(&v112v2, bs112, h, t, "dec-map-v112-p-nil")
- testDeepEqualErr(v112v1, v112v2, t, "equal-map-v112-p-nil")
- // ...
- if v == nil {
- v112v2 = nil
- } else {
- v112v2 = make(map[uint16]uint, len(v))
- } // reset map
- var v112v3, v112v4 typMapMapUint16Uint
- v112v3 = typMapMapUint16Uint(v112v1)
- v112v4 = typMapMapUint16Uint(v112v2)
- bs112 = testMarshalErr(v112v3, h, t, "enc-map-v112-custom")
- testUnmarshalErr(v112v4, bs112, h, t, "dec-map-v112-p-len")
- testDeepEqualErr(v112v3, v112v4, t, "equal-map-v112-p-len")
- }
-
- for _, v := range []map[uint16]uint8{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v113: %v\n", v)
- var v113v1, v113v2 map[uint16]uint8
- v113v1 = v
- bs113 := testMarshalErr(v113v1, h, t, "enc-map-v113")
- if v == nil {
- v113v2 = nil
- } else {
- v113v2 = make(map[uint16]uint8, len(v))
- } // reset map
- testUnmarshalErr(v113v2, bs113, h, t, "dec-map-v113")
- testDeepEqualErr(v113v1, v113v2, t, "equal-map-v113")
- if v == nil {
- v113v2 = nil
- } else {
- v113v2 = make(map[uint16]uint8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v113v2), bs113, h, t, "dec-map-v113-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v113v1, v113v2, t, "equal-map-v113-noaddr")
- if v == nil {
- v113v2 = nil
- } else {
- v113v2 = make(map[uint16]uint8, len(v))
- } // reset map
- testUnmarshalErr(&v113v2, bs113, h, t, "dec-map-v113-p-len")
- testDeepEqualErr(v113v1, v113v2, t, "equal-map-v113-p-len")
- bs113 = testMarshalErr(&v113v1, h, t, "enc-map-v113-p")
- v113v2 = nil
- testUnmarshalErr(&v113v2, bs113, h, t, "dec-map-v113-p-nil")
- testDeepEqualErr(v113v1, v113v2, t, "equal-map-v113-p-nil")
- // ...
- if v == nil {
- v113v2 = nil
- } else {
- v113v2 = make(map[uint16]uint8, len(v))
- } // reset map
- var v113v3, v113v4 typMapMapUint16Uint8
- v113v3 = typMapMapUint16Uint8(v113v1)
- v113v4 = typMapMapUint16Uint8(v113v2)
- bs113 = testMarshalErr(v113v3, h, t, "enc-map-v113-custom")
- testUnmarshalErr(v113v4, bs113, h, t, "dec-map-v113-p-len")
- testDeepEqualErr(v113v3, v113v4, t, "equal-map-v113-p-len")
- }
-
- for _, v := range []map[uint16]uint16{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v114: %v\n", v)
- var v114v1, v114v2 map[uint16]uint16
- v114v1 = v
- bs114 := testMarshalErr(v114v1, h, t, "enc-map-v114")
- if v == nil {
- v114v2 = nil
- } else {
- v114v2 = make(map[uint16]uint16, len(v))
- } // reset map
- testUnmarshalErr(v114v2, bs114, h, t, "dec-map-v114")
- testDeepEqualErr(v114v1, v114v2, t, "equal-map-v114")
- if v == nil {
- v114v2 = nil
- } else {
- v114v2 = make(map[uint16]uint16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v114v2), bs114, h, t, "dec-map-v114-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v114v1, v114v2, t, "equal-map-v114-noaddr")
- if v == nil {
- v114v2 = nil
- } else {
- v114v2 = make(map[uint16]uint16, len(v))
- } // reset map
- testUnmarshalErr(&v114v2, bs114, h, t, "dec-map-v114-p-len")
- testDeepEqualErr(v114v1, v114v2, t, "equal-map-v114-p-len")
- bs114 = testMarshalErr(&v114v1, h, t, "enc-map-v114-p")
- v114v2 = nil
- testUnmarshalErr(&v114v2, bs114, h, t, "dec-map-v114-p-nil")
- testDeepEqualErr(v114v1, v114v2, t, "equal-map-v114-p-nil")
- // ...
- if v == nil {
- v114v2 = nil
- } else {
- v114v2 = make(map[uint16]uint16, len(v))
- } // reset map
- var v114v3, v114v4 typMapMapUint16Uint16
- v114v3 = typMapMapUint16Uint16(v114v1)
- v114v4 = typMapMapUint16Uint16(v114v2)
- bs114 = testMarshalErr(v114v3, h, t, "enc-map-v114-custom")
- testUnmarshalErr(v114v4, bs114, h, t, "dec-map-v114-p-len")
- testDeepEqualErr(v114v3, v114v4, t, "equal-map-v114-p-len")
- }
-
- for _, v := range []map[uint16]uint32{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v115: %v\n", v)
- var v115v1, v115v2 map[uint16]uint32
- v115v1 = v
- bs115 := testMarshalErr(v115v1, h, t, "enc-map-v115")
- if v == nil {
- v115v2 = nil
- } else {
- v115v2 = make(map[uint16]uint32, len(v))
- } // reset map
- testUnmarshalErr(v115v2, bs115, h, t, "dec-map-v115")
- testDeepEqualErr(v115v1, v115v2, t, "equal-map-v115")
- if v == nil {
- v115v2 = nil
- } else {
- v115v2 = make(map[uint16]uint32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v115v2), bs115, h, t, "dec-map-v115-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v115v1, v115v2, t, "equal-map-v115-noaddr")
- if v == nil {
- v115v2 = nil
- } else {
- v115v2 = make(map[uint16]uint32, len(v))
- } // reset map
- testUnmarshalErr(&v115v2, bs115, h, t, "dec-map-v115-p-len")
- testDeepEqualErr(v115v1, v115v2, t, "equal-map-v115-p-len")
- bs115 = testMarshalErr(&v115v1, h, t, "enc-map-v115-p")
- v115v2 = nil
- testUnmarshalErr(&v115v2, bs115, h, t, "dec-map-v115-p-nil")
- testDeepEqualErr(v115v1, v115v2, t, "equal-map-v115-p-nil")
- // ...
- if v == nil {
- v115v2 = nil
- } else {
- v115v2 = make(map[uint16]uint32, len(v))
- } // reset map
- var v115v3, v115v4 typMapMapUint16Uint32
- v115v3 = typMapMapUint16Uint32(v115v1)
- v115v4 = typMapMapUint16Uint32(v115v2)
- bs115 = testMarshalErr(v115v3, h, t, "enc-map-v115-custom")
- testUnmarshalErr(v115v4, bs115, h, t, "dec-map-v115-p-len")
- testDeepEqualErr(v115v3, v115v4, t, "equal-map-v115-p-len")
- }
-
- for _, v := range []map[uint16]uint64{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v116: %v\n", v)
- var v116v1, v116v2 map[uint16]uint64
- v116v1 = v
- bs116 := testMarshalErr(v116v1, h, t, "enc-map-v116")
- if v == nil {
- v116v2 = nil
- } else {
- v116v2 = make(map[uint16]uint64, len(v))
- } // reset map
- testUnmarshalErr(v116v2, bs116, h, t, "dec-map-v116")
- testDeepEqualErr(v116v1, v116v2, t, "equal-map-v116")
- if v == nil {
- v116v2 = nil
- } else {
- v116v2 = make(map[uint16]uint64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v116v2), bs116, h, t, "dec-map-v116-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v116v1, v116v2, t, "equal-map-v116-noaddr")
- if v == nil {
- v116v2 = nil
- } else {
- v116v2 = make(map[uint16]uint64, len(v))
- } // reset map
- testUnmarshalErr(&v116v2, bs116, h, t, "dec-map-v116-p-len")
- testDeepEqualErr(v116v1, v116v2, t, "equal-map-v116-p-len")
- bs116 = testMarshalErr(&v116v1, h, t, "enc-map-v116-p")
- v116v2 = nil
- testUnmarshalErr(&v116v2, bs116, h, t, "dec-map-v116-p-nil")
- testDeepEqualErr(v116v1, v116v2, t, "equal-map-v116-p-nil")
- // ...
- if v == nil {
- v116v2 = nil
- } else {
- v116v2 = make(map[uint16]uint64, len(v))
- } // reset map
- var v116v3, v116v4 typMapMapUint16Uint64
- v116v3 = typMapMapUint16Uint64(v116v1)
- v116v4 = typMapMapUint16Uint64(v116v2)
- bs116 = testMarshalErr(v116v3, h, t, "enc-map-v116-custom")
- testUnmarshalErr(v116v4, bs116, h, t, "dec-map-v116-p-len")
- testDeepEqualErr(v116v3, v116v4, t, "equal-map-v116-p-len")
- }
-
- for _, v := range []map[uint16]uintptr{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v117: %v\n", v)
- var v117v1, v117v2 map[uint16]uintptr
- v117v1 = v
- bs117 := testMarshalErr(v117v1, h, t, "enc-map-v117")
- if v == nil {
- v117v2 = nil
- } else {
- v117v2 = make(map[uint16]uintptr, len(v))
- } // reset map
- testUnmarshalErr(v117v2, bs117, h, t, "dec-map-v117")
- testDeepEqualErr(v117v1, v117v2, t, "equal-map-v117")
- if v == nil {
- v117v2 = nil
- } else {
- v117v2 = make(map[uint16]uintptr, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v117v2), bs117, h, t, "dec-map-v117-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v117v1, v117v2, t, "equal-map-v117-noaddr")
- if v == nil {
- v117v2 = nil
- } else {
- v117v2 = make(map[uint16]uintptr, len(v))
- } // reset map
- testUnmarshalErr(&v117v2, bs117, h, t, "dec-map-v117-p-len")
- testDeepEqualErr(v117v1, v117v2, t, "equal-map-v117-p-len")
- bs117 = testMarshalErr(&v117v1, h, t, "enc-map-v117-p")
- v117v2 = nil
- testUnmarshalErr(&v117v2, bs117, h, t, "dec-map-v117-p-nil")
- testDeepEqualErr(v117v1, v117v2, t, "equal-map-v117-p-nil")
- // ...
- if v == nil {
- v117v2 = nil
- } else {
- v117v2 = make(map[uint16]uintptr, len(v))
- } // reset map
- var v117v3, v117v4 typMapMapUint16Uintptr
- v117v3 = typMapMapUint16Uintptr(v117v1)
- v117v4 = typMapMapUint16Uintptr(v117v2)
- bs117 = testMarshalErr(v117v3, h, t, "enc-map-v117-custom")
- testUnmarshalErr(v117v4, bs117, h, t, "dec-map-v117-p-len")
- testDeepEqualErr(v117v3, v117v4, t, "equal-map-v117-p-len")
- }
-
- for _, v := range []map[uint16]int{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v118: %v\n", v)
- var v118v1, v118v2 map[uint16]int
- v118v1 = v
- bs118 := testMarshalErr(v118v1, h, t, "enc-map-v118")
- if v == nil {
- v118v2 = nil
- } else {
- v118v2 = make(map[uint16]int, len(v))
- } // reset map
- testUnmarshalErr(v118v2, bs118, h, t, "dec-map-v118")
- testDeepEqualErr(v118v1, v118v2, t, "equal-map-v118")
- if v == nil {
- v118v2 = nil
- } else {
- v118v2 = make(map[uint16]int, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v118v2), bs118, h, t, "dec-map-v118-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v118v1, v118v2, t, "equal-map-v118-noaddr")
- if v == nil {
- v118v2 = nil
- } else {
- v118v2 = make(map[uint16]int, len(v))
- } // reset map
- testUnmarshalErr(&v118v2, bs118, h, t, "dec-map-v118-p-len")
- testDeepEqualErr(v118v1, v118v2, t, "equal-map-v118-p-len")
- bs118 = testMarshalErr(&v118v1, h, t, "enc-map-v118-p")
- v118v2 = nil
- testUnmarshalErr(&v118v2, bs118, h, t, "dec-map-v118-p-nil")
- testDeepEqualErr(v118v1, v118v2, t, "equal-map-v118-p-nil")
- // ...
- if v == nil {
- v118v2 = nil
- } else {
- v118v2 = make(map[uint16]int, len(v))
- } // reset map
- var v118v3, v118v4 typMapMapUint16Int
- v118v3 = typMapMapUint16Int(v118v1)
- v118v4 = typMapMapUint16Int(v118v2)
- bs118 = testMarshalErr(v118v3, h, t, "enc-map-v118-custom")
- testUnmarshalErr(v118v4, bs118, h, t, "dec-map-v118-p-len")
- testDeepEqualErr(v118v3, v118v4, t, "equal-map-v118-p-len")
- }
-
- for _, v := range []map[uint16]int8{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v119: %v\n", v)
- var v119v1, v119v2 map[uint16]int8
- v119v1 = v
- bs119 := testMarshalErr(v119v1, h, t, "enc-map-v119")
- if v == nil {
- v119v2 = nil
- } else {
- v119v2 = make(map[uint16]int8, len(v))
- } // reset map
- testUnmarshalErr(v119v2, bs119, h, t, "dec-map-v119")
- testDeepEqualErr(v119v1, v119v2, t, "equal-map-v119")
- if v == nil {
- v119v2 = nil
- } else {
- v119v2 = make(map[uint16]int8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v119v2), bs119, h, t, "dec-map-v119-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v119v1, v119v2, t, "equal-map-v119-noaddr")
- if v == nil {
- v119v2 = nil
- } else {
- v119v2 = make(map[uint16]int8, len(v))
- } // reset map
- testUnmarshalErr(&v119v2, bs119, h, t, "dec-map-v119-p-len")
- testDeepEqualErr(v119v1, v119v2, t, "equal-map-v119-p-len")
- bs119 = testMarshalErr(&v119v1, h, t, "enc-map-v119-p")
- v119v2 = nil
- testUnmarshalErr(&v119v2, bs119, h, t, "dec-map-v119-p-nil")
- testDeepEqualErr(v119v1, v119v2, t, "equal-map-v119-p-nil")
- // ...
- if v == nil {
- v119v2 = nil
- } else {
- v119v2 = make(map[uint16]int8, len(v))
- } // reset map
- var v119v3, v119v4 typMapMapUint16Int8
- v119v3 = typMapMapUint16Int8(v119v1)
- v119v4 = typMapMapUint16Int8(v119v2)
- bs119 = testMarshalErr(v119v3, h, t, "enc-map-v119-custom")
- testUnmarshalErr(v119v4, bs119, h, t, "dec-map-v119-p-len")
- testDeepEqualErr(v119v3, v119v4, t, "equal-map-v119-p-len")
- }
-
- for _, v := range []map[uint16]int16{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v120: %v\n", v)
- var v120v1, v120v2 map[uint16]int16
- v120v1 = v
- bs120 := testMarshalErr(v120v1, h, t, "enc-map-v120")
- if v == nil {
- v120v2 = nil
- } else {
- v120v2 = make(map[uint16]int16, len(v))
- } // reset map
- testUnmarshalErr(v120v2, bs120, h, t, "dec-map-v120")
- testDeepEqualErr(v120v1, v120v2, t, "equal-map-v120")
- if v == nil {
- v120v2 = nil
- } else {
- v120v2 = make(map[uint16]int16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v120v2), bs120, h, t, "dec-map-v120-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v120v1, v120v2, t, "equal-map-v120-noaddr")
- if v == nil {
- v120v2 = nil
- } else {
- v120v2 = make(map[uint16]int16, len(v))
- } // reset map
- testUnmarshalErr(&v120v2, bs120, h, t, "dec-map-v120-p-len")
- testDeepEqualErr(v120v1, v120v2, t, "equal-map-v120-p-len")
- bs120 = testMarshalErr(&v120v1, h, t, "enc-map-v120-p")
- v120v2 = nil
- testUnmarshalErr(&v120v2, bs120, h, t, "dec-map-v120-p-nil")
- testDeepEqualErr(v120v1, v120v2, t, "equal-map-v120-p-nil")
- // ...
- if v == nil {
- v120v2 = nil
- } else {
- v120v2 = make(map[uint16]int16, len(v))
- } // reset map
- var v120v3, v120v4 typMapMapUint16Int16
- v120v3 = typMapMapUint16Int16(v120v1)
- v120v4 = typMapMapUint16Int16(v120v2)
- bs120 = testMarshalErr(v120v3, h, t, "enc-map-v120-custom")
- testUnmarshalErr(v120v4, bs120, h, t, "dec-map-v120-p-len")
- testDeepEqualErr(v120v3, v120v4, t, "equal-map-v120-p-len")
- }
-
- for _, v := range []map[uint16]int32{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v121: %v\n", v)
- var v121v1, v121v2 map[uint16]int32
- v121v1 = v
- bs121 := testMarshalErr(v121v1, h, t, "enc-map-v121")
- if v == nil {
- v121v2 = nil
- } else {
- v121v2 = make(map[uint16]int32, len(v))
- } // reset map
- testUnmarshalErr(v121v2, bs121, h, t, "dec-map-v121")
- testDeepEqualErr(v121v1, v121v2, t, "equal-map-v121")
- if v == nil {
- v121v2 = nil
- } else {
- v121v2 = make(map[uint16]int32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v121v2), bs121, h, t, "dec-map-v121-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v121v1, v121v2, t, "equal-map-v121-noaddr")
- if v == nil {
- v121v2 = nil
- } else {
- v121v2 = make(map[uint16]int32, len(v))
- } // reset map
- testUnmarshalErr(&v121v2, bs121, h, t, "dec-map-v121-p-len")
- testDeepEqualErr(v121v1, v121v2, t, "equal-map-v121-p-len")
- bs121 = testMarshalErr(&v121v1, h, t, "enc-map-v121-p")
- v121v2 = nil
- testUnmarshalErr(&v121v2, bs121, h, t, "dec-map-v121-p-nil")
- testDeepEqualErr(v121v1, v121v2, t, "equal-map-v121-p-nil")
- // ...
- if v == nil {
- v121v2 = nil
- } else {
- v121v2 = make(map[uint16]int32, len(v))
- } // reset map
- var v121v3, v121v4 typMapMapUint16Int32
- v121v3 = typMapMapUint16Int32(v121v1)
- v121v4 = typMapMapUint16Int32(v121v2)
- bs121 = testMarshalErr(v121v3, h, t, "enc-map-v121-custom")
- testUnmarshalErr(v121v4, bs121, h, t, "dec-map-v121-p-len")
- testDeepEqualErr(v121v3, v121v4, t, "equal-map-v121-p-len")
- }
-
- for _, v := range []map[uint16]int64{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v122: %v\n", v)
- var v122v1, v122v2 map[uint16]int64
- v122v1 = v
- bs122 := testMarshalErr(v122v1, h, t, "enc-map-v122")
- if v == nil {
- v122v2 = nil
- } else {
- v122v2 = make(map[uint16]int64, len(v))
- } // reset map
- testUnmarshalErr(v122v2, bs122, h, t, "dec-map-v122")
- testDeepEqualErr(v122v1, v122v2, t, "equal-map-v122")
- if v == nil {
- v122v2 = nil
- } else {
- v122v2 = make(map[uint16]int64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v122v2), bs122, h, t, "dec-map-v122-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v122v1, v122v2, t, "equal-map-v122-noaddr")
- if v == nil {
- v122v2 = nil
- } else {
- v122v2 = make(map[uint16]int64, len(v))
- } // reset map
- testUnmarshalErr(&v122v2, bs122, h, t, "dec-map-v122-p-len")
- testDeepEqualErr(v122v1, v122v2, t, "equal-map-v122-p-len")
- bs122 = testMarshalErr(&v122v1, h, t, "enc-map-v122-p")
- v122v2 = nil
- testUnmarshalErr(&v122v2, bs122, h, t, "dec-map-v122-p-nil")
- testDeepEqualErr(v122v1, v122v2, t, "equal-map-v122-p-nil")
- // ...
- if v == nil {
- v122v2 = nil
- } else {
- v122v2 = make(map[uint16]int64, len(v))
- } // reset map
- var v122v3, v122v4 typMapMapUint16Int64
- v122v3 = typMapMapUint16Int64(v122v1)
- v122v4 = typMapMapUint16Int64(v122v2)
- bs122 = testMarshalErr(v122v3, h, t, "enc-map-v122-custom")
- testUnmarshalErr(v122v4, bs122, h, t, "dec-map-v122-p-len")
- testDeepEqualErr(v122v3, v122v4, t, "equal-map-v122-p-len")
- }
-
- for _, v := range []map[uint16]float32{nil, {}, {33: 0, 44: 22.2}} {
- // fmt.Printf(">>>> running mammoth map v123: %v\n", v)
- var v123v1, v123v2 map[uint16]float32
- v123v1 = v
- bs123 := testMarshalErr(v123v1, h, t, "enc-map-v123")
- if v == nil {
- v123v2 = nil
- } else {
- v123v2 = make(map[uint16]float32, len(v))
- } // reset map
- testUnmarshalErr(v123v2, bs123, h, t, "dec-map-v123")
- testDeepEqualErr(v123v1, v123v2, t, "equal-map-v123")
- if v == nil {
- v123v2 = nil
- } else {
- v123v2 = make(map[uint16]float32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v123v2), bs123, h, t, "dec-map-v123-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v123v1, v123v2, t, "equal-map-v123-noaddr")
- if v == nil {
- v123v2 = nil
- } else {
- v123v2 = make(map[uint16]float32, len(v))
- } // reset map
- testUnmarshalErr(&v123v2, bs123, h, t, "dec-map-v123-p-len")
- testDeepEqualErr(v123v1, v123v2, t, "equal-map-v123-p-len")
- bs123 = testMarshalErr(&v123v1, h, t, "enc-map-v123-p")
- v123v2 = nil
- testUnmarshalErr(&v123v2, bs123, h, t, "dec-map-v123-p-nil")
- testDeepEqualErr(v123v1, v123v2, t, "equal-map-v123-p-nil")
- // ...
- if v == nil {
- v123v2 = nil
- } else {
- v123v2 = make(map[uint16]float32, len(v))
- } // reset map
- var v123v3, v123v4 typMapMapUint16Float32
- v123v3 = typMapMapUint16Float32(v123v1)
- v123v4 = typMapMapUint16Float32(v123v2)
- bs123 = testMarshalErr(v123v3, h, t, "enc-map-v123-custom")
- testUnmarshalErr(v123v4, bs123, h, t, "dec-map-v123-p-len")
- testDeepEqualErr(v123v3, v123v4, t, "equal-map-v123-p-len")
- }
-
- for _, v := range []map[uint16]float64{nil, {}, {33: 0, 44: 11.1}} {
- // fmt.Printf(">>>> running mammoth map v124: %v\n", v)
- var v124v1, v124v2 map[uint16]float64
- v124v1 = v
- bs124 := testMarshalErr(v124v1, h, t, "enc-map-v124")
- if v == nil {
- v124v2 = nil
- } else {
- v124v2 = make(map[uint16]float64, len(v))
- } // reset map
- testUnmarshalErr(v124v2, bs124, h, t, "dec-map-v124")
- testDeepEqualErr(v124v1, v124v2, t, "equal-map-v124")
- if v == nil {
- v124v2 = nil
- } else {
- v124v2 = make(map[uint16]float64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v124v2), bs124, h, t, "dec-map-v124-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v124v1, v124v2, t, "equal-map-v124-noaddr")
- if v == nil {
- v124v2 = nil
- } else {
- v124v2 = make(map[uint16]float64, len(v))
- } // reset map
- testUnmarshalErr(&v124v2, bs124, h, t, "dec-map-v124-p-len")
- testDeepEqualErr(v124v1, v124v2, t, "equal-map-v124-p-len")
- bs124 = testMarshalErr(&v124v1, h, t, "enc-map-v124-p")
- v124v2 = nil
- testUnmarshalErr(&v124v2, bs124, h, t, "dec-map-v124-p-nil")
- testDeepEqualErr(v124v1, v124v2, t, "equal-map-v124-p-nil")
- // ...
- if v == nil {
- v124v2 = nil
- } else {
- v124v2 = make(map[uint16]float64, len(v))
- } // reset map
- var v124v3, v124v4 typMapMapUint16Float64
- v124v3 = typMapMapUint16Float64(v124v1)
- v124v4 = typMapMapUint16Float64(v124v2)
- bs124 = testMarshalErr(v124v3, h, t, "enc-map-v124-custom")
- testUnmarshalErr(v124v4, bs124, h, t, "dec-map-v124-p-len")
- testDeepEqualErr(v124v3, v124v4, t, "equal-map-v124-p-len")
- }
-
- for _, v := range []map[uint16]bool{nil, {}, {33: false, 44: true}} {
- // fmt.Printf(">>>> running mammoth map v125: %v\n", v)
- var v125v1, v125v2 map[uint16]bool
- v125v1 = v
- bs125 := testMarshalErr(v125v1, h, t, "enc-map-v125")
- if v == nil {
- v125v2 = nil
- } else {
- v125v2 = make(map[uint16]bool, len(v))
- } // reset map
- testUnmarshalErr(v125v2, bs125, h, t, "dec-map-v125")
- testDeepEqualErr(v125v1, v125v2, t, "equal-map-v125")
- if v == nil {
- v125v2 = nil
- } else {
- v125v2 = make(map[uint16]bool, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v125v2), bs125, h, t, "dec-map-v125-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v125v1, v125v2, t, "equal-map-v125-noaddr")
- if v == nil {
- v125v2 = nil
- } else {
- v125v2 = make(map[uint16]bool, len(v))
- } // reset map
- testUnmarshalErr(&v125v2, bs125, h, t, "dec-map-v125-p-len")
- testDeepEqualErr(v125v1, v125v2, t, "equal-map-v125-p-len")
- bs125 = testMarshalErr(&v125v1, h, t, "enc-map-v125-p")
- v125v2 = nil
- testUnmarshalErr(&v125v2, bs125, h, t, "dec-map-v125-p-nil")
- testDeepEqualErr(v125v1, v125v2, t, "equal-map-v125-p-nil")
- // ...
- if v == nil {
- v125v2 = nil
- } else {
- v125v2 = make(map[uint16]bool, len(v))
- } // reset map
- var v125v3, v125v4 typMapMapUint16Bool
- v125v3 = typMapMapUint16Bool(v125v1)
- v125v4 = typMapMapUint16Bool(v125v2)
- bs125 = testMarshalErr(v125v3, h, t, "enc-map-v125-custom")
- testUnmarshalErr(v125v4, bs125, h, t, "dec-map-v125-p-len")
- testDeepEqualErr(v125v3, v125v4, t, "equal-map-v125-p-len")
- }
-
- for _, v := range []map[uint32]interface{}{nil, {}, {33: nil, 44: "string-is-an-interface"}} {
- // fmt.Printf(">>>> running mammoth map v128: %v\n", v)
- var v128v1, v128v2 map[uint32]interface{}
- v128v1 = v
- bs128 := testMarshalErr(v128v1, h, t, "enc-map-v128")
- if v == nil {
- v128v2 = nil
- } else {
- v128v2 = make(map[uint32]interface{}, len(v))
- } // reset map
- testUnmarshalErr(v128v2, bs128, h, t, "dec-map-v128")
- testDeepEqualErr(v128v1, v128v2, t, "equal-map-v128")
- if v == nil {
- v128v2 = nil
- } else {
- v128v2 = make(map[uint32]interface{}, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v128v2), bs128, h, t, "dec-map-v128-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v128v1, v128v2, t, "equal-map-v128-noaddr")
- if v == nil {
- v128v2 = nil
- } else {
- v128v2 = make(map[uint32]interface{}, len(v))
- } // reset map
- testUnmarshalErr(&v128v2, bs128, h, t, "dec-map-v128-p-len")
- testDeepEqualErr(v128v1, v128v2, t, "equal-map-v128-p-len")
- bs128 = testMarshalErr(&v128v1, h, t, "enc-map-v128-p")
- v128v2 = nil
- testUnmarshalErr(&v128v2, bs128, h, t, "dec-map-v128-p-nil")
- testDeepEqualErr(v128v1, v128v2, t, "equal-map-v128-p-nil")
- // ...
- if v == nil {
- v128v2 = nil
- } else {
- v128v2 = make(map[uint32]interface{}, len(v))
- } // reset map
- var v128v3, v128v4 typMapMapUint32Intf
- v128v3 = typMapMapUint32Intf(v128v1)
- v128v4 = typMapMapUint32Intf(v128v2)
- bs128 = testMarshalErr(v128v3, h, t, "enc-map-v128-custom")
- testUnmarshalErr(v128v4, bs128, h, t, "dec-map-v128-p-len")
- testDeepEqualErr(v128v3, v128v4, t, "equal-map-v128-p-len")
- }
-
- for _, v := range []map[uint32]string{nil, {}, {33: "", 44: "some-string"}} {
- // fmt.Printf(">>>> running mammoth map v129: %v\n", v)
- var v129v1, v129v2 map[uint32]string
- v129v1 = v
- bs129 := testMarshalErr(v129v1, h, t, "enc-map-v129")
- if v == nil {
- v129v2 = nil
- } else {
- v129v2 = make(map[uint32]string, len(v))
- } // reset map
- testUnmarshalErr(v129v2, bs129, h, t, "dec-map-v129")
- testDeepEqualErr(v129v1, v129v2, t, "equal-map-v129")
- if v == nil {
- v129v2 = nil
- } else {
- v129v2 = make(map[uint32]string, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v129v2), bs129, h, t, "dec-map-v129-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v129v1, v129v2, t, "equal-map-v129-noaddr")
- if v == nil {
- v129v2 = nil
- } else {
- v129v2 = make(map[uint32]string, len(v))
- } // reset map
- testUnmarshalErr(&v129v2, bs129, h, t, "dec-map-v129-p-len")
- testDeepEqualErr(v129v1, v129v2, t, "equal-map-v129-p-len")
- bs129 = testMarshalErr(&v129v1, h, t, "enc-map-v129-p")
- v129v2 = nil
- testUnmarshalErr(&v129v2, bs129, h, t, "dec-map-v129-p-nil")
- testDeepEqualErr(v129v1, v129v2, t, "equal-map-v129-p-nil")
- // ...
- if v == nil {
- v129v2 = nil
- } else {
- v129v2 = make(map[uint32]string, len(v))
- } // reset map
- var v129v3, v129v4 typMapMapUint32String
- v129v3 = typMapMapUint32String(v129v1)
- v129v4 = typMapMapUint32String(v129v2)
- bs129 = testMarshalErr(v129v3, h, t, "enc-map-v129-custom")
- testUnmarshalErr(v129v4, bs129, h, t, "dec-map-v129-p-len")
- testDeepEqualErr(v129v3, v129v4, t, "equal-map-v129-p-len")
- }
-
- for _, v := range []map[uint32]uint{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v130: %v\n", v)
- var v130v1, v130v2 map[uint32]uint
- v130v1 = v
- bs130 := testMarshalErr(v130v1, h, t, "enc-map-v130")
- if v == nil {
- v130v2 = nil
- } else {
- v130v2 = make(map[uint32]uint, len(v))
- } // reset map
- testUnmarshalErr(v130v2, bs130, h, t, "dec-map-v130")
- testDeepEqualErr(v130v1, v130v2, t, "equal-map-v130")
- if v == nil {
- v130v2 = nil
- } else {
- v130v2 = make(map[uint32]uint, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v130v2), bs130, h, t, "dec-map-v130-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v130v1, v130v2, t, "equal-map-v130-noaddr")
- if v == nil {
- v130v2 = nil
- } else {
- v130v2 = make(map[uint32]uint, len(v))
- } // reset map
- testUnmarshalErr(&v130v2, bs130, h, t, "dec-map-v130-p-len")
- testDeepEqualErr(v130v1, v130v2, t, "equal-map-v130-p-len")
- bs130 = testMarshalErr(&v130v1, h, t, "enc-map-v130-p")
- v130v2 = nil
- testUnmarshalErr(&v130v2, bs130, h, t, "dec-map-v130-p-nil")
- testDeepEqualErr(v130v1, v130v2, t, "equal-map-v130-p-nil")
- // ...
- if v == nil {
- v130v2 = nil
- } else {
- v130v2 = make(map[uint32]uint, len(v))
- } // reset map
- var v130v3, v130v4 typMapMapUint32Uint
- v130v3 = typMapMapUint32Uint(v130v1)
- v130v4 = typMapMapUint32Uint(v130v2)
- bs130 = testMarshalErr(v130v3, h, t, "enc-map-v130-custom")
- testUnmarshalErr(v130v4, bs130, h, t, "dec-map-v130-p-len")
- testDeepEqualErr(v130v3, v130v4, t, "equal-map-v130-p-len")
- }
-
- for _, v := range []map[uint32]uint8{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v131: %v\n", v)
- var v131v1, v131v2 map[uint32]uint8
- v131v1 = v
- bs131 := testMarshalErr(v131v1, h, t, "enc-map-v131")
- if v == nil {
- v131v2 = nil
- } else {
- v131v2 = make(map[uint32]uint8, len(v))
- } // reset map
- testUnmarshalErr(v131v2, bs131, h, t, "dec-map-v131")
- testDeepEqualErr(v131v1, v131v2, t, "equal-map-v131")
- if v == nil {
- v131v2 = nil
- } else {
- v131v2 = make(map[uint32]uint8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v131v2), bs131, h, t, "dec-map-v131-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v131v1, v131v2, t, "equal-map-v131-noaddr")
- if v == nil {
- v131v2 = nil
- } else {
- v131v2 = make(map[uint32]uint8, len(v))
- } // reset map
- testUnmarshalErr(&v131v2, bs131, h, t, "dec-map-v131-p-len")
- testDeepEqualErr(v131v1, v131v2, t, "equal-map-v131-p-len")
- bs131 = testMarshalErr(&v131v1, h, t, "enc-map-v131-p")
- v131v2 = nil
- testUnmarshalErr(&v131v2, bs131, h, t, "dec-map-v131-p-nil")
- testDeepEqualErr(v131v1, v131v2, t, "equal-map-v131-p-nil")
- // ...
- if v == nil {
- v131v2 = nil
- } else {
- v131v2 = make(map[uint32]uint8, len(v))
- } // reset map
- var v131v3, v131v4 typMapMapUint32Uint8
- v131v3 = typMapMapUint32Uint8(v131v1)
- v131v4 = typMapMapUint32Uint8(v131v2)
- bs131 = testMarshalErr(v131v3, h, t, "enc-map-v131-custom")
- testUnmarshalErr(v131v4, bs131, h, t, "dec-map-v131-p-len")
- testDeepEqualErr(v131v3, v131v4, t, "equal-map-v131-p-len")
- }
-
- for _, v := range []map[uint32]uint16{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v132: %v\n", v)
- var v132v1, v132v2 map[uint32]uint16
- v132v1 = v
- bs132 := testMarshalErr(v132v1, h, t, "enc-map-v132")
- if v == nil {
- v132v2 = nil
- } else {
- v132v2 = make(map[uint32]uint16, len(v))
- } // reset map
- testUnmarshalErr(v132v2, bs132, h, t, "dec-map-v132")
- testDeepEqualErr(v132v1, v132v2, t, "equal-map-v132")
- if v == nil {
- v132v2 = nil
- } else {
- v132v2 = make(map[uint32]uint16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v132v2), bs132, h, t, "dec-map-v132-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v132v1, v132v2, t, "equal-map-v132-noaddr")
- if v == nil {
- v132v2 = nil
- } else {
- v132v2 = make(map[uint32]uint16, len(v))
- } // reset map
- testUnmarshalErr(&v132v2, bs132, h, t, "dec-map-v132-p-len")
- testDeepEqualErr(v132v1, v132v2, t, "equal-map-v132-p-len")
- bs132 = testMarshalErr(&v132v1, h, t, "enc-map-v132-p")
- v132v2 = nil
- testUnmarshalErr(&v132v2, bs132, h, t, "dec-map-v132-p-nil")
- testDeepEqualErr(v132v1, v132v2, t, "equal-map-v132-p-nil")
- // ...
- if v == nil {
- v132v2 = nil
- } else {
- v132v2 = make(map[uint32]uint16, len(v))
- } // reset map
- var v132v3, v132v4 typMapMapUint32Uint16
- v132v3 = typMapMapUint32Uint16(v132v1)
- v132v4 = typMapMapUint32Uint16(v132v2)
- bs132 = testMarshalErr(v132v3, h, t, "enc-map-v132-custom")
- testUnmarshalErr(v132v4, bs132, h, t, "dec-map-v132-p-len")
- testDeepEqualErr(v132v3, v132v4, t, "equal-map-v132-p-len")
- }
-
- for _, v := range []map[uint32]uint32{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v133: %v\n", v)
- var v133v1, v133v2 map[uint32]uint32
- v133v1 = v
- bs133 := testMarshalErr(v133v1, h, t, "enc-map-v133")
- if v == nil {
- v133v2 = nil
- } else {
- v133v2 = make(map[uint32]uint32, len(v))
- } // reset map
- testUnmarshalErr(v133v2, bs133, h, t, "dec-map-v133")
- testDeepEqualErr(v133v1, v133v2, t, "equal-map-v133")
- if v == nil {
- v133v2 = nil
- } else {
- v133v2 = make(map[uint32]uint32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v133v2), bs133, h, t, "dec-map-v133-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v133v1, v133v2, t, "equal-map-v133-noaddr")
- if v == nil {
- v133v2 = nil
- } else {
- v133v2 = make(map[uint32]uint32, len(v))
- } // reset map
- testUnmarshalErr(&v133v2, bs133, h, t, "dec-map-v133-p-len")
- testDeepEqualErr(v133v1, v133v2, t, "equal-map-v133-p-len")
- bs133 = testMarshalErr(&v133v1, h, t, "enc-map-v133-p")
- v133v2 = nil
- testUnmarshalErr(&v133v2, bs133, h, t, "dec-map-v133-p-nil")
- testDeepEqualErr(v133v1, v133v2, t, "equal-map-v133-p-nil")
- // ...
- if v == nil {
- v133v2 = nil
- } else {
- v133v2 = make(map[uint32]uint32, len(v))
- } // reset map
- var v133v3, v133v4 typMapMapUint32Uint32
- v133v3 = typMapMapUint32Uint32(v133v1)
- v133v4 = typMapMapUint32Uint32(v133v2)
- bs133 = testMarshalErr(v133v3, h, t, "enc-map-v133-custom")
- testUnmarshalErr(v133v4, bs133, h, t, "dec-map-v133-p-len")
- testDeepEqualErr(v133v3, v133v4, t, "equal-map-v133-p-len")
- }
-
- for _, v := range []map[uint32]uint64{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v134: %v\n", v)
- var v134v1, v134v2 map[uint32]uint64
- v134v1 = v
- bs134 := testMarshalErr(v134v1, h, t, "enc-map-v134")
- if v == nil {
- v134v2 = nil
- } else {
- v134v2 = make(map[uint32]uint64, len(v))
- } // reset map
- testUnmarshalErr(v134v2, bs134, h, t, "dec-map-v134")
- testDeepEqualErr(v134v1, v134v2, t, "equal-map-v134")
- if v == nil {
- v134v2 = nil
- } else {
- v134v2 = make(map[uint32]uint64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v134v2), bs134, h, t, "dec-map-v134-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v134v1, v134v2, t, "equal-map-v134-noaddr")
- if v == nil {
- v134v2 = nil
- } else {
- v134v2 = make(map[uint32]uint64, len(v))
- } // reset map
- testUnmarshalErr(&v134v2, bs134, h, t, "dec-map-v134-p-len")
- testDeepEqualErr(v134v1, v134v2, t, "equal-map-v134-p-len")
- bs134 = testMarshalErr(&v134v1, h, t, "enc-map-v134-p")
- v134v2 = nil
- testUnmarshalErr(&v134v2, bs134, h, t, "dec-map-v134-p-nil")
- testDeepEqualErr(v134v1, v134v2, t, "equal-map-v134-p-nil")
- // ...
- if v == nil {
- v134v2 = nil
- } else {
- v134v2 = make(map[uint32]uint64, len(v))
- } // reset map
- var v134v3, v134v4 typMapMapUint32Uint64
- v134v3 = typMapMapUint32Uint64(v134v1)
- v134v4 = typMapMapUint32Uint64(v134v2)
- bs134 = testMarshalErr(v134v3, h, t, "enc-map-v134-custom")
- testUnmarshalErr(v134v4, bs134, h, t, "dec-map-v134-p-len")
- testDeepEqualErr(v134v3, v134v4, t, "equal-map-v134-p-len")
- }
-
- for _, v := range []map[uint32]uintptr{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v135: %v\n", v)
- var v135v1, v135v2 map[uint32]uintptr
- v135v1 = v
- bs135 := testMarshalErr(v135v1, h, t, "enc-map-v135")
- if v == nil {
- v135v2 = nil
- } else {
- v135v2 = make(map[uint32]uintptr, len(v))
- } // reset map
- testUnmarshalErr(v135v2, bs135, h, t, "dec-map-v135")
- testDeepEqualErr(v135v1, v135v2, t, "equal-map-v135")
- if v == nil {
- v135v2 = nil
- } else {
- v135v2 = make(map[uint32]uintptr, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v135v2), bs135, h, t, "dec-map-v135-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v135v1, v135v2, t, "equal-map-v135-noaddr")
- if v == nil {
- v135v2 = nil
- } else {
- v135v2 = make(map[uint32]uintptr, len(v))
- } // reset map
- testUnmarshalErr(&v135v2, bs135, h, t, "dec-map-v135-p-len")
- testDeepEqualErr(v135v1, v135v2, t, "equal-map-v135-p-len")
- bs135 = testMarshalErr(&v135v1, h, t, "enc-map-v135-p")
- v135v2 = nil
- testUnmarshalErr(&v135v2, bs135, h, t, "dec-map-v135-p-nil")
- testDeepEqualErr(v135v1, v135v2, t, "equal-map-v135-p-nil")
- // ...
- if v == nil {
- v135v2 = nil
- } else {
- v135v2 = make(map[uint32]uintptr, len(v))
- } // reset map
- var v135v3, v135v4 typMapMapUint32Uintptr
- v135v3 = typMapMapUint32Uintptr(v135v1)
- v135v4 = typMapMapUint32Uintptr(v135v2)
- bs135 = testMarshalErr(v135v3, h, t, "enc-map-v135-custom")
- testUnmarshalErr(v135v4, bs135, h, t, "dec-map-v135-p-len")
- testDeepEqualErr(v135v3, v135v4, t, "equal-map-v135-p-len")
- }
-
- for _, v := range []map[uint32]int{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v136: %v\n", v)
- var v136v1, v136v2 map[uint32]int
- v136v1 = v
- bs136 := testMarshalErr(v136v1, h, t, "enc-map-v136")
- if v == nil {
- v136v2 = nil
- } else {
- v136v2 = make(map[uint32]int, len(v))
- } // reset map
- testUnmarshalErr(v136v2, bs136, h, t, "dec-map-v136")
- testDeepEqualErr(v136v1, v136v2, t, "equal-map-v136")
- if v == nil {
- v136v2 = nil
- } else {
- v136v2 = make(map[uint32]int, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v136v2), bs136, h, t, "dec-map-v136-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v136v1, v136v2, t, "equal-map-v136-noaddr")
- if v == nil {
- v136v2 = nil
- } else {
- v136v2 = make(map[uint32]int, len(v))
- } // reset map
- testUnmarshalErr(&v136v2, bs136, h, t, "dec-map-v136-p-len")
- testDeepEqualErr(v136v1, v136v2, t, "equal-map-v136-p-len")
- bs136 = testMarshalErr(&v136v1, h, t, "enc-map-v136-p")
- v136v2 = nil
- testUnmarshalErr(&v136v2, bs136, h, t, "dec-map-v136-p-nil")
- testDeepEqualErr(v136v1, v136v2, t, "equal-map-v136-p-nil")
- // ...
- if v == nil {
- v136v2 = nil
- } else {
- v136v2 = make(map[uint32]int, len(v))
- } // reset map
- var v136v3, v136v4 typMapMapUint32Int
- v136v3 = typMapMapUint32Int(v136v1)
- v136v4 = typMapMapUint32Int(v136v2)
- bs136 = testMarshalErr(v136v3, h, t, "enc-map-v136-custom")
- testUnmarshalErr(v136v4, bs136, h, t, "dec-map-v136-p-len")
- testDeepEqualErr(v136v3, v136v4, t, "equal-map-v136-p-len")
- }
-
- for _, v := range []map[uint32]int8{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v137: %v\n", v)
- var v137v1, v137v2 map[uint32]int8
- v137v1 = v
- bs137 := testMarshalErr(v137v1, h, t, "enc-map-v137")
- if v == nil {
- v137v2 = nil
- } else {
- v137v2 = make(map[uint32]int8, len(v))
- } // reset map
- testUnmarshalErr(v137v2, bs137, h, t, "dec-map-v137")
- testDeepEqualErr(v137v1, v137v2, t, "equal-map-v137")
- if v == nil {
- v137v2 = nil
- } else {
- v137v2 = make(map[uint32]int8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v137v2), bs137, h, t, "dec-map-v137-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v137v1, v137v2, t, "equal-map-v137-noaddr")
- if v == nil {
- v137v2 = nil
- } else {
- v137v2 = make(map[uint32]int8, len(v))
- } // reset map
- testUnmarshalErr(&v137v2, bs137, h, t, "dec-map-v137-p-len")
- testDeepEqualErr(v137v1, v137v2, t, "equal-map-v137-p-len")
- bs137 = testMarshalErr(&v137v1, h, t, "enc-map-v137-p")
- v137v2 = nil
- testUnmarshalErr(&v137v2, bs137, h, t, "dec-map-v137-p-nil")
- testDeepEqualErr(v137v1, v137v2, t, "equal-map-v137-p-nil")
- // ...
- if v == nil {
- v137v2 = nil
- } else {
- v137v2 = make(map[uint32]int8, len(v))
- } // reset map
- var v137v3, v137v4 typMapMapUint32Int8
- v137v3 = typMapMapUint32Int8(v137v1)
- v137v4 = typMapMapUint32Int8(v137v2)
- bs137 = testMarshalErr(v137v3, h, t, "enc-map-v137-custom")
- testUnmarshalErr(v137v4, bs137, h, t, "dec-map-v137-p-len")
- testDeepEqualErr(v137v3, v137v4, t, "equal-map-v137-p-len")
- }
-
- for _, v := range []map[uint32]int16{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v138: %v\n", v)
- var v138v1, v138v2 map[uint32]int16
- v138v1 = v
- bs138 := testMarshalErr(v138v1, h, t, "enc-map-v138")
- if v == nil {
- v138v2 = nil
- } else {
- v138v2 = make(map[uint32]int16, len(v))
- } // reset map
- testUnmarshalErr(v138v2, bs138, h, t, "dec-map-v138")
- testDeepEqualErr(v138v1, v138v2, t, "equal-map-v138")
- if v == nil {
- v138v2 = nil
- } else {
- v138v2 = make(map[uint32]int16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v138v2), bs138, h, t, "dec-map-v138-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v138v1, v138v2, t, "equal-map-v138-noaddr")
- if v == nil {
- v138v2 = nil
- } else {
- v138v2 = make(map[uint32]int16, len(v))
- } // reset map
- testUnmarshalErr(&v138v2, bs138, h, t, "dec-map-v138-p-len")
- testDeepEqualErr(v138v1, v138v2, t, "equal-map-v138-p-len")
- bs138 = testMarshalErr(&v138v1, h, t, "enc-map-v138-p")
- v138v2 = nil
- testUnmarshalErr(&v138v2, bs138, h, t, "dec-map-v138-p-nil")
- testDeepEqualErr(v138v1, v138v2, t, "equal-map-v138-p-nil")
- // ...
- if v == nil {
- v138v2 = nil
- } else {
- v138v2 = make(map[uint32]int16, len(v))
- } // reset map
- var v138v3, v138v4 typMapMapUint32Int16
- v138v3 = typMapMapUint32Int16(v138v1)
- v138v4 = typMapMapUint32Int16(v138v2)
- bs138 = testMarshalErr(v138v3, h, t, "enc-map-v138-custom")
- testUnmarshalErr(v138v4, bs138, h, t, "dec-map-v138-p-len")
- testDeepEqualErr(v138v3, v138v4, t, "equal-map-v138-p-len")
- }
-
- for _, v := range []map[uint32]int32{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v139: %v\n", v)
- var v139v1, v139v2 map[uint32]int32
- v139v1 = v
- bs139 := testMarshalErr(v139v1, h, t, "enc-map-v139")
- if v == nil {
- v139v2 = nil
- } else {
- v139v2 = make(map[uint32]int32, len(v))
- } // reset map
- testUnmarshalErr(v139v2, bs139, h, t, "dec-map-v139")
- testDeepEqualErr(v139v1, v139v2, t, "equal-map-v139")
- if v == nil {
- v139v2 = nil
- } else {
- v139v2 = make(map[uint32]int32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v139v2), bs139, h, t, "dec-map-v139-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v139v1, v139v2, t, "equal-map-v139-noaddr")
- if v == nil {
- v139v2 = nil
- } else {
- v139v2 = make(map[uint32]int32, len(v))
- } // reset map
- testUnmarshalErr(&v139v2, bs139, h, t, "dec-map-v139-p-len")
- testDeepEqualErr(v139v1, v139v2, t, "equal-map-v139-p-len")
- bs139 = testMarshalErr(&v139v1, h, t, "enc-map-v139-p")
- v139v2 = nil
- testUnmarshalErr(&v139v2, bs139, h, t, "dec-map-v139-p-nil")
- testDeepEqualErr(v139v1, v139v2, t, "equal-map-v139-p-nil")
- // ...
- if v == nil {
- v139v2 = nil
- } else {
- v139v2 = make(map[uint32]int32, len(v))
- } // reset map
- var v139v3, v139v4 typMapMapUint32Int32
- v139v3 = typMapMapUint32Int32(v139v1)
- v139v4 = typMapMapUint32Int32(v139v2)
- bs139 = testMarshalErr(v139v3, h, t, "enc-map-v139-custom")
- testUnmarshalErr(v139v4, bs139, h, t, "dec-map-v139-p-len")
- testDeepEqualErr(v139v3, v139v4, t, "equal-map-v139-p-len")
- }
-
- for _, v := range []map[uint32]int64{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v140: %v\n", v)
- var v140v1, v140v2 map[uint32]int64
- v140v1 = v
- bs140 := testMarshalErr(v140v1, h, t, "enc-map-v140")
- if v == nil {
- v140v2 = nil
- } else {
- v140v2 = make(map[uint32]int64, len(v))
- } // reset map
- testUnmarshalErr(v140v2, bs140, h, t, "dec-map-v140")
- testDeepEqualErr(v140v1, v140v2, t, "equal-map-v140")
- if v == nil {
- v140v2 = nil
- } else {
- v140v2 = make(map[uint32]int64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v140v2), bs140, h, t, "dec-map-v140-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v140v1, v140v2, t, "equal-map-v140-noaddr")
- if v == nil {
- v140v2 = nil
- } else {
- v140v2 = make(map[uint32]int64, len(v))
- } // reset map
- testUnmarshalErr(&v140v2, bs140, h, t, "dec-map-v140-p-len")
- testDeepEqualErr(v140v1, v140v2, t, "equal-map-v140-p-len")
- bs140 = testMarshalErr(&v140v1, h, t, "enc-map-v140-p")
- v140v2 = nil
- testUnmarshalErr(&v140v2, bs140, h, t, "dec-map-v140-p-nil")
- testDeepEqualErr(v140v1, v140v2, t, "equal-map-v140-p-nil")
- // ...
- if v == nil {
- v140v2 = nil
- } else {
- v140v2 = make(map[uint32]int64, len(v))
- } // reset map
- var v140v3, v140v4 typMapMapUint32Int64
- v140v3 = typMapMapUint32Int64(v140v1)
- v140v4 = typMapMapUint32Int64(v140v2)
- bs140 = testMarshalErr(v140v3, h, t, "enc-map-v140-custom")
- testUnmarshalErr(v140v4, bs140, h, t, "dec-map-v140-p-len")
- testDeepEqualErr(v140v3, v140v4, t, "equal-map-v140-p-len")
- }
-
- for _, v := range []map[uint32]float32{nil, {}, {44: 0, 33: 22.2}} {
- // fmt.Printf(">>>> running mammoth map v141: %v\n", v)
- var v141v1, v141v2 map[uint32]float32
- v141v1 = v
- bs141 := testMarshalErr(v141v1, h, t, "enc-map-v141")
- if v == nil {
- v141v2 = nil
- } else {
- v141v2 = make(map[uint32]float32, len(v))
- } // reset map
- testUnmarshalErr(v141v2, bs141, h, t, "dec-map-v141")
- testDeepEqualErr(v141v1, v141v2, t, "equal-map-v141")
- if v == nil {
- v141v2 = nil
- } else {
- v141v2 = make(map[uint32]float32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v141v2), bs141, h, t, "dec-map-v141-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v141v1, v141v2, t, "equal-map-v141-noaddr")
- if v == nil {
- v141v2 = nil
- } else {
- v141v2 = make(map[uint32]float32, len(v))
- } // reset map
- testUnmarshalErr(&v141v2, bs141, h, t, "dec-map-v141-p-len")
- testDeepEqualErr(v141v1, v141v2, t, "equal-map-v141-p-len")
- bs141 = testMarshalErr(&v141v1, h, t, "enc-map-v141-p")
- v141v2 = nil
- testUnmarshalErr(&v141v2, bs141, h, t, "dec-map-v141-p-nil")
- testDeepEqualErr(v141v1, v141v2, t, "equal-map-v141-p-nil")
- // ...
- if v == nil {
- v141v2 = nil
- } else {
- v141v2 = make(map[uint32]float32, len(v))
- } // reset map
- var v141v3, v141v4 typMapMapUint32Float32
- v141v3 = typMapMapUint32Float32(v141v1)
- v141v4 = typMapMapUint32Float32(v141v2)
- bs141 = testMarshalErr(v141v3, h, t, "enc-map-v141-custom")
- testUnmarshalErr(v141v4, bs141, h, t, "dec-map-v141-p-len")
- testDeepEqualErr(v141v3, v141v4, t, "equal-map-v141-p-len")
- }
-
- for _, v := range []map[uint32]float64{nil, {}, {44: 0, 33: 11.1}} {
- // fmt.Printf(">>>> running mammoth map v142: %v\n", v)
- var v142v1, v142v2 map[uint32]float64
- v142v1 = v
- bs142 := testMarshalErr(v142v1, h, t, "enc-map-v142")
- if v == nil {
- v142v2 = nil
- } else {
- v142v2 = make(map[uint32]float64, len(v))
- } // reset map
- testUnmarshalErr(v142v2, bs142, h, t, "dec-map-v142")
- testDeepEqualErr(v142v1, v142v2, t, "equal-map-v142")
- if v == nil {
- v142v2 = nil
- } else {
- v142v2 = make(map[uint32]float64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v142v2), bs142, h, t, "dec-map-v142-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v142v1, v142v2, t, "equal-map-v142-noaddr")
- if v == nil {
- v142v2 = nil
- } else {
- v142v2 = make(map[uint32]float64, len(v))
- } // reset map
- testUnmarshalErr(&v142v2, bs142, h, t, "dec-map-v142-p-len")
- testDeepEqualErr(v142v1, v142v2, t, "equal-map-v142-p-len")
- bs142 = testMarshalErr(&v142v1, h, t, "enc-map-v142-p")
- v142v2 = nil
- testUnmarshalErr(&v142v2, bs142, h, t, "dec-map-v142-p-nil")
- testDeepEqualErr(v142v1, v142v2, t, "equal-map-v142-p-nil")
- // ...
- if v == nil {
- v142v2 = nil
- } else {
- v142v2 = make(map[uint32]float64, len(v))
- } // reset map
- var v142v3, v142v4 typMapMapUint32Float64
- v142v3 = typMapMapUint32Float64(v142v1)
- v142v4 = typMapMapUint32Float64(v142v2)
- bs142 = testMarshalErr(v142v3, h, t, "enc-map-v142-custom")
- testUnmarshalErr(v142v4, bs142, h, t, "dec-map-v142-p-len")
- testDeepEqualErr(v142v3, v142v4, t, "equal-map-v142-p-len")
- }
-
- for _, v := range []map[uint32]bool{nil, {}, {44: false, 33: true}} {
- // fmt.Printf(">>>> running mammoth map v143: %v\n", v)
- var v143v1, v143v2 map[uint32]bool
- v143v1 = v
- bs143 := testMarshalErr(v143v1, h, t, "enc-map-v143")
- if v == nil {
- v143v2 = nil
- } else {
- v143v2 = make(map[uint32]bool, len(v))
- } // reset map
- testUnmarshalErr(v143v2, bs143, h, t, "dec-map-v143")
- testDeepEqualErr(v143v1, v143v2, t, "equal-map-v143")
- if v == nil {
- v143v2 = nil
- } else {
- v143v2 = make(map[uint32]bool, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v143v2), bs143, h, t, "dec-map-v143-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v143v1, v143v2, t, "equal-map-v143-noaddr")
- if v == nil {
- v143v2 = nil
- } else {
- v143v2 = make(map[uint32]bool, len(v))
- } // reset map
- testUnmarshalErr(&v143v2, bs143, h, t, "dec-map-v143-p-len")
- testDeepEqualErr(v143v1, v143v2, t, "equal-map-v143-p-len")
- bs143 = testMarshalErr(&v143v1, h, t, "enc-map-v143-p")
- v143v2 = nil
- testUnmarshalErr(&v143v2, bs143, h, t, "dec-map-v143-p-nil")
- testDeepEqualErr(v143v1, v143v2, t, "equal-map-v143-p-nil")
- // ...
- if v == nil {
- v143v2 = nil
- } else {
- v143v2 = make(map[uint32]bool, len(v))
- } // reset map
- var v143v3, v143v4 typMapMapUint32Bool
- v143v3 = typMapMapUint32Bool(v143v1)
- v143v4 = typMapMapUint32Bool(v143v2)
- bs143 = testMarshalErr(v143v3, h, t, "enc-map-v143-custom")
- testUnmarshalErr(v143v4, bs143, h, t, "dec-map-v143-p-len")
- testDeepEqualErr(v143v3, v143v4, t, "equal-map-v143-p-len")
- }
-
- for _, v := range []map[uint64]interface{}{nil, {}, {44: nil, 33: "string-is-an-interface-2"}} {
- // fmt.Printf(">>>> running mammoth map v146: %v\n", v)
- var v146v1, v146v2 map[uint64]interface{}
- v146v1 = v
- bs146 := testMarshalErr(v146v1, h, t, "enc-map-v146")
- if v == nil {
- v146v2 = nil
- } else {
- v146v2 = make(map[uint64]interface{}, len(v))
- } // reset map
- testUnmarshalErr(v146v2, bs146, h, t, "dec-map-v146")
- testDeepEqualErr(v146v1, v146v2, t, "equal-map-v146")
- if v == nil {
- v146v2 = nil
- } else {
- v146v2 = make(map[uint64]interface{}, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v146v2), bs146, h, t, "dec-map-v146-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v146v1, v146v2, t, "equal-map-v146-noaddr")
- if v == nil {
- v146v2 = nil
- } else {
- v146v2 = make(map[uint64]interface{}, len(v))
- } // reset map
- testUnmarshalErr(&v146v2, bs146, h, t, "dec-map-v146-p-len")
- testDeepEqualErr(v146v1, v146v2, t, "equal-map-v146-p-len")
- bs146 = testMarshalErr(&v146v1, h, t, "enc-map-v146-p")
- v146v2 = nil
- testUnmarshalErr(&v146v2, bs146, h, t, "dec-map-v146-p-nil")
- testDeepEqualErr(v146v1, v146v2, t, "equal-map-v146-p-nil")
- // ...
- if v == nil {
- v146v2 = nil
- } else {
- v146v2 = make(map[uint64]interface{}, len(v))
- } // reset map
- var v146v3, v146v4 typMapMapUint64Intf
- v146v3 = typMapMapUint64Intf(v146v1)
- v146v4 = typMapMapUint64Intf(v146v2)
- bs146 = testMarshalErr(v146v3, h, t, "enc-map-v146-custom")
- testUnmarshalErr(v146v4, bs146, h, t, "dec-map-v146-p-len")
- testDeepEqualErr(v146v3, v146v4, t, "equal-map-v146-p-len")
- }
-
- for _, v := range []map[uint64]string{nil, {}, {44: "", 33: "some-string-2"}} {
- // fmt.Printf(">>>> running mammoth map v147: %v\n", v)
- var v147v1, v147v2 map[uint64]string
- v147v1 = v
- bs147 := testMarshalErr(v147v1, h, t, "enc-map-v147")
- if v == nil {
- v147v2 = nil
- } else {
- v147v2 = make(map[uint64]string, len(v))
- } // reset map
- testUnmarshalErr(v147v2, bs147, h, t, "dec-map-v147")
- testDeepEqualErr(v147v1, v147v2, t, "equal-map-v147")
- if v == nil {
- v147v2 = nil
- } else {
- v147v2 = make(map[uint64]string, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v147v2), bs147, h, t, "dec-map-v147-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v147v1, v147v2, t, "equal-map-v147-noaddr")
- if v == nil {
- v147v2 = nil
- } else {
- v147v2 = make(map[uint64]string, len(v))
- } // reset map
- testUnmarshalErr(&v147v2, bs147, h, t, "dec-map-v147-p-len")
- testDeepEqualErr(v147v1, v147v2, t, "equal-map-v147-p-len")
- bs147 = testMarshalErr(&v147v1, h, t, "enc-map-v147-p")
- v147v2 = nil
- testUnmarshalErr(&v147v2, bs147, h, t, "dec-map-v147-p-nil")
- testDeepEqualErr(v147v1, v147v2, t, "equal-map-v147-p-nil")
- // ...
- if v == nil {
- v147v2 = nil
- } else {
- v147v2 = make(map[uint64]string, len(v))
- } // reset map
- var v147v3, v147v4 typMapMapUint64String
- v147v3 = typMapMapUint64String(v147v1)
- v147v4 = typMapMapUint64String(v147v2)
- bs147 = testMarshalErr(v147v3, h, t, "enc-map-v147-custom")
- testUnmarshalErr(v147v4, bs147, h, t, "dec-map-v147-p-len")
- testDeepEqualErr(v147v3, v147v4, t, "equal-map-v147-p-len")
- }
-
- for _, v := range []map[uint64]uint{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v148: %v\n", v)
- var v148v1, v148v2 map[uint64]uint
- v148v1 = v
- bs148 := testMarshalErr(v148v1, h, t, "enc-map-v148")
- if v == nil {
- v148v2 = nil
- } else {
- v148v2 = make(map[uint64]uint, len(v))
- } // reset map
- testUnmarshalErr(v148v2, bs148, h, t, "dec-map-v148")
- testDeepEqualErr(v148v1, v148v2, t, "equal-map-v148")
- if v == nil {
- v148v2 = nil
- } else {
- v148v2 = make(map[uint64]uint, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v148v2), bs148, h, t, "dec-map-v148-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v148v1, v148v2, t, "equal-map-v148-noaddr")
- if v == nil {
- v148v2 = nil
- } else {
- v148v2 = make(map[uint64]uint, len(v))
- } // reset map
- testUnmarshalErr(&v148v2, bs148, h, t, "dec-map-v148-p-len")
- testDeepEqualErr(v148v1, v148v2, t, "equal-map-v148-p-len")
- bs148 = testMarshalErr(&v148v1, h, t, "enc-map-v148-p")
- v148v2 = nil
- testUnmarshalErr(&v148v2, bs148, h, t, "dec-map-v148-p-nil")
- testDeepEqualErr(v148v1, v148v2, t, "equal-map-v148-p-nil")
- // ...
- if v == nil {
- v148v2 = nil
- } else {
- v148v2 = make(map[uint64]uint, len(v))
- } // reset map
- var v148v3, v148v4 typMapMapUint64Uint
- v148v3 = typMapMapUint64Uint(v148v1)
- v148v4 = typMapMapUint64Uint(v148v2)
- bs148 = testMarshalErr(v148v3, h, t, "enc-map-v148-custom")
- testUnmarshalErr(v148v4, bs148, h, t, "dec-map-v148-p-len")
- testDeepEqualErr(v148v3, v148v4, t, "equal-map-v148-p-len")
- }
-
- for _, v := range []map[uint64]uint8{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v149: %v\n", v)
- var v149v1, v149v2 map[uint64]uint8
- v149v1 = v
- bs149 := testMarshalErr(v149v1, h, t, "enc-map-v149")
- if v == nil {
- v149v2 = nil
- } else {
- v149v2 = make(map[uint64]uint8, len(v))
- } // reset map
- testUnmarshalErr(v149v2, bs149, h, t, "dec-map-v149")
- testDeepEqualErr(v149v1, v149v2, t, "equal-map-v149")
- if v == nil {
- v149v2 = nil
- } else {
- v149v2 = make(map[uint64]uint8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v149v2), bs149, h, t, "dec-map-v149-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v149v1, v149v2, t, "equal-map-v149-noaddr")
- if v == nil {
- v149v2 = nil
- } else {
- v149v2 = make(map[uint64]uint8, len(v))
- } // reset map
- testUnmarshalErr(&v149v2, bs149, h, t, "dec-map-v149-p-len")
- testDeepEqualErr(v149v1, v149v2, t, "equal-map-v149-p-len")
- bs149 = testMarshalErr(&v149v1, h, t, "enc-map-v149-p")
- v149v2 = nil
- testUnmarshalErr(&v149v2, bs149, h, t, "dec-map-v149-p-nil")
- testDeepEqualErr(v149v1, v149v2, t, "equal-map-v149-p-nil")
- // ...
- if v == nil {
- v149v2 = nil
- } else {
- v149v2 = make(map[uint64]uint8, len(v))
- } // reset map
- var v149v3, v149v4 typMapMapUint64Uint8
- v149v3 = typMapMapUint64Uint8(v149v1)
- v149v4 = typMapMapUint64Uint8(v149v2)
- bs149 = testMarshalErr(v149v3, h, t, "enc-map-v149-custom")
- testUnmarshalErr(v149v4, bs149, h, t, "dec-map-v149-p-len")
- testDeepEqualErr(v149v3, v149v4, t, "equal-map-v149-p-len")
- }
-
- for _, v := range []map[uint64]uint16{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v150: %v\n", v)
- var v150v1, v150v2 map[uint64]uint16
- v150v1 = v
- bs150 := testMarshalErr(v150v1, h, t, "enc-map-v150")
- if v == nil {
- v150v2 = nil
- } else {
- v150v2 = make(map[uint64]uint16, len(v))
- } // reset map
- testUnmarshalErr(v150v2, bs150, h, t, "dec-map-v150")
- testDeepEqualErr(v150v1, v150v2, t, "equal-map-v150")
- if v == nil {
- v150v2 = nil
- } else {
- v150v2 = make(map[uint64]uint16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v150v2), bs150, h, t, "dec-map-v150-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v150v1, v150v2, t, "equal-map-v150-noaddr")
- if v == nil {
- v150v2 = nil
- } else {
- v150v2 = make(map[uint64]uint16, len(v))
- } // reset map
- testUnmarshalErr(&v150v2, bs150, h, t, "dec-map-v150-p-len")
- testDeepEqualErr(v150v1, v150v2, t, "equal-map-v150-p-len")
- bs150 = testMarshalErr(&v150v1, h, t, "enc-map-v150-p")
- v150v2 = nil
- testUnmarshalErr(&v150v2, bs150, h, t, "dec-map-v150-p-nil")
- testDeepEqualErr(v150v1, v150v2, t, "equal-map-v150-p-nil")
- // ...
- if v == nil {
- v150v2 = nil
- } else {
- v150v2 = make(map[uint64]uint16, len(v))
- } // reset map
- var v150v3, v150v4 typMapMapUint64Uint16
- v150v3 = typMapMapUint64Uint16(v150v1)
- v150v4 = typMapMapUint64Uint16(v150v2)
- bs150 = testMarshalErr(v150v3, h, t, "enc-map-v150-custom")
- testUnmarshalErr(v150v4, bs150, h, t, "dec-map-v150-p-len")
- testDeepEqualErr(v150v3, v150v4, t, "equal-map-v150-p-len")
- }
-
- for _, v := range []map[uint64]uint32{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v151: %v\n", v)
- var v151v1, v151v2 map[uint64]uint32
- v151v1 = v
- bs151 := testMarshalErr(v151v1, h, t, "enc-map-v151")
- if v == nil {
- v151v2 = nil
- } else {
- v151v2 = make(map[uint64]uint32, len(v))
- } // reset map
- testUnmarshalErr(v151v2, bs151, h, t, "dec-map-v151")
- testDeepEqualErr(v151v1, v151v2, t, "equal-map-v151")
- if v == nil {
- v151v2 = nil
- } else {
- v151v2 = make(map[uint64]uint32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v151v2), bs151, h, t, "dec-map-v151-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v151v1, v151v2, t, "equal-map-v151-noaddr")
- if v == nil {
- v151v2 = nil
- } else {
- v151v2 = make(map[uint64]uint32, len(v))
- } // reset map
- testUnmarshalErr(&v151v2, bs151, h, t, "dec-map-v151-p-len")
- testDeepEqualErr(v151v1, v151v2, t, "equal-map-v151-p-len")
- bs151 = testMarshalErr(&v151v1, h, t, "enc-map-v151-p")
- v151v2 = nil
- testUnmarshalErr(&v151v2, bs151, h, t, "dec-map-v151-p-nil")
- testDeepEqualErr(v151v1, v151v2, t, "equal-map-v151-p-nil")
- // ...
- if v == nil {
- v151v2 = nil
- } else {
- v151v2 = make(map[uint64]uint32, len(v))
- } // reset map
- var v151v3, v151v4 typMapMapUint64Uint32
- v151v3 = typMapMapUint64Uint32(v151v1)
- v151v4 = typMapMapUint64Uint32(v151v2)
- bs151 = testMarshalErr(v151v3, h, t, "enc-map-v151-custom")
- testUnmarshalErr(v151v4, bs151, h, t, "dec-map-v151-p-len")
- testDeepEqualErr(v151v3, v151v4, t, "equal-map-v151-p-len")
- }
-
- for _, v := range []map[uint64]uint64{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v152: %v\n", v)
- var v152v1, v152v2 map[uint64]uint64
- v152v1 = v
- bs152 := testMarshalErr(v152v1, h, t, "enc-map-v152")
- if v == nil {
- v152v2 = nil
- } else {
- v152v2 = make(map[uint64]uint64, len(v))
- } // reset map
- testUnmarshalErr(v152v2, bs152, h, t, "dec-map-v152")
- testDeepEqualErr(v152v1, v152v2, t, "equal-map-v152")
- if v == nil {
- v152v2 = nil
- } else {
- v152v2 = make(map[uint64]uint64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v152v2), bs152, h, t, "dec-map-v152-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v152v1, v152v2, t, "equal-map-v152-noaddr")
- if v == nil {
- v152v2 = nil
- } else {
- v152v2 = make(map[uint64]uint64, len(v))
- } // reset map
- testUnmarshalErr(&v152v2, bs152, h, t, "dec-map-v152-p-len")
- testDeepEqualErr(v152v1, v152v2, t, "equal-map-v152-p-len")
- bs152 = testMarshalErr(&v152v1, h, t, "enc-map-v152-p")
- v152v2 = nil
- testUnmarshalErr(&v152v2, bs152, h, t, "dec-map-v152-p-nil")
- testDeepEqualErr(v152v1, v152v2, t, "equal-map-v152-p-nil")
- // ...
- if v == nil {
- v152v2 = nil
- } else {
- v152v2 = make(map[uint64]uint64, len(v))
- } // reset map
- var v152v3, v152v4 typMapMapUint64Uint64
- v152v3 = typMapMapUint64Uint64(v152v1)
- v152v4 = typMapMapUint64Uint64(v152v2)
- bs152 = testMarshalErr(v152v3, h, t, "enc-map-v152-custom")
- testUnmarshalErr(v152v4, bs152, h, t, "dec-map-v152-p-len")
- testDeepEqualErr(v152v3, v152v4, t, "equal-map-v152-p-len")
- }
-
- for _, v := range []map[uint64]uintptr{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v153: %v\n", v)
- var v153v1, v153v2 map[uint64]uintptr
- v153v1 = v
- bs153 := testMarshalErr(v153v1, h, t, "enc-map-v153")
- if v == nil {
- v153v2 = nil
- } else {
- v153v2 = make(map[uint64]uintptr, len(v))
- } // reset map
- testUnmarshalErr(v153v2, bs153, h, t, "dec-map-v153")
- testDeepEqualErr(v153v1, v153v2, t, "equal-map-v153")
- if v == nil {
- v153v2 = nil
- } else {
- v153v2 = make(map[uint64]uintptr, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v153v2), bs153, h, t, "dec-map-v153-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v153v1, v153v2, t, "equal-map-v153-noaddr")
- if v == nil {
- v153v2 = nil
- } else {
- v153v2 = make(map[uint64]uintptr, len(v))
- } // reset map
- testUnmarshalErr(&v153v2, bs153, h, t, "dec-map-v153-p-len")
- testDeepEqualErr(v153v1, v153v2, t, "equal-map-v153-p-len")
- bs153 = testMarshalErr(&v153v1, h, t, "enc-map-v153-p")
- v153v2 = nil
- testUnmarshalErr(&v153v2, bs153, h, t, "dec-map-v153-p-nil")
- testDeepEqualErr(v153v1, v153v2, t, "equal-map-v153-p-nil")
- // ...
- if v == nil {
- v153v2 = nil
- } else {
- v153v2 = make(map[uint64]uintptr, len(v))
- } // reset map
- var v153v3, v153v4 typMapMapUint64Uintptr
- v153v3 = typMapMapUint64Uintptr(v153v1)
- v153v4 = typMapMapUint64Uintptr(v153v2)
- bs153 = testMarshalErr(v153v3, h, t, "enc-map-v153-custom")
- testUnmarshalErr(v153v4, bs153, h, t, "dec-map-v153-p-len")
- testDeepEqualErr(v153v3, v153v4, t, "equal-map-v153-p-len")
- }
-
- for _, v := range []map[uint64]int{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v154: %v\n", v)
- var v154v1, v154v2 map[uint64]int
- v154v1 = v
- bs154 := testMarshalErr(v154v1, h, t, "enc-map-v154")
- if v == nil {
- v154v2 = nil
- } else {
- v154v2 = make(map[uint64]int, len(v))
- } // reset map
- testUnmarshalErr(v154v2, bs154, h, t, "dec-map-v154")
- testDeepEqualErr(v154v1, v154v2, t, "equal-map-v154")
- if v == nil {
- v154v2 = nil
- } else {
- v154v2 = make(map[uint64]int, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v154v2), bs154, h, t, "dec-map-v154-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v154v1, v154v2, t, "equal-map-v154-noaddr")
- if v == nil {
- v154v2 = nil
- } else {
- v154v2 = make(map[uint64]int, len(v))
- } // reset map
- testUnmarshalErr(&v154v2, bs154, h, t, "dec-map-v154-p-len")
- testDeepEqualErr(v154v1, v154v2, t, "equal-map-v154-p-len")
- bs154 = testMarshalErr(&v154v1, h, t, "enc-map-v154-p")
- v154v2 = nil
- testUnmarshalErr(&v154v2, bs154, h, t, "dec-map-v154-p-nil")
- testDeepEqualErr(v154v1, v154v2, t, "equal-map-v154-p-nil")
- // ...
- if v == nil {
- v154v2 = nil
- } else {
- v154v2 = make(map[uint64]int, len(v))
- } // reset map
- var v154v3, v154v4 typMapMapUint64Int
- v154v3 = typMapMapUint64Int(v154v1)
- v154v4 = typMapMapUint64Int(v154v2)
- bs154 = testMarshalErr(v154v3, h, t, "enc-map-v154-custom")
- testUnmarshalErr(v154v4, bs154, h, t, "dec-map-v154-p-len")
- testDeepEqualErr(v154v3, v154v4, t, "equal-map-v154-p-len")
- }
-
- for _, v := range []map[uint64]int8{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v155: %v\n", v)
- var v155v1, v155v2 map[uint64]int8
- v155v1 = v
- bs155 := testMarshalErr(v155v1, h, t, "enc-map-v155")
- if v == nil {
- v155v2 = nil
- } else {
- v155v2 = make(map[uint64]int8, len(v))
- } // reset map
- testUnmarshalErr(v155v2, bs155, h, t, "dec-map-v155")
- testDeepEqualErr(v155v1, v155v2, t, "equal-map-v155")
- if v == nil {
- v155v2 = nil
- } else {
- v155v2 = make(map[uint64]int8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v155v2), bs155, h, t, "dec-map-v155-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v155v1, v155v2, t, "equal-map-v155-noaddr")
- if v == nil {
- v155v2 = nil
- } else {
- v155v2 = make(map[uint64]int8, len(v))
- } // reset map
- testUnmarshalErr(&v155v2, bs155, h, t, "dec-map-v155-p-len")
- testDeepEqualErr(v155v1, v155v2, t, "equal-map-v155-p-len")
- bs155 = testMarshalErr(&v155v1, h, t, "enc-map-v155-p")
- v155v2 = nil
- testUnmarshalErr(&v155v2, bs155, h, t, "dec-map-v155-p-nil")
- testDeepEqualErr(v155v1, v155v2, t, "equal-map-v155-p-nil")
- // ...
- if v == nil {
- v155v2 = nil
- } else {
- v155v2 = make(map[uint64]int8, len(v))
- } // reset map
- var v155v3, v155v4 typMapMapUint64Int8
- v155v3 = typMapMapUint64Int8(v155v1)
- v155v4 = typMapMapUint64Int8(v155v2)
- bs155 = testMarshalErr(v155v3, h, t, "enc-map-v155-custom")
- testUnmarshalErr(v155v4, bs155, h, t, "dec-map-v155-p-len")
- testDeepEqualErr(v155v3, v155v4, t, "equal-map-v155-p-len")
- }
-
- for _, v := range []map[uint64]int16{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v156: %v\n", v)
- var v156v1, v156v2 map[uint64]int16
- v156v1 = v
- bs156 := testMarshalErr(v156v1, h, t, "enc-map-v156")
- if v == nil {
- v156v2 = nil
- } else {
- v156v2 = make(map[uint64]int16, len(v))
- } // reset map
- testUnmarshalErr(v156v2, bs156, h, t, "dec-map-v156")
- testDeepEqualErr(v156v1, v156v2, t, "equal-map-v156")
- if v == nil {
- v156v2 = nil
- } else {
- v156v2 = make(map[uint64]int16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v156v2), bs156, h, t, "dec-map-v156-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v156v1, v156v2, t, "equal-map-v156-noaddr")
- if v == nil {
- v156v2 = nil
- } else {
- v156v2 = make(map[uint64]int16, len(v))
- } // reset map
- testUnmarshalErr(&v156v2, bs156, h, t, "dec-map-v156-p-len")
- testDeepEqualErr(v156v1, v156v2, t, "equal-map-v156-p-len")
- bs156 = testMarshalErr(&v156v1, h, t, "enc-map-v156-p")
- v156v2 = nil
- testUnmarshalErr(&v156v2, bs156, h, t, "dec-map-v156-p-nil")
- testDeepEqualErr(v156v1, v156v2, t, "equal-map-v156-p-nil")
- // ...
- if v == nil {
- v156v2 = nil
- } else {
- v156v2 = make(map[uint64]int16, len(v))
- } // reset map
- var v156v3, v156v4 typMapMapUint64Int16
- v156v3 = typMapMapUint64Int16(v156v1)
- v156v4 = typMapMapUint64Int16(v156v2)
- bs156 = testMarshalErr(v156v3, h, t, "enc-map-v156-custom")
- testUnmarshalErr(v156v4, bs156, h, t, "dec-map-v156-p-len")
- testDeepEqualErr(v156v3, v156v4, t, "equal-map-v156-p-len")
- }
-
- for _, v := range []map[uint64]int32{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v157: %v\n", v)
- var v157v1, v157v2 map[uint64]int32
- v157v1 = v
- bs157 := testMarshalErr(v157v1, h, t, "enc-map-v157")
- if v == nil {
- v157v2 = nil
- } else {
- v157v2 = make(map[uint64]int32, len(v))
- } // reset map
- testUnmarshalErr(v157v2, bs157, h, t, "dec-map-v157")
- testDeepEqualErr(v157v1, v157v2, t, "equal-map-v157")
- if v == nil {
- v157v2 = nil
- } else {
- v157v2 = make(map[uint64]int32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v157v2), bs157, h, t, "dec-map-v157-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v157v1, v157v2, t, "equal-map-v157-noaddr")
- if v == nil {
- v157v2 = nil
- } else {
- v157v2 = make(map[uint64]int32, len(v))
- } // reset map
- testUnmarshalErr(&v157v2, bs157, h, t, "dec-map-v157-p-len")
- testDeepEqualErr(v157v1, v157v2, t, "equal-map-v157-p-len")
- bs157 = testMarshalErr(&v157v1, h, t, "enc-map-v157-p")
- v157v2 = nil
- testUnmarshalErr(&v157v2, bs157, h, t, "dec-map-v157-p-nil")
- testDeepEqualErr(v157v1, v157v2, t, "equal-map-v157-p-nil")
- // ...
- if v == nil {
- v157v2 = nil
- } else {
- v157v2 = make(map[uint64]int32, len(v))
- } // reset map
- var v157v3, v157v4 typMapMapUint64Int32
- v157v3 = typMapMapUint64Int32(v157v1)
- v157v4 = typMapMapUint64Int32(v157v2)
- bs157 = testMarshalErr(v157v3, h, t, "enc-map-v157-custom")
- testUnmarshalErr(v157v4, bs157, h, t, "dec-map-v157-p-len")
- testDeepEqualErr(v157v3, v157v4, t, "equal-map-v157-p-len")
- }
-
- for _, v := range []map[uint64]int64{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v158: %v\n", v)
- var v158v1, v158v2 map[uint64]int64
- v158v1 = v
- bs158 := testMarshalErr(v158v1, h, t, "enc-map-v158")
- if v == nil {
- v158v2 = nil
- } else {
- v158v2 = make(map[uint64]int64, len(v))
- } // reset map
- testUnmarshalErr(v158v2, bs158, h, t, "dec-map-v158")
- testDeepEqualErr(v158v1, v158v2, t, "equal-map-v158")
- if v == nil {
- v158v2 = nil
- } else {
- v158v2 = make(map[uint64]int64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v158v2), bs158, h, t, "dec-map-v158-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v158v1, v158v2, t, "equal-map-v158-noaddr")
- if v == nil {
- v158v2 = nil
- } else {
- v158v2 = make(map[uint64]int64, len(v))
- } // reset map
- testUnmarshalErr(&v158v2, bs158, h, t, "dec-map-v158-p-len")
- testDeepEqualErr(v158v1, v158v2, t, "equal-map-v158-p-len")
- bs158 = testMarshalErr(&v158v1, h, t, "enc-map-v158-p")
- v158v2 = nil
- testUnmarshalErr(&v158v2, bs158, h, t, "dec-map-v158-p-nil")
- testDeepEqualErr(v158v1, v158v2, t, "equal-map-v158-p-nil")
- // ...
- if v == nil {
- v158v2 = nil
- } else {
- v158v2 = make(map[uint64]int64, len(v))
- } // reset map
- var v158v3, v158v4 typMapMapUint64Int64
- v158v3 = typMapMapUint64Int64(v158v1)
- v158v4 = typMapMapUint64Int64(v158v2)
- bs158 = testMarshalErr(v158v3, h, t, "enc-map-v158-custom")
- testUnmarshalErr(v158v4, bs158, h, t, "dec-map-v158-p-len")
- testDeepEqualErr(v158v3, v158v4, t, "equal-map-v158-p-len")
- }
-
- for _, v := range []map[uint64]float32{nil, {}, {33: 0, 44: 22.2}} {
- // fmt.Printf(">>>> running mammoth map v159: %v\n", v)
- var v159v1, v159v2 map[uint64]float32
- v159v1 = v
- bs159 := testMarshalErr(v159v1, h, t, "enc-map-v159")
- if v == nil {
- v159v2 = nil
- } else {
- v159v2 = make(map[uint64]float32, len(v))
- } // reset map
- testUnmarshalErr(v159v2, bs159, h, t, "dec-map-v159")
- testDeepEqualErr(v159v1, v159v2, t, "equal-map-v159")
- if v == nil {
- v159v2 = nil
- } else {
- v159v2 = make(map[uint64]float32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v159v2), bs159, h, t, "dec-map-v159-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v159v1, v159v2, t, "equal-map-v159-noaddr")
- if v == nil {
- v159v2 = nil
- } else {
- v159v2 = make(map[uint64]float32, len(v))
- } // reset map
- testUnmarshalErr(&v159v2, bs159, h, t, "dec-map-v159-p-len")
- testDeepEqualErr(v159v1, v159v2, t, "equal-map-v159-p-len")
- bs159 = testMarshalErr(&v159v1, h, t, "enc-map-v159-p")
- v159v2 = nil
- testUnmarshalErr(&v159v2, bs159, h, t, "dec-map-v159-p-nil")
- testDeepEqualErr(v159v1, v159v2, t, "equal-map-v159-p-nil")
- // ...
- if v == nil {
- v159v2 = nil
- } else {
- v159v2 = make(map[uint64]float32, len(v))
- } // reset map
- var v159v3, v159v4 typMapMapUint64Float32
- v159v3 = typMapMapUint64Float32(v159v1)
- v159v4 = typMapMapUint64Float32(v159v2)
- bs159 = testMarshalErr(v159v3, h, t, "enc-map-v159-custom")
- testUnmarshalErr(v159v4, bs159, h, t, "dec-map-v159-p-len")
- testDeepEqualErr(v159v3, v159v4, t, "equal-map-v159-p-len")
- }
-
- for _, v := range []map[uint64]float64{nil, {}, {33: 0, 44: 11.1}} {
- // fmt.Printf(">>>> running mammoth map v160: %v\n", v)
- var v160v1, v160v2 map[uint64]float64
- v160v1 = v
- bs160 := testMarshalErr(v160v1, h, t, "enc-map-v160")
- if v == nil {
- v160v2 = nil
- } else {
- v160v2 = make(map[uint64]float64, len(v))
- } // reset map
- testUnmarshalErr(v160v2, bs160, h, t, "dec-map-v160")
- testDeepEqualErr(v160v1, v160v2, t, "equal-map-v160")
- if v == nil {
- v160v2 = nil
- } else {
- v160v2 = make(map[uint64]float64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v160v2), bs160, h, t, "dec-map-v160-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v160v1, v160v2, t, "equal-map-v160-noaddr")
- if v == nil {
- v160v2 = nil
- } else {
- v160v2 = make(map[uint64]float64, len(v))
- } // reset map
- testUnmarshalErr(&v160v2, bs160, h, t, "dec-map-v160-p-len")
- testDeepEqualErr(v160v1, v160v2, t, "equal-map-v160-p-len")
- bs160 = testMarshalErr(&v160v1, h, t, "enc-map-v160-p")
- v160v2 = nil
- testUnmarshalErr(&v160v2, bs160, h, t, "dec-map-v160-p-nil")
- testDeepEqualErr(v160v1, v160v2, t, "equal-map-v160-p-nil")
- // ...
- if v == nil {
- v160v2 = nil
- } else {
- v160v2 = make(map[uint64]float64, len(v))
- } // reset map
- var v160v3, v160v4 typMapMapUint64Float64
- v160v3 = typMapMapUint64Float64(v160v1)
- v160v4 = typMapMapUint64Float64(v160v2)
- bs160 = testMarshalErr(v160v3, h, t, "enc-map-v160-custom")
- testUnmarshalErr(v160v4, bs160, h, t, "dec-map-v160-p-len")
- testDeepEqualErr(v160v3, v160v4, t, "equal-map-v160-p-len")
- }
-
- for _, v := range []map[uint64]bool{nil, {}, {33: false, 44: true}} {
- // fmt.Printf(">>>> running mammoth map v161: %v\n", v)
- var v161v1, v161v2 map[uint64]bool
- v161v1 = v
- bs161 := testMarshalErr(v161v1, h, t, "enc-map-v161")
- if v == nil {
- v161v2 = nil
- } else {
- v161v2 = make(map[uint64]bool, len(v))
- } // reset map
- testUnmarshalErr(v161v2, bs161, h, t, "dec-map-v161")
- testDeepEqualErr(v161v1, v161v2, t, "equal-map-v161")
- if v == nil {
- v161v2 = nil
- } else {
- v161v2 = make(map[uint64]bool, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v161v2), bs161, h, t, "dec-map-v161-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v161v1, v161v2, t, "equal-map-v161-noaddr")
- if v == nil {
- v161v2 = nil
- } else {
- v161v2 = make(map[uint64]bool, len(v))
- } // reset map
- testUnmarshalErr(&v161v2, bs161, h, t, "dec-map-v161-p-len")
- testDeepEqualErr(v161v1, v161v2, t, "equal-map-v161-p-len")
- bs161 = testMarshalErr(&v161v1, h, t, "enc-map-v161-p")
- v161v2 = nil
- testUnmarshalErr(&v161v2, bs161, h, t, "dec-map-v161-p-nil")
- testDeepEqualErr(v161v1, v161v2, t, "equal-map-v161-p-nil")
- // ...
- if v == nil {
- v161v2 = nil
- } else {
- v161v2 = make(map[uint64]bool, len(v))
- } // reset map
- var v161v3, v161v4 typMapMapUint64Bool
- v161v3 = typMapMapUint64Bool(v161v1)
- v161v4 = typMapMapUint64Bool(v161v2)
- bs161 = testMarshalErr(v161v3, h, t, "enc-map-v161-custom")
- testUnmarshalErr(v161v4, bs161, h, t, "dec-map-v161-p-len")
- testDeepEqualErr(v161v3, v161v4, t, "equal-map-v161-p-len")
- }
-
- for _, v := range []map[uintptr]interface{}{nil, {}, {33: nil, 44: "string-is-an-interface"}} {
- // fmt.Printf(">>>> running mammoth map v164: %v\n", v)
- var v164v1, v164v2 map[uintptr]interface{}
- v164v1 = v
- bs164 := testMarshalErr(v164v1, h, t, "enc-map-v164")
- if v == nil {
- v164v2 = nil
- } else {
- v164v2 = make(map[uintptr]interface{}, len(v))
- } // reset map
- testUnmarshalErr(v164v2, bs164, h, t, "dec-map-v164")
- testDeepEqualErr(v164v1, v164v2, t, "equal-map-v164")
- if v == nil {
- v164v2 = nil
- } else {
- v164v2 = make(map[uintptr]interface{}, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v164v2), bs164, h, t, "dec-map-v164-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v164v1, v164v2, t, "equal-map-v164-noaddr")
- if v == nil {
- v164v2 = nil
- } else {
- v164v2 = make(map[uintptr]interface{}, len(v))
- } // reset map
- testUnmarshalErr(&v164v2, bs164, h, t, "dec-map-v164-p-len")
- testDeepEqualErr(v164v1, v164v2, t, "equal-map-v164-p-len")
- bs164 = testMarshalErr(&v164v1, h, t, "enc-map-v164-p")
- v164v2 = nil
- testUnmarshalErr(&v164v2, bs164, h, t, "dec-map-v164-p-nil")
- testDeepEqualErr(v164v1, v164v2, t, "equal-map-v164-p-nil")
- // ...
- if v == nil {
- v164v2 = nil
- } else {
- v164v2 = make(map[uintptr]interface{}, len(v))
- } // reset map
- var v164v3, v164v4 typMapMapUintptrIntf
- v164v3 = typMapMapUintptrIntf(v164v1)
- v164v4 = typMapMapUintptrIntf(v164v2)
- bs164 = testMarshalErr(v164v3, h, t, "enc-map-v164-custom")
- testUnmarshalErr(v164v4, bs164, h, t, "dec-map-v164-p-len")
- testDeepEqualErr(v164v3, v164v4, t, "equal-map-v164-p-len")
- }
-
- for _, v := range []map[uintptr]string{nil, {}, {33: "", 44: "some-string"}} {
- // fmt.Printf(">>>> running mammoth map v165: %v\n", v)
- var v165v1, v165v2 map[uintptr]string
- v165v1 = v
- bs165 := testMarshalErr(v165v1, h, t, "enc-map-v165")
- if v == nil {
- v165v2 = nil
- } else {
- v165v2 = make(map[uintptr]string, len(v))
- } // reset map
- testUnmarshalErr(v165v2, bs165, h, t, "dec-map-v165")
- testDeepEqualErr(v165v1, v165v2, t, "equal-map-v165")
- if v == nil {
- v165v2 = nil
- } else {
- v165v2 = make(map[uintptr]string, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v165v2), bs165, h, t, "dec-map-v165-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v165v1, v165v2, t, "equal-map-v165-noaddr")
- if v == nil {
- v165v2 = nil
- } else {
- v165v2 = make(map[uintptr]string, len(v))
- } // reset map
- testUnmarshalErr(&v165v2, bs165, h, t, "dec-map-v165-p-len")
- testDeepEqualErr(v165v1, v165v2, t, "equal-map-v165-p-len")
- bs165 = testMarshalErr(&v165v1, h, t, "enc-map-v165-p")
- v165v2 = nil
- testUnmarshalErr(&v165v2, bs165, h, t, "dec-map-v165-p-nil")
- testDeepEqualErr(v165v1, v165v2, t, "equal-map-v165-p-nil")
- // ...
- if v == nil {
- v165v2 = nil
- } else {
- v165v2 = make(map[uintptr]string, len(v))
- } // reset map
- var v165v3, v165v4 typMapMapUintptrString
- v165v3 = typMapMapUintptrString(v165v1)
- v165v4 = typMapMapUintptrString(v165v2)
- bs165 = testMarshalErr(v165v3, h, t, "enc-map-v165-custom")
- testUnmarshalErr(v165v4, bs165, h, t, "dec-map-v165-p-len")
- testDeepEqualErr(v165v3, v165v4, t, "equal-map-v165-p-len")
- }
-
- for _, v := range []map[uintptr]uint{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v166: %v\n", v)
- var v166v1, v166v2 map[uintptr]uint
- v166v1 = v
- bs166 := testMarshalErr(v166v1, h, t, "enc-map-v166")
- if v == nil {
- v166v2 = nil
- } else {
- v166v2 = make(map[uintptr]uint, len(v))
- } // reset map
- testUnmarshalErr(v166v2, bs166, h, t, "dec-map-v166")
- testDeepEqualErr(v166v1, v166v2, t, "equal-map-v166")
- if v == nil {
- v166v2 = nil
- } else {
- v166v2 = make(map[uintptr]uint, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v166v2), bs166, h, t, "dec-map-v166-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v166v1, v166v2, t, "equal-map-v166-noaddr")
- if v == nil {
- v166v2 = nil
- } else {
- v166v2 = make(map[uintptr]uint, len(v))
- } // reset map
- testUnmarshalErr(&v166v2, bs166, h, t, "dec-map-v166-p-len")
- testDeepEqualErr(v166v1, v166v2, t, "equal-map-v166-p-len")
- bs166 = testMarshalErr(&v166v1, h, t, "enc-map-v166-p")
- v166v2 = nil
- testUnmarshalErr(&v166v2, bs166, h, t, "dec-map-v166-p-nil")
- testDeepEqualErr(v166v1, v166v2, t, "equal-map-v166-p-nil")
- // ...
- if v == nil {
- v166v2 = nil
- } else {
- v166v2 = make(map[uintptr]uint, len(v))
- } // reset map
- var v166v3, v166v4 typMapMapUintptrUint
- v166v3 = typMapMapUintptrUint(v166v1)
- v166v4 = typMapMapUintptrUint(v166v2)
- bs166 = testMarshalErr(v166v3, h, t, "enc-map-v166-custom")
- testUnmarshalErr(v166v4, bs166, h, t, "dec-map-v166-p-len")
- testDeepEqualErr(v166v3, v166v4, t, "equal-map-v166-p-len")
- }
-
- for _, v := range []map[uintptr]uint8{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v167: %v\n", v)
- var v167v1, v167v2 map[uintptr]uint8
- v167v1 = v
- bs167 := testMarshalErr(v167v1, h, t, "enc-map-v167")
- if v == nil {
- v167v2 = nil
- } else {
- v167v2 = make(map[uintptr]uint8, len(v))
- } // reset map
- testUnmarshalErr(v167v2, bs167, h, t, "dec-map-v167")
- testDeepEqualErr(v167v1, v167v2, t, "equal-map-v167")
- if v == nil {
- v167v2 = nil
- } else {
- v167v2 = make(map[uintptr]uint8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v167v2), bs167, h, t, "dec-map-v167-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v167v1, v167v2, t, "equal-map-v167-noaddr")
- if v == nil {
- v167v2 = nil
- } else {
- v167v2 = make(map[uintptr]uint8, len(v))
- } // reset map
- testUnmarshalErr(&v167v2, bs167, h, t, "dec-map-v167-p-len")
- testDeepEqualErr(v167v1, v167v2, t, "equal-map-v167-p-len")
- bs167 = testMarshalErr(&v167v1, h, t, "enc-map-v167-p")
- v167v2 = nil
- testUnmarshalErr(&v167v2, bs167, h, t, "dec-map-v167-p-nil")
- testDeepEqualErr(v167v1, v167v2, t, "equal-map-v167-p-nil")
- // ...
- if v == nil {
- v167v2 = nil
- } else {
- v167v2 = make(map[uintptr]uint8, len(v))
- } // reset map
- var v167v3, v167v4 typMapMapUintptrUint8
- v167v3 = typMapMapUintptrUint8(v167v1)
- v167v4 = typMapMapUintptrUint8(v167v2)
- bs167 = testMarshalErr(v167v3, h, t, "enc-map-v167-custom")
- testUnmarshalErr(v167v4, bs167, h, t, "dec-map-v167-p-len")
- testDeepEqualErr(v167v3, v167v4, t, "equal-map-v167-p-len")
- }
-
- for _, v := range []map[uintptr]uint16{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v168: %v\n", v)
- var v168v1, v168v2 map[uintptr]uint16
- v168v1 = v
- bs168 := testMarshalErr(v168v1, h, t, "enc-map-v168")
- if v == nil {
- v168v2 = nil
- } else {
- v168v2 = make(map[uintptr]uint16, len(v))
- } // reset map
- testUnmarshalErr(v168v2, bs168, h, t, "dec-map-v168")
- testDeepEqualErr(v168v1, v168v2, t, "equal-map-v168")
- if v == nil {
- v168v2 = nil
- } else {
- v168v2 = make(map[uintptr]uint16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v168v2), bs168, h, t, "dec-map-v168-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v168v1, v168v2, t, "equal-map-v168-noaddr")
- if v == nil {
- v168v2 = nil
- } else {
- v168v2 = make(map[uintptr]uint16, len(v))
- } // reset map
- testUnmarshalErr(&v168v2, bs168, h, t, "dec-map-v168-p-len")
- testDeepEqualErr(v168v1, v168v2, t, "equal-map-v168-p-len")
- bs168 = testMarshalErr(&v168v1, h, t, "enc-map-v168-p")
- v168v2 = nil
- testUnmarshalErr(&v168v2, bs168, h, t, "dec-map-v168-p-nil")
- testDeepEqualErr(v168v1, v168v2, t, "equal-map-v168-p-nil")
- // ...
- if v == nil {
- v168v2 = nil
- } else {
- v168v2 = make(map[uintptr]uint16, len(v))
- } // reset map
- var v168v3, v168v4 typMapMapUintptrUint16
- v168v3 = typMapMapUintptrUint16(v168v1)
- v168v4 = typMapMapUintptrUint16(v168v2)
- bs168 = testMarshalErr(v168v3, h, t, "enc-map-v168-custom")
- testUnmarshalErr(v168v4, bs168, h, t, "dec-map-v168-p-len")
- testDeepEqualErr(v168v3, v168v4, t, "equal-map-v168-p-len")
- }
-
- for _, v := range []map[uintptr]uint32{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v169: %v\n", v)
- var v169v1, v169v2 map[uintptr]uint32
- v169v1 = v
- bs169 := testMarshalErr(v169v1, h, t, "enc-map-v169")
- if v == nil {
- v169v2 = nil
- } else {
- v169v2 = make(map[uintptr]uint32, len(v))
- } // reset map
- testUnmarshalErr(v169v2, bs169, h, t, "dec-map-v169")
- testDeepEqualErr(v169v1, v169v2, t, "equal-map-v169")
- if v == nil {
- v169v2 = nil
- } else {
- v169v2 = make(map[uintptr]uint32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v169v2), bs169, h, t, "dec-map-v169-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v169v1, v169v2, t, "equal-map-v169-noaddr")
- if v == nil {
- v169v2 = nil
- } else {
- v169v2 = make(map[uintptr]uint32, len(v))
- } // reset map
- testUnmarshalErr(&v169v2, bs169, h, t, "dec-map-v169-p-len")
- testDeepEqualErr(v169v1, v169v2, t, "equal-map-v169-p-len")
- bs169 = testMarshalErr(&v169v1, h, t, "enc-map-v169-p")
- v169v2 = nil
- testUnmarshalErr(&v169v2, bs169, h, t, "dec-map-v169-p-nil")
- testDeepEqualErr(v169v1, v169v2, t, "equal-map-v169-p-nil")
- // ...
- if v == nil {
- v169v2 = nil
- } else {
- v169v2 = make(map[uintptr]uint32, len(v))
- } // reset map
- var v169v3, v169v4 typMapMapUintptrUint32
- v169v3 = typMapMapUintptrUint32(v169v1)
- v169v4 = typMapMapUintptrUint32(v169v2)
- bs169 = testMarshalErr(v169v3, h, t, "enc-map-v169-custom")
- testUnmarshalErr(v169v4, bs169, h, t, "dec-map-v169-p-len")
- testDeepEqualErr(v169v3, v169v4, t, "equal-map-v169-p-len")
- }
-
- for _, v := range []map[uintptr]uint64{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v170: %v\n", v)
- var v170v1, v170v2 map[uintptr]uint64
- v170v1 = v
- bs170 := testMarshalErr(v170v1, h, t, "enc-map-v170")
- if v == nil {
- v170v2 = nil
- } else {
- v170v2 = make(map[uintptr]uint64, len(v))
- } // reset map
- testUnmarshalErr(v170v2, bs170, h, t, "dec-map-v170")
- testDeepEqualErr(v170v1, v170v2, t, "equal-map-v170")
- if v == nil {
- v170v2 = nil
- } else {
- v170v2 = make(map[uintptr]uint64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v170v2), bs170, h, t, "dec-map-v170-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v170v1, v170v2, t, "equal-map-v170-noaddr")
- if v == nil {
- v170v2 = nil
- } else {
- v170v2 = make(map[uintptr]uint64, len(v))
- } // reset map
- testUnmarshalErr(&v170v2, bs170, h, t, "dec-map-v170-p-len")
- testDeepEqualErr(v170v1, v170v2, t, "equal-map-v170-p-len")
- bs170 = testMarshalErr(&v170v1, h, t, "enc-map-v170-p")
- v170v2 = nil
- testUnmarshalErr(&v170v2, bs170, h, t, "dec-map-v170-p-nil")
- testDeepEqualErr(v170v1, v170v2, t, "equal-map-v170-p-nil")
- // ...
- if v == nil {
- v170v2 = nil
- } else {
- v170v2 = make(map[uintptr]uint64, len(v))
- } // reset map
- var v170v3, v170v4 typMapMapUintptrUint64
- v170v3 = typMapMapUintptrUint64(v170v1)
- v170v4 = typMapMapUintptrUint64(v170v2)
- bs170 = testMarshalErr(v170v3, h, t, "enc-map-v170-custom")
- testUnmarshalErr(v170v4, bs170, h, t, "dec-map-v170-p-len")
- testDeepEqualErr(v170v3, v170v4, t, "equal-map-v170-p-len")
- }
-
- for _, v := range []map[uintptr]uintptr{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v171: %v\n", v)
- var v171v1, v171v2 map[uintptr]uintptr
- v171v1 = v
- bs171 := testMarshalErr(v171v1, h, t, "enc-map-v171")
- if v == nil {
- v171v2 = nil
- } else {
- v171v2 = make(map[uintptr]uintptr, len(v))
- } // reset map
- testUnmarshalErr(v171v2, bs171, h, t, "dec-map-v171")
- testDeepEqualErr(v171v1, v171v2, t, "equal-map-v171")
- if v == nil {
- v171v2 = nil
- } else {
- v171v2 = make(map[uintptr]uintptr, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v171v2), bs171, h, t, "dec-map-v171-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v171v1, v171v2, t, "equal-map-v171-noaddr")
- if v == nil {
- v171v2 = nil
- } else {
- v171v2 = make(map[uintptr]uintptr, len(v))
- } // reset map
- testUnmarshalErr(&v171v2, bs171, h, t, "dec-map-v171-p-len")
- testDeepEqualErr(v171v1, v171v2, t, "equal-map-v171-p-len")
- bs171 = testMarshalErr(&v171v1, h, t, "enc-map-v171-p")
- v171v2 = nil
- testUnmarshalErr(&v171v2, bs171, h, t, "dec-map-v171-p-nil")
- testDeepEqualErr(v171v1, v171v2, t, "equal-map-v171-p-nil")
- // ...
- if v == nil {
- v171v2 = nil
- } else {
- v171v2 = make(map[uintptr]uintptr, len(v))
- } // reset map
- var v171v3, v171v4 typMapMapUintptrUintptr
- v171v3 = typMapMapUintptrUintptr(v171v1)
- v171v4 = typMapMapUintptrUintptr(v171v2)
- bs171 = testMarshalErr(v171v3, h, t, "enc-map-v171-custom")
- testUnmarshalErr(v171v4, bs171, h, t, "dec-map-v171-p-len")
- testDeepEqualErr(v171v3, v171v4, t, "equal-map-v171-p-len")
- }
-
- for _, v := range []map[uintptr]int{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v172: %v\n", v)
- var v172v1, v172v2 map[uintptr]int
- v172v1 = v
- bs172 := testMarshalErr(v172v1, h, t, "enc-map-v172")
- if v == nil {
- v172v2 = nil
- } else {
- v172v2 = make(map[uintptr]int, len(v))
- } // reset map
- testUnmarshalErr(v172v2, bs172, h, t, "dec-map-v172")
- testDeepEqualErr(v172v1, v172v2, t, "equal-map-v172")
- if v == nil {
- v172v2 = nil
- } else {
- v172v2 = make(map[uintptr]int, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v172v2), bs172, h, t, "dec-map-v172-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v172v1, v172v2, t, "equal-map-v172-noaddr")
- if v == nil {
- v172v2 = nil
- } else {
- v172v2 = make(map[uintptr]int, len(v))
- } // reset map
- testUnmarshalErr(&v172v2, bs172, h, t, "dec-map-v172-p-len")
- testDeepEqualErr(v172v1, v172v2, t, "equal-map-v172-p-len")
- bs172 = testMarshalErr(&v172v1, h, t, "enc-map-v172-p")
- v172v2 = nil
- testUnmarshalErr(&v172v2, bs172, h, t, "dec-map-v172-p-nil")
- testDeepEqualErr(v172v1, v172v2, t, "equal-map-v172-p-nil")
- // ...
- if v == nil {
- v172v2 = nil
- } else {
- v172v2 = make(map[uintptr]int, len(v))
- } // reset map
- var v172v3, v172v4 typMapMapUintptrInt
- v172v3 = typMapMapUintptrInt(v172v1)
- v172v4 = typMapMapUintptrInt(v172v2)
- bs172 = testMarshalErr(v172v3, h, t, "enc-map-v172-custom")
- testUnmarshalErr(v172v4, bs172, h, t, "dec-map-v172-p-len")
- testDeepEqualErr(v172v3, v172v4, t, "equal-map-v172-p-len")
- }
-
- for _, v := range []map[uintptr]int8{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v173: %v\n", v)
- var v173v1, v173v2 map[uintptr]int8
- v173v1 = v
- bs173 := testMarshalErr(v173v1, h, t, "enc-map-v173")
- if v == nil {
- v173v2 = nil
- } else {
- v173v2 = make(map[uintptr]int8, len(v))
- } // reset map
- testUnmarshalErr(v173v2, bs173, h, t, "dec-map-v173")
- testDeepEqualErr(v173v1, v173v2, t, "equal-map-v173")
- if v == nil {
- v173v2 = nil
- } else {
- v173v2 = make(map[uintptr]int8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v173v2), bs173, h, t, "dec-map-v173-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v173v1, v173v2, t, "equal-map-v173-noaddr")
- if v == nil {
- v173v2 = nil
- } else {
- v173v2 = make(map[uintptr]int8, len(v))
- } // reset map
- testUnmarshalErr(&v173v2, bs173, h, t, "dec-map-v173-p-len")
- testDeepEqualErr(v173v1, v173v2, t, "equal-map-v173-p-len")
- bs173 = testMarshalErr(&v173v1, h, t, "enc-map-v173-p")
- v173v2 = nil
- testUnmarshalErr(&v173v2, bs173, h, t, "dec-map-v173-p-nil")
- testDeepEqualErr(v173v1, v173v2, t, "equal-map-v173-p-nil")
- // ...
- if v == nil {
- v173v2 = nil
- } else {
- v173v2 = make(map[uintptr]int8, len(v))
- } // reset map
- var v173v3, v173v4 typMapMapUintptrInt8
- v173v3 = typMapMapUintptrInt8(v173v1)
- v173v4 = typMapMapUintptrInt8(v173v2)
- bs173 = testMarshalErr(v173v3, h, t, "enc-map-v173-custom")
- testUnmarshalErr(v173v4, bs173, h, t, "dec-map-v173-p-len")
- testDeepEqualErr(v173v3, v173v4, t, "equal-map-v173-p-len")
- }
-
- for _, v := range []map[uintptr]int16{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v174: %v\n", v)
- var v174v1, v174v2 map[uintptr]int16
- v174v1 = v
- bs174 := testMarshalErr(v174v1, h, t, "enc-map-v174")
- if v == nil {
- v174v2 = nil
- } else {
- v174v2 = make(map[uintptr]int16, len(v))
- } // reset map
- testUnmarshalErr(v174v2, bs174, h, t, "dec-map-v174")
- testDeepEqualErr(v174v1, v174v2, t, "equal-map-v174")
- if v == nil {
- v174v2 = nil
- } else {
- v174v2 = make(map[uintptr]int16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v174v2), bs174, h, t, "dec-map-v174-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v174v1, v174v2, t, "equal-map-v174-noaddr")
- if v == nil {
- v174v2 = nil
- } else {
- v174v2 = make(map[uintptr]int16, len(v))
- } // reset map
- testUnmarshalErr(&v174v2, bs174, h, t, "dec-map-v174-p-len")
- testDeepEqualErr(v174v1, v174v2, t, "equal-map-v174-p-len")
- bs174 = testMarshalErr(&v174v1, h, t, "enc-map-v174-p")
- v174v2 = nil
- testUnmarshalErr(&v174v2, bs174, h, t, "dec-map-v174-p-nil")
- testDeepEqualErr(v174v1, v174v2, t, "equal-map-v174-p-nil")
- // ...
- if v == nil {
- v174v2 = nil
- } else {
- v174v2 = make(map[uintptr]int16, len(v))
- } // reset map
- var v174v3, v174v4 typMapMapUintptrInt16
- v174v3 = typMapMapUintptrInt16(v174v1)
- v174v4 = typMapMapUintptrInt16(v174v2)
- bs174 = testMarshalErr(v174v3, h, t, "enc-map-v174-custom")
- testUnmarshalErr(v174v4, bs174, h, t, "dec-map-v174-p-len")
- testDeepEqualErr(v174v3, v174v4, t, "equal-map-v174-p-len")
- }
-
- for _, v := range []map[uintptr]int32{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v175: %v\n", v)
- var v175v1, v175v2 map[uintptr]int32
- v175v1 = v
- bs175 := testMarshalErr(v175v1, h, t, "enc-map-v175")
- if v == nil {
- v175v2 = nil
- } else {
- v175v2 = make(map[uintptr]int32, len(v))
- } // reset map
- testUnmarshalErr(v175v2, bs175, h, t, "dec-map-v175")
- testDeepEqualErr(v175v1, v175v2, t, "equal-map-v175")
- if v == nil {
- v175v2 = nil
- } else {
- v175v2 = make(map[uintptr]int32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v175v2), bs175, h, t, "dec-map-v175-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v175v1, v175v2, t, "equal-map-v175-noaddr")
- if v == nil {
- v175v2 = nil
- } else {
- v175v2 = make(map[uintptr]int32, len(v))
- } // reset map
- testUnmarshalErr(&v175v2, bs175, h, t, "dec-map-v175-p-len")
- testDeepEqualErr(v175v1, v175v2, t, "equal-map-v175-p-len")
- bs175 = testMarshalErr(&v175v1, h, t, "enc-map-v175-p")
- v175v2 = nil
- testUnmarshalErr(&v175v2, bs175, h, t, "dec-map-v175-p-nil")
- testDeepEqualErr(v175v1, v175v2, t, "equal-map-v175-p-nil")
- // ...
- if v == nil {
- v175v2 = nil
- } else {
- v175v2 = make(map[uintptr]int32, len(v))
- } // reset map
- var v175v3, v175v4 typMapMapUintptrInt32
- v175v3 = typMapMapUintptrInt32(v175v1)
- v175v4 = typMapMapUintptrInt32(v175v2)
- bs175 = testMarshalErr(v175v3, h, t, "enc-map-v175-custom")
- testUnmarshalErr(v175v4, bs175, h, t, "dec-map-v175-p-len")
- testDeepEqualErr(v175v3, v175v4, t, "equal-map-v175-p-len")
- }
-
- for _, v := range []map[uintptr]int64{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v176: %v\n", v)
- var v176v1, v176v2 map[uintptr]int64
- v176v1 = v
- bs176 := testMarshalErr(v176v1, h, t, "enc-map-v176")
- if v == nil {
- v176v2 = nil
- } else {
- v176v2 = make(map[uintptr]int64, len(v))
- } // reset map
- testUnmarshalErr(v176v2, bs176, h, t, "dec-map-v176")
- testDeepEqualErr(v176v1, v176v2, t, "equal-map-v176")
- if v == nil {
- v176v2 = nil
- } else {
- v176v2 = make(map[uintptr]int64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v176v2), bs176, h, t, "dec-map-v176-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v176v1, v176v2, t, "equal-map-v176-noaddr")
- if v == nil {
- v176v2 = nil
- } else {
- v176v2 = make(map[uintptr]int64, len(v))
- } // reset map
- testUnmarshalErr(&v176v2, bs176, h, t, "dec-map-v176-p-len")
- testDeepEqualErr(v176v1, v176v2, t, "equal-map-v176-p-len")
- bs176 = testMarshalErr(&v176v1, h, t, "enc-map-v176-p")
- v176v2 = nil
- testUnmarshalErr(&v176v2, bs176, h, t, "dec-map-v176-p-nil")
- testDeepEqualErr(v176v1, v176v2, t, "equal-map-v176-p-nil")
- // ...
- if v == nil {
- v176v2 = nil
- } else {
- v176v2 = make(map[uintptr]int64, len(v))
- } // reset map
- var v176v3, v176v4 typMapMapUintptrInt64
- v176v3 = typMapMapUintptrInt64(v176v1)
- v176v4 = typMapMapUintptrInt64(v176v2)
- bs176 = testMarshalErr(v176v3, h, t, "enc-map-v176-custom")
- testUnmarshalErr(v176v4, bs176, h, t, "dec-map-v176-p-len")
- testDeepEqualErr(v176v3, v176v4, t, "equal-map-v176-p-len")
- }
-
- for _, v := range []map[uintptr]float32{nil, {}, {44: 0, 33: 22.2}} {
- // fmt.Printf(">>>> running mammoth map v177: %v\n", v)
- var v177v1, v177v2 map[uintptr]float32
- v177v1 = v
- bs177 := testMarshalErr(v177v1, h, t, "enc-map-v177")
- if v == nil {
- v177v2 = nil
- } else {
- v177v2 = make(map[uintptr]float32, len(v))
- } // reset map
- testUnmarshalErr(v177v2, bs177, h, t, "dec-map-v177")
- testDeepEqualErr(v177v1, v177v2, t, "equal-map-v177")
- if v == nil {
- v177v2 = nil
- } else {
- v177v2 = make(map[uintptr]float32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v177v2), bs177, h, t, "dec-map-v177-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v177v1, v177v2, t, "equal-map-v177-noaddr")
- if v == nil {
- v177v2 = nil
- } else {
- v177v2 = make(map[uintptr]float32, len(v))
- } // reset map
- testUnmarshalErr(&v177v2, bs177, h, t, "dec-map-v177-p-len")
- testDeepEqualErr(v177v1, v177v2, t, "equal-map-v177-p-len")
- bs177 = testMarshalErr(&v177v1, h, t, "enc-map-v177-p")
- v177v2 = nil
- testUnmarshalErr(&v177v2, bs177, h, t, "dec-map-v177-p-nil")
- testDeepEqualErr(v177v1, v177v2, t, "equal-map-v177-p-nil")
- // ...
- if v == nil {
- v177v2 = nil
- } else {
- v177v2 = make(map[uintptr]float32, len(v))
- } // reset map
- var v177v3, v177v4 typMapMapUintptrFloat32
- v177v3 = typMapMapUintptrFloat32(v177v1)
- v177v4 = typMapMapUintptrFloat32(v177v2)
- bs177 = testMarshalErr(v177v3, h, t, "enc-map-v177-custom")
- testUnmarshalErr(v177v4, bs177, h, t, "dec-map-v177-p-len")
- testDeepEqualErr(v177v3, v177v4, t, "equal-map-v177-p-len")
- }
-
- for _, v := range []map[uintptr]float64{nil, {}, {44: 0, 33: 11.1}} {
- // fmt.Printf(">>>> running mammoth map v178: %v\n", v)
- var v178v1, v178v2 map[uintptr]float64
- v178v1 = v
- bs178 := testMarshalErr(v178v1, h, t, "enc-map-v178")
- if v == nil {
- v178v2 = nil
- } else {
- v178v2 = make(map[uintptr]float64, len(v))
- } // reset map
- testUnmarshalErr(v178v2, bs178, h, t, "dec-map-v178")
- testDeepEqualErr(v178v1, v178v2, t, "equal-map-v178")
- if v == nil {
- v178v2 = nil
- } else {
- v178v2 = make(map[uintptr]float64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v178v2), bs178, h, t, "dec-map-v178-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v178v1, v178v2, t, "equal-map-v178-noaddr")
- if v == nil {
- v178v2 = nil
- } else {
- v178v2 = make(map[uintptr]float64, len(v))
- } // reset map
- testUnmarshalErr(&v178v2, bs178, h, t, "dec-map-v178-p-len")
- testDeepEqualErr(v178v1, v178v2, t, "equal-map-v178-p-len")
- bs178 = testMarshalErr(&v178v1, h, t, "enc-map-v178-p")
- v178v2 = nil
- testUnmarshalErr(&v178v2, bs178, h, t, "dec-map-v178-p-nil")
- testDeepEqualErr(v178v1, v178v2, t, "equal-map-v178-p-nil")
- // ...
- if v == nil {
- v178v2 = nil
- } else {
- v178v2 = make(map[uintptr]float64, len(v))
- } // reset map
- var v178v3, v178v4 typMapMapUintptrFloat64
- v178v3 = typMapMapUintptrFloat64(v178v1)
- v178v4 = typMapMapUintptrFloat64(v178v2)
- bs178 = testMarshalErr(v178v3, h, t, "enc-map-v178-custom")
- testUnmarshalErr(v178v4, bs178, h, t, "dec-map-v178-p-len")
- testDeepEqualErr(v178v3, v178v4, t, "equal-map-v178-p-len")
- }
-
- for _, v := range []map[uintptr]bool{nil, {}, {44: false, 33: true}} {
- // fmt.Printf(">>>> running mammoth map v179: %v\n", v)
- var v179v1, v179v2 map[uintptr]bool
- v179v1 = v
- bs179 := testMarshalErr(v179v1, h, t, "enc-map-v179")
- if v == nil {
- v179v2 = nil
- } else {
- v179v2 = make(map[uintptr]bool, len(v))
- } // reset map
- testUnmarshalErr(v179v2, bs179, h, t, "dec-map-v179")
- testDeepEqualErr(v179v1, v179v2, t, "equal-map-v179")
- if v == nil {
- v179v2 = nil
- } else {
- v179v2 = make(map[uintptr]bool, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v179v2), bs179, h, t, "dec-map-v179-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v179v1, v179v2, t, "equal-map-v179-noaddr")
- if v == nil {
- v179v2 = nil
- } else {
- v179v2 = make(map[uintptr]bool, len(v))
- } // reset map
- testUnmarshalErr(&v179v2, bs179, h, t, "dec-map-v179-p-len")
- testDeepEqualErr(v179v1, v179v2, t, "equal-map-v179-p-len")
- bs179 = testMarshalErr(&v179v1, h, t, "enc-map-v179-p")
- v179v2 = nil
- testUnmarshalErr(&v179v2, bs179, h, t, "dec-map-v179-p-nil")
- testDeepEqualErr(v179v1, v179v2, t, "equal-map-v179-p-nil")
- // ...
- if v == nil {
- v179v2 = nil
- } else {
- v179v2 = make(map[uintptr]bool, len(v))
- } // reset map
- var v179v3, v179v4 typMapMapUintptrBool
- v179v3 = typMapMapUintptrBool(v179v1)
- v179v4 = typMapMapUintptrBool(v179v2)
- bs179 = testMarshalErr(v179v3, h, t, "enc-map-v179-custom")
- testUnmarshalErr(v179v4, bs179, h, t, "dec-map-v179-p-len")
- testDeepEqualErr(v179v3, v179v4, t, "equal-map-v179-p-len")
- }
-
- for _, v := range []map[int]interface{}{nil, {}, {44: nil, 33: "string-is-an-interface-2"}} {
- // fmt.Printf(">>>> running mammoth map v182: %v\n", v)
- var v182v1, v182v2 map[int]interface{}
- v182v1 = v
- bs182 := testMarshalErr(v182v1, h, t, "enc-map-v182")
- if v == nil {
- v182v2 = nil
- } else {
- v182v2 = make(map[int]interface{}, len(v))
- } // reset map
- testUnmarshalErr(v182v2, bs182, h, t, "dec-map-v182")
- testDeepEqualErr(v182v1, v182v2, t, "equal-map-v182")
- if v == nil {
- v182v2 = nil
- } else {
- v182v2 = make(map[int]interface{}, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v182v2), bs182, h, t, "dec-map-v182-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v182v1, v182v2, t, "equal-map-v182-noaddr")
- if v == nil {
- v182v2 = nil
- } else {
- v182v2 = make(map[int]interface{}, len(v))
- } // reset map
- testUnmarshalErr(&v182v2, bs182, h, t, "dec-map-v182-p-len")
- testDeepEqualErr(v182v1, v182v2, t, "equal-map-v182-p-len")
- bs182 = testMarshalErr(&v182v1, h, t, "enc-map-v182-p")
- v182v2 = nil
- testUnmarshalErr(&v182v2, bs182, h, t, "dec-map-v182-p-nil")
- testDeepEqualErr(v182v1, v182v2, t, "equal-map-v182-p-nil")
- // ...
- if v == nil {
- v182v2 = nil
- } else {
- v182v2 = make(map[int]interface{}, len(v))
- } // reset map
- var v182v3, v182v4 typMapMapIntIntf
- v182v3 = typMapMapIntIntf(v182v1)
- v182v4 = typMapMapIntIntf(v182v2)
- bs182 = testMarshalErr(v182v3, h, t, "enc-map-v182-custom")
- testUnmarshalErr(v182v4, bs182, h, t, "dec-map-v182-p-len")
- testDeepEqualErr(v182v3, v182v4, t, "equal-map-v182-p-len")
- }
-
- for _, v := range []map[int]string{nil, {}, {44: "", 33: "some-string-2"}} {
- // fmt.Printf(">>>> running mammoth map v183: %v\n", v)
- var v183v1, v183v2 map[int]string
- v183v1 = v
- bs183 := testMarshalErr(v183v1, h, t, "enc-map-v183")
- if v == nil {
- v183v2 = nil
- } else {
- v183v2 = make(map[int]string, len(v))
- } // reset map
- testUnmarshalErr(v183v2, bs183, h, t, "dec-map-v183")
- testDeepEqualErr(v183v1, v183v2, t, "equal-map-v183")
- if v == nil {
- v183v2 = nil
- } else {
- v183v2 = make(map[int]string, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v183v2), bs183, h, t, "dec-map-v183-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v183v1, v183v2, t, "equal-map-v183-noaddr")
- if v == nil {
- v183v2 = nil
- } else {
- v183v2 = make(map[int]string, len(v))
- } // reset map
- testUnmarshalErr(&v183v2, bs183, h, t, "dec-map-v183-p-len")
- testDeepEqualErr(v183v1, v183v2, t, "equal-map-v183-p-len")
- bs183 = testMarshalErr(&v183v1, h, t, "enc-map-v183-p")
- v183v2 = nil
- testUnmarshalErr(&v183v2, bs183, h, t, "dec-map-v183-p-nil")
- testDeepEqualErr(v183v1, v183v2, t, "equal-map-v183-p-nil")
- // ...
- if v == nil {
- v183v2 = nil
- } else {
- v183v2 = make(map[int]string, len(v))
- } // reset map
- var v183v3, v183v4 typMapMapIntString
- v183v3 = typMapMapIntString(v183v1)
- v183v4 = typMapMapIntString(v183v2)
- bs183 = testMarshalErr(v183v3, h, t, "enc-map-v183-custom")
- testUnmarshalErr(v183v4, bs183, h, t, "dec-map-v183-p-len")
- testDeepEqualErr(v183v3, v183v4, t, "equal-map-v183-p-len")
- }
-
- for _, v := range []map[int]uint{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v184: %v\n", v)
- var v184v1, v184v2 map[int]uint
- v184v1 = v
- bs184 := testMarshalErr(v184v1, h, t, "enc-map-v184")
- if v == nil {
- v184v2 = nil
- } else {
- v184v2 = make(map[int]uint, len(v))
- } // reset map
- testUnmarshalErr(v184v2, bs184, h, t, "dec-map-v184")
- testDeepEqualErr(v184v1, v184v2, t, "equal-map-v184")
- if v == nil {
- v184v2 = nil
- } else {
- v184v2 = make(map[int]uint, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v184v2), bs184, h, t, "dec-map-v184-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v184v1, v184v2, t, "equal-map-v184-noaddr")
- if v == nil {
- v184v2 = nil
- } else {
- v184v2 = make(map[int]uint, len(v))
- } // reset map
- testUnmarshalErr(&v184v2, bs184, h, t, "dec-map-v184-p-len")
- testDeepEqualErr(v184v1, v184v2, t, "equal-map-v184-p-len")
- bs184 = testMarshalErr(&v184v1, h, t, "enc-map-v184-p")
- v184v2 = nil
- testUnmarshalErr(&v184v2, bs184, h, t, "dec-map-v184-p-nil")
- testDeepEqualErr(v184v1, v184v2, t, "equal-map-v184-p-nil")
- // ...
- if v == nil {
- v184v2 = nil
- } else {
- v184v2 = make(map[int]uint, len(v))
- } // reset map
- var v184v3, v184v4 typMapMapIntUint
- v184v3 = typMapMapIntUint(v184v1)
- v184v4 = typMapMapIntUint(v184v2)
- bs184 = testMarshalErr(v184v3, h, t, "enc-map-v184-custom")
- testUnmarshalErr(v184v4, bs184, h, t, "dec-map-v184-p-len")
- testDeepEqualErr(v184v3, v184v4, t, "equal-map-v184-p-len")
- }
-
- for _, v := range []map[int]uint8{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v185: %v\n", v)
- var v185v1, v185v2 map[int]uint8
- v185v1 = v
- bs185 := testMarshalErr(v185v1, h, t, "enc-map-v185")
- if v == nil {
- v185v2 = nil
- } else {
- v185v2 = make(map[int]uint8, len(v))
- } // reset map
- testUnmarshalErr(v185v2, bs185, h, t, "dec-map-v185")
- testDeepEqualErr(v185v1, v185v2, t, "equal-map-v185")
- if v == nil {
- v185v2 = nil
- } else {
- v185v2 = make(map[int]uint8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v185v2), bs185, h, t, "dec-map-v185-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v185v1, v185v2, t, "equal-map-v185-noaddr")
- if v == nil {
- v185v2 = nil
- } else {
- v185v2 = make(map[int]uint8, len(v))
- } // reset map
- testUnmarshalErr(&v185v2, bs185, h, t, "dec-map-v185-p-len")
- testDeepEqualErr(v185v1, v185v2, t, "equal-map-v185-p-len")
- bs185 = testMarshalErr(&v185v1, h, t, "enc-map-v185-p")
- v185v2 = nil
- testUnmarshalErr(&v185v2, bs185, h, t, "dec-map-v185-p-nil")
- testDeepEqualErr(v185v1, v185v2, t, "equal-map-v185-p-nil")
- // ...
- if v == nil {
- v185v2 = nil
- } else {
- v185v2 = make(map[int]uint8, len(v))
- } // reset map
- var v185v3, v185v4 typMapMapIntUint8
- v185v3 = typMapMapIntUint8(v185v1)
- v185v4 = typMapMapIntUint8(v185v2)
- bs185 = testMarshalErr(v185v3, h, t, "enc-map-v185-custom")
- testUnmarshalErr(v185v4, bs185, h, t, "dec-map-v185-p-len")
- testDeepEqualErr(v185v3, v185v4, t, "equal-map-v185-p-len")
- }
-
- for _, v := range []map[int]uint16{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v186: %v\n", v)
- var v186v1, v186v2 map[int]uint16
- v186v1 = v
- bs186 := testMarshalErr(v186v1, h, t, "enc-map-v186")
- if v == nil {
- v186v2 = nil
- } else {
- v186v2 = make(map[int]uint16, len(v))
- } // reset map
- testUnmarshalErr(v186v2, bs186, h, t, "dec-map-v186")
- testDeepEqualErr(v186v1, v186v2, t, "equal-map-v186")
- if v == nil {
- v186v2 = nil
- } else {
- v186v2 = make(map[int]uint16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v186v2), bs186, h, t, "dec-map-v186-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v186v1, v186v2, t, "equal-map-v186-noaddr")
- if v == nil {
- v186v2 = nil
- } else {
- v186v2 = make(map[int]uint16, len(v))
- } // reset map
- testUnmarshalErr(&v186v2, bs186, h, t, "dec-map-v186-p-len")
- testDeepEqualErr(v186v1, v186v2, t, "equal-map-v186-p-len")
- bs186 = testMarshalErr(&v186v1, h, t, "enc-map-v186-p")
- v186v2 = nil
- testUnmarshalErr(&v186v2, bs186, h, t, "dec-map-v186-p-nil")
- testDeepEqualErr(v186v1, v186v2, t, "equal-map-v186-p-nil")
- // ...
- if v == nil {
- v186v2 = nil
- } else {
- v186v2 = make(map[int]uint16, len(v))
- } // reset map
- var v186v3, v186v4 typMapMapIntUint16
- v186v3 = typMapMapIntUint16(v186v1)
- v186v4 = typMapMapIntUint16(v186v2)
- bs186 = testMarshalErr(v186v3, h, t, "enc-map-v186-custom")
- testUnmarshalErr(v186v4, bs186, h, t, "dec-map-v186-p-len")
- testDeepEqualErr(v186v3, v186v4, t, "equal-map-v186-p-len")
- }
-
- for _, v := range []map[int]uint32{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v187: %v\n", v)
- var v187v1, v187v2 map[int]uint32
- v187v1 = v
- bs187 := testMarshalErr(v187v1, h, t, "enc-map-v187")
- if v == nil {
- v187v2 = nil
- } else {
- v187v2 = make(map[int]uint32, len(v))
- } // reset map
- testUnmarshalErr(v187v2, bs187, h, t, "dec-map-v187")
- testDeepEqualErr(v187v1, v187v2, t, "equal-map-v187")
- if v == nil {
- v187v2 = nil
- } else {
- v187v2 = make(map[int]uint32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v187v2), bs187, h, t, "dec-map-v187-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v187v1, v187v2, t, "equal-map-v187-noaddr")
- if v == nil {
- v187v2 = nil
- } else {
- v187v2 = make(map[int]uint32, len(v))
- } // reset map
- testUnmarshalErr(&v187v2, bs187, h, t, "dec-map-v187-p-len")
- testDeepEqualErr(v187v1, v187v2, t, "equal-map-v187-p-len")
- bs187 = testMarshalErr(&v187v1, h, t, "enc-map-v187-p")
- v187v2 = nil
- testUnmarshalErr(&v187v2, bs187, h, t, "dec-map-v187-p-nil")
- testDeepEqualErr(v187v1, v187v2, t, "equal-map-v187-p-nil")
- // ...
- if v == nil {
- v187v2 = nil
- } else {
- v187v2 = make(map[int]uint32, len(v))
- } // reset map
- var v187v3, v187v4 typMapMapIntUint32
- v187v3 = typMapMapIntUint32(v187v1)
- v187v4 = typMapMapIntUint32(v187v2)
- bs187 = testMarshalErr(v187v3, h, t, "enc-map-v187-custom")
- testUnmarshalErr(v187v4, bs187, h, t, "dec-map-v187-p-len")
- testDeepEqualErr(v187v3, v187v4, t, "equal-map-v187-p-len")
- }
-
- for _, v := range []map[int]uint64{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v188: %v\n", v)
- var v188v1, v188v2 map[int]uint64
- v188v1 = v
- bs188 := testMarshalErr(v188v1, h, t, "enc-map-v188")
- if v == nil {
- v188v2 = nil
- } else {
- v188v2 = make(map[int]uint64, len(v))
- } // reset map
- testUnmarshalErr(v188v2, bs188, h, t, "dec-map-v188")
- testDeepEqualErr(v188v1, v188v2, t, "equal-map-v188")
- if v == nil {
- v188v2 = nil
- } else {
- v188v2 = make(map[int]uint64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v188v2), bs188, h, t, "dec-map-v188-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v188v1, v188v2, t, "equal-map-v188-noaddr")
- if v == nil {
- v188v2 = nil
- } else {
- v188v2 = make(map[int]uint64, len(v))
- } // reset map
- testUnmarshalErr(&v188v2, bs188, h, t, "dec-map-v188-p-len")
- testDeepEqualErr(v188v1, v188v2, t, "equal-map-v188-p-len")
- bs188 = testMarshalErr(&v188v1, h, t, "enc-map-v188-p")
- v188v2 = nil
- testUnmarshalErr(&v188v2, bs188, h, t, "dec-map-v188-p-nil")
- testDeepEqualErr(v188v1, v188v2, t, "equal-map-v188-p-nil")
- // ...
- if v == nil {
- v188v2 = nil
- } else {
- v188v2 = make(map[int]uint64, len(v))
- } // reset map
- var v188v3, v188v4 typMapMapIntUint64
- v188v3 = typMapMapIntUint64(v188v1)
- v188v4 = typMapMapIntUint64(v188v2)
- bs188 = testMarshalErr(v188v3, h, t, "enc-map-v188-custom")
- testUnmarshalErr(v188v4, bs188, h, t, "dec-map-v188-p-len")
- testDeepEqualErr(v188v3, v188v4, t, "equal-map-v188-p-len")
- }
-
- for _, v := range []map[int]uintptr{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v189: %v\n", v)
- var v189v1, v189v2 map[int]uintptr
- v189v1 = v
- bs189 := testMarshalErr(v189v1, h, t, "enc-map-v189")
- if v == nil {
- v189v2 = nil
- } else {
- v189v2 = make(map[int]uintptr, len(v))
- } // reset map
- testUnmarshalErr(v189v2, bs189, h, t, "dec-map-v189")
- testDeepEqualErr(v189v1, v189v2, t, "equal-map-v189")
- if v == nil {
- v189v2 = nil
- } else {
- v189v2 = make(map[int]uintptr, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v189v2), bs189, h, t, "dec-map-v189-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v189v1, v189v2, t, "equal-map-v189-noaddr")
- if v == nil {
- v189v2 = nil
- } else {
- v189v2 = make(map[int]uintptr, len(v))
- } // reset map
- testUnmarshalErr(&v189v2, bs189, h, t, "dec-map-v189-p-len")
- testDeepEqualErr(v189v1, v189v2, t, "equal-map-v189-p-len")
- bs189 = testMarshalErr(&v189v1, h, t, "enc-map-v189-p")
- v189v2 = nil
- testUnmarshalErr(&v189v2, bs189, h, t, "dec-map-v189-p-nil")
- testDeepEqualErr(v189v1, v189v2, t, "equal-map-v189-p-nil")
- // ...
- if v == nil {
- v189v2 = nil
- } else {
- v189v2 = make(map[int]uintptr, len(v))
- } // reset map
- var v189v3, v189v4 typMapMapIntUintptr
- v189v3 = typMapMapIntUintptr(v189v1)
- v189v4 = typMapMapIntUintptr(v189v2)
- bs189 = testMarshalErr(v189v3, h, t, "enc-map-v189-custom")
- testUnmarshalErr(v189v4, bs189, h, t, "dec-map-v189-p-len")
- testDeepEqualErr(v189v3, v189v4, t, "equal-map-v189-p-len")
- }
-
- for _, v := range []map[int]int{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v190: %v\n", v)
- var v190v1, v190v2 map[int]int
- v190v1 = v
- bs190 := testMarshalErr(v190v1, h, t, "enc-map-v190")
- if v == nil {
- v190v2 = nil
- } else {
- v190v2 = make(map[int]int, len(v))
- } // reset map
- testUnmarshalErr(v190v2, bs190, h, t, "dec-map-v190")
- testDeepEqualErr(v190v1, v190v2, t, "equal-map-v190")
- if v == nil {
- v190v2 = nil
- } else {
- v190v2 = make(map[int]int, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v190v2), bs190, h, t, "dec-map-v190-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v190v1, v190v2, t, "equal-map-v190-noaddr")
- if v == nil {
- v190v2 = nil
- } else {
- v190v2 = make(map[int]int, len(v))
- } // reset map
- testUnmarshalErr(&v190v2, bs190, h, t, "dec-map-v190-p-len")
- testDeepEqualErr(v190v1, v190v2, t, "equal-map-v190-p-len")
- bs190 = testMarshalErr(&v190v1, h, t, "enc-map-v190-p")
- v190v2 = nil
- testUnmarshalErr(&v190v2, bs190, h, t, "dec-map-v190-p-nil")
- testDeepEqualErr(v190v1, v190v2, t, "equal-map-v190-p-nil")
- // ...
- if v == nil {
- v190v2 = nil
- } else {
- v190v2 = make(map[int]int, len(v))
- } // reset map
- var v190v3, v190v4 typMapMapIntInt
- v190v3 = typMapMapIntInt(v190v1)
- v190v4 = typMapMapIntInt(v190v2)
- bs190 = testMarshalErr(v190v3, h, t, "enc-map-v190-custom")
- testUnmarshalErr(v190v4, bs190, h, t, "dec-map-v190-p-len")
- testDeepEqualErr(v190v3, v190v4, t, "equal-map-v190-p-len")
- }
-
- for _, v := range []map[int]int8{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v191: %v\n", v)
- var v191v1, v191v2 map[int]int8
- v191v1 = v
- bs191 := testMarshalErr(v191v1, h, t, "enc-map-v191")
- if v == nil {
- v191v2 = nil
- } else {
- v191v2 = make(map[int]int8, len(v))
- } // reset map
- testUnmarshalErr(v191v2, bs191, h, t, "dec-map-v191")
- testDeepEqualErr(v191v1, v191v2, t, "equal-map-v191")
- if v == nil {
- v191v2 = nil
- } else {
- v191v2 = make(map[int]int8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v191v2), bs191, h, t, "dec-map-v191-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v191v1, v191v2, t, "equal-map-v191-noaddr")
- if v == nil {
- v191v2 = nil
- } else {
- v191v2 = make(map[int]int8, len(v))
- } // reset map
- testUnmarshalErr(&v191v2, bs191, h, t, "dec-map-v191-p-len")
- testDeepEqualErr(v191v1, v191v2, t, "equal-map-v191-p-len")
- bs191 = testMarshalErr(&v191v1, h, t, "enc-map-v191-p")
- v191v2 = nil
- testUnmarshalErr(&v191v2, bs191, h, t, "dec-map-v191-p-nil")
- testDeepEqualErr(v191v1, v191v2, t, "equal-map-v191-p-nil")
- // ...
- if v == nil {
- v191v2 = nil
- } else {
- v191v2 = make(map[int]int8, len(v))
- } // reset map
- var v191v3, v191v4 typMapMapIntInt8
- v191v3 = typMapMapIntInt8(v191v1)
- v191v4 = typMapMapIntInt8(v191v2)
- bs191 = testMarshalErr(v191v3, h, t, "enc-map-v191-custom")
- testUnmarshalErr(v191v4, bs191, h, t, "dec-map-v191-p-len")
- testDeepEqualErr(v191v3, v191v4, t, "equal-map-v191-p-len")
- }
-
- for _, v := range []map[int]int16{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v192: %v\n", v)
- var v192v1, v192v2 map[int]int16
- v192v1 = v
- bs192 := testMarshalErr(v192v1, h, t, "enc-map-v192")
- if v == nil {
- v192v2 = nil
- } else {
- v192v2 = make(map[int]int16, len(v))
- } // reset map
- testUnmarshalErr(v192v2, bs192, h, t, "dec-map-v192")
- testDeepEqualErr(v192v1, v192v2, t, "equal-map-v192")
- if v == nil {
- v192v2 = nil
- } else {
- v192v2 = make(map[int]int16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v192v2), bs192, h, t, "dec-map-v192-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v192v1, v192v2, t, "equal-map-v192-noaddr")
- if v == nil {
- v192v2 = nil
- } else {
- v192v2 = make(map[int]int16, len(v))
- } // reset map
- testUnmarshalErr(&v192v2, bs192, h, t, "dec-map-v192-p-len")
- testDeepEqualErr(v192v1, v192v2, t, "equal-map-v192-p-len")
- bs192 = testMarshalErr(&v192v1, h, t, "enc-map-v192-p")
- v192v2 = nil
- testUnmarshalErr(&v192v2, bs192, h, t, "dec-map-v192-p-nil")
- testDeepEqualErr(v192v1, v192v2, t, "equal-map-v192-p-nil")
- // ...
- if v == nil {
- v192v2 = nil
- } else {
- v192v2 = make(map[int]int16, len(v))
- } // reset map
- var v192v3, v192v4 typMapMapIntInt16
- v192v3 = typMapMapIntInt16(v192v1)
- v192v4 = typMapMapIntInt16(v192v2)
- bs192 = testMarshalErr(v192v3, h, t, "enc-map-v192-custom")
- testUnmarshalErr(v192v4, bs192, h, t, "dec-map-v192-p-len")
- testDeepEqualErr(v192v3, v192v4, t, "equal-map-v192-p-len")
- }
-
- for _, v := range []map[int]int32{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v193: %v\n", v)
- var v193v1, v193v2 map[int]int32
- v193v1 = v
- bs193 := testMarshalErr(v193v1, h, t, "enc-map-v193")
- if v == nil {
- v193v2 = nil
- } else {
- v193v2 = make(map[int]int32, len(v))
- } // reset map
- testUnmarshalErr(v193v2, bs193, h, t, "dec-map-v193")
- testDeepEqualErr(v193v1, v193v2, t, "equal-map-v193")
- if v == nil {
- v193v2 = nil
- } else {
- v193v2 = make(map[int]int32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v193v2), bs193, h, t, "dec-map-v193-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v193v1, v193v2, t, "equal-map-v193-noaddr")
- if v == nil {
- v193v2 = nil
- } else {
- v193v2 = make(map[int]int32, len(v))
- } // reset map
- testUnmarshalErr(&v193v2, bs193, h, t, "dec-map-v193-p-len")
- testDeepEqualErr(v193v1, v193v2, t, "equal-map-v193-p-len")
- bs193 = testMarshalErr(&v193v1, h, t, "enc-map-v193-p")
- v193v2 = nil
- testUnmarshalErr(&v193v2, bs193, h, t, "dec-map-v193-p-nil")
- testDeepEqualErr(v193v1, v193v2, t, "equal-map-v193-p-nil")
- // ...
- if v == nil {
- v193v2 = nil
- } else {
- v193v2 = make(map[int]int32, len(v))
- } // reset map
- var v193v3, v193v4 typMapMapIntInt32
- v193v3 = typMapMapIntInt32(v193v1)
- v193v4 = typMapMapIntInt32(v193v2)
- bs193 = testMarshalErr(v193v3, h, t, "enc-map-v193-custom")
- testUnmarshalErr(v193v4, bs193, h, t, "dec-map-v193-p-len")
- testDeepEqualErr(v193v3, v193v4, t, "equal-map-v193-p-len")
- }
-
- for _, v := range []map[int]int64{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v194: %v\n", v)
- var v194v1, v194v2 map[int]int64
- v194v1 = v
- bs194 := testMarshalErr(v194v1, h, t, "enc-map-v194")
- if v == nil {
- v194v2 = nil
- } else {
- v194v2 = make(map[int]int64, len(v))
- } // reset map
- testUnmarshalErr(v194v2, bs194, h, t, "dec-map-v194")
- testDeepEqualErr(v194v1, v194v2, t, "equal-map-v194")
- if v == nil {
- v194v2 = nil
- } else {
- v194v2 = make(map[int]int64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v194v2), bs194, h, t, "dec-map-v194-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v194v1, v194v2, t, "equal-map-v194-noaddr")
- if v == nil {
- v194v2 = nil
- } else {
- v194v2 = make(map[int]int64, len(v))
- } // reset map
- testUnmarshalErr(&v194v2, bs194, h, t, "dec-map-v194-p-len")
- testDeepEqualErr(v194v1, v194v2, t, "equal-map-v194-p-len")
- bs194 = testMarshalErr(&v194v1, h, t, "enc-map-v194-p")
- v194v2 = nil
- testUnmarshalErr(&v194v2, bs194, h, t, "dec-map-v194-p-nil")
- testDeepEqualErr(v194v1, v194v2, t, "equal-map-v194-p-nil")
- // ...
- if v == nil {
- v194v2 = nil
- } else {
- v194v2 = make(map[int]int64, len(v))
- } // reset map
- var v194v3, v194v4 typMapMapIntInt64
- v194v3 = typMapMapIntInt64(v194v1)
- v194v4 = typMapMapIntInt64(v194v2)
- bs194 = testMarshalErr(v194v3, h, t, "enc-map-v194-custom")
- testUnmarshalErr(v194v4, bs194, h, t, "dec-map-v194-p-len")
- testDeepEqualErr(v194v3, v194v4, t, "equal-map-v194-p-len")
- }
-
- for _, v := range []map[int]float32{nil, {}, {33: 0, 44: 22.2}} {
- // fmt.Printf(">>>> running mammoth map v195: %v\n", v)
- var v195v1, v195v2 map[int]float32
- v195v1 = v
- bs195 := testMarshalErr(v195v1, h, t, "enc-map-v195")
- if v == nil {
- v195v2 = nil
- } else {
- v195v2 = make(map[int]float32, len(v))
- } // reset map
- testUnmarshalErr(v195v2, bs195, h, t, "dec-map-v195")
- testDeepEqualErr(v195v1, v195v2, t, "equal-map-v195")
- if v == nil {
- v195v2 = nil
- } else {
- v195v2 = make(map[int]float32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v195v2), bs195, h, t, "dec-map-v195-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v195v1, v195v2, t, "equal-map-v195-noaddr")
- if v == nil {
- v195v2 = nil
- } else {
- v195v2 = make(map[int]float32, len(v))
- } // reset map
- testUnmarshalErr(&v195v2, bs195, h, t, "dec-map-v195-p-len")
- testDeepEqualErr(v195v1, v195v2, t, "equal-map-v195-p-len")
- bs195 = testMarshalErr(&v195v1, h, t, "enc-map-v195-p")
- v195v2 = nil
- testUnmarshalErr(&v195v2, bs195, h, t, "dec-map-v195-p-nil")
- testDeepEqualErr(v195v1, v195v2, t, "equal-map-v195-p-nil")
- // ...
- if v == nil {
- v195v2 = nil
- } else {
- v195v2 = make(map[int]float32, len(v))
- } // reset map
- var v195v3, v195v4 typMapMapIntFloat32
- v195v3 = typMapMapIntFloat32(v195v1)
- v195v4 = typMapMapIntFloat32(v195v2)
- bs195 = testMarshalErr(v195v3, h, t, "enc-map-v195-custom")
- testUnmarshalErr(v195v4, bs195, h, t, "dec-map-v195-p-len")
- testDeepEqualErr(v195v3, v195v4, t, "equal-map-v195-p-len")
- }
-
- for _, v := range []map[int]float64{nil, {}, {33: 0, 44: 11.1}} {
- // fmt.Printf(">>>> running mammoth map v196: %v\n", v)
- var v196v1, v196v2 map[int]float64
- v196v1 = v
- bs196 := testMarshalErr(v196v1, h, t, "enc-map-v196")
- if v == nil {
- v196v2 = nil
- } else {
- v196v2 = make(map[int]float64, len(v))
- } // reset map
- testUnmarshalErr(v196v2, bs196, h, t, "dec-map-v196")
- testDeepEqualErr(v196v1, v196v2, t, "equal-map-v196")
- if v == nil {
- v196v2 = nil
- } else {
- v196v2 = make(map[int]float64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v196v2), bs196, h, t, "dec-map-v196-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v196v1, v196v2, t, "equal-map-v196-noaddr")
- if v == nil {
- v196v2 = nil
- } else {
- v196v2 = make(map[int]float64, len(v))
- } // reset map
- testUnmarshalErr(&v196v2, bs196, h, t, "dec-map-v196-p-len")
- testDeepEqualErr(v196v1, v196v2, t, "equal-map-v196-p-len")
- bs196 = testMarshalErr(&v196v1, h, t, "enc-map-v196-p")
- v196v2 = nil
- testUnmarshalErr(&v196v2, bs196, h, t, "dec-map-v196-p-nil")
- testDeepEqualErr(v196v1, v196v2, t, "equal-map-v196-p-nil")
- // ...
- if v == nil {
- v196v2 = nil
- } else {
- v196v2 = make(map[int]float64, len(v))
- } // reset map
- var v196v3, v196v4 typMapMapIntFloat64
- v196v3 = typMapMapIntFloat64(v196v1)
- v196v4 = typMapMapIntFloat64(v196v2)
- bs196 = testMarshalErr(v196v3, h, t, "enc-map-v196-custom")
- testUnmarshalErr(v196v4, bs196, h, t, "dec-map-v196-p-len")
- testDeepEqualErr(v196v3, v196v4, t, "equal-map-v196-p-len")
- }
-
- for _, v := range []map[int]bool{nil, {}, {33: false, 44: true}} {
- // fmt.Printf(">>>> running mammoth map v197: %v\n", v)
- var v197v1, v197v2 map[int]bool
- v197v1 = v
- bs197 := testMarshalErr(v197v1, h, t, "enc-map-v197")
- if v == nil {
- v197v2 = nil
- } else {
- v197v2 = make(map[int]bool, len(v))
- } // reset map
- testUnmarshalErr(v197v2, bs197, h, t, "dec-map-v197")
- testDeepEqualErr(v197v1, v197v2, t, "equal-map-v197")
- if v == nil {
- v197v2 = nil
- } else {
- v197v2 = make(map[int]bool, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v197v2), bs197, h, t, "dec-map-v197-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v197v1, v197v2, t, "equal-map-v197-noaddr")
- if v == nil {
- v197v2 = nil
- } else {
- v197v2 = make(map[int]bool, len(v))
- } // reset map
- testUnmarshalErr(&v197v2, bs197, h, t, "dec-map-v197-p-len")
- testDeepEqualErr(v197v1, v197v2, t, "equal-map-v197-p-len")
- bs197 = testMarshalErr(&v197v1, h, t, "enc-map-v197-p")
- v197v2 = nil
- testUnmarshalErr(&v197v2, bs197, h, t, "dec-map-v197-p-nil")
- testDeepEqualErr(v197v1, v197v2, t, "equal-map-v197-p-nil")
- // ...
- if v == nil {
- v197v2 = nil
- } else {
- v197v2 = make(map[int]bool, len(v))
- } // reset map
- var v197v3, v197v4 typMapMapIntBool
- v197v3 = typMapMapIntBool(v197v1)
- v197v4 = typMapMapIntBool(v197v2)
- bs197 = testMarshalErr(v197v3, h, t, "enc-map-v197-custom")
- testUnmarshalErr(v197v4, bs197, h, t, "dec-map-v197-p-len")
- testDeepEqualErr(v197v3, v197v4, t, "equal-map-v197-p-len")
- }
-
- for _, v := range []map[int8]interface{}{nil, {}, {33: nil, 44: "string-is-an-interface"}} {
- // fmt.Printf(">>>> running mammoth map v200: %v\n", v)
- var v200v1, v200v2 map[int8]interface{}
- v200v1 = v
- bs200 := testMarshalErr(v200v1, h, t, "enc-map-v200")
- if v == nil {
- v200v2 = nil
- } else {
- v200v2 = make(map[int8]interface{}, len(v))
- } // reset map
- testUnmarshalErr(v200v2, bs200, h, t, "dec-map-v200")
- testDeepEqualErr(v200v1, v200v2, t, "equal-map-v200")
- if v == nil {
- v200v2 = nil
- } else {
- v200v2 = make(map[int8]interface{}, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v200v2), bs200, h, t, "dec-map-v200-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v200v1, v200v2, t, "equal-map-v200-noaddr")
- if v == nil {
- v200v2 = nil
- } else {
- v200v2 = make(map[int8]interface{}, len(v))
- } // reset map
- testUnmarshalErr(&v200v2, bs200, h, t, "dec-map-v200-p-len")
- testDeepEqualErr(v200v1, v200v2, t, "equal-map-v200-p-len")
- bs200 = testMarshalErr(&v200v1, h, t, "enc-map-v200-p")
- v200v2 = nil
- testUnmarshalErr(&v200v2, bs200, h, t, "dec-map-v200-p-nil")
- testDeepEqualErr(v200v1, v200v2, t, "equal-map-v200-p-nil")
- // ...
- if v == nil {
- v200v2 = nil
- } else {
- v200v2 = make(map[int8]interface{}, len(v))
- } // reset map
- var v200v3, v200v4 typMapMapInt8Intf
- v200v3 = typMapMapInt8Intf(v200v1)
- v200v4 = typMapMapInt8Intf(v200v2)
- bs200 = testMarshalErr(v200v3, h, t, "enc-map-v200-custom")
- testUnmarshalErr(v200v4, bs200, h, t, "dec-map-v200-p-len")
- testDeepEqualErr(v200v3, v200v4, t, "equal-map-v200-p-len")
- }
-
- for _, v := range []map[int8]string{nil, {}, {33: "", 44: "some-string"}} {
- // fmt.Printf(">>>> running mammoth map v201: %v\n", v)
- var v201v1, v201v2 map[int8]string
- v201v1 = v
- bs201 := testMarshalErr(v201v1, h, t, "enc-map-v201")
- if v == nil {
- v201v2 = nil
- } else {
- v201v2 = make(map[int8]string, len(v))
- } // reset map
- testUnmarshalErr(v201v2, bs201, h, t, "dec-map-v201")
- testDeepEqualErr(v201v1, v201v2, t, "equal-map-v201")
- if v == nil {
- v201v2 = nil
- } else {
- v201v2 = make(map[int8]string, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v201v2), bs201, h, t, "dec-map-v201-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v201v1, v201v2, t, "equal-map-v201-noaddr")
- if v == nil {
- v201v2 = nil
- } else {
- v201v2 = make(map[int8]string, len(v))
- } // reset map
- testUnmarshalErr(&v201v2, bs201, h, t, "dec-map-v201-p-len")
- testDeepEqualErr(v201v1, v201v2, t, "equal-map-v201-p-len")
- bs201 = testMarshalErr(&v201v1, h, t, "enc-map-v201-p")
- v201v2 = nil
- testUnmarshalErr(&v201v2, bs201, h, t, "dec-map-v201-p-nil")
- testDeepEqualErr(v201v1, v201v2, t, "equal-map-v201-p-nil")
- // ...
- if v == nil {
- v201v2 = nil
- } else {
- v201v2 = make(map[int8]string, len(v))
- } // reset map
- var v201v3, v201v4 typMapMapInt8String
- v201v3 = typMapMapInt8String(v201v1)
- v201v4 = typMapMapInt8String(v201v2)
- bs201 = testMarshalErr(v201v3, h, t, "enc-map-v201-custom")
- testUnmarshalErr(v201v4, bs201, h, t, "dec-map-v201-p-len")
- testDeepEqualErr(v201v3, v201v4, t, "equal-map-v201-p-len")
- }
-
- for _, v := range []map[int8]uint{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v202: %v\n", v)
- var v202v1, v202v2 map[int8]uint
- v202v1 = v
- bs202 := testMarshalErr(v202v1, h, t, "enc-map-v202")
- if v == nil {
- v202v2 = nil
- } else {
- v202v2 = make(map[int8]uint, len(v))
- } // reset map
- testUnmarshalErr(v202v2, bs202, h, t, "dec-map-v202")
- testDeepEqualErr(v202v1, v202v2, t, "equal-map-v202")
- if v == nil {
- v202v2 = nil
- } else {
- v202v2 = make(map[int8]uint, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v202v2), bs202, h, t, "dec-map-v202-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v202v1, v202v2, t, "equal-map-v202-noaddr")
- if v == nil {
- v202v2 = nil
- } else {
- v202v2 = make(map[int8]uint, len(v))
- } // reset map
- testUnmarshalErr(&v202v2, bs202, h, t, "dec-map-v202-p-len")
- testDeepEqualErr(v202v1, v202v2, t, "equal-map-v202-p-len")
- bs202 = testMarshalErr(&v202v1, h, t, "enc-map-v202-p")
- v202v2 = nil
- testUnmarshalErr(&v202v2, bs202, h, t, "dec-map-v202-p-nil")
- testDeepEqualErr(v202v1, v202v2, t, "equal-map-v202-p-nil")
- // ...
- if v == nil {
- v202v2 = nil
- } else {
- v202v2 = make(map[int8]uint, len(v))
- } // reset map
- var v202v3, v202v4 typMapMapInt8Uint
- v202v3 = typMapMapInt8Uint(v202v1)
- v202v4 = typMapMapInt8Uint(v202v2)
- bs202 = testMarshalErr(v202v3, h, t, "enc-map-v202-custom")
- testUnmarshalErr(v202v4, bs202, h, t, "dec-map-v202-p-len")
- testDeepEqualErr(v202v3, v202v4, t, "equal-map-v202-p-len")
- }
-
- for _, v := range []map[int8]uint8{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v203: %v\n", v)
- var v203v1, v203v2 map[int8]uint8
- v203v1 = v
- bs203 := testMarshalErr(v203v1, h, t, "enc-map-v203")
- if v == nil {
- v203v2 = nil
- } else {
- v203v2 = make(map[int8]uint8, len(v))
- } // reset map
- testUnmarshalErr(v203v2, bs203, h, t, "dec-map-v203")
- testDeepEqualErr(v203v1, v203v2, t, "equal-map-v203")
- if v == nil {
- v203v2 = nil
- } else {
- v203v2 = make(map[int8]uint8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v203v2), bs203, h, t, "dec-map-v203-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v203v1, v203v2, t, "equal-map-v203-noaddr")
- if v == nil {
- v203v2 = nil
- } else {
- v203v2 = make(map[int8]uint8, len(v))
- } // reset map
- testUnmarshalErr(&v203v2, bs203, h, t, "dec-map-v203-p-len")
- testDeepEqualErr(v203v1, v203v2, t, "equal-map-v203-p-len")
- bs203 = testMarshalErr(&v203v1, h, t, "enc-map-v203-p")
- v203v2 = nil
- testUnmarshalErr(&v203v2, bs203, h, t, "dec-map-v203-p-nil")
- testDeepEqualErr(v203v1, v203v2, t, "equal-map-v203-p-nil")
- // ...
- if v == nil {
- v203v2 = nil
- } else {
- v203v2 = make(map[int8]uint8, len(v))
- } // reset map
- var v203v3, v203v4 typMapMapInt8Uint8
- v203v3 = typMapMapInt8Uint8(v203v1)
- v203v4 = typMapMapInt8Uint8(v203v2)
- bs203 = testMarshalErr(v203v3, h, t, "enc-map-v203-custom")
- testUnmarshalErr(v203v4, bs203, h, t, "dec-map-v203-p-len")
- testDeepEqualErr(v203v3, v203v4, t, "equal-map-v203-p-len")
- }
-
- for _, v := range []map[int8]uint16{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v204: %v\n", v)
- var v204v1, v204v2 map[int8]uint16
- v204v1 = v
- bs204 := testMarshalErr(v204v1, h, t, "enc-map-v204")
- if v == nil {
- v204v2 = nil
- } else {
- v204v2 = make(map[int8]uint16, len(v))
- } // reset map
- testUnmarshalErr(v204v2, bs204, h, t, "dec-map-v204")
- testDeepEqualErr(v204v1, v204v2, t, "equal-map-v204")
- if v == nil {
- v204v2 = nil
- } else {
- v204v2 = make(map[int8]uint16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v204v2), bs204, h, t, "dec-map-v204-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v204v1, v204v2, t, "equal-map-v204-noaddr")
- if v == nil {
- v204v2 = nil
- } else {
- v204v2 = make(map[int8]uint16, len(v))
- } // reset map
- testUnmarshalErr(&v204v2, bs204, h, t, "dec-map-v204-p-len")
- testDeepEqualErr(v204v1, v204v2, t, "equal-map-v204-p-len")
- bs204 = testMarshalErr(&v204v1, h, t, "enc-map-v204-p")
- v204v2 = nil
- testUnmarshalErr(&v204v2, bs204, h, t, "dec-map-v204-p-nil")
- testDeepEqualErr(v204v1, v204v2, t, "equal-map-v204-p-nil")
- // ...
- if v == nil {
- v204v2 = nil
- } else {
- v204v2 = make(map[int8]uint16, len(v))
- } // reset map
- var v204v3, v204v4 typMapMapInt8Uint16
- v204v3 = typMapMapInt8Uint16(v204v1)
- v204v4 = typMapMapInt8Uint16(v204v2)
- bs204 = testMarshalErr(v204v3, h, t, "enc-map-v204-custom")
- testUnmarshalErr(v204v4, bs204, h, t, "dec-map-v204-p-len")
- testDeepEqualErr(v204v3, v204v4, t, "equal-map-v204-p-len")
- }
-
- for _, v := range []map[int8]uint32{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v205: %v\n", v)
- var v205v1, v205v2 map[int8]uint32
- v205v1 = v
- bs205 := testMarshalErr(v205v1, h, t, "enc-map-v205")
- if v == nil {
- v205v2 = nil
- } else {
- v205v2 = make(map[int8]uint32, len(v))
- } // reset map
- testUnmarshalErr(v205v2, bs205, h, t, "dec-map-v205")
- testDeepEqualErr(v205v1, v205v2, t, "equal-map-v205")
- if v == nil {
- v205v2 = nil
- } else {
- v205v2 = make(map[int8]uint32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v205v2), bs205, h, t, "dec-map-v205-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v205v1, v205v2, t, "equal-map-v205-noaddr")
- if v == nil {
- v205v2 = nil
- } else {
- v205v2 = make(map[int8]uint32, len(v))
- } // reset map
- testUnmarshalErr(&v205v2, bs205, h, t, "dec-map-v205-p-len")
- testDeepEqualErr(v205v1, v205v2, t, "equal-map-v205-p-len")
- bs205 = testMarshalErr(&v205v1, h, t, "enc-map-v205-p")
- v205v2 = nil
- testUnmarshalErr(&v205v2, bs205, h, t, "dec-map-v205-p-nil")
- testDeepEqualErr(v205v1, v205v2, t, "equal-map-v205-p-nil")
- // ...
- if v == nil {
- v205v2 = nil
- } else {
- v205v2 = make(map[int8]uint32, len(v))
- } // reset map
- var v205v3, v205v4 typMapMapInt8Uint32
- v205v3 = typMapMapInt8Uint32(v205v1)
- v205v4 = typMapMapInt8Uint32(v205v2)
- bs205 = testMarshalErr(v205v3, h, t, "enc-map-v205-custom")
- testUnmarshalErr(v205v4, bs205, h, t, "dec-map-v205-p-len")
- testDeepEqualErr(v205v3, v205v4, t, "equal-map-v205-p-len")
- }
-
- for _, v := range []map[int8]uint64{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v206: %v\n", v)
- var v206v1, v206v2 map[int8]uint64
- v206v1 = v
- bs206 := testMarshalErr(v206v1, h, t, "enc-map-v206")
- if v == nil {
- v206v2 = nil
- } else {
- v206v2 = make(map[int8]uint64, len(v))
- } // reset map
- testUnmarshalErr(v206v2, bs206, h, t, "dec-map-v206")
- testDeepEqualErr(v206v1, v206v2, t, "equal-map-v206")
- if v == nil {
- v206v2 = nil
- } else {
- v206v2 = make(map[int8]uint64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v206v2), bs206, h, t, "dec-map-v206-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v206v1, v206v2, t, "equal-map-v206-noaddr")
- if v == nil {
- v206v2 = nil
- } else {
- v206v2 = make(map[int8]uint64, len(v))
- } // reset map
- testUnmarshalErr(&v206v2, bs206, h, t, "dec-map-v206-p-len")
- testDeepEqualErr(v206v1, v206v2, t, "equal-map-v206-p-len")
- bs206 = testMarshalErr(&v206v1, h, t, "enc-map-v206-p")
- v206v2 = nil
- testUnmarshalErr(&v206v2, bs206, h, t, "dec-map-v206-p-nil")
- testDeepEqualErr(v206v1, v206v2, t, "equal-map-v206-p-nil")
- // ...
- if v == nil {
- v206v2 = nil
- } else {
- v206v2 = make(map[int8]uint64, len(v))
- } // reset map
- var v206v3, v206v4 typMapMapInt8Uint64
- v206v3 = typMapMapInt8Uint64(v206v1)
- v206v4 = typMapMapInt8Uint64(v206v2)
- bs206 = testMarshalErr(v206v3, h, t, "enc-map-v206-custom")
- testUnmarshalErr(v206v4, bs206, h, t, "dec-map-v206-p-len")
- testDeepEqualErr(v206v3, v206v4, t, "equal-map-v206-p-len")
- }
-
- for _, v := range []map[int8]uintptr{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v207: %v\n", v)
- var v207v1, v207v2 map[int8]uintptr
- v207v1 = v
- bs207 := testMarshalErr(v207v1, h, t, "enc-map-v207")
- if v == nil {
- v207v2 = nil
- } else {
- v207v2 = make(map[int8]uintptr, len(v))
- } // reset map
- testUnmarshalErr(v207v2, bs207, h, t, "dec-map-v207")
- testDeepEqualErr(v207v1, v207v2, t, "equal-map-v207")
- if v == nil {
- v207v2 = nil
- } else {
- v207v2 = make(map[int8]uintptr, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v207v2), bs207, h, t, "dec-map-v207-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v207v1, v207v2, t, "equal-map-v207-noaddr")
- if v == nil {
- v207v2 = nil
- } else {
- v207v2 = make(map[int8]uintptr, len(v))
- } // reset map
- testUnmarshalErr(&v207v2, bs207, h, t, "dec-map-v207-p-len")
- testDeepEqualErr(v207v1, v207v2, t, "equal-map-v207-p-len")
- bs207 = testMarshalErr(&v207v1, h, t, "enc-map-v207-p")
- v207v2 = nil
- testUnmarshalErr(&v207v2, bs207, h, t, "dec-map-v207-p-nil")
- testDeepEqualErr(v207v1, v207v2, t, "equal-map-v207-p-nil")
- // ...
- if v == nil {
- v207v2 = nil
- } else {
- v207v2 = make(map[int8]uintptr, len(v))
- } // reset map
- var v207v3, v207v4 typMapMapInt8Uintptr
- v207v3 = typMapMapInt8Uintptr(v207v1)
- v207v4 = typMapMapInt8Uintptr(v207v2)
- bs207 = testMarshalErr(v207v3, h, t, "enc-map-v207-custom")
- testUnmarshalErr(v207v4, bs207, h, t, "dec-map-v207-p-len")
- testDeepEqualErr(v207v3, v207v4, t, "equal-map-v207-p-len")
- }
-
- for _, v := range []map[int8]int{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v208: %v\n", v)
- var v208v1, v208v2 map[int8]int
- v208v1 = v
- bs208 := testMarshalErr(v208v1, h, t, "enc-map-v208")
- if v == nil {
- v208v2 = nil
- } else {
- v208v2 = make(map[int8]int, len(v))
- } // reset map
- testUnmarshalErr(v208v2, bs208, h, t, "dec-map-v208")
- testDeepEqualErr(v208v1, v208v2, t, "equal-map-v208")
- if v == nil {
- v208v2 = nil
- } else {
- v208v2 = make(map[int8]int, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v208v2), bs208, h, t, "dec-map-v208-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v208v1, v208v2, t, "equal-map-v208-noaddr")
- if v == nil {
- v208v2 = nil
- } else {
- v208v2 = make(map[int8]int, len(v))
- } // reset map
- testUnmarshalErr(&v208v2, bs208, h, t, "dec-map-v208-p-len")
- testDeepEqualErr(v208v1, v208v2, t, "equal-map-v208-p-len")
- bs208 = testMarshalErr(&v208v1, h, t, "enc-map-v208-p")
- v208v2 = nil
- testUnmarshalErr(&v208v2, bs208, h, t, "dec-map-v208-p-nil")
- testDeepEqualErr(v208v1, v208v2, t, "equal-map-v208-p-nil")
- // ...
- if v == nil {
- v208v2 = nil
- } else {
- v208v2 = make(map[int8]int, len(v))
- } // reset map
- var v208v3, v208v4 typMapMapInt8Int
- v208v3 = typMapMapInt8Int(v208v1)
- v208v4 = typMapMapInt8Int(v208v2)
- bs208 = testMarshalErr(v208v3, h, t, "enc-map-v208-custom")
- testUnmarshalErr(v208v4, bs208, h, t, "dec-map-v208-p-len")
- testDeepEqualErr(v208v3, v208v4, t, "equal-map-v208-p-len")
- }
-
- for _, v := range []map[int8]int8{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v209: %v\n", v)
- var v209v1, v209v2 map[int8]int8
- v209v1 = v
- bs209 := testMarshalErr(v209v1, h, t, "enc-map-v209")
- if v == nil {
- v209v2 = nil
- } else {
- v209v2 = make(map[int8]int8, len(v))
- } // reset map
- testUnmarshalErr(v209v2, bs209, h, t, "dec-map-v209")
- testDeepEqualErr(v209v1, v209v2, t, "equal-map-v209")
- if v == nil {
- v209v2 = nil
- } else {
- v209v2 = make(map[int8]int8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v209v2), bs209, h, t, "dec-map-v209-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v209v1, v209v2, t, "equal-map-v209-noaddr")
- if v == nil {
- v209v2 = nil
- } else {
- v209v2 = make(map[int8]int8, len(v))
- } // reset map
- testUnmarshalErr(&v209v2, bs209, h, t, "dec-map-v209-p-len")
- testDeepEqualErr(v209v1, v209v2, t, "equal-map-v209-p-len")
- bs209 = testMarshalErr(&v209v1, h, t, "enc-map-v209-p")
- v209v2 = nil
- testUnmarshalErr(&v209v2, bs209, h, t, "dec-map-v209-p-nil")
- testDeepEqualErr(v209v1, v209v2, t, "equal-map-v209-p-nil")
- // ...
- if v == nil {
- v209v2 = nil
- } else {
- v209v2 = make(map[int8]int8, len(v))
- } // reset map
- var v209v3, v209v4 typMapMapInt8Int8
- v209v3 = typMapMapInt8Int8(v209v1)
- v209v4 = typMapMapInt8Int8(v209v2)
- bs209 = testMarshalErr(v209v3, h, t, "enc-map-v209-custom")
- testUnmarshalErr(v209v4, bs209, h, t, "dec-map-v209-p-len")
- testDeepEqualErr(v209v3, v209v4, t, "equal-map-v209-p-len")
- }
-
- for _, v := range []map[int8]int16{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v210: %v\n", v)
- var v210v1, v210v2 map[int8]int16
- v210v1 = v
- bs210 := testMarshalErr(v210v1, h, t, "enc-map-v210")
- if v == nil {
- v210v2 = nil
- } else {
- v210v2 = make(map[int8]int16, len(v))
- } // reset map
- testUnmarshalErr(v210v2, bs210, h, t, "dec-map-v210")
- testDeepEqualErr(v210v1, v210v2, t, "equal-map-v210")
- if v == nil {
- v210v2 = nil
- } else {
- v210v2 = make(map[int8]int16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v210v2), bs210, h, t, "dec-map-v210-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v210v1, v210v2, t, "equal-map-v210-noaddr")
- if v == nil {
- v210v2 = nil
- } else {
- v210v2 = make(map[int8]int16, len(v))
- } // reset map
- testUnmarshalErr(&v210v2, bs210, h, t, "dec-map-v210-p-len")
- testDeepEqualErr(v210v1, v210v2, t, "equal-map-v210-p-len")
- bs210 = testMarshalErr(&v210v1, h, t, "enc-map-v210-p")
- v210v2 = nil
- testUnmarshalErr(&v210v2, bs210, h, t, "dec-map-v210-p-nil")
- testDeepEqualErr(v210v1, v210v2, t, "equal-map-v210-p-nil")
- // ...
- if v == nil {
- v210v2 = nil
- } else {
- v210v2 = make(map[int8]int16, len(v))
- } // reset map
- var v210v3, v210v4 typMapMapInt8Int16
- v210v3 = typMapMapInt8Int16(v210v1)
- v210v4 = typMapMapInt8Int16(v210v2)
- bs210 = testMarshalErr(v210v3, h, t, "enc-map-v210-custom")
- testUnmarshalErr(v210v4, bs210, h, t, "dec-map-v210-p-len")
- testDeepEqualErr(v210v3, v210v4, t, "equal-map-v210-p-len")
- }
-
- for _, v := range []map[int8]int32{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v211: %v\n", v)
- var v211v1, v211v2 map[int8]int32
- v211v1 = v
- bs211 := testMarshalErr(v211v1, h, t, "enc-map-v211")
- if v == nil {
- v211v2 = nil
- } else {
- v211v2 = make(map[int8]int32, len(v))
- } // reset map
- testUnmarshalErr(v211v2, bs211, h, t, "dec-map-v211")
- testDeepEqualErr(v211v1, v211v2, t, "equal-map-v211")
- if v == nil {
- v211v2 = nil
- } else {
- v211v2 = make(map[int8]int32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v211v2), bs211, h, t, "dec-map-v211-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v211v1, v211v2, t, "equal-map-v211-noaddr")
- if v == nil {
- v211v2 = nil
- } else {
- v211v2 = make(map[int8]int32, len(v))
- } // reset map
- testUnmarshalErr(&v211v2, bs211, h, t, "dec-map-v211-p-len")
- testDeepEqualErr(v211v1, v211v2, t, "equal-map-v211-p-len")
- bs211 = testMarshalErr(&v211v1, h, t, "enc-map-v211-p")
- v211v2 = nil
- testUnmarshalErr(&v211v2, bs211, h, t, "dec-map-v211-p-nil")
- testDeepEqualErr(v211v1, v211v2, t, "equal-map-v211-p-nil")
- // ...
- if v == nil {
- v211v2 = nil
- } else {
- v211v2 = make(map[int8]int32, len(v))
- } // reset map
- var v211v3, v211v4 typMapMapInt8Int32
- v211v3 = typMapMapInt8Int32(v211v1)
- v211v4 = typMapMapInt8Int32(v211v2)
- bs211 = testMarshalErr(v211v3, h, t, "enc-map-v211-custom")
- testUnmarshalErr(v211v4, bs211, h, t, "dec-map-v211-p-len")
- testDeepEqualErr(v211v3, v211v4, t, "equal-map-v211-p-len")
- }
-
- for _, v := range []map[int8]int64{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v212: %v\n", v)
- var v212v1, v212v2 map[int8]int64
- v212v1 = v
- bs212 := testMarshalErr(v212v1, h, t, "enc-map-v212")
- if v == nil {
- v212v2 = nil
- } else {
- v212v2 = make(map[int8]int64, len(v))
- } // reset map
- testUnmarshalErr(v212v2, bs212, h, t, "dec-map-v212")
- testDeepEqualErr(v212v1, v212v2, t, "equal-map-v212")
- if v == nil {
- v212v2 = nil
- } else {
- v212v2 = make(map[int8]int64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v212v2), bs212, h, t, "dec-map-v212-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v212v1, v212v2, t, "equal-map-v212-noaddr")
- if v == nil {
- v212v2 = nil
- } else {
- v212v2 = make(map[int8]int64, len(v))
- } // reset map
- testUnmarshalErr(&v212v2, bs212, h, t, "dec-map-v212-p-len")
- testDeepEqualErr(v212v1, v212v2, t, "equal-map-v212-p-len")
- bs212 = testMarshalErr(&v212v1, h, t, "enc-map-v212-p")
- v212v2 = nil
- testUnmarshalErr(&v212v2, bs212, h, t, "dec-map-v212-p-nil")
- testDeepEqualErr(v212v1, v212v2, t, "equal-map-v212-p-nil")
- // ...
- if v == nil {
- v212v2 = nil
- } else {
- v212v2 = make(map[int8]int64, len(v))
- } // reset map
- var v212v3, v212v4 typMapMapInt8Int64
- v212v3 = typMapMapInt8Int64(v212v1)
- v212v4 = typMapMapInt8Int64(v212v2)
- bs212 = testMarshalErr(v212v3, h, t, "enc-map-v212-custom")
- testUnmarshalErr(v212v4, bs212, h, t, "dec-map-v212-p-len")
- testDeepEqualErr(v212v3, v212v4, t, "equal-map-v212-p-len")
- }
-
- for _, v := range []map[int8]float32{nil, {}, {44: 0, 33: 22.2}} {
- // fmt.Printf(">>>> running mammoth map v213: %v\n", v)
- var v213v1, v213v2 map[int8]float32
- v213v1 = v
- bs213 := testMarshalErr(v213v1, h, t, "enc-map-v213")
- if v == nil {
- v213v2 = nil
- } else {
- v213v2 = make(map[int8]float32, len(v))
- } // reset map
- testUnmarshalErr(v213v2, bs213, h, t, "dec-map-v213")
- testDeepEqualErr(v213v1, v213v2, t, "equal-map-v213")
- if v == nil {
- v213v2 = nil
- } else {
- v213v2 = make(map[int8]float32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v213v2), bs213, h, t, "dec-map-v213-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v213v1, v213v2, t, "equal-map-v213-noaddr")
- if v == nil {
- v213v2 = nil
- } else {
- v213v2 = make(map[int8]float32, len(v))
- } // reset map
- testUnmarshalErr(&v213v2, bs213, h, t, "dec-map-v213-p-len")
- testDeepEqualErr(v213v1, v213v2, t, "equal-map-v213-p-len")
- bs213 = testMarshalErr(&v213v1, h, t, "enc-map-v213-p")
- v213v2 = nil
- testUnmarshalErr(&v213v2, bs213, h, t, "dec-map-v213-p-nil")
- testDeepEqualErr(v213v1, v213v2, t, "equal-map-v213-p-nil")
- // ...
- if v == nil {
- v213v2 = nil
- } else {
- v213v2 = make(map[int8]float32, len(v))
- } // reset map
- var v213v3, v213v4 typMapMapInt8Float32
- v213v3 = typMapMapInt8Float32(v213v1)
- v213v4 = typMapMapInt8Float32(v213v2)
- bs213 = testMarshalErr(v213v3, h, t, "enc-map-v213-custom")
- testUnmarshalErr(v213v4, bs213, h, t, "dec-map-v213-p-len")
- testDeepEqualErr(v213v3, v213v4, t, "equal-map-v213-p-len")
- }
-
- for _, v := range []map[int8]float64{nil, {}, {44: 0, 33: 11.1}} {
- // fmt.Printf(">>>> running mammoth map v214: %v\n", v)
- var v214v1, v214v2 map[int8]float64
- v214v1 = v
- bs214 := testMarshalErr(v214v1, h, t, "enc-map-v214")
- if v == nil {
- v214v2 = nil
- } else {
- v214v2 = make(map[int8]float64, len(v))
- } // reset map
- testUnmarshalErr(v214v2, bs214, h, t, "dec-map-v214")
- testDeepEqualErr(v214v1, v214v2, t, "equal-map-v214")
- if v == nil {
- v214v2 = nil
- } else {
- v214v2 = make(map[int8]float64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v214v2), bs214, h, t, "dec-map-v214-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v214v1, v214v2, t, "equal-map-v214-noaddr")
- if v == nil {
- v214v2 = nil
- } else {
- v214v2 = make(map[int8]float64, len(v))
- } // reset map
- testUnmarshalErr(&v214v2, bs214, h, t, "dec-map-v214-p-len")
- testDeepEqualErr(v214v1, v214v2, t, "equal-map-v214-p-len")
- bs214 = testMarshalErr(&v214v1, h, t, "enc-map-v214-p")
- v214v2 = nil
- testUnmarshalErr(&v214v2, bs214, h, t, "dec-map-v214-p-nil")
- testDeepEqualErr(v214v1, v214v2, t, "equal-map-v214-p-nil")
- // ...
- if v == nil {
- v214v2 = nil
- } else {
- v214v2 = make(map[int8]float64, len(v))
- } // reset map
- var v214v3, v214v4 typMapMapInt8Float64
- v214v3 = typMapMapInt8Float64(v214v1)
- v214v4 = typMapMapInt8Float64(v214v2)
- bs214 = testMarshalErr(v214v3, h, t, "enc-map-v214-custom")
- testUnmarshalErr(v214v4, bs214, h, t, "dec-map-v214-p-len")
- testDeepEqualErr(v214v3, v214v4, t, "equal-map-v214-p-len")
- }
-
- for _, v := range []map[int8]bool{nil, {}, {44: false, 33: true}} {
- // fmt.Printf(">>>> running mammoth map v215: %v\n", v)
- var v215v1, v215v2 map[int8]bool
- v215v1 = v
- bs215 := testMarshalErr(v215v1, h, t, "enc-map-v215")
- if v == nil {
- v215v2 = nil
- } else {
- v215v2 = make(map[int8]bool, len(v))
- } // reset map
- testUnmarshalErr(v215v2, bs215, h, t, "dec-map-v215")
- testDeepEqualErr(v215v1, v215v2, t, "equal-map-v215")
- if v == nil {
- v215v2 = nil
- } else {
- v215v2 = make(map[int8]bool, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v215v2), bs215, h, t, "dec-map-v215-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v215v1, v215v2, t, "equal-map-v215-noaddr")
- if v == nil {
- v215v2 = nil
- } else {
- v215v2 = make(map[int8]bool, len(v))
- } // reset map
- testUnmarshalErr(&v215v2, bs215, h, t, "dec-map-v215-p-len")
- testDeepEqualErr(v215v1, v215v2, t, "equal-map-v215-p-len")
- bs215 = testMarshalErr(&v215v1, h, t, "enc-map-v215-p")
- v215v2 = nil
- testUnmarshalErr(&v215v2, bs215, h, t, "dec-map-v215-p-nil")
- testDeepEqualErr(v215v1, v215v2, t, "equal-map-v215-p-nil")
- // ...
- if v == nil {
- v215v2 = nil
- } else {
- v215v2 = make(map[int8]bool, len(v))
- } // reset map
- var v215v3, v215v4 typMapMapInt8Bool
- v215v3 = typMapMapInt8Bool(v215v1)
- v215v4 = typMapMapInt8Bool(v215v2)
- bs215 = testMarshalErr(v215v3, h, t, "enc-map-v215-custom")
- testUnmarshalErr(v215v4, bs215, h, t, "dec-map-v215-p-len")
- testDeepEqualErr(v215v3, v215v4, t, "equal-map-v215-p-len")
- }
-
- for _, v := range []map[int16]interface{}{nil, {}, {44: nil, 33: "string-is-an-interface-2"}} {
- // fmt.Printf(">>>> running mammoth map v218: %v\n", v)
- var v218v1, v218v2 map[int16]interface{}
- v218v1 = v
- bs218 := testMarshalErr(v218v1, h, t, "enc-map-v218")
- if v == nil {
- v218v2 = nil
- } else {
- v218v2 = make(map[int16]interface{}, len(v))
- } // reset map
- testUnmarshalErr(v218v2, bs218, h, t, "dec-map-v218")
- testDeepEqualErr(v218v1, v218v2, t, "equal-map-v218")
- if v == nil {
- v218v2 = nil
- } else {
- v218v2 = make(map[int16]interface{}, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v218v2), bs218, h, t, "dec-map-v218-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v218v1, v218v2, t, "equal-map-v218-noaddr")
- if v == nil {
- v218v2 = nil
- } else {
- v218v2 = make(map[int16]interface{}, len(v))
- } // reset map
- testUnmarshalErr(&v218v2, bs218, h, t, "dec-map-v218-p-len")
- testDeepEqualErr(v218v1, v218v2, t, "equal-map-v218-p-len")
- bs218 = testMarshalErr(&v218v1, h, t, "enc-map-v218-p")
- v218v2 = nil
- testUnmarshalErr(&v218v2, bs218, h, t, "dec-map-v218-p-nil")
- testDeepEqualErr(v218v1, v218v2, t, "equal-map-v218-p-nil")
- // ...
- if v == nil {
- v218v2 = nil
- } else {
- v218v2 = make(map[int16]interface{}, len(v))
- } // reset map
- var v218v3, v218v4 typMapMapInt16Intf
- v218v3 = typMapMapInt16Intf(v218v1)
- v218v4 = typMapMapInt16Intf(v218v2)
- bs218 = testMarshalErr(v218v3, h, t, "enc-map-v218-custom")
- testUnmarshalErr(v218v4, bs218, h, t, "dec-map-v218-p-len")
- testDeepEqualErr(v218v3, v218v4, t, "equal-map-v218-p-len")
- }
-
- for _, v := range []map[int16]string{nil, {}, {44: "", 33: "some-string-2"}} {
- // fmt.Printf(">>>> running mammoth map v219: %v\n", v)
- var v219v1, v219v2 map[int16]string
- v219v1 = v
- bs219 := testMarshalErr(v219v1, h, t, "enc-map-v219")
- if v == nil {
- v219v2 = nil
- } else {
- v219v2 = make(map[int16]string, len(v))
- } // reset map
- testUnmarshalErr(v219v2, bs219, h, t, "dec-map-v219")
- testDeepEqualErr(v219v1, v219v2, t, "equal-map-v219")
- if v == nil {
- v219v2 = nil
- } else {
- v219v2 = make(map[int16]string, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v219v2), bs219, h, t, "dec-map-v219-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v219v1, v219v2, t, "equal-map-v219-noaddr")
- if v == nil {
- v219v2 = nil
- } else {
- v219v2 = make(map[int16]string, len(v))
- } // reset map
- testUnmarshalErr(&v219v2, bs219, h, t, "dec-map-v219-p-len")
- testDeepEqualErr(v219v1, v219v2, t, "equal-map-v219-p-len")
- bs219 = testMarshalErr(&v219v1, h, t, "enc-map-v219-p")
- v219v2 = nil
- testUnmarshalErr(&v219v2, bs219, h, t, "dec-map-v219-p-nil")
- testDeepEqualErr(v219v1, v219v2, t, "equal-map-v219-p-nil")
- // ...
- if v == nil {
- v219v2 = nil
- } else {
- v219v2 = make(map[int16]string, len(v))
- } // reset map
- var v219v3, v219v4 typMapMapInt16String
- v219v3 = typMapMapInt16String(v219v1)
- v219v4 = typMapMapInt16String(v219v2)
- bs219 = testMarshalErr(v219v3, h, t, "enc-map-v219-custom")
- testUnmarshalErr(v219v4, bs219, h, t, "dec-map-v219-p-len")
- testDeepEqualErr(v219v3, v219v4, t, "equal-map-v219-p-len")
- }
-
- for _, v := range []map[int16]uint{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v220: %v\n", v)
- var v220v1, v220v2 map[int16]uint
- v220v1 = v
- bs220 := testMarshalErr(v220v1, h, t, "enc-map-v220")
- if v == nil {
- v220v2 = nil
- } else {
- v220v2 = make(map[int16]uint, len(v))
- } // reset map
- testUnmarshalErr(v220v2, bs220, h, t, "dec-map-v220")
- testDeepEqualErr(v220v1, v220v2, t, "equal-map-v220")
- if v == nil {
- v220v2 = nil
- } else {
- v220v2 = make(map[int16]uint, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v220v2), bs220, h, t, "dec-map-v220-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v220v1, v220v2, t, "equal-map-v220-noaddr")
- if v == nil {
- v220v2 = nil
- } else {
- v220v2 = make(map[int16]uint, len(v))
- } // reset map
- testUnmarshalErr(&v220v2, bs220, h, t, "dec-map-v220-p-len")
- testDeepEqualErr(v220v1, v220v2, t, "equal-map-v220-p-len")
- bs220 = testMarshalErr(&v220v1, h, t, "enc-map-v220-p")
- v220v2 = nil
- testUnmarshalErr(&v220v2, bs220, h, t, "dec-map-v220-p-nil")
- testDeepEqualErr(v220v1, v220v2, t, "equal-map-v220-p-nil")
- // ...
- if v == nil {
- v220v2 = nil
- } else {
- v220v2 = make(map[int16]uint, len(v))
- } // reset map
- var v220v3, v220v4 typMapMapInt16Uint
- v220v3 = typMapMapInt16Uint(v220v1)
- v220v4 = typMapMapInt16Uint(v220v2)
- bs220 = testMarshalErr(v220v3, h, t, "enc-map-v220-custom")
- testUnmarshalErr(v220v4, bs220, h, t, "dec-map-v220-p-len")
- testDeepEqualErr(v220v3, v220v4, t, "equal-map-v220-p-len")
- }
-
- for _, v := range []map[int16]uint8{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v221: %v\n", v)
- var v221v1, v221v2 map[int16]uint8
- v221v1 = v
- bs221 := testMarshalErr(v221v1, h, t, "enc-map-v221")
- if v == nil {
- v221v2 = nil
- } else {
- v221v2 = make(map[int16]uint8, len(v))
- } // reset map
- testUnmarshalErr(v221v2, bs221, h, t, "dec-map-v221")
- testDeepEqualErr(v221v1, v221v2, t, "equal-map-v221")
- if v == nil {
- v221v2 = nil
- } else {
- v221v2 = make(map[int16]uint8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v221v2), bs221, h, t, "dec-map-v221-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v221v1, v221v2, t, "equal-map-v221-noaddr")
- if v == nil {
- v221v2 = nil
- } else {
- v221v2 = make(map[int16]uint8, len(v))
- } // reset map
- testUnmarshalErr(&v221v2, bs221, h, t, "dec-map-v221-p-len")
- testDeepEqualErr(v221v1, v221v2, t, "equal-map-v221-p-len")
- bs221 = testMarshalErr(&v221v1, h, t, "enc-map-v221-p")
- v221v2 = nil
- testUnmarshalErr(&v221v2, bs221, h, t, "dec-map-v221-p-nil")
- testDeepEqualErr(v221v1, v221v2, t, "equal-map-v221-p-nil")
- // ...
- if v == nil {
- v221v2 = nil
- } else {
- v221v2 = make(map[int16]uint8, len(v))
- } // reset map
- var v221v3, v221v4 typMapMapInt16Uint8
- v221v3 = typMapMapInt16Uint8(v221v1)
- v221v4 = typMapMapInt16Uint8(v221v2)
- bs221 = testMarshalErr(v221v3, h, t, "enc-map-v221-custom")
- testUnmarshalErr(v221v4, bs221, h, t, "dec-map-v221-p-len")
- testDeepEqualErr(v221v3, v221v4, t, "equal-map-v221-p-len")
- }
-
- for _, v := range []map[int16]uint16{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v222: %v\n", v)
- var v222v1, v222v2 map[int16]uint16
- v222v1 = v
- bs222 := testMarshalErr(v222v1, h, t, "enc-map-v222")
- if v == nil {
- v222v2 = nil
- } else {
- v222v2 = make(map[int16]uint16, len(v))
- } // reset map
- testUnmarshalErr(v222v2, bs222, h, t, "dec-map-v222")
- testDeepEqualErr(v222v1, v222v2, t, "equal-map-v222")
- if v == nil {
- v222v2 = nil
- } else {
- v222v2 = make(map[int16]uint16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v222v2), bs222, h, t, "dec-map-v222-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v222v1, v222v2, t, "equal-map-v222-noaddr")
- if v == nil {
- v222v2 = nil
- } else {
- v222v2 = make(map[int16]uint16, len(v))
- } // reset map
- testUnmarshalErr(&v222v2, bs222, h, t, "dec-map-v222-p-len")
- testDeepEqualErr(v222v1, v222v2, t, "equal-map-v222-p-len")
- bs222 = testMarshalErr(&v222v1, h, t, "enc-map-v222-p")
- v222v2 = nil
- testUnmarshalErr(&v222v2, bs222, h, t, "dec-map-v222-p-nil")
- testDeepEqualErr(v222v1, v222v2, t, "equal-map-v222-p-nil")
- // ...
- if v == nil {
- v222v2 = nil
- } else {
- v222v2 = make(map[int16]uint16, len(v))
- } // reset map
- var v222v3, v222v4 typMapMapInt16Uint16
- v222v3 = typMapMapInt16Uint16(v222v1)
- v222v4 = typMapMapInt16Uint16(v222v2)
- bs222 = testMarshalErr(v222v3, h, t, "enc-map-v222-custom")
- testUnmarshalErr(v222v4, bs222, h, t, "dec-map-v222-p-len")
- testDeepEqualErr(v222v3, v222v4, t, "equal-map-v222-p-len")
- }
-
- for _, v := range []map[int16]uint32{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v223: %v\n", v)
- var v223v1, v223v2 map[int16]uint32
- v223v1 = v
- bs223 := testMarshalErr(v223v1, h, t, "enc-map-v223")
- if v == nil {
- v223v2 = nil
- } else {
- v223v2 = make(map[int16]uint32, len(v))
- } // reset map
- testUnmarshalErr(v223v2, bs223, h, t, "dec-map-v223")
- testDeepEqualErr(v223v1, v223v2, t, "equal-map-v223")
- if v == nil {
- v223v2 = nil
- } else {
- v223v2 = make(map[int16]uint32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v223v2), bs223, h, t, "dec-map-v223-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v223v1, v223v2, t, "equal-map-v223-noaddr")
- if v == nil {
- v223v2 = nil
- } else {
- v223v2 = make(map[int16]uint32, len(v))
- } // reset map
- testUnmarshalErr(&v223v2, bs223, h, t, "dec-map-v223-p-len")
- testDeepEqualErr(v223v1, v223v2, t, "equal-map-v223-p-len")
- bs223 = testMarshalErr(&v223v1, h, t, "enc-map-v223-p")
- v223v2 = nil
- testUnmarshalErr(&v223v2, bs223, h, t, "dec-map-v223-p-nil")
- testDeepEqualErr(v223v1, v223v2, t, "equal-map-v223-p-nil")
- // ...
- if v == nil {
- v223v2 = nil
- } else {
- v223v2 = make(map[int16]uint32, len(v))
- } // reset map
- var v223v3, v223v4 typMapMapInt16Uint32
- v223v3 = typMapMapInt16Uint32(v223v1)
- v223v4 = typMapMapInt16Uint32(v223v2)
- bs223 = testMarshalErr(v223v3, h, t, "enc-map-v223-custom")
- testUnmarshalErr(v223v4, bs223, h, t, "dec-map-v223-p-len")
- testDeepEqualErr(v223v3, v223v4, t, "equal-map-v223-p-len")
- }
-
- for _, v := range []map[int16]uint64{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v224: %v\n", v)
- var v224v1, v224v2 map[int16]uint64
- v224v1 = v
- bs224 := testMarshalErr(v224v1, h, t, "enc-map-v224")
- if v == nil {
- v224v2 = nil
- } else {
- v224v2 = make(map[int16]uint64, len(v))
- } // reset map
- testUnmarshalErr(v224v2, bs224, h, t, "dec-map-v224")
- testDeepEqualErr(v224v1, v224v2, t, "equal-map-v224")
- if v == nil {
- v224v2 = nil
- } else {
- v224v2 = make(map[int16]uint64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v224v2), bs224, h, t, "dec-map-v224-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v224v1, v224v2, t, "equal-map-v224-noaddr")
- if v == nil {
- v224v2 = nil
- } else {
- v224v2 = make(map[int16]uint64, len(v))
- } // reset map
- testUnmarshalErr(&v224v2, bs224, h, t, "dec-map-v224-p-len")
- testDeepEqualErr(v224v1, v224v2, t, "equal-map-v224-p-len")
- bs224 = testMarshalErr(&v224v1, h, t, "enc-map-v224-p")
- v224v2 = nil
- testUnmarshalErr(&v224v2, bs224, h, t, "dec-map-v224-p-nil")
- testDeepEqualErr(v224v1, v224v2, t, "equal-map-v224-p-nil")
- // ...
- if v == nil {
- v224v2 = nil
- } else {
- v224v2 = make(map[int16]uint64, len(v))
- } // reset map
- var v224v3, v224v4 typMapMapInt16Uint64
- v224v3 = typMapMapInt16Uint64(v224v1)
- v224v4 = typMapMapInt16Uint64(v224v2)
- bs224 = testMarshalErr(v224v3, h, t, "enc-map-v224-custom")
- testUnmarshalErr(v224v4, bs224, h, t, "dec-map-v224-p-len")
- testDeepEqualErr(v224v3, v224v4, t, "equal-map-v224-p-len")
- }
-
- for _, v := range []map[int16]uintptr{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v225: %v\n", v)
- var v225v1, v225v2 map[int16]uintptr
- v225v1 = v
- bs225 := testMarshalErr(v225v1, h, t, "enc-map-v225")
- if v == nil {
- v225v2 = nil
- } else {
- v225v2 = make(map[int16]uintptr, len(v))
- } // reset map
- testUnmarshalErr(v225v2, bs225, h, t, "dec-map-v225")
- testDeepEqualErr(v225v1, v225v2, t, "equal-map-v225")
- if v == nil {
- v225v2 = nil
- } else {
- v225v2 = make(map[int16]uintptr, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v225v2), bs225, h, t, "dec-map-v225-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v225v1, v225v2, t, "equal-map-v225-noaddr")
- if v == nil {
- v225v2 = nil
- } else {
- v225v2 = make(map[int16]uintptr, len(v))
- } // reset map
- testUnmarshalErr(&v225v2, bs225, h, t, "dec-map-v225-p-len")
- testDeepEqualErr(v225v1, v225v2, t, "equal-map-v225-p-len")
- bs225 = testMarshalErr(&v225v1, h, t, "enc-map-v225-p")
- v225v2 = nil
- testUnmarshalErr(&v225v2, bs225, h, t, "dec-map-v225-p-nil")
- testDeepEqualErr(v225v1, v225v2, t, "equal-map-v225-p-nil")
- // ...
- if v == nil {
- v225v2 = nil
- } else {
- v225v2 = make(map[int16]uintptr, len(v))
- } // reset map
- var v225v3, v225v4 typMapMapInt16Uintptr
- v225v3 = typMapMapInt16Uintptr(v225v1)
- v225v4 = typMapMapInt16Uintptr(v225v2)
- bs225 = testMarshalErr(v225v3, h, t, "enc-map-v225-custom")
- testUnmarshalErr(v225v4, bs225, h, t, "dec-map-v225-p-len")
- testDeepEqualErr(v225v3, v225v4, t, "equal-map-v225-p-len")
- }
-
- for _, v := range []map[int16]int{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v226: %v\n", v)
- var v226v1, v226v2 map[int16]int
- v226v1 = v
- bs226 := testMarshalErr(v226v1, h, t, "enc-map-v226")
- if v == nil {
- v226v2 = nil
- } else {
- v226v2 = make(map[int16]int, len(v))
- } // reset map
- testUnmarshalErr(v226v2, bs226, h, t, "dec-map-v226")
- testDeepEqualErr(v226v1, v226v2, t, "equal-map-v226")
- if v == nil {
- v226v2 = nil
- } else {
- v226v2 = make(map[int16]int, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v226v2), bs226, h, t, "dec-map-v226-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v226v1, v226v2, t, "equal-map-v226-noaddr")
- if v == nil {
- v226v2 = nil
- } else {
- v226v2 = make(map[int16]int, len(v))
- } // reset map
- testUnmarshalErr(&v226v2, bs226, h, t, "dec-map-v226-p-len")
- testDeepEqualErr(v226v1, v226v2, t, "equal-map-v226-p-len")
- bs226 = testMarshalErr(&v226v1, h, t, "enc-map-v226-p")
- v226v2 = nil
- testUnmarshalErr(&v226v2, bs226, h, t, "dec-map-v226-p-nil")
- testDeepEqualErr(v226v1, v226v2, t, "equal-map-v226-p-nil")
- // ...
- if v == nil {
- v226v2 = nil
- } else {
- v226v2 = make(map[int16]int, len(v))
- } // reset map
- var v226v3, v226v4 typMapMapInt16Int
- v226v3 = typMapMapInt16Int(v226v1)
- v226v4 = typMapMapInt16Int(v226v2)
- bs226 = testMarshalErr(v226v3, h, t, "enc-map-v226-custom")
- testUnmarshalErr(v226v4, bs226, h, t, "dec-map-v226-p-len")
- testDeepEqualErr(v226v3, v226v4, t, "equal-map-v226-p-len")
- }
-
- for _, v := range []map[int16]int8{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v227: %v\n", v)
- var v227v1, v227v2 map[int16]int8
- v227v1 = v
- bs227 := testMarshalErr(v227v1, h, t, "enc-map-v227")
- if v == nil {
- v227v2 = nil
- } else {
- v227v2 = make(map[int16]int8, len(v))
- } // reset map
- testUnmarshalErr(v227v2, bs227, h, t, "dec-map-v227")
- testDeepEqualErr(v227v1, v227v2, t, "equal-map-v227")
- if v == nil {
- v227v2 = nil
- } else {
- v227v2 = make(map[int16]int8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v227v2), bs227, h, t, "dec-map-v227-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v227v1, v227v2, t, "equal-map-v227-noaddr")
- if v == nil {
- v227v2 = nil
- } else {
- v227v2 = make(map[int16]int8, len(v))
- } // reset map
- testUnmarshalErr(&v227v2, bs227, h, t, "dec-map-v227-p-len")
- testDeepEqualErr(v227v1, v227v2, t, "equal-map-v227-p-len")
- bs227 = testMarshalErr(&v227v1, h, t, "enc-map-v227-p")
- v227v2 = nil
- testUnmarshalErr(&v227v2, bs227, h, t, "dec-map-v227-p-nil")
- testDeepEqualErr(v227v1, v227v2, t, "equal-map-v227-p-nil")
- // ...
- if v == nil {
- v227v2 = nil
- } else {
- v227v2 = make(map[int16]int8, len(v))
- } // reset map
- var v227v3, v227v4 typMapMapInt16Int8
- v227v3 = typMapMapInt16Int8(v227v1)
- v227v4 = typMapMapInt16Int8(v227v2)
- bs227 = testMarshalErr(v227v3, h, t, "enc-map-v227-custom")
- testUnmarshalErr(v227v4, bs227, h, t, "dec-map-v227-p-len")
- testDeepEqualErr(v227v3, v227v4, t, "equal-map-v227-p-len")
- }
-
- for _, v := range []map[int16]int16{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v228: %v\n", v)
- var v228v1, v228v2 map[int16]int16
- v228v1 = v
- bs228 := testMarshalErr(v228v1, h, t, "enc-map-v228")
- if v == nil {
- v228v2 = nil
- } else {
- v228v2 = make(map[int16]int16, len(v))
- } // reset map
- testUnmarshalErr(v228v2, bs228, h, t, "dec-map-v228")
- testDeepEqualErr(v228v1, v228v2, t, "equal-map-v228")
- if v == nil {
- v228v2 = nil
- } else {
- v228v2 = make(map[int16]int16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v228v2), bs228, h, t, "dec-map-v228-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v228v1, v228v2, t, "equal-map-v228-noaddr")
- if v == nil {
- v228v2 = nil
- } else {
- v228v2 = make(map[int16]int16, len(v))
- } // reset map
- testUnmarshalErr(&v228v2, bs228, h, t, "dec-map-v228-p-len")
- testDeepEqualErr(v228v1, v228v2, t, "equal-map-v228-p-len")
- bs228 = testMarshalErr(&v228v1, h, t, "enc-map-v228-p")
- v228v2 = nil
- testUnmarshalErr(&v228v2, bs228, h, t, "dec-map-v228-p-nil")
- testDeepEqualErr(v228v1, v228v2, t, "equal-map-v228-p-nil")
- // ...
- if v == nil {
- v228v2 = nil
- } else {
- v228v2 = make(map[int16]int16, len(v))
- } // reset map
- var v228v3, v228v4 typMapMapInt16Int16
- v228v3 = typMapMapInt16Int16(v228v1)
- v228v4 = typMapMapInt16Int16(v228v2)
- bs228 = testMarshalErr(v228v3, h, t, "enc-map-v228-custom")
- testUnmarshalErr(v228v4, bs228, h, t, "dec-map-v228-p-len")
- testDeepEqualErr(v228v3, v228v4, t, "equal-map-v228-p-len")
- }
-
- for _, v := range []map[int16]int32{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v229: %v\n", v)
- var v229v1, v229v2 map[int16]int32
- v229v1 = v
- bs229 := testMarshalErr(v229v1, h, t, "enc-map-v229")
- if v == nil {
- v229v2 = nil
- } else {
- v229v2 = make(map[int16]int32, len(v))
- } // reset map
- testUnmarshalErr(v229v2, bs229, h, t, "dec-map-v229")
- testDeepEqualErr(v229v1, v229v2, t, "equal-map-v229")
- if v == nil {
- v229v2 = nil
- } else {
- v229v2 = make(map[int16]int32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v229v2), bs229, h, t, "dec-map-v229-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v229v1, v229v2, t, "equal-map-v229-noaddr")
- if v == nil {
- v229v2 = nil
- } else {
- v229v2 = make(map[int16]int32, len(v))
- } // reset map
- testUnmarshalErr(&v229v2, bs229, h, t, "dec-map-v229-p-len")
- testDeepEqualErr(v229v1, v229v2, t, "equal-map-v229-p-len")
- bs229 = testMarshalErr(&v229v1, h, t, "enc-map-v229-p")
- v229v2 = nil
- testUnmarshalErr(&v229v2, bs229, h, t, "dec-map-v229-p-nil")
- testDeepEqualErr(v229v1, v229v2, t, "equal-map-v229-p-nil")
- // ...
- if v == nil {
- v229v2 = nil
- } else {
- v229v2 = make(map[int16]int32, len(v))
- } // reset map
- var v229v3, v229v4 typMapMapInt16Int32
- v229v3 = typMapMapInt16Int32(v229v1)
- v229v4 = typMapMapInt16Int32(v229v2)
- bs229 = testMarshalErr(v229v3, h, t, "enc-map-v229-custom")
- testUnmarshalErr(v229v4, bs229, h, t, "dec-map-v229-p-len")
- testDeepEqualErr(v229v3, v229v4, t, "equal-map-v229-p-len")
- }
-
- for _, v := range []map[int16]int64{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v230: %v\n", v)
- var v230v1, v230v2 map[int16]int64
- v230v1 = v
- bs230 := testMarshalErr(v230v1, h, t, "enc-map-v230")
- if v == nil {
- v230v2 = nil
- } else {
- v230v2 = make(map[int16]int64, len(v))
- } // reset map
- testUnmarshalErr(v230v2, bs230, h, t, "dec-map-v230")
- testDeepEqualErr(v230v1, v230v2, t, "equal-map-v230")
- if v == nil {
- v230v2 = nil
- } else {
- v230v2 = make(map[int16]int64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v230v2), bs230, h, t, "dec-map-v230-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v230v1, v230v2, t, "equal-map-v230-noaddr")
- if v == nil {
- v230v2 = nil
- } else {
- v230v2 = make(map[int16]int64, len(v))
- } // reset map
- testUnmarshalErr(&v230v2, bs230, h, t, "dec-map-v230-p-len")
- testDeepEqualErr(v230v1, v230v2, t, "equal-map-v230-p-len")
- bs230 = testMarshalErr(&v230v1, h, t, "enc-map-v230-p")
- v230v2 = nil
- testUnmarshalErr(&v230v2, bs230, h, t, "dec-map-v230-p-nil")
- testDeepEqualErr(v230v1, v230v2, t, "equal-map-v230-p-nil")
- // ...
- if v == nil {
- v230v2 = nil
- } else {
- v230v2 = make(map[int16]int64, len(v))
- } // reset map
- var v230v3, v230v4 typMapMapInt16Int64
- v230v3 = typMapMapInt16Int64(v230v1)
- v230v4 = typMapMapInt16Int64(v230v2)
- bs230 = testMarshalErr(v230v3, h, t, "enc-map-v230-custom")
- testUnmarshalErr(v230v4, bs230, h, t, "dec-map-v230-p-len")
- testDeepEqualErr(v230v3, v230v4, t, "equal-map-v230-p-len")
- }
-
- for _, v := range []map[int16]float32{nil, {}, {33: 0, 44: 22.2}} {
- // fmt.Printf(">>>> running mammoth map v231: %v\n", v)
- var v231v1, v231v2 map[int16]float32
- v231v1 = v
- bs231 := testMarshalErr(v231v1, h, t, "enc-map-v231")
- if v == nil {
- v231v2 = nil
- } else {
- v231v2 = make(map[int16]float32, len(v))
- } // reset map
- testUnmarshalErr(v231v2, bs231, h, t, "dec-map-v231")
- testDeepEqualErr(v231v1, v231v2, t, "equal-map-v231")
- if v == nil {
- v231v2 = nil
- } else {
- v231v2 = make(map[int16]float32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v231v2), bs231, h, t, "dec-map-v231-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v231v1, v231v2, t, "equal-map-v231-noaddr")
- if v == nil {
- v231v2 = nil
- } else {
- v231v2 = make(map[int16]float32, len(v))
- } // reset map
- testUnmarshalErr(&v231v2, bs231, h, t, "dec-map-v231-p-len")
- testDeepEqualErr(v231v1, v231v2, t, "equal-map-v231-p-len")
- bs231 = testMarshalErr(&v231v1, h, t, "enc-map-v231-p")
- v231v2 = nil
- testUnmarshalErr(&v231v2, bs231, h, t, "dec-map-v231-p-nil")
- testDeepEqualErr(v231v1, v231v2, t, "equal-map-v231-p-nil")
- // ...
- if v == nil {
- v231v2 = nil
- } else {
- v231v2 = make(map[int16]float32, len(v))
- } // reset map
- var v231v3, v231v4 typMapMapInt16Float32
- v231v3 = typMapMapInt16Float32(v231v1)
- v231v4 = typMapMapInt16Float32(v231v2)
- bs231 = testMarshalErr(v231v3, h, t, "enc-map-v231-custom")
- testUnmarshalErr(v231v4, bs231, h, t, "dec-map-v231-p-len")
- testDeepEqualErr(v231v3, v231v4, t, "equal-map-v231-p-len")
- }
-
- for _, v := range []map[int16]float64{nil, {}, {33: 0, 44: 11.1}} {
- // fmt.Printf(">>>> running mammoth map v232: %v\n", v)
- var v232v1, v232v2 map[int16]float64
- v232v1 = v
- bs232 := testMarshalErr(v232v1, h, t, "enc-map-v232")
- if v == nil {
- v232v2 = nil
- } else {
- v232v2 = make(map[int16]float64, len(v))
- } // reset map
- testUnmarshalErr(v232v2, bs232, h, t, "dec-map-v232")
- testDeepEqualErr(v232v1, v232v2, t, "equal-map-v232")
- if v == nil {
- v232v2 = nil
- } else {
- v232v2 = make(map[int16]float64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v232v2), bs232, h, t, "dec-map-v232-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v232v1, v232v2, t, "equal-map-v232-noaddr")
- if v == nil {
- v232v2 = nil
- } else {
- v232v2 = make(map[int16]float64, len(v))
- } // reset map
- testUnmarshalErr(&v232v2, bs232, h, t, "dec-map-v232-p-len")
- testDeepEqualErr(v232v1, v232v2, t, "equal-map-v232-p-len")
- bs232 = testMarshalErr(&v232v1, h, t, "enc-map-v232-p")
- v232v2 = nil
- testUnmarshalErr(&v232v2, bs232, h, t, "dec-map-v232-p-nil")
- testDeepEqualErr(v232v1, v232v2, t, "equal-map-v232-p-nil")
- // ...
- if v == nil {
- v232v2 = nil
- } else {
- v232v2 = make(map[int16]float64, len(v))
- } // reset map
- var v232v3, v232v4 typMapMapInt16Float64
- v232v3 = typMapMapInt16Float64(v232v1)
- v232v4 = typMapMapInt16Float64(v232v2)
- bs232 = testMarshalErr(v232v3, h, t, "enc-map-v232-custom")
- testUnmarshalErr(v232v4, bs232, h, t, "dec-map-v232-p-len")
- testDeepEqualErr(v232v3, v232v4, t, "equal-map-v232-p-len")
- }
-
- for _, v := range []map[int16]bool{nil, {}, {33: false, 44: true}} {
- // fmt.Printf(">>>> running mammoth map v233: %v\n", v)
- var v233v1, v233v2 map[int16]bool
- v233v1 = v
- bs233 := testMarshalErr(v233v1, h, t, "enc-map-v233")
- if v == nil {
- v233v2 = nil
- } else {
- v233v2 = make(map[int16]bool, len(v))
- } // reset map
- testUnmarshalErr(v233v2, bs233, h, t, "dec-map-v233")
- testDeepEqualErr(v233v1, v233v2, t, "equal-map-v233")
- if v == nil {
- v233v2 = nil
- } else {
- v233v2 = make(map[int16]bool, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v233v2), bs233, h, t, "dec-map-v233-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v233v1, v233v2, t, "equal-map-v233-noaddr")
- if v == nil {
- v233v2 = nil
- } else {
- v233v2 = make(map[int16]bool, len(v))
- } // reset map
- testUnmarshalErr(&v233v2, bs233, h, t, "dec-map-v233-p-len")
- testDeepEqualErr(v233v1, v233v2, t, "equal-map-v233-p-len")
- bs233 = testMarshalErr(&v233v1, h, t, "enc-map-v233-p")
- v233v2 = nil
- testUnmarshalErr(&v233v2, bs233, h, t, "dec-map-v233-p-nil")
- testDeepEqualErr(v233v1, v233v2, t, "equal-map-v233-p-nil")
- // ...
- if v == nil {
- v233v2 = nil
- } else {
- v233v2 = make(map[int16]bool, len(v))
- } // reset map
- var v233v3, v233v4 typMapMapInt16Bool
- v233v3 = typMapMapInt16Bool(v233v1)
- v233v4 = typMapMapInt16Bool(v233v2)
- bs233 = testMarshalErr(v233v3, h, t, "enc-map-v233-custom")
- testUnmarshalErr(v233v4, bs233, h, t, "dec-map-v233-p-len")
- testDeepEqualErr(v233v3, v233v4, t, "equal-map-v233-p-len")
- }
-
- for _, v := range []map[int32]interface{}{nil, {}, {33: nil, 44: "string-is-an-interface"}} {
- // fmt.Printf(">>>> running mammoth map v236: %v\n", v)
- var v236v1, v236v2 map[int32]interface{}
- v236v1 = v
- bs236 := testMarshalErr(v236v1, h, t, "enc-map-v236")
- if v == nil {
- v236v2 = nil
- } else {
- v236v2 = make(map[int32]interface{}, len(v))
- } // reset map
- testUnmarshalErr(v236v2, bs236, h, t, "dec-map-v236")
- testDeepEqualErr(v236v1, v236v2, t, "equal-map-v236")
- if v == nil {
- v236v2 = nil
- } else {
- v236v2 = make(map[int32]interface{}, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v236v2), bs236, h, t, "dec-map-v236-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v236v1, v236v2, t, "equal-map-v236-noaddr")
- if v == nil {
- v236v2 = nil
- } else {
- v236v2 = make(map[int32]interface{}, len(v))
- } // reset map
- testUnmarshalErr(&v236v2, bs236, h, t, "dec-map-v236-p-len")
- testDeepEqualErr(v236v1, v236v2, t, "equal-map-v236-p-len")
- bs236 = testMarshalErr(&v236v1, h, t, "enc-map-v236-p")
- v236v2 = nil
- testUnmarshalErr(&v236v2, bs236, h, t, "dec-map-v236-p-nil")
- testDeepEqualErr(v236v1, v236v2, t, "equal-map-v236-p-nil")
- // ...
- if v == nil {
- v236v2 = nil
- } else {
- v236v2 = make(map[int32]interface{}, len(v))
- } // reset map
- var v236v3, v236v4 typMapMapInt32Intf
- v236v3 = typMapMapInt32Intf(v236v1)
- v236v4 = typMapMapInt32Intf(v236v2)
- bs236 = testMarshalErr(v236v3, h, t, "enc-map-v236-custom")
- testUnmarshalErr(v236v4, bs236, h, t, "dec-map-v236-p-len")
- testDeepEqualErr(v236v3, v236v4, t, "equal-map-v236-p-len")
- }
-
- for _, v := range []map[int32]string{nil, {}, {33: "", 44: "some-string"}} {
- // fmt.Printf(">>>> running mammoth map v237: %v\n", v)
- var v237v1, v237v2 map[int32]string
- v237v1 = v
- bs237 := testMarshalErr(v237v1, h, t, "enc-map-v237")
- if v == nil {
- v237v2 = nil
- } else {
- v237v2 = make(map[int32]string, len(v))
- } // reset map
- testUnmarshalErr(v237v2, bs237, h, t, "dec-map-v237")
- testDeepEqualErr(v237v1, v237v2, t, "equal-map-v237")
- if v == nil {
- v237v2 = nil
- } else {
- v237v2 = make(map[int32]string, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v237v2), bs237, h, t, "dec-map-v237-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v237v1, v237v2, t, "equal-map-v237-noaddr")
- if v == nil {
- v237v2 = nil
- } else {
- v237v2 = make(map[int32]string, len(v))
- } // reset map
- testUnmarshalErr(&v237v2, bs237, h, t, "dec-map-v237-p-len")
- testDeepEqualErr(v237v1, v237v2, t, "equal-map-v237-p-len")
- bs237 = testMarshalErr(&v237v1, h, t, "enc-map-v237-p")
- v237v2 = nil
- testUnmarshalErr(&v237v2, bs237, h, t, "dec-map-v237-p-nil")
- testDeepEqualErr(v237v1, v237v2, t, "equal-map-v237-p-nil")
- // ...
- if v == nil {
- v237v2 = nil
- } else {
- v237v2 = make(map[int32]string, len(v))
- } // reset map
- var v237v3, v237v4 typMapMapInt32String
- v237v3 = typMapMapInt32String(v237v1)
- v237v4 = typMapMapInt32String(v237v2)
- bs237 = testMarshalErr(v237v3, h, t, "enc-map-v237-custom")
- testUnmarshalErr(v237v4, bs237, h, t, "dec-map-v237-p-len")
- testDeepEqualErr(v237v3, v237v4, t, "equal-map-v237-p-len")
- }
-
- for _, v := range []map[int32]uint{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v238: %v\n", v)
- var v238v1, v238v2 map[int32]uint
- v238v1 = v
- bs238 := testMarshalErr(v238v1, h, t, "enc-map-v238")
- if v == nil {
- v238v2 = nil
- } else {
- v238v2 = make(map[int32]uint, len(v))
- } // reset map
- testUnmarshalErr(v238v2, bs238, h, t, "dec-map-v238")
- testDeepEqualErr(v238v1, v238v2, t, "equal-map-v238")
- if v == nil {
- v238v2 = nil
- } else {
- v238v2 = make(map[int32]uint, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v238v2), bs238, h, t, "dec-map-v238-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v238v1, v238v2, t, "equal-map-v238-noaddr")
- if v == nil {
- v238v2 = nil
- } else {
- v238v2 = make(map[int32]uint, len(v))
- } // reset map
- testUnmarshalErr(&v238v2, bs238, h, t, "dec-map-v238-p-len")
- testDeepEqualErr(v238v1, v238v2, t, "equal-map-v238-p-len")
- bs238 = testMarshalErr(&v238v1, h, t, "enc-map-v238-p")
- v238v2 = nil
- testUnmarshalErr(&v238v2, bs238, h, t, "dec-map-v238-p-nil")
- testDeepEqualErr(v238v1, v238v2, t, "equal-map-v238-p-nil")
- // ...
- if v == nil {
- v238v2 = nil
- } else {
- v238v2 = make(map[int32]uint, len(v))
- } // reset map
- var v238v3, v238v4 typMapMapInt32Uint
- v238v3 = typMapMapInt32Uint(v238v1)
- v238v4 = typMapMapInt32Uint(v238v2)
- bs238 = testMarshalErr(v238v3, h, t, "enc-map-v238-custom")
- testUnmarshalErr(v238v4, bs238, h, t, "dec-map-v238-p-len")
- testDeepEqualErr(v238v3, v238v4, t, "equal-map-v238-p-len")
- }
-
- for _, v := range []map[int32]uint8{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v239: %v\n", v)
- var v239v1, v239v2 map[int32]uint8
- v239v1 = v
- bs239 := testMarshalErr(v239v1, h, t, "enc-map-v239")
- if v == nil {
- v239v2 = nil
- } else {
- v239v2 = make(map[int32]uint8, len(v))
- } // reset map
- testUnmarshalErr(v239v2, bs239, h, t, "dec-map-v239")
- testDeepEqualErr(v239v1, v239v2, t, "equal-map-v239")
- if v == nil {
- v239v2 = nil
- } else {
- v239v2 = make(map[int32]uint8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v239v2), bs239, h, t, "dec-map-v239-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v239v1, v239v2, t, "equal-map-v239-noaddr")
- if v == nil {
- v239v2 = nil
- } else {
- v239v2 = make(map[int32]uint8, len(v))
- } // reset map
- testUnmarshalErr(&v239v2, bs239, h, t, "dec-map-v239-p-len")
- testDeepEqualErr(v239v1, v239v2, t, "equal-map-v239-p-len")
- bs239 = testMarshalErr(&v239v1, h, t, "enc-map-v239-p")
- v239v2 = nil
- testUnmarshalErr(&v239v2, bs239, h, t, "dec-map-v239-p-nil")
- testDeepEqualErr(v239v1, v239v2, t, "equal-map-v239-p-nil")
- // ...
- if v == nil {
- v239v2 = nil
- } else {
- v239v2 = make(map[int32]uint8, len(v))
- } // reset map
- var v239v3, v239v4 typMapMapInt32Uint8
- v239v3 = typMapMapInt32Uint8(v239v1)
- v239v4 = typMapMapInt32Uint8(v239v2)
- bs239 = testMarshalErr(v239v3, h, t, "enc-map-v239-custom")
- testUnmarshalErr(v239v4, bs239, h, t, "dec-map-v239-p-len")
- testDeepEqualErr(v239v3, v239v4, t, "equal-map-v239-p-len")
- }
-
- for _, v := range []map[int32]uint16{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v240: %v\n", v)
- var v240v1, v240v2 map[int32]uint16
- v240v1 = v
- bs240 := testMarshalErr(v240v1, h, t, "enc-map-v240")
- if v == nil {
- v240v2 = nil
- } else {
- v240v2 = make(map[int32]uint16, len(v))
- } // reset map
- testUnmarshalErr(v240v2, bs240, h, t, "dec-map-v240")
- testDeepEqualErr(v240v1, v240v2, t, "equal-map-v240")
- if v == nil {
- v240v2 = nil
- } else {
- v240v2 = make(map[int32]uint16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v240v2), bs240, h, t, "dec-map-v240-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v240v1, v240v2, t, "equal-map-v240-noaddr")
- if v == nil {
- v240v2 = nil
- } else {
- v240v2 = make(map[int32]uint16, len(v))
- } // reset map
- testUnmarshalErr(&v240v2, bs240, h, t, "dec-map-v240-p-len")
- testDeepEqualErr(v240v1, v240v2, t, "equal-map-v240-p-len")
- bs240 = testMarshalErr(&v240v1, h, t, "enc-map-v240-p")
- v240v2 = nil
- testUnmarshalErr(&v240v2, bs240, h, t, "dec-map-v240-p-nil")
- testDeepEqualErr(v240v1, v240v2, t, "equal-map-v240-p-nil")
- // ...
- if v == nil {
- v240v2 = nil
- } else {
- v240v2 = make(map[int32]uint16, len(v))
- } // reset map
- var v240v3, v240v4 typMapMapInt32Uint16
- v240v3 = typMapMapInt32Uint16(v240v1)
- v240v4 = typMapMapInt32Uint16(v240v2)
- bs240 = testMarshalErr(v240v3, h, t, "enc-map-v240-custom")
- testUnmarshalErr(v240v4, bs240, h, t, "dec-map-v240-p-len")
- testDeepEqualErr(v240v3, v240v4, t, "equal-map-v240-p-len")
- }
-
- for _, v := range []map[int32]uint32{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v241: %v\n", v)
- var v241v1, v241v2 map[int32]uint32
- v241v1 = v
- bs241 := testMarshalErr(v241v1, h, t, "enc-map-v241")
- if v == nil {
- v241v2 = nil
- } else {
- v241v2 = make(map[int32]uint32, len(v))
- } // reset map
- testUnmarshalErr(v241v2, bs241, h, t, "dec-map-v241")
- testDeepEqualErr(v241v1, v241v2, t, "equal-map-v241")
- if v == nil {
- v241v2 = nil
- } else {
- v241v2 = make(map[int32]uint32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v241v2), bs241, h, t, "dec-map-v241-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v241v1, v241v2, t, "equal-map-v241-noaddr")
- if v == nil {
- v241v2 = nil
- } else {
- v241v2 = make(map[int32]uint32, len(v))
- } // reset map
- testUnmarshalErr(&v241v2, bs241, h, t, "dec-map-v241-p-len")
- testDeepEqualErr(v241v1, v241v2, t, "equal-map-v241-p-len")
- bs241 = testMarshalErr(&v241v1, h, t, "enc-map-v241-p")
- v241v2 = nil
- testUnmarshalErr(&v241v2, bs241, h, t, "dec-map-v241-p-nil")
- testDeepEqualErr(v241v1, v241v2, t, "equal-map-v241-p-nil")
- // ...
- if v == nil {
- v241v2 = nil
- } else {
- v241v2 = make(map[int32]uint32, len(v))
- } // reset map
- var v241v3, v241v4 typMapMapInt32Uint32
- v241v3 = typMapMapInt32Uint32(v241v1)
- v241v4 = typMapMapInt32Uint32(v241v2)
- bs241 = testMarshalErr(v241v3, h, t, "enc-map-v241-custom")
- testUnmarshalErr(v241v4, bs241, h, t, "dec-map-v241-p-len")
- testDeepEqualErr(v241v3, v241v4, t, "equal-map-v241-p-len")
- }
-
- for _, v := range []map[int32]uint64{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v242: %v\n", v)
- var v242v1, v242v2 map[int32]uint64
- v242v1 = v
- bs242 := testMarshalErr(v242v1, h, t, "enc-map-v242")
- if v == nil {
- v242v2 = nil
- } else {
- v242v2 = make(map[int32]uint64, len(v))
- } // reset map
- testUnmarshalErr(v242v2, bs242, h, t, "dec-map-v242")
- testDeepEqualErr(v242v1, v242v2, t, "equal-map-v242")
- if v == nil {
- v242v2 = nil
- } else {
- v242v2 = make(map[int32]uint64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v242v2), bs242, h, t, "dec-map-v242-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v242v1, v242v2, t, "equal-map-v242-noaddr")
- if v == nil {
- v242v2 = nil
- } else {
- v242v2 = make(map[int32]uint64, len(v))
- } // reset map
- testUnmarshalErr(&v242v2, bs242, h, t, "dec-map-v242-p-len")
- testDeepEqualErr(v242v1, v242v2, t, "equal-map-v242-p-len")
- bs242 = testMarshalErr(&v242v1, h, t, "enc-map-v242-p")
- v242v2 = nil
- testUnmarshalErr(&v242v2, bs242, h, t, "dec-map-v242-p-nil")
- testDeepEqualErr(v242v1, v242v2, t, "equal-map-v242-p-nil")
- // ...
- if v == nil {
- v242v2 = nil
- } else {
- v242v2 = make(map[int32]uint64, len(v))
- } // reset map
- var v242v3, v242v4 typMapMapInt32Uint64
- v242v3 = typMapMapInt32Uint64(v242v1)
- v242v4 = typMapMapInt32Uint64(v242v2)
- bs242 = testMarshalErr(v242v3, h, t, "enc-map-v242-custom")
- testUnmarshalErr(v242v4, bs242, h, t, "dec-map-v242-p-len")
- testDeepEqualErr(v242v3, v242v4, t, "equal-map-v242-p-len")
- }
-
- for _, v := range []map[int32]uintptr{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v243: %v\n", v)
- var v243v1, v243v2 map[int32]uintptr
- v243v1 = v
- bs243 := testMarshalErr(v243v1, h, t, "enc-map-v243")
- if v == nil {
- v243v2 = nil
- } else {
- v243v2 = make(map[int32]uintptr, len(v))
- } // reset map
- testUnmarshalErr(v243v2, bs243, h, t, "dec-map-v243")
- testDeepEqualErr(v243v1, v243v2, t, "equal-map-v243")
- if v == nil {
- v243v2 = nil
- } else {
- v243v2 = make(map[int32]uintptr, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v243v2), bs243, h, t, "dec-map-v243-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v243v1, v243v2, t, "equal-map-v243-noaddr")
- if v == nil {
- v243v2 = nil
- } else {
- v243v2 = make(map[int32]uintptr, len(v))
- } // reset map
- testUnmarshalErr(&v243v2, bs243, h, t, "dec-map-v243-p-len")
- testDeepEqualErr(v243v1, v243v2, t, "equal-map-v243-p-len")
- bs243 = testMarshalErr(&v243v1, h, t, "enc-map-v243-p")
- v243v2 = nil
- testUnmarshalErr(&v243v2, bs243, h, t, "dec-map-v243-p-nil")
- testDeepEqualErr(v243v1, v243v2, t, "equal-map-v243-p-nil")
- // ...
- if v == nil {
- v243v2 = nil
- } else {
- v243v2 = make(map[int32]uintptr, len(v))
- } // reset map
- var v243v3, v243v4 typMapMapInt32Uintptr
- v243v3 = typMapMapInt32Uintptr(v243v1)
- v243v4 = typMapMapInt32Uintptr(v243v2)
- bs243 = testMarshalErr(v243v3, h, t, "enc-map-v243-custom")
- testUnmarshalErr(v243v4, bs243, h, t, "dec-map-v243-p-len")
- testDeepEqualErr(v243v3, v243v4, t, "equal-map-v243-p-len")
- }
-
- for _, v := range []map[int32]int{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v244: %v\n", v)
- var v244v1, v244v2 map[int32]int
- v244v1 = v
- bs244 := testMarshalErr(v244v1, h, t, "enc-map-v244")
- if v == nil {
- v244v2 = nil
- } else {
- v244v2 = make(map[int32]int, len(v))
- } // reset map
- testUnmarshalErr(v244v2, bs244, h, t, "dec-map-v244")
- testDeepEqualErr(v244v1, v244v2, t, "equal-map-v244")
- if v == nil {
- v244v2 = nil
- } else {
- v244v2 = make(map[int32]int, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v244v2), bs244, h, t, "dec-map-v244-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v244v1, v244v2, t, "equal-map-v244-noaddr")
- if v == nil {
- v244v2 = nil
- } else {
- v244v2 = make(map[int32]int, len(v))
- } // reset map
- testUnmarshalErr(&v244v2, bs244, h, t, "dec-map-v244-p-len")
- testDeepEqualErr(v244v1, v244v2, t, "equal-map-v244-p-len")
- bs244 = testMarshalErr(&v244v1, h, t, "enc-map-v244-p")
- v244v2 = nil
- testUnmarshalErr(&v244v2, bs244, h, t, "dec-map-v244-p-nil")
- testDeepEqualErr(v244v1, v244v2, t, "equal-map-v244-p-nil")
- // ...
- if v == nil {
- v244v2 = nil
- } else {
- v244v2 = make(map[int32]int, len(v))
- } // reset map
- var v244v3, v244v4 typMapMapInt32Int
- v244v3 = typMapMapInt32Int(v244v1)
- v244v4 = typMapMapInt32Int(v244v2)
- bs244 = testMarshalErr(v244v3, h, t, "enc-map-v244-custom")
- testUnmarshalErr(v244v4, bs244, h, t, "dec-map-v244-p-len")
- testDeepEqualErr(v244v3, v244v4, t, "equal-map-v244-p-len")
- }
-
- for _, v := range []map[int32]int8{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v245: %v\n", v)
- var v245v1, v245v2 map[int32]int8
- v245v1 = v
- bs245 := testMarshalErr(v245v1, h, t, "enc-map-v245")
- if v == nil {
- v245v2 = nil
- } else {
- v245v2 = make(map[int32]int8, len(v))
- } // reset map
- testUnmarshalErr(v245v2, bs245, h, t, "dec-map-v245")
- testDeepEqualErr(v245v1, v245v2, t, "equal-map-v245")
- if v == nil {
- v245v2 = nil
- } else {
- v245v2 = make(map[int32]int8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v245v2), bs245, h, t, "dec-map-v245-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v245v1, v245v2, t, "equal-map-v245-noaddr")
- if v == nil {
- v245v2 = nil
- } else {
- v245v2 = make(map[int32]int8, len(v))
- } // reset map
- testUnmarshalErr(&v245v2, bs245, h, t, "dec-map-v245-p-len")
- testDeepEqualErr(v245v1, v245v2, t, "equal-map-v245-p-len")
- bs245 = testMarshalErr(&v245v1, h, t, "enc-map-v245-p")
- v245v2 = nil
- testUnmarshalErr(&v245v2, bs245, h, t, "dec-map-v245-p-nil")
- testDeepEqualErr(v245v1, v245v2, t, "equal-map-v245-p-nil")
- // ...
- if v == nil {
- v245v2 = nil
- } else {
- v245v2 = make(map[int32]int8, len(v))
- } // reset map
- var v245v3, v245v4 typMapMapInt32Int8
- v245v3 = typMapMapInt32Int8(v245v1)
- v245v4 = typMapMapInt32Int8(v245v2)
- bs245 = testMarshalErr(v245v3, h, t, "enc-map-v245-custom")
- testUnmarshalErr(v245v4, bs245, h, t, "dec-map-v245-p-len")
- testDeepEqualErr(v245v3, v245v4, t, "equal-map-v245-p-len")
- }
-
- for _, v := range []map[int32]int16{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v246: %v\n", v)
- var v246v1, v246v2 map[int32]int16
- v246v1 = v
- bs246 := testMarshalErr(v246v1, h, t, "enc-map-v246")
- if v == nil {
- v246v2 = nil
- } else {
- v246v2 = make(map[int32]int16, len(v))
- } // reset map
- testUnmarshalErr(v246v2, bs246, h, t, "dec-map-v246")
- testDeepEqualErr(v246v1, v246v2, t, "equal-map-v246")
- if v == nil {
- v246v2 = nil
- } else {
- v246v2 = make(map[int32]int16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v246v2), bs246, h, t, "dec-map-v246-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v246v1, v246v2, t, "equal-map-v246-noaddr")
- if v == nil {
- v246v2 = nil
- } else {
- v246v2 = make(map[int32]int16, len(v))
- } // reset map
- testUnmarshalErr(&v246v2, bs246, h, t, "dec-map-v246-p-len")
- testDeepEqualErr(v246v1, v246v2, t, "equal-map-v246-p-len")
- bs246 = testMarshalErr(&v246v1, h, t, "enc-map-v246-p")
- v246v2 = nil
- testUnmarshalErr(&v246v2, bs246, h, t, "dec-map-v246-p-nil")
- testDeepEqualErr(v246v1, v246v2, t, "equal-map-v246-p-nil")
- // ...
- if v == nil {
- v246v2 = nil
- } else {
- v246v2 = make(map[int32]int16, len(v))
- } // reset map
- var v246v3, v246v4 typMapMapInt32Int16
- v246v3 = typMapMapInt32Int16(v246v1)
- v246v4 = typMapMapInt32Int16(v246v2)
- bs246 = testMarshalErr(v246v3, h, t, "enc-map-v246-custom")
- testUnmarshalErr(v246v4, bs246, h, t, "dec-map-v246-p-len")
- testDeepEqualErr(v246v3, v246v4, t, "equal-map-v246-p-len")
- }
-
- for _, v := range []map[int32]int32{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v247: %v\n", v)
- var v247v1, v247v2 map[int32]int32
- v247v1 = v
- bs247 := testMarshalErr(v247v1, h, t, "enc-map-v247")
- if v == nil {
- v247v2 = nil
- } else {
- v247v2 = make(map[int32]int32, len(v))
- } // reset map
- testUnmarshalErr(v247v2, bs247, h, t, "dec-map-v247")
- testDeepEqualErr(v247v1, v247v2, t, "equal-map-v247")
- if v == nil {
- v247v2 = nil
- } else {
- v247v2 = make(map[int32]int32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v247v2), bs247, h, t, "dec-map-v247-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v247v1, v247v2, t, "equal-map-v247-noaddr")
- if v == nil {
- v247v2 = nil
- } else {
- v247v2 = make(map[int32]int32, len(v))
- } // reset map
- testUnmarshalErr(&v247v2, bs247, h, t, "dec-map-v247-p-len")
- testDeepEqualErr(v247v1, v247v2, t, "equal-map-v247-p-len")
- bs247 = testMarshalErr(&v247v1, h, t, "enc-map-v247-p")
- v247v2 = nil
- testUnmarshalErr(&v247v2, bs247, h, t, "dec-map-v247-p-nil")
- testDeepEqualErr(v247v1, v247v2, t, "equal-map-v247-p-nil")
- // ...
- if v == nil {
- v247v2 = nil
- } else {
- v247v2 = make(map[int32]int32, len(v))
- } // reset map
- var v247v3, v247v4 typMapMapInt32Int32
- v247v3 = typMapMapInt32Int32(v247v1)
- v247v4 = typMapMapInt32Int32(v247v2)
- bs247 = testMarshalErr(v247v3, h, t, "enc-map-v247-custom")
- testUnmarshalErr(v247v4, bs247, h, t, "dec-map-v247-p-len")
- testDeepEqualErr(v247v3, v247v4, t, "equal-map-v247-p-len")
- }
-
- for _, v := range []map[int32]int64{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v248: %v\n", v)
- var v248v1, v248v2 map[int32]int64
- v248v1 = v
- bs248 := testMarshalErr(v248v1, h, t, "enc-map-v248")
- if v == nil {
- v248v2 = nil
- } else {
- v248v2 = make(map[int32]int64, len(v))
- } // reset map
- testUnmarshalErr(v248v2, bs248, h, t, "dec-map-v248")
- testDeepEqualErr(v248v1, v248v2, t, "equal-map-v248")
- if v == nil {
- v248v2 = nil
- } else {
- v248v2 = make(map[int32]int64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v248v2), bs248, h, t, "dec-map-v248-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v248v1, v248v2, t, "equal-map-v248-noaddr")
- if v == nil {
- v248v2 = nil
- } else {
- v248v2 = make(map[int32]int64, len(v))
- } // reset map
- testUnmarshalErr(&v248v2, bs248, h, t, "dec-map-v248-p-len")
- testDeepEqualErr(v248v1, v248v2, t, "equal-map-v248-p-len")
- bs248 = testMarshalErr(&v248v1, h, t, "enc-map-v248-p")
- v248v2 = nil
- testUnmarshalErr(&v248v2, bs248, h, t, "dec-map-v248-p-nil")
- testDeepEqualErr(v248v1, v248v2, t, "equal-map-v248-p-nil")
- // ...
- if v == nil {
- v248v2 = nil
- } else {
- v248v2 = make(map[int32]int64, len(v))
- } // reset map
- var v248v3, v248v4 typMapMapInt32Int64
- v248v3 = typMapMapInt32Int64(v248v1)
- v248v4 = typMapMapInt32Int64(v248v2)
- bs248 = testMarshalErr(v248v3, h, t, "enc-map-v248-custom")
- testUnmarshalErr(v248v4, bs248, h, t, "dec-map-v248-p-len")
- testDeepEqualErr(v248v3, v248v4, t, "equal-map-v248-p-len")
- }
-
- for _, v := range []map[int32]float32{nil, {}, {44: 0, 33: 22.2}} {
- // fmt.Printf(">>>> running mammoth map v249: %v\n", v)
- var v249v1, v249v2 map[int32]float32
- v249v1 = v
- bs249 := testMarshalErr(v249v1, h, t, "enc-map-v249")
- if v == nil {
- v249v2 = nil
- } else {
- v249v2 = make(map[int32]float32, len(v))
- } // reset map
- testUnmarshalErr(v249v2, bs249, h, t, "dec-map-v249")
- testDeepEqualErr(v249v1, v249v2, t, "equal-map-v249")
- if v == nil {
- v249v2 = nil
- } else {
- v249v2 = make(map[int32]float32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v249v2), bs249, h, t, "dec-map-v249-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v249v1, v249v2, t, "equal-map-v249-noaddr")
- if v == nil {
- v249v2 = nil
- } else {
- v249v2 = make(map[int32]float32, len(v))
- } // reset map
- testUnmarshalErr(&v249v2, bs249, h, t, "dec-map-v249-p-len")
- testDeepEqualErr(v249v1, v249v2, t, "equal-map-v249-p-len")
- bs249 = testMarshalErr(&v249v1, h, t, "enc-map-v249-p")
- v249v2 = nil
- testUnmarshalErr(&v249v2, bs249, h, t, "dec-map-v249-p-nil")
- testDeepEqualErr(v249v1, v249v2, t, "equal-map-v249-p-nil")
- // ...
- if v == nil {
- v249v2 = nil
- } else {
- v249v2 = make(map[int32]float32, len(v))
- } // reset map
- var v249v3, v249v4 typMapMapInt32Float32
- v249v3 = typMapMapInt32Float32(v249v1)
- v249v4 = typMapMapInt32Float32(v249v2)
- bs249 = testMarshalErr(v249v3, h, t, "enc-map-v249-custom")
- testUnmarshalErr(v249v4, bs249, h, t, "dec-map-v249-p-len")
- testDeepEqualErr(v249v3, v249v4, t, "equal-map-v249-p-len")
- }
-
- for _, v := range []map[int32]float64{nil, {}, {44: 0, 33: 11.1}} {
- // fmt.Printf(">>>> running mammoth map v250: %v\n", v)
- var v250v1, v250v2 map[int32]float64
- v250v1 = v
- bs250 := testMarshalErr(v250v1, h, t, "enc-map-v250")
- if v == nil {
- v250v2 = nil
- } else {
- v250v2 = make(map[int32]float64, len(v))
- } // reset map
- testUnmarshalErr(v250v2, bs250, h, t, "dec-map-v250")
- testDeepEqualErr(v250v1, v250v2, t, "equal-map-v250")
- if v == nil {
- v250v2 = nil
- } else {
- v250v2 = make(map[int32]float64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v250v2), bs250, h, t, "dec-map-v250-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v250v1, v250v2, t, "equal-map-v250-noaddr")
- if v == nil {
- v250v2 = nil
- } else {
- v250v2 = make(map[int32]float64, len(v))
- } // reset map
- testUnmarshalErr(&v250v2, bs250, h, t, "dec-map-v250-p-len")
- testDeepEqualErr(v250v1, v250v2, t, "equal-map-v250-p-len")
- bs250 = testMarshalErr(&v250v1, h, t, "enc-map-v250-p")
- v250v2 = nil
- testUnmarshalErr(&v250v2, bs250, h, t, "dec-map-v250-p-nil")
- testDeepEqualErr(v250v1, v250v2, t, "equal-map-v250-p-nil")
- // ...
- if v == nil {
- v250v2 = nil
- } else {
- v250v2 = make(map[int32]float64, len(v))
- } // reset map
- var v250v3, v250v4 typMapMapInt32Float64
- v250v3 = typMapMapInt32Float64(v250v1)
- v250v4 = typMapMapInt32Float64(v250v2)
- bs250 = testMarshalErr(v250v3, h, t, "enc-map-v250-custom")
- testUnmarshalErr(v250v4, bs250, h, t, "dec-map-v250-p-len")
- testDeepEqualErr(v250v3, v250v4, t, "equal-map-v250-p-len")
- }
-
- for _, v := range []map[int32]bool{nil, {}, {44: false, 33: true}} {
- // fmt.Printf(">>>> running mammoth map v251: %v\n", v)
- var v251v1, v251v2 map[int32]bool
- v251v1 = v
- bs251 := testMarshalErr(v251v1, h, t, "enc-map-v251")
- if v == nil {
- v251v2 = nil
- } else {
- v251v2 = make(map[int32]bool, len(v))
- } // reset map
- testUnmarshalErr(v251v2, bs251, h, t, "dec-map-v251")
- testDeepEqualErr(v251v1, v251v2, t, "equal-map-v251")
- if v == nil {
- v251v2 = nil
- } else {
- v251v2 = make(map[int32]bool, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v251v2), bs251, h, t, "dec-map-v251-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v251v1, v251v2, t, "equal-map-v251-noaddr")
- if v == nil {
- v251v2 = nil
- } else {
- v251v2 = make(map[int32]bool, len(v))
- } // reset map
- testUnmarshalErr(&v251v2, bs251, h, t, "dec-map-v251-p-len")
- testDeepEqualErr(v251v1, v251v2, t, "equal-map-v251-p-len")
- bs251 = testMarshalErr(&v251v1, h, t, "enc-map-v251-p")
- v251v2 = nil
- testUnmarshalErr(&v251v2, bs251, h, t, "dec-map-v251-p-nil")
- testDeepEqualErr(v251v1, v251v2, t, "equal-map-v251-p-nil")
- // ...
- if v == nil {
- v251v2 = nil
- } else {
- v251v2 = make(map[int32]bool, len(v))
- } // reset map
- var v251v3, v251v4 typMapMapInt32Bool
- v251v3 = typMapMapInt32Bool(v251v1)
- v251v4 = typMapMapInt32Bool(v251v2)
- bs251 = testMarshalErr(v251v3, h, t, "enc-map-v251-custom")
- testUnmarshalErr(v251v4, bs251, h, t, "dec-map-v251-p-len")
- testDeepEqualErr(v251v3, v251v4, t, "equal-map-v251-p-len")
- }
-
- for _, v := range []map[int64]interface{}{nil, {}, {44: nil, 33: "string-is-an-interface-2"}} {
- // fmt.Printf(">>>> running mammoth map v254: %v\n", v)
- var v254v1, v254v2 map[int64]interface{}
- v254v1 = v
- bs254 := testMarshalErr(v254v1, h, t, "enc-map-v254")
- if v == nil {
- v254v2 = nil
- } else {
- v254v2 = make(map[int64]interface{}, len(v))
- } // reset map
- testUnmarshalErr(v254v2, bs254, h, t, "dec-map-v254")
- testDeepEqualErr(v254v1, v254v2, t, "equal-map-v254")
- if v == nil {
- v254v2 = nil
- } else {
- v254v2 = make(map[int64]interface{}, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v254v2), bs254, h, t, "dec-map-v254-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v254v1, v254v2, t, "equal-map-v254-noaddr")
- if v == nil {
- v254v2 = nil
- } else {
- v254v2 = make(map[int64]interface{}, len(v))
- } // reset map
- testUnmarshalErr(&v254v2, bs254, h, t, "dec-map-v254-p-len")
- testDeepEqualErr(v254v1, v254v2, t, "equal-map-v254-p-len")
- bs254 = testMarshalErr(&v254v1, h, t, "enc-map-v254-p")
- v254v2 = nil
- testUnmarshalErr(&v254v2, bs254, h, t, "dec-map-v254-p-nil")
- testDeepEqualErr(v254v1, v254v2, t, "equal-map-v254-p-nil")
- // ...
- if v == nil {
- v254v2 = nil
- } else {
- v254v2 = make(map[int64]interface{}, len(v))
- } // reset map
- var v254v3, v254v4 typMapMapInt64Intf
- v254v3 = typMapMapInt64Intf(v254v1)
- v254v4 = typMapMapInt64Intf(v254v2)
- bs254 = testMarshalErr(v254v3, h, t, "enc-map-v254-custom")
- testUnmarshalErr(v254v4, bs254, h, t, "dec-map-v254-p-len")
- testDeepEqualErr(v254v3, v254v4, t, "equal-map-v254-p-len")
- }
-
- for _, v := range []map[int64]string{nil, {}, {44: "", 33: "some-string-2"}} {
- // fmt.Printf(">>>> running mammoth map v255: %v\n", v)
- var v255v1, v255v2 map[int64]string
- v255v1 = v
- bs255 := testMarshalErr(v255v1, h, t, "enc-map-v255")
- if v == nil {
- v255v2 = nil
- } else {
- v255v2 = make(map[int64]string, len(v))
- } // reset map
- testUnmarshalErr(v255v2, bs255, h, t, "dec-map-v255")
- testDeepEqualErr(v255v1, v255v2, t, "equal-map-v255")
- if v == nil {
- v255v2 = nil
- } else {
- v255v2 = make(map[int64]string, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v255v2), bs255, h, t, "dec-map-v255-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v255v1, v255v2, t, "equal-map-v255-noaddr")
- if v == nil {
- v255v2 = nil
- } else {
- v255v2 = make(map[int64]string, len(v))
- } // reset map
- testUnmarshalErr(&v255v2, bs255, h, t, "dec-map-v255-p-len")
- testDeepEqualErr(v255v1, v255v2, t, "equal-map-v255-p-len")
- bs255 = testMarshalErr(&v255v1, h, t, "enc-map-v255-p")
- v255v2 = nil
- testUnmarshalErr(&v255v2, bs255, h, t, "dec-map-v255-p-nil")
- testDeepEqualErr(v255v1, v255v2, t, "equal-map-v255-p-nil")
- // ...
- if v == nil {
- v255v2 = nil
- } else {
- v255v2 = make(map[int64]string, len(v))
- } // reset map
- var v255v3, v255v4 typMapMapInt64String
- v255v3 = typMapMapInt64String(v255v1)
- v255v4 = typMapMapInt64String(v255v2)
- bs255 = testMarshalErr(v255v3, h, t, "enc-map-v255-custom")
- testUnmarshalErr(v255v4, bs255, h, t, "dec-map-v255-p-len")
- testDeepEqualErr(v255v3, v255v4, t, "equal-map-v255-p-len")
- }
-
- for _, v := range []map[int64]uint{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v256: %v\n", v)
- var v256v1, v256v2 map[int64]uint
- v256v1 = v
- bs256 := testMarshalErr(v256v1, h, t, "enc-map-v256")
- if v == nil {
- v256v2 = nil
- } else {
- v256v2 = make(map[int64]uint, len(v))
- } // reset map
- testUnmarshalErr(v256v2, bs256, h, t, "dec-map-v256")
- testDeepEqualErr(v256v1, v256v2, t, "equal-map-v256")
- if v == nil {
- v256v2 = nil
- } else {
- v256v2 = make(map[int64]uint, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v256v2), bs256, h, t, "dec-map-v256-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v256v1, v256v2, t, "equal-map-v256-noaddr")
- if v == nil {
- v256v2 = nil
- } else {
- v256v2 = make(map[int64]uint, len(v))
- } // reset map
- testUnmarshalErr(&v256v2, bs256, h, t, "dec-map-v256-p-len")
- testDeepEqualErr(v256v1, v256v2, t, "equal-map-v256-p-len")
- bs256 = testMarshalErr(&v256v1, h, t, "enc-map-v256-p")
- v256v2 = nil
- testUnmarshalErr(&v256v2, bs256, h, t, "dec-map-v256-p-nil")
- testDeepEqualErr(v256v1, v256v2, t, "equal-map-v256-p-nil")
- // ...
- if v == nil {
- v256v2 = nil
- } else {
- v256v2 = make(map[int64]uint, len(v))
- } // reset map
- var v256v3, v256v4 typMapMapInt64Uint
- v256v3 = typMapMapInt64Uint(v256v1)
- v256v4 = typMapMapInt64Uint(v256v2)
- bs256 = testMarshalErr(v256v3, h, t, "enc-map-v256-custom")
- testUnmarshalErr(v256v4, bs256, h, t, "dec-map-v256-p-len")
- testDeepEqualErr(v256v3, v256v4, t, "equal-map-v256-p-len")
- }
-
- for _, v := range []map[int64]uint8{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v257: %v\n", v)
- var v257v1, v257v2 map[int64]uint8
- v257v1 = v
- bs257 := testMarshalErr(v257v1, h, t, "enc-map-v257")
- if v == nil {
- v257v2 = nil
- } else {
- v257v2 = make(map[int64]uint8, len(v))
- } // reset map
- testUnmarshalErr(v257v2, bs257, h, t, "dec-map-v257")
- testDeepEqualErr(v257v1, v257v2, t, "equal-map-v257")
- if v == nil {
- v257v2 = nil
- } else {
- v257v2 = make(map[int64]uint8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v257v2), bs257, h, t, "dec-map-v257-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v257v1, v257v2, t, "equal-map-v257-noaddr")
- if v == nil {
- v257v2 = nil
- } else {
- v257v2 = make(map[int64]uint8, len(v))
- } // reset map
- testUnmarshalErr(&v257v2, bs257, h, t, "dec-map-v257-p-len")
- testDeepEqualErr(v257v1, v257v2, t, "equal-map-v257-p-len")
- bs257 = testMarshalErr(&v257v1, h, t, "enc-map-v257-p")
- v257v2 = nil
- testUnmarshalErr(&v257v2, bs257, h, t, "dec-map-v257-p-nil")
- testDeepEqualErr(v257v1, v257v2, t, "equal-map-v257-p-nil")
- // ...
- if v == nil {
- v257v2 = nil
- } else {
- v257v2 = make(map[int64]uint8, len(v))
- } // reset map
- var v257v3, v257v4 typMapMapInt64Uint8
- v257v3 = typMapMapInt64Uint8(v257v1)
- v257v4 = typMapMapInt64Uint8(v257v2)
- bs257 = testMarshalErr(v257v3, h, t, "enc-map-v257-custom")
- testUnmarshalErr(v257v4, bs257, h, t, "dec-map-v257-p-len")
- testDeepEqualErr(v257v3, v257v4, t, "equal-map-v257-p-len")
- }
-
- for _, v := range []map[int64]uint16{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v258: %v\n", v)
- var v258v1, v258v2 map[int64]uint16
- v258v1 = v
- bs258 := testMarshalErr(v258v1, h, t, "enc-map-v258")
- if v == nil {
- v258v2 = nil
- } else {
- v258v2 = make(map[int64]uint16, len(v))
- } // reset map
- testUnmarshalErr(v258v2, bs258, h, t, "dec-map-v258")
- testDeepEqualErr(v258v1, v258v2, t, "equal-map-v258")
- if v == nil {
- v258v2 = nil
- } else {
- v258v2 = make(map[int64]uint16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v258v2), bs258, h, t, "dec-map-v258-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v258v1, v258v2, t, "equal-map-v258-noaddr")
- if v == nil {
- v258v2 = nil
- } else {
- v258v2 = make(map[int64]uint16, len(v))
- } // reset map
- testUnmarshalErr(&v258v2, bs258, h, t, "dec-map-v258-p-len")
- testDeepEqualErr(v258v1, v258v2, t, "equal-map-v258-p-len")
- bs258 = testMarshalErr(&v258v1, h, t, "enc-map-v258-p")
- v258v2 = nil
- testUnmarshalErr(&v258v2, bs258, h, t, "dec-map-v258-p-nil")
- testDeepEqualErr(v258v1, v258v2, t, "equal-map-v258-p-nil")
- // ...
- if v == nil {
- v258v2 = nil
- } else {
- v258v2 = make(map[int64]uint16, len(v))
- } // reset map
- var v258v3, v258v4 typMapMapInt64Uint16
- v258v3 = typMapMapInt64Uint16(v258v1)
- v258v4 = typMapMapInt64Uint16(v258v2)
- bs258 = testMarshalErr(v258v3, h, t, "enc-map-v258-custom")
- testUnmarshalErr(v258v4, bs258, h, t, "dec-map-v258-p-len")
- testDeepEqualErr(v258v3, v258v4, t, "equal-map-v258-p-len")
- }
-
- for _, v := range []map[int64]uint32{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v259: %v\n", v)
- var v259v1, v259v2 map[int64]uint32
- v259v1 = v
- bs259 := testMarshalErr(v259v1, h, t, "enc-map-v259")
- if v == nil {
- v259v2 = nil
- } else {
- v259v2 = make(map[int64]uint32, len(v))
- } // reset map
- testUnmarshalErr(v259v2, bs259, h, t, "dec-map-v259")
- testDeepEqualErr(v259v1, v259v2, t, "equal-map-v259")
- if v == nil {
- v259v2 = nil
- } else {
- v259v2 = make(map[int64]uint32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v259v2), bs259, h, t, "dec-map-v259-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v259v1, v259v2, t, "equal-map-v259-noaddr")
- if v == nil {
- v259v2 = nil
- } else {
- v259v2 = make(map[int64]uint32, len(v))
- } // reset map
- testUnmarshalErr(&v259v2, bs259, h, t, "dec-map-v259-p-len")
- testDeepEqualErr(v259v1, v259v2, t, "equal-map-v259-p-len")
- bs259 = testMarshalErr(&v259v1, h, t, "enc-map-v259-p")
- v259v2 = nil
- testUnmarshalErr(&v259v2, bs259, h, t, "dec-map-v259-p-nil")
- testDeepEqualErr(v259v1, v259v2, t, "equal-map-v259-p-nil")
- // ...
- if v == nil {
- v259v2 = nil
- } else {
- v259v2 = make(map[int64]uint32, len(v))
- } // reset map
- var v259v3, v259v4 typMapMapInt64Uint32
- v259v3 = typMapMapInt64Uint32(v259v1)
- v259v4 = typMapMapInt64Uint32(v259v2)
- bs259 = testMarshalErr(v259v3, h, t, "enc-map-v259-custom")
- testUnmarshalErr(v259v4, bs259, h, t, "dec-map-v259-p-len")
- testDeepEqualErr(v259v3, v259v4, t, "equal-map-v259-p-len")
- }
-
- for _, v := range []map[int64]uint64{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v260: %v\n", v)
- var v260v1, v260v2 map[int64]uint64
- v260v1 = v
- bs260 := testMarshalErr(v260v1, h, t, "enc-map-v260")
- if v == nil {
- v260v2 = nil
- } else {
- v260v2 = make(map[int64]uint64, len(v))
- } // reset map
- testUnmarshalErr(v260v2, bs260, h, t, "dec-map-v260")
- testDeepEqualErr(v260v1, v260v2, t, "equal-map-v260")
- if v == nil {
- v260v2 = nil
- } else {
- v260v2 = make(map[int64]uint64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v260v2), bs260, h, t, "dec-map-v260-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v260v1, v260v2, t, "equal-map-v260-noaddr")
- if v == nil {
- v260v2 = nil
- } else {
- v260v2 = make(map[int64]uint64, len(v))
- } // reset map
- testUnmarshalErr(&v260v2, bs260, h, t, "dec-map-v260-p-len")
- testDeepEqualErr(v260v1, v260v2, t, "equal-map-v260-p-len")
- bs260 = testMarshalErr(&v260v1, h, t, "enc-map-v260-p")
- v260v2 = nil
- testUnmarshalErr(&v260v2, bs260, h, t, "dec-map-v260-p-nil")
- testDeepEqualErr(v260v1, v260v2, t, "equal-map-v260-p-nil")
- // ...
- if v == nil {
- v260v2 = nil
- } else {
- v260v2 = make(map[int64]uint64, len(v))
- } // reset map
- var v260v3, v260v4 typMapMapInt64Uint64
- v260v3 = typMapMapInt64Uint64(v260v1)
- v260v4 = typMapMapInt64Uint64(v260v2)
- bs260 = testMarshalErr(v260v3, h, t, "enc-map-v260-custom")
- testUnmarshalErr(v260v4, bs260, h, t, "dec-map-v260-p-len")
- testDeepEqualErr(v260v3, v260v4, t, "equal-map-v260-p-len")
- }
-
- for _, v := range []map[int64]uintptr{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v261: %v\n", v)
- var v261v1, v261v2 map[int64]uintptr
- v261v1 = v
- bs261 := testMarshalErr(v261v1, h, t, "enc-map-v261")
- if v == nil {
- v261v2 = nil
- } else {
- v261v2 = make(map[int64]uintptr, len(v))
- } // reset map
- testUnmarshalErr(v261v2, bs261, h, t, "dec-map-v261")
- testDeepEqualErr(v261v1, v261v2, t, "equal-map-v261")
- if v == nil {
- v261v2 = nil
- } else {
- v261v2 = make(map[int64]uintptr, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v261v2), bs261, h, t, "dec-map-v261-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v261v1, v261v2, t, "equal-map-v261-noaddr")
- if v == nil {
- v261v2 = nil
- } else {
- v261v2 = make(map[int64]uintptr, len(v))
- } // reset map
- testUnmarshalErr(&v261v2, bs261, h, t, "dec-map-v261-p-len")
- testDeepEqualErr(v261v1, v261v2, t, "equal-map-v261-p-len")
- bs261 = testMarshalErr(&v261v1, h, t, "enc-map-v261-p")
- v261v2 = nil
- testUnmarshalErr(&v261v2, bs261, h, t, "dec-map-v261-p-nil")
- testDeepEqualErr(v261v1, v261v2, t, "equal-map-v261-p-nil")
- // ...
- if v == nil {
- v261v2 = nil
- } else {
- v261v2 = make(map[int64]uintptr, len(v))
- } // reset map
- var v261v3, v261v4 typMapMapInt64Uintptr
- v261v3 = typMapMapInt64Uintptr(v261v1)
- v261v4 = typMapMapInt64Uintptr(v261v2)
- bs261 = testMarshalErr(v261v3, h, t, "enc-map-v261-custom")
- testUnmarshalErr(v261v4, bs261, h, t, "dec-map-v261-p-len")
- testDeepEqualErr(v261v3, v261v4, t, "equal-map-v261-p-len")
- }
-
- for _, v := range []map[int64]int{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v262: %v\n", v)
- var v262v1, v262v2 map[int64]int
- v262v1 = v
- bs262 := testMarshalErr(v262v1, h, t, "enc-map-v262")
- if v == nil {
- v262v2 = nil
- } else {
- v262v2 = make(map[int64]int, len(v))
- } // reset map
- testUnmarshalErr(v262v2, bs262, h, t, "dec-map-v262")
- testDeepEqualErr(v262v1, v262v2, t, "equal-map-v262")
- if v == nil {
- v262v2 = nil
- } else {
- v262v2 = make(map[int64]int, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v262v2), bs262, h, t, "dec-map-v262-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v262v1, v262v2, t, "equal-map-v262-noaddr")
- if v == nil {
- v262v2 = nil
- } else {
- v262v2 = make(map[int64]int, len(v))
- } // reset map
- testUnmarshalErr(&v262v2, bs262, h, t, "dec-map-v262-p-len")
- testDeepEqualErr(v262v1, v262v2, t, "equal-map-v262-p-len")
- bs262 = testMarshalErr(&v262v1, h, t, "enc-map-v262-p")
- v262v2 = nil
- testUnmarshalErr(&v262v2, bs262, h, t, "dec-map-v262-p-nil")
- testDeepEqualErr(v262v1, v262v2, t, "equal-map-v262-p-nil")
- // ...
- if v == nil {
- v262v2 = nil
- } else {
- v262v2 = make(map[int64]int, len(v))
- } // reset map
- var v262v3, v262v4 typMapMapInt64Int
- v262v3 = typMapMapInt64Int(v262v1)
- v262v4 = typMapMapInt64Int(v262v2)
- bs262 = testMarshalErr(v262v3, h, t, "enc-map-v262-custom")
- testUnmarshalErr(v262v4, bs262, h, t, "dec-map-v262-p-len")
- testDeepEqualErr(v262v3, v262v4, t, "equal-map-v262-p-len")
- }
-
- for _, v := range []map[int64]int8{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v263: %v\n", v)
- var v263v1, v263v2 map[int64]int8
- v263v1 = v
- bs263 := testMarshalErr(v263v1, h, t, "enc-map-v263")
- if v == nil {
- v263v2 = nil
- } else {
- v263v2 = make(map[int64]int8, len(v))
- } // reset map
- testUnmarshalErr(v263v2, bs263, h, t, "dec-map-v263")
- testDeepEqualErr(v263v1, v263v2, t, "equal-map-v263")
- if v == nil {
- v263v2 = nil
- } else {
- v263v2 = make(map[int64]int8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v263v2), bs263, h, t, "dec-map-v263-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v263v1, v263v2, t, "equal-map-v263-noaddr")
- if v == nil {
- v263v2 = nil
- } else {
- v263v2 = make(map[int64]int8, len(v))
- } // reset map
- testUnmarshalErr(&v263v2, bs263, h, t, "dec-map-v263-p-len")
- testDeepEqualErr(v263v1, v263v2, t, "equal-map-v263-p-len")
- bs263 = testMarshalErr(&v263v1, h, t, "enc-map-v263-p")
- v263v2 = nil
- testUnmarshalErr(&v263v2, bs263, h, t, "dec-map-v263-p-nil")
- testDeepEqualErr(v263v1, v263v2, t, "equal-map-v263-p-nil")
- // ...
- if v == nil {
- v263v2 = nil
- } else {
- v263v2 = make(map[int64]int8, len(v))
- } // reset map
- var v263v3, v263v4 typMapMapInt64Int8
- v263v3 = typMapMapInt64Int8(v263v1)
- v263v4 = typMapMapInt64Int8(v263v2)
- bs263 = testMarshalErr(v263v3, h, t, "enc-map-v263-custom")
- testUnmarshalErr(v263v4, bs263, h, t, "dec-map-v263-p-len")
- testDeepEqualErr(v263v3, v263v4, t, "equal-map-v263-p-len")
- }
-
- for _, v := range []map[int64]int16{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v264: %v\n", v)
- var v264v1, v264v2 map[int64]int16
- v264v1 = v
- bs264 := testMarshalErr(v264v1, h, t, "enc-map-v264")
- if v == nil {
- v264v2 = nil
- } else {
- v264v2 = make(map[int64]int16, len(v))
- } // reset map
- testUnmarshalErr(v264v2, bs264, h, t, "dec-map-v264")
- testDeepEqualErr(v264v1, v264v2, t, "equal-map-v264")
- if v == nil {
- v264v2 = nil
- } else {
- v264v2 = make(map[int64]int16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v264v2), bs264, h, t, "dec-map-v264-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v264v1, v264v2, t, "equal-map-v264-noaddr")
- if v == nil {
- v264v2 = nil
- } else {
- v264v2 = make(map[int64]int16, len(v))
- } // reset map
- testUnmarshalErr(&v264v2, bs264, h, t, "dec-map-v264-p-len")
- testDeepEqualErr(v264v1, v264v2, t, "equal-map-v264-p-len")
- bs264 = testMarshalErr(&v264v1, h, t, "enc-map-v264-p")
- v264v2 = nil
- testUnmarshalErr(&v264v2, bs264, h, t, "dec-map-v264-p-nil")
- testDeepEqualErr(v264v1, v264v2, t, "equal-map-v264-p-nil")
- // ...
- if v == nil {
- v264v2 = nil
- } else {
- v264v2 = make(map[int64]int16, len(v))
- } // reset map
- var v264v3, v264v4 typMapMapInt64Int16
- v264v3 = typMapMapInt64Int16(v264v1)
- v264v4 = typMapMapInt64Int16(v264v2)
- bs264 = testMarshalErr(v264v3, h, t, "enc-map-v264-custom")
- testUnmarshalErr(v264v4, bs264, h, t, "dec-map-v264-p-len")
- testDeepEqualErr(v264v3, v264v4, t, "equal-map-v264-p-len")
- }
-
- for _, v := range []map[int64]int32{nil, {}, {33: 0, 44: 33}} {
- // fmt.Printf(">>>> running mammoth map v265: %v\n", v)
- var v265v1, v265v2 map[int64]int32
- v265v1 = v
- bs265 := testMarshalErr(v265v1, h, t, "enc-map-v265")
- if v == nil {
- v265v2 = nil
- } else {
- v265v2 = make(map[int64]int32, len(v))
- } // reset map
- testUnmarshalErr(v265v2, bs265, h, t, "dec-map-v265")
- testDeepEqualErr(v265v1, v265v2, t, "equal-map-v265")
- if v == nil {
- v265v2 = nil
- } else {
- v265v2 = make(map[int64]int32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v265v2), bs265, h, t, "dec-map-v265-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v265v1, v265v2, t, "equal-map-v265-noaddr")
- if v == nil {
- v265v2 = nil
- } else {
- v265v2 = make(map[int64]int32, len(v))
- } // reset map
- testUnmarshalErr(&v265v2, bs265, h, t, "dec-map-v265-p-len")
- testDeepEqualErr(v265v1, v265v2, t, "equal-map-v265-p-len")
- bs265 = testMarshalErr(&v265v1, h, t, "enc-map-v265-p")
- v265v2 = nil
- testUnmarshalErr(&v265v2, bs265, h, t, "dec-map-v265-p-nil")
- testDeepEqualErr(v265v1, v265v2, t, "equal-map-v265-p-nil")
- // ...
- if v == nil {
- v265v2 = nil
- } else {
- v265v2 = make(map[int64]int32, len(v))
- } // reset map
- var v265v3, v265v4 typMapMapInt64Int32
- v265v3 = typMapMapInt64Int32(v265v1)
- v265v4 = typMapMapInt64Int32(v265v2)
- bs265 = testMarshalErr(v265v3, h, t, "enc-map-v265-custom")
- testUnmarshalErr(v265v4, bs265, h, t, "dec-map-v265-p-len")
- testDeepEqualErr(v265v3, v265v4, t, "equal-map-v265-p-len")
- }
-
- for _, v := range []map[int64]int64{nil, {}, {44: 0, 33: 44}} {
- // fmt.Printf(">>>> running mammoth map v266: %v\n", v)
- var v266v1, v266v2 map[int64]int64
- v266v1 = v
- bs266 := testMarshalErr(v266v1, h, t, "enc-map-v266")
- if v == nil {
- v266v2 = nil
- } else {
- v266v2 = make(map[int64]int64, len(v))
- } // reset map
- testUnmarshalErr(v266v2, bs266, h, t, "dec-map-v266")
- testDeepEqualErr(v266v1, v266v2, t, "equal-map-v266")
- if v == nil {
- v266v2 = nil
- } else {
- v266v2 = make(map[int64]int64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v266v2), bs266, h, t, "dec-map-v266-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v266v1, v266v2, t, "equal-map-v266-noaddr")
- if v == nil {
- v266v2 = nil
- } else {
- v266v2 = make(map[int64]int64, len(v))
- } // reset map
- testUnmarshalErr(&v266v2, bs266, h, t, "dec-map-v266-p-len")
- testDeepEqualErr(v266v1, v266v2, t, "equal-map-v266-p-len")
- bs266 = testMarshalErr(&v266v1, h, t, "enc-map-v266-p")
- v266v2 = nil
- testUnmarshalErr(&v266v2, bs266, h, t, "dec-map-v266-p-nil")
- testDeepEqualErr(v266v1, v266v2, t, "equal-map-v266-p-nil")
- // ...
- if v == nil {
- v266v2 = nil
- } else {
- v266v2 = make(map[int64]int64, len(v))
- } // reset map
- var v266v3, v266v4 typMapMapInt64Int64
- v266v3 = typMapMapInt64Int64(v266v1)
- v266v4 = typMapMapInt64Int64(v266v2)
- bs266 = testMarshalErr(v266v3, h, t, "enc-map-v266-custom")
- testUnmarshalErr(v266v4, bs266, h, t, "dec-map-v266-p-len")
- testDeepEqualErr(v266v3, v266v4, t, "equal-map-v266-p-len")
- }
-
- for _, v := range []map[int64]float32{nil, {}, {33: 0, 44: 22.2}} {
- // fmt.Printf(">>>> running mammoth map v267: %v\n", v)
- var v267v1, v267v2 map[int64]float32
- v267v1 = v
- bs267 := testMarshalErr(v267v1, h, t, "enc-map-v267")
- if v == nil {
- v267v2 = nil
- } else {
- v267v2 = make(map[int64]float32, len(v))
- } // reset map
- testUnmarshalErr(v267v2, bs267, h, t, "dec-map-v267")
- testDeepEqualErr(v267v1, v267v2, t, "equal-map-v267")
- if v == nil {
- v267v2 = nil
- } else {
- v267v2 = make(map[int64]float32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v267v2), bs267, h, t, "dec-map-v267-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v267v1, v267v2, t, "equal-map-v267-noaddr")
- if v == nil {
- v267v2 = nil
- } else {
- v267v2 = make(map[int64]float32, len(v))
- } // reset map
- testUnmarshalErr(&v267v2, bs267, h, t, "dec-map-v267-p-len")
- testDeepEqualErr(v267v1, v267v2, t, "equal-map-v267-p-len")
- bs267 = testMarshalErr(&v267v1, h, t, "enc-map-v267-p")
- v267v2 = nil
- testUnmarshalErr(&v267v2, bs267, h, t, "dec-map-v267-p-nil")
- testDeepEqualErr(v267v1, v267v2, t, "equal-map-v267-p-nil")
- // ...
- if v == nil {
- v267v2 = nil
- } else {
- v267v2 = make(map[int64]float32, len(v))
- } // reset map
- var v267v3, v267v4 typMapMapInt64Float32
- v267v3 = typMapMapInt64Float32(v267v1)
- v267v4 = typMapMapInt64Float32(v267v2)
- bs267 = testMarshalErr(v267v3, h, t, "enc-map-v267-custom")
- testUnmarshalErr(v267v4, bs267, h, t, "dec-map-v267-p-len")
- testDeepEqualErr(v267v3, v267v4, t, "equal-map-v267-p-len")
- }
-
- for _, v := range []map[int64]float64{nil, {}, {33: 0, 44: 11.1}} {
- // fmt.Printf(">>>> running mammoth map v268: %v\n", v)
- var v268v1, v268v2 map[int64]float64
- v268v1 = v
- bs268 := testMarshalErr(v268v1, h, t, "enc-map-v268")
- if v == nil {
- v268v2 = nil
- } else {
- v268v2 = make(map[int64]float64, len(v))
- } // reset map
- testUnmarshalErr(v268v2, bs268, h, t, "dec-map-v268")
- testDeepEqualErr(v268v1, v268v2, t, "equal-map-v268")
- if v == nil {
- v268v2 = nil
- } else {
- v268v2 = make(map[int64]float64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v268v2), bs268, h, t, "dec-map-v268-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v268v1, v268v2, t, "equal-map-v268-noaddr")
- if v == nil {
- v268v2 = nil
- } else {
- v268v2 = make(map[int64]float64, len(v))
- } // reset map
- testUnmarshalErr(&v268v2, bs268, h, t, "dec-map-v268-p-len")
- testDeepEqualErr(v268v1, v268v2, t, "equal-map-v268-p-len")
- bs268 = testMarshalErr(&v268v1, h, t, "enc-map-v268-p")
- v268v2 = nil
- testUnmarshalErr(&v268v2, bs268, h, t, "dec-map-v268-p-nil")
- testDeepEqualErr(v268v1, v268v2, t, "equal-map-v268-p-nil")
- // ...
- if v == nil {
- v268v2 = nil
- } else {
- v268v2 = make(map[int64]float64, len(v))
- } // reset map
- var v268v3, v268v4 typMapMapInt64Float64
- v268v3 = typMapMapInt64Float64(v268v1)
- v268v4 = typMapMapInt64Float64(v268v2)
- bs268 = testMarshalErr(v268v3, h, t, "enc-map-v268-custom")
- testUnmarshalErr(v268v4, bs268, h, t, "dec-map-v268-p-len")
- testDeepEqualErr(v268v3, v268v4, t, "equal-map-v268-p-len")
- }
-
- for _, v := range []map[int64]bool{nil, {}, {33: false, 44: true}} {
- // fmt.Printf(">>>> running mammoth map v269: %v\n", v)
- var v269v1, v269v2 map[int64]bool
- v269v1 = v
- bs269 := testMarshalErr(v269v1, h, t, "enc-map-v269")
- if v == nil {
- v269v2 = nil
- } else {
- v269v2 = make(map[int64]bool, len(v))
- } // reset map
- testUnmarshalErr(v269v2, bs269, h, t, "dec-map-v269")
- testDeepEqualErr(v269v1, v269v2, t, "equal-map-v269")
- if v == nil {
- v269v2 = nil
- } else {
- v269v2 = make(map[int64]bool, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v269v2), bs269, h, t, "dec-map-v269-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v269v1, v269v2, t, "equal-map-v269-noaddr")
- if v == nil {
- v269v2 = nil
- } else {
- v269v2 = make(map[int64]bool, len(v))
- } // reset map
- testUnmarshalErr(&v269v2, bs269, h, t, "dec-map-v269-p-len")
- testDeepEqualErr(v269v1, v269v2, t, "equal-map-v269-p-len")
- bs269 = testMarshalErr(&v269v1, h, t, "enc-map-v269-p")
- v269v2 = nil
- testUnmarshalErr(&v269v2, bs269, h, t, "dec-map-v269-p-nil")
- testDeepEqualErr(v269v1, v269v2, t, "equal-map-v269-p-nil")
- // ...
- if v == nil {
- v269v2 = nil
- } else {
- v269v2 = make(map[int64]bool, len(v))
- } // reset map
- var v269v3, v269v4 typMapMapInt64Bool
- v269v3 = typMapMapInt64Bool(v269v1)
- v269v4 = typMapMapInt64Bool(v269v2)
- bs269 = testMarshalErr(v269v3, h, t, "enc-map-v269-custom")
- testUnmarshalErr(v269v4, bs269, h, t, "dec-map-v269-p-len")
- testDeepEqualErr(v269v3, v269v4, t, "equal-map-v269-p-len")
- }
-
- for _, v := range []map[bool]interface{}{nil, {}, {true: nil}} {
- // fmt.Printf(">>>> running mammoth map v272: %v\n", v)
- var v272v1, v272v2 map[bool]interface{}
- v272v1 = v
- bs272 := testMarshalErr(v272v1, h, t, "enc-map-v272")
- if v == nil {
- v272v2 = nil
- } else {
- v272v2 = make(map[bool]interface{}, len(v))
- } // reset map
- testUnmarshalErr(v272v2, bs272, h, t, "dec-map-v272")
- testDeepEqualErr(v272v1, v272v2, t, "equal-map-v272")
- if v == nil {
- v272v2 = nil
- } else {
- v272v2 = make(map[bool]interface{}, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v272v2), bs272, h, t, "dec-map-v272-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v272v1, v272v2, t, "equal-map-v272-noaddr")
- if v == nil {
- v272v2 = nil
- } else {
- v272v2 = make(map[bool]interface{}, len(v))
- } // reset map
- testUnmarshalErr(&v272v2, bs272, h, t, "dec-map-v272-p-len")
- testDeepEqualErr(v272v1, v272v2, t, "equal-map-v272-p-len")
- bs272 = testMarshalErr(&v272v1, h, t, "enc-map-v272-p")
- v272v2 = nil
- testUnmarshalErr(&v272v2, bs272, h, t, "dec-map-v272-p-nil")
- testDeepEqualErr(v272v1, v272v2, t, "equal-map-v272-p-nil")
- // ...
- if v == nil {
- v272v2 = nil
- } else {
- v272v2 = make(map[bool]interface{}, len(v))
- } // reset map
- var v272v3, v272v4 typMapMapBoolIntf
- v272v3 = typMapMapBoolIntf(v272v1)
- v272v4 = typMapMapBoolIntf(v272v2)
- bs272 = testMarshalErr(v272v3, h, t, "enc-map-v272-custom")
- testUnmarshalErr(v272v4, bs272, h, t, "dec-map-v272-p-len")
- testDeepEqualErr(v272v3, v272v4, t, "equal-map-v272-p-len")
- }
-
- for _, v := range []map[bool]string{nil, {}, {true: ""}} {
- // fmt.Printf(">>>> running mammoth map v273: %v\n", v)
- var v273v1, v273v2 map[bool]string
- v273v1 = v
- bs273 := testMarshalErr(v273v1, h, t, "enc-map-v273")
- if v == nil {
- v273v2 = nil
- } else {
- v273v2 = make(map[bool]string, len(v))
- } // reset map
- testUnmarshalErr(v273v2, bs273, h, t, "dec-map-v273")
- testDeepEqualErr(v273v1, v273v2, t, "equal-map-v273")
- if v == nil {
- v273v2 = nil
- } else {
- v273v2 = make(map[bool]string, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v273v2), bs273, h, t, "dec-map-v273-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v273v1, v273v2, t, "equal-map-v273-noaddr")
- if v == nil {
- v273v2 = nil
- } else {
- v273v2 = make(map[bool]string, len(v))
- } // reset map
- testUnmarshalErr(&v273v2, bs273, h, t, "dec-map-v273-p-len")
- testDeepEqualErr(v273v1, v273v2, t, "equal-map-v273-p-len")
- bs273 = testMarshalErr(&v273v1, h, t, "enc-map-v273-p")
- v273v2 = nil
- testUnmarshalErr(&v273v2, bs273, h, t, "dec-map-v273-p-nil")
- testDeepEqualErr(v273v1, v273v2, t, "equal-map-v273-p-nil")
- // ...
- if v == nil {
- v273v2 = nil
- } else {
- v273v2 = make(map[bool]string, len(v))
- } // reset map
- var v273v3, v273v4 typMapMapBoolString
- v273v3 = typMapMapBoolString(v273v1)
- v273v4 = typMapMapBoolString(v273v2)
- bs273 = testMarshalErr(v273v3, h, t, "enc-map-v273-custom")
- testUnmarshalErr(v273v4, bs273, h, t, "dec-map-v273-p-len")
- testDeepEqualErr(v273v3, v273v4, t, "equal-map-v273-p-len")
- }
-
- for _, v := range []map[bool]uint{nil, {}, {true: 0}} {
- // fmt.Printf(">>>> running mammoth map v274: %v\n", v)
- var v274v1, v274v2 map[bool]uint
- v274v1 = v
- bs274 := testMarshalErr(v274v1, h, t, "enc-map-v274")
- if v == nil {
- v274v2 = nil
- } else {
- v274v2 = make(map[bool]uint, len(v))
- } // reset map
- testUnmarshalErr(v274v2, bs274, h, t, "dec-map-v274")
- testDeepEqualErr(v274v1, v274v2, t, "equal-map-v274")
- if v == nil {
- v274v2 = nil
- } else {
- v274v2 = make(map[bool]uint, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v274v2), bs274, h, t, "dec-map-v274-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v274v1, v274v2, t, "equal-map-v274-noaddr")
- if v == nil {
- v274v2 = nil
- } else {
- v274v2 = make(map[bool]uint, len(v))
- } // reset map
- testUnmarshalErr(&v274v2, bs274, h, t, "dec-map-v274-p-len")
- testDeepEqualErr(v274v1, v274v2, t, "equal-map-v274-p-len")
- bs274 = testMarshalErr(&v274v1, h, t, "enc-map-v274-p")
- v274v2 = nil
- testUnmarshalErr(&v274v2, bs274, h, t, "dec-map-v274-p-nil")
- testDeepEqualErr(v274v1, v274v2, t, "equal-map-v274-p-nil")
- // ...
- if v == nil {
- v274v2 = nil
- } else {
- v274v2 = make(map[bool]uint, len(v))
- } // reset map
- var v274v3, v274v4 typMapMapBoolUint
- v274v3 = typMapMapBoolUint(v274v1)
- v274v4 = typMapMapBoolUint(v274v2)
- bs274 = testMarshalErr(v274v3, h, t, "enc-map-v274-custom")
- testUnmarshalErr(v274v4, bs274, h, t, "dec-map-v274-p-len")
- testDeepEqualErr(v274v3, v274v4, t, "equal-map-v274-p-len")
- }
-
- for _, v := range []map[bool]uint8{nil, {}, {true: 0}} {
- // fmt.Printf(">>>> running mammoth map v275: %v\n", v)
- var v275v1, v275v2 map[bool]uint8
- v275v1 = v
- bs275 := testMarshalErr(v275v1, h, t, "enc-map-v275")
- if v == nil {
- v275v2 = nil
- } else {
- v275v2 = make(map[bool]uint8, len(v))
- } // reset map
- testUnmarshalErr(v275v2, bs275, h, t, "dec-map-v275")
- testDeepEqualErr(v275v1, v275v2, t, "equal-map-v275")
- if v == nil {
- v275v2 = nil
- } else {
- v275v2 = make(map[bool]uint8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v275v2), bs275, h, t, "dec-map-v275-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v275v1, v275v2, t, "equal-map-v275-noaddr")
- if v == nil {
- v275v2 = nil
- } else {
- v275v2 = make(map[bool]uint8, len(v))
- } // reset map
- testUnmarshalErr(&v275v2, bs275, h, t, "dec-map-v275-p-len")
- testDeepEqualErr(v275v1, v275v2, t, "equal-map-v275-p-len")
- bs275 = testMarshalErr(&v275v1, h, t, "enc-map-v275-p")
- v275v2 = nil
- testUnmarshalErr(&v275v2, bs275, h, t, "dec-map-v275-p-nil")
- testDeepEqualErr(v275v1, v275v2, t, "equal-map-v275-p-nil")
- // ...
- if v == nil {
- v275v2 = nil
- } else {
- v275v2 = make(map[bool]uint8, len(v))
- } // reset map
- var v275v3, v275v4 typMapMapBoolUint8
- v275v3 = typMapMapBoolUint8(v275v1)
- v275v4 = typMapMapBoolUint8(v275v2)
- bs275 = testMarshalErr(v275v3, h, t, "enc-map-v275-custom")
- testUnmarshalErr(v275v4, bs275, h, t, "dec-map-v275-p-len")
- testDeepEqualErr(v275v3, v275v4, t, "equal-map-v275-p-len")
- }
-
- for _, v := range []map[bool]uint16{nil, {}, {true: 0}} {
- // fmt.Printf(">>>> running mammoth map v276: %v\n", v)
- var v276v1, v276v2 map[bool]uint16
- v276v1 = v
- bs276 := testMarshalErr(v276v1, h, t, "enc-map-v276")
- if v == nil {
- v276v2 = nil
- } else {
- v276v2 = make(map[bool]uint16, len(v))
- } // reset map
- testUnmarshalErr(v276v2, bs276, h, t, "dec-map-v276")
- testDeepEqualErr(v276v1, v276v2, t, "equal-map-v276")
- if v == nil {
- v276v2 = nil
- } else {
- v276v2 = make(map[bool]uint16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v276v2), bs276, h, t, "dec-map-v276-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v276v1, v276v2, t, "equal-map-v276-noaddr")
- if v == nil {
- v276v2 = nil
- } else {
- v276v2 = make(map[bool]uint16, len(v))
- } // reset map
- testUnmarshalErr(&v276v2, bs276, h, t, "dec-map-v276-p-len")
- testDeepEqualErr(v276v1, v276v2, t, "equal-map-v276-p-len")
- bs276 = testMarshalErr(&v276v1, h, t, "enc-map-v276-p")
- v276v2 = nil
- testUnmarshalErr(&v276v2, bs276, h, t, "dec-map-v276-p-nil")
- testDeepEqualErr(v276v1, v276v2, t, "equal-map-v276-p-nil")
- // ...
- if v == nil {
- v276v2 = nil
- } else {
- v276v2 = make(map[bool]uint16, len(v))
- } // reset map
- var v276v3, v276v4 typMapMapBoolUint16
- v276v3 = typMapMapBoolUint16(v276v1)
- v276v4 = typMapMapBoolUint16(v276v2)
- bs276 = testMarshalErr(v276v3, h, t, "enc-map-v276-custom")
- testUnmarshalErr(v276v4, bs276, h, t, "dec-map-v276-p-len")
- testDeepEqualErr(v276v3, v276v4, t, "equal-map-v276-p-len")
- }
-
- for _, v := range []map[bool]uint32{nil, {}, {true: 0}} {
- // fmt.Printf(">>>> running mammoth map v277: %v\n", v)
- var v277v1, v277v2 map[bool]uint32
- v277v1 = v
- bs277 := testMarshalErr(v277v1, h, t, "enc-map-v277")
- if v == nil {
- v277v2 = nil
- } else {
- v277v2 = make(map[bool]uint32, len(v))
- } // reset map
- testUnmarshalErr(v277v2, bs277, h, t, "dec-map-v277")
- testDeepEqualErr(v277v1, v277v2, t, "equal-map-v277")
- if v == nil {
- v277v2 = nil
- } else {
- v277v2 = make(map[bool]uint32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v277v2), bs277, h, t, "dec-map-v277-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v277v1, v277v2, t, "equal-map-v277-noaddr")
- if v == nil {
- v277v2 = nil
- } else {
- v277v2 = make(map[bool]uint32, len(v))
- } // reset map
- testUnmarshalErr(&v277v2, bs277, h, t, "dec-map-v277-p-len")
- testDeepEqualErr(v277v1, v277v2, t, "equal-map-v277-p-len")
- bs277 = testMarshalErr(&v277v1, h, t, "enc-map-v277-p")
- v277v2 = nil
- testUnmarshalErr(&v277v2, bs277, h, t, "dec-map-v277-p-nil")
- testDeepEqualErr(v277v1, v277v2, t, "equal-map-v277-p-nil")
- // ...
- if v == nil {
- v277v2 = nil
- } else {
- v277v2 = make(map[bool]uint32, len(v))
- } // reset map
- var v277v3, v277v4 typMapMapBoolUint32
- v277v3 = typMapMapBoolUint32(v277v1)
- v277v4 = typMapMapBoolUint32(v277v2)
- bs277 = testMarshalErr(v277v3, h, t, "enc-map-v277-custom")
- testUnmarshalErr(v277v4, bs277, h, t, "dec-map-v277-p-len")
- testDeepEqualErr(v277v3, v277v4, t, "equal-map-v277-p-len")
- }
-
- for _, v := range []map[bool]uint64{nil, {}, {true: 0}} {
- // fmt.Printf(">>>> running mammoth map v278: %v\n", v)
- var v278v1, v278v2 map[bool]uint64
- v278v1 = v
- bs278 := testMarshalErr(v278v1, h, t, "enc-map-v278")
- if v == nil {
- v278v2 = nil
- } else {
- v278v2 = make(map[bool]uint64, len(v))
- } // reset map
- testUnmarshalErr(v278v2, bs278, h, t, "dec-map-v278")
- testDeepEqualErr(v278v1, v278v2, t, "equal-map-v278")
- if v == nil {
- v278v2 = nil
- } else {
- v278v2 = make(map[bool]uint64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v278v2), bs278, h, t, "dec-map-v278-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v278v1, v278v2, t, "equal-map-v278-noaddr")
- if v == nil {
- v278v2 = nil
- } else {
- v278v2 = make(map[bool]uint64, len(v))
- } // reset map
- testUnmarshalErr(&v278v2, bs278, h, t, "dec-map-v278-p-len")
- testDeepEqualErr(v278v1, v278v2, t, "equal-map-v278-p-len")
- bs278 = testMarshalErr(&v278v1, h, t, "enc-map-v278-p")
- v278v2 = nil
- testUnmarshalErr(&v278v2, bs278, h, t, "dec-map-v278-p-nil")
- testDeepEqualErr(v278v1, v278v2, t, "equal-map-v278-p-nil")
- // ...
- if v == nil {
- v278v2 = nil
- } else {
- v278v2 = make(map[bool]uint64, len(v))
- } // reset map
- var v278v3, v278v4 typMapMapBoolUint64
- v278v3 = typMapMapBoolUint64(v278v1)
- v278v4 = typMapMapBoolUint64(v278v2)
- bs278 = testMarshalErr(v278v3, h, t, "enc-map-v278-custom")
- testUnmarshalErr(v278v4, bs278, h, t, "dec-map-v278-p-len")
- testDeepEqualErr(v278v3, v278v4, t, "equal-map-v278-p-len")
- }
-
- for _, v := range []map[bool]uintptr{nil, {}, {true: 0}} {
- // fmt.Printf(">>>> running mammoth map v279: %v\n", v)
- var v279v1, v279v2 map[bool]uintptr
- v279v1 = v
- bs279 := testMarshalErr(v279v1, h, t, "enc-map-v279")
- if v == nil {
- v279v2 = nil
- } else {
- v279v2 = make(map[bool]uintptr, len(v))
- } // reset map
- testUnmarshalErr(v279v2, bs279, h, t, "dec-map-v279")
- testDeepEqualErr(v279v1, v279v2, t, "equal-map-v279")
- if v == nil {
- v279v2 = nil
- } else {
- v279v2 = make(map[bool]uintptr, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v279v2), bs279, h, t, "dec-map-v279-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v279v1, v279v2, t, "equal-map-v279-noaddr")
- if v == nil {
- v279v2 = nil
- } else {
- v279v2 = make(map[bool]uintptr, len(v))
- } // reset map
- testUnmarshalErr(&v279v2, bs279, h, t, "dec-map-v279-p-len")
- testDeepEqualErr(v279v1, v279v2, t, "equal-map-v279-p-len")
- bs279 = testMarshalErr(&v279v1, h, t, "enc-map-v279-p")
- v279v2 = nil
- testUnmarshalErr(&v279v2, bs279, h, t, "dec-map-v279-p-nil")
- testDeepEqualErr(v279v1, v279v2, t, "equal-map-v279-p-nil")
- // ...
- if v == nil {
- v279v2 = nil
- } else {
- v279v2 = make(map[bool]uintptr, len(v))
- } // reset map
- var v279v3, v279v4 typMapMapBoolUintptr
- v279v3 = typMapMapBoolUintptr(v279v1)
- v279v4 = typMapMapBoolUintptr(v279v2)
- bs279 = testMarshalErr(v279v3, h, t, "enc-map-v279-custom")
- testUnmarshalErr(v279v4, bs279, h, t, "dec-map-v279-p-len")
- testDeepEqualErr(v279v3, v279v4, t, "equal-map-v279-p-len")
- }
-
- for _, v := range []map[bool]int{nil, {}, {true: 0}} {
- // fmt.Printf(">>>> running mammoth map v280: %v\n", v)
- var v280v1, v280v2 map[bool]int
- v280v1 = v
- bs280 := testMarshalErr(v280v1, h, t, "enc-map-v280")
- if v == nil {
- v280v2 = nil
- } else {
- v280v2 = make(map[bool]int, len(v))
- } // reset map
- testUnmarshalErr(v280v2, bs280, h, t, "dec-map-v280")
- testDeepEqualErr(v280v1, v280v2, t, "equal-map-v280")
- if v == nil {
- v280v2 = nil
- } else {
- v280v2 = make(map[bool]int, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v280v2), bs280, h, t, "dec-map-v280-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v280v1, v280v2, t, "equal-map-v280-noaddr")
- if v == nil {
- v280v2 = nil
- } else {
- v280v2 = make(map[bool]int, len(v))
- } // reset map
- testUnmarshalErr(&v280v2, bs280, h, t, "dec-map-v280-p-len")
- testDeepEqualErr(v280v1, v280v2, t, "equal-map-v280-p-len")
- bs280 = testMarshalErr(&v280v1, h, t, "enc-map-v280-p")
- v280v2 = nil
- testUnmarshalErr(&v280v2, bs280, h, t, "dec-map-v280-p-nil")
- testDeepEqualErr(v280v1, v280v2, t, "equal-map-v280-p-nil")
- // ...
- if v == nil {
- v280v2 = nil
- } else {
- v280v2 = make(map[bool]int, len(v))
- } // reset map
- var v280v3, v280v4 typMapMapBoolInt
- v280v3 = typMapMapBoolInt(v280v1)
- v280v4 = typMapMapBoolInt(v280v2)
- bs280 = testMarshalErr(v280v3, h, t, "enc-map-v280-custom")
- testUnmarshalErr(v280v4, bs280, h, t, "dec-map-v280-p-len")
- testDeepEqualErr(v280v3, v280v4, t, "equal-map-v280-p-len")
- }
-
- for _, v := range []map[bool]int8{nil, {}, {true: 0}} {
- // fmt.Printf(">>>> running mammoth map v281: %v\n", v)
- var v281v1, v281v2 map[bool]int8
- v281v1 = v
- bs281 := testMarshalErr(v281v1, h, t, "enc-map-v281")
- if v == nil {
- v281v2 = nil
- } else {
- v281v2 = make(map[bool]int8, len(v))
- } // reset map
- testUnmarshalErr(v281v2, bs281, h, t, "dec-map-v281")
- testDeepEqualErr(v281v1, v281v2, t, "equal-map-v281")
- if v == nil {
- v281v2 = nil
- } else {
- v281v2 = make(map[bool]int8, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v281v2), bs281, h, t, "dec-map-v281-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v281v1, v281v2, t, "equal-map-v281-noaddr")
- if v == nil {
- v281v2 = nil
- } else {
- v281v2 = make(map[bool]int8, len(v))
- } // reset map
- testUnmarshalErr(&v281v2, bs281, h, t, "dec-map-v281-p-len")
- testDeepEqualErr(v281v1, v281v2, t, "equal-map-v281-p-len")
- bs281 = testMarshalErr(&v281v1, h, t, "enc-map-v281-p")
- v281v2 = nil
- testUnmarshalErr(&v281v2, bs281, h, t, "dec-map-v281-p-nil")
- testDeepEqualErr(v281v1, v281v2, t, "equal-map-v281-p-nil")
- // ...
- if v == nil {
- v281v2 = nil
- } else {
- v281v2 = make(map[bool]int8, len(v))
- } // reset map
- var v281v3, v281v4 typMapMapBoolInt8
- v281v3 = typMapMapBoolInt8(v281v1)
- v281v4 = typMapMapBoolInt8(v281v2)
- bs281 = testMarshalErr(v281v3, h, t, "enc-map-v281-custom")
- testUnmarshalErr(v281v4, bs281, h, t, "dec-map-v281-p-len")
- testDeepEqualErr(v281v3, v281v4, t, "equal-map-v281-p-len")
- }
-
- for _, v := range []map[bool]int16{nil, {}, {true: 0}} {
- // fmt.Printf(">>>> running mammoth map v282: %v\n", v)
- var v282v1, v282v2 map[bool]int16
- v282v1 = v
- bs282 := testMarshalErr(v282v1, h, t, "enc-map-v282")
- if v == nil {
- v282v2 = nil
- } else {
- v282v2 = make(map[bool]int16, len(v))
- } // reset map
- testUnmarshalErr(v282v2, bs282, h, t, "dec-map-v282")
- testDeepEqualErr(v282v1, v282v2, t, "equal-map-v282")
- if v == nil {
- v282v2 = nil
- } else {
- v282v2 = make(map[bool]int16, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v282v2), bs282, h, t, "dec-map-v282-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v282v1, v282v2, t, "equal-map-v282-noaddr")
- if v == nil {
- v282v2 = nil
- } else {
- v282v2 = make(map[bool]int16, len(v))
- } // reset map
- testUnmarshalErr(&v282v2, bs282, h, t, "dec-map-v282-p-len")
- testDeepEqualErr(v282v1, v282v2, t, "equal-map-v282-p-len")
- bs282 = testMarshalErr(&v282v1, h, t, "enc-map-v282-p")
- v282v2 = nil
- testUnmarshalErr(&v282v2, bs282, h, t, "dec-map-v282-p-nil")
- testDeepEqualErr(v282v1, v282v2, t, "equal-map-v282-p-nil")
- // ...
- if v == nil {
- v282v2 = nil
- } else {
- v282v2 = make(map[bool]int16, len(v))
- } // reset map
- var v282v3, v282v4 typMapMapBoolInt16
- v282v3 = typMapMapBoolInt16(v282v1)
- v282v4 = typMapMapBoolInt16(v282v2)
- bs282 = testMarshalErr(v282v3, h, t, "enc-map-v282-custom")
- testUnmarshalErr(v282v4, bs282, h, t, "dec-map-v282-p-len")
- testDeepEqualErr(v282v3, v282v4, t, "equal-map-v282-p-len")
- }
-
- for _, v := range []map[bool]int32{nil, {}, {true: 0}} {
- // fmt.Printf(">>>> running mammoth map v283: %v\n", v)
- var v283v1, v283v2 map[bool]int32
- v283v1 = v
- bs283 := testMarshalErr(v283v1, h, t, "enc-map-v283")
- if v == nil {
- v283v2 = nil
- } else {
- v283v2 = make(map[bool]int32, len(v))
- } // reset map
- testUnmarshalErr(v283v2, bs283, h, t, "dec-map-v283")
- testDeepEqualErr(v283v1, v283v2, t, "equal-map-v283")
- if v == nil {
- v283v2 = nil
- } else {
- v283v2 = make(map[bool]int32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v283v2), bs283, h, t, "dec-map-v283-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v283v1, v283v2, t, "equal-map-v283-noaddr")
- if v == nil {
- v283v2 = nil
- } else {
- v283v2 = make(map[bool]int32, len(v))
- } // reset map
- testUnmarshalErr(&v283v2, bs283, h, t, "dec-map-v283-p-len")
- testDeepEqualErr(v283v1, v283v2, t, "equal-map-v283-p-len")
- bs283 = testMarshalErr(&v283v1, h, t, "enc-map-v283-p")
- v283v2 = nil
- testUnmarshalErr(&v283v2, bs283, h, t, "dec-map-v283-p-nil")
- testDeepEqualErr(v283v1, v283v2, t, "equal-map-v283-p-nil")
- // ...
- if v == nil {
- v283v2 = nil
- } else {
- v283v2 = make(map[bool]int32, len(v))
- } // reset map
- var v283v3, v283v4 typMapMapBoolInt32
- v283v3 = typMapMapBoolInt32(v283v1)
- v283v4 = typMapMapBoolInt32(v283v2)
- bs283 = testMarshalErr(v283v3, h, t, "enc-map-v283-custom")
- testUnmarshalErr(v283v4, bs283, h, t, "dec-map-v283-p-len")
- testDeepEqualErr(v283v3, v283v4, t, "equal-map-v283-p-len")
- }
-
- for _, v := range []map[bool]int64{nil, {}, {true: 0}} {
- // fmt.Printf(">>>> running mammoth map v284: %v\n", v)
- var v284v1, v284v2 map[bool]int64
- v284v1 = v
- bs284 := testMarshalErr(v284v1, h, t, "enc-map-v284")
- if v == nil {
- v284v2 = nil
- } else {
- v284v2 = make(map[bool]int64, len(v))
- } // reset map
- testUnmarshalErr(v284v2, bs284, h, t, "dec-map-v284")
- testDeepEqualErr(v284v1, v284v2, t, "equal-map-v284")
- if v == nil {
- v284v2 = nil
- } else {
- v284v2 = make(map[bool]int64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v284v2), bs284, h, t, "dec-map-v284-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v284v1, v284v2, t, "equal-map-v284-noaddr")
- if v == nil {
- v284v2 = nil
- } else {
- v284v2 = make(map[bool]int64, len(v))
- } // reset map
- testUnmarshalErr(&v284v2, bs284, h, t, "dec-map-v284-p-len")
- testDeepEqualErr(v284v1, v284v2, t, "equal-map-v284-p-len")
- bs284 = testMarshalErr(&v284v1, h, t, "enc-map-v284-p")
- v284v2 = nil
- testUnmarshalErr(&v284v2, bs284, h, t, "dec-map-v284-p-nil")
- testDeepEqualErr(v284v1, v284v2, t, "equal-map-v284-p-nil")
- // ...
- if v == nil {
- v284v2 = nil
- } else {
- v284v2 = make(map[bool]int64, len(v))
- } // reset map
- var v284v3, v284v4 typMapMapBoolInt64
- v284v3 = typMapMapBoolInt64(v284v1)
- v284v4 = typMapMapBoolInt64(v284v2)
- bs284 = testMarshalErr(v284v3, h, t, "enc-map-v284-custom")
- testUnmarshalErr(v284v4, bs284, h, t, "dec-map-v284-p-len")
- testDeepEqualErr(v284v3, v284v4, t, "equal-map-v284-p-len")
- }
-
- for _, v := range []map[bool]float32{nil, {}, {true: 0}} {
- // fmt.Printf(">>>> running mammoth map v285: %v\n", v)
- var v285v1, v285v2 map[bool]float32
- v285v1 = v
- bs285 := testMarshalErr(v285v1, h, t, "enc-map-v285")
- if v == nil {
- v285v2 = nil
- } else {
- v285v2 = make(map[bool]float32, len(v))
- } // reset map
- testUnmarshalErr(v285v2, bs285, h, t, "dec-map-v285")
- testDeepEqualErr(v285v1, v285v2, t, "equal-map-v285")
- if v == nil {
- v285v2 = nil
- } else {
- v285v2 = make(map[bool]float32, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v285v2), bs285, h, t, "dec-map-v285-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v285v1, v285v2, t, "equal-map-v285-noaddr")
- if v == nil {
- v285v2 = nil
- } else {
- v285v2 = make(map[bool]float32, len(v))
- } // reset map
- testUnmarshalErr(&v285v2, bs285, h, t, "dec-map-v285-p-len")
- testDeepEqualErr(v285v1, v285v2, t, "equal-map-v285-p-len")
- bs285 = testMarshalErr(&v285v1, h, t, "enc-map-v285-p")
- v285v2 = nil
- testUnmarshalErr(&v285v2, bs285, h, t, "dec-map-v285-p-nil")
- testDeepEqualErr(v285v1, v285v2, t, "equal-map-v285-p-nil")
- // ...
- if v == nil {
- v285v2 = nil
- } else {
- v285v2 = make(map[bool]float32, len(v))
- } // reset map
- var v285v3, v285v4 typMapMapBoolFloat32
- v285v3 = typMapMapBoolFloat32(v285v1)
- v285v4 = typMapMapBoolFloat32(v285v2)
- bs285 = testMarshalErr(v285v3, h, t, "enc-map-v285-custom")
- testUnmarshalErr(v285v4, bs285, h, t, "dec-map-v285-p-len")
- testDeepEqualErr(v285v3, v285v4, t, "equal-map-v285-p-len")
- }
-
- for _, v := range []map[bool]float64{nil, {}, {true: 0}} {
- // fmt.Printf(">>>> running mammoth map v286: %v\n", v)
- var v286v1, v286v2 map[bool]float64
- v286v1 = v
- bs286 := testMarshalErr(v286v1, h, t, "enc-map-v286")
- if v == nil {
- v286v2 = nil
- } else {
- v286v2 = make(map[bool]float64, len(v))
- } // reset map
- testUnmarshalErr(v286v2, bs286, h, t, "dec-map-v286")
- testDeepEqualErr(v286v1, v286v2, t, "equal-map-v286")
- if v == nil {
- v286v2 = nil
- } else {
- v286v2 = make(map[bool]float64, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v286v2), bs286, h, t, "dec-map-v286-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v286v1, v286v2, t, "equal-map-v286-noaddr")
- if v == nil {
- v286v2 = nil
- } else {
- v286v2 = make(map[bool]float64, len(v))
- } // reset map
- testUnmarshalErr(&v286v2, bs286, h, t, "dec-map-v286-p-len")
- testDeepEqualErr(v286v1, v286v2, t, "equal-map-v286-p-len")
- bs286 = testMarshalErr(&v286v1, h, t, "enc-map-v286-p")
- v286v2 = nil
- testUnmarshalErr(&v286v2, bs286, h, t, "dec-map-v286-p-nil")
- testDeepEqualErr(v286v1, v286v2, t, "equal-map-v286-p-nil")
- // ...
- if v == nil {
- v286v2 = nil
- } else {
- v286v2 = make(map[bool]float64, len(v))
- } // reset map
- var v286v3, v286v4 typMapMapBoolFloat64
- v286v3 = typMapMapBoolFloat64(v286v1)
- v286v4 = typMapMapBoolFloat64(v286v2)
- bs286 = testMarshalErr(v286v3, h, t, "enc-map-v286-custom")
- testUnmarshalErr(v286v4, bs286, h, t, "dec-map-v286-p-len")
- testDeepEqualErr(v286v3, v286v4, t, "equal-map-v286-p-len")
- }
-
- for _, v := range []map[bool]bool{nil, {}, {true: false}} {
- // fmt.Printf(">>>> running mammoth map v287: %v\n", v)
- var v287v1, v287v2 map[bool]bool
- v287v1 = v
- bs287 := testMarshalErr(v287v1, h, t, "enc-map-v287")
- if v == nil {
- v287v2 = nil
- } else {
- v287v2 = make(map[bool]bool, len(v))
- } // reset map
- testUnmarshalErr(v287v2, bs287, h, t, "dec-map-v287")
- testDeepEqualErr(v287v1, v287v2, t, "equal-map-v287")
- if v == nil {
- v287v2 = nil
- } else {
- v287v2 = make(map[bool]bool, len(v))
- } // reset map
- testUnmarshalErr(reflect.ValueOf(v287v2), bs287, h, t, "dec-map-v287-noaddr") // decode into non-addressable map value
- testDeepEqualErr(v287v1, v287v2, t, "equal-map-v287-noaddr")
- if v == nil {
- v287v2 = nil
- } else {
- v287v2 = make(map[bool]bool, len(v))
- } // reset map
- testUnmarshalErr(&v287v2, bs287, h, t, "dec-map-v287-p-len")
- testDeepEqualErr(v287v1, v287v2, t, "equal-map-v287-p-len")
- bs287 = testMarshalErr(&v287v1, h, t, "enc-map-v287-p")
- v287v2 = nil
- testUnmarshalErr(&v287v2, bs287, h, t, "dec-map-v287-p-nil")
- testDeepEqualErr(v287v1, v287v2, t, "equal-map-v287-p-nil")
- // ...
- if v == nil {
- v287v2 = nil
- } else {
- v287v2 = make(map[bool]bool, len(v))
- } // reset map
- var v287v3, v287v4 typMapMapBoolBool
- v287v3 = typMapMapBoolBool(v287v1)
- v287v4 = typMapMapBoolBool(v287v2)
- bs287 = testMarshalErr(v287v3, h, t, "enc-map-v287-custom")
- testUnmarshalErr(v287v4, bs287, h, t, "dec-map-v287-p-len")
- testDeepEqualErr(v287v3, v287v4, t, "equal-map-v287-p-len")
- }
-
-}
-
-func doTestMammothMapsAndSlices(t *testing.T, h Handle) {
- doTestMammothSlices(t, h)
- doTestMammothMaps(t, h)
-}
diff --git a/vendor/github.com/ugorji/go/codec/py_test.go b/vendor/github.com/ugorji/go/codec/py_test.go
deleted file mode 100644
index d5ff6d259..000000000
--- a/vendor/github.com/ugorji/go/codec/py_test.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// +build x
-
-// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-// These tests are used to verify msgpack and cbor implementations against their python libraries.
-// If you have the library installed, you can enable the tests back by running: go test -tags=x .
-// Look at test.py for how to setup your environment.
-
-import (
- "testing"
-)
-
-func TestMsgpackPythonGenStreams(t *testing.T) {
- doTestPythonGenStreams(t, "msgpack", testMsgpackH)
-}
-
-func TestCborPythonGenStreams(t *testing.T) {
- doTestPythonGenStreams(t, "cbor", testCborH)
-}
-
-func TestMsgpackRpcSpecGoClientToPythonSvc(t *testing.T) {
- doTestMsgpackRpcSpecGoClientToPythonSvc(t)
-}
-
-func TestMsgpackRpcSpecPythonClientToGoSvc(t *testing.T) {
- doTestMsgpackRpcSpecPythonClientToGoSvc(t)
-}
diff --git a/vendor/github.com/ugorji/go/codec/shared_test.go b/vendor/github.com/ugorji/go/codec/shared_test.go
deleted file mode 100644
index aa8c325e1..000000000
--- a/vendor/github.com/ugorji/go/codec/shared_test.go
+++ /dev/null
@@ -1,304 +0,0 @@
-// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-// This file sets up the variables used, including testInitFns.
-// Each file should add initialization that should be performed
-// after flags are parsed.
-//
-// init is a multi-step process:
-// - setup vars (handled by init functions in each file)
-// - parse flags
-// - setup derived vars (handled by pre-init registered functions - registered in init function)
-// - post init (handled by post-init registered functions - registered in init function)
-// This way, no one has to manage carefully control the initialization
-// using file names, etc.
-//
-// Tests which require external dependencies need the -tag=x parameter.
-// They should be run as:
-// go test -tags=x -run=. <other parameters ...>
-// Benchmarks should also take this parameter, to include the sereal, xdr, etc.
-// To run against codecgen, etc, make sure you pass extra parameters.
-// Example usage:
-// go test "-tags=x codecgen" -bench=. <other parameters ...>
-//
-// To fully test everything:
-// go test -tags=x -benchtime=100ms -tv -bg -bi -brw -bu -v -run=. -bench=.
-
-// Handling flags
-// codec_test.go will define a set of global flags for testing, including:
-// - Use Reset
-// - Use IO reader/writer (vs direct bytes)
-// - Set Canonical
-// - Set InternStrings
-// - Use Symbols
-//
-// This way, we can test them all by running same set of tests with a different
-// set of flags.
-//
-// Following this, all the benchmarks will utilize flags set by codec_test.go
-// and will not redefine these "global" flags.
-
-import (
- "bytes"
- "flag"
- "fmt"
- "io"
- "io/ioutil"
- "log"
- "sync"
- "testing"
-)
-
-// DO NOT REMOVE - replacement line for go-codec-bench import declaration tag //
-
-type testHED struct {
- H Handle
- E *Encoder
- D *Decoder
-}
-
-type ioReaderWrapper struct {
- r io.Reader
-}
-
-func (x ioReaderWrapper) Read(p []byte) (n int, err error) {
- return x.r.Read(p)
-}
-
-type ioWriterWrapper struct {
- w io.Writer
-}
-
-func (x ioWriterWrapper) Write(p []byte) (n int, err error) {
- return x.w.Write(p)
-}
-
-var (
- // testNoopH = NoopHandle(8)
- testMsgpackH = &MsgpackHandle{}
- testBincH = &BincHandle{}
- testSimpleH = &SimpleHandle{}
- testCborH = &CborHandle{}
- testJsonH = &JsonHandle{}
-
- testHandles []Handle
- testPreInitFns []func()
- testPostInitFns []func()
-
- testOnce sync.Once
-
- testHEDs []testHED
-)
-
-// flag variables used by tests (and bench)
-var (
- testDepth int
-
- testVerbose bool
- testInitDebug bool
- testStructToArray bool
- testCanonical bool
- testUseReset bool
- testSkipIntf bool
- testInternStr bool
- testUseMust bool
- testCheckCircRef bool
-
- testUseIoEncDec int
- testUseIoWrapper bool
-
- testMaxInitLen int
-
- testNumRepeatString int
-
- testRpcBufsize int
-)
-
-// variables that are not flags, but which can configure the handles
-var (
- testEncodeOptions EncodeOptions
- testDecodeOptions DecodeOptions
-)
-
-// flag variables used by bench
-var (
- benchDoInitBench bool
- benchVerify bool
- benchUnscientificRes bool = false
- benchMapStringKeyOnly bool
- //depth of 0 maps to ~400bytes json-encoded string, 1 maps to ~1400 bytes, etc
- //For depth>1, we likely trigger stack growth for encoders, making benchmarking unreliable.
- benchDepth int
- benchInitDebug bool
-)
-
-func init() {
- log.SetOutput(ioutil.Discard) // don't allow things log to standard out/err
- testHEDs = make([]testHED, 0, 32)
- testHandles = append(testHandles,
- // testNoopH,
- testMsgpackH, testBincH, testSimpleH,
- testCborH, testJsonH)
- testInitFlags()
- benchInitFlags()
-}
-
-func testInitFlags() {
- // delete(testDecOpts.ExtFuncs, timeTyp)
- flag.IntVar(&testDepth, "tsd", 0, "Test Struc Depth")
- flag.BoolVar(&testVerbose, "tv", false, "Test Verbose (no longer used - here for compatibility)")
- flag.BoolVar(&testInitDebug, "tg", false, "Test Init Debug")
- flag.IntVar(&testUseIoEncDec, "ti", -1, "Use IO Reader/Writer for Marshal/Unmarshal ie >= 0")
- flag.BoolVar(&testUseIoWrapper, "tiw", false, "Wrap the IO Reader/Writer with a base pass-through reader/writer")
- flag.BoolVar(&testStructToArray, "ts", false, "Set StructToArray option")
- flag.BoolVar(&testCanonical, "tc", false, "Set Canonical option")
- flag.BoolVar(&testInternStr, "te", false, "Set InternStr option")
- flag.BoolVar(&testSkipIntf, "tf", false, "Skip Interfaces")
- flag.BoolVar(&testUseReset, "tr", false, "Use Reset")
- flag.IntVar(&testNumRepeatString, "trs", 8, "Create string variables by repeating a string N times")
- flag.IntVar(&testMaxInitLen, "tx", 0, "Max Init Len")
- flag.BoolVar(&testUseMust, "tm", true, "Use Must(En|De)code")
- flag.BoolVar(&testCheckCircRef, "tl", false, "Use Check Circular Ref")
-}
-
-func benchInitFlags() {
- flag.BoolVar(&benchMapStringKeyOnly, "bs", false, "Bench use maps with string keys only")
- flag.BoolVar(&benchInitDebug, "bg", false, "Bench Debug")
- flag.IntVar(&benchDepth, "bd", 1, "Bench Depth")
- flag.BoolVar(&benchDoInitBench, "bi", false, "Run Bench Init")
- flag.BoolVar(&benchVerify, "bv", false, "Verify Decoded Value during Benchmark")
- flag.BoolVar(&benchUnscientificRes, "bu", false, "Show Unscientific Results during Benchmark")
-}
-
-func testHEDGet(h Handle) *testHED {
- for i := range testHEDs {
- v := &testHEDs[i]
- if v.H == h {
- return v
- }
- }
- testHEDs = append(testHEDs, testHED{h, NewEncoder(nil, h), NewDecoder(nil, h)})
- return &testHEDs[len(testHEDs)-1]
-}
-
-func testReinit() {
- testOnce = sync.Once{}
- testHEDs = nil
-}
-
-func testInitAll() {
- // only parse it once.
- if !flag.Parsed() {
- flag.Parse()
- }
- for _, f := range testPreInitFns {
- f()
- }
- for _, f := range testPostInitFns {
- f()
- }
-}
-
-func sTestCodecEncode(ts interface{}, bsIn []byte, fn func([]byte) *bytes.Buffer,
- h Handle, bh *BasicHandle) (bs []byte, err error) {
- // bs = make([]byte, 0, approxSize)
- var e *Encoder
- var buf *bytes.Buffer
- if testUseReset {
- e = testHEDGet(h).E
- } else {
- e = NewEncoder(nil, h)
- }
- var oldWriteBufferSize int
- if testUseIoEncDec >= 0 {
- buf = fn(bsIn)
- // set the encode options for using a buffer
- oldWriteBufferSize = bh.WriterBufferSize
- bh.WriterBufferSize = testUseIoEncDec
- if testUseIoWrapper {
- e.Reset(ioWriterWrapper{buf})
- } else {
- e.Reset(buf)
- }
- } else {
- bs = bsIn
- e.ResetBytes(&bs)
- }
- if testUseMust {
- e.MustEncode(ts)
- } else {
- err = e.Encode(ts)
- }
- if testUseIoEncDec >= 0 {
- bs = buf.Bytes()
- bh.WriterBufferSize = oldWriteBufferSize
- }
- return
-}
-
-func sTestCodecDecode(bs []byte, ts interface{}, h Handle, bh *BasicHandle) (err error) {
- var d *Decoder
- // var buf *bytes.Reader
- if testUseReset {
- d = testHEDGet(h).D
- } else {
- d = NewDecoder(nil, h)
- }
- var oldReadBufferSize int
- if testUseIoEncDec >= 0 {
- buf := bytes.NewReader(bs)
- oldReadBufferSize = bh.ReaderBufferSize
- bh.ReaderBufferSize = testUseIoEncDec
- if testUseIoWrapper {
- d.Reset(ioReaderWrapper{buf})
- } else {
- d.Reset(buf)
- }
- } else {
- d.ResetBytes(bs)
- }
- if testUseMust {
- d.MustDecode(ts)
- } else {
- err = d.Decode(ts)
- }
- if testUseIoEncDec >= 0 {
- bh.ReaderBufferSize = oldReadBufferSize
- }
- return
-}
-
-// --- functions below are used by both benchmarks and tests
-
-func logT(x interface{}, format string, args ...interface{}) {
- if t, ok := x.(*testing.T); ok && t != nil {
- t.Logf(format, args...)
- } else if b, ok := x.(*testing.B); ok && b != nil {
- b.Logf(format, args...)
- } else { // if testing.Verbose() { // if testVerbose {
- if len(format) == 0 || format[len(format)-1] != '\n' {
- format = format + "\n"
- }
- fmt.Printf(format, args...)
- }
-}
-
-// --- functions below are used only by benchmarks alone
-
-func fnBenchmarkByteBuf(bsIn []byte) (buf *bytes.Buffer) {
- // var buf bytes.Buffer
- // buf.Grow(approxSize)
- buf = bytes.NewBuffer(bsIn)
- buf.Truncate(0)
- return
-}
-
-// func benchFnCodecEncode(ts interface{}, bsIn []byte, h Handle) (bs []byte, err error) {
-// return testCodecEncode(ts, bsIn, fnBenchmarkByteBuf, h)
-// }
-
-// func benchFnCodecDecode(bs []byte, ts interface{}, h Handle) (err error) {
-// return testCodecDecode(bs, ts, h)
-// }
diff --git a/vendor/github.com/ugorji/go/codec/values_flex_test.go b/vendor/github.com/ugorji/go/codec/values_flex_test.go
deleted file mode 100644
index 6f7de6926..000000000
--- a/vendor/github.com/ugorji/go/codec/values_flex_test.go
+++ /dev/null
@@ -1,208 +0,0 @@
-/* // +build testing */
-
-// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-import (
- "strings"
- "time"
-)
-
-const teststrucflexChanCap = 64
-
-// This file contains values used by tests alone.
-// This is where we may try out different things,
-// that other engines may not support or may barf upon
-// e.g. custom extensions for wrapped types, maps with non-string keys, etc.
-
-// Some unused types just stored here
-type Bbool bool
-type Sstring string
-type Sstructsmall struct {
- A int
-}
-
-type Sstructbig struct {
- A int
- B bool
- c string
- // Sval Sstruct
- Ssmallptr *Sstructsmall
- Ssmall *Sstructsmall
- Sptr *Sstructbig
-}
-
-type SstructbigMapBySlice struct {
- _struct struct{} `codec:",toarray"`
- A int
- B bool
- c string
- // Sval Sstruct
- Ssmallptr *Sstructsmall
- Ssmall *Sstructsmall
- Sptr *Sstructbig
-}
-
-// small struct for testing that codecgen works for unexported types
-type tLowerFirstLetter struct {
- I int
- u uint64
- S string
- b []byte
-}
-
-// Some used types
-type wrapInt64 int64
-type wrapUint8 uint8
-type wrapBytes []uint8
-
-type AnonInTestStrucIntf struct {
- Islice []interface{}
- Ms map[string]interface{}
- Nintf interface{} //don't set this, so we can test for nil
- T time.Time
- Tptr *time.Time
-}
-
-var testWRepeated512 wrapBytes
-var testStrucTime = time.Date(2012, 2, 2, 2, 2, 2, 2000, time.UTC).UTC()
-
-func init() {
- var testARepeated512 [512]byte
- for i := range testARepeated512 {
- testARepeated512[i] = 'A'
- }
- testWRepeated512 = wrapBytes(testARepeated512[:])
-}
-
-type TestStrucFlex struct {
- _struct struct{} `codec:",omitempty"` //set omitempty for every field
- TestStrucCommon
-
- Chstr chan string
-
- Mis map[int]string
- Mbu64 map[bool]struct{}
- Miwu64s map[int]wrapUint64Slice
- Mfwss map[float64]wrapStringSlice
- Mf32wss map[float32]wrapStringSlice
- Mui2wss map[uint64]wrapStringSlice
- Msu2wss map[stringUint64T]wrapStringSlice
-
- Ci64 wrapInt64
- Swrapbytes []wrapBytes
- Swrapuint8 []wrapUint8
-
- ArrStrUi64T [4]stringUint64T
-
- Ui64array [4]uint64
- Ui64slicearray []*[4]uint64
-
- // make this a ptr, so that it could be set or not.
- // for comparison (e.g. with msgp), give it a struct tag (so it is not inlined),
- // make this one omitempty (so it is excluded if nil).
- *AnonInTestStrucIntf `json:",omitempty"`
-
- //M map[interface{}]interface{} `json:"-",bson:"-"`
- Mtsptr map[string]*TestStrucFlex
- Mts map[string]TestStrucFlex
- Its []*TestStrucFlex
- Nteststruc *TestStrucFlex
-}
-
-func emptyTestStrucFlex() *TestStrucFlex {
- var ts TestStrucFlex
- // we initialize and start draining the chan, so that we can decode into it without it blocking due to no consumer
- ts.Chstr = make(chan string, teststrucflexChanCap)
- go func() {
- for range ts.Chstr {
- }
- }() // drain it
- return &ts
-}
-
-func newTestStrucFlex(depth, n int, bench, useInterface, useStringKeyOnly bool) (ts *TestStrucFlex) {
- ts = &TestStrucFlex{
- Chstr: make(chan string, teststrucflexChanCap),
-
- Miwu64s: map[int]wrapUint64Slice{
- 5: []wrapUint64{1, 2, 3, 4, 5},
- 3: []wrapUint64{1, 2, 3},
- },
-
- Mf32wss: map[float32]wrapStringSlice{
- 5.0: []wrapString{"1.0", "2.0", "3.0", "4.0", "5.0"},
- 3.0: []wrapString{"1.0", "2.0", "3.0"},
- },
-
- Mui2wss: map[uint64]wrapStringSlice{
- 5: []wrapString{"1.0", "2.0", "3.0", "4.0", "5.0"},
- 3: []wrapString{"1.0", "2.0", "3.0"},
- },
-
- Mfwss: map[float64]wrapStringSlice{
- 5.0: []wrapString{"1.0", "2.0", "3.0", "4.0", "5.0"},
- 3.0: []wrapString{"1.0", "2.0", "3.0"},
- },
- Mis: map[int]string{
- 1: "one",
- 22: "twenty two",
- -44: "minus forty four",
- },
- Mbu64: map[bool]struct{}{false: {}, true: {}},
-
- Ci64: -22,
- Swrapbytes: []wrapBytes{ // lengths of 1, 2, 4, 8, 16, 32, 64, 128, 256,
- testWRepeated512[:1],
- testWRepeated512[:2],
- testWRepeated512[:4],
- testWRepeated512[:8],
- testWRepeated512[:16],
- testWRepeated512[:32],
- testWRepeated512[:64],
- testWRepeated512[:128],
- testWRepeated512[:256],
- testWRepeated512[:512],
- },
- Swrapuint8: []wrapUint8{
- 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
- },
- Ui64array: [4]uint64{4, 16, 64, 256},
- ArrStrUi64T: [4]stringUint64T{{"4", 4}, {"3", 3}, {"2", 2}, {"1", 1}},
- }
-
- numChanSend := cap(ts.Chstr) / 4 // 8
- for i := 0; i < numChanSend; i++ {
- ts.Chstr <- strings.Repeat("A", i+1)
- }
-
- ts.Ui64slicearray = []*[4]uint64{&ts.Ui64array, &ts.Ui64array}
-
- if useInterface {
- ts.AnonInTestStrucIntf = &AnonInTestStrucIntf{
- Islice: []interface{}{strRpt(n, "true"), true, strRpt(n, "no"), false, uint64(288), float64(0.4)},
- Ms: map[string]interface{}{
- strRpt(n, "true"): strRpt(n, "true"),
- strRpt(n, "int64(9)"): false,
- },
- T: testStrucTime,
- }
- }
-
- populateTestStrucCommon(&ts.TestStrucCommon, n, bench, useInterface, useStringKeyOnly)
- if depth > 0 {
- depth--
- if ts.Mtsptr == nil {
- ts.Mtsptr = make(map[string]*TestStrucFlex)
- }
- if ts.Mts == nil {
- ts.Mts = make(map[string]TestStrucFlex)
- }
- ts.Mtsptr["0"] = newTestStrucFlex(depth, n, bench, useInterface, useStringKeyOnly)
- ts.Mts["0"] = *(ts.Mtsptr["0"])
- ts.Its = append(ts.Its, ts.Mtsptr["0"])
- }
- return
-}
diff --git a/vendor/github.com/ugorji/go/codec/values_test.go b/vendor/github.com/ugorji/go/codec/values_test.go
deleted file mode 100644
index 7eaec803a..000000000
--- a/vendor/github.com/ugorji/go/codec/values_test.go
+++ /dev/null
@@ -1,400 +0,0 @@
-/* // +build testing */
-
-// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-// This file contains values used by tests and benchmarks.
-// The benchmarks will test performance against other libraries
-// (encoding/json, json-iterator, bson, gob, etc).
-// Consequently, we only use values that will parse well in all engines,
-// and only leverage features that work across multiple libraries for a truer comparison.
-// For example,
-// - JSON/BSON do not like maps with keys that are not strings,
-// so we only use maps with string keys here.
-// - _struct options are not honored by other libraries,
-// so we don't use them in this file.
-
-import (
- "math"
- "strings"
-)
-
-// func init() {
-// rt := reflect.TypeOf((*TestStruc)(nil)).Elem()
-// defTypeInfos.get(rt2id(rt), rt)
-// }
-
-type wrapSliceUint64 []uint64
-type wrapSliceString []string
-type wrapUint64 uint64
-type wrapString string
-type wrapUint64Slice []wrapUint64
-type wrapStringSlice []wrapString
-
-type stringUint64T struct {
- S string
- U uint64
-}
-
-type AnonInTestStruc struct {
- AS string
- AI64 int64
- AI16 int16
- AUi64 uint64
- ASslice []string
- AI64slice []int64
- AUi64slice []uint64
- AF64slice []float64
- AF32slice []float32
-
- // AMI32U32 map[int32]uint32
- // AMU32F64 map[uint32]float64 // json/bson do not like it
- AMSU16 map[string]uint16
-
- // use these to test 0-len or nil slices/maps/arrays
- AI64arr0 [0]int64
- A164slice0 []int64
- AUi64sliceN []uint64
- AMSU16N map[string]uint16
- AMSU16E map[string]uint16
-}
-
-// testSimpleFields is a sub-set of TestStrucCommon
-type testSimpleFields struct {
- S string
-
- I64 int64
- I8 int8
-
- Ui64 uint64
- Ui8 uint8
-
- F64 float64
- F32 float32
-
- B bool
-
- Sslice []string
- I16slice []int16
- Ui64slice []uint64
- Ui8slice []uint8
- Bslice []bool
-
- Iptrslice []*int64
-
- WrapSliceInt64 wrapSliceUint64
- WrapSliceString wrapSliceString
-
- Msi64 map[string]int64
-}
-
-type TestStrucCommon struct {
- S string
-
- I64 int64
- I32 int32
- I16 int16
- I8 int8
-
- I64n int64
- I32n int32
- I16n int16
- I8n int8
-
- Ui64 uint64
- Ui32 uint32
- Ui16 uint16
- Ui8 uint8
-
- F64 float64
- F32 float32
-
- B bool
- By uint8 // byte: msgp doesn't like byte
-
- Sslice []string
- I64slice []int64
- I16slice []int16
- Ui64slice []uint64
- Ui8slice []uint8
- Bslice []bool
- Byslice []byte
-
- Iptrslice []*int64
-
- WrapSliceInt64 wrapSliceUint64
- WrapSliceString wrapSliceString
-
- Msi64 map[string]int64
-
- Simplef testSimpleFields
-
- SstrUi64T []stringUint64T
-
- AnonInTestStruc
-
- NotAnon AnonInTestStruc
-
- // R Raw // Testing Raw must be explicitly turned on, so use standalone test
- // Rext RawExt // Testing RawExt is tricky, so use standalone test
-
- Nmap map[string]bool //don't set this, so we can test for nil
- Nslice []byte //don't set this, so we can test for nil
- Nint64 *int64 //don't set this, so we can test for nil
-}
-
-type TestStruc struct {
- // _struct struct{} `json:",omitempty"` //set omitempty for every field
-
- TestStrucCommon
-
- Mtsptr map[string]*TestStruc
- Mts map[string]TestStruc
- Its []*TestStruc
- Nteststruc *TestStruc
-}
-
-func populateTestStrucCommon(ts *TestStrucCommon, n int, bench, useInterface, useStringKeyOnly bool) {
- var i64a, i64b, i64c, i64d int64 = 64, 6464, 646464, 64646464
-
- // if bench, do not use uint64 values > math.MaxInt64, as bson, etc cannot decode them
-
- var a = AnonInTestStruc{
- // There's more leeway in altering this.
- AS: strRpt(n, "A-String"),
- AI64: -64646464,
- AI16: 1616,
- AUi64: 64646464,
- // (U+1D11E)G-clef character may be represented in json as "\uD834\uDD1E".
- // single reverse solidus character may be represented in json as "\u005C".
- // include these in ASslice below.
- ASslice: []string{
- strRpt(n, "Aone"),
- strRpt(n, "Atwo"),
- strRpt(n, "Athree"),
- strRpt(n, "Afour.reverse_solidus.\u005c"),
- strRpt(n, "Afive.Gclef.\U0001d11E\"ugorji\"done.")},
- AI64slice: []int64{
- 0, 1, -1, -22, 333, -4444, 55555, -666666,
- // msgpack ones
- -48, -32, -24, -8, 32, 127, 192, 255,
- // standard ones
- 0, -1, 1,
- math.MaxInt8, math.MaxInt8 + 4, math.MaxInt8 - 4,
- math.MaxInt16, math.MaxInt16 + 4, math.MaxInt16 - 4,
- math.MaxInt32, math.MaxInt32 + 4, math.MaxInt32 - 4,
- math.MaxInt64, math.MaxInt64 - 4,
- math.MinInt8, math.MinInt8 + 4, math.MinInt8 - 4,
- math.MinInt16, math.MinInt16 + 4, math.MinInt16 - 4,
- math.MinInt32, math.MinInt32 + 4, math.MinInt32 - 4,
- math.MinInt64, math.MinInt64 + 4,
- },
- AUi64slice: []uint64{
- 0, 1, 22, 333, 4444, 55555, 666666,
- // standard ones
- math.MaxUint8, math.MaxUint8 + 4, math.MaxUint8 - 4,
- math.MaxUint16, math.MaxUint16 + 4, math.MaxUint16 - 4,
- math.MaxUint32, math.MaxUint32 + 4, math.MaxUint32 - 4,
- },
- AMSU16: map[string]uint16{strRpt(n, "1"): 1, strRpt(n, "22"): 2, strRpt(n, "333"): 3, strRpt(n, "4444"): 4},
-
- // Note: +/- inf, NaN, and other non-representable numbers should not be explicitly tested here
-
- AF64slice: []float64{
- 11.11e-11, -11.11e+11,
- 2.222E+12, -2.222E-12,
- -555.55E-5, 555.55E+5,
- 666.66E-6, -666.66E+6,
- 7777.7777E-7, -7777.7777E-7,
- -8888.8888E+8, 8888.8888E+8,
- -99999.9999E+9, 99999.9999E+9,
- // these below are hairy enough to need strconv.ParseFloat
- 33.33E-33, -33.33E+33,
- 44.44e+44, -44.44e-44,
- // standard ones
- 0, -1, 1,
- // math.Inf(1), math.Inf(-1),
- math.Pi, math.Phi, math.E,
- math.MaxFloat64, math.SmallestNonzeroFloat64,
- },
- AF32slice: []float32{
- 11.11e-11, -11.11e+11,
- 2.222E+12, -2.222E-12,
- -555.55E-5, 555.55E+5,
- 666.66E-6, -666.66E+6,
- 7777.7777E-7, -7777.7777E-7,
- -8888.8888E+8, 8888.8888E+8,
- -99999.9999E+9, 99999.9999E+9,
- // these below are hairy enough to need strconv.ParseFloat
- 33.33E-33, -33.33E+33,
- // standard ones
- 0, -1, 1,
- // math.Float32frombits(0x7FF00000), math.Float32frombits(0xFFF00000), //+inf and -inf
- math.MaxFloat32, math.SmallestNonzeroFloat32,
- },
-
- A164slice0: []int64{},
- AUi64sliceN: nil,
- AMSU16N: nil,
- AMSU16E: map[string]uint16{},
- }
-
- if !bench {
- a.AUi64slice = append(a.AUi64slice, math.MaxUint64, math.MaxUint64-4)
- }
- *ts = TestStrucCommon{
- S: strRpt(n, `some really really cool names that are nigerian and american like "ugorji melody nwoke" - get it? `),
-
- // set the numbers close to the limits
- I8: math.MaxInt8 * 2 / 3, // 8,
- I8n: math.MinInt8 * 2 / 3, // 8,
- I16: math.MaxInt16 * 2 / 3, // 16,
- I16n: math.MinInt16 * 2 / 3, // 16,
- I32: math.MaxInt32 * 2 / 3, // 32,
- I32n: math.MinInt32 * 2 / 3, // 32,
- I64: math.MaxInt64 * 2 / 3, // 64,
- I64n: math.MinInt64 * 2 / 3, // 64,
-
- Ui64: math.MaxUint64 * 2 / 3, // 64
- Ui32: math.MaxUint32 * 2 / 3, // 32
- Ui16: math.MaxUint16 * 2 / 3, // 16
- Ui8: math.MaxUint8 * 2 / 3, // 8
-
- F32: 3.402823e+38, // max representable float32 without losing precision
- F64: 3.40281991833838838338e+53,
-
- B: true,
- By: 5,
-
- Sslice: []string{strRpt(n, "one"), strRpt(n, "two"), strRpt(n, "three")},
- I64slice: []int64{1111, 2222, 3333},
- I16slice: []int16{44, 55, 66},
- Ui64slice: []uint64{12121212, 34343434, 56565656},
- Ui8slice: []uint8{210, 211, 212},
- Bslice: []bool{true, false, true, false},
- Byslice: []byte{13, 14, 15},
-
- Msi64: map[string]int64{
- strRpt(n, "one"): 1,
- strRpt(n, "two"): 2,
- strRpt(n, "\"three\""): 3,
- },
-
- WrapSliceInt64: []uint64{4, 16, 64, 256},
- WrapSliceString: []string{strRpt(n, "4"), strRpt(n, "16"), strRpt(n, "64"), strRpt(n, "256")},
-
- // R: Raw([]byte("goodbye")),
- // Rext: RawExt{ 120, []byte("hello"), }, // TODO: don't set this - it's hard to test
-
- // DecodeNaked bombs here, because the stringUint64T is decoded as a map,
- // and a map cannot be the key type of a map.
- // Thus, don't initialize this here.
- // Msu2wss: map[stringUint64T]wrapStringSlice{
- // {"5", 5}: []wrapString{"1", "2", "3", "4", "5"},
- // {"3", 3}: []wrapString{"1", "2", "3"},
- // },
-
- // make Simplef same as top-level
- // TODO: should this have slightly different values???
- Simplef: testSimpleFields{
- S: strRpt(n, `some really really cool names that are nigerian and american like "ugorji melody nwoke" - get it? `),
-
- // set the numbers close to the limits
- I8: math.MaxInt8 * 2 / 3, // 8,
- I64: math.MaxInt64 * 2 / 3, // 64,
-
- Ui64: math.MaxUint64 * 2 / 3, // 64
- Ui8: math.MaxUint8 * 2 / 3, // 8
-
- F32: 3.402823e+38, // max representable float32 without losing precision
- F64: 3.40281991833838838338e+53,
-
- B: true,
-
- Sslice: []string{strRpt(n, "one"), strRpt(n, "two"), strRpt(n, "three")},
- I16slice: []int16{44, 55, 66},
- Ui64slice: []uint64{12121212, 34343434, 56565656},
- Ui8slice: []uint8{210, 211, 212},
- Bslice: []bool{true, false, true, false},
-
- Msi64: map[string]int64{
- strRpt(n, "one"): 1,
- strRpt(n, "two"): 2,
- strRpt(n, "\"three\""): 3,
- },
-
- WrapSliceInt64: []uint64{4, 16, 64, 256},
- WrapSliceString: []string{strRpt(n, "4"), strRpt(n, "16"), strRpt(n, "64"), strRpt(n, "256")},
- },
-
- SstrUi64T: []stringUint64T{{"1", 1}, {"2", 2}, {"3", 3}, {"4", 4}},
- AnonInTestStruc: a,
- NotAnon: a,
- }
-
- if bench {
- ts.Ui64 = math.MaxInt64 * 2 / 3
- ts.Simplef.Ui64 = ts.Ui64
- }
-
- //For benchmarks, some things will not work.
- if !bench {
- //json and bson require string keys in maps
- //ts.M = map[interface{}]interface{}{
- // true: "true",
- // int8(9): false,
- //}
- //gob cannot encode nil in element in array (encodeArray: nil element)
- ts.Iptrslice = []*int64{nil, &i64a, nil, &i64b, nil, &i64c, nil, &i64d, nil}
- // ts.Iptrslice = nil
- }
- if !useStringKeyOnly {
- // ts.AnonInTestStruc.AMU32F64 = map[uint32]float64{1: 1, 2: 2, 3: 3} // Json/Bson barf
- }
-}
-
-func newTestStruc(depth, n int, bench, useInterface, useStringKeyOnly bool) (ts *TestStruc) {
- ts = &TestStruc{}
- populateTestStrucCommon(&ts.TestStrucCommon, n, bench, useInterface, useStringKeyOnly)
- if depth > 0 {
- depth--
- if ts.Mtsptr == nil {
- ts.Mtsptr = make(map[string]*TestStruc)
- }
- if ts.Mts == nil {
- ts.Mts = make(map[string]TestStruc)
- }
- ts.Mtsptr[strRpt(n, "0")] = newTestStruc(depth, n, bench, useInterface, useStringKeyOnly)
- ts.Mts[strRpt(n, "0")] = *(ts.Mtsptr[strRpt(n, "0")])
- ts.Its = append(ts.Its, ts.Mtsptr[strRpt(n, "0")])
- }
- return
-}
-
-var testStrRptMap = make(map[int]map[string]string)
-
-func strRpt(n int, s string) string {
- if false {
- // fmt.Printf(">>>> calling strings.Repeat on n: %d, key: %s\n", n, s)
- return strings.Repeat(s, n)
- }
- m1, ok := testStrRptMap[n]
- if !ok {
- // fmt.Printf(">>>> making new map for n: %v\n", n)
- m1 = make(map[string]string)
- testStrRptMap[n] = m1
- }
- v1, ok := m1[s]
- if !ok {
- // fmt.Printf(">>>> creating new entry for key: %s\n", s)
- v1 = strings.Repeat(s, n)
- m1[s] = v1
- }
- return v1
-}
-
-// func wstrRpt(n int, s string) wrapBytes {
-// return wrapBytes(bytes.Repeat([]byte(s), n))
-// }
diff --git a/vendor/github.com/ugorji/go/codec/z_all_test.go b/vendor/github.com/ugorji/go/codec/z_all_test.go
deleted file mode 100644
index cc9c8432e..000000000
--- a/vendor/github.com/ugorji/go/codec/z_all_test.go
+++ /dev/null
@@ -1,488 +0,0 @@
-// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-// +build alltests
-// +build go1.7
-
-package codec
-
-// Run this using:
-// go test -tags=alltests -run=Suite -coverprofile=cov.out
-// go tool cover -html=cov.out
-//
-// Because build tags are a build time parameter, we will have to test out the
-// different tags separately.
-// Tags: x codecgen safe appengine notfastpath
-//
-// These tags should be added to alltests, e.g.
-// go test '-tags=alltests x codecgen' -run=Suite -coverprofile=cov.out
-//
-// To run all tests before submitting code, run:
-// a=( "" "safe" "codecgen" "notfastpath" "codecgen notfastpath" "codecgen safe" "safe notfastpath" )
-// for i in "${a[@]}"; do echo ">>>> TAGS: $i"; go test "-tags=alltests $i" -run=Suite; done
-//
-// This only works on go1.7 and above. This is when subtests and suites were supported.
-
-import "testing"
-
-// func TestMain(m *testing.M) {
-// println("calling TestMain")
-// // set some parameters
-// exitcode := m.Run()
-// os.Exit(exitcode)
-// }
-
-func testGroupResetFlags() {
- testUseMust = false
- testCanonical = false
- testUseMust = false
- testInternStr = false
- testUseIoEncDec = -1
- testStructToArray = false
- testCheckCircRef = false
- testUseReset = false
- testMaxInitLen = 0
- testUseIoWrapper = false
- testNumRepeatString = 8
- testEncodeOptions.RecursiveEmptyCheck = false
- testDecodeOptions.MapValueReset = false
- testUseIoEncDec = -1
- testDepth = 0
-}
-
-func testSuite(t *testing.T, f func(t *testing.T)) {
- // find . -name "*_test.go" | xargs grep -e 'flag.' | cut -d '&' -f 2 | cut -d ',' -f 1 | grep -e '^test'
- // Disregard the following: testInitDebug, testSkipIntf, testJsonIndent (Need a test for it)
-
- testReinit() // so flag.Parse() is called first, and never called again
-
- testDecodeOptions = DecodeOptions{}
- testEncodeOptions = EncodeOptions{}
-
- testGroupResetFlags()
-
- testReinit()
- t.Run("optionsFalse", f)
-
- testCanonical = true
- testUseMust = true
- testInternStr = true
- testUseIoEncDec = 0
- testStructToArray = true
- testCheckCircRef = true
- testUseReset = true
- testDecodeOptions.MapValueReset = true
- testEncodeOptions.RecursiveEmptyCheck = true
- testReinit()
- t.Run("optionsTrue", f)
-
- testDepth = 6
- testReinit()
- t.Run("optionsTrue-deepstruct", f)
- testDepth = 0
-
- // testEncodeOptions.AsSymbols = AsSymbolAll
- testUseIoWrapper = true
- testReinit()
- t.Run("optionsTrue-ioWrapper", f)
-
- testUseIoEncDec = -1
-
- // make buffer small enough so that we have to re-fill multiple times.
- testSkipRPCTests = true
- testUseIoEncDec = 128
- // testDecodeOptions.ReaderBufferSize = 128
- // testEncodeOptions.WriterBufferSize = 128
- testReinit()
- t.Run("optionsTrue-bufio", f)
- // testDecodeOptions.ReaderBufferSize = 0
- // testEncodeOptions.WriterBufferSize = 0
- testUseIoEncDec = -1
- testSkipRPCTests = false
-
- testNumRepeatString = 32
- testReinit()
- t.Run("optionsTrue-largestrings", f)
-
- // The following here MUST be tested individually, as they create
- // side effects i.e. the decoded value is different.
- // testDecodeOptions.MapValueReset = true // ok - no side effects
- // testDecodeOptions.InterfaceReset = true // error??? because we do deepEquals to verify
- // testDecodeOptions.ErrorIfNoField = true // error, as expected, as fields not there
- // testDecodeOptions.ErrorIfNoArrayExpand = true // no error, but no error case either
- // testDecodeOptions.PreferArrayOverSlice = true // error??? because slice != array.
- // .... however, update deepEqual to take this option
- // testReinit()
- // t.Run("optionsTrue-resetOptions", f)
-
- testGroupResetFlags()
-}
-
-/*
-find . -name "codec_test.go" | xargs grep -e '^func Test' | \
- cut -d '(' -f 1 | cut -d ' ' -f 2 | \
- while read f; do echo "t.Run(\"$f\", $f)"; done
-*/
-
-func testCodecGroup(t *testing.T) {
- // println("running testcodecsuite")
- // <setup code>
-
- t.Run("TestBincCodecsTable", TestBincCodecsTable)
- t.Run("TestBincCodecsMisc", TestBincCodecsMisc)
- t.Run("TestBincCodecsEmbeddedPointer", TestBincCodecsEmbeddedPointer)
- t.Run("TestBincStdEncIntf", TestBincStdEncIntf)
- t.Run("TestBincMammoth", TestBincMammoth)
- t.Run("TestSimpleCodecsTable", TestSimpleCodecsTable)
- t.Run("TestSimpleCodecsMisc", TestSimpleCodecsMisc)
- t.Run("TestSimpleCodecsEmbeddedPointer", TestSimpleCodecsEmbeddedPointer)
- t.Run("TestSimpleStdEncIntf", TestSimpleStdEncIntf)
- t.Run("TestSimpleMammoth", TestSimpleMammoth)
- t.Run("TestMsgpackCodecsTable", TestMsgpackCodecsTable)
- t.Run("TestMsgpackCodecsMisc", TestMsgpackCodecsMisc)
- t.Run("TestMsgpackCodecsEmbeddedPointer", TestMsgpackCodecsEmbeddedPointer)
- t.Run("TestMsgpackStdEncIntf", TestMsgpackStdEncIntf)
- t.Run("TestMsgpackMammoth", TestMsgpackMammoth)
- t.Run("TestCborCodecsTable", TestCborCodecsTable)
- t.Run("TestCborCodecsMisc", TestCborCodecsMisc)
- t.Run("TestCborCodecsEmbeddedPointer", TestCborCodecsEmbeddedPointer)
- t.Run("TestCborMapEncodeForCanonical", TestCborMapEncodeForCanonical)
- t.Run("TestCborCodecChan", TestCborCodecChan)
- t.Run("TestCborStdEncIntf", TestCborStdEncIntf)
- t.Run("TestCborMammoth", TestCborMammoth)
- t.Run("TestJsonCodecsTable", TestJsonCodecsTable)
- t.Run("TestJsonCodecsMisc", TestJsonCodecsMisc)
- t.Run("TestJsonCodecsEmbeddedPointer", TestJsonCodecsEmbeddedPointer)
- t.Run("TestJsonCodecChan", TestJsonCodecChan)
- t.Run("TestJsonStdEncIntf", TestJsonStdEncIntf)
- t.Run("TestJsonMammoth", TestJsonMammoth)
- t.Run("TestJsonRaw", TestJsonRaw)
- t.Run("TestBincRaw", TestBincRaw)
- t.Run("TestMsgpackRaw", TestMsgpackRaw)
- t.Run("TestSimpleRaw", TestSimpleRaw)
- t.Run("TestCborRaw", TestCborRaw)
- t.Run("TestAllEncCircularRef", TestAllEncCircularRef)
- t.Run("TestAllAnonCycle", TestAllAnonCycle)
- t.Run("TestBincRpcGo", TestBincRpcGo)
- t.Run("TestSimpleRpcGo", TestSimpleRpcGo)
- t.Run("TestMsgpackRpcGo", TestMsgpackRpcGo)
- t.Run("TestCborRpcGo", TestCborRpcGo)
- t.Run("TestJsonRpcGo", TestJsonRpcGo)
- t.Run("TestMsgpackRpcSpec", TestMsgpackRpcSpec)
- t.Run("TestBincUnderlyingType", TestBincUnderlyingType)
- t.Run("TestJsonLargeInteger", TestJsonLargeInteger)
- t.Run("TestJsonDecodeNonStringScalarInStringContext", TestJsonDecodeNonStringScalarInStringContext)
- t.Run("TestJsonEncodeIndent", TestJsonEncodeIndent)
-
- t.Run("TestJsonSwallowAndZero", TestJsonSwallowAndZero)
- t.Run("TestCborSwallowAndZero", TestCborSwallowAndZero)
- t.Run("TestMsgpackSwallowAndZero", TestMsgpackSwallowAndZero)
- t.Run("TestBincSwallowAndZero", TestBincSwallowAndZero)
- t.Run("TestSimpleSwallowAndZero", TestSimpleSwallowAndZero)
- t.Run("TestJsonRawExt", TestJsonRawExt)
- t.Run("TestCborRawExt", TestCborRawExt)
- t.Run("TestMsgpackRawExt", TestMsgpackRawExt)
- t.Run("TestBincRawExt", TestBincRawExt)
- t.Run("TestSimpleRawExt", TestSimpleRawExt)
- t.Run("TestJsonMapStructKey", TestJsonMapStructKey)
- t.Run("TestCborMapStructKey", TestCborMapStructKey)
- t.Run("TestMsgpackMapStructKey", TestMsgpackMapStructKey)
- t.Run("TestBincMapStructKey", TestBincMapStructKey)
- t.Run("TestSimpleMapStructKey", TestSimpleMapStructKey)
- t.Run("TestJsonDecodeNilMapValue", TestJsonDecodeNilMapValue)
- t.Run("TestCborDecodeNilMapValue", TestCborDecodeNilMapValue)
- t.Run("TestMsgpackDecodeNilMapValue", TestMsgpackDecodeNilMapValue)
- t.Run("TestBincDecodeNilMapValue", TestBincDecodeNilMapValue)
- t.Run("TestSimpleDecodeNilMapValue", TestSimpleDecodeNilMapValue)
- t.Run("TestJsonEmbeddedFieldPrecedence", TestJsonEmbeddedFieldPrecedence)
- t.Run("TestCborEmbeddedFieldPrecedence", TestCborEmbeddedFieldPrecedence)
- t.Run("TestMsgpackEmbeddedFieldPrecedence", TestMsgpackEmbeddedFieldPrecedence)
- t.Run("TestBincEmbeddedFieldPrecedence", TestBincEmbeddedFieldPrecedence)
- t.Run("TestSimpleEmbeddedFieldPrecedence", TestSimpleEmbeddedFieldPrecedence)
- t.Run("TestJsonLargeContainerLen", TestJsonLargeContainerLen)
- t.Run("TestCborLargeContainerLen", TestCborLargeContainerLen)
- t.Run("TestMsgpackLargeContainerLen", TestMsgpackLargeContainerLen)
- t.Run("TestBincLargeContainerLen", TestBincLargeContainerLen)
- t.Run("TestSimpleLargeContainerLen", TestSimpleLargeContainerLen)
- t.Run("TestJsonMammothMapsAndSlices", TestJsonMammothMapsAndSlices)
- t.Run("TestCborMammothMapsAndSlices", TestCborMammothMapsAndSlices)
- t.Run("TestMsgpackMammothMapsAndSlices", TestMsgpackMammothMapsAndSlices)
- t.Run("TestBincMammothMapsAndSlices", TestBincMammothMapsAndSlices)
- t.Run("TestSimpleMammothMapsAndSlices", TestSimpleMammothMapsAndSlices)
- t.Run("TestJsonTime", TestJsonTime)
- t.Run("TestCborTime", TestCborTime)
- t.Run("TestMsgpackTime", TestMsgpackTime)
- t.Run("TestBincTime", TestBincTime)
- t.Run("TestSimpleTime", TestSimpleTime)
- t.Run("TestJsonUintToInt", TestJsonUintToInt)
- t.Run("TestCborUintToInt", TestCborUintToInt)
- t.Run("TestMsgpackUintToInt", TestMsgpackUintToInt)
- t.Run("TestBincUintToInt", TestBincUintToInt)
- t.Run("TestSimpleUintToInt", TestSimpleUintToInt)
- t.Run("TestJsonDifferentMapOrSliceType", TestJsonDifferentMapOrSliceType)
- t.Run("TestCborDifferentMapOrSliceType", TestCborDifferentMapOrSliceType)
- t.Run("TestMsgpackDifferentMapOrSliceType", TestMsgpackDifferentMapOrSliceType)
- t.Run("TestBincDifferentMapOrSliceType", TestBincDifferentMapOrSliceType)
- t.Run("TestSimpleDifferentMapOrSliceType", TestSimpleDifferentMapOrSliceType)
- t.Run("TestJsonScalars", TestJsonScalars)
- t.Run("TestCborScalars", TestCborScalars)
- t.Run("TestMsgpackScalars", TestMsgpackScalars)
- t.Run("TestBincScalars", TestBincScalars)
- t.Run("TestSimpleScalars", TestSimpleScalars)
- t.Run("TestJsonOmitempty", TestJsonOmitempty)
- t.Run("TestCborOmitempty", TestCborOmitempty)
- t.Run("TestMsgpackOmitempty", TestMsgpackOmitempty)
- t.Run("TestBincOmitempty", TestBincOmitempty)
- t.Run("TestSimpleOmitempty", TestSimpleOmitempty)
- t.Run("TestJsonIntfMapping", TestJsonIntfMapping)
- t.Run("TestCborIntfMapping", TestCborIntfMapping)
- t.Run("TestMsgpackIntfMapping", TestMsgpackIntfMapping)
- t.Run("TestBincIntfMapping", TestBincIntfMapping)
- t.Run("TestSimpleIntfMapping", TestSimpleIntfMapping)
-
- t.Run("TestJsonInvalidUnicode", TestJsonInvalidUnicode)
- t.Run("TestCborHalfFloat", TestCborHalfFloat)
- // <tear-down code>
-}
-
-func testJsonGroup(t *testing.T) {
- t.Run("TestJsonCodecsTable", TestJsonCodecsTable)
- t.Run("TestJsonCodecsMisc", TestJsonCodecsMisc)
- t.Run("TestJsonCodecsEmbeddedPointer", TestJsonCodecsEmbeddedPointer)
- t.Run("TestJsonCodecChan", TestJsonCodecChan)
- t.Run("TestJsonStdEncIntf", TestJsonStdEncIntf)
- t.Run("TestJsonMammoth", TestJsonMammoth)
- t.Run("TestJsonRaw", TestJsonRaw)
- t.Run("TestJsonRpcGo", TestJsonRpcGo)
- t.Run("TestJsonLargeInteger", TestJsonLargeInteger)
- t.Run("TestJsonDecodeNonStringScalarInStringContext", TestJsonDecodeNonStringScalarInStringContext)
- t.Run("TestJsonEncodeIndent", TestJsonEncodeIndent)
-
- t.Run("TestJsonSwallowAndZero", TestJsonSwallowAndZero)
- t.Run("TestJsonRawExt", TestJsonRawExt)
- t.Run("TestJsonMapStructKey", TestJsonMapStructKey)
- t.Run("TestJsonDecodeNilMapValue", TestJsonDecodeNilMapValue)
- t.Run("TestJsonEmbeddedFieldPrecedence", TestJsonEmbeddedFieldPrecedence)
- t.Run("TestJsonLargeContainerLen", TestJsonLargeContainerLen)
- t.Run("TestJsonMammothMapsAndSlices", TestJsonMammothMapsAndSlices)
- t.Run("TestJsonInvalidUnicode", TestJsonInvalidUnicode)
- t.Run("TestJsonTime", TestJsonTime)
- t.Run("TestJsonUintToInt", TestJsonUintToInt)
- t.Run("TestJsonDifferentMapOrSliceType", TestJsonDifferentMapOrSliceType)
- t.Run("TestJsonScalars", TestJsonScalars)
- t.Run("TestJsonOmitempty", TestJsonOmitempty)
- t.Run("TestJsonIntfMapping", TestJsonIntfMapping)
-}
-
-func testBincGroup(t *testing.T) {
- t.Run("TestBincCodecsTable", TestBincCodecsTable)
- t.Run("TestBincCodecsMisc", TestBincCodecsMisc)
- t.Run("TestBincCodecsEmbeddedPointer", TestBincCodecsEmbeddedPointer)
- t.Run("TestBincStdEncIntf", TestBincStdEncIntf)
- t.Run("TestBincMammoth", TestBincMammoth)
- t.Run("TestBincRaw", TestBincRaw)
- t.Run("TestSimpleRpcGo", TestSimpleRpcGo)
- t.Run("TestBincUnderlyingType", TestBincUnderlyingType)
-
- t.Run("TestBincSwallowAndZero", TestBincSwallowAndZero)
- t.Run("TestBincRawExt", TestBincRawExt)
- t.Run("TestBincMapStructKey", TestBincMapStructKey)
- t.Run("TestBincDecodeNilMapValue", TestBincDecodeNilMapValue)
- t.Run("TestBincEmbeddedFieldPrecedence", TestBincEmbeddedFieldPrecedence)
- t.Run("TestBincLargeContainerLen", TestBincLargeContainerLen)
- t.Run("TestBincMammothMapsAndSlices", TestBincMammothMapsAndSlices)
- t.Run("TestBincTime", TestBincTime)
- t.Run("TestBincUintToInt", TestBincUintToInt)
- t.Run("TestBincDifferentMapOrSliceType", TestBincDifferentMapOrSliceType)
- t.Run("TestBincScalars", TestBincScalars)
- t.Run("TestBincOmitempty", TestBincOmitempty)
- t.Run("TestBincIntfMapping", TestBincIntfMapping)
-}
-
-func testCborGroup(t *testing.T) {
- t.Run("TestCborCodecsTable", TestCborCodecsTable)
- t.Run("TestCborCodecsMisc", TestCborCodecsMisc)
- t.Run("TestCborCodecsEmbeddedPointer", TestCborCodecsEmbeddedPointer)
- t.Run("TestCborMapEncodeForCanonical", TestCborMapEncodeForCanonical)
- t.Run("TestCborCodecChan", TestCborCodecChan)
- t.Run("TestCborStdEncIntf", TestCborStdEncIntf)
- t.Run("TestCborMammoth", TestCborMammoth)
- t.Run("TestCborRaw", TestCborRaw)
- t.Run("TestCborRpcGo", TestCborRpcGo)
-
- t.Run("TestCborSwallowAndZero", TestCborSwallowAndZero)
- t.Run("TestCborRawExt", TestCborRawExt)
- t.Run("TestCborMapStructKey", TestCborMapStructKey)
- t.Run("TestCborDecodeNilMapValue", TestCborDecodeNilMapValue)
- t.Run("TestCborEmbeddedFieldPrecedence", TestCborEmbeddedFieldPrecedence)
- t.Run("TestCborLargeContainerLen", TestCborLargeContainerLen)
- t.Run("TestCborMammothMapsAndSlices", TestCborMammothMapsAndSlices)
- t.Run("TestCborTime", TestCborTime)
- t.Run("TestCborUintToInt", TestCborUintToInt)
- t.Run("TestCborDifferentMapOrSliceType", TestCborDifferentMapOrSliceType)
- t.Run("TestCborScalars", TestCborScalars)
- t.Run("TestCborOmitempty", TestCborOmitempty)
- t.Run("TestCborIntfMapping", TestCborIntfMapping)
- t.Run("TestCborHalfFloat", TestCborHalfFloat)
-}
-
-func testMsgpackGroup(t *testing.T) {
- t.Run("TestMsgpackCodecsTable", TestMsgpackCodecsTable)
- t.Run("TestMsgpackCodecsMisc", TestMsgpackCodecsMisc)
- t.Run("TestMsgpackCodecsEmbeddedPointer", TestMsgpackCodecsEmbeddedPointer)
- t.Run("TestMsgpackStdEncIntf", TestMsgpackStdEncIntf)
- t.Run("TestMsgpackMammoth", TestMsgpackMammoth)
- t.Run("TestMsgpackRaw", TestMsgpackRaw)
- t.Run("TestMsgpackRpcGo", TestMsgpackRpcGo)
- t.Run("TestMsgpackRpcSpec", TestMsgpackRpcSpec)
- t.Run("TestMsgpackSwallowAndZero", TestMsgpackSwallowAndZero)
- t.Run("TestMsgpackRawExt", TestMsgpackRawExt)
- t.Run("TestMsgpackMapStructKey", TestMsgpackMapStructKey)
- t.Run("TestMsgpackDecodeNilMapValue", TestMsgpackDecodeNilMapValue)
- t.Run("TestMsgpackEmbeddedFieldPrecedence", TestMsgpackEmbeddedFieldPrecedence)
- t.Run("TestMsgpackLargeContainerLen", TestMsgpackLargeContainerLen)
- t.Run("TestMsgpackMammothMapsAndSlices", TestMsgpackMammothMapsAndSlices)
- t.Run("TestMsgpackTime", TestMsgpackTime)
- t.Run("TestMsgpackUintToInt", TestMsgpackUintToInt)
- t.Run("TestMsgpackDifferentMapOrSliceType", TestMsgpackDifferentMapOrSliceType)
- t.Run("TestMsgpackScalars", TestMsgpackScalars)
- t.Run("TestMsgpackOmitempty", TestMsgpackOmitempty)
- t.Run("TestMsgpackIntfMapping", TestMsgpackIntfMapping)
-}
-
-func testSimpleGroup(t *testing.T) {
- t.Run("TestSimpleCodecsTable", TestSimpleCodecsTable)
- t.Run("TestSimpleCodecsMisc", TestSimpleCodecsMisc)
- t.Run("TestSimpleCodecsEmbeddedPointer", TestSimpleCodecsEmbeddedPointer)
- t.Run("TestSimpleStdEncIntf", TestSimpleStdEncIntf)
- t.Run("TestSimpleMammoth", TestSimpleMammoth)
- t.Run("TestSimpleRaw", TestSimpleRaw)
- t.Run("TestSimpleRpcGo", TestSimpleRpcGo)
- t.Run("TestSimpleSwallowAndZero", TestSimpleSwallowAndZero)
- t.Run("TestSimpleRawExt", TestSimpleRawExt)
- t.Run("TestSimpleMapStructKey", TestSimpleMapStructKey)
- t.Run("TestSimpleDecodeNilMapValue", TestSimpleDecodeNilMapValue)
- t.Run("TestSimpleEmbeddedFieldPrecedence", TestSimpleEmbeddedFieldPrecedence)
- t.Run("TestSimpleLargeContainerLen", TestSimpleLargeContainerLen)
- t.Run("TestSimpleMammothMapsAndSlices", TestSimpleMammothMapsAndSlices)
- t.Run("TestSimpleTime", TestSimpleTime)
- t.Run("TestSimpleUintToInt", TestSimpleUintToInt)
- t.Run("TestSimpleDifferentMapOrSliceType", TestSimpleDifferentMapOrSliceType)
- t.Run("TestSimpleScalars", TestSimpleScalars)
- t.Run("TestSimpleOmitempty", TestSimpleOmitempty)
- t.Run("TestSimpleIntfMapping", TestSimpleIntfMapping)
-}
-
-func testSimpleMammothGroup(t *testing.T) {
- t.Run("TestSimpleMammothMapsAndSlices", TestSimpleMammothMapsAndSlices)
-}
-
-func testRpcGroup(t *testing.T) {
- t.Run("TestBincRpcGo", TestBincRpcGo)
- t.Run("TestSimpleRpcGo", TestSimpleRpcGo)
- t.Run("TestMsgpackRpcGo", TestMsgpackRpcGo)
- t.Run("TestCborRpcGo", TestCborRpcGo)
- t.Run("TestJsonRpcGo", TestJsonRpcGo)
- t.Run("TestMsgpackRpcSpec", TestMsgpackRpcSpec)
-}
-
-func TestCodecSuite(t *testing.T) {
- testSuite(t, testCodecGroup)
-
- testGroupResetFlags()
-
- oldIndent, oldCharsAsis, oldPreferFloat, oldMapKeyAsString :=
- testJsonH.Indent, testJsonH.HTMLCharsAsIs, testJsonH.PreferFloat, testJsonH.MapKeyAsString
-
- testMaxInitLen = 10
- testJsonH.Indent = 8
- testJsonH.HTMLCharsAsIs = true
- testJsonH.MapKeyAsString = true
- // testJsonH.PreferFloat = true
- testReinit()
- t.Run("json-spaces-htmlcharsasis-initLen10", testJsonGroup)
-
- testMaxInitLen = 10
- testJsonH.Indent = -1
- testJsonH.HTMLCharsAsIs = false
- testJsonH.MapKeyAsString = true
- // testJsonH.PreferFloat = false
- testReinit()
- t.Run("json-tabs-initLen10", testJsonGroup)
-
- testJsonH.Indent, testJsonH.HTMLCharsAsIs, testJsonH.PreferFloat, testJsonH.MapKeyAsString =
- oldIndent, oldCharsAsis, oldPreferFloat, oldMapKeyAsString
-
- oldIndefLen := testCborH.IndefiniteLength
-
- testCborH.IndefiniteLength = true
- testReinit()
- t.Run("cbor-indefinitelength", testCborGroup)
-
- testCborH.IndefiniteLength = oldIndefLen
-
- oldTimeRFC3339 := testCborH.TimeRFC3339
- testCborH.TimeRFC3339 = !testCborH.TimeRFC3339
- testReinit()
- t.Run("cbor-rfc3339", testCborGroup)
- testCborH.TimeRFC3339 = oldTimeRFC3339
-
- oldSymbols := testBincH.AsSymbols
-
- testBincH.AsSymbols = 2 // AsSymbolNone
- testReinit()
- t.Run("binc-no-symbols", testBincGroup)
-
- testBincH.AsSymbols = 1 // AsSymbolAll
- testReinit()
- t.Run("binc-all-symbols", testBincGroup)
-
- testBincH.AsSymbols = oldSymbols
-
- oldWriteExt := testMsgpackH.WriteExt
- oldNoFixedNum := testMsgpackH.NoFixedNum
-
- testMsgpackH.WriteExt = !testMsgpackH.WriteExt
- testReinit()
- t.Run("msgpack-inverse-writeext", testMsgpackGroup)
-
- testMsgpackH.WriteExt = oldWriteExt
-
- testMsgpackH.NoFixedNum = !testMsgpackH.NoFixedNum
- testReinit()
- t.Run("msgpack-fixednum", testMsgpackGroup)
-
- testMsgpackH.NoFixedNum = oldNoFixedNum
-
- oldEncZeroValuesAsNil := testSimpleH.EncZeroValuesAsNil
- testSimpleH.EncZeroValuesAsNil = !testSimpleH.EncZeroValuesAsNil
- testUseMust = true
- testReinit()
- t.Run("simple-enczeroasnil", testSimpleMammothGroup) // testSimpleGroup
- testSimpleH.EncZeroValuesAsNil = oldEncZeroValuesAsNil
-
- oldRpcBufsize := testRpcBufsize
- testRpcBufsize = 0
- t.Run("rpc-buf-0", testRpcGroup)
- testRpcBufsize = 0
- t.Run("rpc-buf-00", testRpcGroup)
- testRpcBufsize = 0
- t.Run("rpc-buf-000", testRpcGroup)
- testRpcBufsize = 16
- t.Run("rpc-buf-16", testRpcGroup)
- testRpcBufsize = 2048
- t.Run("rpc-buf-2048", testRpcGroup)
- testRpcBufsize = oldRpcBufsize
-
- testGroupResetFlags()
-}
-
-// func TestCodecSuite(t *testing.T) {
-// testReinit() // so flag.Parse() is called first, and never called again
-// testDecodeOptions, testEncodeOptions = DecodeOptions{}, EncodeOptions{}
-// testGroupResetFlags()
-// testReinit()
-// t.Run("optionsFalse", func(t *testing.T) {
-// t.Run("TestJsonMammothMapsAndSlices", TestJsonMammothMapsAndSlices)
-// })
-// }
diff --git a/vendor/golang.org/x/crypto/ssh/benchmark_test.go b/vendor/golang.org/x/crypto/ssh/benchmark_test.go
deleted file mode 100644
index 20c330773..000000000
--- a/vendor/golang.org/x/crypto/ssh/benchmark_test.go
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "errors"
- "io"
- "net"
- "testing"
-)
-
-type server struct {
- *ServerConn
- chans <-chan NewChannel
-}
-
-func newServer(c net.Conn, conf *ServerConfig) (*server, error) {
- sconn, chans, reqs, err := NewServerConn(c, conf)
- if err != nil {
- return nil, err
- }
- go DiscardRequests(reqs)
- return &server{sconn, chans}, nil
-}
-
-func (s *server) Accept() (NewChannel, error) {
- n, ok := <-s.chans
- if !ok {
- return nil, io.EOF
- }
- return n, nil
-}
-
-func sshPipe() (Conn, *server, error) {
- c1, c2, err := netPipe()
- if err != nil {
- return nil, nil, err
- }
-
- clientConf := ClientConfig{
- User: "user",
- HostKeyCallback: InsecureIgnoreHostKey(),
- }
- serverConf := ServerConfig{
- NoClientAuth: true,
- }
- serverConf.AddHostKey(testSigners["ecdsa"])
- done := make(chan *server, 1)
- go func() {
- server, err := newServer(c2, &serverConf)
- if err != nil {
- done <- nil
- }
- done <- server
- }()
-
- client, _, reqs, err := NewClientConn(c1, "", &clientConf)
- if err != nil {
- return nil, nil, err
- }
-
- server := <-done
- if server == nil {
- return nil, nil, errors.New("server handshake failed.")
- }
- go DiscardRequests(reqs)
-
- return client, server, nil
-}
-
-func BenchmarkEndToEnd(b *testing.B) {
- b.StopTimer()
-
- client, server, err := sshPipe()
- if err != nil {
- b.Fatalf("sshPipe: %v", err)
- }
-
- defer client.Close()
- defer server.Close()
-
- size := (1 << 20)
- input := make([]byte, size)
- output := make([]byte, size)
- b.SetBytes(int64(size))
- done := make(chan int, 1)
-
- go func() {
- newCh, err := server.Accept()
- if err != nil {
- b.Fatalf("Client: %v", err)
- }
- ch, incoming, err := newCh.Accept()
- go DiscardRequests(incoming)
- for i := 0; i < b.N; i++ {
- if _, err := io.ReadFull(ch, output); err != nil {
- b.Fatalf("ReadFull: %v", err)
- }
- }
- ch.Close()
- done <- 1
- }()
-
- ch, in, err := client.OpenChannel("speed", nil)
- if err != nil {
- b.Fatalf("OpenChannel: %v", err)
- }
- go DiscardRequests(in)
-
- b.ResetTimer()
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- if _, err := ch.Write(input); err != nil {
- b.Fatalf("WriteFull: %v", err)
- }
- }
- ch.Close()
- b.StopTimer()
-
- <-done
-}
diff --git a/vendor/golang.org/x/crypto/ssh/buffer_test.go b/vendor/golang.org/x/crypto/ssh/buffer_test.go
deleted file mode 100644
index d5781cb3d..000000000
--- a/vendor/golang.org/x/crypto/ssh/buffer_test.go
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "io"
- "testing"
-)
-
-var alphabet = []byte("abcdefghijklmnopqrstuvwxyz")
-
-func TestBufferReadwrite(t *testing.T) {
- b := newBuffer()
- b.write(alphabet[:10])
- r, _ := b.Read(make([]byte, 10))
- if r != 10 {
- t.Fatalf("Expected written == read == 10, written: 10, read %d", r)
- }
-
- b = newBuffer()
- b.write(alphabet[:5])
- r, _ = b.Read(make([]byte, 10))
- if r != 5 {
- t.Fatalf("Expected written == read == 5, written: 5, read %d", r)
- }
-
- b = newBuffer()
- b.write(alphabet[:10])
- r, _ = b.Read(make([]byte, 5))
- if r != 5 {
- t.Fatalf("Expected written == 10, read == 5, written: 10, read %d", r)
- }
-
- b = newBuffer()
- b.write(alphabet[:5])
- b.write(alphabet[5:15])
- r, _ = b.Read(make([]byte, 10))
- r2, _ := b.Read(make([]byte, 10))
- if r != 10 || r2 != 5 || 15 != r+r2 {
- t.Fatal("Expected written == read == 15")
- }
-}
-
-func TestBufferClose(t *testing.T) {
- b := newBuffer()
- b.write(alphabet[:10])
- b.eof()
- _, err := b.Read(make([]byte, 5))
- if err != nil {
- t.Fatal("expected read of 5 to not return EOF")
- }
- b = newBuffer()
- b.write(alphabet[:10])
- b.eof()
- r, err := b.Read(make([]byte, 5))
- r2, err2 := b.Read(make([]byte, 10))
- if r != 5 || r2 != 5 || err != nil || err2 != nil {
- t.Fatal("expected reads of 5 and 5")
- }
-
- b = newBuffer()
- b.write(alphabet[:10])
- b.eof()
- r, err = b.Read(make([]byte, 5))
- r2, err2 = b.Read(make([]byte, 10))
- r3, err3 := b.Read(make([]byte, 10))
- if r != 5 || r2 != 5 || r3 != 0 || err != nil || err2 != nil || err3 != io.EOF {
- t.Fatal("expected reads of 5 and 5 and 0, with EOF")
- }
-
- b = newBuffer()
- b.write(make([]byte, 5))
- b.write(make([]byte, 10))
- b.eof()
- r, err = b.Read(make([]byte, 9))
- r2, err2 = b.Read(make([]byte, 3))
- r3, err3 = b.Read(make([]byte, 3))
- r4, err4 := b.Read(make([]byte, 10))
- if err != nil || err2 != nil || err3 != nil || err4 != io.EOF {
- t.Fatalf("Expected EOF on forth read only, err=%v, err2=%v, err3=%v, err4=%v", err, err2, err3, err4)
- }
- if r != 9 || r2 != 3 || r3 != 3 || r4 != 0 {
- t.Fatal("Expected written == read == 15", r, r2, r3, r4)
- }
-}
diff --git a/vendor/golang.org/x/crypto/ssh/certs_test.go b/vendor/golang.org/x/crypto/ssh/certs_test.go
deleted file mode 100644
index c8e7cf585..000000000
--- a/vendor/golang.org/x/crypto/ssh/certs_test.go
+++ /dev/null
@@ -1,335 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "crypto/ecdsa"
- "crypto/elliptic"
- "crypto/rand"
- "net"
- "reflect"
- "testing"
- "time"
-
- "golang.org/x/crypto/ssh/testdata"
-)
-
-// Cert generated by ssh-keygen 6.0p1 Debian-4.
-// % ssh-keygen -s ca-key -I test user-key
-const exampleSSHCert = `ssh-rsa-cert-v01@openssh.com AAAAHHNzaC1yc2EtY2VydC12MDFAb3BlbnNzaC5jb20AAAAgb1srW/W3ZDjYAO45xLYAwzHBDLsJ4Ux6ICFIkTjb1LEAAAADAQABAAAAYQCkoR51poH0wE8w72cqSB8Sszx+vAhzcMdCO0wqHTj7UNENHWEXGrU0E0UQekD7U+yhkhtoyjbPOVIP7hNa6aRk/ezdh/iUnCIt4Jt1v3Z1h1P+hA4QuYFMHNB+rmjPwAcAAAAAAAAAAAAAAAEAAAAEdGVzdAAAAAAAAAAAAAAAAP//////////AAAAAAAAAIIAAAAVcGVybWl0LVgxMS1mb3J3YXJkaW5nAAAAAAAAABdwZXJtaXQtYWdlbnQtZm9yd2FyZGluZwAAAAAAAAAWcGVybWl0LXBvcnQtZm9yd2FyZGluZwAAAAAAAAAKcGVybWl0LXB0eQAAAAAAAAAOcGVybWl0LXVzZXItcmMAAAAAAAAAAAAAAHcAAAAHc3NoLXJzYQAAAAMBAAEAAABhANFS2kaktpSGc+CcmEKPyw9mJC4nZKxHKTgLVZeaGbFZOvJTNzBspQHdy7Q1uKSfktxpgjZnksiu/tFF9ngyY2KFoc+U88ya95IZUycBGCUbBQ8+bhDtw/icdDGQD5WnUwAAAG8AAAAHc3NoLXJzYQAAAGC8Y9Z2LQKhIhxf52773XaWrXdxP0t3GBVo4A10vUWiYoAGepr6rQIoGGXFxT4B9Gp+nEBJjOwKDXPrAevow0T9ca8gZN+0ykbhSrXLE5Ao48rqr3zP4O1/9P7e6gp0gw8=`
-
-func TestParseCert(t *testing.T) {
- authKeyBytes := []byte(exampleSSHCert)
-
- key, _, _, rest, err := ParseAuthorizedKey(authKeyBytes)
- if err != nil {
- t.Fatalf("ParseAuthorizedKey: %v", err)
- }
- if len(rest) > 0 {
- t.Errorf("rest: got %q, want empty", rest)
- }
-
- if _, ok := key.(*Certificate); !ok {
- t.Fatalf("got %v (%T), want *Certificate", key, key)
- }
-
- marshaled := MarshalAuthorizedKey(key)
- // Before comparison, remove the trailing newline that
- // MarshalAuthorizedKey adds.
- marshaled = marshaled[:len(marshaled)-1]
- if !bytes.Equal(authKeyBytes, marshaled) {
- t.Errorf("marshaled certificate does not match original: got %q, want %q", marshaled, authKeyBytes)
- }
-}
-
-// Cert generated by ssh-keygen OpenSSH_6.8p1 OS X 10.10.3
-// % ssh-keygen -s ca -I testcert -O source-address=192.168.1.0/24 -O force-command=/bin/sleep user.pub
-// user.pub key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDACh1rt2DXfV3hk6fszSQcQ/rueMId0kVD9U7nl8cfEnFxqOCrNT92g4laQIGl2mn8lsGZfTLg8ksHq3gkvgO3oo/0wHy4v32JeBOHTsN5AL4gfHNEhWeWb50ev47hnTsRIt9P4dxogeUo/hTu7j9+s9lLpEQXCvq6xocXQt0j8MV9qZBBXFLXVT3cWIkSqOdwt/5ZBg+1GSrc7WfCXVWgTk4a20uPMuJPxU4RQwZW6X3+O8Pqo8C3cW0OzZRFP6gUYUKUsTI5WntlS+LAxgw1mZNsozFGdbiOPRnEryE3SRldh9vjDR3tin1fGpA5P7+CEB/bqaXtG3V+F2OkqaMN
-// Critical Options:
-// force-command /bin/sleep
-// source-address 192.168.1.0/24
-// Extensions:
-// permit-X11-forwarding
-// permit-agent-forwarding
-// permit-port-forwarding
-// permit-pty
-// permit-user-rc
-const exampleSSHCertWithOptions = `ssh-rsa-cert-v01@openssh.com AAAAHHNzaC1yc2EtY2VydC12MDFAb3BlbnNzaC5jb20AAAAgDyysCJY0XrO1n03EeRRoITnTPdjENFmWDs9X58PP3VUAAAADAQABAAABAQDACh1rt2DXfV3hk6fszSQcQ/rueMId0kVD9U7nl8cfEnFxqOCrNT92g4laQIGl2mn8lsGZfTLg8ksHq3gkvgO3oo/0wHy4v32JeBOHTsN5AL4gfHNEhWeWb50ev47hnTsRIt9P4dxogeUo/hTu7j9+s9lLpEQXCvq6xocXQt0j8MV9qZBBXFLXVT3cWIkSqOdwt/5ZBg+1GSrc7WfCXVWgTk4a20uPMuJPxU4RQwZW6X3+O8Pqo8C3cW0OzZRFP6gUYUKUsTI5WntlS+LAxgw1mZNsozFGdbiOPRnEryE3SRldh9vjDR3tin1fGpA5P7+CEB/bqaXtG3V+F2OkqaMNAAAAAAAAAAAAAAABAAAACHRlc3RjZXJ0AAAAAAAAAAAAAAAA//////////8AAABLAAAADWZvcmNlLWNvbW1hbmQAAAAOAAAACi9iaW4vc2xlZXAAAAAOc291cmNlLWFkZHJlc3MAAAASAAAADjE5Mi4xNjguMS4wLzI0AAAAggAAABVwZXJtaXQtWDExLWZvcndhcmRpbmcAAAAAAAAAF3Blcm1pdC1hZ2VudC1mb3J3YXJkaW5nAAAAAAAAABZwZXJtaXQtcG9ydC1mb3J3YXJkaW5nAAAAAAAAAApwZXJtaXQtcHR5AAAAAAAAAA5wZXJtaXQtdXNlci1yYwAAAAAAAAAAAAABFwAAAAdzc2gtcnNhAAAAAwEAAQAAAQEAwU+c5ui5A8+J/CFpjW8wCa52bEODA808WWQDCSuTG/eMXNf59v9Y8Pk0F1E9dGCosSNyVcB/hacUrc6He+i97+HJCyKavBsE6GDxrjRyxYqAlfcOXi/IVmaUGiO8OQ39d4GHrjToInKvExSUeleQyH4Y4/e27T/pILAqPFL3fyrvMLT5qU9QyIt6zIpa7GBP5+urouNavMprV3zsfIqNBbWypinOQAw823a5wN+zwXnhZrgQiHZ/USG09Y6k98y1dTVz8YHlQVR4D3lpTAsKDKJ5hCH9WU4fdf+lU8OyNGaJ/vz0XNqxcToe1l4numLTnaoSuH89pHryjqurB7lJKwAAAQ8AAAAHc3NoLXJzYQAAAQCaHvUIoPL1zWUHIXLvu96/HU1s/i4CAW2IIEuGgxCUCiFj6vyTyYtgxQxcmbfZf6eaITlS6XJZa7Qq4iaFZh75C1DXTX8labXhRSD4E2t//AIP9MC1rtQC5xo6FmbQ+BoKcDskr+mNACcbRSxs3IL3bwCfWDnIw2WbVox9ZdcthJKk4UoCW4ix4QwdHw7zlddlz++fGEEVhmTbll1SUkycGApPFBsAYRTMupUJcYPIeReBI/m8XfkoMk99bV8ZJQTAd7OekHY2/48Ff53jLmyDjP7kNw1F8OaPtkFs6dGJXta4krmaekPy87j+35In5hFj7yoOqvSbmYUkeX70/GGQ`
-
-func TestParseCertWithOptions(t *testing.T) {
- opts := map[string]string{
- "source-address": "192.168.1.0/24",
- "force-command": "/bin/sleep",
- }
- exts := map[string]string{
- "permit-X11-forwarding": "",
- "permit-agent-forwarding": "",
- "permit-port-forwarding": "",
- "permit-pty": "",
- "permit-user-rc": "",
- }
- authKeyBytes := []byte(exampleSSHCertWithOptions)
-
- key, _, _, rest, err := ParseAuthorizedKey(authKeyBytes)
- if err != nil {
- t.Fatalf("ParseAuthorizedKey: %v", err)
- }
- if len(rest) > 0 {
- t.Errorf("rest: got %q, want empty", rest)
- }
- cert, ok := key.(*Certificate)
- if !ok {
- t.Fatalf("got %v (%T), want *Certificate", key, key)
- }
- if !reflect.DeepEqual(cert.CriticalOptions, opts) {
- t.Errorf("unexpected critical options - got %v, want %v", cert.CriticalOptions, opts)
- }
- if !reflect.DeepEqual(cert.Extensions, exts) {
- t.Errorf("unexpected Extensions - got %v, want %v", cert.Extensions, exts)
- }
- marshaled := MarshalAuthorizedKey(key)
- // Before comparison, remove the trailing newline that
- // MarshalAuthorizedKey adds.
- marshaled = marshaled[:len(marshaled)-1]
- if !bytes.Equal(authKeyBytes, marshaled) {
- t.Errorf("marshaled certificate does not match original: got %q, want %q", marshaled, authKeyBytes)
- }
-}
-
-func TestValidateCert(t *testing.T) {
- key, _, _, _, err := ParseAuthorizedKey([]byte(exampleSSHCert))
- if err != nil {
- t.Fatalf("ParseAuthorizedKey: %v", err)
- }
- validCert, ok := key.(*Certificate)
- if !ok {
- t.Fatalf("got %v (%T), want *Certificate", key, key)
- }
- checker := CertChecker{}
- checker.IsUserAuthority = func(k PublicKey) bool {
- return bytes.Equal(k.Marshal(), validCert.SignatureKey.Marshal())
- }
-
- if err := checker.CheckCert("user", validCert); err != nil {
- t.Errorf("Unable to validate certificate: %v", err)
- }
- invalidCert := &Certificate{
- Key: testPublicKeys["rsa"],
- SignatureKey: testPublicKeys["ecdsa"],
- ValidBefore: CertTimeInfinity,
- Signature: &Signature{},
- }
- if err := checker.CheckCert("user", invalidCert); err == nil {
- t.Error("Invalid cert signature passed validation")
- }
-}
-
-func TestValidateCertTime(t *testing.T) {
- cert := Certificate{
- ValidPrincipals: []string{"user"},
- Key: testPublicKeys["rsa"],
- ValidAfter: 50,
- ValidBefore: 100,
- }
-
- cert.SignCert(rand.Reader, testSigners["ecdsa"])
-
- for ts, ok := range map[int64]bool{
- 25: false,
- 50: true,
- 99: true,
- 100: false,
- 125: false,
- } {
- checker := CertChecker{
- Clock: func() time.Time { return time.Unix(ts, 0) },
- }
- checker.IsUserAuthority = func(k PublicKey) bool {
- return bytes.Equal(k.Marshal(),
- testPublicKeys["ecdsa"].Marshal())
- }
-
- if v := checker.CheckCert("user", &cert); (v == nil) != ok {
- t.Errorf("Authenticate(%d): %v", ts, v)
- }
- }
-}
-
-// TODO(hanwen): tests for
-//
-// host keys:
-// * fallbacks
-
-func TestHostKeyCert(t *testing.T) {
- cert := &Certificate{
- ValidPrincipals: []string{"hostname", "hostname.domain", "otherhost"},
- Key: testPublicKeys["rsa"],
- ValidBefore: CertTimeInfinity,
- CertType: HostCert,
- }
- cert.SignCert(rand.Reader, testSigners["ecdsa"])
-
- checker := &CertChecker{
- IsHostAuthority: func(p PublicKey, addr string) bool {
- return addr == "hostname:22" && bytes.Equal(testPublicKeys["ecdsa"].Marshal(), p.Marshal())
- },
- }
-
- certSigner, err := NewCertSigner(cert, testSigners["rsa"])
- if err != nil {
- t.Errorf("NewCertSigner: %v", err)
- }
-
- for _, test := range []struct {
- addr string
- succeed bool
- }{
- {addr: "hostname:22", succeed: true},
- {addr: "otherhost:22", succeed: false}, // The certificate is valid for 'otherhost' as hostname, but we only recognize the authority of the signer for the address 'hostname:22'
- {addr: "lasthost:22", succeed: false},
- } {
- c1, c2, err := netPipe()
- if err != nil {
- t.Fatalf("netPipe: %v", err)
- }
- defer c1.Close()
- defer c2.Close()
-
- errc := make(chan error)
-
- go func() {
- conf := ServerConfig{
- NoClientAuth: true,
- }
- conf.AddHostKey(certSigner)
- _, _, _, err := NewServerConn(c1, &conf)
- errc <- err
- }()
-
- config := &ClientConfig{
- User: "user",
- HostKeyCallback: checker.CheckHostKey,
- }
- _, _, _, err = NewClientConn(c2, test.addr, config)
-
- if (err == nil) != test.succeed {
- t.Fatalf("NewClientConn(%q): %v", test.addr, err)
- }
-
- err = <-errc
- if (err == nil) != test.succeed {
- t.Fatalf("NewServerConn(%q): %v", test.addr, err)
- }
- }
-}
-
-func TestCertTypes(t *testing.T) {
- var testVars = []struct {
- name string
- keys func() Signer
- }{
- {
- name: CertAlgoECDSA256v01,
- keys: func() Signer {
- s, _ := ParsePrivateKey(testdata.PEMBytes["ecdsap256"])
- return s
- },
- },
- {
- name: CertAlgoECDSA384v01,
- keys: func() Signer {
- s, _ := ParsePrivateKey(testdata.PEMBytes["ecdsap384"])
- return s
- },
- },
- {
- name: CertAlgoECDSA521v01,
- keys: func() Signer {
- s, _ := ParsePrivateKey(testdata.PEMBytes["ecdsap521"])
- return s
- },
- },
- {
- name: CertAlgoED25519v01,
- keys: func() Signer {
- s, _ := ParsePrivateKey(testdata.PEMBytes["ed25519"])
- return s
- },
- },
- {
- name: CertAlgoRSAv01,
- keys: func() Signer {
- s, _ := ParsePrivateKey(testdata.PEMBytes["rsa"])
- return s
- },
- },
- {
- name: CertAlgoDSAv01,
- keys: func() Signer {
- s, _ := ParsePrivateKey(testdata.PEMBytes["dsa"])
- return s
- },
- },
- }
-
- k, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
- if err != nil {
- t.Fatalf("error generating host key: %v", err)
- }
-
- signer, err := NewSignerFromKey(k)
- if err != nil {
- t.Fatalf("error generating signer for ssh listener: %v", err)
- }
-
- conf := &ServerConfig{
- PublicKeyCallback: func(c ConnMetadata, k PublicKey) (*Permissions, error) {
- return new(Permissions), nil
- },
- }
- conf.AddHostKey(signer)
-
- for _, m := range testVars {
- t.Run(m.name, func(t *testing.T) {
-
- c1, c2, err := netPipe()
- if err != nil {
- t.Fatalf("netPipe: %v", err)
- }
- defer c1.Close()
- defer c2.Close()
-
- go NewServerConn(c1, conf)
-
- priv := m.keys()
- if err != nil {
- t.Fatalf("error generating ssh pubkey: %v", err)
- }
-
- cert := &Certificate{
- CertType: UserCert,
- Key: priv.PublicKey(),
- }
- cert.SignCert(rand.Reader, priv)
-
- certSigner, err := NewCertSigner(cert, priv)
- if err != nil {
- t.Fatalf("error generating cert signer: %v", err)
- }
-
- config := &ClientConfig{
- User: "user",
- HostKeyCallback: func(h string, r net.Addr, k PublicKey) error { return nil },
- Auth: []AuthMethod{PublicKeys(certSigner)},
- }
-
- _, _, _, err = NewClientConn(c2, "", config)
- if err != nil {
- t.Fatalf("error connecting: %v", err)
- }
- })
- }
-}
diff --git a/vendor/golang.org/x/crypto/ssh/cipher_test.go b/vendor/golang.org/x/crypto/ssh/cipher_test.go
deleted file mode 100644
index a52d6e486..000000000
--- a/vendor/golang.org/x/crypto/ssh/cipher_test.go
+++ /dev/null
@@ -1,131 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "crypto"
- "crypto/rand"
- "testing"
-)
-
-func TestDefaultCiphersExist(t *testing.T) {
- for _, cipherAlgo := range supportedCiphers {
- if _, ok := cipherModes[cipherAlgo]; !ok {
- t.Errorf("supported cipher %q is unknown", cipherAlgo)
- }
- }
- for _, cipherAlgo := range preferredCiphers {
- if _, ok := cipherModes[cipherAlgo]; !ok {
- t.Errorf("preferred cipher %q is unknown", cipherAlgo)
- }
- }
-}
-
-func TestPacketCiphers(t *testing.T) {
- defaultMac := "hmac-sha2-256"
- defaultCipher := "aes128-ctr"
- for cipher := range cipherModes {
- t.Run("cipher="+cipher,
- func(t *testing.T) { testPacketCipher(t, cipher, defaultMac) })
- }
- for mac := range macModes {
- t.Run("mac="+mac,
- func(t *testing.T) { testPacketCipher(t, defaultCipher, mac) })
- }
-}
-
-func testPacketCipher(t *testing.T, cipher, mac string) {
- kr := &kexResult{Hash: crypto.SHA1}
- algs := directionAlgorithms{
- Cipher: cipher,
- MAC: mac,
- Compression: "none",
- }
- client, err := newPacketCipher(clientKeys, algs, kr)
- if err != nil {
- t.Fatalf("newPacketCipher(client, %q, %q): %v", cipher, mac, err)
- }
- server, err := newPacketCipher(clientKeys, algs, kr)
- if err != nil {
- t.Fatalf("newPacketCipher(client, %q, %q): %v", cipher, mac, err)
- }
-
- want := "bla bla"
- input := []byte(want)
- buf := &bytes.Buffer{}
- if err := client.writePacket(0, buf, rand.Reader, input); err != nil {
- t.Fatalf("writePacket(%q, %q): %v", cipher, mac, err)
- }
-
- packet, err := server.readPacket(0, buf)
- if err != nil {
- t.Fatalf("readPacket(%q, %q): %v", cipher, mac, err)
- }
-
- if string(packet) != want {
- t.Errorf("roundtrip(%q, %q): got %q, want %q", cipher, mac, packet, want)
- }
-}
-
-func TestCBCOracleCounterMeasure(t *testing.T) {
- kr := &kexResult{Hash: crypto.SHA1}
- algs := directionAlgorithms{
- Cipher: aes128cbcID,
- MAC: "hmac-sha1",
- Compression: "none",
- }
- client, err := newPacketCipher(clientKeys, algs, kr)
- if err != nil {
- t.Fatalf("newPacketCipher(client): %v", err)
- }
-
- want := "bla bla"
- input := []byte(want)
- buf := &bytes.Buffer{}
- if err := client.writePacket(0, buf, rand.Reader, input); err != nil {
- t.Errorf("writePacket: %v", err)
- }
-
- packetSize := buf.Len()
- buf.Write(make([]byte, 2*maxPacket))
-
- // We corrupt each byte, but this usually will only test the
- // 'packet too large' or 'MAC failure' cases.
- lastRead := -1
- for i := 0; i < packetSize; i++ {
- server, err := newPacketCipher(clientKeys, algs, kr)
- if err != nil {
- t.Fatalf("newPacketCipher(client): %v", err)
- }
-
- fresh := &bytes.Buffer{}
- fresh.Write(buf.Bytes())
- fresh.Bytes()[i] ^= 0x01
-
- before := fresh.Len()
- _, err = server.readPacket(0, fresh)
- if err == nil {
- t.Errorf("corrupt byte %d: readPacket succeeded ", i)
- continue
- }
- if _, ok := err.(cbcError); !ok {
- t.Errorf("corrupt byte %d: got %v (%T), want cbcError", i, err, err)
- continue
- }
-
- after := fresh.Len()
- bytesRead := before - after
- if bytesRead < maxPacket {
- t.Errorf("corrupt byte %d: read %d bytes, want more than %d", i, bytesRead, maxPacket)
- continue
- }
-
- if i > 0 && bytesRead != lastRead {
- t.Errorf("corrupt byte %d: read %d bytes, want %d bytes read", i, bytesRead, lastRead)
- }
- lastRead = bytesRead
- }
-}
diff --git a/vendor/golang.org/x/crypto/ssh/client_auth_test.go b/vendor/golang.org/x/crypto/ssh/client_auth_test.go
deleted file mode 100644
index 5fbb20d85..000000000
--- a/vendor/golang.org/x/crypto/ssh/client_auth_test.go
+++ /dev/null
@@ -1,628 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "crypto/rand"
- "errors"
- "fmt"
- "os"
- "strings"
- "testing"
-)
-
-type keyboardInteractive map[string]string
-
-func (cr keyboardInteractive) Challenge(user string, instruction string, questions []string, echos []bool) ([]string, error) {
- var answers []string
- for _, q := range questions {
- answers = append(answers, cr[q])
- }
- return answers, nil
-}
-
-// reused internally by tests
-var clientPassword = "tiger"
-
-// tryAuth runs a handshake with a given config against an SSH server
-// with config serverConfig
-func tryAuth(t *testing.T, config *ClientConfig) error {
- c1, c2, err := netPipe()
- if err != nil {
- t.Fatalf("netPipe: %v", err)
- }
- defer c1.Close()
- defer c2.Close()
-
- certChecker := CertChecker{
- IsUserAuthority: func(k PublicKey) bool {
- return bytes.Equal(k.Marshal(), testPublicKeys["ecdsa"].Marshal())
- },
- UserKeyFallback: func(conn ConnMetadata, key PublicKey) (*Permissions, error) {
- if conn.User() == "testuser" && bytes.Equal(key.Marshal(), testPublicKeys["rsa"].Marshal()) {
- return nil, nil
- }
-
- return nil, fmt.Errorf("pubkey for %q not acceptable", conn.User())
- },
- IsRevoked: func(c *Certificate) bool {
- return c.Serial == 666
- },
- }
-
- serverConfig := &ServerConfig{
- PasswordCallback: func(conn ConnMetadata, pass []byte) (*Permissions, error) {
- if conn.User() == "testuser" && string(pass) == clientPassword {
- return nil, nil
- }
- return nil, errors.New("password auth failed")
- },
- PublicKeyCallback: certChecker.Authenticate,
- KeyboardInteractiveCallback: func(conn ConnMetadata, challenge KeyboardInteractiveChallenge) (*Permissions, error) {
- ans, err := challenge("user",
- "instruction",
- []string{"question1", "question2"},
- []bool{true, true})
- if err != nil {
- return nil, err
- }
- ok := conn.User() == "testuser" && ans[0] == "answer1" && ans[1] == "answer2"
- if ok {
- challenge("user", "motd", nil, nil)
- return nil, nil
- }
- return nil, errors.New("keyboard-interactive failed")
- },
- }
- serverConfig.AddHostKey(testSigners["rsa"])
-
- go newServer(c1, serverConfig)
- _, _, _, err = NewClientConn(c2, "", config)
- return err
-}
-
-func TestClientAuthPublicKey(t *testing.T) {
- config := &ClientConfig{
- User: "testuser",
- Auth: []AuthMethod{
- PublicKeys(testSigners["rsa"]),
- },
- HostKeyCallback: InsecureIgnoreHostKey(),
- }
- if err := tryAuth(t, config); err != nil {
- t.Fatalf("unable to dial remote side: %s", err)
- }
-}
-
-func TestAuthMethodPassword(t *testing.T) {
- config := &ClientConfig{
- User: "testuser",
- Auth: []AuthMethod{
- Password(clientPassword),
- },
- HostKeyCallback: InsecureIgnoreHostKey(),
- }
-
- if err := tryAuth(t, config); err != nil {
- t.Fatalf("unable to dial remote side: %s", err)
- }
-}
-
-func TestAuthMethodFallback(t *testing.T) {
- var passwordCalled bool
- config := &ClientConfig{
- User: "testuser",
- Auth: []AuthMethod{
- PublicKeys(testSigners["rsa"]),
- PasswordCallback(
- func() (string, error) {
- passwordCalled = true
- return "WRONG", nil
- }),
- },
- HostKeyCallback: InsecureIgnoreHostKey(),
- }
-
- if err := tryAuth(t, config); err != nil {
- t.Fatalf("unable to dial remote side: %s", err)
- }
-
- if passwordCalled {
- t.Errorf("password auth tried before public-key auth.")
- }
-}
-
-func TestAuthMethodWrongPassword(t *testing.T) {
- config := &ClientConfig{
- User: "testuser",
- Auth: []AuthMethod{
- Password("wrong"),
- PublicKeys(testSigners["rsa"]),
- },
- HostKeyCallback: InsecureIgnoreHostKey(),
- }
-
- if err := tryAuth(t, config); err != nil {
- t.Fatalf("unable to dial remote side: %s", err)
- }
-}
-
-func TestAuthMethodKeyboardInteractive(t *testing.T) {
- answers := keyboardInteractive(map[string]string{
- "question1": "answer1",
- "question2": "answer2",
- })
- config := &ClientConfig{
- User: "testuser",
- Auth: []AuthMethod{
- KeyboardInteractive(answers.Challenge),
- },
- HostKeyCallback: InsecureIgnoreHostKey(),
- }
-
- if err := tryAuth(t, config); err != nil {
- t.Fatalf("unable to dial remote side: %s", err)
- }
-}
-
-func TestAuthMethodWrongKeyboardInteractive(t *testing.T) {
- answers := keyboardInteractive(map[string]string{
- "question1": "answer1",
- "question2": "WRONG",
- })
- config := &ClientConfig{
- User: "testuser",
- Auth: []AuthMethod{
- KeyboardInteractive(answers.Challenge),
- },
- }
-
- if err := tryAuth(t, config); err == nil {
- t.Fatalf("wrong answers should not have authenticated with KeyboardInteractive")
- }
-}
-
-// the mock server will only authenticate ssh-rsa keys
-func TestAuthMethodInvalidPublicKey(t *testing.T) {
- config := &ClientConfig{
- User: "testuser",
- Auth: []AuthMethod{
- PublicKeys(testSigners["dsa"]),
- },
- }
-
- if err := tryAuth(t, config); err == nil {
- t.Fatalf("dsa private key should not have authenticated with rsa public key")
- }
-}
-
-// the client should authenticate with the second key
-func TestAuthMethodRSAandDSA(t *testing.T) {
- config := &ClientConfig{
- User: "testuser",
- Auth: []AuthMethod{
- PublicKeys(testSigners["dsa"], testSigners["rsa"]),
- },
- HostKeyCallback: InsecureIgnoreHostKey(),
- }
- if err := tryAuth(t, config); err != nil {
- t.Fatalf("client could not authenticate with rsa key: %v", err)
- }
-}
-
-func TestClientHMAC(t *testing.T) {
- for _, mac := range supportedMACs {
- config := &ClientConfig{
- User: "testuser",
- Auth: []AuthMethod{
- PublicKeys(testSigners["rsa"]),
- },
- Config: Config{
- MACs: []string{mac},
- },
- HostKeyCallback: InsecureIgnoreHostKey(),
- }
- if err := tryAuth(t, config); err != nil {
- t.Fatalf("client could not authenticate with mac algo %s: %v", mac, err)
- }
- }
-}
-
-// issue 4285.
-func TestClientUnsupportedCipher(t *testing.T) {
- config := &ClientConfig{
- User: "testuser",
- Auth: []AuthMethod{
- PublicKeys(),
- },
- Config: Config{
- Ciphers: []string{"aes128-cbc"}, // not currently supported
- },
- }
- if err := tryAuth(t, config); err == nil {
- t.Errorf("expected no ciphers in common")
- }
-}
-
-func TestClientUnsupportedKex(t *testing.T) {
- if os.Getenv("GO_BUILDER_NAME") != "" {
- t.Skip("skipping known-flaky test on the Go build dashboard; see golang.org/issue/15198")
- }
- config := &ClientConfig{
- User: "testuser",
- Auth: []AuthMethod{
- PublicKeys(),
- },
- Config: Config{
- KeyExchanges: []string{"diffie-hellman-group-exchange-sha256"}, // not currently supported
- },
- HostKeyCallback: InsecureIgnoreHostKey(),
- }
- if err := tryAuth(t, config); err == nil || !strings.Contains(err.Error(), "common algorithm") {
- t.Errorf("got %v, expected 'common algorithm'", err)
- }
-}
-
-func TestClientLoginCert(t *testing.T) {
- cert := &Certificate{
- Key: testPublicKeys["rsa"],
- ValidBefore: CertTimeInfinity,
- CertType: UserCert,
- }
- cert.SignCert(rand.Reader, testSigners["ecdsa"])
- certSigner, err := NewCertSigner(cert, testSigners["rsa"])
- if err != nil {
- t.Fatalf("NewCertSigner: %v", err)
- }
-
- clientConfig := &ClientConfig{
- User: "user",
- HostKeyCallback: InsecureIgnoreHostKey(),
- }
- clientConfig.Auth = append(clientConfig.Auth, PublicKeys(certSigner))
-
- // should succeed
- if err := tryAuth(t, clientConfig); err != nil {
- t.Errorf("cert login failed: %v", err)
- }
-
- // corrupted signature
- cert.Signature.Blob[0]++
- if err := tryAuth(t, clientConfig); err == nil {
- t.Errorf("cert login passed with corrupted sig")
- }
-
- // revoked
- cert.Serial = 666
- cert.SignCert(rand.Reader, testSigners["ecdsa"])
- if err := tryAuth(t, clientConfig); err == nil {
- t.Errorf("revoked cert login succeeded")
- }
- cert.Serial = 1
-
- // sign with wrong key
- cert.SignCert(rand.Reader, testSigners["dsa"])
- if err := tryAuth(t, clientConfig); err == nil {
- t.Errorf("cert login passed with non-authoritative key")
- }
-
- // host cert
- cert.CertType = HostCert
- cert.SignCert(rand.Reader, testSigners["ecdsa"])
- if err := tryAuth(t, clientConfig); err == nil {
- t.Errorf("cert login passed with wrong type")
- }
- cert.CertType = UserCert
-
- // principal specified
- cert.ValidPrincipals = []string{"user"}
- cert.SignCert(rand.Reader, testSigners["ecdsa"])
- if err := tryAuth(t, clientConfig); err != nil {
- t.Errorf("cert login failed: %v", err)
- }
-
- // wrong principal specified
- cert.ValidPrincipals = []string{"fred"}
- cert.SignCert(rand.Reader, testSigners["ecdsa"])
- if err := tryAuth(t, clientConfig); err == nil {
- t.Errorf("cert login passed with wrong principal")
- }
- cert.ValidPrincipals = nil
-
- // added critical option
- cert.CriticalOptions = map[string]string{"root-access": "yes"}
- cert.SignCert(rand.Reader, testSigners["ecdsa"])
- if err := tryAuth(t, clientConfig); err == nil {
- t.Errorf("cert login passed with unrecognized critical option")
- }
-
- // allowed source address
- cert.CriticalOptions = map[string]string{"source-address": "127.0.0.42/24,::42/120"}
- cert.SignCert(rand.Reader, testSigners["ecdsa"])
- if err := tryAuth(t, clientConfig); err != nil {
- t.Errorf("cert login with source-address failed: %v", err)
- }
-
- // disallowed source address
- cert.CriticalOptions = map[string]string{"source-address": "127.0.0.42,::42"}
- cert.SignCert(rand.Reader, testSigners["ecdsa"])
- if err := tryAuth(t, clientConfig); err == nil {
- t.Errorf("cert login with source-address succeeded")
- }
-}
-
-func testPermissionsPassing(withPermissions bool, t *testing.T) {
- serverConfig := &ServerConfig{
- PublicKeyCallback: func(conn ConnMetadata, key PublicKey) (*Permissions, error) {
- if conn.User() == "nopermissions" {
- return nil, nil
- }
- return &Permissions{}, nil
- },
- }
- serverConfig.AddHostKey(testSigners["rsa"])
-
- clientConfig := &ClientConfig{
- Auth: []AuthMethod{
- PublicKeys(testSigners["rsa"]),
- },
- HostKeyCallback: InsecureIgnoreHostKey(),
- }
- if withPermissions {
- clientConfig.User = "permissions"
- } else {
- clientConfig.User = "nopermissions"
- }
-
- c1, c2, err := netPipe()
- if err != nil {
- t.Fatalf("netPipe: %v", err)
- }
- defer c1.Close()
- defer c2.Close()
-
- go NewClientConn(c2, "", clientConfig)
- serverConn, err := newServer(c1, serverConfig)
- if err != nil {
- t.Fatal(err)
- }
- if p := serverConn.Permissions; (p != nil) != withPermissions {
- t.Fatalf("withPermissions is %t, but Permissions object is %#v", withPermissions, p)
- }
-}
-
-func TestPermissionsPassing(t *testing.T) {
- testPermissionsPassing(true, t)
-}
-
-func TestNoPermissionsPassing(t *testing.T) {
- testPermissionsPassing(false, t)
-}
-
-func TestRetryableAuth(t *testing.T) {
- n := 0
- passwords := []string{"WRONG1", "WRONG2"}
-
- config := &ClientConfig{
- User: "testuser",
- Auth: []AuthMethod{
- RetryableAuthMethod(PasswordCallback(func() (string, error) {
- p := passwords[n]
- n++
- return p, nil
- }), 2),
- PublicKeys(testSigners["rsa"]),
- },
- HostKeyCallback: InsecureIgnoreHostKey(),
- }
-
- if err := tryAuth(t, config); err != nil {
- t.Fatalf("unable to dial remote side: %s", err)
- }
- if n != 2 {
- t.Fatalf("Did not try all passwords")
- }
-}
-
-func ExampleRetryableAuthMethod(t *testing.T) {
- user := "testuser"
- NumberOfPrompts := 3
-
- // Normally this would be a callback that prompts the user to answer the
- // provided questions
- Cb := func(user, instruction string, questions []string, echos []bool) (answers []string, err error) {
- return []string{"answer1", "answer2"}, nil
- }
-
- config := &ClientConfig{
- HostKeyCallback: InsecureIgnoreHostKey(),
- User: user,
- Auth: []AuthMethod{
- RetryableAuthMethod(KeyboardInteractiveChallenge(Cb), NumberOfPrompts),
- },
- }
-
- if err := tryAuth(t, config); err != nil {
- t.Fatalf("unable to dial remote side: %s", err)
- }
-}
-
-// Test if username is received on server side when NoClientAuth is used
-func TestClientAuthNone(t *testing.T) {
- user := "testuser"
- serverConfig := &ServerConfig{
- NoClientAuth: true,
- }
- serverConfig.AddHostKey(testSigners["rsa"])
-
- clientConfig := &ClientConfig{
- User: user,
- HostKeyCallback: InsecureIgnoreHostKey(),
- }
-
- c1, c2, err := netPipe()
- if err != nil {
- t.Fatalf("netPipe: %v", err)
- }
- defer c1.Close()
- defer c2.Close()
-
- go NewClientConn(c2, "", clientConfig)
- serverConn, err := newServer(c1, serverConfig)
- if err != nil {
- t.Fatalf("newServer: %v", err)
- }
- if serverConn.User() != user {
- t.Fatalf("server: got %q, want %q", serverConn.User(), user)
- }
-}
-
-// Test if authentication attempts are limited on server when MaxAuthTries is set
-func TestClientAuthMaxAuthTries(t *testing.T) {
- user := "testuser"
-
- serverConfig := &ServerConfig{
- MaxAuthTries: 2,
- PasswordCallback: func(conn ConnMetadata, pass []byte) (*Permissions, error) {
- if conn.User() == "testuser" && string(pass) == "right" {
- return nil, nil
- }
- return nil, errors.New("password auth failed")
- },
- }
- serverConfig.AddHostKey(testSigners["rsa"])
-
- expectedErr := fmt.Errorf("ssh: handshake failed: %v", &disconnectMsg{
- Reason: 2,
- Message: "too many authentication failures",
- })
-
- for tries := 2; tries < 4; tries++ {
- n := tries
- clientConfig := &ClientConfig{
- User: user,
- Auth: []AuthMethod{
- RetryableAuthMethod(PasswordCallback(func() (string, error) {
- n--
- if n == 0 {
- return "right", nil
- }
- return "wrong", nil
- }), tries),
- },
- HostKeyCallback: InsecureIgnoreHostKey(),
- }
-
- c1, c2, err := netPipe()
- if err != nil {
- t.Fatalf("netPipe: %v", err)
- }
- defer c1.Close()
- defer c2.Close()
-
- go newServer(c1, serverConfig)
- _, _, _, err = NewClientConn(c2, "", clientConfig)
- if tries > 2 {
- if err == nil {
- t.Fatalf("client: got no error, want %s", expectedErr)
- } else if err.Error() != expectedErr.Error() {
- t.Fatalf("client: got %s, want %s", err, expectedErr)
- }
- } else {
- if err != nil {
- t.Fatalf("client: got %s, want no error", err)
- }
- }
- }
-}
-
-// Test if authentication attempts are correctly limited on server
-// when more public keys are provided then MaxAuthTries
-func TestClientAuthMaxAuthTriesPublicKey(t *testing.T) {
- signers := []Signer{}
- for i := 0; i < 6; i++ {
- signers = append(signers, testSigners["dsa"])
- }
-
- validConfig := &ClientConfig{
- User: "testuser",
- Auth: []AuthMethod{
- PublicKeys(append([]Signer{testSigners["rsa"]}, signers...)...),
- },
- HostKeyCallback: InsecureIgnoreHostKey(),
- }
- if err := tryAuth(t, validConfig); err != nil {
- t.Fatalf("unable to dial remote side: %s", err)
- }
-
- expectedErr := fmt.Errorf("ssh: handshake failed: %v", &disconnectMsg{
- Reason: 2,
- Message: "too many authentication failures",
- })
- invalidConfig := &ClientConfig{
- User: "testuser",
- Auth: []AuthMethod{
- PublicKeys(append(signers, testSigners["rsa"])...),
- },
- HostKeyCallback: InsecureIgnoreHostKey(),
- }
- if err := tryAuth(t, invalidConfig); err == nil {
- t.Fatalf("client: got no error, want %s", expectedErr)
- } else if err.Error() != expectedErr.Error() {
- t.Fatalf("client: got %s, want %s", err, expectedErr)
- }
-}
-
-// Test whether authentication errors are being properly logged if all
-// authentication methods have been exhausted
-func TestClientAuthErrorList(t *testing.T) {
- publicKeyErr := errors.New("This is an error from PublicKeyCallback")
-
- clientConfig := &ClientConfig{
- Auth: []AuthMethod{
- PublicKeys(testSigners["rsa"]),
- },
- HostKeyCallback: InsecureIgnoreHostKey(),
- }
- serverConfig := &ServerConfig{
- PublicKeyCallback: func(_ ConnMetadata, _ PublicKey) (*Permissions, error) {
- return nil, publicKeyErr
- },
- }
- serverConfig.AddHostKey(testSigners["rsa"])
-
- c1, c2, err := netPipe()
- if err != nil {
- t.Fatalf("netPipe: %v", err)
- }
- defer c1.Close()
- defer c2.Close()
-
- go NewClientConn(c2, "", clientConfig)
- _, err = newServer(c1, serverConfig)
- if err == nil {
- t.Fatal("newServer: got nil, expected errors")
- }
-
- authErrs, ok := err.(*ServerAuthError)
- if !ok {
- t.Fatalf("errors: got %T, want *ssh.ServerAuthError", err)
- }
- for i, e := range authErrs.Errors {
- switch i {
- case 0:
- if e != ErrNoAuth {
- t.Fatalf("errors: got error %v, want ErrNoAuth", e)
- }
- case 1:
- if e != publicKeyErr {
- t.Fatalf("errors: got %v, want %v", e, publicKeyErr)
- }
- default:
- t.Fatalf("errors: got %v, expected 2 errors", authErrs.Errors)
- }
- }
-}
diff --git a/vendor/golang.org/x/crypto/ssh/client_test.go b/vendor/golang.org/x/crypto/ssh/client_test.go
deleted file mode 100644
index 81f9599e1..000000000
--- a/vendor/golang.org/x/crypto/ssh/client_test.go
+++ /dev/null
@@ -1,166 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "strings"
- "testing"
-)
-
-func TestClientVersion(t *testing.T) {
- for _, tt := range []struct {
- name string
- version string
- multiLine string
- wantErr bool
- }{
- {
- name: "default version",
- version: packageVersion,
- },
- {
- name: "custom version",
- version: "SSH-2.0-CustomClientVersionString",
- },
- {
- name: "good multi line version",
- version: packageVersion,
- multiLine: strings.Repeat("ignored\r\n", 20),
- },
- {
- name: "bad multi line version",
- version: packageVersion,
- multiLine: "bad multi line version",
- wantErr: true,
- },
- {
- name: "long multi line version",
- version: packageVersion,
- multiLine: strings.Repeat("long multi line version\r\n", 50)[:256],
- wantErr: true,
- },
- } {
- t.Run(tt.name, func(t *testing.T) {
- c1, c2, err := netPipe()
- if err != nil {
- t.Fatalf("netPipe: %v", err)
- }
- defer c1.Close()
- defer c2.Close()
- go func() {
- if tt.multiLine != "" {
- c1.Write([]byte(tt.multiLine))
- }
- NewClientConn(c1, "", &ClientConfig{
- ClientVersion: tt.version,
- HostKeyCallback: InsecureIgnoreHostKey(),
- })
- c1.Close()
- }()
- conf := &ServerConfig{NoClientAuth: true}
- conf.AddHostKey(testSigners["rsa"])
- conn, _, _, err := NewServerConn(c2, conf)
- if err == nil == tt.wantErr {
- t.Fatalf("got err %v; wantErr %t", err, tt.wantErr)
- }
- if tt.wantErr {
- // Don't verify the version on an expected error.
- return
- }
- if got := string(conn.ClientVersion()); got != tt.version {
- t.Fatalf("got %q; want %q", got, tt.version)
- }
- })
- }
-}
-
-func TestHostKeyCheck(t *testing.T) {
- for _, tt := range []struct {
- name string
- wantError string
- key PublicKey
- }{
- {"no callback", "must specify HostKeyCallback", nil},
- {"correct key", "", testSigners["rsa"].PublicKey()},
- {"mismatch", "mismatch", testSigners["ecdsa"].PublicKey()},
- } {
- c1, c2, err := netPipe()
- if err != nil {
- t.Fatalf("netPipe: %v", err)
- }
- defer c1.Close()
- defer c2.Close()
- serverConf := &ServerConfig{
- NoClientAuth: true,
- }
- serverConf.AddHostKey(testSigners["rsa"])
-
- go NewServerConn(c1, serverConf)
- clientConf := ClientConfig{
- User: "user",
- }
- if tt.key != nil {
- clientConf.HostKeyCallback = FixedHostKey(tt.key)
- }
-
- _, _, _, err = NewClientConn(c2, "", &clientConf)
- if err != nil {
- if tt.wantError == "" || !strings.Contains(err.Error(), tt.wantError) {
- t.Errorf("%s: got error %q, missing %q", tt.name, err.Error(), tt.wantError)
- }
- } else if tt.wantError != "" {
- t.Errorf("%s: succeeded, but want error string %q", tt.name, tt.wantError)
- }
- }
-}
-
-func TestBannerCallback(t *testing.T) {
- c1, c2, err := netPipe()
- if err != nil {
- t.Fatalf("netPipe: %v", err)
- }
- defer c1.Close()
- defer c2.Close()
-
- serverConf := &ServerConfig{
- PasswordCallback: func(conn ConnMetadata, password []byte) (*Permissions, error) {
- return &Permissions{}, nil
- },
- BannerCallback: func(conn ConnMetadata) string {
- return "Hello World"
- },
- }
- serverConf.AddHostKey(testSigners["rsa"])
- go NewServerConn(c1, serverConf)
-
- var receivedBanner string
- var bannerCount int
- clientConf := ClientConfig{
- Auth: []AuthMethod{
- Password("123"),
- },
- User: "user",
- HostKeyCallback: InsecureIgnoreHostKey(),
- BannerCallback: func(message string) error {
- bannerCount++
- receivedBanner = message
- return nil
- },
- }
-
- _, _, _, err = NewClientConn(c2, "", &clientConf)
- if err != nil {
- t.Fatal(err)
- }
-
- if bannerCount != 1 {
- t.Errorf("got %d banners; want 1", bannerCount)
- }
-
- expected := "Hello World"
- if receivedBanner != expected {
- t.Fatalf("got %s; want %s", receivedBanner, expected)
- }
-}
diff --git a/vendor/golang.org/x/crypto/ssh/example_test.go b/vendor/golang.org/x/crypto/ssh/example_test.go
deleted file mode 100644
index b910c7bf6..000000000
--- a/vendor/golang.org/x/crypto/ssh/example_test.go
+++ /dev/null
@@ -1,320 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh_test
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io/ioutil"
- "log"
- "net"
- "net/http"
- "os"
- "path/filepath"
- "strings"
-
- "golang.org/x/crypto/ssh"
- "golang.org/x/crypto/ssh/terminal"
-)
-
-func ExampleNewServerConn() {
- // Public key authentication is done by comparing
- // the public key of a received connection
- // with the entries in the authorized_keys file.
- authorizedKeysBytes, err := ioutil.ReadFile("authorized_keys")
- if err != nil {
- log.Fatalf("Failed to load authorized_keys, err: %v", err)
- }
-
- authorizedKeysMap := map[string]bool{}
- for len(authorizedKeysBytes) > 0 {
- pubKey, _, _, rest, err := ssh.ParseAuthorizedKey(authorizedKeysBytes)
- if err != nil {
- log.Fatal(err)
- }
-
- authorizedKeysMap[string(pubKey.Marshal())] = true
- authorizedKeysBytes = rest
- }
-
- // An SSH server is represented by a ServerConfig, which holds
- // certificate details and handles authentication of ServerConns.
- config := &ssh.ServerConfig{
- // Remove to disable password auth.
- PasswordCallback: func(c ssh.ConnMetadata, pass []byte) (*ssh.Permissions, error) {
- // Should use constant-time compare (or better, salt+hash) in
- // a production setting.
- if c.User() == "testuser" && string(pass) == "tiger" {
- return nil, nil
- }
- return nil, fmt.Errorf("password rejected for %q", c.User())
- },
-
- // Remove to disable public key auth.
- PublicKeyCallback: func(c ssh.ConnMetadata, pubKey ssh.PublicKey) (*ssh.Permissions, error) {
- if authorizedKeysMap[string(pubKey.Marshal())] {
- return &ssh.Permissions{
- // Record the public key used for authentication.
- Extensions: map[string]string{
- "pubkey-fp": ssh.FingerprintSHA256(pubKey),
- },
- }, nil
- }
- return nil, fmt.Errorf("unknown public key for %q", c.User())
- },
- }
-
- privateBytes, err := ioutil.ReadFile("id_rsa")
- if err != nil {
- log.Fatal("Failed to load private key: ", err)
- }
-
- private, err := ssh.ParsePrivateKey(privateBytes)
- if err != nil {
- log.Fatal("Failed to parse private key: ", err)
- }
-
- config.AddHostKey(private)
-
- // Once a ServerConfig has been configured, connections can be
- // accepted.
- listener, err := net.Listen("tcp", "0.0.0.0:2022")
- if err != nil {
- log.Fatal("failed to listen for connection: ", err)
- }
- nConn, err := listener.Accept()
- if err != nil {
- log.Fatal("failed to accept incoming connection: ", err)
- }
-
- // Before use, a handshake must be performed on the incoming
- // net.Conn.
- conn, chans, reqs, err := ssh.NewServerConn(nConn, config)
- if err != nil {
- log.Fatal("failed to handshake: ", err)
- }
- log.Printf("logged in with key %s", conn.Permissions.Extensions["pubkey-fp"])
-
- // The incoming Request channel must be serviced.
- go ssh.DiscardRequests(reqs)
-
- // Service the incoming Channel channel.
- for newChannel := range chans {
- // Channels have a type, depending on the application level
- // protocol intended. In the case of a shell, the type is
- // "session" and ServerShell may be used to present a simple
- // terminal interface.
- if newChannel.ChannelType() != "session" {
- newChannel.Reject(ssh.UnknownChannelType, "unknown channel type")
- continue
- }
- channel, requests, err := newChannel.Accept()
- if err != nil {
- log.Fatalf("Could not accept channel: %v", err)
- }
-
- // Sessions have out-of-band requests such as "shell",
- // "pty-req" and "env". Here we handle only the
- // "shell" request.
- go func(in <-chan *ssh.Request) {
- for req := range in {
- req.Reply(req.Type == "shell", nil)
- }
- }(requests)
-
- term := terminal.NewTerminal(channel, "> ")
-
- go func() {
- defer channel.Close()
- for {
- line, err := term.ReadLine()
- if err != nil {
- break
- }
- fmt.Println(line)
- }
- }()
- }
-}
-
-func ExampleHostKeyCheck() {
- // Every client must provide a host key check. Here is a
- // simple-minded parse of OpenSSH's known_hosts file
- host := "hostname"
- file, err := os.Open(filepath.Join(os.Getenv("HOME"), ".ssh", "known_hosts"))
- if err != nil {
- log.Fatal(err)
- }
- defer file.Close()
-
- scanner := bufio.NewScanner(file)
- var hostKey ssh.PublicKey
- for scanner.Scan() {
- fields := strings.Split(scanner.Text(), " ")
- if len(fields) != 3 {
- continue
- }
- if strings.Contains(fields[0], host) {
- var err error
- hostKey, _, _, _, err = ssh.ParseAuthorizedKey(scanner.Bytes())
- if err != nil {
- log.Fatalf("error parsing %q: %v", fields[2], err)
- }
- break
- }
- }
-
- if hostKey == nil {
- log.Fatalf("no hostkey for %s", host)
- }
-
- config := ssh.ClientConfig{
- User: os.Getenv("USER"),
- HostKeyCallback: ssh.FixedHostKey(hostKey),
- }
-
- _, err = ssh.Dial("tcp", host+":22", &config)
- log.Println(err)
-}
-
-func ExampleDial() {
- var hostKey ssh.PublicKey
- // An SSH client is represented with a ClientConn.
- //
- // To authenticate with the remote server you must pass at least one
- // implementation of AuthMethod via the Auth field in ClientConfig,
- // and provide a HostKeyCallback.
- config := &ssh.ClientConfig{
- User: "username",
- Auth: []ssh.AuthMethod{
- ssh.Password("yourpassword"),
- },
- HostKeyCallback: ssh.FixedHostKey(hostKey),
- }
- client, err := ssh.Dial("tcp", "yourserver.com:22", config)
- if err != nil {
- log.Fatal("Failed to dial: ", err)
- }
-
- // Each ClientConn can support multiple interactive sessions,
- // represented by a Session.
- session, err := client.NewSession()
- if err != nil {
- log.Fatal("Failed to create session: ", err)
- }
- defer session.Close()
-
- // Once a Session is created, you can execute a single command on
- // the remote side using the Run method.
- var b bytes.Buffer
- session.Stdout = &b
- if err := session.Run("/usr/bin/whoami"); err != nil {
- log.Fatal("Failed to run: " + err.Error())
- }
- fmt.Println(b.String())
-}
-
-func ExamplePublicKeys() {
- var hostKey ssh.PublicKey
- // A public key may be used to authenticate against the remote
- // server by using an unencrypted PEM-encoded private key file.
- //
- // If you have an encrypted private key, the crypto/x509 package
- // can be used to decrypt it.
- key, err := ioutil.ReadFile("/home/user/.ssh/id_rsa")
- if err != nil {
- log.Fatalf("unable to read private key: %v", err)
- }
-
- // Create the Signer for this private key.
- signer, err := ssh.ParsePrivateKey(key)
- if err != nil {
- log.Fatalf("unable to parse private key: %v", err)
- }
-
- config := &ssh.ClientConfig{
- User: "user",
- Auth: []ssh.AuthMethod{
- // Use the PublicKeys method for remote authentication.
- ssh.PublicKeys(signer),
- },
- HostKeyCallback: ssh.FixedHostKey(hostKey),
- }
-
- // Connect to the remote server and perform the SSH handshake.
- client, err := ssh.Dial("tcp", "host.com:22", config)
- if err != nil {
- log.Fatalf("unable to connect: %v", err)
- }
- defer client.Close()
-}
-
-func ExampleClient_Listen() {
- var hostKey ssh.PublicKey
- config := &ssh.ClientConfig{
- User: "username",
- Auth: []ssh.AuthMethod{
- ssh.Password("password"),
- },
- HostKeyCallback: ssh.FixedHostKey(hostKey),
- }
- // Dial your ssh server.
- conn, err := ssh.Dial("tcp", "localhost:22", config)
- if err != nil {
- log.Fatal("unable to connect: ", err)
- }
- defer conn.Close()
-
- // Request the remote side to open port 8080 on all interfaces.
- l, err := conn.Listen("tcp", "0.0.0.0:8080")
- if err != nil {
- log.Fatal("unable to register tcp forward: ", err)
- }
- defer l.Close()
-
- // Serve HTTP with your SSH server acting as a reverse proxy.
- http.Serve(l, http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {
- fmt.Fprintf(resp, "Hello world!\n")
- }))
-}
-
-func ExampleSession_RequestPty() {
- var hostKey ssh.PublicKey
- // Create client config
- config := &ssh.ClientConfig{
- User: "username",
- Auth: []ssh.AuthMethod{
- ssh.Password("password"),
- },
- HostKeyCallback: ssh.FixedHostKey(hostKey),
- }
- // Connect to ssh server
- conn, err := ssh.Dial("tcp", "localhost:22", config)
- if err != nil {
- log.Fatal("unable to connect: ", err)
- }
- defer conn.Close()
- // Create a session
- session, err := conn.NewSession()
- if err != nil {
- log.Fatal("unable to create session: ", err)
- }
- defer session.Close()
- // Set up terminal modes
- modes := ssh.TerminalModes{
- ssh.ECHO: 0, // disable echoing
- ssh.TTY_OP_ISPEED: 14400, // input speed = 14.4kbaud
- ssh.TTY_OP_OSPEED: 14400, // output speed = 14.4kbaud
- }
- // Request pseudo terminal
- if err := session.RequestPty("xterm", 40, 80, modes); err != nil {
- log.Fatal("request for pseudo terminal failed: ", err)
- }
- // Start remote shell
- if err := session.Shell(); err != nil {
- log.Fatal("failed to start shell: ", err)
- }
-}
diff --git a/vendor/golang.org/x/crypto/ssh/handshake_test.go b/vendor/golang.org/x/crypto/ssh/handshake_test.go
deleted file mode 100644
index 91d493568..000000000
--- a/vendor/golang.org/x/crypto/ssh/handshake_test.go
+++ /dev/null
@@ -1,559 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "crypto/rand"
- "errors"
- "fmt"
- "io"
- "net"
- "reflect"
- "runtime"
- "strings"
- "sync"
- "testing"
-)
-
-type testChecker struct {
- calls []string
-}
-
-func (t *testChecker) Check(dialAddr string, addr net.Addr, key PublicKey) error {
- if dialAddr == "bad" {
- return fmt.Errorf("dialAddr is bad")
- }
-
- if tcpAddr, ok := addr.(*net.TCPAddr); !ok || tcpAddr == nil {
- return fmt.Errorf("testChecker: got %T want *net.TCPAddr", addr)
- }
-
- t.calls = append(t.calls, fmt.Sprintf("%s %v %s %x", dialAddr, addr, key.Type(), key.Marshal()))
-
- return nil
-}
-
-// netPipe is analogous to net.Pipe, but it uses a real net.Conn, and
-// therefore is buffered (net.Pipe deadlocks if both sides start with
-// a write.)
-func netPipe() (net.Conn, net.Conn, error) {
- listener, err := net.Listen("tcp", "127.0.0.1:0")
- if err != nil {
- listener, err = net.Listen("tcp", "[::1]:0")
- if err != nil {
- return nil, nil, err
- }
- }
- defer listener.Close()
- c1, err := net.Dial("tcp", listener.Addr().String())
- if err != nil {
- return nil, nil, err
- }
-
- c2, err := listener.Accept()
- if err != nil {
- c1.Close()
- return nil, nil, err
- }
-
- return c1, c2, nil
-}
-
-// noiseTransport inserts ignore messages to check that the read loop
-// and the key exchange filters out these messages.
-type noiseTransport struct {
- keyingTransport
-}
-
-func (t *noiseTransport) writePacket(p []byte) error {
- ignore := []byte{msgIgnore}
- if err := t.keyingTransport.writePacket(ignore); err != nil {
- return err
- }
- debug := []byte{msgDebug, 1, 2, 3}
- if err := t.keyingTransport.writePacket(debug); err != nil {
- return err
- }
-
- return t.keyingTransport.writePacket(p)
-}
-
-func addNoiseTransport(t keyingTransport) keyingTransport {
- return &noiseTransport{t}
-}
-
-// handshakePair creates two handshakeTransports connected with each
-// other. If the noise argument is true, both transports will try to
-// confuse the other side by sending ignore and debug messages.
-func handshakePair(clientConf *ClientConfig, addr string, noise bool) (client *handshakeTransport, server *handshakeTransport, err error) {
- a, b, err := netPipe()
- if err != nil {
- return nil, nil, err
- }
-
- var trC, trS keyingTransport
-
- trC = newTransport(a, rand.Reader, true)
- trS = newTransport(b, rand.Reader, false)
- if noise {
- trC = addNoiseTransport(trC)
- trS = addNoiseTransport(trS)
- }
- clientConf.SetDefaults()
-
- v := []byte("version")
- client = newClientTransport(trC, v, v, clientConf, addr, a.RemoteAddr())
-
- serverConf := &ServerConfig{}
- serverConf.AddHostKey(testSigners["ecdsa"])
- serverConf.AddHostKey(testSigners["rsa"])
- serverConf.SetDefaults()
- server = newServerTransport(trS, v, v, serverConf)
-
- if err := server.waitSession(); err != nil {
- return nil, nil, fmt.Errorf("server.waitSession: %v", err)
- }
- if err := client.waitSession(); err != nil {
- return nil, nil, fmt.Errorf("client.waitSession: %v", err)
- }
-
- return client, server, nil
-}
-
-func TestHandshakeBasic(t *testing.T) {
- if runtime.GOOS == "plan9" {
- t.Skip("see golang.org/issue/7237")
- }
-
- checker := &syncChecker{
- waitCall: make(chan int, 10),
- called: make(chan int, 10),
- }
-
- checker.waitCall <- 1
- trC, trS, err := handshakePair(&ClientConfig{HostKeyCallback: checker.Check}, "addr", false)
- if err != nil {
- t.Fatalf("handshakePair: %v", err)
- }
-
- defer trC.Close()
- defer trS.Close()
-
- // Let first kex complete normally.
- <-checker.called
-
- clientDone := make(chan int, 0)
- gotHalf := make(chan int, 0)
- const N = 20
-
- go func() {
- defer close(clientDone)
- // Client writes a bunch of stuff, and does a key
- // change in the middle. This should not confuse the
- // handshake in progress. We do this twice, so we test
- // that the packet buffer is reset correctly.
- for i := 0; i < N; i++ {
- p := []byte{msgRequestSuccess, byte(i)}
- if err := trC.writePacket(p); err != nil {
- t.Fatalf("sendPacket: %v", err)
- }
- if (i % 10) == 5 {
- <-gotHalf
- // halfway through, we request a key change.
- trC.requestKeyExchange()
-
- // Wait until we can be sure the key
- // change has really started before we
- // write more.
- <-checker.called
- }
- if (i % 10) == 7 {
- // write some packets until the kex
- // completes, to test buffering of
- // packets.
- checker.waitCall <- 1
- }
- }
- }()
-
- // Server checks that client messages come in cleanly
- i := 0
- err = nil
- for ; i < N; i++ {
- var p []byte
- p, err = trS.readPacket()
- if err != nil {
- break
- }
- if (i % 10) == 5 {
- gotHalf <- 1
- }
-
- want := []byte{msgRequestSuccess, byte(i)}
- if bytes.Compare(p, want) != 0 {
- t.Errorf("message %d: got %v, want %v", i, p, want)
- }
- }
- <-clientDone
- if err != nil && err != io.EOF {
- t.Fatalf("server error: %v", err)
- }
- if i != N {
- t.Errorf("received %d messages, want 10.", i)
- }
-
- close(checker.called)
- if _, ok := <-checker.called; ok {
- // If all went well, we registered exactly 2 key changes: one
- // that establishes the session, and one that we requested
- // additionally.
- t.Fatalf("got another host key checks after 2 handshakes")
- }
-}
-
-func TestForceFirstKex(t *testing.T) {
- // like handshakePair, but must access the keyingTransport.
- checker := &testChecker{}
- clientConf := &ClientConfig{HostKeyCallback: checker.Check}
- a, b, err := netPipe()
- if err != nil {
- t.Fatalf("netPipe: %v", err)
- }
-
- var trC, trS keyingTransport
-
- trC = newTransport(a, rand.Reader, true)
-
- // This is the disallowed packet:
- trC.writePacket(Marshal(&serviceRequestMsg{serviceUserAuth}))
-
- // Rest of the setup.
- trS = newTransport(b, rand.Reader, false)
- clientConf.SetDefaults()
-
- v := []byte("version")
- client := newClientTransport(trC, v, v, clientConf, "addr", a.RemoteAddr())
-
- serverConf := &ServerConfig{}
- serverConf.AddHostKey(testSigners["ecdsa"])
- serverConf.AddHostKey(testSigners["rsa"])
- serverConf.SetDefaults()
- server := newServerTransport(trS, v, v, serverConf)
-
- defer client.Close()
- defer server.Close()
-
- // We setup the initial key exchange, but the remote side
- // tries to send serviceRequestMsg in cleartext, which is
- // disallowed.
-
- if err := server.waitSession(); err == nil {
- t.Errorf("server first kex init should reject unexpected packet")
- }
-}
-
-func TestHandshakeAutoRekeyWrite(t *testing.T) {
- checker := &syncChecker{
- called: make(chan int, 10),
- waitCall: nil,
- }
- clientConf := &ClientConfig{HostKeyCallback: checker.Check}
- clientConf.RekeyThreshold = 500
- trC, trS, err := handshakePair(clientConf, "addr", false)
- if err != nil {
- t.Fatalf("handshakePair: %v", err)
- }
- defer trC.Close()
- defer trS.Close()
-
- input := make([]byte, 251)
- input[0] = msgRequestSuccess
-
- done := make(chan int, 1)
- const numPacket = 5
- go func() {
- defer close(done)
- j := 0
- for ; j < numPacket; j++ {
- if p, err := trS.readPacket(); err != nil {
- break
- } else if !bytes.Equal(input, p) {
- t.Errorf("got packet type %d, want %d", p[0], input[0])
- }
- }
-
- if j != numPacket {
- t.Errorf("got %d, want 5 messages", j)
- }
- }()
-
- <-checker.called
-
- for i := 0; i < numPacket; i++ {
- p := make([]byte, len(input))
- copy(p, input)
- if err := trC.writePacket(p); err != nil {
- t.Errorf("writePacket: %v", err)
- }
- if i == 2 {
- // Make sure the kex is in progress.
- <-checker.called
- }
-
- }
- <-done
-}
-
-type syncChecker struct {
- waitCall chan int
- called chan int
-}
-
-func (c *syncChecker) Check(dialAddr string, addr net.Addr, key PublicKey) error {
- c.called <- 1
- if c.waitCall != nil {
- <-c.waitCall
- }
- return nil
-}
-
-func TestHandshakeAutoRekeyRead(t *testing.T) {
- sync := &syncChecker{
- called: make(chan int, 2),
- waitCall: nil,
- }
- clientConf := &ClientConfig{
- HostKeyCallback: sync.Check,
- }
- clientConf.RekeyThreshold = 500
-
- trC, trS, err := handshakePair(clientConf, "addr", false)
- if err != nil {
- t.Fatalf("handshakePair: %v", err)
- }
- defer trC.Close()
- defer trS.Close()
-
- packet := make([]byte, 501)
- packet[0] = msgRequestSuccess
- if err := trS.writePacket(packet); err != nil {
- t.Fatalf("writePacket: %v", err)
- }
-
- // While we read out the packet, a key change will be
- // initiated.
- done := make(chan int, 1)
- go func() {
- defer close(done)
- if _, err := trC.readPacket(); err != nil {
- t.Fatalf("readPacket(client): %v", err)
- }
-
- }()
-
- <-done
- <-sync.called
-}
-
-// errorKeyingTransport generates errors after a given number of
-// read/write operations.
-type errorKeyingTransport struct {
- packetConn
- readLeft, writeLeft int
-}
-
-func (n *errorKeyingTransport) prepareKeyChange(*algorithms, *kexResult) error {
- return nil
-}
-
-func (n *errorKeyingTransport) getSessionID() []byte {
- return nil
-}
-
-func (n *errorKeyingTransport) writePacket(packet []byte) error {
- if n.writeLeft == 0 {
- n.Close()
- return errors.New("barf")
- }
-
- n.writeLeft--
- return n.packetConn.writePacket(packet)
-}
-
-func (n *errorKeyingTransport) readPacket() ([]byte, error) {
- if n.readLeft == 0 {
- n.Close()
- return nil, errors.New("barf")
- }
-
- n.readLeft--
- return n.packetConn.readPacket()
-}
-
-func TestHandshakeErrorHandlingRead(t *testing.T) {
- for i := 0; i < 20; i++ {
- testHandshakeErrorHandlingN(t, i, -1, false)
- }
-}
-
-func TestHandshakeErrorHandlingWrite(t *testing.T) {
- for i := 0; i < 20; i++ {
- testHandshakeErrorHandlingN(t, -1, i, false)
- }
-}
-
-func TestHandshakeErrorHandlingReadCoupled(t *testing.T) {
- for i := 0; i < 20; i++ {
- testHandshakeErrorHandlingN(t, i, -1, true)
- }
-}
-
-func TestHandshakeErrorHandlingWriteCoupled(t *testing.T) {
- for i := 0; i < 20; i++ {
- testHandshakeErrorHandlingN(t, -1, i, true)
- }
-}
-
-// testHandshakeErrorHandlingN runs handshakes, injecting errors. If
-// handshakeTransport deadlocks, the go runtime will detect it and
-// panic.
-func testHandshakeErrorHandlingN(t *testing.T, readLimit, writeLimit int, coupled bool) {
- msg := Marshal(&serviceRequestMsg{strings.Repeat("x", int(minRekeyThreshold)/4)})
-
- a, b := memPipe()
- defer a.Close()
- defer b.Close()
-
- key := testSigners["ecdsa"]
- serverConf := Config{RekeyThreshold: minRekeyThreshold}
- serverConf.SetDefaults()
- serverConn := newHandshakeTransport(&errorKeyingTransport{a, readLimit, writeLimit}, &serverConf, []byte{'a'}, []byte{'b'})
- serverConn.hostKeys = []Signer{key}
- go serverConn.readLoop()
- go serverConn.kexLoop()
-
- clientConf := Config{RekeyThreshold: 10 * minRekeyThreshold}
- clientConf.SetDefaults()
- clientConn := newHandshakeTransport(&errorKeyingTransport{b, -1, -1}, &clientConf, []byte{'a'}, []byte{'b'})
- clientConn.hostKeyAlgorithms = []string{key.PublicKey().Type()}
- clientConn.hostKeyCallback = InsecureIgnoreHostKey()
- go clientConn.readLoop()
- go clientConn.kexLoop()
-
- var wg sync.WaitGroup
-
- for _, hs := range []packetConn{serverConn, clientConn} {
- if !coupled {
- wg.Add(2)
- go func(c packetConn) {
- for i := 0; ; i++ {
- str := fmt.Sprintf("%08x", i) + strings.Repeat("x", int(minRekeyThreshold)/4-8)
- err := c.writePacket(Marshal(&serviceRequestMsg{str}))
- if err != nil {
- break
- }
- }
- wg.Done()
- c.Close()
- }(hs)
- go func(c packetConn) {
- for {
- _, err := c.readPacket()
- if err != nil {
- break
- }
- }
- wg.Done()
- }(hs)
- } else {
- wg.Add(1)
- go func(c packetConn) {
- for {
- _, err := c.readPacket()
- if err != nil {
- break
- }
- if err := c.writePacket(msg); err != nil {
- break
- }
-
- }
- wg.Done()
- }(hs)
- }
- }
- wg.Wait()
-}
-
-func TestDisconnect(t *testing.T) {
- if runtime.GOOS == "plan9" {
- t.Skip("see golang.org/issue/7237")
- }
- checker := &testChecker{}
- trC, trS, err := handshakePair(&ClientConfig{HostKeyCallback: checker.Check}, "addr", false)
- if err != nil {
- t.Fatalf("handshakePair: %v", err)
- }
-
- defer trC.Close()
- defer trS.Close()
-
- trC.writePacket([]byte{msgRequestSuccess, 0, 0})
- errMsg := &disconnectMsg{
- Reason: 42,
- Message: "such is life",
- }
- trC.writePacket(Marshal(errMsg))
- trC.writePacket([]byte{msgRequestSuccess, 0, 0})
-
- packet, err := trS.readPacket()
- if err != nil {
- t.Fatalf("readPacket 1: %v", err)
- }
- if packet[0] != msgRequestSuccess {
- t.Errorf("got packet %v, want packet type %d", packet, msgRequestSuccess)
- }
-
- _, err = trS.readPacket()
- if err == nil {
- t.Errorf("readPacket 2 succeeded")
- } else if !reflect.DeepEqual(err, errMsg) {
- t.Errorf("got error %#v, want %#v", err, errMsg)
- }
-
- _, err = trS.readPacket()
- if err == nil {
- t.Errorf("readPacket 3 succeeded")
- }
-}
-
-func TestHandshakeRekeyDefault(t *testing.T) {
- clientConf := &ClientConfig{
- Config: Config{
- Ciphers: []string{"aes128-ctr"},
- },
- HostKeyCallback: InsecureIgnoreHostKey(),
- }
- trC, trS, err := handshakePair(clientConf, "addr", false)
- if err != nil {
- t.Fatalf("handshakePair: %v", err)
- }
- defer trC.Close()
- defer trS.Close()
-
- trC.writePacket([]byte{msgRequestSuccess, 0, 0})
- trC.Close()
-
- rgb := (1024 + trC.readBytesLeft) >> 30
- wgb := (1024 + trC.writeBytesLeft) >> 30
-
- if rgb != 64 {
- t.Errorf("got rekey after %dG read, want 64G", rgb)
- }
- if wgb != 64 {
- t.Errorf("got rekey after %dG write, want 64G", wgb)
- }
-}
diff --git a/vendor/golang.org/x/crypto/ssh/kex_test.go b/vendor/golang.org/x/crypto/ssh/kex_test.go
deleted file mode 100644
index 12ca0acd3..000000000
--- a/vendor/golang.org/x/crypto/ssh/kex_test.go
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-// Key exchange tests.
-
-import (
- "crypto/rand"
- "reflect"
- "testing"
-)
-
-func TestKexes(t *testing.T) {
- type kexResultErr struct {
- result *kexResult
- err error
- }
-
- for name, kex := range kexAlgoMap {
- a, b := memPipe()
-
- s := make(chan kexResultErr, 1)
- c := make(chan kexResultErr, 1)
- var magics handshakeMagics
- go func() {
- r, e := kex.Client(a, rand.Reader, &magics)
- a.Close()
- c <- kexResultErr{r, e}
- }()
- go func() {
- r, e := kex.Server(b, rand.Reader, &magics, testSigners["ecdsa"])
- b.Close()
- s <- kexResultErr{r, e}
- }()
-
- clientRes := <-c
- serverRes := <-s
- if clientRes.err != nil {
- t.Errorf("client: %v", clientRes.err)
- }
- if serverRes.err != nil {
- t.Errorf("server: %v", serverRes.err)
- }
- if !reflect.DeepEqual(clientRes.result, serverRes.result) {
- t.Errorf("kex %q: mismatch %#v, %#v", name, clientRes.result, serverRes.result)
- }
- }
-}
diff --git a/vendor/golang.org/x/crypto/ssh/keys_test.go b/vendor/golang.org/x/crypto/ssh/keys_test.go
deleted file mode 100644
index 9a90abc0c..000000000
--- a/vendor/golang.org/x/crypto/ssh/keys_test.go
+++ /dev/null
@@ -1,500 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "crypto/dsa"
- "crypto/ecdsa"
- "crypto/elliptic"
- "crypto/rand"
- "crypto/rsa"
- "crypto/x509"
- "encoding/base64"
- "fmt"
- "reflect"
- "strings"
- "testing"
-
- "golang.org/x/crypto/ed25519"
- "golang.org/x/crypto/ssh/testdata"
-)
-
-func rawKey(pub PublicKey) interface{} {
- switch k := pub.(type) {
- case *rsaPublicKey:
- return (*rsa.PublicKey)(k)
- case *dsaPublicKey:
- return (*dsa.PublicKey)(k)
- case *ecdsaPublicKey:
- return (*ecdsa.PublicKey)(k)
- case ed25519PublicKey:
- return (ed25519.PublicKey)(k)
- case *Certificate:
- return k
- }
- panic("unknown key type")
-}
-
-func TestKeyMarshalParse(t *testing.T) {
- for _, priv := range testSigners {
- pub := priv.PublicKey()
- roundtrip, err := ParsePublicKey(pub.Marshal())
- if err != nil {
- t.Errorf("ParsePublicKey(%T): %v", pub, err)
- }
-
- k1 := rawKey(pub)
- k2 := rawKey(roundtrip)
-
- if !reflect.DeepEqual(k1, k2) {
- t.Errorf("got %#v in roundtrip, want %#v", k2, k1)
- }
- }
-}
-
-func TestUnsupportedCurves(t *testing.T) {
- raw, err := ecdsa.GenerateKey(elliptic.P224(), rand.Reader)
- if err != nil {
- t.Fatalf("GenerateKey: %v", err)
- }
-
- if _, err = NewSignerFromKey(raw); err == nil || !strings.Contains(err.Error(), "only P-256") {
- t.Fatalf("NewPrivateKey should not succeed with P-224, got: %v", err)
- }
-
- if _, err = NewPublicKey(&raw.PublicKey); err == nil || !strings.Contains(err.Error(), "only P-256") {
- t.Fatalf("NewPublicKey should not succeed with P-224, got: %v", err)
- }
-}
-
-func TestNewPublicKey(t *testing.T) {
- for _, k := range testSigners {
- raw := rawKey(k.PublicKey())
- // Skip certificates, as NewPublicKey does not support them.
- if _, ok := raw.(*Certificate); ok {
- continue
- }
- pub, err := NewPublicKey(raw)
- if err != nil {
- t.Errorf("NewPublicKey(%#v): %v", raw, err)
- }
- if !reflect.DeepEqual(k.PublicKey(), pub) {
- t.Errorf("NewPublicKey(%#v) = %#v, want %#v", raw, pub, k.PublicKey())
- }
- }
-}
-
-func TestKeySignVerify(t *testing.T) {
- for _, priv := range testSigners {
- pub := priv.PublicKey()
-
- data := []byte("sign me")
- sig, err := priv.Sign(rand.Reader, data)
- if err != nil {
- t.Fatalf("Sign(%T): %v", priv, err)
- }
-
- if err := pub.Verify(data, sig); err != nil {
- t.Errorf("publicKey.Verify(%T): %v", priv, err)
- }
- sig.Blob[5]++
- if err := pub.Verify(data, sig); err == nil {
- t.Errorf("publicKey.Verify on broken sig did not fail")
- }
- }
-}
-
-func TestParseRSAPrivateKey(t *testing.T) {
- key := testPrivateKeys["rsa"]
-
- rsa, ok := key.(*rsa.PrivateKey)
- if !ok {
- t.Fatalf("got %T, want *rsa.PrivateKey", rsa)
- }
-
- if err := rsa.Validate(); err != nil {
- t.Errorf("Validate: %v", err)
- }
-}
-
-func TestParseECPrivateKey(t *testing.T) {
- key := testPrivateKeys["ecdsa"]
-
- ecKey, ok := key.(*ecdsa.PrivateKey)
- if !ok {
- t.Fatalf("got %T, want *ecdsa.PrivateKey", ecKey)
- }
-
- if !validateECPublicKey(ecKey.Curve, ecKey.X, ecKey.Y) {
- t.Fatalf("public key does not validate.")
- }
-}
-
-// See Issue https://github.com/golang/go/issues/6650.
-func TestParseEncryptedPrivateKeysFails(t *testing.T) {
- const wantSubstring = "encrypted"
- for i, tt := range testdata.PEMEncryptedKeys {
- _, err := ParsePrivateKey(tt.PEMBytes)
- if err == nil {
- t.Errorf("#%d key %s: ParsePrivateKey successfully parsed, expected an error", i, tt.Name)
- continue
- }
-
- if !strings.Contains(err.Error(), wantSubstring) {
- t.Errorf("#%d key %s: got error %q, want substring %q", i, tt.Name, err, wantSubstring)
- }
- }
-}
-
-// Parse encrypted private keys with passphrase
-func TestParseEncryptedPrivateKeysWithPassphrase(t *testing.T) {
- data := []byte("sign me")
- for _, tt := range testdata.PEMEncryptedKeys {
- s, err := ParsePrivateKeyWithPassphrase(tt.PEMBytes, []byte(tt.EncryptionKey))
- if err != nil {
- t.Fatalf("ParsePrivateKeyWithPassphrase returned error: %s", err)
- continue
- }
- sig, err := s.Sign(rand.Reader, data)
- if err != nil {
- t.Fatalf("dsa.Sign: %v", err)
- }
- if err := s.PublicKey().Verify(data, sig); err != nil {
- t.Errorf("Verify failed: %v", err)
- }
- }
-
- tt := testdata.PEMEncryptedKeys[0]
- _, err := ParsePrivateKeyWithPassphrase(tt.PEMBytes, []byte("incorrect"))
- if err != x509.IncorrectPasswordError {
- t.Fatalf("got %v want IncorrectPasswordError", err)
- }
-}
-
-func TestParseDSA(t *testing.T) {
- // We actually exercise the ParsePrivateKey codepath here, as opposed to
- // using the ParseRawPrivateKey+NewSignerFromKey path that testdata_test.go
- // uses.
- s, err := ParsePrivateKey(testdata.PEMBytes["dsa"])
- if err != nil {
- t.Fatalf("ParsePrivateKey returned error: %s", err)
- }
-
- data := []byte("sign me")
- sig, err := s.Sign(rand.Reader, data)
- if err != nil {
- t.Fatalf("dsa.Sign: %v", err)
- }
-
- if err := s.PublicKey().Verify(data, sig); err != nil {
- t.Errorf("Verify failed: %v", err)
- }
-}
-
-// Tests for authorized_keys parsing.
-
-// getTestKey returns a public key, and its base64 encoding.
-func getTestKey() (PublicKey, string) {
- k := testPublicKeys["rsa"]
-
- b := &bytes.Buffer{}
- e := base64.NewEncoder(base64.StdEncoding, b)
- e.Write(k.Marshal())
- e.Close()
-
- return k, b.String()
-}
-
-func TestMarshalParsePublicKey(t *testing.T) {
- pub, pubSerialized := getTestKey()
- line := fmt.Sprintf("%s %s user@host", pub.Type(), pubSerialized)
-
- authKeys := MarshalAuthorizedKey(pub)
- actualFields := strings.Fields(string(authKeys))
- if len(actualFields) == 0 {
- t.Fatalf("failed authKeys: %v", authKeys)
- }
-
- // drop the comment
- expectedFields := strings.Fields(line)[0:2]
-
- if !reflect.DeepEqual(actualFields, expectedFields) {
- t.Errorf("got %v, expected %v", actualFields, expectedFields)
- }
-
- actPub, _, _, _, err := ParseAuthorizedKey([]byte(line))
- if err != nil {
- t.Fatalf("cannot parse %v: %v", line, err)
- }
- if !reflect.DeepEqual(actPub, pub) {
- t.Errorf("got %v, expected %v", actPub, pub)
- }
-}
-
-type testAuthResult struct {
- pubKey PublicKey
- options []string
- comments string
- rest string
- ok bool
-}
-
-func testAuthorizedKeys(t *testing.T, authKeys []byte, expected []testAuthResult) {
- rest := authKeys
- var values []testAuthResult
- for len(rest) > 0 {
- var r testAuthResult
- var err error
- r.pubKey, r.comments, r.options, rest, err = ParseAuthorizedKey(rest)
- r.ok = (err == nil)
- t.Log(err)
- r.rest = string(rest)
- values = append(values, r)
- }
-
- if !reflect.DeepEqual(values, expected) {
- t.Errorf("got %#v, expected %#v", values, expected)
- }
-}
-
-func TestAuthorizedKeyBasic(t *testing.T) {
- pub, pubSerialized := getTestKey()
- line := "ssh-rsa " + pubSerialized + " user@host"
- testAuthorizedKeys(t, []byte(line),
- []testAuthResult{
- {pub, nil, "user@host", "", true},
- })
-}
-
-func TestAuth(t *testing.T) {
- pub, pubSerialized := getTestKey()
- authWithOptions := []string{
- `# comments to ignore before any keys...`,
- ``,
- `env="HOME=/home/root",no-port-forwarding ssh-rsa ` + pubSerialized + ` user@host`,
- `# comments to ignore, along with a blank line`,
- ``,
- `env="HOME=/home/root2" ssh-rsa ` + pubSerialized + ` user2@host2`,
- ``,
- `# more comments, plus a invalid entry`,
- `ssh-rsa data-that-will-not-parse user@host3`,
- }
- for _, eol := range []string{"\n", "\r\n"} {
- authOptions := strings.Join(authWithOptions, eol)
- rest2 := strings.Join(authWithOptions[3:], eol)
- rest3 := strings.Join(authWithOptions[6:], eol)
- testAuthorizedKeys(t, []byte(authOptions), []testAuthResult{
- {pub, []string{`env="HOME=/home/root"`, "no-port-forwarding"}, "user@host", rest2, true},
- {pub, []string{`env="HOME=/home/root2"`}, "user2@host2", rest3, true},
- {nil, nil, "", "", false},
- })
- }
-}
-
-func TestAuthWithQuotedSpaceInEnv(t *testing.T) {
- pub, pubSerialized := getTestKey()
- authWithQuotedSpaceInEnv := []byte(`env="HOME=/home/root dir",no-port-forwarding ssh-rsa ` + pubSerialized + ` user@host`)
- testAuthorizedKeys(t, []byte(authWithQuotedSpaceInEnv), []testAuthResult{
- {pub, []string{`env="HOME=/home/root dir"`, "no-port-forwarding"}, "user@host", "", true},
- })
-}
-
-func TestAuthWithQuotedCommaInEnv(t *testing.T) {
- pub, pubSerialized := getTestKey()
- authWithQuotedCommaInEnv := []byte(`env="HOME=/home/root,dir",no-port-forwarding ssh-rsa ` + pubSerialized + ` user@host`)
- testAuthorizedKeys(t, []byte(authWithQuotedCommaInEnv), []testAuthResult{
- {pub, []string{`env="HOME=/home/root,dir"`, "no-port-forwarding"}, "user@host", "", true},
- })
-}
-
-func TestAuthWithQuotedQuoteInEnv(t *testing.T) {
- pub, pubSerialized := getTestKey()
- authWithQuotedQuoteInEnv := []byte(`env="HOME=/home/\"root dir",no-port-forwarding` + "\t" + `ssh-rsa` + "\t" + pubSerialized + ` user@host`)
- authWithDoubleQuotedQuote := []byte(`no-port-forwarding,env="HOME=/home/ \"root dir\"" ssh-rsa ` + pubSerialized + "\t" + `user@host`)
- testAuthorizedKeys(t, []byte(authWithQuotedQuoteInEnv), []testAuthResult{
- {pub, []string{`env="HOME=/home/\"root dir"`, "no-port-forwarding"}, "user@host", "", true},
- })
-
- testAuthorizedKeys(t, []byte(authWithDoubleQuotedQuote), []testAuthResult{
- {pub, []string{"no-port-forwarding", `env="HOME=/home/ \"root dir\""`}, "user@host", "", true},
- })
-}
-
-func TestAuthWithInvalidSpace(t *testing.T) {
- _, pubSerialized := getTestKey()
- authWithInvalidSpace := []byte(`env="HOME=/home/root dir", no-port-forwarding ssh-rsa ` + pubSerialized + ` user@host
-#more to follow but still no valid keys`)
- testAuthorizedKeys(t, []byte(authWithInvalidSpace), []testAuthResult{
- {nil, nil, "", "", false},
- })
-}
-
-func TestAuthWithMissingQuote(t *testing.T) {
- pub, pubSerialized := getTestKey()
- authWithMissingQuote := []byte(`env="HOME=/home/root,no-port-forwarding ssh-rsa ` + pubSerialized + ` user@host
-env="HOME=/home/root",shared-control ssh-rsa ` + pubSerialized + ` user@host`)
-
- testAuthorizedKeys(t, []byte(authWithMissingQuote), []testAuthResult{
- {pub, []string{`env="HOME=/home/root"`, `shared-control`}, "user@host", "", true},
- })
-}
-
-func TestInvalidEntry(t *testing.T) {
- authInvalid := []byte(`ssh-rsa`)
- _, _, _, _, err := ParseAuthorizedKey(authInvalid)
- if err == nil {
- t.Errorf("got valid entry for %q", authInvalid)
- }
-}
-
-var knownHostsParseTests = []struct {
- input string
- err string
-
- marker string
- comment string
- hosts []string
- rest string
-}{
- {
- "",
- "EOF",
-
- "", "", nil, "",
- },
- {
- "# Just a comment",
- "EOF",
-
- "", "", nil, "",
- },
- {
- " \t ",
- "EOF",
-
- "", "", nil, "",
- },
- {
- "localhost ssh-rsa {RSAPUB}",
- "",
-
- "", "", []string{"localhost"}, "",
- },
- {
- "localhost\tssh-rsa {RSAPUB}",
- "",
-
- "", "", []string{"localhost"}, "",
- },
- {
- "localhost\tssh-rsa {RSAPUB}\tcomment comment",
- "",
-
- "", "comment comment", []string{"localhost"}, "",
- },
- {
- "localhost\tssh-rsa {RSAPUB}\tcomment comment\n",
- "",
-
- "", "comment comment", []string{"localhost"}, "",
- },
- {
- "localhost\tssh-rsa {RSAPUB}\tcomment comment\r\n",
- "",
-
- "", "comment comment", []string{"localhost"}, "",
- },
- {
- "localhost\tssh-rsa {RSAPUB}\tcomment comment\r\nnext line",
- "",
-
- "", "comment comment", []string{"localhost"}, "next line",
- },
- {
- "localhost,[host2:123]\tssh-rsa {RSAPUB}\tcomment comment",
- "",
-
- "", "comment comment", []string{"localhost", "[host2:123]"}, "",
- },
- {
- "@marker \tlocalhost,[host2:123]\tssh-rsa {RSAPUB}",
- "",
-
- "marker", "", []string{"localhost", "[host2:123]"}, "",
- },
- {
- "@marker \tlocalhost,[host2:123]\tssh-rsa aabbccdd",
- "short read",
-
- "", "", nil, "",
- },
-}
-
-func TestKnownHostsParsing(t *testing.T) {
- rsaPub, rsaPubSerialized := getTestKey()
-
- for i, test := range knownHostsParseTests {
- var expectedKey PublicKey
- const rsaKeyToken = "{RSAPUB}"
-
- input := test.input
- if strings.Contains(input, rsaKeyToken) {
- expectedKey = rsaPub
- input = strings.Replace(test.input, rsaKeyToken, rsaPubSerialized, -1)
- }
-
- marker, hosts, pubKey, comment, rest, err := ParseKnownHosts([]byte(input))
- if err != nil {
- if len(test.err) == 0 {
- t.Errorf("#%d: unexpectedly failed with %q", i, err)
- } else if !strings.Contains(err.Error(), test.err) {
- t.Errorf("#%d: expected error containing %q, but got %q", i, test.err, err)
- }
- continue
- } else if len(test.err) != 0 {
- t.Errorf("#%d: succeeded but expected error including %q", i, test.err)
- continue
- }
-
- if !reflect.DeepEqual(expectedKey, pubKey) {
- t.Errorf("#%d: expected key %#v, but got %#v", i, expectedKey, pubKey)
- }
-
- if marker != test.marker {
- t.Errorf("#%d: expected marker %q, but got %q", i, test.marker, marker)
- }
-
- if comment != test.comment {
- t.Errorf("#%d: expected comment %q, but got %q", i, test.comment, comment)
- }
-
- if !reflect.DeepEqual(test.hosts, hosts) {
- t.Errorf("#%d: expected hosts %#v, but got %#v", i, test.hosts, hosts)
- }
-
- if rest := string(rest); rest != test.rest {
- t.Errorf("#%d: expected remaining input to be %q, but got %q", i, test.rest, rest)
- }
- }
-}
-
-func TestFingerprintLegacyMD5(t *testing.T) {
- pub, _ := getTestKey()
- fingerprint := FingerprintLegacyMD5(pub)
- want := "fb:61:6d:1a:e3:f0:95:45:3c:a0:79:be:4a:93:63:66" // ssh-keygen -lf -E md5 rsa
- if fingerprint != want {
- t.Errorf("got fingerprint %q want %q", fingerprint, want)
- }
-}
-
-func TestFingerprintSHA256(t *testing.T) {
- pub, _ := getTestKey()
- fingerprint := FingerprintSHA256(pub)
- want := "SHA256:Anr3LjZK8YVpjrxu79myrW9Hrb/wpcMNpVvTq/RcBm8" // ssh-keygen -lf rsa
- if fingerprint != want {
- t.Errorf("got fingerprint %q want %q", fingerprint, want)
- }
-}
diff --git a/vendor/golang.org/x/crypto/ssh/mempipe_test.go b/vendor/golang.org/x/crypto/ssh/mempipe_test.go
deleted file mode 100644
index 8697cd614..000000000
--- a/vendor/golang.org/x/crypto/ssh/mempipe_test.go
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "io"
- "sync"
- "testing"
-)
-
-// An in-memory packetConn. It is safe to call Close and writePacket
-// from different goroutines.
-type memTransport struct {
- eof bool
- pending [][]byte
- write *memTransport
- sync.Mutex
- *sync.Cond
-}
-
-func (t *memTransport) readPacket() ([]byte, error) {
- t.Lock()
- defer t.Unlock()
- for {
- if len(t.pending) > 0 {
- r := t.pending[0]
- t.pending = t.pending[1:]
- return r, nil
- }
- if t.eof {
- return nil, io.EOF
- }
- t.Cond.Wait()
- }
-}
-
-func (t *memTransport) closeSelf() error {
- t.Lock()
- defer t.Unlock()
- if t.eof {
- return io.EOF
- }
- t.eof = true
- t.Cond.Broadcast()
- return nil
-}
-
-func (t *memTransport) Close() error {
- err := t.write.closeSelf()
- t.closeSelf()
- return err
-}
-
-func (t *memTransport) writePacket(p []byte) error {
- t.write.Lock()
- defer t.write.Unlock()
- if t.write.eof {
- return io.EOF
- }
- c := make([]byte, len(p))
- copy(c, p)
- t.write.pending = append(t.write.pending, c)
- t.write.Cond.Signal()
- return nil
-}
-
-func memPipe() (a, b packetConn) {
- t1 := memTransport{}
- t2 := memTransport{}
- t1.write = &t2
- t2.write = &t1
- t1.Cond = sync.NewCond(&t1.Mutex)
- t2.Cond = sync.NewCond(&t2.Mutex)
- return &t1, &t2
-}
-
-func TestMemPipe(t *testing.T) {
- a, b := memPipe()
- if err := a.writePacket([]byte{42}); err != nil {
- t.Fatalf("writePacket: %v", err)
- }
- if err := a.Close(); err != nil {
- t.Fatal("Close: ", err)
- }
- p, err := b.readPacket()
- if err != nil {
- t.Fatal("readPacket: ", err)
- }
- if len(p) != 1 || p[0] != 42 {
- t.Fatalf("got %v, want {42}", p)
- }
- p, err = b.readPacket()
- if err != io.EOF {
- t.Fatalf("got %v, %v, want EOF", p, err)
- }
-}
-
-func TestDoubleClose(t *testing.T) {
- a, _ := memPipe()
- err := a.Close()
- if err != nil {
- t.Errorf("Close: %v", err)
- }
- err = a.Close()
- if err != io.EOF {
- t.Errorf("expect EOF on double close.")
- }
-}
diff --git a/vendor/golang.org/x/crypto/ssh/messages_test.go b/vendor/golang.org/x/crypto/ssh/messages_test.go
deleted file mode 100644
index e79076412..000000000
--- a/vendor/golang.org/x/crypto/ssh/messages_test.go
+++ /dev/null
@@ -1,288 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "math/big"
- "math/rand"
- "reflect"
- "testing"
- "testing/quick"
-)
-
-var intLengthTests = []struct {
- val, length int
-}{
- {0, 4 + 0},
- {1, 4 + 1},
- {127, 4 + 1},
- {128, 4 + 2},
- {-1, 4 + 1},
-}
-
-func TestIntLength(t *testing.T) {
- for _, test := range intLengthTests {
- v := new(big.Int).SetInt64(int64(test.val))
- length := intLength(v)
- if length != test.length {
- t.Errorf("For %d, got length %d but expected %d", test.val, length, test.length)
- }
- }
-}
-
-type msgAllTypes struct {
- Bool bool `sshtype:"21"`
- Array [16]byte
- Uint64 uint64
- Uint32 uint32
- Uint8 uint8
- String string
- Strings []string
- Bytes []byte
- Int *big.Int
- Rest []byte `ssh:"rest"`
-}
-
-func (t *msgAllTypes) Generate(rand *rand.Rand, size int) reflect.Value {
- m := &msgAllTypes{}
- m.Bool = rand.Intn(2) == 1
- randomBytes(m.Array[:], rand)
- m.Uint64 = uint64(rand.Int63n(1<<63 - 1))
- m.Uint32 = uint32(rand.Intn((1 << 31) - 1))
- m.Uint8 = uint8(rand.Intn(1 << 8))
- m.String = string(m.Array[:])
- m.Strings = randomNameList(rand)
- m.Bytes = m.Array[:]
- m.Int = randomInt(rand)
- m.Rest = m.Array[:]
- return reflect.ValueOf(m)
-}
-
-func TestMarshalUnmarshal(t *testing.T) {
- rand := rand.New(rand.NewSource(0))
- iface := &msgAllTypes{}
- ty := reflect.ValueOf(iface).Type()
-
- n := 100
- if testing.Short() {
- n = 5
- }
- for j := 0; j < n; j++ {
- v, ok := quick.Value(ty, rand)
- if !ok {
- t.Errorf("failed to create value")
- break
- }
-
- m1 := v.Elem().Interface()
- m2 := iface
-
- marshaled := Marshal(m1)
- if err := Unmarshal(marshaled, m2); err != nil {
- t.Errorf("Unmarshal %#v: %s", m1, err)
- break
- }
-
- if !reflect.DeepEqual(v.Interface(), m2) {
- t.Errorf("got: %#v\nwant:%#v\n%x", m2, m1, marshaled)
- break
- }
- }
-}
-
-func TestUnmarshalEmptyPacket(t *testing.T) {
- var b []byte
- var m channelRequestSuccessMsg
- if err := Unmarshal(b, &m); err == nil {
- t.Fatalf("unmarshal of empty slice succeeded")
- }
-}
-
-func TestUnmarshalUnexpectedPacket(t *testing.T) {
- type S struct {
- I uint32 `sshtype:"43"`
- S string
- B bool
- }
-
- s := S{11, "hello", true}
- packet := Marshal(s)
- packet[0] = 42
- roundtrip := S{}
- err := Unmarshal(packet, &roundtrip)
- if err == nil {
- t.Fatal("expected error, not nil")
- }
-}
-
-func TestMarshalPtr(t *testing.T) {
- s := struct {
- S string
- }{"hello"}
-
- m1 := Marshal(s)
- m2 := Marshal(&s)
- if !bytes.Equal(m1, m2) {
- t.Errorf("got %q, want %q for marshaled pointer", m2, m1)
- }
-}
-
-func TestBareMarshalUnmarshal(t *testing.T) {
- type S struct {
- I uint32
- S string
- B bool
- }
-
- s := S{42, "hello", true}
- packet := Marshal(s)
- roundtrip := S{}
- Unmarshal(packet, &roundtrip)
-
- if !reflect.DeepEqual(s, roundtrip) {
- t.Errorf("got %#v, want %#v", roundtrip, s)
- }
-}
-
-func TestBareMarshal(t *testing.T) {
- type S2 struct {
- I uint32
- }
- s := S2{42}
- packet := Marshal(s)
- i, rest, ok := parseUint32(packet)
- if len(rest) > 0 || !ok {
- t.Errorf("parseInt(%q): parse error", packet)
- }
- if i != s.I {
- t.Errorf("got %d, want %d", i, s.I)
- }
-}
-
-func TestUnmarshalShortKexInitPacket(t *testing.T) {
- // This used to panic.
- // Issue 11348
- packet := []byte{0x14, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xff, 0xff, 0xff, 0xff}
- kim := &kexInitMsg{}
- if err := Unmarshal(packet, kim); err == nil {
- t.Error("truncated packet unmarshaled without error")
- }
-}
-
-func TestMarshalMultiTag(t *testing.T) {
- var res struct {
- A uint32 `sshtype:"1|2"`
- }
-
- good1 := struct {
- A uint32 `sshtype:"1"`
- }{
- 1,
- }
- good2 := struct {
- A uint32 `sshtype:"2"`
- }{
- 1,
- }
-
- if e := Unmarshal(Marshal(good1), &res); e != nil {
- t.Errorf("error unmarshaling multipart tag: %v", e)
- }
-
- if e := Unmarshal(Marshal(good2), &res); e != nil {
- t.Errorf("error unmarshaling multipart tag: %v", e)
- }
-
- bad1 := struct {
- A uint32 `sshtype:"3"`
- }{
- 1,
- }
- if e := Unmarshal(Marshal(bad1), &res); e == nil {
- t.Errorf("bad struct unmarshaled without error")
- }
-}
-
-func randomBytes(out []byte, rand *rand.Rand) {
- for i := 0; i < len(out); i++ {
- out[i] = byte(rand.Int31())
- }
-}
-
-func randomNameList(rand *rand.Rand) []string {
- ret := make([]string, rand.Int31()&15)
- for i := range ret {
- s := make([]byte, 1+(rand.Int31()&15))
- for j := range s {
- s[j] = 'a' + uint8(rand.Int31()&15)
- }
- ret[i] = string(s)
- }
- return ret
-}
-
-func randomInt(rand *rand.Rand) *big.Int {
- return new(big.Int).SetInt64(int64(int32(rand.Uint32())))
-}
-
-func (*kexInitMsg) Generate(rand *rand.Rand, size int) reflect.Value {
- ki := &kexInitMsg{}
- randomBytes(ki.Cookie[:], rand)
- ki.KexAlgos = randomNameList(rand)
- ki.ServerHostKeyAlgos = randomNameList(rand)
- ki.CiphersClientServer = randomNameList(rand)
- ki.CiphersServerClient = randomNameList(rand)
- ki.MACsClientServer = randomNameList(rand)
- ki.MACsServerClient = randomNameList(rand)
- ki.CompressionClientServer = randomNameList(rand)
- ki.CompressionServerClient = randomNameList(rand)
- ki.LanguagesClientServer = randomNameList(rand)
- ki.LanguagesServerClient = randomNameList(rand)
- if rand.Int31()&1 == 1 {
- ki.FirstKexFollows = true
- }
- return reflect.ValueOf(ki)
-}
-
-func (*kexDHInitMsg) Generate(rand *rand.Rand, size int) reflect.Value {
- dhi := &kexDHInitMsg{}
- dhi.X = randomInt(rand)
- return reflect.ValueOf(dhi)
-}
-
-var (
- _kexInitMsg = new(kexInitMsg).Generate(rand.New(rand.NewSource(0)), 10).Elem().Interface()
- _kexDHInitMsg = new(kexDHInitMsg).Generate(rand.New(rand.NewSource(0)), 10).Elem().Interface()
-
- _kexInit = Marshal(_kexInitMsg)
- _kexDHInit = Marshal(_kexDHInitMsg)
-)
-
-func BenchmarkMarshalKexInitMsg(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Marshal(_kexInitMsg)
- }
-}
-
-func BenchmarkUnmarshalKexInitMsg(b *testing.B) {
- m := new(kexInitMsg)
- for i := 0; i < b.N; i++ {
- Unmarshal(_kexInit, m)
- }
-}
-
-func BenchmarkMarshalKexDHInitMsg(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Marshal(_kexDHInitMsg)
- }
-}
-
-func BenchmarkUnmarshalKexDHInitMsg(b *testing.B) {
- m := new(kexDHInitMsg)
- for i := 0; i < b.N; i++ {
- Unmarshal(_kexDHInit, m)
- }
-}
diff --git a/vendor/golang.org/x/crypto/ssh/mux_test.go b/vendor/golang.org/x/crypto/ssh/mux_test.go
deleted file mode 100644
index d88b64e43..000000000
--- a/vendor/golang.org/x/crypto/ssh/mux_test.go
+++ /dev/null
@@ -1,501 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "io"
- "io/ioutil"
- "sync"
- "testing"
-)
-
-func muxPair() (*mux, *mux) {
- a, b := memPipe()
-
- s := newMux(a)
- c := newMux(b)
-
- return s, c
-}
-
-// Returns both ends of a channel, and the mux for the the 2nd
-// channel.
-func channelPair(t *testing.T) (*channel, *channel, *mux) {
- c, s := muxPair()
-
- res := make(chan *channel, 1)
- go func() {
- newCh, ok := <-s.incomingChannels
- if !ok {
- t.Fatalf("No incoming channel")
- }
- if newCh.ChannelType() != "chan" {
- t.Fatalf("got type %q want chan", newCh.ChannelType())
- }
- ch, _, err := newCh.Accept()
- if err != nil {
- t.Fatalf("Accept %v", err)
- }
- res <- ch.(*channel)
- }()
-
- ch, err := c.openChannel("chan", nil)
- if err != nil {
- t.Fatalf("OpenChannel: %v", err)
- }
-
- return <-res, ch, c
-}
-
-// Test that stderr and stdout can be addressed from different
-// goroutines. This is intended for use with the race detector.
-func TestMuxChannelExtendedThreadSafety(t *testing.T) {
- writer, reader, mux := channelPair(t)
- defer writer.Close()
- defer reader.Close()
- defer mux.Close()
-
- var wr, rd sync.WaitGroup
- magic := "hello world"
-
- wr.Add(2)
- go func() {
- io.WriteString(writer, magic)
- wr.Done()
- }()
- go func() {
- io.WriteString(writer.Stderr(), magic)
- wr.Done()
- }()
-
- rd.Add(2)
- go func() {
- c, err := ioutil.ReadAll(reader)
- if string(c) != magic {
- t.Fatalf("stdout read got %q, want %q (error %s)", c, magic, err)
- }
- rd.Done()
- }()
- go func() {
- c, err := ioutil.ReadAll(reader.Stderr())
- if string(c) != magic {
- t.Fatalf("stderr read got %q, want %q (error %s)", c, magic, err)
- }
- rd.Done()
- }()
-
- wr.Wait()
- writer.CloseWrite()
- rd.Wait()
-}
-
-func TestMuxReadWrite(t *testing.T) {
- s, c, mux := channelPair(t)
- defer s.Close()
- defer c.Close()
- defer mux.Close()
-
- magic := "hello world"
- magicExt := "hello stderr"
- go func() {
- _, err := s.Write([]byte(magic))
- if err != nil {
- t.Fatalf("Write: %v", err)
- }
- _, err = s.Extended(1).Write([]byte(magicExt))
- if err != nil {
- t.Fatalf("Write: %v", err)
- }
- }()
-
- var buf [1024]byte
- n, err := c.Read(buf[:])
- if err != nil {
- t.Fatalf("server Read: %v", err)
- }
- got := string(buf[:n])
- if got != magic {
- t.Fatalf("server: got %q want %q", got, magic)
- }
-
- n, err = c.Extended(1).Read(buf[:])
- if err != nil {
- t.Fatalf("server Read: %v", err)
- }
-
- got = string(buf[:n])
- if got != magicExt {
- t.Fatalf("server: got %q want %q", got, magic)
- }
-}
-
-func TestMuxChannelOverflow(t *testing.T) {
- reader, writer, mux := channelPair(t)
- defer reader.Close()
- defer writer.Close()
- defer mux.Close()
-
- wDone := make(chan int, 1)
- go func() {
- if _, err := writer.Write(make([]byte, channelWindowSize)); err != nil {
- t.Errorf("could not fill window: %v", err)
- }
- writer.Write(make([]byte, 1))
- wDone <- 1
- }()
- writer.remoteWin.waitWriterBlocked()
-
- // Send 1 byte.
- packet := make([]byte, 1+4+4+1)
- packet[0] = msgChannelData
- marshalUint32(packet[1:], writer.remoteId)
- marshalUint32(packet[5:], uint32(1))
- packet[9] = 42
-
- if err := writer.mux.conn.writePacket(packet); err != nil {
- t.Errorf("could not send packet")
- }
- if _, err := reader.SendRequest("hello", true, nil); err == nil {
- t.Errorf("SendRequest succeeded.")
- }
- <-wDone
-}
-
-func TestMuxChannelCloseWriteUnblock(t *testing.T) {
- reader, writer, mux := channelPair(t)
- defer reader.Close()
- defer writer.Close()
- defer mux.Close()
-
- wDone := make(chan int, 1)
- go func() {
- if _, err := writer.Write(make([]byte, channelWindowSize)); err != nil {
- t.Errorf("could not fill window: %v", err)
- }
- if _, err := writer.Write(make([]byte, 1)); err != io.EOF {
- t.Errorf("got %v, want EOF for unblock write", err)
- }
- wDone <- 1
- }()
-
- writer.remoteWin.waitWriterBlocked()
- reader.Close()
- <-wDone
-}
-
-func TestMuxConnectionCloseWriteUnblock(t *testing.T) {
- reader, writer, mux := channelPair(t)
- defer reader.Close()
- defer writer.Close()
- defer mux.Close()
-
- wDone := make(chan int, 1)
- go func() {
- if _, err := writer.Write(make([]byte, channelWindowSize)); err != nil {
- t.Errorf("could not fill window: %v", err)
- }
- if _, err := writer.Write(make([]byte, 1)); err != io.EOF {
- t.Errorf("got %v, want EOF for unblock write", err)
- }
- wDone <- 1
- }()
-
- writer.remoteWin.waitWriterBlocked()
- mux.Close()
- <-wDone
-}
-
-func TestMuxReject(t *testing.T) {
- client, server := muxPair()
- defer server.Close()
- defer client.Close()
-
- go func() {
- ch, ok := <-server.incomingChannels
- if !ok {
- t.Fatalf("Accept")
- }
- if ch.ChannelType() != "ch" || string(ch.ExtraData()) != "extra" {
- t.Fatalf("unexpected channel: %q, %q", ch.ChannelType(), ch.ExtraData())
- }
- ch.Reject(RejectionReason(42), "message")
- }()
-
- ch, err := client.openChannel("ch", []byte("extra"))
- if ch != nil {
- t.Fatal("openChannel not rejected")
- }
-
- ocf, ok := err.(*OpenChannelError)
- if !ok {
- t.Errorf("got %#v want *OpenChannelError", err)
- } else if ocf.Reason != 42 || ocf.Message != "message" {
- t.Errorf("got %#v, want {Reason: 42, Message: %q}", ocf, "message")
- }
-
- want := "ssh: rejected: unknown reason 42 (message)"
- if err.Error() != want {
- t.Errorf("got %q, want %q", err.Error(), want)
- }
-}
-
-func TestMuxChannelRequest(t *testing.T) {
- client, server, mux := channelPair(t)
- defer server.Close()
- defer client.Close()
- defer mux.Close()
-
- var received int
- var wg sync.WaitGroup
- wg.Add(1)
- go func() {
- for r := range server.incomingRequests {
- received++
- r.Reply(r.Type == "yes", nil)
- }
- wg.Done()
- }()
- _, err := client.SendRequest("yes", false, nil)
- if err != nil {
- t.Fatalf("SendRequest: %v", err)
- }
- ok, err := client.SendRequest("yes", true, nil)
- if err != nil {
- t.Fatalf("SendRequest: %v", err)
- }
-
- if !ok {
- t.Errorf("SendRequest(yes): %v", ok)
-
- }
-
- ok, err = client.SendRequest("no", true, nil)
- if err != nil {
- t.Fatalf("SendRequest: %v", err)
- }
- if ok {
- t.Errorf("SendRequest(no): %v", ok)
-
- }
-
- client.Close()
- wg.Wait()
-
- if received != 3 {
- t.Errorf("got %d requests, want %d", received, 3)
- }
-}
-
-func TestMuxGlobalRequest(t *testing.T) {
- clientMux, serverMux := muxPair()
- defer serverMux.Close()
- defer clientMux.Close()
-
- var seen bool
- go func() {
- for r := range serverMux.incomingRequests {
- seen = seen || r.Type == "peek"
- if r.WantReply {
- err := r.Reply(r.Type == "yes",
- append([]byte(r.Type), r.Payload...))
- if err != nil {
- t.Errorf("AckRequest: %v", err)
- }
- }
- }
- }()
-
- _, _, err := clientMux.SendRequest("peek", false, nil)
- if err != nil {
- t.Errorf("SendRequest: %v", err)
- }
-
- ok, data, err := clientMux.SendRequest("yes", true, []byte("a"))
- if !ok || string(data) != "yesa" || err != nil {
- t.Errorf("SendRequest(\"yes\", true, \"a\"): %v %v %v",
- ok, data, err)
- }
- if ok, data, err := clientMux.SendRequest("yes", true, []byte("a")); !ok || string(data) != "yesa" || err != nil {
- t.Errorf("SendRequest(\"yes\", true, \"a\"): %v %v %v",
- ok, data, err)
- }
-
- if ok, data, err := clientMux.SendRequest("no", true, []byte("a")); ok || string(data) != "noa" || err != nil {
- t.Errorf("SendRequest(\"no\", true, \"a\"): %v %v %v",
- ok, data, err)
- }
-
- if !seen {
- t.Errorf("never saw 'peek' request")
- }
-}
-
-func TestMuxGlobalRequestUnblock(t *testing.T) {
- clientMux, serverMux := muxPair()
- defer serverMux.Close()
- defer clientMux.Close()
-
- result := make(chan error, 1)
- go func() {
- _, _, err := clientMux.SendRequest("hello", true, nil)
- result <- err
- }()
-
- <-serverMux.incomingRequests
- serverMux.conn.Close()
- err := <-result
-
- if err != io.EOF {
- t.Errorf("want EOF, got %v", io.EOF)
- }
-}
-
-func TestMuxChannelRequestUnblock(t *testing.T) {
- a, b, connB := channelPair(t)
- defer a.Close()
- defer b.Close()
- defer connB.Close()
-
- result := make(chan error, 1)
- go func() {
- _, err := a.SendRequest("hello", true, nil)
- result <- err
- }()
-
- <-b.incomingRequests
- connB.conn.Close()
- err := <-result
-
- if err != io.EOF {
- t.Errorf("want EOF, got %v", err)
- }
-}
-
-func TestMuxCloseChannel(t *testing.T) {
- r, w, mux := channelPair(t)
- defer mux.Close()
- defer r.Close()
- defer w.Close()
-
- result := make(chan error, 1)
- go func() {
- var b [1024]byte
- _, err := r.Read(b[:])
- result <- err
- }()
- if err := w.Close(); err != nil {
- t.Errorf("w.Close: %v", err)
- }
-
- if _, err := w.Write([]byte("hello")); err != io.EOF {
- t.Errorf("got err %v, want io.EOF after Close", err)
- }
-
- if err := <-result; err != io.EOF {
- t.Errorf("got %v (%T), want io.EOF", err, err)
- }
-}
-
-func TestMuxCloseWriteChannel(t *testing.T) {
- r, w, mux := channelPair(t)
- defer mux.Close()
-
- result := make(chan error, 1)
- go func() {
- var b [1024]byte
- _, err := r.Read(b[:])
- result <- err
- }()
- if err := w.CloseWrite(); err != nil {
- t.Errorf("w.CloseWrite: %v", err)
- }
-
- if _, err := w.Write([]byte("hello")); err != io.EOF {
- t.Errorf("got err %v, want io.EOF after CloseWrite", err)
- }
-
- if err := <-result; err != io.EOF {
- t.Errorf("got %v (%T), want io.EOF", err, err)
- }
-}
-
-func TestMuxInvalidRecord(t *testing.T) {
- a, b := muxPair()
- defer a.Close()
- defer b.Close()
-
- packet := make([]byte, 1+4+4+1)
- packet[0] = msgChannelData
- marshalUint32(packet[1:], 29348723 /* invalid channel id */)
- marshalUint32(packet[5:], 1)
- packet[9] = 42
-
- a.conn.writePacket(packet)
- go a.SendRequest("hello", false, nil)
- // 'a' wrote an invalid packet, so 'b' has exited.
- req, ok := <-b.incomingRequests
- if ok {
- t.Errorf("got request %#v after receiving invalid packet", req)
- }
-}
-
-func TestZeroWindowAdjust(t *testing.T) {
- a, b, mux := channelPair(t)
- defer a.Close()
- defer b.Close()
- defer mux.Close()
-
- go func() {
- io.WriteString(a, "hello")
- // bogus adjust.
- a.sendMessage(windowAdjustMsg{})
- io.WriteString(a, "world")
- a.Close()
- }()
-
- want := "helloworld"
- c, _ := ioutil.ReadAll(b)
- if string(c) != want {
- t.Errorf("got %q want %q", c, want)
- }
-}
-
-func TestMuxMaxPacketSize(t *testing.T) {
- a, b, mux := channelPair(t)
- defer a.Close()
- defer b.Close()
- defer mux.Close()
-
- large := make([]byte, a.maxRemotePayload+1)
- packet := make([]byte, 1+4+4+1+len(large))
- packet[0] = msgChannelData
- marshalUint32(packet[1:], a.remoteId)
- marshalUint32(packet[5:], uint32(len(large)))
- packet[9] = 42
-
- if err := a.mux.conn.writePacket(packet); err != nil {
- t.Errorf("could not send packet")
- }
-
- go a.SendRequest("hello", false, nil)
-
- _, ok := <-b.incomingRequests
- if ok {
- t.Errorf("connection still alive after receiving large packet.")
- }
-}
-
-// Don't ship code with debug=true.
-func TestDebug(t *testing.T) {
- if debugMux {
- t.Error("mux debug switched on")
- }
- if debugHandshake {
- t.Error("handshake debug switched on")
- }
- if debugTransport {
- t.Error("transport debug switched on")
- }
-}
diff --git a/vendor/golang.org/x/crypto/ssh/session_test.go b/vendor/golang.org/x/crypto/ssh/session_test.go
deleted file mode 100644
index 7dce6dd69..000000000
--- a/vendor/golang.org/x/crypto/ssh/session_test.go
+++ /dev/null
@@ -1,774 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-// Session tests.
-
-import (
- "bytes"
- crypto_rand "crypto/rand"
- "errors"
- "io"
- "io/ioutil"
- "math/rand"
- "net"
- "testing"
-
- "golang.org/x/crypto/ssh/terminal"
-)
-
-type serverType func(Channel, <-chan *Request, *testing.T)
-
-// dial constructs a new test server and returns a *ClientConn.
-func dial(handler serverType, t *testing.T) *Client {
- c1, c2, err := netPipe()
- if err != nil {
- t.Fatalf("netPipe: %v", err)
- }
-
- go func() {
- defer c1.Close()
- conf := ServerConfig{
- NoClientAuth: true,
- }
- conf.AddHostKey(testSigners["rsa"])
-
- _, chans, reqs, err := NewServerConn(c1, &conf)
- if err != nil {
- t.Fatalf("Unable to handshake: %v", err)
- }
- go DiscardRequests(reqs)
-
- for newCh := range chans {
- if newCh.ChannelType() != "session" {
- newCh.Reject(UnknownChannelType, "unknown channel type")
- continue
- }
-
- ch, inReqs, err := newCh.Accept()
- if err != nil {
- t.Errorf("Accept: %v", err)
- continue
- }
- go func() {
- handler(ch, inReqs, t)
- }()
- }
- }()
-
- config := &ClientConfig{
- User: "testuser",
- HostKeyCallback: InsecureIgnoreHostKey(),
- }
-
- conn, chans, reqs, err := NewClientConn(c2, "", config)
- if err != nil {
- t.Fatalf("unable to dial remote side: %v", err)
- }
-
- return NewClient(conn, chans, reqs)
-}
-
-// Test a simple string is returned to session.Stdout.
-func TestSessionShell(t *testing.T) {
- conn := dial(shellHandler, t)
- defer conn.Close()
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("Unable to request new session: %v", err)
- }
- defer session.Close()
- stdout := new(bytes.Buffer)
- session.Stdout = stdout
- if err := session.Shell(); err != nil {
- t.Fatalf("Unable to execute command: %s", err)
- }
- if err := session.Wait(); err != nil {
- t.Fatalf("Remote command did not exit cleanly: %v", err)
- }
- actual := stdout.String()
- if actual != "golang" {
- t.Fatalf("Remote shell did not return expected string: expected=golang, actual=%s", actual)
- }
-}
-
-// TODO(dfc) add support for Std{in,err}Pipe when the Server supports it.
-
-// Test a simple string is returned via StdoutPipe.
-func TestSessionStdoutPipe(t *testing.T) {
- conn := dial(shellHandler, t)
- defer conn.Close()
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("Unable to request new session: %v", err)
- }
- defer session.Close()
- stdout, err := session.StdoutPipe()
- if err != nil {
- t.Fatalf("Unable to request StdoutPipe(): %v", err)
- }
- var buf bytes.Buffer
- if err := session.Shell(); err != nil {
- t.Fatalf("Unable to execute command: %v", err)
- }
- done := make(chan bool, 1)
- go func() {
- if _, err := io.Copy(&buf, stdout); err != nil {
- t.Errorf("Copy of stdout failed: %v", err)
- }
- done <- true
- }()
- if err := session.Wait(); err != nil {
- t.Fatalf("Remote command did not exit cleanly: %v", err)
- }
- <-done
- actual := buf.String()
- if actual != "golang" {
- t.Fatalf("Remote shell did not return expected string: expected=golang, actual=%s", actual)
- }
-}
-
-// Test that a simple string is returned via the Output helper,
-// and that stderr is discarded.
-func TestSessionOutput(t *testing.T) {
- conn := dial(fixedOutputHandler, t)
- defer conn.Close()
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("Unable to request new session: %v", err)
- }
- defer session.Close()
-
- buf, err := session.Output("") // cmd is ignored by fixedOutputHandler
- if err != nil {
- t.Error("Remote command did not exit cleanly:", err)
- }
- w := "this-is-stdout."
- g := string(buf)
- if g != w {
- t.Error("Remote command did not return expected string:")
- t.Logf("want %q", w)
- t.Logf("got %q", g)
- }
-}
-
-// Test that both stdout and stderr are returned
-// via the CombinedOutput helper.
-func TestSessionCombinedOutput(t *testing.T) {
- conn := dial(fixedOutputHandler, t)
- defer conn.Close()
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("Unable to request new session: %v", err)
- }
- defer session.Close()
-
- buf, err := session.CombinedOutput("") // cmd is ignored by fixedOutputHandler
- if err != nil {
- t.Error("Remote command did not exit cleanly:", err)
- }
- const stdout = "this-is-stdout."
- const stderr = "this-is-stderr."
- g := string(buf)
- if g != stdout+stderr && g != stderr+stdout {
- t.Error("Remote command did not return expected string:")
- t.Logf("want %q, or %q", stdout+stderr, stderr+stdout)
- t.Logf("got %q", g)
- }
-}
-
-// Test non-0 exit status is returned correctly.
-func TestExitStatusNonZero(t *testing.T) {
- conn := dial(exitStatusNonZeroHandler, t)
- defer conn.Close()
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("Unable to request new session: %v", err)
- }
- defer session.Close()
- if err := session.Shell(); err != nil {
- t.Fatalf("Unable to execute command: %v", err)
- }
- err = session.Wait()
- if err == nil {
- t.Fatalf("expected command to fail but it didn't")
- }
- e, ok := err.(*ExitError)
- if !ok {
- t.Fatalf("expected *ExitError but got %T", err)
- }
- if e.ExitStatus() != 15 {
- t.Fatalf("expected command to exit with 15 but got %v", e.ExitStatus())
- }
-}
-
-// Test 0 exit status is returned correctly.
-func TestExitStatusZero(t *testing.T) {
- conn := dial(exitStatusZeroHandler, t)
- defer conn.Close()
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("Unable to request new session: %v", err)
- }
- defer session.Close()
-
- if err := session.Shell(); err != nil {
- t.Fatalf("Unable to execute command: %v", err)
- }
- err = session.Wait()
- if err != nil {
- t.Fatalf("expected nil but got %v", err)
- }
-}
-
-// Test exit signal and status are both returned correctly.
-func TestExitSignalAndStatus(t *testing.T) {
- conn := dial(exitSignalAndStatusHandler, t)
- defer conn.Close()
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("Unable to request new session: %v", err)
- }
- defer session.Close()
- if err := session.Shell(); err != nil {
- t.Fatalf("Unable to execute command: %v", err)
- }
- err = session.Wait()
- if err == nil {
- t.Fatalf("expected command to fail but it didn't")
- }
- e, ok := err.(*ExitError)
- if !ok {
- t.Fatalf("expected *ExitError but got %T", err)
- }
- if e.Signal() != "TERM" || e.ExitStatus() != 15 {
- t.Fatalf("expected command to exit with signal TERM and status 15 but got signal %s and status %v", e.Signal(), e.ExitStatus())
- }
-}
-
-// Test exit signal and status are both returned correctly.
-func TestKnownExitSignalOnly(t *testing.T) {
- conn := dial(exitSignalHandler, t)
- defer conn.Close()
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("Unable to request new session: %v", err)
- }
- defer session.Close()
- if err := session.Shell(); err != nil {
- t.Fatalf("Unable to execute command: %v", err)
- }
- err = session.Wait()
- if err == nil {
- t.Fatalf("expected command to fail but it didn't")
- }
- e, ok := err.(*ExitError)
- if !ok {
- t.Fatalf("expected *ExitError but got %T", err)
- }
- if e.Signal() != "TERM" || e.ExitStatus() != 143 {
- t.Fatalf("expected command to exit with signal TERM and status 143 but got signal %s and status %v", e.Signal(), e.ExitStatus())
- }
-}
-
-// Test exit signal and status are both returned correctly.
-func TestUnknownExitSignal(t *testing.T) {
- conn := dial(exitSignalUnknownHandler, t)
- defer conn.Close()
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("Unable to request new session: %v", err)
- }
- defer session.Close()
- if err := session.Shell(); err != nil {
- t.Fatalf("Unable to execute command: %v", err)
- }
- err = session.Wait()
- if err == nil {
- t.Fatalf("expected command to fail but it didn't")
- }
- e, ok := err.(*ExitError)
- if !ok {
- t.Fatalf("expected *ExitError but got %T", err)
- }
- if e.Signal() != "SYS" || e.ExitStatus() != 128 {
- t.Fatalf("expected command to exit with signal SYS and status 128 but got signal %s and status %v", e.Signal(), e.ExitStatus())
- }
-}
-
-func TestExitWithoutStatusOrSignal(t *testing.T) {
- conn := dial(exitWithoutSignalOrStatus, t)
- defer conn.Close()
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("Unable to request new session: %v", err)
- }
- defer session.Close()
- if err := session.Shell(); err != nil {
- t.Fatalf("Unable to execute command: %v", err)
- }
- err = session.Wait()
- if err == nil {
- t.Fatalf("expected command to fail but it didn't")
- }
- if _, ok := err.(*ExitMissingError); !ok {
- t.Fatalf("got %T want *ExitMissingError", err)
- }
-}
-
-// windowTestBytes is the number of bytes that we'll send to the SSH server.
-const windowTestBytes = 16000 * 200
-
-// TestServerWindow writes random data to the server. The server is expected to echo
-// the same data back, which is compared against the original.
-func TestServerWindow(t *testing.T) {
- origBuf := bytes.NewBuffer(make([]byte, 0, windowTestBytes))
- io.CopyN(origBuf, crypto_rand.Reader, windowTestBytes)
- origBytes := origBuf.Bytes()
-
- conn := dial(echoHandler, t)
- defer conn.Close()
- session, err := conn.NewSession()
- if err != nil {
- t.Fatal(err)
- }
- defer session.Close()
- result := make(chan []byte)
-
- go func() {
- defer close(result)
- echoedBuf := bytes.NewBuffer(make([]byte, 0, windowTestBytes))
- serverStdout, err := session.StdoutPipe()
- if err != nil {
- t.Errorf("StdoutPipe failed: %v", err)
- return
- }
- n, err := copyNRandomly("stdout", echoedBuf, serverStdout, windowTestBytes)
- if err != nil && err != io.EOF {
- t.Errorf("Read only %d bytes from server, expected %d: %v", n, windowTestBytes, err)
- }
- result <- echoedBuf.Bytes()
- }()
-
- serverStdin, err := session.StdinPipe()
- if err != nil {
- t.Fatalf("StdinPipe failed: %v", err)
- }
- written, err := copyNRandomly("stdin", serverStdin, origBuf, windowTestBytes)
- if err != nil {
- t.Fatalf("failed to copy origBuf to serverStdin: %v", err)
- }
- if written != windowTestBytes {
- t.Fatalf("Wrote only %d of %d bytes to server", written, windowTestBytes)
- }
-
- echoedBytes := <-result
-
- if !bytes.Equal(origBytes, echoedBytes) {
- t.Fatalf("Echoed buffer differed from original, orig %d, echoed %d", len(origBytes), len(echoedBytes))
- }
-}
-
-// Verify the client can handle a keepalive packet from the server.
-func TestClientHandlesKeepalives(t *testing.T) {
- conn := dial(channelKeepaliveSender, t)
- defer conn.Close()
- session, err := conn.NewSession()
- if err != nil {
- t.Fatal(err)
- }
- defer session.Close()
- if err := session.Shell(); err != nil {
- t.Fatalf("Unable to execute command: %v", err)
- }
- err = session.Wait()
- if err != nil {
- t.Fatalf("expected nil but got: %v", err)
- }
-}
-
-type exitStatusMsg struct {
- Status uint32
-}
-
-type exitSignalMsg struct {
- Signal string
- CoreDumped bool
- Errmsg string
- Lang string
-}
-
-func handleTerminalRequests(in <-chan *Request) {
- for req := range in {
- ok := false
- switch req.Type {
- case "shell":
- ok = true
- if len(req.Payload) > 0 {
- // We don't accept any commands, only the default shell.
- ok = false
- }
- case "env":
- ok = true
- }
- req.Reply(ok, nil)
- }
-}
-
-func newServerShell(ch Channel, in <-chan *Request, prompt string) *terminal.Terminal {
- term := terminal.NewTerminal(ch, prompt)
- go handleTerminalRequests(in)
- return term
-}
-
-func exitStatusZeroHandler(ch Channel, in <-chan *Request, t *testing.T) {
- defer ch.Close()
- // this string is returned to stdout
- shell := newServerShell(ch, in, "> ")
- readLine(shell, t)
- sendStatus(0, ch, t)
-}
-
-func exitStatusNonZeroHandler(ch Channel, in <-chan *Request, t *testing.T) {
- defer ch.Close()
- shell := newServerShell(ch, in, "> ")
- readLine(shell, t)
- sendStatus(15, ch, t)
-}
-
-func exitSignalAndStatusHandler(ch Channel, in <-chan *Request, t *testing.T) {
- defer ch.Close()
- shell := newServerShell(ch, in, "> ")
- readLine(shell, t)
- sendStatus(15, ch, t)
- sendSignal("TERM", ch, t)
-}
-
-func exitSignalHandler(ch Channel, in <-chan *Request, t *testing.T) {
- defer ch.Close()
- shell := newServerShell(ch, in, "> ")
- readLine(shell, t)
- sendSignal("TERM", ch, t)
-}
-
-func exitSignalUnknownHandler(ch Channel, in <-chan *Request, t *testing.T) {
- defer ch.Close()
- shell := newServerShell(ch, in, "> ")
- readLine(shell, t)
- sendSignal("SYS", ch, t)
-}
-
-func exitWithoutSignalOrStatus(ch Channel, in <-chan *Request, t *testing.T) {
- defer ch.Close()
- shell := newServerShell(ch, in, "> ")
- readLine(shell, t)
-}
-
-func shellHandler(ch Channel, in <-chan *Request, t *testing.T) {
- defer ch.Close()
- // this string is returned to stdout
- shell := newServerShell(ch, in, "golang")
- readLine(shell, t)
- sendStatus(0, ch, t)
-}
-
-// Ignores the command, writes fixed strings to stderr and stdout.
-// Strings are "this-is-stdout." and "this-is-stderr.".
-func fixedOutputHandler(ch Channel, in <-chan *Request, t *testing.T) {
- defer ch.Close()
- _, err := ch.Read(nil)
-
- req, ok := <-in
- if !ok {
- t.Fatalf("error: expected channel request, got: %#v", err)
- return
- }
-
- // ignore request, always send some text
- req.Reply(true, nil)
-
- _, err = io.WriteString(ch, "this-is-stdout.")
- if err != nil {
- t.Fatalf("error writing on server: %v", err)
- }
- _, err = io.WriteString(ch.Stderr(), "this-is-stderr.")
- if err != nil {
- t.Fatalf("error writing on server: %v", err)
- }
- sendStatus(0, ch, t)
-}
-
-func readLine(shell *terminal.Terminal, t *testing.T) {
- if _, err := shell.ReadLine(); err != nil && err != io.EOF {
- t.Errorf("unable to read line: %v", err)
- }
-}
-
-func sendStatus(status uint32, ch Channel, t *testing.T) {
- msg := exitStatusMsg{
- Status: status,
- }
- if _, err := ch.SendRequest("exit-status", false, Marshal(&msg)); err != nil {
- t.Errorf("unable to send status: %v", err)
- }
-}
-
-func sendSignal(signal string, ch Channel, t *testing.T) {
- sig := exitSignalMsg{
- Signal: signal,
- CoreDumped: false,
- Errmsg: "Process terminated",
- Lang: "en-GB-oed",
- }
- if _, err := ch.SendRequest("exit-signal", false, Marshal(&sig)); err != nil {
- t.Errorf("unable to send signal: %v", err)
- }
-}
-
-func discardHandler(ch Channel, t *testing.T) {
- defer ch.Close()
- io.Copy(ioutil.Discard, ch)
-}
-
-func echoHandler(ch Channel, in <-chan *Request, t *testing.T) {
- defer ch.Close()
- if n, err := copyNRandomly("echohandler", ch, ch, windowTestBytes); err != nil {
- t.Errorf("short write, wrote %d, expected %d: %v ", n, windowTestBytes, err)
- }
-}
-
-// copyNRandomly copies n bytes from src to dst. It uses a variable, and random,
-// buffer size to exercise more code paths.
-func copyNRandomly(title string, dst io.Writer, src io.Reader, n int) (int, error) {
- var (
- buf = make([]byte, 32*1024)
- written int
- remaining = n
- )
- for remaining > 0 {
- l := rand.Intn(1 << 15)
- if remaining < l {
- l = remaining
- }
- nr, er := src.Read(buf[:l])
- nw, ew := dst.Write(buf[:nr])
- remaining -= nw
- written += nw
- if ew != nil {
- return written, ew
- }
- if nr != nw {
- return written, io.ErrShortWrite
- }
- if er != nil && er != io.EOF {
- return written, er
- }
- }
- return written, nil
-}
-
-func channelKeepaliveSender(ch Channel, in <-chan *Request, t *testing.T) {
- defer ch.Close()
- shell := newServerShell(ch, in, "> ")
- readLine(shell, t)
- if _, err := ch.SendRequest("keepalive@openssh.com", true, nil); err != nil {
- t.Errorf("unable to send channel keepalive request: %v", err)
- }
- sendStatus(0, ch, t)
-}
-
-func TestClientWriteEOF(t *testing.T) {
- conn := dial(simpleEchoHandler, t)
- defer conn.Close()
-
- session, err := conn.NewSession()
- if err != nil {
- t.Fatal(err)
- }
- defer session.Close()
- stdin, err := session.StdinPipe()
- if err != nil {
- t.Fatalf("StdinPipe failed: %v", err)
- }
- stdout, err := session.StdoutPipe()
- if err != nil {
- t.Fatalf("StdoutPipe failed: %v", err)
- }
-
- data := []byte(`0000`)
- _, err = stdin.Write(data)
- if err != nil {
- t.Fatalf("Write failed: %v", err)
- }
- stdin.Close()
-
- res, err := ioutil.ReadAll(stdout)
- if err != nil {
- t.Fatalf("Read failed: %v", err)
- }
-
- if !bytes.Equal(data, res) {
- t.Fatalf("Read differed from write, wrote: %v, read: %v", data, res)
- }
-}
-
-func simpleEchoHandler(ch Channel, in <-chan *Request, t *testing.T) {
- defer ch.Close()
- data, err := ioutil.ReadAll(ch)
- if err != nil {
- t.Errorf("handler read error: %v", err)
- }
- _, err = ch.Write(data)
- if err != nil {
- t.Errorf("handler write error: %v", err)
- }
-}
-
-func TestSessionID(t *testing.T) {
- c1, c2, err := netPipe()
- if err != nil {
- t.Fatalf("netPipe: %v", err)
- }
- defer c1.Close()
- defer c2.Close()
-
- serverID := make(chan []byte, 1)
- clientID := make(chan []byte, 1)
-
- serverConf := &ServerConfig{
- NoClientAuth: true,
- }
- serverConf.AddHostKey(testSigners["ecdsa"])
- clientConf := &ClientConfig{
- HostKeyCallback: InsecureIgnoreHostKey(),
- User: "user",
- }
-
- go func() {
- conn, chans, reqs, err := NewServerConn(c1, serverConf)
- if err != nil {
- t.Fatalf("server handshake: %v", err)
- }
- serverID <- conn.SessionID()
- go DiscardRequests(reqs)
- for ch := range chans {
- ch.Reject(Prohibited, "")
- }
- }()
-
- go func() {
- conn, chans, reqs, err := NewClientConn(c2, "", clientConf)
- if err != nil {
- t.Fatalf("client handshake: %v", err)
- }
- clientID <- conn.SessionID()
- go DiscardRequests(reqs)
- for ch := range chans {
- ch.Reject(Prohibited, "")
- }
- }()
-
- s := <-serverID
- c := <-clientID
- if bytes.Compare(s, c) != 0 {
- t.Errorf("server session ID (%x) != client session ID (%x)", s, c)
- } else if len(s) == 0 {
- t.Errorf("client and server SessionID were empty.")
- }
-}
-
-type noReadConn struct {
- readSeen bool
- net.Conn
-}
-
-func (c *noReadConn) Close() error {
- return nil
-}
-
-func (c *noReadConn) Read(b []byte) (int, error) {
- c.readSeen = true
- return 0, errors.New("noReadConn error")
-}
-
-func TestInvalidServerConfiguration(t *testing.T) {
- c1, c2, err := netPipe()
- if err != nil {
- t.Fatalf("netPipe: %v", err)
- }
- defer c1.Close()
- defer c2.Close()
-
- serveConn := noReadConn{Conn: c1}
- serverConf := &ServerConfig{}
-
- NewServerConn(&serveConn, serverConf)
- if serveConn.readSeen {
- t.Fatalf("NewServerConn attempted to Read() from Conn while configuration is missing host key")
- }
-
- serverConf.AddHostKey(testSigners["ecdsa"])
-
- NewServerConn(&serveConn, serverConf)
- if serveConn.readSeen {
- t.Fatalf("NewServerConn attempted to Read() from Conn while configuration is missing authentication method")
- }
-}
-
-func TestHostKeyAlgorithms(t *testing.T) {
- serverConf := &ServerConfig{
- NoClientAuth: true,
- }
- serverConf.AddHostKey(testSigners["rsa"])
- serverConf.AddHostKey(testSigners["ecdsa"])
-
- connect := func(clientConf *ClientConfig, want string) {
- var alg string
- clientConf.HostKeyCallback = func(h string, a net.Addr, key PublicKey) error {
- alg = key.Type()
- return nil
- }
- c1, c2, err := netPipe()
- if err != nil {
- t.Fatalf("netPipe: %v", err)
- }
- defer c1.Close()
- defer c2.Close()
-
- go NewServerConn(c1, serverConf)
- _, _, _, err = NewClientConn(c2, "", clientConf)
- if err != nil {
- t.Fatalf("NewClientConn: %v", err)
- }
- if alg != want {
- t.Errorf("selected key algorithm %s, want %s", alg, want)
- }
- }
-
- // By default, we get the preferred algorithm, which is ECDSA 256.
-
- clientConf := &ClientConfig{
- HostKeyCallback: InsecureIgnoreHostKey(),
- }
- connect(clientConf, KeyAlgoECDSA256)
-
- // Client asks for RSA explicitly.
- clientConf.HostKeyAlgorithms = []string{KeyAlgoRSA}
- connect(clientConf, KeyAlgoRSA)
-
- c1, c2, err := netPipe()
- if err != nil {
- t.Fatalf("netPipe: %v", err)
- }
- defer c1.Close()
- defer c2.Close()
-
- go NewServerConn(c1, serverConf)
- clientConf.HostKeyAlgorithms = []string{"nonexistent-hostkey-algo"}
- _, _, _, err = NewClientConn(c2, "", clientConf)
- if err == nil {
- t.Fatal("succeeded connecting with unknown hostkey algorithm")
- }
-}
diff --git a/vendor/golang.org/x/crypto/ssh/tcpip_test.go b/vendor/golang.org/x/crypto/ssh/tcpip_test.go
deleted file mode 100644
index f1265cb49..000000000
--- a/vendor/golang.org/x/crypto/ssh/tcpip_test.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "testing"
-)
-
-func TestAutoPortListenBroken(t *testing.T) {
- broken := "SSH-2.0-OpenSSH_5.9hh11"
- works := "SSH-2.0-OpenSSH_6.1"
- if !isBrokenOpenSSHVersion(broken) {
- t.Errorf("version %q not marked as broken", broken)
- }
- if isBrokenOpenSSHVersion(works) {
- t.Errorf("version %q marked as broken", works)
- }
-}
diff --git a/vendor/golang.org/x/crypto/ssh/terminal/terminal_test.go b/vendor/golang.org/x/crypto/ssh/terminal/terminal_test.go
deleted file mode 100644
index d9b77c1c5..000000000
--- a/vendor/golang.org/x/crypto/ssh/terminal/terminal_test.go
+++ /dev/null
@@ -1,358 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd linux,!appengine netbsd openbsd windows plan9 solaris
-
-package terminal
-
-import (
- "bytes"
- "io"
- "os"
- "runtime"
- "testing"
-)
-
-type MockTerminal struct {
- toSend []byte
- bytesPerRead int
- received []byte
-}
-
-func (c *MockTerminal) Read(data []byte) (n int, err error) {
- n = len(data)
- if n == 0 {
- return
- }
- if n > len(c.toSend) {
- n = len(c.toSend)
- }
- if n == 0 {
- return 0, io.EOF
- }
- if c.bytesPerRead > 0 && n > c.bytesPerRead {
- n = c.bytesPerRead
- }
- copy(data, c.toSend[:n])
- c.toSend = c.toSend[n:]
- return
-}
-
-func (c *MockTerminal) Write(data []byte) (n int, err error) {
- c.received = append(c.received, data...)
- return len(data), nil
-}
-
-func TestClose(t *testing.T) {
- c := &MockTerminal{}
- ss := NewTerminal(c, "> ")
- line, err := ss.ReadLine()
- if line != "" {
- t.Errorf("Expected empty line but got: %s", line)
- }
- if err != io.EOF {
- t.Errorf("Error should have been EOF but got: %s", err)
- }
-}
-
-var keyPressTests = []struct {
- in string
- line string
- err error
- throwAwayLines int
-}{
- {
- err: io.EOF,
- },
- {
- in: "\r",
- line: "",
- },
- {
- in: "foo\r",
- line: "foo",
- },
- {
- in: "a\x1b[Cb\r", // right
- line: "ab",
- },
- {
- in: "a\x1b[Db\r", // left
- line: "ba",
- },
- {
- in: "a\177b\r", // backspace
- line: "b",
- },
- {
- in: "\x1b[A\r", // up
- },
- {
- in: "\x1b[B\r", // down
- },
- {
- in: "line\x1b[A\x1b[B\r", // up then down
- line: "line",
- },
- {
- in: "line1\rline2\x1b[A\r", // recall previous line.
- line: "line1",
- throwAwayLines: 1,
- },
- {
- // recall two previous lines and append.
- in: "line1\rline2\rline3\x1b[A\x1b[Axxx\r",
- line: "line1xxx",
- throwAwayLines: 2,
- },
- {
- // Ctrl-A to move to beginning of line followed by ^K to kill
- // line.
- in: "a b \001\013\r",
- line: "",
- },
- {
- // Ctrl-A to move to beginning of line, Ctrl-E to move to end,
- // finally ^K to kill nothing.
- in: "a b \001\005\013\r",
- line: "a b ",
- },
- {
- in: "\027\r",
- line: "",
- },
- {
- in: "a\027\r",
- line: "",
- },
- {
- in: "a \027\r",
- line: "",
- },
- {
- in: "a b\027\r",
- line: "a ",
- },
- {
- in: "a b \027\r",
- line: "a ",
- },
- {
- in: "one two thr\x1b[D\027\r",
- line: "one two r",
- },
- {
- in: "\013\r",
- line: "",
- },
- {
- in: "a\013\r",
- line: "a",
- },
- {
- in: "ab\x1b[D\013\r",
- line: "a",
- },
- {
- in: "Ξεσκεπάζω\r",
- line: "Ξεσκεπάζω",
- },
- {
- in: "£\r\x1b[A\177\r", // non-ASCII char, enter, up, backspace.
- line: "",
- throwAwayLines: 1,
- },
- {
- in: "£\r££\x1b[A\x1b[B\177\r", // non-ASCII char, enter, 2x non-ASCII, up, down, backspace, enter.
- line: "£",
- throwAwayLines: 1,
- },
- {
- // Ctrl-D at the end of the line should be ignored.
- in: "a\004\r",
- line: "a",
- },
- {
- // a, b, left, Ctrl-D should erase the b.
- in: "ab\x1b[D\004\r",
- line: "a",
- },
- {
- // a, b, c, d, left, left, ^U should erase to the beginning of
- // the line.
- in: "abcd\x1b[D\x1b[D\025\r",
- line: "cd",
- },
- {
- // Bracketed paste mode: control sequences should be returned
- // verbatim in paste mode.
- in: "abc\x1b[200~de\177f\x1b[201~\177\r",
- line: "abcde\177",
- },
- {
- // Enter in bracketed paste mode should still work.
- in: "abc\x1b[200~d\refg\x1b[201~h\r",
- line: "efgh",
- throwAwayLines: 1,
- },
- {
- // Lines consisting entirely of pasted data should be indicated as such.
- in: "\x1b[200~a\r",
- line: "a",
- err: ErrPasteIndicator,
- },
-}
-
-func TestKeyPresses(t *testing.T) {
- for i, test := range keyPressTests {
- for j := 1; j < len(test.in); j++ {
- c := &MockTerminal{
- toSend: []byte(test.in),
- bytesPerRead: j,
- }
- ss := NewTerminal(c, "> ")
- for k := 0; k < test.throwAwayLines; k++ {
- _, err := ss.ReadLine()
- if err != nil {
- t.Errorf("Throwaway line %d from test %d resulted in error: %s", k, i, err)
- }
- }
- line, err := ss.ReadLine()
- if line != test.line {
- t.Errorf("Line resulting from test %d (%d bytes per read) was '%s', expected '%s'", i, j, line, test.line)
- break
- }
- if err != test.err {
- t.Errorf("Error resulting from test %d (%d bytes per read) was '%v', expected '%v'", i, j, err, test.err)
- break
- }
- }
- }
-}
-
-func TestPasswordNotSaved(t *testing.T) {
- c := &MockTerminal{
- toSend: []byte("password\r\x1b[A\r"),
- bytesPerRead: 1,
- }
- ss := NewTerminal(c, "> ")
- pw, _ := ss.ReadPassword("> ")
- if pw != "password" {
- t.Fatalf("failed to read password, got %s", pw)
- }
- line, _ := ss.ReadLine()
- if len(line) > 0 {
- t.Fatalf("password was saved in history")
- }
-}
-
-var setSizeTests = []struct {
- width, height int
-}{
- {40, 13},
- {80, 24},
- {132, 43},
-}
-
-func TestTerminalSetSize(t *testing.T) {
- for _, setSize := range setSizeTests {
- c := &MockTerminal{
- toSend: []byte("password\r\x1b[A\r"),
- bytesPerRead: 1,
- }
- ss := NewTerminal(c, "> ")
- ss.SetSize(setSize.width, setSize.height)
- pw, _ := ss.ReadPassword("Password: ")
- if pw != "password" {
- t.Fatalf("failed to read password, got %s", pw)
- }
- if string(c.received) != "Password: \r\n" {
- t.Errorf("failed to set the temporary prompt expected %q, got %q", "Password: ", c.received)
- }
- }
-}
-
-func TestReadPasswordLineEnd(t *testing.T) {
- var tests = []struct {
- input string
- want string
- }{
- {"\n", ""},
- {"\r\n", ""},
- {"test\r\n", "test"},
- {"testtesttesttes\n", "testtesttesttes"},
- {"testtesttesttes\r\n", "testtesttesttes"},
- {"testtesttesttesttest\n", "testtesttesttesttest"},
- {"testtesttesttesttest\r\n", "testtesttesttesttest"},
- }
- for _, test := range tests {
- buf := new(bytes.Buffer)
- if _, err := buf.WriteString(test.input); err != nil {
- t.Fatal(err)
- }
-
- have, err := readPasswordLine(buf)
- if err != nil {
- t.Errorf("readPasswordLine(%q) failed: %v", test.input, err)
- continue
- }
- if string(have) != test.want {
- t.Errorf("readPasswordLine(%q) returns %q, but %q is expected", test.input, string(have), test.want)
- continue
- }
-
- if _, err = buf.WriteString(test.input); err != nil {
- t.Fatal(err)
- }
- have, err = readPasswordLine(buf)
- if err != nil {
- t.Errorf("readPasswordLine(%q) failed: %v", test.input, err)
- continue
- }
- if string(have) != test.want {
- t.Errorf("readPasswordLine(%q) returns %q, but %q is expected", test.input, string(have), test.want)
- continue
- }
- }
-}
-
-func TestMakeRawState(t *testing.T) {
- fd := int(os.Stdout.Fd())
- if !IsTerminal(fd) {
- t.Skip("stdout is not a terminal; skipping test")
- }
-
- st, err := GetState(fd)
- if err != nil {
- t.Fatalf("failed to get terminal state from GetState: %s", err)
- }
-
- if runtime.GOOS == "darwin" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64") {
- t.Skip("MakeRaw not allowed on iOS; skipping test")
- }
-
- defer Restore(fd, st)
- raw, err := MakeRaw(fd)
- if err != nil {
- t.Fatalf("failed to get terminal state from MakeRaw: %s", err)
- }
-
- if *st != *raw {
- t.Errorf("states do not match; was %v, expected %v", raw, st)
- }
-}
-
-func TestOutputNewlines(t *testing.T) {
- // \n should be changed to \r\n in terminal output.
- buf := new(bytes.Buffer)
- term := NewTerminal(buf, ">")
-
- term.Write([]byte("1\n2\n"))
- output := string(buf.Bytes())
- const expected = "1\r\n2\r\n"
-
- if output != expected {
- t.Errorf("incorrect output: was %q, expected %q", output, expected)
- }
-}
diff --git a/vendor/golang.org/x/crypto/ssh/testdata_test.go b/vendor/golang.org/x/crypto/ssh/testdata_test.go
deleted file mode 100644
index 2da8c79dc..000000000
--- a/vendor/golang.org/x/crypto/ssh/testdata_test.go
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// IMPLEMENTATION NOTE: To avoid a package loop, this file is in three places:
-// ssh/, ssh/agent, and ssh/test/. It should be kept in sync across all three
-// instances.
-
-package ssh
-
-import (
- "crypto/rand"
- "fmt"
-
- "golang.org/x/crypto/ssh/testdata"
-)
-
-var (
- testPrivateKeys map[string]interface{}
- testSigners map[string]Signer
- testPublicKeys map[string]PublicKey
-)
-
-func init() {
- var err error
-
- n := len(testdata.PEMBytes)
- testPrivateKeys = make(map[string]interface{}, n)
- testSigners = make(map[string]Signer, n)
- testPublicKeys = make(map[string]PublicKey, n)
- for t, k := range testdata.PEMBytes {
- testPrivateKeys[t], err = ParseRawPrivateKey(k)
- if err != nil {
- panic(fmt.Sprintf("Unable to parse test key %s: %v", t, err))
- }
- testSigners[t], err = NewSignerFromKey(testPrivateKeys[t])
- if err != nil {
- panic(fmt.Sprintf("Unable to create signer for test key %s: %v", t, err))
- }
- testPublicKeys[t] = testSigners[t].PublicKey()
- }
-
- // Create a cert and sign it for use in tests.
- testCert := &Certificate{
- Nonce: []byte{}, // To pass reflect.DeepEqual after marshal & parse, this must be non-nil
- ValidPrincipals: []string{"gopher1", "gopher2"}, // increases test coverage
- ValidAfter: 0, // unix epoch
- ValidBefore: CertTimeInfinity, // The end of currently representable time.
- Reserved: []byte{}, // To pass reflect.DeepEqual after marshal & parse, this must be non-nil
- Key: testPublicKeys["ecdsa"],
- SignatureKey: testPublicKeys["rsa"],
- Permissions: Permissions{
- CriticalOptions: map[string]string{},
- Extensions: map[string]string{},
- },
- }
- testCert.SignCert(rand.Reader, testSigners["rsa"])
- testPrivateKeys["cert"] = testPrivateKeys["ecdsa"]
- testSigners["cert"], err = NewCertSigner(testCert, testSigners["ecdsa"])
- if err != nil {
- panic(fmt.Sprintf("Unable to create certificate signer: %v", err))
- }
-}
diff --git a/vendor/golang.org/x/crypto/ssh/transport_test.go b/vendor/golang.org/x/crypto/ssh/transport_test.go
deleted file mode 100644
index 8445e1e56..000000000
--- a/vendor/golang.org/x/crypto/ssh/transport_test.go
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "crypto/rand"
- "encoding/binary"
- "strings"
- "testing"
-)
-
-func TestReadVersion(t *testing.T) {
- longVersion := strings.Repeat("SSH-2.0-bla", 50)[:253]
- multiLineVersion := strings.Repeat("ignored\r\n", 20) + "SSH-2.0-bla\r\n"
- cases := map[string]string{
- "SSH-2.0-bla\r\n": "SSH-2.0-bla",
- "SSH-2.0-bla\n": "SSH-2.0-bla",
- multiLineVersion: "SSH-2.0-bla",
- longVersion + "\r\n": longVersion,
- }
-
- for in, want := range cases {
- result, err := readVersion(bytes.NewBufferString(in))
- if err != nil {
- t.Errorf("readVersion(%q): %s", in, err)
- }
- got := string(result)
- if got != want {
- t.Errorf("got %q, want %q", got, want)
- }
- }
-}
-
-func TestReadVersionError(t *testing.T) {
- longVersion := strings.Repeat("SSH-2.0-bla", 50)[:253]
- multiLineVersion := strings.Repeat("ignored\r\n", 50) + "SSH-2.0-bla\r\n"
- cases := []string{
- longVersion + "too-long\r\n",
- multiLineVersion,
- }
- for _, in := range cases {
- if _, err := readVersion(bytes.NewBufferString(in)); err == nil {
- t.Errorf("readVersion(%q) should have failed", in)
- }
- }
-}
-
-func TestExchangeVersionsBasic(t *testing.T) {
- v := "SSH-2.0-bla"
- buf := bytes.NewBufferString(v + "\r\n")
- them, err := exchangeVersions(buf, []byte("xyz"))
- if err != nil {
- t.Errorf("exchangeVersions: %v", err)
- }
-
- if want := "SSH-2.0-bla"; string(them) != want {
- t.Errorf("got %q want %q for our version", them, want)
- }
-}
-
-func TestExchangeVersions(t *testing.T) {
- cases := []string{
- "not\x000allowed",
- "not allowed\x01\r\n",
- }
- for _, c := range cases {
- buf := bytes.NewBufferString("SSH-2.0-bla\r\n")
- if _, err := exchangeVersions(buf, []byte(c)); err == nil {
- t.Errorf("exchangeVersions(%q): should have failed", c)
- }
- }
-}
-
-type closerBuffer struct {
- bytes.Buffer
-}
-
-func (b *closerBuffer) Close() error {
- return nil
-}
-
-func TestTransportMaxPacketWrite(t *testing.T) {
- buf := &closerBuffer{}
- tr := newTransport(buf, rand.Reader, true)
- huge := make([]byte, maxPacket+1)
- err := tr.writePacket(huge)
- if err == nil {
- t.Errorf("transport accepted write for a huge packet.")
- }
-}
-
-func TestTransportMaxPacketReader(t *testing.T) {
- var header [5]byte
- huge := make([]byte, maxPacket+128)
- binary.BigEndian.PutUint32(header[0:], uint32(len(huge)))
- // padding.
- header[4] = 0
-
- buf := &closerBuffer{}
- buf.Write(header[:])
- buf.Write(huge)
-
- tr := newTransport(buf, rand.Reader, true)
- _, err := tr.readPacket()
- if err == nil {
- t.Errorf("transport succeeded reading huge packet.")
- } else if !strings.Contains(err.Error(), "large") {
- t.Errorf("got %q, should mention %q", err.Error(), "large")
- }
-}
diff --git a/vendor/golang.org/x/net/context/context_test.go b/vendor/golang.org/x/net/context/context_test.go
deleted file mode 100644
index 62844131b..000000000
--- a/vendor/golang.org/x/net/context/context_test.go
+++ /dev/null
@@ -1,583 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !go1.7
-
-package context
-
-import (
- "fmt"
- "math/rand"
- "runtime"
- "strings"
- "sync"
- "testing"
- "time"
-)
-
-// otherContext is a Context that's not one of the types defined in context.go.
-// This lets us test code paths that differ based on the underlying type of the
-// Context.
-type otherContext struct {
- Context
-}
-
-func TestBackground(t *testing.T) {
- c := Background()
- if c == nil {
- t.Fatalf("Background returned nil")
- }
- select {
- case x := <-c.Done():
- t.Errorf("<-c.Done() == %v want nothing (it should block)", x)
- default:
- }
- if got, want := fmt.Sprint(c), "context.Background"; got != want {
- t.Errorf("Background().String() = %q want %q", got, want)
- }
-}
-
-func TestTODO(t *testing.T) {
- c := TODO()
- if c == nil {
- t.Fatalf("TODO returned nil")
- }
- select {
- case x := <-c.Done():
- t.Errorf("<-c.Done() == %v want nothing (it should block)", x)
- default:
- }
- if got, want := fmt.Sprint(c), "context.TODO"; got != want {
- t.Errorf("TODO().String() = %q want %q", got, want)
- }
-}
-
-func TestWithCancel(t *testing.T) {
- c1, cancel := WithCancel(Background())
-
- if got, want := fmt.Sprint(c1), "context.Background.WithCancel"; got != want {
- t.Errorf("c1.String() = %q want %q", got, want)
- }
-
- o := otherContext{c1}
- c2, _ := WithCancel(o)
- contexts := []Context{c1, o, c2}
-
- for i, c := range contexts {
- if d := c.Done(); d == nil {
- t.Errorf("c[%d].Done() == %v want non-nil", i, d)
- }
- if e := c.Err(); e != nil {
- t.Errorf("c[%d].Err() == %v want nil", i, e)
- }
-
- select {
- case x := <-c.Done():
- t.Errorf("<-c.Done() == %v want nothing (it should block)", x)
- default:
- }
- }
-
- cancel()
- time.Sleep(100 * time.Millisecond) // let cancelation propagate
-
- for i, c := range contexts {
- select {
- case <-c.Done():
- default:
- t.Errorf("<-c[%d].Done() blocked, but shouldn't have", i)
- }
- if e := c.Err(); e != Canceled {
- t.Errorf("c[%d].Err() == %v want %v", i, e, Canceled)
- }
- }
-}
-
-func TestParentFinishesChild(t *testing.T) {
- // Context tree:
- // parent -> cancelChild
- // parent -> valueChild -> timerChild
- parent, cancel := WithCancel(Background())
- cancelChild, stop := WithCancel(parent)
- defer stop()
- valueChild := WithValue(parent, "key", "value")
- timerChild, stop := WithTimeout(valueChild, 10000*time.Hour)
- defer stop()
-
- select {
- case x := <-parent.Done():
- t.Errorf("<-parent.Done() == %v want nothing (it should block)", x)
- case x := <-cancelChild.Done():
- t.Errorf("<-cancelChild.Done() == %v want nothing (it should block)", x)
- case x := <-timerChild.Done():
- t.Errorf("<-timerChild.Done() == %v want nothing (it should block)", x)
- case x := <-valueChild.Done():
- t.Errorf("<-valueChild.Done() == %v want nothing (it should block)", x)
- default:
- }
-
- // The parent's children should contain the two cancelable children.
- pc := parent.(*cancelCtx)
- cc := cancelChild.(*cancelCtx)
- tc := timerChild.(*timerCtx)
- pc.mu.Lock()
- if len(pc.children) != 2 || !pc.children[cc] || !pc.children[tc] {
- t.Errorf("bad linkage: pc.children = %v, want %v and %v",
- pc.children, cc, tc)
- }
- pc.mu.Unlock()
-
- if p, ok := parentCancelCtx(cc.Context); !ok || p != pc {
- t.Errorf("bad linkage: parentCancelCtx(cancelChild.Context) = %v, %v want %v, true", p, ok, pc)
- }
- if p, ok := parentCancelCtx(tc.Context); !ok || p != pc {
- t.Errorf("bad linkage: parentCancelCtx(timerChild.Context) = %v, %v want %v, true", p, ok, pc)
- }
-
- cancel()
-
- pc.mu.Lock()
- if len(pc.children) != 0 {
- t.Errorf("pc.cancel didn't clear pc.children = %v", pc.children)
- }
- pc.mu.Unlock()
-
- // parent and children should all be finished.
- check := func(ctx Context, name string) {
- select {
- case <-ctx.Done():
- default:
- t.Errorf("<-%s.Done() blocked, but shouldn't have", name)
- }
- if e := ctx.Err(); e != Canceled {
- t.Errorf("%s.Err() == %v want %v", name, e, Canceled)
- }
- }
- check(parent, "parent")
- check(cancelChild, "cancelChild")
- check(valueChild, "valueChild")
- check(timerChild, "timerChild")
-
- // WithCancel should return a canceled context on a canceled parent.
- precanceledChild := WithValue(parent, "key", "value")
- select {
- case <-precanceledChild.Done():
- default:
- t.Errorf("<-precanceledChild.Done() blocked, but shouldn't have")
- }
- if e := precanceledChild.Err(); e != Canceled {
- t.Errorf("precanceledChild.Err() == %v want %v", e, Canceled)
- }
-}
-
-func TestChildFinishesFirst(t *testing.T) {
- cancelable, stop := WithCancel(Background())
- defer stop()
- for _, parent := range []Context{Background(), cancelable} {
- child, cancel := WithCancel(parent)
-
- select {
- case x := <-parent.Done():
- t.Errorf("<-parent.Done() == %v want nothing (it should block)", x)
- case x := <-child.Done():
- t.Errorf("<-child.Done() == %v want nothing (it should block)", x)
- default:
- }
-
- cc := child.(*cancelCtx)
- pc, pcok := parent.(*cancelCtx) // pcok == false when parent == Background()
- if p, ok := parentCancelCtx(cc.Context); ok != pcok || (ok && pc != p) {
- t.Errorf("bad linkage: parentCancelCtx(cc.Context) = %v, %v want %v, %v", p, ok, pc, pcok)
- }
-
- if pcok {
- pc.mu.Lock()
- if len(pc.children) != 1 || !pc.children[cc] {
- t.Errorf("bad linkage: pc.children = %v, cc = %v", pc.children, cc)
- }
- pc.mu.Unlock()
- }
-
- cancel()
-
- if pcok {
- pc.mu.Lock()
- if len(pc.children) != 0 {
- t.Errorf("child's cancel didn't remove self from pc.children = %v", pc.children)
- }
- pc.mu.Unlock()
- }
-
- // child should be finished.
- select {
- case <-child.Done():
- default:
- t.Errorf("<-child.Done() blocked, but shouldn't have")
- }
- if e := child.Err(); e != Canceled {
- t.Errorf("child.Err() == %v want %v", e, Canceled)
- }
-
- // parent should not be finished.
- select {
- case x := <-parent.Done():
- t.Errorf("<-parent.Done() == %v want nothing (it should block)", x)
- default:
- }
- if e := parent.Err(); e != nil {
- t.Errorf("parent.Err() == %v want nil", e)
- }
- }
-}
-
-func testDeadline(c Context, wait time.Duration, t *testing.T) {
- select {
- case <-time.After(wait):
- t.Fatalf("context should have timed out")
- case <-c.Done():
- }
- if e := c.Err(); e != DeadlineExceeded {
- t.Errorf("c.Err() == %v want %v", e, DeadlineExceeded)
- }
-}
-
-func TestDeadline(t *testing.T) {
- t.Parallel()
- const timeUnit = 500 * time.Millisecond
- c, _ := WithDeadline(Background(), time.Now().Add(1*timeUnit))
- if got, prefix := fmt.Sprint(c), "context.Background.WithDeadline("; !strings.HasPrefix(got, prefix) {
- t.Errorf("c.String() = %q want prefix %q", got, prefix)
- }
- testDeadline(c, 2*timeUnit, t)
-
- c, _ = WithDeadline(Background(), time.Now().Add(1*timeUnit))
- o := otherContext{c}
- testDeadline(o, 2*timeUnit, t)
-
- c, _ = WithDeadline(Background(), time.Now().Add(1*timeUnit))
- o = otherContext{c}
- c, _ = WithDeadline(o, time.Now().Add(3*timeUnit))
- testDeadline(c, 2*timeUnit, t)
-}
-
-func TestTimeout(t *testing.T) {
- t.Parallel()
- const timeUnit = 500 * time.Millisecond
- c, _ := WithTimeout(Background(), 1*timeUnit)
- if got, prefix := fmt.Sprint(c), "context.Background.WithDeadline("; !strings.HasPrefix(got, prefix) {
- t.Errorf("c.String() = %q want prefix %q", got, prefix)
- }
- testDeadline(c, 2*timeUnit, t)
-
- c, _ = WithTimeout(Background(), 1*timeUnit)
- o := otherContext{c}
- testDeadline(o, 2*timeUnit, t)
-
- c, _ = WithTimeout(Background(), 1*timeUnit)
- o = otherContext{c}
- c, _ = WithTimeout(o, 3*timeUnit)
- testDeadline(c, 2*timeUnit, t)
-}
-
-func TestCanceledTimeout(t *testing.T) {
- t.Parallel()
- const timeUnit = 500 * time.Millisecond
- c, _ := WithTimeout(Background(), 2*timeUnit)
- o := otherContext{c}
- c, cancel := WithTimeout(o, 4*timeUnit)
- cancel()
- time.Sleep(1 * timeUnit) // let cancelation propagate
- select {
- case <-c.Done():
- default:
- t.Errorf("<-c.Done() blocked, but shouldn't have")
- }
- if e := c.Err(); e != Canceled {
- t.Errorf("c.Err() == %v want %v", e, Canceled)
- }
-}
-
-type key1 int
-type key2 int
-
-var k1 = key1(1)
-var k2 = key2(1) // same int as k1, different type
-var k3 = key2(3) // same type as k2, different int
-
-func TestValues(t *testing.T) {
- check := func(c Context, nm, v1, v2, v3 string) {
- if v, ok := c.Value(k1).(string); ok == (len(v1) == 0) || v != v1 {
- t.Errorf(`%s.Value(k1).(string) = %q, %t want %q, %t`, nm, v, ok, v1, len(v1) != 0)
- }
- if v, ok := c.Value(k2).(string); ok == (len(v2) == 0) || v != v2 {
- t.Errorf(`%s.Value(k2).(string) = %q, %t want %q, %t`, nm, v, ok, v2, len(v2) != 0)
- }
- if v, ok := c.Value(k3).(string); ok == (len(v3) == 0) || v != v3 {
- t.Errorf(`%s.Value(k3).(string) = %q, %t want %q, %t`, nm, v, ok, v3, len(v3) != 0)
- }
- }
-
- c0 := Background()
- check(c0, "c0", "", "", "")
-
- c1 := WithValue(Background(), k1, "c1k1")
- check(c1, "c1", "c1k1", "", "")
-
- if got, want := fmt.Sprint(c1), `context.Background.WithValue(1, "c1k1")`; got != want {
- t.Errorf("c.String() = %q want %q", got, want)
- }
-
- c2 := WithValue(c1, k2, "c2k2")
- check(c2, "c2", "c1k1", "c2k2", "")
-
- c3 := WithValue(c2, k3, "c3k3")
- check(c3, "c2", "c1k1", "c2k2", "c3k3")
-
- c4 := WithValue(c3, k1, nil)
- check(c4, "c4", "", "c2k2", "c3k3")
-
- o0 := otherContext{Background()}
- check(o0, "o0", "", "", "")
-
- o1 := otherContext{WithValue(Background(), k1, "c1k1")}
- check(o1, "o1", "c1k1", "", "")
-
- o2 := WithValue(o1, k2, "o2k2")
- check(o2, "o2", "c1k1", "o2k2", "")
-
- o3 := otherContext{c4}
- check(o3, "o3", "", "c2k2", "c3k3")
-
- o4 := WithValue(o3, k3, nil)
- check(o4, "o4", "", "c2k2", "")
-}
-
-func TestAllocs(t *testing.T) {
- bg := Background()
- for _, test := range []struct {
- desc string
- f func()
- limit float64
- gccgoLimit float64
- }{
- {
- desc: "Background()",
- f: func() { Background() },
- limit: 0,
- gccgoLimit: 0,
- },
- {
- desc: fmt.Sprintf("WithValue(bg, %v, nil)", k1),
- f: func() {
- c := WithValue(bg, k1, nil)
- c.Value(k1)
- },
- limit: 3,
- gccgoLimit: 3,
- },
- {
- desc: "WithTimeout(bg, 15*time.Millisecond)",
- f: func() {
- c, _ := WithTimeout(bg, 15*time.Millisecond)
- <-c.Done()
- },
- limit: 8,
- gccgoLimit: 16,
- },
- {
- desc: "WithCancel(bg)",
- f: func() {
- c, cancel := WithCancel(bg)
- cancel()
- <-c.Done()
- },
- limit: 5,
- gccgoLimit: 8,
- },
- {
- desc: "WithTimeout(bg, 100*time.Millisecond)",
- f: func() {
- c, cancel := WithTimeout(bg, 100*time.Millisecond)
- cancel()
- <-c.Done()
- },
- limit: 8,
- gccgoLimit: 25,
- },
- } {
- limit := test.limit
- if runtime.Compiler == "gccgo" {
- // gccgo does not yet do escape analysis.
- // TODO(iant): Remove this when gccgo does do escape analysis.
- limit = test.gccgoLimit
- }
- if n := testing.AllocsPerRun(100, test.f); n > limit {
- t.Errorf("%s allocs = %f want %d", test.desc, n, int(limit))
- }
- }
-}
-
-func TestSimultaneousCancels(t *testing.T) {
- root, cancel := WithCancel(Background())
- m := map[Context]CancelFunc{root: cancel}
- q := []Context{root}
- // Create a tree of contexts.
- for len(q) != 0 && len(m) < 100 {
- parent := q[0]
- q = q[1:]
- for i := 0; i < 4; i++ {
- ctx, cancel := WithCancel(parent)
- m[ctx] = cancel
- q = append(q, ctx)
- }
- }
- // Start all the cancels in a random order.
- var wg sync.WaitGroup
- wg.Add(len(m))
- for _, cancel := range m {
- go func(cancel CancelFunc) {
- cancel()
- wg.Done()
- }(cancel)
- }
- // Wait on all the contexts in a random order.
- for ctx := range m {
- select {
- case <-ctx.Done():
- case <-time.After(1 * time.Second):
- buf := make([]byte, 10<<10)
- n := runtime.Stack(buf, true)
- t.Fatalf("timed out waiting for <-ctx.Done(); stacks:\n%s", buf[:n])
- }
- }
- // Wait for all the cancel functions to return.
- done := make(chan struct{})
- go func() {
- wg.Wait()
- close(done)
- }()
- select {
- case <-done:
- case <-time.After(1 * time.Second):
- buf := make([]byte, 10<<10)
- n := runtime.Stack(buf, true)
- t.Fatalf("timed out waiting for cancel functions; stacks:\n%s", buf[:n])
- }
-}
-
-func TestInterlockedCancels(t *testing.T) {
- parent, cancelParent := WithCancel(Background())
- child, cancelChild := WithCancel(parent)
- go func() {
- parent.Done()
- cancelChild()
- }()
- cancelParent()
- select {
- case <-child.Done():
- case <-time.After(1 * time.Second):
- buf := make([]byte, 10<<10)
- n := runtime.Stack(buf, true)
- t.Fatalf("timed out waiting for child.Done(); stacks:\n%s", buf[:n])
- }
-}
-
-func TestLayersCancel(t *testing.T) {
- testLayers(t, time.Now().UnixNano(), false)
-}
-
-func TestLayersTimeout(t *testing.T) {
- testLayers(t, time.Now().UnixNano(), true)
-}
-
-func testLayers(t *testing.T, seed int64, testTimeout bool) {
- rand.Seed(seed)
- errorf := func(format string, a ...interface{}) {
- t.Errorf(fmt.Sprintf("seed=%d: %s", seed, format), a...)
- }
- const (
- timeout = 200 * time.Millisecond
- minLayers = 30
- )
- type value int
- var (
- vals []*value
- cancels []CancelFunc
- numTimers int
- ctx = Background()
- )
- for i := 0; i < minLayers || numTimers == 0 || len(cancels) == 0 || len(vals) == 0; i++ {
- switch rand.Intn(3) {
- case 0:
- v := new(value)
- ctx = WithValue(ctx, v, v)
- vals = append(vals, v)
- case 1:
- var cancel CancelFunc
- ctx, cancel = WithCancel(ctx)
- cancels = append(cancels, cancel)
- case 2:
- var cancel CancelFunc
- ctx, cancel = WithTimeout(ctx, timeout)
- cancels = append(cancels, cancel)
- numTimers++
- }
- }
- checkValues := func(when string) {
- for _, key := range vals {
- if val := ctx.Value(key).(*value); key != val {
- errorf("%s: ctx.Value(%p) = %p want %p", when, key, val, key)
- }
- }
- }
- select {
- case <-ctx.Done():
- errorf("ctx should not be canceled yet")
- default:
- }
- if s, prefix := fmt.Sprint(ctx), "context.Background."; !strings.HasPrefix(s, prefix) {
- t.Errorf("ctx.String() = %q want prefix %q", s, prefix)
- }
- t.Log(ctx)
- checkValues("before cancel")
- if testTimeout {
- select {
- case <-ctx.Done():
- case <-time.After(timeout + 100*time.Millisecond):
- errorf("ctx should have timed out")
- }
- checkValues("after timeout")
- } else {
- cancel := cancels[rand.Intn(len(cancels))]
- cancel()
- select {
- case <-ctx.Done():
- default:
- errorf("ctx should be canceled")
- }
- checkValues("after cancel")
- }
-}
-
-func TestCancelRemoves(t *testing.T) {
- checkChildren := func(when string, ctx Context, want int) {
- if got := len(ctx.(*cancelCtx).children); got != want {
- t.Errorf("%s: context has %d children, want %d", when, got, want)
- }
- }
-
- ctx, _ := WithCancel(Background())
- checkChildren("after creation", ctx, 0)
- _, cancel := WithCancel(ctx)
- checkChildren("with WithCancel child ", ctx, 1)
- cancel()
- checkChildren("after cancelling WithCancel child", ctx, 0)
-
- ctx, _ = WithCancel(Background())
- checkChildren("after creation", ctx, 0)
- _, cancel = WithTimeout(ctx, 60*time.Minute)
- checkChildren("with WithTimeout child ", ctx, 1)
- cancel()
- checkChildren("after cancelling WithTimeout child", ctx, 0)
-}
diff --git a/vendor/golang.org/x/net/context/withtimeout_test.go b/vendor/golang.org/x/net/context/withtimeout_test.go
deleted file mode 100644
index e6f56691d..000000000
--- a/vendor/golang.org/x/net/context/withtimeout_test.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package context_test
-
-import (
- "fmt"
- "time"
-
- "golang.org/x/net/context"
-)
-
-// This example passes a context with a timeout to tell a blocking function that
-// it should abandon its work after the timeout elapses.
-func ExampleWithTimeout() {
- // Pass a context with a timeout to tell a blocking function that it
- // should abandon its work after the timeout elapses.
- ctx, cancel := context.WithTimeout(context.Background(), 50*time.Millisecond)
- defer cancel()
-
- select {
- case <-time.After(1 * time.Second):
- fmt.Println("overslept")
- case <-ctx.Done():
- fmt.Println(ctx.Err()) // prints "context deadline exceeded"
- }
-
- // Output:
- // context deadline exceeded
-}
diff --git a/vendor/golang.org/x/net/http/httpguts/httplex_test.go b/vendor/golang.org/x/net/http/httpguts/httplex_test.go
deleted file mode 100644
index a2c57f392..000000000
--- a/vendor/golang.org/x/net/http/httpguts/httplex_test.go
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package httpguts
-
-import (
- "testing"
-)
-
-func isChar(c rune) bool { return c <= 127 }
-
-func isCtl(c rune) bool { return c <= 31 || c == 127 }
-
-func isSeparator(c rune) bool {
- switch c {
- case '(', ')', '<', '>', '@', ',', ';', ':', '\\', '"', '/', '[', ']', '?', '=', '{', '}', ' ', '\t':
- return true
- }
- return false
-}
-
-func TestIsToken(t *testing.T) {
- for i := 0; i <= 130; i++ {
- r := rune(i)
- expected := isChar(r) && !isCtl(r) && !isSeparator(r)
- if IsTokenRune(r) != expected {
- t.Errorf("isToken(0x%x) = %v", r, !expected)
- }
- }
-}
-
-func TestHeaderValuesContainsToken(t *testing.T) {
- tests := []struct {
- vals []string
- token string
- want bool
- }{
- {
- vals: []string{"foo"},
- token: "foo",
- want: true,
- },
- {
- vals: []string{"bar", "foo"},
- token: "foo",
- want: true,
- },
- {
- vals: []string{"foo"},
- token: "FOO",
- want: true,
- },
- {
- vals: []string{"foo"},
- token: "bar",
- want: false,
- },
- {
- vals: []string{" foo "},
- token: "FOO",
- want: true,
- },
- {
- vals: []string{"foo,bar"},
- token: "FOO",
- want: true,
- },
- {
- vals: []string{"bar,foo,bar"},
- token: "FOO",
- want: true,
- },
- {
- vals: []string{"bar , foo"},
- token: "FOO",
- want: true,
- },
- {
- vals: []string{"foo ,bar "},
- token: "FOO",
- want: true,
- },
- {
- vals: []string{"bar, foo ,bar"},
- token: "FOO",
- want: true,
- },
- {
- vals: []string{"bar , foo"},
- token: "FOO",
- want: true,
- },
- }
- for _, tt := range tests {
- got := HeaderValuesContainsToken(tt.vals, tt.token)
- if got != tt.want {
- t.Errorf("headerValuesContainsToken(%q, %q) = %v; want %v", tt.vals, tt.token, got, tt.want)
- }
- }
-}
-
-func TestPunycodeHostPort(t *testing.T) {
- tests := []struct {
- in, want string
- }{
- {"www.google.com", "www.google.com"},
- {"гофер.рф", "xn--c1ae0ajs.xn--p1ai"},
- {"bücher.de", "xn--bcher-kva.de"},
- {"bücher.de:8080", "xn--bcher-kva.de:8080"},
- {"[1::6]:8080", "[1::6]:8080"},
- }
- for _, tt := range tests {
- got, err := PunycodeHostPort(tt.in)
- if tt.want != got || err != nil {
- t.Errorf("PunycodeHostPort(%q) = %q, %v, want %q, nil", tt.in, got, err, tt.want)
- }
- }
-}
diff --git a/vendor/golang.org/x/net/http2/ciphers_test.go b/vendor/golang.org/x/net/http2/ciphers_test.go
deleted file mode 100644
index 764bbc8c8..000000000
--- a/vendor/golang.org/x/net/http2/ciphers_test.go
+++ /dev/null
@@ -1,309 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package http2
-
-import "testing"
-
-func TestIsBadCipherBad(t *testing.T) {
- for _, c := range badCiphers {
- if !isBadCipher(c) {
- t.Errorf("Wrong result for isBadCipher(%d), want true", c)
- }
- }
-}
-
-// verify we don't give false positives on ciphers not on blacklist
-func TestIsBadCipherGood(t *testing.T) {
- goodCiphers := map[uint16]string{
- cipher_TLS_DHE_RSA_WITH_AES_256_CCM: "cipher_TLS_DHE_RSA_WITH_AES_256_CCM",
- cipher_TLS_ECDHE_ECDSA_WITH_AES_128_CCM: "cipher_TLS_ECDHE_ECDSA_WITH_AES_128_CCM",
- cipher_TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256: "cipher_TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256",
- }
- for c, name := range goodCiphers {
- if isBadCipher(c) {
- t.Errorf("Wrong result for isBadCipher(%d) %s, want false", c, name)
- }
- }
-}
-
-// copied from https://http2.github.io/http2-spec/#BadCipherSuites,
-var badCiphers = []uint16{
- cipher_TLS_NULL_WITH_NULL_NULL,
- cipher_TLS_RSA_WITH_NULL_MD5,
- cipher_TLS_RSA_WITH_NULL_SHA,
- cipher_TLS_RSA_EXPORT_WITH_RC4_40_MD5,
- cipher_TLS_RSA_WITH_RC4_128_MD5,
- cipher_TLS_RSA_WITH_RC4_128_SHA,
- cipher_TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5,
- cipher_TLS_RSA_WITH_IDEA_CBC_SHA,
- cipher_TLS_RSA_EXPORT_WITH_DES40_CBC_SHA,
- cipher_TLS_RSA_WITH_DES_CBC_SHA,
- cipher_TLS_RSA_WITH_3DES_EDE_CBC_SHA,
- cipher_TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA,
- cipher_TLS_DH_DSS_WITH_DES_CBC_SHA,
- cipher_TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA,
- cipher_TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA,
- cipher_TLS_DH_RSA_WITH_DES_CBC_SHA,
- cipher_TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA,
- cipher_TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA,
- cipher_TLS_DHE_DSS_WITH_DES_CBC_SHA,
- cipher_TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA,
- cipher_TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA,
- cipher_TLS_DHE_RSA_WITH_DES_CBC_SHA,
- cipher_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA,
- cipher_TLS_DH_anon_EXPORT_WITH_RC4_40_MD5,
- cipher_TLS_DH_anon_WITH_RC4_128_MD5,
- cipher_TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA,
- cipher_TLS_DH_anon_WITH_DES_CBC_SHA,
- cipher_TLS_DH_anon_WITH_3DES_EDE_CBC_SHA,
- cipher_TLS_KRB5_WITH_DES_CBC_SHA,
- cipher_TLS_KRB5_WITH_3DES_EDE_CBC_SHA,
- cipher_TLS_KRB5_WITH_RC4_128_SHA,
- cipher_TLS_KRB5_WITH_IDEA_CBC_SHA,
- cipher_TLS_KRB5_WITH_DES_CBC_MD5,
- cipher_TLS_KRB5_WITH_3DES_EDE_CBC_MD5,
- cipher_TLS_KRB5_WITH_RC4_128_MD5,
- cipher_TLS_KRB5_WITH_IDEA_CBC_MD5,
- cipher_TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA,
- cipher_TLS_KRB5_EXPORT_WITH_RC2_CBC_40_SHA,
- cipher_TLS_KRB5_EXPORT_WITH_RC4_40_SHA,
- cipher_TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5,
- cipher_TLS_KRB5_EXPORT_WITH_RC2_CBC_40_MD5,
- cipher_TLS_KRB5_EXPORT_WITH_RC4_40_MD5,
- cipher_TLS_PSK_WITH_NULL_SHA,
- cipher_TLS_DHE_PSK_WITH_NULL_SHA,
- cipher_TLS_RSA_PSK_WITH_NULL_SHA,
- cipher_TLS_RSA_WITH_AES_128_CBC_SHA,
- cipher_TLS_DH_DSS_WITH_AES_128_CBC_SHA,
- cipher_TLS_DH_RSA_WITH_AES_128_CBC_SHA,
- cipher_TLS_DHE_DSS_WITH_AES_128_CBC_SHA,
- cipher_TLS_DHE_RSA_WITH_AES_128_CBC_SHA,
- cipher_TLS_DH_anon_WITH_AES_128_CBC_SHA,
- cipher_TLS_RSA_WITH_AES_256_CBC_SHA,
- cipher_TLS_DH_DSS_WITH_AES_256_CBC_SHA,
- cipher_TLS_DH_RSA_WITH_AES_256_CBC_SHA,
- cipher_TLS_DHE_DSS_WITH_AES_256_CBC_SHA,
- cipher_TLS_DHE_RSA_WITH_AES_256_CBC_SHA,
- cipher_TLS_DH_anon_WITH_AES_256_CBC_SHA,
- cipher_TLS_RSA_WITH_NULL_SHA256,
- cipher_TLS_RSA_WITH_AES_128_CBC_SHA256,
- cipher_TLS_RSA_WITH_AES_256_CBC_SHA256,
- cipher_TLS_DH_DSS_WITH_AES_128_CBC_SHA256,
- cipher_TLS_DH_RSA_WITH_AES_128_CBC_SHA256,
- cipher_TLS_DHE_DSS_WITH_AES_128_CBC_SHA256,
- cipher_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA,
- cipher_TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA,
- cipher_TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA,
- cipher_TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA,
- cipher_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA,
- cipher_TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA,
- cipher_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,
- cipher_TLS_DH_DSS_WITH_AES_256_CBC_SHA256,
- cipher_TLS_DH_RSA_WITH_AES_256_CBC_SHA256,
- cipher_TLS_DHE_DSS_WITH_AES_256_CBC_SHA256,
- cipher_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256,
- cipher_TLS_DH_anon_WITH_AES_128_CBC_SHA256,
- cipher_TLS_DH_anon_WITH_AES_256_CBC_SHA256,
- cipher_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA,
- cipher_TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA,
- cipher_TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA,
- cipher_TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA,
- cipher_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA,
- cipher_TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA,
- cipher_TLS_PSK_WITH_RC4_128_SHA,
- cipher_TLS_PSK_WITH_3DES_EDE_CBC_SHA,
- cipher_TLS_PSK_WITH_AES_128_CBC_SHA,
- cipher_TLS_PSK_WITH_AES_256_CBC_SHA,
- cipher_TLS_DHE_PSK_WITH_RC4_128_SHA,
- cipher_TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA,
- cipher_TLS_DHE_PSK_WITH_AES_128_CBC_SHA,
- cipher_TLS_DHE_PSK_WITH_AES_256_CBC_SHA,
- cipher_TLS_RSA_PSK_WITH_RC4_128_SHA,
- cipher_TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA,
- cipher_TLS_RSA_PSK_WITH_AES_128_CBC_SHA,
- cipher_TLS_RSA_PSK_WITH_AES_256_CBC_SHA,
- cipher_TLS_RSA_WITH_SEED_CBC_SHA,
- cipher_TLS_DH_DSS_WITH_SEED_CBC_SHA,
- cipher_TLS_DH_RSA_WITH_SEED_CBC_SHA,
- cipher_TLS_DHE_DSS_WITH_SEED_CBC_SHA,
- cipher_TLS_DHE_RSA_WITH_SEED_CBC_SHA,
- cipher_TLS_DH_anon_WITH_SEED_CBC_SHA,
- cipher_TLS_RSA_WITH_AES_128_GCM_SHA256,
- cipher_TLS_RSA_WITH_AES_256_GCM_SHA384,
- cipher_TLS_DH_RSA_WITH_AES_128_GCM_SHA256,
- cipher_TLS_DH_RSA_WITH_AES_256_GCM_SHA384,
- cipher_TLS_DH_DSS_WITH_AES_128_GCM_SHA256,
- cipher_TLS_DH_DSS_WITH_AES_256_GCM_SHA384,
- cipher_TLS_DH_anon_WITH_AES_128_GCM_SHA256,
- cipher_TLS_DH_anon_WITH_AES_256_GCM_SHA384,
- cipher_TLS_PSK_WITH_AES_128_GCM_SHA256,
- cipher_TLS_PSK_WITH_AES_256_GCM_SHA384,
- cipher_TLS_RSA_PSK_WITH_AES_128_GCM_SHA256,
- cipher_TLS_RSA_PSK_WITH_AES_256_GCM_SHA384,
- cipher_TLS_PSK_WITH_AES_128_CBC_SHA256,
- cipher_TLS_PSK_WITH_AES_256_CBC_SHA384,
- cipher_TLS_PSK_WITH_NULL_SHA256,
- cipher_TLS_PSK_WITH_NULL_SHA384,
- cipher_TLS_DHE_PSK_WITH_AES_128_CBC_SHA256,
- cipher_TLS_DHE_PSK_WITH_AES_256_CBC_SHA384,
- cipher_TLS_DHE_PSK_WITH_NULL_SHA256,
- cipher_TLS_DHE_PSK_WITH_NULL_SHA384,
- cipher_TLS_RSA_PSK_WITH_AES_128_CBC_SHA256,
- cipher_TLS_RSA_PSK_WITH_AES_256_CBC_SHA384,
- cipher_TLS_RSA_PSK_WITH_NULL_SHA256,
- cipher_TLS_RSA_PSK_WITH_NULL_SHA384,
- cipher_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256,
- cipher_TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256,
- cipher_TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256,
- cipher_TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256,
- cipher_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256,
- cipher_TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA256,
- cipher_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256,
- cipher_TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256,
- cipher_TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256,
- cipher_TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256,
- cipher_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256,
- cipher_TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA256,
- cipher_TLS_EMPTY_RENEGOTIATION_INFO_SCSV,
- cipher_TLS_ECDH_ECDSA_WITH_NULL_SHA,
- cipher_TLS_ECDH_ECDSA_WITH_RC4_128_SHA,
- cipher_TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA,
- cipher_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA,
- cipher_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA,
- cipher_TLS_ECDHE_ECDSA_WITH_NULL_SHA,
- cipher_TLS_ECDHE_ECDSA_WITH_RC4_128_SHA,
- cipher_TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA,
- cipher_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
- cipher_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
- cipher_TLS_ECDH_RSA_WITH_NULL_SHA,
- cipher_TLS_ECDH_RSA_WITH_RC4_128_SHA,
- cipher_TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA,
- cipher_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA,
- cipher_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA,
- cipher_TLS_ECDHE_RSA_WITH_NULL_SHA,
- cipher_TLS_ECDHE_RSA_WITH_RC4_128_SHA,
- cipher_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,
- cipher_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
- cipher_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
- cipher_TLS_ECDH_anon_WITH_NULL_SHA,
- cipher_TLS_ECDH_anon_WITH_RC4_128_SHA,
- cipher_TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA,
- cipher_TLS_ECDH_anon_WITH_AES_128_CBC_SHA,
- cipher_TLS_ECDH_anon_WITH_AES_256_CBC_SHA,
- cipher_TLS_SRP_SHA_WITH_3DES_EDE_CBC_SHA,
- cipher_TLS_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA,
- cipher_TLS_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA,
- cipher_TLS_SRP_SHA_WITH_AES_128_CBC_SHA,
- cipher_TLS_SRP_SHA_RSA_WITH_AES_128_CBC_SHA,
- cipher_TLS_SRP_SHA_DSS_WITH_AES_128_CBC_SHA,
- cipher_TLS_SRP_SHA_WITH_AES_256_CBC_SHA,
- cipher_TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA,
- cipher_TLS_SRP_SHA_DSS_WITH_AES_256_CBC_SHA,
- cipher_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,
- cipher_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,
- cipher_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256,
- cipher_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384,
- cipher_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,
- cipher_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,
- cipher_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256,
- cipher_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384,
- cipher_TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256,
- cipher_TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384,
- cipher_TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256,
- cipher_TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384,
- cipher_TLS_ECDHE_PSK_WITH_RC4_128_SHA,
- cipher_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA,
- cipher_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA,
- cipher_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA,
- cipher_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256,
- cipher_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384,
- cipher_TLS_ECDHE_PSK_WITH_NULL_SHA,
- cipher_TLS_ECDHE_PSK_WITH_NULL_SHA256,
- cipher_TLS_ECDHE_PSK_WITH_NULL_SHA384,
- cipher_TLS_RSA_WITH_ARIA_128_CBC_SHA256,
- cipher_TLS_RSA_WITH_ARIA_256_CBC_SHA384,
- cipher_TLS_DH_DSS_WITH_ARIA_128_CBC_SHA256,
- cipher_TLS_DH_DSS_WITH_ARIA_256_CBC_SHA384,
- cipher_TLS_DH_RSA_WITH_ARIA_128_CBC_SHA256,
- cipher_TLS_DH_RSA_WITH_ARIA_256_CBC_SHA384,
- cipher_TLS_DHE_DSS_WITH_ARIA_128_CBC_SHA256,
- cipher_TLS_DHE_DSS_WITH_ARIA_256_CBC_SHA384,
- cipher_TLS_DHE_RSA_WITH_ARIA_128_CBC_SHA256,
- cipher_TLS_DHE_RSA_WITH_ARIA_256_CBC_SHA384,
- cipher_TLS_DH_anon_WITH_ARIA_128_CBC_SHA256,
- cipher_TLS_DH_anon_WITH_ARIA_256_CBC_SHA384,
- cipher_TLS_ECDHE_ECDSA_WITH_ARIA_128_CBC_SHA256,
- cipher_TLS_ECDHE_ECDSA_WITH_ARIA_256_CBC_SHA384,
- cipher_TLS_ECDH_ECDSA_WITH_ARIA_128_CBC_SHA256,
- cipher_TLS_ECDH_ECDSA_WITH_ARIA_256_CBC_SHA384,
- cipher_TLS_ECDHE_RSA_WITH_ARIA_128_CBC_SHA256,
- cipher_TLS_ECDHE_RSA_WITH_ARIA_256_CBC_SHA384,
- cipher_TLS_ECDH_RSA_WITH_ARIA_128_CBC_SHA256,
- cipher_TLS_ECDH_RSA_WITH_ARIA_256_CBC_SHA384,
- cipher_TLS_RSA_WITH_ARIA_128_GCM_SHA256,
- cipher_TLS_RSA_WITH_ARIA_256_GCM_SHA384,
- cipher_TLS_DH_RSA_WITH_ARIA_128_GCM_SHA256,
- cipher_TLS_DH_RSA_WITH_ARIA_256_GCM_SHA384,
- cipher_TLS_DH_DSS_WITH_ARIA_128_GCM_SHA256,
- cipher_TLS_DH_DSS_WITH_ARIA_256_GCM_SHA384,
- cipher_TLS_DH_anon_WITH_ARIA_128_GCM_SHA256,
- cipher_TLS_DH_anon_WITH_ARIA_256_GCM_SHA384,
- cipher_TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256,
- cipher_TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384,
- cipher_TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256,
- cipher_TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384,
- cipher_TLS_PSK_WITH_ARIA_128_CBC_SHA256,
- cipher_TLS_PSK_WITH_ARIA_256_CBC_SHA384,
- cipher_TLS_DHE_PSK_WITH_ARIA_128_CBC_SHA256,
- cipher_TLS_DHE_PSK_WITH_ARIA_256_CBC_SHA384,
- cipher_TLS_RSA_PSK_WITH_ARIA_128_CBC_SHA256,
- cipher_TLS_RSA_PSK_WITH_ARIA_256_CBC_SHA384,
- cipher_TLS_PSK_WITH_ARIA_128_GCM_SHA256,
- cipher_TLS_PSK_WITH_ARIA_256_GCM_SHA384,
- cipher_TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256,
- cipher_TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384,
- cipher_TLS_ECDHE_PSK_WITH_ARIA_128_CBC_SHA256,
- cipher_TLS_ECDHE_PSK_WITH_ARIA_256_CBC_SHA384,
- cipher_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256,
- cipher_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384,
- cipher_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256,
- cipher_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384,
- cipher_TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256,
- cipher_TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384,
- cipher_TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256,
- cipher_TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384,
- cipher_TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256,
- cipher_TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384,
- cipher_TLS_DH_RSA_WITH_CAMELLIA_128_GCM_SHA256,
- cipher_TLS_DH_RSA_WITH_CAMELLIA_256_GCM_SHA384,
- cipher_TLS_DH_DSS_WITH_CAMELLIA_128_GCM_SHA256,
- cipher_TLS_DH_DSS_WITH_CAMELLIA_256_GCM_SHA384,
- cipher_TLS_DH_anon_WITH_CAMELLIA_128_GCM_SHA256,
- cipher_TLS_DH_anon_WITH_CAMELLIA_256_GCM_SHA384,
- cipher_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256,
- cipher_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384,
- cipher_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256,
- cipher_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384,
- cipher_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256,
- cipher_TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384,
- cipher_TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256,
- cipher_TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384,
- cipher_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256,
- cipher_TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384,
- cipher_TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256,
- cipher_TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384,
- cipher_TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256,
- cipher_TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384,
- cipher_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256,
- cipher_TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384,
- cipher_TLS_RSA_WITH_AES_128_CCM,
- cipher_TLS_RSA_WITH_AES_256_CCM,
- cipher_TLS_RSA_WITH_AES_128_CCM_8,
- cipher_TLS_RSA_WITH_AES_256_CCM_8,
- cipher_TLS_PSK_WITH_AES_128_CCM,
- cipher_TLS_PSK_WITH_AES_256_CCM,
- cipher_TLS_PSK_WITH_AES_128_CCM_8,
- cipher_TLS_PSK_WITH_AES_256_CCM_8,
-}
diff --git a/vendor/golang.org/x/net/http2/databuffer_test.go b/vendor/golang.org/x/net/http2/databuffer_test.go
deleted file mode 100644
index 028e12e52..000000000
--- a/vendor/golang.org/x/net/http2/databuffer_test.go
+++ /dev/null
@@ -1,157 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.7
-
-package http2
-
-import (
- "bytes"
- "fmt"
- "reflect"
- "testing"
-)
-
-func fmtDataChunk(chunk []byte) string {
- out := ""
- var last byte
- var count int
- for _, c := range chunk {
- if c != last {
- if count > 0 {
- out += fmt.Sprintf(" x %d ", count)
- count = 0
- }
- out += string([]byte{c})
- last = c
- }
- count++
- }
- if count > 0 {
- out += fmt.Sprintf(" x %d", count)
- }
- return out
-}
-
-func fmtDataChunks(chunks [][]byte) string {
- var out string
- for _, chunk := range chunks {
- out += fmt.Sprintf("{%q}", fmtDataChunk(chunk))
- }
- return out
-}
-
-func testDataBuffer(t *testing.T, wantBytes []byte, setup func(t *testing.T) *dataBuffer) {
- // Run setup, then read the remaining bytes from the dataBuffer and check
- // that they match wantBytes. We use different read sizes to check corner
- // cases in Read.
- for _, readSize := range []int{1, 2, 1 * 1024, 32 * 1024} {
- t.Run(fmt.Sprintf("ReadSize=%d", readSize), func(t *testing.T) {
- b := setup(t)
- buf := make([]byte, readSize)
- var gotRead bytes.Buffer
- for {
- n, err := b.Read(buf)
- gotRead.Write(buf[:n])
- if err == errReadEmpty {
- break
- }
- if err != nil {
- t.Fatalf("error after %v bytes: %v", gotRead.Len(), err)
- }
- }
- if got, want := gotRead.Bytes(), wantBytes; !bytes.Equal(got, want) {
- t.Errorf("FinalRead=%q, want %q", fmtDataChunk(got), fmtDataChunk(want))
- }
- })
- }
-}
-
-func TestDataBufferAllocation(t *testing.T) {
- writes := [][]byte{
- bytes.Repeat([]byte("a"), 1*1024-1),
- []byte("a"),
- bytes.Repeat([]byte("b"), 4*1024-1),
- []byte("b"),
- bytes.Repeat([]byte("c"), 8*1024-1),
- []byte("c"),
- bytes.Repeat([]byte("d"), 16*1024-1),
- []byte("d"),
- bytes.Repeat([]byte("e"), 32*1024),
- }
- var wantRead bytes.Buffer
- for _, p := range writes {
- wantRead.Write(p)
- }
-
- testDataBuffer(t, wantRead.Bytes(), func(t *testing.T) *dataBuffer {
- b := &dataBuffer{}
- for _, p := range writes {
- if n, err := b.Write(p); n != len(p) || err != nil {
- t.Fatalf("Write(%q x %d)=%v,%v want %v,nil", p[:1], len(p), n, err, len(p))
- }
- }
- want := [][]byte{
- bytes.Repeat([]byte("a"), 1*1024),
- bytes.Repeat([]byte("b"), 4*1024),
- bytes.Repeat([]byte("c"), 8*1024),
- bytes.Repeat([]byte("d"), 16*1024),
- bytes.Repeat([]byte("e"), 16*1024),
- bytes.Repeat([]byte("e"), 16*1024),
- }
- if !reflect.DeepEqual(b.chunks, want) {
- t.Errorf("dataBuffer.chunks\ngot: %s\nwant: %s", fmtDataChunks(b.chunks), fmtDataChunks(want))
- }
- return b
- })
-}
-
-func TestDataBufferAllocationWithExpected(t *testing.T) {
- writes := [][]byte{
- bytes.Repeat([]byte("a"), 1*1024), // allocates 16KB
- bytes.Repeat([]byte("b"), 14*1024),
- bytes.Repeat([]byte("c"), 15*1024), // allocates 16KB more
- bytes.Repeat([]byte("d"), 2*1024),
- bytes.Repeat([]byte("e"), 1*1024), // overflows 32KB expectation, allocates just 1KB
- }
- var wantRead bytes.Buffer
- for _, p := range writes {
- wantRead.Write(p)
- }
-
- testDataBuffer(t, wantRead.Bytes(), func(t *testing.T) *dataBuffer {
- b := &dataBuffer{expected: 32 * 1024}
- for _, p := range writes {
- if n, err := b.Write(p); n != len(p) || err != nil {
- t.Fatalf("Write(%q x %d)=%v,%v want %v,nil", p[:1], len(p), n, err, len(p))
- }
- }
- want := [][]byte{
- append(bytes.Repeat([]byte("a"), 1*1024), append(bytes.Repeat([]byte("b"), 14*1024), bytes.Repeat([]byte("c"), 1*1024)...)...),
- append(bytes.Repeat([]byte("c"), 14*1024), bytes.Repeat([]byte("d"), 2*1024)...),
- bytes.Repeat([]byte("e"), 1*1024),
- }
- if !reflect.DeepEqual(b.chunks, want) {
- t.Errorf("dataBuffer.chunks\ngot: %s\nwant: %s", fmtDataChunks(b.chunks), fmtDataChunks(want))
- }
- return b
- })
-}
-
-func TestDataBufferWriteAfterPartialRead(t *testing.T) {
- testDataBuffer(t, []byte("cdxyz"), func(t *testing.T) *dataBuffer {
- b := &dataBuffer{}
- if n, err := b.Write([]byte("abcd")); n != 4 || err != nil {
- t.Fatalf("Write(\"abcd\")=%v,%v want 4,nil", n, err)
- }
- p := make([]byte, 2)
- if n, err := b.Read(p); n != 2 || err != nil || !bytes.Equal(p, []byte("ab")) {
- t.Fatalf("Read()=%q,%v,%v want \"ab\",2,nil", p, n, err)
- }
- if n, err := b.Write([]byte("xyz")); n != 3 || err != nil {
- t.Fatalf("Write(\"xyz\")=%v,%v want 3,nil", n, err)
- }
- return b
- })
-}
diff --git a/vendor/golang.org/x/net/http2/errors_test.go b/vendor/golang.org/x/net/http2/errors_test.go
deleted file mode 100644
index da5c58c31..000000000
--- a/vendor/golang.org/x/net/http2/errors_test.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package http2
-
-import "testing"
-
-func TestErrCodeString(t *testing.T) {
- tests := []struct {
- err ErrCode
- want string
- }{
- {ErrCodeProtocol, "PROTOCOL_ERROR"},
- {0xd, "HTTP_1_1_REQUIRED"},
- {0xf, "unknown error code 0xf"},
- }
- for i, tt := range tests {
- got := tt.err.String()
- if got != tt.want {
- t.Errorf("%d. Error = %q; want %q", i, got, tt.want)
- }
- }
-}
diff --git a/vendor/golang.org/x/net/http2/flow_test.go b/vendor/golang.org/x/net/http2/flow_test.go
deleted file mode 100644
index 7ae82c781..000000000
--- a/vendor/golang.org/x/net/http2/flow_test.go
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package http2
-
-import "testing"
-
-func TestFlow(t *testing.T) {
- var st flow
- var conn flow
- st.add(3)
- conn.add(2)
-
- if got, want := st.available(), int32(3); got != want {
- t.Errorf("available = %d; want %d", got, want)
- }
- st.setConnFlow(&conn)
- if got, want := st.available(), int32(2); got != want {
- t.Errorf("after parent setup, available = %d; want %d", got, want)
- }
-
- st.take(2)
- if got, want := conn.available(), int32(0); got != want {
- t.Errorf("after taking 2, conn = %d; want %d", got, want)
- }
- if got, want := st.available(), int32(0); got != want {
- t.Errorf("after taking 2, stream = %d; want %d", got, want)
- }
-}
-
-func TestFlowAdd(t *testing.T) {
- var f flow
- if !f.add(1) {
- t.Fatal("failed to add 1")
- }
- if !f.add(-1) {
- t.Fatal("failed to add -1")
- }
- if got, want := f.available(), int32(0); got != want {
- t.Fatalf("size = %d; want %d", got, want)
- }
- if !f.add(1<<31 - 1) {
- t.Fatal("failed to add 2^31-1")
- }
- if got, want := f.available(), int32(1<<31-1); got != want {
- t.Fatalf("size = %d; want %d", got, want)
- }
- if f.add(1) {
- t.Fatal("adding 1 to max shouldn't be allowed")
- }
-}
-
-func TestFlowAddOverflow(t *testing.T) {
- var f flow
- if !f.add(0) {
- t.Fatal("failed to add 0")
- }
- if !f.add(-1) {
- t.Fatal("failed to add -1")
- }
- if !f.add(0) {
- t.Fatal("failed to add 0")
- }
- if !f.add(1) {
- t.Fatal("failed to add 1")
- }
- if !f.add(1) {
- t.Fatal("failed to add 1")
- }
- if !f.add(0) {
- t.Fatal("failed to add 0")
- }
- if !f.add(-3) {
- t.Fatal("failed to add -3")
- }
- if got, want := f.available(), int32(-2); got != want {
- t.Fatalf("size = %d; want %d", got, want)
- }
- if !f.add(1<<31 - 1) {
- t.Fatal("failed to add 2^31-1")
- }
- if got, want := f.available(), int32(1+-3+(1<<31-1)); got != want {
- t.Fatalf("size = %d; want %d", got, want)
- }
-
-}
diff --git a/vendor/golang.org/x/net/http2/frame_test.go b/vendor/golang.org/x/net/http2/frame_test.go
deleted file mode 100644
index 37266bc58..000000000
--- a/vendor/golang.org/x/net/http2/frame_test.go
+++ /dev/null
@@ -1,1191 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package http2
-
-import (
- "bytes"
- "fmt"
- "io"
- "reflect"
- "strings"
- "testing"
- "unsafe"
-
- "golang.org/x/net/http2/hpack"
-)
-
-func testFramer() (*Framer, *bytes.Buffer) {
- buf := new(bytes.Buffer)
- return NewFramer(buf, buf), buf
-}
-
-func TestFrameSizes(t *testing.T) {
- // Catch people rearranging the FrameHeader fields.
- if got, want := int(unsafe.Sizeof(FrameHeader{})), 12; got != want {
- t.Errorf("FrameHeader size = %d; want %d", got, want)
- }
-}
-
-func TestFrameTypeString(t *testing.T) {
- tests := []struct {
- ft FrameType
- want string
- }{
- {FrameData, "DATA"},
- {FramePing, "PING"},
- {FrameGoAway, "GOAWAY"},
- {0xf, "UNKNOWN_FRAME_TYPE_15"},
- }
-
- for i, tt := range tests {
- got := tt.ft.String()
- if got != tt.want {
- t.Errorf("%d. String(FrameType %d) = %q; want %q", i, int(tt.ft), got, tt.want)
- }
- }
-}
-
-func TestWriteRST(t *testing.T) {
- fr, buf := testFramer()
- var streamID uint32 = 1<<24 + 2<<16 + 3<<8 + 4
- var errCode uint32 = 7<<24 + 6<<16 + 5<<8 + 4
- fr.WriteRSTStream(streamID, ErrCode(errCode))
- const wantEnc = "\x00\x00\x04\x03\x00\x01\x02\x03\x04\x07\x06\x05\x04"
- if buf.String() != wantEnc {
- t.Errorf("encoded as %q; want %q", buf.Bytes(), wantEnc)
- }
- f, err := fr.ReadFrame()
- if err != nil {
- t.Fatal(err)
- }
- want := &RSTStreamFrame{
- FrameHeader: FrameHeader{
- valid: true,
- Type: 0x3,
- Flags: 0x0,
- Length: 0x4,
- StreamID: 0x1020304,
- },
- ErrCode: 0x7060504,
- }
- if !reflect.DeepEqual(f, want) {
- t.Errorf("parsed back %#v; want %#v", f, want)
- }
-}
-
-func TestWriteData(t *testing.T) {
- fr, buf := testFramer()
- var streamID uint32 = 1<<24 + 2<<16 + 3<<8 + 4
- data := []byte("ABC")
- fr.WriteData(streamID, true, data)
- const wantEnc = "\x00\x00\x03\x00\x01\x01\x02\x03\x04ABC"
- if buf.String() != wantEnc {
- t.Errorf("encoded as %q; want %q", buf.Bytes(), wantEnc)
- }
- f, err := fr.ReadFrame()
- if err != nil {
- t.Fatal(err)
- }
- df, ok := f.(*DataFrame)
- if !ok {
- t.Fatalf("got %T; want *DataFrame", f)
- }
- if !bytes.Equal(df.Data(), data) {
- t.Errorf("got %q; want %q", df.Data(), data)
- }
- if f.Header().Flags&1 == 0 {
- t.Errorf("didn't see END_STREAM flag")
- }
-}
-
-func TestWriteDataPadded(t *testing.T) {
- tests := [...]struct {
- streamID uint32
- endStream bool
- data []byte
- pad []byte
- wantHeader FrameHeader
- }{
- // Unpadded:
- 0: {
- streamID: 1,
- endStream: true,
- data: []byte("foo"),
- pad: nil,
- wantHeader: FrameHeader{
- Type: FrameData,
- Flags: FlagDataEndStream,
- Length: 3,
- StreamID: 1,
- },
- },
-
- // Padded bit set, but no padding:
- 1: {
- streamID: 1,
- endStream: true,
- data: []byte("foo"),
- pad: []byte{},
- wantHeader: FrameHeader{
- Type: FrameData,
- Flags: FlagDataEndStream | FlagDataPadded,
- Length: 4,
- StreamID: 1,
- },
- },
-
- // Padded bit set, with padding:
- 2: {
- streamID: 1,
- endStream: false,
- data: []byte("foo"),
- pad: []byte{0, 0, 0},
- wantHeader: FrameHeader{
- Type: FrameData,
- Flags: FlagDataPadded,
- Length: 7,
- StreamID: 1,
- },
- },
- }
- for i, tt := range tests {
- fr, _ := testFramer()
- fr.WriteDataPadded(tt.streamID, tt.endStream, tt.data, tt.pad)
- f, err := fr.ReadFrame()
- if err != nil {
- t.Errorf("%d. ReadFrame: %v", i, err)
- continue
- }
- got := f.Header()
- tt.wantHeader.valid = true
- if got != tt.wantHeader {
- t.Errorf("%d. read %+v; want %+v", i, got, tt.wantHeader)
- continue
- }
- df := f.(*DataFrame)
- if !bytes.Equal(df.Data(), tt.data) {
- t.Errorf("%d. got %q; want %q", i, df.Data(), tt.data)
- }
- }
-}
-
-func TestWriteHeaders(t *testing.T) {
- tests := []struct {
- name string
- p HeadersFrameParam
- wantEnc string
- wantFrame *HeadersFrame
- }{
- {
- "basic",
- HeadersFrameParam{
- StreamID: 42,
- BlockFragment: []byte("abc"),
- Priority: PriorityParam{},
- },
- "\x00\x00\x03\x01\x00\x00\x00\x00*abc",
- &HeadersFrame{
- FrameHeader: FrameHeader{
- valid: true,
- StreamID: 42,
- Type: FrameHeaders,
- Length: uint32(len("abc")),
- },
- Priority: PriorityParam{},
- headerFragBuf: []byte("abc"),
- },
- },
- {
- "basic + end flags",
- HeadersFrameParam{
- StreamID: 42,
- BlockFragment: []byte("abc"),
- EndStream: true,
- EndHeaders: true,
- Priority: PriorityParam{},
- },
- "\x00\x00\x03\x01\x05\x00\x00\x00*abc",
- &HeadersFrame{
- FrameHeader: FrameHeader{
- valid: true,
- StreamID: 42,
- Type: FrameHeaders,
- Flags: FlagHeadersEndStream | FlagHeadersEndHeaders,
- Length: uint32(len("abc")),
- },
- Priority: PriorityParam{},
- headerFragBuf: []byte("abc"),
- },
- },
- {
- "with padding",
- HeadersFrameParam{
- StreamID: 42,
- BlockFragment: []byte("abc"),
- EndStream: true,
- EndHeaders: true,
- PadLength: 5,
- Priority: PriorityParam{},
- },
- "\x00\x00\t\x01\r\x00\x00\x00*\x05abc\x00\x00\x00\x00\x00",
- &HeadersFrame{
- FrameHeader: FrameHeader{
- valid: true,
- StreamID: 42,
- Type: FrameHeaders,
- Flags: FlagHeadersEndStream | FlagHeadersEndHeaders | FlagHeadersPadded,
- Length: uint32(1 + len("abc") + 5), // pad length + contents + padding
- },
- Priority: PriorityParam{},
- headerFragBuf: []byte("abc"),
- },
- },
- {
- "with priority",
- HeadersFrameParam{
- StreamID: 42,
- BlockFragment: []byte("abc"),
- EndStream: true,
- EndHeaders: true,
- PadLength: 2,
- Priority: PriorityParam{
- StreamDep: 15,
- Exclusive: true,
- Weight: 127,
- },
- },
- "\x00\x00\v\x01-\x00\x00\x00*\x02\x80\x00\x00\x0f\u007fabc\x00\x00",
- &HeadersFrame{
- FrameHeader: FrameHeader{
- valid: true,
- StreamID: 42,
- Type: FrameHeaders,
- Flags: FlagHeadersEndStream | FlagHeadersEndHeaders | FlagHeadersPadded | FlagHeadersPriority,
- Length: uint32(1 + 5 + len("abc") + 2), // pad length + priority + contents + padding
- },
- Priority: PriorityParam{
- StreamDep: 15,
- Exclusive: true,
- Weight: 127,
- },
- headerFragBuf: []byte("abc"),
- },
- },
- {
- "with priority stream dep zero", // golang.org/issue/15444
- HeadersFrameParam{
- StreamID: 42,
- BlockFragment: []byte("abc"),
- EndStream: true,
- EndHeaders: true,
- PadLength: 2,
- Priority: PriorityParam{
- StreamDep: 0,
- Exclusive: true,
- Weight: 127,
- },
- },
- "\x00\x00\v\x01-\x00\x00\x00*\x02\x80\x00\x00\x00\u007fabc\x00\x00",
- &HeadersFrame{
- FrameHeader: FrameHeader{
- valid: true,
- StreamID: 42,
- Type: FrameHeaders,
- Flags: FlagHeadersEndStream | FlagHeadersEndHeaders | FlagHeadersPadded | FlagHeadersPriority,
- Length: uint32(1 + 5 + len("abc") + 2), // pad length + priority + contents + padding
- },
- Priority: PriorityParam{
- StreamDep: 0,
- Exclusive: true,
- Weight: 127,
- },
- headerFragBuf: []byte("abc"),
- },
- },
- }
- for _, tt := range tests {
- fr, buf := testFramer()
- if err := fr.WriteHeaders(tt.p); err != nil {
- t.Errorf("test %q: %v", tt.name, err)
- continue
- }
- if buf.String() != tt.wantEnc {
- t.Errorf("test %q: encoded %q; want %q", tt.name, buf.Bytes(), tt.wantEnc)
- }
- f, err := fr.ReadFrame()
- if err != nil {
- t.Errorf("test %q: failed to read the frame back: %v", tt.name, err)
- continue
- }
- if !reflect.DeepEqual(f, tt.wantFrame) {
- t.Errorf("test %q: mismatch.\n got: %#v\nwant: %#v\n", tt.name, f, tt.wantFrame)
- }
- }
-}
-
-func TestWriteInvalidStreamDep(t *testing.T) {
- fr, _ := testFramer()
- err := fr.WriteHeaders(HeadersFrameParam{
- StreamID: 42,
- Priority: PriorityParam{
- StreamDep: 1 << 31,
- },
- })
- if err != errDepStreamID {
- t.Errorf("header error = %v; want %q", err, errDepStreamID)
- }
-
- err = fr.WritePriority(2, PriorityParam{StreamDep: 1 << 31})
- if err != errDepStreamID {
- t.Errorf("priority error = %v; want %q", err, errDepStreamID)
- }
-}
-
-func TestWriteContinuation(t *testing.T) {
- const streamID = 42
- tests := []struct {
- name string
- end bool
- frag []byte
-
- wantFrame *ContinuationFrame
- }{
- {
- "not end",
- false,
- []byte("abc"),
- &ContinuationFrame{
- FrameHeader: FrameHeader{
- valid: true,
- StreamID: streamID,
- Type: FrameContinuation,
- Length: uint32(len("abc")),
- },
- headerFragBuf: []byte("abc"),
- },
- },
- {
- "end",
- true,
- []byte("def"),
- &ContinuationFrame{
- FrameHeader: FrameHeader{
- valid: true,
- StreamID: streamID,
- Type: FrameContinuation,
- Flags: FlagContinuationEndHeaders,
- Length: uint32(len("def")),
- },
- headerFragBuf: []byte("def"),
- },
- },
- }
- for _, tt := range tests {
- fr, _ := testFramer()
- if err := fr.WriteContinuation(streamID, tt.end, tt.frag); err != nil {
- t.Errorf("test %q: %v", tt.name, err)
- continue
- }
- fr.AllowIllegalReads = true
- f, err := fr.ReadFrame()
- if err != nil {
- t.Errorf("test %q: failed to read the frame back: %v", tt.name, err)
- continue
- }
- if !reflect.DeepEqual(f, tt.wantFrame) {
- t.Errorf("test %q: mismatch.\n got: %#v\nwant: %#v\n", tt.name, f, tt.wantFrame)
- }
- }
-}
-
-func TestWritePriority(t *testing.T) {
- const streamID = 42
- tests := []struct {
- name string
- priority PriorityParam
- wantFrame *PriorityFrame
- }{
- {
- "not exclusive",
- PriorityParam{
- StreamDep: 2,
- Exclusive: false,
- Weight: 127,
- },
- &PriorityFrame{
- FrameHeader{
- valid: true,
- StreamID: streamID,
- Type: FramePriority,
- Length: 5,
- },
- PriorityParam{
- StreamDep: 2,
- Exclusive: false,
- Weight: 127,
- },
- },
- },
-
- {
- "exclusive",
- PriorityParam{
- StreamDep: 3,
- Exclusive: true,
- Weight: 77,
- },
- &PriorityFrame{
- FrameHeader{
- valid: true,
- StreamID: streamID,
- Type: FramePriority,
- Length: 5,
- },
- PriorityParam{
- StreamDep: 3,
- Exclusive: true,
- Weight: 77,
- },
- },
- },
- }
- for _, tt := range tests {
- fr, _ := testFramer()
- if err := fr.WritePriority(streamID, tt.priority); err != nil {
- t.Errorf("test %q: %v", tt.name, err)
- continue
- }
- f, err := fr.ReadFrame()
- if err != nil {
- t.Errorf("test %q: failed to read the frame back: %v", tt.name, err)
- continue
- }
- if !reflect.DeepEqual(f, tt.wantFrame) {
- t.Errorf("test %q: mismatch.\n got: %#v\nwant: %#v\n", tt.name, f, tt.wantFrame)
- }
- }
-}
-
-func TestWriteSettings(t *testing.T) {
- fr, buf := testFramer()
- settings := []Setting{{1, 2}, {3, 4}}
- fr.WriteSettings(settings...)
- const wantEnc = "\x00\x00\f\x04\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x02\x00\x03\x00\x00\x00\x04"
- if buf.String() != wantEnc {
- t.Errorf("encoded as %q; want %q", buf.Bytes(), wantEnc)
- }
- f, err := fr.ReadFrame()
- if err != nil {
- t.Fatal(err)
- }
- sf, ok := f.(*SettingsFrame)
- if !ok {
- t.Fatalf("Got a %T; want a SettingsFrame", f)
- }
- var got []Setting
- sf.ForeachSetting(func(s Setting) error {
- got = append(got, s)
- valBack, ok := sf.Value(s.ID)
- if !ok || valBack != s.Val {
- t.Errorf("Value(%d) = %v, %v; want %v, true", s.ID, valBack, ok, s.Val)
- }
- return nil
- })
- if !reflect.DeepEqual(settings, got) {
- t.Errorf("Read settings %+v != written settings %+v", got, settings)
- }
-}
-
-func TestWriteSettingsAck(t *testing.T) {
- fr, buf := testFramer()
- fr.WriteSettingsAck()
- const wantEnc = "\x00\x00\x00\x04\x01\x00\x00\x00\x00"
- if buf.String() != wantEnc {
- t.Errorf("encoded as %q; want %q", buf.Bytes(), wantEnc)
- }
-}
-
-func TestWriteWindowUpdate(t *testing.T) {
- fr, buf := testFramer()
- const streamID = 1<<24 + 2<<16 + 3<<8 + 4
- const incr = 7<<24 + 6<<16 + 5<<8 + 4
- if err := fr.WriteWindowUpdate(streamID, incr); err != nil {
- t.Fatal(err)
- }
- const wantEnc = "\x00\x00\x04\x08\x00\x01\x02\x03\x04\x07\x06\x05\x04"
- if buf.String() != wantEnc {
- t.Errorf("encoded as %q; want %q", buf.Bytes(), wantEnc)
- }
- f, err := fr.ReadFrame()
- if err != nil {
- t.Fatal(err)
- }
- want := &WindowUpdateFrame{
- FrameHeader: FrameHeader{
- valid: true,
- Type: 0x8,
- Flags: 0x0,
- Length: 0x4,
- StreamID: 0x1020304,
- },
- Increment: 0x7060504,
- }
- if !reflect.DeepEqual(f, want) {
- t.Errorf("parsed back %#v; want %#v", f, want)
- }
-}
-
-func TestWritePing(t *testing.T) { testWritePing(t, false) }
-func TestWritePingAck(t *testing.T) { testWritePing(t, true) }
-
-func testWritePing(t *testing.T, ack bool) {
- fr, buf := testFramer()
- if err := fr.WritePing(ack, [8]byte{1, 2, 3, 4, 5, 6, 7, 8}); err != nil {
- t.Fatal(err)
- }
- var wantFlags Flags
- if ack {
- wantFlags = FlagPingAck
- }
- var wantEnc = "\x00\x00\x08\x06" + string(wantFlags) + "\x00\x00\x00\x00" + "\x01\x02\x03\x04\x05\x06\x07\x08"
- if buf.String() != wantEnc {
- t.Errorf("encoded as %q; want %q", buf.Bytes(), wantEnc)
- }
-
- f, err := fr.ReadFrame()
- if err != nil {
- t.Fatal(err)
- }
- want := &PingFrame{
- FrameHeader: FrameHeader{
- valid: true,
- Type: 0x6,
- Flags: wantFlags,
- Length: 0x8,
- StreamID: 0,
- },
- Data: [8]byte{1, 2, 3, 4, 5, 6, 7, 8},
- }
- if !reflect.DeepEqual(f, want) {
- t.Errorf("parsed back %#v; want %#v", f, want)
- }
-}
-
-func TestReadFrameHeader(t *testing.T) {
- tests := []struct {
- in string
- want FrameHeader
- }{
- {in: "\x00\x00\x00" + "\x00" + "\x00" + "\x00\x00\x00\x00", want: FrameHeader{}},
- {in: "\x01\x02\x03" + "\x04" + "\x05" + "\x06\x07\x08\x09", want: FrameHeader{
- Length: 66051, Type: 4, Flags: 5, StreamID: 101124105,
- }},
- // Ignore high bit:
- {in: "\xff\xff\xff" + "\xff" + "\xff" + "\xff\xff\xff\xff", want: FrameHeader{
- Length: 16777215, Type: 255, Flags: 255, StreamID: 2147483647}},
- {in: "\xff\xff\xff" + "\xff" + "\xff" + "\x7f\xff\xff\xff", want: FrameHeader{
- Length: 16777215, Type: 255, Flags: 255, StreamID: 2147483647}},
- }
- for i, tt := range tests {
- got, err := readFrameHeader(make([]byte, 9), strings.NewReader(tt.in))
- if err != nil {
- t.Errorf("%d. readFrameHeader(%q) = %v", i, tt.in, err)
- continue
- }
- tt.want.valid = true
- if got != tt.want {
- t.Errorf("%d. readFrameHeader(%q) = %+v; want %+v", i, tt.in, got, tt.want)
- }
- }
-}
-
-func TestReadWriteFrameHeader(t *testing.T) {
- tests := []struct {
- len uint32
- typ FrameType
- flags Flags
- streamID uint32
- }{
- {len: 0, typ: 255, flags: 1, streamID: 0},
- {len: 0, typ: 255, flags: 1, streamID: 1},
- {len: 0, typ: 255, flags: 1, streamID: 255},
- {len: 0, typ: 255, flags: 1, streamID: 256},
- {len: 0, typ: 255, flags: 1, streamID: 65535},
- {len: 0, typ: 255, flags: 1, streamID: 65536},
-
- {len: 0, typ: 1, flags: 255, streamID: 1},
- {len: 255, typ: 1, flags: 255, streamID: 1},
- {len: 256, typ: 1, flags: 255, streamID: 1},
- {len: 65535, typ: 1, flags: 255, streamID: 1},
- {len: 65536, typ: 1, flags: 255, streamID: 1},
- {len: 16777215, typ: 1, flags: 255, streamID: 1},
- }
- for _, tt := range tests {
- fr, buf := testFramer()
- fr.startWrite(tt.typ, tt.flags, tt.streamID)
- fr.writeBytes(make([]byte, tt.len))
- fr.endWrite()
- fh, err := ReadFrameHeader(buf)
- if err != nil {
- t.Errorf("ReadFrameHeader(%+v) = %v", tt, err)
- continue
- }
- if fh.Type != tt.typ || fh.Flags != tt.flags || fh.Length != tt.len || fh.StreamID != tt.streamID {
- t.Errorf("ReadFrameHeader(%+v) = %+v; mismatch", tt, fh)
- }
- }
-
-}
-
-func TestWriteTooLargeFrame(t *testing.T) {
- fr, _ := testFramer()
- fr.startWrite(0, 1, 1)
- fr.writeBytes(make([]byte, 1<<24))
- err := fr.endWrite()
- if err != ErrFrameTooLarge {
- t.Errorf("endWrite = %v; want errFrameTooLarge", err)
- }
-}
-
-func TestWriteGoAway(t *testing.T) {
- const debug = "foo"
- fr, buf := testFramer()
- if err := fr.WriteGoAway(0x01020304, 0x05060708, []byte(debug)); err != nil {
- t.Fatal(err)
- }
- const wantEnc = "\x00\x00\v\a\x00\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08" + debug
- if buf.String() != wantEnc {
- t.Errorf("encoded as %q; want %q", buf.Bytes(), wantEnc)
- }
- f, err := fr.ReadFrame()
- if err != nil {
- t.Fatal(err)
- }
- want := &GoAwayFrame{
- FrameHeader: FrameHeader{
- valid: true,
- Type: 0x7,
- Flags: 0,
- Length: uint32(4 + 4 + len(debug)),
- StreamID: 0,
- },
- LastStreamID: 0x01020304,
- ErrCode: 0x05060708,
- debugData: []byte(debug),
- }
- if !reflect.DeepEqual(f, want) {
- t.Fatalf("parsed back:\n%#v\nwant:\n%#v", f, want)
- }
- if got := string(f.(*GoAwayFrame).DebugData()); got != debug {
- t.Errorf("debug data = %q; want %q", got, debug)
- }
-}
-
-func TestWritePushPromise(t *testing.T) {
- pp := PushPromiseParam{
- StreamID: 42,
- PromiseID: 42,
- BlockFragment: []byte("abc"),
- }
- fr, buf := testFramer()
- if err := fr.WritePushPromise(pp); err != nil {
- t.Fatal(err)
- }
- const wantEnc = "\x00\x00\x07\x05\x00\x00\x00\x00*\x00\x00\x00*abc"
- if buf.String() != wantEnc {
- t.Errorf("encoded as %q; want %q", buf.Bytes(), wantEnc)
- }
- f, err := fr.ReadFrame()
- if err != nil {
- t.Fatal(err)
- }
- _, ok := f.(*PushPromiseFrame)
- if !ok {
- t.Fatalf("got %T; want *PushPromiseFrame", f)
- }
- want := &PushPromiseFrame{
- FrameHeader: FrameHeader{
- valid: true,
- Type: 0x5,
- Flags: 0x0,
- Length: 0x7,
- StreamID: 42,
- },
- PromiseID: 42,
- headerFragBuf: []byte("abc"),
- }
- if !reflect.DeepEqual(f, want) {
- t.Fatalf("parsed back:\n%#v\nwant:\n%#v", f, want)
- }
-}
-
-// test checkFrameOrder and that HEADERS and CONTINUATION frames can't be intermingled.
-func TestReadFrameOrder(t *testing.T) {
- head := func(f *Framer, id uint32, end bool) {
- f.WriteHeaders(HeadersFrameParam{
- StreamID: id,
- BlockFragment: []byte("foo"), // unused, but non-empty
- EndHeaders: end,
- })
- }
- cont := func(f *Framer, id uint32, end bool) {
- f.WriteContinuation(id, end, []byte("foo"))
- }
-
- tests := [...]struct {
- name string
- w func(*Framer)
- atLeast int
- wantErr string
- }{
- 0: {
- w: func(f *Framer) {
- head(f, 1, true)
- },
- },
- 1: {
- w: func(f *Framer) {
- head(f, 1, true)
- head(f, 2, true)
- },
- },
- 2: {
- wantErr: "got HEADERS for stream 2; expected CONTINUATION following HEADERS for stream 1",
- w: func(f *Framer) {
- head(f, 1, false)
- head(f, 2, true)
- },
- },
- 3: {
- wantErr: "got DATA for stream 1; expected CONTINUATION following HEADERS for stream 1",
- w: func(f *Framer) {
- head(f, 1, false)
- },
- },
- 4: {
- w: func(f *Framer) {
- head(f, 1, false)
- cont(f, 1, true)
- head(f, 2, true)
- },
- },
- 5: {
- wantErr: "got CONTINUATION for stream 2; expected stream 1",
- w: func(f *Framer) {
- head(f, 1, false)
- cont(f, 2, true)
- head(f, 2, true)
- },
- },
- 6: {
- wantErr: "unexpected CONTINUATION for stream 1",
- w: func(f *Framer) {
- cont(f, 1, true)
- },
- },
- 7: {
- wantErr: "unexpected CONTINUATION for stream 1",
- w: func(f *Framer) {
- cont(f, 1, false)
- },
- },
- 8: {
- wantErr: "HEADERS frame with stream ID 0",
- w: func(f *Framer) {
- head(f, 0, true)
- },
- },
- 9: {
- wantErr: "CONTINUATION frame with stream ID 0",
- w: func(f *Framer) {
- cont(f, 0, true)
- },
- },
- 10: {
- wantErr: "unexpected CONTINUATION for stream 1",
- atLeast: 5,
- w: func(f *Framer) {
- head(f, 1, false)
- cont(f, 1, false)
- cont(f, 1, false)
- cont(f, 1, false)
- cont(f, 1, true)
- cont(f, 1, false)
- },
- },
- }
- for i, tt := range tests {
- buf := new(bytes.Buffer)
- f := NewFramer(buf, buf)
- f.AllowIllegalWrites = true
- tt.w(f)
- f.WriteData(1, true, nil) // to test transition away from last step
-
- var err error
- n := 0
- var log bytes.Buffer
- for {
- var got Frame
- got, err = f.ReadFrame()
- fmt.Fprintf(&log, " read %v, %v\n", got, err)
- if err != nil {
- break
- }
- n++
- }
- if err == io.EOF {
- err = nil
- }
- ok := tt.wantErr == ""
- if ok && err != nil {
- t.Errorf("%d. after %d good frames, ReadFrame = %v; want success\n%s", i, n, err, log.Bytes())
- continue
- }
- if !ok && err != ConnectionError(ErrCodeProtocol) {
- t.Errorf("%d. after %d good frames, ReadFrame = %v; want ConnectionError(ErrCodeProtocol)\n%s", i, n, err, log.Bytes())
- continue
- }
- if !((f.errDetail == nil && tt.wantErr == "") || (fmt.Sprint(f.errDetail) == tt.wantErr)) {
- t.Errorf("%d. framer eror = %q; want %q\n%s", i, f.errDetail, tt.wantErr, log.Bytes())
- }
- if n < tt.atLeast {
- t.Errorf("%d. framer only read %d frames; want at least %d\n%s", i, n, tt.atLeast, log.Bytes())
- }
- }
-}
-
-func TestMetaFrameHeader(t *testing.T) {
- write := func(f *Framer, frags ...[]byte) {
- for i, frag := range frags {
- end := (i == len(frags)-1)
- if i == 0 {
- f.WriteHeaders(HeadersFrameParam{
- StreamID: 1,
- BlockFragment: frag,
- EndHeaders: end,
- })
- } else {
- f.WriteContinuation(1, end, frag)
- }
- }
- }
-
- want := func(flags Flags, length uint32, pairs ...string) *MetaHeadersFrame {
- mh := &MetaHeadersFrame{
- HeadersFrame: &HeadersFrame{
- FrameHeader: FrameHeader{
- Type: FrameHeaders,
- Flags: flags,
- Length: length,
- StreamID: 1,
- },
- },
- Fields: []hpack.HeaderField(nil),
- }
- for len(pairs) > 0 {
- mh.Fields = append(mh.Fields, hpack.HeaderField{
- Name: pairs[0],
- Value: pairs[1],
- })
- pairs = pairs[2:]
- }
- return mh
- }
- truncated := func(mh *MetaHeadersFrame) *MetaHeadersFrame {
- mh.Truncated = true
- return mh
- }
-
- const noFlags Flags = 0
-
- oneKBString := strings.Repeat("a", 1<<10)
-
- tests := [...]struct {
- name string
- w func(*Framer)
- want interface{} // *MetaHeaderFrame or error
- wantErrReason string
- maxHeaderListSize uint32
- }{
- 0: {
- name: "single_headers",
- w: func(f *Framer) {
- var he hpackEncoder
- all := he.encodeHeaderRaw(t, ":method", "GET", ":path", "/")
- write(f, all)
- },
- want: want(FlagHeadersEndHeaders, 2, ":method", "GET", ":path", "/"),
- },
- 1: {
- name: "with_continuation",
- w: func(f *Framer) {
- var he hpackEncoder
- all := he.encodeHeaderRaw(t, ":method", "GET", ":path", "/", "foo", "bar")
- write(f, all[:1], all[1:])
- },
- want: want(noFlags, 1, ":method", "GET", ":path", "/", "foo", "bar"),
- },
- 2: {
- name: "with_two_continuation",
- w: func(f *Framer) {
- var he hpackEncoder
- all := he.encodeHeaderRaw(t, ":method", "GET", ":path", "/", "foo", "bar")
- write(f, all[:2], all[2:4], all[4:])
- },
- want: want(noFlags, 2, ":method", "GET", ":path", "/", "foo", "bar"),
- },
- 3: {
- name: "big_string_okay",
- w: func(f *Framer) {
- var he hpackEncoder
- all := he.encodeHeaderRaw(t, ":method", "GET", ":path", "/", "foo", oneKBString)
- write(f, all[:2], all[2:])
- },
- want: want(noFlags, 2, ":method", "GET", ":path", "/", "foo", oneKBString),
- },
- 4: {
- name: "big_string_error",
- w: func(f *Framer) {
- var he hpackEncoder
- all := he.encodeHeaderRaw(t, ":method", "GET", ":path", "/", "foo", oneKBString)
- write(f, all[:2], all[2:])
- },
- maxHeaderListSize: (1 << 10) / 2,
- want: ConnectionError(ErrCodeCompression),
- },
- 5: {
- name: "max_header_list_truncated",
- w: func(f *Framer) {
- var he hpackEncoder
- var pairs = []string{":method", "GET", ":path", "/"}
- for i := 0; i < 100; i++ {
- pairs = append(pairs, "foo", "bar")
- }
- all := he.encodeHeaderRaw(t, pairs...)
- write(f, all[:2], all[2:])
- },
- maxHeaderListSize: (1 << 10) / 2,
- want: truncated(want(noFlags, 2,
- ":method", "GET",
- ":path", "/",
- "foo", "bar",
- "foo", "bar",
- "foo", "bar",
- "foo", "bar",
- "foo", "bar",
- "foo", "bar",
- "foo", "bar",
- "foo", "bar",
- "foo", "bar",
- "foo", "bar",
- "foo", "bar", // 11
- )),
- },
- 6: {
- name: "pseudo_order",
- w: func(f *Framer) {
- write(f, encodeHeaderRaw(t,
- ":method", "GET",
- "foo", "bar",
- ":path", "/", // bogus
- ))
- },
- want: streamError(1, ErrCodeProtocol),
- wantErrReason: "pseudo header field after regular",
- },
- 7: {
- name: "pseudo_unknown",
- w: func(f *Framer) {
- write(f, encodeHeaderRaw(t,
- ":unknown", "foo", // bogus
- "foo", "bar",
- ))
- },
- want: streamError(1, ErrCodeProtocol),
- wantErrReason: "invalid pseudo-header \":unknown\"",
- },
- 8: {
- name: "pseudo_mix_request_response",
- w: func(f *Framer) {
- write(f, encodeHeaderRaw(t,
- ":method", "GET",
- ":status", "100",
- ))
- },
- want: streamError(1, ErrCodeProtocol),
- wantErrReason: "mix of request and response pseudo headers",
- },
- 9: {
- name: "pseudo_dup",
- w: func(f *Framer) {
- write(f, encodeHeaderRaw(t,
- ":method", "GET",
- ":method", "POST",
- ))
- },
- want: streamError(1, ErrCodeProtocol),
- wantErrReason: "duplicate pseudo-header \":method\"",
- },
- 10: {
- name: "trailer_okay_no_pseudo",
- w: func(f *Framer) { write(f, encodeHeaderRaw(t, "foo", "bar")) },
- want: want(FlagHeadersEndHeaders, 8, "foo", "bar"),
- },
- 11: {
- name: "invalid_field_name",
- w: func(f *Framer) { write(f, encodeHeaderRaw(t, "CapitalBad", "x")) },
- want: streamError(1, ErrCodeProtocol),
- wantErrReason: "invalid header field name \"CapitalBad\"",
- },
- 12: {
- name: "invalid_field_value",
- w: func(f *Framer) { write(f, encodeHeaderRaw(t, "key", "bad_null\x00")) },
- want: streamError(1, ErrCodeProtocol),
- wantErrReason: "invalid header field value \"bad_null\\x00\"",
- },
- }
- for i, tt := range tests {
- buf := new(bytes.Buffer)
- f := NewFramer(buf, buf)
- f.ReadMetaHeaders = hpack.NewDecoder(initialHeaderTableSize, nil)
- f.MaxHeaderListSize = tt.maxHeaderListSize
- tt.w(f)
-
- name := tt.name
- if name == "" {
- name = fmt.Sprintf("test index %d", i)
- }
-
- var got interface{}
- var err error
- got, err = f.ReadFrame()
- if err != nil {
- got = err
-
- // Ignore the StreamError.Cause field, if it matches the wantErrReason.
- // The test table above predates the Cause field.
- if se, ok := err.(StreamError); ok && se.Cause != nil && se.Cause.Error() == tt.wantErrReason {
- se.Cause = nil
- got = se
- }
- }
- if !reflect.DeepEqual(got, tt.want) {
- if mhg, ok := got.(*MetaHeadersFrame); ok {
- if mhw, ok := tt.want.(*MetaHeadersFrame); ok {
- hg := mhg.HeadersFrame
- hw := mhw.HeadersFrame
- if hg != nil && hw != nil && !reflect.DeepEqual(*hg, *hw) {
- t.Errorf("%s: headers differ:\n got: %+v\nwant: %+v\n", name, *hg, *hw)
- }
- }
- }
- str := func(v interface{}) string {
- if _, ok := v.(error); ok {
- return fmt.Sprintf("error %v", v)
- } else {
- return fmt.Sprintf("value %#v", v)
- }
- }
- t.Errorf("%s:\n got: %v\nwant: %s", name, str(got), str(tt.want))
- }
- if tt.wantErrReason != "" && tt.wantErrReason != fmt.Sprint(f.errDetail) {
- t.Errorf("%s: got error reason %q; want %q", name, f.errDetail, tt.wantErrReason)
- }
- }
-}
-
-func TestSetReuseFrames(t *testing.T) {
- fr, buf := testFramer()
- fr.SetReuseFrames()
-
- // Check that DataFrames are reused. Note that
- // SetReuseFrames only currently implements reuse of DataFrames.
- firstDf := readAndVerifyDataFrame("ABC", 3, fr, buf, t)
-
- for i := 0; i < 10; i++ {
- df := readAndVerifyDataFrame("XYZ", 3, fr, buf, t)
- if df != firstDf {
- t.Errorf("Expected Framer to return references to the same DataFrame. Have %v and %v", &df, &firstDf)
- }
- }
-
- for i := 0; i < 10; i++ {
- df := readAndVerifyDataFrame("", 0, fr, buf, t)
- if df != firstDf {
- t.Errorf("Expected Framer to return references to the same DataFrame. Have %v and %v", &df, &firstDf)
- }
- }
-
- for i := 0; i < 10; i++ {
- df := readAndVerifyDataFrame("HHH", 3, fr, buf, t)
- if df != firstDf {
- t.Errorf("Expected Framer to return references to the same DataFrame. Have %v and %v", &df, &firstDf)
- }
- }
-}
-
-func TestSetReuseFramesMoreThanOnce(t *testing.T) {
- fr, buf := testFramer()
- fr.SetReuseFrames()
-
- firstDf := readAndVerifyDataFrame("ABC", 3, fr, buf, t)
- fr.SetReuseFrames()
-
- for i := 0; i < 10; i++ {
- df := readAndVerifyDataFrame("XYZ", 3, fr, buf, t)
- // SetReuseFrames should be idempotent
- fr.SetReuseFrames()
- if df != firstDf {
- t.Errorf("Expected Framer to return references to the same DataFrame. Have %v and %v", &df, &firstDf)
- }
- }
-}
-
-func TestNoSetReuseFrames(t *testing.T) {
- fr, buf := testFramer()
- const numNewDataFrames = 10
- dfSoFar := make([]interface{}, numNewDataFrames)
-
- // Check that DataFrames are not reused if SetReuseFrames wasn't called.
- // SetReuseFrames only currently implements reuse of DataFrames.
- for i := 0; i < numNewDataFrames; i++ {
- df := readAndVerifyDataFrame("XYZ", 3, fr, buf, t)
- for _, item := range dfSoFar {
- if df == item {
- t.Errorf("Expected Framer to return new DataFrames since SetNoReuseFrames not set.")
- }
- }
- dfSoFar[i] = df
- }
-}
-
-func readAndVerifyDataFrame(data string, length byte, fr *Framer, buf *bytes.Buffer, t *testing.T) *DataFrame {
- var streamID uint32 = 1<<24 + 2<<16 + 3<<8 + 4
- fr.WriteData(streamID, true, []byte(data))
- wantEnc := "\x00\x00" + string(length) + "\x00\x01\x01\x02\x03\x04" + data
- if buf.String() != wantEnc {
- t.Errorf("encoded as %q; want %q", buf.Bytes(), wantEnc)
- }
- f, err := fr.ReadFrame()
- if err != nil {
- t.Fatal(err)
- }
- df, ok := f.(*DataFrame)
- if !ok {
- t.Fatalf("got %T; want *DataFrame", f)
- }
- if !bytes.Equal(df.Data(), []byte(data)) {
- t.Errorf("got %q; want %q", df.Data(), []byte(data))
- }
- if f.Header().Flags&1 == 0 {
- t.Errorf("didn't see END_STREAM flag")
- }
- return df
-}
-
-func encodeHeaderRaw(t *testing.T, pairs ...string) []byte {
- var he hpackEncoder
- return he.encodeHeaderRaw(t, pairs...)
-}
diff --git a/vendor/golang.org/x/net/http2/go18_test.go b/vendor/golang.org/x/net/http2/go18_test.go
deleted file mode 100644
index 30e3b038b..000000000
--- a/vendor/golang.org/x/net/http2/go18_test.go
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.8
-
-package http2
-
-import (
- "crypto/tls"
- "net/http"
- "testing"
- "time"
-)
-
-// Tests that http2.Server.IdleTimeout is initialized from
-// http.Server.{Idle,Read}Timeout. http.Server.IdleTimeout was
-// added in Go 1.8.
-func TestConfigureServerIdleTimeout_Go18(t *testing.T) {
- const timeout = 5 * time.Second
- const notThisOne = 1 * time.Second
-
- // With a zero http2.Server, verify that it copies IdleTimeout:
- {
- s1 := &http.Server{
- IdleTimeout: timeout,
- ReadTimeout: notThisOne,
- }
- s2 := &Server{}
- if err := ConfigureServer(s1, s2); err != nil {
- t.Fatal(err)
- }
- if s2.IdleTimeout != timeout {
- t.Errorf("s2.IdleTimeout = %v; want %v", s2.IdleTimeout, timeout)
- }
- }
-
- // And that it falls back to ReadTimeout:
- {
- s1 := &http.Server{
- ReadTimeout: timeout,
- }
- s2 := &Server{}
- if err := ConfigureServer(s1, s2); err != nil {
- t.Fatal(err)
- }
- if s2.IdleTimeout != timeout {
- t.Errorf("s2.IdleTimeout = %v; want %v", s2.IdleTimeout, timeout)
- }
- }
-
- // Verify that s1's IdleTimeout doesn't overwrite an existing setting:
- {
- s1 := &http.Server{
- IdleTimeout: notThisOne,
- }
- s2 := &Server{
- IdleTimeout: timeout,
- }
- if err := ConfigureServer(s1, s2); err != nil {
- t.Fatal(err)
- }
- if s2.IdleTimeout != timeout {
- t.Errorf("s2.IdleTimeout = %v; want %v", s2.IdleTimeout, timeout)
- }
- }
-}
-
-func TestCertClone(t *testing.T) {
- c := &tls.Config{
- GetClientCertificate: func(*tls.CertificateRequestInfo) (*tls.Certificate, error) {
- panic("shouldn't be called")
- },
- }
- c2 := cloneTLSConfig(c)
- if c2.GetClientCertificate == nil {
- t.Error("GetClientCertificate is nil")
- }
-}
diff --git a/vendor/golang.org/x/net/http2/go19_test.go b/vendor/golang.org/x/net/http2/go19_test.go
deleted file mode 100644
index 22b000667..000000000
--- a/vendor/golang.org/x/net/http2/go19_test.go
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.9
-
-package http2
-
-import (
- "context"
- "net/http"
- "reflect"
- "testing"
- "time"
-)
-
-func TestServerGracefulShutdown(t *testing.T) {
- var st *serverTester
- handlerDone := make(chan struct{})
- st = newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- defer close(handlerDone)
- go st.ts.Config.Shutdown(context.Background())
-
- ga := st.wantGoAway()
- if ga.ErrCode != ErrCodeNo {
- t.Errorf("GOAWAY error = %v; want ErrCodeNo", ga.ErrCode)
- }
- if ga.LastStreamID != 1 {
- t.Errorf("GOAWAY LastStreamID = %v; want 1", ga.LastStreamID)
- }
-
- w.Header().Set("x-foo", "bar")
- })
- defer st.Close()
-
- st.greet()
- st.bodylessReq1()
-
- select {
- case <-handlerDone:
- case <-time.After(5 * time.Second):
- t.Fatalf("server did not shutdown?")
- }
- hf := st.wantHeaders()
- goth := st.decodeHeader(hf.HeaderBlockFragment())
- wanth := [][2]string{
- {":status", "200"},
- {"x-foo", "bar"},
- {"content-length", "0"},
- }
- if !reflect.DeepEqual(goth, wanth) {
- t.Errorf("Got headers %v; want %v", goth, wanth)
- }
-
- n, err := st.cc.Read([]byte{0})
- if n != 0 || err == nil {
- t.Errorf("Read = %v, %v; want 0, non-nil", n, err)
- }
-}
diff --git a/vendor/golang.org/x/net/http2/gotrack_test.go b/vendor/golang.org/x/net/http2/gotrack_test.go
deleted file mode 100644
index 06db61231..000000000
--- a/vendor/golang.org/x/net/http2/gotrack_test.go
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package http2
-
-import (
- "fmt"
- "strings"
- "testing"
-)
-
-func TestGoroutineLock(t *testing.T) {
- oldDebug := DebugGoroutines
- DebugGoroutines = true
- defer func() { DebugGoroutines = oldDebug }()
-
- g := newGoroutineLock()
- g.check()
-
- sawPanic := make(chan interface{})
- go func() {
- defer func() { sawPanic <- recover() }()
- g.check() // should panic
- }()
- e := <-sawPanic
- if e == nil {
- t.Fatal("did not see panic from check in other goroutine")
- }
- if !strings.Contains(fmt.Sprint(e), "wrong goroutine") {
- t.Errorf("expected on see panic about running on the wrong goroutine; got %v", e)
- }
-}
diff --git a/vendor/golang.org/x/net/http2/hpack/encode_test.go b/vendor/golang.org/x/net/http2/hpack/encode_test.go
deleted file mode 100644
index 05f12db9c..000000000
--- a/vendor/golang.org/x/net/http2/hpack/encode_test.go
+++ /dev/null
@@ -1,386 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package hpack
-
-import (
- "bytes"
- "encoding/hex"
- "fmt"
- "math/rand"
- "reflect"
- "strings"
- "testing"
-)
-
-func TestEncoderTableSizeUpdate(t *testing.T) {
- tests := []struct {
- size1, size2 uint32
- wantHex string
- }{
- // Should emit 2 table size updates (2048 and 4096)
- {2048, 4096, "3fe10f 3fe11f 82"},
-
- // Should emit 1 table size update (2048)
- {16384, 2048, "3fe10f 82"},
- }
- for _, tt := range tests {
- var buf bytes.Buffer
- e := NewEncoder(&buf)
- e.SetMaxDynamicTableSize(tt.size1)
- e.SetMaxDynamicTableSize(tt.size2)
- if err := e.WriteField(pair(":method", "GET")); err != nil {
- t.Fatal(err)
- }
- want := removeSpace(tt.wantHex)
- if got := hex.EncodeToString(buf.Bytes()); got != want {
- t.Errorf("e.SetDynamicTableSize %v, %v = %q; want %q", tt.size1, tt.size2, got, want)
- }
- }
-}
-
-func TestEncoderWriteField(t *testing.T) {
- var buf bytes.Buffer
- e := NewEncoder(&buf)
- var got []HeaderField
- d := NewDecoder(4<<10, func(f HeaderField) {
- got = append(got, f)
- })
-
- tests := []struct {
- hdrs []HeaderField
- }{
- {[]HeaderField{
- pair(":method", "GET"),
- pair(":scheme", "http"),
- pair(":path", "/"),
- pair(":authority", "www.example.com"),
- }},
- {[]HeaderField{
- pair(":method", "GET"),
- pair(":scheme", "http"),
- pair(":path", "/"),
- pair(":authority", "www.example.com"),
- pair("cache-control", "no-cache"),
- }},
- {[]HeaderField{
- pair(":method", "GET"),
- pair(":scheme", "https"),
- pair(":path", "/index.html"),
- pair(":authority", "www.example.com"),
- pair("custom-key", "custom-value"),
- }},
- }
- for i, tt := range tests {
- buf.Reset()
- got = got[:0]
- for _, hf := range tt.hdrs {
- if err := e.WriteField(hf); err != nil {
- t.Fatal(err)
- }
- }
- _, err := d.Write(buf.Bytes())
- if err != nil {
- t.Errorf("%d. Decoder Write = %v", i, err)
- }
- if !reflect.DeepEqual(got, tt.hdrs) {
- t.Errorf("%d. Decoded %+v; want %+v", i, got, tt.hdrs)
- }
- }
-}
-
-func TestEncoderSearchTable(t *testing.T) {
- e := NewEncoder(nil)
-
- e.dynTab.add(pair("foo", "bar"))
- e.dynTab.add(pair("blake", "miz"))
- e.dynTab.add(pair(":method", "GET"))
-
- tests := []struct {
- hf HeaderField
- wantI uint64
- wantMatch bool
- }{
- // Name and Value match
- {pair("foo", "bar"), uint64(staticTable.len()) + 3, true},
- {pair("blake", "miz"), uint64(staticTable.len()) + 2, true},
- {pair(":method", "GET"), 2, true},
-
- // Only name match because Sensitive == true. This is allowed to match
- // any ":method" entry. The current implementation uses the last entry
- // added in newStaticTable.
- {HeaderField{":method", "GET", true}, 3, false},
-
- // Only Name matches
- {pair("foo", "..."), uint64(staticTable.len()) + 3, false},
- {pair("blake", "..."), uint64(staticTable.len()) + 2, false},
- // As before, this is allowed to match any ":method" entry.
- {pair(":method", "..."), 3, false},
-
- // None match
- {pair("foo-", "bar"), 0, false},
- }
- for _, tt := range tests {
- if gotI, gotMatch := e.searchTable(tt.hf); gotI != tt.wantI || gotMatch != tt.wantMatch {
- t.Errorf("d.search(%+v) = %v, %v; want %v, %v", tt.hf, gotI, gotMatch, tt.wantI, tt.wantMatch)
- }
- }
-}
-
-func TestAppendVarInt(t *testing.T) {
- tests := []struct {
- n byte
- i uint64
- want []byte
- }{
- // Fits in a byte:
- {1, 0, []byte{0}},
- {2, 2, []byte{2}},
- {3, 6, []byte{6}},
- {4, 14, []byte{14}},
- {5, 30, []byte{30}},
- {6, 62, []byte{62}},
- {7, 126, []byte{126}},
- {8, 254, []byte{254}},
-
- // Multiple bytes:
- {5, 1337, []byte{31, 154, 10}},
- }
- for _, tt := range tests {
- got := appendVarInt(nil, tt.n, tt.i)
- if !bytes.Equal(got, tt.want) {
- t.Errorf("appendVarInt(nil, %v, %v) = %v; want %v", tt.n, tt.i, got, tt.want)
- }
- }
-}
-
-func TestAppendHpackString(t *testing.T) {
- tests := []struct {
- s, wantHex string
- }{
- // Huffman encoded
- {"www.example.com", "8c f1e3 c2e5 f23a 6ba0 ab90 f4ff"},
-
- // Not Huffman encoded
- {"a", "01 61"},
-
- // zero length
- {"", "00"},
- }
- for _, tt := range tests {
- want := removeSpace(tt.wantHex)
- buf := appendHpackString(nil, tt.s)
- if got := hex.EncodeToString(buf); want != got {
- t.Errorf("appendHpackString(nil, %q) = %q; want %q", tt.s, got, want)
- }
- }
-}
-
-func TestAppendIndexed(t *testing.T) {
- tests := []struct {
- i uint64
- wantHex string
- }{
- // 1 byte
- {1, "81"},
- {126, "fe"},
-
- // 2 bytes
- {127, "ff00"},
- {128, "ff01"},
- }
- for _, tt := range tests {
- want := removeSpace(tt.wantHex)
- buf := appendIndexed(nil, tt.i)
- if got := hex.EncodeToString(buf); want != got {
- t.Errorf("appendIndex(nil, %v) = %q; want %q", tt.i, got, want)
- }
- }
-}
-
-func TestAppendNewName(t *testing.T) {
- tests := []struct {
- f HeaderField
- indexing bool
- wantHex string
- }{
- // Incremental indexing
- {HeaderField{"custom-key", "custom-value", false}, true, "40 88 25a8 49e9 5ba9 7d7f 89 25a8 49e9 5bb8 e8b4 bf"},
-
- // Without indexing
- {HeaderField{"custom-key", "custom-value", false}, false, "00 88 25a8 49e9 5ba9 7d7f 89 25a8 49e9 5bb8 e8b4 bf"},
-
- // Never indexed
- {HeaderField{"custom-key", "custom-value", true}, true, "10 88 25a8 49e9 5ba9 7d7f 89 25a8 49e9 5bb8 e8b4 bf"},
- {HeaderField{"custom-key", "custom-value", true}, false, "10 88 25a8 49e9 5ba9 7d7f 89 25a8 49e9 5bb8 e8b4 bf"},
- }
- for _, tt := range tests {
- want := removeSpace(tt.wantHex)
- buf := appendNewName(nil, tt.f, tt.indexing)
- if got := hex.EncodeToString(buf); want != got {
- t.Errorf("appendNewName(nil, %+v, %v) = %q; want %q", tt.f, tt.indexing, got, want)
- }
- }
-}
-
-func TestAppendIndexedName(t *testing.T) {
- tests := []struct {
- f HeaderField
- i uint64
- indexing bool
- wantHex string
- }{
- // Incremental indexing
- {HeaderField{":status", "302", false}, 8, true, "48 82 6402"},
-
- // Without indexing
- {HeaderField{":status", "302", false}, 8, false, "08 82 6402"},
-
- // Never indexed
- {HeaderField{":status", "302", true}, 8, true, "18 82 6402"},
- {HeaderField{":status", "302", true}, 8, false, "18 82 6402"},
- }
- for _, tt := range tests {
- want := removeSpace(tt.wantHex)
- buf := appendIndexedName(nil, tt.f, tt.i, tt.indexing)
- if got := hex.EncodeToString(buf); want != got {
- t.Errorf("appendIndexedName(nil, %+v, %v) = %q; want %q", tt.f, tt.indexing, got, want)
- }
- }
-}
-
-func TestAppendTableSize(t *testing.T) {
- tests := []struct {
- i uint32
- wantHex string
- }{
- // Fits into 1 byte
- {30, "3e"},
-
- // Extra byte
- {31, "3f00"},
- {32, "3f01"},
- }
- for _, tt := range tests {
- want := removeSpace(tt.wantHex)
- buf := appendTableSize(nil, tt.i)
- if got := hex.EncodeToString(buf); want != got {
- t.Errorf("appendTableSize(nil, %v) = %q; want %q", tt.i, got, want)
- }
- }
-}
-
-func TestEncoderSetMaxDynamicTableSize(t *testing.T) {
- var buf bytes.Buffer
- e := NewEncoder(&buf)
- tests := []struct {
- v uint32
- wantUpdate bool
- wantMinSize uint32
- wantMaxSize uint32
- }{
- // Set new table size to 2048
- {2048, true, 2048, 2048},
-
- // Set new table size to 16384, but still limited to
- // 4096
- {16384, true, 2048, 4096},
- }
- for _, tt := range tests {
- e.SetMaxDynamicTableSize(tt.v)
- if got := e.tableSizeUpdate; tt.wantUpdate != got {
- t.Errorf("e.tableSizeUpdate = %v; want %v", got, tt.wantUpdate)
- }
- if got := e.minSize; tt.wantMinSize != got {
- t.Errorf("e.minSize = %v; want %v", got, tt.wantMinSize)
- }
- if got := e.dynTab.maxSize; tt.wantMaxSize != got {
- t.Errorf("e.maxSize = %v; want %v", got, tt.wantMaxSize)
- }
- }
-}
-
-func TestEncoderSetMaxDynamicTableSizeLimit(t *testing.T) {
- e := NewEncoder(nil)
- // 4095 < initialHeaderTableSize means maxSize is truncated to
- // 4095.
- e.SetMaxDynamicTableSizeLimit(4095)
- if got, want := e.dynTab.maxSize, uint32(4095); got != want {
- t.Errorf("e.dynTab.maxSize = %v; want %v", got, want)
- }
- if got, want := e.maxSizeLimit, uint32(4095); got != want {
- t.Errorf("e.maxSizeLimit = %v; want %v", got, want)
- }
- if got, want := e.tableSizeUpdate, true; got != want {
- t.Errorf("e.tableSizeUpdate = %v; want %v", got, want)
- }
- // maxSize will be truncated to maxSizeLimit
- e.SetMaxDynamicTableSize(16384)
- if got, want := e.dynTab.maxSize, uint32(4095); got != want {
- t.Errorf("e.dynTab.maxSize = %v; want %v", got, want)
- }
- // 8192 > current maxSizeLimit, so maxSize does not change.
- e.SetMaxDynamicTableSizeLimit(8192)
- if got, want := e.dynTab.maxSize, uint32(4095); got != want {
- t.Errorf("e.dynTab.maxSize = %v; want %v", got, want)
- }
- if got, want := e.maxSizeLimit, uint32(8192); got != want {
- t.Errorf("e.maxSizeLimit = %v; want %v", got, want)
- }
-}
-
-func removeSpace(s string) string {
- return strings.Replace(s, " ", "", -1)
-}
-
-func BenchmarkEncoderSearchTable(b *testing.B) {
- e := NewEncoder(nil)
-
- // A sample of possible header fields.
- // This is not based on any actual data from HTTP/2 traces.
- var possible []HeaderField
- for _, f := range staticTable.ents {
- if f.Value == "" {
- possible = append(possible, f)
- continue
- }
- // Generate 5 random values, except for cookie and set-cookie,
- // which we know can have many values in practice.
- num := 5
- if f.Name == "cookie" || f.Name == "set-cookie" {
- num = 25
- }
- for i := 0; i < num; i++ {
- f.Value = fmt.Sprintf("%s-%d", f.Name, i)
- possible = append(possible, f)
- }
- }
- for k := 0; k < 10; k++ {
- f := HeaderField{
- Name: fmt.Sprintf("x-header-%d", k),
- Sensitive: rand.Int()%2 == 0,
- }
- for i := 0; i < 5; i++ {
- f.Value = fmt.Sprintf("%s-%d", f.Name, i)
- possible = append(possible, f)
- }
- }
-
- // Add a random sample to the dynamic table. This very loosely simulates
- // a history of 100 requests with 20 header fields per request.
- for r := 0; r < 100*20; r++ {
- f := possible[rand.Int31n(int32(len(possible)))]
- // Skip if this is in the staticTable verbatim.
- if _, has := staticTable.search(f); !has {
- e.dynTab.add(f)
- }
- }
-
- b.ResetTimer()
- for n := 0; n < b.N; n++ {
- for _, f := range possible {
- e.searchTable(f)
- }
- }
-}
diff --git a/vendor/golang.org/x/net/http2/hpack/hpack_test.go b/vendor/golang.org/x/net/http2/hpack/hpack_test.go
deleted file mode 100644
index 974c35f08..000000000
--- a/vendor/golang.org/x/net/http2/hpack/hpack_test.go
+++ /dev/null
@@ -1,741 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package hpack
-
-import (
- "bytes"
- "encoding/hex"
- "fmt"
- "math/rand"
- "reflect"
- "strings"
- "testing"
- "time"
-)
-
-func (d *Decoder) mustAt(idx int) HeaderField {
- if hf, ok := d.at(uint64(idx)); !ok {
- panic(fmt.Sprintf("bogus index %d", idx))
- } else {
- return hf
- }
-}
-
-func TestDynamicTableAt(t *testing.T) {
- d := NewDecoder(4096, nil)
- at := d.mustAt
- if got, want := at(2), (pair(":method", "GET")); got != want {
- t.Errorf("at(2) = %v; want %v", got, want)
- }
- d.dynTab.add(pair("foo", "bar"))
- d.dynTab.add(pair("blake", "miz"))
- if got, want := at(staticTable.len()+1), (pair("blake", "miz")); got != want {
- t.Errorf("at(dyn 1) = %v; want %v", got, want)
- }
- if got, want := at(staticTable.len()+2), (pair("foo", "bar")); got != want {
- t.Errorf("at(dyn 2) = %v; want %v", got, want)
- }
- if got, want := at(3), (pair(":method", "POST")); got != want {
- t.Errorf("at(3) = %v; want %v", got, want)
- }
-}
-
-func TestDynamicTableSizeEvict(t *testing.T) {
- d := NewDecoder(4096, nil)
- if want := uint32(0); d.dynTab.size != want {
- t.Fatalf("size = %d; want %d", d.dynTab.size, want)
- }
- add := d.dynTab.add
- add(pair("blake", "eats pizza"))
- if want := uint32(15 + 32); d.dynTab.size != want {
- t.Fatalf("after pizza, size = %d; want %d", d.dynTab.size, want)
- }
- add(pair("foo", "bar"))
- if want := uint32(15 + 32 + 6 + 32); d.dynTab.size != want {
- t.Fatalf("after foo bar, size = %d; want %d", d.dynTab.size, want)
- }
- d.dynTab.setMaxSize(15 + 32 + 1 /* slop */)
- if want := uint32(6 + 32); d.dynTab.size != want {
- t.Fatalf("after setMaxSize, size = %d; want %d", d.dynTab.size, want)
- }
- if got, want := d.mustAt(staticTable.len()+1), (pair("foo", "bar")); got != want {
- t.Errorf("at(dyn 1) = %v; want %v", got, want)
- }
- add(pair("long", strings.Repeat("x", 500)))
- if want := uint32(0); d.dynTab.size != want {
- t.Fatalf("after big one, size = %d; want %d", d.dynTab.size, want)
- }
-}
-
-func TestDecoderDecode(t *testing.T) {
- tests := []struct {
- name string
- in []byte
- want []HeaderField
- wantDynTab []HeaderField // newest entry first
- }{
- // C.2.1 Literal Header Field with Indexing
- // http://http2.github.io/http2-spec/compression.html#rfc.section.C.2.1
- {"C.2.1", dehex("400a 6375 7374 6f6d 2d6b 6579 0d63 7573 746f 6d2d 6865 6164 6572"),
- []HeaderField{pair("custom-key", "custom-header")},
- []HeaderField{pair("custom-key", "custom-header")},
- },
-
- // C.2.2 Literal Header Field without Indexing
- // http://http2.github.io/http2-spec/compression.html#rfc.section.C.2.2
- {"C.2.2", dehex("040c 2f73 616d 706c 652f 7061 7468"),
- []HeaderField{pair(":path", "/sample/path")},
- []HeaderField{}},
-
- // C.2.3 Literal Header Field never Indexed
- // http://http2.github.io/http2-spec/compression.html#rfc.section.C.2.3
- {"C.2.3", dehex("1008 7061 7373 776f 7264 0673 6563 7265 74"),
- []HeaderField{{"password", "secret", true}},
- []HeaderField{}},
-
- // C.2.4 Indexed Header Field
- // http://http2.github.io/http2-spec/compression.html#rfc.section.C.2.4
- {"C.2.4", []byte("\x82"),
- []HeaderField{pair(":method", "GET")},
- []HeaderField{}},
- }
- for _, tt := range tests {
- d := NewDecoder(4096, nil)
- hf, err := d.DecodeFull(tt.in)
- if err != nil {
- t.Errorf("%s: %v", tt.name, err)
- continue
- }
- if !reflect.DeepEqual(hf, tt.want) {
- t.Errorf("%s: Got %v; want %v", tt.name, hf, tt.want)
- }
- gotDynTab := d.dynTab.reverseCopy()
- if !reflect.DeepEqual(gotDynTab, tt.wantDynTab) {
- t.Errorf("%s: dynamic table after = %v; want %v", tt.name, gotDynTab, tt.wantDynTab)
- }
- }
-}
-
-func (dt *dynamicTable) reverseCopy() (hf []HeaderField) {
- hf = make([]HeaderField, len(dt.table.ents))
- for i := range hf {
- hf[i] = dt.table.ents[len(dt.table.ents)-1-i]
- }
- return
-}
-
-type encAndWant struct {
- enc []byte
- want []HeaderField
- wantDynTab []HeaderField
- wantDynSize uint32
-}
-
-// C.3 Request Examples without Huffman Coding
-// http://http2.github.io/http2-spec/compression.html#rfc.section.C.3
-func TestDecodeC3_NoHuffman(t *testing.T) {
- testDecodeSeries(t, 4096, []encAndWant{
- {dehex("8286 8441 0f77 7777 2e65 7861 6d70 6c65 2e63 6f6d"),
- []HeaderField{
- pair(":method", "GET"),
- pair(":scheme", "http"),
- pair(":path", "/"),
- pair(":authority", "www.example.com"),
- },
- []HeaderField{
- pair(":authority", "www.example.com"),
- },
- 57,
- },
- {dehex("8286 84be 5808 6e6f 2d63 6163 6865"),
- []HeaderField{
- pair(":method", "GET"),
- pair(":scheme", "http"),
- pair(":path", "/"),
- pair(":authority", "www.example.com"),
- pair("cache-control", "no-cache"),
- },
- []HeaderField{
- pair("cache-control", "no-cache"),
- pair(":authority", "www.example.com"),
- },
- 110,
- },
- {dehex("8287 85bf 400a 6375 7374 6f6d 2d6b 6579 0c63 7573 746f 6d2d 7661 6c75 65"),
- []HeaderField{
- pair(":method", "GET"),
- pair(":scheme", "https"),
- pair(":path", "/index.html"),
- pair(":authority", "www.example.com"),
- pair("custom-key", "custom-value"),
- },
- []HeaderField{
- pair("custom-key", "custom-value"),
- pair("cache-control", "no-cache"),
- pair(":authority", "www.example.com"),
- },
- 164,
- },
- })
-}
-
-// C.4 Request Examples with Huffman Coding
-// http://http2.github.io/http2-spec/compression.html#rfc.section.C.4
-func TestDecodeC4_Huffman(t *testing.T) {
- testDecodeSeries(t, 4096, []encAndWant{
- {dehex("8286 8441 8cf1 e3c2 e5f2 3a6b a0ab 90f4 ff"),
- []HeaderField{
- pair(":method", "GET"),
- pair(":scheme", "http"),
- pair(":path", "/"),
- pair(":authority", "www.example.com"),
- },
- []HeaderField{
- pair(":authority", "www.example.com"),
- },
- 57,
- },
- {dehex("8286 84be 5886 a8eb 1064 9cbf"),
- []HeaderField{
- pair(":method", "GET"),
- pair(":scheme", "http"),
- pair(":path", "/"),
- pair(":authority", "www.example.com"),
- pair("cache-control", "no-cache"),
- },
- []HeaderField{
- pair("cache-control", "no-cache"),
- pair(":authority", "www.example.com"),
- },
- 110,
- },
- {dehex("8287 85bf 4088 25a8 49e9 5ba9 7d7f 8925 a849 e95b b8e8 b4bf"),
- []HeaderField{
- pair(":method", "GET"),
- pair(":scheme", "https"),
- pair(":path", "/index.html"),
- pair(":authority", "www.example.com"),
- pair("custom-key", "custom-value"),
- },
- []HeaderField{
- pair("custom-key", "custom-value"),
- pair("cache-control", "no-cache"),
- pair(":authority", "www.example.com"),
- },
- 164,
- },
- })
-}
-
-// http://http2.github.io/http2-spec/compression.html#rfc.section.C.5
-// "This section shows several consecutive header lists, corresponding
-// to HTTP responses, on the same connection. The HTTP/2 setting
-// parameter SETTINGS_HEADER_TABLE_SIZE is set to the value of 256
-// octets, causing some evictions to occur."
-func TestDecodeC5_ResponsesNoHuff(t *testing.T) {
- testDecodeSeries(t, 256, []encAndWant{
- {dehex(`
-4803 3330 3258 0770 7269 7661 7465 611d
-4d6f 6e2c 2032 3120 4f63 7420 3230 3133
-2032 303a 3133 3a32 3120 474d 546e 1768
-7474 7073 3a2f 2f77 7777 2e65 7861 6d70
-6c65 2e63 6f6d
-`),
- []HeaderField{
- pair(":status", "302"),
- pair("cache-control", "private"),
- pair("date", "Mon, 21 Oct 2013 20:13:21 GMT"),
- pair("location", "https://www.example.com"),
- },
- []HeaderField{
- pair("location", "https://www.example.com"),
- pair("date", "Mon, 21 Oct 2013 20:13:21 GMT"),
- pair("cache-control", "private"),
- pair(":status", "302"),
- },
- 222,
- },
- {dehex("4803 3330 37c1 c0bf"),
- []HeaderField{
- pair(":status", "307"),
- pair("cache-control", "private"),
- pair("date", "Mon, 21 Oct 2013 20:13:21 GMT"),
- pair("location", "https://www.example.com"),
- },
- []HeaderField{
- pair(":status", "307"),
- pair("location", "https://www.example.com"),
- pair("date", "Mon, 21 Oct 2013 20:13:21 GMT"),
- pair("cache-control", "private"),
- },
- 222,
- },
- {dehex(`
-88c1 611d 4d6f 6e2c 2032 3120 4f63 7420
-3230 3133 2032 303a 3133 3a32 3220 474d
-54c0 5a04 677a 6970 7738 666f 6f3d 4153
-444a 4b48 514b 425a 584f 5157 454f 5049
-5541 5851 5745 4f49 553b 206d 6178 2d61
-6765 3d33 3630 303b 2076 6572 7369 6f6e
-3d31
-`),
- []HeaderField{
- pair(":status", "200"),
- pair("cache-control", "private"),
- pair("date", "Mon, 21 Oct 2013 20:13:22 GMT"),
- pair("location", "https://www.example.com"),
- pair("content-encoding", "gzip"),
- pair("set-cookie", "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1"),
- },
- []HeaderField{
- pair("set-cookie", "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1"),
- pair("content-encoding", "gzip"),
- pair("date", "Mon, 21 Oct 2013 20:13:22 GMT"),
- },
- 215,
- },
- })
-}
-
-// http://http2.github.io/http2-spec/compression.html#rfc.section.C.6
-// "This section shows the same examples as the previous section, but
-// using Huffman encoding for the literal values. The HTTP/2 setting
-// parameter SETTINGS_HEADER_TABLE_SIZE is set to the value of 256
-// octets, causing some evictions to occur. The eviction mechanism
-// uses the length of the decoded literal values, so the same
-// evictions occurs as in the previous section."
-func TestDecodeC6_ResponsesHuffman(t *testing.T) {
- testDecodeSeries(t, 256, []encAndWant{
- {dehex(`
-4882 6402 5885 aec3 771a 4b61 96d0 7abe
-9410 54d4 44a8 2005 9504 0b81 66e0 82a6
-2d1b ff6e 919d 29ad 1718 63c7 8f0b 97c8
-e9ae 82ae 43d3
-`),
- []HeaderField{
- pair(":status", "302"),
- pair("cache-control", "private"),
- pair("date", "Mon, 21 Oct 2013 20:13:21 GMT"),
- pair("location", "https://www.example.com"),
- },
- []HeaderField{
- pair("location", "https://www.example.com"),
- pair("date", "Mon, 21 Oct 2013 20:13:21 GMT"),
- pair("cache-control", "private"),
- pair(":status", "302"),
- },
- 222,
- },
- {dehex("4883 640e ffc1 c0bf"),
- []HeaderField{
- pair(":status", "307"),
- pair("cache-control", "private"),
- pair("date", "Mon, 21 Oct 2013 20:13:21 GMT"),
- pair("location", "https://www.example.com"),
- },
- []HeaderField{
- pair(":status", "307"),
- pair("location", "https://www.example.com"),
- pair("date", "Mon, 21 Oct 2013 20:13:21 GMT"),
- pair("cache-control", "private"),
- },
- 222,
- },
- {dehex(`
-88c1 6196 d07a be94 1054 d444 a820 0595
-040b 8166 e084 a62d 1bff c05a 839b d9ab
-77ad 94e7 821d d7f2 e6c7 b335 dfdf cd5b
-3960 d5af 2708 7f36 72c1 ab27 0fb5 291f
-9587 3160 65c0 03ed 4ee5 b106 3d50 07
-`),
- []HeaderField{
- pair(":status", "200"),
- pair("cache-control", "private"),
- pair("date", "Mon, 21 Oct 2013 20:13:22 GMT"),
- pair("location", "https://www.example.com"),
- pair("content-encoding", "gzip"),
- pair("set-cookie", "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1"),
- },
- []HeaderField{
- pair("set-cookie", "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1"),
- pair("content-encoding", "gzip"),
- pair("date", "Mon, 21 Oct 2013 20:13:22 GMT"),
- },
- 215,
- },
- })
-}
-
-func testDecodeSeries(t *testing.T, size uint32, steps []encAndWant) {
- d := NewDecoder(size, nil)
- for i, step := range steps {
- hf, err := d.DecodeFull(step.enc)
- if err != nil {
- t.Fatalf("Error at step index %d: %v", i, err)
- }
- if !reflect.DeepEqual(hf, step.want) {
- t.Fatalf("At step index %d: Got headers %v; want %v", i, hf, step.want)
- }
- gotDynTab := d.dynTab.reverseCopy()
- if !reflect.DeepEqual(gotDynTab, step.wantDynTab) {
- t.Errorf("After step index %d, dynamic table = %v; want %v", i, gotDynTab, step.wantDynTab)
- }
- if d.dynTab.size != step.wantDynSize {
- t.Errorf("After step index %d, dynamic table size = %v; want %v", i, d.dynTab.size, step.wantDynSize)
- }
- }
-}
-
-func TestHuffmanDecodeExcessPadding(t *testing.T) {
- tests := [][]byte{
- {0xff}, // Padding Exceeds 7 bits
- {0x1f, 0xff}, // {"a", 1 byte excess padding}
- {0x1f, 0xff, 0xff}, // {"a", 2 byte excess padding}
- {0x1f, 0xff, 0xff, 0xff}, // {"a", 3 byte excess padding}
- {0xff, 0x9f, 0xff, 0xff, 0xff}, // {"a", 29 bit excess padding}
- {'R', 0xbc, '0', 0xff, 0xff, 0xff, 0xff}, // Padding ends on partial symbol.
- }
- for i, in := range tests {
- var buf bytes.Buffer
- if _, err := HuffmanDecode(&buf, in); err != ErrInvalidHuffman {
- t.Errorf("test-%d: decode(%q) = %v; want ErrInvalidHuffman", i, in, err)
- }
- }
-}
-
-func TestHuffmanDecodeEOS(t *testing.T) {
- in := []byte{0xff, 0xff, 0xff, 0xff, 0xfc} // {EOS, "?"}
- var buf bytes.Buffer
- if _, err := HuffmanDecode(&buf, in); err != ErrInvalidHuffman {
- t.Errorf("error = %v; want ErrInvalidHuffman", err)
- }
-}
-
-func TestHuffmanDecodeMaxLengthOnTrailingByte(t *testing.T) {
- in := []byte{0x00, 0x01} // {"0", "0", "0"}
- var buf bytes.Buffer
- if err := huffmanDecode(&buf, 2, in); err != ErrStringLength {
- t.Errorf("error = %v; want ErrStringLength", err)
- }
-}
-
-func TestHuffmanDecodeCorruptPadding(t *testing.T) {
- in := []byte{0x00}
- var buf bytes.Buffer
- if _, err := HuffmanDecode(&buf, in); err != ErrInvalidHuffman {
- t.Errorf("error = %v; want ErrInvalidHuffman", err)
- }
-}
-
-func TestHuffmanDecode(t *testing.T) {
- tests := []struct {
- inHex, want string
- }{
- {"f1e3 c2e5 f23a 6ba0 ab90 f4ff", "www.example.com"},
- {"a8eb 1064 9cbf", "no-cache"},
- {"25a8 49e9 5ba9 7d7f", "custom-key"},
- {"25a8 49e9 5bb8 e8b4 bf", "custom-value"},
- {"6402", "302"},
- {"aec3 771a 4b", "private"},
- {"d07a be94 1054 d444 a820 0595 040b 8166 e082 a62d 1bff", "Mon, 21 Oct 2013 20:13:21 GMT"},
- {"9d29 ad17 1863 c78f 0b97 c8e9 ae82 ae43 d3", "https://www.example.com"},
- {"9bd9 ab", "gzip"},
- {"94e7 821d d7f2 e6c7 b335 dfdf cd5b 3960 d5af 2708 7f36 72c1 ab27 0fb5 291f 9587 3160 65c0 03ed 4ee5 b106 3d50 07",
- "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1"},
- }
- for i, tt := range tests {
- var buf bytes.Buffer
- in, err := hex.DecodeString(strings.Replace(tt.inHex, " ", "", -1))
- if err != nil {
- t.Errorf("%d. hex input error: %v", i, err)
- continue
- }
- if _, err := HuffmanDecode(&buf, in); err != nil {
- t.Errorf("%d. decode error: %v", i, err)
- continue
- }
- if got := buf.String(); tt.want != got {
- t.Errorf("%d. decode = %q; want %q", i, got, tt.want)
- }
- }
-}
-
-func TestAppendHuffmanString(t *testing.T) {
- tests := []struct {
- in, want string
- }{
- {"www.example.com", "f1e3 c2e5 f23a 6ba0 ab90 f4ff"},
- {"no-cache", "a8eb 1064 9cbf"},
- {"custom-key", "25a8 49e9 5ba9 7d7f"},
- {"custom-value", "25a8 49e9 5bb8 e8b4 bf"},
- {"302", "6402"},
- {"private", "aec3 771a 4b"},
- {"Mon, 21 Oct 2013 20:13:21 GMT", "d07a be94 1054 d444 a820 0595 040b 8166 e082 a62d 1bff"},
- {"https://www.example.com", "9d29 ad17 1863 c78f 0b97 c8e9 ae82 ae43 d3"},
- {"gzip", "9bd9 ab"},
- {"foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1",
- "94e7 821d d7f2 e6c7 b335 dfdf cd5b 3960 d5af 2708 7f36 72c1 ab27 0fb5 291f 9587 3160 65c0 03ed 4ee5 b106 3d50 07"},
- }
- for i, tt := range tests {
- buf := []byte{}
- want := strings.Replace(tt.want, " ", "", -1)
- buf = AppendHuffmanString(buf, tt.in)
- if got := hex.EncodeToString(buf); want != got {
- t.Errorf("%d. encode = %q; want %q", i, got, want)
- }
- }
-}
-
-func TestHuffmanMaxStrLen(t *testing.T) {
- const msg = "Some string"
- huff := AppendHuffmanString(nil, msg)
-
- testGood := func(max int) {
- var out bytes.Buffer
- if err := huffmanDecode(&out, max, huff); err != nil {
- t.Errorf("For maxLen=%d, unexpected error: %v", max, err)
- }
- if out.String() != msg {
- t.Errorf("For maxLen=%d, out = %q; want %q", max, out.String(), msg)
- }
- }
- testGood(0)
- testGood(len(msg))
- testGood(len(msg) + 1)
-
- var out bytes.Buffer
- if err := huffmanDecode(&out, len(msg)-1, huff); err != ErrStringLength {
- t.Errorf("err = %v; want ErrStringLength", err)
- }
-}
-
-func TestHuffmanRoundtripStress(t *testing.T) {
- const Len = 50 // of uncompressed string
- input := make([]byte, Len)
- var output bytes.Buffer
- var huff []byte
-
- n := 5000
- if testing.Short() {
- n = 100
- }
- seed := time.Now().UnixNano()
- t.Logf("Seed = %v", seed)
- src := rand.New(rand.NewSource(seed))
- var encSize int64
- for i := 0; i < n; i++ {
- for l := range input {
- input[l] = byte(src.Intn(256))
- }
- huff = AppendHuffmanString(huff[:0], string(input))
- encSize += int64(len(huff))
- output.Reset()
- if err := huffmanDecode(&output, 0, huff); err != nil {
- t.Errorf("Failed to decode %q -> %q -> error %v", input, huff, err)
- continue
- }
- if !bytes.Equal(output.Bytes(), input) {
- t.Errorf("Roundtrip failure on %q -> %q -> %q", input, huff, output.Bytes())
- }
- }
- t.Logf("Compressed size of original: %0.02f%% (%v -> %v)", 100*(float64(encSize)/(Len*float64(n))), Len*n, encSize)
-}
-
-func TestHuffmanDecodeFuzz(t *testing.T) {
- const Len = 50 // of compressed
- var buf, zbuf bytes.Buffer
-
- n := 5000
- if testing.Short() {
- n = 100
- }
- seed := time.Now().UnixNano()
- t.Logf("Seed = %v", seed)
- src := rand.New(rand.NewSource(seed))
- numFail := 0
- for i := 0; i < n; i++ {
- zbuf.Reset()
- if i == 0 {
- // Start with at least one invalid one.
- zbuf.WriteString("00\x91\xff\xff\xff\xff\xc8")
- } else {
- for l := 0; l < Len; l++ {
- zbuf.WriteByte(byte(src.Intn(256)))
- }
- }
-
- buf.Reset()
- if err := huffmanDecode(&buf, 0, zbuf.Bytes()); err != nil {
- if err == ErrInvalidHuffman {
- numFail++
- continue
- }
- t.Errorf("Failed to decode %q: %v", zbuf.Bytes(), err)
- continue
- }
- }
- t.Logf("%0.02f%% are invalid (%d / %d)", 100*float64(numFail)/float64(n), numFail, n)
- if numFail < 1 {
- t.Error("expected at least one invalid huffman encoding (test starts with one)")
- }
-}
-
-func TestReadVarInt(t *testing.T) {
- type res struct {
- i uint64
- consumed int
- err error
- }
- tests := []struct {
- n byte
- p []byte
- want res
- }{
- // Fits in a byte:
- {1, []byte{0}, res{0, 1, nil}},
- {2, []byte{2}, res{2, 1, nil}},
- {3, []byte{6}, res{6, 1, nil}},
- {4, []byte{14}, res{14, 1, nil}},
- {5, []byte{30}, res{30, 1, nil}},
- {6, []byte{62}, res{62, 1, nil}},
- {7, []byte{126}, res{126, 1, nil}},
- {8, []byte{254}, res{254, 1, nil}},
-
- // Doesn't fit in a byte:
- {1, []byte{1}, res{0, 0, errNeedMore}},
- {2, []byte{3}, res{0, 0, errNeedMore}},
- {3, []byte{7}, res{0, 0, errNeedMore}},
- {4, []byte{15}, res{0, 0, errNeedMore}},
- {5, []byte{31}, res{0, 0, errNeedMore}},
- {6, []byte{63}, res{0, 0, errNeedMore}},
- {7, []byte{127}, res{0, 0, errNeedMore}},
- {8, []byte{255}, res{0, 0, errNeedMore}},
-
- // Ignoring top bits:
- {5, []byte{255, 154, 10}, res{1337, 3, nil}}, // high dummy three bits: 111
- {5, []byte{159, 154, 10}, res{1337, 3, nil}}, // high dummy three bits: 100
- {5, []byte{191, 154, 10}, res{1337, 3, nil}}, // high dummy three bits: 101
-
- // Extra byte:
- {5, []byte{191, 154, 10, 2}, res{1337, 3, nil}}, // extra byte
-
- // Short a byte:
- {5, []byte{191, 154}, res{0, 0, errNeedMore}},
-
- // integer overflow:
- {1, []byte{255, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}, res{0, 0, errVarintOverflow}},
- }
- for _, tt := range tests {
- i, remain, err := readVarInt(tt.n, tt.p)
- consumed := len(tt.p) - len(remain)
- got := res{i, consumed, err}
- if got != tt.want {
- t.Errorf("readVarInt(%d, %v ~ %x) = %+v; want %+v", tt.n, tt.p, tt.p, got, tt.want)
- }
- }
-}
-
-// Fuzz crash, originally reported at https://github.com/bradfitz/http2/issues/56
-func TestHuffmanFuzzCrash(t *testing.T) {
- got, err := HuffmanDecodeToString([]byte("00\x91\xff\xff\xff\xff\xc8"))
- if got != "" {
- t.Errorf("Got %q; want empty string", got)
- }
- if err != ErrInvalidHuffman {
- t.Errorf("Err = %v; want ErrInvalidHuffman", err)
- }
-}
-
-func pair(name, value string) HeaderField {
- return HeaderField{Name: name, Value: value}
-}
-
-func dehex(s string) []byte {
- s = strings.Replace(s, " ", "", -1)
- s = strings.Replace(s, "\n", "", -1)
- b, err := hex.DecodeString(s)
- if err != nil {
- panic(err)
- }
- return b
-}
-
-func TestEmitEnabled(t *testing.T) {
- var buf bytes.Buffer
- enc := NewEncoder(&buf)
- enc.WriteField(HeaderField{Name: "foo", Value: "bar"})
- enc.WriteField(HeaderField{Name: "foo", Value: "bar"})
-
- numCallback := 0
- var dec *Decoder
- dec = NewDecoder(8<<20, func(HeaderField) {
- numCallback++
- dec.SetEmitEnabled(false)
- })
- if !dec.EmitEnabled() {
- t.Errorf("initial emit enabled = false; want true")
- }
- if _, err := dec.Write(buf.Bytes()); err != nil {
- t.Error(err)
- }
- if numCallback != 1 {
- t.Errorf("num callbacks = %d; want 1", numCallback)
- }
- if dec.EmitEnabled() {
- t.Errorf("emit enabled = true; want false")
- }
-}
-
-func TestSaveBufLimit(t *testing.T) {
- const maxStr = 1 << 10
- var got []HeaderField
- dec := NewDecoder(initialHeaderTableSize, func(hf HeaderField) {
- got = append(got, hf)
- })
- dec.SetMaxStringLength(maxStr)
- var frag []byte
- frag = append(frag[:0], encodeTypeByte(false, false))
- frag = appendVarInt(frag, 7, 3)
- frag = append(frag, "foo"...)
- frag = appendVarInt(frag, 7, 3)
- frag = append(frag, "bar"...)
-
- if _, err := dec.Write(frag); err != nil {
- t.Fatal(err)
- }
-
- want := []HeaderField{{Name: "foo", Value: "bar"}}
- if !reflect.DeepEqual(got, want) {
- t.Errorf("After small writes, got %v; want %v", got, want)
- }
-
- frag = append(frag[:0], encodeTypeByte(false, false))
- frag = appendVarInt(frag, 7, maxStr*3)
- frag = append(frag, make([]byte, maxStr*3)...)
-
- _, err := dec.Write(frag)
- if err != ErrStringLength {
- t.Fatalf("Write error = %v; want ErrStringLength", err)
- }
-}
-
-func TestDynamicSizeUpdate(t *testing.T) {
- var buf bytes.Buffer
- enc := NewEncoder(&buf)
- enc.SetMaxDynamicTableSize(255)
- enc.WriteField(HeaderField{Name: "foo", Value: "bar"})
-
- d := NewDecoder(4096, nil)
- _, err := d.DecodeFull(buf.Bytes())
- if err != nil {
- t.Fatalf("unexpected error: got = %v", err)
- }
-
- // must fail since the dynamic table update must be at the beginning
- _, err = d.DecodeFull(buf.Bytes())
- if err == nil {
- t.Fatalf("dynamic table size update not at the beginning of a header block")
- }
-}
diff --git a/vendor/golang.org/x/net/http2/hpack/tables_test.go b/vendor/golang.org/x/net/http2/hpack/tables_test.go
deleted file mode 100644
index d963f3635..000000000
--- a/vendor/golang.org/x/net/http2/hpack/tables_test.go
+++ /dev/null
@@ -1,214 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package hpack
-
-import (
- "bufio"
- "regexp"
- "strconv"
- "strings"
- "testing"
-)
-
-func TestHeaderFieldTable(t *testing.T) {
- table := &headerFieldTable{}
- table.init()
- table.addEntry(pair("key1", "value1-1"))
- table.addEntry(pair("key2", "value2-1"))
- table.addEntry(pair("key1", "value1-2"))
- table.addEntry(pair("key3", "value3-1"))
- table.addEntry(pair("key4", "value4-1"))
- table.addEntry(pair("key2", "value2-2"))
-
- // Tests will be run twice: once before evicting anything, and
- // again after evicting the three oldest entries.
- tests := []struct {
- f HeaderField
- beforeWantStaticI uint64
- beforeWantMatch bool
- afterWantStaticI uint64
- afterWantMatch bool
- }{
- {HeaderField{"key1", "value1-1", false}, 1, true, 0, false},
- {HeaderField{"key1", "value1-2", false}, 3, true, 0, false},
- {HeaderField{"key1", "value1-3", false}, 3, false, 0, false},
- {HeaderField{"key2", "value2-1", false}, 2, true, 3, false},
- {HeaderField{"key2", "value2-2", false}, 6, true, 3, true},
- {HeaderField{"key2", "value2-3", false}, 6, false, 3, false},
- {HeaderField{"key4", "value4-1", false}, 5, true, 2, true},
- // Name match only, because sensitive.
- {HeaderField{"key4", "value4-1", true}, 5, false, 2, false},
- // Key not found.
- {HeaderField{"key5", "value5-x", false}, 0, false, 0, false},
- }
-
- staticToDynamic := func(i uint64) uint64 {
- if i == 0 {
- return 0
- }
- return uint64(table.len()) - i + 1 // dynamic is the reversed table
- }
-
- searchStatic := func(f HeaderField) (uint64, bool) {
- old := staticTable
- staticTable = table
- defer func() { staticTable = old }()
- return staticTable.search(f)
- }
-
- searchDynamic := func(f HeaderField) (uint64, bool) {
- return table.search(f)
- }
-
- for _, test := range tests {
- gotI, gotMatch := searchStatic(test.f)
- if wantI, wantMatch := test.beforeWantStaticI, test.beforeWantMatch; gotI != wantI || gotMatch != wantMatch {
- t.Errorf("before evictions: searchStatic(%+v)=%v,%v want %v,%v", test.f, gotI, gotMatch, wantI, wantMatch)
- }
- gotI, gotMatch = searchDynamic(test.f)
- wantDynamicI := staticToDynamic(test.beforeWantStaticI)
- if wantI, wantMatch := wantDynamicI, test.beforeWantMatch; gotI != wantI || gotMatch != wantMatch {
- t.Errorf("before evictions: searchDynamic(%+v)=%v,%v want %v,%v", test.f, gotI, gotMatch, wantI, wantMatch)
- }
- }
-
- table.evictOldest(3)
-
- for _, test := range tests {
- gotI, gotMatch := searchStatic(test.f)
- if wantI, wantMatch := test.afterWantStaticI, test.afterWantMatch; gotI != wantI || gotMatch != wantMatch {
- t.Errorf("after evictions: searchStatic(%+v)=%v,%v want %v,%v", test.f, gotI, gotMatch, wantI, wantMatch)
- }
- gotI, gotMatch = searchDynamic(test.f)
- wantDynamicI := staticToDynamic(test.afterWantStaticI)
- if wantI, wantMatch := wantDynamicI, test.afterWantMatch; gotI != wantI || gotMatch != wantMatch {
- t.Errorf("after evictions: searchDynamic(%+v)=%v,%v want %v,%v", test.f, gotI, gotMatch, wantI, wantMatch)
- }
- }
-}
-
-func TestHeaderFieldTable_LookupMapEviction(t *testing.T) {
- table := &headerFieldTable{}
- table.init()
- table.addEntry(pair("key1", "value1-1"))
- table.addEntry(pair("key2", "value2-1"))
- table.addEntry(pair("key1", "value1-2"))
- table.addEntry(pair("key3", "value3-1"))
- table.addEntry(pair("key4", "value4-1"))
- table.addEntry(pair("key2", "value2-2"))
-
- // evict all pairs
- table.evictOldest(table.len())
-
- if l := table.len(); l > 0 {
- t.Errorf("table.len() = %d, want 0", l)
- }
-
- if l := len(table.byName); l > 0 {
- t.Errorf("len(table.byName) = %d, want 0", l)
- }
-
- if l := len(table.byNameValue); l > 0 {
- t.Errorf("len(table.byNameValue) = %d, want 0", l)
- }
-}
-
-func TestStaticTable(t *testing.T) {
- fromSpec := `
- +-------+-----------------------------+---------------+
- | 1 | :authority | |
- | 2 | :method | GET |
- | 3 | :method | POST |
- | 4 | :path | / |
- | 5 | :path | /index.html |
- | 6 | :scheme | http |
- | 7 | :scheme | https |
- | 8 | :status | 200 |
- | 9 | :status | 204 |
- | 10 | :status | 206 |
- | 11 | :status | 304 |
- | 12 | :status | 400 |
- | 13 | :status | 404 |
- | 14 | :status | 500 |
- | 15 | accept-charset | |
- | 16 | accept-encoding | gzip, deflate |
- | 17 | accept-language | |
- | 18 | accept-ranges | |
- | 19 | accept | |
- | 20 | access-control-allow-origin | |
- | 21 | age | |
- | 22 | allow | |
- | 23 | authorization | |
- | 24 | cache-control | |
- | 25 | content-disposition | |
- | 26 | content-encoding | |
- | 27 | content-language | |
- | 28 | content-length | |
- | 29 | content-location | |
- | 30 | content-range | |
- | 31 | content-type | |
- | 32 | cookie | |
- | 33 | date | |
- | 34 | etag | |
- | 35 | expect | |
- | 36 | expires | |
- | 37 | from | |
- | 38 | host | |
- | 39 | if-match | |
- | 40 | if-modified-since | |
- | 41 | if-none-match | |
- | 42 | if-range | |
- | 43 | if-unmodified-since | |
- | 44 | last-modified | |
- | 45 | link | |
- | 46 | location | |
- | 47 | max-forwards | |
- | 48 | proxy-authenticate | |
- | 49 | proxy-authorization | |
- | 50 | range | |
- | 51 | referer | |
- | 52 | refresh | |
- | 53 | retry-after | |
- | 54 | server | |
- | 55 | set-cookie | |
- | 56 | strict-transport-security | |
- | 57 | transfer-encoding | |
- | 58 | user-agent | |
- | 59 | vary | |
- | 60 | via | |
- | 61 | www-authenticate | |
- +-------+-----------------------------+---------------+
-`
- bs := bufio.NewScanner(strings.NewReader(fromSpec))
- re := regexp.MustCompile(`\| (\d+)\s+\| (\S+)\s*\| (\S(.*\S)?)?\s+\|`)
- for bs.Scan() {
- l := bs.Text()
- if !strings.Contains(l, "|") {
- continue
- }
- m := re.FindStringSubmatch(l)
- if m == nil {
- continue
- }
- i, err := strconv.Atoi(m[1])
- if err != nil {
- t.Errorf("Bogus integer on line %q", l)
- continue
- }
- if i < 1 || i > staticTable.len() {
- t.Errorf("Bogus index %d on line %q", i, l)
- continue
- }
- if got, want := staticTable.ents[i-1].Name, m[2]; got != want {
- t.Errorf("header index %d name = %q; want %q", i, got, want)
- }
- if got, want := staticTable.ents[i-1].Value, m[3]; got != want {
- t.Errorf("header index %d value = %q; want %q", i, got, want)
- }
- }
- if err := bs.Err(); err != nil {
- t.Error(err)
- }
-}
diff --git a/vendor/golang.org/x/net/http2/http2_test.go b/vendor/golang.org/x/net/http2/http2_test.go
deleted file mode 100644
index 667db4887..000000000
--- a/vendor/golang.org/x/net/http2/http2_test.go
+++ /dev/null
@@ -1,227 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package http2
-
-import (
- "bytes"
- "errors"
- "flag"
- "fmt"
- "net/http"
- "os/exec"
- "strconv"
- "strings"
- "testing"
- "time"
-
- "golang.org/x/net/http2/hpack"
-)
-
-var knownFailing = flag.Bool("known_failing", false, "Run known-failing tests.")
-
-func condSkipFailingTest(t *testing.T) {
- if !*knownFailing {
- t.Skip("Skipping known-failing test without --known_failing")
- }
-}
-
-func init() {
- inTests = true
- DebugGoroutines = true
- flag.BoolVar(&VerboseLogs, "verboseh2", VerboseLogs, "Verbose HTTP/2 debug logging")
-}
-
-func TestSettingString(t *testing.T) {
- tests := []struct {
- s Setting
- want string
- }{
- {Setting{SettingMaxFrameSize, 123}, "[MAX_FRAME_SIZE = 123]"},
- {Setting{1<<16 - 1, 123}, "[UNKNOWN_SETTING_65535 = 123]"},
- }
- for i, tt := range tests {
- got := fmt.Sprint(tt.s)
- if got != tt.want {
- t.Errorf("%d. for %#v, string = %q; want %q", i, tt.s, got, tt.want)
- }
- }
-}
-
-type twriter struct {
- t testing.TB
- st *serverTester // optional
-}
-
-func (w twriter) Write(p []byte) (n int, err error) {
- if w.st != nil {
- ps := string(p)
- for _, phrase := range w.st.logFilter {
- if strings.Contains(ps, phrase) {
- return len(p), nil // no logging
- }
- }
- }
- w.t.Logf("%s", p)
- return len(p), nil
-}
-
-// like encodeHeader, but don't add implicit pseudo headers.
-func encodeHeaderNoImplicit(t *testing.T, headers ...string) []byte {
- var buf bytes.Buffer
- enc := hpack.NewEncoder(&buf)
- for len(headers) > 0 {
- k, v := headers[0], headers[1]
- headers = headers[2:]
- if err := enc.WriteField(hpack.HeaderField{Name: k, Value: v}); err != nil {
- t.Fatalf("HPACK encoding error for %q/%q: %v", k, v, err)
- }
- }
- return buf.Bytes()
-}
-
-// Verify that curl has http2.
-func requireCurl(t *testing.T) {
- out, err := dockerLogs(curl(t, "--version"))
- if err != nil {
- t.Skipf("failed to determine curl features; skipping test")
- }
- if !strings.Contains(string(out), "HTTP2") {
- t.Skip("curl doesn't support HTTP2; skipping test")
- }
-}
-
-func curl(t *testing.T, args ...string) (container string) {
- out, err := exec.Command("docker", append([]string{"run", "-d", "--net=host", "gohttp2/curl"}, args...)...).Output()
- if err != nil {
- t.Skipf("Failed to run curl in docker: %v, %s", err, out)
- }
- return strings.TrimSpace(string(out))
-}
-
-// Verify that h2load exists.
-func requireH2load(t *testing.T) {
- out, err := dockerLogs(h2load(t, "--version"))
- if err != nil {
- t.Skipf("failed to probe h2load; skipping test: %s", out)
- }
- if !strings.Contains(string(out), "h2load nghttp2/") {
- t.Skipf("h2load not present; skipping test. (Output=%q)", out)
- }
-}
-
-func h2load(t *testing.T, args ...string) (container string) {
- out, err := exec.Command("docker", append([]string{"run", "-d", "--net=host", "--entrypoint=/usr/local/bin/h2load", "gohttp2/curl"}, args...)...).Output()
- if err != nil {
- t.Skipf("Failed to run h2load in docker: %v, %s", err, out)
- }
- return strings.TrimSpace(string(out))
-}
-
-type puppetCommand struct {
- fn func(w http.ResponseWriter, r *http.Request)
- done chan<- bool
-}
-
-type handlerPuppet struct {
- ch chan puppetCommand
-}
-
-func newHandlerPuppet() *handlerPuppet {
- return &handlerPuppet{
- ch: make(chan puppetCommand),
- }
-}
-
-func (p *handlerPuppet) act(w http.ResponseWriter, r *http.Request) {
- for cmd := range p.ch {
- cmd.fn(w, r)
- cmd.done <- true
- }
-}
-
-func (p *handlerPuppet) done() { close(p.ch) }
-func (p *handlerPuppet) do(fn func(http.ResponseWriter, *http.Request)) {
- done := make(chan bool)
- p.ch <- puppetCommand{fn, done}
- <-done
-}
-func dockerLogs(container string) ([]byte, error) {
- out, err := exec.Command("docker", "wait", container).CombinedOutput()
- if err != nil {
- return out, err
- }
- exitStatus, err := strconv.Atoi(strings.TrimSpace(string(out)))
- if err != nil {
- return out, errors.New("unexpected exit status from docker wait")
- }
- out, err = exec.Command("docker", "logs", container).CombinedOutput()
- exec.Command("docker", "rm", container).Run()
- if err == nil && exitStatus != 0 {
- err = fmt.Errorf("exit status %d: %s", exitStatus, out)
- }
- return out, err
-}
-
-func kill(container string) {
- exec.Command("docker", "kill", container).Run()
- exec.Command("docker", "rm", container).Run()
-}
-
-func cleanDate(res *http.Response) {
- if d := res.Header["Date"]; len(d) == 1 {
- d[0] = "XXX"
- }
-}
-
-func TestSorterPoolAllocs(t *testing.T) {
- ss := []string{"a", "b", "c"}
- h := http.Header{
- "a": nil,
- "b": nil,
- "c": nil,
- }
- sorter := new(sorter)
-
- if allocs := testing.AllocsPerRun(100, func() {
- sorter.SortStrings(ss)
- }); allocs >= 1 {
- t.Logf("SortStrings allocs = %v; want <1", allocs)
- }
-
- if allocs := testing.AllocsPerRun(5, func() {
- if len(sorter.Keys(h)) != 3 {
- t.Fatal("wrong result")
- }
- }); allocs > 0 {
- t.Logf("Keys allocs = %v; want <1", allocs)
- }
-}
-
-// waitCondition reports whether fn eventually returned true,
-// checking immediately and then every checkEvery amount,
-// until waitFor has elapsed, at which point it returns false.
-func waitCondition(waitFor, checkEvery time.Duration, fn func() bool) bool {
- deadline := time.Now().Add(waitFor)
- for time.Now().Before(deadline) {
- if fn() {
- return true
- }
- time.Sleep(checkEvery)
- }
- return false
-}
-
-// waitErrCondition is like waitCondition but with errors instead of bools.
-func waitErrCondition(waitFor, checkEvery time.Duration, fn func() error) error {
- deadline := time.Now().Add(waitFor)
- var err error
- for time.Now().Before(deadline) {
- if err = fn(); err == nil {
- return nil
- }
- time.Sleep(checkEvery)
- }
- return err
-}
diff --git a/vendor/golang.org/x/net/http2/pipe_test.go b/vendor/golang.org/x/net/http2/pipe_test.go
deleted file mode 100644
index 1bf351ff6..000000000
--- a/vendor/golang.org/x/net/http2/pipe_test.go
+++ /dev/null
@@ -1,130 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package http2
-
-import (
- "bytes"
- "errors"
- "io"
- "io/ioutil"
- "testing"
-)
-
-func TestPipeClose(t *testing.T) {
- var p pipe
- p.b = new(bytes.Buffer)
- a := errors.New("a")
- b := errors.New("b")
- p.CloseWithError(a)
- p.CloseWithError(b)
- _, err := p.Read(make([]byte, 1))
- if err != a {
- t.Errorf("err = %v want %v", err, a)
- }
-}
-
-func TestPipeDoneChan(t *testing.T) {
- var p pipe
- done := p.Done()
- select {
- case <-done:
- t.Fatal("done too soon")
- default:
- }
- p.CloseWithError(io.EOF)
- select {
- case <-done:
- default:
- t.Fatal("should be done")
- }
-}
-
-func TestPipeDoneChan_ErrFirst(t *testing.T) {
- var p pipe
- p.CloseWithError(io.EOF)
- done := p.Done()
- select {
- case <-done:
- default:
- t.Fatal("should be done")
- }
-}
-
-func TestPipeDoneChan_Break(t *testing.T) {
- var p pipe
- done := p.Done()
- select {
- case <-done:
- t.Fatal("done too soon")
- default:
- }
- p.BreakWithError(io.EOF)
- select {
- case <-done:
- default:
- t.Fatal("should be done")
- }
-}
-
-func TestPipeDoneChan_Break_ErrFirst(t *testing.T) {
- var p pipe
- p.BreakWithError(io.EOF)
- done := p.Done()
- select {
- case <-done:
- default:
- t.Fatal("should be done")
- }
-}
-
-func TestPipeCloseWithError(t *testing.T) {
- p := &pipe{b: new(bytes.Buffer)}
- const body = "foo"
- io.WriteString(p, body)
- a := errors.New("test error")
- p.CloseWithError(a)
- all, err := ioutil.ReadAll(p)
- if string(all) != body {
- t.Errorf("read bytes = %q; want %q", all, body)
- }
- if err != a {
- t.Logf("read error = %v, %v", err, a)
- }
- // Read and Write should fail.
- if n, err := p.Write([]byte("abc")); err != errClosedPipeWrite || n != 0 {
- t.Errorf("Write(abc) after close\ngot %v, %v\nwant 0, %v", n, err, errClosedPipeWrite)
- }
- if n, err := p.Read(make([]byte, 1)); err == nil || n != 0 {
- t.Errorf("Read() after close\ngot %v, nil\nwant 0, %v", n, errClosedPipeWrite)
- }
-}
-
-func TestPipeBreakWithError(t *testing.T) {
- p := &pipe{b: new(bytes.Buffer)}
- io.WriteString(p, "foo")
- a := errors.New("test err")
- p.BreakWithError(a)
- all, err := ioutil.ReadAll(p)
- if string(all) != "" {
- t.Errorf("read bytes = %q; want empty string", all)
- }
- if err != a {
- t.Logf("read error = %v, %v", err, a)
- }
- if p.b != nil {
- t.Errorf("buffer should be nil after BreakWithError")
- }
- // Write should succeed silently.
- if n, err := p.Write([]byte("abc")); err != nil || n != 3 {
- t.Errorf("Write(abc) after break\ngot %v, %v\nwant 0, nil", n, err)
- }
- if p.b != nil {
- t.Errorf("buffer should be nil after Write")
- }
- // Read should fail.
- if n, err := p.Read(make([]byte, 1)); err == nil || n != 0 {
- t.Errorf("Read() after close\ngot %v, nil\nwant 0, not nil", n)
- }
-}
diff --git a/vendor/golang.org/x/net/http2/server_push_test.go b/vendor/golang.org/x/net/http2/server_push_test.go
deleted file mode 100644
index 918fd30dc..000000000
--- a/vendor/golang.org/x/net/http2/server_push_test.go
+++ /dev/null
@@ -1,521 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.8
-
-package http2
-
-import (
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "net/http"
- "reflect"
- "strconv"
- "sync"
- "testing"
- "time"
-)
-
-func TestServer_Push_Success(t *testing.T) {
- const (
- mainBody = "<html>index page</html>"
- pushedBody = "<html>pushed page</html>"
- userAgent = "testagent"
- cookie = "testcookie"
- )
-
- var stURL string
- checkPromisedReq := func(r *http.Request, wantMethod string, wantH http.Header) error {
- if got, want := r.Method, wantMethod; got != want {
- return fmt.Errorf("promised Req.Method=%q, want %q", got, want)
- }
- if got, want := r.Header, wantH; !reflect.DeepEqual(got, want) {
- return fmt.Errorf("promised Req.Header=%q, want %q", got, want)
- }
- if got, want := "https://"+r.Host, stURL; got != want {
- return fmt.Errorf("promised Req.Host=%q, want %q", got, want)
- }
- if r.Body == nil {
- return fmt.Errorf("nil Body")
- }
- if buf, err := ioutil.ReadAll(r.Body); err != nil || len(buf) != 0 {
- return fmt.Errorf("ReadAll(Body)=%q,%v, want '',nil", buf, err)
- }
- return nil
- }
-
- errc := make(chan error, 3)
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- switch r.URL.RequestURI() {
- case "/":
- // Push "/pushed?get" as a GET request, using an absolute URL.
- opt := &http.PushOptions{
- Header: http.Header{
- "User-Agent": {userAgent},
- },
- }
- if err := w.(http.Pusher).Push(stURL+"/pushed?get", opt); err != nil {
- errc <- fmt.Errorf("error pushing /pushed?get: %v", err)
- return
- }
- // Push "/pushed?head" as a HEAD request, using a path.
- opt = &http.PushOptions{
- Method: "HEAD",
- Header: http.Header{
- "User-Agent": {userAgent},
- "Cookie": {cookie},
- },
- }
- if err := w.(http.Pusher).Push("/pushed?head", opt); err != nil {
- errc <- fmt.Errorf("error pushing /pushed?head: %v", err)
- return
- }
- w.Header().Set("Content-Type", "text/html")
- w.Header().Set("Content-Length", strconv.Itoa(len(mainBody)))
- w.WriteHeader(200)
- io.WriteString(w, mainBody)
- errc <- nil
-
- case "/pushed?get":
- wantH := http.Header{}
- wantH.Set("User-Agent", userAgent)
- if err := checkPromisedReq(r, "GET", wantH); err != nil {
- errc <- fmt.Errorf("/pushed?get: %v", err)
- return
- }
- w.Header().Set("Content-Type", "text/html")
- w.Header().Set("Content-Length", strconv.Itoa(len(pushedBody)))
- w.WriteHeader(200)
- io.WriteString(w, pushedBody)
- errc <- nil
-
- case "/pushed?head":
- wantH := http.Header{}
- wantH.Set("User-Agent", userAgent)
- wantH.Set("Cookie", cookie)
- if err := checkPromisedReq(r, "HEAD", wantH); err != nil {
- errc <- fmt.Errorf("/pushed?head: %v", err)
- return
- }
- w.WriteHeader(204)
- errc <- nil
-
- default:
- errc <- fmt.Errorf("unknown RequestURL %q", r.URL.RequestURI())
- }
- })
- stURL = st.ts.URL
-
- // Send one request, which should push two responses.
- st.greet()
- getSlash(st)
- for k := 0; k < 3; k++ {
- select {
- case <-time.After(2 * time.Second):
- t.Errorf("timeout waiting for handler %d to finish", k)
- case err := <-errc:
- if err != nil {
- t.Fatal(err)
- }
- }
- }
-
- checkPushPromise := func(f Frame, promiseID uint32, wantH [][2]string) error {
- pp, ok := f.(*PushPromiseFrame)
- if !ok {
- return fmt.Errorf("got a %T; want *PushPromiseFrame", f)
- }
- if !pp.HeadersEnded() {
- return fmt.Errorf("want END_HEADERS flag in PushPromiseFrame")
- }
- if got, want := pp.PromiseID, promiseID; got != want {
- return fmt.Errorf("got PromiseID %v; want %v", got, want)
- }
- gotH := st.decodeHeader(pp.HeaderBlockFragment())
- if !reflect.DeepEqual(gotH, wantH) {
- return fmt.Errorf("got promised headers %v; want %v", gotH, wantH)
- }
- return nil
- }
- checkHeaders := func(f Frame, wantH [][2]string) error {
- hf, ok := f.(*HeadersFrame)
- if !ok {
- return fmt.Errorf("got a %T; want *HeadersFrame", f)
- }
- gotH := st.decodeHeader(hf.HeaderBlockFragment())
- if !reflect.DeepEqual(gotH, wantH) {
- return fmt.Errorf("got response headers %v; want %v", gotH, wantH)
- }
- return nil
- }
- checkData := func(f Frame, wantData string) error {
- df, ok := f.(*DataFrame)
- if !ok {
- return fmt.Errorf("got a %T; want *DataFrame", f)
- }
- if gotData := string(df.Data()); gotData != wantData {
- return fmt.Errorf("got response data %q; want %q", gotData, wantData)
- }
- return nil
- }
-
- // Stream 1 has 2 PUSH_PROMISE + HEADERS + DATA
- // Stream 2 has HEADERS + DATA
- // Stream 4 has HEADERS
- expected := map[uint32][]func(Frame) error{
- 1: {
- func(f Frame) error {
- return checkPushPromise(f, 2, [][2]string{
- {":method", "GET"},
- {":scheme", "https"},
- {":authority", st.ts.Listener.Addr().String()},
- {":path", "/pushed?get"},
- {"user-agent", userAgent},
- })
- },
- func(f Frame) error {
- return checkPushPromise(f, 4, [][2]string{
- {":method", "HEAD"},
- {":scheme", "https"},
- {":authority", st.ts.Listener.Addr().String()},
- {":path", "/pushed?head"},
- {"cookie", cookie},
- {"user-agent", userAgent},
- })
- },
- func(f Frame) error {
- return checkHeaders(f, [][2]string{
- {":status", "200"},
- {"content-type", "text/html"},
- {"content-length", strconv.Itoa(len(mainBody))},
- })
- },
- func(f Frame) error {
- return checkData(f, mainBody)
- },
- },
- 2: {
- func(f Frame) error {
- return checkHeaders(f, [][2]string{
- {":status", "200"},
- {"content-type", "text/html"},
- {"content-length", strconv.Itoa(len(pushedBody))},
- })
- },
- func(f Frame) error {
- return checkData(f, pushedBody)
- },
- },
- 4: {
- func(f Frame) error {
- return checkHeaders(f, [][2]string{
- {":status", "204"},
- })
- },
- },
- }
-
- consumed := map[uint32]int{}
- for k := 0; len(expected) > 0; k++ {
- f, err := st.readFrame()
- if err != nil {
- for id, left := range expected {
- t.Errorf("stream %d: missing %d frames", id, len(left))
- }
- t.Fatalf("readFrame %d: %v", k, err)
- }
- id := f.Header().StreamID
- label := fmt.Sprintf("stream %d, frame %d", id, consumed[id])
- if len(expected[id]) == 0 {
- t.Fatalf("%s: unexpected frame %#+v", label, f)
- }
- check := expected[id][0]
- expected[id] = expected[id][1:]
- if len(expected[id]) == 0 {
- delete(expected, id)
- }
- if err := check(f); err != nil {
- t.Fatalf("%s: %v", label, err)
- }
- consumed[id]++
- }
-}
-
-func TestServer_Push_SuccessNoRace(t *testing.T) {
- // Regression test for issue #18326. Ensure the request handler can mutate
- // pushed request headers without racing with the PUSH_PROMISE write.
- errc := make(chan error, 2)
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- switch r.URL.RequestURI() {
- case "/":
- opt := &http.PushOptions{
- Header: http.Header{"User-Agent": {"testagent"}},
- }
- if err := w.(http.Pusher).Push("/pushed", opt); err != nil {
- errc <- fmt.Errorf("error pushing: %v", err)
- return
- }
- w.WriteHeader(200)
- errc <- nil
-
- case "/pushed":
- // Update request header, ensure there is no race.
- r.Header.Set("User-Agent", "newagent")
- r.Header.Set("Cookie", "cookie")
- w.WriteHeader(200)
- errc <- nil
-
- default:
- errc <- fmt.Errorf("unknown RequestURL %q", r.URL.RequestURI())
- }
- })
-
- // Send one request, which should push one response.
- st.greet()
- getSlash(st)
- for k := 0; k < 2; k++ {
- select {
- case <-time.After(2 * time.Second):
- t.Errorf("timeout waiting for handler %d to finish", k)
- case err := <-errc:
- if err != nil {
- t.Fatal(err)
- }
- }
- }
-}
-
-func TestServer_Push_RejectRecursivePush(t *testing.T) {
- // Expect two requests, but might get three if there's a bug and the second push succeeds.
- errc := make(chan error, 3)
- handler := func(w http.ResponseWriter, r *http.Request) error {
- baseURL := "https://" + r.Host
- switch r.URL.Path {
- case "/":
- if err := w.(http.Pusher).Push(baseURL+"/push1", nil); err != nil {
- return fmt.Errorf("first Push()=%v, want nil", err)
- }
- return nil
-
- case "/push1":
- if got, want := w.(http.Pusher).Push(baseURL+"/push2", nil), ErrRecursivePush; got != want {
- return fmt.Errorf("Push()=%v, want %v", got, want)
- }
- return nil
-
- default:
- return fmt.Errorf("unexpected path: %q", r.URL.Path)
- }
- }
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- errc <- handler(w, r)
- })
- defer st.Close()
- st.greet()
- getSlash(st)
- if err := <-errc; err != nil {
- t.Errorf("First request failed: %v", err)
- }
- if err := <-errc; err != nil {
- t.Errorf("Second request failed: %v", err)
- }
-}
-
-func testServer_Push_RejectSingleRequest(t *testing.T, doPush func(http.Pusher, *http.Request) error, settings ...Setting) {
- // Expect one request, but might get two if there's a bug and the push succeeds.
- errc := make(chan error, 2)
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- errc <- doPush(w.(http.Pusher), r)
- })
- defer st.Close()
- st.greet()
- if err := st.fr.WriteSettings(settings...); err != nil {
- st.t.Fatalf("WriteSettings: %v", err)
- }
- st.wantSettingsAck()
- getSlash(st)
- if err := <-errc; err != nil {
- t.Error(err)
- }
- // Should not get a PUSH_PROMISE frame.
- hf := st.wantHeaders()
- if !hf.StreamEnded() {
- t.Error("stream should end after headers")
- }
-}
-
-func TestServer_Push_RejectIfDisabled(t *testing.T) {
- testServer_Push_RejectSingleRequest(t,
- func(p http.Pusher, r *http.Request) error {
- if got, want := p.Push("https://"+r.Host+"/pushed", nil), http.ErrNotSupported; got != want {
- return fmt.Errorf("Push()=%v, want %v", got, want)
- }
- return nil
- },
- Setting{SettingEnablePush, 0})
-}
-
-func TestServer_Push_RejectWhenNoConcurrentStreams(t *testing.T) {
- testServer_Push_RejectSingleRequest(t,
- func(p http.Pusher, r *http.Request) error {
- if got, want := p.Push("https://"+r.Host+"/pushed", nil), ErrPushLimitReached; got != want {
- return fmt.Errorf("Push()=%v, want %v", got, want)
- }
- return nil
- },
- Setting{SettingMaxConcurrentStreams, 0})
-}
-
-func TestServer_Push_RejectWrongScheme(t *testing.T) {
- testServer_Push_RejectSingleRequest(t,
- func(p http.Pusher, r *http.Request) error {
- if err := p.Push("http://"+r.Host+"/pushed", nil); err == nil {
- return errors.New("Push() should have failed (push target URL is http)")
- }
- return nil
- })
-}
-
-func TestServer_Push_RejectMissingHost(t *testing.T) {
- testServer_Push_RejectSingleRequest(t,
- func(p http.Pusher, r *http.Request) error {
- if err := p.Push("https:pushed", nil); err == nil {
- return errors.New("Push() should have failed (push target URL missing host)")
- }
- return nil
- })
-}
-
-func TestServer_Push_RejectRelativePath(t *testing.T) {
- testServer_Push_RejectSingleRequest(t,
- func(p http.Pusher, r *http.Request) error {
- if err := p.Push("../test", nil); err == nil {
- return errors.New("Push() should have failed (push target is a relative path)")
- }
- return nil
- })
-}
-
-func TestServer_Push_RejectForbiddenMethod(t *testing.T) {
- testServer_Push_RejectSingleRequest(t,
- func(p http.Pusher, r *http.Request) error {
- if err := p.Push("https://"+r.Host+"/pushed", &http.PushOptions{Method: "POST"}); err == nil {
- return errors.New("Push() should have failed (cannot promise a POST)")
- }
- return nil
- })
-}
-
-func TestServer_Push_RejectForbiddenHeader(t *testing.T) {
- testServer_Push_RejectSingleRequest(t,
- func(p http.Pusher, r *http.Request) error {
- header := http.Header{
- "Content-Length": {"10"},
- "Content-Encoding": {"gzip"},
- "Trailer": {"Foo"},
- "Te": {"trailers"},
- "Host": {"test.com"},
- ":authority": {"test.com"},
- }
- if err := p.Push("https://"+r.Host+"/pushed", &http.PushOptions{Header: header}); err == nil {
- return errors.New("Push() should have failed (forbidden headers)")
- }
- return nil
- })
-}
-
-func TestServer_Push_StateTransitions(t *testing.T) {
- const body = "foo"
-
- gotPromise := make(chan bool)
- finishedPush := make(chan bool)
-
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- switch r.URL.RequestURI() {
- case "/":
- if err := w.(http.Pusher).Push("/pushed", nil); err != nil {
- t.Errorf("Push error: %v", err)
- }
- // Don't finish this request until the push finishes so we don't
- // nondeterministically interleave output frames with the push.
- <-finishedPush
- case "/pushed":
- <-gotPromise
- }
- w.Header().Set("Content-Type", "text/html")
- w.Header().Set("Content-Length", strconv.Itoa(len(body)))
- w.WriteHeader(200)
- io.WriteString(w, body)
- })
- defer st.Close()
-
- st.greet()
- if st.stream(2) != nil {
- t.Fatal("stream 2 should be empty")
- }
- if got, want := st.streamState(2), stateIdle; got != want {
- t.Fatalf("streamState(2)=%v, want %v", got, want)
- }
- getSlash(st)
- // After the PUSH_PROMISE is sent, the stream should be stateHalfClosedRemote.
- st.wantPushPromise()
- if got, want := st.streamState(2), stateHalfClosedRemote; got != want {
- t.Fatalf("streamState(2)=%v, want %v", got, want)
- }
- // We stall the HTTP handler for "/pushed" until the above check. If we don't
- // stall the handler, then the handler might write HEADERS and DATA and finish
- // the stream before we check st.streamState(2) -- should that happen, we'll
- // see stateClosed and fail the above check.
- close(gotPromise)
- st.wantHeaders()
- if df := st.wantData(); !df.StreamEnded() {
- t.Fatal("expected END_STREAM flag on DATA")
- }
- if got, want := st.streamState(2), stateClosed; got != want {
- t.Fatalf("streamState(2)=%v, want %v", got, want)
- }
- close(finishedPush)
-}
-
-func TestServer_Push_RejectAfterGoAway(t *testing.T) {
- var readyOnce sync.Once
- ready := make(chan struct{})
- errc := make(chan error, 2)
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- select {
- case <-ready:
- case <-time.After(5 * time.Second):
- errc <- fmt.Errorf("timeout waiting for GOAWAY to be processed")
- }
- if got, want := w.(http.Pusher).Push("https://"+r.Host+"/pushed", nil), http.ErrNotSupported; got != want {
- errc <- fmt.Errorf("Push()=%v, want %v", got, want)
- }
- errc <- nil
- })
- defer st.Close()
- st.greet()
- getSlash(st)
-
- // Send GOAWAY and wait for it to be processed.
- st.fr.WriteGoAway(1, ErrCodeNo, nil)
- go func() {
- for {
- select {
- case <-ready:
- return
- default:
- }
- st.sc.serveMsgCh <- func(loopNum int) {
- if !st.sc.pushEnabled {
- readyOnce.Do(func() { close(ready) })
- }
- }
- }
- }()
- if err := <-errc; err != nil {
- t.Error(err)
- }
-}
diff --git a/vendor/golang.org/x/net/http2/server_test.go b/vendor/golang.org/x/net/http2/server_test.go
deleted file mode 100644
index 02eb0dcce..000000000
--- a/vendor/golang.org/x/net/http2/server_test.go
+++ /dev/null
@@ -1,3843 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package http2
-
-import (
- "bytes"
- "crypto/tls"
- "errors"
- "flag"
- "fmt"
- "io"
- "io/ioutil"
- "log"
- "net"
- "net/http"
- "net/http/httptest"
- "os"
- "os/exec"
- "reflect"
- "runtime"
- "strconv"
- "strings"
- "sync"
- "sync/atomic"
- "testing"
- "time"
-
- "golang.org/x/net/http2/hpack"
-)
-
-var stderrVerbose = flag.Bool("stderr_verbose", false, "Mirror verbosity to stderr, unbuffered")
-
-func stderrv() io.Writer {
- if *stderrVerbose {
- return os.Stderr
- }
-
- return ioutil.Discard
-}
-
-type serverTester struct {
- cc net.Conn // client conn
- t testing.TB
- ts *httptest.Server
- fr *Framer
- serverLogBuf bytes.Buffer // logger for httptest.Server
- logFilter []string // substrings to filter out
- scMu sync.Mutex // guards sc
- sc *serverConn
- hpackDec *hpack.Decoder
- decodedHeaders [][2]string
-
- // If http2debug!=2, then we capture Frame debug logs that will be written
- // to t.Log after a test fails. The read and write logs use separate locks
- // and buffers so we don't accidentally introduce synchronization between
- // the read and write goroutines, which may hide data races.
- frameReadLogMu sync.Mutex
- frameReadLogBuf bytes.Buffer
- frameWriteLogMu sync.Mutex
- frameWriteLogBuf bytes.Buffer
-
- // writing headers:
- headerBuf bytes.Buffer
- hpackEnc *hpack.Encoder
-}
-
-func init() {
- testHookOnPanicMu = new(sync.Mutex)
- goAwayTimeout = 25 * time.Millisecond
-}
-
-func resetHooks() {
- testHookOnPanicMu.Lock()
- testHookOnPanic = nil
- testHookOnPanicMu.Unlock()
-}
-
-type serverTesterOpt string
-
-var optOnlyServer = serverTesterOpt("only_server")
-var optQuiet = serverTesterOpt("quiet_logging")
-var optFramerReuseFrames = serverTesterOpt("frame_reuse_frames")
-
-func newServerTester(t testing.TB, handler http.HandlerFunc, opts ...interface{}) *serverTester {
- resetHooks()
-
- ts := httptest.NewUnstartedServer(handler)
-
- tlsConfig := &tls.Config{
- InsecureSkipVerify: true,
- NextProtos: []string{NextProtoTLS},
- }
-
- var onlyServer, quiet, framerReuseFrames bool
- h2server := new(Server)
- for _, opt := range opts {
- switch v := opt.(type) {
- case func(*tls.Config):
- v(tlsConfig)
- case func(*httptest.Server):
- v(ts)
- case func(*Server):
- v(h2server)
- case serverTesterOpt:
- switch v {
- case optOnlyServer:
- onlyServer = true
- case optQuiet:
- quiet = true
- case optFramerReuseFrames:
- framerReuseFrames = true
- }
- case func(net.Conn, http.ConnState):
- ts.Config.ConnState = v
- default:
- t.Fatalf("unknown newServerTester option type %T", v)
- }
- }
-
- ConfigureServer(ts.Config, h2server)
-
- st := &serverTester{
- t: t,
- ts: ts,
- }
- st.hpackEnc = hpack.NewEncoder(&st.headerBuf)
- st.hpackDec = hpack.NewDecoder(initialHeaderTableSize, st.onHeaderField)
-
- ts.TLS = ts.Config.TLSConfig // the httptest.Server has its own copy of this TLS config
- if quiet {
- ts.Config.ErrorLog = log.New(ioutil.Discard, "", 0)
- } else {
- ts.Config.ErrorLog = log.New(io.MultiWriter(stderrv(), twriter{t: t, st: st}, &st.serverLogBuf), "", log.LstdFlags)
- }
- ts.StartTLS()
-
- if VerboseLogs {
- t.Logf("Running test server at: %s", ts.URL)
- }
- testHookGetServerConn = func(v *serverConn) {
- st.scMu.Lock()
- defer st.scMu.Unlock()
- st.sc = v
- }
- log.SetOutput(io.MultiWriter(stderrv(), twriter{t: t, st: st}))
- if !onlyServer {
- cc, err := tls.Dial("tcp", ts.Listener.Addr().String(), tlsConfig)
- if err != nil {
- t.Fatal(err)
- }
- st.cc = cc
- st.fr = NewFramer(cc, cc)
- if framerReuseFrames {
- st.fr.SetReuseFrames()
- }
- if !logFrameReads && !logFrameWrites {
- st.fr.debugReadLoggerf = func(m string, v ...interface{}) {
- m = time.Now().Format("2006-01-02 15:04:05.999999999 ") + strings.TrimPrefix(m, "http2: ") + "\n"
- st.frameReadLogMu.Lock()
- fmt.Fprintf(&st.frameReadLogBuf, m, v...)
- st.frameReadLogMu.Unlock()
- }
- st.fr.debugWriteLoggerf = func(m string, v ...interface{}) {
- m = time.Now().Format("2006-01-02 15:04:05.999999999 ") + strings.TrimPrefix(m, "http2: ") + "\n"
- st.frameWriteLogMu.Lock()
- fmt.Fprintf(&st.frameWriteLogBuf, m, v...)
- st.frameWriteLogMu.Unlock()
- }
- st.fr.logReads = true
- st.fr.logWrites = true
- }
- }
- return st
-}
-
-func (st *serverTester) closeConn() {
- st.scMu.Lock()
- defer st.scMu.Unlock()
- st.sc.conn.Close()
-}
-
-func (st *serverTester) addLogFilter(phrase string) {
- st.logFilter = append(st.logFilter, phrase)
-}
-
-func (st *serverTester) stream(id uint32) *stream {
- ch := make(chan *stream, 1)
- st.sc.serveMsgCh <- func(int) {
- ch <- st.sc.streams[id]
- }
- return <-ch
-}
-
-func (st *serverTester) streamState(id uint32) streamState {
- ch := make(chan streamState, 1)
- st.sc.serveMsgCh <- func(int) {
- state, _ := st.sc.state(id)
- ch <- state
- }
- return <-ch
-}
-
-// loopNum reports how many times this conn's select loop has gone around.
-func (st *serverTester) loopNum() int {
- lastc := make(chan int, 1)
- st.sc.serveMsgCh <- func(loopNum int) {
- lastc <- loopNum
- }
- return <-lastc
-}
-
-// awaitIdle heuristically awaits for the server conn's select loop to be idle.
-// The heuristic is that the server connection's serve loop must schedule
-// 50 times in a row without any channel sends or receives occurring.
-func (st *serverTester) awaitIdle() {
- remain := 50
- last := st.loopNum()
- for remain > 0 {
- n := st.loopNum()
- if n == last+1 {
- remain--
- } else {
- remain = 50
- }
- last = n
- }
-}
-
-func (st *serverTester) Close() {
- if st.t.Failed() {
- st.frameReadLogMu.Lock()
- if st.frameReadLogBuf.Len() > 0 {
- st.t.Logf("Framer read log:\n%s", st.frameReadLogBuf.String())
- }
- st.frameReadLogMu.Unlock()
-
- st.frameWriteLogMu.Lock()
- if st.frameWriteLogBuf.Len() > 0 {
- st.t.Logf("Framer write log:\n%s", st.frameWriteLogBuf.String())
- }
- st.frameWriteLogMu.Unlock()
-
- // If we failed already (and are likely in a Fatal,
- // unwindowing), force close the connection, so the
- // httptest.Server doesn't wait forever for the conn
- // to close.
- if st.cc != nil {
- st.cc.Close()
- }
- }
- st.ts.Close()
- if st.cc != nil {
- st.cc.Close()
- }
- log.SetOutput(os.Stderr)
-}
-
-// greet initiates the client's HTTP/2 connection into a state where
-// frames may be sent.
-func (st *serverTester) greet() {
- st.greetAndCheckSettings(func(Setting) error { return nil })
-}
-
-func (st *serverTester) greetAndCheckSettings(checkSetting func(s Setting) error) {
- st.writePreface()
- st.writeInitialSettings()
- st.wantSettings().ForeachSetting(checkSetting)
- st.writeSettingsAck()
-
- // The initial WINDOW_UPDATE and SETTINGS ACK can come in any order.
- var gotSettingsAck bool
- var gotWindowUpdate bool
-
- for i := 0; i < 2; i++ {
- f, err := st.readFrame()
- if err != nil {
- st.t.Fatal(err)
- }
- switch f := f.(type) {
- case *SettingsFrame:
- if !f.Header().Flags.Has(FlagSettingsAck) {
- st.t.Fatal("Settings Frame didn't have ACK set")
- }
- gotSettingsAck = true
-
- case *WindowUpdateFrame:
- if f.FrameHeader.StreamID != 0 {
- st.t.Fatalf("WindowUpdate StreamID = %d; want 0", f.FrameHeader.StreamID)
- }
- incr := uint32((&Server{}).initialConnRecvWindowSize() - initialWindowSize)
- if f.Increment != incr {
- st.t.Fatalf("WindowUpdate increment = %d; want %d", f.Increment, incr)
- }
- gotWindowUpdate = true
-
- default:
- st.t.Fatalf("Wanting a settings ACK or window update, received a %T", f)
- }
- }
-
- if !gotSettingsAck {
- st.t.Fatalf("Didn't get a settings ACK")
- }
- if !gotWindowUpdate {
- st.t.Fatalf("Didn't get a window update")
- }
-}
-
-func (st *serverTester) writePreface() {
- n, err := st.cc.Write(clientPreface)
- if err != nil {
- st.t.Fatalf("Error writing client preface: %v", err)
- }
- if n != len(clientPreface) {
- st.t.Fatalf("Writing client preface, wrote %d bytes; want %d", n, len(clientPreface))
- }
-}
-
-func (st *serverTester) writeInitialSettings() {
- if err := st.fr.WriteSettings(); err != nil {
- st.t.Fatalf("Error writing initial SETTINGS frame from client to server: %v", err)
- }
-}
-
-func (st *serverTester) writeSettingsAck() {
- if err := st.fr.WriteSettingsAck(); err != nil {
- st.t.Fatalf("Error writing ACK of server's SETTINGS: %v", err)
- }
-}
-
-func (st *serverTester) writeHeaders(p HeadersFrameParam) {
- if err := st.fr.WriteHeaders(p); err != nil {
- st.t.Fatalf("Error writing HEADERS: %v", err)
- }
-}
-
-func (st *serverTester) writePriority(id uint32, p PriorityParam) {
- if err := st.fr.WritePriority(id, p); err != nil {
- st.t.Fatalf("Error writing PRIORITY: %v", err)
- }
-}
-
-func (st *serverTester) encodeHeaderField(k, v string) {
- err := st.hpackEnc.WriteField(hpack.HeaderField{Name: k, Value: v})
- if err != nil {
- st.t.Fatalf("HPACK encoding error for %q/%q: %v", k, v, err)
- }
-}
-
-// encodeHeaderRaw is the magic-free version of encodeHeader.
-// It takes 0 or more (k, v) pairs and encodes them.
-func (st *serverTester) encodeHeaderRaw(headers ...string) []byte {
- if len(headers)%2 == 1 {
- panic("odd number of kv args")
- }
- st.headerBuf.Reset()
- for len(headers) > 0 {
- k, v := headers[0], headers[1]
- st.encodeHeaderField(k, v)
- headers = headers[2:]
- }
- return st.headerBuf.Bytes()
-}
-
-// encodeHeader encodes headers and returns their HPACK bytes. headers
-// must contain an even number of key/value pairs. There may be
-// multiple pairs for keys (e.g. "cookie"). The :method, :path, and
-// :scheme headers default to GET, / and https. The :authority header
-// defaults to st.ts.Listener.Addr().
-func (st *serverTester) encodeHeader(headers ...string) []byte {
- if len(headers)%2 == 1 {
- panic("odd number of kv args")
- }
-
- st.headerBuf.Reset()
- defaultAuthority := st.ts.Listener.Addr().String()
-
- if len(headers) == 0 {
- // Fast path, mostly for benchmarks, so test code doesn't pollute
- // profiles when we're looking to improve server allocations.
- st.encodeHeaderField(":method", "GET")
- st.encodeHeaderField(":scheme", "https")
- st.encodeHeaderField(":authority", defaultAuthority)
- st.encodeHeaderField(":path", "/")
- return st.headerBuf.Bytes()
- }
-
- if len(headers) == 2 && headers[0] == ":method" {
- // Another fast path for benchmarks.
- st.encodeHeaderField(":method", headers[1])
- st.encodeHeaderField(":scheme", "https")
- st.encodeHeaderField(":authority", defaultAuthority)
- st.encodeHeaderField(":path", "/")
- return st.headerBuf.Bytes()
- }
-
- pseudoCount := map[string]int{}
- keys := []string{":method", ":scheme", ":authority", ":path"}
- vals := map[string][]string{
- ":method": {"GET"},
- ":scheme": {"https"},
- ":authority": {defaultAuthority},
- ":path": {"/"},
- }
- for len(headers) > 0 {
- k, v := headers[0], headers[1]
- headers = headers[2:]
- if _, ok := vals[k]; !ok {
- keys = append(keys, k)
- }
- if strings.HasPrefix(k, ":") {
- pseudoCount[k]++
- if pseudoCount[k] == 1 {
- vals[k] = []string{v}
- } else {
- // Allows testing of invalid headers w/ dup pseudo fields.
- vals[k] = append(vals[k], v)
- }
- } else {
- vals[k] = append(vals[k], v)
- }
- }
- for _, k := range keys {
- for _, v := range vals[k] {
- st.encodeHeaderField(k, v)
- }
- }
- return st.headerBuf.Bytes()
-}
-
-// bodylessReq1 writes a HEADERS frames with StreamID 1 and EndStream and EndHeaders set.
-func (st *serverTester) bodylessReq1(headers ...string) {
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1, // clients send odd numbers
- BlockFragment: st.encodeHeader(headers...),
- EndStream: true,
- EndHeaders: true,
- })
-}
-
-func (st *serverTester) writeData(streamID uint32, endStream bool, data []byte) {
- if err := st.fr.WriteData(streamID, endStream, data); err != nil {
- st.t.Fatalf("Error writing DATA: %v", err)
- }
-}
-
-func (st *serverTester) writeDataPadded(streamID uint32, endStream bool, data, pad []byte) {
- if err := st.fr.WriteDataPadded(streamID, endStream, data, pad); err != nil {
- st.t.Fatalf("Error writing DATA: %v", err)
- }
-}
-
-func readFrameTimeout(fr *Framer, wait time.Duration) (Frame, error) {
- ch := make(chan interface{}, 1)
- go func() {
- fr, err := fr.ReadFrame()
- if err != nil {
- ch <- err
- } else {
- ch <- fr
- }
- }()
- t := time.NewTimer(wait)
- select {
- case v := <-ch:
- t.Stop()
- if fr, ok := v.(Frame); ok {
- return fr, nil
- }
- return nil, v.(error)
- case <-t.C:
- return nil, errors.New("timeout waiting for frame")
- }
-}
-
-func (st *serverTester) readFrame() (Frame, error) {
- return readFrameTimeout(st.fr, 2*time.Second)
-}
-
-func (st *serverTester) wantHeaders() *HeadersFrame {
- f, err := st.readFrame()
- if err != nil {
- st.t.Fatalf("Error while expecting a HEADERS frame: %v", err)
- }
- hf, ok := f.(*HeadersFrame)
- if !ok {
- st.t.Fatalf("got a %T; want *HeadersFrame", f)
- }
- return hf
-}
-
-func (st *serverTester) wantContinuation() *ContinuationFrame {
- f, err := st.readFrame()
- if err != nil {
- st.t.Fatalf("Error while expecting a CONTINUATION frame: %v", err)
- }
- cf, ok := f.(*ContinuationFrame)
- if !ok {
- st.t.Fatalf("got a %T; want *ContinuationFrame", f)
- }
- return cf
-}
-
-func (st *serverTester) wantData() *DataFrame {
- f, err := st.readFrame()
- if err != nil {
- st.t.Fatalf("Error while expecting a DATA frame: %v", err)
- }
- df, ok := f.(*DataFrame)
- if !ok {
- st.t.Fatalf("got a %T; want *DataFrame", f)
- }
- return df
-}
-
-func (st *serverTester) wantSettings() *SettingsFrame {
- f, err := st.readFrame()
- if err != nil {
- st.t.Fatalf("Error while expecting a SETTINGS frame: %v", err)
- }
- sf, ok := f.(*SettingsFrame)
- if !ok {
- st.t.Fatalf("got a %T; want *SettingsFrame", f)
- }
- return sf
-}
-
-func (st *serverTester) wantPing() *PingFrame {
- f, err := st.readFrame()
- if err != nil {
- st.t.Fatalf("Error while expecting a PING frame: %v", err)
- }
- pf, ok := f.(*PingFrame)
- if !ok {
- st.t.Fatalf("got a %T; want *PingFrame", f)
- }
- return pf
-}
-
-func (st *serverTester) wantGoAway() *GoAwayFrame {
- f, err := st.readFrame()
- if err != nil {
- st.t.Fatalf("Error while expecting a GOAWAY frame: %v", err)
- }
- gf, ok := f.(*GoAwayFrame)
- if !ok {
- st.t.Fatalf("got a %T; want *GoAwayFrame", f)
- }
- return gf
-}
-
-func (st *serverTester) wantRSTStream(streamID uint32, errCode ErrCode) {
- f, err := st.readFrame()
- if err != nil {
- st.t.Fatalf("Error while expecting an RSTStream frame: %v", err)
- }
- rs, ok := f.(*RSTStreamFrame)
- if !ok {
- st.t.Fatalf("got a %T; want *RSTStreamFrame", f)
- }
- if rs.FrameHeader.StreamID != streamID {
- st.t.Fatalf("RSTStream StreamID = %d; want %d", rs.FrameHeader.StreamID, streamID)
- }
- if rs.ErrCode != errCode {
- st.t.Fatalf("RSTStream ErrCode = %d (%s); want %d (%s)", rs.ErrCode, rs.ErrCode, errCode, errCode)
- }
-}
-
-func (st *serverTester) wantWindowUpdate(streamID, incr uint32) {
- f, err := st.readFrame()
- if err != nil {
- st.t.Fatalf("Error while expecting a WINDOW_UPDATE frame: %v", err)
- }
- wu, ok := f.(*WindowUpdateFrame)
- if !ok {
- st.t.Fatalf("got a %T; want *WindowUpdateFrame", f)
- }
- if wu.FrameHeader.StreamID != streamID {
- st.t.Fatalf("WindowUpdate StreamID = %d; want %d", wu.FrameHeader.StreamID, streamID)
- }
- if wu.Increment != incr {
- st.t.Fatalf("WindowUpdate increment = %d; want %d", wu.Increment, incr)
- }
-}
-
-func (st *serverTester) wantSettingsAck() {
- f, err := st.readFrame()
- if err != nil {
- st.t.Fatal(err)
- }
- sf, ok := f.(*SettingsFrame)
- if !ok {
- st.t.Fatalf("Wanting a settings ACK, received a %T", f)
- }
- if !sf.Header().Flags.Has(FlagSettingsAck) {
- st.t.Fatal("Settings Frame didn't have ACK set")
- }
-}
-
-func (st *serverTester) wantPushPromise() *PushPromiseFrame {
- f, err := st.readFrame()
- if err != nil {
- st.t.Fatal(err)
- }
- ppf, ok := f.(*PushPromiseFrame)
- if !ok {
- st.t.Fatalf("Wanted PushPromise, received %T", ppf)
- }
- return ppf
-}
-
-func TestServer(t *testing.T) {
- gotReq := make(chan bool, 1)
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Foo", "Bar")
- gotReq <- true
- })
- defer st.Close()
-
- covers("3.5", `
- The server connection preface consists of a potentially empty
- SETTINGS frame ([SETTINGS]) that MUST be the first frame the
- server sends in the HTTP/2 connection.
- `)
-
- st.greet()
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1, // clients send odd numbers
- BlockFragment: st.encodeHeader(),
- EndStream: true, // no DATA frames
- EndHeaders: true,
- })
-
- select {
- case <-gotReq:
- case <-time.After(2 * time.Second):
- t.Error("timeout waiting for request")
- }
-}
-
-func TestServer_Request_Get(t *testing.T) {
- testServerRequest(t, func(st *serverTester) {
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1, // clients send odd numbers
- BlockFragment: st.encodeHeader("foo-bar", "some-value"),
- EndStream: true, // no DATA frames
- EndHeaders: true,
- })
- }, func(r *http.Request) {
- if r.Method != "GET" {
- t.Errorf("Method = %q; want GET", r.Method)
- }
- if r.URL.Path != "/" {
- t.Errorf("URL.Path = %q; want /", r.URL.Path)
- }
- if r.ContentLength != 0 {
- t.Errorf("ContentLength = %v; want 0", r.ContentLength)
- }
- if r.Close {
- t.Error("Close = true; want false")
- }
- if !strings.Contains(r.RemoteAddr, ":") {
- t.Errorf("RemoteAddr = %q; want something with a colon", r.RemoteAddr)
- }
- if r.Proto != "HTTP/2.0" || r.ProtoMajor != 2 || r.ProtoMinor != 0 {
- t.Errorf("Proto = %q Major=%v,Minor=%v; want HTTP/2.0", r.Proto, r.ProtoMajor, r.ProtoMinor)
- }
- wantHeader := http.Header{
- "Foo-Bar": []string{"some-value"},
- }
- if !reflect.DeepEqual(r.Header, wantHeader) {
- t.Errorf("Header = %#v; want %#v", r.Header, wantHeader)
- }
- if n, err := r.Body.Read([]byte(" ")); err != io.EOF || n != 0 {
- t.Errorf("Read = %d, %v; want 0, EOF", n, err)
- }
- })
-}
-
-func TestServer_Request_Get_PathSlashes(t *testing.T) {
- testServerRequest(t, func(st *serverTester) {
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1, // clients send odd numbers
- BlockFragment: st.encodeHeader(":path", "/%2f/"),
- EndStream: true, // no DATA frames
- EndHeaders: true,
- })
- }, func(r *http.Request) {
- if r.RequestURI != "/%2f/" {
- t.Errorf("RequestURI = %q; want /%%2f/", r.RequestURI)
- }
- if r.URL.Path != "///" {
- t.Errorf("URL.Path = %q; want ///", r.URL.Path)
- }
- })
-}
-
-// TODO: add a test with EndStream=true on the HEADERS but setting a
-// Content-Length anyway. Should we just omit it and force it to
-// zero?
-
-func TestServer_Request_Post_NoContentLength_EndStream(t *testing.T) {
- testServerRequest(t, func(st *serverTester) {
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1, // clients send odd numbers
- BlockFragment: st.encodeHeader(":method", "POST"),
- EndStream: true,
- EndHeaders: true,
- })
- }, func(r *http.Request) {
- if r.Method != "POST" {
- t.Errorf("Method = %q; want POST", r.Method)
- }
- if r.ContentLength != 0 {
- t.Errorf("ContentLength = %v; want 0", r.ContentLength)
- }
- if n, err := r.Body.Read([]byte(" ")); err != io.EOF || n != 0 {
- t.Errorf("Read = %d, %v; want 0, EOF", n, err)
- }
- })
-}
-
-func TestServer_Request_Post_Body_ImmediateEOF(t *testing.T) {
- testBodyContents(t, -1, "", func(st *serverTester) {
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1, // clients send odd numbers
- BlockFragment: st.encodeHeader(":method", "POST"),
- EndStream: false, // to say DATA frames are coming
- EndHeaders: true,
- })
- st.writeData(1, true, nil) // just kidding. empty body.
- })
-}
-
-func TestServer_Request_Post_Body_OneData(t *testing.T) {
- const content = "Some content"
- testBodyContents(t, -1, content, func(st *serverTester) {
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1, // clients send odd numbers
- BlockFragment: st.encodeHeader(":method", "POST"),
- EndStream: false, // to say DATA frames are coming
- EndHeaders: true,
- })
- st.writeData(1, true, []byte(content))
- })
-}
-
-func TestServer_Request_Post_Body_TwoData(t *testing.T) {
- const content = "Some content"
- testBodyContents(t, -1, content, func(st *serverTester) {
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1, // clients send odd numbers
- BlockFragment: st.encodeHeader(":method", "POST"),
- EndStream: false, // to say DATA frames are coming
- EndHeaders: true,
- })
- st.writeData(1, false, []byte(content[:5]))
- st.writeData(1, true, []byte(content[5:]))
- })
-}
-
-func TestServer_Request_Post_Body_ContentLength_Correct(t *testing.T) {
- const content = "Some content"
- testBodyContents(t, int64(len(content)), content, func(st *serverTester) {
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1, // clients send odd numbers
- BlockFragment: st.encodeHeader(
- ":method", "POST",
- "content-length", strconv.Itoa(len(content)),
- ),
- EndStream: false, // to say DATA frames are coming
- EndHeaders: true,
- })
- st.writeData(1, true, []byte(content))
- })
-}
-
-func TestServer_Request_Post_Body_ContentLength_TooLarge(t *testing.T) {
- testBodyContentsFail(t, 3, "request declared a Content-Length of 3 but only wrote 2 bytes",
- func(st *serverTester) {
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1, // clients send odd numbers
- BlockFragment: st.encodeHeader(
- ":method", "POST",
- "content-length", "3",
- ),
- EndStream: false, // to say DATA frames are coming
- EndHeaders: true,
- })
- st.writeData(1, true, []byte("12"))
- })
-}
-
-func TestServer_Request_Post_Body_ContentLength_TooSmall(t *testing.T) {
- testBodyContentsFail(t, 4, "sender tried to send more than declared Content-Length of 4 bytes",
- func(st *serverTester) {
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1, // clients send odd numbers
- BlockFragment: st.encodeHeader(
- ":method", "POST",
- "content-length", "4",
- ),
- EndStream: false, // to say DATA frames are coming
- EndHeaders: true,
- })
- st.writeData(1, true, []byte("12345"))
- })
-}
-
-func testBodyContents(t *testing.T, wantContentLength int64, wantBody string, write func(st *serverTester)) {
- testServerRequest(t, write, func(r *http.Request) {
- if r.Method != "POST" {
- t.Errorf("Method = %q; want POST", r.Method)
- }
- if r.ContentLength != wantContentLength {
- t.Errorf("ContentLength = %v; want %d", r.ContentLength, wantContentLength)
- }
- all, err := ioutil.ReadAll(r.Body)
- if err != nil {
- t.Fatal(err)
- }
- if string(all) != wantBody {
- t.Errorf("Read = %q; want %q", all, wantBody)
- }
- if err := r.Body.Close(); err != nil {
- t.Fatalf("Close: %v", err)
- }
- })
-}
-
-func testBodyContentsFail(t *testing.T, wantContentLength int64, wantReadError string, write func(st *serverTester)) {
- testServerRequest(t, write, func(r *http.Request) {
- if r.Method != "POST" {
- t.Errorf("Method = %q; want POST", r.Method)
- }
- if r.ContentLength != wantContentLength {
- t.Errorf("ContentLength = %v; want %d", r.ContentLength, wantContentLength)
- }
- all, err := ioutil.ReadAll(r.Body)
- if err == nil {
- t.Fatalf("expected an error (%q) reading from the body. Successfully read %q instead.",
- wantReadError, all)
- }
- if !strings.Contains(err.Error(), wantReadError) {
- t.Fatalf("Body.Read = %v; want substring %q", err, wantReadError)
- }
- if err := r.Body.Close(); err != nil {
- t.Fatalf("Close: %v", err)
- }
- })
-}
-
-// Using a Host header, instead of :authority
-func TestServer_Request_Get_Host(t *testing.T) {
- const host = "example.com"
- testServerRequest(t, func(st *serverTester) {
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1, // clients send odd numbers
- BlockFragment: st.encodeHeader(":authority", "", "host", host),
- EndStream: true,
- EndHeaders: true,
- })
- }, func(r *http.Request) {
- if r.Host != host {
- t.Errorf("Host = %q; want %q", r.Host, host)
- }
- })
-}
-
-// Using an :authority pseudo-header, instead of Host
-func TestServer_Request_Get_Authority(t *testing.T) {
- const host = "example.com"
- testServerRequest(t, func(st *serverTester) {
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1, // clients send odd numbers
- BlockFragment: st.encodeHeader(":authority", host),
- EndStream: true,
- EndHeaders: true,
- })
- }, func(r *http.Request) {
- if r.Host != host {
- t.Errorf("Host = %q; want %q", r.Host, host)
- }
- })
-}
-
-func TestServer_Request_WithContinuation(t *testing.T) {
- wantHeader := http.Header{
- "Foo-One": []string{"value-one"},
- "Foo-Two": []string{"value-two"},
- "Foo-Three": []string{"value-three"},
- }
- testServerRequest(t, func(st *serverTester) {
- fullHeaders := st.encodeHeader(
- "foo-one", "value-one",
- "foo-two", "value-two",
- "foo-three", "value-three",
- )
- remain := fullHeaders
- chunks := 0
- for len(remain) > 0 {
- const maxChunkSize = 5
- chunk := remain
- if len(chunk) > maxChunkSize {
- chunk = chunk[:maxChunkSize]
- }
- remain = remain[len(chunk):]
-
- if chunks == 0 {
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1, // clients send odd numbers
- BlockFragment: chunk,
- EndStream: true, // no DATA frames
- EndHeaders: false, // we'll have continuation frames
- })
- } else {
- err := st.fr.WriteContinuation(1, len(remain) == 0, chunk)
- if err != nil {
- t.Fatal(err)
- }
- }
- chunks++
- }
- if chunks < 2 {
- t.Fatal("too few chunks")
- }
- }, func(r *http.Request) {
- if !reflect.DeepEqual(r.Header, wantHeader) {
- t.Errorf("Header = %#v; want %#v", r.Header, wantHeader)
- }
- })
-}
-
-// Concatenated cookie headers. ("8.1.2.5 Compressing the Cookie Header Field")
-func TestServer_Request_CookieConcat(t *testing.T) {
- const host = "example.com"
- testServerRequest(t, func(st *serverTester) {
- st.bodylessReq1(
- ":authority", host,
- "cookie", "a=b",
- "cookie", "c=d",
- "cookie", "e=f",
- )
- }, func(r *http.Request) {
- const want = "a=b; c=d; e=f"
- if got := r.Header.Get("Cookie"); got != want {
- t.Errorf("Cookie = %q; want %q", got, want)
- }
- })
-}
-
-func TestServer_Request_Reject_CapitalHeader(t *testing.T) {
- testRejectRequest(t, func(st *serverTester) { st.bodylessReq1("UPPER", "v") })
-}
-
-func TestServer_Request_Reject_HeaderFieldNameColon(t *testing.T) {
- testRejectRequest(t, func(st *serverTester) { st.bodylessReq1("has:colon", "v") })
-}
-
-func TestServer_Request_Reject_HeaderFieldNameNULL(t *testing.T) {
- testRejectRequest(t, func(st *serverTester) { st.bodylessReq1("has\x00null", "v") })
-}
-
-func TestServer_Request_Reject_HeaderFieldNameEmpty(t *testing.T) {
- testRejectRequest(t, func(st *serverTester) { st.bodylessReq1("", "v") })
-}
-
-func TestServer_Request_Reject_HeaderFieldValueNewline(t *testing.T) {
- testRejectRequest(t, func(st *serverTester) { st.bodylessReq1("foo", "has\nnewline") })
-}
-
-func TestServer_Request_Reject_HeaderFieldValueCR(t *testing.T) {
- testRejectRequest(t, func(st *serverTester) { st.bodylessReq1("foo", "has\rcarriage") })
-}
-
-func TestServer_Request_Reject_HeaderFieldValueDEL(t *testing.T) {
- testRejectRequest(t, func(st *serverTester) { st.bodylessReq1("foo", "has\x7fdel") })
-}
-
-func TestServer_Request_Reject_Pseudo_Missing_method(t *testing.T) {
- testRejectRequest(t, func(st *serverTester) { st.bodylessReq1(":method", "") })
-}
-
-func TestServer_Request_Reject_Pseudo_ExactlyOne(t *testing.T) {
- // 8.1.2.3 Request Pseudo-Header Fields
- // "All HTTP/2 requests MUST include exactly one valid value" ...
- testRejectRequest(t, func(st *serverTester) {
- st.addLogFilter("duplicate pseudo-header")
- st.bodylessReq1(":method", "GET", ":method", "POST")
- })
-}
-
-func TestServer_Request_Reject_Pseudo_AfterRegular(t *testing.T) {
- // 8.1.2.3 Request Pseudo-Header Fields
- // "All pseudo-header fields MUST appear in the header block
- // before regular header fields. Any request or response that
- // contains a pseudo-header field that appears in a header
- // block after a regular header field MUST be treated as
- // malformed (Section 8.1.2.6)."
- testRejectRequest(t, func(st *serverTester) {
- st.addLogFilter("pseudo-header after regular header")
- var buf bytes.Buffer
- enc := hpack.NewEncoder(&buf)
- enc.WriteField(hpack.HeaderField{Name: ":method", Value: "GET"})
- enc.WriteField(hpack.HeaderField{Name: "regular", Value: "foobar"})
- enc.WriteField(hpack.HeaderField{Name: ":path", Value: "/"})
- enc.WriteField(hpack.HeaderField{Name: ":scheme", Value: "https"})
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1, // clients send odd numbers
- BlockFragment: buf.Bytes(),
- EndStream: true,
- EndHeaders: true,
- })
- })
-}
-
-func TestServer_Request_Reject_Pseudo_Missing_path(t *testing.T) {
- testRejectRequest(t, func(st *serverTester) { st.bodylessReq1(":path", "") })
-}
-
-func TestServer_Request_Reject_Pseudo_Missing_scheme(t *testing.T) {
- testRejectRequest(t, func(st *serverTester) { st.bodylessReq1(":scheme", "") })
-}
-
-func TestServer_Request_Reject_Pseudo_scheme_invalid(t *testing.T) {
- testRejectRequest(t, func(st *serverTester) { st.bodylessReq1(":scheme", "bogus") })
-}
-
-func TestServer_Request_Reject_Pseudo_Unknown(t *testing.T) {
- testRejectRequest(t, func(st *serverTester) {
- st.addLogFilter(`invalid pseudo-header ":unknown_thing"`)
- st.bodylessReq1(":unknown_thing", "")
- })
-}
-
-func testRejectRequest(t *testing.T, send func(*serverTester)) {
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- t.Error("server request made it to handler; should've been rejected")
- })
- defer st.Close()
-
- st.greet()
- send(st)
- st.wantRSTStream(1, ErrCodeProtocol)
-}
-
-func testRejectRequestWithProtocolError(t *testing.T, send func(*serverTester)) {
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- t.Error("server request made it to handler; should've been rejected")
- }, optQuiet)
- defer st.Close()
-
- st.greet()
- send(st)
- gf := st.wantGoAway()
- if gf.ErrCode != ErrCodeProtocol {
- t.Errorf("err code = %v; want %v", gf.ErrCode, ErrCodeProtocol)
- }
-}
-
-// Section 5.1, on idle connections: "Receiving any frame other than
-// HEADERS or PRIORITY on a stream in this state MUST be treated as a
-// connection error (Section 5.4.1) of type PROTOCOL_ERROR."
-func TestRejectFrameOnIdle_WindowUpdate(t *testing.T) {
- testRejectRequestWithProtocolError(t, func(st *serverTester) {
- st.fr.WriteWindowUpdate(123, 456)
- })
-}
-func TestRejectFrameOnIdle_Data(t *testing.T) {
- testRejectRequestWithProtocolError(t, func(st *serverTester) {
- st.fr.WriteData(123, true, nil)
- })
-}
-func TestRejectFrameOnIdle_RSTStream(t *testing.T) {
- testRejectRequestWithProtocolError(t, func(st *serverTester) {
- st.fr.WriteRSTStream(123, ErrCodeCancel)
- })
-}
-
-func TestServer_Request_Connect(t *testing.T) {
- testServerRequest(t, func(st *serverTester) {
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1,
- BlockFragment: st.encodeHeaderRaw(
- ":method", "CONNECT",
- ":authority", "example.com:123",
- ),
- EndStream: true,
- EndHeaders: true,
- })
- }, func(r *http.Request) {
- if g, w := r.Method, "CONNECT"; g != w {
- t.Errorf("Method = %q; want %q", g, w)
- }
- if g, w := r.RequestURI, "example.com:123"; g != w {
- t.Errorf("RequestURI = %q; want %q", g, w)
- }
- if g, w := r.URL.Host, "example.com:123"; g != w {
- t.Errorf("URL.Host = %q; want %q", g, w)
- }
- })
-}
-
-func TestServer_Request_Connect_InvalidPath(t *testing.T) {
- testServerRejectsStream(t, ErrCodeProtocol, func(st *serverTester) {
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1,
- BlockFragment: st.encodeHeaderRaw(
- ":method", "CONNECT",
- ":authority", "example.com:123",
- ":path", "/bogus",
- ),
- EndStream: true,
- EndHeaders: true,
- })
- })
-}
-
-func TestServer_Request_Connect_InvalidScheme(t *testing.T) {
- testServerRejectsStream(t, ErrCodeProtocol, func(st *serverTester) {
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1,
- BlockFragment: st.encodeHeaderRaw(
- ":method", "CONNECT",
- ":authority", "example.com:123",
- ":scheme", "https",
- ),
- EndStream: true,
- EndHeaders: true,
- })
- })
-}
-
-func TestServer_Ping(t *testing.T) {
- st := newServerTester(t, nil)
- defer st.Close()
- st.greet()
-
- // Server should ignore this one, since it has ACK set.
- ackPingData := [8]byte{1, 2, 4, 8, 16, 32, 64, 128}
- if err := st.fr.WritePing(true, ackPingData); err != nil {
- t.Fatal(err)
- }
-
- // But the server should reply to this one, since ACK is false.
- pingData := [8]byte{1, 2, 3, 4, 5, 6, 7, 8}
- if err := st.fr.WritePing(false, pingData); err != nil {
- t.Fatal(err)
- }
-
- pf := st.wantPing()
- if !pf.Flags.Has(FlagPingAck) {
- t.Error("response ping doesn't have ACK set")
- }
- if pf.Data != pingData {
- t.Errorf("response ping has data %q; want %q", pf.Data, pingData)
- }
-}
-
-func TestServer_RejectsLargeFrames(t *testing.T) {
- if runtime.GOOS == "windows" {
- t.Skip("see golang.org/issue/13434")
- }
-
- st := newServerTester(t, nil)
- defer st.Close()
- st.greet()
-
- // Write too large of a frame (too large by one byte)
- // We ignore the return value because it's expected that the server
- // will only read the first 9 bytes (the headre) and then disconnect.
- st.fr.WriteRawFrame(0xff, 0, 0, make([]byte, defaultMaxReadFrameSize+1))
-
- gf := st.wantGoAway()
- if gf.ErrCode != ErrCodeFrameSize {
- t.Errorf("GOAWAY err = %v; want %v", gf.ErrCode, ErrCodeFrameSize)
- }
- if st.serverLogBuf.Len() != 0 {
- // Previously we spun here for a bit until the GOAWAY disconnect
- // timer fired, logging while we fired.
- t.Errorf("unexpected server output: %.500s\n", st.serverLogBuf.Bytes())
- }
-}
-
-func TestServer_Handler_Sends_WindowUpdate(t *testing.T) {
- puppet := newHandlerPuppet()
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- puppet.act(w, r)
- })
- defer st.Close()
- defer puppet.done()
-
- st.greet()
-
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1, // clients send odd numbers
- BlockFragment: st.encodeHeader(":method", "POST"),
- EndStream: false, // data coming
- EndHeaders: true,
- })
- st.writeData(1, false, []byte("abcdef"))
- puppet.do(readBodyHandler(t, "abc"))
- st.wantWindowUpdate(0, 3)
- st.wantWindowUpdate(1, 3)
-
- puppet.do(readBodyHandler(t, "def"))
- st.wantWindowUpdate(0, 3)
- st.wantWindowUpdate(1, 3)
-
- st.writeData(1, true, []byte("ghijkl")) // END_STREAM here
- puppet.do(readBodyHandler(t, "ghi"))
- puppet.do(readBodyHandler(t, "jkl"))
- st.wantWindowUpdate(0, 3)
- st.wantWindowUpdate(0, 3) // no more stream-level, since END_STREAM
-}
-
-// the version of the TestServer_Handler_Sends_WindowUpdate with padding.
-// See golang.org/issue/16556
-func TestServer_Handler_Sends_WindowUpdate_Padding(t *testing.T) {
- puppet := newHandlerPuppet()
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- puppet.act(w, r)
- })
- defer st.Close()
- defer puppet.done()
-
- st.greet()
-
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1,
- BlockFragment: st.encodeHeader(":method", "POST"),
- EndStream: false,
- EndHeaders: true,
- })
- st.writeDataPadded(1, false, []byte("abcdef"), []byte{0, 0, 0, 0})
-
- // Expect to immediately get our 5 bytes of padding back for
- // both the connection and stream (4 bytes of padding + 1 byte of length)
- st.wantWindowUpdate(0, 5)
- st.wantWindowUpdate(1, 5)
-
- puppet.do(readBodyHandler(t, "abc"))
- st.wantWindowUpdate(0, 3)
- st.wantWindowUpdate(1, 3)
-
- puppet.do(readBodyHandler(t, "def"))
- st.wantWindowUpdate(0, 3)
- st.wantWindowUpdate(1, 3)
-}
-
-func TestServer_Send_GoAway_After_Bogus_WindowUpdate(t *testing.T) {
- st := newServerTester(t, nil)
- defer st.Close()
- st.greet()
- if err := st.fr.WriteWindowUpdate(0, 1<<31-1); err != nil {
- t.Fatal(err)
- }
- gf := st.wantGoAway()
- if gf.ErrCode != ErrCodeFlowControl {
- t.Errorf("GOAWAY err = %v; want %v", gf.ErrCode, ErrCodeFlowControl)
- }
- if gf.LastStreamID != 0 {
- t.Errorf("GOAWAY last stream ID = %v; want %v", gf.LastStreamID, 0)
- }
-}
-
-func TestServer_Send_RstStream_After_Bogus_WindowUpdate(t *testing.T) {
- inHandler := make(chan bool)
- blockHandler := make(chan bool)
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- inHandler <- true
- <-blockHandler
- })
- defer st.Close()
- defer close(blockHandler)
- st.greet()
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1,
- BlockFragment: st.encodeHeader(":method", "POST"),
- EndStream: false, // keep it open
- EndHeaders: true,
- })
- <-inHandler
- // Send a bogus window update:
- if err := st.fr.WriteWindowUpdate(1, 1<<31-1); err != nil {
- t.Fatal(err)
- }
- st.wantRSTStream(1, ErrCodeFlowControl)
-}
-
-// testServerPostUnblock sends a hanging POST with unsent data to handler,
-// then runs fn once in the handler, and verifies that the error returned from
-// handler is acceptable. It fails if takes over 5 seconds for handler to exit.
-func testServerPostUnblock(t *testing.T,
- handler func(http.ResponseWriter, *http.Request) error,
- fn func(*serverTester),
- checkErr func(error),
- otherHeaders ...string) {
- inHandler := make(chan bool)
- errc := make(chan error, 1)
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- inHandler <- true
- errc <- handler(w, r)
- })
- defer st.Close()
- st.greet()
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1,
- BlockFragment: st.encodeHeader(append([]string{":method", "POST"}, otherHeaders...)...),
- EndStream: false, // keep it open
- EndHeaders: true,
- })
- <-inHandler
- fn(st)
- select {
- case err := <-errc:
- if checkErr != nil {
- checkErr(err)
- }
- case <-time.After(5 * time.Second):
- t.Fatal("timeout waiting for Handler to return")
- }
-}
-
-func TestServer_RSTStream_Unblocks_Read(t *testing.T) {
- testServerPostUnblock(t,
- func(w http.ResponseWriter, r *http.Request) (err error) {
- _, err = r.Body.Read(make([]byte, 1))
- return
- },
- func(st *serverTester) {
- if err := st.fr.WriteRSTStream(1, ErrCodeCancel); err != nil {
- t.Fatal(err)
- }
- },
- func(err error) {
- want := StreamError{StreamID: 0x1, Code: 0x8}
- if !reflect.DeepEqual(err, want) {
- t.Errorf("Read error = %v; want %v", err, want)
- }
- },
- )
-}
-
-func TestServer_RSTStream_Unblocks_Header_Write(t *testing.T) {
- // Run this test a bunch, because it doesn't always
- // deadlock. But with a bunch, it did.
- n := 50
- if testing.Short() {
- n = 5
- }
- for i := 0; i < n; i++ {
- testServer_RSTStream_Unblocks_Header_Write(t)
- }
-}
-
-func testServer_RSTStream_Unblocks_Header_Write(t *testing.T) {
- inHandler := make(chan bool, 1)
- unblockHandler := make(chan bool, 1)
- headerWritten := make(chan bool, 1)
- wroteRST := make(chan bool, 1)
-
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- inHandler <- true
- <-wroteRST
- w.Header().Set("foo", "bar")
- w.WriteHeader(200)
- w.(http.Flusher).Flush()
- headerWritten <- true
- <-unblockHandler
- })
- defer st.Close()
-
- st.greet()
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1,
- BlockFragment: st.encodeHeader(":method", "POST"),
- EndStream: false, // keep it open
- EndHeaders: true,
- })
- <-inHandler
- if err := st.fr.WriteRSTStream(1, ErrCodeCancel); err != nil {
- t.Fatal(err)
- }
- wroteRST <- true
- st.awaitIdle()
- select {
- case <-headerWritten:
- case <-time.After(2 * time.Second):
- t.Error("timeout waiting for header write")
- }
- unblockHandler <- true
-}
-
-func TestServer_DeadConn_Unblocks_Read(t *testing.T) {
- testServerPostUnblock(t,
- func(w http.ResponseWriter, r *http.Request) (err error) {
- _, err = r.Body.Read(make([]byte, 1))
- return
- },
- func(st *serverTester) { st.cc.Close() },
- func(err error) {
- if err == nil {
- t.Error("unexpected nil error from Request.Body.Read")
- }
- },
- )
-}
-
-var blockUntilClosed = func(w http.ResponseWriter, r *http.Request) error {
- <-w.(http.CloseNotifier).CloseNotify()
- return nil
-}
-
-func TestServer_CloseNotify_After_RSTStream(t *testing.T) {
- testServerPostUnblock(t, blockUntilClosed, func(st *serverTester) {
- if err := st.fr.WriteRSTStream(1, ErrCodeCancel); err != nil {
- t.Fatal(err)
- }
- }, nil)
-}
-
-func TestServer_CloseNotify_After_ConnClose(t *testing.T) {
- testServerPostUnblock(t, blockUntilClosed, func(st *serverTester) { st.cc.Close() }, nil)
-}
-
-// that CloseNotify unblocks after a stream error due to the client's
-// problem that's unrelated to them explicitly canceling it (which is
-// TestServer_CloseNotify_After_RSTStream above)
-func TestServer_CloseNotify_After_StreamError(t *testing.T) {
- testServerPostUnblock(t, blockUntilClosed, func(st *serverTester) {
- // data longer than declared Content-Length => stream error
- st.writeData(1, true, []byte("1234"))
- }, nil, "content-length", "3")
-}
-
-func TestServer_StateTransitions(t *testing.T) {
- var st *serverTester
- inHandler := make(chan bool)
- writeData := make(chan bool)
- leaveHandler := make(chan bool)
- st = newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- inHandler <- true
- if st.stream(1) == nil {
- t.Errorf("nil stream 1 in handler")
- }
- if got, want := st.streamState(1), stateOpen; got != want {
- t.Errorf("in handler, state is %v; want %v", got, want)
- }
- writeData <- true
- if n, err := r.Body.Read(make([]byte, 1)); n != 0 || err != io.EOF {
- t.Errorf("body read = %d, %v; want 0, EOF", n, err)
- }
- if got, want := st.streamState(1), stateHalfClosedRemote; got != want {
- t.Errorf("in handler, state is %v; want %v", got, want)
- }
-
- <-leaveHandler
- })
- st.greet()
- if st.stream(1) != nil {
- t.Fatal("stream 1 should be empty")
- }
- if got := st.streamState(1); got != stateIdle {
- t.Fatalf("stream 1 should be idle; got %v", got)
- }
-
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1,
- BlockFragment: st.encodeHeader(":method", "POST"),
- EndStream: false, // keep it open
- EndHeaders: true,
- })
- <-inHandler
- <-writeData
- st.writeData(1, true, nil)
-
- leaveHandler <- true
- hf := st.wantHeaders()
- if !hf.StreamEnded() {
- t.Fatal("expected END_STREAM flag")
- }
-
- if got, want := st.streamState(1), stateClosed; got != want {
- t.Errorf("at end, state is %v; want %v", got, want)
- }
- if st.stream(1) != nil {
- t.Fatal("at end, stream 1 should be gone")
- }
-}
-
-// test HEADERS w/o EndHeaders + another HEADERS (should get rejected)
-func TestServer_Rejects_HeadersNoEnd_Then_Headers(t *testing.T) {
- testServerRejectsConn(t, func(st *serverTester) {
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1,
- BlockFragment: st.encodeHeader(),
- EndStream: true,
- EndHeaders: false,
- })
- st.writeHeaders(HeadersFrameParam{ // Not a continuation.
- StreamID: 3, // different stream.
- BlockFragment: st.encodeHeader(),
- EndStream: true,
- EndHeaders: true,
- })
- })
-}
-
-// test HEADERS w/o EndHeaders + PING (should get rejected)
-func TestServer_Rejects_HeadersNoEnd_Then_Ping(t *testing.T) {
- testServerRejectsConn(t, func(st *serverTester) {
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1,
- BlockFragment: st.encodeHeader(),
- EndStream: true,
- EndHeaders: false,
- })
- if err := st.fr.WritePing(false, [8]byte{}); err != nil {
- t.Fatal(err)
- }
- })
-}
-
-// test HEADERS w/ EndHeaders + a continuation HEADERS (should get rejected)
-func TestServer_Rejects_HeadersEnd_Then_Continuation(t *testing.T) {
- testServerRejectsConn(t, func(st *serverTester) {
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1,
- BlockFragment: st.encodeHeader(),
- EndStream: true,
- EndHeaders: true,
- })
- st.wantHeaders()
- if err := st.fr.WriteContinuation(1, true, encodeHeaderNoImplicit(t, "foo", "bar")); err != nil {
- t.Fatal(err)
- }
- })
-}
-
-// test HEADERS w/o EndHeaders + a continuation HEADERS on wrong stream ID
-func TestServer_Rejects_HeadersNoEnd_Then_ContinuationWrongStream(t *testing.T) {
- testServerRejectsConn(t, func(st *serverTester) {
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1,
- BlockFragment: st.encodeHeader(),
- EndStream: true,
- EndHeaders: false,
- })
- if err := st.fr.WriteContinuation(3, true, encodeHeaderNoImplicit(t, "foo", "bar")); err != nil {
- t.Fatal(err)
- }
- })
-}
-
-// No HEADERS on stream 0.
-func TestServer_Rejects_Headers0(t *testing.T) {
- testServerRejectsConn(t, func(st *serverTester) {
- st.fr.AllowIllegalWrites = true
- st.writeHeaders(HeadersFrameParam{
- StreamID: 0,
- BlockFragment: st.encodeHeader(),
- EndStream: true,
- EndHeaders: true,
- })
- })
-}
-
-// No CONTINUATION on stream 0.
-func TestServer_Rejects_Continuation0(t *testing.T) {
- testServerRejectsConn(t, func(st *serverTester) {
- st.fr.AllowIllegalWrites = true
- if err := st.fr.WriteContinuation(0, true, st.encodeHeader()); err != nil {
- t.Fatal(err)
- }
- })
-}
-
-// No PRIORITY on stream 0.
-func TestServer_Rejects_Priority0(t *testing.T) {
- testServerRejectsConn(t, func(st *serverTester) {
- st.fr.AllowIllegalWrites = true
- st.writePriority(0, PriorityParam{StreamDep: 1})
- })
-}
-
-// No HEADERS frame with a self-dependence.
-func TestServer_Rejects_HeadersSelfDependence(t *testing.T) {
- testServerRejectsStream(t, ErrCodeProtocol, func(st *serverTester) {
- st.fr.AllowIllegalWrites = true
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1,
- BlockFragment: st.encodeHeader(),
- EndStream: true,
- EndHeaders: true,
- Priority: PriorityParam{StreamDep: 1},
- })
- })
-}
-
-// No PRIORTY frame with a self-dependence.
-func TestServer_Rejects_PrioritySelfDependence(t *testing.T) {
- testServerRejectsStream(t, ErrCodeProtocol, func(st *serverTester) {
- st.fr.AllowIllegalWrites = true
- st.writePriority(1, PriorityParam{StreamDep: 1})
- })
-}
-
-func TestServer_Rejects_PushPromise(t *testing.T) {
- testServerRejectsConn(t, func(st *serverTester) {
- pp := PushPromiseParam{
- StreamID: 1,
- PromiseID: 3,
- }
- if err := st.fr.WritePushPromise(pp); err != nil {
- t.Fatal(err)
- }
- })
-}
-
-// testServerRejectsConn tests that the server hangs up with a GOAWAY
-// frame and a server close after the client does something
-// deserving a CONNECTION_ERROR.
-func testServerRejectsConn(t *testing.T, writeReq func(*serverTester)) {
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {})
- st.addLogFilter("connection error: PROTOCOL_ERROR")
- defer st.Close()
- st.greet()
- writeReq(st)
-
- st.wantGoAway()
- errc := make(chan error, 1)
- go func() {
- fr, err := st.fr.ReadFrame()
- if err == nil {
- err = fmt.Errorf("got frame of type %T", fr)
- }
- errc <- err
- }()
- select {
- case err := <-errc:
- if err != io.EOF {
- t.Errorf("ReadFrame = %v; want io.EOF", err)
- }
- case <-time.After(2 * time.Second):
- t.Error("timeout waiting for disconnect")
- }
-}
-
-// testServerRejectsStream tests that the server sends a RST_STREAM with the provided
-// error code after a client sends a bogus request.
-func testServerRejectsStream(t *testing.T, code ErrCode, writeReq func(*serverTester)) {
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {})
- defer st.Close()
- st.greet()
- writeReq(st)
- st.wantRSTStream(1, code)
-}
-
-// testServerRequest sets up an idle HTTP/2 connection and lets you
-// write a single request with writeReq, and then verify that the
-// *http.Request is built correctly in checkReq.
-func testServerRequest(t *testing.T, writeReq func(*serverTester), checkReq func(*http.Request)) {
- gotReq := make(chan bool, 1)
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- if r.Body == nil {
- t.Fatal("nil Body")
- }
- checkReq(r)
- gotReq <- true
- })
- defer st.Close()
-
- st.greet()
- writeReq(st)
-
- select {
- case <-gotReq:
- case <-time.After(2 * time.Second):
- t.Error("timeout waiting for request")
- }
-}
-
-func getSlash(st *serverTester) { st.bodylessReq1() }
-
-func TestServer_Response_NoData(t *testing.T) {
- testServerResponse(t, func(w http.ResponseWriter, r *http.Request) error {
- // Nothing.
- return nil
- }, func(st *serverTester) {
- getSlash(st)
- hf := st.wantHeaders()
- if !hf.StreamEnded() {
- t.Fatal("want END_STREAM flag")
- }
- if !hf.HeadersEnded() {
- t.Fatal("want END_HEADERS flag")
- }
- })
-}
-
-func TestServer_Response_NoData_Header_FooBar(t *testing.T) {
- testServerResponse(t, func(w http.ResponseWriter, r *http.Request) error {
- w.Header().Set("Foo-Bar", "some-value")
- return nil
- }, func(st *serverTester) {
- getSlash(st)
- hf := st.wantHeaders()
- if !hf.StreamEnded() {
- t.Fatal("want END_STREAM flag")
- }
- if !hf.HeadersEnded() {
- t.Fatal("want END_HEADERS flag")
- }
- goth := st.decodeHeader(hf.HeaderBlockFragment())
- wanth := [][2]string{
- {":status", "200"},
- {"foo-bar", "some-value"},
- {"content-length", "0"},
- }
- if !reflect.DeepEqual(goth, wanth) {
- t.Errorf("Got headers %v; want %v", goth, wanth)
- }
- })
-}
-
-func TestServer_Response_Data_Sniff_DoesntOverride(t *testing.T) {
- const msg = "<html>this is HTML."
- testServerResponse(t, func(w http.ResponseWriter, r *http.Request) error {
- w.Header().Set("Content-Type", "foo/bar")
- io.WriteString(w, msg)
- return nil
- }, func(st *serverTester) {
- getSlash(st)
- hf := st.wantHeaders()
- if hf.StreamEnded() {
- t.Fatal("don't want END_STREAM, expecting data")
- }
- if !hf.HeadersEnded() {
- t.Fatal("want END_HEADERS flag")
- }
- goth := st.decodeHeader(hf.HeaderBlockFragment())
- wanth := [][2]string{
- {":status", "200"},
- {"content-type", "foo/bar"},
- {"content-length", strconv.Itoa(len(msg))},
- }
- if !reflect.DeepEqual(goth, wanth) {
- t.Errorf("Got headers %v; want %v", goth, wanth)
- }
- df := st.wantData()
- if !df.StreamEnded() {
- t.Error("expected DATA to have END_STREAM flag")
- }
- if got := string(df.Data()); got != msg {
- t.Errorf("got DATA %q; want %q", got, msg)
- }
- })
-}
-
-func TestServer_Response_Nosniff_WithoutContentType(t *testing.T) {
- const msg = "<html>this is HTML."
- testServerResponse(t, func(w http.ResponseWriter, r *http.Request) error {
- w.Header().Set("X-Content-Type-Options", "nosniff")
- w.WriteHeader(200)
- io.WriteString(w, msg)
- return nil
- }, func(st *serverTester) {
- getSlash(st)
- hf := st.wantHeaders()
- if hf.StreamEnded() {
- t.Fatal("don't want END_STREAM, expecting data")
- }
- if !hf.HeadersEnded() {
- t.Fatal("want END_HEADERS flag")
- }
- goth := st.decodeHeader(hf.HeaderBlockFragment())
- wanth := [][2]string{
- {":status", "200"},
- {"x-content-type-options", "nosniff"},
- {"content-type", "application/octet-stream"},
- {"content-length", strconv.Itoa(len(msg))},
- }
- if !reflect.DeepEqual(goth, wanth) {
- t.Errorf("Got headers %v; want %v", goth, wanth)
- }
- df := st.wantData()
- if !df.StreamEnded() {
- t.Error("expected DATA to have END_STREAM flag")
- }
- if got := string(df.Data()); got != msg {
- t.Errorf("got DATA %q; want %q", got, msg)
- }
- })
-}
-
-func TestServer_Response_TransferEncoding_chunked(t *testing.T) {
- const msg = "hi"
- testServerResponse(t, func(w http.ResponseWriter, r *http.Request) error {
- w.Header().Set("Transfer-Encoding", "chunked") // should be stripped
- io.WriteString(w, msg)
- return nil
- }, func(st *serverTester) {
- getSlash(st)
- hf := st.wantHeaders()
- goth := st.decodeHeader(hf.HeaderBlockFragment())
- wanth := [][2]string{
- {":status", "200"},
- {"content-type", "text/plain; charset=utf-8"},
- {"content-length", strconv.Itoa(len(msg))},
- }
- if !reflect.DeepEqual(goth, wanth) {
- t.Errorf("Got headers %v; want %v", goth, wanth)
- }
- })
-}
-
-// Header accessed only after the initial write.
-func TestServer_Response_Data_IgnoreHeaderAfterWrite_After(t *testing.T) {
- const msg = "<html>this is HTML."
- testServerResponse(t, func(w http.ResponseWriter, r *http.Request) error {
- io.WriteString(w, msg)
- w.Header().Set("foo", "should be ignored")
- return nil
- }, func(st *serverTester) {
- getSlash(st)
- hf := st.wantHeaders()
- if hf.StreamEnded() {
- t.Fatal("unexpected END_STREAM")
- }
- if !hf.HeadersEnded() {
- t.Fatal("want END_HEADERS flag")
- }
- goth := st.decodeHeader(hf.HeaderBlockFragment())
- wanth := [][2]string{
- {":status", "200"},
- {"content-type", "text/html; charset=utf-8"},
- {"content-length", strconv.Itoa(len(msg))},
- }
- if !reflect.DeepEqual(goth, wanth) {
- t.Errorf("Got headers %v; want %v", goth, wanth)
- }
- })
-}
-
-// Header accessed before the initial write and later mutated.
-func TestServer_Response_Data_IgnoreHeaderAfterWrite_Overwrite(t *testing.T) {
- const msg = "<html>this is HTML."
- testServerResponse(t, func(w http.ResponseWriter, r *http.Request) error {
- w.Header().Set("foo", "proper value")
- io.WriteString(w, msg)
- w.Header().Set("foo", "should be ignored")
- return nil
- }, func(st *serverTester) {
- getSlash(st)
- hf := st.wantHeaders()
- if hf.StreamEnded() {
- t.Fatal("unexpected END_STREAM")
- }
- if !hf.HeadersEnded() {
- t.Fatal("want END_HEADERS flag")
- }
- goth := st.decodeHeader(hf.HeaderBlockFragment())
- wanth := [][2]string{
- {":status", "200"},
- {"foo", "proper value"},
- {"content-type", "text/html; charset=utf-8"},
- {"content-length", strconv.Itoa(len(msg))},
- }
- if !reflect.DeepEqual(goth, wanth) {
- t.Errorf("Got headers %v; want %v", goth, wanth)
- }
- })
-}
-
-func TestServer_Response_Data_SniffLenType(t *testing.T) {
- const msg = "<html>this is HTML."
- testServerResponse(t, func(w http.ResponseWriter, r *http.Request) error {
- io.WriteString(w, msg)
- return nil
- }, func(st *serverTester) {
- getSlash(st)
- hf := st.wantHeaders()
- if hf.StreamEnded() {
- t.Fatal("don't want END_STREAM, expecting data")
- }
- if !hf.HeadersEnded() {
- t.Fatal("want END_HEADERS flag")
- }
- goth := st.decodeHeader(hf.HeaderBlockFragment())
- wanth := [][2]string{
- {":status", "200"},
- {"content-type", "text/html; charset=utf-8"},
- {"content-length", strconv.Itoa(len(msg))},
- }
- if !reflect.DeepEqual(goth, wanth) {
- t.Errorf("Got headers %v; want %v", goth, wanth)
- }
- df := st.wantData()
- if !df.StreamEnded() {
- t.Error("expected DATA to have END_STREAM flag")
- }
- if got := string(df.Data()); got != msg {
- t.Errorf("got DATA %q; want %q", got, msg)
- }
- })
-}
-
-func TestServer_Response_Header_Flush_MidWrite(t *testing.T) {
- const msg = "<html>this is HTML"
- const msg2 = ", and this is the next chunk"
- testServerResponse(t, func(w http.ResponseWriter, r *http.Request) error {
- io.WriteString(w, msg)
- w.(http.Flusher).Flush()
- io.WriteString(w, msg2)
- return nil
- }, func(st *serverTester) {
- getSlash(st)
- hf := st.wantHeaders()
- if hf.StreamEnded() {
- t.Fatal("unexpected END_STREAM flag")
- }
- if !hf.HeadersEnded() {
- t.Fatal("want END_HEADERS flag")
- }
- goth := st.decodeHeader(hf.HeaderBlockFragment())
- wanth := [][2]string{
- {":status", "200"},
- {"content-type", "text/html; charset=utf-8"}, // sniffed
- // and no content-length
- }
- if !reflect.DeepEqual(goth, wanth) {
- t.Errorf("Got headers %v; want %v", goth, wanth)
- }
- {
- df := st.wantData()
- if df.StreamEnded() {
- t.Error("unexpected END_STREAM flag")
- }
- if got := string(df.Data()); got != msg {
- t.Errorf("got DATA %q; want %q", got, msg)
- }
- }
- {
- df := st.wantData()
- if !df.StreamEnded() {
- t.Error("wanted END_STREAM flag on last data chunk")
- }
- if got := string(df.Data()); got != msg2 {
- t.Errorf("got DATA %q; want %q", got, msg2)
- }
- }
- })
-}
-
-func TestServer_Response_LargeWrite(t *testing.T) {
- const size = 1 << 20
- const maxFrameSize = 16 << 10
- testServerResponse(t, func(w http.ResponseWriter, r *http.Request) error {
- n, err := w.Write(bytes.Repeat([]byte("a"), size))
- if err != nil {
- return fmt.Errorf("Write error: %v", err)
- }
- if n != size {
- return fmt.Errorf("wrong size %d from Write", n)
- }
- return nil
- }, func(st *serverTester) {
- if err := st.fr.WriteSettings(
- Setting{SettingInitialWindowSize, 0},
- Setting{SettingMaxFrameSize, maxFrameSize},
- ); err != nil {
- t.Fatal(err)
- }
- st.wantSettingsAck()
-
- getSlash(st) // make the single request
-
- // Give the handler quota to write:
- if err := st.fr.WriteWindowUpdate(1, size); err != nil {
- t.Fatal(err)
- }
- // Give the handler quota to write to connection-level
- // window as well
- if err := st.fr.WriteWindowUpdate(0, size); err != nil {
- t.Fatal(err)
- }
- hf := st.wantHeaders()
- if hf.StreamEnded() {
- t.Fatal("unexpected END_STREAM flag")
- }
- if !hf.HeadersEnded() {
- t.Fatal("want END_HEADERS flag")
- }
- goth := st.decodeHeader(hf.HeaderBlockFragment())
- wanth := [][2]string{
- {":status", "200"},
- {"content-type", "text/plain; charset=utf-8"}, // sniffed
- // and no content-length
- }
- if !reflect.DeepEqual(goth, wanth) {
- t.Errorf("Got headers %v; want %v", goth, wanth)
- }
- var bytes, frames int
- for {
- df := st.wantData()
- bytes += len(df.Data())
- frames++
- for _, b := range df.Data() {
- if b != 'a' {
- t.Fatal("non-'a' byte seen in DATA")
- }
- }
- if df.StreamEnded() {
- break
- }
- }
- if bytes != size {
- t.Errorf("Got %d bytes; want %d", bytes, size)
- }
- if want := int(size / maxFrameSize); frames < want || frames > want*2 {
- t.Errorf("Got %d frames; want %d", frames, size)
- }
- })
-}
-
-// Test that the handler can't write more than the client allows
-func TestServer_Response_LargeWrite_FlowControlled(t *testing.T) {
- // Make these reads. Before each read, the client adds exactly enough
- // flow-control to satisfy the read. Numbers chosen arbitrarily.
- reads := []int{123, 1, 13, 127}
- size := 0
- for _, n := range reads {
- size += n
- }
-
- testServerResponse(t, func(w http.ResponseWriter, r *http.Request) error {
- w.(http.Flusher).Flush()
- n, err := w.Write(bytes.Repeat([]byte("a"), size))
- if err != nil {
- return fmt.Errorf("Write error: %v", err)
- }
- if n != size {
- return fmt.Errorf("wrong size %d from Write", n)
- }
- return nil
- }, func(st *serverTester) {
- // Set the window size to something explicit for this test.
- // It's also how much initial data we expect.
- if err := st.fr.WriteSettings(Setting{SettingInitialWindowSize, uint32(reads[0])}); err != nil {
- t.Fatal(err)
- }
- st.wantSettingsAck()
-
- getSlash(st) // make the single request
-
- hf := st.wantHeaders()
- if hf.StreamEnded() {
- t.Fatal("unexpected END_STREAM flag")
- }
- if !hf.HeadersEnded() {
- t.Fatal("want END_HEADERS flag")
- }
-
- df := st.wantData()
- if got := len(df.Data()); got != reads[0] {
- t.Fatalf("Initial window size = %d but got DATA with %d bytes", reads[0], got)
- }
-
- for _, quota := range reads[1:] {
- if err := st.fr.WriteWindowUpdate(1, uint32(quota)); err != nil {
- t.Fatal(err)
- }
- df := st.wantData()
- if int(quota) != len(df.Data()) {
- t.Fatalf("read %d bytes after giving %d quota", len(df.Data()), quota)
- }
- }
- })
-}
-
-// Test that the handler blocked in a Write is unblocked if the server sends a RST_STREAM.
-func TestServer_Response_RST_Unblocks_LargeWrite(t *testing.T) {
- const size = 1 << 20
- const maxFrameSize = 16 << 10
- testServerResponse(t, func(w http.ResponseWriter, r *http.Request) error {
- w.(http.Flusher).Flush()
- errc := make(chan error, 1)
- go func() {
- _, err := w.Write(bytes.Repeat([]byte("a"), size))
- errc <- err
- }()
- select {
- case err := <-errc:
- if err == nil {
- return errors.New("unexpected nil error from Write in handler")
- }
- return nil
- case <-time.After(2 * time.Second):
- return errors.New("timeout waiting for Write in handler")
- }
- }, func(st *serverTester) {
- if err := st.fr.WriteSettings(
- Setting{SettingInitialWindowSize, 0},
- Setting{SettingMaxFrameSize, maxFrameSize},
- ); err != nil {
- t.Fatal(err)
- }
- st.wantSettingsAck()
-
- getSlash(st) // make the single request
-
- hf := st.wantHeaders()
- if hf.StreamEnded() {
- t.Fatal("unexpected END_STREAM flag")
- }
- if !hf.HeadersEnded() {
- t.Fatal("want END_HEADERS flag")
- }
-
- if err := st.fr.WriteRSTStream(1, ErrCodeCancel); err != nil {
- t.Fatal(err)
- }
- })
-}
-
-func TestServer_Response_Empty_Data_Not_FlowControlled(t *testing.T) {
- testServerResponse(t, func(w http.ResponseWriter, r *http.Request) error {
- w.(http.Flusher).Flush()
- // Nothing; send empty DATA
- return nil
- }, func(st *serverTester) {
- // Handler gets no data quota:
- if err := st.fr.WriteSettings(Setting{SettingInitialWindowSize, 0}); err != nil {
- t.Fatal(err)
- }
- st.wantSettingsAck()
-
- getSlash(st) // make the single request
-
- hf := st.wantHeaders()
- if hf.StreamEnded() {
- t.Fatal("unexpected END_STREAM flag")
- }
- if !hf.HeadersEnded() {
- t.Fatal("want END_HEADERS flag")
- }
-
- df := st.wantData()
- if got := len(df.Data()); got != 0 {
- t.Fatalf("unexpected %d DATA bytes; want 0", got)
- }
- if !df.StreamEnded() {
- t.Fatal("DATA didn't have END_STREAM")
- }
- })
-}
-
-func TestServer_Response_Automatic100Continue(t *testing.T) {
- const msg = "foo"
- const reply = "bar"
- testServerResponse(t, func(w http.ResponseWriter, r *http.Request) error {
- if v := r.Header.Get("Expect"); v != "" {
- t.Errorf("Expect header = %q; want empty", v)
- }
- buf := make([]byte, len(msg))
- // This read should trigger the 100-continue being sent.
- if n, err := io.ReadFull(r.Body, buf); err != nil || n != len(msg) || string(buf) != msg {
- return fmt.Errorf("ReadFull = %q, %v; want %q, nil", buf[:n], err, msg)
- }
- _, err := io.WriteString(w, reply)
- return err
- }, func(st *serverTester) {
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1, // clients send odd numbers
- BlockFragment: st.encodeHeader(":method", "POST", "expect", "100-continue"),
- EndStream: false,
- EndHeaders: true,
- })
- hf := st.wantHeaders()
- if hf.StreamEnded() {
- t.Fatal("unexpected END_STREAM flag")
- }
- if !hf.HeadersEnded() {
- t.Fatal("want END_HEADERS flag")
- }
- goth := st.decodeHeader(hf.HeaderBlockFragment())
- wanth := [][2]string{
- {":status", "100"},
- }
- if !reflect.DeepEqual(goth, wanth) {
- t.Fatalf("Got headers %v; want %v", goth, wanth)
- }
-
- // Okay, they sent status 100, so we can send our
- // gigantic and/or sensitive "foo" payload now.
- st.writeData(1, true, []byte(msg))
-
- st.wantWindowUpdate(0, uint32(len(msg)))
-
- hf = st.wantHeaders()
- if hf.StreamEnded() {
- t.Fatal("expected data to follow")
- }
- if !hf.HeadersEnded() {
- t.Fatal("want END_HEADERS flag")
- }
- goth = st.decodeHeader(hf.HeaderBlockFragment())
- wanth = [][2]string{
- {":status", "200"},
- {"content-type", "text/plain; charset=utf-8"},
- {"content-length", strconv.Itoa(len(reply))},
- }
- if !reflect.DeepEqual(goth, wanth) {
- t.Errorf("Got headers %v; want %v", goth, wanth)
- }
-
- df := st.wantData()
- if string(df.Data()) != reply {
- t.Errorf("Client read %q; want %q", df.Data(), reply)
- }
- if !df.StreamEnded() {
- t.Errorf("expect data stream end")
- }
- })
-}
-
-func TestServer_HandlerWriteErrorOnDisconnect(t *testing.T) {
- errc := make(chan error, 1)
- testServerResponse(t, func(w http.ResponseWriter, r *http.Request) error {
- p := []byte("some data.\n")
- for {
- _, err := w.Write(p)
- if err != nil {
- errc <- err
- return nil
- }
- }
- }, func(st *serverTester) {
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1,
- BlockFragment: st.encodeHeader(),
- EndStream: false,
- EndHeaders: true,
- })
- hf := st.wantHeaders()
- if hf.StreamEnded() {
- t.Fatal("unexpected END_STREAM flag")
- }
- if !hf.HeadersEnded() {
- t.Fatal("want END_HEADERS flag")
- }
- // Close the connection and wait for the handler to (hopefully) notice.
- st.cc.Close()
- select {
- case <-errc:
- case <-time.After(5 * time.Second):
- t.Error("timeout")
- }
- })
-}
-
-func TestServer_Rejects_Too_Many_Streams(t *testing.T) {
- const testPath = "/some/path"
-
- inHandler := make(chan uint32)
- leaveHandler := make(chan bool)
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- id := w.(*responseWriter).rws.stream.id
- inHandler <- id
- if id == 1+(defaultMaxStreams+1)*2 && r.URL.Path != testPath {
- t.Errorf("decoded final path as %q; want %q", r.URL.Path, testPath)
- }
- <-leaveHandler
- })
- defer st.Close()
- st.greet()
- nextStreamID := uint32(1)
- streamID := func() uint32 {
- defer func() { nextStreamID += 2 }()
- return nextStreamID
- }
- sendReq := func(id uint32, headers ...string) {
- st.writeHeaders(HeadersFrameParam{
- StreamID: id,
- BlockFragment: st.encodeHeader(headers...),
- EndStream: true,
- EndHeaders: true,
- })
- }
- for i := 0; i < defaultMaxStreams; i++ {
- sendReq(streamID())
- <-inHandler
- }
- defer func() {
- for i := 0; i < defaultMaxStreams; i++ {
- leaveHandler <- true
- }
- }()
-
- // And this one should cross the limit:
- // (It's also sent as a CONTINUATION, to verify we still track the decoder context,
- // even if we're rejecting it)
- rejectID := streamID()
- headerBlock := st.encodeHeader(":path", testPath)
- frag1, frag2 := headerBlock[:3], headerBlock[3:]
- st.writeHeaders(HeadersFrameParam{
- StreamID: rejectID,
- BlockFragment: frag1,
- EndStream: true,
- EndHeaders: false, // CONTINUATION coming
- })
- if err := st.fr.WriteContinuation(rejectID, true, frag2); err != nil {
- t.Fatal(err)
- }
- st.wantRSTStream(rejectID, ErrCodeProtocol)
-
- // But let a handler finish:
- leaveHandler <- true
- st.wantHeaders()
-
- // And now another stream should be able to start:
- goodID := streamID()
- sendReq(goodID, ":path", testPath)
- select {
- case got := <-inHandler:
- if got != goodID {
- t.Errorf("Got stream %d; want %d", got, goodID)
- }
- case <-time.After(3 * time.Second):
- t.Error("timeout waiting for handler")
- }
-}
-
-// So many response headers that the server needs to use CONTINUATION frames:
-func TestServer_Response_ManyHeaders_With_Continuation(t *testing.T) {
- testServerResponse(t, func(w http.ResponseWriter, r *http.Request) error {
- h := w.Header()
- for i := 0; i < 5000; i++ {
- h.Set(fmt.Sprintf("x-header-%d", i), fmt.Sprintf("x-value-%d", i))
- }
- return nil
- }, func(st *serverTester) {
- getSlash(st)
- hf := st.wantHeaders()
- if hf.HeadersEnded() {
- t.Fatal("got unwanted END_HEADERS flag")
- }
- n := 0
- for {
- n++
- cf := st.wantContinuation()
- if cf.HeadersEnded() {
- break
- }
- }
- if n < 5 {
- t.Errorf("Only got %d CONTINUATION frames; expected 5+ (currently 6)", n)
- }
- })
-}
-
-// This previously crashed (reported by Mathieu Lonjaret as observed
-// while using Camlistore) because we got a DATA frame from the client
-// after the handler exited and our logic at the time was wrong,
-// keeping a stream in the map in stateClosed, which tickled an
-// invariant check later when we tried to remove that stream (via
-// defer sc.closeAllStreamsOnConnClose) when the serverConn serve loop
-// ended.
-func TestServer_NoCrash_HandlerClose_Then_ClientClose(t *testing.T) {
- testServerResponse(t, func(w http.ResponseWriter, r *http.Request) error {
- // nothing
- return nil
- }, func(st *serverTester) {
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1,
- BlockFragment: st.encodeHeader(),
- EndStream: false, // DATA is coming
- EndHeaders: true,
- })
- hf := st.wantHeaders()
- if !hf.HeadersEnded() || !hf.StreamEnded() {
- t.Fatalf("want END_HEADERS+END_STREAM, got %v", hf)
- }
-
- // Sent when the a Handler closes while a client has
- // indicated it's still sending DATA:
- st.wantRSTStream(1, ErrCodeNo)
-
- // Now the handler has ended, so it's ended its
- // stream, but the client hasn't closed its side
- // (stateClosedLocal). So send more data and verify
- // it doesn't crash with an internal invariant panic, like
- // it did before.
- st.writeData(1, true, []byte("foo"))
-
- // Get our flow control bytes back, since the handler didn't get them.
- st.wantWindowUpdate(0, uint32(len("foo")))
-
- // Sent after a peer sends data anyway (admittedly the
- // previous RST_STREAM might've still been in-flight),
- // but they'll get the more friendly 'cancel' code
- // first.
- st.wantRSTStream(1, ErrCodeStreamClosed)
-
- // Set up a bunch of machinery to record the panic we saw
- // previously.
- var (
- panMu sync.Mutex
- panicVal interface{}
- )
-
- testHookOnPanicMu.Lock()
- testHookOnPanic = func(sc *serverConn, pv interface{}) bool {
- panMu.Lock()
- panicVal = pv
- panMu.Unlock()
- return true
- }
- testHookOnPanicMu.Unlock()
-
- // Now force the serve loop to end, via closing the connection.
- st.cc.Close()
- select {
- case <-st.sc.doneServing:
- // Loop has exited.
- panMu.Lock()
- got := panicVal
- panMu.Unlock()
- if got != nil {
- t.Errorf("Got panic: %v", got)
- }
- case <-time.After(5 * time.Second):
- t.Error("timeout")
- }
- })
-}
-
-func TestServer_Rejects_TLS10(t *testing.T) { testRejectTLS(t, tls.VersionTLS10) }
-func TestServer_Rejects_TLS11(t *testing.T) { testRejectTLS(t, tls.VersionTLS11) }
-
-func testRejectTLS(t *testing.T, max uint16) {
- st := newServerTester(t, nil, func(c *tls.Config) {
- c.MaxVersion = max
- })
- defer st.Close()
- gf := st.wantGoAway()
- if got, want := gf.ErrCode, ErrCodeInadequateSecurity; got != want {
- t.Errorf("Got error code %v; want %v", got, want)
- }
-}
-
-func TestServer_Rejects_TLSBadCipher(t *testing.T) {
- st := newServerTester(t, nil, func(c *tls.Config) {
- // Only list bad ones:
- c.CipherSuites = []uint16{
- tls.TLS_RSA_WITH_RC4_128_SHA,
- tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA,
- tls.TLS_RSA_WITH_AES_128_CBC_SHA,
- tls.TLS_RSA_WITH_AES_256_CBC_SHA,
- tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA,
- tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
- tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
- tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA,
- tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,
- tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
- tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
- cipher_TLS_RSA_WITH_AES_128_CBC_SHA256,
- }
- })
- defer st.Close()
- gf := st.wantGoAway()
- if got, want := gf.ErrCode, ErrCodeInadequateSecurity; got != want {
- t.Errorf("Got error code %v; want %v", got, want)
- }
-}
-
-func TestServer_Advertises_Common_Cipher(t *testing.T) {
- const requiredSuite = tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
- st := newServerTester(t, nil, func(c *tls.Config) {
- // Have the client only support the one required by the spec.
- c.CipherSuites = []uint16{requiredSuite}
- }, func(ts *httptest.Server) {
- var srv *http.Server = ts.Config
- // Have the server configured with no specific cipher suites.
- // This tests that Go's defaults include the required one.
- srv.TLSConfig = nil
- })
- defer st.Close()
- st.greet()
-}
-
-func (st *serverTester) onHeaderField(f hpack.HeaderField) {
- if f.Name == "date" {
- return
- }
- st.decodedHeaders = append(st.decodedHeaders, [2]string{f.Name, f.Value})
-}
-
-func (st *serverTester) decodeHeader(headerBlock []byte) (pairs [][2]string) {
- st.decodedHeaders = nil
- if _, err := st.hpackDec.Write(headerBlock); err != nil {
- st.t.Fatalf("hpack decoding error: %v", err)
- }
- if err := st.hpackDec.Close(); err != nil {
- st.t.Fatalf("hpack decoding error: %v", err)
- }
- return st.decodedHeaders
-}
-
-// testServerResponse sets up an idle HTTP/2 connection. The client function should
-// write a single request that must be handled by the handler. This waits up to 5s
-// for client to return, then up to an additional 2s for the handler to return.
-func testServerResponse(t testing.TB,
- handler func(http.ResponseWriter, *http.Request) error,
- client func(*serverTester),
-) {
- errc := make(chan error, 1)
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- if r.Body == nil {
- t.Fatal("nil Body")
- }
- errc <- handler(w, r)
- })
- defer st.Close()
-
- donec := make(chan bool)
- go func() {
- defer close(donec)
- st.greet()
- client(st)
- }()
-
- select {
- case <-donec:
- case <-time.After(5 * time.Second):
- t.Fatal("timeout in client")
- }
-
- select {
- case err := <-errc:
- if err != nil {
- t.Fatalf("Error in handler: %v", err)
- }
- case <-time.After(2 * time.Second):
- t.Fatal("timeout in handler")
- }
-}
-
-// readBodyHandler returns an http Handler func that reads len(want)
-// bytes from r.Body and fails t if the contents read were not
-// the value of want.
-func readBodyHandler(t *testing.T, want string) func(w http.ResponseWriter, r *http.Request) {
- return func(w http.ResponseWriter, r *http.Request) {
- buf := make([]byte, len(want))
- _, err := io.ReadFull(r.Body, buf)
- if err != nil {
- t.Error(err)
- return
- }
- if string(buf) != want {
- t.Errorf("read %q; want %q", buf, want)
- }
- }
-}
-
-// TestServerWithCurl currently fails, hence the LenientCipherSuites test. See:
-// https://github.com/tatsuhiro-t/nghttp2/issues/140 &
-// http://sourceforge.net/p/curl/bugs/1472/
-func TestServerWithCurl(t *testing.T) { testServerWithCurl(t, false) }
-func TestServerWithCurl_LenientCipherSuites(t *testing.T) { testServerWithCurl(t, true) }
-
-func testServerWithCurl(t *testing.T, permitProhibitedCipherSuites bool) {
- if runtime.GOOS != "linux" {
- t.Skip("skipping Docker test when not on Linux; requires --net which won't work with boot2docker anyway")
- }
- if testing.Short() {
- t.Skip("skipping curl test in short mode")
- }
- requireCurl(t)
- var gotConn int32
- testHookOnConn = func() { atomic.StoreInt32(&gotConn, 1) }
-
- const msg = "Hello from curl!\n"
- ts := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Foo", "Bar")
- w.Header().Set("Client-Proto", r.Proto)
- io.WriteString(w, msg)
- }))
- ConfigureServer(ts.Config, &Server{
- PermitProhibitedCipherSuites: permitProhibitedCipherSuites,
- })
- ts.TLS = ts.Config.TLSConfig // the httptest.Server has its own copy of this TLS config
- ts.StartTLS()
- defer ts.Close()
-
- t.Logf("Running test server for curl to hit at: %s", ts.URL)
- container := curl(t, "--silent", "--http2", "--insecure", "-v", ts.URL)
- defer kill(container)
- resc := make(chan interface{}, 1)
- go func() {
- res, err := dockerLogs(container)
- if err != nil {
- resc <- err
- } else {
- resc <- res
- }
- }()
- select {
- case res := <-resc:
- if err, ok := res.(error); ok {
- t.Fatal(err)
- }
- body := string(res.([]byte))
- // Search for both "key: value" and "key:value", since curl changed their format
- // Our Dockerfile contains the latest version (no space), but just in case people
- // didn't rebuild, check both.
- if !strings.Contains(body, "foo: Bar") && !strings.Contains(body, "foo:Bar") {
- t.Errorf("didn't see foo: Bar header")
- t.Logf("Got: %s", body)
- }
- if !strings.Contains(body, "client-proto: HTTP/2") && !strings.Contains(body, "client-proto:HTTP/2") {
- t.Errorf("didn't see client-proto: HTTP/2 header")
- t.Logf("Got: %s", res)
- }
- if !strings.Contains(string(res.([]byte)), msg) {
- t.Errorf("didn't see %q content", msg)
- t.Logf("Got: %s", res)
- }
- case <-time.After(3 * time.Second):
- t.Errorf("timeout waiting for curl")
- }
-
- if atomic.LoadInt32(&gotConn) == 0 {
- t.Error("never saw an http2 connection")
- }
-}
-
-var doh2load = flag.Bool("h2load", false, "Run h2load test")
-
-func TestServerWithH2Load(t *testing.T) {
- if !*doh2load {
- t.Skip("Skipping without --h2load flag.")
- }
- if runtime.GOOS != "linux" {
- t.Skip("skipping Docker test when not on Linux; requires --net which won't work with boot2docker anyway")
- }
- requireH2load(t)
-
- msg := strings.Repeat("Hello, h2load!\n", 5000)
- ts := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- io.WriteString(w, msg)
- w.(http.Flusher).Flush()
- io.WriteString(w, msg)
- }))
- ts.StartTLS()
- defer ts.Close()
-
- cmd := exec.Command("docker", "run", "--net=host", "--entrypoint=/usr/local/bin/h2load", "gohttp2/curl",
- "-n100000", "-c100", "-m100", ts.URL)
- cmd.Stdout = os.Stdout
- cmd.Stderr = os.Stderr
- if err := cmd.Run(); err != nil {
- t.Fatal(err)
- }
-}
-
-// Issue 12843
-func TestServerDoS_MaxHeaderListSize(t *testing.T) {
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {})
- defer st.Close()
-
- // shake hands
- frameSize := defaultMaxReadFrameSize
- var advHeaderListSize *uint32
- st.greetAndCheckSettings(func(s Setting) error {
- switch s.ID {
- case SettingMaxFrameSize:
- if s.Val < minMaxFrameSize {
- frameSize = minMaxFrameSize
- } else if s.Val > maxFrameSize {
- frameSize = maxFrameSize
- } else {
- frameSize = int(s.Val)
- }
- case SettingMaxHeaderListSize:
- advHeaderListSize = &s.Val
- }
- return nil
- })
-
- if advHeaderListSize == nil {
- t.Errorf("server didn't advertise a max header list size")
- } else if *advHeaderListSize == 0 {
- t.Errorf("server advertised a max header list size of 0")
- }
-
- st.encodeHeaderField(":method", "GET")
- st.encodeHeaderField(":path", "/")
- st.encodeHeaderField(":scheme", "https")
- cookie := strings.Repeat("*", 4058)
- st.encodeHeaderField("cookie", cookie)
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1,
- BlockFragment: st.headerBuf.Bytes(),
- EndStream: true,
- EndHeaders: false,
- })
-
- // Capture the short encoding of a duplicate ~4K cookie, now
- // that we've already sent it once.
- st.headerBuf.Reset()
- st.encodeHeaderField("cookie", cookie)
-
- // Now send 1MB of it.
- const size = 1 << 20
- b := bytes.Repeat(st.headerBuf.Bytes(), size/st.headerBuf.Len())
- for len(b) > 0 {
- chunk := b
- if len(chunk) > frameSize {
- chunk = chunk[:frameSize]
- }
- b = b[len(chunk):]
- st.fr.WriteContinuation(1, len(b) == 0, chunk)
- }
-
- h := st.wantHeaders()
- if !h.HeadersEnded() {
- t.Fatalf("Got HEADERS without END_HEADERS set: %v", h)
- }
- headers := st.decodeHeader(h.HeaderBlockFragment())
- want := [][2]string{
- {":status", "431"},
- {"content-type", "text/html; charset=utf-8"},
- {"content-length", "63"},
- }
- if !reflect.DeepEqual(headers, want) {
- t.Errorf("Headers mismatch.\n got: %q\nwant: %q\n", headers, want)
- }
-}
-
-func TestCompressionErrorOnWrite(t *testing.T) {
- const maxStrLen = 8 << 10
- var serverConfig *http.Server
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- // No response body.
- }, func(ts *httptest.Server) {
- serverConfig = ts.Config
- serverConfig.MaxHeaderBytes = maxStrLen
- })
- st.addLogFilter("connection error: COMPRESSION_ERROR")
- defer st.Close()
- st.greet()
-
- maxAllowed := st.sc.framer.maxHeaderStringLen()
-
- // Crank this up, now that we have a conn connected with the
- // hpack.Decoder's max string length set has been initialized
- // from the earlier low ~8K value. We want this higher so don't
- // hit the max header list size. We only want to test hitting
- // the max string size.
- serverConfig.MaxHeaderBytes = 1 << 20
-
- // First a request with a header that's exactly the max allowed size
- // for the hpack compression. It's still too long for the header list
- // size, so we'll get the 431 error, but that keeps the compression
- // context still valid.
- hbf := st.encodeHeader("foo", strings.Repeat("a", maxAllowed))
-
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1,
- BlockFragment: hbf,
- EndStream: true,
- EndHeaders: true,
- })
- h := st.wantHeaders()
- if !h.HeadersEnded() {
- t.Fatalf("Got HEADERS without END_HEADERS set: %v", h)
- }
- headers := st.decodeHeader(h.HeaderBlockFragment())
- want := [][2]string{
- {":status", "431"},
- {"content-type", "text/html; charset=utf-8"},
- {"content-length", "63"},
- }
- if !reflect.DeepEqual(headers, want) {
- t.Errorf("Headers mismatch.\n got: %q\nwant: %q\n", headers, want)
- }
- df := st.wantData()
- if !strings.Contains(string(df.Data()), "HTTP Error 431") {
- t.Errorf("Unexpected data body: %q", df.Data())
- }
- if !df.StreamEnded() {
- t.Fatalf("expect data stream end")
- }
-
- // And now send one that's just one byte too big.
- hbf = st.encodeHeader("bar", strings.Repeat("b", maxAllowed+1))
- st.writeHeaders(HeadersFrameParam{
- StreamID: 3,
- BlockFragment: hbf,
- EndStream: true,
- EndHeaders: true,
- })
- ga := st.wantGoAway()
- if ga.ErrCode != ErrCodeCompression {
- t.Errorf("GOAWAY err = %v; want ErrCodeCompression", ga.ErrCode)
- }
-}
-
-func TestCompressionErrorOnClose(t *testing.T) {
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- // No response body.
- })
- st.addLogFilter("connection error: COMPRESSION_ERROR")
- defer st.Close()
- st.greet()
-
- hbf := st.encodeHeader("foo", "bar")
- hbf = hbf[:len(hbf)-1] // truncate one byte from the end, so hpack.Decoder.Close fails.
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1,
- BlockFragment: hbf,
- EndStream: true,
- EndHeaders: true,
- })
- ga := st.wantGoAway()
- if ga.ErrCode != ErrCodeCompression {
- t.Errorf("GOAWAY err = %v; want ErrCodeCompression", ga.ErrCode)
- }
-}
-
-// test that a server handler can read trailers from a client
-func TestServerReadsTrailers(t *testing.T) {
- const testBody = "some test body"
- writeReq := func(st *serverTester) {
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1, // clients send odd numbers
- BlockFragment: st.encodeHeader("trailer", "Foo, Bar", "trailer", "Baz"),
- EndStream: false,
- EndHeaders: true,
- })
- st.writeData(1, false, []byte(testBody))
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1, // clients send odd numbers
- BlockFragment: st.encodeHeaderRaw(
- "foo", "foov",
- "bar", "barv",
- "baz", "bazv",
- "surprise", "wasn't declared; shouldn't show up",
- ),
- EndStream: true,
- EndHeaders: true,
- })
- }
- checkReq := func(r *http.Request) {
- wantTrailer := http.Header{
- "Foo": nil,
- "Bar": nil,
- "Baz": nil,
- }
- if !reflect.DeepEqual(r.Trailer, wantTrailer) {
- t.Errorf("initial Trailer = %v; want %v", r.Trailer, wantTrailer)
- }
- slurp, err := ioutil.ReadAll(r.Body)
- if string(slurp) != testBody {
- t.Errorf("read body %q; want %q", slurp, testBody)
- }
- if err != nil {
- t.Fatalf("Body slurp: %v", err)
- }
- wantTrailerAfter := http.Header{
- "Foo": {"foov"},
- "Bar": {"barv"},
- "Baz": {"bazv"},
- }
- if !reflect.DeepEqual(r.Trailer, wantTrailerAfter) {
- t.Errorf("final Trailer = %v; want %v", r.Trailer, wantTrailerAfter)
- }
- }
- testServerRequest(t, writeReq, checkReq)
-}
-
-// test that a server handler can send trailers
-func TestServerWritesTrailers_WithFlush(t *testing.T) { testServerWritesTrailers(t, true) }
-func TestServerWritesTrailers_WithoutFlush(t *testing.T) { testServerWritesTrailers(t, false) }
-
-func testServerWritesTrailers(t *testing.T, withFlush bool) {
- // See https://httpwg.github.io/specs/rfc7540.html#rfc.section.8.1.3
- testServerResponse(t, func(w http.ResponseWriter, r *http.Request) error {
- w.Header().Set("Trailer", "Server-Trailer-A, Server-Trailer-B")
- w.Header().Add("Trailer", "Server-Trailer-C")
- w.Header().Add("Trailer", "Transfer-Encoding, Content-Length, Trailer") // filtered
-
- // Regular headers:
- w.Header().Set("Foo", "Bar")
- w.Header().Set("Content-Length", "5") // len("Hello")
-
- io.WriteString(w, "Hello")
- if withFlush {
- w.(http.Flusher).Flush()
- }
- w.Header().Set("Server-Trailer-A", "valuea")
- w.Header().Set("Server-Trailer-C", "valuec") // skipping B
- // After a flush, random keys like Server-Surprise shouldn't show up:
- w.Header().Set("Server-Surpise", "surprise! this isn't predeclared!")
- // But we do permit promoting keys to trailers after a
- // flush if they start with the magic
- // otherwise-invalid "Trailer:" prefix:
- w.Header().Set("Trailer:Post-Header-Trailer", "hi1")
- w.Header().Set("Trailer:post-header-trailer2", "hi2")
- w.Header().Set("Trailer:Range", "invalid")
- w.Header().Set("Trailer:Foo\x01Bogus", "invalid")
- w.Header().Set("Transfer-Encoding", "should not be included; Forbidden by RFC 7230 4.1.2")
- w.Header().Set("Content-Length", "should not be included; Forbidden by RFC 7230 4.1.2")
- w.Header().Set("Trailer", "should not be included; Forbidden by RFC 7230 4.1.2")
- return nil
- }, func(st *serverTester) {
- getSlash(st)
- hf := st.wantHeaders()
- if hf.StreamEnded() {
- t.Fatal("response HEADERS had END_STREAM")
- }
- if !hf.HeadersEnded() {
- t.Fatal("response HEADERS didn't have END_HEADERS")
- }
- goth := st.decodeHeader(hf.HeaderBlockFragment())
- wanth := [][2]string{
- {":status", "200"},
- {"foo", "Bar"},
- {"trailer", "Server-Trailer-A, Server-Trailer-B"},
- {"trailer", "Server-Trailer-C"},
- {"trailer", "Transfer-Encoding, Content-Length, Trailer"},
- {"content-type", "text/plain; charset=utf-8"},
- {"content-length", "5"},
- }
- if !reflect.DeepEqual(goth, wanth) {
- t.Errorf("Header mismatch.\n got: %v\nwant: %v", goth, wanth)
- }
- df := st.wantData()
- if string(df.Data()) != "Hello" {
- t.Fatalf("Client read %q; want Hello", df.Data())
- }
- if df.StreamEnded() {
- t.Fatalf("data frame had STREAM_ENDED")
- }
- tf := st.wantHeaders() // for the trailers
- if !tf.StreamEnded() {
- t.Fatalf("trailers HEADERS lacked END_STREAM")
- }
- if !tf.HeadersEnded() {
- t.Fatalf("trailers HEADERS lacked END_HEADERS")
- }
- wanth = [][2]string{
- {"post-header-trailer", "hi1"},
- {"post-header-trailer2", "hi2"},
- {"server-trailer-a", "valuea"},
- {"server-trailer-c", "valuec"},
- }
- goth = st.decodeHeader(tf.HeaderBlockFragment())
- if !reflect.DeepEqual(goth, wanth) {
- t.Errorf("Header mismatch.\n got: %v\nwant: %v", goth, wanth)
- }
- })
-}
-
-// validate transmitted header field names & values
-// golang.org/issue/14048
-func TestServerDoesntWriteInvalidHeaders(t *testing.T) {
- testServerResponse(t, func(w http.ResponseWriter, r *http.Request) error {
- w.Header().Add("OK1", "x")
- w.Header().Add("Bad:Colon", "x") // colon (non-token byte) in key
- w.Header().Add("Bad1\x00", "x") // null in key
- w.Header().Add("Bad2", "x\x00y") // null in value
- return nil
- }, func(st *serverTester) {
- getSlash(st)
- hf := st.wantHeaders()
- if !hf.StreamEnded() {
- t.Error("response HEADERS lacked END_STREAM")
- }
- if !hf.HeadersEnded() {
- t.Fatal("response HEADERS didn't have END_HEADERS")
- }
- goth := st.decodeHeader(hf.HeaderBlockFragment())
- wanth := [][2]string{
- {":status", "200"},
- {"ok1", "x"},
- {"content-length", "0"},
- }
- if !reflect.DeepEqual(goth, wanth) {
- t.Errorf("Header mismatch.\n got: %v\nwant: %v", goth, wanth)
- }
- })
-}
-
-func BenchmarkServerGets(b *testing.B) {
- defer disableGoroutineTracking()()
- b.ReportAllocs()
-
- const msg = "Hello, world"
- st := newServerTester(b, func(w http.ResponseWriter, r *http.Request) {
- io.WriteString(w, msg)
- })
- defer st.Close()
- st.greet()
-
- // Give the server quota to reply. (plus it has the 64KB)
- if err := st.fr.WriteWindowUpdate(0, uint32(b.N*len(msg))); err != nil {
- b.Fatal(err)
- }
-
- for i := 0; i < b.N; i++ {
- id := 1 + uint32(i)*2
- st.writeHeaders(HeadersFrameParam{
- StreamID: id,
- BlockFragment: st.encodeHeader(),
- EndStream: true,
- EndHeaders: true,
- })
- st.wantHeaders()
- df := st.wantData()
- if !df.StreamEnded() {
- b.Fatalf("DATA didn't have END_STREAM; got %v", df)
- }
- }
-}
-
-func BenchmarkServerPosts(b *testing.B) {
- defer disableGoroutineTracking()()
- b.ReportAllocs()
-
- const msg = "Hello, world"
- st := newServerTester(b, func(w http.ResponseWriter, r *http.Request) {
- // Consume the (empty) body from th peer before replying, otherwise
- // the server will sometimes (depending on scheduling) send the peer a
- // a RST_STREAM with the CANCEL error code.
- if n, err := io.Copy(ioutil.Discard, r.Body); n != 0 || err != nil {
- b.Errorf("Copy error; got %v, %v; want 0, nil", n, err)
- }
- io.WriteString(w, msg)
- })
- defer st.Close()
- st.greet()
-
- // Give the server quota to reply. (plus it has the 64KB)
- if err := st.fr.WriteWindowUpdate(0, uint32(b.N*len(msg))); err != nil {
- b.Fatal(err)
- }
-
- for i := 0; i < b.N; i++ {
- id := 1 + uint32(i)*2
- st.writeHeaders(HeadersFrameParam{
- StreamID: id,
- BlockFragment: st.encodeHeader(":method", "POST"),
- EndStream: false,
- EndHeaders: true,
- })
- st.writeData(id, true, nil)
- st.wantHeaders()
- df := st.wantData()
- if !df.StreamEnded() {
- b.Fatalf("DATA didn't have END_STREAM; got %v", df)
- }
- }
-}
-
-// Send a stream of messages from server to client in separate data frames.
-// Brings up performance issues seen in long streams.
-// Created to show problem in go issue #18502
-func BenchmarkServerToClientStreamDefaultOptions(b *testing.B) {
- benchmarkServerToClientStream(b)
-}
-
-// Justification for Change-Id: Iad93420ef6c3918f54249d867098f1dadfa324d8
-// Expect to see memory/alloc reduction by opting in to Frame reuse with the Framer.
-func BenchmarkServerToClientStreamReuseFrames(b *testing.B) {
- benchmarkServerToClientStream(b, optFramerReuseFrames)
-}
-
-func benchmarkServerToClientStream(b *testing.B, newServerOpts ...interface{}) {
- defer disableGoroutineTracking()()
- b.ReportAllocs()
- const msgLen = 1
- // default window size
- const windowSize = 1<<16 - 1
-
- // next message to send from the server and for the client to expect
- nextMsg := func(i int) []byte {
- msg := make([]byte, msgLen)
- msg[0] = byte(i)
- if len(msg) != msgLen {
- panic("invalid test setup msg length")
- }
- return msg
- }
-
- st := newServerTester(b, func(w http.ResponseWriter, r *http.Request) {
- // Consume the (empty) body from th peer before replying, otherwise
- // the server will sometimes (depending on scheduling) send the peer a
- // a RST_STREAM with the CANCEL error code.
- if n, err := io.Copy(ioutil.Discard, r.Body); n != 0 || err != nil {
- b.Errorf("Copy error; got %v, %v; want 0, nil", n, err)
- }
- for i := 0; i < b.N; i += 1 {
- w.Write(nextMsg(i))
- w.(http.Flusher).Flush()
- }
- }, newServerOpts...)
- defer st.Close()
- st.greet()
-
- const id = uint32(1)
-
- st.writeHeaders(HeadersFrameParam{
- StreamID: id,
- BlockFragment: st.encodeHeader(":method", "POST"),
- EndStream: false,
- EndHeaders: true,
- })
-
- st.writeData(id, true, nil)
- st.wantHeaders()
-
- var pendingWindowUpdate = uint32(0)
-
- for i := 0; i < b.N; i += 1 {
- expected := nextMsg(i)
- df := st.wantData()
- if bytes.Compare(expected, df.data) != 0 {
- b.Fatalf("Bad message received; want %v; got %v", expected, df.data)
- }
- // try to send infrequent but large window updates so they don't overwhelm the test
- pendingWindowUpdate += uint32(len(df.data))
- if pendingWindowUpdate >= windowSize/2 {
- if err := st.fr.WriteWindowUpdate(0, pendingWindowUpdate); err != nil {
- b.Fatal(err)
- }
- if err := st.fr.WriteWindowUpdate(id, pendingWindowUpdate); err != nil {
- b.Fatal(err)
- }
- pendingWindowUpdate = 0
- }
- }
- df := st.wantData()
- if !df.StreamEnded() {
- b.Fatalf("DATA didn't have END_STREAM; got %v", df)
- }
-}
-
-// go-fuzz bug, originally reported at https://github.com/bradfitz/http2/issues/53
-// Verify we don't hang.
-func TestIssue53(t *testing.T) {
- const data = "PRI * HTTP/2.0\r\n\r\nSM" +
- "\r\n\r\n\x00\x00\x00\x01\ainfinfin\ad"
- s := &http.Server{
- ErrorLog: log.New(io.MultiWriter(stderrv(), twriter{t: t}), "", log.LstdFlags),
- Handler: http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
- w.Write([]byte("hello"))
- }),
- }
- s2 := &Server{
- MaxReadFrameSize: 1 << 16,
- PermitProhibitedCipherSuites: true,
- }
- c := &issue53Conn{[]byte(data), false, false}
- s2.ServeConn(c, &ServeConnOpts{BaseConfig: s})
- if !c.closed {
- t.Fatal("connection is not closed")
- }
-}
-
-type issue53Conn struct {
- data []byte
- closed bool
- written bool
-}
-
-func (c *issue53Conn) Read(b []byte) (n int, err error) {
- if len(c.data) == 0 {
- return 0, io.EOF
- }
- n = copy(b, c.data)
- c.data = c.data[n:]
- return
-}
-
-func (c *issue53Conn) Write(b []byte) (n int, err error) {
- c.written = true
- return len(b), nil
-}
-
-func (c *issue53Conn) Close() error {
- c.closed = true
- return nil
-}
-
-func (c *issue53Conn) LocalAddr() net.Addr {
- return &net.TCPAddr{IP: net.IPv4(127, 0, 0, 1), Port: 49706}
-}
-func (c *issue53Conn) RemoteAddr() net.Addr {
- return &net.TCPAddr{IP: net.IPv4(127, 0, 0, 1), Port: 49706}
-}
-func (c *issue53Conn) SetDeadline(t time.Time) error { return nil }
-func (c *issue53Conn) SetReadDeadline(t time.Time) error { return nil }
-func (c *issue53Conn) SetWriteDeadline(t time.Time) error { return nil }
-
-// golang.org/issue/12895
-func TestConfigureServer(t *testing.T) {
- tests := []struct {
- name string
- tlsConfig *tls.Config
- wantErr string
- }{
- {
- name: "empty server",
- },
- {
- name: "just the required cipher suite",
- tlsConfig: &tls.Config{
- CipherSuites: []uint16{tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256},
- },
- },
- {
- name: "just the alternative required cipher suite",
- tlsConfig: &tls.Config{
- CipherSuites: []uint16{tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256},
- },
- },
- {
- name: "missing required cipher suite",
- tlsConfig: &tls.Config{
- CipherSuites: []uint16{tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384},
- },
- wantErr: "is missing an HTTP/2-required AES_128_GCM_SHA256 cipher.",
- },
- {
- name: "required after bad",
- tlsConfig: &tls.Config{
- CipherSuites: []uint16{tls.TLS_RSA_WITH_RC4_128_SHA, tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256},
- },
- wantErr: "contains an HTTP/2-approved cipher suite (0xc02f), but it comes after",
- },
- {
- name: "bad after required",
- tlsConfig: &tls.Config{
- CipherSuites: []uint16{tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, tls.TLS_RSA_WITH_RC4_128_SHA},
- },
- },
- }
- for _, tt := range tests {
- srv := &http.Server{TLSConfig: tt.tlsConfig}
- err := ConfigureServer(srv, nil)
- if (err != nil) != (tt.wantErr != "") {
- if tt.wantErr != "" {
- t.Errorf("%s: success, but want error", tt.name)
- } else {
- t.Errorf("%s: unexpected error: %v", tt.name, err)
- }
- }
- if err != nil && tt.wantErr != "" && !strings.Contains(err.Error(), tt.wantErr) {
- t.Errorf("%s: err = %v; want substring %q", tt.name, err, tt.wantErr)
- }
- if err == nil && !srv.TLSConfig.PreferServerCipherSuites {
- t.Errorf("%s: PreferServerCipherSuite is false; want true", tt.name)
- }
- }
-}
-
-func TestServerRejectHeadWithBody(t *testing.T) {
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- // No response body.
- })
- defer st.Close()
- st.greet()
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1, // clients send odd numbers
- BlockFragment: st.encodeHeader(":method", "HEAD"),
- EndStream: false, // what we're testing, a bogus HEAD request with body
- EndHeaders: true,
- })
- st.wantRSTStream(1, ErrCodeProtocol)
-}
-
-func TestServerNoAutoContentLengthOnHead(t *testing.T) {
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- // No response body. (or smaller than one frame)
- })
- defer st.Close()
- st.greet()
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1, // clients send odd numbers
- BlockFragment: st.encodeHeader(":method", "HEAD"),
- EndStream: true,
- EndHeaders: true,
- })
- h := st.wantHeaders()
- headers := st.decodeHeader(h.HeaderBlockFragment())
- want := [][2]string{
- {":status", "200"},
- }
- if !reflect.DeepEqual(headers, want) {
- t.Errorf("Headers mismatch.\n got: %q\nwant: %q\n", headers, want)
- }
-}
-
-// golang.org/issue/13495
-func TestServerNoDuplicateContentType(t *testing.T) {
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- w.Header()["Content-Type"] = []string{""}
- fmt.Fprintf(w, "<html><head></head><body>hi</body></html>")
- })
- defer st.Close()
- st.greet()
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1,
- BlockFragment: st.encodeHeader(),
- EndStream: true,
- EndHeaders: true,
- })
- h := st.wantHeaders()
- headers := st.decodeHeader(h.HeaderBlockFragment())
- want := [][2]string{
- {":status", "200"},
- {"content-type", ""},
- {"content-length", "41"},
- }
- if !reflect.DeepEqual(headers, want) {
- t.Errorf("Headers mismatch.\n got: %q\nwant: %q\n", headers, want)
- }
-}
-
-func disableGoroutineTracking() (restore func()) {
- old := DebugGoroutines
- DebugGoroutines = false
- return func() { DebugGoroutines = old }
-}
-
-func BenchmarkServer_GetRequest(b *testing.B) {
- defer disableGoroutineTracking()()
- b.ReportAllocs()
- const msg = "Hello, world."
- st := newServerTester(b, func(w http.ResponseWriter, r *http.Request) {
- n, err := io.Copy(ioutil.Discard, r.Body)
- if err != nil || n > 0 {
- b.Errorf("Read %d bytes, error %v; want 0 bytes.", n, err)
- }
- io.WriteString(w, msg)
- })
- defer st.Close()
-
- st.greet()
- // Give the server quota to reply. (plus it has the 64KB)
- if err := st.fr.WriteWindowUpdate(0, uint32(b.N*len(msg))); err != nil {
- b.Fatal(err)
- }
- hbf := st.encodeHeader(":method", "GET")
- for i := 0; i < b.N; i++ {
- streamID := uint32(1 + 2*i)
- st.writeHeaders(HeadersFrameParam{
- StreamID: streamID,
- BlockFragment: hbf,
- EndStream: true,
- EndHeaders: true,
- })
- st.wantHeaders()
- st.wantData()
- }
-}
-
-func BenchmarkServer_PostRequest(b *testing.B) {
- defer disableGoroutineTracking()()
- b.ReportAllocs()
- const msg = "Hello, world."
- st := newServerTester(b, func(w http.ResponseWriter, r *http.Request) {
- n, err := io.Copy(ioutil.Discard, r.Body)
- if err != nil || n > 0 {
- b.Errorf("Read %d bytes, error %v; want 0 bytes.", n, err)
- }
- io.WriteString(w, msg)
- })
- defer st.Close()
- st.greet()
- // Give the server quota to reply. (plus it has the 64KB)
- if err := st.fr.WriteWindowUpdate(0, uint32(b.N*len(msg))); err != nil {
- b.Fatal(err)
- }
- hbf := st.encodeHeader(":method", "POST")
- for i := 0; i < b.N; i++ {
- streamID := uint32(1 + 2*i)
- st.writeHeaders(HeadersFrameParam{
- StreamID: streamID,
- BlockFragment: hbf,
- EndStream: false,
- EndHeaders: true,
- })
- st.writeData(streamID, true, nil)
- st.wantHeaders()
- st.wantData()
- }
-}
-
-type connStateConn struct {
- net.Conn
- cs tls.ConnectionState
-}
-
-func (c connStateConn) ConnectionState() tls.ConnectionState { return c.cs }
-
-// golang.org/issue/12737 -- handle any net.Conn, not just
-// *tls.Conn.
-func TestServerHandleCustomConn(t *testing.T) {
- var s Server
- c1, c2 := net.Pipe()
- clientDone := make(chan struct{})
- handlerDone := make(chan struct{})
- var req *http.Request
- go func() {
- defer close(clientDone)
- defer c2.Close()
- fr := NewFramer(c2, c2)
- io.WriteString(c2, ClientPreface)
- fr.WriteSettings()
- fr.WriteSettingsAck()
- f, err := fr.ReadFrame()
- if err != nil {
- t.Error(err)
- return
- }
- if sf, ok := f.(*SettingsFrame); !ok || sf.IsAck() {
- t.Errorf("Got %v; want non-ACK SettingsFrame", summarizeFrame(f))
- return
- }
- f, err = fr.ReadFrame()
- if err != nil {
- t.Error(err)
- return
- }
- if sf, ok := f.(*SettingsFrame); !ok || !sf.IsAck() {
- t.Errorf("Got %v; want ACK SettingsFrame", summarizeFrame(f))
- return
- }
- var henc hpackEncoder
- fr.WriteHeaders(HeadersFrameParam{
- StreamID: 1,
- BlockFragment: henc.encodeHeaderRaw(t, ":method", "GET", ":path", "/", ":scheme", "https", ":authority", "foo.com"),
- EndStream: true,
- EndHeaders: true,
- })
- go io.Copy(ioutil.Discard, c2)
- <-handlerDone
- }()
- const testString = "my custom ConnectionState"
- fakeConnState := tls.ConnectionState{
- ServerName: testString,
- Version: tls.VersionTLS12,
- CipherSuite: cipher_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
- }
- go s.ServeConn(connStateConn{c1, fakeConnState}, &ServeConnOpts{
- BaseConfig: &http.Server{
- Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- defer close(handlerDone)
- req = r
- }),
- }})
- select {
- case <-clientDone:
- case <-time.After(5 * time.Second):
- t.Fatal("timeout waiting for handler")
- }
- if req.TLS == nil {
- t.Fatalf("Request.TLS is nil. Got: %#v", req)
- }
- if req.TLS.ServerName != testString {
- t.Fatalf("Request.TLS = %+v; want ServerName of %q", req.TLS, testString)
- }
-}
-
-// golang.org/issue/14214
-func TestServer_Rejects_ConnHeaders(t *testing.T) {
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- t.Error("should not get to Handler")
- })
- defer st.Close()
- st.greet()
- st.bodylessReq1("connection", "foo")
- hf := st.wantHeaders()
- goth := st.decodeHeader(hf.HeaderBlockFragment())
- wanth := [][2]string{
- {":status", "400"},
- {"content-type", "text/plain; charset=utf-8"},
- {"x-content-type-options", "nosniff"},
- {"content-length", "51"},
- }
- if !reflect.DeepEqual(goth, wanth) {
- t.Errorf("Got headers %v; want %v", goth, wanth)
- }
-}
-
-type hpackEncoder struct {
- enc *hpack.Encoder
- buf bytes.Buffer
-}
-
-func (he *hpackEncoder) encodeHeaderRaw(t *testing.T, headers ...string) []byte {
- if len(headers)%2 == 1 {
- panic("odd number of kv args")
- }
- he.buf.Reset()
- if he.enc == nil {
- he.enc = hpack.NewEncoder(&he.buf)
- }
- for len(headers) > 0 {
- k, v := headers[0], headers[1]
- err := he.enc.WriteField(hpack.HeaderField{Name: k, Value: v})
- if err != nil {
- t.Fatalf("HPACK encoding error for %q/%q: %v", k, v, err)
- }
- headers = headers[2:]
- }
- return he.buf.Bytes()
-}
-
-func TestCheckValidHTTP2Request(t *testing.T) {
- tests := []struct {
- h http.Header
- want error
- }{
- {
- h: http.Header{"Te": {"trailers"}},
- want: nil,
- },
- {
- h: http.Header{"Te": {"trailers", "bogus"}},
- want: errors.New(`request header "TE" may only be "trailers" in HTTP/2`),
- },
- {
- h: http.Header{"Foo": {""}},
- want: nil,
- },
- {
- h: http.Header{"Connection": {""}},
- want: errors.New(`request header "Connection" is not valid in HTTP/2`),
- },
- {
- h: http.Header{"Proxy-Connection": {""}},
- want: errors.New(`request header "Proxy-Connection" is not valid in HTTP/2`),
- },
- {
- h: http.Header{"Keep-Alive": {""}},
- want: errors.New(`request header "Keep-Alive" is not valid in HTTP/2`),
- },
- {
- h: http.Header{"Upgrade": {""}},
- want: errors.New(`request header "Upgrade" is not valid in HTTP/2`),
- },
- }
- for i, tt := range tests {
- got := checkValidHTTP2RequestHeaders(tt.h)
- if !reflect.DeepEqual(got, tt.want) {
- t.Errorf("%d. checkValidHTTP2Request = %v; want %v", i, got, tt.want)
- }
- }
-}
-
-// golang.org/issue/14030
-func TestExpect100ContinueAfterHandlerWrites(t *testing.T) {
- const msg = "Hello"
- const msg2 = "World"
-
- doRead := make(chan bool, 1)
- defer close(doRead) // fallback cleanup
-
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- io.WriteString(w, msg)
- w.(http.Flusher).Flush()
-
- // Do a read, which might force a 100-continue status to be sent.
- <-doRead
- r.Body.Read(make([]byte, 10))
-
- io.WriteString(w, msg2)
-
- }, optOnlyServer)
- defer st.Close()
-
- tr := &Transport{TLSClientConfig: tlsConfigInsecure}
- defer tr.CloseIdleConnections()
-
- req, _ := http.NewRequest("POST", st.ts.URL, io.LimitReader(neverEnding('A'), 2<<20))
- req.Header.Set("Expect", "100-continue")
-
- res, err := tr.RoundTrip(req)
- if err != nil {
- t.Fatal(err)
- }
- defer res.Body.Close()
-
- buf := make([]byte, len(msg))
- if _, err := io.ReadFull(res.Body, buf); err != nil {
- t.Fatal(err)
- }
- if string(buf) != msg {
- t.Fatalf("msg = %q; want %q", buf, msg)
- }
-
- doRead <- true
-
- if _, err := io.ReadFull(res.Body, buf); err != nil {
- t.Fatal(err)
- }
- if string(buf) != msg2 {
- t.Fatalf("second msg = %q; want %q", buf, msg2)
- }
-}
-
-type funcReader func([]byte) (n int, err error)
-
-func (f funcReader) Read(p []byte) (n int, err error) { return f(p) }
-
-// golang.org/issue/16481 -- return flow control when streams close with unread data.
-// (The Server version of the bug. See also TestUnreadFlowControlReturned_Transport)
-func TestUnreadFlowControlReturned_Server(t *testing.T) {
- unblock := make(chan bool, 1)
- defer close(unblock)
-
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- // Don't read the 16KB request body. Wait until the client's
- // done sending it and then return. This should cause the Server
- // to then return those 16KB of flow control to the client.
- <-unblock
- }, optOnlyServer)
- defer st.Close()
-
- tr := &Transport{TLSClientConfig: tlsConfigInsecure}
- defer tr.CloseIdleConnections()
-
- // This previously hung on the 4th iteration.
- for i := 0; i < 6; i++ {
- body := io.MultiReader(
- io.LimitReader(neverEnding('A'), 16<<10),
- funcReader(func([]byte) (n int, err error) {
- unblock <- true
- return 0, io.EOF
- }),
- )
- req, _ := http.NewRequest("POST", st.ts.URL, body)
- res, err := tr.RoundTrip(req)
- if err != nil {
- t.Fatal(err)
- }
- res.Body.Close()
- }
-
-}
-
-func TestServerIdleTimeout(t *testing.T) {
- if testing.Short() {
- t.Skip("skipping in short mode")
- }
-
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- }, func(h2s *Server) {
- h2s.IdleTimeout = 500 * time.Millisecond
- })
- defer st.Close()
-
- st.greet()
- ga := st.wantGoAway()
- if ga.ErrCode != ErrCodeNo {
- t.Errorf("GOAWAY error = %v; want ErrCodeNo", ga.ErrCode)
- }
-}
-
-func TestServerIdleTimeout_AfterRequest(t *testing.T) {
- if testing.Short() {
- t.Skip("skipping in short mode")
- }
- const timeout = 250 * time.Millisecond
-
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- time.Sleep(timeout * 2)
- }, func(h2s *Server) {
- h2s.IdleTimeout = timeout
- })
- defer st.Close()
-
- st.greet()
-
- // Send a request which takes twice the timeout. Verifies the
- // idle timeout doesn't fire while we're in a request:
- st.bodylessReq1()
- st.wantHeaders()
-
- // But the idle timeout should be rearmed after the request
- // is done:
- ga := st.wantGoAway()
- if ga.ErrCode != ErrCodeNo {
- t.Errorf("GOAWAY error = %v; want ErrCodeNo", ga.ErrCode)
- }
-}
-
-// grpc-go closes the Request.Body currently with a Read.
-// Verify that it doesn't race.
-// See https://github.com/grpc/grpc-go/pull/938
-func TestRequestBodyReadCloseRace(t *testing.T) {
- for i := 0; i < 100; i++ {
- body := &requestBody{
- pipe: &pipe{
- b: new(bytes.Buffer),
- },
- }
- body.pipe.CloseWithError(io.EOF)
-
- done := make(chan bool, 1)
- buf := make([]byte, 10)
- go func() {
- time.Sleep(1 * time.Millisecond)
- body.Close()
- done <- true
- }()
- body.Read(buf)
- <-done
- }
-}
-
-func TestIssue20704Race(t *testing.T) {
- if testing.Short() && os.Getenv("GO_BUILDER_NAME") == "" {
- t.Skip("skipping in short mode")
- }
- const (
- itemSize = 1 << 10
- itemCount = 100
- )
-
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- for i := 0; i < itemCount; i++ {
- _, err := w.Write(make([]byte, itemSize))
- if err != nil {
- return
- }
- }
- }, optOnlyServer)
- defer st.Close()
-
- tr := &Transport{TLSClientConfig: tlsConfigInsecure}
- defer tr.CloseIdleConnections()
- cl := &http.Client{Transport: tr}
-
- for i := 0; i < 1000; i++ {
- resp, err := cl.Get(st.ts.URL)
- if err != nil {
- t.Fatal(err)
- }
- // Force a RST stream to the server by closing without
- // reading the body:
- resp.Body.Close()
- }
-}
-
-func TestServer_Rejects_TooSmall(t *testing.T) {
- testServerResponse(t, func(w http.ResponseWriter, r *http.Request) error {
- ioutil.ReadAll(r.Body)
- return nil
- }, func(st *serverTester) {
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1, // clients send odd numbers
- BlockFragment: st.encodeHeader(
- ":method", "POST",
- "content-length", "4",
- ),
- EndStream: false, // to say DATA frames are coming
- EndHeaders: true,
- })
- st.writeData(1, true, []byte("12345"))
-
- st.wantRSTStream(1, ErrCodeProtocol)
- })
-}
-
-// Tests that a handler setting "Connection: close" results in a GOAWAY being sent,
-// and the connection still completing.
-func TestServerHandlerConnectionClose(t *testing.T) {
- unblockHandler := make(chan bool, 1)
- defer close(unblockHandler) // backup; in case of errors
- testServerResponse(t, func(w http.ResponseWriter, r *http.Request) error {
- w.Header().Set("Connection", "close")
- w.Header().Set("Foo", "bar")
- w.(http.Flusher).Flush()
- <-unblockHandler
- return nil
- }, func(st *serverTester) {
- st.writeHeaders(HeadersFrameParam{
- StreamID: 1,
- BlockFragment: st.encodeHeader(),
- EndStream: true,
- EndHeaders: true,
- })
- var sawGoAway bool
- var sawRes bool
- for {
- f, err := st.readFrame()
- if err == io.EOF {
- break
- }
- if err != nil {
- t.Fatal(err)
- }
- switch f := f.(type) {
- case *GoAwayFrame:
- sawGoAway = true
- unblockHandler <- true
- if f.LastStreamID != 1 || f.ErrCode != ErrCodeNo {
- t.Errorf("unexpected GOAWAY frame: %v", summarizeFrame(f))
- }
- case *HeadersFrame:
- goth := st.decodeHeader(f.HeaderBlockFragment())
- if !sawGoAway {
- t.Fatalf("unexpected Headers frame before GOAWAY: %s, %v", summarizeFrame(f), goth)
- }
- wanth := [][2]string{
- {":status", "200"},
- {"foo", "bar"},
- }
- if !reflect.DeepEqual(goth, wanth) {
- t.Errorf("got headers %v; want %v", goth, wanth)
- }
- sawRes = true
- case *DataFrame:
- if f.StreamID != 1 || !f.StreamEnded() || len(f.Data()) != 0 {
- t.Errorf("unexpected DATA frame: %v", summarizeFrame(f))
- }
- default:
- t.Logf("unexpected frame: %v", summarizeFrame(f))
- }
- }
- if !sawRes {
- t.Errorf("didn't see response")
- }
- })
-}
diff --git a/vendor/golang.org/x/net/http2/transport_test.go b/vendor/golang.org/x/net/http2/transport_test.go
deleted file mode 100644
index 17c09cab7..000000000
--- a/vendor/golang.org/x/net/http2/transport_test.go
+++ /dev/null
@@ -1,3848 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package http2
-
-import (
- "bufio"
- "bytes"
- "crypto/tls"
- "errors"
- "flag"
- "fmt"
- "io"
- "io/ioutil"
- "log"
- "math/rand"
- "net"
- "net/http"
- "net/http/httptest"
- "net/url"
- "os"
- "reflect"
- "runtime"
- "sort"
- "strconv"
- "strings"
- "sync"
- "sync/atomic"
- "testing"
- "time"
-
- "golang.org/x/net/http2/hpack"
-)
-
-var (
- extNet = flag.Bool("extnet", false, "do external network tests")
- transportHost = flag.String("transporthost", "http2.golang.org", "hostname to use for TestTransport")
- insecure = flag.Bool("insecure", false, "insecure TLS dials") // TODO: dead code. remove?
-)
-
-var tlsConfigInsecure = &tls.Config{InsecureSkipVerify: true}
-
-type testContext struct{}
-
-func (testContext) Done() <-chan struct{} { return make(chan struct{}) }
-func (testContext) Err() error { panic("should not be called") }
-func (testContext) Deadline() (deadline time.Time, ok bool) { return time.Time{}, false }
-func (testContext) Value(key interface{}) interface{} { return nil }
-
-func TestTransportExternal(t *testing.T) {
- if !*extNet {
- t.Skip("skipping external network test")
- }
- req, _ := http.NewRequest("GET", "https://"+*transportHost+"/", nil)
- rt := &Transport{TLSClientConfig: tlsConfigInsecure}
- res, err := rt.RoundTrip(req)
- if err != nil {
- t.Fatalf("%v", err)
- }
- res.Write(os.Stdout)
-}
-
-type fakeTLSConn struct {
- net.Conn
-}
-
-func (c *fakeTLSConn) ConnectionState() tls.ConnectionState {
- return tls.ConnectionState{
- Version: tls.VersionTLS12,
- CipherSuite: cipher_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
- }
-}
-
-func startH2cServer(t *testing.T) net.Listener {
- h2Server := &Server{}
- l := newLocalListener(t)
- go func() {
- conn, err := l.Accept()
- if err != nil {
- t.Error(err)
- return
- }
- h2Server.ServeConn(&fakeTLSConn{conn}, &ServeConnOpts{Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- fmt.Fprintf(w, "Hello, %v, http: %v", r.URL.Path, r.TLS == nil)
- })})
- }()
- return l
-}
-
-func TestTransportH2c(t *testing.T) {
- l := startH2cServer(t)
- defer l.Close()
- req, err := http.NewRequest("GET", "http://"+l.Addr().String()+"/foobar", nil)
- if err != nil {
- t.Fatal(err)
- }
- tr := &Transport{
- AllowHTTP: true,
- DialTLS: func(network, addr string, cfg *tls.Config) (net.Conn, error) {
- return net.Dial(network, addr)
- },
- }
- res, err := tr.RoundTrip(req)
- if err != nil {
- t.Fatal(err)
- }
- if res.ProtoMajor != 2 {
- t.Fatal("proto not h2c")
- }
- body, err := ioutil.ReadAll(res.Body)
- if err != nil {
- t.Fatal(err)
- }
- if got, want := string(body), "Hello, /foobar, http: true"; got != want {
- t.Fatalf("response got %v, want %v", got, want)
- }
-}
-
-func TestTransport(t *testing.T) {
- const body = "sup"
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- io.WriteString(w, body)
- }, optOnlyServer)
- defer st.Close()
-
- tr := &Transport{TLSClientConfig: tlsConfigInsecure}
- defer tr.CloseIdleConnections()
-
- req, err := http.NewRequest("GET", st.ts.URL, nil)
- if err != nil {
- t.Fatal(err)
- }
- res, err := tr.RoundTrip(req)
- if err != nil {
- t.Fatal(err)
- }
- defer res.Body.Close()
-
- t.Logf("Got res: %+v", res)
- if g, w := res.StatusCode, 200; g != w {
- t.Errorf("StatusCode = %v; want %v", g, w)
- }
- if g, w := res.Status, "200 OK"; g != w {
- t.Errorf("Status = %q; want %q", g, w)
- }
- wantHeader := http.Header{
- "Content-Length": []string{"3"},
- "Content-Type": []string{"text/plain; charset=utf-8"},
- "Date": []string{"XXX"}, // see cleanDate
- }
- cleanDate(res)
- if !reflect.DeepEqual(res.Header, wantHeader) {
- t.Errorf("res Header = %v; want %v", res.Header, wantHeader)
- }
- if res.Request != req {
- t.Errorf("Response.Request = %p; want %p", res.Request, req)
- }
- if res.TLS == nil {
- t.Error("Response.TLS = nil; want non-nil")
- }
- slurp, err := ioutil.ReadAll(res.Body)
- if err != nil {
- t.Errorf("Body read: %v", err)
- } else if string(slurp) != body {
- t.Errorf("Body = %q; want %q", slurp, body)
- }
-}
-
-func onSameConn(t *testing.T, modReq func(*http.Request)) bool {
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- io.WriteString(w, r.RemoteAddr)
- }, optOnlyServer, func(c net.Conn, st http.ConnState) {
- t.Logf("conn %v is now state %v", c.RemoteAddr(), st)
- })
- defer st.Close()
- tr := &Transport{TLSClientConfig: tlsConfigInsecure}
- defer tr.CloseIdleConnections()
- get := func() string {
- req, err := http.NewRequest("GET", st.ts.URL, nil)
- if err != nil {
- t.Fatal(err)
- }
- modReq(req)
- res, err := tr.RoundTrip(req)
- if err != nil {
- t.Fatal(err)
- }
- defer res.Body.Close()
- slurp, err := ioutil.ReadAll(res.Body)
- if err != nil {
- t.Fatalf("Body read: %v", err)
- }
- addr := strings.TrimSpace(string(slurp))
- if addr == "" {
- t.Fatalf("didn't get an addr in response")
- }
- return addr
- }
- first := get()
- second := get()
- return first == second
-}
-
-func TestTransportReusesConns(t *testing.T) {
- if !onSameConn(t, func(*http.Request) {}) {
- t.Errorf("first and second responses were on different connections")
- }
-}
-
-func TestTransportReusesConn_RequestClose(t *testing.T) {
- if onSameConn(t, func(r *http.Request) { r.Close = true }) {
- t.Errorf("first and second responses were not on different connections")
- }
-}
-
-func TestTransportReusesConn_ConnClose(t *testing.T) {
- if onSameConn(t, func(r *http.Request) { r.Header.Set("Connection", "close") }) {
- t.Errorf("first and second responses were not on different connections")
- }
-}
-
-// Tests that the Transport only keeps one pending dial open per destination address.
-// https://golang.org/issue/13397
-func TestTransportGroupsPendingDials(t *testing.T) {
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- io.WriteString(w, r.RemoteAddr)
- }, optOnlyServer)
- defer st.Close()
- tr := &Transport{
- TLSClientConfig: tlsConfigInsecure,
- }
- defer tr.CloseIdleConnections()
- var (
- mu sync.Mutex
- dials = map[string]int{}
- )
- var wg sync.WaitGroup
- for i := 0; i < 10; i++ {
- wg.Add(1)
- go func() {
- defer wg.Done()
- req, err := http.NewRequest("GET", st.ts.URL, nil)
- if err != nil {
- t.Error(err)
- return
- }
- res, err := tr.RoundTrip(req)
- if err != nil {
- t.Error(err)
- return
- }
- defer res.Body.Close()
- slurp, err := ioutil.ReadAll(res.Body)
- if err != nil {
- t.Errorf("Body read: %v", err)
- }
- addr := strings.TrimSpace(string(slurp))
- if addr == "" {
- t.Errorf("didn't get an addr in response")
- }
- mu.Lock()
- dials[addr]++
- mu.Unlock()
- }()
- }
- wg.Wait()
- if len(dials) != 1 {
- t.Errorf("saw %d dials; want 1: %v", len(dials), dials)
- }
- tr.CloseIdleConnections()
- if err := retry(50, 10*time.Millisecond, func() error {
- cp, ok := tr.connPool().(*clientConnPool)
- if !ok {
- return fmt.Errorf("Conn pool is %T; want *clientConnPool", tr.connPool())
- }
- cp.mu.Lock()
- defer cp.mu.Unlock()
- if len(cp.dialing) != 0 {
- return fmt.Errorf("dialing map = %v; want empty", cp.dialing)
- }
- if len(cp.conns) != 0 {
- return fmt.Errorf("conns = %v; want empty", cp.conns)
- }
- if len(cp.keys) != 0 {
- return fmt.Errorf("keys = %v; want empty", cp.keys)
- }
- return nil
- }); err != nil {
- t.Errorf("State of pool after CloseIdleConnections: %v", err)
- }
-}
-
-func retry(tries int, delay time.Duration, fn func() error) error {
- var err error
- for i := 0; i < tries; i++ {
- err = fn()
- if err == nil {
- return nil
- }
- time.Sleep(delay)
- }
- return err
-}
-
-func TestTransportAbortClosesPipes(t *testing.T) {
- shutdown := make(chan struct{})
- st := newServerTester(t,
- func(w http.ResponseWriter, r *http.Request) {
- w.(http.Flusher).Flush()
- <-shutdown
- },
- optOnlyServer,
- )
- defer st.Close()
- defer close(shutdown) // we must shutdown before st.Close() to avoid hanging
-
- done := make(chan struct{})
- requestMade := make(chan struct{})
- go func() {
- defer close(done)
- tr := &Transport{TLSClientConfig: tlsConfigInsecure}
- req, err := http.NewRequest("GET", st.ts.URL, nil)
- if err != nil {
- t.Fatal(err)
- }
- res, err := tr.RoundTrip(req)
- if err != nil {
- t.Fatal(err)
- }
- defer res.Body.Close()
- close(requestMade)
- _, err = ioutil.ReadAll(res.Body)
- if err == nil {
- t.Error("expected error from res.Body.Read")
- }
- }()
-
- <-requestMade
- // Now force the serve loop to end, via closing the connection.
- st.closeConn()
- // deadlock? that's a bug.
- select {
- case <-done:
- case <-time.After(3 * time.Second):
- t.Fatal("timeout")
- }
-}
-
-// TODO: merge this with TestTransportBody to make TestTransportRequest? This
-// could be a table-driven test with extra goodies.
-func TestTransportPath(t *testing.T) {
- gotc := make(chan *url.URL, 1)
- st := newServerTester(t,
- func(w http.ResponseWriter, r *http.Request) {
- gotc <- r.URL
- },
- optOnlyServer,
- )
- defer st.Close()
-
- tr := &Transport{TLSClientConfig: tlsConfigInsecure}
- defer tr.CloseIdleConnections()
- const (
- path = "/testpath"
- query = "q=1"
- )
- surl := st.ts.URL + path + "?" + query
- req, err := http.NewRequest("POST", surl, nil)
- if err != nil {
- t.Fatal(err)
- }
- c := &http.Client{Transport: tr}
- res, err := c.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer res.Body.Close()
- got := <-gotc
- if got.Path != path {
- t.Errorf("Read Path = %q; want %q", got.Path, path)
- }
- if got.RawQuery != query {
- t.Errorf("Read RawQuery = %q; want %q", got.RawQuery, query)
- }
-}
-
-func randString(n int) string {
- rnd := rand.New(rand.NewSource(int64(n)))
- b := make([]byte, n)
- for i := range b {
- b[i] = byte(rnd.Intn(256))
- }
- return string(b)
-}
-
-type panicReader struct{}
-
-func (panicReader) Read([]byte) (int, error) { panic("unexpected Read") }
-func (panicReader) Close() error { panic("unexpected Close") }
-
-func TestActualContentLength(t *testing.T) {
- tests := []struct {
- req *http.Request
- want int64
- }{
- // Verify we don't read from Body:
- 0: {
- req: &http.Request{Body: panicReader{}},
- want: -1,
- },
- // nil Body means 0, regardless of ContentLength:
- 1: {
- req: &http.Request{Body: nil, ContentLength: 5},
- want: 0,
- },
- // ContentLength is used if set.
- 2: {
- req: &http.Request{Body: panicReader{}, ContentLength: 5},
- want: 5,
- },
- // http.NoBody means 0, not -1.
- 3: {
- req: &http.Request{Body: go18httpNoBody()},
- want: 0,
- },
- }
- for i, tt := range tests {
- got := actualContentLength(tt.req)
- if got != tt.want {
- t.Errorf("test[%d]: got %d; want %d", i, got, tt.want)
- }
- }
-}
-
-func TestTransportBody(t *testing.T) {
- bodyTests := []struct {
- body string
- noContentLen bool
- }{
- {body: "some message"},
- {body: "some message", noContentLen: true},
- {body: strings.Repeat("a", 1<<20), noContentLen: true},
- {body: strings.Repeat("a", 1<<20)},
- {body: randString(16<<10 - 1)},
- {body: randString(16 << 10)},
- {body: randString(16<<10 + 1)},
- {body: randString(512<<10 - 1)},
- {body: randString(512 << 10)},
- {body: randString(512<<10 + 1)},
- {body: randString(1<<20 - 1)},
- {body: randString(1 << 20)},
- {body: randString(1<<20 + 2)},
- }
-
- type reqInfo struct {
- req *http.Request
- slurp []byte
- err error
- }
- gotc := make(chan reqInfo, 1)
- st := newServerTester(t,
- func(w http.ResponseWriter, r *http.Request) {
- slurp, err := ioutil.ReadAll(r.Body)
- if err != nil {
- gotc <- reqInfo{err: err}
- } else {
- gotc <- reqInfo{req: r, slurp: slurp}
- }
- },
- optOnlyServer,
- )
- defer st.Close()
-
- for i, tt := range bodyTests {
- tr := &Transport{TLSClientConfig: tlsConfigInsecure}
- defer tr.CloseIdleConnections()
-
- var body io.Reader = strings.NewReader(tt.body)
- if tt.noContentLen {
- body = struct{ io.Reader }{body} // just a Reader, hiding concrete type and other methods
- }
- req, err := http.NewRequest("POST", st.ts.URL, body)
- if err != nil {
- t.Fatalf("#%d: %v", i, err)
- }
- c := &http.Client{Transport: tr}
- res, err := c.Do(req)
- if err != nil {
- t.Fatalf("#%d: %v", i, err)
- }
- defer res.Body.Close()
- ri := <-gotc
- if ri.err != nil {
- t.Errorf("#%d: read error: %v", i, ri.err)
- continue
- }
- if got := string(ri.slurp); got != tt.body {
- t.Errorf("#%d: Read body mismatch.\n got: %q (len %d)\nwant: %q (len %d)", i, shortString(got), len(got), shortString(tt.body), len(tt.body))
- }
- wantLen := int64(len(tt.body))
- if tt.noContentLen && tt.body != "" {
- wantLen = -1
- }
- if ri.req.ContentLength != wantLen {
- t.Errorf("#%d. handler got ContentLength = %v; want %v", i, ri.req.ContentLength, wantLen)
- }
- }
-}
-
-func shortString(v string) string {
- const maxLen = 100
- if len(v) <= maxLen {
- return v
- }
- return fmt.Sprintf("%v[...%d bytes omitted...]%v", v[:maxLen/2], len(v)-maxLen, v[len(v)-maxLen/2:])
-}
-
-func TestTransportDialTLS(t *testing.T) {
- var mu sync.Mutex // guards following
- var gotReq, didDial bool
-
- ts := newServerTester(t,
- func(w http.ResponseWriter, r *http.Request) {
- mu.Lock()
- gotReq = true
- mu.Unlock()
- },
- optOnlyServer,
- )
- defer ts.Close()
- tr := &Transport{
- DialTLS: func(netw, addr string, cfg *tls.Config) (net.Conn, error) {
- mu.Lock()
- didDial = true
- mu.Unlock()
- cfg.InsecureSkipVerify = true
- c, err := tls.Dial(netw, addr, cfg)
- if err != nil {
- return nil, err
- }
- return c, c.Handshake()
- },
- }
- defer tr.CloseIdleConnections()
- client := &http.Client{Transport: tr}
- res, err := client.Get(ts.ts.URL)
- if err != nil {
- t.Fatal(err)
- }
- res.Body.Close()
- mu.Lock()
- if !gotReq {
- t.Error("didn't get request")
- }
- if !didDial {
- t.Error("didn't use dial hook")
- }
-}
-
-func TestConfigureTransport(t *testing.T) {
- t1 := &http.Transport{}
- err := ConfigureTransport(t1)
- if err == errTransportVersion {
- t.Skip(err)
- }
- if err != nil {
- t.Fatal(err)
- }
- if got := fmt.Sprintf("%#v", t1); !strings.Contains(got, `"h2"`) {
- // Laziness, to avoid buildtags.
- t.Errorf("stringification of HTTP/1 transport didn't contain \"h2\": %v", got)
- }
- wantNextProtos := []string{"h2", "http/1.1"}
- if t1.TLSClientConfig == nil {
- t.Errorf("nil t1.TLSClientConfig")
- } else if !reflect.DeepEqual(t1.TLSClientConfig.NextProtos, wantNextProtos) {
- t.Errorf("TLSClientConfig.NextProtos = %q; want %q", t1.TLSClientConfig.NextProtos, wantNextProtos)
- }
- if err := ConfigureTransport(t1); err == nil {
- t.Error("unexpected success on second call to ConfigureTransport")
- }
-
- // And does it work?
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- io.WriteString(w, r.Proto)
- }, optOnlyServer)
- defer st.Close()
-
- t1.TLSClientConfig.InsecureSkipVerify = true
- c := &http.Client{Transport: t1}
- res, err := c.Get(st.ts.URL)
- if err != nil {
- t.Fatal(err)
- }
- slurp, err := ioutil.ReadAll(res.Body)
- if err != nil {
- t.Fatal(err)
- }
- if got, want := string(slurp), "HTTP/2.0"; got != want {
- t.Errorf("body = %q; want %q", got, want)
- }
-}
-
-type capitalizeReader struct {
- r io.Reader
-}
-
-func (cr capitalizeReader) Read(p []byte) (n int, err error) {
- n, err = cr.r.Read(p)
- for i, b := range p[:n] {
- if b >= 'a' && b <= 'z' {
- p[i] = b - ('a' - 'A')
- }
- }
- return
-}
-
-type flushWriter struct {
- w io.Writer
-}
-
-func (fw flushWriter) Write(p []byte) (n int, err error) {
- n, err = fw.w.Write(p)
- if f, ok := fw.w.(http.Flusher); ok {
- f.Flush()
- }
- return
-}
-
-type clientTester struct {
- t *testing.T
- tr *Transport
- sc, cc net.Conn // server and client conn
- fr *Framer // server's framer
- client func() error
- server func() error
-}
-
-func newClientTester(t *testing.T) *clientTester {
- var dialOnce struct {
- sync.Mutex
- dialed bool
- }
- ct := &clientTester{
- t: t,
- }
- ct.tr = &Transport{
- TLSClientConfig: tlsConfigInsecure,
- DialTLS: func(network, addr string, cfg *tls.Config) (net.Conn, error) {
- dialOnce.Lock()
- defer dialOnce.Unlock()
- if dialOnce.dialed {
- return nil, errors.New("only one dial allowed in test mode")
- }
- dialOnce.dialed = true
- return ct.cc, nil
- },
- }
-
- ln := newLocalListener(t)
- cc, err := net.Dial("tcp", ln.Addr().String())
- if err != nil {
- t.Fatal(err)
-
- }
- sc, err := ln.Accept()
- if err != nil {
- t.Fatal(err)
- }
- ln.Close()
- ct.cc = cc
- ct.sc = sc
- ct.fr = NewFramer(sc, sc)
- return ct
-}
-
-func newLocalListener(t *testing.T) net.Listener {
- ln, err := net.Listen("tcp4", "127.0.0.1:0")
- if err == nil {
- return ln
- }
- ln, err = net.Listen("tcp6", "[::1]:0")
- if err != nil {
- t.Fatal(err)
- }
- return ln
-}
-
-func (ct *clientTester) greet(settings ...Setting) {
- buf := make([]byte, len(ClientPreface))
- _, err := io.ReadFull(ct.sc, buf)
- if err != nil {
- ct.t.Fatalf("reading client preface: %v", err)
- }
- f, err := ct.fr.ReadFrame()
- if err != nil {
- ct.t.Fatalf("Reading client settings frame: %v", err)
- }
- if sf, ok := f.(*SettingsFrame); !ok {
- ct.t.Fatalf("Wanted client settings frame; got %v", f)
- _ = sf // stash it away?
- }
- if err := ct.fr.WriteSettings(settings...); err != nil {
- ct.t.Fatal(err)
- }
- if err := ct.fr.WriteSettingsAck(); err != nil {
- ct.t.Fatal(err)
- }
-}
-
-func (ct *clientTester) readNonSettingsFrame() (Frame, error) {
- for {
- f, err := ct.fr.ReadFrame()
- if err != nil {
- return nil, err
- }
- if _, ok := f.(*SettingsFrame); ok {
- continue
- }
- return f, nil
- }
-}
-
-func (ct *clientTester) cleanup() {
- ct.tr.CloseIdleConnections()
-}
-
-func (ct *clientTester) run() {
- errc := make(chan error, 2)
- ct.start("client", errc, ct.client)
- ct.start("server", errc, ct.server)
- defer ct.cleanup()
- for i := 0; i < 2; i++ {
- if err := <-errc; err != nil {
- ct.t.Error(err)
- return
- }
- }
-}
-
-func (ct *clientTester) start(which string, errc chan<- error, fn func() error) {
- go func() {
- finished := false
- var err error
- defer func() {
- if !finished {
- err = fmt.Errorf("%s goroutine didn't finish.", which)
- } else if err != nil {
- err = fmt.Errorf("%s: %v", which, err)
- }
- errc <- err
- }()
- err = fn()
- finished = true
- }()
-}
-
-func (ct *clientTester) readFrame() (Frame, error) {
- return readFrameTimeout(ct.fr, 2*time.Second)
-}
-
-func (ct *clientTester) firstHeaders() (*HeadersFrame, error) {
- for {
- f, err := ct.readFrame()
- if err != nil {
- return nil, fmt.Errorf("ReadFrame while waiting for Headers: %v", err)
- }
- switch f.(type) {
- case *WindowUpdateFrame, *SettingsFrame:
- continue
- }
- hf, ok := f.(*HeadersFrame)
- if !ok {
- return nil, fmt.Errorf("Got %T; want HeadersFrame", f)
- }
- return hf, nil
- }
-}
-
-type countingReader struct {
- n *int64
-}
-
-func (r countingReader) Read(p []byte) (n int, err error) {
- for i := range p {
- p[i] = byte(i)
- }
- atomic.AddInt64(r.n, int64(len(p)))
- return len(p), err
-}
-
-func TestTransportReqBodyAfterResponse_200(t *testing.T) { testTransportReqBodyAfterResponse(t, 200) }
-func TestTransportReqBodyAfterResponse_403(t *testing.T) { testTransportReqBodyAfterResponse(t, 403) }
-
-func testTransportReqBodyAfterResponse(t *testing.T, status int) {
- const bodySize = 10 << 20
- clientDone := make(chan struct{})
- ct := newClientTester(t)
- ct.client = func() error {
- defer ct.cc.(*net.TCPConn).CloseWrite()
- defer close(clientDone)
-
- var n int64 // atomic
- req, err := http.NewRequest("PUT", "https://dummy.tld/", io.LimitReader(countingReader{&n}, bodySize))
- if err != nil {
- return err
- }
- res, err := ct.tr.RoundTrip(req)
- if err != nil {
- return fmt.Errorf("RoundTrip: %v", err)
- }
- defer res.Body.Close()
- if res.StatusCode != status {
- return fmt.Errorf("status code = %v; want %v", res.StatusCode, status)
- }
- slurp, err := ioutil.ReadAll(res.Body)
- if err != nil {
- return fmt.Errorf("Slurp: %v", err)
- }
- if len(slurp) > 0 {
- return fmt.Errorf("unexpected body: %q", slurp)
- }
- if status == 200 {
- if got := atomic.LoadInt64(&n); got != bodySize {
- return fmt.Errorf("For 200 response, Transport wrote %d bytes; want %d", got, bodySize)
- }
- } else {
- if got := atomic.LoadInt64(&n); got == 0 || got >= bodySize {
- return fmt.Errorf("For %d response, Transport wrote %d bytes; want (0,%d) exclusive", status, got, bodySize)
- }
- }
- return nil
- }
- ct.server = func() error {
- ct.greet()
- var buf bytes.Buffer
- enc := hpack.NewEncoder(&buf)
- var dataRecv int64
- var closed bool
- for {
- f, err := ct.fr.ReadFrame()
- if err != nil {
- select {
- case <-clientDone:
- // If the client's done, it
- // will have reported any
- // errors on its side.
- return nil
- default:
- return err
- }
- }
- //println(fmt.Sprintf("server got frame: %v", f))
- switch f := f.(type) {
- case *WindowUpdateFrame, *SettingsFrame:
- case *HeadersFrame:
- if !f.HeadersEnded() {
- return fmt.Errorf("headers should have END_HEADERS be ended: %v", f)
- }
- if f.StreamEnded() {
- return fmt.Errorf("headers contains END_STREAM unexpectedly: %v", f)
- }
- case *DataFrame:
- dataLen := len(f.Data())
- if dataLen > 0 {
- if dataRecv == 0 {
- enc.WriteField(hpack.HeaderField{Name: ":status", Value: strconv.Itoa(status)})
- ct.fr.WriteHeaders(HeadersFrameParam{
- StreamID: f.StreamID,
- EndHeaders: true,
- EndStream: false,
- BlockFragment: buf.Bytes(),
- })
- }
- if err := ct.fr.WriteWindowUpdate(0, uint32(dataLen)); err != nil {
- return err
- }
- if err := ct.fr.WriteWindowUpdate(f.StreamID, uint32(dataLen)); err != nil {
- return err
- }
- }
- dataRecv += int64(dataLen)
-
- if !closed && ((status != 200 && dataRecv > 0) ||
- (status == 200 && dataRecv == bodySize)) {
- closed = true
- if err := ct.fr.WriteData(f.StreamID, true, nil); err != nil {
- return err
- }
- }
- default:
- return fmt.Errorf("Unexpected client frame %v", f)
- }
- }
- }
- ct.run()
-}
-
-// See golang.org/issue/13444
-func TestTransportFullDuplex(t *testing.T) {
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- w.WriteHeader(200) // redundant but for clarity
- w.(http.Flusher).Flush()
- io.Copy(flushWriter{w}, capitalizeReader{r.Body})
- fmt.Fprintf(w, "bye.\n")
- }, optOnlyServer)
- defer st.Close()
-
- tr := &Transport{TLSClientConfig: tlsConfigInsecure}
- defer tr.CloseIdleConnections()
- c := &http.Client{Transport: tr}
-
- pr, pw := io.Pipe()
- req, err := http.NewRequest("PUT", st.ts.URL, ioutil.NopCloser(pr))
- if err != nil {
- t.Fatal(err)
- }
- req.ContentLength = -1
- res, err := c.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- defer res.Body.Close()
- if res.StatusCode != 200 {
- t.Fatalf("StatusCode = %v; want %v", res.StatusCode, 200)
- }
- bs := bufio.NewScanner(res.Body)
- want := func(v string) {
- if !bs.Scan() {
- t.Fatalf("wanted to read %q but Scan() = false, err = %v", v, bs.Err())
- }
- }
- write := func(v string) {
- _, err := io.WriteString(pw, v)
- if err != nil {
- t.Fatalf("pipe write: %v", err)
- }
- }
- write("foo\n")
- want("FOO")
- write("bar\n")
- want("BAR")
- pw.Close()
- want("bye.")
- if err := bs.Err(); err != nil {
- t.Fatal(err)
- }
-}
-
-func TestTransportConnectRequest(t *testing.T) {
- gotc := make(chan *http.Request, 1)
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- gotc <- r
- }, optOnlyServer)
- defer st.Close()
-
- u, err := url.Parse(st.ts.URL)
- if err != nil {
- t.Fatal(err)
- }
-
- tr := &Transport{TLSClientConfig: tlsConfigInsecure}
- defer tr.CloseIdleConnections()
- c := &http.Client{Transport: tr}
-
- tests := []struct {
- req *http.Request
- want string
- }{
- {
- req: &http.Request{
- Method: "CONNECT",
- Header: http.Header{},
- URL: u,
- },
- want: u.Host,
- },
- {
- req: &http.Request{
- Method: "CONNECT",
- Header: http.Header{},
- URL: u,
- Host: "example.com:123",
- },
- want: "example.com:123",
- },
- }
-
- for i, tt := range tests {
- res, err := c.Do(tt.req)
- if err != nil {
- t.Errorf("%d. RoundTrip = %v", i, err)
- continue
- }
- res.Body.Close()
- req := <-gotc
- if req.Method != "CONNECT" {
- t.Errorf("method = %q; want CONNECT", req.Method)
- }
- if req.Host != tt.want {
- t.Errorf("Host = %q; want %q", req.Host, tt.want)
- }
- if req.URL.Host != tt.want {
- t.Errorf("URL.Host = %q; want %q", req.URL.Host, tt.want)
- }
- }
-}
-
-type headerType int
-
-const (
- noHeader headerType = iota // omitted
- oneHeader
- splitHeader // broken into continuation on purpose
-)
-
-const (
- f0 = noHeader
- f1 = oneHeader
- f2 = splitHeader
- d0 = false
- d1 = true
-)
-
-// Test all 36 combinations of response frame orders:
-// (3 ways of 100-continue) * (2 ways of headers) * (2 ways of data) * (3 ways of trailers):func TestTransportResponsePattern_00f0(t *testing.T) { testTransportResponsePattern(h0, h1, false, h0) }
-// Generated by http://play.golang.org/p/SScqYKJYXd
-func TestTransportResPattern_c0h1d0t0(t *testing.T) { testTransportResPattern(t, f0, f1, d0, f0) }
-func TestTransportResPattern_c0h1d0t1(t *testing.T) { testTransportResPattern(t, f0, f1, d0, f1) }
-func TestTransportResPattern_c0h1d0t2(t *testing.T) { testTransportResPattern(t, f0, f1, d0, f2) }
-func TestTransportResPattern_c0h1d1t0(t *testing.T) { testTransportResPattern(t, f0, f1, d1, f0) }
-func TestTransportResPattern_c0h1d1t1(t *testing.T) { testTransportResPattern(t, f0, f1, d1, f1) }
-func TestTransportResPattern_c0h1d1t2(t *testing.T) { testTransportResPattern(t, f0, f1, d1, f2) }
-func TestTransportResPattern_c0h2d0t0(t *testing.T) { testTransportResPattern(t, f0, f2, d0, f0) }
-func TestTransportResPattern_c0h2d0t1(t *testing.T) { testTransportResPattern(t, f0, f2, d0, f1) }
-func TestTransportResPattern_c0h2d0t2(t *testing.T) { testTransportResPattern(t, f0, f2, d0, f2) }
-func TestTransportResPattern_c0h2d1t0(t *testing.T) { testTransportResPattern(t, f0, f2, d1, f0) }
-func TestTransportResPattern_c0h2d1t1(t *testing.T) { testTransportResPattern(t, f0, f2, d1, f1) }
-func TestTransportResPattern_c0h2d1t2(t *testing.T) { testTransportResPattern(t, f0, f2, d1, f2) }
-func TestTransportResPattern_c1h1d0t0(t *testing.T) { testTransportResPattern(t, f1, f1, d0, f0) }
-func TestTransportResPattern_c1h1d0t1(t *testing.T) { testTransportResPattern(t, f1, f1, d0, f1) }
-func TestTransportResPattern_c1h1d0t2(t *testing.T) { testTransportResPattern(t, f1, f1, d0, f2) }
-func TestTransportResPattern_c1h1d1t0(t *testing.T) { testTransportResPattern(t, f1, f1, d1, f0) }
-func TestTransportResPattern_c1h1d1t1(t *testing.T) { testTransportResPattern(t, f1, f1, d1, f1) }
-func TestTransportResPattern_c1h1d1t2(t *testing.T) { testTransportResPattern(t, f1, f1, d1, f2) }
-func TestTransportResPattern_c1h2d0t0(t *testing.T) { testTransportResPattern(t, f1, f2, d0, f0) }
-func TestTransportResPattern_c1h2d0t1(t *testing.T) { testTransportResPattern(t, f1, f2, d0, f1) }
-func TestTransportResPattern_c1h2d0t2(t *testing.T) { testTransportResPattern(t, f1, f2, d0, f2) }
-func TestTransportResPattern_c1h2d1t0(t *testing.T) { testTransportResPattern(t, f1, f2, d1, f0) }
-func TestTransportResPattern_c1h2d1t1(t *testing.T) { testTransportResPattern(t, f1, f2, d1, f1) }
-func TestTransportResPattern_c1h2d1t2(t *testing.T) { testTransportResPattern(t, f1, f2, d1, f2) }
-func TestTransportResPattern_c2h1d0t0(t *testing.T) { testTransportResPattern(t, f2, f1, d0, f0) }
-func TestTransportResPattern_c2h1d0t1(t *testing.T) { testTransportResPattern(t, f2, f1, d0, f1) }
-func TestTransportResPattern_c2h1d0t2(t *testing.T) { testTransportResPattern(t, f2, f1, d0, f2) }
-func TestTransportResPattern_c2h1d1t0(t *testing.T) { testTransportResPattern(t, f2, f1, d1, f0) }
-func TestTransportResPattern_c2h1d1t1(t *testing.T) { testTransportResPattern(t, f2, f1, d1, f1) }
-func TestTransportResPattern_c2h1d1t2(t *testing.T) { testTransportResPattern(t, f2, f1, d1, f2) }
-func TestTransportResPattern_c2h2d0t0(t *testing.T) { testTransportResPattern(t, f2, f2, d0, f0) }
-func TestTransportResPattern_c2h2d0t1(t *testing.T) { testTransportResPattern(t, f2, f2, d0, f1) }
-func TestTransportResPattern_c2h2d0t2(t *testing.T) { testTransportResPattern(t, f2, f2, d0, f2) }
-func TestTransportResPattern_c2h2d1t0(t *testing.T) { testTransportResPattern(t, f2, f2, d1, f0) }
-func TestTransportResPattern_c2h2d1t1(t *testing.T) { testTransportResPattern(t, f2, f2, d1, f1) }
-func TestTransportResPattern_c2h2d1t2(t *testing.T) { testTransportResPattern(t, f2, f2, d1, f2) }
-
-func testTransportResPattern(t *testing.T, expect100Continue, resHeader headerType, withData bool, trailers headerType) {
- const reqBody = "some request body"
- const resBody = "some response body"
-
- if resHeader == noHeader {
- // TODO: test 100-continue followed by immediate
- // server stream reset, without headers in the middle?
- panic("invalid combination")
- }
-
- ct := newClientTester(t)
- ct.client = func() error {
- req, _ := http.NewRequest("POST", "https://dummy.tld/", strings.NewReader(reqBody))
- if expect100Continue != noHeader {
- req.Header.Set("Expect", "100-continue")
- }
- res, err := ct.tr.RoundTrip(req)
- if err != nil {
- return fmt.Errorf("RoundTrip: %v", err)
- }
- defer res.Body.Close()
- if res.StatusCode != 200 {
- return fmt.Errorf("status code = %v; want 200", res.StatusCode)
- }
- slurp, err := ioutil.ReadAll(res.Body)
- if err != nil {
- return fmt.Errorf("Slurp: %v", err)
- }
- wantBody := resBody
- if !withData {
- wantBody = ""
- }
- if string(slurp) != wantBody {
- return fmt.Errorf("body = %q; want %q", slurp, wantBody)
- }
- if trailers == noHeader {
- if len(res.Trailer) > 0 {
- t.Errorf("Trailer = %v; want none", res.Trailer)
- }
- } else {
- want := http.Header{"Some-Trailer": {"some-value"}}
- if !reflect.DeepEqual(res.Trailer, want) {
- t.Errorf("Trailer = %v; want %v", res.Trailer, want)
- }
- }
- return nil
- }
- ct.server = func() error {
- ct.greet()
- var buf bytes.Buffer
- enc := hpack.NewEncoder(&buf)
-
- for {
- f, err := ct.fr.ReadFrame()
- if err != nil {
- return err
- }
- endStream := false
- send := func(mode headerType) {
- hbf := buf.Bytes()
- switch mode {
- case oneHeader:
- ct.fr.WriteHeaders(HeadersFrameParam{
- StreamID: f.Header().StreamID,
- EndHeaders: true,
- EndStream: endStream,
- BlockFragment: hbf,
- })
- case splitHeader:
- if len(hbf) < 2 {
- panic("too small")
- }
- ct.fr.WriteHeaders(HeadersFrameParam{
- StreamID: f.Header().StreamID,
- EndHeaders: false,
- EndStream: endStream,
- BlockFragment: hbf[:1],
- })
- ct.fr.WriteContinuation(f.Header().StreamID, true, hbf[1:])
- default:
- panic("bogus mode")
- }
- }
- switch f := f.(type) {
- case *WindowUpdateFrame, *SettingsFrame:
- case *DataFrame:
- if !f.StreamEnded() {
- // No need to send flow control tokens. The test request body is tiny.
- continue
- }
- // Response headers (1+ frames; 1 or 2 in this test, but never 0)
- {
- buf.Reset()
- enc.WriteField(hpack.HeaderField{Name: ":status", Value: "200"})
- enc.WriteField(hpack.HeaderField{Name: "x-foo", Value: "blah"})
- enc.WriteField(hpack.HeaderField{Name: "x-bar", Value: "more"})
- if trailers != noHeader {
- enc.WriteField(hpack.HeaderField{Name: "trailer", Value: "some-trailer"})
- }
- endStream = withData == false && trailers == noHeader
- send(resHeader)
- }
- if withData {
- endStream = trailers == noHeader
- ct.fr.WriteData(f.StreamID, endStream, []byte(resBody))
- }
- if trailers != noHeader {
- endStream = true
- buf.Reset()
- enc.WriteField(hpack.HeaderField{Name: "some-trailer", Value: "some-value"})
- send(trailers)
- }
- if endStream {
- return nil
- }
- case *HeadersFrame:
- if expect100Continue != noHeader {
- buf.Reset()
- enc.WriteField(hpack.HeaderField{Name: ":status", Value: "100"})
- send(expect100Continue)
- }
- }
- }
- }
- ct.run()
-}
-
-func TestTransportReceiveUndeclaredTrailer(t *testing.T) {
- ct := newClientTester(t)
- ct.client = func() error {
- req, _ := http.NewRequest("GET", "https://dummy.tld/", nil)
- res, err := ct.tr.RoundTrip(req)
- if err != nil {
- return fmt.Errorf("RoundTrip: %v", err)
- }
- defer res.Body.Close()
- if res.StatusCode != 200 {
- return fmt.Errorf("status code = %v; want 200", res.StatusCode)
- }
- slurp, err := ioutil.ReadAll(res.Body)
- if err != nil {
- return fmt.Errorf("res.Body ReadAll error = %q, %v; want %v", slurp, err, nil)
- }
- if len(slurp) > 0 {
- return fmt.Errorf("body = %q; want nothing", slurp)
- }
- if _, ok := res.Trailer["Some-Trailer"]; !ok {
- return fmt.Errorf("expected Some-Trailer")
- }
- return nil
- }
- ct.server = func() error {
- ct.greet()
-
- var n int
- var hf *HeadersFrame
- for hf == nil && n < 10 {
- f, err := ct.fr.ReadFrame()
- if err != nil {
- return err
- }
- hf, _ = f.(*HeadersFrame)
- n++
- }
-
- var buf bytes.Buffer
- enc := hpack.NewEncoder(&buf)
-
- // send headers without Trailer header
- enc.WriteField(hpack.HeaderField{Name: ":status", Value: "200"})
- ct.fr.WriteHeaders(HeadersFrameParam{
- StreamID: hf.StreamID,
- EndHeaders: true,
- EndStream: false,
- BlockFragment: buf.Bytes(),
- })
-
- // send trailers
- buf.Reset()
- enc.WriteField(hpack.HeaderField{Name: "some-trailer", Value: "I'm an undeclared Trailer!"})
- ct.fr.WriteHeaders(HeadersFrameParam{
- StreamID: hf.StreamID,
- EndHeaders: true,
- EndStream: true,
- BlockFragment: buf.Bytes(),
- })
- return nil
- }
- ct.run()
-}
-
-func TestTransportInvalidTrailer_Pseudo1(t *testing.T) {
- testTransportInvalidTrailer_Pseudo(t, oneHeader)
-}
-func TestTransportInvalidTrailer_Pseudo2(t *testing.T) {
- testTransportInvalidTrailer_Pseudo(t, splitHeader)
-}
-func testTransportInvalidTrailer_Pseudo(t *testing.T, trailers headerType) {
- testInvalidTrailer(t, trailers, pseudoHeaderError(":colon"), func(enc *hpack.Encoder) {
- enc.WriteField(hpack.HeaderField{Name: ":colon", Value: "foo"})
- enc.WriteField(hpack.HeaderField{Name: "foo", Value: "bar"})
- })
-}
-
-func TestTransportInvalidTrailer_Capital1(t *testing.T) {
- testTransportInvalidTrailer_Capital(t, oneHeader)
-}
-func TestTransportInvalidTrailer_Capital2(t *testing.T) {
- testTransportInvalidTrailer_Capital(t, splitHeader)
-}
-func testTransportInvalidTrailer_Capital(t *testing.T, trailers headerType) {
- testInvalidTrailer(t, trailers, headerFieldNameError("Capital"), func(enc *hpack.Encoder) {
- enc.WriteField(hpack.HeaderField{Name: "foo", Value: "bar"})
- enc.WriteField(hpack.HeaderField{Name: "Capital", Value: "bad"})
- })
-}
-func TestTransportInvalidTrailer_EmptyFieldName(t *testing.T) {
- testInvalidTrailer(t, oneHeader, headerFieldNameError(""), func(enc *hpack.Encoder) {
- enc.WriteField(hpack.HeaderField{Name: "", Value: "bad"})
- })
-}
-func TestTransportInvalidTrailer_BinaryFieldValue(t *testing.T) {
- testInvalidTrailer(t, oneHeader, headerFieldValueError("has\nnewline"), func(enc *hpack.Encoder) {
- enc.WriteField(hpack.HeaderField{Name: "x", Value: "has\nnewline"})
- })
-}
-
-func testInvalidTrailer(t *testing.T, trailers headerType, wantErr error, writeTrailer func(*hpack.Encoder)) {
- ct := newClientTester(t)
- ct.client = func() error {
- req, _ := http.NewRequest("GET", "https://dummy.tld/", nil)
- res, err := ct.tr.RoundTrip(req)
- if err != nil {
- return fmt.Errorf("RoundTrip: %v", err)
- }
- defer res.Body.Close()
- if res.StatusCode != 200 {
- return fmt.Errorf("status code = %v; want 200", res.StatusCode)
- }
- slurp, err := ioutil.ReadAll(res.Body)
- se, ok := err.(StreamError)
- if !ok || se.Cause != wantErr {
- return fmt.Errorf("res.Body ReadAll error = %q, %#v; want StreamError with cause %T, %#v", slurp, err, wantErr, wantErr)
- }
- if len(slurp) > 0 {
- return fmt.Errorf("body = %q; want nothing", slurp)
- }
- return nil
- }
- ct.server = func() error {
- ct.greet()
- var buf bytes.Buffer
- enc := hpack.NewEncoder(&buf)
-
- for {
- f, err := ct.fr.ReadFrame()
- if err != nil {
- return err
- }
- switch f := f.(type) {
- case *HeadersFrame:
- var endStream bool
- send := func(mode headerType) {
- hbf := buf.Bytes()
- switch mode {
- case oneHeader:
- ct.fr.WriteHeaders(HeadersFrameParam{
- StreamID: f.StreamID,
- EndHeaders: true,
- EndStream: endStream,
- BlockFragment: hbf,
- })
- case splitHeader:
- if len(hbf) < 2 {
- panic("too small")
- }
- ct.fr.WriteHeaders(HeadersFrameParam{
- StreamID: f.StreamID,
- EndHeaders: false,
- EndStream: endStream,
- BlockFragment: hbf[:1],
- })
- ct.fr.WriteContinuation(f.StreamID, true, hbf[1:])
- default:
- panic("bogus mode")
- }
- }
- // Response headers (1+ frames; 1 or 2 in this test, but never 0)
- {
- buf.Reset()
- enc.WriteField(hpack.HeaderField{Name: ":status", Value: "200"})
- enc.WriteField(hpack.HeaderField{Name: "trailer", Value: "declared"})
- endStream = false
- send(oneHeader)
- }
- // Trailers:
- {
- endStream = true
- buf.Reset()
- writeTrailer(enc)
- send(trailers)
- }
- return nil
- }
- }
- }
- ct.run()
-}
-
-// headerListSize returns the HTTP2 header list size of h.
-// http://httpwg.org/specs/rfc7540.html#SETTINGS_MAX_HEADER_LIST_SIZE
-// http://httpwg.org/specs/rfc7540.html#MaxHeaderBlock
-func headerListSize(h http.Header) (size uint32) {
- for k, vv := range h {
- for _, v := range vv {
- hf := hpack.HeaderField{Name: k, Value: v}
- size += hf.Size()
- }
- }
- return size
-}
-
-// padHeaders adds data to an http.Header until headerListSize(h) ==
-// limit. Due to the way header list sizes are calculated, padHeaders
-// cannot add fewer than len("Pad-Headers") + 32 bytes to h, and will
-// call t.Fatal if asked to do so. PadHeaders first reserves enough
-// space for an empty "Pad-Headers" key, then adds as many copies of
-// filler as possible. Any remaining bytes necessary to push the
-// header list size up to limit are added to h["Pad-Headers"].
-func padHeaders(t *testing.T, h http.Header, limit uint64, filler string) {
- if limit > 0xffffffff {
- t.Fatalf("padHeaders: refusing to pad to more than 2^32-1 bytes. limit = %v", limit)
- }
- hf := hpack.HeaderField{Name: "Pad-Headers", Value: ""}
- minPadding := uint64(hf.Size())
- size := uint64(headerListSize(h))
-
- minlimit := size + minPadding
- if limit < minlimit {
- t.Fatalf("padHeaders: limit %v < %v", limit, minlimit)
- }
-
- // Use a fixed-width format for name so that fieldSize
- // remains constant.
- nameFmt := "Pad-Headers-%06d"
- hf = hpack.HeaderField{Name: fmt.Sprintf(nameFmt, 1), Value: filler}
- fieldSize := uint64(hf.Size())
-
- // Add as many complete filler values as possible, leaving
- // room for at least one empty "Pad-Headers" key.
- limit = limit - minPadding
- for i := 0; size+fieldSize < limit; i++ {
- name := fmt.Sprintf(nameFmt, i)
- h.Add(name, filler)
- size += fieldSize
- }
-
- // Add enough bytes to reach limit.
- remain := limit - size
- lastValue := strings.Repeat("*", int(remain))
- h.Add("Pad-Headers", lastValue)
-}
-
-func TestPadHeaders(t *testing.T) {
- check := func(h http.Header, limit uint32, fillerLen int) {
- if h == nil {
- h = make(http.Header)
- }
- filler := strings.Repeat("f", fillerLen)
- padHeaders(t, h, uint64(limit), filler)
- gotSize := headerListSize(h)
- if gotSize != limit {
- t.Errorf("Got size = %v; want %v", gotSize, limit)
- }
- }
- // Try all possible combinations for small fillerLen and limit.
- hf := hpack.HeaderField{Name: "Pad-Headers", Value: ""}
- minLimit := hf.Size()
- for limit := minLimit; limit <= 128; limit++ {
- for fillerLen := 0; uint32(fillerLen) <= limit; fillerLen++ {
- check(nil, limit, fillerLen)
- }
- }
-
- // Try a few tests with larger limits, plus cumulative
- // tests. Since these tests are cumulative, tests[i+1].limit
- // must be >= tests[i].limit + minLimit. See the comment on
- // padHeaders for more info on why the limit arg has this
- // restriction.
- tests := []struct {
- fillerLen int
- limit uint32
- }{
- {
- fillerLen: 64,
- limit: 1024,
- },
- {
- fillerLen: 1024,
- limit: 1286,
- },
- {
- fillerLen: 256,
- limit: 2048,
- },
- {
- fillerLen: 1024,
- limit: 10 * 1024,
- },
- {
- fillerLen: 1023,
- limit: 11 * 1024,
- },
- }
- h := make(http.Header)
- for _, tc := range tests {
- check(nil, tc.limit, tc.fillerLen)
- check(h, tc.limit, tc.fillerLen)
- }
-}
-
-func TestTransportChecksRequestHeaderListSize(t *testing.T) {
- st := newServerTester(t,
- func(w http.ResponseWriter, r *http.Request) {
- // Consume body & force client to send
- // trailers before writing response.
- // ioutil.ReadAll returns non-nil err for
- // requests that attempt to send greater than
- // maxHeaderListSize bytes of trailers, since
- // those requests generate a stream reset.
- ioutil.ReadAll(r.Body)
- r.Body.Close()
- },
- func(ts *httptest.Server) {
- ts.Config.MaxHeaderBytes = 16 << 10
- },
- optOnlyServer,
- optQuiet,
- )
- defer st.Close()
-
- tr := &Transport{TLSClientConfig: tlsConfigInsecure}
- defer tr.CloseIdleConnections()
-
- checkRoundTrip := func(req *http.Request, wantErr error, desc string) {
- res, err := tr.RoundTrip(req)
- if err != wantErr {
- if res != nil {
- res.Body.Close()
- }
- t.Errorf("%v: RoundTrip err = %v; want %v", desc, err, wantErr)
- return
- }
- if err == nil {
- if res == nil {
- t.Errorf("%v: response nil; want non-nil.", desc)
- return
- }
- defer res.Body.Close()
- if res.StatusCode != http.StatusOK {
- t.Errorf("%v: response status = %v; want %v", desc, res.StatusCode, http.StatusOK)
- }
- return
- }
- if res != nil {
- t.Errorf("%v: RoundTrip err = %v but response non-nil", desc, err)
- }
- }
- headerListSizeForRequest := func(req *http.Request) (size uint64) {
- contentLen := actualContentLength(req)
- trailers, err := commaSeparatedTrailers(req)
- if err != nil {
- t.Fatalf("headerListSizeForRequest: %v", err)
- }
- cc := &ClientConn{peerMaxHeaderListSize: 0xffffffffffffffff}
- cc.henc = hpack.NewEncoder(&cc.hbuf)
- cc.mu.Lock()
- hdrs, err := cc.encodeHeaders(req, true, trailers, contentLen)
- cc.mu.Unlock()
- if err != nil {
- t.Fatalf("headerListSizeForRequest: %v", err)
- }
- hpackDec := hpack.NewDecoder(initialHeaderTableSize, func(hf hpack.HeaderField) {
- size += uint64(hf.Size())
- })
- if len(hdrs) > 0 {
- if _, err := hpackDec.Write(hdrs); err != nil {
- t.Fatalf("headerListSizeForRequest: %v", err)
- }
- }
- return size
- }
- // Create a new Request for each test, rather than reusing the
- // same Request, to avoid a race when modifying req.Headers.
- // See https://github.com/golang/go/issues/21316
- newRequest := func() *http.Request {
- // Body must be non-nil to enable writing trailers.
- body := strings.NewReader("hello")
- req, err := http.NewRequest("POST", st.ts.URL, body)
- if err != nil {
- t.Fatalf("newRequest: NewRequest: %v", err)
- }
- return req
- }
-
- // Make an arbitrary request to ensure we get the server's
- // settings frame and initialize peerMaxHeaderListSize.
- req := newRequest()
- checkRoundTrip(req, nil, "Initial request")
-
- // Get the ClientConn associated with the request and validate
- // peerMaxHeaderListSize.
- addr := authorityAddr(req.URL.Scheme, req.URL.Host)
- cc, err := tr.connPool().GetClientConn(req, addr)
- if err != nil {
- t.Fatalf("GetClientConn: %v", err)
- }
- cc.mu.Lock()
- peerSize := cc.peerMaxHeaderListSize
- cc.mu.Unlock()
- st.scMu.Lock()
- wantSize := uint64(st.sc.maxHeaderListSize())
- st.scMu.Unlock()
- if peerSize != wantSize {
- t.Errorf("peerMaxHeaderListSize = %v; want %v", peerSize, wantSize)
- }
-
- // Sanity check peerSize. (*serverConn) maxHeaderListSize adds
- // 320 bytes of padding.
- wantHeaderBytes := uint64(st.ts.Config.MaxHeaderBytes) + 320
- if peerSize != wantHeaderBytes {
- t.Errorf("peerMaxHeaderListSize = %v; want %v.", peerSize, wantHeaderBytes)
- }
-
- // Pad headers & trailers, but stay under peerSize.
- req = newRequest()
- req.Header = make(http.Header)
- req.Trailer = make(http.Header)
- filler := strings.Repeat("*", 1024)
- padHeaders(t, req.Trailer, peerSize, filler)
- // cc.encodeHeaders adds some default headers to the request,
- // so we need to leave room for those.
- defaultBytes := headerListSizeForRequest(req)
- padHeaders(t, req.Header, peerSize-defaultBytes, filler)
- checkRoundTrip(req, nil, "Headers & Trailers under limit")
-
- // Add enough header bytes to push us over peerSize.
- req = newRequest()
- req.Header = make(http.Header)
- padHeaders(t, req.Header, peerSize, filler)
- checkRoundTrip(req, errRequestHeaderListSize, "Headers over limit")
-
- // Push trailers over the limit.
- req = newRequest()
- req.Trailer = make(http.Header)
- padHeaders(t, req.Trailer, peerSize+1, filler)
- checkRoundTrip(req, errRequestHeaderListSize, "Trailers over limit")
-
- // Send headers with a single large value.
- req = newRequest()
- filler = strings.Repeat("*", int(peerSize))
- req.Header = make(http.Header)
- req.Header.Set("Big", filler)
- checkRoundTrip(req, errRequestHeaderListSize, "Single large header")
-
- // Send trailers with a single large value.
- req = newRequest()
- req.Trailer = make(http.Header)
- req.Trailer.Set("Big", filler)
- checkRoundTrip(req, errRequestHeaderListSize, "Single large trailer")
-}
-
-func TestTransportChecksResponseHeaderListSize(t *testing.T) {
- ct := newClientTester(t)
- ct.client = func() error {
- req, _ := http.NewRequest("GET", "https://dummy.tld/", nil)
- res, err := ct.tr.RoundTrip(req)
- if err != errResponseHeaderListSize {
- if res != nil {
- res.Body.Close()
- }
- size := int64(0)
- for k, vv := range res.Header {
- for _, v := range vv {
- size += int64(len(k)) + int64(len(v)) + 32
- }
- }
- return fmt.Errorf("RoundTrip Error = %v (and %d bytes of response headers); want errResponseHeaderListSize", err, size)
- }
- return nil
- }
- ct.server = func() error {
- ct.greet()
- var buf bytes.Buffer
- enc := hpack.NewEncoder(&buf)
-
- for {
- f, err := ct.fr.ReadFrame()
- if err != nil {
- return err
- }
- switch f := f.(type) {
- case *HeadersFrame:
- enc.WriteField(hpack.HeaderField{Name: ":status", Value: "200"})
- large := strings.Repeat("a", 1<<10)
- for i := 0; i < 5042; i++ {
- enc.WriteField(hpack.HeaderField{Name: large, Value: large})
- }
- if size, want := buf.Len(), 6329; size != want {
- // Note: this number might change if
- // our hpack implementation
- // changes. That's fine. This is
- // just a sanity check that our
- // response can fit in a single
- // header block fragment frame.
- return fmt.Errorf("encoding over 10MB of duplicate keypairs took %d bytes; expected %d", size, want)
- }
- ct.fr.WriteHeaders(HeadersFrameParam{
- StreamID: f.StreamID,
- EndHeaders: true,
- EndStream: true,
- BlockFragment: buf.Bytes(),
- })
- return nil
- }
- }
- }
- ct.run()
-}
-
-// Test that the Transport returns a typed error from Response.Body.Read calls
-// when the server sends an error. (here we use a panic, since that should generate
-// a stream error, but others like cancel should be similar)
-func TestTransportBodyReadErrorType(t *testing.T) {
- doPanic := make(chan bool, 1)
- st := newServerTester(t,
- func(w http.ResponseWriter, r *http.Request) {
- w.(http.Flusher).Flush() // force headers out
- <-doPanic
- panic("boom")
- },
- optOnlyServer,
- optQuiet,
- )
- defer st.Close()
-
- tr := &Transport{TLSClientConfig: tlsConfigInsecure}
- defer tr.CloseIdleConnections()
- c := &http.Client{Transport: tr}
-
- res, err := c.Get(st.ts.URL)
- if err != nil {
- t.Fatal(err)
- }
- defer res.Body.Close()
- doPanic <- true
- buf := make([]byte, 100)
- n, err := res.Body.Read(buf)
- want := StreamError{StreamID: 0x1, Code: 0x2}
- if !reflect.DeepEqual(want, err) {
- t.Errorf("Read = %v, %#v; want error %#v", n, err, want)
- }
-}
-
-// golang.org/issue/13924
-// This used to fail after many iterations, especially with -race:
-// go test -v -run=TestTransportDoubleCloseOnWriteError -count=500 -race
-func TestTransportDoubleCloseOnWriteError(t *testing.T) {
- var (
- mu sync.Mutex
- conn net.Conn // to close if set
- )
-
- st := newServerTester(t,
- func(w http.ResponseWriter, r *http.Request) {
- mu.Lock()
- defer mu.Unlock()
- if conn != nil {
- conn.Close()
- }
- },
- optOnlyServer,
- )
- defer st.Close()
-
- tr := &Transport{
- TLSClientConfig: tlsConfigInsecure,
- DialTLS: func(network, addr string, cfg *tls.Config) (net.Conn, error) {
- tc, err := tls.Dial(network, addr, cfg)
- if err != nil {
- return nil, err
- }
- mu.Lock()
- defer mu.Unlock()
- conn = tc
- return tc, nil
- },
- }
- defer tr.CloseIdleConnections()
- c := &http.Client{Transport: tr}
- c.Get(st.ts.URL)
-}
-
-// Test that the http1 Transport.DisableKeepAlives option is respected
-// and connections are closed as soon as idle.
-// See golang.org/issue/14008
-func TestTransportDisableKeepAlives(t *testing.T) {
- st := newServerTester(t,
- func(w http.ResponseWriter, r *http.Request) {
- io.WriteString(w, "hi")
- },
- optOnlyServer,
- )
- defer st.Close()
-
- connClosed := make(chan struct{}) // closed on tls.Conn.Close
- tr := &Transport{
- t1: &http.Transport{
- DisableKeepAlives: true,
- },
- TLSClientConfig: tlsConfigInsecure,
- DialTLS: func(network, addr string, cfg *tls.Config) (net.Conn, error) {
- tc, err := tls.Dial(network, addr, cfg)
- if err != nil {
- return nil, err
- }
- return &noteCloseConn{Conn: tc, closefn: func() { close(connClosed) }}, nil
- },
- }
- c := &http.Client{Transport: tr}
- res, err := c.Get(st.ts.URL)
- if err != nil {
- t.Fatal(err)
- }
- if _, err := ioutil.ReadAll(res.Body); err != nil {
- t.Fatal(err)
- }
- defer res.Body.Close()
-
- select {
- case <-connClosed:
- case <-time.After(1 * time.Second):
- t.Errorf("timeout")
- }
-
-}
-
-// Test concurrent requests with Transport.DisableKeepAlives. We can share connections,
-// but when things are totally idle, it still needs to close.
-func TestTransportDisableKeepAlives_Concurrency(t *testing.T) {
- const D = 25 * time.Millisecond
- st := newServerTester(t,
- func(w http.ResponseWriter, r *http.Request) {
- time.Sleep(D)
- io.WriteString(w, "hi")
- },
- optOnlyServer,
- )
- defer st.Close()
-
- var dials int32
- var conns sync.WaitGroup
- tr := &Transport{
- t1: &http.Transport{
- DisableKeepAlives: true,
- },
- TLSClientConfig: tlsConfigInsecure,
- DialTLS: func(network, addr string, cfg *tls.Config) (net.Conn, error) {
- tc, err := tls.Dial(network, addr, cfg)
- if err != nil {
- return nil, err
- }
- atomic.AddInt32(&dials, 1)
- conns.Add(1)
- return &noteCloseConn{Conn: tc, closefn: func() { conns.Done() }}, nil
- },
- }
- c := &http.Client{Transport: tr}
- var reqs sync.WaitGroup
- const N = 20
- for i := 0; i < N; i++ {
- reqs.Add(1)
- if i == N-1 {
- // For the final request, try to make all the
- // others close. This isn't verified in the
- // count, other than the Log statement, since
- // it's so timing dependent. This test is
- // really to make sure we don't interrupt a
- // valid request.
- time.Sleep(D * 2)
- }
- go func() {
- defer reqs.Done()
- res, err := c.Get(st.ts.URL)
- if err != nil {
- t.Error(err)
- return
- }
- if _, err := ioutil.ReadAll(res.Body); err != nil {
- t.Error(err)
- return
- }
- res.Body.Close()
- }()
- }
- reqs.Wait()
- conns.Wait()
- t.Logf("did %d dials, %d requests", atomic.LoadInt32(&dials), N)
-}
-
-type noteCloseConn struct {
- net.Conn
- onceClose sync.Once
- closefn func()
-}
-
-func (c *noteCloseConn) Close() error {
- c.onceClose.Do(c.closefn)
- return c.Conn.Close()
-}
-
-func isTimeout(err error) bool {
- switch err := err.(type) {
- case nil:
- return false
- case *url.Error:
- return isTimeout(err.Err)
- case net.Error:
- return err.Timeout()
- }
- return false
-}
-
-// Test that the http1 Transport.ResponseHeaderTimeout option and cancel is sent.
-func TestTransportResponseHeaderTimeout_NoBody(t *testing.T) {
- testTransportResponseHeaderTimeout(t, false)
-}
-func TestTransportResponseHeaderTimeout_Body(t *testing.T) {
- testTransportResponseHeaderTimeout(t, true)
-}
-
-func testTransportResponseHeaderTimeout(t *testing.T, body bool) {
- ct := newClientTester(t)
- ct.tr.t1 = &http.Transport{
- ResponseHeaderTimeout: 5 * time.Millisecond,
- }
- ct.client = func() error {
- c := &http.Client{Transport: ct.tr}
- var err error
- var n int64
- const bodySize = 4 << 20
- if body {
- _, err = c.Post("https://dummy.tld/", "text/foo", io.LimitReader(countingReader{&n}, bodySize))
- } else {
- _, err = c.Get("https://dummy.tld/")
- }
- if !isTimeout(err) {
- t.Errorf("client expected timeout error; got %#v", err)
- }
- if body && n != bodySize {
- t.Errorf("only read %d bytes of body; want %d", n, bodySize)
- }
- return nil
- }
- ct.server = func() error {
- ct.greet()
- for {
- f, err := ct.fr.ReadFrame()
- if err != nil {
- t.Logf("ReadFrame: %v", err)
- return nil
- }
- switch f := f.(type) {
- case *DataFrame:
- dataLen := len(f.Data())
- if dataLen > 0 {
- if err := ct.fr.WriteWindowUpdate(0, uint32(dataLen)); err != nil {
- return err
- }
- if err := ct.fr.WriteWindowUpdate(f.StreamID, uint32(dataLen)); err != nil {
- return err
- }
- }
- case *RSTStreamFrame:
- if f.StreamID == 1 && f.ErrCode == ErrCodeCancel {
- return nil
- }
- }
- }
- }
- ct.run()
-}
-
-func TestTransportDisableCompression(t *testing.T) {
- const body = "sup"
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- want := http.Header{
- "User-Agent": []string{"Go-http-client/2.0"},
- }
- if !reflect.DeepEqual(r.Header, want) {
- t.Errorf("request headers = %v; want %v", r.Header, want)
- }
- }, optOnlyServer)
- defer st.Close()
-
- tr := &Transport{
- TLSClientConfig: tlsConfigInsecure,
- t1: &http.Transport{
- DisableCompression: true,
- },
- }
- defer tr.CloseIdleConnections()
-
- req, err := http.NewRequest("GET", st.ts.URL, nil)
- if err != nil {
- t.Fatal(err)
- }
- res, err := tr.RoundTrip(req)
- if err != nil {
- t.Fatal(err)
- }
- defer res.Body.Close()
-}
-
-// RFC 7540 section 8.1.2.2
-func TestTransportRejectsConnHeaders(t *testing.T) {
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- var got []string
- for k := range r.Header {
- got = append(got, k)
- }
- sort.Strings(got)
- w.Header().Set("Got-Header", strings.Join(got, ","))
- }, optOnlyServer)
- defer st.Close()
-
- tr := &Transport{TLSClientConfig: tlsConfigInsecure}
- defer tr.CloseIdleConnections()
-
- tests := []struct {
- key string
- value []string
- want string
- }{
- {
- key: "Upgrade",
- value: []string{"anything"},
- want: "ERROR: http2: invalid Upgrade request header: [\"anything\"]",
- },
- {
- key: "Connection",
- value: []string{"foo"},
- want: "ERROR: http2: invalid Connection request header: [\"foo\"]",
- },
- {
- key: "Connection",
- value: []string{"close"},
- want: "Accept-Encoding,User-Agent",
- },
- {
- key: "Connection",
- value: []string{"close", "something-else"},
- want: "ERROR: http2: invalid Connection request header: [\"close\" \"something-else\"]",
- },
- {
- key: "Connection",
- value: []string{"keep-alive"},
- want: "Accept-Encoding,User-Agent",
- },
- {
- key: "Proxy-Connection", // just deleted and ignored
- value: []string{"keep-alive"},
- want: "Accept-Encoding,User-Agent",
- },
- {
- key: "Transfer-Encoding",
- value: []string{""},
- want: "Accept-Encoding,User-Agent",
- },
- {
- key: "Transfer-Encoding",
- value: []string{"foo"},
- want: "ERROR: http2: invalid Transfer-Encoding request header: [\"foo\"]",
- },
- {
- key: "Transfer-Encoding",
- value: []string{"chunked"},
- want: "Accept-Encoding,User-Agent",
- },
- {
- key: "Transfer-Encoding",
- value: []string{"chunked", "other"},
- want: "ERROR: http2: invalid Transfer-Encoding request header: [\"chunked\" \"other\"]",
- },
- {
- key: "Content-Length",
- value: []string{"123"},
- want: "Accept-Encoding,User-Agent",
- },
- {
- key: "Keep-Alive",
- value: []string{"doop"},
- want: "Accept-Encoding,User-Agent",
- },
- }
-
- for _, tt := range tests {
- req, _ := http.NewRequest("GET", st.ts.URL, nil)
- req.Header[tt.key] = tt.value
- res, err := tr.RoundTrip(req)
- var got string
- if err != nil {
- got = fmt.Sprintf("ERROR: %v", err)
- } else {
- got = res.Header.Get("Got-Header")
- res.Body.Close()
- }
- if got != tt.want {
- t.Errorf("For key %q, value %q, got = %q; want %q", tt.key, tt.value, got, tt.want)
- }
- }
-}
-
-// golang.org/issue/14048
-func TestTransportFailsOnInvalidHeaders(t *testing.T) {
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- var got []string
- for k := range r.Header {
- got = append(got, k)
- }
- sort.Strings(got)
- w.Header().Set("Got-Header", strings.Join(got, ","))
- }, optOnlyServer)
- defer st.Close()
-
- tests := [...]struct {
- h http.Header
- wantErr string
- }{
- 0: {
- h: http.Header{"with space": {"foo"}},
- wantErr: `invalid HTTP header name "with space"`,
- },
- 1: {
- h: http.Header{"name": {"Брэд"}},
- wantErr: "", // okay
- },
- 2: {
- h: http.Header{"имя": {"Brad"}},
- wantErr: `invalid HTTP header name "имя"`,
- },
- 3: {
- h: http.Header{"foo": {"foo\x01bar"}},
- wantErr: `invalid HTTP header value "foo\x01bar" for header "foo"`,
- },
- }
-
- tr := &Transport{TLSClientConfig: tlsConfigInsecure}
- defer tr.CloseIdleConnections()
-
- for i, tt := range tests {
- req, _ := http.NewRequest("GET", st.ts.URL, nil)
- req.Header = tt.h
- res, err := tr.RoundTrip(req)
- var bad bool
- if tt.wantErr == "" {
- if err != nil {
- bad = true
- t.Errorf("case %d: error = %v; want no error", i, err)
- }
- } else {
- if !strings.Contains(fmt.Sprint(err), tt.wantErr) {
- bad = true
- t.Errorf("case %d: error = %v; want error %q", i, err, tt.wantErr)
- }
- }
- if err == nil {
- if bad {
- t.Logf("case %d: server got headers %q", i, res.Header.Get("Got-Header"))
- }
- res.Body.Close()
- }
- }
-}
-
-// Tests that gzipReader doesn't crash on a second Read call following
-// the first Read call's gzip.NewReader returning an error.
-func TestGzipReader_DoubleReadCrash(t *testing.T) {
- gz := &gzipReader{
- body: ioutil.NopCloser(strings.NewReader("0123456789")),
- }
- var buf [1]byte
- n, err1 := gz.Read(buf[:])
- if n != 0 || !strings.Contains(fmt.Sprint(err1), "invalid header") {
- t.Fatalf("Read = %v, %v; want 0, invalid header", n, err1)
- }
- n, err2 := gz.Read(buf[:])
- if n != 0 || err2 != err1 {
- t.Fatalf("second Read = %v, %v; want 0, %v", n, err2, err1)
- }
-}
-
-func TestTransportNewTLSConfig(t *testing.T) {
- tests := [...]struct {
- conf *tls.Config
- host string
- want *tls.Config
- }{
- // Normal case.
- 0: {
- conf: nil,
- host: "foo.com",
- want: &tls.Config{
- ServerName: "foo.com",
- NextProtos: []string{NextProtoTLS},
- },
- },
-
- // User-provided name (bar.com) takes precedence:
- 1: {
- conf: &tls.Config{
- ServerName: "bar.com",
- },
- host: "foo.com",
- want: &tls.Config{
- ServerName: "bar.com",
- NextProtos: []string{NextProtoTLS},
- },
- },
-
- // NextProto is prepended:
- 2: {
- conf: &tls.Config{
- NextProtos: []string{"foo", "bar"},
- },
- host: "example.com",
- want: &tls.Config{
- ServerName: "example.com",
- NextProtos: []string{NextProtoTLS, "foo", "bar"},
- },
- },
-
- // NextProto is not duplicated:
- 3: {
- conf: &tls.Config{
- NextProtos: []string{"foo", "bar", NextProtoTLS},
- },
- host: "example.com",
- want: &tls.Config{
- ServerName: "example.com",
- NextProtos: []string{"foo", "bar", NextProtoTLS},
- },
- },
- }
- for i, tt := range tests {
- // Ignore the session ticket keys part, which ends up populating
- // unexported fields in the Config:
- if tt.conf != nil {
- tt.conf.SessionTicketsDisabled = true
- }
-
- tr := &Transport{TLSClientConfig: tt.conf}
- got := tr.newTLSConfig(tt.host)
-
- got.SessionTicketsDisabled = false
-
- if !reflect.DeepEqual(got, tt.want) {
- t.Errorf("%d. got %#v; want %#v", i, got, tt.want)
- }
- }
-}
-
-// The Google GFE responds to HEAD requests with a HEADERS frame
-// without END_STREAM, followed by a 0-length DATA frame with
-// END_STREAM. Make sure we don't get confused by that. (We did.)
-func TestTransportReadHeadResponse(t *testing.T) {
- ct := newClientTester(t)
- clientDone := make(chan struct{})
- ct.client = func() error {
- defer close(clientDone)
- req, _ := http.NewRequest("HEAD", "https://dummy.tld/", nil)
- res, err := ct.tr.RoundTrip(req)
- if err != nil {
- return err
- }
- if res.ContentLength != 123 {
- return fmt.Errorf("Content-Length = %d; want 123", res.ContentLength)
- }
- slurp, err := ioutil.ReadAll(res.Body)
- if err != nil {
- return fmt.Errorf("ReadAll: %v", err)
- }
- if len(slurp) > 0 {
- return fmt.Errorf("Unexpected non-empty ReadAll body: %q", slurp)
- }
- return nil
- }
- ct.server = func() error {
- ct.greet()
- for {
- f, err := ct.fr.ReadFrame()
- if err != nil {
- t.Logf("ReadFrame: %v", err)
- return nil
- }
- hf, ok := f.(*HeadersFrame)
- if !ok {
- continue
- }
- var buf bytes.Buffer
- enc := hpack.NewEncoder(&buf)
- enc.WriteField(hpack.HeaderField{Name: ":status", Value: "200"})
- enc.WriteField(hpack.HeaderField{Name: "content-length", Value: "123"})
- ct.fr.WriteHeaders(HeadersFrameParam{
- StreamID: hf.StreamID,
- EndHeaders: true,
- EndStream: false, // as the GFE does
- BlockFragment: buf.Bytes(),
- })
- ct.fr.WriteData(hf.StreamID, true, nil)
-
- <-clientDone
- return nil
- }
- }
- ct.run()
-}
-
-func TestTransportReadHeadResponseWithBody(t *testing.T) {
- // This test use not valid response format.
- // Discarding logger output to not spam tests output.
- log.SetOutput(ioutil.Discard)
- defer log.SetOutput(os.Stderr)
-
- response := "redirecting to /elsewhere"
- ct := newClientTester(t)
- clientDone := make(chan struct{})
- ct.client = func() error {
- defer close(clientDone)
- req, _ := http.NewRequest("HEAD", "https://dummy.tld/", nil)
- res, err := ct.tr.RoundTrip(req)
- if err != nil {
- return err
- }
- if res.ContentLength != int64(len(response)) {
- return fmt.Errorf("Content-Length = %d; want %d", res.ContentLength, len(response))
- }
- slurp, err := ioutil.ReadAll(res.Body)
- if err != nil {
- return fmt.Errorf("ReadAll: %v", err)
- }
- if len(slurp) > 0 {
- return fmt.Errorf("Unexpected non-empty ReadAll body: %q", slurp)
- }
- return nil
- }
- ct.server = func() error {
- ct.greet()
- for {
- f, err := ct.fr.ReadFrame()
- if err != nil {
- t.Logf("ReadFrame: %v", err)
- return nil
- }
- hf, ok := f.(*HeadersFrame)
- if !ok {
- continue
- }
- var buf bytes.Buffer
- enc := hpack.NewEncoder(&buf)
- enc.WriteField(hpack.HeaderField{Name: ":status", Value: "200"})
- enc.WriteField(hpack.HeaderField{Name: "content-length", Value: strconv.Itoa(len(response))})
- ct.fr.WriteHeaders(HeadersFrameParam{
- StreamID: hf.StreamID,
- EndHeaders: true,
- EndStream: false,
- BlockFragment: buf.Bytes(),
- })
- ct.fr.WriteData(hf.StreamID, true, []byte(response))
-
- <-clientDone
- return nil
- }
- }
- ct.run()
-}
-
-type neverEnding byte
-
-func (b neverEnding) Read(p []byte) (int, error) {
- for i := range p {
- p[i] = byte(b)
- }
- return len(p), nil
-}
-
-// golang.org/issue/15425: test that a handler closing the request
-// body doesn't terminate the stream to the peer. (It just stops
-// readability from the handler's side, and eventually the client
-// runs out of flow control tokens)
-func TestTransportHandlerBodyClose(t *testing.T) {
- const bodySize = 10 << 20
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- r.Body.Close()
- io.Copy(w, io.LimitReader(neverEnding('A'), bodySize))
- }, optOnlyServer)
- defer st.Close()
-
- tr := &Transport{TLSClientConfig: tlsConfigInsecure}
- defer tr.CloseIdleConnections()
-
- g0 := runtime.NumGoroutine()
-
- const numReq = 10
- for i := 0; i < numReq; i++ {
- req, err := http.NewRequest("POST", st.ts.URL, struct{ io.Reader }{io.LimitReader(neverEnding('A'), bodySize)})
- if err != nil {
- t.Fatal(err)
- }
- res, err := tr.RoundTrip(req)
- if err != nil {
- t.Fatal(err)
- }
- n, err := io.Copy(ioutil.Discard, res.Body)
- res.Body.Close()
- if n != bodySize || err != nil {
- t.Fatalf("req#%d: Copy = %d, %v; want %d, nil", i, n, err, bodySize)
- }
- }
- tr.CloseIdleConnections()
-
- if !waitCondition(5*time.Second, 100*time.Millisecond, func() bool {
- gd := runtime.NumGoroutine() - g0
- return gd < numReq/2
- }) {
- t.Errorf("appeared to leak goroutines")
- }
-}
-
-// https://golang.org/issue/15930
-func TestTransportFlowControl(t *testing.T) {
- const bufLen = 64 << 10
- var total int64 = 100 << 20 // 100MB
- if testing.Short() {
- total = 10 << 20
- }
-
- var wrote int64 // updated atomically
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- b := make([]byte, bufLen)
- for wrote < total {
- n, err := w.Write(b)
- atomic.AddInt64(&wrote, int64(n))
- if err != nil {
- t.Errorf("ResponseWriter.Write error: %v", err)
- break
- }
- w.(http.Flusher).Flush()
- }
- }, optOnlyServer)
-
- tr := &Transport{TLSClientConfig: tlsConfigInsecure}
- defer tr.CloseIdleConnections()
- req, err := http.NewRequest("GET", st.ts.URL, nil)
- if err != nil {
- t.Fatal("NewRequest error:", err)
- }
- resp, err := tr.RoundTrip(req)
- if err != nil {
- t.Fatal("RoundTrip error:", err)
- }
- defer resp.Body.Close()
-
- var read int64
- b := make([]byte, bufLen)
- for {
- n, err := resp.Body.Read(b)
- if err == io.EOF {
- break
- }
- if err != nil {
- t.Fatal("Read error:", err)
- }
- read += int64(n)
-
- const max = transportDefaultStreamFlow
- if w := atomic.LoadInt64(&wrote); -max > read-w || read-w > max {
- t.Fatalf("Too much data inflight: server wrote %v bytes but client only received %v", w, read)
- }
-
- // Let the server get ahead of the client.
- time.Sleep(1 * time.Millisecond)
- }
-}
-
-// golang.org/issue/14627 -- if the server sends a GOAWAY frame, make
-// the Transport remember it and return it back to users (via
-// RoundTrip or request body reads) if needed (e.g. if the server
-// proceeds to close the TCP connection before the client gets its
-// response)
-func TestTransportUsesGoAwayDebugError_RoundTrip(t *testing.T) {
- testTransportUsesGoAwayDebugError(t, false)
-}
-
-func TestTransportUsesGoAwayDebugError_Body(t *testing.T) {
- testTransportUsesGoAwayDebugError(t, true)
-}
-
-func testTransportUsesGoAwayDebugError(t *testing.T, failMidBody bool) {
- ct := newClientTester(t)
- clientDone := make(chan struct{})
-
- const goAwayErrCode = ErrCodeHTTP11Required // arbitrary
- const goAwayDebugData = "some debug data"
-
- ct.client = func() error {
- defer close(clientDone)
- req, _ := http.NewRequest("GET", "https://dummy.tld/", nil)
- res, err := ct.tr.RoundTrip(req)
- if failMidBody {
- if err != nil {
- return fmt.Errorf("unexpected client RoundTrip error: %v", err)
- }
- _, err = io.Copy(ioutil.Discard, res.Body)
- res.Body.Close()
- }
- want := GoAwayError{
- LastStreamID: 5,
- ErrCode: goAwayErrCode,
- DebugData: goAwayDebugData,
- }
- if !reflect.DeepEqual(err, want) {
- t.Errorf("RoundTrip error = %T: %#v, want %T (%#v)", err, err, want, want)
- }
- return nil
- }
- ct.server = func() error {
- ct.greet()
- for {
- f, err := ct.fr.ReadFrame()
- if err != nil {
- t.Logf("ReadFrame: %v", err)
- return nil
- }
- hf, ok := f.(*HeadersFrame)
- if !ok {
- continue
- }
- if failMidBody {
- var buf bytes.Buffer
- enc := hpack.NewEncoder(&buf)
- enc.WriteField(hpack.HeaderField{Name: ":status", Value: "200"})
- enc.WriteField(hpack.HeaderField{Name: "content-length", Value: "123"})
- ct.fr.WriteHeaders(HeadersFrameParam{
- StreamID: hf.StreamID,
- EndHeaders: true,
- EndStream: false,
- BlockFragment: buf.Bytes(),
- })
- }
- // Write two GOAWAY frames, to test that the Transport takes
- // the interesting parts of both.
- ct.fr.WriteGoAway(5, ErrCodeNo, []byte(goAwayDebugData))
- ct.fr.WriteGoAway(5, goAwayErrCode, nil)
- ct.sc.(*net.TCPConn).CloseWrite()
- <-clientDone
- return nil
- }
- }
- ct.run()
-}
-
-func testTransportReturnsUnusedFlowControl(t *testing.T, oneDataFrame bool) {
- ct := newClientTester(t)
-
- clientClosed := make(chan struct{})
- serverWroteFirstByte := make(chan struct{})
-
- ct.client = func() error {
- req, _ := http.NewRequest("GET", "https://dummy.tld/", nil)
- res, err := ct.tr.RoundTrip(req)
- if err != nil {
- return err
- }
- <-serverWroteFirstByte
-
- if n, err := res.Body.Read(make([]byte, 1)); err != nil || n != 1 {
- return fmt.Errorf("body read = %v, %v; want 1, nil", n, err)
- }
- res.Body.Close() // leaving 4999 bytes unread
- close(clientClosed)
-
- return nil
- }
- ct.server = func() error {
- ct.greet()
-
- var hf *HeadersFrame
- for {
- f, err := ct.fr.ReadFrame()
- if err != nil {
- return fmt.Errorf("ReadFrame while waiting for Headers: %v", err)
- }
- switch f.(type) {
- case *WindowUpdateFrame, *SettingsFrame:
- continue
- }
- var ok bool
- hf, ok = f.(*HeadersFrame)
- if !ok {
- return fmt.Errorf("Got %T; want HeadersFrame", f)
- }
- break
- }
-
- var buf bytes.Buffer
- enc := hpack.NewEncoder(&buf)
- enc.WriteField(hpack.HeaderField{Name: ":status", Value: "200"})
- enc.WriteField(hpack.HeaderField{Name: "content-length", Value: "5000"})
- ct.fr.WriteHeaders(HeadersFrameParam{
- StreamID: hf.StreamID,
- EndHeaders: true,
- EndStream: false,
- BlockFragment: buf.Bytes(),
- })
-
- // Two cases:
- // - Send one DATA frame with 5000 bytes.
- // - Send two DATA frames with 1 and 4999 bytes each.
- //
- // In both cases, the client should consume one byte of data,
- // refund that byte, then refund the following 4999 bytes.
- //
- // In the second case, the server waits for the client connection to
- // close before seconding the second DATA frame. This tests the case
- // where the client receives a DATA frame after it has reset the stream.
- if oneDataFrame {
- ct.fr.WriteData(hf.StreamID, false /* don't end stream */, make([]byte, 5000))
- close(serverWroteFirstByte)
- <-clientClosed
- } else {
- ct.fr.WriteData(hf.StreamID, false /* don't end stream */, make([]byte, 1))
- close(serverWroteFirstByte)
- <-clientClosed
- ct.fr.WriteData(hf.StreamID, false /* don't end stream */, make([]byte, 4999))
- }
-
- waitingFor := "RSTStreamFrame"
- for {
- f, err := ct.fr.ReadFrame()
- if err != nil {
- return fmt.Errorf("ReadFrame while waiting for %s: %v", waitingFor, err)
- }
- if _, ok := f.(*SettingsFrame); ok {
- continue
- }
- switch waitingFor {
- case "RSTStreamFrame":
- if rf, ok := f.(*RSTStreamFrame); !ok || rf.ErrCode != ErrCodeCancel {
- return fmt.Errorf("Expected a RSTStreamFrame with code cancel; got %v", summarizeFrame(f))
- }
- waitingFor = "WindowUpdateFrame"
- case "WindowUpdateFrame":
- if wuf, ok := f.(*WindowUpdateFrame); !ok || wuf.Increment != 4999 {
- return fmt.Errorf("Expected WindowUpdateFrame for 4999 bytes; got %v", summarizeFrame(f))
- }
- return nil
- }
- }
- }
- ct.run()
-}
-
-// See golang.org/issue/16481
-func TestTransportReturnsUnusedFlowControlSingleWrite(t *testing.T) {
- testTransportReturnsUnusedFlowControl(t, true)
-}
-
-// See golang.org/issue/20469
-func TestTransportReturnsUnusedFlowControlMultipleWrites(t *testing.T) {
- testTransportReturnsUnusedFlowControl(t, false)
-}
-
-// Issue 16612: adjust flow control on open streams when transport
-// receives SETTINGS with INITIAL_WINDOW_SIZE from server.
-func TestTransportAdjustsFlowControl(t *testing.T) {
- ct := newClientTester(t)
- clientDone := make(chan struct{})
-
- const bodySize = 1 << 20
-
- ct.client = func() error {
- defer ct.cc.(*net.TCPConn).CloseWrite()
- defer close(clientDone)
-
- req, _ := http.NewRequest("POST", "https://dummy.tld/", struct{ io.Reader }{io.LimitReader(neverEnding('A'), bodySize)})
- res, err := ct.tr.RoundTrip(req)
- if err != nil {
- return err
- }
- res.Body.Close()
- return nil
- }
- ct.server = func() error {
- _, err := io.ReadFull(ct.sc, make([]byte, len(ClientPreface)))
- if err != nil {
- return fmt.Errorf("reading client preface: %v", err)
- }
-
- var gotBytes int64
- var sentSettings bool
- for {
- f, err := ct.fr.ReadFrame()
- if err != nil {
- select {
- case <-clientDone:
- return nil
- default:
- return fmt.Errorf("ReadFrame while waiting for Headers: %v", err)
- }
- }
- switch f := f.(type) {
- case *DataFrame:
- gotBytes += int64(len(f.Data()))
- // After we've got half the client's
- // initial flow control window's worth
- // of request body data, give it just
- // enough flow control to finish.
- if gotBytes >= initialWindowSize/2 && !sentSettings {
- sentSettings = true
-
- ct.fr.WriteSettings(Setting{ID: SettingInitialWindowSize, Val: bodySize})
- ct.fr.WriteWindowUpdate(0, bodySize)
- ct.fr.WriteSettingsAck()
- }
-
- if f.StreamEnded() {
- var buf bytes.Buffer
- enc := hpack.NewEncoder(&buf)
- enc.WriteField(hpack.HeaderField{Name: ":status", Value: "200"})
- ct.fr.WriteHeaders(HeadersFrameParam{
- StreamID: f.StreamID,
- EndHeaders: true,
- EndStream: true,
- BlockFragment: buf.Bytes(),
- })
- }
- }
- }
- }
- ct.run()
-}
-
-// See golang.org/issue/16556
-func TestTransportReturnsDataPaddingFlowControl(t *testing.T) {
- ct := newClientTester(t)
-
- unblockClient := make(chan bool, 1)
-
- ct.client = func() error {
- req, _ := http.NewRequest("GET", "https://dummy.tld/", nil)
- res, err := ct.tr.RoundTrip(req)
- if err != nil {
- return err
- }
- defer res.Body.Close()
- <-unblockClient
- return nil
- }
- ct.server = func() error {
- ct.greet()
-
- var hf *HeadersFrame
- for {
- f, err := ct.fr.ReadFrame()
- if err != nil {
- return fmt.Errorf("ReadFrame while waiting for Headers: %v", err)
- }
- switch f.(type) {
- case *WindowUpdateFrame, *SettingsFrame:
- continue
- }
- var ok bool
- hf, ok = f.(*HeadersFrame)
- if !ok {
- return fmt.Errorf("Got %T; want HeadersFrame", f)
- }
- break
- }
-
- var buf bytes.Buffer
- enc := hpack.NewEncoder(&buf)
- enc.WriteField(hpack.HeaderField{Name: ":status", Value: "200"})
- enc.WriteField(hpack.HeaderField{Name: "content-length", Value: "5000"})
- ct.fr.WriteHeaders(HeadersFrameParam{
- StreamID: hf.StreamID,
- EndHeaders: true,
- EndStream: false,
- BlockFragment: buf.Bytes(),
- })
- pad := make([]byte, 5)
- ct.fr.WriteDataPadded(hf.StreamID, false, make([]byte, 5000), pad) // without ending stream
-
- f, err := ct.readNonSettingsFrame()
- if err != nil {
- return fmt.Errorf("ReadFrame while waiting for first WindowUpdateFrame: %v", err)
- }
- wantBack := uint32(len(pad)) + 1 // one byte for the length of the padding
- if wuf, ok := f.(*WindowUpdateFrame); !ok || wuf.Increment != wantBack || wuf.StreamID != 0 {
- return fmt.Errorf("Expected conn WindowUpdateFrame for %d bytes; got %v", wantBack, summarizeFrame(f))
- }
-
- f, err = ct.readNonSettingsFrame()
- if err != nil {
- return fmt.Errorf("ReadFrame while waiting for second WindowUpdateFrame: %v", err)
- }
- if wuf, ok := f.(*WindowUpdateFrame); !ok || wuf.Increment != wantBack || wuf.StreamID == 0 {
- return fmt.Errorf("Expected stream WindowUpdateFrame for %d bytes; got %v", wantBack, summarizeFrame(f))
- }
- unblockClient <- true
- return nil
- }
- ct.run()
-}
-
-// golang.org/issue/16572 -- RoundTrip shouldn't hang when it gets a
-// StreamError as a result of the response HEADERS
-func TestTransportReturnsErrorOnBadResponseHeaders(t *testing.T) {
- ct := newClientTester(t)
-
- ct.client = func() error {
- req, _ := http.NewRequest("GET", "https://dummy.tld/", nil)
- res, err := ct.tr.RoundTrip(req)
- if err == nil {
- res.Body.Close()
- return errors.New("unexpected successful GET")
- }
- want := StreamError{1, ErrCodeProtocol, headerFieldNameError(" content-type")}
- if !reflect.DeepEqual(want, err) {
- t.Errorf("RoundTrip error = %#v; want %#v", err, want)
- }
- return nil
- }
- ct.server = func() error {
- ct.greet()
-
- hf, err := ct.firstHeaders()
- if err != nil {
- return err
- }
-
- var buf bytes.Buffer
- enc := hpack.NewEncoder(&buf)
- enc.WriteField(hpack.HeaderField{Name: ":status", Value: "200"})
- enc.WriteField(hpack.HeaderField{Name: " content-type", Value: "bogus"}) // bogus spaces
- ct.fr.WriteHeaders(HeadersFrameParam{
- StreamID: hf.StreamID,
- EndHeaders: true,
- EndStream: false,
- BlockFragment: buf.Bytes(),
- })
-
- for {
- fr, err := ct.readFrame()
- if err != nil {
- return fmt.Errorf("error waiting for RST_STREAM from client: %v", err)
- }
- if _, ok := fr.(*SettingsFrame); ok {
- continue
- }
- if rst, ok := fr.(*RSTStreamFrame); !ok || rst.StreamID != 1 || rst.ErrCode != ErrCodeProtocol {
- t.Errorf("Frame = %v; want RST_STREAM for stream 1 with ErrCodeProtocol", summarizeFrame(fr))
- }
- break
- }
-
- return nil
- }
- ct.run()
-}
-
-// byteAndEOFReader returns is in an io.Reader which reads one byte
-// (the underlying byte) and io.EOF at once in its Read call.
-type byteAndEOFReader byte
-
-func (b byteAndEOFReader) Read(p []byte) (n int, err error) {
- if len(p) == 0 {
- panic("unexpected useless call")
- }
- p[0] = byte(b)
- return 1, io.EOF
-}
-
-// Issue 16788: the Transport had a regression where it started
-// sending a spurious DATA frame with a duplicate END_STREAM bit after
-// the request body writer goroutine had already read an EOF from the
-// Request.Body and included the END_STREAM on a data-carrying DATA
-// frame.
-//
-// Notably, to trigger this, the requests need to use a Request.Body
-// which returns (non-0, io.EOF) and also needs to set the ContentLength
-// explicitly.
-func TestTransportBodyDoubleEndStream(t *testing.T) {
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- // Nothing.
- }, optOnlyServer)
- defer st.Close()
-
- tr := &Transport{TLSClientConfig: tlsConfigInsecure}
- defer tr.CloseIdleConnections()
-
- for i := 0; i < 2; i++ {
- req, _ := http.NewRequest("POST", st.ts.URL, byteAndEOFReader('a'))
- req.ContentLength = 1
- res, err := tr.RoundTrip(req)
- if err != nil {
- t.Fatalf("failure on req %d: %v", i+1, err)
- }
- defer res.Body.Close()
- }
-}
-
-// golang.org/issue/16847, golang.org/issue/19103
-func TestTransportRequestPathPseudo(t *testing.T) {
- type result struct {
- path string
- err string
- }
- tests := []struct {
- req *http.Request
- want result
- }{
- 0: {
- req: &http.Request{
- Method: "GET",
- URL: &url.URL{
- Host: "foo.com",
- Path: "/foo",
- },
- },
- want: result{path: "/foo"},
- },
- // In Go 1.7, we accepted paths of "//foo".
- // In Go 1.8, we rejected it (issue 16847).
- // In Go 1.9, we accepted it again (issue 19103).
- 1: {
- req: &http.Request{
- Method: "GET",
- URL: &url.URL{
- Host: "foo.com",
- Path: "//foo",
- },
- },
- want: result{path: "//foo"},
- },
-
- // Opaque with //$Matching_Hostname/path
- 2: {
- req: &http.Request{
- Method: "GET",
- URL: &url.URL{
- Scheme: "https",
- Opaque: "//foo.com/path",
- Host: "foo.com",
- Path: "/ignored",
- },
- },
- want: result{path: "/path"},
- },
-
- // Opaque with some other Request.Host instead:
- 3: {
- req: &http.Request{
- Method: "GET",
- Host: "bar.com",
- URL: &url.URL{
- Scheme: "https",
- Opaque: "//bar.com/path",
- Host: "foo.com",
- Path: "/ignored",
- },
- },
- want: result{path: "/path"},
- },
-
- // Opaque without the leading "//":
- 4: {
- req: &http.Request{
- Method: "GET",
- URL: &url.URL{
- Opaque: "/path",
- Host: "foo.com",
- Path: "/ignored",
- },
- },
- want: result{path: "/path"},
- },
-
- // Opaque we can't handle:
- 5: {
- req: &http.Request{
- Method: "GET",
- URL: &url.URL{
- Scheme: "https",
- Opaque: "//unknown_host/path",
- Host: "foo.com",
- Path: "/ignored",
- },
- },
- want: result{err: `invalid request :path "https://unknown_host/path" from URL.Opaque = "//unknown_host/path"`},
- },
-
- // A CONNECT request:
- 6: {
- req: &http.Request{
- Method: "CONNECT",
- URL: &url.URL{
- Host: "foo.com",
- },
- },
- want: result{},
- },
- }
- for i, tt := range tests {
- cc := &ClientConn{peerMaxHeaderListSize: 0xffffffffffffffff}
- cc.henc = hpack.NewEncoder(&cc.hbuf)
- cc.mu.Lock()
- hdrs, err := cc.encodeHeaders(tt.req, false, "", -1)
- cc.mu.Unlock()
- var got result
- hpackDec := hpack.NewDecoder(initialHeaderTableSize, func(f hpack.HeaderField) {
- if f.Name == ":path" {
- got.path = f.Value
- }
- })
- if err != nil {
- got.err = err.Error()
- } else if len(hdrs) > 0 {
- if _, err := hpackDec.Write(hdrs); err != nil {
- t.Errorf("%d. bogus hpack: %v", i, err)
- continue
- }
- }
- if got != tt.want {
- t.Errorf("%d. got %+v; want %+v", i, got, tt.want)
- }
-
- }
-
-}
-
-// golang.org/issue/17071 -- don't sniff the first byte of the request body
-// before we've determined that the ClientConn is usable.
-func TestRoundTripDoesntConsumeRequestBodyEarly(t *testing.T) {
- const body = "foo"
- req, _ := http.NewRequest("POST", "http://foo.com/", ioutil.NopCloser(strings.NewReader(body)))
- cc := &ClientConn{
- closed: true,
- }
- _, err := cc.RoundTrip(req)
- if err != errClientConnUnusable {
- t.Fatalf("RoundTrip = %v; want errClientConnUnusable", err)
- }
- slurp, err := ioutil.ReadAll(req.Body)
- if err != nil {
- t.Errorf("ReadAll = %v", err)
- }
- if string(slurp) != body {
- t.Errorf("Body = %q; want %q", slurp, body)
- }
-}
-
-func TestClientConnPing(t *testing.T) {
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {}, optOnlyServer)
- defer st.Close()
- tr := &Transport{TLSClientConfig: tlsConfigInsecure}
- defer tr.CloseIdleConnections()
- cc, err := tr.dialClientConn(st.ts.Listener.Addr().String(), false)
- if err != nil {
- t.Fatal(err)
- }
- if err = cc.Ping(testContext{}); err != nil {
- t.Fatal(err)
- }
-}
-
-// Issue 16974: if the server sent a DATA frame after the user
-// canceled the Transport's Request, the Transport previously wrote to a
-// closed pipe, got an error, and ended up closing the whole TCP
-// connection.
-func TestTransportCancelDataResponseRace(t *testing.T) {
- cancel := make(chan struct{})
- clientGotError := make(chan bool, 1)
-
- const msg = "Hello."
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- if strings.Contains(r.URL.Path, "/hello") {
- time.Sleep(50 * time.Millisecond)
- io.WriteString(w, msg)
- return
- }
- for i := 0; i < 50; i++ {
- io.WriteString(w, "Some data.")
- w.(http.Flusher).Flush()
- if i == 2 {
- close(cancel)
- <-clientGotError
- }
- time.Sleep(10 * time.Millisecond)
- }
- }, optOnlyServer)
- defer st.Close()
-
- tr := &Transport{TLSClientConfig: tlsConfigInsecure}
- defer tr.CloseIdleConnections()
-
- c := &http.Client{Transport: tr}
- req, _ := http.NewRequest("GET", st.ts.URL, nil)
- req.Cancel = cancel
- res, err := c.Do(req)
- if err != nil {
- t.Fatal(err)
- }
- if _, err = io.Copy(ioutil.Discard, res.Body); err == nil {
- t.Fatal("unexpected success")
- }
- clientGotError <- true
-
- res, err = c.Get(st.ts.URL + "/hello")
- if err != nil {
- t.Fatal(err)
- }
- slurp, err := ioutil.ReadAll(res.Body)
- if err != nil {
- t.Fatal(err)
- }
- if string(slurp) != msg {
- t.Errorf("Got = %q; want %q", slurp, msg)
- }
-}
-
-// Issue 21316: It should be safe to reuse an http.Request after the
-// request has completed.
-func TestTransportNoRaceOnRequestObjectAfterRequestComplete(t *testing.T) {
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- w.WriteHeader(200)
- io.WriteString(w, "body")
- }, optOnlyServer)
- defer st.Close()
-
- tr := &Transport{TLSClientConfig: tlsConfigInsecure}
- defer tr.CloseIdleConnections()
-
- req, _ := http.NewRequest("GET", st.ts.URL, nil)
- resp, err := tr.RoundTrip(req)
- if err != nil {
- t.Fatal(err)
- }
- if _, err = io.Copy(ioutil.Discard, resp.Body); err != nil {
- t.Fatalf("error reading response body: %v", err)
- }
- if err := resp.Body.Close(); err != nil {
- t.Fatalf("error closing response body: %v", err)
- }
-
- // This access of req.Header should not race with code in the transport.
- req.Header = http.Header{}
-}
-
-func TestTransportRetryAfterGOAWAY(t *testing.T) {
- var dialer struct {
- sync.Mutex
- count int
- }
- ct1 := make(chan *clientTester)
- ct2 := make(chan *clientTester)
-
- ln := newLocalListener(t)
- defer ln.Close()
-
- tr := &Transport{
- TLSClientConfig: tlsConfigInsecure,
- }
- tr.DialTLS = func(network, addr string, cfg *tls.Config) (net.Conn, error) {
- dialer.Lock()
- defer dialer.Unlock()
- dialer.count++
- if dialer.count == 3 {
- return nil, errors.New("unexpected number of dials")
- }
- cc, err := net.Dial("tcp", ln.Addr().String())
- if err != nil {
- return nil, fmt.Errorf("dial error: %v", err)
- }
- sc, err := ln.Accept()
- if err != nil {
- return nil, fmt.Errorf("accept error: %v", err)
- }
- ct := &clientTester{
- t: t,
- tr: tr,
- cc: cc,
- sc: sc,
- fr: NewFramer(sc, sc),
- }
- switch dialer.count {
- case 1:
- ct1 <- ct
- case 2:
- ct2 <- ct
- }
- return cc, nil
- }
-
- errs := make(chan error, 3)
- done := make(chan struct{})
- defer close(done)
-
- // Client.
- go func() {
- req, _ := http.NewRequest("GET", "https://dummy.tld/", nil)
- res, err := tr.RoundTrip(req)
- if res != nil {
- res.Body.Close()
- if got := res.Header.Get("Foo"); got != "bar" {
- err = fmt.Errorf("foo header = %q; want bar", got)
- }
- }
- if err != nil {
- err = fmt.Errorf("RoundTrip: %v", err)
- }
- errs <- err
- }()
-
- connToClose := make(chan io.Closer, 2)
-
- // Server for the first request.
- go func() {
- var ct *clientTester
- select {
- case ct = <-ct1:
- case <-done:
- return
- }
-
- connToClose <- ct.cc
- ct.greet()
- hf, err := ct.firstHeaders()
- if err != nil {
- errs <- fmt.Errorf("server1 failed reading HEADERS: %v", err)
- return
- }
- t.Logf("server1 got %v", hf)
- if err := ct.fr.WriteGoAway(0 /*max id*/, ErrCodeNo, nil); err != nil {
- errs <- fmt.Errorf("server1 failed writing GOAWAY: %v", err)
- return
- }
- errs <- nil
- }()
-
- // Server for the second request.
- go func() {
- var ct *clientTester
- select {
- case ct = <-ct2:
- case <-done:
- return
- }
-
- connToClose <- ct.cc
- ct.greet()
- hf, err := ct.firstHeaders()
- if err != nil {
- errs <- fmt.Errorf("server2 failed reading HEADERS: %v", err)
- return
- }
- t.Logf("server2 got %v", hf)
-
- var buf bytes.Buffer
- enc := hpack.NewEncoder(&buf)
- enc.WriteField(hpack.HeaderField{Name: ":status", Value: "200"})
- enc.WriteField(hpack.HeaderField{Name: "foo", Value: "bar"})
- err = ct.fr.WriteHeaders(HeadersFrameParam{
- StreamID: hf.StreamID,
- EndHeaders: true,
- EndStream: false,
- BlockFragment: buf.Bytes(),
- })
- if err != nil {
- errs <- fmt.Errorf("server2 failed writing response HEADERS: %v", err)
- } else {
- errs <- nil
- }
- }()
-
- for k := 0; k < 3; k++ {
- select {
- case err := <-errs:
- if err != nil {
- t.Error(err)
- }
- case <-time.After(1 * time.Second):
- t.Errorf("timed out")
- }
- }
-
- for {
- select {
- case c := <-connToClose:
- c.Close()
- default:
- return
- }
- }
-}
-
-func TestTransportRetryAfterRefusedStream(t *testing.T) {
- clientDone := make(chan struct{})
- ct := newClientTester(t)
- ct.client = func() error {
- defer ct.cc.(*net.TCPConn).CloseWrite()
- defer close(clientDone)
- req, _ := http.NewRequest("GET", "https://dummy.tld/", nil)
- resp, err := ct.tr.RoundTrip(req)
- if err != nil {
- return fmt.Errorf("RoundTrip: %v", err)
- }
- resp.Body.Close()
- if resp.StatusCode != 204 {
- return fmt.Errorf("Status = %v; want 204", resp.StatusCode)
- }
- return nil
- }
- ct.server = func() error {
- ct.greet()
- var buf bytes.Buffer
- enc := hpack.NewEncoder(&buf)
- nreq := 0
-
- for {
- f, err := ct.fr.ReadFrame()
- if err != nil {
- select {
- case <-clientDone:
- // If the client's done, it
- // will have reported any
- // errors on its side.
- return nil
- default:
- return err
- }
- }
- switch f := f.(type) {
- case *WindowUpdateFrame, *SettingsFrame:
- case *HeadersFrame:
- if !f.HeadersEnded() {
- return fmt.Errorf("headers should have END_HEADERS be ended: %v", f)
- }
- nreq++
- if nreq == 1 {
- ct.fr.WriteRSTStream(f.StreamID, ErrCodeRefusedStream)
- } else {
- enc.WriteField(hpack.HeaderField{Name: ":status", Value: "204"})
- ct.fr.WriteHeaders(HeadersFrameParam{
- StreamID: f.StreamID,
- EndHeaders: true,
- EndStream: true,
- BlockFragment: buf.Bytes(),
- })
- }
- default:
- return fmt.Errorf("Unexpected client frame %v", f)
- }
- }
- }
- ct.run()
-}
-
-func TestTransportRetryHasLimit(t *testing.T) {
- // Skip in short mode because the total expected delay is 1s+2s+4s+8s+16s=29s.
- if testing.Short() {
- t.Skip("skipping long test in short mode")
- }
- clientDone := make(chan struct{})
- ct := newClientTester(t)
- ct.client = func() error {
- defer ct.cc.(*net.TCPConn).CloseWrite()
- defer close(clientDone)
- req, _ := http.NewRequest("GET", "https://dummy.tld/", nil)
- resp, err := ct.tr.RoundTrip(req)
- if err == nil {
- return fmt.Errorf("RoundTrip expected error, got response: %+v", resp)
- }
- t.Logf("expected error, got: %v", err)
- return nil
- }
- ct.server = func() error {
- ct.greet()
- for {
- f, err := ct.fr.ReadFrame()
- if err != nil {
- select {
- case <-clientDone:
- // If the client's done, it
- // will have reported any
- // errors on its side.
- return nil
- default:
- return err
- }
- }
- switch f := f.(type) {
- case *WindowUpdateFrame, *SettingsFrame:
- case *HeadersFrame:
- if !f.HeadersEnded() {
- return fmt.Errorf("headers should have END_HEADERS be ended: %v", f)
- }
- ct.fr.WriteRSTStream(f.StreamID, ErrCodeRefusedStream)
- default:
- return fmt.Errorf("Unexpected client frame %v", f)
- }
- }
- }
- ct.run()
-}
-
-func TestTransportResponseDataBeforeHeaders(t *testing.T) {
- // This test use not valid response format.
- // Discarding logger output to not spam tests output.
- log.SetOutput(ioutil.Discard)
- defer log.SetOutput(os.Stderr)
-
- ct := newClientTester(t)
- ct.client = func() error {
- defer ct.cc.(*net.TCPConn).CloseWrite()
- req := httptest.NewRequest("GET", "https://dummy.tld/", nil)
- // First request is normal to ensure the check is per stream and not per connection.
- _, err := ct.tr.RoundTrip(req)
- if err != nil {
- return fmt.Errorf("RoundTrip expected no error, got: %v", err)
- }
- // Second request returns a DATA frame with no HEADERS.
- resp, err := ct.tr.RoundTrip(req)
- if err == nil {
- return fmt.Errorf("RoundTrip expected error, got response: %+v", resp)
- }
- if err, ok := err.(StreamError); !ok || err.Code != ErrCodeProtocol {
- return fmt.Errorf("expected stream PROTOCOL_ERROR, got: %v", err)
- }
- return nil
- }
- ct.server = func() error {
- ct.greet()
- for {
- f, err := ct.fr.ReadFrame()
- if err == io.EOF {
- return nil
- } else if err != nil {
- return err
- }
- switch f := f.(type) {
- case *WindowUpdateFrame, *SettingsFrame:
- case *HeadersFrame:
- switch f.StreamID {
- case 1:
- // Send a valid response to first request.
- var buf bytes.Buffer
- enc := hpack.NewEncoder(&buf)
- enc.WriteField(hpack.HeaderField{Name: ":status", Value: "200"})
- ct.fr.WriteHeaders(HeadersFrameParam{
- StreamID: f.StreamID,
- EndHeaders: true,
- EndStream: true,
- BlockFragment: buf.Bytes(),
- })
- case 3:
- ct.fr.WriteData(f.StreamID, true, []byte("payload"))
- }
- default:
- return fmt.Errorf("Unexpected client frame %v", f)
- }
- }
- }
- ct.run()
-}
-func TestTransportRequestsStallAtServerLimit(t *testing.T) {
- const maxConcurrent = 2
-
- greet := make(chan struct{}) // server sends initial SETTINGS frame
- gotRequest := make(chan struct{}) // server received a request
- clientDone := make(chan struct{})
-
- // Collect errors from goroutines.
- var wg sync.WaitGroup
- errs := make(chan error, 100)
- defer func() {
- wg.Wait()
- close(errs)
- for err := range errs {
- t.Error(err)
- }
- }()
-
- // We will send maxConcurrent+2 requests. This checker goroutine waits for the
- // following stages:
- // 1. The first maxConcurrent requests are received by the server.
- // 2. The client will cancel the next request
- // 3. The server is unblocked so it can service the first maxConcurrent requests
- // 4. The client will send the final request
- wg.Add(1)
- unblockClient := make(chan struct{})
- clientRequestCancelled := make(chan struct{})
- unblockServer := make(chan struct{})
- go func() {
- defer wg.Done()
- // Stage 1.
- for k := 0; k < maxConcurrent; k++ {
- <-gotRequest
- }
- // Stage 2.
- close(unblockClient)
- <-clientRequestCancelled
- // Stage 3: give some time for the final RoundTrip call to be scheduled and
- // verify that the final request is not sent.
- time.Sleep(50 * time.Millisecond)
- select {
- case <-gotRequest:
- errs <- errors.New("last request did not stall")
- close(unblockServer)
- return
- default:
- }
- close(unblockServer)
- // Stage 4.
- <-gotRequest
- }()
-
- ct := newClientTester(t)
- ct.client = func() error {
- var wg sync.WaitGroup
- defer func() {
- wg.Wait()
- close(clientDone)
- ct.cc.(*net.TCPConn).CloseWrite()
- }()
- for k := 0; k < maxConcurrent+2; k++ {
- wg.Add(1)
- go func(k int) {
- defer wg.Done()
- // Don't send the second request until after receiving SETTINGS from the server
- // to avoid a race where we use the default SettingMaxConcurrentStreams, which
- // is much larger than maxConcurrent. We have to send the first request before
- // waiting because the first request triggers the dial and greet.
- if k > 0 {
- <-greet
- }
- // Block until maxConcurrent requests are sent before sending any more.
- if k >= maxConcurrent {
- <-unblockClient
- }
- req, _ := http.NewRequest("GET", fmt.Sprintf("https://dummy.tld/%d", k), nil)
- if k == maxConcurrent {
- // This request will be canceled.
- cancel := make(chan struct{})
- req.Cancel = cancel
- close(cancel)
- _, err := ct.tr.RoundTrip(req)
- close(clientRequestCancelled)
- if err == nil {
- errs <- fmt.Errorf("RoundTrip(%d) should have failed due to cancel", k)
- return
- }
- } else {
- resp, err := ct.tr.RoundTrip(req)
- if err != nil {
- errs <- fmt.Errorf("RoundTrip(%d): %v", k, err)
- return
- }
- ioutil.ReadAll(resp.Body)
- resp.Body.Close()
- if resp.StatusCode != 204 {
- errs <- fmt.Errorf("Status = %v; want 204", resp.StatusCode)
- return
- }
- }
- }(k)
- }
- return nil
- }
-
- ct.server = func() error {
- var wg sync.WaitGroup
- defer wg.Wait()
-
- ct.greet(Setting{SettingMaxConcurrentStreams, maxConcurrent})
-
- // Server write loop.
- var buf bytes.Buffer
- enc := hpack.NewEncoder(&buf)
- writeResp := make(chan uint32, maxConcurrent+1)
-
- wg.Add(1)
- go func() {
- defer wg.Done()
- <-unblockServer
- for id := range writeResp {
- buf.Reset()
- enc.WriteField(hpack.HeaderField{Name: ":status", Value: "204"})
- ct.fr.WriteHeaders(HeadersFrameParam{
- StreamID: id,
- EndHeaders: true,
- EndStream: true,
- BlockFragment: buf.Bytes(),
- })
- }
- }()
-
- // Server read loop.
- var nreq int
- for {
- f, err := ct.fr.ReadFrame()
- if err != nil {
- select {
- case <-clientDone:
- // If the client's done, it will have reported any errors on its side.
- return nil
- default:
- return err
- }
- }
- switch f := f.(type) {
- case *WindowUpdateFrame:
- case *SettingsFrame:
- // Wait for the client SETTINGS ack until ending the greet.
- close(greet)
- case *HeadersFrame:
- if !f.HeadersEnded() {
- return fmt.Errorf("headers should have END_HEADERS be ended: %v", f)
- }
- gotRequest <- struct{}{}
- nreq++
- writeResp <- f.StreamID
- if nreq == maxConcurrent+1 {
- close(writeResp)
- }
- default:
- return fmt.Errorf("Unexpected client frame %v", f)
- }
- }
- }
-
- ct.run()
-}
-
-func TestAuthorityAddr(t *testing.T) {
- tests := []struct {
- scheme, authority string
- want string
- }{
- {"http", "foo.com", "foo.com:80"},
- {"https", "foo.com", "foo.com:443"},
- {"https", "foo.com:1234", "foo.com:1234"},
- {"https", "1.2.3.4:1234", "1.2.3.4:1234"},
- {"https", "1.2.3.4", "1.2.3.4:443"},
- {"https", "[::1]:1234", "[::1]:1234"},
- {"https", "[::1]", "[::1]:443"},
- }
- for _, tt := range tests {
- got := authorityAddr(tt.scheme, tt.authority)
- if got != tt.want {
- t.Errorf("authorityAddr(%q, %q) = %q; want %q", tt.scheme, tt.authority, got, tt.want)
- }
- }
-}
-
-// Issue 20448: stop allocating for DATA frames' payload after
-// Response.Body.Close is called.
-func TestTransportAllocationsAfterResponseBodyClose(t *testing.T) {
- megabyteZero := make([]byte, 1<<20)
-
- writeErr := make(chan error, 1)
-
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- w.(http.Flusher).Flush()
- var sum int64
- for i := 0; i < 100; i++ {
- n, err := w.Write(megabyteZero)
- sum += int64(n)
- if err != nil {
- writeErr <- err
- return
- }
- }
- t.Logf("wrote all %d bytes", sum)
- writeErr <- nil
- }, optOnlyServer)
- defer st.Close()
-
- tr := &Transport{TLSClientConfig: tlsConfigInsecure}
- defer tr.CloseIdleConnections()
- c := &http.Client{Transport: tr}
- res, err := c.Get(st.ts.URL)
- if err != nil {
- t.Fatal(err)
- }
- var buf [1]byte
- if _, err := res.Body.Read(buf[:]); err != nil {
- t.Error(err)
- }
- if err := res.Body.Close(); err != nil {
- t.Error(err)
- }
-
- trb, ok := res.Body.(transportResponseBody)
- if !ok {
- t.Fatalf("res.Body = %T; want transportResponseBody", res.Body)
- }
- if trb.cs.bufPipe.b != nil {
- t.Errorf("response body pipe is still open")
- }
-
- gotErr := <-writeErr
- if gotErr == nil {
- t.Errorf("Handler unexpectedly managed to write its entire response without getting an error")
- } else if gotErr != errStreamClosed {
- t.Errorf("Handler Write err = %v; want errStreamClosed", gotErr)
- }
-}
-
-// Issue 18891: make sure Request.Body == NoBody means no DATA frame
-// is ever sent, even if empty.
-func TestTransportNoBodyMeansNoDATA(t *testing.T) {
- ct := newClientTester(t)
-
- unblockClient := make(chan bool)
-
- ct.client = func() error {
- req, _ := http.NewRequest("GET", "https://dummy.tld/", go18httpNoBody())
- ct.tr.RoundTrip(req)
- <-unblockClient
- return nil
- }
- ct.server = func() error {
- defer close(unblockClient)
- defer ct.cc.(*net.TCPConn).Close()
- ct.greet()
-
- for {
- f, err := ct.fr.ReadFrame()
- if err != nil {
- return fmt.Errorf("ReadFrame while waiting for Headers: %v", err)
- }
- switch f := f.(type) {
- default:
- return fmt.Errorf("Got %T; want HeadersFrame", f)
- case *WindowUpdateFrame, *SettingsFrame:
- continue
- case *HeadersFrame:
- if !f.StreamEnded() {
- return fmt.Errorf("got headers frame without END_STREAM")
- }
- return nil
- }
- }
- }
- ct.run()
-}
-
-func benchSimpleRoundTrip(b *testing.B, nHeaders int) {
- defer disableGoroutineTracking()()
- b.ReportAllocs()
- st := newServerTester(b,
- func(w http.ResponseWriter, r *http.Request) {
- },
- optOnlyServer,
- optQuiet,
- )
- defer st.Close()
-
- tr := &Transport{TLSClientConfig: tlsConfigInsecure}
- defer tr.CloseIdleConnections()
-
- req, err := http.NewRequest("GET", st.ts.URL, nil)
- if err != nil {
- b.Fatal(err)
- }
-
- for i := 0; i < nHeaders; i++ {
- name := fmt.Sprint("A-", i)
- req.Header.Set(name, "*")
- }
-
- b.ResetTimer()
-
- for i := 0; i < b.N; i++ {
- res, err := tr.RoundTrip(req)
- if err != nil {
- if res != nil {
- res.Body.Close()
- }
- b.Fatalf("RoundTrip err = %v; want nil", err)
- }
- res.Body.Close()
- if res.StatusCode != http.StatusOK {
- b.Fatalf("Response code = %v; want %v", res.StatusCode, http.StatusOK)
- }
- }
-}
-
-type infiniteReader struct{}
-
-func (r infiniteReader) Read(b []byte) (int, error) {
- return len(b), nil
-}
-
-// Issue 20521: it is not an error to receive a response and end stream
-// from the server without the body being consumed.
-func TestTransportResponseAndResetWithoutConsumingBodyRace(t *testing.T) {
- st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
- w.WriteHeader(http.StatusOK)
- }, optOnlyServer)
- defer st.Close()
-
- tr := &Transport{TLSClientConfig: tlsConfigInsecure}
- defer tr.CloseIdleConnections()
-
- // The request body needs to be big enough to trigger flow control.
- req, _ := http.NewRequest("PUT", st.ts.URL, infiniteReader{})
- res, err := tr.RoundTrip(req)
- if err != nil {
- t.Fatal(err)
- }
- if res.StatusCode != http.StatusOK {
- t.Fatalf("Response code = %v; want %v", res.StatusCode, http.StatusOK)
- }
-}
-
-// Verify transport doesn't crash when receiving bogus response lacking a :status header.
-// Issue 22880.
-func TestTransportHandlesInvalidStatuslessResponse(t *testing.T) {
- ct := newClientTester(t)
- ct.client = func() error {
- req, _ := http.NewRequest("GET", "https://dummy.tld/", nil)
- _, err := ct.tr.RoundTrip(req)
- const substr = "malformed response from server: missing status pseudo header"
- if !strings.Contains(fmt.Sprint(err), substr) {
- return fmt.Errorf("RoundTrip error = %v; want substring %q", err, substr)
- }
- return nil
- }
- ct.server = func() error {
- ct.greet()
- var buf bytes.Buffer
- enc := hpack.NewEncoder(&buf)
-
- for {
- f, err := ct.fr.ReadFrame()
- if err != nil {
- return err
- }
- switch f := f.(type) {
- case *HeadersFrame:
- enc.WriteField(hpack.HeaderField{Name: "content-type", Value: "text/html"}) // no :status header
- ct.fr.WriteHeaders(HeadersFrameParam{
- StreamID: f.StreamID,
- EndHeaders: true,
- EndStream: false, // we'll send some DATA to try to crash the transport
- BlockFragment: buf.Bytes(),
- })
- ct.fr.WriteData(f.StreamID, true, []byte("payload"))
- return nil
- }
- }
- }
- ct.run()
-}
-
-func BenchmarkClientRequestHeaders(b *testing.B) {
- b.Run(" 0 Headers", func(b *testing.B) { benchSimpleRoundTrip(b, 0) })
- b.Run(" 10 Headers", func(b *testing.B) { benchSimpleRoundTrip(b, 10) })
- b.Run(" 100 Headers", func(b *testing.B) { benchSimpleRoundTrip(b, 100) })
- b.Run("1000 Headers", func(b *testing.B) { benchSimpleRoundTrip(b, 1000) })
-}
diff --git a/vendor/golang.org/x/net/http2/writesched_priority_test.go b/vendor/golang.org/x/net/http2/writesched_priority_test.go
deleted file mode 100644
index f2b535a2c..000000000
--- a/vendor/golang.org/x/net/http2/writesched_priority_test.go
+++ /dev/null
@@ -1,541 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package http2
-
-import (
- "bytes"
- "fmt"
- "sort"
- "testing"
-)
-
-func defaultPriorityWriteScheduler() *priorityWriteScheduler {
- return NewPriorityWriteScheduler(nil).(*priorityWriteScheduler)
-}
-
-func checkPriorityWellFormed(ws *priorityWriteScheduler) error {
- for id, n := range ws.nodes {
- if id != n.id {
- return fmt.Errorf("bad ws.nodes: ws.nodes[%d] = %d", id, n.id)
- }
- if n.parent == nil {
- if n.next != nil || n.prev != nil {
- return fmt.Errorf("bad node %d: nil parent but prev/next not nil", id)
- }
- continue
- }
- found := false
- for k := n.parent.kids; k != nil; k = k.next {
- if k.id == id {
- found = true
- break
- }
- }
- if !found {
- return fmt.Errorf("bad node %d: not found in parent %d kids list", id, n.parent.id)
- }
- }
- return nil
-}
-
-func fmtTree(ws *priorityWriteScheduler, fmtNode func(*priorityNode) string) string {
- var ids []int
- for _, n := range ws.nodes {
- ids = append(ids, int(n.id))
- }
- sort.Ints(ids)
-
- var buf bytes.Buffer
- for _, id := range ids {
- if buf.Len() != 0 {
- buf.WriteString(" ")
- }
- if id == 0 {
- buf.WriteString(fmtNode(&ws.root))
- } else {
- buf.WriteString(fmtNode(ws.nodes[uint32(id)]))
- }
- }
- return buf.String()
-}
-
-func fmtNodeParentSkipRoot(n *priorityNode) string {
- switch {
- case n.id == 0:
- return ""
- case n.parent == nil:
- return fmt.Sprintf("%d{parent:nil}", n.id)
- default:
- return fmt.Sprintf("%d{parent:%d}", n.id, n.parent.id)
- }
-}
-
-func fmtNodeWeightParentSkipRoot(n *priorityNode) string {
- switch {
- case n.id == 0:
- return ""
- case n.parent == nil:
- return fmt.Sprintf("%d{weight:%d,parent:nil}", n.id, n.weight)
- default:
- return fmt.Sprintf("%d{weight:%d,parent:%d}", n.id, n.weight, n.parent.id)
- }
-}
-
-func TestPriorityTwoStreams(t *testing.T) {
- ws := defaultPriorityWriteScheduler()
- ws.OpenStream(1, OpenStreamOptions{})
- ws.OpenStream(2, OpenStreamOptions{})
-
- want := "1{weight:15,parent:0} 2{weight:15,parent:0}"
- if got := fmtTree(ws, fmtNodeWeightParentSkipRoot); got != want {
- t.Errorf("After open\ngot %q\nwant %q", got, want)
- }
-
- // Move 1's parent to 2.
- ws.AdjustStream(1, PriorityParam{
- StreamDep: 2,
- Weight: 32,
- Exclusive: false,
- })
- want = "1{weight:32,parent:2} 2{weight:15,parent:0}"
- if got := fmtTree(ws, fmtNodeWeightParentSkipRoot); got != want {
- t.Errorf("After adjust\ngot %q\nwant %q", got, want)
- }
-
- if err := checkPriorityWellFormed(ws); err != nil {
- t.Error(err)
- }
-}
-
-func TestPriorityAdjustExclusiveZero(t *testing.T) {
- // 1, 2, and 3 are all children of the 0 stream.
- // Exclusive reprioritization to any of the streams should bring
- // the rest of the streams under the reprioritized stream.
- ws := defaultPriorityWriteScheduler()
- ws.OpenStream(1, OpenStreamOptions{})
- ws.OpenStream(2, OpenStreamOptions{})
- ws.OpenStream(3, OpenStreamOptions{})
-
- want := "1{weight:15,parent:0} 2{weight:15,parent:0} 3{weight:15,parent:0}"
- if got := fmtTree(ws, fmtNodeWeightParentSkipRoot); got != want {
- t.Errorf("After open\ngot %q\nwant %q", got, want)
- }
-
- ws.AdjustStream(2, PriorityParam{
- StreamDep: 0,
- Weight: 20,
- Exclusive: true,
- })
- want = "1{weight:15,parent:2} 2{weight:20,parent:0} 3{weight:15,parent:2}"
- if got := fmtTree(ws, fmtNodeWeightParentSkipRoot); got != want {
- t.Errorf("After adjust\ngot %q\nwant %q", got, want)
- }
-
- if err := checkPriorityWellFormed(ws); err != nil {
- t.Error(err)
- }
-}
-
-func TestPriorityAdjustOwnParent(t *testing.T) {
- // Assigning a node as its own parent should have no effect.
- ws := defaultPriorityWriteScheduler()
- ws.OpenStream(1, OpenStreamOptions{})
- ws.OpenStream(2, OpenStreamOptions{})
- ws.AdjustStream(2, PriorityParam{
- StreamDep: 2,
- Weight: 20,
- Exclusive: true,
- })
- want := "1{weight:15,parent:0} 2{weight:15,parent:0}"
- if got := fmtTree(ws, fmtNodeWeightParentSkipRoot); got != want {
- t.Errorf("After adjust\ngot %q\nwant %q", got, want)
- }
- if err := checkPriorityWellFormed(ws); err != nil {
- t.Error(err)
- }
-}
-
-func TestPriorityClosedStreams(t *testing.T) {
- ws := NewPriorityWriteScheduler(&PriorityWriteSchedulerConfig{MaxClosedNodesInTree: 2}).(*priorityWriteScheduler)
- ws.OpenStream(1, OpenStreamOptions{})
- ws.OpenStream(2, OpenStreamOptions{PusherID: 1})
- ws.OpenStream(3, OpenStreamOptions{PusherID: 2})
- ws.OpenStream(4, OpenStreamOptions{PusherID: 3})
-
- // Close the first three streams. We lose 1, but keep 2 and 3.
- ws.CloseStream(1)
- ws.CloseStream(2)
- ws.CloseStream(3)
-
- want := "2{weight:15,parent:0} 3{weight:15,parent:2} 4{weight:15,parent:3}"
- if got := fmtTree(ws, fmtNodeWeightParentSkipRoot); got != want {
- t.Errorf("After close\ngot %q\nwant %q", got, want)
- }
- if err := checkPriorityWellFormed(ws); err != nil {
- t.Error(err)
- }
-
- // Adding a stream as an exclusive child of 1 gives it default
- // priorities, since 1 is gone.
- ws.OpenStream(5, OpenStreamOptions{})
- ws.AdjustStream(5, PriorityParam{StreamDep: 1, Weight: 15, Exclusive: true})
-
- // Adding a stream as an exclusive child of 2 should work, since 2 is not gone.
- ws.OpenStream(6, OpenStreamOptions{})
- ws.AdjustStream(6, PriorityParam{StreamDep: 2, Weight: 15, Exclusive: true})
-
- want = "2{weight:15,parent:0} 3{weight:15,parent:6} 4{weight:15,parent:3} 5{weight:15,parent:0} 6{weight:15,parent:2}"
- if got := fmtTree(ws, fmtNodeWeightParentSkipRoot); got != want {
- t.Errorf("After add streams\ngot %q\nwant %q", got, want)
- }
- if err := checkPriorityWellFormed(ws); err != nil {
- t.Error(err)
- }
-}
-
-func TestPriorityClosedStreamsDisabled(t *testing.T) {
- ws := NewPriorityWriteScheduler(&PriorityWriteSchedulerConfig{}).(*priorityWriteScheduler)
- ws.OpenStream(1, OpenStreamOptions{})
- ws.OpenStream(2, OpenStreamOptions{PusherID: 1})
- ws.OpenStream(3, OpenStreamOptions{PusherID: 2})
-
- // Close the first two streams. We keep only 3.
- ws.CloseStream(1)
- ws.CloseStream(2)
-
- want := "3{weight:15,parent:0}"
- if got := fmtTree(ws, fmtNodeWeightParentSkipRoot); got != want {
- t.Errorf("After close\ngot %q\nwant %q", got, want)
- }
- if err := checkPriorityWellFormed(ws); err != nil {
- t.Error(err)
- }
-}
-
-func TestPriorityIdleStreams(t *testing.T) {
- ws := NewPriorityWriteScheduler(&PriorityWriteSchedulerConfig{MaxIdleNodesInTree: 2}).(*priorityWriteScheduler)
- ws.AdjustStream(1, PriorityParam{StreamDep: 0, Weight: 15}) // idle
- ws.AdjustStream(2, PriorityParam{StreamDep: 0, Weight: 15}) // idle
- ws.AdjustStream(3, PriorityParam{StreamDep: 2, Weight: 20}) // idle
- ws.OpenStream(4, OpenStreamOptions{})
- ws.OpenStream(5, OpenStreamOptions{})
- ws.OpenStream(6, OpenStreamOptions{})
- ws.AdjustStream(4, PriorityParam{StreamDep: 1, Weight: 15})
- ws.AdjustStream(5, PriorityParam{StreamDep: 2, Weight: 15})
- ws.AdjustStream(6, PriorityParam{StreamDep: 3, Weight: 15})
-
- want := "2{weight:15,parent:0} 3{weight:20,parent:2} 4{weight:15,parent:0} 5{weight:15,parent:2} 6{weight:15,parent:3}"
- if got := fmtTree(ws, fmtNodeWeightParentSkipRoot); got != want {
- t.Errorf("After open\ngot %q\nwant %q", got, want)
- }
- if err := checkPriorityWellFormed(ws); err != nil {
- t.Error(err)
- }
-}
-
-func TestPriorityIdleStreamsDisabled(t *testing.T) {
- ws := NewPriorityWriteScheduler(&PriorityWriteSchedulerConfig{}).(*priorityWriteScheduler)
- ws.AdjustStream(1, PriorityParam{StreamDep: 0, Weight: 15}) // idle
- ws.AdjustStream(2, PriorityParam{StreamDep: 0, Weight: 15}) // idle
- ws.AdjustStream(3, PriorityParam{StreamDep: 2, Weight: 20}) // idle
- ws.OpenStream(4, OpenStreamOptions{})
-
- want := "4{weight:15,parent:0}"
- if got := fmtTree(ws, fmtNodeWeightParentSkipRoot); got != want {
- t.Errorf("After open\ngot %q\nwant %q", got, want)
- }
- if err := checkPriorityWellFormed(ws); err != nil {
- t.Error(err)
- }
-}
-
-func TestPrioritySection531NonExclusive(t *testing.T) {
- // Example from RFC 7540 Section 5.3.1.
- // A,B,C,D = 1,2,3,4
- ws := defaultPriorityWriteScheduler()
- ws.OpenStream(1, OpenStreamOptions{})
- ws.OpenStream(2, OpenStreamOptions{PusherID: 1})
- ws.OpenStream(3, OpenStreamOptions{PusherID: 1})
- ws.OpenStream(4, OpenStreamOptions{})
- ws.AdjustStream(4, PriorityParam{
- StreamDep: 1,
- Weight: 15,
- Exclusive: false,
- })
- want := "1{parent:0} 2{parent:1} 3{parent:1} 4{parent:1}"
- if got := fmtTree(ws, fmtNodeParentSkipRoot); got != want {
- t.Errorf("After adjust\ngot %q\nwant %q", got, want)
- }
- if err := checkPriorityWellFormed(ws); err != nil {
- t.Error(err)
- }
-}
-
-func TestPrioritySection531Exclusive(t *testing.T) {
- // Example from RFC 7540 Section 5.3.1.
- // A,B,C,D = 1,2,3,4
- ws := defaultPriorityWriteScheduler()
- ws.OpenStream(1, OpenStreamOptions{})
- ws.OpenStream(2, OpenStreamOptions{PusherID: 1})
- ws.OpenStream(3, OpenStreamOptions{PusherID: 1})
- ws.OpenStream(4, OpenStreamOptions{})
- ws.AdjustStream(4, PriorityParam{
- StreamDep: 1,
- Weight: 15,
- Exclusive: true,
- })
- want := "1{parent:0} 2{parent:4} 3{parent:4} 4{parent:1}"
- if got := fmtTree(ws, fmtNodeParentSkipRoot); got != want {
- t.Errorf("After adjust\ngot %q\nwant %q", got, want)
- }
- if err := checkPriorityWellFormed(ws); err != nil {
- t.Error(err)
- }
-}
-
-func makeSection533Tree() *priorityWriteScheduler {
- // Initial tree from RFC 7540 Section 5.3.3.
- // A,B,C,D,E,F = 1,2,3,4,5,6
- ws := defaultPriorityWriteScheduler()
- ws.OpenStream(1, OpenStreamOptions{})
- ws.OpenStream(2, OpenStreamOptions{PusherID: 1})
- ws.OpenStream(3, OpenStreamOptions{PusherID: 1})
- ws.OpenStream(4, OpenStreamOptions{PusherID: 3})
- ws.OpenStream(5, OpenStreamOptions{PusherID: 3})
- ws.OpenStream(6, OpenStreamOptions{PusherID: 4})
- return ws
-}
-
-func TestPrioritySection533NonExclusive(t *testing.T) {
- // Example from RFC 7540 Section 5.3.3.
- // A,B,C,D,E,F = 1,2,3,4,5,6
- ws := defaultPriorityWriteScheduler()
- ws.OpenStream(1, OpenStreamOptions{})
- ws.OpenStream(2, OpenStreamOptions{PusherID: 1})
- ws.OpenStream(3, OpenStreamOptions{PusherID: 1})
- ws.OpenStream(4, OpenStreamOptions{PusherID: 3})
- ws.OpenStream(5, OpenStreamOptions{PusherID: 3})
- ws.OpenStream(6, OpenStreamOptions{PusherID: 4})
- ws.AdjustStream(1, PriorityParam{
- StreamDep: 4,
- Weight: 15,
- Exclusive: false,
- })
- want := "1{parent:4} 2{parent:1} 3{parent:1} 4{parent:0} 5{parent:3} 6{parent:4}"
- if got := fmtTree(ws, fmtNodeParentSkipRoot); got != want {
- t.Errorf("After adjust\ngot %q\nwant %q", got, want)
- }
- if err := checkPriorityWellFormed(ws); err != nil {
- t.Error(err)
- }
-}
-
-func TestPrioritySection533Exclusive(t *testing.T) {
- // Example from RFC 7540 Section 5.3.3.
- // A,B,C,D,E,F = 1,2,3,4,5,6
- ws := defaultPriorityWriteScheduler()
- ws.OpenStream(1, OpenStreamOptions{})
- ws.OpenStream(2, OpenStreamOptions{PusherID: 1})
- ws.OpenStream(3, OpenStreamOptions{PusherID: 1})
- ws.OpenStream(4, OpenStreamOptions{PusherID: 3})
- ws.OpenStream(5, OpenStreamOptions{PusherID: 3})
- ws.OpenStream(6, OpenStreamOptions{PusherID: 4})
- ws.AdjustStream(1, PriorityParam{
- StreamDep: 4,
- Weight: 15,
- Exclusive: true,
- })
- want := "1{parent:4} 2{parent:1} 3{parent:1} 4{parent:0} 5{parent:3} 6{parent:1}"
- if got := fmtTree(ws, fmtNodeParentSkipRoot); got != want {
- t.Errorf("After adjust\ngot %q\nwant %q", got, want)
- }
- if err := checkPriorityWellFormed(ws); err != nil {
- t.Error(err)
- }
-}
-
-func checkPopAll(ws WriteScheduler, order []uint32) error {
- for k, id := range order {
- wr, ok := ws.Pop()
- if !ok {
- return fmt.Errorf("Pop[%d]: got ok=false, want %d (order=%v)", k, id, order)
- }
- if got := wr.StreamID(); got != id {
- return fmt.Errorf("Pop[%d]: got %v, want %d (order=%v)", k, got, id, order)
- }
- }
- wr, ok := ws.Pop()
- if ok {
- return fmt.Errorf("Pop[%d]: got %v, want ok=false (order=%v)", len(order), wr.StreamID(), order)
- }
- return nil
-}
-
-func TestPriorityPopFrom533Tree(t *testing.T) {
- ws := makeSection533Tree()
-
- ws.Push(makeWriteHeadersRequest(3 /*C*/))
- ws.Push(makeWriteNonStreamRequest())
- ws.Push(makeWriteHeadersRequest(5 /*E*/))
- ws.Push(makeWriteHeadersRequest(1 /*A*/))
- t.Log("tree:", fmtTree(ws, fmtNodeParentSkipRoot))
-
- if err := checkPopAll(ws, []uint32{0 /*NonStream*/, 1, 3, 5}); err != nil {
- t.Error(err)
- }
-}
-
-func TestPriorityPopFromLinearTree(t *testing.T) {
- ws := defaultPriorityWriteScheduler()
- ws.OpenStream(1, OpenStreamOptions{})
- ws.OpenStream(2, OpenStreamOptions{PusherID: 1})
- ws.OpenStream(3, OpenStreamOptions{PusherID: 2})
- ws.OpenStream(4, OpenStreamOptions{PusherID: 3})
-
- ws.Push(makeWriteHeadersRequest(3))
- ws.Push(makeWriteHeadersRequest(4))
- ws.Push(makeWriteHeadersRequest(1))
- ws.Push(makeWriteHeadersRequest(2))
- ws.Push(makeWriteNonStreamRequest())
- ws.Push(makeWriteNonStreamRequest())
- t.Log("tree:", fmtTree(ws, fmtNodeParentSkipRoot))
-
- if err := checkPopAll(ws, []uint32{0, 0 /*NonStreams*/, 1, 2, 3, 4}); err != nil {
- t.Error(err)
- }
-}
-
-func TestPriorityFlowControl(t *testing.T) {
- ws := NewPriorityWriteScheduler(&PriorityWriteSchedulerConfig{ThrottleOutOfOrderWrites: false})
- ws.OpenStream(1, OpenStreamOptions{})
- ws.OpenStream(2, OpenStreamOptions{PusherID: 1})
-
- sc := &serverConn{maxFrameSize: 16}
- st1 := &stream{id: 1, sc: sc}
- st2 := &stream{id: 2, sc: sc}
-
- ws.Push(FrameWriteRequest{&writeData{1, make([]byte, 16), false}, st1, nil})
- ws.Push(FrameWriteRequest{&writeData{2, make([]byte, 16), false}, st2, nil})
- ws.AdjustStream(2, PriorityParam{StreamDep: 1})
-
- // No flow-control bytes available.
- if wr, ok := ws.Pop(); ok {
- t.Fatalf("Pop(limited by flow control)=%v,true, want false", wr)
- }
-
- // Add enough flow-control bytes to write st2 in two Pop calls.
- // Should write data from st2 even though it's lower priority than st1.
- for i := 1; i <= 2; i++ {
- st2.flow.add(8)
- wr, ok := ws.Pop()
- if !ok {
- t.Fatalf("Pop(%d)=false, want true", i)
- }
- if got, want := wr.DataSize(), 8; got != want {
- t.Fatalf("Pop(%d)=%d bytes, want %d bytes", i, got, want)
- }
- }
-}
-
-func TestPriorityThrottleOutOfOrderWrites(t *testing.T) {
- ws := NewPriorityWriteScheduler(&PriorityWriteSchedulerConfig{ThrottleOutOfOrderWrites: true})
- ws.OpenStream(1, OpenStreamOptions{})
- ws.OpenStream(2, OpenStreamOptions{PusherID: 1})
-
- sc := &serverConn{maxFrameSize: 4096}
- st1 := &stream{id: 1, sc: sc}
- st2 := &stream{id: 2, sc: sc}
- st1.flow.add(4096)
- st2.flow.add(4096)
- ws.Push(FrameWriteRequest{&writeData{2, make([]byte, 4096), false}, st2, nil})
- ws.AdjustStream(2, PriorityParam{StreamDep: 1})
-
- // We have enough flow-control bytes to write st2 in a single Pop call.
- // However, due to out-of-order write throttling, the first call should
- // only write 1KB.
- wr, ok := ws.Pop()
- if !ok {
- t.Fatalf("Pop(st2.first)=false, want true")
- }
- if got, want := wr.StreamID(), uint32(2); got != want {
- t.Fatalf("Pop(st2.first)=stream %d, want stream %d", got, want)
- }
- if got, want := wr.DataSize(), 1024; got != want {
- t.Fatalf("Pop(st2.first)=%d bytes, want %d bytes", got, want)
- }
-
- // Now add data on st1. This should take precedence.
- ws.Push(FrameWriteRequest{&writeData{1, make([]byte, 4096), false}, st1, nil})
- wr, ok = ws.Pop()
- if !ok {
- t.Fatalf("Pop(st1)=false, want true")
- }
- if got, want := wr.StreamID(), uint32(1); got != want {
- t.Fatalf("Pop(st1)=stream %d, want stream %d", got, want)
- }
- if got, want := wr.DataSize(), 4096; got != want {
- t.Fatalf("Pop(st1)=%d bytes, want %d bytes", got, want)
- }
-
- // Should go back to writing 1KB from st2.
- wr, ok = ws.Pop()
- if !ok {
- t.Fatalf("Pop(st2.last)=false, want true")
- }
- if got, want := wr.StreamID(), uint32(2); got != want {
- t.Fatalf("Pop(st2.last)=stream %d, want stream %d", got, want)
- }
- if got, want := wr.DataSize(), 1024; got != want {
- t.Fatalf("Pop(st2.last)=%d bytes, want %d bytes", got, want)
- }
-}
-
-func TestPriorityWeights(t *testing.T) {
- ws := defaultPriorityWriteScheduler()
- ws.OpenStream(1, OpenStreamOptions{})
- ws.OpenStream(2, OpenStreamOptions{})
-
- sc := &serverConn{maxFrameSize: 8}
- st1 := &stream{id: 1, sc: sc}
- st2 := &stream{id: 2, sc: sc}
- st1.flow.add(40)
- st2.flow.add(40)
-
- ws.Push(FrameWriteRequest{&writeData{1, make([]byte, 40), false}, st1, nil})
- ws.Push(FrameWriteRequest{&writeData{2, make([]byte, 40), false}, st2, nil})
- ws.AdjustStream(1, PriorityParam{StreamDep: 0, Weight: 34})
- ws.AdjustStream(2, PriorityParam{StreamDep: 0, Weight: 9})
-
- // st1 gets 3.5x the bandwidth of st2 (3.5 = (34+1)/(9+1)).
- // The maximum frame size is 8 bytes. The write sequence should be:
- // st1, total bytes so far is (st1=8, st=0)
- // st2, total bytes so far is (st1=8, st=8)
- // st1, total bytes so far is (st1=16, st=8)
- // st1, total bytes so far is (st1=24, st=8) // 3x bandwidth
- // st1, total bytes so far is (st1=32, st=8) // 4x bandwidth
- // st2, total bytes so far is (st1=32, st=16) // 2x bandwidth
- // st1, total bytes so far is (st1=40, st=16)
- // st2, total bytes so far is (st1=40, st=24)
- // st2, total bytes so far is (st1=40, st=32)
- // st2, total bytes so far is (st1=40, st=40)
- if err := checkPopAll(ws, []uint32{1, 2, 1, 1, 1, 2, 1, 2, 2, 2}); err != nil {
- t.Error(err)
- }
-}
-
-func TestPriorityRstStreamOnNonOpenStreams(t *testing.T) {
- ws := NewPriorityWriteScheduler(&PriorityWriteSchedulerConfig{
- MaxClosedNodesInTree: 0,
- MaxIdleNodesInTree: 0,
- })
- ws.OpenStream(1, OpenStreamOptions{})
- ws.CloseStream(1)
- ws.Push(FrameWriteRequest{write: streamError(1, ErrCodeProtocol)})
- ws.Push(FrameWriteRequest{write: streamError(2, ErrCodeProtocol)})
-
- if err := checkPopAll(ws, []uint32{1, 2}); err != nil {
- t.Error(err)
- }
-}
diff --git a/vendor/golang.org/x/net/http2/writesched_random_test.go b/vendor/golang.org/x/net/http2/writesched_random_test.go
deleted file mode 100644
index 3bf4aa36a..000000000
--- a/vendor/golang.org/x/net/http2/writesched_random_test.go
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package http2
-
-import "testing"
-
-func TestRandomScheduler(t *testing.T) {
- ws := NewRandomWriteScheduler()
- ws.Push(makeWriteHeadersRequest(3))
- ws.Push(makeWriteHeadersRequest(4))
- ws.Push(makeWriteHeadersRequest(1))
- ws.Push(makeWriteHeadersRequest(2))
- ws.Push(makeWriteNonStreamRequest())
- ws.Push(makeWriteNonStreamRequest())
-
- // Pop all frames. Should get the non-stream requests first,
- // followed by the stream requests in any order.
- var order []FrameWriteRequest
- for {
- wr, ok := ws.Pop()
- if !ok {
- break
- }
- order = append(order, wr)
- }
- t.Logf("got frames: %v", order)
- if len(order) != 6 {
- t.Fatalf("got %d frames, expected 6", len(order))
- }
- if order[0].StreamID() != 0 || order[1].StreamID() != 0 {
- t.Fatal("expected non-stream frames first", order[0], order[1])
- }
- got := make(map[uint32]bool)
- for _, wr := range order[2:] {
- got[wr.StreamID()] = true
- }
- for id := uint32(1); id <= 4; id++ {
- if !got[id] {
- t.Errorf("frame not found for stream %d", id)
- }
- }
-}
diff --git a/vendor/golang.org/x/net/http2/writesched_test.go b/vendor/golang.org/x/net/http2/writesched_test.go
deleted file mode 100644
index 0807056bc..000000000
--- a/vendor/golang.org/x/net/http2/writesched_test.go
+++ /dev/null
@@ -1,125 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package http2
-
-import (
- "fmt"
- "math"
- "reflect"
- "testing"
-)
-
-func makeWriteNonStreamRequest() FrameWriteRequest {
- return FrameWriteRequest{writeSettingsAck{}, nil, nil}
-}
-
-func makeWriteHeadersRequest(streamID uint32) FrameWriteRequest {
- st := &stream{id: streamID}
- return FrameWriteRequest{&writeResHeaders{streamID: streamID, httpResCode: 200}, st, nil}
-}
-
-func checkConsume(wr FrameWriteRequest, nbytes int32, want []FrameWriteRequest) error {
- consumed, rest, n := wr.Consume(nbytes)
- var wantConsumed, wantRest FrameWriteRequest
- switch len(want) {
- case 0:
- case 1:
- wantConsumed = want[0]
- case 2:
- wantConsumed = want[0]
- wantRest = want[1]
- }
- if !reflect.DeepEqual(consumed, wantConsumed) || !reflect.DeepEqual(rest, wantRest) || n != len(want) {
- return fmt.Errorf("got %v, %v, %v\nwant %v, %v, %v", consumed, rest, n, wantConsumed, wantRest, len(want))
- }
- return nil
-}
-
-func TestFrameWriteRequestNonData(t *testing.T) {
- wr := makeWriteNonStreamRequest()
- if got, want := wr.DataSize(), 0; got != want {
- t.Errorf("DataSize: got %v, want %v", got, want)
- }
-
- // Non-DATA frames are always consumed whole.
- if err := checkConsume(wr, 0, []FrameWriteRequest{wr}); err != nil {
- t.Errorf("Consume:\n%v", err)
- }
-}
-
-func TestFrameWriteRequestData(t *testing.T) {
- st := &stream{
- id: 1,
- sc: &serverConn{maxFrameSize: 16},
- }
- const size = 32
- wr := FrameWriteRequest{&writeData{st.id, make([]byte, size), true}, st, make(chan error)}
- if got, want := wr.DataSize(), size; got != want {
- t.Errorf("DataSize: got %v, want %v", got, want)
- }
-
- // No flow-control bytes available: cannot consume anything.
- if err := checkConsume(wr, math.MaxInt32, []FrameWriteRequest{}); err != nil {
- t.Errorf("Consume(limited by flow control):\n%v", err)
- }
-
- // Add enough flow-control bytes to consume the entire frame,
- // but we're now restricted by st.sc.maxFrameSize.
- st.flow.add(size)
- want := []FrameWriteRequest{
- {
- write: &writeData{st.id, make([]byte, st.sc.maxFrameSize), false},
- stream: st,
- done: nil,
- },
- {
- write: &writeData{st.id, make([]byte, size-st.sc.maxFrameSize), true},
- stream: st,
- done: wr.done,
- },
- }
- if err := checkConsume(wr, math.MaxInt32, want); err != nil {
- t.Errorf("Consume(limited by maxFrameSize):\n%v", err)
- }
- rest := want[1]
-
- // Consume 8 bytes from the remaining frame.
- want = []FrameWriteRequest{
- {
- write: &writeData{st.id, make([]byte, 8), false},
- stream: st,
- done: nil,
- },
- {
- write: &writeData{st.id, make([]byte, size-st.sc.maxFrameSize-8), true},
- stream: st,
- done: wr.done,
- },
- }
- if err := checkConsume(rest, 8, want); err != nil {
- t.Errorf("Consume(8):\n%v", err)
- }
- rest = want[1]
-
- // Consume all remaining bytes.
- want = []FrameWriteRequest{
- {
- write: &writeData{st.id, make([]byte, size-st.sc.maxFrameSize-8), true},
- stream: st,
- done: wr.done,
- },
- }
- if err := checkConsume(rest, math.MaxInt32, want); err != nil {
- t.Errorf("Consume(remainder):\n%v", err)
- }
-}
-
-func TestFrameWriteRequest_StreamID(t *testing.T) {
- const streamID = 123
- wr := FrameWriteRequest{write: streamError(streamID, ErrCodeNo)}
- if got := wr.StreamID(); got != streamID {
- t.Errorf("FrameWriteRequest(StreamError) = %v; want %v", got, streamID)
- }
-}
diff --git a/vendor/golang.org/x/net/http2/z_spec_test.go b/vendor/golang.org/x/net/http2/z_spec_test.go
deleted file mode 100644
index 610b2cdbc..000000000
--- a/vendor/golang.org/x/net/http2/z_spec_test.go
+++ /dev/null
@@ -1,356 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package http2
-
-import (
- "bytes"
- "encoding/xml"
- "flag"
- "fmt"
- "io"
- "os"
- "reflect"
- "regexp"
- "sort"
- "strconv"
- "strings"
- "sync"
- "testing"
-)
-
-var coverSpec = flag.Bool("coverspec", false, "Run spec coverage tests")
-
-// The global map of sentence coverage for the http2 spec.
-var defaultSpecCoverage specCoverage
-
-var loadSpecOnce sync.Once
-
-func loadSpec() {
- if f, err := os.Open("testdata/draft-ietf-httpbis-http2.xml"); err != nil {
- panic(err)
- } else {
- defaultSpecCoverage = readSpecCov(f)
- f.Close()
- }
-}
-
-// covers marks all sentences for section sec in defaultSpecCoverage. Sentences not
-// "covered" will be included in report outputted by TestSpecCoverage.
-func covers(sec, sentences string) {
- loadSpecOnce.Do(loadSpec)
- defaultSpecCoverage.cover(sec, sentences)
-}
-
-type specPart struct {
- section string
- sentence string
-}
-
-func (ss specPart) Less(oo specPart) bool {
- atoi := func(s string) int {
- n, err := strconv.Atoi(s)
- if err != nil {
- panic(err)
- }
- return n
- }
- a := strings.Split(ss.section, ".")
- b := strings.Split(oo.section, ".")
- for len(a) > 0 {
- if len(b) == 0 {
- return false
- }
- x, y := atoi(a[0]), atoi(b[0])
- if x == y {
- a, b = a[1:], b[1:]
- continue
- }
- return x < y
- }
- if len(b) > 0 {
- return true
- }
- return false
-}
-
-type bySpecSection []specPart
-
-func (a bySpecSection) Len() int { return len(a) }
-func (a bySpecSection) Less(i, j int) bool { return a[i].Less(a[j]) }
-func (a bySpecSection) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
-
-type specCoverage struct {
- coverage map[specPart]bool
- d *xml.Decoder
-}
-
-func joinSection(sec []int) string {
- s := fmt.Sprintf("%d", sec[0])
- for _, n := range sec[1:] {
- s = fmt.Sprintf("%s.%d", s, n)
- }
- return s
-}
-
-func (sc specCoverage) readSection(sec []int) {
- var (
- buf = new(bytes.Buffer)
- sub = 0
- )
- for {
- tk, err := sc.d.Token()
- if err != nil {
- if err == io.EOF {
- return
- }
- panic(err)
- }
- switch v := tk.(type) {
- case xml.StartElement:
- if skipElement(v) {
- if err := sc.d.Skip(); err != nil {
- panic(err)
- }
- if v.Name.Local == "section" {
- sub++
- }
- break
- }
- switch v.Name.Local {
- case "section":
- sub++
- sc.readSection(append(sec, sub))
- case "xref":
- buf.Write(sc.readXRef(v))
- }
- case xml.CharData:
- if len(sec) == 0 {
- break
- }
- buf.Write(v)
- case xml.EndElement:
- if v.Name.Local == "section" {
- sc.addSentences(joinSection(sec), buf.String())
- return
- }
- }
- }
-}
-
-func (sc specCoverage) readXRef(se xml.StartElement) []byte {
- var b []byte
- for {
- tk, err := sc.d.Token()
- if err != nil {
- panic(err)
- }
- switch v := tk.(type) {
- case xml.CharData:
- if b != nil {
- panic("unexpected CharData")
- }
- b = []byte(string(v))
- case xml.EndElement:
- if v.Name.Local != "xref" {
- panic("expected </xref>")
- }
- if b != nil {
- return b
- }
- sig := attrSig(se)
- switch sig {
- case "target":
- return []byte(fmt.Sprintf("[%s]", attrValue(se, "target")))
- case "fmt-of,rel,target", "fmt-,,rel,target":
- return []byte(fmt.Sprintf("[%s, %s]", attrValue(se, "target"), attrValue(se, "rel")))
- case "fmt-of,sec,target", "fmt-,,sec,target":
- return []byte(fmt.Sprintf("[section %s of %s]", attrValue(se, "sec"), attrValue(se, "target")))
- case "fmt-of,rel,sec,target":
- return []byte(fmt.Sprintf("[section %s of %s, %s]", attrValue(se, "sec"), attrValue(se, "target"), attrValue(se, "rel")))
- default:
- panic(fmt.Sprintf("unknown attribute signature %q in %#v", sig, fmt.Sprintf("%#v", se)))
- }
- default:
- panic(fmt.Sprintf("unexpected tag %q", v))
- }
- }
-}
-
-var skipAnchor = map[string]bool{
- "intro": true,
- "Overview": true,
-}
-
-var skipTitle = map[string]bool{
- "Acknowledgements": true,
- "Change Log": true,
- "Document Organization": true,
- "Conventions and Terminology": true,
-}
-
-func skipElement(s xml.StartElement) bool {
- switch s.Name.Local {
- case "artwork":
- return true
- case "section":
- for _, attr := range s.Attr {
- switch attr.Name.Local {
- case "anchor":
- if skipAnchor[attr.Value] || strings.HasPrefix(attr.Value, "changes.since.") {
- return true
- }
- case "title":
- if skipTitle[attr.Value] {
- return true
- }
- }
- }
- }
- return false
-}
-
-func readSpecCov(r io.Reader) specCoverage {
- sc := specCoverage{
- coverage: map[specPart]bool{},
- d: xml.NewDecoder(r)}
- sc.readSection(nil)
- return sc
-}
-
-func (sc specCoverage) addSentences(sec string, sentence string) {
- for _, s := range parseSentences(sentence) {
- sc.coverage[specPart{sec, s}] = false
- }
-}
-
-func (sc specCoverage) cover(sec string, sentence string) {
- for _, s := range parseSentences(sentence) {
- p := specPart{sec, s}
- if _, ok := sc.coverage[p]; !ok {
- panic(fmt.Sprintf("Not found in spec: %q, %q", sec, s))
- }
- sc.coverage[specPart{sec, s}] = true
- }
-
-}
-
-var whitespaceRx = regexp.MustCompile(`\s+`)
-
-func parseSentences(sens string) []string {
- sens = strings.TrimSpace(sens)
- if sens == "" {
- return nil
- }
- ss := strings.Split(whitespaceRx.ReplaceAllString(sens, " "), ". ")
- for i, s := range ss {
- s = strings.TrimSpace(s)
- if !strings.HasSuffix(s, ".") {
- s += "."
- }
- ss[i] = s
- }
- return ss
-}
-
-func TestSpecParseSentences(t *testing.T) {
- tests := []struct {
- ss string
- want []string
- }{
- {"Sentence 1. Sentence 2.",
- []string{
- "Sentence 1.",
- "Sentence 2.",
- }},
- {"Sentence 1. \nSentence 2.\tSentence 3.",
- []string{
- "Sentence 1.",
- "Sentence 2.",
- "Sentence 3.",
- }},
- }
-
- for i, tt := range tests {
- got := parseSentences(tt.ss)
- if !reflect.DeepEqual(got, tt.want) {
- t.Errorf("%d: got = %q, want %q", i, got, tt.want)
- }
- }
-}
-
-func TestSpecCoverage(t *testing.T) {
- if !*coverSpec {
- t.Skip()
- }
-
- loadSpecOnce.Do(loadSpec)
-
- var (
- list []specPart
- cv = defaultSpecCoverage.coverage
- total = len(cv)
- complete = 0
- )
-
- for sp, touched := range defaultSpecCoverage.coverage {
- if touched {
- complete++
- } else {
- list = append(list, sp)
- }
- }
- sort.Stable(bySpecSection(list))
-
- if testing.Short() && len(list) > 5 {
- list = list[:5]
- }
-
- for _, p := range list {
- t.Errorf("\tSECTION %s: %s", p.section, p.sentence)
- }
-
- t.Logf("%d/%d (%d%%) sentences covered", complete, total, (complete/total)*100)
-}
-
-func attrSig(se xml.StartElement) string {
- var names []string
- for _, attr := range se.Attr {
- if attr.Name.Local == "fmt" {
- names = append(names, "fmt-"+attr.Value)
- } else {
- names = append(names, attr.Name.Local)
- }
- }
- sort.Strings(names)
- return strings.Join(names, ",")
-}
-
-func attrValue(se xml.StartElement, attr string) string {
- for _, a := range se.Attr {
- if a.Name.Local == attr {
- return a.Value
- }
- }
- panic("unknown attribute " + attr)
-}
-
-func TestSpecPartLess(t *testing.T) {
- tests := []struct {
- sec1, sec2 string
- want bool
- }{
- {"6.2.1", "6.2", false},
- {"6.2", "6.2.1", true},
- {"6.10", "6.10.1", true},
- {"6.10", "6.1.1", false}, // 10, not 1
- {"6.1", "6.1", false}, // equal, so not less
- }
- for _, tt := range tests {
- got := (specPart{tt.sec1, "foo"}).Less(specPart{tt.sec2, "foo"})
- if got != tt.want {
- t.Errorf("Less(%q, %q) = %v; want %v", tt.sec1, tt.sec2, got, tt.want)
- }
- }
-}
diff --git a/vendor/golang.org/x/net/idna/example_test.go b/vendor/golang.org/x/net/idna/example_test.go
deleted file mode 100644
index 948f6eb20..000000000
--- a/vendor/golang.org/x/net/idna/example_test.go
+++ /dev/null
@@ -1,70 +0,0 @@
-// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
-
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package idna_test
-
-import (
- "fmt"
-
- "golang.org/x/net/idna"
-)
-
-func ExampleProfile() {
- // Raw Punycode has no restrictions and does no mappings.
- fmt.Println(idna.ToASCII(""))
- fmt.Println(idna.ToASCII("*.faß.com"))
- fmt.Println(idna.Punycode.ToASCII("*.faß.com"))
-
- // Rewrite IDN for lookup. This (currently) uses transitional mappings to
- // find a balance between IDNA2003 and IDNA2008 compatibility.
- fmt.Println(idna.Lookup.ToASCII(""))
- fmt.Println(idna.Lookup.ToASCII("www.faß.com"))
-
- // Convert an IDN to ASCII for registration purposes. This changes the
- // encoding, but reports an error if the input was illformed.
- fmt.Println(idna.Registration.ToASCII(""))
- fmt.Println(idna.Registration.ToASCII("www.faß.com"))
-
- // Output:
- // <nil>
- // *.xn--fa-hia.com <nil>
- // *.xn--fa-hia.com <nil>
- // <nil>
- // www.fass.com <nil>
- // idna: invalid label ""
- // www.xn--fa-hia.com <nil>
-}
-
-func ExampleNew() {
- var p *idna.Profile
-
- // Raw Punycode has no restrictions and does no mappings.
- p = idna.New()
- fmt.Println(p.ToASCII("*.faß.com"))
-
- // Do mappings. Note that star is not allowed in a DNS lookup.
- p = idna.New(
- idna.MapForLookup(),
- idna.Transitional(true)) // Map ß -> ss
- fmt.Println(p.ToASCII("*.faß.com"))
-
- // Lookup for registration. Also does not allow '*'.
- p = idna.New(idna.ValidateForRegistration())
- fmt.Println(p.ToUnicode("*.faß.com"))
-
- // Set up a profile maps for lookup, but allows wild cards.
- p = idna.New(
- idna.MapForLookup(),
- idna.Transitional(true), // Map ß -> ss
- idna.StrictDomainName(false)) // Set more permissive ASCII rules.
- fmt.Println(p.ToASCII("*.faß.com"))
-
- // Output:
- // *.xn--fa-hia.com <nil>
- // *.fass.com idna: disallowed rune U+002A
- // *.faß.com idna: disallowed rune U+002A
- // *.fass.com <nil>
-}
diff --git a/vendor/golang.org/x/net/idna/idna_test.go b/vendor/golang.org/x/net/idna/idna_test.go
deleted file mode 100644
index 0b067cac9..000000000
--- a/vendor/golang.org/x/net/idna/idna_test.go
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package idna
-
-import (
- "testing"
-)
-
-var idnaTestCases = [...]struct {
- ascii, unicode string
-}{
- // Labels.
- {"books", "books"},
- {"xn--bcher-kva", "bücher"},
-
- // Domains.
- {"foo--xn--bar.org", "foo--xn--bar.org"},
- {"golang.org", "golang.org"},
- {"example.xn--p1ai", "example.рф"},
- {"xn--czrw28b.tw", "商業.tw"},
- {"www.xn--mller-kva.de", "www.müller.de"},
-}
-
-func TestIDNA(t *testing.T) {
- for _, tc := range idnaTestCases {
- if a, err := ToASCII(tc.unicode); err != nil {
- t.Errorf("ToASCII(%q): %v", tc.unicode, err)
- } else if a != tc.ascii {
- t.Errorf("ToASCII(%q): got %q, want %q", tc.unicode, a, tc.ascii)
- }
-
- if u, err := ToUnicode(tc.ascii); err != nil {
- t.Errorf("ToUnicode(%q): %v", tc.ascii, err)
- } else if u != tc.unicode {
- t.Errorf("ToUnicode(%q): got %q, want %q", tc.ascii, u, tc.unicode)
- }
- }
-}
-
-func TestIDNASeparators(t *testing.T) {
- type subCase struct {
- unicode string
- wantASCII string
- wantErr bool
- }
-
- testCases := []struct {
- name string
- profile *Profile
- subCases []subCase
- }{
- {
- name: "Punycode", profile: Punycode,
- subCases: []subCase{
- {"example\u3002jp", "xn--examplejp-ck3h", false},
- {"東京\uFF0Ejp", "xn--jp-l92cn98g071o", false},
- {"大阪\uFF61jp", "xn--jp-ku9cz72u463f", false},
- },
- },
- {
- name: "Lookup", profile: Lookup,
- subCases: []subCase{
- {"example\u3002jp", "example.jp", false},
- {"東京\uFF0Ejp", "xn--1lqs71d.jp", false},
- {"大阪\uFF61jp", "xn--pssu33l.jp", false},
- },
- },
- {
- name: "Display", profile: Display,
- subCases: []subCase{
- {"example\u3002jp", "example.jp", false},
- {"東京\uFF0Ejp", "xn--1lqs71d.jp", false},
- {"大阪\uFF61jp", "xn--pssu33l.jp", false},
- },
- },
- {
- name: "Registration", profile: Registration,
- subCases: []subCase{
- {"example\u3002jp", "", true},
- {"東京\uFF0Ejp", "", true},
- {"大阪\uFF61jp", "", true},
- },
- },
- }
- for _, tc := range testCases {
- t.Run(tc.name, func(t *testing.T) {
- for _, c := range tc.subCases {
- gotA, err := tc.profile.ToASCII(c.unicode)
- if c.wantErr {
- if err == nil {
- t.Errorf("ToASCII(%q): got no error, but an error expected", c.unicode)
- }
- } else {
- if err != nil {
- t.Errorf("ToASCII(%q): got err=%v, but no error expected", c.unicode, err)
- } else if gotA != c.wantASCII {
- t.Errorf("ToASCII(%q): got %q, want %q", c.unicode, gotA, c.wantASCII)
- }
- }
- }
- })
- }
-}
-
-// TODO(nigeltao): test errors, once we've specified when ToASCII and ToUnicode
-// return errors.
diff --git a/vendor/golang.org/x/net/idna/punycode_test.go b/vendor/golang.org/x/net/idna/punycode_test.go
deleted file mode 100644
index bfec81dec..000000000
--- a/vendor/golang.org/x/net/idna/punycode_test.go
+++ /dev/null
@@ -1,198 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package idna
-
-import (
- "strings"
- "testing"
-)
-
-var punycodeTestCases = [...]struct {
- s, encoded string
-}{
- {"", ""},
- {"-", "--"},
- {"-a", "-a-"},
- {"-a-", "-a--"},
- {"a", "a-"},
- {"a-", "a--"},
- {"a-b", "a-b-"},
- {"books", "books-"},
- {"bücher", "bcher-kva"},
- {"Hello世界", "Hello-ck1hg65u"},
- {"ü", "tda"},
- {"üý", "tdac"},
-
- // The test cases below come from RFC 3492 section 7.1 with Errata 3026.
- {
- // (A) Arabic (Egyptian).
- "\u0644\u064A\u0647\u0645\u0627\u0628\u062A\u0643\u0644" +
- "\u0645\u0648\u0634\u0639\u0631\u0628\u064A\u061F",
- "egbpdaj6bu4bxfgehfvwxn",
- },
- {
- // (B) Chinese (simplified).
- "\u4ED6\u4EEC\u4E3A\u4EC0\u4E48\u4E0D\u8BF4\u4E2D\u6587",
- "ihqwcrb4cv8a8dqg056pqjye",
- },
- {
- // (C) Chinese (traditional).
- "\u4ED6\u5011\u7232\u4EC0\u9EBD\u4E0D\u8AAA\u4E2D\u6587",
- "ihqwctvzc91f659drss3x8bo0yb",
- },
- {
- // (D) Czech.
- "\u0050\u0072\u006F\u010D\u0070\u0072\u006F\u0073\u0074" +
- "\u011B\u006E\u0065\u006D\u006C\u0075\u0076\u00ED\u010D" +
- "\u0065\u0073\u006B\u0079",
- "Proprostnemluvesky-uyb24dma41a",
- },
- {
- // (E) Hebrew.
- "\u05DC\u05DE\u05D4\u05D4\u05DD\u05E4\u05E9\u05D5\u05D8" +
- "\u05DC\u05D0\u05DE\u05D3\u05D1\u05E8\u05D9\u05DD\u05E2" +
- "\u05D1\u05E8\u05D9\u05EA",
- "4dbcagdahymbxekheh6e0a7fei0b",
- },
- {
- // (F) Hindi (Devanagari).
- "\u092F\u0939\u0932\u094B\u0917\u0939\u093F\u0928\u094D" +
- "\u0926\u0940\u0915\u094D\u092F\u094B\u0902\u0928\u0939" +
- "\u0940\u0902\u092C\u094B\u0932\u0938\u0915\u0924\u0947" +
- "\u0939\u0948\u0902",
- "i1baa7eci9glrd9b2ae1bj0hfcgg6iyaf8o0a1dig0cd",
- },
- {
- // (G) Japanese (kanji and hiragana).
- "\u306A\u305C\u307F\u3093\u306A\u65E5\u672C\u8A9E\u3092" +
- "\u8A71\u3057\u3066\u304F\u308C\u306A\u3044\u306E\u304B",
- "n8jok5ay5dzabd5bym9f0cm5685rrjetr6pdxa",
- },
- {
- // (H) Korean (Hangul syllables).
- "\uC138\uACC4\uC758\uBAA8\uB4E0\uC0AC\uB78C\uB4E4\uC774" +
- "\uD55C\uAD6D\uC5B4\uB97C\uC774\uD574\uD55C\uB2E4\uBA74" +
- "\uC5BC\uB9C8\uB098\uC88B\uC744\uAE4C",
- "989aomsvi5e83db1d2a355cv1e0vak1dwrv93d5xbh15a0dt30a5j" +
- "psd879ccm6fea98c",
- },
- {
- // (I) Russian (Cyrillic).
- "\u043F\u043E\u0447\u0435\u043C\u0443\u0436\u0435\u043E" +
- "\u043D\u0438\u043D\u0435\u0433\u043E\u0432\u043E\u0440" +
- "\u044F\u0442\u043F\u043E\u0440\u0443\u0441\u0441\u043A" +
- "\u0438",
- "b1abfaaepdrnnbgefbadotcwatmq2g4l",
- },
- {
- // (J) Spanish.
- "\u0050\u006F\u0072\u0071\u0075\u00E9\u006E\u006F\u0070" +
- "\u0075\u0065\u0064\u0065\u006E\u0073\u0069\u006D\u0070" +
- "\u006C\u0065\u006D\u0065\u006E\u0074\u0065\u0068\u0061" +
- "\u0062\u006C\u0061\u0072\u0065\u006E\u0045\u0073\u0070" +
- "\u0061\u00F1\u006F\u006C",
- "PorqunopuedensimplementehablarenEspaol-fmd56a",
- },
- {
- // (K) Vietnamese.
- "\u0054\u1EA1\u0069\u0073\u0061\u006F\u0068\u1ECD\u006B" +
- "\u0068\u00F4\u006E\u0067\u0074\u0068\u1EC3\u0063\u0068" +
- "\u1EC9\u006E\u00F3\u0069\u0074\u0069\u1EBF\u006E\u0067" +
- "\u0056\u0069\u1EC7\u0074",
- "TisaohkhngthchnitingVit-kjcr8268qyxafd2f1b9g",
- },
- {
- // (L) 3<nen>B<gumi><kinpachi><sensei>.
- "\u0033\u5E74\u0042\u7D44\u91D1\u516B\u5148\u751F",
- "3B-ww4c5e180e575a65lsy2b",
- },
- {
- // (M) <amuro><namie>-with-SUPER-MONKEYS.
- "\u5B89\u5BA4\u5948\u7F8E\u6075\u002D\u0077\u0069\u0074" +
- "\u0068\u002D\u0053\u0055\u0050\u0045\u0052\u002D\u004D" +
- "\u004F\u004E\u004B\u0045\u0059\u0053",
- "-with-SUPER-MONKEYS-pc58ag80a8qai00g7n9n",
- },
- {
- // (N) Hello-Another-Way-<sorezore><no><basho>.
- "\u0048\u0065\u006C\u006C\u006F\u002D\u0041\u006E\u006F" +
- "\u0074\u0068\u0065\u0072\u002D\u0057\u0061\u0079\u002D" +
- "\u305D\u308C\u305E\u308C\u306E\u5834\u6240",
- "Hello-Another-Way--fc4qua05auwb3674vfr0b",
- },
- {
- // (O) <hitotsu><yane><no><shita>2.
- "\u3072\u3068\u3064\u5C4B\u6839\u306E\u4E0B\u0032",
- "2-u9tlzr9756bt3uc0v",
- },
- {
- // (P) Maji<de>Koi<suru>5<byou><mae>
- "\u004D\u0061\u006A\u0069\u3067\u004B\u006F\u0069\u3059" +
- "\u308B\u0035\u79D2\u524D",
- "MajiKoi5-783gue6qz075azm5e",
- },
- {
- // (Q) <pafii>de<runba>
- "\u30D1\u30D5\u30A3\u30FC\u0064\u0065\u30EB\u30F3\u30D0",
- "de-jg4avhby1noc0d",
- },
- {
- // (R) <sono><supiido><de>
- "\u305D\u306E\u30B9\u30D4\u30FC\u30C9\u3067",
- "d9juau41awczczp",
- },
- {
- // (S) -> $1.00 <-
- "\u002D\u003E\u0020\u0024\u0031\u002E\u0030\u0030\u0020" +
- "\u003C\u002D",
- "-> $1.00 <--",
- },
-}
-
-func TestPunycode(t *testing.T) {
- for _, tc := range punycodeTestCases {
- if got, err := decode(tc.encoded); err != nil {
- t.Errorf("decode(%q): %v", tc.encoded, err)
- } else if got != tc.s {
- t.Errorf("decode(%q): got %q, want %q", tc.encoded, got, tc.s)
- }
-
- if got, err := encode("", tc.s); err != nil {
- t.Errorf(`encode("", %q): %v`, tc.s, err)
- } else if got != tc.encoded {
- t.Errorf(`encode("", %q): got %q, want %q`, tc.s, got, tc.encoded)
- }
- }
-}
-
-var punycodeErrorTestCases = [...]string{
- "decode -", // A sole '-' is invalid.
- "decode foo\x00bar", // '\x00' is not in [0-9A-Za-z].
- "decode foo#bar", // '#' is not in [0-9A-Za-z].
- "decode foo\u00A3bar", // '\u00A3' is not in [0-9A-Za-z].
- "decode 9", // "9a" decodes to codepoint \u00A3; "9" is truncated.
- "decode 99999a", // "99999a" decodes to codepoint \U0048A3C1, which is > \U0010FFFF.
- "decode 9999999999a", // "9999999999a" overflows the int32 calculation.
-
- "encode " + strings.Repeat("x", 65536) + "\uff00", // int32 overflow.
-}
-
-func TestPunycodeErrors(t *testing.T) {
- for _, tc := range punycodeErrorTestCases {
- var err error
- switch {
- case strings.HasPrefix(tc, "decode "):
- _, err = decode(tc[7:])
- case strings.HasPrefix(tc, "encode "):
- _, err = encode("", tc[7:])
- }
- if err == nil {
- if len(tc) > 256 {
- tc = tc[:100] + "..." + tc[len(tc)-100:]
- }
- t.Errorf("no error for %s", tc)
- }
- }
-}
diff --git a/vendor/golang.org/x/net/internal/timeseries/timeseries_test.go b/vendor/golang.org/x/net/internal/timeseries/timeseries_test.go
deleted file mode 100644
index 66325a912..000000000
--- a/vendor/golang.org/x/net/internal/timeseries/timeseries_test.go
+++ /dev/null
@@ -1,170 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package timeseries
-
-import (
- "math"
- "testing"
- "time"
-)
-
-func isNear(x *Float, y float64, tolerance float64) bool {
- return math.Abs(x.Value()-y) < tolerance
-}
-
-func isApproximate(x *Float, y float64) bool {
- return isNear(x, y, 1e-2)
-}
-
-func checkApproximate(t *testing.T, o Observable, y float64) {
- x := o.(*Float)
- if !isApproximate(x, y) {
- t.Errorf("Wanted %g, got %g", y, x.Value())
- }
-}
-
-func checkNear(t *testing.T, o Observable, y, tolerance float64) {
- x := o.(*Float)
- if !isNear(x, y, tolerance) {
- t.Errorf("Wanted %g +- %g, got %g", y, tolerance, x.Value())
- }
-}
-
-var baseTime = time.Date(2013, 1, 1, 0, 0, 0, 0, time.UTC)
-
-func tu(s int64) time.Time {
- return baseTime.Add(time.Duration(s) * time.Second)
-}
-
-func tu2(s int64, ns int64) time.Time {
- return baseTime.Add(time.Duration(s)*time.Second + time.Duration(ns)*time.Nanosecond)
-}
-
-func TestBasicTimeSeries(t *testing.T) {
- ts := NewTimeSeries(NewFloat)
- fo := new(Float)
- *fo = Float(10)
- ts.AddWithTime(fo, tu(1))
- ts.AddWithTime(fo, tu(1))
- ts.AddWithTime(fo, tu(1))
- ts.AddWithTime(fo, tu(1))
- checkApproximate(t, ts.Range(tu(0), tu(1)), 40)
- checkApproximate(t, ts.Total(), 40)
- ts.AddWithTime(fo, tu(3))
- ts.AddWithTime(fo, tu(3))
- ts.AddWithTime(fo, tu(3))
- checkApproximate(t, ts.Range(tu(0), tu(2)), 40)
- checkApproximate(t, ts.Range(tu(2), tu(4)), 30)
- checkApproximate(t, ts.Total(), 70)
- ts.AddWithTime(fo, tu(1))
- ts.AddWithTime(fo, tu(1))
- checkApproximate(t, ts.Range(tu(0), tu(2)), 60)
- checkApproximate(t, ts.Range(tu(2), tu(4)), 30)
- checkApproximate(t, ts.Total(), 90)
- *fo = Float(100)
- ts.AddWithTime(fo, tu(100))
- checkApproximate(t, ts.Range(tu(99), tu(100)), 100)
- checkApproximate(t, ts.Range(tu(0), tu(4)), 36)
- checkApproximate(t, ts.Total(), 190)
- *fo = Float(10)
- ts.AddWithTime(fo, tu(1))
- ts.AddWithTime(fo, tu(1))
- checkApproximate(t, ts.Range(tu(0), tu(4)), 44)
- checkApproximate(t, ts.Range(tu(37), tu2(100, 100e6)), 100)
- checkApproximate(t, ts.Range(tu(50), tu2(100, 100e6)), 100)
- checkApproximate(t, ts.Range(tu(99), tu2(100, 100e6)), 100)
- checkApproximate(t, ts.Total(), 210)
-
- for i, l := range ts.ComputeRange(tu(36), tu(100), 64) {
- if i == 63 {
- checkApproximate(t, l, 100)
- } else {
- checkApproximate(t, l, 0)
- }
- }
-
- checkApproximate(t, ts.Range(tu(0), tu(100)), 210)
- checkApproximate(t, ts.Range(tu(10), tu(100)), 100)
-
- for i, l := range ts.ComputeRange(tu(0), tu(100), 100) {
- if i < 10 {
- checkApproximate(t, l, 11)
- } else if i >= 90 {
- checkApproximate(t, l, 10)
- } else {
- checkApproximate(t, l, 0)
- }
- }
-}
-
-func TestFloat(t *testing.T) {
- f := Float(1)
- if g, w := f.String(), "1"; g != w {
- t.Errorf("Float(1).String = %q; want %q", g, w)
- }
- f2 := Float(2)
- var o Observable = &f2
- f.Add(o)
- if g, w := f.Value(), 3.0; g != w {
- t.Errorf("Float post-add = %v; want %v", g, w)
- }
- f.Multiply(2)
- if g, w := f.Value(), 6.0; g != w {
- t.Errorf("Float post-multiply = %v; want %v", g, w)
- }
- f.Clear()
- if g, w := f.Value(), 0.0; g != w {
- t.Errorf("Float post-clear = %v; want %v", g, w)
- }
- f.CopyFrom(&f2)
- if g, w := f.Value(), 2.0; g != w {
- t.Errorf("Float post-CopyFrom = %v; want %v", g, w)
- }
-}
-
-type mockClock struct {
- time time.Time
-}
-
-func (m *mockClock) Time() time.Time { return m.time }
-func (m *mockClock) Set(t time.Time) { m.time = t }
-
-const buckets = 6
-
-var testResolutions = []time.Duration{
- 10 * time.Second, // level holds one minute of observations
- 100 * time.Second, // level holds ten minutes of observations
- 10 * time.Minute, // level holds one hour of observations
-}
-
-// TestTimeSeries uses a small number of buckets to force a higher
-// error rate on approximations from the timeseries.
-type TestTimeSeries struct {
- timeSeries
-}
-
-func TestExpectedErrorRate(t *testing.T) {
- ts := new(TestTimeSeries)
- fake := new(mockClock)
- fake.Set(time.Now())
- ts.timeSeries.init(testResolutions, NewFloat, buckets, fake)
- for i := 1; i <= 61*61; i++ {
- fake.Set(fake.Time().Add(1 * time.Second))
- ob := Float(1)
- ts.AddWithTime(&ob, fake.Time())
-
- // The results should be accurate within one missing bucket (1/6) of the observations recorded.
- checkNear(t, ts.Latest(0, buckets), min(float64(i), 60), 10)
- checkNear(t, ts.Latest(1, buckets), min(float64(i), 600), 100)
- checkNear(t, ts.Latest(2, buckets), min(float64(i), 3600), 600)
- }
-}
-
-func min(a, b float64) float64 {
- if a < b {
- return a
- }
- return b
-}
diff --git a/vendor/golang.org/x/net/trace/histogram_test.go b/vendor/golang.org/x/net/trace/histogram_test.go
deleted file mode 100644
index d384b9332..000000000
--- a/vendor/golang.org/x/net/trace/histogram_test.go
+++ /dev/null
@@ -1,325 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package trace
-
-import (
- "math"
- "testing"
-)
-
-type sumTest struct {
- value int64
- sum int64
- sumOfSquares float64
- total int64
-}
-
-var sumTests = []sumTest{
- {100, 100, 10000, 1},
- {50, 150, 12500, 2},
- {50, 200, 15000, 3},
- {50, 250, 17500, 4},
-}
-
-type bucketingTest struct {
- in int64
- log int
- bucket int
-}
-
-var bucketingTests = []bucketingTest{
- {0, 0, 0},
- {1, 1, 0},
- {2, 2, 1},
- {3, 2, 1},
- {4, 3, 2},
- {1000, 10, 9},
- {1023, 10, 9},
- {1024, 11, 10},
- {1000000, 20, 19},
-}
-
-type multiplyTest struct {
- in int64
- ratio float64
- expectedSum int64
- expectedTotal int64
- expectedSumOfSquares float64
-}
-
-var multiplyTests = []multiplyTest{
- {15, 2.5, 37, 2, 562.5},
- {128, 4.6, 758, 13, 77953.9},
-}
-
-type percentileTest struct {
- fraction float64
- expected int64
-}
-
-var percentileTests = []percentileTest{
- {0.25, 48},
- {0.5, 96},
- {0.6, 109},
- {0.75, 128},
- {0.90, 205},
- {0.95, 230},
- {0.99, 256},
-}
-
-func TestSum(t *testing.T) {
- var h histogram
-
- for _, test := range sumTests {
- h.addMeasurement(test.value)
- sum := h.sum
- if sum != test.sum {
- t.Errorf("h.Sum = %v WANT: %v", sum, test.sum)
- }
-
- sumOfSquares := h.sumOfSquares
- if sumOfSquares != test.sumOfSquares {
- t.Errorf("h.SumOfSquares = %v WANT: %v", sumOfSquares, test.sumOfSquares)
- }
-
- total := h.total()
- if total != test.total {
- t.Errorf("h.Total = %v WANT: %v", total, test.total)
- }
- }
-}
-
-func TestMultiply(t *testing.T) {
- var h histogram
- for i, test := range multiplyTests {
- h.addMeasurement(test.in)
- h.Multiply(test.ratio)
- if h.sum != test.expectedSum {
- t.Errorf("#%v: h.sum = %v WANT: %v", i, h.sum, test.expectedSum)
- }
- if h.total() != test.expectedTotal {
- t.Errorf("#%v: h.total = %v WANT: %v", i, h.total(), test.expectedTotal)
- }
- if h.sumOfSquares != test.expectedSumOfSquares {
- t.Errorf("#%v: h.SumOfSquares = %v WANT: %v", i, test.expectedSumOfSquares, h.sumOfSquares)
- }
- }
-}
-
-func TestBucketingFunctions(t *testing.T) {
- for _, test := range bucketingTests {
- log := log2(test.in)
- if log != test.log {
- t.Errorf("log2 = %v WANT: %v", log, test.log)
- }
-
- bucket := getBucket(test.in)
- if bucket != test.bucket {
- t.Errorf("getBucket = %v WANT: %v", bucket, test.bucket)
- }
- }
-}
-
-func TestAverage(t *testing.T) {
- a := new(histogram)
- average := a.average()
- if average != 0 {
- t.Errorf("Average of empty histogram was %v WANT: 0", average)
- }
-
- a.addMeasurement(1)
- a.addMeasurement(1)
- a.addMeasurement(3)
- const expected = float64(5) / float64(3)
- average = a.average()
-
- if !isApproximate(average, expected) {
- t.Errorf("Average = %g WANT: %v", average, expected)
- }
-}
-
-func TestStandardDeviation(t *testing.T) {
- a := new(histogram)
- add(a, 10, 1<<4)
- add(a, 10, 1<<5)
- add(a, 10, 1<<6)
- stdDev := a.standardDeviation()
- const expected = 19.95
-
- if !isApproximate(stdDev, expected) {
- t.Errorf("StandardDeviation = %v WANT: %v", stdDev, expected)
- }
-
- // No values
- a = new(histogram)
- stdDev = a.standardDeviation()
-
- if !isApproximate(stdDev, 0) {
- t.Errorf("StandardDeviation = %v WANT: 0", stdDev)
- }
-
- add(a, 1, 1<<4)
- if !isApproximate(stdDev, 0) {
- t.Errorf("StandardDeviation = %v WANT: 0", stdDev)
- }
-
- add(a, 10, 1<<4)
- if !isApproximate(stdDev, 0) {
- t.Errorf("StandardDeviation = %v WANT: 0", stdDev)
- }
-}
-
-func TestPercentileBoundary(t *testing.T) {
- a := new(histogram)
- add(a, 5, 1<<4)
- add(a, 10, 1<<6)
- add(a, 5, 1<<7)
-
- for _, test := range percentileTests {
- percentile := a.percentileBoundary(test.fraction)
- if percentile != test.expected {
- t.Errorf("h.PercentileBoundary (fraction=%v) = %v WANT: %v", test.fraction, percentile, test.expected)
- }
- }
-}
-
-func TestCopyFrom(t *testing.T) {
- a := histogram{5, 25, []int64{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
- 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38}, 4, -1}
- b := histogram{6, 36, []int64{2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
- 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39}, 5, -1}
-
- a.CopyFrom(&b)
-
- if a.String() != b.String() {
- t.Errorf("a.String = %s WANT: %s", a.String(), b.String())
- }
-}
-
-func TestClear(t *testing.T) {
- a := histogram{5, 25, []int64{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
- 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38}, 4, -1}
-
- a.Clear()
-
- expected := "0, 0.000000, 0, 0, []"
- if a.String() != expected {
- t.Errorf("a.String = %s WANT %s", a.String(), expected)
- }
-}
-
-func TestNew(t *testing.T) {
- a := histogram{5, 25, []int64{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
- 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38}, 4, -1}
- b := a.New()
-
- expected := "0, 0.000000, 0, 0, []"
- if b.(*histogram).String() != expected {
- t.Errorf("b.(*histogram).String = %s WANT: %s", b.(*histogram).String(), expected)
- }
-}
-
-func TestAdd(t *testing.T) {
- // The tests here depend on the associativity of addMeasurement and Add.
- // Add empty observation
- a := histogram{5, 25, []int64{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
- 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38}, 4, -1}
- b := a.New()
-
- expected := a.String()
- a.Add(b)
- if a.String() != expected {
- t.Errorf("a.String = %s WANT: %s", a.String(), expected)
- }
-
- // Add same bucketed value, no new buckets
- c := new(histogram)
- d := new(histogram)
- e := new(histogram)
- c.addMeasurement(12)
- d.addMeasurement(11)
- e.addMeasurement(12)
- e.addMeasurement(11)
- c.Add(d)
- if c.String() != e.String() {
- t.Errorf("c.String = %s WANT: %s", c.String(), e.String())
- }
-
- // Add bucketed values
- f := new(histogram)
- g := new(histogram)
- h := new(histogram)
- f.addMeasurement(4)
- f.addMeasurement(12)
- f.addMeasurement(100)
- g.addMeasurement(18)
- g.addMeasurement(36)
- g.addMeasurement(255)
- h.addMeasurement(4)
- h.addMeasurement(12)
- h.addMeasurement(100)
- h.addMeasurement(18)
- h.addMeasurement(36)
- h.addMeasurement(255)
- f.Add(g)
- if f.String() != h.String() {
- t.Errorf("f.String = %q WANT: %q", f.String(), h.String())
- }
-
- // add buckets to no buckets
- i := new(histogram)
- j := new(histogram)
- k := new(histogram)
- j.addMeasurement(18)
- j.addMeasurement(36)
- j.addMeasurement(255)
- k.addMeasurement(18)
- k.addMeasurement(36)
- k.addMeasurement(255)
- i.Add(j)
- if i.String() != k.String() {
- t.Errorf("i.String = %q WANT: %q", i.String(), k.String())
- }
-
- // add buckets to single value (no overlap)
- l := new(histogram)
- m := new(histogram)
- n := new(histogram)
- l.addMeasurement(0)
- m.addMeasurement(18)
- m.addMeasurement(36)
- m.addMeasurement(255)
- n.addMeasurement(0)
- n.addMeasurement(18)
- n.addMeasurement(36)
- n.addMeasurement(255)
- l.Add(m)
- if l.String() != n.String() {
- t.Errorf("l.String = %q WANT: %q", l.String(), n.String())
- }
-
- // mixed order
- o := new(histogram)
- p := new(histogram)
- o.addMeasurement(0)
- o.addMeasurement(2)
- o.addMeasurement(0)
- p.addMeasurement(0)
- p.addMeasurement(0)
- p.addMeasurement(2)
- if o.String() != p.String() {
- t.Errorf("o.String = %q WANT: %q", o.String(), p.String())
- }
-}
-
-func add(h *histogram, times int, val int64) {
- for i := 0; i < times; i++ {
- h.addMeasurement(val)
- }
-}
-
-func isApproximate(x, y float64) bool {
- return math.Abs(x-y) < 1e-2
-}
diff --git a/vendor/golang.org/x/net/trace/trace_test.go b/vendor/golang.org/x/net/trace/trace_test.go
deleted file mode 100644
index bfd9dfe94..000000000
--- a/vendor/golang.org/x/net/trace/trace_test.go
+++ /dev/null
@@ -1,178 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package trace
-
-import (
- "net/http"
- "reflect"
- "testing"
-)
-
-type s struct{}
-
-func (s) String() string { return "lazy string" }
-
-// TestReset checks whether all the fields are zeroed after reset.
-func TestReset(t *testing.T) {
- tr := New("foo", "bar")
- tr.LazyLog(s{}, false)
- tr.LazyPrintf("%d", 1)
- tr.SetRecycler(func(_ interface{}) {})
- tr.SetTraceInfo(3, 4)
- tr.SetMaxEvents(100)
- tr.SetError()
- tr.Finish()
-
- tr.(*trace).reset()
-
- if !reflect.DeepEqual(tr, new(trace)) {
- t.Errorf("reset didn't clear all fields: %+v", tr)
- }
-}
-
-// TestResetLog checks whether all the fields are zeroed after reset.
-func TestResetLog(t *testing.T) {
- el := NewEventLog("foo", "bar")
- el.Printf("message")
- el.Errorf("error")
- el.Finish()
-
- el.(*eventLog).reset()
-
- if !reflect.DeepEqual(el, new(eventLog)) {
- t.Errorf("reset didn't clear all fields: %+v", el)
- }
-}
-
-func TestAuthRequest(t *testing.T) {
- testCases := []struct {
- host string
- want bool
- }{
- {host: "192.168.23.1", want: false},
- {host: "192.168.23.1:8080", want: false},
- {host: "malformed remote addr", want: false},
- {host: "localhost", want: true},
- {host: "localhost:8080", want: true},
- {host: "127.0.0.1", want: true},
- {host: "127.0.0.1:8080", want: true},
- {host: "::1", want: true},
- {host: "[::1]:8080", want: true},
- }
- for _, tt := range testCases {
- req := &http.Request{RemoteAddr: tt.host}
- any, sensitive := AuthRequest(req)
- if any != tt.want || sensitive != tt.want {
- t.Errorf("AuthRequest(%q) = %t, %t; want %t, %t", tt.host, any, sensitive, tt.want, tt.want)
- }
- }
-}
-
-// TestParseTemplate checks that all templates used by this package are valid
-// as they are parsed on first usage
-func TestParseTemplate(t *testing.T) {
- if tmpl := distTmpl(); tmpl == nil {
- t.Error("invalid template returned from distTmpl()")
- }
- if tmpl := pageTmpl(); tmpl == nil {
- t.Error("invalid template returned from pageTmpl()")
- }
- if tmpl := eventsTmpl(); tmpl == nil {
- t.Error("invalid template returned from eventsTmpl()")
- }
-}
-
-func benchmarkTrace(b *testing.B, maxEvents, numEvents int) {
- numSpans := (b.N + numEvents + 1) / numEvents
-
- for i := 0; i < numSpans; i++ {
- tr := New("test", "test")
- tr.SetMaxEvents(maxEvents)
- for j := 0; j < numEvents; j++ {
- tr.LazyPrintf("%d", j)
- }
- tr.Finish()
- }
-}
-
-func BenchmarkTrace_Default_2(b *testing.B) {
- benchmarkTrace(b, 0, 2)
-}
-
-func BenchmarkTrace_Default_10(b *testing.B) {
- benchmarkTrace(b, 0, 10)
-}
-
-func BenchmarkTrace_Default_100(b *testing.B) {
- benchmarkTrace(b, 0, 100)
-}
-
-func BenchmarkTrace_Default_1000(b *testing.B) {
- benchmarkTrace(b, 0, 1000)
-}
-
-func BenchmarkTrace_Default_10000(b *testing.B) {
- benchmarkTrace(b, 0, 10000)
-}
-
-func BenchmarkTrace_10_2(b *testing.B) {
- benchmarkTrace(b, 10, 2)
-}
-
-func BenchmarkTrace_10_10(b *testing.B) {
- benchmarkTrace(b, 10, 10)
-}
-
-func BenchmarkTrace_10_100(b *testing.B) {
- benchmarkTrace(b, 10, 100)
-}
-
-func BenchmarkTrace_10_1000(b *testing.B) {
- benchmarkTrace(b, 10, 1000)
-}
-
-func BenchmarkTrace_10_10000(b *testing.B) {
- benchmarkTrace(b, 10, 10000)
-}
-
-func BenchmarkTrace_100_2(b *testing.B) {
- benchmarkTrace(b, 100, 2)
-}
-
-func BenchmarkTrace_100_10(b *testing.B) {
- benchmarkTrace(b, 100, 10)
-}
-
-func BenchmarkTrace_100_100(b *testing.B) {
- benchmarkTrace(b, 100, 100)
-}
-
-func BenchmarkTrace_100_1000(b *testing.B) {
- benchmarkTrace(b, 100, 1000)
-}
-
-func BenchmarkTrace_100_10000(b *testing.B) {
- benchmarkTrace(b, 100, 10000)
-}
-
-func BenchmarkTrace_1000_2(b *testing.B) {
- benchmarkTrace(b, 1000, 2)
-}
-
-func BenchmarkTrace_1000_10(b *testing.B) {
- benchmarkTrace(b, 1000, 10)
-}
-
-func BenchmarkTrace_1000_100(b *testing.B) {
- benchmarkTrace(b, 1000, 100)
-}
-
-func BenchmarkTrace_1000_1000(b *testing.B) {
- benchmarkTrace(b, 1000, 1000)
-}
-
-func BenchmarkTrace_1000_10000(b *testing.B) {
- benchmarkTrace(b, 1000, 10000)
-}
diff --git a/vendor/golang.org/x/sys/unix/creds_test.go b/vendor/golang.org/x/sys/unix/creds_test.go
deleted file mode 100644
index 1b5083196..000000000
--- a/vendor/golang.org/x/sys/unix/creds_test.go
+++ /dev/null
@@ -1,134 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build linux
-
-package unix_test
-
-import (
- "bytes"
- "go/build"
- "net"
- "os"
- "testing"
-
- "golang.org/x/sys/unix"
-)
-
-// TestSCMCredentials tests the sending and receiving of credentials
-// (PID, UID, GID) in an ancillary message between two UNIX
-// sockets. The SO_PASSCRED socket option is enabled on the sending
-// socket for this to work.
-func TestSCMCredentials(t *testing.T) {
- socketTypeTests := []struct {
- socketType int
- dataLen int
- }{
- {
- unix.SOCK_STREAM,
- 1,
- }, {
- unix.SOCK_DGRAM,
- 0,
- },
- }
-
- for _, tt := range socketTypeTests {
- if tt.socketType == unix.SOCK_DGRAM && !atLeast1p10() {
- t.Log("skipping DGRAM test on pre-1.10")
- continue
- }
-
- fds, err := unix.Socketpair(unix.AF_LOCAL, tt.socketType, 0)
- if err != nil {
- t.Fatalf("Socketpair: %v", err)
- }
- defer unix.Close(fds[0])
- defer unix.Close(fds[1])
-
- err = unix.SetsockoptInt(fds[0], unix.SOL_SOCKET, unix.SO_PASSCRED, 1)
- if err != nil {
- t.Fatalf("SetsockoptInt: %v", err)
- }
-
- srvFile := os.NewFile(uintptr(fds[0]), "server")
- defer srvFile.Close()
- srv, err := net.FileConn(srvFile)
- if err != nil {
- t.Errorf("FileConn: %v", err)
- return
- }
- defer srv.Close()
-
- cliFile := os.NewFile(uintptr(fds[1]), "client")
- defer cliFile.Close()
- cli, err := net.FileConn(cliFile)
- if err != nil {
- t.Errorf("FileConn: %v", err)
- return
- }
- defer cli.Close()
-
- var ucred unix.Ucred
- ucred.Pid = int32(os.Getpid())
- ucred.Uid = uint32(os.Getuid())
- ucred.Gid = uint32(os.Getgid())
- oob := unix.UnixCredentials(&ucred)
-
- // On SOCK_STREAM, this is internally going to send a dummy byte
- n, oobn, err := cli.(*net.UnixConn).WriteMsgUnix(nil, oob, nil)
- if err != nil {
- t.Fatalf("WriteMsgUnix: %v", err)
- }
- if n != 0 {
- t.Fatalf("WriteMsgUnix n = %d, want 0", n)
- }
- if oobn != len(oob) {
- t.Fatalf("WriteMsgUnix oobn = %d, want %d", oobn, len(oob))
- }
-
- oob2 := make([]byte, 10*len(oob))
- n, oobn2, flags, _, err := srv.(*net.UnixConn).ReadMsgUnix(nil, oob2)
- if err != nil {
- t.Fatalf("ReadMsgUnix: %v", err)
- }
- if flags != 0 {
- t.Fatalf("ReadMsgUnix flags = 0x%x, want 0", flags)
- }
- if n != tt.dataLen {
- t.Fatalf("ReadMsgUnix n = %d, want %d", n, tt.dataLen)
- }
- if oobn2 != oobn {
- // without SO_PASSCRED set on the socket, ReadMsgUnix will
- // return zero oob bytes
- t.Fatalf("ReadMsgUnix oobn = %d, want %d", oobn2, oobn)
- }
- oob2 = oob2[:oobn2]
- if !bytes.Equal(oob, oob2) {
- t.Fatal("ReadMsgUnix oob bytes don't match")
- }
-
- scm, err := unix.ParseSocketControlMessage(oob2)
- if err != nil {
- t.Fatalf("ParseSocketControlMessage: %v", err)
- }
- newUcred, err := unix.ParseUnixCredentials(&scm[0])
- if err != nil {
- t.Fatalf("ParseUnixCredentials: %v", err)
- }
- if *newUcred != ucred {
- t.Fatalf("ParseUnixCredentials = %+v, want %+v", newUcred, ucred)
- }
- }
-}
-
-// atLeast1p10 reports whether we are running on Go 1.10 or later.
-func atLeast1p10() bool {
- for _, ver := range build.Default.ReleaseTags {
- if ver == "go1.10" {
- return true
- }
- }
- return false
-}
diff --git a/vendor/golang.org/x/sys/unix/dev_linux_test.go b/vendor/golang.org/x/sys/unix/dev_linux_test.go
deleted file mode 100644
index 51645289c..000000000
--- a/vendor/golang.org/x/sys/unix/dev_linux_test.go
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.7
-
-package unix_test
-
-import (
- "fmt"
- "testing"
-
- "golang.org/x/sys/unix"
-)
-
-func TestDevices(t *testing.T) {
- testCases := []struct {
- path string
- major uint32
- minor uint32
- }{
- // well known major/minor numbers according to
- // https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/admin-guide/devices.txt
- {"/dev/null", 1, 3},
- {"/dev/zero", 1, 5},
- {"/dev/random", 1, 8},
- {"/dev/full", 1, 7},
- {"/dev/urandom", 1, 9},
- {"/dev/tty", 5, 0},
- }
- for _, tc := range testCases {
- t.Run(fmt.Sprintf("%s %v:%v", tc.path, tc.major, tc.minor), func(t *testing.T) {
- var stat unix.Stat_t
- err := unix.Stat(tc.path, &stat)
- if err != nil {
- if err == unix.EACCES {
- t.Skip("no permission to stat device, skipping test")
- }
- t.Errorf("failed to stat device: %v", err)
- return
- }
-
- dev := uint64(stat.Rdev)
- if unix.Major(dev) != tc.major {
- t.Errorf("for %s Major(%#x) == %d, want %d", tc.path, dev, unix.Major(dev), tc.major)
- }
- if unix.Minor(dev) != tc.minor {
- t.Errorf("for %s Minor(%#x) == %d, want %d", tc.path, dev, unix.Minor(dev), tc.minor)
- }
- if unix.Mkdev(tc.major, tc.minor) != dev {
- t.Errorf("for %s Mkdev(%d, %d) == %#x, want %#x", tc.path, tc.major, tc.minor, unix.Mkdev(tc.major, tc.minor), dev)
- }
- })
-
- }
-}
diff --git a/vendor/golang.org/x/sys/unix/example_test.go b/vendor/golang.org/x/sys/unix/example_test.go
deleted file mode 100644
index 10619afdd..000000000
--- a/vendor/golang.org/x/sys/unix/example_test.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd linux netbsd openbsd solaris
-
-package unix_test
-
-import (
- "log"
- "os"
-
- "golang.org/x/sys/unix"
-)
-
-func ExampleExec() {
- err := unix.Exec("/bin/ls", []string{"ls", "-al"}, os.Environ())
- log.Fatal(err)
-}
diff --git a/vendor/golang.org/x/sys/unix/export_test.go b/vendor/golang.org/x/sys/unix/export_test.go
deleted file mode 100644
index e8024690d..000000000
--- a/vendor/golang.org/x/sys/unix/export_test.go
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd linux netbsd openbsd solaris
-
-package unix
-
-var Itoa = itoa
diff --git a/vendor/golang.org/x/sys/unix/mmap_unix_test.go b/vendor/golang.org/x/sys/unix/mmap_unix_test.go
deleted file mode 100644
index 3258ca328..000000000
--- a/vendor/golang.org/x/sys/unix/mmap_unix_test.go
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd linux netbsd openbsd solaris
-
-package unix_test
-
-import (
- "testing"
-
- "golang.org/x/sys/unix"
-)
-
-func TestMmap(t *testing.T) {
- b, err := unix.Mmap(-1, 0, unix.Getpagesize(), unix.PROT_NONE, unix.MAP_ANON|unix.MAP_PRIVATE)
- if err != nil {
- t.Fatalf("Mmap: %v", err)
- }
- if err := unix.Mprotect(b, unix.PROT_READ|unix.PROT_WRITE); err != nil {
- t.Fatalf("Mprotect: %v", err)
- }
-
- b[0] = 42
-
- if err := unix.Msync(b, unix.MS_SYNC); err != nil {
- t.Fatalf("Msync: %v", err)
- }
- if err := unix.Madvise(b, unix.MADV_DONTNEED); err != nil {
- t.Fatalf("Madvise: %v", err)
- }
- if err := unix.Munmap(b); err != nil {
- t.Fatalf("Munmap: %v", err)
- }
-}
diff --git a/vendor/golang.org/x/sys/unix/openbsd_test.go b/vendor/golang.org/x/sys/unix/openbsd_test.go
deleted file mode 100644
index 734d76585..000000000
--- a/vendor/golang.org/x/sys/unix/openbsd_test.go
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build openbsd
-
-// This, on the face of it, bizarre testing mechanism is necessary because
-// the only reliable way to gauge whether or not a pledge(2) call has succeeded
-// is that the program has been killed as a result of breaking its pledge.
-
-package unix_test
-
-import (
- "flag"
- "fmt"
- "io/ioutil"
- "os"
- "os/exec"
- "path/filepath"
- "testing"
-
- "golang.org/x/sys/unix"
-)
-
-type testProc struct {
- fn func() // should always exit instead of returning
- cleanup func() error // for instance, delete coredumps from testing pledge
- success bool // whether zero-exit means success or failure
-}
-
-var (
- testProcs = map[string]testProc{}
- procName = ""
-)
-
-const (
- optName = "sys-unix-internal-procname"
-)
-
-func init() {
- flag.StringVar(&procName, optName, "", "internal use only")
-}
-
-// testCmd generates a proper command that, when executed, runs the test
-// corresponding to the given key.
-func testCmd(procName string) (*exec.Cmd, error) {
- exe, err := filepath.Abs(os.Args[0])
- if err != nil {
- return nil, err
- }
- cmd := exec.Command(exe, "-"+optName+"="+procName)
- cmd.Stdout, cmd.Stderr = os.Stdout, os.Stderr
- return cmd, nil
-}
-
-// ExitsCorrectly is a comprehensive, one-line-of-use wrapper for testing
-// a testProc with a key.
-func ExitsCorrectly(procName string, t *testing.T) {
- s := testProcs[procName]
- c, err := testCmd(procName)
- defer func() {
- if s.cleanup() != nil {
- t.Fatalf("Failed to run cleanup for %s", procName)
- }
- }()
- if err != nil {
- t.Fatalf("Failed to construct command for %s", procName)
- }
- if (c.Run() == nil) != s.success {
- result := "succeed"
- if !s.success {
- result = "fail"
- }
- t.Fatalf("Process did not %s when it was supposed to", result)
- }
-}
-
-func TestMain(m *testing.M) {
- flag.Parse()
- if procName != "" {
- testProcs[procName].fn()
- }
- os.Exit(m.Run())
-}
-
-// For example, add a test for pledge.
-func init() {
- testProcs["pledge"] = testProc{
- func() {
- fmt.Println(unix.Pledge("", nil))
- os.Exit(0)
- },
- func() error {
- files, err := ioutil.ReadDir(".")
- if err != nil {
- return err
- }
- for _, file := range files {
- if filepath.Ext(file.Name()) == ".core" {
- if err := os.Remove(file.Name()); err != nil {
- return err
- }
- }
- }
- return nil
- },
- false,
- }
-}
-
-func TestPledge(t *testing.T) {
- ExitsCorrectly("pledge", t)
-}
diff --git a/vendor/golang.org/x/sys/unix/syscall_bsd_test.go b/vendor/golang.org/x/sys/unix/syscall_bsd_test.go
deleted file mode 100644
index 6c4e2aca0..000000000
--- a/vendor/golang.org/x/sys/unix/syscall_bsd_test.go
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd openbsd
-
-package unix_test
-
-import (
- "os/exec"
- "runtime"
- "testing"
- "time"
-
- "golang.org/x/sys/unix"
-)
-
-const MNT_WAIT = 1
-const MNT_NOWAIT = 2
-
-func TestGetfsstat(t *testing.T) {
- const flags = MNT_NOWAIT // see golang.org/issue/16937
- n, err := unix.Getfsstat(nil, flags)
- if err != nil {
- t.Fatal(err)
- }
-
- data := make([]unix.Statfs_t, n)
- n2, err := unix.Getfsstat(data, flags)
- if err != nil {
- t.Fatal(err)
- }
- if n != n2 {
- t.Errorf("Getfsstat(nil) = %d, but subsequent Getfsstat(slice) = %d", n, n2)
- }
- for i, stat := range data {
- if stat == (unix.Statfs_t{}) {
- t.Errorf("index %v is an empty Statfs_t struct", i)
- }
- }
- if t.Failed() {
- for i, stat := range data[:n2] {
- t.Logf("data[%v] = %+v", i, stat)
- }
- mount, err := exec.Command("mount").CombinedOutput()
- if err != nil {
- t.Logf("mount: %v\n%s", err, mount)
- } else {
- t.Logf("mount: %s", mount)
- }
- }
-}
-
-func TestSelect(t *testing.T) {
- err := unix.Select(0, nil, nil, nil, &unix.Timeval{Sec: 0, Usec: 0})
- if err != nil {
- t.Fatalf("Select: %v", err)
- }
-
- dur := 250 * time.Millisecond
- tv := unix.NsecToTimeval(int64(dur))
- start := time.Now()
- err = unix.Select(0, nil, nil, nil, &tv)
- took := time.Since(start)
- if err != nil {
- t.Fatalf("Select: %v", err)
- }
-
- // On some BSDs the actual timeout might also be slightly less than the requested.
- // Add an acceptable margin to avoid flaky tests.
- if took < dur*2/3 {
- t.Errorf("Select: timeout should have been at least %v, got %v", dur, took)
- }
-}
-
-func TestSysctlRaw(t *testing.T) {
- if runtime.GOOS == "openbsd" {
- t.Skip("kern.proc.pid does not exist on OpenBSD")
- }
-
- _, err := unix.SysctlRaw("kern.proc.pid", unix.Getpid())
- if err != nil {
- t.Fatal(err)
- }
-}
-
-func TestSysctlUint32(t *testing.T) {
- maxproc, err := unix.SysctlUint32("kern.maxproc")
- if err != nil {
- t.Fatal(err)
- }
- t.Logf("kern.maxproc: %v", maxproc)
-}
diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_test.go b/vendor/golang.org/x/sys/unix/syscall_darwin_test.go
deleted file mode 100644
index 65691d5c1..000000000
--- a/vendor/golang.org/x/sys/unix/syscall_darwin_test.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package unix_test
-
-// stringsFromByteSlice converts a sequence of attributes to a []string.
-// On Darwin, each entry is a NULL-terminated string.
-func stringsFromByteSlice(buf []byte) []string {
- var result []string
- off := 0
- for i, b := range buf {
- if b == 0 {
- result = append(result, string(buf[off:i]))
- off = i + 1
- }
- }
- return result
-}
diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_test.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_test.go
deleted file mode 100644
index 0fec1a827..000000000
--- a/vendor/golang.org/x/sys/unix/syscall_freebsd_test.go
+++ /dev/null
@@ -1,312 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build freebsd
-
-package unix_test
-
-import (
- "flag"
- "fmt"
- "io/ioutil"
- "os"
- "os/exec"
- "path"
- "path/filepath"
- "runtime"
- "testing"
-
- "golang.org/x/sys/unix"
-)
-
-func TestSysctlUint64(t *testing.T) {
- _, err := unix.SysctlUint64("vm.swap_total")
- if err != nil {
- t.Fatal(err)
- }
-}
-
-// FIXME: Infrastructure for launching tests in subprocesses stolen from openbsd_test.go - refactor?
-// testCmd generates a proper command that, when executed, runs the test
-// corresponding to the given key.
-
-type testProc struct {
- fn func() // should always exit instead of returning
- arg func(t *testing.T) string // generate argument for test
- cleanup func(arg string) error // for instance, delete coredumps from testing pledge
- success bool // whether zero-exit means success or failure
-}
-
-var (
- testProcs = map[string]testProc{}
- procName = ""
- procArg = ""
-)
-
-const (
- optName = "sys-unix-internal-procname"
- optArg = "sys-unix-internal-arg"
-)
-
-func init() {
- flag.StringVar(&procName, optName, "", "internal use only")
- flag.StringVar(&procArg, optArg, "", "internal use only")
-
-}
-
-func testCmd(procName string, procArg string) (*exec.Cmd, error) {
- exe, err := filepath.Abs(os.Args[0])
- if err != nil {
- return nil, err
- }
- cmd := exec.Command(exe, "-"+optName+"="+procName, "-"+optArg+"="+procArg)
- cmd.Stdout, cmd.Stderr = os.Stdout, os.Stderr
- return cmd, nil
-}
-
-// ExitsCorrectly is a comprehensive, one-line-of-use wrapper for testing
-// a testProc with a key.
-func ExitsCorrectly(t *testing.T, procName string) {
- s := testProcs[procName]
- arg := "-"
- if s.arg != nil {
- arg = s.arg(t)
- }
- c, err := testCmd(procName, arg)
- defer func(arg string) {
- if err := s.cleanup(arg); err != nil {
- t.Fatalf("Failed to run cleanup for %s %s %#v", procName, err, err)
- }
- }(arg)
- if err != nil {
- t.Fatalf("Failed to construct command for %s", procName)
- }
- if (c.Run() == nil) != s.success {
- result := "succeed"
- if !s.success {
- result = "fail"
- }
- t.Fatalf("Process did not %s when it was supposed to", result)
- }
-}
-
-func TestMain(m *testing.M) {
- flag.Parse()
- if procName != "" {
- t := testProcs[procName]
- t.fn()
- os.Stderr.WriteString("test function did not exit\n")
- if t.success {
- os.Exit(1)
- } else {
- os.Exit(0)
- }
- }
- os.Exit(m.Run())
-}
-
-// end of infrastructure
-
-const testfile = "gocapmodetest"
-const testfile2 = testfile + "2"
-
-func CapEnterTest() {
- _, err := os.OpenFile(path.Join(procArg, testfile), os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666)
- if err != nil {
- panic(fmt.Sprintf("OpenFile: %s", err))
- }
-
- err = unix.CapEnter()
- if err != nil {
- panic(fmt.Sprintf("CapEnter: %s", err))
- }
-
- _, err = os.OpenFile(path.Join(procArg, testfile2), os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666)
- if err == nil {
- panic("OpenFile works!")
- }
- if err.(*os.PathError).Err != unix.ECAPMODE {
- panic(fmt.Sprintf("OpenFile failed wrong: %s %#v", err, err))
- }
- os.Exit(0)
-}
-
-func makeTempDir(t *testing.T) string {
- d, err := ioutil.TempDir("", "go_openat_test")
- if err != nil {
- t.Fatalf("TempDir failed: %s", err)
- }
- return d
-}
-
-func removeTempDir(arg string) error {
- err := os.RemoveAll(arg)
- if err != nil && err.(*os.PathError).Err == unix.ENOENT {
- return nil
- }
- return err
-}
-
-func init() {
- testProcs["cap_enter"] = testProc{
- CapEnterTest,
- makeTempDir,
- removeTempDir,
- true,
- }
-}
-
-func TestCapEnter(t *testing.T) {
- if runtime.GOARCH != "amd64" {
- t.Skipf("skipping test on %s", runtime.GOARCH)
- }
- ExitsCorrectly(t, "cap_enter")
-}
-
-func OpenatTest() {
- f, err := os.Open(procArg)
- if err != nil {
- panic(err)
- }
-
- err = unix.CapEnter()
- if err != nil {
- panic(fmt.Sprintf("CapEnter: %s", err))
- }
-
- fxx, err := unix.Openat(int(f.Fd()), "xx", os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666)
- if err != nil {
- panic(err)
- }
- unix.Close(fxx)
-
- // The right to open BASE/xx is not ambient
- _, err = os.OpenFile(procArg+"/xx", os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666)
- if err == nil {
- panic("OpenFile succeeded")
- }
- if err.(*os.PathError).Err != unix.ECAPMODE {
- panic(fmt.Sprintf("OpenFile failed wrong: %s %#v", err, err))
- }
-
- // Can't make a new directory either
- err = os.Mkdir(procArg+"2", 0777)
- if err == nil {
- panic("MKdir succeeded")
- }
- if err.(*os.PathError).Err != unix.ECAPMODE {
- panic(fmt.Sprintf("Mkdir failed wrong: %s %#v", err, err))
- }
-
- // Remove all caps except read and lookup.
- r, err := unix.CapRightsInit([]uint64{unix.CAP_READ, unix.CAP_LOOKUP})
- if err != nil {
- panic(fmt.Sprintf("CapRightsInit failed: %s %#v", err, err))
- }
- err = unix.CapRightsLimit(f.Fd(), r)
- if err != nil {
- panic(fmt.Sprintf("CapRightsLimit failed: %s %#v", err, err))
- }
-
- // Check we can get the rights back again
- r, err = unix.CapRightsGet(f.Fd())
- if err != nil {
- panic(fmt.Sprintf("CapRightsGet failed: %s %#v", err, err))
- }
- b, err := unix.CapRightsIsSet(r, []uint64{unix.CAP_READ, unix.CAP_LOOKUP})
- if err != nil {
- panic(fmt.Sprintf("CapRightsIsSet failed: %s %#v", err, err))
- }
- if !b {
- panic(fmt.Sprintf("Unexpected rights"))
- }
- b, err = unix.CapRightsIsSet(r, []uint64{unix.CAP_READ, unix.CAP_LOOKUP, unix.CAP_WRITE})
- if err != nil {
- panic(fmt.Sprintf("CapRightsIsSet failed: %s %#v", err, err))
- }
- if b {
- panic(fmt.Sprintf("Unexpected rights (2)"))
- }
-
- // Can no longer create a file
- _, err = unix.Openat(int(f.Fd()), "xx2", os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666)
- if err == nil {
- panic("Openat succeeded")
- }
- if err != unix.ENOTCAPABLE {
- panic(fmt.Sprintf("OpenFileAt failed wrong: %s %#v", err, err))
- }
-
- // But can read an existing one
- _, err = unix.Openat(int(f.Fd()), "xx", os.O_RDONLY, 0666)
- if err != nil {
- panic(fmt.Sprintf("Openat failed: %s %#v", err, err))
- }
-
- os.Exit(0)
-}
-
-func init() {
- testProcs["openat"] = testProc{
- OpenatTest,
- makeTempDir,
- removeTempDir,
- true,
- }
-}
-
-func TestOpenat(t *testing.T) {
- if runtime.GOARCH != "amd64" {
- t.Skipf("skipping test on %s", runtime.GOARCH)
- }
- ExitsCorrectly(t, "openat")
-}
-
-func TestCapRightsSetAndClear(t *testing.T) {
- r, err := unix.CapRightsInit([]uint64{unix.CAP_READ, unix.CAP_WRITE, unix.CAP_PDWAIT})
- if err != nil {
- t.Fatalf("CapRightsInit failed: %s", err)
- }
-
- err = unix.CapRightsSet(r, []uint64{unix.CAP_EVENT, unix.CAP_LISTEN})
- if err != nil {
- t.Fatalf("CapRightsSet failed: %s", err)
- }
-
- b, err := unix.CapRightsIsSet(r, []uint64{unix.CAP_READ, unix.CAP_WRITE, unix.CAP_PDWAIT, unix.CAP_EVENT, unix.CAP_LISTEN})
- if err != nil {
- t.Fatalf("CapRightsIsSet failed: %s", err)
- }
- if !b {
- t.Fatalf("Wrong rights set")
- }
-
- err = unix.CapRightsClear(r, []uint64{unix.CAP_READ, unix.CAP_PDWAIT})
- if err != nil {
- t.Fatalf("CapRightsClear failed: %s", err)
- }
-
- b, err = unix.CapRightsIsSet(r, []uint64{unix.CAP_WRITE, unix.CAP_EVENT, unix.CAP_LISTEN})
- if err != nil {
- t.Fatalf("CapRightsIsSet failed: %s", err)
- }
- if !b {
- t.Fatalf("Wrong rights set")
- }
-}
-
-// stringsFromByteSlice converts a sequence of attributes to a []string.
-// On FreeBSD, each entry consists of a single byte containing the length
-// of the attribute name, followed by the attribute name.
-// The name is _not_ NULL-terminated.
-func stringsFromByteSlice(buf []byte) []string {
- var result []string
- i := 0
- for i < len(buf) {
- next := i + 1 + int(buf[i])
- result = append(result, string(buf[i+1:next]))
- i = next
- }
- return result
-}
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_test.go b/vendor/golang.org/x/sys/unix/syscall_linux_test.go
deleted file mode 100644
index eed17268b..000000000
--- a/vendor/golang.org/x/sys/unix/syscall_linux_test.go
+++ /dev/null
@@ -1,421 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build linux
-
-package unix_test
-
-import (
- "os"
- "runtime"
- "runtime/debug"
- "testing"
- "time"
-
- "golang.org/x/sys/unix"
-)
-
-func TestIoctlGetInt(t *testing.T) {
- f, err := os.Open("/dev/random")
- if err != nil {
- t.Fatalf("failed to open device: %v", err)
- }
- defer f.Close()
-
- v, err := unix.IoctlGetInt(int(f.Fd()), unix.RNDGETENTCNT)
- if err != nil {
- t.Fatalf("failed to perform ioctl: %v", err)
- }
-
- t.Logf("%d bits of entropy available", v)
-}
-
-func TestPpoll(t *testing.T) {
- if runtime.GOOS == "android" {
- t.Skip("mkfifo syscall is not available on android, skipping test")
- }
-
- f, cleanup := mktmpfifo(t)
- defer cleanup()
-
- const timeout = 100 * time.Millisecond
-
- ok := make(chan bool, 1)
- go func() {
- select {
- case <-time.After(10 * timeout):
- t.Errorf("Ppoll: failed to timeout after %d", 10*timeout)
- case <-ok:
- }
- }()
-
- fds := []unix.PollFd{{Fd: int32(f.Fd()), Events: unix.POLLIN}}
- timeoutTs := unix.NsecToTimespec(int64(timeout))
- n, err := unix.Ppoll(fds, &timeoutTs, nil)
- ok <- true
- if err != nil {
- t.Errorf("Ppoll: unexpected error: %v", err)
- return
- }
- if n != 0 {
- t.Errorf("Ppoll: wrong number of events: got %v, expected %v", n, 0)
- return
- }
-}
-
-func TestTime(t *testing.T) {
- var ut unix.Time_t
- ut2, err := unix.Time(&ut)
- if err != nil {
- t.Fatalf("Time: %v", err)
- }
- if ut != ut2 {
- t.Errorf("Time: return value %v should be equal to argument %v", ut2, ut)
- }
-
- var now time.Time
-
- for i := 0; i < 10; i++ {
- ut, err = unix.Time(nil)
- if err != nil {
- t.Fatalf("Time: %v", err)
- }
-
- now = time.Now()
-
- if int64(ut) == now.Unix() {
- return
- }
- }
-
- t.Errorf("Time: return value %v should be nearly equal to time.Now().Unix() %v", ut, now.Unix())
-}
-
-func TestUtime(t *testing.T) {
- defer chtmpdir(t)()
-
- touch(t, "file1")
-
- buf := &unix.Utimbuf{
- Modtime: 12345,
- }
-
- err := unix.Utime("file1", buf)
- if err != nil {
- t.Fatalf("Utime: %v", err)
- }
-
- fi, err := os.Stat("file1")
- if err != nil {
- t.Fatal(err)
- }
-
- if fi.ModTime().Unix() != 12345 {
- t.Errorf("Utime: failed to change modtime: expected %v, got %v", 12345, fi.ModTime().Unix())
- }
-}
-
-func TestUtimesNanoAt(t *testing.T) {
- defer chtmpdir(t)()
-
- symlink := "symlink1"
- os.Remove(symlink)
- err := os.Symlink("nonexisting", symlink)
- if err != nil {
- t.Fatal(err)
- }
-
- ts := []unix.Timespec{
- {Sec: 1111, Nsec: 2222},
- {Sec: 3333, Nsec: 4444},
- }
- err = unix.UtimesNanoAt(unix.AT_FDCWD, symlink, ts, unix.AT_SYMLINK_NOFOLLOW)
- if err != nil {
- t.Fatalf("UtimesNanoAt: %v", err)
- }
-
- var st unix.Stat_t
- err = unix.Lstat(symlink, &st)
- if err != nil {
- t.Fatalf("Lstat: %v", err)
- }
-
- // Only check Mtim, Atim might not be supported by the underlying filesystem
- expected := ts[1]
- if st.Mtim.Nsec == 0 {
- // Some filesystems only support 1-second time stamp resolution
- // and will always set Nsec to 0.
- expected.Nsec = 0
- }
- if st.Mtim != expected {
- t.Errorf("UtimesNanoAt: wrong mtime: expected %v, got %v", expected, st.Mtim)
- }
-}
-
-func TestRlimitAs(t *testing.T) {
- // disable GC during to avoid flaky test
- defer debug.SetGCPercent(debug.SetGCPercent(-1))
-
- var rlim unix.Rlimit
- err := unix.Getrlimit(unix.RLIMIT_AS, &rlim)
- if err != nil {
- t.Fatalf("Getrlimit: %v", err)
- }
- var zero unix.Rlimit
- if zero == rlim {
- t.Fatalf("Getrlimit: got zero value %#v", rlim)
- }
- set := rlim
- set.Cur = uint64(unix.Getpagesize())
- err = unix.Setrlimit(unix.RLIMIT_AS, &set)
- if err != nil {
- t.Fatalf("Setrlimit: set failed: %#v %v", set, err)
- }
-
- // RLIMIT_AS was set to the page size, so mmap()'ing twice the page size
- // should fail. See 'man 2 getrlimit'.
- _, err = unix.Mmap(-1, 0, 2*unix.Getpagesize(), unix.PROT_NONE, unix.MAP_ANON|unix.MAP_PRIVATE)
- if err == nil {
- t.Fatal("Mmap: unexpectedly suceeded after setting RLIMIT_AS")
- }
-
- err = unix.Setrlimit(unix.RLIMIT_AS, &rlim)
- if err != nil {
- t.Fatalf("Setrlimit: restore failed: %#v %v", rlim, err)
- }
-
- b, err := unix.Mmap(-1, 0, 2*unix.Getpagesize(), unix.PROT_NONE, unix.MAP_ANON|unix.MAP_PRIVATE)
- if err != nil {
- t.Fatalf("Mmap: %v", err)
- }
- err = unix.Munmap(b)
- if err != nil {
- t.Fatalf("Munmap: %v", err)
- }
-}
-
-func TestSelect(t *testing.T) {
- _, err := unix.Select(0, nil, nil, nil, &unix.Timeval{Sec: 0, Usec: 0})
- if err != nil {
- t.Fatalf("Select: %v", err)
- }
-
- dur := 150 * time.Millisecond
- tv := unix.NsecToTimeval(int64(dur))
- start := time.Now()
- _, err = unix.Select(0, nil, nil, nil, &tv)
- took := time.Since(start)
- if err != nil {
- t.Fatalf("Select: %v", err)
- }
-
- if took < dur {
- t.Errorf("Select: timeout should have been at least %v, got %v", dur, took)
- }
-}
-
-func TestPselect(t *testing.T) {
- _, err := unix.Pselect(0, nil, nil, nil, &unix.Timespec{Sec: 0, Nsec: 0}, nil)
- if err != nil {
- t.Fatalf("Pselect: %v", err)
- }
-
- dur := 2500 * time.Microsecond
- ts := unix.NsecToTimespec(int64(dur))
- start := time.Now()
- _, err = unix.Pselect(0, nil, nil, nil, &ts, nil)
- took := time.Since(start)
- if err != nil {
- t.Fatalf("Pselect: %v", err)
- }
-
- if took < dur {
- t.Errorf("Pselect: timeout should have been at least %v, got %v", dur, took)
- }
-}
-
-func TestSchedSetaffinity(t *testing.T) {
- runtime.LockOSThread()
- defer runtime.UnlockOSThread()
-
- var oldMask unix.CPUSet
- err := unix.SchedGetaffinity(0, &oldMask)
- if err != nil {
- t.Fatalf("SchedGetaffinity: %v", err)
- }
-
- var newMask unix.CPUSet
- newMask.Zero()
- if newMask.Count() != 0 {
- t.Errorf("CpuZero: didn't zero CPU set: %v", newMask)
- }
- cpu := 1
- newMask.Set(cpu)
- if newMask.Count() != 1 || !newMask.IsSet(cpu) {
- t.Errorf("CpuSet: didn't set CPU %d in set: %v", cpu, newMask)
- }
- cpu = 5
- newMask.Set(cpu)
- if newMask.Count() != 2 || !newMask.IsSet(cpu) {
- t.Errorf("CpuSet: didn't set CPU %d in set: %v", cpu, newMask)
- }
- newMask.Clear(cpu)
- if newMask.Count() != 1 || newMask.IsSet(cpu) {
- t.Errorf("CpuClr: didn't clear CPU %d in set: %v", cpu, newMask)
- }
-
- if runtime.NumCPU() < 2 {
- t.Skip("skipping setaffinity tests on single CPU system")
- }
- if runtime.GOOS == "android" {
- t.Skip("skipping setaffinity tests on android")
- }
-
- err = unix.SchedSetaffinity(0, &newMask)
- if err != nil {
- t.Fatalf("SchedSetaffinity: %v", err)
- }
-
- var gotMask unix.CPUSet
- err = unix.SchedGetaffinity(0, &gotMask)
- if err != nil {
- t.Fatalf("SchedGetaffinity: %v", err)
- }
-
- if gotMask != newMask {
- t.Errorf("SchedSetaffinity: returned affinity mask does not match set affinity mask")
- }
-
- // Restore old mask so it doesn't affect successive tests
- err = unix.SchedSetaffinity(0, &oldMask)
- if err != nil {
- t.Fatalf("SchedSetaffinity: %v", err)
- }
-}
-
-func TestStatx(t *testing.T) {
- var stx unix.Statx_t
- err := unix.Statx(unix.AT_FDCWD, ".", 0, 0, &stx)
- if err == unix.ENOSYS || err == unix.EPERM {
- t.Skip("statx syscall is not available, skipping test")
- } else if err != nil {
- t.Fatalf("Statx: %v", err)
- }
-
- defer chtmpdir(t)()
- touch(t, "file1")
-
- var st unix.Stat_t
- err = unix.Stat("file1", &st)
- if err != nil {
- t.Fatalf("Stat: %v", err)
- }
-
- flags := unix.AT_STATX_SYNC_AS_STAT
- err = unix.Statx(unix.AT_FDCWD, "file1", flags, unix.STATX_ALL, &stx)
- if err != nil {
- t.Fatalf("Statx: %v", err)
- }
-
- if uint32(stx.Mode) != st.Mode {
- t.Errorf("Statx: returned stat mode does not match Stat")
- }
-
- ctime := unix.StatxTimestamp{Sec: int64(st.Ctim.Sec), Nsec: uint32(st.Ctim.Nsec)}
- mtime := unix.StatxTimestamp{Sec: int64(st.Mtim.Sec), Nsec: uint32(st.Mtim.Nsec)}
-
- if stx.Ctime != ctime {
- t.Errorf("Statx: returned stat ctime does not match Stat")
- }
- if stx.Mtime != mtime {
- t.Errorf("Statx: returned stat mtime does not match Stat")
- }
-
- err = os.Symlink("file1", "symlink1")
- if err != nil {
- t.Fatal(err)
- }
-
- err = unix.Lstat("symlink1", &st)
- if err != nil {
- t.Fatalf("Lstat: %v", err)
- }
-
- err = unix.Statx(unix.AT_FDCWD, "symlink1", flags, unix.STATX_BASIC_STATS, &stx)
- if err != nil {
- t.Fatalf("Statx: %v", err)
- }
-
- // follow symlink, expect a regulat file
- if stx.Mode&unix.S_IFREG == 0 {
- t.Errorf("Statx: didn't follow symlink")
- }
-
- err = unix.Statx(unix.AT_FDCWD, "symlink1", flags|unix.AT_SYMLINK_NOFOLLOW, unix.STATX_ALL, &stx)
- if err != nil {
- t.Fatalf("Statx: %v", err)
- }
-
- // follow symlink, expect a symlink
- if stx.Mode&unix.S_IFLNK == 0 {
- t.Errorf("Statx: unexpectedly followed symlink")
- }
- if uint32(stx.Mode) != st.Mode {
- t.Errorf("Statx: returned stat mode does not match Lstat")
- }
-
- ctime = unix.StatxTimestamp{Sec: int64(st.Ctim.Sec), Nsec: uint32(st.Ctim.Nsec)}
- mtime = unix.StatxTimestamp{Sec: int64(st.Mtim.Sec), Nsec: uint32(st.Mtim.Nsec)}
-
- if stx.Ctime != ctime {
- t.Errorf("Statx: returned stat ctime does not match Lstat")
- }
- if stx.Mtime != mtime {
- t.Errorf("Statx: returned stat mtime does not match Lstat")
- }
-}
-
-// stringsFromByteSlice converts a sequence of attributes to a []string.
-// On Linux, each entry is a NULL-terminated string.
-func stringsFromByteSlice(buf []byte) []string {
- var result []string
- off := 0
- for i, b := range buf {
- if b == 0 {
- result = append(result, string(buf[off:i]))
- off = i + 1
- }
- }
- return result
-}
-
-func TestFaccessat(t *testing.T) {
- defer chtmpdir(t)()
- touch(t, "file1")
-
- err := unix.Faccessat(unix.AT_FDCWD, "file1", unix.O_RDONLY, 0)
- if err != nil {
- t.Errorf("Faccessat: unexpected error: %v", err)
- }
-
- err = unix.Faccessat(unix.AT_FDCWD, "file1", unix.O_RDONLY, 2)
- if err != unix.EINVAL {
- t.Errorf("Faccessat: unexpected error: %v, want EINVAL", err)
- }
-
- err = unix.Faccessat(unix.AT_FDCWD, "file1", unix.O_RDONLY, unix.AT_EACCESS)
- if err != unix.EOPNOTSUPP {
- t.Errorf("Faccessat: unexpected error: %v, want EOPNOTSUPP", err)
- }
-
- err = os.Symlink("file1", "symlink1")
- if err != nil {
- t.Fatal(err)
- }
-
- err = unix.Faccessat(unix.AT_FDCWD, "symlink1", unix.O_RDONLY, unix.AT_SYMLINK_NOFOLLOW)
- if err != unix.EOPNOTSUPP {
- t.Errorf("Faccessat: unexpected error: %v, want EOPNOTSUPP", err)
- }
-}
diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris_test.go b/vendor/golang.org/x/sys/unix/syscall_solaris_test.go
deleted file mode 100644
index 57dba8824..000000000
--- a/vendor/golang.org/x/sys/unix/syscall_solaris_test.go
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build solaris
-
-package unix_test
-
-import (
- "os/exec"
- "testing"
- "time"
-
- "golang.org/x/sys/unix"
-)
-
-func TestSelect(t *testing.T) {
- err := unix.Select(0, nil, nil, nil, &unix.Timeval{Sec: 0, Usec: 0})
- if err != nil {
- t.Fatalf("Select: %v", err)
- }
-
- dur := 150 * time.Millisecond
- tv := unix.NsecToTimeval(int64(dur))
- start := time.Now()
- err = unix.Select(0, nil, nil, nil, &tv)
- took := time.Since(start)
- if err != nil {
- t.Fatalf("Select: %v", err)
- }
-
- if took < dur {
- t.Errorf("Select: timeout should have been at least %v, got %v", dur, took)
- }
-}
-
-func TestStatvfs(t *testing.T) {
- if err := unix.Statvfs("", nil); err == nil {
- t.Fatal(`Statvfs("") expected failure`)
- }
-
- statvfs := unix.Statvfs_t{}
- if err := unix.Statvfs("/", &statvfs); err != nil {
- t.Errorf(`Statvfs("/") failed: %v`, err)
- }
-
- if t.Failed() {
- mount, err := exec.Command("mount").CombinedOutput()
- if err != nil {
- t.Logf("mount: %v\n%s", err, mount)
- } else {
- t.Logf("mount: %s", mount)
- }
- }
-}
diff --git a/vendor/golang.org/x/sys/unix/syscall_test.go b/vendor/golang.org/x/sys/unix/syscall_test.go
deleted file mode 100644
index a8eef7cf8..000000000
--- a/vendor/golang.org/x/sys/unix/syscall_test.go
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd linux netbsd openbsd solaris
-
-package unix_test
-
-import (
- "fmt"
- "testing"
-
- "golang.org/x/sys/unix"
-)
-
-func testSetGetenv(t *testing.T, key, value string) {
- err := unix.Setenv(key, value)
- if err != nil {
- t.Fatalf("Setenv failed to set %q: %v", value, err)
- }
- newvalue, found := unix.Getenv(key)
- if !found {
- t.Fatalf("Getenv failed to find %v variable (want value %q)", key, value)
- }
- if newvalue != value {
- t.Fatalf("Getenv(%v) = %q; want %q", key, newvalue, value)
- }
-}
-
-func TestEnv(t *testing.T) {
- testSetGetenv(t, "TESTENV", "AVALUE")
- // make sure TESTENV gets set to "", not deleted
- testSetGetenv(t, "TESTENV", "")
-}
-
-func TestItoa(t *testing.T) {
- // Make most negative integer: 0x8000...
- i := 1
- for i<<1 != 0 {
- i <<= 1
- }
- if i >= 0 {
- t.Fatal("bad math")
- }
- s := unix.Itoa(i)
- f := fmt.Sprint(i)
- if s != f {
- t.Fatalf("itoa(%d) = %s, want %s", i, s, f)
- }
-}
-
-func TestUname(t *testing.T) {
- var utsname unix.Utsname
- err := unix.Uname(&utsname)
- if err != nil {
- t.Fatalf("Uname: %v", err)
- }
-
- t.Logf("OS: %s/%s %s", utsname.Sysname[:], utsname.Machine[:], utsname.Release[:])
-}
diff --git a/vendor/golang.org/x/sys/unix/syscall_unix_test.go b/vendor/golang.org/x/sys/unix/syscall_unix_test.go
deleted file mode 100644
index d694990db..000000000
--- a/vendor/golang.org/x/sys/unix/syscall_unix_test.go
+++ /dev/null
@@ -1,657 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd linux netbsd openbsd solaris
-
-package unix_test
-
-import (
- "flag"
- "fmt"
- "io/ioutil"
- "net"
- "os"
- "os/exec"
- "path/filepath"
- "runtime"
- "syscall"
- "testing"
- "time"
-
- "golang.org/x/sys/unix"
-)
-
-// Tests that below functions, structures and constants are consistent
-// on all Unix-like systems.
-func _() {
- // program scheduling priority functions and constants
- var (
- _ func(int, int, int) error = unix.Setpriority
- _ func(int, int) (int, error) = unix.Getpriority
- )
- const (
- _ int = unix.PRIO_USER
- _ int = unix.PRIO_PROCESS
- _ int = unix.PRIO_PGRP
- )
-
- // termios constants
- const (
- _ int = unix.TCIFLUSH
- _ int = unix.TCIOFLUSH
- _ int = unix.TCOFLUSH
- )
-
- // fcntl file locking structure and constants
- var (
- _ = unix.Flock_t{
- Type: int16(0),
- Whence: int16(0),
- Start: int64(0),
- Len: int64(0),
- Pid: int32(0),
- }
- )
- const (
- _ = unix.F_GETLK
- _ = unix.F_SETLK
- _ = unix.F_SETLKW
- )
-}
-
-func TestErrnoSignalName(t *testing.T) {
- testErrors := []struct {
- num syscall.Errno
- name string
- }{
- {syscall.EPERM, "EPERM"},
- {syscall.EINVAL, "EINVAL"},
- {syscall.ENOENT, "ENOENT"},
- }
-
- for _, te := range testErrors {
- t.Run(fmt.Sprintf("%d/%s", te.num, te.name), func(t *testing.T) {
- e := unix.ErrnoName(te.num)
- if e != te.name {
- t.Errorf("ErrnoName(%d) returned %s, want %s", te.num, e, te.name)
- }
- })
- }
-
- testSignals := []struct {
- num syscall.Signal
- name string
- }{
- {syscall.SIGHUP, "SIGHUP"},
- {syscall.SIGPIPE, "SIGPIPE"},
- {syscall.SIGSEGV, "SIGSEGV"},
- }
-
- for _, ts := range testSignals {
- t.Run(fmt.Sprintf("%d/%s", ts.num, ts.name), func(t *testing.T) {
- s := unix.SignalName(ts.num)
- if s != ts.name {
- t.Errorf("SignalName(%d) returned %s, want %s", ts.num, s, ts.name)
- }
- })
- }
-}
-
-func TestFcntlInt(t *testing.T) {
- t.Parallel()
- file, err := ioutil.TempFile("", "TestFnctlInt")
- if err != nil {
- t.Fatal(err)
- }
- defer os.Remove(file.Name())
- defer file.Close()
- f := file.Fd()
- flags, err := unix.FcntlInt(f, unix.F_GETFD, 0)
- if err != nil {
- t.Fatal(err)
- }
- if flags&unix.FD_CLOEXEC == 0 {
- t.Errorf("flags %#x do not include FD_CLOEXEC", flags)
- }
-}
-
-// TestFcntlFlock tests whether the file locking structure matches
-// the calling convention of each kernel.
-func TestFcntlFlock(t *testing.T) {
- name := filepath.Join(os.TempDir(), "TestFcntlFlock")
- fd, err := unix.Open(name, unix.O_CREAT|unix.O_RDWR|unix.O_CLOEXEC, 0)
- if err != nil {
- t.Fatalf("Open failed: %v", err)
- }
- defer unix.Unlink(name)
- defer unix.Close(fd)
- flock := unix.Flock_t{
- Type: unix.F_RDLCK,
- Start: 0, Len: 0, Whence: 1,
- }
- if err := unix.FcntlFlock(uintptr(fd), unix.F_GETLK, &flock); err != nil {
- t.Fatalf("FcntlFlock failed: %v", err)
- }
-}
-
-// TestPassFD tests passing a file descriptor over a Unix socket.
-//
-// This test involved both a parent and child process. The parent
-// process is invoked as a normal test, with "go test", which then
-// runs the child process by running the current test binary with args
-// "-test.run=^TestPassFD$" and an environment variable used to signal
-// that the test should become the child process instead.
-func TestPassFD(t *testing.T) {
- if runtime.GOOS == "darwin" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64") {
- t.Skip("cannot exec subprocess on iOS, skipping test")
- }
-
- if os.Getenv("GO_WANT_HELPER_PROCESS") == "1" {
- passFDChild()
- return
- }
-
- tempDir, err := ioutil.TempDir("", "TestPassFD")
- if err != nil {
- t.Fatal(err)
- }
- defer os.RemoveAll(tempDir)
-
- fds, err := unix.Socketpair(unix.AF_LOCAL, unix.SOCK_STREAM, 0)
- if err != nil {
- t.Fatalf("Socketpair: %v", err)
- }
- defer unix.Close(fds[0])
- defer unix.Close(fds[1])
- writeFile := os.NewFile(uintptr(fds[0]), "child-writes")
- readFile := os.NewFile(uintptr(fds[1]), "parent-reads")
- defer writeFile.Close()
- defer readFile.Close()
-
- cmd := exec.Command(os.Args[0], "-test.run=^TestPassFD$", "--", tempDir)
- cmd.Env = []string{"GO_WANT_HELPER_PROCESS=1"}
- if lp := os.Getenv("LD_LIBRARY_PATH"); lp != "" {
- cmd.Env = append(cmd.Env, "LD_LIBRARY_PATH="+lp)
- }
- cmd.ExtraFiles = []*os.File{writeFile}
-
- out, err := cmd.CombinedOutput()
- if len(out) > 0 || err != nil {
- t.Fatalf("child process: %q, %v", out, err)
- }
-
- c, err := net.FileConn(readFile)
- if err != nil {
- t.Fatalf("FileConn: %v", err)
- }
- defer c.Close()
-
- uc, ok := c.(*net.UnixConn)
- if !ok {
- t.Fatalf("unexpected FileConn type; expected UnixConn, got %T", c)
- }
-
- buf := make([]byte, 32) // expect 1 byte
- oob := make([]byte, 32) // expect 24 bytes
- closeUnix := time.AfterFunc(5*time.Second, func() {
- t.Logf("timeout reading from unix socket")
- uc.Close()
- })
- _, oobn, _, _, err := uc.ReadMsgUnix(buf, oob)
- if err != nil {
- t.Fatalf("ReadMsgUnix: %v", err)
- }
- closeUnix.Stop()
-
- scms, err := unix.ParseSocketControlMessage(oob[:oobn])
- if err != nil {
- t.Fatalf("ParseSocketControlMessage: %v", err)
- }
- if len(scms) != 1 {
- t.Fatalf("expected 1 SocketControlMessage; got scms = %#v", scms)
- }
- scm := scms[0]
- gotFds, err := unix.ParseUnixRights(&scm)
- if err != nil {
- t.Fatalf("unix.ParseUnixRights: %v", err)
- }
- if len(gotFds) != 1 {
- t.Fatalf("wanted 1 fd; got %#v", gotFds)
- }
-
- f := os.NewFile(uintptr(gotFds[0]), "fd-from-child")
- defer f.Close()
-
- got, err := ioutil.ReadAll(f)
- want := "Hello from child process!\n"
- if string(got) != want {
- t.Errorf("child process ReadAll: %q, %v; want %q", got, err, want)
- }
-}
-
-// passFDChild is the child process used by TestPassFD.
-func passFDChild() {
- defer os.Exit(0)
-
- // Look for our fd. It should be fd 3, but we work around an fd leak
- // bug here (http://golang.org/issue/2603) to let it be elsewhere.
- var uc *net.UnixConn
- for fd := uintptr(3); fd <= 10; fd++ {
- f := os.NewFile(fd, "unix-conn")
- var ok bool
- netc, _ := net.FileConn(f)
- uc, ok = netc.(*net.UnixConn)
- if ok {
- break
- }
- }
- if uc == nil {
- fmt.Println("failed to find unix fd")
- return
- }
-
- // Make a file f to send to our parent process on uc.
- // We make it in tempDir, which our parent will clean up.
- flag.Parse()
- tempDir := flag.Arg(0)
- f, err := ioutil.TempFile(tempDir, "")
- if err != nil {
- fmt.Printf("TempFile: %v", err)
- return
- }
-
- f.Write([]byte("Hello from child process!\n"))
- f.Seek(0, 0)
-
- rights := unix.UnixRights(int(f.Fd()))
- dummyByte := []byte("x")
- n, oobn, err := uc.WriteMsgUnix(dummyByte, rights, nil)
- if err != nil {
- fmt.Printf("WriteMsgUnix: %v", err)
- return
- }
- if n != 1 || oobn != len(rights) {
- fmt.Printf("WriteMsgUnix = %d, %d; want 1, %d", n, oobn, len(rights))
- return
- }
-}
-
-// TestUnixRightsRoundtrip tests that UnixRights, ParseSocketControlMessage,
-// and ParseUnixRights are able to successfully round-trip lists of file descriptors.
-func TestUnixRightsRoundtrip(t *testing.T) {
- testCases := [...][][]int{
- {{42}},
- {{1, 2}},
- {{3, 4, 5}},
- {{}},
- {{1, 2}, {3, 4, 5}, {}, {7}},
- }
- for _, testCase := range testCases {
- b := []byte{}
- var n int
- for _, fds := range testCase {
- // Last assignment to n wins
- n = len(b) + unix.CmsgLen(4*len(fds))
- b = append(b, unix.UnixRights(fds...)...)
- }
- // Truncate b
- b = b[:n]
-
- scms, err := unix.ParseSocketControlMessage(b)
- if err != nil {
- t.Fatalf("ParseSocketControlMessage: %v", err)
- }
- if len(scms) != len(testCase) {
- t.Fatalf("expected %v SocketControlMessage; got scms = %#v", len(testCase), scms)
- }
- for i, scm := range scms {
- gotFds, err := unix.ParseUnixRights(&scm)
- if err != nil {
- t.Fatalf("ParseUnixRights: %v", err)
- }
- wantFds := testCase[i]
- if len(gotFds) != len(wantFds) {
- t.Fatalf("expected %v fds, got %#v", len(wantFds), gotFds)
- }
- for j, fd := range gotFds {
- if fd != wantFds[j] {
- t.Fatalf("expected fd %v, got %v", wantFds[j], fd)
- }
- }
- }
- }
-}
-
-func TestRlimit(t *testing.T) {
- var rlimit, zero unix.Rlimit
- err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rlimit)
- if err != nil {
- t.Fatalf("Getrlimit: save failed: %v", err)
- }
- if zero == rlimit {
- t.Fatalf("Getrlimit: save failed: got zero value %#v", rlimit)
- }
- set := rlimit
- set.Cur = set.Max - 1
- err = unix.Setrlimit(unix.RLIMIT_NOFILE, &set)
- if err != nil {
- t.Fatalf("Setrlimit: set failed: %#v %v", set, err)
- }
- var get unix.Rlimit
- err = unix.Getrlimit(unix.RLIMIT_NOFILE, &get)
- if err != nil {
- t.Fatalf("Getrlimit: get failed: %v", err)
- }
- set = rlimit
- set.Cur = set.Max - 1
- if set != get {
- // Seems like Darwin requires some privilege to
- // increase the soft limit of rlimit sandbox, though
- // Setrlimit never reports an error.
- switch runtime.GOOS {
- case "darwin":
- default:
- t.Fatalf("Rlimit: change failed: wanted %#v got %#v", set, get)
- }
- }
- err = unix.Setrlimit(unix.RLIMIT_NOFILE, &rlimit)
- if err != nil {
- t.Fatalf("Setrlimit: restore failed: %#v %v", rlimit, err)
- }
-}
-
-func TestSeekFailure(t *testing.T) {
- _, err := unix.Seek(-1, 0, 0)
- if err == nil {
- t.Fatalf("Seek(-1, 0, 0) did not fail")
- }
- str := err.Error() // used to crash on Linux
- t.Logf("Seek: %v", str)
- if str == "" {
- t.Fatalf("Seek(-1, 0, 0) return error with empty message")
- }
-}
-
-func TestDup(t *testing.T) {
- file, err := ioutil.TempFile("", "TestDup")
- if err != nil {
- t.Fatalf("Tempfile failed: %v", err)
- }
- defer os.Remove(file.Name())
- defer file.Close()
- f := int(file.Fd())
-
- newFd, err := unix.Dup(f)
- if err != nil {
- t.Fatalf("Dup: %v", err)
- }
-
- err = unix.Dup2(newFd, newFd+1)
- if err != nil {
- t.Fatalf("Dup2: %v", err)
- }
-
- b1 := []byte("Test123")
- b2 := make([]byte, 7)
- _, err = unix.Write(newFd+1, b1)
- if err != nil {
- t.Fatalf("Write to dup2 fd failed: %v", err)
- }
- _, err = unix.Seek(f, 0, 0)
- if err != nil {
- t.Fatalf("Seek failed: %v", err)
- }
- _, err = unix.Read(f, b2)
- if err != nil {
- t.Fatalf("Read back failed: %v", err)
- }
- if string(b1) != string(b2) {
- t.Errorf("Dup: stdout write not in file, expected %v, got %v", string(b1), string(b2))
- }
-}
-
-func TestPoll(t *testing.T) {
- if runtime.GOOS == "android" ||
- (runtime.GOOS == "darwin" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64")) {
- t.Skip("mkfifo syscall is not available on android and iOS, skipping test")
- }
-
- f, cleanup := mktmpfifo(t)
- defer cleanup()
-
- const timeout = 100
-
- ok := make(chan bool, 1)
- go func() {
- select {
- case <-time.After(10 * timeout * time.Millisecond):
- t.Errorf("Poll: failed to timeout after %d milliseconds", 10*timeout)
- case <-ok:
- }
- }()
-
- fds := []unix.PollFd{{Fd: int32(f.Fd()), Events: unix.POLLIN}}
- n, err := unix.Poll(fds, timeout)
- ok <- true
- if err != nil {
- t.Errorf("Poll: unexpected error: %v", err)
- return
- }
- if n != 0 {
- t.Errorf("Poll: wrong number of events: got %v, expected %v", n, 0)
- return
- }
-}
-
-func TestGetwd(t *testing.T) {
- fd, err := os.Open(".")
- if err != nil {
- t.Fatalf("Open .: %s", err)
- }
- defer fd.Close()
- // These are chosen carefully not to be symlinks on a Mac
- // (unlike, say, /var, /etc)
- dirs := []string{"/", "/usr/bin"}
- switch runtime.GOOS {
- case "android":
- dirs = []string{"/", "/system/bin"}
- case "darwin":
- switch runtime.GOARCH {
- case "arm", "arm64":
- d1, err := ioutil.TempDir("", "d1")
- if err != nil {
- t.Fatalf("TempDir: %v", err)
- }
- d2, err := ioutil.TempDir("", "d2")
- if err != nil {
- t.Fatalf("TempDir: %v", err)
- }
- dirs = []string{d1, d2}
- }
- }
- oldwd := os.Getenv("PWD")
- for _, d := range dirs {
- err = os.Chdir(d)
- if err != nil {
- t.Fatalf("Chdir: %v", err)
- }
- pwd, err := unix.Getwd()
- if err != nil {
- t.Fatalf("Getwd in %s: %s", d, err)
- }
- os.Setenv("PWD", oldwd)
- err = fd.Chdir()
- if err != nil {
- // We changed the current directory and cannot go back.
- // Don't let the tests continue; they'll scribble
- // all over some other directory.
- fmt.Fprintf(os.Stderr, "fchdir back to dot failed: %s\n", err)
- os.Exit(1)
- }
- if pwd != d {
- t.Fatalf("Getwd returned %q want %q", pwd, d)
- }
- }
-}
-
-func TestFstatat(t *testing.T) {
- defer chtmpdir(t)()
-
- touch(t, "file1")
-
- var st1 unix.Stat_t
- err := unix.Stat("file1", &st1)
- if err != nil {
- t.Fatalf("Stat: %v", err)
- }
-
- var st2 unix.Stat_t
- err = unix.Fstatat(unix.AT_FDCWD, "file1", &st2, 0)
- if err != nil {
- t.Fatalf("Fstatat: %v", err)
- }
-
- if st1 != st2 {
- t.Errorf("Fstatat: returned stat does not match Stat")
- }
-
- err = os.Symlink("file1", "symlink1")
- if err != nil {
- t.Fatal(err)
- }
-
- err = unix.Lstat("symlink1", &st1)
- if err != nil {
- t.Fatalf("Lstat: %v", err)
- }
-
- err = unix.Fstatat(unix.AT_FDCWD, "symlink1", &st2, unix.AT_SYMLINK_NOFOLLOW)
- if err != nil {
- t.Fatalf("Fstatat: %v", err)
- }
-
- if st1 != st2 {
- t.Errorf("Fstatat: returned stat does not match Lstat")
- }
-}
-
-func TestFchmodat(t *testing.T) {
- defer chtmpdir(t)()
-
- touch(t, "file1")
- err := os.Symlink("file1", "symlink1")
- if err != nil {
- t.Fatal(err)
- }
-
- mode := os.FileMode(0444)
- err = unix.Fchmodat(unix.AT_FDCWD, "symlink1", uint32(mode), 0)
- if err != nil {
- t.Fatalf("Fchmodat: unexpected error: %v", err)
- }
-
- fi, err := os.Stat("file1")
- if err != nil {
- t.Fatal(err)
- }
-
- if fi.Mode() != mode {
- t.Errorf("Fchmodat: failed to change file mode: expected %v, got %v", mode, fi.Mode())
- }
-
- mode = os.FileMode(0644)
- didChmodSymlink := true
- err = unix.Fchmodat(unix.AT_FDCWD, "symlink1", uint32(mode), unix.AT_SYMLINK_NOFOLLOW)
- if err != nil {
- if (runtime.GOOS == "android" || runtime.GOOS == "linux" || runtime.GOOS == "solaris") && err == unix.EOPNOTSUPP {
- // Linux and Illumos don't support flags != 0
- didChmodSymlink = false
- } else {
- t.Fatalf("Fchmodat: unexpected error: %v", err)
- }
- }
-
- if !didChmodSymlink {
- // Didn't change mode of the symlink. On Linux, the permissions
- // of a symbolic link are always 0777 according to symlink(7)
- mode = os.FileMode(0777)
- }
-
- var st unix.Stat_t
- err = unix.Lstat("symlink1", &st)
- if err != nil {
- t.Fatal(err)
- }
-
- got := os.FileMode(st.Mode & 0777)
- if got != mode {
- t.Errorf("Fchmodat: failed to change symlink mode: expected %v, got %v", mode, got)
- }
-}
-
-func TestMkdev(t *testing.T) {
- major := uint32(42)
- minor := uint32(7)
- dev := unix.Mkdev(major, minor)
-
- if unix.Major(dev) != major {
- t.Errorf("Major(%#x) == %d, want %d", dev, unix.Major(dev), major)
- }
- if unix.Minor(dev) != minor {
- t.Errorf("Minor(%#x) == %d, want %d", dev, unix.Minor(dev), minor)
- }
-}
-
-// mktmpfifo creates a temporary FIFO and provides a cleanup function.
-func mktmpfifo(t *testing.T) (*os.File, func()) {
- err := unix.Mkfifo("fifo", 0666)
- if err != nil {
- t.Fatalf("mktmpfifo: failed to create FIFO: %v", err)
- }
-
- f, err := os.OpenFile("fifo", os.O_RDWR, 0666)
- if err != nil {
- os.Remove("fifo")
- t.Fatalf("mktmpfifo: failed to open FIFO: %v", err)
- }
-
- return f, func() {
- f.Close()
- os.Remove("fifo")
- }
-}
-
-// utilities taken from os/os_test.go
-
-func touch(t *testing.T, name string) {
- f, err := os.Create(name)
- if err != nil {
- t.Fatal(err)
- }
- if err := f.Close(); err != nil {
- t.Fatal(err)
- }
-}
-
-// chtmpdir changes the working directory to a new temporary directory and
-// provides a cleanup function. Used when PWD is read-only.
-func chtmpdir(t *testing.T) func() {
- oldwd, err := os.Getwd()
- if err != nil {
- t.Fatalf("chtmpdir: %v", err)
- }
- d, err := ioutil.TempDir("", "test")
- if err != nil {
- t.Fatalf("chtmpdir: %v", err)
- }
- if err := os.Chdir(d); err != nil {
- t.Fatalf("chtmpdir: %v", err)
- }
- return func() {
- if err := os.Chdir(oldwd); err != nil {
- t.Fatalf("chtmpdir: %v", err)
- }
- os.RemoveAll(d)
- }
-}
diff --git a/vendor/golang.org/x/sys/unix/timestruct_test.go b/vendor/golang.org/x/sys/unix/timestruct_test.go
deleted file mode 100644
index 4215f46d1..000000000
--- a/vendor/golang.org/x/sys/unix/timestruct_test.go
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2017 The Go Authors. All right reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd linux netbsd openbsd solaris
-
-package unix_test
-
-import (
- "testing"
- "time"
- "unsafe"
-
- "golang.org/x/sys/unix"
-)
-
-func TestTimeToTimespec(t *testing.T) {
- timeTests := []struct {
- time time.Time
- valid bool
- }{
- {time.Unix(0, 0), true},
- {time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC), true},
- {time.Date(2262, time.December, 31, 23, 0, 0, 0, time.UTC), false},
- {time.Unix(0x7FFFFFFF, 0), true},
- {time.Unix(0x80000000, 0), false},
- {time.Unix(0x7FFFFFFF, 1000000000), false},
- {time.Unix(0x7FFFFFFF, 999999999), true},
- {time.Unix(-0x80000000, 0), true},
- {time.Unix(-0x80000001, 0), false},
- {time.Date(2038, time.January, 19, 3, 14, 7, 0, time.UTC), true},
- {time.Date(2038, time.January, 19, 3, 14, 8, 0, time.UTC), false},
- {time.Date(1901, time.December, 13, 20, 45, 52, 0, time.UTC), true},
- {time.Date(1901, time.December, 13, 20, 45, 51, 0, time.UTC), false},
- }
-
- // Currently all targets have either int32 or int64 for Timespec.Sec.
- // If there were a new target with unsigned or floating point type for
- // it, this test must be adjusted.
- have64BitTime := (unsafe.Sizeof(unix.Timespec{}.Sec) == 8)
- for _, tt := range timeTests {
- ts, err := unix.TimeToTimespec(tt.time)
- tt.valid = tt.valid || have64BitTime
- if tt.valid && err != nil {
- t.Errorf("TimeToTimespec(%v): %v", tt.time, err)
- }
- if err == nil {
- tstime := time.Unix(int64(ts.Sec), int64(ts.Nsec))
- if !tstime.Equal(tt.time) {
- t.Errorf("TimeToTimespec(%v) is the time %v", tt.time, tstime)
- }
- }
- }
-}
diff --git a/vendor/golang.org/x/sys/unix/xattr_test.go b/vendor/golang.org/x/sys/unix/xattr_test.go
deleted file mode 100644
index b8b28d0c1..000000000
--- a/vendor/golang.org/x/sys/unix/xattr_test.go
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin freebsd linux
-
-package unix_test
-
-import (
- "os"
- "runtime"
- "strings"
- "testing"
-
- "golang.org/x/sys/unix"
-)
-
-func TestXattr(t *testing.T) {
- defer chtmpdir(t)()
-
- f := "xattr1"
- touch(t, f)
-
- xattrName := "user.test"
- xattrDataSet := "gopher"
- err := unix.Setxattr(f, xattrName, []byte(xattrDataSet), 0)
- if err == unix.ENOTSUP || err == unix.EOPNOTSUPP {
- t.Skip("filesystem does not support extended attributes, skipping test")
- } else if err != nil {
- t.Fatalf("Setxattr: %v", err)
- }
-
- // find size
- size, err := unix.Listxattr(f, nil)
- if err != nil {
- t.Fatalf("Listxattr: %v", err)
- }
-
- if size <= 0 {
- t.Fatalf("Listxattr returned an empty list of attributes")
- }
-
- buf := make([]byte, size)
- read, err := unix.Listxattr(f, buf)
- if err != nil {
- t.Fatalf("Listxattr: %v", err)
- }
-
- xattrs := stringsFromByteSlice(buf[:read])
-
- xattrWant := xattrName
- if runtime.GOOS == "freebsd" {
- // On FreeBSD, the namespace is stored separately from the xattr
- // name and Listxattr doesn't return the namespace prefix.
- xattrWant = strings.TrimPrefix(xattrWant, "user.")
- }
- found := false
- for _, name := range xattrs {
- if name == xattrWant {
- found = true
- }
- }
-
- if !found {
- t.Errorf("Listxattr did not return previously set attribute '%s'", xattrName)
- }
-
- // find size
- size, err = unix.Getxattr(f, xattrName, nil)
- if err != nil {
- t.Fatalf("Getxattr: %v", err)
- }
-
- if size <= 0 {
- t.Fatalf("Getxattr returned an empty attribute")
- }
-
- xattrDataGet := make([]byte, size)
- _, err = unix.Getxattr(f, xattrName, xattrDataGet)
- if err != nil {
- t.Fatalf("Getxattr: %v", err)
- }
-
- got := string(xattrDataGet)
- if got != xattrDataSet {
- t.Errorf("Getxattr: expected attribute value %s, got %s", xattrDataSet, got)
- }
-
- err = unix.Removexattr(f, xattrName)
- if err != nil {
- t.Fatalf("Removexattr: %v", err)
- }
-
- n := "nonexistent"
- err = unix.Lsetxattr(n, xattrName, []byte(xattrDataSet), 0)
- if err != unix.ENOENT {
- t.Errorf("Lsetxattr: expected %v on non-existent file, got %v", unix.ENOENT, err)
- }
-
- _, err = unix.Lgetxattr(n, xattrName, nil)
- if err != unix.ENOENT {
- t.Errorf("Lgetxattr: %v", err)
- }
-
- s := "symlink1"
- err = os.Symlink(n, s)
- if err != nil {
- t.Fatal(err)
- }
-
- err = unix.Lsetxattr(s, xattrName, []byte(xattrDataSet), 0)
- if err != nil {
- // Linux and Android doen't support xattrs on symlinks according
- // to xattr(7), so just test that we get the proper error.
- if (runtime.GOOS != "linux" && runtime.GOOS != "android") || err != unix.EPERM {
- t.Fatalf("Lsetxattr: %v", err)
- }
- }
-}
diff --git a/vendor/golang.org/x/sys/windows/syscall_test.go b/vendor/golang.org/x/sys/windows/syscall_test.go
deleted file mode 100644
index d7009e44a..000000000
--- a/vendor/golang.org/x/sys/windows/syscall_test.go
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-package windows_test
-
-import (
- "syscall"
- "testing"
-
- "golang.org/x/sys/windows"
-)
-
-func testSetGetenv(t *testing.T, key, value string) {
- err := windows.Setenv(key, value)
- if err != nil {
- t.Fatalf("Setenv failed to set %q: %v", value, err)
- }
- newvalue, found := windows.Getenv(key)
- if !found {
- t.Fatalf("Getenv failed to find %v variable (want value %q)", key, value)
- }
- if newvalue != value {
- t.Fatalf("Getenv(%v) = %q; want %q", key, newvalue, value)
- }
-}
-
-func TestEnv(t *testing.T) {
- testSetGetenv(t, "TESTENV", "AVALUE")
- // make sure TESTENV gets set to "", not deleted
- testSetGetenv(t, "TESTENV", "")
-}
-
-func TestGetProcAddressByOrdinal(t *testing.T) {
- // Attempt calling shlwapi.dll:IsOS, resolving it by ordinal, as
- // suggested in
- // https://msdn.microsoft.com/en-us/library/windows/desktop/bb773795.aspx
- h, err := windows.LoadLibrary("shlwapi.dll")
- if err != nil {
- t.Fatalf("Failed to load shlwapi.dll: %s", err)
- }
- procIsOS, err := windows.GetProcAddressByOrdinal(h, 437)
- if err != nil {
- t.Fatalf("Could not find shlwapi.dll:IsOS by ordinal: %s", err)
- }
- const OS_NT = 1
- r, _, _ := syscall.Syscall(procIsOS, 1, OS_NT, 0, 0)
- if r == 0 {
- t.Error("shlwapi.dll:IsOS(OS_NT) returned 0, expected non-zero value")
- }
-}
diff --git a/vendor/golang.org/x/sys/windows/syscall_windows_test.go b/vendor/golang.org/x/sys/windows/syscall_windows_test.go
deleted file mode 100644
index 0e27464e8..000000000
--- a/vendor/golang.org/x/sys/windows/syscall_windows_test.go
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package windows_test
-
-import (
- "io/ioutil"
- "os"
- "path/filepath"
- "syscall"
- "testing"
- "unsafe"
-
- "golang.org/x/sys/windows"
-)
-
-func TestWin32finddata(t *testing.T) {
- dir, err := ioutil.TempDir("", "go-build")
- if err != nil {
- t.Fatalf("failed to create temp directory: %v", err)
- }
- defer os.RemoveAll(dir)
-
- path := filepath.Join(dir, "long_name.and_extension")
- f, err := os.Create(path)
- if err != nil {
- t.Fatalf("failed to create %v: %v", path, err)
- }
- f.Close()
-
- type X struct {
- fd windows.Win32finddata
- got byte
- pad [10]byte // to protect ourselves
-
- }
- var want byte = 2 // it is unlikely to have this character in the filename
- x := X{got: want}
-
- pathp, _ := windows.UTF16PtrFromString(path)
- h, err := windows.FindFirstFile(pathp, &(x.fd))
- if err != nil {
- t.Fatalf("FindFirstFile failed: %v", err)
- }
- err = windows.FindClose(h)
- if err != nil {
- t.Fatalf("FindClose failed: %v", err)
- }
-
- if x.got != want {
- t.Fatalf("memory corruption: want=%d got=%d", want, x.got)
- }
-}
-
-func TestFormatMessage(t *testing.T) {
- dll := windows.MustLoadDLL("pdh.dll")
-
- pdhOpenQuery := func(datasrc *uint16, userdata uint32, query *windows.Handle) (errno uintptr) {
- r0, _, _ := syscall.Syscall(dll.MustFindProc("PdhOpenQueryW").Addr(), 3, uintptr(unsafe.Pointer(datasrc)), uintptr(userdata), uintptr(unsafe.Pointer(query)))
- return r0
- }
-
- pdhCloseQuery := func(query windows.Handle) (errno uintptr) {
- r0, _, _ := syscall.Syscall(dll.MustFindProc("PdhCloseQuery").Addr(), 1, uintptr(query), 0, 0)
- return r0
- }
-
- var q windows.Handle
- name, err := windows.UTF16PtrFromString("no_such_source")
- if err != nil {
- t.Fatal(err)
- }
- errno := pdhOpenQuery(name, 0, &q)
- if errno == 0 {
- pdhCloseQuery(q)
- t.Fatal("PdhOpenQuery succeeded, but expected to fail.")
- }
-
- const flags uint32 = syscall.FORMAT_MESSAGE_FROM_HMODULE | syscall.FORMAT_MESSAGE_ARGUMENT_ARRAY | syscall.FORMAT_MESSAGE_IGNORE_INSERTS
- buf := make([]uint16, 300)
- _, err = windows.FormatMessage(flags, uintptr(dll.Handle), uint32(errno), 0, buf, nil)
- if err != nil {
- t.Fatalf("FormatMessage for handle=%x and errno=%x failed: %v", dll.Handle, errno, err)
- }
-}
-
-func abort(funcname string, err error) {
- panic(funcname + " failed: " + err.Error())
-}
-
-func ExampleLoadLibrary() {
- h, err := windows.LoadLibrary("kernel32.dll")
- if err != nil {
- abort("LoadLibrary", err)
- }
- defer windows.FreeLibrary(h)
- proc, err := windows.GetProcAddress(h, "GetVersion")
- if err != nil {
- abort("GetProcAddress", err)
- }
- r, _, _ := syscall.Syscall(uintptr(proc), 0, 0, 0, 0)
- major := byte(r)
- minor := uint8(r >> 8)
- build := uint16(r >> 16)
- print("windows version ", major, ".", minor, " (Build ", build, ")\n")
-}
-
-func TestTOKEN_ALL_ACCESS(t *testing.T) {
- if windows.TOKEN_ALL_ACCESS != 0xF01FF {
- t.Errorf("TOKEN_ALL_ACCESS = %x, want 0xF01FF", windows.TOKEN_ALL_ACCESS)
- }
-}
diff --git a/vendor/golang.org/x/text/collate/build/builder_test.go b/vendor/golang.org/x/text/collate/build/builder_test.go
deleted file mode 100644
index ff0aba3ae..000000000
--- a/vendor/golang.org/x/text/collate/build/builder_test.go
+++ /dev/null
@@ -1,290 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package build
-
-import "testing"
-
-// cjk returns an implicit collation element for a CJK rune.
-func cjk(r rune) []rawCE {
- // A CJK character C is represented in the DUCET as
- // [.AAAA.0020.0002.C][.BBBB.0000.0000.C]
- // Where AAAA is the most significant 15 bits plus a base value.
- // Any base value will work for the test, so we pick the common value of FB40.
- const base = 0xFB40
- return []rawCE{
- {w: []int{base + int(r>>15), defaultSecondary, defaultTertiary, int(r)}},
- {w: []int{int(r&0x7FFF) | 0x8000, 0, 0, int(r)}},
- }
-}
-
-func pCE(p int) []rawCE {
- return mkCE([]int{p, defaultSecondary, defaultTertiary, 0}, 0)
-}
-
-func pqCE(p, q int) []rawCE {
- return mkCE([]int{p, defaultSecondary, defaultTertiary, q}, 0)
-}
-
-func ptCE(p, t int) []rawCE {
- return mkCE([]int{p, defaultSecondary, t, 0}, 0)
-}
-
-func ptcCE(p, t int, ccc uint8) []rawCE {
- return mkCE([]int{p, defaultSecondary, t, 0}, ccc)
-}
-
-func sCE(s int) []rawCE {
- return mkCE([]int{0, s, defaultTertiary, 0}, 0)
-}
-
-func stCE(s, t int) []rawCE {
- return mkCE([]int{0, s, t, 0}, 0)
-}
-
-func scCE(s int, ccc uint8) []rawCE {
- return mkCE([]int{0, s, defaultTertiary, 0}, ccc)
-}
-
-func mkCE(w []int, ccc uint8) []rawCE {
- return []rawCE{rawCE{w, ccc}}
-}
-
-// ducetElem is used to define test data that is used to generate a table.
-type ducetElem struct {
- str string
- ces []rawCE
-}
-
-func newBuilder(t *testing.T, ducet []ducetElem) *Builder {
- b := NewBuilder()
- for _, e := range ducet {
- ces := [][]int{}
- for _, ce := range e.ces {
- ces = append(ces, ce.w)
- }
- if err := b.Add([]rune(e.str), ces, nil); err != nil {
- t.Errorf(err.Error())
- }
- }
- b.t = &table{}
- b.root.sort()
- return b
-}
-
-type convertTest struct {
- in, out []rawCE
- err bool
-}
-
-var convLargeTests = []convertTest{
- {pCE(0xFB39), pCE(0xFB39), false},
- {cjk(0x2F9B2), pqCE(0x3F9B2, 0x2F9B2), false},
- {pCE(0xFB40), pCE(0), true},
- {append(pCE(0xFB40), pCE(0)[0]), pCE(0), true},
- {pCE(0xFFFE), pCE(illegalOffset), false},
- {pCE(0xFFFF), pCE(illegalOffset + 1), false},
-}
-
-func TestConvertLarge(t *testing.T) {
- for i, tt := range convLargeTests {
- e := new(entry)
- for _, ce := range tt.in {
- e.elems = append(e.elems, makeRawCE(ce.w, ce.ccc))
- }
- elems, err := convertLargeWeights(e.elems)
- if tt.err {
- if err == nil {
- t.Errorf("%d: expected error; none found", i)
- }
- continue
- } else if err != nil {
- t.Errorf("%d: unexpected error: %v", i, err)
- }
- if !equalCEArrays(elems, tt.out) {
- t.Errorf("%d: conversion was %x; want %x", i, elems, tt.out)
- }
- }
-}
-
-// Collation element table for simplify tests.
-var simplifyTest = []ducetElem{
- {"\u0300", sCE(30)}, // grave
- {"\u030C", sCE(40)}, // caron
- {"A", ptCE(100, 8)},
- {"D", ptCE(104, 8)},
- {"E", ptCE(105, 8)},
- {"I", ptCE(110, 8)},
- {"z", ptCE(130, 8)},
- {"\u05F2", append(ptCE(200, 4), ptCE(200, 4)[0])},
- {"\u05B7", sCE(80)},
- {"\u00C0", append(ptCE(100, 8), sCE(30)...)}, // A with grave, can be removed
- {"\u00C8", append(ptCE(105, 8), sCE(30)...)}, // E with grave
- {"\uFB1F", append(ptCE(200, 4), ptCE(200, 4)[0], sCE(80)[0])}, // eliminated by NFD
- {"\u00C8\u0302", ptCE(106, 8)}, // block previous from simplifying
- {"\u01C5", append(ptCE(104, 9), ptCE(130, 4)[0], stCE(40, maxTertiary)[0])}, // eliminated by NFKD
- // no removal: tertiary value of third element is not maxTertiary
- {"\u2162", append(ptCE(110, 9), ptCE(110, 4)[0], ptCE(110, 8)[0])},
-}
-
-var genColTests = []ducetElem{
- {"\uFA70", pqCE(0x1FA70, 0xFA70)},
- {"A\u0300", append(ptCE(100, 8), sCE(30)...)},
- {"A\u0300\uFA70", append(ptCE(100, 8), sCE(30)[0], pqCE(0x1FA70, 0xFA70)[0])},
- {"A\u0300A\u0300", append(ptCE(100, 8), sCE(30)[0], ptCE(100, 8)[0], sCE(30)[0])},
-}
-
-func TestGenColElems(t *testing.T) {
- b := newBuilder(t, simplifyTest[:5])
-
- for i, tt := range genColTests {
- res := b.root.genColElems(tt.str)
- if !equalCEArrays(tt.ces, res) {
- t.Errorf("%d: result %X; want %X", i, res, tt.ces)
- }
- }
-}
-
-type strArray []string
-
-func (sa strArray) contains(s string) bool {
- for _, e := range sa {
- if e == s {
- return true
- }
- }
- return false
-}
-
-var simplifyRemoved = strArray{"\u00C0", "\uFB1F"}
-var simplifyMarked = strArray{"\u01C5"}
-
-func TestSimplify(t *testing.T) {
- b := newBuilder(t, simplifyTest)
- o := &b.root
- simplify(o)
-
- for i, tt := range simplifyTest {
- if simplifyRemoved.contains(tt.str) {
- continue
- }
- e := o.find(tt.str)
- if e.str != tt.str || !equalCEArrays(e.elems, tt.ces) {
- t.Errorf("%d: found element %s -> %X; want %s -> %X", i, e.str, e.elems, tt.str, tt.ces)
- break
- }
- }
- var i, k int
- for e := o.front(); e != nil; e, _ = e.nextIndexed() {
- gold := simplifyMarked.contains(e.str)
- if gold {
- k++
- }
- if gold != e.decompose {
- t.Errorf("%d: %s has decompose %v; want %v", i, e.str, e.decompose, gold)
- }
- i++
- }
- if k != len(simplifyMarked) {
- t.Errorf(" an entry that should be marked as decompose was deleted")
- }
-}
-
-var expandTest = []ducetElem{
- {"\u0300", append(scCE(29, 230), scCE(30, 230)...)},
- {"\u00C0", append(ptCE(100, 8), scCE(30, 230)...)},
- {"\u00C8", append(ptCE(105, 8), scCE(30, 230)...)},
- {"\u00C9", append(ptCE(105, 8), scCE(30, 230)...)}, // identical expansion
- {"\u05F2", append(ptCE(200, 4), ptCE(200, 4)[0], ptCE(200, 4)[0])},
- {"\u01FF", append(ptCE(200, 4), ptcCE(201, 4, 0)[0], scCE(30, 230)[0])},
-}
-
-func TestExpand(t *testing.T) {
- const (
- totalExpansions = 5
- totalElements = 2 + 2 + 2 + 3 + 3 + totalExpansions
- )
- b := newBuilder(t, expandTest)
- o := &b.root
- b.processExpansions(o)
-
- e := o.front()
- for _, tt := range expandTest {
- exp := b.t.ExpandElem[e.expansionIndex:]
- if int(exp[0]) != len(tt.ces) {
- t.Errorf("%U: len(expansion)==%d; want %d", []rune(tt.str)[0], exp[0], len(tt.ces))
- }
- exp = exp[1:]
- for j, w := range tt.ces {
- if ce, _ := makeCE(w); exp[j] != ce {
- t.Errorf("%U: element %d is %X; want %X", []rune(tt.str)[0], j, exp[j], ce)
- }
- }
- e, _ = e.nextIndexed()
- }
- // Verify uniquing.
- if len(b.t.ExpandElem) != totalElements {
- t.Errorf("len(expandElem)==%d; want %d", len(b.t.ExpandElem), totalElements)
- }
-}
-
-var contractTest = []ducetElem{
- {"abc", pCE(102)},
- {"abd", pCE(103)},
- {"a", pCE(100)},
- {"ab", pCE(101)},
- {"ac", pCE(104)},
- {"bcd", pCE(202)},
- {"b", pCE(200)},
- {"bc", pCE(201)},
- {"bd", pCE(203)},
- // shares suffixes with a*
- {"Ab", pCE(301)},
- {"A", pCE(300)},
- {"Ac", pCE(304)},
- {"Abc", pCE(302)},
- {"Abd", pCE(303)},
- // starter to be ignored
- {"z", pCE(1000)},
-}
-
-func TestContract(t *testing.T) {
- const (
- totalElements = 5 + 5 + 4
- )
- b := newBuilder(t, contractTest)
- o := &b.root
- b.processContractions(o)
-
- indexMap := make(map[int]bool)
- handleMap := make(map[rune]*entry)
- for e := o.front(); e != nil; e, _ = e.nextIndexed() {
- if e.contractionHandle.n > 0 {
- handleMap[e.runes[0]] = e
- indexMap[e.contractionHandle.index] = true
- }
- }
- // Verify uniquing.
- if len(indexMap) != 2 {
- t.Errorf("number of tries is %d; want %d", len(indexMap), 2)
- }
- for _, tt := range contractTest {
- e, ok := handleMap[[]rune(tt.str)[0]]
- if !ok {
- continue
- }
- str := tt.str[1:]
- offset, n := lookup(&b.t.ContractTries, e.contractionHandle, []byte(str))
- if len(str) != n {
- t.Errorf("%s: bytes consumed==%d; want %d", tt.str, n, len(str))
- }
- ce := b.t.ContractElem[offset+e.contractionIndex]
- if want, _ := makeCE(tt.ces[0]); want != ce {
- t.Errorf("%s: element %X; want %X", tt.str, ce, want)
- }
- }
- if len(b.t.ContractElem) != totalElements {
- t.Errorf("len(expandElem)==%d; want %d", len(b.t.ContractElem), totalElements)
- }
-}
diff --git a/vendor/golang.org/x/text/collate/build/colelem_test.go b/vendor/golang.org/x/text/collate/build/colelem_test.go
deleted file mode 100644
index d0c8d07d8..000000000
--- a/vendor/golang.org/x/text/collate/build/colelem_test.go
+++ /dev/null
@@ -1,215 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package build
-
-import (
- "testing"
-
- "golang.org/x/text/internal/colltab"
-)
-
-type ceTest struct {
- f func(in []int) (uint32, error)
- arg []int
- val uint32
-}
-
-func normalCE(in []int) (ce uint32, err error) {
- return makeCE(rawCE{w: in[:3], ccc: uint8(in[3])})
-}
-
-func expandCE(in []int) (ce uint32, err error) {
- return makeExpandIndex(in[0])
-}
-
-func contractCE(in []int) (ce uint32, err error) {
- return makeContractIndex(ctHandle{in[0], in[1]}, in[2])
-}
-
-func decompCE(in []int) (ce uint32, err error) {
- return makeDecompose(in[0], in[1])
-}
-
-var ceTests = []ceTest{
- {normalCE, []int{0, 0, 0, 0}, 0xA0000000},
- {normalCE, []int{0, 0x28, 3, 0}, 0xA0002803},
- {normalCE, []int{0, 0x28, 3, 0xFF}, 0xAFF02803},
- {normalCE, []int{100, defaultSecondary, 3, 0}, 0x0000C883},
- // non-ignorable primary with non-default secondary
- {normalCE, []int{100, 0x28, defaultTertiary, 0}, 0x4000C828},
- {normalCE, []int{100, defaultSecondary + 8, 3, 0}, 0x0000C983},
- {normalCE, []int{100, 0, 3, 0}, 0xFFFF}, // non-ignorable primary with non-supported secondary
- {normalCE, []int{100, 1, 3, 0}, 0xFFFF},
- {normalCE, []int{1 << maxPrimaryBits, defaultSecondary, 0, 0}, 0xFFFF},
- {normalCE, []int{0, 1 << maxSecondaryBits, 0, 0}, 0xFFFF},
- {normalCE, []int{100, defaultSecondary, 1 << maxTertiaryBits, 0}, 0xFFFF},
- {normalCE, []int{0x123, defaultSecondary, 8, 0xFF}, 0x88FF0123},
- {normalCE, []int{0x123, defaultSecondary + 1, 8, 0xFF}, 0xFFFF},
-
- {contractCE, []int{0, 0, 0}, 0xC0000000},
- {contractCE, []int{1, 1, 1}, 0xC0010011},
- {contractCE, []int{1, (1 << maxNBits) - 1, 1}, 0xC001001F},
- {contractCE, []int{(1 << maxTrieIndexBits) - 1, 1, 1}, 0xC001FFF1},
- {contractCE, []int{1, 1, (1 << maxContractOffsetBits) - 1}, 0xDFFF0011},
- {contractCE, []int{1, (1 << maxNBits), 1}, 0xFFFF},
- {contractCE, []int{(1 << maxTrieIndexBits), 1, 1}, 0xFFFF},
- {contractCE, []int{1, (1 << maxContractOffsetBits), 1}, 0xFFFF},
-
- {expandCE, []int{0}, 0xE0000000},
- {expandCE, []int{5}, 0xE0000005},
- {expandCE, []int{(1 << maxExpandIndexBits) - 1}, 0xE000FFFF},
- {expandCE, []int{1 << maxExpandIndexBits}, 0xFFFF},
-
- {decompCE, []int{0, 0}, 0xF0000000},
- {decompCE, []int{1, 1}, 0xF0000101},
- {decompCE, []int{0x1F, 0x1F}, 0xF0001F1F},
- {decompCE, []int{256, 0x1F}, 0xFFFF},
- {decompCE, []int{0x1F, 256}, 0xFFFF},
-}
-
-func TestColElem(t *testing.T) {
- for i, tt := range ceTests {
- in := make([]int, len(tt.arg))
- copy(in, tt.arg)
- ce, err := tt.f(in)
- if tt.val == 0xFFFF {
- if err == nil {
- t.Errorf("%d: expected error for args %x", i, tt.arg)
- }
- continue
- }
- if err != nil {
- t.Errorf("%d: unexpected error: %v", i, err.Error())
- }
- if ce != tt.val {
- t.Errorf("%d: colElem=%X; want %X", i, ce, tt.val)
- }
- }
-}
-
-func mkRawCES(in [][]int) []rawCE {
- out := []rawCE{}
- for _, w := range in {
- out = append(out, rawCE{w: w})
- }
- return out
-}
-
-type weightsTest struct {
- a, b [][]int
- level colltab.Level
- result int
-}
-
-var nextWeightTests = []weightsTest{
- {
- a: [][]int{{100, 20, 5, 0}},
- b: [][]int{{101, defaultSecondary, defaultTertiary, 0}},
- level: colltab.Primary,
- },
- {
- a: [][]int{{100, 20, 5, 0}},
- b: [][]int{{100, 21, defaultTertiary, 0}},
- level: colltab.Secondary,
- },
- {
- a: [][]int{{100, 20, 5, 0}},
- b: [][]int{{100, 20, 6, 0}},
- level: colltab.Tertiary,
- },
- {
- a: [][]int{{100, 20, 5, 0}},
- b: [][]int{{100, 20, 5, 0}},
- level: colltab.Identity,
- },
-}
-
-var extra = [][]int{{200, 32, 8, 0}, {0, 32, 8, 0}, {0, 0, 8, 0}, {0, 0, 0, 0}}
-
-func TestNextWeight(t *testing.T) {
- for i, tt := range nextWeightTests {
- test := func(l colltab.Level, tt weightsTest, a, gold [][]int) {
- res := nextWeight(tt.level, mkRawCES(a))
- if !equalCEArrays(mkRawCES(gold), res) {
- t.Errorf("%d:%d: expected weights %d; found %d", i, l, gold, res)
- }
- }
- test(-1, tt, tt.a, tt.b)
- for l := colltab.Primary; l <= colltab.Tertiary; l++ {
- if tt.level <= l {
- test(l, tt, append(tt.a, extra[l]), tt.b)
- } else {
- test(l, tt, append(tt.a, extra[l]), append(tt.b, extra[l]))
- }
- }
- }
-}
-
-var compareTests = []weightsTest{
- {
- [][]int{{100, 20, 5, 0}},
- [][]int{{100, 20, 5, 0}},
- colltab.Identity,
- 0,
- },
- {
- [][]int{{100, 20, 5, 0}, extra[0]},
- [][]int{{100, 20, 5, 1}},
- colltab.Primary,
- 1,
- },
- {
- [][]int{{100, 20, 5, 0}},
- [][]int{{101, 20, 5, 0}},
- colltab.Primary,
- -1,
- },
- {
- [][]int{{101, 20, 5, 0}},
- [][]int{{100, 20, 5, 0}},
- colltab.Primary,
- 1,
- },
- {
- [][]int{{100, 0, 0, 0}, {0, 20, 5, 0}},
- [][]int{{0, 20, 5, 0}, {100, 0, 0, 0}},
- colltab.Identity,
- 0,
- },
- {
- [][]int{{100, 20, 5, 0}},
- [][]int{{100, 21, 5, 0}},
- colltab.Secondary,
- -1,
- },
- {
- [][]int{{100, 20, 5, 0}},
- [][]int{{100, 20, 2, 0}},
- colltab.Tertiary,
- 1,
- },
- {
- [][]int{{100, 20, 5, 1}},
- [][]int{{100, 20, 5, 2}},
- colltab.Quaternary,
- -1,
- },
-}
-
-func TestCompareWeights(t *testing.T) {
- for i, tt := range compareTests {
- test := func(tt weightsTest, a, b [][]int) {
- res, level := compareWeights(mkRawCES(a), mkRawCES(b))
- if res != tt.result {
- t.Errorf("%d: expected comparison result %d; found %d", i, tt.result, res)
- }
- if level != tt.level {
- t.Errorf("%d: expected level %d; found %d", i, tt.level, level)
- }
- }
- test(tt, tt.a, tt.b)
- test(tt, append(tt.a, extra[0]), append(tt.b, extra[0]))
- }
-}
diff --git a/vendor/golang.org/x/text/collate/build/contract_test.go b/vendor/golang.org/x/text/collate/build/contract_test.go
deleted file mode 100644
index 2e0eaecd5..000000000
--- a/vendor/golang.org/x/text/collate/build/contract_test.go
+++ /dev/null
@@ -1,266 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package build
-
-import (
- "bytes"
- "sort"
- "testing"
-
- "golang.org/x/text/internal/colltab"
-)
-
-var largetosmall = []stridx{
- {"a", 5},
- {"ab", 4},
- {"abc", 3},
- {"abcd", 2},
- {"abcde", 1},
- {"abcdef", 0},
-}
-
-var offsetSortTests = [][]stridx{
- {
- {"bcde", 1},
- {"bc", 5},
- {"ab", 4},
- {"bcd", 3},
- {"abcd", 0},
- {"abc", 2},
- },
- largetosmall,
-}
-
-func TestOffsetSort(t *testing.T) {
- for i, st := range offsetSortTests {
- sort.Sort(offsetSort(st))
- for j, si := range st {
- if j != si.index {
- t.Errorf("%d: failed: %v", i, st)
- }
- }
- }
- for i, tt := range genStateTests {
- // ensure input is well-formed
- sort.Sort(offsetSort(tt.in))
- for j, si := range tt.in {
- if si.index != j+1 {
- t.Errorf("%dth sort failed: %v", i, tt.in)
- }
- }
- }
-}
-
-var genidxtest1 = []stridx{
- {"bcde", 3},
- {"bc", 6},
- {"ab", 2},
- {"bcd", 5},
- {"abcd", 0},
- {"abc", 1},
- {"bcdf", 4},
-}
-
-var genidxSortTests = [][]stridx{
- genidxtest1,
- largetosmall,
-}
-
-func TestGenIdxSort(t *testing.T) {
- for i, st := range genidxSortTests {
- sort.Sort(genidxSort(st))
- for j, si := range st {
- if j != si.index {
- t.Errorf("%dth sort failed %v", i, st)
- break
- }
- }
- }
-}
-
-var entrySortTests = []colltab.ContractTrieSet{
- {
- {10, 0, 1, 3},
- {99, 0, 1, 0},
- {20, 50, 0, 2},
- {30, 0, 1, 1},
- },
-}
-
-func TestEntrySort(t *testing.T) {
- for i, et := range entrySortTests {
- sort.Sort(entrySort(et))
- for j, fe := range et {
- if j != int(fe.I) {
- t.Errorf("%dth sort failed %v", i, et)
- break
- }
- }
- }
-}
-
-type GenStateTest struct {
- in []stridx
- firstBlockLen int
- out colltab.ContractTrieSet
-}
-
-var genStateTests = []GenStateTest{
- {[]stridx{
- {"abc", 1},
- },
- 1,
- colltab.ContractTrieSet{
- {'a', 0, 1, noIndex},
- {'b', 0, 1, noIndex},
- {'c', 'c', final, 1},
- },
- },
- {[]stridx{
- {"abc", 1},
- {"abd", 2},
- {"abe", 3},
- },
- 1,
- colltab.ContractTrieSet{
- {'a', 0, 1, noIndex},
- {'b', 0, 1, noIndex},
- {'c', 'e', final, 1},
- },
- },
- {[]stridx{
- {"abc", 1},
- {"ab", 2},
- {"a", 3},
- },
- 1,
- colltab.ContractTrieSet{
- {'a', 0, 1, 3},
- {'b', 0, 1, 2},
- {'c', 'c', final, 1},
- },
- },
- {[]stridx{
- {"abc", 1},
- {"abd", 2},
- {"ab", 3},
- {"ac", 4},
- {"a", 5},
- {"b", 6},
- },
- 2,
- colltab.ContractTrieSet{
- {'b', 'b', final, 6},
- {'a', 0, 2, 5},
- {'c', 'c', final, 4},
- {'b', 0, 1, 3},
- {'c', 'd', final, 1},
- },
- },
- {[]stridx{
- {"bcde", 2},
- {"bc", 7},
- {"ab", 6},
- {"bcd", 5},
- {"abcd", 1},
- {"abc", 4},
- {"bcdf", 3},
- },
- 2,
- colltab.ContractTrieSet{
- {'b', 3, 1, noIndex},
- {'a', 0, 1, noIndex},
- {'b', 0, 1, 6},
- {'c', 0, 1, 4},
- {'d', 'd', final, 1},
- {'c', 0, 1, 7},
- {'d', 0, 1, 5},
- {'e', 'f', final, 2},
- },
- },
-}
-
-func TestGenStates(t *testing.T) {
- for i, tt := range genStateTests {
- si := []stridx{}
- for _, e := range tt.in {
- si = append(si, e)
- }
- // ensure input is well-formed
- sort.Sort(genidxSort(si))
- ct := colltab.ContractTrieSet{}
- n, _ := genStates(&ct, si)
- if nn := tt.firstBlockLen; nn != n {
- t.Errorf("%d: block len %v; want %v", i, n, nn)
- }
- if lv, lw := len(ct), len(tt.out); lv != lw {
- t.Errorf("%d: len %v; want %v", i, lv, lw)
- continue
- }
- for j, fe := range tt.out {
- const msg = "%d:%d: value %s=%v; want %v"
- if fe.L != ct[j].L {
- t.Errorf(msg, i, j, "l", ct[j].L, fe.L)
- }
- if fe.H != ct[j].H {
- t.Errorf(msg, i, j, "h", ct[j].H, fe.H)
- }
- if fe.N != ct[j].N {
- t.Errorf(msg, i, j, "n", ct[j].N, fe.N)
- }
- if fe.I != ct[j].I {
- t.Errorf(msg, i, j, "i", ct[j].I, fe.I)
- }
- }
- }
-}
-
-func TestLookupContraction(t *testing.T) {
- for i, tt := range genStateTests {
- input := []string{}
- for _, e := range tt.in {
- input = append(input, e.str)
- }
- cts := colltab.ContractTrieSet{}
- h, _ := appendTrie(&cts, input)
- for j, si := range tt.in {
- str := si.str
- for _, s := range []string{str, str + "X"} {
- msg := "%d:%d: %s(%s) %v; want %v"
- idx, sn := lookup(&cts, h, []byte(s))
- if idx != si.index {
- t.Errorf(msg, i, j, "index", s, idx, si.index)
- }
- if sn != len(str) {
- t.Errorf(msg, i, j, "sn", s, sn, len(str))
- }
- }
- }
- }
-}
-
-func TestPrintContractionTrieSet(t *testing.T) {
- testdata := colltab.ContractTrieSet(genStateTests[4].out)
- buf := &bytes.Buffer{}
- print(&testdata, buf, "test")
- if contractTrieOutput != buf.String() {
- t.Errorf("output differs; found\n%s", buf.String())
- println(string(buf.Bytes()))
- }
-}
-
-const contractTrieOutput = `// testCTEntries: 8 entries, 32 bytes
-var testCTEntries = [8]struct{L,H,N,I uint8}{
- {0x62, 0x3, 1, 255},
- {0x61, 0x0, 1, 255},
- {0x62, 0x0, 1, 6},
- {0x63, 0x0, 1, 4},
- {0x64, 0x64, 0, 1},
- {0x63, 0x0, 1, 7},
- {0x64, 0x0, 1, 5},
- {0x65, 0x66, 0, 2},
-}
-var testContractTrieSet = colltab.ContractTrieSet( testCTEntries[:] )
-`
diff --git a/vendor/golang.org/x/text/collate/build/order_test.go b/vendor/golang.org/x/text/collate/build/order_test.go
deleted file mode 100644
index 0e174bfbd..000000000
--- a/vendor/golang.org/x/text/collate/build/order_test.go
+++ /dev/null
@@ -1,229 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package build
-
-import (
- "strconv"
- "testing"
-
- "golang.org/x/text/internal/colltab"
-)
-
-type entryTest struct {
- f func(in []int) (uint32, error)
- arg []int
- val uint32
-}
-
-// makeList returns a list of entries of length n+2, with n normal
-// entries plus a leading and trailing anchor.
-func makeList(n int) []*entry {
- es := make([]*entry, n+2)
- weights := []rawCE{{w: []int{100, 20, 5, 0}}}
- for i := range es {
- runes := []rune{rune(i)}
- es[i] = &entry{
- runes: runes,
- elems: weights,
- }
- weights = nextWeight(colltab.Primary, weights)
- }
- for i := 1; i < len(es); i++ {
- es[i-1].next = es[i]
- es[i].prev = es[i-1]
- _, es[i-1].level = compareWeights(es[i-1].elems, es[i].elems)
- }
- es[0].exclude = true
- es[0].logical = firstAnchor
- es[len(es)-1].exclude = true
- es[len(es)-1].logical = lastAnchor
- return es
-}
-
-func TestNextIndexed(t *testing.T) {
- const n = 5
- es := makeList(n)
- for i := int64(0); i < 1<<n; i++ {
- mask := strconv.FormatInt(i+(1<<n), 2)
- for i, c := range mask {
- es[i].exclude = c == '1'
- }
- e := es[0]
- for i, c := range mask {
- if c == '0' {
- e, _ = e.nextIndexed()
- if e != es[i] {
- t.Errorf("%d: expected entry %d; found %d", i, es[i].elems, e.elems)
- }
- }
- }
- if e, _ = e.nextIndexed(); e != nil {
- t.Errorf("%d: expected nil entry; found %d", i, e.elems)
- }
- }
-}
-
-func TestRemove(t *testing.T) {
- const n = 5
- for i := int64(0); i < 1<<n; i++ {
- es := makeList(n)
- mask := strconv.FormatInt(i+(1<<n), 2)
- for i, c := range mask {
- if c == '0' {
- es[i].remove()
- }
- }
- e := es[0]
- for i, c := range mask {
- if c == '1' {
- if e != es[i] {
- t.Errorf("%d: expected entry %d; found %d", i, es[i].elems, e.elems)
- }
- e, _ = e.nextIndexed()
- }
- }
- if e != nil {
- t.Errorf("%d: expected nil entry; found %d", i, e.elems)
- }
- }
-}
-
-// nextPerm generates the next permutation of the array. The starting
-// permutation is assumed to be a list of integers sorted in increasing order.
-// It returns false if there are no more permuations left.
-func nextPerm(a []int) bool {
- i := len(a) - 2
- for ; i >= 0; i-- {
- if a[i] < a[i+1] {
- break
- }
- }
- if i < 0 {
- return false
- }
- for j := len(a) - 1; j >= i; j-- {
- if a[j] > a[i] {
- a[i], a[j] = a[j], a[i]
- break
- }
- }
- for j := i + 1; j < (len(a)+i+1)/2; j++ {
- a[j], a[len(a)+i-j] = a[len(a)+i-j], a[j]
- }
- return true
-}
-
-func TestInsertAfter(t *testing.T) {
- const n = 5
- orig := makeList(n)
- perm := make([]int, n)
- for i := range perm {
- perm[i] = i + 1
- }
- for ok := true; ok; ok = nextPerm(perm) {
- es := makeList(n)
- last := es[0]
- for _, i := range perm {
- last.insertAfter(es[i])
- last = es[i]
- }
- for _, e := range es {
- e.elems = es[0].elems
- }
- e := es[0]
- for _, i := range perm {
- e, _ = e.nextIndexed()
- if e.runes[0] != orig[i].runes[0] {
- t.Errorf("%d:%d: expected entry %X; found %X", perm, i, orig[i].runes, e.runes)
- break
- }
- }
- }
-}
-
-func TestInsertBefore(t *testing.T) {
- const n = 5
- orig := makeList(n)
- perm := make([]int, n)
- for i := range perm {
- perm[i] = i + 1
- }
- for ok := true; ok; ok = nextPerm(perm) {
- es := makeList(n)
- last := es[len(es)-1]
- for _, i := range perm {
- last.insertBefore(es[i])
- last = es[i]
- }
- for _, e := range es {
- e.elems = es[0].elems
- }
- e := es[0]
- for i := n - 1; i >= 0; i-- {
- e, _ = e.nextIndexed()
- if e.runes[0] != rune(perm[i]) {
- t.Errorf("%d:%d: expected entry %X; found %X", perm, i, orig[i].runes, e.runes)
- break
- }
- }
- }
-}
-
-type entryLessTest struct {
- a, b *entry
- res bool
-}
-
-var (
- w1 = []rawCE{{w: []int{100, 20, 5, 5}}}
- w2 = []rawCE{{w: []int{101, 20, 5, 5}}}
-)
-
-var entryLessTests = []entryLessTest{
- {&entry{str: "a", elems: w1},
- &entry{str: "a", elems: w1},
- false,
- },
- {&entry{str: "a", elems: w1},
- &entry{str: "a", elems: w2},
- true,
- },
- {&entry{str: "a", elems: w1},
- &entry{str: "b", elems: w1},
- true,
- },
- {&entry{str: "a", elems: w2},
- &entry{str: "a", elems: w1},
- false,
- },
- {&entry{str: "c", elems: w1},
- &entry{str: "b", elems: w1},
- false,
- },
- {&entry{str: "a", elems: w1, logical: firstAnchor},
- &entry{str: "a", elems: w1},
- true,
- },
- {&entry{str: "a", elems: w1},
- &entry{str: "b", elems: w1, logical: firstAnchor},
- false,
- },
- {&entry{str: "b", elems: w1},
- &entry{str: "a", elems: w1, logical: lastAnchor},
- true,
- },
- {&entry{str: "a", elems: w1, logical: lastAnchor},
- &entry{str: "c", elems: w1},
- false,
- },
-}
-
-func TestEntryLess(t *testing.T) {
- for i, tt := range entryLessTests {
- if res := entryLess(tt.a, tt.b); res != tt.res {
- t.Errorf("%d: was %v; want %v", i, res, tt.res)
- }
- }
-}
diff --git a/vendor/golang.org/x/text/collate/build/trie_test.go b/vendor/golang.org/x/text/collate/build/trie_test.go
deleted file mode 100644
index 4d4f6e4d1..000000000
--- a/vendor/golang.org/x/text/collate/build/trie_test.go
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package build
-
-import (
- "bytes"
- "fmt"
- "testing"
-)
-
-// We take the smallest, largest and an arbitrary value for each
-// of the UTF-8 sequence lengths.
-var testRunes = []rune{
- 0x01, 0x0C, 0x7F, // 1-byte sequences
- 0x80, 0x100, 0x7FF, // 2-byte sequences
- 0x800, 0x999, 0xFFFF, // 3-byte sequences
- 0x10000, 0x10101, 0x10FFFF, // 4-byte sequences
- 0x200, 0x201, 0x202, 0x210, 0x215, // five entries in one sparse block
-}
-
-func makeTestTrie(t *testing.T) trie {
- n := newNode()
- for i, r := range testRunes {
- n.insert(r, uint32(i))
- }
- idx := newTrieBuilder()
- idx.addTrie(n)
- tr, err := idx.generate()
- if err != nil {
- t.Errorf(err.Error())
- }
- return *tr
-}
-
-func TestGenerateTrie(t *testing.T) {
- testdata := makeTestTrie(t)
- buf := &bytes.Buffer{}
- testdata.printArrays(buf, "test")
- fmt.Fprintf(buf, "var testTrie = ")
- testdata.printStruct(buf, &trieHandle{19, 0}, "test")
- if output != buf.String() {
- t.Error("output differs")
- }
-}
-
-var output = `// testValues: 832 entries, 3328 bytes
-// Block 2 is the null block.
-var testValues = [832]uint32 {
- // Block 0x0, offset 0x0
- 0x000c:0x00000001,
- // Block 0x1, offset 0x40
- 0x007f:0x00000002,
- // Block 0x2, offset 0x80
- // Block 0x3, offset 0xc0
- 0x00c0:0x00000003,
- // Block 0x4, offset 0x100
- 0x0100:0x00000004,
- // Block 0x5, offset 0x140
- 0x0140:0x0000000c, 0x0141:0x0000000d, 0x0142:0x0000000e,
- 0x0150:0x0000000f,
- 0x0155:0x00000010,
- // Block 0x6, offset 0x180
- 0x01bf:0x00000005,
- // Block 0x7, offset 0x1c0
- 0x01c0:0x00000006,
- // Block 0x8, offset 0x200
- 0x0219:0x00000007,
- // Block 0x9, offset 0x240
- 0x027f:0x00000008,
- // Block 0xa, offset 0x280
- 0x0280:0x00000009,
- // Block 0xb, offset 0x2c0
- 0x02c1:0x0000000a,
- // Block 0xc, offset 0x300
- 0x033f:0x0000000b,
-}
-
-// testLookup: 640 entries, 1280 bytes
-// Block 0 is the null block.
-var testLookup = [640]uint16 {
- // Block 0x0, offset 0x0
- // Block 0x1, offset 0x40
- // Block 0x2, offset 0x80
- // Block 0x3, offset 0xc0
- 0x0e0:0x05, 0x0e6:0x06,
- // Block 0x4, offset 0x100
- 0x13f:0x07,
- // Block 0x5, offset 0x140
- 0x140:0x08, 0x144:0x09,
- // Block 0x6, offset 0x180
- 0x190:0x03,
- // Block 0x7, offset 0x1c0
- 0x1ff:0x0a,
- // Block 0x8, offset 0x200
- 0x20f:0x05,
- // Block 0x9, offset 0x240
- 0x242:0x01, 0x244:0x02,
- 0x248:0x03,
- 0x25f:0x04,
- 0x260:0x01,
- 0x26f:0x02,
- 0x270:0x04, 0x274:0x06,
-}
-
-var testTrie = trie{ testLookup[1216:], testValues[0:], testLookup[:], testValues[:]}`
diff --git a/vendor/golang.org/x/text/collate/collate_test.go b/vendor/golang.org/x/text/collate/collate_test.go
deleted file mode 100644
index 0e78b96fa..000000000
--- a/vendor/golang.org/x/text/collate/collate_test.go
+++ /dev/null
@@ -1,482 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package collate
-
-import (
- "bytes"
- "testing"
-
- "golang.org/x/text/internal/colltab"
- "golang.org/x/text/language"
-)
-
-type weightsTest struct {
- opt opts
- in, out ColElems
-}
-
-type opts struct {
- lev int
- alt alternateHandling
- top int
-
- backwards bool
- caseLevel bool
-}
-
-// ignore returns an initialized boolean array based on the given Level.
-// A negative value means using the default setting of quaternary.
-func ignore(level colltab.Level) (ignore [colltab.NumLevels]bool) {
- if level < 0 {
- level = colltab.Quaternary
- }
- for i := range ignore {
- ignore[i] = level < colltab.Level(i)
- }
- return ignore
-}
-
-func makeCE(w []int) colltab.Elem {
- ce, err := colltab.MakeElem(w[0], w[1], w[2], uint8(w[3]))
- if err != nil {
- panic(err)
- }
- return ce
-}
-
-func (o opts) collator() *Collator {
- c := &Collator{
- options: options{
- ignore: ignore(colltab.Level(o.lev - 1)),
- alternate: o.alt,
- backwards: o.backwards,
- caseLevel: o.caseLevel,
- variableTop: uint32(o.top),
- },
- }
- return c
-}
-
-const (
- maxQ = 0x1FFFFF
-)
-
-func wpq(p, q int) Weights {
- return W(p, defaults.Secondary, defaults.Tertiary, q)
-}
-
-func wsq(s, q int) Weights {
- return W(0, s, defaults.Tertiary, q)
-}
-
-func wq(q int) Weights {
- return W(0, 0, 0, q)
-}
-
-var zero = W(0, 0, 0, 0)
-
-var processTests = []weightsTest{
- // Shifted
- { // simple sequence of non-variables
- opt: opts{alt: altShifted, top: 100},
- in: ColElems{W(200), W(300), W(400)},
- out: ColElems{wpq(200, maxQ), wpq(300, maxQ), wpq(400, maxQ)},
- },
- { // first is a variable
- opt: opts{alt: altShifted, top: 250},
- in: ColElems{W(200), W(300), W(400)},
- out: ColElems{wq(200), wpq(300, maxQ), wpq(400, maxQ)},
- },
- { // all but first are variable
- opt: opts{alt: altShifted, top: 999},
- in: ColElems{W(1000), W(200), W(300), W(400)},
- out: ColElems{wpq(1000, maxQ), wq(200), wq(300), wq(400)},
- },
- { // first is a modifier
- opt: opts{alt: altShifted, top: 999},
- in: ColElems{W(0, 10), W(1000)},
- out: ColElems{wsq(10, maxQ), wpq(1000, maxQ)},
- },
- { // primary ignorables
- opt: opts{alt: altShifted, top: 250},
- in: ColElems{W(200), W(0, 10), W(300), W(0, 15), W(400)},
- out: ColElems{wq(200), zero, wpq(300, maxQ), wsq(15, maxQ), wpq(400, maxQ)},
- },
- { // secondary ignorables
- opt: opts{alt: altShifted, top: 250},
- in: ColElems{W(200), W(0, 0, 10), W(300), W(0, 0, 15), W(400)},
- out: ColElems{wq(200), zero, wpq(300, maxQ), W(0, 0, 15, maxQ), wpq(400, maxQ)},
- },
- { // tertiary ignorables, no change
- opt: opts{alt: altShifted, top: 250},
- in: ColElems{W(200), zero, W(300), zero, W(400)},
- out: ColElems{wq(200), zero, wpq(300, maxQ), zero, wpq(400, maxQ)},
- },
-
- // ShiftTrimmed (same as Shifted)
- { // simple sequence of non-variables
- opt: opts{alt: altShiftTrimmed, top: 100},
- in: ColElems{W(200), W(300), W(400)},
- out: ColElems{wpq(200, maxQ), wpq(300, maxQ), wpq(400, maxQ)},
- },
- { // first is a variable
- opt: opts{alt: altShiftTrimmed, top: 250},
- in: ColElems{W(200), W(300), W(400)},
- out: ColElems{wq(200), wpq(300, maxQ), wpq(400, maxQ)},
- },
- { // all but first are variable
- opt: opts{alt: altShiftTrimmed, top: 999},
- in: ColElems{W(1000), W(200), W(300), W(400)},
- out: ColElems{wpq(1000, maxQ), wq(200), wq(300), wq(400)},
- },
- { // first is a modifier
- opt: opts{alt: altShiftTrimmed, top: 999},
- in: ColElems{W(0, 10), W(1000)},
- out: ColElems{wsq(10, maxQ), wpq(1000, maxQ)},
- },
- { // primary ignorables
- opt: opts{alt: altShiftTrimmed, top: 250},
- in: ColElems{W(200), W(0, 10), W(300), W(0, 15), W(400)},
- out: ColElems{wq(200), zero, wpq(300, maxQ), wsq(15, maxQ), wpq(400, maxQ)},
- },
- { // secondary ignorables
- opt: opts{alt: altShiftTrimmed, top: 250},
- in: ColElems{W(200), W(0, 0, 10), W(300), W(0, 0, 15), W(400)},
- out: ColElems{wq(200), zero, wpq(300, maxQ), W(0, 0, 15, maxQ), wpq(400, maxQ)},
- },
- { // tertiary ignorables, no change
- opt: opts{alt: altShiftTrimmed, top: 250},
- in: ColElems{W(200), zero, W(300), zero, W(400)},
- out: ColElems{wq(200), zero, wpq(300, maxQ), zero, wpq(400, maxQ)},
- },
-
- // Blanked
- { // simple sequence of non-variables
- opt: opts{alt: altBlanked, top: 100},
- in: ColElems{W(200), W(300), W(400)},
- out: ColElems{W(200), W(300), W(400)},
- },
- { // first is a variable
- opt: opts{alt: altBlanked, top: 250},
- in: ColElems{W(200), W(300), W(400)},
- out: ColElems{zero, W(300), W(400)},
- },
- { // all but first are variable
- opt: opts{alt: altBlanked, top: 999},
- in: ColElems{W(1000), W(200), W(300), W(400)},
- out: ColElems{W(1000), zero, zero, zero},
- },
- { // first is a modifier
- opt: opts{alt: altBlanked, top: 999},
- in: ColElems{W(0, 10), W(1000)},
- out: ColElems{W(0, 10), W(1000)},
- },
- { // primary ignorables
- opt: opts{alt: altBlanked, top: 250},
- in: ColElems{W(200), W(0, 10), W(300), W(0, 15), W(400)},
- out: ColElems{zero, zero, W(300), W(0, 15), W(400)},
- },
- { // secondary ignorables
- opt: opts{alt: altBlanked, top: 250},
- in: ColElems{W(200), W(0, 0, 10), W(300), W(0, 0, 15), W(400)},
- out: ColElems{zero, zero, W(300), W(0, 0, 15), W(400)},
- },
- { // tertiary ignorables, no change
- opt: opts{alt: altBlanked, top: 250},
- in: ColElems{W(200), zero, W(300), zero, W(400)},
- out: ColElems{zero, zero, W(300), zero, W(400)},
- },
-
- // Non-ignorable: input is always equal to output.
- { // all but first are variable
- opt: opts{alt: altNonIgnorable, top: 999},
- in: ColElems{W(1000), W(200), W(300), W(400)},
- out: ColElems{W(1000), W(200), W(300), W(400)},
- },
- { // primary ignorables
- opt: opts{alt: altNonIgnorable, top: 250},
- in: ColElems{W(200), W(0, 10), W(300), W(0, 15), W(400)},
- out: ColElems{W(200), W(0, 10), W(300), W(0, 15), W(400)},
- },
- { // secondary ignorables
- opt: opts{alt: altNonIgnorable, top: 250},
- in: ColElems{W(200), W(0, 0, 10), W(300), W(0, 0, 15), W(400)},
- out: ColElems{W(200), W(0, 0, 10), W(300), W(0, 0, 15), W(400)},
- },
- { // tertiary ignorables, no change
- opt: opts{alt: altNonIgnorable, top: 250},
- in: ColElems{W(200), zero, W(300), zero, W(400)},
- out: ColElems{W(200), zero, W(300), zero, W(400)},
- },
-}
-
-func TestProcessWeights(t *testing.T) {
- for i, tt := range processTests {
- in := convertFromWeights(tt.in)
- out := convertFromWeights(tt.out)
- processWeights(tt.opt.alt, uint32(tt.opt.top), in)
- for j, w := range in {
- if w != out[j] {
- t.Errorf("%d: Weights %d was %v; want %v", i, j, w, out[j])
- }
- }
- }
-}
-
-type keyFromElemTest struct {
- opt opts
- in ColElems
- out []byte
-}
-
-var defS = byte(defaults.Secondary)
-var defT = byte(defaults.Tertiary)
-
-const sep = 0 // separator byte
-
-var keyFromElemTests = []keyFromElemTest{
- { // simple primary and secondary weights.
- opts{alt: altShifted},
- ColElems{W(0x200), W(0x7FFF), W(0, 0x30), W(0x100)},
- []byte{0x2, 0, 0x7F, 0xFF, 0x1, 0x00, // primary
- sep, sep, 0, defS, 0, defS, 0, 0x30, 0, defS, // secondary
- sep, sep, defT, defT, defT, defT, // tertiary
- sep, 0xFF, 0xFF, 0xFF, 0xFF, // quaternary
- },
- },
- { // same as first, but with zero element that need to be removed
- opts{alt: altShifted},
- ColElems{W(0x200), zero, W(0x7FFF), W(0, 0x30), zero, W(0x100)},
- []byte{0x2, 0, 0x7F, 0xFF, 0x1, 0x00, // primary
- sep, sep, 0, defS, 0, defS, 0, 0x30, 0, defS, // secondary
- sep, sep, defT, defT, defT, defT, // tertiary
- sep, 0xFF, 0xFF, 0xFF, 0xFF, // quaternary
- },
- },
- { // same as first, with large primary values
- opts{alt: altShifted},
- ColElems{W(0x200), W(0x8000), W(0, 0x30), W(0x12345)},
- []byte{0x2, 0, 0x80, 0x80, 0x00, 0x81, 0x23, 0x45, // primary
- sep, sep, 0, defS, 0, defS, 0, 0x30, 0, defS, // secondary
- sep, sep, defT, defT, defT, defT, // tertiary
- sep, 0xFF, 0xFF, 0xFF, 0xFF, // quaternary
- },
- },
- { // same as first, but with the secondary level backwards
- opts{alt: altShifted, backwards: true},
- ColElems{W(0x200), W(0x7FFF), W(0, 0x30), W(0x100)},
- []byte{0x2, 0, 0x7F, 0xFF, 0x1, 0x00, // primary
- sep, sep, 0, defS, 0, 0x30, 0, defS, 0, defS, // secondary
- sep, sep, defT, defT, defT, defT, // tertiary
- sep, 0xFF, 0xFF, 0xFF, 0xFF, // quaternary
- },
- },
- { // same as first, ignoring quaternary level
- opts{alt: altShifted, lev: 3},
- ColElems{W(0x200), zero, W(0x7FFF), W(0, 0x30), zero, W(0x100)},
- []byte{0x2, 0, 0x7F, 0xFF, 0x1, 0x00, // primary
- sep, sep, 0, defS, 0, defS, 0, 0x30, 0, defS, // secondary
- sep, sep, defT, defT, defT, defT, // tertiary
- },
- },
- { // same as first, ignoring tertiary level
- opts{alt: altShifted, lev: 2},
- ColElems{W(0x200), zero, W(0x7FFF), W(0, 0x30), zero, W(0x100)},
- []byte{0x2, 0, 0x7F, 0xFF, 0x1, 0x00, // primary
- sep, sep, 0, defS, 0, defS, 0, 0x30, 0, defS, // secondary
- },
- },
- { // same as first, ignoring secondary level
- opts{alt: altShifted, lev: 1},
- ColElems{W(0x200), zero, W(0x7FFF), W(0, 0x30), zero, W(0x100)},
- []byte{0x2, 0, 0x7F, 0xFF, 0x1, 0x00},
- },
- { // simple primary and secondary weights.
- opts{alt: altShiftTrimmed, top: 0x250},
- ColElems{W(0x300), W(0x200), W(0x7FFF), W(0, 0x30), W(0x800)},
- []byte{0x3, 0, 0x7F, 0xFF, 0x8, 0x00, // primary
- sep, sep, 0, defS, 0, defS, 0, 0x30, 0, defS, // secondary
- sep, sep, defT, defT, defT, defT, // tertiary
- sep, 0xFF, 0x2, 0, // quaternary
- },
- },
- { // as first, primary with case level enabled
- opts{alt: altShifted, lev: 1, caseLevel: true},
- ColElems{W(0x200), W(0x7FFF), W(0, 0x30), W(0x100)},
- []byte{0x2, 0, 0x7F, 0xFF, 0x1, 0x00, // primary
- sep, sep, // secondary
- sep, sep, defT, defT, defT, defT, // tertiary
- },
- },
-}
-
-func TestKeyFromElems(t *testing.T) {
- buf := Buffer{}
- for i, tt := range keyFromElemTests {
- buf.Reset()
- in := convertFromWeights(tt.in)
- processWeights(tt.opt.alt, uint32(tt.opt.top), in)
- tt.opt.collator().keyFromElems(&buf, in)
- res := buf.key
- if len(res) != len(tt.out) {
- t.Errorf("%d: len(ws) was %d; want %d (%X should be %X)", i, len(res), len(tt.out), res, tt.out)
- }
- n := len(res)
- if len(tt.out) < n {
- n = len(tt.out)
- }
- for j, c := range res[:n] {
- if c != tt.out[j] {
- t.Errorf("%d: byte %d was %X; want %X", i, j, c, tt.out[j])
- }
- }
- }
-}
-
-func TestGetColElems(t *testing.T) {
- for i, tt := range appendNextTests {
- c, err := makeTable(tt.in)
- if err != nil {
- // error is reported in TestAppendNext
- continue
- }
- // Create one large test per table
- str := make([]byte, 0, 4000)
- out := ColElems{}
- for len(str) < 3000 {
- for _, chk := range tt.chk {
- str = append(str, chk.in[:chk.n]...)
- out = append(out, chk.out...)
- }
- }
- for j, chk := range append(tt.chk, check{string(str), len(str), out}) {
- out := convertFromWeights(chk.out)
- ce := c.getColElems([]byte(chk.in)[:chk.n])
- if len(ce) != len(out) {
- t.Errorf("%d:%d: len(ws) was %d; want %d", i, j, len(ce), len(out))
- continue
- }
- cnt := 0
- for k, w := range ce {
- w, _ = colltab.MakeElem(w.Primary(), w.Secondary(), int(w.Tertiary()), 0)
- if w != out[k] {
- t.Errorf("%d:%d: Weights %d was %X; want %X", i, j, k, w, out[k])
- cnt++
- }
- if cnt > 10 {
- break
- }
- }
- }
- }
-}
-
-type keyTest struct {
- in string
- out []byte
-}
-
-var keyTests = []keyTest{
- {"abc",
- []byte{0, 100, 0, 200, 1, 44, 0, 0, 0, 32, 0, 32, 0, 32, 0, 0, 2, 2, 2, 0, 255, 255, 255},
- },
- {"a\u0301",
- []byte{0, 102, 0, 0, 0, 32, 0, 0, 2, 0, 255},
- },
- {"aaaaa",
- []byte{0, 100, 0, 100, 0, 100, 0, 100, 0, 100, 0, 0,
- 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 0,
- 2, 2, 2, 2, 2, 0,
- 255, 255, 255, 255, 255,
- },
- },
- // Issue 16391: incomplete rune at end of UTF-8 sequence.
- {"\xc2", []byte{133, 255, 253, 0, 0, 0, 32, 0, 0, 2, 0, 255}},
- {"\xc2a", []byte{133, 255, 253, 0, 100, 0, 0, 0, 32, 0, 32, 0, 0, 2, 2, 0, 255, 255}},
-}
-
-func TestKey(t *testing.T) {
- c, _ := makeTable(appendNextTests[4].in)
- c.alternate = altShifted
- c.ignore = ignore(colltab.Quaternary)
- buf := Buffer{}
- keys1 := [][]byte{}
- keys2 := [][]byte{}
- for _, tt := range keyTests {
- keys1 = append(keys1, c.Key(&buf, []byte(tt.in)))
- keys2 = append(keys2, c.KeyFromString(&buf, tt.in))
- }
- // Separate generation from testing to ensure buffers are not overwritten.
- for i, tt := range keyTests {
- if !bytes.Equal(keys1[i], tt.out) {
- t.Errorf("%d: Key(%q) = %d; want %d", i, tt.in, keys1[i], tt.out)
- }
- if !bytes.Equal(keys2[i], tt.out) {
- t.Errorf("%d: KeyFromString(%q) = %d; want %d", i, tt.in, keys2[i], tt.out)
- }
- }
-}
-
-type compareTest struct {
- a, b string
- res int // comparison result
-}
-
-var compareTests = []compareTest{
- {"a\u0301", "a", 1},
- {"a\u0301b", "ab", 1},
- {"a", "a\u0301", -1},
- {"ab", "a\u0301b", -1},
- {"bc", "a\u0301c", 1},
- {"ab", "aB", -1},
- {"a\u0301", "a\u0301", 0},
- {"a", "a", 0},
- // Only clip prefixes of whole runes.
- {"\u302E", "\u302F", 1},
- // Don't clip prefixes when last rune of prefix may be part of contraction.
- {"a\u035E", "a\u0301\u035F", -1},
- {"a\u0301\u035Fb", "a\u0301\u035F", -1},
-}
-
-func TestCompare(t *testing.T) {
- c, _ := makeTable(appendNextTests[4].in)
- for i, tt := range compareTests {
- if res := c.Compare([]byte(tt.a), []byte(tt.b)); res != tt.res {
- t.Errorf("%d: Compare(%q, %q) == %d; want %d", i, tt.a, tt.b, res, tt.res)
- }
- if res := c.CompareString(tt.a, tt.b); res != tt.res {
- t.Errorf("%d: CompareString(%q, %q) == %d; want %d", i, tt.a, tt.b, res, tt.res)
- }
- }
-}
-
-func TestNumeric(t *testing.T) {
- c := New(language.English, Loose, Numeric)
-
- for i, tt := range []struct {
- a, b string
- want int
- }{
- {"1", "2", -1},
- {"2", "12", -1},
- {"2", "12", -1}, // Fullwidth is sorted as usual.
- {"₂", "₁₂", 1}, // Subscript is not sorted as numbers.
- {"②", "①②", 1}, // Circled is not sorted as numbers.
- { // Imperial Aramaic, is not sorted as number.
- "\U00010859",
- "\U00010858\U00010859",
- 1,
- },
- {"12", "2", 1},
- {"A-1", "A-2", -1},
- {"A-2", "A-12", -1},
- {"A-12", "A-2", 1},
- {"A-0001", "A-1", 0},
- } {
- if got := c.CompareString(tt.a, tt.b); got != tt.want {
- t.Errorf("%d: CompareString(%s, %s) = %d; want %d", i, tt.a, tt.b, got, tt.want)
- }
- }
-}
diff --git a/vendor/golang.org/x/text/collate/export_test.go b/vendor/golang.org/x/text/collate/export_test.go
deleted file mode 100644
index 69bfeaf1a..000000000
--- a/vendor/golang.org/x/text/collate/export_test.go
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package collate
-
-// Export for testing.
-// TODO: no longer necessary. Remove at some point.
-
-import (
- "fmt"
-
- "golang.org/x/text/internal/colltab"
-)
-
-const (
- defaultSecondary = 0x20
- defaultTertiary = 0x2
-)
-
-type Weights struct {
- Primary, Secondary, Tertiary, Quaternary int
-}
-
-func W(ce ...int) Weights {
- w := Weights{ce[0], defaultSecondary, defaultTertiary, 0}
- if len(ce) > 1 {
- w.Secondary = ce[1]
- }
- if len(ce) > 2 {
- w.Tertiary = ce[2]
- }
- if len(ce) > 3 {
- w.Quaternary = ce[3]
- }
- return w
-}
-func (w Weights) String() string {
- return fmt.Sprintf("[%X.%X.%X.%X]", w.Primary, w.Secondary, w.Tertiary, w.Quaternary)
-}
-
-func convertFromWeights(ws []Weights) []colltab.Elem {
- out := make([]colltab.Elem, len(ws))
- for i, w := range ws {
- out[i], _ = colltab.MakeElem(w.Primary, w.Secondary, w.Tertiary, 0)
- if out[i] == colltab.Ignore && w.Quaternary > 0 {
- out[i] = colltab.MakeQuaternary(w.Quaternary)
- }
- }
- return out
-}
diff --git a/vendor/golang.org/x/text/collate/option_test.go b/vendor/golang.org/x/text/collate/option_test.go
deleted file mode 100644
index 0f6ba9bc8..000000000
--- a/vendor/golang.org/x/text/collate/option_test.go
+++ /dev/null
@@ -1,209 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-package collate
-
-import (
- "reflect"
- "strings"
- "testing"
-
- "golang.org/x/text/internal/colltab"
- "golang.org/x/text/language"
-)
-
-var (
- defaultIgnore = ignore(colltab.Tertiary)
- defaultTable = getTable(locales[0])
-)
-
-func TestOptions(t *testing.T) {
- for i, tt := range []struct {
- in []Option
- out options
- }{
- 0: {
- out: options{
- ignore: defaultIgnore,
- },
- },
- 1: {
- in: []Option{IgnoreDiacritics},
- out: options{
- ignore: [colltab.NumLevels]bool{false, true, false, true, true},
- },
- },
- 2: {
- in: []Option{IgnoreCase, IgnoreDiacritics},
- out: options{
- ignore: ignore(colltab.Primary),
- },
- },
- 3: {
- in: []Option{ignoreDiacritics, IgnoreWidth},
- out: options{
- ignore: ignore(colltab.Primary),
- caseLevel: true,
- },
- },
- 4: {
- in: []Option{IgnoreWidth, ignoreDiacritics},
- out: options{
- ignore: ignore(colltab.Primary),
- caseLevel: true,
- },
- },
- 5: {
- in: []Option{IgnoreCase, IgnoreWidth},
- out: options{
- ignore: ignore(colltab.Secondary),
- },
- },
- 6: {
- in: []Option{IgnoreCase, IgnoreWidth, Loose},
- out: options{
- ignore: ignore(colltab.Primary),
- },
- },
- 7: {
- in: []Option{Force, IgnoreCase, IgnoreWidth, Loose},
- out: options{
- ignore: [colltab.NumLevels]bool{false, true, true, true, false},
- },
- },
- 8: {
- in: []Option{IgnoreDiacritics, IgnoreCase},
- out: options{
- ignore: ignore(colltab.Primary),
- },
- },
- 9: {
- in: []Option{Numeric},
- out: options{
- ignore: defaultIgnore,
- numeric: true,
- },
- },
- 10: {
- in: []Option{OptionsFromTag(language.MustParse("und-u-ks-level1"))},
- out: options{
- ignore: ignore(colltab.Primary),
- },
- },
- 11: {
- in: []Option{OptionsFromTag(language.MustParse("und-u-ks-level4"))},
- out: options{
- ignore: ignore(colltab.Quaternary),
- },
- },
- 12: {
- in: []Option{OptionsFromTag(language.MustParse("und-u-ks-identic"))},
- out: options{},
- },
- 13: {
- in: []Option{
- OptionsFromTag(language.MustParse("und-u-kn-true-kb-true-kc-true")),
- },
- out: options{
- ignore: defaultIgnore,
- caseLevel: true,
- backwards: true,
- numeric: true,
- },
- },
- 14: {
- in: []Option{
- OptionsFromTag(language.MustParse("und-u-kn-true-kb-true-kc-true")),
- OptionsFromTag(language.MustParse("und-u-kn-false-kb-false-kc-false")),
- },
- out: options{
- ignore: defaultIgnore,
- },
- },
- 15: {
- in: []Option{
- OptionsFromTag(language.MustParse("und-u-kn-true-kb-true-kc-true")),
- OptionsFromTag(language.MustParse("und-u-kn-foo-kb-foo-kc-foo")),
- },
- out: options{
- ignore: defaultIgnore,
- caseLevel: true,
- backwards: true,
- numeric: true,
- },
- },
- 16: { // Normal options take precedence over tag options.
- in: []Option{
- Numeric, IgnoreCase,
- OptionsFromTag(language.MustParse("und-u-kn-false-kc-true")),
- },
- out: options{
- ignore: ignore(colltab.Secondary),
- caseLevel: false,
- numeric: true,
- },
- },
- 17: {
- in: []Option{
- OptionsFromTag(language.MustParse("und-u-ka-shifted")),
- },
- out: options{
- ignore: defaultIgnore,
- alternate: altShifted,
- },
- },
- 18: {
- in: []Option{
- OptionsFromTag(language.MustParse("und-u-ka-blanked")),
- },
- out: options{
- ignore: defaultIgnore,
- alternate: altBlanked,
- },
- },
- 19: {
- in: []Option{
- OptionsFromTag(language.MustParse("und-u-ka-posix")),
- },
- out: options{
- ignore: defaultIgnore,
- alternate: altShiftTrimmed,
- },
- },
- } {
- c := newCollator(defaultTable)
- c.t = nil
- c.variableTop = 0
- c.f = 0
-
- c.setOptions(tt.in)
- if !reflect.DeepEqual(c.options, tt.out) {
- t.Errorf("%d: got %v; want %v", i, c.options, tt.out)
- }
- }
-}
-
-func TestAlternateSortTypes(t *testing.T) {
- testCases := []struct {
- lang string
- in []string
- want []string
- }{{
- lang: "zh,cmn,zh-Hant-u-co-pinyin,zh-HK-u-co-pinyin,zh-pinyin",
- in: []string{"爸爸", "妈妈", "儿子", "女儿"},
- want: []string{"爸爸", "儿子", "妈妈", "女儿"},
- }, {
- lang: "zh-Hant,zh-u-co-stroke,zh-Hant-u-co-stroke",
- in: []string{"爸爸", "妈妈", "儿子", "女儿"},
- want: []string{"儿子", "女儿", "妈妈", "爸爸"},
- }}
- for _, tc := range testCases {
- for _, tag := range strings.Split(tc.lang, ",") {
- got := append([]string{}, tc.in...)
- New(language.MustParse(tag)).SortStrings(got)
- if !reflect.DeepEqual(got, tc.want) {
- t.Errorf("New(%s).SortStrings(%v) = %v; want %v", tag, tc.in, got, tc.want)
- }
- }
- }
-}
diff --git a/vendor/golang.org/x/text/collate/reg_test.go b/vendor/golang.org/x/text/collate/reg_test.go
deleted file mode 100644
index 1ac5fedc8..000000000
--- a/vendor/golang.org/x/text/collate/reg_test.go
+++ /dev/null
@@ -1,230 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package collate
-
-import (
- "archive/zip"
- "bufio"
- "bytes"
- "flag"
- "io"
- "io/ioutil"
- "log"
- "path"
- "regexp"
- "strconv"
- "strings"
- "testing"
- "unicode/utf8"
-
- "golang.org/x/text/collate/build"
- "golang.org/x/text/internal/gen"
- "golang.org/x/text/language"
-)
-
-var long = flag.Bool("long", false,
- "run time-consuming tests, such as tests that fetch data online")
-
-// This regression test runs tests for the test files in CollationTest.zip
-// (taken from http://www.unicode.org/Public/UCA/<gen.UnicodeVersion()>/).
-//
-// The test files have the following form:
-// # header
-// 0009 0021; # ('\u0009') <CHARACTER TABULATION> [| | | 0201 025E]
-// 0009 003F; # ('\u0009') <CHARACTER TABULATION> [| | | 0201 0263]
-// 000A 0021; # ('\u000A') <LINE FEED (LF)> [| | | 0202 025E]
-// 000A 003F; # ('\u000A') <LINE FEED (LF)> [| | | 0202 0263]
-//
-// The part before the semicolon is the hex representation of a sequence
-// of runes. After the hash mark is a comment. The strings
-// represented by rune sequence are in the file in sorted order, as
-// defined by the DUCET.
-
-type Test struct {
- name string
- str [][]byte
- comment []string
-}
-
-var versionRe = regexp.MustCompile(`# UCA Version: (.*)\n?$`)
-var testRe = regexp.MustCompile(`^([\dA-F ]+);.*# (.*)\n?$`)
-
-func TestCollation(t *testing.T) {
- if !gen.IsLocal() && !*long {
- t.Skip("skipping test to prevent downloading; to run use -long or use -local to specify a local source")
- }
- t.Skip("must first update to new file format to support test")
- for _, test := range loadTestData() {
- doTest(t, test)
- }
-}
-
-func Error(e error) {
- if e != nil {
- log.Fatal(e)
- }
-}
-
-// parseUCA parses a Default Unicode Collation Element Table of the format
-// specified in http://www.unicode.org/reports/tr10/#File_Format.
-// It returns the variable top.
-func parseUCA(builder *build.Builder) {
- r := gen.OpenUnicodeFile("UCA", "", "allkeys.txt")
- defer r.Close()
- input := bufio.NewReader(r)
- colelem := regexp.MustCompile(`\[([.*])([0-9A-F.]+)\]`)
- for i := 1; true; i++ {
- l, prefix, err := input.ReadLine()
- if err == io.EOF {
- break
- }
- Error(err)
- line := string(l)
- if prefix {
- log.Fatalf("%d: buffer overflow", i)
- }
- if len(line) == 0 || line[0] == '#' {
- continue
- }
- if line[0] == '@' {
- if strings.HasPrefix(line[1:], "version ") {
- if v := strings.Split(line[1:], " ")[1]; v != gen.UnicodeVersion() {
- log.Fatalf("incompatible version %s; want %s", v, gen.UnicodeVersion())
- }
- }
- } else {
- // parse entries
- part := strings.Split(line, " ; ")
- if len(part) != 2 {
- log.Fatalf("%d: production rule without ';': %v", i, line)
- }
- lhs := []rune{}
- for _, v := range strings.Split(part[0], " ") {
- if v != "" {
- lhs = append(lhs, rune(convHex(i, v)))
- }
- }
- vars := []int{}
- rhs := [][]int{}
- for i, m := range colelem.FindAllStringSubmatch(part[1], -1) {
- if m[1] == "*" {
- vars = append(vars, i)
- }
- elem := []int{}
- for _, h := range strings.Split(m[2], ".") {
- elem = append(elem, convHex(i, h))
- }
- rhs = append(rhs, elem)
- }
- builder.Add(lhs, rhs, vars)
- }
- }
-}
-
-func convHex(line int, s string) int {
- r, e := strconv.ParseInt(s, 16, 32)
- if e != nil {
- log.Fatalf("%d: %v", line, e)
- }
- return int(r)
-}
-
-func loadTestData() []Test {
- f := gen.OpenUnicodeFile("UCA", "", "CollationTest.zip")
- buffer, err := ioutil.ReadAll(f)
- f.Close()
- Error(err)
- archive, err := zip.NewReader(bytes.NewReader(buffer), int64(len(buffer)))
- Error(err)
- tests := []Test{}
- for _, f := range archive.File {
- // Skip the short versions, which are simply duplicates of the long versions.
- if strings.Contains(f.Name, "SHORT") || f.FileInfo().IsDir() {
- continue
- }
- ff, err := f.Open()
- Error(err)
- defer ff.Close()
- scanner := bufio.NewScanner(ff)
- test := Test{name: path.Base(f.Name)}
- for scanner.Scan() {
- line := scanner.Text()
- if len(line) <= 1 || line[0] == '#' {
- if m := versionRe.FindStringSubmatch(line); m != nil {
- if m[1] != gen.UnicodeVersion() {
- log.Printf("warning:%s: version is %s; want %s", f.Name, m[1], gen.UnicodeVersion())
- }
- }
- continue
- }
- m := testRe.FindStringSubmatch(line)
- if m == nil || len(m) < 3 {
- log.Fatalf(`Failed to parse: "%s" result: %#v`, line, m)
- }
- str := []byte{}
- // In the regression test data (unpaired) surrogates are assigned a weight
- // corresponding to their code point value. However, utf8.DecodeRune,
- // which is used to compute the implicit weight, assigns FFFD to surrogates.
- // We therefore skip tests with surrogates. This skips about 35 entries
- // per test.
- valid := true
- for _, split := range strings.Split(m[1], " ") {
- r, err := strconv.ParseUint(split, 16, 64)
- Error(err)
- valid = valid && utf8.ValidRune(rune(r))
- str = append(str, string(rune(r))...)
- }
- if valid {
- test.str = append(test.str, str)
- test.comment = append(test.comment, m[2])
- }
- }
- if scanner.Err() != nil {
- log.Fatal(scanner.Err())
- }
- tests = append(tests, test)
- }
- return tests
-}
-
-var errorCount int
-
-func runes(b []byte) []rune {
- return []rune(string(b))
-}
-
-var shifted = language.MustParse("und-u-ka-shifted-ks-level4")
-
-func doTest(t *testing.T, tc Test) {
- bld := build.NewBuilder()
- parseUCA(bld)
- w, err := bld.Build()
- Error(err)
- var tag language.Tag
- if !strings.Contains(tc.name, "NON_IGNOR") {
- tag = shifted
- }
- c := NewFromTable(w, OptionsFromTag(tag))
- b := &Buffer{}
- prev := tc.str[0]
- for i := 1; i < len(tc.str); i++ {
- b.Reset()
- s := tc.str[i]
- ka := c.Key(b, prev)
- kb := c.Key(b, s)
- if r := bytes.Compare(ka, kb); r == 1 {
- t.Errorf("%s:%d: Key(%.4X) < Key(%.4X) (%X < %X) == %d; want -1 or 0", tc.name, i, []rune(string(prev)), []rune(string(s)), ka, kb, r)
- prev = s
- continue
- }
- if r := c.Compare(prev, s); r == 1 {
- t.Errorf("%s:%d: Compare(%.4X, %.4X) == %d; want -1 or 0", tc.name, i, runes(prev), runes(s), r)
- }
- if r := c.Compare(s, prev); r == -1 {
- t.Errorf("%s:%d: Compare(%.4X, %.4X) == %d; want 1 or 0", tc.name, i, runes(s), runes(prev), r)
- }
- prev = s
- }
-}
diff --git a/vendor/golang.org/x/text/collate/sort_test.go b/vendor/golang.org/x/text/collate/sort_test.go
deleted file mode 100644
index d9e7f31cc..000000000
--- a/vendor/golang.org/x/text/collate/sort_test.go
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package collate_test
-
-import (
- "fmt"
- "testing"
-
- "golang.org/x/text/collate"
- "golang.org/x/text/language"
-)
-
-func ExampleCollator_Strings() {
- c := collate.New(language.Und)
- strings := []string{
- "ad",
- "ab",
- "äb",
- "ac",
- }
- c.SortStrings(strings)
- fmt.Println(strings)
- // Output: [ab äb ac ad]
-}
-
-type sorter []string
-
-func (s sorter) Len() int {
- return len(s)
-}
-
-func (s sorter) Swap(i, j int) {
- s[j], s[i] = s[i], s[j]
-}
-
-func (s sorter) Bytes(i int) []byte {
- return []byte(s[i])
-}
-
-func TestSort(t *testing.T) {
- c := collate.New(language.English)
- strings := []string{
- "bcd",
- "abc",
- "ddd",
- }
- c.Sort(sorter(strings))
- res := fmt.Sprint(strings)
- want := "[abc bcd ddd]"
- if res != want {
- t.Errorf("found %s; want %s", res, want)
- }
-}
diff --git a/vendor/golang.org/x/text/collate/table_test.go b/vendor/golang.org/x/text/collate/table_test.go
deleted file mode 100644
index 3a6b12fd6..000000000
--- a/vendor/golang.org/x/text/collate/table_test.go
+++ /dev/null
@@ -1,291 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package collate
-
-import (
- "testing"
-
- "golang.org/x/text/collate/build"
- "golang.org/x/text/internal/colltab"
- "golang.org/x/text/unicode/norm"
-)
-
-type ColElems []Weights
-
-type input struct {
- str string
- ces [][]int
-}
-
-type check struct {
- in string
- n int
- out ColElems
-}
-
-type tableTest struct {
- in []input
- chk []check
-}
-
-func w(ce ...int) Weights {
- return W(ce...)
-}
-
-var defaults = w(0)
-
-func pt(p, t int) []int {
- return []int{p, defaults.Secondary, t}
-}
-
-func makeTable(in []input) (*Collator, error) {
- b := build.NewBuilder()
- for _, r := range in {
- if e := b.Add([]rune(r.str), r.ces, nil); e != nil {
- panic(e)
- }
- }
- t, err := b.Build()
- if err != nil {
- return nil, err
- }
- return NewFromTable(t), nil
-}
-
-// modSeq holds a seqeunce of modifiers in increasing order of CCC long enough
-// to cause a segment overflow if not handled correctly. The last rune in this
-// list has a CCC of 214.
-var modSeq = []rune{
- 0x05B1, 0x05B2, 0x05B3, 0x05B4, 0x05B5, 0x05B6, 0x05B7, 0x05B8, 0x05B9, 0x05BB,
- 0x05BC, 0x05BD, 0x05BF, 0x05C1, 0x05C2, 0xFB1E, 0x064B, 0x064C, 0x064D, 0x064E,
- 0x064F, 0x0650, 0x0651, 0x0652, 0x0670, 0x0711, 0x0C55, 0x0C56, 0x0E38, 0x0E48,
- 0x0EB8, 0x0EC8, 0x0F71, 0x0F72, 0x0F74, 0x0321, 0x1DCE,
-}
-
-var mods []input
-var modW = func() ColElems {
- ws := ColElems{}
- for _, r := range modSeq {
- rune := norm.NFC.PropertiesString(string(r))
- ws = append(ws, w(0, int(rune.CCC())))
- mods = append(mods, input{string(r), [][]int{{0, int(rune.CCC())}}})
- }
- return ws
-}()
-
-var appendNextTests = []tableTest{
- { // test getWeights
- []input{
- {"a", [][]int{{100}}},
- {"b", [][]int{{105}}},
- {"c", [][]int{{110}}},
- {"ß", [][]int{{120}}},
- },
- []check{
- {"a", 1, ColElems{w(100)}},
- {"b", 1, ColElems{w(105)}},
- {"c", 1, ColElems{w(110)}},
- {"d", 1, ColElems{w(0x50064)}},
- {"ab", 1, ColElems{w(100)}},
- {"bc", 1, ColElems{w(105)}},
- {"dd", 1, ColElems{w(0x50064)}},
- {"ß", 2, ColElems{w(120)}},
- },
- },
- { // test expansion
- []input{
- {"u", [][]int{{100}}},
- {"U", [][]int{{100}, {0, 25}}},
- {"w", [][]int{{100}, {100}}},
- {"W", [][]int{{100}, {0, 25}, {100}, {0, 25}}},
- },
- []check{
- {"u", 1, ColElems{w(100)}},
- {"U", 1, ColElems{w(100), w(0, 25)}},
- {"w", 1, ColElems{w(100), w(100)}},
- {"W", 1, ColElems{w(100), w(0, 25), w(100), w(0, 25)}},
- },
- },
- { // test decompose
- []input{
- {"D", [][]int{pt(104, 8)}},
- {"z", [][]int{pt(130, 8)}},
- {"\u030C", [][]int{{0, 40}}}, // Caron
- {"\u01C5", [][]int{pt(104, 9), pt(130, 4), {0, 40, 0x1F}}}, // Dž = D+z+caron
- },
- []check{
- {"\u01C5", 2, ColElems{w(pt(104, 9)...), w(pt(130, 4)...), w(0, 40, 0x1F)}},
- },
- },
- { // test basic contraction
- []input{
- {"a", [][]int{{100}}},
- {"ab", [][]int{{101}}},
- {"aab", [][]int{{101}, {101}}},
- {"abc", [][]int{{102}}},
- {"b", [][]int{{200}}},
- {"c", [][]int{{300}}},
- {"d", [][]int{{400}}},
- },
- []check{
- {"a", 1, ColElems{w(100)}},
- {"aa", 1, ColElems{w(100)}},
- {"aac", 1, ColElems{w(100)}},
- {"d", 1, ColElems{w(400)}},
- {"ab", 2, ColElems{w(101)}},
- {"abb", 2, ColElems{w(101)}},
- {"aab", 3, ColElems{w(101), w(101)}},
- {"aaba", 3, ColElems{w(101), w(101)}},
- {"abc", 3, ColElems{w(102)}},
- {"abcd", 3, ColElems{w(102)}},
- },
- },
- { // test discontinuous contraction
- append(mods, []input{
- // modifiers; secondary weight equals ccc
- {"\u0316", [][]int{{0, 220}}},
- {"\u0317", [][]int{{0, 220}, {0, 220}}},
- {"\u302D", [][]int{{0, 222}}},
- {"\u302E", [][]int{{0, 225}}}, // used as starter
- {"\u302F", [][]int{{0, 224}}}, // used as starter
- {"\u18A9", [][]int{{0, 228}}},
- {"\u0300", [][]int{{0, 230}}},
- {"\u0301", [][]int{{0, 230}}},
- {"\u0315", [][]int{{0, 232}}},
- {"\u031A", [][]int{{0, 232}}},
- {"\u035C", [][]int{{0, 233}}},
- {"\u035F", [][]int{{0, 233}}},
- {"\u035D", [][]int{{0, 234}}},
- {"\u035E", [][]int{{0, 234}}},
- {"\u0345", [][]int{{0, 240}}},
-
- // starters
- {"a", [][]int{{100}}},
- {"b", [][]int{{200}}},
- {"c", [][]int{{300}}},
- {"\u03B1", [][]int{{900}}},
- {"\x01", [][]int{{0, 0, 0, 0}}},
-
- // contractions
- {"a\u0300", [][]int{{101}}},
- {"a\u0301", [][]int{{102}}},
- {"a\u035E", [][]int{{110}}},
- {"a\u035Eb\u035E", [][]int{{115}}},
- {"ac\u035Eaca\u035E", [][]int{{116}}},
- {"a\u035Db\u035D", [][]int{{117}}},
- {"a\u0301\u035Db", [][]int{{120}}},
- {"a\u0301\u035F", [][]int{{121}}},
- {"a\u0301\u035Fb", [][]int{{119}}},
- {"\u03B1\u0345", [][]int{{901}, {902}}},
- {"\u302E\u302F", [][]int{{0, 131}, {0, 131}}},
- {"\u302F\u18A9", [][]int{{0, 130}}},
- }...),
- []check{
- {"a\x01\u0300", 1, ColElems{w(100)}},
- {"ab", 1, ColElems{w(100)}}, // closing segment
- {"a\u0316\u0300b", 5, ColElems{w(101), w(0, 220)}}, // closing segment
- {"a\u0316\u0300", 5, ColElems{w(101), w(0, 220)}}, // no closing segment
- {"a\u0316\u0300\u035Cb", 5, ColElems{w(101), w(0, 220)}}, // completes before segment end
- {"a\u0316\u0300\u035C", 5, ColElems{w(101), w(0, 220)}}, // completes before segment end
-
- {"a\u0316\u0301b", 5, ColElems{w(102), w(0, 220)}}, // closing segment
- {"a\u0316\u0301", 5, ColElems{w(102), w(0, 220)}}, // no closing segment
- {"a\u0316\u0301\u035Cb", 5, ColElems{w(102), w(0, 220)}}, // completes before segment end
- {"a\u0316\u0301\u035C", 5, ColElems{w(102), w(0, 220)}}, // completes before segment end
-
- // match blocked by modifier with same ccc
- {"a\u0301\u0315\u031A\u035Fb", 3, ColElems{w(102)}},
-
- // multiple gaps
- {"a\u0301\u035Db", 6, ColElems{w(120)}},
- {"a\u0301\u035F", 5, ColElems{w(121)}},
- {"a\u0301\u035Fb", 6, ColElems{w(119)}},
- {"a\u0316\u0301\u035F", 7, ColElems{w(121), w(0, 220)}},
- {"a\u0301\u0315\u035Fb", 7, ColElems{w(121), w(0, 232)}},
- {"a\u0316\u0301\u0315\u035Db", 5, ColElems{w(102), w(0, 220)}},
- {"a\u0316\u0301\u0315\u035F", 9, ColElems{w(121), w(0, 220), w(0, 232)}},
- {"a\u0316\u0301\u0315\u035Fb", 9, ColElems{w(121), w(0, 220), w(0, 232)}},
- {"a\u0316\u0301\u0315\u035F\u035D", 9, ColElems{w(121), w(0, 220), w(0, 232)}},
- {"a\u0316\u0301\u0315\u035F\u035Db", 9, ColElems{w(121), w(0, 220), w(0, 232)}},
-
- // handling of segment overflow
- { // just fits within segment
- "a" + string(modSeq[:30]) + "\u0301",
- 3 + len(string(modSeq[:30])),
- append(ColElems{w(102)}, modW[:30]...),
- },
- {"a" + string(modSeq[:31]) + "\u0301", 1, ColElems{w(100)}}, // overflow
- {"a" + string(modSeq) + "\u0301", 1, ColElems{w(100)}},
- { // just fits within segment with two interstitial runes
- "a" + string(modSeq[:28]) + "\u0301\u0315\u035F",
- 7 + len(string(modSeq[:28])),
- append(append(ColElems{w(121)}, modW[:28]...), w(0, 232)),
- },
- { // second half does not fit within segment
- "a" + string(modSeq[:29]) + "\u0301\u0315\u035F",
- 3 + len(string(modSeq[:29])),
- append(ColElems{w(102)}, modW[:29]...),
- },
-
- // discontinuity can only occur in last normalization segment
- {"a\u035Eb\u035E", 6, ColElems{w(115)}},
- {"a\u0316\u035Eb\u035E", 5, ColElems{w(110), w(0, 220)}},
- {"a\u035Db\u035D", 6, ColElems{w(117)}},
- {"a\u0316\u035Db\u035D", 1, ColElems{w(100)}},
- {"a\u035Eb\u0316\u035E", 8, ColElems{w(115), w(0, 220)}},
- {"a\u035Db\u0316\u035D", 8, ColElems{w(117), w(0, 220)}},
- {"ac\u035Eaca\u035E", 9, ColElems{w(116)}},
- {"a\u0316c\u035Eaca\u035E", 1, ColElems{w(100)}},
- {"ac\u035Eac\u0316a\u035E", 1, ColElems{w(100)}},
-
- // expanding contraction
- {"\u03B1\u0345", 4, ColElems{w(901), w(902)}},
-
- // Theoretical possibilities
- // contraction within a gap
- {"a\u302F\u18A9\u0301", 9, ColElems{w(102), w(0, 130)}},
- // expansion within a gap
- {"a\u0317\u0301", 5, ColElems{w(102), w(0, 220), w(0, 220)}},
- // repeating CCC blocks last modifier
- {"a\u302E\u302F\u0301", 1, ColElems{w(100)}},
- // The trailing combining characters (with lower CCC) should block the first one.
- // TODO: make the following pass.
- // {"a\u035E\u0316\u0316", 1, ColElems{w(100)}},
- {"a\u035F\u035Eb", 5, ColElems{w(110), w(0, 233)}},
- // Last combiner should match after normalization.
- // TODO: make the following pass.
- // {"a\u035D\u0301", 3, ColElems{w(102), w(0, 234)}},
- // The first combiner is blocking the second one as they have the same CCC.
- {"a\u035D\u035Eb", 1, ColElems{w(100)}},
- },
- },
-}
-
-func TestAppendNext(t *testing.T) {
- for i, tt := range appendNextTests {
- c, err := makeTable(tt.in)
- if err != nil {
- t.Errorf("%d: error creating table: %v", i, err)
- continue
- }
- for j, chk := range tt.chk {
- ws, n := c.t.AppendNext(nil, []byte(chk.in))
- if n != chk.n {
- t.Errorf("%d:%d: bytes consumed was %d; want %d", i, j, n, chk.n)
- }
- out := convertFromWeights(chk.out)
- if len(ws) != len(out) {
- t.Errorf("%d:%d: len(ws) was %d; want %d (%X vs %X)\n%X", i, j, len(ws), len(out), ws, out, chk.in)
- continue
- }
- for k, w := range ws {
- w, _ = colltab.MakeElem(w.Primary(), w.Secondary(), int(w.Tertiary()), 0)
- if w != out[k] {
- t.Errorf("%d:%d: Weights %d was %X; want %X", i, j, k, w, out[k])
- }
- }
- }
- }
-}
diff --git a/vendor/golang.org/x/text/internal/colltab/collate_test.go b/vendor/golang.org/x/text/internal/colltab/collate_test.go
deleted file mode 100644
index 580c85c22..000000000
--- a/vendor/golang.org/x/text/internal/colltab/collate_test.go
+++ /dev/null
@@ -1,121 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package colltab_test
-
-// This file contains tests which need to import package collate, which causes
-// an import cycle when done within package colltab itself.
-
-import (
- "bytes"
- "testing"
- "unicode"
-
- "golang.org/x/text/collate"
- "golang.org/x/text/language"
- "golang.org/x/text/unicode/rangetable"
-)
-
-// assigned is used to only test runes that are inside the scope of the Unicode
-// version used to generation the collation table.
-var assigned = rangetable.Assigned(collate.UnicodeVersion)
-
-func TestNonDigits(t *testing.T) {
- c := collate.New(language.English, collate.Loose, collate.Numeric)
-
- // Verify that all non-digit numbers sort outside of the number range.
- for r, hi := rune(unicode.N.R16[0].Lo), rune(unicode.N.R32[0].Hi); r <= hi; r++ {
- if unicode.In(r, unicode.Nd) || !unicode.In(r, assigned) {
- continue
- }
- if a := string(r); c.CompareString(a, "0") != -1 && c.CompareString(a, "999999") != 1 {
- t.Errorf("%+q non-digit number is collated as digit", a)
- }
- }
-}
-
-func TestNumericCompare(t *testing.T) {
- c := collate.New(language.English, collate.Loose, collate.Numeric)
-
- // Iterate over all digits.
- for _, r16 := range unicode.Nd.R16 {
- testDigitCompare(t, c, rune(r16.Lo), rune(r16.Hi))
- }
- for _, r32 := range unicode.Nd.R32 {
- testDigitCompare(t, c, rune(r32.Lo), rune(r32.Hi))
- }
-}
-
-func testDigitCompare(t *testing.T, c *collate.Collator, zero, nine rune) {
- if !unicode.In(zero, assigned) {
- return
- }
- n := int(nine - zero + 1)
- if n%10 != 0 {
- t.Fatalf("len([%+q, %+q]) = %d; want a multiple of 10", zero, nine, n)
- }
- for _, tt := range []struct {
- prefix string
- b [11]string
- }{
- {
- prefix: "",
- b: [11]string{
- "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
- },
- },
- {
- prefix: "1",
- b: [11]string{
- "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20",
- },
- },
- {
- prefix: "0",
- b: [11]string{
- "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10",
- },
- },
- {
- prefix: "00",
- b: [11]string{
- "000", "001", "002", "003", "004", "005", "006", "007", "008", "009", "010",
- },
- },
- {
- prefix: "9",
- b: [11]string{
- "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "100",
- },
- },
- } {
- for k := 0; k <= n; k++ {
- i := k % 10
- a := tt.prefix + string(zero+rune(i))
- for j, b := range tt.b {
- want := 0
- switch {
- case i < j:
- want = -1
- case i > j:
- want = 1
- }
- got := c.CompareString(a, b)
- if got != want {
- t.Errorf("Compare(%+q, %+q) = %d; want %d", a, b, got, want)
- return
- }
- }
- }
- }
-}
-
-func BenchmarkNumericWeighter(b *testing.B) {
- c := collate.New(language.English, collate.Numeric)
- input := bytes.Repeat([]byte("Testing, testing 123..."), 100)
- b.SetBytes(int64(2 * len(input)))
- for i := 0; i < b.N; i++ {
- c.Compare(input, input)
- }
-}
diff --git a/vendor/golang.org/x/text/internal/colltab/collelem_test.go b/vendor/golang.org/x/text/internal/colltab/collelem_test.go
deleted file mode 100644
index f131ecc32..000000000
--- a/vendor/golang.org/x/text/internal/colltab/collelem_test.go
+++ /dev/null
@@ -1,183 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package colltab
-
-import (
- "fmt"
- "testing"
- "unicode"
-)
-
-func (e Elem) String() string {
- q := ""
- if v := e.Quaternary(); v == MaxQuaternary {
- q = "max"
- } else {
- q = fmt.Sprint(v)
- }
- return fmt.Sprintf("[%d, %d, %d, %s]",
- e.Primary(),
- e.Secondary(),
- e.Tertiary(),
- q)
-}
-
-type ceTest struct {
- f func(inout []int) (Elem, ceType)
- arg []int
-}
-
-func makeCE(weights []int) Elem {
- ce, _ := MakeElem(weights[0], weights[1], weights[2], uint8(weights[3]))
- return ce
-}
-
-var defaultValues = []int{0, defaultSecondary, defaultTertiary, 0}
-
-func e(w ...int) Elem {
- return makeCE(append(w, defaultValues[len(w):]...))
-}
-
-func makeContractIndex(index, n, offset int) Elem {
- const (
- contractID = 0xC0000000
- maxNBits = 4
- maxTrieIndexBits = 12
- maxContractOffsetBits = 13
- )
- ce := Elem(contractID)
- ce += Elem(offset << (maxNBits + maxTrieIndexBits))
- ce += Elem(index << maxNBits)
- ce += Elem(n)
- return ce
-}
-
-func makeExpandIndex(index int) Elem {
- const expandID = 0xE0000000
- return expandID + Elem(index)
-}
-
-func makeDecompose(t1, t2 int) Elem {
- const decompID = 0xF0000000
- return Elem(t2<<8+t1) + decompID
-}
-
-func normalCE(inout []int) (ce Elem, t ceType) {
- ce = makeCE(inout)
- inout[0] = ce.Primary()
- inout[1] = ce.Secondary()
- inout[2] = int(ce.Tertiary())
- inout[3] = int(ce.CCC())
- return ce, ceNormal
-}
-
-func expandCE(inout []int) (ce Elem, t ceType) {
- ce = makeExpandIndex(inout[0])
- inout[0] = splitExpandIndex(ce)
- return ce, ceExpansionIndex
-}
-
-func contractCE(inout []int) (ce Elem, t ceType) {
- ce = makeContractIndex(inout[0], inout[1], inout[2])
- i, n, o := splitContractIndex(ce)
- inout[0], inout[1], inout[2] = i, n, o
- return ce, ceContractionIndex
-}
-
-func decompCE(inout []int) (ce Elem, t ceType) {
- ce = makeDecompose(inout[0], inout[1])
- t1, t2 := splitDecompose(ce)
- inout[0], inout[1] = int(t1), int(t2)
- return ce, ceDecompose
-}
-
-var ceTests = []ceTest{
- {normalCE, []int{0, 0, 0, 0}},
- {normalCE, []int{0, 30, 3, 0}},
- {normalCE, []int{0, 30, 3, 0xFF}},
- {normalCE, []int{100, defaultSecondary, defaultTertiary, 0}},
- {normalCE, []int{100, defaultSecondary, defaultTertiary, 0xFF}},
- {normalCE, []int{100, defaultSecondary, 3, 0}},
- {normalCE, []int{0x123, defaultSecondary, 8, 0xFF}},
-
- {contractCE, []int{0, 0, 0}},
- {contractCE, []int{1, 1, 1}},
- {contractCE, []int{1, (1 << maxNBits) - 1, 1}},
- {contractCE, []int{(1 << maxTrieIndexBits) - 1, 1, 1}},
- {contractCE, []int{1, 1, (1 << maxContractOffsetBits) - 1}},
-
- {expandCE, []int{0}},
- {expandCE, []int{5}},
- {expandCE, []int{(1 << maxExpandIndexBits) - 1}},
-
- {decompCE, []int{0, 0}},
- {decompCE, []int{1, 1}},
- {decompCE, []int{0x1F, 0x1F}},
-}
-
-func TestColElem(t *testing.T) {
- for i, tt := range ceTests {
- inout := make([]int, len(tt.arg))
- copy(inout, tt.arg)
- ce, typ := tt.f(inout)
- if ce.ctype() != typ {
- t.Errorf("%d: type is %d; want %d (ColElem: %X)", i, ce.ctype(), typ, ce)
- }
- for j, a := range tt.arg {
- if inout[j] != a {
- t.Errorf("%d: argument %d is %X; want %X (ColElem: %X)", i, j, inout[j], a, ce)
- }
- }
- }
-}
-
-type implicitTest struct {
- r rune
- p int
-}
-
-var implicitTests = []implicitTest{
- {0x33FF, 0x533FF},
- {0x3400, 0x23400},
- {0x4DC0, 0x54DC0},
- {0x4DFF, 0x54DFF},
- {0x4E00, 0x14E00},
- {0x9FCB, 0x19FCB},
- {0xA000, 0x5A000},
- {0xF8FF, 0x5F8FF},
- {0xF900, 0x1F900},
- {0xFA23, 0x1FA23},
- {0xFAD9, 0x1FAD9},
- {0xFB00, 0x5FB00},
- {0x20000, 0x40000},
- {0x2B81C, 0x4B81C},
- {unicode.MaxRune, 0x15FFFF}, // maximum primary value
-}
-
-func TestImplicit(t *testing.T) {
- for _, tt := range implicitTests {
- if p := implicitPrimary(tt.r); p != tt.p {
- t.Errorf("%U: was %X; want %X", tt.r, p, tt.p)
- }
- }
-}
-
-func TestUpdateTertiary(t *testing.T) {
- tests := []struct {
- in, out Elem
- t uint8
- }{
- {0x4000FE20, 0x0000FE8A, 0x0A},
- {0x4000FE21, 0x0000FEAA, 0x0A},
- {0x0000FE8B, 0x0000FE83, 0x03},
- {0x82FF0188, 0x9BFF0188, 0x1B},
- {0xAFF0CC02, 0xAFF0CC1B, 0x1B},
- }
- for i, tt := range tests {
- if out := tt.in.updateTertiary(tt.t); out != tt.out {
- t.Errorf("%d: was %X; want %X", i, out, tt.out)
- }
- }
-}
diff --git a/vendor/golang.org/x/text/internal/colltab/colltab_test.go b/vendor/golang.org/x/text/internal/colltab/colltab_test.go
deleted file mode 100644
index c403ac346..000000000
--- a/vendor/golang.org/x/text/internal/colltab/colltab_test.go
+++ /dev/null
@@ -1,64 +0,0 @@
-package colltab
-
-import (
- "testing"
-
- "golang.org/x/text/language"
-)
-
-func TestMatchLang(t *testing.T) {
- tags := []language.Tag{
- 0: language.Und,
- 1: language.MustParse("bs"),
- 2: language.German,
- 3: language.English,
- 4: language.AmericanEnglish,
- 5: language.MustParse("en-US-u-va-posix"),
- 6: language.Portuguese,
- 7: language.Serbian,
- 8: language.MustParse("sr-Latn"),
- 9: language.Chinese,
- 10: language.MustParse("zh-u-co-stroke"),
- 11: language.MustParse("zh-Hant-u-co-pinyin"),
- 12: language.TraditionalChinese,
- }
- for i, tc := range []struct {
- x int
- t language.Tag
- }{
- {0, language.Und},
- {0, language.Persian}, // Default to first element when no match.
- {3, language.English},
- {4, language.AmericanEnglish},
- {5, language.MustParse("en-US-u-va-posix")}, // Ext. variant match.
- {4, language.MustParse("en-US-u-va-noposix")}, // Ext. variant mismatch.
- {3, language.MustParse("en-UK-u-va-noposix")}, // Ext. variant mismatch.
- {7, language.Serbian},
- {0, language.Croatian}, // Don't match to close language!
- {0, language.MustParse("gsw")}, // Don't match to close language!
- {1, language.MustParse("bs-Cyrl")}, // Odd, but correct.
- {1, language.MustParse("bs-Latn")}, // Estimated script drops.
- {8, language.MustParse("sr-Latn")},
- {9, language.Chinese},
- {9, language.SimplifiedChinese},
- {12, language.TraditionalChinese},
- {11, language.MustParse("zh-Hant-u-co-pinyin")},
- // TODO: should this be 12? Either inherited value (10) or default is
- // fine in this case, though. Other locales are not affected.
- {10, language.MustParse("zh-Hant-u-co-stroke")},
- // There is no "phonebk" sorting order for zh-Hant, so use default.
- {12, language.MustParse("zh-Hant-u-co-phonebk")},
- {10, language.MustParse("zh-u-co-stroke")},
- {12, language.MustParse("und-TW")}, // Infer script and language.
- {12, language.MustParse("und-HK")}, // Infer script and language.
- {6, language.MustParse("und-BR")}, // Infer script and language.
- {6, language.MustParse("und-PT")}, // Infer script and language.
- {2, language.MustParse("und-Latn-DE")}, // Infer language.
- {0, language.MustParse("und-Jpan-BR")}, // Infers "ja", so no match.
- {0, language.MustParse("zu")}, // No match past index.
- } {
- if x := MatchLang(tc.t, tags); x != tc.x {
- t.Errorf("%d: MatchLang(%q, tags) = %d; want %d", i, tc.t, x, tc.x)
- }
- }
-}
diff --git a/vendor/golang.org/x/text/internal/colltab/contract_test.go b/vendor/golang.org/x/text/internal/colltab/contract_test.go
deleted file mode 100644
index ce2871dd4..000000000
--- a/vendor/golang.org/x/text/internal/colltab/contract_test.go
+++ /dev/null
@@ -1,131 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package colltab
-
-import (
- "testing"
-)
-
-type lookupStrings struct {
- str string
- offset int
- n int // bytes consumed from input
-}
-
-type LookupTest struct {
- lookup []lookupStrings
- n int
- tries ContractTrieSet
-}
-
-var lookupTests = []LookupTest{{
- []lookupStrings{
- {"abc", 1, 3},
- {"a", 0, 0},
- {"b", 0, 0},
- {"c", 0, 0},
- {"d", 0, 0},
- },
- 1,
- ContractTrieSet{
- {'a', 0, 1, 0xFF},
- {'b', 0, 1, 0xFF},
- {'c', 'c', 0, 1},
- },
-}, {
- []lookupStrings{
- {"abc", 1, 3},
- {"abd", 2, 3},
- {"abe", 3, 3},
- {"a", 0, 0},
- {"ab", 0, 0},
- {"d", 0, 0},
- {"f", 0, 0},
- },
- 1,
- ContractTrieSet{
- {'a', 0, 1, 0xFF},
- {'b', 0, 1, 0xFF},
- {'c', 'e', 0, 1},
- },
-}, {
- []lookupStrings{
- {"abc", 1, 3},
- {"ab", 2, 2},
- {"a", 3, 1},
- {"abcd", 1, 3},
- {"abe", 2, 2},
- },
- 1,
- ContractTrieSet{
- {'a', 0, 1, 3},
- {'b', 0, 1, 2},
- {'c', 'c', 0, 1},
- },
-}, {
- []lookupStrings{
- {"abc", 1, 3},
- {"abd", 2, 3},
- {"ab", 3, 2},
- {"ac", 4, 2},
- {"a", 5, 1},
- {"b", 6, 1},
- {"ba", 6, 1},
- },
- 2,
- ContractTrieSet{
- {'b', 'b', 0, 6},
- {'a', 0, 2, 5},
- {'c', 'c', 0, 4},
- {'b', 0, 1, 3},
- {'c', 'd', 0, 1},
- },
-}, {
- []lookupStrings{
- {"bcde", 2, 4},
- {"bc", 7, 2},
- {"ab", 6, 2},
- {"bcd", 5, 3},
- {"abcd", 1, 4},
- {"abc", 4, 3},
- {"bcdf", 3, 4},
- },
- 2,
- ContractTrieSet{
- {'b', 3, 1, 0xFF},
- {'a', 0, 1, 0xFF},
- {'b', 0, 1, 6},
- {'c', 0, 1, 4},
- {'d', 'd', 0, 1},
- {'c', 0, 1, 7},
- {'d', 0, 1, 5},
- {'e', 'f', 0, 2},
- },
-}}
-
-func lookup(c *ContractTrieSet, nnode int, s []uint8) (i, n int) {
- scan := c.scanner(0, nnode, s)
- scan.scan(0)
- return scan.result()
-}
-
-func TestLookupContraction(t *testing.T) {
- for i, tt := range lookupTests {
- cts := ContractTrieSet(tt.tries)
- for j, lu := range tt.lookup {
- str := lu.str
- for _, s := range []string{str, str + "X"} {
- const msg = `%d:%d: %s of "%s" %v; want %v`
- offset, n := lookup(&cts, tt.n, []byte(s))
- if offset != lu.offset {
- t.Errorf(msg, i, j, "offset", s, offset, lu.offset)
- }
- if n != lu.n {
- t.Errorf(msg, i, j, "bytes consumed", s, n, len(str))
- }
- }
- }
- }
-}
diff --git a/vendor/golang.org/x/text/internal/colltab/iter_test.go b/vendor/golang.org/x/text/internal/colltab/iter_test.go
deleted file mode 100644
index 5783534c7..000000000
--- a/vendor/golang.org/x/text/internal/colltab/iter_test.go
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package colltab
-
-import (
- "testing"
-)
-
-func TestDoNorm(t *testing.T) {
- const div = -1 // The insertion point of the next block.
- tests := []struct {
- in, out []int
- }{{
- in: []int{4, div, 3},
- out: []int{3, 4},
- }, {
- in: []int{4, div, 3, 3, 3},
- out: []int{3, 3, 3, 4},
- }, {
- in: []int{0, 4, div, 3},
- out: []int{0, 3, 4},
- }, {
- in: []int{0, 0, 4, 5, div, 3, 3},
- out: []int{0, 0, 3, 3, 4, 5},
- }, {
- in: []int{0, 0, 1, 4, 5, div, 3, 3},
- out: []int{0, 0, 1, 3, 3, 4, 5},
- }, {
- in: []int{0, 0, 1, 4, 5, div, 4, 4},
- out: []int{0, 0, 1, 4, 4, 4, 5},
- },
- }
- for j, tt := range tests {
- i := Iter{}
- var w, p int
- for k, cc := range tt.in {
-
- if cc == div {
- w = 100
- p = k
- continue
- }
- i.Elems = append(i.Elems, makeCE([]int{w, defaultSecondary, 2, cc}))
- }
- i.doNorm(p, i.Elems[p].CCC())
- if len(i.Elems) != len(tt.out) {
- t.Errorf("%d: length was %d; want %d", j, len(i.Elems), len(tt.out))
- }
- prevCCC := uint8(0)
- for k, ce := range i.Elems {
- if int(ce.CCC()) != tt.out[k] {
- t.Errorf("%d:%d: unexpected CCC. Was %d; want %d", j, k, ce.CCC(), tt.out[k])
- }
- if k > 0 && ce.CCC() == prevCCC && i.Elems[k-1].Primary() > ce.Primary() {
- t.Errorf("%d:%d: normalization crossed across CCC boundary.", j, k)
- }
- }
- }
-
- // Combining rune overflow is tested in search/pattern_test.go.
-}
diff --git a/vendor/golang.org/x/text/internal/colltab/numeric_test.go b/vendor/golang.org/x/text/internal/colltab/numeric_test.go
deleted file mode 100644
index e9406ae3f..000000000
--- a/vendor/golang.org/x/text/internal/colltab/numeric_test.go
+++ /dev/null
@@ -1,159 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package colltab
-
-import (
- "reflect"
- "strings"
- "testing"
-
- "golang.org/x/text/internal/testtext"
-)
-
-const (
- digSec = defaultSecondary
- digTert = defaultTertiary
-)
-
-var tPlus3 = e(0, 50, digTert+3)
-
-// numWeighter is a testWeighter used for testing numericWeighter.
-var numWeighter = testWeighter{
- "0": p(100),
- "0": []Elem{e(100, digSec, digTert+1)}, // U+FF10 FULLWIDTH DIGIT ZERO
- "₀": []Elem{e(100, digSec, digTert+5)}, // U+2080 SUBSCRIPT ZERO
-
- "1": p(101),
- // Allow non-primary collation elements to be inserted.
- "١": append(p(101), tPlus3), // U+0661 ARABIC-INDIC DIGIT ONE
- // Allow varying tertiary weight if the number is Nd.
- "1": []Elem{e(101, digSec, digTert+1)}, // U+FF11 FULLWIDTH DIGIT ONE
- "2": p(102),
- // Allow non-primary collation elements to be inserted.
- "٢": append(p(102), tPlus3), // U+0662 ARABIC-INDIC DIGIT TWO
- // Varying tertiary weights should be ignored.
- "2": []Elem{e(102, digSec, digTert+3)}, // U+FF12 FULLWIDTH DIGIT TWO
- "3": p(103),
- "4": p(104),
- "5": p(105),
- "6": p(106),
- "7": p(107),
- // Weights must be strictly monotonically increasing, but do not need to be
- // consecutive.
- "8": p(118),
- "9": p(119),
- // Allow non-primary collation elements to be inserted.
- "٩": append(p(119), tPlus3), // U+0669 ARABIC-INDIC DIGIT NINE
- // Varying tertiary weights should be ignored.
- "9": []Elem{e(119, digSec, digTert+1)}, // U+FF19 FULLWIDTH DIGIT NINE
- "₉": []Elem{e(119, digSec, digTert+5)}, // U+2089 SUBSCRIPT NINE
-
- "a": p(5),
- "b": p(6),
- "c": p(8, 2),
-
- "klm": p(99),
-
- "nop": p(121),
-
- "x": p(200),
- "y": p(201),
-}
-
-func p(w ...int) (elems []Elem) {
- for _, x := range w {
- e, _ := MakeElem(x, digSec, digTert, 0)
- elems = append(elems, e)
- }
- return elems
-}
-
-func TestNumericAppendNext(t *testing.T) {
- for _, tt := range []struct {
- in string
- w []Elem
- }{
- {"a", p(5)},
- {"klm", p(99)},
- {"aa", p(5, 5)},
- {"1", p(120, 1, 101)},
- {"0", p(120, 0)},
- {"01", p(120, 1, 101)},
- {"0001", p(120, 1, 101)},
- {"10", p(120, 2, 101, 100)},
- {"99", p(120, 2, 119, 119)},
- {"9999", p(120, 4, 119, 119, 119, 119)},
- {"1a", p(120, 1, 101, 5)},
- {"0b", p(120, 0, 6)},
- {"01c", p(120, 1, 101, 8, 2)},
- {"10x", p(120, 2, 101, 100, 200)},
- {"99y", p(120, 2, 119, 119, 201)},
- {"9999nop", p(120, 4, 119, 119, 119, 119, 121)},
-
- // Allow follow-up collation elements if they have a zero non-primary.
- {"١٢٩", []Elem{e(120), e(3), e(101), tPlus3, e(102), tPlus3, e(119), tPlus3}},
- {
- "129",
- []Elem{
- e(120), e(3),
- e(101, digSec, digTert+1),
- e(102, digSec, digTert+3),
- e(119, digSec, digTert+1),
- },
- },
-
- // Ensure AppendNext* adds to the given buffer.
- {"a10", p(5, 120, 2, 101, 100)},
- } {
- nw := NewNumericWeighter(numWeighter)
-
- b := []byte(tt.in)
- got := []Elem(nil)
- for n, sz := 0, 0; n < len(b); {
- got, sz = nw.AppendNext(got, b[n:])
- n += sz
- }
- if !reflect.DeepEqual(got, tt.w) {
- t.Errorf("AppendNext(%q) =\n%v; want\n%v", tt.in, got, tt.w)
- }
-
- got = nil
- for n, sz := 0, 0; n < len(tt.in); {
- got, sz = nw.AppendNextString(got, tt.in[n:])
- n += sz
- }
- if !reflect.DeepEqual(got, tt.w) {
- t.Errorf("AppendNextString(%q) =\n%v; want\n%v", tt.in, got, tt.w)
- }
- }
-}
-
-func TestNumericOverflow(t *testing.T) {
- manyDigits := strings.Repeat("9", maxDigits+1) + "a"
-
- nw := NewNumericWeighter(numWeighter)
-
- got, n := nw.AppendNextString(nil, manyDigits)
-
- if n != maxDigits {
- t.Errorf("n: got %d; want %d", n, maxDigits)
- }
-
- if got[1].Primary() != maxDigits {
- t.Errorf("primary(e[1]): got %d; want %d", n, maxDigits)
- }
-}
-
-func TestNumericWeighterAlloc(t *testing.T) {
- buf := make([]Elem, 100)
- w := NewNumericWeighter(numWeighter)
- s := "1234567890a"
-
- nNormal := testtext.AllocsPerRun(3, func() { numWeighter.AppendNextString(buf, s) })
- nNumeric := testtext.AllocsPerRun(3, func() { w.AppendNextString(buf, s) })
- if n := nNumeric - nNormal; n > 0 {
- t.Errorf("got %f; want 0", n)
- }
-}
diff --git a/vendor/golang.org/x/text/internal/colltab/trie_test.go b/vendor/golang.org/x/text/internal/colltab/trie_test.go
deleted file mode 100644
index b056a811e..000000000
--- a/vendor/golang.org/x/text/internal/colltab/trie_test.go
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package colltab
-
-import (
- "testing"
-)
-
-// We take the smallest, largest and an arbitrary value for each
-// of the UTF-8 sequence lengths.
-var testRunes = []rune{
- 0x01, 0x0C, 0x7F, // 1-byte sequences
- 0x80, 0x100, 0x7FF, // 2-byte sequences
- 0x800, 0x999, 0xFFFF, // 3-byte sequences
- 0x10000, 0x10101, 0x10FFFF, // 4-byte sequences
- 0x200, 0x201, 0x202, 0x210, 0x215, // five entries in one sparse block
-}
-
-// Test cases for illegal runes.
-type trietest struct {
- size int
- bytes []byte
-}
-
-var tests = []trietest{
- // illegal runes
- {1, []byte{0x80}},
- {1, []byte{0xFF}},
- {1, []byte{t2, tx - 1}},
- {1, []byte{t2, t2}},
- {2, []byte{t3, tx, tx - 1}},
- {2, []byte{t3, tx, t2}},
- {1, []byte{t3, tx - 1, tx}},
- {3, []byte{t4, tx, tx, tx - 1}},
- {3, []byte{t4, tx, tx, t2}},
- {1, []byte{t4, t2, tx, tx - 1}},
- {2, []byte{t4, tx, t2, tx - 1}},
-
- // short runes
- {0, []byte{t2}},
- {0, []byte{t3, tx}},
- {0, []byte{t4, tx, tx}},
-
- // we only support UTF-8 up to utf8.UTFMax bytes (4 bytes)
- {1, []byte{t5, tx, tx, tx, tx}},
- {1, []byte{t6, tx, tx, tx, tx, tx}},
-}
-
-func TestLookupTrie(t *testing.T) {
- for i, r := range testRunes {
- b := []byte(string(r))
- v, sz := testTrie.lookup(b)
- if int(v) != i {
- t.Errorf("lookup(%U): found value %#x, expected %#x", r, v, i)
- }
- if sz != len(b) {
- t.Errorf("lookup(%U): found size %d, expected %d", r, sz, len(b))
- }
- }
- for i, tt := range tests {
- v, sz := testTrie.lookup(tt.bytes)
- if int(v) != 0 {
- t.Errorf("lookup of illegal rune, case %d: found value %#x, expected 0", i, v)
- }
- if sz != tt.size {
- t.Errorf("lookup of illegal rune, case %d: found size %d, expected %d", i, sz, tt.size)
- }
- }
-}
-
-// test data is taken from exp/collate/locale/build/trie_test.go
-var testValues = [832]uint32{
- 0x000c: 0x00000001,
- 0x007f: 0x00000002,
- 0x00c0: 0x00000003,
- 0x0100: 0x00000004,
- 0x0140: 0x0000000c, 0x0141: 0x0000000d, 0x0142: 0x0000000e,
- 0x0150: 0x0000000f,
- 0x0155: 0x00000010,
- 0x01bf: 0x00000005,
- 0x01c0: 0x00000006,
- 0x0219: 0x00000007,
- 0x027f: 0x00000008,
- 0x0280: 0x00000009,
- 0x02c1: 0x0000000a,
- 0x033f: 0x0000000b,
-}
-
-var testLookup = [640]uint16{
- 0x0e0: 0x05, 0x0e6: 0x06,
- 0x13f: 0x07,
- 0x140: 0x08, 0x144: 0x09,
- 0x190: 0x03,
- 0x1ff: 0x0a,
- 0x20f: 0x05,
- 0x242: 0x01, 0x244: 0x02,
- 0x248: 0x03,
- 0x25f: 0x04,
- 0x260: 0x01,
- 0x26f: 0x02,
- 0x270: 0x04, 0x274: 0x06,
-}
-
-var testTrie = Trie{testLookup[6*blockSize:], testValues[:], testLookup[:], testValues[:]}
diff --git a/vendor/golang.org/x/text/internal/colltab/weighter_test.go b/vendor/golang.org/x/text/internal/colltab/weighter_test.go
deleted file mode 100644
index b5f8487b3..000000000
--- a/vendor/golang.org/x/text/internal/colltab/weighter_test.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package colltab
-
-// testWeighter is a simple Weighter that returns weights from a user-defined map.
-type testWeighter map[string][]Elem
-
-func (t testWeighter) Start(int, []byte) int { return 0 }
-func (t testWeighter) StartString(int, string) int { return 0 }
-func (t testWeighter) Domain() []string { return nil }
-func (t testWeighter) Top() uint32 { return 0 }
-
-// maxContractBytes is the maximum length of any key in the map.
-const maxContractBytes = 10
-
-func (t testWeighter) AppendNext(buf []Elem, s []byte) ([]Elem, int) {
- n := len(s)
- if n > maxContractBytes {
- n = maxContractBytes
- }
- for i := n; i > 0; i-- {
- if e, ok := t[string(s[:i])]; ok {
- return append(buf, e...), i
- }
- }
- panic("incomplete testWeighter: could not find " + string(s))
-}
-
-func (t testWeighter) AppendNextString(buf []Elem, s string) ([]Elem, int) {
- n := len(s)
- if n > maxContractBytes {
- n = maxContractBytes
- }
- for i := n; i > 0; i-- {
- if e, ok := t[s[:i]]; ok {
- return append(buf, e...), i
- }
- }
- panic("incomplete testWeighter: could not find " + s)
-}
diff --git a/vendor/golang.org/x/text/internal/gen_test.go b/vendor/golang.org/x/text/internal/gen_test.go
deleted file mode 100644
index a2e1981ae..000000000
--- a/vendor/golang.org/x/text/internal/gen_test.go
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package internal
-
-import (
- "testing"
-
- "golang.org/x/text/language"
-)
-
-func TestParents(t *testing.T) {
- testCases := []struct {
- tag, parent string
- }{
- {"af", "und"},
- {"en", "und"},
- {"en-001", "en"},
- {"en-AU", "en-001"},
- {"en-US", "en"},
- {"en-US-u-va-posix", "en-US"},
- {"ca-ES-valencia", "ca-ES"},
- }
- for _, tc := range testCases {
- tag, ok := language.CompactIndex(language.MustParse(tc.tag))
- if !ok {
- t.Fatalf("Could not get index of flag %s", tc.tag)
- }
- want, ok := language.CompactIndex(language.MustParse(tc.parent))
- if !ok {
- t.Fatalf("Could not get index of parent %s of tag %s", tc.parent, tc.tag)
- }
- if got := int(Parent[tag]); got != want {
- t.Errorf("Parent[%s] = %d; want %d (%s)", tc.tag, got, want, tc.parent)
- }
- }
-}
diff --git a/vendor/golang.org/x/text/internal/internal_test.go b/vendor/golang.org/x/text/internal/internal_test.go
deleted file mode 100644
index ce1b9a382..000000000
--- a/vendor/golang.org/x/text/internal/internal_test.go
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package internal
-
-import (
- "fmt"
- "strings"
- "testing"
-
- "golang.org/x/text/language"
-)
-
-func TestUnique(t *testing.T) {
- testCases := []struct {
- in, want string
- }{
- {"", "[]"},
- {"en", "[en]"},
- {"en en", "[en]"},
- {"en en en", "[en]"},
- {"en-u-cu-eur en", "[en en-u-cu-eur]"},
- {"nl en", "[en nl]"},
- {"pt-Pt pt", "[pt pt-PT]"},
- }
- for _, tc := range testCases {
- tags := []language.Tag{}
- for _, s := range strings.Split(tc.in, " ") {
- if s != "" {
- tags = append(tags, language.MustParse(s))
- }
- }
- if got := fmt.Sprint(UniqueTags(tags)); got != tc.want {
- t.Errorf("Unique(%s) = %s; want %s", tc.in, got, tc.want)
- }
- }
-}
diff --git a/vendor/golang.org/x/text/internal/match_test.go b/vendor/golang.org/x/text/internal/match_test.go
deleted file mode 100644
index 8a3fe6572..000000000
--- a/vendor/golang.org/x/text/internal/match_test.go
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package internal
-
-import (
- "strings"
- "testing"
-
- "golang.org/x/text/language"
-)
-
-func TestInheritanceMatcher(t *testing.T) {
- for i, tt := range []struct {
- haveTags string
- wantTags string
- match string
- conf language.Confidence
- }{
- {"und,en,en-US", "en-US", "en-US", language.Exact}, // most specific match
- {"zh-Hant,zh", "zh-TW", "zh-Hant", language.High}, // zh-TW implies Hant.
- {"und,zh", "zh-TW", "und", language.High}, // zh-TW does not match zh.
- {"zh", "zh-TW", "und", language.No}, // zh-TW does not match zh.
- {"iw,en,nl", "he", "he", language.Exact}, // matches after canonicalization
- {"he,en,nl", "iw", "he", language.Exact}, // matches after canonicalization
- // Prefer first match over more specific match for various reasons:
- // a) consistency of user interface is more important than an exact match,
- // b) _if_ und is specified, it should be considered a correct and useful match,
- // Note that a call to this Match will almost always be with a single tag.
- {"und,en,en-US", "he,en-US", "und", language.High},
- } {
- have := parseTags(tt.haveTags)
- m := NewInheritanceMatcher(have)
- tag, index, conf := m.Match(parseTags(tt.wantTags)...)
- want := language.Raw.Make(tt.match)
- if tag != want {
- t.Errorf("%d:tag: got %q; want %q", i, tag, want)
- }
- if conf != language.No {
- if got, _ := language.All.Canonicalize(have[index]); got != want {
- t.Errorf("%d:index: got %q; want %q ", i, got, want)
- }
- }
- if conf != tt.conf {
- t.Errorf("%d:conf: got %v; want %v", i, conf, tt.conf)
- }
- }
-}
-
-func parseTags(list string) (out []language.Tag) {
- for _, s := range strings.Split(list, ",") {
- out = append(out, language.Raw.Make(strings.TrimSpace(s)))
- }
- return out
-}
diff --git a/vendor/golang.org/x/text/internal/tag/tag_test.go b/vendor/golang.org/x/text/internal/tag/tag_test.go
deleted file mode 100644
index da174a24c..000000000
--- a/vendor/golang.org/x/text/internal/tag/tag_test.go
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package tag
-
-import (
- "strings"
- "testing"
-)
-
-var strdata = []string{
- "aa ",
- "aaa ",
- "aaaa",
- "aaab",
- "aab ",
- "ab ",
- "ba ",
- "xxxx",
- "\xff\xff\xff\xff",
-}
-
-var testCases = map[string]int{
- "a": 0,
- "aa": 0,
- "aaa": 1,
- "aa ": 0,
- "aaaa": 2,
- "aaab": 3,
- "b": 6,
- "ba": 6,
- " ": -1,
- "aaax": -1,
- "bbbb": -1,
- "zzzz": -1,
-}
-
-func TestIndex(t *testing.T) {
- index := Index(strings.Join(strdata, ""))
- for k, v := range testCases {
- if i := index.Index([]byte(k)); i != v {
- t.Errorf("%s: got %d; want %d", k, i, v)
- }
- }
-}
-
-func TestFixCase(t *testing.T) {
- tests := []string{
- "aaaa", "AbCD", "abcd",
- "Zzzz", "AbCD", "Abcd",
- "Zzzz", "AbC", "",
- "XXX", "ab ", "",
- "XXX", "usd", "USD",
- "cmn", "AB ", "",
- "gsw", "CMN", "cmn",
- }
- for tc := tests; len(tc) > 0; tc = tc[3:] {
- b := []byte(tc[1])
- if !FixCase(tc[0], b) {
- b = nil
- }
- if string(b) != tc[2] {
- t.Errorf("FixCase(%q, %q) = %q; want %q", tc[0], tc[1], b, tc[2])
- }
- }
-}
diff --git a/vendor/golang.org/x/text/internal/triegen/data_test.go b/vendor/golang.org/x/text/internal/triegen/data_test.go
deleted file mode 100644
index 91de547a5..000000000
--- a/vendor/golang.org/x/text/internal/triegen/data_test.go
+++ /dev/null
@@ -1,875 +0,0 @@
-// This file is generated with "go test -tags generate". DO NOT EDIT!
-// +build !generate
-
-package triegen_test
-
-// lookup returns the trie value for the first UTF-8 encoding in s and
-// the width in bytes of this encoding. The size will be 0 if s does not
-// hold enough bytes to complete the encoding. len(s) must be greater than 0.
-func (t *randTrie) lookup(s []byte) (v uint8, sz int) {
- c0 := s[0]
- switch {
- case c0 < 0x80: // is ASCII
- return randValues[c0], 1
- case c0 < 0xC2:
- return 0, 1 // Illegal UTF-8: not a starter, not ASCII.
- case c0 < 0xE0: // 2-byte UTF-8
- if len(s) < 2 {
- return 0, 0
- }
- i := randIndex[c0]
- c1 := s[1]
- if c1 < 0x80 || 0xC0 <= c1 {
- return 0, 1 // Illegal UTF-8: not a continuation byte.
- }
- return t.lookupValue(uint32(i), c1), 2
- case c0 < 0xF0: // 3-byte UTF-8
- if len(s) < 3 {
- return 0, 0
- }
- i := randIndex[c0]
- c1 := s[1]
- if c1 < 0x80 || 0xC0 <= c1 {
- return 0, 1 // Illegal UTF-8: not a continuation byte.
- }
- o := uint32(i)<<6 + uint32(c1)
- i = randIndex[o]
- c2 := s[2]
- if c2 < 0x80 || 0xC0 <= c2 {
- return 0, 2 // Illegal UTF-8: not a continuation byte.
- }
- return t.lookupValue(uint32(i), c2), 3
- case c0 < 0xF8: // 4-byte UTF-8
- if len(s) < 4 {
- return 0, 0
- }
- i := randIndex[c0]
- c1 := s[1]
- if c1 < 0x80 || 0xC0 <= c1 {
- return 0, 1 // Illegal UTF-8: not a continuation byte.
- }
- o := uint32(i)<<6 + uint32(c1)
- i = randIndex[o]
- c2 := s[2]
- if c2 < 0x80 || 0xC0 <= c2 {
- return 0, 2 // Illegal UTF-8: not a continuation byte.
- }
- o = uint32(i)<<6 + uint32(c2)
- i = randIndex[o]
- c3 := s[3]
- if c3 < 0x80 || 0xC0 <= c3 {
- return 0, 3 // Illegal UTF-8: not a continuation byte.
- }
- return t.lookupValue(uint32(i), c3), 4
- }
- // Illegal rune
- return 0, 1
-}
-
-// lookupUnsafe returns the trie value for the first UTF-8 encoding in s.
-// s must start with a full and valid UTF-8 encoded rune.
-func (t *randTrie) lookupUnsafe(s []byte) uint8 {
- c0 := s[0]
- if c0 < 0x80 { // is ASCII
- return randValues[c0]
- }
- i := randIndex[c0]
- if c0 < 0xE0 { // 2-byte UTF-8
- return t.lookupValue(uint32(i), s[1])
- }
- i = randIndex[uint32(i)<<6+uint32(s[1])]
- if c0 < 0xF0 { // 3-byte UTF-8
- return t.lookupValue(uint32(i), s[2])
- }
- i = randIndex[uint32(i)<<6+uint32(s[2])]
- if c0 < 0xF8 { // 4-byte UTF-8
- return t.lookupValue(uint32(i), s[3])
- }
- return 0
-}
-
-// lookupString returns the trie value for the first UTF-8 encoding in s and
-// the width in bytes of this encoding. The size will be 0 if s does not
-// hold enough bytes to complete the encoding. len(s) must be greater than 0.
-func (t *randTrie) lookupString(s string) (v uint8, sz int) {
- c0 := s[0]
- switch {
- case c0 < 0x80: // is ASCII
- return randValues[c0], 1
- case c0 < 0xC2:
- return 0, 1 // Illegal UTF-8: not a starter, not ASCII.
- case c0 < 0xE0: // 2-byte UTF-8
- if len(s) < 2 {
- return 0, 0
- }
- i := randIndex[c0]
- c1 := s[1]
- if c1 < 0x80 || 0xC0 <= c1 {
- return 0, 1 // Illegal UTF-8: not a continuation byte.
- }
- return t.lookupValue(uint32(i), c1), 2
- case c0 < 0xF0: // 3-byte UTF-8
- if len(s) < 3 {
- return 0, 0
- }
- i := randIndex[c0]
- c1 := s[1]
- if c1 < 0x80 || 0xC0 <= c1 {
- return 0, 1 // Illegal UTF-8: not a continuation byte.
- }
- o := uint32(i)<<6 + uint32(c1)
- i = randIndex[o]
- c2 := s[2]
- if c2 < 0x80 || 0xC0 <= c2 {
- return 0, 2 // Illegal UTF-8: not a continuation byte.
- }
- return t.lookupValue(uint32(i), c2), 3
- case c0 < 0xF8: // 4-byte UTF-8
- if len(s) < 4 {
- return 0, 0
- }
- i := randIndex[c0]
- c1 := s[1]
- if c1 < 0x80 || 0xC0 <= c1 {
- return 0, 1 // Illegal UTF-8: not a continuation byte.
- }
- o := uint32(i)<<6 + uint32(c1)
- i = randIndex[o]
- c2 := s[2]
- if c2 < 0x80 || 0xC0 <= c2 {
- return 0, 2 // Illegal UTF-8: not a continuation byte.
- }
- o = uint32(i)<<6 + uint32(c2)
- i = randIndex[o]
- c3 := s[3]
- if c3 < 0x80 || 0xC0 <= c3 {
- return 0, 3 // Illegal UTF-8: not a continuation byte.
- }
- return t.lookupValue(uint32(i), c3), 4
- }
- // Illegal rune
- return 0, 1
-}
-
-// lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s.
-// s must start with a full and valid UTF-8 encoded rune.
-func (t *randTrie) lookupStringUnsafe(s string) uint8 {
- c0 := s[0]
- if c0 < 0x80 { // is ASCII
- return randValues[c0]
- }
- i := randIndex[c0]
- if c0 < 0xE0 { // 2-byte UTF-8
- return t.lookupValue(uint32(i), s[1])
- }
- i = randIndex[uint32(i)<<6+uint32(s[1])]
- if c0 < 0xF0 { // 3-byte UTF-8
- return t.lookupValue(uint32(i), s[2])
- }
- i = randIndex[uint32(i)<<6+uint32(s[2])]
- if c0 < 0xF8 { // 4-byte UTF-8
- return t.lookupValue(uint32(i), s[3])
- }
- return 0
-}
-
-// randTrie. Total size: 9280 bytes (9.06 KiB). Checksum: 6debd324a8debb8f.
-type randTrie struct{}
-
-func newRandTrie(i int) *randTrie {
- return &randTrie{}
-}
-
-// lookupValue determines the type of block n and looks up the value for b.
-func (t *randTrie) lookupValue(n uint32, b byte) uint8 {
- switch {
- default:
- return uint8(randValues[n<<6+uint32(b)])
- }
-}
-
-// randValues: 56 blocks, 3584 entries, 3584 bytes
-// The third block is the zero block.
-var randValues = [3584]uint8{
- // Block 0x0, offset 0x0
- // Block 0x1, offset 0x40
- // Block 0x2, offset 0x80
- // Block 0x3, offset 0xc0
- 0xc9: 0x0001,
- // Block 0x4, offset 0x100
- 0x100: 0x0001,
- // Block 0x5, offset 0x140
- 0x155: 0x0001,
- // Block 0x6, offset 0x180
- 0x196: 0x0001,
- // Block 0x7, offset 0x1c0
- 0x1ef: 0x0001,
- // Block 0x8, offset 0x200
- 0x206: 0x0001,
- // Block 0x9, offset 0x240
- 0x258: 0x0001,
- // Block 0xa, offset 0x280
- 0x288: 0x0001,
- // Block 0xb, offset 0x2c0
- 0x2f2: 0x0001,
- // Block 0xc, offset 0x300
- 0x304: 0x0001,
- // Block 0xd, offset 0x340
- 0x34b: 0x0001,
- // Block 0xe, offset 0x380
- 0x3ba: 0x0001,
- // Block 0xf, offset 0x3c0
- 0x3f5: 0x0001,
- // Block 0x10, offset 0x400
- 0x41d: 0x0001,
- // Block 0x11, offset 0x440
- 0x442: 0x0001,
- // Block 0x12, offset 0x480
- 0x4bb: 0x0001,
- // Block 0x13, offset 0x4c0
- 0x4e9: 0x0001,
- // Block 0x14, offset 0x500
- 0x53e: 0x0001,
- // Block 0x15, offset 0x540
- 0x55f: 0x0001,
- // Block 0x16, offset 0x580
- 0x5b7: 0x0001,
- // Block 0x17, offset 0x5c0
- 0x5d9: 0x0001,
- // Block 0x18, offset 0x600
- 0x60e: 0x0001,
- // Block 0x19, offset 0x640
- 0x652: 0x0001,
- // Block 0x1a, offset 0x680
- 0x68f: 0x0001,
- // Block 0x1b, offset 0x6c0
- 0x6dc: 0x0001,
- // Block 0x1c, offset 0x700
- 0x703: 0x0001,
- // Block 0x1d, offset 0x740
- 0x741: 0x0001,
- // Block 0x1e, offset 0x780
- 0x79b: 0x0001,
- // Block 0x1f, offset 0x7c0
- 0x7f1: 0x0001,
- // Block 0x20, offset 0x800
- 0x833: 0x0001,
- // Block 0x21, offset 0x840
- 0x853: 0x0001,
- // Block 0x22, offset 0x880
- 0x8a2: 0x0001,
- // Block 0x23, offset 0x8c0
- 0x8f8: 0x0001,
- // Block 0x24, offset 0x900
- 0x917: 0x0001,
- // Block 0x25, offset 0x940
- 0x945: 0x0001,
- // Block 0x26, offset 0x980
- 0x99e: 0x0001,
- // Block 0x27, offset 0x9c0
- 0x9fd: 0x0001,
- // Block 0x28, offset 0xa00
- 0xa0d: 0x0001,
- // Block 0x29, offset 0xa40
- 0xa66: 0x0001,
- // Block 0x2a, offset 0xa80
- 0xaab: 0x0001,
- // Block 0x2b, offset 0xac0
- 0xaea: 0x0001,
- // Block 0x2c, offset 0xb00
- 0xb2d: 0x0001,
- // Block 0x2d, offset 0xb40
- 0xb54: 0x0001,
- // Block 0x2e, offset 0xb80
- 0xb90: 0x0001,
- // Block 0x2f, offset 0xbc0
- 0xbe5: 0x0001,
- // Block 0x30, offset 0xc00
- 0xc28: 0x0001,
- // Block 0x31, offset 0xc40
- 0xc7c: 0x0001,
- // Block 0x32, offset 0xc80
- 0xcbf: 0x0001,
- // Block 0x33, offset 0xcc0
- 0xcc7: 0x0001,
- // Block 0x34, offset 0xd00
- 0xd34: 0x0001,
- // Block 0x35, offset 0xd40
- 0xd61: 0x0001,
- // Block 0x36, offset 0xd80
- 0xdb9: 0x0001,
- // Block 0x37, offset 0xdc0
- 0xdda: 0x0001,
-}
-
-// randIndex: 89 blocks, 5696 entries, 5696 bytes
-// Block 0 is the zero block.
-var randIndex = [5696]uint8{
- // Block 0x0, offset 0x0
- // Block 0x1, offset 0x40
- // Block 0x2, offset 0x80
- // Block 0x3, offset 0xc0
- 0xe1: 0x02, 0xe3: 0x03, 0xe4: 0x04,
- 0xea: 0x05, 0xeb: 0x06, 0xec: 0x07,
- 0xf0: 0x10, 0xf1: 0x24, 0xf2: 0x3d, 0xf3: 0x4f, 0xf4: 0x56,
- // Block 0x4, offset 0x100
- 0x107: 0x01,
- // Block 0x5, offset 0x140
- 0x16c: 0x02,
- // Block 0x6, offset 0x180
- 0x19c: 0x03,
- 0x1ae: 0x04,
- // Block 0x7, offset 0x1c0
- 0x1d8: 0x05,
- 0x1f7: 0x06,
- // Block 0x8, offset 0x200
- 0x20c: 0x07,
- // Block 0x9, offset 0x240
- 0x24a: 0x08,
- // Block 0xa, offset 0x280
- 0x2b6: 0x09,
- // Block 0xb, offset 0x2c0
- 0x2d5: 0x0a,
- // Block 0xc, offset 0x300
- 0x31a: 0x0b,
- // Block 0xd, offset 0x340
- 0x373: 0x0c,
- // Block 0xe, offset 0x380
- 0x38b: 0x0d,
- // Block 0xf, offset 0x3c0
- 0x3f0: 0x0e,
- // Block 0x10, offset 0x400
- 0x433: 0x0f,
- // Block 0x11, offset 0x440
- 0x45d: 0x10,
- // Block 0x12, offset 0x480
- 0x491: 0x08, 0x494: 0x09, 0x497: 0x0a,
- 0x49b: 0x0b, 0x49c: 0x0c,
- 0x4a1: 0x0d,
- 0x4ad: 0x0e,
- 0x4ba: 0x0f,
- // Block 0x13, offset 0x4c0
- 0x4c1: 0x11,
- // Block 0x14, offset 0x500
- 0x531: 0x12,
- // Block 0x15, offset 0x540
- 0x546: 0x13,
- // Block 0x16, offset 0x580
- 0x5ab: 0x14,
- // Block 0x17, offset 0x5c0
- 0x5d4: 0x11,
- 0x5fe: 0x11,
- // Block 0x18, offset 0x600
- 0x618: 0x0a,
- // Block 0x19, offset 0x640
- 0x65b: 0x15,
- // Block 0x1a, offset 0x680
- 0x6a0: 0x16,
- // Block 0x1b, offset 0x6c0
- 0x6d2: 0x17,
- 0x6f6: 0x18,
- // Block 0x1c, offset 0x700
- 0x711: 0x19,
- // Block 0x1d, offset 0x740
- 0x768: 0x1a,
- // Block 0x1e, offset 0x780
- 0x783: 0x1b,
- // Block 0x1f, offset 0x7c0
- 0x7f9: 0x1c,
- // Block 0x20, offset 0x800
- 0x831: 0x1d,
- // Block 0x21, offset 0x840
- 0x85e: 0x1e,
- // Block 0x22, offset 0x880
- 0x898: 0x1f,
- // Block 0x23, offset 0x8c0
- 0x8c7: 0x18,
- 0x8d5: 0x14,
- 0x8f7: 0x20,
- 0x8fe: 0x1f,
- // Block 0x24, offset 0x900
- 0x905: 0x21,
- // Block 0x25, offset 0x940
- 0x966: 0x03,
- // Block 0x26, offset 0x980
- 0x981: 0x07, 0x983: 0x11,
- 0x989: 0x12, 0x98a: 0x13, 0x98e: 0x14, 0x98f: 0x15,
- 0x992: 0x16, 0x995: 0x17, 0x996: 0x18,
- 0x998: 0x19, 0x999: 0x1a, 0x99b: 0x1b, 0x99f: 0x1c,
- 0x9a3: 0x1d,
- 0x9ad: 0x1e, 0x9af: 0x1f,
- 0x9b0: 0x20, 0x9b1: 0x21,
- 0x9b8: 0x22, 0x9bd: 0x23,
- // Block 0x27, offset 0x9c0
- 0x9cd: 0x22,
- // Block 0x28, offset 0xa00
- 0xa0c: 0x08,
- // Block 0x29, offset 0xa40
- 0xa6f: 0x1c,
- // Block 0x2a, offset 0xa80
- 0xa90: 0x1a,
- 0xaaf: 0x23,
- // Block 0x2b, offset 0xac0
- 0xae3: 0x19,
- 0xae8: 0x24,
- 0xafc: 0x25,
- // Block 0x2c, offset 0xb00
- 0xb13: 0x26,
- // Block 0x2d, offset 0xb40
- 0xb67: 0x1c,
- // Block 0x2e, offset 0xb80
- 0xb8f: 0x0b,
- // Block 0x2f, offset 0xbc0
- 0xbcb: 0x27,
- 0xbe7: 0x26,
- // Block 0x30, offset 0xc00
- 0xc34: 0x16,
- // Block 0x31, offset 0xc40
- 0xc62: 0x03,
- // Block 0x32, offset 0xc80
- 0xcbb: 0x12,
- // Block 0x33, offset 0xcc0
- 0xcdf: 0x09,
- // Block 0x34, offset 0xd00
- 0xd34: 0x0a,
- // Block 0x35, offset 0xd40
- 0xd41: 0x1e,
- // Block 0x36, offset 0xd80
- 0xd83: 0x28,
- // Block 0x37, offset 0xdc0
- 0xdc0: 0x15,
- // Block 0x38, offset 0xe00
- 0xe1a: 0x15,
- // Block 0x39, offset 0xe40
- 0xe65: 0x29,
- // Block 0x3a, offset 0xe80
- 0xe86: 0x1f,
- // Block 0x3b, offset 0xec0
- 0xeec: 0x18,
- // Block 0x3c, offset 0xf00
- 0xf28: 0x2a,
- // Block 0x3d, offset 0xf40
- 0xf53: 0x08,
- // Block 0x3e, offset 0xf80
- 0xfa2: 0x2b,
- 0xfaa: 0x17,
- // Block 0x3f, offset 0xfc0
- 0xfc0: 0x25, 0xfc2: 0x26,
- 0xfc9: 0x27, 0xfcd: 0x28, 0xfce: 0x29,
- 0xfd5: 0x2a,
- 0xfd8: 0x2b, 0xfd9: 0x2c, 0xfdf: 0x2d,
- 0xfe1: 0x2e, 0xfe2: 0x2f, 0xfe3: 0x30, 0xfe6: 0x31,
- 0xfe9: 0x32, 0xfec: 0x33, 0xfed: 0x34, 0xfef: 0x35,
- 0xff1: 0x36, 0xff2: 0x37, 0xff3: 0x38, 0xff4: 0x39,
- 0xffa: 0x3a, 0xffc: 0x3b, 0xffe: 0x3c,
- // Block 0x40, offset 0x1000
- 0x102c: 0x2c,
- // Block 0x41, offset 0x1040
- 0x1074: 0x2c,
- // Block 0x42, offset 0x1080
- 0x108c: 0x08,
- 0x10a0: 0x2d,
- // Block 0x43, offset 0x10c0
- 0x10e8: 0x10,
- // Block 0x44, offset 0x1100
- 0x110f: 0x13,
- // Block 0x45, offset 0x1140
- 0x114b: 0x2e,
- // Block 0x46, offset 0x1180
- 0x118b: 0x23,
- 0x119d: 0x0c,
- // Block 0x47, offset 0x11c0
- 0x11c3: 0x12,
- 0x11f9: 0x0f,
- // Block 0x48, offset 0x1200
- 0x121e: 0x1b,
- // Block 0x49, offset 0x1240
- 0x1270: 0x2f,
- // Block 0x4a, offset 0x1280
- 0x128a: 0x1b,
- 0x12a7: 0x02,
- // Block 0x4b, offset 0x12c0
- 0x12fb: 0x14,
- // Block 0x4c, offset 0x1300
- 0x1333: 0x30,
- // Block 0x4d, offset 0x1340
- 0x134d: 0x31,
- // Block 0x4e, offset 0x1380
- 0x138e: 0x15,
- // Block 0x4f, offset 0x13c0
- 0x13f4: 0x32,
- // Block 0x50, offset 0x1400
- 0x141b: 0x33,
- // Block 0x51, offset 0x1440
- 0x1448: 0x3e, 0x1449: 0x3f, 0x144a: 0x40, 0x144f: 0x41,
- 0x1459: 0x42, 0x145c: 0x43, 0x145e: 0x44, 0x145f: 0x45,
- 0x1468: 0x46, 0x1469: 0x47, 0x146c: 0x48, 0x146d: 0x49, 0x146e: 0x4a,
- 0x1472: 0x4b, 0x1473: 0x4c,
- 0x1479: 0x4d, 0x147b: 0x4e,
- // Block 0x52, offset 0x1480
- 0x1480: 0x34,
- 0x1499: 0x11,
- 0x14b6: 0x2c,
- // Block 0x53, offset 0x14c0
- 0x14e4: 0x0d,
- // Block 0x54, offset 0x1500
- 0x1527: 0x08,
- // Block 0x55, offset 0x1540
- 0x1555: 0x2b,
- // Block 0x56, offset 0x1580
- 0x15b2: 0x35,
- // Block 0x57, offset 0x15c0
- 0x15f2: 0x1c, 0x15f4: 0x29,
- // Block 0x58, offset 0x1600
- 0x1600: 0x50, 0x1603: 0x51,
- 0x1608: 0x52, 0x160a: 0x53, 0x160d: 0x54, 0x160e: 0x55,
-}
-
-// lookup returns the trie value for the first UTF-8 encoding in s and
-// the width in bytes of this encoding. The size will be 0 if s does not
-// hold enough bytes to complete the encoding. len(s) must be greater than 0.
-func (t *multiTrie) lookup(s []byte) (v uint64, sz int) {
- c0 := s[0]
- switch {
- case c0 < 0x80: // is ASCII
- return t.ascii[c0], 1
- case c0 < 0xC2:
- return 0, 1 // Illegal UTF-8: not a starter, not ASCII.
- case c0 < 0xE0: // 2-byte UTF-8
- if len(s) < 2 {
- return 0, 0
- }
- i := t.utf8Start[c0]
- c1 := s[1]
- if c1 < 0x80 || 0xC0 <= c1 {
- return 0, 1 // Illegal UTF-8: not a continuation byte.
- }
- return t.lookupValue(uint32(i), c1), 2
- case c0 < 0xF0: // 3-byte UTF-8
- if len(s) < 3 {
- return 0, 0
- }
- i := t.utf8Start[c0]
- c1 := s[1]
- if c1 < 0x80 || 0xC0 <= c1 {
- return 0, 1 // Illegal UTF-8: not a continuation byte.
- }
- o := uint32(i)<<6 + uint32(c1)
- i = multiIndex[o]
- c2 := s[2]
- if c2 < 0x80 || 0xC0 <= c2 {
- return 0, 2 // Illegal UTF-8: not a continuation byte.
- }
- return t.lookupValue(uint32(i), c2), 3
- case c0 < 0xF8: // 4-byte UTF-8
- if len(s) < 4 {
- return 0, 0
- }
- i := t.utf8Start[c0]
- c1 := s[1]
- if c1 < 0x80 || 0xC0 <= c1 {
- return 0, 1 // Illegal UTF-8: not a continuation byte.
- }
- o := uint32(i)<<6 + uint32(c1)
- i = multiIndex[o]
- c2 := s[2]
- if c2 < 0x80 || 0xC0 <= c2 {
- return 0, 2 // Illegal UTF-8: not a continuation byte.
- }
- o = uint32(i)<<6 + uint32(c2)
- i = multiIndex[o]
- c3 := s[3]
- if c3 < 0x80 || 0xC0 <= c3 {
- return 0, 3 // Illegal UTF-8: not a continuation byte.
- }
- return t.lookupValue(uint32(i), c3), 4
- }
- // Illegal rune
- return 0, 1
-}
-
-// lookupUnsafe returns the trie value for the first UTF-8 encoding in s.
-// s must start with a full and valid UTF-8 encoded rune.
-func (t *multiTrie) lookupUnsafe(s []byte) uint64 {
- c0 := s[0]
- if c0 < 0x80 { // is ASCII
- return t.ascii[c0]
- }
- i := t.utf8Start[c0]
- if c0 < 0xE0 { // 2-byte UTF-8
- return t.lookupValue(uint32(i), s[1])
- }
- i = multiIndex[uint32(i)<<6+uint32(s[1])]
- if c0 < 0xF0 { // 3-byte UTF-8
- return t.lookupValue(uint32(i), s[2])
- }
- i = multiIndex[uint32(i)<<6+uint32(s[2])]
- if c0 < 0xF8 { // 4-byte UTF-8
- return t.lookupValue(uint32(i), s[3])
- }
- return 0
-}
-
-// lookupString returns the trie value for the first UTF-8 encoding in s and
-// the width in bytes of this encoding. The size will be 0 if s does not
-// hold enough bytes to complete the encoding. len(s) must be greater than 0.
-func (t *multiTrie) lookupString(s string) (v uint64, sz int) {
- c0 := s[0]
- switch {
- case c0 < 0x80: // is ASCII
- return t.ascii[c0], 1
- case c0 < 0xC2:
- return 0, 1 // Illegal UTF-8: not a starter, not ASCII.
- case c0 < 0xE0: // 2-byte UTF-8
- if len(s) < 2 {
- return 0, 0
- }
- i := t.utf8Start[c0]
- c1 := s[1]
- if c1 < 0x80 || 0xC0 <= c1 {
- return 0, 1 // Illegal UTF-8: not a continuation byte.
- }
- return t.lookupValue(uint32(i), c1), 2
- case c0 < 0xF0: // 3-byte UTF-8
- if len(s) < 3 {
- return 0, 0
- }
- i := t.utf8Start[c0]
- c1 := s[1]
- if c1 < 0x80 || 0xC0 <= c1 {
- return 0, 1 // Illegal UTF-8: not a continuation byte.
- }
- o := uint32(i)<<6 + uint32(c1)
- i = multiIndex[o]
- c2 := s[2]
- if c2 < 0x80 || 0xC0 <= c2 {
- return 0, 2 // Illegal UTF-8: not a continuation byte.
- }
- return t.lookupValue(uint32(i), c2), 3
- case c0 < 0xF8: // 4-byte UTF-8
- if len(s) < 4 {
- return 0, 0
- }
- i := t.utf8Start[c0]
- c1 := s[1]
- if c1 < 0x80 || 0xC0 <= c1 {
- return 0, 1 // Illegal UTF-8: not a continuation byte.
- }
- o := uint32(i)<<6 + uint32(c1)
- i = multiIndex[o]
- c2 := s[2]
- if c2 < 0x80 || 0xC0 <= c2 {
- return 0, 2 // Illegal UTF-8: not a continuation byte.
- }
- o = uint32(i)<<6 + uint32(c2)
- i = multiIndex[o]
- c3 := s[3]
- if c3 < 0x80 || 0xC0 <= c3 {
- return 0, 3 // Illegal UTF-8: not a continuation byte.
- }
- return t.lookupValue(uint32(i), c3), 4
- }
- // Illegal rune
- return 0, 1
-}
-
-// lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s.
-// s must start with a full and valid UTF-8 encoded rune.
-func (t *multiTrie) lookupStringUnsafe(s string) uint64 {
- c0 := s[0]
- if c0 < 0x80 { // is ASCII
- return t.ascii[c0]
- }
- i := t.utf8Start[c0]
- if c0 < 0xE0 { // 2-byte UTF-8
- return t.lookupValue(uint32(i), s[1])
- }
- i = multiIndex[uint32(i)<<6+uint32(s[1])]
- if c0 < 0xF0 { // 3-byte UTF-8
- return t.lookupValue(uint32(i), s[2])
- }
- i = multiIndex[uint32(i)<<6+uint32(s[2])]
- if c0 < 0xF8 { // 4-byte UTF-8
- return t.lookupValue(uint32(i), s[3])
- }
- return 0
-}
-
-// multiTrie. Total size: 18250 bytes (17.82 KiB). Checksum: a69a609d8696aa5e.
-type multiTrie struct {
- ascii []uint64 // index for ASCII bytes
- utf8Start []uint8 // index for UTF-8 bytes >= 0xC0
-}
-
-func newMultiTrie(i int) *multiTrie {
- h := multiTrieHandles[i]
- return &multiTrie{multiValues[uint32(h.ascii)<<6:], multiIndex[uint32(h.multi)<<6:]}
-}
-
-type multiTrieHandle struct {
- ascii, multi uint8
-}
-
-// multiTrieHandles: 5 handles, 10 bytes
-var multiTrieHandles = [5]multiTrieHandle{
- {0, 0}, // 8c1e77823143d35c: all
- {0, 23}, // 8fb58ff8243b45b0: ASCII only
- {0, 23}, // 8fb58ff8243b45b0: ASCII only 2
- {0, 24}, // 2ccc43994f11046f: BMP only
- {30, 25}, // ce448591bdcb4733: No BMP
-}
-
-// lookupValue determines the type of block n and looks up the value for b.
-func (t *multiTrie) lookupValue(n uint32, b byte) uint64 {
- switch {
- default:
- return uint64(multiValues[n<<6+uint32(b)])
- }
-}
-
-// multiValues: 32 blocks, 2048 entries, 16384 bytes
-// The third block is the zero block.
-var multiValues = [2048]uint64{
- // Block 0x0, offset 0x0
- 0x03: 0x6e361699800b9fb8, 0x04: 0x52d3935a34f6f0b, 0x05: 0x2948319393e7ef10,
- 0x07: 0x20f03b006704f663, 0x08: 0x6c15c0732bb2495f, 0x09: 0xe54e2c59d953551,
- 0x0f: 0x33d8a825807d8037, 0x10: 0x6ecd93cb12168b92, 0x11: 0x6a81c9c0ce86e884,
- 0x1f: 0xa03e77aac8be79b, 0x20: 0x28591d0e7e486efa, 0x21: 0x716fa3bc398dec8,
- 0x3f: 0x4fd3bcfa72bce8b0,
- // Block 0x1, offset 0x40
- 0x40: 0x3cbaef3db8ba5f12, 0x41: 0x2d262347c1f56357,
- 0x7f: 0x782caa2d25a418a9,
- // Block 0x2, offset 0x80
- // Block 0x3, offset 0xc0
- 0xc0: 0x6bbd1f937b1ff5d2, 0xc1: 0x732e23088d2eb8a4,
- // Block 0x4, offset 0x100
- 0x13f: 0x56f8c4c82f5962dc,
- // Block 0x5, offset 0x140
- 0x140: 0x57dc4544729a5da2, 0x141: 0x2f62f9cd307ffa0d,
- // Block 0x6, offset 0x180
- 0x1bf: 0x7bf4d0ebf302a088,
- // Block 0x7, offset 0x1c0
- 0x1c0: 0x1f0d67f249e59931, 0x1c1: 0x3011def73aa550c7,
- // Block 0x8, offset 0x200
- 0x23f: 0x5de81c1dff6bf29d,
- // Block 0x9, offset 0x240
- 0x240: 0x752c035737b825e8, 0x241: 0x1e793399081e3bb3,
- // Block 0xa, offset 0x280
- 0x2bf: 0x6a28f01979cbf059,
- // Block 0xb, offset 0x2c0
- 0x2c0: 0x373a4b0f2cbd4c74, 0x2c1: 0x4fd2c288683b767c,
- // Block 0xc, offset 0x300
- 0x33f: 0x5a10ffa9e29184fb,
- // Block 0xd, offset 0x340
- 0x340: 0x700f9bdb53fff6a5, 0x341: 0xcde93df0427eb79,
- // Block 0xe, offset 0x380
- 0x3bf: 0x74071288fff39c76,
- // Block 0xf, offset 0x3c0
- 0x3c0: 0x481fc2f510e5268a, 0x3c1: 0x7565c28164204849,
- // Block 0x10, offset 0x400
- 0x43f: 0x5676a62fd49c6bec,
- // Block 0x11, offset 0x440
- 0x440: 0x2f2d15776cbafc6b, 0x441: 0x4c55e8dc0ff11a3f,
- // Block 0x12, offset 0x480
- 0x4bf: 0x69d6f0fe711fafc9,
- // Block 0x13, offset 0x4c0
- 0x4c0: 0x33181de28cfb062d, 0x4c1: 0x2ef3adc6bb2f2d02,
- // Block 0x14, offset 0x500
- 0x53f: 0xe03b31814c95f8b,
- // Block 0x15, offset 0x540
- 0x540: 0x3bf6dc9a1c115603, 0x541: 0x6984ec9b7f51f7fc,
- // Block 0x16, offset 0x580
- 0x5bf: 0x3c02ea92fb168559,
- // Block 0x17, offset 0x5c0
- 0x5c0: 0x1badfe42e7629494, 0x5c1: 0x6dc4a554005f7645,
- // Block 0x18, offset 0x600
- 0x63f: 0x3bb2ed2a72748f4b,
- // Block 0x19, offset 0x640
- 0x640: 0x291354cd6767ec10, 0x641: 0x2c3a4715e3c070d6,
- // Block 0x1a, offset 0x680
- 0x6bf: 0x352711cfb7236418,
- // Block 0x1b, offset 0x6c0
- 0x6c0: 0x3a59d34fb8bceda, 0x6c1: 0x5e90d8ebedd64fa1,
- // Block 0x1c, offset 0x700
- 0x73f: 0x7191a77b28d23110,
- // Block 0x1d, offset 0x740
- 0x740: 0x4ca7f0c1623423d8, 0x741: 0x4f7156d996e2d0de,
- // Block 0x1e, offset 0x780
- // Block 0x1f, offset 0x7c0
-}
-
-// multiIndex: 29 blocks, 1856 entries, 1856 bytes
-// Block 0 is the zero block.
-var multiIndex = [1856]uint8{
- // Block 0x0, offset 0x0
- // Block 0x1, offset 0x40
- // Block 0x2, offset 0x80
- // Block 0x3, offset 0xc0
- 0xc2: 0x01, 0xc3: 0x02, 0xc4: 0x03, 0xc7: 0x04,
- 0xc8: 0x05, 0xcf: 0x06,
- 0xd0: 0x07,
- 0xdf: 0x08,
- 0xe0: 0x02, 0xe1: 0x03, 0xe2: 0x04, 0xe3: 0x05, 0xe4: 0x06, 0xe7: 0x07,
- 0xe8: 0x08, 0xef: 0x09,
- 0xf0: 0x0e, 0xf1: 0x11, 0xf2: 0x13, 0xf3: 0x15, 0xf4: 0x17,
- // Block 0x4, offset 0x100
- 0x120: 0x09,
- 0x13f: 0x0a,
- // Block 0x5, offset 0x140
- 0x140: 0x0b,
- 0x17f: 0x0c,
- // Block 0x6, offset 0x180
- 0x180: 0x0d,
- // Block 0x7, offset 0x1c0
- 0x1ff: 0x0e,
- // Block 0x8, offset 0x200
- 0x200: 0x0f,
- // Block 0x9, offset 0x240
- 0x27f: 0x10,
- // Block 0xa, offset 0x280
- 0x280: 0x11,
- // Block 0xb, offset 0x2c0
- 0x2ff: 0x12,
- // Block 0xc, offset 0x300
- 0x300: 0x13,
- // Block 0xd, offset 0x340
- 0x37f: 0x14,
- // Block 0xe, offset 0x380
- 0x380: 0x15,
- // Block 0xf, offset 0x3c0
- 0x3ff: 0x16,
- // Block 0x10, offset 0x400
- 0x410: 0x0a,
- 0x41f: 0x0b,
- 0x420: 0x0c,
- 0x43f: 0x0d,
- // Block 0x11, offset 0x440
- 0x440: 0x17,
- // Block 0x12, offset 0x480
- 0x4bf: 0x18,
- // Block 0x13, offset 0x4c0
- 0x4c0: 0x0f,
- 0x4ff: 0x10,
- // Block 0x14, offset 0x500
- 0x500: 0x19,
- // Block 0x15, offset 0x540
- 0x540: 0x12,
- // Block 0x16, offset 0x580
- 0x5bf: 0x1a,
- // Block 0x17, offset 0x5c0
- 0x5ff: 0x14,
- // Block 0x18, offset 0x600
- 0x600: 0x1b,
- // Block 0x19, offset 0x640
- 0x640: 0x16,
- // Block 0x1a, offset 0x680
- // Block 0x1b, offset 0x6c0
- 0x6c2: 0x01, 0x6c3: 0x02, 0x6c4: 0x03, 0x6c7: 0x04,
- 0x6c8: 0x05, 0x6cf: 0x06,
- 0x6d0: 0x07,
- 0x6df: 0x08,
- 0x6e0: 0x02, 0x6e1: 0x03, 0x6e2: 0x04, 0x6e3: 0x05, 0x6e4: 0x06, 0x6e7: 0x07,
- 0x6e8: 0x08, 0x6ef: 0x09,
- // Block 0x1c, offset 0x700
- 0x730: 0x0e, 0x731: 0x11, 0x732: 0x13, 0x733: 0x15, 0x734: 0x17,
-}
diff --git a/vendor/golang.org/x/text/internal/triegen/example_compact_test.go b/vendor/golang.org/x/text/internal/triegen/example_compact_test.go
deleted file mode 100644
index 7cf604ca4..000000000
--- a/vendor/golang.org/x/text/internal/triegen/example_compact_test.go
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package triegen_test
-
-import (
- "fmt"
- "io"
- "io/ioutil"
-
- "golang.org/x/text/internal/triegen"
-)
-
-func ExampleCompacter() {
- t := triegen.NewTrie("root")
- for r := rune(0); r < 10000; r += 64 {
- t.Insert(r, 0x9015BADA55^uint64(r))
- }
- sz, _ := t.Gen(ioutil.Discard)
-
- fmt.Printf("Size normal: %5d\n", sz)
-
- var c myCompacter
- sz, _ = t.Gen(ioutil.Discard, triegen.Compact(&c))
-
- fmt.Printf("Size compacted: %5d\n", sz)
-
- // Output:
- // Size normal: 81344
- // Size compacted: 3224
-}
-
-// A myCompacter accepts a block if only the first value is given.
-type myCompacter []uint64
-
-func (c *myCompacter) Size(values []uint64) (sz int, ok bool) {
- for _, v := range values[1:] {
- if v != 0 {
- return 0, false
- }
- }
- return 8, true // the size of a uint64
-}
-
-func (c *myCompacter) Store(v []uint64) uint32 {
- x := uint32(len(*c))
- *c = append(*c, v[0])
- return x
-}
-
-func (c *myCompacter) Print(w io.Writer) error {
- fmt.Fprintln(w, "var firstValue = []uint64{")
- for _, v := range *c {
- fmt.Fprintf(w, "\t%#x,\n", v)
- }
- fmt.Fprintln(w, "}")
- return nil
-}
-
-func (c *myCompacter) Handler() string {
- return "getFirstValue"
-
- // Where getFirstValue is included along with the generated code:
- // func getFirstValue(n uint32, b byte) uint64 {
- // if b == 0x80 { // the first continuation byte
- // return firstValue[n]
- // }
- // return 0
- // }
-}
diff --git a/vendor/golang.org/x/text/internal/triegen/example_test.go b/vendor/golang.org/x/text/internal/triegen/example_test.go
deleted file mode 100644
index 557a152e7..000000000
--- a/vendor/golang.org/x/text/internal/triegen/example_test.go
+++ /dev/null
@@ -1,148 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package triegen_test
-
-import (
- "fmt"
- "io/ioutil"
- "math/rand"
- "unicode"
-
- "golang.org/x/text/internal/triegen"
-)
-
-const seed = 0x12345
-
-var genWriter = ioutil.Discard
-
-func randomRunes() map[rune]uint8 {
- rnd := rand.New(rand.NewSource(seed))
- m := map[rune]uint8{}
- for len(m) < 100 {
- // Only set our random rune if it is a valid Unicode code point.
- if r := rune(rnd.Int31n(unicode.MaxRune + 1)); []rune(string(r))[0] == r {
- m[r] = 1
- }
- }
- return m
-}
-
-// Example_build shows how to build a simple trie. It assigns the value 1 to
-// 100 random runes generated by randomRunes.
-func Example_build() {
- t := triegen.NewTrie("rand")
-
- for r, _ := range randomRunes() {
- t.Insert(r, 1)
- }
- sz, err := t.Gen(genWriter)
-
- fmt.Printf("Trie size: %d bytes\n", sz)
- fmt.Printf("Error: %v\n", err)
-
- // Output:
- // Trie size: 9280 bytes
- // Error: <nil>
-}
-
-// Example_lookup demonstrates how to use the trie generated by Example_build.
-func Example_lookup() {
- trie := newRandTrie(0)
-
- // The same set of runes used by Example_build.
- runes := randomRunes()
-
- // Verify the right value is returned for all runes.
- for r := rune(0); r <= unicode.MaxRune; r++ {
- // Note that the return type of lookup is uint8.
- if v, _ := trie.lookupString(string(r)); v != runes[r] {
- fmt.Println("FAILURE")
- return
- }
- }
- fmt.Println("SUCCESS")
-
- // Output:
- // SUCCESS
-}
-
-// runeValues generates some random values for a set of interesting runes.
-func runeValues() map[rune]uint64 {
- rnd := rand.New(rand.NewSource(seed))
- m := map[rune]uint64{}
- for p := 4; p <= unicode.MaxRune; p <<= 1 {
- for d := -1; d <= 1; d++ {
- m[rune(p+d)] = uint64(rnd.Int63())
- }
- }
- return m
-}
-
-// ExampleGen_build demonstrates the creation of multiple tries sharing common
-// blocks. ExampleGen_lookup demonstrates how to use the generated tries.
-func ExampleGen_build() {
- var tries []*triegen.Trie
-
- rv := runeValues()
- for _, c := range []struct {
- include func(rune) bool
- name string
- }{
- {func(r rune) bool { return true }, "all"},
- {func(r rune) bool { return r < 0x80 }, "ASCII only"},
- {func(r rune) bool { return r < 0x80 }, "ASCII only 2"},
- {func(r rune) bool { return r <= 0xFFFF }, "BMP only"},
- {func(r rune) bool { return r > 0xFFFF }, "No BMP"},
- } {
- t := triegen.NewTrie(c.name)
- tries = append(tries, t)
-
- for r, v := range rv {
- if c.include(r) {
- t.Insert(r, v)
- }
- }
- }
- sz, err := triegen.Gen(genWriter, "multi", tries)
-
- fmt.Printf("Trie size: %d bytes\n", sz)
- fmt.Printf("Error: %v\n", err)
-
- // Output:
- // Trie size: 18250 bytes
- // Error: <nil>
-}
-
-// ExampleGen_lookup shows how to look up values in the trie generated by
-// ExampleGen_build.
-func ExampleGen_lookup() {
- rv := runeValues()
- for i, include := range []func(rune) bool{
- func(r rune) bool { return true }, // all
- func(r rune) bool { return r < 0x80 }, // ASCII only
- func(r rune) bool { return r < 0x80 }, // ASCII only 2
- func(r rune) bool { return r <= 0xFFFF }, // BMP only
- func(r rune) bool { return r > 0xFFFF }, // No BMP
- } {
- t := newMultiTrie(i)
-
- for r := rune(0); r <= unicode.MaxRune; r++ {
- x := uint64(0)
- if include(r) {
- x = rv[r]
- }
- // As we convert from a valid rune, we know it is safe to use
- // lookupStringUnsafe.
- if v := t.lookupStringUnsafe(string(r)); x != v {
- fmt.Println("FAILURE")
- return
- }
- }
- }
- fmt.Println("SUCCESS")
-
- // Output:
- // SUCCESS
-}
diff --git a/vendor/golang.org/x/text/internal/triegen/gen_test.go b/vendor/golang.org/x/text/internal/triegen/gen_test.go
deleted file mode 100644
index 831627d7a..000000000
--- a/vendor/golang.org/x/text/internal/triegen/gen_test.go
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build generate
-
-package triegen_test
-
-// The code in this file generates captures and writes the tries generated in
-// the examples to data_test.go. To invoke it, run:
-// go test -tags=generate
-//
-// Making the generation code a "test" allows us to link in the necessary test
-// code.
-
-import (
- "log"
- "os"
- "os/exec"
-)
-
-func init() {
- const tmpfile = "tmpout"
- const dstfile = "data_test.go"
-
- f, err := os.Create(tmpfile)
- if err != nil {
- log.Fatalf("Could not create output file: %v", err)
- }
- defer os.Remove(tmpfile)
- defer f.Close()
-
- // We exit before this function returns, regardless of success or failure,
- // so there's no need to save (and later restore) the existing genWriter
- // value.
- genWriter = f
-
- f.Write([]byte(header))
-
- Example_build()
- ExampleGen_build()
-
- if err := exec.Command("gofmt", "-w", tmpfile).Run(); err != nil {
- log.Fatal(err)
- }
- os.Remove(dstfile)
- os.Rename(tmpfile, dstfile)
-
- os.Exit(0)
-}
-
-const header = `// This file is generated with "go test -tags generate". DO NOT EDIT!
-// +build !generate
-
-package triegen_test
-`
-
-// Stubs for generated tries. These are needed as we exclude data_test.go if
-// the generate flag is set. This will clearly make the tests fail, but that
-// is okay. It allows us to bootstrap.
-
-type trie struct{}
-
-func (t *trie) lookupString(string) (uint8, int) { return 0, 1 }
-func (t *trie) lookupStringUnsafe(string) uint64 { return 0 }
-
-func newRandTrie(i int) *trie { return &trie{} }
-func newMultiTrie(i int) *trie { return &trie{} }
diff --git a/vendor/golang.org/x/text/internal/ucd/example_test.go b/vendor/golang.org/x/text/internal/ucd/example_test.go
deleted file mode 100644
index 338a50d1c..000000000
--- a/vendor/golang.org/x/text/internal/ucd/example_test.go
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ucd_test
-
-import (
- "fmt"
- "strings"
-
- "golang.org/x/text/internal/ucd"
-)
-
-func Example() {
- // Read rune-by-rune from UnicodeData.
- var count int
- p := ucd.New(strings.NewReader(unicodeData))
- for p.Next() {
- count++
- if lower := p.Runes(ucd.SimpleLowercaseMapping); lower != nil {
- fmt.Printf("lower(%U) -> %U\n", p.Rune(0), lower[0])
- }
- }
- if err := p.Err(); err != nil {
- fmt.Println(err)
- }
- fmt.Println("Number of runes visited:", count)
-
- // Read raw ranges from Scripts.
- p = ucd.New(strings.NewReader(scripts), ucd.KeepRanges)
- for p.Next() {
- start, end := p.Range(0)
- fmt.Printf("%04X..%04X: %s\n", start, end, p.String(1))
- }
- if err := p.Err(); err != nil {
- fmt.Println(err)
- }
-
- // Output:
- // lower(U+00C0) -> U+00E0
- // lower(U+00C1) -> U+00E1
- // lower(U+00C2) -> U+00E2
- // lower(U+00C3) -> U+00E3
- // lower(U+00C4) -> U+00E4
- // Number of runes visited: 6594
- // 0000..001F: Common
- // 0020..0020: Common
- // 0021..0023: Common
- // 0024..0024: Common
-}
-
-// Excerpt from UnicodeData.txt
-const unicodeData = `
-00B9;SUPERSCRIPT ONE;No;0;EN;<super> 0031;;1;1;N;SUPERSCRIPT DIGIT ONE;;;;
-00BA;MASCULINE ORDINAL INDICATOR;Lo;0;L;<super> 006F;;;;N;;;;;
-00BB;RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK;Pf;0;ON;;;;;Y;RIGHT POINTING GUILLEMET;;;;
-00BC;VULGAR FRACTION ONE QUARTER;No;0;ON;<fraction> 0031 2044 0034;;;1/4;N;FRACTION ONE QUARTER;;;;
-00BD;VULGAR FRACTION ONE HALF;No;0;ON;<fraction> 0031 2044 0032;;;1/2;N;FRACTION ONE HALF;;;;
-00BE;VULGAR FRACTION THREE QUARTERS;No;0;ON;<fraction> 0033 2044 0034;;;3/4;N;FRACTION THREE QUARTERS;;;;
-00BF;INVERTED QUESTION MARK;Po;0;ON;;;;;N;;;;;
-00C0;LATIN CAPITAL LETTER A WITH GRAVE;Lu;0;L;0041 0300;;;;N;LATIN CAPITAL LETTER A GRAVE;;;00E0;
-00C1;LATIN CAPITAL LETTER A WITH ACUTE;Lu;0;L;0041 0301;;;;N;LATIN CAPITAL LETTER A ACUTE;;;00E1;
-00C2;LATIN CAPITAL LETTER A WITH CIRCUMFLEX;Lu;0;L;0041 0302;;;;N;LATIN CAPITAL LETTER A CIRCUMFLEX;;;00E2;
-00C3;LATIN CAPITAL LETTER A WITH TILDE;Lu;0;L;0041 0303;;;;N;LATIN CAPITAL LETTER A TILDE;;;00E3;
-00C4;LATIN CAPITAL LETTER A WITH DIAERESIS;Lu;0;L;0041 0308;;;;N;LATIN CAPITAL LETTER A DIAERESIS;;;00E4;
-
-# A legacy rune range.
-3400;<CJK Ideograph Extension A, First>;Lo;0;L;;;;;N;;;;;
-4DB5;<CJK Ideograph Extension A, Last>;Lo;0;L;;;;;N;;;;;
-`
-
-// Excerpt from Scripts.txt
-const scripts = `
-# Property: Script
-# ================================================
-
-0000..001F ; Common # Cc [32] <control-0000>..<control-001F>
-0020 ; Common # Zs SPACE
-0021..0023 ; Common # Po [3] EXCLAMATION MARK..NUMBER SIGN
-0024 ; Common # Sc DOLLAR SIGN
-`
diff --git a/vendor/golang.org/x/text/internal/ucd/ucd_test.go b/vendor/golang.org/x/text/internal/ucd/ucd_test.go
deleted file mode 100644
index 11a6542e4..000000000
--- a/vendor/golang.org/x/text/internal/ucd/ucd_test.go
+++ /dev/null
@@ -1,105 +0,0 @@
-package ucd
-
-import (
- "strings"
- "testing"
-)
-
-const file = `
-# Comments should be skipped
-# rune; bool; uint; int; float; runes; # Y
-0..0005; Y; 0; 2; -5.25 ; 0 1 2 3 4 5;
-6..0007; Yes ; 6; 1; -4.25 ; 0006 0007;
-8; T ; 8 ; 0 ;-3.25 ;;# T
-9; True ;9 ; -1;-2.25 ; 0009;
-
-# more comments to be ignored
-@Part0
-
-A; N; 10 ; -2; -1.25; ;# N
-B; No; 11 ; -3; -0.25;
-C; False;12; -4; 0.75;
-D; ;13;-5;1.75;
-
-@Part1 # Another part.
-# We test part comments get removed by not commenting the the next line.
-E..10FFFF; F; 14 ; -6; 2.75;
-`
-
-var want = []struct {
- start, end rune
-}{
- {0x00, 0x05},
- {0x06, 0x07},
- {0x08, 0x08},
- {0x09, 0x09},
- {0x0A, 0x0A},
- {0x0B, 0x0B},
- {0x0C, 0x0C},
- {0x0D, 0x0D},
- {0x0E, 0x10FFFF},
-}
-
-func TestGetters(t *testing.T) {
- parts := [][2]string{
- {"Part0", ""},
- {"Part1", "Another part."},
- }
- handler := func(p *Parser) {
- if len(parts) == 0 {
- t.Error("Part handler invoked too many times.")
- return
- }
- want := parts[0]
- parts = parts[1:]
- if got0, got1 := p.String(0), p.Comment(); got0 != want[0] || got1 != want[1] {
- t.Errorf(`part: got %q, %q; want %q"`, got0, got1, want)
- }
- }
-
- p := New(strings.NewReader(file), KeepRanges, Part(handler))
- for i := 0; p.Next(); i++ {
- start, end := p.Range(0)
- w := want[i]
- if start != w.start || end != w.end {
- t.Fatalf("%d:Range(0); got %#x..%#x; want %#x..%#x", i, start, end, w.start, w.end)
- }
- if w.start == w.end && p.Rune(0) != w.start {
- t.Errorf("%d:Range(0).start: got %U; want %U", i, p.Rune(0), w.start)
- }
- if got, want := p.Bool(1), w.start <= 9; got != want {
- t.Errorf("%d:Bool(1): got %v; want %v", i, got, want)
- }
- if got := p.Rune(4); got != 0 || p.Err() == nil {
- t.Errorf("%d:Rune(%q): got no error; want error", i, p.String(1))
- }
- p.err = nil
- if got := p.Uint(2); rune(got) != start {
- t.Errorf("%d:Uint(2): got %v; want %v", i, got, start)
- }
- if got, want := p.Int(3), 2-i; got != want {
- t.Errorf("%d:Int(3): got %v; want %v", i, got, want)
- }
- if got, want := p.Float(4), -5.25+float64(i); got != want {
- t.Errorf("%d:Int(3): got %v; want %v", i, got, want)
- }
- if got := p.Runes(5); got == nil {
- if p.String(5) != "" {
- t.Errorf("%d:Runes(5): expected non-empty list", i)
- }
- } else {
- if got[0] != start || got[len(got)-1] != end {
- t.Errorf("%d:Runes(5): got %#x; want %#x..%#x", i, got, start, end)
- }
- }
- if got := p.Comment(); got != "" && got != p.String(1) {
- t.Errorf("%d:Comment(): got %v; want %v", i, got, p.String(1))
- }
- }
- if err := p.Err(); err != nil {
- t.Errorf("Parser error: %v", err)
- }
- if len(parts) != 0 {
- t.Errorf("expected %d more invocations of part handler", len(parts))
- }
-}
diff --git a/vendor/golang.org/x/text/language/coverage_test.go b/vendor/golang.org/x/text/language/coverage_test.go
deleted file mode 100644
index 8e08e5ca4..000000000
--- a/vendor/golang.org/x/text/language/coverage_test.go
+++ /dev/null
@@ -1,154 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package language
-
-import (
- "fmt"
- "reflect"
- "testing"
-)
-
-func TestSupported(t *testing.T) {
- // To prove the results are correct for a type, we test that the number of
- // results is identical to the number of results on record, that all results
- // are distinct and that all results are valid.
- tests := map[string]int{
- "BaseLanguages": numLanguages,
- "Scripts": numScripts,
- "Regions": numRegions,
- "Tags": 0,
- }
- sup := reflect.ValueOf(Supported)
- for name, num := range tests {
- v := sup.MethodByName(name).Call(nil)[0]
- if n := v.Len(); n != num {
- t.Errorf("len(%s()) was %d; want %d", name, n, num)
- }
- dup := make(map[string]bool)
- for i := 0; i < v.Len(); i++ {
- x := v.Index(i).Interface()
- // An invalid value will either cause a crash or result in a
- // duplicate when passed to Sprint.
- s := fmt.Sprint(x)
- if dup[s] {
- t.Errorf("%s: duplicate entry %q", name, s)
- }
- dup[s] = true
- }
- if len(dup) != v.Len() {
- t.Errorf("%s: # unique entries was %d; want %d", name, len(dup), v.Len())
- }
- }
-}
-
-func TestNewCoverage(t *testing.T) {
- bases := []Base{Base{0}, Base{3}, Base{7}}
- scripts := []Script{Script{11}, Script{17}, Script{23}}
- regions := []Region{Region{101}, Region{103}, Region{107}}
- tags := []Tag{Make("pt"), Make("en"), Make("en-GB"), Make("en-US"), Make("pt-PT")}
- fbases := func() []Base { return bases }
- fscripts := func() []Script { return scripts }
- fregions := func() []Region { return regions }
- ftags := func() []Tag { return tags }
-
- tests := []struct {
- desc string
- list []interface{}
- bases []Base
- scripts []Script
- regions []Region
- tags []Tag
- }{
- {
- desc: "empty",
- },
- {
- desc: "bases",
- list: []interface{}{bases},
- bases: bases,
- },
- {
- desc: "scripts",
- list: []interface{}{scripts},
- scripts: scripts,
- },
- {
- desc: "regions",
- list: []interface{}{regions},
- regions: regions,
- },
- {
- desc: "bases derives from tags",
- list: []interface{}{tags},
- bases: []Base{Base{_en}, Base{_pt}},
- tags: tags,
- },
- {
- desc: "tags and bases",
- list: []interface{}{tags, bases},
- bases: bases,
- tags: tags,
- },
- {
- desc: "fully specified",
- list: []interface{}{tags, bases, scripts, regions},
- bases: bases,
- scripts: scripts,
- regions: regions,
- tags: tags,
- },
- {
- desc: "bases func",
- list: []interface{}{fbases},
- bases: bases,
- },
- {
- desc: "scripts func",
- list: []interface{}{fscripts},
- scripts: scripts,
- },
- {
- desc: "regions func",
- list: []interface{}{fregions},
- regions: regions,
- },
- {
- desc: "tags func",
- list: []interface{}{ftags},
- bases: []Base{Base{_en}, Base{_pt}},
- tags: tags,
- },
- {
- desc: "tags and bases",
- list: []interface{}{ftags, fbases},
- bases: bases,
- tags: tags,
- },
- {
- desc: "fully specified",
- list: []interface{}{ftags, fbases, fscripts, fregions},
- bases: bases,
- scripts: scripts,
- regions: regions,
- tags: tags,
- },
- }
-
- for i, tt := range tests {
- l := NewCoverage(tt.list...)
- if a := l.BaseLanguages(); !reflect.DeepEqual(a, tt.bases) {
- t.Errorf("%d:%s: BaseLanguages was %v; want %v", i, tt.desc, a, tt.bases)
- }
- if a := l.Scripts(); !reflect.DeepEqual(a, tt.scripts) {
- t.Errorf("%d:%s: Scripts was %v; want %v", i, tt.desc, a, tt.scripts)
- }
- if a := l.Regions(); !reflect.DeepEqual(a, tt.regions) {
- t.Errorf("%d:%s: Regions was %v; want %v", i, tt.desc, a, tt.regions)
- }
- if a := l.Tags(); !reflect.DeepEqual(a, tt.tags) {
- t.Errorf("%d:%s: Tags was %v; want %v", i, tt.desc, a, tt.tags)
- }
- }
-}
diff --git a/vendor/golang.org/x/text/language/examples_test.go b/vendor/golang.org/x/text/language/examples_test.go
deleted file mode 100644
index d5e8176dc..000000000
--- a/vendor/golang.org/x/text/language/examples_test.go
+++ /dev/null
@@ -1,413 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package language_test
-
-import (
- "fmt"
- "net/http"
-
- "golang.org/x/text/language"
-)
-
-func ExampleCanonType() {
- p := func(id string) {
- fmt.Printf("Default(%s) -> %s\n", id, language.Make(id))
- fmt.Printf("BCP47(%s) -> %s\n", id, language.BCP47.Make(id))
- fmt.Printf("Macro(%s) -> %s\n", id, language.Macro.Make(id))
- fmt.Printf("All(%s) -> %s\n", id, language.All.Make(id))
- }
- p("en-Latn")
- p("sh")
- p("zh-cmn")
- p("bjd")
- p("iw-Latn-fonipa-u-cu-usd")
- // Output:
- // Default(en-Latn) -> en-Latn
- // BCP47(en-Latn) -> en
- // Macro(en-Latn) -> en-Latn
- // All(en-Latn) -> en
- // Default(sh) -> sr-Latn
- // BCP47(sh) -> sh
- // Macro(sh) -> sh
- // All(sh) -> sr-Latn
- // Default(zh-cmn) -> cmn
- // BCP47(zh-cmn) -> cmn
- // Macro(zh-cmn) -> zh
- // All(zh-cmn) -> zh
- // Default(bjd) -> drl
- // BCP47(bjd) -> drl
- // Macro(bjd) -> bjd
- // All(bjd) -> drl
- // Default(iw-Latn-fonipa-u-cu-usd) -> he-Latn-fonipa-u-cu-usd
- // BCP47(iw-Latn-fonipa-u-cu-usd) -> he-Latn-fonipa-u-cu-usd
- // Macro(iw-Latn-fonipa-u-cu-usd) -> iw-Latn-fonipa-u-cu-usd
- // All(iw-Latn-fonipa-u-cu-usd) -> he-Latn-fonipa-u-cu-usd
-}
-
-func ExampleTag_Base() {
- fmt.Println(language.Make("und").Base())
- fmt.Println(language.Make("und-US").Base())
- fmt.Println(language.Make("und-NL").Base())
- fmt.Println(language.Make("und-419").Base()) // Latin America
- fmt.Println(language.Make("und-ZZ").Base())
- // Output:
- // en Low
- // en High
- // nl High
- // es Low
- // en Low
-}
-
-func ExampleTag_Script() {
- en := language.Make("en")
- sr := language.Make("sr")
- sr_Latn := language.Make("sr_Latn")
- fmt.Println(en.Script())
- fmt.Println(sr.Script())
- // Was a script explicitly specified?
- _, c := sr.Script()
- fmt.Println(c == language.Exact)
- _, c = sr_Latn.Script()
- fmt.Println(c == language.Exact)
- // Output:
- // Latn High
- // Cyrl Low
- // false
- // true
-}
-
-func ExampleTag_Region() {
- ru := language.Make("ru")
- en := language.Make("en")
- fmt.Println(ru.Region())
- fmt.Println(en.Region())
- // Output:
- // RU Low
- // US Low
-}
-
-func ExampleRegion_TLD() {
- us := language.MustParseRegion("US")
- gb := language.MustParseRegion("GB")
- uk := language.MustParseRegion("UK")
- bu := language.MustParseRegion("BU")
-
- fmt.Println(us.TLD())
- fmt.Println(gb.TLD())
- fmt.Println(uk.TLD())
- fmt.Println(bu.TLD())
-
- fmt.Println(us.Canonicalize().TLD())
- fmt.Println(gb.Canonicalize().TLD())
- fmt.Println(uk.Canonicalize().TLD())
- fmt.Println(bu.Canonicalize().TLD())
- // Output:
- // US <nil>
- // UK <nil>
- // UK <nil>
- // ZZ language: region is not a valid ccTLD
- // US <nil>
- // UK <nil>
- // UK <nil>
- // MM <nil>
-}
-
-func ExampleCompose() {
- nl, _ := language.ParseBase("nl")
- us, _ := language.ParseRegion("US")
- de := language.Make("de-1901-u-co-phonebk")
- jp := language.Make("ja-JP")
- fi := language.Make("fi-x-ing")
-
- u, _ := language.ParseExtension("u-nu-arabic")
- x, _ := language.ParseExtension("x-piglatin")
-
- // Combine a base language and region.
- fmt.Println(language.Compose(nl, us))
- // Combine a base language and extension.
- fmt.Println(language.Compose(nl, x))
- // Replace the region.
- fmt.Println(language.Compose(jp, us))
- // Combine several tags.
- fmt.Println(language.Compose(us, nl, u))
-
- // Replace the base language of a tag.
- fmt.Println(language.Compose(de, nl))
- fmt.Println(language.Compose(de, nl, u))
- // Remove the base language.
- fmt.Println(language.Compose(de, language.Base{}))
- // Remove all variants.
- fmt.Println(language.Compose(de, []language.Variant{}))
- // Remove all extensions.
- fmt.Println(language.Compose(de, []language.Extension{}))
- fmt.Println(language.Compose(fi, []language.Extension{}))
- // Remove all variants and extensions.
- fmt.Println(language.Compose(de.Raw()))
-
- // An error is gobbled or returned if non-nil.
- fmt.Println(language.Compose(language.ParseRegion("ZA")))
- fmt.Println(language.Compose(language.ParseRegion("HH")))
-
- // Compose uses the same Default canonicalization as Make.
- fmt.Println(language.Compose(language.Raw.Parse("en-Latn-UK")))
-
- // Call compose on a different CanonType for different results.
- fmt.Println(language.All.Compose(language.Raw.Parse("en-Latn-UK")))
-
- // Output:
- // nl-US <nil>
- // nl-x-piglatin <nil>
- // ja-US <nil>
- // nl-US-u-nu-arabic <nil>
- // nl-1901-u-co-phonebk <nil>
- // nl-1901-u-nu-arabic <nil>
- // und-1901-u-co-phonebk <nil>
- // de-u-co-phonebk <nil>
- // de-1901 <nil>
- // fi <nil>
- // de <nil>
- // und-ZA <nil>
- // und language: subtag "HH" is well-formed but unknown
- // en-Latn-GB <nil>
- // en-GB <nil>
-}
-
-func ExampleParse_errors() {
- for _, s := range []string{"Foo", "Bar", "Foobar"} {
- _, err := language.Parse(s)
- if err != nil {
- if inv, ok := err.(language.ValueError); ok {
- fmt.Println(inv.Subtag())
- } else {
- fmt.Println(s)
- }
- }
- }
- for _, s := range []string{"en", "aa-Uuuu", "AC", "ac-u"} {
- _, err := language.Parse(s)
- switch e := err.(type) {
- case language.ValueError:
- fmt.Printf("%s: culprit %q\n", s, e.Subtag())
- case nil:
- // No error.
- default:
- // A syntax error.
- fmt.Printf("%s: ill-formed\n", s)
- }
- }
- // Output:
- // foo
- // Foobar
- // aa-Uuuu: culprit "Uuuu"
- // AC: culprit "ac"
- // ac-u: ill-formed
-}
-
-func ExampleParent() {
- p := func(tag string) {
- fmt.Printf("parent(%v): %v\n", tag, language.Make(tag).Parent())
- }
- p("zh-CN")
-
- // Australian English inherits from World English.
- p("en-AU")
-
- // If the tag has a different maximized script from its parent, a tag with
- // this maximized script is inserted. This allows different language tags
- // which have the same base language and script in common to inherit from
- // a common set of settings.
- p("zh-HK")
-
- // If the maximized script of the parent is not identical, CLDR will skip
- // inheriting from it, as it means there will not be many entries in common
- // and inheriting from it is nonsensical.
- p("zh-Hant")
-
- // The parent of a tag with variants and extensions is the tag with all
- // variants and extensions removed.
- p("de-1994-u-co-phonebk")
-
- // Remove default script.
- p("de-Latn-LU")
-
- // Output:
- // parent(zh-CN): zh
- // parent(en-AU): en-001
- // parent(zh-HK): zh-Hant
- // parent(zh-Hant): und
- // parent(de-1994-u-co-phonebk): de
- // parent(de-Latn-LU): de
-}
-
-// ExampleMatcher_bestMatch gives some examples of getting the best match of
-// a set of tags to any of the tags of given set.
-func ExampleMatcher() {
- // This is the set of tags from which we want to pick the best match. These
- // can be, for example, the supported languages for some package.
- tags := []language.Tag{
- language.English,
- language.BritishEnglish,
- language.French,
- language.Afrikaans,
- language.BrazilianPortuguese,
- language.EuropeanPortuguese,
- language.Croatian,
- language.SimplifiedChinese,
- language.Raw.Make("iw-IL"),
- language.Raw.Make("iw"),
- language.Raw.Make("he"),
- }
- m := language.NewMatcher(tags)
-
- // A simple match.
- fmt.Println(m.Match(language.Make("fr")))
-
- // Australian English is closer to British than American English.
- fmt.Println(m.Match(language.Make("en-AU")))
-
- // Default to the first tag passed to the Matcher if there is no match.
- fmt.Println(m.Match(language.Make("ar")))
-
- // Get the default tag.
- fmt.Println(m.Match())
-
- fmt.Println("----")
-
- // Someone specifying sr-Latn is probably fine with getting Croatian.
- fmt.Println(m.Match(language.Make("sr-Latn")))
-
- // We match SimplifiedChinese, but with Low confidence.
- fmt.Println(m.Match(language.TraditionalChinese))
-
- // Serbian in Latin script is a closer match to Croatian than Traditional
- // Chinese to Simplified Chinese.
- fmt.Println(m.Match(language.TraditionalChinese, language.Make("sr-Latn")))
-
- fmt.Println("----")
-
- // In case a multiple variants of a language are available, the most spoken
- // variant is typically returned.
- fmt.Println(m.Match(language.Portuguese))
-
- // Pick the first value passed to Match in case of a tie.
- fmt.Println(m.Match(language.Dutch, language.Make("fr-BE"), language.Make("af-NA")))
- fmt.Println(m.Match(language.Dutch, language.Make("af-NA"), language.Make("fr-BE")))
-
- fmt.Println("----")
-
- // If a Matcher is initialized with a language and it's deprecated version,
- // it will distinguish between them.
- fmt.Println(m.Match(language.Raw.Make("iw")))
-
- // However, for non-exact matches, it will treat deprecated versions as
- // equivalent and consider other factors first.
- fmt.Println(m.Match(language.Raw.Make("he-IL")))
-
- fmt.Println("----")
-
- // User settings passed to the Unicode extension are ignored for matching
- // and preserved in the returned tag.
- fmt.Println(m.Match(language.Make("de-u-co-phonebk"), language.Make("fr-u-cu-frf")))
-
- // Even if the matching language is different.
- fmt.Println(m.Match(language.Make("de-u-co-phonebk"), language.Make("br-u-cu-frf")))
-
- // If there is no matching language, the options of the first preferred tag are used.
- fmt.Println(m.Match(language.Make("de-u-co-phonebk")))
-
- // Output:
- // fr 2 Exact
- // en-GB 1 High
- // en 0 No
- // en 0 No
- // ----
- // hr 6 High
- // zh-Hans 7 Low
- // hr 6 High
- // ----
- // pt-BR 4 High
- // fr 2 High
- // af 3 High
- // ----
- // iw 9 Exact
- // he 10 Exact
- // ----
- // fr-u-cu-frf 2 Exact
- // fr-u-cu-frf 2 High
- // en-u-co-phonebk 0 No
-
- // TODO: "he" should be "he-u-rg-IL High"
-}
-
-func ExampleMatchStrings() {
- // languages supported by this service:
- matcher := language.NewMatcher([]language.Tag{
- language.English, language.Dutch, language.German,
- })
-
- http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
- lang, _ := r.Cookie("lang")
- tag, _ := language.MatchStrings(matcher, lang.String(), r.Header.Get("Accept-Language"))
-
- fmt.Println("User language:", tag)
- })
-}
-
-func ExampleComprehends() {
- // Various levels of comprehensibility.
- fmt.Println(language.Comprehends(language.English, language.English))
- fmt.Println(language.Comprehends(language.AmericanEnglish, language.BritishEnglish))
-
- // An explicit Und results in no match.
- fmt.Println(language.Comprehends(language.English, language.Und))
-
- fmt.Println("----")
-
- // There is usually no mutual comprehensibility between different scripts.
- fmt.Println(language.Comprehends(language.Make("en-Dsrt"), language.English))
-
- // One exception is for Traditional versus Simplified Chinese, albeit with
- // a low confidence.
- fmt.Println(language.Comprehends(language.TraditionalChinese, language.SimplifiedChinese))
-
- fmt.Println("----")
-
- // A Swiss German speaker will often understand High German.
- fmt.Println(language.Comprehends(language.Make("gsw"), language.Make("de")))
-
- // The converse is not generally the case.
- fmt.Println(language.Comprehends(language.Make("de"), language.Make("gsw")))
-
- // Output:
- // Exact
- // High
- // No
- // ----
- // No
- // Low
- // ----
- // High
- // No
-}
-
-func ExampleTag_values() {
- us := language.MustParseRegion("US")
- en := language.MustParseBase("en")
-
- lang, _, region := language.AmericanEnglish.Raw()
- fmt.Println(lang == en, region == us)
-
- lang, _, region = language.BritishEnglish.Raw()
- fmt.Println(lang == en, region == us)
-
- // Tags can be compared for exact equivalence using '=='.
- en_us, _ := language.Compose(en, us)
- fmt.Println(en_us == language.AmericanEnglish)
-
- // Output:
- // true true
- // true false
- // true
-}
diff --git a/vendor/golang.org/x/text/language/httpexample_test.go b/vendor/golang.org/x/text/language/httpexample_test.go
deleted file mode 100644
index 40d0663c8..000000000
--- a/vendor/golang.org/x/text/language/httpexample_test.go
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package language_test
-
-import (
- "fmt"
- "net/http"
- "strings"
-
- "golang.org/x/text/language"
-)
-
-// matcher is a language.Matcher configured for all supported languages.
-var matcher = language.NewMatcher([]language.Tag{
- language.BritishEnglish,
- language.Norwegian,
- language.German,
-})
-
-// handler is a http.HandlerFunc.
-func handler(w http.ResponseWriter, r *http.Request) {
- t, q, err := language.ParseAcceptLanguage(r.Header.Get("Accept-Language"))
- // We ignore the error: the default language will be selected for t == nil.
- tag, _, _ := matcher.Match(t...)
- fmt.Printf("%5v (t: %6v; q: %3v; err: %v)\n", tag, t, q, err)
-}
-
-func ExampleParseAcceptLanguage() {
- for _, al := range []string{
- "nn;q=0.3, en-us;q=0.8, en,",
- "gsw, en;q=0.7, en-US;q=0.8",
- "gsw, nl, da",
- "invalid",
- } {
- // Create dummy request with Accept-Language set and pass it to handler.
- r, _ := http.NewRequest("GET", "example.com", strings.NewReader("Hello"))
- r.Header.Set("Accept-Language", al)
- handler(nil, r)
- }
-
- // Output:
- // en-GB (t: [ en en-US nn]; q: [ 1 0.8 0.3]; err: <nil>)
- // en-GB (t: [ gsw en-US en]; q: [ 1 0.8 0.7]; err: <nil>)
- // de (t: [ gsw nl da]; q: [ 1 1 1]; err: <nil>)
- // en-GB (t: []; q: []; err: language: tag is not well-formed)
-}
diff --git a/vendor/golang.org/x/text/language/language_test.go b/vendor/golang.org/x/text/language/language_test.go
deleted file mode 100644
index 9e42d15dc..000000000
--- a/vendor/golang.org/x/text/language/language_test.go
+++ /dev/null
@@ -1,911 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package language
-
-import (
- "reflect"
- "testing"
-
- "golang.org/x/text/internal/testtext"
-)
-
-func TestTagSize(t *testing.T) {
- id := Tag{}
- typ := reflect.TypeOf(id)
- if typ.Size() > 24 {
- t.Errorf("size of Tag was %d; want 24", typ.Size())
- }
-}
-
-func TestIsRoot(t *testing.T) {
- loc := Tag{}
- if !loc.IsRoot() {
- t.Errorf("unspecified should be root.")
- }
- for i, tt := range parseTests() {
- loc, _ := Parse(tt.in)
- undef := tt.lang == "und" && tt.script == "" && tt.region == "" && tt.ext == ""
- if loc.IsRoot() != undef {
- t.Errorf("%d: was %v; want %v", i, loc.IsRoot(), undef)
- }
- }
-}
-
-func TestEquality(t *testing.T) {
- for i, tt := range parseTests()[48:49] {
- s := tt.in
- tag := Make(s)
- t1 := Make(tag.String())
- if tag != t1 {
- t.Errorf("%d:%s: equality test 1 failed\n got: %#v\nwant: %#v)", i, s, t1, tag)
- }
- t2, _ := Compose(tag)
- if tag != t2 {
- t.Errorf("%d:%s: equality test 2 failed\n got: %#v\nwant: %#v", i, s, t2, tag)
- }
- }
-}
-
-func TestMakeString(t *testing.T) {
- tests := []struct{ in, out string }{
- {"und", "und"},
- {"und", "und-CW"},
- {"nl", "nl-NL"},
- {"de-1901", "nl-1901"},
- {"de-1901", "de-Arab-1901"},
- {"x-a-b", "de-Arab-x-a-b"},
- {"x-a-b", "x-a-b"},
- }
- for i, tt := range tests {
- id, _ := Parse(tt.in)
- mod, _ := Parse(tt.out)
- id.setTagsFrom(mod)
- for j := 0; j < 2; j++ {
- id.remakeString()
- if str := id.String(); str != tt.out {
- t.Errorf("%d:%d: found %s; want %s", i, j, id.String(), tt.out)
- }
- }
- // The bytes to string conversion as used in remakeString
- // occasionally measures as more than one alloc, breaking this test.
- // To alleviate this we set the number of runs to more than 1.
- if n := testtext.AllocsPerRun(8, id.remakeString); n > 1 {
- t.Errorf("%d: # allocs got %.1f; want <= 1", i, n)
- }
- }
-}
-
-func TestCompactIndex(t *testing.T) {
- tests := []struct {
- tag string
- index int
- ok bool
- }{
- // TODO: these values will change with each CLDR update. This issue
- // will be solved if we decide to fix the indexes.
- {"und", 0, true},
- {"ca-ES-valencia", 1, true},
- {"ca-ES-valencia-u-va-posix", 0, false},
- {"ca-ES-valencia-u-co-phonebk", 1, true},
- {"ca-ES-valencia-u-co-phonebk-va-posix", 0, false},
- {"x-klingon", 0, false},
- {"en-US", 232, true},
- {"en-US-u-va-posix", 2, true},
- {"en", 136, true},
- {"en-u-co-phonebk", 136, true},
- {"en-001", 137, true},
- {"sh", 0, false}, // We don't normalize.
- }
- for _, tt := range tests {
- x, ok := CompactIndex(Raw.MustParse(tt.tag))
- if x != tt.index || ok != tt.ok {
- t.Errorf("%s: got %d, %v; want %d %v", tt.tag, x, ok, tt.index, tt.ok)
- }
- }
-}
-
-func TestMarshal(t *testing.T) {
- testCases := []string{
- // TODO: these values will change with each CLDR update. This issue
- // will be solved if we decide to fix the indexes.
- "und",
- "ca-ES-valencia",
- "ca-ES-valencia-u-va-posix",
- "ca-ES-valencia-u-co-phonebk",
- "ca-ES-valencia-u-co-phonebk-va-posix",
- "x-klingon",
- "en-US",
- "en-US-u-va-posix",
- "en",
- "en-u-co-phonebk",
- "en-001",
- "sh",
- }
- for _, tc := range testCases {
- var tag Tag
- err := tag.UnmarshalText([]byte(tc))
- if err != nil {
- t.Errorf("UnmarshalText(%q): unexpected error: %v", tc, err)
- }
- b, err := tag.MarshalText()
- if err != nil {
- t.Errorf("MarshalText(%q): unexpected error: %v", tc, err)
- }
- if got := string(b); got != tc {
- t.Errorf("%s: got %q; want %q", tc, got, tc)
- }
- }
-}
-
-func TestBase(t *testing.T) {
- tests := []struct {
- loc, lang string
- conf Confidence
- }{
- {"und", "en", Low},
- {"x-abc", "und", No},
- {"en", "en", Exact},
- {"und-Cyrl", "ru", High},
- // If a region is not included, the official language should be English.
- {"und-US", "en", High},
- // TODO: not-explicitly listed scripts should probably be und, No
- // Modify addTags to return info on how the match was derived.
- // {"und-Aghb", "und", No},
- }
- for i, tt := range tests {
- loc, _ := Parse(tt.loc)
- lang, conf := loc.Base()
- if lang.String() != tt.lang {
- t.Errorf("%d: language was %s; want %s", i, lang, tt.lang)
- }
- if conf != tt.conf {
- t.Errorf("%d: confidence was %d; want %d", i, conf, tt.conf)
- }
- }
-}
-
-func TestParseBase(t *testing.T) {
- tests := []struct {
- in string
- out string
- ok bool
- }{
- {"en", "en", true},
- {"EN", "en", true},
- {"nld", "nl", true},
- {"dut", "dut", true}, // bibliographic
- {"aaj", "und", false}, // unknown
- {"qaa", "qaa", true},
- {"a", "und", false},
- {"", "und", false},
- {"aaaa", "und", false},
- }
- for i, tt := range tests {
- x, err := ParseBase(tt.in)
- if x.String() != tt.out || err == nil != tt.ok {
- t.Errorf("%d:%s: was %s, %v; want %s, %v", i, tt.in, x, err == nil, tt.out, tt.ok)
- }
- if y, _, _ := Raw.Make(tt.out).Raw(); x != y {
- t.Errorf("%d:%s: tag was %s; want %s", i, tt.in, x, y)
- }
- }
-}
-
-func TestScript(t *testing.T) {
- tests := []struct {
- loc, scr string
- conf Confidence
- }{
- {"und", "Latn", Low},
- {"en-Latn", "Latn", Exact},
- {"en", "Latn", High},
- {"sr", "Cyrl", Low},
- {"kk", "Cyrl", High},
- {"kk-CN", "Arab", Low},
- {"cmn", "Hans", Low},
- {"ru", "Cyrl", High},
- {"ru-RU", "Cyrl", High},
- {"yue", "Hant", Low},
- {"x-abc", "Zzzz", Low},
- {"und-zyyy", "Zyyy", Exact},
- }
- for i, tt := range tests {
- loc, _ := Parse(tt.loc)
- sc, conf := loc.Script()
- if sc.String() != tt.scr {
- t.Errorf("%d:%s: script was %s; want %s", i, tt.loc, sc, tt.scr)
- }
- if conf != tt.conf {
- t.Errorf("%d:%s: confidence was %d; want %d", i, tt.loc, conf, tt.conf)
- }
- }
-}
-
-func TestParseScript(t *testing.T) {
- tests := []struct {
- in string
- out string
- ok bool
- }{
- {"Latn", "Latn", true},
- {"zzzz", "Zzzz", true},
- {"zyyy", "Zyyy", true},
- {"Latm", "Zzzz", false},
- {"Zzz", "Zzzz", false},
- {"", "Zzzz", false},
- {"Zzzxx", "Zzzz", false},
- }
- for i, tt := range tests {
- x, err := ParseScript(tt.in)
- if x.String() != tt.out || err == nil != tt.ok {
- t.Errorf("%d:%s: was %s, %v; want %s, %v", i, tt.in, x, err == nil, tt.out, tt.ok)
- }
- if err == nil {
- if _, y, _ := Raw.Make("und-" + tt.out).Raw(); x != y {
- t.Errorf("%d:%s: tag was %s; want %s", i, tt.in, x, y)
- }
- }
- }
-}
-
-func TestRegion(t *testing.T) {
- tests := []struct {
- loc, reg string
- conf Confidence
- }{
- {"und", "US", Low},
- {"en", "US", Low},
- {"zh-Hant", "TW", Low},
- {"en-US", "US", Exact},
- {"cmn", "CN", Low},
- {"ru", "RU", Low},
- {"yue", "HK", Low},
- {"x-abc", "ZZ", Low},
- }
- for i, tt := range tests {
- loc, _ := Raw.Parse(tt.loc)
- reg, conf := loc.Region()
- if reg.String() != tt.reg {
- t.Errorf("%d:%s: region was %s; want %s", i, tt.loc, reg, tt.reg)
- }
- if conf != tt.conf {
- t.Errorf("%d:%s: confidence was %d; want %d", i, tt.loc, conf, tt.conf)
- }
- }
-}
-
-func TestEncodeM49(t *testing.T) {
- tests := []struct {
- m49 int
- code string
- ok bool
- }{
- {1, "001", true},
- {840, "US", true},
- {899, "ZZ", false},
- }
- for i, tt := range tests {
- if r, err := EncodeM49(tt.m49); r.String() != tt.code || err == nil != tt.ok {
- t.Errorf("%d:%d: was %s, %v; want %s, %v", i, tt.m49, r, err == nil, tt.code, tt.ok)
- }
- }
- for i := 1; i <= 1000; i++ {
- if r, err := EncodeM49(i); err == nil && r.M49() == 0 {
- t.Errorf("%d has no error, but maps to undefined region", i)
- }
- }
-}
-
-func TestParseRegion(t *testing.T) {
- tests := []struct {
- in string
- out string
- ok bool
- }{
- {"001", "001", true},
- {"840", "US", true},
- {"899", "ZZ", false},
- {"USA", "US", true},
- {"US", "US", true},
- {"BC", "ZZ", false},
- {"C", "ZZ", false},
- {"CCCC", "ZZ", false},
- {"01", "ZZ", false},
- }
- for i, tt := range tests {
- r, err := ParseRegion(tt.in)
- if r.String() != tt.out || err == nil != tt.ok {
- t.Errorf("%d:%s: was %s, %v; want %s, %v", i, tt.in, r, err == nil, tt.out, tt.ok)
- }
- if err == nil {
- if _, _, y := Raw.Make("und-" + tt.out).Raw(); r != y {
- t.Errorf("%d:%s: tag was %s; want %s", i, tt.in, r, y)
- }
- }
- }
-}
-
-func TestIsCountry(t *testing.T) {
- tests := []struct {
- reg string
- country bool
- }{
- {"US", true},
- {"001", false},
- {"958", false},
- {"419", false},
- {"203", true},
- {"020", true},
- {"900", false},
- {"999", false},
- {"QO", false},
- {"EU", false},
- {"AA", false},
- {"XK", true},
- }
- for i, tt := range tests {
- reg, _ := getRegionID([]byte(tt.reg))
- r := Region{reg}
- if r.IsCountry() != tt.country {
- t.Errorf("%d: IsCountry(%s) was %v; want %v", i, tt.reg, r.IsCountry(), tt.country)
- }
- }
-}
-
-func TestIsGroup(t *testing.T) {
- tests := []struct {
- reg string
- group bool
- }{
- {"US", false},
- {"001", true},
- {"958", false},
- {"419", true},
- {"203", false},
- {"020", false},
- {"900", false},
- {"999", false},
- {"QO", true},
- {"EU", true},
- {"AA", false},
- {"XK", false},
- }
- for i, tt := range tests {
- reg, _ := getRegionID([]byte(tt.reg))
- r := Region{reg}
- if r.IsGroup() != tt.group {
- t.Errorf("%d: IsGroup(%s) was %v; want %v", i, tt.reg, r.IsGroup(), tt.group)
- }
- }
-}
-
-func TestContains(t *testing.T) {
- tests := []struct {
- enclosing, contained string
- contains bool
- }{
- // A region contains itself.
- {"US", "US", true},
- {"001", "001", true},
-
- // Direct containment.
- {"001", "002", true},
- {"039", "XK", true},
- {"150", "XK", true},
- {"EU", "AT", true},
- {"QO", "AQ", true},
-
- // Indirect containemnt.
- {"001", "US", true},
- {"001", "419", true},
- {"001", "013", true},
-
- // No containment.
- {"US", "001", false},
- {"155", "EU", false},
- }
- for i, tt := range tests {
- enc, _ := getRegionID([]byte(tt.enclosing))
- con, _ := getRegionID([]byte(tt.contained))
- r := Region{enc}
- if got := r.Contains(Region{con}); got != tt.contains {
- t.Errorf("%d: %s.Contains(%s) was %v; want %v", i, tt.enclosing, tt.contained, got, tt.contains)
- }
- }
-}
-
-func TestRegionCanonicalize(t *testing.T) {
- for i, tt := range []struct{ in, out string }{
- {"UK", "GB"},
- {"TP", "TL"},
- {"QU", "EU"},
- {"SU", "SU"},
- {"VD", "VN"},
- {"DD", "DE"},
- } {
- r := MustParseRegion(tt.in)
- want := MustParseRegion(tt.out)
- if got := r.Canonicalize(); got != want {
- t.Errorf("%d: got %v; want %v", i, got, want)
- }
- }
-}
-
-func TestRegionTLD(t *testing.T) {
- for _, tt := range []struct {
- in, out string
- ok bool
- }{
- {"EH", "EH", true},
- {"FR", "FR", true},
- {"TL", "TL", true},
-
- // In ccTLD before in ISO.
- {"GG", "GG", true},
-
- // Non-standard assignment of ccTLD to ISO code.
- {"GB", "UK", true},
-
- // Exceptionally reserved in ISO and valid ccTLD.
- {"UK", "UK", true},
- {"AC", "AC", true},
- {"EU", "EU", true},
- {"SU", "SU", true},
-
- // Exceptionally reserved in ISO and invalid ccTLD.
- {"CP", "ZZ", false},
- {"DG", "ZZ", false},
- {"EA", "ZZ", false},
- {"FX", "ZZ", false},
- {"IC", "ZZ", false},
- {"TA", "ZZ", false},
-
- // Transitionally reserved in ISO (e.g. deprecated) but valid ccTLD as
- // it is still being phased out.
- {"AN", "AN", true},
- {"TP", "TP", true},
-
- // Transitionally reserved in ISO (e.g. deprecated) and invalid ccTLD.
- // Defined in package language as it has a mapping in CLDR.
- {"BU", "ZZ", false},
- {"CS", "ZZ", false},
- {"NT", "ZZ", false},
- {"YU", "ZZ", false},
- {"ZR", "ZZ", false},
- // Not defined in package: SF.
-
- // Indeterminately reserved in ISO.
- // Defined in package language as it has a legacy mapping in CLDR.
- {"DY", "ZZ", false},
- {"RH", "ZZ", false},
- {"VD", "ZZ", false},
- // Not defined in package: EW, FL, JA, LF, PI, RA, RB, RC, RI, RL, RM,
- // RN, RP, WG, WL, WV, and YV.
-
- // Not assigned in ISO, but legacy definitions in CLDR.
- {"DD", "ZZ", false},
- {"YD", "ZZ", false},
-
- // Normal mappings but somewhat special status in ccTLD.
- {"BL", "BL", true},
- {"MF", "MF", true},
- {"BV", "BV", true},
- {"SJ", "SJ", true},
-
- // Have values when normalized, but not as is.
- {"QU", "ZZ", false},
-
- // ISO Private Use.
- {"AA", "ZZ", false},
- {"QM", "ZZ", false},
- {"QO", "ZZ", false},
- {"XA", "ZZ", false},
- {"XK", "ZZ", false}, // Sometimes used for Kosovo, but invalid ccTLD.
- } {
- if tt.in == "" {
- continue
- }
-
- r := MustParseRegion(tt.in)
- var want Region
- if tt.out != "ZZ" {
- want = MustParseRegion(tt.out)
- }
- tld, err := r.TLD()
- if got := err == nil; got != tt.ok {
- t.Errorf("error(%v): got %v; want %v", r, got, tt.ok)
- }
- if tld != want {
- t.Errorf("TLD(%v): got %v; want %v", r, tld, want)
- }
- }
-}
-
-func TestCanonicalize(t *testing.T) {
- // TODO: do a full test using CLDR data in a separate regression test.
- tests := []struct {
- in, out string
- option CanonType
- }{
- {"en-Latn", "en", SuppressScript},
- {"sr-Cyrl", "sr-Cyrl", SuppressScript},
- {"sh", "sr-Latn", Legacy},
- {"sh-HR", "sr-Latn-HR", Legacy},
- {"sh-Cyrl-HR", "sr-Cyrl-HR", Legacy},
- {"tl", "fil", Legacy},
- {"no", "no", Legacy},
- {"no", "nb", Legacy | CLDR},
- {"cmn", "cmn", Legacy},
- {"cmn", "zh", Macro},
- {"cmn-u-co-stroke", "zh-u-co-stroke", Macro},
- {"yue", "yue", Macro},
- {"nb", "no", Macro},
- {"nb", "nb", Macro | CLDR},
- {"no", "no", Macro},
- {"no", "no", Macro | CLDR},
- {"iw", "he", DeprecatedBase},
- {"iw", "he", Deprecated | CLDR},
- {"mo", "ro-MD", Deprecated}, // Adopted by CLDR as of version 25.
- {"alb", "sq", Legacy}, // bibliographic
- {"dut", "nl", Legacy}, // bibliographic
- // As of CLDR 25, mo is no longer considered a legacy mapping.
- {"mo", "mo", Legacy | CLDR},
- {"und-AN", "und-AN", Deprecated},
- {"und-YD", "und-YE", DeprecatedRegion},
- {"und-YD", "und-YD", DeprecatedBase},
- {"und-Qaai", "und-Zinh", DeprecatedScript},
- {"und-Qaai", "und-Qaai", DeprecatedBase},
- {"drh", "mn", All}, // drh -> khk -> mn
- }
- for i, tt := range tests {
- in, _ := Raw.Parse(tt.in)
- in, _ = tt.option.Canonicalize(in)
- if in.String() != tt.out {
- t.Errorf("%d:%s: was %s; want %s", i, tt.in, in.String(), tt.out)
- }
- if int(in.pVariant) > int(in.pExt) || int(in.pExt) > len(in.str) {
- t.Errorf("%d:%s:offsets %d <= %d <= %d must be true", i, tt.in, in.pVariant, in.pExt, len(in.str))
- }
- }
- // Test idempotence.
- for _, base := range Supported.BaseLanguages() {
- tag, _ := Raw.Compose(base)
- got, _ := All.Canonicalize(tag)
- want, _ := All.Canonicalize(got)
- if got != want {
- t.Errorf("idem(%s): got %s; want %s", tag, got, want)
- }
- }
-}
-
-func TestTypeForKey(t *testing.T) {
- tests := []struct{ key, in, out string }{
- {"co", "en", ""},
- {"co", "en-u-abc", ""},
- {"co", "en-u-co-phonebk", "phonebk"},
- {"co", "en-u-co-phonebk-cu-aud", "phonebk"},
- {"co", "x-foo-u-co-phonebk", ""},
- {"nu", "en-u-co-phonebk-nu-arabic", "arabic"},
- {"kc", "cmn-u-co-stroke", ""},
- }
- for _, tt := range tests {
- if v := Make(tt.in).TypeForKey(tt.key); v != tt.out {
- t.Errorf("%q[%q]: was %q; want %q", tt.in, tt.key, v, tt.out)
- }
- }
-}
-
-func TestSetTypeForKey(t *testing.T) {
- tests := []struct {
- key, value, in, out string
- err bool
- }{
- // replace existing value
- {"co", "pinyin", "en-u-co-phonebk", "en-u-co-pinyin", false},
- {"co", "pinyin", "en-u-co-phonebk-cu-xau", "en-u-co-pinyin-cu-xau", false},
- {"co", "pinyin", "en-u-co-phonebk-v-xx", "en-u-co-pinyin-v-xx", false},
- {"co", "pinyin", "en-u-co-phonebk-x-x", "en-u-co-pinyin-x-x", false},
- {"nu", "arabic", "en-u-co-phonebk-nu-vaai", "en-u-co-phonebk-nu-arabic", false},
- // add to existing -u extension
- {"co", "pinyin", "en-u-ca-gregory", "en-u-ca-gregory-co-pinyin", false},
- {"co", "pinyin", "en-u-ca-gregory-nu-vaai", "en-u-ca-gregory-co-pinyin-nu-vaai", false},
- {"co", "pinyin", "en-u-ca-gregory-v-va", "en-u-ca-gregory-co-pinyin-v-va", false},
- {"co", "pinyin", "en-u-ca-gregory-x-a", "en-u-ca-gregory-co-pinyin-x-a", false},
- {"ca", "gregory", "en-u-co-pinyin", "en-u-ca-gregory-co-pinyin", false},
- // remove pair
- {"co", "", "en-u-co-phonebk", "en", false},
- {"co", "", "en-u-ca-gregory-co-phonebk", "en-u-ca-gregory", false},
- {"co", "", "en-u-co-phonebk-nu-arabic", "en-u-nu-arabic", false},
- {"co", "", "en", "en", false},
- // add -u extension
- {"co", "pinyin", "en", "en-u-co-pinyin", false},
- {"co", "pinyin", "und", "und-u-co-pinyin", false},
- {"co", "pinyin", "en-a-aaa", "en-a-aaa-u-co-pinyin", false},
- {"co", "pinyin", "en-x-aaa", "en-u-co-pinyin-x-aaa", false},
- {"co", "pinyin", "en-v-aa", "en-u-co-pinyin-v-aa", false},
- {"co", "pinyin", "en-a-aaa-x-x", "en-a-aaa-u-co-pinyin-x-x", false},
- {"co", "pinyin", "en-a-aaa-v-va", "en-a-aaa-u-co-pinyin-v-va", false},
- // error on invalid values
- {"co", "pinyinxxx", "en", "en", true},
- {"co", "piny.n", "en", "en", true},
- {"co", "pinyinxxx", "en-a-aaa", "en-a-aaa", true},
- {"co", "pinyinxxx", "en-u-aaa", "en-u-aaa", true},
- {"co", "pinyinxxx", "en-u-aaa-co-pinyin", "en-u-aaa-co-pinyin", true},
- {"co", "pinyi.", "en-u-aaa-co-pinyin", "en-u-aaa-co-pinyin", true},
- {"col", "pinyin", "en", "en", true},
- {"co", "cu", "en", "en", true},
- // error when setting on a private use tag
- {"co", "phonebook", "x-foo", "x-foo", true},
- }
- for i, tt := range tests {
- tag := Make(tt.in)
- if v, err := tag.SetTypeForKey(tt.key, tt.value); v.String() != tt.out {
- t.Errorf("%d:%q[%q]=%q: was %q; want %q", i, tt.in, tt.key, tt.value, v, tt.out)
- } else if (err != nil) != tt.err {
- t.Errorf("%d:%q[%q]=%q: error was %v; want %v", i, tt.in, tt.key, tt.value, err != nil, tt.err)
- } else if val := v.TypeForKey(tt.key); err == nil && val != tt.value {
- t.Errorf("%d:%q[%q]==%q: was %v; want %v", i, tt.out, tt.key, tt.value, val, tt.value)
- }
- if len(tag.String()) <= 3 {
- // Simulate a tag for which the string has not been set.
- tag.str, tag.pExt, tag.pVariant = "", 0, 0
- if tag, err := tag.SetTypeForKey(tt.key, tt.value); err == nil {
- if val := tag.TypeForKey(tt.key); err == nil && val != tt.value {
- t.Errorf("%d:%q[%q]==%q: was %v; want %v", i, tt.out, tt.key, tt.value, val, tt.value)
- }
- }
- }
- }
-}
-
-func TestFindKeyAndType(t *testing.T) {
- // out is either the matched type in case of a match or the original
- // string up till the insertion point.
- tests := []struct {
- key string
- hasExt bool
- in, out string
- }{
- // Don't search past a private use extension.
- {"co", false, "en-x-foo-u-co-pinyin", "en"},
- {"co", false, "x-foo-u-co-pinyin", ""},
- {"co", false, "en-s-fff-x-foo", "en-s-fff"},
- // Insertion points in absence of -u extension.
- {"cu", false, "en", ""}, // t.str is ""
- {"cu", false, "en-v-va", "en"},
- {"cu", false, "en-a-va", "en-a-va"},
- {"cu", false, "en-a-va-v-va", "en-a-va"},
- {"cu", false, "en-x-a", "en"},
- // Tags with the -u extension.
- {"co", true, "en-u-co-standard", "standard"},
- {"co", true, "yue-u-co-pinyin", "pinyin"},
- {"co", true, "en-u-co-abc", "abc"},
- {"co", true, "en-u-co-abc-def", "abc-def"},
- {"co", true, "en-u-co-abc-def-x-foo", "abc-def"},
- {"co", true, "en-u-co-standard-nu-arab", "standard"},
- {"co", true, "yue-u-co-pinyin-nu-arab", "pinyin"},
- // Insertion points.
- {"cu", true, "en-u-co-standard", "en-u-co-standard"},
- {"cu", true, "yue-u-co-pinyin-x-foo", "yue-u-co-pinyin"},
- {"cu", true, "en-u-co-abc", "en-u-co-abc"},
- {"cu", true, "en-u-nu-arabic", "en-u"},
- {"cu", true, "en-u-co-abc-def-nu-arabic", "en-u-co-abc-def"},
- }
- for i, tt := range tests {
- start, end, hasExt := Make(tt.in).findTypeForKey(tt.key)
- if start != end {
- res := tt.in[start:end]
- if res != tt.out {
- t.Errorf("%d:%s: was %q; want %q", i, tt.in, res, tt.out)
- }
- } else {
- if hasExt != tt.hasExt {
- t.Errorf("%d:%s: hasExt was %v; want %v", i, tt.in, hasExt, tt.hasExt)
- continue
- }
- if tt.in[:start] != tt.out {
- t.Errorf("%d:%s: insertion point was %q; want %q", i, tt.in, tt.in[:start], tt.out)
- }
- }
- }
-}
-
-func TestParent(t *testing.T) {
- tests := []struct{ in, out string }{
- // Strip variants and extensions first
- {"de-u-co-phonebk", "de"},
- {"de-1994", "de"},
- {"de-Latn-1994", "de"}, // remove superfluous script.
-
- // Ensure the canonical Tag for an entry is in the chain for base-script
- // pairs.
- {"zh-Hans", "zh"},
-
- // Skip the script if it is the maximized version. CLDR files for the
- // skipped tag are always empty.
- {"zh-Hans-TW", "zh"},
- {"zh-Hans-CN", "zh"},
-
- // Insert the script if the maximized script is not the same as the
- // maximized script of the base language.
- {"zh-TW", "zh-Hant"},
- {"zh-HK", "zh-Hant"},
- {"zh-Hant-TW", "zh-Hant"},
- {"zh-Hant-HK", "zh-Hant"},
-
- // Non-default script skips to und.
- // CLDR
- {"az-Cyrl", "und"},
- {"bs-Cyrl", "und"},
- {"en-Dsrt", "und"},
- {"ha-Arab", "und"},
- {"mn-Mong", "und"},
- {"pa-Arab", "und"},
- {"shi-Latn", "und"},
- {"sr-Latn", "und"},
- {"uz-Arab", "und"},
- {"uz-Cyrl", "und"},
- {"vai-Latn", "und"},
- {"zh-Hant", "und"},
- // extra
- {"nl-Cyrl", "und"},
-
- // World english inherits from en-001.
- {"en-150", "en-001"},
- {"en-AU", "en-001"},
- {"en-BE", "en-001"},
- {"en-GG", "en-001"},
- {"en-GI", "en-001"},
- {"en-HK", "en-001"},
- {"en-IE", "en-001"},
- {"en-IM", "en-001"},
- {"en-IN", "en-001"},
- {"en-JE", "en-001"},
- {"en-MT", "en-001"},
- {"en-NZ", "en-001"},
- {"en-PK", "en-001"},
- {"en-SG", "en-001"},
-
- // Spanish in Latin-American countries have es-419 as parent.
- {"es-AR", "es-419"},
- {"es-BO", "es-419"},
- {"es-CL", "es-419"},
- {"es-CO", "es-419"},
- {"es-CR", "es-419"},
- {"es-CU", "es-419"},
- {"es-DO", "es-419"},
- {"es-EC", "es-419"},
- {"es-GT", "es-419"},
- {"es-HN", "es-419"},
- {"es-MX", "es-419"},
- {"es-NI", "es-419"},
- {"es-PA", "es-419"},
- {"es-PE", "es-419"},
- {"es-PR", "es-419"},
- {"es-PY", "es-419"},
- {"es-SV", "es-419"},
- {"es-US", "es-419"},
- {"es-UY", "es-419"},
- {"es-VE", "es-419"},
- // exceptions (according to CLDR)
- {"es-CW", "es"},
-
- // Inherit from pt-PT, instead of pt for these countries.
- {"pt-AO", "pt-PT"},
- {"pt-CV", "pt-PT"},
- {"pt-GW", "pt-PT"},
- {"pt-MO", "pt-PT"},
- {"pt-MZ", "pt-PT"},
- {"pt-ST", "pt-PT"},
- {"pt-TL", "pt-PT"},
- }
- for _, tt := range tests {
- tag := Raw.MustParse(tt.in)
- if p := Raw.MustParse(tt.out); p != tag.Parent() {
- t.Errorf("%s: was %v; want %v", tt.in, tag.Parent(), p)
- }
- }
-}
-
-var (
- // Tags without error that don't need to be changed.
- benchBasic = []string{
- "en",
- "en-Latn",
- "en-GB",
- "za",
- "zh-Hant",
- "zh",
- "zh-HK",
- "ar-MK",
- "en-CA",
- "fr-CA",
- "fr-CH",
- "fr",
- "lv",
- "he-IT",
- "tlh",
- "ja",
- "ja-Jpan",
- "ja-Jpan-JP",
- "de-1996",
- "de-CH",
- "sr",
- "sr-Latn",
- }
- // Tags with extensions, not changes required.
- benchExt = []string{
- "x-a-b-c-d",
- "x-aa-bbbb-cccccccc-d",
- "en-x_cc-b-bbb-a-aaa",
- "en-c_cc-b-bbb-a-aaa-x-x",
- "en-u-co-phonebk",
- "en-Cyrl-u-co-phonebk",
- "en-US-u-co-phonebk-cu-xau",
- "en-nedix-u-co-phonebk",
- "en-t-t0-abcd",
- "en-t-nl-latn",
- "en-t-t0-abcd-x-a",
- }
- // Change, but not memory allocation required.
- benchSimpleChange = []string{
- "EN",
- "i-klingon",
- "en-latn",
- "zh-cmn-Hans-CN",
- "iw-NL",
- }
- // Change and memory allocation required.
- benchChangeAlloc = []string{
- "en-c_cc-b-bbb-a-aaa",
- "en-u-cu-xua-co-phonebk",
- "en-u-cu-xua-co-phonebk-a-cd",
- "en-u-def-abc-cu-xua-co-phonebk",
- "en-t-en-Cyrl-NL-1994",
- "en-t-en-Cyrl-NL-1994-t0-abc-def",
- }
- // Tags that result in errors.
- benchErr = []string{
- // IllFormed
- "x_A.-B-C_D",
- "en-u-cu-co-phonebk",
- "en-u-cu-xau-co",
- "en-t-nl-abcd",
- // Invalid
- "xx",
- "nl-Uuuu",
- "nl-QB",
- }
- benchChange = append(benchSimpleChange, benchChangeAlloc...)
- benchAll = append(append(append(benchBasic, benchExt...), benchChange...), benchErr...)
-)
-
-func doParse(b *testing.B, tag []string) {
- for i := 0; i < b.N; i++ {
- // Use the modulo instead of looping over all tags so that we get a somewhat
- // meaningful ns/op.
- Parse(tag[i%len(tag)])
- }
-}
-
-func BenchmarkParse(b *testing.B) {
- doParse(b, benchAll)
-}
-
-func BenchmarkParseBasic(b *testing.B) {
- doParse(b, benchBasic)
-}
-
-func BenchmarkParseError(b *testing.B) {
- doParse(b, benchErr)
-}
-
-func BenchmarkParseSimpleChange(b *testing.B) {
- doParse(b, benchSimpleChange)
-}
-
-func BenchmarkParseChangeAlloc(b *testing.B) {
- doParse(b, benchChangeAlloc)
-}
diff --git a/vendor/golang.org/x/text/language/lookup_test.go b/vendor/golang.org/x/text/language/lookup_test.go
deleted file mode 100644
index 9833830c4..000000000
--- a/vendor/golang.org/x/text/language/lookup_test.go
+++ /dev/null
@@ -1,457 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package language
-
-import (
- "testing"
-
- "golang.org/x/text/internal/tag"
-)
-
-func b(s string) []byte {
- return []byte(s)
-}
-
-func TestLangID(t *testing.T) {
- tests := []struct {
- id, bcp47, iso3, norm string
- err error
- }{
- {id: "", bcp47: "und", iso3: "und", err: errSyntax},
- {id: " ", bcp47: "und", iso3: "und", err: errSyntax},
- {id: " ", bcp47: "und", iso3: "und", err: errSyntax},
- {id: " ", bcp47: "und", iso3: "und", err: errSyntax},
- {id: "xxx", bcp47: "und", iso3: "und", err: mkErrInvalid([]byte("xxx"))},
- {id: "und", bcp47: "und", iso3: "und"},
- {id: "aju", bcp47: "aju", iso3: "aju", norm: "jrb"},
- {id: "jrb", bcp47: "jrb", iso3: "jrb"},
- {id: "es", bcp47: "es", iso3: "spa"},
- {id: "spa", bcp47: "es", iso3: "spa"},
- {id: "ji", bcp47: "ji", iso3: "yid-", norm: "yi"},
- {id: "jw", bcp47: "jw", iso3: "jav-", norm: "jv"},
- {id: "ar", bcp47: "ar", iso3: "ara"},
- {id: "kw", bcp47: "kw", iso3: "cor"},
- {id: "arb", bcp47: "arb", iso3: "arb", norm: "ar"},
- {id: "ar", bcp47: "ar", iso3: "ara"},
- {id: "kur", bcp47: "ku", iso3: "kur"},
- {id: "nl", bcp47: "nl", iso3: "nld"},
- {id: "NL", bcp47: "nl", iso3: "nld"},
- {id: "gsw", bcp47: "gsw", iso3: "gsw"},
- {id: "gSW", bcp47: "gsw", iso3: "gsw"},
- {id: "und", bcp47: "und", iso3: "und"},
- {id: "sh", bcp47: "sh", iso3: "hbs", norm: "sr"},
- {id: "hbs", bcp47: "sh", iso3: "hbs", norm: "sr"},
- {id: "no", bcp47: "no", iso3: "nor", norm: "no"},
- {id: "nor", bcp47: "no", iso3: "nor", norm: "no"},
- {id: "cmn", bcp47: "cmn", iso3: "cmn", norm: "zh"},
- }
- for i, tt := range tests {
- want, err := getLangID(b(tt.id))
- if err != tt.err {
- t.Errorf("%d:err(%s): found %q; want %q", i, tt.id, err, tt.err)
- }
- if err != nil {
- continue
- }
- if id, _ := getLangISO2(b(tt.bcp47)); len(tt.bcp47) == 2 && want != id {
- t.Errorf("%d:getISO2(%s): found %v; want %v", i, tt.bcp47, id, want)
- }
- if len(tt.iso3) == 3 {
- if id, _ := getLangISO3(b(tt.iso3)); want != id {
- t.Errorf("%d:getISO3(%s): found %q; want %q", i, tt.iso3, id, want)
- }
- if id, _ := getLangID(b(tt.iso3)); want != id {
- t.Errorf("%d:getID3(%s): found %v; want %v", i, tt.iso3, id, want)
- }
- }
- norm := want
- if tt.norm != "" {
- norm, _ = getLangID(b(tt.norm))
- }
- id, _ := normLang(want)
- if id != norm {
- t.Errorf("%d:norm(%s): found %v; want %v", i, tt.id, id, norm)
- }
- if id := want.String(); tt.bcp47 != id {
- t.Errorf("%d:String(): found %s; want %s", i, id, tt.bcp47)
- }
- if id := want.ISO3(); tt.iso3[:3] != id {
- t.Errorf("%d:iso3(): found %s; want %s", i, id, tt.iso3[:3])
- }
- }
-}
-
-func TestGrandfathered(t *testing.T) {
- for _, tt := range []struct{ in, out string }{
- {"art-lojban", "jbo"},
- {"i-ami", "ami"},
- {"i-bnn", "bnn"},
- {"i-hak", "hak"},
- {"i-klingon", "tlh"},
- {"i-lux", "lb"},
- {"i-navajo", "nv"},
- {"i-pwn", "pwn"},
- {"i-tao", "tao"},
- {"i-tay", "tay"},
- {"i-tsu", "tsu"},
- {"no-bok", "nb"},
- {"no-nyn", "nn"},
- {"sgn-BE-FR", "sfb"},
- {"sgn-BE-NL", "vgt"},
- {"sgn-CH-DE", "sgg"},
- {"sgn-ch-de", "sgg"},
- {"zh-guoyu", "cmn"},
- {"zh-hakka", "hak"},
- {"zh-min-nan", "nan"},
- {"zh-xiang", "hsn"},
-
- // Grandfathered tags with no modern replacement will be converted as follows:
- {"cel-gaulish", "xtg-x-cel-gaulish"},
- {"en-GB-oed", "en-GB-oxendict"},
- {"en-gb-oed", "en-GB-oxendict"},
- {"i-default", "en-x-i-default"},
- {"i-enochian", "und-x-i-enochian"},
- {"i-mingo", "see-x-i-mingo"},
- {"zh-min", "nan-x-zh-min"},
-
- {"root", "und"},
- {"en_US_POSIX", "en-US-u-va-posix"},
- {"en_us_posix", "en-US-u-va-posix"},
- {"en-us-posix", "en-US-u-va-posix"},
- } {
- got := Raw.Make(tt.in)
- want := Raw.MustParse(tt.out)
- if got != want {
- t.Errorf("%s: got %q; want %q", tt.in, got, want)
- }
- }
-}
-
-func TestRegionID(t *testing.T) {
- tests := []struct {
- in, out string
- }{
- {"_ ", ""},
- {"_000", ""},
- {"419", "419"},
- {"AA", "AA"},
- {"ATF", "TF"},
- {"HV", "HV"},
- {"CT", "CT"},
- {"DY", "DY"},
- {"IC", "IC"},
- {"FQ", "FQ"},
- {"JT", "JT"},
- {"ZZ", "ZZ"},
- {"EU", "EU"},
- {"QO", "QO"},
- {"FX", "FX"},
- }
- for i, tt := range tests {
- if tt.in[0] == '_' {
- id := tt.in[1:]
- if _, err := getRegionID(b(id)); err == nil {
- t.Errorf("%d:err(%s): found nil; want error", i, id)
- }
- continue
- }
- want, _ := getRegionID(b(tt.in))
- if s := want.String(); s != tt.out {
- t.Errorf("%d:%s: found %q; want %q", i, tt.in, s, tt.out)
- }
- if len(tt.in) == 2 {
- want, _ := getRegionISO2(b(tt.in))
- if s := want.String(); s != tt.out {
- t.Errorf("%d:getISO2(%s): found %q; want %q", i, tt.in, s, tt.out)
- }
- }
- }
-}
-
-func TestRegionType(t *testing.T) {
- for _, tt := range []struct {
- r string
- t byte
- }{
- {"NL", bcp47Region | ccTLD},
- {"EU", bcp47Region | ccTLD}, // exceptionally reserved
- {"AN", bcp47Region | ccTLD}, // transitionally reserved
-
- {"DD", bcp47Region}, // deleted in ISO, deprecated in BCP 47
- {"NT", bcp47Region}, // transitionally reserved, deprecated in BCP 47
-
- {"XA", iso3166UserAssigned | bcp47Region},
- {"ZZ", iso3166UserAssigned | bcp47Region},
- {"AA", iso3166UserAssigned | bcp47Region},
- {"QO", iso3166UserAssigned | bcp47Region},
- {"QM", iso3166UserAssigned | bcp47Region},
- {"XK", iso3166UserAssigned | bcp47Region},
-
- {"CT", 0}, // deleted in ISO, not in BCP 47, canonicalized in CLDR
- } {
- r := MustParseRegion(tt.r)
- if tp := r.typ(); tp != tt.t {
- t.Errorf("Type(%s): got %x; want %x", tt.r, tp, tt.t)
- }
- }
-}
-
-func TestRegionISO3(t *testing.T) {
- tests := []struct {
- from, iso3, to string
- }{
- {" ", "ZZZ", "ZZ"},
- {"000", "ZZZ", "ZZ"},
- {"AA", "AAA", ""},
- {"CT", "CTE", ""},
- {"DY", "DHY", ""},
- {"EU", "QUU", ""},
- {"HV", "HVO", ""},
- {"IC", "ZZZ", "ZZ"},
- {"JT", "JTN", ""},
- {"PZ", "PCZ", ""},
- {"QU", "QUU", "EU"},
- {"QO", "QOO", ""},
- {"YD", "YMD", ""},
- {"FQ", "ATF", "TF"},
- {"TF", "ATF", ""},
- {"FX", "FXX", ""},
- {"ZZ", "ZZZ", ""},
- {"419", "ZZZ", "ZZ"},
- }
- for _, tt := range tests {
- r, _ := getRegionID(b(tt.from))
- if s := r.ISO3(); s != tt.iso3 {
- t.Errorf("iso3(%q): found %q; want %q", tt.from, s, tt.iso3)
- }
- if tt.iso3 == "" {
- continue
- }
- want := tt.to
- if tt.to == "" {
- want = tt.from
- }
- r, _ = getRegionID(b(want))
- if id, _ := getRegionISO3(b(tt.iso3)); id != r {
- t.Errorf("%s: found %q; want %q", tt.iso3, id, want)
- }
- }
-}
-
-func TestRegionM49(t *testing.T) {
- fromTests := []struct {
- m49 int
- id string
- }{
- {0, ""},
- {-1, ""},
- {1000, ""},
- {10000, ""},
-
- {001, "001"},
- {104, "MM"},
- {180, "CD"},
- {230, "ET"},
- {231, "ET"},
- {249, "FX"},
- {250, "FR"},
- {276, "DE"},
- {278, "DD"},
- {280, "DE"},
- {419, "419"},
- {626, "TL"},
- {736, "SD"},
- {840, "US"},
- {854, "BF"},
- {891, "CS"},
- {899, ""},
- {958, "AA"},
- {966, "QT"},
- {967, "EU"},
- {999, "ZZ"},
- }
- for _, tt := range fromTests {
- id, err := getRegionM49(tt.m49)
- if want, have := err != nil, tt.id == ""; want != have {
- t.Errorf("error(%d): have %v; want %v", tt.m49, have, want)
- continue
- }
- r, _ := getRegionID(b(tt.id))
- if r != id {
- t.Errorf("region(%d): have %s; want %s", tt.m49, id, r)
- }
- }
-
- toTests := []struct {
- m49 int
- id string
- }{
- {0, "000"},
- {0, "IC"}, // Some codes don't have an ID
-
- {001, "001"},
- {104, "MM"},
- {104, "BU"},
- {180, "CD"},
- {180, "ZR"},
- {231, "ET"},
- {250, "FR"},
- {249, "FX"},
- {276, "DE"},
- {278, "DD"},
- {419, "419"},
- {626, "TL"},
- {626, "TP"},
- {729, "SD"},
- {826, "GB"},
- {840, "US"},
- {854, "BF"},
- {891, "YU"},
- {891, "CS"},
- {958, "AA"},
- {966, "QT"},
- {967, "EU"},
- {967, "QU"},
- {999, "ZZ"},
- // For codes that don't have an M49 code use the replacement value,
- // if available.
- {854, "HV"}, // maps to Burkino Faso
- }
- for _, tt := range toTests {
- r, _ := getRegionID(b(tt.id))
- if r.M49() != tt.m49 {
- t.Errorf("m49(%q): have %d; want %d", tt.id, r.M49(), tt.m49)
- }
- }
-}
-
-func TestRegionDeprecation(t *testing.T) {
- tests := []struct{ in, out string }{
- {"BU", "MM"},
- {"BUR", "MM"},
- {"CT", "KI"},
- {"DD", "DE"},
- {"DDR", "DE"},
- {"DY", "BJ"},
- {"FX", "FR"},
- {"HV", "BF"},
- {"JT", "UM"},
- {"MI", "UM"},
- {"NH", "VU"},
- {"NQ", "AQ"},
- {"PU", "UM"},
- {"PZ", "PA"},
- {"QU", "EU"},
- {"RH", "ZW"},
- {"TP", "TL"},
- {"UK", "GB"},
- {"VD", "VN"},
- {"WK", "UM"},
- {"YD", "YE"},
- {"NL", "NL"},
- }
- for _, tt := range tests {
- rIn, _ := getRegionID([]byte(tt.in))
- rOut, _ := getRegionISO2([]byte(tt.out))
- r := normRegion(rIn)
- if rOut == rIn && r != 0 {
- t.Errorf("%s: was %q; want %q", tt.in, r, tt.in)
- }
- if rOut != rIn && r != rOut {
- t.Errorf("%s: was %q; want %q", tt.in, r, tt.out)
- }
-
- }
-}
-
-func TestGetScriptID(t *testing.T) {
- idx := tag.Index("0000BbbbDdddEeeeZzzz\xff\xff\xff\xff")
- tests := []struct {
- in string
- out scriptID
- }{
- {" ", 0},
- {" ", 0},
- {" ", 0},
- {"", 0},
- {"Aaaa", 0},
- {"Bbbb", 1},
- {"Dddd", 2},
- {"dddd", 2},
- {"dDDD", 2},
- {"Eeee", 3},
- {"Zzzz", 4},
- }
- for i, tt := range tests {
- if id, err := getScriptID(idx, b(tt.in)); id != tt.out {
- t.Errorf("%d:%s: found %d; want %d", i, tt.in, id, tt.out)
- } else if id == 0 && err == nil {
- t.Errorf("%d:%s: no error; expected one", i, tt.in)
- }
- }
-}
-
-func TestIsPrivateUse(t *testing.T) {
- type test struct {
- s string
- private bool
- }
- tests := []test{
- {"en", false},
- {"und", false},
- {"pzn", false},
- {"qaa", true},
- {"qtz", true},
- {"qua", false},
- }
- for i, tt := range tests {
- x, _ := getLangID([]byte(tt.s))
- if b := x.IsPrivateUse(); b != tt.private {
- t.Errorf("%d: langID.IsPrivateUse(%s) was %v; want %v", i, tt.s, b, tt.private)
- }
- }
- tests = []test{
- {"001", false},
- {"419", false},
- {"899", false},
- {"900", false},
- {"957", false},
- {"958", true},
- {"AA", true},
- {"AC", false},
- {"EU", false}, // CLDR grouping, exceptionally reserved in ISO.
- {"QU", true}, // Canonicalizes to EU, User-assigned in ISO.
- {"QO", true}, // CLDR grouping, User-assigned in ISO.
- {"QA", false},
- {"QM", true},
- {"QZ", true},
- {"XA", true},
- {"XK", true}, // Assigned to Kosovo in CLDR, User-assigned in ISO.
- {"XZ", true},
- {"ZW", false},
- {"ZZ", true},
- }
- for i, tt := range tests {
- x, _ := getRegionID([]byte(tt.s))
- if b := x.IsPrivateUse(); b != tt.private {
- t.Errorf("%d: regionID.IsPrivateUse(%s) was %v; want %v", i, tt.s, b, tt.private)
- }
- }
- tests = []test{
- {"Latn", false},
- {"Laaa", false}, // invalid
- {"Qaaa", true},
- {"Qabx", true},
- {"Qaby", false},
- {"Zyyy", false},
- {"Zzzz", false},
- }
- for i, tt := range tests {
- x, _ := getScriptID(script, []byte(tt.s))
- if b := x.IsPrivateUse(); b != tt.private {
- t.Errorf("%d: scriptID.IsPrivateUse(%s) was %v; want %v", i, tt.s, b, tt.private)
- }
- }
-}
diff --git a/vendor/golang.org/x/text/language/match_test.go b/vendor/golang.org/x/text/language/match_test.go
deleted file mode 100644
index 8b60b07a3..000000000
--- a/vendor/golang.org/x/text/language/match_test.go
+++ /dev/null
@@ -1,505 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package language
-
-import (
- "bytes"
- "flag"
- "fmt"
- "os"
- "path"
- "path/filepath"
- "strings"
- "testing"
-
- "golang.org/x/text/internal/testtext"
- "golang.org/x/text/internal/ucd"
-)
-
-var verbose = flag.Bool("verbose", false, "set to true to print the internal tables of matchers")
-
-func TestCompliance(t *testing.T) {
- filepath.Walk("testdata", func(file string, info os.FileInfo, err error) error {
- if info.IsDir() {
- return nil
- }
- r, err := os.Open(file)
- if err != nil {
- t.Fatal(err)
- }
- ucd.Parse(r, func(p *ucd.Parser) {
- name := strings.Replace(path.Join(p.String(0), p.String(1)), " ", "", -1)
- if skip[name] {
- return
- }
- t.Run(info.Name()+"/"+name, func(t *testing.T) {
- supported := makeTagList(p.String(0))
- desired := makeTagList(p.String(1))
- gotCombined, index, conf := NewMatcher(supported).Match(desired...)
-
- gotMatch := supported[index]
- wantMatch := mk(p.String(2))
- if gotMatch != wantMatch {
- t.Fatalf("match: got %q; want %q (%v)", gotMatch, wantMatch, conf)
- }
- wantCombined, err := Raw.Parse(p.String(3))
- if err == nil && gotCombined != wantCombined {
- t.Errorf("combined: got %q; want %q (%v)", gotCombined, wantCombined, conf)
- }
- })
- })
- return nil
- })
-}
-
-var skip = map[string]bool{
- // TODO: bugs
- // Honor the wildcard match. This may only be useful to select non-exact
- // stuff.
- "mul,af/nl": true, // match: got "af"; want "mul"
-
- // TODO: include other extensions.
- // combined: got "en-GB-u-ca-buddhist-nu-arab"; want "en-GB-fonipa-t-m0-iso-i0-pinyin-u-ca-buddhist-nu-arab"
- "und,en-GB-u-sd-gbsct/en-fonipa-u-nu-Arab-ca-buddhist-t-m0-iso-i0-pinyin": true,
-
- // Inconsistencies with Mark Davis' implementation where it is not clear
- // which is better.
-
- // Inconsistencies in combined. I think the Go approach is more appropriate.
- // We could use -u-rg- and -u-va- as alternative.
- "und,fr/fr-BE-fonipa": true, // combined: got "fr"; want "fr-BE-fonipa"
- "und,fr-CA/fr-BE-fonipa": true, // combined: got "fr-CA"; want "fr-BE-fonipa"
- "und,fr-fonupa/fr-BE-fonipa": true, // combined: got "fr-fonupa"; want "fr-BE-fonipa"
- "und,no/nn-BE-fonipa": true, // combined: got "no"; want "no-BE-fonipa"
- "50,und,fr-CA-fonupa/fr-BE-fonipa": true, // combined: got "fr-CA-fonupa"; want "fr-BE-fonipa"
-
- // The initial number is a threshold. As we don't use scoring, we will not
- // implement this.
- "50,und,fr-Cyrl-CA-fonupa/fr-BE-fonipa": true,
- // match: got "und"; want "fr-Cyrl-CA-fonupa"
- // combined: got "und"; want "fr-Cyrl-BE-fonipa"
-
- // Other interesting cases to test:
- // - Should same language or same script have the preference if there is
- // usually no understanding of the other script?
- // - More specific region in desired may replace enclosing supported.
-}
-
-func makeTagList(s string) (tags []Tag) {
- for _, s := range strings.Split(s, ",") {
- tags = append(tags, mk(strings.TrimSpace(s)))
- }
- return tags
-}
-
-func TestMatchStrings(t *testing.T) {
- testCases := []struct {
- supported string
- desired string // strings separted by |
- tag string
- index int
- }{{
- supported: "en",
- desired: "",
- tag: "en",
- index: 0,
- }, {
- supported: "en",
- desired: "nl",
- tag: "en",
- index: 0,
- }, {
- supported: "en,nl",
- desired: "nl",
- tag: "nl",
- index: 1,
- }, {
- supported: "en,nl",
- desired: "nl|en",
- tag: "nl",
- index: 1,
- }, {
- supported: "en-GB,nl",
- desired: "en ; q=0.1,nl",
- tag: "nl",
- index: 1,
- }, {
- supported: "en-GB,nl",
- desired: "en;q=0.005 | dk; q=0.1,nl ",
- tag: "en-GB",
- index: 0,
- }, {
- // do not match faulty tags with und
- supported: "en,und",
- desired: "|en",
- tag: "en",
- index: 0,
- }}
- for _, tc := range testCases {
- t.Run(path.Join(tc.supported, tc.desired), func(t *testing.T) {
- m := NewMatcher(makeTagList(tc.supported))
- tag, index := MatchStrings(m, strings.Split(tc.desired, "|")...)
- if tag.String() != tc.tag || index != tc.index {
- t.Errorf("got %v, %d; want %v, %d", tag, index, tc.tag, tc.index)
- }
- })
- }
-}
-
-func TestAddLikelySubtags(t *testing.T) {
- tests := []struct{ in, out string }{
- {"aa", "aa-Latn-ET"},
- {"aa-Latn", "aa-Latn-ET"},
- {"aa-Arab", "aa-Arab-ET"},
- {"aa-Arab-ER", "aa-Arab-ER"},
- {"kk", "kk-Cyrl-KZ"},
- {"kk-CN", "kk-Arab-CN"},
- {"cmn", "cmn"},
- {"zh-AU", "zh-Hant-AU"},
- {"zh-VN", "zh-Hant-VN"},
- {"zh-SG", "zh-Hans-SG"},
- {"zh-Hant", "zh-Hant-TW"},
- {"zh-Hani", "zh-Hani-CN"},
- {"und-Hani", "zh-Hani-CN"},
- {"und", "en-Latn-US"},
- {"und-GB", "en-Latn-GB"},
- {"und-CW", "pap-Latn-CW"},
- {"und-YT", "fr-Latn-YT"},
- {"und-Arab", "ar-Arab-EG"},
- {"und-AM", "hy-Armn-AM"},
- {"und-TW", "zh-Hant-TW"},
- {"und-002", "en-Latn-NG"},
- {"und-Latn-002", "en-Latn-NG"},
- {"en-Latn-002", "en-Latn-NG"},
- {"en-002", "en-Latn-NG"},
- {"en-001", "en-Latn-US"},
- {"und-003", "en-Latn-US"},
- {"und-GB", "en-Latn-GB"},
- {"Latn-001", "en-Latn-US"},
- {"en-001", "en-Latn-US"},
- {"es-419", "es-Latn-419"},
- {"he-145", "he-Hebr-IL"},
- {"ky-145", "ky-Latn-TR"},
- {"kk", "kk-Cyrl-KZ"},
- // Don't specialize duplicate and ambiguous matches.
- {"kk-034", "kk-Arab-034"}, // Matches IR and AF. Both are Arab.
- {"ku-145", "ku-Latn-TR"}, // Matches IQ, TR, and LB, but kk -> TR.
- {"und-Arab-CC", "ms-Arab-CC"},
- {"und-Arab-GB", "ks-Arab-GB"},
- {"und-Hans-CC", "zh-Hans-CC"},
- {"und-CC", "en-Latn-CC"},
- {"sr", "sr-Cyrl-RS"},
- {"sr-151", "sr-Latn-151"}, // Matches RO and RU.
- // We would like addLikelySubtags to generate the same results if the input
- // only changes by adding tags that would otherwise have been added
- // by the expansion.
- // In other words:
- // und-AA -> xx-Scrp-AA implies und-Scrp-AA -> xx-Scrp-AA
- // und-AA -> xx-Scrp-AA implies xx-AA -> xx-Scrp-AA
- // und-Scrp -> xx-Scrp-AA implies und-Scrp-AA -> xx-Scrp-AA
- // und-Scrp -> xx-Scrp-AA implies xx-Scrp -> xx-Scrp-AA
- // xx -> xx-Scrp-AA implies xx-Scrp -> xx-Scrp-AA
- // xx -> xx-Scrp-AA implies xx-AA -> xx-Scrp-AA
- //
- // The algorithm specified in
- // http://unicode.org/reports/tr35/tr35-9.html#Supplemental_Data,
- // Section C.10, does not handle the first case. For example,
- // the CLDR data contains an entry und-BJ -> fr-Latn-BJ, but not
- // there is no rule for und-Latn-BJ. According to spec, und-Latn-BJ
- // would expand to en-Latn-BJ, violating the aforementioned principle.
- // We deviate from the spec by letting und-Scrp-AA expand to xx-Scrp-AA
- // if a rule of the form und-AA -> xx-Scrp-AA is defined.
- // Note that as of version 23, CLDR has some explicitly specified
- // entries that do not conform to these rules. The implementation
- // will not correct these explicit inconsistencies. A later versions of CLDR
- // is supposed to fix this.
- {"und-Latn-BJ", "fr-Latn-BJ"},
- {"und-Bugi-ID", "bug-Bugi-ID"},
- // regions, scripts and languages without definitions
- {"und-Arab-AA", "ar-Arab-AA"},
- {"und-Afak-RE", "fr-Afak-RE"},
- {"und-Arab-GB", "ks-Arab-GB"},
- {"abp-Arab-GB", "abp-Arab-GB"},
- // script has preference over region
- {"und-Arab-NL", "ar-Arab-NL"},
- {"zza", "zza-Latn-TR"},
- // preserve variants and extensions
- {"de-1901", "de-Latn-DE-1901"},
- {"de-x-abc", "de-Latn-DE-x-abc"},
- {"de-1901-x-abc", "de-Latn-DE-1901-x-abc"},
- {"x-abc", "x-abc"}, // TODO: is this the desired behavior?
- }
- for i, tt := range tests {
- in, _ := Parse(tt.in)
- out, _ := Parse(tt.out)
- in, _ = in.addLikelySubtags()
- if in.String() != out.String() {
- t.Errorf("%d: add(%s) was %s; want %s", i, tt.in, in, tt.out)
- }
- }
-}
-func TestMinimize(t *testing.T) {
- tests := []struct{ in, out string }{
- {"aa", "aa"},
- {"aa-Latn", "aa"},
- {"aa-Latn-ET", "aa"},
- {"aa-ET", "aa"},
- {"aa-Arab", "aa-Arab"},
- {"aa-Arab-ER", "aa-Arab-ER"},
- {"aa-Arab-ET", "aa-Arab"},
- {"und", "und"},
- {"und-Latn", "und"},
- {"und-Latn-US", "und"},
- {"en-Latn-US", "en"},
- {"cmn", "cmn"},
- {"cmn-Hans", "cmn-Hans"},
- {"cmn-Hant", "cmn-Hant"},
- {"zh-AU", "zh-AU"},
- {"zh-VN", "zh-VN"},
- {"zh-SG", "zh-SG"},
- {"zh-Hant", "zh-Hant"},
- {"zh-Hant-TW", "zh-TW"},
- {"zh-Hans", "zh"},
- {"zh-Hani", "zh-Hani"},
- {"und-Hans", "und-Hans"},
- {"und-Hani", "und-Hani"},
-
- {"und-CW", "und-CW"},
- {"und-YT", "und-YT"},
- {"und-Arab", "und-Arab"},
- {"und-AM", "und-AM"},
- {"und-Arab-CC", "und-Arab-CC"},
- {"und-CC", "und-CC"},
- {"und-Latn-BJ", "und-BJ"},
- {"und-Bugi-ID", "und-Bugi"},
- {"bug-Bugi-ID", "bug-Bugi"},
- // regions, scripts and languages without definitions
- {"und-Arab-AA", "und-Arab-AA"},
- // preserve variants and extensions
- {"de-Latn-1901", "de-1901"},
- {"de-Latn-x-abc", "de-x-abc"},
- {"de-DE-1901-x-abc", "de-1901-x-abc"},
- {"x-abc", "x-abc"}, // TODO: is this the desired behavior?
- }
- for i, tt := range tests {
- in, _ := Parse(tt.in)
- out, _ := Parse(tt.out)
- min, _ := in.minimize()
- if min.String() != out.String() {
- t.Errorf("%d: min(%s) was %s; want %s", i, tt.in, min, tt.out)
- }
- max, _ := min.addLikelySubtags()
- if x, _ := in.addLikelySubtags(); x.String() != max.String() {
- t.Errorf("%d: max(min(%s)) = %s; want %s", i, tt.in, max, x)
- }
- }
-}
-
-func TestRegionGroups(t *testing.T) {
- testCases := []struct {
- a, b string
- distance uint8
- }{
- {"zh-TW", "zh-HK", 5},
- {"zh-MO", "zh-HK", 4},
- {"es-ES", "es-AR", 5},
- {"es-ES", "es", 4},
- {"es-419", "es-MX", 4},
- {"es-AR", "es-MX", 4},
- {"es-ES", "es-MX", 5},
- {"es-PT", "es-MX", 5},
- }
- for _, tc := range testCases {
- a := MustParse(tc.a)
- aScript, _ := a.Script()
- b := MustParse(tc.b)
- bScript, _ := b.Script()
-
- if aScript != bScript {
- t.Errorf("scripts differ: %q vs %q", aScript, bScript)
- continue
- }
- d, _ := regionGroupDist(a.region, b.region, aScript.scriptID, a.lang)
- if d != tc.distance {
- t.Errorf("got %q; want %q", d, tc.distance)
- }
- }
-}
-
-func TestIsParadigmLocale(t *testing.T) {
- testCases := map[string]bool{
- "en-US": true,
- "en-GB": true,
- "en-VI": false,
- "es-GB": false,
- "es-ES": true,
- "es-419": true,
- }
- for str, want := range testCases {
- tag := Make(str)
- got := isParadigmLocale(tag.lang, tag.region)
- if got != want {
- t.Errorf("isPL(%q) = %v; want %v", str, got, want)
- }
- }
-}
-
-// Implementation of String methods for various types for debugging purposes.
-
-func (m *matcher) String() string {
- w := &bytes.Buffer{}
- fmt.Fprintln(w, "Default:", m.default_)
- for tag, h := range m.index {
- fmt.Fprintf(w, " %s: %v\n", tag, h)
- }
- return w.String()
-}
-
-func (h *matchHeader) String() string {
- w := &bytes.Buffer{}
- fmt.Fprint(w, "haveTag: ")
- for _, h := range h.haveTags {
- fmt.Fprintf(w, "%v, ", h)
- }
- return w.String()
-}
-
-func (t haveTag) String() string {
- return fmt.Sprintf("%v:%d:%v:%v-%v|%v", t.tag, t.index, t.conf, t.maxRegion, t.maxScript, t.altScript)
-}
-
-func TestBestMatchAlloc(t *testing.T) {
- m := NewMatcher(makeTagList("en sr nl"))
- // Go allocates when creating a list of tags from a single tag!
- list := []Tag{English}
- avg := testtext.AllocsPerRun(1, func() {
- m.Match(list...)
- })
- if avg > 0 {
- t.Errorf("got %f; want 0", avg)
- }
-}
-
-var benchHave = []Tag{
- mk("en"),
- mk("en-GB"),
- mk("za"),
- mk("zh-Hant"),
- mk("zh-Hans-CN"),
- mk("zh"),
- mk("zh-HK"),
- mk("ar-MK"),
- mk("en-CA"),
- mk("fr-CA"),
- mk("fr-US"),
- mk("fr-CH"),
- mk("fr"),
- mk("lt"),
- mk("lv"),
- mk("iw"),
- mk("iw-NL"),
- mk("he"),
- mk("he-IT"),
- mk("tlh"),
- mk("ja"),
- mk("ja-Jpan"),
- mk("ja-Jpan-JP"),
- mk("de"),
- mk("de-CH"),
- mk("de-AT"),
- mk("de-DE"),
- mk("sr"),
- mk("sr-Latn"),
- mk("sr-Cyrl"),
- mk("sr-ME"),
-}
-
-var benchWant = [][]Tag{
- []Tag{
- mk("en"),
- },
- []Tag{
- mk("en-AU"),
- mk("de-HK"),
- mk("nl"),
- mk("fy"),
- mk("lv"),
- },
- []Tag{
- mk("en-AU"),
- mk("de-HK"),
- mk("nl"),
- mk("fy"),
- },
- []Tag{
- mk("ja-Hant"),
- mk("da-HK"),
- mk("nl"),
- mk("zh-TW"),
- },
- []Tag{
- mk("ja-Hant"),
- mk("da-HK"),
- mk("nl"),
- mk("hr"),
- },
-}
-
-func BenchmarkMatch(b *testing.B) {
- m := newMatcher(benchHave, nil)
- for i := 0; i < b.N; i++ {
- for _, want := range benchWant {
- m.getBest(want...)
- }
- }
-}
-
-func BenchmarkMatchExact(b *testing.B) {
- want := mk("en")
- m := newMatcher(benchHave, nil)
- for i := 0; i < b.N; i++ {
- m.getBest(want)
- }
-}
-
-func BenchmarkMatchAltLanguagePresent(b *testing.B) {
- want := mk("hr")
- m := newMatcher(benchHave, nil)
- for i := 0; i < b.N; i++ {
- m.getBest(want)
- }
-}
-
-func BenchmarkMatchAltLanguageNotPresent(b *testing.B) {
- want := mk("nn")
- m := newMatcher(benchHave, nil)
- for i := 0; i < b.N; i++ {
- m.getBest(want)
- }
-}
-
-func BenchmarkMatchAltScriptPresent(b *testing.B) {
- want := mk("zh-Hant-CN")
- m := newMatcher(benchHave, nil)
- for i := 0; i < b.N; i++ {
- m.getBest(want)
- }
-}
-
-func BenchmarkMatchAltScriptNotPresent(b *testing.B) {
- want := mk("fr-Cyrl")
- m := newMatcher(benchHave, nil)
- for i := 0; i < b.N; i++ {
- m.getBest(want)
- }
-}
-
-func BenchmarkMatchLimitedExact(b *testing.B) {
- want := []Tag{mk("he-NL"), mk("iw-NL")}
- m := newMatcher(benchHave, nil)
- for i := 0; i < b.N; i++ {
- m.getBest(want...)
- }
-}
diff --git a/vendor/golang.org/x/text/language/parse_test.go b/vendor/golang.org/x/text/language/parse_test.go
deleted file mode 100644
index 9b40eb444..000000000
--- a/vendor/golang.org/x/text/language/parse_test.go
+++ /dev/null
@@ -1,517 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package language
-
-import (
- "bytes"
- "strings"
- "testing"
-
- "golang.org/x/text/internal/tag"
-)
-
-type scanTest struct {
- ok bool // true if scanning does not result in an error
- in string
- tok []string // the expected tokens
-}
-
-var tests = []scanTest{
- {true, "", []string{}},
- {true, "1", []string{"1"}},
- {true, "en", []string{"en"}},
- {true, "root", []string{"root"}},
- {true, "maxchars", []string{"maxchars"}},
- {false, "bad/", []string{}},
- {false, "morethan8", []string{}},
- {false, "-", []string{}},
- {false, "----", []string{}},
- {false, "_", []string{}},
- {true, "en-US", []string{"en", "US"}},
- {true, "en_US", []string{"en", "US"}},
- {false, "en-US-", []string{"en", "US"}},
- {false, "en-US--", []string{"en", "US"}},
- {false, "en-US---", []string{"en", "US"}},
- {false, "en--US", []string{"en", "US"}},
- {false, "-en-US", []string{"en", "US"}},
- {false, "-en--US-", []string{"en", "US"}},
- {false, "-en--US-", []string{"en", "US"}},
- {false, "en-.-US", []string{"en", "US"}},
- {false, ".-en--US-.", []string{"en", "US"}},
- {false, "en-u.-US", []string{"en", "US"}},
- {true, "en-u1-US", []string{"en", "u1", "US"}},
- {true, "maxchar1_maxchar2-maxchar3", []string{"maxchar1", "maxchar2", "maxchar3"}},
- {false, "moreThan8-moreThan8-e", []string{"e"}},
-}
-
-func TestScan(t *testing.T) {
- for i, tt := range tests {
- scan := makeScannerString(tt.in)
- for j := 0; !scan.done; j++ {
- if j >= len(tt.tok) {
- t.Errorf("%d: extra token %q", i, scan.token)
- } else if tag.Compare(tt.tok[j], scan.token) != 0 {
- t.Errorf("%d: token %d: found %q; want %q", i, j, scan.token, tt.tok[j])
- break
- }
- scan.scan()
- }
- if s := strings.Join(tt.tok, "-"); tag.Compare(s, bytes.Replace(scan.b, b("_"), b("-"), -1)) != 0 {
- t.Errorf("%d: input: found %q; want %q", i, scan.b, s)
- }
- if (scan.err == nil) != tt.ok {
- t.Errorf("%d: ok: found %v; want %v", i, scan.err == nil, tt.ok)
- }
- }
-}
-
-func TestAcceptMinSize(t *testing.T) {
- for i, tt := range tests {
- // count number of successive tokens with a minimum size.
- for sz := 1; sz <= 8; sz++ {
- scan := makeScannerString(tt.in)
- scan.end, scan.next = 0, 0
- end := scan.acceptMinSize(sz)
- n := 0
- for i := 0; i < len(tt.tok) && len(tt.tok[i]) >= sz; i++ {
- n += len(tt.tok[i])
- if i > 0 {
- n++
- }
- }
- if end != n {
- t.Errorf("%d:%d: found len %d; want %d", i, sz, end, n)
- }
- }
- }
-}
-
-type parseTest struct {
- i int // the index of this test
- in string
- lang, script, region string
- variants, ext string
- extList []string // only used when more than one extension is present
- invalid bool
- rewrite bool // special rewrite not handled by parseTag
- changed bool // string needed to be reformatted
-}
-
-func parseTests() []parseTest {
- tests := []parseTest{
- {in: "root", lang: "und"},
- {in: "und", lang: "und"},
- {in: "en", lang: "en"},
- {in: "xy", lang: "und", invalid: true},
- {in: "en-ZY", lang: "en", invalid: true},
- {in: "gsw", lang: "gsw"},
- {in: "sr_Latn", lang: "sr", script: "Latn"},
- {in: "af-Arab", lang: "af", script: "Arab"},
- {in: "nl-BE", lang: "nl", region: "BE"},
- {in: "es-419", lang: "es", region: "419"},
- {in: "und-001", lang: "und", region: "001"},
- {in: "de-latn-be", lang: "de", script: "Latn", region: "BE"},
- // Variants
- {in: "de-1901", lang: "de", variants: "1901"},
- // Accept with unsuppressed script.
- {in: "de-Latn-1901", lang: "de", script: "Latn", variants: "1901"},
- // Specialized.
- {in: "sl-rozaj", lang: "sl", variants: "rozaj"},
- {in: "sl-rozaj-lipaw", lang: "sl", variants: "rozaj-lipaw"},
- {in: "sl-rozaj-biske", lang: "sl", variants: "rozaj-biske"},
- {in: "sl-rozaj-biske-1994", lang: "sl", variants: "rozaj-biske-1994"},
- {in: "sl-rozaj-1994", lang: "sl", variants: "rozaj-1994"},
- // Maximum number of variants while adhering to prefix rules.
- {in: "sl-rozaj-biske-1994-alalc97-fonipa-fonupa-fonxsamp", lang: "sl", variants: "rozaj-biske-1994-alalc97-fonipa-fonupa-fonxsamp"},
-
- // Sorting.
- {in: "sl-1994-biske-rozaj", lang: "sl", variants: "rozaj-biske-1994", changed: true},
- {in: "sl-rozaj-biske-1994-alalc97-fonupa-fonipa-fonxsamp", lang: "sl", variants: "rozaj-biske-1994-alalc97-fonipa-fonupa-fonxsamp", changed: true},
- {in: "nl-fonxsamp-alalc97-fonipa-fonupa", lang: "nl", variants: "alalc97-fonipa-fonupa-fonxsamp", changed: true},
-
- // Duplicates variants are removed, but not an error.
- {in: "nl-fonupa-fonupa", lang: "nl", variants: "fonupa"},
-
- // Variants that do not have correct prefixes. We still accept these.
- {in: "de-Cyrl-1901", lang: "de", script: "Cyrl", variants: "1901"},
- {in: "sl-rozaj-lipaw-1994", lang: "sl", variants: "rozaj-lipaw-1994"},
- {in: "sl-1994-biske-rozaj-1994-biske-rozaj", lang: "sl", variants: "rozaj-biske-1994", changed: true},
- {in: "de-Cyrl-1901", lang: "de", script: "Cyrl", variants: "1901"},
-
- // Invalid variant.
- {in: "de-1902", lang: "de", variants: "", invalid: true},
-
- {in: "EN_CYRL", lang: "en", script: "Cyrl"},
- // private use and extensions
- {in: "x-a-b-c-d", ext: "x-a-b-c-d"},
- {in: "x_A.-B-C_D", ext: "x-b-c-d", invalid: true, changed: true},
- {in: "x-aa-bbbb-cccccccc-d", ext: "x-aa-bbbb-cccccccc-d"},
- {in: "en-c_cc-b-bbb-a-aaa", lang: "en", changed: true, extList: []string{"a-aaa", "b-bbb", "c-cc"}},
- {in: "en-x_cc-b-bbb-a-aaa", lang: "en", ext: "x-cc-b-bbb-a-aaa", changed: true},
- {in: "en-c_cc-b-bbb-a-aaa-x-x", lang: "en", changed: true, extList: []string{"a-aaa", "b-bbb", "c-cc", "x-x"}},
- {in: "en-v-c", lang: "en", ext: "", invalid: true},
- {in: "en-v-abcdefghi", lang: "en", ext: "", invalid: true},
- {in: "en-v-abc-x", lang: "en", ext: "v-abc", invalid: true},
- {in: "en-v-abc-x-", lang: "en", ext: "v-abc", invalid: true},
- {in: "en-v-abc-w-x-xx", lang: "en", extList: []string{"v-abc", "x-xx"}, invalid: true, changed: true},
- {in: "en-v-abc-w-y-yx", lang: "en", extList: []string{"v-abc", "y-yx"}, invalid: true, changed: true},
- {in: "en-v-c-abc", lang: "en", ext: "c-abc", invalid: true, changed: true},
- {in: "en-v-w-abc", lang: "en", ext: "w-abc", invalid: true, changed: true},
- {in: "en-v-x-abc", lang: "en", ext: "x-abc", invalid: true, changed: true},
- {in: "en-v-x-a", lang: "en", ext: "x-a", invalid: true, changed: true},
- {in: "en-9-aa-0-aa-z-bb-x-a", lang: "en", extList: []string{"0-aa", "9-aa", "z-bb", "x-a"}, changed: true},
- {in: "en-u-c", lang: "en", ext: "", invalid: true},
- {in: "en-u-co-phonebk", lang: "en", ext: "u-co-phonebk"},
- {in: "en-u-co-phonebk-ca", lang: "en", ext: "u-co-phonebk", invalid: true},
- {in: "en-u-nu-arabic-co-phonebk-ca", lang: "en", ext: "u-co-phonebk-nu-arabic", invalid: true, changed: true},
- {in: "en-u-nu-arabic-co-phonebk-ca-x", lang: "en", ext: "u-co-phonebk-nu-arabic", invalid: true, changed: true},
- {in: "en-u-nu-arabic-co-phonebk-ca-s", lang: "en", ext: "u-co-phonebk-nu-arabic", invalid: true, changed: true},
- {in: "en-u-nu-arabic-co-phonebk-ca-a12345678", lang: "en", ext: "u-co-phonebk-nu-arabic", invalid: true, changed: true},
- {in: "en-u-co-phonebook", lang: "en", ext: "", invalid: true},
- {in: "en-u-co-phonebook-cu-xau", lang: "en", ext: "u-cu-xau", invalid: true, changed: true},
- {in: "en-Cyrl-u-co-phonebk", lang: "en", script: "Cyrl", ext: "u-co-phonebk"},
- {in: "en-US-u-co-phonebk", lang: "en", region: "US", ext: "u-co-phonebk"},
- {in: "en-US-u-co-phonebk-cu-xau", lang: "en", region: "US", ext: "u-co-phonebk-cu-xau"},
- {in: "en-scotland-u-co-phonebk", lang: "en", variants: "scotland", ext: "u-co-phonebk"},
- {in: "en-u-cu-xua-co-phonebk", lang: "en", ext: "u-co-phonebk-cu-xua", changed: true},
- {in: "en-u-def-abc-cu-xua-co-phonebk", lang: "en", ext: "u-abc-def-co-phonebk-cu-xua", changed: true},
- {in: "en-u-def-abc", lang: "en", ext: "u-abc-def", changed: true},
- {in: "en-u-cu-xua-co-phonebk-a-cd", lang: "en", extList: []string{"a-cd", "u-co-phonebk-cu-xua"}, changed: true},
- // Invalid "u" extension. Drop invalid parts.
- {in: "en-u-cu-co-phonebk", lang: "en", extList: []string{"u-co-phonebk"}, invalid: true, changed: true},
- {in: "en-u-cu-xau-co", lang: "en", extList: []string{"u-cu-xau"}, invalid: true},
- // We allow duplicate keys as the LDML spec does not explicitly prohibit it.
- // TODO: Consider eliminating duplicates and returning an error.
- {in: "en-u-cu-xau-co-phonebk-cu-xau", lang: "en", ext: "u-co-phonebk-cu-xau-cu-xau", changed: true},
- {in: "en-t-en-Cyrl-NL-fonipa", lang: "en", ext: "t-en-cyrl-nl-fonipa", changed: true},
- {in: "en-t-en-Cyrl-NL-fonipa-t0-abc-def", lang: "en", ext: "t-en-cyrl-nl-fonipa-t0-abc-def", changed: true},
- {in: "en-t-t0-abcd", lang: "en", ext: "t-t0-abcd"},
- // Not necessary to have changed here.
- {in: "en-t-nl-abcd", lang: "en", ext: "t-nl", invalid: true},
- {in: "en-t-nl-latn", lang: "en", ext: "t-nl-latn"},
- {in: "en-t-t0-abcd-x-a", lang: "en", extList: []string{"t-t0-abcd", "x-a"}},
- // invalid
- {in: "", lang: "und", invalid: true},
- {in: "-", lang: "und", invalid: true},
- {in: "x", lang: "und", invalid: true},
- {in: "x-", lang: "und", invalid: true},
- {in: "x--", lang: "und", invalid: true},
- {in: "a-a-b-c-d", lang: "und", invalid: true},
- {in: "en-", lang: "en", invalid: true},
- {in: "enne-", lang: "und", invalid: true},
- {in: "en.", lang: "und", invalid: true},
- {in: "en.-latn", lang: "und", invalid: true},
- {in: "en.-en", lang: "en", invalid: true},
- {in: "x-a-tooManyChars-c-d", ext: "x-a-c-d", invalid: true, changed: true},
- {in: "a-tooManyChars-c-d", lang: "und", invalid: true},
- // TODO: check key-value validity
- // { in: "en-u-cu-xd", lang: "en", ext: "u-cu-xd", invalid: true },
- {in: "en-t-abcd", lang: "en", invalid: true},
- {in: "en-Latn-US-en", lang: "en", script: "Latn", region: "US", invalid: true},
- // rewrites (more tests in TestGrandfathered)
- {in: "zh-min-nan", lang: "nan"},
- {in: "zh-yue", lang: "yue"},
- {in: "zh-xiang", lang: "hsn", rewrite: true},
- {in: "zh-guoyu", lang: "cmn", rewrite: true},
- {in: "iw", lang: "iw"},
- {in: "sgn-BE-FR", lang: "sfb", rewrite: true},
- {in: "i-klingon", lang: "tlh", rewrite: true},
- }
- for i, tt := range tests {
- tests[i].i = i
- if tt.extList != nil {
- tests[i].ext = strings.Join(tt.extList, "-")
- }
- if tt.ext != "" && tt.extList == nil {
- tests[i].extList = []string{tt.ext}
- }
- }
- return tests
-}
-
-func TestParseExtensions(t *testing.T) {
- for i, tt := range parseTests() {
- if tt.ext == "" || tt.rewrite {
- continue
- }
- scan := makeScannerString(tt.in)
- if len(scan.b) > 1 && scan.b[1] != '-' {
- scan.end = nextExtension(string(scan.b), 0)
- scan.next = scan.end + 1
- scan.scan()
- }
- start := scan.start
- scan.toLower(start, len(scan.b))
- parseExtensions(&scan)
- ext := string(scan.b[start:])
- if ext != tt.ext {
- t.Errorf("%d(%s): ext was %v; want %v", i, tt.in, ext, tt.ext)
- }
- if changed := !strings.HasPrefix(tt.in[start:], ext); changed != tt.changed {
- t.Errorf("%d(%s): changed was %v; want %v", i, tt.in, changed, tt.changed)
- }
- }
-}
-
-// partChecks runs checks for each part by calling the function returned by f.
-func partChecks(t *testing.T, f func(*parseTest) (Tag, bool)) {
- for i, tt := range parseTests() {
- tag, skip := f(&tt)
- if skip {
- continue
- }
- if l, _ := getLangID(b(tt.lang)); l != tag.lang {
- t.Errorf("%d: lang was %q; want %q", i, tag.lang, l)
- }
- if sc, _ := getScriptID(script, b(tt.script)); sc != tag.script {
- t.Errorf("%d: script was %q; want %q", i, tag.script, sc)
- }
- if r, _ := getRegionID(b(tt.region)); r != tag.region {
- t.Errorf("%d: region was %q; want %q", i, tag.region, r)
- }
- if tag.str == "" {
- continue
- }
- p := int(tag.pVariant)
- if p < int(tag.pExt) {
- p++
- }
- if s, g := tag.str[p:tag.pExt], tt.variants; s != g {
- t.Errorf("%d: variants was %q; want %q", i, s, g)
- }
- p = int(tag.pExt)
- if p > 0 && p < len(tag.str) {
- p++
- }
- if s, g := (tag.str)[p:], tt.ext; s != g {
- t.Errorf("%d: extensions were %q; want %q", i, s, g)
- }
- }
-}
-
-func TestParseTag(t *testing.T) {
- partChecks(t, func(tt *parseTest) (id Tag, skip bool) {
- if strings.HasPrefix(tt.in, "x-") || tt.rewrite {
- return Tag{}, true
- }
- scan := makeScannerString(tt.in)
- id, end := parseTag(&scan)
- id.str = string(scan.b[:end])
- tt.ext = ""
- tt.extList = []string{}
- return id, false
- })
-}
-
-func TestParse(t *testing.T) {
- partChecks(t, func(tt *parseTest) (id Tag, skip bool) {
- id, err := Raw.Parse(tt.in)
- ext := ""
- if id.str != "" {
- if strings.HasPrefix(id.str, "x-") {
- ext = id.str
- } else if int(id.pExt) < len(id.str) && id.pExt > 0 {
- ext = id.str[id.pExt+1:]
- }
- }
- if tag, _ := Raw.Parse(id.String()); tag.String() != id.String() {
- t.Errorf("%d:%s: reparse was %q; want %q", tt.i, tt.in, id.String(), tag.String())
- }
- if ext != tt.ext {
- t.Errorf("%d:%s: ext was %q; want %q", tt.i, tt.in, ext, tt.ext)
- }
- changed := id.str != "" && !strings.HasPrefix(tt.in, id.str)
- if changed != tt.changed {
- t.Errorf("%d:%s: changed was %v; want %v", tt.i, tt.in, changed, tt.changed)
- }
- if (err != nil) != tt.invalid {
- t.Errorf("%d:%s: invalid was %v; want %v. Error: %v", tt.i, tt.in, err != nil, tt.invalid, err)
- }
- return id, false
- })
-}
-
-func TestErrors(t *testing.T) {
- mkInvalid := func(s string) error {
- return mkErrInvalid([]byte(s))
- }
- tests := []struct {
- in string
- out error
- }{
- // invalid subtags.
- {"ac", mkInvalid("ac")},
- {"AC", mkInvalid("ac")},
- {"aa-Uuuu", mkInvalid("Uuuu")},
- {"aa-AB", mkInvalid("AB")},
- // ill-formed wins over invalid.
- {"ac-u", errSyntax},
- {"ac-u-ca", errSyntax},
- {"ac-u-ca-co-pinyin", errSyntax},
- {"noob", errSyntax},
- }
- for _, tt := range tests {
- _, err := Parse(tt.in)
- if err != tt.out {
- t.Errorf("%s: was %q; want %q", tt.in, err, tt.out)
- }
- }
-}
-
-func TestCompose1(t *testing.T) {
- partChecks(t, func(tt *parseTest) (id Tag, skip bool) {
- l, _ := ParseBase(tt.lang)
- s, _ := ParseScript(tt.script)
- r, _ := ParseRegion(tt.region)
- v := []Variant{}
- for _, x := range strings.Split(tt.variants, "-") {
- p, _ := ParseVariant(x)
- v = append(v, p)
- }
- e := []Extension{}
- for _, x := range tt.extList {
- p, _ := ParseExtension(x)
- e = append(e, p)
- }
- id, _ = Raw.Compose(l, s, r, v, e)
- return id, false
- })
-}
-
-func TestCompose2(t *testing.T) {
- partChecks(t, func(tt *parseTest) (id Tag, skip bool) {
- l, _ := ParseBase(tt.lang)
- s, _ := ParseScript(tt.script)
- r, _ := ParseRegion(tt.region)
- p := []interface{}{l, s, r, s, r, l}
- for _, x := range strings.Split(tt.variants, "-") {
- v, _ := ParseVariant(x)
- p = append(p, v)
- }
- for _, x := range tt.extList {
- e, _ := ParseExtension(x)
- p = append(p, e)
- }
- id, _ = Raw.Compose(p...)
- return id, false
- })
-}
-
-func TestCompose3(t *testing.T) {
- partChecks(t, func(tt *parseTest) (id Tag, skip bool) {
- id, _ = Raw.Parse(tt.in)
- id, _ = Raw.Compose(id)
- return id, false
- })
-}
-
-func mk(s string) Tag {
- return Raw.Make(s)
-}
-
-func TestParseAcceptLanguage(t *testing.T) {
- type res struct {
- t Tag
- q float32
- }
- en := []res{{mk("en"), 1.0}}
- tests := []struct {
- out []res
- in string
- ok bool
- }{
- {en, "en", true},
- {en, " en", true},
- {en, "en ", true},
- {en, " en ", true},
- {en, "en,", true},
- {en, ",en", true},
- {en, ",,,en,,,", true},
- {en, ",en;q=1", true},
-
- // We allow an empty input, contrary to spec.
- {nil, "", true},
- {[]res{{mk("aa"), 1}}, "aa;", true}, // allow unspecified weight
-
- // errors
- {nil, ";", false},
- {nil, "$", false},
- {nil, "e;", false},
- {nil, "x;", false},
- {nil, "x", false},
- {nil, "ac", false}, // non-existing language
- {nil, "aa;q", false},
- {nil, "aa;q=", false},
- {nil, "aa;q=.", false},
-
- // odd fallbacks
- {
- []res{{mk("en"), 0.1}},
- " english ;q=.1",
- true,
- },
- {
- []res{{mk("it"), 1.0}, {mk("de"), 1.0}, {mk("fr"), 1.0}},
- " italian, deutsch, french",
- true,
- },
-
- // lists
- {
- []res{{mk("en"), 0.1}},
- "en;q=.1",
- true,
- },
- {
- []res{{mk("mul"), 1.0}},
- "*",
- true,
- },
- {
- []res{{mk("en"), 1.0}, {mk("de"), 1.0}},
- "en,de",
- true,
- },
- {
- []res{{mk("en"), 1.0}, {mk("de"), .5}},
- "en,de;q=0.5",
- true,
- },
- {
- []res{{mk("de"), 0.8}, {mk("en"), 0.5}},
- " en ; q = 0.5 , , de;q=0.8",
- true,
- },
- {
- []res{{mk("en"), 1.0}, {mk("de"), 1.0}, {mk("fr"), 1.0}, {mk("tlh"), 1.0}},
- "en,de,fr,i-klingon",
- true,
- },
- // sorting
- {
- []res{{mk("tlh"), 0.4}, {mk("de"), 0.2}, {mk("fr"), 0.2}, {mk("en"), 0.1}},
- "en;q=0.1,de;q=0.2,fr;q=0.2,i-klingon;q=0.4",
- true,
- },
- // dropping
- {
- []res{{mk("fr"), 0.2}, {mk("en"), 0.1}},
- "en;q=0.1,de;q=0,fr;q=0.2,i-klingon;q=0.0",
- true,
- },
- }
- for i, tt := range tests {
- tags, qs, e := ParseAcceptLanguage(tt.in)
- if e == nil != tt.ok {
- t.Errorf("%d:%s:err: was %v; want %v", i, tt.in, e == nil, tt.ok)
- }
- for j, tag := range tags {
- if out := tt.out[j]; !tag.equalTags(out.t) || qs[j] != out.q {
- t.Errorf("%d:%s: was %s, %1f; want %s, %1f", i, tt.in, tag, qs[j], out.t, out.q)
- break
- }
- }
- }
-}
diff --git a/vendor/golang.org/x/text/secure/bidirule/bench_test.go b/vendor/golang.org/x/text/secure/bidirule/bench_test.go
deleted file mode 100644
index 2db922bfd..000000000
--- a/vendor/golang.org/x/text/secure/bidirule/bench_test.go
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package bidirule
-
-import (
- "testing"
-
- "golang.org/x/text/internal/testtext"
-)
-
-var benchData = []struct{ name, data string }{
- {"ascii", "Scheveningen"},
- {"arabic", "دبي"},
- {"hangul", "다음과"},
-}
-
-func doBench(b *testing.B, fn func(b *testing.B, data string)) {
- for _, d := range benchData {
- testtext.Bench(b, d.name, func(b *testing.B) { fn(b, d.data) })
- }
-}
-
-func BenchmarkSpan(b *testing.B) {
- r := New()
- doBench(b, func(b *testing.B, str string) {
- b.SetBytes(int64(len(str)))
- data := []byte(str)
- for i := 0; i < b.N; i++ {
- r.Reset()
- r.Span(data, true)
- }
- })
-}
-
-func BenchmarkDirectionASCII(b *testing.B) {
- doBench(b, func(b *testing.B, str string) {
- b.SetBytes(int64(len(str)))
- data := []byte(str)
- for i := 0; i < b.N; i++ {
- Direction(data)
- }
- })
-}
-
-func BenchmarkDirectionStringASCII(b *testing.B) {
- doBench(b, func(b *testing.B, str string) {
- b.SetBytes(int64(len(str)))
- for i := 0; i < b.N; i++ {
- DirectionString(str)
- }
- })
-}
diff --git a/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0_test.go b/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0_test.go
deleted file mode 100644
index 06ec5f5df..000000000
--- a/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0_test.go
+++ /dev/null
@@ -1,694 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.10
-
-package bidirule
-
-import (
- "golang.org/x/text/transform"
- "golang.org/x/text/unicode/bidi"
-)
-
-var testCases = [][]ruleTest{
- // Go-specific rules.
- // Invalid UTF-8 is invalid.
- 0: []ruleTest{{
- in: "",
- dir: bidi.LeftToRight,
- }, {
- in: "\x80",
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: 0,
- }, {
- in: "\xcc",
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: 0,
- }, {
- in: "abc\x80",
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: 3,
- }, {
- in: "abc\xcc",
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: 3,
- }, {
- in: "abc\xccdef",
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: 3,
- }, {
- in: "\xccdef",
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: 0,
- }, {
- in: strR + "\x80",
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: len(strR),
- }, {
- in: strR + "\xcc",
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: len(strR),
- }, {
- in: strAL + "\xcc" + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: len(strAL),
- }, {
- in: "\xcc" + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 0,
- }},
-
- // Rule 2.1: The first character must be a character with Bidi property L,
- // R, or AL. If it has the R or AL property, it is an RTL label; if it has
- // the L property, it is an LTR label.
- 1: []ruleTest{{
- in: strL,
- dir: bidi.LeftToRight,
- }, {
- in: strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strAN,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- }, {
- in: strEN,
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: len(strEN),
- }, {
- in: strES,
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: len(strES),
- }, {
- in: strET,
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: len(strET),
- }, {
- in: strCS,
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: len(strCS),
- }, {
- in: strNSM,
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: len(strNSM),
- }, {
- in: strBN,
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: len(strBN),
- }, {
- in: strB,
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: len(strB),
- }, {
- in: strS,
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: len(strS),
- }, {
- in: strWS,
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: len(strWS),
- }, {
- in: strON,
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: len(strON),
- }, {
- in: strEN + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 3,
- }, {
- in: strES + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 2,
- }, {
- in: strET + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 1,
- }, {
- in: strCS + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 1,
- }, {
- in: strNSM + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 2,
- }, {
- in: strBN + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 3,
- }, {
- in: strB + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 3,
- }, {
- in: strS + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 1,
- }, {
- in: strWS + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 1,
- }, {
- in: strON + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 1,
- }},
-
- // Rule 2.2: In an RTL label, only characters with the Bidi properties R,
- // AL, AN, EN, ES, CS, ET, ON, BN, or NSM are allowed.
- 2: []ruleTest{{
- in: strR + strR + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strAL + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strAN + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strEN + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strES + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strCS + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strET + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strON + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strBN + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strNSM + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strL + strR,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strR + strB + strR,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strR + strS + strAL,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strR + strWS + strAL,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strAL + strR + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strAL + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strAN + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strEN + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strES + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strCS + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strET + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strON + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strBN + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strNSM + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strL + strR,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }, {
- in: strAL + strB + strR,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }, {
- in: strAL + strS + strAL,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }, {
- in: strAL + strWS + strAL,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }},
-
- // Rule 2.3: In an RTL label, the end of the label must be a character with
- // Bidi property R, AL, EN, or AN, followed by zero or more characters with
- // Bidi property NSM.
- 3: []ruleTest{{
- in: strR + strNSM,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strAL + strNSM,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strEN + strNSM + strNSM,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strAN,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strES + strNSM,
- dir: bidi.RightToLeft,
- n: len(strR + strES + strNSM),
- err: ErrInvalid,
- }, {
- in: strR + strCS + strNSM + strNSM,
- dir: bidi.RightToLeft,
- n: len(strR + strCS + strNSM + strNSM),
- err: ErrInvalid,
- }, {
- in: strR + strET,
- dir: bidi.RightToLeft,
- n: len(strR + strET),
- err: ErrInvalid,
- }, {
- in: strR + strON + strNSM,
- dir: bidi.RightToLeft,
- n: len(strR + strON + strNSM),
- err: ErrInvalid,
- }, {
- in: strR + strBN + strNSM + strNSM,
- dir: bidi.RightToLeft,
- n: len(strR + strBN + strNSM + strNSM),
- err: ErrInvalid,
- }, {
- in: strR + strL + strNSM,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strR + strB + strNSM + strNSM,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strR + strS,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strR + strWS,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strAL + strNSM,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strAL + strNSM,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strEN + strNSM + strNSM,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strAN,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strES + strNSM,
- dir: bidi.RightToLeft,
- n: len(strAL + strES + strNSM),
- err: ErrInvalid,
- }, {
- in: strAL + strCS + strNSM + strNSM,
- dir: bidi.RightToLeft,
- n: len(strAL + strCS + strNSM + strNSM),
- err: ErrInvalid,
- }, {
- in: strAL + strET,
- dir: bidi.RightToLeft,
- n: len(strAL + strET),
- err: ErrInvalid,
- }, {
- in: strAL + strON + strNSM,
- dir: bidi.RightToLeft,
- n: len(strAL + strON + strNSM),
- err: ErrInvalid,
- }, {
- in: strAL + strBN + strNSM + strNSM,
- dir: bidi.RightToLeft,
- n: len(strAL + strBN + strNSM + strNSM),
- err: ErrInvalid,
- }, {
- in: strAL + strL + strNSM,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }, {
- in: strAL + strB + strNSM + strNSM,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }, {
- in: strAL + strS,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }, {
- in: strAL + strWS,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }},
-
- // Rule 2.4: In an RTL label, if an EN is present, no AN may be present,
- // and vice versa.
- 4: []ruleTest{{
- in: strR + strEN + strAN,
- dir: bidi.RightToLeft,
- n: len(strR + strEN),
- err: ErrInvalid,
- }, {
- in: strR + strAN + strEN + strNSM,
- dir: bidi.RightToLeft,
- n: len(strR + strAN),
- err: ErrInvalid,
- }, {
- in: strAL + strEN + strAN,
- dir: bidi.RightToLeft,
- n: len(strAL + strEN),
- err: ErrInvalid,
- }, {
- in: strAL + strAN + strEN + strNSM,
- dir: bidi.RightToLeft,
- n: len(strAL + strAN),
- err: ErrInvalid,
- }},
-
- // Rule 2.5: In an LTR label, only characters with the Bidi properties L,
- // EN, ES, CS, ET, ON, BN, or NSM are allowed.
- 5: []ruleTest{{
- in: strL + strL + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strEN + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strES + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strCS + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strET + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strON + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strBN + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strNSM + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strR + strL,
- dir: bidi.RightToLeft,
- n: len(strL),
- err: ErrInvalid,
- }, {
- in: strL + strAL + strL,
- dir: bidi.RightToLeft,
- n: len(strL),
- err: ErrInvalid,
- }, {
- in: strL + strAN + strL,
- dir: bidi.RightToLeft,
- n: len(strL),
- err: ErrInvalid,
- }, {
- in: strL + strB + strL,
- dir: bidi.LeftToRight,
- n: len(strL + strB + strL),
- err: ErrInvalid,
- }, {
- in: strL + strB + strL + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strB + strL),
- err: ErrInvalid,
- }, {
- in: strL + strS + strL,
- dir: bidi.LeftToRight,
- n: len(strL + strS + strL),
- err: ErrInvalid,
- }, {
- in: strL + strS + strL + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strS + strL),
- err: ErrInvalid,
- }, {
- in: strL + strWS + strL,
- dir: bidi.LeftToRight,
- n: len(strL + strWS + strL),
- err: ErrInvalid,
- }, {
- in: strL + strWS + strL + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strWS + strL),
- err: ErrInvalid,
- }},
-
- // Rule 2.6: In an LTR label, the end of the label must be a character with
- // Bidi property L or EN, followed by zero or more characters with Bidi
- // property NSM.
- 6: []ruleTest{{
- in: strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strNSM,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strNSM + strNSM,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strEN,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strEN + strNSM,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strEN + strNSM + strNSM,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strES,
- dir: bidi.LeftToRight,
- n: len(strL + strES),
- err: ErrInvalid,
- }, {
- in: strL + strES + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strES),
- err: ErrInvalid,
- }, {
- in: strL + strCS,
- dir: bidi.LeftToRight,
- n: len(strL + strCS),
- err: ErrInvalid,
- }, {
- in: strL + strCS + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strCS),
- err: ErrInvalid,
- }, {
- in: strL + strET,
- dir: bidi.LeftToRight,
- n: len(strL + strET),
- err: ErrInvalid,
- }, {
- in: strL + strET + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strET),
- err: ErrInvalid,
- }, {
- in: strL + strON,
- dir: bidi.LeftToRight,
- n: len(strL + strON),
- err: ErrInvalid,
- }, {
- in: strL + strON + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strON),
- err: ErrInvalid,
- }, {
- in: strL + strBN,
- dir: bidi.LeftToRight,
- n: len(strL + strBN),
- err: ErrInvalid,
- }, {
- in: strL + strBN + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strBN),
- err: ErrInvalid,
- }, {
- in: strL + strR,
- dir: bidi.RightToLeft,
- n: len(strL),
- err: ErrInvalid,
- }, {
- in: strL + strAL,
- dir: bidi.RightToLeft,
- n: len(strL),
- err: ErrInvalid,
- }, {
- in: strL + strAN,
- dir: bidi.RightToLeft,
- n: len(strL),
- err: ErrInvalid,
- }, {
- in: strL + strB,
- dir: bidi.LeftToRight,
- n: len(strL + strB),
- err: ErrInvalid,
- }, {
- in: strL + strB + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strB),
- err: ErrInvalid,
- }, {
- in: strL + strS,
- dir: bidi.LeftToRight,
- n: len(strL + strS),
- err: ErrInvalid,
- }, {
- in: strL + strS + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strS),
- err: ErrInvalid,
- }, {
- in: strL + strWS,
- dir: bidi.LeftToRight,
- n: len(strL + strWS),
- err: ErrInvalid,
- }, {
- in: strL + strWS + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strWS),
- err: ErrInvalid,
- }},
-
- // Incremental processing.
- 9: []ruleTest{{
- in: "e\u0301", // é
- dir: bidi.LeftToRight,
-
- pSrc: 2,
- nSrc: 1,
- err0: transform.ErrShortSrc,
- }, {
- in: "e\u1000f", // é
- dir: bidi.LeftToRight,
-
- pSrc: 3,
- nSrc: 1,
- err0: transform.ErrShortSrc,
- }, {
- // Remain invalid once invalid.
- in: strR + "ab",
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
-
- pSrc: len(strR) + 1,
- nSrc: len(strR),
- err0: ErrInvalid,
- }, {
- // Short destination
- in: "abcdefghij",
- dir: bidi.LeftToRight,
-
- pSrc: 10,
- szDst: 5,
- nSrc: 5,
- err0: transform.ErrShortDst,
- }, {
- in: "\U000102f7",
- dir: bidi.LeftToRight,
- n: len("\U000102f7"),
- err: ErrInvalid,
- }, {
- // Short destination splitting input rune
- in: "e\u0301",
- dir: bidi.LeftToRight,
-
- pSrc: 3,
- szDst: 2,
- nSrc: 1,
- err0: transform.ErrShortDst,
- }, {
- // Unicode 10.0.0 IDNA test string.
- in: "FAX\u2a77\U0001d186",
- dir: bidi.LeftToRight,
- n: len("FAX\u2a77\U0001d186"),
- err: ErrInvalid,
- }, {
- in: "\x80\u0660",
- dir: bidi.RightToLeft,
- n: 0,
- err: ErrInvalid,
- }},
-}
diff --git a/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0_test.go b/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0_test.go
deleted file mode 100644
index 008874ed3..000000000
--- a/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0_test.go
+++ /dev/null
@@ -1,668 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !go1.10
-
-package bidirule
-
-import (
- "golang.org/x/text/transform"
- "golang.org/x/text/unicode/bidi"
-)
-
-var testCases = [][]ruleTest{
- // Go-specific rules.
- // Invalid UTF-8 is invalid.
- 0: []ruleTest{{
- in: "",
- dir: bidi.LeftToRight,
- }, {
- in: "\x80",
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: 0,
- }, {
- in: "\xcc",
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: 0,
- }, {
- in: "abc\x80",
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: 3,
- }, {
- in: "abc\xcc",
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: 3,
- }, {
- in: "abc\xccdef",
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: 3,
- }, {
- in: "\xccdef",
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: 0,
- }, {
- in: strR + "\x80",
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: len(strR),
- }, {
- in: strR + "\xcc",
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: len(strR),
- }, {
- in: strAL + "\xcc" + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: len(strAL),
- }, {
- in: "\xcc" + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 0,
- }},
-
- // Rule 2.1: The first character must be a character with Bidi property L,
- // R, or AL. If it has the R or AL property, it is an RTL label; if it has
- // the L property, it is an LTR label.
- 1: []ruleTest{{
- in: strL,
- dir: bidi.LeftToRight,
- }, {
- in: strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strAN,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- }, {
- in: strEN,
- dir: bidi.LeftToRight,
- err: nil, // not an RTL string
- }, {
- in: strES,
- dir: bidi.LeftToRight,
- err: nil, // not an RTL string
- }, {
- in: strET,
- dir: bidi.LeftToRight,
- err: nil, // not an RTL string
- }, {
- in: strCS,
- dir: bidi.LeftToRight,
- err: nil, // not an RTL string
- }, {
- in: strNSM,
- dir: bidi.LeftToRight,
- err: nil, // not an RTL string
- }, {
- in: strBN,
- dir: bidi.LeftToRight,
- err: nil, // not an RTL string
- }, {
- in: strB,
- dir: bidi.LeftToRight,
- err: nil, // not an RTL string
- }, {
- in: strS,
- dir: bidi.LeftToRight,
- err: nil, // not an RTL string
- }, {
- in: strWS,
- dir: bidi.LeftToRight,
- err: nil, // not an RTL string
- }, {
- in: strON,
- dir: bidi.LeftToRight,
- err: nil, // not an RTL string
- }, {
- in: strEN + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 3,
- }, {
- in: strES + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 2,
- }, {
- in: strET + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 1,
- }, {
- in: strCS + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 1,
- }, {
- in: strNSM + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 2,
- }, {
- in: strBN + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 3,
- }, {
- in: strB + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 3,
- }, {
- in: strS + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 1,
- }, {
- in: strWS + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 1,
- }, {
- in: strON + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 1,
- }},
-
- // Rule 2.2: In an RTL label, only characters with the Bidi properties R,
- // AL, AN, EN, ES, CS, ET, ON, BN, or NSM are allowed.
- 2: []ruleTest{{
- in: strR + strR + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strAL + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strAN + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strEN + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strES + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strCS + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strET + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strON + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strBN + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strNSM + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strL + strR,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strR + strB + strR,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strR + strS + strAL,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strR + strWS + strAL,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strAL + strR + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strAL + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strAN + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strEN + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strES + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strCS + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strET + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strON + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strBN + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strNSM + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strL + strR,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }, {
- in: strAL + strB + strR,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }, {
- in: strAL + strS + strAL,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }, {
- in: strAL + strWS + strAL,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }},
-
- // Rule 2.3: In an RTL label, the end of the label must be a character with
- // Bidi property R, AL, EN, or AN, followed by zero or more characters with
- // Bidi property NSM.
- 3: []ruleTest{{
- in: strR + strNSM,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strAL + strNSM,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strEN + strNSM + strNSM,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strAN,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strES + strNSM,
- dir: bidi.RightToLeft,
- n: len(strR + strES + strNSM),
- err: ErrInvalid,
- }, {
- in: strR + strCS + strNSM + strNSM,
- dir: bidi.RightToLeft,
- n: len(strR + strCS + strNSM + strNSM),
- err: ErrInvalid,
- }, {
- in: strR + strET,
- dir: bidi.RightToLeft,
- n: len(strR + strET),
- err: ErrInvalid,
- }, {
- in: strR + strON + strNSM,
- dir: bidi.RightToLeft,
- n: len(strR + strON + strNSM),
- err: ErrInvalid,
- }, {
- in: strR + strBN + strNSM + strNSM,
- dir: bidi.RightToLeft,
- n: len(strR + strBN + strNSM + strNSM),
- err: ErrInvalid,
- }, {
- in: strR + strL + strNSM,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strR + strB + strNSM + strNSM,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strR + strS,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strR + strWS,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strAL + strNSM,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strAL + strNSM,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strEN + strNSM + strNSM,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strAN,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strES + strNSM,
- dir: bidi.RightToLeft,
- n: len(strAL + strES + strNSM),
- err: ErrInvalid,
- }, {
- in: strAL + strCS + strNSM + strNSM,
- dir: bidi.RightToLeft,
- n: len(strAL + strCS + strNSM + strNSM),
- err: ErrInvalid,
- }, {
- in: strAL + strET,
- dir: bidi.RightToLeft,
- n: len(strAL + strET),
- err: ErrInvalid,
- }, {
- in: strAL + strON + strNSM,
- dir: bidi.RightToLeft,
- n: len(strAL + strON + strNSM),
- err: ErrInvalid,
- }, {
- in: strAL + strBN + strNSM + strNSM,
- dir: bidi.RightToLeft,
- n: len(strAL + strBN + strNSM + strNSM),
- err: ErrInvalid,
- }, {
- in: strAL + strL + strNSM,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }, {
- in: strAL + strB + strNSM + strNSM,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }, {
- in: strAL + strS,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }, {
- in: strAL + strWS,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }},
-
- // Rule 2.4: In an RTL label, if an EN is present, no AN may be present,
- // and vice versa.
- 4: []ruleTest{{
- in: strR + strEN + strAN,
- dir: bidi.RightToLeft,
- n: len(strR + strEN),
- err: ErrInvalid,
- }, {
- in: strR + strAN + strEN + strNSM,
- dir: bidi.RightToLeft,
- n: len(strR + strAN),
- err: ErrInvalid,
- }, {
- in: strAL + strEN + strAN,
- dir: bidi.RightToLeft,
- n: len(strAL + strEN),
- err: ErrInvalid,
- }, {
- in: strAL + strAN + strEN + strNSM,
- dir: bidi.RightToLeft,
- n: len(strAL + strAN),
- err: ErrInvalid,
- }},
-
- // Rule 2.5: In an LTR label, only characters with the Bidi properties L,
- // EN, ES, CS, ET, ON, BN, or NSM are allowed.
- 5: []ruleTest{{
- in: strL + strL + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strEN + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strES + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strCS + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strET + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strON + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strBN + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strNSM + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strR + strL,
- dir: bidi.RightToLeft,
- n: len(strL),
- err: ErrInvalid,
- }, {
- in: strL + strAL + strL,
- dir: bidi.RightToLeft,
- n: len(strL),
- err: ErrInvalid,
- }, {
- in: strL + strAN + strL,
- dir: bidi.RightToLeft,
- n: len(strL),
- err: ErrInvalid,
- }, {
- in: strL + strB + strL,
- dir: bidi.LeftToRight,
- n: len(strL + strAN + strL),
- err: nil,
- }, {
- in: strL + strB + strL + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strB + strL),
- err: ErrInvalid,
- }, {
- in: strL + strS + strL,
- dir: bidi.LeftToRight,
- n: len(strL + strS + strL),
- err: nil,
- }, {
- in: strL + strS + strL + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strS + strL),
- err: ErrInvalid,
- }, {
- in: strL + strWS + strL,
- dir: bidi.LeftToRight,
- n: len(strL + strWS + strL),
- err: nil,
- }, {
- in: strL + strWS + strL + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strWS + strL),
- err: ErrInvalid,
- }},
-
- // Rule 2.6: In an LTR label, the end of the label must be a character with
- // Bidi property L or EN, followed by zero or more characters with Bidi
- // property NSM.
- 6: []ruleTest{{
- in: strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strNSM,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strNSM + strNSM,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strEN,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strEN + strNSM,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strEN + strNSM + strNSM,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strES,
- dir: bidi.LeftToRight,
- n: len(strL + strES),
- err: nil,
- }, {
- in: strL + strES + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strES),
- err: ErrInvalid,
- }, {
- in: strL + strCS,
- dir: bidi.LeftToRight,
- n: len(strL + strCS),
- err: nil,
- }, {
- in: strL + strCS + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strCS),
- err: ErrInvalid,
- }, {
- in: strL + strET,
- dir: bidi.LeftToRight,
- n: len(strL + strET),
- err: nil,
- }, {
- in: strL + strET + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strET),
- err: ErrInvalid,
- }, {
- in: strL + strON,
- dir: bidi.LeftToRight,
- n: len(strL + strON),
- err: nil,
- }, {
- in: strL + strON + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strON),
- err: ErrInvalid,
- }, {
- in: strL + strBN,
- dir: bidi.LeftToRight,
- n: len(strL + strBN),
- err: nil,
- }, {
- in: strL + strBN + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strBN),
- err: ErrInvalid,
- }, {
- in: strL + strR,
- dir: bidi.RightToLeft,
- n: len(strL),
- err: ErrInvalid,
- }, {
- in: strL + strAL,
- dir: bidi.RightToLeft,
- n: len(strL),
- err: ErrInvalid,
- }, {
- in: strL + strAN,
- dir: bidi.RightToLeft,
- n: len(strL),
- err: ErrInvalid,
- }, {
- in: strL + strB,
- dir: bidi.LeftToRight,
- n: len(strL + strB),
- err: nil,
- }, {
- in: strL + strB + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strB),
- err: ErrInvalid,
- }, {
- in: strL + strB,
- dir: bidi.LeftToRight,
- n: len(strL + strB),
- err: nil,
- }, {
- in: strL + strB + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strB),
- err: ErrInvalid,
- }, {
- in: strL + strB,
- dir: bidi.LeftToRight,
- n: len(strL + strB),
- err: nil,
- }, {
- in: strL + strB + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strB),
- err: ErrInvalid,
- }},
-
- // Incremental processing.
- 9: []ruleTest{{
- in: "e\u0301", // é
- dir: bidi.LeftToRight,
-
- pSrc: 2,
- nSrc: 1,
- err0: transform.ErrShortSrc,
- }, {
- in: "e\u1000f", // é
- dir: bidi.LeftToRight,
-
- pSrc: 3,
- nSrc: 1,
- err0: transform.ErrShortSrc,
- }, {
- // Remain invalid once invalid.
- in: strR + "ab",
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
-
- pSrc: len(strR) + 1,
- nSrc: len(strR),
- err0: ErrInvalid,
- }, {
- // Short destination
- in: "abcdefghij",
- dir: bidi.LeftToRight,
-
- pSrc: 10,
- szDst: 5,
- nSrc: 5,
- err0: transform.ErrShortDst,
- }, {
- // Short destination splitting input rune
- in: "e\u0301",
- dir: bidi.LeftToRight,
-
- pSrc: 3,
- szDst: 2,
- nSrc: 1,
- err0: transform.ErrShortDst,
- }},
-}
diff --git a/vendor/golang.org/x/text/secure/bidirule/bidirule_test.go b/vendor/golang.org/x/text/secure/bidirule/bidirule_test.go
deleted file mode 100644
index e8fde3383..000000000
--- a/vendor/golang.org/x/text/secure/bidirule/bidirule_test.go
+++ /dev/null
@@ -1,168 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package bidirule
-
-import (
- "fmt"
- "testing"
-
- "golang.org/x/text/internal/testtext"
- "golang.org/x/text/unicode/bidi"
-)
-
-const (
- strL = "ABC" // Left to right - most letters in LTR scripts
- strR = "עברית" // Right to left - most letters in non-Arabic RTL scripts
- strAL = "دبي" // Arabic letters - most letters in the Arabic script
- strEN = "123" // European Number (0-9, and Extended Arabic-Indic numbers)
- strES = "+-" // European Number Separator (+ and -)
- strET = "$" // European Number Terminator (currency symbols, the hash sign, the percent sign and so on)
- strAN = "\u0660" // Arabic Number; this encompasses the Arabic-Indic numbers, but not the Extended Arabic-Indic numbers
- strCS = "," // Common Number Separator (. , / : et al)
- strNSM = "\u0300" // Nonspacing Mark - most combining accents
- strBN = "\u200d" // Boundary Neutral - control characters (ZWNJ, ZWJ, and others)
- strB = "\u2029" // Paragraph Separator
- strS = "\u0009" // Segment Separator
- strWS = " " // Whitespace, including the SPACE character
- strON = "@" // Other Neutrals, including @, &, parentheses, MIDDLE DOT
-)
-
-type ruleTest struct {
- in string
- dir bidi.Direction
- n int // position at which the rule fails
- err error
-
- // For tests that split the string in two.
- pSrc int // number of source bytes to consume first
- szDst int // size of destination buffer
- nSrc int // source bytes consumed and bytes written
- err0 error // error after first run
-}
-
-func init() {
- for rule, cases := range testCases {
- for i, tc := range cases {
- if tc.err == nil {
- testCases[rule][i].n = len(tc.in)
- }
- }
- }
-}
-
-func doTests(t *testing.T, fn func(t *testing.T, tc ruleTest)) {
- for rule, cases := range testCases {
- for i, tc := range cases {
- name := fmt.Sprintf("%d/%d:%+q:%s", rule, i, tc.in, tc.in)
- testtext.Run(t, name, func(t *testing.T) {
- fn(t, tc)
- })
- }
- }
-}
-
-func TestDirection(t *testing.T) {
- doTests(t, func(t *testing.T, tc ruleTest) {
- dir := Direction([]byte(tc.in))
- if dir != tc.dir {
- t.Errorf("dir was %v; want %v", dir, tc.dir)
- }
- })
-}
-
-func TestDirectionString(t *testing.T) {
- doTests(t, func(t *testing.T, tc ruleTest) {
- dir := DirectionString(tc.in)
- if dir != tc.dir {
- t.Errorf("dir was %v; want %v", dir, tc.dir)
- }
- })
-}
-
-func TestValid(t *testing.T) {
- doTests(t, func(t *testing.T, tc ruleTest) {
- got := Valid([]byte(tc.in))
- want := tc.err == nil
- if got != want {
- t.Fatalf("Valid: got %v; want %v", got, want)
- }
-
- got = ValidString(tc.in)
- want = tc.err == nil
- if got != want {
- t.Fatalf("Valid: got %v; want %v", got, want)
- }
- })
-}
-
-func TestSpan(t *testing.T) {
- doTests(t, func(t *testing.T, tc ruleTest) {
- // Skip tests that test for limited destination buffer size.
- if tc.szDst > 0 {
- return
- }
-
- r := New()
- src := []byte(tc.in)
-
- n, err := r.Span(src[:tc.pSrc], tc.pSrc == len(tc.in))
- if err != tc.err0 {
- t.Errorf("err0 was %v; want %v", err, tc.err0)
- }
- if n != tc.nSrc {
- t.Fatalf("nSrc was %d; want %d", n, tc.nSrc)
- }
-
- n, err = r.Span(src[n:], true)
- if err != tc.err {
- t.Errorf("error was %v; want %v", err, tc.err)
- }
- if got := n + tc.nSrc; got != tc.n {
- t.Errorf("n was %d; want %d", got, tc.n)
- }
- })
-}
-
-func TestTransform(t *testing.T) {
- doTests(t, func(t *testing.T, tc ruleTest) {
- r := New()
-
- src := []byte(tc.in)
- dst := make([]byte, len(tc.in))
- if tc.szDst > 0 {
- dst = make([]byte, tc.szDst)
- }
-
- // First transform operates on a zero-length string for most tests.
- nDst, nSrc, err := r.Transform(dst, src[:tc.pSrc], tc.pSrc == len(tc.in))
- if err != tc.err0 {
- t.Errorf("err0 was %v; want %v", err, tc.err0)
- }
- if nDst != nSrc {
- t.Fatalf("nDst (%d) and nSrc (%d) should match", nDst, nSrc)
- }
- if nSrc != tc.nSrc {
- t.Fatalf("nSrc was %d; want %d", nSrc, tc.nSrc)
- }
-
- dst1 := make([]byte, len(tc.in))
- copy(dst1, dst[:nDst])
-
- nDst, nSrc, err = r.Transform(dst1[nDst:], src[nSrc:], true)
- if err != tc.err {
- t.Errorf("error was %v; want %v", err, tc.err)
- }
- if nDst != nSrc {
- t.Fatalf("nDst (%d) and nSrc (%d) should match", nDst, nSrc)
- }
- n := nSrc + tc.nSrc
- if n != tc.n {
- t.Fatalf("n was %d; want %d", n, tc.n)
- }
- if got, want := string(dst1[:n]), tc.in[:tc.n]; got != want {
- t.Errorf("got %+q; want %+q", got, want)
- }
- })
-}
diff --git a/vendor/golang.org/x/text/transform/examples_test.go b/vendor/golang.org/x/text/transform/examples_test.go
deleted file mode 100644
index f2e284dba..000000000
--- a/vendor/golang.org/x/text/transform/examples_test.go
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package transform_test
-
-import (
- "fmt"
- "unicode"
-
- "golang.org/x/text/transform"
- "golang.org/x/text/unicode/norm"
-)
-
-func ExampleRemoveFunc() {
- input := []byte(`tschüß; до свидания`)
-
- b := make([]byte, len(input))
-
- t := transform.RemoveFunc(unicode.IsSpace)
- n, _, _ := t.Transform(b, input, true)
- fmt.Println(string(b[:n]))
-
- t = transform.RemoveFunc(func(r rune) bool {
- return !unicode.Is(unicode.Latin, r)
- })
- n, _, _ = t.Transform(b, input, true)
- fmt.Println(string(b[:n]))
-
- n, _, _ = t.Transform(b, norm.NFD.Bytes(input), true)
- fmt.Println(string(b[:n]))
-
- // Output:
- // tschüß;досвидания
- // tschüß
- // tschuß
-}
diff --git a/vendor/golang.org/x/text/transform/transform_test.go b/vendor/golang.org/x/text/transform/transform_test.go
deleted file mode 100644
index 771633d1d..000000000
--- a/vendor/golang.org/x/text/transform/transform_test.go
+++ /dev/null
@@ -1,1317 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package transform
-
-import (
- "bytes"
- "errors"
- "fmt"
- "io/ioutil"
- "strconv"
- "strings"
- "testing"
- "time"
- "unicode/utf8"
-
- "golang.org/x/text/internal/testtext"
-)
-
-type lowerCaseASCII struct{ NopResetter }
-
-func (lowerCaseASCII) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- n := len(src)
- if n > len(dst) {
- n, err = len(dst), ErrShortDst
- }
- for i, c := range src[:n] {
- if 'A' <= c && c <= 'Z' {
- c += 'a' - 'A'
- }
- dst[i] = c
- }
- return n, n, err
-}
-
-// lowerCaseASCIILookahead lowercases the string and reports ErrShortSrc as long
-// as the input is not atEOF.
-type lowerCaseASCIILookahead struct{ NopResetter }
-
-func (lowerCaseASCIILookahead) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- n := len(src)
- if n > len(dst) {
- n, err = len(dst), ErrShortDst
- }
- for i, c := range src[:n] {
- if 'A' <= c && c <= 'Z' {
- c += 'a' - 'A'
- }
- dst[i] = c
- }
- if !atEOF {
- err = ErrShortSrc
- }
- return n, n, err
-}
-
-var errYouMentionedX = errors.New("you mentioned X")
-
-type dontMentionX struct{ NopResetter }
-
-func (dontMentionX) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- n := len(src)
- if n > len(dst) {
- n, err = len(dst), ErrShortDst
- }
- for i, c := range src[:n] {
- if c == 'X' {
- return i, i, errYouMentionedX
- }
- dst[i] = c
- }
- return n, n, err
-}
-
-var errAtEnd = errors.New("error after all text")
-
-type errorAtEnd struct{ NopResetter }
-
-func (errorAtEnd) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- n := copy(dst, src)
- if n < len(src) {
- return n, n, ErrShortDst
- }
- if atEOF {
- return n, n, errAtEnd
- }
- return n, n, nil
-}
-
-type replaceWithConstant struct {
- replacement string
- written int
-}
-
-func (t *replaceWithConstant) Reset() {
- t.written = 0
-}
-
-func (t *replaceWithConstant) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- if atEOF {
- nDst = copy(dst, t.replacement[t.written:])
- t.written += nDst
- if t.written < len(t.replacement) {
- err = ErrShortDst
- }
- }
- return nDst, len(src), err
-}
-
-type addAnXAtTheEnd struct{ NopResetter }
-
-func (addAnXAtTheEnd) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- n := copy(dst, src)
- if n < len(src) {
- return n, n, ErrShortDst
- }
- if !atEOF {
- return n, n, nil
- }
- if len(dst) == n {
- return n, n, ErrShortDst
- }
- dst[n] = 'X'
- return n + 1, n, nil
-}
-
-// doublerAtEOF is a strange Transformer that transforms "this" to "tthhiiss",
-// but only if atEOF is true.
-type doublerAtEOF struct{ NopResetter }
-
-func (doublerAtEOF) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- if !atEOF {
- return 0, 0, ErrShortSrc
- }
- for i, c := range src {
- if 2*i+2 >= len(dst) {
- return 2 * i, i, ErrShortDst
- }
- dst[2*i+0] = c
- dst[2*i+1] = c
- }
- return 2 * len(src), len(src), nil
-}
-
-// rleDecode and rleEncode implement a toy run-length encoding: "aabbbbbbbbbb"
-// is encoded as "2a10b". The decoding is assumed to not contain any numbers.
-
-type rleDecode struct{ NopResetter }
-
-func (rleDecode) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
-loop:
- for len(src) > 0 {
- n := 0
- for i, c := range src {
- if '0' <= c && c <= '9' {
- n = 10*n + int(c-'0')
- continue
- }
- if i == 0 {
- return nDst, nSrc, errors.New("rleDecode: bad input")
- }
- if n > len(dst) {
- return nDst, nSrc, ErrShortDst
- }
- for j := 0; j < n; j++ {
- dst[j] = c
- }
- dst, src = dst[n:], src[i+1:]
- nDst, nSrc = nDst+n, nSrc+i+1
- continue loop
- }
- if atEOF {
- return nDst, nSrc, errors.New("rleDecode: bad input")
- }
- return nDst, nSrc, ErrShortSrc
- }
- return nDst, nSrc, nil
-}
-
-type rleEncode struct {
- NopResetter
-
- // allowStutter means that "xxxxxxxx" can be encoded as "5x3x"
- // instead of always as "8x".
- allowStutter bool
-}
-
-func (e rleEncode) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- for len(src) > 0 {
- n, c0 := len(src), src[0]
- for i, c := range src[1:] {
- if c != c0 {
- n = i + 1
- break
- }
- }
- if n == len(src) && !atEOF && !e.allowStutter {
- return nDst, nSrc, ErrShortSrc
- }
- s := strconv.Itoa(n)
- if len(s) >= len(dst) {
- return nDst, nSrc, ErrShortDst
- }
- copy(dst, s)
- dst[len(s)] = c0
- dst, src = dst[len(s)+1:], src[n:]
- nDst, nSrc = nDst+len(s)+1, nSrc+n
- }
- return nDst, nSrc, nil
-}
-
-// trickler consumes all input bytes, but writes a single byte at a time to dst.
-type trickler []byte
-
-func (t *trickler) Reset() {
- *t = nil
-}
-
-func (t *trickler) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- *t = append(*t, src...)
- if len(*t) == 0 {
- return 0, 0, nil
- }
- if len(dst) == 0 {
- return 0, len(src), ErrShortDst
- }
- dst[0] = (*t)[0]
- *t = (*t)[1:]
- if len(*t) > 0 {
- err = ErrShortDst
- }
- return 1, len(src), err
-}
-
-// delayedTrickler is like trickler, but delays writing output to dst. This is
-// highly unlikely to be relevant in practice, but it seems like a good idea
-// to have some tolerance as long as progress can be detected.
-type delayedTrickler []byte
-
-func (t *delayedTrickler) Reset() {
- *t = nil
-}
-
-func (t *delayedTrickler) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- if len(*t) > 0 && len(dst) > 0 {
- dst[0] = (*t)[0]
- *t = (*t)[1:]
- nDst = 1
- }
- *t = append(*t, src...)
- if len(*t) > 0 {
- err = ErrShortDst
- }
- return nDst, len(src), err
-}
-
-type testCase struct {
- desc string
- t Transformer
- src string
- dstSize int
- srcSize int
- ioSize int
- wantStr string
- wantErr error
- wantIter int // number of iterations taken; 0 means we don't care.
-}
-
-func (t testCase) String() string {
- return tstr(t.t) + "; " + t.desc
-}
-
-func tstr(t Transformer) string {
- if stringer, ok := t.(fmt.Stringer); ok {
- return stringer.String()
- }
- s := fmt.Sprintf("%T", t)
- return s[1+strings.Index(s, "."):]
-}
-
-func (c chain) String() string {
- buf := &bytes.Buffer{}
- buf.WriteString("Chain(")
- for i, l := range c.link[:len(c.link)-1] {
- if i != 0 {
- fmt.Fprint(buf, ", ")
- }
- buf.WriteString(tstr(l.t))
- }
- buf.WriteString(")")
- return buf.String()
-}
-
-var testCases = []testCase{
- {
- desc: "empty",
- t: lowerCaseASCII{},
- src: "",
- dstSize: 100,
- srcSize: 100,
- wantStr: "",
- },
-
- {
- desc: "basic",
- t: lowerCaseASCII{},
- src: "Hello WORLD.",
- dstSize: 100,
- srcSize: 100,
- wantStr: "hello world.",
- },
-
- {
- desc: "small dst",
- t: lowerCaseASCII{},
- src: "Hello WORLD.",
- dstSize: 3,
- srcSize: 100,
- wantStr: "hello world.",
- },
-
- {
- desc: "small src",
- t: lowerCaseASCII{},
- src: "Hello WORLD.",
- dstSize: 100,
- srcSize: 4,
- wantStr: "hello world.",
- },
-
- {
- desc: "small buffers",
- t: lowerCaseASCII{},
- src: "Hello WORLD.",
- dstSize: 3,
- srcSize: 4,
- wantStr: "hello world.",
- },
-
- {
- desc: "very small buffers",
- t: lowerCaseASCII{},
- src: "Hello WORLD.",
- dstSize: 1,
- srcSize: 1,
- wantStr: "hello world.",
- },
-
- {
- desc: "small dst with lookahead",
- t: lowerCaseASCIILookahead{},
- src: "Hello WORLD.",
- dstSize: 3,
- srcSize: 100,
- wantStr: "hello world.",
- },
-
- {
- desc: "small src with lookahead",
- t: lowerCaseASCIILookahead{},
- src: "Hello WORLD.",
- dstSize: 100,
- srcSize: 4,
- wantStr: "hello world.",
- },
-
- {
- desc: "small buffers with lookahead",
- t: lowerCaseASCIILookahead{},
- src: "Hello WORLD.",
- dstSize: 3,
- srcSize: 4,
- wantStr: "hello world.",
- },
-
- {
- desc: "very small buffers with lookahead",
- t: lowerCaseASCIILookahead{},
- src: "Hello WORLD.",
- dstSize: 1,
- srcSize: 2,
- wantStr: "hello world.",
- },
-
- {
- desc: "user error",
- t: dontMentionX{},
- src: "The First Rule of Transform Club: don't mention Mister X, ever.",
- dstSize: 100,
- srcSize: 100,
- wantStr: "The First Rule of Transform Club: don't mention Mister ",
- wantErr: errYouMentionedX,
- },
-
- {
- desc: "user error at end",
- t: errorAtEnd{},
- src: "All goes well until it doesn't.",
- dstSize: 100,
- srcSize: 100,
- wantStr: "All goes well until it doesn't.",
- wantErr: errAtEnd,
- },
-
- {
- desc: "user error at end, incremental",
- t: errorAtEnd{},
- src: "All goes well until it doesn't.",
- dstSize: 10,
- srcSize: 10,
- wantStr: "All goes well until it doesn't.",
- wantErr: errAtEnd,
- },
-
- {
- desc: "replace entire non-empty string with one byte",
- t: &replaceWithConstant{replacement: "X"},
- src: "none of this will be copied",
- dstSize: 1,
- srcSize: 10,
- wantStr: "X",
- },
-
- {
- desc: "replace entire empty string with one byte",
- t: &replaceWithConstant{replacement: "X"},
- src: "",
- dstSize: 1,
- srcSize: 10,
- wantStr: "X",
- },
-
- {
- desc: "replace entire empty string with seven bytes",
- t: &replaceWithConstant{replacement: "ABCDEFG"},
- src: "",
- dstSize: 3,
- srcSize: 10,
- wantStr: "ABCDEFG",
- },
-
- {
- desc: "add an X (initialBufSize-1)",
- t: addAnXAtTheEnd{},
- src: aaa[:initialBufSize-1],
- dstSize: 10,
- srcSize: 10,
- wantStr: aaa[:initialBufSize-1] + "X",
- },
-
- {
- desc: "add an X (initialBufSize+0)",
- t: addAnXAtTheEnd{},
- src: aaa[:initialBufSize+0],
- dstSize: 10,
- srcSize: 10,
- wantStr: aaa[:initialBufSize+0] + "X",
- },
-
- {
- desc: "add an X (initialBufSize+1)",
- t: addAnXAtTheEnd{},
- src: aaa[:initialBufSize+1],
- dstSize: 10,
- srcSize: 10,
- wantStr: aaa[:initialBufSize+1] + "X",
- },
-
- {
- desc: "small buffers",
- t: dontMentionX{},
- src: "The First Rule of Transform Club: don't mention Mister X, ever.",
- dstSize: 10,
- srcSize: 10,
- wantStr: "The First Rule of Transform Club: don't mention Mister ",
- wantErr: errYouMentionedX,
- },
-
- {
- desc: "very small buffers",
- t: dontMentionX{},
- src: "The First Rule of Transform Club: don't mention Mister X, ever.",
- dstSize: 1,
- srcSize: 1,
- wantStr: "The First Rule of Transform Club: don't mention Mister ",
- wantErr: errYouMentionedX,
- },
-
- {
- desc: "only transform at EOF",
- t: doublerAtEOF{},
- src: "this",
- dstSize: 100,
- srcSize: 100,
- wantStr: "tthhiiss",
- },
-
- {
- desc: "basic",
- t: rleDecode{},
- src: "1a2b3c10d11e0f1g",
- dstSize: 100,
- srcSize: 100,
- wantStr: "abbcccddddddddddeeeeeeeeeeeg",
- },
-
- {
- desc: "long",
- t: rleDecode{},
- src: "12a23b34c45d56e99z",
- dstSize: 100,
- srcSize: 100,
- wantStr: strings.Repeat("a", 12) +
- strings.Repeat("b", 23) +
- strings.Repeat("c", 34) +
- strings.Repeat("d", 45) +
- strings.Repeat("e", 56) +
- strings.Repeat("z", 99),
- },
-
- {
- desc: "tight buffers",
- t: rleDecode{},
- src: "1a2b3c10d11e0f1g",
- dstSize: 11,
- srcSize: 3,
- wantStr: "abbcccddddddddddeeeeeeeeeeeg",
- },
-
- {
- desc: "short dst",
- t: rleDecode{},
- src: "1a2b3c10d11e0f1g",
- dstSize: 10,
- srcSize: 3,
- wantStr: "abbcccdddddddddd",
- wantErr: ErrShortDst,
- },
-
- {
- desc: "short src",
- t: rleDecode{},
- src: "1a2b3c10d11e0f1g",
- dstSize: 11,
- srcSize: 2,
- ioSize: 2,
- wantStr: "abbccc",
- wantErr: ErrShortSrc,
- },
-
- {
- desc: "basic",
- t: rleEncode{},
- src: "abbcccddddddddddeeeeeeeeeeeg",
- dstSize: 100,
- srcSize: 100,
- wantStr: "1a2b3c10d11e1g",
- },
-
- {
- desc: "long",
- t: rleEncode{},
- src: strings.Repeat("a", 12) +
- strings.Repeat("b", 23) +
- strings.Repeat("c", 34) +
- strings.Repeat("d", 45) +
- strings.Repeat("e", 56) +
- strings.Repeat("z", 99),
- dstSize: 100,
- srcSize: 100,
- wantStr: "12a23b34c45d56e99z",
- },
-
- {
- desc: "tight buffers",
- t: rleEncode{},
- src: "abbcccddddddddddeeeeeeeeeeeg",
- dstSize: 3,
- srcSize: 12,
- wantStr: "1a2b3c10d11e1g",
- },
-
- {
- desc: "short dst",
- t: rleEncode{},
- src: "abbcccddddddddddeeeeeeeeeeeg",
- dstSize: 2,
- srcSize: 12,
- wantStr: "1a2b3c",
- wantErr: ErrShortDst,
- },
-
- {
- desc: "short src",
- t: rleEncode{},
- src: "abbcccddddddddddeeeeeeeeeeeg",
- dstSize: 3,
- srcSize: 11,
- ioSize: 11,
- wantStr: "1a2b3c10d",
- wantErr: ErrShortSrc,
- },
-
- {
- desc: "allowStutter = false",
- t: rleEncode{allowStutter: false},
- src: "aaaabbbbbbbbccccddddd",
- dstSize: 10,
- srcSize: 10,
- wantStr: "4a8b4c5d",
- },
-
- {
- desc: "allowStutter = true",
- t: rleEncode{allowStutter: true},
- src: "aaaabbbbbbbbccccddddd",
- dstSize: 10,
- srcSize: 10,
- ioSize: 10,
- wantStr: "4a6b2b4c4d1d",
- },
-
- {
- desc: "trickler",
- t: &trickler{},
- src: "abcdefghijklm",
- dstSize: 3,
- srcSize: 15,
- wantStr: "abcdefghijklm",
- },
-
- {
- desc: "delayedTrickler",
- t: &delayedTrickler{},
- src: "abcdefghijklm",
- dstSize: 3,
- srcSize: 15,
- wantStr: "abcdefghijklm",
- },
-}
-
-func TestReader(t *testing.T) {
- for _, tc := range testCases {
- testtext.Run(t, tc.desc, func(t *testing.T) {
- r := NewReader(strings.NewReader(tc.src), tc.t)
- // Differently sized dst and src buffers are not part of the
- // exported API. We override them manually.
- r.dst = make([]byte, tc.dstSize)
- r.src = make([]byte, tc.srcSize)
- got, err := ioutil.ReadAll(r)
- str := string(got)
- if str != tc.wantStr || err != tc.wantErr {
- t.Errorf("\ngot %q, %v\nwant %q, %v", str, err, tc.wantStr, tc.wantErr)
- }
- })
- }
-}
-
-func TestWriter(t *testing.T) {
- tests := append(testCases, chainTests()...)
- for _, tc := range tests {
- sizes := []int{1, 2, 3, 4, 5, 10, 100, 1000}
- if tc.ioSize > 0 {
- sizes = []int{tc.ioSize}
- }
- for _, sz := range sizes {
- testtext.Run(t, fmt.Sprintf("%s/%d", tc.desc, sz), func(t *testing.T) {
- bb := &bytes.Buffer{}
- w := NewWriter(bb, tc.t)
- // Differently sized dst and src buffers are not part of the
- // exported API. We override them manually.
- w.dst = make([]byte, tc.dstSize)
- w.src = make([]byte, tc.srcSize)
- src := make([]byte, sz)
- var err error
- for b := tc.src; len(b) > 0 && err == nil; {
- n := copy(src, b)
- b = b[n:]
- m := 0
- m, err = w.Write(src[:n])
- if m != n && err == nil {
- t.Errorf("did not consume all bytes %d < %d", m, n)
- }
- }
- if err == nil {
- err = w.Close()
- }
- str := bb.String()
- if str != tc.wantStr || err != tc.wantErr {
- t.Errorf("\ngot %q, %v\nwant %q, %v", str, err, tc.wantStr, tc.wantErr)
- }
- })
- }
- }
-}
-
-func TestNop(t *testing.T) {
- testCases := []struct {
- str string
- dstSize int
- err error
- }{
- {"", 0, nil},
- {"", 10, nil},
- {"a", 0, ErrShortDst},
- {"a", 1, nil},
- {"a", 10, nil},
- }
- for i, tc := range testCases {
- dst := make([]byte, tc.dstSize)
- nDst, nSrc, err := Nop.Transform(dst, []byte(tc.str), true)
- want := tc.str
- if tc.dstSize < len(want) {
- want = want[:tc.dstSize]
- }
- if got := string(dst[:nDst]); got != want || err != tc.err || nSrc != nDst {
- t.Errorf("%d:\ngot %q, %d, %v\nwant %q, %d, %v", i, got, nSrc, err, want, nDst, tc.err)
- }
- }
-}
-
-func TestDiscard(t *testing.T) {
- testCases := []struct {
- str string
- dstSize int
- }{
- {"", 0},
- {"", 10},
- {"a", 0},
- {"ab", 10},
- }
- for i, tc := range testCases {
- nDst, nSrc, err := Discard.Transform(make([]byte, tc.dstSize), []byte(tc.str), true)
- if nDst != 0 || nSrc != len(tc.str) || err != nil {
- t.Errorf("%d:\ngot %q, %d, %v\nwant 0, %d, nil", i, nDst, nSrc, err, len(tc.str))
- }
- }
-}
-
-// mkChain creates a Chain transformer. x must be alternating between transformer
-// and bufSize, like T, (sz, T)*
-func mkChain(x ...interface{}) *chain {
- t := []Transformer{}
- for i := 0; i < len(x); i += 2 {
- t = append(t, x[i].(Transformer))
- }
- c := Chain(t...).(*chain)
- for i, j := 1, 1; i < len(x); i, j = i+2, j+1 {
- c.link[j].b = make([]byte, x[i].(int))
- }
- return c
-}
-
-func chainTests() []testCase {
- return []testCase{
- {
- desc: "nil error",
- t: mkChain(rleEncode{}, 100, lowerCaseASCII{}),
- src: "ABB",
- dstSize: 100,
- srcSize: 100,
- wantStr: "1a2b",
- wantErr: nil,
- wantIter: 1,
- },
-
- {
- desc: "short dst buffer",
- t: mkChain(lowerCaseASCII{}, 3, rleDecode{}),
- src: "1a2b3c10d11e0f1g",
- dstSize: 10,
- srcSize: 3,
- wantStr: "abbcccdddddddddd",
- wantErr: ErrShortDst,
- },
-
- {
- desc: "short internal dst buffer",
- t: mkChain(lowerCaseASCII{}, 3, rleDecode{}, 10, Nop),
- src: "1a2b3c10d11e0f1g",
- dstSize: 100,
- srcSize: 3,
- wantStr: "abbcccdddddddddd",
- wantErr: errShortInternal,
- },
-
- {
- desc: "short internal dst buffer from input",
- t: mkChain(rleDecode{}, 10, Nop),
- src: "1a2b3c10d11e0f1g",
- dstSize: 100,
- srcSize: 3,
- wantStr: "abbcccdddddddddd",
- wantErr: errShortInternal,
- },
-
- {
- desc: "empty short internal dst buffer",
- t: mkChain(lowerCaseASCII{}, 3, rleDecode{}, 10, Nop),
- src: "4a7b11e0f1g",
- dstSize: 100,
- srcSize: 3,
- wantStr: "aaaabbbbbbb",
- wantErr: errShortInternal,
- },
-
- {
- desc: "empty short internal dst buffer from input",
- t: mkChain(rleDecode{}, 10, Nop),
- src: "4a7b11e0f1g",
- dstSize: 100,
- srcSize: 3,
- wantStr: "aaaabbbbbbb",
- wantErr: errShortInternal,
- },
-
- {
- desc: "short internal src buffer after full dst buffer",
- t: mkChain(Nop, 5, rleEncode{}, 10, Nop),
- src: "cccccddddd",
- dstSize: 100,
- srcSize: 100,
- wantStr: "",
- wantErr: errShortInternal,
- wantIter: 1,
- },
-
- {
- desc: "short internal src buffer after short dst buffer; test lastFull",
- t: mkChain(rleDecode{}, 5, rleEncode{}, 4, Nop),
- src: "2a1b4c6d",
- dstSize: 100,
- srcSize: 100,
- wantStr: "2a1b",
- wantErr: errShortInternal,
- },
-
- {
- desc: "short internal src buffer after successful complete fill",
- t: mkChain(Nop, 3, rleDecode{}),
- src: "123a4b",
- dstSize: 4,
- srcSize: 3,
- wantStr: "",
- wantErr: errShortInternal,
- wantIter: 1,
- },
-
- {
- desc: "short internal src buffer after short dst buffer; test lastFull",
- t: mkChain(rleDecode{}, 5, rleEncode{}),
- src: "2a1b4c6d",
- dstSize: 4,
- srcSize: 100,
- wantStr: "2a1b",
- wantErr: errShortInternal,
- },
-
- {
- desc: "short src buffer",
- t: mkChain(rleEncode{}, 5, Nop),
- src: "abbcccddddeeeee",
- dstSize: 4,
- srcSize: 4,
- ioSize: 4,
- wantStr: "1a2b3c",
- wantErr: ErrShortSrc,
- },
-
- {
- desc: "process all in one go",
- t: mkChain(rleEncode{}, 5, Nop),
- src: "abbcccddddeeeeeffffff",
- dstSize: 100,
- srcSize: 100,
- wantStr: "1a2b3c4d5e6f",
- wantErr: nil,
- wantIter: 1,
- },
-
- {
- desc: "complete processing downstream after error",
- t: mkChain(dontMentionX{}, 2, rleDecode{}, 5, Nop),
- src: "3a4b5eX",
- dstSize: 100,
- srcSize: 100,
- ioSize: 100,
- wantStr: "aaabbbbeeeee",
- wantErr: errYouMentionedX,
- },
-
- {
- desc: "return downstream fatal errors first (followed by short dst)",
- t: mkChain(dontMentionX{}, 8, rleDecode{}, 4, Nop),
- src: "3a4b5eX",
- dstSize: 100,
- srcSize: 100,
- ioSize: 100,
- wantStr: "aaabbbb",
- wantErr: errShortInternal,
- },
-
- {
- desc: "return downstream fatal errors first (followed by short src)",
- t: mkChain(dontMentionX{}, 5, Nop, 1, rleDecode{}),
- src: "1a5bX",
- dstSize: 100,
- srcSize: 100,
- ioSize: 100,
- wantStr: "",
- wantErr: errShortInternal,
- },
-
- {
- desc: "short internal",
- t: mkChain(Nop, 11, rleEncode{}, 3, Nop),
- src: "abbcccddddddddddeeeeeeeeeeeg",
- dstSize: 3,
- srcSize: 100,
- wantStr: "1a2b3c10d",
- wantErr: errShortInternal,
- },
- }
-}
-
-func doTransform(tc testCase) (res string, iter int, err error) {
- tc.t.Reset()
- dst := make([]byte, tc.dstSize)
- out, in := make([]byte, 0, 2*len(tc.src)), []byte(tc.src)
- for {
- iter++
- src, atEOF := in, true
- if len(src) > tc.srcSize {
- src, atEOF = src[:tc.srcSize], false
- }
- nDst, nSrc, err := tc.t.Transform(dst, src, atEOF)
- out = append(out, dst[:nDst]...)
- in = in[nSrc:]
- switch {
- case err == nil && len(in) != 0:
- case err == ErrShortSrc && nSrc > 0:
- case err == ErrShortDst && (nDst > 0 || nSrc > 0):
- default:
- return string(out), iter, err
- }
- }
-}
-
-func TestChain(t *testing.T) {
- if c, ok := Chain().(nop); !ok {
- t.Errorf("empty chain: %v; want Nop", c)
- }
-
- // Test Chain for a single Transformer.
- for _, tc := range testCases {
- tc.t = Chain(tc.t)
- str, _, err := doTransform(tc)
- if str != tc.wantStr || err != tc.wantErr {
- t.Errorf("%s:\ngot %q, %v\nwant %q, %v", tc, str, err, tc.wantStr, tc.wantErr)
- }
- }
-
- tests := chainTests()
- sizes := []int{1, 2, 3, 4, 5, 7, 10, 100, 1000}
- addTest := func(tc testCase, t *chain) {
- if t.link[0].t != tc.t && tc.wantErr == ErrShortSrc {
- tc.wantErr = errShortInternal
- }
- if t.link[len(t.link)-2].t != tc.t && tc.wantErr == ErrShortDst {
- tc.wantErr = errShortInternal
- }
- tc.t = t
- tests = append(tests, tc)
- }
- for _, tc := range testCases {
- for _, sz := range sizes {
- tt := tc
- tt.dstSize = sz
- addTest(tt, mkChain(tc.t, tc.dstSize, Nop))
- addTest(tt, mkChain(tc.t, tc.dstSize, Nop, 2, Nop))
- addTest(tt, mkChain(Nop, tc.srcSize, tc.t, tc.dstSize, Nop))
- if sz >= tc.dstSize && (tc.wantErr != ErrShortDst || sz == tc.dstSize) {
- addTest(tt, mkChain(Nop, tc.srcSize, tc.t))
- addTest(tt, mkChain(Nop, 100, Nop, tc.srcSize, tc.t))
- }
- }
- }
- for _, tc := range testCases {
- tt := tc
- tt.dstSize = 1
- tt.wantStr = ""
- addTest(tt, mkChain(tc.t, tc.dstSize, Discard))
- addTest(tt, mkChain(Nop, tc.srcSize, tc.t, tc.dstSize, Discard))
- addTest(tt, mkChain(Nop, tc.srcSize, tc.t, tc.dstSize, Nop, tc.dstSize, Discard))
- }
- for _, tc := range testCases {
- tt := tc
- tt.dstSize = 100
- tt.wantStr = strings.Replace(tc.src, "0f", "", -1)
- // Chain encoders and decoders.
- if _, ok := tc.t.(rleEncode); ok && tc.wantErr == nil {
- addTest(tt, mkChain(tc.t, tc.dstSize, Nop, 1000, rleDecode{}))
- addTest(tt, mkChain(tc.t, tc.dstSize, Nop, tc.dstSize, rleDecode{}))
- addTest(tt, mkChain(Nop, tc.srcSize, tc.t, tc.dstSize, Nop, 100, rleDecode{}))
- // decoding needs larger destinations
- addTest(tt, mkChain(Nop, tc.srcSize, tc.t, tc.dstSize, rleDecode{}, 100, Nop))
- addTest(tt, mkChain(Nop, tc.srcSize, tc.t, tc.dstSize, Nop, 100, rleDecode{}, 100, Nop))
- } else if _, ok := tc.t.(rleDecode); ok && tc.wantErr == nil {
- // The internal buffer size may need to be the sum of the maximum segment
- // size of the two encoders!
- addTest(tt, mkChain(tc.t, 2*tc.dstSize, rleEncode{}))
- addTest(tt, mkChain(tc.t, tc.dstSize, Nop, 101, rleEncode{}))
- addTest(tt, mkChain(Nop, tc.srcSize, tc.t, tc.dstSize, Nop, 100, rleEncode{}))
- addTest(tt, mkChain(Nop, tc.srcSize, tc.t, tc.dstSize, Nop, 200, rleEncode{}, 100, Nop))
- }
- }
- for _, tc := range tests {
- str, iter, err := doTransform(tc)
- mi := tc.wantIter != 0 && tc.wantIter != iter
- if str != tc.wantStr || err != tc.wantErr || mi {
- t.Errorf("%s:\ngot iter:%d, %q, %v\nwant iter:%d, %q, %v", tc, iter, str, err, tc.wantIter, tc.wantStr, tc.wantErr)
- }
- break
- }
-}
-
-func TestRemoveFunc(t *testing.T) {
- filter := RemoveFunc(func(r rune) bool {
- return strings.IndexRune("ab\u0300\u1234,", r) != -1
- })
- tests := []testCase{
- {
- src: ",",
- wantStr: "",
- },
-
- {
- src: "c",
- wantStr: "c",
- },
-
- {
- src: "\u2345",
- wantStr: "\u2345",
- },
-
- {
- src: "tschüß",
- wantStr: "tschüß",
- },
-
- {
- src: ",до,свидания,",
- wantStr: "досвидания",
- },
-
- {
- src: "a\xbd\xb2=\xbc ⌘",
- wantStr: "\uFFFD\uFFFD=\uFFFD ⌘",
- },
-
- {
- // If we didn't replace illegal bytes with RuneError, the result
- // would be \u0300 or the code would need to be more complex.
- src: "\xcc\u0300\x80",
- wantStr: "\uFFFD\uFFFD",
- },
-
- {
- src: "\xcc\u0300\x80",
- dstSize: 3,
- wantStr: "\uFFFD\uFFFD",
- wantIter: 2,
- },
-
- {
- // Test a long buffer greater than the internal buffer size
- src: "hello\xcc\xcc\xccworld",
- srcSize: 13,
- wantStr: "hello\uFFFD\uFFFD\uFFFDworld",
- wantIter: 1,
- },
-
- {
- src: "\u2345",
- dstSize: 2,
- wantStr: "",
- wantErr: ErrShortDst,
- },
-
- {
- src: "\xcc",
- dstSize: 2,
- wantStr: "",
- wantErr: ErrShortDst,
- },
-
- {
- src: "\u0300",
- dstSize: 2,
- srcSize: 1,
- wantStr: "",
- wantErr: ErrShortSrc,
- },
-
- {
- t: RemoveFunc(func(r rune) bool {
- return r == utf8.RuneError
- }),
- src: "\xcc\u0300\x80",
- wantStr: "\u0300",
- },
- }
-
- for _, tc := range tests {
- tc.desc = tc.src
- if tc.t == nil {
- tc.t = filter
- }
- if tc.dstSize == 0 {
- tc.dstSize = 100
- }
- if tc.srcSize == 0 {
- tc.srcSize = 100
- }
- str, iter, err := doTransform(tc)
- mi := tc.wantIter != 0 && tc.wantIter != iter
- if str != tc.wantStr || err != tc.wantErr || mi {
- t.Errorf("%+q:\ngot iter:%d, %+q, %v\nwant iter:%d, %+q, %v", tc.src, iter, str, err, tc.wantIter, tc.wantStr, tc.wantErr)
- }
-
- tc.src = str
- idem, _, _ := doTransform(tc)
- if str != idem {
- t.Errorf("%+q: found %+q; want %+q", tc.src, idem, str)
- }
- }
-}
-
-func testString(t *testing.T, f func(Transformer, string) (string, int, error)) {
- for _, tt := range append(testCases, chainTests()...) {
- if tt.desc == "allowStutter = true" {
- // We don't have control over the buffer size, so we eliminate tests
- // that depend on a specific buffer size being set.
- continue
- }
- if tt.wantErr == ErrShortDst || tt.wantErr == ErrShortSrc {
- // The result string will be different.
- continue
- }
- testtext.Run(t, tt.desc, func(t *testing.T) {
- got, n, err := f(tt.t, tt.src)
- if tt.wantErr != err {
- t.Errorf("error: got %v; want %v", err, tt.wantErr)
- }
- // Check that err == nil implies that n == len(tt.src). Note that vice
- // versa isn't necessarily true.
- if err == nil && n != len(tt.src) {
- t.Errorf("err == nil: got %d bytes, want %d", n, err)
- }
- if got != tt.wantStr {
- t.Errorf("string: got %q; want %q", got, tt.wantStr)
- }
- })
- }
-}
-
-func TestBytes(t *testing.T) {
- testString(t, func(z Transformer, s string) (string, int, error) {
- b, n, err := Bytes(z, []byte(s))
- return string(b), n, err
- })
-}
-
-func TestAppend(t *testing.T) {
- // Create a bunch of subtests for different buffer sizes.
- testCases := [][]byte{
- nil,
- make([]byte, 0, 0),
- make([]byte, 0, 1),
- make([]byte, 1, 1),
- make([]byte, 1, 5),
- make([]byte, 100, 100),
- make([]byte, 100, 200),
- }
- for _, tc := range testCases {
- testString(t, func(z Transformer, s string) (string, int, error) {
- b, n, err := Append(z, tc, []byte(s))
- return string(b[len(tc):]), n, err
- })
- }
-}
-
-func TestString(t *testing.T) {
- testtext.Run(t, "transform", func(t *testing.T) { testString(t, String) })
-
- // Overrun the internal destination buffer.
- for i, s := range []string{
- aaa[:1*initialBufSize-1],
- aaa[:1*initialBufSize+0],
- aaa[:1*initialBufSize+1],
- AAA[:1*initialBufSize-1],
- AAA[:1*initialBufSize+0],
- AAA[:1*initialBufSize+1],
- AAA[:2*initialBufSize-1],
- AAA[:2*initialBufSize+0],
- AAA[:2*initialBufSize+1],
- aaa[:1*initialBufSize-2] + "A",
- aaa[:1*initialBufSize-1] + "A",
- aaa[:1*initialBufSize+0] + "A",
- aaa[:1*initialBufSize+1] + "A",
- } {
- testtext.Run(t, fmt.Sprint("dst buffer test using lower/", i), func(t *testing.T) {
- got, _, _ := String(lowerCaseASCII{}, s)
- if want := strings.ToLower(s); got != want {
- t.Errorf("got %s (%d); want %s (%d)", got, len(got), want, len(want))
- }
- })
- }
-
- // Overrun the internal source buffer.
- for i, s := range []string{
- aaa[:1*initialBufSize-1],
- aaa[:1*initialBufSize+0],
- aaa[:1*initialBufSize+1],
- aaa[:2*initialBufSize+1],
- aaa[:2*initialBufSize+0],
- aaa[:2*initialBufSize+1],
- } {
- testtext.Run(t, fmt.Sprint("src buffer test using rleEncode/", i), func(t *testing.T) {
- got, _, _ := String(rleEncode{}, s)
- if want := fmt.Sprintf("%da", len(s)); got != want {
- t.Errorf("got %s (%d); want %s (%d)", got, len(got), want, len(want))
- }
- })
- }
-
- // Test allocations for non-changing strings.
- // Note we still need to allocate a single buffer.
- for i, s := range []string{
- "",
- "123456789",
- aaa[:initialBufSize-1],
- aaa[:initialBufSize+0],
- aaa[:initialBufSize+1],
- aaa[:10*initialBufSize],
- } {
- testtext.Run(t, fmt.Sprint("alloc/", i), func(t *testing.T) {
- if n := testtext.AllocsPerRun(5, func() { String(&lowerCaseASCIILookahead{}, s) }); n > 1 {
- t.Errorf("#allocs was %f; want 1", n)
- }
- })
- }
-}
-
-// TestBytesAllocation tests that buffer growth stays limited with the trickler
-// transformer, which behaves oddly but within spec. In case buffer growth is
-// not correctly handled, the test will either panic with a failed allocation or
-// thrash. To ensure the tests terminate under the last condition, we time out
-// after some sufficiently long period of time.
-func TestBytesAllocation(t *testing.T) {
- done := make(chan bool)
- go func() {
- in := bytes.Repeat([]byte{'a'}, 1000)
- tr := trickler(make([]byte, 1))
- Bytes(&tr, in)
- done <- true
- }()
- select {
- case <-done:
- case <-time.After(3 * time.Second):
- t.Error("time out, likely due to excessive allocation")
- }
-}
-
-// TestStringAllocation tests that buffer growth stays limited with the trickler
-// transformer, which behaves oddly but within spec. In case buffer growth is
-// not correctly handled, the test will either panic with a failed allocation or
-// thrash. To ensure the tests terminate under the last condition, we time out
-// after some sufficiently long period of time.
-func TestStringAllocation(t *testing.T) {
- done := make(chan bool)
- go func() {
- tr := trickler(make([]byte, 1))
- String(&tr, aaa[:1000])
- done <- true
- }()
- select {
- case <-done:
- case <-time.After(3 * time.Second):
- t.Error("time out, likely due to excessive allocation")
- }
-}
-
-func BenchmarkStringLowerEmpty(b *testing.B) {
- for i := 0; i < b.N; i++ {
- String(&lowerCaseASCIILookahead{}, "")
- }
-}
-
-func BenchmarkStringLowerIdentical(b *testing.B) {
- for i := 0; i < b.N; i++ {
- String(&lowerCaseASCIILookahead{}, aaa[:4096])
- }
-}
-
-func BenchmarkStringLowerChanged(b *testing.B) {
- for i := 0; i < b.N; i++ {
- String(&lowerCaseASCIILookahead{}, AAA[:4096])
- }
-}
-
-var (
- aaa = strings.Repeat("a", 4096)
- AAA = strings.Repeat("A", 4096)
-)
diff --git a/vendor/golang.org/x/text/unicode/bidi/core_test.go b/vendor/golang.org/x/text/unicode/bidi/core_test.go
deleted file mode 100644
index f28d386c8..000000000
--- a/vendor/golang.org/x/text/unicode/bidi/core_test.go
+++ /dev/null
@@ -1,224 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package bidi
-
-import (
- "flag"
- "fmt"
- "log"
- "strconv"
- "strings"
- "testing"
-
- "golang.org/x/text/internal/gen"
- "golang.org/x/text/internal/testtext"
- "golang.org/x/text/internal/ucd"
- "golang.org/x/text/unicode/norm"
-)
-
-var testLevels = flag.Bool("levels", false, "enable testing of levels")
-
-// TestBidiCore performs the tests in BidiTest.txt.
-// See http://www.unicode.org/Public/UCD/latest/ucd/BidiTest.txt.
-func TestBidiCore(t *testing.T) {
- testtext.SkipIfNotLong(t)
-
- r := gen.OpenUCDFile("BidiTest.txt")
- defer r.Close()
-
- var wantLevels, wantOrder []string
- p := ucd.New(r, ucd.Part(func(p *ucd.Parser) {
- s := strings.Split(p.String(0), ":")
- switch s[0] {
- case "Levels":
- wantLevels = strings.Fields(s[1])
- case "Reorder":
- wantOrder = strings.Fields(s[1])
- default:
- log.Fatalf("Unknown part %q.", s[0])
- }
- }))
-
- for p.Next() {
- types := []Class{}
- for _, s := range p.Strings(0) {
- types = append(types, bidiClass[s])
- }
- // We ignore the bracketing part of the algorithm.
- pairTypes := make([]bracketType, len(types))
- pairValues := make([]rune, len(types))
-
- for i := uint(0); i < 3; i++ {
- if p.Uint(1)&(1<<i) == 0 {
- continue
- }
- lev := level(int(i) - 1)
- par := newParagraph(types, pairTypes, pairValues, lev)
-
- if *testLevels {
- levels := par.getLevels([]int{len(types)})
- for i, s := range wantLevels {
- if s == "x" {
- continue
- }
- l, _ := strconv.ParseUint(s, 10, 8)
- if level(l)&1 != levels[i]&1 {
- t.Errorf("%s:%d:levels: got %v; want %v", p.String(0), lev, levels, wantLevels)
- break
- }
- }
- }
-
- order := par.getReordering([]int{len(types)})
- gotOrder := filterOrder(types, order)
- if got, want := fmt.Sprint(gotOrder), fmt.Sprint(wantOrder); got != want {
- t.Errorf("%s:%d:order: got %v; want %v\noriginal %v", p.String(0), lev, got, want, order)
- }
- }
- }
- if err := p.Err(); err != nil {
- log.Fatal(err)
- }
-}
-
-var removeClasses = map[Class]bool{
- LRO: true,
- RLO: true,
- RLE: true,
- LRE: true,
- PDF: true,
- BN: true,
-}
-
-// TestBidiCharacters performs the tests in BidiCharacterTest.txt.
-// See http://www.unicode.org/Public/UCD/latest/ucd/BidiCharacterTest.txt
-func TestBidiCharacters(t *testing.T) {
- testtext.SkipIfNotLong(t)
-
- ucd.Parse(gen.OpenUCDFile("BidiCharacterTest.txt"), func(p *ucd.Parser) {
- var (
- types []Class
- pairTypes []bracketType
- pairValues []rune
- parLevel level
-
- wantLevel = level(p.Int(2))
- wantLevels = p.Strings(3)
- wantVisualOrder = p.Strings(4)
- )
-
- switch l := p.Int(1); l {
- case 0, 1:
- parLevel = level(l)
- case 2:
- parLevel = implicitLevel
- default:
- // Spec says to ignore unknown parts.
- }
-
- runes := p.Runes(0)
-
- for _, r := range runes {
- // Assign the bracket type.
- if d := norm.NFKD.PropertiesString(string(r)).Decomposition(); d != nil {
- r = []rune(string(d))[0]
- }
- p, _ := LookupRune(r)
-
- // Assign the class for this rune.
- types = append(types, p.Class())
-
- switch {
- case !p.IsBracket():
- pairTypes = append(pairTypes, bpNone)
- pairValues = append(pairValues, 0)
- case p.IsOpeningBracket():
- pairTypes = append(pairTypes, bpOpen)
- pairValues = append(pairValues, r)
- default:
- pairTypes = append(pairTypes, bpClose)
- pairValues = append(pairValues, p.reverseBracket(r))
- }
- }
- par := newParagraph(types, pairTypes, pairValues, parLevel)
-
- // Test results:
- if got := par.embeddingLevel; got != wantLevel {
- t.Errorf("%v:level: got %d; want %d", string(runes), got, wantLevel)
- }
-
- if *testLevels {
- gotLevels := getLevelStrings(types, par.getLevels([]int{len(types)}))
- if got, want := fmt.Sprint(gotLevels), fmt.Sprint(wantLevels); got != want {
- t.Errorf("%04X %q:%d: got %v; want %v\nval: %x\npair: %v", runes, string(runes), parLevel, got, want, pairValues, pairTypes)
- }
- }
-
- order := par.getReordering([]int{len(types)})
- order = filterOrder(types, order)
- if got, want := fmt.Sprint(order), fmt.Sprint(wantVisualOrder); got != want {
- t.Errorf("%04X %q:%d: got %v; want %v\ngot order: %s", runes, string(runes), parLevel, got, want, reorder(runes, order))
- }
- })
-}
-
-func getLevelStrings(cl []Class, levels []level) []string {
- var results []string
- for i, l := range levels {
- if !removeClasses[cl[i]] {
- results = append(results, fmt.Sprint(l))
- } else {
- results = append(results, "x")
- }
- }
- return results
-}
-
-func filterOrder(cl []Class, order []int) []int {
- no := []int{}
- for _, o := range order {
- if !removeClasses[cl[o]] {
- no = append(no, o)
- }
- }
- return no
-}
-
-func reorder(r []rune, order []int) string {
- nr := make([]rune, len(order))
- for i, o := range order {
- nr[i] = r[o]
- }
- return string(nr)
-}
-
-// bidiClass names and codes taken from class "bc" in
-// http://www.unicode.org/Public/8.0.0/ucd/PropertyValueAliases.txt
-var bidiClass = map[string]Class{
- "AL": AL, // classArabicLetter,
- "AN": AN, // classArabicNumber,
- "B": B, // classParagraphSeparator,
- "BN": BN, // classBoundaryNeutral,
- "CS": CS, // classCommonSeparator,
- "EN": EN, // classEuropeanNumber,
- "ES": ES, // classEuropeanSeparator,
- "ET": ET, // classEuropeanTerminator,
- "L": L, // classLeftToRight,
- "NSM": NSM, // classNonspacingMark,
- "ON": ON, // classOtherNeutral,
- "R": R, // classRightToLeft,
- "S": S, // classSegmentSeparator,
- "WS": WS, // classWhiteSpace,
-
- "LRO": LRO, // classLeftToRightOverride,
- "RLO": RLO, // classRightToLeftOverride,
- "LRE": LRE, // classLeftToRightEmbedding,
- "RLE": RLE, // classRightToLeftEmbedding,
- "PDF": PDF, // classPopDirectionalFormat,
- "LRI": LRI, // classLeftToRightIsolate,
- "RLI": RLI, // classRightToLeftIsolate,
- "FSI": FSI, // classFirstStrongIsolate,
- "PDI": PDI, // classPopDirectionalIsolate,
-}
diff --git a/vendor/golang.org/x/text/unicode/bidi/ranges_test.go b/vendor/golang.org/x/text/unicode/bidi/ranges_test.go
deleted file mode 100644
index bfaecd502..000000000
--- a/vendor/golang.org/x/text/unicode/bidi/ranges_test.go
+++ /dev/null
@@ -1,53 +0,0 @@
-// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
-
-package bidi
-
-import (
- "unicode"
-
- "golang.org/x/text/internal/gen"
- "golang.org/x/text/internal/ucd"
- "golang.org/x/text/unicode/rangetable"
-)
-
-// These tables are hand-extracted from:
-// http://www.unicode.org/Public/8.0.0/ucd/extracted/DerivedBidiClass.txt
-func visitDefaults(fn func(r rune, c Class)) {
- // first write default values for ranges listed above.
- visitRunes(fn, AL, []rune{
- 0x0600, 0x07BF, // Arabic
- 0x08A0, 0x08FF, // Arabic Extended-A
- 0xFB50, 0xFDCF, // Arabic Presentation Forms
- 0xFDF0, 0xFDFF,
- 0xFE70, 0xFEFF,
- 0x0001EE00, 0x0001EEFF, // Arabic Mathematical Alpha Symbols
- })
- visitRunes(fn, R, []rune{
- 0x0590, 0x05FF, // Hebrew
- 0x07C0, 0x089F, // Nko et al.
- 0xFB1D, 0xFB4F,
- 0x00010800, 0x00010FFF, // Cypriot Syllabary et. al.
- 0x0001E800, 0x0001EDFF,
- 0x0001EF00, 0x0001EFFF,
- })
- visitRunes(fn, ET, []rune{ // European Terminator
- 0x20A0, 0x20Cf, // Currency symbols
- })
- rangetable.Visit(unicode.Noncharacter_Code_Point, func(r rune) {
- fn(r, BN) // Boundary Neutral
- })
- ucd.Parse(gen.OpenUCDFile("DerivedCoreProperties.txt"), func(p *ucd.Parser) {
- if p.String(1) == "Default_Ignorable_Code_Point" {
- fn(p.Rune(0), BN) // Boundary Neutral
- }
- })
-}
-
-func visitRunes(fn func(r rune, c Class), c Class, runes []rune) {
- for i := 0; i < len(runes); i += 2 {
- lo, hi := runes[i], runes[i+1]
- for j := lo; j <= hi; j++ {
- fn(j, c)
- }
- }
-}
diff --git a/vendor/golang.org/x/text/unicode/bidi/tables_test.go b/vendor/golang.org/x/text/unicode/bidi/tables_test.go
deleted file mode 100644
index 356a4a58d..000000000
--- a/vendor/golang.org/x/text/unicode/bidi/tables_test.go
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package bidi
-
-import (
- "testing"
-
- "golang.org/x/text/internal/gen"
- "golang.org/x/text/internal/testtext"
- "golang.org/x/text/internal/ucd"
-)
-
-var labels = []string{
- AL: "AL",
- AN: "AN",
- B: "B",
- BN: "BN",
- CS: "CS",
- EN: "EN",
- ES: "ES",
- ET: "ET",
- L: "L",
- NSM: "NSM",
- ON: "ON",
- R: "R",
- S: "S",
- WS: "WS",
-
- LRO: "LRO",
- RLO: "RLO",
- LRE: "LRE",
- RLE: "RLE",
- PDF: "PDF",
- LRI: "LRI",
- RLI: "RLI",
- FSI: "FSI",
- PDI: "PDI",
-}
-
-func TestTables(t *testing.T) {
- testtext.SkipIfNotLong(t)
-
- ucd.Parse(gen.OpenUCDFile("BidiBrackets.txt"), func(p *ucd.Parser) {
- r1 := p.Rune(0)
- want := p.Rune(1)
-
- e, _ := LookupRune(r1)
- if got := e.reverseBracket(r1); got != want {
- t.Errorf("Reverse(%U) = %U; want %U", r1, got, want)
- }
- })
-
- done := map[rune]bool{}
- test := func(name string, r rune, want string) {
- str := string(r)
- e, _ := LookupString(str)
- if got := labels[e.Class()]; got != want {
- t.Errorf("%s:%U: got %s; want %s", name, r, got, want)
- }
- if e2, sz := LookupRune(r); e != e2 || sz != len(str) {
- t.Errorf("LookupRune(%U) = %v, %d; want %v, %d", r, e2, e, sz, len(str))
- }
- if e2, sz := Lookup([]byte(str)); e != e2 || sz != len(str) {
- t.Errorf("Lookup(%U) = %v, %d; want %v, %d", r, e2, e, sz, len(str))
- }
- done[r] = true
- }
-
- // Insert the derived BiDi properties.
- ucd.Parse(gen.OpenUCDFile("extracted/DerivedBidiClass.txt"), func(p *ucd.Parser) {
- r := p.Rune(0)
- test("derived", r, p.String(1))
- })
- visitDefaults(func(r rune, c Class) {
- if !done[r] {
- test("default", r, labels[c])
- }
- })
-
-}
diff --git a/vendor/golang.org/x/text/unicode/cldr/cldr_test.go b/vendor/golang.org/x/text/unicode/cldr/cldr_test.go
deleted file mode 100644
index 951028d7e..000000000
--- a/vendor/golang.org/x/text/unicode/cldr/cldr_test.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package cldr
-
-import "testing"
-
-func TestParseDraft(t *testing.T) {
- tests := []struct {
- in string
- draft Draft
- err bool
- }{
- {"unconfirmed", Unconfirmed, false},
- {"provisional", Provisional, false},
- {"contributed", Contributed, false},
- {"approved", Approved, false},
- {"", Approved, false},
- {"foo", Approved, true},
- }
- for _, tt := range tests {
- if d, err := ParseDraft(tt.in); d != tt.draft || (err != nil) != tt.err {
- t.Errorf("%q: was %v, %v; want %v, %v", tt.in, d, err != nil, tt.draft, tt.err)
- }
- }
-}
diff --git a/vendor/golang.org/x/text/unicode/cldr/collate_test.go b/vendor/golang.org/x/text/unicode/cldr/collate_test.go
deleted file mode 100644
index f6721639a..000000000
--- a/vendor/golang.org/x/text/unicode/cldr/collate_test.go
+++ /dev/null
@@ -1,275 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package cldr
-
-import (
- "fmt"
- "strings"
- "testing"
-)
-
-// A recorder implements the RuleProcessor interface, whereby its methods
-// simply record the invocations.
-type recorder struct {
- calls []string
-}
-
-func (r *recorder) Reset(anchor string, before int) error {
- if before > 5 {
- return fmt.Errorf("before %d > 5", before)
- }
- r.calls = append(r.calls, fmt.Sprintf("R:%s-%d", anchor, before))
- return nil
-}
-
-func (r *recorder) Insert(level int, str, context, extend string) error {
- s := fmt.Sprintf("O:%d:%s", level, str)
- if context != "" {
- s += "|" + context
- }
- if extend != "" {
- s += "/" + extend
- }
- r.calls = append(r.calls, s)
- return nil
-}
-
-func (r *recorder) Index(id string) {
- r.calls = append(r.calls, fmt.Sprintf("I:%s", id))
-}
-
-func (r *recorder) Error(err error) {
- r.calls = append(r.calls, fmt.Sprintf("E:%v", err))
-}
-
-func TestRuleProcessor(t *testing.T) {
- for _, tt := range []struct {
- desc string
- in string
- out string
- }{
- {desc: "empty"},
- {desc: "whitespace and comments only",
- in: `
-
-
- # adsfads
-# adfadf
- `,
- },
- {
- desc: "reset anchor",
- in: `
- & a
- &b #
- & [ before 3 ] c
- & [before 4] d & ee
- & [first tertiary ignorable]
- &'g'
- & 'h''h'h'h'
- &'\u0069' # LATIN SMALL LETTER I
- `,
- out: `
- R:a-0
- R:b-0
- R:c-3
- R:d-4
- R:ee-0
- R:<first tertiary ignorable/>-0
- R:g-0
- R:hhhh-0
- R:i-0
- `,
- },
- {
- desc: "ordering",
- in: `
- & 0
- < 1 <<''2#
-<<< 3'3''33'3#
- <<<<4
- = 5 << 6 | s
- <<<< 7 / z
- << 8'' | s / ch
- `,
- out: `
- R:0-0
- O:1:1
- O:2:'2
- O:3:33333
- O:4:4
- O:5:5
- O:2:6|s
- O:4:7/z
- O:2:8'|s/ch
- `,
- },
- {
- desc: "index",
- in: "< '\ufdd0'A",
- out: "I:A",
- },
- {
- desc: "sequence",
- in: `
- & 0
- <<* 1234
- <* a-cde-f
- =* q-q
- `,
- out: `
- R:0-0
- O:2:1
- O:2:2
- O:2:3
- O:2:4
- O:1:a
- O:1:b
- O:1:c
- O:1:d
- O:1:e
- O:1:f
- O:5:q
- `,
- },
- {
- desc: "compact",
- in: "&B<t<<<T<s<<<S<e<<<E",
- out: `
- R:B-0
- O:1:t
- O:3:T
- O:1:s
- O:3:S
- O:1:e
- O:3:E
- `,
- },
- {
- desc: "err operator",
- in: "a",
- out: "E:1: illegal operator 'a'",
- },
- {
- desc: "err line number",
- in: `& a
- << b
- a`,
- out: `
- R:a-0
- O:2:b
- E:3: illegal operator 'a'`,
- },
- {
- desc: "err empty anchor",
- in: " & ",
- out: "E:1: missing string",
- },
- {
- desc: "err anchor invalid special 1",
- in: " & [ foo ",
- out: "E:1: unmatched bracket",
- },
- {
- desc: "err anchor invalid special 2",
- in: "&[",
- out: "E:1: unmatched bracket",
- },
- {
- desc: "err anchor invalid before 1",
- in: "&[before a]",
- out: `E:1: strconv.ParseUint: parsing "a": invalid syntax`,
- },
- {
- desc: "err anchor invalid before 2",
- in: "&[before 12]",
- out: `E:1: strconv.ParseUint: parsing "12": value out of range`,
- },
- {
- desc: "err anchor invalid before 3",
- in: "&[before 2]",
- out: "E:1: missing string",
- },
- {
- desc: "err anchor invalid before 4",
- in: "&[before 6] a",
- out: "E:1: before 6 > 5",
- },
- {
- desc: "err empty order",
- in: " < ",
- out: "E:1: missing string",
- },
- {
- desc: "err empty identity",
- in: " = ",
- out: "E:1: missing string",
- },
- {
- desc: "err empty context",
- in: " < a | ",
- out: "E:1: missing string after context",
- },
- {
- desc: "err empty extend",
- in: " < a / ",
- out: "E:1: missing string after extension",
- },
- {
- desc: "err empty sequence",
- in: " <* ",
- out: "E:1: empty sequence",
- },
- {
- desc: "err sequence 1",
- in: " <* -a",
- out: "E:1: range without starter value",
- },
- {
- desc: "err sequence 3",
- in: " <* a-a-b",
- out: `O:1:a
- E:1: range without starter value
- `,
- },
- {
- desc: "err sequence 3",
- in: " <* b-a",
- out: `O:1:b
- E:1: invalid range 'b'-'a'
- `,
- },
- {
- desc: "err unmatched quote",
- in: " < 'b",
- out: ` E:1: unmatched single quote
- `,
- },
- } {
- rec := &recorder{}
- err := Collation{
- Cr: []*Common{
- {hidden: hidden{CharData: tt.in}},
- },
- }.Process(rec)
- if err != nil {
- rec.Error(err)
- }
- got := rec.calls
- want := strings.Split(strings.TrimSpace(tt.out), "\n")
- if tt.out == "" {
- want = nil
- }
- if len(got) != len(want) {
- t.Errorf("%s: nResults: got %d; want %d", tt.desc, len(got), len(want))
- continue
- }
- for i, g := range got {
- if want := strings.TrimSpace(want[i]); g != want {
- t.Errorf("%s:%d: got %q; want %q", tt.desc, i, g, want)
- }
- }
- }
-}
diff --git a/vendor/golang.org/x/text/unicode/cldr/data_test.go b/vendor/golang.org/x/text/unicode/cldr/data_test.go
deleted file mode 100644
index 166218962..000000000
--- a/vendor/golang.org/x/text/unicode/cldr/data_test.go
+++ /dev/null
@@ -1,186 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package cldr
-
-// This file contains test data.
-
-import (
- "io"
- "strings"
-)
-
-type testLoader struct {
-}
-
-func (t testLoader) Len() int {
- return len(testFiles)
-}
-
-func (t testLoader) Path(i int) string {
- return testPaths[i]
-}
-
-func (t testLoader) Reader(i int) (io.ReadCloser, error) {
- return &reader{*strings.NewReader(testFiles[i])}, nil
-}
-
-// reader adds a dummy Close method to strings.Reader so that it
-// satisfies the io.ReadCloser interface.
-type reader struct {
- strings.Reader
-}
-
-func (r reader) Close() error {
- return nil
-}
-
-var (
- testFiles = []string{de_xml, gsw_xml, root_xml}
- testPaths = []string{
- "common/main/de.xml",
- "common/main/gsw.xml",
- "common/main/root.xml",
- }
-)
-
-var root_xml = `<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE ldml SYSTEM "../../common/dtd/ldml.dtd">
-<ldml>
- <identity>
- <language type="root"/>
- <generation date="now"/>
- </identity>
- <characters>
- <exemplarCharacters>[]</exemplarCharacters>
- <exemplarCharacters type="auxiliary">[]</exemplarCharacters>
- <exemplarCharacters type="punctuation">[\- ‐ – — … ' ‘ ‚ &quot; “ „ \&amp; #]</exemplarCharacters>
- <ellipsis type="final">{0}…</ellipsis>
- <ellipsis type="initial">…{0}</ellipsis>
- <moreInformation>?</moreInformation>
- </characters>
- <dates>
- <calendars>
- <default choice="gregorian"/>
- <calendar type="buddhist">
- <months>
- <alias source="locale" path="../../calendar[@type='gregorian']/months"/>
- </months>
- </calendar>
- <calendar type="chinese">
- <months>
- <alias source="locale" path="../../calendar[@type='gregorian']/months"/>
- </months>
- </calendar>
- <calendar type="gregorian">
- <months>
- <default choice="format"/>
- <monthContext type="format">
- <default choice="wide"/>
- <monthWidth type="narrow">
- <alias source="locale" path="../../monthContext[@type='stand-alone']/monthWidth[@type='narrow']"/>
- </monthWidth>
- <monthWidth type="wide">
- <month type="1">11</month>
- <month type="2">22</month>
- <month type="3">33</month>
- <month type="4">44</month>
- </monthWidth>
- </monthContext>
- <monthContext type="stand-alone">
- <monthWidth type="narrow">
- <month type="1">1</month>
- <month type="2">2</month>
- <month type="3">3</month>
- <month type="4">4</month>
- </monthWidth>
- <monthWidth type="wide">
- <alias source="locale" path="../../monthContext[@type='format']/monthWidth[@type='wide']"/>
- </monthWidth>
- </monthContext>
- </months>
- </calendar>
- </calendars>
- </dates>
-</ldml>
-`
-
-var de_xml = `<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE ldml SYSTEM "../../common/dtd/ldml.dtd">
-<ldml>
- <identity>
- <language type="de"/>
- </identity>
- <characters>
- <exemplarCharacters>[a ä b c d e ö p q r s ß t u ü v w x y z]</exemplarCharacters>
- <exemplarCharacters type="auxiliary">[á à ă]</exemplarCharacters>
- <exemplarCharacters type="index">[A B C D E F G H Z]</exemplarCharacters>
- <ellipsis type="final">{0} …</ellipsis>
- <ellipsis type="initial">… {0}</ellipsis>
- <moreInformation>?</moreInformation>
- <stopwords>
- <stopwordList type="collation" draft="provisional">der die das</stopwordList>
- </stopwords>
- </characters>
- <dates>
- <calendars>
- <calendar type="buddhist">
- <months>
- <monthContext type="format">
- <monthWidth type="narrow">
- <month type="3">BBB</month>
- </monthWidth>
- <monthWidth type="wide">
- <month type="3">bbb</month>
- </monthWidth>
- </monthContext>
- </months>
- </calendar>
- <calendar type="gregorian">
- <months>
- <monthContext type="format">
- <monthWidth type="narrow">
- <month type="3">M</month>
- <month type="4">A</month>
- </monthWidth>
- <monthWidth type="wide">
- <month type="3">Maerz</month>
- <month type="4">April</month>
- <month type="5">Mai</month>
- </monthWidth>
- </monthContext>
- <monthContext type="stand-alone">
- <monthWidth type="narrow">
- <month type="3">m</month>
- <month type="5">m</month>
- </monthWidth>
- <monthWidth type="wide">
- <month type="4">april</month>
- <month type="5">mai</month>
- </monthWidth>
- </monthContext>
- </months>
- </calendar>
- </calendars>
- </dates>
- <posix>
- <messages>
- <yesstr>yes:y</yesstr>
- <nostr>no:n</nostr>
- </messages>
- </posix>
-</ldml>
-`
-
-var gsw_xml = `<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE ldml SYSTEM "../../common/dtd/ldml.dtd">
-<ldml>
- <identity>
- <language type="gsw"/>
- </identity>
- <posix>
- <alias source="de" path="//ldml/posix"/>
- </posix>
-</ldml>
-`
diff --git a/vendor/golang.org/x/text/unicode/cldr/examples_test.go b/vendor/golang.org/x/text/unicode/cldr/examples_test.go
deleted file mode 100644
index 1a69b0073..000000000
--- a/vendor/golang.org/x/text/unicode/cldr/examples_test.go
+++ /dev/null
@@ -1,21 +0,0 @@
-package cldr_test
-
-import (
- "fmt"
-
- "golang.org/x/text/unicode/cldr"
-)
-
-func ExampleSlice() {
- var dr *cldr.CLDR // assume this is initialized
-
- x, _ := dr.LDML("en")
- cs := x.Collations.Collation
- // remove all but the default
- cldr.MakeSlice(&cs).Filter(func(e cldr.Elem) bool {
- return e.GetCommon().Type != x.Collations.Default()
- })
- for i, c := range cs {
- fmt.Println(i, c.Type)
- }
-}
diff --git a/vendor/golang.org/x/text/unicode/cldr/resolve_test.go b/vendor/golang.org/x/text/unicode/cldr/resolve_test.go
deleted file mode 100644
index 3d8edaec8..000000000
--- a/vendor/golang.org/x/text/unicode/cldr/resolve_test.go
+++ /dev/null
@@ -1,368 +0,0 @@
-package cldr
-
-import (
- "fmt"
- "log"
- "reflect"
- "testing"
-)
-
-func failOnError(err error) {
- if err != nil {
- log.Panic(err)
- }
-}
-
-func data() *CLDR {
- d := Decoder{}
- data, err := d.Decode(testLoader{})
- failOnError(err)
- return data
-}
-
-type h struct {
- A string `xml:"ha,attr"`
- E string `xml:"he"`
- D string `xml:",chardata"`
- X string
-}
-
-type fieldTest struct {
- Common
- To string `xml:"to,attr"`
- Key string `xml:"key,attr"`
- E string `xml:"e"`
- D string `xml:",chardata"`
- X string
- h
-}
-
-var testStruct = fieldTest{
- Common: Common{
- name: "mapping", // exclude "type" as distinguishing attribute
- Type: "foo",
- Alt: "foo",
- },
- To: "nyc",
- Key: "k",
- E: "E",
- D: "D",
- h: h{
- A: "A",
- E: "E",
- D: "D",
- },
-}
-
-func TestIter(t *testing.T) {
- tests := map[string]string{
- "Type": "foo",
- "Alt": "foo",
- "To": "nyc",
- "A": "A",
- "Alias": "<nil>",
- }
- k := 0
- for i := iter(reflect.ValueOf(testStruct)); !i.done(); i.next() {
- v := i.value()
- if v.Kind() == reflect.Ptr && v.Elem().Kind() == reflect.String {
- v = v.Elem()
- }
- name := i.field().Name
- if w, ok := tests[name]; ok {
- s := fmt.Sprint(v.Interface())
- if w != s {
- t.Errorf("value: found %q; want %q", w, s)
- }
- delete(tests, name)
- }
- k++
- }
- if len(tests) != 0 {
- t.Errorf("missing fields: %v", tests)
- }
-}
-
-func TestFindField(t *testing.T) {
- tests := []struct {
- name, val string
- exist bool
- }{
- {"type", "foo", true},
- {"alt", "foo", true},
- {"to", "nyc", true},
- {"he", "E", true},
- {"q", "", false},
- }
- vf := reflect.ValueOf(testStruct)
- for i, tt := range tests {
- v, err := findField(vf, tt.name)
- if (err == nil) != tt.exist {
- t.Errorf("%d: field %q present is %v; want %v", i, tt.name, err == nil, tt.exist)
- } else if tt.exist {
- if v.Kind() == reflect.Ptr {
- if v.IsNil() {
- continue
- }
- v = v.Elem()
- }
- if v.String() != tt.val {
- t.Errorf("%d: found value %q; want %q", i, v.String(), tt.val)
- }
- }
- }
-}
-
-var keyTests = []struct {
- exclude []string
- key string
-}{
- {[]string{}, "alt=foo;key=k;to=nyc"},
- {[]string{"type"}, "alt=foo;key=k;to=nyc"},
- {[]string{"choice"}, "alt=foo;key=k;to=nyc"},
- {[]string{"alt"}, "key=k;to=nyc"},
- {[]string{"a"}, "alt=foo;key=k;to=nyc"},
- {[]string{"to"}, "alt=foo;key=k"},
- {[]string{"alt", "to"}, "key=k"},
- {[]string{"alt", "to", "key"}, ""},
-}
-
-func TestAttrKey(t *testing.T) {
- v := reflect.ValueOf(&testStruct)
- for i, tt := range keyTests {
- key := attrKey(v, tt.exclude...)
- if key != tt.key {
- t.Errorf("%d: found %q, want %q", i, key, tt.key)
- }
- }
-}
-
-func TestKey(t *testing.T) {
- for i, tt := range keyTests {
- key := Key(&testStruct, tt.exclude...)
- if key != tt.key {
- t.Errorf("%d: found %q, want %q", i, key, tt.key)
- }
- }
-}
-
-func testEnclosing(t *testing.T, x *LDML, name string) {
- eq := func(a, b Elem, i int) {
- for ; i > 0; i-- {
- b = b.enclosing()
- }
- if a != b {
- t.Errorf("%s: found path %q, want %q", name, getPath(a), getPath(b))
- }
- }
- eq(x, x, 0)
- eq(x, x.Identity, 1)
- eq(x, x.Dates.Calendars, 2)
- eq(x, x.Dates.Calendars.Calendar[0], 3)
- eq(x, x.Dates.Calendars.Calendar[1], 3)
- //eq(x, x.Dates.Calendars.Calendar[0].Months, 4)
- eq(x, x.Dates.Calendars.Calendar[1].Months, 4)
-}
-
-func TestEnclosing(t *testing.T) {
- testEnclosing(t, data().RawLDML("de"), "enclosing-raw")
- de, _ := data().LDML("de")
- testEnclosing(t, de, "enclosing")
-}
-
-func TestDeepCopy(t *testing.T) {
- eq := func(have, want string) {
- if have != want {
- t.Errorf("found %q; want %q", have, want)
- }
- }
- x, _ := data().LDML("de")
- vc := deepCopy(reflect.ValueOf(x))
- c := vc.Interface().(*LDML)
- linkEnclosing(nil, c)
- if x == c {
- t.Errorf("did not copy")
- }
-
- eq(c.name, "ldml")
- eq(c.Dates.name, "dates")
- testEnclosing(t, c, "deepCopy")
-}
-
-type getTest struct {
- loc string
- path string
- field string // used in combination with length
- data string
- altData string // used for buddhist calendar if value != ""
- typ string
- length int
- missing bool
-}
-
-const (
- budMon = "dates/calendars/calendar[@type='buddhist']/months/"
- chnMon = "dates/calendars/calendar[@type='chinese']/months/"
- greMon = "dates/calendars/calendar[@type='gregorian']/months/"
-)
-
-func monthVal(path, context, width string, month int) string {
- const format = "%s/monthContext[@type='%s']/monthWidth[@type='%s']/month[@type='%d']"
- return fmt.Sprintf(format, path, context, width, month)
-}
-
-var rootGetTests = []getTest{
- {loc: "root", path: "identity/language", typ: "root"},
- {loc: "root", path: "characters/moreInformation", data: "?"},
- {loc: "root", path: "characters", field: "exemplarCharacters", length: 3},
- {loc: "root", path: greMon, field: "monthContext", length: 2},
- {loc: "root", path: greMon + "monthContext[@type='format']/monthWidth[@type='narrow']", field: "month", length: 4},
- {loc: "root", path: greMon + "monthContext[@type='stand-alone']/monthWidth[@type='wide']", field: "month", length: 4},
- // unescaping character data
- {loc: "root", path: "characters/exemplarCharacters[@type='punctuation']", data: `[\- ‐ – — … ' ‘ ‚ " “ „ \& #]`},
- // default resolution
- {loc: "root", path: "dates/calendars/calendar", typ: "gregorian"},
- // alias resolution
- {loc: "root", path: budMon, field: "monthContext", length: 2},
- // crossing but non-circular alias resolution
- {loc: "root", path: budMon + "monthContext[@type='format']/monthWidth[@type='narrow']", field: "month", length: 4},
- {loc: "root", path: budMon + "monthContext[@type='stand-alone']/monthWidth[@type='wide']", field: "month", length: 4},
- {loc: "root", path: monthVal(greMon, "format", "wide", 1), data: "11"},
- {loc: "root", path: monthVal(greMon, "format", "narrow", 2), data: "2"},
- {loc: "root", path: monthVal(greMon, "stand-alone", "wide", 3), data: "33"},
- {loc: "root", path: monthVal(greMon, "stand-alone", "narrow", 4), data: "4"},
- {loc: "root", path: monthVal(budMon, "format", "wide", 1), data: "11"},
- {loc: "root", path: monthVal(budMon, "format", "narrow", 2), data: "2"},
- {loc: "root", path: monthVal(budMon, "stand-alone", "wide", 3), data: "33"},
- {loc: "root", path: monthVal(budMon, "stand-alone", "narrow", 4), data: "4"},
-}
-
-// 19
-var deGetTests = []getTest{
- {loc: "de", path: "identity/language", typ: "de"},
- {loc: "de", path: "posix", length: 2},
- {loc: "de", path: "characters", field: "exemplarCharacters", length: 4},
- {loc: "de", path: "characters/exemplarCharacters[@type='auxiliary']", data: `[á à ă]`},
- // identity is a blocking element, so de should not inherit generation from root.
- {loc: "de", path: "identity/generation", missing: true},
- // default resolution
- {loc: "root", path: "dates/calendars/calendar", typ: "gregorian"},
-
- // absolute path alias resolution
- {loc: "gsw", path: "posix", field: "messages", length: 1},
- {loc: "gsw", path: "posix/messages/yesstr", data: "yes:y"},
-}
-
-// 27(greMon) - 52(budMon) - 77(chnMon)
-func calGetTests(s string) []getTest {
- tests := []getTest{
- {loc: "de", path: s, length: 2},
- {loc: "de", path: s + "monthContext[@type='format']/monthWidth[@type='wide']", field: "month", length: 5},
- {loc: "de", path: monthVal(s, "format", "wide", 1), data: "11"},
- {loc: "de", path: monthVal(s, "format", "wide", 2), data: "22"},
- {loc: "de", path: monthVal(s, "format", "wide", 3), data: "Maerz", altData: "bbb"},
- {loc: "de", path: monthVal(s, "format", "wide", 4), data: "April"},
- {loc: "de", path: monthVal(s, "format", "wide", 5), data: "Mai"},
-
- {loc: "de", path: s + "monthContext[@type='format']/monthWidth[@type='narrow']", field: "month", length: 5},
- {loc: "de", path: monthVal(s, "format", "narrow", 1), data: "1"},
- {loc: "de", path: monthVal(s, "format", "narrow", 2), data: "2"},
- {loc: "de", path: monthVal(s, "format", "narrow", 3), data: "M", altData: "BBB"},
- {loc: "de", path: monthVal(s, "format", "narrow", 4), data: "A"},
- {loc: "de", path: monthVal(s, "format", "narrow", 5), data: "m"},
-
- {loc: "de", path: s + "monthContext[@type='stand-alone']/monthWidth[@type='wide']", field: "month", length: 5},
- {loc: "de", path: monthVal(s, "stand-alone", "wide", 1), data: "11"},
- {loc: "de", path: monthVal(s, "stand-alone", "wide", 2), data: "22"},
- {loc: "de", path: monthVal(s, "stand-alone", "wide", 3), data: "Maerz", altData: "bbb"},
- {loc: "de", path: monthVal(s, "stand-alone", "wide", 4), data: "april"},
- {loc: "de", path: monthVal(s, "stand-alone", "wide", 5), data: "mai"},
-
- {loc: "de", path: s + "monthContext[@type='stand-alone']/monthWidth[@type='narrow']", field: "month", length: 5},
- {loc: "de", path: monthVal(s, "stand-alone", "narrow", 1), data: "1"},
- {loc: "de", path: monthVal(s, "stand-alone", "narrow", 2), data: "2"},
- {loc: "de", path: monthVal(s, "stand-alone", "narrow", 3), data: "m"},
- {loc: "de", path: monthVal(s, "stand-alone", "narrow", 4), data: "4"},
- {loc: "de", path: monthVal(s, "stand-alone", "narrow", 5), data: "m"},
- }
- if s == budMon {
- for i, t := range tests {
- if t.altData != "" {
- tests[i].data = t.altData
- }
- }
- }
- return tests
-}
-
-var getTests = append(rootGetTests,
- append(deGetTests,
- append(calGetTests(greMon),
- append(calGetTests(budMon),
- calGetTests(chnMon)...)...)...)...)
-
-func TestPath(t *testing.T) {
- d := data()
- for i, tt := range getTests {
- x, _ := d.LDML(tt.loc)
- e, err := walkXPath(x, tt.path)
- if err != nil {
- if !tt.missing {
- t.Errorf("%d:error: %v %v", i, err, tt.missing)
- }
- continue
- }
- if tt.missing {
- t.Errorf("%d: missing is %v; want %v", i, e == nil, tt.missing)
- continue
- }
- if tt.data != "" && e.GetCommon().Data() != tt.data {
- t.Errorf("%d: data is %v; want %v", i, e.GetCommon().Data(), tt.data)
- continue
- }
- if tt.typ != "" && e.GetCommon().Type != tt.typ {
- t.Errorf("%d: type is %v; want %v", i, e.GetCommon().Type, tt.typ)
- continue
- }
- if tt.field != "" {
- slice, _ := findField(reflect.ValueOf(e), tt.field)
- if slice.Len() != tt.length {
- t.Errorf("%d: length is %v; want %v", i, slice.Len(), tt.length)
- continue
- }
- }
- }
-}
-
-func TestGet(t *testing.T) {
- d := data()
- for i, tt := range getTests {
- x, _ := d.LDML(tt.loc)
- e, err := Get(x, tt.path)
- if err != nil {
- if !tt.missing {
- t.Errorf("%d:error: %v %v", i, err, tt.missing)
- }
- continue
- }
- if tt.missing {
- t.Errorf("%d: missing is %v; want %v", i, e == nil, tt.missing)
- continue
- }
- if tt.data != "" && e.GetCommon().Data() != tt.data {
- t.Errorf("%d: data is %v; want %v", i, e.GetCommon().Data(), tt.data)
- continue
- }
- if tt.typ != "" && e.GetCommon().Type != tt.typ {
- t.Errorf("%d: type is %v; want %v", i, e.GetCommon().Type, tt.typ)
- continue
- }
- if tt.field != "" {
- slice, _ := findField(reflect.ValueOf(e), tt.field)
- if slice.Len() != tt.length {
- t.Errorf("%d: length is %v; want %v", i, slice.Len(), tt.length)
- continue
- }
- }
- }
-}
diff --git a/vendor/golang.org/x/text/unicode/cldr/slice_test.go b/vendor/golang.org/x/text/unicode/cldr/slice_test.go
deleted file mode 100644
index 3d487d3bd..000000000
--- a/vendor/golang.org/x/text/unicode/cldr/slice_test.go
+++ /dev/null
@@ -1,175 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package cldr
-
-import (
- "reflect"
- "testing"
-)
-
-type testSlice []*Common
-
-func mkElem(alt, typ, ref string) *Common {
- return &Common{
- Type: typ,
- Reference: ref,
- Alt: alt,
- }
-}
-
-var (
- testSlice1 = testSlice{
- mkElem("1", "a", "i.a"),
- mkElem("1", "b", "i.b"),
- mkElem("1", "c", "i.c"),
- mkElem("2", "b", "ii"),
- mkElem("3", "c", "iii"),
- mkElem("4", "a", "iv.a"),
- mkElem("4", "d", "iv.d"),
- }
- testSliceE = testSlice{}
-)
-
-func panics(f func()) (panics bool) {
- defer func() {
- if err := recover(); err != nil {
- panics = true
- }
- }()
- f()
- return panics
-}
-
-func TestMakeSlice(t *testing.T) {
- foo := 1
- bar := []int{}
- tests := []struct {
- i interface{}
- panics bool
- err string
- }{
- {&foo, true, "should panic when passed a pointer to the wrong type"},
- {&bar, true, "should panic when slice element of the wrong type"},
- {testSlice1, true, "should panic when passed a slice"},
- {&testSlice1, false, "should not panic"},
- }
- for i, tt := range tests {
- if panics(func() { MakeSlice(tt.i) }) != tt.panics {
- t.Errorf("%d: %s", i, tt.err)
- }
- }
-}
-
-var anyOfTests = []struct {
- sl testSlice
- values []string
- n int
-}{
- {testSliceE, []string{}, 0},
- {testSliceE, []string{"1", "2", "3"}, 0},
- {testSlice1, []string{}, 0},
- {testSlice1, []string{"1"}, 3},
- {testSlice1, []string{"2"}, 1},
- {testSlice1, []string{"5"}, 0},
- {testSlice1, []string{"1", "2", "3"}, 5},
-}
-
-func TestSelectAnyOf(t *testing.T) {
- for i, tt := range anyOfTests {
- sl := tt.sl
- s := MakeSlice(&sl)
- s.SelectAnyOf("alt", tt.values...)
- if len(sl) != tt.n {
- t.Errorf("%d: found len == %d; want %d", i, len(sl), tt.n)
- }
- }
- sl := testSlice1
- s := MakeSlice(&sl)
- if !panics(func() { s.SelectAnyOf("foo") }) {
- t.Errorf("should panic on non-existing attribute")
- }
-}
-
-func TestFilter(t *testing.T) {
- for i, tt := range anyOfTests {
- sl := tt.sl
- s := MakeSlice(&sl)
- s.Filter(func(e Elem) bool {
- v, _ := findField(reflect.ValueOf(e), "alt")
- return in(tt.values, v.String())
- })
- if len(sl) != tt.n {
- t.Errorf("%d: found len == %d; want %d", i, len(sl), tt.n)
- }
- }
-}
-
-func TestGroup(t *testing.T) {
- f := func(excl ...string) func(Elem) string {
- return func(e Elem) string {
- return Key(e, excl...)
- }
- }
- tests := []struct {
- sl testSlice
- f func(Elem) string
- lens []int
- }{
- {testSliceE, f(), []int{}},
- {testSlice1, f(), []int{1, 1, 1, 1, 1, 1, 1}},
- {testSlice1, f("type"), []int{3, 1, 1, 2}},
- {testSlice1, f("alt"), []int{2, 2, 2, 1}},
- {testSlice1, f("alt", "type"), []int{7}},
- {testSlice1, f("alt", "type"), []int{7}},
- }
- for i, tt := range tests {
- sl := tt.sl
- s := MakeSlice(&sl)
- g := s.Group(tt.f)
- if len(tt.lens) != len(g) {
- t.Errorf("%d: found %d; want %d", i, len(g), len(tt.lens))
- continue
- }
- for j, v := range tt.lens {
- if n := g[j].Value().Len(); n != v {
- t.Errorf("%d: found %d for length of group %d; want %d", i, n, j, v)
- }
- }
- }
-}
-
-func TestSelectOnePerGroup(t *testing.T) {
- tests := []struct {
- sl testSlice
- attr string
- values []string
- refs []string
- }{
- {testSliceE, "alt", []string{"1"}, []string{}},
- {testSliceE, "type", []string{"a"}, []string{}},
- {testSlice1, "alt", []string{"2", "3", "1"}, []string{"i.a", "ii", "iii"}},
- {testSlice1, "alt", []string{"1", "4"}, []string{"i.a", "i.b", "i.c", "iv.d"}},
- {testSlice1, "type", []string{"c", "d"}, []string{"i.c", "iii", "iv.d"}},
- }
- for i, tt := range tests {
- sl := tt.sl
- s := MakeSlice(&sl)
- s.SelectOnePerGroup(tt.attr, tt.values)
- if len(sl) != len(tt.refs) {
- t.Errorf("%d: found result length %d; want %d", i, len(sl), len(tt.refs))
- continue
- }
- for j, e := range sl {
- if tt.refs[j] != e.Reference {
- t.Errorf("%d:%d found %s; want %s", i, j, e.Reference, tt.refs[i])
- }
- }
- }
- sl := testSlice1
- s := MakeSlice(&sl)
- if !panics(func() { s.SelectOnePerGroup("foo", nil) }) {
- t.Errorf("should panic on non-existing attribute")
- }
-}
diff --git a/vendor/golang.org/x/text/unicode/norm/composition_test.go b/vendor/golang.org/x/text/unicode/norm/composition_test.go
deleted file mode 100644
index 11684069d..000000000
--- a/vendor/golang.org/x/text/unicode/norm/composition_test.go
+++ /dev/null
@@ -1,130 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package norm
-
-import "testing"
-
-// TestCase is used for most tests.
-type TestCase struct {
- in []rune
- out []rune
-}
-
-func runTests(t *testing.T, name string, fm Form, tests []TestCase) {
- rb := reorderBuffer{}
- rb.init(fm, nil)
- for i, test := range tests {
- rb.setFlusher(nil, appendFlush)
- for j, rune := range test.in {
- b := []byte(string(rune))
- src := inputBytes(b)
- info := rb.f.info(src, 0)
- if j == 0 {
- rb.ss.first(info)
- } else {
- rb.ss.next(info)
- }
- if rb.insertFlush(src, 0, info) < 0 {
- t.Errorf("%s:%d: insert failed for rune %d", name, i, j)
- }
- }
- rb.doFlush()
- was := string(rb.out)
- want := string(test.out)
- if len(was) != len(want) {
- t.Errorf("%s:%d: length = %d; want %d", name, i, len(was), len(want))
- }
- if was != want {
- k, pfx := pidx(was, want)
- t.Errorf("%s:%d: \nwas %s%+q; \nwant %s%+q", name, i, pfx, was[k:], pfx, want[k:])
- }
- }
-}
-
-func TestFlush(t *testing.T) {
- const (
- hello = "Hello "
- world = "world!"
- )
- buf := make([]byte, maxByteBufferSize)
- p := copy(buf, hello)
- out := buf[p:]
- rb := reorderBuffer{}
- rb.initString(NFC, world)
- if i := rb.flushCopy(out); i != 0 {
- t.Errorf("wrote bytes on flush of empty buffer. (len(out) = %d)", i)
- }
-
- for i := range world {
- // No need to set streamSafe values for this test.
- rb.insertFlush(rb.src, i, rb.f.info(rb.src, i))
- n := rb.flushCopy(out)
- out = out[n:]
- p += n
- }
-
- was := buf[:p]
- want := hello + world
- if string(was) != want {
- t.Errorf(`output after flush was "%s"; want "%s"`, string(was), want)
- }
- if rb.nrune != 0 {
- t.Errorf("non-null size of info buffer (rb.nrune == %d)", rb.nrune)
- }
- if rb.nbyte != 0 {
- t.Errorf("non-null size of byte buffer (rb.nbyte == %d)", rb.nbyte)
- }
-}
-
-var insertTests = []TestCase{
- {[]rune{'a'}, []rune{'a'}},
- {[]rune{0x300}, []rune{0x300}},
- {[]rune{0x300, 0x316}, []rune{0x316, 0x300}}, // CCC(0x300)==230; CCC(0x316)==220
- {[]rune{0x316, 0x300}, []rune{0x316, 0x300}},
- {[]rune{0x41, 0x316, 0x300}, []rune{0x41, 0x316, 0x300}},
- {[]rune{0x41, 0x300, 0x316}, []rune{0x41, 0x316, 0x300}},
- {[]rune{0x300, 0x316, 0x41}, []rune{0x316, 0x300, 0x41}},
- {[]rune{0x41, 0x300, 0x40, 0x316}, []rune{0x41, 0x300, 0x40, 0x316}},
-}
-
-func TestInsert(t *testing.T) {
- runTests(t, "TestInsert", NFD, insertTests)
-}
-
-var decompositionNFDTest = []TestCase{
- {[]rune{0xC0}, []rune{0x41, 0x300}},
- {[]rune{0xAC00}, []rune{0x1100, 0x1161}},
- {[]rune{0x01C4}, []rune{0x01C4}},
- {[]rune{0x320E}, []rune{0x320E}},
- {[]rune("음ẻ과"), []rune{0x110B, 0x1173, 0x11B7, 0x65, 0x309, 0x1100, 0x116A}},
-}
-
-var decompositionNFKDTest = []TestCase{
- {[]rune{0xC0}, []rune{0x41, 0x300}},
- {[]rune{0xAC00}, []rune{0x1100, 0x1161}},
- {[]rune{0x01C4}, []rune{0x44, 0x5A, 0x030C}},
- {[]rune{0x320E}, []rune{0x28, 0x1100, 0x1161, 0x29}},
-}
-
-func TestDecomposition(t *testing.T) {
- runTests(t, "TestDecompositionNFD", NFD, decompositionNFDTest)
- runTests(t, "TestDecompositionNFKD", NFKD, decompositionNFKDTest)
-}
-
-var compositionTest = []TestCase{
- {[]rune{0x41, 0x300}, []rune{0xC0}},
- {[]rune{0x41, 0x316}, []rune{0x41, 0x316}},
- {[]rune{0x41, 0x300, 0x35D}, []rune{0xC0, 0x35D}},
- {[]rune{0x41, 0x316, 0x300}, []rune{0xC0, 0x316}},
- // blocking starter
- {[]rune{0x41, 0x316, 0x40, 0x300}, []rune{0x41, 0x316, 0x40, 0x300}},
- {[]rune{0x1100, 0x1161}, []rune{0xAC00}},
- // parenthesized Hangul, alternate between ASCII and Hangul.
- {[]rune{0x28, 0x1100, 0x1161, 0x29}, []rune{0x28, 0xAC00, 0x29}},
-}
-
-func TestComposition(t *testing.T) {
- runTests(t, "TestComposition", NFC, compositionTest)
-}
diff --git a/vendor/golang.org/x/text/unicode/norm/data10.0.0_test.go b/vendor/golang.org/x/text/unicode/norm/data10.0.0_test.go
deleted file mode 100644
index 1d0f73dc1..000000000
--- a/vendor/golang.org/x/text/unicode/norm/data10.0.0_test.go
+++ /dev/null
@@ -1,7424 +0,0 @@
-// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
-
-// +build go1.10
-
-package norm
-
-const (
- Yes = iota
- No
- Maybe
-)
-
-type formData struct {
- qc uint8
- combinesForward bool
- decomposition string
-}
-
-type runeData struct {
- r rune
- ccc uint8
- nLead uint8
- nTrail uint8
- f [2]formData // 0: canonical; 1: compatibility
-}
-
-func f(qc uint8, cf bool, dec string) [2]formData {
- return [2]formData{{qc, cf, dec}, {qc, cf, dec}}
-}
-
-func g(qc, qck uint8, cf, cfk bool, d, dk string) [2]formData {
- return [2]formData{{qc, cf, d}, {qck, cfk, dk}}
-}
-
-var testData = []runeData{
- {0x0, 0, 0, 0, f(Yes, false, "")},
- {0x3c, 0, 0, 0, f(Yes, true, "")},
- {0x3f, 0, 0, 0, f(Yes, false, "")},
- {0x41, 0, 0, 0, f(Yes, true, "")},
- {0x51, 0, 0, 0, f(Yes, false, "")},
- {0x52, 0, 0, 0, f(Yes, true, "")},
- {0x5b, 0, 0, 0, f(Yes, false, "")},
- {0x61, 0, 0, 0, f(Yes, true, "")},
- {0x71, 0, 0, 0, f(Yes, false, "")},
- {0x72, 0, 0, 0, f(Yes, true, "")},
- {0x7b, 0, 0, 0, f(Yes, false, "")},
- {0xa0, 0, 0, 0, g(Yes, No, false, false, "", " ")},
- {0xa1, 0, 0, 0, f(Yes, false, "")},
- {0xa8, 0, 0, 1, g(Yes, No, true, false, "", " ̈")},
- {0xa9, 0, 0, 0, f(Yes, false, "")},
- {0xaa, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0xab, 0, 0, 0, f(Yes, false, "")},
- {0xaf, 0, 0, 1, g(Yes, No, false, false, "", " ̄")},
- {0xb0, 0, 0, 0, f(Yes, false, "")},
- {0xb2, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0xb3, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0xb4, 0, 0, 1, g(Yes, No, false, false, "", " ́")},
- {0xb5, 0, 0, 0, g(Yes, No, false, false, "", "μ")},
- {0xb6, 0, 0, 0, f(Yes, false, "")},
- {0xb8, 0, 0, 1, g(Yes, No, false, false, "", " ̧")},
- {0xb9, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0xba, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0xbb, 0, 0, 0, f(Yes, false, "")},
- {0xbc, 0, 0, 0, g(Yes, No, false, false, "", "1⁄4")},
- {0xbd, 0, 0, 0, g(Yes, No, false, false, "", "1⁄2")},
- {0xbe, 0, 0, 0, g(Yes, No, false, false, "", "3⁄4")},
- {0xbf, 0, 0, 0, f(Yes, false, "")},
- {0xc0, 0, 0, 1, f(Yes, false, "À")},
- {0xc1, 0, 0, 1, f(Yes, false, "Á")},
- {0xc2, 0, 0, 1, f(Yes, true, "Â")},
- {0xc3, 0, 0, 1, f(Yes, false, "Ã")},
- {0xc4, 0, 0, 1, f(Yes, true, "Ä")},
- {0xc5, 0, 0, 1, f(Yes, true, "Å")},
- {0xc6, 0, 0, 0, f(Yes, true, "")},
- {0xc7, 0, 0, 1, f(Yes, true, "Ç")},
- {0xc8, 0, 0, 1, f(Yes, false, "È")},
- {0xc9, 0, 0, 1, f(Yes, false, "É")},
- {0xca, 0, 0, 1, f(Yes, true, "Ê")},
- {0xcb, 0, 0, 1, f(Yes, false, "Ë")},
- {0xcc, 0, 0, 1, f(Yes, false, "Ì")},
- {0xcd, 0, 0, 1, f(Yes, false, "Í")},
- {0xce, 0, 0, 1, f(Yes, false, "Î")},
- {0xcf, 0, 0, 1, f(Yes, true, "Ï")},
- {0xd0, 0, 0, 0, f(Yes, false, "")},
- {0xd1, 0, 0, 1, f(Yes, false, "Ñ")},
- {0xd2, 0, 0, 1, f(Yes, false, "Ò")},
- {0xd3, 0, 0, 1, f(Yes, false, "Ó")},
- {0xd4, 0, 0, 1, f(Yes, true, "Ô")},
- {0xd5, 0, 0, 1, f(Yes, true, "Õ")},
- {0xd6, 0, 0, 1, f(Yes, true, "Ö")},
- {0xd7, 0, 0, 0, f(Yes, false, "")},
- {0xd8, 0, 0, 0, f(Yes, true, "")},
- {0xd9, 0, 0, 1, f(Yes, false, "Ù")},
- {0xda, 0, 0, 1, f(Yes, false, "Ú")},
- {0xdb, 0, 0, 1, f(Yes, false, "Û")},
- {0xdc, 0, 0, 1, f(Yes, true, "Ü")},
- {0xdd, 0, 0, 1, f(Yes, false, "Ý")},
- {0xde, 0, 0, 0, f(Yes, false, "")},
- {0xe0, 0, 0, 1, f(Yes, false, "à")},
- {0xe1, 0, 0, 1, f(Yes, false, "á")},
- {0xe2, 0, 0, 1, f(Yes, true, "â")},
- {0xe3, 0, 0, 1, f(Yes, false, "ã")},
- {0xe4, 0, 0, 1, f(Yes, true, "ä")},
- {0xe5, 0, 0, 1, f(Yes, true, "å")},
- {0xe6, 0, 0, 0, f(Yes, true, "")},
- {0xe7, 0, 0, 1, f(Yes, true, "ç")},
- {0xe8, 0, 0, 1, f(Yes, false, "è")},
- {0xe9, 0, 0, 1, f(Yes, false, "é")},
- {0xea, 0, 0, 1, f(Yes, true, "ê")},
- {0xeb, 0, 0, 1, f(Yes, false, "ë")},
- {0xec, 0, 0, 1, f(Yes, false, "ì")},
- {0xed, 0, 0, 1, f(Yes, false, "í")},
- {0xee, 0, 0, 1, f(Yes, false, "î")},
- {0xef, 0, 0, 1, f(Yes, true, "ï")},
- {0xf0, 0, 0, 0, f(Yes, false, "")},
- {0xf1, 0, 0, 1, f(Yes, false, "ñ")},
- {0xf2, 0, 0, 1, f(Yes, false, "ò")},
- {0xf3, 0, 0, 1, f(Yes, false, "ó")},
- {0xf4, 0, 0, 1, f(Yes, true, "ô")},
- {0xf5, 0, 0, 1, f(Yes, true, "õ")},
- {0xf6, 0, 0, 1, f(Yes, true, "ö")},
- {0xf7, 0, 0, 0, f(Yes, false, "")},
- {0xf8, 0, 0, 0, f(Yes, true, "")},
- {0xf9, 0, 0, 1, f(Yes, false, "ù")},
- {0xfa, 0, 0, 1, f(Yes, false, "ú")},
- {0xfb, 0, 0, 1, f(Yes, false, "û")},
- {0xfc, 0, 0, 1, f(Yes, true, "ü")},
- {0xfd, 0, 0, 1, f(Yes, false, "ý")},
- {0xfe, 0, 0, 0, f(Yes, false, "")},
- {0xff, 0, 0, 1, f(Yes, false, "ÿ")},
- {0x100, 0, 0, 1, f(Yes, false, "Ā")},
- {0x101, 0, 0, 1, f(Yes, false, "ā")},
- {0x102, 0, 0, 1, f(Yes, true, "Ă")},
- {0x103, 0, 0, 1, f(Yes, true, "ă")},
- {0x104, 0, 0, 1, f(Yes, false, "Ą")},
- {0x105, 0, 0, 1, f(Yes, false, "ą")},
- {0x106, 0, 0, 1, f(Yes, false, "Ć")},
- {0x107, 0, 0, 1, f(Yes, false, "ć")},
- {0x108, 0, 0, 1, f(Yes, false, "Ĉ")},
- {0x109, 0, 0, 1, f(Yes, false, "ĉ")},
- {0x10a, 0, 0, 1, f(Yes, false, "Ċ")},
- {0x10b, 0, 0, 1, f(Yes, false, "ċ")},
- {0x10c, 0, 0, 1, f(Yes, false, "Č")},
- {0x10d, 0, 0, 1, f(Yes, false, "č")},
- {0x10e, 0, 0, 1, f(Yes, false, "Ď")},
- {0x10f, 0, 0, 1, f(Yes, false, "ď")},
- {0x110, 0, 0, 0, f(Yes, false, "")},
- {0x112, 0, 0, 1, f(Yes, true, "Ē")},
- {0x113, 0, 0, 1, f(Yes, true, "ē")},
- {0x114, 0, 0, 1, f(Yes, false, "Ĕ")},
- {0x115, 0, 0, 1, f(Yes, false, "ĕ")},
- {0x116, 0, 0, 1, f(Yes, false, "Ė")},
- {0x117, 0, 0, 1, f(Yes, false, "ė")},
- {0x118, 0, 0, 1, f(Yes, false, "Ę")},
- {0x119, 0, 0, 1, f(Yes, false, "ę")},
- {0x11a, 0, 0, 1, f(Yes, false, "Ě")},
- {0x11b, 0, 0, 1, f(Yes, false, "ě")},
- {0x11c, 0, 0, 1, f(Yes, false, "Ĝ")},
- {0x11d, 0, 0, 1, f(Yes, false, "ĝ")},
- {0x11e, 0, 0, 1, f(Yes, false, "Ğ")},
- {0x11f, 0, 0, 1, f(Yes, false, "ğ")},
- {0x120, 0, 0, 1, f(Yes, false, "Ġ")},
- {0x121, 0, 0, 1, f(Yes, false, "ġ")},
- {0x122, 0, 0, 1, f(Yes, false, "Ģ")},
- {0x123, 0, 0, 1, f(Yes, false, "ģ")},
- {0x124, 0, 0, 1, f(Yes, false, "Ĥ")},
- {0x125, 0, 0, 1, f(Yes, false, "ĥ")},
- {0x126, 0, 0, 0, f(Yes, false, "")},
- {0x128, 0, 0, 1, f(Yes, false, "Ĩ")},
- {0x129, 0, 0, 1, f(Yes, false, "ĩ")},
- {0x12a, 0, 0, 1, f(Yes, false, "Ī")},
- {0x12b, 0, 0, 1, f(Yes, false, "ī")},
- {0x12c, 0, 0, 1, f(Yes, false, "Ĭ")},
- {0x12d, 0, 0, 1, f(Yes, false, "ĭ")},
- {0x12e, 0, 0, 1, f(Yes, false, "Į")},
- {0x12f, 0, 0, 1, f(Yes, false, "į")},
- {0x130, 0, 0, 1, f(Yes, false, "İ")},
- {0x131, 0, 0, 0, f(Yes, false, "")},
- {0x132, 0, 0, 0, g(Yes, No, false, false, "", "IJ")},
- {0x133, 0, 0, 0, g(Yes, No, false, false, "", "ij")},
- {0x134, 0, 0, 1, f(Yes, false, "Ĵ")},
- {0x135, 0, 0, 1, f(Yes, false, "ĵ")},
- {0x136, 0, 0, 1, f(Yes, false, "Ķ")},
- {0x137, 0, 0, 1, f(Yes, false, "ķ")},
- {0x138, 0, 0, 0, f(Yes, false, "")},
- {0x139, 0, 0, 1, f(Yes, false, "Ĺ")},
- {0x13a, 0, 0, 1, f(Yes, false, "ĺ")},
- {0x13b, 0, 0, 1, f(Yes, false, "Ļ")},
- {0x13c, 0, 0, 1, f(Yes, false, "ļ")},
- {0x13d, 0, 0, 1, f(Yes, false, "Ľ")},
- {0x13e, 0, 0, 1, f(Yes, false, "ľ")},
- {0x13f, 0, 0, 0, g(Yes, No, false, false, "", "L·")},
- {0x140, 0, 0, 0, g(Yes, No, false, false, "", "l·")},
- {0x141, 0, 0, 0, f(Yes, false, "")},
- {0x143, 0, 0, 1, f(Yes, false, "Ń")},
- {0x144, 0, 0, 1, f(Yes, false, "ń")},
- {0x145, 0, 0, 1, f(Yes, false, "Ņ")},
- {0x146, 0, 0, 1, f(Yes, false, "ņ")},
- {0x147, 0, 0, 1, f(Yes, false, "Ň")},
- {0x148, 0, 0, 1, f(Yes, false, "ň")},
- {0x149, 0, 0, 0, g(Yes, No, false, false, "", "ʼn")},
- {0x14a, 0, 0, 0, f(Yes, false, "")},
- {0x14c, 0, 0, 1, f(Yes, true, "Ō")},
- {0x14d, 0, 0, 1, f(Yes, true, "ō")},
- {0x14e, 0, 0, 1, f(Yes, false, "Ŏ")},
- {0x14f, 0, 0, 1, f(Yes, false, "ŏ")},
- {0x150, 0, 0, 1, f(Yes, false, "Ő")},
- {0x151, 0, 0, 1, f(Yes, false, "ő")},
- {0x152, 0, 0, 0, f(Yes, false, "")},
- {0x154, 0, 0, 1, f(Yes, false, "Ŕ")},
- {0x155, 0, 0, 1, f(Yes, false, "ŕ")},
- {0x156, 0, 0, 1, f(Yes, false, "Ŗ")},
- {0x157, 0, 0, 1, f(Yes, false, "ŗ")},
- {0x158, 0, 0, 1, f(Yes, false, "Ř")},
- {0x159, 0, 0, 1, f(Yes, false, "ř")},
- {0x15a, 0, 0, 1, f(Yes, true, "Ś")},
- {0x15b, 0, 0, 1, f(Yes, true, "ś")},
- {0x15c, 0, 0, 1, f(Yes, false, "Ŝ")},
- {0x15d, 0, 0, 1, f(Yes, false, "ŝ")},
- {0x15e, 0, 0, 1, f(Yes, false, "Ş")},
- {0x15f, 0, 0, 1, f(Yes, false, "ş")},
- {0x160, 0, 0, 1, f(Yes, true, "Š")},
- {0x161, 0, 0, 1, f(Yes, true, "š")},
- {0x162, 0, 0, 1, f(Yes, false, "Ţ")},
- {0x163, 0, 0, 1, f(Yes, false, "ţ")},
- {0x164, 0, 0, 1, f(Yes, false, "Ť")},
- {0x165, 0, 0, 1, f(Yes, false, "ť")},
- {0x166, 0, 0, 0, f(Yes, false, "")},
- {0x168, 0, 0, 1, f(Yes, true, "Ũ")},
- {0x169, 0, 0, 1, f(Yes, true, "ũ")},
- {0x16a, 0, 0, 1, f(Yes, true, "Ū")},
- {0x16b, 0, 0, 1, f(Yes, true, "ū")},
- {0x16c, 0, 0, 1, f(Yes, false, "Ŭ")},
- {0x16d, 0, 0, 1, f(Yes, false, "ŭ")},
- {0x16e, 0, 0, 1, f(Yes, false, "Ů")},
- {0x16f, 0, 0, 1, f(Yes, false, "ů")},
- {0x170, 0, 0, 1, f(Yes, false, "Ű")},
- {0x171, 0, 0, 1, f(Yes, false, "ű")},
- {0x172, 0, 0, 1, f(Yes, false, "Ų")},
- {0x173, 0, 0, 1, f(Yes, false, "ų")},
- {0x174, 0, 0, 1, f(Yes, false, "Ŵ")},
- {0x175, 0, 0, 1, f(Yes, false, "ŵ")},
- {0x176, 0, 0, 1, f(Yes, false, "Ŷ")},
- {0x177, 0, 0, 1, f(Yes, false, "ŷ")},
- {0x178, 0, 0, 1, f(Yes, false, "Ÿ")},
- {0x179, 0, 0, 1, f(Yes, false, "Ź")},
- {0x17a, 0, 0, 1, f(Yes, false, "ź")},
- {0x17b, 0, 0, 1, f(Yes, false, "Ż")},
- {0x17c, 0, 0, 1, f(Yes, false, "ż")},
- {0x17d, 0, 0, 1, f(Yes, false, "Ž")},
- {0x17e, 0, 0, 1, f(Yes, false, "ž")},
- {0x17f, 0, 0, 0, g(Yes, No, true, false, "", "s")},
- {0x180, 0, 0, 0, f(Yes, false, "")},
- {0x1a0, 0, 0, 1, f(Yes, true, "Ơ")},
- {0x1a1, 0, 0, 1, f(Yes, true, "ơ")},
- {0x1a2, 0, 0, 0, f(Yes, false, "")},
- {0x1af, 0, 0, 1, f(Yes, true, "Ư")},
- {0x1b0, 0, 0, 1, f(Yes, true, "ư")},
- {0x1b1, 0, 0, 0, f(Yes, false, "")},
- {0x1b7, 0, 0, 0, f(Yes, true, "")},
- {0x1b8, 0, 0, 0, f(Yes, false, "")},
- {0x1c4, 0, 0, 1, g(Yes, No, false, false, "", "DŽ")},
- {0x1c5, 0, 0, 1, g(Yes, No, false, false, "", "Dž")},
- {0x1c6, 0, 0, 1, g(Yes, No, false, false, "", "dž")},
- {0x1c7, 0, 0, 0, g(Yes, No, false, false, "", "LJ")},
- {0x1c8, 0, 0, 0, g(Yes, No, false, false, "", "Lj")},
- {0x1c9, 0, 0, 0, g(Yes, No, false, false, "", "lj")},
- {0x1ca, 0, 0, 0, g(Yes, No, false, false, "", "NJ")},
- {0x1cb, 0, 0, 0, g(Yes, No, false, false, "", "Nj")},
- {0x1cc, 0, 0, 0, g(Yes, No, false, false, "", "nj")},
- {0x1cd, 0, 0, 1, f(Yes, false, "Ǎ")},
- {0x1ce, 0, 0, 1, f(Yes, false, "ǎ")},
- {0x1cf, 0, 0, 1, f(Yes, false, "Ǐ")},
- {0x1d0, 0, 0, 1, f(Yes, false, "ǐ")},
- {0x1d1, 0, 0, 1, f(Yes, false, "Ǒ")},
- {0x1d2, 0, 0, 1, f(Yes, false, "ǒ")},
- {0x1d3, 0, 0, 1, f(Yes, false, "Ǔ")},
- {0x1d4, 0, 0, 1, f(Yes, false, "ǔ")},
- {0x1d5, 0, 0, 2, f(Yes, false, "Ǖ")},
- {0x1d6, 0, 0, 2, f(Yes, false, "ǖ")},
- {0x1d7, 0, 0, 2, f(Yes, false, "Ǘ")},
- {0x1d8, 0, 0, 2, f(Yes, false, "ǘ")},
- {0x1d9, 0, 0, 2, f(Yes, false, "Ǚ")},
- {0x1da, 0, 0, 2, f(Yes, false, "ǚ")},
- {0x1db, 0, 0, 2, f(Yes, false, "Ǜ")},
- {0x1dc, 0, 0, 2, f(Yes, false, "ǜ")},
- {0x1dd, 0, 0, 0, f(Yes, false, "")},
- {0x1de, 0, 0, 2, f(Yes, false, "Ǟ")},
- {0x1df, 0, 0, 2, f(Yes, false, "ǟ")},
- {0x1e0, 0, 0, 2, f(Yes, false, "Ǡ")},
- {0x1e1, 0, 0, 2, f(Yes, false, "ǡ")},
- {0x1e2, 0, 0, 1, f(Yes, false, "Ǣ")},
- {0x1e3, 0, 0, 1, f(Yes, false, "ǣ")},
- {0x1e4, 0, 0, 0, f(Yes, false, "")},
- {0x1e6, 0, 0, 1, f(Yes, false, "Ǧ")},
- {0x1e7, 0, 0, 1, f(Yes, false, "ǧ")},
- {0x1e8, 0, 0, 1, f(Yes, false, "Ǩ")},
- {0x1e9, 0, 0, 1, f(Yes, false, "ǩ")},
- {0x1ea, 0, 0, 1, f(Yes, true, "Ǫ")},
- {0x1eb, 0, 0, 1, f(Yes, true, "ǫ")},
- {0x1ec, 0, 0, 2, f(Yes, false, "Ǭ")},
- {0x1ed, 0, 0, 2, f(Yes, false, "ǭ")},
- {0x1ee, 0, 0, 1, f(Yes, false, "Ǯ")},
- {0x1ef, 0, 0, 1, f(Yes, false, "ǯ")},
- {0x1f0, 0, 0, 1, f(Yes, false, "ǰ")},
- {0x1f1, 0, 0, 0, g(Yes, No, false, false, "", "DZ")},
- {0x1f2, 0, 0, 0, g(Yes, No, false, false, "", "Dz")},
- {0x1f3, 0, 0, 0, g(Yes, No, false, false, "", "dz")},
- {0x1f4, 0, 0, 1, f(Yes, false, "Ǵ")},
- {0x1f5, 0, 0, 1, f(Yes, false, "ǵ")},
- {0x1f6, 0, 0, 0, f(Yes, false, "")},
- {0x1f8, 0, 0, 1, f(Yes, false, "Ǹ")},
- {0x1f9, 0, 0, 1, f(Yes, false, "ǹ")},
- {0x1fa, 0, 0, 2, f(Yes, false, "Ǻ")},
- {0x1fb, 0, 0, 2, f(Yes, false, "ǻ")},
- {0x1fc, 0, 0, 1, f(Yes, false, "Ǽ")},
- {0x1fd, 0, 0, 1, f(Yes, false, "ǽ")},
- {0x1fe, 0, 0, 1, f(Yes, false, "Ǿ")},
- {0x1ff, 0, 0, 1, f(Yes, false, "ǿ")},
- {0x200, 0, 0, 1, f(Yes, false, "Ȁ")},
- {0x201, 0, 0, 1, f(Yes, false, "ȁ")},
- {0x202, 0, 0, 1, f(Yes, false, "Ȃ")},
- {0x203, 0, 0, 1, f(Yes, false, "ȃ")},
- {0x204, 0, 0, 1, f(Yes, false, "Ȅ")},
- {0x205, 0, 0, 1, f(Yes, false, "ȅ")},
- {0x206, 0, 0, 1, f(Yes, false, "Ȇ")},
- {0x207, 0, 0, 1, f(Yes, false, "ȇ")},
- {0x208, 0, 0, 1, f(Yes, false, "Ȉ")},
- {0x209, 0, 0, 1, f(Yes, false, "ȉ")},
- {0x20a, 0, 0, 1, f(Yes, false, "Ȋ")},
- {0x20b, 0, 0, 1, f(Yes, false, "ȋ")},
- {0x20c, 0, 0, 1, f(Yes, false, "Ȍ")},
- {0x20d, 0, 0, 1, f(Yes, false, "ȍ")},
- {0x20e, 0, 0, 1, f(Yes, false, "Ȏ")},
- {0x20f, 0, 0, 1, f(Yes, false, "ȏ")},
- {0x210, 0, 0, 1, f(Yes, false, "Ȑ")},
- {0x211, 0, 0, 1, f(Yes, false, "ȑ")},
- {0x212, 0, 0, 1, f(Yes, false, "Ȓ")},
- {0x213, 0, 0, 1, f(Yes, false, "ȓ")},
- {0x214, 0, 0, 1, f(Yes, false, "Ȕ")},
- {0x215, 0, 0, 1, f(Yes, false, "ȕ")},
- {0x216, 0, 0, 1, f(Yes, false, "Ȗ")},
- {0x217, 0, 0, 1, f(Yes, false, "ȗ")},
- {0x218, 0, 0, 1, f(Yes, false, "Ș")},
- {0x219, 0, 0, 1, f(Yes, false, "ș")},
- {0x21a, 0, 0, 1, f(Yes, false, "Ț")},
- {0x21b, 0, 0, 1, f(Yes, false, "ț")},
- {0x21c, 0, 0, 0, f(Yes, false, "")},
- {0x21e, 0, 0, 1, f(Yes, false, "Ȟ")},
- {0x21f, 0, 0, 1, f(Yes, false, "ȟ")},
- {0x220, 0, 0, 0, f(Yes, false, "")},
- {0x226, 0, 0, 1, f(Yes, true, "Ȧ")},
- {0x227, 0, 0, 1, f(Yes, true, "ȧ")},
- {0x228, 0, 0, 1, f(Yes, true, "Ȩ")},
- {0x229, 0, 0, 1, f(Yes, true, "ȩ")},
- {0x22a, 0, 0, 2, f(Yes, false, "Ȫ")},
- {0x22b, 0, 0, 2, f(Yes, false, "ȫ")},
- {0x22c, 0, 0, 2, f(Yes, false, "Ȭ")},
- {0x22d, 0, 0, 2, f(Yes, false, "ȭ")},
- {0x22e, 0, 0, 1, f(Yes, true, "Ȯ")},
- {0x22f, 0, 0, 1, f(Yes, true, "ȯ")},
- {0x230, 0, 0, 2, f(Yes, false, "Ȱ")},
- {0x231, 0, 0, 2, f(Yes, false, "ȱ")},
- {0x232, 0, 0, 1, f(Yes, false, "Ȳ")},
- {0x233, 0, 0, 1, f(Yes, false, "ȳ")},
- {0x234, 0, 0, 0, f(Yes, false, "")},
- {0x292, 0, 0, 0, f(Yes, true, "")},
- {0x293, 0, 0, 0, f(Yes, false, "")},
- {0x2b0, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x2b1, 0, 0, 0, g(Yes, No, false, false, "", "ɦ")},
- {0x2b2, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x2b3, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x2b4, 0, 0, 0, g(Yes, No, false, false, "", "ɹ")},
- {0x2b5, 0, 0, 0, g(Yes, No, false, false, "", "ɻ")},
- {0x2b6, 0, 0, 0, g(Yes, No, false, false, "", "ʁ")},
- {0x2b7, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x2b8, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x2b9, 0, 0, 0, f(Yes, false, "")},
- {0x2d8, 0, 0, 1, g(Yes, No, false, false, "", " ̆")},
- {0x2d9, 0, 0, 1, g(Yes, No, false, false, "", " ̇")},
- {0x2da, 0, 0, 1, g(Yes, No, false, false, "", " ̊")},
- {0x2db, 0, 0, 1, g(Yes, No, false, false, "", " ̨")},
- {0x2dc, 0, 0, 1, g(Yes, No, false, false, "", " ̃")},
- {0x2dd, 0, 0, 1, g(Yes, No, false, false, "", " ̋")},
- {0x2de, 0, 0, 0, f(Yes, false, "")},
- {0x2e0, 0, 0, 0, g(Yes, No, false, false, "", "ɣ")},
- {0x2e1, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x2e2, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x2e3, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x2e4, 0, 0, 0, g(Yes, No, false, false, "", "ʕ")},
- {0x2e5, 0, 0, 0, f(Yes, false, "")},
- {0x300, 230, 1, 1, f(Maybe, false, "")},
- {0x305, 230, 1, 1, f(Yes, false, "")},
- {0x306, 230, 1, 1, f(Maybe, false, "")},
- {0x30d, 230, 1, 1, f(Yes, false, "")},
- {0x30f, 230, 1, 1, f(Maybe, false, "")},
- {0x310, 230, 1, 1, f(Yes, false, "")},
- {0x311, 230, 1, 1, f(Maybe, false, "")},
- {0x312, 230, 1, 1, f(Yes, false, "")},
- {0x313, 230, 1, 1, f(Maybe, false, "")},
- {0x315, 232, 1, 1, f(Yes, false, "")},
- {0x316, 220, 1, 1, f(Yes, false, "")},
- {0x31a, 232, 1, 1, f(Yes, false, "")},
- {0x31b, 216, 1, 1, f(Maybe, false, "")},
- {0x31c, 220, 1, 1, f(Yes, false, "")},
- {0x321, 202, 1, 1, f(Yes, false, "")},
- {0x323, 220, 1, 1, f(Maybe, false, "")},
- {0x327, 202, 1, 1, f(Maybe, false, "")},
- {0x329, 220, 1, 1, f(Yes, false, "")},
- {0x32d, 220, 1, 1, f(Maybe, false, "")},
- {0x32f, 220, 1, 1, f(Yes, false, "")},
- {0x330, 220, 1, 1, f(Maybe, false, "")},
- {0x332, 220, 1, 1, f(Yes, false, "")},
- {0x334, 1, 1, 1, f(Yes, false, "")},
- {0x338, 1, 1, 1, f(Maybe, false, "")},
- {0x339, 220, 1, 1, f(Yes, false, "")},
- {0x33d, 230, 1, 1, f(Yes, false, "")},
- {0x340, 230, 1, 1, f(No, false, "̀")},
- {0x341, 230, 1, 1, f(No, false, "́")},
- {0x342, 230, 1, 1, f(Maybe, false, "")},
- {0x343, 230, 1, 1, f(No, false, "̓")},
- {0x344, 230, 2, 2, f(No, false, "̈́")},
- {0x345, 240, 1, 1, f(Maybe, false, "")},
- {0x346, 230, 1, 1, f(Yes, false, "")},
- {0x347, 220, 1, 1, f(Yes, false, "")},
- {0x34a, 230, 1, 1, f(Yes, false, "")},
- {0x34d, 220, 1, 1, f(Yes, false, "")},
- {0x34f, 0, 0, 0, f(Yes, false, "")},
- {0x350, 230, 1, 1, f(Yes, false, "")},
- {0x353, 220, 1, 1, f(Yes, false, "")},
- {0x357, 230, 1, 1, f(Yes, false, "")},
- {0x358, 232, 1, 1, f(Yes, false, "")},
- {0x359, 220, 1, 1, f(Yes, false, "")},
- {0x35b, 230, 1, 1, f(Yes, false, "")},
- {0x35c, 233, 1, 1, f(Yes, false, "")},
- {0x35d, 234, 1, 1, f(Yes, false, "")},
- {0x35f, 233, 1, 1, f(Yes, false, "")},
- {0x360, 234, 1, 1, f(Yes, false, "")},
- {0x362, 233, 1, 1, f(Yes, false, "")},
- {0x363, 230, 1, 1, f(Yes, false, "")},
- {0x370, 0, 0, 0, f(Yes, false, "")},
- {0x374, 0, 0, 0, f(No, false, "ʹ")},
- {0x375, 0, 0, 0, f(Yes, false, "")},
- {0x37a, 0, 0, 1, g(Yes, No, false, false, "", " ͅ")},
- {0x37b, 0, 0, 0, f(Yes, false, "")},
- {0x37e, 0, 0, 0, f(No, false, ";")},
- {0x37f, 0, 0, 0, f(Yes, false, "")},
- {0x384, 0, 0, 1, g(Yes, No, false, false, "", " ́")},
- {0x385, 0, 0, 2, g(Yes, No, false, false, "΅", " ̈́")},
- {0x386, 0, 0, 1, f(Yes, false, "Ά")},
- {0x387, 0, 0, 0, f(No, false, "·")},
- {0x388, 0, 0, 1, f(Yes, false, "Έ")},
- {0x389, 0, 0, 1, f(Yes, false, "Ή")},
- {0x38a, 0, 0, 1, f(Yes, false, "Ί")},
- {0x38b, 0, 0, 0, f(Yes, false, "")},
- {0x38c, 0, 0, 1, f(Yes, false, "Ό")},
- {0x38d, 0, 0, 0, f(Yes, false, "")},
- {0x38e, 0, 0, 1, f(Yes, false, "Ύ")},
- {0x38f, 0, 0, 1, f(Yes, false, "Ώ")},
- {0x390, 0, 0, 2, f(Yes, false, "ΐ")},
- {0x391, 0, 0, 0, f(Yes, true, "")},
- {0x392, 0, 0, 0, f(Yes, false, "")},
- {0x395, 0, 0, 0, f(Yes, true, "")},
- {0x396, 0, 0, 0, f(Yes, false, "")},
- {0x397, 0, 0, 0, f(Yes, true, "")},
- {0x398, 0, 0, 0, f(Yes, false, "")},
- {0x399, 0, 0, 0, f(Yes, true, "")},
- {0x39a, 0, 0, 0, f(Yes, false, "")},
- {0x39f, 0, 0, 0, f(Yes, true, "")},
- {0x3a0, 0, 0, 0, f(Yes, false, "")},
- {0x3a1, 0, 0, 0, f(Yes, true, "")},
- {0x3a2, 0, 0, 0, f(Yes, false, "")},
- {0x3a5, 0, 0, 0, f(Yes, true, "")},
- {0x3a6, 0, 0, 0, f(Yes, false, "")},
- {0x3a9, 0, 0, 0, f(Yes, true, "")},
- {0x3aa, 0, 0, 1, f(Yes, false, "Ϊ")},
- {0x3ab, 0, 0, 1, f(Yes, false, "Ϋ")},
- {0x3ac, 0, 0, 1, f(Yes, true, "ά")},
- {0x3ad, 0, 0, 1, f(Yes, false, "έ")},
- {0x3ae, 0, 0, 1, f(Yes, true, "ή")},
- {0x3af, 0, 0, 1, f(Yes, false, "ί")},
- {0x3b0, 0, 0, 2, f(Yes, false, "ΰ")},
- {0x3b1, 0, 0, 0, f(Yes, true, "")},
- {0x3b2, 0, 0, 0, f(Yes, false, "")},
- {0x3b5, 0, 0, 0, f(Yes, true, "")},
- {0x3b6, 0, 0, 0, f(Yes, false, "")},
- {0x3b7, 0, 0, 0, f(Yes, true, "")},
- {0x3b8, 0, 0, 0, f(Yes, false, "")},
- {0x3b9, 0, 0, 0, f(Yes, true, "")},
- {0x3ba, 0, 0, 0, f(Yes, false, "")},
- {0x3bf, 0, 0, 0, f(Yes, true, "")},
- {0x3c0, 0, 0, 0, f(Yes, false, "")},
- {0x3c1, 0, 0, 0, f(Yes, true, "")},
- {0x3c2, 0, 0, 0, f(Yes, false, "")},
- {0x3c5, 0, 0, 0, f(Yes, true, "")},
- {0x3c6, 0, 0, 0, f(Yes, false, "")},
- {0x3c9, 0, 0, 0, f(Yes, true, "")},
- {0x3ca, 0, 0, 1, f(Yes, true, "ϊ")},
- {0x3cb, 0, 0, 1, f(Yes, true, "ϋ")},
- {0x3cc, 0, 0, 1, f(Yes, false, "ό")},
- {0x3cd, 0, 0, 1, f(Yes, false, "ύ")},
- {0x3ce, 0, 0, 1, f(Yes, true, "ώ")},
- {0x3cf, 0, 0, 0, f(Yes, false, "")},
- {0x3d0, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x3d1, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x3d2, 0, 0, 0, g(Yes, No, true, false, "", "Υ")},
- {0x3d3, 0, 0, 1, g(Yes, No, false, false, "ϓ", "Ύ")},
- {0x3d4, 0, 0, 1, g(Yes, No, false, false, "ϔ", "Ϋ")},
- {0x3d5, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x3d6, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x3d7, 0, 0, 0, f(Yes, false, "")},
- {0x3f0, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x3f1, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x3f2, 0, 0, 0, g(Yes, No, false, false, "", "ς")},
- {0x3f3, 0, 0, 0, f(Yes, false, "")},
- {0x3f4, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x3f5, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x3f6, 0, 0, 0, f(Yes, false, "")},
- {0x3f9, 0, 0, 0, g(Yes, No, false, false, "", "Σ")},
- {0x3fa, 0, 0, 0, f(Yes, false, "")},
- {0x400, 0, 0, 1, f(Yes, false, "Ѐ")},
- {0x401, 0, 0, 1, f(Yes, false, "Ё")},
- {0x402, 0, 0, 0, f(Yes, false, "")},
- {0x403, 0, 0, 1, f(Yes, false, "Ѓ")},
- {0x404, 0, 0, 0, f(Yes, false, "")},
- {0x406, 0, 0, 0, f(Yes, true, "")},
- {0x407, 0, 0, 1, f(Yes, false, "Ї")},
- {0x408, 0, 0, 0, f(Yes, false, "")},
- {0x40c, 0, 0, 1, f(Yes, false, "Ќ")},
- {0x40d, 0, 0, 1, f(Yes, false, "Ѝ")},
- {0x40e, 0, 0, 1, f(Yes, false, "Ў")},
- {0x40f, 0, 0, 0, f(Yes, false, "")},
- {0x410, 0, 0, 0, f(Yes, true, "")},
- {0x411, 0, 0, 0, f(Yes, false, "")},
- {0x413, 0, 0, 0, f(Yes, true, "")},
- {0x414, 0, 0, 0, f(Yes, false, "")},
- {0x415, 0, 0, 0, f(Yes, true, "")},
- {0x419, 0, 0, 1, f(Yes, false, "Й")},
- {0x41a, 0, 0, 0, f(Yes, true, "")},
- {0x41b, 0, 0, 0, f(Yes, false, "")},
- {0x41e, 0, 0, 0, f(Yes, true, "")},
- {0x41f, 0, 0, 0, f(Yes, false, "")},
- {0x423, 0, 0, 0, f(Yes, true, "")},
- {0x424, 0, 0, 0, f(Yes, false, "")},
- {0x427, 0, 0, 0, f(Yes, true, "")},
- {0x428, 0, 0, 0, f(Yes, false, "")},
- {0x42b, 0, 0, 0, f(Yes, true, "")},
- {0x42c, 0, 0, 0, f(Yes, false, "")},
- {0x42d, 0, 0, 0, f(Yes, true, "")},
- {0x42e, 0, 0, 0, f(Yes, false, "")},
- {0x430, 0, 0, 0, f(Yes, true, "")},
- {0x431, 0, 0, 0, f(Yes, false, "")},
- {0x433, 0, 0, 0, f(Yes, true, "")},
- {0x434, 0, 0, 0, f(Yes, false, "")},
- {0x435, 0, 0, 0, f(Yes, true, "")},
- {0x439, 0, 0, 1, f(Yes, false, "й")},
- {0x43a, 0, 0, 0, f(Yes, true, "")},
- {0x43b, 0, 0, 0, f(Yes, false, "")},
- {0x43e, 0, 0, 0, f(Yes, true, "")},
- {0x43f, 0, 0, 0, f(Yes, false, "")},
- {0x443, 0, 0, 0, f(Yes, true, "")},
- {0x444, 0, 0, 0, f(Yes, false, "")},
- {0x447, 0, 0, 0, f(Yes, true, "")},
- {0x448, 0, 0, 0, f(Yes, false, "")},
- {0x44b, 0, 0, 0, f(Yes, true, "")},
- {0x44c, 0, 0, 0, f(Yes, false, "")},
- {0x44d, 0, 0, 0, f(Yes, true, "")},
- {0x44e, 0, 0, 0, f(Yes, false, "")},
- {0x450, 0, 0, 1, f(Yes, false, "ѐ")},
- {0x451, 0, 0, 1, f(Yes, false, "ё")},
- {0x452, 0, 0, 0, f(Yes, false, "")},
- {0x453, 0, 0, 1, f(Yes, false, "ѓ")},
- {0x454, 0, 0, 0, f(Yes, false, "")},
- {0x456, 0, 0, 0, f(Yes, true, "")},
- {0x457, 0, 0, 1, f(Yes, false, "ї")},
- {0x458, 0, 0, 0, f(Yes, false, "")},
- {0x45c, 0, 0, 1, f(Yes, false, "ќ")},
- {0x45d, 0, 0, 1, f(Yes, false, "ѝ")},
- {0x45e, 0, 0, 1, f(Yes, false, "ў")},
- {0x45f, 0, 0, 0, f(Yes, false, "")},
- {0x474, 0, 0, 0, f(Yes, true, "")},
- {0x476, 0, 0, 1, f(Yes, false, "Ѷ")},
- {0x477, 0, 0, 1, f(Yes, false, "ѷ")},
- {0x478, 0, 0, 0, f(Yes, false, "")},
- {0x483, 230, 1, 1, f(Yes, false, "")},
- {0x488, 0, 0, 0, f(Yes, false, "")},
- {0x4c1, 0, 0, 1, f(Yes, false, "Ӂ")},
- {0x4c2, 0, 0, 1, f(Yes, false, "ӂ")},
- {0x4c3, 0, 0, 0, f(Yes, false, "")},
- {0x4d0, 0, 0, 1, f(Yes, false, "Ӑ")},
- {0x4d1, 0, 0, 1, f(Yes, false, "ӑ")},
- {0x4d2, 0, 0, 1, f(Yes, false, "Ӓ")},
- {0x4d3, 0, 0, 1, f(Yes, false, "ӓ")},
- {0x4d4, 0, 0, 0, f(Yes, false, "")},
- {0x4d6, 0, 0, 1, f(Yes, false, "Ӗ")},
- {0x4d7, 0, 0, 1, f(Yes, false, "ӗ")},
- {0x4d8, 0, 0, 0, f(Yes, true, "")},
- {0x4da, 0, 0, 1, f(Yes, false, "Ӛ")},
- {0x4db, 0, 0, 1, f(Yes, false, "ӛ")},
- {0x4dc, 0, 0, 1, f(Yes, false, "Ӝ")},
- {0x4dd, 0, 0, 1, f(Yes, false, "ӝ")},
- {0x4de, 0, 0, 1, f(Yes, false, "Ӟ")},
- {0x4df, 0, 0, 1, f(Yes, false, "ӟ")},
- {0x4e0, 0, 0, 0, f(Yes, false, "")},
- {0x4e2, 0, 0, 1, f(Yes, false, "Ӣ")},
- {0x4e3, 0, 0, 1, f(Yes, false, "ӣ")},
- {0x4e4, 0, 0, 1, f(Yes, false, "Ӥ")},
- {0x4e5, 0, 0, 1, f(Yes, false, "ӥ")},
- {0x4e6, 0, 0, 1, f(Yes, false, "Ӧ")},
- {0x4e7, 0, 0, 1, f(Yes, false, "ӧ")},
- {0x4e8, 0, 0, 0, f(Yes, true, "")},
- {0x4ea, 0, 0, 1, f(Yes, false, "Ӫ")},
- {0x4eb, 0, 0, 1, f(Yes, false, "ӫ")},
- {0x4ec, 0, 0, 1, f(Yes, false, "Ӭ")},
- {0x4ed, 0, 0, 1, f(Yes, false, "ӭ")},
- {0x4ee, 0, 0, 1, f(Yes, false, "Ӯ")},
- {0x4ef, 0, 0, 1, f(Yes, false, "ӯ")},
- {0x4f0, 0, 0, 1, f(Yes, false, "Ӱ")},
- {0x4f1, 0, 0, 1, f(Yes, false, "ӱ")},
- {0x4f2, 0, 0, 1, f(Yes, false, "Ӳ")},
- {0x4f3, 0, 0, 1, f(Yes, false, "ӳ")},
- {0x4f4, 0, 0, 1, f(Yes, false, "Ӵ")},
- {0x4f5, 0, 0, 1, f(Yes, false, "ӵ")},
- {0x4f6, 0, 0, 0, f(Yes, false, "")},
- {0x4f8, 0, 0, 1, f(Yes, false, "Ӹ")},
- {0x4f9, 0, 0, 1, f(Yes, false, "ӹ")},
- {0x4fa, 0, 0, 0, f(Yes, false, "")},
- {0x587, 0, 0, 0, g(Yes, No, false, false, "", "եւ")},
- {0x588, 0, 0, 0, f(Yes, false, "")},
- {0x591, 220, 1, 1, f(Yes, false, "")},
- {0x592, 230, 1, 1, f(Yes, false, "")},
- {0x596, 220, 1, 1, f(Yes, false, "")},
- {0x597, 230, 1, 1, f(Yes, false, "")},
- {0x59a, 222, 1, 1, f(Yes, false, "")},
- {0x59b, 220, 1, 1, f(Yes, false, "")},
- {0x59c, 230, 1, 1, f(Yes, false, "")},
- {0x5a2, 220, 1, 1, f(Yes, false, "")},
- {0x5a8, 230, 1, 1, f(Yes, false, "")},
- {0x5aa, 220, 1, 1, f(Yes, false, "")},
- {0x5ab, 230, 1, 1, f(Yes, false, "")},
- {0x5ad, 222, 1, 1, f(Yes, false, "")},
- {0x5ae, 228, 1, 1, f(Yes, false, "")},
- {0x5af, 230, 1, 1, f(Yes, false, "")},
- {0x5b0, 10, 1, 1, f(Yes, false, "")},
- {0x5b1, 11, 1, 1, f(Yes, false, "")},
- {0x5b2, 12, 1, 1, f(Yes, false, "")},
- {0x5b3, 13, 1, 1, f(Yes, false, "")},
- {0x5b4, 14, 1, 1, f(Yes, false, "")},
- {0x5b5, 15, 1, 1, f(Yes, false, "")},
- {0x5b6, 16, 1, 1, f(Yes, false, "")},
- {0x5b7, 17, 1, 1, f(Yes, false, "")},
- {0x5b8, 18, 1, 1, f(Yes, false, "")},
- {0x5b9, 19, 1, 1, f(Yes, false, "")},
- {0x5bb, 20, 1, 1, f(Yes, false, "")},
- {0x5bc, 21, 1, 1, f(Yes, false, "")},
- {0x5bd, 22, 1, 1, f(Yes, false, "")},
- {0x5be, 0, 0, 0, f(Yes, false, "")},
- {0x5bf, 23, 1, 1, f(Yes, false, "")},
- {0x5c0, 0, 0, 0, f(Yes, false, "")},
- {0x5c1, 24, 1, 1, f(Yes, false, "")},
- {0x5c2, 25, 1, 1, f(Yes, false, "")},
- {0x5c3, 0, 0, 0, f(Yes, false, "")},
- {0x5c4, 230, 1, 1, f(Yes, false, "")},
- {0x5c5, 220, 1, 1, f(Yes, false, "")},
- {0x5c6, 0, 0, 0, f(Yes, false, "")},
- {0x5c7, 18, 1, 1, f(Yes, false, "")},
- {0x5c8, 0, 0, 0, f(Yes, false, "")},
- {0x610, 230, 1, 1, f(Yes, false, "")},
- {0x618, 30, 1, 1, f(Yes, false, "")},
- {0x619, 31, 1, 1, f(Yes, false, "")},
- {0x61a, 32, 1, 1, f(Yes, false, "")},
- {0x61b, 0, 0, 0, f(Yes, false, "")},
- {0x622, 0, 0, 1, f(Yes, false, "آ")},
- {0x623, 0, 0, 1, f(Yes, false, "أ")},
- {0x624, 0, 0, 1, f(Yes, false, "ؤ")},
- {0x625, 0, 0, 1, f(Yes, false, "إ")},
- {0x626, 0, 0, 1, f(Yes, false, "ئ")},
- {0x627, 0, 0, 0, f(Yes, true, "")},
- {0x628, 0, 0, 0, f(Yes, false, "")},
- {0x648, 0, 0, 0, f(Yes, true, "")},
- {0x649, 0, 0, 0, f(Yes, false, "")},
- {0x64a, 0, 0, 0, f(Yes, true, "")},
- {0x64b, 27, 1, 1, f(Yes, false, "")},
- {0x64c, 28, 1, 1, f(Yes, false, "")},
- {0x64d, 29, 1, 1, f(Yes, false, "")},
- {0x64e, 30, 1, 1, f(Yes, false, "")},
- {0x64f, 31, 1, 1, f(Yes, false, "")},
- {0x650, 32, 1, 1, f(Yes, false, "")},
- {0x651, 33, 1, 1, f(Yes, false, "")},
- {0x652, 34, 1, 1, f(Yes, false, "")},
- {0x653, 230, 1, 1, f(Maybe, false, "")},
- {0x655, 220, 1, 1, f(Maybe, false, "")},
- {0x656, 220, 1, 1, f(Yes, false, "")},
- {0x657, 230, 1, 1, f(Yes, false, "")},
- {0x65c, 220, 1, 1, f(Yes, false, "")},
- {0x65d, 230, 1, 1, f(Yes, false, "")},
- {0x65f, 220, 1, 1, f(Yes, false, "")},
- {0x660, 0, 0, 0, f(Yes, false, "")},
- {0x670, 35, 1, 1, f(Yes, false, "")},
- {0x671, 0, 0, 0, f(Yes, false, "")},
- {0x675, 0, 0, 0, g(Yes, No, false, false, "", "اٴ")},
- {0x676, 0, 0, 0, g(Yes, No, false, false, "", "وٴ")},
- {0x677, 0, 0, 0, g(Yes, No, false, false, "", "ۇٴ")},
- {0x678, 0, 0, 0, g(Yes, No, false, false, "", "يٴ")},
- {0x679, 0, 0, 0, f(Yes, false, "")},
- {0x6c0, 0, 0, 1, f(Yes, false, "ۀ")},
- {0x6c1, 0, 0, 0, f(Yes, true, "")},
- {0x6c2, 0, 0, 1, f(Yes, false, "ۂ")},
- {0x6c3, 0, 0, 0, f(Yes, false, "")},
- {0x6d2, 0, 0, 0, f(Yes, true, "")},
- {0x6d3, 0, 0, 1, f(Yes, false, "ۓ")},
- {0x6d4, 0, 0, 0, f(Yes, false, "")},
- {0x6d5, 0, 0, 0, f(Yes, true, "")},
- {0x6d6, 230, 1, 1, f(Yes, false, "")},
- {0x6dd, 0, 0, 0, f(Yes, false, "")},
- {0x6df, 230, 1, 1, f(Yes, false, "")},
- {0x6e3, 220, 1, 1, f(Yes, false, "")},
- {0x6e4, 230, 1, 1, f(Yes, false, "")},
- {0x6e5, 0, 0, 0, f(Yes, false, "")},
- {0x6e7, 230, 1, 1, f(Yes, false, "")},
- {0x6e9, 0, 0, 0, f(Yes, false, "")},
- {0x6ea, 220, 1, 1, f(Yes, false, "")},
- {0x6eb, 230, 1, 1, f(Yes, false, "")},
- {0x6ed, 220, 1, 1, f(Yes, false, "")},
- {0x6ee, 0, 0, 0, f(Yes, false, "")},
- {0x711, 36, 1, 1, f(Yes, false, "")},
- {0x712, 0, 0, 0, f(Yes, false, "")},
- {0x730, 230, 1, 1, f(Yes, false, "")},
- {0x731, 220, 1, 1, f(Yes, false, "")},
- {0x732, 230, 1, 1, f(Yes, false, "")},
- {0x734, 220, 1, 1, f(Yes, false, "")},
- {0x735, 230, 1, 1, f(Yes, false, "")},
- {0x737, 220, 1, 1, f(Yes, false, "")},
- {0x73a, 230, 1, 1, f(Yes, false, "")},
- {0x73b, 220, 1, 1, f(Yes, false, "")},
- {0x73d, 230, 1, 1, f(Yes, false, "")},
- {0x73e, 220, 1, 1, f(Yes, false, "")},
- {0x73f, 230, 1, 1, f(Yes, false, "")},
- {0x742, 220, 1, 1, f(Yes, false, "")},
- {0x743, 230, 1, 1, f(Yes, false, "")},
- {0x744, 220, 1, 1, f(Yes, false, "")},
- {0x745, 230, 1, 1, f(Yes, false, "")},
- {0x746, 220, 1, 1, f(Yes, false, "")},
- {0x747, 230, 1, 1, f(Yes, false, "")},
- {0x748, 220, 1, 1, f(Yes, false, "")},
- {0x749, 230, 1, 1, f(Yes, false, "")},
- {0x74b, 0, 0, 0, f(Yes, false, "")},
- {0x7eb, 230, 1, 1, f(Yes, false, "")},
- {0x7f2, 220, 1, 1, f(Yes, false, "")},
- {0x7f3, 230, 1, 1, f(Yes, false, "")},
- {0x7f4, 0, 0, 0, f(Yes, false, "")},
- {0x816, 230, 1, 1, f(Yes, false, "")},
- {0x81a, 0, 0, 0, f(Yes, false, "")},
- {0x81b, 230, 1, 1, f(Yes, false, "")},
- {0x824, 0, 0, 0, f(Yes, false, "")},
- {0x825, 230, 1, 1, f(Yes, false, "")},
- {0x828, 0, 0, 0, f(Yes, false, "")},
- {0x829, 230, 1, 1, f(Yes, false, "")},
- {0x82e, 0, 0, 0, f(Yes, false, "")},
- {0x859, 220, 1, 1, f(Yes, false, "")},
- {0x85c, 0, 0, 0, f(Yes, false, "")},
- {0x8d4, 230, 1, 1, f(Yes, false, "")},
- {0x8e2, 0, 0, 0, f(Yes, false, "")},
- {0x8e3, 220, 1, 1, f(Yes, false, "")},
- {0x8e4, 230, 1, 1, f(Yes, false, "")},
- {0x8e6, 220, 1, 1, f(Yes, false, "")},
- {0x8e7, 230, 1, 1, f(Yes, false, "")},
- {0x8e9, 220, 1, 1, f(Yes, false, "")},
- {0x8ea, 230, 1, 1, f(Yes, false, "")},
- {0x8ed, 220, 1, 1, f(Yes, false, "")},
- {0x8f0, 27, 1, 1, f(Yes, false, "")},
- {0x8f1, 28, 1, 1, f(Yes, false, "")},
- {0x8f2, 29, 1, 1, f(Yes, false, "")},
- {0x8f3, 230, 1, 1, f(Yes, false, "")},
- {0x8f6, 220, 1, 1, f(Yes, false, "")},
- {0x8f7, 230, 1, 1, f(Yes, false, "")},
- {0x8f9, 220, 1, 1, f(Yes, false, "")},
- {0x8fb, 230, 1, 1, f(Yes, false, "")},
- {0x900, 0, 0, 0, f(Yes, false, "")},
- {0x928, 0, 0, 0, f(Yes, true, "")},
- {0x929, 0, 0, 1, f(Yes, false, "ऩ")},
- {0x92a, 0, 0, 0, f(Yes, false, "")},
- {0x930, 0, 0, 0, f(Yes, true, "")},
- {0x931, 0, 0, 1, f(Yes, false, "ऱ")},
- {0x932, 0, 0, 0, f(Yes, false, "")},
- {0x933, 0, 0, 0, f(Yes, true, "")},
- {0x934, 0, 0, 1, f(Yes, false, "ऴ")},
- {0x935, 0, 0, 0, f(Yes, false, "")},
- {0x93c, 7, 1, 1, f(Maybe, false, "")},
- {0x93d, 0, 0, 0, f(Yes, false, "")},
- {0x94d, 9, 1, 1, f(Yes, false, "")},
- {0x94e, 0, 0, 0, f(Yes, false, "")},
- {0x951, 230, 1, 1, f(Yes, false, "")},
- {0x952, 220, 1, 1, f(Yes, false, "")},
- {0x953, 230, 1, 1, f(Yes, false, "")},
- {0x955, 0, 0, 0, f(Yes, false, "")},
- {0x958, 0, 0, 1, f(No, false, "क़")},
- {0x959, 0, 0, 1, f(No, false, "ख़")},
- {0x95a, 0, 0, 1, f(No, false, "ग़")},
- {0x95b, 0, 0, 1, f(No, false, "ज़")},
- {0x95c, 0, 0, 1, f(No, false, "ड़")},
- {0x95d, 0, 0, 1, f(No, false, "ढ़")},
- {0x95e, 0, 0, 1, f(No, false, "फ़")},
- {0x95f, 0, 0, 1, f(No, false, "य़")},
- {0x960, 0, 0, 0, f(Yes, false, "")},
- {0x9bc, 7, 1, 1, f(Yes, false, "")},
- {0x9bd, 0, 0, 0, f(Yes, false, "")},
- {0x9be, 0, 1, 1, f(Maybe, false, "")},
- {0x9bf, 0, 0, 0, f(Yes, false, "")},
- {0x9c7, 0, 0, 0, f(Yes, true, "")},
- {0x9c8, 0, 0, 0, f(Yes, false, "")},
- {0x9cb, 0, 0, 1, f(Yes, false, "ো")},
- {0x9cc, 0, 0, 1, f(Yes, false, "ৌ")},
- {0x9cd, 9, 1, 1, f(Yes, false, "")},
- {0x9ce, 0, 0, 0, f(Yes, false, "")},
- {0x9d7, 0, 1, 1, f(Maybe, false, "")},
- {0x9d8, 0, 0, 0, f(Yes, false, "")},
- {0x9dc, 0, 0, 1, f(No, false, "ড়")},
- {0x9dd, 0, 0, 1, f(No, false, "ঢ়")},
- {0x9de, 0, 0, 0, f(Yes, false, "")},
- {0x9df, 0, 0, 1, f(No, false, "য়")},
- {0x9e0, 0, 0, 0, f(Yes, false, "")},
- {0xa33, 0, 0, 1, f(No, false, "ਲ਼")},
- {0xa34, 0, 0, 0, f(Yes, false, "")},
- {0xa36, 0, 0, 1, f(No, false, "ਸ਼")},
- {0xa37, 0, 0, 0, f(Yes, false, "")},
- {0xa3c, 7, 1, 1, f(Yes, false, "")},
- {0xa3d, 0, 0, 0, f(Yes, false, "")},
- {0xa4d, 9, 1, 1, f(Yes, false, "")},
- {0xa4e, 0, 0, 0, f(Yes, false, "")},
- {0xa59, 0, 0, 1, f(No, false, "ਖ਼")},
- {0xa5a, 0, 0, 1, f(No, false, "ਗ਼")},
- {0xa5b, 0, 0, 1, f(No, false, "ਜ਼")},
- {0xa5c, 0, 0, 0, f(Yes, false, "")},
- {0xa5e, 0, 0, 1, f(No, false, "ਫ਼")},
- {0xa5f, 0, 0, 0, f(Yes, false, "")},
- {0xabc, 7, 1, 1, f(Yes, false, "")},
- {0xabd, 0, 0, 0, f(Yes, false, "")},
- {0xacd, 9, 1, 1, f(Yes, false, "")},
- {0xace, 0, 0, 0, f(Yes, false, "")},
- {0xb3c, 7, 1, 1, f(Yes, false, "")},
- {0xb3d, 0, 0, 0, f(Yes, false, "")},
- {0xb3e, 0, 1, 1, f(Maybe, false, "")},
- {0xb3f, 0, 0, 0, f(Yes, false, "")},
- {0xb47, 0, 0, 0, f(Yes, true, "")},
- {0xb48, 0, 0, 1, f(Yes, false, "ୈ")},
- {0xb49, 0, 0, 0, f(Yes, false, "")},
- {0xb4b, 0, 0, 1, f(Yes, false, "ୋ")},
- {0xb4c, 0, 0, 1, f(Yes, false, "ୌ")},
- {0xb4d, 9, 1, 1, f(Yes, false, "")},
- {0xb4e, 0, 0, 0, f(Yes, false, "")},
- {0xb56, 0, 1, 1, f(Maybe, false, "")},
- {0xb58, 0, 0, 0, f(Yes, false, "")},
- {0xb5c, 0, 0, 1, f(No, false, "ଡ଼")},
- {0xb5d, 0, 0, 1, f(No, false, "ଢ଼")},
- {0xb5e, 0, 0, 0, f(Yes, false, "")},
- {0xb92, 0, 0, 0, f(Yes, true, "")},
- {0xb93, 0, 0, 0, f(Yes, false, "")},
- {0xb94, 0, 0, 1, f(Yes, false, "ஔ")},
- {0xb95, 0, 0, 0, f(Yes, false, "")},
- {0xbbe, 0, 1, 1, f(Maybe, false, "")},
- {0xbbf, 0, 0, 0, f(Yes, false, "")},
- {0xbc6, 0, 0, 0, f(Yes, true, "")},
- {0xbc8, 0, 0, 0, f(Yes, false, "")},
- {0xbca, 0, 0, 1, f(Yes, false, "ொ")},
- {0xbcb, 0, 0, 1, f(Yes, false, "ோ")},
- {0xbcc, 0, 0, 1, f(Yes, false, "ௌ")},
- {0xbcd, 9, 1, 1, f(Yes, false, "")},
- {0xbce, 0, 0, 0, f(Yes, false, "")},
- {0xbd7, 0, 1, 1, f(Maybe, false, "")},
- {0xbd8, 0, 0, 0, f(Yes, false, "")},
- {0xc46, 0, 0, 0, f(Yes, true, "")},
- {0xc47, 0, 0, 0, f(Yes, false, "")},
- {0xc48, 0, 0, 1, f(Yes, false, "ై")},
- {0xc49, 0, 0, 0, f(Yes, false, "")},
- {0xc4d, 9, 1, 1, f(Yes, false, "")},
- {0xc4e, 0, 0, 0, f(Yes, false, "")},
- {0xc55, 84, 1, 1, f(Yes, false, "")},
- {0xc56, 91, 1, 1, f(Maybe, false, "")},
- {0xc57, 0, 0, 0, f(Yes, false, "")},
- {0xcbc, 7, 1, 1, f(Yes, false, "")},
- {0xcbd, 0, 0, 0, f(Yes, false, "")},
- {0xcbf, 0, 0, 0, f(Yes, true, "")},
- {0xcc0, 0, 0, 1, f(Yes, false, "ೀ")},
- {0xcc1, 0, 0, 0, f(Yes, false, "")},
- {0xcc2, 0, 1, 1, f(Maybe, false, "")},
- {0xcc3, 0, 0, 0, f(Yes, false, "")},
- {0xcc6, 0, 0, 0, f(Yes, true, "")},
- {0xcc7, 0, 0, 1, f(Yes, false, "ೇ")},
- {0xcc8, 0, 0, 1, f(Yes, false, "ೈ")},
- {0xcc9, 0, 0, 0, f(Yes, false, "")},
- {0xcca, 0, 0, 1, f(Yes, true, "ೊ")},
- {0xccb, 0, 0, 2, f(Yes, false, "ೋ")},
- {0xccc, 0, 0, 0, f(Yes, false, "")},
- {0xccd, 9, 1, 1, f(Yes, false, "")},
- {0xcce, 0, 0, 0, f(Yes, false, "")},
- {0xcd5, 0, 1, 1, f(Maybe, false, "")},
- {0xcd7, 0, 0, 0, f(Yes, false, "")},
- {0xd3b, 9, 1, 1, f(Yes, false, "")},
- {0xd3d, 0, 0, 0, f(Yes, false, "")},
- {0xd3e, 0, 1, 1, f(Maybe, false, "")},
- {0xd3f, 0, 0, 0, f(Yes, false, "")},
- {0xd46, 0, 0, 0, f(Yes, true, "")},
- {0xd48, 0, 0, 0, f(Yes, false, "")},
- {0xd4a, 0, 0, 1, f(Yes, false, "ൊ")},
- {0xd4b, 0, 0, 1, f(Yes, false, "ോ")},
- {0xd4c, 0, 0, 1, f(Yes, false, "ൌ")},
- {0xd4d, 9, 1, 1, f(Yes, false, "")},
- {0xd4e, 0, 0, 0, f(Yes, false, "")},
- {0xd57, 0, 1, 1, f(Maybe, false, "")},
- {0xd58, 0, 0, 0, f(Yes, false, "")},
- {0xdca, 9, 1, 1, f(Maybe, false, "")},
- {0xdcb, 0, 0, 0, f(Yes, false, "")},
- {0xdcf, 0, 1, 1, f(Maybe, false, "")},
- {0xdd0, 0, 0, 0, f(Yes, false, "")},
- {0xdd9, 0, 0, 0, f(Yes, true, "")},
- {0xdda, 0, 0, 1, f(Yes, false, "ේ")},
- {0xddb, 0, 0, 0, f(Yes, false, "")},
- {0xddc, 0, 0, 1, f(Yes, true, "ො")},
- {0xddd, 0, 0, 2, f(Yes, false, "ෝ")},
- {0xdde, 0, 0, 1, f(Yes, false, "ෞ")},
- {0xddf, 0, 1, 1, f(Maybe, false, "")},
- {0xde0, 0, 0, 0, f(Yes, false, "")},
- {0xe33, 0, 0, 0, g(Yes, No, false, false, "", "ํา")},
- {0xe34, 0, 0, 0, f(Yes, false, "")},
- {0xe38, 103, 1, 1, f(Yes, false, "")},
- {0xe3a, 9, 1, 1, f(Yes, false, "")},
- {0xe3b, 0, 0, 0, f(Yes, false, "")},
- {0xe48, 107, 1, 1, f(Yes, false, "")},
- {0xe4c, 0, 0, 0, f(Yes, false, "")},
- {0xeb3, 0, 0, 0, g(Yes, No, false, false, "", "ໍາ")},
- {0xeb4, 0, 0, 0, f(Yes, false, "")},
- {0xeb8, 118, 1, 1, f(Yes, false, "")},
- {0xeba, 0, 0, 0, f(Yes, false, "")},
- {0xec8, 122, 1, 1, f(Yes, false, "")},
- {0xecc, 0, 0, 0, f(Yes, false, "")},
- {0xedc, 0, 0, 0, g(Yes, No, false, false, "", "ຫນ")},
- {0xedd, 0, 0, 0, g(Yes, No, false, false, "", "ຫມ")},
- {0xede, 0, 0, 0, f(Yes, false, "")},
- {0xf0c, 0, 0, 0, g(Yes, No, false, false, "", "་")},
- {0xf0d, 0, 0, 0, f(Yes, false, "")},
- {0xf18, 220, 1, 1, f(Yes, false, "")},
- {0xf1a, 0, 0, 0, f(Yes, false, "")},
- {0xf35, 220, 1, 1, f(Yes, false, "")},
- {0xf36, 0, 0, 0, f(Yes, false, "")},
- {0xf37, 220, 1, 1, f(Yes, false, "")},
- {0xf38, 0, 0, 0, f(Yes, false, "")},
- {0xf39, 216, 1, 1, f(Yes, false, "")},
- {0xf3a, 0, 0, 0, f(Yes, false, "")},
- {0xf43, 0, 0, 0, f(No, false, "གྷ")},
- {0xf44, 0, 0, 0, f(Yes, false, "")},
- {0xf4d, 0, 0, 0, f(No, false, "ཌྷ")},
- {0xf4e, 0, 0, 0, f(Yes, false, "")},
- {0xf52, 0, 0, 0, f(No, false, "དྷ")},
- {0xf53, 0, 0, 0, f(Yes, false, "")},
- {0xf57, 0, 0, 0, f(No, false, "བྷ")},
- {0xf58, 0, 0, 0, f(Yes, false, "")},
- {0xf5c, 0, 0, 0, f(No, false, "ཛྷ")},
- {0xf5d, 0, 0, 0, f(Yes, false, "")},
- {0xf69, 0, 0, 0, f(No, false, "ཀྵ")},
- {0xf6a, 0, 0, 0, f(Yes, false, "")},
- {0xf71, 129, 1, 1, f(Yes, false, "")},
- {0xf72, 130, 1, 1, f(Yes, false, "")},
- {0xf73, 0, 2, 2, f(No, false, "ཱི")},
- {0xf74, 132, 1, 1, f(Yes, false, "")},
- {0xf75, 0, 2, 2, f(No, false, "ཱུ")},
- {0xf76, 0, 0, 1, f(No, false, "ྲྀ")},
- {0xf77, 0, 0, 2, g(Yes, No, false, false, "", "ྲཱྀ")},
- {0xf78, 0, 0, 1, f(No, false, "ླྀ")},
- {0xf79, 0, 0, 2, g(Yes, No, false, false, "", "ླཱྀ")},
- {0xf7a, 130, 1, 1, f(Yes, false, "")},
- {0xf7e, 0, 0, 0, f(Yes, false, "")},
- {0xf80, 130, 1, 1, f(Yes, false, "")},
- {0xf81, 0, 2, 2, f(No, false, "ཱྀ")},
- {0xf82, 230, 1, 1, f(Yes, false, "")},
- {0xf84, 9, 1, 1, f(Yes, false, "")},
- {0xf85, 0, 0, 0, f(Yes, false, "")},
- {0xf86, 230, 1, 1, f(Yes, false, "")},
- {0xf88, 0, 0, 0, f(Yes, false, "")},
- {0xf93, 0, 0, 0, f(No, false, "ྒྷ")},
- {0xf94, 0, 0, 0, f(Yes, false, "")},
- {0xf9d, 0, 0, 0, f(No, false, "ྜྷ")},
- {0xf9e, 0, 0, 0, f(Yes, false, "")},
- {0xfa2, 0, 0, 0, f(No, false, "ྡྷ")},
- {0xfa3, 0, 0, 0, f(Yes, false, "")},
- {0xfa7, 0, 0, 0, f(No, false, "ྦྷ")},
- {0xfa8, 0, 0, 0, f(Yes, false, "")},
- {0xfac, 0, 0, 0, f(No, false, "ྫྷ")},
- {0xfad, 0, 0, 0, f(Yes, false, "")},
- {0xfb9, 0, 0, 0, f(No, false, "ྐྵ")},
- {0xfba, 0, 0, 0, f(Yes, false, "")},
- {0xfc6, 220, 1, 1, f(Yes, false, "")},
- {0xfc7, 0, 0, 0, f(Yes, false, "")},
- {0x1025, 0, 0, 0, f(Yes, true, "")},
- {0x1026, 0, 0, 1, f(Yes, false, "ဦ")},
- {0x1027, 0, 0, 0, f(Yes, false, "")},
- {0x102e, 0, 1, 1, f(Maybe, false, "")},
- {0x102f, 0, 0, 0, f(Yes, false, "")},
- {0x1037, 7, 1, 1, f(Yes, false, "")},
- {0x1038, 0, 0, 0, f(Yes, false, "")},
- {0x1039, 9, 1, 1, f(Yes, false, "")},
- {0x103b, 0, 0, 0, f(Yes, false, "")},
- {0x108d, 220, 1, 1, f(Yes, false, "")},
- {0x108e, 0, 0, 0, f(Yes, false, "")},
- {0x10fc, 0, 0, 0, g(Yes, No, false, false, "", "ნ")},
- {0x10fd, 0, 0, 0, f(Yes, false, "")},
- {0x1100, 0, 0, 0, f(Yes, true, "")},
- {0x1113, 0, 0, 0, f(Yes, false, "")},
- {0x1161, 0, 1, 1, f(Maybe, true, "")},
- {0x1176, 0, 0, 0, f(Yes, false, "")},
- {0x11a8, 0, 1, 1, f(Maybe, false, "")},
- {0x11c3, 0, 0, 0, f(Yes, false, "")},
- {0x135d, 230, 1, 1, f(Yes, false, "")},
- {0x1360, 0, 0, 0, f(Yes, false, "")},
- {0x1714, 9, 1, 1, f(Yes, false, "")},
- {0x1715, 0, 0, 0, f(Yes, false, "")},
- {0x1734, 9, 1, 1, f(Yes, false, "")},
- {0x1735, 0, 0, 0, f(Yes, false, "")},
- {0x17d2, 9, 1, 1, f(Yes, false, "")},
- {0x17d3, 0, 0, 0, f(Yes, false, "")},
- {0x17dd, 230, 1, 1, f(Yes, false, "")},
- {0x17de, 0, 0, 0, f(Yes, false, "")},
- {0x18a9, 228, 1, 1, f(Yes, false, "")},
- {0x18aa, 0, 0, 0, f(Yes, false, "")},
- {0x1939, 222, 1, 1, f(Yes, false, "")},
- {0x193a, 230, 1, 1, f(Yes, false, "")},
- {0x193b, 220, 1, 1, f(Yes, false, "")},
- {0x193c, 0, 0, 0, f(Yes, false, "")},
- {0x1a17, 230, 1, 1, f(Yes, false, "")},
- {0x1a18, 220, 1, 1, f(Yes, false, "")},
- {0x1a19, 0, 0, 0, f(Yes, false, "")},
- {0x1a60, 9, 1, 1, f(Yes, false, "")},
- {0x1a61, 0, 0, 0, f(Yes, false, "")},
- {0x1a75, 230, 1, 1, f(Yes, false, "")},
- {0x1a7d, 0, 0, 0, f(Yes, false, "")},
- {0x1a7f, 220, 1, 1, f(Yes, false, "")},
- {0x1a80, 0, 0, 0, f(Yes, false, "")},
- {0x1ab0, 230, 1, 1, f(Yes, false, "")},
- {0x1ab5, 220, 1, 1, f(Yes, false, "")},
- {0x1abb, 230, 1, 1, f(Yes, false, "")},
- {0x1abd, 220, 1, 1, f(Yes, false, "")},
- {0x1abe, 0, 0, 0, f(Yes, false, "")},
- {0x1b05, 0, 0, 0, f(Yes, true, "")},
- {0x1b06, 0, 0, 1, f(Yes, false, "ᬆ")},
- {0x1b07, 0, 0, 0, f(Yes, true, "")},
- {0x1b08, 0, 0, 1, f(Yes, false, "ᬈ")},
- {0x1b09, 0, 0, 0, f(Yes, true, "")},
- {0x1b0a, 0, 0, 1, f(Yes, false, "ᬊ")},
- {0x1b0b, 0, 0, 0, f(Yes, true, "")},
- {0x1b0c, 0, 0, 1, f(Yes, false, "ᬌ")},
- {0x1b0d, 0, 0, 0, f(Yes, true, "")},
- {0x1b0e, 0, 0, 1, f(Yes, false, "ᬎ")},
- {0x1b0f, 0, 0, 0, f(Yes, false, "")},
- {0x1b11, 0, 0, 0, f(Yes, true, "")},
- {0x1b12, 0, 0, 1, f(Yes, false, "ᬒ")},
- {0x1b13, 0, 0, 0, f(Yes, false, "")},
- {0x1b34, 7, 1, 1, f(Yes, false, "")},
- {0x1b35, 0, 1, 1, f(Maybe, false, "")},
- {0x1b36, 0, 0, 0, f(Yes, false, "")},
- {0x1b3a, 0, 0, 0, f(Yes, true, "")},
- {0x1b3b, 0, 0, 1, f(Yes, false, "ᬻ")},
- {0x1b3c, 0, 0, 0, f(Yes, true, "")},
- {0x1b3d, 0, 0, 1, f(Yes, false, "ᬽ")},
- {0x1b3e, 0, 0, 0, f(Yes, true, "")},
- {0x1b40, 0, 0, 1, f(Yes, false, "ᭀ")},
- {0x1b41, 0, 0, 1, f(Yes, false, "ᭁ")},
- {0x1b42, 0, 0, 0, f(Yes, true, "")},
- {0x1b43, 0, 0, 1, f(Yes, false, "ᭃ")},
- {0x1b44, 9, 1, 1, f(Yes, false, "")},
- {0x1b45, 0, 0, 0, f(Yes, false, "")},
- {0x1b6b, 230, 1, 1, f(Yes, false, "")},
- {0x1b6c, 220, 1, 1, f(Yes, false, "")},
- {0x1b6d, 230, 1, 1, f(Yes, false, "")},
- {0x1b74, 0, 0, 0, f(Yes, false, "")},
- {0x1baa, 9, 1, 1, f(Yes, false, "")},
- {0x1bac, 0, 0, 0, f(Yes, false, "")},
- {0x1be6, 7, 1, 1, f(Yes, false, "")},
- {0x1be7, 0, 0, 0, f(Yes, false, "")},
- {0x1bf2, 9, 1, 1, f(Yes, false, "")},
- {0x1bf4, 0, 0, 0, f(Yes, false, "")},
- {0x1c37, 7, 1, 1, f(Yes, false, "")},
- {0x1c38, 0, 0, 0, f(Yes, false, "")},
- {0x1cd0, 230, 1, 1, f(Yes, false, "")},
- {0x1cd3, 0, 0, 0, f(Yes, false, "")},
- {0x1cd4, 1, 1, 1, f(Yes, false, "")},
- {0x1cd5, 220, 1, 1, f(Yes, false, "")},
- {0x1cda, 230, 1, 1, f(Yes, false, "")},
- {0x1cdc, 220, 1, 1, f(Yes, false, "")},
- {0x1ce0, 230, 1, 1, f(Yes, false, "")},
- {0x1ce1, 0, 0, 0, f(Yes, false, "")},
- {0x1ce2, 1, 1, 1, f(Yes, false, "")},
- {0x1ce9, 0, 0, 0, f(Yes, false, "")},
- {0x1ced, 220, 1, 1, f(Yes, false, "")},
- {0x1cee, 0, 0, 0, f(Yes, false, "")},
- {0x1cf4, 230, 1, 1, f(Yes, false, "")},
- {0x1cf5, 0, 0, 0, f(Yes, false, "")},
- {0x1cf8, 230, 1, 1, f(Yes, false, "")},
- {0x1cfa, 0, 0, 0, f(Yes, false, "")},
- {0x1d2c, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d2d, 0, 0, 0, g(Yes, No, false, false, "", "Æ")},
- {0x1d2e, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d2f, 0, 0, 0, f(Yes, false, "")},
- {0x1d30, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d31, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d32, 0, 0, 0, g(Yes, No, false, false, "", "Ǝ")},
- {0x1d33, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d34, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d35, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d36, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d37, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d38, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d39, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d3a, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d3b, 0, 0, 0, f(Yes, false, "")},
- {0x1d3c, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d3d, 0, 0, 0, g(Yes, No, false, false, "", "Ȣ")},
- {0x1d3e, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d3f, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d40, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d41, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d42, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d43, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d44, 0, 0, 0, g(Yes, No, false, false, "", "ɐ")},
- {0x1d45, 0, 0, 0, g(Yes, No, false, false, "", "ɑ")},
- {0x1d46, 0, 0, 0, g(Yes, No, false, false, "", "ᴂ")},
- {0x1d47, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d48, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d49, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d4a, 0, 0, 0, g(Yes, No, false, false, "", "ə")},
- {0x1d4b, 0, 0, 0, g(Yes, No, false, false, "", "ɛ")},
- {0x1d4c, 0, 0, 0, g(Yes, No, false, false, "", "ɜ")},
- {0x1d4d, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d4e, 0, 0, 0, f(Yes, false, "")},
- {0x1d4f, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d50, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d51, 0, 0, 0, g(Yes, No, false, false, "", "ŋ")},
- {0x1d52, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d53, 0, 0, 0, g(Yes, No, false, false, "", "ɔ")},
- {0x1d54, 0, 0, 0, g(Yes, No, false, false, "", "ᴖ")},
- {0x1d55, 0, 0, 0, g(Yes, No, false, false, "", "ᴗ")},
- {0x1d56, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d57, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d58, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d59, 0, 0, 0, g(Yes, No, false, false, "", "ᴝ")},
- {0x1d5a, 0, 0, 0, g(Yes, No, false, false, "", "ɯ")},
- {0x1d5b, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d5c, 0, 0, 0, g(Yes, No, false, false, "", "ᴥ")},
- {0x1d5d, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x1d5e, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x1d5f, 0, 0, 0, g(Yes, No, false, false, "", "δ")},
- {0x1d60, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d61, 0, 0, 0, g(Yes, No, false, false, "", "χ")},
- {0x1d62, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d63, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d64, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d65, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d66, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x1d67, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x1d68, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d69, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d6a, 0, 0, 0, g(Yes, No, false, false, "", "χ")},
- {0x1d6b, 0, 0, 0, f(Yes, false, "")},
- {0x1d78, 0, 0, 0, g(Yes, No, false, false, "", "н")},
- {0x1d79, 0, 0, 0, f(Yes, false, "")},
- {0x1d9b, 0, 0, 0, g(Yes, No, false, false, "", "ɒ")},
- {0x1d9c, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d9d, 0, 0, 0, g(Yes, No, false, false, "", "ɕ")},
- {0x1d9e, 0, 0, 0, g(Yes, No, false, false, "", "ð")},
- {0x1d9f, 0, 0, 0, g(Yes, No, false, false, "", "ɜ")},
- {0x1da0, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1da1, 0, 0, 0, g(Yes, No, false, false, "", "ɟ")},
- {0x1da2, 0, 0, 0, g(Yes, No, false, false, "", "ɡ")},
- {0x1da3, 0, 0, 0, g(Yes, No, false, false, "", "ɥ")},
- {0x1da4, 0, 0, 0, g(Yes, No, false, false, "", "ɨ")},
- {0x1da5, 0, 0, 0, g(Yes, No, false, false, "", "ɩ")},
- {0x1da6, 0, 0, 0, g(Yes, No, false, false, "", "ɪ")},
- {0x1da7, 0, 0, 0, g(Yes, No, false, false, "", "ᵻ")},
- {0x1da8, 0, 0, 0, g(Yes, No, false, false, "", "ʝ")},
- {0x1da9, 0, 0, 0, g(Yes, No, false, false, "", "ɭ")},
- {0x1daa, 0, 0, 0, g(Yes, No, false, false, "", "ᶅ")},
- {0x1dab, 0, 0, 0, g(Yes, No, false, false, "", "ʟ")},
- {0x1dac, 0, 0, 0, g(Yes, No, false, false, "", "ɱ")},
- {0x1dad, 0, 0, 0, g(Yes, No, false, false, "", "ɰ")},
- {0x1dae, 0, 0, 0, g(Yes, No, false, false, "", "ɲ")},
- {0x1daf, 0, 0, 0, g(Yes, No, false, false, "", "ɳ")},
- {0x1db0, 0, 0, 0, g(Yes, No, false, false, "", "ɴ")},
- {0x1db1, 0, 0, 0, g(Yes, No, false, false, "", "ɵ")},
- {0x1db2, 0, 0, 0, g(Yes, No, false, false, "", "ɸ")},
- {0x1db3, 0, 0, 0, g(Yes, No, false, false, "", "ʂ")},
- {0x1db4, 0, 0, 0, g(Yes, No, false, false, "", "ʃ")},
- {0x1db5, 0, 0, 0, g(Yes, No, false, false, "", "ƫ")},
- {0x1db6, 0, 0, 0, g(Yes, No, false, false, "", "ʉ")},
- {0x1db7, 0, 0, 0, g(Yes, No, false, false, "", "ʊ")},
- {0x1db8, 0, 0, 0, g(Yes, No, false, false, "", "ᴜ")},
- {0x1db9, 0, 0, 0, g(Yes, No, false, false, "", "ʋ")},
- {0x1dba, 0, 0, 0, g(Yes, No, false, false, "", "ʌ")},
- {0x1dbb, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1dbc, 0, 0, 0, g(Yes, No, false, false, "", "ʐ")},
- {0x1dbd, 0, 0, 0, g(Yes, No, false, false, "", "ʑ")},
- {0x1dbe, 0, 0, 0, g(Yes, No, false, false, "", "ʒ")},
- {0x1dbf, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1dc0, 230, 1, 1, f(Yes, false, "")},
- {0x1dc2, 220, 1, 1, f(Yes, false, "")},
- {0x1dc3, 230, 1, 1, f(Yes, false, "")},
- {0x1dca, 220, 1, 1, f(Yes, false, "")},
- {0x1dcb, 230, 1, 1, f(Yes, false, "")},
- {0x1dcd, 234, 1, 1, f(Yes, false, "")},
- {0x1dce, 214, 1, 1, f(Yes, false, "")},
- {0x1dcf, 220, 1, 1, f(Yes, false, "")},
- {0x1dd0, 202, 1, 1, f(Yes, false, "")},
- {0x1dd1, 230, 1, 1, f(Yes, false, "")},
- {0x1df6, 232, 1, 1, f(Yes, false, "")},
- {0x1df7, 228, 1, 1, f(Yes, false, "")},
- {0x1df9, 220, 1, 1, f(Yes, false, "")},
- {0x1dfa, 0, 0, 0, f(Yes, false, "")},
- {0x1dfb, 230, 1, 1, f(Yes, false, "")},
- {0x1dfc, 233, 1, 1, f(Yes, false, "")},
- {0x1dfd, 220, 1, 1, f(Yes, false, "")},
- {0x1dfe, 230, 1, 1, f(Yes, false, "")},
- {0x1dff, 220, 1, 1, f(Yes, false, "")},
- {0x1e00, 0, 0, 1, f(Yes, false, "Ḁ")},
- {0x1e01, 0, 0, 1, f(Yes, false, "ḁ")},
- {0x1e02, 0, 0, 1, f(Yes, false, "Ḃ")},
- {0x1e03, 0, 0, 1, f(Yes, false, "ḃ")},
- {0x1e04, 0, 0, 1, f(Yes, false, "Ḅ")},
- {0x1e05, 0, 0, 1, f(Yes, false, "ḅ")},
- {0x1e06, 0, 0, 1, f(Yes, false, "Ḇ")},
- {0x1e07, 0, 0, 1, f(Yes, false, "ḇ")},
- {0x1e08, 0, 0, 2, f(Yes, false, "Ḉ")},
- {0x1e09, 0, 0, 2, f(Yes, false, "ḉ")},
- {0x1e0a, 0, 0, 1, f(Yes, false, "Ḋ")},
- {0x1e0b, 0, 0, 1, f(Yes, false, "ḋ")},
- {0x1e0c, 0, 0, 1, f(Yes, false, "Ḍ")},
- {0x1e0d, 0, 0, 1, f(Yes, false, "ḍ")},
- {0x1e0e, 0, 0, 1, f(Yes, false, "Ḏ")},
- {0x1e0f, 0, 0, 1, f(Yes, false, "ḏ")},
- {0x1e10, 0, 0, 1, f(Yes, false, "Ḑ")},
- {0x1e11, 0, 0, 1, f(Yes, false, "ḑ")},
- {0x1e12, 0, 0, 1, f(Yes, false, "Ḓ")},
- {0x1e13, 0, 0, 1, f(Yes, false, "ḓ")},
- {0x1e14, 0, 0, 2, f(Yes, false, "Ḕ")},
- {0x1e15, 0, 0, 2, f(Yes, false, "ḕ")},
- {0x1e16, 0, 0, 2, f(Yes, false, "Ḗ")},
- {0x1e17, 0, 0, 2, f(Yes, false, "ḗ")},
- {0x1e18, 0, 0, 1, f(Yes, false, "Ḙ")},
- {0x1e19, 0, 0, 1, f(Yes, false, "ḙ")},
- {0x1e1a, 0, 0, 1, f(Yes, false, "Ḛ")},
- {0x1e1b, 0, 0, 1, f(Yes, false, "ḛ")},
- {0x1e1c, 0, 0, 2, f(Yes, false, "Ḝ")},
- {0x1e1d, 0, 0, 2, f(Yes, false, "ḝ")},
- {0x1e1e, 0, 0, 1, f(Yes, false, "Ḟ")},
- {0x1e1f, 0, 0, 1, f(Yes, false, "ḟ")},
- {0x1e20, 0, 0, 1, f(Yes, false, "Ḡ")},
- {0x1e21, 0, 0, 1, f(Yes, false, "ḡ")},
- {0x1e22, 0, 0, 1, f(Yes, false, "Ḣ")},
- {0x1e23, 0, 0, 1, f(Yes, false, "ḣ")},
- {0x1e24, 0, 0, 1, f(Yes, false, "Ḥ")},
- {0x1e25, 0, 0, 1, f(Yes, false, "ḥ")},
- {0x1e26, 0, 0, 1, f(Yes, false, "Ḧ")},
- {0x1e27, 0, 0, 1, f(Yes, false, "ḧ")},
- {0x1e28, 0, 0, 1, f(Yes, false, "Ḩ")},
- {0x1e29, 0, 0, 1, f(Yes, false, "ḩ")},
- {0x1e2a, 0, 0, 1, f(Yes, false, "Ḫ")},
- {0x1e2b, 0, 0, 1, f(Yes, false, "ḫ")},
- {0x1e2c, 0, 0, 1, f(Yes, false, "Ḭ")},
- {0x1e2d, 0, 0, 1, f(Yes, false, "ḭ")},
- {0x1e2e, 0, 0, 2, f(Yes, false, "Ḯ")},
- {0x1e2f, 0, 0, 2, f(Yes, false, "ḯ")},
- {0x1e30, 0, 0, 1, f(Yes, false, "Ḱ")},
- {0x1e31, 0, 0, 1, f(Yes, false, "ḱ")},
- {0x1e32, 0, 0, 1, f(Yes, false, "Ḳ")},
- {0x1e33, 0, 0, 1, f(Yes, false, "ḳ")},
- {0x1e34, 0, 0, 1, f(Yes, false, "Ḵ")},
- {0x1e35, 0, 0, 1, f(Yes, false, "ḵ")},
- {0x1e36, 0, 0, 1, f(Yes, true, "Ḷ")},
- {0x1e37, 0, 0, 1, f(Yes, true, "ḷ")},
- {0x1e38, 0, 0, 2, f(Yes, false, "Ḹ")},
- {0x1e39, 0, 0, 2, f(Yes, false, "ḹ")},
- {0x1e3a, 0, 0, 1, f(Yes, false, "Ḻ")},
- {0x1e3b, 0, 0, 1, f(Yes, false, "ḻ")},
- {0x1e3c, 0, 0, 1, f(Yes, false, "Ḽ")},
- {0x1e3d, 0, 0, 1, f(Yes, false, "ḽ")},
- {0x1e3e, 0, 0, 1, f(Yes, false, "Ḿ")},
- {0x1e3f, 0, 0, 1, f(Yes, false, "ḿ")},
- {0x1e40, 0, 0, 1, f(Yes, false, "Ṁ")},
- {0x1e41, 0, 0, 1, f(Yes, false, "ṁ")},
- {0x1e42, 0, 0, 1, f(Yes, false, "Ṃ")},
- {0x1e43, 0, 0, 1, f(Yes, false, "ṃ")},
- {0x1e44, 0, 0, 1, f(Yes, false, "Ṅ")},
- {0x1e45, 0, 0, 1, f(Yes, false, "ṅ")},
- {0x1e46, 0, 0, 1, f(Yes, false, "Ṇ")},
- {0x1e47, 0, 0, 1, f(Yes, false, "ṇ")},
- {0x1e48, 0, 0, 1, f(Yes, false, "Ṉ")},
- {0x1e49, 0, 0, 1, f(Yes, false, "ṉ")},
- {0x1e4a, 0, 0, 1, f(Yes, false, "Ṋ")},
- {0x1e4b, 0, 0, 1, f(Yes, false, "ṋ")},
- {0x1e4c, 0, 0, 2, f(Yes, false, "Ṍ")},
- {0x1e4d, 0, 0, 2, f(Yes, false, "ṍ")},
- {0x1e4e, 0, 0, 2, f(Yes, false, "Ṏ")},
- {0x1e4f, 0, 0, 2, f(Yes, false, "ṏ")},
- {0x1e50, 0, 0, 2, f(Yes, false, "Ṑ")},
- {0x1e51, 0, 0, 2, f(Yes, false, "ṑ")},
- {0x1e52, 0, 0, 2, f(Yes, false, "Ṓ")},
- {0x1e53, 0, 0, 2, f(Yes, false, "ṓ")},
- {0x1e54, 0, 0, 1, f(Yes, false, "Ṕ")},
- {0x1e55, 0, 0, 1, f(Yes, false, "ṕ")},
- {0x1e56, 0, 0, 1, f(Yes, false, "Ṗ")},
- {0x1e57, 0, 0, 1, f(Yes, false, "ṗ")},
- {0x1e58, 0, 0, 1, f(Yes, false, "Ṙ")},
- {0x1e59, 0, 0, 1, f(Yes, false, "ṙ")},
- {0x1e5a, 0, 0, 1, f(Yes, true, "Ṛ")},
- {0x1e5b, 0, 0, 1, f(Yes, true, "ṛ")},
- {0x1e5c, 0, 0, 2, f(Yes, false, "Ṝ")},
- {0x1e5d, 0, 0, 2, f(Yes, false, "ṝ")},
- {0x1e5e, 0, 0, 1, f(Yes, false, "Ṟ")},
- {0x1e5f, 0, 0, 1, f(Yes, false, "ṟ")},
- {0x1e60, 0, 0, 1, f(Yes, false, "Ṡ")},
- {0x1e61, 0, 0, 1, f(Yes, false, "ṡ")},
- {0x1e62, 0, 0, 1, f(Yes, true, "Ṣ")},
- {0x1e63, 0, 0, 1, f(Yes, true, "ṣ")},
- {0x1e64, 0, 0, 2, f(Yes, false, "Ṥ")},
- {0x1e65, 0, 0, 2, f(Yes, false, "ṥ")},
- {0x1e66, 0, 0, 2, f(Yes, false, "Ṧ")},
- {0x1e67, 0, 0, 2, f(Yes, false, "ṧ")},
- {0x1e68, 0, 0, 2, f(Yes, false, "Ṩ")},
- {0x1e69, 0, 0, 2, f(Yes, false, "ṩ")},
- {0x1e6a, 0, 0, 1, f(Yes, false, "Ṫ")},
- {0x1e6b, 0, 0, 1, f(Yes, false, "ṫ")},
- {0x1e6c, 0, 0, 1, f(Yes, false, "Ṭ")},
- {0x1e6d, 0, 0, 1, f(Yes, false, "ṭ")},
- {0x1e6e, 0, 0, 1, f(Yes, false, "Ṯ")},
- {0x1e6f, 0, 0, 1, f(Yes, false, "ṯ")},
- {0x1e70, 0, 0, 1, f(Yes, false, "Ṱ")},
- {0x1e71, 0, 0, 1, f(Yes, false, "ṱ")},
- {0x1e72, 0, 0, 1, f(Yes, false, "Ṳ")},
- {0x1e73, 0, 0, 1, f(Yes, false, "ṳ")},
- {0x1e74, 0, 0, 1, f(Yes, false, "Ṵ")},
- {0x1e75, 0, 0, 1, f(Yes, false, "ṵ")},
- {0x1e76, 0, 0, 1, f(Yes, false, "Ṷ")},
- {0x1e77, 0, 0, 1, f(Yes, false, "ṷ")},
- {0x1e78, 0, 0, 2, f(Yes, false, "Ṹ")},
- {0x1e79, 0, 0, 2, f(Yes, false, "ṹ")},
- {0x1e7a, 0, 0, 2, f(Yes, false, "Ṻ")},
- {0x1e7b, 0, 0, 2, f(Yes, false, "ṻ")},
- {0x1e7c, 0, 0, 1, f(Yes, false, "Ṽ")},
- {0x1e7d, 0, 0, 1, f(Yes, false, "ṽ")},
- {0x1e7e, 0, 0, 1, f(Yes, false, "Ṿ")},
- {0x1e7f, 0, 0, 1, f(Yes, false, "ṿ")},
- {0x1e80, 0, 0, 1, f(Yes, false, "Ẁ")},
- {0x1e81, 0, 0, 1, f(Yes, false, "ẁ")},
- {0x1e82, 0, 0, 1, f(Yes, false, "Ẃ")},
- {0x1e83, 0, 0, 1, f(Yes, false, "ẃ")},
- {0x1e84, 0, 0, 1, f(Yes, false, "Ẅ")},
- {0x1e85, 0, 0, 1, f(Yes, false, "ẅ")},
- {0x1e86, 0, 0, 1, f(Yes, false, "Ẇ")},
- {0x1e87, 0, 0, 1, f(Yes, false, "ẇ")},
- {0x1e88, 0, 0, 1, f(Yes, false, "Ẉ")},
- {0x1e89, 0, 0, 1, f(Yes, false, "ẉ")},
- {0x1e8a, 0, 0, 1, f(Yes, false, "Ẋ")},
- {0x1e8b, 0, 0, 1, f(Yes, false, "ẋ")},
- {0x1e8c, 0, 0, 1, f(Yes, false, "Ẍ")},
- {0x1e8d, 0, 0, 1, f(Yes, false, "ẍ")},
- {0x1e8e, 0, 0, 1, f(Yes, false, "Ẏ")},
- {0x1e8f, 0, 0, 1, f(Yes, false, "ẏ")},
- {0x1e90, 0, 0, 1, f(Yes, false, "Ẑ")},
- {0x1e91, 0, 0, 1, f(Yes, false, "ẑ")},
- {0x1e92, 0, 0, 1, f(Yes, false, "Ẓ")},
- {0x1e93, 0, 0, 1, f(Yes, false, "ẓ")},
- {0x1e94, 0, 0, 1, f(Yes, false, "Ẕ")},
- {0x1e95, 0, 0, 1, f(Yes, false, "ẕ")},
- {0x1e96, 0, 0, 1, f(Yes, false, "ẖ")},
- {0x1e97, 0, 0, 1, f(Yes, false, "ẗ")},
- {0x1e98, 0, 0, 1, f(Yes, false, "ẘ")},
- {0x1e99, 0, 0, 1, f(Yes, false, "ẙ")},
- {0x1e9a, 0, 0, 0, g(Yes, No, false, false, "", "aʾ")},
- {0x1e9b, 0, 0, 1, g(Yes, No, false, false, "ẛ", "ṡ")},
- {0x1e9c, 0, 0, 0, f(Yes, false, "")},
- {0x1ea0, 0, 0, 1, f(Yes, true, "Ạ")},
- {0x1ea1, 0, 0, 1, f(Yes, true, "ạ")},
- {0x1ea2, 0, 0, 1, f(Yes, false, "Ả")},
- {0x1ea3, 0, 0, 1, f(Yes, false, "ả")},
- {0x1ea4, 0, 0, 2, f(Yes, false, "Ấ")},
- {0x1ea5, 0, 0, 2, f(Yes, false, "ấ")},
- {0x1ea6, 0, 0, 2, f(Yes, false, "Ầ")},
- {0x1ea7, 0, 0, 2, f(Yes, false, "ầ")},
- {0x1ea8, 0, 0, 2, f(Yes, false, "Ẩ")},
- {0x1ea9, 0, 0, 2, f(Yes, false, "ẩ")},
- {0x1eaa, 0, 0, 2, f(Yes, false, "Ẫ")},
- {0x1eab, 0, 0, 2, f(Yes, false, "ẫ")},
- {0x1eac, 0, 0, 2, f(Yes, false, "Ậ")},
- {0x1ead, 0, 0, 2, f(Yes, false, "ậ")},
- {0x1eae, 0, 0, 2, f(Yes, false, "Ắ")},
- {0x1eaf, 0, 0, 2, f(Yes, false, "ắ")},
- {0x1eb0, 0, 0, 2, f(Yes, false, "Ằ")},
- {0x1eb1, 0, 0, 2, f(Yes, false, "ằ")},
- {0x1eb2, 0, 0, 2, f(Yes, false, "Ẳ")},
- {0x1eb3, 0, 0, 2, f(Yes, false, "ẳ")},
- {0x1eb4, 0, 0, 2, f(Yes, false, "Ẵ")},
- {0x1eb5, 0, 0, 2, f(Yes, false, "ẵ")},
- {0x1eb6, 0, 0, 2, f(Yes, false, "Ặ")},
- {0x1eb7, 0, 0, 2, f(Yes, false, "ặ")},
- {0x1eb8, 0, 0, 1, f(Yes, true, "Ẹ")},
- {0x1eb9, 0, 0, 1, f(Yes, true, "ẹ")},
- {0x1eba, 0, 0, 1, f(Yes, false, "Ẻ")},
- {0x1ebb, 0, 0, 1, f(Yes, false, "ẻ")},
- {0x1ebc, 0, 0, 1, f(Yes, false, "Ẽ")},
- {0x1ebd, 0, 0, 1, f(Yes, false, "ẽ")},
- {0x1ebe, 0, 0, 2, f(Yes, false, "Ế")},
- {0x1ebf, 0, 0, 2, f(Yes, false, "ế")},
- {0x1ec0, 0, 0, 2, f(Yes, false, "Ề")},
- {0x1ec1, 0, 0, 2, f(Yes, false, "ề")},
- {0x1ec2, 0, 0, 2, f(Yes, false, "Ể")},
- {0x1ec3, 0, 0, 2, f(Yes, false, "ể")},
- {0x1ec4, 0, 0, 2, f(Yes, false, "Ễ")},
- {0x1ec5, 0, 0, 2, f(Yes, false, "ễ")},
- {0x1ec6, 0, 0, 2, f(Yes, false, "Ệ")},
- {0x1ec7, 0, 0, 2, f(Yes, false, "ệ")},
- {0x1ec8, 0, 0, 1, f(Yes, false, "Ỉ")},
- {0x1ec9, 0, 0, 1, f(Yes, false, "ỉ")},
- {0x1eca, 0, 0, 1, f(Yes, false, "Ị")},
- {0x1ecb, 0, 0, 1, f(Yes, false, "ị")},
- {0x1ecc, 0, 0, 1, f(Yes, true, "Ọ")},
- {0x1ecd, 0, 0, 1, f(Yes, true, "ọ")},
- {0x1ece, 0, 0, 1, f(Yes, false, "Ỏ")},
- {0x1ecf, 0, 0, 1, f(Yes, false, "ỏ")},
- {0x1ed0, 0, 0, 2, f(Yes, false, "Ố")},
- {0x1ed1, 0, 0, 2, f(Yes, false, "ố")},
- {0x1ed2, 0, 0, 2, f(Yes, false, "Ồ")},
- {0x1ed3, 0, 0, 2, f(Yes, false, "ồ")},
- {0x1ed4, 0, 0, 2, f(Yes, false, "Ổ")},
- {0x1ed5, 0, 0, 2, f(Yes, false, "ổ")},
- {0x1ed6, 0, 0, 2, f(Yes, false, "Ỗ")},
- {0x1ed7, 0, 0, 2, f(Yes, false, "ỗ")},
- {0x1ed8, 0, 0, 2, f(Yes, false, "Ộ")},
- {0x1ed9, 0, 0, 2, f(Yes, false, "ộ")},
- {0x1eda, 0, 0, 2, f(Yes, false, "Ớ")},
- {0x1edb, 0, 0, 2, f(Yes, false, "ớ")},
- {0x1edc, 0, 0, 2, f(Yes, false, "Ờ")},
- {0x1edd, 0, 0, 2, f(Yes, false, "ờ")},
- {0x1ede, 0, 0, 2, f(Yes, false, "Ở")},
- {0x1edf, 0, 0, 2, f(Yes, false, "ở")},
- {0x1ee0, 0, 0, 2, f(Yes, false, "Ỡ")},
- {0x1ee1, 0, 0, 2, f(Yes, false, "ỡ")},
- {0x1ee2, 0, 0, 2, f(Yes, false, "Ợ")},
- {0x1ee3, 0, 0, 2, f(Yes, false, "ợ")},
- {0x1ee4, 0, 0, 1, f(Yes, false, "Ụ")},
- {0x1ee5, 0, 0, 1, f(Yes, false, "ụ")},
- {0x1ee6, 0, 0, 1, f(Yes, false, "Ủ")},
- {0x1ee7, 0, 0, 1, f(Yes, false, "ủ")},
- {0x1ee8, 0, 0, 2, f(Yes, false, "Ứ")},
- {0x1ee9, 0, 0, 2, f(Yes, false, "ứ")},
- {0x1eea, 0, 0, 2, f(Yes, false, "Ừ")},
- {0x1eeb, 0, 0, 2, f(Yes, false, "ừ")},
- {0x1eec, 0, 0, 2, f(Yes, false, "Ử")},
- {0x1eed, 0, 0, 2, f(Yes, false, "ử")},
- {0x1eee, 0, 0, 2, f(Yes, false, "Ữ")},
- {0x1eef, 0, 0, 2, f(Yes, false, "ữ")},
- {0x1ef0, 0, 0, 2, f(Yes, false, "Ự")},
- {0x1ef1, 0, 0, 2, f(Yes, false, "ự")},
- {0x1ef2, 0, 0, 1, f(Yes, false, "Ỳ")},
- {0x1ef3, 0, 0, 1, f(Yes, false, "ỳ")},
- {0x1ef4, 0, 0, 1, f(Yes, false, "Ỵ")},
- {0x1ef5, 0, 0, 1, f(Yes, false, "ỵ")},
- {0x1ef6, 0, 0, 1, f(Yes, false, "Ỷ")},
- {0x1ef7, 0, 0, 1, f(Yes, false, "ỷ")},
- {0x1ef8, 0, 0, 1, f(Yes, false, "Ỹ")},
- {0x1ef9, 0, 0, 1, f(Yes, false, "ỹ")},
- {0x1efa, 0, 0, 0, f(Yes, false, "")},
- {0x1f00, 0, 0, 1, f(Yes, true, "ἀ")},
- {0x1f01, 0, 0, 1, f(Yes, true, "ἁ")},
- {0x1f02, 0, 0, 2, f(Yes, true, "ἂ")},
- {0x1f03, 0, 0, 2, f(Yes, true, "ἃ")},
- {0x1f04, 0, 0, 2, f(Yes, true, "ἄ")},
- {0x1f05, 0, 0, 2, f(Yes, true, "ἅ")},
- {0x1f06, 0, 0, 2, f(Yes, true, "ἆ")},
- {0x1f07, 0, 0, 2, f(Yes, true, "ἇ")},
- {0x1f08, 0, 0, 1, f(Yes, true, "Ἀ")},
- {0x1f09, 0, 0, 1, f(Yes, true, "Ἁ")},
- {0x1f0a, 0, 0, 2, f(Yes, true, "Ἂ")},
- {0x1f0b, 0, 0, 2, f(Yes, true, "Ἃ")},
- {0x1f0c, 0, 0, 2, f(Yes, true, "Ἄ")},
- {0x1f0d, 0, 0, 2, f(Yes, true, "Ἅ")},
- {0x1f0e, 0, 0, 2, f(Yes, true, "Ἆ")},
- {0x1f0f, 0, 0, 2, f(Yes, true, "Ἇ")},
- {0x1f10, 0, 0, 1, f(Yes, true, "ἐ")},
- {0x1f11, 0, 0, 1, f(Yes, true, "ἑ")},
- {0x1f12, 0, 0, 2, f(Yes, false, "ἒ")},
- {0x1f13, 0, 0, 2, f(Yes, false, "ἓ")},
- {0x1f14, 0, 0, 2, f(Yes, false, "ἔ")},
- {0x1f15, 0, 0, 2, f(Yes, false, "ἕ")},
- {0x1f16, 0, 0, 0, f(Yes, false, "")},
- {0x1f18, 0, 0, 1, f(Yes, true, "Ἐ")},
- {0x1f19, 0, 0, 1, f(Yes, true, "Ἑ")},
- {0x1f1a, 0, 0, 2, f(Yes, false, "Ἒ")},
- {0x1f1b, 0, 0, 2, f(Yes, false, "Ἓ")},
- {0x1f1c, 0, 0, 2, f(Yes, false, "Ἔ")},
- {0x1f1d, 0, 0, 2, f(Yes, false, "Ἕ")},
- {0x1f1e, 0, 0, 0, f(Yes, false, "")},
- {0x1f20, 0, 0, 1, f(Yes, true, "ἠ")},
- {0x1f21, 0, 0, 1, f(Yes, true, "ἡ")},
- {0x1f22, 0, 0, 2, f(Yes, true, "ἢ")},
- {0x1f23, 0, 0, 2, f(Yes, true, "ἣ")},
- {0x1f24, 0, 0, 2, f(Yes, true, "ἤ")},
- {0x1f25, 0, 0, 2, f(Yes, true, "ἥ")},
- {0x1f26, 0, 0, 2, f(Yes, true, "ἦ")},
- {0x1f27, 0, 0, 2, f(Yes, true, "ἧ")},
- {0x1f28, 0, 0, 1, f(Yes, true, "Ἠ")},
- {0x1f29, 0, 0, 1, f(Yes, true, "Ἡ")},
- {0x1f2a, 0, 0, 2, f(Yes, true, "Ἢ")},
- {0x1f2b, 0, 0, 2, f(Yes, true, "Ἣ")},
- {0x1f2c, 0, 0, 2, f(Yes, true, "Ἤ")},
- {0x1f2d, 0, 0, 2, f(Yes, true, "Ἥ")},
- {0x1f2e, 0, 0, 2, f(Yes, true, "Ἦ")},
- {0x1f2f, 0, 0, 2, f(Yes, true, "Ἧ")},
- {0x1f30, 0, 0, 1, f(Yes, true, "ἰ")},
- {0x1f31, 0, 0, 1, f(Yes, true, "ἱ")},
- {0x1f32, 0, 0, 2, f(Yes, false, "ἲ")},
- {0x1f33, 0, 0, 2, f(Yes, false, "ἳ")},
- {0x1f34, 0, 0, 2, f(Yes, false, "ἴ")},
- {0x1f35, 0, 0, 2, f(Yes, false, "ἵ")},
- {0x1f36, 0, 0, 2, f(Yes, false, "ἶ")},
- {0x1f37, 0, 0, 2, f(Yes, false, "ἷ")},
- {0x1f38, 0, 0, 1, f(Yes, true, "Ἰ")},
- {0x1f39, 0, 0, 1, f(Yes, true, "Ἱ")},
- {0x1f3a, 0, 0, 2, f(Yes, false, "Ἲ")},
- {0x1f3b, 0, 0, 2, f(Yes, false, "Ἳ")},
- {0x1f3c, 0, 0, 2, f(Yes, false, "Ἴ")},
- {0x1f3d, 0, 0, 2, f(Yes, false, "Ἵ")},
- {0x1f3e, 0, 0, 2, f(Yes, false, "Ἶ")},
- {0x1f3f, 0, 0, 2, f(Yes, false, "Ἷ")},
- {0x1f40, 0, 0, 1, f(Yes, true, "ὀ")},
- {0x1f41, 0, 0, 1, f(Yes, true, "ὁ")},
- {0x1f42, 0, 0, 2, f(Yes, false, "ὂ")},
- {0x1f43, 0, 0, 2, f(Yes, false, "ὃ")},
- {0x1f44, 0, 0, 2, f(Yes, false, "ὄ")},
- {0x1f45, 0, 0, 2, f(Yes, false, "ὅ")},
- {0x1f46, 0, 0, 0, f(Yes, false, "")},
- {0x1f48, 0, 0, 1, f(Yes, true, "Ὀ")},
- {0x1f49, 0, 0, 1, f(Yes, true, "Ὁ")},
- {0x1f4a, 0, 0, 2, f(Yes, false, "Ὂ")},
- {0x1f4b, 0, 0, 2, f(Yes, false, "Ὃ")},
- {0x1f4c, 0, 0, 2, f(Yes, false, "Ὄ")},
- {0x1f4d, 0, 0, 2, f(Yes, false, "Ὅ")},
- {0x1f4e, 0, 0, 0, f(Yes, false, "")},
- {0x1f50, 0, 0, 1, f(Yes, true, "ὐ")},
- {0x1f51, 0, 0, 1, f(Yes, true, "ὑ")},
- {0x1f52, 0, 0, 2, f(Yes, false, "ὒ")},
- {0x1f53, 0, 0, 2, f(Yes, false, "ὓ")},
- {0x1f54, 0, 0, 2, f(Yes, false, "ὔ")},
- {0x1f55, 0, 0, 2, f(Yes, false, "ὕ")},
- {0x1f56, 0, 0, 2, f(Yes, false, "ὖ")},
- {0x1f57, 0, 0, 2, f(Yes, false, "ὗ")},
- {0x1f58, 0, 0, 0, f(Yes, false, "")},
- {0x1f59, 0, 0, 1, f(Yes, true, "Ὑ")},
- {0x1f5a, 0, 0, 0, f(Yes, false, "")},
- {0x1f5b, 0, 0, 2, f(Yes, false, "Ὓ")},
- {0x1f5c, 0, 0, 0, f(Yes, false, "")},
- {0x1f5d, 0, 0, 2, f(Yes, false, "Ὕ")},
- {0x1f5e, 0, 0, 0, f(Yes, false, "")},
- {0x1f5f, 0, 0, 2, f(Yes, false, "Ὗ")},
- {0x1f60, 0, 0, 1, f(Yes, true, "ὠ")},
- {0x1f61, 0, 0, 1, f(Yes, true, "ὡ")},
- {0x1f62, 0, 0, 2, f(Yes, true, "ὢ")},
- {0x1f63, 0, 0, 2, f(Yes, true, "ὣ")},
- {0x1f64, 0, 0, 2, f(Yes, true, "ὤ")},
- {0x1f65, 0, 0, 2, f(Yes, true, "ὥ")},
- {0x1f66, 0, 0, 2, f(Yes, true, "ὦ")},
- {0x1f67, 0, 0, 2, f(Yes, true, "ὧ")},
- {0x1f68, 0, 0, 1, f(Yes, true, "Ὠ")},
- {0x1f69, 0, 0, 1, f(Yes, true, "Ὡ")},
- {0x1f6a, 0, 0, 2, f(Yes, true, "Ὢ")},
- {0x1f6b, 0, 0, 2, f(Yes, true, "Ὣ")},
- {0x1f6c, 0, 0, 2, f(Yes, true, "Ὤ")},
- {0x1f6d, 0, 0, 2, f(Yes, true, "Ὥ")},
- {0x1f6e, 0, 0, 2, f(Yes, true, "Ὦ")},
- {0x1f6f, 0, 0, 2, f(Yes, true, "Ὧ")},
- {0x1f70, 0, 0, 1, f(Yes, true, "ὰ")},
- {0x1f71, 0, 0, 1, f(No, false, "ά")},
- {0x1f72, 0, 0, 1, f(Yes, false, "ὲ")},
- {0x1f73, 0, 0, 1, f(No, false, "έ")},
- {0x1f74, 0, 0, 1, f(Yes, true, "ὴ")},
- {0x1f75, 0, 0, 1, f(No, false, "ή")},
- {0x1f76, 0, 0, 1, f(Yes, false, "ὶ")},
- {0x1f77, 0, 0, 1, f(No, false, "ί")},
- {0x1f78, 0, 0, 1, f(Yes, false, "ὸ")},
- {0x1f79, 0, 0, 1, f(No, false, "ό")},
- {0x1f7a, 0, 0, 1, f(Yes, false, "ὺ")},
- {0x1f7b, 0, 0, 1, f(No, false, "ύ")},
- {0x1f7c, 0, 0, 1, f(Yes, true, "ὼ")},
- {0x1f7d, 0, 0, 1, f(No, false, "ώ")},
- {0x1f7e, 0, 0, 0, f(Yes, false, "")},
- {0x1f80, 0, 0, 2, f(Yes, false, "ᾀ")},
- {0x1f81, 0, 0, 2, f(Yes, false, "ᾁ")},
- {0x1f82, 0, 0, 3, f(Yes, false, "ᾂ")},
- {0x1f83, 0, 0, 3, f(Yes, false, "ᾃ")},
- {0x1f84, 0, 0, 3, f(Yes, false, "ᾄ")},
- {0x1f85, 0, 0, 3, f(Yes, false, "ᾅ")},
- {0x1f86, 0, 0, 3, f(Yes, false, "ᾆ")},
- {0x1f87, 0, 0, 3, f(Yes, false, "ᾇ")},
- {0x1f88, 0, 0, 2, f(Yes, false, "ᾈ")},
- {0x1f89, 0, 0, 2, f(Yes, false, "ᾉ")},
- {0x1f8a, 0, 0, 3, f(Yes, false, "ᾊ")},
- {0x1f8b, 0, 0, 3, f(Yes, false, "ᾋ")},
- {0x1f8c, 0, 0, 3, f(Yes, false, "ᾌ")},
- {0x1f8d, 0, 0, 3, f(Yes, false, "ᾍ")},
- {0x1f8e, 0, 0, 3, f(Yes, false, "ᾎ")},
- {0x1f8f, 0, 0, 3, f(Yes, false, "ᾏ")},
- {0x1f90, 0, 0, 2, f(Yes, false, "ᾐ")},
- {0x1f91, 0, 0, 2, f(Yes, false, "ᾑ")},
- {0x1f92, 0, 0, 3, f(Yes, false, "ᾒ")},
- {0x1f93, 0, 0, 3, f(Yes, false, "ᾓ")},
- {0x1f94, 0, 0, 3, f(Yes, false, "ᾔ")},
- {0x1f95, 0, 0, 3, f(Yes, false, "ᾕ")},
- {0x1f96, 0, 0, 3, f(Yes, false, "ᾖ")},
- {0x1f97, 0, 0, 3, f(Yes, false, "ᾗ")},
- {0x1f98, 0, 0, 2, f(Yes, false, "ᾘ")},
- {0x1f99, 0, 0, 2, f(Yes, false, "ᾙ")},
- {0x1f9a, 0, 0, 3, f(Yes, false, "ᾚ")},
- {0x1f9b, 0, 0, 3, f(Yes, false, "ᾛ")},
- {0x1f9c, 0, 0, 3, f(Yes, false, "ᾜ")},
- {0x1f9d, 0, 0, 3, f(Yes, false, "ᾝ")},
- {0x1f9e, 0, 0, 3, f(Yes, false, "ᾞ")},
- {0x1f9f, 0, 0, 3, f(Yes, false, "ᾟ")},
- {0x1fa0, 0, 0, 2, f(Yes, false, "ᾠ")},
- {0x1fa1, 0, 0, 2, f(Yes, false, "ᾡ")},
- {0x1fa2, 0, 0, 3, f(Yes, false, "ᾢ")},
- {0x1fa3, 0, 0, 3, f(Yes, false, "ᾣ")},
- {0x1fa4, 0, 0, 3, f(Yes, false, "ᾤ")},
- {0x1fa5, 0, 0, 3, f(Yes, false, "ᾥ")},
- {0x1fa6, 0, 0, 3, f(Yes, false, "ᾦ")},
- {0x1fa7, 0, 0, 3, f(Yes, false, "ᾧ")},
- {0x1fa8, 0, 0, 2, f(Yes, false, "ᾨ")},
- {0x1fa9, 0, 0, 2, f(Yes, false, "ᾩ")},
- {0x1faa, 0, 0, 3, f(Yes, false, "ᾪ")},
- {0x1fab, 0, 0, 3, f(Yes, false, "ᾫ")},
- {0x1fac, 0, 0, 3, f(Yes, false, "ᾬ")},
- {0x1fad, 0, 0, 3, f(Yes, false, "ᾭ")},
- {0x1fae, 0, 0, 3, f(Yes, false, "ᾮ")},
- {0x1faf, 0, 0, 3, f(Yes, false, "ᾯ")},
- {0x1fb0, 0, 0, 1, f(Yes, false, "ᾰ")},
- {0x1fb1, 0, 0, 1, f(Yes, false, "ᾱ")},
- {0x1fb2, 0, 0, 2, f(Yes, false, "ᾲ")},
- {0x1fb3, 0, 0, 1, f(Yes, false, "ᾳ")},
- {0x1fb4, 0, 0, 2, f(Yes, false, "ᾴ")},
- {0x1fb5, 0, 0, 0, f(Yes, false, "")},
- {0x1fb6, 0, 0, 1, f(Yes, true, "ᾶ")},
- {0x1fb7, 0, 0, 2, f(Yes, false, "ᾷ")},
- {0x1fb8, 0, 0, 1, f(Yes, false, "Ᾰ")},
- {0x1fb9, 0, 0, 1, f(Yes, false, "Ᾱ")},
- {0x1fba, 0, 0, 1, f(Yes, false, "Ὰ")},
- {0x1fbb, 0, 0, 1, f(No, false, "Ά")},
- {0x1fbc, 0, 0, 1, f(Yes, false, "ᾼ")},
- {0x1fbd, 0, 0, 1, g(Yes, No, false, false, "", " ̓")},
- {0x1fbe, 0, 0, 0, f(No, false, "ι")},
- {0x1fbf, 0, 0, 1, g(Yes, No, true, false, "", " ̓")},
- {0x1fc0, 0, 0, 1, g(Yes, No, false, false, "", " ͂")},
- {0x1fc1, 0, 0, 2, g(Yes, No, false, false, "῁", " ̈͂")},
- {0x1fc2, 0, 0, 2, f(Yes, false, "ῂ")},
- {0x1fc3, 0, 0, 1, f(Yes, false, "ῃ")},
- {0x1fc4, 0, 0, 2, f(Yes, false, "ῄ")},
- {0x1fc5, 0, 0, 0, f(Yes, false, "")},
- {0x1fc6, 0, 0, 1, f(Yes, true, "ῆ")},
- {0x1fc7, 0, 0, 2, f(Yes, false, "ῇ")},
- {0x1fc8, 0, 0, 1, f(Yes, false, "Ὲ")},
- {0x1fc9, 0, 0, 1, f(No, false, "Έ")},
- {0x1fca, 0, 0, 1, f(Yes, false, "Ὴ")},
- {0x1fcb, 0, 0, 1, f(No, false, "Ή")},
- {0x1fcc, 0, 0, 1, f(Yes, false, "ῌ")},
- {0x1fcd, 0, 0, 2, g(Yes, No, false, false, "῍", " ̓̀")},
- {0x1fce, 0, 0, 2, g(Yes, No, false, false, "῎", " ̓́")},
- {0x1fcf, 0, 0, 2, g(Yes, No, false, false, "῏", " ̓͂")},
- {0x1fd0, 0, 0, 1, f(Yes, false, "ῐ")},
- {0x1fd1, 0, 0, 1, f(Yes, false, "ῑ")},
- {0x1fd2, 0, 0, 2, f(Yes, false, "ῒ")},
- {0x1fd3, 0, 0, 2, f(No, false, "ΐ")},
- {0x1fd4, 0, 0, 0, f(Yes, false, "")},
- {0x1fd6, 0, 0, 1, f(Yes, false, "ῖ")},
- {0x1fd7, 0, 0, 2, f(Yes, false, "ῗ")},
- {0x1fd8, 0, 0, 1, f(Yes, false, "Ῐ")},
- {0x1fd9, 0, 0, 1, f(Yes, false, "Ῑ")},
- {0x1fda, 0, 0, 1, f(Yes, false, "Ὶ")},
- {0x1fdb, 0, 0, 1, f(No, false, "Ί")},
- {0x1fdc, 0, 0, 0, f(Yes, false, "")},
- {0x1fdd, 0, 0, 2, g(Yes, No, false, false, "῝", " ̔̀")},
- {0x1fde, 0, 0, 2, g(Yes, No, false, false, "῞", " ̔́")},
- {0x1fdf, 0, 0, 2, g(Yes, No, false, false, "῟", " ̔͂")},
- {0x1fe0, 0, 0, 1, f(Yes, false, "ῠ")},
- {0x1fe1, 0, 0, 1, f(Yes, false, "ῡ")},
- {0x1fe2, 0, 0, 2, f(Yes, false, "ῢ")},
- {0x1fe3, 0, 0, 2, f(No, false, "ΰ")},
- {0x1fe4, 0, 0, 1, f(Yes, false, "ῤ")},
- {0x1fe5, 0, 0, 1, f(Yes, false, "ῥ")},
- {0x1fe6, 0, 0, 1, f(Yes, false, "ῦ")},
- {0x1fe7, 0, 0, 2, f(Yes, false, "ῧ")},
- {0x1fe8, 0, 0, 1, f(Yes, false, "Ῠ")},
- {0x1fe9, 0, 0, 1, f(Yes, false, "Ῡ")},
- {0x1fea, 0, 0, 1, f(Yes, false, "Ὺ")},
- {0x1feb, 0, 0, 1, f(No, false, "Ύ")},
- {0x1fec, 0, 0, 1, f(Yes, false, "Ῥ")},
- {0x1fed, 0, 0, 2, g(Yes, No, false, false, "῭", " ̈̀")},
- {0x1fee, 0, 0, 2, g(No, No, false, false, "΅", " ̈́")},
- {0x1fef, 0, 0, 0, f(No, false, "`")},
- {0x1ff0, 0, 0, 0, f(Yes, false, "")},
- {0x1ff2, 0, 0, 2, f(Yes, false, "ῲ")},
- {0x1ff3, 0, 0, 1, f(Yes, false, "ῳ")},
- {0x1ff4, 0, 0, 2, f(Yes, false, "ῴ")},
- {0x1ff5, 0, 0, 0, f(Yes, false, "")},
- {0x1ff6, 0, 0, 1, f(Yes, true, "ῶ")},
- {0x1ff7, 0, 0, 2, f(Yes, false, "ῷ")},
- {0x1ff8, 0, 0, 1, f(Yes, false, "Ὸ")},
- {0x1ff9, 0, 0, 1, f(No, false, "Ό")},
- {0x1ffa, 0, 0, 1, f(Yes, false, "Ὼ")},
- {0x1ffb, 0, 0, 1, f(No, false, "Ώ")},
- {0x1ffc, 0, 0, 1, f(Yes, false, "ῼ")},
- {0x1ffd, 0, 0, 1, g(No, No, false, false, "´", " ́")},
- {0x1ffe, 0, 0, 1, g(Yes, No, true, false, "", " ̔")},
- {0x1fff, 0, 0, 0, f(Yes, false, "")},
- {0x2000, 0, 0, 0, g(No, No, false, false, "\u2002", " ")},
- {0x2001, 0, 0, 0, g(No, No, false, false, "\u2003", " ")},
- {0x2002, 0, 0, 0, g(Yes, No, false, false, "", " ")},
- {0x200b, 0, 0, 0, f(Yes, false, "")},
- {0x2011, 0, 0, 0, g(Yes, No, false, false, "", "‐")},
- {0x2012, 0, 0, 0, f(Yes, false, "")},
- {0x2017, 0, 0, 1, g(Yes, No, false, false, "", " ̳")},
- {0x2018, 0, 0, 0, f(Yes, false, "")},
- {0x2024, 0, 0, 0, g(Yes, No, false, false, "", ".")},
- {0x2025, 0, 0, 0, g(Yes, No, false, false, "", "..")},
- {0x2026, 0, 0, 0, g(Yes, No, false, false, "", "...")},
- {0x2027, 0, 0, 0, f(Yes, false, "")},
- {0x202f, 0, 0, 0, g(Yes, No, false, false, "", " ")},
- {0x2030, 0, 0, 0, f(Yes, false, "")},
- {0x2033, 0, 0, 0, g(Yes, No, false, false, "", "′′")},
- {0x2034, 0, 0, 0, g(Yes, No, false, false, "", "′′′")},
- {0x2035, 0, 0, 0, f(Yes, false, "")},
- {0x2036, 0, 0, 0, g(Yes, No, false, false, "", "‵‵")},
- {0x2037, 0, 0, 0, g(Yes, No, false, false, "", "‵‵‵")},
- {0x2038, 0, 0, 0, f(Yes, false, "")},
- {0x203c, 0, 0, 0, g(Yes, No, false, false, "", "!!")},
- {0x203d, 0, 0, 0, f(Yes, false, "")},
- {0x203e, 0, 0, 1, g(Yes, No, false, false, "", " ̅")},
- {0x203f, 0, 0, 0, f(Yes, false, "")},
- {0x2047, 0, 0, 0, g(Yes, No, false, false, "", "??")},
- {0x2048, 0, 0, 0, g(Yes, No, false, false, "", "?!")},
- {0x2049, 0, 0, 0, g(Yes, No, false, false, "", "!?")},
- {0x204a, 0, 0, 0, f(Yes, false, "")},
- {0x2057, 0, 0, 0, g(Yes, No, false, false, "", "′′′′")},
- {0x2058, 0, 0, 0, f(Yes, false, "")},
- {0x205f, 0, 0, 0, g(Yes, No, false, false, "", " ")},
- {0x2060, 0, 0, 0, f(Yes, false, "")},
- {0x2070, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x2071, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x2072, 0, 0, 0, f(Yes, false, "")},
- {0x2074, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x2075, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x2076, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x2077, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x2078, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x2079, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x207a, 0, 0, 0, g(Yes, No, false, false, "", "+")},
- {0x207b, 0, 0, 0, g(Yes, No, false, false, "", "−")},
- {0x207c, 0, 0, 0, g(Yes, No, false, false, "", "=")},
- {0x207d, 0, 0, 0, g(Yes, No, false, false, "", "(")},
- {0x207e, 0, 0, 0, g(Yes, No, false, false, "", ")")},
- {0x207f, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x2080, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x2081, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0x2082, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0x2083, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0x2084, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x2085, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x2086, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x2087, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x2088, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x2089, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x208a, 0, 0, 0, g(Yes, No, false, false, "", "+")},
- {0x208b, 0, 0, 0, g(Yes, No, false, false, "", "−")},
- {0x208c, 0, 0, 0, g(Yes, No, false, false, "", "=")},
- {0x208d, 0, 0, 0, g(Yes, No, false, false, "", "(")},
- {0x208e, 0, 0, 0, g(Yes, No, false, false, "", ")")},
- {0x208f, 0, 0, 0, f(Yes, false, "")},
- {0x2090, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x2091, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x2092, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x2093, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x2094, 0, 0, 0, g(Yes, No, false, false, "", "ə")},
- {0x2095, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x2096, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x2097, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x2098, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x2099, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x209a, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x209b, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x209c, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x209d, 0, 0, 0, f(Yes, false, "")},
- {0x20a8, 0, 0, 0, g(Yes, No, false, false, "", "Rs")},
- {0x20a9, 0, 0, 0, f(Yes, false, "")},
- {0x20d0, 230, 1, 1, f(Yes, false, "")},
- {0x20d2, 1, 1, 1, f(Yes, false, "")},
- {0x20d4, 230, 1, 1, f(Yes, false, "")},
- {0x20d8, 1, 1, 1, f(Yes, false, "")},
- {0x20db, 230, 1, 1, f(Yes, false, "")},
- {0x20dd, 0, 0, 0, f(Yes, false, "")},
- {0x20e1, 230, 1, 1, f(Yes, false, "")},
- {0x20e2, 0, 0, 0, f(Yes, false, "")},
- {0x20e5, 1, 1, 1, f(Yes, false, "")},
- {0x20e7, 230, 1, 1, f(Yes, false, "")},
- {0x20e8, 220, 1, 1, f(Yes, false, "")},
- {0x20e9, 230, 1, 1, f(Yes, false, "")},
- {0x20ea, 1, 1, 1, f(Yes, false, "")},
- {0x20ec, 220, 1, 1, f(Yes, false, "")},
- {0x20f0, 230, 1, 1, f(Yes, false, "")},
- {0x20f1, 0, 0, 0, f(Yes, false, "")},
- {0x2100, 0, 0, 0, g(Yes, No, false, false, "", "a/c")},
- {0x2101, 0, 0, 0, g(Yes, No, false, false, "", "a/s")},
- {0x2102, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x2103, 0, 0, 0, g(Yes, No, false, false, "", "°C")},
- {0x2104, 0, 0, 0, f(Yes, false, "")},
- {0x2105, 0, 0, 0, g(Yes, No, false, false, "", "c/o")},
- {0x2106, 0, 0, 0, g(Yes, No, false, false, "", "c/u")},
- {0x2107, 0, 0, 0, g(Yes, No, false, false, "", "Ɛ")},
- {0x2108, 0, 0, 0, f(Yes, false, "")},
- {0x2109, 0, 0, 0, g(Yes, No, false, false, "", "°F")},
- {0x210a, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x210b, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x210e, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x210f, 0, 0, 0, g(Yes, No, false, false, "", "ħ")},
- {0x2110, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x2112, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x2113, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x2114, 0, 0, 0, f(Yes, false, "")},
- {0x2115, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x2116, 0, 0, 0, g(Yes, No, false, false, "", "No")},
- {0x2117, 0, 0, 0, f(Yes, false, "")},
- {0x2119, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x211a, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x211b, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x211e, 0, 0, 0, f(Yes, false, "")},
- {0x2120, 0, 0, 0, g(Yes, No, false, false, "", "SM")},
- {0x2121, 0, 0, 0, g(Yes, No, false, false, "", "TEL")},
- {0x2122, 0, 0, 0, g(Yes, No, false, false, "", "TM")},
- {0x2123, 0, 0, 0, f(Yes, false, "")},
- {0x2124, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x2125, 0, 0, 0, f(Yes, false, "")},
- {0x2126, 0, 0, 0, f(No, false, "Ω")},
- {0x2127, 0, 0, 0, f(Yes, false, "")},
- {0x2128, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x2129, 0, 0, 0, f(Yes, false, "")},
- {0x212a, 0, 0, 0, f(No, false, "K")},
- {0x212b, 0, 0, 1, f(No, false, "Å")},
- {0x212c, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x212d, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x212e, 0, 0, 0, f(Yes, false, "")},
- {0x212f, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x2130, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x2131, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x2132, 0, 0, 0, f(Yes, false, "")},
- {0x2133, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x2134, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x2135, 0, 0, 0, g(Yes, No, false, false, "", "א")},
- {0x2136, 0, 0, 0, g(Yes, No, false, false, "", "ב")},
- {0x2137, 0, 0, 0, g(Yes, No, false, false, "", "ג")},
- {0x2138, 0, 0, 0, g(Yes, No, false, false, "", "ד")},
- {0x2139, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x213a, 0, 0, 0, f(Yes, false, "")},
- {0x213b, 0, 0, 0, g(Yes, No, false, false, "", "FAX")},
- {0x213c, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x213d, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x213e, 0, 0, 0, g(Yes, No, false, false, "", "Γ")},
- {0x213f, 0, 0, 0, g(Yes, No, false, false, "", "Π")},
- {0x2140, 0, 0, 0, g(Yes, No, false, false, "", "∑")},
- {0x2141, 0, 0, 0, f(Yes, false, "")},
- {0x2145, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x2146, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x2147, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x2148, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x2149, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x214a, 0, 0, 0, f(Yes, false, "")},
- {0x2150, 0, 0, 0, g(Yes, No, false, false, "", "1⁄7")},
- {0x2151, 0, 0, 0, g(Yes, No, false, false, "", "1⁄9")},
- {0x2152, 0, 0, 0, g(Yes, No, false, false, "", "1⁄10")},
- {0x2153, 0, 0, 0, g(Yes, No, false, false, "", "1⁄3")},
- {0x2154, 0, 0, 0, g(Yes, No, false, false, "", "2⁄3")},
- {0x2155, 0, 0, 0, g(Yes, No, false, false, "", "1⁄5")},
- {0x2156, 0, 0, 0, g(Yes, No, false, false, "", "2⁄5")},
- {0x2157, 0, 0, 0, g(Yes, No, false, false, "", "3⁄5")},
- {0x2158, 0, 0, 0, g(Yes, No, false, false, "", "4⁄5")},
- {0x2159, 0, 0, 0, g(Yes, No, false, false, "", "1⁄6")},
- {0x215a, 0, 0, 0, g(Yes, No, false, false, "", "5⁄6")},
- {0x215b, 0, 0, 0, g(Yes, No, false, false, "", "1⁄8")},
- {0x215c, 0, 0, 0, g(Yes, No, false, false, "", "3⁄8")},
- {0x215d, 0, 0, 0, g(Yes, No, false, false, "", "5⁄8")},
- {0x215e, 0, 0, 0, g(Yes, No, false, false, "", "7⁄8")},
- {0x215f, 0, 0, 0, g(Yes, No, false, false, "", "1⁄")},
- {0x2160, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x2161, 0, 0, 0, g(Yes, No, false, false, "", "II")},
- {0x2162, 0, 0, 0, g(Yes, No, false, false, "", "III")},
- {0x2163, 0, 0, 0, g(Yes, No, false, false, "", "IV")},
- {0x2164, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x2165, 0, 0, 0, g(Yes, No, false, false, "", "VI")},
- {0x2166, 0, 0, 0, g(Yes, No, false, false, "", "VII")},
- {0x2167, 0, 0, 0, g(Yes, No, false, false, "", "VIII")},
- {0x2168, 0, 0, 0, g(Yes, No, false, false, "", "IX")},
- {0x2169, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x216a, 0, 0, 0, g(Yes, No, false, false, "", "XI")},
- {0x216b, 0, 0, 0, g(Yes, No, false, false, "", "XII")},
- {0x216c, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x216d, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x216e, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x216f, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x2170, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x2171, 0, 0, 0, g(Yes, No, false, false, "", "ii")},
- {0x2172, 0, 0, 0, g(Yes, No, false, false, "", "iii")},
- {0x2173, 0, 0, 0, g(Yes, No, false, false, "", "iv")},
- {0x2174, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x2175, 0, 0, 0, g(Yes, No, false, false, "", "vi")},
- {0x2176, 0, 0, 0, g(Yes, No, false, false, "", "vii")},
- {0x2177, 0, 0, 0, g(Yes, No, false, false, "", "viii")},
- {0x2178, 0, 0, 0, g(Yes, No, false, false, "", "ix")},
- {0x2179, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x217a, 0, 0, 0, g(Yes, No, false, false, "", "xi")},
- {0x217b, 0, 0, 0, g(Yes, No, false, false, "", "xii")},
- {0x217c, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x217d, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x217e, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x217f, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x2180, 0, 0, 0, f(Yes, false, "")},
- {0x2189, 0, 0, 0, g(Yes, No, false, false, "", "0⁄3")},
- {0x218a, 0, 0, 0, f(Yes, false, "")},
- {0x2190, 0, 0, 0, f(Yes, true, "")},
- {0x2191, 0, 0, 0, f(Yes, false, "")},
- {0x2192, 0, 0, 0, f(Yes, true, "")},
- {0x2193, 0, 0, 0, f(Yes, false, "")},
- {0x2194, 0, 0, 0, f(Yes, true, "")},
- {0x2195, 0, 0, 0, f(Yes, false, "")},
- {0x219a, 0, 0, 1, f(Yes, false, "↚")},
- {0x219b, 0, 0, 1, f(Yes, false, "↛")},
- {0x219c, 0, 0, 0, f(Yes, false, "")},
- {0x21ae, 0, 0, 1, f(Yes, false, "↮")},
- {0x21af, 0, 0, 0, f(Yes, false, "")},
- {0x21cd, 0, 0, 1, f(Yes, false, "⇍")},
- {0x21ce, 0, 0, 1, f(Yes, false, "⇎")},
- {0x21cf, 0, 0, 1, f(Yes, false, "⇏")},
- {0x21d0, 0, 0, 0, f(Yes, true, "")},
- {0x21d1, 0, 0, 0, f(Yes, false, "")},
- {0x21d2, 0, 0, 0, f(Yes, true, "")},
- {0x21d3, 0, 0, 0, f(Yes, false, "")},
- {0x21d4, 0, 0, 0, f(Yes, true, "")},
- {0x21d5, 0, 0, 0, f(Yes, false, "")},
- {0x2203, 0, 0, 0, f(Yes, true, "")},
- {0x2204, 0, 0, 1, f(Yes, false, "∄")},
- {0x2205, 0, 0, 0, f(Yes, false, "")},
- {0x2208, 0, 0, 0, f(Yes, true, "")},
- {0x2209, 0, 0, 1, f(Yes, false, "∉")},
- {0x220a, 0, 0, 0, f(Yes, false, "")},
- {0x220b, 0, 0, 0, f(Yes, true, "")},
- {0x220c, 0, 0, 1, f(Yes, false, "∌")},
- {0x220d, 0, 0, 0, f(Yes, false, "")},
- {0x2223, 0, 0, 0, f(Yes, true, "")},
- {0x2224, 0, 0, 1, f(Yes, false, "∤")},
- {0x2225, 0, 0, 0, f(Yes, true, "")},
- {0x2226, 0, 0, 1, f(Yes, false, "∦")},
- {0x2227, 0, 0, 0, f(Yes, false, "")},
- {0x222c, 0, 0, 0, g(Yes, No, false, false, "", "∫∫")},
- {0x222d, 0, 0, 0, g(Yes, No, false, false, "", "∫∫∫")},
- {0x222e, 0, 0, 0, f(Yes, false, "")},
- {0x222f, 0, 0, 0, g(Yes, No, false, false, "", "∮∮")},
- {0x2230, 0, 0, 0, g(Yes, No, false, false, "", "∮∮∮")},
- {0x2231, 0, 0, 0, f(Yes, false, "")},
- {0x223c, 0, 0, 0, f(Yes, true, "")},
- {0x223d, 0, 0, 0, f(Yes, false, "")},
- {0x2241, 0, 0, 1, f(Yes, false, "≁")},
- {0x2242, 0, 0, 0, f(Yes, false, "")},
- {0x2243, 0, 0, 0, f(Yes, true, "")},
- {0x2244, 0, 0, 1, f(Yes, false, "≄")},
- {0x2245, 0, 0, 0, f(Yes, true, "")},
- {0x2246, 0, 0, 0, f(Yes, false, "")},
- {0x2247, 0, 0, 1, f(Yes, false, "≇")},
- {0x2248, 0, 0, 0, f(Yes, true, "")},
- {0x2249, 0, 0, 1, f(Yes, false, "≉")},
- {0x224a, 0, 0, 0, f(Yes, false, "")},
- {0x224d, 0, 0, 0, f(Yes, true, "")},
- {0x224e, 0, 0, 0, f(Yes, false, "")},
- {0x2260, 0, 0, 1, f(Yes, false, "≠")},
- {0x2261, 0, 0, 0, f(Yes, true, "")},
- {0x2262, 0, 0, 1, f(Yes, false, "≢")},
- {0x2263, 0, 0, 0, f(Yes, false, "")},
- {0x2264, 0, 0, 0, f(Yes, true, "")},
- {0x2266, 0, 0, 0, f(Yes, false, "")},
- {0x226d, 0, 0, 1, f(Yes, false, "≭")},
- {0x226e, 0, 0, 1, f(Yes, false, "≮")},
- {0x226f, 0, 0, 1, f(Yes, false, "≯")},
- {0x2270, 0, 0, 1, f(Yes, false, "≰")},
- {0x2271, 0, 0, 1, f(Yes, false, "≱")},
- {0x2272, 0, 0, 0, f(Yes, true, "")},
- {0x2274, 0, 0, 1, f(Yes, false, "≴")},
- {0x2275, 0, 0, 1, f(Yes, false, "≵")},
- {0x2276, 0, 0, 0, f(Yes, true, "")},
- {0x2278, 0, 0, 1, f(Yes, false, "≸")},
- {0x2279, 0, 0, 1, f(Yes, false, "≹")},
- {0x227a, 0, 0, 0, f(Yes, true, "")},
- {0x227e, 0, 0, 0, f(Yes, false, "")},
- {0x2280, 0, 0, 1, f(Yes, false, "⊀")},
- {0x2281, 0, 0, 1, f(Yes, false, "⊁")},
- {0x2282, 0, 0, 0, f(Yes, true, "")},
- {0x2284, 0, 0, 1, f(Yes, false, "⊄")},
- {0x2285, 0, 0, 1, f(Yes, false, "⊅")},
- {0x2286, 0, 0, 0, f(Yes, true, "")},
- {0x2288, 0, 0, 1, f(Yes, false, "⊈")},
- {0x2289, 0, 0, 1, f(Yes, false, "⊉")},
- {0x228a, 0, 0, 0, f(Yes, false, "")},
- {0x2291, 0, 0, 0, f(Yes, true, "")},
- {0x2293, 0, 0, 0, f(Yes, false, "")},
- {0x22a2, 0, 0, 0, f(Yes, true, "")},
- {0x22a3, 0, 0, 0, f(Yes, false, "")},
- {0x22a8, 0, 0, 0, f(Yes, true, "")},
- {0x22aa, 0, 0, 0, f(Yes, false, "")},
- {0x22ab, 0, 0, 0, f(Yes, true, "")},
- {0x22ac, 0, 0, 1, f(Yes, false, "⊬")},
- {0x22ad, 0, 0, 1, f(Yes, false, "⊭")},
- {0x22ae, 0, 0, 1, f(Yes, false, "⊮")},
- {0x22af, 0, 0, 1, f(Yes, false, "⊯")},
- {0x22b0, 0, 0, 0, f(Yes, false, "")},
- {0x22b2, 0, 0, 0, f(Yes, true, "")},
- {0x22b6, 0, 0, 0, f(Yes, false, "")},
- {0x22e0, 0, 0, 1, f(Yes, false, "⋠")},
- {0x22e1, 0, 0, 1, f(Yes, false, "⋡")},
- {0x22e2, 0, 0, 1, f(Yes, false, "⋢")},
- {0x22e3, 0, 0, 1, f(Yes, false, "⋣")},
- {0x22e4, 0, 0, 0, f(Yes, false, "")},
- {0x22ea, 0, 0, 1, f(Yes, false, "⋪")},
- {0x22eb, 0, 0, 1, f(Yes, false, "⋫")},
- {0x22ec, 0, 0, 1, f(Yes, false, "⋬")},
- {0x22ed, 0, 0, 1, f(Yes, false, "⋭")},
- {0x22ee, 0, 0, 0, f(Yes, false, "")},
- {0x2329, 0, 0, 0, f(No, false, "〈")},
- {0x232a, 0, 0, 0, f(No, false, "〉")},
- {0x232b, 0, 0, 0, f(Yes, false, "")},
- {0x2460, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0x2461, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0x2462, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0x2463, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x2464, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x2465, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x2466, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x2467, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x2468, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x2469, 0, 0, 0, g(Yes, No, false, false, "", "10")},
- {0x246a, 0, 0, 0, g(Yes, No, false, false, "", "11")},
- {0x246b, 0, 0, 0, g(Yes, No, false, false, "", "12")},
- {0x246c, 0, 0, 0, g(Yes, No, false, false, "", "13")},
- {0x246d, 0, 0, 0, g(Yes, No, false, false, "", "14")},
- {0x246e, 0, 0, 0, g(Yes, No, false, false, "", "15")},
- {0x246f, 0, 0, 0, g(Yes, No, false, false, "", "16")},
- {0x2470, 0, 0, 0, g(Yes, No, false, false, "", "17")},
- {0x2471, 0, 0, 0, g(Yes, No, false, false, "", "18")},
- {0x2472, 0, 0, 0, g(Yes, No, false, false, "", "19")},
- {0x2473, 0, 0, 0, g(Yes, No, false, false, "", "20")},
- {0x2474, 0, 0, 0, g(Yes, No, false, false, "", "(1)")},
- {0x2475, 0, 0, 0, g(Yes, No, false, false, "", "(2)")},
- {0x2476, 0, 0, 0, g(Yes, No, false, false, "", "(3)")},
- {0x2477, 0, 0, 0, g(Yes, No, false, false, "", "(4)")},
- {0x2478, 0, 0, 0, g(Yes, No, false, false, "", "(5)")},
- {0x2479, 0, 0, 0, g(Yes, No, false, false, "", "(6)")},
- {0x247a, 0, 0, 0, g(Yes, No, false, false, "", "(7)")},
- {0x247b, 0, 0, 0, g(Yes, No, false, false, "", "(8)")},
- {0x247c, 0, 0, 0, g(Yes, No, false, false, "", "(9)")},
- {0x247d, 0, 0, 0, g(Yes, No, false, false, "", "(10)")},
- {0x247e, 0, 0, 0, g(Yes, No, false, false, "", "(11)")},
- {0x247f, 0, 0, 0, g(Yes, No, false, false, "", "(12)")},
- {0x2480, 0, 0, 0, g(Yes, No, false, false, "", "(13)")},
- {0x2481, 0, 0, 0, g(Yes, No, false, false, "", "(14)")},
- {0x2482, 0, 0, 0, g(Yes, No, false, false, "", "(15)")},
- {0x2483, 0, 0, 0, g(Yes, No, false, false, "", "(16)")},
- {0x2484, 0, 0, 0, g(Yes, No, false, false, "", "(17)")},
- {0x2485, 0, 0, 0, g(Yes, No, false, false, "", "(18)")},
- {0x2486, 0, 0, 0, g(Yes, No, false, false, "", "(19)")},
- {0x2487, 0, 0, 0, g(Yes, No, false, false, "", "(20)")},
- {0x2488, 0, 0, 0, g(Yes, No, false, false, "", "1.")},
- {0x2489, 0, 0, 0, g(Yes, No, false, false, "", "2.")},
- {0x248a, 0, 0, 0, g(Yes, No, false, false, "", "3.")},
- {0x248b, 0, 0, 0, g(Yes, No, false, false, "", "4.")},
- {0x248c, 0, 0, 0, g(Yes, No, false, false, "", "5.")},
- {0x248d, 0, 0, 0, g(Yes, No, false, false, "", "6.")},
- {0x248e, 0, 0, 0, g(Yes, No, false, false, "", "7.")},
- {0x248f, 0, 0, 0, g(Yes, No, false, false, "", "8.")},
- {0x2490, 0, 0, 0, g(Yes, No, false, false, "", "9.")},
- {0x2491, 0, 0, 0, g(Yes, No, false, false, "", "10.")},
- {0x2492, 0, 0, 0, g(Yes, No, false, false, "", "11.")},
- {0x2493, 0, 0, 0, g(Yes, No, false, false, "", "12.")},
- {0x2494, 0, 0, 0, g(Yes, No, false, false, "", "13.")},
- {0x2495, 0, 0, 0, g(Yes, No, false, false, "", "14.")},
- {0x2496, 0, 0, 0, g(Yes, No, false, false, "", "15.")},
- {0x2497, 0, 0, 0, g(Yes, No, false, false, "", "16.")},
- {0x2498, 0, 0, 0, g(Yes, No, false, false, "", "17.")},
- {0x2499, 0, 0, 0, g(Yes, No, false, false, "", "18.")},
- {0x249a, 0, 0, 0, g(Yes, No, false, false, "", "19.")},
- {0x249b, 0, 0, 0, g(Yes, No, false, false, "", "20.")},
- {0x249c, 0, 0, 0, g(Yes, No, false, false, "", "(a)")},
- {0x249d, 0, 0, 0, g(Yes, No, false, false, "", "(b)")},
- {0x249e, 0, 0, 0, g(Yes, No, false, false, "", "(c)")},
- {0x249f, 0, 0, 0, g(Yes, No, false, false, "", "(d)")},
- {0x24a0, 0, 0, 0, g(Yes, No, false, false, "", "(e)")},
- {0x24a1, 0, 0, 0, g(Yes, No, false, false, "", "(f)")},
- {0x24a2, 0, 0, 0, g(Yes, No, false, false, "", "(g)")},
- {0x24a3, 0, 0, 0, g(Yes, No, false, false, "", "(h)")},
- {0x24a4, 0, 0, 0, g(Yes, No, false, false, "", "(i)")},
- {0x24a5, 0, 0, 0, g(Yes, No, false, false, "", "(j)")},
- {0x24a6, 0, 0, 0, g(Yes, No, false, false, "", "(k)")},
- {0x24a7, 0, 0, 0, g(Yes, No, false, false, "", "(l)")},
- {0x24a8, 0, 0, 0, g(Yes, No, false, false, "", "(m)")},
- {0x24a9, 0, 0, 0, g(Yes, No, false, false, "", "(n)")},
- {0x24aa, 0, 0, 0, g(Yes, No, false, false, "", "(o)")},
- {0x24ab, 0, 0, 0, g(Yes, No, false, false, "", "(p)")},
- {0x24ac, 0, 0, 0, g(Yes, No, false, false, "", "(q)")},
- {0x24ad, 0, 0, 0, g(Yes, No, false, false, "", "(r)")},
- {0x24ae, 0, 0, 0, g(Yes, No, false, false, "", "(s)")},
- {0x24af, 0, 0, 0, g(Yes, No, false, false, "", "(t)")},
- {0x24b0, 0, 0, 0, g(Yes, No, false, false, "", "(u)")},
- {0x24b1, 0, 0, 0, g(Yes, No, false, false, "", "(v)")},
- {0x24b2, 0, 0, 0, g(Yes, No, false, false, "", "(w)")},
- {0x24b3, 0, 0, 0, g(Yes, No, false, false, "", "(x)")},
- {0x24b4, 0, 0, 0, g(Yes, No, false, false, "", "(y)")},
- {0x24b5, 0, 0, 0, g(Yes, No, false, false, "", "(z)")},
- {0x24b6, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x24b7, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x24b8, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x24b9, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x24ba, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x24bb, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x24bc, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x24bd, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x24be, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x24bf, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x24c0, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x24c1, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x24c2, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x24c3, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x24c4, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x24c5, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x24c6, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x24c7, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x24c8, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x24c9, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x24ca, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x24cb, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x24cc, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x24cd, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x24ce, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x24cf, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x24d0, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x24d1, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x24d2, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x24d3, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x24d4, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x24d5, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x24d6, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x24d7, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x24d8, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x24d9, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x24da, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x24db, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x24dc, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x24dd, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x24de, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x24df, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x24e0, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x24e1, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x24e2, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x24e3, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x24e4, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x24e5, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x24e6, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x24e7, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x24e8, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x24e9, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x24ea, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x24eb, 0, 0, 0, f(Yes, false, "")},
- {0x2a0c, 0, 0, 0, g(Yes, No, false, false, "", "∫∫∫∫")},
- {0x2a0d, 0, 0, 0, f(Yes, false, "")},
- {0x2a74, 0, 0, 0, g(Yes, No, false, false, "", "::=")},
- {0x2a75, 0, 0, 0, g(Yes, No, false, false, "", "==")},
- {0x2a76, 0, 0, 0, g(Yes, No, false, false, "", "===")},
- {0x2a77, 0, 0, 0, f(Yes, false, "")},
- {0x2adc, 0, 0, 1, f(No, false, "⫝̸")},
- {0x2add, 0, 0, 0, f(Yes, false, "")},
- {0x2c7c, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x2c7d, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x2c7e, 0, 0, 0, f(Yes, false, "")},
- {0x2cef, 230, 1, 1, f(Yes, false, "")},
- {0x2cf2, 0, 0, 0, f(Yes, false, "")},
- {0x2d6f, 0, 0, 0, g(Yes, No, false, false, "", "ⵡ")},
- {0x2d70, 0, 0, 0, f(Yes, false, "")},
- {0x2d7f, 9, 1, 1, f(Yes, false, "")},
- {0x2d80, 0, 0, 0, f(Yes, false, "")},
- {0x2de0, 230, 1, 1, f(Yes, false, "")},
- {0x2e00, 0, 0, 0, f(Yes, false, "")},
- {0x2e9f, 0, 0, 0, g(Yes, No, false, false, "", "母")},
- {0x2ea0, 0, 0, 0, f(Yes, false, "")},
- {0x2ef3, 0, 0, 0, g(Yes, No, false, false, "", "龟")},
- {0x2ef4, 0, 0, 0, f(Yes, false, "")},
- {0x2f00, 0, 0, 0, g(Yes, No, false, false, "", "一")},
- {0x2f01, 0, 0, 0, g(Yes, No, false, false, "", "丨")},
- {0x2f02, 0, 0, 0, g(Yes, No, false, false, "", "丶")},
- {0x2f03, 0, 0, 0, g(Yes, No, false, false, "", "丿")},
- {0x2f04, 0, 0, 0, g(Yes, No, false, false, "", "乙")},
- {0x2f05, 0, 0, 0, g(Yes, No, false, false, "", "亅")},
- {0x2f06, 0, 0, 0, g(Yes, No, false, false, "", "二")},
- {0x2f07, 0, 0, 0, g(Yes, No, false, false, "", "亠")},
- {0x2f08, 0, 0, 0, g(Yes, No, false, false, "", "人")},
- {0x2f09, 0, 0, 0, g(Yes, No, false, false, "", "儿")},
- {0x2f0a, 0, 0, 0, g(Yes, No, false, false, "", "入")},
- {0x2f0b, 0, 0, 0, g(Yes, No, false, false, "", "八")},
- {0x2f0c, 0, 0, 0, g(Yes, No, false, false, "", "冂")},
- {0x2f0d, 0, 0, 0, g(Yes, No, false, false, "", "冖")},
- {0x2f0e, 0, 0, 0, g(Yes, No, false, false, "", "冫")},
- {0x2f0f, 0, 0, 0, g(Yes, No, false, false, "", "几")},
- {0x2f10, 0, 0, 0, g(Yes, No, false, false, "", "凵")},
- {0x2f11, 0, 0, 0, g(Yes, No, false, false, "", "刀")},
- {0x2f12, 0, 0, 0, g(Yes, No, false, false, "", "力")},
- {0x2f13, 0, 0, 0, g(Yes, No, false, false, "", "勹")},
- {0x2f14, 0, 0, 0, g(Yes, No, false, false, "", "匕")},
- {0x2f15, 0, 0, 0, g(Yes, No, false, false, "", "匚")},
- {0x2f16, 0, 0, 0, g(Yes, No, false, false, "", "匸")},
- {0x2f17, 0, 0, 0, g(Yes, No, false, false, "", "十")},
- {0x2f18, 0, 0, 0, g(Yes, No, false, false, "", "卜")},
- {0x2f19, 0, 0, 0, g(Yes, No, false, false, "", "卩")},
- {0x2f1a, 0, 0, 0, g(Yes, No, false, false, "", "厂")},
- {0x2f1b, 0, 0, 0, g(Yes, No, false, false, "", "厶")},
- {0x2f1c, 0, 0, 0, g(Yes, No, false, false, "", "又")},
- {0x2f1d, 0, 0, 0, g(Yes, No, false, false, "", "口")},
- {0x2f1e, 0, 0, 0, g(Yes, No, false, false, "", "囗")},
- {0x2f1f, 0, 0, 0, g(Yes, No, false, false, "", "土")},
- {0x2f20, 0, 0, 0, g(Yes, No, false, false, "", "士")},
- {0x2f21, 0, 0, 0, g(Yes, No, false, false, "", "夂")},
- {0x2f22, 0, 0, 0, g(Yes, No, false, false, "", "夊")},
- {0x2f23, 0, 0, 0, g(Yes, No, false, false, "", "夕")},
- {0x2f24, 0, 0, 0, g(Yes, No, false, false, "", "大")},
- {0x2f25, 0, 0, 0, g(Yes, No, false, false, "", "女")},
- {0x2f26, 0, 0, 0, g(Yes, No, false, false, "", "子")},
- {0x2f27, 0, 0, 0, g(Yes, No, false, false, "", "宀")},
- {0x2f28, 0, 0, 0, g(Yes, No, false, false, "", "寸")},
- {0x2f29, 0, 0, 0, g(Yes, No, false, false, "", "小")},
- {0x2f2a, 0, 0, 0, g(Yes, No, false, false, "", "尢")},
- {0x2f2b, 0, 0, 0, g(Yes, No, false, false, "", "尸")},
- {0x2f2c, 0, 0, 0, g(Yes, No, false, false, "", "屮")},
- {0x2f2d, 0, 0, 0, g(Yes, No, false, false, "", "山")},
- {0x2f2e, 0, 0, 0, g(Yes, No, false, false, "", "巛")},
- {0x2f2f, 0, 0, 0, g(Yes, No, false, false, "", "工")},
- {0x2f30, 0, 0, 0, g(Yes, No, false, false, "", "己")},
- {0x2f31, 0, 0, 0, g(Yes, No, false, false, "", "巾")},
- {0x2f32, 0, 0, 0, g(Yes, No, false, false, "", "干")},
- {0x2f33, 0, 0, 0, g(Yes, No, false, false, "", "幺")},
- {0x2f34, 0, 0, 0, g(Yes, No, false, false, "", "广")},
- {0x2f35, 0, 0, 0, g(Yes, No, false, false, "", "廴")},
- {0x2f36, 0, 0, 0, g(Yes, No, false, false, "", "廾")},
- {0x2f37, 0, 0, 0, g(Yes, No, false, false, "", "弋")},
- {0x2f38, 0, 0, 0, g(Yes, No, false, false, "", "弓")},
- {0x2f39, 0, 0, 0, g(Yes, No, false, false, "", "彐")},
- {0x2f3a, 0, 0, 0, g(Yes, No, false, false, "", "彡")},
- {0x2f3b, 0, 0, 0, g(Yes, No, false, false, "", "彳")},
- {0x2f3c, 0, 0, 0, g(Yes, No, false, false, "", "心")},
- {0x2f3d, 0, 0, 0, g(Yes, No, false, false, "", "戈")},
- {0x2f3e, 0, 0, 0, g(Yes, No, false, false, "", "戶")},
- {0x2f3f, 0, 0, 0, g(Yes, No, false, false, "", "手")},
- {0x2f40, 0, 0, 0, g(Yes, No, false, false, "", "支")},
- {0x2f41, 0, 0, 0, g(Yes, No, false, false, "", "攴")},
- {0x2f42, 0, 0, 0, g(Yes, No, false, false, "", "文")},
- {0x2f43, 0, 0, 0, g(Yes, No, false, false, "", "斗")},
- {0x2f44, 0, 0, 0, g(Yes, No, false, false, "", "斤")},
- {0x2f45, 0, 0, 0, g(Yes, No, false, false, "", "方")},
- {0x2f46, 0, 0, 0, g(Yes, No, false, false, "", "无")},
- {0x2f47, 0, 0, 0, g(Yes, No, false, false, "", "日")},
- {0x2f48, 0, 0, 0, g(Yes, No, false, false, "", "曰")},
- {0x2f49, 0, 0, 0, g(Yes, No, false, false, "", "月")},
- {0x2f4a, 0, 0, 0, g(Yes, No, false, false, "", "木")},
- {0x2f4b, 0, 0, 0, g(Yes, No, false, false, "", "欠")},
- {0x2f4c, 0, 0, 0, g(Yes, No, false, false, "", "止")},
- {0x2f4d, 0, 0, 0, g(Yes, No, false, false, "", "歹")},
- {0x2f4e, 0, 0, 0, g(Yes, No, false, false, "", "殳")},
- {0x2f4f, 0, 0, 0, g(Yes, No, false, false, "", "毋")},
- {0x2f50, 0, 0, 0, g(Yes, No, false, false, "", "比")},
- {0x2f51, 0, 0, 0, g(Yes, No, false, false, "", "毛")},
- {0x2f52, 0, 0, 0, g(Yes, No, false, false, "", "氏")},
- {0x2f53, 0, 0, 0, g(Yes, No, false, false, "", "气")},
- {0x2f54, 0, 0, 0, g(Yes, No, false, false, "", "水")},
- {0x2f55, 0, 0, 0, g(Yes, No, false, false, "", "火")},
- {0x2f56, 0, 0, 0, g(Yes, No, false, false, "", "爪")},
- {0x2f57, 0, 0, 0, g(Yes, No, false, false, "", "父")},
- {0x2f58, 0, 0, 0, g(Yes, No, false, false, "", "爻")},
- {0x2f59, 0, 0, 0, g(Yes, No, false, false, "", "爿")},
- {0x2f5a, 0, 0, 0, g(Yes, No, false, false, "", "片")},
- {0x2f5b, 0, 0, 0, g(Yes, No, false, false, "", "牙")},
- {0x2f5c, 0, 0, 0, g(Yes, No, false, false, "", "牛")},
- {0x2f5d, 0, 0, 0, g(Yes, No, false, false, "", "犬")},
- {0x2f5e, 0, 0, 0, g(Yes, No, false, false, "", "玄")},
- {0x2f5f, 0, 0, 0, g(Yes, No, false, false, "", "玉")},
- {0x2f60, 0, 0, 0, g(Yes, No, false, false, "", "瓜")},
- {0x2f61, 0, 0, 0, g(Yes, No, false, false, "", "瓦")},
- {0x2f62, 0, 0, 0, g(Yes, No, false, false, "", "甘")},
- {0x2f63, 0, 0, 0, g(Yes, No, false, false, "", "生")},
- {0x2f64, 0, 0, 0, g(Yes, No, false, false, "", "用")},
- {0x2f65, 0, 0, 0, g(Yes, No, false, false, "", "田")},
- {0x2f66, 0, 0, 0, g(Yes, No, false, false, "", "疋")},
- {0x2f67, 0, 0, 0, g(Yes, No, false, false, "", "疒")},
- {0x2f68, 0, 0, 0, g(Yes, No, false, false, "", "癶")},
- {0x2f69, 0, 0, 0, g(Yes, No, false, false, "", "白")},
- {0x2f6a, 0, 0, 0, g(Yes, No, false, false, "", "皮")},
- {0x2f6b, 0, 0, 0, g(Yes, No, false, false, "", "皿")},
- {0x2f6c, 0, 0, 0, g(Yes, No, false, false, "", "目")},
- {0x2f6d, 0, 0, 0, g(Yes, No, false, false, "", "矛")},
- {0x2f6e, 0, 0, 0, g(Yes, No, false, false, "", "矢")},
- {0x2f6f, 0, 0, 0, g(Yes, No, false, false, "", "石")},
- {0x2f70, 0, 0, 0, g(Yes, No, false, false, "", "示")},
- {0x2f71, 0, 0, 0, g(Yes, No, false, false, "", "禸")},
- {0x2f72, 0, 0, 0, g(Yes, No, false, false, "", "禾")},
- {0x2f73, 0, 0, 0, g(Yes, No, false, false, "", "穴")},
- {0x2f74, 0, 0, 0, g(Yes, No, false, false, "", "立")},
- {0x2f75, 0, 0, 0, g(Yes, No, false, false, "", "竹")},
- {0x2f76, 0, 0, 0, g(Yes, No, false, false, "", "米")},
- {0x2f77, 0, 0, 0, g(Yes, No, false, false, "", "糸")},
- {0x2f78, 0, 0, 0, g(Yes, No, false, false, "", "缶")},
- {0x2f79, 0, 0, 0, g(Yes, No, false, false, "", "网")},
- {0x2f7a, 0, 0, 0, g(Yes, No, false, false, "", "羊")},
- {0x2f7b, 0, 0, 0, g(Yes, No, false, false, "", "羽")},
- {0x2f7c, 0, 0, 0, g(Yes, No, false, false, "", "老")},
- {0x2f7d, 0, 0, 0, g(Yes, No, false, false, "", "而")},
- {0x2f7e, 0, 0, 0, g(Yes, No, false, false, "", "耒")},
- {0x2f7f, 0, 0, 0, g(Yes, No, false, false, "", "耳")},
- {0x2f80, 0, 0, 0, g(Yes, No, false, false, "", "聿")},
- {0x2f81, 0, 0, 0, g(Yes, No, false, false, "", "肉")},
- {0x2f82, 0, 0, 0, g(Yes, No, false, false, "", "臣")},
- {0x2f83, 0, 0, 0, g(Yes, No, false, false, "", "自")},
- {0x2f84, 0, 0, 0, g(Yes, No, false, false, "", "至")},
- {0x2f85, 0, 0, 0, g(Yes, No, false, false, "", "臼")},
- {0x2f86, 0, 0, 0, g(Yes, No, false, false, "", "舌")},
- {0x2f87, 0, 0, 0, g(Yes, No, false, false, "", "舛")},
- {0x2f88, 0, 0, 0, g(Yes, No, false, false, "", "舟")},
- {0x2f89, 0, 0, 0, g(Yes, No, false, false, "", "艮")},
- {0x2f8a, 0, 0, 0, g(Yes, No, false, false, "", "色")},
- {0x2f8b, 0, 0, 0, g(Yes, No, false, false, "", "艸")},
- {0x2f8c, 0, 0, 0, g(Yes, No, false, false, "", "虍")},
- {0x2f8d, 0, 0, 0, g(Yes, No, false, false, "", "虫")},
- {0x2f8e, 0, 0, 0, g(Yes, No, false, false, "", "血")},
- {0x2f8f, 0, 0, 0, g(Yes, No, false, false, "", "行")},
- {0x2f90, 0, 0, 0, g(Yes, No, false, false, "", "衣")},
- {0x2f91, 0, 0, 0, g(Yes, No, false, false, "", "襾")},
- {0x2f92, 0, 0, 0, g(Yes, No, false, false, "", "見")},
- {0x2f93, 0, 0, 0, g(Yes, No, false, false, "", "角")},
- {0x2f94, 0, 0, 0, g(Yes, No, false, false, "", "言")},
- {0x2f95, 0, 0, 0, g(Yes, No, false, false, "", "谷")},
- {0x2f96, 0, 0, 0, g(Yes, No, false, false, "", "豆")},
- {0x2f97, 0, 0, 0, g(Yes, No, false, false, "", "豕")},
- {0x2f98, 0, 0, 0, g(Yes, No, false, false, "", "豸")},
- {0x2f99, 0, 0, 0, g(Yes, No, false, false, "", "貝")},
- {0x2f9a, 0, 0, 0, g(Yes, No, false, false, "", "赤")},
- {0x2f9b, 0, 0, 0, g(Yes, No, false, false, "", "走")},
- {0x2f9c, 0, 0, 0, g(Yes, No, false, false, "", "足")},
- {0x2f9d, 0, 0, 0, g(Yes, No, false, false, "", "身")},
- {0x2f9e, 0, 0, 0, g(Yes, No, false, false, "", "車")},
- {0x2f9f, 0, 0, 0, g(Yes, No, false, false, "", "辛")},
- {0x2fa0, 0, 0, 0, g(Yes, No, false, false, "", "辰")},
- {0x2fa1, 0, 0, 0, g(Yes, No, false, false, "", "辵")},
- {0x2fa2, 0, 0, 0, g(Yes, No, false, false, "", "邑")},
- {0x2fa3, 0, 0, 0, g(Yes, No, false, false, "", "酉")},
- {0x2fa4, 0, 0, 0, g(Yes, No, false, false, "", "釆")},
- {0x2fa5, 0, 0, 0, g(Yes, No, false, false, "", "里")},
- {0x2fa6, 0, 0, 0, g(Yes, No, false, false, "", "金")},
- {0x2fa7, 0, 0, 0, g(Yes, No, false, false, "", "長")},
- {0x2fa8, 0, 0, 0, g(Yes, No, false, false, "", "門")},
- {0x2fa9, 0, 0, 0, g(Yes, No, false, false, "", "阜")},
- {0x2faa, 0, 0, 0, g(Yes, No, false, false, "", "隶")},
- {0x2fab, 0, 0, 0, g(Yes, No, false, false, "", "隹")},
- {0x2fac, 0, 0, 0, g(Yes, No, false, false, "", "雨")},
- {0x2fad, 0, 0, 0, g(Yes, No, false, false, "", "靑")},
- {0x2fae, 0, 0, 0, g(Yes, No, false, false, "", "非")},
- {0x2faf, 0, 0, 0, g(Yes, No, false, false, "", "面")},
- {0x2fb0, 0, 0, 0, g(Yes, No, false, false, "", "革")},
- {0x2fb1, 0, 0, 0, g(Yes, No, false, false, "", "韋")},
- {0x2fb2, 0, 0, 0, g(Yes, No, false, false, "", "韭")},
- {0x2fb3, 0, 0, 0, g(Yes, No, false, false, "", "音")},
- {0x2fb4, 0, 0, 0, g(Yes, No, false, false, "", "頁")},
- {0x2fb5, 0, 0, 0, g(Yes, No, false, false, "", "風")},
- {0x2fb6, 0, 0, 0, g(Yes, No, false, false, "", "飛")},
- {0x2fb7, 0, 0, 0, g(Yes, No, false, false, "", "食")},
- {0x2fb8, 0, 0, 0, g(Yes, No, false, false, "", "首")},
- {0x2fb9, 0, 0, 0, g(Yes, No, false, false, "", "香")},
- {0x2fba, 0, 0, 0, g(Yes, No, false, false, "", "馬")},
- {0x2fbb, 0, 0, 0, g(Yes, No, false, false, "", "骨")},
- {0x2fbc, 0, 0, 0, g(Yes, No, false, false, "", "高")},
- {0x2fbd, 0, 0, 0, g(Yes, No, false, false, "", "髟")},
- {0x2fbe, 0, 0, 0, g(Yes, No, false, false, "", "鬥")},
- {0x2fbf, 0, 0, 0, g(Yes, No, false, false, "", "鬯")},
- {0x2fc0, 0, 0, 0, g(Yes, No, false, false, "", "鬲")},
- {0x2fc1, 0, 0, 0, g(Yes, No, false, false, "", "鬼")},
- {0x2fc2, 0, 0, 0, g(Yes, No, false, false, "", "魚")},
- {0x2fc3, 0, 0, 0, g(Yes, No, false, false, "", "鳥")},
- {0x2fc4, 0, 0, 0, g(Yes, No, false, false, "", "鹵")},
- {0x2fc5, 0, 0, 0, g(Yes, No, false, false, "", "鹿")},
- {0x2fc6, 0, 0, 0, g(Yes, No, false, false, "", "麥")},
- {0x2fc7, 0, 0, 0, g(Yes, No, false, false, "", "麻")},
- {0x2fc8, 0, 0, 0, g(Yes, No, false, false, "", "黃")},
- {0x2fc9, 0, 0, 0, g(Yes, No, false, false, "", "黍")},
- {0x2fca, 0, 0, 0, g(Yes, No, false, false, "", "黑")},
- {0x2fcb, 0, 0, 0, g(Yes, No, false, false, "", "黹")},
- {0x2fcc, 0, 0, 0, g(Yes, No, false, false, "", "黽")},
- {0x2fcd, 0, 0, 0, g(Yes, No, false, false, "", "鼎")},
- {0x2fce, 0, 0, 0, g(Yes, No, false, false, "", "鼓")},
- {0x2fcf, 0, 0, 0, g(Yes, No, false, false, "", "鼠")},
- {0x2fd0, 0, 0, 0, g(Yes, No, false, false, "", "鼻")},
- {0x2fd1, 0, 0, 0, g(Yes, No, false, false, "", "齊")},
- {0x2fd2, 0, 0, 0, g(Yes, No, false, false, "", "齒")},
- {0x2fd3, 0, 0, 0, g(Yes, No, false, false, "", "龍")},
- {0x2fd4, 0, 0, 0, g(Yes, No, false, false, "", "龜")},
- {0x2fd5, 0, 0, 0, g(Yes, No, false, false, "", "龠")},
- {0x2fd6, 0, 0, 0, f(Yes, false, "")},
- {0x3000, 0, 0, 0, g(Yes, No, false, false, "", " ")},
- {0x3001, 0, 0, 0, f(Yes, false, "")},
- {0x302a, 218, 1, 1, f(Yes, false, "")},
- {0x302b, 228, 1, 1, f(Yes, false, "")},
- {0x302c, 232, 1, 1, f(Yes, false, "")},
- {0x302d, 222, 1, 1, f(Yes, false, "")},
- {0x302e, 224, 1, 1, f(Yes, false, "")},
- {0x3030, 0, 0, 0, f(Yes, false, "")},
- {0x3036, 0, 0, 0, g(Yes, No, false, false, "", "〒")},
- {0x3037, 0, 0, 0, f(Yes, false, "")},
- {0x3038, 0, 0, 0, g(Yes, No, false, false, "", "十")},
- {0x3039, 0, 0, 0, g(Yes, No, false, false, "", "卄")},
- {0x303a, 0, 0, 0, g(Yes, No, false, false, "", "卅")},
- {0x303b, 0, 0, 0, f(Yes, false, "")},
- {0x3046, 0, 0, 0, f(Yes, true, "")},
- {0x3047, 0, 0, 0, f(Yes, false, "")},
- {0x304b, 0, 0, 0, f(Yes, true, "")},
- {0x304c, 0, 0, 1, f(Yes, false, "が")},
- {0x304d, 0, 0, 0, f(Yes, true, "")},
- {0x304e, 0, 0, 1, f(Yes, false, "ぎ")},
- {0x304f, 0, 0, 0, f(Yes, true, "")},
- {0x3050, 0, 0, 1, f(Yes, false, "ぐ")},
- {0x3051, 0, 0, 0, f(Yes, true, "")},
- {0x3052, 0, 0, 1, f(Yes, false, "げ")},
- {0x3053, 0, 0, 0, f(Yes, true, "")},
- {0x3054, 0, 0, 1, f(Yes, false, "ご")},
- {0x3055, 0, 0, 0, f(Yes, true, "")},
- {0x3056, 0, 0, 1, f(Yes, false, "ざ")},
- {0x3057, 0, 0, 0, f(Yes, true, "")},
- {0x3058, 0, 0, 1, f(Yes, false, "じ")},
- {0x3059, 0, 0, 0, f(Yes, true, "")},
- {0x305a, 0, 0, 1, f(Yes, false, "ず")},
- {0x305b, 0, 0, 0, f(Yes, true, "")},
- {0x305c, 0, 0, 1, f(Yes, false, "ぜ")},
- {0x305d, 0, 0, 0, f(Yes, true, "")},
- {0x305e, 0, 0, 1, f(Yes, false, "ぞ")},
- {0x305f, 0, 0, 0, f(Yes, true, "")},
- {0x3060, 0, 0, 1, f(Yes, false, "だ")},
- {0x3061, 0, 0, 0, f(Yes, true, "")},
- {0x3062, 0, 0, 1, f(Yes, false, "ぢ")},
- {0x3063, 0, 0, 0, f(Yes, false, "")},
- {0x3064, 0, 0, 0, f(Yes, true, "")},
- {0x3065, 0, 0, 1, f(Yes, false, "づ")},
- {0x3066, 0, 0, 0, f(Yes, true, "")},
- {0x3067, 0, 0, 1, f(Yes, false, "で")},
- {0x3068, 0, 0, 0, f(Yes, true, "")},
- {0x3069, 0, 0, 1, f(Yes, false, "ど")},
- {0x306a, 0, 0, 0, f(Yes, false, "")},
- {0x306f, 0, 0, 0, f(Yes, true, "")},
- {0x3070, 0, 0, 1, f(Yes, false, "ば")},
- {0x3071, 0, 0, 1, f(Yes, false, "ぱ")},
- {0x3072, 0, 0, 0, f(Yes, true, "")},
- {0x3073, 0, 0, 1, f(Yes, false, "び")},
- {0x3074, 0, 0, 1, f(Yes, false, "ぴ")},
- {0x3075, 0, 0, 0, f(Yes, true, "")},
- {0x3076, 0, 0, 1, f(Yes, false, "ぶ")},
- {0x3077, 0, 0, 1, f(Yes, false, "ぷ")},
- {0x3078, 0, 0, 0, f(Yes, true, "")},
- {0x3079, 0, 0, 1, f(Yes, false, "べ")},
- {0x307a, 0, 0, 1, f(Yes, false, "ぺ")},
- {0x307b, 0, 0, 0, f(Yes, true, "")},
- {0x307c, 0, 0, 1, f(Yes, false, "ぼ")},
- {0x307d, 0, 0, 1, f(Yes, false, "ぽ")},
- {0x307e, 0, 0, 0, f(Yes, false, "")},
- {0x3094, 0, 0, 1, f(Yes, false, "ゔ")},
- {0x3095, 0, 0, 0, f(Yes, false, "")},
- {0x3099, 8, 1, 1, f(Maybe, false, "")},
- {0x309b, 0, 0, 1, g(Yes, No, false, false, "", " ゙")},
- {0x309c, 0, 0, 1, g(Yes, No, false, false, "", " ゚")},
- {0x309d, 0, 0, 0, f(Yes, true, "")},
- {0x309e, 0, 0, 1, f(Yes, false, "ゞ")},
- {0x309f, 0, 0, 0, g(Yes, No, false, false, "", "より")},
- {0x30a0, 0, 0, 0, f(Yes, false, "")},
- {0x30a6, 0, 0, 0, f(Yes, true, "")},
- {0x30a7, 0, 0, 0, f(Yes, false, "")},
- {0x30ab, 0, 0, 0, f(Yes, true, "")},
- {0x30ac, 0, 0, 1, f(Yes, false, "ガ")},
- {0x30ad, 0, 0, 0, f(Yes, true, "")},
- {0x30ae, 0, 0, 1, f(Yes, false, "ギ")},
- {0x30af, 0, 0, 0, f(Yes, true, "")},
- {0x30b0, 0, 0, 1, f(Yes, false, "グ")},
- {0x30b1, 0, 0, 0, f(Yes, true, "")},
- {0x30b2, 0, 0, 1, f(Yes, false, "ゲ")},
- {0x30b3, 0, 0, 0, f(Yes, true, "")},
- {0x30b4, 0, 0, 1, f(Yes, false, "ゴ")},
- {0x30b5, 0, 0, 0, f(Yes, true, "")},
- {0x30b6, 0, 0, 1, f(Yes, false, "ザ")},
- {0x30b7, 0, 0, 0, f(Yes, true, "")},
- {0x30b8, 0, 0, 1, f(Yes, false, "ジ")},
- {0x30b9, 0, 0, 0, f(Yes, true, "")},
- {0x30ba, 0, 0, 1, f(Yes, false, "ズ")},
- {0x30bb, 0, 0, 0, f(Yes, true, "")},
- {0x30bc, 0, 0, 1, f(Yes, false, "ゼ")},
- {0x30bd, 0, 0, 0, f(Yes, true, "")},
- {0x30be, 0, 0, 1, f(Yes, false, "ゾ")},
- {0x30bf, 0, 0, 0, f(Yes, true, "")},
- {0x30c0, 0, 0, 1, f(Yes, false, "ダ")},
- {0x30c1, 0, 0, 0, f(Yes, true, "")},
- {0x30c2, 0, 0, 1, f(Yes, false, "ヂ")},
- {0x30c3, 0, 0, 0, f(Yes, false, "")},
- {0x30c4, 0, 0, 0, f(Yes, true, "")},
- {0x30c5, 0, 0, 1, f(Yes, false, "ヅ")},
- {0x30c6, 0, 0, 0, f(Yes, true, "")},
- {0x30c7, 0, 0, 1, f(Yes, false, "デ")},
- {0x30c8, 0, 0, 0, f(Yes, true, "")},
- {0x30c9, 0, 0, 1, f(Yes, false, "ド")},
- {0x30ca, 0, 0, 0, f(Yes, false, "")},
- {0x30cf, 0, 0, 0, f(Yes, true, "")},
- {0x30d0, 0, 0, 1, f(Yes, false, "バ")},
- {0x30d1, 0, 0, 1, f(Yes, false, "パ")},
- {0x30d2, 0, 0, 0, f(Yes, true, "")},
- {0x30d3, 0, 0, 1, f(Yes, false, "ビ")},
- {0x30d4, 0, 0, 1, f(Yes, false, "ピ")},
- {0x30d5, 0, 0, 0, f(Yes, true, "")},
- {0x30d6, 0, 0, 1, f(Yes, false, "ブ")},
- {0x30d7, 0, 0, 1, f(Yes, false, "プ")},
- {0x30d8, 0, 0, 0, f(Yes, true, "")},
- {0x30d9, 0, 0, 1, f(Yes, false, "ベ")},
- {0x30da, 0, 0, 1, f(Yes, false, "ペ")},
- {0x30db, 0, 0, 0, f(Yes, true, "")},
- {0x30dc, 0, 0, 1, f(Yes, false, "ボ")},
- {0x30dd, 0, 0, 1, f(Yes, false, "ポ")},
- {0x30de, 0, 0, 0, f(Yes, false, "")},
- {0x30ef, 0, 0, 0, f(Yes, true, "")},
- {0x30f3, 0, 0, 0, f(Yes, false, "")},
- {0x30f4, 0, 0, 1, f(Yes, false, "ヴ")},
- {0x30f5, 0, 0, 0, f(Yes, false, "")},
- {0x30f7, 0, 0, 1, f(Yes, false, "ヷ")},
- {0x30f8, 0, 0, 1, f(Yes, false, "ヸ")},
- {0x30f9, 0, 0, 1, f(Yes, false, "ヹ")},
- {0x30fa, 0, 0, 1, f(Yes, false, "ヺ")},
- {0x30fb, 0, 0, 0, f(Yes, false, "")},
- {0x30fd, 0, 0, 0, f(Yes, true, "")},
- {0x30fe, 0, 0, 1, f(Yes, false, "ヾ")},
- {0x30ff, 0, 0, 0, g(Yes, No, false, false, "", "コト")},
- {0x3100, 0, 0, 0, f(Yes, false, "")},
- {0x3131, 0, 0, 0, g(Yes, No, false, false, "", "ᄀ")},
- {0x3132, 0, 0, 0, g(Yes, No, false, false, "", "ᄁ")},
- {0x3133, 0, 1, 1, g(Yes, No, false, false, "", "ᆪ")},
- {0x3134, 0, 0, 0, g(Yes, No, false, false, "", "ᄂ")},
- {0x3135, 0, 1, 1, g(Yes, No, false, false, "", "ᆬ")},
- {0x3136, 0, 1, 1, g(Yes, No, false, false, "", "ᆭ")},
- {0x3137, 0, 0, 0, g(Yes, No, false, false, "", "ᄃ")},
- {0x3138, 0, 0, 0, g(Yes, No, false, false, "", "ᄄ")},
- {0x3139, 0, 0, 0, g(Yes, No, false, false, "", "ᄅ")},
- {0x313a, 0, 1, 1, g(Yes, No, false, false, "", "ᆰ")},
- {0x313b, 0, 1, 1, g(Yes, No, false, false, "", "ᆱ")},
- {0x313c, 0, 1, 1, g(Yes, No, false, false, "", "ᆲ")},
- {0x313d, 0, 1, 1, g(Yes, No, false, false, "", "ᆳ")},
- {0x313e, 0, 1, 1, g(Yes, No, false, false, "", "ᆴ")},
- {0x313f, 0, 1, 1, g(Yes, No, false, false, "", "ᆵ")},
- {0x3140, 0, 0, 0, g(Yes, No, false, false, "", "ᄚ")},
- {0x3141, 0, 0, 0, g(Yes, No, false, false, "", "ᄆ")},
- {0x3142, 0, 0, 0, g(Yes, No, false, false, "", "ᄇ")},
- {0x3143, 0, 0, 0, g(Yes, No, false, false, "", "ᄈ")},
- {0x3144, 0, 0, 0, g(Yes, No, false, false, "", "ᄡ")},
- {0x3145, 0, 0, 0, g(Yes, No, false, false, "", "ᄉ")},
- {0x3146, 0, 0, 0, g(Yes, No, false, false, "", "ᄊ")},
- {0x3147, 0, 0, 0, g(Yes, No, false, false, "", "ᄋ")},
- {0x3148, 0, 0, 0, g(Yes, No, false, false, "", "ᄌ")},
- {0x3149, 0, 0, 0, g(Yes, No, false, false, "", "ᄍ")},
- {0x314a, 0, 0, 0, g(Yes, No, false, false, "", "ᄎ")},
- {0x314b, 0, 0, 0, g(Yes, No, false, false, "", "ᄏ")},
- {0x314c, 0, 0, 0, g(Yes, No, false, false, "", "ᄐ")},
- {0x314d, 0, 0, 0, g(Yes, No, false, false, "", "ᄑ")},
- {0x314e, 0, 0, 0, g(Yes, No, false, false, "", "ᄒ")},
- {0x314f, 0, 1, 1, g(Yes, No, false, false, "", "ᅡ")},
- {0x3150, 0, 1, 1, g(Yes, No, false, false, "", "ᅢ")},
- {0x3151, 0, 1, 1, g(Yes, No, false, false, "", "ᅣ")},
- {0x3152, 0, 1, 1, g(Yes, No, false, false, "", "ᅤ")},
- {0x3153, 0, 1, 1, g(Yes, No, false, false, "", "ᅥ")},
- {0x3154, 0, 1, 1, g(Yes, No, false, false, "", "ᅦ")},
- {0x3155, 0, 1, 1, g(Yes, No, false, false, "", "ᅧ")},
- {0x3156, 0, 1, 1, g(Yes, No, false, false, "", "ᅨ")},
- {0x3157, 0, 1, 1, g(Yes, No, false, false, "", "ᅩ")},
- {0x3158, 0, 1, 1, g(Yes, No, false, false, "", "ᅪ")},
- {0x3159, 0, 1, 1, g(Yes, No, false, false, "", "ᅫ")},
- {0x315a, 0, 1, 1, g(Yes, No, false, false, "", "ᅬ")},
- {0x315b, 0, 1, 1, g(Yes, No, false, false, "", "ᅭ")},
- {0x315c, 0, 1, 1, g(Yes, No, false, false, "", "ᅮ")},
- {0x315d, 0, 1, 1, g(Yes, No, false, false, "", "ᅯ")},
- {0x315e, 0, 1, 1, g(Yes, No, false, false, "", "ᅰ")},
- {0x315f, 0, 1, 1, g(Yes, No, false, false, "", "ᅱ")},
- {0x3160, 0, 1, 1, g(Yes, No, false, false, "", "ᅲ")},
- {0x3161, 0, 1, 1, g(Yes, No, false, false, "", "ᅳ")},
- {0x3162, 0, 1, 1, g(Yes, No, false, false, "", "ᅴ")},
- {0x3163, 0, 1, 1, g(Yes, No, false, false, "", "ᅵ")},
- {0x3164, 0, 0, 0, g(Yes, No, false, false, "", "ᅠ")},
- {0x3165, 0, 0, 0, g(Yes, No, false, false, "", "ᄔ")},
- {0x3166, 0, 0, 0, g(Yes, No, false, false, "", "ᄕ")},
- {0x3167, 0, 0, 0, g(Yes, No, false, false, "", "ᇇ")},
- {0x3168, 0, 0, 0, g(Yes, No, false, false, "", "ᇈ")},
- {0x3169, 0, 0, 0, g(Yes, No, false, false, "", "ᇌ")},
- {0x316a, 0, 0, 0, g(Yes, No, false, false, "", "ᇎ")},
- {0x316b, 0, 0, 0, g(Yes, No, false, false, "", "ᇓ")},
- {0x316c, 0, 0, 0, g(Yes, No, false, false, "", "ᇗ")},
- {0x316d, 0, 0, 0, g(Yes, No, false, false, "", "ᇙ")},
- {0x316e, 0, 0, 0, g(Yes, No, false, false, "", "ᄜ")},
- {0x316f, 0, 0, 0, g(Yes, No, false, false, "", "ᇝ")},
- {0x3170, 0, 0, 0, g(Yes, No, false, false, "", "ᇟ")},
- {0x3171, 0, 0, 0, g(Yes, No, false, false, "", "ᄝ")},
- {0x3172, 0, 0, 0, g(Yes, No, false, false, "", "ᄞ")},
- {0x3173, 0, 0, 0, g(Yes, No, false, false, "", "ᄠ")},
- {0x3174, 0, 0, 0, g(Yes, No, false, false, "", "ᄢ")},
- {0x3175, 0, 0, 0, g(Yes, No, false, false, "", "ᄣ")},
- {0x3176, 0, 0, 0, g(Yes, No, false, false, "", "ᄧ")},
- {0x3177, 0, 0, 0, g(Yes, No, false, false, "", "ᄩ")},
- {0x3178, 0, 0, 0, g(Yes, No, false, false, "", "ᄫ")},
- {0x3179, 0, 0, 0, g(Yes, No, false, false, "", "ᄬ")},
- {0x317a, 0, 0, 0, g(Yes, No, false, false, "", "ᄭ")},
- {0x317b, 0, 0, 0, g(Yes, No, false, false, "", "ᄮ")},
- {0x317c, 0, 0, 0, g(Yes, No, false, false, "", "ᄯ")},
- {0x317d, 0, 0, 0, g(Yes, No, false, false, "", "ᄲ")},
- {0x317e, 0, 0, 0, g(Yes, No, false, false, "", "ᄶ")},
- {0x317f, 0, 0, 0, g(Yes, No, false, false, "", "ᅀ")},
- {0x3180, 0, 0, 0, g(Yes, No, false, false, "", "ᅇ")},
- {0x3181, 0, 0, 0, g(Yes, No, false, false, "", "ᅌ")},
- {0x3182, 0, 0, 0, g(Yes, No, false, false, "", "ᇱ")},
- {0x3183, 0, 0, 0, g(Yes, No, false, false, "", "ᇲ")},
- {0x3184, 0, 0, 0, g(Yes, No, false, false, "", "ᅗ")},
- {0x3185, 0, 0, 0, g(Yes, No, false, false, "", "ᅘ")},
- {0x3186, 0, 0, 0, g(Yes, No, false, false, "", "ᅙ")},
- {0x3187, 0, 0, 0, g(Yes, No, false, false, "", "ᆄ")},
- {0x3188, 0, 0, 0, g(Yes, No, false, false, "", "ᆅ")},
- {0x3189, 0, 0, 0, g(Yes, No, false, false, "", "ᆈ")},
- {0x318a, 0, 0, 0, g(Yes, No, false, false, "", "ᆑ")},
- {0x318b, 0, 0, 0, g(Yes, No, false, false, "", "ᆒ")},
- {0x318c, 0, 0, 0, g(Yes, No, false, false, "", "ᆔ")},
- {0x318d, 0, 0, 0, g(Yes, No, false, false, "", "ᆞ")},
- {0x318e, 0, 0, 0, g(Yes, No, false, false, "", "ᆡ")},
- {0x318f, 0, 0, 0, f(Yes, false, "")},
- {0x3192, 0, 0, 0, g(Yes, No, false, false, "", "一")},
- {0x3193, 0, 0, 0, g(Yes, No, false, false, "", "二")},
- {0x3194, 0, 0, 0, g(Yes, No, false, false, "", "三")},
- {0x3195, 0, 0, 0, g(Yes, No, false, false, "", "四")},
- {0x3196, 0, 0, 0, g(Yes, No, false, false, "", "上")},
- {0x3197, 0, 0, 0, g(Yes, No, false, false, "", "中")},
- {0x3198, 0, 0, 0, g(Yes, No, false, false, "", "下")},
- {0x3199, 0, 0, 0, g(Yes, No, false, false, "", "甲")},
- {0x319a, 0, 0, 0, g(Yes, No, false, false, "", "乙")},
- {0x319b, 0, 0, 0, g(Yes, No, false, false, "", "丙")},
- {0x319c, 0, 0, 0, g(Yes, No, false, false, "", "丁")},
- {0x319d, 0, 0, 0, g(Yes, No, false, false, "", "天")},
- {0x319e, 0, 0, 0, g(Yes, No, false, false, "", "地")},
- {0x319f, 0, 0, 0, g(Yes, No, false, false, "", "人")},
- {0x31a0, 0, 0, 0, f(Yes, false, "")},
- {0x3200, 0, 0, 0, g(Yes, No, false, false, "", "(ᄀ)")},
- {0x3201, 0, 0, 0, g(Yes, No, false, false, "", "(ᄂ)")},
- {0x3202, 0, 0, 0, g(Yes, No, false, false, "", "(ᄃ)")},
- {0x3203, 0, 0, 0, g(Yes, No, false, false, "", "(ᄅ)")},
- {0x3204, 0, 0, 0, g(Yes, No, false, false, "", "(ᄆ)")},
- {0x3205, 0, 0, 0, g(Yes, No, false, false, "", "(ᄇ)")},
- {0x3206, 0, 0, 0, g(Yes, No, false, false, "", "(ᄉ)")},
- {0x3207, 0, 0, 0, g(Yes, No, false, false, "", "(ᄋ)")},
- {0x3208, 0, 0, 0, g(Yes, No, false, false, "", "(ᄌ)")},
- {0x3209, 0, 0, 0, g(Yes, No, false, false, "", "(ᄎ)")},
- {0x320a, 0, 0, 0, g(Yes, No, false, false, "", "(ᄏ)")},
- {0x320b, 0, 0, 0, g(Yes, No, false, false, "", "(ᄐ)")},
- {0x320c, 0, 0, 0, g(Yes, No, false, false, "", "(ᄑ)")},
- {0x320d, 0, 0, 0, g(Yes, No, false, false, "", "(ᄒ)")},
- {0x320e, 0, 0, 0, g(Yes, No, false, false, "", "(가)")},
- {0x320f, 0, 0, 0, g(Yes, No, false, false, "", "(나)")},
- {0x3210, 0, 0, 0, g(Yes, No, false, false, "", "(다)")},
- {0x3211, 0, 0, 0, g(Yes, No, false, false, "", "(라)")},
- {0x3212, 0, 0, 0, g(Yes, No, false, false, "", "(마)")},
- {0x3213, 0, 0, 0, g(Yes, No, false, false, "", "(바)")},
- {0x3214, 0, 0, 0, g(Yes, No, false, false, "", "(사)")},
- {0x3215, 0, 0, 0, g(Yes, No, false, false, "", "(아)")},
- {0x3216, 0, 0, 0, g(Yes, No, false, false, "", "(자)")},
- {0x3217, 0, 0, 0, g(Yes, No, false, false, "", "(차)")},
- {0x3218, 0, 0, 0, g(Yes, No, false, false, "", "(카)")},
- {0x3219, 0, 0, 0, g(Yes, No, false, false, "", "(타)")},
- {0x321a, 0, 0, 0, g(Yes, No, false, false, "", "(파)")},
- {0x321b, 0, 0, 0, g(Yes, No, false, false, "", "(하)")},
- {0x321c, 0, 0, 0, g(Yes, No, false, false, "", "(주)")},
- {0x321d, 0, 0, 0, g(Yes, No, false, false, "", "(오전)")},
- {0x321e, 0, 0, 0, g(Yes, No, false, false, "", "(오후)")},
- {0x321f, 0, 0, 0, f(Yes, false, "")},
- {0x3220, 0, 0, 0, g(Yes, No, false, false, "", "(一)")},
- {0x3221, 0, 0, 0, g(Yes, No, false, false, "", "(二)")},
- {0x3222, 0, 0, 0, g(Yes, No, false, false, "", "(三)")},
- {0x3223, 0, 0, 0, g(Yes, No, false, false, "", "(四)")},
- {0x3224, 0, 0, 0, g(Yes, No, false, false, "", "(五)")},
- {0x3225, 0, 0, 0, g(Yes, No, false, false, "", "(六)")},
- {0x3226, 0, 0, 0, g(Yes, No, false, false, "", "(七)")},
- {0x3227, 0, 0, 0, g(Yes, No, false, false, "", "(八)")},
- {0x3228, 0, 0, 0, g(Yes, No, false, false, "", "(九)")},
- {0x3229, 0, 0, 0, g(Yes, No, false, false, "", "(十)")},
- {0x322a, 0, 0, 0, g(Yes, No, false, false, "", "(月)")},
- {0x322b, 0, 0, 0, g(Yes, No, false, false, "", "(火)")},
- {0x322c, 0, 0, 0, g(Yes, No, false, false, "", "(水)")},
- {0x322d, 0, 0, 0, g(Yes, No, false, false, "", "(木)")},
- {0x322e, 0, 0, 0, g(Yes, No, false, false, "", "(金)")},
- {0x322f, 0, 0, 0, g(Yes, No, false, false, "", "(土)")},
- {0x3230, 0, 0, 0, g(Yes, No, false, false, "", "(日)")},
- {0x3231, 0, 0, 0, g(Yes, No, false, false, "", "(株)")},
- {0x3232, 0, 0, 0, g(Yes, No, false, false, "", "(有)")},
- {0x3233, 0, 0, 0, g(Yes, No, false, false, "", "(社)")},
- {0x3234, 0, 0, 0, g(Yes, No, false, false, "", "(名)")},
- {0x3235, 0, 0, 0, g(Yes, No, false, false, "", "(特)")},
- {0x3236, 0, 0, 0, g(Yes, No, false, false, "", "(財)")},
- {0x3237, 0, 0, 0, g(Yes, No, false, false, "", "(祝)")},
- {0x3238, 0, 0, 0, g(Yes, No, false, false, "", "(労)")},
- {0x3239, 0, 0, 0, g(Yes, No, false, false, "", "(代)")},
- {0x323a, 0, 0, 0, g(Yes, No, false, false, "", "(呼)")},
- {0x323b, 0, 0, 0, g(Yes, No, false, false, "", "(学)")},
- {0x323c, 0, 0, 0, g(Yes, No, false, false, "", "(監)")},
- {0x323d, 0, 0, 0, g(Yes, No, false, false, "", "(企)")},
- {0x323e, 0, 0, 0, g(Yes, No, false, false, "", "(資)")},
- {0x323f, 0, 0, 0, g(Yes, No, false, false, "", "(協)")},
- {0x3240, 0, 0, 0, g(Yes, No, false, false, "", "(祭)")},
- {0x3241, 0, 0, 0, g(Yes, No, false, false, "", "(休)")},
- {0x3242, 0, 0, 0, g(Yes, No, false, false, "", "(自)")},
- {0x3243, 0, 0, 0, g(Yes, No, false, false, "", "(至)")},
- {0x3244, 0, 0, 0, g(Yes, No, false, false, "", "問")},
- {0x3245, 0, 0, 0, g(Yes, No, false, false, "", "幼")},
- {0x3246, 0, 0, 0, g(Yes, No, false, false, "", "文")},
- {0x3247, 0, 0, 0, g(Yes, No, false, false, "", "箏")},
- {0x3248, 0, 0, 0, f(Yes, false, "")},
- {0x3250, 0, 0, 0, g(Yes, No, false, false, "", "PTE")},
- {0x3251, 0, 0, 0, g(Yes, No, false, false, "", "21")},
- {0x3252, 0, 0, 0, g(Yes, No, false, false, "", "22")},
- {0x3253, 0, 0, 0, g(Yes, No, false, false, "", "23")},
- {0x3254, 0, 0, 0, g(Yes, No, false, false, "", "24")},
- {0x3255, 0, 0, 0, g(Yes, No, false, false, "", "25")},
- {0x3256, 0, 0, 0, g(Yes, No, false, false, "", "26")},
- {0x3257, 0, 0, 0, g(Yes, No, false, false, "", "27")},
- {0x3258, 0, 0, 0, g(Yes, No, false, false, "", "28")},
- {0x3259, 0, 0, 0, g(Yes, No, false, false, "", "29")},
- {0x325a, 0, 0, 0, g(Yes, No, false, false, "", "30")},
- {0x325b, 0, 0, 0, g(Yes, No, false, false, "", "31")},
- {0x325c, 0, 0, 0, g(Yes, No, false, false, "", "32")},
- {0x325d, 0, 0, 0, g(Yes, No, false, false, "", "33")},
- {0x325e, 0, 0, 0, g(Yes, No, false, false, "", "34")},
- {0x325f, 0, 0, 0, g(Yes, No, false, false, "", "35")},
- {0x3260, 0, 0, 0, g(Yes, No, false, false, "", "ᄀ")},
- {0x3261, 0, 0, 0, g(Yes, No, false, false, "", "ᄂ")},
- {0x3262, 0, 0, 0, g(Yes, No, false, false, "", "ᄃ")},
- {0x3263, 0, 0, 0, g(Yes, No, false, false, "", "ᄅ")},
- {0x3264, 0, 0, 0, g(Yes, No, false, false, "", "ᄆ")},
- {0x3265, 0, 0, 0, g(Yes, No, false, false, "", "ᄇ")},
- {0x3266, 0, 0, 0, g(Yes, No, false, false, "", "ᄉ")},
- {0x3267, 0, 0, 0, g(Yes, No, false, false, "", "ᄋ")},
- {0x3268, 0, 0, 0, g(Yes, No, false, false, "", "ᄌ")},
- {0x3269, 0, 0, 0, g(Yes, No, false, false, "", "ᄎ")},
- {0x326a, 0, 0, 0, g(Yes, No, false, false, "", "ᄏ")},
- {0x326b, 0, 0, 0, g(Yes, No, false, false, "", "ᄐ")},
- {0x326c, 0, 0, 0, g(Yes, No, false, false, "", "ᄑ")},
- {0x326d, 0, 0, 0, g(Yes, No, false, false, "", "ᄒ")},
- {0x326e, 0, 0, 1, g(Yes, No, false, false, "", "가")},
- {0x326f, 0, 0, 1, g(Yes, No, false, false, "", "나")},
- {0x3270, 0, 0, 1, g(Yes, No, false, false, "", "다")},
- {0x3271, 0, 0, 1, g(Yes, No, false, false, "", "라")},
- {0x3272, 0, 0, 1, g(Yes, No, false, false, "", "마")},
- {0x3273, 0, 0, 1, g(Yes, No, false, false, "", "바")},
- {0x3274, 0, 0, 1, g(Yes, No, false, false, "", "사")},
- {0x3275, 0, 0, 1, g(Yes, No, false, false, "", "아")},
- {0x3276, 0, 0, 1, g(Yes, No, false, false, "", "자")},
- {0x3277, 0, 0, 1, g(Yes, No, false, false, "", "차")},
- {0x3278, 0, 0, 1, g(Yes, No, false, false, "", "카")},
- {0x3279, 0, 0, 1, g(Yes, No, false, false, "", "타")},
- {0x327a, 0, 0, 1, g(Yes, No, false, false, "", "파")},
- {0x327b, 0, 0, 1, g(Yes, No, false, false, "", "하")},
- {0x327c, 0, 0, 1, g(Yes, No, false, false, "", "참고")},
- {0x327d, 0, 0, 1, g(Yes, No, false, false, "", "주의")},
- {0x327e, 0, 0, 1, g(Yes, No, false, false, "", "우")},
- {0x327f, 0, 0, 0, f(Yes, false, "")},
- {0x3280, 0, 0, 0, g(Yes, No, false, false, "", "一")},
- {0x3281, 0, 0, 0, g(Yes, No, false, false, "", "二")},
- {0x3282, 0, 0, 0, g(Yes, No, false, false, "", "三")},
- {0x3283, 0, 0, 0, g(Yes, No, false, false, "", "四")},
- {0x3284, 0, 0, 0, g(Yes, No, false, false, "", "五")},
- {0x3285, 0, 0, 0, g(Yes, No, false, false, "", "六")},
- {0x3286, 0, 0, 0, g(Yes, No, false, false, "", "七")},
- {0x3287, 0, 0, 0, g(Yes, No, false, false, "", "八")},
- {0x3288, 0, 0, 0, g(Yes, No, false, false, "", "九")},
- {0x3289, 0, 0, 0, g(Yes, No, false, false, "", "十")},
- {0x328a, 0, 0, 0, g(Yes, No, false, false, "", "月")},
- {0x328b, 0, 0, 0, g(Yes, No, false, false, "", "火")},
- {0x328c, 0, 0, 0, g(Yes, No, false, false, "", "水")},
- {0x328d, 0, 0, 0, g(Yes, No, false, false, "", "木")},
- {0x328e, 0, 0, 0, g(Yes, No, false, false, "", "金")},
- {0x328f, 0, 0, 0, g(Yes, No, false, false, "", "土")},
- {0x3290, 0, 0, 0, g(Yes, No, false, false, "", "日")},
- {0x3291, 0, 0, 0, g(Yes, No, false, false, "", "株")},
- {0x3292, 0, 0, 0, g(Yes, No, false, false, "", "有")},
- {0x3293, 0, 0, 0, g(Yes, No, false, false, "", "社")},
- {0x3294, 0, 0, 0, g(Yes, No, false, false, "", "名")},
- {0x3295, 0, 0, 0, g(Yes, No, false, false, "", "特")},
- {0x3296, 0, 0, 0, g(Yes, No, false, false, "", "財")},
- {0x3297, 0, 0, 0, g(Yes, No, false, false, "", "祝")},
- {0x3298, 0, 0, 0, g(Yes, No, false, false, "", "労")},
- {0x3299, 0, 0, 0, g(Yes, No, false, false, "", "秘")},
- {0x329a, 0, 0, 0, g(Yes, No, false, false, "", "男")},
- {0x329b, 0, 0, 0, g(Yes, No, false, false, "", "女")},
- {0x329c, 0, 0, 0, g(Yes, No, false, false, "", "適")},
- {0x329d, 0, 0, 0, g(Yes, No, false, false, "", "優")},
- {0x329e, 0, 0, 0, g(Yes, No, false, false, "", "印")},
- {0x329f, 0, 0, 0, g(Yes, No, false, false, "", "注")},
- {0x32a0, 0, 0, 0, g(Yes, No, false, false, "", "項")},
- {0x32a1, 0, 0, 0, g(Yes, No, false, false, "", "休")},
- {0x32a2, 0, 0, 0, g(Yes, No, false, false, "", "写")},
- {0x32a3, 0, 0, 0, g(Yes, No, false, false, "", "正")},
- {0x32a4, 0, 0, 0, g(Yes, No, false, false, "", "上")},
- {0x32a5, 0, 0, 0, g(Yes, No, false, false, "", "中")},
- {0x32a6, 0, 0, 0, g(Yes, No, false, false, "", "下")},
- {0x32a7, 0, 0, 0, g(Yes, No, false, false, "", "左")},
- {0x32a8, 0, 0, 0, g(Yes, No, false, false, "", "右")},
- {0x32a9, 0, 0, 0, g(Yes, No, false, false, "", "医")},
- {0x32aa, 0, 0, 0, g(Yes, No, false, false, "", "宗")},
- {0x32ab, 0, 0, 0, g(Yes, No, false, false, "", "学")},
- {0x32ac, 0, 0, 0, g(Yes, No, false, false, "", "監")},
- {0x32ad, 0, 0, 0, g(Yes, No, false, false, "", "企")},
- {0x32ae, 0, 0, 0, g(Yes, No, false, false, "", "資")},
- {0x32af, 0, 0, 0, g(Yes, No, false, false, "", "協")},
- {0x32b0, 0, 0, 0, g(Yes, No, false, false, "", "夜")},
- {0x32b1, 0, 0, 0, g(Yes, No, false, false, "", "36")},
- {0x32b2, 0, 0, 0, g(Yes, No, false, false, "", "37")},
- {0x32b3, 0, 0, 0, g(Yes, No, false, false, "", "38")},
- {0x32b4, 0, 0, 0, g(Yes, No, false, false, "", "39")},
- {0x32b5, 0, 0, 0, g(Yes, No, false, false, "", "40")},
- {0x32b6, 0, 0, 0, g(Yes, No, false, false, "", "41")},
- {0x32b7, 0, 0, 0, g(Yes, No, false, false, "", "42")},
- {0x32b8, 0, 0, 0, g(Yes, No, false, false, "", "43")},
- {0x32b9, 0, 0, 0, g(Yes, No, false, false, "", "44")},
- {0x32ba, 0, 0, 0, g(Yes, No, false, false, "", "45")},
- {0x32bb, 0, 0, 0, g(Yes, No, false, false, "", "46")},
- {0x32bc, 0, 0, 0, g(Yes, No, false, false, "", "47")},
- {0x32bd, 0, 0, 0, g(Yes, No, false, false, "", "48")},
- {0x32be, 0, 0, 0, g(Yes, No, false, false, "", "49")},
- {0x32bf, 0, 0, 0, g(Yes, No, false, false, "", "50")},
- {0x32c0, 0, 0, 0, g(Yes, No, false, false, "", "1月")},
- {0x32c1, 0, 0, 0, g(Yes, No, false, false, "", "2月")},
- {0x32c2, 0, 0, 0, g(Yes, No, false, false, "", "3月")},
- {0x32c3, 0, 0, 0, g(Yes, No, false, false, "", "4月")},
- {0x32c4, 0, 0, 0, g(Yes, No, false, false, "", "5月")},
- {0x32c5, 0, 0, 0, g(Yes, No, false, false, "", "6月")},
- {0x32c6, 0, 0, 0, g(Yes, No, false, false, "", "7月")},
- {0x32c7, 0, 0, 0, g(Yes, No, false, false, "", "8月")},
- {0x32c8, 0, 0, 0, g(Yes, No, false, false, "", "9月")},
- {0x32c9, 0, 0, 0, g(Yes, No, false, false, "", "10月")},
- {0x32ca, 0, 0, 0, g(Yes, No, false, false, "", "11月")},
- {0x32cb, 0, 0, 0, g(Yes, No, false, false, "", "12月")},
- {0x32cc, 0, 0, 0, g(Yes, No, false, false, "", "Hg")},
- {0x32cd, 0, 0, 0, g(Yes, No, false, false, "", "erg")},
- {0x32ce, 0, 0, 0, g(Yes, No, false, false, "", "eV")},
- {0x32cf, 0, 0, 0, g(Yes, No, false, false, "", "LTD")},
- {0x32d0, 0, 0, 0, g(Yes, No, false, false, "", "ア")},
- {0x32d1, 0, 0, 0, g(Yes, No, false, false, "", "イ")},
- {0x32d2, 0, 0, 0, g(Yes, No, false, false, "", "ウ")},
- {0x32d3, 0, 0, 0, g(Yes, No, false, false, "", "エ")},
- {0x32d4, 0, 0, 0, g(Yes, No, false, false, "", "オ")},
- {0x32d5, 0, 0, 0, g(Yes, No, false, false, "", "カ")},
- {0x32d6, 0, 0, 0, g(Yes, No, false, false, "", "キ")},
- {0x32d7, 0, 0, 0, g(Yes, No, false, false, "", "ク")},
- {0x32d8, 0, 0, 0, g(Yes, No, false, false, "", "ケ")},
- {0x32d9, 0, 0, 0, g(Yes, No, false, false, "", "コ")},
- {0x32da, 0, 0, 0, g(Yes, No, false, false, "", "サ")},
- {0x32db, 0, 0, 0, g(Yes, No, false, false, "", "シ")},
- {0x32dc, 0, 0, 0, g(Yes, No, false, false, "", "ス")},
- {0x32dd, 0, 0, 0, g(Yes, No, false, false, "", "セ")},
- {0x32de, 0, 0, 0, g(Yes, No, false, false, "", "ソ")},
- {0x32df, 0, 0, 0, g(Yes, No, false, false, "", "タ")},
- {0x32e0, 0, 0, 0, g(Yes, No, false, false, "", "チ")},
- {0x32e1, 0, 0, 0, g(Yes, No, false, false, "", "ツ")},
- {0x32e2, 0, 0, 0, g(Yes, No, false, false, "", "テ")},
- {0x32e3, 0, 0, 0, g(Yes, No, false, false, "", "ト")},
- {0x32e4, 0, 0, 0, g(Yes, No, false, false, "", "ナ")},
- {0x32e5, 0, 0, 0, g(Yes, No, false, false, "", "ニ")},
- {0x32e6, 0, 0, 0, g(Yes, No, false, false, "", "ヌ")},
- {0x32e7, 0, 0, 0, g(Yes, No, false, false, "", "ネ")},
- {0x32e8, 0, 0, 0, g(Yes, No, false, false, "", "ノ")},
- {0x32e9, 0, 0, 0, g(Yes, No, false, false, "", "ハ")},
- {0x32ea, 0, 0, 0, g(Yes, No, false, false, "", "ヒ")},
- {0x32eb, 0, 0, 0, g(Yes, No, false, false, "", "フ")},
- {0x32ec, 0, 0, 0, g(Yes, No, false, false, "", "ヘ")},
- {0x32ed, 0, 0, 0, g(Yes, No, false, false, "", "ホ")},
- {0x32ee, 0, 0, 0, g(Yes, No, false, false, "", "マ")},
- {0x32ef, 0, 0, 0, g(Yes, No, false, false, "", "ミ")},
- {0x32f0, 0, 0, 0, g(Yes, No, false, false, "", "ム")},
- {0x32f1, 0, 0, 0, g(Yes, No, false, false, "", "メ")},
- {0x32f2, 0, 0, 0, g(Yes, No, false, false, "", "モ")},
- {0x32f3, 0, 0, 0, g(Yes, No, false, false, "", "ヤ")},
- {0x32f4, 0, 0, 0, g(Yes, No, false, false, "", "ユ")},
- {0x32f5, 0, 0, 0, g(Yes, No, false, false, "", "ヨ")},
- {0x32f6, 0, 0, 0, g(Yes, No, false, false, "", "ラ")},
- {0x32f7, 0, 0, 0, g(Yes, No, false, false, "", "リ")},
- {0x32f8, 0, 0, 0, g(Yes, No, false, false, "", "ル")},
- {0x32f9, 0, 0, 0, g(Yes, No, false, false, "", "レ")},
- {0x32fa, 0, 0, 0, g(Yes, No, false, false, "", "ロ")},
- {0x32fb, 0, 0, 0, g(Yes, No, false, false, "", "ワ")},
- {0x32fc, 0, 0, 0, g(Yes, No, false, false, "", "ヰ")},
- {0x32fd, 0, 0, 0, g(Yes, No, false, false, "", "ヱ")},
- {0x32fe, 0, 0, 0, g(Yes, No, false, false, "", "ヲ")},
- {0x32ff, 0, 0, 0, f(Yes, false, "")},
- {0x3300, 0, 0, 0, g(Yes, No, false, false, "", "アパート")},
- {0x3301, 0, 0, 0, g(Yes, No, false, false, "", "アルファ")},
- {0x3302, 0, 0, 0, g(Yes, No, false, false, "", "アンペア")},
- {0x3303, 0, 0, 0, g(Yes, No, false, false, "", "アール")},
- {0x3304, 0, 0, 1, g(Yes, No, false, false, "", "イニング")},
- {0x3305, 0, 0, 0, g(Yes, No, false, false, "", "インチ")},
- {0x3306, 0, 0, 0, g(Yes, No, false, false, "", "ウォン")},
- {0x3307, 0, 0, 1, g(Yes, No, false, false, "", "エスクード")},
- {0x3308, 0, 0, 0, g(Yes, No, false, false, "", "エーカー")},
- {0x3309, 0, 0, 0, g(Yes, No, false, false, "", "オンス")},
- {0x330a, 0, 0, 0, g(Yes, No, false, false, "", "オーム")},
- {0x330b, 0, 0, 0, g(Yes, No, false, false, "", "カイリ")},
- {0x330c, 0, 0, 0, g(Yes, No, false, false, "", "カラット")},
- {0x330d, 0, 0, 0, g(Yes, No, false, false, "", "カロリー")},
- {0x330e, 0, 0, 0, g(Yes, No, false, false, "", "ガロン")},
- {0x330f, 0, 0, 0, g(Yes, No, false, false, "", "ガンマ")},
- {0x3310, 0, 0, 1, g(Yes, No, false, false, "", "ギガ")},
- {0x3311, 0, 0, 0, g(Yes, No, false, false, "", "ギニー")},
- {0x3312, 0, 0, 0, g(Yes, No, false, false, "", "キュリー")},
- {0x3313, 0, 0, 0, g(Yes, No, false, false, "", "ギルダー")},
- {0x3314, 0, 0, 0, g(Yes, No, false, false, "", "キロ")},
- {0x3315, 0, 0, 0, g(Yes, No, false, false, "", "キログラム")},
- {0x3316, 0, 0, 0, g(Yes, No, false, false, "", "キロメートル")},
- {0x3317, 0, 0, 0, g(Yes, No, false, false, "", "キロワット")},
- {0x3318, 0, 0, 0, g(Yes, No, false, false, "", "グラム")},
- {0x3319, 0, 0, 0, g(Yes, No, false, false, "", "グラムトン")},
- {0x331a, 0, 0, 0, g(Yes, No, false, false, "", "クルゼイロ")},
- {0x331b, 0, 0, 0, g(Yes, No, false, false, "", "クローネ")},
- {0x331c, 0, 0, 0, g(Yes, No, false, false, "", "ケース")},
- {0x331d, 0, 0, 0, g(Yes, No, false, false, "", "コルナ")},
- {0x331e, 0, 0, 1, g(Yes, No, false, false, "", "コーポ")},
- {0x331f, 0, 0, 0, g(Yes, No, false, false, "", "サイクル")},
- {0x3320, 0, 0, 0, g(Yes, No, false, false, "", "サンチーム")},
- {0x3321, 0, 0, 1, g(Yes, No, false, false, "", "シリング")},
- {0x3322, 0, 0, 0, g(Yes, No, false, false, "", "センチ")},
- {0x3323, 0, 0, 0, g(Yes, No, false, false, "", "セント")},
- {0x3324, 0, 0, 0, g(Yes, No, false, false, "", "ダース")},
- {0x3325, 0, 0, 0, g(Yes, No, false, false, "", "デシ")},
- {0x3326, 0, 0, 0, g(Yes, No, false, false, "", "ドル")},
- {0x3327, 0, 0, 0, g(Yes, No, false, false, "", "トン")},
- {0x3328, 0, 0, 0, g(Yes, No, false, false, "", "ナノ")},
- {0x3329, 0, 0, 0, g(Yes, No, false, false, "", "ノット")},
- {0x332a, 0, 0, 0, g(Yes, No, false, false, "", "ハイツ")},
- {0x332b, 0, 0, 0, g(Yes, No, false, false, "", "パーセント")},
- {0x332c, 0, 0, 0, g(Yes, No, false, false, "", "パーツ")},
- {0x332d, 0, 0, 0, g(Yes, No, false, false, "", "バーレル")},
- {0x332e, 0, 0, 0, g(Yes, No, false, false, "", "ピアストル")},
- {0x332f, 0, 0, 0, g(Yes, No, false, false, "", "ピクル")},
- {0x3330, 0, 0, 0, g(Yes, No, false, false, "", "ピコ")},
- {0x3331, 0, 0, 0, g(Yes, No, false, false, "", "ビル")},
- {0x3332, 0, 0, 1, g(Yes, No, false, false, "", "ファラッド")},
- {0x3333, 0, 0, 0, g(Yes, No, false, false, "", "フィート")},
- {0x3334, 0, 0, 0, g(Yes, No, false, false, "", "ブッシェル")},
- {0x3335, 0, 0, 0, g(Yes, No, false, false, "", "フラン")},
- {0x3336, 0, 0, 0, g(Yes, No, false, false, "", "ヘクタール")},
- {0x3337, 0, 0, 0, g(Yes, No, false, false, "", "ペソ")},
- {0x3338, 0, 0, 0, g(Yes, No, false, false, "", "ペニヒ")},
- {0x3339, 0, 0, 0, g(Yes, No, false, false, "", "ヘルツ")},
- {0x333a, 0, 0, 0, g(Yes, No, false, false, "", "ペンス")},
- {0x333b, 0, 0, 1, g(Yes, No, false, false, "", "ページ")},
- {0x333c, 0, 0, 0, g(Yes, No, false, false, "", "ベータ")},
- {0x333d, 0, 0, 0, g(Yes, No, false, false, "", "ポイント")},
- {0x333e, 0, 0, 0, g(Yes, No, false, false, "", "ボルト")},
- {0x333f, 0, 0, 0, g(Yes, No, false, false, "", "ホン")},
- {0x3340, 0, 0, 1, g(Yes, No, false, false, "", "ポンド")},
- {0x3341, 0, 0, 0, g(Yes, No, false, false, "", "ホール")},
- {0x3342, 0, 0, 0, g(Yes, No, false, false, "", "ホーン")},
- {0x3343, 0, 0, 0, g(Yes, No, false, false, "", "マイクロ")},
- {0x3344, 0, 0, 0, g(Yes, No, false, false, "", "マイル")},
- {0x3345, 0, 0, 0, g(Yes, No, false, false, "", "マッハ")},
- {0x3346, 0, 0, 0, g(Yes, No, false, false, "", "マルク")},
- {0x3347, 0, 0, 0, g(Yes, No, false, false, "", "マンション")},
- {0x3348, 0, 0, 0, g(Yes, No, false, false, "", "ミクロン")},
- {0x3349, 0, 0, 0, g(Yes, No, false, false, "", "ミリ")},
- {0x334a, 0, 0, 0, g(Yes, No, false, false, "", "ミリバール")},
- {0x334b, 0, 0, 1, g(Yes, No, false, false, "", "メガ")},
- {0x334c, 0, 0, 0, g(Yes, No, false, false, "", "メガトン")},
- {0x334d, 0, 0, 0, g(Yes, No, false, false, "", "メートル")},
- {0x334e, 0, 0, 1, g(Yes, No, false, false, "", "ヤード")},
- {0x334f, 0, 0, 0, g(Yes, No, false, false, "", "ヤール")},
- {0x3350, 0, 0, 0, g(Yes, No, false, false, "", "ユアン")},
- {0x3351, 0, 0, 0, g(Yes, No, false, false, "", "リットル")},
- {0x3352, 0, 0, 0, g(Yes, No, false, false, "", "リラ")},
- {0x3353, 0, 0, 0, g(Yes, No, false, false, "", "ルピー")},
- {0x3354, 0, 0, 0, g(Yes, No, false, false, "", "ルーブル")},
- {0x3355, 0, 0, 0, g(Yes, No, false, false, "", "レム")},
- {0x3356, 0, 0, 0, g(Yes, No, false, false, "", "レントゲン")},
- {0x3357, 0, 0, 0, g(Yes, No, false, false, "", "ワット")},
- {0x3358, 0, 0, 0, g(Yes, No, false, false, "", "0点")},
- {0x3359, 0, 0, 0, g(Yes, No, false, false, "", "1点")},
- {0x335a, 0, 0, 0, g(Yes, No, false, false, "", "2点")},
- {0x335b, 0, 0, 0, g(Yes, No, false, false, "", "3点")},
- {0x335c, 0, 0, 0, g(Yes, No, false, false, "", "4点")},
- {0x335d, 0, 0, 0, g(Yes, No, false, false, "", "5点")},
- {0x335e, 0, 0, 0, g(Yes, No, false, false, "", "6点")},
- {0x335f, 0, 0, 0, g(Yes, No, false, false, "", "7点")},
- {0x3360, 0, 0, 0, g(Yes, No, false, false, "", "8点")},
- {0x3361, 0, 0, 0, g(Yes, No, false, false, "", "9点")},
- {0x3362, 0, 0, 0, g(Yes, No, false, false, "", "10点")},
- {0x3363, 0, 0, 0, g(Yes, No, false, false, "", "11点")},
- {0x3364, 0, 0, 0, g(Yes, No, false, false, "", "12点")},
- {0x3365, 0, 0, 0, g(Yes, No, false, false, "", "13点")},
- {0x3366, 0, 0, 0, g(Yes, No, false, false, "", "14点")},
- {0x3367, 0, 0, 0, g(Yes, No, false, false, "", "15点")},
- {0x3368, 0, 0, 0, g(Yes, No, false, false, "", "16点")},
- {0x3369, 0, 0, 0, g(Yes, No, false, false, "", "17点")},
- {0x336a, 0, 0, 0, g(Yes, No, false, false, "", "18点")},
- {0x336b, 0, 0, 0, g(Yes, No, false, false, "", "19点")},
- {0x336c, 0, 0, 0, g(Yes, No, false, false, "", "20点")},
- {0x336d, 0, 0, 0, g(Yes, No, false, false, "", "21点")},
- {0x336e, 0, 0, 0, g(Yes, No, false, false, "", "22点")},
- {0x336f, 0, 0, 0, g(Yes, No, false, false, "", "23点")},
- {0x3370, 0, 0, 0, g(Yes, No, false, false, "", "24点")},
- {0x3371, 0, 0, 0, g(Yes, No, false, false, "", "hPa")},
- {0x3372, 0, 0, 0, g(Yes, No, false, false, "", "da")},
- {0x3373, 0, 0, 0, g(Yes, No, false, false, "", "AU")},
- {0x3374, 0, 0, 0, g(Yes, No, false, false, "", "bar")},
- {0x3375, 0, 0, 0, g(Yes, No, false, false, "", "oV")},
- {0x3376, 0, 0, 0, g(Yes, No, false, false, "", "pc")},
- {0x3377, 0, 0, 0, g(Yes, No, false, false, "", "dm")},
- {0x3378, 0, 0, 0, g(Yes, No, false, false, "", "dm2")},
- {0x3379, 0, 0, 0, g(Yes, No, false, false, "", "dm3")},
- {0x337a, 0, 0, 0, g(Yes, No, false, false, "", "IU")},
- {0x337b, 0, 0, 0, g(Yes, No, false, false, "", "平成")},
- {0x337c, 0, 0, 0, g(Yes, No, false, false, "", "昭和")},
- {0x337d, 0, 0, 0, g(Yes, No, false, false, "", "大正")},
- {0x337e, 0, 0, 0, g(Yes, No, false, false, "", "明治")},
- {0x337f, 0, 0, 0, g(Yes, No, false, false, "", "株式会社")},
- {0x3380, 0, 0, 0, g(Yes, No, false, false, "", "pA")},
- {0x3381, 0, 0, 0, g(Yes, No, false, false, "", "nA")},
- {0x3382, 0, 0, 0, g(Yes, No, false, false, "", "μA")},
- {0x3383, 0, 0, 0, g(Yes, No, false, false, "", "mA")},
- {0x3384, 0, 0, 0, g(Yes, No, false, false, "", "kA")},
- {0x3385, 0, 0, 0, g(Yes, No, false, false, "", "KB")},
- {0x3386, 0, 0, 0, g(Yes, No, false, false, "", "MB")},
- {0x3387, 0, 0, 0, g(Yes, No, false, false, "", "GB")},
- {0x3388, 0, 0, 0, g(Yes, No, false, false, "", "cal")},
- {0x3389, 0, 0, 0, g(Yes, No, false, false, "", "kcal")},
- {0x338a, 0, 0, 0, g(Yes, No, false, false, "", "pF")},
- {0x338b, 0, 0, 0, g(Yes, No, false, false, "", "nF")},
- {0x338c, 0, 0, 0, g(Yes, No, false, false, "", "μF")},
- {0x338d, 0, 0, 0, g(Yes, No, false, false, "", "μg")},
- {0x338e, 0, 0, 0, g(Yes, No, false, false, "", "mg")},
- {0x338f, 0, 0, 0, g(Yes, No, false, false, "", "kg")},
- {0x3390, 0, 0, 0, g(Yes, No, false, false, "", "Hz")},
- {0x3391, 0, 0, 0, g(Yes, No, false, false, "", "kHz")},
- {0x3392, 0, 0, 0, g(Yes, No, false, false, "", "MHz")},
- {0x3393, 0, 0, 0, g(Yes, No, false, false, "", "GHz")},
- {0x3394, 0, 0, 0, g(Yes, No, false, false, "", "THz")},
- {0x3395, 0, 0, 0, g(Yes, No, false, false, "", "μl")},
- {0x3396, 0, 0, 0, g(Yes, No, false, false, "", "ml")},
- {0x3397, 0, 0, 0, g(Yes, No, false, false, "", "dl")},
- {0x3398, 0, 0, 0, g(Yes, No, false, false, "", "kl")},
- {0x3399, 0, 0, 0, g(Yes, No, false, false, "", "fm")},
- {0x339a, 0, 0, 0, g(Yes, No, false, false, "", "nm")},
- {0x339b, 0, 0, 0, g(Yes, No, false, false, "", "μm")},
- {0x339c, 0, 0, 0, g(Yes, No, false, false, "", "mm")},
- {0x339d, 0, 0, 0, g(Yes, No, false, false, "", "cm")},
- {0x339e, 0, 0, 0, g(Yes, No, false, false, "", "km")},
- {0x339f, 0, 0, 0, g(Yes, No, false, false, "", "mm2")},
- {0x33a0, 0, 0, 0, g(Yes, No, false, false, "", "cm2")},
- {0x33a1, 0, 0, 0, g(Yes, No, false, false, "", "m2")},
- {0x33a2, 0, 0, 0, g(Yes, No, false, false, "", "km2")},
- {0x33a3, 0, 0, 0, g(Yes, No, false, false, "", "mm3")},
- {0x33a4, 0, 0, 0, g(Yes, No, false, false, "", "cm3")},
- {0x33a5, 0, 0, 0, g(Yes, No, false, false, "", "m3")},
- {0x33a6, 0, 0, 0, g(Yes, No, false, false, "", "km3")},
- {0x33a7, 0, 0, 0, g(Yes, No, false, false, "", "m∕s")},
- {0x33a8, 0, 0, 0, g(Yes, No, false, false, "", "m∕s2")},
- {0x33a9, 0, 0, 0, g(Yes, No, false, false, "", "Pa")},
- {0x33aa, 0, 0, 0, g(Yes, No, false, false, "", "kPa")},
- {0x33ab, 0, 0, 0, g(Yes, No, false, false, "", "MPa")},
- {0x33ac, 0, 0, 0, g(Yes, No, false, false, "", "GPa")},
- {0x33ad, 0, 0, 0, g(Yes, No, false, false, "", "rad")},
- {0x33ae, 0, 0, 0, g(Yes, No, false, false, "", "rad∕s")},
- {0x33af, 0, 0, 0, g(Yes, No, false, false, "", "rad∕s2")},
- {0x33b0, 0, 0, 0, g(Yes, No, false, false, "", "ps")},
- {0x33b1, 0, 0, 0, g(Yes, No, false, false, "", "ns")},
- {0x33b2, 0, 0, 0, g(Yes, No, false, false, "", "μs")},
- {0x33b3, 0, 0, 0, g(Yes, No, false, false, "", "ms")},
- {0x33b4, 0, 0, 0, g(Yes, No, false, false, "", "pV")},
- {0x33b5, 0, 0, 0, g(Yes, No, false, false, "", "nV")},
- {0x33b6, 0, 0, 0, g(Yes, No, false, false, "", "μV")},
- {0x33b7, 0, 0, 0, g(Yes, No, false, false, "", "mV")},
- {0x33b8, 0, 0, 0, g(Yes, No, false, false, "", "kV")},
- {0x33b9, 0, 0, 0, g(Yes, No, false, false, "", "MV")},
- {0x33ba, 0, 0, 0, g(Yes, No, false, false, "", "pW")},
- {0x33bb, 0, 0, 0, g(Yes, No, false, false, "", "nW")},
- {0x33bc, 0, 0, 0, g(Yes, No, false, false, "", "μW")},
- {0x33bd, 0, 0, 0, g(Yes, No, false, false, "", "mW")},
- {0x33be, 0, 0, 0, g(Yes, No, false, false, "", "kW")},
- {0x33bf, 0, 0, 0, g(Yes, No, false, false, "", "MW")},
- {0x33c0, 0, 0, 0, g(Yes, No, false, false, "", "kΩ")},
- {0x33c1, 0, 0, 0, g(Yes, No, false, false, "", "MΩ")},
- {0x33c2, 0, 0, 0, g(Yes, No, false, false, "", "a.m.")},
- {0x33c3, 0, 0, 0, g(Yes, No, false, false, "", "Bq")},
- {0x33c4, 0, 0, 0, g(Yes, No, false, false, "", "cc")},
- {0x33c5, 0, 0, 0, g(Yes, No, false, false, "", "cd")},
- {0x33c6, 0, 0, 0, g(Yes, No, false, false, "", "C∕kg")},
- {0x33c7, 0, 0, 0, g(Yes, No, false, false, "", "Co.")},
- {0x33c8, 0, 0, 0, g(Yes, No, false, false, "", "dB")},
- {0x33c9, 0, 0, 0, g(Yes, No, false, false, "", "Gy")},
- {0x33ca, 0, 0, 0, g(Yes, No, false, false, "", "ha")},
- {0x33cb, 0, 0, 0, g(Yes, No, false, false, "", "HP")},
- {0x33cc, 0, 0, 0, g(Yes, No, false, false, "", "in")},
- {0x33cd, 0, 0, 0, g(Yes, No, false, false, "", "KK")},
- {0x33ce, 0, 0, 0, g(Yes, No, false, false, "", "KM")},
- {0x33cf, 0, 0, 0, g(Yes, No, false, false, "", "kt")},
- {0x33d0, 0, 0, 0, g(Yes, No, false, false, "", "lm")},
- {0x33d1, 0, 0, 0, g(Yes, No, false, false, "", "ln")},
- {0x33d2, 0, 0, 0, g(Yes, No, false, false, "", "log")},
- {0x33d3, 0, 0, 0, g(Yes, No, false, false, "", "lx")},
- {0x33d4, 0, 0, 0, g(Yes, No, false, false, "", "mb")},
- {0x33d5, 0, 0, 0, g(Yes, No, false, false, "", "mil")},
- {0x33d6, 0, 0, 0, g(Yes, No, false, false, "", "mol")},
- {0x33d7, 0, 0, 0, g(Yes, No, false, false, "", "PH")},
- {0x33d8, 0, 0, 0, g(Yes, No, false, false, "", "p.m.")},
- {0x33d9, 0, 0, 0, g(Yes, No, false, false, "", "PPM")},
- {0x33da, 0, 0, 0, g(Yes, No, false, false, "", "PR")},
- {0x33db, 0, 0, 0, g(Yes, No, false, false, "", "sr")},
- {0x33dc, 0, 0, 0, g(Yes, No, false, false, "", "Sv")},
- {0x33dd, 0, 0, 0, g(Yes, No, false, false, "", "Wb")},
- {0x33de, 0, 0, 0, g(Yes, No, false, false, "", "V∕m")},
- {0x33df, 0, 0, 0, g(Yes, No, false, false, "", "A∕m")},
- {0x33e0, 0, 0, 0, g(Yes, No, false, false, "", "1日")},
- {0x33e1, 0, 0, 0, g(Yes, No, false, false, "", "2日")},
- {0x33e2, 0, 0, 0, g(Yes, No, false, false, "", "3日")},
- {0x33e3, 0, 0, 0, g(Yes, No, false, false, "", "4日")},
- {0x33e4, 0, 0, 0, g(Yes, No, false, false, "", "5日")},
- {0x33e5, 0, 0, 0, g(Yes, No, false, false, "", "6日")},
- {0x33e6, 0, 0, 0, g(Yes, No, false, false, "", "7日")},
- {0x33e7, 0, 0, 0, g(Yes, No, false, false, "", "8日")},
- {0x33e8, 0, 0, 0, g(Yes, No, false, false, "", "9日")},
- {0x33e9, 0, 0, 0, g(Yes, No, false, false, "", "10日")},
- {0x33ea, 0, 0, 0, g(Yes, No, false, false, "", "11日")},
- {0x33eb, 0, 0, 0, g(Yes, No, false, false, "", "12日")},
- {0x33ec, 0, 0, 0, g(Yes, No, false, false, "", "13日")},
- {0x33ed, 0, 0, 0, g(Yes, No, false, false, "", "14日")},
- {0x33ee, 0, 0, 0, g(Yes, No, false, false, "", "15日")},
- {0x33ef, 0, 0, 0, g(Yes, No, false, false, "", "16日")},
- {0x33f0, 0, 0, 0, g(Yes, No, false, false, "", "17日")},
- {0x33f1, 0, 0, 0, g(Yes, No, false, false, "", "18日")},
- {0x33f2, 0, 0, 0, g(Yes, No, false, false, "", "19日")},
- {0x33f3, 0, 0, 0, g(Yes, No, false, false, "", "20日")},
- {0x33f4, 0, 0, 0, g(Yes, No, false, false, "", "21日")},
- {0x33f5, 0, 0, 0, g(Yes, No, false, false, "", "22日")},
- {0x33f6, 0, 0, 0, g(Yes, No, false, false, "", "23日")},
- {0x33f7, 0, 0, 0, g(Yes, No, false, false, "", "24日")},
- {0x33f8, 0, 0, 0, g(Yes, No, false, false, "", "25日")},
- {0x33f9, 0, 0, 0, g(Yes, No, false, false, "", "26日")},
- {0x33fa, 0, 0, 0, g(Yes, No, false, false, "", "27日")},
- {0x33fb, 0, 0, 0, g(Yes, No, false, false, "", "28日")},
- {0x33fc, 0, 0, 0, g(Yes, No, false, false, "", "29日")},
- {0x33fd, 0, 0, 0, g(Yes, No, false, false, "", "30日")},
- {0x33fe, 0, 0, 0, g(Yes, No, false, false, "", "31日")},
- {0x33ff, 0, 0, 0, g(Yes, No, false, false, "", "gal")},
- {0x3400, 0, 0, 0, f(Yes, false, "")},
- {0xa66f, 230, 1, 1, f(Yes, false, "")},
- {0xa670, 0, 0, 0, f(Yes, false, "")},
- {0xa674, 230, 1, 1, f(Yes, false, "")},
- {0xa67e, 0, 0, 0, f(Yes, false, "")},
- {0xa69c, 0, 0, 0, g(Yes, No, false, false, "", "ъ")},
- {0xa69d, 0, 0, 0, g(Yes, No, false, false, "", "ь")},
- {0xa69e, 230, 1, 1, f(Yes, false, "")},
- {0xa6a0, 0, 0, 0, f(Yes, false, "")},
- {0xa6f0, 230, 1, 1, f(Yes, false, "")},
- {0xa6f2, 0, 0, 0, f(Yes, false, "")},
- {0xa770, 0, 0, 0, g(Yes, No, false, false, "", "ꝯ")},
- {0xa771, 0, 0, 0, f(Yes, false, "")},
- {0xa7f8, 0, 0, 0, g(Yes, No, false, false, "", "Ħ")},
- {0xa7f9, 0, 0, 0, g(Yes, No, false, false, "", "œ")},
- {0xa7fa, 0, 0, 0, f(Yes, false, "")},
- {0xa806, 9, 1, 1, f(Yes, false, "")},
- {0xa807, 0, 0, 0, f(Yes, false, "")},
- {0xa8c4, 9, 1, 1, f(Yes, false, "")},
- {0xa8c5, 0, 0, 0, f(Yes, false, "")},
- {0xa8e0, 230, 1, 1, f(Yes, false, "")},
- {0xa8f2, 0, 0, 0, f(Yes, false, "")},
- {0xa92b, 220, 1, 1, f(Yes, false, "")},
- {0xa92e, 0, 0, 0, f(Yes, false, "")},
- {0xa953, 9, 1, 1, f(Yes, false, "")},
- {0xa954, 0, 0, 0, f(Yes, false, "")},
- {0xa9b3, 7, 1, 1, f(Yes, false, "")},
- {0xa9b4, 0, 0, 0, f(Yes, false, "")},
- {0xa9c0, 9, 1, 1, f(Yes, false, "")},
- {0xa9c1, 0, 0, 0, f(Yes, false, "")},
- {0xaab0, 230, 1, 1, f(Yes, false, "")},
- {0xaab1, 0, 0, 0, f(Yes, false, "")},
- {0xaab2, 230, 1, 1, f(Yes, false, "")},
- {0xaab4, 220, 1, 1, f(Yes, false, "")},
- {0xaab5, 0, 0, 0, f(Yes, false, "")},
- {0xaab7, 230, 1, 1, f(Yes, false, "")},
- {0xaab9, 0, 0, 0, f(Yes, false, "")},
- {0xaabe, 230, 1, 1, f(Yes, false, "")},
- {0xaac0, 0, 0, 0, f(Yes, false, "")},
- {0xaac1, 230, 1, 1, f(Yes, false, "")},
- {0xaac2, 0, 0, 0, f(Yes, false, "")},
- {0xaaf6, 9, 1, 1, f(Yes, false, "")},
- {0xaaf7, 0, 0, 0, f(Yes, false, "")},
- {0xab5c, 0, 0, 0, g(Yes, No, false, false, "", "ꜧ")},
- {0xab5d, 0, 0, 0, g(Yes, No, false, false, "", "ꬷ")},
- {0xab5e, 0, 0, 0, g(Yes, No, false, false, "", "ɫ")},
- {0xab5f, 0, 0, 0, g(Yes, No, false, false, "", "ꭒ")},
- {0xab60, 0, 0, 0, f(Yes, false, "")},
- {0xabed, 9, 1, 1, f(Yes, false, "")},
- {0xabee, 0, 0, 0, f(Yes, false, "")},
- {0xac00, 0, 0, 1, f(Yes, true, "")},
- {0xac01, 0, 0, 2, f(Yes, false, "")},
- {0xac1c, 0, 0, 1, f(Yes, true, "")},
- {0xac1d, 0, 0, 2, f(Yes, false, "")},
- {0xac38, 0, 0, 1, f(Yes, true, "")},
- {0xac39, 0, 0, 2, f(Yes, false, "")},
- {0xac54, 0, 0, 1, f(Yes, true, "")},
- {0xac55, 0, 0, 2, f(Yes, false, "")},
- {0xac70, 0, 0, 1, f(Yes, true, "")},
- {0xac71, 0, 0, 2, f(Yes, false, "")},
- {0xac8c, 0, 0, 1, f(Yes, true, "")},
- {0xac8d, 0, 0, 2, f(Yes, false, "")},
- {0xaca8, 0, 0, 1, f(Yes, true, "")},
- {0xaca9, 0, 0, 2, f(Yes, false, "")},
- {0xacc4, 0, 0, 1, f(Yes, true, "")},
- {0xacc5, 0, 0, 2, f(Yes, false, "")},
- {0xace0, 0, 0, 1, f(Yes, true, "")},
- {0xace1, 0, 0, 2, f(Yes, false, "")},
- {0xacfc, 0, 0, 1, f(Yes, true, "")},
- {0xacfd, 0, 0, 2, f(Yes, false, "")},
- {0xad18, 0, 0, 1, f(Yes, true, "")},
- {0xad19, 0, 0, 2, f(Yes, false, "")},
- {0xad34, 0, 0, 1, f(Yes, true, "")},
- {0xad35, 0, 0, 2, f(Yes, false, "")},
- {0xad50, 0, 0, 1, f(Yes, true, "")},
- {0xad51, 0, 0, 2, f(Yes, false, "")},
- {0xad6c, 0, 0, 1, f(Yes, true, "")},
- {0xad6d, 0, 0, 2, f(Yes, false, "")},
- {0xad88, 0, 0, 1, f(Yes, true, "")},
- {0xad89, 0, 0, 2, f(Yes, false, "")},
- {0xada4, 0, 0, 1, f(Yes, true, "")},
- {0xada5, 0, 0, 2, f(Yes, false, "")},
- {0xadc0, 0, 0, 1, f(Yes, true, "")},
- {0xadc1, 0, 0, 2, f(Yes, false, "")},
- {0xaddc, 0, 0, 1, f(Yes, true, "")},
- {0xaddd, 0, 0, 2, f(Yes, false, "")},
- {0xadf8, 0, 0, 1, f(Yes, true, "")},
- {0xadf9, 0, 0, 2, f(Yes, false, "")},
- {0xae14, 0, 0, 1, f(Yes, true, "")},
- {0xae15, 0, 0, 2, f(Yes, false, "")},
- {0xae30, 0, 0, 1, f(Yes, true, "")},
- {0xae31, 0, 0, 2, f(Yes, false, "")},
- {0xae4c, 0, 0, 1, f(Yes, true, "")},
- {0xae4d, 0, 0, 2, f(Yes, false, "")},
- {0xae68, 0, 0, 1, f(Yes, true, "")},
- {0xae69, 0, 0, 2, f(Yes, false, "")},
- {0xae84, 0, 0, 1, f(Yes, true, "")},
- {0xae85, 0, 0, 2, f(Yes, false, "")},
- {0xaea0, 0, 0, 1, f(Yes, true, "")},
- {0xaea1, 0, 0, 2, f(Yes, false, "")},
- {0xaebc, 0, 0, 1, f(Yes, true, "")},
- {0xaebd, 0, 0, 2, f(Yes, false, "")},
- {0xaed8, 0, 0, 1, f(Yes, true, "")},
- {0xaed9, 0, 0, 2, f(Yes, false, "")},
- {0xaef4, 0, 0, 1, f(Yes, true, "")},
- {0xaef5, 0, 0, 2, f(Yes, false, "")},
- {0xaf10, 0, 0, 1, f(Yes, true, "")},
- {0xaf11, 0, 0, 2, f(Yes, false, "")},
- {0xaf2c, 0, 0, 1, f(Yes, true, "")},
- {0xaf2d, 0, 0, 2, f(Yes, false, "")},
- {0xaf48, 0, 0, 1, f(Yes, true, "")},
- {0xaf49, 0, 0, 2, f(Yes, false, "")},
- {0xaf64, 0, 0, 1, f(Yes, true, "")},
- {0xaf65, 0, 0, 2, f(Yes, false, "")},
- {0xaf80, 0, 0, 1, f(Yes, true, "")},
- {0xaf81, 0, 0, 2, f(Yes, false, "")},
- {0xaf9c, 0, 0, 1, f(Yes, true, "")},
- {0xaf9d, 0, 0, 2, f(Yes, false, "")},
- {0xafb8, 0, 0, 1, f(Yes, true, "")},
- {0xafb9, 0, 0, 2, f(Yes, false, "")},
- {0xafd4, 0, 0, 1, f(Yes, true, "")},
- {0xafd5, 0, 0, 2, f(Yes, false, "")},
- {0xaff0, 0, 0, 1, f(Yes, true, "")},
- {0xaff1, 0, 0, 2, f(Yes, false, "")},
- {0xb00c, 0, 0, 1, f(Yes, true, "")},
- {0xb00d, 0, 0, 2, f(Yes, false, "")},
- {0xb028, 0, 0, 1, f(Yes, true, "")},
- {0xb029, 0, 0, 2, f(Yes, false, "")},
- {0xb044, 0, 0, 1, f(Yes, true, "")},
- {0xb045, 0, 0, 2, f(Yes, false, "")},
- {0xb060, 0, 0, 1, f(Yes, true, "")},
- {0xb061, 0, 0, 2, f(Yes, false, "")},
- {0xb07c, 0, 0, 1, f(Yes, true, "")},
- {0xb07d, 0, 0, 2, f(Yes, false, "")},
- {0xb098, 0, 0, 1, f(Yes, true, "")},
- {0xb099, 0, 0, 2, f(Yes, false, "")},
- {0xb0b4, 0, 0, 1, f(Yes, true, "")},
- {0xb0b5, 0, 0, 2, f(Yes, false, "")},
- {0xb0d0, 0, 0, 1, f(Yes, true, "")},
- {0xb0d1, 0, 0, 2, f(Yes, false, "")},
- {0xb0ec, 0, 0, 1, f(Yes, true, "")},
- {0xb0ed, 0, 0, 2, f(Yes, false, "")},
- {0xb108, 0, 0, 1, f(Yes, true, "")},
- {0xb109, 0, 0, 2, f(Yes, false, "")},
- {0xb124, 0, 0, 1, f(Yes, true, "")},
- {0xb125, 0, 0, 2, f(Yes, false, "")},
- {0xb140, 0, 0, 1, f(Yes, true, "")},
- {0xb141, 0, 0, 2, f(Yes, false, "")},
- {0xb15c, 0, 0, 1, f(Yes, true, "")},
- {0xb15d, 0, 0, 2, f(Yes, false, "")},
- {0xb178, 0, 0, 1, f(Yes, true, "")},
- {0xb179, 0, 0, 2, f(Yes, false, "")},
- {0xb194, 0, 0, 1, f(Yes, true, "")},
- {0xb195, 0, 0, 2, f(Yes, false, "")},
- {0xb1b0, 0, 0, 1, f(Yes, true, "")},
- {0xb1b1, 0, 0, 2, f(Yes, false, "")},
- {0xb1cc, 0, 0, 1, f(Yes, true, "")},
- {0xb1cd, 0, 0, 2, f(Yes, false, "")},
- {0xb1e8, 0, 0, 1, f(Yes, true, "")},
- {0xb1e9, 0, 0, 2, f(Yes, false, "")},
- {0xb204, 0, 0, 1, f(Yes, true, "")},
- {0xb205, 0, 0, 2, f(Yes, false, "")},
- {0xb220, 0, 0, 1, f(Yes, true, "")},
- {0xb221, 0, 0, 2, f(Yes, false, "")},
- {0xb23c, 0, 0, 1, f(Yes, true, "")},
- {0xb23d, 0, 0, 2, f(Yes, false, "")},
- {0xb258, 0, 0, 1, f(Yes, true, "")},
- {0xb259, 0, 0, 2, f(Yes, false, "")},
- {0xb274, 0, 0, 1, f(Yes, true, "")},
- {0xb275, 0, 0, 2, f(Yes, false, "")},
- {0xb290, 0, 0, 1, f(Yes, true, "")},
- {0xb291, 0, 0, 2, f(Yes, false, "")},
- {0xb2ac, 0, 0, 1, f(Yes, true, "")},
- {0xb2ad, 0, 0, 2, f(Yes, false, "")},
- {0xb2c8, 0, 0, 1, f(Yes, true, "")},
- {0xb2c9, 0, 0, 2, f(Yes, false, "")},
- {0xb2e4, 0, 0, 1, f(Yes, true, "")},
- {0xb2e5, 0, 0, 2, f(Yes, false, "")},
- {0xb300, 0, 0, 1, f(Yes, true, "")},
- {0xb301, 0, 0, 2, f(Yes, false, "")},
- {0xb31c, 0, 0, 1, f(Yes, true, "")},
- {0xb31d, 0, 0, 2, f(Yes, false, "")},
- {0xb338, 0, 0, 1, f(Yes, true, "")},
- {0xb339, 0, 0, 2, f(Yes, false, "")},
- {0xb354, 0, 0, 1, f(Yes, true, "")},
- {0xb355, 0, 0, 2, f(Yes, false, "")},
- {0xb370, 0, 0, 1, f(Yes, true, "")},
- {0xb371, 0, 0, 2, f(Yes, false, "")},
- {0xb38c, 0, 0, 1, f(Yes, true, "")},
- {0xb38d, 0, 0, 2, f(Yes, false, "")},
- {0xb3a8, 0, 0, 1, f(Yes, true, "")},
- {0xb3a9, 0, 0, 2, f(Yes, false, "")},
- {0xb3c4, 0, 0, 1, f(Yes, true, "")},
- {0xb3c5, 0, 0, 2, f(Yes, false, "")},
- {0xb3e0, 0, 0, 1, f(Yes, true, "")},
- {0xb3e1, 0, 0, 2, f(Yes, false, "")},
- {0xb3fc, 0, 0, 1, f(Yes, true, "")},
- {0xb3fd, 0, 0, 2, f(Yes, false, "")},
- {0xb418, 0, 0, 1, f(Yes, true, "")},
- {0xb419, 0, 0, 2, f(Yes, false, "")},
- {0xb434, 0, 0, 1, f(Yes, true, "")},
- {0xb435, 0, 0, 2, f(Yes, false, "")},
- {0xb450, 0, 0, 1, f(Yes, true, "")},
- {0xb451, 0, 0, 2, f(Yes, false, "")},
- {0xb46c, 0, 0, 1, f(Yes, true, "")},
- {0xb46d, 0, 0, 2, f(Yes, false, "")},
- {0xb488, 0, 0, 1, f(Yes, true, "")},
- {0xb489, 0, 0, 2, f(Yes, false, "")},
- {0xb4a4, 0, 0, 1, f(Yes, true, "")},
- {0xb4a5, 0, 0, 2, f(Yes, false, "")},
- {0xb4c0, 0, 0, 1, f(Yes, true, "")},
- {0xb4c1, 0, 0, 2, f(Yes, false, "")},
- {0xb4dc, 0, 0, 1, f(Yes, true, "")},
- {0xb4dd, 0, 0, 2, f(Yes, false, "")},
- {0xb4f8, 0, 0, 1, f(Yes, true, "")},
- {0xb4f9, 0, 0, 2, f(Yes, false, "")},
- {0xb514, 0, 0, 1, f(Yes, true, "")},
- {0xb515, 0, 0, 2, f(Yes, false, "")},
- {0xb530, 0, 0, 1, f(Yes, true, "")},
- {0xb531, 0, 0, 2, f(Yes, false, "")},
- {0xb54c, 0, 0, 1, f(Yes, true, "")},
- {0xb54d, 0, 0, 2, f(Yes, false, "")},
- {0xb568, 0, 0, 1, f(Yes, true, "")},
- {0xb569, 0, 0, 2, f(Yes, false, "")},
- {0xb584, 0, 0, 1, f(Yes, true, "")},
- {0xb585, 0, 0, 2, f(Yes, false, "")},
- {0xb5a0, 0, 0, 1, f(Yes, true, "")},
- {0xb5a1, 0, 0, 2, f(Yes, false, "")},
- {0xb5bc, 0, 0, 1, f(Yes, true, "")},
- {0xb5bd, 0, 0, 2, f(Yes, false, "")},
- {0xb5d8, 0, 0, 1, f(Yes, true, "")},
- {0xb5d9, 0, 0, 2, f(Yes, false, "")},
- {0xb5f4, 0, 0, 1, f(Yes, true, "")},
- {0xb5f5, 0, 0, 2, f(Yes, false, "")},
- {0xb610, 0, 0, 1, f(Yes, true, "")},
- {0xb611, 0, 0, 2, f(Yes, false, "")},
- {0xb62c, 0, 0, 1, f(Yes, true, "")},
- {0xb62d, 0, 0, 2, f(Yes, false, "")},
- {0xb648, 0, 0, 1, f(Yes, true, "")},
- {0xb649, 0, 0, 2, f(Yes, false, "")},
- {0xb664, 0, 0, 1, f(Yes, true, "")},
- {0xb665, 0, 0, 2, f(Yes, false, "")},
- {0xb680, 0, 0, 1, f(Yes, true, "")},
- {0xb681, 0, 0, 2, f(Yes, false, "")},
- {0xb69c, 0, 0, 1, f(Yes, true, "")},
- {0xb69d, 0, 0, 2, f(Yes, false, "")},
- {0xb6b8, 0, 0, 1, f(Yes, true, "")},
- {0xb6b9, 0, 0, 2, f(Yes, false, "")},
- {0xb6d4, 0, 0, 1, f(Yes, true, "")},
- {0xb6d5, 0, 0, 2, f(Yes, false, "")},
- {0xb6f0, 0, 0, 1, f(Yes, true, "")},
- {0xb6f1, 0, 0, 2, f(Yes, false, "")},
- {0xb70c, 0, 0, 1, f(Yes, true, "")},
- {0xb70d, 0, 0, 2, f(Yes, false, "")},
- {0xb728, 0, 0, 1, f(Yes, true, "")},
- {0xb729, 0, 0, 2, f(Yes, false, "")},
- {0xb744, 0, 0, 1, f(Yes, true, "")},
- {0xb745, 0, 0, 2, f(Yes, false, "")},
- {0xb760, 0, 0, 1, f(Yes, true, "")},
- {0xb761, 0, 0, 2, f(Yes, false, "")},
- {0xb77c, 0, 0, 1, f(Yes, true, "")},
- {0xb77d, 0, 0, 2, f(Yes, false, "")},
- {0xb798, 0, 0, 1, f(Yes, true, "")},
- {0xb799, 0, 0, 2, f(Yes, false, "")},
- {0xb7b4, 0, 0, 1, f(Yes, true, "")},
- {0xb7b5, 0, 0, 2, f(Yes, false, "")},
- {0xb7d0, 0, 0, 1, f(Yes, true, "")},
- {0xb7d1, 0, 0, 2, f(Yes, false, "")},
- {0xb7ec, 0, 0, 1, f(Yes, true, "")},
- {0xb7ed, 0, 0, 2, f(Yes, false, "")},
- {0xb808, 0, 0, 1, f(Yes, true, "")},
- {0xb809, 0, 0, 2, f(Yes, false, "")},
- {0xb824, 0, 0, 1, f(Yes, true, "")},
- {0xb825, 0, 0, 2, f(Yes, false, "")},
- {0xb840, 0, 0, 1, f(Yes, true, "")},
- {0xb841, 0, 0, 2, f(Yes, false, "")},
- {0xb85c, 0, 0, 1, f(Yes, true, "")},
- {0xb85d, 0, 0, 2, f(Yes, false, "")},
- {0xb878, 0, 0, 1, f(Yes, true, "")},
- {0xb879, 0, 0, 2, f(Yes, false, "")},
- {0xb894, 0, 0, 1, f(Yes, true, "")},
- {0xb895, 0, 0, 2, f(Yes, false, "")},
- {0xb8b0, 0, 0, 1, f(Yes, true, "")},
- {0xb8b1, 0, 0, 2, f(Yes, false, "")},
- {0xb8cc, 0, 0, 1, f(Yes, true, "")},
- {0xb8cd, 0, 0, 2, f(Yes, false, "")},
- {0xb8e8, 0, 0, 1, f(Yes, true, "")},
- {0xb8e9, 0, 0, 2, f(Yes, false, "")},
- {0xb904, 0, 0, 1, f(Yes, true, "")},
- {0xb905, 0, 0, 2, f(Yes, false, "")},
- {0xb920, 0, 0, 1, f(Yes, true, "")},
- {0xb921, 0, 0, 2, f(Yes, false, "")},
- {0xb93c, 0, 0, 1, f(Yes, true, "")},
- {0xb93d, 0, 0, 2, f(Yes, false, "")},
- {0xb958, 0, 0, 1, f(Yes, true, "")},
- {0xb959, 0, 0, 2, f(Yes, false, "")},
- {0xb974, 0, 0, 1, f(Yes, true, "")},
- {0xb975, 0, 0, 2, f(Yes, false, "")},
- {0xb990, 0, 0, 1, f(Yes, true, "")},
- {0xb991, 0, 0, 2, f(Yes, false, "")},
- {0xb9ac, 0, 0, 1, f(Yes, true, "")},
- {0xb9ad, 0, 0, 2, f(Yes, false, "")},
- {0xb9c8, 0, 0, 1, f(Yes, true, "")},
- {0xb9c9, 0, 0, 2, f(Yes, false, "")},
- {0xb9e4, 0, 0, 1, f(Yes, true, "")},
- {0xb9e5, 0, 0, 2, f(Yes, false, "")},
- {0xba00, 0, 0, 1, f(Yes, true, "")},
- {0xba01, 0, 0, 2, f(Yes, false, "")},
- {0xba1c, 0, 0, 1, f(Yes, true, "")},
- {0xba1d, 0, 0, 2, f(Yes, false, "")},
- {0xba38, 0, 0, 1, f(Yes, true, "")},
- {0xba39, 0, 0, 2, f(Yes, false, "")},
- {0xba54, 0, 0, 1, f(Yes, true, "")},
- {0xba55, 0, 0, 2, f(Yes, false, "")},
- {0xba70, 0, 0, 1, f(Yes, true, "")},
- {0xba71, 0, 0, 2, f(Yes, false, "")},
- {0xba8c, 0, 0, 1, f(Yes, true, "")},
- {0xba8d, 0, 0, 2, f(Yes, false, "")},
- {0xbaa8, 0, 0, 1, f(Yes, true, "")},
- {0xbaa9, 0, 0, 2, f(Yes, false, "")},
- {0xbac4, 0, 0, 1, f(Yes, true, "")},
- {0xbac5, 0, 0, 2, f(Yes, false, "")},
- {0xbae0, 0, 0, 1, f(Yes, true, "")},
- {0xbae1, 0, 0, 2, f(Yes, false, "")},
- {0xbafc, 0, 0, 1, f(Yes, true, "")},
- {0xbafd, 0, 0, 2, f(Yes, false, "")},
- {0xbb18, 0, 0, 1, f(Yes, true, "")},
- {0xbb19, 0, 0, 2, f(Yes, false, "")},
- {0xbb34, 0, 0, 1, f(Yes, true, "")},
- {0xbb35, 0, 0, 2, f(Yes, false, "")},
- {0xbb50, 0, 0, 1, f(Yes, true, "")},
- {0xbb51, 0, 0, 2, f(Yes, false, "")},
- {0xbb6c, 0, 0, 1, f(Yes, true, "")},
- {0xbb6d, 0, 0, 2, f(Yes, false, "")},
- {0xbb88, 0, 0, 1, f(Yes, true, "")},
- {0xbb89, 0, 0, 2, f(Yes, false, "")},
- {0xbba4, 0, 0, 1, f(Yes, true, "")},
- {0xbba5, 0, 0, 2, f(Yes, false, "")},
- {0xbbc0, 0, 0, 1, f(Yes, true, "")},
- {0xbbc1, 0, 0, 2, f(Yes, false, "")},
- {0xbbdc, 0, 0, 1, f(Yes, true, "")},
- {0xbbdd, 0, 0, 2, f(Yes, false, "")},
- {0xbbf8, 0, 0, 1, f(Yes, true, "")},
- {0xbbf9, 0, 0, 2, f(Yes, false, "")},
- {0xbc14, 0, 0, 1, f(Yes, true, "")},
- {0xbc15, 0, 0, 2, f(Yes, false, "")},
- {0xbc30, 0, 0, 1, f(Yes, true, "")},
- {0xbc31, 0, 0, 2, f(Yes, false, "")},
- {0xbc4c, 0, 0, 1, f(Yes, true, "")},
- {0xbc4d, 0, 0, 2, f(Yes, false, "")},
- {0xbc68, 0, 0, 1, f(Yes, true, "")},
- {0xbc69, 0, 0, 2, f(Yes, false, "")},
- {0xbc84, 0, 0, 1, f(Yes, true, "")},
- {0xbc85, 0, 0, 2, f(Yes, false, "")},
- {0xbca0, 0, 0, 1, f(Yes, true, "")},
- {0xbca1, 0, 0, 2, f(Yes, false, "")},
- {0xbcbc, 0, 0, 1, f(Yes, true, "")},
- {0xbcbd, 0, 0, 2, f(Yes, false, "")},
- {0xbcd8, 0, 0, 1, f(Yes, true, "")},
- {0xbcd9, 0, 0, 2, f(Yes, false, "")},
- {0xbcf4, 0, 0, 1, f(Yes, true, "")},
- {0xbcf5, 0, 0, 2, f(Yes, false, "")},
- {0xbd10, 0, 0, 1, f(Yes, true, "")},
- {0xbd11, 0, 0, 2, f(Yes, false, "")},
- {0xbd2c, 0, 0, 1, f(Yes, true, "")},
- {0xbd2d, 0, 0, 2, f(Yes, false, "")},
- {0xbd48, 0, 0, 1, f(Yes, true, "")},
- {0xbd49, 0, 0, 2, f(Yes, false, "")},
- {0xbd64, 0, 0, 1, f(Yes, true, "")},
- {0xbd65, 0, 0, 2, f(Yes, false, "")},
- {0xbd80, 0, 0, 1, f(Yes, true, "")},
- {0xbd81, 0, 0, 2, f(Yes, false, "")},
- {0xbd9c, 0, 0, 1, f(Yes, true, "")},
- {0xbd9d, 0, 0, 2, f(Yes, false, "")},
- {0xbdb8, 0, 0, 1, f(Yes, true, "")},
- {0xbdb9, 0, 0, 2, f(Yes, false, "")},
- {0xbdd4, 0, 0, 1, f(Yes, true, "")},
- {0xbdd5, 0, 0, 2, f(Yes, false, "")},
- {0xbdf0, 0, 0, 1, f(Yes, true, "")},
- {0xbdf1, 0, 0, 2, f(Yes, false, "")},
- {0xbe0c, 0, 0, 1, f(Yes, true, "")},
- {0xbe0d, 0, 0, 2, f(Yes, false, "")},
- {0xbe28, 0, 0, 1, f(Yes, true, "")},
- {0xbe29, 0, 0, 2, f(Yes, false, "")},
- {0xbe44, 0, 0, 1, f(Yes, true, "")},
- {0xbe45, 0, 0, 2, f(Yes, false, "")},
- {0xbe60, 0, 0, 1, f(Yes, true, "")},
- {0xbe61, 0, 0, 2, f(Yes, false, "")},
- {0xbe7c, 0, 0, 1, f(Yes, true, "")},
- {0xbe7d, 0, 0, 2, f(Yes, false, "")},
- {0xbe98, 0, 0, 1, f(Yes, true, "")},
- {0xbe99, 0, 0, 2, f(Yes, false, "")},
- {0xbeb4, 0, 0, 1, f(Yes, true, "")},
- {0xbeb5, 0, 0, 2, f(Yes, false, "")},
- {0xbed0, 0, 0, 1, f(Yes, true, "")},
- {0xbed1, 0, 0, 2, f(Yes, false, "")},
- {0xbeec, 0, 0, 1, f(Yes, true, "")},
- {0xbeed, 0, 0, 2, f(Yes, false, "")},
- {0xbf08, 0, 0, 1, f(Yes, true, "")},
- {0xbf09, 0, 0, 2, f(Yes, false, "")},
- {0xbf24, 0, 0, 1, f(Yes, true, "")},
- {0xbf25, 0, 0, 2, f(Yes, false, "")},
- {0xbf40, 0, 0, 1, f(Yes, true, "")},
- {0xbf41, 0, 0, 2, f(Yes, false, "")},
- {0xbf5c, 0, 0, 1, f(Yes, true, "")},
- {0xbf5d, 0, 0, 2, f(Yes, false, "")},
- {0xbf78, 0, 0, 1, f(Yes, true, "")},
- {0xbf79, 0, 0, 2, f(Yes, false, "")},
- {0xbf94, 0, 0, 1, f(Yes, true, "")},
- {0xbf95, 0, 0, 2, f(Yes, false, "")},
- {0xbfb0, 0, 0, 1, f(Yes, true, "")},
- {0xbfb1, 0, 0, 2, f(Yes, false, "")},
- {0xbfcc, 0, 0, 1, f(Yes, true, "")},
- {0xbfcd, 0, 0, 2, f(Yes, false, "")},
- {0xbfe8, 0, 0, 1, f(Yes, true, "")},
- {0xbfe9, 0, 0, 2, f(Yes, false, "")},
- {0xc004, 0, 0, 1, f(Yes, true, "")},
- {0xc005, 0, 0, 2, f(Yes, false, "")},
- {0xc020, 0, 0, 1, f(Yes, true, "")},
- {0xc021, 0, 0, 2, f(Yes, false, "")},
- {0xc03c, 0, 0, 1, f(Yes, true, "")},
- {0xc03d, 0, 0, 2, f(Yes, false, "")},
- {0xc058, 0, 0, 1, f(Yes, true, "")},
- {0xc059, 0, 0, 2, f(Yes, false, "")},
- {0xc074, 0, 0, 1, f(Yes, true, "")},
- {0xc075, 0, 0, 2, f(Yes, false, "")},
- {0xc090, 0, 0, 1, f(Yes, true, "")},
- {0xc091, 0, 0, 2, f(Yes, false, "")},
- {0xc0ac, 0, 0, 1, f(Yes, true, "")},
- {0xc0ad, 0, 0, 2, f(Yes, false, "")},
- {0xc0c8, 0, 0, 1, f(Yes, true, "")},
- {0xc0c9, 0, 0, 2, f(Yes, false, "")},
- {0xc0e4, 0, 0, 1, f(Yes, true, "")},
- {0xc0e5, 0, 0, 2, f(Yes, false, "")},
- {0xc100, 0, 0, 1, f(Yes, true, "")},
- {0xc101, 0, 0, 2, f(Yes, false, "")},
- {0xc11c, 0, 0, 1, f(Yes, true, "")},
- {0xc11d, 0, 0, 2, f(Yes, false, "")},
- {0xc138, 0, 0, 1, f(Yes, true, "")},
- {0xc139, 0, 0, 2, f(Yes, false, "")},
- {0xc154, 0, 0, 1, f(Yes, true, "")},
- {0xc155, 0, 0, 2, f(Yes, false, "")},
- {0xc170, 0, 0, 1, f(Yes, true, "")},
- {0xc171, 0, 0, 2, f(Yes, false, "")},
- {0xc18c, 0, 0, 1, f(Yes, true, "")},
- {0xc18d, 0, 0, 2, f(Yes, false, "")},
- {0xc1a8, 0, 0, 1, f(Yes, true, "")},
- {0xc1a9, 0, 0, 2, f(Yes, false, "")},
- {0xc1c4, 0, 0, 1, f(Yes, true, "")},
- {0xc1c5, 0, 0, 2, f(Yes, false, "")},
- {0xc1e0, 0, 0, 1, f(Yes, true, "")},
- {0xc1e1, 0, 0, 2, f(Yes, false, "")},
- {0xc1fc, 0, 0, 1, f(Yes, true, "")},
- {0xc1fd, 0, 0, 2, f(Yes, false, "")},
- {0xc218, 0, 0, 1, f(Yes, true, "")},
- {0xc219, 0, 0, 2, f(Yes, false, "")},
- {0xc234, 0, 0, 1, f(Yes, true, "")},
- {0xc235, 0, 0, 2, f(Yes, false, "")},
- {0xc250, 0, 0, 1, f(Yes, true, "")},
- {0xc251, 0, 0, 2, f(Yes, false, "")},
- {0xc26c, 0, 0, 1, f(Yes, true, "")},
- {0xc26d, 0, 0, 2, f(Yes, false, "")},
- {0xc288, 0, 0, 1, f(Yes, true, "")},
- {0xc289, 0, 0, 2, f(Yes, false, "")},
- {0xc2a4, 0, 0, 1, f(Yes, true, "")},
- {0xc2a5, 0, 0, 2, f(Yes, false, "")},
- {0xc2c0, 0, 0, 1, f(Yes, true, "")},
- {0xc2c1, 0, 0, 2, f(Yes, false, "")},
- {0xc2dc, 0, 0, 1, f(Yes, true, "")},
- {0xc2dd, 0, 0, 2, f(Yes, false, "")},
- {0xc2f8, 0, 0, 1, f(Yes, true, "")},
- {0xc2f9, 0, 0, 2, f(Yes, false, "")},
- {0xc314, 0, 0, 1, f(Yes, true, "")},
- {0xc315, 0, 0, 2, f(Yes, false, "")},
- {0xc330, 0, 0, 1, f(Yes, true, "")},
- {0xc331, 0, 0, 2, f(Yes, false, "")},
- {0xc34c, 0, 0, 1, f(Yes, true, "")},
- {0xc34d, 0, 0, 2, f(Yes, false, "")},
- {0xc368, 0, 0, 1, f(Yes, true, "")},
- {0xc369, 0, 0, 2, f(Yes, false, "")},
- {0xc384, 0, 0, 1, f(Yes, true, "")},
- {0xc385, 0, 0, 2, f(Yes, false, "")},
- {0xc3a0, 0, 0, 1, f(Yes, true, "")},
- {0xc3a1, 0, 0, 2, f(Yes, false, "")},
- {0xc3bc, 0, 0, 1, f(Yes, true, "")},
- {0xc3bd, 0, 0, 2, f(Yes, false, "")},
- {0xc3d8, 0, 0, 1, f(Yes, true, "")},
- {0xc3d9, 0, 0, 2, f(Yes, false, "")},
- {0xc3f4, 0, 0, 1, f(Yes, true, "")},
- {0xc3f5, 0, 0, 2, f(Yes, false, "")},
- {0xc410, 0, 0, 1, f(Yes, true, "")},
- {0xc411, 0, 0, 2, f(Yes, false, "")},
- {0xc42c, 0, 0, 1, f(Yes, true, "")},
- {0xc42d, 0, 0, 2, f(Yes, false, "")},
- {0xc448, 0, 0, 1, f(Yes, true, "")},
- {0xc449, 0, 0, 2, f(Yes, false, "")},
- {0xc464, 0, 0, 1, f(Yes, true, "")},
- {0xc465, 0, 0, 2, f(Yes, false, "")},
- {0xc480, 0, 0, 1, f(Yes, true, "")},
- {0xc481, 0, 0, 2, f(Yes, false, "")},
- {0xc49c, 0, 0, 1, f(Yes, true, "")},
- {0xc49d, 0, 0, 2, f(Yes, false, "")},
- {0xc4b8, 0, 0, 1, f(Yes, true, "")},
- {0xc4b9, 0, 0, 2, f(Yes, false, "")},
- {0xc4d4, 0, 0, 1, f(Yes, true, "")},
- {0xc4d5, 0, 0, 2, f(Yes, false, "")},
- {0xc4f0, 0, 0, 1, f(Yes, true, "")},
- {0xc4f1, 0, 0, 2, f(Yes, false, "")},
- {0xc50c, 0, 0, 1, f(Yes, true, "")},
- {0xc50d, 0, 0, 2, f(Yes, false, "")},
- {0xc528, 0, 0, 1, f(Yes, true, "")},
- {0xc529, 0, 0, 2, f(Yes, false, "")},
- {0xc544, 0, 0, 1, f(Yes, true, "")},
- {0xc545, 0, 0, 2, f(Yes, false, "")},
- {0xc560, 0, 0, 1, f(Yes, true, "")},
- {0xc561, 0, 0, 2, f(Yes, false, "")},
- {0xc57c, 0, 0, 1, f(Yes, true, "")},
- {0xc57d, 0, 0, 2, f(Yes, false, "")},
- {0xc598, 0, 0, 1, f(Yes, true, "")},
- {0xc599, 0, 0, 2, f(Yes, false, "")},
- {0xc5b4, 0, 0, 1, f(Yes, true, "")},
- {0xc5b5, 0, 0, 2, f(Yes, false, "")},
- {0xc5d0, 0, 0, 1, f(Yes, true, "")},
- {0xc5d1, 0, 0, 2, f(Yes, false, "")},
- {0xc5ec, 0, 0, 1, f(Yes, true, "")},
- {0xc5ed, 0, 0, 2, f(Yes, false, "")},
- {0xc608, 0, 0, 1, f(Yes, true, "")},
- {0xc609, 0, 0, 2, f(Yes, false, "")},
- {0xc624, 0, 0, 1, f(Yes, true, "")},
- {0xc625, 0, 0, 2, f(Yes, false, "")},
- {0xc640, 0, 0, 1, f(Yes, true, "")},
- {0xc641, 0, 0, 2, f(Yes, false, "")},
- {0xc65c, 0, 0, 1, f(Yes, true, "")},
- {0xc65d, 0, 0, 2, f(Yes, false, "")},
- {0xc678, 0, 0, 1, f(Yes, true, "")},
- {0xc679, 0, 0, 2, f(Yes, false, "")},
- {0xc694, 0, 0, 1, f(Yes, true, "")},
- {0xc695, 0, 0, 2, f(Yes, false, "")},
- {0xc6b0, 0, 0, 1, f(Yes, true, "")},
- {0xc6b1, 0, 0, 2, f(Yes, false, "")},
- {0xc6cc, 0, 0, 1, f(Yes, true, "")},
- {0xc6cd, 0, 0, 2, f(Yes, false, "")},
- {0xc6e8, 0, 0, 1, f(Yes, true, "")},
- {0xc6e9, 0, 0, 2, f(Yes, false, "")},
- {0xc704, 0, 0, 1, f(Yes, true, "")},
- {0xc705, 0, 0, 2, f(Yes, false, "")},
- {0xc720, 0, 0, 1, f(Yes, true, "")},
- {0xc721, 0, 0, 2, f(Yes, false, "")},
- {0xc73c, 0, 0, 1, f(Yes, true, "")},
- {0xc73d, 0, 0, 2, f(Yes, false, "")},
- {0xc758, 0, 0, 1, f(Yes, true, "")},
- {0xc759, 0, 0, 2, f(Yes, false, "")},
- {0xc774, 0, 0, 1, f(Yes, true, "")},
- {0xc775, 0, 0, 2, f(Yes, false, "")},
- {0xc790, 0, 0, 1, f(Yes, true, "")},
- {0xc791, 0, 0, 2, f(Yes, false, "")},
- {0xc7ac, 0, 0, 1, f(Yes, true, "")},
- {0xc7ad, 0, 0, 2, f(Yes, false, "")},
- {0xc7c8, 0, 0, 1, f(Yes, true, "")},
- {0xc7c9, 0, 0, 2, f(Yes, false, "")},
- {0xc7e4, 0, 0, 1, f(Yes, true, "")},
- {0xc7e5, 0, 0, 2, f(Yes, false, "")},
- {0xc800, 0, 0, 1, f(Yes, true, "")},
- {0xc801, 0, 0, 2, f(Yes, false, "")},
- {0xc81c, 0, 0, 1, f(Yes, true, "")},
- {0xc81d, 0, 0, 2, f(Yes, false, "")},
- {0xc838, 0, 0, 1, f(Yes, true, "")},
- {0xc839, 0, 0, 2, f(Yes, false, "")},
- {0xc854, 0, 0, 1, f(Yes, true, "")},
- {0xc855, 0, 0, 2, f(Yes, false, "")},
- {0xc870, 0, 0, 1, f(Yes, true, "")},
- {0xc871, 0, 0, 2, f(Yes, false, "")},
- {0xc88c, 0, 0, 1, f(Yes, true, "")},
- {0xc88d, 0, 0, 2, f(Yes, false, "")},
- {0xc8a8, 0, 0, 1, f(Yes, true, "")},
- {0xc8a9, 0, 0, 2, f(Yes, false, "")},
- {0xc8c4, 0, 0, 1, f(Yes, true, "")},
- {0xc8c5, 0, 0, 2, f(Yes, false, "")},
- {0xc8e0, 0, 0, 1, f(Yes, true, "")},
- {0xc8e1, 0, 0, 2, f(Yes, false, "")},
- {0xc8fc, 0, 0, 1, f(Yes, true, "")},
- {0xc8fd, 0, 0, 2, f(Yes, false, "")},
- {0xc918, 0, 0, 1, f(Yes, true, "")},
- {0xc919, 0, 0, 2, f(Yes, false, "")},
- {0xc934, 0, 0, 1, f(Yes, true, "")},
- {0xc935, 0, 0, 2, f(Yes, false, "")},
- {0xc950, 0, 0, 1, f(Yes, true, "")},
- {0xc951, 0, 0, 2, f(Yes, false, "")},
- {0xc96c, 0, 0, 1, f(Yes, true, "")},
- {0xc96d, 0, 0, 2, f(Yes, false, "")},
- {0xc988, 0, 0, 1, f(Yes, true, "")},
- {0xc989, 0, 0, 2, f(Yes, false, "")},
- {0xc9a4, 0, 0, 1, f(Yes, true, "")},
- {0xc9a5, 0, 0, 2, f(Yes, false, "")},
- {0xc9c0, 0, 0, 1, f(Yes, true, "")},
- {0xc9c1, 0, 0, 2, f(Yes, false, "")},
- {0xc9dc, 0, 0, 1, f(Yes, true, "")},
- {0xc9dd, 0, 0, 2, f(Yes, false, "")},
- {0xc9f8, 0, 0, 1, f(Yes, true, "")},
- {0xc9f9, 0, 0, 2, f(Yes, false, "")},
- {0xca14, 0, 0, 1, f(Yes, true, "")},
- {0xca15, 0, 0, 2, f(Yes, false, "")},
- {0xca30, 0, 0, 1, f(Yes, true, "")},
- {0xca31, 0, 0, 2, f(Yes, false, "")},
- {0xca4c, 0, 0, 1, f(Yes, true, "")},
- {0xca4d, 0, 0, 2, f(Yes, false, "")},
- {0xca68, 0, 0, 1, f(Yes, true, "")},
- {0xca69, 0, 0, 2, f(Yes, false, "")},
- {0xca84, 0, 0, 1, f(Yes, true, "")},
- {0xca85, 0, 0, 2, f(Yes, false, "")},
- {0xcaa0, 0, 0, 1, f(Yes, true, "")},
- {0xcaa1, 0, 0, 2, f(Yes, false, "")},
- {0xcabc, 0, 0, 1, f(Yes, true, "")},
- {0xcabd, 0, 0, 2, f(Yes, false, "")},
- {0xcad8, 0, 0, 1, f(Yes, true, "")},
- {0xcad9, 0, 0, 2, f(Yes, false, "")},
- {0xcaf4, 0, 0, 1, f(Yes, true, "")},
- {0xcaf5, 0, 0, 2, f(Yes, false, "")},
- {0xcb10, 0, 0, 1, f(Yes, true, "")},
- {0xcb11, 0, 0, 2, f(Yes, false, "")},
- {0xcb2c, 0, 0, 1, f(Yes, true, "")},
- {0xcb2d, 0, 0, 2, f(Yes, false, "")},
- {0xcb48, 0, 0, 1, f(Yes, true, "")},
- {0xcb49, 0, 0, 2, f(Yes, false, "")},
- {0xcb64, 0, 0, 1, f(Yes, true, "")},
- {0xcb65, 0, 0, 2, f(Yes, false, "")},
- {0xcb80, 0, 0, 1, f(Yes, true, "")},
- {0xcb81, 0, 0, 2, f(Yes, false, "")},
- {0xcb9c, 0, 0, 1, f(Yes, true, "")},
- {0xcb9d, 0, 0, 2, f(Yes, false, "")},
- {0xcbb8, 0, 0, 1, f(Yes, true, "")},
- {0xcbb9, 0, 0, 2, f(Yes, false, "")},
- {0xcbd4, 0, 0, 1, f(Yes, true, "")},
- {0xcbd5, 0, 0, 2, f(Yes, false, "")},
- {0xcbf0, 0, 0, 1, f(Yes, true, "")},
- {0xcbf1, 0, 0, 2, f(Yes, false, "")},
- {0xcc0c, 0, 0, 1, f(Yes, true, "")},
- {0xcc0d, 0, 0, 2, f(Yes, false, "")},
- {0xcc28, 0, 0, 1, f(Yes, true, "")},
- {0xcc29, 0, 0, 2, f(Yes, false, "")},
- {0xcc44, 0, 0, 1, f(Yes, true, "")},
- {0xcc45, 0, 0, 2, f(Yes, false, "")},
- {0xcc60, 0, 0, 1, f(Yes, true, "")},
- {0xcc61, 0, 0, 2, f(Yes, false, "")},
- {0xcc7c, 0, 0, 1, f(Yes, true, "")},
- {0xcc7d, 0, 0, 2, f(Yes, false, "")},
- {0xcc98, 0, 0, 1, f(Yes, true, "")},
- {0xcc99, 0, 0, 2, f(Yes, false, "")},
- {0xccb4, 0, 0, 1, f(Yes, true, "")},
- {0xccb5, 0, 0, 2, f(Yes, false, "")},
- {0xccd0, 0, 0, 1, f(Yes, true, "")},
- {0xccd1, 0, 0, 2, f(Yes, false, "")},
- {0xccec, 0, 0, 1, f(Yes, true, "")},
- {0xcced, 0, 0, 2, f(Yes, false, "")},
- {0xcd08, 0, 0, 1, f(Yes, true, "")},
- {0xcd09, 0, 0, 2, f(Yes, false, "")},
- {0xcd24, 0, 0, 1, f(Yes, true, "")},
- {0xcd25, 0, 0, 2, f(Yes, false, "")},
- {0xcd40, 0, 0, 1, f(Yes, true, "")},
- {0xcd41, 0, 0, 2, f(Yes, false, "")},
- {0xcd5c, 0, 0, 1, f(Yes, true, "")},
- {0xcd5d, 0, 0, 2, f(Yes, false, "")},
- {0xcd78, 0, 0, 1, f(Yes, true, "")},
- {0xcd79, 0, 0, 2, f(Yes, false, "")},
- {0xcd94, 0, 0, 1, f(Yes, true, "")},
- {0xcd95, 0, 0, 2, f(Yes, false, "")},
- {0xcdb0, 0, 0, 1, f(Yes, true, "")},
- {0xcdb1, 0, 0, 2, f(Yes, false, "")},
- {0xcdcc, 0, 0, 1, f(Yes, true, "")},
- {0xcdcd, 0, 0, 2, f(Yes, false, "")},
- {0xcde8, 0, 0, 1, f(Yes, true, "")},
- {0xcde9, 0, 0, 2, f(Yes, false, "")},
- {0xce04, 0, 0, 1, f(Yes, true, "")},
- {0xce05, 0, 0, 2, f(Yes, false, "")},
- {0xce20, 0, 0, 1, f(Yes, true, "")},
- {0xce21, 0, 0, 2, f(Yes, false, "")},
- {0xce3c, 0, 0, 1, f(Yes, true, "")},
- {0xce3d, 0, 0, 2, f(Yes, false, "")},
- {0xce58, 0, 0, 1, f(Yes, true, "")},
- {0xce59, 0, 0, 2, f(Yes, false, "")},
- {0xce74, 0, 0, 1, f(Yes, true, "")},
- {0xce75, 0, 0, 2, f(Yes, false, "")},
- {0xce90, 0, 0, 1, f(Yes, true, "")},
- {0xce91, 0, 0, 2, f(Yes, false, "")},
- {0xceac, 0, 0, 1, f(Yes, true, "")},
- {0xcead, 0, 0, 2, f(Yes, false, "")},
- {0xcec8, 0, 0, 1, f(Yes, true, "")},
- {0xcec9, 0, 0, 2, f(Yes, false, "")},
- {0xcee4, 0, 0, 1, f(Yes, true, "")},
- {0xcee5, 0, 0, 2, f(Yes, false, "")},
- {0xcf00, 0, 0, 1, f(Yes, true, "")},
- {0xcf01, 0, 0, 2, f(Yes, false, "")},
- {0xcf1c, 0, 0, 1, f(Yes, true, "")},
- {0xcf1d, 0, 0, 2, f(Yes, false, "")},
- {0xcf38, 0, 0, 1, f(Yes, true, "")},
- {0xcf39, 0, 0, 2, f(Yes, false, "")},
- {0xcf54, 0, 0, 1, f(Yes, true, "")},
- {0xcf55, 0, 0, 2, f(Yes, false, "")},
- {0xcf70, 0, 0, 1, f(Yes, true, "")},
- {0xcf71, 0, 0, 2, f(Yes, false, "")},
- {0xcf8c, 0, 0, 1, f(Yes, true, "")},
- {0xcf8d, 0, 0, 2, f(Yes, false, "")},
- {0xcfa8, 0, 0, 1, f(Yes, true, "")},
- {0xcfa9, 0, 0, 2, f(Yes, false, "")},
- {0xcfc4, 0, 0, 1, f(Yes, true, "")},
- {0xcfc5, 0, 0, 2, f(Yes, false, "")},
- {0xcfe0, 0, 0, 1, f(Yes, true, "")},
- {0xcfe1, 0, 0, 2, f(Yes, false, "")},
- {0xcffc, 0, 0, 1, f(Yes, true, "")},
- {0xcffd, 0, 0, 2, f(Yes, false, "")},
- {0xd018, 0, 0, 1, f(Yes, true, "")},
- {0xd019, 0, 0, 2, f(Yes, false, "")},
- {0xd034, 0, 0, 1, f(Yes, true, "")},
- {0xd035, 0, 0, 2, f(Yes, false, "")},
- {0xd050, 0, 0, 1, f(Yes, true, "")},
- {0xd051, 0, 0, 2, f(Yes, false, "")},
- {0xd06c, 0, 0, 1, f(Yes, true, "")},
- {0xd06d, 0, 0, 2, f(Yes, false, "")},
- {0xd088, 0, 0, 1, f(Yes, true, "")},
- {0xd089, 0, 0, 2, f(Yes, false, "")},
- {0xd0a4, 0, 0, 1, f(Yes, true, "")},
- {0xd0a5, 0, 0, 2, f(Yes, false, "")},
- {0xd0c0, 0, 0, 1, f(Yes, true, "")},
- {0xd0c1, 0, 0, 2, f(Yes, false, "")},
- {0xd0dc, 0, 0, 1, f(Yes, true, "")},
- {0xd0dd, 0, 0, 2, f(Yes, false, "")},
- {0xd0f8, 0, 0, 1, f(Yes, true, "")},
- {0xd0f9, 0, 0, 2, f(Yes, false, "")},
- {0xd114, 0, 0, 1, f(Yes, true, "")},
- {0xd115, 0, 0, 2, f(Yes, false, "")},
- {0xd130, 0, 0, 1, f(Yes, true, "")},
- {0xd131, 0, 0, 2, f(Yes, false, "")},
- {0xd14c, 0, 0, 1, f(Yes, true, "")},
- {0xd14d, 0, 0, 2, f(Yes, false, "")},
- {0xd168, 0, 0, 1, f(Yes, true, "")},
- {0xd169, 0, 0, 2, f(Yes, false, "")},
- {0xd184, 0, 0, 1, f(Yes, true, "")},
- {0xd185, 0, 0, 2, f(Yes, false, "")},
- {0xd1a0, 0, 0, 1, f(Yes, true, "")},
- {0xd1a1, 0, 0, 2, f(Yes, false, "")},
- {0xd1bc, 0, 0, 1, f(Yes, true, "")},
- {0xd1bd, 0, 0, 2, f(Yes, false, "")},
- {0xd1d8, 0, 0, 1, f(Yes, true, "")},
- {0xd1d9, 0, 0, 2, f(Yes, false, "")},
- {0xd1f4, 0, 0, 1, f(Yes, true, "")},
- {0xd1f5, 0, 0, 2, f(Yes, false, "")},
- {0xd210, 0, 0, 1, f(Yes, true, "")},
- {0xd211, 0, 0, 2, f(Yes, false, "")},
- {0xd22c, 0, 0, 1, f(Yes, true, "")},
- {0xd22d, 0, 0, 2, f(Yes, false, "")},
- {0xd248, 0, 0, 1, f(Yes, true, "")},
- {0xd249, 0, 0, 2, f(Yes, false, "")},
- {0xd264, 0, 0, 1, f(Yes, true, "")},
- {0xd265, 0, 0, 2, f(Yes, false, "")},
- {0xd280, 0, 0, 1, f(Yes, true, "")},
- {0xd281, 0, 0, 2, f(Yes, false, "")},
- {0xd29c, 0, 0, 1, f(Yes, true, "")},
- {0xd29d, 0, 0, 2, f(Yes, false, "")},
- {0xd2b8, 0, 0, 1, f(Yes, true, "")},
- {0xd2b9, 0, 0, 2, f(Yes, false, "")},
- {0xd2d4, 0, 0, 1, f(Yes, true, "")},
- {0xd2d5, 0, 0, 2, f(Yes, false, "")},
- {0xd2f0, 0, 0, 1, f(Yes, true, "")},
- {0xd2f1, 0, 0, 2, f(Yes, false, "")},
- {0xd30c, 0, 0, 1, f(Yes, true, "")},
- {0xd30d, 0, 0, 2, f(Yes, false, "")},
- {0xd328, 0, 0, 1, f(Yes, true, "")},
- {0xd329, 0, 0, 2, f(Yes, false, "")},
- {0xd344, 0, 0, 1, f(Yes, true, "")},
- {0xd345, 0, 0, 2, f(Yes, false, "")},
- {0xd360, 0, 0, 1, f(Yes, true, "")},
- {0xd361, 0, 0, 2, f(Yes, false, "")},
- {0xd37c, 0, 0, 1, f(Yes, true, "")},
- {0xd37d, 0, 0, 2, f(Yes, false, "")},
- {0xd398, 0, 0, 1, f(Yes, true, "")},
- {0xd399, 0, 0, 2, f(Yes, false, "")},
- {0xd3b4, 0, 0, 1, f(Yes, true, "")},
- {0xd3b5, 0, 0, 2, f(Yes, false, "")},
- {0xd3d0, 0, 0, 1, f(Yes, true, "")},
- {0xd3d1, 0, 0, 2, f(Yes, false, "")},
- {0xd3ec, 0, 0, 1, f(Yes, true, "")},
- {0xd3ed, 0, 0, 2, f(Yes, false, "")},
- {0xd408, 0, 0, 1, f(Yes, true, "")},
- {0xd409, 0, 0, 2, f(Yes, false, "")},
- {0xd424, 0, 0, 1, f(Yes, true, "")},
- {0xd425, 0, 0, 2, f(Yes, false, "")},
- {0xd440, 0, 0, 1, f(Yes, true, "")},
- {0xd441, 0, 0, 2, f(Yes, false, "")},
- {0xd45c, 0, 0, 1, f(Yes, true, "")},
- {0xd45d, 0, 0, 2, f(Yes, false, "")},
- {0xd478, 0, 0, 1, f(Yes, true, "")},
- {0xd479, 0, 0, 2, f(Yes, false, "")},
- {0xd494, 0, 0, 1, f(Yes, true, "")},
- {0xd495, 0, 0, 2, f(Yes, false, "")},
- {0xd4b0, 0, 0, 1, f(Yes, true, "")},
- {0xd4b1, 0, 0, 2, f(Yes, false, "")},
- {0xd4cc, 0, 0, 1, f(Yes, true, "")},
- {0xd4cd, 0, 0, 2, f(Yes, false, "")},
- {0xd4e8, 0, 0, 1, f(Yes, true, "")},
- {0xd4e9, 0, 0, 2, f(Yes, false, "")},
- {0xd504, 0, 0, 1, f(Yes, true, "")},
- {0xd505, 0, 0, 2, f(Yes, false, "")},
- {0xd520, 0, 0, 1, f(Yes, true, "")},
- {0xd521, 0, 0, 2, f(Yes, false, "")},
- {0xd53c, 0, 0, 1, f(Yes, true, "")},
- {0xd53d, 0, 0, 2, f(Yes, false, "")},
- {0xd558, 0, 0, 1, f(Yes, true, "")},
- {0xd559, 0, 0, 2, f(Yes, false, "")},
- {0xd574, 0, 0, 1, f(Yes, true, "")},
- {0xd575, 0, 0, 2, f(Yes, false, "")},
- {0xd590, 0, 0, 1, f(Yes, true, "")},
- {0xd591, 0, 0, 2, f(Yes, false, "")},
- {0xd5ac, 0, 0, 1, f(Yes, true, "")},
- {0xd5ad, 0, 0, 2, f(Yes, false, "")},
- {0xd5c8, 0, 0, 1, f(Yes, true, "")},
- {0xd5c9, 0, 0, 2, f(Yes, false, "")},
- {0xd5e4, 0, 0, 1, f(Yes, true, "")},
- {0xd5e5, 0, 0, 2, f(Yes, false, "")},
- {0xd600, 0, 0, 1, f(Yes, true, "")},
- {0xd601, 0, 0, 2, f(Yes, false, "")},
- {0xd61c, 0, 0, 1, f(Yes, true, "")},
- {0xd61d, 0, 0, 2, f(Yes, false, "")},
- {0xd638, 0, 0, 1, f(Yes, true, "")},
- {0xd639, 0, 0, 2, f(Yes, false, "")},
- {0xd654, 0, 0, 1, f(Yes, true, "")},
- {0xd655, 0, 0, 2, f(Yes, false, "")},
- {0xd670, 0, 0, 1, f(Yes, true, "")},
- {0xd671, 0, 0, 2, f(Yes, false, "")},
- {0xd68c, 0, 0, 1, f(Yes, true, "")},
- {0xd68d, 0, 0, 2, f(Yes, false, "")},
- {0xd6a8, 0, 0, 1, f(Yes, true, "")},
- {0xd6a9, 0, 0, 2, f(Yes, false, "")},
- {0xd6c4, 0, 0, 1, f(Yes, true, "")},
- {0xd6c5, 0, 0, 2, f(Yes, false, "")},
- {0xd6e0, 0, 0, 1, f(Yes, true, "")},
- {0xd6e1, 0, 0, 2, f(Yes, false, "")},
- {0xd6fc, 0, 0, 1, f(Yes, true, "")},
- {0xd6fd, 0, 0, 2, f(Yes, false, "")},
- {0xd718, 0, 0, 1, f(Yes, true, "")},
- {0xd719, 0, 0, 2, f(Yes, false, "")},
- {0xd734, 0, 0, 1, f(Yes, true, "")},
- {0xd735, 0, 0, 2, f(Yes, false, "")},
- {0xd750, 0, 0, 1, f(Yes, true, "")},
- {0xd751, 0, 0, 2, f(Yes, false, "")},
- {0xd76c, 0, 0, 1, f(Yes, true, "")},
- {0xd76d, 0, 0, 2, f(Yes, false, "")},
- {0xd788, 0, 0, 1, f(Yes, true, "")},
- {0xd789, 0, 0, 2, f(Yes, false, "")},
- {0xd7a4, 0, 0, 0, f(Yes, false, "")},
- {0xf900, 0, 0, 0, f(No, false, "豈")},
- {0xf901, 0, 0, 0, f(No, false, "更")},
- {0xf902, 0, 0, 0, f(No, false, "車")},
- {0xf903, 0, 0, 0, f(No, false, "賈")},
- {0xf904, 0, 0, 0, f(No, false, "滑")},
- {0xf905, 0, 0, 0, f(No, false, "串")},
- {0xf906, 0, 0, 0, f(No, false, "句")},
- {0xf907, 0, 0, 0, f(No, false, "龜")},
- {0xf909, 0, 0, 0, f(No, false, "契")},
- {0xf90a, 0, 0, 0, f(No, false, "金")},
- {0xf90b, 0, 0, 0, f(No, false, "喇")},
- {0xf90c, 0, 0, 0, f(No, false, "奈")},
- {0xf90d, 0, 0, 0, f(No, false, "懶")},
- {0xf90e, 0, 0, 0, f(No, false, "癩")},
- {0xf90f, 0, 0, 0, f(No, false, "羅")},
- {0xf910, 0, 0, 0, f(No, false, "蘿")},
- {0xf911, 0, 0, 0, f(No, false, "螺")},
- {0xf912, 0, 0, 0, f(No, false, "裸")},
- {0xf913, 0, 0, 0, f(No, false, "邏")},
- {0xf914, 0, 0, 0, f(No, false, "樂")},
- {0xf915, 0, 0, 0, f(No, false, "洛")},
- {0xf916, 0, 0, 0, f(No, false, "烙")},
- {0xf917, 0, 0, 0, f(No, false, "珞")},
- {0xf918, 0, 0, 0, f(No, false, "落")},
- {0xf919, 0, 0, 0, f(No, false, "酪")},
- {0xf91a, 0, 0, 0, f(No, false, "駱")},
- {0xf91b, 0, 0, 0, f(No, false, "亂")},
- {0xf91c, 0, 0, 0, f(No, false, "卵")},
- {0xf91d, 0, 0, 0, f(No, false, "欄")},
- {0xf91e, 0, 0, 0, f(No, false, "爛")},
- {0xf91f, 0, 0, 0, f(No, false, "蘭")},
- {0xf920, 0, 0, 0, f(No, false, "鸞")},
- {0xf921, 0, 0, 0, f(No, false, "嵐")},
- {0xf922, 0, 0, 0, f(No, false, "濫")},
- {0xf923, 0, 0, 0, f(No, false, "藍")},
- {0xf924, 0, 0, 0, f(No, false, "襤")},
- {0xf925, 0, 0, 0, f(No, false, "拉")},
- {0xf926, 0, 0, 0, f(No, false, "臘")},
- {0xf927, 0, 0, 0, f(No, false, "蠟")},
- {0xf928, 0, 0, 0, f(No, false, "廊")},
- {0xf929, 0, 0, 0, f(No, false, "朗")},
- {0xf92a, 0, 0, 0, f(No, false, "浪")},
- {0xf92b, 0, 0, 0, f(No, false, "狼")},
- {0xf92c, 0, 0, 0, f(No, false, "郎")},
- {0xf92d, 0, 0, 0, f(No, false, "來")},
- {0xf92e, 0, 0, 0, f(No, false, "冷")},
- {0xf92f, 0, 0, 0, f(No, false, "勞")},
- {0xf930, 0, 0, 0, f(No, false, "擄")},
- {0xf931, 0, 0, 0, f(No, false, "櫓")},
- {0xf932, 0, 0, 0, f(No, false, "爐")},
- {0xf933, 0, 0, 0, f(No, false, "盧")},
- {0xf934, 0, 0, 0, f(No, false, "老")},
- {0xf935, 0, 0, 0, f(No, false, "蘆")},
- {0xf936, 0, 0, 0, f(No, false, "虜")},
- {0xf937, 0, 0, 0, f(No, false, "路")},
- {0xf938, 0, 0, 0, f(No, false, "露")},
- {0xf939, 0, 0, 0, f(No, false, "魯")},
- {0xf93a, 0, 0, 0, f(No, false, "鷺")},
- {0xf93b, 0, 0, 0, f(No, false, "碌")},
- {0xf93c, 0, 0, 0, f(No, false, "祿")},
- {0xf93d, 0, 0, 0, f(No, false, "綠")},
- {0xf93e, 0, 0, 0, f(No, false, "菉")},
- {0xf93f, 0, 0, 0, f(No, false, "錄")},
- {0xf940, 0, 0, 0, f(No, false, "鹿")},
- {0xf941, 0, 0, 0, f(No, false, "論")},
- {0xf942, 0, 0, 0, f(No, false, "壟")},
- {0xf943, 0, 0, 0, f(No, false, "弄")},
- {0xf944, 0, 0, 0, f(No, false, "籠")},
- {0xf945, 0, 0, 0, f(No, false, "聾")},
- {0xf946, 0, 0, 0, f(No, false, "牢")},
- {0xf947, 0, 0, 0, f(No, false, "磊")},
- {0xf948, 0, 0, 0, f(No, false, "賂")},
- {0xf949, 0, 0, 0, f(No, false, "雷")},
- {0xf94a, 0, 0, 0, f(No, false, "壘")},
- {0xf94b, 0, 0, 0, f(No, false, "屢")},
- {0xf94c, 0, 0, 0, f(No, false, "樓")},
- {0xf94d, 0, 0, 0, f(No, false, "淚")},
- {0xf94e, 0, 0, 0, f(No, false, "漏")},
- {0xf94f, 0, 0, 0, f(No, false, "累")},
- {0xf950, 0, 0, 0, f(No, false, "縷")},
- {0xf951, 0, 0, 0, f(No, false, "陋")},
- {0xf952, 0, 0, 0, f(No, false, "勒")},
- {0xf953, 0, 0, 0, f(No, false, "肋")},
- {0xf954, 0, 0, 0, f(No, false, "凜")},
- {0xf955, 0, 0, 0, f(No, false, "凌")},
- {0xf956, 0, 0, 0, f(No, false, "稜")},
- {0xf957, 0, 0, 0, f(No, false, "綾")},
- {0xf958, 0, 0, 0, f(No, false, "菱")},
- {0xf959, 0, 0, 0, f(No, false, "陵")},
- {0xf95a, 0, 0, 0, f(No, false, "讀")},
- {0xf95b, 0, 0, 0, f(No, false, "拏")},
- {0xf95c, 0, 0, 0, f(No, false, "樂")},
- {0xf95d, 0, 0, 0, f(No, false, "諾")},
- {0xf95e, 0, 0, 0, f(No, false, "丹")},
- {0xf95f, 0, 0, 0, f(No, false, "寧")},
- {0xf960, 0, 0, 0, f(No, false, "怒")},
- {0xf961, 0, 0, 0, f(No, false, "率")},
- {0xf962, 0, 0, 0, f(No, false, "異")},
- {0xf963, 0, 0, 0, f(No, false, "北")},
- {0xf964, 0, 0, 0, f(No, false, "磻")},
- {0xf965, 0, 0, 0, f(No, false, "便")},
- {0xf966, 0, 0, 0, f(No, false, "復")},
- {0xf967, 0, 0, 0, f(No, false, "不")},
- {0xf968, 0, 0, 0, f(No, false, "泌")},
- {0xf969, 0, 0, 0, f(No, false, "數")},
- {0xf96a, 0, 0, 0, f(No, false, "索")},
- {0xf96b, 0, 0, 0, f(No, false, "參")},
- {0xf96c, 0, 0, 0, f(No, false, "塞")},
- {0xf96d, 0, 0, 0, f(No, false, "省")},
- {0xf96e, 0, 0, 0, f(No, false, "葉")},
- {0xf96f, 0, 0, 0, f(No, false, "說")},
- {0xf970, 0, 0, 0, f(No, false, "殺")},
- {0xf971, 0, 0, 0, f(No, false, "辰")},
- {0xf972, 0, 0, 0, f(No, false, "沈")},
- {0xf973, 0, 0, 0, f(No, false, "拾")},
- {0xf974, 0, 0, 0, f(No, false, "若")},
- {0xf975, 0, 0, 0, f(No, false, "掠")},
- {0xf976, 0, 0, 0, f(No, false, "略")},
- {0xf977, 0, 0, 0, f(No, false, "亮")},
- {0xf978, 0, 0, 0, f(No, false, "兩")},
- {0xf979, 0, 0, 0, f(No, false, "凉")},
- {0xf97a, 0, 0, 0, f(No, false, "梁")},
- {0xf97b, 0, 0, 0, f(No, false, "糧")},
- {0xf97c, 0, 0, 0, f(No, false, "良")},
- {0xf97d, 0, 0, 0, f(No, false, "諒")},
- {0xf97e, 0, 0, 0, f(No, false, "量")},
- {0xf97f, 0, 0, 0, f(No, false, "勵")},
- {0xf980, 0, 0, 0, f(No, false, "呂")},
- {0xf981, 0, 0, 0, f(No, false, "女")},
- {0xf982, 0, 0, 0, f(No, false, "廬")},
- {0xf983, 0, 0, 0, f(No, false, "旅")},
- {0xf984, 0, 0, 0, f(No, false, "濾")},
- {0xf985, 0, 0, 0, f(No, false, "礪")},
- {0xf986, 0, 0, 0, f(No, false, "閭")},
- {0xf987, 0, 0, 0, f(No, false, "驪")},
- {0xf988, 0, 0, 0, f(No, false, "麗")},
- {0xf989, 0, 0, 0, f(No, false, "黎")},
- {0xf98a, 0, 0, 0, f(No, false, "力")},
- {0xf98b, 0, 0, 0, f(No, false, "曆")},
- {0xf98c, 0, 0, 0, f(No, false, "歷")},
- {0xf98d, 0, 0, 0, f(No, false, "轢")},
- {0xf98e, 0, 0, 0, f(No, false, "年")},
- {0xf98f, 0, 0, 0, f(No, false, "憐")},
- {0xf990, 0, 0, 0, f(No, false, "戀")},
- {0xf991, 0, 0, 0, f(No, false, "撚")},
- {0xf992, 0, 0, 0, f(No, false, "漣")},
- {0xf993, 0, 0, 0, f(No, false, "煉")},
- {0xf994, 0, 0, 0, f(No, false, "璉")},
- {0xf995, 0, 0, 0, f(No, false, "秊")},
- {0xf996, 0, 0, 0, f(No, false, "練")},
- {0xf997, 0, 0, 0, f(No, false, "聯")},
- {0xf998, 0, 0, 0, f(No, false, "輦")},
- {0xf999, 0, 0, 0, f(No, false, "蓮")},
- {0xf99a, 0, 0, 0, f(No, false, "連")},
- {0xf99b, 0, 0, 0, f(No, false, "鍊")},
- {0xf99c, 0, 0, 0, f(No, false, "列")},
- {0xf99d, 0, 0, 0, f(No, false, "劣")},
- {0xf99e, 0, 0, 0, f(No, false, "咽")},
- {0xf99f, 0, 0, 0, f(No, false, "烈")},
- {0xf9a0, 0, 0, 0, f(No, false, "裂")},
- {0xf9a1, 0, 0, 0, f(No, false, "說")},
- {0xf9a2, 0, 0, 0, f(No, false, "廉")},
- {0xf9a3, 0, 0, 0, f(No, false, "念")},
- {0xf9a4, 0, 0, 0, f(No, false, "捻")},
- {0xf9a5, 0, 0, 0, f(No, false, "殮")},
- {0xf9a6, 0, 0, 0, f(No, false, "簾")},
- {0xf9a7, 0, 0, 0, f(No, false, "獵")},
- {0xf9a8, 0, 0, 0, f(No, false, "令")},
- {0xf9a9, 0, 0, 0, f(No, false, "囹")},
- {0xf9aa, 0, 0, 0, f(No, false, "寧")},
- {0xf9ab, 0, 0, 0, f(No, false, "嶺")},
- {0xf9ac, 0, 0, 0, f(No, false, "怜")},
- {0xf9ad, 0, 0, 0, f(No, false, "玲")},
- {0xf9ae, 0, 0, 0, f(No, false, "瑩")},
- {0xf9af, 0, 0, 0, f(No, false, "羚")},
- {0xf9b0, 0, 0, 0, f(No, false, "聆")},
- {0xf9b1, 0, 0, 0, f(No, false, "鈴")},
- {0xf9b2, 0, 0, 0, f(No, false, "零")},
- {0xf9b3, 0, 0, 0, f(No, false, "靈")},
- {0xf9b4, 0, 0, 0, f(No, false, "領")},
- {0xf9b5, 0, 0, 0, f(No, false, "例")},
- {0xf9b6, 0, 0, 0, f(No, false, "禮")},
- {0xf9b7, 0, 0, 0, f(No, false, "醴")},
- {0xf9b8, 0, 0, 0, f(No, false, "隸")},
- {0xf9b9, 0, 0, 0, f(No, false, "惡")},
- {0xf9ba, 0, 0, 0, f(No, false, "了")},
- {0xf9bb, 0, 0, 0, f(No, false, "僚")},
- {0xf9bc, 0, 0, 0, f(No, false, "寮")},
- {0xf9bd, 0, 0, 0, f(No, false, "尿")},
- {0xf9be, 0, 0, 0, f(No, false, "料")},
- {0xf9bf, 0, 0, 0, f(No, false, "樂")},
- {0xf9c0, 0, 0, 0, f(No, false, "燎")},
- {0xf9c1, 0, 0, 0, f(No, false, "療")},
- {0xf9c2, 0, 0, 0, f(No, false, "蓼")},
- {0xf9c3, 0, 0, 0, f(No, false, "遼")},
- {0xf9c4, 0, 0, 0, f(No, false, "龍")},
- {0xf9c5, 0, 0, 0, f(No, false, "暈")},
- {0xf9c6, 0, 0, 0, f(No, false, "阮")},
- {0xf9c7, 0, 0, 0, f(No, false, "劉")},
- {0xf9c8, 0, 0, 0, f(No, false, "杻")},
- {0xf9c9, 0, 0, 0, f(No, false, "柳")},
- {0xf9ca, 0, 0, 0, f(No, false, "流")},
- {0xf9cb, 0, 0, 0, f(No, false, "溜")},
- {0xf9cc, 0, 0, 0, f(No, false, "琉")},
- {0xf9cd, 0, 0, 0, f(No, false, "留")},
- {0xf9ce, 0, 0, 0, f(No, false, "硫")},
- {0xf9cf, 0, 0, 0, f(No, false, "紐")},
- {0xf9d0, 0, 0, 0, f(No, false, "類")},
- {0xf9d1, 0, 0, 0, f(No, false, "六")},
- {0xf9d2, 0, 0, 0, f(No, false, "戮")},
- {0xf9d3, 0, 0, 0, f(No, false, "陸")},
- {0xf9d4, 0, 0, 0, f(No, false, "倫")},
- {0xf9d5, 0, 0, 0, f(No, false, "崙")},
- {0xf9d6, 0, 0, 0, f(No, false, "淪")},
- {0xf9d7, 0, 0, 0, f(No, false, "輪")},
- {0xf9d8, 0, 0, 0, f(No, false, "律")},
- {0xf9d9, 0, 0, 0, f(No, false, "慄")},
- {0xf9da, 0, 0, 0, f(No, false, "栗")},
- {0xf9db, 0, 0, 0, f(No, false, "率")},
- {0xf9dc, 0, 0, 0, f(No, false, "隆")},
- {0xf9dd, 0, 0, 0, f(No, false, "利")},
- {0xf9de, 0, 0, 0, f(No, false, "吏")},
- {0xf9df, 0, 0, 0, f(No, false, "履")},
- {0xf9e0, 0, 0, 0, f(No, false, "易")},
- {0xf9e1, 0, 0, 0, f(No, false, "李")},
- {0xf9e2, 0, 0, 0, f(No, false, "梨")},
- {0xf9e3, 0, 0, 0, f(No, false, "泥")},
- {0xf9e4, 0, 0, 0, f(No, false, "理")},
- {0xf9e5, 0, 0, 0, f(No, false, "痢")},
- {0xf9e6, 0, 0, 0, f(No, false, "罹")},
- {0xf9e7, 0, 0, 0, f(No, false, "裏")},
- {0xf9e8, 0, 0, 0, f(No, false, "裡")},
- {0xf9e9, 0, 0, 0, f(No, false, "里")},
- {0xf9ea, 0, 0, 0, f(No, false, "離")},
- {0xf9eb, 0, 0, 0, f(No, false, "匿")},
- {0xf9ec, 0, 0, 0, f(No, false, "溺")},
- {0xf9ed, 0, 0, 0, f(No, false, "吝")},
- {0xf9ee, 0, 0, 0, f(No, false, "燐")},
- {0xf9ef, 0, 0, 0, f(No, false, "璘")},
- {0xf9f0, 0, 0, 0, f(No, false, "藺")},
- {0xf9f1, 0, 0, 0, f(No, false, "隣")},
- {0xf9f2, 0, 0, 0, f(No, false, "鱗")},
- {0xf9f3, 0, 0, 0, f(No, false, "麟")},
- {0xf9f4, 0, 0, 0, f(No, false, "林")},
- {0xf9f5, 0, 0, 0, f(No, false, "淋")},
- {0xf9f6, 0, 0, 0, f(No, false, "臨")},
- {0xf9f7, 0, 0, 0, f(No, false, "立")},
- {0xf9f8, 0, 0, 0, f(No, false, "笠")},
- {0xf9f9, 0, 0, 0, f(No, false, "粒")},
- {0xf9fa, 0, 0, 0, f(No, false, "狀")},
- {0xf9fb, 0, 0, 0, f(No, false, "炙")},
- {0xf9fc, 0, 0, 0, f(No, false, "識")},
- {0xf9fd, 0, 0, 0, f(No, false, "什")},
- {0xf9fe, 0, 0, 0, f(No, false, "茶")},
- {0xf9ff, 0, 0, 0, f(No, false, "刺")},
- {0xfa00, 0, 0, 0, f(No, false, "切")},
- {0xfa01, 0, 0, 0, f(No, false, "度")},
- {0xfa02, 0, 0, 0, f(No, false, "拓")},
- {0xfa03, 0, 0, 0, f(No, false, "糖")},
- {0xfa04, 0, 0, 0, f(No, false, "宅")},
- {0xfa05, 0, 0, 0, f(No, false, "洞")},
- {0xfa06, 0, 0, 0, f(No, false, "暴")},
- {0xfa07, 0, 0, 0, f(No, false, "輻")},
- {0xfa08, 0, 0, 0, f(No, false, "行")},
- {0xfa09, 0, 0, 0, f(No, false, "降")},
- {0xfa0a, 0, 0, 0, f(No, false, "見")},
- {0xfa0b, 0, 0, 0, f(No, false, "廓")},
- {0xfa0c, 0, 0, 0, f(No, false, "兀")},
- {0xfa0d, 0, 0, 0, f(No, false, "嗀")},
- {0xfa0e, 0, 0, 0, f(Yes, false, "")},
- {0xfa10, 0, 0, 0, f(No, false, "塚")},
- {0xfa11, 0, 0, 0, f(Yes, false, "")},
- {0xfa12, 0, 0, 0, f(No, false, "晴")},
- {0xfa13, 0, 0, 0, f(Yes, false, "")},
- {0xfa15, 0, 0, 0, f(No, false, "凞")},
- {0xfa16, 0, 0, 0, f(No, false, "猪")},
- {0xfa17, 0, 0, 0, f(No, false, "益")},
- {0xfa18, 0, 0, 0, f(No, false, "礼")},
- {0xfa19, 0, 0, 0, f(No, false, "神")},
- {0xfa1a, 0, 0, 0, f(No, false, "祥")},
- {0xfa1b, 0, 0, 0, f(No, false, "福")},
- {0xfa1c, 0, 0, 0, f(No, false, "靖")},
- {0xfa1d, 0, 0, 0, f(No, false, "精")},
- {0xfa1e, 0, 0, 0, f(No, false, "羽")},
- {0xfa1f, 0, 0, 0, f(Yes, false, "")},
- {0xfa20, 0, 0, 0, f(No, false, "蘒")},
- {0xfa21, 0, 0, 0, f(Yes, false, "")},
- {0xfa22, 0, 0, 0, f(No, false, "諸")},
- {0xfa23, 0, 0, 0, f(Yes, false, "")},
- {0xfa25, 0, 0, 0, f(No, false, "逸")},
- {0xfa26, 0, 0, 0, f(No, false, "都")},
- {0xfa27, 0, 0, 0, f(Yes, false, "")},
- {0xfa2a, 0, 0, 0, f(No, false, "飯")},
- {0xfa2b, 0, 0, 0, f(No, false, "飼")},
- {0xfa2c, 0, 0, 0, f(No, false, "館")},
- {0xfa2d, 0, 0, 0, f(No, false, "鶴")},
- {0xfa2e, 0, 0, 0, f(No, false, "郞")},
- {0xfa2f, 0, 0, 0, f(No, false, "隷")},
- {0xfa30, 0, 0, 0, f(No, false, "侮")},
- {0xfa31, 0, 0, 0, f(No, false, "僧")},
- {0xfa32, 0, 0, 0, f(No, false, "免")},
- {0xfa33, 0, 0, 0, f(No, false, "勉")},
- {0xfa34, 0, 0, 0, f(No, false, "勤")},
- {0xfa35, 0, 0, 0, f(No, false, "卑")},
- {0xfa36, 0, 0, 0, f(No, false, "喝")},
- {0xfa37, 0, 0, 0, f(No, false, "嘆")},
- {0xfa38, 0, 0, 0, f(No, false, "器")},
- {0xfa39, 0, 0, 0, f(No, false, "塀")},
- {0xfa3a, 0, 0, 0, f(No, false, "墨")},
- {0xfa3b, 0, 0, 0, f(No, false, "層")},
- {0xfa3c, 0, 0, 0, f(No, false, "屮")},
- {0xfa3d, 0, 0, 0, f(No, false, "悔")},
- {0xfa3e, 0, 0, 0, f(No, false, "慨")},
- {0xfa3f, 0, 0, 0, f(No, false, "憎")},
- {0xfa40, 0, 0, 0, f(No, false, "懲")},
- {0xfa41, 0, 0, 0, f(No, false, "敏")},
- {0xfa42, 0, 0, 0, f(No, false, "既")},
- {0xfa43, 0, 0, 0, f(No, false, "暑")},
- {0xfa44, 0, 0, 0, f(No, false, "梅")},
- {0xfa45, 0, 0, 0, f(No, false, "海")},
- {0xfa46, 0, 0, 0, f(No, false, "渚")},
- {0xfa47, 0, 0, 0, f(No, false, "漢")},
- {0xfa48, 0, 0, 0, f(No, false, "煮")},
- {0xfa49, 0, 0, 0, f(No, false, "爫")},
- {0xfa4a, 0, 0, 0, f(No, false, "琢")},
- {0xfa4b, 0, 0, 0, f(No, false, "碑")},
- {0xfa4c, 0, 0, 0, f(No, false, "社")},
- {0xfa4d, 0, 0, 0, f(No, false, "祉")},
- {0xfa4e, 0, 0, 0, f(No, false, "祈")},
- {0xfa4f, 0, 0, 0, f(No, false, "祐")},
- {0xfa50, 0, 0, 0, f(No, false, "祖")},
- {0xfa51, 0, 0, 0, f(No, false, "祝")},
- {0xfa52, 0, 0, 0, f(No, false, "禍")},
- {0xfa53, 0, 0, 0, f(No, false, "禎")},
- {0xfa54, 0, 0, 0, f(No, false, "穀")},
- {0xfa55, 0, 0, 0, f(No, false, "突")},
- {0xfa56, 0, 0, 0, f(No, false, "節")},
- {0xfa57, 0, 0, 0, f(No, false, "練")},
- {0xfa58, 0, 0, 0, f(No, false, "縉")},
- {0xfa59, 0, 0, 0, f(No, false, "繁")},
- {0xfa5a, 0, 0, 0, f(No, false, "署")},
- {0xfa5b, 0, 0, 0, f(No, false, "者")},
- {0xfa5c, 0, 0, 0, f(No, false, "臭")},
- {0xfa5d, 0, 0, 0, f(No, false, "艹")},
- {0xfa5f, 0, 0, 0, f(No, false, "著")},
- {0xfa60, 0, 0, 0, f(No, false, "褐")},
- {0xfa61, 0, 0, 0, f(No, false, "視")},
- {0xfa62, 0, 0, 0, f(No, false, "謁")},
- {0xfa63, 0, 0, 0, f(No, false, "謹")},
- {0xfa64, 0, 0, 0, f(No, false, "賓")},
- {0xfa65, 0, 0, 0, f(No, false, "贈")},
- {0xfa66, 0, 0, 0, f(No, false, "辶")},
- {0xfa67, 0, 0, 0, f(No, false, "逸")},
- {0xfa68, 0, 0, 0, f(No, false, "難")},
- {0xfa69, 0, 0, 0, f(No, false, "響")},
- {0xfa6a, 0, 0, 0, f(No, false, "頻")},
- {0xfa6b, 0, 0, 0, f(No, false, "恵")},
- {0xfa6c, 0, 0, 0, f(No, false, "𤋮")},
- {0xfa6d, 0, 0, 0, f(No, false, "舘")},
- {0xfa6e, 0, 0, 0, f(Yes, false, "")},
- {0xfa70, 0, 0, 0, f(No, false, "並")},
- {0xfa71, 0, 0, 0, f(No, false, "况")},
- {0xfa72, 0, 0, 0, f(No, false, "全")},
- {0xfa73, 0, 0, 0, f(No, false, "侀")},
- {0xfa74, 0, 0, 0, f(No, false, "充")},
- {0xfa75, 0, 0, 0, f(No, false, "冀")},
- {0xfa76, 0, 0, 0, f(No, false, "勇")},
- {0xfa77, 0, 0, 0, f(No, false, "勺")},
- {0xfa78, 0, 0, 0, f(No, false, "喝")},
- {0xfa79, 0, 0, 0, f(No, false, "啕")},
- {0xfa7a, 0, 0, 0, f(No, false, "喙")},
- {0xfa7b, 0, 0, 0, f(No, false, "嗢")},
- {0xfa7c, 0, 0, 0, f(No, false, "塚")},
- {0xfa7d, 0, 0, 0, f(No, false, "墳")},
- {0xfa7e, 0, 0, 0, f(No, false, "奄")},
- {0xfa7f, 0, 0, 0, f(No, false, "奔")},
- {0xfa80, 0, 0, 0, f(No, false, "婢")},
- {0xfa81, 0, 0, 0, f(No, false, "嬨")},
- {0xfa82, 0, 0, 0, f(No, false, "廒")},
- {0xfa83, 0, 0, 0, f(No, false, "廙")},
- {0xfa84, 0, 0, 0, f(No, false, "彩")},
- {0xfa85, 0, 0, 0, f(No, false, "徭")},
- {0xfa86, 0, 0, 0, f(No, false, "惘")},
- {0xfa87, 0, 0, 0, f(No, false, "慎")},
- {0xfa88, 0, 0, 0, f(No, false, "愈")},
- {0xfa89, 0, 0, 0, f(No, false, "憎")},
- {0xfa8a, 0, 0, 0, f(No, false, "慠")},
- {0xfa8b, 0, 0, 0, f(No, false, "懲")},
- {0xfa8c, 0, 0, 0, f(No, false, "戴")},
- {0xfa8d, 0, 0, 0, f(No, false, "揄")},
- {0xfa8e, 0, 0, 0, f(No, false, "搜")},
- {0xfa8f, 0, 0, 0, f(No, false, "摒")},
- {0xfa90, 0, 0, 0, f(No, false, "敖")},
- {0xfa91, 0, 0, 0, f(No, false, "晴")},
- {0xfa92, 0, 0, 0, f(No, false, "朗")},
- {0xfa93, 0, 0, 0, f(No, false, "望")},
- {0xfa94, 0, 0, 0, f(No, false, "杖")},
- {0xfa95, 0, 0, 0, f(No, false, "歹")},
- {0xfa96, 0, 0, 0, f(No, false, "殺")},
- {0xfa97, 0, 0, 0, f(No, false, "流")},
- {0xfa98, 0, 0, 0, f(No, false, "滛")},
- {0xfa99, 0, 0, 0, f(No, false, "滋")},
- {0xfa9a, 0, 0, 0, f(No, false, "漢")},
- {0xfa9b, 0, 0, 0, f(No, false, "瀞")},
- {0xfa9c, 0, 0, 0, f(No, false, "煮")},
- {0xfa9d, 0, 0, 0, f(No, false, "瞧")},
- {0xfa9e, 0, 0, 0, f(No, false, "爵")},
- {0xfa9f, 0, 0, 0, f(No, false, "犯")},
- {0xfaa0, 0, 0, 0, f(No, false, "猪")},
- {0xfaa1, 0, 0, 0, f(No, false, "瑱")},
- {0xfaa2, 0, 0, 0, f(No, false, "甆")},
- {0xfaa3, 0, 0, 0, f(No, false, "画")},
- {0xfaa4, 0, 0, 0, f(No, false, "瘝")},
- {0xfaa5, 0, 0, 0, f(No, false, "瘟")},
- {0xfaa6, 0, 0, 0, f(No, false, "益")},
- {0xfaa7, 0, 0, 0, f(No, false, "盛")},
- {0xfaa8, 0, 0, 0, f(No, false, "直")},
- {0xfaa9, 0, 0, 0, f(No, false, "睊")},
- {0xfaaa, 0, 0, 0, f(No, false, "着")},
- {0xfaab, 0, 0, 0, f(No, false, "磌")},
- {0xfaac, 0, 0, 0, f(No, false, "窱")},
- {0xfaad, 0, 0, 0, f(No, false, "節")},
- {0xfaae, 0, 0, 0, f(No, false, "类")},
- {0xfaaf, 0, 0, 0, f(No, false, "絛")},
- {0xfab0, 0, 0, 0, f(No, false, "練")},
- {0xfab1, 0, 0, 0, f(No, false, "缾")},
- {0xfab2, 0, 0, 0, f(No, false, "者")},
- {0xfab3, 0, 0, 0, f(No, false, "荒")},
- {0xfab4, 0, 0, 0, f(No, false, "華")},
- {0xfab5, 0, 0, 0, f(No, false, "蝹")},
- {0xfab6, 0, 0, 0, f(No, false, "襁")},
- {0xfab7, 0, 0, 0, f(No, false, "覆")},
- {0xfab8, 0, 0, 0, f(No, false, "視")},
- {0xfab9, 0, 0, 0, f(No, false, "調")},
- {0xfaba, 0, 0, 0, f(No, false, "諸")},
- {0xfabb, 0, 0, 0, f(No, false, "請")},
- {0xfabc, 0, 0, 0, f(No, false, "謁")},
- {0xfabd, 0, 0, 0, f(No, false, "諾")},
- {0xfabe, 0, 0, 0, f(No, false, "諭")},
- {0xfabf, 0, 0, 0, f(No, false, "謹")},
- {0xfac0, 0, 0, 0, f(No, false, "變")},
- {0xfac1, 0, 0, 0, f(No, false, "贈")},
- {0xfac2, 0, 0, 0, f(No, false, "輸")},
- {0xfac3, 0, 0, 0, f(No, false, "遲")},
- {0xfac4, 0, 0, 0, f(No, false, "醙")},
- {0xfac5, 0, 0, 0, f(No, false, "鉶")},
- {0xfac6, 0, 0, 0, f(No, false, "陼")},
- {0xfac7, 0, 0, 0, f(No, false, "難")},
- {0xfac8, 0, 0, 0, f(No, false, "靖")},
- {0xfac9, 0, 0, 0, f(No, false, "韛")},
- {0xfaca, 0, 0, 0, f(No, false, "響")},
- {0xfacb, 0, 0, 0, f(No, false, "頋")},
- {0xfacc, 0, 0, 0, f(No, false, "頻")},
- {0xfacd, 0, 0, 0, f(No, false, "鬒")},
- {0xface, 0, 0, 0, f(No, false, "龜")},
- {0xfacf, 0, 0, 0, f(No, false, "𢡊")},
- {0xfad0, 0, 0, 0, f(No, false, "𢡄")},
- {0xfad1, 0, 0, 0, f(No, false, "𣏕")},
- {0xfad2, 0, 0, 0, f(No, false, "㮝")},
- {0xfad3, 0, 0, 0, f(No, false, "䀘")},
- {0xfad4, 0, 0, 0, f(No, false, "䀹")},
- {0xfad5, 0, 0, 0, f(No, false, "𥉉")},
- {0xfad6, 0, 0, 0, f(No, false, "𥳐")},
- {0xfad7, 0, 0, 0, f(No, false, "𧻓")},
- {0xfad8, 0, 0, 0, f(No, false, "齃")},
- {0xfad9, 0, 0, 0, f(No, false, "龎")},
- {0xfada, 0, 0, 0, f(Yes, false, "")},
- {0xfb00, 0, 0, 0, g(Yes, No, false, false, "", "ff")},
- {0xfb01, 0, 0, 0, g(Yes, No, false, false, "", "fi")},
- {0xfb02, 0, 0, 0, g(Yes, No, false, false, "", "fl")},
- {0xfb03, 0, 0, 0, g(Yes, No, false, false, "", "ffi")},
- {0xfb04, 0, 0, 0, g(Yes, No, false, false, "", "ffl")},
- {0xfb05, 0, 0, 0, g(Yes, No, false, false, "", "st")},
- {0xfb07, 0, 0, 0, f(Yes, false, "")},
- {0xfb13, 0, 0, 0, g(Yes, No, false, false, "", "մն")},
- {0xfb14, 0, 0, 0, g(Yes, No, false, false, "", "մե")},
- {0xfb15, 0, 0, 0, g(Yes, No, false, false, "", "մի")},
- {0xfb16, 0, 0, 0, g(Yes, No, false, false, "", "վն")},
- {0xfb17, 0, 0, 0, g(Yes, No, false, false, "", "մխ")},
- {0xfb18, 0, 0, 0, f(Yes, false, "")},
- {0xfb1d, 0, 0, 1, f(No, false, "יִ")},
- {0xfb1e, 26, 1, 1, f(Yes, false, "")},
- {0xfb1f, 0, 0, 1, f(No, false, "ײַ")},
- {0xfb20, 0, 0, 0, g(Yes, No, false, false, "", "ע")},
- {0xfb21, 0, 0, 0, g(Yes, No, false, false, "", "א")},
- {0xfb22, 0, 0, 0, g(Yes, No, false, false, "", "ד")},
- {0xfb23, 0, 0, 0, g(Yes, No, false, false, "", "ה")},
- {0xfb24, 0, 0, 0, g(Yes, No, false, false, "", "כ")},
- {0xfb25, 0, 0, 0, g(Yes, No, false, false, "", "ל")},
- {0xfb26, 0, 0, 0, g(Yes, No, false, false, "", "ם")},
- {0xfb27, 0, 0, 0, g(Yes, No, false, false, "", "ר")},
- {0xfb28, 0, 0, 0, g(Yes, No, false, false, "", "ת")},
- {0xfb29, 0, 0, 0, g(Yes, No, false, false, "", "+")},
- {0xfb2a, 0, 0, 1, f(No, false, "שׁ")},
- {0xfb2b, 0, 0, 1, f(No, false, "שׂ")},
- {0xfb2c, 0, 0, 2, f(No, false, "שּׁ")},
- {0xfb2d, 0, 0, 2, f(No, false, "שּׂ")},
- {0xfb2e, 0, 0, 1, f(No, false, "אַ")},
- {0xfb2f, 0, 0, 1, f(No, false, "אָ")},
- {0xfb30, 0, 0, 1, f(No, false, "אּ")},
- {0xfb31, 0, 0, 1, f(No, false, "בּ")},
- {0xfb32, 0, 0, 1, f(No, false, "גּ")},
- {0xfb33, 0, 0, 1, f(No, false, "דּ")},
- {0xfb34, 0, 0, 1, f(No, false, "הּ")},
- {0xfb35, 0, 0, 1, f(No, false, "וּ")},
- {0xfb36, 0, 0, 1, f(No, false, "זּ")},
- {0xfb37, 0, 0, 0, f(Yes, false, "")},
- {0xfb38, 0, 0, 1, f(No, false, "טּ")},
- {0xfb39, 0, 0, 1, f(No, false, "יּ")},
- {0xfb3a, 0, 0, 1, f(No, false, "ךּ")},
- {0xfb3b, 0, 0, 1, f(No, false, "כּ")},
- {0xfb3c, 0, 0, 1, f(No, false, "לּ")},
- {0xfb3d, 0, 0, 0, f(Yes, false, "")},
- {0xfb3e, 0, 0, 1, f(No, false, "מּ")},
- {0xfb3f, 0, 0, 0, f(Yes, false, "")},
- {0xfb40, 0, 0, 1, f(No, false, "נּ")},
- {0xfb41, 0, 0, 1, f(No, false, "סּ")},
- {0xfb42, 0, 0, 0, f(Yes, false, "")},
- {0xfb43, 0, 0, 1, f(No, false, "ףּ")},
- {0xfb44, 0, 0, 1, f(No, false, "פּ")},
- {0xfb45, 0, 0, 0, f(Yes, false, "")},
- {0xfb46, 0, 0, 1, f(No, false, "צּ")},
- {0xfb47, 0, 0, 1, f(No, false, "קּ")},
- {0xfb48, 0, 0, 1, f(No, false, "רּ")},
- {0xfb49, 0, 0, 1, f(No, false, "שּ")},
- {0xfb4a, 0, 0, 1, f(No, false, "תּ")},
- {0xfb4b, 0, 0, 1, f(No, false, "וֹ")},
- {0xfb4c, 0, 0, 1, f(No, false, "בֿ")},
- {0xfb4d, 0, 0, 1, f(No, false, "כֿ")},
- {0xfb4e, 0, 0, 1, f(No, false, "פֿ")},
- {0xfb4f, 0, 0, 0, g(Yes, No, false, false, "", "אל")},
- {0xfb50, 0, 0, 0, g(Yes, No, false, false, "", "ٱ")},
- {0xfb52, 0, 0, 0, g(Yes, No, false, false, "", "ٻ")},
- {0xfb56, 0, 0, 0, g(Yes, No, false, false, "", "پ")},
- {0xfb5a, 0, 0, 0, g(Yes, No, false, false, "", "ڀ")},
- {0xfb5e, 0, 0, 0, g(Yes, No, false, false, "", "ٺ")},
- {0xfb62, 0, 0, 0, g(Yes, No, false, false, "", "ٿ")},
- {0xfb66, 0, 0, 0, g(Yes, No, false, false, "", "ٹ")},
- {0xfb6a, 0, 0, 0, g(Yes, No, false, false, "", "ڤ")},
- {0xfb6e, 0, 0, 0, g(Yes, No, false, false, "", "ڦ")},
- {0xfb72, 0, 0, 0, g(Yes, No, false, false, "", "ڄ")},
- {0xfb76, 0, 0, 0, g(Yes, No, false, false, "", "ڃ")},
- {0xfb7a, 0, 0, 0, g(Yes, No, false, false, "", "چ")},
- {0xfb7e, 0, 0, 0, g(Yes, No, false, false, "", "ڇ")},
- {0xfb82, 0, 0, 0, g(Yes, No, false, false, "", "ڍ")},
- {0xfb84, 0, 0, 0, g(Yes, No, false, false, "", "ڌ")},
- {0xfb86, 0, 0, 0, g(Yes, No, false, false, "", "ڎ")},
- {0xfb88, 0, 0, 0, g(Yes, No, false, false, "", "ڈ")},
- {0xfb8a, 0, 0, 0, g(Yes, No, false, false, "", "ژ")},
- {0xfb8c, 0, 0, 0, g(Yes, No, false, false, "", "ڑ")},
- {0xfb8e, 0, 0, 0, g(Yes, No, false, false, "", "ک")},
- {0xfb92, 0, 0, 0, g(Yes, No, false, false, "", "گ")},
- {0xfb96, 0, 0, 0, g(Yes, No, false, false, "", "ڳ")},
- {0xfb9a, 0, 0, 0, g(Yes, No, false, false, "", "ڱ")},
- {0xfb9e, 0, 0, 0, g(Yes, No, false, false, "", "ں")},
- {0xfba0, 0, 0, 0, g(Yes, No, false, false, "", "ڻ")},
- {0xfba4, 0, 0, 1, g(Yes, No, false, false, "", "ۀ")},
- {0xfba6, 0, 0, 0, g(Yes, No, false, false, "", "ہ")},
- {0xfbaa, 0, 0, 0, g(Yes, No, false, false, "", "ھ")},
- {0xfbae, 0, 0, 0, g(Yes, No, false, false, "", "ے")},
- {0xfbb0, 0, 0, 1, g(Yes, No, false, false, "", "ۓ")},
- {0xfbb2, 0, 0, 0, f(Yes, false, "")},
- {0xfbd3, 0, 0, 0, g(Yes, No, false, false, "", "ڭ")},
- {0xfbd7, 0, 0, 0, g(Yes, No, false, false, "", "ۇ")},
- {0xfbd9, 0, 0, 0, g(Yes, No, false, false, "", "ۆ")},
- {0xfbdb, 0, 0, 0, g(Yes, No, false, false, "", "ۈ")},
- {0xfbdd, 0, 0, 0, g(Yes, No, false, false, "", "ۇٴ")},
- {0xfbde, 0, 0, 0, g(Yes, No, false, false, "", "ۋ")},
- {0xfbe0, 0, 0, 0, g(Yes, No, false, false, "", "ۅ")},
- {0xfbe2, 0, 0, 0, g(Yes, No, false, false, "", "ۉ")},
- {0xfbe4, 0, 0, 0, g(Yes, No, false, false, "", "ې")},
- {0xfbe8, 0, 0, 0, g(Yes, No, false, false, "", "ى")},
- {0xfbea, 0, 0, 0, g(Yes, No, false, false, "", "ئا")},
- {0xfbec, 0, 0, 0, g(Yes, No, false, false, "", "ئە")},
- {0xfbee, 0, 0, 0, g(Yes, No, false, false, "", "ئو")},
- {0xfbf0, 0, 0, 0, g(Yes, No, false, false, "", "ئۇ")},
- {0xfbf2, 0, 0, 0, g(Yes, No, false, false, "", "ئۆ")},
- {0xfbf4, 0, 0, 0, g(Yes, No, false, false, "", "ئۈ")},
- {0xfbf6, 0, 0, 0, g(Yes, No, false, false, "", "ئې")},
- {0xfbf9, 0, 0, 0, g(Yes, No, false, false, "", "ئى")},
- {0xfbfc, 0, 0, 0, g(Yes, No, false, false, "", "ی")},
- {0xfc00, 0, 0, 0, g(Yes, No, false, false, "", "ئج")},
- {0xfc01, 0, 0, 0, g(Yes, No, false, false, "", "ئح")},
- {0xfc02, 0, 0, 0, g(Yes, No, false, false, "", "ئم")},
- {0xfc03, 0, 0, 0, g(Yes, No, false, false, "", "ئى")},
- {0xfc04, 0, 0, 0, g(Yes, No, false, false, "", "ئي")},
- {0xfc05, 0, 0, 0, g(Yes, No, false, false, "", "بج")},
- {0xfc06, 0, 0, 0, g(Yes, No, false, false, "", "بح")},
- {0xfc07, 0, 0, 0, g(Yes, No, false, false, "", "بخ")},
- {0xfc08, 0, 0, 0, g(Yes, No, false, false, "", "بم")},
- {0xfc09, 0, 0, 0, g(Yes, No, false, false, "", "بى")},
- {0xfc0a, 0, 0, 0, g(Yes, No, false, false, "", "بي")},
- {0xfc0b, 0, 0, 0, g(Yes, No, false, false, "", "تج")},
- {0xfc0c, 0, 0, 0, g(Yes, No, false, false, "", "تح")},
- {0xfc0d, 0, 0, 0, g(Yes, No, false, false, "", "تخ")},
- {0xfc0e, 0, 0, 0, g(Yes, No, false, false, "", "تم")},
- {0xfc0f, 0, 0, 0, g(Yes, No, false, false, "", "تى")},
- {0xfc10, 0, 0, 0, g(Yes, No, false, false, "", "تي")},
- {0xfc11, 0, 0, 0, g(Yes, No, false, false, "", "ثج")},
- {0xfc12, 0, 0, 0, g(Yes, No, false, false, "", "ثم")},
- {0xfc13, 0, 0, 0, g(Yes, No, false, false, "", "ثى")},
- {0xfc14, 0, 0, 0, g(Yes, No, false, false, "", "ثي")},
- {0xfc15, 0, 0, 0, g(Yes, No, false, false, "", "جح")},
- {0xfc16, 0, 0, 0, g(Yes, No, false, false, "", "جم")},
- {0xfc17, 0, 0, 0, g(Yes, No, false, false, "", "حج")},
- {0xfc18, 0, 0, 0, g(Yes, No, false, false, "", "حم")},
- {0xfc19, 0, 0, 0, g(Yes, No, false, false, "", "خج")},
- {0xfc1a, 0, 0, 0, g(Yes, No, false, false, "", "خح")},
- {0xfc1b, 0, 0, 0, g(Yes, No, false, false, "", "خم")},
- {0xfc1c, 0, 0, 0, g(Yes, No, false, false, "", "سج")},
- {0xfc1d, 0, 0, 0, g(Yes, No, false, false, "", "سح")},
- {0xfc1e, 0, 0, 0, g(Yes, No, false, false, "", "سخ")},
- {0xfc1f, 0, 0, 0, g(Yes, No, false, false, "", "سم")},
- {0xfc20, 0, 0, 0, g(Yes, No, false, false, "", "صح")},
- {0xfc21, 0, 0, 0, g(Yes, No, false, false, "", "صم")},
- {0xfc22, 0, 0, 0, g(Yes, No, false, false, "", "ضج")},
- {0xfc23, 0, 0, 0, g(Yes, No, false, false, "", "ضح")},
- {0xfc24, 0, 0, 0, g(Yes, No, false, false, "", "ضخ")},
- {0xfc25, 0, 0, 0, g(Yes, No, false, false, "", "ضم")},
- {0xfc26, 0, 0, 0, g(Yes, No, false, false, "", "طح")},
- {0xfc27, 0, 0, 0, g(Yes, No, false, false, "", "طم")},
- {0xfc28, 0, 0, 0, g(Yes, No, false, false, "", "ظم")},
- {0xfc29, 0, 0, 0, g(Yes, No, false, false, "", "عج")},
- {0xfc2a, 0, 0, 0, g(Yes, No, false, false, "", "عم")},
- {0xfc2b, 0, 0, 0, g(Yes, No, false, false, "", "غج")},
- {0xfc2c, 0, 0, 0, g(Yes, No, false, false, "", "غم")},
- {0xfc2d, 0, 0, 0, g(Yes, No, false, false, "", "فج")},
- {0xfc2e, 0, 0, 0, g(Yes, No, false, false, "", "فح")},
- {0xfc2f, 0, 0, 0, g(Yes, No, false, false, "", "فخ")},
- {0xfc30, 0, 0, 0, g(Yes, No, false, false, "", "فم")},
- {0xfc31, 0, 0, 0, g(Yes, No, false, false, "", "فى")},
- {0xfc32, 0, 0, 0, g(Yes, No, false, false, "", "في")},
- {0xfc33, 0, 0, 0, g(Yes, No, false, false, "", "قح")},
- {0xfc34, 0, 0, 0, g(Yes, No, false, false, "", "قم")},
- {0xfc35, 0, 0, 0, g(Yes, No, false, false, "", "قى")},
- {0xfc36, 0, 0, 0, g(Yes, No, false, false, "", "قي")},
- {0xfc37, 0, 0, 0, g(Yes, No, false, false, "", "كا")},
- {0xfc38, 0, 0, 0, g(Yes, No, false, false, "", "كج")},
- {0xfc39, 0, 0, 0, g(Yes, No, false, false, "", "كح")},
- {0xfc3a, 0, 0, 0, g(Yes, No, false, false, "", "كخ")},
- {0xfc3b, 0, 0, 0, g(Yes, No, false, false, "", "كل")},
- {0xfc3c, 0, 0, 0, g(Yes, No, false, false, "", "كم")},
- {0xfc3d, 0, 0, 0, g(Yes, No, false, false, "", "كى")},
- {0xfc3e, 0, 0, 0, g(Yes, No, false, false, "", "كي")},
- {0xfc3f, 0, 0, 0, g(Yes, No, false, false, "", "لج")},
- {0xfc40, 0, 0, 0, g(Yes, No, false, false, "", "لح")},
- {0xfc41, 0, 0, 0, g(Yes, No, false, false, "", "لخ")},
- {0xfc42, 0, 0, 0, g(Yes, No, false, false, "", "لم")},
- {0xfc43, 0, 0, 0, g(Yes, No, false, false, "", "لى")},
- {0xfc44, 0, 0, 0, g(Yes, No, false, false, "", "لي")},
- {0xfc45, 0, 0, 0, g(Yes, No, false, false, "", "مج")},
- {0xfc46, 0, 0, 0, g(Yes, No, false, false, "", "مح")},
- {0xfc47, 0, 0, 0, g(Yes, No, false, false, "", "مخ")},
- {0xfc48, 0, 0, 0, g(Yes, No, false, false, "", "مم")},
- {0xfc49, 0, 0, 0, g(Yes, No, false, false, "", "مى")},
- {0xfc4a, 0, 0, 0, g(Yes, No, false, false, "", "مي")},
- {0xfc4b, 0, 0, 0, g(Yes, No, false, false, "", "نج")},
- {0xfc4c, 0, 0, 0, g(Yes, No, false, false, "", "نح")},
- {0xfc4d, 0, 0, 0, g(Yes, No, false, false, "", "نخ")},
- {0xfc4e, 0, 0, 0, g(Yes, No, false, false, "", "نم")},
- {0xfc4f, 0, 0, 0, g(Yes, No, false, false, "", "نى")},
- {0xfc50, 0, 0, 0, g(Yes, No, false, false, "", "ني")},
- {0xfc51, 0, 0, 0, g(Yes, No, false, false, "", "هج")},
- {0xfc52, 0, 0, 0, g(Yes, No, false, false, "", "هم")},
- {0xfc53, 0, 0, 0, g(Yes, No, false, false, "", "هى")},
- {0xfc54, 0, 0, 0, g(Yes, No, false, false, "", "هي")},
- {0xfc55, 0, 0, 0, g(Yes, No, false, false, "", "يج")},
- {0xfc56, 0, 0, 0, g(Yes, No, false, false, "", "يح")},
- {0xfc57, 0, 0, 0, g(Yes, No, false, false, "", "يخ")},
- {0xfc58, 0, 0, 0, g(Yes, No, false, false, "", "يم")},
- {0xfc59, 0, 0, 0, g(Yes, No, false, false, "", "يى")},
- {0xfc5a, 0, 0, 0, g(Yes, No, false, false, "", "يي")},
- {0xfc5b, 0, 0, 1, g(Yes, No, false, false, "", "ذٰ")},
- {0xfc5c, 0, 0, 1, g(Yes, No, false, false, "", "رٰ")},
- {0xfc5d, 0, 0, 1, g(Yes, No, false, false, "", "ىٰ")},
- {0xfc5e, 0, 0, 2, g(Yes, No, false, false, "", " ٌّ")},
- {0xfc5f, 0, 0, 2, g(Yes, No, false, false, "", " ٍّ")},
- {0xfc60, 0, 0, 2, g(Yes, No, false, false, "", " َّ")},
- {0xfc61, 0, 0, 2, g(Yes, No, false, false, "", " ُّ")},
- {0xfc62, 0, 0, 2, g(Yes, No, false, false, "", " ِّ")},
- {0xfc63, 0, 0, 2, g(Yes, No, false, false, "", " ّٰ")},
- {0xfc64, 0, 0, 0, g(Yes, No, false, false, "", "ئر")},
- {0xfc65, 0, 0, 0, g(Yes, No, false, false, "", "ئز")},
- {0xfc66, 0, 0, 0, g(Yes, No, false, false, "", "ئم")},
- {0xfc67, 0, 0, 0, g(Yes, No, false, false, "", "ئن")},
- {0xfc68, 0, 0, 0, g(Yes, No, false, false, "", "ئى")},
- {0xfc69, 0, 0, 0, g(Yes, No, false, false, "", "ئي")},
- {0xfc6a, 0, 0, 0, g(Yes, No, false, false, "", "بر")},
- {0xfc6b, 0, 0, 0, g(Yes, No, false, false, "", "بز")},
- {0xfc6c, 0, 0, 0, g(Yes, No, false, false, "", "بم")},
- {0xfc6d, 0, 0, 0, g(Yes, No, false, false, "", "بن")},
- {0xfc6e, 0, 0, 0, g(Yes, No, false, false, "", "بى")},
- {0xfc6f, 0, 0, 0, g(Yes, No, false, false, "", "بي")},
- {0xfc70, 0, 0, 0, g(Yes, No, false, false, "", "تر")},
- {0xfc71, 0, 0, 0, g(Yes, No, false, false, "", "تز")},
- {0xfc72, 0, 0, 0, g(Yes, No, false, false, "", "تم")},
- {0xfc73, 0, 0, 0, g(Yes, No, false, false, "", "تن")},
- {0xfc74, 0, 0, 0, g(Yes, No, false, false, "", "تى")},
- {0xfc75, 0, 0, 0, g(Yes, No, false, false, "", "تي")},
- {0xfc76, 0, 0, 0, g(Yes, No, false, false, "", "ثر")},
- {0xfc77, 0, 0, 0, g(Yes, No, false, false, "", "ثز")},
- {0xfc78, 0, 0, 0, g(Yes, No, false, false, "", "ثم")},
- {0xfc79, 0, 0, 0, g(Yes, No, false, false, "", "ثن")},
- {0xfc7a, 0, 0, 0, g(Yes, No, false, false, "", "ثى")},
- {0xfc7b, 0, 0, 0, g(Yes, No, false, false, "", "ثي")},
- {0xfc7c, 0, 0, 0, g(Yes, No, false, false, "", "فى")},
- {0xfc7d, 0, 0, 0, g(Yes, No, false, false, "", "في")},
- {0xfc7e, 0, 0, 0, g(Yes, No, false, false, "", "قى")},
- {0xfc7f, 0, 0, 0, g(Yes, No, false, false, "", "قي")},
- {0xfc80, 0, 0, 0, g(Yes, No, false, false, "", "كا")},
- {0xfc81, 0, 0, 0, g(Yes, No, false, false, "", "كل")},
- {0xfc82, 0, 0, 0, g(Yes, No, false, false, "", "كم")},
- {0xfc83, 0, 0, 0, g(Yes, No, false, false, "", "كى")},
- {0xfc84, 0, 0, 0, g(Yes, No, false, false, "", "كي")},
- {0xfc85, 0, 0, 0, g(Yes, No, false, false, "", "لم")},
- {0xfc86, 0, 0, 0, g(Yes, No, false, false, "", "لى")},
- {0xfc87, 0, 0, 0, g(Yes, No, false, false, "", "لي")},
- {0xfc88, 0, 0, 0, g(Yes, No, false, false, "", "ما")},
- {0xfc89, 0, 0, 0, g(Yes, No, false, false, "", "مم")},
- {0xfc8a, 0, 0, 0, g(Yes, No, false, false, "", "نر")},
- {0xfc8b, 0, 0, 0, g(Yes, No, false, false, "", "نز")},
- {0xfc8c, 0, 0, 0, g(Yes, No, false, false, "", "نم")},
- {0xfc8d, 0, 0, 0, g(Yes, No, false, false, "", "نن")},
- {0xfc8e, 0, 0, 0, g(Yes, No, false, false, "", "نى")},
- {0xfc8f, 0, 0, 0, g(Yes, No, false, false, "", "ني")},
- {0xfc90, 0, 0, 1, g(Yes, No, false, false, "", "ىٰ")},
- {0xfc91, 0, 0, 0, g(Yes, No, false, false, "", "ير")},
- {0xfc92, 0, 0, 0, g(Yes, No, false, false, "", "يز")},
- {0xfc93, 0, 0, 0, g(Yes, No, false, false, "", "يم")},
- {0xfc94, 0, 0, 0, g(Yes, No, false, false, "", "ين")},
- {0xfc95, 0, 0, 0, g(Yes, No, false, false, "", "يى")},
- {0xfc96, 0, 0, 0, g(Yes, No, false, false, "", "يي")},
- {0xfc97, 0, 0, 0, g(Yes, No, false, false, "", "ئج")},
- {0xfc98, 0, 0, 0, g(Yes, No, false, false, "", "ئح")},
- {0xfc99, 0, 0, 0, g(Yes, No, false, false, "", "ئخ")},
- {0xfc9a, 0, 0, 0, g(Yes, No, false, false, "", "ئم")},
- {0xfc9b, 0, 0, 0, g(Yes, No, false, false, "", "ئه")},
- {0xfc9c, 0, 0, 0, g(Yes, No, false, false, "", "بج")},
- {0xfc9d, 0, 0, 0, g(Yes, No, false, false, "", "بح")},
- {0xfc9e, 0, 0, 0, g(Yes, No, false, false, "", "بخ")},
- {0xfc9f, 0, 0, 0, g(Yes, No, false, false, "", "بم")},
- {0xfca0, 0, 0, 0, g(Yes, No, false, false, "", "به")},
- {0xfca1, 0, 0, 0, g(Yes, No, false, false, "", "تج")},
- {0xfca2, 0, 0, 0, g(Yes, No, false, false, "", "تح")},
- {0xfca3, 0, 0, 0, g(Yes, No, false, false, "", "تخ")},
- {0xfca4, 0, 0, 0, g(Yes, No, false, false, "", "تم")},
- {0xfca5, 0, 0, 0, g(Yes, No, false, false, "", "ته")},
- {0xfca6, 0, 0, 0, g(Yes, No, false, false, "", "ثم")},
- {0xfca7, 0, 0, 0, g(Yes, No, false, false, "", "جح")},
- {0xfca8, 0, 0, 0, g(Yes, No, false, false, "", "جم")},
- {0xfca9, 0, 0, 0, g(Yes, No, false, false, "", "حج")},
- {0xfcaa, 0, 0, 0, g(Yes, No, false, false, "", "حم")},
- {0xfcab, 0, 0, 0, g(Yes, No, false, false, "", "خج")},
- {0xfcac, 0, 0, 0, g(Yes, No, false, false, "", "خم")},
- {0xfcad, 0, 0, 0, g(Yes, No, false, false, "", "سج")},
- {0xfcae, 0, 0, 0, g(Yes, No, false, false, "", "سح")},
- {0xfcaf, 0, 0, 0, g(Yes, No, false, false, "", "سخ")},
- {0xfcb0, 0, 0, 0, g(Yes, No, false, false, "", "سم")},
- {0xfcb1, 0, 0, 0, g(Yes, No, false, false, "", "صح")},
- {0xfcb2, 0, 0, 0, g(Yes, No, false, false, "", "صخ")},
- {0xfcb3, 0, 0, 0, g(Yes, No, false, false, "", "صم")},
- {0xfcb4, 0, 0, 0, g(Yes, No, false, false, "", "ضج")},
- {0xfcb5, 0, 0, 0, g(Yes, No, false, false, "", "ضح")},
- {0xfcb6, 0, 0, 0, g(Yes, No, false, false, "", "ضخ")},
- {0xfcb7, 0, 0, 0, g(Yes, No, false, false, "", "ضم")},
- {0xfcb8, 0, 0, 0, g(Yes, No, false, false, "", "طح")},
- {0xfcb9, 0, 0, 0, g(Yes, No, false, false, "", "ظم")},
- {0xfcba, 0, 0, 0, g(Yes, No, false, false, "", "عج")},
- {0xfcbb, 0, 0, 0, g(Yes, No, false, false, "", "عم")},
- {0xfcbc, 0, 0, 0, g(Yes, No, false, false, "", "غج")},
- {0xfcbd, 0, 0, 0, g(Yes, No, false, false, "", "غم")},
- {0xfcbe, 0, 0, 0, g(Yes, No, false, false, "", "فج")},
- {0xfcbf, 0, 0, 0, g(Yes, No, false, false, "", "فح")},
- {0xfcc0, 0, 0, 0, g(Yes, No, false, false, "", "فخ")},
- {0xfcc1, 0, 0, 0, g(Yes, No, false, false, "", "فم")},
- {0xfcc2, 0, 0, 0, g(Yes, No, false, false, "", "قح")},
- {0xfcc3, 0, 0, 0, g(Yes, No, false, false, "", "قم")},
- {0xfcc4, 0, 0, 0, g(Yes, No, false, false, "", "كج")},
- {0xfcc5, 0, 0, 0, g(Yes, No, false, false, "", "كح")},
- {0xfcc6, 0, 0, 0, g(Yes, No, false, false, "", "كخ")},
- {0xfcc7, 0, 0, 0, g(Yes, No, false, false, "", "كل")},
- {0xfcc8, 0, 0, 0, g(Yes, No, false, false, "", "كم")},
- {0xfcc9, 0, 0, 0, g(Yes, No, false, false, "", "لج")},
- {0xfcca, 0, 0, 0, g(Yes, No, false, false, "", "لح")},
- {0xfccb, 0, 0, 0, g(Yes, No, false, false, "", "لخ")},
- {0xfccc, 0, 0, 0, g(Yes, No, false, false, "", "لم")},
- {0xfccd, 0, 0, 0, g(Yes, No, false, false, "", "له")},
- {0xfcce, 0, 0, 0, g(Yes, No, false, false, "", "مج")},
- {0xfccf, 0, 0, 0, g(Yes, No, false, false, "", "مح")},
- {0xfcd0, 0, 0, 0, g(Yes, No, false, false, "", "مخ")},
- {0xfcd1, 0, 0, 0, g(Yes, No, false, false, "", "مم")},
- {0xfcd2, 0, 0, 0, g(Yes, No, false, false, "", "نج")},
- {0xfcd3, 0, 0, 0, g(Yes, No, false, false, "", "نح")},
- {0xfcd4, 0, 0, 0, g(Yes, No, false, false, "", "نخ")},
- {0xfcd5, 0, 0, 0, g(Yes, No, false, false, "", "نم")},
- {0xfcd6, 0, 0, 0, g(Yes, No, false, false, "", "نه")},
- {0xfcd7, 0, 0, 0, g(Yes, No, false, false, "", "هج")},
- {0xfcd8, 0, 0, 0, g(Yes, No, false, false, "", "هم")},
- {0xfcd9, 0, 0, 1, g(Yes, No, false, false, "", "هٰ")},
- {0xfcda, 0, 0, 0, g(Yes, No, false, false, "", "يج")},
- {0xfcdb, 0, 0, 0, g(Yes, No, false, false, "", "يح")},
- {0xfcdc, 0, 0, 0, g(Yes, No, false, false, "", "يخ")},
- {0xfcdd, 0, 0, 0, g(Yes, No, false, false, "", "يم")},
- {0xfcde, 0, 0, 0, g(Yes, No, false, false, "", "يه")},
- {0xfcdf, 0, 0, 0, g(Yes, No, false, false, "", "ئم")},
- {0xfce0, 0, 0, 0, g(Yes, No, false, false, "", "ئه")},
- {0xfce1, 0, 0, 0, g(Yes, No, false, false, "", "بم")},
- {0xfce2, 0, 0, 0, g(Yes, No, false, false, "", "به")},
- {0xfce3, 0, 0, 0, g(Yes, No, false, false, "", "تم")},
- {0xfce4, 0, 0, 0, g(Yes, No, false, false, "", "ته")},
- {0xfce5, 0, 0, 0, g(Yes, No, false, false, "", "ثم")},
- {0xfce6, 0, 0, 0, g(Yes, No, false, false, "", "ثه")},
- {0xfce7, 0, 0, 0, g(Yes, No, false, false, "", "سم")},
- {0xfce8, 0, 0, 0, g(Yes, No, false, false, "", "سه")},
- {0xfce9, 0, 0, 0, g(Yes, No, false, false, "", "شم")},
- {0xfcea, 0, 0, 0, g(Yes, No, false, false, "", "شه")},
- {0xfceb, 0, 0, 0, g(Yes, No, false, false, "", "كل")},
- {0xfcec, 0, 0, 0, g(Yes, No, false, false, "", "كم")},
- {0xfced, 0, 0, 0, g(Yes, No, false, false, "", "لم")},
- {0xfcee, 0, 0, 0, g(Yes, No, false, false, "", "نم")},
- {0xfcef, 0, 0, 0, g(Yes, No, false, false, "", "نه")},
- {0xfcf0, 0, 0, 0, g(Yes, No, false, false, "", "يم")},
- {0xfcf1, 0, 0, 0, g(Yes, No, false, false, "", "يه")},
- {0xfcf2, 0, 0, 2, g(Yes, No, false, false, "", "ـَّ")},
- {0xfcf3, 0, 0, 2, g(Yes, No, false, false, "", "ـُّ")},
- {0xfcf4, 0, 0, 2, g(Yes, No, false, false, "", "ـِّ")},
- {0xfcf5, 0, 0, 0, g(Yes, No, false, false, "", "طى")},
- {0xfcf6, 0, 0, 0, g(Yes, No, false, false, "", "طي")},
- {0xfcf7, 0, 0, 0, g(Yes, No, false, false, "", "عى")},
- {0xfcf8, 0, 0, 0, g(Yes, No, false, false, "", "عي")},
- {0xfcf9, 0, 0, 0, g(Yes, No, false, false, "", "غى")},
- {0xfcfa, 0, 0, 0, g(Yes, No, false, false, "", "غي")},
- {0xfcfb, 0, 0, 0, g(Yes, No, false, false, "", "سى")},
- {0xfcfc, 0, 0, 0, g(Yes, No, false, false, "", "سي")},
- {0xfcfd, 0, 0, 0, g(Yes, No, false, false, "", "شى")},
- {0xfcfe, 0, 0, 0, g(Yes, No, false, false, "", "شي")},
- {0xfcff, 0, 0, 0, g(Yes, No, false, false, "", "حى")},
- {0xfd00, 0, 0, 0, g(Yes, No, false, false, "", "حي")},
- {0xfd01, 0, 0, 0, g(Yes, No, false, false, "", "جى")},
- {0xfd02, 0, 0, 0, g(Yes, No, false, false, "", "جي")},
- {0xfd03, 0, 0, 0, g(Yes, No, false, false, "", "خى")},
- {0xfd04, 0, 0, 0, g(Yes, No, false, false, "", "خي")},
- {0xfd05, 0, 0, 0, g(Yes, No, false, false, "", "صى")},
- {0xfd06, 0, 0, 0, g(Yes, No, false, false, "", "صي")},
- {0xfd07, 0, 0, 0, g(Yes, No, false, false, "", "ضى")},
- {0xfd08, 0, 0, 0, g(Yes, No, false, false, "", "ضي")},
- {0xfd09, 0, 0, 0, g(Yes, No, false, false, "", "شج")},
- {0xfd0a, 0, 0, 0, g(Yes, No, false, false, "", "شح")},
- {0xfd0b, 0, 0, 0, g(Yes, No, false, false, "", "شخ")},
- {0xfd0c, 0, 0, 0, g(Yes, No, false, false, "", "شم")},
- {0xfd0d, 0, 0, 0, g(Yes, No, false, false, "", "شر")},
- {0xfd0e, 0, 0, 0, g(Yes, No, false, false, "", "سر")},
- {0xfd0f, 0, 0, 0, g(Yes, No, false, false, "", "صر")},
- {0xfd10, 0, 0, 0, g(Yes, No, false, false, "", "ضر")},
- {0xfd11, 0, 0, 0, g(Yes, No, false, false, "", "طى")},
- {0xfd12, 0, 0, 0, g(Yes, No, false, false, "", "طي")},
- {0xfd13, 0, 0, 0, g(Yes, No, false, false, "", "عى")},
- {0xfd14, 0, 0, 0, g(Yes, No, false, false, "", "عي")},
- {0xfd15, 0, 0, 0, g(Yes, No, false, false, "", "غى")},
- {0xfd16, 0, 0, 0, g(Yes, No, false, false, "", "غي")},
- {0xfd17, 0, 0, 0, g(Yes, No, false, false, "", "سى")},
- {0xfd18, 0, 0, 0, g(Yes, No, false, false, "", "سي")},
- {0xfd19, 0, 0, 0, g(Yes, No, false, false, "", "شى")},
- {0xfd1a, 0, 0, 0, g(Yes, No, false, false, "", "شي")},
- {0xfd1b, 0, 0, 0, g(Yes, No, false, false, "", "حى")},
- {0xfd1c, 0, 0, 0, g(Yes, No, false, false, "", "حي")},
- {0xfd1d, 0, 0, 0, g(Yes, No, false, false, "", "جى")},
- {0xfd1e, 0, 0, 0, g(Yes, No, false, false, "", "جي")},
- {0xfd1f, 0, 0, 0, g(Yes, No, false, false, "", "خى")},
- {0xfd20, 0, 0, 0, g(Yes, No, false, false, "", "خي")},
- {0xfd21, 0, 0, 0, g(Yes, No, false, false, "", "صى")},
- {0xfd22, 0, 0, 0, g(Yes, No, false, false, "", "صي")},
- {0xfd23, 0, 0, 0, g(Yes, No, false, false, "", "ضى")},
- {0xfd24, 0, 0, 0, g(Yes, No, false, false, "", "ضي")},
- {0xfd25, 0, 0, 0, g(Yes, No, false, false, "", "شج")},
- {0xfd26, 0, 0, 0, g(Yes, No, false, false, "", "شح")},
- {0xfd27, 0, 0, 0, g(Yes, No, false, false, "", "شخ")},
- {0xfd28, 0, 0, 0, g(Yes, No, false, false, "", "شم")},
- {0xfd29, 0, 0, 0, g(Yes, No, false, false, "", "شر")},
- {0xfd2a, 0, 0, 0, g(Yes, No, false, false, "", "سر")},
- {0xfd2b, 0, 0, 0, g(Yes, No, false, false, "", "صر")},
- {0xfd2c, 0, 0, 0, g(Yes, No, false, false, "", "ضر")},
- {0xfd2d, 0, 0, 0, g(Yes, No, false, false, "", "شج")},
- {0xfd2e, 0, 0, 0, g(Yes, No, false, false, "", "شح")},
- {0xfd2f, 0, 0, 0, g(Yes, No, false, false, "", "شخ")},
- {0xfd30, 0, 0, 0, g(Yes, No, false, false, "", "شم")},
- {0xfd31, 0, 0, 0, g(Yes, No, false, false, "", "سه")},
- {0xfd32, 0, 0, 0, g(Yes, No, false, false, "", "شه")},
- {0xfd33, 0, 0, 0, g(Yes, No, false, false, "", "طم")},
- {0xfd34, 0, 0, 0, g(Yes, No, false, false, "", "سج")},
- {0xfd35, 0, 0, 0, g(Yes, No, false, false, "", "سح")},
- {0xfd36, 0, 0, 0, g(Yes, No, false, false, "", "سخ")},
- {0xfd37, 0, 0, 0, g(Yes, No, false, false, "", "شج")},
- {0xfd38, 0, 0, 0, g(Yes, No, false, false, "", "شح")},
- {0xfd39, 0, 0, 0, g(Yes, No, false, false, "", "شخ")},
- {0xfd3a, 0, 0, 0, g(Yes, No, false, false, "", "طم")},
- {0xfd3b, 0, 0, 0, g(Yes, No, false, false, "", "ظم")},
- {0xfd3c, 0, 0, 1, g(Yes, No, false, false, "", "اً")},
- {0xfd3e, 0, 0, 0, f(Yes, false, "")},
- {0xfd50, 0, 0, 0, g(Yes, No, false, false, "", "تجم")},
- {0xfd51, 0, 0, 0, g(Yes, No, false, false, "", "تحج")},
- {0xfd53, 0, 0, 0, g(Yes, No, false, false, "", "تحم")},
- {0xfd54, 0, 0, 0, g(Yes, No, false, false, "", "تخم")},
- {0xfd55, 0, 0, 0, g(Yes, No, false, false, "", "تمج")},
- {0xfd56, 0, 0, 0, g(Yes, No, false, false, "", "تمح")},
- {0xfd57, 0, 0, 0, g(Yes, No, false, false, "", "تمخ")},
- {0xfd58, 0, 0, 0, g(Yes, No, false, false, "", "جمح")},
- {0xfd5a, 0, 0, 0, g(Yes, No, false, false, "", "حمي")},
- {0xfd5b, 0, 0, 0, g(Yes, No, false, false, "", "حمى")},
- {0xfd5c, 0, 0, 0, g(Yes, No, false, false, "", "سحج")},
- {0xfd5d, 0, 0, 0, g(Yes, No, false, false, "", "سجح")},
- {0xfd5e, 0, 0, 0, g(Yes, No, false, false, "", "سجى")},
- {0xfd5f, 0, 0, 0, g(Yes, No, false, false, "", "سمح")},
- {0xfd61, 0, 0, 0, g(Yes, No, false, false, "", "سمج")},
- {0xfd62, 0, 0, 0, g(Yes, No, false, false, "", "سمم")},
- {0xfd64, 0, 0, 0, g(Yes, No, false, false, "", "صحح")},
- {0xfd66, 0, 0, 0, g(Yes, No, false, false, "", "صمم")},
- {0xfd67, 0, 0, 0, g(Yes, No, false, false, "", "شحم")},
- {0xfd69, 0, 0, 0, g(Yes, No, false, false, "", "شجي")},
- {0xfd6a, 0, 0, 0, g(Yes, No, false, false, "", "شمخ")},
- {0xfd6c, 0, 0, 0, g(Yes, No, false, false, "", "شمم")},
- {0xfd6e, 0, 0, 0, g(Yes, No, false, false, "", "ضحى")},
- {0xfd6f, 0, 0, 0, g(Yes, No, false, false, "", "ضخم")},
- {0xfd71, 0, 0, 0, g(Yes, No, false, false, "", "طمح")},
- {0xfd73, 0, 0, 0, g(Yes, No, false, false, "", "طمم")},
- {0xfd74, 0, 0, 0, g(Yes, No, false, false, "", "طمي")},
- {0xfd75, 0, 0, 0, g(Yes, No, false, false, "", "عجم")},
- {0xfd76, 0, 0, 0, g(Yes, No, false, false, "", "عمم")},
- {0xfd78, 0, 0, 0, g(Yes, No, false, false, "", "عمى")},
- {0xfd79, 0, 0, 0, g(Yes, No, false, false, "", "غمم")},
- {0xfd7a, 0, 0, 0, g(Yes, No, false, false, "", "غمي")},
- {0xfd7b, 0, 0, 0, g(Yes, No, false, false, "", "غمى")},
- {0xfd7c, 0, 0, 0, g(Yes, No, false, false, "", "فخم")},
- {0xfd7e, 0, 0, 0, g(Yes, No, false, false, "", "قمح")},
- {0xfd7f, 0, 0, 0, g(Yes, No, false, false, "", "قمم")},
- {0xfd80, 0, 0, 0, g(Yes, No, false, false, "", "لحم")},
- {0xfd81, 0, 0, 0, g(Yes, No, false, false, "", "لحي")},
- {0xfd82, 0, 0, 0, g(Yes, No, false, false, "", "لحى")},
- {0xfd83, 0, 0, 0, g(Yes, No, false, false, "", "لجج")},
- {0xfd85, 0, 0, 0, g(Yes, No, false, false, "", "لخم")},
- {0xfd87, 0, 0, 0, g(Yes, No, false, false, "", "لمح")},
- {0xfd89, 0, 0, 0, g(Yes, No, false, false, "", "محج")},
- {0xfd8a, 0, 0, 0, g(Yes, No, false, false, "", "محم")},
- {0xfd8b, 0, 0, 0, g(Yes, No, false, false, "", "محي")},
- {0xfd8c, 0, 0, 0, g(Yes, No, false, false, "", "مجح")},
- {0xfd8d, 0, 0, 0, g(Yes, No, false, false, "", "مجم")},
- {0xfd8e, 0, 0, 0, g(Yes, No, false, false, "", "مخج")},
- {0xfd8f, 0, 0, 0, g(Yes, No, false, false, "", "مخم")},
- {0xfd90, 0, 0, 0, f(Yes, false, "")},
- {0xfd92, 0, 0, 0, g(Yes, No, false, false, "", "مجخ")},
- {0xfd93, 0, 0, 0, g(Yes, No, false, false, "", "همج")},
- {0xfd94, 0, 0, 0, g(Yes, No, false, false, "", "همم")},
- {0xfd95, 0, 0, 0, g(Yes, No, false, false, "", "نحم")},
- {0xfd96, 0, 0, 0, g(Yes, No, false, false, "", "نحى")},
- {0xfd97, 0, 0, 0, g(Yes, No, false, false, "", "نجم")},
- {0xfd99, 0, 0, 0, g(Yes, No, false, false, "", "نجى")},
- {0xfd9a, 0, 0, 0, g(Yes, No, false, false, "", "نمي")},
- {0xfd9b, 0, 0, 0, g(Yes, No, false, false, "", "نمى")},
- {0xfd9c, 0, 0, 0, g(Yes, No, false, false, "", "يمم")},
- {0xfd9e, 0, 0, 0, g(Yes, No, false, false, "", "بخي")},
- {0xfd9f, 0, 0, 0, g(Yes, No, false, false, "", "تجي")},
- {0xfda0, 0, 0, 0, g(Yes, No, false, false, "", "تجى")},
- {0xfda1, 0, 0, 0, g(Yes, No, false, false, "", "تخي")},
- {0xfda2, 0, 0, 0, g(Yes, No, false, false, "", "تخى")},
- {0xfda3, 0, 0, 0, g(Yes, No, false, false, "", "تمي")},
- {0xfda4, 0, 0, 0, g(Yes, No, false, false, "", "تمى")},
- {0xfda5, 0, 0, 0, g(Yes, No, false, false, "", "جمي")},
- {0xfda6, 0, 0, 0, g(Yes, No, false, false, "", "جحى")},
- {0xfda7, 0, 0, 0, g(Yes, No, false, false, "", "جمى")},
- {0xfda8, 0, 0, 0, g(Yes, No, false, false, "", "سخى")},
- {0xfda9, 0, 0, 0, g(Yes, No, false, false, "", "صحي")},
- {0xfdaa, 0, 0, 0, g(Yes, No, false, false, "", "شحي")},
- {0xfdab, 0, 0, 0, g(Yes, No, false, false, "", "ضحي")},
- {0xfdac, 0, 0, 0, g(Yes, No, false, false, "", "لجي")},
- {0xfdad, 0, 0, 0, g(Yes, No, false, false, "", "لمي")},
- {0xfdae, 0, 0, 0, g(Yes, No, false, false, "", "يحي")},
- {0xfdaf, 0, 0, 0, g(Yes, No, false, false, "", "يجي")},
- {0xfdb0, 0, 0, 0, g(Yes, No, false, false, "", "يمي")},
- {0xfdb1, 0, 0, 0, g(Yes, No, false, false, "", "ممي")},
- {0xfdb2, 0, 0, 0, g(Yes, No, false, false, "", "قمي")},
- {0xfdb3, 0, 0, 0, g(Yes, No, false, false, "", "نحي")},
- {0xfdb4, 0, 0, 0, g(Yes, No, false, false, "", "قمح")},
- {0xfdb5, 0, 0, 0, g(Yes, No, false, false, "", "لحم")},
- {0xfdb6, 0, 0, 0, g(Yes, No, false, false, "", "عمي")},
- {0xfdb7, 0, 0, 0, g(Yes, No, false, false, "", "كمي")},
- {0xfdb8, 0, 0, 0, g(Yes, No, false, false, "", "نجح")},
- {0xfdb9, 0, 0, 0, g(Yes, No, false, false, "", "مخي")},
- {0xfdba, 0, 0, 0, g(Yes, No, false, false, "", "لجم")},
- {0xfdbb, 0, 0, 0, g(Yes, No, false, false, "", "كمم")},
- {0xfdbc, 0, 0, 0, g(Yes, No, false, false, "", "لجم")},
- {0xfdbd, 0, 0, 0, g(Yes, No, false, false, "", "نجح")},
- {0xfdbe, 0, 0, 0, g(Yes, No, false, false, "", "جحي")},
- {0xfdbf, 0, 0, 0, g(Yes, No, false, false, "", "حجي")},
- {0xfdc0, 0, 0, 0, g(Yes, No, false, false, "", "مجي")},
- {0xfdc1, 0, 0, 0, g(Yes, No, false, false, "", "فمي")},
- {0xfdc2, 0, 0, 0, g(Yes, No, false, false, "", "بحي")},
- {0xfdc3, 0, 0, 0, g(Yes, No, false, false, "", "كمم")},
- {0xfdc4, 0, 0, 0, g(Yes, No, false, false, "", "عجم")},
- {0xfdc5, 0, 0, 0, g(Yes, No, false, false, "", "صمم")},
- {0xfdc6, 0, 0, 0, g(Yes, No, false, false, "", "سخي")},
- {0xfdc7, 0, 0, 0, g(Yes, No, false, false, "", "نجي")},
- {0xfdc8, 0, 0, 0, f(Yes, false, "")},
- {0xfdf0, 0, 0, 0, g(Yes, No, false, false, "", "صلے")},
- {0xfdf1, 0, 0, 0, g(Yes, No, false, false, "", "قلے")},
- {0xfdf2, 0, 0, 0, g(Yes, No, false, false, "", "الله")},
- {0xfdf3, 0, 0, 0, g(Yes, No, false, false, "", "اكبر")},
- {0xfdf4, 0, 0, 0, g(Yes, No, false, false, "", "محمد")},
- {0xfdf5, 0, 0, 0, g(Yes, No, false, false, "", "صلعم")},
- {0xfdf6, 0, 0, 0, g(Yes, No, false, false, "", "رسول")},
- {0xfdf7, 0, 0, 0, g(Yes, No, false, false, "", "عليه")},
- {0xfdf8, 0, 0, 0, g(Yes, No, false, false, "", "وسلم")},
- {0xfdf9, 0, 0, 0, g(Yes, No, false, false, "", "صلى")},
- {0xfdfa, 0, 0, 0, g(Yes, No, false, false, "", "صلى الله عليه وسلم")},
- {0xfdfb, 0, 0, 0, g(Yes, No, false, false, "", "جل جلاله")},
- {0xfdfc, 0, 0, 0, g(Yes, No, false, false, "", "ریال")},
- {0xfdfd, 0, 0, 0, f(Yes, false, "")},
- {0xfe10, 0, 0, 0, g(Yes, No, false, false, "", ",")},
- {0xfe11, 0, 0, 0, g(Yes, No, false, false, "", "、")},
- {0xfe12, 0, 0, 0, g(Yes, No, false, false, "", "。")},
- {0xfe13, 0, 0, 0, g(Yes, No, false, false, "", ":")},
- {0xfe14, 0, 0, 0, g(Yes, No, false, false, "", ";")},
- {0xfe15, 0, 0, 0, g(Yes, No, false, false, "", "!")},
- {0xfe16, 0, 0, 0, g(Yes, No, false, false, "", "?")},
- {0xfe17, 0, 0, 0, g(Yes, No, false, false, "", "〖")},
- {0xfe18, 0, 0, 0, g(Yes, No, false, false, "", "〗")},
- {0xfe19, 0, 0, 0, g(Yes, No, false, false, "", "...")},
- {0xfe1a, 0, 0, 0, f(Yes, false, "")},
- {0xfe20, 230, 1, 1, f(Yes, false, "")},
- {0xfe27, 220, 1, 1, f(Yes, false, "")},
- {0xfe2e, 230, 1, 1, f(Yes, false, "")},
- {0xfe30, 0, 0, 0, g(Yes, No, false, false, "", "..")},
- {0xfe31, 0, 0, 0, g(Yes, No, false, false, "", "—")},
- {0xfe32, 0, 0, 0, g(Yes, No, false, false, "", "–")},
- {0xfe33, 0, 0, 0, g(Yes, No, false, false, "", "_")},
- {0xfe35, 0, 0, 0, g(Yes, No, false, false, "", "(")},
- {0xfe36, 0, 0, 0, g(Yes, No, false, false, "", ")")},
- {0xfe37, 0, 0, 0, g(Yes, No, false, false, "", "{")},
- {0xfe38, 0, 0, 0, g(Yes, No, false, false, "", "}")},
- {0xfe39, 0, 0, 0, g(Yes, No, false, false, "", "〔")},
- {0xfe3a, 0, 0, 0, g(Yes, No, false, false, "", "〕")},
- {0xfe3b, 0, 0, 0, g(Yes, No, false, false, "", "【")},
- {0xfe3c, 0, 0, 0, g(Yes, No, false, false, "", "】")},
- {0xfe3d, 0, 0, 0, g(Yes, No, false, false, "", "《")},
- {0xfe3e, 0, 0, 0, g(Yes, No, false, false, "", "》")},
- {0xfe3f, 0, 0, 0, g(Yes, No, false, false, "", "〈")},
- {0xfe40, 0, 0, 0, g(Yes, No, false, false, "", "〉")},
- {0xfe41, 0, 0, 0, g(Yes, No, false, false, "", "「")},
- {0xfe42, 0, 0, 0, g(Yes, No, false, false, "", "」")},
- {0xfe43, 0, 0, 0, g(Yes, No, false, false, "", "『")},
- {0xfe44, 0, 0, 0, g(Yes, No, false, false, "", "』")},
- {0xfe45, 0, 0, 0, f(Yes, false, "")},
- {0xfe47, 0, 0, 0, g(Yes, No, false, false, "", "[")},
- {0xfe48, 0, 0, 0, g(Yes, No, false, false, "", "]")},
- {0xfe49, 0, 0, 1, g(Yes, No, false, false, "", " ̅")},
- {0xfe4d, 0, 0, 0, g(Yes, No, false, false, "", "_")},
- {0xfe50, 0, 0, 0, g(Yes, No, false, false, "", ",")},
- {0xfe51, 0, 0, 0, g(Yes, No, false, false, "", "、")},
- {0xfe52, 0, 0, 0, g(Yes, No, false, false, "", ".")},
- {0xfe53, 0, 0, 0, f(Yes, false, "")},
- {0xfe54, 0, 0, 0, g(Yes, No, false, false, "", ";")},
- {0xfe55, 0, 0, 0, g(Yes, No, false, false, "", ":")},
- {0xfe56, 0, 0, 0, g(Yes, No, false, false, "", "?")},
- {0xfe57, 0, 0, 0, g(Yes, No, false, false, "", "!")},
- {0xfe58, 0, 0, 0, g(Yes, No, false, false, "", "—")},
- {0xfe59, 0, 0, 0, g(Yes, No, false, false, "", "(")},
- {0xfe5a, 0, 0, 0, g(Yes, No, false, false, "", ")")},
- {0xfe5b, 0, 0, 0, g(Yes, No, false, false, "", "{")},
- {0xfe5c, 0, 0, 0, g(Yes, No, false, false, "", "}")},
- {0xfe5d, 0, 0, 0, g(Yes, No, false, false, "", "〔")},
- {0xfe5e, 0, 0, 0, g(Yes, No, false, false, "", "〕")},
- {0xfe5f, 0, 0, 0, g(Yes, No, false, false, "", "#")},
- {0xfe60, 0, 0, 0, g(Yes, No, false, false, "", "&")},
- {0xfe61, 0, 0, 0, g(Yes, No, false, false, "", "*")},
- {0xfe62, 0, 0, 0, g(Yes, No, false, false, "", "+")},
- {0xfe63, 0, 0, 0, g(Yes, No, false, false, "", "-")},
- {0xfe64, 0, 0, 0, g(Yes, No, false, false, "", "<")},
- {0xfe65, 0, 0, 0, g(Yes, No, false, false, "", ">")},
- {0xfe66, 0, 0, 0, g(Yes, No, false, false, "", "=")},
- {0xfe67, 0, 0, 0, f(Yes, false, "")},
- {0xfe68, 0, 0, 0, g(Yes, No, false, false, "", "\\")},
- {0xfe69, 0, 0, 0, g(Yes, No, false, false, "", "$")},
- {0xfe6a, 0, 0, 0, g(Yes, No, false, false, "", "%")},
- {0xfe6b, 0, 0, 0, g(Yes, No, false, false, "", "@")},
- {0xfe6c, 0, 0, 0, f(Yes, false, "")},
- {0xfe70, 0, 0, 1, g(Yes, No, false, false, "", " ً")},
- {0xfe71, 0, 0, 1, g(Yes, No, false, false, "", "ـً")},
- {0xfe72, 0, 0, 1, g(Yes, No, false, false, "", " ٌ")},
- {0xfe73, 0, 0, 0, f(Yes, false, "")},
- {0xfe74, 0, 0, 1, g(Yes, No, false, false, "", " ٍ")},
- {0xfe75, 0, 0, 0, f(Yes, false, "")},
- {0xfe76, 0, 0, 1, g(Yes, No, false, false, "", " َ")},
- {0xfe77, 0, 0, 1, g(Yes, No, false, false, "", "ـَ")},
- {0xfe78, 0, 0, 1, g(Yes, No, false, false, "", " ُ")},
- {0xfe79, 0, 0, 1, g(Yes, No, false, false, "", "ـُ")},
- {0xfe7a, 0, 0, 1, g(Yes, No, false, false, "", " ِ")},
- {0xfe7b, 0, 0, 1, g(Yes, No, false, false, "", "ـِ")},
- {0xfe7c, 0, 0, 1, g(Yes, No, false, false, "", " ّ")},
- {0xfe7d, 0, 0, 1, g(Yes, No, false, false, "", "ـّ")},
- {0xfe7e, 0, 0, 1, g(Yes, No, false, false, "", " ْ")},
- {0xfe7f, 0, 0, 1, g(Yes, No, false, false, "", "ـْ")},
- {0xfe80, 0, 0, 0, g(Yes, No, false, false, "", "ء")},
- {0xfe81, 0, 0, 1, g(Yes, No, false, false, "", "آ")},
- {0xfe83, 0, 0, 1, g(Yes, No, false, false, "", "أ")},
- {0xfe85, 0, 0, 1, g(Yes, No, false, false, "", "ؤ")},
- {0xfe87, 0, 0, 1, g(Yes, No, false, false, "", "إ")},
- {0xfe89, 0, 0, 1, g(Yes, No, false, false, "", "ئ")},
- {0xfe8d, 0, 0, 0, g(Yes, No, false, false, "", "ا")},
- {0xfe8f, 0, 0, 0, g(Yes, No, false, false, "", "ب")},
- {0xfe93, 0, 0, 0, g(Yes, No, false, false, "", "ة")},
- {0xfe95, 0, 0, 0, g(Yes, No, false, false, "", "ت")},
- {0xfe99, 0, 0, 0, g(Yes, No, false, false, "", "ث")},
- {0xfe9d, 0, 0, 0, g(Yes, No, false, false, "", "ج")},
- {0xfea1, 0, 0, 0, g(Yes, No, false, false, "", "ح")},
- {0xfea5, 0, 0, 0, g(Yes, No, false, false, "", "خ")},
- {0xfea9, 0, 0, 0, g(Yes, No, false, false, "", "د")},
- {0xfeab, 0, 0, 0, g(Yes, No, false, false, "", "ذ")},
- {0xfead, 0, 0, 0, g(Yes, No, false, false, "", "ر")},
- {0xfeaf, 0, 0, 0, g(Yes, No, false, false, "", "ز")},
- {0xfeb1, 0, 0, 0, g(Yes, No, false, false, "", "س")},
- {0xfeb5, 0, 0, 0, g(Yes, No, false, false, "", "ش")},
- {0xfeb9, 0, 0, 0, g(Yes, No, false, false, "", "ص")},
- {0xfebd, 0, 0, 0, g(Yes, No, false, false, "", "ض")},
- {0xfec1, 0, 0, 0, g(Yes, No, false, false, "", "ط")},
- {0xfec5, 0, 0, 0, g(Yes, No, false, false, "", "ظ")},
- {0xfec9, 0, 0, 0, g(Yes, No, false, false, "", "ع")},
- {0xfecd, 0, 0, 0, g(Yes, No, false, false, "", "غ")},
- {0xfed1, 0, 0, 0, g(Yes, No, false, false, "", "ف")},
- {0xfed5, 0, 0, 0, g(Yes, No, false, false, "", "ق")},
- {0xfed9, 0, 0, 0, g(Yes, No, false, false, "", "ك")},
- {0xfedd, 0, 0, 0, g(Yes, No, false, false, "", "ل")},
- {0xfee1, 0, 0, 0, g(Yes, No, false, false, "", "م")},
- {0xfee5, 0, 0, 0, g(Yes, No, false, false, "", "ن")},
- {0xfee9, 0, 0, 0, g(Yes, No, false, false, "", "ه")},
- {0xfeed, 0, 0, 0, g(Yes, No, false, false, "", "و")},
- {0xfeef, 0, 0, 0, g(Yes, No, false, false, "", "ى")},
- {0xfef1, 0, 0, 0, g(Yes, No, false, false, "", "ي")},
- {0xfef5, 0, 0, 1, g(Yes, No, false, false, "", "لآ")},
- {0xfef7, 0, 0, 1, g(Yes, No, false, false, "", "لأ")},
- {0xfef9, 0, 0, 1, g(Yes, No, false, false, "", "لإ")},
- {0xfefb, 0, 0, 0, g(Yes, No, false, false, "", "لا")},
- {0xfefd, 0, 0, 0, f(Yes, false, "")},
- {0xff01, 0, 0, 0, g(Yes, No, false, false, "", "!")},
- {0xff02, 0, 0, 0, g(Yes, No, false, false, "", "\"")},
- {0xff03, 0, 0, 0, g(Yes, No, false, false, "", "#")},
- {0xff04, 0, 0, 0, g(Yes, No, false, false, "", "$")},
- {0xff05, 0, 0, 0, g(Yes, No, false, false, "", "%")},
- {0xff06, 0, 0, 0, g(Yes, No, false, false, "", "&")},
- {0xff07, 0, 0, 0, g(Yes, No, false, false, "", "'")},
- {0xff08, 0, 0, 0, g(Yes, No, false, false, "", "(")},
- {0xff09, 0, 0, 0, g(Yes, No, false, false, "", ")")},
- {0xff0a, 0, 0, 0, g(Yes, No, false, false, "", "*")},
- {0xff0b, 0, 0, 0, g(Yes, No, false, false, "", "+")},
- {0xff0c, 0, 0, 0, g(Yes, No, false, false, "", ",")},
- {0xff0d, 0, 0, 0, g(Yes, No, false, false, "", "-")},
- {0xff0e, 0, 0, 0, g(Yes, No, false, false, "", ".")},
- {0xff0f, 0, 0, 0, g(Yes, No, false, false, "", "/")},
- {0xff10, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0xff11, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0xff12, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0xff13, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0xff14, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0xff15, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0xff16, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0xff17, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0xff18, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0xff19, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0xff1a, 0, 0, 0, g(Yes, No, false, false, "", ":")},
- {0xff1b, 0, 0, 0, g(Yes, No, false, false, "", ";")},
- {0xff1c, 0, 0, 0, g(Yes, No, false, false, "", "<")},
- {0xff1d, 0, 0, 0, g(Yes, No, false, false, "", "=")},
- {0xff1e, 0, 0, 0, g(Yes, No, false, false, "", ">")},
- {0xff1f, 0, 0, 0, g(Yes, No, false, false, "", "?")},
- {0xff20, 0, 0, 0, g(Yes, No, false, false, "", "@")},
- {0xff21, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0xff22, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0xff23, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0xff24, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0xff25, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0xff26, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0xff27, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0xff28, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0xff29, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0xff2a, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0xff2b, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0xff2c, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0xff2d, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0xff2e, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0xff2f, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0xff30, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0xff31, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0xff32, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0xff33, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0xff34, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0xff35, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0xff36, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0xff37, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0xff38, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0xff39, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0xff3a, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0xff3b, 0, 0, 0, g(Yes, No, false, false, "", "[")},
- {0xff3c, 0, 0, 0, g(Yes, No, false, false, "", "\\")},
- {0xff3d, 0, 0, 0, g(Yes, No, false, false, "", "]")},
- {0xff3e, 0, 0, 0, g(Yes, No, false, false, "", "^")},
- {0xff3f, 0, 0, 0, g(Yes, No, false, false, "", "_")},
- {0xff40, 0, 0, 0, g(Yes, No, false, false, "", "`")},
- {0xff41, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0xff42, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0xff43, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0xff44, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0xff45, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0xff46, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0xff47, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0xff48, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0xff49, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0xff4a, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0xff4b, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0xff4c, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0xff4d, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0xff4e, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0xff4f, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0xff50, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0xff51, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0xff52, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0xff53, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0xff54, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0xff55, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0xff56, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0xff57, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0xff58, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0xff59, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0xff5a, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0xff5b, 0, 0, 0, g(Yes, No, false, false, "", "{")},
- {0xff5c, 0, 0, 0, g(Yes, No, false, false, "", "|")},
- {0xff5d, 0, 0, 0, g(Yes, No, false, false, "", "}")},
- {0xff5e, 0, 0, 0, g(Yes, No, false, false, "", "~")},
- {0xff5f, 0, 0, 0, g(Yes, No, false, false, "", "⦅")},
- {0xff60, 0, 0, 0, g(Yes, No, false, false, "", "⦆")},
- {0xff61, 0, 0, 0, g(Yes, No, false, false, "", "。")},
- {0xff62, 0, 0, 0, g(Yes, No, false, false, "", "「")},
- {0xff63, 0, 0, 0, g(Yes, No, false, false, "", "」")},
- {0xff64, 0, 0, 0, g(Yes, No, false, false, "", "、")},
- {0xff65, 0, 0, 0, g(Yes, No, false, false, "", "・")},
- {0xff66, 0, 0, 0, g(Yes, No, false, false, "", "ヲ")},
- {0xff67, 0, 0, 0, g(Yes, No, false, false, "", "ァ")},
- {0xff68, 0, 0, 0, g(Yes, No, false, false, "", "ィ")},
- {0xff69, 0, 0, 0, g(Yes, No, false, false, "", "ゥ")},
- {0xff6a, 0, 0, 0, g(Yes, No, false, false, "", "ェ")},
- {0xff6b, 0, 0, 0, g(Yes, No, false, false, "", "ォ")},
- {0xff6c, 0, 0, 0, g(Yes, No, false, false, "", "ャ")},
- {0xff6d, 0, 0, 0, g(Yes, No, false, false, "", "ュ")},
- {0xff6e, 0, 0, 0, g(Yes, No, false, false, "", "ョ")},
- {0xff6f, 0, 0, 0, g(Yes, No, false, false, "", "ッ")},
- {0xff70, 0, 0, 0, g(Yes, No, false, false, "", "ー")},
- {0xff71, 0, 0, 0, g(Yes, No, false, false, "", "ア")},
- {0xff72, 0, 0, 0, g(Yes, No, false, false, "", "イ")},
- {0xff73, 0, 0, 0, g(Yes, No, false, false, "", "ウ")},
- {0xff74, 0, 0, 0, g(Yes, No, false, false, "", "エ")},
- {0xff75, 0, 0, 0, g(Yes, No, false, false, "", "オ")},
- {0xff76, 0, 0, 0, g(Yes, No, false, false, "", "カ")},
- {0xff77, 0, 0, 0, g(Yes, No, false, false, "", "キ")},
- {0xff78, 0, 0, 0, g(Yes, No, false, false, "", "ク")},
- {0xff79, 0, 0, 0, g(Yes, No, false, false, "", "ケ")},
- {0xff7a, 0, 0, 0, g(Yes, No, false, false, "", "コ")},
- {0xff7b, 0, 0, 0, g(Yes, No, false, false, "", "サ")},
- {0xff7c, 0, 0, 0, g(Yes, No, false, false, "", "シ")},
- {0xff7d, 0, 0, 0, g(Yes, No, false, false, "", "ス")},
- {0xff7e, 0, 0, 0, g(Yes, No, false, false, "", "セ")},
- {0xff7f, 0, 0, 0, g(Yes, No, false, false, "", "ソ")},
- {0xff80, 0, 0, 0, g(Yes, No, false, false, "", "タ")},
- {0xff81, 0, 0, 0, g(Yes, No, false, false, "", "チ")},
- {0xff82, 0, 0, 0, g(Yes, No, false, false, "", "ツ")},
- {0xff83, 0, 0, 0, g(Yes, No, false, false, "", "テ")},
- {0xff84, 0, 0, 0, g(Yes, No, false, false, "", "ト")},
- {0xff85, 0, 0, 0, g(Yes, No, false, false, "", "ナ")},
- {0xff86, 0, 0, 0, g(Yes, No, false, false, "", "ニ")},
- {0xff87, 0, 0, 0, g(Yes, No, false, false, "", "ヌ")},
- {0xff88, 0, 0, 0, g(Yes, No, false, false, "", "ネ")},
- {0xff89, 0, 0, 0, g(Yes, No, false, false, "", "ノ")},
- {0xff8a, 0, 0, 0, g(Yes, No, false, false, "", "ハ")},
- {0xff8b, 0, 0, 0, g(Yes, No, false, false, "", "ヒ")},
- {0xff8c, 0, 0, 0, g(Yes, No, false, false, "", "フ")},
- {0xff8d, 0, 0, 0, g(Yes, No, false, false, "", "ヘ")},
- {0xff8e, 0, 0, 0, g(Yes, No, false, false, "", "ホ")},
- {0xff8f, 0, 0, 0, g(Yes, No, false, false, "", "マ")},
- {0xff90, 0, 0, 0, g(Yes, No, false, false, "", "ミ")},
- {0xff91, 0, 0, 0, g(Yes, No, false, false, "", "ム")},
- {0xff92, 0, 0, 0, g(Yes, No, false, false, "", "メ")},
- {0xff93, 0, 0, 0, g(Yes, No, false, false, "", "モ")},
- {0xff94, 0, 0, 0, g(Yes, No, false, false, "", "ヤ")},
- {0xff95, 0, 0, 0, g(Yes, No, false, false, "", "ユ")},
- {0xff96, 0, 0, 0, g(Yes, No, false, false, "", "ヨ")},
- {0xff97, 0, 0, 0, g(Yes, No, false, false, "", "ラ")},
- {0xff98, 0, 0, 0, g(Yes, No, false, false, "", "リ")},
- {0xff99, 0, 0, 0, g(Yes, No, false, false, "", "ル")},
- {0xff9a, 0, 0, 0, g(Yes, No, false, false, "", "レ")},
- {0xff9b, 0, 0, 0, g(Yes, No, false, false, "", "ロ")},
- {0xff9c, 0, 0, 0, g(Yes, No, false, false, "", "ワ")},
- {0xff9d, 0, 0, 0, g(Yes, No, false, false, "", "ン")},
- {0xff9e, 0, 1, 1, g(Yes, No, false, false, "", "゙")},
- {0xff9f, 0, 1, 1, g(Yes, No, false, false, "", "゚")},
- {0xffa0, 0, 0, 0, g(Yes, No, false, false, "", "ᅠ")},
- {0xffa1, 0, 0, 0, g(Yes, No, false, false, "", "ᄀ")},
- {0xffa2, 0, 0, 0, g(Yes, No, false, false, "", "ᄁ")},
- {0xffa3, 0, 1, 1, g(Yes, No, false, false, "", "ᆪ")},
- {0xffa4, 0, 0, 0, g(Yes, No, false, false, "", "ᄂ")},
- {0xffa5, 0, 1, 1, g(Yes, No, false, false, "", "ᆬ")},
- {0xffa6, 0, 1, 1, g(Yes, No, false, false, "", "ᆭ")},
- {0xffa7, 0, 0, 0, g(Yes, No, false, false, "", "ᄃ")},
- {0xffa8, 0, 0, 0, g(Yes, No, false, false, "", "ᄄ")},
- {0xffa9, 0, 0, 0, g(Yes, No, false, false, "", "ᄅ")},
- {0xffaa, 0, 1, 1, g(Yes, No, false, false, "", "ᆰ")},
- {0xffab, 0, 1, 1, g(Yes, No, false, false, "", "ᆱ")},
- {0xffac, 0, 1, 1, g(Yes, No, false, false, "", "ᆲ")},
- {0xffad, 0, 1, 1, g(Yes, No, false, false, "", "ᆳ")},
- {0xffae, 0, 1, 1, g(Yes, No, false, false, "", "ᆴ")},
- {0xffaf, 0, 1, 1, g(Yes, No, false, false, "", "ᆵ")},
- {0xffb0, 0, 0, 0, g(Yes, No, false, false, "", "ᄚ")},
- {0xffb1, 0, 0, 0, g(Yes, No, false, false, "", "ᄆ")},
- {0xffb2, 0, 0, 0, g(Yes, No, false, false, "", "ᄇ")},
- {0xffb3, 0, 0, 0, g(Yes, No, false, false, "", "ᄈ")},
- {0xffb4, 0, 0, 0, g(Yes, No, false, false, "", "ᄡ")},
- {0xffb5, 0, 0, 0, g(Yes, No, false, false, "", "ᄉ")},
- {0xffb6, 0, 0, 0, g(Yes, No, false, false, "", "ᄊ")},
- {0xffb7, 0, 0, 0, g(Yes, No, false, false, "", "ᄋ")},
- {0xffb8, 0, 0, 0, g(Yes, No, false, false, "", "ᄌ")},
- {0xffb9, 0, 0, 0, g(Yes, No, false, false, "", "ᄍ")},
- {0xffba, 0, 0, 0, g(Yes, No, false, false, "", "ᄎ")},
- {0xffbb, 0, 0, 0, g(Yes, No, false, false, "", "ᄏ")},
- {0xffbc, 0, 0, 0, g(Yes, No, false, false, "", "ᄐ")},
- {0xffbd, 0, 0, 0, g(Yes, No, false, false, "", "ᄑ")},
- {0xffbe, 0, 0, 0, g(Yes, No, false, false, "", "ᄒ")},
- {0xffbf, 0, 0, 0, f(Yes, false, "")},
- {0xffc2, 0, 1, 1, g(Yes, No, false, false, "", "ᅡ")},
- {0xffc3, 0, 1, 1, g(Yes, No, false, false, "", "ᅢ")},
- {0xffc4, 0, 1, 1, g(Yes, No, false, false, "", "ᅣ")},
- {0xffc5, 0, 1, 1, g(Yes, No, false, false, "", "ᅤ")},
- {0xffc6, 0, 1, 1, g(Yes, No, false, false, "", "ᅥ")},
- {0xffc7, 0, 1, 1, g(Yes, No, false, false, "", "ᅦ")},
- {0xffc8, 0, 0, 0, f(Yes, false, "")},
- {0xffca, 0, 1, 1, g(Yes, No, false, false, "", "ᅧ")},
- {0xffcb, 0, 1, 1, g(Yes, No, false, false, "", "ᅨ")},
- {0xffcc, 0, 1, 1, g(Yes, No, false, false, "", "ᅩ")},
- {0xffcd, 0, 1, 1, g(Yes, No, false, false, "", "ᅪ")},
- {0xffce, 0, 1, 1, g(Yes, No, false, false, "", "ᅫ")},
- {0xffcf, 0, 1, 1, g(Yes, No, false, false, "", "ᅬ")},
- {0xffd0, 0, 0, 0, f(Yes, false, "")},
- {0xffd2, 0, 1, 1, g(Yes, No, false, false, "", "ᅭ")},
- {0xffd3, 0, 1, 1, g(Yes, No, false, false, "", "ᅮ")},
- {0xffd4, 0, 1, 1, g(Yes, No, false, false, "", "ᅯ")},
- {0xffd5, 0, 1, 1, g(Yes, No, false, false, "", "ᅰ")},
- {0xffd6, 0, 1, 1, g(Yes, No, false, false, "", "ᅱ")},
- {0xffd7, 0, 1, 1, g(Yes, No, false, false, "", "ᅲ")},
- {0xffd8, 0, 0, 0, f(Yes, false, "")},
- {0xffda, 0, 1, 1, g(Yes, No, false, false, "", "ᅳ")},
- {0xffdb, 0, 1, 1, g(Yes, No, false, false, "", "ᅴ")},
- {0xffdc, 0, 1, 1, g(Yes, No, false, false, "", "ᅵ")},
- {0xffdd, 0, 0, 0, f(Yes, false, "")},
- {0xffe0, 0, 0, 0, g(Yes, No, false, false, "", "¢")},
- {0xffe1, 0, 0, 0, g(Yes, No, false, false, "", "£")},
- {0xffe2, 0, 0, 0, g(Yes, No, false, false, "", "¬")},
- {0xffe3, 0, 0, 1, g(Yes, No, false, false, "", " ̄")},
- {0xffe4, 0, 0, 0, g(Yes, No, false, false, "", "¦")},
- {0xffe5, 0, 0, 0, g(Yes, No, false, false, "", "¥")},
- {0xffe6, 0, 0, 0, g(Yes, No, false, false, "", "₩")},
- {0xffe7, 0, 0, 0, f(Yes, false, "")},
- {0xffe8, 0, 0, 0, g(Yes, No, false, false, "", "│")},
- {0xffe9, 0, 0, 0, g(Yes, No, false, false, "", "←")},
- {0xffea, 0, 0, 0, g(Yes, No, false, false, "", "↑")},
- {0xffeb, 0, 0, 0, g(Yes, No, false, false, "", "→")},
- {0xffec, 0, 0, 0, g(Yes, No, false, false, "", "↓")},
- {0xffed, 0, 0, 0, g(Yes, No, false, false, "", "■")},
- {0xffee, 0, 0, 0, g(Yes, No, false, false, "", "○")},
- {0xffef, 0, 0, 0, f(Yes, false, "")},
- {0x101fd, 220, 1, 1, f(Yes, false, "")},
- {0x101fe, 0, 0, 0, f(Yes, false, "")},
- {0x102e0, 220, 1, 1, f(Yes, false, "")},
- {0x102e1, 0, 0, 0, f(Yes, false, "")},
- {0x10376, 230, 1, 1, f(Yes, false, "")},
- {0x1037b, 0, 0, 0, f(Yes, false, "")},
- {0x10a0d, 220, 1, 1, f(Yes, false, "")},
- {0x10a0e, 0, 0, 0, f(Yes, false, "")},
- {0x10a0f, 230, 1, 1, f(Yes, false, "")},
- {0x10a10, 0, 0, 0, f(Yes, false, "")},
- {0x10a38, 230, 1, 1, f(Yes, false, "")},
- {0x10a39, 1, 1, 1, f(Yes, false, "")},
- {0x10a3a, 220, 1, 1, f(Yes, false, "")},
- {0x10a3b, 0, 0, 0, f(Yes, false, "")},
- {0x10a3f, 9, 1, 1, f(Yes, false, "")},
- {0x10a40, 0, 0, 0, f(Yes, false, "")},
- {0x10ae5, 230, 1, 1, f(Yes, false, "")},
- {0x10ae6, 220, 1, 1, f(Yes, false, "")},
- {0x10ae7, 0, 0, 0, f(Yes, false, "")},
- {0x11046, 9, 1, 1, f(Yes, false, "")},
- {0x11047, 0, 0, 0, f(Yes, false, "")},
- {0x1107f, 9, 1, 1, f(Yes, false, "")},
- {0x11080, 0, 0, 0, f(Yes, false, "")},
- {0x11099, 0, 0, 0, f(Yes, true, "")},
- {0x1109a, 0, 0, 1, f(Yes, false, "𑂚")},
- {0x1109b, 0, 0, 0, f(Yes, true, "")},
- {0x1109c, 0, 0, 1, f(Yes, false, "𑂜")},
- {0x1109d, 0, 0, 0, f(Yes, false, "")},
- {0x110a5, 0, 0, 0, f(Yes, true, "")},
- {0x110a6, 0, 0, 0, f(Yes, false, "")},
- {0x110ab, 0, 0, 1, f(Yes, false, "𑂫")},
- {0x110ac, 0, 0, 0, f(Yes, false, "")},
- {0x110b9, 9, 1, 1, f(Yes, false, "")},
- {0x110ba, 7, 1, 1, f(Maybe, false, "")},
- {0x110bb, 0, 0, 0, f(Yes, false, "")},
- {0x11100, 230, 1, 1, f(Yes, false, "")},
- {0x11103, 0, 0, 0, f(Yes, false, "")},
- {0x11127, 0, 1, 1, f(Maybe, false, "")},
- {0x11128, 0, 0, 0, f(Yes, false, "")},
- {0x1112e, 0, 0, 1, f(Yes, false, "𑄮")},
- {0x1112f, 0, 0, 1, f(Yes, false, "𑄯")},
- {0x11130, 0, 0, 0, f(Yes, false, "")},
- {0x11131, 0, 0, 0, f(Yes, true, "")},
- {0x11133, 9, 1, 1, f(Yes, false, "")},
- {0x11135, 0, 0, 0, f(Yes, false, "")},
- {0x11173, 7, 1, 1, f(Yes, false, "")},
- {0x11174, 0, 0, 0, f(Yes, false, "")},
- {0x111c0, 9, 1, 1, f(Yes, false, "")},
- {0x111c1, 0, 0, 0, f(Yes, false, "")},
- {0x111ca, 7, 1, 1, f(Yes, false, "")},
- {0x111cb, 0, 0, 0, f(Yes, false, "")},
- {0x11235, 9, 1, 1, f(Yes, false, "")},
- {0x11236, 7, 1, 1, f(Yes, false, "")},
- {0x11237, 0, 0, 0, f(Yes, false, "")},
- {0x112e9, 7, 1, 1, f(Yes, false, "")},
- {0x112ea, 9, 1, 1, f(Yes, false, "")},
- {0x112eb, 0, 0, 0, f(Yes, false, "")},
- {0x1133c, 7, 1, 1, f(Yes, false, "")},
- {0x1133d, 0, 0, 0, f(Yes, false, "")},
- {0x1133e, 0, 1, 1, f(Maybe, false, "")},
- {0x1133f, 0, 0, 0, f(Yes, false, "")},
- {0x11347, 0, 0, 0, f(Yes, true, "")},
- {0x11348, 0, 0, 0, f(Yes, false, "")},
- {0x1134b, 0, 0, 1, f(Yes, false, "𑍋")},
- {0x1134c, 0, 0, 1, f(Yes, false, "𑍌")},
- {0x1134d, 9, 1, 1, f(Yes, false, "")},
- {0x1134e, 0, 0, 0, f(Yes, false, "")},
- {0x11357, 0, 1, 1, f(Maybe, false, "")},
- {0x11358, 0, 0, 0, f(Yes, false, "")},
- {0x11366, 230, 1, 1, f(Yes, false, "")},
- {0x1136d, 0, 0, 0, f(Yes, false, "")},
- {0x11370, 230, 1, 1, f(Yes, false, "")},
- {0x11375, 0, 0, 0, f(Yes, false, "")},
- {0x11442, 9, 1, 1, f(Yes, false, "")},
- {0x11443, 0, 0, 0, f(Yes, false, "")},
- {0x11446, 7, 1, 1, f(Yes, false, "")},
- {0x11447, 0, 0, 0, f(Yes, false, "")},
- {0x114b0, 0, 1, 1, f(Maybe, false, "")},
- {0x114b1, 0, 0, 0, f(Yes, false, "")},
- {0x114b9, 0, 0, 0, f(Yes, true, "")},
- {0x114ba, 0, 1, 1, f(Maybe, false, "")},
- {0x114bb, 0, 0, 1, f(Yes, false, "𑒻")},
- {0x114bc, 0, 0, 1, f(Yes, false, "𑒼")},
- {0x114bd, 0, 1, 1, f(Maybe, false, "")},
- {0x114be, 0, 0, 1, f(Yes, false, "𑒾")},
- {0x114bf, 0, 0, 0, f(Yes, false, "")},
- {0x114c2, 9, 1, 1, f(Yes, false, "")},
- {0x114c3, 7, 1, 1, f(Yes, false, "")},
- {0x114c4, 0, 0, 0, f(Yes, false, "")},
- {0x115af, 0, 1, 1, f(Maybe, false, "")},
- {0x115b0, 0, 0, 0, f(Yes, false, "")},
- {0x115b8, 0, 0, 0, f(Yes, true, "")},
- {0x115ba, 0, 0, 1, f(Yes, false, "𑖺")},
- {0x115bb, 0, 0, 1, f(Yes, false, "𑖻")},
- {0x115bc, 0, 0, 0, f(Yes, false, "")},
- {0x115bf, 9, 1, 1, f(Yes, false, "")},
- {0x115c0, 7, 1, 1, f(Yes, false, "")},
- {0x115c1, 0, 0, 0, f(Yes, false, "")},
- {0x1163f, 9, 1, 1, f(Yes, false, "")},
- {0x11640, 0, 0, 0, f(Yes, false, "")},
- {0x116b6, 9, 1, 1, f(Yes, false, "")},
- {0x116b7, 7, 1, 1, f(Yes, false, "")},
- {0x116b8, 0, 0, 0, f(Yes, false, "")},
- {0x1172b, 9, 1, 1, f(Yes, false, "")},
- {0x1172c, 0, 0, 0, f(Yes, false, "")},
- {0x11a34, 9, 1, 1, f(Yes, false, "")},
- {0x11a35, 0, 0, 0, f(Yes, false, "")},
- {0x11a47, 9, 1, 1, f(Yes, false, "")},
- {0x11a48, 0, 0, 0, f(Yes, false, "")},
- {0x11a99, 9, 1, 1, f(Yes, false, "")},
- {0x11a9a, 0, 0, 0, f(Yes, false, "")},
- {0x11c3f, 9, 1, 1, f(Yes, false, "")},
- {0x11c40, 0, 0, 0, f(Yes, false, "")},
- {0x11d42, 7, 1, 1, f(Yes, false, "")},
- {0x11d43, 0, 0, 0, f(Yes, false, "")},
- {0x11d44, 9, 1, 1, f(Yes, false, "")},
- {0x11d46, 0, 0, 0, f(Yes, false, "")},
- {0x16af0, 1, 1, 1, f(Yes, false, "")},
- {0x16af5, 0, 0, 0, f(Yes, false, "")},
- {0x16b30, 230, 1, 1, f(Yes, false, "")},
- {0x16b37, 0, 0, 0, f(Yes, false, "")},
- {0x1bc9e, 1, 1, 1, f(Yes, false, "")},
- {0x1bc9f, 0, 0, 0, f(Yes, false, "")},
- {0x1d15e, 0, 0, 1, f(No, false, "𝅗𝅥")},
- {0x1d15f, 0, 0, 1, f(No, false, "𝅘𝅥")},
- {0x1d160, 0, 0, 2, f(No, false, "𝅘𝅥𝅮")},
- {0x1d161, 0, 0, 2, f(No, false, "𝅘𝅥𝅯")},
- {0x1d162, 0, 0, 2, f(No, false, "𝅘𝅥𝅰")},
- {0x1d163, 0, 0, 2, f(No, false, "𝅘𝅥𝅱")},
- {0x1d164, 0, 0, 2, f(No, false, "𝅘𝅥𝅲")},
- {0x1d165, 216, 1, 1, f(Yes, false, "")},
- {0x1d167, 1, 1, 1, f(Yes, false, "")},
- {0x1d16a, 0, 0, 0, f(Yes, false, "")},
- {0x1d16d, 226, 1, 1, f(Yes, false, "")},
- {0x1d16e, 216, 1, 1, f(Yes, false, "")},
- {0x1d173, 0, 0, 0, f(Yes, false, "")},
- {0x1d17b, 220, 1, 1, f(Yes, false, "")},
- {0x1d183, 0, 0, 0, f(Yes, false, "")},
- {0x1d185, 230, 1, 1, f(Yes, false, "")},
- {0x1d18a, 220, 1, 1, f(Yes, false, "")},
- {0x1d18c, 0, 0, 0, f(Yes, false, "")},
- {0x1d1aa, 230, 1, 1, f(Yes, false, "")},
- {0x1d1ae, 0, 0, 0, f(Yes, false, "")},
- {0x1d1bb, 0, 0, 1, f(No, false, "𝆹𝅥")},
- {0x1d1bc, 0, 0, 1, f(No, false, "𝆺𝅥")},
- {0x1d1bd, 0, 0, 2, f(No, false, "𝆹𝅥𝅮")},
- {0x1d1be, 0, 0, 2, f(No, false, "𝆺𝅥𝅮")},
- {0x1d1bf, 0, 0, 2, f(No, false, "𝆹𝅥𝅯")},
- {0x1d1c0, 0, 0, 2, f(No, false, "𝆺𝅥𝅯")},
- {0x1d1c1, 0, 0, 0, f(Yes, false, "")},
- {0x1d242, 230, 1, 1, f(Yes, false, "")},
- {0x1d245, 0, 0, 0, f(Yes, false, "")},
- {0x1d400, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d401, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d402, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d403, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d404, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d405, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d406, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d407, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d408, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d409, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d40a, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d40b, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d40c, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d40d, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d40e, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d40f, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d410, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d411, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d412, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d413, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d414, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d415, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d416, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d417, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d418, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d419, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d41a, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d41b, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d41c, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d41d, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d41e, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d41f, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d420, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d421, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d422, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d423, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d424, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d425, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d426, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d427, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d428, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d429, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d42a, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d42b, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d42c, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d42d, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d42e, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d42f, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d430, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d431, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d432, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d433, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d434, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d435, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d436, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d437, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d438, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d439, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d43a, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d43b, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d43c, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d43d, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d43e, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d43f, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d440, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d441, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d442, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d443, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d444, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d445, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d446, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d447, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d448, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d449, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d44a, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d44b, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d44c, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d44d, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d44e, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d44f, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d450, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d451, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d452, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d453, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d454, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d455, 0, 0, 0, f(Yes, false, "")},
- {0x1d456, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d457, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d458, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d459, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d45a, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d45b, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d45c, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d45d, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d45e, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d45f, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d460, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d461, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d462, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d463, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d464, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d465, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d466, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d467, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d468, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d469, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d46a, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d46b, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d46c, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d46d, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d46e, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d46f, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d470, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d471, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d472, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d473, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d474, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d475, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d476, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d477, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d478, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d479, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d47a, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d47b, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d47c, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d47d, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d47e, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d47f, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d480, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d481, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d482, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d483, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d484, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d485, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d486, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d487, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d488, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d489, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d48a, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d48b, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d48c, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d48d, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d48e, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d48f, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d490, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d491, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d492, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d493, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d494, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d495, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d496, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d497, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d498, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d499, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d49a, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d49b, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d49c, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d49d, 0, 0, 0, f(Yes, false, "")},
- {0x1d49e, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d49f, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d4a0, 0, 0, 0, f(Yes, false, "")},
- {0x1d4a2, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d4a3, 0, 0, 0, f(Yes, false, "")},
- {0x1d4a5, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d4a6, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d4a7, 0, 0, 0, f(Yes, false, "")},
- {0x1d4a9, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d4aa, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d4ab, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d4ac, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d4ad, 0, 0, 0, f(Yes, false, "")},
- {0x1d4ae, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d4af, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d4b0, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d4b1, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d4b2, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d4b3, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d4b4, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d4b5, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d4b6, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d4b7, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d4b8, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d4b9, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d4ba, 0, 0, 0, f(Yes, false, "")},
- {0x1d4bb, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d4bc, 0, 0, 0, f(Yes, false, "")},
- {0x1d4bd, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d4be, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d4bf, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d4c0, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d4c1, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d4c2, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d4c3, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d4c4, 0, 0, 0, f(Yes, false, "")},
- {0x1d4c5, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d4c6, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d4c7, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d4c8, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d4c9, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d4ca, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d4cb, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d4cc, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d4cd, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d4ce, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d4cf, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d4d0, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d4d1, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d4d2, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d4d3, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d4d4, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d4d5, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d4d6, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d4d7, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d4d8, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d4d9, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d4da, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d4db, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d4dc, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d4dd, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d4de, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d4df, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d4e0, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d4e1, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d4e2, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d4e3, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d4e4, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d4e5, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d4e6, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d4e7, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d4e8, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d4e9, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d4ea, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d4eb, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d4ec, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d4ed, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d4ee, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d4ef, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d4f0, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d4f1, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d4f2, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d4f3, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d4f4, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d4f5, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d4f6, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d4f7, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d4f8, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d4f9, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d4fa, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d4fb, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d4fc, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d4fd, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d4fe, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d4ff, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d500, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d501, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d502, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d503, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d504, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d505, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d506, 0, 0, 0, f(Yes, false, "")},
- {0x1d507, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d508, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d509, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d50a, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d50b, 0, 0, 0, f(Yes, false, "")},
- {0x1d50d, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d50e, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d50f, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d510, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d511, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d512, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d513, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d514, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d515, 0, 0, 0, f(Yes, false, "")},
- {0x1d516, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d517, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d518, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d519, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d51a, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d51b, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d51c, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d51d, 0, 0, 0, f(Yes, false, "")},
- {0x1d51e, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d51f, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d520, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d521, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d522, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d523, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d524, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d525, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d526, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d527, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d528, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d529, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d52a, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d52b, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d52c, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d52d, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d52e, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d52f, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d530, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d531, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d532, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d533, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d534, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d535, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d536, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d537, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d538, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d539, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d53a, 0, 0, 0, f(Yes, false, "")},
- {0x1d53b, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d53c, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d53d, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d53e, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d53f, 0, 0, 0, f(Yes, false, "")},
- {0x1d540, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d541, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d542, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d543, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d544, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d545, 0, 0, 0, f(Yes, false, "")},
- {0x1d546, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d547, 0, 0, 0, f(Yes, false, "")},
- {0x1d54a, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d54b, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d54c, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d54d, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d54e, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d54f, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d550, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d551, 0, 0, 0, f(Yes, false, "")},
- {0x1d552, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d553, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d554, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d555, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d556, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d557, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d558, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d559, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d55a, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d55b, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d55c, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d55d, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d55e, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d55f, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d560, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d561, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d562, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d563, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d564, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d565, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d566, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d567, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d568, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d569, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d56a, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d56b, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d56c, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d56d, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d56e, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d56f, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d570, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d571, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d572, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d573, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d574, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d575, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d576, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d577, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d578, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d579, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d57a, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d57b, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d57c, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d57d, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d57e, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d57f, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d580, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d581, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d582, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d583, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d584, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d585, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d586, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d587, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d588, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d589, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d58a, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d58b, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d58c, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d58d, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d58e, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d58f, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d590, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d591, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d592, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d593, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d594, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d595, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d596, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d597, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d598, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d599, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d59a, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d59b, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d59c, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d59d, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d59e, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d59f, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d5a0, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d5a1, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d5a2, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d5a3, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d5a4, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d5a5, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d5a6, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d5a7, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d5a8, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d5a9, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d5aa, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d5ab, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d5ac, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d5ad, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d5ae, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d5af, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d5b0, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d5b1, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d5b2, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d5b3, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d5b4, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d5b5, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d5b6, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d5b7, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d5b8, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d5b9, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d5ba, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d5bb, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d5bc, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d5bd, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d5be, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d5bf, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d5c0, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d5c1, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d5c2, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d5c3, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d5c4, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d5c5, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d5c6, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d5c7, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d5c8, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d5c9, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d5ca, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d5cb, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d5cc, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d5cd, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d5ce, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d5cf, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d5d0, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d5d1, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d5d2, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d5d3, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d5d4, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d5d5, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d5d6, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d5d7, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d5d8, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d5d9, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d5da, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d5db, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d5dc, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d5dd, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d5de, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d5df, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d5e0, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d5e1, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d5e2, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d5e3, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d5e4, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d5e5, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d5e6, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d5e7, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d5e8, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d5e9, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d5ea, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d5eb, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d5ec, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d5ed, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d5ee, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d5ef, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d5f0, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d5f1, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d5f2, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d5f3, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d5f4, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d5f5, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d5f6, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d5f7, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d5f8, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d5f9, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d5fa, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d5fb, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d5fc, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d5fd, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d5fe, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d5ff, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d600, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d601, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d602, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d603, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d604, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d605, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d606, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d607, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d608, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d609, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d60a, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d60b, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d60c, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d60d, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d60e, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d60f, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d610, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d611, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d612, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d613, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d614, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d615, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d616, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d617, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d618, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d619, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d61a, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d61b, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d61c, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d61d, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d61e, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d61f, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d620, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d621, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d622, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d623, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d624, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d625, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d626, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d627, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d628, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d629, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d62a, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d62b, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d62c, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d62d, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d62e, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d62f, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d630, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d631, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d632, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d633, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d634, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d635, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d636, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d637, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d638, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d639, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d63a, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d63b, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d63c, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d63d, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d63e, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d63f, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d640, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d641, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d642, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d643, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d644, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d645, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d646, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d647, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d648, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d649, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d64a, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d64b, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d64c, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d64d, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d64e, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d64f, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d650, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d651, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d652, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d653, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d654, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d655, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d656, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d657, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d658, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d659, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d65a, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d65b, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d65c, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d65d, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d65e, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d65f, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d660, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d661, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d662, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d663, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d664, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d665, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d666, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d667, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d668, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d669, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d66a, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d66b, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d66c, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d66d, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d66e, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d66f, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d670, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d671, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d672, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d673, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d674, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d675, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d676, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d677, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d678, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d679, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d67a, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d67b, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d67c, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d67d, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d67e, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d67f, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d680, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d681, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d682, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d683, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d684, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d685, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d686, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d687, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d688, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d689, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d68a, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d68b, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d68c, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d68d, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d68e, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d68f, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d690, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d691, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d692, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d693, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d694, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d695, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d696, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d697, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d698, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d699, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d69a, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d69b, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d69c, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d69d, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d69e, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d69f, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d6a0, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d6a1, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d6a2, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d6a3, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d6a4, 0, 0, 0, g(Yes, No, false, false, "", "ı")},
- {0x1d6a5, 0, 0, 0, g(Yes, No, false, false, "", "ȷ")},
- {0x1d6a6, 0, 0, 0, f(Yes, false, "")},
- {0x1d6a8, 0, 0, 0, g(Yes, No, false, false, "", "Α")},
- {0x1d6a9, 0, 0, 0, g(Yes, No, false, false, "", "Β")},
- {0x1d6aa, 0, 0, 0, g(Yes, No, false, false, "", "Γ")},
- {0x1d6ab, 0, 0, 0, g(Yes, No, false, false, "", "Δ")},
- {0x1d6ac, 0, 0, 0, g(Yes, No, false, false, "", "Ε")},
- {0x1d6ad, 0, 0, 0, g(Yes, No, false, false, "", "Ζ")},
- {0x1d6ae, 0, 0, 0, g(Yes, No, false, false, "", "Η")},
- {0x1d6af, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d6b0, 0, 0, 0, g(Yes, No, false, false, "", "Ι")},
- {0x1d6b1, 0, 0, 0, g(Yes, No, false, false, "", "Κ")},
- {0x1d6b2, 0, 0, 0, g(Yes, No, false, false, "", "Λ")},
- {0x1d6b3, 0, 0, 0, g(Yes, No, false, false, "", "Μ")},
- {0x1d6b4, 0, 0, 0, g(Yes, No, false, false, "", "Ν")},
- {0x1d6b5, 0, 0, 0, g(Yes, No, false, false, "", "Ξ")},
- {0x1d6b6, 0, 0, 0, g(Yes, No, false, false, "", "Ο")},
- {0x1d6b7, 0, 0, 0, g(Yes, No, false, false, "", "Π")},
- {0x1d6b8, 0, 0, 0, g(Yes, No, false, false, "", "Ρ")},
- {0x1d6b9, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d6ba, 0, 0, 0, g(Yes, No, false, false, "", "Σ")},
- {0x1d6bb, 0, 0, 0, g(Yes, No, false, false, "", "Τ")},
- {0x1d6bc, 0, 0, 0, g(Yes, No, false, false, "", "Υ")},
- {0x1d6bd, 0, 0, 0, g(Yes, No, false, false, "", "Φ")},
- {0x1d6be, 0, 0, 0, g(Yes, No, false, false, "", "Χ")},
- {0x1d6bf, 0, 0, 0, g(Yes, No, false, false, "", "Ψ")},
- {0x1d6c0, 0, 0, 0, g(Yes, No, false, false, "", "Ω")},
- {0x1d6c1, 0, 0, 0, g(Yes, No, false, false, "", "∇")},
- {0x1d6c2, 0, 0, 0, g(Yes, No, false, false, "", "α")},
- {0x1d6c3, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x1d6c4, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x1d6c5, 0, 0, 0, g(Yes, No, false, false, "", "δ")},
- {0x1d6c6, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d6c7, 0, 0, 0, g(Yes, No, false, false, "", "ζ")},
- {0x1d6c8, 0, 0, 0, g(Yes, No, false, false, "", "η")},
- {0x1d6c9, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d6ca, 0, 0, 0, g(Yes, No, false, false, "", "ι")},
- {0x1d6cb, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d6cc, 0, 0, 0, g(Yes, No, false, false, "", "λ")},
- {0x1d6cd, 0, 0, 0, g(Yes, No, false, false, "", "μ")},
- {0x1d6ce, 0, 0, 0, g(Yes, No, false, false, "", "ν")},
- {0x1d6cf, 0, 0, 0, g(Yes, No, false, false, "", "ξ")},
- {0x1d6d0, 0, 0, 0, g(Yes, No, false, false, "", "ο")},
- {0x1d6d1, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d6d2, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d6d3, 0, 0, 0, g(Yes, No, false, false, "", "ς")},
- {0x1d6d4, 0, 0, 0, g(Yes, No, false, false, "", "σ")},
- {0x1d6d5, 0, 0, 0, g(Yes, No, false, false, "", "τ")},
- {0x1d6d6, 0, 0, 0, g(Yes, No, false, false, "", "υ")},
- {0x1d6d7, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d6d8, 0, 0, 0, g(Yes, No, false, false, "", "χ")},
- {0x1d6d9, 0, 0, 0, g(Yes, No, false, false, "", "ψ")},
- {0x1d6da, 0, 0, 0, g(Yes, No, false, false, "", "ω")},
- {0x1d6db, 0, 0, 0, g(Yes, No, false, false, "", "∂")},
- {0x1d6dc, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d6dd, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d6de, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d6df, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d6e0, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d6e1, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d6e2, 0, 0, 0, g(Yes, No, false, false, "", "Α")},
- {0x1d6e3, 0, 0, 0, g(Yes, No, false, false, "", "Β")},
- {0x1d6e4, 0, 0, 0, g(Yes, No, false, false, "", "Γ")},
- {0x1d6e5, 0, 0, 0, g(Yes, No, false, false, "", "Δ")},
- {0x1d6e6, 0, 0, 0, g(Yes, No, false, false, "", "Ε")},
- {0x1d6e7, 0, 0, 0, g(Yes, No, false, false, "", "Ζ")},
- {0x1d6e8, 0, 0, 0, g(Yes, No, false, false, "", "Η")},
- {0x1d6e9, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d6ea, 0, 0, 0, g(Yes, No, false, false, "", "Ι")},
- {0x1d6eb, 0, 0, 0, g(Yes, No, false, false, "", "Κ")},
- {0x1d6ec, 0, 0, 0, g(Yes, No, false, false, "", "Λ")},
- {0x1d6ed, 0, 0, 0, g(Yes, No, false, false, "", "Μ")},
- {0x1d6ee, 0, 0, 0, g(Yes, No, false, false, "", "Ν")},
- {0x1d6ef, 0, 0, 0, g(Yes, No, false, false, "", "Ξ")},
- {0x1d6f0, 0, 0, 0, g(Yes, No, false, false, "", "Ο")},
- {0x1d6f1, 0, 0, 0, g(Yes, No, false, false, "", "Π")},
- {0x1d6f2, 0, 0, 0, g(Yes, No, false, false, "", "Ρ")},
- {0x1d6f3, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d6f4, 0, 0, 0, g(Yes, No, false, false, "", "Σ")},
- {0x1d6f5, 0, 0, 0, g(Yes, No, false, false, "", "Τ")},
- {0x1d6f6, 0, 0, 0, g(Yes, No, false, false, "", "Υ")},
- {0x1d6f7, 0, 0, 0, g(Yes, No, false, false, "", "Φ")},
- {0x1d6f8, 0, 0, 0, g(Yes, No, false, false, "", "Χ")},
- {0x1d6f9, 0, 0, 0, g(Yes, No, false, false, "", "Ψ")},
- {0x1d6fa, 0, 0, 0, g(Yes, No, false, false, "", "Ω")},
- {0x1d6fb, 0, 0, 0, g(Yes, No, false, false, "", "∇")},
- {0x1d6fc, 0, 0, 0, g(Yes, No, false, false, "", "α")},
- {0x1d6fd, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x1d6fe, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x1d6ff, 0, 0, 0, g(Yes, No, false, false, "", "δ")},
- {0x1d700, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d701, 0, 0, 0, g(Yes, No, false, false, "", "ζ")},
- {0x1d702, 0, 0, 0, g(Yes, No, false, false, "", "η")},
- {0x1d703, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d704, 0, 0, 0, g(Yes, No, false, false, "", "ι")},
- {0x1d705, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d706, 0, 0, 0, g(Yes, No, false, false, "", "λ")},
- {0x1d707, 0, 0, 0, g(Yes, No, false, false, "", "μ")},
- {0x1d708, 0, 0, 0, g(Yes, No, false, false, "", "ν")},
- {0x1d709, 0, 0, 0, g(Yes, No, false, false, "", "ξ")},
- {0x1d70a, 0, 0, 0, g(Yes, No, false, false, "", "ο")},
- {0x1d70b, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d70c, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d70d, 0, 0, 0, g(Yes, No, false, false, "", "ς")},
- {0x1d70e, 0, 0, 0, g(Yes, No, false, false, "", "σ")},
- {0x1d70f, 0, 0, 0, g(Yes, No, false, false, "", "τ")},
- {0x1d710, 0, 0, 0, g(Yes, No, false, false, "", "υ")},
- {0x1d711, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d712, 0, 0, 0, g(Yes, No, false, false, "", "χ")},
- {0x1d713, 0, 0, 0, g(Yes, No, false, false, "", "ψ")},
- {0x1d714, 0, 0, 0, g(Yes, No, false, false, "", "ω")},
- {0x1d715, 0, 0, 0, g(Yes, No, false, false, "", "∂")},
- {0x1d716, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d717, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d718, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d719, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d71a, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d71b, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d71c, 0, 0, 0, g(Yes, No, false, false, "", "Α")},
- {0x1d71d, 0, 0, 0, g(Yes, No, false, false, "", "Β")},
- {0x1d71e, 0, 0, 0, g(Yes, No, false, false, "", "Γ")},
- {0x1d71f, 0, 0, 0, g(Yes, No, false, false, "", "Δ")},
- {0x1d720, 0, 0, 0, g(Yes, No, false, false, "", "Ε")},
- {0x1d721, 0, 0, 0, g(Yes, No, false, false, "", "Ζ")},
- {0x1d722, 0, 0, 0, g(Yes, No, false, false, "", "Η")},
- {0x1d723, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d724, 0, 0, 0, g(Yes, No, false, false, "", "Ι")},
- {0x1d725, 0, 0, 0, g(Yes, No, false, false, "", "Κ")},
- {0x1d726, 0, 0, 0, g(Yes, No, false, false, "", "Λ")},
- {0x1d727, 0, 0, 0, g(Yes, No, false, false, "", "Μ")},
- {0x1d728, 0, 0, 0, g(Yes, No, false, false, "", "Ν")},
- {0x1d729, 0, 0, 0, g(Yes, No, false, false, "", "Ξ")},
- {0x1d72a, 0, 0, 0, g(Yes, No, false, false, "", "Ο")},
- {0x1d72b, 0, 0, 0, g(Yes, No, false, false, "", "Π")},
- {0x1d72c, 0, 0, 0, g(Yes, No, false, false, "", "Ρ")},
- {0x1d72d, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d72e, 0, 0, 0, g(Yes, No, false, false, "", "Σ")},
- {0x1d72f, 0, 0, 0, g(Yes, No, false, false, "", "Τ")},
- {0x1d730, 0, 0, 0, g(Yes, No, false, false, "", "Υ")},
- {0x1d731, 0, 0, 0, g(Yes, No, false, false, "", "Φ")},
- {0x1d732, 0, 0, 0, g(Yes, No, false, false, "", "Χ")},
- {0x1d733, 0, 0, 0, g(Yes, No, false, false, "", "Ψ")},
- {0x1d734, 0, 0, 0, g(Yes, No, false, false, "", "Ω")},
- {0x1d735, 0, 0, 0, g(Yes, No, false, false, "", "∇")},
- {0x1d736, 0, 0, 0, g(Yes, No, false, false, "", "α")},
- {0x1d737, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x1d738, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x1d739, 0, 0, 0, g(Yes, No, false, false, "", "δ")},
- {0x1d73a, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d73b, 0, 0, 0, g(Yes, No, false, false, "", "ζ")},
- {0x1d73c, 0, 0, 0, g(Yes, No, false, false, "", "η")},
- {0x1d73d, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d73e, 0, 0, 0, g(Yes, No, false, false, "", "ι")},
- {0x1d73f, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d740, 0, 0, 0, g(Yes, No, false, false, "", "λ")},
- {0x1d741, 0, 0, 0, g(Yes, No, false, false, "", "μ")},
- {0x1d742, 0, 0, 0, g(Yes, No, false, false, "", "ν")},
- {0x1d743, 0, 0, 0, g(Yes, No, false, false, "", "ξ")},
- {0x1d744, 0, 0, 0, g(Yes, No, false, false, "", "ο")},
- {0x1d745, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d746, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d747, 0, 0, 0, g(Yes, No, false, false, "", "ς")},
- {0x1d748, 0, 0, 0, g(Yes, No, false, false, "", "σ")},
- {0x1d749, 0, 0, 0, g(Yes, No, false, false, "", "τ")},
- {0x1d74a, 0, 0, 0, g(Yes, No, false, false, "", "υ")},
- {0x1d74b, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d74c, 0, 0, 0, g(Yes, No, false, false, "", "χ")},
- {0x1d74d, 0, 0, 0, g(Yes, No, false, false, "", "ψ")},
- {0x1d74e, 0, 0, 0, g(Yes, No, false, false, "", "ω")},
- {0x1d74f, 0, 0, 0, g(Yes, No, false, false, "", "∂")},
- {0x1d750, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d751, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d752, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d753, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d754, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d755, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d756, 0, 0, 0, g(Yes, No, false, false, "", "Α")},
- {0x1d757, 0, 0, 0, g(Yes, No, false, false, "", "Β")},
- {0x1d758, 0, 0, 0, g(Yes, No, false, false, "", "Γ")},
- {0x1d759, 0, 0, 0, g(Yes, No, false, false, "", "Δ")},
- {0x1d75a, 0, 0, 0, g(Yes, No, false, false, "", "Ε")},
- {0x1d75b, 0, 0, 0, g(Yes, No, false, false, "", "Ζ")},
- {0x1d75c, 0, 0, 0, g(Yes, No, false, false, "", "Η")},
- {0x1d75d, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d75e, 0, 0, 0, g(Yes, No, false, false, "", "Ι")},
- {0x1d75f, 0, 0, 0, g(Yes, No, false, false, "", "Κ")},
- {0x1d760, 0, 0, 0, g(Yes, No, false, false, "", "Λ")},
- {0x1d761, 0, 0, 0, g(Yes, No, false, false, "", "Μ")},
- {0x1d762, 0, 0, 0, g(Yes, No, false, false, "", "Ν")},
- {0x1d763, 0, 0, 0, g(Yes, No, false, false, "", "Ξ")},
- {0x1d764, 0, 0, 0, g(Yes, No, false, false, "", "Ο")},
- {0x1d765, 0, 0, 0, g(Yes, No, false, false, "", "Π")},
- {0x1d766, 0, 0, 0, g(Yes, No, false, false, "", "Ρ")},
- {0x1d767, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d768, 0, 0, 0, g(Yes, No, false, false, "", "Σ")},
- {0x1d769, 0, 0, 0, g(Yes, No, false, false, "", "Τ")},
- {0x1d76a, 0, 0, 0, g(Yes, No, false, false, "", "Υ")},
- {0x1d76b, 0, 0, 0, g(Yes, No, false, false, "", "Φ")},
- {0x1d76c, 0, 0, 0, g(Yes, No, false, false, "", "Χ")},
- {0x1d76d, 0, 0, 0, g(Yes, No, false, false, "", "Ψ")},
- {0x1d76e, 0, 0, 0, g(Yes, No, false, false, "", "Ω")},
- {0x1d76f, 0, 0, 0, g(Yes, No, false, false, "", "∇")},
- {0x1d770, 0, 0, 0, g(Yes, No, false, false, "", "α")},
- {0x1d771, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x1d772, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x1d773, 0, 0, 0, g(Yes, No, false, false, "", "δ")},
- {0x1d774, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d775, 0, 0, 0, g(Yes, No, false, false, "", "ζ")},
- {0x1d776, 0, 0, 0, g(Yes, No, false, false, "", "η")},
- {0x1d777, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d778, 0, 0, 0, g(Yes, No, false, false, "", "ι")},
- {0x1d779, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d77a, 0, 0, 0, g(Yes, No, false, false, "", "λ")},
- {0x1d77b, 0, 0, 0, g(Yes, No, false, false, "", "μ")},
- {0x1d77c, 0, 0, 0, g(Yes, No, false, false, "", "ν")},
- {0x1d77d, 0, 0, 0, g(Yes, No, false, false, "", "ξ")},
- {0x1d77e, 0, 0, 0, g(Yes, No, false, false, "", "ο")},
- {0x1d77f, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d780, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d781, 0, 0, 0, g(Yes, No, false, false, "", "ς")},
- {0x1d782, 0, 0, 0, g(Yes, No, false, false, "", "σ")},
- {0x1d783, 0, 0, 0, g(Yes, No, false, false, "", "τ")},
- {0x1d784, 0, 0, 0, g(Yes, No, false, false, "", "υ")},
- {0x1d785, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d786, 0, 0, 0, g(Yes, No, false, false, "", "χ")},
- {0x1d787, 0, 0, 0, g(Yes, No, false, false, "", "ψ")},
- {0x1d788, 0, 0, 0, g(Yes, No, false, false, "", "ω")},
- {0x1d789, 0, 0, 0, g(Yes, No, false, false, "", "∂")},
- {0x1d78a, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d78b, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d78c, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d78d, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d78e, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d78f, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d790, 0, 0, 0, g(Yes, No, false, false, "", "Α")},
- {0x1d791, 0, 0, 0, g(Yes, No, false, false, "", "Β")},
- {0x1d792, 0, 0, 0, g(Yes, No, false, false, "", "Γ")},
- {0x1d793, 0, 0, 0, g(Yes, No, false, false, "", "Δ")},
- {0x1d794, 0, 0, 0, g(Yes, No, false, false, "", "Ε")},
- {0x1d795, 0, 0, 0, g(Yes, No, false, false, "", "Ζ")},
- {0x1d796, 0, 0, 0, g(Yes, No, false, false, "", "Η")},
- {0x1d797, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d798, 0, 0, 0, g(Yes, No, false, false, "", "Ι")},
- {0x1d799, 0, 0, 0, g(Yes, No, false, false, "", "Κ")},
- {0x1d79a, 0, 0, 0, g(Yes, No, false, false, "", "Λ")},
- {0x1d79b, 0, 0, 0, g(Yes, No, false, false, "", "Μ")},
- {0x1d79c, 0, 0, 0, g(Yes, No, false, false, "", "Ν")},
- {0x1d79d, 0, 0, 0, g(Yes, No, false, false, "", "Ξ")},
- {0x1d79e, 0, 0, 0, g(Yes, No, false, false, "", "Ο")},
- {0x1d79f, 0, 0, 0, g(Yes, No, false, false, "", "Π")},
- {0x1d7a0, 0, 0, 0, g(Yes, No, false, false, "", "Ρ")},
- {0x1d7a1, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d7a2, 0, 0, 0, g(Yes, No, false, false, "", "Σ")},
- {0x1d7a3, 0, 0, 0, g(Yes, No, false, false, "", "Τ")},
- {0x1d7a4, 0, 0, 0, g(Yes, No, false, false, "", "Υ")},
- {0x1d7a5, 0, 0, 0, g(Yes, No, false, false, "", "Φ")},
- {0x1d7a6, 0, 0, 0, g(Yes, No, false, false, "", "Χ")},
- {0x1d7a7, 0, 0, 0, g(Yes, No, false, false, "", "Ψ")},
- {0x1d7a8, 0, 0, 0, g(Yes, No, false, false, "", "Ω")},
- {0x1d7a9, 0, 0, 0, g(Yes, No, false, false, "", "∇")},
- {0x1d7aa, 0, 0, 0, g(Yes, No, false, false, "", "α")},
- {0x1d7ab, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x1d7ac, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x1d7ad, 0, 0, 0, g(Yes, No, false, false, "", "δ")},
- {0x1d7ae, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d7af, 0, 0, 0, g(Yes, No, false, false, "", "ζ")},
- {0x1d7b0, 0, 0, 0, g(Yes, No, false, false, "", "η")},
- {0x1d7b1, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d7b2, 0, 0, 0, g(Yes, No, false, false, "", "ι")},
- {0x1d7b3, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d7b4, 0, 0, 0, g(Yes, No, false, false, "", "λ")},
- {0x1d7b5, 0, 0, 0, g(Yes, No, false, false, "", "μ")},
- {0x1d7b6, 0, 0, 0, g(Yes, No, false, false, "", "ν")},
- {0x1d7b7, 0, 0, 0, g(Yes, No, false, false, "", "ξ")},
- {0x1d7b8, 0, 0, 0, g(Yes, No, false, false, "", "ο")},
- {0x1d7b9, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d7ba, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d7bb, 0, 0, 0, g(Yes, No, false, false, "", "ς")},
- {0x1d7bc, 0, 0, 0, g(Yes, No, false, false, "", "σ")},
- {0x1d7bd, 0, 0, 0, g(Yes, No, false, false, "", "τ")},
- {0x1d7be, 0, 0, 0, g(Yes, No, false, false, "", "υ")},
- {0x1d7bf, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d7c0, 0, 0, 0, g(Yes, No, false, false, "", "χ")},
- {0x1d7c1, 0, 0, 0, g(Yes, No, false, false, "", "ψ")},
- {0x1d7c2, 0, 0, 0, g(Yes, No, false, false, "", "ω")},
- {0x1d7c3, 0, 0, 0, g(Yes, No, false, false, "", "∂")},
- {0x1d7c4, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d7c5, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d7c6, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d7c7, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d7c8, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d7c9, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d7ca, 0, 0, 0, g(Yes, No, false, false, "", "Ϝ")},
- {0x1d7cb, 0, 0, 0, g(Yes, No, false, false, "", "ϝ")},
- {0x1d7cc, 0, 0, 0, f(Yes, false, "")},
- {0x1d7ce, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x1d7cf, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0x1d7d0, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0x1d7d1, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0x1d7d2, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x1d7d3, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x1d7d4, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x1d7d5, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x1d7d6, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x1d7d7, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x1d7d8, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x1d7d9, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0x1d7da, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0x1d7db, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0x1d7dc, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x1d7dd, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x1d7de, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x1d7df, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x1d7e0, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x1d7e1, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x1d7e2, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x1d7e3, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0x1d7e4, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0x1d7e5, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0x1d7e6, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x1d7e7, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x1d7e8, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x1d7e9, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x1d7ea, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x1d7eb, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x1d7ec, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x1d7ed, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0x1d7ee, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0x1d7ef, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0x1d7f0, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x1d7f1, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x1d7f2, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x1d7f3, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x1d7f4, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x1d7f5, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x1d7f6, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x1d7f7, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0x1d7f8, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0x1d7f9, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0x1d7fa, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x1d7fb, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x1d7fc, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x1d7fd, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x1d7fe, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x1d7ff, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x1d800, 0, 0, 0, f(Yes, false, "")},
- {0x1e000, 230, 1, 1, f(Yes, false, "")},
- {0x1e007, 0, 0, 0, f(Yes, false, "")},
- {0x1e008, 230, 1, 1, f(Yes, false, "")},
- {0x1e019, 0, 0, 0, f(Yes, false, "")},
- {0x1e01b, 230, 1, 1, f(Yes, false, "")},
- {0x1e022, 0, 0, 0, f(Yes, false, "")},
- {0x1e023, 230, 1, 1, f(Yes, false, "")},
- {0x1e025, 0, 0, 0, f(Yes, false, "")},
- {0x1e026, 230, 1, 1, f(Yes, false, "")},
- {0x1e02b, 0, 0, 0, f(Yes, false, "")},
- {0x1e8d0, 220, 1, 1, f(Yes, false, "")},
- {0x1e8d7, 0, 0, 0, f(Yes, false, "")},
- {0x1e944, 230, 1, 1, f(Yes, false, "")},
- {0x1e94a, 7, 1, 1, f(Yes, false, "")},
- {0x1e94b, 0, 0, 0, f(Yes, false, "")},
- {0x1ee00, 0, 0, 0, g(Yes, No, false, false, "", "ا")},
- {0x1ee01, 0, 0, 0, g(Yes, No, false, false, "", "ب")},
- {0x1ee02, 0, 0, 0, g(Yes, No, false, false, "", "ج")},
- {0x1ee03, 0, 0, 0, g(Yes, No, false, false, "", "د")},
- {0x1ee04, 0, 0, 0, f(Yes, false, "")},
- {0x1ee05, 0, 0, 0, g(Yes, No, false, false, "", "و")},
- {0x1ee06, 0, 0, 0, g(Yes, No, false, false, "", "ز")},
- {0x1ee07, 0, 0, 0, g(Yes, No, false, false, "", "ح")},
- {0x1ee08, 0, 0, 0, g(Yes, No, false, false, "", "ط")},
- {0x1ee09, 0, 0, 0, g(Yes, No, false, false, "", "ي")},
- {0x1ee0a, 0, 0, 0, g(Yes, No, false, false, "", "ك")},
- {0x1ee0b, 0, 0, 0, g(Yes, No, false, false, "", "ل")},
- {0x1ee0c, 0, 0, 0, g(Yes, No, false, false, "", "م")},
- {0x1ee0d, 0, 0, 0, g(Yes, No, false, false, "", "ن")},
- {0x1ee0e, 0, 0, 0, g(Yes, No, false, false, "", "س")},
- {0x1ee0f, 0, 0, 0, g(Yes, No, false, false, "", "ع")},
- {0x1ee10, 0, 0, 0, g(Yes, No, false, false, "", "ف")},
- {0x1ee11, 0, 0, 0, g(Yes, No, false, false, "", "ص")},
- {0x1ee12, 0, 0, 0, g(Yes, No, false, false, "", "ق")},
- {0x1ee13, 0, 0, 0, g(Yes, No, false, false, "", "ر")},
- {0x1ee14, 0, 0, 0, g(Yes, No, false, false, "", "ش")},
- {0x1ee15, 0, 0, 0, g(Yes, No, false, false, "", "ت")},
- {0x1ee16, 0, 0, 0, g(Yes, No, false, false, "", "ث")},
- {0x1ee17, 0, 0, 0, g(Yes, No, false, false, "", "خ")},
- {0x1ee18, 0, 0, 0, g(Yes, No, false, false, "", "ذ")},
- {0x1ee19, 0, 0, 0, g(Yes, No, false, false, "", "ض")},
- {0x1ee1a, 0, 0, 0, g(Yes, No, false, false, "", "ظ")},
- {0x1ee1b, 0, 0, 0, g(Yes, No, false, false, "", "غ")},
- {0x1ee1c, 0, 0, 0, g(Yes, No, false, false, "", "ٮ")},
- {0x1ee1d, 0, 0, 0, g(Yes, No, false, false, "", "ں")},
- {0x1ee1e, 0, 0, 0, g(Yes, No, false, false, "", "ڡ")},
- {0x1ee1f, 0, 0, 0, g(Yes, No, false, false, "", "ٯ")},
- {0x1ee20, 0, 0, 0, f(Yes, false, "")},
- {0x1ee21, 0, 0, 0, g(Yes, No, false, false, "", "ب")},
- {0x1ee22, 0, 0, 0, g(Yes, No, false, false, "", "ج")},
- {0x1ee23, 0, 0, 0, f(Yes, false, "")},
- {0x1ee24, 0, 0, 0, g(Yes, No, false, false, "", "ه")},
- {0x1ee25, 0, 0, 0, f(Yes, false, "")},
- {0x1ee27, 0, 0, 0, g(Yes, No, false, false, "", "ح")},
- {0x1ee28, 0, 0, 0, f(Yes, false, "")},
- {0x1ee29, 0, 0, 0, g(Yes, No, false, false, "", "ي")},
- {0x1ee2a, 0, 0, 0, g(Yes, No, false, false, "", "ك")},
- {0x1ee2b, 0, 0, 0, g(Yes, No, false, false, "", "ل")},
- {0x1ee2c, 0, 0, 0, g(Yes, No, false, false, "", "م")},
- {0x1ee2d, 0, 0, 0, g(Yes, No, false, false, "", "ن")},
- {0x1ee2e, 0, 0, 0, g(Yes, No, false, false, "", "س")},
- {0x1ee2f, 0, 0, 0, g(Yes, No, false, false, "", "ع")},
- {0x1ee30, 0, 0, 0, g(Yes, No, false, false, "", "ف")},
- {0x1ee31, 0, 0, 0, g(Yes, No, false, false, "", "ص")},
- {0x1ee32, 0, 0, 0, g(Yes, No, false, false, "", "ق")},
- {0x1ee33, 0, 0, 0, f(Yes, false, "")},
- {0x1ee34, 0, 0, 0, g(Yes, No, false, false, "", "ش")},
- {0x1ee35, 0, 0, 0, g(Yes, No, false, false, "", "ت")},
- {0x1ee36, 0, 0, 0, g(Yes, No, false, false, "", "ث")},
- {0x1ee37, 0, 0, 0, g(Yes, No, false, false, "", "خ")},
- {0x1ee38, 0, 0, 0, f(Yes, false, "")},
- {0x1ee39, 0, 0, 0, g(Yes, No, false, false, "", "ض")},
- {0x1ee3a, 0, 0, 0, f(Yes, false, "")},
- {0x1ee3b, 0, 0, 0, g(Yes, No, false, false, "", "غ")},
- {0x1ee3c, 0, 0, 0, f(Yes, false, "")},
- {0x1ee42, 0, 0, 0, g(Yes, No, false, false, "", "ج")},
- {0x1ee43, 0, 0, 0, f(Yes, false, "")},
- {0x1ee47, 0, 0, 0, g(Yes, No, false, false, "", "ح")},
- {0x1ee48, 0, 0, 0, f(Yes, false, "")},
- {0x1ee49, 0, 0, 0, g(Yes, No, false, false, "", "ي")},
- {0x1ee4a, 0, 0, 0, f(Yes, false, "")},
- {0x1ee4b, 0, 0, 0, g(Yes, No, false, false, "", "ل")},
- {0x1ee4c, 0, 0, 0, f(Yes, false, "")},
- {0x1ee4d, 0, 0, 0, g(Yes, No, false, false, "", "ن")},
- {0x1ee4e, 0, 0, 0, g(Yes, No, false, false, "", "س")},
- {0x1ee4f, 0, 0, 0, g(Yes, No, false, false, "", "ع")},
- {0x1ee50, 0, 0, 0, f(Yes, false, "")},
- {0x1ee51, 0, 0, 0, g(Yes, No, false, false, "", "ص")},
- {0x1ee52, 0, 0, 0, g(Yes, No, false, false, "", "ق")},
- {0x1ee53, 0, 0, 0, f(Yes, false, "")},
- {0x1ee54, 0, 0, 0, g(Yes, No, false, false, "", "ش")},
- {0x1ee55, 0, 0, 0, f(Yes, false, "")},
- {0x1ee57, 0, 0, 0, g(Yes, No, false, false, "", "خ")},
- {0x1ee58, 0, 0, 0, f(Yes, false, "")},
- {0x1ee59, 0, 0, 0, g(Yes, No, false, false, "", "ض")},
- {0x1ee5a, 0, 0, 0, f(Yes, false, "")},
- {0x1ee5b, 0, 0, 0, g(Yes, No, false, false, "", "غ")},
- {0x1ee5c, 0, 0, 0, f(Yes, false, "")},
- {0x1ee5d, 0, 0, 0, g(Yes, No, false, false, "", "ں")},
- {0x1ee5e, 0, 0, 0, f(Yes, false, "")},
- {0x1ee5f, 0, 0, 0, g(Yes, No, false, false, "", "ٯ")},
- {0x1ee60, 0, 0, 0, f(Yes, false, "")},
- {0x1ee61, 0, 0, 0, g(Yes, No, false, false, "", "ب")},
- {0x1ee62, 0, 0, 0, g(Yes, No, false, false, "", "ج")},
- {0x1ee63, 0, 0, 0, f(Yes, false, "")},
- {0x1ee64, 0, 0, 0, g(Yes, No, false, false, "", "ه")},
- {0x1ee65, 0, 0, 0, f(Yes, false, "")},
- {0x1ee67, 0, 0, 0, g(Yes, No, false, false, "", "ح")},
- {0x1ee68, 0, 0, 0, g(Yes, No, false, false, "", "ط")},
- {0x1ee69, 0, 0, 0, g(Yes, No, false, false, "", "ي")},
- {0x1ee6a, 0, 0, 0, g(Yes, No, false, false, "", "ك")},
- {0x1ee6b, 0, 0, 0, f(Yes, false, "")},
- {0x1ee6c, 0, 0, 0, g(Yes, No, false, false, "", "م")},
- {0x1ee6d, 0, 0, 0, g(Yes, No, false, false, "", "ن")},
- {0x1ee6e, 0, 0, 0, g(Yes, No, false, false, "", "س")},
- {0x1ee6f, 0, 0, 0, g(Yes, No, false, false, "", "ع")},
- {0x1ee70, 0, 0, 0, g(Yes, No, false, false, "", "ف")},
- {0x1ee71, 0, 0, 0, g(Yes, No, false, false, "", "ص")},
- {0x1ee72, 0, 0, 0, g(Yes, No, false, false, "", "ق")},
- {0x1ee73, 0, 0, 0, f(Yes, false, "")},
- {0x1ee74, 0, 0, 0, g(Yes, No, false, false, "", "ش")},
- {0x1ee75, 0, 0, 0, g(Yes, No, false, false, "", "ت")},
- {0x1ee76, 0, 0, 0, g(Yes, No, false, false, "", "ث")},
- {0x1ee77, 0, 0, 0, g(Yes, No, false, false, "", "خ")},
- {0x1ee78, 0, 0, 0, f(Yes, false, "")},
- {0x1ee79, 0, 0, 0, g(Yes, No, false, false, "", "ض")},
- {0x1ee7a, 0, 0, 0, g(Yes, No, false, false, "", "ظ")},
- {0x1ee7b, 0, 0, 0, g(Yes, No, false, false, "", "غ")},
- {0x1ee7c, 0, 0, 0, g(Yes, No, false, false, "", "ٮ")},
- {0x1ee7d, 0, 0, 0, f(Yes, false, "")},
- {0x1ee7e, 0, 0, 0, g(Yes, No, false, false, "", "ڡ")},
- {0x1ee7f, 0, 0, 0, f(Yes, false, "")},
- {0x1ee80, 0, 0, 0, g(Yes, No, false, false, "", "ا")},
- {0x1ee81, 0, 0, 0, g(Yes, No, false, false, "", "ب")},
- {0x1ee82, 0, 0, 0, g(Yes, No, false, false, "", "ج")},
- {0x1ee83, 0, 0, 0, g(Yes, No, false, false, "", "د")},
- {0x1ee84, 0, 0, 0, g(Yes, No, false, false, "", "ه")},
- {0x1ee85, 0, 0, 0, g(Yes, No, false, false, "", "و")},
- {0x1ee86, 0, 0, 0, g(Yes, No, false, false, "", "ز")},
- {0x1ee87, 0, 0, 0, g(Yes, No, false, false, "", "ح")},
- {0x1ee88, 0, 0, 0, g(Yes, No, false, false, "", "ط")},
- {0x1ee89, 0, 0, 0, g(Yes, No, false, false, "", "ي")},
- {0x1ee8a, 0, 0, 0, f(Yes, false, "")},
- {0x1ee8b, 0, 0, 0, g(Yes, No, false, false, "", "ل")},
- {0x1ee8c, 0, 0, 0, g(Yes, No, false, false, "", "م")},
- {0x1ee8d, 0, 0, 0, g(Yes, No, false, false, "", "ن")},
- {0x1ee8e, 0, 0, 0, g(Yes, No, false, false, "", "س")},
- {0x1ee8f, 0, 0, 0, g(Yes, No, false, false, "", "ع")},
- {0x1ee90, 0, 0, 0, g(Yes, No, false, false, "", "ف")},
- {0x1ee91, 0, 0, 0, g(Yes, No, false, false, "", "ص")},
- {0x1ee92, 0, 0, 0, g(Yes, No, false, false, "", "ق")},
- {0x1ee93, 0, 0, 0, g(Yes, No, false, false, "", "ر")},
- {0x1ee94, 0, 0, 0, g(Yes, No, false, false, "", "ش")},
- {0x1ee95, 0, 0, 0, g(Yes, No, false, false, "", "ت")},
- {0x1ee96, 0, 0, 0, g(Yes, No, false, false, "", "ث")},
- {0x1ee97, 0, 0, 0, g(Yes, No, false, false, "", "خ")},
- {0x1ee98, 0, 0, 0, g(Yes, No, false, false, "", "ذ")},
- {0x1ee99, 0, 0, 0, g(Yes, No, false, false, "", "ض")},
- {0x1ee9a, 0, 0, 0, g(Yes, No, false, false, "", "ظ")},
- {0x1ee9b, 0, 0, 0, g(Yes, No, false, false, "", "غ")},
- {0x1ee9c, 0, 0, 0, f(Yes, false, "")},
- {0x1eea1, 0, 0, 0, g(Yes, No, false, false, "", "ب")},
- {0x1eea2, 0, 0, 0, g(Yes, No, false, false, "", "ج")},
- {0x1eea3, 0, 0, 0, g(Yes, No, false, false, "", "د")},
- {0x1eea4, 0, 0, 0, f(Yes, false, "")},
- {0x1eea5, 0, 0, 0, g(Yes, No, false, false, "", "و")},
- {0x1eea6, 0, 0, 0, g(Yes, No, false, false, "", "ز")},
- {0x1eea7, 0, 0, 0, g(Yes, No, false, false, "", "ح")},
- {0x1eea8, 0, 0, 0, g(Yes, No, false, false, "", "ط")},
- {0x1eea9, 0, 0, 0, g(Yes, No, false, false, "", "ي")},
- {0x1eeaa, 0, 0, 0, f(Yes, false, "")},
- {0x1eeab, 0, 0, 0, g(Yes, No, false, false, "", "ل")},
- {0x1eeac, 0, 0, 0, g(Yes, No, false, false, "", "م")},
- {0x1eead, 0, 0, 0, g(Yes, No, false, false, "", "ن")},
- {0x1eeae, 0, 0, 0, g(Yes, No, false, false, "", "س")},
- {0x1eeaf, 0, 0, 0, g(Yes, No, false, false, "", "ع")},
- {0x1eeb0, 0, 0, 0, g(Yes, No, false, false, "", "ف")},
- {0x1eeb1, 0, 0, 0, g(Yes, No, false, false, "", "ص")},
- {0x1eeb2, 0, 0, 0, g(Yes, No, false, false, "", "ق")},
- {0x1eeb3, 0, 0, 0, g(Yes, No, false, false, "", "ر")},
- {0x1eeb4, 0, 0, 0, g(Yes, No, false, false, "", "ش")},
- {0x1eeb5, 0, 0, 0, g(Yes, No, false, false, "", "ت")},
- {0x1eeb6, 0, 0, 0, g(Yes, No, false, false, "", "ث")},
- {0x1eeb7, 0, 0, 0, g(Yes, No, false, false, "", "خ")},
- {0x1eeb8, 0, 0, 0, g(Yes, No, false, false, "", "ذ")},
- {0x1eeb9, 0, 0, 0, g(Yes, No, false, false, "", "ض")},
- {0x1eeba, 0, 0, 0, g(Yes, No, false, false, "", "ظ")},
- {0x1eebb, 0, 0, 0, g(Yes, No, false, false, "", "غ")},
- {0x1eebc, 0, 0, 0, f(Yes, false, "")},
- {0x1f100, 0, 0, 0, g(Yes, No, false, false, "", "0.")},
- {0x1f101, 0, 0, 0, g(Yes, No, false, false, "", "0,")},
- {0x1f102, 0, 0, 0, g(Yes, No, false, false, "", "1,")},
- {0x1f103, 0, 0, 0, g(Yes, No, false, false, "", "2,")},
- {0x1f104, 0, 0, 0, g(Yes, No, false, false, "", "3,")},
- {0x1f105, 0, 0, 0, g(Yes, No, false, false, "", "4,")},
- {0x1f106, 0, 0, 0, g(Yes, No, false, false, "", "5,")},
- {0x1f107, 0, 0, 0, g(Yes, No, false, false, "", "6,")},
- {0x1f108, 0, 0, 0, g(Yes, No, false, false, "", "7,")},
- {0x1f109, 0, 0, 0, g(Yes, No, false, false, "", "8,")},
- {0x1f10a, 0, 0, 0, g(Yes, No, false, false, "", "9,")},
- {0x1f10b, 0, 0, 0, f(Yes, false, "")},
- {0x1f110, 0, 0, 0, g(Yes, No, false, false, "", "(A)")},
- {0x1f111, 0, 0, 0, g(Yes, No, false, false, "", "(B)")},
- {0x1f112, 0, 0, 0, g(Yes, No, false, false, "", "(C)")},
- {0x1f113, 0, 0, 0, g(Yes, No, false, false, "", "(D)")},
- {0x1f114, 0, 0, 0, g(Yes, No, false, false, "", "(E)")},
- {0x1f115, 0, 0, 0, g(Yes, No, false, false, "", "(F)")},
- {0x1f116, 0, 0, 0, g(Yes, No, false, false, "", "(G)")},
- {0x1f117, 0, 0, 0, g(Yes, No, false, false, "", "(H)")},
- {0x1f118, 0, 0, 0, g(Yes, No, false, false, "", "(I)")},
- {0x1f119, 0, 0, 0, g(Yes, No, false, false, "", "(J)")},
- {0x1f11a, 0, 0, 0, g(Yes, No, false, false, "", "(K)")},
- {0x1f11b, 0, 0, 0, g(Yes, No, false, false, "", "(L)")},
- {0x1f11c, 0, 0, 0, g(Yes, No, false, false, "", "(M)")},
- {0x1f11d, 0, 0, 0, g(Yes, No, false, false, "", "(N)")},
- {0x1f11e, 0, 0, 0, g(Yes, No, false, false, "", "(O)")},
- {0x1f11f, 0, 0, 0, g(Yes, No, false, false, "", "(P)")},
- {0x1f120, 0, 0, 0, g(Yes, No, false, false, "", "(Q)")},
- {0x1f121, 0, 0, 0, g(Yes, No, false, false, "", "(R)")},
- {0x1f122, 0, 0, 0, g(Yes, No, false, false, "", "(S)")},
- {0x1f123, 0, 0, 0, g(Yes, No, false, false, "", "(T)")},
- {0x1f124, 0, 0, 0, g(Yes, No, false, false, "", "(U)")},
- {0x1f125, 0, 0, 0, g(Yes, No, false, false, "", "(V)")},
- {0x1f126, 0, 0, 0, g(Yes, No, false, false, "", "(W)")},
- {0x1f127, 0, 0, 0, g(Yes, No, false, false, "", "(X)")},
- {0x1f128, 0, 0, 0, g(Yes, No, false, false, "", "(Y)")},
- {0x1f129, 0, 0, 0, g(Yes, No, false, false, "", "(Z)")},
- {0x1f12a, 0, 0, 0, g(Yes, No, false, false, "", "〔S〕")},
- {0x1f12b, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1f12c, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1f12d, 0, 0, 0, g(Yes, No, false, false, "", "CD")},
- {0x1f12e, 0, 0, 0, g(Yes, No, false, false, "", "WZ")},
- {0x1f12f, 0, 0, 0, f(Yes, false, "")},
- {0x1f130, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1f131, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1f132, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1f133, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1f134, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1f135, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1f136, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1f137, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1f138, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1f139, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1f13a, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1f13b, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1f13c, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1f13d, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1f13e, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1f13f, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1f140, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1f141, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1f142, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1f143, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1f144, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1f145, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1f146, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1f147, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1f148, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1f149, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1f14a, 0, 0, 0, g(Yes, No, false, false, "", "HV")},
- {0x1f14b, 0, 0, 0, g(Yes, No, false, false, "", "MV")},
- {0x1f14c, 0, 0, 0, g(Yes, No, false, false, "", "SD")},
- {0x1f14d, 0, 0, 0, g(Yes, No, false, false, "", "SS")},
- {0x1f14e, 0, 0, 0, g(Yes, No, false, false, "", "PPV")},
- {0x1f14f, 0, 0, 0, g(Yes, No, false, false, "", "WC")},
- {0x1f150, 0, 0, 0, f(Yes, false, "")},
- {0x1f16a, 0, 0, 0, g(Yes, No, false, false, "", "MC")},
- {0x1f16b, 0, 0, 0, g(Yes, No, false, false, "", "MD")},
- {0x1f16c, 0, 0, 0, f(Yes, false, "")},
- {0x1f190, 0, 0, 0, g(Yes, No, false, false, "", "DJ")},
- {0x1f191, 0, 0, 0, f(Yes, false, "")},
- {0x1f200, 0, 0, 0, g(Yes, No, false, false, "", "ほか")},
- {0x1f201, 0, 0, 0, g(Yes, No, false, false, "", "ココ")},
- {0x1f202, 0, 0, 0, g(Yes, No, false, false, "", "サ")},
- {0x1f203, 0, 0, 0, f(Yes, false, "")},
- {0x1f210, 0, 0, 0, g(Yes, No, false, false, "", "手")},
- {0x1f211, 0, 0, 0, g(Yes, No, false, false, "", "字")},
- {0x1f212, 0, 0, 0, g(Yes, No, false, false, "", "双")},
- {0x1f213, 0, 0, 1, g(Yes, No, false, false, "", "デ")},
- {0x1f214, 0, 0, 0, g(Yes, No, false, false, "", "二")},
- {0x1f215, 0, 0, 0, g(Yes, No, false, false, "", "多")},
- {0x1f216, 0, 0, 0, g(Yes, No, false, false, "", "解")},
- {0x1f217, 0, 0, 0, g(Yes, No, false, false, "", "天")},
- {0x1f218, 0, 0, 0, g(Yes, No, false, false, "", "交")},
- {0x1f219, 0, 0, 0, g(Yes, No, false, false, "", "映")},
- {0x1f21a, 0, 0, 0, g(Yes, No, false, false, "", "無")},
- {0x1f21b, 0, 0, 0, g(Yes, No, false, false, "", "料")},
- {0x1f21c, 0, 0, 0, g(Yes, No, false, false, "", "前")},
- {0x1f21d, 0, 0, 0, g(Yes, No, false, false, "", "後")},
- {0x1f21e, 0, 0, 0, g(Yes, No, false, false, "", "再")},
- {0x1f21f, 0, 0, 0, g(Yes, No, false, false, "", "新")},
- {0x1f220, 0, 0, 0, g(Yes, No, false, false, "", "初")},
- {0x1f221, 0, 0, 0, g(Yes, No, false, false, "", "終")},
- {0x1f222, 0, 0, 0, g(Yes, No, false, false, "", "生")},
- {0x1f223, 0, 0, 0, g(Yes, No, false, false, "", "販")},
- {0x1f224, 0, 0, 0, g(Yes, No, false, false, "", "声")},
- {0x1f225, 0, 0, 0, g(Yes, No, false, false, "", "吹")},
- {0x1f226, 0, 0, 0, g(Yes, No, false, false, "", "演")},
- {0x1f227, 0, 0, 0, g(Yes, No, false, false, "", "投")},
- {0x1f228, 0, 0, 0, g(Yes, No, false, false, "", "捕")},
- {0x1f229, 0, 0, 0, g(Yes, No, false, false, "", "一")},
- {0x1f22a, 0, 0, 0, g(Yes, No, false, false, "", "三")},
- {0x1f22b, 0, 0, 0, g(Yes, No, false, false, "", "遊")},
- {0x1f22c, 0, 0, 0, g(Yes, No, false, false, "", "左")},
- {0x1f22d, 0, 0, 0, g(Yes, No, false, false, "", "中")},
- {0x1f22e, 0, 0, 0, g(Yes, No, false, false, "", "右")},
- {0x1f22f, 0, 0, 0, g(Yes, No, false, false, "", "指")},
- {0x1f230, 0, 0, 0, g(Yes, No, false, false, "", "走")},
- {0x1f231, 0, 0, 0, g(Yes, No, false, false, "", "打")},
- {0x1f232, 0, 0, 0, g(Yes, No, false, false, "", "禁")},
- {0x1f233, 0, 0, 0, g(Yes, No, false, false, "", "空")},
- {0x1f234, 0, 0, 0, g(Yes, No, false, false, "", "合")},
- {0x1f235, 0, 0, 0, g(Yes, No, false, false, "", "満")},
- {0x1f236, 0, 0, 0, g(Yes, No, false, false, "", "有")},
- {0x1f237, 0, 0, 0, g(Yes, No, false, false, "", "月")},
- {0x1f238, 0, 0, 0, g(Yes, No, false, false, "", "申")},
- {0x1f239, 0, 0, 0, g(Yes, No, false, false, "", "割")},
- {0x1f23a, 0, 0, 0, g(Yes, No, false, false, "", "営")},
- {0x1f23b, 0, 0, 0, g(Yes, No, false, false, "", "配")},
- {0x1f23c, 0, 0, 0, f(Yes, false, "")},
- {0x1f240, 0, 0, 0, g(Yes, No, false, false, "", "〔本〕")},
- {0x1f241, 0, 0, 0, g(Yes, No, false, false, "", "〔三〕")},
- {0x1f242, 0, 0, 0, g(Yes, No, false, false, "", "〔二〕")},
- {0x1f243, 0, 0, 0, g(Yes, No, false, false, "", "〔安〕")},
- {0x1f244, 0, 0, 0, g(Yes, No, false, false, "", "〔点〕")},
- {0x1f245, 0, 0, 0, g(Yes, No, false, false, "", "〔打〕")},
- {0x1f246, 0, 0, 0, g(Yes, No, false, false, "", "〔盗〕")},
- {0x1f247, 0, 0, 0, g(Yes, No, false, false, "", "〔勝〕")},
- {0x1f248, 0, 0, 0, g(Yes, No, false, false, "", "〔敗〕")},
- {0x1f249, 0, 0, 0, f(Yes, false, "")},
- {0x1f250, 0, 0, 0, g(Yes, No, false, false, "", "得")},
- {0x1f251, 0, 0, 0, g(Yes, No, false, false, "", "可")},
- {0x1f252, 0, 0, 0, f(Yes, false, "")},
- {0x2f800, 0, 0, 0, f(No, false, "丽")},
- {0x2f801, 0, 0, 0, f(No, false, "丸")},
- {0x2f802, 0, 0, 0, f(No, false, "乁")},
- {0x2f803, 0, 0, 0, f(No, false, "𠄢")},
- {0x2f804, 0, 0, 0, f(No, false, "你")},
- {0x2f805, 0, 0, 0, f(No, false, "侮")},
- {0x2f806, 0, 0, 0, f(No, false, "侻")},
- {0x2f807, 0, 0, 0, f(No, false, "倂")},
- {0x2f808, 0, 0, 0, f(No, false, "偺")},
- {0x2f809, 0, 0, 0, f(No, false, "備")},
- {0x2f80a, 0, 0, 0, f(No, false, "僧")},
- {0x2f80b, 0, 0, 0, f(No, false, "像")},
- {0x2f80c, 0, 0, 0, f(No, false, "㒞")},
- {0x2f80d, 0, 0, 0, f(No, false, "𠘺")},
- {0x2f80e, 0, 0, 0, f(No, false, "免")},
- {0x2f80f, 0, 0, 0, f(No, false, "兔")},
- {0x2f810, 0, 0, 0, f(No, false, "兤")},
- {0x2f811, 0, 0, 0, f(No, false, "具")},
- {0x2f812, 0, 0, 0, f(No, false, "𠔜")},
- {0x2f813, 0, 0, 0, f(No, false, "㒹")},
- {0x2f814, 0, 0, 0, f(No, false, "內")},
- {0x2f815, 0, 0, 0, f(No, false, "再")},
- {0x2f816, 0, 0, 0, f(No, false, "𠕋")},
- {0x2f817, 0, 0, 0, f(No, false, "冗")},
- {0x2f818, 0, 0, 0, f(No, false, "冤")},
- {0x2f819, 0, 0, 0, f(No, false, "仌")},
- {0x2f81a, 0, 0, 0, f(No, false, "冬")},
- {0x2f81b, 0, 0, 0, f(No, false, "况")},
- {0x2f81c, 0, 0, 0, f(No, false, "𩇟")},
- {0x2f81d, 0, 0, 0, f(No, false, "凵")},
- {0x2f81e, 0, 0, 0, f(No, false, "刃")},
- {0x2f81f, 0, 0, 0, f(No, false, "㓟")},
- {0x2f820, 0, 0, 0, f(No, false, "刻")},
- {0x2f821, 0, 0, 0, f(No, false, "剆")},
- {0x2f822, 0, 0, 0, f(No, false, "割")},
- {0x2f823, 0, 0, 0, f(No, false, "剷")},
- {0x2f824, 0, 0, 0, f(No, false, "㔕")},
- {0x2f825, 0, 0, 0, f(No, false, "勇")},
- {0x2f826, 0, 0, 0, f(No, false, "勉")},
- {0x2f827, 0, 0, 0, f(No, false, "勤")},
- {0x2f828, 0, 0, 0, f(No, false, "勺")},
- {0x2f829, 0, 0, 0, f(No, false, "包")},
- {0x2f82a, 0, 0, 0, f(No, false, "匆")},
- {0x2f82b, 0, 0, 0, f(No, false, "北")},
- {0x2f82c, 0, 0, 0, f(No, false, "卉")},
- {0x2f82d, 0, 0, 0, f(No, false, "卑")},
- {0x2f82e, 0, 0, 0, f(No, false, "博")},
- {0x2f82f, 0, 0, 0, f(No, false, "即")},
- {0x2f830, 0, 0, 0, f(No, false, "卽")},
- {0x2f831, 0, 0, 0, f(No, false, "卿")},
- {0x2f834, 0, 0, 0, f(No, false, "𠨬")},
- {0x2f835, 0, 0, 0, f(No, false, "灰")},
- {0x2f836, 0, 0, 0, f(No, false, "及")},
- {0x2f837, 0, 0, 0, f(No, false, "叟")},
- {0x2f838, 0, 0, 0, f(No, false, "𠭣")},
- {0x2f839, 0, 0, 0, f(No, false, "叫")},
- {0x2f83a, 0, 0, 0, f(No, false, "叱")},
- {0x2f83b, 0, 0, 0, f(No, false, "吆")},
- {0x2f83c, 0, 0, 0, f(No, false, "咞")},
- {0x2f83d, 0, 0, 0, f(No, false, "吸")},
- {0x2f83e, 0, 0, 0, f(No, false, "呈")},
- {0x2f83f, 0, 0, 0, f(No, false, "周")},
- {0x2f840, 0, 0, 0, f(No, false, "咢")},
- {0x2f841, 0, 0, 0, f(No, false, "哶")},
- {0x2f842, 0, 0, 0, f(No, false, "唐")},
- {0x2f843, 0, 0, 0, f(No, false, "啓")},
- {0x2f844, 0, 0, 0, f(No, false, "啣")},
- {0x2f845, 0, 0, 0, f(No, false, "善")},
- {0x2f847, 0, 0, 0, f(No, false, "喙")},
- {0x2f848, 0, 0, 0, f(No, false, "喫")},
- {0x2f849, 0, 0, 0, f(No, false, "喳")},
- {0x2f84a, 0, 0, 0, f(No, false, "嗂")},
- {0x2f84b, 0, 0, 0, f(No, false, "圖")},
- {0x2f84c, 0, 0, 0, f(No, false, "嘆")},
- {0x2f84d, 0, 0, 0, f(No, false, "圗")},
- {0x2f84e, 0, 0, 0, f(No, false, "噑")},
- {0x2f84f, 0, 0, 0, f(No, false, "噴")},
- {0x2f850, 0, 0, 0, f(No, false, "切")},
- {0x2f851, 0, 0, 0, f(No, false, "壮")},
- {0x2f852, 0, 0, 0, f(No, false, "城")},
- {0x2f853, 0, 0, 0, f(No, false, "埴")},
- {0x2f854, 0, 0, 0, f(No, false, "堍")},
- {0x2f855, 0, 0, 0, f(No, false, "型")},
- {0x2f856, 0, 0, 0, f(No, false, "堲")},
- {0x2f857, 0, 0, 0, f(No, false, "報")},
- {0x2f858, 0, 0, 0, f(No, false, "墬")},
- {0x2f859, 0, 0, 0, f(No, false, "𡓤")},
- {0x2f85a, 0, 0, 0, f(No, false, "売")},
- {0x2f85b, 0, 0, 0, f(No, false, "壷")},
- {0x2f85c, 0, 0, 0, f(No, false, "夆")},
- {0x2f85d, 0, 0, 0, f(No, false, "多")},
- {0x2f85e, 0, 0, 0, f(No, false, "夢")},
- {0x2f85f, 0, 0, 0, f(No, false, "奢")},
- {0x2f860, 0, 0, 0, f(No, false, "𡚨")},
- {0x2f861, 0, 0, 0, f(No, false, "𡛪")},
- {0x2f862, 0, 0, 0, f(No, false, "姬")},
- {0x2f863, 0, 0, 0, f(No, false, "娛")},
- {0x2f864, 0, 0, 0, f(No, false, "娧")},
- {0x2f865, 0, 0, 0, f(No, false, "姘")},
- {0x2f866, 0, 0, 0, f(No, false, "婦")},
- {0x2f867, 0, 0, 0, f(No, false, "㛮")},
- {0x2f868, 0, 0, 0, f(No, false, "㛼")},
- {0x2f869, 0, 0, 0, f(No, false, "嬈")},
- {0x2f86a, 0, 0, 0, f(No, false, "嬾")},
- {0x2f86c, 0, 0, 0, f(No, false, "𡧈")},
- {0x2f86d, 0, 0, 0, f(No, false, "寃")},
- {0x2f86e, 0, 0, 0, f(No, false, "寘")},
- {0x2f86f, 0, 0, 0, f(No, false, "寧")},
- {0x2f870, 0, 0, 0, f(No, false, "寳")},
- {0x2f871, 0, 0, 0, f(No, false, "𡬘")},
- {0x2f872, 0, 0, 0, f(No, false, "寿")},
- {0x2f873, 0, 0, 0, f(No, false, "将")},
- {0x2f874, 0, 0, 0, f(No, false, "当")},
- {0x2f875, 0, 0, 0, f(No, false, "尢")},
- {0x2f876, 0, 0, 0, f(No, false, "㞁")},
- {0x2f877, 0, 0, 0, f(No, false, "屠")},
- {0x2f878, 0, 0, 0, f(No, false, "屮")},
- {0x2f879, 0, 0, 0, f(No, false, "峀")},
- {0x2f87a, 0, 0, 0, f(No, false, "岍")},
- {0x2f87b, 0, 0, 0, f(No, false, "𡷤")},
- {0x2f87c, 0, 0, 0, f(No, false, "嵃")},
- {0x2f87d, 0, 0, 0, f(No, false, "𡷦")},
- {0x2f87e, 0, 0, 0, f(No, false, "嵮")},
- {0x2f87f, 0, 0, 0, f(No, false, "嵫")},
- {0x2f880, 0, 0, 0, f(No, false, "嵼")},
- {0x2f881, 0, 0, 0, f(No, false, "巡")},
- {0x2f882, 0, 0, 0, f(No, false, "巢")},
- {0x2f883, 0, 0, 0, f(No, false, "㠯")},
- {0x2f884, 0, 0, 0, f(No, false, "巽")},
- {0x2f885, 0, 0, 0, f(No, false, "帨")},
- {0x2f886, 0, 0, 0, f(No, false, "帽")},
- {0x2f887, 0, 0, 0, f(No, false, "幩")},
- {0x2f888, 0, 0, 0, f(No, false, "㡢")},
- {0x2f889, 0, 0, 0, f(No, false, "𢆃")},
- {0x2f88a, 0, 0, 0, f(No, false, "㡼")},
- {0x2f88b, 0, 0, 0, f(No, false, "庰")},
- {0x2f88c, 0, 0, 0, f(No, false, "庳")},
- {0x2f88d, 0, 0, 0, f(No, false, "庶")},
- {0x2f88e, 0, 0, 0, f(No, false, "廊")},
- {0x2f88f, 0, 0, 0, f(No, false, "𪎒")},
- {0x2f890, 0, 0, 0, f(No, false, "廾")},
- {0x2f891, 0, 0, 0, f(No, false, "𢌱")},
- {0x2f893, 0, 0, 0, f(No, false, "舁")},
- {0x2f894, 0, 0, 0, f(No, false, "弢")},
- {0x2f896, 0, 0, 0, f(No, false, "㣇")},
- {0x2f897, 0, 0, 0, f(No, false, "𣊸")},
- {0x2f898, 0, 0, 0, f(No, false, "𦇚")},
- {0x2f899, 0, 0, 0, f(No, false, "形")},
- {0x2f89a, 0, 0, 0, f(No, false, "彫")},
- {0x2f89b, 0, 0, 0, f(No, false, "㣣")},
- {0x2f89c, 0, 0, 0, f(No, false, "徚")},
- {0x2f89d, 0, 0, 0, f(No, false, "忍")},
- {0x2f89e, 0, 0, 0, f(No, false, "志")},
- {0x2f89f, 0, 0, 0, f(No, false, "忹")},
- {0x2f8a0, 0, 0, 0, f(No, false, "悁")},
- {0x2f8a1, 0, 0, 0, f(No, false, "㤺")},
- {0x2f8a2, 0, 0, 0, f(No, false, "㤜")},
- {0x2f8a3, 0, 0, 0, f(No, false, "悔")},
- {0x2f8a4, 0, 0, 0, f(No, false, "𢛔")},
- {0x2f8a5, 0, 0, 0, f(No, false, "惇")},
- {0x2f8a6, 0, 0, 0, f(No, false, "慈")},
- {0x2f8a7, 0, 0, 0, f(No, false, "慌")},
- {0x2f8a8, 0, 0, 0, f(No, false, "慎")},
- {0x2f8a9, 0, 0, 0, f(No, false, "慌")},
- {0x2f8aa, 0, 0, 0, f(No, false, "慺")},
- {0x2f8ab, 0, 0, 0, f(No, false, "憎")},
- {0x2f8ac, 0, 0, 0, f(No, false, "憲")},
- {0x2f8ad, 0, 0, 0, f(No, false, "憤")},
- {0x2f8ae, 0, 0, 0, f(No, false, "憯")},
- {0x2f8af, 0, 0, 0, f(No, false, "懞")},
- {0x2f8b0, 0, 0, 0, f(No, false, "懲")},
- {0x2f8b1, 0, 0, 0, f(No, false, "懶")},
- {0x2f8b2, 0, 0, 0, f(No, false, "成")},
- {0x2f8b3, 0, 0, 0, f(No, false, "戛")},
- {0x2f8b4, 0, 0, 0, f(No, false, "扝")},
- {0x2f8b5, 0, 0, 0, f(No, false, "抱")},
- {0x2f8b6, 0, 0, 0, f(No, false, "拔")},
- {0x2f8b7, 0, 0, 0, f(No, false, "捐")},
- {0x2f8b8, 0, 0, 0, f(No, false, "𢬌")},
- {0x2f8b9, 0, 0, 0, f(No, false, "挽")},
- {0x2f8ba, 0, 0, 0, f(No, false, "拼")},
- {0x2f8bb, 0, 0, 0, f(No, false, "捨")},
- {0x2f8bc, 0, 0, 0, f(No, false, "掃")},
- {0x2f8bd, 0, 0, 0, f(No, false, "揤")},
- {0x2f8be, 0, 0, 0, f(No, false, "𢯱")},
- {0x2f8bf, 0, 0, 0, f(No, false, "搢")},
- {0x2f8c0, 0, 0, 0, f(No, false, "揅")},
- {0x2f8c1, 0, 0, 0, f(No, false, "掩")},
- {0x2f8c2, 0, 0, 0, f(No, false, "㨮")},
- {0x2f8c3, 0, 0, 0, f(No, false, "摩")},
- {0x2f8c4, 0, 0, 0, f(No, false, "摾")},
- {0x2f8c5, 0, 0, 0, f(No, false, "撝")},
- {0x2f8c6, 0, 0, 0, f(No, false, "摷")},
- {0x2f8c7, 0, 0, 0, f(No, false, "㩬")},
- {0x2f8c8, 0, 0, 0, f(No, false, "敏")},
- {0x2f8c9, 0, 0, 0, f(No, false, "敬")},
- {0x2f8ca, 0, 0, 0, f(No, false, "𣀊")},
- {0x2f8cb, 0, 0, 0, f(No, false, "旣")},
- {0x2f8cc, 0, 0, 0, f(No, false, "書")},
- {0x2f8cd, 0, 0, 0, f(No, false, "晉")},
- {0x2f8ce, 0, 0, 0, f(No, false, "㬙")},
- {0x2f8cf, 0, 0, 0, f(No, false, "暑")},
- {0x2f8d0, 0, 0, 0, f(No, false, "㬈")},
- {0x2f8d1, 0, 0, 0, f(No, false, "㫤")},
- {0x2f8d2, 0, 0, 0, f(No, false, "冒")},
- {0x2f8d3, 0, 0, 0, f(No, false, "冕")},
- {0x2f8d4, 0, 0, 0, f(No, false, "最")},
- {0x2f8d5, 0, 0, 0, f(No, false, "暜")},
- {0x2f8d6, 0, 0, 0, f(No, false, "肭")},
- {0x2f8d7, 0, 0, 0, f(No, false, "䏙")},
- {0x2f8d8, 0, 0, 0, f(No, false, "朗")},
- {0x2f8d9, 0, 0, 0, f(No, false, "望")},
- {0x2f8da, 0, 0, 0, f(No, false, "朡")},
- {0x2f8db, 0, 0, 0, f(No, false, "杞")},
- {0x2f8dc, 0, 0, 0, f(No, false, "杓")},
- {0x2f8dd, 0, 0, 0, f(No, false, "𣏃")},
- {0x2f8de, 0, 0, 0, f(No, false, "㭉")},
- {0x2f8df, 0, 0, 0, f(No, false, "柺")},
- {0x2f8e0, 0, 0, 0, f(No, false, "枅")},
- {0x2f8e1, 0, 0, 0, f(No, false, "桒")},
- {0x2f8e2, 0, 0, 0, f(No, false, "梅")},
- {0x2f8e3, 0, 0, 0, f(No, false, "𣑭")},
- {0x2f8e4, 0, 0, 0, f(No, false, "梎")},
- {0x2f8e5, 0, 0, 0, f(No, false, "栟")},
- {0x2f8e6, 0, 0, 0, f(No, false, "椔")},
- {0x2f8e7, 0, 0, 0, f(No, false, "㮝")},
- {0x2f8e8, 0, 0, 0, f(No, false, "楂")},
- {0x2f8e9, 0, 0, 0, f(No, false, "榣")},
- {0x2f8ea, 0, 0, 0, f(No, false, "槪")},
- {0x2f8eb, 0, 0, 0, f(No, false, "檨")},
- {0x2f8ec, 0, 0, 0, f(No, false, "𣚣")},
- {0x2f8ed, 0, 0, 0, f(No, false, "櫛")},
- {0x2f8ee, 0, 0, 0, f(No, false, "㰘")},
- {0x2f8ef, 0, 0, 0, f(No, false, "次")},
- {0x2f8f0, 0, 0, 0, f(No, false, "𣢧")},
- {0x2f8f1, 0, 0, 0, f(No, false, "歔")},
- {0x2f8f2, 0, 0, 0, f(No, false, "㱎")},
- {0x2f8f3, 0, 0, 0, f(No, false, "歲")},
- {0x2f8f4, 0, 0, 0, f(No, false, "殟")},
- {0x2f8f5, 0, 0, 0, f(No, false, "殺")},
- {0x2f8f6, 0, 0, 0, f(No, false, "殻")},
- {0x2f8f7, 0, 0, 0, f(No, false, "𣪍")},
- {0x2f8f8, 0, 0, 0, f(No, false, "𡴋")},
- {0x2f8f9, 0, 0, 0, f(No, false, "𣫺")},
- {0x2f8fa, 0, 0, 0, f(No, false, "汎")},
- {0x2f8fb, 0, 0, 0, f(No, false, "𣲼")},
- {0x2f8fc, 0, 0, 0, f(No, false, "沿")},
- {0x2f8fd, 0, 0, 0, f(No, false, "泍")},
- {0x2f8fe, 0, 0, 0, f(No, false, "汧")},
- {0x2f8ff, 0, 0, 0, f(No, false, "洖")},
- {0x2f900, 0, 0, 0, f(No, false, "派")},
- {0x2f901, 0, 0, 0, f(No, false, "海")},
- {0x2f902, 0, 0, 0, f(No, false, "流")},
- {0x2f903, 0, 0, 0, f(No, false, "浩")},
- {0x2f904, 0, 0, 0, f(No, false, "浸")},
- {0x2f905, 0, 0, 0, f(No, false, "涅")},
- {0x2f906, 0, 0, 0, f(No, false, "𣴞")},
- {0x2f907, 0, 0, 0, f(No, false, "洴")},
- {0x2f908, 0, 0, 0, f(No, false, "港")},
- {0x2f909, 0, 0, 0, f(No, false, "湮")},
- {0x2f90a, 0, 0, 0, f(No, false, "㴳")},
- {0x2f90b, 0, 0, 0, f(No, false, "滋")},
- {0x2f90c, 0, 0, 0, f(No, false, "滇")},
- {0x2f90d, 0, 0, 0, f(No, false, "𣻑")},
- {0x2f90e, 0, 0, 0, f(No, false, "淹")},
- {0x2f90f, 0, 0, 0, f(No, false, "潮")},
- {0x2f910, 0, 0, 0, f(No, false, "𣽞")},
- {0x2f911, 0, 0, 0, f(No, false, "𣾎")},
- {0x2f912, 0, 0, 0, f(No, false, "濆")},
- {0x2f913, 0, 0, 0, f(No, false, "瀹")},
- {0x2f914, 0, 0, 0, f(No, false, "瀞")},
- {0x2f915, 0, 0, 0, f(No, false, "瀛")},
- {0x2f916, 0, 0, 0, f(No, false, "㶖")},
- {0x2f917, 0, 0, 0, f(No, false, "灊")},
- {0x2f918, 0, 0, 0, f(No, false, "災")},
- {0x2f919, 0, 0, 0, f(No, false, "灷")},
- {0x2f91a, 0, 0, 0, f(No, false, "炭")},
- {0x2f91b, 0, 0, 0, f(No, false, "𠔥")},
- {0x2f91c, 0, 0, 0, f(No, false, "煅")},
- {0x2f91d, 0, 0, 0, f(No, false, "𤉣")},
- {0x2f91e, 0, 0, 0, f(No, false, "熜")},
- {0x2f91f, 0, 0, 0, f(No, false, "𤎫")},
- {0x2f920, 0, 0, 0, f(No, false, "爨")},
- {0x2f921, 0, 0, 0, f(No, false, "爵")},
- {0x2f922, 0, 0, 0, f(No, false, "牐")},
- {0x2f923, 0, 0, 0, f(No, false, "𤘈")},
- {0x2f924, 0, 0, 0, f(No, false, "犀")},
- {0x2f925, 0, 0, 0, f(No, false, "犕")},
- {0x2f926, 0, 0, 0, f(No, false, "𤜵")},
- {0x2f927, 0, 0, 0, f(No, false, "𤠔")},
- {0x2f928, 0, 0, 0, f(No, false, "獺")},
- {0x2f929, 0, 0, 0, f(No, false, "王")},
- {0x2f92a, 0, 0, 0, f(No, false, "㺬")},
- {0x2f92b, 0, 0, 0, f(No, false, "玥")},
- {0x2f92c, 0, 0, 0, f(No, false, "㺸")},
- {0x2f92e, 0, 0, 0, f(No, false, "瑇")},
- {0x2f92f, 0, 0, 0, f(No, false, "瑜")},
- {0x2f930, 0, 0, 0, f(No, false, "瑱")},
- {0x2f931, 0, 0, 0, f(No, false, "璅")},
- {0x2f932, 0, 0, 0, f(No, false, "瓊")},
- {0x2f933, 0, 0, 0, f(No, false, "㼛")},
- {0x2f934, 0, 0, 0, f(No, false, "甤")},
- {0x2f935, 0, 0, 0, f(No, false, "𤰶")},
- {0x2f936, 0, 0, 0, f(No, false, "甾")},
- {0x2f937, 0, 0, 0, f(No, false, "𤲒")},
- {0x2f938, 0, 0, 0, f(No, false, "異")},
- {0x2f939, 0, 0, 0, f(No, false, "𢆟")},
- {0x2f93a, 0, 0, 0, f(No, false, "瘐")},
- {0x2f93b, 0, 0, 0, f(No, false, "𤾡")},
- {0x2f93c, 0, 0, 0, f(No, false, "𤾸")},
- {0x2f93d, 0, 0, 0, f(No, false, "𥁄")},
- {0x2f93e, 0, 0, 0, f(No, false, "㿼")},
- {0x2f93f, 0, 0, 0, f(No, false, "䀈")},
- {0x2f940, 0, 0, 0, f(No, false, "直")},
- {0x2f941, 0, 0, 0, f(No, false, "𥃳")},
- {0x2f942, 0, 0, 0, f(No, false, "𥃲")},
- {0x2f943, 0, 0, 0, f(No, false, "𥄙")},
- {0x2f944, 0, 0, 0, f(No, false, "𥄳")},
- {0x2f945, 0, 0, 0, f(No, false, "眞")},
- {0x2f946, 0, 0, 0, f(No, false, "真")},
- {0x2f948, 0, 0, 0, f(No, false, "睊")},
- {0x2f949, 0, 0, 0, f(No, false, "䀹")},
- {0x2f94a, 0, 0, 0, f(No, false, "瞋")},
- {0x2f94b, 0, 0, 0, f(No, false, "䁆")},
- {0x2f94c, 0, 0, 0, f(No, false, "䂖")},
- {0x2f94d, 0, 0, 0, f(No, false, "𥐝")},
- {0x2f94e, 0, 0, 0, f(No, false, "硎")},
- {0x2f94f, 0, 0, 0, f(No, false, "碌")},
- {0x2f950, 0, 0, 0, f(No, false, "磌")},
- {0x2f951, 0, 0, 0, f(No, false, "䃣")},
- {0x2f952, 0, 0, 0, f(No, false, "𥘦")},
- {0x2f953, 0, 0, 0, f(No, false, "祖")},
- {0x2f954, 0, 0, 0, f(No, false, "𥚚")},
- {0x2f955, 0, 0, 0, f(No, false, "𥛅")},
- {0x2f956, 0, 0, 0, f(No, false, "福")},
- {0x2f957, 0, 0, 0, f(No, false, "秫")},
- {0x2f958, 0, 0, 0, f(No, false, "䄯")},
- {0x2f959, 0, 0, 0, f(No, false, "穀")},
- {0x2f95a, 0, 0, 0, f(No, false, "穊")},
- {0x2f95b, 0, 0, 0, f(No, false, "穏")},
- {0x2f95c, 0, 0, 0, f(No, false, "𥥼")},
- {0x2f95d, 0, 0, 0, f(No, false, "𥪧")},
- {0x2f95f, 0, 0, 0, f(No, false, "竮")},
- {0x2f960, 0, 0, 0, f(No, false, "䈂")},
- {0x2f961, 0, 0, 0, f(No, false, "𥮫")},
- {0x2f962, 0, 0, 0, f(No, false, "篆")},
- {0x2f963, 0, 0, 0, f(No, false, "築")},
- {0x2f964, 0, 0, 0, f(No, false, "䈧")},
- {0x2f965, 0, 0, 0, f(No, false, "𥲀")},
- {0x2f966, 0, 0, 0, f(No, false, "糒")},
- {0x2f967, 0, 0, 0, f(No, false, "䊠")},
- {0x2f968, 0, 0, 0, f(No, false, "糨")},
- {0x2f969, 0, 0, 0, f(No, false, "糣")},
- {0x2f96a, 0, 0, 0, f(No, false, "紀")},
- {0x2f96b, 0, 0, 0, f(No, false, "𥾆")},
- {0x2f96c, 0, 0, 0, f(No, false, "絣")},
- {0x2f96d, 0, 0, 0, f(No, false, "䌁")},
- {0x2f96e, 0, 0, 0, f(No, false, "緇")},
- {0x2f96f, 0, 0, 0, f(No, false, "縂")},
- {0x2f970, 0, 0, 0, f(No, false, "繅")},
- {0x2f971, 0, 0, 0, f(No, false, "䌴")},
- {0x2f972, 0, 0, 0, f(No, false, "𦈨")},
- {0x2f973, 0, 0, 0, f(No, false, "𦉇")},
- {0x2f974, 0, 0, 0, f(No, false, "䍙")},
- {0x2f975, 0, 0, 0, f(No, false, "𦋙")},
- {0x2f976, 0, 0, 0, f(No, false, "罺")},
- {0x2f977, 0, 0, 0, f(No, false, "𦌾")},
- {0x2f978, 0, 0, 0, f(No, false, "羕")},
- {0x2f979, 0, 0, 0, f(No, false, "翺")},
- {0x2f97a, 0, 0, 0, f(No, false, "者")},
- {0x2f97b, 0, 0, 0, f(No, false, "𦓚")},
- {0x2f97c, 0, 0, 0, f(No, false, "𦔣")},
- {0x2f97d, 0, 0, 0, f(No, false, "聠")},
- {0x2f97e, 0, 0, 0, f(No, false, "𦖨")},
- {0x2f97f, 0, 0, 0, f(No, false, "聰")},
- {0x2f980, 0, 0, 0, f(No, false, "𣍟")},
- {0x2f981, 0, 0, 0, f(No, false, "䏕")},
- {0x2f982, 0, 0, 0, f(No, false, "育")},
- {0x2f983, 0, 0, 0, f(No, false, "脃")},
- {0x2f984, 0, 0, 0, f(No, false, "䐋")},
- {0x2f985, 0, 0, 0, f(No, false, "脾")},
- {0x2f986, 0, 0, 0, f(No, false, "媵")},
- {0x2f987, 0, 0, 0, f(No, false, "𦞧")},
- {0x2f988, 0, 0, 0, f(No, false, "𦞵")},
- {0x2f989, 0, 0, 0, f(No, false, "𣎓")},
- {0x2f98a, 0, 0, 0, f(No, false, "𣎜")},
- {0x2f98b, 0, 0, 0, f(No, false, "舁")},
- {0x2f98c, 0, 0, 0, f(No, false, "舄")},
- {0x2f98d, 0, 0, 0, f(No, false, "辞")},
- {0x2f98e, 0, 0, 0, f(No, false, "䑫")},
- {0x2f98f, 0, 0, 0, f(No, false, "芑")},
- {0x2f990, 0, 0, 0, f(No, false, "芋")},
- {0x2f991, 0, 0, 0, f(No, false, "芝")},
- {0x2f992, 0, 0, 0, f(No, false, "劳")},
- {0x2f993, 0, 0, 0, f(No, false, "花")},
- {0x2f994, 0, 0, 0, f(No, false, "芳")},
- {0x2f995, 0, 0, 0, f(No, false, "芽")},
- {0x2f996, 0, 0, 0, f(No, false, "苦")},
- {0x2f997, 0, 0, 0, f(No, false, "𦬼")},
- {0x2f998, 0, 0, 0, f(No, false, "若")},
- {0x2f999, 0, 0, 0, f(No, false, "茝")},
- {0x2f99a, 0, 0, 0, f(No, false, "荣")},
- {0x2f99b, 0, 0, 0, f(No, false, "莭")},
- {0x2f99c, 0, 0, 0, f(No, false, "茣")},
- {0x2f99d, 0, 0, 0, f(No, false, "莽")},
- {0x2f99e, 0, 0, 0, f(No, false, "菧")},
- {0x2f99f, 0, 0, 0, f(No, false, "著")},
- {0x2f9a0, 0, 0, 0, f(No, false, "荓")},
- {0x2f9a1, 0, 0, 0, f(No, false, "菊")},
- {0x2f9a2, 0, 0, 0, f(No, false, "菌")},
- {0x2f9a3, 0, 0, 0, f(No, false, "菜")},
- {0x2f9a4, 0, 0, 0, f(No, false, "𦰶")},
- {0x2f9a5, 0, 0, 0, f(No, false, "𦵫")},
- {0x2f9a6, 0, 0, 0, f(No, false, "𦳕")},
- {0x2f9a7, 0, 0, 0, f(No, false, "䔫")},
- {0x2f9a8, 0, 0, 0, f(No, false, "蓱")},
- {0x2f9a9, 0, 0, 0, f(No, false, "蓳")},
- {0x2f9aa, 0, 0, 0, f(No, false, "蔖")},
- {0x2f9ab, 0, 0, 0, f(No, false, "𧏊")},
- {0x2f9ac, 0, 0, 0, f(No, false, "蕤")},
- {0x2f9ad, 0, 0, 0, f(No, false, "𦼬")},
- {0x2f9ae, 0, 0, 0, f(No, false, "䕝")},
- {0x2f9af, 0, 0, 0, f(No, false, "䕡")},
- {0x2f9b0, 0, 0, 0, f(No, false, "𦾱")},
- {0x2f9b1, 0, 0, 0, f(No, false, "𧃒")},
- {0x2f9b2, 0, 0, 0, f(No, false, "䕫")},
- {0x2f9b3, 0, 0, 0, f(No, false, "虐")},
- {0x2f9b4, 0, 0, 0, f(No, false, "虜")},
- {0x2f9b5, 0, 0, 0, f(No, false, "虧")},
- {0x2f9b6, 0, 0, 0, f(No, false, "虩")},
- {0x2f9b7, 0, 0, 0, f(No, false, "蚩")},
- {0x2f9b8, 0, 0, 0, f(No, false, "蚈")},
- {0x2f9b9, 0, 0, 0, f(No, false, "蜎")},
- {0x2f9ba, 0, 0, 0, f(No, false, "蛢")},
- {0x2f9bb, 0, 0, 0, f(No, false, "蝹")},
- {0x2f9bc, 0, 0, 0, f(No, false, "蜨")},
- {0x2f9bd, 0, 0, 0, f(No, false, "蝫")},
- {0x2f9be, 0, 0, 0, f(No, false, "螆")},
- {0x2f9bf, 0, 0, 0, f(No, false, "䗗")},
- {0x2f9c0, 0, 0, 0, f(No, false, "蟡")},
- {0x2f9c1, 0, 0, 0, f(No, false, "蠁")},
- {0x2f9c2, 0, 0, 0, f(No, false, "䗹")},
- {0x2f9c3, 0, 0, 0, f(No, false, "衠")},
- {0x2f9c4, 0, 0, 0, f(No, false, "衣")},
- {0x2f9c5, 0, 0, 0, f(No, false, "𧙧")},
- {0x2f9c6, 0, 0, 0, f(No, false, "裗")},
- {0x2f9c7, 0, 0, 0, f(No, false, "裞")},
- {0x2f9c8, 0, 0, 0, f(No, false, "䘵")},
- {0x2f9c9, 0, 0, 0, f(No, false, "裺")},
- {0x2f9ca, 0, 0, 0, f(No, false, "㒻")},
- {0x2f9cb, 0, 0, 0, f(No, false, "𧢮")},
- {0x2f9cc, 0, 0, 0, f(No, false, "𧥦")},
- {0x2f9cd, 0, 0, 0, f(No, false, "䚾")},
- {0x2f9ce, 0, 0, 0, f(No, false, "䛇")},
- {0x2f9cf, 0, 0, 0, f(No, false, "誠")},
- {0x2f9d0, 0, 0, 0, f(No, false, "諭")},
- {0x2f9d1, 0, 0, 0, f(No, false, "變")},
- {0x2f9d2, 0, 0, 0, f(No, false, "豕")},
- {0x2f9d3, 0, 0, 0, f(No, false, "𧲨")},
- {0x2f9d4, 0, 0, 0, f(No, false, "貫")},
- {0x2f9d5, 0, 0, 0, f(No, false, "賁")},
- {0x2f9d6, 0, 0, 0, f(No, false, "贛")},
- {0x2f9d7, 0, 0, 0, f(No, false, "起")},
- {0x2f9d8, 0, 0, 0, f(No, false, "𧼯")},
- {0x2f9d9, 0, 0, 0, f(No, false, "𠠄")},
- {0x2f9da, 0, 0, 0, f(No, false, "跋")},
- {0x2f9db, 0, 0, 0, f(No, false, "趼")},
- {0x2f9dc, 0, 0, 0, f(No, false, "跰")},
- {0x2f9dd, 0, 0, 0, f(No, false, "𠣞")},
- {0x2f9de, 0, 0, 0, f(No, false, "軔")},
- {0x2f9df, 0, 0, 0, f(No, false, "輸")},
- {0x2f9e0, 0, 0, 0, f(No, false, "𨗒")},
- {0x2f9e1, 0, 0, 0, f(No, false, "𨗭")},
- {0x2f9e2, 0, 0, 0, f(No, false, "邔")},
- {0x2f9e3, 0, 0, 0, f(No, false, "郱")},
- {0x2f9e4, 0, 0, 0, f(No, false, "鄑")},
- {0x2f9e5, 0, 0, 0, f(No, false, "𨜮")},
- {0x2f9e6, 0, 0, 0, f(No, false, "鄛")},
- {0x2f9e7, 0, 0, 0, f(No, false, "鈸")},
- {0x2f9e8, 0, 0, 0, f(No, false, "鋗")},
- {0x2f9e9, 0, 0, 0, f(No, false, "鋘")},
- {0x2f9ea, 0, 0, 0, f(No, false, "鉼")},
- {0x2f9eb, 0, 0, 0, f(No, false, "鏹")},
- {0x2f9ec, 0, 0, 0, f(No, false, "鐕")},
- {0x2f9ed, 0, 0, 0, f(No, false, "𨯺")},
- {0x2f9ee, 0, 0, 0, f(No, false, "開")},
- {0x2f9ef, 0, 0, 0, f(No, false, "䦕")},
- {0x2f9f0, 0, 0, 0, f(No, false, "閷")},
- {0x2f9f1, 0, 0, 0, f(No, false, "𨵷")},
- {0x2f9f2, 0, 0, 0, f(No, false, "䧦")},
- {0x2f9f3, 0, 0, 0, f(No, false, "雃")},
- {0x2f9f4, 0, 0, 0, f(No, false, "嶲")},
- {0x2f9f5, 0, 0, 0, f(No, false, "霣")},
- {0x2f9f6, 0, 0, 0, f(No, false, "𩅅")},
- {0x2f9f7, 0, 0, 0, f(No, false, "𩈚")},
- {0x2f9f8, 0, 0, 0, f(No, false, "䩮")},
- {0x2f9f9, 0, 0, 0, f(No, false, "䩶")},
- {0x2f9fa, 0, 0, 0, f(No, false, "韠")},
- {0x2f9fb, 0, 0, 0, f(No, false, "𩐊")},
- {0x2f9fc, 0, 0, 0, f(No, false, "䪲")},
- {0x2f9fd, 0, 0, 0, f(No, false, "𩒖")},
- {0x2f9fe, 0, 0, 0, f(No, false, "頋")},
- {0x2fa00, 0, 0, 0, f(No, false, "頩")},
- {0x2fa01, 0, 0, 0, f(No, false, "𩖶")},
- {0x2fa02, 0, 0, 0, f(No, false, "飢")},
- {0x2fa03, 0, 0, 0, f(No, false, "䬳")},
- {0x2fa04, 0, 0, 0, f(No, false, "餩")},
- {0x2fa05, 0, 0, 0, f(No, false, "馧")},
- {0x2fa06, 0, 0, 0, f(No, false, "駂")},
- {0x2fa07, 0, 0, 0, f(No, false, "駾")},
- {0x2fa08, 0, 0, 0, f(No, false, "䯎")},
- {0x2fa09, 0, 0, 0, f(No, false, "𩬰")},
- {0x2fa0a, 0, 0, 0, f(No, false, "鬒")},
- {0x2fa0b, 0, 0, 0, f(No, false, "鱀")},
- {0x2fa0c, 0, 0, 0, f(No, false, "鳽")},
- {0x2fa0d, 0, 0, 0, f(No, false, "䳎")},
- {0x2fa0e, 0, 0, 0, f(No, false, "䳭")},
- {0x2fa0f, 0, 0, 0, f(No, false, "鵧")},
- {0x2fa10, 0, 0, 0, f(No, false, "𪃎")},
- {0x2fa11, 0, 0, 0, f(No, false, "䳸")},
- {0x2fa12, 0, 0, 0, f(No, false, "𪄅")},
- {0x2fa13, 0, 0, 0, f(No, false, "𪈎")},
- {0x2fa14, 0, 0, 0, f(No, false, "𪊑")},
- {0x2fa15, 0, 0, 0, f(No, false, "麻")},
- {0x2fa16, 0, 0, 0, f(No, false, "䵖")},
- {0x2fa17, 0, 0, 0, f(No, false, "黹")},
- {0x2fa18, 0, 0, 0, f(No, false, "黾")},
- {0x2fa19, 0, 0, 0, f(No, false, "鼅")},
- {0x2fa1a, 0, 0, 0, f(No, false, "鼏")},
- {0x2fa1b, 0, 0, 0, f(No, false, "鼖")},
- {0x2fa1c, 0, 0, 0, f(No, false, "鼻")},
- {0x2fa1d, 0, 0, 0, f(No, false, "𪘀")},
- {0x2fa1e, 0, 0, 0, f(Yes, false, "")},
-}
diff --git a/vendor/golang.org/x/text/unicode/norm/data9.0.0_test.go b/vendor/golang.org/x/text/unicode/norm/data9.0.0_test.go
deleted file mode 100644
index b1be64d55..000000000
--- a/vendor/golang.org/x/text/unicode/norm/data9.0.0_test.go
+++ /dev/null
@@ -1,7409 +0,0 @@
-// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
-
-// +build !go1.10
-
-package norm
-
-const (
- Yes = iota
- No
- Maybe
-)
-
-type formData struct {
- qc uint8
- combinesForward bool
- decomposition string
-}
-
-type runeData struct {
- r rune
- ccc uint8
- nLead uint8
- nTrail uint8
- f [2]formData // 0: canonical; 1: compatibility
-}
-
-func f(qc uint8, cf bool, dec string) [2]formData {
- return [2]formData{{qc, cf, dec}, {qc, cf, dec}}
-}
-
-func g(qc, qck uint8, cf, cfk bool, d, dk string) [2]formData {
- return [2]formData{{qc, cf, d}, {qck, cfk, dk}}
-}
-
-var testData = []runeData{
- {0x0, 0, 0, 0, f(Yes, false, "")},
- {0x3c, 0, 0, 0, f(Yes, true, "")},
- {0x3f, 0, 0, 0, f(Yes, false, "")},
- {0x41, 0, 0, 0, f(Yes, true, "")},
- {0x51, 0, 0, 0, f(Yes, false, "")},
- {0x52, 0, 0, 0, f(Yes, true, "")},
- {0x5b, 0, 0, 0, f(Yes, false, "")},
- {0x61, 0, 0, 0, f(Yes, true, "")},
- {0x71, 0, 0, 0, f(Yes, false, "")},
- {0x72, 0, 0, 0, f(Yes, true, "")},
- {0x7b, 0, 0, 0, f(Yes, false, "")},
- {0xa0, 0, 0, 0, g(Yes, No, false, false, "", " ")},
- {0xa1, 0, 0, 0, f(Yes, false, "")},
- {0xa8, 0, 0, 1, g(Yes, No, true, false, "", " ̈")},
- {0xa9, 0, 0, 0, f(Yes, false, "")},
- {0xaa, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0xab, 0, 0, 0, f(Yes, false, "")},
- {0xaf, 0, 0, 1, g(Yes, No, false, false, "", " ̄")},
- {0xb0, 0, 0, 0, f(Yes, false, "")},
- {0xb2, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0xb3, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0xb4, 0, 0, 1, g(Yes, No, false, false, "", " ́")},
- {0xb5, 0, 0, 0, g(Yes, No, false, false, "", "μ")},
- {0xb6, 0, 0, 0, f(Yes, false, "")},
- {0xb8, 0, 0, 1, g(Yes, No, false, false, "", " ̧")},
- {0xb9, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0xba, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0xbb, 0, 0, 0, f(Yes, false, "")},
- {0xbc, 0, 0, 0, g(Yes, No, false, false, "", "1⁄4")},
- {0xbd, 0, 0, 0, g(Yes, No, false, false, "", "1⁄2")},
- {0xbe, 0, 0, 0, g(Yes, No, false, false, "", "3⁄4")},
- {0xbf, 0, 0, 0, f(Yes, false, "")},
- {0xc0, 0, 0, 1, f(Yes, false, "À")},
- {0xc1, 0, 0, 1, f(Yes, false, "Á")},
- {0xc2, 0, 0, 1, f(Yes, true, "Â")},
- {0xc3, 0, 0, 1, f(Yes, false, "Ã")},
- {0xc4, 0, 0, 1, f(Yes, true, "Ä")},
- {0xc5, 0, 0, 1, f(Yes, true, "Å")},
- {0xc6, 0, 0, 0, f(Yes, true, "")},
- {0xc7, 0, 0, 1, f(Yes, true, "Ç")},
- {0xc8, 0, 0, 1, f(Yes, false, "È")},
- {0xc9, 0, 0, 1, f(Yes, false, "É")},
- {0xca, 0, 0, 1, f(Yes, true, "Ê")},
- {0xcb, 0, 0, 1, f(Yes, false, "Ë")},
- {0xcc, 0, 0, 1, f(Yes, false, "Ì")},
- {0xcd, 0, 0, 1, f(Yes, false, "Í")},
- {0xce, 0, 0, 1, f(Yes, false, "Î")},
- {0xcf, 0, 0, 1, f(Yes, true, "Ï")},
- {0xd0, 0, 0, 0, f(Yes, false, "")},
- {0xd1, 0, 0, 1, f(Yes, false, "Ñ")},
- {0xd2, 0, 0, 1, f(Yes, false, "Ò")},
- {0xd3, 0, 0, 1, f(Yes, false, "Ó")},
- {0xd4, 0, 0, 1, f(Yes, true, "Ô")},
- {0xd5, 0, 0, 1, f(Yes, true, "Õ")},
- {0xd6, 0, 0, 1, f(Yes, true, "Ö")},
- {0xd7, 0, 0, 0, f(Yes, false, "")},
- {0xd8, 0, 0, 0, f(Yes, true, "")},
- {0xd9, 0, 0, 1, f(Yes, false, "Ù")},
- {0xda, 0, 0, 1, f(Yes, false, "Ú")},
- {0xdb, 0, 0, 1, f(Yes, false, "Û")},
- {0xdc, 0, 0, 1, f(Yes, true, "Ü")},
- {0xdd, 0, 0, 1, f(Yes, false, "Ý")},
- {0xde, 0, 0, 0, f(Yes, false, "")},
- {0xe0, 0, 0, 1, f(Yes, false, "à")},
- {0xe1, 0, 0, 1, f(Yes, false, "á")},
- {0xe2, 0, 0, 1, f(Yes, true, "â")},
- {0xe3, 0, 0, 1, f(Yes, false, "ã")},
- {0xe4, 0, 0, 1, f(Yes, true, "ä")},
- {0xe5, 0, 0, 1, f(Yes, true, "å")},
- {0xe6, 0, 0, 0, f(Yes, true, "")},
- {0xe7, 0, 0, 1, f(Yes, true, "ç")},
- {0xe8, 0, 0, 1, f(Yes, false, "è")},
- {0xe9, 0, 0, 1, f(Yes, false, "é")},
- {0xea, 0, 0, 1, f(Yes, true, "ê")},
- {0xeb, 0, 0, 1, f(Yes, false, "ë")},
- {0xec, 0, 0, 1, f(Yes, false, "ì")},
- {0xed, 0, 0, 1, f(Yes, false, "í")},
- {0xee, 0, 0, 1, f(Yes, false, "î")},
- {0xef, 0, 0, 1, f(Yes, true, "ï")},
- {0xf0, 0, 0, 0, f(Yes, false, "")},
- {0xf1, 0, 0, 1, f(Yes, false, "ñ")},
- {0xf2, 0, 0, 1, f(Yes, false, "ò")},
- {0xf3, 0, 0, 1, f(Yes, false, "ó")},
- {0xf4, 0, 0, 1, f(Yes, true, "ô")},
- {0xf5, 0, 0, 1, f(Yes, true, "õ")},
- {0xf6, 0, 0, 1, f(Yes, true, "ö")},
- {0xf7, 0, 0, 0, f(Yes, false, "")},
- {0xf8, 0, 0, 0, f(Yes, true, "")},
- {0xf9, 0, 0, 1, f(Yes, false, "ù")},
- {0xfa, 0, 0, 1, f(Yes, false, "ú")},
- {0xfb, 0, 0, 1, f(Yes, false, "û")},
- {0xfc, 0, 0, 1, f(Yes, true, "ü")},
- {0xfd, 0, 0, 1, f(Yes, false, "ý")},
- {0xfe, 0, 0, 0, f(Yes, false, "")},
- {0xff, 0, 0, 1, f(Yes, false, "ÿ")},
- {0x100, 0, 0, 1, f(Yes, false, "Ā")},
- {0x101, 0, 0, 1, f(Yes, false, "ā")},
- {0x102, 0, 0, 1, f(Yes, true, "Ă")},
- {0x103, 0, 0, 1, f(Yes, true, "ă")},
- {0x104, 0, 0, 1, f(Yes, false, "Ą")},
- {0x105, 0, 0, 1, f(Yes, false, "ą")},
- {0x106, 0, 0, 1, f(Yes, false, "Ć")},
- {0x107, 0, 0, 1, f(Yes, false, "ć")},
- {0x108, 0, 0, 1, f(Yes, false, "Ĉ")},
- {0x109, 0, 0, 1, f(Yes, false, "ĉ")},
- {0x10a, 0, 0, 1, f(Yes, false, "Ċ")},
- {0x10b, 0, 0, 1, f(Yes, false, "ċ")},
- {0x10c, 0, 0, 1, f(Yes, false, "Č")},
- {0x10d, 0, 0, 1, f(Yes, false, "č")},
- {0x10e, 0, 0, 1, f(Yes, false, "Ď")},
- {0x10f, 0, 0, 1, f(Yes, false, "ď")},
- {0x110, 0, 0, 0, f(Yes, false, "")},
- {0x112, 0, 0, 1, f(Yes, true, "Ē")},
- {0x113, 0, 0, 1, f(Yes, true, "ē")},
- {0x114, 0, 0, 1, f(Yes, false, "Ĕ")},
- {0x115, 0, 0, 1, f(Yes, false, "ĕ")},
- {0x116, 0, 0, 1, f(Yes, false, "Ė")},
- {0x117, 0, 0, 1, f(Yes, false, "ė")},
- {0x118, 0, 0, 1, f(Yes, false, "Ę")},
- {0x119, 0, 0, 1, f(Yes, false, "ę")},
- {0x11a, 0, 0, 1, f(Yes, false, "Ě")},
- {0x11b, 0, 0, 1, f(Yes, false, "ě")},
- {0x11c, 0, 0, 1, f(Yes, false, "Ĝ")},
- {0x11d, 0, 0, 1, f(Yes, false, "ĝ")},
- {0x11e, 0, 0, 1, f(Yes, false, "Ğ")},
- {0x11f, 0, 0, 1, f(Yes, false, "ğ")},
- {0x120, 0, 0, 1, f(Yes, false, "Ġ")},
- {0x121, 0, 0, 1, f(Yes, false, "ġ")},
- {0x122, 0, 0, 1, f(Yes, false, "Ģ")},
- {0x123, 0, 0, 1, f(Yes, false, "ģ")},
- {0x124, 0, 0, 1, f(Yes, false, "Ĥ")},
- {0x125, 0, 0, 1, f(Yes, false, "ĥ")},
- {0x126, 0, 0, 0, f(Yes, false, "")},
- {0x128, 0, 0, 1, f(Yes, false, "Ĩ")},
- {0x129, 0, 0, 1, f(Yes, false, "ĩ")},
- {0x12a, 0, 0, 1, f(Yes, false, "Ī")},
- {0x12b, 0, 0, 1, f(Yes, false, "ī")},
- {0x12c, 0, 0, 1, f(Yes, false, "Ĭ")},
- {0x12d, 0, 0, 1, f(Yes, false, "ĭ")},
- {0x12e, 0, 0, 1, f(Yes, false, "Į")},
- {0x12f, 0, 0, 1, f(Yes, false, "į")},
- {0x130, 0, 0, 1, f(Yes, false, "İ")},
- {0x131, 0, 0, 0, f(Yes, false, "")},
- {0x132, 0, 0, 0, g(Yes, No, false, false, "", "IJ")},
- {0x133, 0, 0, 0, g(Yes, No, false, false, "", "ij")},
- {0x134, 0, 0, 1, f(Yes, false, "Ĵ")},
- {0x135, 0, 0, 1, f(Yes, false, "ĵ")},
- {0x136, 0, 0, 1, f(Yes, false, "Ķ")},
- {0x137, 0, 0, 1, f(Yes, false, "ķ")},
- {0x138, 0, 0, 0, f(Yes, false, "")},
- {0x139, 0, 0, 1, f(Yes, false, "Ĺ")},
- {0x13a, 0, 0, 1, f(Yes, false, "ĺ")},
- {0x13b, 0, 0, 1, f(Yes, false, "Ļ")},
- {0x13c, 0, 0, 1, f(Yes, false, "ļ")},
- {0x13d, 0, 0, 1, f(Yes, false, "Ľ")},
- {0x13e, 0, 0, 1, f(Yes, false, "ľ")},
- {0x13f, 0, 0, 0, g(Yes, No, false, false, "", "L·")},
- {0x140, 0, 0, 0, g(Yes, No, false, false, "", "l·")},
- {0x141, 0, 0, 0, f(Yes, false, "")},
- {0x143, 0, 0, 1, f(Yes, false, "Ń")},
- {0x144, 0, 0, 1, f(Yes, false, "ń")},
- {0x145, 0, 0, 1, f(Yes, false, "Ņ")},
- {0x146, 0, 0, 1, f(Yes, false, "ņ")},
- {0x147, 0, 0, 1, f(Yes, false, "Ň")},
- {0x148, 0, 0, 1, f(Yes, false, "ň")},
- {0x149, 0, 0, 0, g(Yes, No, false, false, "", "ʼn")},
- {0x14a, 0, 0, 0, f(Yes, false, "")},
- {0x14c, 0, 0, 1, f(Yes, true, "Ō")},
- {0x14d, 0, 0, 1, f(Yes, true, "ō")},
- {0x14e, 0, 0, 1, f(Yes, false, "Ŏ")},
- {0x14f, 0, 0, 1, f(Yes, false, "ŏ")},
- {0x150, 0, 0, 1, f(Yes, false, "Ő")},
- {0x151, 0, 0, 1, f(Yes, false, "ő")},
- {0x152, 0, 0, 0, f(Yes, false, "")},
- {0x154, 0, 0, 1, f(Yes, false, "Ŕ")},
- {0x155, 0, 0, 1, f(Yes, false, "ŕ")},
- {0x156, 0, 0, 1, f(Yes, false, "Ŗ")},
- {0x157, 0, 0, 1, f(Yes, false, "ŗ")},
- {0x158, 0, 0, 1, f(Yes, false, "Ř")},
- {0x159, 0, 0, 1, f(Yes, false, "ř")},
- {0x15a, 0, 0, 1, f(Yes, true, "Ś")},
- {0x15b, 0, 0, 1, f(Yes, true, "ś")},
- {0x15c, 0, 0, 1, f(Yes, false, "Ŝ")},
- {0x15d, 0, 0, 1, f(Yes, false, "ŝ")},
- {0x15e, 0, 0, 1, f(Yes, false, "Ş")},
- {0x15f, 0, 0, 1, f(Yes, false, "ş")},
- {0x160, 0, 0, 1, f(Yes, true, "Š")},
- {0x161, 0, 0, 1, f(Yes, true, "š")},
- {0x162, 0, 0, 1, f(Yes, false, "Ţ")},
- {0x163, 0, 0, 1, f(Yes, false, "ţ")},
- {0x164, 0, 0, 1, f(Yes, false, "Ť")},
- {0x165, 0, 0, 1, f(Yes, false, "ť")},
- {0x166, 0, 0, 0, f(Yes, false, "")},
- {0x168, 0, 0, 1, f(Yes, true, "Ũ")},
- {0x169, 0, 0, 1, f(Yes, true, "ũ")},
- {0x16a, 0, 0, 1, f(Yes, true, "Ū")},
- {0x16b, 0, 0, 1, f(Yes, true, "ū")},
- {0x16c, 0, 0, 1, f(Yes, false, "Ŭ")},
- {0x16d, 0, 0, 1, f(Yes, false, "ŭ")},
- {0x16e, 0, 0, 1, f(Yes, false, "Ů")},
- {0x16f, 0, 0, 1, f(Yes, false, "ů")},
- {0x170, 0, 0, 1, f(Yes, false, "Ű")},
- {0x171, 0, 0, 1, f(Yes, false, "ű")},
- {0x172, 0, 0, 1, f(Yes, false, "Ų")},
- {0x173, 0, 0, 1, f(Yes, false, "ų")},
- {0x174, 0, 0, 1, f(Yes, false, "Ŵ")},
- {0x175, 0, 0, 1, f(Yes, false, "ŵ")},
- {0x176, 0, 0, 1, f(Yes, false, "Ŷ")},
- {0x177, 0, 0, 1, f(Yes, false, "ŷ")},
- {0x178, 0, 0, 1, f(Yes, false, "Ÿ")},
- {0x179, 0, 0, 1, f(Yes, false, "Ź")},
- {0x17a, 0, 0, 1, f(Yes, false, "ź")},
- {0x17b, 0, 0, 1, f(Yes, false, "Ż")},
- {0x17c, 0, 0, 1, f(Yes, false, "ż")},
- {0x17d, 0, 0, 1, f(Yes, false, "Ž")},
- {0x17e, 0, 0, 1, f(Yes, false, "ž")},
- {0x17f, 0, 0, 0, g(Yes, No, true, false, "", "s")},
- {0x180, 0, 0, 0, f(Yes, false, "")},
- {0x1a0, 0, 0, 1, f(Yes, true, "Ơ")},
- {0x1a1, 0, 0, 1, f(Yes, true, "ơ")},
- {0x1a2, 0, 0, 0, f(Yes, false, "")},
- {0x1af, 0, 0, 1, f(Yes, true, "Ư")},
- {0x1b0, 0, 0, 1, f(Yes, true, "ư")},
- {0x1b1, 0, 0, 0, f(Yes, false, "")},
- {0x1b7, 0, 0, 0, f(Yes, true, "")},
- {0x1b8, 0, 0, 0, f(Yes, false, "")},
- {0x1c4, 0, 0, 1, g(Yes, No, false, false, "", "DŽ")},
- {0x1c5, 0, 0, 1, g(Yes, No, false, false, "", "Dž")},
- {0x1c6, 0, 0, 1, g(Yes, No, false, false, "", "dž")},
- {0x1c7, 0, 0, 0, g(Yes, No, false, false, "", "LJ")},
- {0x1c8, 0, 0, 0, g(Yes, No, false, false, "", "Lj")},
- {0x1c9, 0, 0, 0, g(Yes, No, false, false, "", "lj")},
- {0x1ca, 0, 0, 0, g(Yes, No, false, false, "", "NJ")},
- {0x1cb, 0, 0, 0, g(Yes, No, false, false, "", "Nj")},
- {0x1cc, 0, 0, 0, g(Yes, No, false, false, "", "nj")},
- {0x1cd, 0, 0, 1, f(Yes, false, "Ǎ")},
- {0x1ce, 0, 0, 1, f(Yes, false, "ǎ")},
- {0x1cf, 0, 0, 1, f(Yes, false, "Ǐ")},
- {0x1d0, 0, 0, 1, f(Yes, false, "ǐ")},
- {0x1d1, 0, 0, 1, f(Yes, false, "Ǒ")},
- {0x1d2, 0, 0, 1, f(Yes, false, "ǒ")},
- {0x1d3, 0, 0, 1, f(Yes, false, "Ǔ")},
- {0x1d4, 0, 0, 1, f(Yes, false, "ǔ")},
- {0x1d5, 0, 0, 2, f(Yes, false, "Ǖ")},
- {0x1d6, 0, 0, 2, f(Yes, false, "ǖ")},
- {0x1d7, 0, 0, 2, f(Yes, false, "Ǘ")},
- {0x1d8, 0, 0, 2, f(Yes, false, "ǘ")},
- {0x1d9, 0, 0, 2, f(Yes, false, "Ǚ")},
- {0x1da, 0, 0, 2, f(Yes, false, "ǚ")},
- {0x1db, 0, 0, 2, f(Yes, false, "Ǜ")},
- {0x1dc, 0, 0, 2, f(Yes, false, "ǜ")},
- {0x1dd, 0, 0, 0, f(Yes, false, "")},
- {0x1de, 0, 0, 2, f(Yes, false, "Ǟ")},
- {0x1df, 0, 0, 2, f(Yes, false, "ǟ")},
- {0x1e0, 0, 0, 2, f(Yes, false, "Ǡ")},
- {0x1e1, 0, 0, 2, f(Yes, false, "ǡ")},
- {0x1e2, 0, 0, 1, f(Yes, false, "Ǣ")},
- {0x1e3, 0, 0, 1, f(Yes, false, "ǣ")},
- {0x1e4, 0, 0, 0, f(Yes, false, "")},
- {0x1e6, 0, 0, 1, f(Yes, false, "Ǧ")},
- {0x1e7, 0, 0, 1, f(Yes, false, "ǧ")},
- {0x1e8, 0, 0, 1, f(Yes, false, "Ǩ")},
- {0x1e9, 0, 0, 1, f(Yes, false, "ǩ")},
- {0x1ea, 0, 0, 1, f(Yes, true, "Ǫ")},
- {0x1eb, 0, 0, 1, f(Yes, true, "ǫ")},
- {0x1ec, 0, 0, 2, f(Yes, false, "Ǭ")},
- {0x1ed, 0, 0, 2, f(Yes, false, "ǭ")},
- {0x1ee, 0, 0, 1, f(Yes, false, "Ǯ")},
- {0x1ef, 0, 0, 1, f(Yes, false, "ǯ")},
- {0x1f0, 0, 0, 1, f(Yes, false, "ǰ")},
- {0x1f1, 0, 0, 0, g(Yes, No, false, false, "", "DZ")},
- {0x1f2, 0, 0, 0, g(Yes, No, false, false, "", "Dz")},
- {0x1f3, 0, 0, 0, g(Yes, No, false, false, "", "dz")},
- {0x1f4, 0, 0, 1, f(Yes, false, "Ǵ")},
- {0x1f5, 0, 0, 1, f(Yes, false, "ǵ")},
- {0x1f6, 0, 0, 0, f(Yes, false, "")},
- {0x1f8, 0, 0, 1, f(Yes, false, "Ǹ")},
- {0x1f9, 0, 0, 1, f(Yes, false, "ǹ")},
- {0x1fa, 0, 0, 2, f(Yes, false, "Ǻ")},
- {0x1fb, 0, 0, 2, f(Yes, false, "ǻ")},
- {0x1fc, 0, 0, 1, f(Yes, false, "Ǽ")},
- {0x1fd, 0, 0, 1, f(Yes, false, "ǽ")},
- {0x1fe, 0, 0, 1, f(Yes, false, "Ǿ")},
- {0x1ff, 0, 0, 1, f(Yes, false, "ǿ")},
- {0x200, 0, 0, 1, f(Yes, false, "Ȁ")},
- {0x201, 0, 0, 1, f(Yes, false, "ȁ")},
- {0x202, 0, 0, 1, f(Yes, false, "Ȃ")},
- {0x203, 0, 0, 1, f(Yes, false, "ȃ")},
- {0x204, 0, 0, 1, f(Yes, false, "Ȅ")},
- {0x205, 0, 0, 1, f(Yes, false, "ȅ")},
- {0x206, 0, 0, 1, f(Yes, false, "Ȇ")},
- {0x207, 0, 0, 1, f(Yes, false, "ȇ")},
- {0x208, 0, 0, 1, f(Yes, false, "Ȉ")},
- {0x209, 0, 0, 1, f(Yes, false, "ȉ")},
- {0x20a, 0, 0, 1, f(Yes, false, "Ȋ")},
- {0x20b, 0, 0, 1, f(Yes, false, "ȋ")},
- {0x20c, 0, 0, 1, f(Yes, false, "Ȍ")},
- {0x20d, 0, 0, 1, f(Yes, false, "ȍ")},
- {0x20e, 0, 0, 1, f(Yes, false, "Ȏ")},
- {0x20f, 0, 0, 1, f(Yes, false, "ȏ")},
- {0x210, 0, 0, 1, f(Yes, false, "Ȑ")},
- {0x211, 0, 0, 1, f(Yes, false, "ȑ")},
- {0x212, 0, 0, 1, f(Yes, false, "Ȓ")},
- {0x213, 0, 0, 1, f(Yes, false, "ȓ")},
- {0x214, 0, 0, 1, f(Yes, false, "Ȕ")},
- {0x215, 0, 0, 1, f(Yes, false, "ȕ")},
- {0x216, 0, 0, 1, f(Yes, false, "Ȗ")},
- {0x217, 0, 0, 1, f(Yes, false, "ȗ")},
- {0x218, 0, 0, 1, f(Yes, false, "Ș")},
- {0x219, 0, 0, 1, f(Yes, false, "ș")},
- {0x21a, 0, 0, 1, f(Yes, false, "Ț")},
- {0x21b, 0, 0, 1, f(Yes, false, "ț")},
- {0x21c, 0, 0, 0, f(Yes, false, "")},
- {0x21e, 0, 0, 1, f(Yes, false, "Ȟ")},
- {0x21f, 0, 0, 1, f(Yes, false, "ȟ")},
- {0x220, 0, 0, 0, f(Yes, false, "")},
- {0x226, 0, 0, 1, f(Yes, true, "Ȧ")},
- {0x227, 0, 0, 1, f(Yes, true, "ȧ")},
- {0x228, 0, 0, 1, f(Yes, true, "Ȩ")},
- {0x229, 0, 0, 1, f(Yes, true, "ȩ")},
- {0x22a, 0, 0, 2, f(Yes, false, "Ȫ")},
- {0x22b, 0, 0, 2, f(Yes, false, "ȫ")},
- {0x22c, 0, 0, 2, f(Yes, false, "Ȭ")},
- {0x22d, 0, 0, 2, f(Yes, false, "ȭ")},
- {0x22e, 0, 0, 1, f(Yes, true, "Ȯ")},
- {0x22f, 0, 0, 1, f(Yes, true, "ȯ")},
- {0x230, 0, 0, 2, f(Yes, false, "Ȱ")},
- {0x231, 0, 0, 2, f(Yes, false, "ȱ")},
- {0x232, 0, 0, 1, f(Yes, false, "Ȳ")},
- {0x233, 0, 0, 1, f(Yes, false, "ȳ")},
- {0x234, 0, 0, 0, f(Yes, false, "")},
- {0x292, 0, 0, 0, f(Yes, true, "")},
- {0x293, 0, 0, 0, f(Yes, false, "")},
- {0x2b0, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x2b1, 0, 0, 0, g(Yes, No, false, false, "", "ɦ")},
- {0x2b2, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x2b3, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x2b4, 0, 0, 0, g(Yes, No, false, false, "", "ɹ")},
- {0x2b5, 0, 0, 0, g(Yes, No, false, false, "", "ɻ")},
- {0x2b6, 0, 0, 0, g(Yes, No, false, false, "", "ʁ")},
- {0x2b7, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x2b8, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x2b9, 0, 0, 0, f(Yes, false, "")},
- {0x2d8, 0, 0, 1, g(Yes, No, false, false, "", " ̆")},
- {0x2d9, 0, 0, 1, g(Yes, No, false, false, "", " ̇")},
- {0x2da, 0, 0, 1, g(Yes, No, false, false, "", " ̊")},
- {0x2db, 0, 0, 1, g(Yes, No, false, false, "", " ̨")},
- {0x2dc, 0, 0, 1, g(Yes, No, false, false, "", " ̃")},
- {0x2dd, 0, 0, 1, g(Yes, No, false, false, "", " ̋")},
- {0x2de, 0, 0, 0, f(Yes, false, "")},
- {0x2e0, 0, 0, 0, g(Yes, No, false, false, "", "ɣ")},
- {0x2e1, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x2e2, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x2e3, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x2e4, 0, 0, 0, g(Yes, No, false, false, "", "ʕ")},
- {0x2e5, 0, 0, 0, f(Yes, false, "")},
- {0x300, 230, 1, 1, f(Maybe, false, "")},
- {0x305, 230, 1, 1, f(Yes, false, "")},
- {0x306, 230, 1, 1, f(Maybe, false, "")},
- {0x30d, 230, 1, 1, f(Yes, false, "")},
- {0x30f, 230, 1, 1, f(Maybe, false, "")},
- {0x310, 230, 1, 1, f(Yes, false, "")},
- {0x311, 230, 1, 1, f(Maybe, false, "")},
- {0x312, 230, 1, 1, f(Yes, false, "")},
- {0x313, 230, 1, 1, f(Maybe, false, "")},
- {0x315, 232, 1, 1, f(Yes, false, "")},
- {0x316, 220, 1, 1, f(Yes, false, "")},
- {0x31a, 232, 1, 1, f(Yes, false, "")},
- {0x31b, 216, 1, 1, f(Maybe, false, "")},
- {0x31c, 220, 1, 1, f(Yes, false, "")},
- {0x321, 202, 1, 1, f(Yes, false, "")},
- {0x323, 220, 1, 1, f(Maybe, false, "")},
- {0x327, 202, 1, 1, f(Maybe, false, "")},
- {0x329, 220, 1, 1, f(Yes, false, "")},
- {0x32d, 220, 1, 1, f(Maybe, false, "")},
- {0x32f, 220, 1, 1, f(Yes, false, "")},
- {0x330, 220, 1, 1, f(Maybe, false, "")},
- {0x332, 220, 1, 1, f(Yes, false, "")},
- {0x334, 1, 1, 1, f(Yes, false, "")},
- {0x338, 1, 1, 1, f(Maybe, false, "")},
- {0x339, 220, 1, 1, f(Yes, false, "")},
- {0x33d, 230, 1, 1, f(Yes, false, "")},
- {0x340, 230, 1, 1, f(No, false, "̀")},
- {0x341, 230, 1, 1, f(No, false, "́")},
- {0x342, 230, 1, 1, f(Maybe, false, "")},
- {0x343, 230, 1, 1, f(No, false, "̓")},
- {0x344, 230, 2, 2, f(No, false, "̈́")},
- {0x345, 240, 1, 1, f(Maybe, false, "")},
- {0x346, 230, 1, 1, f(Yes, false, "")},
- {0x347, 220, 1, 1, f(Yes, false, "")},
- {0x34a, 230, 1, 1, f(Yes, false, "")},
- {0x34d, 220, 1, 1, f(Yes, false, "")},
- {0x34f, 0, 0, 0, f(Yes, false, "")},
- {0x350, 230, 1, 1, f(Yes, false, "")},
- {0x353, 220, 1, 1, f(Yes, false, "")},
- {0x357, 230, 1, 1, f(Yes, false, "")},
- {0x358, 232, 1, 1, f(Yes, false, "")},
- {0x359, 220, 1, 1, f(Yes, false, "")},
- {0x35b, 230, 1, 1, f(Yes, false, "")},
- {0x35c, 233, 1, 1, f(Yes, false, "")},
- {0x35d, 234, 1, 1, f(Yes, false, "")},
- {0x35f, 233, 1, 1, f(Yes, false, "")},
- {0x360, 234, 1, 1, f(Yes, false, "")},
- {0x362, 233, 1, 1, f(Yes, false, "")},
- {0x363, 230, 1, 1, f(Yes, false, "")},
- {0x370, 0, 0, 0, f(Yes, false, "")},
- {0x374, 0, 0, 0, f(No, false, "ʹ")},
- {0x375, 0, 0, 0, f(Yes, false, "")},
- {0x37a, 0, 0, 1, g(Yes, No, false, false, "", " ͅ")},
- {0x37b, 0, 0, 0, f(Yes, false, "")},
- {0x37e, 0, 0, 0, f(No, false, ";")},
- {0x37f, 0, 0, 0, f(Yes, false, "")},
- {0x384, 0, 0, 1, g(Yes, No, false, false, "", " ́")},
- {0x385, 0, 0, 2, g(Yes, No, false, false, "΅", " ̈́")},
- {0x386, 0, 0, 1, f(Yes, false, "Ά")},
- {0x387, 0, 0, 0, f(No, false, "·")},
- {0x388, 0, 0, 1, f(Yes, false, "Έ")},
- {0x389, 0, 0, 1, f(Yes, false, "Ή")},
- {0x38a, 0, 0, 1, f(Yes, false, "Ί")},
- {0x38b, 0, 0, 0, f(Yes, false, "")},
- {0x38c, 0, 0, 1, f(Yes, false, "Ό")},
- {0x38d, 0, 0, 0, f(Yes, false, "")},
- {0x38e, 0, 0, 1, f(Yes, false, "Ύ")},
- {0x38f, 0, 0, 1, f(Yes, false, "Ώ")},
- {0x390, 0, 0, 2, f(Yes, false, "ΐ")},
- {0x391, 0, 0, 0, f(Yes, true, "")},
- {0x392, 0, 0, 0, f(Yes, false, "")},
- {0x395, 0, 0, 0, f(Yes, true, "")},
- {0x396, 0, 0, 0, f(Yes, false, "")},
- {0x397, 0, 0, 0, f(Yes, true, "")},
- {0x398, 0, 0, 0, f(Yes, false, "")},
- {0x399, 0, 0, 0, f(Yes, true, "")},
- {0x39a, 0, 0, 0, f(Yes, false, "")},
- {0x39f, 0, 0, 0, f(Yes, true, "")},
- {0x3a0, 0, 0, 0, f(Yes, false, "")},
- {0x3a1, 0, 0, 0, f(Yes, true, "")},
- {0x3a2, 0, 0, 0, f(Yes, false, "")},
- {0x3a5, 0, 0, 0, f(Yes, true, "")},
- {0x3a6, 0, 0, 0, f(Yes, false, "")},
- {0x3a9, 0, 0, 0, f(Yes, true, "")},
- {0x3aa, 0, 0, 1, f(Yes, false, "Ϊ")},
- {0x3ab, 0, 0, 1, f(Yes, false, "Ϋ")},
- {0x3ac, 0, 0, 1, f(Yes, true, "ά")},
- {0x3ad, 0, 0, 1, f(Yes, false, "έ")},
- {0x3ae, 0, 0, 1, f(Yes, true, "ή")},
- {0x3af, 0, 0, 1, f(Yes, false, "ί")},
- {0x3b0, 0, 0, 2, f(Yes, false, "ΰ")},
- {0x3b1, 0, 0, 0, f(Yes, true, "")},
- {0x3b2, 0, 0, 0, f(Yes, false, "")},
- {0x3b5, 0, 0, 0, f(Yes, true, "")},
- {0x3b6, 0, 0, 0, f(Yes, false, "")},
- {0x3b7, 0, 0, 0, f(Yes, true, "")},
- {0x3b8, 0, 0, 0, f(Yes, false, "")},
- {0x3b9, 0, 0, 0, f(Yes, true, "")},
- {0x3ba, 0, 0, 0, f(Yes, false, "")},
- {0x3bf, 0, 0, 0, f(Yes, true, "")},
- {0x3c0, 0, 0, 0, f(Yes, false, "")},
- {0x3c1, 0, 0, 0, f(Yes, true, "")},
- {0x3c2, 0, 0, 0, f(Yes, false, "")},
- {0x3c5, 0, 0, 0, f(Yes, true, "")},
- {0x3c6, 0, 0, 0, f(Yes, false, "")},
- {0x3c9, 0, 0, 0, f(Yes, true, "")},
- {0x3ca, 0, 0, 1, f(Yes, true, "ϊ")},
- {0x3cb, 0, 0, 1, f(Yes, true, "ϋ")},
- {0x3cc, 0, 0, 1, f(Yes, false, "ό")},
- {0x3cd, 0, 0, 1, f(Yes, false, "ύ")},
- {0x3ce, 0, 0, 1, f(Yes, true, "ώ")},
- {0x3cf, 0, 0, 0, f(Yes, false, "")},
- {0x3d0, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x3d1, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x3d2, 0, 0, 0, g(Yes, No, true, false, "", "Υ")},
- {0x3d3, 0, 0, 1, g(Yes, No, false, false, "ϓ", "Ύ")},
- {0x3d4, 0, 0, 1, g(Yes, No, false, false, "ϔ", "Ϋ")},
- {0x3d5, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x3d6, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x3d7, 0, 0, 0, f(Yes, false, "")},
- {0x3f0, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x3f1, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x3f2, 0, 0, 0, g(Yes, No, false, false, "", "ς")},
- {0x3f3, 0, 0, 0, f(Yes, false, "")},
- {0x3f4, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x3f5, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x3f6, 0, 0, 0, f(Yes, false, "")},
- {0x3f9, 0, 0, 0, g(Yes, No, false, false, "", "Σ")},
- {0x3fa, 0, 0, 0, f(Yes, false, "")},
- {0x400, 0, 0, 1, f(Yes, false, "Ѐ")},
- {0x401, 0, 0, 1, f(Yes, false, "Ё")},
- {0x402, 0, 0, 0, f(Yes, false, "")},
- {0x403, 0, 0, 1, f(Yes, false, "Ѓ")},
- {0x404, 0, 0, 0, f(Yes, false, "")},
- {0x406, 0, 0, 0, f(Yes, true, "")},
- {0x407, 0, 0, 1, f(Yes, false, "Ї")},
- {0x408, 0, 0, 0, f(Yes, false, "")},
- {0x40c, 0, 0, 1, f(Yes, false, "Ќ")},
- {0x40d, 0, 0, 1, f(Yes, false, "Ѝ")},
- {0x40e, 0, 0, 1, f(Yes, false, "Ў")},
- {0x40f, 0, 0, 0, f(Yes, false, "")},
- {0x410, 0, 0, 0, f(Yes, true, "")},
- {0x411, 0, 0, 0, f(Yes, false, "")},
- {0x413, 0, 0, 0, f(Yes, true, "")},
- {0x414, 0, 0, 0, f(Yes, false, "")},
- {0x415, 0, 0, 0, f(Yes, true, "")},
- {0x419, 0, 0, 1, f(Yes, false, "Й")},
- {0x41a, 0, 0, 0, f(Yes, true, "")},
- {0x41b, 0, 0, 0, f(Yes, false, "")},
- {0x41e, 0, 0, 0, f(Yes, true, "")},
- {0x41f, 0, 0, 0, f(Yes, false, "")},
- {0x423, 0, 0, 0, f(Yes, true, "")},
- {0x424, 0, 0, 0, f(Yes, false, "")},
- {0x427, 0, 0, 0, f(Yes, true, "")},
- {0x428, 0, 0, 0, f(Yes, false, "")},
- {0x42b, 0, 0, 0, f(Yes, true, "")},
- {0x42c, 0, 0, 0, f(Yes, false, "")},
- {0x42d, 0, 0, 0, f(Yes, true, "")},
- {0x42e, 0, 0, 0, f(Yes, false, "")},
- {0x430, 0, 0, 0, f(Yes, true, "")},
- {0x431, 0, 0, 0, f(Yes, false, "")},
- {0x433, 0, 0, 0, f(Yes, true, "")},
- {0x434, 0, 0, 0, f(Yes, false, "")},
- {0x435, 0, 0, 0, f(Yes, true, "")},
- {0x439, 0, 0, 1, f(Yes, false, "й")},
- {0x43a, 0, 0, 0, f(Yes, true, "")},
- {0x43b, 0, 0, 0, f(Yes, false, "")},
- {0x43e, 0, 0, 0, f(Yes, true, "")},
- {0x43f, 0, 0, 0, f(Yes, false, "")},
- {0x443, 0, 0, 0, f(Yes, true, "")},
- {0x444, 0, 0, 0, f(Yes, false, "")},
- {0x447, 0, 0, 0, f(Yes, true, "")},
- {0x448, 0, 0, 0, f(Yes, false, "")},
- {0x44b, 0, 0, 0, f(Yes, true, "")},
- {0x44c, 0, 0, 0, f(Yes, false, "")},
- {0x44d, 0, 0, 0, f(Yes, true, "")},
- {0x44e, 0, 0, 0, f(Yes, false, "")},
- {0x450, 0, 0, 1, f(Yes, false, "ѐ")},
- {0x451, 0, 0, 1, f(Yes, false, "ё")},
- {0x452, 0, 0, 0, f(Yes, false, "")},
- {0x453, 0, 0, 1, f(Yes, false, "ѓ")},
- {0x454, 0, 0, 0, f(Yes, false, "")},
- {0x456, 0, 0, 0, f(Yes, true, "")},
- {0x457, 0, 0, 1, f(Yes, false, "ї")},
- {0x458, 0, 0, 0, f(Yes, false, "")},
- {0x45c, 0, 0, 1, f(Yes, false, "ќ")},
- {0x45d, 0, 0, 1, f(Yes, false, "ѝ")},
- {0x45e, 0, 0, 1, f(Yes, false, "ў")},
- {0x45f, 0, 0, 0, f(Yes, false, "")},
- {0x474, 0, 0, 0, f(Yes, true, "")},
- {0x476, 0, 0, 1, f(Yes, false, "Ѷ")},
- {0x477, 0, 0, 1, f(Yes, false, "ѷ")},
- {0x478, 0, 0, 0, f(Yes, false, "")},
- {0x483, 230, 1, 1, f(Yes, false, "")},
- {0x488, 0, 0, 0, f(Yes, false, "")},
- {0x4c1, 0, 0, 1, f(Yes, false, "Ӂ")},
- {0x4c2, 0, 0, 1, f(Yes, false, "ӂ")},
- {0x4c3, 0, 0, 0, f(Yes, false, "")},
- {0x4d0, 0, 0, 1, f(Yes, false, "Ӑ")},
- {0x4d1, 0, 0, 1, f(Yes, false, "ӑ")},
- {0x4d2, 0, 0, 1, f(Yes, false, "Ӓ")},
- {0x4d3, 0, 0, 1, f(Yes, false, "ӓ")},
- {0x4d4, 0, 0, 0, f(Yes, false, "")},
- {0x4d6, 0, 0, 1, f(Yes, false, "Ӗ")},
- {0x4d7, 0, 0, 1, f(Yes, false, "ӗ")},
- {0x4d8, 0, 0, 0, f(Yes, true, "")},
- {0x4da, 0, 0, 1, f(Yes, false, "Ӛ")},
- {0x4db, 0, 0, 1, f(Yes, false, "ӛ")},
- {0x4dc, 0, 0, 1, f(Yes, false, "Ӝ")},
- {0x4dd, 0, 0, 1, f(Yes, false, "ӝ")},
- {0x4de, 0, 0, 1, f(Yes, false, "Ӟ")},
- {0x4df, 0, 0, 1, f(Yes, false, "ӟ")},
- {0x4e0, 0, 0, 0, f(Yes, false, "")},
- {0x4e2, 0, 0, 1, f(Yes, false, "Ӣ")},
- {0x4e3, 0, 0, 1, f(Yes, false, "ӣ")},
- {0x4e4, 0, 0, 1, f(Yes, false, "Ӥ")},
- {0x4e5, 0, 0, 1, f(Yes, false, "ӥ")},
- {0x4e6, 0, 0, 1, f(Yes, false, "Ӧ")},
- {0x4e7, 0, 0, 1, f(Yes, false, "ӧ")},
- {0x4e8, 0, 0, 0, f(Yes, true, "")},
- {0x4ea, 0, 0, 1, f(Yes, false, "Ӫ")},
- {0x4eb, 0, 0, 1, f(Yes, false, "ӫ")},
- {0x4ec, 0, 0, 1, f(Yes, false, "Ӭ")},
- {0x4ed, 0, 0, 1, f(Yes, false, "ӭ")},
- {0x4ee, 0, 0, 1, f(Yes, false, "Ӯ")},
- {0x4ef, 0, 0, 1, f(Yes, false, "ӯ")},
- {0x4f0, 0, 0, 1, f(Yes, false, "Ӱ")},
- {0x4f1, 0, 0, 1, f(Yes, false, "ӱ")},
- {0x4f2, 0, 0, 1, f(Yes, false, "Ӳ")},
- {0x4f3, 0, 0, 1, f(Yes, false, "ӳ")},
- {0x4f4, 0, 0, 1, f(Yes, false, "Ӵ")},
- {0x4f5, 0, 0, 1, f(Yes, false, "ӵ")},
- {0x4f6, 0, 0, 0, f(Yes, false, "")},
- {0x4f8, 0, 0, 1, f(Yes, false, "Ӹ")},
- {0x4f9, 0, 0, 1, f(Yes, false, "ӹ")},
- {0x4fa, 0, 0, 0, f(Yes, false, "")},
- {0x587, 0, 0, 0, g(Yes, No, false, false, "", "եւ")},
- {0x588, 0, 0, 0, f(Yes, false, "")},
- {0x591, 220, 1, 1, f(Yes, false, "")},
- {0x592, 230, 1, 1, f(Yes, false, "")},
- {0x596, 220, 1, 1, f(Yes, false, "")},
- {0x597, 230, 1, 1, f(Yes, false, "")},
- {0x59a, 222, 1, 1, f(Yes, false, "")},
- {0x59b, 220, 1, 1, f(Yes, false, "")},
- {0x59c, 230, 1, 1, f(Yes, false, "")},
- {0x5a2, 220, 1, 1, f(Yes, false, "")},
- {0x5a8, 230, 1, 1, f(Yes, false, "")},
- {0x5aa, 220, 1, 1, f(Yes, false, "")},
- {0x5ab, 230, 1, 1, f(Yes, false, "")},
- {0x5ad, 222, 1, 1, f(Yes, false, "")},
- {0x5ae, 228, 1, 1, f(Yes, false, "")},
- {0x5af, 230, 1, 1, f(Yes, false, "")},
- {0x5b0, 10, 1, 1, f(Yes, false, "")},
- {0x5b1, 11, 1, 1, f(Yes, false, "")},
- {0x5b2, 12, 1, 1, f(Yes, false, "")},
- {0x5b3, 13, 1, 1, f(Yes, false, "")},
- {0x5b4, 14, 1, 1, f(Yes, false, "")},
- {0x5b5, 15, 1, 1, f(Yes, false, "")},
- {0x5b6, 16, 1, 1, f(Yes, false, "")},
- {0x5b7, 17, 1, 1, f(Yes, false, "")},
- {0x5b8, 18, 1, 1, f(Yes, false, "")},
- {0x5b9, 19, 1, 1, f(Yes, false, "")},
- {0x5bb, 20, 1, 1, f(Yes, false, "")},
- {0x5bc, 21, 1, 1, f(Yes, false, "")},
- {0x5bd, 22, 1, 1, f(Yes, false, "")},
- {0x5be, 0, 0, 0, f(Yes, false, "")},
- {0x5bf, 23, 1, 1, f(Yes, false, "")},
- {0x5c0, 0, 0, 0, f(Yes, false, "")},
- {0x5c1, 24, 1, 1, f(Yes, false, "")},
- {0x5c2, 25, 1, 1, f(Yes, false, "")},
- {0x5c3, 0, 0, 0, f(Yes, false, "")},
- {0x5c4, 230, 1, 1, f(Yes, false, "")},
- {0x5c5, 220, 1, 1, f(Yes, false, "")},
- {0x5c6, 0, 0, 0, f(Yes, false, "")},
- {0x5c7, 18, 1, 1, f(Yes, false, "")},
- {0x5c8, 0, 0, 0, f(Yes, false, "")},
- {0x610, 230, 1, 1, f(Yes, false, "")},
- {0x618, 30, 1, 1, f(Yes, false, "")},
- {0x619, 31, 1, 1, f(Yes, false, "")},
- {0x61a, 32, 1, 1, f(Yes, false, "")},
- {0x61b, 0, 0, 0, f(Yes, false, "")},
- {0x622, 0, 0, 1, f(Yes, false, "آ")},
- {0x623, 0, 0, 1, f(Yes, false, "أ")},
- {0x624, 0, 0, 1, f(Yes, false, "ؤ")},
- {0x625, 0, 0, 1, f(Yes, false, "إ")},
- {0x626, 0, 0, 1, f(Yes, false, "ئ")},
- {0x627, 0, 0, 0, f(Yes, true, "")},
- {0x628, 0, 0, 0, f(Yes, false, "")},
- {0x648, 0, 0, 0, f(Yes, true, "")},
- {0x649, 0, 0, 0, f(Yes, false, "")},
- {0x64a, 0, 0, 0, f(Yes, true, "")},
- {0x64b, 27, 1, 1, f(Yes, false, "")},
- {0x64c, 28, 1, 1, f(Yes, false, "")},
- {0x64d, 29, 1, 1, f(Yes, false, "")},
- {0x64e, 30, 1, 1, f(Yes, false, "")},
- {0x64f, 31, 1, 1, f(Yes, false, "")},
- {0x650, 32, 1, 1, f(Yes, false, "")},
- {0x651, 33, 1, 1, f(Yes, false, "")},
- {0x652, 34, 1, 1, f(Yes, false, "")},
- {0x653, 230, 1, 1, f(Maybe, false, "")},
- {0x655, 220, 1, 1, f(Maybe, false, "")},
- {0x656, 220, 1, 1, f(Yes, false, "")},
- {0x657, 230, 1, 1, f(Yes, false, "")},
- {0x65c, 220, 1, 1, f(Yes, false, "")},
- {0x65d, 230, 1, 1, f(Yes, false, "")},
- {0x65f, 220, 1, 1, f(Yes, false, "")},
- {0x660, 0, 0, 0, f(Yes, false, "")},
- {0x670, 35, 1, 1, f(Yes, false, "")},
- {0x671, 0, 0, 0, f(Yes, false, "")},
- {0x675, 0, 0, 0, g(Yes, No, false, false, "", "اٴ")},
- {0x676, 0, 0, 0, g(Yes, No, false, false, "", "وٴ")},
- {0x677, 0, 0, 0, g(Yes, No, false, false, "", "ۇٴ")},
- {0x678, 0, 0, 0, g(Yes, No, false, false, "", "يٴ")},
- {0x679, 0, 0, 0, f(Yes, false, "")},
- {0x6c0, 0, 0, 1, f(Yes, false, "ۀ")},
- {0x6c1, 0, 0, 0, f(Yes, true, "")},
- {0x6c2, 0, 0, 1, f(Yes, false, "ۂ")},
- {0x6c3, 0, 0, 0, f(Yes, false, "")},
- {0x6d2, 0, 0, 0, f(Yes, true, "")},
- {0x6d3, 0, 0, 1, f(Yes, false, "ۓ")},
- {0x6d4, 0, 0, 0, f(Yes, false, "")},
- {0x6d5, 0, 0, 0, f(Yes, true, "")},
- {0x6d6, 230, 1, 1, f(Yes, false, "")},
- {0x6dd, 0, 0, 0, f(Yes, false, "")},
- {0x6df, 230, 1, 1, f(Yes, false, "")},
- {0x6e3, 220, 1, 1, f(Yes, false, "")},
- {0x6e4, 230, 1, 1, f(Yes, false, "")},
- {0x6e5, 0, 0, 0, f(Yes, false, "")},
- {0x6e7, 230, 1, 1, f(Yes, false, "")},
- {0x6e9, 0, 0, 0, f(Yes, false, "")},
- {0x6ea, 220, 1, 1, f(Yes, false, "")},
- {0x6eb, 230, 1, 1, f(Yes, false, "")},
- {0x6ed, 220, 1, 1, f(Yes, false, "")},
- {0x6ee, 0, 0, 0, f(Yes, false, "")},
- {0x711, 36, 1, 1, f(Yes, false, "")},
- {0x712, 0, 0, 0, f(Yes, false, "")},
- {0x730, 230, 1, 1, f(Yes, false, "")},
- {0x731, 220, 1, 1, f(Yes, false, "")},
- {0x732, 230, 1, 1, f(Yes, false, "")},
- {0x734, 220, 1, 1, f(Yes, false, "")},
- {0x735, 230, 1, 1, f(Yes, false, "")},
- {0x737, 220, 1, 1, f(Yes, false, "")},
- {0x73a, 230, 1, 1, f(Yes, false, "")},
- {0x73b, 220, 1, 1, f(Yes, false, "")},
- {0x73d, 230, 1, 1, f(Yes, false, "")},
- {0x73e, 220, 1, 1, f(Yes, false, "")},
- {0x73f, 230, 1, 1, f(Yes, false, "")},
- {0x742, 220, 1, 1, f(Yes, false, "")},
- {0x743, 230, 1, 1, f(Yes, false, "")},
- {0x744, 220, 1, 1, f(Yes, false, "")},
- {0x745, 230, 1, 1, f(Yes, false, "")},
- {0x746, 220, 1, 1, f(Yes, false, "")},
- {0x747, 230, 1, 1, f(Yes, false, "")},
- {0x748, 220, 1, 1, f(Yes, false, "")},
- {0x749, 230, 1, 1, f(Yes, false, "")},
- {0x74b, 0, 0, 0, f(Yes, false, "")},
- {0x7eb, 230, 1, 1, f(Yes, false, "")},
- {0x7f2, 220, 1, 1, f(Yes, false, "")},
- {0x7f3, 230, 1, 1, f(Yes, false, "")},
- {0x7f4, 0, 0, 0, f(Yes, false, "")},
- {0x816, 230, 1, 1, f(Yes, false, "")},
- {0x81a, 0, 0, 0, f(Yes, false, "")},
- {0x81b, 230, 1, 1, f(Yes, false, "")},
- {0x824, 0, 0, 0, f(Yes, false, "")},
- {0x825, 230, 1, 1, f(Yes, false, "")},
- {0x828, 0, 0, 0, f(Yes, false, "")},
- {0x829, 230, 1, 1, f(Yes, false, "")},
- {0x82e, 0, 0, 0, f(Yes, false, "")},
- {0x859, 220, 1, 1, f(Yes, false, "")},
- {0x85c, 0, 0, 0, f(Yes, false, "")},
- {0x8d4, 230, 1, 1, f(Yes, false, "")},
- {0x8e2, 0, 0, 0, f(Yes, false, "")},
- {0x8e3, 220, 1, 1, f(Yes, false, "")},
- {0x8e4, 230, 1, 1, f(Yes, false, "")},
- {0x8e6, 220, 1, 1, f(Yes, false, "")},
- {0x8e7, 230, 1, 1, f(Yes, false, "")},
- {0x8e9, 220, 1, 1, f(Yes, false, "")},
- {0x8ea, 230, 1, 1, f(Yes, false, "")},
- {0x8ed, 220, 1, 1, f(Yes, false, "")},
- {0x8f0, 27, 1, 1, f(Yes, false, "")},
- {0x8f1, 28, 1, 1, f(Yes, false, "")},
- {0x8f2, 29, 1, 1, f(Yes, false, "")},
- {0x8f3, 230, 1, 1, f(Yes, false, "")},
- {0x8f6, 220, 1, 1, f(Yes, false, "")},
- {0x8f7, 230, 1, 1, f(Yes, false, "")},
- {0x8f9, 220, 1, 1, f(Yes, false, "")},
- {0x8fb, 230, 1, 1, f(Yes, false, "")},
- {0x900, 0, 0, 0, f(Yes, false, "")},
- {0x928, 0, 0, 0, f(Yes, true, "")},
- {0x929, 0, 0, 1, f(Yes, false, "ऩ")},
- {0x92a, 0, 0, 0, f(Yes, false, "")},
- {0x930, 0, 0, 0, f(Yes, true, "")},
- {0x931, 0, 0, 1, f(Yes, false, "ऱ")},
- {0x932, 0, 0, 0, f(Yes, false, "")},
- {0x933, 0, 0, 0, f(Yes, true, "")},
- {0x934, 0, 0, 1, f(Yes, false, "ऴ")},
- {0x935, 0, 0, 0, f(Yes, false, "")},
- {0x93c, 7, 1, 1, f(Maybe, false, "")},
- {0x93d, 0, 0, 0, f(Yes, false, "")},
- {0x94d, 9, 1, 1, f(Yes, false, "")},
- {0x94e, 0, 0, 0, f(Yes, false, "")},
- {0x951, 230, 1, 1, f(Yes, false, "")},
- {0x952, 220, 1, 1, f(Yes, false, "")},
- {0x953, 230, 1, 1, f(Yes, false, "")},
- {0x955, 0, 0, 0, f(Yes, false, "")},
- {0x958, 0, 0, 1, f(No, false, "क़")},
- {0x959, 0, 0, 1, f(No, false, "ख़")},
- {0x95a, 0, 0, 1, f(No, false, "ग़")},
- {0x95b, 0, 0, 1, f(No, false, "ज़")},
- {0x95c, 0, 0, 1, f(No, false, "ड़")},
- {0x95d, 0, 0, 1, f(No, false, "ढ़")},
- {0x95e, 0, 0, 1, f(No, false, "फ़")},
- {0x95f, 0, 0, 1, f(No, false, "य़")},
- {0x960, 0, 0, 0, f(Yes, false, "")},
- {0x9bc, 7, 1, 1, f(Yes, false, "")},
- {0x9bd, 0, 0, 0, f(Yes, false, "")},
- {0x9be, 0, 1, 1, f(Maybe, false, "")},
- {0x9bf, 0, 0, 0, f(Yes, false, "")},
- {0x9c7, 0, 0, 0, f(Yes, true, "")},
- {0x9c8, 0, 0, 0, f(Yes, false, "")},
- {0x9cb, 0, 0, 1, f(Yes, false, "ো")},
- {0x9cc, 0, 0, 1, f(Yes, false, "ৌ")},
- {0x9cd, 9, 1, 1, f(Yes, false, "")},
- {0x9ce, 0, 0, 0, f(Yes, false, "")},
- {0x9d7, 0, 1, 1, f(Maybe, false, "")},
- {0x9d8, 0, 0, 0, f(Yes, false, "")},
- {0x9dc, 0, 0, 1, f(No, false, "ড়")},
- {0x9dd, 0, 0, 1, f(No, false, "ঢ়")},
- {0x9de, 0, 0, 0, f(Yes, false, "")},
- {0x9df, 0, 0, 1, f(No, false, "য়")},
- {0x9e0, 0, 0, 0, f(Yes, false, "")},
- {0xa33, 0, 0, 1, f(No, false, "ਲ਼")},
- {0xa34, 0, 0, 0, f(Yes, false, "")},
- {0xa36, 0, 0, 1, f(No, false, "ਸ਼")},
- {0xa37, 0, 0, 0, f(Yes, false, "")},
- {0xa3c, 7, 1, 1, f(Yes, false, "")},
- {0xa3d, 0, 0, 0, f(Yes, false, "")},
- {0xa4d, 9, 1, 1, f(Yes, false, "")},
- {0xa4e, 0, 0, 0, f(Yes, false, "")},
- {0xa59, 0, 0, 1, f(No, false, "ਖ਼")},
- {0xa5a, 0, 0, 1, f(No, false, "ਗ਼")},
- {0xa5b, 0, 0, 1, f(No, false, "ਜ਼")},
- {0xa5c, 0, 0, 0, f(Yes, false, "")},
- {0xa5e, 0, 0, 1, f(No, false, "ਫ਼")},
- {0xa5f, 0, 0, 0, f(Yes, false, "")},
- {0xabc, 7, 1, 1, f(Yes, false, "")},
- {0xabd, 0, 0, 0, f(Yes, false, "")},
- {0xacd, 9, 1, 1, f(Yes, false, "")},
- {0xace, 0, 0, 0, f(Yes, false, "")},
- {0xb3c, 7, 1, 1, f(Yes, false, "")},
- {0xb3d, 0, 0, 0, f(Yes, false, "")},
- {0xb3e, 0, 1, 1, f(Maybe, false, "")},
- {0xb3f, 0, 0, 0, f(Yes, false, "")},
- {0xb47, 0, 0, 0, f(Yes, true, "")},
- {0xb48, 0, 0, 1, f(Yes, false, "ୈ")},
- {0xb49, 0, 0, 0, f(Yes, false, "")},
- {0xb4b, 0, 0, 1, f(Yes, false, "ୋ")},
- {0xb4c, 0, 0, 1, f(Yes, false, "ୌ")},
- {0xb4d, 9, 1, 1, f(Yes, false, "")},
- {0xb4e, 0, 0, 0, f(Yes, false, "")},
- {0xb56, 0, 1, 1, f(Maybe, false, "")},
- {0xb58, 0, 0, 0, f(Yes, false, "")},
- {0xb5c, 0, 0, 1, f(No, false, "ଡ଼")},
- {0xb5d, 0, 0, 1, f(No, false, "ଢ଼")},
- {0xb5e, 0, 0, 0, f(Yes, false, "")},
- {0xb92, 0, 0, 0, f(Yes, true, "")},
- {0xb93, 0, 0, 0, f(Yes, false, "")},
- {0xb94, 0, 0, 1, f(Yes, false, "ஔ")},
- {0xb95, 0, 0, 0, f(Yes, false, "")},
- {0xbbe, 0, 1, 1, f(Maybe, false, "")},
- {0xbbf, 0, 0, 0, f(Yes, false, "")},
- {0xbc6, 0, 0, 0, f(Yes, true, "")},
- {0xbc8, 0, 0, 0, f(Yes, false, "")},
- {0xbca, 0, 0, 1, f(Yes, false, "ொ")},
- {0xbcb, 0, 0, 1, f(Yes, false, "ோ")},
- {0xbcc, 0, 0, 1, f(Yes, false, "ௌ")},
- {0xbcd, 9, 1, 1, f(Yes, false, "")},
- {0xbce, 0, 0, 0, f(Yes, false, "")},
- {0xbd7, 0, 1, 1, f(Maybe, false, "")},
- {0xbd8, 0, 0, 0, f(Yes, false, "")},
- {0xc46, 0, 0, 0, f(Yes, true, "")},
- {0xc47, 0, 0, 0, f(Yes, false, "")},
- {0xc48, 0, 0, 1, f(Yes, false, "ై")},
- {0xc49, 0, 0, 0, f(Yes, false, "")},
- {0xc4d, 9, 1, 1, f(Yes, false, "")},
- {0xc4e, 0, 0, 0, f(Yes, false, "")},
- {0xc55, 84, 1, 1, f(Yes, false, "")},
- {0xc56, 91, 1, 1, f(Maybe, false, "")},
- {0xc57, 0, 0, 0, f(Yes, false, "")},
- {0xcbc, 7, 1, 1, f(Yes, false, "")},
- {0xcbd, 0, 0, 0, f(Yes, false, "")},
- {0xcbf, 0, 0, 0, f(Yes, true, "")},
- {0xcc0, 0, 0, 1, f(Yes, false, "ೀ")},
- {0xcc1, 0, 0, 0, f(Yes, false, "")},
- {0xcc2, 0, 1, 1, f(Maybe, false, "")},
- {0xcc3, 0, 0, 0, f(Yes, false, "")},
- {0xcc6, 0, 0, 0, f(Yes, true, "")},
- {0xcc7, 0, 0, 1, f(Yes, false, "ೇ")},
- {0xcc8, 0, 0, 1, f(Yes, false, "ೈ")},
- {0xcc9, 0, 0, 0, f(Yes, false, "")},
- {0xcca, 0, 0, 1, f(Yes, true, "ೊ")},
- {0xccb, 0, 0, 2, f(Yes, false, "ೋ")},
- {0xccc, 0, 0, 0, f(Yes, false, "")},
- {0xccd, 9, 1, 1, f(Yes, false, "")},
- {0xcce, 0, 0, 0, f(Yes, false, "")},
- {0xcd5, 0, 1, 1, f(Maybe, false, "")},
- {0xcd7, 0, 0, 0, f(Yes, false, "")},
- {0xd3e, 0, 1, 1, f(Maybe, false, "")},
- {0xd3f, 0, 0, 0, f(Yes, false, "")},
- {0xd46, 0, 0, 0, f(Yes, true, "")},
- {0xd48, 0, 0, 0, f(Yes, false, "")},
- {0xd4a, 0, 0, 1, f(Yes, false, "ൊ")},
- {0xd4b, 0, 0, 1, f(Yes, false, "ോ")},
- {0xd4c, 0, 0, 1, f(Yes, false, "ൌ")},
- {0xd4d, 9, 1, 1, f(Yes, false, "")},
- {0xd4e, 0, 0, 0, f(Yes, false, "")},
- {0xd57, 0, 1, 1, f(Maybe, false, "")},
- {0xd58, 0, 0, 0, f(Yes, false, "")},
- {0xdca, 9, 1, 1, f(Maybe, false, "")},
- {0xdcb, 0, 0, 0, f(Yes, false, "")},
- {0xdcf, 0, 1, 1, f(Maybe, false, "")},
- {0xdd0, 0, 0, 0, f(Yes, false, "")},
- {0xdd9, 0, 0, 0, f(Yes, true, "")},
- {0xdda, 0, 0, 1, f(Yes, false, "ේ")},
- {0xddb, 0, 0, 0, f(Yes, false, "")},
- {0xddc, 0, 0, 1, f(Yes, true, "ො")},
- {0xddd, 0, 0, 2, f(Yes, false, "ෝ")},
- {0xdde, 0, 0, 1, f(Yes, false, "ෞ")},
- {0xddf, 0, 1, 1, f(Maybe, false, "")},
- {0xde0, 0, 0, 0, f(Yes, false, "")},
- {0xe33, 0, 0, 0, g(Yes, No, false, false, "", "ํา")},
- {0xe34, 0, 0, 0, f(Yes, false, "")},
- {0xe38, 103, 1, 1, f(Yes, false, "")},
- {0xe3a, 9, 1, 1, f(Yes, false, "")},
- {0xe3b, 0, 0, 0, f(Yes, false, "")},
- {0xe48, 107, 1, 1, f(Yes, false, "")},
- {0xe4c, 0, 0, 0, f(Yes, false, "")},
- {0xeb3, 0, 0, 0, g(Yes, No, false, false, "", "ໍາ")},
- {0xeb4, 0, 0, 0, f(Yes, false, "")},
- {0xeb8, 118, 1, 1, f(Yes, false, "")},
- {0xeba, 0, 0, 0, f(Yes, false, "")},
- {0xec8, 122, 1, 1, f(Yes, false, "")},
- {0xecc, 0, 0, 0, f(Yes, false, "")},
- {0xedc, 0, 0, 0, g(Yes, No, false, false, "", "ຫນ")},
- {0xedd, 0, 0, 0, g(Yes, No, false, false, "", "ຫມ")},
- {0xede, 0, 0, 0, f(Yes, false, "")},
- {0xf0c, 0, 0, 0, g(Yes, No, false, false, "", "་")},
- {0xf0d, 0, 0, 0, f(Yes, false, "")},
- {0xf18, 220, 1, 1, f(Yes, false, "")},
- {0xf1a, 0, 0, 0, f(Yes, false, "")},
- {0xf35, 220, 1, 1, f(Yes, false, "")},
- {0xf36, 0, 0, 0, f(Yes, false, "")},
- {0xf37, 220, 1, 1, f(Yes, false, "")},
- {0xf38, 0, 0, 0, f(Yes, false, "")},
- {0xf39, 216, 1, 1, f(Yes, false, "")},
- {0xf3a, 0, 0, 0, f(Yes, false, "")},
- {0xf43, 0, 0, 0, f(No, false, "གྷ")},
- {0xf44, 0, 0, 0, f(Yes, false, "")},
- {0xf4d, 0, 0, 0, f(No, false, "ཌྷ")},
- {0xf4e, 0, 0, 0, f(Yes, false, "")},
- {0xf52, 0, 0, 0, f(No, false, "དྷ")},
- {0xf53, 0, 0, 0, f(Yes, false, "")},
- {0xf57, 0, 0, 0, f(No, false, "བྷ")},
- {0xf58, 0, 0, 0, f(Yes, false, "")},
- {0xf5c, 0, 0, 0, f(No, false, "ཛྷ")},
- {0xf5d, 0, 0, 0, f(Yes, false, "")},
- {0xf69, 0, 0, 0, f(No, false, "ཀྵ")},
- {0xf6a, 0, 0, 0, f(Yes, false, "")},
- {0xf71, 129, 1, 1, f(Yes, false, "")},
- {0xf72, 130, 1, 1, f(Yes, false, "")},
- {0xf73, 0, 2, 2, f(No, false, "ཱི")},
- {0xf74, 132, 1, 1, f(Yes, false, "")},
- {0xf75, 0, 2, 2, f(No, false, "ཱུ")},
- {0xf76, 0, 0, 1, f(No, false, "ྲྀ")},
- {0xf77, 0, 0, 2, g(Yes, No, false, false, "", "ྲཱྀ")},
- {0xf78, 0, 0, 1, f(No, false, "ླྀ")},
- {0xf79, 0, 0, 2, g(Yes, No, false, false, "", "ླཱྀ")},
- {0xf7a, 130, 1, 1, f(Yes, false, "")},
- {0xf7e, 0, 0, 0, f(Yes, false, "")},
- {0xf80, 130, 1, 1, f(Yes, false, "")},
- {0xf81, 0, 2, 2, f(No, false, "ཱྀ")},
- {0xf82, 230, 1, 1, f(Yes, false, "")},
- {0xf84, 9, 1, 1, f(Yes, false, "")},
- {0xf85, 0, 0, 0, f(Yes, false, "")},
- {0xf86, 230, 1, 1, f(Yes, false, "")},
- {0xf88, 0, 0, 0, f(Yes, false, "")},
- {0xf93, 0, 0, 0, f(No, false, "ྒྷ")},
- {0xf94, 0, 0, 0, f(Yes, false, "")},
- {0xf9d, 0, 0, 0, f(No, false, "ྜྷ")},
- {0xf9e, 0, 0, 0, f(Yes, false, "")},
- {0xfa2, 0, 0, 0, f(No, false, "ྡྷ")},
- {0xfa3, 0, 0, 0, f(Yes, false, "")},
- {0xfa7, 0, 0, 0, f(No, false, "ྦྷ")},
- {0xfa8, 0, 0, 0, f(Yes, false, "")},
- {0xfac, 0, 0, 0, f(No, false, "ྫྷ")},
- {0xfad, 0, 0, 0, f(Yes, false, "")},
- {0xfb9, 0, 0, 0, f(No, false, "ྐྵ")},
- {0xfba, 0, 0, 0, f(Yes, false, "")},
- {0xfc6, 220, 1, 1, f(Yes, false, "")},
- {0xfc7, 0, 0, 0, f(Yes, false, "")},
- {0x1025, 0, 0, 0, f(Yes, true, "")},
- {0x1026, 0, 0, 1, f(Yes, false, "ဦ")},
- {0x1027, 0, 0, 0, f(Yes, false, "")},
- {0x102e, 0, 1, 1, f(Maybe, false, "")},
- {0x102f, 0, 0, 0, f(Yes, false, "")},
- {0x1037, 7, 1, 1, f(Yes, false, "")},
- {0x1038, 0, 0, 0, f(Yes, false, "")},
- {0x1039, 9, 1, 1, f(Yes, false, "")},
- {0x103b, 0, 0, 0, f(Yes, false, "")},
- {0x108d, 220, 1, 1, f(Yes, false, "")},
- {0x108e, 0, 0, 0, f(Yes, false, "")},
- {0x10fc, 0, 0, 0, g(Yes, No, false, false, "", "ნ")},
- {0x10fd, 0, 0, 0, f(Yes, false, "")},
- {0x1100, 0, 0, 0, f(Yes, true, "")},
- {0x1113, 0, 0, 0, f(Yes, false, "")},
- {0x1161, 0, 1, 1, f(Maybe, true, "")},
- {0x1176, 0, 0, 0, f(Yes, false, "")},
- {0x11a8, 0, 1, 1, f(Maybe, false, "")},
- {0x11c3, 0, 0, 0, f(Yes, false, "")},
- {0x135d, 230, 1, 1, f(Yes, false, "")},
- {0x1360, 0, 0, 0, f(Yes, false, "")},
- {0x1714, 9, 1, 1, f(Yes, false, "")},
- {0x1715, 0, 0, 0, f(Yes, false, "")},
- {0x1734, 9, 1, 1, f(Yes, false, "")},
- {0x1735, 0, 0, 0, f(Yes, false, "")},
- {0x17d2, 9, 1, 1, f(Yes, false, "")},
- {0x17d3, 0, 0, 0, f(Yes, false, "")},
- {0x17dd, 230, 1, 1, f(Yes, false, "")},
- {0x17de, 0, 0, 0, f(Yes, false, "")},
- {0x18a9, 228, 1, 1, f(Yes, false, "")},
- {0x18aa, 0, 0, 0, f(Yes, false, "")},
- {0x1939, 222, 1, 1, f(Yes, false, "")},
- {0x193a, 230, 1, 1, f(Yes, false, "")},
- {0x193b, 220, 1, 1, f(Yes, false, "")},
- {0x193c, 0, 0, 0, f(Yes, false, "")},
- {0x1a17, 230, 1, 1, f(Yes, false, "")},
- {0x1a18, 220, 1, 1, f(Yes, false, "")},
- {0x1a19, 0, 0, 0, f(Yes, false, "")},
- {0x1a60, 9, 1, 1, f(Yes, false, "")},
- {0x1a61, 0, 0, 0, f(Yes, false, "")},
- {0x1a75, 230, 1, 1, f(Yes, false, "")},
- {0x1a7d, 0, 0, 0, f(Yes, false, "")},
- {0x1a7f, 220, 1, 1, f(Yes, false, "")},
- {0x1a80, 0, 0, 0, f(Yes, false, "")},
- {0x1ab0, 230, 1, 1, f(Yes, false, "")},
- {0x1ab5, 220, 1, 1, f(Yes, false, "")},
- {0x1abb, 230, 1, 1, f(Yes, false, "")},
- {0x1abd, 220, 1, 1, f(Yes, false, "")},
- {0x1abe, 0, 0, 0, f(Yes, false, "")},
- {0x1b05, 0, 0, 0, f(Yes, true, "")},
- {0x1b06, 0, 0, 1, f(Yes, false, "ᬆ")},
- {0x1b07, 0, 0, 0, f(Yes, true, "")},
- {0x1b08, 0, 0, 1, f(Yes, false, "ᬈ")},
- {0x1b09, 0, 0, 0, f(Yes, true, "")},
- {0x1b0a, 0, 0, 1, f(Yes, false, "ᬊ")},
- {0x1b0b, 0, 0, 0, f(Yes, true, "")},
- {0x1b0c, 0, 0, 1, f(Yes, false, "ᬌ")},
- {0x1b0d, 0, 0, 0, f(Yes, true, "")},
- {0x1b0e, 0, 0, 1, f(Yes, false, "ᬎ")},
- {0x1b0f, 0, 0, 0, f(Yes, false, "")},
- {0x1b11, 0, 0, 0, f(Yes, true, "")},
- {0x1b12, 0, 0, 1, f(Yes, false, "ᬒ")},
- {0x1b13, 0, 0, 0, f(Yes, false, "")},
- {0x1b34, 7, 1, 1, f(Yes, false, "")},
- {0x1b35, 0, 1, 1, f(Maybe, false, "")},
- {0x1b36, 0, 0, 0, f(Yes, false, "")},
- {0x1b3a, 0, 0, 0, f(Yes, true, "")},
- {0x1b3b, 0, 0, 1, f(Yes, false, "ᬻ")},
- {0x1b3c, 0, 0, 0, f(Yes, true, "")},
- {0x1b3d, 0, 0, 1, f(Yes, false, "ᬽ")},
- {0x1b3e, 0, 0, 0, f(Yes, true, "")},
- {0x1b40, 0, 0, 1, f(Yes, false, "ᭀ")},
- {0x1b41, 0, 0, 1, f(Yes, false, "ᭁ")},
- {0x1b42, 0, 0, 0, f(Yes, true, "")},
- {0x1b43, 0, 0, 1, f(Yes, false, "ᭃ")},
- {0x1b44, 9, 1, 1, f(Yes, false, "")},
- {0x1b45, 0, 0, 0, f(Yes, false, "")},
- {0x1b6b, 230, 1, 1, f(Yes, false, "")},
- {0x1b6c, 220, 1, 1, f(Yes, false, "")},
- {0x1b6d, 230, 1, 1, f(Yes, false, "")},
- {0x1b74, 0, 0, 0, f(Yes, false, "")},
- {0x1baa, 9, 1, 1, f(Yes, false, "")},
- {0x1bac, 0, 0, 0, f(Yes, false, "")},
- {0x1be6, 7, 1, 1, f(Yes, false, "")},
- {0x1be7, 0, 0, 0, f(Yes, false, "")},
- {0x1bf2, 9, 1, 1, f(Yes, false, "")},
- {0x1bf4, 0, 0, 0, f(Yes, false, "")},
- {0x1c37, 7, 1, 1, f(Yes, false, "")},
- {0x1c38, 0, 0, 0, f(Yes, false, "")},
- {0x1cd0, 230, 1, 1, f(Yes, false, "")},
- {0x1cd3, 0, 0, 0, f(Yes, false, "")},
- {0x1cd4, 1, 1, 1, f(Yes, false, "")},
- {0x1cd5, 220, 1, 1, f(Yes, false, "")},
- {0x1cda, 230, 1, 1, f(Yes, false, "")},
- {0x1cdc, 220, 1, 1, f(Yes, false, "")},
- {0x1ce0, 230, 1, 1, f(Yes, false, "")},
- {0x1ce1, 0, 0, 0, f(Yes, false, "")},
- {0x1ce2, 1, 1, 1, f(Yes, false, "")},
- {0x1ce9, 0, 0, 0, f(Yes, false, "")},
- {0x1ced, 220, 1, 1, f(Yes, false, "")},
- {0x1cee, 0, 0, 0, f(Yes, false, "")},
- {0x1cf4, 230, 1, 1, f(Yes, false, "")},
- {0x1cf5, 0, 0, 0, f(Yes, false, "")},
- {0x1cf8, 230, 1, 1, f(Yes, false, "")},
- {0x1cfa, 0, 0, 0, f(Yes, false, "")},
- {0x1d2c, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d2d, 0, 0, 0, g(Yes, No, false, false, "", "Æ")},
- {0x1d2e, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d2f, 0, 0, 0, f(Yes, false, "")},
- {0x1d30, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d31, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d32, 0, 0, 0, g(Yes, No, false, false, "", "Ǝ")},
- {0x1d33, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d34, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d35, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d36, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d37, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d38, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d39, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d3a, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d3b, 0, 0, 0, f(Yes, false, "")},
- {0x1d3c, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d3d, 0, 0, 0, g(Yes, No, false, false, "", "Ȣ")},
- {0x1d3e, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d3f, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d40, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d41, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d42, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d43, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d44, 0, 0, 0, g(Yes, No, false, false, "", "ɐ")},
- {0x1d45, 0, 0, 0, g(Yes, No, false, false, "", "ɑ")},
- {0x1d46, 0, 0, 0, g(Yes, No, false, false, "", "ᴂ")},
- {0x1d47, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d48, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d49, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d4a, 0, 0, 0, g(Yes, No, false, false, "", "ə")},
- {0x1d4b, 0, 0, 0, g(Yes, No, false, false, "", "ɛ")},
- {0x1d4c, 0, 0, 0, g(Yes, No, false, false, "", "ɜ")},
- {0x1d4d, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d4e, 0, 0, 0, f(Yes, false, "")},
- {0x1d4f, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d50, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d51, 0, 0, 0, g(Yes, No, false, false, "", "ŋ")},
- {0x1d52, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d53, 0, 0, 0, g(Yes, No, false, false, "", "ɔ")},
- {0x1d54, 0, 0, 0, g(Yes, No, false, false, "", "ᴖ")},
- {0x1d55, 0, 0, 0, g(Yes, No, false, false, "", "ᴗ")},
- {0x1d56, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d57, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d58, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d59, 0, 0, 0, g(Yes, No, false, false, "", "ᴝ")},
- {0x1d5a, 0, 0, 0, g(Yes, No, false, false, "", "ɯ")},
- {0x1d5b, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d5c, 0, 0, 0, g(Yes, No, false, false, "", "ᴥ")},
- {0x1d5d, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x1d5e, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x1d5f, 0, 0, 0, g(Yes, No, false, false, "", "δ")},
- {0x1d60, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d61, 0, 0, 0, g(Yes, No, false, false, "", "χ")},
- {0x1d62, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d63, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d64, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d65, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d66, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x1d67, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x1d68, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d69, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d6a, 0, 0, 0, g(Yes, No, false, false, "", "χ")},
- {0x1d6b, 0, 0, 0, f(Yes, false, "")},
- {0x1d78, 0, 0, 0, g(Yes, No, false, false, "", "н")},
- {0x1d79, 0, 0, 0, f(Yes, false, "")},
- {0x1d9b, 0, 0, 0, g(Yes, No, false, false, "", "ɒ")},
- {0x1d9c, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d9d, 0, 0, 0, g(Yes, No, false, false, "", "ɕ")},
- {0x1d9e, 0, 0, 0, g(Yes, No, false, false, "", "ð")},
- {0x1d9f, 0, 0, 0, g(Yes, No, false, false, "", "ɜ")},
- {0x1da0, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1da1, 0, 0, 0, g(Yes, No, false, false, "", "ɟ")},
- {0x1da2, 0, 0, 0, g(Yes, No, false, false, "", "ɡ")},
- {0x1da3, 0, 0, 0, g(Yes, No, false, false, "", "ɥ")},
- {0x1da4, 0, 0, 0, g(Yes, No, false, false, "", "ɨ")},
- {0x1da5, 0, 0, 0, g(Yes, No, false, false, "", "ɩ")},
- {0x1da6, 0, 0, 0, g(Yes, No, false, false, "", "ɪ")},
- {0x1da7, 0, 0, 0, g(Yes, No, false, false, "", "ᵻ")},
- {0x1da8, 0, 0, 0, g(Yes, No, false, false, "", "ʝ")},
- {0x1da9, 0, 0, 0, g(Yes, No, false, false, "", "ɭ")},
- {0x1daa, 0, 0, 0, g(Yes, No, false, false, "", "ᶅ")},
- {0x1dab, 0, 0, 0, g(Yes, No, false, false, "", "ʟ")},
- {0x1dac, 0, 0, 0, g(Yes, No, false, false, "", "ɱ")},
- {0x1dad, 0, 0, 0, g(Yes, No, false, false, "", "ɰ")},
- {0x1dae, 0, 0, 0, g(Yes, No, false, false, "", "ɲ")},
- {0x1daf, 0, 0, 0, g(Yes, No, false, false, "", "ɳ")},
- {0x1db0, 0, 0, 0, g(Yes, No, false, false, "", "ɴ")},
- {0x1db1, 0, 0, 0, g(Yes, No, false, false, "", "ɵ")},
- {0x1db2, 0, 0, 0, g(Yes, No, false, false, "", "ɸ")},
- {0x1db3, 0, 0, 0, g(Yes, No, false, false, "", "ʂ")},
- {0x1db4, 0, 0, 0, g(Yes, No, false, false, "", "ʃ")},
- {0x1db5, 0, 0, 0, g(Yes, No, false, false, "", "ƫ")},
- {0x1db6, 0, 0, 0, g(Yes, No, false, false, "", "ʉ")},
- {0x1db7, 0, 0, 0, g(Yes, No, false, false, "", "ʊ")},
- {0x1db8, 0, 0, 0, g(Yes, No, false, false, "", "ᴜ")},
- {0x1db9, 0, 0, 0, g(Yes, No, false, false, "", "ʋ")},
- {0x1dba, 0, 0, 0, g(Yes, No, false, false, "", "ʌ")},
- {0x1dbb, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1dbc, 0, 0, 0, g(Yes, No, false, false, "", "ʐ")},
- {0x1dbd, 0, 0, 0, g(Yes, No, false, false, "", "ʑ")},
- {0x1dbe, 0, 0, 0, g(Yes, No, false, false, "", "ʒ")},
- {0x1dbf, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1dc0, 230, 1, 1, f(Yes, false, "")},
- {0x1dc2, 220, 1, 1, f(Yes, false, "")},
- {0x1dc3, 230, 1, 1, f(Yes, false, "")},
- {0x1dca, 220, 1, 1, f(Yes, false, "")},
- {0x1dcb, 230, 1, 1, f(Yes, false, "")},
- {0x1dcd, 234, 1, 1, f(Yes, false, "")},
- {0x1dce, 214, 1, 1, f(Yes, false, "")},
- {0x1dcf, 220, 1, 1, f(Yes, false, "")},
- {0x1dd0, 202, 1, 1, f(Yes, false, "")},
- {0x1dd1, 230, 1, 1, f(Yes, false, "")},
- {0x1df6, 0, 0, 0, f(Yes, false, "")},
- {0x1dfb, 230, 1, 1, f(Yes, false, "")},
- {0x1dfc, 233, 1, 1, f(Yes, false, "")},
- {0x1dfd, 220, 1, 1, f(Yes, false, "")},
- {0x1dfe, 230, 1, 1, f(Yes, false, "")},
- {0x1dff, 220, 1, 1, f(Yes, false, "")},
- {0x1e00, 0, 0, 1, f(Yes, false, "Ḁ")},
- {0x1e01, 0, 0, 1, f(Yes, false, "ḁ")},
- {0x1e02, 0, 0, 1, f(Yes, false, "Ḃ")},
- {0x1e03, 0, 0, 1, f(Yes, false, "ḃ")},
- {0x1e04, 0, 0, 1, f(Yes, false, "Ḅ")},
- {0x1e05, 0, 0, 1, f(Yes, false, "ḅ")},
- {0x1e06, 0, 0, 1, f(Yes, false, "Ḇ")},
- {0x1e07, 0, 0, 1, f(Yes, false, "ḇ")},
- {0x1e08, 0, 0, 2, f(Yes, false, "Ḉ")},
- {0x1e09, 0, 0, 2, f(Yes, false, "ḉ")},
- {0x1e0a, 0, 0, 1, f(Yes, false, "Ḋ")},
- {0x1e0b, 0, 0, 1, f(Yes, false, "ḋ")},
- {0x1e0c, 0, 0, 1, f(Yes, false, "Ḍ")},
- {0x1e0d, 0, 0, 1, f(Yes, false, "ḍ")},
- {0x1e0e, 0, 0, 1, f(Yes, false, "Ḏ")},
- {0x1e0f, 0, 0, 1, f(Yes, false, "ḏ")},
- {0x1e10, 0, 0, 1, f(Yes, false, "Ḑ")},
- {0x1e11, 0, 0, 1, f(Yes, false, "ḑ")},
- {0x1e12, 0, 0, 1, f(Yes, false, "Ḓ")},
- {0x1e13, 0, 0, 1, f(Yes, false, "ḓ")},
- {0x1e14, 0, 0, 2, f(Yes, false, "Ḕ")},
- {0x1e15, 0, 0, 2, f(Yes, false, "ḕ")},
- {0x1e16, 0, 0, 2, f(Yes, false, "Ḗ")},
- {0x1e17, 0, 0, 2, f(Yes, false, "ḗ")},
- {0x1e18, 0, 0, 1, f(Yes, false, "Ḙ")},
- {0x1e19, 0, 0, 1, f(Yes, false, "ḙ")},
- {0x1e1a, 0, 0, 1, f(Yes, false, "Ḛ")},
- {0x1e1b, 0, 0, 1, f(Yes, false, "ḛ")},
- {0x1e1c, 0, 0, 2, f(Yes, false, "Ḝ")},
- {0x1e1d, 0, 0, 2, f(Yes, false, "ḝ")},
- {0x1e1e, 0, 0, 1, f(Yes, false, "Ḟ")},
- {0x1e1f, 0, 0, 1, f(Yes, false, "ḟ")},
- {0x1e20, 0, 0, 1, f(Yes, false, "Ḡ")},
- {0x1e21, 0, 0, 1, f(Yes, false, "ḡ")},
- {0x1e22, 0, 0, 1, f(Yes, false, "Ḣ")},
- {0x1e23, 0, 0, 1, f(Yes, false, "ḣ")},
- {0x1e24, 0, 0, 1, f(Yes, false, "Ḥ")},
- {0x1e25, 0, 0, 1, f(Yes, false, "ḥ")},
- {0x1e26, 0, 0, 1, f(Yes, false, "Ḧ")},
- {0x1e27, 0, 0, 1, f(Yes, false, "ḧ")},
- {0x1e28, 0, 0, 1, f(Yes, false, "Ḩ")},
- {0x1e29, 0, 0, 1, f(Yes, false, "ḩ")},
- {0x1e2a, 0, 0, 1, f(Yes, false, "Ḫ")},
- {0x1e2b, 0, 0, 1, f(Yes, false, "ḫ")},
- {0x1e2c, 0, 0, 1, f(Yes, false, "Ḭ")},
- {0x1e2d, 0, 0, 1, f(Yes, false, "ḭ")},
- {0x1e2e, 0, 0, 2, f(Yes, false, "Ḯ")},
- {0x1e2f, 0, 0, 2, f(Yes, false, "ḯ")},
- {0x1e30, 0, 0, 1, f(Yes, false, "Ḱ")},
- {0x1e31, 0, 0, 1, f(Yes, false, "ḱ")},
- {0x1e32, 0, 0, 1, f(Yes, false, "Ḳ")},
- {0x1e33, 0, 0, 1, f(Yes, false, "ḳ")},
- {0x1e34, 0, 0, 1, f(Yes, false, "Ḵ")},
- {0x1e35, 0, 0, 1, f(Yes, false, "ḵ")},
- {0x1e36, 0, 0, 1, f(Yes, true, "Ḷ")},
- {0x1e37, 0, 0, 1, f(Yes, true, "ḷ")},
- {0x1e38, 0, 0, 2, f(Yes, false, "Ḹ")},
- {0x1e39, 0, 0, 2, f(Yes, false, "ḹ")},
- {0x1e3a, 0, 0, 1, f(Yes, false, "Ḻ")},
- {0x1e3b, 0, 0, 1, f(Yes, false, "ḻ")},
- {0x1e3c, 0, 0, 1, f(Yes, false, "Ḽ")},
- {0x1e3d, 0, 0, 1, f(Yes, false, "ḽ")},
- {0x1e3e, 0, 0, 1, f(Yes, false, "Ḿ")},
- {0x1e3f, 0, 0, 1, f(Yes, false, "ḿ")},
- {0x1e40, 0, 0, 1, f(Yes, false, "Ṁ")},
- {0x1e41, 0, 0, 1, f(Yes, false, "ṁ")},
- {0x1e42, 0, 0, 1, f(Yes, false, "Ṃ")},
- {0x1e43, 0, 0, 1, f(Yes, false, "ṃ")},
- {0x1e44, 0, 0, 1, f(Yes, false, "Ṅ")},
- {0x1e45, 0, 0, 1, f(Yes, false, "ṅ")},
- {0x1e46, 0, 0, 1, f(Yes, false, "Ṇ")},
- {0x1e47, 0, 0, 1, f(Yes, false, "ṇ")},
- {0x1e48, 0, 0, 1, f(Yes, false, "Ṉ")},
- {0x1e49, 0, 0, 1, f(Yes, false, "ṉ")},
- {0x1e4a, 0, 0, 1, f(Yes, false, "Ṋ")},
- {0x1e4b, 0, 0, 1, f(Yes, false, "ṋ")},
- {0x1e4c, 0, 0, 2, f(Yes, false, "Ṍ")},
- {0x1e4d, 0, 0, 2, f(Yes, false, "ṍ")},
- {0x1e4e, 0, 0, 2, f(Yes, false, "Ṏ")},
- {0x1e4f, 0, 0, 2, f(Yes, false, "ṏ")},
- {0x1e50, 0, 0, 2, f(Yes, false, "Ṑ")},
- {0x1e51, 0, 0, 2, f(Yes, false, "ṑ")},
- {0x1e52, 0, 0, 2, f(Yes, false, "Ṓ")},
- {0x1e53, 0, 0, 2, f(Yes, false, "ṓ")},
- {0x1e54, 0, 0, 1, f(Yes, false, "Ṕ")},
- {0x1e55, 0, 0, 1, f(Yes, false, "ṕ")},
- {0x1e56, 0, 0, 1, f(Yes, false, "Ṗ")},
- {0x1e57, 0, 0, 1, f(Yes, false, "ṗ")},
- {0x1e58, 0, 0, 1, f(Yes, false, "Ṙ")},
- {0x1e59, 0, 0, 1, f(Yes, false, "ṙ")},
- {0x1e5a, 0, 0, 1, f(Yes, true, "Ṛ")},
- {0x1e5b, 0, 0, 1, f(Yes, true, "ṛ")},
- {0x1e5c, 0, 0, 2, f(Yes, false, "Ṝ")},
- {0x1e5d, 0, 0, 2, f(Yes, false, "ṝ")},
- {0x1e5e, 0, 0, 1, f(Yes, false, "Ṟ")},
- {0x1e5f, 0, 0, 1, f(Yes, false, "ṟ")},
- {0x1e60, 0, 0, 1, f(Yes, false, "Ṡ")},
- {0x1e61, 0, 0, 1, f(Yes, false, "ṡ")},
- {0x1e62, 0, 0, 1, f(Yes, true, "Ṣ")},
- {0x1e63, 0, 0, 1, f(Yes, true, "ṣ")},
- {0x1e64, 0, 0, 2, f(Yes, false, "Ṥ")},
- {0x1e65, 0, 0, 2, f(Yes, false, "ṥ")},
- {0x1e66, 0, 0, 2, f(Yes, false, "Ṧ")},
- {0x1e67, 0, 0, 2, f(Yes, false, "ṧ")},
- {0x1e68, 0, 0, 2, f(Yes, false, "Ṩ")},
- {0x1e69, 0, 0, 2, f(Yes, false, "ṩ")},
- {0x1e6a, 0, 0, 1, f(Yes, false, "Ṫ")},
- {0x1e6b, 0, 0, 1, f(Yes, false, "ṫ")},
- {0x1e6c, 0, 0, 1, f(Yes, false, "Ṭ")},
- {0x1e6d, 0, 0, 1, f(Yes, false, "ṭ")},
- {0x1e6e, 0, 0, 1, f(Yes, false, "Ṯ")},
- {0x1e6f, 0, 0, 1, f(Yes, false, "ṯ")},
- {0x1e70, 0, 0, 1, f(Yes, false, "Ṱ")},
- {0x1e71, 0, 0, 1, f(Yes, false, "ṱ")},
- {0x1e72, 0, 0, 1, f(Yes, false, "Ṳ")},
- {0x1e73, 0, 0, 1, f(Yes, false, "ṳ")},
- {0x1e74, 0, 0, 1, f(Yes, false, "Ṵ")},
- {0x1e75, 0, 0, 1, f(Yes, false, "ṵ")},
- {0x1e76, 0, 0, 1, f(Yes, false, "Ṷ")},
- {0x1e77, 0, 0, 1, f(Yes, false, "ṷ")},
- {0x1e78, 0, 0, 2, f(Yes, false, "Ṹ")},
- {0x1e79, 0, 0, 2, f(Yes, false, "ṹ")},
- {0x1e7a, 0, 0, 2, f(Yes, false, "Ṻ")},
- {0x1e7b, 0, 0, 2, f(Yes, false, "ṻ")},
- {0x1e7c, 0, 0, 1, f(Yes, false, "Ṽ")},
- {0x1e7d, 0, 0, 1, f(Yes, false, "ṽ")},
- {0x1e7e, 0, 0, 1, f(Yes, false, "Ṿ")},
- {0x1e7f, 0, 0, 1, f(Yes, false, "ṿ")},
- {0x1e80, 0, 0, 1, f(Yes, false, "Ẁ")},
- {0x1e81, 0, 0, 1, f(Yes, false, "ẁ")},
- {0x1e82, 0, 0, 1, f(Yes, false, "Ẃ")},
- {0x1e83, 0, 0, 1, f(Yes, false, "ẃ")},
- {0x1e84, 0, 0, 1, f(Yes, false, "Ẅ")},
- {0x1e85, 0, 0, 1, f(Yes, false, "ẅ")},
- {0x1e86, 0, 0, 1, f(Yes, false, "Ẇ")},
- {0x1e87, 0, 0, 1, f(Yes, false, "ẇ")},
- {0x1e88, 0, 0, 1, f(Yes, false, "Ẉ")},
- {0x1e89, 0, 0, 1, f(Yes, false, "ẉ")},
- {0x1e8a, 0, 0, 1, f(Yes, false, "Ẋ")},
- {0x1e8b, 0, 0, 1, f(Yes, false, "ẋ")},
- {0x1e8c, 0, 0, 1, f(Yes, false, "Ẍ")},
- {0x1e8d, 0, 0, 1, f(Yes, false, "ẍ")},
- {0x1e8e, 0, 0, 1, f(Yes, false, "Ẏ")},
- {0x1e8f, 0, 0, 1, f(Yes, false, "ẏ")},
- {0x1e90, 0, 0, 1, f(Yes, false, "Ẑ")},
- {0x1e91, 0, 0, 1, f(Yes, false, "ẑ")},
- {0x1e92, 0, 0, 1, f(Yes, false, "Ẓ")},
- {0x1e93, 0, 0, 1, f(Yes, false, "ẓ")},
- {0x1e94, 0, 0, 1, f(Yes, false, "Ẕ")},
- {0x1e95, 0, 0, 1, f(Yes, false, "ẕ")},
- {0x1e96, 0, 0, 1, f(Yes, false, "ẖ")},
- {0x1e97, 0, 0, 1, f(Yes, false, "ẗ")},
- {0x1e98, 0, 0, 1, f(Yes, false, "ẘ")},
- {0x1e99, 0, 0, 1, f(Yes, false, "ẙ")},
- {0x1e9a, 0, 0, 0, g(Yes, No, false, false, "", "aʾ")},
- {0x1e9b, 0, 0, 1, g(Yes, No, false, false, "ẛ", "ṡ")},
- {0x1e9c, 0, 0, 0, f(Yes, false, "")},
- {0x1ea0, 0, 0, 1, f(Yes, true, "Ạ")},
- {0x1ea1, 0, 0, 1, f(Yes, true, "ạ")},
- {0x1ea2, 0, 0, 1, f(Yes, false, "Ả")},
- {0x1ea3, 0, 0, 1, f(Yes, false, "ả")},
- {0x1ea4, 0, 0, 2, f(Yes, false, "Ấ")},
- {0x1ea5, 0, 0, 2, f(Yes, false, "ấ")},
- {0x1ea6, 0, 0, 2, f(Yes, false, "Ầ")},
- {0x1ea7, 0, 0, 2, f(Yes, false, "ầ")},
- {0x1ea8, 0, 0, 2, f(Yes, false, "Ẩ")},
- {0x1ea9, 0, 0, 2, f(Yes, false, "ẩ")},
- {0x1eaa, 0, 0, 2, f(Yes, false, "Ẫ")},
- {0x1eab, 0, 0, 2, f(Yes, false, "ẫ")},
- {0x1eac, 0, 0, 2, f(Yes, false, "Ậ")},
- {0x1ead, 0, 0, 2, f(Yes, false, "ậ")},
- {0x1eae, 0, 0, 2, f(Yes, false, "Ắ")},
- {0x1eaf, 0, 0, 2, f(Yes, false, "ắ")},
- {0x1eb0, 0, 0, 2, f(Yes, false, "Ằ")},
- {0x1eb1, 0, 0, 2, f(Yes, false, "ằ")},
- {0x1eb2, 0, 0, 2, f(Yes, false, "Ẳ")},
- {0x1eb3, 0, 0, 2, f(Yes, false, "ẳ")},
- {0x1eb4, 0, 0, 2, f(Yes, false, "Ẵ")},
- {0x1eb5, 0, 0, 2, f(Yes, false, "ẵ")},
- {0x1eb6, 0, 0, 2, f(Yes, false, "Ặ")},
- {0x1eb7, 0, 0, 2, f(Yes, false, "ặ")},
- {0x1eb8, 0, 0, 1, f(Yes, true, "Ẹ")},
- {0x1eb9, 0, 0, 1, f(Yes, true, "ẹ")},
- {0x1eba, 0, 0, 1, f(Yes, false, "Ẻ")},
- {0x1ebb, 0, 0, 1, f(Yes, false, "ẻ")},
- {0x1ebc, 0, 0, 1, f(Yes, false, "Ẽ")},
- {0x1ebd, 0, 0, 1, f(Yes, false, "ẽ")},
- {0x1ebe, 0, 0, 2, f(Yes, false, "Ế")},
- {0x1ebf, 0, 0, 2, f(Yes, false, "ế")},
- {0x1ec0, 0, 0, 2, f(Yes, false, "Ề")},
- {0x1ec1, 0, 0, 2, f(Yes, false, "ề")},
- {0x1ec2, 0, 0, 2, f(Yes, false, "Ể")},
- {0x1ec3, 0, 0, 2, f(Yes, false, "ể")},
- {0x1ec4, 0, 0, 2, f(Yes, false, "Ễ")},
- {0x1ec5, 0, 0, 2, f(Yes, false, "ễ")},
- {0x1ec6, 0, 0, 2, f(Yes, false, "Ệ")},
- {0x1ec7, 0, 0, 2, f(Yes, false, "ệ")},
- {0x1ec8, 0, 0, 1, f(Yes, false, "Ỉ")},
- {0x1ec9, 0, 0, 1, f(Yes, false, "ỉ")},
- {0x1eca, 0, 0, 1, f(Yes, false, "Ị")},
- {0x1ecb, 0, 0, 1, f(Yes, false, "ị")},
- {0x1ecc, 0, 0, 1, f(Yes, true, "Ọ")},
- {0x1ecd, 0, 0, 1, f(Yes, true, "ọ")},
- {0x1ece, 0, 0, 1, f(Yes, false, "Ỏ")},
- {0x1ecf, 0, 0, 1, f(Yes, false, "ỏ")},
- {0x1ed0, 0, 0, 2, f(Yes, false, "Ố")},
- {0x1ed1, 0, 0, 2, f(Yes, false, "ố")},
- {0x1ed2, 0, 0, 2, f(Yes, false, "Ồ")},
- {0x1ed3, 0, 0, 2, f(Yes, false, "ồ")},
- {0x1ed4, 0, 0, 2, f(Yes, false, "Ổ")},
- {0x1ed5, 0, 0, 2, f(Yes, false, "ổ")},
- {0x1ed6, 0, 0, 2, f(Yes, false, "Ỗ")},
- {0x1ed7, 0, 0, 2, f(Yes, false, "ỗ")},
- {0x1ed8, 0, 0, 2, f(Yes, false, "Ộ")},
- {0x1ed9, 0, 0, 2, f(Yes, false, "ộ")},
- {0x1eda, 0, 0, 2, f(Yes, false, "Ớ")},
- {0x1edb, 0, 0, 2, f(Yes, false, "ớ")},
- {0x1edc, 0, 0, 2, f(Yes, false, "Ờ")},
- {0x1edd, 0, 0, 2, f(Yes, false, "ờ")},
- {0x1ede, 0, 0, 2, f(Yes, false, "Ở")},
- {0x1edf, 0, 0, 2, f(Yes, false, "ở")},
- {0x1ee0, 0, 0, 2, f(Yes, false, "Ỡ")},
- {0x1ee1, 0, 0, 2, f(Yes, false, "ỡ")},
- {0x1ee2, 0, 0, 2, f(Yes, false, "Ợ")},
- {0x1ee3, 0, 0, 2, f(Yes, false, "ợ")},
- {0x1ee4, 0, 0, 1, f(Yes, false, "Ụ")},
- {0x1ee5, 0, 0, 1, f(Yes, false, "ụ")},
- {0x1ee6, 0, 0, 1, f(Yes, false, "Ủ")},
- {0x1ee7, 0, 0, 1, f(Yes, false, "ủ")},
- {0x1ee8, 0, 0, 2, f(Yes, false, "Ứ")},
- {0x1ee9, 0, 0, 2, f(Yes, false, "ứ")},
- {0x1eea, 0, 0, 2, f(Yes, false, "Ừ")},
- {0x1eeb, 0, 0, 2, f(Yes, false, "ừ")},
- {0x1eec, 0, 0, 2, f(Yes, false, "Ử")},
- {0x1eed, 0, 0, 2, f(Yes, false, "ử")},
- {0x1eee, 0, 0, 2, f(Yes, false, "Ữ")},
- {0x1eef, 0, 0, 2, f(Yes, false, "ữ")},
- {0x1ef0, 0, 0, 2, f(Yes, false, "Ự")},
- {0x1ef1, 0, 0, 2, f(Yes, false, "ự")},
- {0x1ef2, 0, 0, 1, f(Yes, false, "Ỳ")},
- {0x1ef3, 0, 0, 1, f(Yes, false, "ỳ")},
- {0x1ef4, 0, 0, 1, f(Yes, false, "Ỵ")},
- {0x1ef5, 0, 0, 1, f(Yes, false, "ỵ")},
- {0x1ef6, 0, 0, 1, f(Yes, false, "Ỷ")},
- {0x1ef7, 0, 0, 1, f(Yes, false, "ỷ")},
- {0x1ef8, 0, 0, 1, f(Yes, false, "Ỹ")},
- {0x1ef9, 0, 0, 1, f(Yes, false, "ỹ")},
- {0x1efa, 0, 0, 0, f(Yes, false, "")},
- {0x1f00, 0, 0, 1, f(Yes, true, "ἀ")},
- {0x1f01, 0, 0, 1, f(Yes, true, "ἁ")},
- {0x1f02, 0, 0, 2, f(Yes, true, "ἂ")},
- {0x1f03, 0, 0, 2, f(Yes, true, "ἃ")},
- {0x1f04, 0, 0, 2, f(Yes, true, "ἄ")},
- {0x1f05, 0, 0, 2, f(Yes, true, "ἅ")},
- {0x1f06, 0, 0, 2, f(Yes, true, "ἆ")},
- {0x1f07, 0, 0, 2, f(Yes, true, "ἇ")},
- {0x1f08, 0, 0, 1, f(Yes, true, "Ἀ")},
- {0x1f09, 0, 0, 1, f(Yes, true, "Ἁ")},
- {0x1f0a, 0, 0, 2, f(Yes, true, "Ἂ")},
- {0x1f0b, 0, 0, 2, f(Yes, true, "Ἃ")},
- {0x1f0c, 0, 0, 2, f(Yes, true, "Ἄ")},
- {0x1f0d, 0, 0, 2, f(Yes, true, "Ἅ")},
- {0x1f0e, 0, 0, 2, f(Yes, true, "Ἆ")},
- {0x1f0f, 0, 0, 2, f(Yes, true, "Ἇ")},
- {0x1f10, 0, 0, 1, f(Yes, true, "ἐ")},
- {0x1f11, 0, 0, 1, f(Yes, true, "ἑ")},
- {0x1f12, 0, 0, 2, f(Yes, false, "ἒ")},
- {0x1f13, 0, 0, 2, f(Yes, false, "ἓ")},
- {0x1f14, 0, 0, 2, f(Yes, false, "ἔ")},
- {0x1f15, 0, 0, 2, f(Yes, false, "ἕ")},
- {0x1f16, 0, 0, 0, f(Yes, false, "")},
- {0x1f18, 0, 0, 1, f(Yes, true, "Ἐ")},
- {0x1f19, 0, 0, 1, f(Yes, true, "Ἑ")},
- {0x1f1a, 0, 0, 2, f(Yes, false, "Ἒ")},
- {0x1f1b, 0, 0, 2, f(Yes, false, "Ἓ")},
- {0x1f1c, 0, 0, 2, f(Yes, false, "Ἔ")},
- {0x1f1d, 0, 0, 2, f(Yes, false, "Ἕ")},
- {0x1f1e, 0, 0, 0, f(Yes, false, "")},
- {0x1f20, 0, 0, 1, f(Yes, true, "ἠ")},
- {0x1f21, 0, 0, 1, f(Yes, true, "ἡ")},
- {0x1f22, 0, 0, 2, f(Yes, true, "ἢ")},
- {0x1f23, 0, 0, 2, f(Yes, true, "ἣ")},
- {0x1f24, 0, 0, 2, f(Yes, true, "ἤ")},
- {0x1f25, 0, 0, 2, f(Yes, true, "ἥ")},
- {0x1f26, 0, 0, 2, f(Yes, true, "ἦ")},
- {0x1f27, 0, 0, 2, f(Yes, true, "ἧ")},
- {0x1f28, 0, 0, 1, f(Yes, true, "Ἠ")},
- {0x1f29, 0, 0, 1, f(Yes, true, "Ἡ")},
- {0x1f2a, 0, 0, 2, f(Yes, true, "Ἢ")},
- {0x1f2b, 0, 0, 2, f(Yes, true, "Ἣ")},
- {0x1f2c, 0, 0, 2, f(Yes, true, "Ἤ")},
- {0x1f2d, 0, 0, 2, f(Yes, true, "Ἥ")},
- {0x1f2e, 0, 0, 2, f(Yes, true, "Ἦ")},
- {0x1f2f, 0, 0, 2, f(Yes, true, "Ἧ")},
- {0x1f30, 0, 0, 1, f(Yes, true, "ἰ")},
- {0x1f31, 0, 0, 1, f(Yes, true, "ἱ")},
- {0x1f32, 0, 0, 2, f(Yes, false, "ἲ")},
- {0x1f33, 0, 0, 2, f(Yes, false, "ἳ")},
- {0x1f34, 0, 0, 2, f(Yes, false, "ἴ")},
- {0x1f35, 0, 0, 2, f(Yes, false, "ἵ")},
- {0x1f36, 0, 0, 2, f(Yes, false, "ἶ")},
- {0x1f37, 0, 0, 2, f(Yes, false, "ἷ")},
- {0x1f38, 0, 0, 1, f(Yes, true, "Ἰ")},
- {0x1f39, 0, 0, 1, f(Yes, true, "Ἱ")},
- {0x1f3a, 0, 0, 2, f(Yes, false, "Ἲ")},
- {0x1f3b, 0, 0, 2, f(Yes, false, "Ἳ")},
- {0x1f3c, 0, 0, 2, f(Yes, false, "Ἴ")},
- {0x1f3d, 0, 0, 2, f(Yes, false, "Ἵ")},
- {0x1f3e, 0, 0, 2, f(Yes, false, "Ἶ")},
- {0x1f3f, 0, 0, 2, f(Yes, false, "Ἷ")},
- {0x1f40, 0, 0, 1, f(Yes, true, "ὀ")},
- {0x1f41, 0, 0, 1, f(Yes, true, "ὁ")},
- {0x1f42, 0, 0, 2, f(Yes, false, "ὂ")},
- {0x1f43, 0, 0, 2, f(Yes, false, "ὃ")},
- {0x1f44, 0, 0, 2, f(Yes, false, "ὄ")},
- {0x1f45, 0, 0, 2, f(Yes, false, "ὅ")},
- {0x1f46, 0, 0, 0, f(Yes, false, "")},
- {0x1f48, 0, 0, 1, f(Yes, true, "Ὀ")},
- {0x1f49, 0, 0, 1, f(Yes, true, "Ὁ")},
- {0x1f4a, 0, 0, 2, f(Yes, false, "Ὂ")},
- {0x1f4b, 0, 0, 2, f(Yes, false, "Ὃ")},
- {0x1f4c, 0, 0, 2, f(Yes, false, "Ὄ")},
- {0x1f4d, 0, 0, 2, f(Yes, false, "Ὅ")},
- {0x1f4e, 0, 0, 0, f(Yes, false, "")},
- {0x1f50, 0, 0, 1, f(Yes, true, "ὐ")},
- {0x1f51, 0, 0, 1, f(Yes, true, "ὑ")},
- {0x1f52, 0, 0, 2, f(Yes, false, "ὒ")},
- {0x1f53, 0, 0, 2, f(Yes, false, "ὓ")},
- {0x1f54, 0, 0, 2, f(Yes, false, "ὔ")},
- {0x1f55, 0, 0, 2, f(Yes, false, "ὕ")},
- {0x1f56, 0, 0, 2, f(Yes, false, "ὖ")},
- {0x1f57, 0, 0, 2, f(Yes, false, "ὗ")},
- {0x1f58, 0, 0, 0, f(Yes, false, "")},
- {0x1f59, 0, 0, 1, f(Yes, true, "Ὑ")},
- {0x1f5a, 0, 0, 0, f(Yes, false, "")},
- {0x1f5b, 0, 0, 2, f(Yes, false, "Ὓ")},
- {0x1f5c, 0, 0, 0, f(Yes, false, "")},
- {0x1f5d, 0, 0, 2, f(Yes, false, "Ὕ")},
- {0x1f5e, 0, 0, 0, f(Yes, false, "")},
- {0x1f5f, 0, 0, 2, f(Yes, false, "Ὗ")},
- {0x1f60, 0, 0, 1, f(Yes, true, "ὠ")},
- {0x1f61, 0, 0, 1, f(Yes, true, "ὡ")},
- {0x1f62, 0, 0, 2, f(Yes, true, "ὢ")},
- {0x1f63, 0, 0, 2, f(Yes, true, "ὣ")},
- {0x1f64, 0, 0, 2, f(Yes, true, "ὤ")},
- {0x1f65, 0, 0, 2, f(Yes, true, "ὥ")},
- {0x1f66, 0, 0, 2, f(Yes, true, "ὦ")},
- {0x1f67, 0, 0, 2, f(Yes, true, "ὧ")},
- {0x1f68, 0, 0, 1, f(Yes, true, "Ὠ")},
- {0x1f69, 0, 0, 1, f(Yes, true, "Ὡ")},
- {0x1f6a, 0, 0, 2, f(Yes, true, "Ὢ")},
- {0x1f6b, 0, 0, 2, f(Yes, true, "Ὣ")},
- {0x1f6c, 0, 0, 2, f(Yes, true, "Ὤ")},
- {0x1f6d, 0, 0, 2, f(Yes, true, "Ὥ")},
- {0x1f6e, 0, 0, 2, f(Yes, true, "Ὦ")},
- {0x1f6f, 0, 0, 2, f(Yes, true, "Ὧ")},
- {0x1f70, 0, 0, 1, f(Yes, true, "ὰ")},
- {0x1f71, 0, 0, 1, f(No, false, "ά")},
- {0x1f72, 0, 0, 1, f(Yes, false, "ὲ")},
- {0x1f73, 0, 0, 1, f(No, false, "έ")},
- {0x1f74, 0, 0, 1, f(Yes, true, "ὴ")},
- {0x1f75, 0, 0, 1, f(No, false, "ή")},
- {0x1f76, 0, 0, 1, f(Yes, false, "ὶ")},
- {0x1f77, 0, 0, 1, f(No, false, "ί")},
- {0x1f78, 0, 0, 1, f(Yes, false, "ὸ")},
- {0x1f79, 0, 0, 1, f(No, false, "ό")},
- {0x1f7a, 0, 0, 1, f(Yes, false, "ὺ")},
- {0x1f7b, 0, 0, 1, f(No, false, "ύ")},
- {0x1f7c, 0, 0, 1, f(Yes, true, "ὼ")},
- {0x1f7d, 0, 0, 1, f(No, false, "ώ")},
- {0x1f7e, 0, 0, 0, f(Yes, false, "")},
- {0x1f80, 0, 0, 2, f(Yes, false, "ᾀ")},
- {0x1f81, 0, 0, 2, f(Yes, false, "ᾁ")},
- {0x1f82, 0, 0, 3, f(Yes, false, "ᾂ")},
- {0x1f83, 0, 0, 3, f(Yes, false, "ᾃ")},
- {0x1f84, 0, 0, 3, f(Yes, false, "ᾄ")},
- {0x1f85, 0, 0, 3, f(Yes, false, "ᾅ")},
- {0x1f86, 0, 0, 3, f(Yes, false, "ᾆ")},
- {0x1f87, 0, 0, 3, f(Yes, false, "ᾇ")},
- {0x1f88, 0, 0, 2, f(Yes, false, "ᾈ")},
- {0x1f89, 0, 0, 2, f(Yes, false, "ᾉ")},
- {0x1f8a, 0, 0, 3, f(Yes, false, "ᾊ")},
- {0x1f8b, 0, 0, 3, f(Yes, false, "ᾋ")},
- {0x1f8c, 0, 0, 3, f(Yes, false, "ᾌ")},
- {0x1f8d, 0, 0, 3, f(Yes, false, "ᾍ")},
- {0x1f8e, 0, 0, 3, f(Yes, false, "ᾎ")},
- {0x1f8f, 0, 0, 3, f(Yes, false, "ᾏ")},
- {0x1f90, 0, 0, 2, f(Yes, false, "ᾐ")},
- {0x1f91, 0, 0, 2, f(Yes, false, "ᾑ")},
- {0x1f92, 0, 0, 3, f(Yes, false, "ᾒ")},
- {0x1f93, 0, 0, 3, f(Yes, false, "ᾓ")},
- {0x1f94, 0, 0, 3, f(Yes, false, "ᾔ")},
- {0x1f95, 0, 0, 3, f(Yes, false, "ᾕ")},
- {0x1f96, 0, 0, 3, f(Yes, false, "ᾖ")},
- {0x1f97, 0, 0, 3, f(Yes, false, "ᾗ")},
- {0x1f98, 0, 0, 2, f(Yes, false, "ᾘ")},
- {0x1f99, 0, 0, 2, f(Yes, false, "ᾙ")},
- {0x1f9a, 0, 0, 3, f(Yes, false, "ᾚ")},
- {0x1f9b, 0, 0, 3, f(Yes, false, "ᾛ")},
- {0x1f9c, 0, 0, 3, f(Yes, false, "ᾜ")},
- {0x1f9d, 0, 0, 3, f(Yes, false, "ᾝ")},
- {0x1f9e, 0, 0, 3, f(Yes, false, "ᾞ")},
- {0x1f9f, 0, 0, 3, f(Yes, false, "ᾟ")},
- {0x1fa0, 0, 0, 2, f(Yes, false, "ᾠ")},
- {0x1fa1, 0, 0, 2, f(Yes, false, "ᾡ")},
- {0x1fa2, 0, 0, 3, f(Yes, false, "ᾢ")},
- {0x1fa3, 0, 0, 3, f(Yes, false, "ᾣ")},
- {0x1fa4, 0, 0, 3, f(Yes, false, "ᾤ")},
- {0x1fa5, 0, 0, 3, f(Yes, false, "ᾥ")},
- {0x1fa6, 0, 0, 3, f(Yes, false, "ᾦ")},
- {0x1fa7, 0, 0, 3, f(Yes, false, "ᾧ")},
- {0x1fa8, 0, 0, 2, f(Yes, false, "ᾨ")},
- {0x1fa9, 0, 0, 2, f(Yes, false, "ᾩ")},
- {0x1faa, 0, 0, 3, f(Yes, false, "ᾪ")},
- {0x1fab, 0, 0, 3, f(Yes, false, "ᾫ")},
- {0x1fac, 0, 0, 3, f(Yes, false, "ᾬ")},
- {0x1fad, 0, 0, 3, f(Yes, false, "ᾭ")},
- {0x1fae, 0, 0, 3, f(Yes, false, "ᾮ")},
- {0x1faf, 0, 0, 3, f(Yes, false, "ᾯ")},
- {0x1fb0, 0, 0, 1, f(Yes, false, "ᾰ")},
- {0x1fb1, 0, 0, 1, f(Yes, false, "ᾱ")},
- {0x1fb2, 0, 0, 2, f(Yes, false, "ᾲ")},
- {0x1fb3, 0, 0, 1, f(Yes, false, "ᾳ")},
- {0x1fb4, 0, 0, 2, f(Yes, false, "ᾴ")},
- {0x1fb5, 0, 0, 0, f(Yes, false, "")},
- {0x1fb6, 0, 0, 1, f(Yes, true, "ᾶ")},
- {0x1fb7, 0, 0, 2, f(Yes, false, "ᾷ")},
- {0x1fb8, 0, 0, 1, f(Yes, false, "Ᾰ")},
- {0x1fb9, 0, 0, 1, f(Yes, false, "Ᾱ")},
- {0x1fba, 0, 0, 1, f(Yes, false, "Ὰ")},
- {0x1fbb, 0, 0, 1, f(No, false, "Ά")},
- {0x1fbc, 0, 0, 1, f(Yes, false, "ᾼ")},
- {0x1fbd, 0, 0, 1, g(Yes, No, false, false, "", " ̓")},
- {0x1fbe, 0, 0, 0, f(No, false, "ι")},
- {0x1fbf, 0, 0, 1, g(Yes, No, true, false, "", " ̓")},
- {0x1fc0, 0, 0, 1, g(Yes, No, false, false, "", " ͂")},
- {0x1fc1, 0, 0, 2, g(Yes, No, false, false, "῁", " ̈͂")},
- {0x1fc2, 0, 0, 2, f(Yes, false, "ῂ")},
- {0x1fc3, 0, 0, 1, f(Yes, false, "ῃ")},
- {0x1fc4, 0, 0, 2, f(Yes, false, "ῄ")},
- {0x1fc5, 0, 0, 0, f(Yes, false, "")},
- {0x1fc6, 0, 0, 1, f(Yes, true, "ῆ")},
- {0x1fc7, 0, 0, 2, f(Yes, false, "ῇ")},
- {0x1fc8, 0, 0, 1, f(Yes, false, "Ὲ")},
- {0x1fc9, 0, 0, 1, f(No, false, "Έ")},
- {0x1fca, 0, 0, 1, f(Yes, false, "Ὴ")},
- {0x1fcb, 0, 0, 1, f(No, false, "Ή")},
- {0x1fcc, 0, 0, 1, f(Yes, false, "ῌ")},
- {0x1fcd, 0, 0, 2, g(Yes, No, false, false, "῍", " ̓̀")},
- {0x1fce, 0, 0, 2, g(Yes, No, false, false, "῎", " ̓́")},
- {0x1fcf, 0, 0, 2, g(Yes, No, false, false, "῏", " ̓͂")},
- {0x1fd0, 0, 0, 1, f(Yes, false, "ῐ")},
- {0x1fd1, 0, 0, 1, f(Yes, false, "ῑ")},
- {0x1fd2, 0, 0, 2, f(Yes, false, "ῒ")},
- {0x1fd3, 0, 0, 2, f(No, false, "ΐ")},
- {0x1fd4, 0, 0, 0, f(Yes, false, "")},
- {0x1fd6, 0, 0, 1, f(Yes, false, "ῖ")},
- {0x1fd7, 0, 0, 2, f(Yes, false, "ῗ")},
- {0x1fd8, 0, 0, 1, f(Yes, false, "Ῐ")},
- {0x1fd9, 0, 0, 1, f(Yes, false, "Ῑ")},
- {0x1fda, 0, 0, 1, f(Yes, false, "Ὶ")},
- {0x1fdb, 0, 0, 1, f(No, false, "Ί")},
- {0x1fdc, 0, 0, 0, f(Yes, false, "")},
- {0x1fdd, 0, 0, 2, g(Yes, No, false, false, "῝", " ̔̀")},
- {0x1fde, 0, 0, 2, g(Yes, No, false, false, "῞", " ̔́")},
- {0x1fdf, 0, 0, 2, g(Yes, No, false, false, "῟", " ̔͂")},
- {0x1fe0, 0, 0, 1, f(Yes, false, "ῠ")},
- {0x1fe1, 0, 0, 1, f(Yes, false, "ῡ")},
- {0x1fe2, 0, 0, 2, f(Yes, false, "ῢ")},
- {0x1fe3, 0, 0, 2, f(No, false, "ΰ")},
- {0x1fe4, 0, 0, 1, f(Yes, false, "ῤ")},
- {0x1fe5, 0, 0, 1, f(Yes, false, "ῥ")},
- {0x1fe6, 0, 0, 1, f(Yes, false, "ῦ")},
- {0x1fe7, 0, 0, 2, f(Yes, false, "ῧ")},
- {0x1fe8, 0, 0, 1, f(Yes, false, "Ῠ")},
- {0x1fe9, 0, 0, 1, f(Yes, false, "Ῡ")},
- {0x1fea, 0, 0, 1, f(Yes, false, "Ὺ")},
- {0x1feb, 0, 0, 1, f(No, false, "Ύ")},
- {0x1fec, 0, 0, 1, f(Yes, false, "Ῥ")},
- {0x1fed, 0, 0, 2, g(Yes, No, false, false, "῭", " ̈̀")},
- {0x1fee, 0, 0, 2, g(No, No, false, false, "΅", " ̈́")},
- {0x1fef, 0, 0, 0, f(No, false, "`")},
- {0x1ff0, 0, 0, 0, f(Yes, false, "")},
- {0x1ff2, 0, 0, 2, f(Yes, false, "ῲ")},
- {0x1ff3, 0, 0, 1, f(Yes, false, "ῳ")},
- {0x1ff4, 0, 0, 2, f(Yes, false, "ῴ")},
- {0x1ff5, 0, 0, 0, f(Yes, false, "")},
- {0x1ff6, 0, 0, 1, f(Yes, true, "ῶ")},
- {0x1ff7, 0, 0, 2, f(Yes, false, "ῷ")},
- {0x1ff8, 0, 0, 1, f(Yes, false, "Ὸ")},
- {0x1ff9, 0, 0, 1, f(No, false, "Ό")},
- {0x1ffa, 0, 0, 1, f(Yes, false, "Ὼ")},
- {0x1ffb, 0, 0, 1, f(No, false, "Ώ")},
- {0x1ffc, 0, 0, 1, f(Yes, false, "ῼ")},
- {0x1ffd, 0, 0, 1, g(No, No, false, false, "´", " ́")},
- {0x1ffe, 0, 0, 1, g(Yes, No, true, false, "", " ̔")},
- {0x1fff, 0, 0, 0, f(Yes, false, "")},
- {0x2000, 0, 0, 0, g(No, No, false, false, "\u2002", " ")},
- {0x2001, 0, 0, 0, g(No, No, false, false, "\u2003", " ")},
- {0x2002, 0, 0, 0, g(Yes, No, false, false, "", " ")},
- {0x200b, 0, 0, 0, f(Yes, false, "")},
- {0x2011, 0, 0, 0, g(Yes, No, false, false, "", "‐")},
- {0x2012, 0, 0, 0, f(Yes, false, "")},
- {0x2017, 0, 0, 1, g(Yes, No, false, false, "", " ̳")},
- {0x2018, 0, 0, 0, f(Yes, false, "")},
- {0x2024, 0, 0, 0, g(Yes, No, false, false, "", ".")},
- {0x2025, 0, 0, 0, g(Yes, No, false, false, "", "..")},
- {0x2026, 0, 0, 0, g(Yes, No, false, false, "", "...")},
- {0x2027, 0, 0, 0, f(Yes, false, "")},
- {0x202f, 0, 0, 0, g(Yes, No, false, false, "", " ")},
- {0x2030, 0, 0, 0, f(Yes, false, "")},
- {0x2033, 0, 0, 0, g(Yes, No, false, false, "", "′′")},
- {0x2034, 0, 0, 0, g(Yes, No, false, false, "", "′′′")},
- {0x2035, 0, 0, 0, f(Yes, false, "")},
- {0x2036, 0, 0, 0, g(Yes, No, false, false, "", "‵‵")},
- {0x2037, 0, 0, 0, g(Yes, No, false, false, "", "‵‵‵")},
- {0x2038, 0, 0, 0, f(Yes, false, "")},
- {0x203c, 0, 0, 0, g(Yes, No, false, false, "", "!!")},
- {0x203d, 0, 0, 0, f(Yes, false, "")},
- {0x203e, 0, 0, 1, g(Yes, No, false, false, "", " ̅")},
- {0x203f, 0, 0, 0, f(Yes, false, "")},
- {0x2047, 0, 0, 0, g(Yes, No, false, false, "", "??")},
- {0x2048, 0, 0, 0, g(Yes, No, false, false, "", "?!")},
- {0x2049, 0, 0, 0, g(Yes, No, false, false, "", "!?")},
- {0x204a, 0, 0, 0, f(Yes, false, "")},
- {0x2057, 0, 0, 0, g(Yes, No, false, false, "", "′′′′")},
- {0x2058, 0, 0, 0, f(Yes, false, "")},
- {0x205f, 0, 0, 0, g(Yes, No, false, false, "", " ")},
- {0x2060, 0, 0, 0, f(Yes, false, "")},
- {0x2070, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x2071, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x2072, 0, 0, 0, f(Yes, false, "")},
- {0x2074, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x2075, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x2076, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x2077, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x2078, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x2079, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x207a, 0, 0, 0, g(Yes, No, false, false, "", "+")},
- {0x207b, 0, 0, 0, g(Yes, No, false, false, "", "−")},
- {0x207c, 0, 0, 0, g(Yes, No, false, false, "", "=")},
- {0x207d, 0, 0, 0, g(Yes, No, false, false, "", "(")},
- {0x207e, 0, 0, 0, g(Yes, No, false, false, "", ")")},
- {0x207f, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x2080, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x2081, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0x2082, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0x2083, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0x2084, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x2085, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x2086, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x2087, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x2088, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x2089, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x208a, 0, 0, 0, g(Yes, No, false, false, "", "+")},
- {0x208b, 0, 0, 0, g(Yes, No, false, false, "", "−")},
- {0x208c, 0, 0, 0, g(Yes, No, false, false, "", "=")},
- {0x208d, 0, 0, 0, g(Yes, No, false, false, "", "(")},
- {0x208e, 0, 0, 0, g(Yes, No, false, false, "", ")")},
- {0x208f, 0, 0, 0, f(Yes, false, "")},
- {0x2090, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x2091, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x2092, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x2093, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x2094, 0, 0, 0, g(Yes, No, false, false, "", "ə")},
- {0x2095, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x2096, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x2097, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x2098, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x2099, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x209a, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x209b, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x209c, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x209d, 0, 0, 0, f(Yes, false, "")},
- {0x20a8, 0, 0, 0, g(Yes, No, false, false, "", "Rs")},
- {0x20a9, 0, 0, 0, f(Yes, false, "")},
- {0x20d0, 230, 1, 1, f(Yes, false, "")},
- {0x20d2, 1, 1, 1, f(Yes, false, "")},
- {0x20d4, 230, 1, 1, f(Yes, false, "")},
- {0x20d8, 1, 1, 1, f(Yes, false, "")},
- {0x20db, 230, 1, 1, f(Yes, false, "")},
- {0x20dd, 0, 0, 0, f(Yes, false, "")},
- {0x20e1, 230, 1, 1, f(Yes, false, "")},
- {0x20e2, 0, 0, 0, f(Yes, false, "")},
- {0x20e5, 1, 1, 1, f(Yes, false, "")},
- {0x20e7, 230, 1, 1, f(Yes, false, "")},
- {0x20e8, 220, 1, 1, f(Yes, false, "")},
- {0x20e9, 230, 1, 1, f(Yes, false, "")},
- {0x20ea, 1, 1, 1, f(Yes, false, "")},
- {0x20ec, 220, 1, 1, f(Yes, false, "")},
- {0x20f0, 230, 1, 1, f(Yes, false, "")},
- {0x20f1, 0, 0, 0, f(Yes, false, "")},
- {0x2100, 0, 0, 0, g(Yes, No, false, false, "", "a/c")},
- {0x2101, 0, 0, 0, g(Yes, No, false, false, "", "a/s")},
- {0x2102, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x2103, 0, 0, 0, g(Yes, No, false, false, "", "°C")},
- {0x2104, 0, 0, 0, f(Yes, false, "")},
- {0x2105, 0, 0, 0, g(Yes, No, false, false, "", "c/o")},
- {0x2106, 0, 0, 0, g(Yes, No, false, false, "", "c/u")},
- {0x2107, 0, 0, 0, g(Yes, No, false, false, "", "Ɛ")},
- {0x2108, 0, 0, 0, f(Yes, false, "")},
- {0x2109, 0, 0, 0, g(Yes, No, false, false, "", "°F")},
- {0x210a, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x210b, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x210e, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x210f, 0, 0, 0, g(Yes, No, false, false, "", "ħ")},
- {0x2110, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x2112, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x2113, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x2114, 0, 0, 0, f(Yes, false, "")},
- {0x2115, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x2116, 0, 0, 0, g(Yes, No, false, false, "", "No")},
- {0x2117, 0, 0, 0, f(Yes, false, "")},
- {0x2119, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x211a, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x211b, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x211e, 0, 0, 0, f(Yes, false, "")},
- {0x2120, 0, 0, 0, g(Yes, No, false, false, "", "SM")},
- {0x2121, 0, 0, 0, g(Yes, No, false, false, "", "TEL")},
- {0x2122, 0, 0, 0, g(Yes, No, false, false, "", "TM")},
- {0x2123, 0, 0, 0, f(Yes, false, "")},
- {0x2124, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x2125, 0, 0, 0, f(Yes, false, "")},
- {0x2126, 0, 0, 0, f(No, false, "Ω")},
- {0x2127, 0, 0, 0, f(Yes, false, "")},
- {0x2128, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x2129, 0, 0, 0, f(Yes, false, "")},
- {0x212a, 0, 0, 0, f(No, false, "K")},
- {0x212b, 0, 0, 1, f(No, false, "Å")},
- {0x212c, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x212d, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x212e, 0, 0, 0, f(Yes, false, "")},
- {0x212f, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x2130, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x2131, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x2132, 0, 0, 0, f(Yes, false, "")},
- {0x2133, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x2134, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x2135, 0, 0, 0, g(Yes, No, false, false, "", "א")},
- {0x2136, 0, 0, 0, g(Yes, No, false, false, "", "ב")},
- {0x2137, 0, 0, 0, g(Yes, No, false, false, "", "ג")},
- {0x2138, 0, 0, 0, g(Yes, No, false, false, "", "ד")},
- {0x2139, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x213a, 0, 0, 0, f(Yes, false, "")},
- {0x213b, 0, 0, 0, g(Yes, No, false, false, "", "FAX")},
- {0x213c, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x213d, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x213e, 0, 0, 0, g(Yes, No, false, false, "", "Γ")},
- {0x213f, 0, 0, 0, g(Yes, No, false, false, "", "Π")},
- {0x2140, 0, 0, 0, g(Yes, No, false, false, "", "∑")},
- {0x2141, 0, 0, 0, f(Yes, false, "")},
- {0x2145, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x2146, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x2147, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x2148, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x2149, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x214a, 0, 0, 0, f(Yes, false, "")},
- {0x2150, 0, 0, 0, g(Yes, No, false, false, "", "1⁄7")},
- {0x2151, 0, 0, 0, g(Yes, No, false, false, "", "1⁄9")},
- {0x2152, 0, 0, 0, g(Yes, No, false, false, "", "1⁄10")},
- {0x2153, 0, 0, 0, g(Yes, No, false, false, "", "1⁄3")},
- {0x2154, 0, 0, 0, g(Yes, No, false, false, "", "2⁄3")},
- {0x2155, 0, 0, 0, g(Yes, No, false, false, "", "1⁄5")},
- {0x2156, 0, 0, 0, g(Yes, No, false, false, "", "2⁄5")},
- {0x2157, 0, 0, 0, g(Yes, No, false, false, "", "3⁄5")},
- {0x2158, 0, 0, 0, g(Yes, No, false, false, "", "4⁄5")},
- {0x2159, 0, 0, 0, g(Yes, No, false, false, "", "1⁄6")},
- {0x215a, 0, 0, 0, g(Yes, No, false, false, "", "5⁄6")},
- {0x215b, 0, 0, 0, g(Yes, No, false, false, "", "1⁄8")},
- {0x215c, 0, 0, 0, g(Yes, No, false, false, "", "3⁄8")},
- {0x215d, 0, 0, 0, g(Yes, No, false, false, "", "5⁄8")},
- {0x215e, 0, 0, 0, g(Yes, No, false, false, "", "7⁄8")},
- {0x215f, 0, 0, 0, g(Yes, No, false, false, "", "1⁄")},
- {0x2160, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x2161, 0, 0, 0, g(Yes, No, false, false, "", "II")},
- {0x2162, 0, 0, 0, g(Yes, No, false, false, "", "III")},
- {0x2163, 0, 0, 0, g(Yes, No, false, false, "", "IV")},
- {0x2164, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x2165, 0, 0, 0, g(Yes, No, false, false, "", "VI")},
- {0x2166, 0, 0, 0, g(Yes, No, false, false, "", "VII")},
- {0x2167, 0, 0, 0, g(Yes, No, false, false, "", "VIII")},
- {0x2168, 0, 0, 0, g(Yes, No, false, false, "", "IX")},
- {0x2169, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x216a, 0, 0, 0, g(Yes, No, false, false, "", "XI")},
- {0x216b, 0, 0, 0, g(Yes, No, false, false, "", "XII")},
- {0x216c, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x216d, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x216e, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x216f, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x2170, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x2171, 0, 0, 0, g(Yes, No, false, false, "", "ii")},
- {0x2172, 0, 0, 0, g(Yes, No, false, false, "", "iii")},
- {0x2173, 0, 0, 0, g(Yes, No, false, false, "", "iv")},
- {0x2174, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x2175, 0, 0, 0, g(Yes, No, false, false, "", "vi")},
- {0x2176, 0, 0, 0, g(Yes, No, false, false, "", "vii")},
- {0x2177, 0, 0, 0, g(Yes, No, false, false, "", "viii")},
- {0x2178, 0, 0, 0, g(Yes, No, false, false, "", "ix")},
- {0x2179, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x217a, 0, 0, 0, g(Yes, No, false, false, "", "xi")},
- {0x217b, 0, 0, 0, g(Yes, No, false, false, "", "xii")},
- {0x217c, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x217d, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x217e, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x217f, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x2180, 0, 0, 0, f(Yes, false, "")},
- {0x2189, 0, 0, 0, g(Yes, No, false, false, "", "0⁄3")},
- {0x218a, 0, 0, 0, f(Yes, false, "")},
- {0x2190, 0, 0, 0, f(Yes, true, "")},
- {0x2191, 0, 0, 0, f(Yes, false, "")},
- {0x2192, 0, 0, 0, f(Yes, true, "")},
- {0x2193, 0, 0, 0, f(Yes, false, "")},
- {0x2194, 0, 0, 0, f(Yes, true, "")},
- {0x2195, 0, 0, 0, f(Yes, false, "")},
- {0x219a, 0, 0, 1, f(Yes, false, "↚")},
- {0x219b, 0, 0, 1, f(Yes, false, "↛")},
- {0x219c, 0, 0, 0, f(Yes, false, "")},
- {0x21ae, 0, 0, 1, f(Yes, false, "↮")},
- {0x21af, 0, 0, 0, f(Yes, false, "")},
- {0x21cd, 0, 0, 1, f(Yes, false, "⇍")},
- {0x21ce, 0, 0, 1, f(Yes, false, "⇎")},
- {0x21cf, 0, 0, 1, f(Yes, false, "⇏")},
- {0x21d0, 0, 0, 0, f(Yes, true, "")},
- {0x21d1, 0, 0, 0, f(Yes, false, "")},
- {0x21d2, 0, 0, 0, f(Yes, true, "")},
- {0x21d3, 0, 0, 0, f(Yes, false, "")},
- {0x21d4, 0, 0, 0, f(Yes, true, "")},
- {0x21d5, 0, 0, 0, f(Yes, false, "")},
- {0x2203, 0, 0, 0, f(Yes, true, "")},
- {0x2204, 0, 0, 1, f(Yes, false, "∄")},
- {0x2205, 0, 0, 0, f(Yes, false, "")},
- {0x2208, 0, 0, 0, f(Yes, true, "")},
- {0x2209, 0, 0, 1, f(Yes, false, "∉")},
- {0x220a, 0, 0, 0, f(Yes, false, "")},
- {0x220b, 0, 0, 0, f(Yes, true, "")},
- {0x220c, 0, 0, 1, f(Yes, false, "∌")},
- {0x220d, 0, 0, 0, f(Yes, false, "")},
- {0x2223, 0, 0, 0, f(Yes, true, "")},
- {0x2224, 0, 0, 1, f(Yes, false, "∤")},
- {0x2225, 0, 0, 0, f(Yes, true, "")},
- {0x2226, 0, 0, 1, f(Yes, false, "∦")},
- {0x2227, 0, 0, 0, f(Yes, false, "")},
- {0x222c, 0, 0, 0, g(Yes, No, false, false, "", "∫∫")},
- {0x222d, 0, 0, 0, g(Yes, No, false, false, "", "∫∫∫")},
- {0x222e, 0, 0, 0, f(Yes, false, "")},
- {0x222f, 0, 0, 0, g(Yes, No, false, false, "", "∮∮")},
- {0x2230, 0, 0, 0, g(Yes, No, false, false, "", "∮∮∮")},
- {0x2231, 0, 0, 0, f(Yes, false, "")},
- {0x223c, 0, 0, 0, f(Yes, true, "")},
- {0x223d, 0, 0, 0, f(Yes, false, "")},
- {0x2241, 0, 0, 1, f(Yes, false, "≁")},
- {0x2242, 0, 0, 0, f(Yes, false, "")},
- {0x2243, 0, 0, 0, f(Yes, true, "")},
- {0x2244, 0, 0, 1, f(Yes, false, "≄")},
- {0x2245, 0, 0, 0, f(Yes, true, "")},
- {0x2246, 0, 0, 0, f(Yes, false, "")},
- {0x2247, 0, 0, 1, f(Yes, false, "≇")},
- {0x2248, 0, 0, 0, f(Yes, true, "")},
- {0x2249, 0, 0, 1, f(Yes, false, "≉")},
- {0x224a, 0, 0, 0, f(Yes, false, "")},
- {0x224d, 0, 0, 0, f(Yes, true, "")},
- {0x224e, 0, 0, 0, f(Yes, false, "")},
- {0x2260, 0, 0, 1, f(Yes, false, "≠")},
- {0x2261, 0, 0, 0, f(Yes, true, "")},
- {0x2262, 0, 0, 1, f(Yes, false, "≢")},
- {0x2263, 0, 0, 0, f(Yes, false, "")},
- {0x2264, 0, 0, 0, f(Yes, true, "")},
- {0x2266, 0, 0, 0, f(Yes, false, "")},
- {0x226d, 0, 0, 1, f(Yes, false, "≭")},
- {0x226e, 0, 0, 1, f(Yes, false, "≮")},
- {0x226f, 0, 0, 1, f(Yes, false, "≯")},
- {0x2270, 0, 0, 1, f(Yes, false, "≰")},
- {0x2271, 0, 0, 1, f(Yes, false, "≱")},
- {0x2272, 0, 0, 0, f(Yes, true, "")},
- {0x2274, 0, 0, 1, f(Yes, false, "≴")},
- {0x2275, 0, 0, 1, f(Yes, false, "≵")},
- {0x2276, 0, 0, 0, f(Yes, true, "")},
- {0x2278, 0, 0, 1, f(Yes, false, "≸")},
- {0x2279, 0, 0, 1, f(Yes, false, "≹")},
- {0x227a, 0, 0, 0, f(Yes, true, "")},
- {0x227e, 0, 0, 0, f(Yes, false, "")},
- {0x2280, 0, 0, 1, f(Yes, false, "⊀")},
- {0x2281, 0, 0, 1, f(Yes, false, "⊁")},
- {0x2282, 0, 0, 0, f(Yes, true, "")},
- {0x2284, 0, 0, 1, f(Yes, false, "⊄")},
- {0x2285, 0, 0, 1, f(Yes, false, "⊅")},
- {0x2286, 0, 0, 0, f(Yes, true, "")},
- {0x2288, 0, 0, 1, f(Yes, false, "⊈")},
- {0x2289, 0, 0, 1, f(Yes, false, "⊉")},
- {0x228a, 0, 0, 0, f(Yes, false, "")},
- {0x2291, 0, 0, 0, f(Yes, true, "")},
- {0x2293, 0, 0, 0, f(Yes, false, "")},
- {0x22a2, 0, 0, 0, f(Yes, true, "")},
- {0x22a3, 0, 0, 0, f(Yes, false, "")},
- {0x22a8, 0, 0, 0, f(Yes, true, "")},
- {0x22aa, 0, 0, 0, f(Yes, false, "")},
- {0x22ab, 0, 0, 0, f(Yes, true, "")},
- {0x22ac, 0, 0, 1, f(Yes, false, "⊬")},
- {0x22ad, 0, 0, 1, f(Yes, false, "⊭")},
- {0x22ae, 0, 0, 1, f(Yes, false, "⊮")},
- {0x22af, 0, 0, 1, f(Yes, false, "⊯")},
- {0x22b0, 0, 0, 0, f(Yes, false, "")},
- {0x22b2, 0, 0, 0, f(Yes, true, "")},
- {0x22b6, 0, 0, 0, f(Yes, false, "")},
- {0x22e0, 0, 0, 1, f(Yes, false, "⋠")},
- {0x22e1, 0, 0, 1, f(Yes, false, "⋡")},
- {0x22e2, 0, 0, 1, f(Yes, false, "⋢")},
- {0x22e3, 0, 0, 1, f(Yes, false, "⋣")},
- {0x22e4, 0, 0, 0, f(Yes, false, "")},
- {0x22ea, 0, 0, 1, f(Yes, false, "⋪")},
- {0x22eb, 0, 0, 1, f(Yes, false, "⋫")},
- {0x22ec, 0, 0, 1, f(Yes, false, "⋬")},
- {0x22ed, 0, 0, 1, f(Yes, false, "⋭")},
- {0x22ee, 0, 0, 0, f(Yes, false, "")},
- {0x2329, 0, 0, 0, f(No, false, "〈")},
- {0x232a, 0, 0, 0, f(No, false, "〉")},
- {0x232b, 0, 0, 0, f(Yes, false, "")},
- {0x2460, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0x2461, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0x2462, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0x2463, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x2464, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x2465, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x2466, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x2467, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x2468, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x2469, 0, 0, 0, g(Yes, No, false, false, "", "10")},
- {0x246a, 0, 0, 0, g(Yes, No, false, false, "", "11")},
- {0x246b, 0, 0, 0, g(Yes, No, false, false, "", "12")},
- {0x246c, 0, 0, 0, g(Yes, No, false, false, "", "13")},
- {0x246d, 0, 0, 0, g(Yes, No, false, false, "", "14")},
- {0x246e, 0, 0, 0, g(Yes, No, false, false, "", "15")},
- {0x246f, 0, 0, 0, g(Yes, No, false, false, "", "16")},
- {0x2470, 0, 0, 0, g(Yes, No, false, false, "", "17")},
- {0x2471, 0, 0, 0, g(Yes, No, false, false, "", "18")},
- {0x2472, 0, 0, 0, g(Yes, No, false, false, "", "19")},
- {0x2473, 0, 0, 0, g(Yes, No, false, false, "", "20")},
- {0x2474, 0, 0, 0, g(Yes, No, false, false, "", "(1)")},
- {0x2475, 0, 0, 0, g(Yes, No, false, false, "", "(2)")},
- {0x2476, 0, 0, 0, g(Yes, No, false, false, "", "(3)")},
- {0x2477, 0, 0, 0, g(Yes, No, false, false, "", "(4)")},
- {0x2478, 0, 0, 0, g(Yes, No, false, false, "", "(5)")},
- {0x2479, 0, 0, 0, g(Yes, No, false, false, "", "(6)")},
- {0x247a, 0, 0, 0, g(Yes, No, false, false, "", "(7)")},
- {0x247b, 0, 0, 0, g(Yes, No, false, false, "", "(8)")},
- {0x247c, 0, 0, 0, g(Yes, No, false, false, "", "(9)")},
- {0x247d, 0, 0, 0, g(Yes, No, false, false, "", "(10)")},
- {0x247e, 0, 0, 0, g(Yes, No, false, false, "", "(11)")},
- {0x247f, 0, 0, 0, g(Yes, No, false, false, "", "(12)")},
- {0x2480, 0, 0, 0, g(Yes, No, false, false, "", "(13)")},
- {0x2481, 0, 0, 0, g(Yes, No, false, false, "", "(14)")},
- {0x2482, 0, 0, 0, g(Yes, No, false, false, "", "(15)")},
- {0x2483, 0, 0, 0, g(Yes, No, false, false, "", "(16)")},
- {0x2484, 0, 0, 0, g(Yes, No, false, false, "", "(17)")},
- {0x2485, 0, 0, 0, g(Yes, No, false, false, "", "(18)")},
- {0x2486, 0, 0, 0, g(Yes, No, false, false, "", "(19)")},
- {0x2487, 0, 0, 0, g(Yes, No, false, false, "", "(20)")},
- {0x2488, 0, 0, 0, g(Yes, No, false, false, "", "1.")},
- {0x2489, 0, 0, 0, g(Yes, No, false, false, "", "2.")},
- {0x248a, 0, 0, 0, g(Yes, No, false, false, "", "3.")},
- {0x248b, 0, 0, 0, g(Yes, No, false, false, "", "4.")},
- {0x248c, 0, 0, 0, g(Yes, No, false, false, "", "5.")},
- {0x248d, 0, 0, 0, g(Yes, No, false, false, "", "6.")},
- {0x248e, 0, 0, 0, g(Yes, No, false, false, "", "7.")},
- {0x248f, 0, 0, 0, g(Yes, No, false, false, "", "8.")},
- {0x2490, 0, 0, 0, g(Yes, No, false, false, "", "9.")},
- {0x2491, 0, 0, 0, g(Yes, No, false, false, "", "10.")},
- {0x2492, 0, 0, 0, g(Yes, No, false, false, "", "11.")},
- {0x2493, 0, 0, 0, g(Yes, No, false, false, "", "12.")},
- {0x2494, 0, 0, 0, g(Yes, No, false, false, "", "13.")},
- {0x2495, 0, 0, 0, g(Yes, No, false, false, "", "14.")},
- {0x2496, 0, 0, 0, g(Yes, No, false, false, "", "15.")},
- {0x2497, 0, 0, 0, g(Yes, No, false, false, "", "16.")},
- {0x2498, 0, 0, 0, g(Yes, No, false, false, "", "17.")},
- {0x2499, 0, 0, 0, g(Yes, No, false, false, "", "18.")},
- {0x249a, 0, 0, 0, g(Yes, No, false, false, "", "19.")},
- {0x249b, 0, 0, 0, g(Yes, No, false, false, "", "20.")},
- {0x249c, 0, 0, 0, g(Yes, No, false, false, "", "(a)")},
- {0x249d, 0, 0, 0, g(Yes, No, false, false, "", "(b)")},
- {0x249e, 0, 0, 0, g(Yes, No, false, false, "", "(c)")},
- {0x249f, 0, 0, 0, g(Yes, No, false, false, "", "(d)")},
- {0x24a0, 0, 0, 0, g(Yes, No, false, false, "", "(e)")},
- {0x24a1, 0, 0, 0, g(Yes, No, false, false, "", "(f)")},
- {0x24a2, 0, 0, 0, g(Yes, No, false, false, "", "(g)")},
- {0x24a3, 0, 0, 0, g(Yes, No, false, false, "", "(h)")},
- {0x24a4, 0, 0, 0, g(Yes, No, false, false, "", "(i)")},
- {0x24a5, 0, 0, 0, g(Yes, No, false, false, "", "(j)")},
- {0x24a6, 0, 0, 0, g(Yes, No, false, false, "", "(k)")},
- {0x24a7, 0, 0, 0, g(Yes, No, false, false, "", "(l)")},
- {0x24a8, 0, 0, 0, g(Yes, No, false, false, "", "(m)")},
- {0x24a9, 0, 0, 0, g(Yes, No, false, false, "", "(n)")},
- {0x24aa, 0, 0, 0, g(Yes, No, false, false, "", "(o)")},
- {0x24ab, 0, 0, 0, g(Yes, No, false, false, "", "(p)")},
- {0x24ac, 0, 0, 0, g(Yes, No, false, false, "", "(q)")},
- {0x24ad, 0, 0, 0, g(Yes, No, false, false, "", "(r)")},
- {0x24ae, 0, 0, 0, g(Yes, No, false, false, "", "(s)")},
- {0x24af, 0, 0, 0, g(Yes, No, false, false, "", "(t)")},
- {0x24b0, 0, 0, 0, g(Yes, No, false, false, "", "(u)")},
- {0x24b1, 0, 0, 0, g(Yes, No, false, false, "", "(v)")},
- {0x24b2, 0, 0, 0, g(Yes, No, false, false, "", "(w)")},
- {0x24b3, 0, 0, 0, g(Yes, No, false, false, "", "(x)")},
- {0x24b4, 0, 0, 0, g(Yes, No, false, false, "", "(y)")},
- {0x24b5, 0, 0, 0, g(Yes, No, false, false, "", "(z)")},
- {0x24b6, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x24b7, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x24b8, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x24b9, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x24ba, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x24bb, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x24bc, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x24bd, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x24be, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x24bf, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x24c0, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x24c1, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x24c2, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x24c3, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x24c4, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x24c5, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x24c6, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x24c7, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x24c8, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x24c9, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x24ca, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x24cb, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x24cc, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x24cd, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x24ce, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x24cf, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x24d0, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x24d1, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x24d2, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x24d3, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x24d4, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x24d5, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x24d6, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x24d7, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x24d8, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x24d9, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x24da, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x24db, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x24dc, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x24dd, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x24de, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x24df, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x24e0, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x24e1, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x24e2, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x24e3, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x24e4, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x24e5, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x24e6, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x24e7, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x24e8, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x24e9, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x24ea, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x24eb, 0, 0, 0, f(Yes, false, "")},
- {0x2a0c, 0, 0, 0, g(Yes, No, false, false, "", "∫∫∫∫")},
- {0x2a0d, 0, 0, 0, f(Yes, false, "")},
- {0x2a74, 0, 0, 0, g(Yes, No, false, false, "", "::=")},
- {0x2a75, 0, 0, 0, g(Yes, No, false, false, "", "==")},
- {0x2a76, 0, 0, 0, g(Yes, No, false, false, "", "===")},
- {0x2a77, 0, 0, 0, f(Yes, false, "")},
- {0x2adc, 0, 0, 1, f(No, false, "⫝̸")},
- {0x2add, 0, 0, 0, f(Yes, false, "")},
- {0x2c7c, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x2c7d, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x2c7e, 0, 0, 0, f(Yes, false, "")},
- {0x2cef, 230, 1, 1, f(Yes, false, "")},
- {0x2cf2, 0, 0, 0, f(Yes, false, "")},
- {0x2d6f, 0, 0, 0, g(Yes, No, false, false, "", "ⵡ")},
- {0x2d70, 0, 0, 0, f(Yes, false, "")},
- {0x2d7f, 9, 1, 1, f(Yes, false, "")},
- {0x2d80, 0, 0, 0, f(Yes, false, "")},
- {0x2de0, 230, 1, 1, f(Yes, false, "")},
- {0x2e00, 0, 0, 0, f(Yes, false, "")},
- {0x2e9f, 0, 0, 0, g(Yes, No, false, false, "", "母")},
- {0x2ea0, 0, 0, 0, f(Yes, false, "")},
- {0x2ef3, 0, 0, 0, g(Yes, No, false, false, "", "龟")},
- {0x2ef4, 0, 0, 0, f(Yes, false, "")},
- {0x2f00, 0, 0, 0, g(Yes, No, false, false, "", "一")},
- {0x2f01, 0, 0, 0, g(Yes, No, false, false, "", "丨")},
- {0x2f02, 0, 0, 0, g(Yes, No, false, false, "", "丶")},
- {0x2f03, 0, 0, 0, g(Yes, No, false, false, "", "丿")},
- {0x2f04, 0, 0, 0, g(Yes, No, false, false, "", "乙")},
- {0x2f05, 0, 0, 0, g(Yes, No, false, false, "", "亅")},
- {0x2f06, 0, 0, 0, g(Yes, No, false, false, "", "二")},
- {0x2f07, 0, 0, 0, g(Yes, No, false, false, "", "亠")},
- {0x2f08, 0, 0, 0, g(Yes, No, false, false, "", "人")},
- {0x2f09, 0, 0, 0, g(Yes, No, false, false, "", "儿")},
- {0x2f0a, 0, 0, 0, g(Yes, No, false, false, "", "入")},
- {0x2f0b, 0, 0, 0, g(Yes, No, false, false, "", "八")},
- {0x2f0c, 0, 0, 0, g(Yes, No, false, false, "", "冂")},
- {0x2f0d, 0, 0, 0, g(Yes, No, false, false, "", "冖")},
- {0x2f0e, 0, 0, 0, g(Yes, No, false, false, "", "冫")},
- {0x2f0f, 0, 0, 0, g(Yes, No, false, false, "", "几")},
- {0x2f10, 0, 0, 0, g(Yes, No, false, false, "", "凵")},
- {0x2f11, 0, 0, 0, g(Yes, No, false, false, "", "刀")},
- {0x2f12, 0, 0, 0, g(Yes, No, false, false, "", "力")},
- {0x2f13, 0, 0, 0, g(Yes, No, false, false, "", "勹")},
- {0x2f14, 0, 0, 0, g(Yes, No, false, false, "", "匕")},
- {0x2f15, 0, 0, 0, g(Yes, No, false, false, "", "匚")},
- {0x2f16, 0, 0, 0, g(Yes, No, false, false, "", "匸")},
- {0x2f17, 0, 0, 0, g(Yes, No, false, false, "", "十")},
- {0x2f18, 0, 0, 0, g(Yes, No, false, false, "", "卜")},
- {0x2f19, 0, 0, 0, g(Yes, No, false, false, "", "卩")},
- {0x2f1a, 0, 0, 0, g(Yes, No, false, false, "", "厂")},
- {0x2f1b, 0, 0, 0, g(Yes, No, false, false, "", "厶")},
- {0x2f1c, 0, 0, 0, g(Yes, No, false, false, "", "又")},
- {0x2f1d, 0, 0, 0, g(Yes, No, false, false, "", "口")},
- {0x2f1e, 0, 0, 0, g(Yes, No, false, false, "", "囗")},
- {0x2f1f, 0, 0, 0, g(Yes, No, false, false, "", "土")},
- {0x2f20, 0, 0, 0, g(Yes, No, false, false, "", "士")},
- {0x2f21, 0, 0, 0, g(Yes, No, false, false, "", "夂")},
- {0x2f22, 0, 0, 0, g(Yes, No, false, false, "", "夊")},
- {0x2f23, 0, 0, 0, g(Yes, No, false, false, "", "夕")},
- {0x2f24, 0, 0, 0, g(Yes, No, false, false, "", "大")},
- {0x2f25, 0, 0, 0, g(Yes, No, false, false, "", "女")},
- {0x2f26, 0, 0, 0, g(Yes, No, false, false, "", "子")},
- {0x2f27, 0, 0, 0, g(Yes, No, false, false, "", "宀")},
- {0x2f28, 0, 0, 0, g(Yes, No, false, false, "", "寸")},
- {0x2f29, 0, 0, 0, g(Yes, No, false, false, "", "小")},
- {0x2f2a, 0, 0, 0, g(Yes, No, false, false, "", "尢")},
- {0x2f2b, 0, 0, 0, g(Yes, No, false, false, "", "尸")},
- {0x2f2c, 0, 0, 0, g(Yes, No, false, false, "", "屮")},
- {0x2f2d, 0, 0, 0, g(Yes, No, false, false, "", "山")},
- {0x2f2e, 0, 0, 0, g(Yes, No, false, false, "", "巛")},
- {0x2f2f, 0, 0, 0, g(Yes, No, false, false, "", "工")},
- {0x2f30, 0, 0, 0, g(Yes, No, false, false, "", "己")},
- {0x2f31, 0, 0, 0, g(Yes, No, false, false, "", "巾")},
- {0x2f32, 0, 0, 0, g(Yes, No, false, false, "", "干")},
- {0x2f33, 0, 0, 0, g(Yes, No, false, false, "", "幺")},
- {0x2f34, 0, 0, 0, g(Yes, No, false, false, "", "广")},
- {0x2f35, 0, 0, 0, g(Yes, No, false, false, "", "廴")},
- {0x2f36, 0, 0, 0, g(Yes, No, false, false, "", "廾")},
- {0x2f37, 0, 0, 0, g(Yes, No, false, false, "", "弋")},
- {0x2f38, 0, 0, 0, g(Yes, No, false, false, "", "弓")},
- {0x2f39, 0, 0, 0, g(Yes, No, false, false, "", "彐")},
- {0x2f3a, 0, 0, 0, g(Yes, No, false, false, "", "彡")},
- {0x2f3b, 0, 0, 0, g(Yes, No, false, false, "", "彳")},
- {0x2f3c, 0, 0, 0, g(Yes, No, false, false, "", "心")},
- {0x2f3d, 0, 0, 0, g(Yes, No, false, false, "", "戈")},
- {0x2f3e, 0, 0, 0, g(Yes, No, false, false, "", "戶")},
- {0x2f3f, 0, 0, 0, g(Yes, No, false, false, "", "手")},
- {0x2f40, 0, 0, 0, g(Yes, No, false, false, "", "支")},
- {0x2f41, 0, 0, 0, g(Yes, No, false, false, "", "攴")},
- {0x2f42, 0, 0, 0, g(Yes, No, false, false, "", "文")},
- {0x2f43, 0, 0, 0, g(Yes, No, false, false, "", "斗")},
- {0x2f44, 0, 0, 0, g(Yes, No, false, false, "", "斤")},
- {0x2f45, 0, 0, 0, g(Yes, No, false, false, "", "方")},
- {0x2f46, 0, 0, 0, g(Yes, No, false, false, "", "无")},
- {0x2f47, 0, 0, 0, g(Yes, No, false, false, "", "日")},
- {0x2f48, 0, 0, 0, g(Yes, No, false, false, "", "曰")},
- {0x2f49, 0, 0, 0, g(Yes, No, false, false, "", "月")},
- {0x2f4a, 0, 0, 0, g(Yes, No, false, false, "", "木")},
- {0x2f4b, 0, 0, 0, g(Yes, No, false, false, "", "欠")},
- {0x2f4c, 0, 0, 0, g(Yes, No, false, false, "", "止")},
- {0x2f4d, 0, 0, 0, g(Yes, No, false, false, "", "歹")},
- {0x2f4e, 0, 0, 0, g(Yes, No, false, false, "", "殳")},
- {0x2f4f, 0, 0, 0, g(Yes, No, false, false, "", "毋")},
- {0x2f50, 0, 0, 0, g(Yes, No, false, false, "", "比")},
- {0x2f51, 0, 0, 0, g(Yes, No, false, false, "", "毛")},
- {0x2f52, 0, 0, 0, g(Yes, No, false, false, "", "氏")},
- {0x2f53, 0, 0, 0, g(Yes, No, false, false, "", "气")},
- {0x2f54, 0, 0, 0, g(Yes, No, false, false, "", "水")},
- {0x2f55, 0, 0, 0, g(Yes, No, false, false, "", "火")},
- {0x2f56, 0, 0, 0, g(Yes, No, false, false, "", "爪")},
- {0x2f57, 0, 0, 0, g(Yes, No, false, false, "", "父")},
- {0x2f58, 0, 0, 0, g(Yes, No, false, false, "", "爻")},
- {0x2f59, 0, 0, 0, g(Yes, No, false, false, "", "爿")},
- {0x2f5a, 0, 0, 0, g(Yes, No, false, false, "", "片")},
- {0x2f5b, 0, 0, 0, g(Yes, No, false, false, "", "牙")},
- {0x2f5c, 0, 0, 0, g(Yes, No, false, false, "", "牛")},
- {0x2f5d, 0, 0, 0, g(Yes, No, false, false, "", "犬")},
- {0x2f5e, 0, 0, 0, g(Yes, No, false, false, "", "玄")},
- {0x2f5f, 0, 0, 0, g(Yes, No, false, false, "", "玉")},
- {0x2f60, 0, 0, 0, g(Yes, No, false, false, "", "瓜")},
- {0x2f61, 0, 0, 0, g(Yes, No, false, false, "", "瓦")},
- {0x2f62, 0, 0, 0, g(Yes, No, false, false, "", "甘")},
- {0x2f63, 0, 0, 0, g(Yes, No, false, false, "", "生")},
- {0x2f64, 0, 0, 0, g(Yes, No, false, false, "", "用")},
- {0x2f65, 0, 0, 0, g(Yes, No, false, false, "", "田")},
- {0x2f66, 0, 0, 0, g(Yes, No, false, false, "", "疋")},
- {0x2f67, 0, 0, 0, g(Yes, No, false, false, "", "疒")},
- {0x2f68, 0, 0, 0, g(Yes, No, false, false, "", "癶")},
- {0x2f69, 0, 0, 0, g(Yes, No, false, false, "", "白")},
- {0x2f6a, 0, 0, 0, g(Yes, No, false, false, "", "皮")},
- {0x2f6b, 0, 0, 0, g(Yes, No, false, false, "", "皿")},
- {0x2f6c, 0, 0, 0, g(Yes, No, false, false, "", "目")},
- {0x2f6d, 0, 0, 0, g(Yes, No, false, false, "", "矛")},
- {0x2f6e, 0, 0, 0, g(Yes, No, false, false, "", "矢")},
- {0x2f6f, 0, 0, 0, g(Yes, No, false, false, "", "石")},
- {0x2f70, 0, 0, 0, g(Yes, No, false, false, "", "示")},
- {0x2f71, 0, 0, 0, g(Yes, No, false, false, "", "禸")},
- {0x2f72, 0, 0, 0, g(Yes, No, false, false, "", "禾")},
- {0x2f73, 0, 0, 0, g(Yes, No, false, false, "", "穴")},
- {0x2f74, 0, 0, 0, g(Yes, No, false, false, "", "立")},
- {0x2f75, 0, 0, 0, g(Yes, No, false, false, "", "竹")},
- {0x2f76, 0, 0, 0, g(Yes, No, false, false, "", "米")},
- {0x2f77, 0, 0, 0, g(Yes, No, false, false, "", "糸")},
- {0x2f78, 0, 0, 0, g(Yes, No, false, false, "", "缶")},
- {0x2f79, 0, 0, 0, g(Yes, No, false, false, "", "网")},
- {0x2f7a, 0, 0, 0, g(Yes, No, false, false, "", "羊")},
- {0x2f7b, 0, 0, 0, g(Yes, No, false, false, "", "羽")},
- {0x2f7c, 0, 0, 0, g(Yes, No, false, false, "", "老")},
- {0x2f7d, 0, 0, 0, g(Yes, No, false, false, "", "而")},
- {0x2f7e, 0, 0, 0, g(Yes, No, false, false, "", "耒")},
- {0x2f7f, 0, 0, 0, g(Yes, No, false, false, "", "耳")},
- {0x2f80, 0, 0, 0, g(Yes, No, false, false, "", "聿")},
- {0x2f81, 0, 0, 0, g(Yes, No, false, false, "", "肉")},
- {0x2f82, 0, 0, 0, g(Yes, No, false, false, "", "臣")},
- {0x2f83, 0, 0, 0, g(Yes, No, false, false, "", "自")},
- {0x2f84, 0, 0, 0, g(Yes, No, false, false, "", "至")},
- {0x2f85, 0, 0, 0, g(Yes, No, false, false, "", "臼")},
- {0x2f86, 0, 0, 0, g(Yes, No, false, false, "", "舌")},
- {0x2f87, 0, 0, 0, g(Yes, No, false, false, "", "舛")},
- {0x2f88, 0, 0, 0, g(Yes, No, false, false, "", "舟")},
- {0x2f89, 0, 0, 0, g(Yes, No, false, false, "", "艮")},
- {0x2f8a, 0, 0, 0, g(Yes, No, false, false, "", "色")},
- {0x2f8b, 0, 0, 0, g(Yes, No, false, false, "", "艸")},
- {0x2f8c, 0, 0, 0, g(Yes, No, false, false, "", "虍")},
- {0x2f8d, 0, 0, 0, g(Yes, No, false, false, "", "虫")},
- {0x2f8e, 0, 0, 0, g(Yes, No, false, false, "", "血")},
- {0x2f8f, 0, 0, 0, g(Yes, No, false, false, "", "行")},
- {0x2f90, 0, 0, 0, g(Yes, No, false, false, "", "衣")},
- {0x2f91, 0, 0, 0, g(Yes, No, false, false, "", "襾")},
- {0x2f92, 0, 0, 0, g(Yes, No, false, false, "", "見")},
- {0x2f93, 0, 0, 0, g(Yes, No, false, false, "", "角")},
- {0x2f94, 0, 0, 0, g(Yes, No, false, false, "", "言")},
- {0x2f95, 0, 0, 0, g(Yes, No, false, false, "", "谷")},
- {0x2f96, 0, 0, 0, g(Yes, No, false, false, "", "豆")},
- {0x2f97, 0, 0, 0, g(Yes, No, false, false, "", "豕")},
- {0x2f98, 0, 0, 0, g(Yes, No, false, false, "", "豸")},
- {0x2f99, 0, 0, 0, g(Yes, No, false, false, "", "貝")},
- {0x2f9a, 0, 0, 0, g(Yes, No, false, false, "", "赤")},
- {0x2f9b, 0, 0, 0, g(Yes, No, false, false, "", "走")},
- {0x2f9c, 0, 0, 0, g(Yes, No, false, false, "", "足")},
- {0x2f9d, 0, 0, 0, g(Yes, No, false, false, "", "身")},
- {0x2f9e, 0, 0, 0, g(Yes, No, false, false, "", "車")},
- {0x2f9f, 0, 0, 0, g(Yes, No, false, false, "", "辛")},
- {0x2fa0, 0, 0, 0, g(Yes, No, false, false, "", "辰")},
- {0x2fa1, 0, 0, 0, g(Yes, No, false, false, "", "辵")},
- {0x2fa2, 0, 0, 0, g(Yes, No, false, false, "", "邑")},
- {0x2fa3, 0, 0, 0, g(Yes, No, false, false, "", "酉")},
- {0x2fa4, 0, 0, 0, g(Yes, No, false, false, "", "釆")},
- {0x2fa5, 0, 0, 0, g(Yes, No, false, false, "", "里")},
- {0x2fa6, 0, 0, 0, g(Yes, No, false, false, "", "金")},
- {0x2fa7, 0, 0, 0, g(Yes, No, false, false, "", "長")},
- {0x2fa8, 0, 0, 0, g(Yes, No, false, false, "", "門")},
- {0x2fa9, 0, 0, 0, g(Yes, No, false, false, "", "阜")},
- {0x2faa, 0, 0, 0, g(Yes, No, false, false, "", "隶")},
- {0x2fab, 0, 0, 0, g(Yes, No, false, false, "", "隹")},
- {0x2fac, 0, 0, 0, g(Yes, No, false, false, "", "雨")},
- {0x2fad, 0, 0, 0, g(Yes, No, false, false, "", "靑")},
- {0x2fae, 0, 0, 0, g(Yes, No, false, false, "", "非")},
- {0x2faf, 0, 0, 0, g(Yes, No, false, false, "", "面")},
- {0x2fb0, 0, 0, 0, g(Yes, No, false, false, "", "革")},
- {0x2fb1, 0, 0, 0, g(Yes, No, false, false, "", "韋")},
- {0x2fb2, 0, 0, 0, g(Yes, No, false, false, "", "韭")},
- {0x2fb3, 0, 0, 0, g(Yes, No, false, false, "", "音")},
- {0x2fb4, 0, 0, 0, g(Yes, No, false, false, "", "頁")},
- {0x2fb5, 0, 0, 0, g(Yes, No, false, false, "", "風")},
- {0x2fb6, 0, 0, 0, g(Yes, No, false, false, "", "飛")},
- {0x2fb7, 0, 0, 0, g(Yes, No, false, false, "", "食")},
- {0x2fb8, 0, 0, 0, g(Yes, No, false, false, "", "首")},
- {0x2fb9, 0, 0, 0, g(Yes, No, false, false, "", "香")},
- {0x2fba, 0, 0, 0, g(Yes, No, false, false, "", "馬")},
- {0x2fbb, 0, 0, 0, g(Yes, No, false, false, "", "骨")},
- {0x2fbc, 0, 0, 0, g(Yes, No, false, false, "", "高")},
- {0x2fbd, 0, 0, 0, g(Yes, No, false, false, "", "髟")},
- {0x2fbe, 0, 0, 0, g(Yes, No, false, false, "", "鬥")},
- {0x2fbf, 0, 0, 0, g(Yes, No, false, false, "", "鬯")},
- {0x2fc0, 0, 0, 0, g(Yes, No, false, false, "", "鬲")},
- {0x2fc1, 0, 0, 0, g(Yes, No, false, false, "", "鬼")},
- {0x2fc2, 0, 0, 0, g(Yes, No, false, false, "", "魚")},
- {0x2fc3, 0, 0, 0, g(Yes, No, false, false, "", "鳥")},
- {0x2fc4, 0, 0, 0, g(Yes, No, false, false, "", "鹵")},
- {0x2fc5, 0, 0, 0, g(Yes, No, false, false, "", "鹿")},
- {0x2fc6, 0, 0, 0, g(Yes, No, false, false, "", "麥")},
- {0x2fc7, 0, 0, 0, g(Yes, No, false, false, "", "麻")},
- {0x2fc8, 0, 0, 0, g(Yes, No, false, false, "", "黃")},
- {0x2fc9, 0, 0, 0, g(Yes, No, false, false, "", "黍")},
- {0x2fca, 0, 0, 0, g(Yes, No, false, false, "", "黑")},
- {0x2fcb, 0, 0, 0, g(Yes, No, false, false, "", "黹")},
- {0x2fcc, 0, 0, 0, g(Yes, No, false, false, "", "黽")},
- {0x2fcd, 0, 0, 0, g(Yes, No, false, false, "", "鼎")},
- {0x2fce, 0, 0, 0, g(Yes, No, false, false, "", "鼓")},
- {0x2fcf, 0, 0, 0, g(Yes, No, false, false, "", "鼠")},
- {0x2fd0, 0, 0, 0, g(Yes, No, false, false, "", "鼻")},
- {0x2fd1, 0, 0, 0, g(Yes, No, false, false, "", "齊")},
- {0x2fd2, 0, 0, 0, g(Yes, No, false, false, "", "齒")},
- {0x2fd3, 0, 0, 0, g(Yes, No, false, false, "", "龍")},
- {0x2fd4, 0, 0, 0, g(Yes, No, false, false, "", "龜")},
- {0x2fd5, 0, 0, 0, g(Yes, No, false, false, "", "龠")},
- {0x2fd6, 0, 0, 0, f(Yes, false, "")},
- {0x3000, 0, 0, 0, g(Yes, No, false, false, "", " ")},
- {0x3001, 0, 0, 0, f(Yes, false, "")},
- {0x302a, 218, 1, 1, f(Yes, false, "")},
- {0x302b, 228, 1, 1, f(Yes, false, "")},
- {0x302c, 232, 1, 1, f(Yes, false, "")},
- {0x302d, 222, 1, 1, f(Yes, false, "")},
- {0x302e, 224, 1, 1, f(Yes, false, "")},
- {0x3030, 0, 0, 0, f(Yes, false, "")},
- {0x3036, 0, 0, 0, g(Yes, No, false, false, "", "〒")},
- {0x3037, 0, 0, 0, f(Yes, false, "")},
- {0x3038, 0, 0, 0, g(Yes, No, false, false, "", "十")},
- {0x3039, 0, 0, 0, g(Yes, No, false, false, "", "卄")},
- {0x303a, 0, 0, 0, g(Yes, No, false, false, "", "卅")},
- {0x303b, 0, 0, 0, f(Yes, false, "")},
- {0x3046, 0, 0, 0, f(Yes, true, "")},
- {0x3047, 0, 0, 0, f(Yes, false, "")},
- {0x304b, 0, 0, 0, f(Yes, true, "")},
- {0x304c, 0, 0, 1, f(Yes, false, "が")},
- {0x304d, 0, 0, 0, f(Yes, true, "")},
- {0x304e, 0, 0, 1, f(Yes, false, "ぎ")},
- {0x304f, 0, 0, 0, f(Yes, true, "")},
- {0x3050, 0, 0, 1, f(Yes, false, "ぐ")},
- {0x3051, 0, 0, 0, f(Yes, true, "")},
- {0x3052, 0, 0, 1, f(Yes, false, "げ")},
- {0x3053, 0, 0, 0, f(Yes, true, "")},
- {0x3054, 0, 0, 1, f(Yes, false, "ご")},
- {0x3055, 0, 0, 0, f(Yes, true, "")},
- {0x3056, 0, 0, 1, f(Yes, false, "ざ")},
- {0x3057, 0, 0, 0, f(Yes, true, "")},
- {0x3058, 0, 0, 1, f(Yes, false, "じ")},
- {0x3059, 0, 0, 0, f(Yes, true, "")},
- {0x305a, 0, 0, 1, f(Yes, false, "ず")},
- {0x305b, 0, 0, 0, f(Yes, true, "")},
- {0x305c, 0, 0, 1, f(Yes, false, "ぜ")},
- {0x305d, 0, 0, 0, f(Yes, true, "")},
- {0x305e, 0, 0, 1, f(Yes, false, "ぞ")},
- {0x305f, 0, 0, 0, f(Yes, true, "")},
- {0x3060, 0, 0, 1, f(Yes, false, "だ")},
- {0x3061, 0, 0, 0, f(Yes, true, "")},
- {0x3062, 0, 0, 1, f(Yes, false, "ぢ")},
- {0x3063, 0, 0, 0, f(Yes, false, "")},
- {0x3064, 0, 0, 0, f(Yes, true, "")},
- {0x3065, 0, 0, 1, f(Yes, false, "づ")},
- {0x3066, 0, 0, 0, f(Yes, true, "")},
- {0x3067, 0, 0, 1, f(Yes, false, "で")},
- {0x3068, 0, 0, 0, f(Yes, true, "")},
- {0x3069, 0, 0, 1, f(Yes, false, "ど")},
- {0x306a, 0, 0, 0, f(Yes, false, "")},
- {0x306f, 0, 0, 0, f(Yes, true, "")},
- {0x3070, 0, 0, 1, f(Yes, false, "ば")},
- {0x3071, 0, 0, 1, f(Yes, false, "ぱ")},
- {0x3072, 0, 0, 0, f(Yes, true, "")},
- {0x3073, 0, 0, 1, f(Yes, false, "び")},
- {0x3074, 0, 0, 1, f(Yes, false, "ぴ")},
- {0x3075, 0, 0, 0, f(Yes, true, "")},
- {0x3076, 0, 0, 1, f(Yes, false, "ぶ")},
- {0x3077, 0, 0, 1, f(Yes, false, "ぷ")},
- {0x3078, 0, 0, 0, f(Yes, true, "")},
- {0x3079, 0, 0, 1, f(Yes, false, "べ")},
- {0x307a, 0, 0, 1, f(Yes, false, "ぺ")},
- {0x307b, 0, 0, 0, f(Yes, true, "")},
- {0x307c, 0, 0, 1, f(Yes, false, "ぼ")},
- {0x307d, 0, 0, 1, f(Yes, false, "ぽ")},
- {0x307e, 0, 0, 0, f(Yes, false, "")},
- {0x3094, 0, 0, 1, f(Yes, false, "ゔ")},
- {0x3095, 0, 0, 0, f(Yes, false, "")},
- {0x3099, 8, 1, 1, f(Maybe, false, "")},
- {0x309b, 0, 0, 1, g(Yes, No, false, false, "", " ゙")},
- {0x309c, 0, 0, 1, g(Yes, No, false, false, "", " ゚")},
- {0x309d, 0, 0, 0, f(Yes, true, "")},
- {0x309e, 0, 0, 1, f(Yes, false, "ゞ")},
- {0x309f, 0, 0, 0, g(Yes, No, false, false, "", "より")},
- {0x30a0, 0, 0, 0, f(Yes, false, "")},
- {0x30a6, 0, 0, 0, f(Yes, true, "")},
- {0x30a7, 0, 0, 0, f(Yes, false, "")},
- {0x30ab, 0, 0, 0, f(Yes, true, "")},
- {0x30ac, 0, 0, 1, f(Yes, false, "ガ")},
- {0x30ad, 0, 0, 0, f(Yes, true, "")},
- {0x30ae, 0, 0, 1, f(Yes, false, "ギ")},
- {0x30af, 0, 0, 0, f(Yes, true, "")},
- {0x30b0, 0, 0, 1, f(Yes, false, "グ")},
- {0x30b1, 0, 0, 0, f(Yes, true, "")},
- {0x30b2, 0, 0, 1, f(Yes, false, "ゲ")},
- {0x30b3, 0, 0, 0, f(Yes, true, "")},
- {0x30b4, 0, 0, 1, f(Yes, false, "ゴ")},
- {0x30b5, 0, 0, 0, f(Yes, true, "")},
- {0x30b6, 0, 0, 1, f(Yes, false, "ザ")},
- {0x30b7, 0, 0, 0, f(Yes, true, "")},
- {0x30b8, 0, 0, 1, f(Yes, false, "ジ")},
- {0x30b9, 0, 0, 0, f(Yes, true, "")},
- {0x30ba, 0, 0, 1, f(Yes, false, "ズ")},
- {0x30bb, 0, 0, 0, f(Yes, true, "")},
- {0x30bc, 0, 0, 1, f(Yes, false, "ゼ")},
- {0x30bd, 0, 0, 0, f(Yes, true, "")},
- {0x30be, 0, 0, 1, f(Yes, false, "ゾ")},
- {0x30bf, 0, 0, 0, f(Yes, true, "")},
- {0x30c0, 0, 0, 1, f(Yes, false, "ダ")},
- {0x30c1, 0, 0, 0, f(Yes, true, "")},
- {0x30c2, 0, 0, 1, f(Yes, false, "ヂ")},
- {0x30c3, 0, 0, 0, f(Yes, false, "")},
- {0x30c4, 0, 0, 0, f(Yes, true, "")},
- {0x30c5, 0, 0, 1, f(Yes, false, "ヅ")},
- {0x30c6, 0, 0, 0, f(Yes, true, "")},
- {0x30c7, 0, 0, 1, f(Yes, false, "デ")},
- {0x30c8, 0, 0, 0, f(Yes, true, "")},
- {0x30c9, 0, 0, 1, f(Yes, false, "ド")},
- {0x30ca, 0, 0, 0, f(Yes, false, "")},
- {0x30cf, 0, 0, 0, f(Yes, true, "")},
- {0x30d0, 0, 0, 1, f(Yes, false, "バ")},
- {0x30d1, 0, 0, 1, f(Yes, false, "パ")},
- {0x30d2, 0, 0, 0, f(Yes, true, "")},
- {0x30d3, 0, 0, 1, f(Yes, false, "ビ")},
- {0x30d4, 0, 0, 1, f(Yes, false, "ピ")},
- {0x30d5, 0, 0, 0, f(Yes, true, "")},
- {0x30d6, 0, 0, 1, f(Yes, false, "ブ")},
- {0x30d7, 0, 0, 1, f(Yes, false, "プ")},
- {0x30d8, 0, 0, 0, f(Yes, true, "")},
- {0x30d9, 0, 0, 1, f(Yes, false, "ベ")},
- {0x30da, 0, 0, 1, f(Yes, false, "ペ")},
- {0x30db, 0, 0, 0, f(Yes, true, "")},
- {0x30dc, 0, 0, 1, f(Yes, false, "ボ")},
- {0x30dd, 0, 0, 1, f(Yes, false, "ポ")},
- {0x30de, 0, 0, 0, f(Yes, false, "")},
- {0x30ef, 0, 0, 0, f(Yes, true, "")},
- {0x30f3, 0, 0, 0, f(Yes, false, "")},
- {0x30f4, 0, 0, 1, f(Yes, false, "ヴ")},
- {0x30f5, 0, 0, 0, f(Yes, false, "")},
- {0x30f7, 0, 0, 1, f(Yes, false, "ヷ")},
- {0x30f8, 0, 0, 1, f(Yes, false, "ヸ")},
- {0x30f9, 0, 0, 1, f(Yes, false, "ヹ")},
- {0x30fa, 0, 0, 1, f(Yes, false, "ヺ")},
- {0x30fb, 0, 0, 0, f(Yes, false, "")},
- {0x30fd, 0, 0, 0, f(Yes, true, "")},
- {0x30fe, 0, 0, 1, f(Yes, false, "ヾ")},
- {0x30ff, 0, 0, 0, g(Yes, No, false, false, "", "コト")},
- {0x3100, 0, 0, 0, f(Yes, false, "")},
- {0x3131, 0, 0, 0, g(Yes, No, false, false, "", "ᄀ")},
- {0x3132, 0, 0, 0, g(Yes, No, false, false, "", "ᄁ")},
- {0x3133, 0, 1, 1, g(Yes, No, false, false, "", "ᆪ")},
- {0x3134, 0, 0, 0, g(Yes, No, false, false, "", "ᄂ")},
- {0x3135, 0, 1, 1, g(Yes, No, false, false, "", "ᆬ")},
- {0x3136, 0, 1, 1, g(Yes, No, false, false, "", "ᆭ")},
- {0x3137, 0, 0, 0, g(Yes, No, false, false, "", "ᄃ")},
- {0x3138, 0, 0, 0, g(Yes, No, false, false, "", "ᄄ")},
- {0x3139, 0, 0, 0, g(Yes, No, false, false, "", "ᄅ")},
- {0x313a, 0, 1, 1, g(Yes, No, false, false, "", "ᆰ")},
- {0x313b, 0, 1, 1, g(Yes, No, false, false, "", "ᆱ")},
- {0x313c, 0, 1, 1, g(Yes, No, false, false, "", "ᆲ")},
- {0x313d, 0, 1, 1, g(Yes, No, false, false, "", "ᆳ")},
- {0x313e, 0, 1, 1, g(Yes, No, false, false, "", "ᆴ")},
- {0x313f, 0, 1, 1, g(Yes, No, false, false, "", "ᆵ")},
- {0x3140, 0, 0, 0, g(Yes, No, false, false, "", "ᄚ")},
- {0x3141, 0, 0, 0, g(Yes, No, false, false, "", "ᄆ")},
- {0x3142, 0, 0, 0, g(Yes, No, false, false, "", "ᄇ")},
- {0x3143, 0, 0, 0, g(Yes, No, false, false, "", "ᄈ")},
- {0x3144, 0, 0, 0, g(Yes, No, false, false, "", "ᄡ")},
- {0x3145, 0, 0, 0, g(Yes, No, false, false, "", "ᄉ")},
- {0x3146, 0, 0, 0, g(Yes, No, false, false, "", "ᄊ")},
- {0x3147, 0, 0, 0, g(Yes, No, false, false, "", "ᄋ")},
- {0x3148, 0, 0, 0, g(Yes, No, false, false, "", "ᄌ")},
- {0x3149, 0, 0, 0, g(Yes, No, false, false, "", "ᄍ")},
- {0x314a, 0, 0, 0, g(Yes, No, false, false, "", "ᄎ")},
- {0x314b, 0, 0, 0, g(Yes, No, false, false, "", "ᄏ")},
- {0x314c, 0, 0, 0, g(Yes, No, false, false, "", "ᄐ")},
- {0x314d, 0, 0, 0, g(Yes, No, false, false, "", "ᄑ")},
- {0x314e, 0, 0, 0, g(Yes, No, false, false, "", "ᄒ")},
- {0x314f, 0, 1, 1, g(Yes, No, false, false, "", "ᅡ")},
- {0x3150, 0, 1, 1, g(Yes, No, false, false, "", "ᅢ")},
- {0x3151, 0, 1, 1, g(Yes, No, false, false, "", "ᅣ")},
- {0x3152, 0, 1, 1, g(Yes, No, false, false, "", "ᅤ")},
- {0x3153, 0, 1, 1, g(Yes, No, false, false, "", "ᅥ")},
- {0x3154, 0, 1, 1, g(Yes, No, false, false, "", "ᅦ")},
- {0x3155, 0, 1, 1, g(Yes, No, false, false, "", "ᅧ")},
- {0x3156, 0, 1, 1, g(Yes, No, false, false, "", "ᅨ")},
- {0x3157, 0, 1, 1, g(Yes, No, false, false, "", "ᅩ")},
- {0x3158, 0, 1, 1, g(Yes, No, false, false, "", "ᅪ")},
- {0x3159, 0, 1, 1, g(Yes, No, false, false, "", "ᅫ")},
- {0x315a, 0, 1, 1, g(Yes, No, false, false, "", "ᅬ")},
- {0x315b, 0, 1, 1, g(Yes, No, false, false, "", "ᅭ")},
- {0x315c, 0, 1, 1, g(Yes, No, false, false, "", "ᅮ")},
- {0x315d, 0, 1, 1, g(Yes, No, false, false, "", "ᅯ")},
- {0x315e, 0, 1, 1, g(Yes, No, false, false, "", "ᅰ")},
- {0x315f, 0, 1, 1, g(Yes, No, false, false, "", "ᅱ")},
- {0x3160, 0, 1, 1, g(Yes, No, false, false, "", "ᅲ")},
- {0x3161, 0, 1, 1, g(Yes, No, false, false, "", "ᅳ")},
- {0x3162, 0, 1, 1, g(Yes, No, false, false, "", "ᅴ")},
- {0x3163, 0, 1, 1, g(Yes, No, false, false, "", "ᅵ")},
- {0x3164, 0, 0, 0, g(Yes, No, false, false, "", "ᅠ")},
- {0x3165, 0, 0, 0, g(Yes, No, false, false, "", "ᄔ")},
- {0x3166, 0, 0, 0, g(Yes, No, false, false, "", "ᄕ")},
- {0x3167, 0, 0, 0, g(Yes, No, false, false, "", "ᇇ")},
- {0x3168, 0, 0, 0, g(Yes, No, false, false, "", "ᇈ")},
- {0x3169, 0, 0, 0, g(Yes, No, false, false, "", "ᇌ")},
- {0x316a, 0, 0, 0, g(Yes, No, false, false, "", "ᇎ")},
- {0x316b, 0, 0, 0, g(Yes, No, false, false, "", "ᇓ")},
- {0x316c, 0, 0, 0, g(Yes, No, false, false, "", "ᇗ")},
- {0x316d, 0, 0, 0, g(Yes, No, false, false, "", "ᇙ")},
- {0x316e, 0, 0, 0, g(Yes, No, false, false, "", "ᄜ")},
- {0x316f, 0, 0, 0, g(Yes, No, false, false, "", "ᇝ")},
- {0x3170, 0, 0, 0, g(Yes, No, false, false, "", "ᇟ")},
- {0x3171, 0, 0, 0, g(Yes, No, false, false, "", "ᄝ")},
- {0x3172, 0, 0, 0, g(Yes, No, false, false, "", "ᄞ")},
- {0x3173, 0, 0, 0, g(Yes, No, false, false, "", "ᄠ")},
- {0x3174, 0, 0, 0, g(Yes, No, false, false, "", "ᄢ")},
- {0x3175, 0, 0, 0, g(Yes, No, false, false, "", "ᄣ")},
- {0x3176, 0, 0, 0, g(Yes, No, false, false, "", "ᄧ")},
- {0x3177, 0, 0, 0, g(Yes, No, false, false, "", "ᄩ")},
- {0x3178, 0, 0, 0, g(Yes, No, false, false, "", "ᄫ")},
- {0x3179, 0, 0, 0, g(Yes, No, false, false, "", "ᄬ")},
- {0x317a, 0, 0, 0, g(Yes, No, false, false, "", "ᄭ")},
- {0x317b, 0, 0, 0, g(Yes, No, false, false, "", "ᄮ")},
- {0x317c, 0, 0, 0, g(Yes, No, false, false, "", "ᄯ")},
- {0x317d, 0, 0, 0, g(Yes, No, false, false, "", "ᄲ")},
- {0x317e, 0, 0, 0, g(Yes, No, false, false, "", "ᄶ")},
- {0x317f, 0, 0, 0, g(Yes, No, false, false, "", "ᅀ")},
- {0x3180, 0, 0, 0, g(Yes, No, false, false, "", "ᅇ")},
- {0x3181, 0, 0, 0, g(Yes, No, false, false, "", "ᅌ")},
- {0x3182, 0, 0, 0, g(Yes, No, false, false, "", "ᇱ")},
- {0x3183, 0, 0, 0, g(Yes, No, false, false, "", "ᇲ")},
- {0x3184, 0, 0, 0, g(Yes, No, false, false, "", "ᅗ")},
- {0x3185, 0, 0, 0, g(Yes, No, false, false, "", "ᅘ")},
- {0x3186, 0, 0, 0, g(Yes, No, false, false, "", "ᅙ")},
- {0x3187, 0, 0, 0, g(Yes, No, false, false, "", "ᆄ")},
- {0x3188, 0, 0, 0, g(Yes, No, false, false, "", "ᆅ")},
- {0x3189, 0, 0, 0, g(Yes, No, false, false, "", "ᆈ")},
- {0x318a, 0, 0, 0, g(Yes, No, false, false, "", "ᆑ")},
- {0x318b, 0, 0, 0, g(Yes, No, false, false, "", "ᆒ")},
- {0x318c, 0, 0, 0, g(Yes, No, false, false, "", "ᆔ")},
- {0x318d, 0, 0, 0, g(Yes, No, false, false, "", "ᆞ")},
- {0x318e, 0, 0, 0, g(Yes, No, false, false, "", "ᆡ")},
- {0x318f, 0, 0, 0, f(Yes, false, "")},
- {0x3192, 0, 0, 0, g(Yes, No, false, false, "", "一")},
- {0x3193, 0, 0, 0, g(Yes, No, false, false, "", "二")},
- {0x3194, 0, 0, 0, g(Yes, No, false, false, "", "三")},
- {0x3195, 0, 0, 0, g(Yes, No, false, false, "", "四")},
- {0x3196, 0, 0, 0, g(Yes, No, false, false, "", "上")},
- {0x3197, 0, 0, 0, g(Yes, No, false, false, "", "中")},
- {0x3198, 0, 0, 0, g(Yes, No, false, false, "", "下")},
- {0x3199, 0, 0, 0, g(Yes, No, false, false, "", "甲")},
- {0x319a, 0, 0, 0, g(Yes, No, false, false, "", "乙")},
- {0x319b, 0, 0, 0, g(Yes, No, false, false, "", "丙")},
- {0x319c, 0, 0, 0, g(Yes, No, false, false, "", "丁")},
- {0x319d, 0, 0, 0, g(Yes, No, false, false, "", "天")},
- {0x319e, 0, 0, 0, g(Yes, No, false, false, "", "地")},
- {0x319f, 0, 0, 0, g(Yes, No, false, false, "", "人")},
- {0x31a0, 0, 0, 0, f(Yes, false, "")},
- {0x3200, 0, 0, 0, g(Yes, No, false, false, "", "(ᄀ)")},
- {0x3201, 0, 0, 0, g(Yes, No, false, false, "", "(ᄂ)")},
- {0x3202, 0, 0, 0, g(Yes, No, false, false, "", "(ᄃ)")},
- {0x3203, 0, 0, 0, g(Yes, No, false, false, "", "(ᄅ)")},
- {0x3204, 0, 0, 0, g(Yes, No, false, false, "", "(ᄆ)")},
- {0x3205, 0, 0, 0, g(Yes, No, false, false, "", "(ᄇ)")},
- {0x3206, 0, 0, 0, g(Yes, No, false, false, "", "(ᄉ)")},
- {0x3207, 0, 0, 0, g(Yes, No, false, false, "", "(ᄋ)")},
- {0x3208, 0, 0, 0, g(Yes, No, false, false, "", "(ᄌ)")},
- {0x3209, 0, 0, 0, g(Yes, No, false, false, "", "(ᄎ)")},
- {0x320a, 0, 0, 0, g(Yes, No, false, false, "", "(ᄏ)")},
- {0x320b, 0, 0, 0, g(Yes, No, false, false, "", "(ᄐ)")},
- {0x320c, 0, 0, 0, g(Yes, No, false, false, "", "(ᄑ)")},
- {0x320d, 0, 0, 0, g(Yes, No, false, false, "", "(ᄒ)")},
- {0x320e, 0, 0, 0, g(Yes, No, false, false, "", "(가)")},
- {0x320f, 0, 0, 0, g(Yes, No, false, false, "", "(나)")},
- {0x3210, 0, 0, 0, g(Yes, No, false, false, "", "(다)")},
- {0x3211, 0, 0, 0, g(Yes, No, false, false, "", "(라)")},
- {0x3212, 0, 0, 0, g(Yes, No, false, false, "", "(마)")},
- {0x3213, 0, 0, 0, g(Yes, No, false, false, "", "(바)")},
- {0x3214, 0, 0, 0, g(Yes, No, false, false, "", "(사)")},
- {0x3215, 0, 0, 0, g(Yes, No, false, false, "", "(아)")},
- {0x3216, 0, 0, 0, g(Yes, No, false, false, "", "(자)")},
- {0x3217, 0, 0, 0, g(Yes, No, false, false, "", "(차)")},
- {0x3218, 0, 0, 0, g(Yes, No, false, false, "", "(카)")},
- {0x3219, 0, 0, 0, g(Yes, No, false, false, "", "(타)")},
- {0x321a, 0, 0, 0, g(Yes, No, false, false, "", "(파)")},
- {0x321b, 0, 0, 0, g(Yes, No, false, false, "", "(하)")},
- {0x321c, 0, 0, 0, g(Yes, No, false, false, "", "(주)")},
- {0x321d, 0, 0, 0, g(Yes, No, false, false, "", "(오전)")},
- {0x321e, 0, 0, 0, g(Yes, No, false, false, "", "(오후)")},
- {0x321f, 0, 0, 0, f(Yes, false, "")},
- {0x3220, 0, 0, 0, g(Yes, No, false, false, "", "(一)")},
- {0x3221, 0, 0, 0, g(Yes, No, false, false, "", "(二)")},
- {0x3222, 0, 0, 0, g(Yes, No, false, false, "", "(三)")},
- {0x3223, 0, 0, 0, g(Yes, No, false, false, "", "(四)")},
- {0x3224, 0, 0, 0, g(Yes, No, false, false, "", "(五)")},
- {0x3225, 0, 0, 0, g(Yes, No, false, false, "", "(六)")},
- {0x3226, 0, 0, 0, g(Yes, No, false, false, "", "(七)")},
- {0x3227, 0, 0, 0, g(Yes, No, false, false, "", "(八)")},
- {0x3228, 0, 0, 0, g(Yes, No, false, false, "", "(九)")},
- {0x3229, 0, 0, 0, g(Yes, No, false, false, "", "(十)")},
- {0x322a, 0, 0, 0, g(Yes, No, false, false, "", "(月)")},
- {0x322b, 0, 0, 0, g(Yes, No, false, false, "", "(火)")},
- {0x322c, 0, 0, 0, g(Yes, No, false, false, "", "(水)")},
- {0x322d, 0, 0, 0, g(Yes, No, false, false, "", "(木)")},
- {0x322e, 0, 0, 0, g(Yes, No, false, false, "", "(金)")},
- {0x322f, 0, 0, 0, g(Yes, No, false, false, "", "(土)")},
- {0x3230, 0, 0, 0, g(Yes, No, false, false, "", "(日)")},
- {0x3231, 0, 0, 0, g(Yes, No, false, false, "", "(株)")},
- {0x3232, 0, 0, 0, g(Yes, No, false, false, "", "(有)")},
- {0x3233, 0, 0, 0, g(Yes, No, false, false, "", "(社)")},
- {0x3234, 0, 0, 0, g(Yes, No, false, false, "", "(名)")},
- {0x3235, 0, 0, 0, g(Yes, No, false, false, "", "(特)")},
- {0x3236, 0, 0, 0, g(Yes, No, false, false, "", "(財)")},
- {0x3237, 0, 0, 0, g(Yes, No, false, false, "", "(祝)")},
- {0x3238, 0, 0, 0, g(Yes, No, false, false, "", "(労)")},
- {0x3239, 0, 0, 0, g(Yes, No, false, false, "", "(代)")},
- {0x323a, 0, 0, 0, g(Yes, No, false, false, "", "(呼)")},
- {0x323b, 0, 0, 0, g(Yes, No, false, false, "", "(学)")},
- {0x323c, 0, 0, 0, g(Yes, No, false, false, "", "(監)")},
- {0x323d, 0, 0, 0, g(Yes, No, false, false, "", "(企)")},
- {0x323e, 0, 0, 0, g(Yes, No, false, false, "", "(資)")},
- {0x323f, 0, 0, 0, g(Yes, No, false, false, "", "(協)")},
- {0x3240, 0, 0, 0, g(Yes, No, false, false, "", "(祭)")},
- {0x3241, 0, 0, 0, g(Yes, No, false, false, "", "(休)")},
- {0x3242, 0, 0, 0, g(Yes, No, false, false, "", "(自)")},
- {0x3243, 0, 0, 0, g(Yes, No, false, false, "", "(至)")},
- {0x3244, 0, 0, 0, g(Yes, No, false, false, "", "問")},
- {0x3245, 0, 0, 0, g(Yes, No, false, false, "", "幼")},
- {0x3246, 0, 0, 0, g(Yes, No, false, false, "", "文")},
- {0x3247, 0, 0, 0, g(Yes, No, false, false, "", "箏")},
- {0x3248, 0, 0, 0, f(Yes, false, "")},
- {0x3250, 0, 0, 0, g(Yes, No, false, false, "", "PTE")},
- {0x3251, 0, 0, 0, g(Yes, No, false, false, "", "21")},
- {0x3252, 0, 0, 0, g(Yes, No, false, false, "", "22")},
- {0x3253, 0, 0, 0, g(Yes, No, false, false, "", "23")},
- {0x3254, 0, 0, 0, g(Yes, No, false, false, "", "24")},
- {0x3255, 0, 0, 0, g(Yes, No, false, false, "", "25")},
- {0x3256, 0, 0, 0, g(Yes, No, false, false, "", "26")},
- {0x3257, 0, 0, 0, g(Yes, No, false, false, "", "27")},
- {0x3258, 0, 0, 0, g(Yes, No, false, false, "", "28")},
- {0x3259, 0, 0, 0, g(Yes, No, false, false, "", "29")},
- {0x325a, 0, 0, 0, g(Yes, No, false, false, "", "30")},
- {0x325b, 0, 0, 0, g(Yes, No, false, false, "", "31")},
- {0x325c, 0, 0, 0, g(Yes, No, false, false, "", "32")},
- {0x325d, 0, 0, 0, g(Yes, No, false, false, "", "33")},
- {0x325e, 0, 0, 0, g(Yes, No, false, false, "", "34")},
- {0x325f, 0, 0, 0, g(Yes, No, false, false, "", "35")},
- {0x3260, 0, 0, 0, g(Yes, No, false, false, "", "ᄀ")},
- {0x3261, 0, 0, 0, g(Yes, No, false, false, "", "ᄂ")},
- {0x3262, 0, 0, 0, g(Yes, No, false, false, "", "ᄃ")},
- {0x3263, 0, 0, 0, g(Yes, No, false, false, "", "ᄅ")},
- {0x3264, 0, 0, 0, g(Yes, No, false, false, "", "ᄆ")},
- {0x3265, 0, 0, 0, g(Yes, No, false, false, "", "ᄇ")},
- {0x3266, 0, 0, 0, g(Yes, No, false, false, "", "ᄉ")},
- {0x3267, 0, 0, 0, g(Yes, No, false, false, "", "ᄋ")},
- {0x3268, 0, 0, 0, g(Yes, No, false, false, "", "ᄌ")},
- {0x3269, 0, 0, 0, g(Yes, No, false, false, "", "ᄎ")},
- {0x326a, 0, 0, 0, g(Yes, No, false, false, "", "ᄏ")},
- {0x326b, 0, 0, 0, g(Yes, No, false, false, "", "ᄐ")},
- {0x326c, 0, 0, 0, g(Yes, No, false, false, "", "ᄑ")},
- {0x326d, 0, 0, 0, g(Yes, No, false, false, "", "ᄒ")},
- {0x326e, 0, 0, 1, g(Yes, No, false, false, "", "가")},
- {0x326f, 0, 0, 1, g(Yes, No, false, false, "", "나")},
- {0x3270, 0, 0, 1, g(Yes, No, false, false, "", "다")},
- {0x3271, 0, 0, 1, g(Yes, No, false, false, "", "라")},
- {0x3272, 0, 0, 1, g(Yes, No, false, false, "", "마")},
- {0x3273, 0, 0, 1, g(Yes, No, false, false, "", "바")},
- {0x3274, 0, 0, 1, g(Yes, No, false, false, "", "사")},
- {0x3275, 0, 0, 1, g(Yes, No, false, false, "", "아")},
- {0x3276, 0, 0, 1, g(Yes, No, false, false, "", "자")},
- {0x3277, 0, 0, 1, g(Yes, No, false, false, "", "차")},
- {0x3278, 0, 0, 1, g(Yes, No, false, false, "", "카")},
- {0x3279, 0, 0, 1, g(Yes, No, false, false, "", "타")},
- {0x327a, 0, 0, 1, g(Yes, No, false, false, "", "파")},
- {0x327b, 0, 0, 1, g(Yes, No, false, false, "", "하")},
- {0x327c, 0, 0, 1, g(Yes, No, false, false, "", "참고")},
- {0x327d, 0, 0, 1, g(Yes, No, false, false, "", "주의")},
- {0x327e, 0, 0, 1, g(Yes, No, false, false, "", "우")},
- {0x327f, 0, 0, 0, f(Yes, false, "")},
- {0x3280, 0, 0, 0, g(Yes, No, false, false, "", "一")},
- {0x3281, 0, 0, 0, g(Yes, No, false, false, "", "二")},
- {0x3282, 0, 0, 0, g(Yes, No, false, false, "", "三")},
- {0x3283, 0, 0, 0, g(Yes, No, false, false, "", "四")},
- {0x3284, 0, 0, 0, g(Yes, No, false, false, "", "五")},
- {0x3285, 0, 0, 0, g(Yes, No, false, false, "", "六")},
- {0x3286, 0, 0, 0, g(Yes, No, false, false, "", "七")},
- {0x3287, 0, 0, 0, g(Yes, No, false, false, "", "八")},
- {0x3288, 0, 0, 0, g(Yes, No, false, false, "", "九")},
- {0x3289, 0, 0, 0, g(Yes, No, false, false, "", "十")},
- {0x328a, 0, 0, 0, g(Yes, No, false, false, "", "月")},
- {0x328b, 0, 0, 0, g(Yes, No, false, false, "", "火")},
- {0x328c, 0, 0, 0, g(Yes, No, false, false, "", "水")},
- {0x328d, 0, 0, 0, g(Yes, No, false, false, "", "木")},
- {0x328e, 0, 0, 0, g(Yes, No, false, false, "", "金")},
- {0x328f, 0, 0, 0, g(Yes, No, false, false, "", "土")},
- {0x3290, 0, 0, 0, g(Yes, No, false, false, "", "日")},
- {0x3291, 0, 0, 0, g(Yes, No, false, false, "", "株")},
- {0x3292, 0, 0, 0, g(Yes, No, false, false, "", "有")},
- {0x3293, 0, 0, 0, g(Yes, No, false, false, "", "社")},
- {0x3294, 0, 0, 0, g(Yes, No, false, false, "", "名")},
- {0x3295, 0, 0, 0, g(Yes, No, false, false, "", "特")},
- {0x3296, 0, 0, 0, g(Yes, No, false, false, "", "財")},
- {0x3297, 0, 0, 0, g(Yes, No, false, false, "", "祝")},
- {0x3298, 0, 0, 0, g(Yes, No, false, false, "", "労")},
- {0x3299, 0, 0, 0, g(Yes, No, false, false, "", "秘")},
- {0x329a, 0, 0, 0, g(Yes, No, false, false, "", "男")},
- {0x329b, 0, 0, 0, g(Yes, No, false, false, "", "女")},
- {0x329c, 0, 0, 0, g(Yes, No, false, false, "", "適")},
- {0x329d, 0, 0, 0, g(Yes, No, false, false, "", "優")},
- {0x329e, 0, 0, 0, g(Yes, No, false, false, "", "印")},
- {0x329f, 0, 0, 0, g(Yes, No, false, false, "", "注")},
- {0x32a0, 0, 0, 0, g(Yes, No, false, false, "", "項")},
- {0x32a1, 0, 0, 0, g(Yes, No, false, false, "", "休")},
- {0x32a2, 0, 0, 0, g(Yes, No, false, false, "", "写")},
- {0x32a3, 0, 0, 0, g(Yes, No, false, false, "", "正")},
- {0x32a4, 0, 0, 0, g(Yes, No, false, false, "", "上")},
- {0x32a5, 0, 0, 0, g(Yes, No, false, false, "", "中")},
- {0x32a6, 0, 0, 0, g(Yes, No, false, false, "", "下")},
- {0x32a7, 0, 0, 0, g(Yes, No, false, false, "", "左")},
- {0x32a8, 0, 0, 0, g(Yes, No, false, false, "", "右")},
- {0x32a9, 0, 0, 0, g(Yes, No, false, false, "", "医")},
- {0x32aa, 0, 0, 0, g(Yes, No, false, false, "", "宗")},
- {0x32ab, 0, 0, 0, g(Yes, No, false, false, "", "学")},
- {0x32ac, 0, 0, 0, g(Yes, No, false, false, "", "監")},
- {0x32ad, 0, 0, 0, g(Yes, No, false, false, "", "企")},
- {0x32ae, 0, 0, 0, g(Yes, No, false, false, "", "資")},
- {0x32af, 0, 0, 0, g(Yes, No, false, false, "", "協")},
- {0x32b0, 0, 0, 0, g(Yes, No, false, false, "", "夜")},
- {0x32b1, 0, 0, 0, g(Yes, No, false, false, "", "36")},
- {0x32b2, 0, 0, 0, g(Yes, No, false, false, "", "37")},
- {0x32b3, 0, 0, 0, g(Yes, No, false, false, "", "38")},
- {0x32b4, 0, 0, 0, g(Yes, No, false, false, "", "39")},
- {0x32b5, 0, 0, 0, g(Yes, No, false, false, "", "40")},
- {0x32b6, 0, 0, 0, g(Yes, No, false, false, "", "41")},
- {0x32b7, 0, 0, 0, g(Yes, No, false, false, "", "42")},
- {0x32b8, 0, 0, 0, g(Yes, No, false, false, "", "43")},
- {0x32b9, 0, 0, 0, g(Yes, No, false, false, "", "44")},
- {0x32ba, 0, 0, 0, g(Yes, No, false, false, "", "45")},
- {0x32bb, 0, 0, 0, g(Yes, No, false, false, "", "46")},
- {0x32bc, 0, 0, 0, g(Yes, No, false, false, "", "47")},
- {0x32bd, 0, 0, 0, g(Yes, No, false, false, "", "48")},
- {0x32be, 0, 0, 0, g(Yes, No, false, false, "", "49")},
- {0x32bf, 0, 0, 0, g(Yes, No, false, false, "", "50")},
- {0x32c0, 0, 0, 0, g(Yes, No, false, false, "", "1月")},
- {0x32c1, 0, 0, 0, g(Yes, No, false, false, "", "2月")},
- {0x32c2, 0, 0, 0, g(Yes, No, false, false, "", "3月")},
- {0x32c3, 0, 0, 0, g(Yes, No, false, false, "", "4月")},
- {0x32c4, 0, 0, 0, g(Yes, No, false, false, "", "5月")},
- {0x32c5, 0, 0, 0, g(Yes, No, false, false, "", "6月")},
- {0x32c6, 0, 0, 0, g(Yes, No, false, false, "", "7月")},
- {0x32c7, 0, 0, 0, g(Yes, No, false, false, "", "8月")},
- {0x32c8, 0, 0, 0, g(Yes, No, false, false, "", "9月")},
- {0x32c9, 0, 0, 0, g(Yes, No, false, false, "", "10月")},
- {0x32ca, 0, 0, 0, g(Yes, No, false, false, "", "11月")},
- {0x32cb, 0, 0, 0, g(Yes, No, false, false, "", "12月")},
- {0x32cc, 0, 0, 0, g(Yes, No, false, false, "", "Hg")},
- {0x32cd, 0, 0, 0, g(Yes, No, false, false, "", "erg")},
- {0x32ce, 0, 0, 0, g(Yes, No, false, false, "", "eV")},
- {0x32cf, 0, 0, 0, g(Yes, No, false, false, "", "LTD")},
- {0x32d0, 0, 0, 0, g(Yes, No, false, false, "", "ア")},
- {0x32d1, 0, 0, 0, g(Yes, No, false, false, "", "イ")},
- {0x32d2, 0, 0, 0, g(Yes, No, false, false, "", "ウ")},
- {0x32d3, 0, 0, 0, g(Yes, No, false, false, "", "エ")},
- {0x32d4, 0, 0, 0, g(Yes, No, false, false, "", "オ")},
- {0x32d5, 0, 0, 0, g(Yes, No, false, false, "", "カ")},
- {0x32d6, 0, 0, 0, g(Yes, No, false, false, "", "キ")},
- {0x32d7, 0, 0, 0, g(Yes, No, false, false, "", "ク")},
- {0x32d8, 0, 0, 0, g(Yes, No, false, false, "", "ケ")},
- {0x32d9, 0, 0, 0, g(Yes, No, false, false, "", "コ")},
- {0x32da, 0, 0, 0, g(Yes, No, false, false, "", "サ")},
- {0x32db, 0, 0, 0, g(Yes, No, false, false, "", "シ")},
- {0x32dc, 0, 0, 0, g(Yes, No, false, false, "", "ス")},
- {0x32dd, 0, 0, 0, g(Yes, No, false, false, "", "セ")},
- {0x32de, 0, 0, 0, g(Yes, No, false, false, "", "ソ")},
- {0x32df, 0, 0, 0, g(Yes, No, false, false, "", "タ")},
- {0x32e0, 0, 0, 0, g(Yes, No, false, false, "", "チ")},
- {0x32e1, 0, 0, 0, g(Yes, No, false, false, "", "ツ")},
- {0x32e2, 0, 0, 0, g(Yes, No, false, false, "", "テ")},
- {0x32e3, 0, 0, 0, g(Yes, No, false, false, "", "ト")},
- {0x32e4, 0, 0, 0, g(Yes, No, false, false, "", "ナ")},
- {0x32e5, 0, 0, 0, g(Yes, No, false, false, "", "ニ")},
- {0x32e6, 0, 0, 0, g(Yes, No, false, false, "", "ヌ")},
- {0x32e7, 0, 0, 0, g(Yes, No, false, false, "", "ネ")},
- {0x32e8, 0, 0, 0, g(Yes, No, false, false, "", "ノ")},
- {0x32e9, 0, 0, 0, g(Yes, No, false, false, "", "ハ")},
- {0x32ea, 0, 0, 0, g(Yes, No, false, false, "", "ヒ")},
- {0x32eb, 0, 0, 0, g(Yes, No, false, false, "", "フ")},
- {0x32ec, 0, 0, 0, g(Yes, No, false, false, "", "ヘ")},
- {0x32ed, 0, 0, 0, g(Yes, No, false, false, "", "ホ")},
- {0x32ee, 0, 0, 0, g(Yes, No, false, false, "", "マ")},
- {0x32ef, 0, 0, 0, g(Yes, No, false, false, "", "ミ")},
- {0x32f0, 0, 0, 0, g(Yes, No, false, false, "", "ム")},
- {0x32f1, 0, 0, 0, g(Yes, No, false, false, "", "メ")},
- {0x32f2, 0, 0, 0, g(Yes, No, false, false, "", "モ")},
- {0x32f3, 0, 0, 0, g(Yes, No, false, false, "", "ヤ")},
- {0x32f4, 0, 0, 0, g(Yes, No, false, false, "", "ユ")},
- {0x32f5, 0, 0, 0, g(Yes, No, false, false, "", "ヨ")},
- {0x32f6, 0, 0, 0, g(Yes, No, false, false, "", "ラ")},
- {0x32f7, 0, 0, 0, g(Yes, No, false, false, "", "リ")},
- {0x32f8, 0, 0, 0, g(Yes, No, false, false, "", "ル")},
- {0x32f9, 0, 0, 0, g(Yes, No, false, false, "", "レ")},
- {0x32fa, 0, 0, 0, g(Yes, No, false, false, "", "ロ")},
- {0x32fb, 0, 0, 0, g(Yes, No, false, false, "", "ワ")},
- {0x32fc, 0, 0, 0, g(Yes, No, false, false, "", "ヰ")},
- {0x32fd, 0, 0, 0, g(Yes, No, false, false, "", "ヱ")},
- {0x32fe, 0, 0, 0, g(Yes, No, false, false, "", "ヲ")},
- {0x32ff, 0, 0, 0, f(Yes, false, "")},
- {0x3300, 0, 0, 0, g(Yes, No, false, false, "", "アパート")},
- {0x3301, 0, 0, 0, g(Yes, No, false, false, "", "アルファ")},
- {0x3302, 0, 0, 0, g(Yes, No, false, false, "", "アンペア")},
- {0x3303, 0, 0, 0, g(Yes, No, false, false, "", "アール")},
- {0x3304, 0, 0, 1, g(Yes, No, false, false, "", "イニング")},
- {0x3305, 0, 0, 0, g(Yes, No, false, false, "", "インチ")},
- {0x3306, 0, 0, 0, g(Yes, No, false, false, "", "ウォン")},
- {0x3307, 0, 0, 1, g(Yes, No, false, false, "", "エスクード")},
- {0x3308, 0, 0, 0, g(Yes, No, false, false, "", "エーカー")},
- {0x3309, 0, 0, 0, g(Yes, No, false, false, "", "オンス")},
- {0x330a, 0, 0, 0, g(Yes, No, false, false, "", "オーム")},
- {0x330b, 0, 0, 0, g(Yes, No, false, false, "", "カイリ")},
- {0x330c, 0, 0, 0, g(Yes, No, false, false, "", "カラット")},
- {0x330d, 0, 0, 0, g(Yes, No, false, false, "", "カロリー")},
- {0x330e, 0, 0, 0, g(Yes, No, false, false, "", "ガロン")},
- {0x330f, 0, 0, 0, g(Yes, No, false, false, "", "ガンマ")},
- {0x3310, 0, 0, 1, g(Yes, No, false, false, "", "ギガ")},
- {0x3311, 0, 0, 0, g(Yes, No, false, false, "", "ギニー")},
- {0x3312, 0, 0, 0, g(Yes, No, false, false, "", "キュリー")},
- {0x3313, 0, 0, 0, g(Yes, No, false, false, "", "ギルダー")},
- {0x3314, 0, 0, 0, g(Yes, No, false, false, "", "キロ")},
- {0x3315, 0, 0, 0, g(Yes, No, false, false, "", "キログラム")},
- {0x3316, 0, 0, 0, g(Yes, No, false, false, "", "キロメートル")},
- {0x3317, 0, 0, 0, g(Yes, No, false, false, "", "キロワット")},
- {0x3318, 0, 0, 0, g(Yes, No, false, false, "", "グラム")},
- {0x3319, 0, 0, 0, g(Yes, No, false, false, "", "グラムトン")},
- {0x331a, 0, 0, 0, g(Yes, No, false, false, "", "クルゼイロ")},
- {0x331b, 0, 0, 0, g(Yes, No, false, false, "", "クローネ")},
- {0x331c, 0, 0, 0, g(Yes, No, false, false, "", "ケース")},
- {0x331d, 0, 0, 0, g(Yes, No, false, false, "", "コルナ")},
- {0x331e, 0, 0, 1, g(Yes, No, false, false, "", "コーポ")},
- {0x331f, 0, 0, 0, g(Yes, No, false, false, "", "サイクル")},
- {0x3320, 0, 0, 0, g(Yes, No, false, false, "", "サンチーム")},
- {0x3321, 0, 0, 1, g(Yes, No, false, false, "", "シリング")},
- {0x3322, 0, 0, 0, g(Yes, No, false, false, "", "センチ")},
- {0x3323, 0, 0, 0, g(Yes, No, false, false, "", "セント")},
- {0x3324, 0, 0, 0, g(Yes, No, false, false, "", "ダース")},
- {0x3325, 0, 0, 0, g(Yes, No, false, false, "", "デシ")},
- {0x3326, 0, 0, 0, g(Yes, No, false, false, "", "ドル")},
- {0x3327, 0, 0, 0, g(Yes, No, false, false, "", "トン")},
- {0x3328, 0, 0, 0, g(Yes, No, false, false, "", "ナノ")},
- {0x3329, 0, 0, 0, g(Yes, No, false, false, "", "ノット")},
- {0x332a, 0, 0, 0, g(Yes, No, false, false, "", "ハイツ")},
- {0x332b, 0, 0, 0, g(Yes, No, false, false, "", "パーセント")},
- {0x332c, 0, 0, 0, g(Yes, No, false, false, "", "パーツ")},
- {0x332d, 0, 0, 0, g(Yes, No, false, false, "", "バーレル")},
- {0x332e, 0, 0, 0, g(Yes, No, false, false, "", "ピアストル")},
- {0x332f, 0, 0, 0, g(Yes, No, false, false, "", "ピクル")},
- {0x3330, 0, 0, 0, g(Yes, No, false, false, "", "ピコ")},
- {0x3331, 0, 0, 0, g(Yes, No, false, false, "", "ビル")},
- {0x3332, 0, 0, 1, g(Yes, No, false, false, "", "ファラッド")},
- {0x3333, 0, 0, 0, g(Yes, No, false, false, "", "フィート")},
- {0x3334, 0, 0, 0, g(Yes, No, false, false, "", "ブッシェル")},
- {0x3335, 0, 0, 0, g(Yes, No, false, false, "", "フラン")},
- {0x3336, 0, 0, 0, g(Yes, No, false, false, "", "ヘクタール")},
- {0x3337, 0, 0, 0, g(Yes, No, false, false, "", "ペソ")},
- {0x3338, 0, 0, 0, g(Yes, No, false, false, "", "ペニヒ")},
- {0x3339, 0, 0, 0, g(Yes, No, false, false, "", "ヘルツ")},
- {0x333a, 0, 0, 0, g(Yes, No, false, false, "", "ペンス")},
- {0x333b, 0, 0, 1, g(Yes, No, false, false, "", "ページ")},
- {0x333c, 0, 0, 0, g(Yes, No, false, false, "", "ベータ")},
- {0x333d, 0, 0, 0, g(Yes, No, false, false, "", "ポイント")},
- {0x333e, 0, 0, 0, g(Yes, No, false, false, "", "ボルト")},
- {0x333f, 0, 0, 0, g(Yes, No, false, false, "", "ホン")},
- {0x3340, 0, 0, 1, g(Yes, No, false, false, "", "ポンド")},
- {0x3341, 0, 0, 0, g(Yes, No, false, false, "", "ホール")},
- {0x3342, 0, 0, 0, g(Yes, No, false, false, "", "ホーン")},
- {0x3343, 0, 0, 0, g(Yes, No, false, false, "", "マイクロ")},
- {0x3344, 0, 0, 0, g(Yes, No, false, false, "", "マイル")},
- {0x3345, 0, 0, 0, g(Yes, No, false, false, "", "マッハ")},
- {0x3346, 0, 0, 0, g(Yes, No, false, false, "", "マルク")},
- {0x3347, 0, 0, 0, g(Yes, No, false, false, "", "マンション")},
- {0x3348, 0, 0, 0, g(Yes, No, false, false, "", "ミクロン")},
- {0x3349, 0, 0, 0, g(Yes, No, false, false, "", "ミリ")},
- {0x334a, 0, 0, 0, g(Yes, No, false, false, "", "ミリバール")},
- {0x334b, 0, 0, 1, g(Yes, No, false, false, "", "メガ")},
- {0x334c, 0, 0, 0, g(Yes, No, false, false, "", "メガトン")},
- {0x334d, 0, 0, 0, g(Yes, No, false, false, "", "メートル")},
- {0x334e, 0, 0, 1, g(Yes, No, false, false, "", "ヤード")},
- {0x334f, 0, 0, 0, g(Yes, No, false, false, "", "ヤール")},
- {0x3350, 0, 0, 0, g(Yes, No, false, false, "", "ユアン")},
- {0x3351, 0, 0, 0, g(Yes, No, false, false, "", "リットル")},
- {0x3352, 0, 0, 0, g(Yes, No, false, false, "", "リラ")},
- {0x3353, 0, 0, 0, g(Yes, No, false, false, "", "ルピー")},
- {0x3354, 0, 0, 0, g(Yes, No, false, false, "", "ルーブル")},
- {0x3355, 0, 0, 0, g(Yes, No, false, false, "", "レム")},
- {0x3356, 0, 0, 0, g(Yes, No, false, false, "", "レントゲン")},
- {0x3357, 0, 0, 0, g(Yes, No, false, false, "", "ワット")},
- {0x3358, 0, 0, 0, g(Yes, No, false, false, "", "0点")},
- {0x3359, 0, 0, 0, g(Yes, No, false, false, "", "1点")},
- {0x335a, 0, 0, 0, g(Yes, No, false, false, "", "2点")},
- {0x335b, 0, 0, 0, g(Yes, No, false, false, "", "3点")},
- {0x335c, 0, 0, 0, g(Yes, No, false, false, "", "4点")},
- {0x335d, 0, 0, 0, g(Yes, No, false, false, "", "5点")},
- {0x335e, 0, 0, 0, g(Yes, No, false, false, "", "6点")},
- {0x335f, 0, 0, 0, g(Yes, No, false, false, "", "7点")},
- {0x3360, 0, 0, 0, g(Yes, No, false, false, "", "8点")},
- {0x3361, 0, 0, 0, g(Yes, No, false, false, "", "9点")},
- {0x3362, 0, 0, 0, g(Yes, No, false, false, "", "10点")},
- {0x3363, 0, 0, 0, g(Yes, No, false, false, "", "11点")},
- {0x3364, 0, 0, 0, g(Yes, No, false, false, "", "12点")},
- {0x3365, 0, 0, 0, g(Yes, No, false, false, "", "13点")},
- {0x3366, 0, 0, 0, g(Yes, No, false, false, "", "14点")},
- {0x3367, 0, 0, 0, g(Yes, No, false, false, "", "15点")},
- {0x3368, 0, 0, 0, g(Yes, No, false, false, "", "16点")},
- {0x3369, 0, 0, 0, g(Yes, No, false, false, "", "17点")},
- {0x336a, 0, 0, 0, g(Yes, No, false, false, "", "18点")},
- {0x336b, 0, 0, 0, g(Yes, No, false, false, "", "19点")},
- {0x336c, 0, 0, 0, g(Yes, No, false, false, "", "20点")},
- {0x336d, 0, 0, 0, g(Yes, No, false, false, "", "21点")},
- {0x336e, 0, 0, 0, g(Yes, No, false, false, "", "22点")},
- {0x336f, 0, 0, 0, g(Yes, No, false, false, "", "23点")},
- {0x3370, 0, 0, 0, g(Yes, No, false, false, "", "24点")},
- {0x3371, 0, 0, 0, g(Yes, No, false, false, "", "hPa")},
- {0x3372, 0, 0, 0, g(Yes, No, false, false, "", "da")},
- {0x3373, 0, 0, 0, g(Yes, No, false, false, "", "AU")},
- {0x3374, 0, 0, 0, g(Yes, No, false, false, "", "bar")},
- {0x3375, 0, 0, 0, g(Yes, No, false, false, "", "oV")},
- {0x3376, 0, 0, 0, g(Yes, No, false, false, "", "pc")},
- {0x3377, 0, 0, 0, g(Yes, No, false, false, "", "dm")},
- {0x3378, 0, 0, 0, g(Yes, No, false, false, "", "dm2")},
- {0x3379, 0, 0, 0, g(Yes, No, false, false, "", "dm3")},
- {0x337a, 0, 0, 0, g(Yes, No, false, false, "", "IU")},
- {0x337b, 0, 0, 0, g(Yes, No, false, false, "", "平成")},
- {0x337c, 0, 0, 0, g(Yes, No, false, false, "", "昭和")},
- {0x337d, 0, 0, 0, g(Yes, No, false, false, "", "大正")},
- {0x337e, 0, 0, 0, g(Yes, No, false, false, "", "明治")},
- {0x337f, 0, 0, 0, g(Yes, No, false, false, "", "株式会社")},
- {0x3380, 0, 0, 0, g(Yes, No, false, false, "", "pA")},
- {0x3381, 0, 0, 0, g(Yes, No, false, false, "", "nA")},
- {0x3382, 0, 0, 0, g(Yes, No, false, false, "", "μA")},
- {0x3383, 0, 0, 0, g(Yes, No, false, false, "", "mA")},
- {0x3384, 0, 0, 0, g(Yes, No, false, false, "", "kA")},
- {0x3385, 0, 0, 0, g(Yes, No, false, false, "", "KB")},
- {0x3386, 0, 0, 0, g(Yes, No, false, false, "", "MB")},
- {0x3387, 0, 0, 0, g(Yes, No, false, false, "", "GB")},
- {0x3388, 0, 0, 0, g(Yes, No, false, false, "", "cal")},
- {0x3389, 0, 0, 0, g(Yes, No, false, false, "", "kcal")},
- {0x338a, 0, 0, 0, g(Yes, No, false, false, "", "pF")},
- {0x338b, 0, 0, 0, g(Yes, No, false, false, "", "nF")},
- {0x338c, 0, 0, 0, g(Yes, No, false, false, "", "μF")},
- {0x338d, 0, 0, 0, g(Yes, No, false, false, "", "μg")},
- {0x338e, 0, 0, 0, g(Yes, No, false, false, "", "mg")},
- {0x338f, 0, 0, 0, g(Yes, No, false, false, "", "kg")},
- {0x3390, 0, 0, 0, g(Yes, No, false, false, "", "Hz")},
- {0x3391, 0, 0, 0, g(Yes, No, false, false, "", "kHz")},
- {0x3392, 0, 0, 0, g(Yes, No, false, false, "", "MHz")},
- {0x3393, 0, 0, 0, g(Yes, No, false, false, "", "GHz")},
- {0x3394, 0, 0, 0, g(Yes, No, false, false, "", "THz")},
- {0x3395, 0, 0, 0, g(Yes, No, false, false, "", "μl")},
- {0x3396, 0, 0, 0, g(Yes, No, false, false, "", "ml")},
- {0x3397, 0, 0, 0, g(Yes, No, false, false, "", "dl")},
- {0x3398, 0, 0, 0, g(Yes, No, false, false, "", "kl")},
- {0x3399, 0, 0, 0, g(Yes, No, false, false, "", "fm")},
- {0x339a, 0, 0, 0, g(Yes, No, false, false, "", "nm")},
- {0x339b, 0, 0, 0, g(Yes, No, false, false, "", "μm")},
- {0x339c, 0, 0, 0, g(Yes, No, false, false, "", "mm")},
- {0x339d, 0, 0, 0, g(Yes, No, false, false, "", "cm")},
- {0x339e, 0, 0, 0, g(Yes, No, false, false, "", "km")},
- {0x339f, 0, 0, 0, g(Yes, No, false, false, "", "mm2")},
- {0x33a0, 0, 0, 0, g(Yes, No, false, false, "", "cm2")},
- {0x33a1, 0, 0, 0, g(Yes, No, false, false, "", "m2")},
- {0x33a2, 0, 0, 0, g(Yes, No, false, false, "", "km2")},
- {0x33a3, 0, 0, 0, g(Yes, No, false, false, "", "mm3")},
- {0x33a4, 0, 0, 0, g(Yes, No, false, false, "", "cm3")},
- {0x33a5, 0, 0, 0, g(Yes, No, false, false, "", "m3")},
- {0x33a6, 0, 0, 0, g(Yes, No, false, false, "", "km3")},
- {0x33a7, 0, 0, 0, g(Yes, No, false, false, "", "m∕s")},
- {0x33a8, 0, 0, 0, g(Yes, No, false, false, "", "m∕s2")},
- {0x33a9, 0, 0, 0, g(Yes, No, false, false, "", "Pa")},
- {0x33aa, 0, 0, 0, g(Yes, No, false, false, "", "kPa")},
- {0x33ab, 0, 0, 0, g(Yes, No, false, false, "", "MPa")},
- {0x33ac, 0, 0, 0, g(Yes, No, false, false, "", "GPa")},
- {0x33ad, 0, 0, 0, g(Yes, No, false, false, "", "rad")},
- {0x33ae, 0, 0, 0, g(Yes, No, false, false, "", "rad∕s")},
- {0x33af, 0, 0, 0, g(Yes, No, false, false, "", "rad∕s2")},
- {0x33b0, 0, 0, 0, g(Yes, No, false, false, "", "ps")},
- {0x33b1, 0, 0, 0, g(Yes, No, false, false, "", "ns")},
- {0x33b2, 0, 0, 0, g(Yes, No, false, false, "", "μs")},
- {0x33b3, 0, 0, 0, g(Yes, No, false, false, "", "ms")},
- {0x33b4, 0, 0, 0, g(Yes, No, false, false, "", "pV")},
- {0x33b5, 0, 0, 0, g(Yes, No, false, false, "", "nV")},
- {0x33b6, 0, 0, 0, g(Yes, No, false, false, "", "μV")},
- {0x33b7, 0, 0, 0, g(Yes, No, false, false, "", "mV")},
- {0x33b8, 0, 0, 0, g(Yes, No, false, false, "", "kV")},
- {0x33b9, 0, 0, 0, g(Yes, No, false, false, "", "MV")},
- {0x33ba, 0, 0, 0, g(Yes, No, false, false, "", "pW")},
- {0x33bb, 0, 0, 0, g(Yes, No, false, false, "", "nW")},
- {0x33bc, 0, 0, 0, g(Yes, No, false, false, "", "μW")},
- {0x33bd, 0, 0, 0, g(Yes, No, false, false, "", "mW")},
- {0x33be, 0, 0, 0, g(Yes, No, false, false, "", "kW")},
- {0x33bf, 0, 0, 0, g(Yes, No, false, false, "", "MW")},
- {0x33c0, 0, 0, 0, g(Yes, No, false, false, "", "kΩ")},
- {0x33c1, 0, 0, 0, g(Yes, No, false, false, "", "MΩ")},
- {0x33c2, 0, 0, 0, g(Yes, No, false, false, "", "a.m.")},
- {0x33c3, 0, 0, 0, g(Yes, No, false, false, "", "Bq")},
- {0x33c4, 0, 0, 0, g(Yes, No, false, false, "", "cc")},
- {0x33c5, 0, 0, 0, g(Yes, No, false, false, "", "cd")},
- {0x33c6, 0, 0, 0, g(Yes, No, false, false, "", "C∕kg")},
- {0x33c7, 0, 0, 0, g(Yes, No, false, false, "", "Co.")},
- {0x33c8, 0, 0, 0, g(Yes, No, false, false, "", "dB")},
- {0x33c9, 0, 0, 0, g(Yes, No, false, false, "", "Gy")},
- {0x33ca, 0, 0, 0, g(Yes, No, false, false, "", "ha")},
- {0x33cb, 0, 0, 0, g(Yes, No, false, false, "", "HP")},
- {0x33cc, 0, 0, 0, g(Yes, No, false, false, "", "in")},
- {0x33cd, 0, 0, 0, g(Yes, No, false, false, "", "KK")},
- {0x33ce, 0, 0, 0, g(Yes, No, false, false, "", "KM")},
- {0x33cf, 0, 0, 0, g(Yes, No, false, false, "", "kt")},
- {0x33d0, 0, 0, 0, g(Yes, No, false, false, "", "lm")},
- {0x33d1, 0, 0, 0, g(Yes, No, false, false, "", "ln")},
- {0x33d2, 0, 0, 0, g(Yes, No, false, false, "", "log")},
- {0x33d3, 0, 0, 0, g(Yes, No, false, false, "", "lx")},
- {0x33d4, 0, 0, 0, g(Yes, No, false, false, "", "mb")},
- {0x33d5, 0, 0, 0, g(Yes, No, false, false, "", "mil")},
- {0x33d6, 0, 0, 0, g(Yes, No, false, false, "", "mol")},
- {0x33d7, 0, 0, 0, g(Yes, No, false, false, "", "PH")},
- {0x33d8, 0, 0, 0, g(Yes, No, false, false, "", "p.m.")},
- {0x33d9, 0, 0, 0, g(Yes, No, false, false, "", "PPM")},
- {0x33da, 0, 0, 0, g(Yes, No, false, false, "", "PR")},
- {0x33db, 0, 0, 0, g(Yes, No, false, false, "", "sr")},
- {0x33dc, 0, 0, 0, g(Yes, No, false, false, "", "Sv")},
- {0x33dd, 0, 0, 0, g(Yes, No, false, false, "", "Wb")},
- {0x33de, 0, 0, 0, g(Yes, No, false, false, "", "V∕m")},
- {0x33df, 0, 0, 0, g(Yes, No, false, false, "", "A∕m")},
- {0x33e0, 0, 0, 0, g(Yes, No, false, false, "", "1日")},
- {0x33e1, 0, 0, 0, g(Yes, No, false, false, "", "2日")},
- {0x33e2, 0, 0, 0, g(Yes, No, false, false, "", "3日")},
- {0x33e3, 0, 0, 0, g(Yes, No, false, false, "", "4日")},
- {0x33e4, 0, 0, 0, g(Yes, No, false, false, "", "5日")},
- {0x33e5, 0, 0, 0, g(Yes, No, false, false, "", "6日")},
- {0x33e6, 0, 0, 0, g(Yes, No, false, false, "", "7日")},
- {0x33e7, 0, 0, 0, g(Yes, No, false, false, "", "8日")},
- {0x33e8, 0, 0, 0, g(Yes, No, false, false, "", "9日")},
- {0x33e9, 0, 0, 0, g(Yes, No, false, false, "", "10日")},
- {0x33ea, 0, 0, 0, g(Yes, No, false, false, "", "11日")},
- {0x33eb, 0, 0, 0, g(Yes, No, false, false, "", "12日")},
- {0x33ec, 0, 0, 0, g(Yes, No, false, false, "", "13日")},
- {0x33ed, 0, 0, 0, g(Yes, No, false, false, "", "14日")},
- {0x33ee, 0, 0, 0, g(Yes, No, false, false, "", "15日")},
- {0x33ef, 0, 0, 0, g(Yes, No, false, false, "", "16日")},
- {0x33f0, 0, 0, 0, g(Yes, No, false, false, "", "17日")},
- {0x33f1, 0, 0, 0, g(Yes, No, false, false, "", "18日")},
- {0x33f2, 0, 0, 0, g(Yes, No, false, false, "", "19日")},
- {0x33f3, 0, 0, 0, g(Yes, No, false, false, "", "20日")},
- {0x33f4, 0, 0, 0, g(Yes, No, false, false, "", "21日")},
- {0x33f5, 0, 0, 0, g(Yes, No, false, false, "", "22日")},
- {0x33f6, 0, 0, 0, g(Yes, No, false, false, "", "23日")},
- {0x33f7, 0, 0, 0, g(Yes, No, false, false, "", "24日")},
- {0x33f8, 0, 0, 0, g(Yes, No, false, false, "", "25日")},
- {0x33f9, 0, 0, 0, g(Yes, No, false, false, "", "26日")},
- {0x33fa, 0, 0, 0, g(Yes, No, false, false, "", "27日")},
- {0x33fb, 0, 0, 0, g(Yes, No, false, false, "", "28日")},
- {0x33fc, 0, 0, 0, g(Yes, No, false, false, "", "29日")},
- {0x33fd, 0, 0, 0, g(Yes, No, false, false, "", "30日")},
- {0x33fe, 0, 0, 0, g(Yes, No, false, false, "", "31日")},
- {0x33ff, 0, 0, 0, g(Yes, No, false, false, "", "gal")},
- {0x3400, 0, 0, 0, f(Yes, false, "")},
- {0xa66f, 230, 1, 1, f(Yes, false, "")},
- {0xa670, 0, 0, 0, f(Yes, false, "")},
- {0xa674, 230, 1, 1, f(Yes, false, "")},
- {0xa67e, 0, 0, 0, f(Yes, false, "")},
- {0xa69c, 0, 0, 0, g(Yes, No, false, false, "", "ъ")},
- {0xa69d, 0, 0, 0, g(Yes, No, false, false, "", "ь")},
- {0xa69e, 230, 1, 1, f(Yes, false, "")},
- {0xa6a0, 0, 0, 0, f(Yes, false, "")},
- {0xa6f0, 230, 1, 1, f(Yes, false, "")},
- {0xa6f2, 0, 0, 0, f(Yes, false, "")},
- {0xa770, 0, 0, 0, g(Yes, No, false, false, "", "ꝯ")},
- {0xa771, 0, 0, 0, f(Yes, false, "")},
- {0xa7f8, 0, 0, 0, g(Yes, No, false, false, "", "Ħ")},
- {0xa7f9, 0, 0, 0, g(Yes, No, false, false, "", "œ")},
- {0xa7fa, 0, 0, 0, f(Yes, false, "")},
- {0xa806, 9, 1, 1, f(Yes, false, "")},
- {0xa807, 0, 0, 0, f(Yes, false, "")},
- {0xa8c4, 9, 1, 1, f(Yes, false, "")},
- {0xa8c5, 0, 0, 0, f(Yes, false, "")},
- {0xa8e0, 230, 1, 1, f(Yes, false, "")},
- {0xa8f2, 0, 0, 0, f(Yes, false, "")},
- {0xa92b, 220, 1, 1, f(Yes, false, "")},
- {0xa92e, 0, 0, 0, f(Yes, false, "")},
- {0xa953, 9, 1, 1, f(Yes, false, "")},
- {0xa954, 0, 0, 0, f(Yes, false, "")},
- {0xa9b3, 7, 1, 1, f(Yes, false, "")},
- {0xa9b4, 0, 0, 0, f(Yes, false, "")},
- {0xa9c0, 9, 1, 1, f(Yes, false, "")},
- {0xa9c1, 0, 0, 0, f(Yes, false, "")},
- {0xaab0, 230, 1, 1, f(Yes, false, "")},
- {0xaab1, 0, 0, 0, f(Yes, false, "")},
- {0xaab2, 230, 1, 1, f(Yes, false, "")},
- {0xaab4, 220, 1, 1, f(Yes, false, "")},
- {0xaab5, 0, 0, 0, f(Yes, false, "")},
- {0xaab7, 230, 1, 1, f(Yes, false, "")},
- {0xaab9, 0, 0, 0, f(Yes, false, "")},
- {0xaabe, 230, 1, 1, f(Yes, false, "")},
- {0xaac0, 0, 0, 0, f(Yes, false, "")},
- {0xaac1, 230, 1, 1, f(Yes, false, "")},
- {0xaac2, 0, 0, 0, f(Yes, false, "")},
- {0xaaf6, 9, 1, 1, f(Yes, false, "")},
- {0xaaf7, 0, 0, 0, f(Yes, false, "")},
- {0xab5c, 0, 0, 0, g(Yes, No, false, false, "", "ꜧ")},
- {0xab5d, 0, 0, 0, g(Yes, No, false, false, "", "ꬷ")},
- {0xab5e, 0, 0, 0, g(Yes, No, false, false, "", "ɫ")},
- {0xab5f, 0, 0, 0, g(Yes, No, false, false, "", "ꭒ")},
- {0xab60, 0, 0, 0, f(Yes, false, "")},
- {0xabed, 9, 1, 1, f(Yes, false, "")},
- {0xabee, 0, 0, 0, f(Yes, false, "")},
- {0xac00, 0, 0, 1, f(Yes, true, "")},
- {0xac01, 0, 0, 2, f(Yes, false, "")},
- {0xac1c, 0, 0, 1, f(Yes, true, "")},
- {0xac1d, 0, 0, 2, f(Yes, false, "")},
- {0xac38, 0, 0, 1, f(Yes, true, "")},
- {0xac39, 0, 0, 2, f(Yes, false, "")},
- {0xac54, 0, 0, 1, f(Yes, true, "")},
- {0xac55, 0, 0, 2, f(Yes, false, "")},
- {0xac70, 0, 0, 1, f(Yes, true, "")},
- {0xac71, 0, 0, 2, f(Yes, false, "")},
- {0xac8c, 0, 0, 1, f(Yes, true, "")},
- {0xac8d, 0, 0, 2, f(Yes, false, "")},
- {0xaca8, 0, 0, 1, f(Yes, true, "")},
- {0xaca9, 0, 0, 2, f(Yes, false, "")},
- {0xacc4, 0, 0, 1, f(Yes, true, "")},
- {0xacc5, 0, 0, 2, f(Yes, false, "")},
- {0xace0, 0, 0, 1, f(Yes, true, "")},
- {0xace1, 0, 0, 2, f(Yes, false, "")},
- {0xacfc, 0, 0, 1, f(Yes, true, "")},
- {0xacfd, 0, 0, 2, f(Yes, false, "")},
- {0xad18, 0, 0, 1, f(Yes, true, "")},
- {0xad19, 0, 0, 2, f(Yes, false, "")},
- {0xad34, 0, 0, 1, f(Yes, true, "")},
- {0xad35, 0, 0, 2, f(Yes, false, "")},
- {0xad50, 0, 0, 1, f(Yes, true, "")},
- {0xad51, 0, 0, 2, f(Yes, false, "")},
- {0xad6c, 0, 0, 1, f(Yes, true, "")},
- {0xad6d, 0, 0, 2, f(Yes, false, "")},
- {0xad88, 0, 0, 1, f(Yes, true, "")},
- {0xad89, 0, 0, 2, f(Yes, false, "")},
- {0xada4, 0, 0, 1, f(Yes, true, "")},
- {0xada5, 0, 0, 2, f(Yes, false, "")},
- {0xadc0, 0, 0, 1, f(Yes, true, "")},
- {0xadc1, 0, 0, 2, f(Yes, false, "")},
- {0xaddc, 0, 0, 1, f(Yes, true, "")},
- {0xaddd, 0, 0, 2, f(Yes, false, "")},
- {0xadf8, 0, 0, 1, f(Yes, true, "")},
- {0xadf9, 0, 0, 2, f(Yes, false, "")},
- {0xae14, 0, 0, 1, f(Yes, true, "")},
- {0xae15, 0, 0, 2, f(Yes, false, "")},
- {0xae30, 0, 0, 1, f(Yes, true, "")},
- {0xae31, 0, 0, 2, f(Yes, false, "")},
- {0xae4c, 0, 0, 1, f(Yes, true, "")},
- {0xae4d, 0, 0, 2, f(Yes, false, "")},
- {0xae68, 0, 0, 1, f(Yes, true, "")},
- {0xae69, 0, 0, 2, f(Yes, false, "")},
- {0xae84, 0, 0, 1, f(Yes, true, "")},
- {0xae85, 0, 0, 2, f(Yes, false, "")},
- {0xaea0, 0, 0, 1, f(Yes, true, "")},
- {0xaea1, 0, 0, 2, f(Yes, false, "")},
- {0xaebc, 0, 0, 1, f(Yes, true, "")},
- {0xaebd, 0, 0, 2, f(Yes, false, "")},
- {0xaed8, 0, 0, 1, f(Yes, true, "")},
- {0xaed9, 0, 0, 2, f(Yes, false, "")},
- {0xaef4, 0, 0, 1, f(Yes, true, "")},
- {0xaef5, 0, 0, 2, f(Yes, false, "")},
- {0xaf10, 0, 0, 1, f(Yes, true, "")},
- {0xaf11, 0, 0, 2, f(Yes, false, "")},
- {0xaf2c, 0, 0, 1, f(Yes, true, "")},
- {0xaf2d, 0, 0, 2, f(Yes, false, "")},
- {0xaf48, 0, 0, 1, f(Yes, true, "")},
- {0xaf49, 0, 0, 2, f(Yes, false, "")},
- {0xaf64, 0, 0, 1, f(Yes, true, "")},
- {0xaf65, 0, 0, 2, f(Yes, false, "")},
- {0xaf80, 0, 0, 1, f(Yes, true, "")},
- {0xaf81, 0, 0, 2, f(Yes, false, "")},
- {0xaf9c, 0, 0, 1, f(Yes, true, "")},
- {0xaf9d, 0, 0, 2, f(Yes, false, "")},
- {0xafb8, 0, 0, 1, f(Yes, true, "")},
- {0xafb9, 0, 0, 2, f(Yes, false, "")},
- {0xafd4, 0, 0, 1, f(Yes, true, "")},
- {0xafd5, 0, 0, 2, f(Yes, false, "")},
- {0xaff0, 0, 0, 1, f(Yes, true, "")},
- {0xaff1, 0, 0, 2, f(Yes, false, "")},
- {0xb00c, 0, 0, 1, f(Yes, true, "")},
- {0xb00d, 0, 0, 2, f(Yes, false, "")},
- {0xb028, 0, 0, 1, f(Yes, true, "")},
- {0xb029, 0, 0, 2, f(Yes, false, "")},
- {0xb044, 0, 0, 1, f(Yes, true, "")},
- {0xb045, 0, 0, 2, f(Yes, false, "")},
- {0xb060, 0, 0, 1, f(Yes, true, "")},
- {0xb061, 0, 0, 2, f(Yes, false, "")},
- {0xb07c, 0, 0, 1, f(Yes, true, "")},
- {0xb07d, 0, 0, 2, f(Yes, false, "")},
- {0xb098, 0, 0, 1, f(Yes, true, "")},
- {0xb099, 0, 0, 2, f(Yes, false, "")},
- {0xb0b4, 0, 0, 1, f(Yes, true, "")},
- {0xb0b5, 0, 0, 2, f(Yes, false, "")},
- {0xb0d0, 0, 0, 1, f(Yes, true, "")},
- {0xb0d1, 0, 0, 2, f(Yes, false, "")},
- {0xb0ec, 0, 0, 1, f(Yes, true, "")},
- {0xb0ed, 0, 0, 2, f(Yes, false, "")},
- {0xb108, 0, 0, 1, f(Yes, true, "")},
- {0xb109, 0, 0, 2, f(Yes, false, "")},
- {0xb124, 0, 0, 1, f(Yes, true, "")},
- {0xb125, 0, 0, 2, f(Yes, false, "")},
- {0xb140, 0, 0, 1, f(Yes, true, "")},
- {0xb141, 0, 0, 2, f(Yes, false, "")},
- {0xb15c, 0, 0, 1, f(Yes, true, "")},
- {0xb15d, 0, 0, 2, f(Yes, false, "")},
- {0xb178, 0, 0, 1, f(Yes, true, "")},
- {0xb179, 0, 0, 2, f(Yes, false, "")},
- {0xb194, 0, 0, 1, f(Yes, true, "")},
- {0xb195, 0, 0, 2, f(Yes, false, "")},
- {0xb1b0, 0, 0, 1, f(Yes, true, "")},
- {0xb1b1, 0, 0, 2, f(Yes, false, "")},
- {0xb1cc, 0, 0, 1, f(Yes, true, "")},
- {0xb1cd, 0, 0, 2, f(Yes, false, "")},
- {0xb1e8, 0, 0, 1, f(Yes, true, "")},
- {0xb1e9, 0, 0, 2, f(Yes, false, "")},
- {0xb204, 0, 0, 1, f(Yes, true, "")},
- {0xb205, 0, 0, 2, f(Yes, false, "")},
- {0xb220, 0, 0, 1, f(Yes, true, "")},
- {0xb221, 0, 0, 2, f(Yes, false, "")},
- {0xb23c, 0, 0, 1, f(Yes, true, "")},
- {0xb23d, 0, 0, 2, f(Yes, false, "")},
- {0xb258, 0, 0, 1, f(Yes, true, "")},
- {0xb259, 0, 0, 2, f(Yes, false, "")},
- {0xb274, 0, 0, 1, f(Yes, true, "")},
- {0xb275, 0, 0, 2, f(Yes, false, "")},
- {0xb290, 0, 0, 1, f(Yes, true, "")},
- {0xb291, 0, 0, 2, f(Yes, false, "")},
- {0xb2ac, 0, 0, 1, f(Yes, true, "")},
- {0xb2ad, 0, 0, 2, f(Yes, false, "")},
- {0xb2c8, 0, 0, 1, f(Yes, true, "")},
- {0xb2c9, 0, 0, 2, f(Yes, false, "")},
- {0xb2e4, 0, 0, 1, f(Yes, true, "")},
- {0xb2e5, 0, 0, 2, f(Yes, false, "")},
- {0xb300, 0, 0, 1, f(Yes, true, "")},
- {0xb301, 0, 0, 2, f(Yes, false, "")},
- {0xb31c, 0, 0, 1, f(Yes, true, "")},
- {0xb31d, 0, 0, 2, f(Yes, false, "")},
- {0xb338, 0, 0, 1, f(Yes, true, "")},
- {0xb339, 0, 0, 2, f(Yes, false, "")},
- {0xb354, 0, 0, 1, f(Yes, true, "")},
- {0xb355, 0, 0, 2, f(Yes, false, "")},
- {0xb370, 0, 0, 1, f(Yes, true, "")},
- {0xb371, 0, 0, 2, f(Yes, false, "")},
- {0xb38c, 0, 0, 1, f(Yes, true, "")},
- {0xb38d, 0, 0, 2, f(Yes, false, "")},
- {0xb3a8, 0, 0, 1, f(Yes, true, "")},
- {0xb3a9, 0, 0, 2, f(Yes, false, "")},
- {0xb3c4, 0, 0, 1, f(Yes, true, "")},
- {0xb3c5, 0, 0, 2, f(Yes, false, "")},
- {0xb3e0, 0, 0, 1, f(Yes, true, "")},
- {0xb3e1, 0, 0, 2, f(Yes, false, "")},
- {0xb3fc, 0, 0, 1, f(Yes, true, "")},
- {0xb3fd, 0, 0, 2, f(Yes, false, "")},
- {0xb418, 0, 0, 1, f(Yes, true, "")},
- {0xb419, 0, 0, 2, f(Yes, false, "")},
- {0xb434, 0, 0, 1, f(Yes, true, "")},
- {0xb435, 0, 0, 2, f(Yes, false, "")},
- {0xb450, 0, 0, 1, f(Yes, true, "")},
- {0xb451, 0, 0, 2, f(Yes, false, "")},
- {0xb46c, 0, 0, 1, f(Yes, true, "")},
- {0xb46d, 0, 0, 2, f(Yes, false, "")},
- {0xb488, 0, 0, 1, f(Yes, true, "")},
- {0xb489, 0, 0, 2, f(Yes, false, "")},
- {0xb4a4, 0, 0, 1, f(Yes, true, "")},
- {0xb4a5, 0, 0, 2, f(Yes, false, "")},
- {0xb4c0, 0, 0, 1, f(Yes, true, "")},
- {0xb4c1, 0, 0, 2, f(Yes, false, "")},
- {0xb4dc, 0, 0, 1, f(Yes, true, "")},
- {0xb4dd, 0, 0, 2, f(Yes, false, "")},
- {0xb4f8, 0, 0, 1, f(Yes, true, "")},
- {0xb4f9, 0, 0, 2, f(Yes, false, "")},
- {0xb514, 0, 0, 1, f(Yes, true, "")},
- {0xb515, 0, 0, 2, f(Yes, false, "")},
- {0xb530, 0, 0, 1, f(Yes, true, "")},
- {0xb531, 0, 0, 2, f(Yes, false, "")},
- {0xb54c, 0, 0, 1, f(Yes, true, "")},
- {0xb54d, 0, 0, 2, f(Yes, false, "")},
- {0xb568, 0, 0, 1, f(Yes, true, "")},
- {0xb569, 0, 0, 2, f(Yes, false, "")},
- {0xb584, 0, 0, 1, f(Yes, true, "")},
- {0xb585, 0, 0, 2, f(Yes, false, "")},
- {0xb5a0, 0, 0, 1, f(Yes, true, "")},
- {0xb5a1, 0, 0, 2, f(Yes, false, "")},
- {0xb5bc, 0, 0, 1, f(Yes, true, "")},
- {0xb5bd, 0, 0, 2, f(Yes, false, "")},
- {0xb5d8, 0, 0, 1, f(Yes, true, "")},
- {0xb5d9, 0, 0, 2, f(Yes, false, "")},
- {0xb5f4, 0, 0, 1, f(Yes, true, "")},
- {0xb5f5, 0, 0, 2, f(Yes, false, "")},
- {0xb610, 0, 0, 1, f(Yes, true, "")},
- {0xb611, 0, 0, 2, f(Yes, false, "")},
- {0xb62c, 0, 0, 1, f(Yes, true, "")},
- {0xb62d, 0, 0, 2, f(Yes, false, "")},
- {0xb648, 0, 0, 1, f(Yes, true, "")},
- {0xb649, 0, 0, 2, f(Yes, false, "")},
- {0xb664, 0, 0, 1, f(Yes, true, "")},
- {0xb665, 0, 0, 2, f(Yes, false, "")},
- {0xb680, 0, 0, 1, f(Yes, true, "")},
- {0xb681, 0, 0, 2, f(Yes, false, "")},
- {0xb69c, 0, 0, 1, f(Yes, true, "")},
- {0xb69d, 0, 0, 2, f(Yes, false, "")},
- {0xb6b8, 0, 0, 1, f(Yes, true, "")},
- {0xb6b9, 0, 0, 2, f(Yes, false, "")},
- {0xb6d4, 0, 0, 1, f(Yes, true, "")},
- {0xb6d5, 0, 0, 2, f(Yes, false, "")},
- {0xb6f0, 0, 0, 1, f(Yes, true, "")},
- {0xb6f1, 0, 0, 2, f(Yes, false, "")},
- {0xb70c, 0, 0, 1, f(Yes, true, "")},
- {0xb70d, 0, 0, 2, f(Yes, false, "")},
- {0xb728, 0, 0, 1, f(Yes, true, "")},
- {0xb729, 0, 0, 2, f(Yes, false, "")},
- {0xb744, 0, 0, 1, f(Yes, true, "")},
- {0xb745, 0, 0, 2, f(Yes, false, "")},
- {0xb760, 0, 0, 1, f(Yes, true, "")},
- {0xb761, 0, 0, 2, f(Yes, false, "")},
- {0xb77c, 0, 0, 1, f(Yes, true, "")},
- {0xb77d, 0, 0, 2, f(Yes, false, "")},
- {0xb798, 0, 0, 1, f(Yes, true, "")},
- {0xb799, 0, 0, 2, f(Yes, false, "")},
- {0xb7b4, 0, 0, 1, f(Yes, true, "")},
- {0xb7b5, 0, 0, 2, f(Yes, false, "")},
- {0xb7d0, 0, 0, 1, f(Yes, true, "")},
- {0xb7d1, 0, 0, 2, f(Yes, false, "")},
- {0xb7ec, 0, 0, 1, f(Yes, true, "")},
- {0xb7ed, 0, 0, 2, f(Yes, false, "")},
- {0xb808, 0, 0, 1, f(Yes, true, "")},
- {0xb809, 0, 0, 2, f(Yes, false, "")},
- {0xb824, 0, 0, 1, f(Yes, true, "")},
- {0xb825, 0, 0, 2, f(Yes, false, "")},
- {0xb840, 0, 0, 1, f(Yes, true, "")},
- {0xb841, 0, 0, 2, f(Yes, false, "")},
- {0xb85c, 0, 0, 1, f(Yes, true, "")},
- {0xb85d, 0, 0, 2, f(Yes, false, "")},
- {0xb878, 0, 0, 1, f(Yes, true, "")},
- {0xb879, 0, 0, 2, f(Yes, false, "")},
- {0xb894, 0, 0, 1, f(Yes, true, "")},
- {0xb895, 0, 0, 2, f(Yes, false, "")},
- {0xb8b0, 0, 0, 1, f(Yes, true, "")},
- {0xb8b1, 0, 0, 2, f(Yes, false, "")},
- {0xb8cc, 0, 0, 1, f(Yes, true, "")},
- {0xb8cd, 0, 0, 2, f(Yes, false, "")},
- {0xb8e8, 0, 0, 1, f(Yes, true, "")},
- {0xb8e9, 0, 0, 2, f(Yes, false, "")},
- {0xb904, 0, 0, 1, f(Yes, true, "")},
- {0xb905, 0, 0, 2, f(Yes, false, "")},
- {0xb920, 0, 0, 1, f(Yes, true, "")},
- {0xb921, 0, 0, 2, f(Yes, false, "")},
- {0xb93c, 0, 0, 1, f(Yes, true, "")},
- {0xb93d, 0, 0, 2, f(Yes, false, "")},
- {0xb958, 0, 0, 1, f(Yes, true, "")},
- {0xb959, 0, 0, 2, f(Yes, false, "")},
- {0xb974, 0, 0, 1, f(Yes, true, "")},
- {0xb975, 0, 0, 2, f(Yes, false, "")},
- {0xb990, 0, 0, 1, f(Yes, true, "")},
- {0xb991, 0, 0, 2, f(Yes, false, "")},
- {0xb9ac, 0, 0, 1, f(Yes, true, "")},
- {0xb9ad, 0, 0, 2, f(Yes, false, "")},
- {0xb9c8, 0, 0, 1, f(Yes, true, "")},
- {0xb9c9, 0, 0, 2, f(Yes, false, "")},
- {0xb9e4, 0, 0, 1, f(Yes, true, "")},
- {0xb9e5, 0, 0, 2, f(Yes, false, "")},
- {0xba00, 0, 0, 1, f(Yes, true, "")},
- {0xba01, 0, 0, 2, f(Yes, false, "")},
- {0xba1c, 0, 0, 1, f(Yes, true, "")},
- {0xba1d, 0, 0, 2, f(Yes, false, "")},
- {0xba38, 0, 0, 1, f(Yes, true, "")},
- {0xba39, 0, 0, 2, f(Yes, false, "")},
- {0xba54, 0, 0, 1, f(Yes, true, "")},
- {0xba55, 0, 0, 2, f(Yes, false, "")},
- {0xba70, 0, 0, 1, f(Yes, true, "")},
- {0xba71, 0, 0, 2, f(Yes, false, "")},
- {0xba8c, 0, 0, 1, f(Yes, true, "")},
- {0xba8d, 0, 0, 2, f(Yes, false, "")},
- {0xbaa8, 0, 0, 1, f(Yes, true, "")},
- {0xbaa9, 0, 0, 2, f(Yes, false, "")},
- {0xbac4, 0, 0, 1, f(Yes, true, "")},
- {0xbac5, 0, 0, 2, f(Yes, false, "")},
- {0xbae0, 0, 0, 1, f(Yes, true, "")},
- {0xbae1, 0, 0, 2, f(Yes, false, "")},
- {0xbafc, 0, 0, 1, f(Yes, true, "")},
- {0xbafd, 0, 0, 2, f(Yes, false, "")},
- {0xbb18, 0, 0, 1, f(Yes, true, "")},
- {0xbb19, 0, 0, 2, f(Yes, false, "")},
- {0xbb34, 0, 0, 1, f(Yes, true, "")},
- {0xbb35, 0, 0, 2, f(Yes, false, "")},
- {0xbb50, 0, 0, 1, f(Yes, true, "")},
- {0xbb51, 0, 0, 2, f(Yes, false, "")},
- {0xbb6c, 0, 0, 1, f(Yes, true, "")},
- {0xbb6d, 0, 0, 2, f(Yes, false, "")},
- {0xbb88, 0, 0, 1, f(Yes, true, "")},
- {0xbb89, 0, 0, 2, f(Yes, false, "")},
- {0xbba4, 0, 0, 1, f(Yes, true, "")},
- {0xbba5, 0, 0, 2, f(Yes, false, "")},
- {0xbbc0, 0, 0, 1, f(Yes, true, "")},
- {0xbbc1, 0, 0, 2, f(Yes, false, "")},
- {0xbbdc, 0, 0, 1, f(Yes, true, "")},
- {0xbbdd, 0, 0, 2, f(Yes, false, "")},
- {0xbbf8, 0, 0, 1, f(Yes, true, "")},
- {0xbbf9, 0, 0, 2, f(Yes, false, "")},
- {0xbc14, 0, 0, 1, f(Yes, true, "")},
- {0xbc15, 0, 0, 2, f(Yes, false, "")},
- {0xbc30, 0, 0, 1, f(Yes, true, "")},
- {0xbc31, 0, 0, 2, f(Yes, false, "")},
- {0xbc4c, 0, 0, 1, f(Yes, true, "")},
- {0xbc4d, 0, 0, 2, f(Yes, false, "")},
- {0xbc68, 0, 0, 1, f(Yes, true, "")},
- {0xbc69, 0, 0, 2, f(Yes, false, "")},
- {0xbc84, 0, 0, 1, f(Yes, true, "")},
- {0xbc85, 0, 0, 2, f(Yes, false, "")},
- {0xbca0, 0, 0, 1, f(Yes, true, "")},
- {0xbca1, 0, 0, 2, f(Yes, false, "")},
- {0xbcbc, 0, 0, 1, f(Yes, true, "")},
- {0xbcbd, 0, 0, 2, f(Yes, false, "")},
- {0xbcd8, 0, 0, 1, f(Yes, true, "")},
- {0xbcd9, 0, 0, 2, f(Yes, false, "")},
- {0xbcf4, 0, 0, 1, f(Yes, true, "")},
- {0xbcf5, 0, 0, 2, f(Yes, false, "")},
- {0xbd10, 0, 0, 1, f(Yes, true, "")},
- {0xbd11, 0, 0, 2, f(Yes, false, "")},
- {0xbd2c, 0, 0, 1, f(Yes, true, "")},
- {0xbd2d, 0, 0, 2, f(Yes, false, "")},
- {0xbd48, 0, 0, 1, f(Yes, true, "")},
- {0xbd49, 0, 0, 2, f(Yes, false, "")},
- {0xbd64, 0, 0, 1, f(Yes, true, "")},
- {0xbd65, 0, 0, 2, f(Yes, false, "")},
- {0xbd80, 0, 0, 1, f(Yes, true, "")},
- {0xbd81, 0, 0, 2, f(Yes, false, "")},
- {0xbd9c, 0, 0, 1, f(Yes, true, "")},
- {0xbd9d, 0, 0, 2, f(Yes, false, "")},
- {0xbdb8, 0, 0, 1, f(Yes, true, "")},
- {0xbdb9, 0, 0, 2, f(Yes, false, "")},
- {0xbdd4, 0, 0, 1, f(Yes, true, "")},
- {0xbdd5, 0, 0, 2, f(Yes, false, "")},
- {0xbdf0, 0, 0, 1, f(Yes, true, "")},
- {0xbdf1, 0, 0, 2, f(Yes, false, "")},
- {0xbe0c, 0, 0, 1, f(Yes, true, "")},
- {0xbe0d, 0, 0, 2, f(Yes, false, "")},
- {0xbe28, 0, 0, 1, f(Yes, true, "")},
- {0xbe29, 0, 0, 2, f(Yes, false, "")},
- {0xbe44, 0, 0, 1, f(Yes, true, "")},
- {0xbe45, 0, 0, 2, f(Yes, false, "")},
- {0xbe60, 0, 0, 1, f(Yes, true, "")},
- {0xbe61, 0, 0, 2, f(Yes, false, "")},
- {0xbe7c, 0, 0, 1, f(Yes, true, "")},
- {0xbe7d, 0, 0, 2, f(Yes, false, "")},
- {0xbe98, 0, 0, 1, f(Yes, true, "")},
- {0xbe99, 0, 0, 2, f(Yes, false, "")},
- {0xbeb4, 0, 0, 1, f(Yes, true, "")},
- {0xbeb5, 0, 0, 2, f(Yes, false, "")},
- {0xbed0, 0, 0, 1, f(Yes, true, "")},
- {0xbed1, 0, 0, 2, f(Yes, false, "")},
- {0xbeec, 0, 0, 1, f(Yes, true, "")},
- {0xbeed, 0, 0, 2, f(Yes, false, "")},
- {0xbf08, 0, 0, 1, f(Yes, true, "")},
- {0xbf09, 0, 0, 2, f(Yes, false, "")},
- {0xbf24, 0, 0, 1, f(Yes, true, "")},
- {0xbf25, 0, 0, 2, f(Yes, false, "")},
- {0xbf40, 0, 0, 1, f(Yes, true, "")},
- {0xbf41, 0, 0, 2, f(Yes, false, "")},
- {0xbf5c, 0, 0, 1, f(Yes, true, "")},
- {0xbf5d, 0, 0, 2, f(Yes, false, "")},
- {0xbf78, 0, 0, 1, f(Yes, true, "")},
- {0xbf79, 0, 0, 2, f(Yes, false, "")},
- {0xbf94, 0, 0, 1, f(Yes, true, "")},
- {0xbf95, 0, 0, 2, f(Yes, false, "")},
- {0xbfb0, 0, 0, 1, f(Yes, true, "")},
- {0xbfb1, 0, 0, 2, f(Yes, false, "")},
- {0xbfcc, 0, 0, 1, f(Yes, true, "")},
- {0xbfcd, 0, 0, 2, f(Yes, false, "")},
- {0xbfe8, 0, 0, 1, f(Yes, true, "")},
- {0xbfe9, 0, 0, 2, f(Yes, false, "")},
- {0xc004, 0, 0, 1, f(Yes, true, "")},
- {0xc005, 0, 0, 2, f(Yes, false, "")},
- {0xc020, 0, 0, 1, f(Yes, true, "")},
- {0xc021, 0, 0, 2, f(Yes, false, "")},
- {0xc03c, 0, 0, 1, f(Yes, true, "")},
- {0xc03d, 0, 0, 2, f(Yes, false, "")},
- {0xc058, 0, 0, 1, f(Yes, true, "")},
- {0xc059, 0, 0, 2, f(Yes, false, "")},
- {0xc074, 0, 0, 1, f(Yes, true, "")},
- {0xc075, 0, 0, 2, f(Yes, false, "")},
- {0xc090, 0, 0, 1, f(Yes, true, "")},
- {0xc091, 0, 0, 2, f(Yes, false, "")},
- {0xc0ac, 0, 0, 1, f(Yes, true, "")},
- {0xc0ad, 0, 0, 2, f(Yes, false, "")},
- {0xc0c8, 0, 0, 1, f(Yes, true, "")},
- {0xc0c9, 0, 0, 2, f(Yes, false, "")},
- {0xc0e4, 0, 0, 1, f(Yes, true, "")},
- {0xc0e5, 0, 0, 2, f(Yes, false, "")},
- {0xc100, 0, 0, 1, f(Yes, true, "")},
- {0xc101, 0, 0, 2, f(Yes, false, "")},
- {0xc11c, 0, 0, 1, f(Yes, true, "")},
- {0xc11d, 0, 0, 2, f(Yes, false, "")},
- {0xc138, 0, 0, 1, f(Yes, true, "")},
- {0xc139, 0, 0, 2, f(Yes, false, "")},
- {0xc154, 0, 0, 1, f(Yes, true, "")},
- {0xc155, 0, 0, 2, f(Yes, false, "")},
- {0xc170, 0, 0, 1, f(Yes, true, "")},
- {0xc171, 0, 0, 2, f(Yes, false, "")},
- {0xc18c, 0, 0, 1, f(Yes, true, "")},
- {0xc18d, 0, 0, 2, f(Yes, false, "")},
- {0xc1a8, 0, 0, 1, f(Yes, true, "")},
- {0xc1a9, 0, 0, 2, f(Yes, false, "")},
- {0xc1c4, 0, 0, 1, f(Yes, true, "")},
- {0xc1c5, 0, 0, 2, f(Yes, false, "")},
- {0xc1e0, 0, 0, 1, f(Yes, true, "")},
- {0xc1e1, 0, 0, 2, f(Yes, false, "")},
- {0xc1fc, 0, 0, 1, f(Yes, true, "")},
- {0xc1fd, 0, 0, 2, f(Yes, false, "")},
- {0xc218, 0, 0, 1, f(Yes, true, "")},
- {0xc219, 0, 0, 2, f(Yes, false, "")},
- {0xc234, 0, 0, 1, f(Yes, true, "")},
- {0xc235, 0, 0, 2, f(Yes, false, "")},
- {0xc250, 0, 0, 1, f(Yes, true, "")},
- {0xc251, 0, 0, 2, f(Yes, false, "")},
- {0xc26c, 0, 0, 1, f(Yes, true, "")},
- {0xc26d, 0, 0, 2, f(Yes, false, "")},
- {0xc288, 0, 0, 1, f(Yes, true, "")},
- {0xc289, 0, 0, 2, f(Yes, false, "")},
- {0xc2a4, 0, 0, 1, f(Yes, true, "")},
- {0xc2a5, 0, 0, 2, f(Yes, false, "")},
- {0xc2c0, 0, 0, 1, f(Yes, true, "")},
- {0xc2c1, 0, 0, 2, f(Yes, false, "")},
- {0xc2dc, 0, 0, 1, f(Yes, true, "")},
- {0xc2dd, 0, 0, 2, f(Yes, false, "")},
- {0xc2f8, 0, 0, 1, f(Yes, true, "")},
- {0xc2f9, 0, 0, 2, f(Yes, false, "")},
- {0xc314, 0, 0, 1, f(Yes, true, "")},
- {0xc315, 0, 0, 2, f(Yes, false, "")},
- {0xc330, 0, 0, 1, f(Yes, true, "")},
- {0xc331, 0, 0, 2, f(Yes, false, "")},
- {0xc34c, 0, 0, 1, f(Yes, true, "")},
- {0xc34d, 0, 0, 2, f(Yes, false, "")},
- {0xc368, 0, 0, 1, f(Yes, true, "")},
- {0xc369, 0, 0, 2, f(Yes, false, "")},
- {0xc384, 0, 0, 1, f(Yes, true, "")},
- {0xc385, 0, 0, 2, f(Yes, false, "")},
- {0xc3a0, 0, 0, 1, f(Yes, true, "")},
- {0xc3a1, 0, 0, 2, f(Yes, false, "")},
- {0xc3bc, 0, 0, 1, f(Yes, true, "")},
- {0xc3bd, 0, 0, 2, f(Yes, false, "")},
- {0xc3d8, 0, 0, 1, f(Yes, true, "")},
- {0xc3d9, 0, 0, 2, f(Yes, false, "")},
- {0xc3f4, 0, 0, 1, f(Yes, true, "")},
- {0xc3f5, 0, 0, 2, f(Yes, false, "")},
- {0xc410, 0, 0, 1, f(Yes, true, "")},
- {0xc411, 0, 0, 2, f(Yes, false, "")},
- {0xc42c, 0, 0, 1, f(Yes, true, "")},
- {0xc42d, 0, 0, 2, f(Yes, false, "")},
- {0xc448, 0, 0, 1, f(Yes, true, "")},
- {0xc449, 0, 0, 2, f(Yes, false, "")},
- {0xc464, 0, 0, 1, f(Yes, true, "")},
- {0xc465, 0, 0, 2, f(Yes, false, "")},
- {0xc480, 0, 0, 1, f(Yes, true, "")},
- {0xc481, 0, 0, 2, f(Yes, false, "")},
- {0xc49c, 0, 0, 1, f(Yes, true, "")},
- {0xc49d, 0, 0, 2, f(Yes, false, "")},
- {0xc4b8, 0, 0, 1, f(Yes, true, "")},
- {0xc4b9, 0, 0, 2, f(Yes, false, "")},
- {0xc4d4, 0, 0, 1, f(Yes, true, "")},
- {0xc4d5, 0, 0, 2, f(Yes, false, "")},
- {0xc4f0, 0, 0, 1, f(Yes, true, "")},
- {0xc4f1, 0, 0, 2, f(Yes, false, "")},
- {0xc50c, 0, 0, 1, f(Yes, true, "")},
- {0xc50d, 0, 0, 2, f(Yes, false, "")},
- {0xc528, 0, 0, 1, f(Yes, true, "")},
- {0xc529, 0, 0, 2, f(Yes, false, "")},
- {0xc544, 0, 0, 1, f(Yes, true, "")},
- {0xc545, 0, 0, 2, f(Yes, false, "")},
- {0xc560, 0, 0, 1, f(Yes, true, "")},
- {0xc561, 0, 0, 2, f(Yes, false, "")},
- {0xc57c, 0, 0, 1, f(Yes, true, "")},
- {0xc57d, 0, 0, 2, f(Yes, false, "")},
- {0xc598, 0, 0, 1, f(Yes, true, "")},
- {0xc599, 0, 0, 2, f(Yes, false, "")},
- {0xc5b4, 0, 0, 1, f(Yes, true, "")},
- {0xc5b5, 0, 0, 2, f(Yes, false, "")},
- {0xc5d0, 0, 0, 1, f(Yes, true, "")},
- {0xc5d1, 0, 0, 2, f(Yes, false, "")},
- {0xc5ec, 0, 0, 1, f(Yes, true, "")},
- {0xc5ed, 0, 0, 2, f(Yes, false, "")},
- {0xc608, 0, 0, 1, f(Yes, true, "")},
- {0xc609, 0, 0, 2, f(Yes, false, "")},
- {0xc624, 0, 0, 1, f(Yes, true, "")},
- {0xc625, 0, 0, 2, f(Yes, false, "")},
- {0xc640, 0, 0, 1, f(Yes, true, "")},
- {0xc641, 0, 0, 2, f(Yes, false, "")},
- {0xc65c, 0, 0, 1, f(Yes, true, "")},
- {0xc65d, 0, 0, 2, f(Yes, false, "")},
- {0xc678, 0, 0, 1, f(Yes, true, "")},
- {0xc679, 0, 0, 2, f(Yes, false, "")},
- {0xc694, 0, 0, 1, f(Yes, true, "")},
- {0xc695, 0, 0, 2, f(Yes, false, "")},
- {0xc6b0, 0, 0, 1, f(Yes, true, "")},
- {0xc6b1, 0, 0, 2, f(Yes, false, "")},
- {0xc6cc, 0, 0, 1, f(Yes, true, "")},
- {0xc6cd, 0, 0, 2, f(Yes, false, "")},
- {0xc6e8, 0, 0, 1, f(Yes, true, "")},
- {0xc6e9, 0, 0, 2, f(Yes, false, "")},
- {0xc704, 0, 0, 1, f(Yes, true, "")},
- {0xc705, 0, 0, 2, f(Yes, false, "")},
- {0xc720, 0, 0, 1, f(Yes, true, "")},
- {0xc721, 0, 0, 2, f(Yes, false, "")},
- {0xc73c, 0, 0, 1, f(Yes, true, "")},
- {0xc73d, 0, 0, 2, f(Yes, false, "")},
- {0xc758, 0, 0, 1, f(Yes, true, "")},
- {0xc759, 0, 0, 2, f(Yes, false, "")},
- {0xc774, 0, 0, 1, f(Yes, true, "")},
- {0xc775, 0, 0, 2, f(Yes, false, "")},
- {0xc790, 0, 0, 1, f(Yes, true, "")},
- {0xc791, 0, 0, 2, f(Yes, false, "")},
- {0xc7ac, 0, 0, 1, f(Yes, true, "")},
- {0xc7ad, 0, 0, 2, f(Yes, false, "")},
- {0xc7c8, 0, 0, 1, f(Yes, true, "")},
- {0xc7c9, 0, 0, 2, f(Yes, false, "")},
- {0xc7e4, 0, 0, 1, f(Yes, true, "")},
- {0xc7e5, 0, 0, 2, f(Yes, false, "")},
- {0xc800, 0, 0, 1, f(Yes, true, "")},
- {0xc801, 0, 0, 2, f(Yes, false, "")},
- {0xc81c, 0, 0, 1, f(Yes, true, "")},
- {0xc81d, 0, 0, 2, f(Yes, false, "")},
- {0xc838, 0, 0, 1, f(Yes, true, "")},
- {0xc839, 0, 0, 2, f(Yes, false, "")},
- {0xc854, 0, 0, 1, f(Yes, true, "")},
- {0xc855, 0, 0, 2, f(Yes, false, "")},
- {0xc870, 0, 0, 1, f(Yes, true, "")},
- {0xc871, 0, 0, 2, f(Yes, false, "")},
- {0xc88c, 0, 0, 1, f(Yes, true, "")},
- {0xc88d, 0, 0, 2, f(Yes, false, "")},
- {0xc8a8, 0, 0, 1, f(Yes, true, "")},
- {0xc8a9, 0, 0, 2, f(Yes, false, "")},
- {0xc8c4, 0, 0, 1, f(Yes, true, "")},
- {0xc8c5, 0, 0, 2, f(Yes, false, "")},
- {0xc8e0, 0, 0, 1, f(Yes, true, "")},
- {0xc8e1, 0, 0, 2, f(Yes, false, "")},
- {0xc8fc, 0, 0, 1, f(Yes, true, "")},
- {0xc8fd, 0, 0, 2, f(Yes, false, "")},
- {0xc918, 0, 0, 1, f(Yes, true, "")},
- {0xc919, 0, 0, 2, f(Yes, false, "")},
- {0xc934, 0, 0, 1, f(Yes, true, "")},
- {0xc935, 0, 0, 2, f(Yes, false, "")},
- {0xc950, 0, 0, 1, f(Yes, true, "")},
- {0xc951, 0, 0, 2, f(Yes, false, "")},
- {0xc96c, 0, 0, 1, f(Yes, true, "")},
- {0xc96d, 0, 0, 2, f(Yes, false, "")},
- {0xc988, 0, 0, 1, f(Yes, true, "")},
- {0xc989, 0, 0, 2, f(Yes, false, "")},
- {0xc9a4, 0, 0, 1, f(Yes, true, "")},
- {0xc9a5, 0, 0, 2, f(Yes, false, "")},
- {0xc9c0, 0, 0, 1, f(Yes, true, "")},
- {0xc9c1, 0, 0, 2, f(Yes, false, "")},
- {0xc9dc, 0, 0, 1, f(Yes, true, "")},
- {0xc9dd, 0, 0, 2, f(Yes, false, "")},
- {0xc9f8, 0, 0, 1, f(Yes, true, "")},
- {0xc9f9, 0, 0, 2, f(Yes, false, "")},
- {0xca14, 0, 0, 1, f(Yes, true, "")},
- {0xca15, 0, 0, 2, f(Yes, false, "")},
- {0xca30, 0, 0, 1, f(Yes, true, "")},
- {0xca31, 0, 0, 2, f(Yes, false, "")},
- {0xca4c, 0, 0, 1, f(Yes, true, "")},
- {0xca4d, 0, 0, 2, f(Yes, false, "")},
- {0xca68, 0, 0, 1, f(Yes, true, "")},
- {0xca69, 0, 0, 2, f(Yes, false, "")},
- {0xca84, 0, 0, 1, f(Yes, true, "")},
- {0xca85, 0, 0, 2, f(Yes, false, "")},
- {0xcaa0, 0, 0, 1, f(Yes, true, "")},
- {0xcaa1, 0, 0, 2, f(Yes, false, "")},
- {0xcabc, 0, 0, 1, f(Yes, true, "")},
- {0xcabd, 0, 0, 2, f(Yes, false, "")},
- {0xcad8, 0, 0, 1, f(Yes, true, "")},
- {0xcad9, 0, 0, 2, f(Yes, false, "")},
- {0xcaf4, 0, 0, 1, f(Yes, true, "")},
- {0xcaf5, 0, 0, 2, f(Yes, false, "")},
- {0xcb10, 0, 0, 1, f(Yes, true, "")},
- {0xcb11, 0, 0, 2, f(Yes, false, "")},
- {0xcb2c, 0, 0, 1, f(Yes, true, "")},
- {0xcb2d, 0, 0, 2, f(Yes, false, "")},
- {0xcb48, 0, 0, 1, f(Yes, true, "")},
- {0xcb49, 0, 0, 2, f(Yes, false, "")},
- {0xcb64, 0, 0, 1, f(Yes, true, "")},
- {0xcb65, 0, 0, 2, f(Yes, false, "")},
- {0xcb80, 0, 0, 1, f(Yes, true, "")},
- {0xcb81, 0, 0, 2, f(Yes, false, "")},
- {0xcb9c, 0, 0, 1, f(Yes, true, "")},
- {0xcb9d, 0, 0, 2, f(Yes, false, "")},
- {0xcbb8, 0, 0, 1, f(Yes, true, "")},
- {0xcbb9, 0, 0, 2, f(Yes, false, "")},
- {0xcbd4, 0, 0, 1, f(Yes, true, "")},
- {0xcbd5, 0, 0, 2, f(Yes, false, "")},
- {0xcbf0, 0, 0, 1, f(Yes, true, "")},
- {0xcbf1, 0, 0, 2, f(Yes, false, "")},
- {0xcc0c, 0, 0, 1, f(Yes, true, "")},
- {0xcc0d, 0, 0, 2, f(Yes, false, "")},
- {0xcc28, 0, 0, 1, f(Yes, true, "")},
- {0xcc29, 0, 0, 2, f(Yes, false, "")},
- {0xcc44, 0, 0, 1, f(Yes, true, "")},
- {0xcc45, 0, 0, 2, f(Yes, false, "")},
- {0xcc60, 0, 0, 1, f(Yes, true, "")},
- {0xcc61, 0, 0, 2, f(Yes, false, "")},
- {0xcc7c, 0, 0, 1, f(Yes, true, "")},
- {0xcc7d, 0, 0, 2, f(Yes, false, "")},
- {0xcc98, 0, 0, 1, f(Yes, true, "")},
- {0xcc99, 0, 0, 2, f(Yes, false, "")},
- {0xccb4, 0, 0, 1, f(Yes, true, "")},
- {0xccb5, 0, 0, 2, f(Yes, false, "")},
- {0xccd0, 0, 0, 1, f(Yes, true, "")},
- {0xccd1, 0, 0, 2, f(Yes, false, "")},
- {0xccec, 0, 0, 1, f(Yes, true, "")},
- {0xcced, 0, 0, 2, f(Yes, false, "")},
- {0xcd08, 0, 0, 1, f(Yes, true, "")},
- {0xcd09, 0, 0, 2, f(Yes, false, "")},
- {0xcd24, 0, 0, 1, f(Yes, true, "")},
- {0xcd25, 0, 0, 2, f(Yes, false, "")},
- {0xcd40, 0, 0, 1, f(Yes, true, "")},
- {0xcd41, 0, 0, 2, f(Yes, false, "")},
- {0xcd5c, 0, 0, 1, f(Yes, true, "")},
- {0xcd5d, 0, 0, 2, f(Yes, false, "")},
- {0xcd78, 0, 0, 1, f(Yes, true, "")},
- {0xcd79, 0, 0, 2, f(Yes, false, "")},
- {0xcd94, 0, 0, 1, f(Yes, true, "")},
- {0xcd95, 0, 0, 2, f(Yes, false, "")},
- {0xcdb0, 0, 0, 1, f(Yes, true, "")},
- {0xcdb1, 0, 0, 2, f(Yes, false, "")},
- {0xcdcc, 0, 0, 1, f(Yes, true, "")},
- {0xcdcd, 0, 0, 2, f(Yes, false, "")},
- {0xcde8, 0, 0, 1, f(Yes, true, "")},
- {0xcde9, 0, 0, 2, f(Yes, false, "")},
- {0xce04, 0, 0, 1, f(Yes, true, "")},
- {0xce05, 0, 0, 2, f(Yes, false, "")},
- {0xce20, 0, 0, 1, f(Yes, true, "")},
- {0xce21, 0, 0, 2, f(Yes, false, "")},
- {0xce3c, 0, 0, 1, f(Yes, true, "")},
- {0xce3d, 0, 0, 2, f(Yes, false, "")},
- {0xce58, 0, 0, 1, f(Yes, true, "")},
- {0xce59, 0, 0, 2, f(Yes, false, "")},
- {0xce74, 0, 0, 1, f(Yes, true, "")},
- {0xce75, 0, 0, 2, f(Yes, false, "")},
- {0xce90, 0, 0, 1, f(Yes, true, "")},
- {0xce91, 0, 0, 2, f(Yes, false, "")},
- {0xceac, 0, 0, 1, f(Yes, true, "")},
- {0xcead, 0, 0, 2, f(Yes, false, "")},
- {0xcec8, 0, 0, 1, f(Yes, true, "")},
- {0xcec9, 0, 0, 2, f(Yes, false, "")},
- {0xcee4, 0, 0, 1, f(Yes, true, "")},
- {0xcee5, 0, 0, 2, f(Yes, false, "")},
- {0xcf00, 0, 0, 1, f(Yes, true, "")},
- {0xcf01, 0, 0, 2, f(Yes, false, "")},
- {0xcf1c, 0, 0, 1, f(Yes, true, "")},
- {0xcf1d, 0, 0, 2, f(Yes, false, "")},
- {0xcf38, 0, 0, 1, f(Yes, true, "")},
- {0xcf39, 0, 0, 2, f(Yes, false, "")},
- {0xcf54, 0, 0, 1, f(Yes, true, "")},
- {0xcf55, 0, 0, 2, f(Yes, false, "")},
- {0xcf70, 0, 0, 1, f(Yes, true, "")},
- {0xcf71, 0, 0, 2, f(Yes, false, "")},
- {0xcf8c, 0, 0, 1, f(Yes, true, "")},
- {0xcf8d, 0, 0, 2, f(Yes, false, "")},
- {0xcfa8, 0, 0, 1, f(Yes, true, "")},
- {0xcfa9, 0, 0, 2, f(Yes, false, "")},
- {0xcfc4, 0, 0, 1, f(Yes, true, "")},
- {0xcfc5, 0, 0, 2, f(Yes, false, "")},
- {0xcfe0, 0, 0, 1, f(Yes, true, "")},
- {0xcfe1, 0, 0, 2, f(Yes, false, "")},
- {0xcffc, 0, 0, 1, f(Yes, true, "")},
- {0xcffd, 0, 0, 2, f(Yes, false, "")},
- {0xd018, 0, 0, 1, f(Yes, true, "")},
- {0xd019, 0, 0, 2, f(Yes, false, "")},
- {0xd034, 0, 0, 1, f(Yes, true, "")},
- {0xd035, 0, 0, 2, f(Yes, false, "")},
- {0xd050, 0, 0, 1, f(Yes, true, "")},
- {0xd051, 0, 0, 2, f(Yes, false, "")},
- {0xd06c, 0, 0, 1, f(Yes, true, "")},
- {0xd06d, 0, 0, 2, f(Yes, false, "")},
- {0xd088, 0, 0, 1, f(Yes, true, "")},
- {0xd089, 0, 0, 2, f(Yes, false, "")},
- {0xd0a4, 0, 0, 1, f(Yes, true, "")},
- {0xd0a5, 0, 0, 2, f(Yes, false, "")},
- {0xd0c0, 0, 0, 1, f(Yes, true, "")},
- {0xd0c1, 0, 0, 2, f(Yes, false, "")},
- {0xd0dc, 0, 0, 1, f(Yes, true, "")},
- {0xd0dd, 0, 0, 2, f(Yes, false, "")},
- {0xd0f8, 0, 0, 1, f(Yes, true, "")},
- {0xd0f9, 0, 0, 2, f(Yes, false, "")},
- {0xd114, 0, 0, 1, f(Yes, true, "")},
- {0xd115, 0, 0, 2, f(Yes, false, "")},
- {0xd130, 0, 0, 1, f(Yes, true, "")},
- {0xd131, 0, 0, 2, f(Yes, false, "")},
- {0xd14c, 0, 0, 1, f(Yes, true, "")},
- {0xd14d, 0, 0, 2, f(Yes, false, "")},
- {0xd168, 0, 0, 1, f(Yes, true, "")},
- {0xd169, 0, 0, 2, f(Yes, false, "")},
- {0xd184, 0, 0, 1, f(Yes, true, "")},
- {0xd185, 0, 0, 2, f(Yes, false, "")},
- {0xd1a0, 0, 0, 1, f(Yes, true, "")},
- {0xd1a1, 0, 0, 2, f(Yes, false, "")},
- {0xd1bc, 0, 0, 1, f(Yes, true, "")},
- {0xd1bd, 0, 0, 2, f(Yes, false, "")},
- {0xd1d8, 0, 0, 1, f(Yes, true, "")},
- {0xd1d9, 0, 0, 2, f(Yes, false, "")},
- {0xd1f4, 0, 0, 1, f(Yes, true, "")},
- {0xd1f5, 0, 0, 2, f(Yes, false, "")},
- {0xd210, 0, 0, 1, f(Yes, true, "")},
- {0xd211, 0, 0, 2, f(Yes, false, "")},
- {0xd22c, 0, 0, 1, f(Yes, true, "")},
- {0xd22d, 0, 0, 2, f(Yes, false, "")},
- {0xd248, 0, 0, 1, f(Yes, true, "")},
- {0xd249, 0, 0, 2, f(Yes, false, "")},
- {0xd264, 0, 0, 1, f(Yes, true, "")},
- {0xd265, 0, 0, 2, f(Yes, false, "")},
- {0xd280, 0, 0, 1, f(Yes, true, "")},
- {0xd281, 0, 0, 2, f(Yes, false, "")},
- {0xd29c, 0, 0, 1, f(Yes, true, "")},
- {0xd29d, 0, 0, 2, f(Yes, false, "")},
- {0xd2b8, 0, 0, 1, f(Yes, true, "")},
- {0xd2b9, 0, 0, 2, f(Yes, false, "")},
- {0xd2d4, 0, 0, 1, f(Yes, true, "")},
- {0xd2d5, 0, 0, 2, f(Yes, false, "")},
- {0xd2f0, 0, 0, 1, f(Yes, true, "")},
- {0xd2f1, 0, 0, 2, f(Yes, false, "")},
- {0xd30c, 0, 0, 1, f(Yes, true, "")},
- {0xd30d, 0, 0, 2, f(Yes, false, "")},
- {0xd328, 0, 0, 1, f(Yes, true, "")},
- {0xd329, 0, 0, 2, f(Yes, false, "")},
- {0xd344, 0, 0, 1, f(Yes, true, "")},
- {0xd345, 0, 0, 2, f(Yes, false, "")},
- {0xd360, 0, 0, 1, f(Yes, true, "")},
- {0xd361, 0, 0, 2, f(Yes, false, "")},
- {0xd37c, 0, 0, 1, f(Yes, true, "")},
- {0xd37d, 0, 0, 2, f(Yes, false, "")},
- {0xd398, 0, 0, 1, f(Yes, true, "")},
- {0xd399, 0, 0, 2, f(Yes, false, "")},
- {0xd3b4, 0, 0, 1, f(Yes, true, "")},
- {0xd3b5, 0, 0, 2, f(Yes, false, "")},
- {0xd3d0, 0, 0, 1, f(Yes, true, "")},
- {0xd3d1, 0, 0, 2, f(Yes, false, "")},
- {0xd3ec, 0, 0, 1, f(Yes, true, "")},
- {0xd3ed, 0, 0, 2, f(Yes, false, "")},
- {0xd408, 0, 0, 1, f(Yes, true, "")},
- {0xd409, 0, 0, 2, f(Yes, false, "")},
- {0xd424, 0, 0, 1, f(Yes, true, "")},
- {0xd425, 0, 0, 2, f(Yes, false, "")},
- {0xd440, 0, 0, 1, f(Yes, true, "")},
- {0xd441, 0, 0, 2, f(Yes, false, "")},
- {0xd45c, 0, 0, 1, f(Yes, true, "")},
- {0xd45d, 0, 0, 2, f(Yes, false, "")},
- {0xd478, 0, 0, 1, f(Yes, true, "")},
- {0xd479, 0, 0, 2, f(Yes, false, "")},
- {0xd494, 0, 0, 1, f(Yes, true, "")},
- {0xd495, 0, 0, 2, f(Yes, false, "")},
- {0xd4b0, 0, 0, 1, f(Yes, true, "")},
- {0xd4b1, 0, 0, 2, f(Yes, false, "")},
- {0xd4cc, 0, 0, 1, f(Yes, true, "")},
- {0xd4cd, 0, 0, 2, f(Yes, false, "")},
- {0xd4e8, 0, 0, 1, f(Yes, true, "")},
- {0xd4e9, 0, 0, 2, f(Yes, false, "")},
- {0xd504, 0, 0, 1, f(Yes, true, "")},
- {0xd505, 0, 0, 2, f(Yes, false, "")},
- {0xd520, 0, 0, 1, f(Yes, true, "")},
- {0xd521, 0, 0, 2, f(Yes, false, "")},
- {0xd53c, 0, 0, 1, f(Yes, true, "")},
- {0xd53d, 0, 0, 2, f(Yes, false, "")},
- {0xd558, 0, 0, 1, f(Yes, true, "")},
- {0xd559, 0, 0, 2, f(Yes, false, "")},
- {0xd574, 0, 0, 1, f(Yes, true, "")},
- {0xd575, 0, 0, 2, f(Yes, false, "")},
- {0xd590, 0, 0, 1, f(Yes, true, "")},
- {0xd591, 0, 0, 2, f(Yes, false, "")},
- {0xd5ac, 0, 0, 1, f(Yes, true, "")},
- {0xd5ad, 0, 0, 2, f(Yes, false, "")},
- {0xd5c8, 0, 0, 1, f(Yes, true, "")},
- {0xd5c9, 0, 0, 2, f(Yes, false, "")},
- {0xd5e4, 0, 0, 1, f(Yes, true, "")},
- {0xd5e5, 0, 0, 2, f(Yes, false, "")},
- {0xd600, 0, 0, 1, f(Yes, true, "")},
- {0xd601, 0, 0, 2, f(Yes, false, "")},
- {0xd61c, 0, 0, 1, f(Yes, true, "")},
- {0xd61d, 0, 0, 2, f(Yes, false, "")},
- {0xd638, 0, 0, 1, f(Yes, true, "")},
- {0xd639, 0, 0, 2, f(Yes, false, "")},
- {0xd654, 0, 0, 1, f(Yes, true, "")},
- {0xd655, 0, 0, 2, f(Yes, false, "")},
- {0xd670, 0, 0, 1, f(Yes, true, "")},
- {0xd671, 0, 0, 2, f(Yes, false, "")},
- {0xd68c, 0, 0, 1, f(Yes, true, "")},
- {0xd68d, 0, 0, 2, f(Yes, false, "")},
- {0xd6a8, 0, 0, 1, f(Yes, true, "")},
- {0xd6a9, 0, 0, 2, f(Yes, false, "")},
- {0xd6c4, 0, 0, 1, f(Yes, true, "")},
- {0xd6c5, 0, 0, 2, f(Yes, false, "")},
- {0xd6e0, 0, 0, 1, f(Yes, true, "")},
- {0xd6e1, 0, 0, 2, f(Yes, false, "")},
- {0xd6fc, 0, 0, 1, f(Yes, true, "")},
- {0xd6fd, 0, 0, 2, f(Yes, false, "")},
- {0xd718, 0, 0, 1, f(Yes, true, "")},
- {0xd719, 0, 0, 2, f(Yes, false, "")},
- {0xd734, 0, 0, 1, f(Yes, true, "")},
- {0xd735, 0, 0, 2, f(Yes, false, "")},
- {0xd750, 0, 0, 1, f(Yes, true, "")},
- {0xd751, 0, 0, 2, f(Yes, false, "")},
- {0xd76c, 0, 0, 1, f(Yes, true, "")},
- {0xd76d, 0, 0, 2, f(Yes, false, "")},
- {0xd788, 0, 0, 1, f(Yes, true, "")},
- {0xd789, 0, 0, 2, f(Yes, false, "")},
- {0xd7a4, 0, 0, 0, f(Yes, false, "")},
- {0xf900, 0, 0, 0, f(No, false, "豈")},
- {0xf901, 0, 0, 0, f(No, false, "更")},
- {0xf902, 0, 0, 0, f(No, false, "車")},
- {0xf903, 0, 0, 0, f(No, false, "賈")},
- {0xf904, 0, 0, 0, f(No, false, "滑")},
- {0xf905, 0, 0, 0, f(No, false, "串")},
- {0xf906, 0, 0, 0, f(No, false, "句")},
- {0xf907, 0, 0, 0, f(No, false, "龜")},
- {0xf909, 0, 0, 0, f(No, false, "契")},
- {0xf90a, 0, 0, 0, f(No, false, "金")},
- {0xf90b, 0, 0, 0, f(No, false, "喇")},
- {0xf90c, 0, 0, 0, f(No, false, "奈")},
- {0xf90d, 0, 0, 0, f(No, false, "懶")},
- {0xf90e, 0, 0, 0, f(No, false, "癩")},
- {0xf90f, 0, 0, 0, f(No, false, "羅")},
- {0xf910, 0, 0, 0, f(No, false, "蘿")},
- {0xf911, 0, 0, 0, f(No, false, "螺")},
- {0xf912, 0, 0, 0, f(No, false, "裸")},
- {0xf913, 0, 0, 0, f(No, false, "邏")},
- {0xf914, 0, 0, 0, f(No, false, "樂")},
- {0xf915, 0, 0, 0, f(No, false, "洛")},
- {0xf916, 0, 0, 0, f(No, false, "烙")},
- {0xf917, 0, 0, 0, f(No, false, "珞")},
- {0xf918, 0, 0, 0, f(No, false, "落")},
- {0xf919, 0, 0, 0, f(No, false, "酪")},
- {0xf91a, 0, 0, 0, f(No, false, "駱")},
- {0xf91b, 0, 0, 0, f(No, false, "亂")},
- {0xf91c, 0, 0, 0, f(No, false, "卵")},
- {0xf91d, 0, 0, 0, f(No, false, "欄")},
- {0xf91e, 0, 0, 0, f(No, false, "爛")},
- {0xf91f, 0, 0, 0, f(No, false, "蘭")},
- {0xf920, 0, 0, 0, f(No, false, "鸞")},
- {0xf921, 0, 0, 0, f(No, false, "嵐")},
- {0xf922, 0, 0, 0, f(No, false, "濫")},
- {0xf923, 0, 0, 0, f(No, false, "藍")},
- {0xf924, 0, 0, 0, f(No, false, "襤")},
- {0xf925, 0, 0, 0, f(No, false, "拉")},
- {0xf926, 0, 0, 0, f(No, false, "臘")},
- {0xf927, 0, 0, 0, f(No, false, "蠟")},
- {0xf928, 0, 0, 0, f(No, false, "廊")},
- {0xf929, 0, 0, 0, f(No, false, "朗")},
- {0xf92a, 0, 0, 0, f(No, false, "浪")},
- {0xf92b, 0, 0, 0, f(No, false, "狼")},
- {0xf92c, 0, 0, 0, f(No, false, "郎")},
- {0xf92d, 0, 0, 0, f(No, false, "來")},
- {0xf92e, 0, 0, 0, f(No, false, "冷")},
- {0xf92f, 0, 0, 0, f(No, false, "勞")},
- {0xf930, 0, 0, 0, f(No, false, "擄")},
- {0xf931, 0, 0, 0, f(No, false, "櫓")},
- {0xf932, 0, 0, 0, f(No, false, "爐")},
- {0xf933, 0, 0, 0, f(No, false, "盧")},
- {0xf934, 0, 0, 0, f(No, false, "老")},
- {0xf935, 0, 0, 0, f(No, false, "蘆")},
- {0xf936, 0, 0, 0, f(No, false, "虜")},
- {0xf937, 0, 0, 0, f(No, false, "路")},
- {0xf938, 0, 0, 0, f(No, false, "露")},
- {0xf939, 0, 0, 0, f(No, false, "魯")},
- {0xf93a, 0, 0, 0, f(No, false, "鷺")},
- {0xf93b, 0, 0, 0, f(No, false, "碌")},
- {0xf93c, 0, 0, 0, f(No, false, "祿")},
- {0xf93d, 0, 0, 0, f(No, false, "綠")},
- {0xf93e, 0, 0, 0, f(No, false, "菉")},
- {0xf93f, 0, 0, 0, f(No, false, "錄")},
- {0xf940, 0, 0, 0, f(No, false, "鹿")},
- {0xf941, 0, 0, 0, f(No, false, "論")},
- {0xf942, 0, 0, 0, f(No, false, "壟")},
- {0xf943, 0, 0, 0, f(No, false, "弄")},
- {0xf944, 0, 0, 0, f(No, false, "籠")},
- {0xf945, 0, 0, 0, f(No, false, "聾")},
- {0xf946, 0, 0, 0, f(No, false, "牢")},
- {0xf947, 0, 0, 0, f(No, false, "磊")},
- {0xf948, 0, 0, 0, f(No, false, "賂")},
- {0xf949, 0, 0, 0, f(No, false, "雷")},
- {0xf94a, 0, 0, 0, f(No, false, "壘")},
- {0xf94b, 0, 0, 0, f(No, false, "屢")},
- {0xf94c, 0, 0, 0, f(No, false, "樓")},
- {0xf94d, 0, 0, 0, f(No, false, "淚")},
- {0xf94e, 0, 0, 0, f(No, false, "漏")},
- {0xf94f, 0, 0, 0, f(No, false, "累")},
- {0xf950, 0, 0, 0, f(No, false, "縷")},
- {0xf951, 0, 0, 0, f(No, false, "陋")},
- {0xf952, 0, 0, 0, f(No, false, "勒")},
- {0xf953, 0, 0, 0, f(No, false, "肋")},
- {0xf954, 0, 0, 0, f(No, false, "凜")},
- {0xf955, 0, 0, 0, f(No, false, "凌")},
- {0xf956, 0, 0, 0, f(No, false, "稜")},
- {0xf957, 0, 0, 0, f(No, false, "綾")},
- {0xf958, 0, 0, 0, f(No, false, "菱")},
- {0xf959, 0, 0, 0, f(No, false, "陵")},
- {0xf95a, 0, 0, 0, f(No, false, "讀")},
- {0xf95b, 0, 0, 0, f(No, false, "拏")},
- {0xf95c, 0, 0, 0, f(No, false, "樂")},
- {0xf95d, 0, 0, 0, f(No, false, "諾")},
- {0xf95e, 0, 0, 0, f(No, false, "丹")},
- {0xf95f, 0, 0, 0, f(No, false, "寧")},
- {0xf960, 0, 0, 0, f(No, false, "怒")},
- {0xf961, 0, 0, 0, f(No, false, "率")},
- {0xf962, 0, 0, 0, f(No, false, "異")},
- {0xf963, 0, 0, 0, f(No, false, "北")},
- {0xf964, 0, 0, 0, f(No, false, "磻")},
- {0xf965, 0, 0, 0, f(No, false, "便")},
- {0xf966, 0, 0, 0, f(No, false, "復")},
- {0xf967, 0, 0, 0, f(No, false, "不")},
- {0xf968, 0, 0, 0, f(No, false, "泌")},
- {0xf969, 0, 0, 0, f(No, false, "數")},
- {0xf96a, 0, 0, 0, f(No, false, "索")},
- {0xf96b, 0, 0, 0, f(No, false, "參")},
- {0xf96c, 0, 0, 0, f(No, false, "塞")},
- {0xf96d, 0, 0, 0, f(No, false, "省")},
- {0xf96e, 0, 0, 0, f(No, false, "葉")},
- {0xf96f, 0, 0, 0, f(No, false, "說")},
- {0xf970, 0, 0, 0, f(No, false, "殺")},
- {0xf971, 0, 0, 0, f(No, false, "辰")},
- {0xf972, 0, 0, 0, f(No, false, "沈")},
- {0xf973, 0, 0, 0, f(No, false, "拾")},
- {0xf974, 0, 0, 0, f(No, false, "若")},
- {0xf975, 0, 0, 0, f(No, false, "掠")},
- {0xf976, 0, 0, 0, f(No, false, "略")},
- {0xf977, 0, 0, 0, f(No, false, "亮")},
- {0xf978, 0, 0, 0, f(No, false, "兩")},
- {0xf979, 0, 0, 0, f(No, false, "凉")},
- {0xf97a, 0, 0, 0, f(No, false, "梁")},
- {0xf97b, 0, 0, 0, f(No, false, "糧")},
- {0xf97c, 0, 0, 0, f(No, false, "良")},
- {0xf97d, 0, 0, 0, f(No, false, "諒")},
- {0xf97e, 0, 0, 0, f(No, false, "量")},
- {0xf97f, 0, 0, 0, f(No, false, "勵")},
- {0xf980, 0, 0, 0, f(No, false, "呂")},
- {0xf981, 0, 0, 0, f(No, false, "女")},
- {0xf982, 0, 0, 0, f(No, false, "廬")},
- {0xf983, 0, 0, 0, f(No, false, "旅")},
- {0xf984, 0, 0, 0, f(No, false, "濾")},
- {0xf985, 0, 0, 0, f(No, false, "礪")},
- {0xf986, 0, 0, 0, f(No, false, "閭")},
- {0xf987, 0, 0, 0, f(No, false, "驪")},
- {0xf988, 0, 0, 0, f(No, false, "麗")},
- {0xf989, 0, 0, 0, f(No, false, "黎")},
- {0xf98a, 0, 0, 0, f(No, false, "力")},
- {0xf98b, 0, 0, 0, f(No, false, "曆")},
- {0xf98c, 0, 0, 0, f(No, false, "歷")},
- {0xf98d, 0, 0, 0, f(No, false, "轢")},
- {0xf98e, 0, 0, 0, f(No, false, "年")},
- {0xf98f, 0, 0, 0, f(No, false, "憐")},
- {0xf990, 0, 0, 0, f(No, false, "戀")},
- {0xf991, 0, 0, 0, f(No, false, "撚")},
- {0xf992, 0, 0, 0, f(No, false, "漣")},
- {0xf993, 0, 0, 0, f(No, false, "煉")},
- {0xf994, 0, 0, 0, f(No, false, "璉")},
- {0xf995, 0, 0, 0, f(No, false, "秊")},
- {0xf996, 0, 0, 0, f(No, false, "練")},
- {0xf997, 0, 0, 0, f(No, false, "聯")},
- {0xf998, 0, 0, 0, f(No, false, "輦")},
- {0xf999, 0, 0, 0, f(No, false, "蓮")},
- {0xf99a, 0, 0, 0, f(No, false, "連")},
- {0xf99b, 0, 0, 0, f(No, false, "鍊")},
- {0xf99c, 0, 0, 0, f(No, false, "列")},
- {0xf99d, 0, 0, 0, f(No, false, "劣")},
- {0xf99e, 0, 0, 0, f(No, false, "咽")},
- {0xf99f, 0, 0, 0, f(No, false, "烈")},
- {0xf9a0, 0, 0, 0, f(No, false, "裂")},
- {0xf9a1, 0, 0, 0, f(No, false, "說")},
- {0xf9a2, 0, 0, 0, f(No, false, "廉")},
- {0xf9a3, 0, 0, 0, f(No, false, "念")},
- {0xf9a4, 0, 0, 0, f(No, false, "捻")},
- {0xf9a5, 0, 0, 0, f(No, false, "殮")},
- {0xf9a6, 0, 0, 0, f(No, false, "簾")},
- {0xf9a7, 0, 0, 0, f(No, false, "獵")},
- {0xf9a8, 0, 0, 0, f(No, false, "令")},
- {0xf9a9, 0, 0, 0, f(No, false, "囹")},
- {0xf9aa, 0, 0, 0, f(No, false, "寧")},
- {0xf9ab, 0, 0, 0, f(No, false, "嶺")},
- {0xf9ac, 0, 0, 0, f(No, false, "怜")},
- {0xf9ad, 0, 0, 0, f(No, false, "玲")},
- {0xf9ae, 0, 0, 0, f(No, false, "瑩")},
- {0xf9af, 0, 0, 0, f(No, false, "羚")},
- {0xf9b0, 0, 0, 0, f(No, false, "聆")},
- {0xf9b1, 0, 0, 0, f(No, false, "鈴")},
- {0xf9b2, 0, 0, 0, f(No, false, "零")},
- {0xf9b3, 0, 0, 0, f(No, false, "靈")},
- {0xf9b4, 0, 0, 0, f(No, false, "領")},
- {0xf9b5, 0, 0, 0, f(No, false, "例")},
- {0xf9b6, 0, 0, 0, f(No, false, "禮")},
- {0xf9b7, 0, 0, 0, f(No, false, "醴")},
- {0xf9b8, 0, 0, 0, f(No, false, "隸")},
- {0xf9b9, 0, 0, 0, f(No, false, "惡")},
- {0xf9ba, 0, 0, 0, f(No, false, "了")},
- {0xf9bb, 0, 0, 0, f(No, false, "僚")},
- {0xf9bc, 0, 0, 0, f(No, false, "寮")},
- {0xf9bd, 0, 0, 0, f(No, false, "尿")},
- {0xf9be, 0, 0, 0, f(No, false, "料")},
- {0xf9bf, 0, 0, 0, f(No, false, "樂")},
- {0xf9c0, 0, 0, 0, f(No, false, "燎")},
- {0xf9c1, 0, 0, 0, f(No, false, "療")},
- {0xf9c2, 0, 0, 0, f(No, false, "蓼")},
- {0xf9c3, 0, 0, 0, f(No, false, "遼")},
- {0xf9c4, 0, 0, 0, f(No, false, "龍")},
- {0xf9c5, 0, 0, 0, f(No, false, "暈")},
- {0xf9c6, 0, 0, 0, f(No, false, "阮")},
- {0xf9c7, 0, 0, 0, f(No, false, "劉")},
- {0xf9c8, 0, 0, 0, f(No, false, "杻")},
- {0xf9c9, 0, 0, 0, f(No, false, "柳")},
- {0xf9ca, 0, 0, 0, f(No, false, "流")},
- {0xf9cb, 0, 0, 0, f(No, false, "溜")},
- {0xf9cc, 0, 0, 0, f(No, false, "琉")},
- {0xf9cd, 0, 0, 0, f(No, false, "留")},
- {0xf9ce, 0, 0, 0, f(No, false, "硫")},
- {0xf9cf, 0, 0, 0, f(No, false, "紐")},
- {0xf9d0, 0, 0, 0, f(No, false, "類")},
- {0xf9d1, 0, 0, 0, f(No, false, "六")},
- {0xf9d2, 0, 0, 0, f(No, false, "戮")},
- {0xf9d3, 0, 0, 0, f(No, false, "陸")},
- {0xf9d4, 0, 0, 0, f(No, false, "倫")},
- {0xf9d5, 0, 0, 0, f(No, false, "崙")},
- {0xf9d6, 0, 0, 0, f(No, false, "淪")},
- {0xf9d7, 0, 0, 0, f(No, false, "輪")},
- {0xf9d8, 0, 0, 0, f(No, false, "律")},
- {0xf9d9, 0, 0, 0, f(No, false, "慄")},
- {0xf9da, 0, 0, 0, f(No, false, "栗")},
- {0xf9db, 0, 0, 0, f(No, false, "率")},
- {0xf9dc, 0, 0, 0, f(No, false, "隆")},
- {0xf9dd, 0, 0, 0, f(No, false, "利")},
- {0xf9de, 0, 0, 0, f(No, false, "吏")},
- {0xf9df, 0, 0, 0, f(No, false, "履")},
- {0xf9e0, 0, 0, 0, f(No, false, "易")},
- {0xf9e1, 0, 0, 0, f(No, false, "李")},
- {0xf9e2, 0, 0, 0, f(No, false, "梨")},
- {0xf9e3, 0, 0, 0, f(No, false, "泥")},
- {0xf9e4, 0, 0, 0, f(No, false, "理")},
- {0xf9e5, 0, 0, 0, f(No, false, "痢")},
- {0xf9e6, 0, 0, 0, f(No, false, "罹")},
- {0xf9e7, 0, 0, 0, f(No, false, "裏")},
- {0xf9e8, 0, 0, 0, f(No, false, "裡")},
- {0xf9e9, 0, 0, 0, f(No, false, "里")},
- {0xf9ea, 0, 0, 0, f(No, false, "離")},
- {0xf9eb, 0, 0, 0, f(No, false, "匿")},
- {0xf9ec, 0, 0, 0, f(No, false, "溺")},
- {0xf9ed, 0, 0, 0, f(No, false, "吝")},
- {0xf9ee, 0, 0, 0, f(No, false, "燐")},
- {0xf9ef, 0, 0, 0, f(No, false, "璘")},
- {0xf9f0, 0, 0, 0, f(No, false, "藺")},
- {0xf9f1, 0, 0, 0, f(No, false, "隣")},
- {0xf9f2, 0, 0, 0, f(No, false, "鱗")},
- {0xf9f3, 0, 0, 0, f(No, false, "麟")},
- {0xf9f4, 0, 0, 0, f(No, false, "林")},
- {0xf9f5, 0, 0, 0, f(No, false, "淋")},
- {0xf9f6, 0, 0, 0, f(No, false, "臨")},
- {0xf9f7, 0, 0, 0, f(No, false, "立")},
- {0xf9f8, 0, 0, 0, f(No, false, "笠")},
- {0xf9f9, 0, 0, 0, f(No, false, "粒")},
- {0xf9fa, 0, 0, 0, f(No, false, "狀")},
- {0xf9fb, 0, 0, 0, f(No, false, "炙")},
- {0xf9fc, 0, 0, 0, f(No, false, "識")},
- {0xf9fd, 0, 0, 0, f(No, false, "什")},
- {0xf9fe, 0, 0, 0, f(No, false, "茶")},
- {0xf9ff, 0, 0, 0, f(No, false, "刺")},
- {0xfa00, 0, 0, 0, f(No, false, "切")},
- {0xfa01, 0, 0, 0, f(No, false, "度")},
- {0xfa02, 0, 0, 0, f(No, false, "拓")},
- {0xfa03, 0, 0, 0, f(No, false, "糖")},
- {0xfa04, 0, 0, 0, f(No, false, "宅")},
- {0xfa05, 0, 0, 0, f(No, false, "洞")},
- {0xfa06, 0, 0, 0, f(No, false, "暴")},
- {0xfa07, 0, 0, 0, f(No, false, "輻")},
- {0xfa08, 0, 0, 0, f(No, false, "行")},
- {0xfa09, 0, 0, 0, f(No, false, "降")},
- {0xfa0a, 0, 0, 0, f(No, false, "見")},
- {0xfa0b, 0, 0, 0, f(No, false, "廓")},
- {0xfa0c, 0, 0, 0, f(No, false, "兀")},
- {0xfa0d, 0, 0, 0, f(No, false, "嗀")},
- {0xfa0e, 0, 0, 0, f(Yes, false, "")},
- {0xfa10, 0, 0, 0, f(No, false, "塚")},
- {0xfa11, 0, 0, 0, f(Yes, false, "")},
- {0xfa12, 0, 0, 0, f(No, false, "晴")},
- {0xfa13, 0, 0, 0, f(Yes, false, "")},
- {0xfa15, 0, 0, 0, f(No, false, "凞")},
- {0xfa16, 0, 0, 0, f(No, false, "猪")},
- {0xfa17, 0, 0, 0, f(No, false, "益")},
- {0xfa18, 0, 0, 0, f(No, false, "礼")},
- {0xfa19, 0, 0, 0, f(No, false, "神")},
- {0xfa1a, 0, 0, 0, f(No, false, "祥")},
- {0xfa1b, 0, 0, 0, f(No, false, "福")},
- {0xfa1c, 0, 0, 0, f(No, false, "靖")},
- {0xfa1d, 0, 0, 0, f(No, false, "精")},
- {0xfa1e, 0, 0, 0, f(No, false, "羽")},
- {0xfa1f, 0, 0, 0, f(Yes, false, "")},
- {0xfa20, 0, 0, 0, f(No, false, "蘒")},
- {0xfa21, 0, 0, 0, f(Yes, false, "")},
- {0xfa22, 0, 0, 0, f(No, false, "諸")},
- {0xfa23, 0, 0, 0, f(Yes, false, "")},
- {0xfa25, 0, 0, 0, f(No, false, "逸")},
- {0xfa26, 0, 0, 0, f(No, false, "都")},
- {0xfa27, 0, 0, 0, f(Yes, false, "")},
- {0xfa2a, 0, 0, 0, f(No, false, "飯")},
- {0xfa2b, 0, 0, 0, f(No, false, "飼")},
- {0xfa2c, 0, 0, 0, f(No, false, "館")},
- {0xfa2d, 0, 0, 0, f(No, false, "鶴")},
- {0xfa2e, 0, 0, 0, f(No, false, "郞")},
- {0xfa2f, 0, 0, 0, f(No, false, "隷")},
- {0xfa30, 0, 0, 0, f(No, false, "侮")},
- {0xfa31, 0, 0, 0, f(No, false, "僧")},
- {0xfa32, 0, 0, 0, f(No, false, "免")},
- {0xfa33, 0, 0, 0, f(No, false, "勉")},
- {0xfa34, 0, 0, 0, f(No, false, "勤")},
- {0xfa35, 0, 0, 0, f(No, false, "卑")},
- {0xfa36, 0, 0, 0, f(No, false, "喝")},
- {0xfa37, 0, 0, 0, f(No, false, "嘆")},
- {0xfa38, 0, 0, 0, f(No, false, "器")},
- {0xfa39, 0, 0, 0, f(No, false, "塀")},
- {0xfa3a, 0, 0, 0, f(No, false, "墨")},
- {0xfa3b, 0, 0, 0, f(No, false, "層")},
- {0xfa3c, 0, 0, 0, f(No, false, "屮")},
- {0xfa3d, 0, 0, 0, f(No, false, "悔")},
- {0xfa3e, 0, 0, 0, f(No, false, "慨")},
- {0xfa3f, 0, 0, 0, f(No, false, "憎")},
- {0xfa40, 0, 0, 0, f(No, false, "懲")},
- {0xfa41, 0, 0, 0, f(No, false, "敏")},
- {0xfa42, 0, 0, 0, f(No, false, "既")},
- {0xfa43, 0, 0, 0, f(No, false, "暑")},
- {0xfa44, 0, 0, 0, f(No, false, "梅")},
- {0xfa45, 0, 0, 0, f(No, false, "海")},
- {0xfa46, 0, 0, 0, f(No, false, "渚")},
- {0xfa47, 0, 0, 0, f(No, false, "漢")},
- {0xfa48, 0, 0, 0, f(No, false, "煮")},
- {0xfa49, 0, 0, 0, f(No, false, "爫")},
- {0xfa4a, 0, 0, 0, f(No, false, "琢")},
- {0xfa4b, 0, 0, 0, f(No, false, "碑")},
- {0xfa4c, 0, 0, 0, f(No, false, "社")},
- {0xfa4d, 0, 0, 0, f(No, false, "祉")},
- {0xfa4e, 0, 0, 0, f(No, false, "祈")},
- {0xfa4f, 0, 0, 0, f(No, false, "祐")},
- {0xfa50, 0, 0, 0, f(No, false, "祖")},
- {0xfa51, 0, 0, 0, f(No, false, "祝")},
- {0xfa52, 0, 0, 0, f(No, false, "禍")},
- {0xfa53, 0, 0, 0, f(No, false, "禎")},
- {0xfa54, 0, 0, 0, f(No, false, "穀")},
- {0xfa55, 0, 0, 0, f(No, false, "突")},
- {0xfa56, 0, 0, 0, f(No, false, "節")},
- {0xfa57, 0, 0, 0, f(No, false, "練")},
- {0xfa58, 0, 0, 0, f(No, false, "縉")},
- {0xfa59, 0, 0, 0, f(No, false, "繁")},
- {0xfa5a, 0, 0, 0, f(No, false, "署")},
- {0xfa5b, 0, 0, 0, f(No, false, "者")},
- {0xfa5c, 0, 0, 0, f(No, false, "臭")},
- {0xfa5d, 0, 0, 0, f(No, false, "艹")},
- {0xfa5f, 0, 0, 0, f(No, false, "著")},
- {0xfa60, 0, 0, 0, f(No, false, "褐")},
- {0xfa61, 0, 0, 0, f(No, false, "視")},
- {0xfa62, 0, 0, 0, f(No, false, "謁")},
- {0xfa63, 0, 0, 0, f(No, false, "謹")},
- {0xfa64, 0, 0, 0, f(No, false, "賓")},
- {0xfa65, 0, 0, 0, f(No, false, "贈")},
- {0xfa66, 0, 0, 0, f(No, false, "辶")},
- {0xfa67, 0, 0, 0, f(No, false, "逸")},
- {0xfa68, 0, 0, 0, f(No, false, "難")},
- {0xfa69, 0, 0, 0, f(No, false, "響")},
- {0xfa6a, 0, 0, 0, f(No, false, "頻")},
- {0xfa6b, 0, 0, 0, f(No, false, "恵")},
- {0xfa6c, 0, 0, 0, f(No, false, "𤋮")},
- {0xfa6d, 0, 0, 0, f(No, false, "舘")},
- {0xfa6e, 0, 0, 0, f(Yes, false, "")},
- {0xfa70, 0, 0, 0, f(No, false, "並")},
- {0xfa71, 0, 0, 0, f(No, false, "况")},
- {0xfa72, 0, 0, 0, f(No, false, "全")},
- {0xfa73, 0, 0, 0, f(No, false, "侀")},
- {0xfa74, 0, 0, 0, f(No, false, "充")},
- {0xfa75, 0, 0, 0, f(No, false, "冀")},
- {0xfa76, 0, 0, 0, f(No, false, "勇")},
- {0xfa77, 0, 0, 0, f(No, false, "勺")},
- {0xfa78, 0, 0, 0, f(No, false, "喝")},
- {0xfa79, 0, 0, 0, f(No, false, "啕")},
- {0xfa7a, 0, 0, 0, f(No, false, "喙")},
- {0xfa7b, 0, 0, 0, f(No, false, "嗢")},
- {0xfa7c, 0, 0, 0, f(No, false, "塚")},
- {0xfa7d, 0, 0, 0, f(No, false, "墳")},
- {0xfa7e, 0, 0, 0, f(No, false, "奄")},
- {0xfa7f, 0, 0, 0, f(No, false, "奔")},
- {0xfa80, 0, 0, 0, f(No, false, "婢")},
- {0xfa81, 0, 0, 0, f(No, false, "嬨")},
- {0xfa82, 0, 0, 0, f(No, false, "廒")},
- {0xfa83, 0, 0, 0, f(No, false, "廙")},
- {0xfa84, 0, 0, 0, f(No, false, "彩")},
- {0xfa85, 0, 0, 0, f(No, false, "徭")},
- {0xfa86, 0, 0, 0, f(No, false, "惘")},
- {0xfa87, 0, 0, 0, f(No, false, "慎")},
- {0xfa88, 0, 0, 0, f(No, false, "愈")},
- {0xfa89, 0, 0, 0, f(No, false, "憎")},
- {0xfa8a, 0, 0, 0, f(No, false, "慠")},
- {0xfa8b, 0, 0, 0, f(No, false, "懲")},
- {0xfa8c, 0, 0, 0, f(No, false, "戴")},
- {0xfa8d, 0, 0, 0, f(No, false, "揄")},
- {0xfa8e, 0, 0, 0, f(No, false, "搜")},
- {0xfa8f, 0, 0, 0, f(No, false, "摒")},
- {0xfa90, 0, 0, 0, f(No, false, "敖")},
- {0xfa91, 0, 0, 0, f(No, false, "晴")},
- {0xfa92, 0, 0, 0, f(No, false, "朗")},
- {0xfa93, 0, 0, 0, f(No, false, "望")},
- {0xfa94, 0, 0, 0, f(No, false, "杖")},
- {0xfa95, 0, 0, 0, f(No, false, "歹")},
- {0xfa96, 0, 0, 0, f(No, false, "殺")},
- {0xfa97, 0, 0, 0, f(No, false, "流")},
- {0xfa98, 0, 0, 0, f(No, false, "滛")},
- {0xfa99, 0, 0, 0, f(No, false, "滋")},
- {0xfa9a, 0, 0, 0, f(No, false, "漢")},
- {0xfa9b, 0, 0, 0, f(No, false, "瀞")},
- {0xfa9c, 0, 0, 0, f(No, false, "煮")},
- {0xfa9d, 0, 0, 0, f(No, false, "瞧")},
- {0xfa9e, 0, 0, 0, f(No, false, "爵")},
- {0xfa9f, 0, 0, 0, f(No, false, "犯")},
- {0xfaa0, 0, 0, 0, f(No, false, "猪")},
- {0xfaa1, 0, 0, 0, f(No, false, "瑱")},
- {0xfaa2, 0, 0, 0, f(No, false, "甆")},
- {0xfaa3, 0, 0, 0, f(No, false, "画")},
- {0xfaa4, 0, 0, 0, f(No, false, "瘝")},
- {0xfaa5, 0, 0, 0, f(No, false, "瘟")},
- {0xfaa6, 0, 0, 0, f(No, false, "益")},
- {0xfaa7, 0, 0, 0, f(No, false, "盛")},
- {0xfaa8, 0, 0, 0, f(No, false, "直")},
- {0xfaa9, 0, 0, 0, f(No, false, "睊")},
- {0xfaaa, 0, 0, 0, f(No, false, "着")},
- {0xfaab, 0, 0, 0, f(No, false, "磌")},
- {0xfaac, 0, 0, 0, f(No, false, "窱")},
- {0xfaad, 0, 0, 0, f(No, false, "節")},
- {0xfaae, 0, 0, 0, f(No, false, "类")},
- {0xfaaf, 0, 0, 0, f(No, false, "絛")},
- {0xfab0, 0, 0, 0, f(No, false, "練")},
- {0xfab1, 0, 0, 0, f(No, false, "缾")},
- {0xfab2, 0, 0, 0, f(No, false, "者")},
- {0xfab3, 0, 0, 0, f(No, false, "荒")},
- {0xfab4, 0, 0, 0, f(No, false, "華")},
- {0xfab5, 0, 0, 0, f(No, false, "蝹")},
- {0xfab6, 0, 0, 0, f(No, false, "襁")},
- {0xfab7, 0, 0, 0, f(No, false, "覆")},
- {0xfab8, 0, 0, 0, f(No, false, "視")},
- {0xfab9, 0, 0, 0, f(No, false, "調")},
- {0xfaba, 0, 0, 0, f(No, false, "諸")},
- {0xfabb, 0, 0, 0, f(No, false, "請")},
- {0xfabc, 0, 0, 0, f(No, false, "謁")},
- {0xfabd, 0, 0, 0, f(No, false, "諾")},
- {0xfabe, 0, 0, 0, f(No, false, "諭")},
- {0xfabf, 0, 0, 0, f(No, false, "謹")},
- {0xfac0, 0, 0, 0, f(No, false, "變")},
- {0xfac1, 0, 0, 0, f(No, false, "贈")},
- {0xfac2, 0, 0, 0, f(No, false, "輸")},
- {0xfac3, 0, 0, 0, f(No, false, "遲")},
- {0xfac4, 0, 0, 0, f(No, false, "醙")},
- {0xfac5, 0, 0, 0, f(No, false, "鉶")},
- {0xfac6, 0, 0, 0, f(No, false, "陼")},
- {0xfac7, 0, 0, 0, f(No, false, "難")},
- {0xfac8, 0, 0, 0, f(No, false, "靖")},
- {0xfac9, 0, 0, 0, f(No, false, "韛")},
- {0xfaca, 0, 0, 0, f(No, false, "響")},
- {0xfacb, 0, 0, 0, f(No, false, "頋")},
- {0xfacc, 0, 0, 0, f(No, false, "頻")},
- {0xfacd, 0, 0, 0, f(No, false, "鬒")},
- {0xface, 0, 0, 0, f(No, false, "龜")},
- {0xfacf, 0, 0, 0, f(No, false, "𢡊")},
- {0xfad0, 0, 0, 0, f(No, false, "𢡄")},
- {0xfad1, 0, 0, 0, f(No, false, "𣏕")},
- {0xfad2, 0, 0, 0, f(No, false, "㮝")},
- {0xfad3, 0, 0, 0, f(No, false, "䀘")},
- {0xfad4, 0, 0, 0, f(No, false, "䀹")},
- {0xfad5, 0, 0, 0, f(No, false, "𥉉")},
- {0xfad6, 0, 0, 0, f(No, false, "𥳐")},
- {0xfad7, 0, 0, 0, f(No, false, "𧻓")},
- {0xfad8, 0, 0, 0, f(No, false, "齃")},
- {0xfad9, 0, 0, 0, f(No, false, "龎")},
- {0xfada, 0, 0, 0, f(Yes, false, "")},
- {0xfb00, 0, 0, 0, g(Yes, No, false, false, "", "ff")},
- {0xfb01, 0, 0, 0, g(Yes, No, false, false, "", "fi")},
- {0xfb02, 0, 0, 0, g(Yes, No, false, false, "", "fl")},
- {0xfb03, 0, 0, 0, g(Yes, No, false, false, "", "ffi")},
- {0xfb04, 0, 0, 0, g(Yes, No, false, false, "", "ffl")},
- {0xfb05, 0, 0, 0, g(Yes, No, false, false, "", "st")},
- {0xfb07, 0, 0, 0, f(Yes, false, "")},
- {0xfb13, 0, 0, 0, g(Yes, No, false, false, "", "մն")},
- {0xfb14, 0, 0, 0, g(Yes, No, false, false, "", "մե")},
- {0xfb15, 0, 0, 0, g(Yes, No, false, false, "", "մի")},
- {0xfb16, 0, 0, 0, g(Yes, No, false, false, "", "վն")},
- {0xfb17, 0, 0, 0, g(Yes, No, false, false, "", "մխ")},
- {0xfb18, 0, 0, 0, f(Yes, false, "")},
- {0xfb1d, 0, 0, 1, f(No, false, "יִ")},
- {0xfb1e, 26, 1, 1, f(Yes, false, "")},
- {0xfb1f, 0, 0, 1, f(No, false, "ײַ")},
- {0xfb20, 0, 0, 0, g(Yes, No, false, false, "", "ע")},
- {0xfb21, 0, 0, 0, g(Yes, No, false, false, "", "א")},
- {0xfb22, 0, 0, 0, g(Yes, No, false, false, "", "ד")},
- {0xfb23, 0, 0, 0, g(Yes, No, false, false, "", "ה")},
- {0xfb24, 0, 0, 0, g(Yes, No, false, false, "", "כ")},
- {0xfb25, 0, 0, 0, g(Yes, No, false, false, "", "ל")},
- {0xfb26, 0, 0, 0, g(Yes, No, false, false, "", "ם")},
- {0xfb27, 0, 0, 0, g(Yes, No, false, false, "", "ר")},
- {0xfb28, 0, 0, 0, g(Yes, No, false, false, "", "ת")},
- {0xfb29, 0, 0, 0, g(Yes, No, false, false, "", "+")},
- {0xfb2a, 0, 0, 1, f(No, false, "שׁ")},
- {0xfb2b, 0, 0, 1, f(No, false, "שׂ")},
- {0xfb2c, 0, 0, 2, f(No, false, "שּׁ")},
- {0xfb2d, 0, 0, 2, f(No, false, "שּׂ")},
- {0xfb2e, 0, 0, 1, f(No, false, "אַ")},
- {0xfb2f, 0, 0, 1, f(No, false, "אָ")},
- {0xfb30, 0, 0, 1, f(No, false, "אּ")},
- {0xfb31, 0, 0, 1, f(No, false, "בּ")},
- {0xfb32, 0, 0, 1, f(No, false, "גּ")},
- {0xfb33, 0, 0, 1, f(No, false, "דּ")},
- {0xfb34, 0, 0, 1, f(No, false, "הּ")},
- {0xfb35, 0, 0, 1, f(No, false, "וּ")},
- {0xfb36, 0, 0, 1, f(No, false, "זּ")},
- {0xfb37, 0, 0, 0, f(Yes, false, "")},
- {0xfb38, 0, 0, 1, f(No, false, "טּ")},
- {0xfb39, 0, 0, 1, f(No, false, "יּ")},
- {0xfb3a, 0, 0, 1, f(No, false, "ךּ")},
- {0xfb3b, 0, 0, 1, f(No, false, "כּ")},
- {0xfb3c, 0, 0, 1, f(No, false, "לּ")},
- {0xfb3d, 0, 0, 0, f(Yes, false, "")},
- {0xfb3e, 0, 0, 1, f(No, false, "מּ")},
- {0xfb3f, 0, 0, 0, f(Yes, false, "")},
- {0xfb40, 0, 0, 1, f(No, false, "נּ")},
- {0xfb41, 0, 0, 1, f(No, false, "סּ")},
- {0xfb42, 0, 0, 0, f(Yes, false, "")},
- {0xfb43, 0, 0, 1, f(No, false, "ףּ")},
- {0xfb44, 0, 0, 1, f(No, false, "פּ")},
- {0xfb45, 0, 0, 0, f(Yes, false, "")},
- {0xfb46, 0, 0, 1, f(No, false, "צּ")},
- {0xfb47, 0, 0, 1, f(No, false, "קּ")},
- {0xfb48, 0, 0, 1, f(No, false, "רּ")},
- {0xfb49, 0, 0, 1, f(No, false, "שּ")},
- {0xfb4a, 0, 0, 1, f(No, false, "תּ")},
- {0xfb4b, 0, 0, 1, f(No, false, "וֹ")},
- {0xfb4c, 0, 0, 1, f(No, false, "בֿ")},
- {0xfb4d, 0, 0, 1, f(No, false, "כֿ")},
- {0xfb4e, 0, 0, 1, f(No, false, "פֿ")},
- {0xfb4f, 0, 0, 0, g(Yes, No, false, false, "", "אל")},
- {0xfb50, 0, 0, 0, g(Yes, No, false, false, "", "ٱ")},
- {0xfb52, 0, 0, 0, g(Yes, No, false, false, "", "ٻ")},
- {0xfb56, 0, 0, 0, g(Yes, No, false, false, "", "پ")},
- {0xfb5a, 0, 0, 0, g(Yes, No, false, false, "", "ڀ")},
- {0xfb5e, 0, 0, 0, g(Yes, No, false, false, "", "ٺ")},
- {0xfb62, 0, 0, 0, g(Yes, No, false, false, "", "ٿ")},
- {0xfb66, 0, 0, 0, g(Yes, No, false, false, "", "ٹ")},
- {0xfb6a, 0, 0, 0, g(Yes, No, false, false, "", "ڤ")},
- {0xfb6e, 0, 0, 0, g(Yes, No, false, false, "", "ڦ")},
- {0xfb72, 0, 0, 0, g(Yes, No, false, false, "", "ڄ")},
- {0xfb76, 0, 0, 0, g(Yes, No, false, false, "", "ڃ")},
- {0xfb7a, 0, 0, 0, g(Yes, No, false, false, "", "چ")},
- {0xfb7e, 0, 0, 0, g(Yes, No, false, false, "", "ڇ")},
- {0xfb82, 0, 0, 0, g(Yes, No, false, false, "", "ڍ")},
- {0xfb84, 0, 0, 0, g(Yes, No, false, false, "", "ڌ")},
- {0xfb86, 0, 0, 0, g(Yes, No, false, false, "", "ڎ")},
- {0xfb88, 0, 0, 0, g(Yes, No, false, false, "", "ڈ")},
- {0xfb8a, 0, 0, 0, g(Yes, No, false, false, "", "ژ")},
- {0xfb8c, 0, 0, 0, g(Yes, No, false, false, "", "ڑ")},
- {0xfb8e, 0, 0, 0, g(Yes, No, false, false, "", "ک")},
- {0xfb92, 0, 0, 0, g(Yes, No, false, false, "", "گ")},
- {0xfb96, 0, 0, 0, g(Yes, No, false, false, "", "ڳ")},
- {0xfb9a, 0, 0, 0, g(Yes, No, false, false, "", "ڱ")},
- {0xfb9e, 0, 0, 0, g(Yes, No, false, false, "", "ں")},
- {0xfba0, 0, 0, 0, g(Yes, No, false, false, "", "ڻ")},
- {0xfba4, 0, 0, 1, g(Yes, No, false, false, "", "ۀ")},
- {0xfba6, 0, 0, 0, g(Yes, No, false, false, "", "ہ")},
- {0xfbaa, 0, 0, 0, g(Yes, No, false, false, "", "ھ")},
- {0xfbae, 0, 0, 0, g(Yes, No, false, false, "", "ے")},
- {0xfbb0, 0, 0, 1, g(Yes, No, false, false, "", "ۓ")},
- {0xfbb2, 0, 0, 0, f(Yes, false, "")},
- {0xfbd3, 0, 0, 0, g(Yes, No, false, false, "", "ڭ")},
- {0xfbd7, 0, 0, 0, g(Yes, No, false, false, "", "ۇ")},
- {0xfbd9, 0, 0, 0, g(Yes, No, false, false, "", "ۆ")},
- {0xfbdb, 0, 0, 0, g(Yes, No, false, false, "", "ۈ")},
- {0xfbdd, 0, 0, 0, g(Yes, No, false, false, "", "ۇٴ")},
- {0xfbde, 0, 0, 0, g(Yes, No, false, false, "", "ۋ")},
- {0xfbe0, 0, 0, 0, g(Yes, No, false, false, "", "ۅ")},
- {0xfbe2, 0, 0, 0, g(Yes, No, false, false, "", "ۉ")},
- {0xfbe4, 0, 0, 0, g(Yes, No, false, false, "", "ې")},
- {0xfbe8, 0, 0, 0, g(Yes, No, false, false, "", "ى")},
- {0xfbea, 0, 0, 0, g(Yes, No, false, false, "", "ئا")},
- {0xfbec, 0, 0, 0, g(Yes, No, false, false, "", "ئە")},
- {0xfbee, 0, 0, 0, g(Yes, No, false, false, "", "ئو")},
- {0xfbf0, 0, 0, 0, g(Yes, No, false, false, "", "ئۇ")},
- {0xfbf2, 0, 0, 0, g(Yes, No, false, false, "", "ئۆ")},
- {0xfbf4, 0, 0, 0, g(Yes, No, false, false, "", "ئۈ")},
- {0xfbf6, 0, 0, 0, g(Yes, No, false, false, "", "ئې")},
- {0xfbf9, 0, 0, 0, g(Yes, No, false, false, "", "ئى")},
- {0xfbfc, 0, 0, 0, g(Yes, No, false, false, "", "ی")},
- {0xfc00, 0, 0, 0, g(Yes, No, false, false, "", "ئج")},
- {0xfc01, 0, 0, 0, g(Yes, No, false, false, "", "ئح")},
- {0xfc02, 0, 0, 0, g(Yes, No, false, false, "", "ئم")},
- {0xfc03, 0, 0, 0, g(Yes, No, false, false, "", "ئى")},
- {0xfc04, 0, 0, 0, g(Yes, No, false, false, "", "ئي")},
- {0xfc05, 0, 0, 0, g(Yes, No, false, false, "", "بج")},
- {0xfc06, 0, 0, 0, g(Yes, No, false, false, "", "بح")},
- {0xfc07, 0, 0, 0, g(Yes, No, false, false, "", "بخ")},
- {0xfc08, 0, 0, 0, g(Yes, No, false, false, "", "بم")},
- {0xfc09, 0, 0, 0, g(Yes, No, false, false, "", "بى")},
- {0xfc0a, 0, 0, 0, g(Yes, No, false, false, "", "بي")},
- {0xfc0b, 0, 0, 0, g(Yes, No, false, false, "", "تج")},
- {0xfc0c, 0, 0, 0, g(Yes, No, false, false, "", "تح")},
- {0xfc0d, 0, 0, 0, g(Yes, No, false, false, "", "تخ")},
- {0xfc0e, 0, 0, 0, g(Yes, No, false, false, "", "تم")},
- {0xfc0f, 0, 0, 0, g(Yes, No, false, false, "", "تى")},
- {0xfc10, 0, 0, 0, g(Yes, No, false, false, "", "تي")},
- {0xfc11, 0, 0, 0, g(Yes, No, false, false, "", "ثج")},
- {0xfc12, 0, 0, 0, g(Yes, No, false, false, "", "ثم")},
- {0xfc13, 0, 0, 0, g(Yes, No, false, false, "", "ثى")},
- {0xfc14, 0, 0, 0, g(Yes, No, false, false, "", "ثي")},
- {0xfc15, 0, 0, 0, g(Yes, No, false, false, "", "جح")},
- {0xfc16, 0, 0, 0, g(Yes, No, false, false, "", "جم")},
- {0xfc17, 0, 0, 0, g(Yes, No, false, false, "", "حج")},
- {0xfc18, 0, 0, 0, g(Yes, No, false, false, "", "حم")},
- {0xfc19, 0, 0, 0, g(Yes, No, false, false, "", "خج")},
- {0xfc1a, 0, 0, 0, g(Yes, No, false, false, "", "خح")},
- {0xfc1b, 0, 0, 0, g(Yes, No, false, false, "", "خم")},
- {0xfc1c, 0, 0, 0, g(Yes, No, false, false, "", "سج")},
- {0xfc1d, 0, 0, 0, g(Yes, No, false, false, "", "سح")},
- {0xfc1e, 0, 0, 0, g(Yes, No, false, false, "", "سخ")},
- {0xfc1f, 0, 0, 0, g(Yes, No, false, false, "", "سم")},
- {0xfc20, 0, 0, 0, g(Yes, No, false, false, "", "صح")},
- {0xfc21, 0, 0, 0, g(Yes, No, false, false, "", "صم")},
- {0xfc22, 0, 0, 0, g(Yes, No, false, false, "", "ضج")},
- {0xfc23, 0, 0, 0, g(Yes, No, false, false, "", "ضح")},
- {0xfc24, 0, 0, 0, g(Yes, No, false, false, "", "ضخ")},
- {0xfc25, 0, 0, 0, g(Yes, No, false, false, "", "ضم")},
- {0xfc26, 0, 0, 0, g(Yes, No, false, false, "", "طح")},
- {0xfc27, 0, 0, 0, g(Yes, No, false, false, "", "طم")},
- {0xfc28, 0, 0, 0, g(Yes, No, false, false, "", "ظم")},
- {0xfc29, 0, 0, 0, g(Yes, No, false, false, "", "عج")},
- {0xfc2a, 0, 0, 0, g(Yes, No, false, false, "", "عم")},
- {0xfc2b, 0, 0, 0, g(Yes, No, false, false, "", "غج")},
- {0xfc2c, 0, 0, 0, g(Yes, No, false, false, "", "غم")},
- {0xfc2d, 0, 0, 0, g(Yes, No, false, false, "", "فج")},
- {0xfc2e, 0, 0, 0, g(Yes, No, false, false, "", "فح")},
- {0xfc2f, 0, 0, 0, g(Yes, No, false, false, "", "فخ")},
- {0xfc30, 0, 0, 0, g(Yes, No, false, false, "", "فم")},
- {0xfc31, 0, 0, 0, g(Yes, No, false, false, "", "فى")},
- {0xfc32, 0, 0, 0, g(Yes, No, false, false, "", "في")},
- {0xfc33, 0, 0, 0, g(Yes, No, false, false, "", "قح")},
- {0xfc34, 0, 0, 0, g(Yes, No, false, false, "", "قم")},
- {0xfc35, 0, 0, 0, g(Yes, No, false, false, "", "قى")},
- {0xfc36, 0, 0, 0, g(Yes, No, false, false, "", "قي")},
- {0xfc37, 0, 0, 0, g(Yes, No, false, false, "", "كا")},
- {0xfc38, 0, 0, 0, g(Yes, No, false, false, "", "كج")},
- {0xfc39, 0, 0, 0, g(Yes, No, false, false, "", "كح")},
- {0xfc3a, 0, 0, 0, g(Yes, No, false, false, "", "كخ")},
- {0xfc3b, 0, 0, 0, g(Yes, No, false, false, "", "كل")},
- {0xfc3c, 0, 0, 0, g(Yes, No, false, false, "", "كم")},
- {0xfc3d, 0, 0, 0, g(Yes, No, false, false, "", "كى")},
- {0xfc3e, 0, 0, 0, g(Yes, No, false, false, "", "كي")},
- {0xfc3f, 0, 0, 0, g(Yes, No, false, false, "", "لج")},
- {0xfc40, 0, 0, 0, g(Yes, No, false, false, "", "لح")},
- {0xfc41, 0, 0, 0, g(Yes, No, false, false, "", "لخ")},
- {0xfc42, 0, 0, 0, g(Yes, No, false, false, "", "لم")},
- {0xfc43, 0, 0, 0, g(Yes, No, false, false, "", "لى")},
- {0xfc44, 0, 0, 0, g(Yes, No, false, false, "", "لي")},
- {0xfc45, 0, 0, 0, g(Yes, No, false, false, "", "مج")},
- {0xfc46, 0, 0, 0, g(Yes, No, false, false, "", "مح")},
- {0xfc47, 0, 0, 0, g(Yes, No, false, false, "", "مخ")},
- {0xfc48, 0, 0, 0, g(Yes, No, false, false, "", "مم")},
- {0xfc49, 0, 0, 0, g(Yes, No, false, false, "", "مى")},
- {0xfc4a, 0, 0, 0, g(Yes, No, false, false, "", "مي")},
- {0xfc4b, 0, 0, 0, g(Yes, No, false, false, "", "نج")},
- {0xfc4c, 0, 0, 0, g(Yes, No, false, false, "", "نح")},
- {0xfc4d, 0, 0, 0, g(Yes, No, false, false, "", "نخ")},
- {0xfc4e, 0, 0, 0, g(Yes, No, false, false, "", "نم")},
- {0xfc4f, 0, 0, 0, g(Yes, No, false, false, "", "نى")},
- {0xfc50, 0, 0, 0, g(Yes, No, false, false, "", "ني")},
- {0xfc51, 0, 0, 0, g(Yes, No, false, false, "", "هج")},
- {0xfc52, 0, 0, 0, g(Yes, No, false, false, "", "هم")},
- {0xfc53, 0, 0, 0, g(Yes, No, false, false, "", "هى")},
- {0xfc54, 0, 0, 0, g(Yes, No, false, false, "", "هي")},
- {0xfc55, 0, 0, 0, g(Yes, No, false, false, "", "يج")},
- {0xfc56, 0, 0, 0, g(Yes, No, false, false, "", "يح")},
- {0xfc57, 0, 0, 0, g(Yes, No, false, false, "", "يخ")},
- {0xfc58, 0, 0, 0, g(Yes, No, false, false, "", "يم")},
- {0xfc59, 0, 0, 0, g(Yes, No, false, false, "", "يى")},
- {0xfc5a, 0, 0, 0, g(Yes, No, false, false, "", "يي")},
- {0xfc5b, 0, 0, 1, g(Yes, No, false, false, "", "ذٰ")},
- {0xfc5c, 0, 0, 1, g(Yes, No, false, false, "", "رٰ")},
- {0xfc5d, 0, 0, 1, g(Yes, No, false, false, "", "ىٰ")},
- {0xfc5e, 0, 0, 2, g(Yes, No, false, false, "", " ٌّ")},
- {0xfc5f, 0, 0, 2, g(Yes, No, false, false, "", " ٍّ")},
- {0xfc60, 0, 0, 2, g(Yes, No, false, false, "", " َّ")},
- {0xfc61, 0, 0, 2, g(Yes, No, false, false, "", " ُّ")},
- {0xfc62, 0, 0, 2, g(Yes, No, false, false, "", " ِّ")},
- {0xfc63, 0, 0, 2, g(Yes, No, false, false, "", " ّٰ")},
- {0xfc64, 0, 0, 0, g(Yes, No, false, false, "", "ئر")},
- {0xfc65, 0, 0, 0, g(Yes, No, false, false, "", "ئز")},
- {0xfc66, 0, 0, 0, g(Yes, No, false, false, "", "ئم")},
- {0xfc67, 0, 0, 0, g(Yes, No, false, false, "", "ئن")},
- {0xfc68, 0, 0, 0, g(Yes, No, false, false, "", "ئى")},
- {0xfc69, 0, 0, 0, g(Yes, No, false, false, "", "ئي")},
- {0xfc6a, 0, 0, 0, g(Yes, No, false, false, "", "بر")},
- {0xfc6b, 0, 0, 0, g(Yes, No, false, false, "", "بز")},
- {0xfc6c, 0, 0, 0, g(Yes, No, false, false, "", "بم")},
- {0xfc6d, 0, 0, 0, g(Yes, No, false, false, "", "بن")},
- {0xfc6e, 0, 0, 0, g(Yes, No, false, false, "", "بى")},
- {0xfc6f, 0, 0, 0, g(Yes, No, false, false, "", "بي")},
- {0xfc70, 0, 0, 0, g(Yes, No, false, false, "", "تر")},
- {0xfc71, 0, 0, 0, g(Yes, No, false, false, "", "تز")},
- {0xfc72, 0, 0, 0, g(Yes, No, false, false, "", "تم")},
- {0xfc73, 0, 0, 0, g(Yes, No, false, false, "", "تن")},
- {0xfc74, 0, 0, 0, g(Yes, No, false, false, "", "تى")},
- {0xfc75, 0, 0, 0, g(Yes, No, false, false, "", "تي")},
- {0xfc76, 0, 0, 0, g(Yes, No, false, false, "", "ثر")},
- {0xfc77, 0, 0, 0, g(Yes, No, false, false, "", "ثز")},
- {0xfc78, 0, 0, 0, g(Yes, No, false, false, "", "ثم")},
- {0xfc79, 0, 0, 0, g(Yes, No, false, false, "", "ثن")},
- {0xfc7a, 0, 0, 0, g(Yes, No, false, false, "", "ثى")},
- {0xfc7b, 0, 0, 0, g(Yes, No, false, false, "", "ثي")},
- {0xfc7c, 0, 0, 0, g(Yes, No, false, false, "", "فى")},
- {0xfc7d, 0, 0, 0, g(Yes, No, false, false, "", "في")},
- {0xfc7e, 0, 0, 0, g(Yes, No, false, false, "", "قى")},
- {0xfc7f, 0, 0, 0, g(Yes, No, false, false, "", "قي")},
- {0xfc80, 0, 0, 0, g(Yes, No, false, false, "", "كا")},
- {0xfc81, 0, 0, 0, g(Yes, No, false, false, "", "كل")},
- {0xfc82, 0, 0, 0, g(Yes, No, false, false, "", "كم")},
- {0xfc83, 0, 0, 0, g(Yes, No, false, false, "", "كى")},
- {0xfc84, 0, 0, 0, g(Yes, No, false, false, "", "كي")},
- {0xfc85, 0, 0, 0, g(Yes, No, false, false, "", "لم")},
- {0xfc86, 0, 0, 0, g(Yes, No, false, false, "", "لى")},
- {0xfc87, 0, 0, 0, g(Yes, No, false, false, "", "لي")},
- {0xfc88, 0, 0, 0, g(Yes, No, false, false, "", "ما")},
- {0xfc89, 0, 0, 0, g(Yes, No, false, false, "", "مم")},
- {0xfc8a, 0, 0, 0, g(Yes, No, false, false, "", "نر")},
- {0xfc8b, 0, 0, 0, g(Yes, No, false, false, "", "نز")},
- {0xfc8c, 0, 0, 0, g(Yes, No, false, false, "", "نم")},
- {0xfc8d, 0, 0, 0, g(Yes, No, false, false, "", "نن")},
- {0xfc8e, 0, 0, 0, g(Yes, No, false, false, "", "نى")},
- {0xfc8f, 0, 0, 0, g(Yes, No, false, false, "", "ني")},
- {0xfc90, 0, 0, 1, g(Yes, No, false, false, "", "ىٰ")},
- {0xfc91, 0, 0, 0, g(Yes, No, false, false, "", "ير")},
- {0xfc92, 0, 0, 0, g(Yes, No, false, false, "", "يز")},
- {0xfc93, 0, 0, 0, g(Yes, No, false, false, "", "يم")},
- {0xfc94, 0, 0, 0, g(Yes, No, false, false, "", "ين")},
- {0xfc95, 0, 0, 0, g(Yes, No, false, false, "", "يى")},
- {0xfc96, 0, 0, 0, g(Yes, No, false, false, "", "يي")},
- {0xfc97, 0, 0, 0, g(Yes, No, false, false, "", "ئج")},
- {0xfc98, 0, 0, 0, g(Yes, No, false, false, "", "ئح")},
- {0xfc99, 0, 0, 0, g(Yes, No, false, false, "", "ئخ")},
- {0xfc9a, 0, 0, 0, g(Yes, No, false, false, "", "ئم")},
- {0xfc9b, 0, 0, 0, g(Yes, No, false, false, "", "ئه")},
- {0xfc9c, 0, 0, 0, g(Yes, No, false, false, "", "بج")},
- {0xfc9d, 0, 0, 0, g(Yes, No, false, false, "", "بح")},
- {0xfc9e, 0, 0, 0, g(Yes, No, false, false, "", "بخ")},
- {0xfc9f, 0, 0, 0, g(Yes, No, false, false, "", "بم")},
- {0xfca0, 0, 0, 0, g(Yes, No, false, false, "", "به")},
- {0xfca1, 0, 0, 0, g(Yes, No, false, false, "", "تج")},
- {0xfca2, 0, 0, 0, g(Yes, No, false, false, "", "تح")},
- {0xfca3, 0, 0, 0, g(Yes, No, false, false, "", "تخ")},
- {0xfca4, 0, 0, 0, g(Yes, No, false, false, "", "تم")},
- {0xfca5, 0, 0, 0, g(Yes, No, false, false, "", "ته")},
- {0xfca6, 0, 0, 0, g(Yes, No, false, false, "", "ثم")},
- {0xfca7, 0, 0, 0, g(Yes, No, false, false, "", "جح")},
- {0xfca8, 0, 0, 0, g(Yes, No, false, false, "", "جم")},
- {0xfca9, 0, 0, 0, g(Yes, No, false, false, "", "حج")},
- {0xfcaa, 0, 0, 0, g(Yes, No, false, false, "", "حم")},
- {0xfcab, 0, 0, 0, g(Yes, No, false, false, "", "خج")},
- {0xfcac, 0, 0, 0, g(Yes, No, false, false, "", "خم")},
- {0xfcad, 0, 0, 0, g(Yes, No, false, false, "", "سج")},
- {0xfcae, 0, 0, 0, g(Yes, No, false, false, "", "سح")},
- {0xfcaf, 0, 0, 0, g(Yes, No, false, false, "", "سخ")},
- {0xfcb0, 0, 0, 0, g(Yes, No, false, false, "", "سم")},
- {0xfcb1, 0, 0, 0, g(Yes, No, false, false, "", "صح")},
- {0xfcb2, 0, 0, 0, g(Yes, No, false, false, "", "صخ")},
- {0xfcb3, 0, 0, 0, g(Yes, No, false, false, "", "صم")},
- {0xfcb4, 0, 0, 0, g(Yes, No, false, false, "", "ضج")},
- {0xfcb5, 0, 0, 0, g(Yes, No, false, false, "", "ضح")},
- {0xfcb6, 0, 0, 0, g(Yes, No, false, false, "", "ضخ")},
- {0xfcb7, 0, 0, 0, g(Yes, No, false, false, "", "ضم")},
- {0xfcb8, 0, 0, 0, g(Yes, No, false, false, "", "طح")},
- {0xfcb9, 0, 0, 0, g(Yes, No, false, false, "", "ظم")},
- {0xfcba, 0, 0, 0, g(Yes, No, false, false, "", "عج")},
- {0xfcbb, 0, 0, 0, g(Yes, No, false, false, "", "عم")},
- {0xfcbc, 0, 0, 0, g(Yes, No, false, false, "", "غج")},
- {0xfcbd, 0, 0, 0, g(Yes, No, false, false, "", "غم")},
- {0xfcbe, 0, 0, 0, g(Yes, No, false, false, "", "فج")},
- {0xfcbf, 0, 0, 0, g(Yes, No, false, false, "", "فح")},
- {0xfcc0, 0, 0, 0, g(Yes, No, false, false, "", "فخ")},
- {0xfcc1, 0, 0, 0, g(Yes, No, false, false, "", "فم")},
- {0xfcc2, 0, 0, 0, g(Yes, No, false, false, "", "قح")},
- {0xfcc3, 0, 0, 0, g(Yes, No, false, false, "", "قم")},
- {0xfcc4, 0, 0, 0, g(Yes, No, false, false, "", "كج")},
- {0xfcc5, 0, 0, 0, g(Yes, No, false, false, "", "كح")},
- {0xfcc6, 0, 0, 0, g(Yes, No, false, false, "", "كخ")},
- {0xfcc7, 0, 0, 0, g(Yes, No, false, false, "", "كل")},
- {0xfcc8, 0, 0, 0, g(Yes, No, false, false, "", "كم")},
- {0xfcc9, 0, 0, 0, g(Yes, No, false, false, "", "لج")},
- {0xfcca, 0, 0, 0, g(Yes, No, false, false, "", "لح")},
- {0xfccb, 0, 0, 0, g(Yes, No, false, false, "", "لخ")},
- {0xfccc, 0, 0, 0, g(Yes, No, false, false, "", "لم")},
- {0xfccd, 0, 0, 0, g(Yes, No, false, false, "", "له")},
- {0xfcce, 0, 0, 0, g(Yes, No, false, false, "", "مج")},
- {0xfccf, 0, 0, 0, g(Yes, No, false, false, "", "مح")},
- {0xfcd0, 0, 0, 0, g(Yes, No, false, false, "", "مخ")},
- {0xfcd1, 0, 0, 0, g(Yes, No, false, false, "", "مم")},
- {0xfcd2, 0, 0, 0, g(Yes, No, false, false, "", "نج")},
- {0xfcd3, 0, 0, 0, g(Yes, No, false, false, "", "نح")},
- {0xfcd4, 0, 0, 0, g(Yes, No, false, false, "", "نخ")},
- {0xfcd5, 0, 0, 0, g(Yes, No, false, false, "", "نم")},
- {0xfcd6, 0, 0, 0, g(Yes, No, false, false, "", "نه")},
- {0xfcd7, 0, 0, 0, g(Yes, No, false, false, "", "هج")},
- {0xfcd8, 0, 0, 0, g(Yes, No, false, false, "", "هم")},
- {0xfcd9, 0, 0, 1, g(Yes, No, false, false, "", "هٰ")},
- {0xfcda, 0, 0, 0, g(Yes, No, false, false, "", "يج")},
- {0xfcdb, 0, 0, 0, g(Yes, No, false, false, "", "يح")},
- {0xfcdc, 0, 0, 0, g(Yes, No, false, false, "", "يخ")},
- {0xfcdd, 0, 0, 0, g(Yes, No, false, false, "", "يم")},
- {0xfcde, 0, 0, 0, g(Yes, No, false, false, "", "يه")},
- {0xfcdf, 0, 0, 0, g(Yes, No, false, false, "", "ئم")},
- {0xfce0, 0, 0, 0, g(Yes, No, false, false, "", "ئه")},
- {0xfce1, 0, 0, 0, g(Yes, No, false, false, "", "بم")},
- {0xfce2, 0, 0, 0, g(Yes, No, false, false, "", "به")},
- {0xfce3, 0, 0, 0, g(Yes, No, false, false, "", "تم")},
- {0xfce4, 0, 0, 0, g(Yes, No, false, false, "", "ته")},
- {0xfce5, 0, 0, 0, g(Yes, No, false, false, "", "ثم")},
- {0xfce6, 0, 0, 0, g(Yes, No, false, false, "", "ثه")},
- {0xfce7, 0, 0, 0, g(Yes, No, false, false, "", "سم")},
- {0xfce8, 0, 0, 0, g(Yes, No, false, false, "", "سه")},
- {0xfce9, 0, 0, 0, g(Yes, No, false, false, "", "شم")},
- {0xfcea, 0, 0, 0, g(Yes, No, false, false, "", "شه")},
- {0xfceb, 0, 0, 0, g(Yes, No, false, false, "", "كل")},
- {0xfcec, 0, 0, 0, g(Yes, No, false, false, "", "كم")},
- {0xfced, 0, 0, 0, g(Yes, No, false, false, "", "لم")},
- {0xfcee, 0, 0, 0, g(Yes, No, false, false, "", "نم")},
- {0xfcef, 0, 0, 0, g(Yes, No, false, false, "", "نه")},
- {0xfcf0, 0, 0, 0, g(Yes, No, false, false, "", "يم")},
- {0xfcf1, 0, 0, 0, g(Yes, No, false, false, "", "يه")},
- {0xfcf2, 0, 0, 2, g(Yes, No, false, false, "", "ـَّ")},
- {0xfcf3, 0, 0, 2, g(Yes, No, false, false, "", "ـُّ")},
- {0xfcf4, 0, 0, 2, g(Yes, No, false, false, "", "ـِّ")},
- {0xfcf5, 0, 0, 0, g(Yes, No, false, false, "", "طى")},
- {0xfcf6, 0, 0, 0, g(Yes, No, false, false, "", "طي")},
- {0xfcf7, 0, 0, 0, g(Yes, No, false, false, "", "عى")},
- {0xfcf8, 0, 0, 0, g(Yes, No, false, false, "", "عي")},
- {0xfcf9, 0, 0, 0, g(Yes, No, false, false, "", "غى")},
- {0xfcfa, 0, 0, 0, g(Yes, No, false, false, "", "غي")},
- {0xfcfb, 0, 0, 0, g(Yes, No, false, false, "", "سى")},
- {0xfcfc, 0, 0, 0, g(Yes, No, false, false, "", "سي")},
- {0xfcfd, 0, 0, 0, g(Yes, No, false, false, "", "شى")},
- {0xfcfe, 0, 0, 0, g(Yes, No, false, false, "", "شي")},
- {0xfcff, 0, 0, 0, g(Yes, No, false, false, "", "حى")},
- {0xfd00, 0, 0, 0, g(Yes, No, false, false, "", "حي")},
- {0xfd01, 0, 0, 0, g(Yes, No, false, false, "", "جى")},
- {0xfd02, 0, 0, 0, g(Yes, No, false, false, "", "جي")},
- {0xfd03, 0, 0, 0, g(Yes, No, false, false, "", "خى")},
- {0xfd04, 0, 0, 0, g(Yes, No, false, false, "", "خي")},
- {0xfd05, 0, 0, 0, g(Yes, No, false, false, "", "صى")},
- {0xfd06, 0, 0, 0, g(Yes, No, false, false, "", "صي")},
- {0xfd07, 0, 0, 0, g(Yes, No, false, false, "", "ضى")},
- {0xfd08, 0, 0, 0, g(Yes, No, false, false, "", "ضي")},
- {0xfd09, 0, 0, 0, g(Yes, No, false, false, "", "شج")},
- {0xfd0a, 0, 0, 0, g(Yes, No, false, false, "", "شح")},
- {0xfd0b, 0, 0, 0, g(Yes, No, false, false, "", "شخ")},
- {0xfd0c, 0, 0, 0, g(Yes, No, false, false, "", "شم")},
- {0xfd0d, 0, 0, 0, g(Yes, No, false, false, "", "شر")},
- {0xfd0e, 0, 0, 0, g(Yes, No, false, false, "", "سر")},
- {0xfd0f, 0, 0, 0, g(Yes, No, false, false, "", "صر")},
- {0xfd10, 0, 0, 0, g(Yes, No, false, false, "", "ضر")},
- {0xfd11, 0, 0, 0, g(Yes, No, false, false, "", "طى")},
- {0xfd12, 0, 0, 0, g(Yes, No, false, false, "", "طي")},
- {0xfd13, 0, 0, 0, g(Yes, No, false, false, "", "عى")},
- {0xfd14, 0, 0, 0, g(Yes, No, false, false, "", "عي")},
- {0xfd15, 0, 0, 0, g(Yes, No, false, false, "", "غى")},
- {0xfd16, 0, 0, 0, g(Yes, No, false, false, "", "غي")},
- {0xfd17, 0, 0, 0, g(Yes, No, false, false, "", "سى")},
- {0xfd18, 0, 0, 0, g(Yes, No, false, false, "", "سي")},
- {0xfd19, 0, 0, 0, g(Yes, No, false, false, "", "شى")},
- {0xfd1a, 0, 0, 0, g(Yes, No, false, false, "", "شي")},
- {0xfd1b, 0, 0, 0, g(Yes, No, false, false, "", "حى")},
- {0xfd1c, 0, 0, 0, g(Yes, No, false, false, "", "حي")},
- {0xfd1d, 0, 0, 0, g(Yes, No, false, false, "", "جى")},
- {0xfd1e, 0, 0, 0, g(Yes, No, false, false, "", "جي")},
- {0xfd1f, 0, 0, 0, g(Yes, No, false, false, "", "خى")},
- {0xfd20, 0, 0, 0, g(Yes, No, false, false, "", "خي")},
- {0xfd21, 0, 0, 0, g(Yes, No, false, false, "", "صى")},
- {0xfd22, 0, 0, 0, g(Yes, No, false, false, "", "صي")},
- {0xfd23, 0, 0, 0, g(Yes, No, false, false, "", "ضى")},
- {0xfd24, 0, 0, 0, g(Yes, No, false, false, "", "ضي")},
- {0xfd25, 0, 0, 0, g(Yes, No, false, false, "", "شج")},
- {0xfd26, 0, 0, 0, g(Yes, No, false, false, "", "شح")},
- {0xfd27, 0, 0, 0, g(Yes, No, false, false, "", "شخ")},
- {0xfd28, 0, 0, 0, g(Yes, No, false, false, "", "شم")},
- {0xfd29, 0, 0, 0, g(Yes, No, false, false, "", "شر")},
- {0xfd2a, 0, 0, 0, g(Yes, No, false, false, "", "سر")},
- {0xfd2b, 0, 0, 0, g(Yes, No, false, false, "", "صر")},
- {0xfd2c, 0, 0, 0, g(Yes, No, false, false, "", "ضر")},
- {0xfd2d, 0, 0, 0, g(Yes, No, false, false, "", "شج")},
- {0xfd2e, 0, 0, 0, g(Yes, No, false, false, "", "شح")},
- {0xfd2f, 0, 0, 0, g(Yes, No, false, false, "", "شخ")},
- {0xfd30, 0, 0, 0, g(Yes, No, false, false, "", "شم")},
- {0xfd31, 0, 0, 0, g(Yes, No, false, false, "", "سه")},
- {0xfd32, 0, 0, 0, g(Yes, No, false, false, "", "شه")},
- {0xfd33, 0, 0, 0, g(Yes, No, false, false, "", "طم")},
- {0xfd34, 0, 0, 0, g(Yes, No, false, false, "", "سج")},
- {0xfd35, 0, 0, 0, g(Yes, No, false, false, "", "سح")},
- {0xfd36, 0, 0, 0, g(Yes, No, false, false, "", "سخ")},
- {0xfd37, 0, 0, 0, g(Yes, No, false, false, "", "شج")},
- {0xfd38, 0, 0, 0, g(Yes, No, false, false, "", "شح")},
- {0xfd39, 0, 0, 0, g(Yes, No, false, false, "", "شخ")},
- {0xfd3a, 0, 0, 0, g(Yes, No, false, false, "", "طم")},
- {0xfd3b, 0, 0, 0, g(Yes, No, false, false, "", "ظم")},
- {0xfd3c, 0, 0, 1, g(Yes, No, false, false, "", "اً")},
- {0xfd3e, 0, 0, 0, f(Yes, false, "")},
- {0xfd50, 0, 0, 0, g(Yes, No, false, false, "", "تجم")},
- {0xfd51, 0, 0, 0, g(Yes, No, false, false, "", "تحج")},
- {0xfd53, 0, 0, 0, g(Yes, No, false, false, "", "تحم")},
- {0xfd54, 0, 0, 0, g(Yes, No, false, false, "", "تخم")},
- {0xfd55, 0, 0, 0, g(Yes, No, false, false, "", "تمج")},
- {0xfd56, 0, 0, 0, g(Yes, No, false, false, "", "تمح")},
- {0xfd57, 0, 0, 0, g(Yes, No, false, false, "", "تمخ")},
- {0xfd58, 0, 0, 0, g(Yes, No, false, false, "", "جمح")},
- {0xfd5a, 0, 0, 0, g(Yes, No, false, false, "", "حمي")},
- {0xfd5b, 0, 0, 0, g(Yes, No, false, false, "", "حمى")},
- {0xfd5c, 0, 0, 0, g(Yes, No, false, false, "", "سحج")},
- {0xfd5d, 0, 0, 0, g(Yes, No, false, false, "", "سجح")},
- {0xfd5e, 0, 0, 0, g(Yes, No, false, false, "", "سجى")},
- {0xfd5f, 0, 0, 0, g(Yes, No, false, false, "", "سمح")},
- {0xfd61, 0, 0, 0, g(Yes, No, false, false, "", "سمج")},
- {0xfd62, 0, 0, 0, g(Yes, No, false, false, "", "سمم")},
- {0xfd64, 0, 0, 0, g(Yes, No, false, false, "", "صحح")},
- {0xfd66, 0, 0, 0, g(Yes, No, false, false, "", "صمم")},
- {0xfd67, 0, 0, 0, g(Yes, No, false, false, "", "شحم")},
- {0xfd69, 0, 0, 0, g(Yes, No, false, false, "", "شجي")},
- {0xfd6a, 0, 0, 0, g(Yes, No, false, false, "", "شمخ")},
- {0xfd6c, 0, 0, 0, g(Yes, No, false, false, "", "شمم")},
- {0xfd6e, 0, 0, 0, g(Yes, No, false, false, "", "ضحى")},
- {0xfd6f, 0, 0, 0, g(Yes, No, false, false, "", "ضخم")},
- {0xfd71, 0, 0, 0, g(Yes, No, false, false, "", "طمح")},
- {0xfd73, 0, 0, 0, g(Yes, No, false, false, "", "طمم")},
- {0xfd74, 0, 0, 0, g(Yes, No, false, false, "", "طمي")},
- {0xfd75, 0, 0, 0, g(Yes, No, false, false, "", "عجم")},
- {0xfd76, 0, 0, 0, g(Yes, No, false, false, "", "عمم")},
- {0xfd78, 0, 0, 0, g(Yes, No, false, false, "", "عمى")},
- {0xfd79, 0, 0, 0, g(Yes, No, false, false, "", "غمم")},
- {0xfd7a, 0, 0, 0, g(Yes, No, false, false, "", "غمي")},
- {0xfd7b, 0, 0, 0, g(Yes, No, false, false, "", "غمى")},
- {0xfd7c, 0, 0, 0, g(Yes, No, false, false, "", "فخم")},
- {0xfd7e, 0, 0, 0, g(Yes, No, false, false, "", "قمح")},
- {0xfd7f, 0, 0, 0, g(Yes, No, false, false, "", "قمم")},
- {0xfd80, 0, 0, 0, g(Yes, No, false, false, "", "لحم")},
- {0xfd81, 0, 0, 0, g(Yes, No, false, false, "", "لحي")},
- {0xfd82, 0, 0, 0, g(Yes, No, false, false, "", "لحى")},
- {0xfd83, 0, 0, 0, g(Yes, No, false, false, "", "لجج")},
- {0xfd85, 0, 0, 0, g(Yes, No, false, false, "", "لخم")},
- {0xfd87, 0, 0, 0, g(Yes, No, false, false, "", "لمح")},
- {0xfd89, 0, 0, 0, g(Yes, No, false, false, "", "محج")},
- {0xfd8a, 0, 0, 0, g(Yes, No, false, false, "", "محم")},
- {0xfd8b, 0, 0, 0, g(Yes, No, false, false, "", "محي")},
- {0xfd8c, 0, 0, 0, g(Yes, No, false, false, "", "مجح")},
- {0xfd8d, 0, 0, 0, g(Yes, No, false, false, "", "مجم")},
- {0xfd8e, 0, 0, 0, g(Yes, No, false, false, "", "مخج")},
- {0xfd8f, 0, 0, 0, g(Yes, No, false, false, "", "مخم")},
- {0xfd90, 0, 0, 0, f(Yes, false, "")},
- {0xfd92, 0, 0, 0, g(Yes, No, false, false, "", "مجخ")},
- {0xfd93, 0, 0, 0, g(Yes, No, false, false, "", "همج")},
- {0xfd94, 0, 0, 0, g(Yes, No, false, false, "", "همم")},
- {0xfd95, 0, 0, 0, g(Yes, No, false, false, "", "نحم")},
- {0xfd96, 0, 0, 0, g(Yes, No, false, false, "", "نحى")},
- {0xfd97, 0, 0, 0, g(Yes, No, false, false, "", "نجم")},
- {0xfd99, 0, 0, 0, g(Yes, No, false, false, "", "نجى")},
- {0xfd9a, 0, 0, 0, g(Yes, No, false, false, "", "نمي")},
- {0xfd9b, 0, 0, 0, g(Yes, No, false, false, "", "نمى")},
- {0xfd9c, 0, 0, 0, g(Yes, No, false, false, "", "يمم")},
- {0xfd9e, 0, 0, 0, g(Yes, No, false, false, "", "بخي")},
- {0xfd9f, 0, 0, 0, g(Yes, No, false, false, "", "تجي")},
- {0xfda0, 0, 0, 0, g(Yes, No, false, false, "", "تجى")},
- {0xfda1, 0, 0, 0, g(Yes, No, false, false, "", "تخي")},
- {0xfda2, 0, 0, 0, g(Yes, No, false, false, "", "تخى")},
- {0xfda3, 0, 0, 0, g(Yes, No, false, false, "", "تمي")},
- {0xfda4, 0, 0, 0, g(Yes, No, false, false, "", "تمى")},
- {0xfda5, 0, 0, 0, g(Yes, No, false, false, "", "جمي")},
- {0xfda6, 0, 0, 0, g(Yes, No, false, false, "", "جحى")},
- {0xfda7, 0, 0, 0, g(Yes, No, false, false, "", "جمى")},
- {0xfda8, 0, 0, 0, g(Yes, No, false, false, "", "سخى")},
- {0xfda9, 0, 0, 0, g(Yes, No, false, false, "", "صحي")},
- {0xfdaa, 0, 0, 0, g(Yes, No, false, false, "", "شحي")},
- {0xfdab, 0, 0, 0, g(Yes, No, false, false, "", "ضحي")},
- {0xfdac, 0, 0, 0, g(Yes, No, false, false, "", "لجي")},
- {0xfdad, 0, 0, 0, g(Yes, No, false, false, "", "لمي")},
- {0xfdae, 0, 0, 0, g(Yes, No, false, false, "", "يحي")},
- {0xfdaf, 0, 0, 0, g(Yes, No, false, false, "", "يجي")},
- {0xfdb0, 0, 0, 0, g(Yes, No, false, false, "", "يمي")},
- {0xfdb1, 0, 0, 0, g(Yes, No, false, false, "", "ممي")},
- {0xfdb2, 0, 0, 0, g(Yes, No, false, false, "", "قمي")},
- {0xfdb3, 0, 0, 0, g(Yes, No, false, false, "", "نحي")},
- {0xfdb4, 0, 0, 0, g(Yes, No, false, false, "", "قمح")},
- {0xfdb5, 0, 0, 0, g(Yes, No, false, false, "", "لحم")},
- {0xfdb6, 0, 0, 0, g(Yes, No, false, false, "", "عمي")},
- {0xfdb7, 0, 0, 0, g(Yes, No, false, false, "", "كمي")},
- {0xfdb8, 0, 0, 0, g(Yes, No, false, false, "", "نجح")},
- {0xfdb9, 0, 0, 0, g(Yes, No, false, false, "", "مخي")},
- {0xfdba, 0, 0, 0, g(Yes, No, false, false, "", "لجم")},
- {0xfdbb, 0, 0, 0, g(Yes, No, false, false, "", "كمم")},
- {0xfdbc, 0, 0, 0, g(Yes, No, false, false, "", "لجم")},
- {0xfdbd, 0, 0, 0, g(Yes, No, false, false, "", "نجح")},
- {0xfdbe, 0, 0, 0, g(Yes, No, false, false, "", "جحي")},
- {0xfdbf, 0, 0, 0, g(Yes, No, false, false, "", "حجي")},
- {0xfdc0, 0, 0, 0, g(Yes, No, false, false, "", "مجي")},
- {0xfdc1, 0, 0, 0, g(Yes, No, false, false, "", "فمي")},
- {0xfdc2, 0, 0, 0, g(Yes, No, false, false, "", "بحي")},
- {0xfdc3, 0, 0, 0, g(Yes, No, false, false, "", "كمم")},
- {0xfdc4, 0, 0, 0, g(Yes, No, false, false, "", "عجم")},
- {0xfdc5, 0, 0, 0, g(Yes, No, false, false, "", "صمم")},
- {0xfdc6, 0, 0, 0, g(Yes, No, false, false, "", "سخي")},
- {0xfdc7, 0, 0, 0, g(Yes, No, false, false, "", "نجي")},
- {0xfdc8, 0, 0, 0, f(Yes, false, "")},
- {0xfdf0, 0, 0, 0, g(Yes, No, false, false, "", "صلے")},
- {0xfdf1, 0, 0, 0, g(Yes, No, false, false, "", "قلے")},
- {0xfdf2, 0, 0, 0, g(Yes, No, false, false, "", "الله")},
- {0xfdf3, 0, 0, 0, g(Yes, No, false, false, "", "اكبر")},
- {0xfdf4, 0, 0, 0, g(Yes, No, false, false, "", "محمد")},
- {0xfdf5, 0, 0, 0, g(Yes, No, false, false, "", "صلعم")},
- {0xfdf6, 0, 0, 0, g(Yes, No, false, false, "", "رسول")},
- {0xfdf7, 0, 0, 0, g(Yes, No, false, false, "", "عليه")},
- {0xfdf8, 0, 0, 0, g(Yes, No, false, false, "", "وسلم")},
- {0xfdf9, 0, 0, 0, g(Yes, No, false, false, "", "صلى")},
- {0xfdfa, 0, 0, 0, g(Yes, No, false, false, "", "صلى الله عليه وسلم")},
- {0xfdfb, 0, 0, 0, g(Yes, No, false, false, "", "جل جلاله")},
- {0xfdfc, 0, 0, 0, g(Yes, No, false, false, "", "ریال")},
- {0xfdfd, 0, 0, 0, f(Yes, false, "")},
- {0xfe10, 0, 0, 0, g(Yes, No, false, false, "", ",")},
- {0xfe11, 0, 0, 0, g(Yes, No, false, false, "", "、")},
- {0xfe12, 0, 0, 0, g(Yes, No, false, false, "", "。")},
- {0xfe13, 0, 0, 0, g(Yes, No, false, false, "", ":")},
- {0xfe14, 0, 0, 0, g(Yes, No, false, false, "", ";")},
- {0xfe15, 0, 0, 0, g(Yes, No, false, false, "", "!")},
- {0xfe16, 0, 0, 0, g(Yes, No, false, false, "", "?")},
- {0xfe17, 0, 0, 0, g(Yes, No, false, false, "", "〖")},
- {0xfe18, 0, 0, 0, g(Yes, No, false, false, "", "〗")},
- {0xfe19, 0, 0, 0, g(Yes, No, false, false, "", "...")},
- {0xfe1a, 0, 0, 0, f(Yes, false, "")},
- {0xfe20, 230, 1, 1, f(Yes, false, "")},
- {0xfe27, 220, 1, 1, f(Yes, false, "")},
- {0xfe2e, 230, 1, 1, f(Yes, false, "")},
- {0xfe30, 0, 0, 0, g(Yes, No, false, false, "", "..")},
- {0xfe31, 0, 0, 0, g(Yes, No, false, false, "", "—")},
- {0xfe32, 0, 0, 0, g(Yes, No, false, false, "", "–")},
- {0xfe33, 0, 0, 0, g(Yes, No, false, false, "", "_")},
- {0xfe35, 0, 0, 0, g(Yes, No, false, false, "", "(")},
- {0xfe36, 0, 0, 0, g(Yes, No, false, false, "", ")")},
- {0xfe37, 0, 0, 0, g(Yes, No, false, false, "", "{")},
- {0xfe38, 0, 0, 0, g(Yes, No, false, false, "", "}")},
- {0xfe39, 0, 0, 0, g(Yes, No, false, false, "", "〔")},
- {0xfe3a, 0, 0, 0, g(Yes, No, false, false, "", "〕")},
- {0xfe3b, 0, 0, 0, g(Yes, No, false, false, "", "【")},
- {0xfe3c, 0, 0, 0, g(Yes, No, false, false, "", "】")},
- {0xfe3d, 0, 0, 0, g(Yes, No, false, false, "", "《")},
- {0xfe3e, 0, 0, 0, g(Yes, No, false, false, "", "》")},
- {0xfe3f, 0, 0, 0, g(Yes, No, false, false, "", "〈")},
- {0xfe40, 0, 0, 0, g(Yes, No, false, false, "", "〉")},
- {0xfe41, 0, 0, 0, g(Yes, No, false, false, "", "「")},
- {0xfe42, 0, 0, 0, g(Yes, No, false, false, "", "」")},
- {0xfe43, 0, 0, 0, g(Yes, No, false, false, "", "『")},
- {0xfe44, 0, 0, 0, g(Yes, No, false, false, "", "』")},
- {0xfe45, 0, 0, 0, f(Yes, false, "")},
- {0xfe47, 0, 0, 0, g(Yes, No, false, false, "", "[")},
- {0xfe48, 0, 0, 0, g(Yes, No, false, false, "", "]")},
- {0xfe49, 0, 0, 1, g(Yes, No, false, false, "", " ̅")},
- {0xfe4d, 0, 0, 0, g(Yes, No, false, false, "", "_")},
- {0xfe50, 0, 0, 0, g(Yes, No, false, false, "", ",")},
- {0xfe51, 0, 0, 0, g(Yes, No, false, false, "", "、")},
- {0xfe52, 0, 0, 0, g(Yes, No, false, false, "", ".")},
- {0xfe53, 0, 0, 0, f(Yes, false, "")},
- {0xfe54, 0, 0, 0, g(Yes, No, false, false, "", ";")},
- {0xfe55, 0, 0, 0, g(Yes, No, false, false, "", ":")},
- {0xfe56, 0, 0, 0, g(Yes, No, false, false, "", "?")},
- {0xfe57, 0, 0, 0, g(Yes, No, false, false, "", "!")},
- {0xfe58, 0, 0, 0, g(Yes, No, false, false, "", "—")},
- {0xfe59, 0, 0, 0, g(Yes, No, false, false, "", "(")},
- {0xfe5a, 0, 0, 0, g(Yes, No, false, false, "", ")")},
- {0xfe5b, 0, 0, 0, g(Yes, No, false, false, "", "{")},
- {0xfe5c, 0, 0, 0, g(Yes, No, false, false, "", "}")},
- {0xfe5d, 0, 0, 0, g(Yes, No, false, false, "", "〔")},
- {0xfe5e, 0, 0, 0, g(Yes, No, false, false, "", "〕")},
- {0xfe5f, 0, 0, 0, g(Yes, No, false, false, "", "#")},
- {0xfe60, 0, 0, 0, g(Yes, No, false, false, "", "&")},
- {0xfe61, 0, 0, 0, g(Yes, No, false, false, "", "*")},
- {0xfe62, 0, 0, 0, g(Yes, No, false, false, "", "+")},
- {0xfe63, 0, 0, 0, g(Yes, No, false, false, "", "-")},
- {0xfe64, 0, 0, 0, g(Yes, No, false, false, "", "<")},
- {0xfe65, 0, 0, 0, g(Yes, No, false, false, "", ">")},
- {0xfe66, 0, 0, 0, g(Yes, No, false, false, "", "=")},
- {0xfe67, 0, 0, 0, f(Yes, false, "")},
- {0xfe68, 0, 0, 0, g(Yes, No, false, false, "", "\\")},
- {0xfe69, 0, 0, 0, g(Yes, No, false, false, "", "$")},
- {0xfe6a, 0, 0, 0, g(Yes, No, false, false, "", "%")},
- {0xfe6b, 0, 0, 0, g(Yes, No, false, false, "", "@")},
- {0xfe6c, 0, 0, 0, f(Yes, false, "")},
- {0xfe70, 0, 0, 1, g(Yes, No, false, false, "", " ً")},
- {0xfe71, 0, 0, 1, g(Yes, No, false, false, "", "ـً")},
- {0xfe72, 0, 0, 1, g(Yes, No, false, false, "", " ٌ")},
- {0xfe73, 0, 0, 0, f(Yes, false, "")},
- {0xfe74, 0, 0, 1, g(Yes, No, false, false, "", " ٍ")},
- {0xfe75, 0, 0, 0, f(Yes, false, "")},
- {0xfe76, 0, 0, 1, g(Yes, No, false, false, "", " َ")},
- {0xfe77, 0, 0, 1, g(Yes, No, false, false, "", "ـَ")},
- {0xfe78, 0, 0, 1, g(Yes, No, false, false, "", " ُ")},
- {0xfe79, 0, 0, 1, g(Yes, No, false, false, "", "ـُ")},
- {0xfe7a, 0, 0, 1, g(Yes, No, false, false, "", " ِ")},
- {0xfe7b, 0, 0, 1, g(Yes, No, false, false, "", "ـِ")},
- {0xfe7c, 0, 0, 1, g(Yes, No, false, false, "", " ّ")},
- {0xfe7d, 0, 0, 1, g(Yes, No, false, false, "", "ـّ")},
- {0xfe7e, 0, 0, 1, g(Yes, No, false, false, "", " ْ")},
- {0xfe7f, 0, 0, 1, g(Yes, No, false, false, "", "ـْ")},
- {0xfe80, 0, 0, 0, g(Yes, No, false, false, "", "ء")},
- {0xfe81, 0, 0, 1, g(Yes, No, false, false, "", "آ")},
- {0xfe83, 0, 0, 1, g(Yes, No, false, false, "", "أ")},
- {0xfe85, 0, 0, 1, g(Yes, No, false, false, "", "ؤ")},
- {0xfe87, 0, 0, 1, g(Yes, No, false, false, "", "إ")},
- {0xfe89, 0, 0, 1, g(Yes, No, false, false, "", "ئ")},
- {0xfe8d, 0, 0, 0, g(Yes, No, false, false, "", "ا")},
- {0xfe8f, 0, 0, 0, g(Yes, No, false, false, "", "ب")},
- {0xfe93, 0, 0, 0, g(Yes, No, false, false, "", "ة")},
- {0xfe95, 0, 0, 0, g(Yes, No, false, false, "", "ت")},
- {0xfe99, 0, 0, 0, g(Yes, No, false, false, "", "ث")},
- {0xfe9d, 0, 0, 0, g(Yes, No, false, false, "", "ج")},
- {0xfea1, 0, 0, 0, g(Yes, No, false, false, "", "ح")},
- {0xfea5, 0, 0, 0, g(Yes, No, false, false, "", "خ")},
- {0xfea9, 0, 0, 0, g(Yes, No, false, false, "", "د")},
- {0xfeab, 0, 0, 0, g(Yes, No, false, false, "", "ذ")},
- {0xfead, 0, 0, 0, g(Yes, No, false, false, "", "ر")},
- {0xfeaf, 0, 0, 0, g(Yes, No, false, false, "", "ز")},
- {0xfeb1, 0, 0, 0, g(Yes, No, false, false, "", "س")},
- {0xfeb5, 0, 0, 0, g(Yes, No, false, false, "", "ش")},
- {0xfeb9, 0, 0, 0, g(Yes, No, false, false, "", "ص")},
- {0xfebd, 0, 0, 0, g(Yes, No, false, false, "", "ض")},
- {0xfec1, 0, 0, 0, g(Yes, No, false, false, "", "ط")},
- {0xfec5, 0, 0, 0, g(Yes, No, false, false, "", "ظ")},
- {0xfec9, 0, 0, 0, g(Yes, No, false, false, "", "ع")},
- {0xfecd, 0, 0, 0, g(Yes, No, false, false, "", "غ")},
- {0xfed1, 0, 0, 0, g(Yes, No, false, false, "", "ف")},
- {0xfed5, 0, 0, 0, g(Yes, No, false, false, "", "ق")},
- {0xfed9, 0, 0, 0, g(Yes, No, false, false, "", "ك")},
- {0xfedd, 0, 0, 0, g(Yes, No, false, false, "", "ل")},
- {0xfee1, 0, 0, 0, g(Yes, No, false, false, "", "م")},
- {0xfee5, 0, 0, 0, g(Yes, No, false, false, "", "ن")},
- {0xfee9, 0, 0, 0, g(Yes, No, false, false, "", "ه")},
- {0xfeed, 0, 0, 0, g(Yes, No, false, false, "", "و")},
- {0xfeef, 0, 0, 0, g(Yes, No, false, false, "", "ى")},
- {0xfef1, 0, 0, 0, g(Yes, No, false, false, "", "ي")},
- {0xfef5, 0, 0, 1, g(Yes, No, false, false, "", "لآ")},
- {0xfef7, 0, 0, 1, g(Yes, No, false, false, "", "لأ")},
- {0xfef9, 0, 0, 1, g(Yes, No, false, false, "", "لإ")},
- {0xfefb, 0, 0, 0, g(Yes, No, false, false, "", "لا")},
- {0xfefd, 0, 0, 0, f(Yes, false, "")},
- {0xff01, 0, 0, 0, g(Yes, No, false, false, "", "!")},
- {0xff02, 0, 0, 0, g(Yes, No, false, false, "", "\"")},
- {0xff03, 0, 0, 0, g(Yes, No, false, false, "", "#")},
- {0xff04, 0, 0, 0, g(Yes, No, false, false, "", "$")},
- {0xff05, 0, 0, 0, g(Yes, No, false, false, "", "%")},
- {0xff06, 0, 0, 0, g(Yes, No, false, false, "", "&")},
- {0xff07, 0, 0, 0, g(Yes, No, false, false, "", "'")},
- {0xff08, 0, 0, 0, g(Yes, No, false, false, "", "(")},
- {0xff09, 0, 0, 0, g(Yes, No, false, false, "", ")")},
- {0xff0a, 0, 0, 0, g(Yes, No, false, false, "", "*")},
- {0xff0b, 0, 0, 0, g(Yes, No, false, false, "", "+")},
- {0xff0c, 0, 0, 0, g(Yes, No, false, false, "", ",")},
- {0xff0d, 0, 0, 0, g(Yes, No, false, false, "", "-")},
- {0xff0e, 0, 0, 0, g(Yes, No, false, false, "", ".")},
- {0xff0f, 0, 0, 0, g(Yes, No, false, false, "", "/")},
- {0xff10, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0xff11, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0xff12, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0xff13, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0xff14, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0xff15, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0xff16, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0xff17, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0xff18, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0xff19, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0xff1a, 0, 0, 0, g(Yes, No, false, false, "", ":")},
- {0xff1b, 0, 0, 0, g(Yes, No, false, false, "", ";")},
- {0xff1c, 0, 0, 0, g(Yes, No, false, false, "", "<")},
- {0xff1d, 0, 0, 0, g(Yes, No, false, false, "", "=")},
- {0xff1e, 0, 0, 0, g(Yes, No, false, false, "", ">")},
- {0xff1f, 0, 0, 0, g(Yes, No, false, false, "", "?")},
- {0xff20, 0, 0, 0, g(Yes, No, false, false, "", "@")},
- {0xff21, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0xff22, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0xff23, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0xff24, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0xff25, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0xff26, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0xff27, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0xff28, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0xff29, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0xff2a, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0xff2b, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0xff2c, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0xff2d, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0xff2e, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0xff2f, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0xff30, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0xff31, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0xff32, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0xff33, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0xff34, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0xff35, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0xff36, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0xff37, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0xff38, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0xff39, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0xff3a, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0xff3b, 0, 0, 0, g(Yes, No, false, false, "", "[")},
- {0xff3c, 0, 0, 0, g(Yes, No, false, false, "", "\\")},
- {0xff3d, 0, 0, 0, g(Yes, No, false, false, "", "]")},
- {0xff3e, 0, 0, 0, g(Yes, No, false, false, "", "^")},
- {0xff3f, 0, 0, 0, g(Yes, No, false, false, "", "_")},
- {0xff40, 0, 0, 0, g(Yes, No, false, false, "", "`")},
- {0xff41, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0xff42, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0xff43, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0xff44, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0xff45, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0xff46, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0xff47, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0xff48, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0xff49, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0xff4a, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0xff4b, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0xff4c, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0xff4d, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0xff4e, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0xff4f, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0xff50, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0xff51, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0xff52, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0xff53, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0xff54, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0xff55, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0xff56, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0xff57, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0xff58, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0xff59, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0xff5a, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0xff5b, 0, 0, 0, g(Yes, No, false, false, "", "{")},
- {0xff5c, 0, 0, 0, g(Yes, No, false, false, "", "|")},
- {0xff5d, 0, 0, 0, g(Yes, No, false, false, "", "}")},
- {0xff5e, 0, 0, 0, g(Yes, No, false, false, "", "~")},
- {0xff5f, 0, 0, 0, g(Yes, No, false, false, "", "⦅")},
- {0xff60, 0, 0, 0, g(Yes, No, false, false, "", "⦆")},
- {0xff61, 0, 0, 0, g(Yes, No, false, false, "", "。")},
- {0xff62, 0, 0, 0, g(Yes, No, false, false, "", "「")},
- {0xff63, 0, 0, 0, g(Yes, No, false, false, "", "」")},
- {0xff64, 0, 0, 0, g(Yes, No, false, false, "", "、")},
- {0xff65, 0, 0, 0, g(Yes, No, false, false, "", "・")},
- {0xff66, 0, 0, 0, g(Yes, No, false, false, "", "ヲ")},
- {0xff67, 0, 0, 0, g(Yes, No, false, false, "", "ァ")},
- {0xff68, 0, 0, 0, g(Yes, No, false, false, "", "ィ")},
- {0xff69, 0, 0, 0, g(Yes, No, false, false, "", "ゥ")},
- {0xff6a, 0, 0, 0, g(Yes, No, false, false, "", "ェ")},
- {0xff6b, 0, 0, 0, g(Yes, No, false, false, "", "ォ")},
- {0xff6c, 0, 0, 0, g(Yes, No, false, false, "", "ャ")},
- {0xff6d, 0, 0, 0, g(Yes, No, false, false, "", "ュ")},
- {0xff6e, 0, 0, 0, g(Yes, No, false, false, "", "ョ")},
- {0xff6f, 0, 0, 0, g(Yes, No, false, false, "", "ッ")},
- {0xff70, 0, 0, 0, g(Yes, No, false, false, "", "ー")},
- {0xff71, 0, 0, 0, g(Yes, No, false, false, "", "ア")},
- {0xff72, 0, 0, 0, g(Yes, No, false, false, "", "イ")},
- {0xff73, 0, 0, 0, g(Yes, No, false, false, "", "ウ")},
- {0xff74, 0, 0, 0, g(Yes, No, false, false, "", "エ")},
- {0xff75, 0, 0, 0, g(Yes, No, false, false, "", "オ")},
- {0xff76, 0, 0, 0, g(Yes, No, false, false, "", "カ")},
- {0xff77, 0, 0, 0, g(Yes, No, false, false, "", "キ")},
- {0xff78, 0, 0, 0, g(Yes, No, false, false, "", "ク")},
- {0xff79, 0, 0, 0, g(Yes, No, false, false, "", "ケ")},
- {0xff7a, 0, 0, 0, g(Yes, No, false, false, "", "コ")},
- {0xff7b, 0, 0, 0, g(Yes, No, false, false, "", "サ")},
- {0xff7c, 0, 0, 0, g(Yes, No, false, false, "", "シ")},
- {0xff7d, 0, 0, 0, g(Yes, No, false, false, "", "ス")},
- {0xff7e, 0, 0, 0, g(Yes, No, false, false, "", "セ")},
- {0xff7f, 0, 0, 0, g(Yes, No, false, false, "", "ソ")},
- {0xff80, 0, 0, 0, g(Yes, No, false, false, "", "タ")},
- {0xff81, 0, 0, 0, g(Yes, No, false, false, "", "チ")},
- {0xff82, 0, 0, 0, g(Yes, No, false, false, "", "ツ")},
- {0xff83, 0, 0, 0, g(Yes, No, false, false, "", "テ")},
- {0xff84, 0, 0, 0, g(Yes, No, false, false, "", "ト")},
- {0xff85, 0, 0, 0, g(Yes, No, false, false, "", "ナ")},
- {0xff86, 0, 0, 0, g(Yes, No, false, false, "", "ニ")},
- {0xff87, 0, 0, 0, g(Yes, No, false, false, "", "ヌ")},
- {0xff88, 0, 0, 0, g(Yes, No, false, false, "", "ネ")},
- {0xff89, 0, 0, 0, g(Yes, No, false, false, "", "ノ")},
- {0xff8a, 0, 0, 0, g(Yes, No, false, false, "", "ハ")},
- {0xff8b, 0, 0, 0, g(Yes, No, false, false, "", "ヒ")},
- {0xff8c, 0, 0, 0, g(Yes, No, false, false, "", "フ")},
- {0xff8d, 0, 0, 0, g(Yes, No, false, false, "", "ヘ")},
- {0xff8e, 0, 0, 0, g(Yes, No, false, false, "", "ホ")},
- {0xff8f, 0, 0, 0, g(Yes, No, false, false, "", "マ")},
- {0xff90, 0, 0, 0, g(Yes, No, false, false, "", "ミ")},
- {0xff91, 0, 0, 0, g(Yes, No, false, false, "", "ム")},
- {0xff92, 0, 0, 0, g(Yes, No, false, false, "", "メ")},
- {0xff93, 0, 0, 0, g(Yes, No, false, false, "", "モ")},
- {0xff94, 0, 0, 0, g(Yes, No, false, false, "", "ヤ")},
- {0xff95, 0, 0, 0, g(Yes, No, false, false, "", "ユ")},
- {0xff96, 0, 0, 0, g(Yes, No, false, false, "", "ヨ")},
- {0xff97, 0, 0, 0, g(Yes, No, false, false, "", "ラ")},
- {0xff98, 0, 0, 0, g(Yes, No, false, false, "", "リ")},
- {0xff99, 0, 0, 0, g(Yes, No, false, false, "", "ル")},
- {0xff9a, 0, 0, 0, g(Yes, No, false, false, "", "レ")},
- {0xff9b, 0, 0, 0, g(Yes, No, false, false, "", "ロ")},
- {0xff9c, 0, 0, 0, g(Yes, No, false, false, "", "ワ")},
- {0xff9d, 0, 0, 0, g(Yes, No, false, false, "", "ン")},
- {0xff9e, 0, 1, 1, g(Yes, No, false, false, "", "゙")},
- {0xff9f, 0, 1, 1, g(Yes, No, false, false, "", "゚")},
- {0xffa0, 0, 0, 0, g(Yes, No, false, false, "", "ᅠ")},
- {0xffa1, 0, 0, 0, g(Yes, No, false, false, "", "ᄀ")},
- {0xffa2, 0, 0, 0, g(Yes, No, false, false, "", "ᄁ")},
- {0xffa3, 0, 1, 1, g(Yes, No, false, false, "", "ᆪ")},
- {0xffa4, 0, 0, 0, g(Yes, No, false, false, "", "ᄂ")},
- {0xffa5, 0, 1, 1, g(Yes, No, false, false, "", "ᆬ")},
- {0xffa6, 0, 1, 1, g(Yes, No, false, false, "", "ᆭ")},
- {0xffa7, 0, 0, 0, g(Yes, No, false, false, "", "ᄃ")},
- {0xffa8, 0, 0, 0, g(Yes, No, false, false, "", "ᄄ")},
- {0xffa9, 0, 0, 0, g(Yes, No, false, false, "", "ᄅ")},
- {0xffaa, 0, 1, 1, g(Yes, No, false, false, "", "ᆰ")},
- {0xffab, 0, 1, 1, g(Yes, No, false, false, "", "ᆱ")},
- {0xffac, 0, 1, 1, g(Yes, No, false, false, "", "ᆲ")},
- {0xffad, 0, 1, 1, g(Yes, No, false, false, "", "ᆳ")},
- {0xffae, 0, 1, 1, g(Yes, No, false, false, "", "ᆴ")},
- {0xffaf, 0, 1, 1, g(Yes, No, false, false, "", "ᆵ")},
- {0xffb0, 0, 0, 0, g(Yes, No, false, false, "", "ᄚ")},
- {0xffb1, 0, 0, 0, g(Yes, No, false, false, "", "ᄆ")},
- {0xffb2, 0, 0, 0, g(Yes, No, false, false, "", "ᄇ")},
- {0xffb3, 0, 0, 0, g(Yes, No, false, false, "", "ᄈ")},
- {0xffb4, 0, 0, 0, g(Yes, No, false, false, "", "ᄡ")},
- {0xffb5, 0, 0, 0, g(Yes, No, false, false, "", "ᄉ")},
- {0xffb6, 0, 0, 0, g(Yes, No, false, false, "", "ᄊ")},
- {0xffb7, 0, 0, 0, g(Yes, No, false, false, "", "ᄋ")},
- {0xffb8, 0, 0, 0, g(Yes, No, false, false, "", "ᄌ")},
- {0xffb9, 0, 0, 0, g(Yes, No, false, false, "", "ᄍ")},
- {0xffba, 0, 0, 0, g(Yes, No, false, false, "", "ᄎ")},
- {0xffbb, 0, 0, 0, g(Yes, No, false, false, "", "ᄏ")},
- {0xffbc, 0, 0, 0, g(Yes, No, false, false, "", "ᄐ")},
- {0xffbd, 0, 0, 0, g(Yes, No, false, false, "", "ᄑ")},
- {0xffbe, 0, 0, 0, g(Yes, No, false, false, "", "ᄒ")},
- {0xffbf, 0, 0, 0, f(Yes, false, "")},
- {0xffc2, 0, 1, 1, g(Yes, No, false, false, "", "ᅡ")},
- {0xffc3, 0, 1, 1, g(Yes, No, false, false, "", "ᅢ")},
- {0xffc4, 0, 1, 1, g(Yes, No, false, false, "", "ᅣ")},
- {0xffc5, 0, 1, 1, g(Yes, No, false, false, "", "ᅤ")},
- {0xffc6, 0, 1, 1, g(Yes, No, false, false, "", "ᅥ")},
- {0xffc7, 0, 1, 1, g(Yes, No, false, false, "", "ᅦ")},
- {0xffc8, 0, 0, 0, f(Yes, false, "")},
- {0xffca, 0, 1, 1, g(Yes, No, false, false, "", "ᅧ")},
- {0xffcb, 0, 1, 1, g(Yes, No, false, false, "", "ᅨ")},
- {0xffcc, 0, 1, 1, g(Yes, No, false, false, "", "ᅩ")},
- {0xffcd, 0, 1, 1, g(Yes, No, false, false, "", "ᅪ")},
- {0xffce, 0, 1, 1, g(Yes, No, false, false, "", "ᅫ")},
- {0xffcf, 0, 1, 1, g(Yes, No, false, false, "", "ᅬ")},
- {0xffd0, 0, 0, 0, f(Yes, false, "")},
- {0xffd2, 0, 1, 1, g(Yes, No, false, false, "", "ᅭ")},
- {0xffd3, 0, 1, 1, g(Yes, No, false, false, "", "ᅮ")},
- {0xffd4, 0, 1, 1, g(Yes, No, false, false, "", "ᅯ")},
- {0xffd5, 0, 1, 1, g(Yes, No, false, false, "", "ᅰ")},
- {0xffd6, 0, 1, 1, g(Yes, No, false, false, "", "ᅱ")},
- {0xffd7, 0, 1, 1, g(Yes, No, false, false, "", "ᅲ")},
- {0xffd8, 0, 0, 0, f(Yes, false, "")},
- {0xffda, 0, 1, 1, g(Yes, No, false, false, "", "ᅳ")},
- {0xffdb, 0, 1, 1, g(Yes, No, false, false, "", "ᅴ")},
- {0xffdc, 0, 1, 1, g(Yes, No, false, false, "", "ᅵ")},
- {0xffdd, 0, 0, 0, f(Yes, false, "")},
- {0xffe0, 0, 0, 0, g(Yes, No, false, false, "", "¢")},
- {0xffe1, 0, 0, 0, g(Yes, No, false, false, "", "£")},
- {0xffe2, 0, 0, 0, g(Yes, No, false, false, "", "¬")},
- {0xffe3, 0, 0, 1, g(Yes, No, false, false, "", " ̄")},
- {0xffe4, 0, 0, 0, g(Yes, No, false, false, "", "¦")},
- {0xffe5, 0, 0, 0, g(Yes, No, false, false, "", "¥")},
- {0xffe6, 0, 0, 0, g(Yes, No, false, false, "", "₩")},
- {0xffe7, 0, 0, 0, f(Yes, false, "")},
- {0xffe8, 0, 0, 0, g(Yes, No, false, false, "", "│")},
- {0xffe9, 0, 0, 0, g(Yes, No, false, false, "", "←")},
- {0xffea, 0, 0, 0, g(Yes, No, false, false, "", "↑")},
- {0xffeb, 0, 0, 0, g(Yes, No, false, false, "", "→")},
- {0xffec, 0, 0, 0, g(Yes, No, false, false, "", "↓")},
- {0xffed, 0, 0, 0, g(Yes, No, false, false, "", "■")},
- {0xffee, 0, 0, 0, g(Yes, No, false, false, "", "○")},
- {0xffef, 0, 0, 0, f(Yes, false, "")},
- {0x101fd, 220, 1, 1, f(Yes, false, "")},
- {0x101fe, 0, 0, 0, f(Yes, false, "")},
- {0x102e0, 220, 1, 1, f(Yes, false, "")},
- {0x102e1, 0, 0, 0, f(Yes, false, "")},
- {0x10376, 230, 1, 1, f(Yes, false, "")},
- {0x1037b, 0, 0, 0, f(Yes, false, "")},
- {0x10a0d, 220, 1, 1, f(Yes, false, "")},
- {0x10a0e, 0, 0, 0, f(Yes, false, "")},
- {0x10a0f, 230, 1, 1, f(Yes, false, "")},
- {0x10a10, 0, 0, 0, f(Yes, false, "")},
- {0x10a38, 230, 1, 1, f(Yes, false, "")},
- {0x10a39, 1, 1, 1, f(Yes, false, "")},
- {0x10a3a, 220, 1, 1, f(Yes, false, "")},
- {0x10a3b, 0, 0, 0, f(Yes, false, "")},
- {0x10a3f, 9, 1, 1, f(Yes, false, "")},
- {0x10a40, 0, 0, 0, f(Yes, false, "")},
- {0x10ae5, 230, 1, 1, f(Yes, false, "")},
- {0x10ae6, 220, 1, 1, f(Yes, false, "")},
- {0x10ae7, 0, 0, 0, f(Yes, false, "")},
- {0x11046, 9, 1, 1, f(Yes, false, "")},
- {0x11047, 0, 0, 0, f(Yes, false, "")},
- {0x1107f, 9, 1, 1, f(Yes, false, "")},
- {0x11080, 0, 0, 0, f(Yes, false, "")},
- {0x11099, 0, 0, 0, f(Yes, true, "")},
- {0x1109a, 0, 0, 1, f(Yes, false, "𑂚")},
- {0x1109b, 0, 0, 0, f(Yes, true, "")},
- {0x1109c, 0, 0, 1, f(Yes, false, "𑂜")},
- {0x1109d, 0, 0, 0, f(Yes, false, "")},
- {0x110a5, 0, 0, 0, f(Yes, true, "")},
- {0x110a6, 0, 0, 0, f(Yes, false, "")},
- {0x110ab, 0, 0, 1, f(Yes, false, "𑂫")},
- {0x110ac, 0, 0, 0, f(Yes, false, "")},
- {0x110b9, 9, 1, 1, f(Yes, false, "")},
- {0x110ba, 7, 1, 1, f(Maybe, false, "")},
- {0x110bb, 0, 0, 0, f(Yes, false, "")},
- {0x11100, 230, 1, 1, f(Yes, false, "")},
- {0x11103, 0, 0, 0, f(Yes, false, "")},
- {0x11127, 0, 1, 1, f(Maybe, false, "")},
- {0x11128, 0, 0, 0, f(Yes, false, "")},
- {0x1112e, 0, 0, 1, f(Yes, false, "𑄮")},
- {0x1112f, 0, 0, 1, f(Yes, false, "𑄯")},
- {0x11130, 0, 0, 0, f(Yes, false, "")},
- {0x11131, 0, 0, 0, f(Yes, true, "")},
- {0x11133, 9, 1, 1, f(Yes, false, "")},
- {0x11135, 0, 0, 0, f(Yes, false, "")},
- {0x11173, 7, 1, 1, f(Yes, false, "")},
- {0x11174, 0, 0, 0, f(Yes, false, "")},
- {0x111c0, 9, 1, 1, f(Yes, false, "")},
- {0x111c1, 0, 0, 0, f(Yes, false, "")},
- {0x111ca, 7, 1, 1, f(Yes, false, "")},
- {0x111cb, 0, 0, 0, f(Yes, false, "")},
- {0x11235, 9, 1, 1, f(Yes, false, "")},
- {0x11236, 7, 1, 1, f(Yes, false, "")},
- {0x11237, 0, 0, 0, f(Yes, false, "")},
- {0x112e9, 7, 1, 1, f(Yes, false, "")},
- {0x112ea, 9, 1, 1, f(Yes, false, "")},
- {0x112eb, 0, 0, 0, f(Yes, false, "")},
- {0x1133c, 7, 1, 1, f(Yes, false, "")},
- {0x1133d, 0, 0, 0, f(Yes, false, "")},
- {0x1133e, 0, 1, 1, f(Maybe, false, "")},
- {0x1133f, 0, 0, 0, f(Yes, false, "")},
- {0x11347, 0, 0, 0, f(Yes, true, "")},
- {0x11348, 0, 0, 0, f(Yes, false, "")},
- {0x1134b, 0, 0, 1, f(Yes, false, "𑍋")},
- {0x1134c, 0, 0, 1, f(Yes, false, "𑍌")},
- {0x1134d, 9, 1, 1, f(Yes, false, "")},
- {0x1134e, 0, 0, 0, f(Yes, false, "")},
- {0x11357, 0, 1, 1, f(Maybe, false, "")},
- {0x11358, 0, 0, 0, f(Yes, false, "")},
- {0x11366, 230, 1, 1, f(Yes, false, "")},
- {0x1136d, 0, 0, 0, f(Yes, false, "")},
- {0x11370, 230, 1, 1, f(Yes, false, "")},
- {0x11375, 0, 0, 0, f(Yes, false, "")},
- {0x11442, 9, 1, 1, f(Yes, false, "")},
- {0x11443, 0, 0, 0, f(Yes, false, "")},
- {0x11446, 7, 1, 1, f(Yes, false, "")},
- {0x11447, 0, 0, 0, f(Yes, false, "")},
- {0x114b0, 0, 1, 1, f(Maybe, false, "")},
- {0x114b1, 0, 0, 0, f(Yes, false, "")},
- {0x114b9, 0, 0, 0, f(Yes, true, "")},
- {0x114ba, 0, 1, 1, f(Maybe, false, "")},
- {0x114bb, 0, 0, 1, f(Yes, false, "𑒻")},
- {0x114bc, 0, 0, 1, f(Yes, false, "𑒼")},
- {0x114bd, 0, 1, 1, f(Maybe, false, "")},
- {0x114be, 0, 0, 1, f(Yes, false, "𑒾")},
- {0x114bf, 0, 0, 0, f(Yes, false, "")},
- {0x114c2, 9, 1, 1, f(Yes, false, "")},
- {0x114c3, 7, 1, 1, f(Yes, false, "")},
- {0x114c4, 0, 0, 0, f(Yes, false, "")},
- {0x115af, 0, 1, 1, f(Maybe, false, "")},
- {0x115b0, 0, 0, 0, f(Yes, false, "")},
- {0x115b8, 0, 0, 0, f(Yes, true, "")},
- {0x115ba, 0, 0, 1, f(Yes, false, "𑖺")},
- {0x115bb, 0, 0, 1, f(Yes, false, "𑖻")},
- {0x115bc, 0, 0, 0, f(Yes, false, "")},
- {0x115bf, 9, 1, 1, f(Yes, false, "")},
- {0x115c0, 7, 1, 1, f(Yes, false, "")},
- {0x115c1, 0, 0, 0, f(Yes, false, "")},
- {0x1163f, 9, 1, 1, f(Yes, false, "")},
- {0x11640, 0, 0, 0, f(Yes, false, "")},
- {0x116b6, 9, 1, 1, f(Yes, false, "")},
- {0x116b7, 7, 1, 1, f(Yes, false, "")},
- {0x116b8, 0, 0, 0, f(Yes, false, "")},
- {0x1172b, 9, 1, 1, f(Yes, false, "")},
- {0x1172c, 0, 0, 0, f(Yes, false, "")},
- {0x11c3f, 9, 1, 1, f(Yes, false, "")},
- {0x11c40, 0, 0, 0, f(Yes, false, "")},
- {0x16af0, 1, 1, 1, f(Yes, false, "")},
- {0x16af5, 0, 0, 0, f(Yes, false, "")},
- {0x16b30, 230, 1, 1, f(Yes, false, "")},
- {0x16b37, 0, 0, 0, f(Yes, false, "")},
- {0x1bc9e, 1, 1, 1, f(Yes, false, "")},
- {0x1bc9f, 0, 0, 0, f(Yes, false, "")},
- {0x1d15e, 0, 0, 1, f(No, false, "𝅗𝅥")},
- {0x1d15f, 0, 0, 1, f(No, false, "𝅘𝅥")},
- {0x1d160, 0, 0, 2, f(No, false, "𝅘𝅥𝅮")},
- {0x1d161, 0, 0, 2, f(No, false, "𝅘𝅥𝅯")},
- {0x1d162, 0, 0, 2, f(No, false, "𝅘𝅥𝅰")},
- {0x1d163, 0, 0, 2, f(No, false, "𝅘𝅥𝅱")},
- {0x1d164, 0, 0, 2, f(No, false, "𝅘𝅥𝅲")},
- {0x1d165, 216, 1, 1, f(Yes, false, "")},
- {0x1d167, 1, 1, 1, f(Yes, false, "")},
- {0x1d16a, 0, 0, 0, f(Yes, false, "")},
- {0x1d16d, 226, 1, 1, f(Yes, false, "")},
- {0x1d16e, 216, 1, 1, f(Yes, false, "")},
- {0x1d173, 0, 0, 0, f(Yes, false, "")},
- {0x1d17b, 220, 1, 1, f(Yes, false, "")},
- {0x1d183, 0, 0, 0, f(Yes, false, "")},
- {0x1d185, 230, 1, 1, f(Yes, false, "")},
- {0x1d18a, 220, 1, 1, f(Yes, false, "")},
- {0x1d18c, 0, 0, 0, f(Yes, false, "")},
- {0x1d1aa, 230, 1, 1, f(Yes, false, "")},
- {0x1d1ae, 0, 0, 0, f(Yes, false, "")},
- {0x1d1bb, 0, 0, 1, f(No, false, "𝆹𝅥")},
- {0x1d1bc, 0, 0, 1, f(No, false, "𝆺𝅥")},
- {0x1d1bd, 0, 0, 2, f(No, false, "𝆹𝅥𝅮")},
- {0x1d1be, 0, 0, 2, f(No, false, "𝆺𝅥𝅮")},
- {0x1d1bf, 0, 0, 2, f(No, false, "𝆹𝅥𝅯")},
- {0x1d1c0, 0, 0, 2, f(No, false, "𝆺𝅥𝅯")},
- {0x1d1c1, 0, 0, 0, f(Yes, false, "")},
- {0x1d242, 230, 1, 1, f(Yes, false, "")},
- {0x1d245, 0, 0, 0, f(Yes, false, "")},
- {0x1d400, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d401, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d402, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d403, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d404, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d405, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d406, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d407, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d408, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d409, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d40a, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d40b, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d40c, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d40d, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d40e, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d40f, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d410, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d411, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d412, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d413, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d414, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d415, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d416, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d417, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d418, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d419, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d41a, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d41b, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d41c, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d41d, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d41e, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d41f, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d420, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d421, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d422, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d423, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d424, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d425, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d426, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d427, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d428, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d429, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d42a, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d42b, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d42c, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d42d, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d42e, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d42f, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d430, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d431, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d432, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d433, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d434, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d435, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d436, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d437, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d438, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d439, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d43a, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d43b, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d43c, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d43d, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d43e, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d43f, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d440, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d441, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d442, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d443, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d444, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d445, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d446, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d447, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d448, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d449, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d44a, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d44b, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d44c, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d44d, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d44e, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d44f, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d450, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d451, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d452, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d453, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d454, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d455, 0, 0, 0, f(Yes, false, "")},
- {0x1d456, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d457, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d458, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d459, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d45a, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d45b, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d45c, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d45d, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d45e, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d45f, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d460, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d461, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d462, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d463, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d464, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d465, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d466, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d467, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d468, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d469, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d46a, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d46b, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d46c, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d46d, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d46e, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d46f, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d470, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d471, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d472, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d473, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d474, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d475, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d476, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d477, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d478, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d479, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d47a, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d47b, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d47c, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d47d, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d47e, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d47f, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d480, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d481, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d482, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d483, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d484, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d485, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d486, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d487, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d488, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d489, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d48a, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d48b, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d48c, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d48d, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d48e, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d48f, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d490, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d491, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d492, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d493, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d494, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d495, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d496, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d497, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d498, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d499, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d49a, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d49b, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d49c, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d49d, 0, 0, 0, f(Yes, false, "")},
- {0x1d49e, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d49f, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d4a0, 0, 0, 0, f(Yes, false, "")},
- {0x1d4a2, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d4a3, 0, 0, 0, f(Yes, false, "")},
- {0x1d4a5, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d4a6, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d4a7, 0, 0, 0, f(Yes, false, "")},
- {0x1d4a9, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d4aa, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d4ab, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d4ac, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d4ad, 0, 0, 0, f(Yes, false, "")},
- {0x1d4ae, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d4af, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d4b0, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d4b1, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d4b2, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d4b3, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d4b4, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d4b5, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d4b6, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d4b7, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d4b8, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d4b9, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d4ba, 0, 0, 0, f(Yes, false, "")},
- {0x1d4bb, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d4bc, 0, 0, 0, f(Yes, false, "")},
- {0x1d4bd, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d4be, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d4bf, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d4c0, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d4c1, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d4c2, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d4c3, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d4c4, 0, 0, 0, f(Yes, false, "")},
- {0x1d4c5, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d4c6, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d4c7, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d4c8, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d4c9, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d4ca, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d4cb, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d4cc, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d4cd, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d4ce, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d4cf, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d4d0, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d4d1, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d4d2, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d4d3, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d4d4, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d4d5, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d4d6, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d4d7, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d4d8, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d4d9, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d4da, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d4db, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d4dc, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d4dd, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d4de, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d4df, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d4e0, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d4e1, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d4e2, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d4e3, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d4e4, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d4e5, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d4e6, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d4e7, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d4e8, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d4e9, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d4ea, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d4eb, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d4ec, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d4ed, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d4ee, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d4ef, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d4f0, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d4f1, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d4f2, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d4f3, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d4f4, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d4f5, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d4f6, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d4f7, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d4f8, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d4f9, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d4fa, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d4fb, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d4fc, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d4fd, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d4fe, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d4ff, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d500, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d501, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d502, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d503, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d504, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d505, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d506, 0, 0, 0, f(Yes, false, "")},
- {0x1d507, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d508, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d509, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d50a, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d50b, 0, 0, 0, f(Yes, false, "")},
- {0x1d50d, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d50e, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d50f, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d510, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d511, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d512, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d513, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d514, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d515, 0, 0, 0, f(Yes, false, "")},
- {0x1d516, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d517, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d518, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d519, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d51a, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d51b, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d51c, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d51d, 0, 0, 0, f(Yes, false, "")},
- {0x1d51e, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d51f, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d520, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d521, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d522, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d523, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d524, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d525, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d526, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d527, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d528, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d529, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d52a, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d52b, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d52c, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d52d, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d52e, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d52f, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d530, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d531, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d532, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d533, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d534, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d535, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d536, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d537, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d538, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d539, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d53a, 0, 0, 0, f(Yes, false, "")},
- {0x1d53b, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d53c, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d53d, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d53e, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d53f, 0, 0, 0, f(Yes, false, "")},
- {0x1d540, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d541, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d542, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d543, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d544, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d545, 0, 0, 0, f(Yes, false, "")},
- {0x1d546, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d547, 0, 0, 0, f(Yes, false, "")},
- {0x1d54a, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d54b, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d54c, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d54d, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d54e, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d54f, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d550, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d551, 0, 0, 0, f(Yes, false, "")},
- {0x1d552, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d553, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d554, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d555, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d556, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d557, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d558, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d559, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d55a, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d55b, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d55c, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d55d, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d55e, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d55f, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d560, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d561, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d562, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d563, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d564, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d565, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d566, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d567, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d568, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d569, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d56a, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d56b, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d56c, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d56d, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d56e, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d56f, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d570, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d571, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d572, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d573, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d574, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d575, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d576, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d577, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d578, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d579, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d57a, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d57b, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d57c, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d57d, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d57e, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d57f, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d580, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d581, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d582, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d583, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d584, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d585, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d586, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d587, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d588, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d589, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d58a, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d58b, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d58c, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d58d, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d58e, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d58f, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d590, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d591, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d592, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d593, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d594, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d595, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d596, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d597, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d598, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d599, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d59a, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d59b, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d59c, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d59d, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d59e, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d59f, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d5a0, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d5a1, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d5a2, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d5a3, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d5a4, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d5a5, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d5a6, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d5a7, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d5a8, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d5a9, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d5aa, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d5ab, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d5ac, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d5ad, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d5ae, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d5af, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d5b0, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d5b1, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d5b2, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d5b3, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d5b4, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d5b5, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d5b6, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d5b7, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d5b8, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d5b9, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d5ba, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d5bb, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d5bc, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d5bd, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d5be, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d5bf, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d5c0, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d5c1, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d5c2, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d5c3, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d5c4, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d5c5, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d5c6, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d5c7, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d5c8, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d5c9, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d5ca, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d5cb, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d5cc, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d5cd, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d5ce, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d5cf, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d5d0, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d5d1, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d5d2, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d5d3, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d5d4, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d5d5, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d5d6, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d5d7, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d5d8, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d5d9, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d5da, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d5db, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d5dc, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d5dd, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d5de, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d5df, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d5e0, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d5e1, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d5e2, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d5e3, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d5e4, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d5e5, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d5e6, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d5e7, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d5e8, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d5e9, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d5ea, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d5eb, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d5ec, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d5ed, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d5ee, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d5ef, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d5f0, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d5f1, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d5f2, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d5f3, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d5f4, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d5f5, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d5f6, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d5f7, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d5f8, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d5f9, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d5fa, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d5fb, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d5fc, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d5fd, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d5fe, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d5ff, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d600, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d601, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d602, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d603, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d604, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d605, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d606, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d607, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d608, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d609, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d60a, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d60b, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d60c, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d60d, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d60e, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d60f, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d610, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d611, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d612, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d613, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d614, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d615, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d616, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d617, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d618, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d619, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d61a, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d61b, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d61c, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d61d, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d61e, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d61f, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d620, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d621, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d622, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d623, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d624, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d625, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d626, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d627, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d628, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d629, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d62a, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d62b, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d62c, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d62d, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d62e, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d62f, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d630, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d631, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d632, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d633, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d634, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d635, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d636, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d637, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d638, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d639, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d63a, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d63b, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d63c, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d63d, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d63e, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d63f, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d640, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d641, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d642, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d643, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d644, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d645, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d646, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d647, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d648, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d649, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d64a, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d64b, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d64c, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d64d, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d64e, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d64f, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d650, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d651, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d652, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d653, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d654, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d655, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d656, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d657, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d658, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d659, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d65a, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d65b, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d65c, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d65d, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d65e, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d65f, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d660, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d661, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d662, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d663, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d664, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d665, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d666, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d667, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d668, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d669, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d66a, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d66b, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d66c, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d66d, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d66e, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d66f, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d670, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d671, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d672, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d673, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d674, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d675, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d676, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d677, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d678, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d679, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d67a, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d67b, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d67c, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d67d, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d67e, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d67f, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d680, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d681, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d682, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d683, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d684, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d685, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d686, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d687, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d688, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d689, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d68a, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d68b, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d68c, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d68d, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d68e, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d68f, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d690, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d691, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d692, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d693, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d694, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d695, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d696, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d697, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d698, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d699, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d69a, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d69b, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d69c, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d69d, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d69e, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d69f, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d6a0, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d6a1, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d6a2, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d6a3, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d6a4, 0, 0, 0, g(Yes, No, false, false, "", "ı")},
- {0x1d6a5, 0, 0, 0, g(Yes, No, false, false, "", "ȷ")},
- {0x1d6a6, 0, 0, 0, f(Yes, false, "")},
- {0x1d6a8, 0, 0, 0, g(Yes, No, false, false, "", "Α")},
- {0x1d6a9, 0, 0, 0, g(Yes, No, false, false, "", "Β")},
- {0x1d6aa, 0, 0, 0, g(Yes, No, false, false, "", "Γ")},
- {0x1d6ab, 0, 0, 0, g(Yes, No, false, false, "", "Δ")},
- {0x1d6ac, 0, 0, 0, g(Yes, No, false, false, "", "Ε")},
- {0x1d6ad, 0, 0, 0, g(Yes, No, false, false, "", "Ζ")},
- {0x1d6ae, 0, 0, 0, g(Yes, No, false, false, "", "Η")},
- {0x1d6af, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d6b0, 0, 0, 0, g(Yes, No, false, false, "", "Ι")},
- {0x1d6b1, 0, 0, 0, g(Yes, No, false, false, "", "Κ")},
- {0x1d6b2, 0, 0, 0, g(Yes, No, false, false, "", "Λ")},
- {0x1d6b3, 0, 0, 0, g(Yes, No, false, false, "", "Μ")},
- {0x1d6b4, 0, 0, 0, g(Yes, No, false, false, "", "Ν")},
- {0x1d6b5, 0, 0, 0, g(Yes, No, false, false, "", "Ξ")},
- {0x1d6b6, 0, 0, 0, g(Yes, No, false, false, "", "Ο")},
- {0x1d6b7, 0, 0, 0, g(Yes, No, false, false, "", "Π")},
- {0x1d6b8, 0, 0, 0, g(Yes, No, false, false, "", "Ρ")},
- {0x1d6b9, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d6ba, 0, 0, 0, g(Yes, No, false, false, "", "Σ")},
- {0x1d6bb, 0, 0, 0, g(Yes, No, false, false, "", "Τ")},
- {0x1d6bc, 0, 0, 0, g(Yes, No, false, false, "", "Υ")},
- {0x1d6bd, 0, 0, 0, g(Yes, No, false, false, "", "Φ")},
- {0x1d6be, 0, 0, 0, g(Yes, No, false, false, "", "Χ")},
- {0x1d6bf, 0, 0, 0, g(Yes, No, false, false, "", "Ψ")},
- {0x1d6c0, 0, 0, 0, g(Yes, No, false, false, "", "Ω")},
- {0x1d6c1, 0, 0, 0, g(Yes, No, false, false, "", "∇")},
- {0x1d6c2, 0, 0, 0, g(Yes, No, false, false, "", "α")},
- {0x1d6c3, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x1d6c4, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x1d6c5, 0, 0, 0, g(Yes, No, false, false, "", "δ")},
- {0x1d6c6, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d6c7, 0, 0, 0, g(Yes, No, false, false, "", "ζ")},
- {0x1d6c8, 0, 0, 0, g(Yes, No, false, false, "", "η")},
- {0x1d6c9, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d6ca, 0, 0, 0, g(Yes, No, false, false, "", "ι")},
- {0x1d6cb, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d6cc, 0, 0, 0, g(Yes, No, false, false, "", "λ")},
- {0x1d6cd, 0, 0, 0, g(Yes, No, false, false, "", "μ")},
- {0x1d6ce, 0, 0, 0, g(Yes, No, false, false, "", "ν")},
- {0x1d6cf, 0, 0, 0, g(Yes, No, false, false, "", "ξ")},
- {0x1d6d0, 0, 0, 0, g(Yes, No, false, false, "", "ο")},
- {0x1d6d1, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d6d2, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d6d3, 0, 0, 0, g(Yes, No, false, false, "", "ς")},
- {0x1d6d4, 0, 0, 0, g(Yes, No, false, false, "", "σ")},
- {0x1d6d5, 0, 0, 0, g(Yes, No, false, false, "", "τ")},
- {0x1d6d6, 0, 0, 0, g(Yes, No, false, false, "", "υ")},
- {0x1d6d7, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d6d8, 0, 0, 0, g(Yes, No, false, false, "", "χ")},
- {0x1d6d9, 0, 0, 0, g(Yes, No, false, false, "", "ψ")},
- {0x1d6da, 0, 0, 0, g(Yes, No, false, false, "", "ω")},
- {0x1d6db, 0, 0, 0, g(Yes, No, false, false, "", "∂")},
- {0x1d6dc, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d6dd, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d6de, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d6df, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d6e0, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d6e1, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d6e2, 0, 0, 0, g(Yes, No, false, false, "", "Α")},
- {0x1d6e3, 0, 0, 0, g(Yes, No, false, false, "", "Β")},
- {0x1d6e4, 0, 0, 0, g(Yes, No, false, false, "", "Γ")},
- {0x1d6e5, 0, 0, 0, g(Yes, No, false, false, "", "Δ")},
- {0x1d6e6, 0, 0, 0, g(Yes, No, false, false, "", "Ε")},
- {0x1d6e7, 0, 0, 0, g(Yes, No, false, false, "", "Ζ")},
- {0x1d6e8, 0, 0, 0, g(Yes, No, false, false, "", "Η")},
- {0x1d6e9, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d6ea, 0, 0, 0, g(Yes, No, false, false, "", "Ι")},
- {0x1d6eb, 0, 0, 0, g(Yes, No, false, false, "", "Κ")},
- {0x1d6ec, 0, 0, 0, g(Yes, No, false, false, "", "Λ")},
- {0x1d6ed, 0, 0, 0, g(Yes, No, false, false, "", "Μ")},
- {0x1d6ee, 0, 0, 0, g(Yes, No, false, false, "", "Ν")},
- {0x1d6ef, 0, 0, 0, g(Yes, No, false, false, "", "Ξ")},
- {0x1d6f0, 0, 0, 0, g(Yes, No, false, false, "", "Ο")},
- {0x1d6f1, 0, 0, 0, g(Yes, No, false, false, "", "Π")},
- {0x1d6f2, 0, 0, 0, g(Yes, No, false, false, "", "Ρ")},
- {0x1d6f3, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d6f4, 0, 0, 0, g(Yes, No, false, false, "", "Σ")},
- {0x1d6f5, 0, 0, 0, g(Yes, No, false, false, "", "Τ")},
- {0x1d6f6, 0, 0, 0, g(Yes, No, false, false, "", "Υ")},
- {0x1d6f7, 0, 0, 0, g(Yes, No, false, false, "", "Φ")},
- {0x1d6f8, 0, 0, 0, g(Yes, No, false, false, "", "Χ")},
- {0x1d6f9, 0, 0, 0, g(Yes, No, false, false, "", "Ψ")},
- {0x1d6fa, 0, 0, 0, g(Yes, No, false, false, "", "Ω")},
- {0x1d6fb, 0, 0, 0, g(Yes, No, false, false, "", "∇")},
- {0x1d6fc, 0, 0, 0, g(Yes, No, false, false, "", "α")},
- {0x1d6fd, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x1d6fe, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x1d6ff, 0, 0, 0, g(Yes, No, false, false, "", "δ")},
- {0x1d700, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d701, 0, 0, 0, g(Yes, No, false, false, "", "ζ")},
- {0x1d702, 0, 0, 0, g(Yes, No, false, false, "", "η")},
- {0x1d703, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d704, 0, 0, 0, g(Yes, No, false, false, "", "ι")},
- {0x1d705, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d706, 0, 0, 0, g(Yes, No, false, false, "", "λ")},
- {0x1d707, 0, 0, 0, g(Yes, No, false, false, "", "μ")},
- {0x1d708, 0, 0, 0, g(Yes, No, false, false, "", "ν")},
- {0x1d709, 0, 0, 0, g(Yes, No, false, false, "", "ξ")},
- {0x1d70a, 0, 0, 0, g(Yes, No, false, false, "", "ο")},
- {0x1d70b, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d70c, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d70d, 0, 0, 0, g(Yes, No, false, false, "", "ς")},
- {0x1d70e, 0, 0, 0, g(Yes, No, false, false, "", "σ")},
- {0x1d70f, 0, 0, 0, g(Yes, No, false, false, "", "τ")},
- {0x1d710, 0, 0, 0, g(Yes, No, false, false, "", "υ")},
- {0x1d711, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d712, 0, 0, 0, g(Yes, No, false, false, "", "χ")},
- {0x1d713, 0, 0, 0, g(Yes, No, false, false, "", "ψ")},
- {0x1d714, 0, 0, 0, g(Yes, No, false, false, "", "ω")},
- {0x1d715, 0, 0, 0, g(Yes, No, false, false, "", "∂")},
- {0x1d716, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d717, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d718, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d719, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d71a, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d71b, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d71c, 0, 0, 0, g(Yes, No, false, false, "", "Α")},
- {0x1d71d, 0, 0, 0, g(Yes, No, false, false, "", "Β")},
- {0x1d71e, 0, 0, 0, g(Yes, No, false, false, "", "Γ")},
- {0x1d71f, 0, 0, 0, g(Yes, No, false, false, "", "Δ")},
- {0x1d720, 0, 0, 0, g(Yes, No, false, false, "", "Ε")},
- {0x1d721, 0, 0, 0, g(Yes, No, false, false, "", "Ζ")},
- {0x1d722, 0, 0, 0, g(Yes, No, false, false, "", "Η")},
- {0x1d723, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d724, 0, 0, 0, g(Yes, No, false, false, "", "Ι")},
- {0x1d725, 0, 0, 0, g(Yes, No, false, false, "", "Κ")},
- {0x1d726, 0, 0, 0, g(Yes, No, false, false, "", "Λ")},
- {0x1d727, 0, 0, 0, g(Yes, No, false, false, "", "Μ")},
- {0x1d728, 0, 0, 0, g(Yes, No, false, false, "", "Ν")},
- {0x1d729, 0, 0, 0, g(Yes, No, false, false, "", "Ξ")},
- {0x1d72a, 0, 0, 0, g(Yes, No, false, false, "", "Ο")},
- {0x1d72b, 0, 0, 0, g(Yes, No, false, false, "", "Π")},
- {0x1d72c, 0, 0, 0, g(Yes, No, false, false, "", "Ρ")},
- {0x1d72d, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d72e, 0, 0, 0, g(Yes, No, false, false, "", "Σ")},
- {0x1d72f, 0, 0, 0, g(Yes, No, false, false, "", "Τ")},
- {0x1d730, 0, 0, 0, g(Yes, No, false, false, "", "Υ")},
- {0x1d731, 0, 0, 0, g(Yes, No, false, false, "", "Φ")},
- {0x1d732, 0, 0, 0, g(Yes, No, false, false, "", "Χ")},
- {0x1d733, 0, 0, 0, g(Yes, No, false, false, "", "Ψ")},
- {0x1d734, 0, 0, 0, g(Yes, No, false, false, "", "Ω")},
- {0x1d735, 0, 0, 0, g(Yes, No, false, false, "", "∇")},
- {0x1d736, 0, 0, 0, g(Yes, No, false, false, "", "α")},
- {0x1d737, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x1d738, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x1d739, 0, 0, 0, g(Yes, No, false, false, "", "δ")},
- {0x1d73a, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d73b, 0, 0, 0, g(Yes, No, false, false, "", "ζ")},
- {0x1d73c, 0, 0, 0, g(Yes, No, false, false, "", "η")},
- {0x1d73d, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d73e, 0, 0, 0, g(Yes, No, false, false, "", "ι")},
- {0x1d73f, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d740, 0, 0, 0, g(Yes, No, false, false, "", "λ")},
- {0x1d741, 0, 0, 0, g(Yes, No, false, false, "", "μ")},
- {0x1d742, 0, 0, 0, g(Yes, No, false, false, "", "ν")},
- {0x1d743, 0, 0, 0, g(Yes, No, false, false, "", "ξ")},
- {0x1d744, 0, 0, 0, g(Yes, No, false, false, "", "ο")},
- {0x1d745, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d746, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d747, 0, 0, 0, g(Yes, No, false, false, "", "ς")},
- {0x1d748, 0, 0, 0, g(Yes, No, false, false, "", "σ")},
- {0x1d749, 0, 0, 0, g(Yes, No, false, false, "", "τ")},
- {0x1d74a, 0, 0, 0, g(Yes, No, false, false, "", "υ")},
- {0x1d74b, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d74c, 0, 0, 0, g(Yes, No, false, false, "", "χ")},
- {0x1d74d, 0, 0, 0, g(Yes, No, false, false, "", "ψ")},
- {0x1d74e, 0, 0, 0, g(Yes, No, false, false, "", "ω")},
- {0x1d74f, 0, 0, 0, g(Yes, No, false, false, "", "∂")},
- {0x1d750, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d751, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d752, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d753, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d754, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d755, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d756, 0, 0, 0, g(Yes, No, false, false, "", "Α")},
- {0x1d757, 0, 0, 0, g(Yes, No, false, false, "", "Β")},
- {0x1d758, 0, 0, 0, g(Yes, No, false, false, "", "Γ")},
- {0x1d759, 0, 0, 0, g(Yes, No, false, false, "", "Δ")},
- {0x1d75a, 0, 0, 0, g(Yes, No, false, false, "", "Ε")},
- {0x1d75b, 0, 0, 0, g(Yes, No, false, false, "", "Ζ")},
- {0x1d75c, 0, 0, 0, g(Yes, No, false, false, "", "Η")},
- {0x1d75d, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d75e, 0, 0, 0, g(Yes, No, false, false, "", "Ι")},
- {0x1d75f, 0, 0, 0, g(Yes, No, false, false, "", "Κ")},
- {0x1d760, 0, 0, 0, g(Yes, No, false, false, "", "Λ")},
- {0x1d761, 0, 0, 0, g(Yes, No, false, false, "", "Μ")},
- {0x1d762, 0, 0, 0, g(Yes, No, false, false, "", "Ν")},
- {0x1d763, 0, 0, 0, g(Yes, No, false, false, "", "Ξ")},
- {0x1d764, 0, 0, 0, g(Yes, No, false, false, "", "Ο")},
- {0x1d765, 0, 0, 0, g(Yes, No, false, false, "", "Π")},
- {0x1d766, 0, 0, 0, g(Yes, No, false, false, "", "Ρ")},
- {0x1d767, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d768, 0, 0, 0, g(Yes, No, false, false, "", "Σ")},
- {0x1d769, 0, 0, 0, g(Yes, No, false, false, "", "Τ")},
- {0x1d76a, 0, 0, 0, g(Yes, No, false, false, "", "Υ")},
- {0x1d76b, 0, 0, 0, g(Yes, No, false, false, "", "Φ")},
- {0x1d76c, 0, 0, 0, g(Yes, No, false, false, "", "Χ")},
- {0x1d76d, 0, 0, 0, g(Yes, No, false, false, "", "Ψ")},
- {0x1d76e, 0, 0, 0, g(Yes, No, false, false, "", "Ω")},
- {0x1d76f, 0, 0, 0, g(Yes, No, false, false, "", "∇")},
- {0x1d770, 0, 0, 0, g(Yes, No, false, false, "", "α")},
- {0x1d771, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x1d772, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x1d773, 0, 0, 0, g(Yes, No, false, false, "", "δ")},
- {0x1d774, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d775, 0, 0, 0, g(Yes, No, false, false, "", "ζ")},
- {0x1d776, 0, 0, 0, g(Yes, No, false, false, "", "η")},
- {0x1d777, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d778, 0, 0, 0, g(Yes, No, false, false, "", "ι")},
- {0x1d779, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d77a, 0, 0, 0, g(Yes, No, false, false, "", "λ")},
- {0x1d77b, 0, 0, 0, g(Yes, No, false, false, "", "μ")},
- {0x1d77c, 0, 0, 0, g(Yes, No, false, false, "", "ν")},
- {0x1d77d, 0, 0, 0, g(Yes, No, false, false, "", "ξ")},
- {0x1d77e, 0, 0, 0, g(Yes, No, false, false, "", "ο")},
- {0x1d77f, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d780, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d781, 0, 0, 0, g(Yes, No, false, false, "", "ς")},
- {0x1d782, 0, 0, 0, g(Yes, No, false, false, "", "σ")},
- {0x1d783, 0, 0, 0, g(Yes, No, false, false, "", "τ")},
- {0x1d784, 0, 0, 0, g(Yes, No, false, false, "", "υ")},
- {0x1d785, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d786, 0, 0, 0, g(Yes, No, false, false, "", "χ")},
- {0x1d787, 0, 0, 0, g(Yes, No, false, false, "", "ψ")},
- {0x1d788, 0, 0, 0, g(Yes, No, false, false, "", "ω")},
- {0x1d789, 0, 0, 0, g(Yes, No, false, false, "", "∂")},
- {0x1d78a, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d78b, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d78c, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d78d, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d78e, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d78f, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d790, 0, 0, 0, g(Yes, No, false, false, "", "Α")},
- {0x1d791, 0, 0, 0, g(Yes, No, false, false, "", "Β")},
- {0x1d792, 0, 0, 0, g(Yes, No, false, false, "", "Γ")},
- {0x1d793, 0, 0, 0, g(Yes, No, false, false, "", "Δ")},
- {0x1d794, 0, 0, 0, g(Yes, No, false, false, "", "Ε")},
- {0x1d795, 0, 0, 0, g(Yes, No, false, false, "", "Ζ")},
- {0x1d796, 0, 0, 0, g(Yes, No, false, false, "", "Η")},
- {0x1d797, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d798, 0, 0, 0, g(Yes, No, false, false, "", "Ι")},
- {0x1d799, 0, 0, 0, g(Yes, No, false, false, "", "Κ")},
- {0x1d79a, 0, 0, 0, g(Yes, No, false, false, "", "Λ")},
- {0x1d79b, 0, 0, 0, g(Yes, No, false, false, "", "Μ")},
- {0x1d79c, 0, 0, 0, g(Yes, No, false, false, "", "Ν")},
- {0x1d79d, 0, 0, 0, g(Yes, No, false, false, "", "Ξ")},
- {0x1d79e, 0, 0, 0, g(Yes, No, false, false, "", "Ο")},
- {0x1d79f, 0, 0, 0, g(Yes, No, false, false, "", "Π")},
- {0x1d7a0, 0, 0, 0, g(Yes, No, false, false, "", "Ρ")},
- {0x1d7a1, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d7a2, 0, 0, 0, g(Yes, No, false, false, "", "Σ")},
- {0x1d7a3, 0, 0, 0, g(Yes, No, false, false, "", "Τ")},
- {0x1d7a4, 0, 0, 0, g(Yes, No, false, false, "", "Υ")},
- {0x1d7a5, 0, 0, 0, g(Yes, No, false, false, "", "Φ")},
- {0x1d7a6, 0, 0, 0, g(Yes, No, false, false, "", "Χ")},
- {0x1d7a7, 0, 0, 0, g(Yes, No, false, false, "", "Ψ")},
- {0x1d7a8, 0, 0, 0, g(Yes, No, false, false, "", "Ω")},
- {0x1d7a9, 0, 0, 0, g(Yes, No, false, false, "", "∇")},
- {0x1d7aa, 0, 0, 0, g(Yes, No, false, false, "", "α")},
- {0x1d7ab, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x1d7ac, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x1d7ad, 0, 0, 0, g(Yes, No, false, false, "", "δ")},
- {0x1d7ae, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d7af, 0, 0, 0, g(Yes, No, false, false, "", "ζ")},
- {0x1d7b0, 0, 0, 0, g(Yes, No, false, false, "", "η")},
- {0x1d7b1, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d7b2, 0, 0, 0, g(Yes, No, false, false, "", "ι")},
- {0x1d7b3, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d7b4, 0, 0, 0, g(Yes, No, false, false, "", "λ")},
- {0x1d7b5, 0, 0, 0, g(Yes, No, false, false, "", "μ")},
- {0x1d7b6, 0, 0, 0, g(Yes, No, false, false, "", "ν")},
- {0x1d7b7, 0, 0, 0, g(Yes, No, false, false, "", "ξ")},
- {0x1d7b8, 0, 0, 0, g(Yes, No, false, false, "", "ο")},
- {0x1d7b9, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d7ba, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d7bb, 0, 0, 0, g(Yes, No, false, false, "", "ς")},
- {0x1d7bc, 0, 0, 0, g(Yes, No, false, false, "", "σ")},
- {0x1d7bd, 0, 0, 0, g(Yes, No, false, false, "", "τ")},
- {0x1d7be, 0, 0, 0, g(Yes, No, false, false, "", "υ")},
- {0x1d7bf, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d7c0, 0, 0, 0, g(Yes, No, false, false, "", "χ")},
- {0x1d7c1, 0, 0, 0, g(Yes, No, false, false, "", "ψ")},
- {0x1d7c2, 0, 0, 0, g(Yes, No, false, false, "", "ω")},
- {0x1d7c3, 0, 0, 0, g(Yes, No, false, false, "", "∂")},
- {0x1d7c4, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d7c5, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d7c6, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d7c7, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d7c8, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d7c9, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d7ca, 0, 0, 0, g(Yes, No, false, false, "", "Ϝ")},
- {0x1d7cb, 0, 0, 0, g(Yes, No, false, false, "", "ϝ")},
- {0x1d7cc, 0, 0, 0, f(Yes, false, "")},
- {0x1d7ce, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x1d7cf, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0x1d7d0, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0x1d7d1, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0x1d7d2, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x1d7d3, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x1d7d4, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x1d7d5, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x1d7d6, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x1d7d7, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x1d7d8, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x1d7d9, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0x1d7da, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0x1d7db, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0x1d7dc, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x1d7dd, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x1d7de, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x1d7df, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x1d7e0, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x1d7e1, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x1d7e2, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x1d7e3, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0x1d7e4, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0x1d7e5, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0x1d7e6, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x1d7e7, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x1d7e8, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x1d7e9, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x1d7ea, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x1d7eb, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x1d7ec, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x1d7ed, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0x1d7ee, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0x1d7ef, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0x1d7f0, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x1d7f1, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x1d7f2, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x1d7f3, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x1d7f4, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x1d7f5, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x1d7f6, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x1d7f7, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0x1d7f8, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0x1d7f9, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0x1d7fa, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x1d7fb, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x1d7fc, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x1d7fd, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x1d7fe, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x1d7ff, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x1d800, 0, 0, 0, f(Yes, false, "")},
- {0x1e000, 230, 1, 1, f(Yes, false, "")},
- {0x1e007, 0, 0, 0, f(Yes, false, "")},
- {0x1e008, 230, 1, 1, f(Yes, false, "")},
- {0x1e019, 0, 0, 0, f(Yes, false, "")},
- {0x1e01b, 230, 1, 1, f(Yes, false, "")},
- {0x1e022, 0, 0, 0, f(Yes, false, "")},
- {0x1e023, 230, 1, 1, f(Yes, false, "")},
- {0x1e025, 0, 0, 0, f(Yes, false, "")},
- {0x1e026, 230, 1, 1, f(Yes, false, "")},
- {0x1e02b, 0, 0, 0, f(Yes, false, "")},
- {0x1e8d0, 220, 1, 1, f(Yes, false, "")},
- {0x1e8d7, 0, 0, 0, f(Yes, false, "")},
- {0x1e944, 230, 1, 1, f(Yes, false, "")},
- {0x1e94a, 7, 1, 1, f(Yes, false, "")},
- {0x1e94b, 0, 0, 0, f(Yes, false, "")},
- {0x1ee00, 0, 0, 0, g(Yes, No, false, false, "", "ا")},
- {0x1ee01, 0, 0, 0, g(Yes, No, false, false, "", "ب")},
- {0x1ee02, 0, 0, 0, g(Yes, No, false, false, "", "ج")},
- {0x1ee03, 0, 0, 0, g(Yes, No, false, false, "", "د")},
- {0x1ee04, 0, 0, 0, f(Yes, false, "")},
- {0x1ee05, 0, 0, 0, g(Yes, No, false, false, "", "و")},
- {0x1ee06, 0, 0, 0, g(Yes, No, false, false, "", "ز")},
- {0x1ee07, 0, 0, 0, g(Yes, No, false, false, "", "ح")},
- {0x1ee08, 0, 0, 0, g(Yes, No, false, false, "", "ط")},
- {0x1ee09, 0, 0, 0, g(Yes, No, false, false, "", "ي")},
- {0x1ee0a, 0, 0, 0, g(Yes, No, false, false, "", "ك")},
- {0x1ee0b, 0, 0, 0, g(Yes, No, false, false, "", "ل")},
- {0x1ee0c, 0, 0, 0, g(Yes, No, false, false, "", "م")},
- {0x1ee0d, 0, 0, 0, g(Yes, No, false, false, "", "ن")},
- {0x1ee0e, 0, 0, 0, g(Yes, No, false, false, "", "س")},
- {0x1ee0f, 0, 0, 0, g(Yes, No, false, false, "", "ع")},
- {0x1ee10, 0, 0, 0, g(Yes, No, false, false, "", "ف")},
- {0x1ee11, 0, 0, 0, g(Yes, No, false, false, "", "ص")},
- {0x1ee12, 0, 0, 0, g(Yes, No, false, false, "", "ق")},
- {0x1ee13, 0, 0, 0, g(Yes, No, false, false, "", "ر")},
- {0x1ee14, 0, 0, 0, g(Yes, No, false, false, "", "ش")},
- {0x1ee15, 0, 0, 0, g(Yes, No, false, false, "", "ت")},
- {0x1ee16, 0, 0, 0, g(Yes, No, false, false, "", "ث")},
- {0x1ee17, 0, 0, 0, g(Yes, No, false, false, "", "خ")},
- {0x1ee18, 0, 0, 0, g(Yes, No, false, false, "", "ذ")},
- {0x1ee19, 0, 0, 0, g(Yes, No, false, false, "", "ض")},
- {0x1ee1a, 0, 0, 0, g(Yes, No, false, false, "", "ظ")},
- {0x1ee1b, 0, 0, 0, g(Yes, No, false, false, "", "غ")},
- {0x1ee1c, 0, 0, 0, g(Yes, No, false, false, "", "ٮ")},
- {0x1ee1d, 0, 0, 0, g(Yes, No, false, false, "", "ں")},
- {0x1ee1e, 0, 0, 0, g(Yes, No, false, false, "", "ڡ")},
- {0x1ee1f, 0, 0, 0, g(Yes, No, false, false, "", "ٯ")},
- {0x1ee20, 0, 0, 0, f(Yes, false, "")},
- {0x1ee21, 0, 0, 0, g(Yes, No, false, false, "", "ب")},
- {0x1ee22, 0, 0, 0, g(Yes, No, false, false, "", "ج")},
- {0x1ee23, 0, 0, 0, f(Yes, false, "")},
- {0x1ee24, 0, 0, 0, g(Yes, No, false, false, "", "ه")},
- {0x1ee25, 0, 0, 0, f(Yes, false, "")},
- {0x1ee27, 0, 0, 0, g(Yes, No, false, false, "", "ح")},
- {0x1ee28, 0, 0, 0, f(Yes, false, "")},
- {0x1ee29, 0, 0, 0, g(Yes, No, false, false, "", "ي")},
- {0x1ee2a, 0, 0, 0, g(Yes, No, false, false, "", "ك")},
- {0x1ee2b, 0, 0, 0, g(Yes, No, false, false, "", "ل")},
- {0x1ee2c, 0, 0, 0, g(Yes, No, false, false, "", "م")},
- {0x1ee2d, 0, 0, 0, g(Yes, No, false, false, "", "ن")},
- {0x1ee2e, 0, 0, 0, g(Yes, No, false, false, "", "س")},
- {0x1ee2f, 0, 0, 0, g(Yes, No, false, false, "", "ع")},
- {0x1ee30, 0, 0, 0, g(Yes, No, false, false, "", "ف")},
- {0x1ee31, 0, 0, 0, g(Yes, No, false, false, "", "ص")},
- {0x1ee32, 0, 0, 0, g(Yes, No, false, false, "", "ق")},
- {0x1ee33, 0, 0, 0, f(Yes, false, "")},
- {0x1ee34, 0, 0, 0, g(Yes, No, false, false, "", "ش")},
- {0x1ee35, 0, 0, 0, g(Yes, No, false, false, "", "ت")},
- {0x1ee36, 0, 0, 0, g(Yes, No, false, false, "", "ث")},
- {0x1ee37, 0, 0, 0, g(Yes, No, false, false, "", "خ")},
- {0x1ee38, 0, 0, 0, f(Yes, false, "")},
- {0x1ee39, 0, 0, 0, g(Yes, No, false, false, "", "ض")},
- {0x1ee3a, 0, 0, 0, f(Yes, false, "")},
- {0x1ee3b, 0, 0, 0, g(Yes, No, false, false, "", "غ")},
- {0x1ee3c, 0, 0, 0, f(Yes, false, "")},
- {0x1ee42, 0, 0, 0, g(Yes, No, false, false, "", "ج")},
- {0x1ee43, 0, 0, 0, f(Yes, false, "")},
- {0x1ee47, 0, 0, 0, g(Yes, No, false, false, "", "ح")},
- {0x1ee48, 0, 0, 0, f(Yes, false, "")},
- {0x1ee49, 0, 0, 0, g(Yes, No, false, false, "", "ي")},
- {0x1ee4a, 0, 0, 0, f(Yes, false, "")},
- {0x1ee4b, 0, 0, 0, g(Yes, No, false, false, "", "ل")},
- {0x1ee4c, 0, 0, 0, f(Yes, false, "")},
- {0x1ee4d, 0, 0, 0, g(Yes, No, false, false, "", "ن")},
- {0x1ee4e, 0, 0, 0, g(Yes, No, false, false, "", "س")},
- {0x1ee4f, 0, 0, 0, g(Yes, No, false, false, "", "ع")},
- {0x1ee50, 0, 0, 0, f(Yes, false, "")},
- {0x1ee51, 0, 0, 0, g(Yes, No, false, false, "", "ص")},
- {0x1ee52, 0, 0, 0, g(Yes, No, false, false, "", "ق")},
- {0x1ee53, 0, 0, 0, f(Yes, false, "")},
- {0x1ee54, 0, 0, 0, g(Yes, No, false, false, "", "ش")},
- {0x1ee55, 0, 0, 0, f(Yes, false, "")},
- {0x1ee57, 0, 0, 0, g(Yes, No, false, false, "", "خ")},
- {0x1ee58, 0, 0, 0, f(Yes, false, "")},
- {0x1ee59, 0, 0, 0, g(Yes, No, false, false, "", "ض")},
- {0x1ee5a, 0, 0, 0, f(Yes, false, "")},
- {0x1ee5b, 0, 0, 0, g(Yes, No, false, false, "", "غ")},
- {0x1ee5c, 0, 0, 0, f(Yes, false, "")},
- {0x1ee5d, 0, 0, 0, g(Yes, No, false, false, "", "ں")},
- {0x1ee5e, 0, 0, 0, f(Yes, false, "")},
- {0x1ee5f, 0, 0, 0, g(Yes, No, false, false, "", "ٯ")},
- {0x1ee60, 0, 0, 0, f(Yes, false, "")},
- {0x1ee61, 0, 0, 0, g(Yes, No, false, false, "", "ب")},
- {0x1ee62, 0, 0, 0, g(Yes, No, false, false, "", "ج")},
- {0x1ee63, 0, 0, 0, f(Yes, false, "")},
- {0x1ee64, 0, 0, 0, g(Yes, No, false, false, "", "ه")},
- {0x1ee65, 0, 0, 0, f(Yes, false, "")},
- {0x1ee67, 0, 0, 0, g(Yes, No, false, false, "", "ح")},
- {0x1ee68, 0, 0, 0, g(Yes, No, false, false, "", "ط")},
- {0x1ee69, 0, 0, 0, g(Yes, No, false, false, "", "ي")},
- {0x1ee6a, 0, 0, 0, g(Yes, No, false, false, "", "ك")},
- {0x1ee6b, 0, 0, 0, f(Yes, false, "")},
- {0x1ee6c, 0, 0, 0, g(Yes, No, false, false, "", "م")},
- {0x1ee6d, 0, 0, 0, g(Yes, No, false, false, "", "ن")},
- {0x1ee6e, 0, 0, 0, g(Yes, No, false, false, "", "س")},
- {0x1ee6f, 0, 0, 0, g(Yes, No, false, false, "", "ع")},
- {0x1ee70, 0, 0, 0, g(Yes, No, false, false, "", "ف")},
- {0x1ee71, 0, 0, 0, g(Yes, No, false, false, "", "ص")},
- {0x1ee72, 0, 0, 0, g(Yes, No, false, false, "", "ق")},
- {0x1ee73, 0, 0, 0, f(Yes, false, "")},
- {0x1ee74, 0, 0, 0, g(Yes, No, false, false, "", "ش")},
- {0x1ee75, 0, 0, 0, g(Yes, No, false, false, "", "ت")},
- {0x1ee76, 0, 0, 0, g(Yes, No, false, false, "", "ث")},
- {0x1ee77, 0, 0, 0, g(Yes, No, false, false, "", "خ")},
- {0x1ee78, 0, 0, 0, f(Yes, false, "")},
- {0x1ee79, 0, 0, 0, g(Yes, No, false, false, "", "ض")},
- {0x1ee7a, 0, 0, 0, g(Yes, No, false, false, "", "ظ")},
- {0x1ee7b, 0, 0, 0, g(Yes, No, false, false, "", "غ")},
- {0x1ee7c, 0, 0, 0, g(Yes, No, false, false, "", "ٮ")},
- {0x1ee7d, 0, 0, 0, f(Yes, false, "")},
- {0x1ee7e, 0, 0, 0, g(Yes, No, false, false, "", "ڡ")},
- {0x1ee7f, 0, 0, 0, f(Yes, false, "")},
- {0x1ee80, 0, 0, 0, g(Yes, No, false, false, "", "ا")},
- {0x1ee81, 0, 0, 0, g(Yes, No, false, false, "", "ب")},
- {0x1ee82, 0, 0, 0, g(Yes, No, false, false, "", "ج")},
- {0x1ee83, 0, 0, 0, g(Yes, No, false, false, "", "د")},
- {0x1ee84, 0, 0, 0, g(Yes, No, false, false, "", "ه")},
- {0x1ee85, 0, 0, 0, g(Yes, No, false, false, "", "و")},
- {0x1ee86, 0, 0, 0, g(Yes, No, false, false, "", "ز")},
- {0x1ee87, 0, 0, 0, g(Yes, No, false, false, "", "ح")},
- {0x1ee88, 0, 0, 0, g(Yes, No, false, false, "", "ط")},
- {0x1ee89, 0, 0, 0, g(Yes, No, false, false, "", "ي")},
- {0x1ee8a, 0, 0, 0, f(Yes, false, "")},
- {0x1ee8b, 0, 0, 0, g(Yes, No, false, false, "", "ل")},
- {0x1ee8c, 0, 0, 0, g(Yes, No, false, false, "", "م")},
- {0x1ee8d, 0, 0, 0, g(Yes, No, false, false, "", "ن")},
- {0x1ee8e, 0, 0, 0, g(Yes, No, false, false, "", "س")},
- {0x1ee8f, 0, 0, 0, g(Yes, No, false, false, "", "ع")},
- {0x1ee90, 0, 0, 0, g(Yes, No, false, false, "", "ف")},
- {0x1ee91, 0, 0, 0, g(Yes, No, false, false, "", "ص")},
- {0x1ee92, 0, 0, 0, g(Yes, No, false, false, "", "ق")},
- {0x1ee93, 0, 0, 0, g(Yes, No, false, false, "", "ر")},
- {0x1ee94, 0, 0, 0, g(Yes, No, false, false, "", "ش")},
- {0x1ee95, 0, 0, 0, g(Yes, No, false, false, "", "ت")},
- {0x1ee96, 0, 0, 0, g(Yes, No, false, false, "", "ث")},
- {0x1ee97, 0, 0, 0, g(Yes, No, false, false, "", "خ")},
- {0x1ee98, 0, 0, 0, g(Yes, No, false, false, "", "ذ")},
- {0x1ee99, 0, 0, 0, g(Yes, No, false, false, "", "ض")},
- {0x1ee9a, 0, 0, 0, g(Yes, No, false, false, "", "ظ")},
- {0x1ee9b, 0, 0, 0, g(Yes, No, false, false, "", "غ")},
- {0x1ee9c, 0, 0, 0, f(Yes, false, "")},
- {0x1eea1, 0, 0, 0, g(Yes, No, false, false, "", "ب")},
- {0x1eea2, 0, 0, 0, g(Yes, No, false, false, "", "ج")},
- {0x1eea3, 0, 0, 0, g(Yes, No, false, false, "", "د")},
- {0x1eea4, 0, 0, 0, f(Yes, false, "")},
- {0x1eea5, 0, 0, 0, g(Yes, No, false, false, "", "و")},
- {0x1eea6, 0, 0, 0, g(Yes, No, false, false, "", "ز")},
- {0x1eea7, 0, 0, 0, g(Yes, No, false, false, "", "ح")},
- {0x1eea8, 0, 0, 0, g(Yes, No, false, false, "", "ط")},
- {0x1eea9, 0, 0, 0, g(Yes, No, false, false, "", "ي")},
- {0x1eeaa, 0, 0, 0, f(Yes, false, "")},
- {0x1eeab, 0, 0, 0, g(Yes, No, false, false, "", "ل")},
- {0x1eeac, 0, 0, 0, g(Yes, No, false, false, "", "م")},
- {0x1eead, 0, 0, 0, g(Yes, No, false, false, "", "ن")},
- {0x1eeae, 0, 0, 0, g(Yes, No, false, false, "", "س")},
- {0x1eeaf, 0, 0, 0, g(Yes, No, false, false, "", "ع")},
- {0x1eeb0, 0, 0, 0, g(Yes, No, false, false, "", "ف")},
- {0x1eeb1, 0, 0, 0, g(Yes, No, false, false, "", "ص")},
- {0x1eeb2, 0, 0, 0, g(Yes, No, false, false, "", "ق")},
- {0x1eeb3, 0, 0, 0, g(Yes, No, false, false, "", "ر")},
- {0x1eeb4, 0, 0, 0, g(Yes, No, false, false, "", "ش")},
- {0x1eeb5, 0, 0, 0, g(Yes, No, false, false, "", "ت")},
- {0x1eeb6, 0, 0, 0, g(Yes, No, false, false, "", "ث")},
- {0x1eeb7, 0, 0, 0, g(Yes, No, false, false, "", "خ")},
- {0x1eeb8, 0, 0, 0, g(Yes, No, false, false, "", "ذ")},
- {0x1eeb9, 0, 0, 0, g(Yes, No, false, false, "", "ض")},
- {0x1eeba, 0, 0, 0, g(Yes, No, false, false, "", "ظ")},
- {0x1eebb, 0, 0, 0, g(Yes, No, false, false, "", "غ")},
- {0x1eebc, 0, 0, 0, f(Yes, false, "")},
- {0x1f100, 0, 0, 0, g(Yes, No, false, false, "", "0.")},
- {0x1f101, 0, 0, 0, g(Yes, No, false, false, "", "0,")},
- {0x1f102, 0, 0, 0, g(Yes, No, false, false, "", "1,")},
- {0x1f103, 0, 0, 0, g(Yes, No, false, false, "", "2,")},
- {0x1f104, 0, 0, 0, g(Yes, No, false, false, "", "3,")},
- {0x1f105, 0, 0, 0, g(Yes, No, false, false, "", "4,")},
- {0x1f106, 0, 0, 0, g(Yes, No, false, false, "", "5,")},
- {0x1f107, 0, 0, 0, g(Yes, No, false, false, "", "6,")},
- {0x1f108, 0, 0, 0, g(Yes, No, false, false, "", "7,")},
- {0x1f109, 0, 0, 0, g(Yes, No, false, false, "", "8,")},
- {0x1f10a, 0, 0, 0, g(Yes, No, false, false, "", "9,")},
- {0x1f10b, 0, 0, 0, f(Yes, false, "")},
- {0x1f110, 0, 0, 0, g(Yes, No, false, false, "", "(A)")},
- {0x1f111, 0, 0, 0, g(Yes, No, false, false, "", "(B)")},
- {0x1f112, 0, 0, 0, g(Yes, No, false, false, "", "(C)")},
- {0x1f113, 0, 0, 0, g(Yes, No, false, false, "", "(D)")},
- {0x1f114, 0, 0, 0, g(Yes, No, false, false, "", "(E)")},
- {0x1f115, 0, 0, 0, g(Yes, No, false, false, "", "(F)")},
- {0x1f116, 0, 0, 0, g(Yes, No, false, false, "", "(G)")},
- {0x1f117, 0, 0, 0, g(Yes, No, false, false, "", "(H)")},
- {0x1f118, 0, 0, 0, g(Yes, No, false, false, "", "(I)")},
- {0x1f119, 0, 0, 0, g(Yes, No, false, false, "", "(J)")},
- {0x1f11a, 0, 0, 0, g(Yes, No, false, false, "", "(K)")},
- {0x1f11b, 0, 0, 0, g(Yes, No, false, false, "", "(L)")},
- {0x1f11c, 0, 0, 0, g(Yes, No, false, false, "", "(M)")},
- {0x1f11d, 0, 0, 0, g(Yes, No, false, false, "", "(N)")},
- {0x1f11e, 0, 0, 0, g(Yes, No, false, false, "", "(O)")},
- {0x1f11f, 0, 0, 0, g(Yes, No, false, false, "", "(P)")},
- {0x1f120, 0, 0, 0, g(Yes, No, false, false, "", "(Q)")},
- {0x1f121, 0, 0, 0, g(Yes, No, false, false, "", "(R)")},
- {0x1f122, 0, 0, 0, g(Yes, No, false, false, "", "(S)")},
- {0x1f123, 0, 0, 0, g(Yes, No, false, false, "", "(T)")},
- {0x1f124, 0, 0, 0, g(Yes, No, false, false, "", "(U)")},
- {0x1f125, 0, 0, 0, g(Yes, No, false, false, "", "(V)")},
- {0x1f126, 0, 0, 0, g(Yes, No, false, false, "", "(W)")},
- {0x1f127, 0, 0, 0, g(Yes, No, false, false, "", "(X)")},
- {0x1f128, 0, 0, 0, g(Yes, No, false, false, "", "(Y)")},
- {0x1f129, 0, 0, 0, g(Yes, No, false, false, "", "(Z)")},
- {0x1f12a, 0, 0, 0, g(Yes, No, false, false, "", "〔S〕")},
- {0x1f12b, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1f12c, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1f12d, 0, 0, 0, g(Yes, No, false, false, "", "CD")},
- {0x1f12e, 0, 0, 0, g(Yes, No, false, false, "", "WZ")},
- {0x1f12f, 0, 0, 0, f(Yes, false, "")},
- {0x1f130, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1f131, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1f132, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1f133, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1f134, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1f135, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1f136, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1f137, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1f138, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1f139, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1f13a, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1f13b, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1f13c, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1f13d, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1f13e, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1f13f, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1f140, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1f141, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1f142, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1f143, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1f144, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1f145, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1f146, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1f147, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1f148, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1f149, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1f14a, 0, 0, 0, g(Yes, No, false, false, "", "HV")},
- {0x1f14b, 0, 0, 0, g(Yes, No, false, false, "", "MV")},
- {0x1f14c, 0, 0, 0, g(Yes, No, false, false, "", "SD")},
- {0x1f14d, 0, 0, 0, g(Yes, No, false, false, "", "SS")},
- {0x1f14e, 0, 0, 0, g(Yes, No, false, false, "", "PPV")},
- {0x1f14f, 0, 0, 0, g(Yes, No, false, false, "", "WC")},
- {0x1f150, 0, 0, 0, f(Yes, false, "")},
- {0x1f16a, 0, 0, 0, g(Yes, No, false, false, "", "MC")},
- {0x1f16b, 0, 0, 0, g(Yes, No, false, false, "", "MD")},
- {0x1f16c, 0, 0, 0, f(Yes, false, "")},
- {0x1f190, 0, 0, 0, g(Yes, No, false, false, "", "DJ")},
- {0x1f191, 0, 0, 0, f(Yes, false, "")},
- {0x1f200, 0, 0, 0, g(Yes, No, false, false, "", "ほか")},
- {0x1f201, 0, 0, 0, g(Yes, No, false, false, "", "ココ")},
- {0x1f202, 0, 0, 0, g(Yes, No, false, false, "", "サ")},
- {0x1f203, 0, 0, 0, f(Yes, false, "")},
- {0x1f210, 0, 0, 0, g(Yes, No, false, false, "", "手")},
- {0x1f211, 0, 0, 0, g(Yes, No, false, false, "", "字")},
- {0x1f212, 0, 0, 0, g(Yes, No, false, false, "", "双")},
- {0x1f213, 0, 0, 1, g(Yes, No, false, false, "", "デ")},
- {0x1f214, 0, 0, 0, g(Yes, No, false, false, "", "二")},
- {0x1f215, 0, 0, 0, g(Yes, No, false, false, "", "多")},
- {0x1f216, 0, 0, 0, g(Yes, No, false, false, "", "解")},
- {0x1f217, 0, 0, 0, g(Yes, No, false, false, "", "天")},
- {0x1f218, 0, 0, 0, g(Yes, No, false, false, "", "交")},
- {0x1f219, 0, 0, 0, g(Yes, No, false, false, "", "映")},
- {0x1f21a, 0, 0, 0, g(Yes, No, false, false, "", "無")},
- {0x1f21b, 0, 0, 0, g(Yes, No, false, false, "", "料")},
- {0x1f21c, 0, 0, 0, g(Yes, No, false, false, "", "前")},
- {0x1f21d, 0, 0, 0, g(Yes, No, false, false, "", "後")},
- {0x1f21e, 0, 0, 0, g(Yes, No, false, false, "", "再")},
- {0x1f21f, 0, 0, 0, g(Yes, No, false, false, "", "新")},
- {0x1f220, 0, 0, 0, g(Yes, No, false, false, "", "初")},
- {0x1f221, 0, 0, 0, g(Yes, No, false, false, "", "終")},
- {0x1f222, 0, 0, 0, g(Yes, No, false, false, "", "生")},
- {0x1f223, 0, 0, 0, g(Yes, No, false, false, "", "販")},
- {0x1f224, 0, 0, 0, g(Yes, No, false, false, "", "声")},
- {0x1f225, 0, 0, 0, g(Yes, No, false, false, "", "吹")},
- {0x1f226, 0, 0, 0, g(Yes, No, false, false, "", "演")},
- {0x1f227, 0, 0, 0, g(Yes, No, false, false, "", "投")},
- {0x1f228, 0, 0, 0, g(Yes, No, false, false, "", "捕")},
- {0x1f229, 0, 0, 0, g(Yes, No, false, false, "", "一")},
- {0x1f22a, 0, 0, 0, g(Yes, No, false, false, "", "三")},
- {0x1f22b, 0, 0, 0, g(Yes, No, false, false, "", "遊")},
- {0x1f22c, 0, 0, 0, g(Yes, No, false, false, "", "左")},
- {0x1f22d, 0, 0, 0, g(Yes, No, false, false, "", "中")},
- {0x1f22e, 0, 0, 0, g(Yes, No, false, false, "", "右")},
- {0x1f22f, 0, 0, 0, g(Yes, No, false, false, "", "指")},
- {0x1f230, 0, 0, 0, g(Yes, No, false, false, "", "走")},
- {0x1f231, 0, 0, 0, g(Yes, No, false, false, "", "打")},
- {0x1f232, 0, 0, 0, g(Yes, No, false, false, "", "禁")},
- {0x1f233, 0, 0, 0, g(Yes, No, false, false, "", "空")},
- {0x1f234, 0, 0, 0, g(Yes, No, false, false, "", "合")},
- {0x1f235, 0, 0, 0, g(Yes, No, false, false, "", "満")},
- {0x1f236, 0, 0, 0, g(Yes, No, false, false, "", "有")},
- {0x1f237, 0, 0, 0, g(Yes, No, false, false, "", "月")},
- {0x1f238, 0, 0, 0, g(Yes, No, false, false, "", "申")},
- {0x1f239, 0, 0, 0, g(Yes, No, false, false, "", "割")},
- {0x1f23a, 0, 0, 0, g(Yes, No, false, false, "", "営")},
- {0x1f23b, 0, 0, 0, g(Yes, No, false, false, "", "配")},
- {0x1f23c, 0, 0, 0, f(Yes, false, "")},
- {0x1f240, 0, 0, 0, g(Yes, No, false, false, "", "〔本〕")},
- {0x1f241, 0, 0, 0, g(Yes, No, false, false, "", "〔三〕")},
- {0x1f242, 0, 0, 0, g(Yes, No, false, false, "", "〔二〕")},
- {0x1f243, 0, 0, 0, g(Yes, No, false, false, "", "〔安〕")},
- {0x1f244, 0, 0, 0, g(Yes, No, false, false, "", "〔点〕")},
- {0x1f245, 0, 0, 0, g(Yes, No, false, false, "", "〔打〕")},
- {0x1f246, 0, 0, 0, g(Yes, No, false, false, "", "〔盗〕")},
- {0x1f247, 0, 0, 0, g(Yes, No, false, false, "", "〔勝〕")},
- {0x1f248, 0, 0, 0, g(Yes, No, false, false, "", "〔敗〕")},
- {0x1f249, 0, 0, 0, f(Yes, false, "")},
- {0x1f250, 0, 0, 0, g(Yes, No, false, false, "", "得")},
- {0x1f251, 0, 0, 0, g(Yes, No, false, false, "", "可")},
- {0x1f252, 0, 0, 0, f(Yes, false, "")},
- {0x2f800, 0, 0, 0, f(No, false, "丽")},
- {0x2f801, 0, 0, 0, f(No, false, "丸")},
- {0x2f802, 0, 0, 0, f(No, false, "乁")},
- {0x2f803, 0, 0, 0, f(No, false, "𠄢")},
- {0x2f804, 0, 0, 0, f(No, false, "你")},
- {0x2f805, 0, 0, 0, f(No, false, "侮")},
- {0x2f806, 0, 0, 0, f(No, false, "侻")},
- {0x2f807, 0, 0, 0, f(No, false, "倂")},
- {0x2f808, 0, 0, 0, f(No, false, "偺")},
- {0x2f809, 0, 0, 0, f(No, false, "備")},
- {0x2f80a, 0, 0, 0, f(No, false, "僧")},
- {0x2f80b, 0, 0, 0, f(No, false, "像")},
- {0x2f80c, 0, 0, 0, f(No, false, "㒞")},
- {0x2f80d, 0, 0, 0, f(No, false, "𠘺")},
- {0x2f80e, 0, 0, 0, f(No, false, "免")},
- {0x2f80f, 0, 0, 0, f(No, false, "兔")},
- {0x2f810, 0, 0, 0, f(No, false, "兤")},
- {0x2f811, 0, 0, 0, f(No, false, "具")},
- {0x2f812, 0, 0, 0, f(No, false, "𠔜")},
- {0x2f813, 0, 0, 0, f(No, false, "㒹")},
- {0x2f814, 0, 0, 0, f(No, false, "內")},
- {0x2f815, 0, 0, 0, f(No, false, "再")},
- {0x2f816, 0, 0, 0, f(No, false, "𠕋")},
- {0x2f817, 0, 0, 0, f(No, false, "冗")},
- {0x2f818, 0, 0, 0, f(No, false, "冤")},
- {0x2f819, 0, 0, 0, f(No, false, "仌")},
- {0x2f81a, 0, 0, 0, f(No, false, "冬")},
- {0x2f81b, 0, 0, 0, f(No, false, "况")},
- {0x2f81c, 0, 0, 0, f(No, false, "𩇟")},
- {0x2f81d, 0, 0, 0, f(No, false, "凵")},
- {0x2f81e, 0, 0, 0, f(No, false, "刃")},
- {0x2f81f, 0, 0, 0, f(No, false, "㓟")},
- {0x2f820, 0, 0, 0, f(No, false, "刻")},
- {0x2f821, 0, 0, 0, f(No, false, "剆")},
- {0x2f822, 0, 0, 0, f(No, false, "割")},
- {0x2f823, 0, 0, 0, f(No, false, "剷")},
- {0x2f824, 0, 0, 0, f(No, false, "㔕")},
- {0x2f825, 0, 0, 0, f(No, false, "勇")},
- {0x2f826, 0, 0, 0, f(No, false, "勉")},
- {0x2f827, 0, 0, 0, f(No, false, "勤")},
- {0x2f828, 0, 0, 0, f(No, false, "勺")},
- {0x2f829, 0, 0, 0, f(No, false, "包")},
- {0x2f82a, 0, 0, 0, f(No, false, "匆")},
- {0x2f82b, 0, 0, 0, f(No, false, "北")},
- {0x2f82c, 0, 0, 0, f(No, false, "卉")},
- {0x2f82d, 0, 0, 0, f(No, false, "卑")},
- {0x2f82e, 0, 0, 0, f(No, false, "博")},
- {0x2f82f, 0, 0, 0, f(No, false, "即")},
- {0x2f830, 0, 0, 0, f(No, false, "卽")},
- {0x2f831, 0, 0, 0, f(No, false, "卿")},
- {0x2f834, 0, 0, 0, f(No, false, "𠨬")},
- {0x2f835, 0, 0, 0, f(No, false, "灰")},
- {0x2f836, 0, 0, 0, f(No, false, "及")},
- {0x2f837, 0, 0, 0, f(No, false, "叟")},
- {0x2f838, 0, 0, 0, f(No, false, "𠭣")},
- {0x2f839, 0, 0, 0, f(No, false, "叫")},
- {0x2f83a, 0, 0, 0, f(No, false, "叱")},
- {0x2f83b, 0, 0, 0, f(No, false, "吆")},
- {0x2f83c, 0, 0, 0, f(No, false, "咞")},
- {0x2f83d, 0, 0, 0, f(No, false, "吸")},
- {0x2f83e, 0, 0, 0, f(No, false, "呈")},
- {0x2f83f, 0, 0, 0, f(No, false, "周")},
- {0x2f840, 0, 0, 0, f(No, false, "咢")},
- {0x2f841, 0, 0, 0, f(No, false, "哶")},
- {0x2f842, 0, 0, 0, f(No, false, "唐")},
- {0x2f843, 0, 0, 0, f(No, false, "啓")},
- {0x2f844, 0, 0, 0, f(No, false, "啣")},
- {0x2f845, 0, 0, 0, f(No, false, "善")},
- {0x2f847, 0, 0, 0, f(No, false, "喙")},
- {0x2f848, 0, 0, 0, f(No, false, "喫")},
- {0x2f849, 0, 0, 0, f(No, false, "喳")},
- {0x2f84a, 0, 0, 0, f(No, false, "嗂")},
- {0x2f84b, 0, 0, 0, f(No, false, "圖")},
- {0x2f84c, 0, 0, 0, f(No, false, "嘆")},
- {0x2f84d, 0, 0, 0, f(No, false, "圗")},
- {0x2f84e, 0, 0, 0, f(No, false, "噑")},
- {0x2f84f, 0, 0, 0, f(No, false, "噴")},
- {0x2f850, 0, 0, 0, f(No, false, "切")},
- {0x2f851, 0, 0, 0, f(No, false, "壮")},
- {0x2f852, 0, 0, 0, f(No, false, "城")},
- {0x2f853, 0, 0, 0, f(No, false, "埴")},
- {0x2f854, 0, 0, 0, f(No, false, "堍")},
- {0x2f855, 0, 0, 0, f(No, false, "型")},
- {0x2f856, 0, 0, 0, f(No, false, "堲")},
- {0x2f857, 0, 0, 0, f(No, false, "報")},
- {0x2f858, 0, 0, 0, f(No, false, "墬")},
- {0x2f859, 0, 0, 0, f(No, false, "𡓤")},
- {0x2f85a, 0, 0, 0, f(No, false, "売")},
- {0x2f85b, 0, 0, 0, f(No, false, "壷")},
- {0x2f85c, 0, 0, 0, f(No, false, "夆")},
- {0x2f85d, 0, 0, 0, f(No, false, "多")},
- {0x2f85e, 0, 0, 0, f(No, false, "夢")},
- {0x2f85f, 0, 0, 0, f(No, false, "奢")},
- {0x2f860, 0, 0, 0, f(No, false, "𡚨")},
- {0x2f861, 0, 0, 0, f(No, false, "𡛪")},
- {0x2f862, 0, 0, 0, f(No, false, "姬")},
- {0x2f863, 0, 0, 0, f(No, false, "娛")},
- {0x2f864, 0, 0, 0, f(No, false, "娧")},
- {0x2f865, 0, 0, 0, f(No, false, "姘")},
- {0x2f866, 0, 0, 0, f(No, false, "婦")},
- {0x2f867, 0, 0, 0, f(No, false, "㛮")},
- {0x2f868, 0, 0, 0, f(No, false, "㛼")},
- {0x2f869, 0, 0, 0, f(No, false, "嬈")},
- {0x2f86a, 0, 0, 0, f(No, false, "嬾")},
- {0x2f86c, 0, 0, 0, f(No, false, "𡧈")},
- {0x2f86d, 0, 0, 0, f(No, false, "寃")},
- {0x2f86e, 0, 0, 0, f(No, false, "寘")},
- {0x2f86f, 0, 0, 0, f(No, false, "寧")},
- {0x2f870, 0, 0, 0, f(No, false, "寳")},
- {0x2f871, 0, 0, 0, f(No, false, "𡬘")},
- {0x2f872, 0, 0, 0, f(No, false, "寿")},
- {0x2f873, 0, 0, 0, f(No, false, "将")},
- {0x2f874, 0, 0, 0, f(No, false, "当")},
- {0x2f875, 0, 0, 0, f(No, false, "尢")},
- {0x2f876, 0, 0, 0, f(No, false, "㞁")},
- {0x2f877, 0, 0, 0, f(No, false, "屠")},
- {0x2f878, 0, 0, 0, f(No, false, "屮")},
- {0x2f879, 0, 0, 0, f(No, false, "峀")},
- {0x2f87a, 0, 0, 0, f(No, false, "岍")},
- {0x2f87b, 0, 0, 0, f(No, false, "𡷤")},
- {0x2f87c, 0, 0, 0, f(No, false, "嵃")},
- {0x2f87d, 0, 0, 0, f(No, false, "𡷦")},
- {0x2f87e, 0, 0, 0, f(No, false, "嵮")},
- {0x2f87f, 0, 0, 0, f(No, false, "嵫")},
- {0x2f880, 0, 0, 0, f(No, false, "嵼")},
- {0x2f881, 0, 0, 0, f(No, false, "巡")},
- {0x2f882, 0, 0, 0, f(No, false, "巢")},
- {0x2f883, 0, 0, 0, f(No, false, "㠯")},
- {0x2f884, 0, 0, 0, f(No, false, "巽")},
- {0x2f885, 0, 0, 0, f(No, false, "帨")},
- {0x2f886, 0, 0, 0, f(No, false, "帽")},
- {0x2f887, 0, 0, 0, f(No, false, "幩")},
- {0x2f888, 0, 0, 0, f(No, false, "㡢")},
- {0x2f889, 0, 0, 0, f(No, false, "𢆃")},
- {0x2f88a, 0, 0, 0, f(No, false, "㡼")},
- {0x2f88b, 0, 0, 0, f(No, false, "庰")},
- {0x2f88c, 0, 0, 0, f(No, false, "庳")},
- {0x2f88d, 0, 0, 0, f(No, false, "庶")},
- {0x2f88e, 0, 0, 0, f(No, false, "廊")},
- {0x2f88f, 0, 0, 0, f(No, false, "𪎒")},
- {0x2f890, 0, 0, 0, f(No, false, "廾")},
- {0x2f891, 0, 0, 0, f(No, false, "𢌱")},
- {0x2f893, 0, 0, 0, f(No, false, "舁")},
- {0x2f894, 0, 0, 0, f(No, false, "弢")},
- {0x2f896, 0, 0, 0, f(No, false, "㣇")},
- {0x2f897, 0, 0, 0, f(No, false, "𣊸")},
- {0x2f898, 0, 0, 0, f(No, false, "𦇚")},
- {0x2f899, 0, 0, 0, f(No, false, "形")},
- {0x2f89a, 0, 0, 0, f(No, false, "彫")},
- {0x2f89b, 0, 0, 0, f(No, false, "㣣")},
- {0x2f89c, 0, 0, 0, f(No, false, "徚")},
- {0x2f89d, 0, 0, 0, f(No, false, "忍")},
- {0x2f89e, 0, 0, 0, f(No, false, "志")},
- {0x2f89f, 0, 0, 0, f(No, false, "忹")},
- {0x2f8a0, 0, 0, 0, f(No, false, "悁")},
- {0x2f8a1, 0, 0, 0, f(No, false, "㤺")},
- {0x2f8a2, 0, 0, 0, f(No, false, "㤜")},
- {0x2f8a3, 0, 0, 0, f(No, false, "悔")},
- {0x2f8a4, 0, 0, 0, f(No, false, "𢛔")},
- {0x2f8a5, 0, 0, 0, f(No, false, "惇")},
- {0x2f8a6, 0, 0, 0, f(No, false, "慈")},
- {0x2f8a7, 0, 0, 0, f(No, false, "慌")},
- {0x2f8a8, 0, 0, 0, f(No, false, "慎")},
- {0x2f8a9, 0, 0, 0, f(No, false, "慌")},
- {0x2f8aa, 0, 0, 0, f(No, false, "慺")},
- {0x2f8ab, 0, 0, 0, f(No, false, "憎")},
- {0x2f8ac, 0, 0, 0, f(No, false, "憲")},
- {0x2f8ad, 0, 0, 0, f(No, false, "憤")},
- {0x2f8ae, 0, 0, 0, f(No, false, "憯")},
- {0x2f8af, 0, 0, 0, f(No, false, "懞")},
- {0x2f8b0, 0, 0, 0, f(No, false, "懲")},
- {0x2f8b1, 0, 0, 0, f(No, false, "懶")},
- {0x2f8b2, 0, 0, 0, f(No, false, "成")},
- {0x2f8b3, 0, 0, 0, f(No, false, "戛")},
- {0x2f8b4, 0, 0, 0, f(No, false, "扝")},
- {0x2f8b5, 0, 0, 0, f(No, false, "抱")},
- {0x2f8b6, 0, 0, 0, f(No, false, "拔")},
- {0x2f8b7, 0, 0, 0, f(No, false, "捐")},
- {0x2f8b8, 0, 0, 0, f(No, false, "𢬌")},
- {0x2f8b9, 0, 0, 0, f(No, false, "挽")},
- {0x2f8ba, 0, 0, 0, f(No, false, "拼")},
- {0x2f8bb, 0, 0, 0, f(No, false, "捨")},
- {0x2f8bc, 0, 0, 0, f(No, false, "掃")},
- {0x2f8bd, 0, 0, 0, f(No, false, "揤")},
- {0x2f8be, 0, 0, 0, f(No, false, "𢯱")},
- {0x2f8bf, 0, 0, 0, f(No, false, "搢")},
- {0x2f8c0, 0, 0, 0, f(No, false, "揅")},
- {0x2f8c1, 0, 0, 0, f(No, false, "掩")},
- {0x2f8c2, 0, 0, 0, f(No, false, "㨮")},
- {0x2f8c3, 0, 0, 0, f(No, false, "摩")},
- {0x2f8c4, 0, 0, 0, f(No, false, "摾")},
- {0x2f8c5, 0, 0, 0, f(No, false, "撝")},
- {0x2f8c6, 0, 0, 0, f(No, false, "摷")},
- {0x2f8c7, 0, 0, 0, f(No, false, "㩬")},
- {0x2f8c8, 0, 0, 0, f(No, false, "敏")},
- {0x2f8c9, 0, 0, 0, f(No, false, "敬")},
- {0x2f8ca, 0, 0, 0, f(No, false, "𣀊")},
- {0x2f8cb, 0, 0, 0, f(No, false, "旣")},
- {0x2f8cc, 0, 0, 0, f(No, false, "書")},
- {0x2f8cd, 0, 0, 0, f(No, false, "晉")},
- {0x2f8ce, 0, 0, 0, f(No, false, "㬙")},
- {0x2f8cf, 0, 0, 0, f(No, false, "暑")},
- {0x2f8d0, 0, 0, 0, f(No, false, "㬈")},
- {0x2f8d1, 0, 0, 0, f(No, false, "㫤")},
- {0x2f8d2, 0, 0, 0, f(No, false, "冒")},
- {0x2f8d3, 0, 0, 0, f(No, false, "冕")},
- {0x2f8d4, 0, 0, 0, f(No, false, "最")},
- {0x2f8d5, 0, 0, 0, f(No, false, "暜")},
- {0x2f8d6, 0, 0, 0, f(No, false, "肭")},
- {0x2f8d7, 0, 0, 0, f(No, false, "䏙")},
- {0x2f8d8, 0, 0, 0, f(No, false, "朗")},
- {0x2f8d9, 0, 0, 0, f(No, false, "望")},
- {0x2f8da, 0, 0, 0, f(No, false, "朡")},
- {0x2f8db, 0, 0, 0, f(No, false, "杞")},
- {0x2f8dc, 0, 0, 0, f(No, false, "杓")},
- {0x2f8dd, 0, 0, 0, f(No, false, "𣏃")},
- {0x2f8de, 0, 0, 0, f(No, false, "㭉")},
- {0x2f8df, 0, 0, 0, f(No, false, "柺")},
- {0x2f8e0, 0, 0, 0, f(No, false, "枅")},
- {0x2f8e1, 0, 0, 0, f(No, false, "桒")},
- {0x2f8e2, 0, 0, 0, f(No, false, "梅")},
- {0x2f8e3, 0, 0, 0, f(No, false, "𣑭")},
- {0x2f8e4, 0, 0, 0, f(No, false, "梎")},
- {0x2f8e5, 0, 0, 0, f(No, false, "栟")},
- {0x2f8e6, 0, 0, 0, f(No, false, "椔")},
- {0x2f8e7, 0, 0, 0, f(No, false, "㮝")},
- {0x2f8e8, 0, 0, 0, f(No, false, "楂")},
- {0x2f8e9, 0, 0, 0, f(No, false, "榣")},
- {0x2f8ea, 0, 0, 0, f(No, false, "槪")},
- {0x2f8eb, 0, 0, 0, f(No, false, "檨")},
- {0x2f8ec, 0, 0, 0, f(No, false, "𣚣")},
- {0x2f8ed, 0, 0, 0, f(No, false, "櫛")},
- {0x2f8ee, 0, 0, 0, f(No, false, "㰘")},
- {0x2f8ef, 0, 0, 0, f(No, false, "次")},
- {0x2f8f0, 0, 0, 0, f(No, false, "𣢧")},
- {0x2f8f1, 0, 0, 0, f(No, false, "歔")},
- {0x2f8f2, 0, 0, 0, f(No, false, "㱎")},
- {0x2f8f3, 0, 0, 0, f(No, false, "歲")},
- {0x2f8f4, 0, 0, 0, f(No, false, "殟")},
- {0x2f8f5, 0, 0, 0, f(No, false, "殺")},
- {0x2f8f6, 0, 0, 0, f(No, false, "殻")},
- {0x2f8f7, 0, 0, 0, f(No, false, "𣪍")},
- {0x2f8f8, 0, 0, 0, f(No, false, "𡴋")},
- {0x2f8f9, 0, 0, 0, f(No, false, "𣫺")},
- {0x2f8fa, 0, 0, 0, f(No, false, "汎")},
- {0x2f8fb, 0, 0, 0, f(No, false, "𣲼")},
- {0x2f8fc, 0, 0, 0, f(No, false, "沿")},
- {0x2f8fd, 0, 0, 0, f(No, false, "泍")},
- {0x2f8fe, 0, 0, 0, f(No, false, "汧")},
- {0x2f8ff, 0, 0, 0, f(No, false, "洖")},
- {0x2f900, 0, 0, 0, f(No, false, "派")},
- {0x2f901, 0, 0, 0, f(No, false, "海")},
- {0x2f902, 0, 0, 0, f(No, false, "流")},
- {0x2f903, 0, 0, 0, f(No, false, "浩")},
- {0x2f904, 0, 0, 0, f(No, false, "浸")},
- {0x2f905, 0, 0, 0, f(No, false, "涅")},
- {0x2f906, 0, 0, 0, f(No, false, "𣴞")},
- {0x2f907, 0, 0, 0, f(No, false, "洴")},
- {0x2f908, 0, 0, 0, f(No, false, "港")},
- {0x2f909, 0, 0, 0, f(No, false, "湮")},
- {0x2f90a, 0, 0, 0, f(No, false, "㴳")},
- {0x2f90b, 0, 0, 0, f(No, false, "滋")},
- {0x2f90c, 0, 0, 0, f(No, false, "滇")},
- {0x2f90d, 0, 0, 0, f(No, false, "𣻑")},
- {0x2f90e, 0, 0, 0, f(No, false, "淹")},
- {0x2f90f, 0, 0, 0, f(No, false, "潮")},
- {0x2f910, 0, 0, 0, f(No, false, "𣽞")},
- {0x2f911, 0, 0, 0, f(No, false, "𣾎")},
- {0x2f912, 0, 0, 0, f(No, false, "濆")},
- {0x2f913, 0, 0, 0, f(No, false, "瀹")},
- {0x2f914, 0, 0, 0, f(No, false, "瀞")},
- {0x2f915, 0, 0, 0, f(No, false, "瀛")},
- {0x2f916, 0, 0, 0, f(No, false, "㶖")},
- {0x2f917, 0, 0, 0, f(No, false, "灊")},
- {0x2f918, 0, 0, 0, f(No, false, "災")},
- {0x2f919, 0, 0, 0, f(No, false, "灷")},
- {0x2f91a, 0, 0, 0, f(No, false, "炭")},
- {0x2f91b, 0, 0, 0, f(No, false, "𠔥")},
- {0x2f91c, 0, 0, 0, f(No, false, "煅")},
- {0x2f91d, 0, 0, 0, f(No, false, "𤉣")},
- {0x2f91e, 0, 0, 0, f(No, false, "熜")},
- {0x2f91f, 0, 0, 0, f(No, false, "𤎫")},
- {0x2f920, 0, 0, 0, f(No, false, "爨")},
- {0x2f921, 0, 0, 0, f(No, false, "爵")},
- {0x2f922, 0, 0, 0, f(No, false, "牐")},
- {0x2f923, 0, 0, 0, f(No, false, "𤘈")},
- {0x2f924, 0, 0, 0, f(No, false, "犀")},
- {0x2f925, 0, 0, 0, f(No, false, "犕")},
- {0x2f926, 0, 0, 0, f(No, false, "𤜵")},
- {0x2f927, 0, 0, 0, f(No, false, "𤠔")},
- {0x2f928, 0, 0, 0, f(No, false, "獺")},
- {0x2f929, 0, 0, 0, f(No, false, "王")},
- {0x2f92a, 0, 0, 0, f(No, false, "㺬")},
- {0x2f92b, 0, 0, 0, f(No, false, "玥")},
- {0x2f92c, 0, 0, 0, f(No, false, "㺸")},
- {0x2f92e, 0, 0, 0, f(No, false, "瑇")},
- {0x2f92f, 0, 0, 0, f(No, false, "瑜")},
- {0x2f930, 0, 0, 0, f(No, false, "瑱")},
- {0x2f931, 0, 0, 0, f(No, false, "璅")},
- {0x2f932, 0, 0, 0, f(No, false, "瓊")},
- {0x2f933, 0, 0, 0, f(No, false, "㼛")},
- {0x2f934, 0, 0, 0, f(No, false, "甤")},
- {0x2f935, 0, 0, 0, f(No, false, "𤰶")},
- {0x2f936, 0, 0, 0, f(No, false, "甾")},
- {0x2f937, 0, 0, 0, f(No, false, "𤲒")},
- {0x2f938, 0, 0, 0, f(No, false, "異")},
- {0x2f939, 0, 0, 0, f(No, false, "𢆟")},
- {0x2f93a, 0, 0, 0, f(No, false, "瘐")},
- {0x2f93b, 0, 0, 0, f(No, false, "𤾡")},
- {0x2f93c, 0, 0, 0, f(No, false, "𤾸")},
- {0x2f93d, 0, 0, 0, f(No, false, "𥁄")},
- {0x2f93e, 0, 0, 0, f(No, false, "㿼")},
- {0x2f93f, 0, 0, 0, f(No, false, "䀈")},
- {0x2f940, 0, 0, 0, f(No, false, "直")},
- {0x2f941, 0, 0, 0, f(No, false, "𥃳")},
- {0x2f942, 0, 0, 0, f(No, false, "𥃲")},
- {0x2f943, 0, 0, 0, f(No, false, "𥄙")},
- {0x2f944, 0, 0, 0, f(No, false, "𥄳")},
- {0x2f945, 0, 0, 0, f(No, false, "眞")},
- {0x2f946, 0, 0, 0, f(No, false, "真")},
- {0x2f948, 0, 0, 0, f(No, false, "睊")},
- {0x2f949, 0, 0, 0, f(No, false, "䀹")},
- {0x2f94a, 0, 0, 0, f(No, false, "瞋")},
- {0x2f94b, 0, 0, 0, f(No, false, "䁆")},
- {0x2f94c, 0, 0, 0, f(No, false, "䂖")},
- {0x2f94d, 0, 0, 0, f(No, false, "𥐝")},
- {0x2f94e, 0, 0, 0, f(No, false, "硎")},
- {0x2f94f, 0, 0, 0, f(No, false, "碌")},
- {0x2f950, 0, 0, 0, f(No, false, "磌")},
- {0x2f951, 0, 0, 0, f(No, false, "䃣")},
- {0x2f952, 0, 0, 0, f(No, false, "𥘦")},
- {0x2f953, 0, 0, 0, f(No, false, "祖")},
- {0x2f954, 0, 0, 0, f(No, false, "𥚚")},
- {0x2f955, 0, 0, 0, f(No, false, "𥛅")},
- {0x2f956, 0, 0, 0, f(No, false, "福")},
- {0x2f957, 0, 0, 0, f(No, false, "秫")},
- {0x2f958, 0, 0, 0, f(No, false, "䄯")},
- {0x2f959, 0, 0, 0, f(No, false, "穀")},
- {0x2f95a, 0, 0, 0, f(No, false, "穊")},
- {0x2f95b, 0, 0, 0, f(No, false, "穏")},
- {0x2f95c, 0, 0, 0, f(No, false, "𥥼")},
- {0x2f95d, 0, 0, 0, f(No, false, "𥪧")},
- {0x2f95f, 0, 0, 0, f(No, false, "竮")},
- {0x2f960, 0, 0, 0, f(No, false, "䈂")},
- {0x2f961, 0, 0, 0, f(No, false, "𥮫")},
- {0x2f962, 0, 0, 0, f(No, false, "篆")},
- {0x2f963, 0, 0, 0, f(No, false, "築")},
- {0x2f964, 0, 0, 0, f(No, false, "䈧")},
- {0x2f965, 0, 0, 0, f(No, false, "𥲀")},
- {0x2f966, 0, 0, 0, f(No, false, "糒")},
- {0x2f967, 0, 0, 0, f(No, false, "䊠")},
- {0x2f968, 0, 0, 0, f(No, false, "糨")},
- {0x2f969, 0, 0, 0, f(No, false, "糣")},
- {0x2f96a, 0, 0, 0, f(No, false, "紀")},
- {0x2f96b, 0, 0, 0, f(No, false, "𥾆")},
- {0x2f96c, 0, 0, 0, f(No, false, "絣")},
- {0x2f96d, 0, 0, 0, f(No, false, "䌁")},
- {0x2f96e, 0, 0, 0, f(No, false, "緇")},
- {0x2f96f, 0, 0, 0, f(No, false, "縂")},
- {0x2f970, 0, 0, 0, f(No, false, "繅")},
- {0x2f971, 0, 0, 0, f(No, false, "䌴")},
- {0x2f972, 0, 0, 0, f(No, false, "𦈨")},
- {0x2f973, 0, 0, 0, f(No, false, "𦉇")},
- {0x2f974, 0, 0, 0, f(No, false, "䍙")},
- {0x2f975, 0, 0, 0, f(No, false, "𦋙")},
- {0x2f976, 0, 0, 0, f(No, false, "罺")},
- {0x2f977, 0, 0, 0, f(No, false, "𦌾")},
- {0x2f978, 0, 0, 0, f(No, false, "羕")},
- {0x2f979, 0, 0, 0, f(No, false, "翺")},
- {0x2f97a, 0, 0, 0, f(No, false, "者")},
- {0x2f97b, 0, 0, 0, f(No, false, "𦓚")},
- {0x2f97c, 0, 0, 0, f(No, false, "𦔣")},
- {0x2f97d, 0, 0, 0, f(No, false, "聠")},
- {0x2f97e, 0, 0, 0, f(No, false, "𦖨")},
- {0x2f97f, 0, 0, 0, f(No, false, "聰")},
- {0x2f980, 0, 0, 0, f(No, false, "𣍟")},
- {0x2f981, 0, 0, 0, f(No, false, "䏕")},
- {0x2f982, 0, 0, 0, f(No, false, "育")},
- {0x2f983, 0, 0, 0, f(No, false, "脃")},
- {0x2f984, 0, 0, 0, f(No, false, "䐋")},
- {0x2f985, 0, 0, 0, f(No, false, "脾")},
- {0x2f986, 0, 0, 0, f(No, false, "媵")},
- {0x2f987, 0, 0, 0, f(No, false, "𦞧")},
- {0x2f988, 0, 0, 0, f(No, false, "𦞵")},
- {0x2f989, 0, 0, 0, f(No, false, "𣎓")},
- {0x2f98a, 0, 0, 0, f(No, false, "𣎜")},
- {0x2f98b, 0, 0, 0, f(No, false, "舁")},
- {0x2f98c, 0, 0, 0, f(No, false, "舄")},
- {0x2f98d, 0, 0, 0, f(No, false, "辞")},
- {0x2f98e, 0, 0, 0, f(No, false, "䑫")},
- {0x2f98f, 0, 0, 0, f(No, false, "芑")},
- {0x2f990, 0, 0, 0, f(No, false, "芋")},
- {0x2f991, 0, 0, 0, f(No, false, "芝")},
- {0x2f992, 0, 0, 0, f(No, false, "劳")},
- {0x2f993, 0, 0, 0, f(No, false, "花")},
- {0x2f994, 0, 0, 0, f(No, false, "芳")},
- {0x2f995, 0, 0, 0, f(No, false, "芽")},
- {0x2f996, 0, 0, 0, f(No, false, "苦")},
- {0x2f997, 0, 0, 0, f(No, false, "𦬼")},
- {0x2f998, 0, 0, 0, f(No, false, "若")},
- {0x2f999, 0, 0, 0, f(No, false, "茝")},
- {0x2f99a, 0, 0, 0, f(No, false, "荣")},
- {0x2f99b, 0, 0, 0, f(No, false, "莭")},
- {0x2f99c, 0, 0, 0, f(No, false, "茣")},
- {0x2f99d, 0, 0, 0, f(No, false, "莽")},
- {0x2f99e, 0, 0, 0, f(No, false, "菧")},
- {0x2f99f, 0, 0, 0, f(No, false, "著")},
- {0x2f9a0, 0, 0, 0, f(No, false, "荓")},
- {0x2f9a1, 0, 0, 0, f(No, false, "菊")},
- {0x2f9a2, 0, 0, 0, f(No, false, "菌")},
- {0x2f9a3, 0, 0, 0, f(No, false, "菜")},
- {0x2f9a4, 0, 0, 0, f(No, false, "𦰶")},
- {0x2f9a5, 0, 0, 0, f(No, false, "𦵫")},
- {0x2f9a6, 0, 0, 0, f(No, false, "𦳕")},
- {0x2f9a7, 0, 0, 0, f(No, false, "䔫")},
- {0x2f9a8, 0, 0, 0, f(No, false, "蓱")},
- {0x2f9a9, 0, 0, 0, f(No, false, "蓳")},
- {0x2f9aa, 0, 0, 0, f(No, false, "蔖")},
- {0x2f9ab, 0, 0, 0, f(No, false, "𧏊")},
- {0x2f9ac, 0, 0, 0, f(No, false, "蕤")},
- {0x2f9ad, 0, 0, 0, f(No, false, "𦼬")},
- {0x2f9ae, 0, 0, 0, f(No, false, "䕝")},
- {0x2f9af, 0, 0, 0, f(No, false, "䕡")},
- {0x2f9b0, 0, 0, 0, f(No, false, "𦾱")},
- {0x2f9b1, 0, 0, 0, f(No, false, "𧃒")},
- {0x2f9b2, 0, 0, 0, f(No, false, "䕫")},
- {0x2f9b3, 0, 0, 0, f(No, false, "虐")},
- {0x2f9b4, 0, 0, 0, f(No, false, "虜")},
- {0x2f9b5, 0, 0, 0, f(No, false, "虧")},
- {0x2f9b6, 0, 0, 0, f(No, false, "虩")},
- {0x2f9b7, 0, 0, 0, f(No, false, "蚩")},
- {0x2f9b8, 0, 0, 0, f(No, false, "蚈")},
- {0x2f9b9, 0, 0, 0, f(No, false, "蜎")},
- {0x2f9ba, 0, 0, 0, f(No, false, "蛢")},
- {0x2f9bb, 0, 0, 0, f(No, false, "蝹")},
- {0x2f9bc, 0, 0, 0, f(No, false, "蜨")},
- {0x2f9bd, 0, 0, 0, f(No, false, "蝫")},
- {0x2f9be, 0, 0, 0, f(No, false, "螆")},
- {0x2f9bf, 0, 0, 0, f(No, false, "䗗")},
- {0x2f9c0, 0, 0, 0, f(No, false, "蟡")},
- {0x2f9c1, 0, 0, 0, f(No, false, "蠁")},
- {0x2f9c2, 0, 0, 0, f(No, false, "䗹")},
- {0x2f9c3, 0, 0, 0, f(No, false, "衠")},
- {0x2f9c4, 0, 0, 0, f(No, false, "衣")},
- {0x2f9c5, 0, 0, 0, f(No, false, "𧙧")},
- {0x2f9c6, 0, 0, 0, f(No, false, "裗")},
- {0x2f9c7, 0, 0, 0, f(No, false, "裞")},
- {0x2f9c8, 0, 0, 0, f(No, false, "䘵")},
- {0x2f9c9, 0, 0, 0, f(No, false, "裺")},
- {0x2f9ca, 0, 0, 0, f(No, false, "㒻")},
- {0x2f9cb, 0, 0, 0, f(No, false, "𧢮")},
- {0x2f9cc, 0, 0, 0, f(No, false, "𧥦")},
- {0x2f9cd, 0, 0, 0, f(No, false, "䚾")},
- {0x2f9ce, 0, 0, 0, f(No, false, "䛇")},
- {0x2f9cf, 0, 0, 0, f(No, false, "誠")},
- {0x2f9d0, 0, 0, 0, f(No, false, "諭")},
- {0x2f9d1, 0, 0, 0, f(No, false, "變")},
- {0x2f9d2, 0, 0, 0, f(No, false, "豕")},
- {0x2f9d3, 0, 0, 0, f(No, false, "𧲨")},
- {0x2f9d4, 0, 0, 0, f(No, false, "貫")},
- {0x2f9d5, 0, 0, 0, f(No, false, "賁")},
- {0x2f9d6, 0, 0, 0, f(No, false, "贛")},
- {0x2f9d7, 0, 0, 0, f(No, false, "起")},
- {0x2f9d8, 0, 0, 0, f(No, false, "𧼯")},
- {0x2f9d9, 0, 0, 0, f(No, false, "𠠄")},
- {0x2f9da, 0, 0, 0, f(No, false, "跋")},
- {0x2f9db, 0, 0, 0, f(No, false, "趼")},
- {0x2f9dc, 0, 0, 0, f(No, false, "跰")},
- {0x2f9dd, 0, 0, 0, f(No, false, "𠣞")},
- {0x2f9de, 0, 0, 0, f(No, false, "軔")},
- {0x2f9df, 0, 0, 0, f(No, false, "輸")},
- {0x2f9e0, 0, 0, 0, f(No, false, "𨗒")},
- {0x2f9e1, 0, 0, 0, f(No, false, "𨗭")},
- {0x2f9e2, 0, 0, 0, f(No, false, "邔")},
- {0x2f9e3, 0, 0, 0, f(No, false, "郱")},
- {0x2f9e4, 0, 0, 0, f(No, false, "鄑")},
- {0x2f9e5, 0, 0, 0, f(No, false, "𨜮")},
- {0x2f9e6, 0, 0, 0, f(No, false, "鄛")},
- {0x2f9e7, 0, 0, 0, f(No, false, "鈸")},
- {0x2f9e8, 0, 0, 0, f(No, false, "鋗")},
- {0x2f9e9, 0, 0, 0, f(No, false, "鋘")},
- {0x2f9ea, 0, 0, 0, f(No, false, "鉼")},
- {0x2f9eb, 0, 0, 0, f(No, false, "鏹")},
- {0x2f9ec, 0, 0, 0, f(No, false, "鐕")},
- {0x2f9ed, 0, 0, 0, f(No, false, "𨯺")},
- {0x2f9ee, 0, 0, 0, f(No, false, "開")},
- {0x2f9ef, 0, 0, 0, f(No, false, "䦕")},
- {0x2f9f0, 0, 0, 0, f(No, false, "閷")},
- {0x2f9f1, 0, 0, 0, f(No, false, "𨵷")},
- {0x2f9f2, 0, 0, 0, f(No, false, "䧦")},
- {0x2f9f3, 0, 0, 0, f(No, false, "雃")},
- {0x2f9f4, 0, 0, 0, f(No, false, "嶲")},
- {0x2f9f5, 0, 0, 0, f(No, false, "霣")},
- {0x2f9f6, 0, 0, 0, f(No, false, "𩅅")},
- {0x2f9f7, 0, 0, 0, f(No, false, "𩈚")},
- {0x2f9f8, 0, 0, 0, f(No, false, "䩮")},
- {0x2f9f9, 0, 0, 0, f(No, false, "䩶")},
- {0x2f9fa, 0, 0, 0, f(No, false, "韠")},
- {0x2f9fb, 0, 0, 0, f(No, false, "𩐊")},
- {0x2f9fc, 0, 0, 0, f(No, false, "䪲")},
- {0x2f9fd, 0, 0, 0, f(No, false, "𩒖")},
- {0x2f9fe, 0, 0, 0, f(No, false, "頋")},
- {0x2fa00, 0, 0, 0, f(No, false, "頩")},
- {0x2fa01, 0, 0, 0, f(No, false, "𩖶")},
- {0x2fa02, 0, 0, 0, f(No, false, "飢")},
- {0x2fa03, 0, 0, 0, f(No, false, "䬳")},
- {0x2fa04, 0, 0, 0, f(No, false, "餩")},
- {0x2fa05, 0, 0, 0, f(No, false, "馧")},
- {0x2fa06, 0, 0, 0, f(No, false, "駂")},
- {0x2fa07, 0, 0, 0, f(No, false, "駾")},
- {0x2fa08, 0, 0, 0, f(No, false, "䯎")},
- {0x2fa09, 0, 0, 0, f(No, false, "𩬰")},
- {0x2fa0a, 0, 0, 0, f(No, false, "鬒")},
- {0x2fa0b, 0, 0, 0, f(No, false, "鱀")},
- {0x2fa0c, 0, 0, 0, f(No, false, "鳽")},
- {0x2fa0d, 0, 0, 0, f(No, false, "䳎")},
- {0x2fa0e, 0, 0, 0, f(No, false, "䳭")},
- {0x2fa0f, 0, 0, 0, f(No, false, "鵧")},
- {0x2fa10, 0, 0, 0, f(No, false, "𪃎")},
- {0x2fa11, 0, 0, 0, f(No, false, "䳸")},
- {0x2fa12, 0, 0, 0, f(No, false, "𪄅")},
- {0x2fa13, 0, 0, 0, f(No, false, "𪈎")},
- {0x2fa14, 0, 0, 0, f(No, false, "𪊑")},
- {0x2fa15, 0, 0, 0, f(No, false, "麻")},
- {0x2fa16, 0, 0, 0, f(No, false, "䵖")},
- {0x2fa17, 0, 0, 0, f(No, false, "黹")},
- {0x2fa18, 0, 0, 0, f(No, false, "黾")},
- {0x2fa19, 0, 0, 0, f(No, false, "鼅")},
- {0x2fa1a, 0, 0, 0, f(No, false, "鼏")},
- {0x2fa1b, 0, 0, 0, f(No, false, "鼖")},
- {0x2fa1c, 0, 0, 0, f(No, false, "鼻")},
- {0x2fa1d, 0, 0, 0, f(No, false, "𪘀")},
- {0x2fa1e, 0, 0, 0, f(Yes, false, "")},
-}
diff --git a/vendor/golang.org/x/text/unicode/norm/example_iter_test.go b/vendor/golang.org/x/text/unicode/norm/example_iter_test.go
deleted file mode 100644
index 82df89c7b..000000000
--- a/vendor/golang.org/x/text/unicode/norm/example_iter_test.go
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package norm_test
-
-import (
- "bytes"
- "fmt"
- "unicode/utf8"
-
- "golang.org/x/text/unicode/norm"
-)
-
-// EqualSimple uses a norm.Iter to compare two non-normalized
-// strings for equivalence.
-func EqualSimple(a, b string) bool {
- var ia, ib norm.Iter
- ia.InitString(norm.NFKD, a)
- ib.InitString(norm.NFKD, b)
- for !ia.Done() && !ib.Done() {
- if !bytes.Equal(ia.Next(), ib.Next()) {
- return false
- }
- }
- return ia.Done() && ib.Done()
-}
-
-// FindPrefix finds the longest common prefix of ASCII characters
-// of a and b.
-func FindPrefix(a, b string) int {
- i := 0
- for ; i < len(a) && i < len(b) && a[i] < utf8.RuneSelf && a[i] == b[i]; i++ {
- }
- return i
-}
-
-// EqualOpt is like EqualSimple, but optimizes the special
-// case for ASCII characters.
-func EqualOpt(a, b string) bool {
- n := FindPrefix(a, b)
- a, b = a[n:], b[n:]
- var ia, ib norm.Iter
- ia.InitString(norm.NFKD, a)
- ib.InitString(norm.NFKD, b)
- for !ia.Done() && !ib.Done() {
- if !bytes.Equal(ia.Next(), ib.Next()) {
- return false
- }
- if n := int64(FindPrefix(a[ia.Pos():], b[ib.Pos():])); n != 0 {
- ia.Seek(n, 1)
- ib.Seek(n, 1)
- }
- }
- return ia.Done() && ib.Done()
-}
-
-var compareTests = []struct{ a, b string }{
- {"aaa", "aaa"},
- {"aaa", "aab"},
- {"a\u0300a", "\u00E0a"},
- {"a\u0300\u0320b", "a\u0320\u0300b"},
- {"\u1E0A\u0323", "\x44\u0323\u0307"},
- // A character that decomposes into multiple segments
- // spans several iterations.
- {"\u3304", "\u30A4\u30CB\u30F3\u30AF\u3099"},
-}
-
-func ExampleIter() {
- for i, t := range compareTests {
- r0 := EqualSimple(t.a, t.b)
- r1 := EqualOpt(t.a, t.b)
- fmt.Printf("%d: %v %v\n", i, r0, r1)
- }
- // Output:
- // 0: true true
- // 1: false false
- // 2: true true
- // 3: true true
- // 4: true true
- // 5: true true
-}
diff --git a/vendor/golang.org/x/text/unicode/norm/example_test.go b/vendor/golang.org/x/text/unicode/norm/example_test.go
deleted file mode 100644
index 8f3b15653..000000000
--- a/vendor/golang.org/x/text/unicode/norm/example_test.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package norm_test
-
-import (
- "fmt"
-
- "golang.org/x/text/unicode/norm"
-)
-
-func ExampleForm_NextBoundary() {
- s := norm.NFD.String("Mêlée")
-
- for i := 0; i < len(s); {
- d := norm.NFC.NextBoundaryInString(s[i:], true)
- fmt.Printf("%[1]s: %+[1]q\n", s[i:i+d])
- i += d
- }
- // Output:
- // M: "M"
- // ê: "e\u0302"
- // l: "l"
- // é: "e\u0301"
- // e: "e"
-}
diff --git a/vendor/golang.org/x/text/unicode/norm/forminfo_test.go b/vendor/golang.org/x/text/unicode/norm/forminfo_test.go
deleted file mode 100644
index e15ba9bee..000000000
--- a/vendor/golang.org/x/text/unicode/norm/forminfo_test.go
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build test
-
-package norm
-
-import "testing"
-
-func TestProperties(t *testing.T) {
- var d runeData
- CK := [2]string{"C", "K"}
- for k, r := 1, rune(0); r < 0x2ffff; r++ {
- if k < len(testData) && r == testData[k].r {
- d = testData[k]
- k++
- }
- s := string(r)
- for j, p := range []Properties{NFC.PropertiesString(s), NFKC.PropertiesString(s)} {
- f := d.f[j]
- if p.CCC() != d.ccc {
- t.Errorf("%U: ccc(%s): was %d; want %d %X", r, CK[j], p.CCC(), d.ccc, p.index)
- }
- if p.isYesC() != (f.qc == Yes) {
- t.Errorf("%U: YesC(%s): was %v; want %v", r, CK[j], p.isYesC(), f.qc == Yes)
- }
- if p.combinesBackward() != (f.qc == Maybe) {
- t.Errorf("%U: combines backwards(%s): was %v; want %v", r, CK[j], p.combinesBackward(), f.qc == Maybe)
- }
- if p.nLeadingNonStarters() != d.nLead {
- t.Errorf("%U: nLead(%s): was %d; want %d %#v %#v", r, CK[j], p.nLeadingNonStarters(), d.nLead, p, d)
- }
- if p.nTrailingNonStarters() != d.nTrail {
- t.Errorf("%U: nTrail(%s): was %d; want %d %#v %#v", r, CK[j], p.nTrailingNonStarters(), d.nTrail, p, d)
- }
- if p.combinesForward() != f.combinesForward {
- t.Errorf("%U: combines forward(%s): was %v; want %v %#v", r, CK[j], p.combinesForward(), f.combinesForward, p)
- }
- // Skip Hangul as it is algorithmically computed.
- if r >= hangulBase && r < hangulEnd {
- continue
- }
- if p.hasDecomposition() {
- if has := f.decomposition != ""; !has {
- t.Errorf("%U: hasDecomposition(%s): was %v; want %v", r, CK[j], p.hasDecomposition(), has)
- }
- if string(p.Decomposition()) != f.decomposition {
- t.Errorf("%U: decomp(%s): was %+q; want %+q", r, CK[j], p.Decomposition(), f.decomposition)
- }
- }
- }
- }
-}
diff --git a/vendor/golang.org/x/text/unicode/norm/iter_test.go b/vendor/golang.org/x/text/unicode/norm/iter_test.go
deleted file mode 100644
index d95aa304d..000000000
--- a/vendor/golang.org/x/text/unicode/norm/iter_test.go
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package norm
-
-import (
- "strings"
- "testing"
-)
-
-func doIterNorm(f Form, s string) []byte {
- acc := []byte{}
- i := Iter{}
- i.InitString(f, s)
- for !i.Done() {
- acc = append(acc, i.Next()...)
- }
- return acc
-}
-
-func TestIterNext(t *testing.T) {
- runNormTests(t, "IterNext", func(f Form, out []byte, s string) []byte {
- return doIterNorm(f, string(append(out, s...)))
- })
-}
-
-type SegmentTest struct {
- in string
- out []string
-}
-
-var segmentTests = []SegmentTest{
- {"\u1E0A\u0323a", []string{"\x44\u0323\u0307", "a", ""}},
- {rep('a', segSize), append(strings.Split(rep('a', segSize), ""), "")},
- {rep('a', segSize+2), append(strings.Split(rep('a', segSize+2), ""), "")},
- {rep('a', segSize) + "\u0300aa",
- append(strings.Split(rep('a', segSize-1), ""), "a\u0300", "a", "a", "")},
-
- // U+0f73 is NOT treated as a starter as it is a modifier
- {"a" + grave(29) + "\u0f73", []string{"a" + grave(29), cgj + "\u0f73"}},
- {"a\u0f73", []string{"a\u0f73"}},
-
- // U+ff9e is treated as a non-starter.
- // TODO: should we? Note that this will only affect iteration, as whether
- // or not we do so does not affect the normalization output and will either
- // way result in consistent iteration output.
- {"a" + grave(30) + "\uff9e", []string{"a" + grave(30), cgj + "\uff9e"}},
- {"a\uff9e", []string{"a\uff9e"}},
-}
-
-var segmentTestsK = []SegmentTest{
- {"\u3332", []string{"\u30D5", "\u30A1", "\u30E9", "\u30C3", "\u30C8\u3099", ""}},
- // last segment of multi-segment decomposition needs normalization
- {"\u3332\u093C", []string{"\u30D5", "\u30A1", "\u30E9", "\u30C3", "\u30C8\u093C\u3099", ""}},
- {"\u320E", []string{"\x28", "\uAC00", "\x29"}},
-
- // last segment should be copied to start of buffer.
- {"\ufdfa", []string{"\u0635", "\u0644", "\u0649", " ", "\u0627", "\u0644", "\u0644", "\u0647", " ", "\u0639", "\u0644", "\u064a", "\u0647", " ", "\u0648", "\u0633", "\u0644", "\u0645", ""}},
- {"\ufdfa" + grave(30), []string{"\u0635", "\u0644", "\u0649", " ", "\u0627", "\u0644", "\u0644", "\u0647", " ", "\u0639", "\u0644", "\u064a", "\u0647", " ", "\u0648", "\u0633", "\u0644", "\u0645" + grave(30), ""}},
- {"\uFDFA" + grave(64), []string{"\u0635", "\u0644", "\u0649", " ", "\u0627", "\u0644", "\u0644", "\u0647", " ", "\u0639", "\u0644", "\u064a", "\u0647", " ", "\u0648", "\u0633", "\u0644", "\u0645" + grave(30), cgj + grave(30), cgj + grave(4), ""}},
-
- // Hangul and Jamo are grouped together.
- {"\uAC00", []string{"\u1100\u1161", ""}},
- {"\uAC01", []string{"\u1100\u1161\u11A8", ""}},
- {"\u1100\u1161", []string{"\u1100\u1161", ""}},
-}
-
-// Note that, by design, segmentation is equal for composing and decomposing forms.
-func TestIterSegmentation(t *testing.T) {
- segmentTest(t, "SegmentTestD", NFD, segmentTests)
- segmentTest(t, "SegmentTestC", NFC, segmentTests)
- segmentTest(t, "SegmentTestKD", NFKD, segmentTestsK)
- segmentTest(t, "SegmentTestKC", NFKC, segmentTestsK)
-}
-
-func segmentTest(t *testing.T, name string, f Form, tests []SegmentTest) {
- iter := Iter{}
- for i, tt := range tests {
- iter.InitString(f, tt.in)
- for j, seg := range tt.out {
- if seg == "" {
- if !iter.Done() {
- res := string(iter.Next())
- t.Errorf(`%s:%d:%d: expected Done()==true, found segment %+q`, name, i, j, res)
- }
- continue
- }
- if iter.Done() {
- t.Errorf("%s:%d:%d: Done()==true, want false", name, i, j)
- }
- seg = f.String(seg)
- if res := string(iter.Next()); res != seg {
- t.Errorf(`%s:%d:%d" segment was %+q (%d); want %+q (%d)`, name, i, j, pc(res), len(res), pc(seg), len(seg))
- }
- }
- }
-}
diff --git a/vendor/golang.org/x/text/unicode/norm/normalize_test.go b/vendor/golang.org/x/text/unicode/norm/normalize_test.go
deleted file mode 100644
index e3c0ac73a..000000000
--- a/vendor/golang.org/x/text/unicode/norm/normalize_test.go
+++ /dev/null
@@ -1,1287 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package norm
-
-import (
- "bytes"
- "flag"
- "fmt"
- "io"
- "log"
- "strings"
- "testing"
- "unicode/utf8"
-
- "golang.org/x/text/internal/testtext"
- "golang.org/x/text/transform"
-)
-
-var (
- testn = flag.Int("testn", -1, "specific test number to run or -1 for all")
-)
-
-// pc replaces any rune r that is repeated n times, for n > 1, with r{n}.
-func pc(s string) []byte {
- b := bytes.NewBuffer(make([]byte, 0, len(s)))
- for i := 0; i < len(s); {
- r, sz := utf8.DecodeRuneInString(s[i:])
- n := 0
- if sz == 1 {
- // Special-case one-byte case to handle repetition for invalid UTF-8.
- for c := s[i]; i+n < len(s) && s[i+n] == c; n++ {
- }
- } else {
- for _, r2 := range s[i:] {
- if r2 != r {
- break
- }
- n++
- }
- }
- b.WriteString(s[i : i+sz])
- if n > 1 {
- fmt.Fprintf(b, "{%d}", n)
- }
- i += sz * n
- }
- return b.Bytes()
-}
-
-// pidx finds the index from which two strings start to differ, plus context.
-// It returns the index and ellipsis if the index is greater than 0.
-func pidx(a, b string) (i int, prefix string) {
- for ; i < len(a) && i < len(b) && a[i] == b[i]; i++ {
- }
- if i < 8 {
- return 0, ""
- }
- i -= 3 // ensure taking at least one full rune before the difference.
- for k := i - 7; i > k && !utf8.RuneStart(a[i]); i-- {
- }
- return i, "..."
-}
-
-type PositionTest struct {
- input string
- pos int
- buffer string // expected contents of reorderBuffer, if applicable
-}
-
-type positionFunc func(rb *reorderBuffer, s string) (int, []byte)
-
-func runPosTests(t *testing.T, name string, f Form, fn positionFunc, tests []PositionTest) {
- rb := reorderBuffer{}
- rb.init(f, nil)
- for i, test := range tests {
- rb.reset()
- rb.src = inputString(test.input)
- rb.nsrc = len(test.input)
- pos, out := fn(&rb, test.input)
- if pos != test.pos {
- t.Errorf("%s:%d: position is %d; want %d", name, i, pos, test.pos)
- }
- if outs := string(out); outs != test.buffer {
- k, pfx := pidx(outs, test.buffer)
- t.Errorf("%s:%d: buffer \nwas %s%+q; \nwant %s%+q", name, i, pfx, pc(outs[k:]), pfx, pc(test.buffer[k:]))
- }
- }
-}
-
-func grave(n int) string {
- return rep(0x0300, n)
-}
-
-func rep(r rune, n int) string {
- return strings.Repeat(string(r), n)
-}
-
-const segSize = maxByteBufferSize
-
-var cgj = GraphemeJoiner
-
-var decomposeSegmentTests = []PositionTest{
- // illegal runes
- {"\xC2", 0, ""},
- {"\xC0", 1, "\xC0"},
- {"\u00E0\x80", 2, "\u0061\u0300"},
- // starter
- {"a", 1, "a"},
- {"ab", 1, "a"},
- // starter + composing
- {"a\u0300", 3, "a\u0300"},
- {"a\u0300b", 3, "a\u0300"},
- // with decomposition
- {"\u00C0", 2, "A\u0300"},
- {"\u00C0b", 2, "A\u0300"},
- // long
- {grave(31), 60, grave(30) + cgj},
- {"a" + grave(31), 61, "a" + grave(30) + cgj},
-
- // Stability tests: see http://www.unicode.org/review/pr-29.html.
- // U+0300 COMBINING GRAVE ACCENT;Mn;230;NSM;;;;;N;NON-SPACING GRAVE;;;;
- // U+0B47 ORIYA VOWEL SIGN E;Mc;0;L;;;;;N;;;;;
- // U+0B3E ORIYA VOWEL SIGN AA;Mc;0;L;;;;;N;;;;;
- // U+1100 HANGUL CHOSEONG KIYEOK;Lo;0;L;;;;;N;;;;;
- // U+1161 HANGUL JUNGSEONG A;Lo;0;L;;;;;N;;;;;
- {"\u0B47\u0300\u0B3E", 8, "\u0B47\u0300\u0B3E"},
- {"\u1100\u0300\u1161", 8, "\u1100\u0300\u1161"},
- {"\u0B47\u0B3E", 6, "\u0B47\u0B3E"},
- {"\u1100\u1161", 6, "\u1100\u1161"},
-
- // U+04DA MALAYALAM VOWEL SIGN O;Mc;0;L;0D46 0D3E;;;;N;;;;;
- // Sequence of decomposing characters that are starters and modifiers.
- {"\u0d4a" + strings.Repeat("\u0d3e", 31), 90, "\u0d46" + strings.Repeat("\u0d3e", 30) + cgj},
-
- {grave(30), 60, grave(30)},
- // U+FF9E is a starter, but decomposes to U+3099, which is not.
- {grave(30) + "\uff9e", 60, grave(30) + cgj},
- // ends with incomplete UTF-8 encoding
- {"\xCC", 0, ""},
- {"\u0300\xCC", 2, "\u0300"},
-}
-
-func decomposeSegmentF(rb *reorderBuffer, s string) (int, []byte) {
- rb.initString(NFD, s)
- rb.setFlusher(nil, appendFlush)
- p := decomposeSegment(rb, 0, true)
- return p, rb.out
-}
-
-func TestDecomposeSegment(t *testing.T) {
- runPosTests(t, "TestDecomposeSegment", NFC, decomposeSegmentF, decomposeSegmentTests)
-}
-
-var firstBoundaryTests = []PositionTest{
- // no boundary
- {"", -1, ""},
- {"\u0300", -1, ""},
- {"\x80\x80", -1, ""},
- // illegal runes
- {"\xff", 0, ""},
- {"\u0300\xff", 2, ""},
- {"\u0300\xc0\x80\x80", 2, ""},
- // boundaries
- {"a", 0, ""},
- {"\u0300a", 2, ""},
- // Hangul
- {"\u1103\u1161", 0, ""},
- {"\u110B\u1173\u11B7", 0, ""},
- {"\u1161\u110B\u1173\u11B7", 3, ""},
- {"\u1173\u11B7\u1103\u1161", 6, ""},
- // too many combining characters.
- {grave(maxNonStarters - 1), -1, ""},
- {grave(maxNonStarters), 60, ""},
- {grave(maxNonStarters + 1), 60, ""},
-}
-
-func firstBoundaryF(rb *reorderBuffer, s string) (int, []byte) {
- return rb.f.form.FirstBoundary([]byte(s)), nil
-}
-
-func firstBoundaryStringF(rb *reorderBuffer, s string) (int, []byte) {
- return rb.f.form.FirstBoundaryInString(s), nil
-}
-
-func TestFirstBoundary(t *testing.T) {
- runPosTests(t, "TestFirstBoundary", NFC, firstBoundaryF, firstBoundaryTests)
- runPosTests(t, "TestFirstBoundaryInString", NFC, firstBoundaryStringF, firstBoundaryTests)
-}
-
-func TestNextBoundary(t *testing.T) {
- testCases := []struct {
- input string
- atEOF bool
- want int
- }{
- // no boundary
- {"", true, 0},
- {"", false, -1},
- {"\u0300", true, 2},
- {"\u0300", false, -1},
- {"\x80\x80", true, 1},
- {"\x80\x80", false, 1},
- // illegal runes
- {"\xff", false, 1},
- {"\u0300\xff", false, 2},
- {"\u0300\xc0\x80\x80", false, 2},
- {"\xc2\x80\x80", false, 2},
- {"\xc2", false, -1},
- {"\xc2", true, 1},
- {"a\u0300\xc2", false, -1},
- {"a\u0300\xc2", true, 3},
- // boundaries
- {"a", true, 1},
- {"a", false, -1},
- {"aa", false, 1},
- {"\u0300", true, 2},
- {"\u0300", false, -1},
- {"\u0300a", false, 2},
- // Hangul
- {"\u1103\u1161", true, 6},
- {"\u1103\u1161", false, -1},
- {"\u110B\u1173\u11B7", false, -1},
- {"\u110B\u1173\u11B7\u110B\u1173\u11B7", false, 9},
- {"\u1161\u110B\u1173\u11B7", false, 3},
- {"\u1173\u11B7\u1103\u1161", false, 6},
- // too many combining characters.
- {grave(maxNonStarters - 1), false, -1},
- {grave(maxNonStarters), false, 60},
- {grave(maxNonStarters + 1), false, 60},
- }
-
- for _, tc := range testCases {
- if got := NFC.NextBoundary([]byte(tc.input), tc.atEOF); got != tc.want {
- t.Errorf("NextBoundary(%+q, %v) = %d; want %d", tc.input, tc.atEOF, got, tc.want)
- }
- if got := NFC.NextBoundaryInString(tc.input, tc.atEOF); got != tc.want {
- t.Errorf("NextBoundaryInString(%+q, %v) = %d; want %d", tc.input, tc.atEOF, got, tc.want)
- }
- }
-}
-
-var decomposeToLastTests = []PositionTest{
- // ends with inert character
- {"Hello!", 6, ""},
- {"\u0632", 2, ""},
- {"a\u0301\u0635", 5, ""},
- // ends with non-inert starter
- {"a", 0, "a"},
- {"a\u0301a", 3, "a"},
- {"a\u0301\u03B9", 3, "\u03B9"},
- {"a\u0327", 0, "a\u0327"},
- // illegal runes
- {"\xFF", 1, ""},
- {"aa\xFF", 3, ""},
- {"\xC0\x80\x80", 3, ""},
- {"\xCC\x80\x80", 3, ""},
- // ends with incomplete UTF-8 encoding
- {"a\xCC", 2, ""},
- // ends with combining characters
- {"\u0300\u0301", 0, "\u0300\u0301"},
- {"a\u0300\u0301", 0, "a\u0300\u0301"},
- {"a\u0301\u0308", 0, "a\u0301\u0308"},
- {"a\u0308\u0301", 0, "a\u0308\u0301"},
- {"aaaa\u0300\u0301", 3, "a\u0300\u0301"},
- {"\u0300a\u0300\u0301", 2, "a\u0300\u0301"},
- {"\u00C0", 0, "A\u0300"},
- {"a\u00C0", 1, "A\u0300"},
- // decomposing
- {"a\u0300\u00E0", 3, "a\u0300"},
- // multisegment decompositions (flushes leading segments)
- {"a\u0300\uFDC0", 7, "\u064A"},
- {"\uFDC0" + grave(29), 4, "\u064A" + grave(29)},
- {"\uFDC0" + grave(30), 4, "\u064A" + grave(30)},
- {"\uFDC0" + grave(31), 5, grave(30)},
- {"\uFDFA" + grave(14), 31, "\u0645" + grave(14)},
- // Overflow
- {"\u00E0" + grave(29), 0, "a" + grave(30)},
- {"\u00E0" + grave(30), 2, grave(30)},
- // Hangul
- {"a\u1103", 1, "\u1103"},
- {"a\u110B", 1, "\u110B"},
- {"a\u110B\u1173", 1, "\u110B\u1173"},
- // See comment in composition.go:compBoundaryAfter.
- {"a\u110B\u1173\u11B7", 1, "\u110B\u1173\u11B7"},
- {"a\uC73C", 1, "\u110B\u1173"},
- {"다음", 3, "\u110B\u1173\u11B7"},
- {"다", 0, "\u1103\u1161"},
- {"\u1103\u1161\u110B\u1173\u11B7", 6, "\u110B\u1173\u11B7"},
- {"\u110B\u1173\u11B7\u1103\u1161", 9, "\u1103\u1161"},
- {"다음음", 6, "\u110B\u1173\u11B7"},
- {"음다다", 6, "\u1103\u1161"},
- // maximized buffer
- {"a" + grave(30), 0, "a" + grave(30)},
- // Buffer overflow
- {"a" + grave(31), 3, grave(30)},
- // weird UTF-8
- {"a\u0300\u11B7", 0, "a\u0300\u11B7"},
-}
-
-func decomposeToLast(rb *reorderBuffer, s string) (int, []byte) {
- rb.setFlusher([]byte(s), appendFlush)
- decomposeToLastBoundary(rb)
- buf := rb.flush(nil)
- return len(rb.out), buf
-}
-
-func TestDecomposeToLastBoundary(t *testing.T) {
- runPosTests(t, "TestDecomposeToLastBoundary", NFKC, decomposeToLast, decomposeToLastTests)
-}
-
-var lastBoundaryTests = []PositionTest{
- // ends with inert character
- {"Hello!", 6, ""},
- {"\u0632", 2, ""},
- // ends with non-inert starter
- {"a", 0, ""},
- // illegal runes
- {"\xff", 1, ""},
- {"aa\xff", 3, ""},
- {"a\xff\u0300", 1, ""}, // TODO: should probably be 2.
- {"\xc0\x80\x80", 3, ""},
- {"\xc0\x80\x80\u0300", 3, ""},
- // ends with incomplete UTF-8 encoding
- {"\xCC", -1, ""},
- {"\xE0\x80", -1, ""},
- {"\xF0\x80\x80", -1, ""},
- {"a\xCC", 0, ""},
- {"\x80\xCC", 1, ""},
- {"\xCC\xCC", 1, ""},
- // ends with combining characters
- {"a\u0300\u0301", 0, ""},
- {"aaaa\u0300\u0301", 3, ""},
- {"\u0300a\u0300\u0301", 2, ""},
- {"\u00C2", 0, ""},
- {"a\u00C2", 1, ""},
- // decomposition may recombine
- {"\u0226", 0, ""},
- // no boundary
- {"", -1, ""},
- {"\u0300\u0301", -1, ""},
- {"\u0300", -1, ""},
- {"\x80\x80", -1, ""},
- {"\x80\x80\u0301", -1, ""},
- // Hangul
- {"다음", 3, ""},
- {"다", 0, ""},
- {"\u1103\u1161\u110B\u1173\u11B7", 6, ""},
- {"\u110B\u1173\u11B7\u1103\u1161", 9, ""},
- // too many combining characters.
- {grave(maxNonStarters - 1), -1, ""},
- // May still be preceded with a non-starter.
- {grave(maxNonStarters), -1, ""},
- // May still need to insert a cgj after the last combiner.
- {grave(maxNonStarters + 1), 2, ""},
- {grave(maxNonStarters + 2), 4, ""},
-
- {"a" + grave(maxNonStarters-1), 0, ""},
- {"a" + grave(maxNonStarters), 0, ""},
- // May still need to insert a cgj after the last combiner.
- {"a" + grave(maxNonStarters+1), 3, ""},
- {"a" + grave(maxNonStarters+2), 5, ""},
-}
-
-func lastBoundaryF(rb *reorderBuffer, s string) (int, []byte) {
- return rb.f.form.LastBoundary([]byte(s)), nil
-}
-
-func TestLastBoundary(t *testing.T) {
- runPosTests(t, "TestLastBoundary", NFC, lastBoundaryF, lastBoundaryTests)
-}
-
-type spanTest struct {
- input string
- atEOF bool
- n int
- err error
-}
-
-var quickSpanTests = []spanTest{
- {"", true, 0, nil},
- // starters
- {"a", true, 1, nil},
- {"abc", true, 3, nil},
- {"\u043Eb", true, 3, nil},
- // incomplete last rune.
- {"\xCC", true, 1, nil},
- {"\xCC", false, 0, transform.ErrShortSrc},
- {"a\xCC", true, 2, nil},
- {"a\xCC", false, 0, transform.ErrShortSrc}, // TODO: could be 1 for NFD
- // incorrectly ordered combining characters
- {"\u0300\u0316", true, 0, transform.ErrEndOfSpan},
- {"\u0300\u0316", false, 0, transform.ErrEndOfSpan},
- {"\u0300\u0316cd", true, 0, transform.ErrEndOfSpan},
- {"\u0300\u0316cd", false, 0, transform.ErrEndOfSpan},
- // have a maximum number of combining characters.
- {rep(0x035D, 30) + "\u035B", true, 0, transform.ErrEndOfSpan},
- {"a" + rep(0x035D, 30) + "\u035B", true, 0, transform.ErrEndOfSpan},
- {"Ɵ" + rep(0x035D, 30) + "\u035B", true, 0, transform.ErrEndOfSpan},
- {"aa" + rep(0x035D, 30) + "\u035B", true, 1, transform.ErrEndOfSpan},
- {rep(0x035D, 30) + cgj + "\u035B", true, 64, nil},
- {"a" + rep(0x035D, 30) + cgj + "\u035B", true, 65, nil},
- {"Ɵ" + rep(0x035D, 30) + cgj + "\u035B", true, 66, nil},
- {"aa" + rep(0x035D, 30) + cgj + "\u035B", true, 66, nil},
-
- {"a" + rep(0x035D, 30) + cgj + "\u035B", false, 61, transform.ErrShortSrc},
- {"Ɵ" + rep(0x035D, 30) + cgj + "\u035B", false, 62, transform.ErrShortSrc},
- {"aa" + rep(0x035D, 30) + cgj + "\u035B", false, 62, transform.ErrShortSrc},
-}
-
-var quickSpanNFDTests = []spanTest{
- // needs decomposing
- {"\u00C0", true, 0, transform.ErrEndOfSpan},
- {"abc\u00C0", true, 3, transform.ErrEndOfSpan},
- // correctly ordered combining characters
- {"\u0300", true, 2, nil},
- {"ab\u0300", true, 4, nil},
- {"ab\u0300cd", true, 6, nil},
- {"\u0300cd", true, 4, nil},
- {"\u0316\u0300", true, 4, nil},
- {"ab\u0316\u0300", true, 6, nil},
- {"ab\u0316\u0300cd", true, 8, nil},
- {"ab\u0316\u0300\u00C0", true, 6, transform.ErrEndOfSpan},
- {"\u0316\u0300cd", true, 6, nil},
- {"\u043E\u0308b", true, 5, nil},
- // incorrectly ordered combining characters
- {"ab\u0300\u0316", true, 1, transform.ErrEndOfSpan}, // TODO: we could skip 'b' as well.
- {"ab\u0300\u0316cd", true, 1, transform.ErrEndOfSpan},
- // Hangul
- {"같은", true, 0, transform.ErrEndOfSpan},
-}
-
-var quickSpanNFCTests = []spanTest{
- // okay composed
- {"\u00C0", true, 2, nil},
- {"abc\u00C0", true, 5, nil},
- // correctly ordered combining characters
- // TODO: b may combine with modifiers, which is why this fails. We could
- // make a more precise test that that actually checks whether last
- // characters combines. Probably not worth it.
- {"ab\u0300", true, 1, transform.ErrEndOfSpan},
- {"ab\u0300cd", true, 1, transform.ErrEndOfSpan},
- {"ab\u0316\u0300", true, 1, transform.ErrEndOfSpan},
- {"ab\u0316\u0300cd", true, 1, transform.ErrEndOfSpan},
- {"\u00C0\u035D", true, 4, nil},
- // we do not special case leading combining characters
- {"\u0300cd", true, 0, transform.ErrEndOfSpan},
- {"\u0300", true, 0, transform.ErrEndOfSpan},
- {"\u0316\u0300", true, 0, transform.ErrEndOfSpan},
- {"\u0316\u0300cd", true, 0, transform.ErrEndOfSpan},
- // incorrectly ordered combining characters
- {"ab\u0300\u0316", true, 1, transform.ErrEndOfSpan},
- {"ab\u0300\u0316cd", true, 1, transform.ErrEndOfSpan},
- // Hangul
- {"같은", true, 6, nil},
- {"같은", false, 3, transform.ErrShortSrc},
- // We return the start of the violating segment in case of overflow.
- {grave(30) + "\uff9e", true, 0, transform.ErrEndOfSpan},
- {grave(30), true, 0, transform.ErrEndOfSpan},
-}
-
-func runSpanTests(t *testing.T, name string, f Form, testCases []spanTest) {
- for i, tc := range testCases {
- s := fmt.Sprintf("Bytes/%s/%d=%+q/atEOF=%v", name, i, pc(tc.input), tc.atEOF)
- ok := testtext.Run(t, s, func(t *testing.T) {
- n, err := f.Span([]byte(tc.input), tc.atEOF)
- if n != tc.n || err != tc.err {
- t.Errorf("\n got %d, %v;\nwant %d, %v", n, err, tc.n, tc.err)
- }
- })
- if !ok {
- continue // Don't do the String variant if the Bytes variant failed.
- }
- s = fmt.Sprintf("String/%s/%d=%+q/atEOF=%v", name, i, pc(tc.input), tc.atEOF)
- testtext.Run(t, s, func(t *testing.T) {
- n, err := f.SpanString(tc.input, tc.atEOF)
- if n != tc.n || err != tc.err {
- t.Errorf("\n got %d, %v;\nwant %d, %v", n, err, tc.n, tc.err)
- }
- })
- }
-}
-
-func TestSpan(t *testing.T) {
- runSpanTests(t, "NFD", NFD, quickSpanTests)
- runSpanTests(t, "NFD", NFD, quickSpanNFDTests)
- runSpanTests(t, "NFC", NFC, quickSpanTests)
- runSpanTests(t, "NFC", NFC, quickSpanNFCTests)
-}
-
-var isNormalTests = []PositionTest{
- {"", 1, ""},
- // illegal runes
- {"\xff", 1, ""},
- // starters
- {"a", 1, ""},
- {"abc", 1, ""},
- {"\u043Eb", 1, ""},
- // incorrectly ordered combining characters
- {"\u0300\u0316", 0, ""},
- {"ab\u0300\u0316", 0, ""},
- {"ab\u0300\u0316cd", 0, ""},
- {"\u0300\u0316cd", 0, ""},
-}
-var isNormalNFDTests = []PositionTest{
- // needs decomposing
- {"\u00C0", 0, ""},
- {"abc\u00C0", 0, ""},
- // correctly ordered combining characters
- {"\u0300", 1, ""},
- {"ab\u0300", 1, ""},
- {"ab\u0300cd", 1, ""},
- {"\u0300cd", 1, ""},
- {"\u0316\u0300", 1, ""},
- {"ab\u0316\u0300", 1, ""},
- {"ab\u0316\u0300cd", 1, ""},
- {"\u0316\u0300cd", 1, ""},
- {"\u043E\u0308b", 1, ""},
- // Hangul
- {"같은", 0, ""},
-}
-var isNormalNFCTests = []PositionTest{
- // okay composed
- {"\u00C0", 1, ""},
- {"abc\u00C0", 1, ""},
- // need reordering
- {"a\u0300", 0, ""},
- {"a\u0300cd", 0, ""},
- {"a\u0316\u0300", 0, ""},
- {"a\u0316\u0300cd", 0, ""},
- // correctly ordered combining characters
- {"ab\u0300", 1, ""},
- {"ab\u0300cd", 1, ""},
- {"ab\u0316\u0300", 1, ""},
- {"ab\u0316\u0300cd", 1, ""},
- {"\u00C0\u035D", 1, ""},
- {"\u0300", 1, ""},
- {"\u0316\u0300cd", 1, ""},
- // Hangul
- {"같은", 1, ""},
-}
-
-var isNormalNFKXTests = []PositionTest{
- // Special case.
- {"\u00BC", 0, ""},
-}
-
-func isNormalF(rb *reorderBuffer, s string) (int, []byte) {
- if rb.f.form.IsNormal([]byte(s)) {
- return 1, nil
- }
- return 0, nil
-}
-
-func isNormalStringF(rb *reorderBuffer, s string) (int, []byte) {
- if rb.f.form.IsNormalString(s) {
- return 1, nil
- }
- return 0, nil
-}
-
-func TestIsNormal(t *testing.T) {
- runPosTests(t, "TestIsNormalNFD1", NFD, isNormalF, isNormalTests)
- runPosTests(t, "TestIsNormalNFD2", NFD, isNormalF, isNormalNFDTests)
- runPosTests(t, "TestIsNormalNFC1", NFC, isNormalF, isNormalTests)
- runPosTests(t, "TestIsNormalNFC2", NFC, isNormalF, isNormalNFCTests)
- runPosTests(t, "TestIsNormalNFKD1", NFKD, isNormalF, isNormalTests)
- runPosTests(t, "TestIsNormalNFKD2", NFKD, isNormalF, isNormalNFDTests)
- runPosTests(t, "TestIsNormalNFKD3", NFKD, isNormalF, isNormalNFKXTests)
- runPosTests(t, "TestIsNormalNFKC1", NFKC, isNormalF, isNormalTests)
- runPosTests(t, "TestIsNormalNFKC2", NFKC, isNormalF, isNormalNFCTests)
- runPosTests(t, "TestIsNormalNFKC3", NFKC, isNormalF, isNormalNFKXTests)
-}
-
-func TestIsNormalString(t *testing.T) {
- runPosTests(t, "TestIsNormalNFD1", NFD, isNormalStringF, isNormalTests)
- runPosTests(t, "TestIsNormalNFD2", NFD, isNormalStringF, isNormalNFDTests)
- runPosTests(t, "TestIsNormalNFC1", NFC, isNormalStringF, isNormalTests)
- runPosTests(t, "TestIsNormalNFC2", NFC, isNormalStringF, isNormalNFCTests)
-}
-
-type AppendTest struct {
- left string
- right string
- out string
-}
-
-type appendFunc func(f Form, out []byte, s string) []byte
-
-var fstr = []string{"NFC", "NFD", "NFKC", "NFKD"}
-
-func runNormTests(t *testing.T, name string, fn appendFunc) {
- for f := NFC; f <= NFKD; f++ {
- runAppendTests(t, name, f, fn, normTests[f])
- }
-}
-
-func runAppendTests(t *testing.T, name string, f Form, fn appendFunc, tests []AppendTest) {
- for i, test := range tests {
- t.Run(fmt.Sprintf("%s/%d", fstr[f], i), func(t *testing.T) {
- id := pc(test.left + test.right)
- if *testn >= 0 && i != *testn {
- return
- }
- t.Run("fn", func(t *testing.T) {
- out := []byte(test.left)
- have := string(fn(f, out, test.right))
- if len(have) != len(test.out) {
- t.Errorf("%+q: length is %d; want %d (%+q vs %+q)", id, len(have), len(test.out), pc(have), pc(test.out))
- }
- if have != test.out {
- k, pf := pidx(have, test.out)
- t.Errorf("%+q:\nwas %s%+q; \nwant %s%+q", id, pf, pc(have[k:]), pf, pc(test.out[k:]))
- }
- })
-
- // Bootstrap by normalizing input. Ensures that the various variants
- // behave the same.
- for g := NFC; g <= NFKD; g++ {
- if f == g {
- continue
- }
- t.Run(fstr[g], func(t *testing.T) {
- want := g.String(test.left + test.right)
- have := string(fn(g, g.AppendString(nil, test.left), test.right))
- if len(have) != len(want) {
- t.Errorf("%+q: length is %d; want %d (%+q vs %+q)", id, len(have), len(want), pc(have), pc(want))
- }
- if have != want {
- k, pf := pidx(have, want)
- t.Errorf("%+q:\nwas %s%+q; \nwant %s%+q", id, pf, pc(have[k:]), pf, pc(want[k:]))
- }
- })
- }
- })
- }
-}
-
-var normTests = [][]AppendTest{
- appendTestsNFC,
- appendTestsNFD,
- appendTestsNFKC,
- appendTestsNFKD,
-}
-
-var appendTestsNFC = []AppendTest{
- {"", ascii, ascii},
- {"", txt_all, txt_all},
- {"\uff9e", grave(30), "\uff9e" + grave(29) + cgj + grave(1)},
- {grave(30), "\uff9e", grave(30) + cgj + "\uff9e"},
-
- // Tests designed for Iter.
- { // ordering of non-composing combining characters
- "",
- "\u0305\u0316",
- "\u0316\u0305",
- },
- { // segment overflow
- "",
- "a" + rep(0x0305, maxNonStarters+4) + "\u0316",
- "a" + rep(0x0305, maxNonStarters) + cgj + "\u0316" + rep(0x305, 4),
- },
-
- { // Combine across non-blocking non-starters.
- // U+0327 COMBINING CEDILLA;Mn;202;NSM;;;;;N;NON-SPACING CEDILLA;;;;
- // U+0325 COMBINING RING BELOW;Mn;220;NSM;;;;;N;NON-SPACING RING BELOW;;;;
- "", "a\u0327\u0325", "\u1e01\u0327",
- },
-
- { // Jamo V+T does not combine.
- "",
- "\u1161\u11a8",
- "\u1161\u11a8",
- },
-
- // Stability tests: see http://www.unicode.org/review/pr-29.html.
- {"", "\u0b47\u0300\u0b3e", "\u0b47\u0300\u0b3e"},
- {"", "\u1100\u0300\u1161", "\u1100\u0300\u1161"},
- {"", "\u0b47\u0b3e", "\u0b4b"},
- {"", "\u1100\u1161", "\uac00"},
-
- // U+04DA MALAYALAM VOWEL SIGN O;Mc;0;L;0D46 0D3E;;;;N;;;;;
- { // 0d4a starts a new segment.
- "",
- "\u0d4a" + strings.Repeat("\u0d3e", 15) + "\u0d4a" + strings.Repeat("\u0d3e", 15),
- "\u0d4a" + strings.Repeat("\u0d3e", 15) + "\u0d4a" + strings.Repeat("\u0d3e", 15),
- },
-
- { // Split combining characters.
- // TODO: don't insert CGJ before starters.
- "",
- "\u0d46" + strings.Repeat("\u0d3e", 31),
- "\u0d4a" + strings.Repeat("\u0d3e", 29) + cgj + "\u0d3e",
- },
-
- { // Split combining characters.
- "",
- "\u0d4a" + strings.Repeat("\u0d3e", 30),
- "\u0d4a" + strings.Repeat("\u0d3e", 29) + cgj + "\u0d3e",
- },
-
- { // https://golang.org/issues/20079
- "",
- "\xeb\u0344",
- "\xeb\u0308\u0301",
- },
-
- { // https://golang.org/issues/20079
- "",
- "\uac00" + strings.Repeat("\u0300", 30),
- "\uac00" + strings.Repeat("\u0300", 29) + "\u034f\u0300",
- },
-
- { // https://golang.org/issues/20079
- "",
- "\xeb" + strings.Repeat("\u0300", 31),
- "\xeb" + strings.Repeat("\u0300", 30) + "\u034f\u0300",
- },
-}
-
-var appendTestsNFD = []AppendTest{
- // TODO: Move some of the tests here.
-}
-
-var appendTestsNFKC = []AppendTest{
- // empty buffers
- {"", "", ""},
- {"a", "", "a"},
- {"", "a", "a"},
- {"", "\u0041\u0307\u0304", "\u01E0"},
- // segment split across buffers
- {"", "a\u0300b", "\u00E0b"},
- {"a", "\u0300b", "\u00E0b"},
- {"a", "\u0300\u0316", "\u00E0\u0316"},
- {"a", "\u0316\u0300", "\u00E0\u0316"},
- {"a", "\u0300a\u0300", "\u00E0\u00E0"},
- {"a", "\u0300a\u0300a\u0300", "\u00E0\u00E0\u00E0"},
- {"a", "\u0300aaa\u0300aaa\u0300", "\u00E0aa\u00E0aa\u00E0"},
- {"a\u0300", "\u0327", "\u00E0\u0327"},
- {"a\u0327", "\u0300", "\u00E0\u0327"},
- {"a\u0316", "\u0300", "\u00E0\u0316"},
- {"\u0041\u0307", "\u0304", "\u01E0"},
- // Hangul
- {"", "\u110B\u1173", "\uC73C"},
- {"", "\u1103\u1161", "\uB2E4"},
- {"", "\u110B\u1173\u11B7", "\uC74C"},
- {"", "\u320E", "\x28\uAC00\x29"},
- {"", "\x28\u1100\u1161\x29", "\x28\uAC00\x29"},
- {"\u1103", "\u1161", "\uB2E4"},
- {"\u110B", "\u1173\u11B7", "\uC74C"},
- {"\u110B\u1173", "\u11B7", "\uC74C"},
- {"\uC73C", "\u11B7", "\uC74C"},
- // UTF-8 encoding split across buffers
- {"a\xCC", "\x80", "\u00E0"},
- {"a\xCC", "\x80b", "\u00E0b"},
- {"a\xCC", "\x80a\u0300", "\u00E0\u00E0"},
- {"a\xCC", "\x80\x80", "\u00E0\x80"},
- {"a\xCC", "\x80\xCC", "\u00E0\xCC"},
- {"a\u0316\xCC", "\x80a\u0316\u0300", "\u00E0\u0316\u00E0\u0316"},
- // ending in incomplete UTF-8 encoding
- {"", "\xCC", "\xCC"},
- {"a", "\xCC", "a\xCC"},
- {"a", "b\xCC", "ab\xCC"},
- {"\u0226", "\xCC", "\u0226\xCC"},
- // illegal runes
- {"", "\x80", "\x80"},
- {"", "\x80\x80\x80", "\x80\x80\x80"},
- {"", "\xCC\x80\x80\x80", "\xCC\x80\x80\x80"},
- {"", "a\x80", "a\x80"},
- {"", "a\x80\x80\x80", "a\x80\x80\x80"},
- {"", "a\x80\x80\x80\x80\x80\x80", "a\x80\x80\x80\x80\x80\x80"},
- {"a", "\x80\x80\x80", "a\x80\x80\x80"},
- // overflow
- {"", strings.Repeat("\x80", 33), strings.Repeat("\x80", 33)},
- {strings.Repeat("\x80", 33), "", strings.Repeat("\x80", 33)},
- {strings.Repeat("\x80", 33), strings.Repeat("\x80", 33), strings.Repeat("\x80", 66)},
- // overflow of combining characters
- {"", grave(34), grave(30) + cgj + grave(4)},
- {"", grave(36), grave(30) + cgj + grave(6)},
- {grave(29), grave(5), grave(30) + cgj + grave(4)},
- {grave(30), grave(4), grave(30) + cgj + grave(4)},
- {grave(30), grave(3), grave(30) + cgj + grave(3)},
- {grave(30) + "\xCC", "\x80", grave(30) + cgj + grave(1)},
- {"", "\uFDFA" + grave(14), "\u0635\u0644\u0649 \u0627\u0644\u0644\u0647 \u0639\u0644\u064a\u0647 \u0648\u0633\u0644\u0645" + grave(14)},
- {"", "\uFDFA" + grave(28) + "\u0316", "\u0635\u0644\u0649 \u0627\u0644\u0644\u0647 \u0639\u0644\u064a\u0647 \u0648\u0633\u0644\u0645\u0316" + grave(28)},
- // - First rune has a trailing non-starter.
- {"\u00d5", grave(30), "\u00d5" + grave(29) + cgj + grave(1)},
- // - U+FF9E decomposes into a non-starter in compatibility mode. A CGJ must be
- // inserted even when FF9E starts a new segment.
- {"\uff9e", grave(30), "\u3099" + grave(29) + cgj + grave(1)},
- {grave(30), "\uff9e", grave(30) + cgj + "\u3099"},
- // - Many non-starter decompositions in a row causing overflow.
- {"", rep(0x340, 31), rep(0x300, 30) + cgj + "\u0300"},
- {"", rep(0xFF9E, 31), rep(0x3099, 30) + cgj + "\u3099"},
-
- {"", "\u0644\u0625" + rep(0x300, 31), "\u0644\u0625" + rep(0x300, 29) + cgj + "\u0300\u0300"},
- {"", "\ufef9" + rep(0x300, 31), "\u0644\u0625" + rep(0x300, 29) + cgj + rep(0x0300, 2)},
- {"", "\ufef9" + rep(0x300, 31), "\u0644\u0625" + rep(0x300, 29) + cgj + rep(0x0300, 2)},
-
- // U+0F81 TIBETAN VOWEL SIGN REVERSED II splits into two modifiers.
- {"", "\u0f7f" + rep(0xf71, 29) + "\u0f81", "\u0f7f" + rep(0xf71, 29) + cgj + "\u0f71\u0f80"},
- {"", "\u0f7f" + rep(0xf71, 28) + "\u0f81", "\u0f7f" + rep(0xf71, 29) + "\u0f80"},
- {"", "\u0f7f" + rep(0xf81, 16), "\u0f7f" + rep(0xf71, 15) + rep(0xf80, 15) + cgj + "\u0f71\u0f80"},
-
- // weird UTF-8
- {"\u00E0\xE1", "\x86", "\u00E0\xE1\x86"},
- {"a\u0300\u11B7", "\u0300", "\u00E0\u11B7\u0300"},
- {"a\u0300\u11B7\u0300", "\u0300", "\u00E0\u11B7\u0300\u0300"},
- {"\u0300", "\xF8\x80\x80\x80\x80\u0300", "\u0300\xF8\x80\x80\x80\x80\u0300"},
- {"\u0300", "\xFC\x80\x80\x80\x80\x80\u0300", "\u0300\xFC\x80\x80\x80\x80\x80\u0300"},
- {"\xF8\x80\x80\x80\x80\u0300", "\u0300", "\xF8\x80\x80\x80\x80\u0300\u0300"},
- {"\xFC\x80\x80\x80\x80\x80\u0300", "\u0300", "\xFC\x80\x80\x80\x80\x80\u0300\u0300"},
- {"\xF8\x80\x80\x80", "\x80\u0300\u0300", "\xF8\x80\x80\x80\x80\u0300\u0300"},
-
- {"", strings.Repeat("a\u0316\u0300", 6), strings.Repeat("\u00E0\u0316", 6)},
- // large input.
- {"", strings.Repeat("a\u0300\u0316", 31), strings.Repeat("\u00E0\u0316", 31)},
- {"", strings.Repeat("a\u0300\u0316", 4000), strings.Repeat("\u00E0\u0316", 4000)},
- {"", strings.Repeat("\x80\x80", 4000), strings.Repeat("\x80\x80", 4000)},
- {"", "\u0041\u0307\u0304", "\u01E0"},
-}
-
-var appendTestsNFKD = []AppendTest{
- {"", "a" + grave(64), "a" + grave(30) + cgj + grave(30) + cgj + grave(4)},
-
- { // segment overflow on unchanged character
- "",
- "a" + grave(64) + "\u0316",
- "a" + grave(30) + cgj + grave(30) + cgj + "\u0316" + grave(4),
- },
- { // segment overflow on unchanged character + start value
- "",
- "a" + grave(98) + "\u0316",
- "a" + grave(30) + cgj + grave(30) + cgj + grave(30) + cgj + "\u0316" + grave(8),
- },
- { // segment overflow on decomposition. (U+0340 decomposes to U+0300.)
- "",
- "a" + grave(59) + "\u0340",
- "a" + grave(30) + cgj + grave(30),
- },
- { // segment overflow on non-starter decomposition
- "",
- "a" + grave(33) + "\u0340" + grave(30) + "\u0320",
- "a" + grave(30) + cgj + grave(30) + cgj + "\u0320" + grave(4),
- },
- { // start value after ASCII overflow
- "",
- rep('a', segSize) + grave(32) + "\u0320",
- rep('a', segSize) + grave(30) + cgj + "\u0320" + grave(2),
- },
- { // Jamo overflow
- "",
- "\u1100\u1161" + grave(30) + "\u0320" + grave(2),
- "\u1100\u1161" + grave(29) + cgj + "\u0320" + grave(3),
- },
- { // Hangul
- "",
- "\uac00",
- "\u1100\u1161",
- },
- { // Hangul overflow
- "",
- "\uac00" + grave(32) + "\u0320",
- "\u1100\u1161" + grave(29) + cgj + "\u0320" + grave(3),
- },
- { // Hangul overflow in Hangul mode.
- "",
- "\uac00\uac00" + grave(32) + "\u0320",
- "\u1100\u1161\u1100\u1161" + grave(29) + cgj + "\u0320" + grave(3),
- },
- { // Hangul overflow in Hangul mode.
- "",
- strings.Repeat("\uac00", 3) + grave(32) + "\u0320",
- strings.Repeat("\u1100\u1161", 3) + grave(29) + cgj + "\u0320" + grave(3),
- },
- { // start value after cc=0
- "",
- "您您" + grave(34) + "\u0320",
- "您您" + grave(30) + cgj + "\u0320" + grave(4),
- },
- { // start value after normalization
- "",
- "\u0300\u0320a" + grave(34) + "\u0320",
- "\u0320\u0300a" + grave(30) + cgj + "\u0320" + grave(4),
- },
- {
- // U+0F81 TIBETAN VOWEL SIGN REVERSED II splits into two modifiers.
- "",
- "a\u0f7f" + rep(0xf71, 29) + "\u0f81",
- "a\u0f7f" + rep(0xf71, 29) + cgj + "\u0f71\u0f80",
- },
-}
-
-func TestAppend(t *testing.T) {
- runNormTests(t, "Append", func(f Form, out []byte, s string) []byte {
- return f.Append(out, []byte(s)...)
- })
-}
-
-func TestAppendString(t *testing.T) {
- runNormTests(t, "AppendString", func(f Form, out []byte, s string) []byte {
- return f.AppendString(out, s)
- })
-}
-
-func TestBytes(t *testing.T) {
- runNormTests(t, "Bytes", func(f Form, out []byte, s string) []byte {
- buf := []byte{}
- buf = append(buf, out...)
- buf = append(buf, s...)
- return f.Bytes(buf)
- })
-}
-
-func TestString(t *testing.T) {
- runNormTests(t, "String", func(f Form, out []byte, s string) []byte {
- outs := string(out) + s
- return []byte(f.String(outs))
- })
-}
-
-func TestLinking(t *testing.T) {
- const prog = `
- package main
- import "fmt"
- import "golang.org/x/text/unicode/norm"
- func main() { fmt.Println(norm.%s) }
- `
- baseline, errB := testtext.CodeSize(fmt.Sprintf(prog, "MaxSegmentSize"))
- withTables, errT := testtext.CodeSize(fmt.Sprintf(prog, `NFC.String("")`))
- if errB != nil || errT != nil {
- t.Skipf("code size failed: %v and %v", errB, errT)
- }
- // Tables are at least 50K
- if d := withTables - baseline; d < 50*1024 {
- t.Errorf("tables appear not to be dropped: %d - %d = %d",
- withTables, baseline, d)
- }
-}
-
-func appendBench(f Form, in []byte) func() {
- buf := make([]byte, 0, 4*len(in))
- return func() {
- f.Append(buf, in...)
- }
-}
-
-func bytesBench(f Form, in []byte) func() {
- return func() {
- f.Bytes(in)
- }
-}
-
-func iterBench(f Form, in []byte) func() {
- iter := Iter{}
- return func() {
- iter.Init(f, in)
- for !iter.Done() {
- iter.Next()
- }
- }
-}
-
-func transformBench(f Form, in []byte) func() {
- buf := make([]byte, 4*len(in))
- return func() {
- if _, n, err := f.Transform(buf, in, true); err != nil || len(in) != n {
- log.Panic(n, len(in), err)
- }
- }
-}
-
-func readerBench(f Form, in []byte) func() {
- buf := make([]byte, 4*len(in))
- return func() {
- r := f.Reader(bytes.NewReader(in))
- var err error
- for err == nil {
- _, err = r.Read(buf)
- }
- if err != io.EOF {
- panic("")
- }
- }
-}
-
-func writerBench(f Form, in []byte) func() {
- buf := make([]byte, 0, 4*len(in))
- return func() {
- r := f.Writer(bytes.NewBuffer(buf))
- if _, err := r.Write(in); err != nil {
- panic("")
- }
- }
-}
-
-func appendBenchmarks(bm []func(), f Form, in []byte) []func() {
- bm = append(bm, appendBench(f, in))
- bm = append(bm, iterBench(f, in))
- bm = append(bm, transformBench(f, in))
- bm = append(bm, readerBench(f, in))
- bm = append(bm, writerBench(f, in))
- return bm
-}
-
-func doFormBenchmark(b *testing.B, inf, f Form, s string) {
- b.StopTimer()
- in := inf.Bytes([]byte(s))
- bm := appendBenchmarks(nil, f, in)
- b.SetBytes(int64(len(in) * len(bm)))
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- for _, fn := range bm {
- fn()
- }
- }
-}
-
-func doSingle(b *testing.B, f func(Form, []byte) func(), s []byte) {
- b.StopTimer()
- fn := f(NFC, s)
- b.SetBytes(int64(len(s)))
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- fn()
- }
-}
-
-var (
- smallNoChange = []byte("nörmalization")
- smallChange = []byte("No\u0308rmalization")
- ascii = strings.Repeat("There is nothing to change here! ", 500)
-)
-
-func lowerBench(f Form, in []byte) func() {
- // Use package strings instead of bytes as it doesn't allocate memory
- // if there aren't any changes.
- s := string(in)
- return func() {
- strings.ToLower(s)
- }
-}
-
-func BenchmarkLowerCaseNoChange(b *testing.B) {
- doSingle(b, lowerBench, smallNoChange)
-}
-func BenchmarkLowerCaseChange(b *testing.B) {
- doSingle(b, lowerBench, smallChange)
-}
-
-func quickSpanBench(f Form, in []byte) func() {
- return func() {
- f.QuickSpan(in)
- }
-}
-
-func BenchmarkQuickSpanChangeNFC(b *testing.B) {
- doSingle(b, quickSpanBench, smallNoChange)
-}
-
-func BenchmarkBytesNoChangeNFC(b *testing.B) {
- doSingle(b, bytesBench, smallNoChange)
-}
-func BenchmarkBytesChangeNFC(b *testing.B) {
- doSingle(b, bytesBench, smallChange)
-}
-
-func BenchmarkAppendNoChangeNFC(b *testing.B) {
- doSingle(b, appendBench, smallNoChange)
-}
-func BenchmarkAppendChangeNFC(b *testing.B) {
- doSingle(b, appendBench, smallChange)
-}
-func BenchmarkAppendLargeNFC(b *testing.B) {
- doSingle(b, appendBench, txt_all_bytes)
-}
-
-func BenchmarkIterNoChangeNFC(b *testing.B) {
- doSingle(b, iterBench, smallNoChange)
-}
-func BenchmarkIterChangeNFC(b *testing.B) {
- doSingle(b, iterBench, smallChange)
-}
-func BenchmarkIterLargeNFC(b *testing.B) {
- doSingle(b, iterBench, txt_all_bytes)
-}
-
-func BenchmarkTransformNoChangeNFC(b *testing.B) {
- doSingle(b, transformBench, smallNoChange)
-}
-func BenchmarkTransformChangeNFC(b *testing.B) {
- doSingle(b, transformBench, smallChange)
-}
-func BenchmarkTransformLargeNFC(b *testing.B) {
- doSingle(b, transformBench, txt_all_bytes)
-}
-
-func BenchmarkNormalizeAsciiNFC(b *testing.B) {
- doFormBenchmark(b, NFC, NFC, ascii)
-}
-func BenchmarkNormalizeAsciiNFD(b *testing.B) {
- doFormBenchmark(b, NFC, NFD, ascii)
-}
-func BenchmarkNormalizeAsciiNFKC(b *testing.B) {
- doFormBenchmark(b, NFC, NFKC, ascii)
-}
-func BenchmarkNormalizeAsciiNFKD(b *testing.B) {
- doFormBenchmark(b, NFC, NFKD, ascii)
-}
-
-func BenchmarkNormalizeNFC2NFC(b *testing.B) {
- doFormBenchmark(b, NFC, NFC, txt_all)
-}
-func BenchmarkNormalizeNFC2NFD(b *testing.B) {
- doFormBenchmark(b, NFC, NFD, txt_all)
-}
-func BenchmarkNormalizeNFD2NFC(b *testing.B) {
- doFormBenchmark(b, NFD, NFC, txt_all)
-}
-func BenchmarkNormalizeNFD2NFD(b *testing.B) {
- doFormBenchmark(b, NFD, NFD, txt_all)
-}
-
-// Hangul is often special-cased, so we test it separately.
-func BenchmarkNormalizeHangulNFC2NFC(b *testing.B) {
- doFormBenchmark(b, NFC, NFC, txt_kr)
-}
-func BenchmarkNormalizeHangulNFC2NFD(b *testing.B) {
- doFormBenchmark(b, NFC, NFD, txt_kr)
-}
-func BenchmarkNormalizeHangulNFD2NFC(b *testing.B) {
- doFormBenchmark(b, NFD, NFC, txt_kr)
-}
-func BenchmarkNormalizeHangulNFD2NFD(b *testing.B) {
- doFormBenchmark(b, NFD, NFD, txt_kr)
-}
-
-var forms = []Form{NFC, NFD, NFKC, NFKD}
-
-func doTextBenchmark(b *testing.B, s string) {
- b.StopTimer()
- in := []byte(s)
- bm := []func(){}
- for _, f := range forms {
- bm = appendBenchmarks(bm, f, in)
- }
- b.SetBytes(int64(len(s) * len(bm)))
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- for _, f := range bm {
- f()
- }
- }
-}
-
-func BenchmarkCanonicalOrdering(b *testing.B) {
- doTextBenchmark(b, txt_canon)
-}
-func BenchmarkExtendedLatin(b *testing.B) {
- doTextBenchmark(b, txt_vn)
-}
-func BenchmarkMiscTwoByteUtf8(b *testing.B) {
- doTextBenchmark(b, twoByteUtf8)
-}
-func BenchmarkMiscThreeByteUtf8(b *testing.B) {
- doTextBenchmark(b, threeByteUtf8)
-}
-func BenchmarkHangul(b *testing.B) {
- doTextBenchmark(b, txt_kr)
-}
-func BenchmarkJapanese(b *testing.B) {
- doTextBenchmark(b, txt_jp)
-}
-func BenchmarkChinese(b *testing.B) {
- doTextBenchmark(b, txt_cn)
-}
-func BenchmarkOverflow(b *testing.B) {
- doTextBenchmark(b, overflow)
-}
-
-var overflow = string(bytes.Repeat([]byte("\u035D"), 4096)) + "\u035B"
-
-// Tests sampled from the Canonical ordering tests (Part 2) of
-// http://unicode.org/Public/UNIDATA/NormalizationTest.txt
-const txt_canon = `\u0061\u0315\u0300\u05AE\u0300\u0062 \u0061\u0300\u0315\u0300\u05AE\u0062
-\u0061\u0302\u0315\u0300\u05AE\u0062 \u0061\u0307\u0315\u0300\u05AE\u0062
-\u0061\u0315\u0300\u05AE\u030A\u0062 \u0061\u059A\u0316\u302A\u031C\u0062
-\u0061\u032E\u059A\u0316\u302A\u0062 \u0061\u0338\u093C\u0334\u0062
-\u0061\u059A\u0316\u302A\u0339 \u0061\u0341\u0315\u0300\u05AE\u0062
-\u0061\u0348\u059A\u0316\u302A\u0062 \u0061\u0361\u0345\u035D\u035C\u0062
-\u0061\u0366\u0315\u0300\u05AE\u0062 \u0061\u0315\u0300\u05AE\u0486\u0062
-\u0061\u05A4\u059A\u0316\u302A\u0062 \u0061\u0315\u0300\u05AE\u0613\u0062
-\u0061\u0315\u0300\u05AE\u0615\u0062 \u0061\u0617\u0315\u0300\u05AE\u0062
-\u0061\u0619\u0618\u064D\u064E\u0062 \u0061\u0315\u0300\u05AE\u0654\u0062
-\u0061\u0315\u0300\u05AE\u06DC\u0062 \u0061\u0733\u0315\u0300\u05AE\u0062
-\u0061\u0744\u059A\u0316\u302A\u0062 \u0061\u0315\u0300\u05AE\u0745\u0062
-\u0061\u09CD\u05B0\u094D\u3099\u0062 \u0061\u0E38\u0E48\u0E38\u0C56\u0062
-\u0061\u0EB8\u0E48\u0E38\u0E49\u0062 \u0061\u0F72\u0F71\u0EC8\u0F71\u0062
-\u0061\u1039\u05B0\u094D\u3099\u0062 \u0061\u05B0\u094D\u3099\u1A60\u0062
-\u0061\u3099\u093C\u0334\u1BE6\u0062 \u0061\u3099\u093C\u0334\u1C37\u0062
-\u0061\u1CD9\u059A\u0316\u302A\u0062 \u0061\u2DED\u0315\u0300\u05AE\u0062
-\u0061\u2DEF\u0315\u0300\u05AE\u0062 \u0061\u302D\u302E\u059A\u0316\u0062`
-
-// Taken from http://creativecommons.org/licenses/by-sa/3.0/vn/
-const txt_vn = `Với các điều kiện sau: Ghi nhận công của tác giả.
-Nếu bạn sử dụng, chuyển đổi, hoặc xây dựng dự án từ
-nội dung được chia sẻ này, bạn phải áp dụng giấy phép này hoặc
-một giấy phép khác có các điều khoản tương tự như giấy phép này
-cho dự án của bạn. Hiểu rằng: Miễn — Bất kỳ các điều kiện nào
-trên đây cũng có thể được miễn bỏ nếu bạn được sự cho phép của
-người sở hữu bản quyền. Phạm vi công chúng — Khi tác phẩm hoặc
-bất kỳ chương nào của tác phẩm đã trong vùng dành cho công
-chúng theo quy định của pháp luật thì tình trạng của nó không
-bị ảnh hưởng bởi giấy phép trong bất kỳ trường hợp nào.`
-
-// Taken from http://creativecommons.org/licenses/by-sa/1.0/deed.ru
-const txt_ru = `При обязательном соблюдении следующих условий:
-Attribution — Вы должны атрибутировать произведение (указывать
-автора и источник) в порядке, предусмотренном автором или
-лицензиаром (но только так, чтобы никоим образом не подразумевалось,
-что они поддерживают вас или использование вами данного произведения).
-Υπό τις ακόλουθες προϋποθέσεις:`
-
-// Taken from http://creativecommons.org/licenses/by-sa/3.0/gr/
-const txt_gr = `Αναφορά Δημιουργού — Θα πρέπει να κάνετε την αναφορά στο έργο με τον
-τρόπο που έχει οριστεί από το δημιουργό ή το χορηγούντο την άδεια
-(χωρίς όμως να εννοείται με οποιονδήποτε τρόπο ότι εγκρίνουν εσάς ή
-τη χρήση του έργου από εσάς). Παρόμοια Διανομή — Εάν αλλοιώσετε,
-τροποποιήσετε ή δημιουργήσετε περαιτέρω βασισμένοι στο έργο θα
-μπορείτε να διανέμετε το έργο που θα προκύψει μόνο με την ίδια ή
-παρόμοια άδεια.`
-
-// Taken from http://creativecommons.org/licenses/by-sa/3.0/deed.ar
-const txt_ar = `بموجب الشروط التالية نسب المصنف — يجب عليك أن
-تنسب العمل بالطريقة التي تحددها المؤلف أو المرخص (ولكن ليس بأي حال من
-الأحوال أن توحي وتقترح بتحول أو استخدامك للعمل).
-المشاركة على قدم المساواة — إذا كنت يعدل ، والتغيير ، أو الاستفادة
-من هذا العمل ، قد ينتج عن توزيع العمل إلا في ظل تشابه او تطابق فى واحد
-لهذا الترخيص.`
-
-// Taken from http://creativecommons.org/licenses/by-sa/1.0/il/
-const txt_il = `בכפוף לתנאים הבאים: ייחוס — עליך לייחס את היצירה (לתת קרדיט) באופן
-המצויין על-ידי היוצר או מעניק הרישיון (אך לא בשום אופן המרמז על כך
-שהם תומכים בך או בשימוש שלך ביצירה). שיתוף זהה — אם תחליט/י לשנות,
-לעבד או ליצור יצירה נגזרת בהסתמך על יצירה זו, תוכל/י להפיץ את יצירתך
-החדשה רק תחת אותו הרישיון או רישיון דומה לרישיון זה.`
-
-const twoByteUtf8 = txt_ru + txt_gr + txt_ar + txt_il
-
-// Taken from http://creativecommons.org/licenses/by-sa/2.0/kr/
-const txt_kr = `다음과 같은 조건을 따라야 합니다: 저작자표시
-(Attribution) — 저작자나 이용허락자가 정한 방법으로 저작물의
-원저작자를 표시하여야 합니다(그러나 원저작자가 이용자나 이용자의
-이용을 보증하거나 추천한다는 의미로 표시해서는 안됩니다).
-동일조건변경허락 — 이 저작물을 이용하여 만든 이차적 저작물에는 본
-라이선스와 동일한 라이선스를 적용해야 합니다.`
-
-// Taken from http://creativecommons.org/licenses/by-sa/3.0/th/
-const txt_th = `ภายใต้เงื่อนไข ดังต่อไปนี้ : แสดงที่มา — คุณต้องแสดงที่
-มาของงานดังกล่าว ตามรูปแบบที่ผู้สร้างสรรค์หรือผู้อนุญาตกำหนด (แต่
-ไม่ใช่ในลักษณะที่ว่า พวกเขาสนับสนุนคุณหรือสนับสนุนการที่
-คุณนำงานไปใช้) อนุญาตแบบเดียวกัน — หากคุณดัดแปลง เปลี่ยนรูป หรื
-อต่อเติมงานนี้ คุณต้องใช้สัญญาอนุญาตแบบเดียวกันหรือแบบที่เหมื
-อนกับสัญญาอนุญาตที่ใช้กับงานนี้เท่านั้น`
-
-const threeByteUtf8 = txt_th
-
-// Taken from http://creativecommons.org/licenses/by-sa/2.0/jp/
-const txt_jp = `あなたの従うべき条件は以下の通りです。
-表示 — あなたは原著作者のクレジットを表示しなければなりません。
-継承 — もしあなたがこの作品を改変、変形または加工した場合、
-あなたはその結果生じた作品をこの作品と同一の許諾条件の下でのみ
-頒布することができます。`
-
-// http://creativecommons.org/licenses/by-sa/2.5/cn/
-const txt_cn = `您可以自由: 复制、发行、展览、表演、放映、
-广播或通过信息网络传播本作品 创作演绎作品
-对本作品进行商业性使用 惟须遵守下列条件:
-署名 — 您必须按照作者或者许可人指定的方式对作品进行署名。
-相同方式共享 — 如果您改变、转换本作品或者以本作品为基础进行创作,
-您只能采用与本协议相同的许可协议发布基于本作品的演绎作品。`
-
-const txt_cjk = txt_cn + txt_jp + txt_kr
-const txt_all = txt_vn + twoByteUtf8 + threeByteUtf8 + txt_cjk
-
-var txt_all_bytes = []byte(txt_all)
diff --git a/vendor/golang.org/x/text/unicode/norm/readwriter_test.go b/vendor/golang.org/x/text/unicode/norm/readwriter_test.go
deleted file mode 100644
index b7756ba24..000000000
--- a/vendor/golang.org/x/text/unicode/norm/readwriter_test.go
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package norm
-
-import (
- "bytes"
- "fmt"
- "testing"
-)
-
-var bufSizes = []int{1, 2, 3, 4, 5, 6, 7, 8, 100, 101, 102, 103, 4000, 4001, 4002, 4003}
-
-func readFunc(size int) appendFunc {
- return func(f Form, out []byte, s string) []byte {
- out = append(out, s...)
- r := f.Reader(bytes.NewBuffer(out))
- buf := make([]byte, size)
- result := []byte{}
- for n, err := 0, error(nil); err == nil; {
- n, err = r.Read(buf)
- result = append(result, buf[:n]...)
- }
- return result
- }
-}
-
-func TestReader(t *testing.T) {
- for _, s := range bufSizes {
- name := fmt.Sprintf("TestReader%d", s)
- runNormTests(t, name, readFunc(s))
- }
-}
-
-func writeFunc(size int) appendFunc {
- return func(f Form, out []byte, s string) []byte {
- in := append(out, s...)
- result := new(bytes.Buffer)
- w := f.Writer(result)
- buf := make([]byte, size)
- for n := 0; len(in) > 0; in = in[n:] {
- n = copy(buf, in)
- _, _ = w.Write(buf[:n])
- }
- w.Close()
- return result.Bytes()
- }
-}
-
-func TestWriter(t *testing.T) {
- for _, s := range bufSizes {
- name := fmt.Sprintf("TestWriter%d", s)
- runNormTests(t, name, writeFunc(s))
- }
-}
diff --git a/vendor/golang.org/x/text/unicode/norm/transform_test.go b/vendor/golang.org/x/text/unicode/norm/transform_test.go
deleted file mode 100644
index d596ff3d8..000000000
--- a/vendor/golang.org/x/text/unicode/norm/transform_test.go
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package norm
-
-import (
- "fmt"
- "testing"
-
- "golang.org/x/text/transform"
-)
-
-func TestTransform(t *testing.T) {
- tests := []struct {
- f Form
- in, out string
- eof bool
- dstSize int
- err error
- }{
- {NFC, "ab", "ab", true, 2, nil},
- {NFC, "qx", "qx", true, 2, nil},
- {NFD, "qx", "qx", true, 2, nil},
- {NFC, "", "", true, 1, nil},
- {NFD, "", "", true, 1, nil},
- {NFC, "", "", false, 1, nil},
- {NFD, "", "", false, 1, nil},
-
- // Normalized segment does not fit in destination.
- {NFD, "ö", "", true, 1, transform.ErrShortDst},
- {NFD, "ö", "", true, 2, transform.ErrShortDst},
-
- // As an artifact of the algorithm, only full segments are written.
- // This is not strictly required, and some bytes could be written.
- // In practice, for Transform to not block, the destination buffer
- // should be at least MaxSegmentSize to work anyway and these edge
- // conditions will be relatively rare.
- {NFC, "ab", "", true, 1, transform.ErrShortDst},
- // This is even true for inert runes.
- {NFC, "qx", "", true, 1, transform.ErrShortDst},
- {NFC, "a\u0300abc", "\u00e0a", true, 4, transform.ErrShortDst},
-
- // We cannot write a segment if successive runes could still change the result.
- {NFD, "ö", "", false, 3, transform.ErrShortSrc},
- {NFC, "a\u0300", "", false, 4, transform.ErrShortSrc},
- {NFD, "a\u0300", "", false, 4, transform.ErrShortSrc},
- {NFC, "ö", "", false, 3, transform.ErrShortSrc},
-
- {NFC, "a\u0300", "", true, 1, transform.ErrShortDst},
- // Theoretically could fit, but won't due to simplified checks.
- {NFC, "a\u0300", "", true, 2, transform.ErrShortDst},
- {NFC, "a\u0300", "", true, 3, transform.ErrShortDst},
- {NFC, "a\u0300", "\u00e0", true, 4, nil},
-
- {NFD, "öa\u0300", "o\u0308", false, 8, transform.ErrShortSrc},
- {NFD, "öa\u0300ö", "o\u0308a\u0300", true, 8, transform.ErrShortDst},
- {NFD, "öa\u0300ö", "o\u0308a\u0300", false, 12, transform.ErrShortSrc},
-
- // Illegal input is copied verbatim.
- {NFD, "\xbd\xb2=\xbc ", "\xbd\xb2=\xbc ", true, 8, nil},
- }
- b := make([]byte, 100)
- for i, tt := range tests {
- nDst, _, err := tt.f.Transform(b[:tt.dstSize], []byte(tt.in), tt.eof)
- out := string(b[:nDst])
- if out != tt.out || err != tt.err {
- t.Errorf("%d: was %+q (%v); want %+q (%v)", i, out, err, tt.out, tt.err)
- }
- if want := tt.f.String(tt.in)[:nDst]; want != out {
- t.Errorf("%d: incorrect normalization: was %+q; want %+q", i, out, want)
- }
- }
-}
-
-var transBufSizes = []int{
- MaxTransformChunkSize,
- 3 * MaxTransformChunkSize / 2,
- 2 * MaxTransformChunkSize,
- 3 * MaxTransformChunkSize,
- 100 * MaxTransformChunkSize,
-}
-
-func doTransNorm(f Form, buf []byte, b []byte) []byte {
- acc := []byte{}
- for p := 0; p < len(b); {
- nd, ns, _ := f.Transform(buf[:], b[p:], true)
- p += ns
- acc = append(acc, buf[:nd]...)
- }
- return acc
-}
-
-func TestTransformNorm(t *testing.T) {
- for _, sz := range transBufSizes {
- buf := make([]byte, sz)
- runNormTests(t, fmt.Sprintf("Transform:%d", sz), func(f Form, out []byte, s string) []byte {
- return doTransNorm(f, buf, append(out, s...))
- })
- }
-}
diff --git a/vendor/golang.org/x/text/unicode/norm/ucd_test.go b/vendor/golang.org/x/text/unicode/norm/ucd_test.go
deleted file mode 100644
index 29205a6aa..000000000
--- a/vendor/golang.org/x/text/unicode/norm/ucd_test.go
+++ /dev/null
@@ -1,275 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package norm
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "regexp"
- "runtime"
- "strconv"
- "strings"
- "sync"
- "testing"
- "time"
- "unicode/utf8"
-
- "golang.org/x/text/internal/gen"
- "golang.org/x/text/internal/testtext"
-)
-
-var once sync.Once
-
-func skipShort(t *testing.T) {
- testtext.SkipIfNotLong(t)
-
- once.Do(func() { loadTestData(t) })
-}
-
-// This regression test runs the test set in NormalizationTest.txt
-// (taken from http://www.unicode.org/Public/<unicode.Version>/ucd/).
-//
-// NormalizationTest.txt has form:
-// @Part0 # Specific cases
-// #
-// 1E0A;1E0A;0044 0307;1E0A;0044 0307; # (Ḋ; Ḋ; D◌̇; Ḋ; D◌̇; ) LATIN CAPITAL LETTER D WITH DOT ABOVE
-// 1E0C;1E0C;0044 0323;1E0C;0044 0323; # (Ḍ; Ḍ; D◌̣; Ḍ; D◌̣; ) LATIN CAPITAL LETTER D WITH DOT BELOW
-//
-// Each test has 5 columns (c1, c2, c3, c4, c5), where
-// (c1, c2, c3, c4, c5) == (c1, NFC(c1), NFD(c1), NFKC(c1), NFKD(c1))
-//
-// CONFORMANCE:
-// 1. The following invariants must be true for all conformant implementations
-//
-// NFC
-// c2 == NFC(c1) == NFC(c2) == NFC(c3)
-// c4 == NFC(c4) == NFC(c5)
-//
-// NFD
-// c3 == NFD(c1) == NFD(c2) == NFD(c3)
-// c5 == NFD(c4) == NFD(c5)
-//
-// NFKC
-// c4 == NFKC(c1) == NFKC(c2) == NFKC(c3) == NFKC(c4) == NFKC(c5)
-//
-// NFKD
-// c5 == NFKD(c1) == NFKD(c2) == NFKD(c3) == NFKD(c4) == NFKD(c5)
-//
-// 2. For every code point X assigned in this version of Unicode that is not
-// specifically listed in Part 1, the following invariants must be true
-// for all conformant implementations:
-//
-// X == NFC(X) == NFD(X) == NFKC(X) == NFKD(X)
-//
-
-// Column types.
-const (
- cRaw = iota
- cNFC
- cNFD
- cNFKC
- cNFKD
- cMaxColumns
-)
-
-// Holds data from NormalizationTest.txt
-var part []Part
-
-type Part struct {
- name string
- number int
- tests []Test
-}
-
-type Test struct {
- name string
- partnr int
- number int
- r rune // used for character by character test
- cols [cMaxColumns]string // Each has 5 entries, see below.
-}
-
-func (t Test) Name() string {
- if t.number < 0 {
- return part[t.partnr].name
- }
- return fmt.Sprintf("%s:%d", part[t.partnr].name, t.number)
-}
-
-var partRe = regexp.MustCompile(`@Part(\d) # (.*)$`)
-var testRe = regexp.MustCompile(`^` + strings.Repeat(`([\dA-F ]+);`, 5) + ` # (.*)$`)
-
-var counter int
-
-// Load the data form NormalizationTest.txt
-func loadTestData(t *testing.T) {
- f := gen.OpenUCDFile("NormalizationTest.txt")
- defer f.Close()
- scanner := bufio.NewScanner(f)
- for scanner.Scan() {
- line := scanner.Text()
- if len(line) == 0 || line[0] == '#' {
- continue
- }
- m := partRe.FindStringSubmatch(line)
- if m != nil {
- if len(m) < 3 {
- t.Fatal("Failed to parse Part: ", line)
- }
- i, err := strconv.Atoi(m[1])
- if err != nil {
- t.Fatal(err)
- }
- name := m[2]
- part = append(part, Part{name: name[:len(name)-1], number: i})
- continue
- }
- m = testRe.FindStringSubmatch(line)
- if m == nil || len(m) < 7 {
- t.Fatalf(`Failed to parse: "%s" result: %#v`, line, m)
- }
- test := Test{name: m[6], partnr: len(part) - 1, number: counter}
- counter++
- for j := 1; j < len(m)-1; j++ {
- for _, split := range strings.Split(m[j], " ") {
- r, err := strconv.ParseUint(split, 16, 64)
- if err != nil {
- t.Fatal(err)
- }
- if test.r == 0 {
- // save for CharacterByCharacterTests
- test.r = rune(r)
- }
- var buf [utf8.UTFMax]byte
- sz := utf8.EncodeRune(buf[:], rune(r))
- test.cols[j-1] += string(buf[:sz])
- }
- }
- part := &part[len(part)-1]
- part.tests = append(part.tests, test)
- }
- if scanner.Err() != nil {
- t.Fatal(scanner.Err())
- }
-}
-
-func cmpResult(t *testing.T, tc *Test, name string, f Form, gold, test, result string) {
- if gold != result {
- t.Errorf("%s:%s: %s(%+q)=%+q; want %+q: %s",
- tc.Name(), name, fstr[f], test, result, gold, tc.name)
- }
-}
-
-func cmpIsNormal(t *testing.T, tc *Test, name string, f Form, test string, result, want bool) {
- if result != want {
- t.Errorf("%s:%s: %s(%+q)=%v; want %v", tc.Name(), name, fstr[f], test, result, want)
- }
-}
-
-func doTest(t *testing.T, tc *Test, f Form, gold, test string) {
- testb := []byte(test)
- result := f.Bytes(testb)
- cmpResult(t, tc, "Bytes", f, gold, test, string(result))
-
- sresult := f.String(test)
- cmpResult(t, tc, "String", f, gold, test, sresult)
-
- acc := []byte{}
- i := Iter{}
- i.InitString(f, test)
- for !i.Done() {
- acc = append(acc, i.Next()...)
- }
- cmpResult(t, tc, "Iter.Next", f, gold, test, string(acc))
-
- buf := make([]byte, 128)
- acc = nil
- for p := 0; p < len(testb); {
- nDst, nSrc, _ := f.Transform(buf, testb[p:], true)
- acc = append(acc, buf[:nDst]...)
- p += nSrc
- }
- cmpResult(t, tc, "Transform", f, gold, test, string(acc))
-
- for i := range test {
- out := f.Append(f.Bytes([]byte(test[:i])), []byte(test[i:])...)
- cmpResult(t, tc, fmt.Sprintf(":Append:%d", i), f, gold, test, string(out))
- }
- cmpIsNormal(t, tc, "IsNormal", f, test, f.IsNormal([]byte(test)), test == gold)
- cmpIsNormal(t, tc, "IsNormalString", f, test, f.IsNormalString(test), test == gold)
-}
-
-func doConformanceTests(t *testing.T, tc *Test, partn int) {
- for i := 0; i <= 2; i++ {
- doTest(t, tc, NFC, tc.cols[1], tc.cols[i])
- doTest(t, tc, NFD, tc.cols[2], tc.cols[i])
- doTest(t, tc, NFKC, tc.cols[3], tc.cols[i])
- doTest(t, tc, NFKD, tc.cols[4], tc.cols[i])
- }
- for i := 3; i <= 4; i++ {
- doTest(t, tc, NFC, tc.cols[3], tc.cols[i])
- doTest(t, tc, NFD, tc.cols[4], tc.cols[i])
- doTest(t, tc, NFKC, tc.cols[3], tc.cols[i])
- doTest(t, tc, NFKD, tc.cols[4], tc.cols[i])
- }
-}
-
-func TestCharacterByCharacter(t *testing.T) {
- skipShort(t)
- tests := part[1].tests
- var last rune = 0
- for i := 0; i <= len(tests); i++ { // last one is special case
- var r rune
- if i == len(tests) {
- r = 0x2FA1E // Don't have to go to 0x10FFFF
- } else {
- r = tests[i].r
- }
- for last++; last < r; last++ {
- // Check all characters that were not explicitly listed in the test.
- tc := &Test{partnr: 1, number: -1}
- char := string(last)
- doTest(t, tc, NFC, char, char)
- doTest(t, tc, NFD, char, char)
- doTest(t, tc, NFKC, char, char)
- doTest(t, tc, NFKD, char, char)
- }
- if i < len(tests) {
- doConformanceTests(t, &tests[i], 1)
- }
- }
-}
-
-func TestStandardTests(t *testing.T) {
- skipShort(t)
- for _, j := range []int{0, 2, 3} {
- for _, test := range part[j].tests {
- doConformanceTests(t, &test, j)
- }
- }
-}
-
-// TestPerformance verifies that normalization is O(n). If any of the
-// code does not properly check for maxCombiningChars, normalization
-// may exhibit O(n**2) behavior.
-func TestPerformance(t *testing.T) {
- skipShort(t)
- runtime.GOMAXPROCS(2)
- success := make(chan bool, 1)
- go func() {
- buf := bytes.Repeat([]byte("\u035D"), 1024*1024)
- buf = append(buf, "\u035B"...)
- NFC.Append(nil, buf...)
- success <- true
- }()
- timeout := time.After(1 * time.Second)
- select {
- case <-success:
- // test completed before the timeout
- case <-timeout:
- t.Errorf(`unexpectedly long time to complete PerformanceTest`)
- }
-}
diff --git a/vendor/golang.org/x/text/unicode/rangetable/merge_test.go b/vendor/golang.org/x/text/unicode/rangetable/merge_test.go
deleted file mode 100644
index 93ed0fcad..000000000
--- a/vendor/golang.org/x/text/unicode/rangetable/merge_test.go
+++ /dev/null
@@ -1,184 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package rangetable
-
-import (
- "testing"
- "unicode"
-)
-
-var (
- maxRuneTable = &unicode.RangeTable{
- R32: []unicode.Range32{
- {unicode.MaxRune, unicode.MaxRune, 1},
- },
- }
-
- overlap1 = &unicode.RangeTable{
- R16: []unicode.Range16{
- {0x100, 0xfffc, 4},
- },
- R32: []unicode.Range32{
- {0x100000, 0x10fffc, 4},
- },
- }
-
- overlap2 = &unicode.RangeTable{
- R16: []unicode.Range16{
- {0x101, 0xfffd, 4},
- },
- R32: []unicode.Range32{
- {0x100001, 0x10fffd, 3},
- },
- }
-
- // The following table should be compacted into two entries for R16 and R32.
- optimize = &unicode.RangeTable{
- R16: []unicode.Range16{
- {0x1, 0x1, 1},
- {0x2, 0x2, 1},
- {0x3, 0x3, 1},
- {0x5, 0x5, 1},
- {0x7, 0x7, 1},
- {0x9, 0x9, 1},
- {0xb, 0xf, 2},
- },
- R32: []unicode.Range32{
- {0x10001, 0x10001, 1},
- {0x10002, 0x10002, 1},
- {0x10003, 0x10003, 1},
- {0x10005, 0x10005, 1},
- {0x10007, 0x10007, 1},
- {0x10009, 0x10009, 1},
- {0x1000b, 0x1000f, 2},
- },
- }
-)
-
-func TestMerge(t *testing.T) {
- for i, tt := range [][]*unicode.RangeTable{
- {unicode.Cc, unicode.Cf},
- {unicode.L, unicode.Ll},
- {unicode.L, unicode.Ll, unicode.Lu},
- {unicode.Ll, unicode.Lu},
- {unicode.M},
- unicode.GraphicRanges,
- cased,
-
- // Merge R16 only and R32 only and vice versa.
- {unicode.Khmer, unicode.Khudawadi},
- {unicode.Imperial_Aramaic, unicode.Radical},
-
- // Merge with empty.
- {&unicode.RangeTable{}},
- {&unicode.RangeTable{}, &unicode.RangeTable{}},
- {&unicode.RangeTable{}, &unicode.RangeTable{}, &unicode.RangeTable{}},
- {&unicode.RangeTable{}, unicode.Hiragana},
- {unicode.Inherited, &unicode.RangeTable{}},
- {&unicode.RangeTable{}, unicode.Hanunoo, &unicode.RangeTable{}},
-
- // Hypothetical tables.
- {maxRuneTable},
- {overlap1, overlap2},
-
- // Optimization
- {optimize},
- } {
- rt := Merge(tt...)
- for r := rune(0); r <= unicode.MaxRune; r++ {
- if got, want := unicode.Is(rt, r), unicode.In(r, tt...); got != want {
- t.Fatalf("%d:%U: got %v; want %v", i, r, got, want)
- }
- }
- // Test optimization and correctness for R16.
- for k := 0; k < len(rt.R16)-1; k++ {
- if lo, hi := rt.R16[k].Lo, rt.R16[k].Hi; lo > hi {
- t.Errorf("%d: Lo (%x) > Hi (%x)", i, lo, hi)
- }
- if hi, lo := rt.R16[k].Hi, rt.R16[k+1].Lo; hi >= lo {
- t.Errorf("%d: Hi (%x) >= next Lo (%x)", i, hi, lo)
- }
- if rt.R16[k].Hi+rt.R16[k].Stride == rt.R16[k+1].Lo {
- t.Errorf("%d: missed optimization for R16 at %d between %X and %x",
- i, k, rt.R16[k], rt.R16[k+1])
- }
- }
- // Test optimization and correctness for R32.
- for k := 0; k < len(rt.R32)-1; k++ {
- if lo, hi := rt.R32[k].Lo, rt.R32[k].Hi; lo > hi {
- t.Errorf("%d: Lo (%x) > Hi (%x)", i, lo, hi)
- }
- if hi, lo := rt.R32[k].Hi, rt.R32[k+1].Lo; hi >= lo {
- t.Errorf("%d: Hi (%x) >= next Lo (%x)", i, hi, lo)
- }
- if rt.R32[k].Hi+rt.R32[k].Stride == rt.R32[k+1].Lo {
- t.Errorf("%d: missed optimization for R32 at %d between %X and %X",
- i, k, rt.R32[k], rt.R32[k+1])
- }
- }
- }
-}
-
-const runes = "Hello World in 2015!,\U0010fffd"
-
-func BenchmarkNotMerged(t *testing.B) {
- for i := 0; i < t.N; i++ {
- for _, r := range runes {
- unicode.In(r, unicode.GraphicRanges...)
- }
- }
-}
-
-func BenchmarkMerged(t *testing.B) {
- rt := Merge(unicode.GraphicRanges...)
-
- for i := 0; i < t.N; i++ {
- for _, r := range runes {
- unicode.Is(rt, r)
- }
- }
-}
-
-var cased = []*unicode.RangeTable{
- unicode.Lower,
- unicode.Upper,
- unicode.Title,
- unicode.Other_Lowercase,
- unicode.Other_Uppercase,
-}
-
-func BenchmarkNotMergedCased(t *testing.B) {
- for i := 0; i < t.N; i++ {
- for _, r := range runes {
- unicode.In(r, cased...)
- }
- }
-}
-
-func BenchmarkMergedCased(t *testing.B) {
- // This reduces len(R16) from 243 to 82 and len(R32) from 65 to 35 for
- // Unicode 7.0.0.
- rt := Merge(cased...)
-
- for i := 0; i < t.N; i++ {
- for _, r := range runes {
- unicode.Is(rt, r)
- }
- }
-}
-
-func BenchmarkInit(t *testing.B) {
- for i := 0; i < t.N; i++ {
- Merge(cased...)
- Merge(unicode.GraphicRanges...)
- }
-}
-
-func BenchmarkInit2(t *testing.B) {
- // Hypothetical near-worst-case performance.
- for i := 0; i < t.N; i++ {
- Merge(overlap1, overlap2)
- }
-}
diff --git a/vendor/golang.org/x/text/unicode/rangetable/rangetable_test.go b/vendor/golang.org/x/text/unicode/rangetable/rangetable_test.go
deleted file mode 100644
index 5a355aa35..000000000
--- a/vendor/golang.org/x/text/unicode/rangetable/rangetable_test.go
+++ /dev/null
@@ -1,55 +0,0 @@
-package rangetable
-
-import (
- "reflect"
- "testing"
- "unicode"
-)
-
-var (
- empty = &unicode.RangeTable{}
- many = &unicode.RangeTable{
- R16: []unicode.Range16{{0, 0xffff, 5}},
- R32: []unicode.Range32{{0x10004, 0x10009, 5}},
- LatinOffset: 0,
- }
-)
-
-func TestVisit(t *testing.T) {
- Visit(empty, func(got rune) {
- t.Error("call from empty RangeTable")
- })
-
- var want rune
- Visit(many, func(got rune) {
- if got != want {
- t.Errorf("got %U; want %U", got, want)
- }
- want += 5
- })
- if want -= 5; want != 0x10009 {
- t.Errorf("last run was %U; want U+10009", want)
- }
-}
-
-func TestNew(t *testing.T) {
- for i, rt := range []*unicode.RangeTable{
- empty,
- unicode.Co,
- unicode.Letter,
- unicode.ASCII_Hex_Digit,
- many,
- maxRuneTable,
- } {
- var got, want []rune
- Visit(rt, func(r rune) {
- want = append(want, r)
- })
- Visit(New(want...), func(r rune) {
- got = append(got, r)
- })
- if !reflect.DeepEqual(got, want) {
- t.Errorf("%d:\ngot %v;\nwant %v", i, got, want)
- }
- }
-}
diff --git a/vendor/golang.org/x/time/rate/rate_test.go b/vendor/golang.org/x/time/rate/rate_test.go
deleted file mode 100644
index ec8c66ddf..000000000
--- a/vendor/golang.org/x/time/rate/rate_test.go
+++ /dev/null
@@ -1,459 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.7
-
-package rate
-
-import (
- "context"
- "math"
- "runtime"
- "sync"
- "sync/atomic"
- "testing"
- "time"
-)
-
-func TestLimit(t *testing.T) {
- if Limit(10) == Inf {
- t.Errorf("Limit(10) == Inf should be false")
- }
-}
-
-func closeEnough(a, b Limit) bool {
- return (math.Abs(float64(a)/float64(b)) - 1.0) < 1e-9
-}
-
-func TestEvery(t *testing.T) {
- cases := []struct {
- interval time.Duration
- lim Limit
- }{
- {0, Inf},
- {-1, Inf},
- {1 * time.Nanosecond, Limit(1e9)},
- {1 * time.Microsecond, Limit(1e6)},
- {1 * time.Millisecond, Limit(1e3)},
- {10 * time.Millisecond, Limit(100)},
- {100 * time.Millisecond, Limit(10)},
- {1 * time.Second, Limit(1)},
- {2 * time.Second, Limit(0.5)},
- {time.Duration(2.5 * float64(time.Second)), Limit(0.4)},
- {4 * time.Second, Limit(0.25)},
- {10 * time.Second, Limit(0.1)},
- {time.Duration(math.MaxInt64), Limit(1e9 / float64(math.MaxInt64))},
- }
- for _, tc := range cases {
- lim := Every(tc.interval)
- if !closeEnough(lim, tc.lim) {
- t.Errorf("Every(%v) = %v want %v", tc.interval, lim, tc.lim)
- }
- }
-}
-
-const (
- d = 100 * time.Millisecond
-)
-
-var (
- t0 = time.Now()
- t1 = t0.Add(time.Duration(1) * d)
- t2 = t0.Add(time.Duration(2) * d)
- t3 = t0.Add(time.Duration(3) * d)
- t4 = t0.Add(time.Duration(4) * d)
- t5 = t0.Add(time.Duration(5) * d)
- t9 = t0.Add(time.Duration(9) * d)
-)
-
-type allow struct {
- t time.Time
- n int
- ok bool
-}
-
-func run(t *testing.T, lim *Limiter, allows []allow) {
- for i, allow := range allows {
- ok := lim.AllowN(allow.t, allow.n)
- if ok != allow.ok {
- t.Errorf("step %d: lim.AllowN(%v, %v) = %v want %v",
- i, allow.t, allow.n, ok, allow.ok)
- }
- }
-}
-
-func TestLimiterBurst1(t *testing.T) {
- run(t, NewLimiter(10, 1), []allow{
- {t0, 1, true},
- {t0, 1, false},
- {t0, 1, false},
- {t1, 1, true},
- {t1, 1, false},
- {t1, 1, false},
- {t2, 2, false}, // burst size is 1, so n=2 always fails
- {t2, 1, true},
- {t2, 1, false},
- })
-}
-
-func TestLimiterBurst3(t *testing.T) {
- run(t, NewLimiter(10, 3), []allow{
- {t0, 2, true},
- {t0, 2, false},
- {t0, 1, true},
- {t0, 1, false},
- {t1, 4, false},
- {t2, 1, true},
- {t3, 1, true},
- {t4, 1, true},
- {t4, 1, true},
- {t4, 1, false},
- {t4, 1, false},
- {t9, 3, true},
- {t9, 0, true},
- })
-}
-
-func TestLimiterJumpBackwards(t *testing.T) {
- run(t, NewLimiter(10, 3), []allow{
- {t1, 1, true}, // start at t1
- {t0, 1, true}, // jump back to t0, two tokens remain
- {t0, 1, true},
- {t0, 1, false},
- {t0, 1, false},
- {t1, 1, true}, // got a token
- {t1, 1, false},
- {t1, 1, false},
- {t2, 1, true}, // got another token
- {t2, 1, false},
- {t2, 1, false},
- })
-}
-
-func TestSimultaneousRequests(t *testing.T) {
- const (
- limit = 1
- burst = 5
- numRequests = 15
- )
- var (
- wg sync.WaitGroup
- numOK = uint32(0)
- )
-
- // Very slow replenishing bucket.
- lim := NewLimiter(limit, burst)
-
- // Tries to take a token, atomically updates the counter and decreases the wait
- // group counter.
- f := func() {
- defer wg.Done()
- if ok := lim.Allow(); ok {
- atomic.AddUint32(&numOK, 1)
- }
- }
-
- wg.Add(numRequests)
- for i := 0; i < numRequests; i++ {
- go f()
- }
- wg.Wait()
- if numOK != burst {
- t.Errorf("numOK = %d, want %d", numOK, burst)
- }
-}
-
-func TestLongRunningQPS(t *testing.T) {
- if testing.Short() {
- t.Skip("skipping in short mode")
- }
- if runtime.GOOS == "openbsd" {
- t.Skip("low resolution time.Sleep invalidates test (golang.org/issue/14183)")
- return
- }
-
- // The test runs for a few seconds executing many requests and then checks
- // that overall number of requests is reasonable.
- const (
- limit = 100
- burst = 100
- )
- var numOK = int32(0)
-
- lim := NewLimiter(limit, burst)
-
- var wg sync.WaitGroup
- f := func() {
- if ok := lim.Allow(); ok {
- atomic.AddInt32(&numOK, 1)
- }
- wg.Done()
- }
-
- start := time.Now()
- end := start.Add(5 * time.Second)
- for time.Now().Before(end) {
- wg.Add(1)
- go f()
-
- // This will still offer ~500 requests per second, but won't consume
- // outrageous amount of CPU.
- time.Sleep(2 * time.Millisecond)
- }
- wg.Wait()
- elapsed := time.Since(start)
- ideal := burst + (limit * float64(elapsed) / float64(time.Second))
-
- // We should never get more requests than allowed.
- if want := int32(ideal + 1); numOK > want {
- t.Errorf("numOK = %d, want %d (ideal %f)", numOK, want, ideal)
- }
- // We should get very close to the number of requests allowed.
- if want := int32(0.999 * ideal); numOK < want {
- t.Errorf("numOK = %d, want %d (ideal %f)", numOK, want, ideal)
- }
-}
-
-type request struct {
- t time.Time
- n int
- act time.Time
- ok bool
-}
-
-// dFromDuration converts a duration to a multiple of the global constant d
-func dFromDuration(dur time.Duration) int {
- // Adding a millisecond to be swallowed by the integer division
- // because we don't care about small inaccuracies
- return int((dur + time.Millisecond) / d)
-}
-
-// dSince returns multiples of d since t0
-func dSince(t time.Time) int {
- return dFromDuration(t.Sub(t0))
-}
-
-func runReserve(t *testing.T, lim *Limiter, req request) *Reservation {
- return runReserveMax(t, lim, req, InfDuration)
-}
-
-func runReserveMax(t *testing.T, lim *Limiter, req request, maxReserve time.Duration) *Reservation {
- r := lim.reserveN(req.t, req.n, maxReserve)
- if r.ok && (dSince(r.timeToAct) != dSince(req.act)) || r.ok != req.ok {
- t.Errorf("lim.reserveN(t%d, %v, %v) = (t%d, %v) want (t%d, %v)",
- dSince(req.t), req.n, maxReserve, dSince(r.timeToAct), r.ok, dSince(req.act), req.ok)
- }
- return &r
-}
-
-func TestSimpleReserve(t *testing.T) {
- lim := NewLimiter(10, 2)
-
- runReserve(t, lim, request{t0, 2, t0, true})
- runReserve(t, lim, request{t0, 2, t2, true})
- runReserve(t, lim, request{t3, 2, t4, true})
-}
-
-func TestMix(t *testing.T) {
- lim := NewLimiter(10, 2)
-
- runReserve(t, lim, request{t0, 3, t1, false}) // should return false because n > Burst
- runReserve(t, lim, request{t0, 2, t0, true})
- run(t, lim, []allow{{t1, 2, false}}) // not enought tokens - don't allow
- runReserve(t, lim, request{t1, 2, t2, true})
- run(t, lim, []allow{{t1, 1, false}}) // negative tokens - don't allow
- run(t, lim, []allow{{t3, 1, true}})
-}
-
-func TestCancelInvalid(t *testing.T) {
- lim := NewLimiter(10, 2)
-
- runReserve(t, lim, request{t0, 2, t0, true})
- r := runReserve(t, lim, request{t0, 3, t3, false})
- r.CancelAt(t0) // should have no effect
- runReserve(t, lim, request{t0, 2, t2, true}) // did not get extra tokens
-}
-
-func TestCancelLast(t *testing.T) {
- lim := NewLimiter(10, 2)
-
- runReserve(t, lim, request{t0, 2, t0, true})
- r := runReserve(t, lim, request{t0, 2, t2, true})
- r.CancelAt(t1) // got 2 tokens back
- runReserve(t, lim, request{t1, 2, t2, true})
-}
-
-func TestCancelTooLate(t *testing.T) {
- lim := NewLimiter(10, 2)
-
- runReserve(t, lim, request{t0, 2, t0, true})
- r := runReserve(t, lim, request{t0, 2, t2, true})
- r.CancelAt(t3) // too late to cancel - should have no effect
- runReserve(t, lim, request{t3, 2, t4, true})
-}
-
-func TestCancel0Tokens(t *testing.T) {
- lim := NewLimiter(10, 2)
-
- runReserve(t, lim, request{t0, 2, t0, true})
- r := runReserve(t, lim, request{t0, 1, t1, true})
- runReserve(t, lim, request{t0, 1, t2, true})
- r.CancelAt(t0) // got 0 tokens back
- runReserve(t, lim, request{t0, 1, t3, true})
-}
-
-func TestCancel1Token(t *testing.T) {
- lim := NewLimiter(10, 2)
-
- runReserve(t, lim, request{t0, 2, t0, true})
- r := runReserve(t, lim, request{t0, 2, t2, true})
- runReserve(t, lim, request{t0, 1, t3, true})
- r.CancelAt(t2) // got 1 token back
- runReserve(t, lim, request{t2, 2, t4, true})
-}
-
-func TestCancelMulti(t *testing.T) {
- lim := NewLimiter(10, 4)
-
- runReserve(t, lim, request{t0, 4, t0, true})
- rA := runReserve(t, lim, request{t0, 3, t3, true})
- runReserve(t, lim, request{t0, 1, t4, true})
- rC := runReserve(t, lim, request{t0, 1, t5, true})
- rC.CancelAt(t1) // get 1 token back
- rA.CancelAt(t1) // get 2 tokens back, as if C was never reserved
- runReserve(t, lim, request{t1, 3, t5, true})
-}
-
-func TestReserveJumpBack(t *testing.T) {
- lim := NewLimiter(10, 2)
-
- runReserve(t, lim, request{t1, 2, t1, true}) // start at t1
- runReserve(t, lim, request{t0, 1, t1, true}) // should violate Limit,Burst
- runReserve(t, lim, request{t2, 2, t3, true})
-}
-
-func TestReserveJumpBackCancel(t *testing.T) {
- lim := NewLimiter(10, 2)
-
- runReserve(t, lim, request{t1, 2, t1, true}) // start at t1
- r := runReserve(t, lim, request{t1, 2, t3, true})
- runReserve(t, lim, request{t1, 1, t4, true})
- r.CancelAt(t0) // cancel at t0, get 1 token back
- runReserve(t, lim, request{t1, 2, t4, true}) // should violate Limit,Burst
-}
-
-func TestReserveSetLimit(t *testing.T) {
- lim := NewLimiter(5, 2)
-
- runReserve(t, lim, request{t0, 2, t0, true})
- runReserve(t, lim, request{t0, 2, t4, true})
- lim.SetLimitAt(t2, 10)
- runReserve(t, lim, request{t2, 1, t4, true}) // violates Limit and Burst
-}
-
-func TestReserveSetLimitCancel(t *testing.T) {
- lim := NewLimiter(5, 2)
-
- runReserve(t, lim, request{t0, 2, t0, true})
- r := runReserve(t, lim, request{t0, 2, t4, true})
- lim.SetLimitAt(t2, 10)
- r.CancelAt(t2) // 2 tokens back
- runReserve(t, lim, request{t2, 2, t3, true})
-}
-
-func TestReserveMax(t *testing.T) {
- lim := NewLimiter(10, 2)
- maxT := d
-
- runReserveMax(t, lim, request{t0, 2, t0, true}, maxT)
- runReserveMax(t, lim, request{t0, 1, t1, true}, maxT) // reserve for close future
- runReserveMax(t, lim, request{t0, 1, t2, false}, maxT) // time to act too far in the future
-}
-
-type wait struct {
- name string
- ctx context.Context
- n int
- delay int // in multiples of d
- nilErr bool
-}
-
-func runWait(t *testing.T, lim *Limiter, w wait) {
- start := time.Now()
- err := lim.WaitN(w.ctx, w.n)
- delay := time.Now().Sub(start)
- if (w.nilErr && err != nil) || (!w.nilErr && err == nil) || w.delay != dFromDuration(delay) {
- errString := "<nil>"
- if !w.nilErr {
- errString = "<non-nil error>"
- }
- t.Errorf("lim.WaitN(%v, lim, %v) = %v with delay %v ; want %v with delay %v",
- w.name, w.n, err, delay, errString, d*time.Duration(w.delay))
- }
-}
-
-func TestWaitSimple(t *testing.T) {
- lim := NewLimiter(10, 3)
-
- ctx, cancel := context.WithCancel(context.Background())
- cancel()
- runWait(t, lim, wait{"already-cancelled", ctx, 1, 0, false})
-
- runWait(t, lim, wait{"exceed-burst-error", context.Background(), 4, 0, false})
-
- runWait(t, lim, wait{"act-now", context.Background(), 2, 0, true})
- runWait(t, lim, wait{"act-later", context.Background(), 3, 2, true})
-}
-
-func TestWaitCancel(t *testing.T) {
- lim := NewLimiter(10, 3)
-
- ctx, cancel := context.WithCancel(context.Background())
- runWait(t, lim, wait{"act-now", ctx, 2, 0, true}) // after this lim.tokens = 1
- go func() {
- time.Sleep(d)
- cancel()
- }()
- runWait(t, lim, wait{"will-cancel", ctx, 3, 1, false})
- // should get 3 tokens back, and have lim.tokens = 2
- t.Logf("tokens:%v last:%v lastEvent:%v", lim.tokens, lim.last, lim.lastEvent)
- runWait(t, lim, wait{"act-now-after-cancel", context.Background(), 2, 0, true})
-}
-
-func TestWaitTimeout(t *testing.T) {
- lim := NewLimiter(10, 3)
-
- ctx, cancel := context.WithTimeout(context.Background(), d)
- defer cancel()
- runWait(t, lim, wait{"act-now", ctx, 2, 0, true})
- runWait(t, lim, wait{"w-timeout-err", ctx, 3, 0, false})
-}
-
-func TestWaitInf(t *testing.T) {
- lim := NewLimiter(Inf, 0)
-
- runWait(t, lim, wait{"exceed-burst-no-error", context.Background(), 3, 0, true})
-}
-
-func BenchmarkAllowN(b *testing.B) {
- lim := NewLimiter(Every(1*time.Second), 1)
- now := time.Now()
- b.ReportAllocs()
- b.ResetTimer()
- b.RunParallel(func(pb *testing.PB) {
- for pb.Next() {
- lim.AllowN(now, 1)
- }
- })
-}
-
-func BenchmarkWaitNNoDelay(b *testing.B) {
- lim := NewLimiter(Limit(b.N), b.N)
- ctx := context.Background()
- b.ReportAllocs()
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- lim.WaitN(ctx, 1)
- }
-}
diff --git a/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin_test.go b/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin_test.go
deleted file mode 100644
index 70d8af716..000000000
--- a/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin_test.go
+++ /dev/null
@@ -1,477 +0,0 @@
-/*
- *
- * Copyright 2017 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package roundrobin_test
-
-import (
- "fmt"
- "net"
- "sync"
- "testing"
- "time"
-
- "golang.org/x/net/context"
- "google.golang.org/grpc"
- "google.golang.org/grpc/balancer/roundrobin"
- "google.golang.org/grpc/codes"
- _ "google.golang.org/grpc/grpclog/glogger"
- "google.golang.org/grpc/internal/leakcheck"
- "google.golang.org/grpc/peer"
- "google.golang.org/grpc/resolver"
- "google.golang.org/grpc/resolver/manual"
- "google.golang.org/grpc/status"
- testpb "google.golang.org/grpc/test/grpc_testing"
-)
-
-type testServer struct {
- testpb.TestServiceServer
-}
-
-func (s *testServer) EmptyCall(ctx context.Context, in *testpb.Empty) (*testpb.Empty, error) {
- return &testpb.Empty{}, nil
-}
-
-func (s *testServer) FullDuplexCall(stream testpb.TestService_FullDuplexCallServer) error {
- return nil
-}
-
-type test struct {
- servers []*grpc.Server
- addresses []string
-}
-
-func (t *test) cleanup() {
- for _, s := range t.servers {
- s.Stop()
- }
-}
-
-func startTestServers(count int) (_ *test, err error) {
- t := &test{}
-
- defer func() {
- if err != nil {
- for _, s := range t.servers {
- s.Stop()
- }
- }
- }()
- for i := 0; i < count; i++ {
- lis, err := net.Listen("tcp", "localhost:0")
- if err != nil {
- return nil, fmt.Errorf("Failed to listen %v", err)
- }
-
- s := grpc.NewServer()
- testpb.RegisterTestServiceServer(s, &testServer{})
- t.servers = append(t.servers, s)
- t.addresses = append(t.addresses, lis.Addr().String())
-
- go func(s *grpc.Server, l net.Listener) {
- s.Serve(l)
- }(s, lis)
- }
-
- return t, nil
-}
-
-func TestOneBackend(t *testing.T) {
- defer leakcheck.Check(t)
- r, cleanup := manual.GenerateAndRegisterManualResolver()
- defer cleanup()
-
- test, err := startTestServers(1)
- if err != nil {
- t.Fatalf("failed to start servers: %v", err)
- }
- defer test.cleanup()
-
- cc, err := grpc.Dial(r.Scheme()+":///test.server", grpc.WithInsecure(), grpc.WithBalancerName(roundrobin.Name))
- if err != nil {
- t.Fatalf("failed to dial: %v", err)
- }
- defer cc.Close()
- testc := testpb.NewTestServiceClient(cc)
- // The first RPC should fail because there's no address.
- ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond)
- defer cancel()
- if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); err == nil || status.Code(err) != codes.DeadlineExceeded {
- t.Fatalf("EmptyCall() = _, %v, want _, DeadlineExceeded", err)
- }
-
- r.NewAddress([]resolver.Address{{Addr: test.addresses[0]}})
- // The second RPC should succeed.
- if _, err := testc.EmptyCall(context.Background(), &testpb.Empty{}); err != nil {
- t.Fatalf("EmptyCall() = _, %v, want _, <nil>", err)
- }
-}
-
-func TestBackendsRoundRobin(t *testing.T) {
- defer leakcheck.Check(t)
- r, cleanup := manual.GenerateAndRegisterManualResolver()
- defer cleanup()
-
- backendCount := 5
- test, err := startTestServers(backendCount)
- if err != nil {
- t.Fatalf("failed to start servers: %v", err)
- }
- defer test.cleanup()
-
- cc, err := grpc.Dial(r.Scheme()+":///test.server", grpc.WithInsecure(), grpc.WithBalancerName(roundrobin.Name))
- if err != nil {
- t.Fatalf("failed to dial: %v", err)
- }
- defer cc.Close()
- testc := testpb.NewTestServiceClient(cc)
- // The first RPC should fail because there's no address.
- ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond)
- defer cancel()
- if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); err == nil || status.Code(err) != codes.DeadlineExceeded {
- t.Fatalf("EmptyCall() = _, %v, want _, DeadlineExceeded", err)
- }
-
- var resolvedAddrs []resolver.Address
- for i := 0; i < backendCount; i++ {
- resolvedAddrs = append(resolvedAddrs, resolver.Address{Addr: test.addresses[i]})
- }
-
- r.NewAddress(resolvedAddrs)
- var p peer.Peer
- // Make sure connections to all servers are up.
- for si := 0; si < backendCount; si++ {
- var connected bool
- for i := 0; i < 1000; i++ {
- if _, err := testc.EmptyCall(context.Background(), &testpb.Empty{}, grpc.Peer(&p)); err != nil {
- t.Fatalf("EmptyCall() = _, %v, want _, <nil>", err)
- }
- if p.Addr.String() == test.addresses[si] {
- connected = true
- break
- }
- time.Sleep(time.Millisecond)
- }
- if !connected {
- t.Fatalf("Connection to %v was not up after more than 1 second", test.addresses[si])
- }
- }
-
- for i := 0; i < 3*backendCount; i++ {
- if _, err := testc.EmptyCall(context.Background(), &testpb.Empty{}, grpc.Peer(&p)); err != nil {
- t.Fatalf("EmptyCall() = _, %v, want _, <nil>", err)
- }
- if p.Addr.String() != test.addresses[i%backendCount] {
- t.Fatalf("Index %d: want peer %v, got peer %v", i, test.addresses[i%backendCount], p.Addr.String())
- }
- }
-}
-
-func TestAddressesRemoved(t *testing.T) {
- defer leakcheck.Check(t)
- r, cleanup := manual.GenerateAndRegisterManualResolver()
- defer cleanup()
-
- test, err := startTestServers(1)
- if err != nil {
- t.Fatalf("failed to start servers: %v", err)
- }
- defer test.cleanup()
-
- cc, err := grpc.Dial(r.Scheme()+":///test.server", grpc.WithInsecure(), grpc.WithBalancerName(roundrobin.Name))
- if err != nil {
- t.Fatalf("failed to dial: %v", err)
- }
- defer cc.Close()
- testc := testpb.NewTestServiceClient(cc)
- // The first RPC should fail because there's no address.
- ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond)
- defer cancel()
- if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); err == nil || status.Code(err) != codes.DeadlineExceeded {
- t.Fatalf("EmptyCall() = _, %v, want _, DeadlineExceeded", err)
- }
-
- r.NewAddress([]resolver.Address{{Addr: test.addresses[0]}})
- // The second RPC should succeed.
- if _, err := testc.EmptyCall(context.Background(), &testpb.Empty{}); err != nil {
- t.Fatalf("EmptyCall() = _, %v, want _, <nil>", err)
- }
-
- r.NewAddress([]resolver.Address{})
- for i := 0; i < 1000; i++ {
- ctx, cancel := context.WithTimeout(context.Background(), 50*time.Millisecond)
- defer cancel()
- if _, err := testc.EmptyCall(ctx, &testpb.Empty{}, grpc.FailFast(false)); status.Code(err) == codes.DeadlineExceeded {
- return
- }
- time.Sleep(time.Millisecond)
- }
- t.Fatalf("No RPC failed after removing all addresses, want RPC to fail with DeadlineExceeded")
-}
-
-func TestCloseWithPendingRPC(t *testing.T) {
- defer leakcheck.Check(t)
- r, cleanup := manual.GenerateAndRegisterManualResolver()
- defer cleanup()
-
- test, err := startTestServers(1)
- if err != nil {
- t.Fatalf("failed to start servers: %v", err)
- }
- defer test.cleanup()
-
- cc, err := grpc.Dial(r.Scheme()+":///test.server", grpc.WithInsecure(), grpc.WithBalancerName(roundrobin.Name))
- if err != nil {
- t.Fatalf("failed to dial: %v", err)
- }
- testc := testpb.NewTestServiceClient(cc)
-
- var wg sync.WaitGroup
- for i := 0; i < 3; i++ {
- wg.Add(1)
- go func() {
- defer wg.Done()
- // This RPC blocks until cc is closed.
- ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
- if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); status.Code(err) == codes.DeadlineExceeded {
- t.Errorf("RPC failed because of deadline after cc is closed; want error the client connection is closing")
- }
- cancel()
- }()
- }
- cc.Close()
- wg.Wait()
-}
-
-func TestNewAddressWhileBlocking(t *testing.T) {
- defer leakcheck.Check(t)
- r, cleanup := manual.GenerateAndRegisterManualResolver()
- defer cleanup()
-
- test, err := startTestServers(1)
- if err != nil {
- t.Fatalf("failed to start servers: %v", err)
- }
- defer test.cleanup()
-
- cc, err := grpc.Dial(r.Scheme()+":///test.server", grpc.WithInsecure(), grpc.WithBalancerName(roundrobin.Name))
- if err != nil {
- t.Fatalf("failed to dial: %v", err)
- }
- defer cc.Close()
- testc := testpb.NewTestServiceClient(cc)
- // The first RPC should fail because there's no address.
- ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond)
- defer cancel()
- if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); err == nil || status.Code(err) != codes.DeadlineExceeded {
- t.Fatalf("EmptyCall() = _, %v, want _, DeadlineExceeded", err)
- }
-
- r.NewAddress([]resolver.Address{{Addr: test.addresses[0]}})
- // The second RPC should succeed.
- ctx, cancel = context.WithTimeout(context.Background(), 2*time.Second)
- defer cancel()
- if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); err != nil {
- t.Fatalf("EmptyCall() = _, %v, want _, nil", err)
- }
-
- r.NewAddress([]resolver.Address{})
-
- var wg sync.WaitGroup
- for i := 0; i < 3; i++ {
- wg.Add(1)
- go func() {
- defer wg.Done()
- // This RPC blocks until NewAddress is called.
- testc.EmptyCall(context.Background(), &testpb.Empty{})
- }()
- }
- time.Sleep(50 * time.Millisecond)
- r.NewAddress([]resolver.Address{{Addr: test.addresses[0]}})
- wg.Wait()
-}
-
-func TestOneServerDown(t *testing.T) {
- defer leakcheck.Check(t)
- r, cleanup := manual.GenerateAndRegisterManualResolver()
- defer cleanup()
-
- backendCount := 3
- test, err := startTestServers(backendCount)
- if err != nil {
- t.Fatalf("failed to start servers: %v", err)
- }
- defer test.cleanup()
-
- cc, err := grpc.Dial(r.Scheme()+":///test.server", grpc.WithInsecure(), grpc.WithBalancerName(roundrobin.Name), grpc.WithWaitForHandshake())
- if err != nil {
- t.Fatalf("failed to dial: %v", err)
- }
- defer cc.Close()
- testc := testpb.NewTestServiceClient(cc)
- // The first RPC should fail because there's no address.
- ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond)
- defer cancel()
- if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); err == nil || status.Code(err) != codes.DeadlineExceeded {
- t.Fatalf("EmptyCall() = _, %v, want _, DeadlineExceeded", err)
- }
-
- var resolvedAddrs []resolver.Address
- for i := 0; i < backendCount; i++ {
- resolvedAddrs = append(resolvedAddrs, resolver.Address{Addr: test.addresses[i]})
- }
-
- r.NewAddress(resolvedAddrs)
- var p peer.Peer
- // Make sure connections to all servers are up.
- for si := 0; si < backendCount; si++ {
- var connected bool
- for i := 0; i < 1000; i++ {
- if _, err := testc.EmptyCall(context.Background(), &testpb.Empty{}, grpc.Peer(&p)); err != nil {
- t.Fatalf("EmptyCall() = _, %v, want _, <nil>", err)
- }
- if p.Addr.String() == test.addresses[si] {
- connected = true
- break
- }
- time.Sleep(time.Millisecond)
- }
- if !connected {
- t.Fatalf("Connection to %v was not up after more than 1 second", test.addresses[si])
- }
- }
-
- for i := 0; i < 3*backendCount; i++ {
- if _, err := testc.EmptyCall(context.Background(), &testpb.Empty{}, grpc.Peer(&p)); err != nil {
- t.Fatalf("EmptyCall() = _, %v, want _, <nil>", err)
- }
- if p.Addr.String() != test.addresses[i%backendCount] {
- t.Fatalf("Index %d: want peer %v, got peer %v", i, test.addresses[i%backendCount], p.Addr.String())
- }
- }
-
- // Stop one server, RPCs should roundrobin among the remaining servers.
- backendCount--
- test.servers[backendCount].Stop()
- // Loop until see server[backendCount-1] twice without seeing server[backendCount].
- var targetSeen int
- for i := 0; i < 1000; i++ {
- if _, err := testc.EmptyCall(context.Background(), &testpb.Empty{}, grpc.Peer(&p)); err != nil {
- targetSeen = 0
- t.Logf("EmptyCall() = _, %v, want _, <nil>", err)
- // Due to a race, this RPC could possibly get the connection that
- // was closing, and this RPC may fail. Keep trying when this
- // happens.
- continue
- }
- switch p.Addr.String() {
- case test.addresses[backendCount-1]:
- targetSeen++
- case test.addresses[backendCount]:
- // Reset targetSeen if peer is server[backendCount].
- targetSeen = 0
- }
- // Break to make sure the last picked address is server[-1], so the following for loop won't be flaky.
- if targetSeen >= 2 {
- break
- }
- }
- if targetSeen != 2 {
- t.Fatal("Failed to see server[backendCount-1] twice without seeing server[backendCount]")
- }
- for i := 0; i < 3*backendCount; i++ {
- if _, err := testc.EmptyCall(context.Background(), &testpb.Empty{}, grpc.Peer(&p)); err != nil {
- t.Fatalf("EmptyCall() = _, %v, want _, <nil>", err)
- }
- if p.Addr.String() != test.addresses[i%backendCount] {
- t.Errorf("Index %d: want peer %v, got peer %v", i, test.addresses[i%backendCount], p.Addr.String())
- }
- }
-}
-
-func TestAllServersDown(t *testing.T) {
- defer leakcheck.Check(t)
- r, cleanup := manual.GenerateAndRegisterManualResolver()
- defer cleanup()
-
- backendCount := 3
- test, err := startTestServers(backendCount)
- if err != nil {
- t.Fatalf("failed to start servers: %v", err)
- }
- defer test.cleanup()
-
- cc, err := grpc.Dial(r.Scheme()+":///test.server", grpc.WithInsecure(), grpc.WithBalancerName(roundrobin.Name), grpc.WithWaitForHandshake())
- if err != nil {
- t.Fatalf("failed to dial: %v", err)
- }
- defer cc.Close()
- testc := testpb.NewTestServiceClient(cc)
- // The first RPC should fail because there's no address.
- ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond)
- defer cancel()
- if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); err == nil || status.Code(err) != codes.DeadlineExceeded {
- t.Fatalf("EmptyCall() = _, %v, want _, DeadlineExceeded", err)
- }
-
- var resolvedAddrs []resolver.Address
- for i := 0; i < backendCount; i++ {
- resolvedAddrs = append(resolvedAddrs, resolver.Address{Addr: test.addresses[i]})
- }
-
- r.NewAddress(resolvedAddrs)
- var p peer.Peer
- // Make sure connections to all servers are up.
- for si := 0; si < backendCount; si++ {
- var connected bool
- for i := 0; i < 1000; i++ {
- if _, err := testc.EmptyCall(context.Background(), &testpb.Empty{}, grpc.Peer(&p)); err != nil {
- t.Fatalf("EmptyCall() = _, %v, want _, <nil>", err)
- }
- if p.Addr.String() == test.addresses[si] {
- connected = true
- break
- }
- time.Sleep(time.Millisecond)
- }
- if !connected {
- t.Fatalf("Connection to %v was not up after more than 1 second", test.addresses[si])
- }
- }
-
- for i := 0; i < 3*backendCount; i++ {
- if _, err := testc.EmptyCall(context.Background(), &testpb.Empty{}, grpc.Peer(&p)); err != nil {
- t.Fatalf("EmptyCall() = _, %v, want _, <nil>", err)
- }
- if p.Addr.String() != test.addresses[i%backendCount] {
- t.Fatalf("Index %d: want peer %v, got peer %v", i, test.addresses[i%backendCount], p.Addr.String())
- }
- }
-
- // All servers are stopped, failfast RPC should fail with unavailable.
- for i := 0; i < backendCount; i++ {
- test.servers[i].Stop()
- }
- time.Sleep(100 * time.Millisecond)
- for i := 0; i < 1000; i++ {
- if _, err := testc.EmptyCall(context.Background(), &testpb.Empty{}); status.Code(err) == codes.Unavailable {
- return
- }
- time.Sleep(time.Millisecond)
- }
- t.Fatalf("Failfast RPCs didn't fail with Unavailable after all servers are stopped")
-}
diff --git a/vendor/google.golang.org/grpc/balancer_switching_test.go b/vendor/google.golang.org/grpc/balancer_switching_test.go
deleted file mode 100644
index 0dcd9165c..000000000
--- a/vendor/google.golang.org/grpc/balancer_switching_test.go
+++ /dev/null
@@ -1,469 +0,0 @@
-/*
- *
- * Copyright 2017 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package grpc
-
-import (
- "fmt"
- "math"
- "testing"
- "time"
-
- "golang.org/x/net/context"
- "google.golang.org/grpc/balancer"
- "google.golang.org/grpc/balancer/roundrobin"
- "google.golang.org/grpc/connectivity"
- _ "google.golang.org/grpc/grpclog/glogger"
- "google.golang.org/grpc/internal/leakcheck"
- "google.golang.org/grpc/resolver"
- "google.golang.org/grpc/resolver/manual"
-)
-
-var _ balancer.Builder = &magicalLB{}
-var _ balancer.Balancer = &magicalLB{}
-
-// magicalLB is a ringer for grpclb. It is used to avoid circular dependencies on the grpclb package
-type magicalLB struct{}
-
-func (b *magicalLB) Name() string {
- return "grpclb"
-}
-
-func (b *magicalLB) Build(cc balancer.ClientConn, opts balancer.BuildOptions) balancer.Balancer {
- return b
-}
-
-func (b *magicalLB) HandleSubConnStateChange(balancer.SubConn, connectivity.State) {}
-
-func (b *magicalLB) HandleResolvedAddrs([]resolver.Address, error) {}
-
-func (b *magicalLB) Close() {}
-
-func init() {
- balancer.Register(&magicalLB{})
-}
-
-func checkPickFirst(cc *ClientConn, servers []*server) error {
- var (
- req = "port"
- reply string
- err error
- )
- connected := false
- for i := 0; i < 5000; i++ {
- if err = cc.Invoke(context.Background(), "/foo/bar", &req, &reply); errorDesc(err) == servers[0].port {
- if connected {
- // connected is set to false if peer is not server[0]. So if
- // connected is true here, this is the second time we saw
- // server[0] in a row. Break because pickfirst is in effect.
- break
- }
- connected = true
- } else {
- connected = false
- }
- time.Sleep(time.Millisecond)
- }
- if !connected {
- return fmt.Errorf("pickfirst is not in effect after 5 second, EmptyCall() = _, %v, want _, %v", err, servers[0].port)
- }
- // The following RPCs should all succeed with the first server.
- for i := 0; i < 3; i++ {
- err = cc.Invoke(context.Background(), "/foo/bar", &req, &reply)
- if errorDesc(err) != servers[0].port {
- return fmt.Errorf("Index %d: want peer %v, got peer %v", i, servers[0].port, err)
- }
- }
- return nil
-}
-
-func checkRoundRobin(cc *ClientConn, servers []*server) error {
- var (
- req = "port"
- reply string
- err error
- )
-
- // Make sure connections to all servers are up.
- for i := 0; i < 2; i++ {
- // Do this check twice, otherwise the first RPC's transport may still be
- // picked by the closing pickfirst balancer, and the test becomes flaky.
- for _, s := range servers {
- var up bool
- for i := 0; i < 5000; i++ {
- if err = cc.Invoke(context.Background(), "/foo/bar", &req, &reply); errorDesc(err) == s.port {
- up = true
- break
- }
- time.Sleep(time.Millisecond)
- }
- if !up {
- return fmt.Errorf("server %v is not up within 5 second", s.port)
- }
- }
- }
-
- serverCount := len(servers)
- for i := 0; i < 3*serverCount; i++ {
- err = cc.Invoke(context.Background(), "/foo/bar", &req, &reply)
- if errorDesc(err) != servers[i%serverCount].port {
- return fmt.Errorf("Index %d: want peer %v, got peer %v", i, servers[i%serverCount].port, err)
- }
- }
- return nil
-}
-
-func TestSwitchBalancer(t *testing.T) {
- defer leakcheck.Check(t)
- r, rcleanup := manual.GenerateAndRegisterManualResolver()
- defer rcleanup()
-
- numServers := 2
- servers, _, scleanup := startServers(t, numServers, math.MaxInt32)
- defer scleanup()
-
- cc, err := Dial(r.Scheme()+":///test.server", WithInsecure(), WithCodec(testCodec{}))
- if err != nil {
- t.Fatalf("failed to dial: %v", err)
- }
- defer cc.Close()
- r.NewAddress([]resolver.Address{{Addr: servers[0].addr}, {Addr: servers[1].addr}})
- // The default balancer is pickfirst.
- if err := checkPickFirst(cc, servers); err != nil {
- t.Fatalf("check pickfirst returned non-nil error: %v", err)
- }
- // Switch to roundrobin.
- cc.handleServiceConfig(`{"loadBalancingPolicy": "round_robin"}`)
- if err := checkRoundRobin(cc, servers); err != nil {
- t.Fatalf("check roundrobin returned non-nil error: %v", err)
- }
- // Switch to pickfirst.
- cc.handleServiceConfig(`{"loadBalancingPolicy": "pick_first"}`)
- if err := checkPickFirst(cc, servers); err != nil {
- t.Fatalf("check pickfirst returned non-nil error: %v", err)
- }
-}
-
-// Test that balancer specified by dial option will not be overridden.
-func TestBalancerDialOption(t *testing.T) {
- defer leakcheck.Check(t)
- r, rcleanup := manual.GenerateAndRegisterManualResolver()
- defer rcleanup()
-
- numServers := 2
- servers, _, scleanup := startServers(t, numServers, math.MaxInt32)
- defer scleanup()
-
- cc, err := Dial(r.Scheme()+":///test.server", WithInsecure(), WithCodec(testCodec{}), WithBalancerName(roundrobin.Name))
- if err != nil {
- t.Fatalf("failed to dial: %v", err)
- }
- defer cc.Close()
- r.NewAddress([]resolver.Address{{Addr: servers[0].addr}, {Addr: servers[1].addr}})
- // The init balancer is roundrobin.
- if err := checkRoundRobin(cc, servers); err != nil {
- t.Fatalf("check roundrobin returned non-nil error: %v", err)
- }
- // Switch to pickfirst.
- cc.handleServiceConfig(`{"loadBalancingPolicy": "pick_first"}`)
- // Balancer is still roundrobin.
- if err := checkRoundRobin(cc, servers); err != nil {
- t.Fatalf("check roundrobin returned non-nil error: %v", err)
- }
-}
-
-// First addr update contains grpclb.
-func TestSwitchBalancerGRPCLBFirst(t *testing.T) {
- defer leakcheck.Check(t)
- r, rcleanup := manual.GenerateAndRegisterManualResolver()
- defer rcleanup()
-
- cc, err := Dial(r.Scheme()+":///test.server", WithInsecure(), WithCodec(testCodec{}))
- if err != nil {
- t.Fatalf("failed to dial: %v", err)
- }
- defer cc.Close()
-
- // ClientConn will switch balancer to grpclb when receives an address of
- // type GRPCLB.
- r.NewAddress([]resolver.Address{{Addr: "backend"}, {Addr: "grpclb", Type: resolver.GRPCLB}})
- var isGRPCLB bool
- for i := 0; i < 5000; i++ {
- cc.mu.Lock()
- isGRPCLB = cc.curBalancerName == "grpclb"
- cc.mu.Unlock()
- if isGRPCLB {
- break
- }
- time.Sleep(time.Millisecond)
- }
- if !isGRPCLB {
- t.Fatalf("after 5 second, cc.balancer is of type %v, not grpclb", cc.curBalancerName)
- }
-
- // New update containing new backend and new grpclb. Should not switch
- // balancer.
- r.NewAddress([]resolver.Address{{Addr: "backend2"}, {Addr: "grpclb2", Type: resolver.GRPCLB}})
- for i := 0; i < 200; i++ {
- cc.mu.Lock()
- isGRPCLB = cc.curBalancerName == "grpclb"
- cc.mu.Unlock()
- if !isGRPCLB {
- break
- }
- time.Sleep(time.Millisecond)
- }
- if !isGRPCLB {
- t.Fatalf("within 200 ms, cc.balancer switched to !grpclb, want grpclb")
- }
-
- var isPickFirst bool
- // Switch balancer to pickfirst.
- r.NewAddress([]resolver.Address{{Addr: "backend"}})
- for i := 0; i < 5000; i++ {
- cc.mu.Lock()
- isPickFirst = cc.curBalancerName == PickFirstBalancerName
- cc.mu.Unlock()
- if isPickFirst {
- break
- }
- time.Sleep(time.Millisecond)
- }
- if !isPickFirst {
- t.Fatalf("after 5 second, cc.balancer is of type %v, not pick_first", cc.curBalancerName)
- }
-}
-
-// First addr update does not contain grpclb.
-func TestSwitchBalancerGRPCLBSecond(t *testing.T) {
- defer leakcheck.Check(t)
- r, rcleanup := manual.GenerateAndRegisterManualResolver()
- defer rcleanup()
-
- cc, err := Dial(r.Scheme()+":///test.server", WithInsecure(), WithCodec(testCodec{}))
- if err != nil {
- t.Fatalf("failed to dial: %v", err)
- }
- defer cc.Close()
-
- r.NewAddress([]resolver.Address{{Addr: "backend"}})
- var isPickFirst bool
- for i := 0; i < 5000; i++ {
- cc.mu.Lock()
- isPickFirst = cc.curBalancerName == PickFirstBalancerName
- cc.mu.Unlock()
- if isPickFirst {
- break
- }
- time.Sleep(time.Millisecond)
- }
- if !isPickFirst {
- t.Fatalf("after 5 second, cc.balancer is of type %v, not pick_first", cc.curBalancerName)
- }
-
- // ClientConn will switch balancer to grpclb when receives an address of
- // type GRPCLB.
- r.NewAddress([]resolver.Address{{Addr: "backend"}, {Addr: "grpclb", Type: resolver.GRPCLB}})
- var isGRPCLB bool
- for i := 0; i < 5000; i++ {
- cc.mu.Lock()
- isGRPCLB = cc.curBalancerName == "grpclb"
- cc.mu.Unlock()
- if isGRPCLB {
- break
- }
- time.Sleep(time.Millisecond)
- }
- if !isGRPCLB {
- t.Fatalf("after 5 second, cc.balancer is of type %v, not grpclb", cc.curBalancerName)
- }
-
- // New update containing new backend and new grpclb. Should not switch
- // balancer.
- r.NewAddress([]resolver.Address{{Addr: "backend2"}, {Addr: "grpclb2", Type: resolver.GRPCLB}})
- for i := 0; i < 200; i++ {
- cc.mu.Lock()
- isGRPCLB = cc.curBalancerName == "grpclb"
- cc.mu.Unlock()
- if !isGRPCLB {
- break
- }
- time.Sleep(time.Millisecond)
- }
- if !isGRPCLB {
- t.Fatalf("within 200 ms, cc.balancer switched to !grpclb, want grpclb")
- }
-
- // Switch balancer back.
- r.NewAddress([]resolver.Address{{Addr: "backend"}})
- for i := 0; i < 5000; i++ {
- cc.mu.Lock()
- isPickFirst = cc.curBalancerName == PickFirstBalancerName
- cc.mu.Unlock()
- if isPickFirst {
- break
- }
- time.Sleep(time.Millisecond)
- }
- if !isPickFirst {
- t.Fatalf("after 5 second, cc.balancer is of type %v, not pick_first", cc.curBalancerName)
- }
-}
-
-// Test that if the current balancer is roundrobin, after switching to grpclb,
-// when the resolved address doesn't contain grpclb addresses, balancer will be
-// switched back to roundrobin.
-func TestSwitchBalancerGRPCLBRoundRobin(t *testing.T) {
- defer leakcheck.Check(t)
- r, rcleanup := manual.GenerateAndRegisterManualResolver()
- defer rcleanup()
-
- cc, err := Dial(r.Scheme()+":///test.server", WithInsecure(), WithCodec(testCodec{}))
- if err != nil {
- t.Fatalf("failed to dial: %v", err)
- }
- defer cc.Close()
-
- r.NewServiceConfig(`{"loadBalancingPolicy": "round_robin"}`)
-
- r.NewAddress([]resolver.Address{{Addr: "backend"}})
- var isRoundRobin bool
- for i := 0; i < 5000; i++ {
- cc.mu.Lock()
- isRoundRobin = cc.curBalancerName == "round_robin"
- cc.mu.Unlock()
- if isRoundRobin {
- break
- }
- time.Sleep(time.Millisecond)
- }
- if !isRoundRobin {
- t.Fatalf("after 5 second, cc.balancer is of type %v, not round_robin", cc.curBalancerName)
- }
-
- // ClientConn will switch balancer to grpclb when receives an address of
- // type GRPCLB.
- r.NewAddress([]resolver.Address{{Addr: "grpclb", Type: resolver.GRPCLB}})
- var isGRPCLB bool
- for i := 0; i < 5000; i++ {
- cc.mu.Lock()
- isGRPCLB = cc.curBalancerName == "grpclb"
- cc.mu.Unlock()
- if isGRPCLB {
- break
- }
- time.Sleep(time.Millisecond)
- }
- if !isGRPCLB {
- t.Fatalf("after 5 second, cc.balancer is of type %v, not grpclb", cc.curBalancerName)
- }
-
- // Switch balancer back.
- r.NewAddress([]resolver.Address{{Addr: "backend"}})
- for i := 0; i < 5000; i++ {
- cc.mu.Lock()
- isRoundRobin = cc.curBalancerName == "round_robin"
- cc.mu.Unlock()
- if isRoundRobin {
- break
- }
- time.Sleep(time.Millisecond)
- }
- if !isRoundRobin {
- t.Fatalf("after 5 second, cc.balancer is of type %v, not round_robin", cc.curBalancerName)
- }
-}
-
-// Test that if resolved address list contains grpclb, the balancer option in
-// service config won't take effect. But when there's no grpclb address in a new
-// resolved address list, balancer will be switched to the new one.
-func TestSwitchBalancerGRPCLBServiceConfig(t *testing.T) {
- defer leakcheck.Check(t)
- r, rcleanup := manual.GenerateAndRegisterManualResolver()
- defer rcleanup()
-
- cc, err := Dial(r.Scheme()+":///test.server", WithInsecure(), WithCodec(testCodec{}))
- if err != nil {
- t.Fatalf("failed to dial: %v", err)
- }
- defer cc.Close()
-
- r.NewAddress([]resolver.Address{{Addr: "backend"}})
- var isPickFirst bool
- for i := 0; i < 5000; i++ {
- cc.mu.Lock()
- isPickFirst = cc.curBalancerName == PickFirstBalancerName
- cc.mu.Unlock()
- if isPickFirst {
- break
- }
- time.Sleep(time.Millisecond)
- }
- if !isPickFirst {
- t.Fatalf("after 5 second, cc.balancer is of type %v, not pick_first", cc.curBalancerName)
- }
-
- // ClientConn will switch balancer to grpclb when receives an address of
- // type GRPCLB.
- r.NewAddress([]resolver.Address{{Addr: "grpclb", Type: resolver.GRPCLB}})
- var isGRPCLB bool
- for i := 0; i < 5000; i++ {
- cc.mu.Lock()
- isGRPCLB = cc.curBalancerName == "grpclb"
- cc.mu.Unlock()
- if isGRPCLB {
- break
- }
- time.Sleep(time.Millisecond)
- }
- if !isGRPCLB {
- t.Fatalf("after 5 second, cc.balancer is of type %v, not grpclb", cc.curBalancerName)
- }
-
- r.NewServiceConfig(`{"loadBalancingPolicy": "round_robin"}`)
- var isRoundRobin bool
- for i := 0; i < 200; i++ {
- cc.mu.Lock()
- isRoundRobin = cc.curBalancerName == "round_robin"
- cc.mu.Unlock()
- if isRoundRobin {
- break
- }
- time.Sleep(time.Millisecond)
- }
- // Balancer should NOT switch to round_robin because resolved list contains
- // grpclb.
- if isRoundRobin {
- t.Fatalf("within 200 ms, cc.balancer switched to round_robin, want grpclb")
- }
-
- // Switch balancer back.
- r.NewAddress([]resolver.Address{{Addr: "backend"}})
- for i := 0; i < 5000; i++ {
- cc.mu.Lock()
- isRoundRobin = cc.curBalancerName == "round_robin"
- cc.mu.Unlock()
- if isRoundRobin {
- break
- }
- time.Sleep(time.Millisecond)
- }
- if !isRoundRobin {
- t.Fatalf("after 5 second, cc.balancer is of type %v, not round_robin", cc.curBalancerName)
- }
-}
diff --git a/vendor/google.golang.org/grpc/balancer_test.go b/vendor/google.golang.org/grpc/balancer_test.go
deleted file mode 100644
index 8675e7d5e..000000000
--- a/vendor/google.golang.org/grpc/balancer_test.go
+++ /dev/null
@@ -1,804 +0,0 @@
-/*
- *
- * Copyright 2016 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package grpc
-
-import (
- "fmt"
- "math"
- "strconv"
- "sync"
- "testing"
- "time"
-
- "golang.org/x/net/context"
- "google.golang.org/grpc/codes"
- _ "google.golang.org/grpc/grpclog/glogger"
- "google.golang.org/grpc/internal/leakcheck"
- "google.golang.org/grpc/naming"
- "google.golang.org/grpc/status"
-
- // V1 balancer tests use passthrough resolver instead of dns.
- // TODO(bar) remove this when removing v1 balaner entirely.
-
- _ "google.golang.org/grpc/resolver/passthrough"
-)
-
-type testWatcher struct {
- // the channel to receives name resolution updates
- update chan *naming.Update
- // the side channel to get to know how many updates in a batch
- side chan int
- // the channel to notify update injector that the update reading is done
- readDone chan int
-}
-
-func (w *testWatcher) Next() (updates []*naming.Update, err error) {
- n := <-w.side
- if n == 0 {
- return nil, fmt.Errorf("w.side is closed")
- }
- for i := 0; i < n; i++ {
- u := <-w.update
- if u != nil {
- updates = append(updates, u)
- }
- }
- w.readDone <- 0
- return
-}
-
-func (w *testWatcher) Close() {
- close(w.side)
-}
-
-// Inject naming resolution updates to the testWatcher.
-func (w *testWatcher) inject(updates []*naming.Update) {
- w.side <- len(updates)
- for _, u := range updates {
- w.update <- u
- }
- <-w.readDone
-}
-
-type testNameResolver struct {
- w *testWatcher
- addr string
-}
-
-func (r *testNameResolver) Resolve(target string) (naming.Watcher, error) {
- r.w = &testWatcher{
- update: make(chan *naming.Update, 1),
- side: make(chan int, 1),
- readDone: make(chan int),
- }
- r.w.side <- 1
- r.w.update <- &naming.Update{
- Op: naming.Add,
- Addr: r.addr,
- }
- go func() {
- <-r.w.readDone
- }()
- return r.w, nil
-}
-
-func startServers(t *testing.T, numServers int, maxStreams uint32) ([]*server, *testNameResolver, func()) {
- var servers []*server
- for i := 0; i < numServers; i++ {
- s := newTestServer()
- servers = append(servers, s)
- go s.start(t, 0, maxStreams)
- s.wait(t, 2*time.Second)
- }
- // Point to server[0]
- addr := "localhost:" + servers[0].port
- return servers, &testNameResolver{
- addr: addr,
- }, func() {
- for i := 0; i < numServers; i++ {
- servers[i].stop()
- }
- }
-}
-
-func TestNameDiscovery(t *testing.T) {
- defer leakcheck.Check(t)
- // Start 2 servers on 2 ports.
- numServers := 2
- servers, r, cleanup := startServers(t, numServers, math.MaxUint32)
- defer cleanup()
- cc, err := Dial("passthrough:///foo.bar.com", WithBalancer(RoundRobin(r)), WithBlock(), WithInsecure(), WithCodec(testCodec{}))
- if err != nil {
- t.Fatalf("Failed to create ClientConn: %v", err)
- }
- defer cc.Close()
- req := "port"
- var reply string
- if err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err == nil || errorDesc(err) != servers[0].port {
- t.Fatalf("grpc.Invoke(_, _, _, _, _) = %v, want %s", err, servers[0].port)
- }
- // Inject the name resolution change to remove servers[0] and add servers[1].
- var updates []*naming.Update
- updates = append(updates, &naming.Update{
- Op: naming.Delete,
- Addr: "localhost:" + servers[0].port,
- })
- updates = append(updates, &naming.Update{
- Op: naming.Add,
- Addr: "localhost:" + servers[1].port,
- })
- r.w.inject(updates)
- // Loop until the rpcs in flight talks to servers[1].
- for {
- if err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err != nil && errorDesc(err) == servers[1].port {
- break
- }
- time.Sleep(10 * time.Millisecond)
- }
-}
-
-func TestEmptyAddrs(t *testing.T) {
- defer leakcheck.Check(t)
- servers, r, cleanup := startServers(t, 1, math.MaxUint32)
- defer cleanup()
- cc, err := Dial("passthrough:///foo.bar.com", WithBalancer(RoundRobin(r)), WithBlock(), WithInsecure(), WithCodec(testCodec{}))
- if err != nil {
- t.Fatalf("Failed to create ClientConn: %v", err)
- }
- defer cc.Close()
- var reply string
- if err := cc.Invoke(context.Background(), "/foo/bar", &expectedRequest, &reply); err != nil || reply != expectedResponse {
- t.Fatalf("grpc.Invoke(_, _, _, _, _) = %v, reply = %q, want %q, <nil>", err, reply, expectedResponse)
- }
- // Inject name resolution change to remove the server so that there is no address
- // available after that.
- u := &naming.Update{
- Op: naming.Delete,
- Addr: "localhost:" + servers[0].port,
- }
- r.w.inject([]*naming.Update{u})
- // Loop until the above updates apply.
- for {
- time.Sleep(10 * time.Millisecond)
- ctx, cancel := context.WithTimeout(context.Background(), 10*time.Millisecond)
- if err := cc.Invoke(ctx, "/foo/bar", &expectedRequest, &reply); err != nil {
- cancel()
- break
- }
- cancel()
- }
-}
-
-func TestRoundRobin(t *testing.T) {
- defer leakcheck.Check(t)
- // Start 3 servers on 3 ports.
- numServers := 3
- servers, r, cleanup := startServers(t, numServers, math.MaxUint32)
- defer cleanup()
- cc, err := Dial("passthrough:///foo.bar.com", WithBalancer(RoundRobin(r)), WithBlock(), WithInsecure(), WithCodec(testCodec{}))
- if err != nil {
- t.Fatalf("Failed to create ClientConn: %v", err)
- }
- defer cc.Close()
- // Add servers[1] to the service discovery.
- u := &naming.Update{
- Op: naming.Add,
- Addr: "localhost:" + servers[1].port,
- }
- r.w.inject([]*naming.Update{u})
- req := "port"
- var reply string
- // Loop until servers[1] is up
- for {
- if err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err != nil && errorDesc(err) == servers[1].port {
- break
- }
- time.Sleep(10 * time.Millisecond)
- }
- // Add server2[2] to the service discovery.
- u = &naming.Update{
- Op: naming.Add,
- Addr: "localhost:" + servers[2].port,
- }
- r.w.inject([]*naming.Update{u})
- // Loop until both servers[2] are up.
- for {
- if err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err != nil && errorDesc(err) == servers[2].port {
- break
- }
- time.Sleep(10 * time.Millisecond)
- }
- // Check the incoming RPCs served in a round-robin manner.
- for i := 0; i < 10; i++ {
- if err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err == nil || errorDesc(err) != servers[i%numServers].port {
- t.Fatalf("Index %d: Invoke(_, _, _, _, _) = %v, want %s", i, err, servers[i%numServers].port)
- }
- }
-}
-
-func TestCloseWithPendingRPC(t *testing.T) {
- defer leakcheck.Check(t)
- servers, r, cleanup := startServers(t, 1, math.MaxUint32)
- defer cleanup()
- cc, err := Dial("passthrough:///foo.bar.com", WithBalancer(RoundRobin(r)), WithBlock(), WithInsecure(), WithCodec(testCodec{}))
- if err != nil {
- t.Fatalf("Failed to create ClientConn: %v", err)
- }
- defer cc.Close()
- var reply string
- if err := cc.Invoke(context.Background(), "/foo/bar", &expectedRequest, &reply, FailFast(false)); err != nil {
- t.Fatalf("grpc.Invoke(_, _, _, _, _) = %v, want %s", err, servers[0].port)
- }
- // Remove the server.
- updates := []*naming.Update{{
- Op: naming.Delete,
- Addr: "localhost:" + servers[0].port,
- }}
- r.w.inject(updates)
- // Loop until the above update applies.
- for {
- ctx, cancel := context.WithTimeout(context.Background(), 10*time.Millisecond)
- if err := cc.Invoke(ctx, "/foo/bar", &expectedRequest, &reply, FailFast(false)); status.Code(err) == codes.DeadlineExceeded {
- cancel()
- break
- }
- time.Sleep(10 * time.Millisecond)
- cancel()
- }
- // Issue 2 RPCs which should be completed with error status once cc is closed.
- var wg sync.WaitGroup
- wg.Add(2)
- go func() {
- defer wg.Done()
- var reply string
- if err := cc.Invoke(context.Background(), "/foo/bar", &expectedRequest, &reply, FailFast(false)); err == nil {
- t.Errorf("grpc.Invoke(_, _, _, _, _) = %v, want not nil", err)
- }
- }()
- go func() {
- defer wg.Done()
- var reply string
- time.Sleep(5 * time.Millisecond)
- if err := cc.Invoke(context.Background(), "/foo/bar", &expectedRequest, &reply, FailFast(false)); err == nil {
- t.Errorf("grpc.Invoke(_, _, _, _, _) = %v, want not nil", err)
- }
- }()
- time.Sleep(5 * time.Millisecond)
- cc.Close()
- wg.Wait()
-}
-
-func TestGetOnWaitChannel(t *testing.T) {
- defer leakcheck.Check(t)
- servers, r, cleanup := startServers(t, 1, math.MaxUint32)
- defer cleanup()
- cc, err := Dial("passthrough:///foo.bar.com", WithBalancer(RoundRobin(r)), WithBlock(), WithInsecure(), WithCodec(testCodec{}))
- if err != nil {
- t.Fatalf("Failed to create ClientConn: %v", err)
- }
- defer cc.Close()
- // Remove all servers so that all upcoming RPCs will block on waitCh.
- updates := []*naming.Update{{
- Op: naming.Delete,
- Addr: "localhost:" + servers[0].port,
- }}
- r.w.inject(updates)
- for {
- var reply string
- ctx, cancel := context.WithTimeout(context.Background(), 10*time.Millisecond)
- if err := cc.Invoke(ctx, "/foo/bar", &expectedRequest, &reply, FailFast(false)); status.Code(err) == codes.DeadlineExceeded {
- cancel()
- break
- }
- cancel()
- time.Sleep(10 * time.Millisecond)
- }
- var wg sync.WaitGroup
- wg.Add(1)
- go func() {
- defer wg.Done()
- var reply string
- if err := cc.Invoke(context.Background(), "/foo/bar", &expectedRequest, &reply, FailFast(false)); err != nil {
- t.Errorf("grpc.Invoke(_, _, _, _, _) = %v, want <nil>", err)
- }
- }()
- // Add a connected server to get the above RPC through.
- updates = []*naming.Update{{
- Op: naming.Add,
- Addr: "localhost:" + servers[0].port,
- }}
- r.w.inject(updates)
- // Wait until the above RPC succeeds.
- wg.Wait()
-}
-
-func TestOneServerDown(t *testing.T) {
- defer leakcheck.Check(t)
- // Start 2 servers.
- numServers := 2
- servers, r, cleanup := startServers(t, numServers, math.MaxUint32)
- defer cleanup()
- cc, err := Dial("passthrough:///foo.bar.com", WithBalancer(RoundRobin(r)), WithBlock(), WithInsecure(), WithCodec(testCodec{}), WithWaitForHandshake())
- if err != nil {
- t.Fatalf("Failed to create ClientConn: %v", err)
- }
- defer cc.Close()
- // Add servers[1] to the service discovery.
- var updates []*naming.Update
- updates = append(updates, &naming.Update{
- Op: naming.Add,
- Addr: "localhost:" + servers[1].port,
- })
- r.w.inject(updates)
- req := "port"
- var reply string
- // Loop until servers[1] is up
- for {
- if err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err != nil && errorDesc(err) == servers[1].port {
- break
- }
- time.Sleep(10 * time.Millisecond)
- }
-
- var wg sync.WaitGroup
- numRPC := 100
- sleepDuration := 10 * time.Millisecond
- wg.Add(1)
- go func() {
- time.Sleep(sleepDuration)
- // After sleepDuration, kill server[0].
- servers[0].stop()
- wg.Done()
- }()
-
- // All non-failfast RPCs should not block because there's at least one connection available.
- for i := 0; i < numRPC; i++ {
- wg.Add(1)
- go func() {
- time.Sleep(sleepDuration)
- // After sleepDuration, invoke RPC.
- // server[0] is killed around the same time to make it racy between balancer and gRPC internals.
- cc.Invoke(context.Background(), "/foo/bar", &req, &reply, FailFast(false))
- wg.Done()
- }()
- }
- wg.Wait()
-}
-
-func TestOneAddressRemoval(t *testing.T) {
- defer leakcheck.Check(t)
- // Start 2 servers.
- numServers := 2
- servers, r, cleanup := startServers(t, numServers, math.MaxUint32)
- defer cleanup()
- cc, err := Dial("passthrough:///foo.bar.com", WithBalancer(RoundRobin(r)), WithBlock(), WithInsecure(), WithCodec(testCodec{}))
- if err != nil {
- t.Fatalf("Failed to create ClientConn: %v", err)
- }
- defer cc.Close()
- // Add servers[1] to the service discovery.
- var updates []*naming.Update
- updates = append(updates, &naming.Update{
- Op: naming.Add,
- Addr: "localhost:" + servers[1].port,
- })
- r.w.inject(updates)
- req := "port"
- var reply string
- // Loop until servers[1] is up
- for {
- if err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err != nil && errorDesc(err) == servers[1].port {
- break
- }
- time.Sleep(10 * time.Millisecond)
- }
-
- var wg sync.WaitGroup
- numRPC := 100
- sleepDuration := 10 * time.Millisecond
- wg.Add(1)
- go func() {
- time.Sleep(sleepDuration)
- // After sleepDuration, delete server[0].
- var updates []*naming.Update
- updates = append(updates, &naming.Update{
- Op: naming.Delete,
- Addr: "localhost:" + servers[0].port,
- })
- r.w.inject(updates)
- wg.Done()
- }()
-
- // All non-failfast RPCs should not fail because there's at least one connection available.
- for i := 0; i < numRPC; i++ {
- wg.Add(1)
- go func() {
- var reply string
- time.Sleep(sleepDuration)
- // After sleepDuration, invoke RPC.
- // server[0] is removed around the same time to make it racy between balancer and gRPC internals.
- if err := cc.Invoke(context.Background(), "/foo/bar", &expectedRequest, &reply, FailFast(false)); err != nil {
- t.Errorf("grpc.Invoke(_, _, _, _, _) = %v, want nil", err)
- }
- wg.Done()
- }()
- }
- wg.Wait()
-}
-
-func checkServerUp(t *testing.T, currentServer *server) {
- req := "port"
- port := currentServer.port
- cc, err := Dial("passthrough:///localhost:"+port, WithBlock(), WithInsecure(), WithCodec(testCodec{}))
- if err != nil {
- t.Fatalf("Failed to create ClientConn: %v", err)
- }
- defer cc.Close()
- var reply string
- for {
- if err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err != nil && errorDesc(err) == port {
- break
- }
- time.Sleep(10 * time.Millisecond)
- }
-}
-
-func TestPickFirstEmptyAddrs(t *testing.T) {
- defer leakcheck.Check(t)
- servers, r, cleanup := startServers(t, 1, math.MaxUint32)
- defer cleanup()
- cc, err := Dial("passthrough:///foo.bar.com", WithBalancer(pickFirstBalancerV1(r)), WithBlock(), WithInsecure(), WithCodec(testCodec{}))
- if err != nil {
- t.Fatalf("Failed to create ClientConn: %v", err)
- }
- defer cc.Close()
- var reply string
- if err := cc.Invoke(context.Background(), "/foo/bar", &expectedRequest, &reply); err != nil || reply != expectedResponse {
- t.Fatalf("grpc.Invoke(_, _, _, _, _) = %v, reply = %q, want %q, <nil>", err, reply, expectedResponse)
- }
- // Inject name resolution change to remove the server so that there is no address
- // available after that.
- u := &naming.Update{
- Op: naming.Delete,
- Addr: "localhost:" + servers[0].port,
- }
- r.w.inject([]*naming.Update{u})
- // Loop until the above updates apply.
- for {
- time.Sleep(10 * time.Millisecond)
- ctx, cancel := context.WithTimeout(context.Background(), 10*time.Millisecond)
- if err := cc.Invoke(ctx, "/foo/bar", &expectedRequest, &reply); err != nil {
- cancel()
- break
- }
- cancel()
- }
-}
-
-func TestPickFirstCloseWithPendingRPC(t *testing.T) {
- defer leakcheck.Check(t)
- servers, r, cleanup := startServers(t, 1, math.MaxUint32)
- defer cleanup()
- cc, err := Dial("passthrough:///foo.bar.com", WithBalancer(pickFirstBalancerV1(r)), WithBlock(), WithInsecure(), WithCodec(testCodec{}))
- if err != nil {
- t.Fatalf("Failed to create ClientConn: %v", err)
- }
- defer cc.Close()
- var reply string
- if err := cc.Invoke(context.Background(), "/foo/bar", &expectedRequest, &reply, FailFast(false)); err != nil {
- t.Fatalf("grpc.Invoke(_, _, _, _, _) = %v, want %s", err, servers[0].port)
- }
- // Remove the server.
- updates := []*naming.Update{{
- Op: naming.Delete,
- Addr: "localhost:" + servers[0].port,
- }}
- r.w.inject(updates)
- // Loop until the above update applies.
- for {
- ctx, cancel := context.WithTimeout(context.Background(), 10*time.Millisecond)
- if err := cc.Invoke(ctx, "/foo/bar", &expectedRequest, &reply, FailFast(false)); status.Code(err) == codes.DeadlineExceeded {
- cancel()
- break
- }
- time.Sleep(10 * time.Millisecond)
- cancel()
- }
- // Issue 2 RPCs which should be completed with error status once cc is closed.
- var wg sync.WaitGroup
- wg.Add(2)
- go func() {
- defer wg.Done()
- var reply string
- if err := cc.Invoke(context.Background(), "/foo/bar", &expectedRequest, &reply, FailFast(false)); err == nil {
- t.Errorf("grpc.Invoke(_, _, _, _, _) = %v, want not nil", err)
- }
- }()
- go func() {
- defer wg.Done()
- var reply string
- time.Sleep(5 * time.Millisecond)
- if err := cc.Invoke(context.Background(), "/foo/bar", &expectedRequest, &reply, FailFast(false)); err == nil {
- t.Errorf("grpc.Invoke(_, _, _, _, _) = %v, want not nil", err)
- }
- }()
- time.Sleep(5 * time.Millisecond)
- cc.Close()
- wg.Wait()
-}
-
-func TestPickFirstOrderAllServerUp(t *testing.T) {
- defer leakcheck.Check(t)
- // Start 3 servers on 3 ports.
- numServers := 3
- servers, r, cleanup := startServers(t, numServers, math.MaxUint32)
- defer cleanup()
- cc, err := Dial("passthrough:///foo.bar.com", WithBalancer(pickFirstBalancerV1(r)), WithBlock(), WithInsecure(), WithCodec(testCodec{}))
- if err != nil {
- t.Fatalf("Failed to create ClientConn: %v", err)
- }
- defer cc.Close()
- // Add servers[1] and [2] to the service discovery.
- u := &naming.Update{
- Op: naming.Add,
- Addr: "localhost:" + servers[1].port,
- }
- r.w.inject([]*naming.Update{u})
-
- u = &naming.Update{
- Op: naming.Add,
- Addr: "localhost:" + servers[2].port,
- }
- r.w.inject([]*naming.Update{u})
-
- // Loop until all 3 servers are up
- checkServerUp(t, servers[0])
- checkServerUp(t, servers[1])
- checkServerUp(t, servers[2])
-
- // Check the incoming RPCs served in server[0]
- req := "port"
- var reply string
- for i := 0; i < 20; i++ {
- if err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err == nil || errorDesc(err) != servers[0].port {
- t.Fatalf("Index %d: Invoke(_, _, _, _, _) = %v, want %s", 0, err, servers[0].port)
- }
- time.Sleep(10 * time.Millisecond)
- }
-
- // Delete server[0] in the balancer, the incoming RPCs served in server[1]
- // For test addrconn, close server[0] instead
- u = &naming.Update{
- Op: naming.Delete,
- Addr: "localhost:" + servers[0].port,
- }
- r.w.inject([]*naming.Update{u})
- // Loop until it changes to server[1]
- for {
- if err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err != nil && errorDesc(err) == servers[1].port {
- break
- }
- time.Sleep(10 * time.Millisecond)
- }
- for i := 0; i < 20; i++ {
- if err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err == nil || errorDesc(err) != servers[1].port {
- t.Fatalf("Index %d: Invoke(_, _, _, _, _) = %v, want %s", 1, err, servers[1].port)
- }
- time.Sleep(10 * time.Millisecond)
- }
-
- // Add server[0] back to the balancer, the incoming RPCs served in server[1]
- // Add is append operation, the order of Notify now is {server[1].port server[2].port server[0].port}
- u = &naming.Update{
- Op: naming.Add,
- Addr: "localhost:" + servers[0].port,
- }
- r.w.inject([]*naming.Update{u})
- for i := 0; i < 20; i++ {
- if err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err == nil || errorDesc(err) != servers[1].port {
- t.Fatalf("Index %d: Invoke(_, _, _, _, _) = %v, want %s", 1, err, servers[1].port)
- }
- time.Sleep(10 * time.Millisecond)
- }
-
- // Delete server[1] in the balancer, the incoming RPCs served in server[2]
- u = &naming.Update{
- Op: naming.Delete,
- Addr: "localhost:" + servers[1].port,
- }
- r.w.inject([]*naming.Update{u})
- for {
- if err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err != nil && errorDesc(err) == servers[2].port {
- break
- }
- time.Sleep(1 * time.Second)
- }
- for i := 0; i < 20; i++ {
- if err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err == nil || errorDesc(err) != servers[2].port {
- t.Fatalf("Index %d: Invoke(_, _, _, _, _) = %v, want %s", 2, err, servers[2].port)
- }
- time.Sleep(10 * time.Millisecond)
- }
-
- // Delete server[2] in the balancer, the incoming RPCs served in server[0]
- u = &naming.Update{
- Op: naming.Delete,
- Addr: "localhost:" + servers[2].port,
- }
- r.w.inject([]*naming.Update{u})
- for {
- if err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err != nil && errorDesc(err) == servers[0].port {
- break
- }
- time.Sleep(1 * time.Second)
- }
- for i := 0; i < 20; i++ {
- if err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err == nil || errorDesc(err) != servers[0].port {
- t.Fatalf("Index %d: Invoke(_, _, _, _, _) = %v, want %s", 0, err, servers[0].port)
- }
- time.Sleep(10 * time.Millisecond)
- }
-}
-
-func TestPickFirstOrderOneServerDown(t *testing.T) {
- defer leakcheck.Check(t)
- // Start 3 servers on 3 ports.
- numServers := 3
- servers, r, cleanup := startServers(t, numServers, math.MaxUint32)
- defer cleanup()
- cc, err := Dial("passthrough:///foo.bar.com", WithBalancer(pickFirstBalancerV1(r)), WithBlock(), WithInsecure(), WithCodec(testCodec{}), WithWaitForHandshake())
- if err != nil {
- t.Fatalf("Failed to create ClientConn: %v", err)
- }
- defer cc.Close()
- // Add servers[1] and [2] to the service discovery.
- u := &naming.Update{
- Op: naming.Add,
- Addr: "localhost:" + servers[1].port,
- }
- r.w.inject([]*naming.Update{u})
-
- u = &naming.Update{
- Op: naming.Add,
- Addr: "localhost:" + servers[2].port,
- }
- r.w.inject([]*naming.Update{u})
-
- // Loop until all 3 servers are up
- checkServerUp(t, servers[0])
- checkServerUp(t, servers[1])
- checkServerUp(t, servers[2])
-
- // Check the incoming RPCs served in server[0]
- req := "port"
- var reply string
- for i := 0; i < 20; i++ {
- if err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err == nil || errorDesc(err) != servers[0].port {
- t.Fatalf("Index %d: Invoke(_, _, _, _, _) = %v, want %s", 0, err, servers[0].port)
- }
- time.Sleep(10 * time.Millisecond)
- }
-
- // server[0] down, incoming RPCs served in server[1], but the order of Notify still remains
- // {server[0] server[1] server[2]}
- servers[0].stop()
- // Loop until it changes to server[1]
- for {
- if err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err != nil && errorDesc(err) == servers[1].port {
- break
- }
- time.Sleep(10 * time.Millisecond)
- }
- for i := 0; i < 20; i++ {
- if err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err == nil || errorDesc(err) != servers[1].port {
- t.Fatalf("Index %d: Invoke(_, _, _, _, _) = %v, want %s", 1, err, servers[1].port)
- }
- time.Sleep(10 * time.Millisecond)
- }
-
- // up the server[0] back, the incoming RPCs served in server[1]
- p, _ := strconv.Atoi(servers[0].port)
- servers[0] = newTestServer()
- go servers[0].start(t, p, math.MaxUint32)
- defer servers[0].stop()
- servers[0].wait(t, 2*time.Second)
- checkServerUp(t, servers[0])
-
- for i := 0; i < 20; i++ {
- if err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err == nil || errorDesc(err) != servers[1].port {
- t.Fatalf("Index %d: Invoke(_, _, _, _, _) = %v, want %s", 1, err, servers[1].port)
- }
- time.Sleep(10 * time.Millisecond)
- }
-
- // Delete server[1] in the balancer, the incoming RPCs served in server[0]
- u = &naming.Update{
- Op: naming.Delete,
- Addr: "localhost:" + servers[1].port,
- }
- r.w.inject([]*naming.Update{u})
- for {
- if err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err != nil && errorDesc(err) == servers[0].port {
- break
- }
- time.Sleep(1 * time.Second)
- }
- for i := 0; i < 20; i++ {
- if err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err == nil || errorDesc(err) != servers[0].port {
- t.Fatalf("Index %d: Invoke(_, _, _, _, _) = %v, want %s", 0, err, servers[0].port)
- }
- time.Sleep(10 * time.Millisecond)
- }
-}
-
-func TestPickFirstOneAddressRemoval(t *testing.T) {
- defer leakcheck.Check(t)
- // Start 2 servers.
- numServers := 2
- servers, r, cleanup := startServers(t, numServers, math.MaxUint32)
- defer cleanup()
- cc, err := Dial("passthrough:///localhost:"+servers[0].port, WithBalancer(pickFirstBalancerV1(r)), WithBlock(), WithInsecure(), WithCodec(testCodec{}))
- if err != nil {
- t.Fatalf("Failed to create ClientConn: %v", err)
- }
- defer cc.Close()
- // Add servers[1] to the service discovery.
- var updates []*naming.Update
- updates = append(updates, &naming.Update{
- Op: naming.Add,
- Addr: "localhost:" + servers[1].port,
- })
- r.w.inject(updates)
-
- // Create a new cc to Loop until servers[1] is up
- checkServerUp(t, servers[0])
- checkServerUp(t, servers[1])
-
- var wg sync.WaitGroup
- numRPC := 100
- sleepDuration := 10 * time.Millisecond
- wg.Add(1)
- go func() {
- time.Sleep(sleepDuration)
- // After sleepDuration, delete server[0].
- var updates []*naming.Update
- updates = append(updates, &naming.Update{
- Op: naming.Delete,
- Addr: "localhost:" + servers[0].port,
- })
- r.w.inject(updates)
- wg.Done()
- }()
-
- // All non-failfast RPCs should not fail because there's at least one connection available.
- for i := 0; i < numRPC; i++ {
- wg.Add(1)
- go func() {
- var reply string
- time.Sleep(sleepDuration)
- // After sleepDuration, invoke RPC.
- // server[0] is removed around the same time to make it racy between balancer and gRPC internals.
- if err := cc.Invoke(context.Background(), "/foo/bar", &expectedRequest, &reply, FailFast(false)); err != nil {
- t.Errorf("grpc.Invoke(_, _, _, _, _) = %v, want nil", err)
- }
- wg.Done()
- }()
- }
- wg.Wait()
-}
diff --git a/vendor/google.golang.org/grpc/call_test.go b/vendor/google.golang.org/grpc/call_test.go
deleted file mode 100644
index d57d01e4a..000000000
--- a/vendor/google.golang.org/grpc/call_test.go
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- *
- * Copyright 2014 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package grpc
-
-import (
- "fmt"
- "io"
- "math"
- "net"
- "strconv"
- "strings"
- "sync"
- "testing"
- "time"
-
- "golang.org/x/net/context"
- "google.golang.org/grpc/codes"
- "google.golang.org/grpc/internal/leakcheck"
- "google.golang.org/grpc/status"
- "google.golang.org/grpc/transport"
-)
-
-var (
- expectedRequest = "ping"
- expectedResponse = "pong"
- weirdError = "format verbs: %v%s"
- sizeLargeErr = 1024 * 1024
- canceled = 0
-)
-
-type testCodec struct {
-}
-
-func (testCodec) Marshal(v interface{}) ([]byte, error) {
- return []byte(*(v.(*string))), nil
-}
-
-func (testCodec) Unmarshal(data []byte, v interface{}) error {
- *(v.(*string)) = string(data)
- return nil
-}
-
-func (testCodec) String() string {
- return "test"
-}
-
-type testStreamHandler struct {
- port string
- t transport.ServerTransport
-}
-
-func (h *testStreamHandler) handleStream(t *testing.T, s *transport.Stream) {
- p := &parser{r: s}
- for {
- pf, req, err := p.recvMsg(math.MaxInt32)
- if err == io.EOF {
- break
- }
- if err != nil {
- return
- }
- if pf != compressionNone {
- t.Errorf("Received the mistaken message format %d, want %d", pf, compressionNone)
- return
- }
- var v string
- codec := testCodec{}
- if err := codec.Unmarshal(req, &v); err != nil {
- t.Errorf("Failed to unmarshal the received message: %v", err)
- return
- }
- if v == "weird error" {
- h.t.WriteStatus(s, status.New(codes.Internal, weirdError))
- return
- }
- if v == "canceled" {
- canceled++
- h.t.WriteStatus(s, status.New(codes.Internal, ""))
- return
- }
- if v == "port" {
- h.t.WriteStatus(s, status.New(codes.Internal, h.port))
- return
- }
-
- if v != expectedRequest {
- h.t.WriteStatus(s, status.New(codes.Internal, strings.Repeat("A", sizeLargeErr)))
- return
- }
- }
- // send a response back to end the stream.
- data, err := encode(testCodec{}, &expectedResponse)
- if err != nil {
- t.Errorf("Failed to encode the response: %v", err)
- return
- }
- hdr, payload := msgHeader(data, nil)
- h.t.Write(s, hdr, payload, &transport.Options{})
- h.t.WriteStatus(s, status.New(codes.OK, ""))
-}
-
-type server struct {
- lis net.Listener
- port string
- addr string
- startedErr chan error // sent nil or an error after server starts
- mu sync.Mutex
- conns map[transport.ServerTransport]bool
-}
-
-func newTestServer() *server {
- return &server{startedErr: make(chan error, 1)}
-}
-
-// start starts server. Other goroutines should block on s.startedErr for further operations.
-func (s *server) start(t *testing.T, port int, maxStreams uint32) {
- var err error
- if port == 0 {
- s.lis, err = net.Listen("tcp", "localhost:0")
- } else {
- s.lis, err = net.Listen("tcp", "localhost:"+strconv.Itoa(port))
- }
- if err != nil {
- s.startedErr <- fmt.Errorf("failed to listen: %v", err)
- return
- }
- s.addr = s.lis.Addr().String()
- _, p, err := net.SplitHostPort(s.addr)
- if err != nil {
- s.startedErr <- fmt.Errorf("failed to parse listener address: %v", err)
- return
- }
- s.port = p
- s.conns = make(map[transport.ServerTransport]bool)
- s.startedErr <- nil
- for {
- conn, err := s.lis.Accept()
- if err != nil {
- return
- }
- config := &transport.ServerConfig{
- MaxStreams: maxStreams,
- }
- st, err := transport.NewServerTransport("http2", conn, config)
- if err != nil {
- continue
- }
- s.mu.Lock()
- if s.conns == nil {
- s.mu.Unlock()
- st.Close()
- return
- }
- s.conns[st] = true
- s.mu.Unlock()
- h := &testStreamHandler{
- port: s.port,
- t: st,
- }
- go st.HandleStreams(func(s *transport.Stream) {
- go h.handleStream(t, s)
- }, func(ctx context.Context, method string) context.Context {
- return ctx
- })
- }
-}
-
-func (s *server) wait(t *testing.T, timeout time.Duration) {
- select {
- case err := <-s.startedErr:
- if err != nil {
- t.Fatal(err)
- }
- case <-time.After(timeout):
- t.Fatalf("Timed out after %v waiting for server to be ready", timeout)
- }
-}
-
-func (s *server) stop() {
- s.lis.Close()
- s.mu.Lock()
- for c := range s.conns {
- c.Close()
- }
- s.conns = nil
- s.mu.Unlock()
-}
-
-func setUp(t *testing.T, port int, maxStreams uint32) (*server, *ClientConn) {
- server := newTestServer()
- go server.start(t, port, maxStreams)
- server.wait(t, 2*time.Second)
- addr := "localhost:" + server.port
- cc, err := Dial(addr, WithBlock(), WithInsecure(), WithCodec(testCodec{}))
- if err != nil {
- t.Fatalf("Failed to create ClientConn: %v", err)
- }
- return server, cc
-}
-
-func TestInvoke(t *testing.T) {
- defer leakcheck.Check(t)
- server, cc := setUp(t, 0, math.MaxUint32)
- var reply string
- if err := cc.Invoke(context.Background(), "/foo/bar", &expectedRequest, &reply); err != nil || reply != expectedResponse {
- t.Fatalf("grpc.Invoke(_, _, _, _, _) = %v, want <nil>", err)
- }
- cc.Close()
- server.stop()
-}
-
-func TestInvokeLargeErr(t *testing.T) {
- defer leakcheck.Check(t)
- server, cc := setUp(t, 0, math.MaxUint32)
- var reply string
- req := "hello"
- err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply)
- if _, ok := status.FromError(err); !ok {
- t.Fatalf("grpc.Invoke(_, _, _, _, _) receives non rpc error.")
- }
- if status.Code(err) != codes.Internal || len(errorDesc(err)) != sizeLargeErr {
- t.Fatalf("grpc.Invoke(_, _, _, _, _) = %v, want an error of code %d and desc size %d", err, codes.Internal, sizeLargeErr)
- }
- cc.Close()
- server.stop()
-}
-
-// TestInvokeErrorSpecialChars checks that error messages don't get mangled.
-func TestInvokeErrorSpecialChars(t *testing.T) {
- defer leakcheck.Check(t)
- server, cc := setUp(t, 0, math.MaxUint32)
- var reply string
- req := "weird error"
- err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply)
- if _, ok := status.FromError(err); !ok {
- t.Fatalf("grpc.Invoke(_, _, _, _, _) receives non rpc error.")
- }
- if got, want := errorDesc(err), weirdError; got != want {
- t.Fatalf("grpc.Invoke(_, _, _, _, _) error = %q, want %q", got, want)
- }
- cc.Close()
- server.stop()
-}
-
-// TestInvokeCancel checks that an Invoke with a canceled context is not sent.
-func TestInvokeCancel(t *testing.T) {
- defer leakcheck.Check(t)
- server, cc := setUp(t, 0, math.MaxUint32)
- var reply string
- req := "canceled"
- for i := 0; i < 100; i++ {
- ctx, cancel := context.WithCancel(context.Background())
- cancel()
- cc.Invoke(ctx, "/foo/bar", &req, &reply)
- }
- if canceled != 0 {
- t.Fatalf("received %d of 100 canceled requests", canceled)
- }
- cc.Close()
- server.stop()
-}
-
-// TestInvokeCancelClosedNonFail checks that a canceled non-failfast RPC
-// on a closed client will terminate.
-func TestInvokeCancelClosedNonFailFast(t *testing.T) {
- defer leakcheck.Check(t)
- server, cc := setUp(t, 0, math.MaxUint32)
- var reply string
- cc.Close()
- req := "hello"
- ctx, cancel := context.WithCancel(context.Background())
- cancel()
- if err := cc.Invoke(ctx, "/foo/bar", &req, &reply, FailFast(false)); err == nil {
- t.Fatalf("canceled invoke on closed connection should fail")
- }
- server.stop()
-}
diff --git a/vendor/google.golang.org/grpc/clientconn_test.go b/vendor/google.golang.org/grpc/clientconn_test.go
deleted file mode 100644
index fd239d36d..000000000
--- a/vendor/google.golang.org/grpc/clientconn_test.go
+++ /dev/null
@@ -1,678 +0,0 @@
-/*
- *
- * Copyright 2014 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package grpc
-
-import (
- "math"
- "net"
- "sync/atomic"
- "testing"
- "time"
-
- "golang.org/x/net/context"
- "golang.org/x/net/http2"
- "google.golang.org/grpc/connectivity"
- "google.golang.org/grpc/credentials"
- "google.golang.org/grpc/internal/backoff"
- "google.golang.org/grpc/internal/leakcheck"
- "google.golang.org/grpc/keepalive"
- "google.golang.org/grpc/naming"
- "google.golang.org/grpc/resolver"
- "google.golang.org/grpc/resolver/manual"
- _ "google.golang.org/grpc/resolver/passthrough"
- "google.golang.org/grpc/testdata"
-)
-
-var (
- mutableMinConnectTimeout = time.Second * 20
-)
-
-func init() {
- getMinConnectTimeout = func() time.Duration {
- return time.Duration(atomic.LoadInt64((*int64)(&mutableMinConnectTimeout)))
- }
-}
-
-func assertState(wantState connectivity.State, cc *ClientConn) (connectivity.State, bool) {
- ctx, cancel := context.WithTimeout(context.Background(), time.Second)
- defer cancel()
- var state connectivity.State
- for state = cc.GetState(); state != wantState && cc.WaitForStateChange(ctx, state); state = cc.GetState() {
- }
- return state, state == wantState
-}
-
-func TestDialWithMultipleBackendsNotSendingServerPreface(t *testing.T) {
- defer leakcheck.Check(t)
- numServers := 2
- servers := make([]net.Listener, numServers)
- var err error
- for i := 0; i < numServers; i++ {
- servers[i], err = net.Listen("tcp", "localhost:0")
- if err != nil {
- t.Fatalf("Error while listening. Err: %v", err)
- }
- }
- dones := make([]chan struct{}, numServers)
- for i := 0; i < numServers; i++ {
- dones[i] = make(chan struct{})
- }
- for i := 0; i < numServers; i++ {
- go func(i int) {
- defer func() {
- close(dones[i])
- }()
- conn, err := servers[i].Accept()
- if err != nil {
- t.Errorf("Error while accepting. Err: %v", err)
- return
- }
- defer conn.Close()
- switch i {
- case 0: // 1st server accepts the connection and immediately closes it.
- case 1: // 2nd server accepts the connection and sends settings frames.
- framer := http2.NewFramer(conn, conn)
- if err := framer.WriteSettings(http2.Setting{}); err != nil {
- t.Errorf("Error while writing settings frame. %v", err)
- return
- }
- conn.SetDeadline(time.Now().Add(time.Second))
- buf := make([]byte, 1024)
- for { // Make sure the connection stays healthy.
- _, err = conn.Read(buf)
- if err == nil {
- continue
- }
- if nerr, ok := err.(net.Error); !ok || !nerr.Timeout() {
- t.Errorf("Server expected the conn.Read(_) to timeout instead got error: %v", err)
- }
- return
- }
- }
- }(i)
- }
- r, cleanup := manual.GenerateAndRegisterManualResolver()
- defer cleanup()
- resolvedAddrs := make([]resolver.Address, numServers)
- for i := 0; i < numServers; i++ {
- resolvedAddrs[i] = resolver.Address{Addr: servers[i].Addr().String()}
- }
- r.InitialAddrs(resolvedAddrs)
- client, err := Dial(r.Scheme()+":///test.server", WithInsecure())
- if err != nil {
- t.Errorf("Dial failed. Err: %v", err)
- } else {
- defer client.Close()
- }
- time.Sleep(time.Second) // Close the servers after a second for cleanup.
- for _, s := range servers {
- s.Close()
- }
- for _, done := range dones {
- <-done
- }
-}
-
-func TestDialWaitsForServerSettings(t *testing.T) {
- defer leakcheck.Check(t)
- server, err := net.Listen("tcp", "localhost:0")
- if err != nil {
- t.Fatalf("Error while listening. Err: %v", err)
- }
- defer server.Close()
- done := make(chan struct{})
- sent := make(chan struct{})
- dialDone := make(chan struct{})
- go func() { // Launch the server.
- defer func() {
- close(done)
- }()
- conn, err := server.Accept()
- if err != nil {
- t.Errorf("Error while accepting. Err: %v", err)
- return
- }
- defer conn.Close()
- // Sleep for a little bit to make sure that Dial on client
- // side blocks until settings are received.
- time.Sleep(500 * time.Millisecond)
- framer := http2.NewFramer(conn, conn)
- close(sent)
- if err := framer.WriteSettings(http2.Setting{}); err != nil {
- t.Errorf("Error while writing settings. Err: %v", err)
- return
- }
- <-dialDone // Close conn only after dial returns.
- }()
- ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
- defer cancel()
- client, err := DialContext(ctx, server.Addr().String(), WithInsecure(), WithWaitForHandshake(), WithBlock())
- close(dialDone)
- if err != nil {
- cancel()
- t.Fatalf("Error while dialing. Err: %v", err)
- }
- defer client.Close()
- select {
- case <-sent:
- default:
- t.Fatalf("Dial returned before server settings were sent")
- }
- <-done
-
-}
-
-func TestCloseConnectionWhenServerPrefaceNotReceived(t *testing.T) {
- mctBkp := getMinConnectTimeout()
- // Call this only after transportMonitor goroutine has ended.
- defer func() {
- atomic.StoreInt64((*int64)(&mutableMinConnectTimeout), int64(mctBkp))
-
- }()
- defer leakcheck.Check(t)
- atomic.StoreInt64((*int64)(&mutableMinConnectTimeout), int64(time.Millisecond)*500)
- lis, err := net.Listen("tcp", "localhost:0")
- if err != nil {
- t.Fatalf("Error while listening. Err: %v", err)
- }
- var (
- conn2 net.Conn
- over uint32
- )
- defer func() {
- lis.Close()
- // conn2 shouldn't be closed until the client has
- // observed a successful test.
- if conn2 != nil {
- conn2.Close()
- }
- }()
- done := make(chan struct{})
- go func() { // Launch the server.
- defer close(done)
- conn1, err := lis.Accept()
- if err != nil {
- t.Errorf("Error while accepting. Err: %v", err)
- return
- }
- defer conn1.Close()
- // Don't send server settings and the client should close the connection and try again.
- conn2, err = lis.Accept() // Accept a reconnection request from client.
- if err != nil {
- t.Errorf("Error while accepting. Err: %v", err)
- return
- }
- framer := http2.NewFramer(conn2, conn2)
- if err = framer.WriteSettings(http2.Setting{}); err != nil {
- t.Errorf("Error while writing settings. Err: %v", err)
- return
- }
- b := make([]byte, 8)
- for {
- _, err = conn2.Read(b)
- if err == nil {
- continue
- }
- if atomic.LoadUint32(&over) == 1 {
- // The connection stayed alive for the timer.
- // Success.
- return
- }
- t.Errorf("Unexpected error while reading. Err: %v, want timeout error", err)
- break
- }
- }()
- client, err := Dial(lis.Addr().String(), WithInsecure())
- if err != nil {
- t.Fatalf("Error while dialing. Err: %v", err)
- }
- time.Sleep(time.Second * 2) // Let things play out.
- atomic.StoreUint32(&over, 1)
- lis.Close()
- client.Close()
- <-done
-}
-
-func TestBackoffWhenNoServerPrefaceReceived(t *testing.T) {
- defer leakcheck.Check(t)
- server, err := net.Listen("tcp", "localhost:0")
- if err != nil {
- t.Fatalf("Error while listening. Err: %v", err)
- }
- defer server.Close()
- done := make(chan struct{})
- go func() { // Launch the server.
- defer func() {
- close(done)
- }()
- conn, err := server.Accept() // Accept the connection only to close it immediately.
- if err != nil {
- t.Errorf("Error while accepting. Err: %v", err)
- return
- }
- prevAt := time.Now()
- conn.Close()
- var prevDuration time.Duration
- // Make sure the retry attempts are backed off properly.
- for i := 0; i < 3; i++ {
- conn, err := server.Accept()
- if err != nil {
- t.Errorf("Error while accepting. Err: %v", err)
- return
- }
- meow := time.Now()
- conn.Close()
- dr := meow.Sub(prevAt)
- if dr <= prevDuration {
- t.Errorf("Client backoff did not increase with retries. Previous duration: %v, current duration: %v", prevDuration, dr)
- return
- }
- prevDuration = dr
- prevAt = meow
- }
- }()
- client, err := Dial(server.Addr().String(), WithInsecure())
- if err != nil {
- t.Fatalf("Error while dialing. Err: %v", err)
- }
- defer client.Close()
- <-done
-
-}
-
-func TestConnectivityStates(t *testing.T) {
- defer leakcheck.Check(t)
- servers, resolver, cleanup := startServers(t, 2, math.MaxUint32)
- defer cleanup()
- cc, err := Dial("passthrough:///foo.bar.com", WithBalancer(RoundRobin(resolver)), WithInsecure())
- if err != nil {
- t.Fatalf("Dial(\"foo.bar.com\", WithBalancer(_)) = _, %v, want _ <nil>", err)
- }
- defer cc.Close()
- wantState := connectivity.Ready
- if state, ok := assertState(wantState, cc); !ok {
- t.Fatalf("asserState(%s) = %s, false, want %s, true", wantState, state, wantState)
- }
- // Send an update to delete the server connection (tearDown addrConn).
- update := []*naming.Update{
- {
- Op: naming.Delete,
- Addr: "localhost:" + servers[0].port,
- },
- }
- resolver.w.inject(update)
- wantState = connectivity.TransientFailure
- if state, ok := assertState(wantState, cc); !ok {
- t.Fatalf("asserState(%s) = %s, false, want %s, true", wantState, state, wantState)
- }
- update[0] = &naming.Update{
- Op: naming.Add,
- Addr: "localhost:" + servers[1].port,
- }
- resolver.w.inject(update)
- wantState = connectivity.Ready
- if state, ok := assertState(wantState, cc); !ok {
- t.Fatalf("asserState(%s) = %s, false, want %s, true", wantState, state, wantState)
- }
-
-}
-
-func TestWithTimeout(t *testing.T) {
- defer leakcheck.Check(t)
- conn, err := Dial("passthrough:///Non-Existent.Server:80", WithTimeout(time.Millisecond), WithBlock(), WithInsecure())
- if err == nil {
- conn.Close()
- }
- if err != context.DeadlineExceeded {
- t.Fatalf("Dial(_, _) = %v, %v, want %v", conn, err, context.DeadlineExceeded)
- }
-}
-
-func TestWithTransportCredentialsTLS(t *testing.T) {
- ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond)
- defer cancel()
- defer leakcheck.Check(t)
- creds, err := credentials.NewClientTLSFromFile(testdata.Path("ca.pem"), "x.test.youtube.com")
- if err != nil {
- t.Fatalf("Failed to create credentials %v", err)
- }
- conn, err := DialContext(ctx, "passthrough:///Non-Existent.Server:80", WithTransportCredentials(creds), WithBlock())
- if err == nil {
- conn.Close()
- }
- if err != context.DeadlineExceeded {
- t.Fatalf("Dial(_, _) = %v, %v, want %v", conn, err, context.DeadlineExceeded)
- }
-}
-
-func TestDefaultAuthority(t *testing.T) {
- defer leakcheck.Check(t)
- target := "Non-Existent.Server:8080"
- conn, err := Dial(target, WithInsecure())
- if err != nil {
- t.Fatalf("Dial(_, _) = _, %v, want _, <nil>", err)
- }
- defer conn.Close()
- if conn.authority != target {
- t.Fatalf("%v.authority = %v, want %v", conn, conn.authority, target)
- }
-}
-
-func TestTLSServerNameOverwrite(t *testing.T) {
- defer leakcheck.Check(t)
- overwriteServerName := "over.write.server.name"
- creds, err := credentials.NewClientTLSFromFile(testdata.Path("ca.pem"), overwriteServerName)
- if err != nil {
- t.Fatalf("Failed to create credentials %v", err)
- }
- conn, err := Dial("passthrough:///Non-Existent.Server:80", WithTransportCredentials(creds))
- if err != nil {
- t.Fatalf("Dial(_, _) = _, %v, want _, <nil>", err)
- }
- defer conn.Close()
- if conn.authority != overwriteServerName {
- t.Fatalf("%v.authority = %v, want %v", conn, conn.authority, overwriteServerName)
- }
-}
-
-func TestWithAuthority(t *testing.T) {
- defer leakcheck.Check(t)
- overwriteServerName := "over.write.server.name"
- conn, err := Dial("passthrough:///Non-Existent.Server:80", WithInsecure(), WithAuthority(overwriteServerName))
- if err != nil {
- t.Fatalf("Dial(_, _) = _, %v, want _, <nil>", err)
- }
- defer conn.Close()
- if conn.authority != overwriteServerName {
- t.Fatalf("%v.authority = %v, want %v", conn, conn.authority, overwriteServerName)
- }
-}
-
-func TestWithAuthorityAndTLS(t *testing.T) {
- defer leakcheck.Check(t)
- overwriteServerName := "over.write.server.name"
- creds, err := credentials.NewClientTLSFromFile(testdata.Path("ca.pem"), overwriteServerName)
- if err != nil {
- t.Fatalf("Failed to create credentials %v", err)
- }
- conn, err := Dial("passthrough:///Non-Existent.Server:80", WithTransportCredentials(creds), WithAuthority("no.effect.authority"))
- if err != nil {
- t.Fatalf("Dial(_, _) = _, %v, want _, <nil>", err)
- }
- defer conn.Close()
- if conn.authority != overwriteServerName {
- t.Fatalf("%v.authority = %v, want %v", conn, conn.authority, overwriteServerName)
- }
-}
-
-func TestDialContextCancel(t *testing.T) {
- defer leakcheck.Check(t)
- ctx, cancel := context.WithCancel(context.Background())
- cancel()
- if _, err := DialContext(ctx, "Non-Existent.Server:80", WithBlock(), WithInsecure()); err != context.Canceled {
- t.Fatalf("DialContext(%v, _) = _, %v, want _, %v", ctx, err, context.Canceled)
- }
-}
-
-// blockingBalancer mimics the behavior of balancers whose initialization takes a long time.
-// In this test, reading from blockingBalancer.Notify() blocks forever.
-type blockingBalancer struct {
- ch chan []Address
-}
-
-func newBlockingBalancer() Balancer {
- return &blockingBalancer{ch: make(chan []Address)}
-}
-func (b *blockingBalancer) Start(target string, config BalancerConfig) error {
- return nil
-}
-func (b *blockingBalancer) Up(addr Address) func(error) {
- return nil
-}
-func (b *blockingBalancer) Get(ctx context.Context, opts BalancerGetOptions) (addr Address, put func(), err error) {
- return Address{}, nil, nil
-}
-func (b *blockingBalancer) Notify() <-chan []Address {
- return b.ch
-}
-func (b *blockingBalancer) Close() error {
- close(b.ch)
- return nil
-}
-
-func TestDialWithBlockingBalancer(t *testing.T) {
- defer leakcheck.Check(t)
- ctx, cancel := context.WithCancel(context.Background())
- dialDone := make(chan struct{})
- go func() {
- DialContext(ctx, "Non-Existent.Server:80", WithBlock(), WithInsecure(), WithBalancer(newBlockingBalancer()))
- close(dialDone)
- }()
- cancel()
- <-dialDone
-}
-
-// securePerRPCCredentials always requires transport security.
-type securePerRPCCredentials struct{}
-
-func (c securePerRPCCredentials) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) {
- return nil, nil
-}
-
-func (c securePerRPCCredentials) RequireTransportSecurity() bool {
- return true
-}
-
-func TestCredentialsMisuse(t *testing.T) {
- defer leakcheck.Check(t)
- tlsCreds, err := credentials.NewClientTLSFromFile(testdata.Path("ca.pem"), "x.test.youtube.com")
- if err != nil {
- t.Fatalf("Failed to create authenticator %v", err)
- }
- // Two conflicting credential configurations
- if _, err := Dial("passthrough:///Non-Existent.Server:80", WithTransportCredentials(tlsCreds), WithBlock(), WithInsecure()); err != errCredentialsConflict {
- t.Fatalf("Dial(_, _) = _, %v, want _, %v", err, errCredentialsConflict)
- }
- // security info on insecure connection
- if _, err := Dial("passthrough:///Non-Existent.Server:80", WithPerRPCCredentials(securePerRPCCredentials{}), WithBlock(), WithInsecure()); err != errTransportCredentialsMissing {
- t.Fatalf("Dial(_, _) = _, %v, want _, %v", err, errTransportCredentialsMissing)
- }
-}
-
-func TestWithBackoffConfigDefault(t *testing.T) {
- defer leakcheck.Check(t)
- testBackoffConfigSet(t, &DefaultBackoffConfig)
-}
-
-func TestWithBackoffConfig(t *testing.T) {
- defer leakcheck.Check(t)
- b := BackoffConfig{MaxDelay: DefaultBackoffConfig.MaxDelay / 2}
- expected := b
- testBackoffConfigSet(t, &expected, WithBackoffConfig(b))
-}
-
-func TestWithBackoffMaxDelay(t *testing.T) {
- defer leakcheck.Check(t)
- md := DefaultBackoffConfig.MaxDelay / 2
- expected := BackoffConfig{MaxDelay: md}
- testBackoffConfigSet(t, &expected, WithBackoffMaxDelay(md))
-}
-
-func testBackoffConfigSet(t *testing.T, expected *BackoffConfig, opts ...DialOption) {
- opts = append(opts, WithInsecure())
- conn, err := Dial("passthrough:///foo:80", opts...)
- if err != nil {
- t.Fatalf("unexpected error dialing connection: %v", err)
- }
- defer conn.Close()
-
- if conn.dopts.bs == nil {
- t.Fatalf("backoff config not set")
- }
-
- actual, ok := conn.dopts.bs.(backoff.Exponential)
- if !ok {
- t.Fatalf("unexpected type of backoff config: %#v", conn.dopts.bs)
- }
-
- expectedValue := backoff.Exponential{
- MaxDelay: expected.MaxDelay,
- }
- if actual != expectedValue {
- t.Fatalf("unexpected backoff config on connection: %v, want %v", actual, expected)
- }
-}
-
-// emptyBalancer returns an empty set of servers.
-type emptyBalancer struct {
- ch chan []Address
-}
-
-func newEmptyBalancer() Balancer {
- return &emptyBalancer{ch: make(chan []Address, 1)}
-}
-func (b *emptyBalancer) Start(_ string, _ BalancerConfig) error {
- b.ch <- nil
- return nil
-}
-func (b *emptyBalancer) Up(_ Address) func(error) {
- return nil
-}
-func (b *emptyBalancer) Get(_ context.Context, _ BalancerGetOptions) (Address, func(), error) {
- return Address{}, nil, nil
-}
-func (b *emptyBalancer) Notify() <-chan []Address {
- return b.ch
-}
-func (b *emptyBalancer) Close() error {
- close(b.ch)
- return nil
-}
-
-func TestNonblockingDialWithEmptyBalancer(t *testing.T) {
- defer leakcheck.Check(t)
- ctx, cancel := context.WithCancel(context.Background())
- defer cancel()
- dialDone := make(chan error)
- go func() {
- dialDone <- func() error {
- conn, err := DialContext(ctx, "Non-Existent.Server:80", WithInsecure(), WithBalancer(newEmptyBalancer()))
- if err != nil {
- return err
- }
- return conn.Close()
- }()
- }()
- if err := <-dialDone; err != nil {
- t.Fatalf("unexpected error dialing connection: %s", err)
- }
-}
-
-func TestResolverServiceConfigBeforeAddressNotPanic(t *testing.T) {
- defer leakcheck.Check(t)
- r, rcleanup := manual.GenerateAndRegisterManualResolver()
- defer rcleanup()
-
- cc, err := Dial(r.Scheme()+":///test.server", WithInsecure())
- if err != nil {
- t.Fatalf("failed to dial: %v", err)
- }
- defer cc.Close()
-
- // SwitchBalancer before NewAddress. There was no balancer created, this
- // makes sure we don't call close on nil balancerWrapper.
- r.NewServiceConfig(`{"loadBalancingPolicy": "round_robin"}`) // This should not panic.
-
- time.Sleep(time.Second) // Sleep to make sure the service config is handled by ClientConn.
-}
-
-func TestResolverEmptyUpdateNotPanic(t *testing.T) {
- defer leakcheck.Check(t)
- r, rcleanup := manual.GenerateAndRegisterManualResolver()
- defer rcleanup()
-
- cc, err := Dial(r.Scheme()+":///test.server", WithInsecure())
- if err != nil {
- t.Fatalf("failed to dial: %v", err)
- }
- defer cc.Close()
-
- // This make sure we don't create addrConn with empty address list.
- r.NewAddress([]resolver.Address{}) // This should not panic.
-
- time.Sleep(time.Second) // Sleep to make sure the service config is handled by ClientConn.
-}
-
-func TestClientUpdatesParamsAfterGoAway(t *testing.T) {
- defer leakcheck.Check(t)
- lis, err := net.Listen("tcp", "localhost:0")
- if err != nil {
- t.Fatalf("Failed to listen. Err: %v", err)
- }
- defer lis.Close()
- addr := lis.Addr().String()
- s := NewServer()
- go s.Serve(lis)
- defer s.Stop()
- cc, err := Dial(addr, WithBlock(), WithInsecure(), WithKeepaliveParams(keepalive.ClientParameters{
- Time: 50 * time.Millisecond,
- Timeout: 100 * time.Millisecond,
- PermitWithoutStream: true,
- }))
- if err != nil {
- t.Fatalf("Dial(%s, _) = _, %v, want _, <nil>", addr, err)
- }
- defer cc.Close()
- time.Sleep(1 * time.Second)
- cc.mu.RLock()
- defer cc.mu.RUnlock()
- v := cc.mkp.Time
- if v < 100*time.Millisecond {
- t.Fatalf("cc.dopts.copts.Keepalive.Time = %v , want 100ms", v)
- }
-}
-
-func TestDisableServiceConfigOption(t *testing.T) {
- r, cleanup := manual.GenerateAndRegisterManualResolver()
- defer cleanup()
- addr := r.Scheme() + ":///non.existent"
- cc, err := Dial(addr, WithInsecure(), WithDisableServiceConfig())
- if err != nil {
- t.Fatalf("Dial(%s, _) = _, %v, want _, <nil>", addr, err)
- }
- defer cc.Close()
- r.NewServiceConfig(`{
- "methodConfig": [
- {
- "name": [
- {
- "service": "foo",
- "method": "Bar"
- }
- ],
- "waitForReady": true
- }
- ]
-}`)
- time.Sleep(1 * time.Second)
- m := cc.GetMethodConfig("/foo/Bar")
- if m.WaitForReady != nil {
- t.Fatalf("want: method (\"/foo/bar/\") config to be empty, got: %v", m)
- }
-}
diff --git a/vendor/google.golang.org/grpc/codec_test.go b/vendor/google.golang.org/grpc/codec_test.go
deleted file mode 100644
index 3fda708ed..000000000
--- a/vendor/google.golang.org/grpc/codec_test.go
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *
- * Copyright 2014 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package grpc
-
-import (
- "testing"
-
- "google.golang.org/grpc/encoding"
- "google.golang.org/grpc/encoding/proto"
-)
-
-func TestGetCodecForProtoIsNotNil(t *testing.T) {
- if encoding.GetCodec(proto.Name) == nil {
- t.Fatalf("encoding.GetCodec(%q) must not be nil by default", proto.Name)
- }
-}
diff --git a/vendor/google.golang.org/grpc/codes/codes_test.go b/vendor/google.golang.org/grpc/codes/codes_test.go
deleted file mode 100644
index d3e32d229..000000000
--- a/vendor/google.golang.org/grpc/codes/codes_test.go
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *
- * Copyright 2017 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package codes
-
-import (
- "encoding/json"
- "reflect"
- "testing"
-
- cpb "google.golang.org/genproto/googleapis/rpc/code"
-)
-
-func TestUnmarshalJSON(t *testing.T) {
- for s, v := range cpb.Code_value {
- want := Code(v)
- var got Code
- if err := got.UnmarshalJSON([]byte(`"` + s + `"`)); err != nil || got != want {
- t.Errorf("got.UnmarshalJSON(%q) = %v; want <nil>. got=%v; want %v", s, err, got, want)
- }
- }
-}
-
-func TestJSONUnmarshal(t *testing.T) {
- var got []Code
- want := []Code{OK, NotFound, Internal, Canceled}
- in := `["OK", "NOT_FOUND", "INTERNAL", "CANCELLED"]`
- err := json.Unmarshal([]byte(in), &got)
- if err != nil || !reflect.DeepEqual(got, want) {
- t.Fatalf("json.Unmarshal(%q, &got) = %v; want <nil>. got=%v; want %v", in, err, got, want)
- }
-}
-
-func TestUnmarshalJSON_NilReceiver(t *testing.T) {
- var got *Code
- in := OK.String()
- if err := got.UnmarshalJSON([]byte(in)); err == nil {
- t.Errorf("got.UnmarshalJSON(%q) = nil; want <non-nil>. got=%v", in, got)
- }
-}
-
-func TestUnmarshalJSON_UnknownInput(t *testing.T) {
- var got Code
- for _, in := range [][]byte{[]byte(""), []byte("xxx"), []byte("Code(17)"), nil} {
- if err := got.UnmarshalJSON([]byte(in)); err == nil {
- t.Errorf("got.UnmarshalJSON(%q) = nil; want <non-nil>. got=%v", in, got)
- }
- }
-}
-
-func TestUnmarshalJSON_MarshalUnmarshal(t *testing.T) {
- for i := 0; i < _maxCode; i++ {
- var cUnMarshaled Code
- c := Code(i)
-
- cJSON, err := json.Marshal(c)
- if err != nil {
- t.Errorf("marshalling %q failed: %v", c, err)
- }
-
- if err := json.Unmarshal(cJSON, &cUnMarshaled); err != nil {
- t.Errorf("unmarshalling code failed: %s", err)
- }
-
- if c != cUnMarshaled {
- t.Errorf("code is %q after marshalling/unmarshalling, expected %q", cUnMarshaled, c)
- }
- }
-}
diff --git a/vendor/google.golang.org/grpc/credentials/credentials_test.go b/vendor/google.golang.org/grpc/credentials/credentials_test.go
deleted file mode 100644
index 9b13db51d..000000000
--- a/vendor/google.golang.org/grpc/credentials/credentials_test.go
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- *
- * Copyright 2016 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package credentials
-
-import (
- "crypto/tls"
- "net"
- "testing"
-
- "golang.org/x/net/context"
- "google.golang.org/grpc/testdata"
-)
-
-func TestTLSOverrideServerName(t *testing.T) {
- expectedServerName := "server.name"
- c := NewTLS(nil)
- c.OverrideServerName(expectedServerName)
- if c.Info().ServerName != expectedServerName {
- t.Fatalf("c.Info().ServerName = %v, want %v", c.Info().ServerName, expectedServerName)
- }
-}
-
-func TestTLSClone(t *testing.T) {
- expectedServerName := "server.name"
- c := NewTLS(nil)
- c.OverrideServerName(expectedServerName)
- cc := c.Clone()
- if cc.Info().ServerName != expectedServerName {
- t.Fatalf("cc.Info().ServerName = %v, want %v", cc.Info().ServerName, expectedServerName)
- }
- cc.OverrideServerName("")
- if c.Info().ServerName != expectedServerName {
- t.Fatalf("Change in clone should not affect the original, c.Info().ServerName = %v, want %v", c.Info().ServerName, expectedServerName)
- }
-
-}
-
-type serverHandshake func(net.Conn) (AuthInfo, error)
-
-func TestClientHandshakeReturnsAuthInfo(t *testing.T) {
- done := make(chan AuthInfo, 1)
- lis := launchServer(t, tlsServerHandshake, done)
- defer lis.Close()
- lisAddr := lis.Addr().String()
- clientAuthInfo := clientHandle(t, gRPCClientHandshake, lisAddr)
- // wait until server sends serverAuthInfo or fails.
- serverAuthInfo, ok := <-done
- if !ok {
- t.Fatalf("Error at server-side")
- }
- if !compare(clientAuthInfo, serverAuthInfo) {
- t.Fatalf("c.ClientHandshake(_, %v, _) = %v, want %v.", lisAddr, clientAuthInfo, serverAuthInfo)
- }
-}
-
-func TestServerHandshakeReturnsAuthInfo(t *testing.T) {
- done := make(chan AuthInfo, 1)
- lis := launchServer(t, gRPCServerHandshake, done)
- defer lis.Close()
- clientAuthInfo := clientHandle(t, tlsClientHandshake, lis.Addr().String())
- // wait until server sends serverAuthInfo or fails.
- serverAuthInfo, ok := <-done
- if !ok {
- t.Fatalf("Error at server-side")
- }
- if !compare(clientAuthInfo, serverAuthInfo) {
- t.Fatalf("ServerHandshake(_) = %v, want %v.", serverAuthInfo, clientAuthInfo)
- }
-}
-
-func TestServerAndClientHandshake(t *testing.T) {
- done := make(chan AuthInfo, 1)
- lis := launchServer(t, gRPCServerHandshake, done)
- defer lis.Close()
- clientAuthInfo := clientHandle(t, gRPCClientHandshake, lis.Addr().String())
- // wait until server sends serverAuthInfo or fails.
- serverAuthInfo, ok := <-done
- if !ok {
- t.Fatalf("Error at server-side")
- }
- if !compare(clientAuthInfo, serverAuthInfo) {
- t.Fatalf("AuthInfo returned by server: %v and client: %v aren't same", serverAuthInfo, clientAuthInfo)
- }
-}
-
-func compare(a1, a2 AuthInfo) bool {
- if a1.AuthType() != a2.AuthType() {
- return false
- }
- switch a1.AuthType() {
- case "tls":
- state1 := a1.(TLSInfo).State
- state2 := a2.(TLSInfo).State
- if state1.Version == state2.Version &&
- state1.HandshakeComplete == state2.HandshakeComplete &&
- state1.CipherSuite == state2.CipherSuite &&
- state1.NegotiatedProtocol == state2.NegotiatedProtocol {
- return true
- }
- return false
- default:
- return false
- }
-}
-
-func launchServer(t *testing.T, hs serverHandshake, done chan AuthInfo) net.Listener {
- lis, err := net.Listen("tcp", "localhost:0")
- if err != nil {
- t.Fatalf("Failed to listen: %v", err)
- }
- go serverHandle(t, hs, done, lis)
- return lis
-}
-
-// Is run in a separate goroutine.
-func serverHandle(t *testing.T, hs serverHandshake, done chan AuthInfo, lis net.Listener) {
- serverRawConn, err := lis.Accept()
- if err != nil {
- t.Errorf("Server failed to accept connection: %v", err)
- close(done)
- return
- }
- serverAuthInfo, err := hs(serverRawConn)
- if err != nil {
- t.Errorf("Server failed while handshake. Error: %v", err)
- serverRawConn.Close()
- close(done)
- return
- }
- done <- serverAuthInfo
-}
-
-func clientHandle(t *testing.T, hs func(net.Conn, string) (AuthInfo, error), lisAddr string) AuthInfo {
- conn, err := net.Dial("tcp", lisAddr)
- if err != nil {
- t.Fatalf("Client failed to connect to %s. Error: %v", lisAddr, err)
- }
- defer conn.Close()
- clientAuthInfo, err := hs(conn, lisAddr)
- if err != nil {
- t.Fatalf("Error on client while handshake. Error: %v", err)
- }
- return clientAuthInfo
-}
-
-// Server handshake implementation in gRPC.
-func gRPCServerHandshake(conn net.Conn) (AuthInfo, error) {
- serverTLS, err := NewServerTLSFromFile(testdata.Path("server1.pem"), testdata.Path("server1.key"))
- if err != nil {
- return nil, err
- }
- _, serverAuthInfo, err := serverTLS.ServerHandshake(conn)
- if err != nil {
- return nil, err
- }
- return serverAuthInfo, nil
-}
-
-// Client handshake implementation in gRPC.
-func gRPCClientHandshake(conn net.Conn, lisAddr string) (AuthInfo, error) {
- clientTLS := NewTLS(&tls.Config{InsecureSkipVerify: true})
- _, authInfo, err := clientTLS.ClientHandshake(context.Background(), lisAddr, conn)
- if err != nil {
- return nil, err
- }
- return authInfo, nil
-}
-
-func tlsServerHandshake(conn net.Conn) (AuthInfo, error) {
- cert, err := tls.LoadX509KeyPair(testdata.Path("server1.pem"), testdata.Path("server1.key"))
- if err != nil {
- return nil, err
- }
- serverTLSConfig := &tls.Config{Certificates: []tls.Certificate{cert}}
- serverConn := tls.Server(conn, serverTLSConfig)
- err = serverConn.Handshake()
- if err != nil {
- return nil, err
- }
- return TLSInfo{State: serverConn.ConnectionState()}, nil
-}
-
-func tlsClientHandshake(conn net.Conn, _ string) (AuthInfo, error) {
- clientTLSConfig := &tls.Config{InsecureSkipVerify: true}
- clientConn := tls.Client(conn, clientTLSConfig)
- if err := clientConn.Handshake(); err != nil {
- return nil, err
- }
- return TLSInfo{State: clientConn.ConnectionState()}, nil
-}
diff --git a/vendor/google.golang.org/grpc/encoding/proto/proto_benchmark_test.go b/vendor/google.golang.org/grpc/encoding/proto/proto_benchmark_test.go
deleted file mode 100644
index 63ea57de2..000000000
--- a/vendor/google.golang.org/grpc/encoding/proto/proto_benchmark_test.go
+++ /dev/null
@@ -1,100 +0,0 @@
-// +build go1.7
-
-/*
- *
- * Copyright 2014 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package proto
-
-import (
- "fmt"
- "testing"
-
- "github.com/golang/protobuf/proto"
- "google.golang.org/grpc/encoding"
- "google.golang.org/grpc/test/codec_perf"
-)
-
-func setupBenchmarkProtoCodecInputs(payloadBaseSize uint32) []proto.Message {
- payloadBase := make([]byte, payloadBaseSize)
- // arbitrary byte slices
- payloadSuffixes := [][]byte{
- []byte("one"),
- []byte("two"),
- []byte("three"),
- []byte("four"),
- []byte("five"),
- }
- protoStructs := make([]proto.Message, 0)
-
- for _, p := range payloadSuffixes {
- ps := &codec_perf.Buffer{}
- ps.Body = append(payloadBase, p...)
- protoStructs = append(protoStructs, ps)
- }
-
- return protoStructs
-}
-
-// The possible use of certain protobuf APIs like the proto.Buffer API potentially involves caching
-// on our side. This can add checks around memory allocations and possible contention.
-// Example run: go test -v -run=^$ -bench=BenchmarkProtoCodec -benchmem
-func BenchmarkProtoCodec(b *testing.B) {
- // range of message sizes
- payloadBaseSizes := make([]uint32, 0)
- for i := uint32(0); i <= 12; i += 4 {
- payloadBaseSizes = append(payloadBaseSizes, 1<<i)
- }
- // range of SetParallelism
- parallelisms := make([]int, 0)
- for i := uint32(0); i <= 16; i += 4 {
- parallelisms = append(parallelisms, int(1<<i))
- }
- for _, s := range payloadBaseSizes {
- for _, p := range parallelisms {
- protoStructs := setupBenchmarkProtoCodecInputs(s)
- name := fmt.Sprintf("MinPayloadSize:%v/SetParallelism(%v)", s, p)
- b.Run(name, func(b *testing.B) {
- codec := &codec{}
- b.SetParallelism(p)
- b.RunParallel(func(pb *testing.PB) {
- benchmarkProtoCodec(codec, protoStructs, pb, b)
- })
- })
- }
- }
-}
-
-func benchmarkProtoCodec(codec *codec, protoStructs []proto.Message, pb *testing.PB, b *testing.B) {
- counter := 0
- for pb.Next() {
- counter++
- ps := protoStructs[counter%len(protoStructs)]
- fastMarshalAndUnmarshal(codec, ps, b)
- }
-}
-
-func fastMarshalAndUnmarshal(codec encoding.Codec, protoStruct proto.Message, b *testing.B) {
- marshaledBytes, err := codec.Marshal(protoStruct)
- if err != nil {
- b.Errorf("codec.Marshal(_) returned an error")
- }
- res := codec_perf.Buffer{}
- if err := codec.Unmarshal(marshaledBytes, &res); err != nil {
- b.Errorf("codec.Unmarshal(_) returned an error")
- }
-}
diff --git a/vendor/google.golang.org/grpc/encoding/proto/proto_test.go b/vendor/google.golang.org/grpc/encoding/proto/proto_test.go
deleted file mode 100644
index 10c6f7785..000000000
--- a/vendor/google.golang.org/grpc/encoding/proto/proto_test.go
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- *
- * Copyright 2018 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package proto
-
-import (
- "bytes"
- "sync"
- "testing"
-
- "google.golang.org/grpc/encoding"
- "google.golang.org/grpc/test/codec_perf"
-)
-
-func marshalAndUnmarshal(t *testing.T, codec encoding.Codec, expectedBody []byte) {
- p := &codec_perf.Buffer{}
- p.Body = expectedBody
-
- marshalledBytes, err := codec.Marshal(p)
- if err != nil {
- t.Errorf("codec.Marshal(_) returned an error")
- }
-
- if err := codec.Unmarshal(marshalledBytes, p); err != nil {
- t.Errorf("codec.Unmarshal(_) returned an error")
- }
-
- if !bytes.Equal(p.GetBody(), expectedBody) {
- t.Errorf("Unexpected body; got %v; want %v", p.GetBody(), expectedBody)
- }
-}
-
-func TestBasicProtoCodecMarshalAndUnmarshal(t *testing.T) {
- marshalAndUnmarshal(t, codec{}, []byte{1, 2, 3})
-}
-
-// Try to catch possible race conditions around use of pools
-func TestConcurrentUsage(t *testing.T) {
- const (
- numGoRoutines = 100
- numMarshUnmarsh = 1000
- )
-
- // small, arbitrary byte slices
- protoBodies := [][]byte{
- []byte("one"),
- []byte("two"),
- []byte("three"),
- []byte("four"),
- []byte("five"),
- }
-
- var wg sync.WaitGroup
- codec := codec{}
-
- for i := 0; i < numGoRoutines; i++ {
- wg.Add(1)
- go func() {
- defer wg.Done()
- for k := 0; k < numMarshUnmarsh; k++ {
- marshalAndUnmarshal(t, codec, protoBodies[k%len(protoBodies)])
- }
- }()
- }
-
- wg.Wait()
-}
-
-// TestStaggeredMarshalAndUnmarshalUsingSamePool tries to catch potential errors in which slices get
-// stomped on during reuse of a proto.Buffer.
-func TestStaggeredMarshalAndUnmarshalUsingSamePool(t *testing.T) {
- codec1 := codec{}
- codec2 := codec{}
-
- expectedBody1 := []byte{1, 2, 3}
- expectedBody2 := []byte{4, 5, 6}
-
- proto1 := codec_perf.Buffer{Body: expectedBody1}
- proto2 := codec_perf.Buffer{Body: expectedBody2}
-
- var m1, m2 []byte
- var err error
-
- if m1, err = codec1.Marshal(&proto1); err != nil {
- t.Errorf("codec.Marshal(%v) failed", proto1)
- }
-
- if m2, err = codec2.Marshal(&proto2); err != nil {
- t.Errorf("codec.Marshal(%v) failed", proto2)
- }
-
- if err = codec1.Unmarshal(m1, &proto1); err != nil {
- t.Errorf("codec.Unmarshal(%v) failed", m1)
- }
-
- if err = codec2.Unmarshal(m2, &proto2); err != nil {
- t.Errorf("codec.Unmarshal(%v) failed", m2)
- }
-
- b1 := proto1.GetBody()
- b2 := proto2.GetBody()
-
- for i, v := range b1 {
- if expectedBody1[i] != v {
- t.Errorf("expected %v at index %v but got %v", i, expectedBody1[i], v)
- }
- }
-
- for i, v := range b2 {
- if expectedBody2[i] != v {
- t.Errorf("expected %v at index %v but got %v", i, expectedBody2[i], v)
- }
- }
-}
diff --git a/vendor/google.golang.org/grpc/grpclog/loggerv2_test.go b/vendor/google.golang.org/grpc/grpclog/loggerv2_test.go
deleted file mode 100644
index 756f215f9..000000000
--- a/vendor/google.golang.org/grpc/grpclog/loggerv2_test.go
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *
- * Copyright 2017 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package grpclog
-
-import (
- "bytes"
- "fmt"
- "regexp"
- "testing"
-)
-
-func TestLoggerV2Severity(t *testing.T) {
- buffers := []*bytes.Buffer{new(bytes.Buffer), new(bytes.Buffer), new(bytes.Buffer)}
- SetLoggerV2(NewLoggerV2(buffers[infoLog], buffers[warningLog], buffers[errorLog]))
-
- Info(severityName[infoLog])
- Warning(severityName[warningLog])
- Error(severityName[errorLog])
-
- for i := 0; i < fatalLog; i++ {
- buf := buffers[i]
- // The content of info buffer should be something like:
- // INFO: 2017/04/07 14:55:42 INFO
- // WARNING: 2017/04/07 14:55:42 WARNING
- // ERROR: 2017/04/07 14:55:42 ERROR
- for j := i; j < fatalLog; j++ {
- b, err := buf.ReadBytes('\n')
- if err != nil {
- t.Fatal(err)
- }
- if err := checkLogForSeverity(j, b); err != nil {
- t.Fatal(err)
- }
- }
- }
-}
-
-// check if b is in the format of:
-// WARNING: 2017/04/07 14:55:42 WARNING
-func checkLogForSeverity(s int, b []byte) error {
- expected := regexp.MustCompile(fmt.Sprintf(`^%s: [0-9]{4}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} %s\n$`, severityName[s], severityName[s]))
- if m := expected.Match(b); !m {
- return fmt.Errorf("got: %v, want string in format of: %v", string(b), severityName[s]+": 2016/10/05 17:09:26 "+severityName[s])
- }
- return nil
-}
diff --git a/vendor/google.golang.org/grpc/metadata/metadata_test.go b/vendor/google.golang.org/grpc/metadata/metadata_test.go
deleted file mode 100644
index 4392145de..000000000
--- a/vendor/google.golang.org/grpc/metadata/metadata_test.go
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- *
- * Copyright 2014 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package metadata
-
-import (
- "reflect"
- "strconv"
- "testing"
-
- "golang.org/x/net/context"
-)
-
-func TestPairsMD(t *testing.T) {
- for _, test := range []struct {
- // input
- kv []string
- // output
- md MD
- }{
- {[]string{}, MD{}},
- {[]string{"k1", "v1", "k1", "v2"}, MD{"k1": []string{"v1", "v2"}}},
- } {
- md := Pairs(test.kv...)
- if !reflect.DeepEqual(md, test.md) {
- t.Fatalf("Pairs(%v) = %v, want %v", test.kv, md, test.md)
- }
- }
-}
-
-func TestCopy(t *testing.T) {
- const key, val = "key", "val"
- orig := Pairs(key, val)
- copy := orig.Copy()
- if !reflect.DeepEqual(orig, copy) {
- t.Errorf("copied value not equal to the original, got %v, want %v", copy, orig)
- }
- orig[key][0] = "foo"
- if v := copy[key][0]; v != val {
- t.Errorf("change in original should not affect copy, got %q, want %q", v, val)
- }
-}
-
-func TestJoin(t *testing.T) {
- for _, test := range []struct {
- mds []MD
- want MD
- }{
- {[]MD{}, MD{}},
- {[]MD{Pairs("foo", "bar")}, Pairs("foo", "bar")},
- {[]MD{Pairs("foo", "bar"), Pairs("foo", "baz")}, Pairs("foo", "bar", "foo", "baz")},
- {[]MD{Pairs("foo", "bar"), Pairs("foo", "baz"), Pairs("zip", "zap")}, Pairs("foo", "bar", "foo", "baz", "zip", "zap")},
- } {
- md := Join(test.mds...)
- if !reflect.DeepEqual(md, test.want) {
- t.Errorf("context's metadata is %v, want %v", md, test.want)
- }
- }
-}
-
-func TestGet(t *testing.T) {
- for _, test := range []struct {
- md MD
- key string
- wantVals []string
- }{
- {md: Pairs("My-Optional-Header", "42"), key: "My-Optional-Header", wantVals: []string{"42"}},
- {md: Pairs("Header", "42", "Header", "43", "Header", "44", "other", "1"), key: "HEADER", wantVals: []string{"42", "43", "44"}},
- {md: Pairs("HEADER", "10"), key: "HEADER", wantVals: []string{"10"}},
- } {
- vals := test.md.Get(test.key)
- if !reflect.DeepEqual(vals, test.wantVals) {
- t.Errorf("value of metadata %v is %v, want %v", test.key, vals, test.wantVals)
- }
- }
-}
-
-func TestSet(t *testing.T) {
- for _, test := range []struct {
- md MD
- setKey string
- setVals []string
- want MD
- }{
- {
- md: Pairs("My-Optional-Header", "42", "other-key", "999"),
- setKey: "Other-Key",
- setVals: []string{"1"},
- want: Pairs("my-optional-header", "42", "other-key", "1"),
- },
- {
- md: Pairs("My-Optional-Header", "42"),
- setKey: "Other-Key",
- setVals: []string{"1", "2", "3"},
- want: Pairs("my-optional-header", "42", "other-key", "1", "other-key", "2", "other-key", "3"),
- },
- {
- md: Pairs("My-Optional-Header", "42"),
- setKey: "Other-Key",
- setVals: []string{},
- want: Pairs("my-optional-header", "42"),
- },
- } {
- test.md.Set(test.setKey, test.setVals...)
- if !reflect.DeepEqual(test.md, test.want) {
- t.Errorf("value of metadata is %v, want %v", test.md, test.want)
- }
- }
-}
-
-func TestAppend(t *testing.T) {
- for _, test := range []struct {
- md MD
- appendKey string
- appendVals []string
- want MD
- }{
- {
- md: Pairs("My-Optional-Header", "42"),
- appendKey: "Other-Key",
- appendVals: []string{"1"},
- want: Pairs("my-optional-header", "42", "other-key", "1"),
- },
- {
- md: Pairs("My-Optional-Header", "42"),
- appendKey: "my-OptIoNal-HeAder",
- appendVals: []string{"1", "2", "3"},
- want: Pairs("my-optional-header", "42", "my-optional-header", "1",
- "my-optional-header", "2", "my-optional-header", "3"),
- },
- {
- md: Pairs("My-Optional-Header", "42"),
- appendKey: "my-OptIoNal-HeAder",
- appendVals: []string{},
- want: Pairs("my-optional-header", "42"),
- },
- } {
- test.md.Append(test.appendKey, test.appendVals...)
- if !reflect.DeepEqual(test.md, test.want) {
- t.Errorf("value of metadata is %v, want %v", test.md, test.want)
- }
- }
-}
-
-func TestAppendToOutgoingContext(t *testing.T) {
- // Pre-existing metadata
- ctx := NewOutgoingContext(context.Background(), Pairs("k1", "v1", "k2", "v2"))
- ctx = AppendToOutgoingContext(ctx, "k1", "v3")
- ctx = AppendToOutgoingContext(ctx, "k1", "v4")
- md, ok := FromOutgoingContext(ctx)
- if !ok {
- t.Errorf("Expected MD to exist in ctx, but got none")
- }
- want := Pairs("k1", "v1", "k1", "v3", "k1", "v4", "k2", "v2")
- if !reflect.DeepEqual(md, want) {
- t.Errorf("context's metadata is %v, want %v", md, want)
- }
-
- // No existing metadata
- ctx = AppendToOutgoingContext(context.Background(), "k1", "v1")
- md, ok = FromOutgoingContext(ctx)
- if !ok {
- t.Errorf("Expected MD to exist in ctx, but got none")
- }
- want = Pairs("k1", "v1")
- if !reflect.DeepEqual(md, want) {
- t.Errorf("context's metadata is %v, want %v", md, want)
- }
-}
-
-func TestAppendToOutgoingContext_Repeated(t *testing.T) {
- ctx := context.Background()
-
- for i := 0; i < 100; i = i + 2 {
- ctx1 := AppendToOutgoingContext(ctx, "k", strconv.Itoa(i))
- ctx2 := AppendToOutgoingContext(ctx, "k", strconv.Itoa(i+1))
-
- md1, _ := FromOutgoingContext(ctx1)
- md2, _ := FromOutgoingContext(ctx2)
-
- if reflect.DeepEqual(md1, md2) {
- t.Fatalf("md1, md2 = %v, %v; should not be equal", md1, md2)
- }
-
- ctx = ctx1
- }
-}
-
-func TestAppendToOutgoingContext_FromKVSlice(t *testing.T) {
- const k, v = "a", "b"
- kv := []string{k, v}
- ctx := AppendToOutgoingContext(context.Background(), kv...)
- md, _ := FromOutgoingContext(ctx)
- if md[k][0] != v {
- t.Fatalf("md[%q] = %q; want %q", k, md[k], v)
- }
- kv[1] = "xxx"
- md, _ = FromOutgoingContext(ctx)
- if md[k][0] != v {
- t.Fatalf("md[%q] = %q; want %q", k, md[k], v)
- }
-}
-
-// Old/slow approach to adding metadata to context
-func Benchmark_AddingMetadata_ContextManipulationApproach(b *testing.B) {
- // TODO: Add in N=1-100 tests once Go1.6 support is removed.
- const num = 10
- for n := 0; n < b.N; n++ {
- ctx := context.Background()
- for i := 0; i < num; i++ {
- md, _ := FromOutgoingContext(ctx)
- NewOutgoingContext(ctx, Join(Pairs("k1", "v1", "k2", "v2"), md))
- }
- }
-}
-
-// Newer/faster approach to adding metadata to context
-func BenchmarkAppendToOutgoingContext(b *testing.B) {
- const num = 10
- for n := 0; n < b.N; n++ {
- ctx := context.Background()
- for i := 0; i < num; i++ {
- ctx = AppendToOutgoingContext(ctx, "k1", "v1", "k2", "v2")
- }
- }
-}
-
-func BenchmarkFromOutgoingContext(b *testing.B) {
- ctx := context.Background()
- ctx = NewOutgoingContext(ctx, MD{"k3": {"v3", "v4"}})
- ctx = AppendToOutgoingContext(ctx, "k1", "v1", "k2", "v2")
-
- for n := 0; n < b.N; n++ {
- FromOutgoingContext(ctx)
- }
-}
diff --git a/vendor/google.golang.org/grpc/naming/dns_resolver_test.go b/vendor/google.golang.org/grpc/naming/dns_resolver_test.go
deleted file mode 100644
index be1ac1aec..000000000
--- a/vendor/google.golang.org/grpc/naming/dns_resolver_test.go
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- *
- * Copyright 2017 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package naming
-
-import (
- "fmt"
- "net"
- "reflect"
- "sync"
- "testing"
- "time"
-)
-
-func newUpdateWithMD(op Operation, addr, lb string) *Update {
- return &Update{
- Op: op,
- Addr: addr,
- Metadata: AddrMetadataGRPCLB{AddrType: GRPCLB, ServerName: lb},
- }
-}
-
-func toMap(u []*Update) map[string]*Update {
- m := make(map[string]*Update)
- for _, v := range u {
- m[v.Addr] = v
- }
- return m
-}
-
-func TestCompileUpdate(t *testing.T) {
- tests := []struct {
- oldAddrs []string
- newAddrs []string
- want []*Update
- }{
- {
- []string{},
- []string{"1.0.0.1"},
- []*Update{{Op: Add, Addr: "1.0.0.1"}},
- },
- {
- []string{"1.0.0.1"},
- []string{"1.0.0.1"},
- []*Update{},
- },
- {
- []string{"1.0.0.0"},
- []string{"1.0.0.1"},
- []*Update{{Op: Delete, Addr: "1.0.0.0"}, {Op: Add, Addr: "1.0.0.1"}},
- },
- {
- []string{"1.0.0.1"},
- []string{"1.0.0.0"},
- []*Update{{Op: Add, Addr: "1.0.0.0"}, {Op: Delete, Addr: "1.0.0.1"}},
- },
- {
- []string{"1.0.0.1"},
- []string{"1.0.0.1", "1.0.0.2", "1.0.0.3"},
- []*Update{{Op: Add, Addr: "1.0.0.2"}, {Op: Add, Addr: "1.0.0.3"}},
- },
- {
- []string{"1.0.0.1", "1.0.0.2", "1.0.0.3"},
- []string{"1.0.0.0"},
- []*Update{{Op: Add, Addr: "1.0.0.0"}, {Op: Delete, Addr: "1.0.0.1"}, {Op: Delete, Addr: "1.0.0.2"}, {Op: Delete, Addr: "1.0.0.3"}},
- },
- {
- []string{"1.0.0.1", "1.0.0.3", "1.0.0.5"},
- []string{"1.0.0.2", "1.0.0.3", "1.0.0.6"},
- []*Update{{Op: Delete, Addr: "1.0.0.1"}, {Op: Add, Addr: "1.0.0.2"}, {Op: Delete, Addr: "1.0.0.5"}, {Op: Add, Addr: "1.0.0.6"}},
- },
- {
- []string{"1.0.0.1", "1.0.0.1", "1.0.0.2"},
- []string{"1.0.0.1"},
- []*Update{{Op: Delete, Addr: "1.0.0.2"}},
- },
- }
-
- var w dnsWatcher
- for _, c := range tests {
- w.curAddrs = make(map[string]*Update)
- newUpdates := make(map[string]*Update)
- for _, a := range c.oldAddrs {
- w.curAddrs[a] = &Update{Addr: a}
- }
- for _, a := range c.newAddrs {
- newUpdates[a] = &Update{Addr: a}
- }
- r := w.compileUpdate(newUpdates)
- if !reflect.DeepEqual(toMap(c.want), toMap(r)) {
- t.Errorf("w(%+v).compileUpdate(%+v) = %+v, want %+v", c.oldAddrs, c.newAddrs, updatesToSlice(r), updatesToSlice(c.want))
- }
- }
-}
-
-func TestResolveFunc(t *testing.T) {
- tests := []struct {
- addr string
- want error
- }{
- // TODO(yuxuanli): More false cases?
- {"www.google.com", nil},
- {"foo.bar:12345", nil},
- {"127.0.0.1", nil},
- {"127.0.0.1:12345", nil},
- {"[::1]:80", nil},
- {"[2001:db8:a0b:12f0::1]:21", nil},
- {":80", nil},
- {"127.0.0...1:12345", nil},
- {"[fe80::1%lo0]:80", nil},
- {"golang.org:http", nil},
- {"[2001:db8::1]:http", nil},
- {":", nil},
- {"", errMissingAddr},
- {"[2001:db8:a0b:12f0::1", fmt.Errorf("invalid target address %v", "[2001:db8:a0b:12f0::1")},
- }
-
- r, err := NewDNSResolver()
- if err != nil {
- t.Errorf("%v", err)
- }
- for _, v := range tests {
- _, err := r.Resolve(v.addr)
- if !reflect.DeepEqual(err, v.want) {
- t.Errorf("Resolve(%q) = %v, want %v", v.addr, err, v.want)
- }
- }
-}
-
-var hostLookupTbl = map[string][]string{
- "foo.bar.com": {"1.2.3.4", "5.6.7.8"},
- "ipv4.single.fake": {"1.2.3.4"},
- "ipv4.multi.fake": {"1.2.3.4", "5.6.7.8", "9.10.11.12"},
- "ipv6.single.fake": {"2607:f8b0:400a:801::1001"},
- "ipv6.multi.fake": {"2607:f8b0:400a:801::1001", "2607:f8b0:400a:801::1002", "2607:f8b0:400a:801::1003"},
-}
-
-func hostLookup(host string) ([]string, error) {
- if addrs, ok := hostLookupTbl[host]; ok {
- return addrs, nil
- }
- return nil, fmt.Errorf("failed to lookup host:%s resolution in hostLookupTbl", host)
-}
-
-var srvLookupTbl = map[string][]*net.SRV{
- "_grpclb._tcp.srv.ipv4.single.fake": {&net.SRV{Target: "ipv4.single.fake", Port: 1234}},
- "_grpclb._tcp.srv.ipv4.multi.fake": {&net.SRV{Target: "ipv4.multi.fake", Port: 1234}},
- "_grpclb._tcp.srv.ipv6.single.fake": {&net.SRV{Target: "ipv6.single.fake", Port: 1234}},
- "_grpclb._tcp.srv.ipv6.multi.fake": {&net.SRV{Target: "ipv6.multi.fake", Port: 1234}},
-}
-
-func srvLookup(service, proto, name string) (string, []*net.SRV, error) {
- cname := "_" + service + "._" + proto + "." + name
- if srvs, ok := srvLookupTbl[cname]; ok {
- return cname, srvs, nil
- }
- return "", nil, fmt.Errorf("failed to lookup srv record for %s in srvLookupTbl", cname)
-}
-
-func updatesToSlice(updates []*Update) []Update {
- res := make([]Update, len(updates))
- for i, u := range updates {
- res[i] = *u
- }
- return res
-}
-
-func testResolver(t *testing.T, freq time.Duration, slp time.Duration) {
- tests := []struct {
- target string
- want []*Update
- }{
- {
- "foo.bar.com",
- []*Update{{Op: Add, Addr: "1.2.3.4" + colonDefaultPort}, {Op: Add, Addr: "5.6.7.8" + colonDefaultPort}},
- },
- {
- "foo.bar.com:1234",
- []*Update{{Op: Add, Addr: "1.2.3.4:1234"}, {Op: Add, Addr: "5.6.7.8:1234"}},
- },
- {
- "srv.ipv4.single.fake",
- []*Update{newUpdateWithMD(Add, "1.2.3.4:1234", "ipv4.single.fake")},
- },
- {
- "srv.ipv4.multi.fake",
- []*Update{
- newUpdateWithMD(Add, "1.2.3.4:1234", "ipv4.multi.fake"),
- newUpdateWithMD(Add, "5.6.7.8:1234", "ipv4.multi.fake"),
- newUpdateWithMD(Add, "9.10.11.12:1234", "ipv4.multi.fake")},
- },
- {
- "srv.ipv6.single.fake",
- []*Update{newUpdateWithMD(Add, "[2607:f8b0:400a:801::1001]:1234", "ipv6.single.fake")},
- },
- {
- "srv.ipv6.multi.fake",
- []*Update{
- newUpdateWithMD(Add, "[2607:f8b0:400a:801::1001]:1234", "ipv6.multi.fake"),
- newUpdateWithMD(Add, "[2607:f8b0:400a:801::1002]:1234", "ipv6.multi.fake"),
- newUpdateWithMD(Add, "[2607:f8b0:400a:801::1003]:1234", "ipv6.multi.fake"),
- },
- },
- }
-
- for _, a := range tests {
- r, err := NewDNSResolverWithFreq(freq)
- if err != nil {
- t.Fatalf("%v\n", err)
- }
- w, err := r.Resolve(a.target)
- if err != nil {
- t.Fatalf("%v\n", err)
- }
- updates, err := w.Next()
- if err != nil {
- t.Fatalf("%v\n", err)
- }
- if !reflect.DeepEqual(toMap(a.want), toMap(updates)) {
- t.Errorf("Resolve(%q) = %+v, want %+v\n", a.target, updatesToSlice(updates), updatesToSlice(a.want))
- }
- var wg sync.WaitGroup
- wg.Add(1)
- go func() {
- defer wg.Done()
- for {
- _, err := w.Next()
- if err != nil {
- return
- }
- t.Error("Execution shouldn't reach here, since w.Next() should be blocked until close happen.")
- }
- }()
- // Sleep for sometime to let watcher do more than one lookup
- time.Sleep(slp)
- w.Close()
- wg.Wait()
- }
-}
-
-func TestResolve(t *testing.T) {
- defer replaceNetFunc()()
- testResolver(t, time.Millisecond*5, time.Millisecond*10)
-}
-
-const colonDefaultPort = ":" + defaultPort
-
-func TestIPWatcher(t *testing.T) {
- tests := []struct {
- target string
- want []*Update
- }{
- {"127.0.0.1", []*Update{{Op: Add, Addr: "127.0.0.1" + colonDefaultPort}}},
- {"127.0.0.1:12345", []*Update{{Op: Add, Addr: "127.0.0.1:12345"}}},
- {"::1", []*Update{{Op: Add, Addr: "[::1]" + colonDefaultPort}}},
- {"[::1]:12345", []*Update{{Op: Add, Addr: "[::1]:12345"}}},
- {"[::1]:", []*Update{{Op: Add, Addr: "[::1]:443"}}},
- {"2001:db8:85a3::8a2e:370:7334", []*Update{{Op: Add, Addr: "[2001:db8:85a3::8a2e:370:7334]" + colonDefaultPort}}},
- {"[2001:db8:85a3::8a2e:370:7334]", []*Update{{Op: Add, Addr: "[2001:db8:85a3::8a2e:370:7334]" + colonDefaultPort}}},
- {"[2001:db8:85a3::8a2e:370:7334]:12345", []*Update{{Op: Add, Addr: "[2001:db8:85a3::8a2e:370:7334]:12345"}}},
- {"[2001:db8::1]:http", []*Update{{Op: Add, Addr: "[2001:db8::1]:http"}}},
- // TODO(yuxuanli): zone support?
- }
-
- for _, v := range tests {
- r, err := NewDNSResolverWithFreq(time.Millisecond * 5)
- if err != nil {
- t.Fatalf("%v\n", err)
- }
- w, err := r.Resolve(v.target)
- if err != nil {
- t.Fatalf("%v\n", err)
- }
- var updates []*Update
- var wg sync.WaitGroup
- wg.Add(1)
- count := 0
- go func() {
- defer wg.Done()
- for {
- u, err := w.Next()
- if err != nil {
- return
- }
- updates = u
- count++
- }
- }()
- // Sleep for sometime to let watcher do more than one lookup
- time.Sleep(time.Millisecond * 10)
- w.Close()
- wg.Wait()
- if !reflect.DeepEqual(v.want, updates) {
- t.Errorf("Resolve(%q) = %v, want %+v\n", v.target, updatesToSlice(updates), updatesToSlice(v.want))
- }
- if count != 1 {
- t.Errorf("IPWatcher Next() should return only once, not %d times\n", count)
- }
- }
-}
diff --git a/vendor/google.golang.org/grpc/naming/go17_test.go b/vendor/google.golang.org/grpc/naming/go17_test.go
deleted file mode 100644
index db39b9ab7..000000000
--- a/vendor/google.golang.org/grpc/naming/go17_test.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// +build go1.6, !go1.8
-
-/*
- *
- * Copyright 2017 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package naming
-
-import (
- "net"
-
- "golang.org/x/net/context"
-)
-
-func replaceNetFunc() func() {
- oldLookupHost := lookupHost
- oldLookupSRV := lookupSRV
- lookupHost = func(ctx context.Context, host string) ([]string, error) {
- return hostLookup(host)
- }
- lookupSRV = func(ctx context.Context, service, proto, name string) (string, []*net.SRV, error) {
- return srvLookup(service, proto, name)
- }
- return func() {
- lookupHost = oldLookupHost
- lookupSRV = oldLookupSRV
- }
-}
diff --git a/vendor/google.golang.org/grpc/naming/go18_test.go b/vendor/google.golang.org/grpc/naming/go18_test.go
deleted file mode 100644
index 5e297539b..000000000
--- a/vendor/google.golang.org/grpc/naming/go18_test.go
+++ /dev/null
@@ -1,41 +0,0 @@
-// +build go1.8
-
-/*
- *
- * Copyright 2017 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package naming
-
-import (
- "context"
- "net"
-)
-
-func replaceNetFunc() func() {
- oldLookupHost := lookupHost
- oldLookupSRV := lookupSRV
- lookupHost = func(ctx context.Context, host string) ([]string, error) {
- return hostLookup(host)
- }
- lookupSRV = func(ctx context.Context, service, proto, name string) (string, []*net.SRV, error) {
- return srvLookup(service, proto, name)
- }
- return func() {
- lookupHost = oldLookupHost
- lookupSRV = oldLookupSRV
- }
-}
diff --git a/vendor/google.golang.org/grpc/picker_wrapper_test.go b/vendor/google.golang.org/grpc/picker_wrapper_test.go
deleted file mode 100644
index d455286d3..000000000
--- a/vendor/google.golang.org/grpc/picker_wrapper_test.go
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- *
- * Copyright 2017 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package grpc
-
-import (
- "fmt"
- "sync/atomic"
- "testing"
- "time"
-
- "golang.org/x/net/context"
- "google.golang.org/grpc/balancer"
- "google.golang.org/grpc/connectivity"
- _ "google.golang.org/grpc/grpclog/glogger"
- "google.golang.org/grpc/internal/leakcheck"
- "google.golang.org/grpc/transport"
-)
-
-const goroutineCount = 5
-
-var (
- testT = &testTransport{}
- testSC = &acBalancerWrapper{ac: &addrConn{
- state: connectivity.Ready,
- transport: testT,
- }}
- testSCNotReady = &acBalancerWrapper{ac: &addrConn{
- state: connectivity.TransientFailure,
- }}
-)
-
-type testTransport struct {
- transport.ClientTransport
-}
-
-type testingPicker struct {
- err error
- sc balancer.SubConn
- maxCalled int64
-}
-
-func (p *testingPicker) Pick(ctx context.Context, opts balancer.PickOptions) (balancer.SubConn, func(balancer.DoneInfo), error) {
- if atomic.AddInt64(&p.maxCalled, -1) < 0 {
- return nil, nil, fmt.Errorf("Pick called to many times (> goroutineCount)")
- }
- if p.err != nil {
- return nil, nil, p.err
- }
- return p.sc, nil, nil
-}
-
-func TestBlockingPickTimeout(t *testing.T) {
- defer leakcheck.Check(t)
- bp := newPickerWrapper()
- ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond)
- defer cancel()
- if _, _, err := bp.pick(ctx, true, balancer.PickOptions{}); err != context.DeadlineExceeded {
- t.Errorf("bp.pick returned error %v, want DeadlineExceeded", err)
- }
-}
-
-func TestBlockingPick(t *testing.T) {
- defer leakcheck.Check(t)
- bp := newPickerWrapper()
- // All goroutines should block because picker is nil in bp.
- var finishedCount uint64
- for i := goroutineCount; i > 0; i-- {
- go func() {
- if tr, _, err := bp.pick(context.Background(), true, balancer.PickOptions{}); err != nil || tr != testT {
- t.Errorf("bp.pick returned non-nil error: %v", err)
- }
- atomic.AddUint64(&finishedCount, 1)
- }()
- }
- time.Sleep(50 * time.Millisecond)
- if c := atomic.LoadUint64(&finishedCount); c != 0 {
- t.Errorf("finished goroutines count: %v, want 0", c)
- }
- bp.updatePicker(&testingPicker{sc: testSC, maxCalled: goroutineCount})
-}
-
-func TestBlockingPickNoSubAvailable(t *testing.T) {
- defer leakcheck.Check(t)
- bp := newPickerWrapper()
- var finishedCount uint64
- bp.updatePicker(&testingPicker{err: balancer.ErrNoSubConnAvailable, maxCalled: goroutineCount})
- // All goroutines should block because picker returns no sc available.
- for i := goroutineCount; i > 0; i-- {
- go func() {
- if tr, _, err := bp.pick(context.Background(), true, balancer.PickOptions{}); err != nil || tr != testT {
- t.Errorf("bp.pick returned non-nil error: %v", err)
- }
- atomic.AddUint64(&finishedCount, 1)
- }()
- }
- time.Sleep(50 * time.Millisecond)
- if c := atomic.LoadUint64(&finishedCount); c != 0 {
- t.Errorf("finished goroutines count: %v, want 0", c)
- }
- bp.updatePicker(&testingPicker{sc: testSC, maxCalled: goroutineCount})
-}
-
-func TestBlockingPickTransientWaitforready(t *testing.T) {
- defer leakcheck.Check(t)
- bp := newPickerWrapper()
- bp.updatePicker(&testingPicker{err: balancer.ErrTransientFailure, maxCalled: goroutineCount})
- var finishedCount uint64
- // All goroutines should block because picker returns transientFailure and
- // picks are not failfast.
- for i := goroutineCount; i > 0; i-- {
- go func() {
- if tr, _, err := bp.pick(context.Background(), false, balancer.PickOptions{}); err != nil || tr != testT {
- t.Errorf("bp.pick returned non-nil error: %v", err)
- }
- atomic.AddUint64(&finishedCount, 1)
- }()
- }
- time.Sleep(time.Millisecond)
- if c := atomic.LoadUint64(&finishedCount); c != 0 {
- t.Errorf("finished goroutines count: %v, want 0", c)
- }
- bp.updatePicker(&testingPicker{sc: testSC, maxCalled: goroutineCount})
-}
-
-func TestBlockingPickSCNotReady(t *testing.T) {
- defer leakcheck.Check(t)
- bp := newPickerWrapper()
- bp.updatePicker(&testingPicker{sc: testSCNotReady, maxCalled: goroutineCount})
- var finishedCount uint64
- // All goroutines should block because sc is not ready.
- for i := goroutineCount; i > 0; i-- {
- go func() {
- if tr, _, err := bp.pick(context.Background(), true, balancer.PickOptions{}); err != nil || tr != testT {
- t.Errorf("bp.pick returned non-nil error: %v", err)
- }
- atomic.AddUint64(&finishedCount, 1)
- }()
- }
- time.Sleep(time.Millisecond)
- if c := atomic.LoadUint64(&finishedCount); c != 0 {
- t.Errorf("finished goroutines count: %v, want 0", c)
- }
- bp.updatePicker(&testingPicker{sc: testSC, maxCalled: goroutineCount})
-}
diff --git a/vendor/google.golang.org/grpc/pickfirst_test.go b/vendor/google.golang.org/grpc/pickfirst_test.go
deleted file mode 100644
index 7f8169f19..000000000
--- a/vendor/google.golang.org/grpc/pickfirst_test.go
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
- *
- * Copyright 2017 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package grpc
-
-import (
- "math"
- "sync"
- "testing"
- "time"
-
- "golang.org/x/net/context"
- "google.golang.org/grpc/codes"
- "google.golang.org/grpc/internal/leakcheck"
- "google.golang.org/grpc/resolver"
- "google.golang.org/grpc/resolver/manual"
- "google.golang.org/grpc/status"
-)
-
-func errorDesc(err error) string {
- if s, ok := status.FromError(err); ok {
- return s.Message()
- }
- return err.Error()
-}
-
-func TestOneBackendPickfirst(t *testing.T) {
- defer leakcheck.Check(t)
- r, rcleanup := manual.GenerateAndRegisterManualResolver()
- defer rcleanup()
-
- numServers := 1
- servers, _, scleanup := startServers(t, numServers, math.MaxInt32)
- defer scleanup()
-
- cc, err := Dial(r.Scheme()+":///test.server", WithInsecure(), WithCodec(testCodec{}))
- if err != nil {
- t.Fatalf("failed to dial: %v", err)
- }
- defer cc.Close()
- // The first RPC should fail because there's no address.
- ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond)
- defer cancel()
- req := "port"
- var reply string
- if err := cc.Invoke(ctx, "/foo/bar", &req, &reply); err == nil || status.Code(err) != codes.DeadlineExceeded {
- t.Fatalf("EmptyCall() = _, %v, want _, DeadlineExceeded", err)
- }
-
- r.NewAddress([]resolver.Address{{Addr: servers[0].addr}})
- // The second RPC should succeed.
- for i := 0; i < 1000; i++ {
- if err = cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err != nil && errorDesc(err) == servers[0].port {
- return
- }
- time.Sleep(time.Millisecond)
- }
- t.Fatalf("EmptyCall() = _, %v, want _, %v", err, servers[0].port)
-}
-
-func TestBackendsPickfirst(t *testing.T) {
- defer leakcheck.Check(t)
- r, rcleanup := manual.GenerateAndRegisterManualResolver()
- defer rcleanup()
-
- numServers := 2
- servers, _, scleanup := startServers(t, numServers, math.MaxInt32)
- defer scleanup()
-
- cc, err := Dial(r.Scheme()+":///test.server", WithInsecure(), WithCodec(testCodec{}))
- if err != nil {
- t.Fatalf("failed to dial: %v", err)
- }
- defer cc.Close()
- // The first RPC should fail because there's no address.
- ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond)
- defer cancel()
- req := "port"
- var reply string
- if err := cc.Invoke(ctx, "/foo/bar", &req, &reply); err == nil || status.Code(err) != codes.DeadlineExceeded {
- t.Fatalf("EmptyCall() = _, %v, want _, DeadlineExceeded", err)
- }
-
- r.NewAddress([]resolver.Address{{Addr: servers[0].addr}, {Addr: servers[1].addr}})
- // The second RPC should succeed with the first server.
- for i := 0; i < 1000; i++ {
- if err = cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err != nil && errorDesc(err) == servers[0].port {
- return
- }
- time.Sleep(time.Millisecond)
- }
- t.Fatalf("EmptyCall() = _, %v, want _, %v", err, servers[0].port)
-}
-
-func TestNewAddressWhileBlockingPickfirst(t *testing.T) {
- defer leakcheck.Check(t)
- r, rcleanup := manual.GenerateAndRegisterManualResolver()
- defer rcleanup()
-
- numServers := 1
- servers, _, scleanup := startServers(t, numServers, math.MaxInt32)
- defer scleanup()
-
- cc, err := Dial(r.Scheme()+":///test.server", WithInsecure(), WithCodec(testCodec{}))
- if err != nil {
- t.Fatalf("failed to dial: %v", err)
- }
- defer cc.Close()
- // The first RPC should fail because there's no address.
- ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond)
- defer cancel()
- req := "port"
- var reply string
- if err := cc.Invoke(ctx, "/foo/bar", &req, &reply); err == nil || status.Code(err) != codes.DeadlineExceeded {
- t.Fatalf("EmptyCall() = _, %v, want _, DeadlineExceeded", err)
- }
-
- var wg sync.WaitGroup
- for i := 0; i < 3; i++ {
- wg.Add(1)
- go func() {
- defer wg.Done()
- // This RPC blocks until NewAddress is called.
- cc.Invoke(context.Background(), "/foo/bar", &req, &reply)
- }()
- }
- time.Sleep(50 * time.Millisecond)
- r.NewAddress([]resolver.Address{{Addr: servers[0].addr}})
- wg.Wait()
-}
-
-func TestCloseWithPendingRPCPickfirst(t *testing.T) {
- defer leakcheck.Check(t)
- r, rcleanup := manual.GenerateAndRegisterManualResolver()
- defer rcleanup()
-
- numServers := 1
- _, _, scleanup := startServers(t, numServers, math.MaxInt32)
- defer scleanup()
-
- cc, err := Dial(r.Scheme()+":///test.server", WithInsecure(), WithCodec(testCodec{}))
- if err != nil {
- t.Fatalf("failed to dial: %v", err)
- }
- defer cc.Close()
- // The first RPC should fail because there's no address.
- ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond)
- defer cancel()
- req := "port"
- var reply string
- if err := cc.Invoke(ctx, "/foo/bar", &req, &reply); err == nil || status.Code(err) != codes.DeadlineExceeded {
- t.Fatalf("EmptyCall() = _, %v, want _, DeadlineExceeded", err)
- }
-
- var wg sync.WaitGroup
- for i := 0; i < 3; i++ {
- wg.Add(1)
- go func() {
- defer wg.Done()
- // This RPC blocks until NewAddress is called.
- cc.Invoke(context.Background(), "/foo/bar", &req, &reply)
- }()
- }
- time.Sleep(50 * time.Millisecond)
- cc.Close()
- wg.Wait()
-}
-
-func TestOneServerDownPickfirst(t *testing.T) {
- defer leakcheck.Check(t)
- r, rcleanup := manual.GenerateAndRegisterManualResolver()
- defer rcleanup()
-
- numServers := 2
- servers, _, scleanup := startServers(t, numServers, math.MaxInt32)
- defer scleanup()
-
- cc, err := Dial(r.Scheme()+":///test.server", WithInsecure(), WithCodec(testCodec{}), WithWaitForHandshake())
- if err != nil {
- t.Fatalf("failed to dial: %v", err)
- }
- defer cc.Close()
- // The first RPC should fail because there's no address.
- ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond)
- defer cancel()
- req := "port"
- var reply string
- if err := cc.Invoke(ctx, "/foo/bar", &req, &reply); err == nil || status.Code(err) != codes.DeadlineExceeded {
- t.Fatalf("EmptyCall() = _, %v, want _, DeadlineExceeded", err)
- }
-
- r.NewAddress([]resolver.Address{{Addr: servers[0].addr}, {Addr: servers[1].addr}})
- // The second RPC should succeed with the first server.
- for i := 0; i < 1000; i++ {
- if err = cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err != nil && errorDesc(err) == servers[0].port {
- break
- }
- time.Sleep(time.Millisecond)
- }
-
- servers[0].stop()
- for i := 0; i < 1000; i++ {
- if err = cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err != nil && errorDesc(err) == servers[1].port {
- return
- }
- time.Sleep(time.Millisecond)
- }
- t.Fatalf("EmptyCall() = _, %v, want _, %v", err, servers[0].port)
-}
-
-func TestAllServersDownPickfirst(t *testing.T) {
- defer leakcheck.Check(t)
- r, rcleanup := manual.GenerateAndRegisterManualResolver()
- defer rcleanup()
-
- numServers := 2
- servers, _, scleanup := startServers(t, numServers, math.MaxInt32)
- defer scleanup()
-
- cc, err := Dial(r.Scheme()+":///test.server", WithInsecure(), WithCodec(testCodec{}), WithWaitForHandshake())
- if err != nil {
- t.Fatalf("failed to dial: %v", err)
- }
- defer cc.Close()
- // The first RPC should fail because there's no address.
- ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond)
- defer cancel()
- req := "port"
- var reply string
- if err := cc.Invoke(ctx, "/foo/bar", &req, &reply); err == nil || status.Code(err) != codes.DeadlineExceeded {
- t.Fatalf("EmptyCall() = _, %v, want _, DeadlineExceeded", err)
- }
-
- r.NewAddress([]resolver.Address{{Addr: servers[0].addr}, {Addr: servers[1].addr}})
- // The second RPC should succeed with the first server.
- for i := 0; i < 1000; i++ {
- if err = cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err != nil && errorDesc(err) == servers[0].port {
- break
- }
- time.Sleep(time.Millisecond)
- }
-
- for i := 0; i < numServers; i++ {
- servers[i].stop()
- }
- for i := 0; i < 1000; i++ {
- if err = cc.Invoke(context.Background(), "/foo/bar", &req, &reply); status.Code(err) == codes.Unavailable {
- return
- }
- time.Sleep(time.Millisecond)
- }
- t.Fatalf("EmptyCall() = _, %v, want _, error with code unavailable", err)
-}
-
-func TestAddressesRemovedPickfirst(t *testing.T) {
- defer leakcheck.Check(t)
- r, rcleanup := manual.GenerateAndRegisterManualResolver()
- defer rcleanup()
-
- numServers := 3
- servers, _, scleanup := startServers(t, numServers, math.MaxInt32)
- defer scleanup()
-
- cc, err := Dial(r.Scheme()+":///test.server", WithInsecure(), WithCodec(testCodec{}))
- if err != nil {
- t.Fatalf("failed to dial: %v", err)
- }
- defer cc.Close()
- // The first RPC should fail because there's no address.
- ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond)
- defer cancel()
- req := "port"
- var reply string
- if err := cc.Invoke(ctx, "/foo/bar", &req, &reply); err == nil || status.Code(err) != codes.DeadlineExceeded {
- t.Fatalf("EmptyCall() = _, %v, want _, DeadlineExceeded", err)
- }
-
- r.NewAddress([]resolver.Address{{Addr: servers[0].addr}, {Addr: servers[1].addr}, {Addr: servers[2].addr}})
- for i := 0; i < 1000; i++ {
- if err = cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err != nil && errorDesc(err) == servers[0].port {
- break
- }
- time.Sleep(time.Millisecond)
- }
- for i := 0; i < 20; i++ {
- if err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err == nil || errorDesc(err) != servers[0].port {
- t.Fatalf("Index %d: Invoke(_, _, _, _, _) = %v, want %s", 0, err, servers[0].port)
- }
- time.Sleep(10 * time.Millisecond)
- }
-
- // Remove server[0].
- r.NewAddress([]resolver.Address{{Addr: servers[1].addr}, {Addr: servers[2].addr}})
- for i := 0; i < 1000; i++ {
- if err = cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err != nil && errorDesc(err) == servers[1].port {
- break
- }
- time.Sleep(time.Millisecond)
- }
- for i := 0; i < 20; i++ {
- if err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err == nil || errorDesc(err) != servers[1].port {
- t.Fatalf("Index %d: Invoke(_, _, _, _, _) = %v, want %s", 1, err, servers[1].port)
- }
- time.Sleep(10 * time.Millisecond)
- }
-
- // Append server[0], nothing should change.
- r.NewAddress([]resolver.Address{{Addr: servers[1].addr}, {Addr: servers[2].addr}, {Addr: servers[0].addr}})
- for i := 0; i < 20; i++ {
- if err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err == nil || errorDesc(err) != servers[1].port {
- t.Fatalf("Index %d: Invoke(_, _, _, _, _) = %v, want %s", 1, err, servers[1].port)
- }
- time.Sleep(10 * time.Millisecond)
- }
-
- // Remove server[1].
- r.NewAddress([]resolver.Address{{Addr: servers[2].addr}, {Addr: servers[0].addr}})
- for i := 0; i < 1000; i++ {
- if err = cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err != nil && errorDesc(err) == servers[2].port {
- break
- }
- time.Sleep(time.Millisecond)
- }
- for i := 0; i < 20; i++ {
- if err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err == nil || errorDesc(err) != servers[2].port {
- t.Fatalf("Index %d: Invoke(_, _, _, _, _) = %v, want %s", 2, err, servers[2].port)
- }
- time.Sleep(10 * time.Millisecond)
- }
-
- // Remove server[2].
- r.NewAddress([]resolver.Address{{Addr: servers[0].addr}})
- for i := 0; i < 1000; i++ {
- if err = cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err != nil && errorDesc(err) == servers[0].port {
- break
- }
- time.Sleep(time.Millisecond)
- }
- for i := 0; i < 20; i++ {
- if err := cc.Invoke(context.Background(), "/foo/bar", &req, &reply); err == nil || errorDesc(err) != servers[0].port {
- t.Fatalf("Index %d: Invoke(_, _, _, _, _) = %v, want %s", 0, err, servers[0].port)
- }
- time.Sleep(10 * time.Millisecond)
- }
-}
diff --git a/vendor/google.golang.org/grpc/proxy_test.go b/vendor/google.golang.org/grpc/proxy_test.go
deleted file mode 100644
index 7183ba342..000000000
--- a/vendor/google.golang.org/grpc/proxy_test.go
+++ /dev/null
@@ -1,182 +0,0 @@
-// +build !race
-
-/*
- *
- * Copyright 2017 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package grpc
-
-import (
- "bufio"
- "io"
- "net"
- "net/http"
- "net/url"
- "testing"
- "time"
-
- "golang.org/x/net/context"
- "google.golang.org/grpc/internal/leakcheck"
-)
-
-const (
- envTestAddr = "1.2.3.4:8080"
- envProxyAddr = "2.3.4.5:7687"
-)
-
-// overwriteAndRestore overwrite function httpProxyFromEnvironment and
-// returns a function to restore the default values.
-func overwrite(hpfe func(req *http.Request) (*url.URL, error)) func() {
- backHPFE := httpProxyFromEnvironment
- httpProxyFromEnvironment = hpfe
- return func() {
- httpProxyFromEnvironment = backHPFE
- }
-}
-
-type proxyServer struct {
- t *testing.T
- lis net.Listener
- in net.Conn
- out net.Conn
-}
-
-func (p *proxyServer) run() {
- in, err := p.lis.Accept()
- if err != nil {
- return
- }
- p.in = in
-
- req, err := http.ReadRequest(bufio.NewReader(in))
- if err != nil {
- p.t.Errorf("failed to read CONNECT req: %v", err)
- return
- }
- if req.Method != http.MethodConnect || req.UserAgent() != grpcUA {
- resp := http.Response{StatusCode: http.StatusMethodNotAllowed}
- resp.Write(p.in)
- p.in.Close()
- p.t.Errorf("get wrong CONNECT req: %+v", req)
- return
- }
-
- out, err := net.Dial("tcp", req.URL.Host)
- if err != nil {
- p.t.Errorf("failed to dial to server: %v", err)
- return
- }
- resp := http.Response{StatusCode: http.StatusOK, Proto: "HTTP/1.0"}
- resp.Write(p.in)
- p.out = out
- go io.Copy(p.in, p.out)
- go io.Copy(p.out, p.in)
-}
-
-func (p *proxyServer) stop() {
- p.lis.Close()
- if p.in != nil {
- p.in.Close()
- }
- if p.out != nil {
- p.out.Close()
- }
-}
-
-func TestHTTPConnect(t *testing.T) {
- defer leakcheck.Check(t)
- plis, err := net.Listen("tcp", "localhost:0")
- if err != nil {
- t.Fatalf("failed to listen: %v", err)
- }
- p := &proxyServer{t: t, lis: plis}
- go p.run()
- defer p.stop()
-
- blis, err := net.Listen("tcp", "localhost:0")
- if err != nil {
- t.Fatalf("failed to listen: %v", err)
- }
-
- msg := []byte{4, 3, 5, 2}
- recvBuf := make([]byte, len(msg))
- done := make(chan struct{})
- go func() {
- in, err := blis.Accept()
- if err != nil {
- t.Errorf("failed to accept: %v", err)
- return
- }
- defer in.Close()
- in.Read(recvBuf)
- close(done)
- }()
-
- // Overwrite the function in the test and restore them in defer.
- hpfe := func(req *http.Request) (*url.URL, error) {
- return &url.URL{Host: plis.Addr().String()}, nil
- }
- defer overwrite(hpfe)()
-
- // Dial to proxy server.
- dialer := newProxyDialer(func(ctx context.Context, addr string) (net.Conn, error) {
- if deadline, ok := ctx.Deadline(); ok {
- return net.DialTimeout("tcp", addr, deadline.Sub(time.Now()))
- }
- return net.Dial("tcp", addr)
- })
- ctx, cancel := context.WithTimeout(context.Background(), time.Second)
- defer cancel()
- c, err := dialer(ctx, blis.Addr().String())
- if err != nil {
- t.Fatalf("http connect Dial failed: %v", err)
- }
- defer c.Close()
-
- // Send msg on the connection.
- c.Write(msg)
- <-done
-
- // Check received msg.
- if string(recvBuf) != string(msg) {
- t.Fatalf("received msg: %v, want %v", recvBuf, msg)
- }
-}
-
-func TestMapAddressEnv(t *testing.T) {
- defer leakcheck.Check(t)
- // Overwrite the function in the test and restore them in defer.
- hpfe := func(req *http.Request) (*url.URL, error) {
- if req.URL.Host == envTestAddr {
- return &url.URL{
- Scheme: "https",
- Host: envProxyAddr,
- }, nil
- }
- return nil, nil
- }
- defer overwrite(hpfe)()
-
- // envTestAddr should be handled by ProxyFromEnvironment.
- got, err := mapAddress(context.Background(), envTestAddr)
- if err != nil {
- t.Error(err)
- }
- if got != envProxyAddr {
- t.Errorf("want %v, got %v", envProxyAddr, got)
- }
-}
diff --git a/vendor/google.golang.org/grpc/resolver/dns/dns_resolver_test.go b/vendor/google.golang.org/grpc/resolver/dns/dns_resolver_test.go
deleted file mode 100644
index 66c9735f7..000000000
--- a/vendor/google.golang.org/grpc/resolver/dns/dns_resolver_test.go
+++ /dev/null
@@ -1,936 +0,0 @@
-/*
- *
- * Copyright 2017 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package dns
-
-import (
- "fmt"
- "net"
- "os"
- "reflect"
- "sync"
- "testing"
- "time"
-
- "google.golang.org/grpc/internal/leakcheck"
- "google.golang.org/grpc/resolver"
-)
-
-func TestMain(m *testing.M) {
- cleanup := replaceNetFunc()
- code := m.Run()
- cleanup()
- os.Exit(code)
-}
-
-const (
- txtBytesLimit = 255
-)
-
-type testClientConn struct {
- target string
- m1 sync.Mutex
- addrs []resolver.Address
- a int
- m2 sync.Mutex
- sc string
- s int
-}
-
-func (t *testClientConn) NewAddress(addresses []resolver.Address) {
- t.m1.Lock()
- defer t.m1.Unlock()
- t.addrs = addresses
- t.a++
-}
-
-func (t *testClientConn) getAddress() ([]resolver.Address, int) {
- t.m1.Lock()
- defer t.m1.Unlock()
- return t.addrs, t.a
-}
-
-func (t *testClientConn) NewServiceConfig(serviceConfig string) {
- t.m2.Lock()
- defer t.m2.Unlock()
- t.sc = serviceConfig
- t.s++
-}
-
-func (t *testClientConn) getSc() (string, int) {
- t.m2.Lock()
- defer t.m2.Unlock()
- return t.sc, t.s
-}
-
-var hostLookupTbl = struct {
- sync.Mutex
- tbl map[string][]string
-}{
- tbl: map[string][]string{
- "foo.bar.com": {"1.2.3.4", "5.6.7.8"},
- "ipv4.single.fake": {"1.2.3.4"},
- "srv.ipv4.single.fake": {"2.4.6.8"},
- "ipv4.multi.fake": {"1.2.3.4", "5.6.7.8", "9.10.11.12"},
- "ipv6.single.fake": {"2607:f8b0:400a:801::1001"},
- "ipv6.multi.fake": {"2607:f8b0:400a:801::1001", "2607:f8b0:400a:801::1002", "2607:f8b0:400a:801::1003"},
- },
-}
-
-func hostLookup(host string) ([]string, error) {
- hostLookupTbl.Lock()
- defer hostLookupTbl.Unlock()
- if addrs, cnt := hostLookupTbl.tbl[host]; cnt {
- return addrs, nil
- }
- return nil, fmt.Errorf("failed to lookup host:%s resolution in hostLookupTbl", host)
-}
-
-var srvLookupTbl = struct {
- sync.Mutex
- tbl map[string][]*net.SRV
-}{
- tbl: map[string][]*net.SRV{
- "_grpclb._tcp.srv.ipv4.single.fake": {&net.SRV{Target: "ipv4.single.fake", Port: 1234}},
- "_grpclb._tcp.srv.ipv4.multi.fake": {&net.SRV{Target: "ipv4.multi.fake", Port: 1234}},
- "_grpclb._tcp.srv.ipv6.single.fake": {&net.SRV{Target: "ipv6.single.fake", Port: 1234}},
- "_grpclb._tcp.srv.ipv6.multi.fake": {&net.SRV{Target: "ipv6.multi.fake", Port: 1234}},
- },
-}
-
-func srvLookup(service, proto, name string) (string, []*net.SRV, error) {
- cname := "_" + service + "._" + proto + "." + name
- srvLookupTbl.Lock()
- defer srvLookupTbl.Unlock()
- if srvs, cnt := srvLookupTbl.tbl[cname]; cnt {
- return cname, srvs, nil
- }
- return "", nil, fmt.Errorf("failed to lookup srv record for %s in srvLookupTbl", cname)
-}
-
-// div divides a byte slice into a slice of strings, each of which is of maximum
-// 255 bytes length, which is the length limit per TXT record in DNS.
-func div(b []byte) []string {
- var r []string
- for i := 0; i < len(b); i += txtBytesLimit {
- if i+txtBytesLimit > len(b) {
- r = append(r, string(b[i:]))
- } else {
- r = append(r, string(b[i:i+txtBytesLimit]))
- }
- }
- return r
-}
-
-// scfs contains an array of service config file string in JSON format.
-// Notes about the scfs contents and usage:
-// scfs contains 4 service config file JSON strings for testing. Inside each
-// service config file, there are multiple choices. scfs[0:3] each contains 5
-// choices, and first 3 choices are nonmatching choices based on canarying rule,
-// while the last two are matched choices. scfs[3] only contains 3 choices, and
-// all of them are nonmatching based on canarying rule. For each of scfs[0:3],
-// the eventually returned service config, which is from the first of the two
-// matched choices, is stored in the corresponding scs element (e.g.
-// scfs[0]->scs[0]). scfs and scs elements are used in pair to test the dns
-// resolver functionality, with scfs as the input and scs used for validation of
-// the output. For scfs[3], it corresponds to empty service config, since there
-// isn't a matched choice.
-var scfs = []string{
- `[
- {
- "clientLanguage": [
- "CPP",
- "JAVA"
- ],
- "serviceConfig": {
- "loadBalancingPolicy": "grpclb",
- "methodConfig": [
- {
- "name": [
- {
- "service": "all"
- }
- ],
- "timeout": "1s"
- }
- ]
- }
- },
- {
- "percentage": 0,
- "serviceConfig": {
- "loadBalancingPolicy": "grpclb",
- "methodConfig": [
- {
- "name": [
- {
- "service": "all"
- }
- ],
- "timeout": "1s"
- }
- ]
- }
- },
- {
- "clientHostName": [
- "localhost"
- ],
- "serviceConfig": {
- "loadBalancingPolicy": "grpclb",
- "methodConfig": [
- {
- "name": [
- {
- "service": "all"
- }
- ],
- "timeout": "1s"
- }
- ]
- }
- },
- {
- "clientLanguage": [
- "GO"
- ],
- "percentage": 100,
- "serviceConfig": {
- "methodConfig": [
- {
- "name": [
- {
- "method": "bar"
- }
- ],
- "maxRequestMessageBytes": 1024,
- "maxResponseMessageBytes": 1024
- }
- ]
- }
- },
- {
- "serviceConfig": {
- "loadBalancingPolicy": "round_robin",
- "methodConfig": [
- {
- "name": [
- {
- "service": "foo",
- "method": "bar"
- }
- ],
- "waitForReady": true
- }
- ]
- }
- }
-]`,
- `[
- {
- "clientLanguage": [
- "CPP",
- "JAVA"
- ],
- "serviceConfig": {
- "loadBalancingPolicy": "grpclb",
- "methodConfig": [
- {
- "name": [
- {
- "service": "all"
- }
- ],
- "timeout": "1s"
- }
- ]
- }
- },
- {
- "percentage": 0,
- "serviceConfig": {
- "loadBalancingPolicy": "grpclb",
- "methodConfig": [
- {
- "name": [
- {
- "service": "all"
- }
- ],
- "timeout": "1s"
- }
- ]
- }
- },
- {
- "clientHostName": [
- "localhost"
- ],
- "serviceConfig": {
- "loadBalancingPolicy": "grpclb",
- "methodConfig": [
- {
- "name": [
- {
- "service": "all"
- }
- ],
- "timeout": "1s"
- }
- ]
- }
- },
- {
- "clientLanguage": [
- "GO"
- ],
- "percentage": 100,
- "serviceConfig": {
- "methodConfig": [
- {
- "name": [
- {
- "service": "foo",
- "method": "bar"
- }
- ],
- "waitForReady": true,
- "timeout": "1s",
- "maxRequestMessageBytes": 1024,
- "maxResponseMessageBytes": 1024
- }
- ]
- }
- },
- {
- "serviceConfig": {
- "loadBalancingPolicy": "round_robin",
- "methodConfig": [
- {
- "name": [
- {
- "service": "foo",
- "method": "bar"
- }
- ],
- "waitForReady": true
- }
- ]
- }
- }
-]`,
- `[
- {
- "clientLanguage": [
- "CPP",
- "JAVA"
- ],
- "serviceConfig": {
- "loadBalancingPolicy": "grpclb",
- "methodConfig": [
- {
- "name": [
- {
- "service": "all"
- }
- ],
- "timeout": "1s"
- }
- ]
- }
- },
- {
- "percentage": 0,
- "serviceConfig": {
- "loadBalancingPolicy": "grpclb",
- "methodConfig": [
- {
- "name": [
- {
- "service": "all"
- }
- ],
- "timeout": "1s"
- }
- ]
- }
- },
- {
- "clientHostName": [
- "localhost"
- ],
- "serviceConfig": {
- "loadBalancingPolicy": "grpclb",
- "methodConfig": [
- {
- "name": [
- {
- "service": "all"
- }
- ],
- "timeout": "1s"
- }
- ]
- }
- },
- {
- "clientLanguage": [
- "GO"
- ],
- "percentage": 100,
- "serviceConfig": {
- "loadBalancingPolicy": "round_robin",
- "methodConfig": [
- {
- "name": [
- {
- "service": "foo"
- }
- ],
- "waitForReady": true,
- "timeout": "1s"
- },
- {
- "name": [
- {
- "service": "bar"
- }
- ],
- "waitForReady": false
- }
- ]
- }
- },
- {
- "serviceConfig": {
- "loadBalancingPolicy": "round_robin",
- "methodConfig": [
- {
- "name": [
- {
- "service": "foo",
- "method": "bar"
- }
- ],
- "waitForReady": true
- }
- ]
- }
- }
-]`,
- `[
- {
- "clientLanguage": [
- "CPP",
- "JAVA"
- ],
- "serviceConfig": {
- "loadBalancingPolicy": "grpclb",
- "methodConfig": [
- {
- "name": [
- {
- "service": "all"
- }
- ],
- "timeout": "1s"
- }
- ]
- }
- },
- {
- "percentage": 0,
- "serviceConfig": {
- "loadBalancingPolicy": "grpclb",
- "methodConfig": [
- {
- "name": [
- {
- "service": "all"
- }
- ],
- "timeout": "1s"
- }
- ]
- }
- },
- {
- "clientHostName": [
- "localhost"
- ],
- "serviceConfig": {
- "loadBalancingPolicy": "grpclb",
- "methodConfig": [
- {
- "name": [
- {
- "service": "all"
- }
- ],
- "timeout": "1s"
- }
- ]
- }
- }
-]`,
-}
-
-// scs contains an array of service config string in JSON format.
-var scs = []string{
- `{
- "methodConfig": [
- {
- "name": [
- {
- "method": "bar"
- }
- ],
- "maxRequestMessageBytes": 1024,
- "maxResponseMessageBytes": 1024
- }
- ]
- }`,
- `{
- "methodConfig": [
- {
- "name": [
- {
- "service": "foo",
- "method": "bar"
- }
- ],
- "waitForReady": true,
- "timeout": "1s",
- "maxRequestMessageBytes": 1024,
- "maxResponseMessageBytes": 1024
- }
- ]
- }`,
- `{
- "loadBalancingPolicy": "round_robin",
- "methodConfig": [
- {
- "name": [
- {
- "service": "foo"
- }
- ],
- "waitForReady": true,
- "timeout": "1s"
- },
- {
- "name": [
- {
- "service": "bar"
- }
- ],
- "waitForReady": false
- }
- ]
- }`,
-}
-
-// scLookupTbl is a set, which contains targets that have service config. Target
-// not in this set should not have service config.
-var scLookupTbl = map[string]bool{
- "foo.bar.com": true,
- "srv.ipv4.single.fake": true,
- "srv.ipv4.multi.fake": true,
- "no.attribute": true,
-}
-
-// generateSCF generates a slice of strings (aggregately representing a single
-// service config file) for the input name, which mocks the result from a real
-// DNS TXT record lookup.
-func generateSCF(name string) []string {
- var b []byte
- switch name {
- case "foo.bar.com":
- b = []byte(scfs[0])
- case "srv.ipv4.single.fake":
- b = []byte(scfs[1])
- case "srv.ipv4.multi.fake":
- b = []byte(scfs[2])
- default:
- b = []byte(scfs[3])
- }
- if name == "no.attribute" {
- return div(b)
- }
- return div(append([]byte(txtAttribute), b...))
-}
-
-// generateSC returns a service config string in JSON format for the input name.
-func generateSC(name string) string {
- _, cnt := scLookupTbl[name]
- if !cnt || name == "no.attribute" {
- return ""
- }
- switch name {
- case "foo.bar.com":
- return scs[0]
- case "srv.ipv4.single.fake":
- return scs[1]
- case "srv.ipv4.multi.fake":
- return scs[2]
- default:
- return ""
- }
-}
-
-var txtLookupTbl = struct {
- sync.Mutex
- tbl map[string][]string
-}{
- tbl: map[string][]string{
- "foo.bar.com": generateSCF("foo.bar.com"),
- "srv.ipv4.single.fake": generateSCF("srv.ipv4.single.fake"),
- "srv.ipv4.multi.fake": generateSCF("srv.ipv4.multi.fake"),
- "srv.ipv6.single.fake": generateSCF("srv.ipv6.single.fake"),
- "srv.ipv6.multi.fake": generateSCF("srv.ipv6.multi.fake"),
- "no.attribute": generateSCF("no.attribute"),
- },
-}
-
-func txtLookup(host string) ([]string, error) {
- txtLookupTbl.Lock()
- defer txtLookupTbl.Unlock()
- if scs, cnt := txtLookupTbl.tbl[host]; cnt {
- return scs, nil
- }
- return nil, fmt.Errorf("failed to lookup TXT:%s resolution in txtLookupTbl", host)
-}
-
-func TestResolve(t *testing.T) {
- testDNSResolver(t)
- testDNSResolveNow(t)
- testIPResolver(t)
-}
-
-func testDNSResolver(t *testing.T) {
- defer leakcheck.Check(t)
- tests := []struct {
- target string
- addrWant []resolver.Address
- scWant string
- }{
- {
- "foo.bar.com",
- []resolver.Address{{Addr: "1.2.3.4" + colonDefaultPort}, {Addr: "5.6.7.8" + colonDefaultPort}},
- generateSC("foo.bar.com"),
- },
- {
- "foo.bar.com:1234",
- []resolver.Address{{Addr: "1.2.3.4:1234"}, {Addr: "5.6.7.8:1234"}},
- generateSC("foo.bar.com"),
- },
- {
- "srv.ipv4.single.fake",
- []resolver.Address{{Addr: "1.2.3.4:1234", Type: resolver.GRPCLB, ServerName: "ipv4.single.fake"}, {Addr: "2.4.6.8" + colonDefaultPort}},
- generateSC("srv.ipv4.single.fake"),
- },
- {
- "srv.ipv4.multi.fake",
- []resolver.Address{
- {Addr: "1.2.3.4:1234", Type: resolver.GRPCLB, ServerName: "ipv4.multi.fake"},
- {Addr: "5.6.7.8:1234", Type: resolver.GRPCLB, ServerName: "ipv4.multi.fake"},
- {Addr: "9.10.11.12:1234", Type: resolver.GRPCLB, ServerName: "ipv4.multi.fake"},
- },
- generateSC("srv.ipv4.multi.fake"),
- },
- {
- "srv.ipv6.single.fake",
- []resolver.Address{{Addr: "[2607:f8b0:400a:801::1001]:1234", Type: resolver.GRPCLB, ServerName: "ipv6.single.fake"}},
- generateSC("srv.ipv6.single.fake"),
- },
- {
- "srv.ipv6.multi.fake",
- []resolver.Address{
- {Addr: "[2607:f8b0:400a:801::1001]:1234", Type: resolver.GRPCLB, ServerName: "ipv6.multi.fake"},
- {Addr: "[2607:f8b0:400a:801::1002]:1234", Type: resolver.GRPCLB, ServerName: "ipv6.multi.fake"},
- {Addr: "[2607:f8b0:400a:801::1003]:1234", Type: resolver.GRPCLB, ServerName: "ipv6.multi.fake"},
- },
- generateSC("srv.ipv6.multi.fake"),
- },
- {
- "no.attribute",
- nil,
- generateSC("no.attribute"),
- },
- }
-
- for _, a := range tests {
- b := NewBuilder()
- cc := &testClientConn{target: a.target}
- r, err := b.Build(resolver.Target{Endpoint: a.target}, cc, resolver.BuildOption{})
- if err != nil {
- t.Fatalf("%v\n", err)
- }
- var addrs []resolver.Address
- var cnt int
- for {
- addrs, cnt = cc.getAddress()
- if cnt > 0 {
- break
- }
- time.Sleep(time.Millisecond)
- }
- var sc string
- for {
- sc, cnt = cc.getSc()
- if cnt > 0 {
- break
- }
- time.Sleep(time.Millisecond)
- }
- if !reflect.DeepEqual(a.addrWant, addrs) {
- t.Errorf("Resolved addresses of target: %q = %+v, want %+v\n", a.target, addrs, a.addrWant)
- }
- if !reflect.DeepEqual(a.scWant, sc) {
- t.Errorf("Resolved service config of target: %q = %+v, want %+v\n", a.target, sc, a.scWant)
- }
- r.Close()
- }
-}
-
-func mutateTbl(target string) func() {
- hostLookupTbl.Lock()
- oldHostTblEntry := hostLookupTbl.tbl[target]
- hostLookupTbl.tbl[target] = hostLookupTbl.tbl[target][:len(oldHostTblEntry)-1]
- hostLookupTbl.Unlock()
- txtLookupTbl.Lock()
- oldTxtTblEntry := txtLookupTbl.tbl[target]
- txtLookupTbl.tbl[target] = []string{""}
- txtLookupTbl.Unlock()
-
- return func() {
- hostLookupTbl.Lock()
- hostLookupTbl.tbl[target] = oldHostTblEntry
- hostLookupTbl.Unlock()
- txtLookupTbl.Lock()
- txtLookupTbl.tbl[target] = oldTxtTblEntry
- txtLookupTbl.Unlock()
- }
-}
-
-func testDNSResolveNow(t *testing.T) {
- defer leakcheck.Check(t)
- tests := []struct {
- target string
- addrWant []resolver.Address
- addrNext []resolver.Address
- scWant string
- scNext string
- }{
- {
- "foo.bar.com",
- []resolver.Address{{Addr: "1.2.3.4" + colonDefaultPort}, {Addr: "5.6.7.8" + colonDefaultPort}},
- []resolver.Address{{Addr: "1.2.3.4" + colonDefaultPort}},
- generateSC("foo.bar.com"),
- "",
- },
- }
-
- for _, a := range tests {
- b := NewBuilder()
- cc := &testClientConn{target: a.target}
- r, err := b.Build(resolver.Target{Endpoint: a.target}, cc, resolver.BuildOption{})
- if err != nil {
- t.Fatalf("%v\n", err)
- }
- var addrs []resolver.Address
- var cnt int
- for {
- addrs, cnt = cc.getAddress()
- if cnt > 0 {
- break
- }
- time.Sleep(time.Millisecond)
- }
- var sc string
- for {
- sc, cnt = cc.getSc()
- if cnt > 0 {
- break
- }
- time.Sleep(time.Millisecond)
- }
- if !reflect.DeepEqual(a.addrWant, addrs) {
- t.Errorf("Resolved addresses of target: %q = %+v, want %+v\n", a.target, addrs, a.addrWant)
- }
- if !reflect.DeepEqual(a.scWant, sc) {
- t.Errorf("Resolved service config of target: %q = %+v, want %+v\n", a.target, sc, a.scWant)
- }
- revertTbl := mutateTbl(a.target)
- r.ResolveNow(resolver.ResolveNowOption{})
- for {
- addrs, cnt = cc.getAddress()
- if cnt == 2 {
- break
- }
- time.Sleep(time.Millisecond)
- }
- for {
- sc, cnt = cc.getSc()
- if cnt == 2 {
- break
- }
- time.Sleep(time.Millisecond)
- }
- if !reflect.DeepEqual(a.addrNext, addrs) {
- t.Errorf("Resolved addresses of target: %q = %+v, want %+v\n", a.target, addrs, a.addrNext)
- }
- if !reflect.DeepEqual(a.scNext, sc) {
- t.Errorf("Resolved service config of target: %q = %+v, want %+v\n", a.target, sc, a.scNext)
- }
- revertTbl()
- r.Close()
- }
-}
-
-const colonDefaultPort = ":" + defaultPort
-
-func testIPResolver(t *testing.T) {
- defer leakcheck.Check(t)
- tests := []struct {
- target string
- want []resolver.Address
- }{
- {"127.0.0.1", []resolver.Address{{Addr: "127.0.0.1" + colonDefaultPort}}},
- {"127.0.0.1:12345", []resolver.Address{{Addr: "127.0.0.1:12345"}}},
- {"::1", []resolver.Address{{Addr: "[::1]" + colonDefaultPort}}},
- {"[::1]:12345", []resolver.Address{{Addr: "[::1]:12345"}}},
- {"[::1]:", []resolver.Address{{Addr: "[::1]:443"}}},
- {"2001:db8:85a3::8a2e:370:7334", []resolver.Address{{Addr: "[2001:db8:85a3::8a2e:370:7334]" + colonDefaultPort}}},
- {"[2001:db8:85a3::8a2e:370:7334]", []resolver.Address{{Addr: "[2001:db8:85a3::8a2e:370:7334]" + colonDefaultPort}}},
- {"[2001:db8:85a3::8a2e:370:7334]:12345", []resolver.Address{{Addr: "[2001:db8:85a3::8a2e:370:7334]:12345"}}},
- {"[2001:db8::1]:http", []resolver.Address{{Addr: "[2001:db8::1]:http"}}},
- // TODO(yuxuanli): zone support?
- }
-
- for _, v := range tests {
- b := NewBuilder()
- cc := &testClientConn{target: v.target}
- r, err := b.Build(resolver.Target{Endpoint: v.target}, cc, resolver.BuildOption{})
- if err != nil {
- t.Fatalf("%v\n", err)
- }
- var addrs []resolver.Address
- var cnt int
- for {
- addrs, cnt = cc.getAddress()
- if cnt > 0 {
- break
- }
- time.Sleep(time.Millisecond)
- }
- if !reflect.DeepEqual(v.want, addrs) {
- t.Errorf("Resolved addresses of target: %q = %+v, want %+v\n", v.target, addrs, v.want)
- }
- r.ResolveNow(resolver.ResolveNowOption{})
- for {
- addrs, cnt = cc.getAddress()
- if cnt == 2 {
- break
- }
- time.Sleep(time.Millisecond)
- }
- if !reflect.DeepEqual(v.want, addrs) {
- t.Errorf("Resolved addresses of target: %q = %+v, want %+v\n", v.target, addrs, v.want)
- }
- r.Close()
- }
-}
-
-func TestResolveFunc(t *testing.T) {
- defer leakcheck.Check(t)
- tests := []struct {
- addr string
- want error
- }{
- // TODO(yuxuanli): More false cases?
- {"www.google.com", nil},
- {"foo.bar:12345", nil},
- {"127.0.0.1", nil},
- {"127.0.0.1:12345", nil},
- {"[::1]:80", nil},
- {"[2001:db8:a0b:12f0::1]:21", nil},
- {":80", nil},
- {"127.0.0...1:12345", nil},
- {"[fe80::1%lo0]:80", nil},
- {"golang.org:http", nil},
- {"[2001:db8::1]:http", nil},
- {":", nil},
- {"", errMissingAddr},
- {"[2001:db8:a0b:12f0::1", errForInvalidTarget},
- }
-
- b := NewBuilder()
- for _, v := range tests {
- cc := &testClientConn{target: v.addr}
- r, err := b.Build(resolver.Target{Endpoint: v.addr}, cc, resolver.BuildOption{})
- if err == nil {
- r.Close()
- }
- if !reflect.DeepEqual(err, v.want) {
- t.Errorf("Build(%q, cc, resolver.BuildOption{}) = %v, want %v", v.addr, err, v.want)
- }
- }
-}
-
-func TestDisableServiceConfig(t *testing.T) {
- defer leakcheck.Check(t)
- tests := []struct {
- target string
- scWant string
- disableServiceConfig bool
- }{
- {
- "foo.bar.com",
- generateSC("foo.bar.com"),
- false,
- },
- {
- "foo.bar.com",
- "",
- true,
- },
- }
-
- for _, a := range tests {
- b := NewBuilder()
- cc := &testClientConn{target: a.target}
- r, err := b.Build(resolver.Target{Endpoint: a.target}, cc, resolver.BuildOption{DisableServiceConfig: a.disableServiceConfig})
- if err != nil {
- t.Fatalf("%v\n", err)
- }
- var cnt int
- var sc string
- for {
- sc, cnt = cc.getSc()
- if cnt > 0 {
- break
- }
- time.Sleep(time.Millisecond)
- }
- if !reflect.DeepEqual(a.scWant, sc) {
- t.Errorf("Resolved service config of target: %q = %+v, want %+v\n", a.target, sc, a.scWant)
- }
- r.Close()
- }
-}
diff --git a/vendor/google.golang.org/grpc/resolver/dns/go17_test.go b/vendor/google.golang.org/grpc/resolver/dns/go17_test.go
deleted file mode 100644
index 21eaa8885..000000000
--- a/vendor/google.golang.org/grpc/resolver/dns/go17_test.go
+++ /dev/null
@@ -1,50 +0,0 @@
-// +build go1.6, !go1.8
-
-/*
- *
- * Copyright 2017 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package dns
-
-import (
- "fmt"
- "net"
-
- "golang.org/x/net/context"
-)
-
-var errForInvalidTarget = fmt.Errorf("invalid target address [2001:db8:a0b:12f0::1, error info: missing ']' in address [2001:db8:a0b:12f0::1:443")
-
-func replaceNetFunc() func() {
- oldLookupHost := lookupHost
- oldLookupSRV := lookupSRV
- oldLookupTXT := lookupTXT
- lookupHost = func(ctx context.Context, host string) ([]string, error) {
- return hostLookup(host)
- }
- lookupSRV = func(ctx context.Context, service, proto, name string) (string, []*net.SRV, error) {
- return srvLookup(service, proto, name)
- }
- lookupTXT = func(ctx context.Context, host string) ([]string, error) {
- return txtLookup(host)
- }
- return func() {
- lookupHost = oldLookupHost
- lookupSRV = oldLookupSRV
- lookupTXT = oldLookupTXT
- }
-}
diff --git a/vendor/google.golang.org/grpc/resolver/dns/go18_test.go b/vendor/google.golang.org/grpc/resolver/dns/go18_test.go
deleted file mode 100644
index b0149c867..000000000
--- a/vendor/google.golang.org/grpc/resolver/dns/go18_test.go
+++ /dev/null
@@ -1,49 +0,0 @@
-// +build go1.8
-
-/*
- *
- * Copyright 2017 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package dns
-
-import (
- "context"
- "fmt"
- "net"
-)
-
-var errForInvalidTarget = fmt.Errorf("invalid target address [2001:db8:a0b:12f0::1, error info: address [2001:db8:a0b:12f0::1:443: missing ']' in address")
-
-func replaceNetFunc() func() {
- oldLookupHost := lookupHost
- oldLookupSRV := lookupSRV
- oldLookupTXT := lookupTXT
- lookupHost = func(ctx context.Context, host string) ([]string, error) {
- return hostLookup(host)
- }
- lookupSRV = func(ctx context.Context, service, proto, name string) (string, []*net.SRV, error) {
- return srvLookup(service, proto, name)
- }
- lookupTXT = func(ctx context.Context, host string) ([]string, error) {
- return txtLookup(host)
- }
- return func() {
- lookupHost = oldLookupHost
- lookupSRV = oldLookupSRV
- lookupTXT = oldLookupTXT
- }
-}
diff --git a/vendor/google.golang.org/grpc/resolver_conn_wrapper_test.go b/vendor/google.golang.org/grpc/resolver_conn_wrapper_test.go
deleted file mode 100644
index 6f1367a2c..000000000
--- a/vendor/google.golang.org/grpc/resolver_conn_wrapper_test.go
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- *
- * Copyright 2017 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package grpc
-
-import (
- "fmt"
- "net"
- "testing"
- "time"
-
- "google.golang.org/grpc/resolver"
-)
-
-func TestParseTarget(t *testing.T) {
- for _, test := range []resolver.Target{
- {Scheme: "dns", Authority: "", Endpoint: "google.com"},
- {Scheme: "dns", Authority: "a.server.com", Endpoint: "google.com"},
- {Scheme: "dns", Authority: "a.server.com", Endpoint: "google.com/?a=b"},
- {Scheme: "passthrough", Authority: "", Endpoint: "/unix/socket/address"},
- } {
- str := test.Scheme + "://" + test.Authority + "/" + test.Endpoint
- got := parseTarget(str)
- if got != test {
- t.Errorf("parseTarget(%q) = %+v, want %+v", str, got, test)
- }
- }
-}
-
-func TestParseTargetString(t *testing.T) {
- for _, test := range []struct {
- targetStr string
- want resolver.Target
- }{
- {targetStr: "", want: resolver.Target{Scheme: "", Authority: "", Endpoint: ""}},
- {targetStr: ":///", want: resolver.Target{Scheme: "", Authority: "", Endpoint: ""}},
- {targetStr: "a:///", want: resolver.Target{Scheme: "a", Authority: "", Endpoint: ""}},
- {targetStr: "://a/", want: resolver.Target{Scheme: "", Authority: "a", Endpoint: ""}},
- {targetStr: ":///a", want: resolver.Target{Scheme: "", Authority: "", Endpoint: "a"}},
- {targetStr: "a://b/", want: resolver.Target{Scheme: "a", Authority: "b", Endpoint: ""}},
- {targetStr: "a:///b", want: resolver.Target{Scheme: "a", Authority: "", Endpoint: "b"}},
- {targetStr: "://a/b", want: resolver.Target{Scheme: "", Authority: "a", Endpoint: "b"}},
- {targetStr: "a://b/c", want: resolver.Target{Scheme: "a", Authority: "b", Endpoint: "c"}},
- {targetStr: "dns:///google.com", want: resolver.Target{Scheme: "dns", Authority: "", Endpoint: "google.com"}},
- {targetStr: "dns://a.server.com/google.com", want: resolver.Target{Scheme: "dns", Authority: "a.server.com", Endpoint: "google.com"}},
- {targetStr: "dns://a.server.com/google.com/?a=b", want: resolver.Target{Scheme: "dns", Authority: "a.server.com", Endpoint: "google.com/?a=b"}},
-
- {targetStr: "/", want: resolver.Target{Scheme: "", Authority: "", Endpoint: "/"}},
- {targetStr: "google.com", want: resolver.Target{Scheme: "", Authority: "", Endpoint: "google.com"}},
- {targetStr: "google.com/?a=b", want: resolver.Target{Scheme: "", Authority: "", Endpoint: "google.com/?a=b"}},
- {targetStr: "/unix/socket/address", want: resolver.Target{Scheme: "", Authority: "", Endpoint: "/unix/socket/address"}},
-
- // If we can only parse part of the target.
- {targetStr: "://", want: resolver.Target{Scheme: "", Authority: "", Endpoint: "://"}},
- {targetStr: "unix://domain", want: resolver.Target{Scheme: "", Authority: "", Endpoint: "unix://domain"}},
- {targetStr: "a:b", want: resolver.Target{Scheme: "", Authority: "", Endpoint: "a:b"}},
- {targetStr: "a/b", want: resolver.Target{Scheme: "", Authority: "", Endpoint: "a/b"}},
- {targetStr: "a:/b", want: resolver.Target{Scheme: "", Authority: "", Endpoint: "a:/b"}},
- {targetStr: "a//b", want: resolver.Target{Scheme: "", Authority: "", Endpoint: "a//b"}},
- {targetStr: "a://b", want: resolver.Target{Scheme: "", Authority: "", Endpoint: "a://b"}},
- } {
- got := parseTarget(test.targetStr)
- if got != test.want {
- t.Errorf("parseTarget(%q) = %+v, want %+v", test.targetStr, got, test.want)
- }
- }
-}
-
-// The target string with unknown scheme should be kept unchanged and passed to
-// the dialer.
-func TestDialParseTargetUnknownScheme(t *testing.T) {
- for _, test := range []struct {
- targetStr string
- want string
- }{
- {"/unix/socket/address", "/unix/socket/address"},
-
- // Special test for "unix:///".
- {"unix:///unix/socket/address", "unix:///unix/socket/address"},
-
- // For known scheme.
- {"passthrough://a.server.com/google.com", "google.com"},
- } {
- dialStrCh := make(chan string, 1)
- cc, err := Dial(test.targetStr, WithInsecure(), WithDialer(func(t string, _ time.Duration) (net.Conn, error) {
- dialStrCh <- t
- return nil, fmt.Errorf("test dialer, always error")
- }))
- if err != nil {
- t.Fatalf("Failed to create ClientConn: %v", err)
- }
- got := <-dialStrCh
- cc.Close()
- if got != test.want {
- t.Errorf("Dial(%q), dialer got %q, want %q", test.targetStr, got, test.want)
- }
- }
-}
diff --git a/vendor/google.golang.org/grpc/rpc_util_test.go b/vendor/google.golang.org/grpc/rpc_util_test.go
deleted file mode 100644
index f28cff233..000000000
--- a/vendor/google.golang.org/grpc/rpc_util_test.go
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- *
- * Copyright 2014 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package grpc
-
-import (
- "bytes"
- "compress/gzip"
- "io"
- "math"
- "reflect"
- "testing"
-
- "github.com/golang/protobuf/proto"
- "google.golang.org/grpc/codes"
- "google.golang.org/grpc/encoding"
- protoenc "google.golang.org/grpc/encoding/proto"
- "google.golang.org/grpc/status"
- perfpb "google.golang.org/grpc/test/codec_perf"
- "google.golang.org/grpc/transport"
-)
-
-type fullReader struct {
- reader io.Reader
-}
-
-func (f fullReader) Read(p []byte) (int, error) {
- return io.ReadFull(f.reader, p)
-}
-
-var _ CallOption = EmptyCallOption{} // ensure EmptyCallOption implements the interface
-
-func TestSimpleParsing(t *testing.T) {
- bigMsg := bytes.Repeat([]byte{'x'}, 1<<24)
- for _, test := range []struct {
- // input
- p []byte
- // outputs
- err error
- b []byte
- pt payloadFormat
- }{
- {nil, io.EOF, nil, compressionNone},
- {[]byte{0, 0, 0, 0, 0}, nil, nil, compressionNone},
- {[]byte{0, 0, 0, 0, 1, 'a'}, nil, []byte{'a'}, compressionNone},
- {[]byte{1, 0}, io.ErrUnexpectedEOF, nil, compressionNone},
- {[]byte{0, 0, 0, 0, 10, 'a'}, io.ErrUnexpectedEOF, nil, compressionNone},
- // Check that messages with length >= 2^24 are parsed.
- {append([]byte{0, 1, 0, 0, 0}, bigMsg...), nil, bigMsg, compressionNone},
- } {
- buf := fullReader{bytes.NewReader(test.p)}
- parser := &parser{r: buf}
- pt, b, err := parser.recvMsg(math.MaxInt32)
- if err != test.err || !bytes.Equal(b, test.b) || pt != test.pt {
- t.Fatalf("parser{%v}.recvMsg(_) = %v, %v, %v\nwant %v, %v, %v", test.p, pt, b, err, test.pt, test.b, test.err)
- }
- }
-}
-
-func TestMultipleParsing(t *testing.T) {
- // Set a byte stream consists of 3 messages with their headers.
- p := []byte{0, 0, 0, 0, 1, 'a', 0, 0, 0, 0, 2, 'b', 'c', 0, 0, 0, 0, 1, 'd'}
- b := fullReader{bytes.NewReader(p)}
- parser := &parser{r: b}
-
- wantRecvs := []struct {
- pt payloadFormat
- data []byte
- }{
- {compressionNone, []byte("a")},
- {compressionNone, []byte("bc")},
- {compressionNone, []byte("d")},
- }
- for i, want := range wantRecvs {
- pt, data, err := parser.recvMsg(math.MaxInt32)
- if err != nil || pt != want.pt || !reflect.DeepEqual(data, want.data) {
- t.Fatalf("after %d calls, parser{%v}.recvMsg(_) = %v, %v, %v\nwant %v, %v, <nil>",
- i, p, pt, data, err, want.pt, want.data)
- }
- }
-
- pt, data, err := parser.recvMsg(math.MaxInt32)
- if err != io.EOF {
- t.Fatalf("after %d recvMsgs calls, parser{%v}.recvMsg(_) = %v, %v, %v\nwant _, _, %v",
- len(wantRecvs), p, pt, data, err, io.EOF)
- }
-}
-
-func TestEncode(t *testing.T) {
- for _, test := range []struct {
- // input
- msg proto.Message
- // outputs
- hdr []byte
- data []byte
- err error
- }{
- {nil, []byte{0, 0, 0, 0, 0}, []byte{}, nil},
- } {
- data, err := encode(encoding.GetCodec(protoenc.Name), test.msg)
- if err != test.err || !bytes.Equal(data, test.data) {
- t.Errorf("encode(_, %v) = %v, %v; want %v, %v", test.msg, data, err, test.data, test.err)
- continue
- }
- if hdr, _ := msgHeader(data, nil); !bytes.Equal(hdr, test.hdr) {
- t.Errorf("msgHeader(%v, false) = %v; want %v", data, hdr, test.hdr)
- }
- }
-}
-
-func TestCompress(t *testing.T) {
- bestCompressor, err := NewGZIPCompressorWithLevel(gzip.BestCompression)
- if err != nil {
- t.Fatalf("Could not initialize gzip compressor with best compression.")
- }
- bestSpeedCompressor, err := NewGZIPCompressorWithLevel(gzip.BestSpeed)
- if err != nil {
- t.Fatalf("Could not initialize gzip compressor with best speed compression.")
- }
-
- defaultCompressor, err := NewGZIPCompressorWithLevel(gzip.BestSpeed)
- if err != nil {
- t.Fatalf("Could not initialize gzip compressor with default compression.")
- }
-
- level5, err := NewGZIPCompressorWithLevel(5)
- if err != nil {
- t.Fatalf("Could not initialize gzip compressor with level 5 compression.")
- }
-
- for _, test := range []struct {
- // input
- data []byte
- cp Compressor
- dc Decompressor
- // outputs
- err error
- }{
- {make([]byte, 1024), NewGZIPCompressor(), NewGZIPDecompressor(), nil},
- {make([]byte, 1024), bestCompressor, NewGZIPDecompressor(), nil},
- {make([]byte, 1024), bestSpeedCompressor, NewGZIPDecompressor(), nil},
- {make([]byte, 1024), defaultCompressor, NewGZIPDecompressor(), nil},
- {make([]byte, 1024), level5, NewGZIPDecompressor(), nil},
- } {
- b := new(bytes.Buffer)
- if err := test.cp.Do(b, test.data); err != test.err {
- t.Fatalf("Compressor.Do(_, %v) = %v, want %v", test.data, err, test.err)
- }
- if b.Len() >= len(test.data) {
- t.Fatalf("The compressor fails to compress data.")
- }
- if p, err := test.dc.Do(b); err != nil || !bytes.Equal(test.data, p) {
- t.Fatalf("Decompressor.Do(%v) = %v, %v, want %v, <nil>", b, p, err, test.data)
- }
- }
-}
-
-func TestToRPCErr(t *testing.T) {
- for _, test := range []struct {
- // input
- errIn error
- // outputs
- errOut error
- }{
- {transport.StreamError{Code: codes.Unknown, Desc: ""}, status.Error(codes.Unknown, "")},
- {transport.ErrConnClosing, status.Error(codes.Unavailable, transport.ErrConnClosing.Desc)},
- } {
- err := toRPCErr(test.errIn)
- if _, ok := status.FromError(err); !ok {
- t.Fatalf("toRPCErr{%v} returned type %T, want %T", test.errIn, err, status.Error(codes.Unknown, ""))
- }
- if !reflect.DeepEqual(err, test.errOut) {
- t.Fatalf("toRPCErr{%v} = %v \nwant %v", test.errIn, err, test.errOut)
- }
- }
-}
-
-func TestParseDialTarget(t *testing.T) {
- for _, test := range []struct {
- target, wantNet, wantAddr string
- }{
- {"unix:etcd:0", "unix", "etcd:0"},
- {"unix:///tmp/unix-3", "unix", "/tmp/unix-3"},
- {"unix://domain", "unix", "domain"},
- {"unix://etcd:0", "unix", "etcd:0"},
- {"unix:///etcd:0", "unix", "/etcd:0"},
- {"passthrough://unix://domain", "tcp", "passthrough://unix://domain"},
- {"https://google.com:443", "tcp", "https://google.com:443"},
- {"dns:///google.com", "tcp", "dns:///google.com"},
- {"/unix/socket/address", "tcp", "/unix/socket/address"},
- } {
- gotNet, gotAddr := parseDialTarget(test.target)
- if gotNet != test.wantNet || gotAddr != test.wantAddr {
- t.Errorf("parseDialTarget(%q) = %s, %s want %s, %s", test.target, gotNet, gotAddr, test.wantNet, test.wantAddr)
- }
- }
-}
-
-// bmEncode benchmarks encoding a Protocol Buffer message containing mSize
-// bytes.
-func bmEncode(b *testing.B, mSize int) {
- cdc := encoding.GetCodec(protoenc.Name)
- msg := &perfpb.Buffer{Body: make([]byte, mSize)}
- encodeData, _ := encode(cdc, msg)
- encodedSz := int64(len(encodeData))
- b.ReportAllocs()
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- encode(cdc, msg)
- }
- b.SetBytes(encodedSz)
-}
-
-func BenchmarkEncode1B(b *testing.B) {
- bmEncode(b, 1)
-}
-
-func BenchmarkEncode1KiB(b *testing.B) {
- bmEncode(b, 1024)
-}
-
-func BenchmarkEncode8KiB(b *testing.B) {
- bmEncode(b, 8*1024)
-}
-
-func BenchmarkEncode64KiB(b *testing.B) {
- bmEncode(b, 64*1024)
-}
-
-func BenchmarkEncode512KiB(b *testing.B) {
- bmEncode(b, 512*1024)
-}
-
-func BenchmarkEncode1MiB(b *testing.B) {
- bmEncode(b, 1024*1024)
-}
-
-// bmCompressor benchmarks a compressor of a Protocol Buffer message containing
-// mSize bytes.
-func bmCompressor(b *testing.B, mSize int, cp Compressor) {
- payload := make([]byte, mSize)
- cBuf := bytes.NewBuffer(make([]byte, mSize))
- b.ReportAllocs()
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- cp.Do(cBuf, payload)
- cBuf.Reset()
- }
-}
-
-func BenchmarkGZIPCompressor1B(b *testing.B) {
- bmCompressor(b, 1, NewGZIPCompressor())
-}
-
-func BenchmarkGZIPCompressor1KiB(b *testing.B) {
- bmCompressor(b, 1024, NewGZIPCompressor())
-}
-
-func BenchmarkGZIPCompressor8KiB(b *testing.B) {
- bmCompressor(b, 8*1024, NewGZIPCompressor())
-}
-
-func BenchmarkGZIPCompressor64KiB(b *testing.B) {
- bmCompressor(b, 64*1024, NewGZIPCompressor())
-}
-
-func BenchmarkGZIPCompressor512KiB(b *testing.B) {
- bmCompressor(b, 512*1024, NewGZIPCompressor())
-}
-
-func BenchmarkGZIPCompressor1MiB(b *testing.B) {
- bmCompressor(b, 1024*1024, NewGZIPCompressor())
-}
diff --git a/vendor/google.golang.org/grpc/server_test.go b/vendor/google.golang.org/grpc/server_test.go
deleted file mode 100644
index 77e40b029..000000000
--- a/vendor/google.golang.org/grpc/server_test.go
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- *
- * Copyright 2016 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package grpc
-
-import (
- "net"
- "reflect"
- "strings"
- "testing"
- "time"
-
- "golang.org/x/net/context"
- "google.golang.org/grpc/internal/leakcheck"
- "google.golang.org/grpc/transport"
-)
-
-type emptyServiceServer interface{}
-
-type testServer struct{}
-
-func TestStopBeforeServe(t *testing.T) {
- defer leakcheck.Check(t)
- lis, err := net.Listen("tcp", "localhost:0")
- if err != nil {
- t.Fatalf("failed to create listener: %v", err)
- }
-
- server := NewServer()
- server.Stop()
- err = server.Serve(lis)
- if err != ErrServerStopped {
- t.Fatalf("server.Serve() error = %v, want %v", err, ErrServerStopped)
- }
-
- // server.Serve is responsible for closing the listener, even if the
- // server was already stopped.
- err = lis.Close()
- if got, want := errorDesc(err), "use of closed"; !strings.Contains(got, want) {
- t.Errorf("Close() error = %q, want %q", got, want)
- }
-}
-
-func TestGracefulStop(t *testing.T) {
- defer leakcheck.Check(t)
-
- lis, err := net.Listen("tcp", "localhost:0")
- if err != nil {
- t.Fatalf("failed to create listener: %v", err)
- }
-
- server := NewServer()
- go func() {
- // make sure Serve() is called
- time.Sleep(time.Millisecond * 500)
- server.GracefulStop()
- }()
-
- err = server.Serve(lis)
- if err != nil {
- t.Fatalf("Serve() returned non-nil error on GracefulStop: %v", err)
- }
-}
-
-func TestGetServiceInfo(t *testing.T) {
- defer leakcheck.Check(t)
- testSd := ServiceDesc{
- ServiceName: "grpc.testing.EmptyService",
- HandlerType: (*emptyServiceServer)(nil),
- Methods: []MethodDesc{
- {
- MethodName: "EmptyCall",
- Handler: nil,
- },
- },
- Streams: []StreamDesc{
- {
- StreamName: "EmptyStream",
- Handler: nil,
- ServerStreams: false,
- ClientStreams: true,
- },
- },
- Metadata: []int{0, 2, 1, 3},
- }
-
- server := NewServer()
- server.RegisterService(&testSd, &testServer{})
-
- info := server.GetServiceInfo()
- want := map[string]ServiceInfo{
- "grpc.testing.EmptyService": {
- Methods: []MethodInfo{
- {
- Name: "EmptyCall",
- IsClientStream: false,
- IsServerStream: false,
- },
- {
- Name: "EmptyStream",
- IsClientStream: true,
- IsServerStream: false,
- }},
- Metadata: []int{0, 2, 1, 3},
- },
- }
-
- if !reflect.DeepEqual(info, want) {
- t.Errorf("GetServiceInfo() = %+v, want %+v", info, want)
- }
-}
-
-func TestStreamContext(t *testing.T) {
- expectedStream := &transport.Stream{}
- ctx := NewContextWithServerTransportStream(context.Background(), expectedStream)
- s := ServerTransportStreamFromContext(ctx)
- stream, ok := s.(*transport.Stream)
- if !ok || expectedStream != stream {
- t.Fatalf("GetStreamFromContext(%v) = %v, %t, want: %v, true", ctx, stream, ok, expectedStream)
- }
-}
diff --git a/vendor/google.golang.org/grpc/service_config_test.go b/vendor/google.golang.org/grpc/service_config_test.go
deleted file mode 100644
index 8301a5061..000000000
--- a/vendor/google.golang.org/grpc/service_config_test.go
+++ /dev/null
@@ -1,386 +0,0 @@
-/*
- *
- * Copyright 2017 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package grpc
-
-import (
- "fmt"
- "math"
- "reflect"
- "testing"
- "time"
-)
-
-func TestParseLoadBalancer(t *testing.T) {
- testcases := []struct {
- scjs string
- wantSC ServiceConfig
- wantErr bool
- }{
- {
- `{
- "loadBalancingPolicy": "round_robin",
- "methodConfig": [
- {
- "name": [
- {
- "service": "foo",
- "method": "Bar"
- }
- ],
- "waitForReady": true
- }
- ]
-}`,
- ServiceConfig{
- LB: newString("round_robin"),
- Methods: map[string]MethodConfig{
- "/foo/Bar": {
- WaitForReady: newBool(true),
- },
- },
- },
- false,
- },
- {
- `{
- "loadBalancingPolicy": 1,
- "methodConfig": [
- {
- "name": [
- {
- "service": "foo",
- "method": "Bar"
- }
- ],
- "waitForReady": false
- }
- ]
-}`,
- ServiceConfig{},
- true,
- },
- }
-
- for _, c := range testcases {
- sc, err := parseServiceConfig(c.scjs)
- if c.wantErr != (err != nil) || !reflect.DeepEqual(sc, c.wantSC) {
- t.Fatalf("parseServiceConfig(%s) = %+v, %v, want %+v, %v", c.scjs, sc, err, c.wantSC, c.wantErr)
- }
- }
-}
-
-func TestParseWaitForReady(t *testing.T) {
- testcases := []struct {
- scjs string
- wantSC ServiceConfig
- wantErr bool
- }{
- {
- `{
- "methodConfig": [
- {
- "name": [
- {
- "service": "foo",
- "method": "Bar"
- }
- ],
- "waitForReady": true
- }
- ]
-}`,
- ServiceConfig{
- Methods: map[string]MethodConfig{
- "/foo/Bar": {
- WaitForReady: newBool(true),
- },
- },
- },
- false,
- },
- {
- `{
- "methodConfig": [
- {
- "name": [
- {
- "service": "foo",
- "method": "Bar"
- }
- ],
- "waitForReady": false
- }
- ]
-}`,
- ServiceConfig{
- Methods: map[string]MethodConfig{
- "/foo/Bar": {
- WaitForReady: newBool(false),
- },
- },
- },
- false,
- },
- {
- `{
- "methodConfig": [
- {
- "name": [
- {
- "service": "foo",
- "method": "Bar"
- }
- ],
- "waitForReady": fall
- },
- {
- "name": [
- {
- "service": "foo",
- "method": "Bar"
- }
- ],
- "waitForReady": true
- }
- ]
-}`,
- ServiceConfig{},
- true,
- },
- }
-
- for _, c := range testcases {
- sc, err := parseServiceConfig(c.scjs)
- if c.wantErr != (err != nil) || !reflect.DeepEqual(sc, c.wantSC) {
- t.Fatalf("parseServiceConfig(%s) = %+v, %v, want %+v, %v", c.scjs, sc, err, c.wantSC, c.wantErr)
- }
- }
-}
-
-func TestPraseTimeOut(t *testing.T) {
- testcases := []struct {
- scjs string
- wantSC ServiceConfig
- wantErr bool
- }{
- {
- `{
- "methodConfig": [
- {
- "name": [
- {
- "service": "foo",
- "method": "Bar"
- }
- ],
- "timeout": "1s"
- }
- ]
-}`,
- ServiceConfig{
- Methods: map[string]MethodConfig{
- "/foo/Bar": {
- Timeout: newDuration(time.Second),
- },
- },
- },
- false,
- },
- {
- `{
- "methodConfig": [
- {
- "name": [
- {
- "service": "foo",
- "method": "Bar"
- }
- ],
- "timeout": "3c"
- }
- ]
-}`,
- ServiceConfig{},
- true,
- },
- {
- `{
- "methodConfig": [
- {
- "name": [
- {
- "service": "foo",
- "method": "Bar"
- }
- ],
- "timeout": "3c"
- },
- {
- "name": [
- {
- "service": "foo",
- "method": "Bar"
- }
- ],
- "timeout": "1s"
- }
- ]
-}`,
- ServiceConfig{},
- true,
- },
- }
-
- for _, c := range testcases {
- sc, err := parseServiceConfig(c.scjs)
- if c.wantErr != (err != nil) || !reflect.DeepEqual(sc, c.wantSC) {
- t.Fatalf("parseServiceConfig(%s) = %+v, %v, want %+v, %v", c.scjs, sc, err, c.wantSC, c.wantErr)
- }
- }
-}
-
-func TestPraseMsgSize(t *testing.T) {
- testcases := []struct {
- scjs string
- wantSC ServiceConfig
- wantErr bool
- }{
- {
- `{
- "methodConfig": [
- {
- "name": [
- {
- "service": "foo",
- "method": "Bar"
- }
- ],
- "maxRequestMessageBytes": 1024,
- "maxResponseMessageBytes": 2048
- }
- ]
-}`,
- ServiceConfig{
- Methods: map[string]MethodConfig{
- "/foo/Bar": {
- MaxReqSize: newInt(1024),
- MaxRespSize: newInt(2048),
- },
- },
- },
- false,
- },
- {
- `{
- "methodConfig": [
- {
- "name": [
- {
- "service": "foo",
- "method": "Bar"
- }
- ],
- "maxRequestMessageBytes": "1024",
- "maxResponseMessageBytes": "2048"
- },
- {
- "name": [
- {
- "service": "foo",
- "method": "Bar"
- }
- ],
- "maxRequestMessageBytes": 1024,
- "maxResponseMessageBytes": 2048
- }
- ]
-}`,
- ServiceConfig{},
- true,
- },
- }
-
- for _, c := range testcases {
- sc, err := parseServiceConfig(c.scjs)
- if c.wantErr != (err != nil) || !reflect.DeepEqual(sc, c.wantSC) {
- t.Fatalf("parseServiceConfig(%s) = %+v, %v, want %+v, %v", c.scjs, sc, err, c.wantSC, c.wantErr)
- }
- }
-}
-
-func TestParseDuration(t *testing.T) {
- testCases := []struct {
- s *string
- want *time.Duration
- err bool
- }{
- {s: nil, want: nil},
- {s: newString("1s"), want: newDuration(time.Second)},
- {s: newString("-1s"), want: newDuration(-time.Second)},
- {s: newString("1.1s"), want: newDuration(1100 * time.Millisecond)},
- {s: newString("1.s"), want: newDuration(time.Second)},
- {s: newString("1.0s"), want: newDuration(time.Second)},
- {s: newString(".002s"), want: newDuration(2 * time.Millisecond)},
- {s: newString(".002000s"), want: newDuration(2 * time.Millisecond)},
- {s: newString("0.003s"), want: newDuration(3 * time.Millisecond)},
- {s: newString("0.000004s"), want: newDuration(4 * time.Microsecond)},
- {s: newString("5000.000000009s"), want: newDuration(5000*time.Second + 9*time.Nanosecond)},
- {s: newString("4999.999999999s"), want: newDuration(5000*time.Second - time.Nanosecond)},
- {s: newString("1"), err: true},
- {s: newString("s"), err: true},
- {s: newString(".s"), err: true},
- {s: newString("1 s"), err: true},
- {s: newString(" 1s"), err: true},
- {s: newString("1ms"), err: true},
- {s: newString("1.1.1s"), err: true},
- {s: newString("Xs"), err: true},
- {s: newString("as"), err: true},
- {s: newString(".0000000001s"), err: true},
- {s: newString(fmt.Sprint(math.MaxInt32) + "s"), want: newDuration(math.MaxInt32 * time.Second)},
- {s: newString(fmt.Sprint(int64(math.MaxInt32)+1) + "s"), err: true},
- }
- for _, tc := range testCases {
- got, err := parseDuration(tc.s)
- if tc.err != (err != nil) ||
- (got == nil) != (tc.want == nil) ||
- (got != nil && *got != *tc.want) {
- wantErr := "<nil>"
- if tc.err {
- wantErr = "<non-nil error>"
- }
- s := "<nil>"
- if tc.s != nil {
- s = `&"` + *tc.s + `"`
- }
- t.Errorf("parseDuration(%v) = %v, %v; want %v, %v", s, got, err, tc.want, wantErr)
- }
- }
-}
-
-func newBool(b bool) *bool {
- return &b
-}
-
-func newDuration(b time.Duration) *time.Duration {
- return &b
-}
-
-func newString(b string) *string {
- return &b
-}
diff --git a/vendor/google.golang.org/grpc/stats/stats_test.go b/vendor/google.golang.org/grpc/stats/stats_test.go
deleted file mode 100644
index 00a5e4f31..000000000
--- a/vendor/google.golang.org/grpc/stats/stats_test.go
+++ /dev/null
@@ -1,1257 +0,0 @@
-// +build go1.7
-
-/*
- *
- * Copyright 2016 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package stats_test
-
-import (
- "fmt"
- "io"
- "net"
- "reflect"
- "sync"
- "testing"
- "time"
-
- "github.com/golang/protobuf/proto"
- "golang.org/x/net/context"
- "google.golang.org/grpc"
- "google.golang.org/grpc/metadata"
- "google.golang.org/grpc/stats"
- testpb "google.golang.org/grpc/stats/grpc_testing"
- "google.golang.org/grpc/status"
-)
-
-func init() {
- grpc.EnableTracing = false
-}
-
-type connCtxKey struct{}
-type rpcCtxKey struct{}
-
-var (
- // For headers:
- testMetadata = metadata.MD{
- "key1": []string{"value1"},
- "key2": []string{"value2"},
- }
- // For trailers:
- testTrailerMetadata = metadata.MD{
- "tkey1": []string{"trailerValue1"},
- "tkey2": []string{"trailerValue2"},
- }
- // The id for which the service handler should return error.
- errorID int32 = 32202
-)
-
-type testServer struct{}
-
-func (s *testServer) UnaryCall(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) {
- md, ok := metadata.FromIncomingContext(ctx)
- if ok {
- if err := grpc.SendHeader(ctx, md); err != nil {
- return nil, status.Errorf(status.Code(err), "grpc.SendHeader(_, %v) = %v, want <nil>", md, err)
- }
- if err := grpc.SetTrailer(ctx, testTrailerMetadata); err != nil {
- return nil, status.Errorf(status.Code(err), "grpc.SetTrailer(_, %v) = %v, want <nil>", testTrailerMetadata, err)
- }
- }
-
- if in.Id == errorID {
- return nil, fmt.Errorf("got error id: %v", in.Id)
- }
-
- return &testpb.SimpleResponse{Id: in.Id}, nil
-}
-
-func (s *testServer) FullDuplexCall(stream testpb.TestService_FullDuplexCallServer) error {
- md, ok := metadata.FromIncomingContext(stream.Context())
- if ok {
- if err := stream.SendHeader(md); err != nil {
- return status.Errorf(status.Code(err), "%v.SendHeader(%v) = %v, want %v", stream, md, err, nil)
- }
- stream.SetTrailer(testTrailerMetadata)
- }
- for {
- in, err := stream.Recv()
- if err == io.EOF {
- // read done.
- return nil
- }
- if err != nil {
- return err
- }
-
- if in.Id == errorID {
- return fmt.Errorf("got error id: %v", in.Id)
- }
-
- if err := stream.Send(&testpb.SimpleResponse{Id: in.Id}); err != nil {
- return err
- }
- }
-}
-
-func (s *testServer) ClientStreamCall(stream testpb.TestService_ClientStreamCallServer) error {
- md, ok := metadata.FromIncomingContext(stream.Context())
- if ok {
- if err := stream.SendHeader(md); err != nil {
- return status.Errorf(status.Code(err), "%v.SendHeader(%v) = %v, want %v", stream, md, err, nil)
- }
- stream.SetTrailer(testTrailerMetadata)
- }
- for {
- in, err := stream.Recv()
- if err == io.EOF {
- // read done.
- return stream.SendAndClose(&testpb.SimpleResponse{Id: int32(0)})
- }
- if err != nil {
- return err
- }
-
- if in.Id == errorID {
- return fmt.Errorf("got error id: %v", in.Id)
- }
- }
-}
-
-func (s *testServer) ServerStreamCall(in *testpb.SimpleRequest, stream testpb.TestService_ServerStreamCallServer) error {
- md, ok := metadata.FromIncomingContext(stream.Context())
- if ok {
- if err := stream.SendHeader(md); err != nil {
- return status.Errorf(status.Code(err), "%v.SendHeader(%v) = %v, want %v", stream, md, err, nil)
- }
- stream.SetTrailer(testTrailerMetadata)
- }
-
- if in.Id == errorID {
- return fmt.Errorf("got error id: %v", in.Id)
- }
-
- for i := 0; i < 5; i++ {
- if err := stream.Send(&testpb.SimpleResponse{Id: in.Id}); err != nil {
- return err
- }
- }
- return nil
-}
-
-// test is an end-to-end test. It should be created with the newTest
-// func, modified as needed, and then started with its startServer method.
-// It should be cleaned up with the tearDown method.
-type test struct {
- t *testing.T
- compress string
- clientStatsHandler stats.Handler
- serverStatsHandler stats.Handler
-
- testServer testpb.TestServiceServer // nil means none
- // srv and srvAddr are set once startServer is called.
- srv *grpc.Server
- srvAddr string
-
- cc *grpc.ClientConn // nil until requested via clientConn
-}
-
-func (te *test) tearDown() {
- if te.cc != nil {
- te.cc.Close()
- te.cc = nil
- }
- te.srv.Stop()
-}
-
-type testConfig struct {
- compress string
-}
-
-// newTest returns a new test using the provided testing.T and
-// environment. It is returned with default values. Tests should
-// modify it before calling its startServer and clientConn methods.
-func newTest(t *testing.T, tc *testConfig, ch stats.Handler, sh stats.Handler) *test {
- te := &test{
- t: t,
- compress: tc.compress,
- clientStatsHandler: ch,
- serverStatsHandler: sh,
- }
- return te
-}
-
-// startServer starts a gRPC server listening. Callers should defer a
-// call to te.tearDown to clean up.
-func (te *test) startServer(ts testpb.TestServiceServer) {
- te.testServer = ts
- lis, err := net.Listen("tcp", "localhost:0")
- if err != nil {
- te.t.Fatalf("Failed to listen: %v", err)
- }
- var opts []grpc.ServerOption
- if te.compress == "gzip" {
- opts = append(opts,
- grpc.RPCCompressor(grpc.NewGZIPCompressor()),
- grpc.RPCDecompressor(grpc.NewGZIPDecompressor()),
- )
- }
- if te.serverStatsHandler != nil {
- opts = append(opts, grpc.StatsHandler(te.serverStatsHandler))
- }
- s := grpc.NewServer(opts...)
- te.srv = s
- if te.testServer != nil {
- testpb.RegisterTestServiceServer(s, te.testServer)
- }
-
- go s.Serve(lis)
- te.srvAddr = lis.Addr().String()
-}
-
-func (te *test) clientConn() *grpc.ClientConn {
- if te.cc != nil {
- return te.cc
- }
- opts := []grpc.DialOption{grpc.WithInsecure(), grpc.WithBlock()}
- if te.compress == "gzip" {
- opts = append(opts,
- grpc.WithCompressor(grpc.NewGZIPCompressor()),
- grpc.WithDecompressor(grpc.NewGZIPDecompressor()),
- )
- }
- if te.clientStatsHandler != nil {
- opts = append(opts, grpc.WithStatsHandler(te.clientStatsHandler))
- }
-
- var err error
- te.cc, err = grpc.Dial(te.srvAddr, opts...)
- if err != nil {
- te.t.Fatalf("Dial(%q) = %v", te.srvAddr, err)
- }
- return te.cc
-}
-
-type rpcType int
-
-const (
- unaryRPC rpcType = iota
- clientStreamRPC
- serverStreamRPC
- fullDuplexStreamRPC
-)
-
-type rpcConfig struct {
- count int // Number of requests and responses for streaming RPCs.
- success bool // Whether the RPC should succeed or return error.
- failfast bool
- callType rpcType // Type of RPC.
-}
-
-func (te *test) doUnaryCall(c *rpcConfig) (*testpb.SimpleRequest, *testpb.SimpleResponse, error) {
- var (
- resp *testpb.SimpleResponse
- req *testpb.SimpleRequest
- err error
- )
- tc := testpb.NewTestServiceClient(te.clientConn())
- if c.success {
- req = &testpb.SimpleRequest{Id: errorID + 1}
- } else {
- req = &testpb.SimpleRequest{Id: errorID}
- }
- ctx := metadata.NewOutgoingContext(context.Background(), testMetadata)
-
- resp, err = tc.UnaryCall(ctx, req, grpc.FailFast(c.failfast))
- return req, resp, err
-}
-
-func (te *test) doFullDuplexCallRoundtrip(c *rpcConfig) ([]*testpb.SimpleRequest, []*testpb.SimpleResponse, error) {
- var (
- reqs []*testpb.SimpleRequest
- resps []*testpb.SimpleResponse
- err error
- )
- tc := testpb.NewTestServiceClient(te.clientConn())
- stream, err := tc.FullDuplexCall(metadata.NewOutgoingContext(context.Background(), testMetadata), grpc.FailFast(c.failfast))
- if err != nil {
- return reqs, resps, err
- }
- var startID int32
- if !c.success {
- startID = errorID
- }
- for i := 0; i < c.count; i++ {
- req := &testpb.SimpleRequest{
- Id: int32(i) + startID,
- }
- reqs = append(reqs, req)
- if err = stream.Send(req); err != nil {
- return reqs, resps, err
- }
- var resp *testpb.SimpleResponse
- if resp, err = stream.Recv(); err != nil {
- return reqs, resps, err
- }
- resps = append(resps, resp)
- }
- if err = stream.CloseSend(); err != nil && err != io.EOF {
- return reqs, resps, err
- }
- if _, err = stream.Recv(); err != io.EOF {
- return reqs, resps, err
- }
-
- return reqs, resps, nil
-}
-
-func (te *test) doClientStreamCall(c *rpcConfig) ([]*testpb.SimpleRequest, *testpb.SimpleResponse, error) {
- var (
- reqs []*testpb.SimpleRequest
- resp *testpb.SimpleResponse
- err error
- )
- tc := testpb.NewTestServiceClient(te.clientConn())
- stream, err := tc.ClientStreamCall(metadata.NewOutgoingContext(context.Background(), testMetadata), grpc.FailFast(c.failfast))
- if err != nil {
- return reqs, resp, err
- }
- var startID int32
- if !c.success {
- startID = errorID
- }
- for i := 0; i < c.count; i++ {
- req := &testpb.SimpleRequest{
- Id: int32(i) + startID,
- }
- reqs = append(reqs, req)
- if err = stream.Send(req); err != nil {
- return reqs, resp, err
- }
- }
- resp, err = stream.CloseAndRecv()
- return reqs, resp, err
-}
-
-func (te *test) doServerStreamCall(c *rpcConfig) (*testpb.SimpleRequest, []*testpb.SimpleResponse, error) {
- var (
- req *testpb.SimpleRequest
- resps []*testpb.SimpleResponse
- err error
- )
-
- tc := testpb.NewTestServiceClient(te.clientConn())
-
- var startID int32
- if !c.success {
- startID = errorID
- }
- req = &testpb.SimpleRequest{Id: startID}
- stream, err := tc.ServerStreamCall(metadata.NewOutgoingContext(context.Background(), testMetadata), req, grpc.FailFast(c.failfast))
- if err != nil {
- return req, resps, err
- }
- for {
- var resp *testpb.SimpleResponse
- resp, err := stream.Recv()
- if err == io.EOF {
- return req, resps, nil
- } else if err != nil {
- return req, resps, err
- }
- resps = append(resps, resp)
- }
-}
-
-type expectedData struct {
- method string
- serverAddr string
- compression string
- reqIdx int
- requests []*testpb.SimpleRequest
- respIdx int
- responses []*testpb.SimpleResponse
- err error
- failfast bool
-}
-
-type gotData struct {
- ctx context.Context
- client bool
- s interface{} // This could be RPCStats or ConnStats.
-}
-
-const (
- begin int = iota
- end
- inPayload
- inHeader
- inTrailer
- outPayload
- outHeader
- outTrailer
- connbegin
- connend
-)
-
-func checkBegin(t *testing.T, d *gotData, e *expectedData) {
- var (
- ok bool
- st *stats.Begin
- )
- if st, ok = d.s.(*stats.Begin); !ok {
- t.Fatalf("got %T, want Begin", d.s)
- }
- if d.ctx == nil {
- t.Fatalf("d.ctx = nil, want <non-nil>")
- }
- if st.BeginTime.IsZero() {
- t.Fatalf("st.BeginTime = %v, want <non-zero>", st.BeginTime)
- }
- if d.client {
- if st.FailFast != e.failfast {
- t.Fatalf("st.FailFast = %v, want %v", st.FailFast, e.failfast)
- }
- }
-}
-
-func checkInHeader(t *testing.T, d *gotData, e *expectedData) {
- var (
- ok bool
- st *stats.InHeader
- )
- if st, ok = d.s.(*stats.InHeader); !ok {
- t.Fatalf("got %T, want InHeader", d.s)
- }
- if d.ctx == nil {
- t.Fatalf("d.ctx = nil, want <non-nil>")
- }
- if !d.client {
- if st.FullMethod != e.method {
- t.Fatalf("st.FullMethod = %s, want %v", st.FullMethod, e.method)
- }
- if st.LocalAddr.String() != e.serverAddr {
- t.Fatalf("st.LocalAddr = %v, want %v", st.LocalAddr, e.serverAddr)
- }
- if st.Compression != e.compression {
- t.Fatalf("st.Compression = %v, want %v", st.Compression, e.compression)
- }
-
- if connInfo, ok := d.ctx.Value(connCtxKey{}).(*stats.ConnTagInfo); ok {
- if connInfo.RemoteAddr != st.RemoteAddr {
- t.Fatalf("connInfo.RemoteAddr = %v, want %v", connInfo.RemoteAddr, st.RemoteAddr)
- }
- if connInfo.LocalAddr != st.LocalAddr {
- t.Fatalf("connInfo.LocalAddr = %v, want %v", connInfo.LocalAddr, st.LocalAddr)
- }
- } else {
- t.Fatalf("got context %v, want one with connCtxKey", d.ctx)
- }
- if rpcInfo, ok := d.ctx.Value(rpcCtxKey{}).(*stats.RPCTagInfo); ok {
- if rpcInfo.FullMethodName != st.FullMethod {
- t.Fatalf("rpcInfo.FullMethod = %s, want %v", rpcInfo.FullMethodName, st.FullMethod)
- }
- } else {
- t.Fatalf("got context %v, want one with rpcCtxKey", d.ctx)
- }
- }
-}
-
-func checkInPayload(t *testing.T, d *gotData, e *expectedData) {
- var (
- ok bool
- st *stats.InPayload
- )
- if st, ok = d.s.(*stats.InPayload); !ok {
- t.Fatalf("got %T, want InPayload", d.s)
- }
- if d.ctx == nil {
- t.Fatalf("d.ctx = nil, want <non-nil>")
- }
- if d.client {
- b, err := proto.Marshal(e.responses[e.respIdx])
- if err != nil {
- t.Fatalf("failed to marshal message: %v", err)
- }
- if reflect.TypeOf(st.Payload) != reflect.TypeOf(e.responses[e.respIdx]) {
- t.Fatalf("st.Payload = %T, want %T", st.Payload, e.responses[e.respIdx])
- }
- e.respIdx++
- if string(st.Data) != string(b) {
- t.Fatalf("st.Data = %v, want %v", st.Data, b)
- }
- if st.Length != len(b) {
- t.Fatalf("st.Lenght = %v, want %v", st.Length, len(b))
- }
- } else {
- b, err := proto.Marshal(e.requests[e.reqIdx])
- if err != nil {
- t.Fatalf("failed to marshal message: %v", err)
- }
- if reflect.TypeOf(st.Payload) != reflect.TypeOf(e.requests[e.reqIdx]) {
- t.Fatalf("st.Payload = %T, want %T", st.Payload, e.requests[e.reqIdx])
- }
- e.reqIdx++
- if string(st.Data) != string(b) {
- t.Fatalf("st.Data = %v, want %v", st.Data, b)
- }
- if st.Length != len(b) {
- t.Fatalf("st.Lenght = %v, want %v", st.Length, len(b))
- }
- }
- // TODO check WireLength and ReceivedTime.
- if st.RecvTime.IsZero() {
- t.Fatalf("st.ReceivedTime = %v, want <non-zero>", st.RecvTime)
- }
-}
-
-func checkInTrailer(t *testing.T, d *gotData, e *expectedData) {
- var (
- ok bool
- )
- if _, ok = d.s.(*stats.InTrailer); !ok {
- t.Fatalf("got %T, want InTrailer", d.s)
- }
- if d.ctx == nil {
- t.Fatalf("d.ctx = nil, want <non-nil>")
- }
-}
-
-func checkOutHeader(t *testing.T, d *gotData, e *expectedData) {
- var (
- ok bool
- st *stats.OutHeader
- )
- if st, ok = d.s.(*stats.OutHeader); !ok {
- t.Fatalf("got %T, want OutHeader", d.s)
- }
- if d.ctx == nil {
- t.Fatalf("d.ctx = nil, want <non-nil>")
- }
- if d.client {
- if st.FullMethod != e.method {
- t.Fatalf("st.FullMethod = %s, want %v", st.FullMethod, e.method)
- }
- if st.RemoteAddr.String() != e.serverAddr {
- t.Fatalf("st.RemoteAddr = %v, want %v", st.RemoteAddr, e.serverAddr)
- }
- if st.Compression != e.compression {
- t.Fatalf("st.Compression = %v, want %v", st.Compression, e.compression)
- }
-
- if rpcInfo, ok := d.ctx.Value(rpcCtxKey{}).(*stats.RPCTagInfo); ok {
- if rpcInfo.FullMethodName != st.FullMethod {
- t.Fatalf("rpcInfo.FullMethod = %s, want %v", rpcInfo.FullMethodName, st.FullMethod)
- }
- } else {
- t.Fatalf("got context %v, want one with rpcCtxKey", d.ctx)
- }
- }
-}
-
-func checkOutPayload(t *testing.T, d *gotData, e *expectedData) {
- var (
- ok bool
- st *stats.OutPayload
- )
- if st, ok = d.s.(*stats.OutPayload); !ok {
- t.Fatalf("got %T, want OutPayload", d.s)
- }
- if d.ctx == nil {
- t.Fatalf("d.ctx = nil, want <non-nil>")
- }
- if d.client {
- b, err := proto.Marshal(e.requests[e.reqIdx])
- if err != nil {
- t.Fatalf("failed to marshal message: %v", err)
- }
- if reflect.TypeOf(st.Payload) != reflect.TypeOf(e.requests[e.reqIdx]) {
- t.Fatalf("st.Payload = %T, want %T", st.Payload, e.requests[e.reqIdx])
- }
- e.reqIdx++
- if string(st.Data) != string(b) {
- t.Fatalf("st.Data = %v, want %v", st.Data, b)
- }
- if st.Length != len(b) {
- t.Fatalf("st.Lenght = %v, want %v", st.Length, len(b))
- }
- } else {
- b, err := proto.Marshal(e.responses[e.respIdx])
- if err != nil {
- t.Fatalf("failed to marshal message: %v", err)
- }
- if reflect.TypeOf(st.Payload) != reflect.TypeOf(e.responses[e.respIdx]) {
- t.Fatalf("st.Payload = %T, want %T", st.Payload, e.responses[e.respIdx])
- }
- e.respIdx++
- if string(st.Data) != string(b) {
- t.Fatalf("st.Data = %v, want %v", st.Data, b)
- }
- if st.Length != len(b) {
- t.Fatalf("st.Lenght = %v, want %v", st.Length, len(b))
- }
- }
- // TODO check WireLength and ReceivedTime.
- if st.SentTime.IsZero() {
- t.Fatalf("st.SentTime = %v, want <non-zero>", st.SentTime)
- }
-}
-
-func checkOutTrailer(t *testing.T, d *gotData, e *expectedData) {
- var (
- ok bool
- st *stats.OutTrailer
- )
- if st, ok = d.s.(*stats.OutTrailer); !ok {
- t.Fatalf("got %T, want OutTrailer", d.s)
- }
- if d.ctx == nil {
- t.Fatalf("d.ctx = nil, want <non-nil>")
- }
- if st.Client {
- t.Fatalf("st IsClient = true, want false")
- }
-}
-
-func checkEnd(t *testing.T, d *gotData, e *expectedData) {
- var (
- ok bool
- st *stats.End
- )
- if st, ok = d.s.(*stats.End); !ok {
- t.Fatalf("got %T, want End", d.s)
- }
- if d.ctx == nil {
- t.Fatalf("d.ctx = nil, want <non-nil>")
- }
- if st.BeginTime.IsZero() {
- t.Fatalf("st.BeginTime = %v, want <non-zero>", st.BeginTime)
- }
- if st.EndTime.IsZero() {
- t.Fatalf("st.EndTime = %v, want <non-zero>", st.EndTime)
- }
-
- actual, ok := status.FromError(st.Error)
- if !ok {
- t.Fatalf("expected st.Error to be a statusError, got %v (type %T)", st.Error, st.Error)
- }
-
- expectedStatus, _ := status.FromError(e.err)
- if actual.Code() != expectedStatus.Code() || actual.Message() != expectedStatus.Message() {
- t.Fatalf("st.Error = %v, want %v", st.Error, e.err)
- }
-}
-
-func checkConnBegin(t *testing.T, d *gotData, e *expectedData) {
- var (
- ok bool
- st *stats.ConnBegin
- )
- if st, ok = d.s.(*stats.ConnBegin); !ok {
- t.Fatalf("got %T, want ConnBegin", d.s)
- }
- if d.ctx == nil {
- t.Fatalf("d.ctx = nil, want <non-nil>")
- }
- st.IsClient() // TODO remove this.
-}
-
-func checkConnEnd(t *testing.T, d *gotData, e *expectedData) {
- var (
- ok bool
- st *stats.ConnEnd
- )
- if st, ok = d.s.(*stats.ConnEnd); !ok {
- t.Fatalf("got %T, want ConnEnd", d.s)
- }
- if d.ctx == nil {
- t.Fatalf("d.ctx = nil, want <non-nil>")
- }
- st.IsClient() // TODO remove this.
-}
-
-type statshandler struct {
- mu sync.Mutex
- gotRPC []*gotData
- gotConn []*gotData
-}
-
-func (h *statshandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context {
- return context.WithValue(ctx, connCtxKey{}, info)
-}
-
-func (h *statshandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context {
- return context.WithValue(ctx, rpcCtxKey{}, info)
-}
-
-func (h *statshandler) HandleConn(ctx context.Context, s stats.ConnStats) {
- h.mu.Lock()
- defer h.mu.Unlock()
- h.gotConn = append(h.gotConn, &gotData{ctx, s.IsClient(), s})
-}
-
-func (h *statshandler) HandleRPC(ctx context.Context, s stats.RPCStats) {
- h.mu.Lock()
- defer h.mu.Unlock()
- h.gotRPC = append(h.gotRPC, &gotData{ctx, s.IsClient(), s})
-}
-
-func checkConnStats(t *testing.T, got []*gotData) {
- if len(got) <= 0 || len(got)%2 != 0 {
- for i, g := range got {
- t.Errorf(" - %v, %T = %+v, ctx: %v", i, g.s, g.s, g.ctx)
- }
- t.Fatalf("got %v stats, want even positive number", len(got))
- }
- // The first conn stats must be a ConnBegin.
- checkConnBegin(t, got[0], nil)
- // The last conn stats must be a ConnEnd.
- checkConnEnd(t, got[len(got)-1], nil)
-}
-
-func checkServerStats(t *testing.T, got []*gotData, expect *expectedData, checkFuncs []func(t *testing.T, d *gotData, e *expectedData)) {
- if len(got) != len(checkFuncs) {
- for i, g := range got {
- t.Errorf(" - %v, %T", i, g.s)
- }
- t.Fatalf("got %v stats, want %v stats", len(got), len(checkFuncs))
- }
-
- var rpcctx context.Context
- for i := 0; i < len(got); i++ {
- if _, ok := got[i].s.(stats.RPCStats); ok {
- if rpcctx != nil && got[i].ctx != rpcctx {
- t.Fatalf("got different contexts with stats %T", got[i].s)
- }
- rpcctx = got[i].ctx
- }
- }
-
- for i, f := range checkFuncs {
- f(t, got[i], expect)
- }
-}
-
-func testServerStats(t *testing.T, tc *testConfig, cc *rpcConfig, checkFuncs []func(t *testing.T, d *gotData, e *expectedData)) {
- h := &statshandler{}
- te := newTest(t, tc, nil, h)
- te.startServer(&testServer{})
- defer te.tearDown()
-
- var (
- reqs []*testpb.SimpleRequest
- resps []*testpb.SimpleResponse
- err error
- method string
-
- req *testpb.SimpleRequest
- resp *testpb.SimpleResponse
- e error
- )
-
- switch cc.callType {
- case unaryRPC:
- method = "/grpc.testing.TestService/UnaryCall"
- req, resp, e = te.doUnaryCall(cc)
- reqs = []*testpb.SimpleRequest{req}
- resps = []*testpb.SimpleResponse{resp}
- err = e
- case clientStreamRPC:
- method = "/grpc.testing.TestService/ClientStreamCall"
- reqs, resp, e = te.doClientStreamCall(cc)
- resps = []*testpb.SimpleResponse{resp}
- err = e
- case serverStreamRPC:
- method = "/grpc.testing.TestService/ServerStreamCall"
- req, resps, e = te.doServerStreamCall(cc)
- reqs = []*testpb.SimpleRequest{req}
- err = e
- case fullDuplexStreamRPC:
- method = "/grpc.testing.TestService/FullDuplexCall"
- reqs, resps, err = te.doFullDuplexCallRoundtrip(cc)
- }
- if cc.success != (err == nil) {
- t.Fatalf("cc.success: %v, got error: %v", cc.success, err)
- }
- te.cc.Close()
- te.srv.GracefulStop() // Wait for the server to stop.
-
- for {
- h.mu.Lock()
- if len(h.gotRPC) >= len(checkFuncs) {
- h.mu.Unlock()
- break
- }
- h.mu.Unlock()
- time.Sleep(10 * time.Millisecond)
- }
-
- for {
- h.mu.Lock()
- if _, ok := h.gotConn[len(h.gotConn)-1].s.(*stats.ConnEnd); ok {
- h.mu.Unlock()
- break
- }
- h.mu.Unlock()
- time.Sleep(10 * time.Millisecond)
- }
-
- expect := &expectedData{
- serverAddr: te.srvAddr,
- compression: tc.compress,
- method: method,
- requests: reqs,
- responses: resps,
- err: err,
- }
-
- h.mu.Lock()
- checkConnStats(t, h.gotConn)
- h.mu.Unlock()
- checkServerStats(t, h.gotRPC, expect, checkFuncs)
-}
-
-func TestServerStatsUnaryRPC(t *testing.T) {
- testServerStats(t, &testConfig{compress: ""}, &rpcConfig{success: true, callType: unaryRPC}, []func(t *testing.T, d *gotData, e *expectedData){
- checkInHeader,
- checkBegin,
- checkInPayload,
- checkOutHeader,
- checkOutPayload,
- checkOutTrailer,
- checkEnd,
- })
-}
-
-func TestServerStatsUnaryRPCError(t *testing.T) {
- testServerStats(t, &testConfig{compress: ""}, &rpcConfig{success: false, callType: unaryRPC}, []func(t *testing.T, d *gotData, e *expectedData){
- checkInHeader,
- checkBegin,
- checkInPayload,
- checkOutHeader,
- checkOutTrailer,
- checkEnd,
- })
-}
-
-func TestServerStatsClientStreamRPC(t *testing.T) {
- count := 5
- checkFuncs := []func(t *testing.T, d *gotData, e *expectedData){
- checkInHeader,
- checkBegin,
- checkOutHeader,
- }
- ioPayFuncs := []func(t *testing.T, d *gotData, e *expectedData){
- checkInPayload,
- }
- for i := 0; i < count; i++ {
- checkFuncs = append(checkFuncs, ioPayFuncs...)
- }
- checkFuncs = append(checkFuncs,
- checkOutPayload,
- checkOutTrailer,
- checkEnd,
- )
- testServerStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: true, callType: clientStreamRPC}, checkFuncs)
-}
-
-func TestServerStatsClientStreamRPCError(t *testing.T) {
- count := 1
- testServerStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: false, callType: clientStreamRPC}, []func(t *testing.T, d *gotData, e *expectedData){
- checkInHeader,
- checkBegin,
- checkOutHeader,
- checkInPayload,
- checkOutTrailer,
- checkEnd,
- })
-}
-
-func TestServerStatsServerStreamRPC(t *testing.T) {
- count := 5
- checkFuncs := []func(t *testing.T, d *gotData, e *expectedData){
- checkInHeader,
- checkBegin,
- checkInPayload,
- checkOutHeader,
- }
- ioPayFuncs := []func(t *testing.T, d *gotData, e *expectedData){
- checkOutPayload,
- }
- for i := 0; i < count; i++ {
- checkFuncs = append(checkFuncs, ioPayFuncs...)
- }
- checkFuncs = append(checkFuncs,
- checkOutTrailer,
- checkEnd,
- )
- testServerStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: true, callType: serverStreamRPC}, checkFuncs)
-}
-
-func TestServerStatsServerStreamRPCError(t *testing.T) {
- count := 5
- testServerStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: false, callType: serverStreamRPC}, []func(t *testing.T, d *gotData, e *expectedData){
- checkInHeader,
- checkBegin,
- checkInPayload,
- checkOutHeader,
- checkOutTrailer,
- checkEnd,
- })
-}
-
-func TestServerStatsFullDuplexRPC(t *testing.T) {
- count := 5
- checkFuncs := []func(t *testing.T, d *gotData, e *expectedData){
- checkInHeader,
- checkBegin,
- checkOutHeader,
- }
- ioPayFuncs := []func(t *testing.T, d *gotData, e *expectedData){
- checkInPayload,
- checkOutPayload,
- }
- for i := 0; i < count; i++ {
- checkFuncs = append(checkFuncs, ioPayFuncs...)
- }
- checkFuncs = append(checkFuncs,
- checkOutTrailer,
- checkEnd,
- )
- testServerStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: true, callType: fullDuplexStreamRPC}, checkFuncs)
-}
-
-func TestServerStatsFullDuplexRPCError(t *testing.T) {
- count := 5
- testServerStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: false, callType: fullDuplexStreamRPC}, []func(t *testing.T, d *gotData, e *expectedData){
- checkInHeader,
- checkBegin,
- checkOutHeader,
- checkInPayload,
- checkOutTrailer,
- checkEnd,
- })
-}
-
-type checkFuncWithCount struct {
- f func(t *testing.T, d *gotData, e *expectedData)
- c int // expected count
-}
-
-func checkClientStats(t *testing.T, got []*gotData, expect *expectedData, checkFuncs map[int]*checkFuncWithCount) {
- var expectLen int
- for _, v := range checkFuncs {
- expectLen += v.c
- }
- if len(got) != expectLen {
- for i, g := range got {
- t.Errorf(" - %v, %T", i, g.s)
- }
- t.Fatalf("got %v stats, want %v stats", len(got), expectLen)
- }
-
- var tagInfoInCtx *stats.RPCTagInfo
- for i := 0; i < len(got); i++ {
- if _, ok := got[i].s.(stats.RPCStats); ok {
- tagInfoInCtxNew, _ := got[i].ctx.Value(rpcCtxKey{}).(*stats.RPCTagInfo)
- if tagInfoInCtx != nil && tagInfoInCtx != tagInfoInCtxNew {
- t.Fatalf("got context containing different tagInfo with stats %T", got[i].s)
- }
- tagInfoInCtx = tagInfoInCtxNew
- }
- }
-
- for _, s := range got {
- switch s.s.(type) {
- case *stats.Begin:
- if checkFuncs[begin].c <= 0 {
- t.Fatalf("unexpected stats: %T", s.s)
- }
- checkFuncs[begin].f(t, s, expect)
- checkFuncs[begin].c--
- case *stats.OutHeader:
- if checkFuncs[outHeader].c <= 0 {
- t.Fatalf("unexpected stats: %T", s.s)
- }
- checkFuncs[outHeader].f(t, s, expect)
- checkFuncs[outHeader].c--
- case *stats.OutPayload:
- if checkFuncs[outPayload].c <= 0 {
- t.Fatalf("unexpected stats: %T", s.s)
- }
- checkFuncs[outPayload].f(t, s, expect)
- checkFuncs[outPayload].c--
- case *stats.InHeader:
- if checkFuncs[inHeader].c <= 0 {
- t.Fatalf("unexpected stats: %T", s.s)
- }
- checkFuncs[inHeader].f(t, s, expect)
- checkFuncs[inHeader].c--
- case *stats.InPayload:
- if checkFuncs[inPayload].c <= 0 {
- t.Fatalf("unexpected stats: %T", s.s)
- }
- checkFuncs[inPayload].f(t, s, expect)
- checkFuncs[inPayload].c--
- case *stats.InTrailer:
- if checkFuncs[inTrailer].c <= 0 {
- t.Fatalf("unexpected stats: %T", s.s)
- }
- checkFuncs[inTrailer].f(t, s, expect)
- checkFuncs[inTrailer].c--
- case *stats.End:
- if checkFuncs[end].c <= 0 {
- t.Fatalf("unexpected stats: %T", s.s)
- }
- checkFuncs[end].f(t, s, expect)
- checkFuncs[end].c--
- case *stats.ConnBegin:
- if checkFuncs[connbegin].c <= 0 {
- t.Fatalf("unexpected stats: %T", s.s)
- }
- checkFuncs[connbegin].f(t, s, expect)
- checkFuncs[connbegin].c--
- case *stats.ConnEnd:
- if checkFuncs[connend].c <= 0 {
- t.Fatalf("unexpected stats: %T", s.s)
- }
- checkFuncs[connend].f(t, s, expect)
- checkFuncs[connend].c--
- default:
- t.Fatalf("unexpected stats: %T", s.s)
- }
- }
-}
-
-func testClientStats(t *testing.T, tc *testConfig, cc *rpcConfig, checkFuncs map[int]*checkFuncWithCount) {
- h := &statshandler{}
- te := newTest(t, tc, h, nil)
- te.startServer(&testServer{})
- defer te.tearDown()
-
- var (
- reqs []*testpb.SimpleRequest
- resps []*testpb.SimpleResponse
- method string
- err error
-
- req *testpb.SimpleRequest
- resp *testpb.SimpleResponse
- e error
- )
- switch cc.callType {
- case unaryRPC:
- method = "/grpc.testing.TestService/UnaryCall"
- req, resp, e = te.doUnaryCall(cc)
- reqs = []*testpb.SimpleRequest{req}
- resps = []*testpb.SimpleResponse{resp}
- err = e
- case clientStreamRPC:
- method = "/grpc.testing.TestService/ClientStreamCall"
- reqs, resp, e = te.doClientStreamCall(cc)
- resps = []*testpb.SimpleResponse{resp}
- err = e
- case serverStreamRPC:
- method = "/grpc.testing.TestService/ServerStreamCall"
- req, resps, e = te.doServerStreamCall(cc)
- reqs = []*testpb.SimpleRequest{req}
- err = e
- case fullDuplexStreamRPC:
- method = "/grpc.testing.TestService/FullDuplexCall"
- reqs, resps, err = te.doFullDuplexCallRoundtrip(cc)
- }
- if cc.success != (err == nil) {
- t.Fatalf("cc.success: %v, got error: %v", cc.success, err)
- }
- te.cc.Close()
- te.srv.GracefulStop() // Wait for the server to stop.
-
- lenRPCStats := 0
- for _, v := range checkFuncs {
- lenRPCStats += v.c
- }
- for {
- h.mu.Lock()
- if len(h.gotRPC) >= lenRPCStats {
- h.mu.Unlock()
- break
- }
- h.mu.Unlock()
- time.Sleep(10 * time.Millisecond)
- }
-
- for {
- h.mu.Lock()
- if _, ok := h.gotConn[len(h.gotConn)-1].s.(*stats.ConnEnd); ok {
- h.mu.Unlock()
- break
- }
- h.mu.Unlock()
- time.Sleep(10 * time.Millisecond)
- }
-
- expect := &expectedData{
- serverAddr: te.srvAddr,
- compression: tc.compress,
- method: method,
- requests: reqs,
- responses: resps,
- failfast: cc.failfast,
- err: err,
- }
-
- h.mu.Lock()
- checkConnStats(t, h.gotConn)
- h.mu.Unlock()
- checkClientStats(t, h.gotRPC, expect, checkFuncs)
-}
-
-func TestClientStatsUnaryRPC(t *testing.T) {
- testClientStats(t, &testConfig{compress: ""}, &rpcConfig{success: true, failfast: false, callType: unaryRPC}, map[int]*checkFuncWithCount{
- begin: {checkBegin, 1},
- outHeader: {checkOutHeader, 1},
- outPayload: {checkOutPayload, 1},
- inHeader: {checkInHeader, 1},
- inPayload: {checkInPayload, 1},
- inTrailer: {checkInTrailer, 1},
- end: {checkEnd, 1},
- })
-}
-
-func TestClientStatsUnaryRPCError(t *testing.T) {
- testClientStats(t, &testConfig{compress: ""}, &rpcConfig{success: false, failfast: false, callType: unaryRPC}, map[int]*checkFuncWithCount{
- begin: {checkBegin, 1},
- outHeader: {checkOutHeader, 1},
- outPayload: {checkOutPayload, 1},
- inHeader: {checkInHeader, 1},
- inTrailer: {checkInTrailer, 1},
- end: {checkEnd, 1},
- })
-}
-
-func TestClientStatsClientStreamRPC(t *testing.T) {
- count := 5
- testClientStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: true, failfast: false, callType: clientStreamRPC}, map[int]*checkFuncWithCount{
- begin: {checkBegin, 1},
- outHeader: {checkOutHeader, 1},
- inHeader: {checkInHeader, 1},
- outPayload: {checkOutPayload, count},
- inTrailer: {checkInTrailer, 1},
- inPayload: {checkInPayload, 1},
- end: {checkEnd, 1},
- })
-}
-
-func TestClientStatsClientStreamRPCError(t *testing.T) {
- count := 1
- testClientStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: false, failfast: false, callType: clientStreamRPC}, map[int]*checkFuncWithCount{
- begin: {checkBegin, 1},
- outHeader: {checkOutHeader, 1},
- inHeader: {checkInHeader, 1},
- outPayload: {checkOutPayload, 1},
- inTrailer: {checkInTrailer, 1},
- end: {checkEnd, 1},
- })
-}
-
-func TestClientStatsServerStreamRPC(t *testing.T) {
- count := 5
- testClientStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: true, failfast: false, callType: serverStreamRPC}, map[int]*checkFuncWithCount{
- begin: {checkBegin, 1},
- outHeader: {checkOutHeader, 1},
- outPayload: {checkOutPayload, 1},
- inHeader: {checkInHeader, 1},
- inPayload: {checkInPayload, count},
- inTrailer: {checkInTrailer, 1},
- end: {checkEnd, 1},
- })
-}
-
-func TestClientStatsServerStreamRPCError(t *testing.T) {
- count := 5
- testClientStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: false, failfast: false, callType: serverStreamRPC}, map[int]*checkFuncWithCount{
- begin: {checkBegin, 1},
- outHeader: {checkOutHeader, 1},
- outPayload: {checkOutPayload, 1},
- inHeader: {checkInHeader, 1},
- inTrailer: {checkInTrailer, 1},
- end: {checkEnd, 1},
- })
-}
-
-func TestClientStatsFullDuplexRPC(t *testing.T) {
- count := 5
- testClientStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: true, failfast: false, callType: fullDuplexStreamRPC}, map[int]*checkFuncWithCount{
- begin: {checkBegin, 1},
- outHeader: {checkOutHeader, 1},
- outPayload: {checkOutPayload, count},
- inHeader: {checkInHeader, 1},
- inPayload: {checkInPayload, count},
- inTrailer: {checkInTrailer, 1},
- end: {checkEnd, 1},
- })
-}
-
-func TestClientStatsFullDuplexRPCError(t *testing.T) {
- count := 5
- testClientStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: false, failfast: false, callType: fullDuplexStreamRPC}, map[int]*checkFuncWithCount{
- begin: {checkBegin, 1},
- outHeader: {checkOutHeader, 1},
- outPayload: {checkOutPayload, 1},
- inHeader: {checkInHeader, 1},
- inTrailer: {checkInTrailer, 1},
- end: {checkEnd, 1},
- })
-}
-
-func TestTags(t *testing.T) {
- b := []byte{5, 2, 4, 3, 1}
- ctx := stats.SetTags(context.Background(), b)
- if tg := stats.OutgoingTags(ctx); !reflect.DeepEqual(tg, b) {
- t.Errorf("OutgoingTags(%v) = %v; want %v", ctx, tg, b)
- }
- if tg := stats.Tags(ctx); tg != nil {
- t.Errorf("Tags(%v) = %v; want nil", ctx, tg)
- }
-
- ctx = stats.SetIncomingTags(context.Background(), b)
- if tg := stats.Tags(ctx); !reflect.DeepEqual(tg, b) {
- t.Errorf("Tags(%v) = %v; want %v", ctx, tg, b)
- }
- if tg := stats.OutgoingTags(ctx); tg != nil {
- t.Errorf("OutgoingTags(%v) = %v; want nil", ctx, tg)
- }
-}
-
-func TestTrace(t *testing.T) {
- b := []byte{5, 2, 4, 3, 1}
- ctx := stats.SetTrace(context.Background(), b)
- if tr := stats.OutgoingTrace(ctx); !reflect.DeepEqual(tr, b) {
- t.Errorf("OutgoingTrace(%v) = %v; want %v", ctx, tr, b)
- }
- if tr := stats.Trace(ctx); tr != nil {
- t.Errorf("Trace(%v) = %v; want nil", ctx, tr)
- }
-
- ctx = stats.SetIncomingTrace(context.Background(), b)
- if tr := stats.Trace(ctx); !reflect.DeepEqual(tr, b) {
- t.Errorf("Trace(%v) = %v; want %v", ctx, tr, b)
- }
- if tr := stats.OutgoingTrace(ctx); tr != nil {
- t.Errorf("OutgoingTrace(%v) = %v; want nil", ctx, tr)
- }
-}
diff --git a/vendor/google.golang.org/grpc/status/go17_test.go b/vendor/google.golang.org/grpc/status/go17_test.go
deleted file mode 100644
index 2dc5add94..000000000
--- a/vendor/google.golang.org/grpc/status/go17_test.go
+++ /dev/null
@@ -1,44 +0,0 @@
-// +build go1.7
-
-/*
- *
- * Copyright 2018 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package status
-
-import (
- "context"
- "testing"
-
- "google.golang.org/grpc/codes"
-)
-
-func TestFromStdContextError(t *testing.T) {
- testCases := []struct {
- in error
- want *Status
- }{
- {in: context.DeadlineExceeded, want: New(codes.DeadlineExceeded, context.DeadlineExceeded.Error())},
- {in: context.Canceled, want: New(codes.Canceled, context.Canceled.Error())},
- }
- for _, tc := range testCases {
- got := FromContextError(tc.in)
- if got.Code() != tc.want.Code() || got.Message() != tc.want.Message() {
- t.Errorf("FromContextError(%v) = %v; want %v", tc.in, got, tc.want)
- }
- }
-}
diff --git a/vendor/google.golang.org/grpc/status/status_test.go b/vendor/google.golang.org/grpc/status/status_test.go
deleted file mode 100644
index 1eb132093..000000000
--- a/vendor/google.golang.org/grpc/status/status_test.go
+++ /dev/null
@@ -1,348 +0,0 @@
-/*
- *
- * Copyright 2017 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package status
-
-import (
- "errors"
- "fmt"
- "reflect"
- "testing"
-
- "github.com/golang/protobuf/proto"
- "github.com/golang/protobuf/ptypes"
- apb "github.com/golang/protobuf/ptypes/any"
- dpb "github.com/golang/protobuf/ptypes/duration"
- "golang.org/x/net/context"
- cpb "google.golang.org/genproto/googleapis/rpc/code"
- epb "google.golang.org/genproto/googleapis/rpc/errdetails"
- spb "google.golang.org/genproto/googleapis/rpc/status"
- "google.golang.org/grpc/codes"
-)
-
-func TestErrorsWithSameParameters(t *testing.T) {
- const description = "some description"
- e1 := Errorf(codes.AlreadyExists, description)
- e2 := Errorf(codes.AlreadyExists, description)
- if e1 == e2 || !reflect.DeepEqual(e1, e2) {
- t.Fatalf("Errors should be equivalent but unique - e1: %v, %v e2: %p, %v", e1.(*statusError), e1, e2.(*statusError), e2)
- }
-}
-
-func TestFromToProto(t *testing.T) {
- s := &spb.Status{
- Code: int32(codes.Internal),
- Message: "test test test",
- Details: []*apb.Any{{TypeUrl: "foo", Value: []byte{3, 2, 1}}},
- }
-
- err := FromProto(s)
- if got := err.Proto(); !proto.Equal(s, got) {
- t.Fatalf("Expected errors to be identical - s: %v got: %v", s, got)
- }
-}
-
-func TestFromNilProto(t *testing.T) {
- tests := []*Status{nil, FromProto(nil)}
- for _, s := range tests {
- if c := s.Code(); c != codes.OK {
- t.Errorf("s: %v - Expected s.Code() = OK; got %v", s, c)
- }
- if m := s.Message(); m != "" {
- t.Errorf("s: %v - Expected s.Message() = \"\"; got %q", s, m)
- }
- if p := s.Proto(); p != nil {
- t.Errorf("s: %v - Expected s.Proto() = nil; got %q", s, p)
- }
- if e := s.Err(); e != nil {
- t.Errorf("s: %v - Expected s.Err() = nil; got %v", s, e)
- }
- }
-}
-
-func TestError(t *testing.T) {
- err := Error(codes.Internal, "test description")
- if got, want := err.Error(), "rpc error: code = Internal desc = test description"; got != want {
- t.Fatalf("err.Error() = %q; want %q", got, want)
- }
- s, _ := FromError(err)
- if got, want := s.Code(), codes.Internal; got != want {
- t.Fatalf("err.Code() = %s; want %s", got, want)
- }
- if got, want := s.Message(), "test description"; got != want {
- t.Fatalf("err.Message() = %s; want %s", got, want)
- }
-}
-
-func TestErrorOK(t *testing.T) {
- err := Error(codes.OK, "foo")
- if err != nil {
- t.Fatalf("Error(codes.OK, _) = %p; want nil", err.(*statusError))
- }
-}
-
-func TestErrorProtoOK(t *testing.T) {
- s := &spb.Status{Code: int32(codes.OK)}
- if got := ErrorProto(s); got != nil {
- t.Fatalf("ErrorProto(%v) = %v; want nil", s, got)
- }
-}
-
-func TestFromError(t *testing.T) {
- code, message := codes.Internal, "test description"
- err := Error(code, message)
- s, ok := FromError(err)
- if !ok || s.Code() != code || s.Message() != message || s.Err() == nil {
- t.Fatalf("FromError(%v) = %v, %v; want <Code()=%s, Message()=%q, Err()!=nil>, true", err, s, ok, code, message)
- }
-}
-
-func TestFromErrorOK(t *testing.T) {
- code, message := codes.OK, ""
- s, ok := FromError(nil)
- if !ok || s.Code() != code || s.Message() != message || s.Err() != nil {
- t.Fatalf("FromError(nil) = %v, %v; want <Code()=%s, Message()=%q, Err=nil>, true", s, ok, code, message)
- }
-}
-
-type customError struct {
- Code codes.Code
- Message string
- Details []*apb.Any
-}
-
-func (c customError) Error() string {
- return fmt.Sprintf("rpc error: code = %s desc = %s", c.Code, c.Message)
-}
-
-func (c customError) GRPCStatus() *Status {
- return &Status{
- s: &spb.Status{
- Code: int32(c.Code),
- Message: c.Message,
- Details: c.Details,
- },
- }
-}
-
-func TestFromErrorImplementsInterface(t *testing.T) {
- code, message := codes.Internal, "test description"
- details := []*apb.Any{{
- TypeUrl: "testUrl",
- Value: []byte("testValue"),
- }}
- err := customError{
- Code: code,
- Message: message,
- Details: details,
- }
- s, ok := FromError(err)
- if !ok || s.Code() != code || s.Message() != message || s.Err() == nil {
- t.Fatalf("FromError(%v) = %v, %v; want <Code()=%s, Message()=%q, Err()!=nil>, true", err, s, ok, code, message)
- }
- pd := s.Proto().GetDetails()
- if len(pd) != 1 || !reflect.DeepEqual(pd[0], details[0]) {
- t.Fatalf("s.Proto.GetDetails() = %v; want <Details()=%s>", pd, details)
- }
-}
-
-func TestFromErrorUnknownError(t *testing.T) {
- code, message := codes.Unknown, "unknown error"
- err := errors.New("unknown error")
- s, ok := FromError(err)
- if ok || s.Code() != code || s.Message() != message {
- t.Fatalf("FromError(%v) = %v, %v; want <Code()=%s, Message()=%q>, false", err, s, ok, code, message)
- }
-}
-
-func TestConvertKnownError(t *testing.T) {
- code, message := codes.Internal, "test description"
- err := Error(code, message)
- s := Convert(err)
- if s.Code() != code || s.Message() != message {
- t.Fatalf("Convert(%v) = %v; want <Code()=%s, Message()=%q>", err, s, code, message)
- }
-}
-
-func TestConvertUnknownError(t *testing.T) {
- code, message := codes.Unknown, "unknown error"
- err := errors.New("unknown error")
- s := Convert(err)
- if s.Code() != code || s.Message() != message {
- t.Fatalf("Convert(%v) = %v; want <Code()=%s, Message()=%q>", err, s, code, message)
- }
-}
-
-func TestStatus_ErrorDetails(t *testing.T) {
- tests := []struct {
- code codes.Code
- details []proto.Message
- }{
- {
- code: codes.NotFound,
- details: nil,
- },
- {
- code: codes.NotFound,
- details: []proto.Message{
- &epb.ResourceInfo{
- ResourceType: "book",
- ResourceName: "projects/1234/books/5678",
- Owner: "User",
- },
- },
- },
- {
- code: codes.Internal,
- details: []proto.Message{
- &epb.DebugInfo{
- StackEntries: []string{
- "first stack",
- "second stack",
- },
- },
- },
- },
- {
- code: codes.Unavailable,
- details: []proto.Message{
- &epb.RetryInfo{
- RetryDelay: &dpb.Duration{Seconds: 60},
- },
- &epb.ResourceInfo{
- ResourceType: "book",
- ResourceName: "projects/1234/books/5678",
- Owner: "User",
- },
- },
- },
- }
-
- for _, tc := range tests {
- s, err := New(tc.code, "").WithDetails(tc.details...)
- if err != nil {
- t.Fatalf("(%v).WithDetails(%+v) failed: %v", str(s), tc.details, err)
- }
- details := s.Details()
- for i := range details {
- if !proto.Equal(details[i].(proto.Message), tc.details[i]) {
- t.Fatalf("(%v).Details()[%d] = %+v, want %+v", str(s), i, details[i], tc.details[i])
- }
- }
- }
-}
-
-func TestStatus_WithDetails_Fail(t *testing.T) {
- tests := []*Status{
- nil,
- FromProto(nil),
- New(codes.OK, ""),
- }
- for _, s := range tests {
- if s, err := s.WithDetails(); err == nil || s != nil {
- t.Fatalf("(%v).WithDetails(%+v) = %v, %v; want nil, non-nil", str(s), []proto.Message{}, s, err)
- }
- }
-}
-
-func TestStatus_ErrorDetails_Fail(t *testing.T) {
- tests := []struct {
- s *Status
- i []interface{}
- }{
- {
- nil,
- nil,
- },
- {
- FromProto(nil),
- nil,
- },
- {
- New(codes.OK, ""),
- []interface{}{},
- },
- {
- FromProto(&spb.Status{
- Code: int32(cpb.Code_CANCELLED),
- Details: []*apb.Any{
- {
- TypeUrl: "",
- Value: []byte{},
- },
- mustMarshalAny(&epb.ResourceInfo{
- ResourceType: "book",
- ResourceName: "projects/1234/books/5678",
- Owner: "User",
- }),
- },
- }),
- []interface{}{
- errors.New(`message type url "" is invalid`),
- &epb.ResourceInfo{
- ResourceType: "book",
- ResourceName: "projects/1234/books/5678",
- Owner: "User",
- },
- },
- },
- }
- for _, tc := range tests {
- got := tc.s.Details()
- if !reflect.DeepEqual(got, tc.i) {
- t.Errorf("(%v).Details() = %+v, want %+v", str(tc.s), got, tc.i)
- }
- }
-}
-
-func str(s *Status) string {
- if s == nil {
- return "nil"
- }
- if s.s == nil {
- return "<Code=OK>"
- }
- return fmt.Sprintf("<Code=%v, Message=%q, Details=%+v>", codes.Code(s.s.GetCode()), s.s.GetMessage(), s.s.GetDetails())
-}
-
-// mustMarshalAny converts a protobuf message to an any.
-func mustMarshalAny(msg proto.Message) *apb.Any {
- any, err := ptypes.MarshalAny(msg)
- if err != nil {
- panic(fmt.Sprintf("ptypes.MarshalAny(%+v) failed: %v", msg, err))
- }
- return any
-}
-
-func TestFromContextError(t *testing.T) {
- testCases := []struct {
- in error
- want *Status
- }{
- {in: nil, want: New(codes.OK, "")},
- {in: context.DeadlineExceeded, want: New(codes.DeadlineExceeded, context.DeadlineExceeded.Error())},
- {in: context.Canceled, want: New(codes.Canceled, context.Canceled.Error())},
- {in: errors.New("other"), want: New(codes.Unknown, "other")},
- }
- for _, tc := range testCases {
- got := FromContextError(tc.in)
- if got.Code() != tc.want.Code() || got.Message() != tc.want.Message() {
- t.Errorf("FromContextError(%v) = %v; want %v", tc.in, got, tc.want)
- }
- }
-}
diff --git a/vendor/google.golang.org/grpc/stickiness_linkedmap_test.go b/vendor/google.golang.org/grpc/stickiness_linkedmap_test.go
deleted file mode 100644
index e2d763555..000000000
--- a/vendor/google.golang.org/grpc/stickiness_linkedmap_test.go
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- *
- * Copyright 2018 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package grpc
-
-import (
- "container/list"
- "fmt"
- "reflect"
- "testing"
-)
-
-var linkedMapTestData = make([]*stickyStoreEntry, 5)
-
-func TestLinkedMapPutGet(t *testing.T) {
- m := newLinkedMap()
- m.put("one", linkedMapTestData[0])
- if got, ok := m.get("one"); !ok || got != linkedMapTestData[0] {
- t.Errorf("m.Get(%v) = %v, %v, want %v, true", 1, got, ok, "one")
- }
- m.put("two", linkedMapTestData[1])
- if got, ok := m.get("two"); !ok || got != linkedMapTestData[1] {
- t.Errorf("m.Get(%v) = %v, %v, want %v, true", 2, got, ok, "two")
- }
- m.put("oneone", linkedMapTestData[4])
- if got, ok := m.get("one"); !ok || got != linkedMapTestData[4] {
- t.Errorf("m.Get(%v) = %v, %v, want %v, true", 1, got, ok, "oneone")
- }
-}
-
-func TestLinkedMapRemove(t *testing.T) {
- m := newLinkedMap()
- m.put("one", linkedMapTestData[0])
- if got, ok := m.get("one"); !ok || got != linkedMapTestData[0] {
- t.Errorf("m.Get(%v) = %v, %v, want %v, true", 1, got, ok, "one")
- }
- m.put("two", linkedMapTestData[1])
- if got, ok := m.get("two"); !ok || got != linkedMapTestData[1] {
- t.Errorf("m.Get(%v) = %v, %v, want %v, true", 2, got, ok, "two")
- }
-
- if got, ok := m.remove("one"); !ok || got != linkedMapTestData[0] {
- t.Errorf("m.Remove(%v) = %v, %v, want %v, true", 1, got, ok, "one")
- }
- if got, ok := m.get("one"); ok {
- t.Errorf("m.Get(%v) = %v, %v, want _, false", 1, got, ok)
- }
- // 2 should still in the map.
- if got, ok := m.get("two"); !ok || got != linkedMapTestData[1] {
- t.Errorf("m.Get(%v) = %v, %v, want %v, true", 2, got, ok, "two")
- }
-}
-
-func TestLinkedMapLen(t *testing.T) {
- m := newLinkedMap()
- if got := m.len(); got != 0 {
- t.Errorf("m.Len() = %v, want %v", got, 0)
- }
- m.put("one", linkedMapTestData[0])
- if got := m.len(); got != 1 {
- t.Errorf("m.Len() = %v, want %v", got, 1)
- }
- m.put("two", linkedMapTestData[1])
- if got := m.len(); got != 2 {
- t.Errorf("m.Len() = %v, want %v", got, 2)
- }
- m.put("one", linkedMapTestData[4])
- if got := m.len(); got != 2 {
- t.Errorf("m.Len() = %v, want %v", got, 2)
- }
-
- // Internal checks.
- if got := len(m.m); got != 2 {
- t.Errorf("len(m.m) = %v, want %v", got, 2)
- }
- if got := m.l.Len(); got != 2 {
- t.Errorf("m.l.Len() = %v, want %v", got, 2)
- }
-}
-
-func TestLinkedMapClear(t *testing.T) {
- m := newLinkedMap()
- m.put("one", linkedMapTestData[0])
- if got, ok := m.get("one"); !ok || got != linkedMapTestData[0] {
- t.Errorf("m.Get(%v) = %v, %v, want %v, true", 1, got, ok, "one")
- }
- m.put("two", linkedMapTestData[1])
- if got, ok := m.get("two"); !ok || got != linkedMapTestData[1] {
- t.Errorf("m.Get(%v) = %v, %v, want %v, true", 2, got, ok, "two")
- }
-
- m.clear()
- if got, ok := m.get("one"); ok {
- t.Errorf("m.Get(%v) = %v, %v, want _, false", 1, got, ok)
- }
- if got, ok := m.get("two"); ok {
- t.Errorf("m.Get(%v) = %v, %v, want _, false", 2, got, ok)
- }
- if got := m.len(); got != 0 {
- t.Errorf("m.Len() = %v, want %v", got, 0)
- }
-}
-
-func TestLinkedMapRemoveOldest(t *testing.T) {
- m := newLinkedMap()
- m.put("one", linkedMapTestData[0])
- m.put("two", linkedMapTestData[1])
- m.put("three", linkedMapTestData[2])
- m.put("four", linkedMapTestData[3])
- if got, ok := m.get("one"); !ok || got != linkedMapTestData[0] {
- t.Errorf("m.Get(%v) = %v, %v, want %v, true", 1, got, ok, "one")
- }
- if got, ok := m.get("two"); !ok || got != linkedMapTestData[1] {
- t.Errorf("m.Get(%v) = %v, %v, want %v, true", 2, got, ok, "two")
- }
- if got, ok := m.get("three"); !ok || got != linkedMapTestData[2] {
- t.Errorf("m.Get(%v) = %v, %v, want %v, true", 3, got, ok, "three")
- }
- if got, ok := m.get("four"); !ok || got != linkedMapTestData[3] {
- t.Errorf("m.Get(%v) = %v, %v, want %v, true", 4, got, ok, "four")
- }
-
- if err := checkListOrdered(m.l, []string{"one", "two", "three", "four"}); err != nil {
- t.Fatalf("m.l is not expected: %v", err)
- }
-
- m.put("three", linkedMapTestData[2])
- if err := checkListOrdered(m.l, []string{"one", "two", "four", "three"}); err != nil {
- t.Fatalf("m.l is not expected: %v", err)
- }
- m.put("four", linkedMapTestData[3])
- if err := checkListOrdered(m.l, []string{"one", "two", "three", "four"}); err != nil {
- t.Fatalf("m.l is not expected: %v", err)
- }
-
- m.removeOldest()
- if got, ok := m.get("one"); ok {
- t.Errorf("m.Get(%v) = %v, %v, want _, false", 1, got, ok)
- }
- if err := checkListOrdered(m.l, []string{"two", "three", "four"}); err != nil {
- t.Fatalf("m.l is not expected: %v", err)
- }
-
- m.get("two") // 2 is refreshed, 3 becomes the oldest
- if err := checkListOrdered(m.l, []string{"three", "four", "two"}); err != nil {
- t.Fatalf("m.l is not expected: %v", err)
- }
-
- m.removeOldest()
- if got, ok := m.get("three"); ok {
- t.Errorf("m.Get(%v) = %v, %v, want _, false", 3, got, ok)
- }
- // 2 and 4 are still in map.
- if got, ok := m.get("two"); !ok || got != linkedMapTestData[1] {
- t.Errorf("m.Get(%v) = %v, %v, want %v, true", 2, got, ok, "two")
- }
- if got, ok := m.get("four"); !ok || got != linkedMapTestData[3] {
- t.Errorf("m.Get(%v) = %v, %v, want %v, true", 4, got, ok, "four")
- }
-}
-
-func checkListOrdered(l *list.List, want []string) error {
- got := make([]string, 0, len(want))
- for p := l.Front(); p != nil; p = p.Next() {
- got = append(got, p.Value.(*linkedMapKVPair).key)
- }
- if !reflect.DeepEqual(got, want) {
- return fmt.Errorf("list elements: %v, want %v", got, want)
- }
- return nil
-}
diff --git a/vendor/google.golang.org/grpc/stickiness_test.go b/vendor/google.golang.org/grpc/stickiness_test.go
deleted file mode 100644
index f625d680b..000000000
--- a/vendor/google.golang.org/grpc/stickiness_test.go
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- *
- * Copyright 2018 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package grpc
-
-import (
- "fmt"
- "math"
- "strings"
- "testing"
- "time"
-
- "golang.org/x/net/context"
- "google.golang.org/grpc/balancer/roundrobin"
- "google.golang.org/grpc/internal/leakcheck"
- "google.golang.org/grpc/metadata"
- "google.golang.org/grpc/resolver"
- "google.golang.org/grpc/resolver/manual"
-)
-
-func TestStickyKeyFromContext(t *testing.T) {
- for _, test := range []struct {
- org, add []string
- mdKey string
- wantStr string
- wantBool bool
- }{
- {[]string{}, []string{}, "", "", false},
- {[]string{"k1", "v1"}, []string{"k2", "v2"}, "k", "", false},
-
- {[]string{"k", "v"}, []string{}, "k", "v", true},
- {[]string{}, []string{"k", "v"}, "k", "v", true},
- {[]string{"k1", "v1"}, []string{"k2", "v2"}, "k1", "v1", true},
- {[]string{"k1", "v1"}, []string{"k2", "v2"}, "k2", "v2", true},
- } {
- ctx := context.Background()
- if len(test.org) > 0 {
- ctx = metadata.NewOutgoingContext(ctx, metadata.Pairs(test.org...))
- }
- if len(test.add) > 0 {
- ctx = metadata.AppendToOutgoingContext(ctx, test.add...)
- }
- got, ok := stickyKeyFromContext(ctx, test.mdKey)
- if got != test.wantStr || ok != test.wantBool {
- t.Errorf("test: %+v, got: %q, %v, want: %q, %v\n", test, got, ok, test.wantStr, test.wantBool)
- }
- }
-}
-
-func TestStickinessServiceConfig(t *testing.T) {
- envConfigStickinessOn = true
- defer func() { envConfigStickinessOn = false }()
- defer leakcheck.Check(t)
- r, rcleanup := manual.GenerateAndRegisterManualResolver()
- defer rcleanup()
-
- cc, err := Dial(r.Scheme()+":///test.server", WithInsecure())
- if err != nil {
- t.Fatalf("failed to dial: %v", err)
- }
- defer cc.Close()
-
- const testInput = "testStickinessKey"
- wantStr := strings.ToLower(testInput)
-
- r.NewServiceConfig(fmt.Sprintf(`{"stickinessMetadataKey": "%v"}`, testInput)) // ToLower() will be applied to the input.
-
- for i := 0; i < 1000; i++ {
- if key := cc.blockingpicker.getStickinessMDKey(); key == wantStr {
- return
- }
- time.Sleep(time.Millisecond)
- }
- t.Fatalf("cc.blockingpicker.stickiness.stickinessMDKey failed to change to %v within one second", wantStr)
-}
-
-func TestStickinessEnd2end(t *testing.T) {
- envConfigStickinessOn = true
- defer func() { envConfigStickinessOn = false }()
- defer leakcheck.Check(t)
- r, rcleanup := manual.GenerateAndRegisterManualResolver()
- defer rcleanup()
-
- numServers := 2
- servers, _, scleanup := startServers(t, numServers, math.MaxInt32)
- defer scleanup()
-
- cc, err := Dial(r.Scheme()+":///test.server",
- WithInsecure(), WithCodec(testCodec{}), WithBalancerName(roundrobin.Name))
- if err != nil {
- t.Fatalf("failed to dial: %v", err)
- }
- defer cc.Close()
- req := "port"
- var reply string
- r.NewAddress([]resolver.Address{{Addr: servers[0].addr}, {Addr: servers[1].addr}})
-
- var (
- i int
- picked []int
- )
-
- // Check that each backend will be picked for at least 3 times.
- picked = make([]int, 2, 2)
- for i = 0; i < 1000; i++ {
- if err = Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err != nil {
- if errorDesc(err) == servers[0].port {
- picked[0]++
- } else if errorDesc(err) == servers[1].port {
- picked[1]++
- }
- }
- if picked[0] >= 3 && picked[1] >= 3 {
- break
- }
- time.Sleep(time.Millisecond)
- }
- if i >= 1000 {
- t.Fatalf("When doing roundrobin, addr1 was picked %v times, addr2 was picked %v times", picked[0], picked[1])
- }
-
- r.NewServiceConfig(fmt.Sprintf(`{"stickinessMetadataKey": "sessionid"}`))
-
- // Should still be roundrobin.
- picked = make([]int, 2, 2)
- for i = 0; i < 1000; i++ {
- if err = Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err != nil {
- if errorDesc(err) == servers[0].port {
- picked[0]++
- } else if errorDesc(err) == servers[1].port {
- picked[1]++
- }
- }
- if picked[0] >= 3 && picked[1] >= 3 {
- break
- }
- time.Sleep(time.Millisecond)
- }
- if i >= 1000 {
- t.Fatalf("When doing roundrobin, addr1 was picked %v times, addr2 was picked %v times", picked[0], picked[1])
- }
-
- // Do sticky call, only one backend will be picked.
- picked = make([]int, 2, 2)
- for i = 0; i < 100; i++ {
- ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs("sessionid", "1"))
- if err = Invoke(ctx, "/foo/bar", &req, &reply, cc); err != nil {
- if errorDesc(err) == servers[0].port {
- picked[0]++
- } else if errorDesc(err) == servers[1].port {
- picked[1]++
- }
- }
- time.Sleep(time.Millisecond)
- }
-
- if (picked[0] != 0) == (picked[1] != 0) {
- t.Fatalf("When doing sticky RPC, addr1 was picked %v times, addr2 was picked %v times, want at least one of them to be 0", picked[0], picked[1])
- }
-
-}
-
-// Changing stickinessMDKey in service config will clear the sticky map.
-func TestStickinessChangeMDKey(t *testing.T) {
- envConfigStickinessOn = true
- defer func() { envConfigStickinessOn = false }()
- defer leakcheck.Check(t)
- r, rcleanup := manual.GenerateAndRegisterManualResolver()
- defer rcleanup()
-
- numServers := 2
- servers, _, scleanup := startServers(t, numServers, math.MaxInt32)
- defer scleanup()
-
- cc, err := Dial(r.Scheme()+":///test.server", WithInsecure(), WithCodec(testCodec{}))
- if err != nil {
- t.Fatalf("failed to dial: %v", err)
- }
- defer cc.Close()
- req := "port"
- var reply string
- r.NewAddress([]resolver.Address{{Addr: servers[0].addr}, {Addr: servers[1].addr}})
-
- r.NewServiceConfig(fmt.Sprintf(`{"stickinessMetadataKey": "sessionid"}`))
-
- // Do sticky call, only one backend will be picked, and there will be one
- // entry in stickiness map.
- for i := 0; i < 100; i++ {
- ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs("sessionid", "1"))
- Invoke(ctx, "/foo/bar", &req, &reply, cc)
- time.Sleep(time.Millisecond)
- }
-
- cc.blockingpicker.stickiness.mu.Lock()
- mapLen := cc.blockingpicker.stickiness.store.len()
- cc.blockingpicker.stickiness.mu.Unlock()
- if mapLen != 1 {
- t.Fatalf("length of stickiness map is %v, want 1", mapLen)
- }
-
- r.NewServiceConfig(fmt.Sprintf(`{"stickinessMetadataKey": "sessionidnew"}`))
-
- var i int
- for i = 0; i < 1000; i++ {
- cc.blockingpicker.stickiness.mu.Lock()
- mapLen = cc.blockingpicker.stickiness.store.len()
- cc.blockingpicker.stickiness.mu.Unlock()
- if mapLen == 0 {
- break
- }
- time.Sleep(time.Millisecond)
- }
- if i >= 1000 {
- t.Fatalf("After 1 second, length of stickiness map is %v, want 0", mapLen)
- }
-}
-
-// Switching balancer will clear the sticky map.
-func TestStickinessSwitchingBalancer(t *testing.T) {
- envConfigStickinessOn = true
- defer func() { envConfigStickinessOn = false }()
- defer leakcheck.Check(t)
- r, rcleanup := manual.GenerateAndRegisterManualResolver()
- defer rcleanup()
-
- numServers := 2
- servers, _, scleanup := startServers(t, numServers, math.MaxInt32)
- defer scleanup()
-
- cc, err := Dial(r.Scheme()+":///test.server", WithInsecure(), WithCodec(testCodec{}))
- if err != nil {
- t.Fatalf("failed to dial: %v", err)
- }
- defer cc.Close()
- req := "port"
- var reply string
- r.NewAddress([]resolver.Address{{Addr: servers[0].addr}, {Addr: servers[1].addr}})
-
- r.NewServiceConfig(fmt.Sprintf(`{"stickinessMetadataKey": "sessionid"}`))
-
- // Do sticky call, only one backend will be picked, and there will be one
- // entry in stickiness map.
- for i := 0; i < 100; i++ {
- ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs("sessionid", "1"))
- Invoke(ctx, "/foo/bar", &req, &reply, cc)
- time.Sleep(time.Millisecond)
- }
-
- cc.blockingpicker.stickiness.mu.Lock()
- mapLen := cc.blockingpicker.stickiness.store.len()
- cc.blockingpicker.stickiness.mu.Unlock()
- if mapLen != 1 {
- t.Fatalf("length of stickiness map is %v, want 1", mapLen)
- }
-
- cc.mu.Lock()
- cc.switchBalancer("round_robin")
- cc.mu.Unlock()
-
- var i int
- for i = 0; i < 1000; i++ {
- cc.blockingpicker.stickiness.mu.Lock()
- mapLen = cc.blockingpicker.stickiness.store.len()
- cc.blockingpicker.stickiness.mu.Unlock()
- if mapLen == 0 {
- break
- }
- time.Sleep(time.Millisecond)
- }
- if i >= 1000 {
- t.Fatalf("After 1 second, length of stickiness map is %v, want 0", mapLen)
- }
-}
diff --git a/vendor/google.golang.org/grpc/transport/handler_server_test.go b/vendor/google.golang.org/grpc/transport/handler_server_test.go
deleted file mode 100644
index 3261b8e3d..000000000
--- a/vendor/google.golang.org/grpc/transport/handler_server_test.go
+++ /dev/null
@@ -1,482 +0,0 @@
-/*
- *
- * Copyright 2016 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package transport
-
-import (
- "errors"
- "fmt"
- "io"
- "net/http"
- "net/http/httptest"
- "net/url"
- "reflect"
- "sync"
- "testing"
- "time"
-
- "github.com/golang/protobuf/proto"
- dpb "github.com/golang/protobuf/ptypes/duration"
- "golang.org/x/net/context"
- epb "google.golang.org/genproto/googleapis/rpc/errdetails"
- "google.golang.org/grpc/codes"
- "google.golang.org/grpc/metadata"
- "google.golang.org/grpc/status"
-)
-
-func TestHandlerTransport_NewServerHandlerTransport(t *testing.T) {
- type testCase struct {
- name string
- req *http.Request
- wantErr string
- modrw func(http.ResponseWriter) http.ResponseWriter
- check func(*serverHandlerTransport, *testCase) error
- }
- tests := []testCase{
- {
- name: "http/1.1",
- req: &http.Request{
- ProtoMajor: 1,
- ProtoMinor: 1,
- },
- wantErr: "gRPC requires HTTP/2",
- },
- {
- name: "bad method",
- req: &http.Request{
- ProtoMajor: 2,
- Method: "GET",
- Header: http.Header{},
- RequestURI: "/",
- },
- wantErr: "invalid gRPC request method",
- },
- {
- name: "bad content type",
- req: &http.Request{
- ProtoMajor: 2,
- Method: "POST",
- Header: http.Header{
- "Content-Type": {"application/foo"},
- },
- RequestURI: "/service/foo.bar",
- },
- wantErr: "invalid gRPC request content-type",
- },
- {
- name: "not flusher",
- req: &http.Request{
- ProtoMajor: 2,
- Method: "POST",
- Header: http.Header{
- "Content-Type": {"application/grpc"},
- },
- RequestURI: "/service/foo.bar",
- },
- modrw: func(w http.ResponseWriter) http.ResponseWriter {
- // Return w without its Flush method
- type onlyCloseNotifier interface {
- http.ResponseWriter
- http.CloseNotifier
- }
- return struct{ onlyCloseNotifier }{w.(onlyCloseNotifier)}
- },
- wantErr: "gRPC requires a ResponseWriter supporting http.Flusher",
- },
- {
- name: "not closenotifier",
- req: &http.Request{
- ProtoMajor: 2,
- Method: "POST",
- Header: http.Header{
- "Content-Type": {"application/grpc"},
- },
- RequestURI: "/service/foo.bar",
- },
- modrw: func(w http.ResponseWriter) http.ResponseWriter {
- // Return w without its CloseNotify method
- type onlyFlusher interface {
- http.ResponseWriter
- http.Flusher
- }
- return struct{ onlyFlusher }{w.(onlyFlusher)}
- },
- wantErr: "gRPC requires a ResponseWriter supporting http.CloseNotifier",
- },
- {
- name: "valid",
- req: &http.Request{
- ProtoMajor: 2,
- Method: "POST",
- Header: http.Header{
- "Content-Type": {"application/grpc"},
- },
- URL: &url.URL{
- Path: "/service/foo.bar",
- },
- RequestURI: "/service/foo.bar",
- },
- check: func(t *serverHandlerTransport, tt *testCase) error {
- if t.req != tt.req {
- return fmt.Errorf("t.req = %p; want %p", t.req, tt.req)
- }
- if t.rw == nil {
- return errors.New("t.rw = nil; want non-nil")
- }
- return nil
- },
- },
- {
- name: "with timeout",
- req: &http.Request{
- ProtoMajor: 2,
- Method: "POST",
- Header: http.Header{
- "Content-Type": []string{"application/grpc"},
- "Grpc-Timeout": {"200m"},
- },
- URL: &url.URL{
- Path: "/service/foo.bar",
- },
- RequestURI: "/service/foo.bar",
- },
- check: func(t *serverHandlerTransport, tt *testCase) error {
- if !t.timeoutSet {
- return errors.New("timeout not set")
- }
- if want := 200 * time.Millisecond; t.timeout != want {
- return fmt.Errorf("timeout = %v; want %v", t.timeout, want)
- }
- return nil
- },
- },
- {
- name: "with bad timeout",
- req: &http.Request{
- ProtoMajor: 2,
- Method: "POST",
- Header: http.Header{
- "Content-Type": []string{"application/grpc"},
- "Grpc-Timeout": {"tomorrow"},
- },
- URL: &url.URL{
- Path: "/service/foo.bar",
- },
- RequestURI: "/service/foo.bar",
- },
- wantErr: `stream error: code = Internal desc = "malformed time-out: transport: timeout unit is not recognized: \"tomorrow\""`,
- },
- {
- name: "with metadata",
- req: &http.Request{
- ProtoMajor: 2,
- Method: "POST",
- Header: http.Header{
- "Content-Type": []string{"application/grpc"},
- "meta-foo": {"foo-val"},
- "meta-bar": {"bar-val1", "bar-val2"},
- "user-agent": {"x/y a/b"},
- },
- URL: &url.URL{
- Path: "/service/foo.bar",
- },
- RequestURI: "/service/foo.bar",
- },
- check: func(ht *serverHandlerTransport, tt *testCase) error {
- want := metadata.MD{
- "meta-bar": {"bar-val1", "bar-val2"},
- "user-agent": {"x/y a/b"},
- "meta-foo": {"foo-val"},
- "content-type": {"application/grpc"},
- }
-
- if !reflect.DeepEqual(ht.headerMD, want) {
- return fmt.Errorf("metdata = %#v; want %#v", ht.headerMD, want)
- }
- return nil
- },
- },
- }
-
- for _, tt := range tests {
- rw := newTestHandlerResponseWriter()
- if tt.modrw != nil {
- rw = tt.modrw(rw)
- }
- got, gotErr := NewServerHandlerTransport(rw, tt.req, nil)
- if (gotErr != nil) != (tt.wantErr != "") || (gotErr != nil && gotErr.Error() != tt.wantErr) {
- t.Errorf("%s: error = %v; want %q", tt.name, gotErr, tt.wantErr)
- continue
- }
- if gotErr != nil {
- continue
- }
- if tt.check != nil {
- if err := tt.check(got.(*serverHandlerTransport), &tt); err != nil {
- t.Errorf("%s: %v", tt.name, err)
- }
- }
- }
-}
-
-type testHandlerResponseWriter struct {
- *httptest.ResponseRecorder
- closeNotify chan bool
-}
-
-func (w testHandlerResponseWriter) CloseNotify() <-chan bool { return w.closeNotify }
-func (w testHandlerResponseWriter) Flush() {}
-
-func newTestHandlerResponseWriter() http.ResponseWriter {
- return testHandlerResponseWriter{
- ResponseRecorder: httptest.NewRecorder(),
- closeNotify: make(chan bool, 1),
- }
-}
-
-type handleStreamTest struct {
- t *testing.T
- bodyw *io.PipeWriter
- req *http.Request
- rw testHandlerResponseWriter
- ht *serverHandlerTransport
-}
-
-func newHandleStreamTest(t *testing.T) *handleStreamTest {
- bodyr, bodyw := io.Pipe()
- req := &http.Request{
- ProtoMajor: 2,
- Method: "POST",
- Header: http.Header{
- "Content-Type": {"application/grpc"},
- },
- URL: &url.URL{
- Path: "/service/foo.bar",
- },
- RequestURI: "/service/foo.bar",
- Body: bodyr,
- }
- rw := newTestHandlerResponseWriter().(testHandlerResponseWriter)
- ht, err := NewServerHandlerTransport(rw, req, nil)
- if err != nil {
- t.Fatal(err)
- }
- return &handleStreamTest{
- t: t,
- bodyw: bodyw,
- ht: ht.(*serverHandlerTransport),
- rw: rw,
- }
-}
-
-func TestHandlerTransport_HandleStreams(t *testing.T) {
- st := newHandleStreamTest(t)
- handleStream := func(s *Stream) {
- if want := "/service/foo.bar"; s.method != want {
- t.Errorf("stream method = %q; want %q", s.method, want)
- }
- st.bodyw.Close() // no body
- st.ht.WriteStatus(s, status.New(codes.OK, ""))
- }
- st.ht.HandleStreams(
- func(s *Stream) { go handleStream(s) },
- func(ctx context.Context, method string) context.Context { return ctx },
- )
- wantHeader := http.Header{
- "Date": nil,
- "Content-Type": {"application/grpc"},
- "Trailer": {"Grpc-Status", "Grpc-Message", "Grpc-Status-Details-Bin"},
- "Grpc-Status": {"0"},
- }
- if !reflect.DeepEqual(st.rw.HeaderMap, wantHeader) {
- t.Errorf("Header+Trailer Map: %#v; want %#v", st.rw.HeaderMap, wantHeader)
- }
-}
-
-// Tests that codes.Unimplemented will close the body, per comment in handler_server.go.
-func TestHandlerTransport_HandleStreams_Unimplemented(t *testing.T) {
- handleStreamCloseBodyTest(t, codes.Unimplemented, "thingy is unimplemented")
-}
-
-// Tests that codes.InvalidArgument will close the body, per comment in handler_server.go.
-func TestHandlerTransport_HandleStreams_InvalidArgument(t *testing.T) {
- handleStreamCloseBodyTest(t, codes.InvalidArgument, "bad arg")
-}
-
-func handleStreamCloseBodyTest(t *testing.T, statusCode codes.Code, msg string) {
- st := newHandleStreamTest(t)
-
- handleStream := func(s *Stream) {
- st.ht.WriteStatus(s, status.New(statusCode, msg))
- }
- st.ht.HandleStreams(
- func(s *Stream) { go handleStream(s) },
- func(ctx context.Context, method string) context.Context { return ctx },
- )
- wantHeader := http.Header{
- "Date": nil,
- "Content-Type": {"application/grpc"},
- "Trailer": {"Grpc-Status", "Grpc-Message", "Grpc-Status-Details-Bin"},
- "Grpc-Status": {fmt.Sprint(uint32(statusCode))},
- "Grpc-Message": {encodeGrpcMessage(msg)},
- }
-
- if !reflect.DeepEqual(st.rw.HeaderMap, wantHeader) {
- t.Errorf("Header+Trailer mismatch.\n got: %#v\nwant: %#v", st.rw.HeaderMap, wantHeader)
- }
-}
-
-func TestHandlerTransport_HandleStreams_Timeout(t *testing.T) {
- bodyr, bodyw := io.Pipe()
- req := &http.Request{
- ProtoMajor: 2,
- Method: "POST",
- Header: http.Header{
- "Content-Type": {"application/grpc"},
- "Grpc-Timeout": {"200m"},
- },
- URL: &url.URL{
- Path: "/service/foo.bar",
- },
- RequestURI: "/service/foo.bar",
- Body: bodyr,
- }
- rw := newTestHandlerResponseWriter().(testHandlerResponseWriter)
- ht, err := NewServerHandlerTransport(rw, req, nil)
- if err != nil {
- t.Fatal(err)
- }
- runStream := func(s *Stream) {
- defer bodyw.Close()
- select {
- case <-s.ctx.Done():
- case <-time.After(5 * time.Second):
- t.Errorf("timeout waiting for ctx.Done")
- return
- }
- err := s.ctx.Err()
- if err != context.DeadlineExceeded {
- t.Errorf("ctx.Err = %v; want %v", err, context.DeadlineExceeded)
- return
- }
- ht.WriteStatus(s, status.New(codes.DeadlineExceeded, "too slow"))
- }
- ht.HandleStreams(
- func(s *Stream) { go runStream(s) },
- func(ctx context.Context, method string) context.Context { return ctx },
- )
- wantHeader := http.Header{
- "Date": nil,
- "Content-Type": {"application/grpc"},
- "Trailer": {"Grpc-Status", "Grpc-Message", "Grpc-Status-Details-Bin"},
- "Grpc-Status": {"4"},
- "Grpc-Message": {encodeGrpcMessage("too slow")},
- }
- if !reflect.DeepEqual(rw.HeaderMap, wantHeader) {
- t.Errorf("Header+Trailer Map mismatch.\n got: %#v\nwant: %#v", rw.HeaderMap, wantHeader)
- }
-}
-
-// TestHandlerTransport_HandleStreams_MultiWriteStatus ensures that
-// concurrent "WriteStatus"s do not panic writing to closed "writes" channel.
-func TestHandlerTransport_HandleStreams_MultiWriteStatus(t *testing.T) {
- testHandlerTransportHandleStreams(t, func(st *handleStreamTest, s *Stream) {
- if want := "/service/foo.bar"; s.method != want {
- t.Errorf("stream method = %q; want %q", s.method, want)
- }
- st.bodyw.Close() // no body
-
- var wg sync.WaitGroup
- wg.Add(5)
- for i := 0; i < 5; i++ {
- go func() {
- defer wg.Done()
- st.ht.WriteStatus(s, status.New(codes.OK, ""))
- }()
- }
- wg.Wait()
- })
-}
-
-// TestHandlerTransport_HandleStreams_WriteStatusWrite ensures that "Write"
-// following "WriteStatus" does not panic writing to closed "writes" channel.
-func TestHandlerTransport_HandleStreams_WriteStatusWrite(t *testing.T) {
- testHandlerTransportHandleStreams(t, func(st *handleStreamTest, s *Stream) {
- if want := "/service/foo.bar"; s.method != want {
- t.Errorf("stream method = %q; want %q", s.method, want)
- }
- st.bodyw.Close() // no body
-
- st.ht.WriteStatus(s, status.New(codes.OK, ""))
- st.ht.Write(s, []byte("hdr"), []byte("data"), &Options{})
- })
-}
-
-func testHandlerTransportHandleStreams(t *testing.T, handleStream func(st *handleStreamTest, s *Stream)) {
- st := newHandleStreamTest(t)
- st.ht.HandleStreams(
- func(s *Stream) { go handleStream(st, s) },
- func(ctx context.Context, method string) context.Context { return ctx },
- )
-}
-
-func TestHandlerTransport_HandleStreams_ErrDetails(t *testing.T) {
- errDetails := []proto.Message{
- &epb.RetryInfo{
- RetryDelay: &dpb.Duration{Seconds: 60},
- },
- &epb.ResourceInfo{
- ResourceType: "foo bar",
- ResourceName: "service.foo.bar",
- Owner: "User",
- },
- }
-
- statusCode := codes.ResourceExhausted
- msg := "you are being throttled"
- st, err := status.New(statusCode, msg).WithDetails(errDetails...)
- if err != nil {
- t.Fatal(err)
- }
-
- stBytes, err := proto.Marshal(st.Proto())
- if err != nil {
- t.Fatal(err)
- }
-
- hst := newHandleStreamTest(t)
- handleStream := func(s *Stream) {
- hst.ht.WriteStatus(s, st)
- }
- hst.ht.HandleStreams(
- func(s *Stream) { go handleStream(s) },
- func(ctx context.Context, method string) context.Context { return ctx },
- )
- wantHeader := http.Header{
- "Date": nil,
- "Content-Type": {"application/grpc"},
- "Trailer": {"Grpc-Status", "Grpc-Message", "Grpc-Status-Details-Bin"},
- "Grpc-Status": {fmt.Sprint(uint32(statusCode))},
- "Grpc-Message": {encodeGrpcMessage(msg)},
- "Grpc-Status-Details-Bin": {encodeBinHeader(stBytes)},
- }
-
- if !reflect.DeepEqual(hst.rw.HeaderMap, wantHeader) {
- t.Errorf("Header+Trailer mismatch.\n got: %#v\nwant: %#v", hst.rw.HeaderMap, wantHeader)
- }
-}
diff --git a/vendor/google.golang.org/grpc/transport/http_util_test.go b/vendor/google.golang.org/grpc/transport/http_util_test.go
deleted file mode 100644
index 44169b653..000000000
--- a/vendor/google.golang.org/grpc/transport/http_util_test.go
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- *
- * Copyright 2014 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package transport
-
-import (
- "fmt"
- "reflect"
- "testing"
- "time"
-)
-
-func TestTimeoutEncode(t *testing.T) {
- for _, test := range []struct {
- in string
- out string
- }{
- {"12345678ns", "12345678n"},
- {"123456789ns", "123457u"},
- {"12345678us", "12345678u"},
- {"123456789us", "123457m"},
- {"12345678ms", "12345678m"},
- {"123456789ms", "123457S"},
- {"12345678s", "12345678S"},
- {"123456789s", "2057614M"},
- {"12345678m", "12345678M"},
- {"123456789m", "2057614H"},
- } {
- d, err := time.ParseDuration(test.in)
- if err != nil {
- t.Fatalf("failed to parse duration string %s: %v", test.in, err)
- }
- out := encodeTimeout(d)
- if out != test.out {
- t.Fatalf("timeoutEncode(%s) = %s, want %s", test.in, out, test.out)
- }
- }
-}
-
-func TestTimeoutDecode(t *testing.T) {
- for _, test := range []struct {
- // input
- s string
- // output
- d time.Duration
- err error
- }{
- {"1234S", time.Second * 1234, nil},
- {"1234x", 0, fmt.Errorf("transport: timeout unit is not recognized: %q", "1234x")},
- {"1", 0, fmt.Errorf("transport: timeout string is too short: %q", "1")},
- {"", 0, fmt.Errorf("transport: timeout string is too short: %q", "")},
- } {
- d, err := decodeTimeout(test.s)
- if d != test.d || fmt.Sprint(err) != fmt.Sprint(test.err) {
- t.Fatalf("timeoutDecode(%q) = %d, %v, want %d, %v", test.s, int64(d), err, int64(test.d), test.err)
- }
- }
-}
-
-func TestContentSubtype(t *testing.T) {
- tests := []struct {
- contentType string
- want string
- wantValid bool
- }{
- {"application/grpc", "", true},
- {"application/grpc+", "", true},
- {"application/grpc+blah", "blah", true},
- {"application/grpc;", "", true},
- {"application/grpc;blah", "blah", true},
- {"application/grpcd", "", false},
- {"application/grpd", "", false},
- {"application/grp", "", false},
- }
- for _, tt := range tests {
- got, gotValid := contentSubtype(tt.contentType)
- if got != tt.want || gotValid != tt.wantValid {
- t.Errorf("contentSubtype(%q) = (%v, %v); want (%v, %v)", tt.contentType, got, gotValid, tt.want, tt.wantValid)
- }
- }
-}
-
-func TestEncodeGrpcMessage(t *testing.T) {
- for _, tt := range []struct {
- input string
- expected string
- }{
- {"", ""},
- {"Hello", "Hello"},
- {"\u0000", "%00"},
- {"%", "%25"},
- {"系统", "%E7%B3%BB%E7%BB%9F"},
- {string([]byte{0xff, 0xfe, 0xfd}), "%EF%BF%BD%EF%BF%BD%EF%BF%BD"},
- } {
- actual := encodeGrpcMessage(tt.input)
- if tt.expected != actual {
- t.Errorf("encodeGrpcMessage(%q) = %q, want %q", tt.input, actual, tt.expected)
- }
- }
-
- // make sure that all the visible ASCII chars except '%' are not percent encoded.
- for i := ' '; i <= '~' && i != '%'; i++ {
- output := encodeGrpcMessage(string(i))
- if output != string(i) {
- t.Errorf("encodeGrpcMessage(%v) = %v, want %v", string(i), output, string(i))
- }
- }
-
- // make sure that all the invisible ASCII chars and '%' are percent encoded.
- for i := rune(0); i == '%' || (i >= rune(0) && i < ' ') || (i > '~' && i <= rune(127)); i++ {
- output := encodeGrpcMessage(string(i))
- expected := fmt.Sprintf("%%%02X", i)
- if output != expected {
- t.Errorf("encodeGrpcMessage(%v) = %v, want %v", string(i), output, expected)
- }
- }
-}
-
-func TestDecodeGrpcMessage(t *testing.T) {
- for _, tt := range []struct {
- input string
- expected string
- }{
- {"", ""},
- {"Hello", "Hello"},
- {"H%61o", "Hao"},
- {"H%6", "H%6"},
- {"%G0", "%G0"},
- {"%E7%B3%BB%E7%BB%9F", "系统"},
- {"%EF%BF%BD", "�"},
- } {
- actual := decodeGrpcMessage(tt.input)
- if tt.expected != actual {
- t.Errorf("decodeGrpcMessage(%q) = %q, want %q", tt.input, actual, tt.expected)
- }
- }
-
- // make sure that all the visible ASCII chars except '%' are not percent decoded.
- for i := ' '; i <= '~' && i != '%'; i++ {
- output := decodeGrpcMessage(string(i))
- if output != string(i) {
- t.Errorf("decodeGrpcMessage(%v) = %v, want %v", string(i), output, string(i))
- }
- }
-
- // make sure that all the invisible ASCII chars and '%' are percent decoded.
- for i := rune(0); i == '%' || (i >= rune(0) && i < ' ') || (i > '~' && i <= rune(127)); i++ {
- output := decodeGrpcMessage(fmt.Sprintf("%%%02X", i))
- if output != string(i) {
- t.Errorf("decodeGrpcMessage(%v) = %v, want %v", fmt.Sprintf("%%%02X", i), output, string(i))
- }
- }
-}
-
-// Decode an encoded string should get the same thing back, except for invalid
-// utf8 chars.
-func TestDecodeEncodeGrpcMessage(t *testing.T) {
- testCases := []struct {
- orig string
- want string
- }{
- {"", ""},
- {"hello", "hello"},
- {"h%6", "h%6"},
- {"%G0", "%G0"},
- {"系统", "系统"},
- {"Hello, 世界", "Hello, 世界"},
-
- {string([]byte{0xff, 0xfe, 0xfd}), "���"},
- {string([]byte{0xff}) + "Hello" + string([]byte{0xfe}) + "世界" + string([]byte{0xfd}), "�Hello�世界�"},
- }
- for _, tC := range testCases {
- got := decodeGrpcMessage(encodeGrpcMessage(tC.orig))
- if got != tC.want {
- t.Errorf("decodeGrpcMessage(encodeGrpcMessage(%q)) = %q, want %q", tC.orig, got, tC.want)
- }
- }
-}
-
-const binaryValue = string(128)
-
-func TestEncodeMetadataHeader(t *testing.T) {
- for _, test := range []struct {
- // input
- kin string
- vin string
- // output
- vout string
- }{
- {"key", "abc", "abc"},
- {"KEY", "abc", "abc"},
- {"key-bin", "abc", "YWJj"},
- {"key-bin", binaryValue, "woA"},
- } {
- v := encodeMetadataHeader(test.kin, test.vin)
- if !reflect.DeepEqual(v, test.vout) {
- t.Fatalf("encodeMetadataHeader(%q, %q) = %q, want %q", test.kin, test.vin, v, test.vout)
- }
- }
-}
-
-func TestDecodeMetadataHeader(t *testing.T) {
- for _, test := range []struct {
- // input
- kin string
- vin string
- // output
- vout string
- err error
- }{
- {"a", "abc", "abc", nil},
- {"key-bin", "Zm9vAGJhcg==", "foo\x00bar", nil},
- {"key-bin", "Zm9vAGJhcg", "foo\x00bar", nil},
- {"key-bin", "woA=", binaryValue, nil},
- {"a", "abc,efg", "abc,efg", nil},
- } {
- v, err := decodeMetadataHeader(test.kin, test.vin)
- if !reflect.DeepEqual(v, test.vout) || !reflect.DeepEqual(err, test.err) {
- t.Fatalf("decodeMetadataHeader(%q, %q) = %q, %v, want %q, %v", test.kin, test.vin, v, err, test.vout, test.err)
- }
- }
-}
diff --git a/vendor/google.golang.org/grpc/transport/transport_test.go b/vendor/google.golang.org/grpc/transport/transport_test.go
deleted file mode 100644
index b6add205d..000000000
--- a/vendor/google.golang.org/grpc/transport/transport_test.go
+++ /dev/null
@@ -1,2312 +0,0 @@
-/*
- *
- * Copyright 2014 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package transport
-
-import (
- "bufio"
- "bytes"
- "encoding/binary"
- "errors"
- "fmt"
- "io"
- "math"
- "net"
- "net/http"
- "reflect"
- "runtime"
- "strconv"
- "strings"
- "sync"
- "testing"
- "time"
-
- "golang.org/x/net/context"
- "golang.org/x/net/http2"
- "golang.org/x/net/http2/hpack"
- "google.golang.org/grpc/codes"
- "google.golang.org/grpc/internal/leakcheck"
- "google.golang.org/grpc/keepalive"
- "google.golang.org/grpc/status"
-)
-
-type server struct {
- lis net.Listener
- port string
- startedErr chan error // error (or nil) with server start value
- mu sync.Mutex
- conns map[ServerTransport]bool
- h *testStreamHandler
- ready chan struct{}
-}
-
-var (
- expectedRequest = []byte("ping")
- expectedResponse = []byte("pong")
- expectedRequestLarge = make([]byte, initialWindowSize*2)
- expectedResponseLarge = make([]byte, initialWindowSize*2)
- expectedInvalidHeaderField = "invalid/content-type"
-)
-
-type testStreamHandler struct {
- t *http2Server
- notify chan struct{}
- getNotified chan struct{}
-}
-
-type hType int
-
-const (
- normal hType = iota
- suspended
- notifyCall
- misbehaved
- encodingRequiredStatus
- invalidHeaderField
- delayRead
- pingpong
-)
-
-func (h *testStreamHandler) handleStreamAndNotify(s *Stream) {
- if h.notify == nil {
- return
- }
- go func() {
- select {
- case <-h.notify:
- default:
- close(h.notify)
- }
- }()
-}
-
-func (h *testStreamHandler) handleStream(t *testing.T, s *Stream) {
- req := expectedRequest
- resp := expectedResponse
- if s.Method() == "foo.Large" {
- req = expectedRequestLarge
- resp = expectedResponseLarge
- }
- p := make([]byte, len(req))
- _, err := s.Read(p)
- if err != nil {
- return
- }
- if !bytes.Equal(p, req) {
- t.Fatalf("handleStream got %v, want %v", p, req)
- }
- // send a response back to the client.
- h.t.Write(s, nil, resp, &Options{})
- // send the trailer to end the stream.
- h.t.WriteStatus(s, status.New(codes.OK, ""))
-}
-
-func (h *testStreamHandler) handleStreamPingPong(t *testing.T, s *Stream) {
- header := make([]byte, 5)
- for {
- if _, err := s.Read(header); err != nil {
- if err == io.EOF {
- h.t.WriteStatus(s, status.New(codes.OK, ""))
- return
- }
- t.Fatalf("Error on server while reading data header: %v", err)
- }
- sz := binary.BigEndian.Uint32(header[1:])
- msg := make([]byte, int(sz))
- if _, err := s.Read(msg); err != nil {
- t.Fatalf("Error on server while reading message: %v", err)
- }
- buf := make([]byte, sz+5)
- buf[0] = byte(0)
- binary.BigEndian.PutUint32(buf[1:], uint32(sz))
- copy(buf[5:], msg)
- h.t.Write(s, nil, buf, &Options{})
- }
-}
-
-func (h *testStreamHandler) handleStreamMisbehave(t *testing.T, s *Stream) {
- conn, ok := s.ServerTransport().(*http2Server)
- if !ok {
- t.Fatalf("Failed to convert %v to *http2Server", s.ServerTransport())
- }
- var sent int
- p := make([]byte, http2MaxFrameLen)
- for sent < initialWindowSize {
- n := initialWindowSize - sent
- // The last message may be smaller than http2MaxFrameLen
- if n <= http2MaxFrameLen {
- if s.Method() == "foo.Connection" {
- // Violate connection level flow control window of client but do not
- // violate any stream level windows.
- p = make([]byte, n)
- } else {
- // Violate stream level flow control window of client.
- p = make([]byte, n+1)
- }
- }
- conn.controlBuf.put(&dataFrame{
- streamID: s.id,
- h: nil,
- d: p,
- onEachWrite: func() {},
- })
- sent += len(p)
- }
-}
-
-func (h *testStreamHandler) handleStreamEncodingRequiredStatus(t *testing.T, s *Stream) {
- // raw newline is not accepted by http2 framer so it must be encoded.
- h.t.WriteStatus(s, encodingTestStatus)
-}
-
-func (h *testStreamHandler) handleStreamInvalidHeaderField(t *testing.T, s *Stream) {
- headerFields := []hpack.HeaderField{}
- headerFields = append(headerFields, hpack.HeaderField{Name: "content-type", Value: expectedInvalidHeaderField})
- h.t.controlBuf.put(&headerFrame{
- streamID: s.id,
- hf: headerFields,
- endStream: false,
- })
-}
-
-// handleStreamDelayRead delays reads so that the other side has to halt on
-// stream-level flow control.
-// This handler assumes dynamic flow control is turned off and assumes window
-// sizes to be set to defaultWindowSize.
-func (h *testStreamHandler) handleStreamDelayRead(t *testing.T, s *Stream) {
- req := expectedRequest
- resp := expectedResponse
- if s.Method() == "foo.Large" {
- req = expectedRequestLarge
- resp = expectedResponseLarge
- }
- var (
- mu sync.Mutex
- total int
- )
- s.wq.replenish = func(n int) {
- mu.Lock()
- total += n
- mu.Unlock()
- s.wq.realReplenish(n)
- }
- getTotal := func() int {
- mu.Lock()
- defer mu.Unlock()
- return total
- }
- done := make(chan struct{})
- defer close(done)
- go func() {
- for {
- select {
- // Prevent goroutine from leaking.
- case <-done:
- return
- default:
- }
- if getTotal() == defaultWindowSize {
- // Signal the client to start reading and
- // thereby send window update.
- close(h.notify)
- return
- }
- runtime.Gosched()
- }
- }()
- p := make([]byte, len(req))
-
- // Let the other side run out of stream-level window before
- // starting to read and thereby sending a window update.
- timer := time.NewTimer(time.Second * 10)
- select {
- case <-h.getNotified:
- timer.Stop()
- case <-timer.C:
- t.Errorf("Server timed-out.")
- return
- }
- _, err := s.Read(p)
- if err != nil {
- t.Errorf("s.Read(_) = _, %v, want _, <nil>", err)
- return
- }
-
- if !bytes.Equal(p, req) {
- t.Errorf("handleStream got %v, want %v", p, req)
- return
- }
- // This write will cause server to run out of stream level,
- // flow control and the other side won't send a window update
- // until that happens.
- if err := h.t.Write(s, nil, resp, &Options{}); err != nil {
- t.Errorf("server Write got %v, want <nil>", err)
- return
- }
- // Read one more time to ensure that everything remains fine and
- // that the goroutine, that we launched earlier to signal client
- // to read, gets enough time to process.
- _, err = s.Read(p)
- if err != nil {
- t.Errorf("s.Read(_) = _, %v, want _, nil", err)
- return
- }
- // send the trailer to end the stream.
- if err := h.t.WriteStatus(s, status.New(codes.OK, "")); err != nil {
- t.Errorf("server WriteStatus got %v, want <nil>", err)
- return
- }
-}
-
-// start starts server. Other goroutines should block on s.readyChan for further operations.
-func (s *server) start(t *testing.T, port int, serverConfig *ServerConfig, ht hType) {
- var err error
- if port == 0 {
- s.lis, err = net.Listen("tcp", "localhost:0")
- } else {
- s.lis, err = net.Listen("tcp", "localhost:"+strconv.Itoa(port))
- }
- if err != nil {
- s.startedErr <- fmt.Errorf("failed to listen: %v", err)
- return
- }
- _, p, err := net.SplitHostPort(s.lis.Addr().String())
- if err != nil {
- s.startedErr <- fmt.Errorf("failed to parse listener address: %v", err)
- return
- }
- s.port = p
- s.conns = make(map[ServerTransport]bool)
- s.startedErr <- nil
- for {
- conn, err := s.lis.Accept()
- if err != nil {
- return
- }
- transport, err := NewServerTransport("http2", conn, serverConfig)
- if err != nil {
- return
- }
- s.mu.Lock()
- if s.conns == nil {
- s.mu.Unlock()
- transport.Close()
- return
- }
- s.conns[transport] = true
- h := &testStreamHandler{t: transport.(*http2Server)}
- s.h = h
- s.mu.Unlock()
- switch ht {
- case notifyCall:
- go transport.HandleStreams(h.handleStreamAndNotify,
- func(ctx context.Context, _ string) context.Context {
- return ctx
- })
- case suspended:
- go transport.HandleStreams(func(*Stream) {}, // Do nothing to handle the stream.
- func(ctx context.Context, method string) context.Context {
- return ctx
- })
- case misbehaved:
- go transport.HandleStreams(func(s *Stream) {
- go h.handleStreamMisbehave(t, s)
- }, func(ctx context.Context, method string) context.Context {
- return ctx
- })
- case encodingRequiredStatus:
- go transport.HandleStreams(func(s *Stream) {
- go h.handleStreamEncodingRequiredStatus(t, s)
- }, func(ctx context.Context, method string) context.Context {
- return ctx
- })
- case invalidHeaderField:
- go transport.HandleStreams(func(s *Stream) {
- go h.handleStreamInvalidHeaderField(t, s)
- }, func(ctx context.Context, method string) context.Context {
- return ctx
- })
- case delayRead:
- h.notify = make(chan struct{})
- h.getNotified = make(chan struct{})
- s.mu.Lock()
- close(s.ready)
- s.mu.Unlock()
- go transport.HandleStreams(func(s *Stream) {
- go h.handleStreamDelayRead(t, s)
- }, func(ctx context.Context, method string) context.Context {
- return ctx
- })
- case pingpong:
- go transport.HandleStreams(func(s *Stream) {
- go h.handleStreamPingPong(t, s)
- }, func(ctx context.Context, method string) context.Context {
- return ctx
- })
- default:
- go transport.HandleStreams(func(s *Stream) {
- go h.handleStream(t, s)
- }, func(ctx context.Context, method string) context.Context {
- return ctx
- })
- }
- }
-}
-
-func (s *server) wait(t *testing.T, timeout time.Duration) {
- select {
- case err := <-s.startedErr:
- if err != nil {
- t.Fatal(err)
- }
- case <-time.After(timeout):
- t.Fatalf("Timed out after %v waiting for server to be ready", timeout)
- }
-}
-
-func (s *server) stop() {
- s.lis.Close()
- s.mu.Lock()
- for c := range s.conns {
- c.Close()
- }
- s.conns = nil
- s.mu.Unlock()
-}
-
-func setUpServerOnly(t *testing.T, port int, serverConfig *ServerConfig, ht hType) *server {
- server := &server{startedErr: make(chan error, 1), ready: make(chan struct{})}
- go server.start(t, port, serverConfig, ht)
- server.wait(t, 2*time.Second)
- return server
-}
-
-func setUp(t *testing.T, port int, maxStreams uint32, ht hType) (*server, ClientTransport) {
- return setUpWithOptions(t, port, &ServerConfig{MaxStreams: maxStreams}, ht, ConnectOptions{}, func() {})
-}
-
-func setUpWithOptions(t *testing.T, port int, serverConfig *ServerConfig, ht hType, copts ConnectOptions, onHandshake func()) (*server, ClientTransport) {
- server := setUpServerOnly(t, port, serverConfig, ht)
- addr := "localhost:" + server.port
- var (
- ct ClientTransport
- connErr error
- )
- target := TargetInfo{
- Addr: addr,
- }
- connectCtx, cancel := context.WithDeadline(context.Background(), time.Now().Add(2*time.Second))
- ct, connErr = NewClientTransport(connectCtx, context.Background(), target, copts, onHandshake)
- if connErr != nil {
- cancel() // Do not cancel in success path.
- t.Fatalf("failed to create transport: %v", connErr)
- }
- return server, ct
-}
-
-func setUpWithNoPingServer(t *testing.T, copts ConnectOptions, done chan net.Conn) ClientTransport {
- lis, err := net.Listen("tcp", "localhost:0")
- if err != nil {
- t.Fatalf("Failed to listen: %v", err)
- }
- // Launch a non responsive server.
- go func() {
- defer lis.Close()
- conn, err := lis.Accept()
- if err != nil {
- t.Errorf("Error at server-side while accepting: %v", err)
- close(done)
- return
- }
- done <- conn
- }()
- connectCtx, cancel := context.WithDeadline(context.Background(), time.Now().Add(2*time.Second))
- tr, err := NewClientTransport(connectCtx, context.Background(), TargetInfo{Addr: lis.Addr().String()}, copts, func() {})
- if err != nil {
- cancel() // Do not cancel in success path.
- // Server clean-up.
- lis.Close()
- if conn, ok := <-done; ok {
- conn.Close()
- }
- t.Fatalf("Failed to dial: %v", err)
- }
- return tr
-}
-
-// TestInflightStreamClosing ensures that closing in-flight stream
-// sends StreamError to concurrent stream reader.
-func TestInflightStreamClosing(t *testing.T) {
- serverConfig := &ServerConfig{}
- server, client := setUpWithOptions(t, 0, serverConfig, suspended, ConnectOptions{}, func() {})
- defer server.stop()
- defer client.Close()
-
- stream, err := client.NewStream(context.Background(), &CallHdr{})
- if err != nil {
- t.Fatalf("Client failed to create RPC request: %v", err)
- }
-
- donec := make(chan struct{})
- serr := StreamError{Desc: "client connection is closing"}
- go func() {
- defer close(donec)
- if _, err := stream.Read(make([]byte, defaultWindowSize)); err != serr {
- t.Errorf("unexpected Stream error %v, expected %v", err, serr)
- }
- }()
-
- // should unblock concurrent stream.Read
- client.CloseStream(stream, serr)
-
- // wait for stream.Read error
- timeout := time.NewTimer(5 * time.Second)
- select {
- case <-donec:
- if !timeout.Stop() {
- <-timeout.C
- }
- case <-timeout.C:
- t.Fatalf("Test timed out, expected a StreamError.")
- }
-}
-
-// TestMaxConnectionIdle tests that a server will send GoAway to a idle client.
-// An idle client is one who doesn't make any RPC calls for a duration of
-// MaxConnectionIdle time.
-func TestMaxConnectionIdle(t *testing.T) {
- serverConfig := &ServerConfig{
- KeepaliveParams: keepalive.ServerParameters{
- MaxConnectionIdle: 2 * time.Second,
- },
- }
- server, client := setUpWithOptions(t, 0, serverConfig, suspended, ConnectOptions{}, func() {})
- defer server.stop()
- defer client.Close()
- stream, err := client.NewStream(context.Background(), &CallHdr{Flush: true})
- if err != nil {
- t.Fatalf("Client failed to create RPC request: %v", err)
- }
- client.(*http2Client).closeStream(stream, io.EOF, true, http2.ErrCodeCancel, nil, nil, false)
- // wait for server to see that closed stream and max-age logic to send goaway after no new RPCs are mode
- timeout := time.NewTimer(time.Second * 4)
- select {
- case <-client.GoAway():
- if !timeout.Stop() {
- <-timeout.C
- }
- case <-timeout.C:
- t.Fatalf("Test timed out, expected a GoAway from the server.")
- }
-}
-
-// TestMaxConenctionIdleNegative tests that a server will not send GoAway to a non-idle(busy) client.
-func TestMaxConnectionIdleNegative(t *testing.T) {
- serverConfig := &ServerConfig{
- KeepaliveParams: keepalive.ServerParameters{
- MaxConnectionIdle: 2 * time.Second,
- },
- }
- server, client := setUpWithOptions(t, 0, serverConfig, suspended, ConnectOptions{}, func() {})
- defer server.stop()
- defer client.Close()
- _, err := client.NewStream(context.Background(), &CallHdr{Flush: true})
- if err != nil {
- t.Fatalf("Client failed to create RPC request: %v", err)
- }
- timeout := time.NewTimer(time.Second * 4)
- select {
- case <-client.GoAway():
- if !timeout.Stop() {
- <-timeout.C
- }
- t.Fatalf("A non-idle client received a GoAway.")
- case <-timeout.C:
- }
-
-}
-
-// TestMaxConnectionAge tests that a server will send GoAway after a duration of MaxConnectionAge.
-func TestMaxConnectionAge(t *testing.T) {
- serverConfig := &ServerConfig{
- KeepaliveParams: keepalive.ServerParameters{
- MaxConnectionAge: 2 * time.Second,
- },
- }
- server, client := setUpWithOptions(t, 0, serverConfig, suspended, ConnectOptions{}, func() {})
- defer server.stop()
- defer client.Close()
- _, err := client.NewStream(context.Background(), &CallHdr{})
- if err != nil {
- t.Fatalf("Client failed to create stream: %v", err)
- }
- // Wait for max-age logic to send GoAway.
- timeout := time.NewTimer(4 * time.Second)
- select {
- case <-client.GoAway():
- if !timeout.Stop() {
- <-timeout.C
- }
- case <-timeout.C:
- t.Fatalf("Test timer out, expected a GoAway from the server.")
- }
-}
-
-// TestKeepaliveServer tests that a server closes connection with a client that doesn't respond to keepalive pings.
-func TestKeepaliveServer(t *testing.T) {
- serverConfig := &ServerConfig{
- KeepaliveParams: keepalive.ServerParameters{
- Time: 2 * time.Second,
- Timeout: 1 * time.Second,
- },
- }
- server, c := setUpWithOptions(t, 0, serverConfig, suspended, ConnectOptions{}, func() {})
- defer server.stop()
- defer c.Close()
- client, err := net.Dial("tcp", server.lis.Addr().String())
- if err != nil {
- t.Fatalf("Failed to dial: %v", err)
- }
- defer client.Close()
-
- // Set read deadline on client conn so that it doesn't block forever in errorsome cases.
- client.SetDeadline(time.Now().Add(10 * time.Second))
-
- if n, err := client.Write(clientPreface); err != nil || n != len(clientPreface) {
- t.Fatalf("Error writing client preface; n=%v, err=%v", n, err)
- }
- framer := newFramer(client, defaultWriteBufSize, defaultReadBufSize)
- if err := framer.fr.WriteSettings(http2.Setting{}); err != nil {
- t.Fatal("Error writing settings frame:", err)
- }
- framer.writer.Flush()
- // Wait for keepalive logic to close the connection.
- time.Sleep(4 * time.Second)
- b := make([]byte, 24)
- for {
- _, err = client.Read(b)
- if err == nil {
- continue
- }
- if err != io.EOF {
- t.Fatalf("client.Read(_) = _,%v, want io.EOF", err)
- }
- break
- }
-}
-
-// TestKeepaliveServerNegative tests that a server doesn't close connection with a client that responds to keepalive pings.
-func TestKeepaliveServerNegative(t *testing.T) {
- serverConfig := &ServerConfig{
- KeepaliveParams: keepalive.ServerParameters{
- Time: 2 * time.Second,
- Timeout: 1 * time.Second,
- },
- }
- server, client := setUpWithOptions(t, 0, serverConfig, suspended, ConnectOptions{}, func() {})
- defer server.stop()
- defer client.Close()
- // Give keepalive logic some time by sleeping.
- time.Sleep(4 * time.Second)
- // Assert that client is still active.
- clientTr := client.(*http2Client)
- clientTr.mu.Lock()
- defer clientTr.mu.Unlock()
- if clientTr.state != reachable {
- t.Fatalf("Test failed: Expected server-client connection to be healthy.")
- }
-}
-
-func TestKeepaliveClientClosesIdleTransport(t *testing.T) {
- done := make(chan net.Conn, 1)
- tr := setUpWithNoPingServer(t, ConnectOptions{KeepaliveParams: keepalive.ClientParameters{
- Time: 2 * time.Second, // Keepalive time = 2 sec.
- Timeout: 1 * time.Second, // Keepalive timeout = 1 sec.
- PermitWithoutStream: true, // Run keepalive even with no RPCs.
- }}, done)
- defer tr.Close()
- conn, ok := <-done
- if !ok {
- t.Fatalf("Server didn't return connection object")
- }
- defer conn.Close()
- // Sleep for keepalive to close the connection.
- time.Sleep(4 * time.Second)
- // Assert that the connection was closed.
- ct := tr.(*http2Client)
- ct.mu.Lock()
- defer ct.mu.Unlock()
- if ct.state == reachable {
- t.Fatalf("Test Failed: Expected client transport to have closed.")
- }
-}
-
-func TestKeepaliveClientStaysHealthyOnIdleTransport(t *testing.T) {
- done := make(chan net.Conn, 1)
- tr := setUpWithNoPingServer(t, ConnectOptions{KeepaliveParams: keepalive.ClientParameters{
- Time: 2 * time.Second, // Keepalive time = 2 sec.
- Timeout: 1 * time.Second, // Keepalive timeout = 1 sec.
- }}, done)
- defer tr.Close()
- conn, ok := <-done
- if !ok {
- t.Fatalf("server didn't reutrn connection object")
- }
- defer conn.Close()
- // Give keepalive some time.
- time.Sleep(4 * time.Second)
- // Assert that connections is still healthy.
- ct := tr.(*http2Client)
- ct.mu.Lock()
- defer ct.mu.Unlock()
- if ct.state != reachable {
- t.Fatalf("Test failed: Expected client transport to be healthy.")
- }
-}
-
-func TestKeepaliveClientClosesWithActiveStreams(t *testing.T) {
- done := make(chan net.Conn, 1)
- tr := setUpWithNoPingServer(t, ConnectOptions{KeepaliveParams: keepalive.ClientParameters{
- Time: 2 * time.Second, // Keepalive time = 2 sec.
- Timeout: 1 * time.Second, // Keepalive timeout = 1 sec.
- }}, done)
- defer tr.Close()
- conn, ok := <-done
- if !ok {
- t.Fatalf("Server didn't return connection object")
- }
- defer conn.Close()
- // Create a stream.
- _, err := tr.NewStream(context.Background(), &CallHdr{Flush: true})
- if err != nil {
- t.Fatalf("Failed to create a new stream: %v", err)
- }
- // Give keepalive some time.
- time.Sleep(4 * time.Second)
- // Assert that transport was closed.
- ct := tr.(*http2Client)
- ct.mu.Lock()
- defer ct.mu.Unlock()
- if ct.state == reachable {
- t.Fatalf("Test failed: Expected client transport to have closed.")
- }
-}
-
-func TestKeepaliveClientStaysHealthyWithResponsiveServer(t *testing.T) {
- s, tr := setUpWithOptions(t, 0, &ServerConfig{MaxStreams: math.MaxUint32}, normal, ConnectOptions{KeepaliveParams: keepalive.ClientParameters{
- Time: 2 * time.Second, // Keepalive time = 2 sec.
- Timeout: 1 * time.Second, // Keepalive timeout = 1 sec.
- PermitWithoutStream: true, // Run keepalive even with no RPCs.
- }}, func() {})
- defer s.stop()
- defer tr.Close()
- // Give keep alive some time.
- time.Sleep(4 * time.Second)
- // Assert that transport is healthy.
- ct := tr.(*http2Client)
- ct.mu.Lock()
- defer ct.mu.Unlock()
- if ct.state != reachable {
- t.Fatalf("Test failed: Expected client transport to be healthy.")
- }
-}
-
-func TestKeepaliveServerEnforcementWithAbusiveClientNoRPC(t *testing.T) {
- serverConfig := &ServerConfig{
- KeepalivePolicy: keepalive.EnforcementPolicy{
- MinTime: 2 * time.Second,
- },
- }
- clientOptions := ConnectOptions{
- KeepaliveParams: keepalive.ClientParameters{
- Time: 50 * time.Millisecond,
- Timeout: 1 * time.Second,
- PermitWithoutStream: true,
- },
- }
- server, client := setUpWithOptions(t, 0, serverConfig, normal, clientOptions, func() {})
- defer server.stop()
- defer client.Close()
-
- timeout := time.NewTimer(10 * time.Second)
- select {
- case <-client.GoAway():
- if !timeout.Stop() {
- <-timeout.C
- }
- case <-timeout.C:
- t.Fatalf("Test failed: Expected a GoAway from server.")
- }
- time.Sleep(500 * time.Millisecond)
- ct := client.(*http2Client)
- ct.mu.Lock()
- defer ct.mu.Unlock()
- if ct.state == reachable {
- t.Fatalf("Test failed: Expected the connection to be closed.")
- }
-}
-
-func TestKeepaliveServerEnforcementWithAbusiveClientWithRPC(t *testing.T) {
- serverConfig := &ServerConfig{
- KeepalivePolicy: keepalive.EnforcementPolicy{
- MinTime: 2 * time.Second,
- },
- }
- clientOptions := ConnectOptions{
- KeepaliveParams: keepalive.ClientParameters{
- Time: 50 * time.Millisecond,
- Timeout: 1 * time.Second,
- },
- }
- server, client := setUpWithOptions(t, 0, serverConfig, suspended, clientOptions, func() {})
- defer server.stop()
- defer client.Close()
-
- if _, err := client.NewStream(context.Background(), &CallHdr{Flush: true}); err != nil {
- t.Fatalf("Client failed to create stream.")
- }
- timeout := time.NewTimer(10 * time.Second)
- select {
- case <-client.GoAway():
- if !timeout.Stop() {
- <-timeout.C
- }
- case <-timeout.C:
- t.Fatalf("Test failed: Expected a GoAway from server.")
- }
- time.Sleep(500 * time.Millisecond)
- ct := client.(*http2Client)
- ct.mu.Lock()
- defer ct.mu.Unlock()
- if ct.state == reachable {
- t.Fatalf("Test failed: Expected the connection to be closed.")
- }
-}
-
-func TestKeepaliveServerEnforcementWithObeyingClientNoRPC(t *testing.T) {
- serverConfig := &ServerConfig{
- KeepalivePolicy: keepalive.EnforcementPolicy{
- MinTime: 100 * time.Millisecond,
- PermitWithoutStream: true,
- },
- }
- clientOptions := ConnectOptions{
- KeepaliveParams: keepalive.ClientParameters{
- Time: 101 * time.Millisecond,
- Timeout: 1 * time.Second,
- PermitWithoutStream: true,
- },
- }
- server, client := setUpWithOptions(t, 0, serverConfig, normal, clientOptions, func() {})
- defer server.stop()
- defer client.Close()
-
- // Give keepalive enough time.
- time.Sleep(3 * time.Second)
- // Assert that connection is healthy.
- ct := client.(*http2Client)
- ct.mu.Lock()
- defer ct.mu.Unlock()
- if ct.state != reachable {
- t.Fatalf("Test failed: Expected connection to be healthy.")
- }
-}
-
-func TestKeepaliveServerEnforcementWithObeyingClientWithRPC(t *testing.T) {
- serverConfig := &ServerConfig{
- KeepalivePolicy: keepalive.EnforcementPolicy{
- MinTime: 100 * time.Millisecond,
- },
- }
- clientOptions := ConnectOptions{
- KeepaliveParams: keepalive.ClientParameters{
- Time: 101 * time.Millisecond,
- Timeout: 1 * time.Second,
- },
- }
- server, client := setUpWithOptions(t, 0, serverConfig, suspended, clientOptions, func() {})
- defer server.stop()
- defer client.Close()
-
- if _, err := client.NewStream(context.Background(), &CallHdr{Flush: true}); err != nil {
- t.Fatalf("Client failed to create stream.")
- }
-
- // Give keepalive enough time.
- time.Sleep(3 * time.Second)
- // Assert that connection is healthy.
- ct := client.(*http2Client)
- ct.mu.Lock()
- defer ct.mu.Unlock()
- if ct.state != reachable {
- t.Fatalf("Test failed: Expected connection to be healthy.")
- }
-}
-
-func TestClientSendAndReceive(t *testing.T) {
- server, ct := setUp(t, 0, math.MaxUint32, normal)
- callHdr := &CallHdr{
- Host: "localhost",
- Method: "foo.Small",
- }
- s1, err1 := ct.NewStream(context.Background(), callHdr)
- if err1 != nil {
- t.Fatalf("failed to open stream: %v", err1)
- }
- if s1.id != 1 {
- t.Fatalf("wrong stream id: %d", s1.id)
- }
- s2, err2 := ct.NewStream(context.Background(), callHdr)
- if err2 != nil {
- t.Fatalf("failed to open stream: %v", err2)
- }
- if s2.id != 3 {
- t.Fatalf("wrong stream id: %d", s2.id)
- }
- opts := Options{
- Last: true,
- Delay: false,
- }
- if err := ct.Write(s1, nil, expectedRequest, &opts); err != nil && err != io.EOF {
- t.Fatalf("failed to send data: %v", err)
- }
- p := make([]byte, len(expectedResponse))
- _, recvErr := s1.Read(p)
- if recvErr != nil || !bytes.Equal(p, expectedResponse) {
- t.Fatalf("Error: %v, want <nil>; Result: %v, want %v", recvErr, p, expectedResponse)
- }
- _, recvErr = s1.Read(p)
- if recvErr != io.EOF {
- t.Fatalf("Error: %v; want <EOF>", recvErr)
- }
- ct.Close()
- server.stop()
-}
-
-func TestClientErrorNotify(t *testing.T) {
- server, ct := setUp(t, 0, math.MaxUint32, normal)
- go server.stop()
- // ct.reader should detect the error and activate ct.Error().
- <-ct.Error()
- ct.Close()
-}
-
-func performOneRPC(ct ClientTransport) {
- callHdr := &CallHdr{
- Host: "localhost",
- Method: "foo.Small",
- }
- s, err := ct.NewStream(context.Background(), callHdr)
- if err != nil {
- return
- }
- opts := Options{
- Last: true,
- Delay: false,
- }
- if err := ct.Write(s, []byte{}, expectedRequest, &opts); err == nil || err == io.EOF {
- time.Sleep(5 * time.Millisecond)
- // The following s.Recv()'s could error out because the
- // underlying transport is gone.
- //
- // Read response
- p := make([]byte, len(expectedResponse))
- s.Read(p)
- // Read io.EOF
- s.Read(p)
- }
-}
-
-func TestClientMix(t *testing.T) {
- s, ct := setUp(t, 0, math.MaxUint32, normal)
- go func(s *server) {
- time.Sleep(5 * time.Second)
- s.stop()
- }(s)
- go func(ct ClientTransport) {
- <-ct.Error()
- ct.Close()
- }(ct)
- for i := 0; i < 1000; i++ {
- time.Sleep(10 * time.Millisecond)
- go performOneRPC(ct)
- }
-}
-
-func TestLargeMessage(t *testing.T) {
- server, ct := setUp(t, 0, math.MaxUint32, normal)
- callHdr := &CallHdr{
- Host: "localhost",
- Method: "foo.Large",
- }
- var wg sync.WaitGroup
- for i := 0; i < 2; i++ {
- wg.Add(1)
- go func() {
- defer wg.Done()
- s, err := ct.NewStream(context.Background(), callHdr)
- if err != nil {
- t.Errorf("%v.NewStream(_, _) = _, %v, want _, <nil>", ct, err)
- }
- if err := ct.Write(s, []byte{}, expectedRequestLarge, &Options{Last: true, Delay: false}); err != nil && err != io.EOF {
- t.Errorf("%v.Write(_, _, _) = %v, want <nil>", ct, err)
- }
- p := make([]byte, len(expectedResponseLarge))
- if _, err := s.Read(p); err != nil || !bytes.Equal(p, expectedResponseLarge) {
- t.Errorf("s.Read(%v) = _, %v, want %v, <nil>", err, p, expectedResponse)
- }
- if _, err = s.Read(p); err != io.EOF {
- t.Errorf("Failed to complete the stream %v; want <EOF>", err)
- }
- }()
- }
- wg.Wait()
- ct.Close()
- server.stop()
-}
-
-func TestLargeMessageWithDelayRead(t *testing.T) {
- // Disable dynamic flow control.
- sc := &ServerConfig{
- InitialWindowSize: defaultWindowSize,
- InitialConnWindowSize: defaultWindowSize,
- }
- co := ConnectOptions{
- InitialWindowSize: defaultWindowSize,
- InitialConnWindowSize: defaultWindowSize,
- }
- server, ct := setUpWithOptions(t, 0, sc, delayRead, co, func() {})
- defer server.stop()
- defer ct.Close()
- server.mu.Lock()
- ready := server.ready
- server.mu.Unlock()
- callHdr := &CallHdr{
- Host: "localhost",
- Method: "foo.Large",
- }
- ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(time.Second*10))
- defer cancel()
- s, err := ct.NewStream(ctx, callHdr)
- if err != nil {
- t.Fatalf("%v.NewStream(_, _) = _, %v, want _, <nil>", ct, err)
- return
- }
- // Wait for server's handerler to be initialized
- select {
- case <-ready:
- case <-ctx.Done():
- t.Fatalf("Client timed out waiting for server handler to be initialized.")
- }
- server.mu.Lock()
- serviceHandler := server.h
- server.mu.Unlock()
- var (
- mu sync.Mutex
- total int
- )
- s.wq.replenish = func(n int) {
- mu.Lock()
- total += n
- mu.Unlock()
- s.wq.realReplenish(n)
- }
- getTotal := func() int {
- mu.Lock()
- defer mu.Unlock()
- return total
- }
- done := make(chan struct{})
- defer close(done)
- go func() {
- for {
- select {
- // Prevent goroutine from leaking in case of error.
- case <-done:
- return
- default:
- }
- if getTotal() == defaultWindowSize {
- // unblock server to be able to read and
- // thereby send stream level window update.
- close(serviceHandler.getNotified)
- return
- }
- runtime.Gosched()
- }
- }()
- // This write will cause client to run out of stream level,
- // flow control and the other side won't send a window update
- // until that happens.
- if err := ct.Write(s, []byte{}, expectedRequestLarge, &Options{}); err != nil {
- t.Fatalf("write(_, _, _) = %v, want <nil>", err)
- }
- p := make([]byte, len(expectedResponseLarge))
-
- // Wait for the other side to run out of stream level flow control before
- // reading and thereby sending a window update.
- select {
- case <-serviceHandler.notify:
- case <-ctx.Done():
- t.Fatalf("Client timed out")
- }
- if _, err := s.Read(p); err != nil || !bytes.Equal(p, expectedResponseLarge) {
- t.Fatalf("s.Read(_) = _, %v, want _, <nil>", err)
- }
- if err := ct.Write(s, []byte{}, expectedRequestLarge, &Options{Last: true}); err != nil {
- t.Fatalf("Write(_, _, _) = %v, want <nil>", err)
- }
- if _, err = s.Read(p); err != io.EOF {
- t.Fatalf("Failed to complete the stream %v; want <EOF>", err)
- }
-}
-
-func TestGracefulClose(t *testing.T) {
- server, ct := setUp(t, 0, math.MaxUint32, pingpong)
- defer func() {
- // Stop the server's listener to make the server's goroutines terminate
- // (after the last active stream is done).
- server.lis.Close()
- // Check for goroutine leaks (i.e. GracefulClose with an active stream
- // doesn't eventually close the connection when that stream completes).
- leakcheck.Check(t)
- // Correctly clean up the server
- server.stop()
- }()
- ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(time.Second*10))
- defer cancel()
- s, err := ct.NewStream(ctx, &CallHdr{})
- if err != nil {
- t.Fatalf("NewStream(_, _) = _, %v, want _, <nil>", err)
- }
- msg := make([]byte, 1024)
- outgoingHeader := make([]byte, 5)
- outgoingHeader[0] = byte(0)
- binary.BigEndian.PutUint32(outgoingHeader[1:], uint32(len(msg)))
- incomingHeader := make([]byte, 5)
- if err := ct.Write(s, outgoingHeader, msg, &Options{}); err != nil {
- t.Fatalf("Error while writing: %v", err)
- }
- if _, err := s.Read(incomingHeader); err != nil {
- t.Fatalf("Error while reading: %v", err)
- }
- sz := binary.BigEndian.Uint32(incomingHeader[1:])
- recvMsg := make([]byte, int(sz))
- if _, err := s.Read(recvMsg); err != nil {
- t.Fatalf("Error while reading: %v", err)
- }
- if err = ct.GracefulClose(); err != nil {
- t.Fatalf("GracefulClose() = %v, want <nil>", err)
- }
- var wg sync.WaitGroup
- // Expect the failure for all the follow-up streams because ct has been closed gracefully.
- for i := 0; i < 200; i++ {
- wg.Add(1)
- go func() {
- defer wg.Done()
- str, err := ct.NewStream(context.Background(), &CallHdr{})
- if err == ErrConnClosing {
- return
- } else if err != nil {
- t.Errorf("_.NewStream(_, _) = _, %v, want _, %v", err, ErrConnClosing)
- return
- }
- ct.Write(str, nil, nil, &Options{Last: true})
- if _, err := str.Read(make([]byte, 8)); err != errStreamDrain && err != ErrConnClosing {
- t.Errorf("_.Read(_) = _, %v, want _, %v or %v", err, errStreamDrain, ErrConnClosing)
- }
- }()
- }
- ct.Write(s, nil, nil, &Options{Last: true})
- if _, err := s.Read(incomingHeader); err != io.EOF {
- t.Fatalf("Client expected EOF from the server. Got: %v", err)
- }
- // The stream which was created before graceful close can still proceed.
- wg.Wait()
-}
-
-func TestLargeMessageSuspension(t *testing.T) {
- server, ct := setUp(t, 0, math.MaxUint32, suspended)
- callHdr := &CallHdr{
- Host: "localhost",
- Method: "foo.Large",
- }
- // Set a long enough timeout for writing a large message out.
- ctx, cancel := context.WithTimeout(context.Background(), time.Second)
- defer cancel()
- s, err := ct.NewStream(ctx, callHdr)
- if err != nil {
- t.Fatalf("failed to open stream: %v", err)
- }
- // Launch a goroutine simillar to the stream monitoring goroutine in
- // stream.go to keep track of context timeout and call CloseStream.
- go func() {
- <-ctx.Done()
- ct.CloseStream(s, ContextErr(ctx.Err()))
- }()
- // Write should not be done successfully due to flow control.
- msg := make([]byte, initialWindowSize*8)
- ct.Write(s, nil, msg, &Options{})
- err = ct.Write(s, nil, msg, &Options{Last: true})
- if err != errStreamDone {
- t.Fatalf("Write got %v, want io.EOF", err)
- }
- expectedErr := streamErrorf(codes.DeadlineExceeded, "%v", context.DeadlineExceeded)
- if _, err := s.Read(make([]byte, 8)); err != expectedErr {
- t.Fatalf("Read got %v of type %T, want %v", err, err, expectedErr)
- }
- ct.Close()
- server.stop()
-}
-
-func TestMaxStreams(t *testing.T) {
- serverConfig := &ServerConfig{
- MaxStreams: 1,
- }
- server, ct := setUpWithOptions(t, 0, serverConfig, suspended, ConnectOptions{}, func() {})
- defer ct.Close()
- defer server.stop()
- callHdr := &CallHdr{
- Host: "localhost",
- Method: "foo.Large",
- }
- s, err := ct.NewStream(context.Background(), callHdr)
- if err != nil {
- t.Fatalf("Failed to open stream: %v", err)
- }
- // Keep creating streams until one fails with deadline exceeded, marking the application
- // of server settings on client.
- slist := []*Stream{}
- pctx, cancel := context.WithCancel(context.Background())
- defer cancel()
- timer := time.NewTimer(time.Second * 10)
- expectedErr := streamErrorf(codes.DeadlineExceeded, "%v", context.DeadlineExceeded)
- for {
- select {
- case <-timer.C:
- t.Fatalf("Test timeout: client didn't receive server settings.")
- default:
- }
- ctx, cancel := context.WithDeadline(pctx, time.Now().Add(time.Second))
- // This is only to get rid of govet. All these context are based on a base
- // context which is canceled at the end of the test.
- defer cancel()
- if str, err := ct.NewStream(ctx, callHdr); err == nil {
- slist = append(slist, str)
- continue
- } else if err != expectedErr {
- t.Fatalf("ct.NewStream(_,_) = _, %v, want _, %v", err, expectedErr)
- }
- timer.Stop()
- break
- }
- done := make(chan struct{})
- // Try and create a new stream.
- go func() {
- defer close(done)
- ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(time.Second*10))
- defer cancel()
- if _, err := ct.NewStream(ctx, callHdr); err != nil {
- t.Errorf("Failed to open stream: %v", err)
- }
- }()
- // Close all the extra streams created and make sure the new stream is not created.
- for _, str := range slist {
- ct.CloseStream(str, nil)
- }
- select {
- case <-done:
- t.Fatalf("Test failed: didn't expect new stream to be created just yet.")
- default:
- }
- // Close the first stream created so that the new stream can finally be created.
- ct.CloseStream(s, nil)
- <-done
- ct.Close()
- cc := ct.(*http2Client)
- <-cc.writerDone
- if cc.maxConcurrentStreams != 1 {
- t.Fatalf("cc.maxConcurrentStreams: %d, want 1", cc.maxConcurrentStreams)
- }
-}
-
-func TestServerContextCanceledOnClosedConnection(t *testing.T) {
- server, ct := setUp(t, 0, math.MaxUint32, suspended)
- callHdr := &CallHdr{
- Host: "localhost",
- Method: "foo",
- }
- var sc *http2Server
- // Wait until the server transport is setup.
- for {
- server.mu.Lock()
- if len(server.conns) == 0 {
- server.mu.Unlock()
- time.Sleep(time.Millisecond)
- continue
- }
- for k := range server.conns {
- var ok bool
- sc, ok = k.(*http2Server)
- if !ok {
- t.Fatalf("Failed to convert %v to *http2Server", k)
- }
- }
- server.mu.Unlock()
- break
- }
- cc, ok := ct.(*http2Client)
- if !ok {
- t.Fatalf("Failed to convert %v to *http2Client", ct)
- }
- s, err := ct.NewStream(context.Background(), callHdr)
- if err != nil {
- t.Fatalf("Failed to open stream: %v", err)
- }
- cc.controlBuf.put(&dataFrame{
- streamID: s.id,
- endStream: false,
- h: nil,
- d: make([]byte, http2MaxFrameLen),
- onEachWrite: func() {},
- })
- // Loop until the server side stream is created.
- var ss *Stream
- for {
- time.Sleep(time.Second)
- sc.mu.Lock()
- if len(sc.activeStreams) == 0 {
- sc.mu.Unlock()
- continue
- }
- ss = sc.activeStreams[s.id]
- sc.mu.Unlock()
- break
- }
- cc.Close()
- select {
- case <-ss.Context().Done():
- if ss.Context().Err() != context.Canceled {
- t.Fatalf("ss.Context().Err() got %v, want %v", ss.Context().Err(), context.Canceled)
- }
- case <-time.After(5 * time.Second):
- t.Fatalf("Failed to cancel the context of the sever side stream.")
- }
- server.stop()
-}
-
-func TestClientConnDecoupledFromApplicationRead(t *testing.T) {
- connectOptions := ConnectOptions{
- InitialWindowSize: defaultWindowSize,
- InitialConnWindowSize: defaultWindowSize,
- }
- server, client := setUpWithOptions(t, 0, &ServerConfig{}, notifyCall, connectOptions, func() {})
- defer server.stop()
- defer client.Close()
-
- waitWhileTrue(t, func() (bool, error) {
- server.mu.Lock()
- defer server.mu.Unlock()
-
- if len(server.conns) == 0 {
- return true, fmt.Errorf("timed-out while waiting for connection to be created on the server")
- }
- return false, nil
- })
-
- var st *http2Server
- server.mu.Lock()
- for k := range server.conns {
- st = k.(*http2Server)
- }
- notifyChan := make(chan struct{})
- server.h.notify = notifyChan
- server.mu.Unlock()
- cstream1, err := client.NewStream(context.Background(), &CallHdr{Flush: true})
- if err != nil {
- t.Fatalf("Client failed to create first stream. Err: %v", err)
- }
-
- <-notifyChan
- var sstream1 *Stream
- // Access stream on the server.
- st.mu.Lock()
- for _, v := range st.activeStreams {
- if v.id == cstream1.id {
- sstream1 = v
- }
- }
- st.mu.Unlock()
- if sstream1 == nil {
- t.Fatalf("Didn't find stream corresponding to client cstream.id: %v on the server", cstream1.id)
- }
- // Exhaust client's connection window.
- if err := st.Write(sstream1, []byte{}, make([]byte, defaultWindowSize), &Options{}); err != nil {
- t.Fatalf("Server failed to write data. Err: %v", err)
- }
- notifyChan = make(chan struct{})
- server.mu.Lock()
- server.h.notify = notifyChan
- server.mu.Unlock()
- // Create another stream on client.
- cstream2, err := client.NewStream(context.Background(), &CallHdr{Flush: true})
- if err != nil {
- t.Fatalf("Client failed to create second stream. Err: %v", err)
- }
- <-notifyChan
- var sstream2 *Stream
- st.mu.Lock()
- for _, v := range st.activeStreams {
- if v.id == cstream2.id {
- sstream2 = v
- }
- }
- st.mu.Unlock()
- if sstream2 == nil {
- t.Fatalf("Didn't find stream corresponding to client cstream.id: %v on the server", cstream2.id)
- }
- // Server should be able to send data on the new stream, even though the client hasn't read anything on the first stream.
- if err := st.Write(sstream2, []byte{}, make([]byte, defaultWindowSize), &Options{}); err != nil {
- t.Fatalf("Server failed to write data. Err: %v", err)
- }
-
- // Client should be able to read data on second stream.
- if _, err := cstream2.Read(make([]byte, defaultWindowSize)); err != nil {
- t.Fatalf("_.Read(_) = _, %v, want _, <nil>", err)
- }
-
- // Client should be able to read data on first stream.
- if _, err := cstream1.Read(make([]byte, defaultWindowSize)); err != nil {
- t.Fatalf("_.Read(_) = _, %v, want _, <nil>", err)
- }
-}
-
-func TestServerConnDecoupledFromApplicationRead(t *testing.T) {
- serverConfig := &ServerConfig{
- InitialWindowSize: defaultWindowSize,
- InitialConnWindowSize: defaultWindowSize,
- }
- server, client := setUpWithOptions(t, 0, serverConfig, suspended, ConnectOptions{}, func() {})
- defer server.stop()
- defer client.Close()
- waitWhileTrue(t, func() (bool, error) {
- server.mu.Lock()
- defer server.mu.Unlock()
-
- if len(server.conns) == 0 {
- return true, fmt.Errorf("timed-out while waiting for connection to be created on the server")
- }
- return false, nil
- })
- var st *http2Server
- server.mu.Lock()
- for k := range server.conns {
- st = k.(*http2Server)
- }
- server.mu.Unlock()
- cstream1, err := client.NewStream(context.Background(), &CallHdr{Flush: true})
- if err != nil {
- t.Fatalf("Failed to create 1st stream. Err: %v", err)
- }
- // Exhaust server's connection window.
- if err := client.Write(cstream1, nil, make([]byte, defaultWindowSize), &Options{Last: true}); err != nil {
- t.Fatalf("Client failed to write data. Err: %v", err)
- }
- //Client should be able to create another stream and send data on it.
- cstream2, err := client.NewStream(context.Background(), &CallHdr{Flush: true})
- if err != nil {
- t.Fatalf("Failed to create 2nd stream. Err: %v", err)
- }
- if err := client.Write(cstream2, nil, make([]byte, defaultWindowSize), &Options{}); err != nil {
- t.Fatalf("Client failed to write data. Err: %v", err)
- }
- // Get the streams on server.
- waitWhileTrue(t, func() (bool, error) {
- st.mu.Lock()
- defer st.mu.Unlock()
-
- if len(st.activeStreams) != 2 {
- return true, fmt.Errorf("timed-out while waiting for server to have created the streams")
- }
- return false, nil
- })
- var sstream1 *Stream
- st.mu.Lock()
- for _, v := range st.activeStreams {
- if v.id == 1 {
- sstream1 = v
- }
- }
- st.mu.Unlock()
- // Reading from the stream on server should succeed.
- if _, err := sstream1.Read(make([]byte, defaultWindowSize)); err != nil {
- t.Fatalf("_.Read(_) = %v, want <nil>", err)
- }
-
- if _, err := sstream1.Read(make([]byte, 1)); err != io.EOF {
- t.Fatalf("_.Read(_) = %v, want io.EOF", err)
- }
-
-}
-
-func TestServerWithMisbehavedClient(t *testing.T) {
- server := setUpServerOnly(t, 0, &ServerConfig{}, suspended)
- defer server.stop()
- // Create a client that can override server stream quota.
- mconn, err := net.Dial("tcp", server.lis.Addr().String())
- if err != nil {
- t.Fatalf("Clent failed to dial:%v", err)
- }
- defer mconn.Close()
- if err := mconn.SetWriteDeadline(time.Now().Add(time.Second * 10)); err != nil {
- t.Fatalf("Failed to set write deadline: %v", err)
- }
- if n, err := mconn.Write(clientPreface); err != nil || n != len(clientPreface) {
- t.Fatalf("mconn.Write(clientPreface) = %d, %v, want %d, <nil>", n, err, len(clientPreface))
- }
- // success chan indicates that reader received a RSTStream from server.
- success := make(chan struct{})
- var mu sync.Mutex
- framer := http2.NewFramer(mconn, mconn)
- if err := framer.WriteSettings(); err != nil {
- t.Fatalf("Error while writing settings: %v", err)
- }
- go func() { // Launch a reader for this misbehaving client.
- for {
- frame, err := framer.ReadFrame()
- if err != nil {
- return
- }
- switch frame := frame.(type) {
- case *http2.PingFrame:
- // Write ping ack back so that server's BDP estimation works right.
- mu.Lock()
- framer.WritePing(true, frame.Data)
- mu.Unlock()
- case *http2.RSTStreamFrame:
- if frame.Header().StreamID != 1 || http2.ErrCode(frame.ErrCode) != http2.ErrCodeFlowControl {
- t.Errorf("RST stream received with streamID: %d and code: %v, want streamID: 1 and code: http2.ErrCodeFlowControl", frame.Header().StreamID, http2.ErrCode(frame.ErrCode))
- }
- close(success)
- return
- default:
- // Do nothing.
- }
-
- }
- }()
- // Create a stream.
- var buf bytes.Buffer
- henc := hpack.NewEncoder(&buf)
- // TODO(mmukhi): Remove unnecessary fields.
- if err := henc.WriteField(hpack.HeaderField{Name: ":method", Value: "POST"}); err != nil {
- t.Fatalf("Error while encoding header: %v", err)
- }
- if err := henc.WriteField(hpack.HeaderField{Name: ":path", Value: "foo"}); err != nil {
- t.Fatalf("Error while encoding header: %v", err)
- }
- if err := henc.WriteField(hpack.HeaderField{Name: ":authority", Value: "localhost"}); err != nil {
- t.Fatalf("Error while encoding header: %v", err)
- }
- if err := henc.WriteField(hpack.HeaderField{Name: "content-type", Value: "application/grpc"}); err != nil {
- t.Fatalf("Error while encoding header: %v", err)
- }
- mu.Lock()
- if err := framer.WriteHeaders(http2.HeadersFrameParam{StreamID: 1, BlockFragment: buf.Bytes(), EndHeaders: true}); err != nil {
- mu.Unlock()
- t.Fatalf("Error while writing headers: %v", err)
- }
- mu.Unlock()
-
- // Test server behavior for violation of stream flow control window size restriction.
- timer := time.NewTimer(time.Second * 5)
- dbuf := make([]byte, http2MaxFrameLen)
- for {
- select {
- case <-timer.C:
- t.Fatalf("Test timed out.")
- case <-success:
- return
- default:
- }
- mu.Lock()
- if err := framer.WriteData(1, false, dbuf); err != nil {
- mu.Unlock()
- // Error here means the server could have closed the connection due to flow control
- // violation. Make sure that is the case by waiting for success chan to be closed.
- select {
- case <-timer.C:
- t.Fatalf("Error while writing data: %v", err)
- case <-success:
- return
- }
- }
- mu.Unlock()
- // This for loop is capable of hogging the CPU and cause starvation
- // in Go versions prior to 1.9,
- // in single CPU environment. Explicitly relinquish processor.
- runtime.Gosched()
- }
-}
-
-func TestClientWithMisbehavedServer(t *testing.T) {
- // Create a misbehaving server.
- lis, err := net.Listen("tcp", "localhost:0")
- if err != nil {
- t.Fatalf("Error while listening: %v", err)
- }
- defer lis.Close()
- // success chan indicates that the server received
- // RSTStream from the client.
- success := make(chan struct{})
- go func() { // Launch the misbehaving server.
- sconn, err := lis.Accept()
- if err != nil {
- t.Errorf("Error while accepting: %v", err)
- return
- }
- defer sconn.Close()
- if _, err := io.ReadFull(sconn, make([]byte, len(clientPreface))); err != nil {
- t.Errorf("Error while reading clieng preface: %v", err)
- return
- }
- sfr := http2.NewFramer(sconn, sconn)
- if err := sfr.WriteSettingsAck(); err != nil {
- t.Errorf("Error while writing settings: %v", err)
- return
- }
- var mu sync.Mutex
- for {
- frame, err := sfr.ReadFrame()
- if err != nil {
- return
- }
- switch frame := frame.(type) {
- case *http2.HeadersFrame:
- // When the client creates a stream, violate the stream flow control.
- go func() {
- buf := make([]byte, http2MaxFrameLen)
- for {
- mu.Lock()
- if err := sfr.WriteData(1, false, buf); err != nil {
- mu.Unlock()
- return
- }
- mu.Unlock()
- // This for loop is capable of hogging the CPU and cause starvation
- // in Go versions prior to 1.9,
- // in single CPU environment. Explicitly relinquish processor.
- runtime.Gosched()
- }
- }()
- case *http2.RSTStreamFrame:
- if frame.Header().StreamID != 1 || http2.ErrCode(frame.ErrCode) != http2.ErrCodeFlowControl {
- t.Errorf("RST stream received with streamID: %d and code: %v, want streamID: 1 and code: http2.ErrCodeFlowControl", frame.Header().StreamID, http2.ErrCode(frame.ErrCode))
- }
- close(success)
- return
- case *http2.PingFrame:
- mu.Lock()
- sfr.WritePing(true, frame.Data)
- mu.Unlock()
- default:
- }
- }
- }()
- connectCtx, cancel := context.WithDeadline(context.Background(), time.Now().Add(2*time.Second))
- defer cancel()
- ct, err := NewClientTransport(connectCtx, context.Background(), TargetInfo{Addr: lis.Addr().String()}, ConnectOptions{}, func() {})
- if err != nil {
- t.Fatalf("Error while creating client transport: %v", err)
- }
- defer ct.Close()
- str, err := ct.NewStream(context.Background(), &CallHdr{})
- if err != nil {
- t.Fatalf("Error while creating stream: %v", err)
- }
- timer := time.NewTimer(time.Second * 5)
- go func() { // This go routine mimics the one in stream.go to call CloseStream.
- <-str.Done()
- ct.CloseStream(str, nil)
- }()
- select {
- case <-timer.C:
- t.Fatalf("Test timed-out.")
- case <-success:
- }
-}
-
-var encodingTestStatus = status.New(codes.Internal, "\n")
-
-func TestEncodingRequiredStatus(t *testing.T) {
- server, ct := setUp(t, 0, math.MaxUint32, encodingRequiredStatus)
- callHdr := &CallHdr{
- Host: "localhost",
- Method: "foo",
- }
- s, err := ct.NewStream(context.Background(), callHdr)
- if err != nil {
- return
- }
- opts := Options{
- Last: true,
- Delay: false,
- }
- if err := ct.Write(s, nil, expectedRequest, &opts); err != nil && err != errStreamDone {
- t.Fatalf("Failed to write the request: %v", err)
- }
- p := make([]byte, http2MaxFrameLen)
- if _, err := s.trReader.(*transportReader).Read(p); err != io.EOF {
- t.Fatalf("Read got error %v, want %v", err, io.EOF)
- }
- if !reflect.DeepEqual(s.Status(), encodingTestStatus) {
- t.Fatalf("stream with status %v, want %v", s.Status(), encodingTestStatus)
- }
- ct.Close()
- server.stop()
-}
-
-func TestInvalidHeaderField(t *testing.T) {
- server, ct := setUp(t, 0, math.MaxUint32, invalidHeaderField)
- callHdr := &CallHdr{
- Host: "localhost",
- Method: "foo",
- }
- s, err := ct.NewStream(context.Background(), callHdr)
- if err != nil {
- return
- }
- p := make([]byte, http2MaxFrameLen)
- _, err = s.trReader.(*transportReader).Read(p)
- if se, ok := err.(StreamError); !ok || se.Code != codes.Internal || !strings.Contains(err.Error(), expectedInvalidHeaderField) {
- t.Fatalf("Read got error %v, want error with code %s and contains %q", err, codes.Internal, expectedInvalidHeaderField)
- }
- ct.Close()
- server.stop()
-}
-
-func TestIsReservedHeader(t *testing.T) {
- tests := []struct {
- h string
- want bool
- }{
- {"", false}, // but should be rejected earlier
- {"foo", false},
- {"content-type", true},
- {"user-agent", true},
- {":anything", true},
- {"grpc-message-type", true},
- {"grpc-encoding", true},
- {"grpc-message", true},
- {"grpc-status", true},
- {"grpc-timeout", true},
- {"te", true},
- }
- for _, tt := range tests {
- got := isReservedHeader(tt.h)
- if got != tt.want {
- t.Errorf("isReservedHeader(%q) = %v; want %v", tt.h, got, tt.want)
- }
- }
-}
-
-func TestContextErr(t *testing.T) {
- for _, test := range []struct {
- // input
- errIn error
- // outputs
- errOut StreamError
- }{
- {context.DeadlineExceeded, StreamError{codes.DeadlineExceeded, context.DeadlineExceeded.Error()}},
- {context.Canceled, StreamError{codes.Canceled, context.Canceled.Error()}},
- } {
- err := ContextErr(test.errIn)
- if err != test.errOut {
- t.Fatalf("ContextErr{%v} = %v \nwant %v", test.errIn, err, test.errOut)
- }
- }
-}
-
-func max(a, b int32) int32 {
- if a > b {
- return a
- }
- return b
-}
-
-type windowSizeConfig struct {
- serverStream int32
- serverConn int32
- clientStream int32
- clientConn int32
-}
-
-func TestAccountCheckWindowSizeWithLargeWindow(t *testing.T) {
- wc := windowSizeConfig{
- serverStream: 10 * 1024 * 1024,
- serverConn: 12 * 1024 * 1024,
- clientStream: 6 * 1024 * 1024,
- clientConn: 8 * 1024 * 1024,
- }
- testFlowControlAccountCheck(t, 1024*1024, wc)
-}
-
-func TestAccountCheckWindowSizeWithSmallWindow(t *testing.T) {
- wc := windowSizeConfig{
- serverStream: defaultWindowSize,
- // Note this is smaller than initialConnWindowSize which is the current default.
- serverConn: defaultWindowSize,
- clientStream: defaultWindowSize,
- clientConn: defaultWindowSize,
- }
- testFlowControlAccountCheck(t, 1024*1024, wc)
-}
-
-func TestAccountCheckDynamicWindowSmallMessage(t *testing.T) {
- testFlowControlAccountCheck(t, 1024, windowSizeConfig{})
-}
-
-func TestAccountCheckDynamicWindowLargeMessage(t *testing.T) {
- testFlowControlAccountCheck(t, 1024*1024, windowSizeConfig{})
-}
-
-func testFlowControlAccountCheck(t *testing.T, msgSize int, wc windowSizeConfig) {
- sc := &ServerConfig{
- InitialWindowSize: wc.serverStream,
- InitialConnWindowSize: wc.serverConn,
- }
- co := ConnectOptions{
- InitialWindowSize: wc.clientStream,
- InitialConnWindowSize: wc.clientConn,
- }
- server, client := setUpWithOptions(t, 0, sc, pingpong, co, func() {})
- defer server.stop()
- defer client.Close()
- waitWhileTrue(t, func() (bool, error) {
- server.mu.Lock()
- defer server.mu.Unlock()
- if len(server.conns) == 0 {
- return true, fmt.Errorf("timed out while waiting for server transport to be created")
- }
- return false, nil
- })
- var st *http2Server
- server.mu.Lock()
- for k := range server.conns {
- st = k.(*http2Server)
- }
- server.mu.Unlock()
- ct := client.(*http2Client)
- cstream, err := client.NewStream(context.Background(), &CallHdr{})
- if err != nil {
- t.Fatalf("Failed to create stream. Err: %v", err)
- }
- msg := make([]byte, msgSize)
- buf := make([]byte, msgSize+5)
- buf[0] = byte(0)
- binary.BigEndian.PutUint32(buf[1:], uint32(msgSize))
- copy(buf[5:], msg)
- opts := Options{}
- header := make([]byte, 5)
- for i := 1; i <= 10; i++ {
- if err := ct.Write(cstream, nil, buf, &opts); err != nil {
- t.Fatalf("Error on client while writing message: %v", err)
- }
- if _, err := cstream.Read(header); err != nil {
- t.Fatalf("Error on client while reading data frame header: %v", err)
- }
- sz := binary.BigEndian.Uint32(header[1:])
- recvMsg := make([]byte, int(sz))
- if _, err := cstream.Read(recvMsg); err != nil {
- t.Fatalf("Error on client while reading data: %v", err)
- }
- if len(recvMsg) != len(msg) {
- t.Fatalf("Length of message received by client: %v, want: %v", len(recvMsg), len(msg))
- }
- }
- var sstream *Stream
- st.mu.Lock()
- for _, v := range st.activeStreams {
- sstream = v
- }
- st.mu.Unlock()
- loopyServerStream := st.loopy.estdStreams[sstream.id]
- loopyClientStream := ct.loopy.estdStreams[cstream.id]
- ct.Write(cstream, nil, nil, &Options{Last: true}) // Close the stream.
- if _, err := cstream.Read(header); err != io.EOF {
- t.Fatalf("Client expected an EOF from the server. Got: %v", err)
- }
- // Sleep for a little to make sure both sides flush out their buffers.
- time.Sleep(time.Millisecond * 500)
- // Close down both server and client so that their internals can be read without data
- // races.
- ct.Close()
- st.Close()
- <-st.readerDone
- <-st.writerDone
- <-ct.readerDone
- <-ct.writerDone
- // Check transport flow control.
- if ct.fc.limit != ct.fc.unacked+st.loopy.sendQuota {
- t.Fatalf("Account mismatch: client transport inflow(%d) != client unacked(%d) + server sendQuota(%d)", ct.fc.limit, ct.fc.unacked, st.loopy.sendQuota)
- }
- if st.fc.limit != st.fc.unacked+ct.loopy.sendQuota {
- t.Fatalf("Account mismatch: server transport inflow(%d) != server unacked(%d) + client sendQuota(%d)", st.fc.limit, st.fc.unacked, ct.loopy.sendQuota)
- }
- // Check stream flow control.
- if int(cstream.fc.limit+cstream.fc.delta-cstream.fc.pendingData-cstream.fc.pendingUpdate) != int(st.loopy.oiws)-loopyServerStream.bytesOutStanding {
- t.Fatalf("Account mismatch: client stream inflow limit(%d) + delta(%d) - pendingData(%d) - pendingUpdate(%d) != server outgoing InitialWindowSize(%d) - outgoingStream.bytesOutStanding(%d)", cstream.fc.limit, cstream.fc.delta, cstream.fc.pendingData, cstream.fc.pendingUpdate, st.loopy.oiws, loopyServerStream.bytesOutStanding)
- }
- if int(sstream.fc.limit+sstream.fc.delta-sstream.fc.pendingData-sstream.fc.pendingUpdate) != int(ct.loopy.oiws)-loopyClientStream.bytesOutStanding {
- t.Fatalf("Account mismatch: server stream inflow limit(%d) + delta(%d) - pendingData(%d) - pendingUpdate(%d) != client outgoing InitialWindowSize(%d) - outgoingStream.bytesOutStanding(%d)", sstream.fc.limit, sstream.fc.delta, sstream.fc.pendingData, sstream.fc.pendingUpdate, ct.loopy.oiws, loopyClientStream.bytesOutStanding)
- }
-}
-
-func waitWhileTrue(t *testing.T, condition func() (bool, error)) {
- var (
- wait bool
- err error
- )
- timer := time.NewTimer(time.Second * 5)
- for {
- wait, err = condition()
- if wait {
- select {
- case <-timer.C:
- t.Fatalf(err.Error())
- default:
- time.Sleep(50 * time.Millisecond)
- continue
- }
- }
- if !timer.Stop() {
- <-timer.C
- }
- break
- }
-}
-
-// A function of type writeHeaders writes out
-// http status with the given stream ID using the given framer.
-type writeHeaders func(*http2.Framer, uint32, int) error
-
-func writeOneHeader(framer *http2.Framer, sid uint32, httpStatus int) error {
- var buf bytes.Buffer
- henc := hpack.NewEncoder(&buf)
- henc.WriteField(hpack.HeaderField{Name: ":status", Value: fmt.Sprint(httpStatus)})
- return framer.WriteHeaders(http2.HeadersFrameParam{
- StreamID: sid,
- BlockFragment: buf.Bytes(),
- EndStream: true,
- EndHeaders: true,
- })
-}
-
-func writeTwoHeaders(framer *http2.Framer, sid uint32, httpStatus int) error {
- var buf bytes.Buffer
- henc := hpack.NewEncoder(&buf)
- henc.WriteField(hpack.HeaderField{
- Name: ":status",
- Value: fmt.Sprint(http.StatusOK),
- })
- if err := framer.WriteHeaders(http2.HeadersFrameParam{
- StreamID: sid,
- BlockFragment: buf.Bytes(),
- EndHeaders: true,
- }); err != nil {
- return err
- }
- buf.Reset()
- henc.WriteField(hpack.HeaderField{
- Name: ":status",
- Value: fmt.Sprint(httpStatus),
- })
- return framer.WriteHeaders(http2.HeadersFrameParam{
- StreamID: sid,
- BlockFragment: buf.Bytes(),
- EndStream: true,
- EndHeaders: true,
- })
-}
-
-type httpServer struct {
- conn net.Conn
- httpStatus int
- wh writeHeaders
-}
-
-func (s *httpServer) start(t *testing.T, lis net.Listener) {
- // Launch an HTTP server to send back header with httpStatus.
- go func() {
- var err error
- s.conn, err = lis.Accept()
- if err != nil {
- t.Errorf("Error accepting connection: %v", err)
- return
- }
- // Read preface sent by client.
- if _, err = io.ReadFull(s.conn, make([]byte, len(http2.ClientPreface))); err != nil {
- t.Errorf("Error at server-side while reading preface from client. Err: %v", err)
- return
- }
- reader := bufio.NewReaderSize(s.conn, defaultWriteBufSize)
- writer := bufio.NewWriterSize(s.conn, defaultReadBufSize)
- framer := http2.NewFramer(writer, reader)
- if err = framer.WriteSettingsAck(); err != nil {
- t.Errorf("Error at server-side while sending Settings ack. Err: %v", err)
- return
- }
- var sid uint32
- // Read frames until a header is received.
- for {
- frame, err := framer.ReadFrame()
- if err != nil {
- t.Errorf("Error at server-side while reading frame. Err: %v", err)
- return
- }
- if hframe, ok := frame.(*http2.HeadersFrame); ok {
- sid = hframe.Header().StreamID
- break
- }
- }
- if err = s.wh(framer, sid, s.httpStatus); err != nil {
- t.Errorf("Error at server-side while writing headers. Err: %v", err)
- return
- }
- writer.Flush()
- }()
-}
-
-func (s *httpServer) cleanUp() {
- if s.conn != nil {
- s.conn.Close()
- }
-}
-
-func setUpHTTPStatusTest(t *testing.T, httpStatus int, wh writeHeaders) (stream *Stream, cleanUp func()) {
- var (
- err error
- lis net.Listener
- server *httpServer
- client ClientTransport
- )
- cleanUp = func() {
- if lis != nil {
- lis.Close()
- }
- if server != nil {
- server.cleanUp()
- }
- if client != nil {
- client.Close()
- }
- }
- defer func() {
- if err != nil {
- cleanUp()
- }
- }()
- lis, err = net.Listen("tcp", "localhost:0")
- if err != nil {
- t.Fatalf("Failed to listen. Err: %v", err)
- }
- server = &httpServer{
- httpStatus: httpStatus,
- wh: wh,
- }
- server.start(t, lis)
- connectCtx, cancel := context.WithDeadline(context.Background(), time.Now().Add(2*time.Second))
- client, err = newHTTP2Client(connectCtx, context.Background(), TargetInfo{Addr: lis.Addr().String()}, ConnectOptions{}, func() {})
- if err != nil {
- cancel() // Do not cancel in success path.
- t.Fatalf("Error creating client. Err: %v", err)
- }
- stream, err = client.NewStream(context.Background(), &CallHdr{Method: "bogus/method", Flush: true})
- if err != nil {
- t.Fatalf("Error creating stream at client-side. Err: %v", err)
- }
- return
-}
-
-func TestHTTPToGRPCStatusMapping(t *testing.T) {
- for k := range httpStatusConvTab {
- testHTTPToGRPCStatusMapping(t, k, writeOneHeader)
- }
-}
-
-func testHTTPToGRPCStatusMapping(t *testing.T, httpStatus int, wh writeHeaders) {
- stream, cleanUp := setUpHTTPStatusTest(t, httpStatus, wh)
- defer cleanUp()
- want := httpStatusConvTab[httpStatus]
- buf := make([]byte, 8)
- _, err := stream.Read(buf)
- if err == nil {
- t.Fatalf("Stream.Read(_) unexpectedly returned no error. Expected stream error with code %v", want)
- }
- serr, ok := err.(StreamError)
- if !ok {
- t.Fatalf("err.(Type) = %T, want StreamError", err)
- }
- if want != serr.Code {
- t.Fatalf("Want error code: %v, got: %v", want, serr.Code)
- }
-}
-
-func TestHTTPStatusOKAndMissingGRPCStatus(t *testing.T) {
- stream, cleanUp := setUpHTTPStatusTest(t, http.StatusOK, writeOneHeader)
- defer cleanUp()
- buf := make([]byte, 8)
- _, err := stream.Read(buf)
- if err != io.EOF {
- t.Fatalf("stream.Read(_) = _, %v, want _, io.EOF", err)
- }
- want := codes.Unknown
- if stream.status.Code() != want {
- t.Fatalf("Status code of stream: %v, want: %v", stream.status.Code(), want)
- }
-}
-
-func TestHTTPStatusNottOKAndMissingGRPCStatusInSecondHeader(t *testing.T) {
- testHTTPToGRPCStatusMapping(t, http.StatusUnauthorized, writeTwoHeaders)
-}
-
-// If any error occurs on a call to Stream.Read, future calls
-// should continue to return that same error.
-func TestReadGivesSameErrorAfterAnyErrorOccurs(t *testing.T) {
- testRecvBuffer := newRecvBuffer()
- s := &Stream{
- ctx: context.Background(),
- buf: testRecvBuffer,
- requestRead: func(int) {},
- }
- s.trReader = &transportReader{
- reader: &recvBufferReader{
- ctx: s.ctx,
- ctxDone: s.ctx.Done(),
- recv: s.buf,
- },
- windowHandler: func(int) {},
- }
- testData := make([]byte, 1)
- testData[0] = 5
- testErr := errors.New("test error")
- s.write(recvMsg{data: testData, err: testErr})
-
- inBuf := make([]byte, 1)
- actualCount, actualErr := s.Read(inBuf)
- if actualCount != 0 {
- t.Errorf("actualCount, _ := s.Read(_) differs; want 0; got %v", actualCount)
- }
- if actualErr.Error() != testErr.Error() {
- t.Errorf("_ , actualErr := s.Read(_) differs; want actualErr.Error() to be %v; got %v", testErr.Error(), actualErr.Error())
- }
-
- s.write(recvMsg{data: testData, err: nil})
- s.write(recvMsg{data: testData, err: errors.New("different error from first")})
-
- for i := 0; i < 2; i++ {
- inBuf := make([]byte, 1)
- actualCount, actualErr := s.Read(inBuf)
- if actualCount != 0 {
- t.Errorf("actualCount, _ := s.Read(_) differs; want %v; got %v", 0, actualCount)
- }
- if actualErr.Error() != testErr.Error() {
- t.Errorf("_ , actualErr := s.Read(_) differs; want actualErr.Error() to be %v; got %v", testErr.Error(), actualErr.Error())
- }
- }
-}
-
-func TestPingPong1B(t *testing.T) {
- runPingPongTest(t, 1)
-}
-
-func TestPingPong1KB(t *testing.T) {
- runPingPongTest(t, 1024)
-}
-
-func TestPingPong64KB(t *testing.T) {
- runPingPongTest(t, 65536)
-}
-
-func TestPingPong1MB(t *testing.T) {
- runPingPongTest(t, 1048576)
-}
-
-//This is a stress-test of flow control logic.
-func runPingPongTest(t *testing.T, msgSize int) {
- server, client := setUp(t, 0, 0, pingpong)
- defer server.stop()
- defer client.Close()
- waitWhileTrue(t, func() (bool, error) {
- server.mu.Lock()
- defer server.mu.Unlock()
- if len(server.conns) == 0 {
- return true, fmt.Errorf("timed out while waiting for server transport to be created")
- }
- return false, nil
- })
- ct := client.(*http2Client)
- stream, err := client.NewStream(context.Background(), &CallHdr{})
- if err != nil {
- t.Fatalf("Failed to create stream. Err: %v", err)
- }
- msg := make([]byte, msgSize)
- outgoingHeader := make([]byte, 5)
- outgoingHeader[0] = byte(0)
- binary.BigEndian.PutUint32(outgoingHeader[1:], uint32(msgSize))
- opts := &Options{}
- incomingHeader := make([]byte, 5)
- done := make(chan struct{})
- go func() {
- timer := time.NewTimer(time.Second * 5)
- <-timer.C
- close(done)
- }()
- for {
- select {
- case <-done:
- ct.Write(stream, nil, nil, &Options{Last: true})
- if _, err := stream.Read(incomingHeader); err != io.EOF {
- t.Fatalf("Client expected EOF from the server. Got: %v", err)
- }
- return
- default:
- if err := ct.Write(stream, outgoingHeader, msg, opts); err != nil {
- t.Fatalf("Error on client while writing message. Err: %v", err)
- }
- if _, err := stream.Read(incomingHeader); err != nil {
- t.Fatalf("Error on client while reading data header. Err: %v", err)
- }
- sz := binary.BigEndian.Uint32(incomingHeader[1:])
- recvMsg := make([]byte, int(sz))
- if _, err := stream.Read(recvMsg); err != nil {
- t.Fatalf("Error on client while reading data. Err: %v", err)
- }
- }
- }
-}
-
-type tableSizeLimit struct {
- mu sync.Mutex
- limits []uint32
-}
-
-func (t *tableSizeLimit) add(limit uint32) {
- t.mu.Lock()
- t.limits = append(t.limits, limit)
- t.mu.Unlock()
-}
-
-func (t *tableSizeLimit) getLen() int {
- t.mu.Lock()
- defer t.mu.Unlock()
- return len(t.limits)
-}
-
-func (t *tableSizeLimit) getIndex(i int) uint32 {
- t.mu.Lock()
- defer t.mu.Unlock()
- return t.limits[i]
-}
-
-func TestHeaderTblSize(t *testing.T) {
- limits := &tableSizeLimit{}
- updateHeaderTblSize = func(e *hpack.Encoder, v uint32) {
- e.SetMaxDynamicTableSizeLimit(v)
- limits.add(v)
- }
- defer func() {
- updateHeaderTblSize = func(e *hpack.Encoder, v uint32) {
- e.SetMaxDynamicTableSizeLimit(v)
- }
- }()
-
- server, ct := setUp(t, 0, math.MaxUint32, normal)
- defer ct.Close()
- defer server.stop()
- _, err := ct.NewStream(context.Background(), &CallHdr{})
- if err != nil {
- t.Fatalf("failed to open stream: %v", err)
- }
-
- var svrTransport ServerTransport
- var i int
- for i = 0; i < 1000; i++ {
- server.mu.Lock()
- if len(server.conns) != 0 {
- server.mu.Unlock()
- break
- }
- server.mu.Unlock()
- time.Sleep(10 * time.Millisecond)
- continue
- }
- if i == 1000 {
- t.Fatalf("unable to create any server transport after 10s")
- }
-
- for st := range server.conns {
- svrTransport = st
- break
- }
- svrTransport.(*http2Server).controlBuf.put(&outgoingSettings{
- ss: []http2.Setting{
- {
- ID: http2.SettingHeaderTableSize,
- Val: uint32(100),
- },
- },
- })
-
- for i = 0; i < 1000; i++ {
- if limits.getLen() != 1 {
- time.Sleep(10 * time.Millisecond)
- continue
- }
- if val := limits.getIndex(0); val != uint32(100) {
- t.Fatalf("expected limits[0] = 100, got %d", val)
- }
- break
- }
- if i == 1000 {
- t.Fatalf("expected len(limits) = 1 within 10s, got != 1")
- }
-
- ct.(*http2Client).controlBuf.put(&outgoingSettings{
- ss: []http2.Setting{
- {
- ID: http2.SettingHeaderTableSize,
- Val: uint32(200),
- },
- },
- })
-
- for i := 0; i < 1000; i++ {
- if limits.getLen() != 2 {
- time.Sleep(10 * time.Millisecond)
- continue
- }
- if val := limits.getIndex(1); val != uint32(200) {
- t.Fatalf("expected limits[1] = 200, got %d", val)
- }
- break
- }
- if i == 1000 {
- t.Fatalf("expected len(limits) = 2 within 10s, got != 2")
- }
-}
diff --git a/vendor/gopkg.in/inf.v0/benchmark_test.go b/vendor/gopkg.in/inf.v0/benchmark_test.go
deleted file mode 100644
index 27071da0e..000000000
--- a/vendor/gopkg.in/inf.v0/benchmark_test.go
+++ /dev/null
@@ -1,210 +0,0 @@
-package inf
-
-import (
- "fmt"
- "math/big"
- "math/rand"
- "sync"
- "testing"
-)
-
-const maxcap = 1024 * 1024
-const bits = 256
-const maxscale = 32
-
-var once sync.Once
-
-var decInput [][2]Dec
-var intInput [][2]big.Int
-
-var initBench = func() {
- decInput = make([][2]Dec, maxcap)
- intInput = make([][2]big.Int, maxcap)
- max := new(big.Int).Lsh(big.NewInt(1), bits)
- r := rand.New(rand.NewSource(0))
- for i := 0; i < cap(decInput); i++ {
- decInput[i][0].SetUnscaledBig(new(big.Int).Rand(r, max)).
- SetScale(Scale(r.Int31n(int32(2*maxscale-1)) - int32(maxscale)))
- decInput[i][1].SetUnscaledBig(new(big.Int).Rand(r, max)).
- SetScale(Scale(r.Int31n(int32(2*maxscale-1)) - int32(maxscale)))
- }
- for i := 0; i < cap(intInput); i++ {
- intInput[i][0].Rand(r, max)
- intInput[i][1].Rand(r, max)
- }
-}
-
-func doBenchmarkDec1(b *testing.B, f func(z *Dec)) {
- once.Do(initBench)
- b.ResetTimer()
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- f(&decInput[i%maxcap][0])
- }
-}
-
-func doBenchmarkDec2(b *testing.B, f func(x, y *Dec)) {
- once.Do(initBench)
- b.ResetTimer()
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- f(&decInput[i%maxcap][0], &decInput[i%maxcap][1])
- }
-}
-
-func doBenchmarkInt1(b *testing.B, f func(z *big.Int)) {
- once.Do(initBench)
- b.ResetTimer()
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- f(&intInput[i%maxcap][0])
- }
-}
-
-func doBenchmarkInt2(b *testing.B, f func(x, y *big.Int)) {
- once.Do(initBench)
- b.ResetTimer()
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- f(&intInput[i%maxcap][0], &intInput[i%maxcap][1])
- }
-}
-
-func Benchmark_Dec_String(b *testing.B) {
- doBenchmarkDec1(b, func(x *Dec) {
- x.String()
- })
-}
-
-func Benchmark_Dec_StringScan(b *testing.B) {
- doBenchmarkDec1(b, func(x *Dec) {
- s := x.String()
- d := new(Dec)
- fmt.Sscan(s, d)
- })
-}
-
-func Benchmark_Dec_GobEncode(b *testing.B) {
- doBenchmarkDec1(b, func(x *Dec) {
- x.GobEncode()
- })
-}
-
-func Benchmark_Dec_GobEnDecode(b *testing.B) {
- doBenchmarkDec1(b, func(x *Dec) {
- g, _ := x.GobEncode()
- new(Dec).GobDecode(g)
- })
-}
-
-func Benchmark_Dec_Add(b *testing.B) {
- doBenchmarkDec2(b, func(x, y *Dec) {
- ys := y.Scale()
- y.SetScale(x.Scale())
- _ = new(Dec).Add(x, y)
- y.SetScale(ys)
- })
-}
-
-func Benchmark_Dec_AddMixed(b *testing.B) {
- doBenchmarkDec2(b, func(x, y *Dec) {
- _ = new(Dec).Add(x, y)
- })
-}
-
-func Benchmark_Dec_Sub(b *testing.B) {
- doBenchmarkDec2(b, func(x, y *Dec) {
- ys := y.Scale()
- y.SetScale(x.Scale())
- _ = new(Dec).Sub(x, y)
- y.SetScale(ys)
- })
-}
-
-func Benchmark_Dec_SubMixed(b *testing.B) {
- doBenchmarkDec2(b, func(x, y *Dec) {
- _ = new(Dec).Sub(x, y)
- })
-}
-
-func Benchmark_Dec_Mul(b *testing.B) {
- doBenchmarkDec2(b, func(x, y *Dec) {
- _ = new(Dec).Mul(x, y)
- })
-}
-
-func Benchmark_Dec_Mul_QuoExact(b *testing.B) {
- doBenchmarkDec2(b, func(x, y *Dec) {
- v := new(Dec).Mul(x, y)
- _ = new(Dec).QuoExact(v, y)
- })
-}
-
-func Benchmark_Dec_QuoRound_Fixed_Down(b *testing.B) {
- doBenchmarkDec2(b, func(x, y *Dec) {
- _ = new(Dec).QuoRound(x, y, 0, RoundDown)
- })
-}
-
-func Benchmark_Dec_QuoRound_Fixed_HalfUp(b *testing.B) {
- doBenchmarkDec2(b, func(x, y *Dec) {
- _ = new(Dec).QuoRound(x, y, 0, RoundHalfUp)
- })
-}
-
-func Benchmark_Int_String(b *testing.B) {
- doBenchmarkInt1(b, func(x *big.Int) {
- x.String()
- })
-}
-
-func Benchmark_Int_StringScan(b *testing.B) {
- doBenchmarkInt1(b, func(x *big.Int) {
- s := x.String()
- d := new(big.Int)
- fmt.Sscan(s, d)
- })
-}
-
-func Benchmark_Int_GobEncode(b *testing.B) {
- doBenchmarkInt1(b, func(x *big.Int) {
- x.GobEncode()
- })
-}
-
-func Benchmark_Int_GobEnDecode(b *testing.B) {
- doBenchmarkInt1(b, func(x *big.Int) {
- g, _ := x.GobEncode()
- new(big.Int).GobDecode(g)
- })
-}
-
-func Benchmark_Int_Add(b *testing.B) {
- doBenchmarkInt2(b, func(x, y *big.Int) {
- _ = new(big.Int).Add(x, y)
- })
-}
-
-func Benchmark_Int_Sub(b *testing.B) {
- doBenchmarkInt2(b, func(x, y *big.Int) {
- _ = new(big.Int).Sub(x, y)
- })
-}
-
-func Benchmark_Int_Mul(b *testing.B) {
- doBenchmarkInt2(b, func(x, y *big.Int) {
- _ = new(big.Int).Mul(x, y)
- })
-}
-
-func Benchmark_Int_Quo(b *testing.B) {
- doBenchmarkInt2(b, func(x, y *big.Int) {
- _ = new(big.Int).Quo(x, y)
- })
-}
-
-func Benchmark_Int_QuoRem(b *testing.B) {
- doBenchmarkInt2(b, func(x, y *big.Int) {
- _, _ = new(big.Int).QuoRem(x, y, new(big.Int))
- })
-}
diff --git a/vendor/gopkg.in/inf.v0/dec_go1_2_test.go b/vendor/gopkg.in/inf.v0/dec_go1_2_test.go
deleted file mode 100644
index 5df0f7b55..000000000
--- a/vendor/gopkg.in/inf.v0/dec_go1_2_test.go
+++ /dev/null
@@ -1,33 +0,0 @@
-// +build go1.2
-
-package inf
-
-import (
- "encoding"
- "encoding/json"
- "testing"
-)
-
-var _ encoding.TextMarshaler = new(Dec)
-var _ encoding.TextUnmarshaler = new(Dec)
-
-type Obj struct {
- Val *Dec
-}
-
-func TestDecJsonMarshalUnmarshal(t *testing.T) {
- o := Obj{Val: NewDec(123, 2)}
- js, err := json.Marshal(o)
- if err != nil {
- t.Fatalf("json.Marshal(%v): got %v, want ok", o, err)
- }
- o2 := &Obj{}
- err = json.Unmarshal(js, o2)
- if err != nil {
- t.Fatalf("json.Unmarshal(%#q): got %v, want ok", js, err)
- }
- if o.Val.Scale() != o2.Val.Scale() ||
- o.Val.UnscaledBig().Cmp(o2.Val.UnscaledBig()) != 0 {
- t.Fatalf("json.Unmarshal(json.Marshal(%v)): want %v, got %v", o, o, o2)
- }
-}
diff --git a/vendor/gopkg.in/inf.v0/dec_internal_test.go b/vendor/gopkg.in/inf.v0/dec_internal_test.go
deleted file mode 100644
index d4fbe3e5b..000000000
--- a/vendor/gopkg.in/inf.v0/dec_internal_test.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package inf
-
-import (
- "math/big"
- "testing"
-)
-
-var decQuoRemZZZ = []struct {
- z, x, y *Dec
- r *big.Rat
- srA, srB int
-}{
- // basic examples
- {NewDec(1, 0), NewDec(2, 0), NewDec(2, 0), big.NewRat(0, 1), 0, 1},
- {NewDec(15, 1), NewDec(3, 0), NewDec(2, 0), big.NewRat(0, 1), 0, 1},
- {NewDec(1, 1), NewDec(1, 0), NewDec(10, 0), big.NewRat(0, 1), 0, 1},
- {NewDec(0, 0), NewDec(2, 0), NewDec(3, 0), big.NewRat(2, 3), 1, 1},
- {NewDec(0, 0), NewDec(2, 0), NewDec(6, 0), big.NewRat(1, 3), 1, 1},
- {NewDec(1, 1), NewDec(2, 0), NewDec(12, 0), big.NewRat(2, 3), 1, 1},
-
- // examples from the Go Language Specification
- {NewDec(1, 0), NewDec(5, 0), NewDec(3, 0), big.NewRat(2, 3), 1, 1},
- {NewDec(-1, 0), NewDec(-5, 0), NewDec(3, 0), big.NewRat(-2, 3), -1, 1},
- {NewDec(-1, 0), NewDec(5, 0), NewDec(-3, 0), big.NewRat(-2, 3), 1, -1},
- {NewDec(1, 0), NewDec(-5, 0), NewDec(-3, 0), big.NewRat(2, 3), -1, -1},
-}
-
-func TestDecQuoRem(t *testing.T) {
- for i, a := range decQuoRemZZZ {
- z, rA, rB := new(Dec), new(big.Int), new(big.Int)
- s := scaleQuoExact{}.Scale(a.x, a.y)
- z.quoRem(a.x, a.y, s, true, rA, rB)
- if a.z.Cmp(z) != 0 || a.r.Cmp(new(big.Rat).SetFrac(rA, rB)) != 0 {
- t.Errorf("#%d QuoRemZZZ got %v, %v, %v; expected %v, %v", i, z, rA, rB, a.z, a.r)
- }
- if a.srA != rA.Sign() || a.srB != rB.Sign() {
- t.Errorf("#%d QuoRemZZZ wrong signs, got %v, %v; expected %v, %v", i, rA.Sign(), rB.Sign(), a.srA, a.srB)
- }
- }
-}
diff --git a/vendor/gopkg.in/inf.v0/dec_test.go b/vendor/gopkg.in/inf.v0/dec_test.go
deleted file mode 100644
index e4b09b3fd..000000000
--- a/vendor/gopkg.in/inf.v0/dec_test.go
+++ /dev/null
@@ -1,379 +0,0 @@
-package inf_test
-
-import (
- "bytes"
- "encoding/gob"
- "fmt"
- "math/big"
- "strings"
- "testing"
-
- "gopkg.in/inf.v0"
-)
-
-type decFunZZ func(z, x, y *inf.Dec) *inf.Dec
-type decArgZZ struct {
- z, x, y *inf.Dec
-}
-
-var decSumZZ = []decArgZZ{
- {inf.NewDec(0, 0), inf.NewDec(0, 0), inf.NewDec(0, 0)},
- {inf.NewDec(1, 0), inf.NewDec(1, 0), inf.NewDec(0, 0)},
- {inf.NewDec(1111111110, 0), inf.NewDec(123456789, 0), inf.NewDec(987654321, 0)},
- {inf.NewDec(-1, 0), inf.NewDec(-1, 0), inf.NewDec(0, 0)},
- {inf.NewDec(864197532, 0), inf.NewDec(-123456789, 0), inf.NewDec(987654321, 0)},
- {inf.NewDec(-1111111110, 0), inf.NewDec(-123456789, 0), inf.NewDec(-987654321, 0)},
- {inf.NewDec(12, 2), inf.NewDec(1, 1), inf.NewDec(2, 2)},
-}
-
-var decProdZZ = []decArgZZ{
- {inf.NewDec(0, 0), inf.NewDec(0, 0), inf.NewDec(0, 0)},
- {inf.NewDec(0, 0), inf.NewDec(1, 0), inf.NewDec(0, 0)},
- {inf.NewDec(1, 0), inf.NewDec(1, 0), inf.NewDec(1, 0)},
- {inf.NewDec(-991*991, 0), inf.NewDec(991, 0), inf.NewDec(-991, 0)},
- {inf.NewDec(2, 3), inf.NewDec(1, 1), inf.NewDec(2, 2)},
- {inf.NewDec(2, -3), inf.NewDec(1, -1), inf.NewDec(2, -2)},
- {inf.NewDec(2, 3), inf.NewDec(1, 1), inf.NewDec(2, 2)},
-}
-
-func TestDecSignZ(t *testing.T) {
- var zero inf.Dec
- for _, a := range decSumZZ {
- s := a.z.Sign()
- e := a.z.Cmp(&zero)
- if s != e {
- t.Errorf("got %d; want %d for z = %v", s, e, a.z)
- }
- }
-}
-
-func TestDecAbsZ(t *testing.T) {
- var zero inf.Dec
- for _, a := range decSumZZ {
- var z inf.Dec
- z.Abs(a.z)
- var e inf.Dec
- e.Set(a.z)
- if e.Cmp(&zero) < 0 {
- e.Sub(&zero, &e)
- }
- if z.Cmp(&e) != 0 {
- t.Errorf("got z = %v; want %v", z, e)
- }
- }
-}
-
-func testDecFunZZ(t *testing.T, msg string, f decFunZZ, a decArgZZ) {
- var z inf.Dec
- f(&z, a.x, a.y)
- if (&z).Cmp(a.z) != 0 {
- t.Errorf("%s%+v\n\tgot z = %v; want %v", msg, a, &z, a.z)
- }
-}
-
-func TestDecSumZZ(t *testing.T) {
- AddZZ := func(z, x, y *inf.Dec) *inf.Dec { return z.Add(x, y) }
- SubZZ := func(z, x, y *inf.Dec) *inf.Dec { return z.Sub(x, y) }
- for _, a := range decSumZZ {
- arg := a
- testDecFunZZ(t, "AddZZ", AddZZ, arg)
-
- arg = decArgZZ{a.z, a.y, a.x}
- testDecFunZZ(t, "AddZZ symmetric", AddZZ, arg)
-
- arg = decArgZZ{a.x, a.z, a.y}
- testDecFunZZ(t, "SubZZ", SubZZ, arg)
-
- arg = decArgZZ{a.y, a.z, a.x}
- testDecFunZZ(t, "SubZZ symmetric", SubZZ, arg)
- }
-}
-
-func TestDecProdZZ(t *testing.T) {
- MulZZ := func(z, x, y *inf.Dec) *inf.Dec { return z.Mul(x, y) }
- for _, a := range decProdZZ {
- arg := a
- testDecFunZZ(t, "MulZZ", MulZZ, arg)
-
- arg = decArgZZ{a.z, a.y, a.x}
- testDecFunZZ(t, "MulZZ symmetric", MulZZ, arg)
- }
-}
-
-var decUnscaledTests = []struct {
- d *inf.Dec
- u int64 // ignored when ok == false
- ok bool
-}{
- {new(inf.Dec), 0, true},
- {inf.NewDec(-1<<63, 0), -1 << 63, true},
- {inf.NewDec(-(-1<<63 + 1), 0), -(-1<<63 + 1), true},
- {new(inf.Dec).Neg(inf.NewDec(-1<<63, 0)), 0, false},
- {new(inf.Dec).Sub(inf.NewDec(-1<<63, 0), inf.NewDec(1, 0)), 0, false},
- {inf.NewDecBig(new(big.Int).Lsh(big.NewInt(1), 64), 0), 0, false},
-}
-
-func TestDecUnscaled(t *testing.T) {
- for i, tt := range decUnscaledTests {
- u, ok := tt.d.Unscaled()
- if ok != tt.ok {
- t.Errorf("#%d Unscaled: got %v, expected %v", i, ok, tt.ok)
- } else if ok && u != tt.u {
- t.Errorf("#%d Unscaled: got %v, expected %v", i, u, tt.u)
- }
- }
-}
-
-var decRoundTests = [...]struct {
- in *inf.Dec
- s inf.Scale
- r inf.Rounder
- exp *inf.Dec
-}{
- {inf.NewDec(123424999999999993, 15), 2, inf.RoundHalfUp, inf.NewDec(12342, 2)},
- {inf.NewDec(123425000000000001, 15), 2, inf.RoundHalfUp, inf.NewDec(12343, 2)},
- {inf.NewDec(123424999999999993, 15), 15, inf.RoundHalfUp, inf.NewDec(123424999999999993, 15)},
- {inf.NewDec(123424999999999993, 15), 16, inf.RoundHalfUp, inf.NewDec(1234249999999999930, 16)},
- {inf.NewDecBig(new(big.Int).Lsh(big.NewInt(1), 64), 0), -1, inf.RoundHalfUp, inf.NewDec(1844674407370955162, -1)},
- {inf.NewDecBig(new(big.Int).Lsh(big.NewInt(1), 64), 0), -2, inf.RoundHalfUp, inf.NewDec(184467440737095516, -2)},
- {inf.NewDecBig(new(big.Int).Lsh(big.NewInt(1), 64), 0), -3, inf.RoundHalfUp, inf.NewDec(18446744073709552, -3)},
- {inf.NewDecBig(new(big.Int).Lsh(big.NewInt(1), 64), 0), -4, inf.RoundHalfUp, inf.NewDec(1844674407370955, -4)},
- {inf.NewDecBig(new(big.Int).Lsh(big.NewInt(1), 64), 0), -5, inf.RoundHalfUp, inf.NewDec(184467440737096, -5)},
- {inf.NewDecBig(new(big.Int).Lsh(big.NewInt(1), 64), 0), -6, inf.RoundHalfUp, inf.NewDec(18446744073710, -6)},
-}
-
-func TestDecRound(t *testing.T) {
- for i, tt := range decRoundTests {
- z := new(inf.Dec).Round(tt.in, tt.s, tt.r)
- if tt.exp.Cmp(z) != 0 {
- t.Errorf("#%d Round got %v; expected %v", i, z, tt.exp)
- }
- }
-}
-
-var decStringTests = []struct {
- in string
- out string
- val int64
- scale inf.Scale // skip SetString if negative
- ok bool
- scanOk bool
-}{
- {in: "", ok: false, scanOk: false},
- {in: "a", ok: false, scanOk: false},
- {in: "z", ok: false, scanOk: false},
- {in: "+", ok: false, scanOk: false},
- {in: "-", ok: false, scanOk: false},
- {in: "g", ok: false, scanOk: false},
- {in: ".", ok: false, scanOk: false},
- {in: ".-0", ok: false, scanOk: false},
- {in: ".+0", ok: false, scanOk: false},
- // Scannable but not SetStringable
- {"0b", "ignored", 0, 0, false, true},
- {"0x", "ignored", 0, 0, false, true},
- {"0xg", "ignored", 0, 0, false, true},
- {"0.0g", "ignored", 0, 1, false, true},
- // examples from godoc for Dec
- {"0", "0", 0, 0, true, true},
- {"0.00", "0.00", 0, 2, true, true},
- {"ignored", "0", 0, -2, true, false},
- {"1", "1", 1, 0, true, true},
- {"1.00", "1.00", 100, 2, true, true},
- {"10", "10", 10, 0, true, true},
- {"ignored", "10", 1, -1, true, false},
- // other tests
- {"+0", "0", 0, 0, true, true},
- {"-0", "0", 0, 0, true, true},
- {"0.0", "0.0", 0, 1, true, true},
- {"0.1", "0.1", 1, 1, true, true},
- {"0.", "0", 0, 0, true, true},
- {"-10", "-10", -1, -1, true, true},
- {"-1", "-1", -1, 0, true, true},
- {"-0.1", "-0.1", -1, 1, true, true},
- {"-0.01", "-0.01", -1, 2, true, true},
- {"+0.", "0", 0, 0, true, true},
- {"-0.", "0", 0, 0, true, true},
- {".0", "0.0", 0, 1, true, true},
- {"+.0", "0.0", 0, 1, true, true},
- {"-.0", "0.0", 0, 1, true, true},
- {"0.0000000000", "0.0000000000", 0, 10, true, true},
- {"0.0000000001", "0.0000000001", 1, 10, true, true},
- {"-0.0000000000", "0.0000000000", 0, 10, true, true},
- {"-0.0000000001", "-0.0000000001", -1, 10, true, true},
- {"-10", "-10", -10, 0, true, true},
- {"+10", "10", 10, 0, true, true},
- {"00", "0", 0, 0, true, true},
- {"023", "23", 23, 0, true, true}, // decimal, not octal
- {"-02.3", "-2.3", -23, 1, true, true}, // decimal, not octal
-}
-
-func TestDecGetString(t *testing.T) {
- z := new(inf.Dec)
- for i, test := range decStringTests {
- if !test.ok {
- continue
- }
- z.SetUnscaled(test.val)
- z.SetScale(test.scale)
-
- s := z.String()
- if s != test.out {
- t.Errorf("#%da got %s; want %s", i, s, test.out)
- }
-
- s = fmt.Sprintf("%d", z)
- if s != test.out {
- t.Errorf("#%db got %s; want %s", i, s, test.out)
- }
- }
-}
-
-func TestDecSetString(t *testing.T) {
- tmp := new(inf.Dec)
- for i, test := range decStringTests {
- if test.scale < 0 {
- // SetString only supports scale >= 0
- continue
- }
- // initialize to a non-zero value so that issues with parsing
- // 0 are detected
- tmp.Set(inf.NewDec(1234567890, 123))
- n1, ok1 := new(inf.Dec).SetString(test.in)
- n2, ok2 := tmp.SetString(test.in)
- expected := inf.NewDec(test.val, test.scale)
- if ok1 != test.ok || ok2 != test.ok {
- t.Errorf("#%d (input '%s') ok incorrect (should be %t)", i, test.in, test.ok)
- continue
- }
- if !ok1 {
- if n1 != nil {
- t.Errorf("#%d (input '%s') n1 != nil", i, test.in)
- }
- continue
- }
- if !ok2 {
- if n2 != nil {
- t.Errorf("#%d (input '%s') n2 != nil", i, test.in)
- }
- continue
- }
-
- if n1.Cmp(expected) != 0 {
- t.Errorf("#%d (input '%s') got: %s want: %d", i, test.in, n1, test.val)
- }
- if n2.Cmp(expected) != 0 {
- t.Errorf("#%d (input '%s') got: %s want: %d", i, test.in, n2, test.val)
- }
- }
-}
-
-func TestDecScan(t *testing.T) {
- tmp := new(inf.Dec)
- for i, test := range decStringTests {
- if test.scale < 0 {
- // SetString only supports scale >= 0
- continue
- }
- // initialize to a non-zero value so that issues with parsing
- // 0 are detected
- tmp.Set(inf.NewDec(1234567890, 123))
- n1, n2 := new(inf.Dec), tmp
- nn1, err1 := fmt.Sscan(test.in, n1)
- nn2, err2 := fmt.Sscan(test.in, n2)
- if !test.scanOk {
- if err1 == nil || err2 == nil {
- t.Errorf("#%d (input '%s') ok incorrect, should be %t", i, test.in, test.scanOk)
- }
- continue
- }
- expected := inf.NewDec(test.val, test.scale)
- if nn1 != 1 || err1 != nil || nn2 != 1 || err2 != nil {
- t.Errorf("#%d (input '%s') error %d %v, %d %v", i, test.in, nn1, err1, nn2, err2)
- continue
- }
- if n1.Cmp(expected) != 0 {
- t.Errorf("#%d (input '%s') got: %s want: %d", i, test.in, n1, test.val)
- }
- if n2.Cmp(expected) != 0 {
- t.Errorf("#%d (input '%s') got: %s want: %d", i, test.in, n2, test.val)
- }
- }
-}
-
-var decScanNextTests = []struct {
- in string
- ok bool
- next rune
-}{
- {"", false, 0},
- {"a", false, 'a'},
- {"z", false, 'z'},
- {"+", false, 0},
- {"-", false, 0},
- {"g", false, 'g'},
- {".", false, 0},
- {".-0", false, '-'},
- {".+0", false, '+'},
- {"0b", true, 'b'},
- {"0x", true, 'x'},
- {"0xg", true, 'x'},
- {"0.0g", true, 'g'},
-}
-
-func TestDecScanNext(t *testing.T) {
- for i, test := range decScanNextTests {
- rdr := strings.NewReader(test.in)
- n1 := new(inf.Dec)
- nn1, _ := fmt.Fscan(rdr, n1)
- if (test.ok && nn1 == 0) || (!test.ok && nn1 > 0) {
- t.Errorf("#%d (input '%s') ok incorrect should be %t", i, test.in, test.ok)
- continue
- }
- r := rune(0)
- nn2, err := fmt.Fscanf(rdr, "%c", &r)
- if test.next != r {
- t.Errorf("#%d (input '%s') next incorrect, got %c should be %c, %d, %v", i, test.in, r, test.next, nn2, err)
- }
- }
-}
-
-var decGobEncodingTests = []string{
- "0",
- "1",
- "2",
- "10",
- "42",
- "1234567890",
- "298472983472983471903246121093472394872319615612417471234712061",
-}
-
-func TestDecGobEncoding(t *testing.T) {
- var medium bytes.Buffer
- enc := gob.NewEncoder(&medium)
- dec := gob.NewDecoder(&medium)
- for i, test := range decGobEncodingTests {
- for j := 0; j < 2; j++ {
- for k := inf.Scale(-5); k <= 5; k++ {
- medium.Reset() // empty buffer for each test case (in case of failures)
- stest := test
- if j != 0 {
- // negative numbers
- stest = "-" + test
- }
- var tx inf.Dec
- tx.SetString(stest)
- tx.SetScale(k) // test with positive, negative, and zero scale
- if err := enc.Encode(&tx); err != nil {
- t.Errorf("#%d%c: encoding failed: %s", i, 'a'+j, err)
- }
- var rx inf.Dec
- if err := dec.Decode(&rx); err != nil {
- t.Errorf("#%d%c: decoding failed: %s", i, 'a'+j, err)
- }
- if rx.Cmp(&tx) != 0 {
- t.Errorf("#%d%c: transmission failed: got %s want %s", i, 'a'+j, &rx, &tx)
- }
- }
- }
- }
-}
diff --git a/vendor/gopkg.in/inf.v0/example_test.go b/vendor/gopkg.in/inf.v0/example_test.go
deleted file mode 100644
index fa1e54d16..000000000
--- a/vendor/gopkg.in/inf.v0/example_test.go
+++ /dev/null
@@ -1,62 +0,0 @@
-package inf_test
-
-import (
- "fmt"
- "log"
-)
-
-import "gopkg.in/inf.v0"
-
-func ExampleDec_SetString() {
- d := new(inf.Dec)
- d.SetString("012345.67890") // decimal; leading 0 ignored; trailing 0 kept
- fmt.Println(d)
- // Output: 12345.67890
-}
-
-func ExampleDec_Scan() {
- // The Scan function is rarely used directly;
- // the fmt package recognizes it as an implementation of fmt.Scanner.
- d := new(inf.Dec)
- _, err := fmt.Sscan("184467440.73709551617", d)
- if err != nil {
- log.Println("error scanning value:", err)
- } else {
- fmt.Println(d)
- }
- // Output: 184467440.73709551617
-}
-
-func ExampleDec_QuoRound_scale2RoundDown() {
- // 10 / 3 is an infinite decimal; it has no exact Dec representation
- x, y := inf.NewDec(10, 0), inf.NewDec(3, 0)
- // use 2 digits beyond the decimal point, round towards 0
- z := new(inf.Dec).QuoRound(x, y, 2, inf.RoundDown)
- fmt.Println(z)
- // Output: 3.33
-}
-
-func ExampleDec_QuoRound_scale2RoundCeil() {
- // -42 / 400 is an finite decimal with 3 digits beyond the decimal point
- x, y := inf.NewDec(-42, 0), inf.NewDec(400, 0)
- // use 2 digits beyond decimal point, round towards positive infinity
- z := new(inf.Dec).QuoRound(x, y, 2, inf.RoundCeil)
- fmt.Println(z)
- // Output: -0.10
-}
-
-func ExampleDec_QuoExact_ok() {
- // 1 / 25 is a finite decimal; it has exact Dec representation
- x, y := inf.NewDec(1, 0), inf.NewDec(25, 0)
- z := new(inf.Dec).QuoExact(x, y)
- fmt.Println(z)
- // Output: 0.04
-}
-
-func ExampleDec_QuoExact_fail() {
- // 1 / 3 is an infinite decimal; it has no exact Dec representation
- x, y := inf.NewDec(1, 0), inf.NewDec(3, 0)
- z := new(inf.Dec).QuoExact(x, y)
- fmt.Println(z)
- // Output: <nil>
-}
diff --git a/vendor/gopkg.in/inf.v0/rounder_example_test.go b/vendor/gopkg.in/inf.v0/rounder_example_test.go
deleted file mode 100644
index 4bf36af95..000000000
--- a/vendor/gopkg.in/inf.v0/rounder_example_test.go
+++ /dev/null
@@ -1,73 +0,0 @@
-package inf_test
-
-import (
- "fmt"
- "os"
- "text/tabwriter"
-
- "gopkg.in/inf.v0"
-)
-
-// This example displays the results of Dec.Round with each of the Rounders.
-//
-func ExampleRounder() {
- var vals = []struct {
- x string
- s inf.Scale
- }{
- {"-0.18", 1}, {"-0.15", 1}, {"-0.12", 1}, {"-0.10", 1},
- {"-0.08", 1}, {"-0.05", 1}, {"-0.02", 1}, {"0.00", 1},
- {"0.02", 1}, {"0.05", 1}, {"0.08", 1}, {"0.10", 1},
- {"0.12", 1}, {"0.15", 1}, {"0.18", 1},
- }
-
- var rounders = []struct {
- name string
- rounder inf.Rounder
- }{
- {"RoundDown", inf.RoundDown}, {"RoundUp", inf.RoundUp},
- {"RoundCeil", inf.RoundCeil}, {"RoundFloor", inf.RoundFloor},
- {"RoundHalfDown", inf.RoundHalfDown}, {"RoundHalfUp", inf.RoundHalfUp},
- {"RoundHalfEven", inf.RoundHalfEven}, {"RoundExact", inf.RoundExact},
- }
-
- fmt.Println("The results of new(inf.Dec).Round(x, s, inf.RoundXXX):")
- fmt.Println()
- w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', tabwriter.AlignRight)
- fmt.Fprint(w, "x\ts\t|\t")
- for _, r := range rounders {
- fmt.Fprintf(w, "%s\t", r.name[5:])
- }
- fmt.Fprintln(w)
- for _, v := range vals {
- fmt.Fprintf(w, "%s\t%d\t|\t", v.x, v.s)
- for _, r := range rounders {
- x, _ := new(inf.Dec).SetString(v.x)
- z := new(inf.Dec).Round(x, v.s, r.rounder)
- fmt.Fprintf(w, "%d\t", z)
- }
- fmt.Fprintln(w)
- }
- w.Flush()
-
- // Output:
- // The results of new(inf.Dec).Round(x, s, inf.RoundXXX):
- //
- // x s | Down Up Ceil Floor HalfDown HalfUp HalfEven Exact
- // -0.18 1 | -0.1 -0.2 -0.1 -0.2 -0.2 -0.2 -0.2 <nil>
- // -0.15 1 | -0.1 -0.2 -0.1 -0.2 -0.1 -0.2 -0.2 <nil>
- // -0.12 1 | -0.1 -0.2 -0.1 -0.2 -0.1 -0.1 -0.1 <nil>
- // -0.10 1 | -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1
- // -0.08 1 | 0.0 -0.1 0.0 -0.1 -0.1 -0.1 -0.1 <nil>
- // -0.05 1 | 0.0 -0.1 0.0 -0.1 0.0 -0.1 0.0 <nil>
- // -0.02 1 | 0.0 -0.1 0.0 -0.1 0.0 0.0 0.0 <nil>
- // 0.00 1 | 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
- // 0.02 1 | 0.0 0.1 0.1 0.0 0.0 0.0 0.0 <nil>
- // 0.05 1 | 0.0 0.1 0.1 0.0 0.0 0.1 0.0 <nil>
- // 0.08 1 | 0.0 0.1 0.1 0.0 0.1 0.1 0.1 <nil>
- // 0.10 1 | 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1
- // 0.12 1 | 0.1 0.2 0.2 0.1 0.1 0.1 0.1 <nil>
- // 0.15 1 | 0.1 0.2 0.2 0.1 0.1 0.2 0.2 <nil>
- // 0.18 1 | 0.1 0.2 0.2 0.1 0.2 0.2 0.2 <nil>
-
-}
diff --git a/vendor/gopkg.in/inf.v0/rounder_test.go b/vendor/gopkg.in/inf.v0/rounder_test.go
deleted file mode 100644
index d7e14c58c..000000000
--- a/vendor/gopkg.in/inf.v0/rounder_test.go
+++ /dev/null
@@ -1,109 +0,0 @@
-package inf_test
-
-import (
- "math/big"
- "testing"
-
- "gopkg.in/inf.v0"
-)
-
-var decRounderInputs = [...]struct {
- quo *inf.Dec
- rA, rB *big.Int
-}{
- // examples from go language spec
- {inf.NewDec(1, 0), big.NewInt(2), big.NewInt(3)}, // 5 / 3
- {inf.NewDec(-1, 0), big.NewInt(-2), big.NewInt(3)}, // -5 / 3
- {inf.NewDec(-1, 0), big.NewInt(2), big.NewInt(-3)}, // 5 / -3
- {inf.NewDec(1, 0), big.NewInt(-2), big.NewInt(-3)}, // -5 / -3
- // examples from godoc
- {inf.NewDec(-1, 1), big.NewInt(-8), big.NewInt(10)},
- {inf.NewDec(-1, 1), big.NewInt(-5), big.NewInt(10)},
- {inf.NewDec(-1, 1), big.NewInt(-2), big.NewInt(10)},
- {inf.NewDec(0, 1), big.NewInt(-8), big.NewInt(10)},
- {inf.NewDec(0, 1), big.NewInt(-5), big.NewInt(10)},
- {inf.NewDec(0, 1), big.NewInt(-2), big.NewInt(10)},
- {inf.NewDec(0, 1), big.NewInt(0), big.NewInt(1)},
- {inf.NewDec(0, 1), big.NewInt(2), big.NewInt(10)},
- {inf.NewDec(0, 1), big.NewInt(5), big.NewInt(10)},
- {inf.NewDec(0, 1), big.NewInt(8), big.NewInt(10)},
- {inf.NewDec(1, 1), big.NewInt(2), big.NewInt(10)},
- {inf.NewDec(1, 1), big.NewInt(5), big.NewInt(10)},
- {inf.NewDec(1, 1), big.NewInt(8), big.NewInt(10)},
-}
-
-var decRounderResults = [...]struct {
- rounder inf.Rounder
- results [len(decRounderInputs)]*inf.Dec
-}{
- {inf.RoundExact, [...]*inf.Dec{nil, nil, nil, nil,
- nil, nil, nil, nil, nil, nil,
- inf.NewDec(0, 1), nil, nil, nil, nil, nil, nil}},
- {inf.RoundDown, [...]*inf.Dec{
- inf.NewDec(1, 0), inf.NewDec(-1, 0), inf.NewDec(-1, 0), inf.NewDec(1, 0),
- inf.NewDec(-1, 1), inf.NewDec(-1, 1), inf.NewDec(-1, 1),
- inf.NewDec(0, 1), inf.NewDec(0, 1), inf.NewDec(0, 1),
- inf.NewDec(0, 1),
- inf.NewDec(0, 1), inf.NewDec(0, 1), inf.NewDec(0, 1),
- inf.NewDec(1, 1), inf.NewDec(1, 1), inf.NewDec(1, 1)}},
- {inf.RoundUp, [...]*inf.Dec{
- inf.NewDec(2, 0), inf.NewDec(-2, 0), inf.NewDec(-2, 0), inf.NewDec(2, 0),
- inf.NewDec(-2, 1), inf.NewDec(-2, 1), inf.NewDec(-2, 1),
- inf.NewDec(-1, 1), inf.NewDec(-1, 1), inf.NewDec(-1, 1),
- inf.NewDec(0, 1),
- inf.NewDec(1, 1), inf.NewDec(1, 1), inf.NewDec(1, 1),
- inf.NewDec(2, 1), inf.NewDec(2, 1), inf.NewDec(2, 1)}},
- {inf.RoundHalfDown, [...]*inf.Dec{
- inf.NewDec(2, 0), inf.NewDec(-2, 0), inf.NewDec(-2, 0), inf.NewDec(2, 0),
- inf.NewDec(-2, 1), inf.NewDec(-1, 1), inf.NewDec(-1, 1),
- inf.NewDec(-1, 1), inf.NewDec(0, 1), inf.NewDec(0, 1),
- inf.NewDec(0, 1),
- inf.NewDec(0, 1), inf.NewDec(0, 1), inf.NewDec(1, 1),
- inf.NewDec(1, 1), inf.NewDec(1, 1), inf.NewDec(2, 1)}},
- {inf.RoundHalfUp, [...]*inf.Dec{
- inf.NewDec(2, 0), inf.NewDec(-2, 0), inf.NewDec(-2, 0), inf.NewDec(2, 0),
- inf.NewDec(-2, 1), inf.NewDec(-2, 1), inf.NewDec(-1, 1),
- inf.NewDec(-1, 1), inf.NewDec(-1, 1), inf.NewDec(0, 1),
- inf.NewDec(0, 1),
- inf.NewDec(0, 1), inf.NewDec(1, 1), inf.NewDec(1, 1),
- inf.NewDec(1, 1), inf.NewDec(2, 1), inf.NewDec(2, 1)}},
- {inf.RoundHalfEven, [...]*inf.Dec{
- inf.NewDec(2, 0), inf.NewDec(-2, 0), inf.NewDec(-2, 0), inf.NewDec(2, 0),
- inf.NewDec(-2, 1), inf.NewDec(-2, 1), inf.NewDec(-1, 1),
- inf.NewDec(-1, 1), inf.NewDec(0, 1), inf.NewDec(0, 1),
- inf.NewDec(0, 1),
- inf.NewDec(0, 1), inf.NewDec(0, 1), inf.NewDec(1, 1),
- inf.NewDec(1, 1), inf.NewDec(2, 1), inf.NewDec(2, 1)}},
- {inf.RoundFloor, [...]*inf.Dec{
- inf.NewDec(1, 0), inf.NewDec(-2, 0), inf.NewDec(-2, 0), inf.NewDec(1, 0),
- inf.NewDec(-2, 1), inf.NewDec(-2, 1), inf.NewDec(-2, 1),
- inf.NewDec(-1, 1), inf.NewDec(-1, 1), inf.NewDec(-1, 1),
- inf.NewDec(0, 1),
- inf.NewDec(0, 1), inf.NewDec(0, 1), inf.NewDec(0, 1),
- inf.NewDec(1, 1), inf.NewDec(1, 1), inf.NewDec(1, 1)}},
- {inf.RoundCeil, [...]*inf.Dec{
- inf.NewDec(2, 0), inf.NewDec(-1, 0), inf.NewDec(-1, 0), inf.NewDec(2, 0),
- inf.NewDec(-1, 1), inf.NewDec(-1, 1), inf.NewDec(-1, 1),
- inf.NewDec(0, 1), inf.NewDec(0, 1), inf.NewDec(0, 1),
- inf.NewDec(0, 1),
- inf.NewDec(1, 1), inf.NewDec(1, 1), inf.NewDec(1, 1),
- inf.NewDec(2, 1), inf.NewDec(2, 1), inf.NewDec(2, 1)}},
-}
-
-func TestDecRounders(t *testing.T) {
- for i, a := range decRounderResults {
- for j, input := range decRounderInputs {
- q := new(inf.Dec).Set(input.quo)
- rA, rB := new(big.Int).Set(input.rA), new(big.Int).Set(input.rB)
- res := a.rounder.Round(new(inf.Dec), q, rA, rB)
- if a.results[j] == nil && res == nil {
- continue
- }
- if (a.results[j] == nil && res != nil) ||
- (a.results[j] != nil && res == nil) ||
- a.results[j].Cmp(res) != 0 {
- t.Errorf("#%d,%d Rounder got %v; expected %v", i, j, res, a.results[j])
- }
- }
- }
-}
diff --git a/vendor/gopkg.in/yaml.v2/decode_test.go b/vendor/gopkg.in/yaml.v2/decode_test.go
deleted file mode 100644
index 9269f12b8..000000000
--- a/vendor/gopkg.in/yaml.v2/decode_test.go
+++ /dev/null
@@ -1,1326 +0,0 @@
-package yaml_test
-
-import (
- "errors"
- "io"
- "math"
- "reflect"
- "strings"
- "time"
-
- . "gopkg.in/check.v1"
- "gopkg.in/yaml.v2"
-)
-
-var unmarshalIntTest = 123
-
-var unmarshalTests = []struct {
- data string
- value interface{}
-}{
- {
- "",
- (*struct{})(nil),
- },
- {
- "{}", &struct{}{},
- }, {
- "v: hi",
- map[string]string{"v": "hi"},
- }, {
- "v: hi", map[string]interface{}{"v": "hi"},
- }, {
- "v: true",
- map[string]string{"v": "true"},
- }, {
- "v: true",
- map[string]interface{}{"v": true},
- }, {
- "v: 10",
- map[string]interface{}{"v": 10},
- }, {
- "v: 0b10",
- map[string]interface{}{"v": 2},
- }, {
- "v: 0xA",
- map[string]interface{}{"v": 10},
- }, {
- "v: 4294967296",
- map[string]int64{"v": 4294967296},
- }, {
- "v: 0.1",
- map[string]interface{}{"v": 0.1},
- }, {
- "v: .1",
- map[string]interface{}{"v": 0.1},
- }, {
- "v: .Inf",
- map[string]interface{}{"v": math.Inf(+1)},
- }, {
- "v: -.Inf",
- map[string]interface{}{"v": math.Inf(-1)},
- }, {
- "v: -10",
- map[string]interface{}{"v": -10},
- }, {
- "v: -.1",
- map[string]interface{}{"v": -0.1},
- },
-
- // Simple values.
- {
- "123",
- &unmarshalIntTest,
- },
-
- // Floats from spec
- {
- "canonical: 6.8523e+5",
- map[string]interface{}{"canonical": 6.8523e+5},
- }, {
- "expo: 685.230_15e+03",
- map[string]interface{}{"expo": 685.23015e+03},
- }, {
- "fixed: 685_230.15",
- map[string]interface{}{"fixed": 685230.15},
- }, {
- "neginf: -.inf",
- map[string]interface{}{"neginf": math.Inf(-1)},
- }, {
- "fixed: 685_230.15",
- map[string]float64{"fixed": 685230.15},
- },
- //{"sexa: 190:20:30.15", map[string]interface{}{"sexa": 0}}, // Unsupported
- //{"notanum: .NaN", map[string]interface{}{"notanum": math.NaN()}}, // Equality of NaN fails.
-
- // Bools from spec
- {
- "canonical: y",
- map[string]interface{}{"canonical": true},
- }, {
- "answer: NO",
- map[string]interface{}{"answer": false},
- }, {
- "logical: True",
- map[string]interface{}{"logical": true},
- }, {
- "option: on",
- map[string]interface{}{"option": true},
- }, {
- "option: on",
- map[string]bool{"option": true},
- },
- // Ints from spec
- {
- "canonical: 685230",
- map[string]interface{}{"canonical": 685230},
- }, {
- "decimal: +685_230",
- map[string]interface{}{"decimal": 685230},
- }, {
- "octal: 02472256",
- map[string]interface{}{"octal": 685230},
- }, {
- "hexa: 0x_0A_74_AE",
- map[string]interface{}{"hexa": 685230},
- }, {
- "bin: 0b1010_0111_0100_1010_1110",
- map[string]interface{}{"bin": 685230},
- }, {
- "bin: -0b101010",
- map[string]interface{}{"bin": -42},
- }, {
- "bin: -0b1000000000000000000000000000000000000000000000000000000000000000",
- map[string]interface{}{"bin": -9223372036854775808},
- }, {
- "decimal: +685_230",
- map[string]int{"decimal": 685230},
- },
-
- //{"sexa: 190:20:30", map[string]interface{}{"sexa": 0}}, // Unsupported
-
- // Nulls from spec
- {
- "empty:",
- map[string]interface{}{"empty": nil},
- }, {
- "canonical: ~",
- map[string]interface{}{"canonical": nil},
- }, {
- "english: null",
- map[string]interface{}{"english": nil},
- }, {
- "~: null key",
- map[interface{}]string{nil: "null key"},
- }, {
- "empty:",
- map[string]*bool{"empty": nil},
- },
-
- // Flow sequence
- {
- "seq: [A,B]",
- map[string]interface{}{"seq": []interface{}{"A", "B"}},
- }, {
- "seq: [A,B,C,]",
- map[string][]string{"seq": []string{"A", "B", "C"}},
- }, {
- "seq: [A,1,C]",
- map[string][]string{"seq": []string{"A", "1", "C"}},
- }, {
- "seq: [A,1,C]",
- map[string][]int{"seq": []int{1}},
- }, {
- "seq: [A,1,C]",
- map[string]interface{}{"seq": []interface{}{"A", 1, "C"}},
- },
- // Block sequence
- {
- "seq:\n - A\n - B",
- map[string]interface{}{"seq": []interface{}{"A", "B"}},
- }, {
- "seq:\n - A\n - B\n - C",
- map[string][]string{"seq": []string{"A", "B", "C"}},
- }, {
- "seq:\n - A\n - 1\n - C",
- map[string][]string{"seq": []string{"A", "1", "C"}},
- }, {
- "seq:\n - A\n - 1\n - C",
- map[string][]int{"seq": []int{1}},
- }, {
- "seq:\n - A\n - 1\n - C",
- map[string]interface{}{"seq": []interface{}{"A", 1, "C"}},
- },
-
- // Literal block scalar
- {
- "scalar: | # Comment\n\n literal\n\n \ttext\n\n",
- map[string]string{"scalar": "\nliteral\n\n\ttext\n"},
- },
-
- // Folded block scalar
- {
- "scalar: > # Comment\n\n folded\n line\n \n next\n line\n * one\n * two\n\n last\n line\n\n",
- map[string]string{"scalar": "\nfolded line\nnext line\n * one\n * two\n\nlast line\n"},
- },
-
- // Map inside interface with no type hints.
- {
- "a: {b: c}",
- map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": "c"}},
- },
-
- // Structs and type conversions.
- {
- "hello: world",
- &struct{ Hello string }{"world"},
- }, {
- "a: {b: c}",
- &struct{ A struct{ B string } }{struct{ B string }{"c"}},
- }, {
- "a: {b: c}",
- &struct{ A *struct{ B string } }{&struct{ B string }{"c"}},
- }, {
- "a: {b: c}",
- &struct{ A map[string]string }{map[string]string{"b": "c"}},
- }, {
- "a: {b: c}",
- &struct{ A *map[string]string }{&map[string]string{"b": "c"}},
- }, {
- "a:",
- &struct{ A map[string]string }{},
- }, {
- "a: 1",
- &struct{ A int }{1},
- }, {
- "a: 1",
- &struct{ A float64 }{1},
- }, {
- "a: 1.0",
- &struct{ A int }{1},
- }, {
- "a: 1.0",
- &struct{ A uint }{1},
- }, {
- "a: [1, 2]",
- &struct{ A []int }{[]int{1, 2}},
- }, {
- "a: [1, 2]",
- &struct{ A [2]int }{[2]int{1, 2}},
- }, {
- "a: 1",
- &struct{ B int }{0},
- }, {
- "a: 1",
- &struct {
- B int "a"
- }{1},
- }, {
- "a: y",
- &struct{ A bool }{true},
- },
-
- // Some cross type conversions
- {
- "v: 42",
- map[string]uint{"v": 42},
- }, {
- "v: -42",
- map[string]uint{},
- }, {
- "v: 4294967296",
- map[string]uint64{"v": 4294967296},
- }, {
- "v: -4294967296",
- map[string]uint64{},
- },
-
- // int
- {
- "int_max: 2147483647",
- map[string]int{"int_max": math.MaxInt32},
- },
- {
- "int_min: -2147483648",
- map[string]int{"int_min": math.MinInt32},
- },
- {
- "int_overflow: 9223372036854775808", // math.MaxInt64 + 1
- map[string]int{},
- },
-
- // int64
- {
- "int64_max: 9223372036854775807",
- map[string]int64{"int64_max": math.MaxInt64},
- },
- {
- "int64_max_base2: 0b111111111111111111111111111111111111111111111111111111111111111",
- map[string]int64{"int64_max_base2": math.MaxInt64},
- },
- {
- "int64_min: -9223372036854775808",
- map[string]int64{"int64_min": math.MinInt64},
- },
- {
- "int64_neg_base2: -0b111111111111111111111111111111111111111111111111111111111111111",
- map[string]int64{"int64_neg_base2": -math.MaxInt64},
- },
- {
- "int64_overflow: 9223372036854775808", // math.MaxInt64 + 1
- map[string]int64{},
- },
-
- // uint
- {
- "uint_min: 0",
- map[string]uint{"uint_min": 0},
- },
- {
- "uint_max: 4294967295",
- map[string]uint{"uint_max": math.MaxUint32},
- },
- {
- "uint_underflow: -1",
- map[string]uint{},
- },
-
- // uint64
- {
- "uint64_min: 0",
- map[string]uint{"uint64_min": 0},
- },
- {
- "uint64_max: 18446744073709551615",
- map[string]uint64{"uint64_max": math.MaxUint64},
- },
- {
- "uint64_max_base2: 0b1111111111111111111111111111111111111111111111111111111111111111",
- map[string]uint64{"uint64_max_base2": math.MaxUint64},
- },
- {
- "uint64_maxint64: 9223372036854775807",
- map[string]uint64{"uint64_maxint64": math.MaxInt64},
- },
- {
- "uint64_underflow: -1",
- map[string]uint64{},
- },
-
- // float32
- {
- "float32_max: 3.40282346638528859811704183484516925440e+38",
- map[string]float32{"float32_max": math.MaxFloat32},
- },
- {
- "float32_nonzero: 1.401298464324817070923729583289916131280e-45",
- map[string]float32{"float32_nonzero": math.SmallestNonzeroFloat32},
- },
- {
- "float32_maxuint64: 18446744073709551615",
- map[string]float32{"float32_maxuint64": float32(math.MaxUint64)},
- },
- {
- "float32_maxuint64+1: 18446744073709551616",
- map[string]float32{"float32_maxuint64+1": float32(math.MaxUint64 + 1)},
- },
-
- // float64
- {
- "float64_max: 1.797693134862315708145274237317043567981e+308",
- map[string]float64{"float64_max": math.MaxFloat64},
- },
- {
- "float64_nonzero: 4.940656458412465441765687928682213723651e-324",
- map[string]float64{"float64_nonzero": math.SmallestNonzeroFloat64},
- },
- {
- "float64_maxuint64: 18446744073709551615",
- map[string]float64{"float64_maxuint64": float64(math.MaxUint64)},
- },
- {
- "float64_maxuint64+1: 18446744073709551616",
- map[string]float64{"float64_maxuint64+1": float64(math.MaxUint64 + 1)},
- },
-
- // Overflow cases.
- {
- "v: 4294967297",
- map[string]int32{},
- }, {
- "v: 128",
- map[string]int8{},
- },
-
- // Quoted values.
- {
- "'1': '\"2\"'",
- map[interface{}]interface{}{"1": "\"2\""},
- }, {
- "v:\n- A\n- 'B\n\n C'\n",
- map[string][]string{"v": []string{"A", "B\nC"}},
- },
-
- // Explicit tags.
- {
- "v: !!float '1.1'",
- map[string]interface{}{"v": 1.1},
- }, {
- "v: !!float 0",
- map[string]interface{}{"v": float64(0)},
- }, {
- "v: !!float -1",
- map[string]interface{}{"v": float64(-1)},
- }, {
- "v: !!null ''",
- map[string]interface{}{"v": nil},
- }, {
- "%TAG !y! tag:yaml.org,2002:\n---\nv: !y!int '1'",
- map[string]interface{}{"v": 1},
- },
-
- // Non-specific tag (Issue #75)
- {
- "v: ! test",
- map[string]interface{}{"v": "test"},
- },
-
- // Anchors and aliases.
- {
- "a: &x 1\nb: &y 2\nc: *x\nd: *y\n",
- &struct{ A, B, C, D int }{1, 2, 1, 2},
- }, {
- "a: &a {c: 1}\nb: *a",
- &struct {
- A, B struct {
- C int
- }
- }{struct{ C int }{1}, struct{ C int }{1}},
- }, {
- "a: &a [1, 2]\nb: *a",
- &struct{ B []int }{[]int{1, 2}},
- },
-
- // Bug #1133337
- {
- "foo: ''",
- map[string]*string{"foo": new(string)},
- }, {
- "foo: null",
- map[string]*string{"foo": nil},
- }, {
- "foo: null",
- map[string]string{"foo": ""},
- }, {
- "foo: null",
- map[string]interface{}{"foo": nil},
- },
-
- // Support for ~
- {
- "foo: ~",
- map[string]*string{"foo": nil},
- }, {
- "foo: ~",
- map[string]string{"foo": ""},
- }, {
- "foo: ~",
- map[string]interface{}{"foo": nil},
- },
-
- // Ignored field
- {
- "a: 1\nb: 2\n",
- &struct {
- A int
- B int "-"
- }{1, 0},
- },
-
- // Bug #1191981
- {
- "" +
- "%YAML 1.1\n" +
- "--- !!str\n" +
- `"Generic line break (no glyph)\n\` + "\n" +
- ` Generic line break (glyphed)\n\` + "\n" +
- ` Line separator\u2028\` + "\n" +
- ` Paragraph separator\u2029"` + "\n",
- "" +
- "Generic line break (no glyph)\n" +
- "Generic line break (glyphed)\n" +
- "Line separator\u2028Paragraph separator\u2029",
- },
-
- // Struct inlining
- {
- "a: 1\nb: 2\nc: 3\n",
- &struct {
- A int
- C inlineB `yaml:",inline"`
- }{1, inlineB{2, inlineC{3}}},
- },
-
- // Map inlining
- {
- "a: 1\nb: 2\nc: 3\n",
- &struct {
- A int
- C map[string]int `yaml:",inline"`
- }{1, map[string]int{"b": 2, "c": 3}},
- },
-
- // bug 1243827
- {
- "a: -b_c",
- map[string]interface{}{"a": "-b_c"},
- },
- {
- "a: +b_c",
- map[string]interface{}{"a": "+b_c"},
- },
- {
- "a: 50cent_of_dollar",
- map[string]interface{}{"a": "50cent_of_dollar"},
- },
-
- // issue #295 (allow scalars with colons in flow mappings and sequences)
- {
- "a: {b: https://github.com/go-yaml/yaml}",
- map[string]interface{}{"a": map[interface{}]interface{}{
- "b": "https://github.com/go-yaml/yaml",
- }},
- },
- {
- "a: [https://github.com/go-yaml/yaml]",
- map[string]interface{}{"a": []interface{}{"https://github.com/go-yaml/yaml"}},
- },
-
- // Duration
- {
- "a: 3s",
- map[string]time.Duration{"a": 3 * time.Second},
- },
-
- // Issue #24.
- {
- "a: <foo>",
- map[string]string{"a": "<foo>"},
- },
-
- // Base 60 floats are obsolete and unsupported.
- {
- "a: 1:1\n",
- map[string]string{"a": "1:1"},
- },
-
- // Binary data.
- {
- "a: !!binary gIGC\n",
- map[string]string{"a": "\x80\x81\x82"},
- }, {
- "a: !!binary |\n " + strings.Repeat("kJCQ", 17) + "kJ\n CQ\n",
- map[string]string{"a": strings.Repeat("\x90", 54)},
- }, {
- "a: !!binary |\n " + strings.Repeat("A", 70) + "\n ==\n",
- map[string]string{"a": strings.Repeat("\x00", 52)},
- },
-
- // Ordered maps.
- {
- "{b: 2, a: 1, d: 4, c: 3, sub: {e: 5}}",
- &yaml.MapSlice{{"b", 2}, {"a", 1}, {"d", 4}, {"c", 3}, {"sub", yaml.MapSlice{{"e", 5}}}},
- },
-
- // Issue #39.
- {
- "a:\n b:\n c: d\n",
- map[string]struct{ B interface{} }{"a": {map[interface{}]interface{}{"c": "d"}}},
- },
-
- // Custom map type.
- {
- "a: {b: c}",
- M{"a": M{"b": "c"}},
- },
-
- // Support encoding.TextUnmarshaler.
- {
- "a: 1.2.3.4\n",
- map[string]textUnmarshaler{"a": textUnmarshaler{S: "1.2.3.4"}},
- },
- {
- "a: 2015-02-24T18:19:39Z\n",
- map[string]textUnmarshaler{"a": textUnmarshaler{"2015-02-24T18:19:39Z"}},
- },
-
- // Timestamps
- {
- // Date only.
- "a: 2015-01-01\n",
- map[string]time.Time{"a": time.Date(2015, 1, 1, 0, 0, 0, 0, time.UTC)},
- },
- {
- // RFC3339
- "a: 2015-02-24T18:19:39.12Z\n",
- map[string]time.Time{"a": time.Date(2015, 2, 24, 18, 19, 39, .12e9, time.UTC)},
- },
- {
- // RFC3339 with short dates.
- "a: 2015-2-3T3:4:5Z",
- map[string]time.Time{"a": time.Date(2015, 2, 3, 3, 4, 5, 0, time.UTC)},
- },
- {
- // ISO8601 lower case t
- "a: 2015-02-24t18:19:39Z\n",
- map[string]time.Time{"a": time.Date(2015, 2, 24, 18, 19, 39, 0, time.UTC)},
- },
- {
- // space separate, no time zone
- "a: 2015-02-24 18:19:39\n",
- map[string]time.Time{"a": time.Date(2015, 2, 24, 18, 19, 39, 0, time.UTC)},
- },
- // Some cases not currently handled. Uncomment these when
- // the code is fixed.
- // {
- // // space separated with time zone
- // "a: 2001-12-14 21:59:43.10 -5",
- // map[string]interface{}{"a": time.Date(2001, 12, 14, 21, 59, 43, .1e9, time.UTC)},
- // },
- // {
- // // arbitrary whitespace between fields
- // "a: 2001-12-14 \t\t \t21:59:43.10 \t Z",
- // map[string]interface{}{"a": time.Date(2001, 12, 14, 21, 59, 43, .1e9, time.UTC)},
- // },
- {
- // explicit string tag
- "a: !!str 2015-01-01",
- map[string]interface{}{"a": "2015-01-01"},
- },
- {
- // explicit timestamp tag on quoted string
- "a: !!timestamp \"2015-01-01\"",
- map[string]time.Time{"a": time.Date(2015, 1, 1, 0, 0, 0, 0, time.UTC)},
- },
- {
- // explicit timestamp tag on unquoted string
- "a: !!timestamp 2015-01-01",
- map[string]time.Time{"a": time.Date(2015, 1, 1, 0, 0, 0, 0, time.UTC)},
- },
- {
- // quoted string that's a valid timestamp
- "a: \"2015-01-01\"",
- map[string]interface{}{"a": "2015-01-01"},
- },
- {
- // explicit timestamp tag into interface.
- "a: !!timestamp \"2015-01-01\"",
- map[string]interface{}{"a": "2015-01-01"},
- },
- {
- // implicit timestamp tag into interface.
- "a: 2015-01-01",
- map[string]interface{}{"a": "2015-01-01"},
- },
-
- // Encode empty lists as zero-length slices.
- {
- "a: []",
- &struct{ A []int }{[]int{}},
- },
-
- // UTF-16-LE
- {
- "\xff\xfe\xf1\x00o\x00\xf1\x00o\x00:\x00 \x00v\x00e\x00r\x00y\x00 \x00y\x00e\x00s\x00\n\x00",
- M{"ñoño": "very yes"},
- },
- // UTF-16-LE with surrogate.
- {
- "\xff\xfe\xf1\x00o\x00\xf1\x00o\x00:\x00 \x00v\x00e\x00r\x00y\x00 \x00y\x00e\x00s\x00 \x00=\xd8\xd4\xdf\n\x00",
- M{"ñoño": "very yes 🟔"},
- },
-
- // UTF-16-BE
- {
- "\xfe\xff\x00\xf1\x00o\x00\xf1\x00o\x00:\x00 \x00v\x00e\x00r\x00y\x00 \x00y\x00e\x00s\x00\n",
- M{"ñoño": "very yes"},
- },
- // UTF-16-BE with surrogate.
- {
- "\xfe\xff\x00\xf1\x00o\x00\xf1\x00o\x00:\x00 \x00v\x00e\x00r\x00y\x00 \x00y\x00e\x00s\x00 \xd8=\xdf\xd4\x00\n",
- M{"ñoño": "very yes 🟔"},
- },
-
- // YAML Float regex shouldn't match this
- {
- "a: 123456e1\n",
- M{"a": "123456e1"},
- }, {
- "a: 123456E1\n",
- M{"a": "123456E1"},
- },
- // yaml-test-suite 3GZX: Spec Example 7.1. Alias Nodes
- {
- "First occurrence: &anchor Foo\nSecond occurrence: *anchor\nOverride anchor: &anchor Bar\nReuse anchor: *anchor\n",
- map[interface{}]interface{}{
- "Reuse anchor": "Bar",
- "First occurrence": "Foo",
- "Second occurrence": "Foo",
- "Override anchor": "Bar",
- },
- },
- // Single document with garbage following it.
- {
- "---\nhello\n...\n}not yaml",
- "hello",
- },
-}
-
-type M map[interface{}]interface{}
-
-type inlineB struct {
- B int
- inlineC `yaml:",inline"`
-}
-
-type inlineC struct {
- C int
-}
-
-func (s *S) TestUnmarshal(c *C) {
- for i, item := range unmarshalTests {
- c.Logf("test %d: %q", i, item.data)
- t := reflect.ValueOf(item.value).Type()
- value := reflect.New(t)
- err := yaml.Unmarshal([]byte(item.data), value.Interface())
- if _, ok := err.(*yaml.TypeError); !ok {
- c.Assert(err, IsNil)
- }
- c.Assert(value.Elem().Interface(), DeepEquals, item.value, Commentf("error: %v", err))
- }
-}
-
-// TODO(v3): This test should also work when unmarshaling onto an interface{}.
-func (s *S) TestUnmarshalFullTimestamp(c *C) {
- // Full timestamp in same format as encoded. This is confirmed to be
- // properly decoded by Python as a timestamp as well.
- var str = "2015-02-24T18:19:39.123456789-03:00"
- var t time.Time
- err := yaml.Unmarshal([]byte(str), &t)
- c.Assert(err, IsNil)
- c.Assert(t, Equals, time.Date(2015, 2, 24, 18, 19, 39, 123456789, t.Location()))
- c.Assert(t.In(time.UTC), Equals, time.Date(2015, 2, 24, 21, 19, 39, 123456789, time.UTC))
-}
-
-func (s *S) TestDecoderSingleDocument(c *C) {
- // Test that Decoder.Decode works as expected on
- // all the unmarshal tests.
- for i, item := range unmarshalTests {
- c.Logf("test %d: %q", i, item.data)
- if item.data == "" {
- // Behaviour differs when there's no YAML.
- continue
- }
- t := reflect.ValueOf(item.value).Type()
- value := reflect.New(t)
- err := yaml.NewDecoder(strings.NewReader(item.data)).Decode(value.Interface())
- if _, ok := err.(*yaml.TypeError); !ok {
- c.Assert(err, IsNil)
- }
- c.Assert(value.Elem().Interface(), DeepEquals, item.value)
- }
-}
-
-var decoderTests = []struct {
- data string
- values []interface{}
-}{{
- "",
- nil,
-}, {
- "a: b",
- []interface{}{
- map[interface{}]interface{}{"a": "b"},
- },
-}, {
- "---\na: b\n...\n",
- []interface{}{
- map[interface{}]interface{}{"a": "b"},
- },
-}, {
- "---\n'hello'\n...\n---\ngoodbye\n...\n",
- []interface{}{
- "hello",
- "goodbye",
- },
-}}
-
-func (s *S) TestDecoder(c *C) {
- for i, item := range decoderTests {
- c.Logf("test %d: %q", i, item.data)
- var values []interface{}
- dec := yaml.NewDecoder(strings.NewReader(item.data))
- for {
- var value interface{}
- err := dec.Decode(&value)
- if err == io.EOF {
- break
- }
- c.Assert(err, IsNil)
- values = append(values, value)
- }
- c.Assert(values, DeepEquals, item.values)
- }
-}
-
-type errReader struct{}
-
-func (errReader) Read([]byte) (int, error) {
- return 0, errors.New("some read error")
-}
-
-func (s *S) TestDecoderReadError(c *C) {
- err := yaml.NewDecoder(errReader{}).Decode(&struct{}{})
- c.Assert(err, ErrorMatches, `yaml: input error: some read error`)
-}
-
-func (s *S) TestUnmarshalNaN(c *C) {
- value := map[string]interface{}{}
- err := yaml.Unmarshal([]byte("notanum: .NaN"), &value)
- c.Assert(err, IsNil)
- c.Assert(math.IsNaN(value["notanum"].(float64)), Equals, true)
-}
-
-var unmarshalErrorTests = []struct {
- data, error string
-}{
- {"v: !!float 'error'", "yaml: cannot decode !!str `error` as a !!float"},
- {"v: [A,", "yaml: line 1: did not find expected node content"},
- {"v:\n- [A,", "yaml: line 2: did not find expected node content"},
- {"a:\n- b: *,", "yaml: line 2: did not find expected alphabetic or numeric character"},
- {"a: *b\n", "yaml: unknown anchor 'b' referenced"},
- {"a: &a\n b: *a\n", "yaml: anchor 'a' value contains itself"},
- {"value: -", "yaml: block sequence entries are not allowed in this context"},
- {"a: !!binary ==", "yaml: !!binary value contains invalid base64 data"},
- {"{[.]}", `yaml: invalid map key: \[\]interface \{\}\{"\."\}`},
- {"{{.}}", `yaml: invalid map key: map\[interface\ \{\}\]interface \{\}\{".":interface \{\}\(nil\)\}`},
- {"b: *a\na: &a {c: 1}", `yaml: unknown anchor 'a' referenced`},
- {"%TAG !%79! tag:yaml.org,2002:\n---\nv: !%79!int '1'", "yaml: did not find expected whitespace"},
-}
-
-func (s *S) TestUnmarshalErrors(c *C) {
- for i, item := range unmarshalErrorTests {
- c.Logf("test %d: %q", i, item.data)
- var value interface{}
- err := yaml.Unmarshal([]byte(item.data), &value)
- c.Assert(err, ErrorMatches, item.error, Commentf("Partial unmarshal: %#v", value))
- }
-}
-
-func (s *S) TestDecoderErrors(c *C) {
- for _, item := range unmarshalErrorTests {
- var value interface{}
- err := yaml.NewDecoder(strings.NewReader(item.data)).Decode(&value)
- c.Assert(err, ErrorMatches, item.error, Commentf("Partial unmarshal: %#v", value))
- }
-}
-
-var unmarshalerTests = []struct {
- data, tag string
- value interface{}
-}{
- {"_: {hi: there}", "!!map", map[interface{}]interface{}{"hi": "there"}},
- {"_: [1,A]", "!!seq", []interface{}{1, "A"}},
- {"_: 10", "!!int", 10},
- {"_: null", "!!null", nil},
- {`_: BAR!`, "!!str", "BAR!"},
- {`_: "BAR!"`, "!!str", "BAR!"},
- {"_: !!foo 'BAR!'", "!!foo", "BAR!"},
- {`_: ""`, "!!str", ""},
-}
-
-var unmarshalerResult = map[int]error{}
-
-type unmarshalerType struct {
- value interface{}
-}
-
-func (o *unmarshalerType) UnmarshalYAML(unmarshal func(v interface{}) error) error {
- if err := unmarshal(&o.value); err != nil {
- return err
- }
- if i, ok := o.value.(int); ok {
- if result, ok := unmarshalerResult[i]; ok {
- return result
- }
- }
- return nil
-}
-
-type unmarshalerPointer struct {
- Field *unmarshalerType "_"
-}
-
-type unmarshalerValue struct {
- Field unmarshalerType "_"
-}
-
-func (s *S) TestUnmarshalerPointerField(c *C) {
- for _, item := range unmarshalerTests {
- obj := &unmarshalerPointer{}
- err := yaml.Unmarshal([]byte(item.data), obj)
- c.Assert(err, IsNil)
- if item.value == nil {
- c.Assert(obj.Field, IsNil)
- } else {
- c.Assert(obj.Field, NotNil, Commentf("Pointer not initialized (%#v)", item.value))
- c.Assert(obj.Field.value, DeepEquals, item.value)
- }
- }
-}
-
-func (s *S) TestUnmarshalerValueField(c *C) {
- for _, item := range unmarshalerTests {
- obj := &unmarshalerValue{}
- err := yaml.Unmarshal([]byte(item.data), obj)
- c.Assert(err, IsNil)
- c.Assert(obj.Field, NotNil, Commentf("Pointer not initialized (%#v)", item.value))
- c.Assert(obj.Field.value, DeepEquals, item.value)
- }
-}
-
-func (s *S) TestUnmarshalerWholeDocument(c *C) {
- obj := &unmarshalerType{}
- err := yaml.Unmarshal([]byte(unmarshalerTests[0].data), obj)
- c.Assert(err, IsNil)
- value, ok := obj.value.(map[interface{}]interface{})
- c.Assert(ok, Equals, true, Commentf("value: %#v", obj.value))
- c.Assert(value["_"], DeepEquals, unmarshalerTests[0].value)
-}
-
-func (s *S) TestUnmarshalerTypeError(c *C) {
- unmarshalerResult[2] = &yaml.TypeError{[]string{"foo"}}
- unmarshalerResult[4] = &yaml.TypeError{[]string{"bar"}}
- defer func() {
- delete(unmarshalerResult, 2)
- delete(unmarshalerResult, 4)
- }()
-
- type T struct {
- Before int
- After int
- M map[string]*unmarshalerType
- }
- var v T
- data := `{before: A, m: {abc: 1, def: 2, ghi: 3, jkl: 4}, after: B}`
- err := yaml.Unmarshal([]byte(data), &v)
- c.Assert(err, ErrorMatches, ""+
- "yaml: unmarshal errors:\n"+
- " line 1: cannot unmarshal !!str `A` into int\n"+
- " foo\n"+
- " bar\n"+
- " line 1: cannot unmarshal !!str `B` into int")
- c.Assert(v.M["abc"], NotNil)
- c.Assert(v.M["def"], IsNil)
- c.Assert(v.M["ghi"], NotNil)
- c.Assert(v.M["jkl"], IsNil)
-
- c.Assert(v.M["abc"].value, Equals, 1)
- c.Assert(v.M["ghi"].value, Equals, 3)
-}
-
-type proxyTypeError struct{}
-
-func (v *proxyTypeError) UnmarshalYAML(unmarshal func(interface{}) error) error {
- var s string
- var a int32
- var b int64
- if err := unmarshal(&s); err != nil {
- panic(err)
- }
- if s == "a" {
- if err := unmarshal(&b); err == nil {
- panic("should have failed")
- }
- return unmarshal(&a)
- }
- if err := unmarshal(&a); err == nil {
- panic("should have failed")
- }
- return unmarshal(&b)
-}
-
-func (s *S) TestUnmarshalerTypeErrorProxying(c *C) {
- type T struct {
- Before int
- After int
- M map[string]*proxyTypeError
- }
- var v T
- data := `{before: A, m: {abc: a, def: b}, after: B}`
- err := yaml.Unmarshal([]byte(data), &v)
- c.Assert(err, ErrorMatches, ""+
- "yaml: unmarshal errors:\n"+
- " line 1: cannot unmarshal !!str `A` into int\n"+
- " line 1: cannot unmarshal !!str `a` into int32\n"+
- " line 1: cannot unmarshal !!str `b` into int64\n"+
- " line 1: cannot unmarshal !!str `B` into int")
-}
-
-type failingUnmarshaler struct{}
-
-var failingErr = errors.New("failingErr")
-
-func (ft *failingUnmarshaler) UnmarshalYAML(unmarshal func(interface{}) error) error {
- return failingErr
-}
-
-func (s *S) TestUnmarshalerError(c *C) {
- err := yaml.Unmarshal([]byte("a: b"), &failingUnmarshaler{})
- c.Assert(err, Equals, failingErr)
-}
-
-type sliceUnmarshaler []int
-
-func (su *sliceUnmarshaler) UnmarshalYAML(unmarshal func(interface{}) error) error {
- var slice []int
- err := unmarshal(&slice)
- if err == nil {
- *su = slice
- return nil
- }
-
- var intVal int
- err = unmarshal(&intVal)
- if err == nil {
- *su = []int{intVal}
- return nil
- }
-
- return err
-}
-
-func (s *S) TestUnmarshalerRetry(c *C) {
- var su sliceUnmarshaler
- err := yaml.Unmarshal([]byte("[1, 2, 3]"), &su)
- c.Assert(err, IsNil)
- c.Assert(su, DeepEquals, sliceUnmarshaler([]int{1, 2, 3}))
-
- err = yaml.Unmarshal([]byte("1"), &su)
- c.Assert(err, IsNil)
- c.Assert(su, DeepEquals, sliceUnmarshaler([]int{1}))
-}
-
-// From http://yaml.org/type/merge.html
-var mergeTests = `
-anchors:
- list:
- - &CENTER { "x": 1, "y": 2 }
- - &LEFT { "x": 0, "y": 2 }
- - &BIG { "r": 10 }
- - &SMALL { "r": 1 }
-
-# All the following maps are equal:
-
-plain:
- # Explicit keys
- "x": 1
- "y": 2
- "r": 10
- label: center/big
-
-mergeOne:
- # Merge one map
- << : *CENTER
- "r": 10
- label: center/big
-
-mergeMultiple:
- # Merge multiple maps
- << : [ *CENTER, *BIG ]
- label: center/big
-
-override:
- # Override
- << : [ *BIG, *LEFT, *SMALL ]
- "x": 1
- label: center/big
-
-shortTag:
- # Explicit short merge tag
- !!merge "<<" : [ *CENTER, *BIG ]
- label: center/big
-
-longTag:
- # Explicit merge long tag
- !<tag:yaml.org,2002:merge> "<<" : [ *CENTER, *BIG ]
- label: center/big
-
-inlineMap:
- # Inlined map
- << : {"x": 1, "y": 2, "r": 10}
- label: center/big
-
-inlineSequenceMap:
- # Inlined map in sequence
- << : [ *CENTER, {"r": 10} ]
- label: center/big
-`
-
-func (s *S) TestMerge(c *C) {
- var want = map[interface{}]interface{}{
- "x": 1,
- "y": 2,
- "r": 10,
- "label": "center/big",
- }
-
- var m map[interface{}]interface{}
- err := yaml.Unmarshal([]byte(mergeTests), &m)
- c.Assert(err, IsNil)
- for name, test := range m {
- if name == "anchors" {
- continue
- }
- c.Assert(test, DeepEquals, want, Commentf("test %q failed", name))
- }
-}
-
-func (s *S) TestMergeStruct(c *C) {
- type Data struct {
- X, Y, R int
- Label string
- }
- want := Data{1, 2, 10, "center/big"}
-
- var m map[string]Data
- err := yaml.Unmarshal([]byte(mergeTests), &m)
- c.Assert(err, IsNil)
- for name, test := range m {
- if name == "anchors" {
- continue
- }
- c.Assert(test, Equals, want, Commentf("test %q failed", name))
- }
-}
-
-var unmarshalNullTests = []func() interface{}{
- func() interface{} { var v interface{}; v = "v"; return &v },
- func() interface{} { var s = "s"; return &s },
- func() interface{} { var s = "s"; sptr := &s; return &sptr },
- func() interface{} { var i = 1; return &i },
- func() interface{} { var i = 1; iptr := &i; return &iptr },
- func() interface{} { m := map[string]int{"s": 1}; return &m },
- func() interface{} { m := map[string]int{"s": 1}; return m },
-}
-
-func (s *S) TestUnmarshalNull(c *C) {
- for _, test := range unmarshalNullTests {
- item := test()
- zero := reflect.Zero(reflect.TypeOf(item).Elem()).Interface()
- err := yaml.Unmarshal([]byte("null"), item)
- c.Assert(err, IsNil)
- if reflect.TypeOf(item).Kind() == reflect.Map {
- c.Assert(reflect.ValueOf(item).Interface(), DeepEquals, reflect.MakeMap(reflect.TypeOf(item)).Interface())
- } else {
- c.Assert(reflect.ValueOf(item).Elem().Interface(), DeepEquals, zero)
- }
- }
-}
-
-func (s *S) TestUnmarshalSliceOnPreset(c *C) {
- // Issue #48.
- v := struct{ A []int }{[]int{1}}
- yaml.Unmarshal([]byte("a: [2]"), &v)
- c.Assert(v.A, DeepEquals, []int{2})
-}
-
-var unmarshalStrictTests = []struct {
- data string
- value interface{}
- error string
-}{{
- data: "a: 1\nc: 2\n",
- value: struct{ A, B int }{A: 1},
- error: `yaml: unmarshal errors:\n line 2: field c not found in type struct { A int; B int }`,
-}, {
- data: "a: 1\nb: 2\na: 3\n",
- value: struct{ A, B int }{A: 3, B: 2},
- error: `yaml: unmarshal errors:\n line 3: field a already set in type struct { A int; B int }`,
-}, {
- data: "c: 3\na: 1\nb: 2\nc: 4\n",
- value: struct {
- A int
- inlineB `yaml:",inline"`
- }{
- A: 1,
- inlineB: inlineB{
- B: 2,
- inlineC: inlineC{
- C: 4,
- },
- },
- },
- error: `yaml: unmarshal errors:\n line 4: field c already set in type struct { A int; yaml_test.inlineB "yaml:\\",inline\\"" }`,
-}, {
- data: "c: 0\na: 1\nb: 2\nc: 1\n",
- value: struct {
- A int
- inlineB `yaml:",inline"`
- }{
- A: 1,
- inlineB: inlineB{
- B: 2,
- inlineC: inlineC{
- C: 1,
- },
- },
- },
- error: `yaml: unmarshal errors:\n line 4: field c already set in type struct { A int; yaml_test.inlineB "yaml:\\",inline\\"" }`,
-}, {
- data: "c: 1\na: 1\nb: 2\nc: 3\n",
- value: struct {
- A int
- M map[string]interface{} `yaml:",inline"`
- }{
- A: 1,
- M: map[string]interface{}{
- "b": 2,
- "c": 3,
- },
- },
- error: `yaml: unmarshal errors:\n line 4: key "c" already set in map`,
-}, {
- data: "a: 1\n9: 2\nnull: 3\n9: 4",
- value: map[interface{}]interface{}{
- "a": 1,
- nil: 3,
- 9: 4,
- },
- error: `yaml: unmarshal errors:\n line 4: key 9 already set in map`,
-}}
-
-func (s *S) TestUnmarshalStrict(c *C) {
- for i, item := range unmarshalStrictTests {
- c.Logf("test %d: %q", i, item.data)
- // First test that normal Unmarshal unmarshals to the expected value.
- t := reflect.ValueOf(item.value).Type()
- value := reflect.New(t)
- err := yaml.Unmarshal([]byte(item.data), value.Interface())
- c.Assert(err, Equals, nil)
- c.Assert(value.Elem().Interface(), DeepEquals, item.value)
-
- // Then test that UnmarshalStrict fails on the same thing.
- t = reflect.ValueOf(item.value).Type()
- value = reflect.New(t)
- err = yaml.UnmarshalStrict([]byte(item.data), value.Interface())
- c.Assert(err, ErrorMatches, item.error)
- }
-}
-
-type textUnmarshaler struct {
- S string
-}
-
-func (t *textUnmarshaler) UnmarshalText(s []byte) error {
- t.S = string(s)
- return nil
-}
-
-func (s *S) TestFuzzCrashers(c *C) {
- cases := []string{
- // runtime error: index out of range
- "\"\\0\\\r\n",
-
- // should not happen
- " 0: [\n] 0",
- "? ? \"\n\" 0",
- " - {\n000}0",
- "0:\n 0: [0\n] 0",
- " - \"\n000\"0",
- " - \"\n000\"\"",
- "0:\n - {\n000}0",
- "0:\n - \"\n000\"0",
- "0:\n - \"\n000\"\"",
-
- // runtime error: index out of range
- " \ufeff\n",
- "? \ufeff\n",
- "? \ufeff:\n",
- "0: \ufeff\n",
- "? \ufeff: \ufeff\n",
- }
- for _, data := range cases {
- var v interface{}
- _ = yaml.Unmarshal([]byte(data), &v)
- }
-}
-
-//var data []byte
-//func init() {
-// var err error
-// data, err = ioutil.ReadFile("/tmp/file.yaml")
-// if err != nil {
-// panic(err)
-// }
-//}
-//
-//func (s *S) BenchmarkUnmarshal(c *C) {
-// var err error
-// for i := 0; i < c.N; i++ {
-// var v map[string]interface{}
-// err = yaml.Unmarshal(data, &v)
-// }
-// if err != nil {
-// panic(err)
-// }
-//}
-//
-//func (s *S) BenchmarkMarshal(c *C) {
-// var v map[string]interface{}
-// yaml.Unmarshal(data, &v)
-// c.ResetTimer()
-// for i := 0; i < c.N; i++ {
-// yaml.Marshal(&v)
-// }
-//}
diff --git a/vendor/gopkg.in/yaml.v2/encode_test.go b/vendor/gopkg.in/yaml.v2/encode_test.go
deleted file mode 100644
index f0911a76a..000000000
--- a/vendor/gopkg.in/yaml.v2/encode_test.go
+++ /dev/null
@@ -1,595 +0,0 @@
-package yaml_test
-
-import (
- "bytes"
- "fmt"
- "math"
- "strconv"
- "strings"
- "time"
-
- "net"
- "os"
-
- . "gopkg.in/check.v1"
- "gopkg.in/yaml.v2"
-)
-
-var marshalIntTest = 123
-
-var marshalTests = []struct {
- value interface{}
- data string
-}{
- {
- nil,
- "null\n",
- }, {
- (*marshalerType)(nil),
- "null\n",
- }, {
- &struct{}{},
- "{}\n",
- }, {
- map[string]string{"v": "hi"},
- "v: hi\n",
- }, {
- map[string]interface{}{"v": "hi"},
- "v: hi\n",
- }, {
- map[string]string{"v": "true"},
- "v: \"true\"\n",
- }, {
- map[string]string{"v": "false"},
- "v: \"false\"\n",
- }, {
- map[string]interface{}{"v": true},
- "v: true\n",
- }, {
- map[string]interface{}{"v": false},
- "v: false\n",
- }, {
- map[string]interface{}{"v": 10},
- "v: 10\n",
- }, {
- map[string]interface{}{"v": -10},
- "v: -10\n",
- }, {
- map[string]uint{"v": 42},
- "v: 42\n",
- }, {
- map[string]interface{}{"v": int64(4294967296)},
- "v: 4294967296\n",
- }, {
- map[string]int64{"v": int64(4294967296)},
- "v: 4294967296\n",
- }, {
- map[string]uint64{"v": 4294967296},
- "v: 4294967296\n",
- }, {
- map[string]interface{}{"v": "10"},
- "v: \"10\"\n",
- }, {
- map[string]interface{}{"v": 0.1},
- "v: 0.1\n",
- }, {
- map[string]interface{}{"v": float64(0.1)},
- "v: 0.1\n",
- }, {
- map[string]interface{}{"v": float32(0.99)},
- "v: 0.99\n",
- }, {
- map[string]interface{}{"v": -0.1},
- "v: -0.1\n",
- }, {
- map[string]interface{}{"v": math.Inf(+1)},
- "v: .inf\n",
- }, {
- map[string]interface{}{"v": math.Inf(-1)},
- "v: -.inf\n",
- }, {
- map[string]interface{}{"v": math.NaN()},
- "v: .nan\n",
- }, {
- map[string]interface{}{"v": nil},
- "v: null\n",
- }, {
- map[string]interface{}{"v": ""},
- "v: \"\"\n",
- }, {
- map[string][]string{"v": []string{"A", "B"}},
- "v:\n- A\n- B\n",
- }, {
- map[string][]string{"v": []string{"A", "B\nC"}},
- "v:\n- A\n- |-\n B\n C\n",
- }, {
- map[string][]interface{}{"v": []interface{}{"A", 1, map[string][]int{"B": []int{2, 3}}}},
- "v:\n- A\n- 1\n- B:\n - 2\n - 3\n",
- }, {
- map[string]interface{}{"a": map[interface{}]interface{}{"b": "c"}},
- "a:\n b: c\n",
- }, {
- map[string]interface{}{"a": "-"},
- "a: '-'\n",
- },
-
- // Simple values.
- {
- &marshalIntTest,
- "123\n",
- },
-
- // Structures
- {
- &struct{ Hello string }{"world"},
- "hello: world\n",
- }, {
- &struct {
- A struct {
- B string
- }
- }{struct{ B string }{"c"}},
- "a:\n b: c\n",
- }, {
- &struct {
- A *struct {
- B string
- }
- }{&struct{ B string }{"c"}},
- "a:\n b: c\n",
- }, {
- &struct {
- A *struct {
- B string
- }
- }{},
- "a: null\n",
- }, {
- &struct{ A int }{1},
- "a: 1\n",
- }, {
- &struct{ A []int }{[]int{1, 2}},
- "a:\n- 1\n- 2\n",
- }, {
- &struct{ A [2]int }{[2]int{1, 2}},
- "a:\n- 1\n- 2\n",
- }, {
- &struct {
- B int "a"
- }{1},
- "a: 1\n",
- }, {
- &struct{ A bool }{true},
- "a: true\n",
- },
-
- // Conditional flag
- {
- &struct {
- A int "a,omitempty"
- B int "b,omitempty"
- }{1, 0},
- "a: 1\n",
- }, {
- &struct {
- A int "a,omitempty"
- B int "b,omitempty"
- }{0, 0},
- "{}\n",
- }, {
- &struct {
- A *struct{ X, y int } "a,omitempty,flow"
- }{&struct{ X, y int }{1, 2}},
- "a: {x: 1}\n",
- }, {
- &struct {
- A *struct{ X, y int } "a,omitempty,flow"
- }{nil},
- "{}\n",
- }, {
- &struct {
- A *struct{ X, y int } "a,omitempty,flow"
- }{&struct{ X, y int }{}},
- "a: {x: 0}\n",
- }, {
- &struct {
- A struct{ X, y int } "a,omitempty,flow"
- }{struct{ X, y int }{1, 2}},
- "a: {x: 1}\n",
- }, {
- &struct {
- A struct{ X, y int } "a,omitempty,flow"
- }{struct{ X, y int }{0, 1}},
- "{}\n",
- }, {
- &struct {
- A float64 "a,omitempty"
- B float64 "b,omitempty"
- }{1, 0},
- "a: 1\n",
- },
- {
- &struct {
- T1 time.Time "t1,omitempty"
- T2 time.Time "t2,omitempty"
- T3 *time.Time "t3,omitempty"
- T4 *time.Time "t4,omitempty"
- }{
- T2: time.Date(2018, 1, 9, 10, 40, 47, 0, time.UTC),
- T4: newTime(time.Date(2098, 1, 9, 10, 40, 47, 0, time.UTC)),
- },
- "t2: 2018-01-09T10:40:47Z\nt4: 2098-01-09T10:40:47Z\n",
- },
- // Nil interface that implements Marshaler.
- {
- map[string]yaml.Marshaler{
- "a": nil,
- },
- "a: null\n",
- },
-
- // Flow flag
- {
- &struct {
- A []int "a,flow"
- }{[]int{1, 2}},
- "a: [1, 2]\n",
- }, {
- &struct {
- A map[string]string "a,flow"
- }{map[string]string{"b": "c", "d": "e"}},
- "a: {b: c, d: e}\n",
- }, {
- &struct {
- A struct {
- B, D string
- } "a,flow"
- }{struct{ B, D string }{"c", "e"}},
- "a: {b: c, d: e}\n",
- },
-
- // Unexported field
- {
- &struct {
- u int
- A int
- }{0, 1},
- "a: 1\n",
- },
-
- // Ignored field
- {
- &struct {
- A int
- B int "-"
- }{1, 2},
- "a: 1\n",
- },
-
- // Struct inlining
- {
- &struct {
- A int
- C inlineB `yaml:",inline"`
- }{1, inlineB{2, inlineC{3}}},
- "a: 1\nb: 2\nc: 3\n",
- },
-
- // Map inlining
- {
- &struct {
- A int
- C map[string]int `yaml:",inline"`
- }{1, map[string]int{"b": 2, "c": 3}},
- "a: 1\nb: 2\nc: 3\n",
- },
-
- // Duration
- {
- map[string]time.Duration{"a": 3 * time.Second},
- "a: 3s\n",
- },
-
- // Issue #24: bug in map merging logic.
- {
- map[string]string{"a": "<foo>"},
- "a: <foo>\n",
- },
-
- // Issue #34: marshal unsupported base 60 floats quoted for compatibility
- // with old YAML 1.1 parsers.
- {
- map[string]string{"a": "1:1"},
- "a: \"1:1\"\n",
- },
-
- // Binary data.
- {
- map[string]string{"a": "\x00"},
- "a: \"\\0\"\n",
- }, {
- map[string]string{"a": "\x80\x81\x82"},
- "a: !!binary gIGC\n",
- }, {
- map[string]string{"a": strings.Repeat("\x90", 54)},
- "a: !!binary |\n " + strings.Repeat("kJCQ", 17) + "kJ\n CQ\n",
- },
-
- // Ordered maps.
- {
- &yaml.MapSlice{{"b", 2}, {"a", 1}, {"d", 4}, {"c", 3}, {"sub", yaml.MapSlice{{"e", 5}}}},
- "b: 2\na: 1\nd: 4\nc: 3\nsub:\n e: 5\n",
- },
-
- // Encode unicode as utf-8 rather than in escaped form.
- {
- map[string]string{"a": "你好"},
- "a: 你好\n",
- },
-
- // Support encoding.TextMarshaler.
- {
- map[string]net.IP{"a": net.IPv4(1, 2, 3, 4)},
- "a: 1.2.3.4\n",
- },
- // time.Time gets a timestamp tag.
- {
- map[string]time.Time{"a": time.Date(2015, 2, 24, 18, 19, 39, 0, time.UTC)},
- "a: 2015-02-24T18:19:39Z\n",
- },
- {
- map[string]*time.Time{"a": newTime(time.Date(2015, 2, 24, 18, 19, 39, 0, time.UTC))},
- "a: 2015-02-24T18:19:39Z\n",
- },
- {
- // This is confirmed to be properly decoded in Python (libyaml) without a timestamp tag.
- map[string]time.Time{"a": time.Date(2015, 2, 24, 18, 19, 39, 123456789, time.FixedZone("FOO", -3*60*60))},
- "a: 2015-02-24T18:19:39.123456789-03:00\n",
- },
- // Ensure timestamp-like strings are quoted.
- {
- map[string]string{"a": "2015-02-24T18:19:39Z"},
- "a: \"2015-02-24T18:19:39Z\"\n",
- },
-
- // Ensure strings containing ": " are quoted (reported as PR #43, but not reproducible).
- {
- map[string]string{"a": "b: c"},
- "a: 'b: c'\n",
- },
-
- // Containing hash mark ('#') in string should be quoted
- {
- map[string]string{"a": "Hello #comment"},
- "a: 'Hello #comment'\n",
- },
- {
- map[string]string{"a": "你好 #comment"},
- "a: '你好 #comment'\n",
- },
-}
-
-func (s *S) TestMarshal(c *C) {
- defer os.Setenv("TZ", os.Getenv("TZ"))
- os.Setenv("TZ", "UTC")
- for i, item := range marshalTests {
- c.Logf("test %d: %q", i, item.data)
- data, err := yaml.Marshal(item.value)
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, item.data)
- }
-}
-
-func (s *S) TestEncoderSingleDocument(c *C) {
- for i, item := range marshalTests {
- c.Logf("test %d. %q", i, item.data)
- var buf bytes.Buffer
- enc := yaml.NewEncoder(&buf)
- err := enc.Encode(item.value)
- c.Assert(err, Equals, nil)
- err = enc.Close()
- c.Assert(err, Equals, nil)
- c.Assert(buf.String(), Equals, item.data)
- }
-}
-
-func (s *S) TestEncoderMultipleDocuments(c *C) {
- var buf bytes.Buffer
- enc := yaml.NewEncoder(&buf)
- err := enc.Encode(map[string]string{"a": "b"})
- c.Assert(err, Equals, nil)
- err = enc.Encode(map[string]string{"c": "d"})
- c.Assert(err, Equals, nil)
- err = enc.Close()
- c.Assert(err, Equals, nil)
- c.Assert(buf.String(), Equals, "a: b\n---\nc: d\n")
-}
-
-func (s *S) TestEncoderWriteError(c *C) {
- enc := yaml.NewEncoder(errorWriter{})
- err := enc.Encode(map[string]string{"a": "b"})
- c.Assert(err, ErrorMatches, `yaml: write error: some write error`) // Data not flushed yet
-}
-
-type errorWriter struct{}
-
-func (errorWriter) Write([]byte) (int, error) {
- return 0, fmt.Errorf("some write error")
-}
-
-var marshalErrorTests = []struct {
- value interface{}
- error string
- panic string
-}{{
- value: &struct {
- B int
- inlineB ",inline"
- }{1, inlineB{2, inlineC{3}}},
- panic: `Duplicated key 'b' in struct struct \{ B int; .*`,
-}, {
- value: &struct {
- A int
- B map[string]int ",inline"
- }{1, map[string]int{"a": 2}},
- panic: `Can't have key "a" in inlined map; conflicts with struct field`,
-}}
-
-func (s *S) TestMarshalErrors(c *C) {
- for _, item := range marshalErrorTests {
- if item.panic != "" {
- c.Assert(func() { yaml.Marshal(item.value) }, PanicMatches, item.panic)
- } else {
- _, err := yaml.Marshal(item.value)
- c.Assert(err, ErrorMatches, item.error)
- }
- }
-}
-
-func (s *S) TestMarshalTypeCache(c *C) {
- var data []byte
- var err error
- func() {
- type T struct{ A int }
- data, err = yaml.Marshal(&T{})
- c.Assert(err, IsNil)
- }()
- func() {
- type T struct{ B int }
- data, err = yaml.Marshal(&T{})
- c.Assert(err, IsNil)
- }()
- c.Assert(string(data), Equals, "b: 0\n")
-}
-
-var marshalerTests = []struct {
- data string
- value interface{}
-}{
- {"_:\n hi: there\n", map[interface{}]interface{}{"hi": "there"}},
- {"_:\n- 1\n- A\n", []interface{}{1, "A"}},
- {"_: 10\n", 10},
- {"_: null\n", nil},
- {"_: BAR!\n", "BAR!"},
-}
-
-type marshalerType struct {
- value interface{}
-}
-
-func (o marshalerType) MarshalText() ([]byte, error) {
- panic("MarshalText called on type with MarshalYAML")
-}
-
-func (o marshalerType) MarshalYAML() (interface{}, error) {
- return o.value, nil
-}
-
-type marshalerValue struct {
- Field marshalerType "_"
-}
-
-func (s *S) TestMarshaler(c *C) {
- for _, item := range marshalerTests {
- obj := &marshalerValue{}
- obj.Field.value = item.value
- data, err := yaml.Marshal(obj)
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, string(item.data))
- }
-}
-
-func (s *S) TestMarshalerWholeDocument(c *C) {
- obj := &marshalerType{}
- obj.value = map[string]string{"hello": "world!"}
- data, err := yaml.Marshal(obj)
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, "hello: world!\n")
-}
-
-type failingMarshaler struct{}
-
-func (ft *failingMarshaler) MarshalYAML() (interface{}, error) {
- return nil, failingErr
-}
-
-func (s *S) TestMarshalerError(c *C) {
- _, err := yaml.Marshal(&failingMarshaler{})
- c.Assert(err, Equals, failingErr)
-}
-
-func (s *S) TestSortedOutput(c *C) {
- order := []interface{}{
- false,
- true,
- 1,
- uint(1),
- 1.0,
- 1.1,
- 1.2,
- 2,
- uint(2),
- 2.0,
- 2.1,
- "",
- ".1",
- ".2",
- ".a",
- "1",
- "2",
- "a!10",
- "a/0001",
- "a/002",
- "a/3",
- "a/10",
- "a/11",
- "a/0012",
- "a/100",
- "a~10",
- "ab/1",
- "b/1",
- "b/01",
- "b/2",
- "b/02",
- "b/3",
- "b/03",
- "b1",
- "b01",
- "b3",
- "c2.10",
- "c10.2",
- "d1",
- "d7",
- "d7abc",
- "d12",
- "d12a",
- }
- m := make(map[interface{}]int)
- for _, k := range order {
- m[k] = 1
- }
- data, err := yaml.Marshal(m)
- c.Assert(err, IsNil)
- out := "\n" + string(data)
- last := 0
- for i, k := range order {
- repr := fmt.Sprint(k)
- if s, ok := k.(string); ok {
- if _, err = strconv.ParseFloat(repr, 32); s == "" || err == nil {
- repr = `"` + repr + `"`
- }
- }
- index := strings.Index(out, "\n"+repr+":")
- if index == -1 {
- c.Fatalf("%#v is not in the output: %#v", k, out)
- }
- if index < last {
- c.Fatalf("%#v was generated before %#v: %q", k, order[i-1], out)
- }
- last = index
- }
-}
-
-func newTime(t time.Time) *time.Time {
- return &t
-}
diff --git a/vendor/gopkg.in/yaml.v2/example_embedded_test.go b/vendor/gopkg.in/yaml.v2/example_embedded_test.go
deleted file mode 100644
index 171c0931a..000000000
--- a/vendor/gopkg.in/yaml.v2/example_embedded_test.go
+++ /dev/null
@@ -1,41 +0,0 @@
-package yaml_test
-
-import (
- "fmt"
- "log"
-
- "gopkg.in/yaml.v2"
-)
-
-// An example showing how to unmarshal embedded
-// structs from YAML.
-
-type StructA struct {
- A string `yaml:"a"`
-}
-
-type StructB struct {
- // Embedded structs are not treated as embedded in YAML by default. To do that,
- // add the ",inline" annotation below
- StructA `yaml:",inline"`
- B string `yaml:"b"`
-}
-
-var data = `
-a: a string from struct A
-b: a string from struct B
-`
-
-func ExampleUnmarshal_embedded() {
- var b StructB
-
- err := yaml.Unmarshal([]byte(data), &b)
- if err != nil {
- log.Fatalf("cannot unmarshal data: %v", err)
- }
- fmt.Println(b.A)
- fmt.Println(b.B)
- // Output:
- // a string from struct A
- // a string from struct B
-}
diff --git a/vendor/gopkg.in/yaml.v2/suite_test.go b/vendor/gopkg.in/yaml.v2/suite_test.go
deleted file mode 100644
index c5cf1ed4f..000000000
--- a/vendor/gopkg.in/yaml.v2/suite_test.go
+++ /dev/null
@@ -1,12 +0,0 @@
-package yaml_test
-
-import (
- . "gopkg.in/check.v1"
- "testing"
-)
-
-func Test(t *testing.T) { TestingT(t) }
-
-type S struct{}
-
-var _ = Suite(&S{})
diff --git a/vendor/k8s.io/api/core/v1/taint_test.go b/vendor/k8s.io/api/core/v1/taint_test.go
deleted file mode 100644
index 22c7f9c4f..000000000
--- a/vendor/k8s.io/api/core/v1/taint_test.go
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package v1
-
-import (
- "testing"
-)
-
-func TestTaintToString(t *testing.T) {
- testCases := []struct {
- taint *Taint
- expectedString string
- }{
- {
- taint: &Taint{
- Key: "foo",
- Value: "bar",
- Effect: TaintEffectNoSchedule,
- },
- expectedString: "foo=bar:NoSchedule",
- },
- {
- taint: &Taint{
- Key: "foo",
- Effect: TaintEffectNoSchedule,
- },
- expectedString: "foo:NoSchedule",
- },
- }
-
- for i, tc := range testCases {
- if tc.expectedString != tc.taint.ToString() {
- t.Errorf("[%v] expected taint %v converted to %s, got %s", i, tc.taint, tc.expectedString, tc.taint.ToString())
- }
- }
-}
-
-func TestMatchTaint(t *testing.T) {
- testCases := []struct {
- description string
- taint *Taint
- taintToMatch Taint
- expectMatch bool
- }{
- {
- description: "two taints with the same key,value,effect should match",
- taint: &Taint{
- Key: "foo",
- Value: "bar",
- Effect: TaintEffectNoSchedule,
- },
- taintToMatch: Taint{
- Key: "foo",
- Value: "bar",
- Effect: TaintEffectNoSchedule,
- },
- expectMatch: true,
- },
- {
- description: "two taints with the same key,effect but different value should match",
- taint: &Taint{
- Key: "foo",
- Value: "bar",
- Effect: TaintEffectNoSchedule,
- },
- taintToMatch: Taint{
- Key: "foo",
- Value: "different-value",
- Effect: TaintEffectNoSchedule,
- },
- expectMatch: true,
- },
- {
- description: "two taints with the different key cannot match",
- taint: &Taint{
- Key: "foo",
- Value: "bar",
- Effect: TaintEffectNoSchedule,
- },
- taintToMatch: Taint{
- Key: "different-key",
- Value: "bar",
- Effect: TaintEffectNoSchedule,
- },
- expectMatch: false,
- },
- {
- description: "two taints with the different effect cannot match",
- taint: &Taint{
- Key: "foo",
- Value: "bar",
- Effect: TaintEffectNoSchedule,
- },
- taintToMatch: Taint{
- Key: "foo",
- Value: "bar",
- Effect: TaintEffectPreferNoSchedule,
- },
- expectMatch: false,
- },
- }
-
- for _, tc := range testCases {
- if tc.expectMatch != tc.taint.MatchTaint(&tc.taintToMatch) {
- t.Errorf("[%s] expect taint %s match taint %s", tc.description, tc.taint.ToString(), tc.taintToMatch.ToString())
- }
- }
-}
diff --git a/vendor/k8s.io/api/core/v1/toleration_test.go b/vendor/k8s.io/api/core/v1/toleration_test.go
deleted file mode 100644
index 3dd48f087..000000000
--- a/vendor/k8s.io/api/core/v1/toleration_test.go
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package v1
-
-import (
- "testing"
-)
-
-func TestTolerationToleratesTaint(t *testing.T) {
-
- testCases := []struct {
- description string
- toleration Toleration
- taint Taint
- expectTolerated bool
- }{
- {
- description: "toleration and taint have the same key and effect, and operator is Exists, and taint has no value, expect tolerated",
- toleration: Toleration{
- Key: "foo",
- Operator: TolerationOpExists,
- Effect: TaintEffectNoSchedule,
- },
- taint: Taint{
- Key: "foo",
- Effect: TaintEffectNoSchedule,
- },
- expectTolerated: true,
- },
- {
- description: "toleration and taint have the same key and effect, and operator is Exists, and taint has some value, expect tolerated",
- toleration: Toleration{
- Key: "foo",
- Operator: TolerationOpExists,
- Effect: TaintEffectNoSchedule,
- },
- taint: Taint{
- Key: "foo",
- Value: "bar",
- Effect: TaintEffectNoSchedule,
- },
- expectTolerated: true,
- },
- {
- description: "toleration and taint have the same effect, toleration has empty key and operator is Exists, means match all taints, expect tolerated",
- toleration: Toleration{
- Key: "",
- Operator: TolerationOpExists,
- Effect: TaintEffectNoSchedule,
- },
- taint: Taint{
- Key: "foo",
- Value: "bar",
- Effect: TaintEffectNoSchedule,
- },
- expectTolerated: true,
- },
- {
- description: "toleration and taint have the same key, effect and value, and operator is Equal, expect tolerated",
- toleration: Toleration{
- Key: "foo",
- Operator: TolerationOpEqual,
- Value: "bar",
- Effect: TaintEffectNoSchedule,
- },
- taint: Taint{
- Key: "foo",
- Value: "bar",
- Effect: TaintEffectNoSchedule,
- },
- expectTolerated: true,
- },
- {
- description: "toleration and taint have the same key and effect, but different values, and operator is Equal, expect not tolerated",
- toleration: Toleration{
- Key: "foo",
- Operator: TolerationOpEqual,
- Value: "value1",
- Effect: TaintEffectNoSchedule,
- },
- taint: Taint{
- Key: "foo",
- Value: "value2",
- Effect: TaintEffectNoSchedule,
- },
- expectTolerated: false,
- },
- {
- description: "toleration and taint have the same key and value, but different effects, and operator is Equal, expect not tolerated",
- toleration: Toleration{
- Key: "foo",
- Operator: TolerationOpEqual,
- Value: "bar",
- Effect: TaintEffectNoSchedule,
- },
- taint: Taint{
- Key: "foo",
- Value: "bar",
- Effect: TaintEffectNoExecute,
- },
- expectTolerated: false,
- },
- }
- for _, tc := range testCases {
- if tolerated := tc.toleration.ToleratesTaint(&tc.taint); tc.expectTolerated != tolerated {
- t.Errorf("[%s] expect %v, got %v: toleration %+v, taint %s", tc.description, tc.expectTolerated, tolerated, tc.toleration, tc.taint.ToString())
- }
- }
-}
diff --git a/vendor/k8s.io/api/roundtrip_test.go b/vendor/k8s.io/api/roundtrip_test.go
deleted file mode 100644
index 5b82feb84..000000000
--- a/vendor/k8s.io/api/roundtrip_test.go
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
-Copyright 2018 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package testing
-
-import (
- "math/rand"
- "testing"
-
- admissionv1beta1 "k8s.io/api/admission/v1beta1"
- admissionregv1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
- admissionregv1beta1 "k8s.io/api/admissionregistration/v1beta1"
- appsv1 "k8s.io/api/apps/v1"
- appsv1beta1 "k8s.io/api/apps/v1beta1"
- appsv1beta2 "k8s.io/api/apps/v1beta2"
- authenticationv1 "k8s.io/api/authentication/v1"
- authenticationv1beta1 "k8s.io/api/authentication/v1beta1"
- authorizationv1 "k8s.io/api/authorization/v1"
- authorizationv1beta1 "k8s.io/api/authorization/v1beta1"
- autoscalingv1 "k8s.io/api/autoscaling/v1"
- autoscalingv2beta1 "k8s.io/api/autoscaling/v2beta1"
- batchv1 "k8s.io/api/batch/v1"
- batchv1beta1 "k8s.io/api/batch/v1beta1"
- batchv2alpha1 "k8s.io/api/batch/v2alpha1"
- certificatesv1beta1 "k8s.io/api/certificates/v1beta1"
- corev1 "k8s.io/api/core/v1"
- eventsv1beta1 "k8s.io/api/events/v1beta1"
- extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
- imagepolicyv1alpha1 "k8s.io/api/imagepolicy/v1alpha1"
- networkingv1 "k8s.io/api/networking/v1"
- policyv1beta1 "k8s.io/api/policy/v1beta1"
- rbacv1 "k8s.io/api/rbac/v1"
- rbacv1alpha1 "k8s.io/api/rbac/v1alpha1"
- rbacv1beta1 "k8s.io/api/rbac/v1beta1"
- schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1"
- schedulingv1beta1 "k8s.io/api/scheduling/v1beta1"
- settingsv1alpha1 "k8s.io/api/settings/v1alpha1"
- storagev1 "k8s.io/api/storage/v1"
- storagev1alpha1 "k8s.io/api/storage/v1alpha1"
- storagev1beta1 "k8s.io/api/storage/v1beta1"
-
- "k8s.io/apimachinery/pkg/api/testing/fuzzer"
- "k8s.io/apimachinery/pkg/api/testing/roundtrip"
- genericfuzzer "k8s.io/apimachinery/pkg/apis/meta/fuzzer"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/runtime/serializer"
-)
-
-var groups = []runtime.SchemeBuilder{
- admissionv1beta1.SchemeBuilder,
- admissionregv1alpha1.SchemeBuilder,
- admissionregv1beta1.SchemeBuilder,
- appsv1beta1.SchemeBuilder,
- appsv1beta2.SchemeBuilder,
- appsv1.SchemeBuilder,
- authenticationv1beta1.SchemeBuilder,
- authenticationv1.SchemeBuilder,
- authorizationv1beta1.SchemeBuilder,
- authorizationv1.SchemeBuilder,
- autoscalingv1.SchemeBuilder,
- autoscalingv2beta1.SchemeBuilder,
- batchv2alpha1.SchemeBuilder,
- batchv1beta1.SchemeBuilder,
- batchv1.SchemeBuilder,
- certificatesv1beta1.SchemeBuilder,
- corev1.SchemeBuilder,
- eventsv1beta1.SchemeBuilder,
- extensionsv1beta1.SchemeBuilder,
- imagepolicyv1alpha1.SchemeBuilder,
- networkingv1.SchemeBuilder,
- policyv1beta1.SchemeBuilder,
- rbacv1alpha1.SchemeBuilder,
- rbacv1beta1.SchemeBuilder,
- rbacv1.SchemeBuilder,
- schedulingv1alpha1.SchemeBuilder,
- schedulingv1beta1.SchemeBuilder,
- settingsv1alpha1.SchemeBuilder,
- storagev1alpha1.SchemeBuilder,
- storagev1beta1.SchemeBuilder,
- storagev1.SchemeBuilder,
-}
-
-func TestRoundTripExternalTypes(t *testing.T) {
- for _, builder := range groups {
- scheme := runtime.NewScheme()
- codecs := serializer.NewCodecFactory(scheme)
-
- builder.AddToScheme(scheme)
- seed := rand.Int63()
- // I'm only using the generic fuzzer funcs, but at some point in time we might need to
- // switch to specialized. For now we're happy with the current serialization test.
- fuzzer := fuzzer.FuzzerFor(genericfuzzer.Funcs, rand.NewSource(seed), codecs)
-
- roundtrip.RoundTripExternalTypes(t, scheme, codecs, fuzzer, nil)
- }
-}
-
-func TestFailRoundTrip(t *testing.T) {
- scheme := runtime.NewScheme()
- codecs := serializer.NewCodecFactory(scheme)
- groupVersion := schema.GroupVersion{Group: "broken", Version: "v1"}
- builder := runtime.NewSchemeBuilder(func(scheme *runtime.Scheme) error {
- scheme.AddKnownTypes(groupVersion, &BrokenType{})
- metav1.AddToGroupVersion(scheme, groupVersion)
- return nil
- })
- builder.AddToScheme(scheme)
- seed := rand.Int63()
- fuzzer := fuzzer.FuzzerFor(genericfuzzer.Funcs, rand.NewSource(seed), codecs)
- tmpT := new(testing.T)
- roundtrip.RoundTripExternalTypes(tmpT, scheme, codecs, fuzzer, nil)
- // It's very hacky way of making sure the DeepCopy is actually invoked inside RoundTripExternalTypes
- // used in the other test. If for some reason this tests starts passing we need to fail b/c we're not testing
- // the DeepCopy in the other method which we care so much about.
- if !tmpT.Failed() {
- t.Log("RoundTrip should've failed on DeepCopy but it did not!")
- t.FailNow()
- }
-}
-
-type BrokenType struct {
- metav1.TypeMeta `json:",inline"`
- metav1.ObjectMeta `json:"metadata,omitempty"`
-
- Field1 string `json:"field1,omitempty"`
- Field2 string `json:"field2,omitempty"`
-}
-
-func (in *BrokenType) DeepCopy() *BrokenType {
- return new(BrokenType)
-}
-
-func (in *BrokenType) DeepCopyObject() runtime.Object {
- return in.DeepCopy()
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/api/errors/errors_test.go b/vendor/k8s.io/apimachinery/pkg/api/errors/errors_test.go
deleted file mode 100644
index 303a9d3f4..000000000
--- a/vendor/k8s.io/apimachinery/pkg/api/errors/errors_test.go
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package errors
-
-import (
- "errors"
- "fmt"
- "reflect"
- "testing"
-
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/util/validation/field"
-)
-
-func resource(resource string) schema.GroupResource {
- return schema.GroupResource{Group: "", Resource: resource}
-}
-func kind(kind string) schema.GroupKind {
- return schema.GroupKind{Group: "", Kind: kind}
-}
-
-func TestErrorNew(t *testing.T) {
- err := NewAlreadyExists(resource("tests"), "1")
- if !IsAlreadyExists(err) {
- t.Errorf("expected to be %s", metav1.StatusReasonAlreadyExists)
- }
- if IsConflict(err) {
- t.Errorf("expected to not be %s", metav1.StatusReasonConflict)
- }
- if IsNotFound(err) {
- t.Errorf(fmt.Sprintf("expected to not be %s", metav1.StatusReasonNotFound))
- }
- if IsInvalid(err) {
- t.Errorf("expected to not be %s", metav1.StatusReasonInvalid)
- }
- if IsBadRequest(err) {
- t.Errorf("expected to not be %s", metav1.StatusReasonBadRequest)
- }
- if IsForbidden(err) {
- t.Errorf("expected to not be %s", metav1.StatusReasonForbidden)
- }
- if IsServerTimeout(err) {
- t.Errorf("expected to not be %s", metav1.StatusReasonServerTimeout)
- }
- if IsMethodNotSupported(err) {
- t.Errorf("expected to not be %s", metav1.StatusReasonMethodNotAllowed)
- }
-
- if !IsConflict(NewConflict(resource("tests"), "2", errors.New("message"))) {
- t.Errorf("expected to be conflict")
- }
- if !IsNotFound(NewNotFound(resource("tests"), "3")) {
- t.Errorf("expected to be %s", metav1.StatusReasonNotFound)
- }
- if !IsInvalid(NewInvalid(kind("Test"), "2", nil)) {
- t.Errorf("expected to be %s", metav1.StatusReasonInvalid)
- }
- if !IsBadRequest(NewBadRequest("reason")) {
- t.Errorf("expected to be %s", metav1.StatusReasonBadRequest)
- }
- if !IsForbidden(NewForbidden(resource("tests"), "2", errors.New("reason"))) {
- t.Errorf("expected to be %s", metav1.StatusReasonForbidden)
- }
- if !IsUnauthorized(NewUnauthorized("reason")) {
- t.Errorf("expected to be %s", metav1.StatusReasonUnauthorized)
- }
- if !IsServerTimeout(NewServerTimeout(resource("tests"), "reason", 0)) {
- t.Errorf("expected to be %s", metav1.StatusReasonServerTimeout)
- }
- if !IsMethodNotSupported(NewMethodNotSupported(resource("foos"), "delete")) {
- t.Errorf("expected to be %s", metav1.StatusReasonMethodNotAllowed)
- }
-
- if time, ok := SuggestsClientDelay(NewServerTimeout(resource("tests"), "doing something", 10)); time != 10 || !ok {
- t.Errorf("unexpected %d", time)
- }
- if time, ok := SuggestsClientDelay(NewServerTimeout(resource("tests"), "doing something", 0)); time != 0 || !ok {
- t.Errorf("unexpected %d", time)
- }
- if time, ok := SuggestsClientDelay(NewTimeoutError("test reason", 10)); time != 10 || !ok {
- t.Errorf("unexpected %d", time)
- }
- if time, ok := SuggestsClientDelay(NewTooManyRequests("doing something", 10)); time != 10 || !ok {
- t.Errorf("unexpected %d", time)
- }
- if time, ok := SuggestsClientDelay(NewTooManyRequests("doing something", 1)); time != 1 || !ok {
- t.Errorf("unexpected %d", time)
- }
- if time, ok := SuggestsClientDelay(NewGenericServerResponse(429, "get", resource("tests"), "test", "doing something", 10, true)); time != 10 || !ok {
- t.Errorf("unexpected %d", time)
- }
- if time, ok := SuggestsClientDelay(NewGenericServerResponse(500, "get", resource("tests"), "test", "doing something", 10, true)); time != 10 || !ok {
- t.Errorf("unexpected %d", time)
- }
- if time, ok := SuggestsClientDelay(NewGenericServerResponse(429, "get", resource("tests"), "test", "doing something", 0, true)); time != 0 || ok {
- t.Errorf("unexpected %d", time)
- }
-}
-
-func TestNewInvalid(t *testing.T) {
- testCases := []struct {
- Err *field.Error
- Details *metav1.StatusDetails
- }{
- {
- field.Duplicate(field.NewPath("field[0].name"), "bar"),
- &metav1.StatusDetails{
- Kind: "Kind",
- Name: "name",
- Causes: []metav1.StatusCause{{
- Type: metav1.CauseTypeFieldValueDuplicate,
- Field: "field[0].name",
- }},
- },
- },
- {
- field.Invalid(field.NewPath("field[0].name"), "bar", "detail"),
- &metav1.StatusDetails{
- Kind: "Kind",
- Name: "name",
- Causes: []metav1.StatusCause{{
- Type: metav1.CauseTypeFieldValueInvalid,
- Field: "field[0].name",
- }},
- },
- },
- {
- field.NotFound(field.NewPath("field[0].name"), "bar"),
- &metav1.StatusDetails{
- Kind: "Kind",
- Name: "name",
- Causes: []metav1.StatusCause{{
- Type: metav1.CauseTypeFieldValueNotFound,
- Field: "field[0].name",
- }},
- },
- },
- {
- field.NotSupported(field.NewPath("field[0].name"), "bar", nil),
- &metav1.StatusDetails{
- Kind: "Kind",
- Name: "name",
- Causes: []metav1.StatusCause{{
- Type: metav1.CauseTypeFieldValueNotSupported,
- Field: "field[0].name",
- }},
- },
- },
- {
- field.Required(field.NewPath("field[0].name"), ""),
- &metav1.StatusDetails{
- Kind: "Kind",
- Name: "name",
- Causes: []metav1.StatusCause{{
- Type: metav1.CauseTypeFieldValueRequired,
- Field: "field[0].name",
- }},
- },
- },
- }
- for i, testCase := range testCases {
- vErr, expected := testCase.Err, testCase.Details
- expected.Causes[0].Message = vErr.ErrorBody()
- err := NewInvalid(kind("Kind"), "name", field.ErrorList{vErr})
- status := err.ErrStatus
- if status.Code != 422 || status.Reason != metav1.StatusReasonInvalid {
- t.Errorf("%d: unexpected status: %#v", i, status)
- }
- if !reflect.DeepEqual(expected, status.Details) {
- t.Errorf("%d: expected %#v, got %#v", i, expected, status.Details)
- }
- }
-}
-
-func TestReasonForError(t *testing.T) {
- if e, a := metav1.StatusReasonUnknown, ReasonForError(nil); e != a {
- t.Errorf("unexpected reason type: %#v", a)
- }
-}
-
-type TestType struct{}
-
-func (obj *TestType) GetObjectKind() schema.ObjectKind { return schema.EmptyObjectKind }
-func (obj *TestType) DeepCopyObject() runtime.Object {
- if obj == nil {
- return nil
- }
- clone := *obj
- return &clone
-}
-
-func TestFromObject(t *testing.T) {
- table := []struct {
- obj runtime.Object
- message string
- }{
- {&metav1.Status{Message: "foobar"}, "foobar"},
- {&TestType{}, "unexpected object: &{}"},
- }
-
- for _, item := range table {
- if e, a := item.message, FromObject(item.obj).Error(); e != a {
- t.Errorf("Expected %v, got %v", e, a)
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/api/meta/meta_test.go b/vendor/k8s.io/apimachinery/pkg/api/meta/meta_test.go
deleted file mode 100644
index 4680bae9a..000000000
--- a/vendor/k8s.io/apimachinery/pkg/api/meta/meta_test.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package meta
-
-import (
- "math/rand"
- "reflect"
- "testing"
-
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- metav1beta1 "k8s.io/apimachinery/pkg/apis/meta/v1beta1"
- "k8s.io/apimachinery/pkg/util/diff"
-
- fuzz "github.com/google/gofuzz"
-)
-
-func TestAsPartialObjectMetadata(t *testing.T) {
- f := fuzz.New().NilChance(.5).NumElements(0, 1).RandSource(rand.NewSource(1))
-
- for i := 0; i < 100; i++ {
- m := &metav1.ObjectMeta{}
- f.Fuzz(m)
- partial := AsPartialObjectMetadata(m)
- if !reflect.DeepEqual(&partial.ObjectMeta, m) {
- t.Fatalf("incomplete partial object metadata: %s", diff.ObjectReflectDiff(&partial.ObjectMeta, m))
- }
- }
-
- for i := 0; i < 100; i++ {
- m := &metav1beta1.PartialObjectMetadata{}
- f.Fuzz(&m.ObjectMeta)
- partial := AsPartialObjectMetadata(m)
- if !reflect.DeepEqual(&partial.ObjectMeta, &m.ObjectMeta) {
- t.Fatalf("incomplete partial object metadata: %s", diff.ObjectReflectDiff(&partial.ObjectMeta, &m.ObjectMeta))
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/api/meta/multirestmapper_test.go b/vendor/k8s.io/apimachinery/pkg/api/meta/multirestmapper_test.go
deleted file mode 100644
index b71ca468d..000000000
--- a/vendor/k8s.io/apimachinery/pkg/api/meta/multirestmapper_test.go
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package meta
-
-import (
- "errors"
- "reflect"
- "testing"
-
- "k8s.io/apimachinery/pkg/runtime/schema"
-)
-
-func TestMultiRESTMapperResourceFor(t *testing.T) {
- tcs := []struct {
- name string
-
- mapper MultiRESTMapper
- input schema.GroupVersionResource
- result schema.GroupVersionResource
- err error
- }{
- {
- name: "empty",
- mapper: MultiRESTMapper{},
- input: schema.GroupVersionResource{Resource: "foo"},
- result: schema.GroupVersionResource{},
- err: &NoResourceMatchError{PartialResource: schema.GroupVersionResource{Resource: "foo"}},
- },
- {
- name: "ignore not found",
- mapper: MultiRESTMapper{fixedRESTMapper{err: &NoResourceMatchError{PartialResource: schema.GroupVersionResource{Resource: "IGNORE_THIS"}}}},
- input: schema.GroupVersionResource{Resource: "foo"},
- result: schema.GroupVersionResource{},
- err: &NoResourceMatchError{PartialResource: schema.GroupVersionResource{Resource: "foo"}},
- },
- {
- name: "accept first failure",
- mapper: MultiRESTMapper{fixedRESTMapper{err: errors.New("fail on this")}, fixedRESTMapper{resourcesFor: []schema.GroupVersionResource{{Resource: "unused"}}}},
- input: schema.GroupVersionResource{Resource: "foo"},
- result: schema.GroupVersionResource{},
- err: errors.New("fail on this"),
- },
- }
-
- for _, tc := range tcs {
- actualResult, actualErr := tc.mapper.ResourceFor(tc.input)
- if e, a := tc.result, actualResult; e != a {
- t.Errorf("%s: expected %v, got %v", tc.name, e, a)
- }
- switch {
- case tc.err == nil && actualErr == nil:
- case tc.err == nil:
- t.Errorf("%s: unexpected error: %v", tc.name, actualErr)
- case actualErr == nil:
- t.Errorf("%s: expected error: %v got nil", tc.name, tc.err)
- case tc.err.Error() != actualErr.Error():
- t.Errorf("%s: expected %v, got %v", tc.name, tc.err, actualErr)
- }
- }
-}
-
-func TestMultiRESTMapperResourcesFor(t *testing.T) {
- tcs := []struct {
- name string
-
- mapper MultiRESTMapper
- input schema.GroupVersionResource
- result []schema.GroupVersionResource
- err error
- }{
- {
- name: "empty",
- mapper: MultiRESTMapper{},
- input: schema.GroupVersionResource{Resource: "foo"},
- result: nil,
- err: &NoResourceMatchError{PartialResource: schema.GroupVersionResource{Resource: "foo"}},
- },
- {
- name: "ignore not found",
- mapper: MultiRESTMapper{fixedRESTMapper{err: &NoResourceMatchError{PartialResource: schema.GroupVersionResource{Resource: "IGNORE_THIS"}}}},
- input: schema.GroupVersionResource{Resource: "foo"},
- result: nil,
- err: &NoResourceMatchError{PartialResource: schema.GroupVersionResource{Resource: "foo"}},
- },
- {
- name: "accept first failure",
- mapper: MultiRESTMapper{fixedRESTMapper{err: errors.New("fail on this")}, fixedRESTMapper{resourcesFor: []schema.GroupVersionResource{{Resource: "unused"}}}},
- input: schema.GroupVersionResource{Resource: "foo"},
- result: nil,
- err: errors.New("fail on this"),
- },
- {
- name: "union and dedup",
- mapper: MultiRESTMapper{
- fixedRESTMapper{resourcesFor: []schema.GroupVersionResource{{Resource: "dupe"}, {Resource: "first"}}},
- fixedRESTMapper{resourcesFor: []schema.GroupVersionResource{{Resource: "dupe"}, {Resource: "second"}}},
- },
- input: schema.GroupVersionResource{Resource: "foo"},
- result: []schema.GroupVersionResource{{Resource: "dupe"}, {Resource: "first"}, {Resource: "second"}},
- },
- {
- name: "skip not and continue",
- mapper: MultiRESTMapper{
- fixedRESTMapper{err: &NoResourceMatchError{PartialResource: schema.GroupVersionResource{Resource: "IGNORE_THIS"}}},
- fixedRESTMapper{resourcesFor: []schema.GroupVersionResource{{Resource: "first"}, {Resource: "second"}}},
- },
- input: schema.GroupVersionResource{Resource: "foo"},
- result: []schema.GroupVersionResource{{Resource: "first"}, {Resource: "second"}},
- },
- }
-
- for _, tc := range tcs {
- actualResult, actualErr := tc.mapper.ResourcesFor(tc.input)
- if e, a := tc.result, actualResult; !reflect.DeepEqual(e, a) {
- t.Errorf("%s: expected %v, got %v", tc.name, e, a)
- }
- switch {
- case tc.err == nil && actualErr == nil:
- case tc.err == nil:
- t.Errorf("%s: unexpected error: %v", tc.name, actualErr)
- case actualErr == nil:
- t.Errorf("%s: expected error: %v got nil", tc.name, tc.err)
- case tc.err.Error() != actualErr.Error():
- t.Errorf("%s: expected %v, got %v", tc.name, tc.err, actualErr)
- }
- }
-}
-
-func TestMultiRESTMapperKindsFor(t *testing.T) {
- tcs := []struct {
- name string
-
- mapper MultiRESTMapper
- input schema.GroupVersionResource
- result []schema.GroupVersionKind
- err error
- }{
- {
- name: "empty",
- mapper: MultiRESTMapper{},
- input: schema.GroupVersionResource{Resource: "foo"},
- result: nil,
- err: &NoResourceMatchError{PartialResource: schema.GroupVersionResource{Resource: "foo"}},
- },
- {
- name: "ignore not found",
- mapper: MultiRESTMapper{fixedRESTMapper{err: &NoResourceMatchError{PartialResource: schema.GroupVersionResource{Resource: "IGNORE_THIS"}}}},
- input: schema.GroupVersionResource{Resource: "foo"},
- result: nil,
- err: &NoResourceMatchError{PartialResource: schema.GroupVersionResource{Resource: "foo"}},
- },
- {
- name: "accept first failure",
- mapper: MultiRESTMapper{fixedRESTMapper{err: errors.New("fail on this")}, fixedRESTMapper{kindsFor: []schema.GroupVersionKind{{Kind: "unused"}}}},
- input: schema.GroupVersionResource{Resource: "foo"},
- result: nil,
- err: errors.New("fail on this"),
- },
- {
- name: "union and dedup",
- mapper: MultiRESTMapper{
- fixedRESTMapper{kindsFor: []schema.GroupVersionKind{{Kind: "dupe"}, {Kind: "first"}}},
- fixedRESTMapper{kindsFor: []schema.GroupVersionKind{{Kind: "dupe"}, {Kind: "second"}}},
- },
- input: schema.GroupVersionResource{Resource: "foo"},
- result: []schema.GroupVersionKind{{Kind: "dupe"}, {Kind: "first"}, {Kind: "second"}},
- },
- {
- name: "skip not and continue",
- mapper: MultiRESTMapper{
- fixedRESTMapper{err: &NoResourceMatchError{PartialResource: schema.GroupVersionResource{Resource: "IGNORE_THIS"}}},
- fixedRESTMapper{kindsFor: []schema.GroupVersionKind{{Kind: "first"}, {Kind: "second"}}},
- },
- input: schema.GroupVersionResource{Resource: "foo"},
- result: []schema.GroupVersionKind{{Kind: "first"}, {Kind: "second"}},
- },
- }
-
- for _, tc := range tcs {
- actualResult, actualErr := tc.mapper.KindsFor(tc.input)
- if e, a := tc.result, actualResult; !reflect.DeepEqual(e, a) {
- t.Errorf("%s: expected %v, got %v", tc.name, e, a)
- }
- switch {
- case tc.err == nil && actualErr == nil:
- case tc.err == nil:
- t.Errorf("%s: unexpected error: %v", tc.name, actualErr)
- case actualErr == nil:
- t.Errorf("%s: expected error: %v got nil", tc.name, tc.err)
- case tc.err.Error() != actualErr.Error():
- t.Errorf("%s: expected %v, got %v", tc.name, tc.err, actualErr)
- }
- }
-}
-
-func TestMultiRESTMapperKindFor(t *testing.T) {
- tcs := []struct {
- name string
-
- mapper MultiRESTMapper
- input schema.GroupVersionResource
- result schema.GroupVersionKind
- err error
- }{
- {
- name: "empty",
- mapper: MultiRESTMapper{},
- input: schema.GroupVersionResource{Resource: "foo"},
- result: schema.GroupVersionKind{},
- err: &NoResourceMatchError{PartialResource: schema.GroupVersionResource{Resource: "foo"}},
- },
- {
- name: "ignore not found",
- mapper: MultiRESTMapper{fixedRESTMapper{err: &NoResourceMatchError{PartialResource: schema.GroupVersionResource{Resource: "IGNORE_THIS"}}}},
- input: schema.GroupVersionResource{Resource: "foo"},
- result: schema.GroupVersionKind{},
- err: &NoResourceMatchError{PartialResource: schema.GroupVersionResource{Resource: "foo"}},
- },
- {
- name: "accept first failure",
- mapper: MultiRESTMapper{fixedRESTMapper{err: errors.New("fail on this")}, fixedRESTMapper{kindsFor: []schema.GroupVersionKind{{Kind: "unused"}}}},
- input: schema.GroupVersionResource{Resource: "foo"},
- result: schema.GroupVersionKind{},
- err: errors.New("fail on this"),
- },
- }
-
- for _, tc := range tcs {
- actualResult, actualErr := tc.mapper.KindFor(tc.input)
- if e, a := tc.result, actualResult; e != a {
- t.Errorf("%s: expected %v, got %v", tc.name, e, a)
- }
- switch {
- case tc.err == nil && actualErr == nil:
- case tc.err == nil:
- t.Errorf("%s: unexpected error: %v", tc.name, actualErr)
- case actualErr == nil:
- t.Errorf("%s: expected error: %v got nil", tc.name, tc.err)
- case tc.err.Error() != actualErr.Error():
- t.Errorf("%s: expected %v, got %v", tc.name, tc.err, actualErr)
- }
- }
-}
-
-func TestMultiRESTMapperRESTMappings(t *testing.T) {
- mapping1, mapping2 := &RESTMapping{}, &RESTMapping{}
- tcs := []struct {
- name string
-
- mapper MultiRESTMapper
- groupKind schema.GroupKind
- versions []string
- result []*RESTMapping
- err error
- }{
- {
- name: "empty with no versions",
- mapper: MultiRESTMapper{},
- groupKind: schema.GroupKind{Kind: "Foo"},
- result: nil,
- err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "Foo"}},
- },
- {
- name: "empty with one version",
- mapper: MultiRESTMapper{},
- groupKind: schema.GroupKind{Kind: "Foo"},
- versions: []string{"v1beta"},
- result: nil,
- err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "Foo"}, SearchedVersions: []string{"v1beta"}},
- },
- {
- name: "empty with multi(two) vesions",
- mapper: MultiRESTMapper{},
- groupKind: schema.GroupKind{Kind: "Foo"},
- versions: []string{"v1beta", "v2"},
- result: nil,
- err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "Foo"}, SearchedVersions: []string{"v1beta", "v2"}},
- },
- {
- name: "ignore not found with kind not exist",
- mapper: MultiRESTMapper{fixedRESTMapper{err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "IGNORE_THIS"}}}},
- groupKind: schema.GroupKind{Kind: "Foo"},
- versions: nil,
- result: nil,
- err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "Foo"}},
- },
- {
- name: "ignore not found with version not exist",
- mapper: MultiRESTMapper{fixedRESTMapper{err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "Foo"}, SearchedVersions: []string{"v1"}}}},
- groupKind: schema.GroupKind{Kind: "Foo"},
- versions: []string{"v1beta"},
- result: nil,
- err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "Foo"}, SearchedVersions: []string{"v1beta"}},
- },
- {
- name: "ignore not found with multi versions not exist",
- mapper: MultiRESTMapper{fixedRESTMapper{err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "Foo"}, SearchedVersions: []string{"v1"}}}},
- groupKind: schema.GroupKind{Kind: "Foo"},
- versions: []string{"v1beta", "v2"},
- result: nil,
- err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "Foo"}, SearchedVersions: []string{"v1beta", "v2"}},
- },
- {
- name: "accept first failure",
- mapper: MultiRESTMapper{fixedRESTMapper{err: errors.New("fail on this")}, fixedRESTMapper{mappings: []*RESTMapping{mapping1}}},
- groupKind: schema.GroupKind{Kind: "Foo"},
- versions: []string{"v1beta"},
- result: nil,
- err: errors.New("fail on this"),
- },
- {
- name: "return both",
- mapper: MultiRESTMapper{fixedRESTMapper{mappings: []*RESTMapping{mapping1}}, fixedRESTMapper{mappings: []*RESTMapping{mapping2}}},
- groupKind: schema.GroupKind{Kind: "Foo"},
- versions: []string{"v1beta"},
- result: []*RESTMapping{mapping1, mapping2},
- },
- }
-
- for _, tc := range tcs {
- actualResult, actualErr := tc.mapper.RESTMappings(tc.groupKind, tc.versions...)
- if e, a := tc.result, actualResult; !reflect.DeepEqual(e, a) {
- t.Errorf("%s: expected %v, got %v", tc.name, e, a)
- }
- switch {
- case tc.err == nil && actualErr == nil:
- case tc.err == nil:
- t.Errorf("%s: unexpected error: %v", tc.name, actualErr)
- case actualErr == nil:
- t.Errorf("%s: expected error: %v got nil", tc.name, tc.err)
- case tc.err.Error() != actualErr.Error():
- t.Errorf("%s: expected %v, got %v", tc.name, tc.err, actualErr)
- }
- }
-}
-
-type fixedRESTMapper struct {
- resourcesFor []schema.GroupVersionResource
- kindsFor []schema.GroupVersionKind
- resourceFor schema.GroupVersionResource
- kindFor schema.GroupVersionKind
- mappings []*RESTMapping
-
- err error
-}
-
-func (m fixedRESTMapper) ResourceSingularizer(resource string) (singular string, err error) {
- return "", m.err
-}
-
-func (m fixedRESTMapper) ResourcesFor(resource schema.GroupVersionResource) ([]schema.GroupVersionResource, error) {
- return m.resourcesFor, m.err
-}
-
-func (m fixedRESTMapper) KindsFor(resource schema.GroupVersionResource) (gvk []schema.GroupVersionKind, err error) {
- return m.kindsFor, m.err
-}
-
-func (m fixedRESTMapper) ResourceFor(resource schema.GroupVersionResource) (schema.GroupVersionResource, error) {
- return m.resourceFor, m.err
-}
-
-func (m fixedRESTMapper) KindFor(resource schema.GroupVersionResource) (schema.GroupVersionKind, error) {
- return m.kindFor, m.err
-}
-
-func (m fixedRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string) (mapping *RESTMapping, err error) {
- return nil, m.err
-}
-
-func (m fixedRESTMapper) RESTMappings(gk schema.GroupKind, versions ...string) (mappings []*RESTMapping, err error) {
- return m.mappings, m.err
-}
-
-func (m fixedRESTMapper) ResourceIsValid(resource schema.GroupVersionResource) bool {
- return false
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/api/meta/priority_test.go b/vendor/k8s.io/apimachinery/pkg/api/meta/priority_test.go
deleted file mode 100644
index fff1afd17..000000000
--- a/vendor/k8s.io/apimachinery/pkg/api/meta/priority_test.go
+++ /dev/null
@@ -1,409 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package meta
-
-import (
- "errors"
- "reflect"
- "strings"
- "testing"
-
- "k8s.io/apimachinery/pkg/runtime/schema"
-)
-
-func TestPriorityRESTMapperResourceForErrorHandling(t *testing.T) {
- tcs := []struct {
- name string
-
- delegate RESTMapper
- resourcePatterns []schema.GroupVersionResource
- result schema.GroupVersionResource
- err string
- }{
- {
- name: "error",
- delegate: fixedRESTMapper{err: errors.New("delegateError")},
- err: "delegateError",
- },
- {
- name: "single hit + error",
- delegate: fixedRESTMapper{resourcesFor: []schema.GroupVersionResource{{Resource: "single-hit"}}, err: errors.New("delegateError")},
- result: schema.GroupVersionResource{Resource: "single-hit"},
- err: "delegateError",
- },
- {
- name: "group selection + error",
- delegate: fixedRESTMapper{resourcesFor: []schema.GroupVersionResource{
- {Group: "one", Version: "a", Resource: "first"},
- {Group: "two", Version: "b", Resource: "second"},
- }, err: errors.New("delegateError")},
- resourcePatterns: []schema.GroupVersionResource{
- {Group: "one", Version: AnyVersion, Resource: AnyResource},
- },
- result: schema.GroupVersionResource{Group: "one", Version: "a", Resource: "first"},
- err: "delegateError",
- },
-
- {
- name: "single hit",
- delegate: fixedRESTMapper{resourcesFor: []schema.GroupVersionResource{{Resource: "single-hit"}}},
- result: schema.GroupVersionResource{Resource: "single-hit"},
- },
- {
- name: "ambiguous match",
- delegate: fixedRESTMapper{resourcesFor: []schema.GroupVersionResource{
- {Group: "one", Version: "a", Resource: "first"},
- {Group: "two", Version: "b", Resource: "second"},
- }},
- err: "matches multiple resources",
- },
- {
- name: "group selection",
- delegate: fixedRESTMapper{resourcesFor: []schema.GroupVersionResource{
- {Group: "one", Version: "a", Resource: "first"},
- {Group: "two", Version: "b", Resource: "second"},
- }},
- resourcePatterns: []schema.GroupVersionResource{
- {Group: "one", Version: AnyVersion, Resource: AnyResource},
- },
- result: schema.GroupVersionResource{Group: "one", Version: "a", Resource: "first"},
- },
- {
- name: "empty match continues",
- delegate: fixedRESTMapper{resourcesFor: []schema.GroupVersionResource{
- {Group: "one", Version: "a", Resource: "first"},
- {Group: "two", Version: "b", Resource: "second"},
- }},
- resourcePatterns: []schema.GroupVersionResource{
- {Group: "fail", Version: AnyVersion, Resource: AnyResource},
- {Group: "one", Version: AnyVersion, Resource: AnyResource},
- },
- result: schema.GroupVersionResource{Group: "one", Version: "a", Resource: "first"},
- },
- {
- name: "group followed by version selection",
- delegate: fixedRESTMapper{resourcesFor: []schema.GroupVersionResource{
- {Group: "one", Version: "a", Resource: "first"},
- {Group: "two", Version: "b", Resource: "second"},
- {Group: "one", Version: "c", Resource: "third"},
- }},
- resourcePatterns: []schema.GroupVersionResource{
- {Group: "one", Version: AnyVersion, Resource: AnyResource},
- {Group: AnyGroup, Version: "a", Resource: AnyResource},
- },
- result: schema.GroupVersionResource{Group: "one", Version: "a", Resource: "first"},
- },
- {
- name: "resource selection",
- delegate: fixedRESTMapper{resourcesFor: []schema.GroupVersionResource{
- {Group: "one", Version: "a", Resource: "first"},
- {Group: "one", Version: "a", Resource: "second"},
- }},
- resourcePatterns: []schema.GroupVersionResource{
- {Group: AnyGroup, Version: AnyVersion, Resource: "second"},
- },
- result: schema.GroupVersionResource{Group: "one", Version: "a", Resource: "second"},
- },
- }
-
- for _, tc := range tcs {
- mapper := PriorityRESTMapper{Delegate: tc.delegate, ResourcePriority: tc.resourcePatterns}
-
- actualResult, actualErr := mapper.ResourceFor(schema.GroupVersionResource{})
- if e, a := tc.result, actualResult; e != a {
- t.Errorf("%s: expected %v, got %v", tc.name, e, a)
- }
- if len(tc.err) == 0 && actualErr == nil {
- continue
- }
- if len(tc.err) == 0 && actualErr != nil {
- t.Errorf("%s: unexpected err: %v", tc.name, actualErr)
- continue
- }
- if len(tc.err) > 0 && actualErr == nil {
- t.Errorf("%s: missing expected err: %v", tc.name, tc.err)
- continue
- }
- if !strings.Contains(actualErr.Error(), tc.err) {
- t.Errorf("%s: expected %v, got %v", tc.name, tc.err, actualErr)
- }
- }
-}
-
-func TestPriorityRESTMapperKindForErrorHandling(t *testing.T) {
- tcs := []struct {
- name string
-
- delegate RESTMapper
- kindPatterns []schema.GroupVersionKind
- result schema.GroupVersionKind
- err string
- }{
- {
- name: "error",
- delegate: fixedRESTMapper{err: errors.New("delegateErr")},
- err: "delegateErr",
- },
- {
- name: "single hit + error",
- delegate: fixedRESTMapper{kindsFor: []schema.GroupVersionKind{{Kind: "single-hit"}}, err: errors.New("delegateErr")},
- result: schema.GroupVersionKind{Kind: "single-hit"},
- err: "delegateErr",
- },
- {
- name: "group selection + error",
- delegate: fixedRESTMapper{kindsFor: []schema.GroupVersionKind{
- {Group: "one", Version: "a", Kind: "first"},
- {Group: "two", Version: "b", Kind: "second"},
- }, err: errors.New("delegateErr")},
- kindPatterns: []schema.GroupVersionKind{
- {Group: "one", Version: AnyVersion, Kind: AnyKind},
- },
- result: schema.GroupVersionKind{Group: "one", Version: "a", Kind: "first"},
- err: "delegateErr",
- },
-
- {
- name: "single hit",
- delegate: fixedRESTMapper{kindsFor: []schema.GroupVersionKind{{Kind: "single-hit"}}},
- result: schema.GroupVersionKind{Kind: "single-hit"},
- },
- {
- name: "ambiguous match",
- delegate: fixedRESTMapper{kindsFor: []schema.GroupVersionKind{
- {Group: "one", Version: "a", Kind: "first"},
- {Group: "two", Version: "b", Kind: "second"},
- }},
- err: "matches multiple kinds",
- },
- {
- name: "group selection",
- delegate: fixedRESTMapper{kindsFor: []schema.GroupVersionKind{
- {Group: "one", Version: "a", Kind: "first"},
- {Group: "two", Version: "b", Kind: "second"},
- }},
- kindPatterns: []schema.GroupVersionKind{
- {Group: "one", Version: AnyVersion, Kind: AnyKind},
- },
- result: schema.GroupVersionKind{Group: "one", Version: "a", Kind: "first"},
- },
- {
- name: "empty match continues",
- delegate: fixedRESTMapper{kindsFor: []schema.GroupVersionKind{
- {Group: "one", Version: "a", Kind: "first"},
- {Group: "two", Version: "b", Kind: "second"},
- }},
- kindPatterns: []schema.GroupVersionKind{
- {Group: "fail", Version: AnyVersion, Kind: AnyKind},
- {Group: "one", Version: AnyVersion, Kind: AnyKind},
- },
- result: schema.GroupVersionKind{Group: "one", Version: "a", Kind: "first"},
- },
- {
- name: "group followed by version selection",
- delegate: fixedRESTMapper{kindsFor: []schema.GroupVersionKind{
- {Group: "one", Version: "a", Kind: "first"},
- {Group: "two", Version: "b", Kind: "second"},
- {Group: "one", Version: "c", Kind: "third"},
- }},
- kindPatterns: []schema.GroupVersionKind{
- {Group: "one", Version: AnyVersion, Kind: AnyKind},
- {Group: AnyGroup, Version: "a", Kind: AnyKind},
- },
- result: schema.GroupVersionKind{Group: "one", Version: "a", Kind: "first"},
- },
- {
- name: "kind selection",
- delegate: fixedRESTMapper{kindsFor: []schema.GroupVersionKind{
- {Group: "one", Version: "a", Kind: "first"},
- {Group: "one", Version: "a", Kind: "second"},
- }},
- kindPatterns: []schema.GroupVersionKind{
- {Group: AnyGroup, Version: AnyVersion, Kind: "second"},
- },
- result: schema.GroupVersionKind{Group: "one", Version: "a", Kind: "second"},
- },
- }
-
- for _, tc := range tcs {
- mapper := PriorityRESTMapper{Delegate: tc.delegate, KindPriority: tc.kindPatterns}
-
- actualResult, actualErr := mapper.KindFor(schema.GroupVersionResource{})
- if e, a := tc.result, actualResult; e != a {
- t.Errorf("%s: expected %v, got %v", tc.name, e, a)
- }
- if len(tc.err) == 0 && actualErr == nil {
- continue
- }
- if len(tc.err) == 0 && actualErr != nil {
- t.Errorf("%s: unexpected err: %v", tc.name, actualErr)
- continue
- }
- if len(tc.err) > 0 && actualErr == nil {
- t.Errorf("%s: missing expected err: %v", tc.name, tc.err)
- continue
- }
- if !strings.Contains(actualErr.Error(), tc.err) {
- t.Errorf("%s: expected %v, got %v", tc.name, tc.err, actualErr)
- }
- }
-}
-
-func TestPriorityRESTMapperRESTMapping(t *testing.T) {
- mapping1 := &RESTMapping{
- GroupVersionKind: schema.GroupVersionKind{Kind: "Foo", Version: "v1alpha1"},
- }
- mapping2 := &RESTMapping{
- GroupVersionKind: schema.GroupVersionKind{Kind: "Foo", Version: "v1"},
- }
- mapping3 := &RESTMapping{
- GroupVersionKind: schema.GroupVersionKind{Group: "other", Kind: "Foo", Version: "v1"},
- }
- allMappers := MultiRESTMapper{
- fixedRESTMapper{mappings: []*RESTMapping{mapping1}},
- fixedRESTMapper{mappings: []*RESTMapping{mapping2}},
- fixedRESTMapper{mappings: []*RESTMapping{mapping3}},
- }
- tcs := []struct {
- name string
-
- mapper PriorityRESTMapper
- input schema.GroupKind
- result *RESTMapping
- err error
- }{
- {
- name: "empty",
- mapper: PriorityRESTMapper{Delegate: MultiRESTMapper{}},
- input: schema.GroupKind{Kind: "Foo"},
- err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "Foo"}},
- },
- {
- name: "ignore not found",
- mapper: PriorityRESTMapper{Delegate: MultiRESTMapper{fixedRESTMapper{err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "IGNORE_THIS"}}}}},
- input: schema.GroupKind{Kind: "Foo"},
- err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "Foo"}},
- },
- {
- name: "accept first failure",
- mapper: PriorityRESTMapper{Delegate: MultiRESTMapper{fixedRESTMapper{err: errors.New("fail on this")}, fixedRESTMapper{mappings: []*RESTMapping{mapping1}}}},
- input: schema.GroupKind{Kind: "Foo"},
- err: errors.New("fail on this"),
- },
- {
- name: "result + error",
- mapper: PriorityRESTMapper{Delegate: fixedRESTMapper{mappings: []*RESTMapping{mapping1}, err: errors.New("fail on this")}},
- input: schema.GroupKind{Kind: "Foo"},
- result: mapping1,
- err: errors.New("fail on this"),
- },
- {
- name: "return error for ambiguous",
- mapper: PriorityRESTMapper{
- Delegate: allMappers,
- },
- input: schema.GroupKind{Kind: "Foo"},
- err: &AmbiguousKindError{
- PartialKind: schema.GroupVersionKind{Kind: "Foo"},
- MatchingKinds: []schema.GroupVersionKind{
- {Kind: "Foo", Version: "v1alpha1"},
- {Kind: "Foo", Version: "v1"},
- {Group: "other", Kind: "Foo", Version: "v1"},
- },
- },
- },
- {
- name: "accept only item",
- mapper: PriorityRESTMapper{
- Delegate: fixedRESTMapper{mappings: []*RESTMapping{mapping1}},
- },
- input: schema.GroupKind{Kind: "Foo"},
- result: mapping1,
- },
- {
- name: "return single priority",
- mapper: PriorityRESTMapper{
- Delegate: allMappers,
- KindPriority: []schema.GroupVersionKind{{Version: "v1", Kind: AnyKind}, {Version: "v1alpha1", Kind: AnyKind}},
- },
- input: schema.GroupKind{Kind: "Foo"},
- result: mapping2,
- },
- {
- name: "return out of group match",
- mapper: PriorityRESTMapper{
- Delegate: allMappers,
- KindPriority: []schema.GroupVersionKind{{Group: AnyGroup, Version: "v1", Kind: AnyKind}, {Group: "other", Version: AnyVersion, Kind: AnyKind}},
- },
- input: schema.GroupKind{Kind: "Foo"},
- result: mapping3,
- },
- }
-
- for _, tc := range tcs {
- actualResult, actualErr := tc.mapper.RESTMapping(tc.input)
- if e, a := tc.result, actualResult; !reflect.DeepEqual(e, a) {
- t.Errorf("%s: expected %v, got %v", tc.name, e, a)
- }
- switch {
- case tc.err == nil && actualErr == nil:
- case tc.err == nil:
- t.Errorf("%s: unexpected error: %v", tc.name, actualErr)
- case actualErr == nil:
- t.Errorf("%s: expected error: %v got nil", tc.name, tc.err)
- case tc.err.Error() != actualErr.Error():
- t.Errorf("%s: expected %v, got %v", tc.name, tc.err, actualErr)
- }
- }
-}
-
-func TestPriorityRESTMapperRESTMappingHonorsUserVersion(t *testing.T) {
- mappingV2alpha1 := &RESTMapping{
- GroupVersionKind: schema.GroupVersionKind{Group: "Bar", Kind: "Foo", Version: "v2alpha1"},
- }
- mappingV1 := &RESTMapping{
- GroupVersionKind: schema.GroupVersionKind{Group: "Bar", Kind: "Foo", Version: "v1"},
- }
-
- allMappers := MultiRESTMapper{
- fixedRESTMapper{mappings: []*RESTMapping{mappingV2alpha1}},
- fixedRESTMapper{mappings: []*RESTMapping{mappingV1}},
- }
-
- mapper := PriorityRESTMapper{
- Delegate: allMappers,
- KindPriority: []schema.GroupVersionKind{{Group: "Bar", Version: "v2alpha1", Kind: AnyKind}, {Group: "Bar", Version: AnyVersion, Kind: AnyKind}},
- }
-
- outMapping1, err := mapper.RESTMapping(schema.GroupKind{Group: "Bar", Kind: "Foo"}, "v1")
- if err != nil {
- t.Errorf("unexpected error: %v", err)
- }
-
- if outMapping1 != mappingV1 {
- t.Errorf("asked for version %v, expected mapping for %v, got mapping for %v", "v1", mappingV1.GroupVersionKind, outMapping1.GroupVersionKind)
- }
-
- outMapping2, err := mapper.RESTMapping(schema.GroupKind{Group: "Bar", Kind: "Foo"}, "v2alpha1")
- if err != nil {
- t.Errorf("unexpected error: %v", err)
- }
-
- if outMapping2 != mappingV2alpha1 {
- t.Errorf("asked for version %v, expected mapping for %v, got mapping for %v", "v2alpha1", mappingV2alpha1.GroupVersionKind, outMapping2.GroupVersionKind)
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/api/meta/restmapper_test.go b/vendor/k8s.io/apimachinery/pkg/api/meta/restmapper_test.go
deleted file mode 100644
index 853404ad6..000000000
--- a/vendor/k8s.io/apimachinery/pkg/api/meta/restmapper_test.go
+++ /dev/null
@@ -1,724 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package meta
-
-import (
- "reflect"
- "strings"
- "testing"
-
- "k8s.io/apimachinery/pkg/runtime/schema"
-)
-
-func TestRESTMapperVersionAndKindForResource(t *testing.T) {
- testGroup := "test.group"
- testVersion := "test"
- testGroupVersion := schema.GroupVersion{Group: testGroup, Version: testVersion}
-
- testCases := []struct {
- Resource schema.GroupVersionResource
- GroupVersionToRegister schema.GroupVersion
- ExpectedGVK schema.GroupVersionKind
- Err bool
- }{
- {Resource: schema.GroupVersionResource{Resource: "internalobjec"}, Err: true},
- {Resource: schema.GroupVersionResource{Resource: "internalObjec"}, Err: true},
-
- {Resource: schema.GroupVersionResource{Resource: "internalobject"}, ExpectedGVK: testGroupVersion.WithKind("InternalObject")},
- {Resource: schema.GroupVersionResource{Resource: "internalobjects"}, ExpectedGVK: testGroupVersion.WithKind("InternalObject")},
- }
- for i, testCase := range testCases {
- mapper := NewDefaultRESTMapper([]schema.GroupVersion{testGroupVersion})
- if len(testCase.ExpectedGVK.Kind) != 0 {
- mapper.Add(testCase.ExpectedGVK, RESTScopeNamespace)
- }
- actualGVK, err := mapper.KindFor(testCase.Resource)
-
- hasErr := err != nil
- if hasErr != testCase.Err {
- t.Errorf("%d: unexpected error behavior %t: %v", i, testCase.Err, err)
- continue
- }
- if err != nil {
- continue
- }
-
- if actualGVK != testCase.ExpectedGVK {
- t.Errorf("%d: unexpected version and kind: e=%s a=%s", i, testCase.ExpectedGVK, actualGVK)
- }
- }
-}
-
-func TestRESTMapperGroupForResource(t *testing.T) {
- testCases := []struct {
- Resource schema.GroupVersionResource
- GroupVersionKind schema.GroupVersionKind
- Err bool
- }{
- {Resource: schema.GroupVersionResource{Resource: "myObject"}, GroupVersionKind: schema.GroupVersionKind{Group: "testapi", Version: "test", Kind: "MyObject"}},
- {Resource: schema.GroupVersionResource{Resource: "myobject"}, GroupVersionKind: schema.GroupVersionKind{Group: "testapi2", Version: "test", Kind: "MyObject"}},
- {Resource: schema.GroupVersionResource{Resource: "myObje"}, Err: true, GroupVersionKind: schema.GroupVersionKind{Group: "testapi", Version: "test", Kind: "MyObject"}},
- {Resource: schema.GroupVersionResource{Resource: "myobje"}, Err: true, GroupVersionKind: schema.GroupVersionKind{Group: "testapi", Version: "test", Kind: "MyObject"}},
- }
- for i, testCase := range testCases {
- mapper := NewDefaultRESTMapper([]schema.GroupVersion{testCase.GroupVersionKind.GroupVersion()})
- mapper.Add(testCase.GroupVersionKind, RESTScopeNamespace)
-
- actualGVK, err := mapper.KindFor(testCase.Resource)
- if testCase.Err {
- if err == nil {
- t.Errorf("%d: expected error", i)
- }
- } else if err != nil {
- t.Errorf("%d: unexpected error: %v", i, err)
- } else if actualGVK != testCase.GroupVersionKind {
- t.Errorf("%d: expected group %q, got %q", i, testCase.GroupVersionKind, actualGVK)
- }
- }
-}
-
-func TestRESTMapperKindsFor(t *testing.T) {
- testCases := []struct {
- Name string
- PreferredOrder []schema.GroupVersion
- KindsToRegister []schema.GroupVersionKind
- PartialResourceToRequest schema.GroupVersionResource
-
- ExpectedKinds []schema.GroupVersionKind
- ExpectedKindErr string
- }{
- {
- // exact matches are preferred
- Name: "groups, with group exact",
- PreferredOrder: []schema.GroupVersion{
- {Group: "first-group-1", Version: "first-version"},
- {Group: "first-group", Version: "first-version"},
- },
- KindsToRegister: []schema.GroupVersionKind{
- {Group: "first-group-1", Version: "first-version", Kind: "my-kind"},
- {Group: "first-group", Version: "first-version", Kind: "my-kind"},
- },
- PartialResourceToRequest: schema.GroupVersionResource{Group: "first-group", Resource: "my-kind"},
-
- ExpectedKinds: []schema.GroupVersionKind{
- {Group: "first-group", Version: "first-version", Kind: "my-kind"},
- },
- },
-
- {
- // group prefixes work
- Name: "groups, with group prefix",
- PreferredOrder: []schema.GroupVersion{
- {Group: "second-group", Version: "first-version"},
- {Group: "first-group", Version: "first-version"},
- },
- KindsToRegister: []schema.GroupVersionKind{
- {Group: "first-group", Version: "first-version", Kind: "my-kind"},
- {Group: "second-group", Version: "first-version", Kind: "my-kind"},
- },
- PartialResourceToRequest: schema.GroupVersionResource{Group: "first", Resource: "my-kind"},
-
- ExpectedKinds: []schema.GroupVersionKind{
- {Group: "first-group", Version: "first-version", Kind: "my-kind"},
- },
- },
-
- {
- // group prefixes can be ambiguous
- Name: "groups, with ambiguous group prefix",
- PreferredOrder: []schema.GroupVersion{
- {Group: "first-group-1", Version: "first-version"},
- {Group: "first-group", Version: "first-version"},
- },
- KindsToRegister: []schema.GroupVersionKind{
- {Group: "first-group-1", Version: "first-version", Kind: "my-kind"},
- {Group: "first-group", Version: "first-version", Kind: "my-kind"},
- },
- PartialResourceToRequest: schema.GroupVersionResource{Group: "first", Resource: "my-kind"},
-
- ExpectedKinds: []schema.GroupVersionKind{
- {Group: "first-group-1", Version: "first-version", Kind: "my-kind"},
- {Group: "first-group", Version: "first-version", Kind: "my-kind"},
- },
- ExpectedKindErr: " matches multiple kinds ",
- },
-
- {
- Name: "ambiguous groups, with preference order",
- PreferredOrder: []schema.GroupVersion{
- {Group: "second-group", Version: "first-version"},
- {Group: "first-group", Version: "first-version"},
- },
- KindsToRegister: []schema.GroupVersionKind{
- {Group: "first-group", Version: "first-version", Kind: "my-kind"},
- {Group: "first-group", Version: "first-version", Kind: "your-kind"},
- {Group: "second-group", Version: "first-version", Kind: "my-kind"},
- {Group: "second-group", Version: "first-version", Kind: "your-kind"},
- },
- PartialResourceToRequest: schema.GroupVersionResource{Resource: "my-kinds"},
-
- ExpectedKinds: []schema.GroupVersionKind{
- {Group: "second-group", Version: "first-version", Kind: "my-kind"},
- {Group: "first-group", Version: "first-version", Kind: "my-kind"},
- },
- ExpectedKindErr: " matches multiple kinds ",
- },
-
- {
- Name: "ambiguous groups, with explicit group match",
- PreferredOrder: []schema.GroupVersion{
- {Group: "second-group", Version: "first-version"},
- {Group: "first-group", Version: "first-version"},
- },
- KindsToRegister: []schema.GroupVersionKind{
- {Group: "first-group", Version: "first-version", Kind: "my-kind"},
- {Group: "first-group", Version: "first-version", Kind: "your-kind"},
- {Group: "second-group", Version: "first-version", Kind: "my-kind"},
- {Group: "second-group", Version: "first-version", Kind: "your-kind"},
- },
- PartialResourceToRequest: schema.GroupVersionResource{Group: "first-group", Resource: "my-kinds"},
-
- ExpectedKinds: []schema.GroupVersionKind{
- {Group: "first-group", Version: "first-version", Kind: "my-kind"},
- },
- },
-
- {
- Name: "ambiguous groups, with ambiguous version match",
- PreferredOrder: []schema.GroupVersion{
- {Group: "first-group", Version: "first-version"},
- {Group: "second-group", Version: "first-version"},
- },
- KindsToRegister: []schema.GroupVersionKind{
- {Group: "first-group", Version: "first-version", Kind: "my-kind"},
- {Group: "first-group", Version: "first-version", Kind: "your-kind"},
- {Group: "second-group", Version: "first-version", Kind: "my-kind"},
- {Group: "second-group", Version: "first-version", Kind: "your-kind"},
- },
- PartialResourceToRequest: schema.GroupVersionResource{Version: "first-version", Resource: "my-kinds"},
-
- ExpectedKinds: []schema.GroupVersionKind{
- {Group: "first-group", Version: "first-version", Kind: "my-kind"},
- {Group: "second-group", Version: "first-version", Kind: "my-kind"},
- },
- ExpectedKindErr: " matches multiple kinds ",
- },
- }
- for _, testCase := range testCases {
- tcName := testCase.Name
- mapper := NewDefaultRESTMapper(testCase.PreferredOrder)
- for _, kind := range testCase.KindsToRegister {
- mapper.Add(kind, RESTScopeNamespace)
- }
-
- actualKinds, err := mapper.KindsFor(testCase.PartialResourceToRequest)
- if err != nil {
- t.Errorf("%s: unexpected error: %v", tcName, err)
- continue
- }
- if !reflect.DeepEqual(testCase.ExpectedKinds, actualKinds) {
- t.Errorf("%s: expected %v, got %v", tcName, testCase.ExpectedKinds, actualKinds)
- }
-
- singleKind, err := mapper.KindFor(testCase.PartialResourceToRequest)
- if err == nil && len(testCase.ExpectedKindErr) != 0 {
- t.Errorf("%s: expected error: %v", tcName, testCase.ExpectedKindErr)
- continue
- }
- if err != nil {
- if len(testCase.ExpectedKindErr) == 0 {
- t.Errorf("%s: unexpected error: %v", tcName, err)
- continue
- } else {
- if !strings.Contains(err.Error(), testCase.ExpectedKindErr) {
- t.Errorf("%s: expected %v, got %v", tcName, testCase.ExpectedKindErr, err)
- continue
- }
- }
-
- } else {
- if testCase.ExpectedKinds[0] != singleKind {
- t.Errorf("%s: expected %v, got %v", tcName, testCase.ExpectedKinds[0], singleKind)
- }
-
- }
- }
-}
-
-func TestRESTMapperResourcesFor(t *testing.T) {
- testCases := []struct {
- Name string
- PreferredOrder []schema.GroupVersion
- KindsToRegister []schema.GroupVersionKind
- PluralPartialResourceToRequest schema.GroupVersionResource
- SingularPartialResourceToRequest schema.GroupVersionResource
-
- ExpectedResources []schema.GroupVersionResource
- ExpectedResourceErr string
- }{
- {
- // exact matches are preferred
- Name: "groups, with group exact",
- PreferredOrder: []schema.GroupVersion{
- {Group: "first-group-1", Version: "first-version"},
- {Group: "first-group", Version: "first-version"},
- },
- KindsToRegister: []schema.GroupVersionKind{
- {Group: "first-group-1", Version: "first-version", Kind: "my-kind"},
- {Group: "first-group", Version: "first-version", Kind: "my-kind"},
- },
- PluralPartialResourceToRequest: schema.GroupVersionResource{Group: "first-group", Resource: "my-kinds"},
- SingularPartialResourceToRequest: schema.GroupVersionResource{Group: "first-group", Resource: "my-kind"},
-
- ExpectedResources: []schema.GroupVersionResource{
- {Group: "first-group", Version: "first-version", Resource: "my-kinds"},
- },
- },
-
- {
- // group prefixes work
- Name: "groups, with group prefix",
- PreferredOrder: []schema.GroupVersion{
- {Group: "second-group", Version: "first-version"},
- {Group: "first-group", Version: "first-version"},
- },
- KindsToRegister: []schema.GroupVersionKind{
- {Group: "first-group", Version: "first-version", Kind: "my-kind"},
- {Group: "second-group", Version: "first-version", Kind: "my-kind"},
- },
- PluralPartialResourceToRequest: schema.GroupVersionResource{Group: "first", Resource: "my-kinds"},
- SingularPartialResourceToRequest: schema.GroupVersionResource{Group: "first", Resource: "my-kind"},
-
- ExpectedResources: []schema.GroupVersionResource{
- {Group: "first-group", Version: "first-version", Resource: "my-kinds"},
- },
- },
-
- {
- // group prefixes can be ambiguous
- Name: "groups, with ambiguous group prefix",
- PreferredOrder: []schema.GroupVersion{
- {Group: "first-group-1", Version: "first-version"},
- {Group: "first-group", Version: "first-version"},
- },
- KindsToRegister: []schema.GroupVersionKind{
- {Group: "first-group-1", Version: "first-version", Kind: "my-kind"},
- {Group: "first-group", Version: "first-version", Kind: "my-kind"},
- },
- PluralPartialResourceToRequest: schema.GroupVersionResource{Group: "first", Resource: "my-kinds"},
- SingularPartialResourceToRequest: schema.GroupVersionResource{Group: "first", Resource: "my-kind"},
-
- ExpectedResources: []schema.GroupVersionResource{
- {Group: "first-group-1", Version: "first-version", Resource: "my-kinds"},
- {Group: "first-group", Version: "first-version", Resource: "my-kinds"},
- },
- ExpectedResourceErr: " matches multiple resources ",
- },
-
- {
- Name: "ambiguous groups, with preference order",
- PreferredOrder: []schema.GroupVersion{
- {Group: "second-group", Version: "first-version"},
- {Group: "first-group", Version: "first-version"},
- },
- KindsToRegister: []schema.GroupVersionKind{
- {Group: "first-group", Version: "first-version", Kind: "my-kind"},
- {Group: "first-group", Version: "first-version", Kind: "your-kind"},
- {Group: "second-group", Version: "first-version", Kind: "my-kind"},
- {Group: "second-group", Version: "first-version", Kind: "your-kind"},
- },
- PluralPartialResourceToRequest: schema.GroupVersionResource{Resource: "my-kinds"},
- SingularPartialResourceToRequest: schema.GroupVersionResource{Resource: "my-kind"},
-
- ExpectedResources: []schema.GroupVersionResource{
- {Group: "second-group", Version: "first-version", Resource: "my-kinds"},
- {Group: "first-group", Version: "first-version", Resource: "my-kinds"},
- },
- ExpectedResourceErr: " matches multiple resources ",
- },
-
- {
- Name: "ambiguous groups, with explicit group match",
- PreferredOrder: []schema.GroupVersion{
- {Group: "second-group", Version: "first-version"},
- {Group: "first-group", Version: "first-version"},
- },
- KindsToRegister: []schema.GroupVersionKind{
- {Group: "first-group", Version: "first-version", Kind: "my-kind"},
- {Group: "first-group", Version: "first-version", Kind: "your-kind"},
- {Group: "second-group", Version: "first-version", Kind: "my-kind"},
- {Group: "second-group", Version: "first-version", Kind: "your-kind"},
- },
- PluralPartialResourceToRequest: schema.GroupVersionResource{Group: "first-group", Resource: "my-kinds"},
- SingularPartialResourceToRequest: schema.GroupVersionResource{Group: "first-group", Resource: "my-kind"},
-
- ExpectedResources: []schema.GroupVersionResource{
- {Group: "first-group", Version: "first-version", Resource: "my-kinds"},
- },
- },
-
- {
- Name: "ambiguous groups, with ambiguous version match",
- PreferredOrder: []schema.GroupVersion{
- {Group: "first-group", Version: "first-version"},
- {Group: "second-group", Version: "first-version"},
- },
- KindsToRegister: []schema.GroupVersionKind{
- {Group: "first-group", Version: "first-version", Kind: "my-kind"},
- {Group: "first-group", Version: "first-version", Kind: "your-kind"},
- {Group: "second-group", Version: "first-version", Kind: "my-kind"},
- {Group: "second-group", Version: "first-version", Kind: "your-kind"},
- },
- PluralPartialResourceToRequest: schema.GroupVersionResource{Version: "first-version", Resource: "my-kinds"},
- SingularPartialResourceToRequest: schema.GroupVersionResource{Version: "first-version", Resource: "my-kind"},
-
- ExpectedResources: []schema.GroupVersionResource{
- {Group: "first-group", Version: "first-version", Resource: "my-kinds"},
- {Group: "second-group", Version: "first-version", Resource: "my-kinds"},
- },
- ExpectedResourceErr: " matches multiple resources ",
- },
- }
- for _, testCase := range testCases {
- tcName := testCase.Name
-
- for _, partialResource := range []schema.GroupVersionResource{testCase.PluralPartialResourceToRequest, testCase.SingularPartialResourceToRequest} {
- mapper := NewDefaultRESTMapper(testCase.PreferredOrder)
- for _, kind := range testCase.KindsToRegister {
- mapper.Add(kind, RESTScopeNamespace)
- }
-
- actualResources, err := mapper.ResourcesFor(partialResource)
- if err != nil {
- t.Errorf("%s: unexpected error: %v", tcName, err)
- continue
- }
- if !reflect.DeepEqual(testCase.ExpectedResources, actualResources) {
- t.Errorf("%s: expected %v, got %v", tcName, testCase.ExpectedResources, actualResources)
- }
-
- singleResource, err := mapper.ResourceFor(partialResource)
- if err == nil && len(testCase.ExpectedResourceErr) != 0 {
- t.Errorf("%s: expected error: %v", tcName, testCase.ExpectedResourceErr)
- continue
- }
- if err != nil {
- if len(testCase.ExpectedResourceErr) == 0 {
- t.Errorf("%s: unexpected error: %v", tcName, err)
- continue
- } else {
- if !strings.Contains(err.Error(), testCase.ExpectedResourceErr) {
- t.Errorf("%s: expected %v, got %v", tcName, testCase.ExpectedResourceErr, err)
- continue
- }
- }
-
- } else {
- if testCase.ExpectedResources[0] != singleResource {
- t.Errorf("%s: expected %v, got %v", tcName, testCase.ExpectedResources[0], singleResource)
- }
-
- }
- }
- }
-}
-
-func TestKindToResource(t *testing.T) {
- testCases := []struct {
- Kind string
- Plural, Singular string
- }{
- {Kind: "Pod", Plural: "pods", Singular: "pod"},
-
- {Kind: "ReplicationController", Plural: "replicationcontrollers", Singular: "replicationcontroller"},
-
- // Add "ies" when ending with "y"
- {Kind: "ImageRepository", Plural: "imagerepositories", Singular: "imagerepository"},
- // Add "es" when ending with "s"
- {Kind: "miss", Plural: "misses", Singular: "miss"},
- // Add "s" otherwise
- {Kind: "lowercase", Plural: "lowercases", Singular: "lowercase"},
- }
- for i, testCase := range testCases {
- version := schema.GroupVersion{}
-
- plural, singular := UnsafeGuessKindToResource(version.WithKind(testCase.Kind))
- if singular != version.WithResource(testCase.Singular) || plural != version.WithResource(testCase.Plural) {
- t.Errorf("%d: unexpected plural and singular: %v %v", i, plural, singular)
- }
- }
-}
-
-func TestRESTMapperResourceSingularizer(t *testing.T) {
- testGroupVersion := schema.GroupVersion{Group: "tgroup", Version: "test"}
-
- testCases := []struct {
- Kind string
- Plural string
- Singular string
- }{
- {Kind: "Pod", Plural: "pods", Singular: "pod"},
- {Kind: "ReplicationController", Plural: "replicationcontrollers", Singular: "replicationcontroller"},
- {Kind: "ImageRepository", Plural: "imagerepositories", Singular: "imagerepository"},
- {Kind: "Status", Plural: "statuses", Singular: "status"},
-
- {Kind: "lowercase", Plural: "lowercases", Singular: "lowercase"},
- // TODO this test is broken. This updates to reflect actual behavior. Kinds are expected to be singular
- // old (incorrect), comment: Don't add extra s if the original object is already plural
- {Kind: "lowercases", Plural: "lowercaseses", Singular: "lowercases"},
- }
- for i, testCase := range testCases {
- mapper := NewDefaultRESTMapper([]schema.GroupVersion{testGroupVersion})
- // create singular/plural mapping
- mapper.Add(testGroupVersion.WithKind(testCase.Kind), RESTScopeNamespace)
-
- singular, err := mapper.ResourceSingularizer(testCase.Plural)
- if err != nil {
- t.Errorf("%d: unexpected error: %v", i, err)
- }
- if singular != testCase.Singular {
- t.Errorf("%d: mismatched singular: got %v, expected %v", i, singular, testCase.Singular)
- }
- }
-}
-
-func TestRESTMapperRESTMapping(t *testing.T) {
- testGroup := "tgroup"
- testGroupVersion := schema.GroupVersion{Group: testGroup, Version: "test"}
- internalGroupVersion := schema.GroupVersion{Group: testGroup, Version: "test"}
-
- testCases := []struct {
- Kind string
- APIGroupVersions []schema.GroupVersion
- DefaultVersions []schema.GroupVersion
-
- Resource schema.GroupVersionResource
- ExpectedGroupVersion *schema.GroupVersion
- Err bool
- }{
- {Kind: "Unknown", Err: true},
- {Kind: "InternalObject", Err: true},
-
- {DefaultVersions: []schema.GroupVersion{testGroupVersion}, Kind: "Unknown", Err: true},
-
- {DefaultVersions: []schema.GroupVersion{testGroupVersion}, Kind: "InternalObject", APIGroupVersions: []schema.GroupVersion{{Group: testGroup, Version: "test"}}, Resource: testGroupVersion.WithResource("internalobjects")},
- {DefaultVersions: []schema.GroupVersion{testGroupVersion}, Kind: "InternalObject", APIGroupVersions: []schema.GroupVersion{{Group: testGroup, Version: "test"}}, Resource: testGroupVersion.WithResource("internalobjects")},
-
- {DefaultVersions: []schema.GroupVersion{testGroupVersion}, Kind: "InternalObject", APIGroupVersions: []schema.GroupVersion{{Group: testGroup, Version: "test"}}, Resource: testGroupVersion.WithResource("internalobjects")},
-
- {DefaultVersions: []schema.GroupVersion{testGroupVersion}, Kind: "InternalObject", APIGroupVersions: []schema.GroupVersion{}, Resource: internalGroupVersion.WithResource("internalobjects"), ExpectedGroupVersion: &schema.GroupVersion{Group: testGroup, Version: "test"}},
-
- {DefaultVersions: []schema.GroupVersion{testGroupVersion}, Kind: "InternalObject", APIGroupVersions: []schema.GroupVersion{{Group: testGroup, Version: "test"}}, Resource: testGroupVersion.WithResource("internalobjects")},
-
- // TODO: add test for a resource that exists in one version but not another
- }
- for i, testCase := range testCases {
- mapper := NewDefaultRESTMapper(testCase.DefaultVersions)
- mapper.Add(internalGroupVersion.WithKind("InternalObject"), RESTScopeNamespace)
-
- preferredVersions := []string{}
- for _, gv := range testCase.APIGroupVersions {
- preferredVersions = append(preferredVersions, gv.Version)
- }
- gk := schema.GroupKind{Group: testGroup, Kind: testCase.Kind}
-
- mapping, err := mapper.RESTMapping(gk, preferredVersions...)
- hasErr := err != nil
- if hasErr != testCase.Err {
- t.Errorf("%d: unexpected error behavior %t: %v", i, testCase.Err, err)
- }
- if hasErr {
- continue
- }
- if mapping.Resource != testCase.Resource {
- t.Errorf("%d: unexpected resource: %#v", i, mapping)
- }
-
- groupVersion := testCase.ExpectedGroupVersion
- if groupVersion == nil {
- groupVersion = &testCase.APIGroupVersions[0]
- }
- if mapping.GroupVersionKind.GroupVersion() != *groupVersion {
- t.Errorf("%d: unexpected version: %#v", i, mapping)
- }
-
- }
-}
-
-func TestRESTMapperRESTMappingSelectsVersion(t *testing.T) {
- expectedGroupVersion1 := schema.GroupVersion{Group: "tgroup", Version: "test1"}
- expectedGroupVersion2 := schema.GroupVersion{Group: "tgroup", Version: "test2"}
- expectedGroupVersion3 := schema.GroupVersion{Group: "tgroup", Version: "test3"}
- internalObjectGK := schema.GroupKind{Group: "tgroup", Kind: "InternalObject"}
- otherObjectGK := schema.GroupKind{Group: "tgroup", Kind: "OtherObject"}
-
- mapper := NewDefaultRESTMapper([]schema.GroupVersion{expectedGroupVersion1, expectedGroupVersion2})
- mapper.Add(expectedGroupVersion1.WithKind("InternalObject"), RESTScopeNamespace)
- mapper.Add(expectedGroupVersion2.WithKind("OtherObject"), RESTScopeNamespace)
-
- // pick default matching object kind based on search order
- mapping, err := mapper.RESTMapping(otherObjectGK)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- if mapping.Resource != expectedGroupVersion2.WithResource("otherobjects") || mapping.GroupVersionKind.GroupVersion() != expectedGroupVersion2 {
- t.Errorf("unexpected mapping: %#v", mapping)
- }
-
- mapping, err = mapper.RESTMapping(internalObjectGK)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- if mapping.Resource != expectedGroupVersion1.WithResource("internalobjects") || mapping.GroupVersionKind.GroupVersion() != expectedGroupVersion1 {
- t.Errorf("unexpected mapping: %#v", mapping)
- }
-
- // mismatch of version
- mapping, err = mapper.RESTMapping(internalObjectGK, expectedGroupVersion2.Version)
- if err == nil {
- t.Errorf("unexpected non-error")
- }
- mapping, err = mapper.RESTMapping(otherObjectGK, expectedGroupVersion1.Version)
- if err == nil {
- t.Errorf("unexpected non-error")
- }
-
- // not in the search versions
- mapping, err = mapper.RESTMapping(otherObjectGK, expectedGroupVersion3.Version)
- if err == nil {
- t.Errorf("unexpected non-error")
- }
-
- // explicit search order
- mapping, err = mapper.RESTMapping(otherObjectGK, expectedGroupVersion3.Version, expectedGroupVersion1.Version)
- if err == nil {
- t.Errorf("unexpected non-error")
- }
-
- mapping, err = mapper.RESTMapping(otherObjectGK, expectedGroupVersion3.Version, expectedGroupVersion2.Version)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- if mapping.Resource != expectedGroupVersion2.WithResource("otherobjects") || mapping.GroupVersionKind.GroupVersion() != expectedGroupVersion2 {
- t.Errorf("unexpected mapping: %#v", mapping)
- }
-}
-
-func TestRESTMapperRESTMappings(t *testing.T) {
- testGroup := "tgroup"
- testGroupVersion := schema.GroupVersion{Group: testGroup, Version: "v1"}
-
- testCases := []struct {
- Kind string
- APIGroupVersions []schema.GroupVersion
- DefaultVersions []schema.GroupVersion
- AddGroupVersionKind []schema.GroupVersionKind
-
- ExpectedRESTMappings []*RESTMapping
- Err bool
- }{
- {Kind: "Unknown", Err: true},
- {Kind: "InternalObject", Err: true},
-
- {DefaultVersions: []schema.GroupVersion{testGroupVersion}, Kind: "Unknown", Err: true},
-
- // ask for specific version - not available - thus error
- {DefaultVersions: []schema.GroupVersion{testGroupVersion}, Kind: "InternalObject", APIGroupVersions: []schema.GroupVersion{{Group: testGroup, Version: "v2"}}, Err: true},
-
- // ask for specific version - available - check ExpectedRESTMappings
- {
- DefaultVersions: []schema.GroupVersion{testGroupVersion},
- Kind: "InternalObject",
- APIGroupVersions: []schema.GroupVersion{{Group: testGroup, Version: "v2"}},
- AddGroupVersionKind: []schema.GroupVersionKind{schema.GroupVersion{Group: testGroup, Version: "v2"}.WithKind("InternalObject")},
- ExpectedRESTMappings: []*RESTMapping{{Resource: schema.GroupVersionResource{Group: testGroup, Version: "v2", Resource: "internalobjects"}, GroupVersionKind: schema.GroupVersionKind{Group: testGroup, Version: "v2", Kind: "InternalObject"}}},
- },
-
- // ask for specific versions - only one available - check ExpectedRESTMappings
- {
- DefaultVersions: []schema.GroupVersion{testGroupVersion},
- Kind: "InternalObject",
- APIGroupVersions: []schema.GroupVersion{{Group: testGroup, Version: "v3"}, {Group: testGroup, Version: "v2"}},
- AddGroupVersionKind: []schema.GroupVersionKind{schema.GroupVersion{Group: testGroup, Version: "v2"}.WithKind("InternalObject")},
- ExpectedRESTMappings: []*RESTMapping{{Resource: schema.GroupVersionResource{Group: testGroup, Version: "v2", Resource: "internalobjects"}, GroupVersionKind: schema.GroupVersionKind{Group: testGroup, Version: "v2", Kind: "InternalObject"}}},
- },
-
- // do not ask for specific version - search through default versions - check ExpectedRESTMappings
- {
- DefaultVersions: []schema.GroupVersion{testGroupVersion, {Group: testGroup, Version: "v2"}},
- Kind: "InternalObject",
- AddGroupVersionKind: []schema.GroupVersionKind{schema.GroupVersion{Group: testGroup, Version: "v1"}.WithKind("InternalObject"), schema.GroupVersion{Group: testGroup, Version: "v2"}.WithKind("InternalObject")},
- ExpectedRESTMappings: []*RESTMapping{
- {
- Resource: schema.GroupVersionResource{Group: testGroup, Version: "v1", Resource: "internalobjects"},
- GroupVersionKind: schema.GroupVersionKind{Group: testGroup, Version: "v1", Kind: "InternalObject"},
- },
- {
- Resource: schema.GroupVersionResource{Group: testGroup, Version: "v2", Resource: "internalobjects"},
- GroupVersionKind: schema.GroupVersionKind{Group: testGroup, Version: "v2", Kind: "InternalObject"},
- },
- },
- },
- }
-
- for i, testCase := range testCases {
- mapper := NewDefaultRESTMapper(testCase.DefaultVersions)
- for _, gvk := range testCase.AddGroupVersionKind {
- mapper.Add(gvk, RESTScopeNamespace)
- }
-
- preferredVersions := []string{}
- for _, gv := range testCase.APIGroupVersions {
- preferredVersions = append(preferredVersions, gv.Version)
- }
- gk := schema.GroupKind{Group: testGroup, Kind: testCase.Kind}
-
- mappings, err := mapper.RESTMappings(gk, preferredVersions...)
- hasErr := err != nil
- if hasErr != testCase.Err {
- t.Errorf("%d: unexpected error behavior %t: %v", i, testCase.Err, err)
- }
- if hasErr {
- continue
- }
- if len(mappings) != len(testCase.ExpectedRESTMappings) {
- t.Errorf("%d: unexpected number = %d of rest mappings was returned, expected = %d", i, len(mappings), len(testCase.ExpectedRESTMappings))
- }
- for j, mapping := range mappings {
- exp := testCase.ExpectedRESTMappings[j]
- if mapping.Resource != exp.Resource {
- t.Errorf("%d - %d: unexpected resource: %#v", i, j, mapping)
- }
- if mapping.GroupVersionKind != exp.GroupVersionKind {
- t.Errorf("%d - %d: unexpected GroupVersionKind: %#v", i, j, mapping)
- }
- }
- }
-}
-
-func TestRESTMapperReportsErrorOnBadVersion(t *testing.T) {
- expectedGroupVersion1 := schema.GroupVersion{Group: "tgroup", Version: "test1"}
- expectedGroupVersion2 := schema.GroupVersion{Group: "tgroup", Version: "test2"}
- internalObjectGK := schema.GroupKind{Group: "tgroup", Kind: "InternalObject"}
-
- mapper := NewDefaultRESTMapper([]schema.GroupVersion{expectedGroupVersion1, expectedGroupVersion2})
- mapper.Add(expectedGroupVersion1.WithKind("InternalObject"), RESTScopeNamespace)
- _, err := mapper.RESTMapping(internalObjectGK, "test3")
- if err == nil {
- t.Errorf("unexpected non-error")
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/api/resource/amount_test.go b/vendor/k8s.io/apimachinery/pkg/api/resource/amount_test.go
deleted file mode 100644
index dd070bad3..000000000
--- a/vendor/k8s.io/apimachinery/pkg/api/resource/amount_test.go
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package resource
-
-import (
- "testing"
-)
-
-func TestInt64AmountAsInt64(t *testing.T) {
- for _, test := range []struct {
- value int64
- scale Scale
- result int64
- ok bool
- }{
- {100, 0, 100, true},
- {100, 1, 1000, true},
- {100, -5, 0, false},
- {100, 100, 0, false},
- } {
- r, ok := int64Amount{value: test.value, scale: test.scale}.AsInt64()
- if r != test.result {
- t.Errorf("%v: unexpected result: %d", test, r)
- }
- if ok != test.ok {
- t.Errorf("%v: unexpected ok: %t", test, ok)
- }
- }
-}
-
-func TestInt64AmountAdd(t *testing.T) {
- for _, test := range []struct {
- a, b, c int64Amount
- ok bool
- }{
- {int64Amount{value: 100, scale: 1}, int64Amount{value: 10, scale: 2}, int64Amount{value: 200, scale: 1}, true},
- {int64Amount{value: 100, scale: 1}, int64Amount{value: 1, scale: 2}, int64Amount{value: 110, scale: 1}, true},
- {int64Amount{value: 100, scale: 1}, int64Amount{value: 1, scale: 100}, int64Amount{value: 1, scale: 100}, false},
- {int64Amount{value: -5, scale: 2}, int64Amount{value: 50, scale: 1}, int64Amount{value: 0, scale: 1}, true},
- {int64Amount{value: -5, scale: 2}, int64Amount{value: 5, scale: 2}, int64Amount{value: 0, scale: 2}, true},
-
- {int64Amount{value: mostPositive, scale: -1}, int64Amount{value: 1, scale: -1}, int64Amount{value: 0, scale: -1}, false},
- {int64Amount{value: mostPositive, scale: -1}, int64Amount{value: 0, scale: -1}, int64Amount{value: mostPositive, scale: -1}, true},
- {int64Amount{value: mostPositive / 10, scale: 1}, int64Amount{value: 10, scale: 0}, int64Amount{value: mostPositive, scale: -1}, false},
- } {
- c := test.a
- ok := c.Add(test.b)
- if ok != test.ok {
- t.Errorf("%v: unexpected ok: %t", test, ok)
- }
- if ok {
- if c != test.c {
- t.Errorf("%v: unexpected result: %d", test, c)
- }
- } else {
- if c != test.a {
- t.Errorf("%v: overflow addition mutated source: %d", test, c)
- }
- }
-
- // addition is commutative
- c = test.b
- if ok := c.Add(test.a); ok != test.ok {
- t.Errorf("%v: unexpected ok: %t", test, ok)
- }
- if ok {
- if c != test.c {
- t.Errorf("%v: unexpected result: %d", test, c)
- }
- } else {
- if c != test.b {
- t.Errorf("%v: overflow addition mutated source: %d", test, c)
- }
- }
- }
-}
-func TestInt64AsCanonicalString(t *testing.T) {
- for _, test := range []struct {
- value int64
- scale Scale
- result string
- exponent int32
- }{
- {100, 0, "100", 0},
- {100, 1, "1", 3},
- {100, -1, "10", 0},
- {10800, -10, "1080", -9},
- } {
- r, exp := int64Amount{value: test.value, scale: test.scale}.AsCanonicalBytes(nil)
- if string(r) != test.result {
- t.Errorf("%v: unexpected result: %s", test, r)
- }
- if exp != test.exponent {
- t.Errorf("%v: unexpected exponent: %d", test, exp)
- }
- }
-}
-
-func TestAmountSign(t *testing.T) {
- table := []struct {
- i int64Amount
- expect int
- }{
- {int64Amount{value: -50, scale: 1}, -1},
- {int64Amount{value: 0, scale: 1}, 0},
- {int64Amount{value: 300, scale: 1}, 1},
- {int64Amount{value: -50, scale: -8}, -1},
- {int64Amount{value: 50, scale: -8}, 1},
- {int64Amount{value: 0, scale: -8}, 0},
- {int64Amount{value: -50, scale: 0}, -1},
- {int64Amount{value: 50, scale: 0}, 1},
- {int64Amount{value: 0, scale: 0}, 0},
- }
- for _, testCase := range table {
- if result := testCase.i.Sign(); result != testCase.expect {
- t.Errorf("i: %v, Expected: %v, Actual: %v", testCase.i, testCase.expect, result)
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/api/resource/math_test.go b/vendor/k8s.io/apimachinery/pkg/api/resource/math_test.go
deleted file mode 100644
index 070a0c237..000000000
--- a/vendor/k8s.io/apimachinery/pkg/api/resource/math_test.go
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package resource
-
-import (
- "testing"
-)
-
-func TestDetectOverflowAdd(t *testing.T) {
- for _, test := range []struct {
- a, b int64
- c int64
- ok bool
- }{
- {0, 0, 0, true},
- {-1, 1, 0, true},
- {0, 1, 1, true},
- {2, 2, 4, true},
- {2, -2, 0, true},
- {-2, -2, -4, true},
-
- {mostNegative, -1, 0, false},
- {mostNegative, 1, mostNegative + 1, true},
- {mostPositive, -1, mostPositive - 1, true},
- {mostPositive, 1, 0, false},
-
- {mostNegative, mostPositive, -1, true},
- {mostPositive, mostNegative, -1, true},
- {mostPositive, mostPositive, 0, false},
- {mostNegative, mostNegative, 0, false},
-
- {-mostPositive, mostNegative, 0, false},
- {mostNegative, -mostPositive, 0, false},
- {-mostPositive, -mostPositive, 0, false},
- } {
- c, ok := int64Add(test.a, test.b)
- if c != test.c {
- t.Errorf("%v: unexpected result: %d", test, c)
- }
- if ok != test.ok {
- t.Errorf("%v: unexpected overflow: %t", test, ok)
- }
- // addition is commutative
- d, ok2 := int64Add(test.b, test.a)
- if c != d || ok != ok2 {
- t.Errorf("%v: not commutative: %d %t", test, d, ok2)
- }
- }
-}
-
-func TestDetectOverflowMultiply(t *testing.T) {
- for _, test := range []struct {
- a, b int64
- c int64
- ok bool
- }{
- {0, 0, 0, true},
- {-1, 1, -1, true},
- {-1, -1, 1, true},
- {1, 1, 1, true},
- {0, 1, 0, true},
- {1, 0, 0, true},
- {2, 2, 4, true},
- {2, -2, -4, true},
- {-2, -2, 4, true},
-
- {mostNegative, -1, 0, false},
- {mostNegative, 1, mostNegative, true},
- {mostPositive, -1, -mostPositive, true},
- {mostPositive, 1, mostPositive, true},
-
- {mostNegative, mostPositive, 0, false},
- {mostPositive, mostNegative, 0, false},
- {mostPositive, mostPositive, 1, false},
- {mostNegative, mostNegative, 0, false},
-
- {-mostPositive, mostNegative, 0, false},
- {mostNegative, -mostPositive, 0, false},
- {-mostPositive, -mostPositive, 1, false},
- } {
- c, ok := int64Multiply(test.a, test.b)
- if c != test.c {
- t.Errorf("%v: unexpected result: %d", test, c)
- }
- if ok != test.ok {
- t.Errorf("%v: unexpected overflow: %t", test, ok)
- }
- // multiplication is commutative
- d, ok2 := int64Multiply(test.b, test.a)
- if c != d || ok != ok2 {
- t.Errorf("%v: not commutative: %d %t", test, d, ok2)
- }
- }
-}
-
-func TestDetectOverflowScale(t *testing.T) {
- for _, a := range []int64{0, -1, 1, 10, -10, mostPositive, mostNegative, -mostPositive} {
- for _, b := range []int64{1, 2, 10, 100, 1000, mostPositive} {
- expect, expectOk := int64Multiply(a, b)
-
- c, ok := int64MultiplyScale(a, b)
- if c != expect {
- t.Errorf("%d*%d: unexpected result: %d", a, b, c)
- }
- if ok != expectOk {
- t.Errorf("%d*%d: unexpected overflow: %t", a, b, ok)
- }
- }
- for _, test := range []struct {
- base int64
- fn func(a int64) (int64, bool)
- }{
- {10, int64MultiplyScale10},
- {100, int64MultiplyScale100},
- {1000, int64MultiplyScale1000},
- } {
- expect, expectOk := int64Multiply(a, test.base)
- c, ok := test.fn(a)
- if c != expect {
- t.Errorf("%d*%d: unexpected result: %d", a, test.base, c)
- }
- if ok != expectOk {
- t.Errorf("%d*%d: unexpected overflow: %t", a, test.base, ok)
- }
- }
- }
-}
-
-func TestRemoveInt64Factors(t *testing.T) {
- for _, test := range []struct {
- value int64
- max int64
- result int64
- scale int32
- }{
- {100, 10, 1, 2},
- {100, 10, 1, 2},
- {100, 100, 1, 1},
- {1, 10, 1, 0},
- } {
- r, s := removeInt64Factors(test.value, test.max)
- if r != test.result {
- t.Errorf("%v: unexpected result: %d", test, r)
- }
- if s != test.scale {
- t.Errorf("%v: unexpected scale: %d", test, s)
- }
- }
-}
-
-func TestNegativeScaleInt64(t *testing.T) {
- for _, test := range []struct {
- base int64
- scale Scale
- result int64
- exact bool
- }{
- {1234567, 0, 1234567, true},
- {1234567, 1, 123457, false},
- {1234567, 2, 12346, false},
- {1234567, 3, 1235, false},
- {1234567, 4, 124, false},
-
- {-1234567, 0, -1234567, true},
- {-1234567, 1, -123457, false},
- {-1234567, 2, -12346, false},
- {-1234567, 3, -1235, false},
- {-1234567, 4, -124, false},
-
- {1000, 0, 1000, true},
- {1000, 1, 100, true},
- {1000, 2, 10, true},
- {1000, 3, 1, true},
- {1000, 4, 1, false},
-
- {-1000, 0, -1000, true},
- {-1000, 1, -100, true},
- {-1000, 2, -10, true},
- {-1000, 3, -1, true},
- {-1000, 4, -1, false},
-
- {0, 0, 0, true},
- {0, 1, 0, true},
- {0, 2, 0, true},
-
- // negative scale is undefined behavior
- {1000, -1, 1000, true},
- } {
- result, exact := negativeScaleInt64(test.base, test.scale)
- if result != test.result {
- t.Errorf("%v: unexpected result: %d", test, result)
- }
- if exact != test.exact {
- t.Errorf("%v: unexpected exact: %t", test, exact)
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/api/resource/quantity_example_test.go b/vendor/k8s.io/apimachinery/pkg/api/resource/quantity_example_test.go
deleted file mode 100644
index 56a7dbe0e..000000000
--- a/vendor/k8s.io/apimachinery/pkg/api/resource/quantity_example_test.go
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package resource_test
-
-import (
- "fmt"
-
- "k8s.io/apimachinery/pkg/api/resource"
-)
-
-func ExampleFormat() {
- memorySize := resource.NewQuantity(5*1024*1024*1024, resource.BinarySI)
- fmt.Printf("memorySize = %v\n", memorySize)
-
- diskSize := resource.NewQuantity(5*1000*1000*1000, resource.DecimalSI)
- fmt.Printf("diskSize = %v\n", diskSize)
-
- cores := resource.NewMilliQuantity(5300, resource.DecimalSI)
- fmt.Printf("cores = %v\n", cores)
-
- // Output:
- // memorySize = 5Gi
- // diskSize = 5G
- // cores = 5300m
-}
-
-func ExampleMustParse() {
- memorySize := resource.MustParse("5Gi")
- fmt.Printf("memorySize = %v (%v)\n", memorySize.Value(), memorySize.Format)
-
- diskSize := resource.MustParse("5G")
- fmt.Printf("diskSize = %v (%v)\n", diskSize.Value(), diskSize.Format)
-
- cores := resource.MustParse("5300m")
- fmt.Printf("milliCores = %v (%v)\n", cores.MilliValue(), cores.Format)
-
- cores2 := resource.MustParse("5.4")
- fmt.Printf("milliCores = %v (%v)\n", cores2.MilliValue(), cores2.Format)
-
- // Output:
- // memorySize = 5368709120 (BinarySI)
- // diskSize = 5000000000 (DecimalSI)
- // milliCores = 5300 (DecimalSI)
- // milliCores = 5400 (DecimalSI)
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/api/resource/quantity_proto_test.go b/vendor/k8s.io/apimachinery/pkg/api/resource/quantity_proto_test.go
deleted file mode 100644
index 574a3cf5d..000000000
--- a/vendor/k8s.io/apimachinery/pkg/api/resource/quantity_proto_test.go
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package resource
-
-import (
- "testing"
-
- inf "gopkg.in/inf.v0"
-)
-
-func TestQuantityProtoMarshal(t *testing.T) {
- // Test when d is nil
- table := []struct {
- quantity string
- expect Quantity
- }{
- {"0", Quantity{i: int64Amount{value: 0, scale: 0}, s: "0", Format: DecimalSI}},
- {"100m", Quantity{i: int64Amount{value: 100, scale: -3}, s: "100m", Format: DecimalSI}},
- {"50m", Quantity{i: int64Amount{value: 50, scale: -3}, s: "50m", Format: DecimalSI}},
- {"10000T", Quantity{i: int64Amount{value: 10000, scale: 12}, s: "10000T", Format: DecimalSI}},
- }
- for _, testCase := range table {
- q := MustParse(testCase.quantity)
- // Won't currently get an error as MarshalTo can't return one
- result, _ := q.Marshal()
- q.MarshalTo(result)
- if q.Cmp(testCase.expect) != 0 {
- t.Errorf("Expected: %v, Actual: %v", testCase.expect, q)
- }
- }
- // Test when i is {0,0}
- table2 := []struct {
- dec *inf.Dec
- expect Quantity
- }{
- {dec(0, 0).Dec, Quantity{i: int64Amount{value: 0, scale: 0}, d: infDecAmount{dec(0, 0).Dec}, s: "0", Format: DecimalSI}},
- {dec(10, 0).Dec, Quantity{i: int64Amount{value: 0, scale: 0}, d: infDecAmount{dec(10, 0).Dec}, s: "10", Format: DecimalSI}},
- {dec(-10, 0).Dec, Quantity{i: int64Amount{value: 0, scale: 0}, d: infDecAmount{dec(-10, 0).Dec}, s: "-10", Format: DecimalSI}},
- }
- for _, testCase := range table2 {
- q := Quantity{d: infDecAmount{testCase.dec}, Format: DecimalSI}
- // Won't currently get an error as MarshalTo can't return one
- result, _ := q.Marshal()
- q.Unmarshal(result)
- if q.Cmp(testCase.expect) != 0 {
- t.Errorf("Expected: %v, Actual: %v", testCase.expect, q)
- }
- }
-}
-
-func TestQuantityProtoUnmarshal(t *testing.T) {
- // Test when d is nil
- table := []struct {
- input Quantity
- expect string
- }{
- {Quantity{i: int64Amount{value: 0, scale: 0}, s: "0", Format: DecimalSI}, "0"},
- {Quantity{i: int64Amount{value: 100, scale: -3}, s: "100m", Format: DecimalSI}, "100m"},
- {Quantity{i: int64Amount{value: 50, scale: -3}, s: "50m", Format: DecimalSI}, "50m"},
- {Quantity{i: int64Amount{value: 10000, scale: 12}, s: "10000T", Format: DecimalSI}, "10000T"},
- }
- for _, testCase := range table {
- var inputQ Quantity
- expectQ := MustParse(testCase.expect)
- inputByteArray, _ := testCase.input.Marshal()
- inputQ.Unmarshal(inputByteArray)
- if inputQ.Cmp(expectQ) != 0 {
- t.Errorf("Expected: %v, Actual: %v", inputQ, expectQ)
- }
- }
- // Test when i is {0,0}
- table2 := []struct {
- input Quantity
- expect *inf.Dec
- }{
- {Quantity{i: int64Amount{value: 0, scale: 0}, d: infDecAmount{dec(0, 0).Dec}, s: "0", Format: DecimalSI}, dec(0, 0).Dec},
- {Quantity{i: int64Amount{value: 0, scale: 0}, d: infDecAmount{dec(10, 0).Dec}, s: "10", Format: DecimalSI}, dec(10, 0).Dec},
- {Quantity{i: int64Amount{value: 0, scale: 0}, d: infDecAmount{dec(-10, 0).Dec}, s: "-10", Format: DecimalSI}, dec(-10, 0).Dec},
- }
- for _, testCase := range table2 {
- var inputQ Quantity
- expectQ := Quantity{d: infDecAmount{testCase.expect}, Format: DecimalSI}
- inputByteArray, _ := testCase.input.Marshal()
- inputQ.Unmarshal(inputByteArray)
- if inputQ.Cmp(expectQ) != 0 {
- t.Errorf("Expected: %v, Actual: %v", inputQ, expectQ)
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/api/resource/quantity_test.go b/vendor/k8s.io/apimachinery/pkg/api/resource/quantity_test.go
deleted file mode 100644
index 915b2444e..000000000
--- a/vendor/k8s.io/apimachinery/pkg/api/resource/quantity_test.go
+++ /dev/null
@@ -1,1352 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package resource
-
-import (
- "encoding/json"
- "math/rand"
- "strings"
- "testing"
- "unicode"
-
- fuzz "github.com/google/gofuzz"
-
- inf "gopkg.in/inf.v0"
-)
-
-func amount(i int64, exponent int) infDecAmount {
- // See the below test-- scale is the negative of an exponent.
- return infDecAmount{inf.NewDec(i, inf.Scale(-exponent))}
-}
-
-func dec(i int64, exponent int) infDecAmount {
- // See the below test-- scale is the negative of an exponent.
- return infDecAmount{inf.NewDec(i, inf.Scale(-exponent))}
-}
-
-func decQuantity(i int64, exponent int, format Format) Quantity {
- return Quantity{d: dec(i, exponent), Format: format}
-}
-
-func intQuantity(i int64, exponent Scale, format Format) Quantity {
- return Quantity{i: int64Amount{value: i, scale: exponent}, Format: format}
-}
-
-func TestDec(t *testing.T) {
- table := []struct {
- got infDecAmount
- expect string
- }{
- {dec(1, 0), "1"},
- {dec(1, 1), "10"},
- {dec(5, 2), "500"},
- {dec(8, 3), "8000"},
- {dec(2, 0), "2"},
- {dec(1, -1), "0.1"},
- {dec(3, -2), "0.03"},
- {dec(4, -3), "0.004"},
- }
-
- for _, item := range table {
- if e, a := item.expect, item.got.Dec.String(); e != a {
- t.Errorf("expected %v, got %v", e, a)
- }
- }
-}
-
-// TestQuantityParseZero ensures that when a 0 quantity is passed, its string value is 0
-func TestQuantityParseZero(t *testing.T) {
- zero := MustParse("0")
- if expected, actual := "0", zero.String(); expected != actual {
- t.Errorf("Expected %v, actual %v", expected, actual)
- }
-}
-
-// TestQuantityParseNonNumericPanic ensures that when a non-numeric string is parsed
-// it panics
-func TestQuantityParseNonNumericPanic(t *testing.T) {
- defer func() {
- if r := recover(); r == nil {
- t.Errorf("MustParse did not panic")
- }
- }()
- _ = MustParse("Non-Numeric")
-}
-
-// TestQuantityAddZeroPreservesSuffix verifies that a suffix is preserved
-// independent of the order of operations when adding a zero and non-zero val
-func TestQuantityAddZeroPreservesSuffix(t *testing.T) {
- testValues := []string{"100m", "1Gi"}
- zero := MustParse("0")
- for _, testValue := range testValues {
- value := MustParse(testValue)
- v1 := *value.Copy()
- // ensure non-zero + zero = non-zero (suffix preserved)
- v1.Add(zero)
- // ensure zero + non-zero = non-zero (suffix preserved)
- v2 := *zero.Copy()
- v2.Add(value)
-
- if v1.String() != testValue {
- t.Errorf("Expected %v, actual %v", testValue, v1.String())
- continue
- }
- if v2.String() != testValue {
- t.Errorf("Expected %v, actual %v", testValue, v2.String())
- }
- }
-}
-
-// TestQuantitySubZeroPreservesSuffix verifies that a suffix is preserved
-// independent of the order of operations when subtracting a zero and non-zero val
-func TestQuantitySubZeroPreservesSuffix(t *testing.T) {
- testValues := []string{"100m", "1Gi"}
- zero := MustParse("0")
- for _, testValue := range testValues {
- value := MustParse(testValue)
- v1 := *value.Copy()
- // ensure non-zero - zero = non-zero (suffix preserved)
- v1.Sub(zero)
- // ensure we preserved the input value
- if v1.String() != testValue {
- t.Errorf("Expected %v, actual %v", testValue, v1.String())
- }
-
- // ensure zero - non-zero = -non-zero (suffix preserved)
- v2 := *zero.Copy()
- v2.Sub(value)
- negVal := *value.Copy()
- negVal.Neg()
- if v2.String() != negVal.String() {
- t.Errorf("Expected %v, actual %v", negVal.String(), v2.String())
- }
- }
-}
-
-// TestQuantityCanocicalizeZero verifies that you get 0 as canonical value if internal value is 0, and not 0<suffix>
-func TestQuantityCanocicalizeZero(t *testing.T) {
- val := MustParse("1000m")
- val.i.Sub(int64Amount{value: 1})
- zero := Quantity{i: val.i, Format: DecimalSI}
- if expected, actual := "0", zero.String(); expected != actual {
- t.Errorf("Expected %v, actual %v", expected, actual)
- }
-}
-
-func TestQuantityCmp(t *testing.T) {
- // Test when d is nil
- table := []struct {
- x string
- y string
- expect int
- }{
- {"0", "0", 0},
- {"100m", "50m", 1},
- {"50m", "100m", -1},
- {"10000T", "100Gi", 1},
- }
- for _, testCase := range table {
- q1 := MustParse(testCase.x)
- q2 := MustParse(testCase.y)
- if result := q1.Cmp(q2); result != testCase.expect {
- t.Errorf("X: %v, Y: %v, Expected: %v, Actual: %v", testCase.x, testCase.y, testCase.expect, result)
- }
- }
- // Test when i is {0,0}
- table2 := []struct {
- x *inf.Dec
- y *inf.Dec
- expect int
- }{
- {dec(0, 0).Dec, dec(0, 0).Dec, 0},
- {nil, dec(0, 0).Dec, 0},
- {dec(0, 0).Dec, nil, 0},
- {nil, nil, 0},
- {nil, dec(10, 0).Dec, -1},
- {nil, dec(-10, 0).Dec, 1},
- {dec(10, 0).Dec, nil, 1},
- {dec(-10, 0).Dec, nil, -1},
- }
- for _, testCase := range table2 {
- q1 := Quantity{d: infDecAmount{testCase.x}, Format: DecimalSI}
- q2 := Quantity{d: infDecAmount{testCase.y}, Format: DecimalSI}
- if result := q1.Cmp(q2); result != testCase.expect {
- t.Errorf("X: %v, Y: %v, Expected: %v, Actual: %v", testCase.x, testCase.y, testCase.expect, result)
- }
- }
-}
-
-func TestParseQuantityString(t *testing.T) {
- table := []struct {
- input string
- positive bool
- value string
- num, denom, suffix string
- }{
- {"0.025Ti", true, "0.025", "0", "025", "Ti"},
- {"1.025Ti", true, "1.025", "1", "025", "Ti"},
- {"-1.025Ti", false, "-1.025", "1", "025", "Ti"},
- {".", true, ".", "0", "", ""},
- {"-.", false, "-.", "0", "", ""},
- {"1E-3", true, "1", "1", "", "E-3"},
- }
- for _, test := range table {
- positive, value, num, denom, suffix, err := parseQuantityString(test.input)
- if err != nil {
- t.Errorf("%s: error: %v", test.input, err)
- continue
- }
- if positive != test.positive || value != test.value || num != test.num || denom != test.denom || suffix != test.suffix {
- t.Errorf("%s: unmatched: %t %q %q %q %q", test.input, positive, value, num, denom, suffix)
- }
- }
-}
-
-func TestQuantityParse(t *testing.T) {
- if _, err := ParseQuantity(""); err == nil {
- t.Errorf("expected empty string to return error")
- }
-
- table := []struct {
- input string
- expect Quantity
- }{
- {"0", decQuantity(0, 0, DecimalSI)},
- {"0n", decQuantity(0, 0, DecimalSI)},
- {"0u", decQuantity(0, 0, DecimalSI)},
- {"0m", decQuantity(0, 0, DecimalSI)},
- {"0Ki", decQuantity(0, 0, BinarySI)},
- {"0k", decQuantity(0, 0, DecimalSI)},
- {"0Mi", decQuantity(0, 0, BinarySI)},
- {"0M", decQuantity(0, 0, DecimalSI)},
- {"0Gi", decQuantity(0, 0, BinarySI)},
- {"0G", decQuantity(0, 0, DecimalSI)},
- {"0Ti", decQuantity(0, 0, BinarySI)},
- {"0T", decQuantity(0, 0, DecimalSI)},
-
- // Quantity less numbers are allowed
- {"1", decQuantity(1, 0, DecimalSI)},
-
- // Binary suffixes
- {"1Ki", decQuantity(1024, 0, BinarySI)},
- {"8Ki", decQuantity(8*1024, 0, BinarySI)},
- {"7Mi", decQuantity(7*1024*1024, 0, BinarySI)},
- {"6Gi", decQuantity(6*1024*1024*1024, 0, BinarySI)},
- {"5Ti", decQuantity(5*1024*1024*1024*1024, 0, BinarySI)},
- {"4Pi", decQuantity(4*1024*1024*1024*1024*1024, 0, BinarySI)},
- {"3Ei", decQuantity(3*1024*1024*1024*1024*1024*1024, 0, BinarySI)},
-
- {"10Ti", decQuantity(10*1024*1024*1024*1024, 0, BinarySI)},
- {"100Ti", decQuantity(100*1024*1024*1024*1024, 0, BinarySI)},
-
- // Decimal suffixes
- {"5n", decQuantity(5, -9, DecimalSI)},
- {"4u", decQuantity(4, -6, DecimalSI)},
- {"3m", decQuantity(3, -3, DecimalSI)},
- {"9", decQuantity(9, 0, DecimalSI)},
- {"8k", decQuantity(8, 3, DecimalSI)},
- {"50k", decQuantity(5, 4, DecimalSI)},
- {"7M", decQuantity(7, 6, DecimalSI)},
- {"6G", decQuantity(6, 9, DecimalSI)},
- {"5T", decQuantity(5, 12, DecimalSI)},
- {"40T", decQuantity(4, 13, DecimalSI)},
- {"300T", decQuantity(3, 14, DecimalSI)},
- {"2P", decQuantity(2, 15, DecimalSI)},
- {"1E", decQuantity(1, 18, DecimalSI)},
-
- // Decimal exponents
- {"1E-3", decQuantity(1, -3, DecimalExponent)},
- {"1e3", decQuantity(1, 3, DecimalExponent)},
- {"1E6", decQuantity(1, 6, DecimalExponent)},
- {"1e9", decQuantity(1, 9, DecimalExponent)},
- {"1E12", decQuantity(1, 12, DecimalExponent)},
- {"1e15", decQuantity(1, 15, DecimalExponent)},
- {"1E18", decQuantity(1, 18, DecimalExponent)},
-
- // Nonstandard but still parsable
- {"1e14", decQuantity(1, 14, DecimalExponent)},
- {"1e13", decQuantity(1, 13, DecimalExponent)},
- {"1e3", decQuantity(1, 3, DecimalExponent)},
- {"100.035k", decQuantity(100035, 0, DecimalSI)},
-
- // Things that look like floating point
- {"0.001", decQuantity(1, -3, DecimalSI)},
- {"0.0005k", decQuantity(5, -1, DecimalSI)},
- {"0.005", decQuantity(5, -3, DecimalSI)},
- {"0.05", decQuantity(5, -2, DecimalSI)},
- {"0.5", decQuantity(5, -1, DecimalSI)},
- {"0.00050k", decQuantity(5, -1, DecimalSI)},
- {"0.00500", decQuantity(5, -3, DecimalSI)},
- {"0.05000", decQuantity(5, -2, DecimalSI)},
- {"0.50000", decQuantity(5, -1, DecimalSI)},
- {"0.5e0", decQuantity(5, -1, DecimalExponent)},
- {"0.5e-1", decQuantity(5, -2, DecimalExponent)},
- {"0.5e-2", decQuantity(5, -3, DecimalExponent)},
- {"0.5e0", decQuantity(5, -1, DecimalExponent)},
- {"10.035M", decQuantity(10035, 3, DecimalSI)},
-
- {"1.2e3", decQuantity(12, 2, DecimalExponent)},
- {"1.3E+6", decQuantity(13, 5, DecimalExponent)},
- {"1.40e9", decQuantity(14, 8, DecimalExponent)},
- {"1.53E12", decQuantity(153, 10, DecimalExponent)},
- {"1.6e15", decQuantity(16, 14, DecimalExponent)},
- {"1.7E18", decQuantity(17, 17, DecimalExponent)},
-
- {"9.01", decQuantity(901, -2, DecimalSI)},
- {"8.1k", decQuantity(81, 2, DecimalSI)},
- {"7.123456M", decQuantity(7123456, 0, DecimalSI)},
- {"6.987654321G", decQuantity(6987654321, 0, DecimalSI)},
- {"5.444T", decQuantity(5444, 9, DecimalSI)},
- {"40.1T", decQuantity(401, 11, DecimalSI)},
- {"300.2T", decQuantity(3002, 11, DecimalSI)},
- {"2.5P", decQuantity(25, 14, DecimalSI)},
- {"1.01E", decQuantity(101, 16, DecimalSI)},
-
- // Things that saturate/round
- {"3.001n", decQuantity(4, -9, DecimalSI)},
- {"1.1E-9", decQuantity(2, -9, DecimalExponent)},
- {"0.0000000001", decQuantity(1, -9, DecimalSI)},
- {"0.0000000005", decQuantity(1, -9, DecimalSI)},
- {"0.00000000050", decQuantity(1, -9, DecimalSI)},
- {"0.5e-9", decQuantity(1, -9, DecimalExponent)},
- {"0.9n", decQuantity(1, -9, DecimalSI)},
- {"0.00000012345", decQuantity(124, -9, DecimalSI)},
- {"0.00000012354", decQuantity(124, -9, DecimalSI)},
- {"9Ei", Quantity{d: maxAllowed, Format: BinarySI}},
- {"9223372036854775807Ki", Quantity{d: maxAllowed, Format: BinarySI}},
- {"12E", decQuantity(12, 18, DecimalSI)},
-
- // We'll accept fractional binary stuff, too.
- {"100.035Ki", decQuantity(10243584, -2, BinarySI)},
- {"0.5Mi", decQuantity(.5*1024*1024, 0, BinarySI)},
- {"0.05Gi", decQuantity(536870912, -1, BinarySI)},
- {"0.025Ti", decQuantity(274877906944, -1, BinarySI)},
-
- // Things written by trolls
- {"0.000000000001Ki", decQuantity(2, -9, DecimalSI)}, // rounds up, changes format
- {".001", decQuantity(1, -3, DecimalSI)},
- {".0001k", decQuantity(100, -3, DecimalSI)},
- {"1.", decQuantity(1, 0, DecimalSI)},
- {"1.G", decQuantity(1, 9, DecimalSI)},
- }
-
- for _, asDec := range []bool{false, true} {
- for _, item := range table {
- got, err := ParseQuantity(item.input)
- if err != nil {
- t.Errorf("%v: unexpected error: %v", item.input, err)
- continue
- }
- if asDec {
- got.AsDec()
- }
-
- if e, a := item.expect, got; e.Cmp(a) != 0 {
- t.Errorf("%v: expected %v, got %v", item.input, e.String(), a.String())
- }
- if e, a := item.expect.Format, got.Format; e != a {
- t.Errorf("%v: expected %#v, got %#v", item.input, e, a)
- }
-
- if asDec {
- if i, ok := got.AsInt64(); i != 0 || ok {
- t.Errorf("%v: expected inf.Dec to return false for AsInt64: %d", item.input, i)
- }
- continue
- }
- i, ok := item.expect.AsInt64()
- if !ok {
- continue
- }
- j, ok := got.AsInt64()
- if !ok {
- if got.d.Dec == nil && got.i.scale >= 0 {
- t.Errorf("%v: is an int64Amount, but can't return AsInt64: %v", item.input, got)
- }
- continue
- }
- if i != j {
- t.Errorf("%v: expected equivalent representation as int64: %d %d", item.input, i, j)
- }
- }
-
- for _, item := range table {
- got, err := ParseQuantity(item.input)
- if err != nil {
- t.Errorf("%v: unexpected error: %v", item.input, err)
- continue
- }
-
- if asDec {
- got.AsDec()
- }
-
- // verify that we can decompose the input and get the same result by building up from the base.
- positive, _, num, denom, suffix, err := parseQuantityString(item.input)
- if err != nil {
- t.Errorf("%v: unexpected error: %v", item.input, err)
- continue
- }
- if got.Sign() >= 0 && !positive || got.Sign() < 0 && positive {
- t.Errorf("%v: positive was incorrect: %t", item.input, positive)
- continue
- }
- var value string
- if !positive {
- value = "-"
- }
- value += num
- if len(denom) > 0 {
- value += "." + denom
- }
- value += suffix
- if len(value) == 0 {
- t.Errorf("%v: did not parse correctly, %q %q %q", item.input, num, denom, suffix)
- }
- expected, err := ParseQuantity(value)
- if err != nil {
- t.Errorf("%v: unexpected error for %s: %v", item.input, value, err)
- continue
- }
- if expected.Cmp(got) != 0 {
- t.Errorf("%v: not the same as %s", item.input, value)
- continue
- }
- }
-
- // Try the negative version of everything
- desired := &inf.Dec{}
- expect := Quantity{d: infDecAmount{Dec: desired}}
- for _, item := range table {
- got, err := ParseQuantity("-" + strings.TrimLeftFunc(item.input, unicode.IsSpace))
- if err != nil {
- t.Errorf("-%v: unexpected error: %v", item.input, err)
- continue
- }
- if asDec {
- got.AsDec()
- }
-
- expected := item.expect
- desired.Neg(expected.AsDec())
-
- if e, a := expect, got; e.Cmp(a) != 0 {
- t.Errorf("%v: expected %s, got %s", item.input, e.String(), a.String())
- }
- if e, a := expected.Format, got.Format; e != a {
- t.Errorf("%v: expected %#v, got %#v", item.input, e, a)
- }
- }
-
- // Try everything with an explicit +
- for _, item := range table {
- got, err := ParseQuantity("+" + strings.TrimLeftFunc(item.input, unicode.IsSpace))
- if err != nil {
- t.Errorf("-%v: unexpected error: %v", item.input, err)
- continue
- }
- if asDec {
- got.AsDec()
- }
-
- if e, a := item.expect, got; e.Cmp(a) != 0 {
- t.Errorf("%v(%t): expected %s, got %s", item.input, asDec, e.String(), a.String())
- }
- if e, a := item.expect.Format, got.Format; e != a {
- t.Errorf("%v: expected %#v, got %#v", item.input, e, a)
- }
- }
- }
-
- invalid := []string{
- "1.1.M",
- "1+1.0M",
- "0.1mi",
- "0.1am",
- "aoeu",
- ".5i",
- "1i",
- "-3.01i",
- "-3.01e-",
-
- // trailing whitespace is forbidden
- " 1",
- "1 ",
- }
- for _, item := range invalid {
- _, err := ParseQuantity(item)
- if err == nil {
- t.Errorf("%v parsed unexpectedly", item)
- }
- }
-}
-
-func TestQuantityRoundUp(t *testing.T) {
- table := []struct {
- in string
- scale Scale
- expect Quantity
- ok bool
- }{
- {"9.01", -3, decQuantity(901, -2, DecimalSI), true},
- {"9.01", -2, decQuantity(901, -2, DecimalSI), true},
- {"9.01", -1, decQuantity(91, -1, DecimalSI), false},
- {"9.01", 0, decQuantity(10, 0, DecimalSI), false},
- {"9.01", 1, decQuantity(10, 0, DecimalSI), false},
- {"9.01", 2, decQuantity(100, 0, DecimalSI), false},
-
- {"-9.01", -3, decQuantity(-901, -2, DecimalSI), true},
- {"-9.01", -2, decQuantity(-901, -2, DecimalSI), true},
- {"-9.01", -1, decQuantity(-91, -1, DecimalSI), false},
- {"-9.01", 0, decQuantity(-10, 0, DecimalSI), false},
- {"-9.01", 1, decQuantity(-10, 0, DecimalSI), false},
- {"-9.01", 2, decQuantity(-100, 0, DecimalSI), false},
- }
-
- for _, asDec := range []bool{false, true} {
- for _, item := range table {
- got, err := ParseQuantity(item.in)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- expect := *item.expect.Copy()
- if asDec {
- got.AsDec()
- }
- if ok := got.RoundUp(item.scale); ok != item.ok {
- t.Errorf("%s(%d,%t): unexpected ok: %t", item.in, item.scale, asDec, ok)
- }
- if got.Cmp(expect) != 0 {
- t.Errorf("%s(%d,%t): unexpected round: %s vs %s", item.in, item.scale, asDec, got.String(), expect.String())
- }
- }
- }
-}
-
-func TestQuantityCmpInt64AndDec(t *testing.T) {
- table := []struct {
- a, b Quantity
- cmp int
- }{
- {intQuantity(901, -2, DecimalSI), intQuantity(901, -2, DecimalSI), 0},
- {intQuantity(90, -1, DecimalSI), intQuantity(901, -2, DecimalSI), -1},
- {intQuantity(901, -2, DecimalSI), intQuantity(900, -2, DecimalSI), 1},
- {intQuantity(0, 0, DecimalSI), intQuantity(0, 0, DecimalSI), 0},
- {intQuantity(0, 1, DecimalSI), intQuantity(0, -1, DecimalSI), 0},
- {intQuantity(0, -1, DecimalSI), intQuantity(0, 1, DecimalSI), 0},
- {intQuantity(800, -3, DecimalSI), intQuantity(1, 0, DecimalSI), -1},
- {intQuantity(800, -3, DecimalSI), intQuantity(79, -2, DecimalSI), 1},
-
- {intQuantity(mostPositive, 0, DecimalSI), intQuantity(1, -1, DecimalSI), 1},
- {intQuantity(mostPositive, 1, DecimalSI), intQuantity(1, 0, DecimalSI), 1},
- {intQuantity(mostPositive, 1, DecimalSI), intQuantity(1, 1, DecimalSI), 1},
- {intQuantity(mostPositive, 1, DecimalSI), intQuantity(0, 1, DecimalSI), 1},
- {intQuantity(mostPositive, -16, DecimalSI), intQuantity(1, 3, DecimalSI), -1},
-
- {intQuantity(mostNegative, 0, DecimalSI), intQuantity(0, 0, DecimalSI), -1},
- {intQuantity(mostNegative, -18, DecimalSI), intQuantity(-1, 0, DecimalSI), -1},
- {intQuantity(mostNegative, -19, DecimalSI), intQuantity(-1, 0, DecimalSI), 1},
-
- {intQuantity(1*1000000*1000000*1000000, -17, DecimalSI), intQuantity(1, 1, DecimalSI), 0},
- {intQuantity(1*1000000*1000000*1000000, -17, DecimalSI), intQuantity(-10, 0, DecimalSI), 1},
- {intQuantity(-1*1000000*1000000*1000000, -17, DecimalSI), intQuantity(-10, 0, DecimalSI), 0},
- {intQuantity(1*1000000*1000000*1000000, -17, DecimalSI), intQuantity(1, 0, DecimalSI), 1},
-
- {intQuantity(1*1000000*1000000*1000000+1, -17, DecimalSI), intQuantity(1, 1, DecimalSI), 1},
- {intQuantity(1*1000000*1000000*1000000-1, -17, DecimalSI), intQuantity(1, 1, DecimalSI), -1},
- }
-
- for _, item := range table {
- if cmp := item.a.Cmp(item.b); cmp != item.cmp {
- t.Errorf("%#v: unexpected Cmp: %d", item, cmp)
- }
- if cmp := item.b.Cmp(item.a); cmp != -item.cmp {
- t.Errorf("%#v: unexpected inverted Cmp: %d", item, cmp)
- }
- }
-
- for _, item := range table {
- a, b := *item.a.Copy(), *item.b.Copy()
- a.AsDec()
- if cmp := a.Cmp(b); cmp != item.cmp {
- t.Errorf("%#v: unexpected Cmp: %d", item, cmp)
- }
- if cmp := b.Cmp(a); cmp != -item.cmp {
- t.Errorf("%#v: unexpected inverted Cmp: %d", item, cmp)
- }
- }
-
- for _, item := range table {
- a, b := *item.a.Copy(), *item.b.Copy()
- b.AsDec()
- if cmp := a.Cmp(b); cmp != item.cmp {
- t.Errorf("%#v: unexpected Cmp: %d", item, cmp)
- }
- if cmp := b.Cmp(a); cmp != -item.cmp {
- t.Errorf("%#v: unexpected inverted Cmp: %d", item, cmp)
- }
- }
-
- for _, item := range table {
- a, b := *item.a.Copy(), *item.b.Copy()
- a.AsDec()
- b.AsDec()
- if cmp := a.Cmp(b); cmp != item.cmp {
- t.Errorf("%#v: unexpected Cmp: %d", item, cmp)
- }
- if cmp := b.Cmp(a); cmp != -item.cmp {
- t.Errorf("%#v: unexpected inverted Cmp: %d", item, cmp)
- }
- }
-}
-
-func TestQuantityNeg(t *testing.T) {
- table := []struct {
- a Quantity
- out string
- }{
- {intQuantity(901, -2, DecimalSI), "-9010m"},
- {decQuantity(901, -2, DecimalSI), "-9010m"},
- }
-
- for i, item := range table {
- out := *item.a.Copy()
- out.Neg()
- if out.Cmp(item.a) == 0 {
- t.Errorf("%d: negating an item should not mutate the source: %s", i, out.String())
- }
- if out.String() != item.out {
- t.Errorf("%d: negating did not equal exact value: %s", i, out.String())
- }
- }
-}
-
-func TestQuantityString(t *testing.T) {
- table := []struct {
- in Quantity
- expect string
- alternate string
- }{
- {decQuantity(1024*1024*1024, 0, BinarySI), "1Gi", "1024Mi"},
- {decQuantity(300*1024*1024, 0, BinarySI), "300Mi", "307200Ki"},
- {decQuantity(6*1024, 0, BinarySI), "6Ki", ""},
- {decQuantity(1001*1024*1024*1024, 0, BinarySI), "1001Gi", "1025024Mi"},
- {decQuantity(1024*1024*1024*1024, 0, BinarySI), "1Ti", "1024Gi"},
- {decQuantity(5, 0, BinarySI), "5", "5000m"},
- {decQuantity(500, -3, BinarySI), "500m", "0.5"},
- {decQuantity(1, 9, DecimalSI), "1G", "1000M"},
- {decQuantity(1000, 6, DecimalSI), "1G", "0.001T"},
- {decQuantity(1000000, 3, DecimalSI), "1G", ""},
- {decQuantity(1000000000, 0, DecimalSI), "1G", ""},
- {decQuantity(1, -3, DecimalSI), "1m", "1000u"},
- {decQuantity(80, -3, DecimalSI), "80m", ""},
- {decQuantity(1080, -3, DecimalSI), "1080m", "1.08"},
- {decQuantity(108, -2, DecimalSI), "1080m", "1080000000n"},
- {decQuantity(10800, -4, DecimalSI), "1080m", ""},
- {decQuantity(300, 6, DecimalSI), "300M", ""},
- {decQuantity(1, 12, DecimalSI), "1T", ""},
- {decQuantity(1234567, 6, DecimalSI), "1234567M", ""},
- {decQuantity(1234567, -3, BinarySI), "1234567m", ""},
- {decQuantity(3, 3, DecimalSI), "3k", ""},
- {decQuantity(1025, 0, BinarySI), "1025", ""},
- {decQuantity(0, 0, DecimalSI), "0", ""},
- {decQuantity(0, 0, BinarySI), "0", ""},
- {decQuantity(1, 9, DecimalExponent), "1e9", ".001e12"},
- {decQuantity(1, -3, DecimalExponent), "1e-3", "0.001e0"},
- {decQuantity(1, -9, DecimalExponent), "1e-9", "1000e-12"},
- {decQuantity(80, -3, DecimalExponent), "80e-3", ""},
- {decQuantity(300, 6, DecimalExponent), "300e6", ""},
- {decQuantity(1, 12, DecimalExponent), "1e12", ""},
- {decQuantity(1, 3, DecimalExponent), "1e3", ""},
- {decQuantity(3, 3, DecimalExponent), "3e3", ""},
- {decQuantity(3, 3, DecimalSI), "3k", ""},
- {decQuantity(0, 0, DecimalExponent), "0", "00"},
- {decQuantity(1, -9, DecimalSI), "1n", ""},
- {decQuantity(80, -9, DecimalSI), "80n", ""},
- {decQuantity(1080, -9, DecimalSI), "1080n", ""},
- {decQuantity(108, -8, DecimalSI), "1080n", ""},
- {decQuantity(10800, -10, DecimalSI), "1080n", ""},
- {decQuantity(1, -6, DecimalSI), "1u", ""},
- {decQuantity(80, -6, DecimalSI), "80u", ""},
- {decQuantity(1080, -6, DecimalSI), "1080u", ""},
- }
- for _, item := range table {
- got := item.in.String()
- if e, a := item.expect, got; e != a {
- t.Errorf("%#v: expected %v, got %v", item.in, e, a)
- }
- q, err := ParseQuantity(item.expect)
- if err != nil {
- t.Errorf("%#v: unexpected error: %v", item.expect, err)
- }
- if len(q.s) == 0 || q.s != item.expect {
- t.Errorf("%#v: did not copy canonical string on parse: %s", item.expect, q.s)
- }
- if len(item.alternate) == 0 {
- continue
- }
- q, err = ParseQuantity(item.alternate)
- if err != nil {
- t.Errorf("%#v: unexpected error: %v", item.expect, err)
- continue
- }
- if len(q.s) != 0 {
- t.Errorf("%#v: unexpected nested string: %v", item.expect, q.s)
- }
- if q.String() != item.expect {
- t.Errorf("%#v: unexpected alternate canonical: %v", item.expect, q.String())
- }
- if len(q.s) == 0 || q.s != item.expect {
- t.Errorf("%#v: did not set canonical string on ToString: %s", item.expect, q.s)
- }
- }
- desired := &inf.Dec{} // Avoid modifying the values in the table.
- for _, item := range table {
- if item.in.Cmp(Quantity{}) == 0 {
- // Don't expect it to print "-0" ever
- continue
- }
- q := item.in
- q.d = infDecAmount{desired.Neg(q.AsDec())}
- if e, a := "-"+item.expect, q.String(); e != a {
- t.Errorf("%#v: expected %v, got %v", item.in, e, a)
- }
- }
-}
-
-func TestQuantityParseEmit(t *testing.T) {
- table := []struct {
- in string
- expect string
- }{
- {"1Ki", "1Ki"},
- {"1Mi", "1Mi"},
- {"1Gi", "1Gi"},
- {"1024Mi", "1Gi"},
- {"1000M", "1G"},
- {".001Ki", "1024m"},
- {".000001Ki", "1024u"},
- {".000000001Ki", "1024n"},
- {".000000000001Ki", "2n"},
- }
-
- for _, item := range table {
- q, err := ParseQuantity(item.in)
- if err != nil {
- t.Errorf("Couldn't parse %v", item.in)
- continue
- }
- if e, a := item.expect, q.String(); e != a {
- t.Errorf("%#v: expected %v, got %v", item.in, e, a)
- }
- }
- for _, item := range table {
- q, err := ParseQuantity("-" + item.in)
- if err != nil {
- t.Errorf("Couldn't parse %v", item.in)
- continue
- }
- if q.Cmp(Quantity{}) == 0 {
- continue
- }
- if e, a := "-"+item.expect, q.String(); e != a {
- t.Errorf("%#v: expected %v, got %v (%#v)", item.in, e, a, q.i)
- }
- }
-}
-
-var fuzzer = fuzz.New().Funcs(
- func(q *Quantity, c fuzz.Continue) {
- q.i = Zero
- if c.RandBool() {
- q.Format = BinarySI
- if c.RandBool() {
- dec := &inf.Dec{}
- q.d = infDecAmount{Dec: dec}
- dec.SetScale(0)
- dec.SetUnscaled(c.Int63())
- return
- }
- // Be sure to test cases like 1Mi
- dec := &inf.Dec{}
- q.d = infDecAmount{Dec: dec}
- dec.SetScale(0)
- dec.SetUnscaled(c.Int63n(1024) << uint(10*c.Intn(5)))
- return
- }
- if c.RandBool() {
- q.Format = DecimalSI
- } else {
- q.Format = DecimalExponent
- }
- if c.RandBool() {
- dec := &inf.Dec{}
- q.d = infDecAmount{Dec: dec}
- dec.SetScale(inf.Scale(c.Intn(4)))
- dec.SetUnscaled(c.Int63())
- return
- }
- // Be sure to test cases like 1M
- dec := &inf.Dec{}
- q.d = infDecAmount{Dec: dec}
- dec.SetScale(inf.Scale(3 - c.Intn(15)))
- dec.SetUnscaled(c.Int63n(1000))
- },
-)
-
-func TestQuantityDeepCopy(t *testing.T) {
- // Test when d is nil
- slice := []string{"0", "100m", "50m", "10000T"}
- for _, testCase := range slice {
- q := MustParse(testCase)
- if result := q.DeepCopy(); result != q {
- t.Errorf("Expected: %v, Actual: %v", q, result)
- }
- }
- table := []*inf.Dec{
- dec(0, 0).Dec,
- dec(10, 0).Dec,
- dec(-10, 0).Dec,
- }
- // Test when i is {0,0}
- for _, testCase := range table {
- q := Quantity{d: infDecAmount{testCase}, Format: DecimalSI}
- result := q.DeepCopy()
- if q.d.Cmp(result.AsDec()) != 0 {
- t.Errorf("Expected: %v, Actual: %v", q.String(), result.String())
- }
- result = Quantity{d: infDecAmount{dec(2, 0).Dec}, Format: DecimalSI}
- if q.d.Cmp(result.AsDec()) == 0 {
- t.Errorf("Modifying result has affected q")
- }
- }
-}
-
-func TestJSON(t *testing.T) {
- for i := 0; i < 500; i++ {
- q := &Quantity{}
- fuzzer.Fuzz(q)
- b, err := json.Marshal(q)
- if err != nil {
- t.Errorf("error encoding %v: %v", q, err)
- continue
- }
- q2 := &Quantity{}
- err = json.Unmarshal(b, q2)
- if err != nil {
- t.Logf("%d: %s", i, string(b))
- t.Errorf("%v: error decoding %v: %v", q, string(b), err)
- }
- if q2.Cmp(*q) != 0 {
- t.Errorf("Expected equal: %v, %v (json was '%v')", q, q2, string(b))
- }
- }
-}
-
-func TestJSONWhitespace(t *testing.T) {
- q := Quantity{}
- testCases := []struct {
- in string
- expect string
- }{
- {`" 1"`, "1"},
- {`"1 "`, "1"},
- {`1`, "1"},
- {` 1`, "1"},
- {`1 `, "1"},
- {`10`, "10"},
- {`-1`, "-1"},
- {` -1`, "-1"},
- }
- for _, test := range testCases {
- if err := json.Unmarshal([]byte(test.in), &q); err != nil {
- t.Errorf("%q: %v", test.in, err)
- }
- if q.String() != test.expect {
- t.Errorf("unexpected string: %q", q.String())
- }
- }
-}
-
-func TestMilliNewSet(t *testing.T) {
- table := []struct {
- value int64
- format Format
- expect string
- exact bool
- }{
- {1, DecimalSI, "1m", true},
- {1000, DecimalSI, "1", true},
- {1234000, DecimalSI, "1234", true},
- {1024, BinarySI, "1024m", false}, // Format changes
- {1000000, "invalidFormatDefaultsToExponent", "1e3", true},
- {1024 * 1024, BinarySI, "1048576m", false}, // Format changes
- }
-
- for _, item := range table {
- q := NewMilliQuantity(item.value, item.format)
- if e, a := item.expect, q.String(); e != a {
- t.Errorf("Expected %v, got %v; %#v", e, a, q)
- }
- if !item.exact {
- continue
- }
- q2, err := ParseQuantity(q.String())
- if err != nil {
- t.Errorf("Round trip failed on %v", q)
- }
- if e, a := item.value, q2.MilliValue(); e != a {
- t.Errorf("Expected %v, got %v", e, a)
- }
- }
-
- for _, item := range table {
- q := NewQuantity(0, item.format)
- q.SetMilli(item.value)
- if e, a := item.expect, q.String(); e != a {
- t.Errorf("Set: Expected %v, got %v; %#v", e, a, q)
- }
- }
-}
-
-func TestNewSet(t *testing.T) {
- table := []struct {
- value int64
- format Format
- expect string
- }{
- {1, DecimalSI, "1"},
- {1000, DecimalSI, "1k"},
- {1234000, DecimalSI, "1234k"},
- {1024, BinarySI, "1Ki"},
- {1000000, "invalidFormatDefaultsToExponent", "1e6"},
- {1024 * 1024, BinarySI, "1Mi"},
- }
-
- for _, asDec := range []bool{false, true} {
- for _, item := range table {
- q := NewQuantity(item.value, item.format)
- if asDec {
- q.ToDec()
- }
- if e, a := item.expect, q.String(); e != a {
- t.Errorf("Expected %v, got %v; %#v", e, a, q)
- }
- q2, err := ParseQuantity(q.String())
- if err != nil {
- t.Errorf("Round trip failed on %v", q)
- }
- if e, a := item.value, q2.Value(); e != a {
- t.Errorf("Expected %v, got %v", e, a)
- }
- }
-
- for _, item := range table {
- q := NewQuantity(0, item.format)
- q.Set(item.value)
- if asDec {
- q.ToDec()
- }
- if e, a := item.expect, q.String(); e != a {
- t.Errorf("Set: Expected %v, got %v; %#v", e, a, q)
- }
- }
- }
-}
-
-func TestNewScaledSet(t *testing.T) {
- table := []struct {
- value int64
- scale Scale
- expect string
- }{
- {1, Nano, "1n"},
- {1000, Nano, "1u"},
- {1, Micro, "1u"},
- {1000, Micro, "1m"},
- {1, Milli, "1m"},
- {1000, Milli, "1"},
- {1, 0, "1"},
- {0, Nano, "0"},
- {0, Micro, "0"},
- {0, Milli, "0"},
- {0, 0, "0"},
- }
-
- for _, item := range table {
- q := NewScaledQuantity(item.value, item.scale)
- if e, a := item.expect, q.String(); e != a {
- t.Errorf("Expected %v, got %v; %#v", e, a, q)
- }
- q2, err := ParseQuantity(q.String())
- if err != nil {
- t.Errorf("Round trip failed on %v", q)
- }
- if e, a := item.value, q2.ScaledValue(item.scale); e != a {
- t.Errorf("Expected %v, got %v", e, a)
- }
- q3 := NewQuantity(0, DecimalSI)
- q3.SetScaled(item.value, item.scale)
- if q.Cmp(*q3) != 0 {
- t.Errorf("Expected %v and %v to be equal", q, q3)
- }
- }
-}
-
-func TestScaledValue(t *testing.T) {
- table := []struct {
- fromScale Scale
- toScale Scale
- expected int64
- }{
- {Nano, Nano, 1},
- {Nano, Micro, 1},
- {Nano, Milli, 1},
- {Nano, 0, 1},
- {Micro, Nano, 1000},
- {Micro, Micro, 1},
- {Micro, Milli, 1},
- {Micro, 0, 1},
- {Milli, Nano, 1000 * 1000},
- {Milli, Micro, 1000},
- {Milli, Milli, 1},
- {Milli, 0, 1},
- {0, Nano, 1000 * 1000 * 1000},
- {0, Micro, 1000 * 1000},
- {0, Milli, 1000},
- {0, 0, 1},
- }
-
- for _, item := range table {
- q := NewScaledQuantity(1, item.fromScale)
- if e, a := item.expected, q.ScaledValue(item.toScale); e != a {
- t.Errorf("%v to %v: Expected %v, got %v", item.fromScale, item.toScale, e, a)
- }
- }
-}
-
-func TestUninitializedNoCrash(t *testing.T) {
- var q Quantity
-
- q.Value()
- q.MilliValue()
- q.Copy()
- _ = q.String()
- q.MarshalJSON()
-}
-
-func TestCopy(t *testing.T) {
- q := NewQuantity(5, DecimalSI)
- c := q.Copy()
- c.Set(6)
- if q.Value() == 6 {
- t.Errorf("Copy didn't")
- }
-}
-
-func TestSub(t *testing.T) {
- tests := []struct {
- a Quantity
- b Quantity
- expected Quantity
- }{
- {decQuantity(10, 0, DecimalSI), decQuantity(1, 1, DecimalSI), decQuantity(0, 0, DecimalSI)},
- {decQuantity(10, 0, DecimalSI), decQuantity(1, 0, BinarySI), decQuantity(9, 0, DecimalSI)},
- {decQuantity(10, 0, BinarySI), decQuantity(1, 0, DecimalSI), decQuantity(9, 0, BinarySI)},
- {Quantity{Format: DecimalSI}, decQuantity(50, 0, DecimalSI), decQuantity(-50, 0, DecimalSI)},
- {decQuantity(50, 0, DecimalSI), Quantity{Format: DecimalSI}, decQuantity(50, 0, DecimalSI)},
- {Quantity{Format: DecimalSI}, Quantity{Format: DecimalSI}, decQuantity(0, 0, DecimalSI)},
- }
-
- for i, test := range tests {
- test.a.Sub(test.b)
- if test.a.Cmp(test.expected) != 0 {
- t.Errorf("[%d] Expected %q, got %q", i, test.expected.String(), test.a.String())
- }
- }
-}
-
-func TestNeg(t *testing.T) {
- tests := []struct {
- a Quantity
- b Quantity
- expected Quantity
- }{
- {a: intQuantity(0, 0, DecimalSI), expected: intQuantity(0, 0, DecimalSI)},
- {a: Quantity{}, expected: Quantity{}},
- {a: intQuantity(10, 0, BinarySI), expected: intQuantity(-10, 0, BinarySI)},
- {a: intQuantity(-10, 0, BinarySI), expected: intQuantity(10, 0, BinarySI)},
- {a: decQuantity(0, 0, DecimalSI), expected: intQuantity(0, 0, DecimalSI)},
- {a: decQuantity(10, 0, BinarySI), expected: intQuantity(-10, 0, BinarySI)},
- {a: decQuantity(-10, 0, BinarySI), expected: intQuantity(10, 0, BinarySI)},
- }
-
- for i, test := range tests {
- a := test.a.Copy()
- a.Neg()
- // ensure value is same
- if a.Cmp(test.expected) != 0 {
- t.Errorf("[%d] Expected %q, got %q", i, test.expected.String(), a.String())
- }
- }
-}
-
-func TestAdd(t *testing.T) {
- tests := []struct {
- a Quantity
- b Quantity
- expected Quantity
- }{
- {decQuantity(10, 0, DecimalSI), decQuantity(1, 1, DecimalSI), decQuantity(20, 0, DecimalSI)},
- {decQuantity(10, 0, DecimalSI), decQuantity(1, 0, BinarySI), decQuantity(11, 0, DecimalSI)},
- {decQuantity(10, 0, BinarySI), decQuantity(1, 0, DecimalSI), decQuantity(11, 0, BinarySI)},
- {Quantity{Format: DecimalSI}, decQuantity(50, 0, DecimalSI), decQuantity(50, 0, DecimalSI)},
- {decQuantity(50, 0, DecimalSI), Quantity{Format: DecimalSI}, decQuantity(50, 0, DecimalSI)},
- {Quantity{Format: DecimalSI}, Quantity{Format: DecimalSI}, decQuantity(0, 0, DecimalSI)},
- }
-
- for i, test := range tests {
- test.a.Add(test.b)
- if test.a.Cmp(test.expected) != 0 {
- t.Errorf("[%d] Expected %q, got %q", i, test.expected.String(), test.a.String())
- }
- }
-}
-
-func TestAddSubRoundTrip(t *testing.T) {
- for k := -10; k <= 10; k++ {
- q := Quantity{Format: DecimalSI}
- var order []int64
- for i := 0; i < 100; i++ {
- j := rand.Int63()
- order = append(order, j)
- q.Add(*NewScaledQuantity(j, Scale(k)))
- }
- for _, j := range order {
- q.Sub(*NewScaledQuantity(j, Scale(k)))
- }
- if !q.IsZero() {
- t.Errorf("addition and subtraction did not cancel: %s", &q)
- }
- }
-}
-
-func TestAddSubRoundTripAcrossScales(t *testing.T) {
- q := Quantity{Format: DecimalSI}
- var order []int64
- for i := 0; i < 100; i++ {
- j := rand.Int63()
- order = append(order, j)
- q.Add(*NewScaledQuantity(j, Scale(j%20-10)))
- }
- for _, j := range order {
- q.Sub(*NewScaledQuantity(j, Scale(j%20-10)))
- }
- if !q.IsZero() {
- t.Errorf("addition and subtraction did not cancel: %s", &q)
- }
-}
-
-func TestNegateRoundTrip(t *testing.T) {
- for _, asDec := range []bool{false, true} {
- for k := -10; k <= 10; k++ {
- for i := 0; i < 100; i++ {
- j := rand.Int63()
- q := *NewScaledQuantity(j, Scale(k))
- if asDec {
- q.AsDec()
- }
-
- b := q.Copy()
- b.Neg()
- b.Neg()
- if b.Cmp(q) != 0 {
- t.Errorf("double negation did not cancel: %s", &q)
- }
- }
- }
- }
-}
-func benchmarkQuantities() []Quantity {
- return []Quantity{
- intQuantity(1024*1024*1024, 0, BinarySI),
- intQuantity(1024*1024*1024*1024, 0, BinarySI),
- intQuantity(1000000, 3, DecimalSI),
- intQuantity(1000000000, 0, DecimalSI),
- intQuantity(1, -3, DecimalSI),
- intQuantity(80, -3, DecimalSI),
- intQuantity(1080, -3, DecimalSI),
- intQuantity(0, 0, BinarySI),
- intQuantity(1, 9, DecimalExponent),
- intQuantity(1, -9, DecimalSI),
- intQuantity(1000000, 10, DecimalSI),
- }
-}
-
-func BenchmarkQuantityString(b *testing.B) {
- values := benchmarkQuantities()
- b.ResetTimer()
- var s string
- for i := 0; i < b.N; i++ {
- q := values[i%len(values)]
- q.s = ""
- s = q.String()
- }
- b.StopTimer()
- if len(s) == 0 {
- b.Fatal(s)
- }
-}
-
-func BenchmarkQuantityStringPrecalc(b *testing.B) {
- values := benchmarkQuantities()
- for i := range values {
- _ = values[i].String()
- }
- b.ResetTimer()
- var s string
- for i := 0; i < b.N; i++ {
- q := values[i%len(values)]
- s = q.String()
- }
- b.StopTimer()
- if len(s) == 0 {
- b.Fatal(s)
- }
-}
-
-func BenchmarkQuantityStringBinarySI(b *testing.B) {
- values := benchmarkQuantities()
- for i := range values {
- values[i].Format = BinarySI
- }
- b.ResetTimer()
- var s string
- for i := 0; i < b.N; i++ {
- q := values[i%len(values)]
- q.s = ""
- s = q.String()
- }
- b.StopTimer()
- if len(s) == 0 {
- b.Fatal(s)
- }
-}
-
-func BenchmarkQuantityMarshalJSON(b *testing.B) {
- values := benchmarkQuantities()
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- q := values[i%len(values)]
- q.s = ""
- if _, err := q.MarshalJSON(); err != nil {
- b.Fatal(err)
- }
- }
- b.StopTimer()
-}
-
-func BenchmarkQuantityUnmarshalJSON(b *testing.B) {
- values := benchmarkQuantities()
- var json [][]byte
- for _, v := range values {
- data, _ := v.MarshalJSON()
- json = append(json, data)
- }
-
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- var q Quantity
- if err := q.UnmarshalJSON(json[i%len(values)]); err != nil {
- b.Fatal(err)
- }
- }
- b.StopTimer()
-}
-
-func BenchmarkParseQuantity(b *testing.B) {
- values := benchmarkQuantities()
- var strings []string
- for _, v := range values {
- strings = append(strings, v.String())
- }
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- if _, err := ParseQuantity(strings[i%len(values)]); err != nil {
- b.Fatal(err)
- }
- }
- b.StopTimer()
-}
-
-func BenchmarkCanonicalize(b *testing.B) {
- values := benchmarkQuantities()
- b.ResetTimer()
- buffer := make([]byte, 0, 100)
- for i := 0; i < b.N; i++ {
- s, _ := values[i%len(values)].CanonicalizeBytes(buffer)
- if len(s) == 0 {
- b.Fatal(s)
- }
- }
- b.StopTimer()
-}
-
-func BenchmarkQuantityRoundUp(b *testing.B) {
- values := benchmarkQuantities()
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- q := values[i%len(values)]
- copied := q
- copied.RoundUp(-3)
- }
- b.StopTimer()
-}
-
-func BenchmarkQuantityCopy(b *testing.B) {
- values := benchmarkQuantities()
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- values[i%len(values)].Copy()
- }
- b.StopTimer()
-}
-
-func BenchmarkQuantityAdd(b *testing.B) {
- values := benchmarkQuantities()
- base := &Quantity{}
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- q := values[i%len(values)]
- base.d.Dec = nil
- base.i = int64Amount{value: 100}
- base.Add(q)
- }
- b.StopTimer()
-}
-
-func BenchmarkQuantityCmp(b *testing.B) {
- values := benchmarkQuantities()
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- q := values[i%len(values)]
- if q.Cmp(q) != 0 {
- b.Fatal(q)
- }
- }
- b.StopTimer()
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/api/resource/scale_int_test.go b/vendor/k8s.io/apimachinery/pkg/api/resource/scale_int_test.go
deleted file mode 100644
index b150fa514..000000000
--- a/vendor/k8s.io/apimachinery/pkg/api/resource/scale_int_test.go
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
-Copyright 2015 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package resource
-
-import (
- "math"
- "math/big"
- "testing"
-)
-
-func TestScaledValueInternal(t *testing.T) {
- tests := []struct {
- unscaled *big.Int
- scale int
- newScale int
-
- want int64
- }{
- // remain scale
- {big.NewInt(1000), 0, 0, 1000},
-
- // scale down
- {big.NewInt(1000), 0, -3, 1},
- {big.NewInt(1000), 3, 0, 1},
- {big.NewInt(0), 3, 0, 0},
-
- // always round up
- {big.NewInt(999), 3, 0, 1},
- {big.NewInt(500), 3, 0, 1},
- {big.NewInt(499), 3, 0, 1},
- {big.NewInt(1), 3, 0, 1},
- // large scaled value does not lose precision
- {big.NewInt(0).Sub(maxInt64, bigOne), 1, 0, (math.MaxInt64-1)/10 + 1},
- // large intermediate result.
- {big.NewInt(1).Exp(big.NewInt(10), big.NewInt(100), nil), 100, 0, 1},
-
- // scale up
- {big.NewInt(0), 0, 3, 0},
- {big.NewInt(1), 0, 3, 1000},
- {big.NewInt(1), -3, 0, 1000},
- {big.NewInt(1000), -3, 2, 100000000},
- {big.NewInt(0).Div(big.NewInt(math.MaxInt64), bigThousand), 0, 3,
- (math.MaxInt64 / 1000) * 1000},
- }
-
- for i, tt := range tests {
- old := (&big.Int{}).Set(tt.unscaled)
- got := scaledValue(tt.unscaled, tt.scale, tt.newScale)
- if got != tt.want {
- t.Errorf("#%d: got = %v, want %v", i, got, tt.want)
- }
- if tt.unscaled.Cmp(old) != 0 {
- t.Errorf("#%d: unscaled = %v, want %v", i, tt.unscaled, old)
- }
- }
-}
-
-func BenchmarkScaledValueSmall(b *testing.B) {
- s := big.NewInt(1000)
- for i := 0; i < b.N; i++ {
- scaledValue(s, 3, 0)
- }
-}
-
-func BenchmarkScaledValueLarge(b *testing.B) {
- s := big.NewInt(math.MaxInt64)
- s.Mul(s, big.NewInt(1000))
- for i := 0; i < b.N; i++ {
- scaledValue(s, 10, 0)
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/register_test.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/register_test.go
deleted file mode 100644
index 8116f8074..000000000
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/register_test.go
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package internalversion
-
-import (
- "net/url"
- "reflect"
- "testing"
-
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/util/diff"
-)
-
-func TestListOptions(t *testing.T) {
- // verify round trip conversion
- ten := int64(10)
- in := &metav1.ListOptions{
- LabelSelector: "a=1",
- FieldSelector: "b=1",
- ResourceVersion: "10",
- TimeoutSeconds: &ten,
- Watch: true,
- }
- out := &ListOptions{}
- if err := scheme.Convert(in, out, nil); err != nil {
- t.Fatal(err)
- }
- actual := &metav1.ListOptions{}
- if err := scheme.Convert(out, actual, nil); err != nil {
- t.Fatal(err)
- }
- if !reflect.DeepEqual(in, actual) {
- t.Errorf("unexpected: %s", diff.ObjectReflectDiff(in, actual))
- }
-
- // verify failing conversion
- for i, failingObject := range []*metav1.ListOptions{
- {LabelSelector: "a!!!"},
- {FieldSelector: "a!!!"},
- } {
- out = &ListOptions{}
- if err := scheme.Convert(failingObject, out, nil); err == nil {
- t.Errorf("%d: unexpected conversion: %#v", i, out)
- }
- }
-
- // verify kind registration
- if gvks, unversioned, err := scheme.ObjectKinds(in); err != nil || unversioned || gvks[0] != metav1.SchemeGroupVersion.WithKind("ListOptions") {
- t.Errorf("unexpected: %v %v %v", gvks[0], unversioned, err)
- }
- if gvks, unversioned, err := scheme.ObjectKinds(out); err != nil || unversioned || gvks[0] != SchemeGroupVersion.WithKind("ListOptions") {
- t.Errorf("unexpected: %v %v %v", gvks[0], unversioned, err)
- }
-
- actual = &metav1.ListOptions{}
- if err := ParameterCodec.DecodeParameters(url.Values{"watch": []string{"1"}}, metav1.SchemeGroupVersion, actual); err != nil {
- t.Fatal(err)
- }
- if !actual.Watch {
- t.Errorf("unexpected watch decode: %#v", actual)
- }
-
- // check ParameterCodec
- query, err := ParameterCodec.EncodeParameters(in, metav1.SchemeGroupVersion)
- if err != nil {
- t.Fatal(err)
- }
- actual = &metav1.ListOptions{}
- if err := ParameterCodec.DecodeParameters(query, metav1.SchemeGroupVersion, actual); err != nil {
- t.Fatal(err)
- }
- if !reflect.DeepEqual(in, actual) {
- t.Errorf("unexpected: %s", diff.ObjectReflectDiff(in, actual))
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/roundtrip_test.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/roundtrip_test.go
deleted file mode 100644
index 725aa316d..000000000
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/roundtrip_test.go
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package internalversion
-
-import (
- "testing"
-
- "k8s.io/apimachinery/pkg/api/testing/roundtrip"
- "k8s.io/apimachinery/pkg/apis/meta/fuzzer"
-)
-
-func TestRoundTrip(t *testing.T) {
- roundtrip.RoundTripTestForScheme(t, scheme, fuzzer.Funcs)
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/controller_ref_test.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/controller_ref_test.go
deleted file mode 100644
index add764a33..000000000
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/controller_ref_test.go
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package v1
-
-import (
- "testing"
-
- "k8s.io/apimachinery/pkg/runtime/schema"
-)
-
-type metaObj struct {
- ObjectMeta
- TypeMeta
-}
-
-func TestNewControllerRef(t *testing.T) {
- gvk := schema.GroupVersionKind{
- Group: "group",
- Version: "v1",
- Kind: "Kind",
- }
- obj1 := &metaObj{
- ObjectMeta: ObjectMeta{
- Name: "name",
- UID: "uid1",
- },
- }
- controllerRef := NewControllerRef(obj1, gvk)
- if controllerRef.UID != obj1.UID {
- t.Errorf("Incorrect UID: %s", controllerRef.UID)
- }
- if controllerRef.Controller == nil || *controllerRef.Controller != true {
- t.Error("Controller must be set to true")
- }
- if controllerRef.BlockOwnerDeletion == nil || *controllerRef.BlockOwnerDeletion != true {
- t.Error("BlockOwnerDeletion must be set to true")
- }
- if controllerRef.APIVersion == "" ||
- controllerRef.Kind == "" ||
- controllerRef.Name == "" {
- t.Errorf("All controllerRef fields must be set: %v", controllerRef)
- }
-}
-
-func TestGetControllerOf(t *testing.T) {
- gvk := schema.GroupVersionKind{
- Group: "group",
- Version: "v1",
- Kind: "Kind",
- }
- obj1 := &metaObj{
- ObjectMeta: ObjectMeta{
- UID: "uid1",
- Name: "name1",
- },
- }
- controllerRef := NewControllerRef(obj1, gvk)
- var falseRef = false
- obj2 := &metaObj{
- ObjectMeta: ObjectMeta{
- UID: "uid2",
- Name: "name1",
- OwnerReferences: []OwnerReference{
- {
- Name: "owner1",
- Controller: &falseRef,
- },
- *controllerRef,
- {
- Name: "owner2",
- Controller: &falseRef,
- },
- },
- },
- }
-
- if GetControllerOf(obj1) != nil {
- t.Error("GetControllerOf must return null")
- }
- c := GetControllerOf(obj2)
- if c.Name != controllerRef.Name || c.UID != controllerRef.UID {
- t.Errorf("Incorrect result of GetControllerOf: %v", c)
- }
-}
-
-func TestIsControlledBy(t *testing.T) {
- gvk := schema.GroupVersionKind{
- Group: "group",
- Version: "v1",
- Kind: "Kind",
- }
- obj1 := &metaObj{
- ObjectMeta: ObjectMeta{
- UID: "uid1",
- },
- }
- obj2 := &metaObj{
- ObjectMeta: ObjectMeta{
- UID: "uid2",
- OwnerReferences: []OwnerReference{
- *NewControllerRef(obj1, gvk),
- },
- },
- }
- obj3 := &metaObj{
- ObjectMeta: ObjectMeta{
- UID: "uid3",
- OwnerReferences: []OwnerReference{
- *NewControllerRef(obj2, gvk),
- },
- },
- }
- if !IsControlledBy(obj2, obj1) || !IsControlledBy(obj3, obj2) {
- t.Error("Incorrect IsControlledBy result: false")
- }
- if IsControlledBy(obj3, obj1) {
- t.Error("Incorrect IsControlledBy result: true")
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/conversion_test.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/conversion_test.go
deleted file mode 100644
index 4ff57fd8d..000000000
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/conversion_test.go
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package v1_test
-
-import (
- "testing"
-
- apiequality "k8s.io/apimachinery/pkg/api/equality"
- "k8s.io/apimachinery/pkg/apis/meta/v1"
-)
-
-func TestMapToLabelSelectorRoundTrip(t *testing.T) {
- // We should be able to round-trip a map-only selector through LabelSelector.
- inputs := []map[string]string{
- nil,
- {},
- {"one": "foo"},
- {"one": "foo", "two": "bar"},
- }
- for _, in := range inputs {
- ls := &v1.LabelSelector{}
- if err := v1.Convert_map_to_unversioned_LabelSelector(&in, ls, nil); err != nil {
- t.Errorf("Convert_map_to_unversioned_LabelSelector(%#v): %v", in, err)
- continue
- }
- out := map[string]string{}
- if err := v1.Convert_unversioned_LabelSelector_to_map(ls, &out, nil); err != nil {
- t.Errorf("Convert_unversioned_LabelSelector_to_map(%#v): %v", ls, err)
- continue
- }
- if !apiequality.Semantic.DeepEqual(in, out) {
- t.Errorf("map-selector conversion round-trip failed: got %v; want %v", out, in)
- }
- }
-}
-
-func TestConvertSliceStringToDeletionPropagation(t *testing.T) {
- tcs := []struct {
- Input []string
- Output v1.DeletionPropagation
- }{
- {
- Input: nil,
- Output: "",
- },
- {
- Input: []string{},
- Output: "",
- },
- {
- Input: []string{"foo"},
- Output: "foo",
- },
- {
- Input: []string{"bar", "foo"},
- Output: "bar",
- },
- }
-
- for _, tc := range tcs {
- var dp v1.DeletionPropagation
- if err := v1.Convert_Slice_string_To_v1_DeletionPropagation(&tc.Input, &dp, nil); err != nil {
- t.Errorf("Convert_Slice_string_To_v1_DeletionPropagation(%#v): %v", tc.Input, err)
- continue
- }
- if !apiequality.Semantic.DeepEqual(dp, tc.Output) {
- t.Errorf("slice string to DeletionPropagation conversion failed: got %v; want %v", dp, tc.Output)
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/duration_test.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/duration_test.go
deleted file mode 100644
index 7230cb28a..000000000
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/duration_test.go
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package v1
-
-import (
- "encoding/json"
- "testing"
- "time"
-
- "github.com/ghodss/yaml"
-)
-
-type DurationHolder struct {
- D Duration `json:"d"`
-}
-
-func TestDurationMarshalYAML(t *testing.T) {
- cases := []struct {
- input Duration
- result string
- }{
- {Duration{5 * time.Second}, "d: 5s\n"},
- {Duration{2 * time.Minute}, "d: 2m0s\n"},
- {Duration{time.Hour + 3*time.Millisecond}, "d: 1h0m0.003s\n"},
- }
-
- for _, c := range cases {
- input := DurationHolder{c.input}
- result, err := yaml.Marshal(&input)
- if err != nil {
- t.Errorf("Failed to marshal input: %q: %v", input, err)
- }
- if string(result) != c.result {
- t.Errorf("Failed to marshal input: %q: expected %q, got %q", input, c.result, string(result))
- }
- }
-}
-
-func TestDurationUnmarshalYAML(t *testing.T) {
- cases := []struct {
- input string
- result Duration
- }{
- {"d: 0s\n", Duration{}},
- {"d: 5s\n", Duration{5 * time.Second}},
- {"d: 2m0s\n", Duration{2 * time.Minute}},
- {"d: 1h0m0.003s\n", Duration{time.Hour + 3*time.Millisecond}},
-
- // Units with zero values can optionally be dropped
- {"d: 2m\n", Duration{2 * time.Minute}},
- {"d: 1h0.003s\n", Duration{time.Hour + 3*time.Millisecond}},
- }
-
- for _, c := range cases {
- var result DurationHolder
- if err := yaml.Unmarshal([]byte(c.input), &result); err != nil {
- t.Errorf("Failed to unmarshal input %q: %v", c.input, err)
- }
- if result.D != c.result {
- t.Errorf("Failed to unmarshal input %q: expected %q, got %q", c.input, c.result, result)
- }
- }
-}
-
-func TestDurationMarshalJSON(t *testing.T) {
- cases := []struct {
- input Duration
- result string
- }{
- {Duration{5 * time.Second}, `{"d":"5s"}`},
- {Duration{2 * time.Minute}, `{"d":"2m0s"}`},
- {Duration{time.Hour + 3*time.Millisecond}, `{"d":"1h0m0.003s"}`},
- }
-
- for _, c := range cases {
- input := DurationHolder{c.input}
- result, err := json.Marshal(&input)
- if err != nil {
- t.Errorf("Failed to marshal input: %q: %v", input, err)
- }
- if string(result) != c.result {
- t.Errorf("Failed to marshal input: %q: expected %q, got %q", input, c.result, string(result))
- }
- }
-}
-
-func TestDurationUnmarshalJSON(t *testing.T) {
- cases := []struct {
- input string
- result Duration
- }{
- {`{"d":"0s"}`, Duration{}},
- {`{"d":"5s"}`, Duration{5 * time.Second}},
- {`{"d":"2m0s"}`, Duration{2 * time.Minute}},
- {`{"d":"1h0m0.003s"}`, Duration{time.Hour + 3*time.Millisecond}},
-
- // Units with zero values can optionally be dropped
- {`{"d":"2m"}`, Duration{2 * time.Minute}},
- {`{"d":"1h0.003s"}`, Duration{time.Hour + 3*time.Millisecond}},
- }
-
- for _, c := range cases {
- var result DurationHolder
- if err := json.Unmarshal([]byte(c.input), &result); err != nil {
- t.Errorf("Failed to unmarshal input %q: %v", c.input, err)
- }
- if result.D != c.result {
- t.Errorf("Failed to unmarshal input %q: expected %q, got %q", c.input, c.result, result)
- }
- }
-}
-
-func TestDurationMarshalJSONUnmarshalYAML(t *testing.T) {
- cases := []struct {
- input Duration
- }{
- {Duration{}},
- {Duration{5 * time.Second}},
- {Duration{2 * time.Minute}},
- {Duration{time.Hour + 3*time.Millisecond}},
- }
-
- for i, c := range cases {
- input := DurationHolder{c.input}
- jsonMarshalled, err := json.Marshal(&input)
- if err != nil {
- t.Errorf("%d-1: Failed to marshal input: '%v': %v", i, input, err)
- }
-
- var result DurationHolder
- if err := yaml.Unmarshal(jsonMarshalled, &result); err != nil {
- t.Errorf("%d-2: Failed to unmarshal '%+v': %v", i, string(jsonMarshalled), err)
- }
-
- if input.D != result.D {
- t.Errorf("%d-4: Failed to marshal input '%#v': got %#v", i, input, result)
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/group_version_test.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/group_version_test.go
deleted file mode 100644
index ab62ff424..000000000
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/group_version_test.go
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
-Copyright 2015 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package v1
-
-import (
- "encoding/json"
- "reflect"
- "testing"
-
- k8s_json "k8s.io/apimachinery/pkg/runtime/serializer/json"
-)
-
-type GroupVersionHolder struct {
- GV GroupVersion `json:"val"`
-}
-
-func TestGroupVersionUnmarshalJSON(t *testing.T) {
- cases := []struct {
- input []byte
- expect GroupVersion
- }{
- {[]byte(`{"val": "v1"}`), GroupVersion{"", "v1"}},
- {[]byte(`{"val": "extensions/v1beta1"}`), GroupVersion{"extensions", "v1beta1"}},
- }
-
- for _, c := range cases {
- var result GroupVersionHolder
- // test golang lib's JSON codec
- if err := json.Unmarshal([]byte(c.input), &result); err != nil {
- t.Errorf("JSON codec failed to unmarshal input '%v': %v", c.input, err)
- }
- if !reflect.DeepEqual(result.GV, c.expect) {
- t.Errorf("JSON codec failed to unmarshal input '%s': expected %+v, got %+v", c.input, c.expect, result.GV)
- }
- // test the json-iterator codec
- iter := k8s_json.CaseSensitiveJsonIterator()
- if err := iter.Unmarshal(c.input, &result); err != nil {
- t.Errorf("json-iterator codec failed to unmarshal input '%v': %v", c.input, err)
- }
- if !reflect.DeepEqual(result.GV, c.expect) {
- t.Errorf("json-iterator codec failed to unmarshal input '%s': expected %+v, got %+v", c.input, c.expect, result.GV)
- }
- }
-}
-
-func TestGroupVersionMarshalJSON(t *testing.T) {
- cases := []struct {
- input GroupVersion
- expect []byte
- }{
- {GroupVersion{"", "v1"}, []byte(`{"val":"v1"}`)},
- {GroupVersion{"extensions", "v1beta1"}, []byte(`{"val":"extensions/v1beta1"}`)},
- }
-
- for _, c := range cases {
- input := GroupVersionHolder{c.input}
- result, err := json.Marshal(&input)
- if err != nil {
- t.Errorf("Failed to marshal input '%v': %v", input, err)
- }
- if !reflect.DeepEqual(result, c.expect) {
- t.Errorf("Failed to marshal input '%+v': expected: %s, got: %s", input, c.expect, result)
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers_test.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers_test.go
deleted file mode 100644
index fba6b158e..000000000
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers_test.go
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package v1
-
-import (
- "reflect"
- "strings"
- "testing"
-
- "k8s.io/apimachinery/pkg/labels"
-)
-
-func TestLabelSelectorAsSelector(t *testing.T) {
- matchLabels := map[string]string{"foo": "bar"}
- matchExpressions := []LabelSelectorRequirement{{
- Key: "baz",
- Operator: LabelSelectorOpIn,
- Values: []string{"qux", "norf"},
- }}
- mustParse := func(s string) labels.Selector {
- out, e := labels.Parse(s)
- if e != nil {
- panic(e)
- }
- return out
- }
- tc := []struct {
- in *LabelSelector
- out labels.Selector
- expectErr bool
- }{
- {in: nil, out: labels.Nothing()},
- {in: &LabelSelector{}, out: labels.Everything()},
- {
- in: &LabelSelector{MatchLabels: matchLabels},
- out: mustParse("foo=bar"),
- },
- {
- in: &LabelSelector{MatchExpressions: matchExpressions},
- out: mustParse("baz in (norf,qux)"),
- },
- {
- in: &LabelSelector{MatchLabels: matchLabels, MatchExpressions: matchExpressions},
- out: mustParse("baz in (norf,qux),foo=bar"),
- },
- {
- in: &LabelSelector{
- MatchExpressions: []LabelSelectorRequirement{{
- Key: "baz",
- Operator: LabelSelectorOpExists,
- Values: []string{"qux", "norf"},
- }},
- },
- expectErr: true,
- },
- }
-
- for i, tc := range tc {
- out, err := LabelSelectorAsSelector(tc.in)
- if err == nil && tc.expectErr {
- t.Errorf("[%v]expected error but got none.", i)
- }
- if err != nil && !tc.expectErr {
- t.Errorf("[%v]did not expect error but got: %v", i, err)
- }
- if !reflect.DeepEqual(out, tc.out) {
- t.Errorf("[%v]expected:\n\t%+v\nbut got:\n\t%+v", i, tc.out, out)
- }
- }
-}
-
-func TestLabelSelectorAsMap(t *testing.T) {
- matchLabels := map[string]string{"foo": "bar"}
- matchExpressions := func(operator LabelSelectorOperator, values []string) []LabelSelectorRequirement {
- return []LabelSelectorRequirement{{
- Key: "baz",
- Operator: operator,
- Values: values,
- }}
- }
-
- tests := []struct {
- in *LabelSelector
- out map[string]string
- errString string
- }{
- {in: nil, out: nil},
- {
- in: &LabelSelector{MatchLabels: matchLabels},
- out: map[string]string{"foo": "bar"},
- },
- {
- in: &LabelSelector{MatchLabels: matchLabels, MatchExpressions: matchExpressions(LabelSelectorOpIn, []string{"norf"})},
- out: map[string]string{"foo": "bar", "baz": "norf"},
- },
- {
- in: &LabelSelector{MatchExpressions: matchExpressions(LabelSelectorOpIn, []string{"norf"})},
- out: map[string]string{"baz": "norf"},
- },
- {
- in: &LabelSelector{MatchLabels: matchLabels, MatchExpressions: matchExpressions(LabelSelectorOpIn, []string{"norf", "qux"})},
- out: map[string]string{"foo": "bar"},
- errString: "without a single value cannot be converted",
- },
- {
- in: &LabelSelector{MatchExpressions: matchExpressions(LabelSelectorOpNotIn, []string{"norf", "qux"})},
- out: map[string]string{},
- errString: "cannot be converted",
- },
- {
- in: &LabelSelector{MatchLabels: matchLabels, MatchExpressions: matchExpressions(LabelSelectorOpExists, []string{})},
- out: map[string]string{"foo": "bar"},
- errString: "cannot be converted",
- },
- {
- in: &LabelSelector{MatchExpressions: matchExpressions(LabelSelectorOpDoesNotExist, []string{})},
- out: map[string]string{},
- errString: "cannot be converted",
- },
- }
-
- for i, tc := range tests {
- out, err := LabelSelectorAsMap(tc.in)
- if err == nil && len(tc.errString) > 0 {
- t.Errorf("[%v]expected error but got none.", i)
- continue
- }
- if err != nil && len(tc.errString) == 0 {
- t.Errorf("[%v]did not expect error but got: %v", i, err)
- continue
- }
- if err != nil && len(tc.errString) > 0 && !strings.Contains(err.Error(), tc.errString) {
- t.Errorf("[%v]expected error with %q but got: %v", i, tc.errString, err)
- continue
- }
- if !reflect.DeepEqual(out, tc.out) {
- t.Errorf("[%v]expected:\n\t%+v\nbut got:\n\t%+v", i, tc.out, out)
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/labels_test.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/labels_test.go
deleted file mode 100644
index 918b1a294..000000000
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/labels_test.go
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package v1
-
-import (
- "reflect"
- "testing"
-)
-
-func TestCloneSelectorAndAddLabel(t *testing.T) {
- labels := map[string]string{
- "foo1": "bar1",
- "foo2": "bar2",
- "foo3": "bar3",
- }
- matchExpressions := []LabelSelectorRequirement{
- {Key: "foo", Operator: LabelSelectorOpIn, Values: []string{"foo"}},
- }
-
- cases := []struct {
- labels map[string]string
- labelKey string
- labelValue string
- want map[string]string
- }{
- {
- labels: labels,
- want: labels,
- },
- {
- labels: labels,
- labelKey: "foo4",
- labelValue: "89",
- want: map[string]string{
- "foo1": "bar1",
- "foo2": "bar2",
- "foo3": "bar3",
- "foo4": "89",
- },
- },
- {
- labels: nil,
- labelKey: "foo4",
- labelValue: "12",
- want: map[string]string{
- "foo4": "12",
- },
- },
- }
-
- for _, tc := range cases {
- ls_in := LabelSelector{MatchLabels: tc.labels, MatchExpressions: matchExpressions}
- ls_out := LabelSelector{MatchLabels: tc.want, MatchExpressions: matchExpressions}
-
- got := CloneSelectorAndAddLabel(&ls_in, tc.labelKey, tc.labelValue)
- if !reflect.DeepEqual(got, &ls_out) {
- t.Errorf("got %v, want %v", got, tc.want)
- }
- }
-}
-
-func TestAddLabelToSelector(t *testing.T) {
- labels := map[string]string{
- "foo1": "bar1",
- "foo2": "bar2",
- "foo3": "bar3",
- }
-
- cases := []struct {
- labels map[string]string
- labelKey string
- labelValue string
- want map[string]string
- }{
- {
- labels: labels,
- want: labels,
- },
- {
- labels: labels,
- labelKey: "foo4",
- labelValue: "89",
- want: map[string]string{
- "foo1": "bar1",
- "foo2": "bar2",
- "foo3": "bar3",
- "foo4": "89",
- },
- },
- {
- labels: nil,
- labelKey: "foo4",
- labelValue: "12",
- want: map[string]string{
- "foo4": "12",
- },
- },
- }
-
- for _, tc := range cases {
- ls_in := LabelSelector{MatchLabels: tc.labels}
- ls_out := LabelSelector{MatchLabels: tc.want}
-
- got := AddLabelToSelector(&ls_in, tc.labelKey, tc.labelValue)
- if !reflect.DeepEqual(got, &ls_out) {
- t.Errorf("got %v, want %v", got, tc.want)
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_test.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_test.go
deleted file mode 100644
index 339610aeb..000000000
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_test.go
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package v1
-
-import (
- "encoding/json"
- "reflect"
- "testing"
- "time"
-
- "github.com/ghodss/yaml"
-)
-
-type MicroTimeHolder struct {
- T MicroTime `json:"t"`
-}
-
-func TestMicroTimeMarshalYAML(t *testing.T) {
- cases := []struct {
- input MicroTime
- result string
- }{
- {MicroTime{}, "t: null\n"},
- {DateMicro(1998, time.May, 5, 1, 5, 5, 50, time.FixedZone("test", -4*60*60)), "t: 1998-05-05T05:05:05.000000Z\n"},
- {DateMicro(1998, time.May, 5, 5, 5, 5, 0, time.UTC), "t: 1998-05-05T05:05:05.000000Z\n"},
- }
-
- for _, c := range cases {
- input := MicroTimeHolder{c.input}
- result, err := yaml.Marshal(&input)
- if err != nil {
- t.Errorf("Failed to marshal input: '%v': %v", input, err)
- }
- if string(result) != c.result {
- t.Errorf("Failed to marshal input: '%v': expected %+v, got %q", input, c.result, string(result))
- }
- }
-}
-
-func TestMicroTimeUnmarshalYAML(t *testing.T) {
- cases := []struct {
- input string
- result MicroTime
- }{
- {"t: null\n", MicroTime{}},
- {"t: 1998-05-05T05:05:05.000000Z\n", MicroTime{Date(1998, time.May, 5, 5, 5, 5, 0, time.UTC).Local()}},
- }
-
- for _, c := range cases {
- var result MicroTimeHolder
- if err := yaml.Unmarshal([]byte(c.input), &result); err != nil {
- t.Errorf("Failed to unmarshal input '%v': %v", c.input, err)
- }
- if result.T != c.result {
- t.Errorf("Failed to unmarshal input '%v': expected %+v, got %+v", c.input, c.result, result)
- }
- }
-}
-
-func TestMicroTimeMarshalJSON(t *testing.T) {
- cases := []struct {
- input MicroTime
- result string
- }{
- {MicroTime{}, "{\"t\":null}"},
- {DateMicro(1998, time.May, 5, 5, 5, 5, 50, time.UTC), "{\"t\":\"1998-05-05T05:05:05.000000Z\"}"},
- {DateMicro(1998, time.May, 5, 5, 5, 5, 0, time.UTC), "{\"t\":\"1998-05-05T05:05:05.000000Z\"}"},
- }
-
- for _, c := range cases {
- input := MicroTimeHolder{c.input}
- result, err := json.Marshal(&input)
- if err != nil {
- t.Errorf("Failed to marshal input: '%v': %v", input, err)
- }
- if string(result) != c.result {
- t.Errorf("Failed to marshal input: '%v': expected %+v, got %q", input, c.result, string(result))
- }
- }
-}
-
-func TestMicroTimeUnmarshalJSON(t *testing.T) {
- cases := []struct {
- input string
- result MicroTime
- }{
- {"{\"t\":null}", MicroTime{}},
- {"{\"t\":\"1998-05-05T05:05:05.000000Z\"}", MicroTime{Date(1998, time.May, 5, 5, 5, 5, 0, time.UTC).Local()}},
- }
-
- for _, c := range cases {
- var result MicroTimeHolder
- if err := json.Unmarshal([]byte(c.input), &result); err != nil {
- t.Errorf("Failed to unmarshal input '%v': %v", c.input, err)
- }
- if result.T != c.result {
- t.Errorf("Failed to unmarshal input '%v': expected %+v, got %+v", c.input, c.result, result)
- }
- }
-}
-
-func TestMicroTimeProto(t *testing.T) {
- cases := []struct {
- input MicroTime
- }{
- {MicroTime{}},
- {DateMicro(1998, time.May, 5, 1, 5, 5, 50, time.Local)},
- {DateMicro(1998, time.May, 5, 5, 5, 5, 0, time.Local)},
- }
-
- for _, c := range cases {
- input := c.input
- data, err := input.Marshal()
- if err != nil {
- t.Fatalf("Failed to marshal input: '%v': %v", input, err)
- }
- time := MicroTime{}
- if err := time.Unmarshal(data); err != nil {
- t.Fatalf("Failed to unmarshal output: '%v': %v", input, err)
- }
- if !reflect.DeepEqual(input, time) {
- t.Errorf("Marshal->Unmarshal is not idempotent: '%v' vs '%v'", input, time)
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time_test.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time_test.go
deleted file mode 100644
index 9923958ee..000000000
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time_test.go
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package v1
-
-import (
- "encoding/json"
- "reflect"
- "testing"
- "time"
-
- "github.com/ghodss/yaml"
-)
-
-type TimeHolder struct {
- T Time `json:"t"`
-}
-
-func TestTimeMarshalYAML(t *testing.T) {
- cases := []struct {
- input Time
- result string
- }{
- {Time{}, "t: null\n"},
- {Date(1998, time.May, 5, 1, 5, 5, 50, time.FixedZone("test", -4*60*60)), "t: 1998-05-05T05:05:05Z\n"},
- {Date(1998, time.May, 5, 5, 5, 5, 0, time.UTC), "t: 1998-05-05T05:05:05Z\n"},
- }
-
- for _, c := range cases {
- input := TimeHolder{c.input}
- result, err := yaml.Marshal(&input)
- if err != nil {
- t.Errorf("Failed to marshal input: '%v': %v", input, err)
- }
- if string(result) != c.result {
- t.Errorf("Failed to marshal input: '%v': expected %+v, got %q", input, c.result, string(result))
- }
- }
-}
-
-func TestTimeUnmarshalYAML(t *testing.T) {
- cases := []struct {
- input string
- result Time
- }{
- {"t: null\n", Time{}},
- {"t: 1998-05-05T05:05:05Z\n", Time{Date(1998, time.May, 5, 5, 5, 5, 0, time.UTC).Local()}},
- }
-
- for _, c := range cases {
- var result TimeHolder
- if err := yaml.Unmarshal([]byte(c.input), &result); err != nil {
- t.Errorf("Failed to unmarshal input '%v': %v", c.input, err)
- }
- if result.T != c.result {
- t.Errorf("Failed to unmarshal input '%v': expected %+v, got %+v", c.input, c.result, result)
- }
- }
-}
-
-func TestTimeMarshalJSON(t *testing.T) {
- cases := []struct {
- input Time
- result string
- }{
- {Time{}, "{\"t\":null}"},
- {Date(1998, time.May, 5, 5, 5, 5, 50, time.UTC), "{\"t\":\"1998-05-05T05:05:05Z\"}"},
- {Date(1998, time.May, 5, 5, 5, 5, 0, time.UTC), "{\"t\":\"1998-05-05T05:05:05Z\"}"},
- }
-
- for _, c := range cases {
- input := TimeHolder{c.input}
- result, err := json.Marshal(&input)
- if err != nil {
- t.Errorf("Failed to marshal input: '%v': %v", input, err)
- }
- if string(result) != c.result {
- t.Errorf("Failed to marshal input: '%v': expected %+v, got %q", input, c.result, string(result))
- }
- }
-}
-
-func TestTimeUnmarshalJSON(t *testing.T) {
- cases := []struct {
- input string
- result Time
- }{
- {"{\"t\":null}", Time{}},
- {"{\"t\":\"1998-05-05T05:05:05Z\"}", Time{Date(1998, time.May, 5, 5, 5, 5, 0, time.UTC).Local()}},
- }
-
- for _, c := range cases {
- var result TimeHolder
- if err := json.Unmarshal([]byte(c.input), &result); err != nil {
- t.Errorf("Failed to unmarshal input '%v': %v", c.input, err)
- }
- if result.T != c.result {
- t.Errorf("Failed to unmarshal input '%v': expected %+v, got %+v", c.input, c.result, result)
- }
- }
-}
-
-func TestTimeMarshalJSONUnmarshalYAML(t *testing.T) {
- cases := []struct {
- input Time
- }{
- {Time{}},
- {Date(1998, time.May, 5, 5, 5, 5, 50, time.Local).Rfc3339Copy()},
- {Date(1998, time.May, 5, 5, 5, 5, 0, time.Local).Rfc3339Copy()},
- }
-
- for i, c := range cases {
- input := TimeHolder{c.input}
- jsonMarshalled, err := json.Marshal(&input)
- if err != nil {
- t.Errorf("%d-1: Failed to marshal input: '%v': %v", i, input, err)
- }
-
- var result TimeHolder
- err = yaml.Unmarshal(jsonMarshalled, &result)
- if err != nil {
- t.Errorf("%d-2: Failed to unmarshal '%+v': %v", i, string(jsonMarshalled), err)
- }
-
- iN, iO := input.T.Zone()
- oN, oO := result.T.Zone()
- if iN != oN || iO != oO {
- t.Errorf("%d-3: Time zones differ before and after serialization %s:%d %s:%d", i, iN, iO, oN, oO)
- }
-
- if input.T.UnixNano() != result.T.UnixNano() {
- t.Errorf("%d-4: Failed to marshal input '%#v': got %#v", i, input, result)
- }
- }
-}
-
-func TestTimeProto(t *testing.T) {
- cases := []struct {
- input Time
- }{
- {Time{}},
- {Date(1998, time.May, 5, 1, 5, 5, 0, time.Local)},
- {Date(1998, time.May, 5, 5, 5, 5, 0, time.Local)},
- }
-
- for _, c := range cases {
- input := c.input
- data, err := input.Marshal()
- if err != nil {
- t.Fatalf("Failed to marshal input: '%v': %v", input, err)
- }
- time := Time{}
- if err := time.Unmarshal(data); err != nil {
- t.Fatalf("Failed to unmarshal output: '%v': %v", input, err)
- }
- if !reflect.DeepEqual(input, time) {
- t.Errorf("Marshal->Unmarshal is not idempotent: '%v' vs '%v'", input, time)
- }
- }
-}
-
-func TestTimeEqual(t *testing.T) {
- t1 := NewTime(time.Now())
- cases := []struct {
- name string
- x *Time
- y *Time
- result bool
- }{
- {"nil =? nil", nil, nil, true},
- {"!nil =? !nil", &t1, &t1, true},
- {"nil =? !nil", nil, &t1, false},
- {"!nil =? nil", &t1, nil, false},
- }
-
- for _, c := range cases {
- t.Run(c.name, func(t *testing.T) {
- result := c.x.Equal(c.y)
- if result != c.result {
- t.Errorf("Failed equality test for '%v', '%v': expected %+v, got %+v", c.x, c.y, c.result, result)
- }
- })
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types_test.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types_test.go
deleted file mode 100644
index ed5f20c40..000000000
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types_test.go
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package v1
-
-import (
- "encoding/json"
- "reflect"
- "testing"
-
- k8s_json "k8s.io/apimachinery/pkg/runtime/serializer/json"
-)
-
-func TestVerbsUgorjiMarshalJSON(t *testing.T) {
- cases := []struct {
- input APIResource
- result string
- }{
- {APIResource{}, `{"name":"","singularName":"","namespaced":false,"kind":"","verbs":null}`},
- {APIResource{Verbs: Verbs([]string{})}, `{"name":"","singularName":"","namespaced":false,"kind":"","verbs":[]}`},
- {APIResource{Verbs: Verbs([]string{"delete"})}, `{"name":"","singularName":"","namespaced":false,"kind":"","verbs":["delete"]}`},
- }
-
- for i, c := range cases {
- result, err := json.Marshal(&c.input)
- if err != nil {
- t.Errorf("[%d] Failed to marshal input: '%v': %v", i, c.input, err)
- }
- if string(result) != c.result {
- t.Errorf("[%d] Failed to marshal input: '%v': expected '%v', got '%v'", i, c.input, c.result, string(result))
- }
- }
-}
-
-func TestVerbsUJsonIterUnmarshalJSON(t *testing.T) {
- cases := []struct {
- input string
- result APIResource
- }{
- {`{}`, APIResource{}},
- {`{"verbs":null}`, APIResource{}},
- {`{"verbs":[]}`, APIResource{Verbs: Verbs([]string{})}},
- {`{"verbs":["delete"]}`, APIResource{Verbs: Verbs([]string{"delete"})}},
- }
-
- iter := k8s_json.CaseSensitiveJsonIterator()
- for i, c := range cases {
- var result APIResource
- if err := iter.Unmarshal([]byte(c.input), &result); err != nil {
- t.Errorf("[%d] Failed to unmarshal input '%v': %v", i, c.input, err)
- }
- if !reflect.DeepEqual(result, c.result) {
- t.Errorf("[%d] Failed to unmarshal input '%v': expected %+v, got %+v", i, c.input, c.result, result)
- }
- }
-}
-
-// TestUgorjiMarshalJSONWithOmit tests that we don't have regressions regarding nil and empty slices with "omit"
-func TestUgorjiMarshalJSONWithOmit(t *testing.T) {
- cases := []struct {
- input LabelSelector
- result string
- }{
- {LabelSelector{}, `{}`},
- {LabelSelector{MatchExpressions: []LabelSelectorRequirement{}}, `{}`},
- {LabelSelector{MatchExpressions: []LabelSelectorRequirement{{}}}, `{"matchExpressions":[{"key":"","operator":""}]}`},
- }
-
- for i, c := range cases {
- result, err := json.Marshal(&c.input)
- if err != nil {
- t.Errorf("[%d] Failed to marshal input: '%v': %v", i, c.input, err)
- }
- if string(result) != c.result {
- t.Errorf("[%d] Failed to marshal input: '%v': expected '%v', got '%v'", i, c.input, c.result, string(result))
- }
- }
-}
-
-func TestVerbsUnmarshalJSON(t *testing.T) {
- cases := []struct {
- input string
- result APIResource
- }{
- {`{}`, APIResource{}},
- {`{"verbs":null}`, APIResource{}},
- {`{"verbs":[]}`, APIResource{Verbs: Verbs([]string{})}},
- {`{"verbs":["delete"]}`, APIResource{Verbs: Verbs([]string{"delete"})}},
- }
-
- for i, c := range cases {
- var result APIResource
- if err := json.Unmarshal([]byte(c.input), &result); err != nil {
- t.Errorf("[%d] Failed to unmarshal input '%v': %v", i, c.input, err)
- }
- if !reflect.DeepEqual(result, c.result) {
- t.Errorf("[%d] Failed to unmarshal input '%v': expected %+v, got %+v", i, c.input, c.result, result)
- }
- }
-}
-
-func TestVerbsProto(t *testing.T) {
- cases := []APIResource{
- {},
- {Verbs: Verbs([]string{})},
- {Verbs: Verbs([]string{"delete"})},
- }
-
- for _, input := range cases {
- data, err := input.Marshal()
- if err != nil {
- t.Fatalf("Failed to marshal input: '%v': %v", input, err)
- }
- resource := APIResource{}
- if err := resource.Unmarshal(data); err != nil {
- t.Fatalf("Failed to unmarshal output: '%v': %v", input, err)
- }
- if !reflect.DeepEqual(input, resource) {
- t.Errorf("Marshal->Unmarshal is not idempotent: '%v' vs '%v'", input, resource)
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers_test.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers_test.go
deleted file mode 100644
index d97996211..000000000
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers_test.go
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package unstructured
-
-import (
- "io/ioutil"
- "sync"
- "testing"
-
- "github.com/stretchr/testify/assert"
-)
-
-// TestCodecOfUnstructuredList tests that there are no data races in Encode().
-// i.e. that it does not mutate the object being encoded.
-func TestCodecOfUnstructuredList(t *testing.T) {
- var wg sync.WaitGroup
- concurrency := 10
- list := UnstructuredList{
- Object: map[string]interface{}{},
- }
- wg.Add(concurrency)
- for i := 0; i < concurrency; i++ {
- go func() {
- defer wg.Done()
- assert.NoError(t, UnstructuredJSONScheme.Encode(&list, ioutil.Discard))
- }()
- }
- wg.Wait()
-}
-
-func TestRemoveNestedField(t *testing.T) {
- obj := map[string]interface{}{
- "x": map[string]interface{}{
- "y": 1,
- "a": "foo",
- },
- }
- RemoveNestedField(obj, "x", "a")
- assert.Len(t, obj["x"], 1)
- RemoveNestedField(obj, "x", "y")
- assert.Empty(t, obj["x"])
- RemoveNestedField(obj, "x")
- assert.Empty(t, obj)
- RemoveNestedField(obj, "x") // Remove of a non-existent field
- assert.Empty(t, obj)
-}
-
-func TestNestedFieldNoCopy(t *testing.T) {
- target := map[string]interface{}{"foo": "bar"}
-
- obj := map[string]interface{}{
- "a": map[string]interface{}{
- "b": target,
- "c": nil,
- "d": []interface{}{"foo"},
- },
- }
-
- // case 1: field exists and is non-nil
- res, exists, err := NestedFieldNoCopy(obj, "a", "b")
- assert.True(t, exists)
- assert.Nil(t, err)
- assert.Equal(t, target, res)
- target["foo"] = "baz"
- assert.Equal(t, target["foo"], res.(map[string]interface{})["foo"], "result should be a reference to the expected item")
-
- // case 2: field exists and is nil
- res, exists, err = NestedFieldNoCopy(obj, "a", "c")
- assert.True(t, exists)
- assert.Nil(t, err)
- assert.Nil(t, res)
-
- // case 3: error traversing obj
- res, exists, err = NestedFieldNoCopy(obj, "a", "d", "foo")
- assert.False(t, exists)
- assert.NotNil(t, err)
- assert.Nil(t, res)
-
- // case 4: field does not exist
- res, exists, err = NestedFieldNoCopy(obj, "a", "e")
- assert.False(t, exists)
- assert.Nil(t, err)
- assert.Nil(t, res)
-}
-
-func TestNestedFieldCopy(t *testing.T) {
- target := map[string]interface{}{"foo": "bar"}
-
- obj := map[string]interface{}{
- "a": map[string]interface{}{
- "b": target,
- "c": nil,
- "d": []interface{}{"foo"},
- },
- }
-
- // case 1: field exists and is non-nil
- res, exists, err := NestedFieldCopy(obj, "a", "b")
- assert.True(t, exists)
- assert.Nil(t, err)
- assert.Equal(t, target, res)
- target["foo"] = "baz"
- assert.NotEqual(t, target["foo"], res.(map[string]interface{})["foo"], "result should be a copy of the expected item")
-
- // case 2: field exists and is nil
- res, exists, err = NestedFieldCopy(obj, "a", "c")
- assert.True(t, exists)
- assert.Nil(t, err)
- assert.Nil(t, res)
-
- // case 3: error traversing obj
- res, exists, err = NestedFieldCopy(obj, "a", "d", "foo")
- assert.False(t, exists)
- assert.NotNil(t, err)
- assert.Nil(t, res)
-
- // case 4: field does not exist
- res, exists, err = NestedFieldCopy(obj, "a", "e")
- assert.False(t, exists)
- assert.Nil(t, err)
- assert.Nil(t, res)
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list_test.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list_test.go
deleted file mode 100644
index 04ada449b..000000000
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list_test.go
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package unstructured
-
-import (
- "testing"
-
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-
- "github.com/stretchr/testify/assert"
- "github.com/stretchr/testify/require"
-)
-
-func TestUnstructuredList(t *testing.T) {
- list := &UnstructuredList{
- Object: map[string]interface{}{"kind": "List", "apiVersion": "v1"},
- Items: []Unstructured{
- {Object: map[string]interface{}{"kind": "Pod", "apiVersion": "v1", "metadata": map[string]interface{}{"name": "test"}}},
- },
- }
- content := list.UnstructuredContent()
- items := content["items"].([]interface{})
- require.Len(t, items, 1)
- val, found, err := NestedFieldCopy(items[0].(map[string]interface{}), "metadata", "name")
- require.True(t, found)
- require.NoError(t, err)
- assert.Equal(t, "test", val)
-}
-
-func TestNilDeletionTimestamp(t *testing.T) {
- var u Unstructured
- del := u.GetDeletionTimestamp()
- if del != nil {
- t.Errorf("unexpected non-nil deletion timestamp: %v", del)
- }
- u.SetDeletionTimestamp(u.GetDeletionTimestamp())
- del = u.GetDeletionTimestamp()
- if del != nil {
- t.Errorf("unexpected non-nil deletion timestamp: %v", del)
- }
- _, ok := u.Object["metadata"]
- assert.False(t, ok)
-
- now := metav1.Now()
- u.SetDeletionTimestamp(&now)
- assert.Equal(t, now.Unix(), u.GetDeletionTimestamp().Unix())
- u.SetDeletionTimestamp(nil)
- metadata := u.Object["metadata"].(map[string]interface{})
- _, ok = metadata["deletionTimestamp"]
- assert.False(t, ok)
-}
-
-func TestEmptyCreationTimestampIsOmitted(t *testing.T) {
- var u Unstructured
- now := metav1.Now()
-
- // set an initial creationTimestamp and ensure the field exists
- u.SetCreationTimestamp(now)
- metadata := u.Object["metadata"].(map[string]interface{})
- creationTimestamp, exists := metadata["creationTimestamp"]
- if !exists {
- t.Fatalf("unexpected missing creationTimestamp")
- }
-
- // set an empty timestamp and ensure the field no longer exists
- u.SetCreationTimestamp(metav1.Time{})
- metadata = u.Object["metadata"].(map[string]interface{})
- creationTimestamp, exists = metadata["creationTimestamp"]
- if exists {
- t.Errorf("unexpected creation timestamp field: %q", creationTimestamp)
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_test.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_test.go
deleted file mode 100644
index cbcbbcef3..000000000
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_test.go
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-Copyright 2018 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package unstructured
-
-import (
- "testing"
-
- "github.com/stretchr/testify/assert"
-)
-
-func TestNilUnstructuredContent(t *testing.T) {
- var u Unstructured
- uCopy := u.DeepCopy()
- content := u.UnstructuredContent()
- expContent := make(map[string]interface{})
- assert.EqualValues(t, expContent, content)
- assert.Equal(t, uCopy, &u)
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/conversion/converter_test.go b/vendor/k8s.io/apimachinery/pkg/conversion/converter_test.go
deleted file mode 100644
index 5373c8098..000000000
--- a/vendor/k8s.io/apimachinery/pkg/conversion/converter_test.go
+++ /dev/null
@@ -1,826 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package conversion
-
-import (
- "fmt"
- "reflect"
- "strconv"
- "strings"
- "testing"
-
- "github.com/google/gofuzz"
- flag "github.com/spf13/pflag"
-
- "k8s.io/apimachinery/pkg/util/diff"
-)
-
-var fuzzIters = flag.Int("fuzz-iters", 50, "How many fuzzing iterations to do.")
-
-// Test a weird version/kind embedding format.
-type MyWeirdCustomEmbeddedVersionKindField struct {
- ID string `json:"ID,omitempty"`
- APIVersion string `json:"myVersionKey,omitempty"`
- ObjectKind string `json:"myKindKey,omitempty"`
- Z string `json:"Z,omitempty"`
- Y uint64 `json:"Y,omitempty"`
-}
-
-type TestType1 struct {
- MyWeirdCustomEmbeddedVersionKindField `json:",inline"`
- A string `json:"A,omitempty"`
- B int `json:"B,omitempty"`
- C int8 `json:"C,omitempty"`
- D int16 `json:"D,omitempty"`
- E int32 `json:"E,omitempty"`
- F int64 `json:"F,omitempty"`
- G uint `json:"G,omitempty"`
- H uint8 `json:"H,omitempty"`
- I uint16 `json:"I,omitempty"`
- J uint32 `json:"J,omitempty"`
- K uint64 `json:"K,omitempty"`
- L bool `json:"L,omitempty"`
- M map[string]int `json:"M,omitempty"`
- N map[string]TestType2 `json:"N,omitempty"`
- O *TestType2 `json:"O,omitempty"`
- P []TestType2 `json:"Q,omitempty"`
-}
-
-type TestType2 struct {
- A string `json:"A,omitempty"`
- B int `json:"B,omitempty"`
-}
-
-type ExternalTestType2 struct {
- A string `json:"A,omitempty"`
- B int `json:"B,omitempty"`
-}
-type ExternalTestType1 struct {
- MyWeirdCustomEmbeddedVersionKindField `json:",inline"`
- A string `json:"A,omitempty"`
- B int `json:"B,omitempty"`
- C int8 `json:"C,omitempty"`
- D int16 `json:"D,omitempty"`
- E int32 `json:"E,omitempty"`
- F int64 `json:"F,omitempty"`
- G uint `json:"G,omitempty"`
- H uint8 `json:"H,omitempty"`
- I uint16 `json:"I,omitempty"`
- J uint32 `json:"J,omitempty"`
- K uint64 `json:"K,omitempty"`
- L bool `json:"L,omitempty"`
- M map[string]int `json:"M,omitempty"`
- N map[string]ExternalTestType2 `json:"N,omitempty"`
- O *ExternalTestType2 `json:"O,omitempty"`
- P []ExternalTestType2 `json:"Q,omitempty"`
-}
-
-func testLogger(t *testing.T) DebugLogger {
- // We don't set logger to eliminate rubbish logs in tests.
- // If you want to switch it, simply switch it to: "return t"
- return nil
-}
-
-func TestConverter_byteSlice(t *testing.T) {
- c := NewConverter(DefaultNameFunc)
- src := []byte{1, 2, 3}
- dest := []byte{}
- err := c.Convert(&src, &dest, 0, nil)
- if err != nil {
- t.Fatalf("expected no error")
- }
- if e, a := src, dest; !reflect.DeepEqual(e, a) {
- t.Errorf("expected %#v, got %#v", e, a)
- }
-}
-
-func TestConverter_MismatchedTypes(t *testing.T) {
- c := NewConverter(DefaultNameFunc)
-
- err := c.RegisterConversionFunc(
- func(in *[]string, out *int, s Scope) error {
- if str, err := strconv.Atoi((*in)[0]); err != nil {
- return err
- } else {
- *out = str
- return nil
- }
- },
- )
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
-
- src := []string{"5"}
- var dest *int
- err = c.Convert(&src, &dest, 0, nil)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- if e, a := 5, *dest; e != a {
- t.Errorf("expected %#v, got %#v", e, a)
- }
-}
-
-func TestConverter_DefaultConvert(t *testing.T) {
- type A struct {
- Foo string
- Baz int
- }
- type B struct {
- Bar string
- Baz int
- }
- c := NewConverter(DefaultNameFunc)
- c.Debug = testLogger(t)
- c.nameFunc = func(t reflect.Type) string { return "MyType" }
-
- // Ensure conversion funcs can call DefaultConvert to get default behavior,
- // then fixup remaining fields manually
- err := c.RegisterConversionFunc(func(in *A, out *B, s Scope) error {
- if err := s.DefaultConvert(in, out, IgnoreMissingFields); err != nil {
- return err
- }
- out.Bar = in.Foo
- return nil
- })
- if err != nil {
- t.Fatalf("unexpected error %v", err)
- }
-
- x := A{"hello, intrepid test reader!", 3}
- y := B{}
-
- err = c.Convert(&x, &y, 0, nil)
- if err != nil {
- t.Fatalf("unexpected error %v", err)
- }
- if e, a := x.Foo, y.Bar; e != a {
- t.Errorf("expected %v, got %v", e, a)
- }
- if e, a := x.Baz, y.Baz; e != a {
- t.Errorf("expected %v, got %v", e, a)
- }
-}
-
-func TestConverter_DeepCopy(t *testing.T) {
- type A struct {
- Foo *string
- Bar []string
- Baz interface{}
- Qux map[string]string
- }
- c := NewConverter(DefaultNameFunc)
- c.Debug = testLogger(t)
-
- foo, baz := "foo", "baz"
- x := A{
- Foo: &foo,
- Bar: []string{"bar"},
- Baz: &baz,
- Qux: map[string]string{"qux": "qux"},
- }
- y := A{}
-
- if err := c.Convert(&x, &y, 0, nil); err != nil {
- t.Fatalf("unexpected error %v", err)
- }
- *x.Foo = "foo2"
- x.Bar[0] = "bar2"
- *x.Baz.(*string) = "baz2"
- x.Qux["qux"] = "qux2"
- if e, a := *x.Foo, *y.Foo; e == a {
- t.Errorf("expected difference between %v and %v", e, a)
- }
- if e, a := x.Bar, y.Bar; reflect.DeepEqual(e, a) {
- t.Errorf("expected difference between %v and %v", e, a)
- }
- if e, a := *x.Baz.(*string), *y.Baz.(*string); e == a {
- t.Errorf("expected difference between %v and %v", e, a)
- }
- if e, a := x.Qux, y.Qux; reflect.DeepEqual(e, a) {
- t.Errorf("expected difference between %v and %v", e, a)
- }
-}
-
-func TestConverter_CallsRegisteredFunctions(t *testing.T) {
- type A struct {
- Foo string
- Baz int
- }
- type B struct {
- Bar string
- Baz int
- }
- type C struct{}
- c := NewConverter(DefaultNameFunc)
- c.Debug = testLogger(t)
- err := c.RegisterConversionFunc(func(in *A, out *B, s Scope) error {
- out.Bar = in.Foo
- return s.Convert(&in.Baz, &out.Baz, 0)
- })
- if err != nil {
- t.Fatalf("unexpected error %v", err)
- }
- err = c.RegisterConversionFunc(func(in *B, out *A, s Scope) error {
- out.Foo = in.Bar
- return s.Convert(&in.Baz, &out.Baz, 0)
- })
- if err != nil {
- t.Fatalf("unexpected error %v", err)
- }
-
- x := A{"hello, intrepid test reader!", 3}
- y := B{}
-
- err = c.Convert(&x, &y, 0, nil)
- if err != nil {
- t.Fatalf("unexpected error %v", err)
- }
- if e, a := x.Foo, y.Bar; e != a {
- t.Errorf("expected %v, got %v", e, a)
- }
- if e, a := x.Baz, y.Baz; e != a {
- t.Errorf("expected %v, got %v", e, a)
- }
-
- z := B{"all your test are belong to us", 42}
- w := A{}
-
- err = c.Convert(&z, &w, 0, nil)
- if err != nil {
- t.Fatalf("unexpected error %v", err)
- }
- if e, a := z.Bar, w.Foo; e != a {
- t.Errorf("expected %v, got %v", e, a)
- }
- if e, a := z.Baz, w.Baz; e != a {
- t.Errorf("expected %v, got %v", e, a)
- }
-
- err = c.RegisterConversionFunc(func(in *A, out *C, s Scope) error {
- return fmt.Errorf("C can't store an A, silly")
- })
- if err != nil {
- t.Fatalf("unexpected error %v", err)
- }
- err = c.Convert(&A{}, &C{}, 0, nil)
- if err == nil {
- t.Errorf("unexpected non-error")
- }
-}
-
-func TestConverter_IgnoredConversion(t *testing.T) {
- type A struct{}
- type B struct{}
-
- count := 0
- c := NewConverter(DefaultNameFunc)
- if err := c.RegisterConversionFunc(func(in *A, out *B, s Scope) error {
- count++
- return nil
- }); err != nil {
- t.Fatalf("unexpected error %v", err)
- }
- if err := c.RegisterIgnoredConversion(&A{}, &B{}); err != nil {
- t.Fatal(err)
- }
- a := A{}
- b := B{}
- if err := c.Convert(&a, &b, 0, nil); err != nil {
- t.Errorf("%v", err)
- }
- if count != 0 {
- t.Errorf("unexpected number of conversion invocations")
- }
-}
-
-func TestConverter_IgnoredConversionNested(t *testing.T) {
- type C string
- type A struct {
- C C
- }
- type B struct {
- C C
- }
-
- c := NewConverter(DefaultNameFunc)
- typed := C("")
- if err := c.RegisterIgnoredConversion(&typed, &typed); err != nil {
- t.Fatal(err)
- }
- a := A{C: C("test")}
- b := B{C: C("other")}
- if err := c.Convert(&a, &b, AllowDifferentFieldTypeNames, nil); err != nil {
- t.Errorf("%v", err)
- }
- if b.C != C("other") {
- t.Errorf("expected no conversion of field C: %#v", b)
- }
-}
-
-func TestConverter_GeneratedConversionOverriden(t *testing.T) {
- type A struct{}
- type B struct{}
- c := NewConverter(DefaultNameFunc)
- if err := c.RegisterConversionFunc(func(in *A, out *B, s Scope) error {
- return nil
- }); err != nil {
- t.Fatalf("unexpected error %v", err)
- }
- if err := c.RegisterGeneratedConversionFunc(func(in *A, out *B, s Scope) error {
- return fmt.Errorf("generated function should be overridden")
- }); err != nil {
- t.Fatalf("unexpected error %v", err)
- }
-
- a := A{}
- b := B{}
- if err := c.Convert(&a, &b, 0, nil); err != nil {
- t.Errorf("%v", err)
- }
-}
-
-func TestConverter_WithConversionOverriden(t *testing.T) {
- type A struct{}
- type B struct{}
- c := NewConverter(DefaultNameFunc)
- if err := c.RegisterConversionFunc(func(in *A, out *B, s Scope) error {
- return fmt.Errorf("conversion function should be overridden")
- }); err != nil {
- t.Fatalf("unexpected error %v", err)
- }
- if err := c.RegisterGeneratedConversionFunc(func(in *A, out *B, s Scope) error {
- return fmt.Errorf("generated function should be overridden")
- }); err != nil {
- t.Fatalf("unexpected error %v", err)
- }
-
- ext := NewConversionFuncs()
- ext.Add(func(in *A, out *B, s Scope) error {
- return nil
- })
- newc := c.WithConversions(ext)
-
- a := A{}
- b := B{}
- if err := c.Convert(&a, &b, 0, nil); err == nil || err.Error() != "conversion function should be overridden" {
- t.Errorf("unexpected error: %v", err)
- }
- if err := newc.Convert(&a, &b, 0, nil); err != nil {
- t.Errorf("%v", err)
- }
-}
-
-func TestConverter_MapsStringArrays(t *testing.T) {
- type A struct {
- Foo string
- Baz int
- Other string
- }
- c := NewConverter(DefaultNameFunc)
- c.Debug = testLogger(t)
- if err := c.RegisterConversionFunc(func(input *[]string, out *string, s Scope) error {
- if len(*input) == 0 {
- *out = ""
- }
- *out = (*input)[0]
- return nil
- }); err != nil {
- t.Fatalf("unexpected error %v", err)
- }
-
- x := map[string][]string{
- "Foo": {"bar"},
- "Baz": {"1"},
- "Other": {"", "test"},
- "other": {"wrong"},
- }
- y := A{"test", 2, "something"}
-
- if err := c.Convert(&x, &y, AllowDifferentFieldTypeNames, nil); err == nil {
- t.Error("unexpected non-error")
- }
-
- if err := c.RegisterConversionFunc(func(input *[]string, out *int, s Scope) error {
- if len(*input) == 0 {
- *out = 0
- }
- str := (*input)[0]
- i, err := strconv.Atoi(str)
- if err != nil {
- return err
- }
- *out = i
- return nil
- }); err != nil {
- t.Fatalf("unexpected error %v", err)
- }
-
- if err := c.Convert(&x, &y, AllowDifferentFieldTypeNames, nil); err != nil {
- t.Fatalf("unexpected error %v", err)
- }
- if !reflect.DeepEqual(y, A{"bar", 1, ""}) {
- t.Errorf("unexpected result: %#v", y)
- }
-}
-
-func TestConverter_MapsStringArraysWithMappingKey(t *testing.T) {
- type A struct {
- Foo string `json:"test"`
- Baz int
- Other string
- }
- c := NewConverter(DefaultNameFunc)
- c.Debug = testLogger(t)
- if err := c.RegisterConversionFunc(func(input *[]string, out *string, s Scope) error {
- if len(*input) == 0 {
- *out = ""
- }
- *out = (*input)[0]
- return nil
- }); err != nil {
- t.Fatalf("unexpected error %v", err)
- }
-
- x := map[string][]string{
- "Foo": {"bar"},
- "test": {"baz"},
- }
- y := A{"", 0, ""}
-
- if err := c.Convert(&x, &y, AllowDifferentFieldTypeNames|IgnoreMissingFields, &Meta{}); err != nil {
- t.Fatalf("unexpected error %v", err)
- }
- if !reflect.DeepEqual(y, A{"bar", 0, ""}) {
- t.Errorf("unexpected result: %#v", y)
- }
-
- mapping := func(key string, sourceTag, destTag reflect.StructTag) (source string, dest string) {
- if s := destTag.Get("json"); len(s) > 0 {
- return strings.SplitN(s, ",", 2)[0], key
- }
- return key, key
- }
-
- if err := c.Convert(&x, &y, AllowDifferentFieldTypeNames|IgnoreMissingFields, &Meta{KeyNameMapping: mapping}); err != nil {
- t.Fatalf("unexpected error %v", err)
- }
- if !reflect.DeepEqual(y, A{"baz", 0, ""}) {
- t.Errorf("unexpected result: %#v", y)
- }
-}
-
-func TestConverter_fuzz(t *testing.T) {
- // Use the same types from the scheme test.
- table := []struct {
- from, to, check interface{}
- }{
- {&TestType1{}, &ExternalTestType1{}, &TestType1{}},
- {&ExternalTestType1{}, &TestType1{}, &ExternalTestType1{}},
- }
-
- f := fuzz.New().NilChance(.5).NumElements(0, 100)
- c := NewConverter(DefaultNameFunc)
- c.nameFunc = func(t reflect.Type) string {
- // Hide the fact that we don't have separate packages for these things.
- return map[reflect.Type]string{
- reflect.TypeOf(TestType1{}): "TestType1",
- reflect.TypeOf(ExternalTestType1{}): "TestType1",
- reflect.TypeOf(TestType2{}): "TestType2",
- reflect.TypeOf(ExternalTestType2{}): "TestType2",
- }[t]
- }
- c.Debug = testLogger(t)
-
- for i, item := range table {
- for j := 0; j < *fuzzIters; j++ {
- f.Fuzz(item.from)
- err := c.Convert(item.from, item.to, 0, nil)
- if err != nil {
- t.Errorf("(%v, %v): unexpected error: %v", i, j, err)
- continue
- }
- err = c.Convert(item.to, item.check, 0, nil)
- if err != nil {
- t.Errorf("(%v, %v): unexpected error: %v", i, j, err)
- continue
- }
- if e, a := item.from, item.check; !reflect.DeepEqual(e, a) {
- t.Errorf("(%v, %v): unexpected diff: %v", i, j, diff.ObjectDiff(e, a))
- }
- }
- }
-}
-
-func TestConverter_MapElemAddr(t *testing.T) {
- type Foo struct {
- A map[int]int
- }
- type Bar struct {
- A map[string]string
- }
- c := NewConverter(DefaultNameFunc)
- c.Debug = testLogger(t)
- err := c.RegisterConversionFunc(
- func(in *int, out *string, s Scope) error {
- *out = fmt.Sprintf("%v", *in)
- return nil
- },
- )
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
- err = c.RegisterConversionFunc(
- func(in *string, out *int, s Scope) error {
- if str, err := strconv.Atoi(*in); err != nil {
- return err
- } else {
- *out = str
- return nil
- }
- },
- )
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
- f := fuzz.New().NilChance(0).NumElements(3, 3)
- first := Foo{}
- second := Bar{}
- f.Fuzz(&first)
- err = c.Convert(&first, &second, AllowDifferentFieldTypeNames, nil)
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
- third := Foo{}
- err = c.Convert(&second, &third, AllowDifferentFieldTypeNames, nil)
- if e, a := first, third; !reflect.DeepEqual(e, a) {
- t.Errorf("Unexpected diff: %v", diff.ObjectDiff(e, a))
- }
-}
-
-func TestConverter_tags(t *testing.T) {
- type Foo struct {
- A string `test:"foo"`
- }
- type Bar struct {
- A string `test:"bar"`
- }
- c := NewConverter(DefaultNameFunc)
- c.Debug = testLogger(t)
- err := c.RegisterConversionFunc(
- func(in *string, out *string, s Scope) error {
- if e, a := "foo", s.SrcTag().Get("test"); e != a {
- t.Errorf("expected %v, got %v", e, a)
- }
- if e, a := "bar", s.DestTag().Get("test"); e != a {
- t.Errorf("expected %v, got %v", e, a)
- }
- return nil
- },
- )
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
- err = c.Convert(&Foo{}, &Bar{}, AllowDifferentFieldTypeNames, nil)
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
-}
-
-func TestConverter_meta(t *testing.T) {
- type Foo struct{ A string }
- type Bar struct{ A string }
- c := NewConverter(DefaultNameFunc)
- c.Debug = testLogger(t)
- checks := 0
- err := c.RegisterConversionFunc(
- func(in *Foo, out *Bar, s Scope) error {
- if s.Meta() == nil {
- t.Errorf("Meta did not get passed!")
- }
- checks++
- s.Convert(&in.A, &out.A, 0)
- return nil
- },
- )
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
- err = c.RegisterConversionFunc(
- func(in *string, out *string, s Scope) error {
- if s.Meta() == nil {
- t.Errorf("Meta did not get passed a second time!")
- }
- checks++
- return nil
- },
- )
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
- err = c.Convert(&Foo{}, &Bar{}, 0, &Meta{})
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
- if checks != 2 {
- t.Errorf("Registered functions did not get called.")
- }
-}
-
-func TestConverter_flags(t *testing.T) {
- type Foo struct{ A string }
- type Bar struct{ A string }
- table := []struct {
- from, to interface{}
- flags FieldMatchingFlags
- shouldSucceed bool
- }{
- // Check that DestFromSource allows extra fields only in source.
- {
- from: &struct{ A string }{},
- to: &struct{ A, B string }{},
- flags: DestFromSource,
- shouldSucceed: false,
- }, {
- from: &struct{ A, B string }{},
- to: &struct{ A string }{},
- flags: DestFromSource,
- shouldSucceed: true,
- },
-
- // Check that SourceToDest allows for extra fields only in dest.
- {
- from: &struct{ A string }{},
- to: &struct{ A, B string }{},
- flags: SourceToDest,
- shouldSucceed: true,
- }, {
- from: &struct{ A, B string }{},
- to: &struct{ A string }{},
- flags: SourceToDest,
- shouldSucceed: false,
- },
-
- // Check that IgnoreMissingFields makes the above failure cases pass.
- {
- from: &struct{ A string }{},
- to: &struct{ A, B string }{},
- flags: DestFromSource | IgnoreMissingFields,
- shouldSucceed: true,
- }, {
- from: &struct{ A, B string }{},
- to: &struct{ A string }{},
- flags: SourceToDest | IgnoreMissingFields,
- shouldSucceed: true,
- },
-
- // Check that the field type name must match unless
- // AllowDifferentFieldTypeNames is specified.
- {
- from: &struct{ A, B Foo }{},
- to: &struct{ A Bar }{},
- flags: DestFromSource,
- shouldSucceed: false,
- }, {
- from: &struct{ A Foo }{},
- to: &struct{ A, B Bar }{},
- flags: SourceToDest,
- shouldSucceed: false,
- }, {
- from: &struct{ A, B Foo }{},
- to: &struct{ A Bar }{},
- flags: DestFromSource | AllowDifferentFieldTypeNames,
- shouldSucceed: true,
- }, {
- from: &struct{ A Foo }{},
- to: &struct{ A, B Bar }{},
- flags: SourceToDest | AllowDifferentFieldTypeNames,
- shouldSucceed: true,
- },
- }
- f := fuzz.New().NilChance(.5).NumElements(0, 100)
- c := NewConverter(DefaultNameFunc)
- c.Debug = testLogger(t)
-
- for i, item := range table {
- for j := 0; j < *fuzzIters; j++ {
- f.Fuzz(item.from)
- err := c.Convert(item.from, item.to, item.flags, nil)
- if item.shouldSucceed && err != nil {
- t.Errorf("(%v, %v): unexpected error: %v", i, j, err)
- continue
- }
- if !item.shouldSucceed && err == nil {
- t.Errorf("(%v, %v): unexpected non-error", i, j)
- continue
- }
- }
- }
-}
-
-func TestConverter_FieldRename(t *testing.T) {
- type WeirdMeta struct {
- Name string
- Type string
- }
- type NameMeta struct {
- Name string
- }
- type TypeMeta struct {
- Type string
- }
- type A struct {
- WeirdMeta
- }
- type B struct {
- TypeMeta
- NameMeta
- }
-
- c := NewConverter(DefaultNameFunc)
- err := c.SetStructFieldCopy(WeirdMeta{}, "WeirdMeta", TypeMeta{}, "TypeMeta")
- if err != nil {
- t.Fatalf("unexpected error %v", err)
- }
- err = c.SetStructFieldCopy(WeirdMeta{}, "WeirdMeta", NameMeta{}, "NameMeta")
- if err != nil {
- t.Fatalf("unexpected error %v", err)
- }
- err = c.SetStructFieldCopy(TypeMeta{}, "TypeMeta", WeirdMeta{}, "WeirdMeta")
- if err != nil {
- t.Fatalf("unexpected error %v", err)
- }
- err = c.SetStructFieldCopy(NameMeta{}, "NameMeta", WeirdMeta{}, "WeirdMeta")
- if err != nil {
- t.Fatalf("unexpected error %v", err)
- }
- c.Debug = testLogger(t)
-
- aVal := &A{
- WeirdMeta: WeirdMeta{
- Name: "Foo",
- Type: "Bar",
- },
- }
-
- bVal := &B{
- TypeMeta: TypeMeta{"Bar"},
- NameMeta: NameMeta{"Foo"},
- }
-
- table := map[string]struct {
- from, to, expect interface{}
- flags FieldMatchingFlags
- }{
- "to": {
- aVal,
- &B{},
- bVal,
- AllowDifferentFieldTypeNames | SourceToDest | IgnoreMissingFields,
- },
- "from": {
- bVal,
- &A{},
- aVal,
- AllowDifferentFieldTypeNames | SourceToDest,
- },
- "toDestFirst": {
- aVal,
- &B{},
- bVal,
- AllowDifferentFieldTypeNames,
- },
- "fromDestFirst": {
- bVal,
- &A{},
- aVal,
- AllowDifferentFieldTypeNames | IgnoreMissingFields,
- },
- }
-
- for name, item := range table {
- err := c.Convert(item.from, item.to, item.flags, nil)
- if err != nil {
- t.Errorf("%v: unexpected error: %v", name, err)
- continue
- }
- if e, a := item.expect, item.to; !reflect.DeepEqual(e, a) {
- t.Errorf("%v: unexpected diff: %v", name, diff.ObjectDiff(e, a))
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/conversion/helper_test.go b/vendor/k8s.io/apimachinery/pkg/conversion/helper_test.go
deleted file mode 100644
index 8c61a30a8..000000000
--- a/vendor/k8s.io/apimachinery/pkg/conversion/helper_test.go
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package conversion
-
-import "testing"
-
-func TestInvalidPtrValueKind(t *testing.T) {
- var simple interface{}
- switch obj := simple.(type) {
- default:
- _, err := EnforcePtr(obj)
- if err == nil {
- t.Errorf("Expected error on invalid kind")
- }
- }
-}
-
-func TestEnforceNilPtr(t *testing.T) {
- var nilPtr *struct{}
- _, err := EnforcePtr(nilPtr)
- if err == nil {
- t.Errorf("Expected error on nil pointer")
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/conversion/queryparams/convert_test.go b/vendor/k8s.io/apimachinery/pkg/conversion/queryparams/convert_test.go
deleted file mode 100644
index 1eed5e1fe..000000000
--- a/vendor/k8s.io/apimachinery/pkg/conversion/queryparams/convert_test.go
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package queryparams_test
-
-import (
- "net/url"
- "reflect"
- "testing"
- "time"
-
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/conversion/queryparams"
- "k8s.io/apimachinery/pkg/runtime/schema"
-)
-
-type namedString string
-type namedBool bool
-
-type bar struct {
- Float1 float32 `json:"float1"`
- Float2 float64 `json:"float2"`
- Int1 int64 `json:"int1,omitempty"`
- Int2 int32 `json:"int2,omitempty"`
- Int3 int16 `json:"int3,omitempty"`
- Str1 string `json:"str1,omitempty"`
- Ignored int
- Ignored2 string
-}
-
-func (obj *bar) GetObjectKind() schema.ObjectKind { return schema.EmptyObjectKind }
-
-type foo struct {
- Str string `json:"str"`
- Integer int `json:"integer,omitempty"`
- Slice []string `json:"slice,omitempty"`
- Boolean bool `json:"boolean,omitempty"`
- NamedStr namedString `json:"namedStr,omitempty"`
- NamedBool namedBool `json:"namedBool,omitempty"`
- Foobar bar `json:"foobar,omitempty"`
- Testmap map[string]string `json:"testmap,omitempty"`
-}
-
-func (obj *foo) GetObjectKind() schema.ObjectKind { return schema.EmptyObjectKind }
-
-type baz struct {
- Ptr *int `json:"ptr"`
- Bptr *bool `json:"bptr,omitempty"`
-}
-
-func (obj *baz) GetObjectKind() schema.ObjectKind { return schema.EmptyObjectKind }
-
-// childStructs tests some of the types we serialize to query params for log API calls
-// notably, the nested time struct
-type childStructs struct {
- Container string `json:"container,omitempty"`
- Follow bool `json:"follow,omitempty"`
- Previous bool `json:"previous,omitempty"`
- SinceSeconds *int64 `json:"sinceSeconds,omitempty"`
- TailLines *int64 `json:"tailLines,omitempty"`
- SinceTime *metav1.Time `json:"sinceTime,omitempty"`
- EmptyTime *metav1.Time `json:"emptyTime"`
- NonPointerTime metav1.Time `json:"nonPointerTime"`
-}
-
-func (obj *childStructs) GetObjectKind() schema.ObjectKind { return schema.EmptyObjectKind }
-
-func validateResult(t *testing.T, input interface{}, actual, expected url.Values) {
- local := url.Values{}
- for k, v := range expected {
- local[k] = v
- }
- for k, v := range actual {
- if ev, ok := local[k]; !ok || !reflect.DeepEqual(ev, v) {
- if !ok {
- t.Errorf("%#v: actual value key %s not found in expected map", input, k)
- } else {
- t.Errorf("%#v: values don't match: actual: %#v, expected: %#v", input, v, ev)
- }
- }
- delete(local, k)
- }
- if len(local) > 0 {
- t.Errorf("%#v: expected map has keys that were not found in actual map: %#v", input, local)
- }
-}
-
-func TestConvert(t *testing.T) {
- sinceSeconds := int64(123)
- tailLines := int64(0)
- sinceTime := metav1.Date(2000, 1, 1, 12, 34, 56, 0, time.UTC)
-
- tests := []struct {
- input interface{}
- expected url.Values
- }{
- {
- input: &foo{
- Str: "hello",
- },
- expected: url.Values{"str": {"hello"}},
- },
- {
- input: &foo{
- Str: "test string",
- Slice: []string{"one", "two", "three"},
- Integer: 234,
- Boolean: true,
- },
- expected: url.Values{"str": {"test string"}, "slice": {"one", "two", "three"}, "integer": {"234"}, "boolean": {"true"}},
- },
- {
- input: &foo{
- Str: "named types",
- NamedStr: "value1",
- NamedBool: true,
- },
- expected: url.Values{"str": {"named types"}, "namedStr": {"value1"}, "namedBool": {"true"}},
- },
- {
- input: &foo{
- Str: "don't ignore embedded struct",
- Foobar: bar{
- Float1: 5.0,
- },
- },
- expected: url.Values{"str": {"don't ignore embedded struct"}, "float1": {"5"}, "float2": {"0"}},
- },
- {
- // Ignore untagged fields
- input: &bar{
- Float1: 23.5,
- Float2: 100.7,
- Int1: 1,
- Int2: 2,
- Int3: 3,
- Ignored: 1,
- Ignored2: "ignored",
- },
- expected: url.Values{"float1": {"23.5"}, "float2": {"100.7"}, "int1": {"1"}, "int2": {"2"}, "int3": {"3"}},
- },
- {
- // include fields that are not tagged omitempty
- input: &foo{
- NamedStr: "named str",
- },
- expected: url.Values{"str": {""}, "namedStr": {"named str"}},
- },
- {
- input: &baz{
- Ptr: intp(5),
- Bptr: boolp(true),
- },
- expected: url.Values{"ptr": {"5"}, "bptr": {"true"}},
- },
- {
- input: &baz{
- Bptr: boolp(true),
- },
- expected: url.Values{"ptr": {""}, "bptr": {"true"}},
- },
- {
- input: &baz{
- Ptr: intp(5),
- },
- expected: url.Values{"ptr": {"5"}},
- },
- {
- input: &childStructs{
- Container: "mycontainer",
- Follow: true,
- Previous: true,
- SinceSeconds: &sinceSeconds,
- TailLines: nil,
- SinceTime: &sinceTime, // test a custom marshaller
- EmptyTime: nil, // test a nil custom marshaller without omitempty
- NonPointerTime: sinceTime,
- },
- expected: url.Values{"container": {"mycontainer"}, "follow": {"true"}, "previous": {"true"}, "sinceSeconds": {"123"}, "sinceTime": {"2000-01-01T12:34:56Z"}, "emptyTime": {""}, "nonPointerTime": {"2000-01-01T12:34:56Z"}},
- },
- {
- input: &childStructs{
- Container: "mycontainer",
- Follow: true,
- Previous: true,
- SinceSeconds: &sinceSeconds,
- TailLines: &tailLines,
- SinceTime: nil, // test a nil custom marshaller with omitempty
- NonPointerTime: sinceTime,
- },
- expected: url.Values{"container": {"mycontainer"}, "follow": {"true"}, "previous": {"true"}, "sinceSeconds": {"123"}, "tailLines": {"0"}, "emptyTime": {""}, "nonPointerTime": {"2000-01-01T12:34:56Z"}},
- },
- }
-
- for _, test := range tests {
- result, err := queryparams.Convert(test.input)
- if err != nil {
- t.Errorf("Unexpected error while converting %#v: %v", test.input, err)
- }
- validateResult(t, test.input, result, test.expected)
- }
-}
-
-func intp(n int) *int { return &n }
-
-func boolp(b bool) *bool { return &b }
diff --git a/vendor/k8s.io/apimachinery/pkg/fields/fields_test.go b/vendor/k8s.io/apimachinery/pkg/fields/fields_test.go
deleted file mode 100644
index 6965be687..000000000
--- a/vendor/k8s.io/apimachinery/pkg/fields/fields_test.go
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-Copyright 2015 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package fields
-
-import (
- "testing"
-)
-
-func matches(t *testing.T, ls Set, want string) {
- if ls.String() != want {
- t.Errorf("Expected '%s', but got '%s'", want, ls.String())
- }
-}
-
-func TestSetString(t *testing.T) {
- matches(t, Set{"x": "y"}, "x=y")
- matches(t, Set{"foo": "bar"}, "foo=bar")
- matches(t, Set{"foo": "bar", "baz": "qup"}, "baz=qup,foo=bar")
-}
-
-func TestFieldHas(t *testing.T) {
- fieldHasTests := []struct {
- Ls Fields
- Key string
- Has bool
- }{
- {Set{"x": "y"}, "x", true},
- {Set{"x": ""}, "x", true},
- {Set{"x": "y"}, "foo", false},
- }
- for _, lh := range fieldHasTests {
- if has := lh.Ls.Has(lh.Key); has != lh.Has {
- t.Errorf("%#v.Has(%#v) => %v, expected %v", lh.Ls, lh.Key, has, lh.Has)
- }
- }
-}
-
-func TestFieldGet(t *testing.T) {
- ls := Set{"x": "y"}
- if ls.Get("x") != "y" {
- t.Errorf("Set.Get is broken")
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/fields/selector_test.go b/vendor/k8s.io/apimachinery/pkg/fields/selector_test.go
deleted file mode 100644
index 0aa66935c..000000000
--- a/vendor/k8s.io/apimachinery/pkg/fields/selector_test.go
+++ /dev/null
@@ -1,397 +0,0 @@
-/*
-Copyright 2015 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package fields
-
-import (
- "reflect"
- "testing"
-)
-
-func TestSplitTerms(t *testing.T) {
- testcases := map[string][]string{
- // Simple selectors
- `a`: {`a`},
- `a=avalue`: {`a=avalue`},
- `a=avalue,b=bvalue`: {`a=avalue`, `b=bvalue`},
- `a=avalue,b==bvalue,c!=cvalue`: {`a=avalue`, `b==bvalue`, `c!=cvalue`},
-
- // Empty terms
- ``: nil,
- `a=a,`: {`a=a`, ``},
- `,a=a`: {``, `a=a`},
-
- // Escaped values
- `k=\,,k2=v2`: {`k=\,`, `k2=v2`}, // escaped comma in value
- `k=\\,k2=v2`: {`k=\\`, `k2=v2`}, // escaped backslash, unescaped comma
- `k=\\\,,k2=v2`: {`k=\\\,`, `k2=v2`}, // escaped backslash and comma
- `k=\a\b\`: {`k=\a\b\`}, // non-escape sequences
- `k=\`: {`k=\`}, // orphan backslash
-
- // Multi-byte
- `함=수,목=록`: {`함=수`, `목=록`},
- }
-
- for selector, expectedTerms := range testcases {
- if terms := splitTerms(selector); !reflect.DeepEqual(terms, expectedTerms) {
- t.Errorf("splitSelectors(`%s`): Expected\n%#v\ngot\n%#v", selector, expectedTerms, terms)
- }
- }
-}
-
-func TestSplitTerm(t *testing.T) {
- testcases := map[string]struct {
- lhs string
- op string
- rhs string
- ok bool
- }{
- // Simple terms
- `a=value`: {lhs: `a`, op: `=`, rhs: `value`, ok: true},
- `b==value`: {lhs: `b`, op: `==`, rhs: `value`, ok: true},
- `c!=value`: {lhs: `c`, op: `!=`, rhs: `value`, ok: true},
-
- // Empty or invalid terms
- ``: {lhs: ``, op: ``, rhs: ``, ok: false},
- `a`: {lhs: ``, op: ``, rhs: ``, ok: false},
-
- // Escaped values
- `k=\,`: {lhs: `k`, op: `=`, rhs: `\,`, ok: true},
- `k=\=`: {lhs: `k`, op: `=`, rhs: `\=`, ok: true},
- `k=\\\a\b\=\,\`: {lhs: `k`, op: `=`, rhs: `\\\a\b\=\,\`, ok: true},
-
- // Multi-byte
- `함=수`: {lhs: `함`, op: `=`, rhs: `수`, ok: true},
- }
-
- for term, expected := range testcases {
- lhs, op, rhs, ok := splitTerm(term)
- if lhs != expected.lhs || op != expected.op || rhs != expected.rhs || ok != expected.ok {
- t.Errorf(
- "splitTerm(`%s`): Expected\n%s,%s,%s,%v\nGot\n%s,%s,%s,%v",
- term,
- expected.lhs, expected.op, expected.rhs, expected.ok,
- lhs, op, rhs, ok,
- )
- }
- }
-}
-
-func TestEscapeValue(t *testing.T) {
- // map values to their normalized escaped values
- testcases := map[string]string{
- ``: ``,
- `a`: `a`,
- `=`: `\=`,
- `,`: `\,`,
- `\`: `\\`,
- `\=\,\`: `\\\=\\\,\\`,
- }
-
- for unescapedValue, escapedValue := range testcases {
- actualEscaped := EscapeValue(unescapedValue)
- if actualEscaped != escapedValue {
- t.Errorf("EscapeValue(%s): expected %s, got %s", unescapedValue, escapedValue, actualEscaped)
- }
-
- actualUnescaped, err := UnescapeValue(escapedValue)
- if err != nil {
- t.Errorf("UnescapeValue(%s): unexpected error %v", escapedValue, err)
- }
- if actualUnescaped != unescapedValue {
- t.Errorf("UnescapeValue(%s): expected %s, got %s", escapedValue, unescapedValue, actualUnescaped)
- }
- }
-
- // test invalid escape sequences
- invalidTestcases := []string{
- `\`, // orphan slash is invalid
- `\\\`, // orphan slash is invalid
- `\a`, // unrecognized escape sequence is invalid
- }
- for _, invalidValue := range invalidTestcases {
- _, err := UnescapeValue(invalidValue)
- if _, ok := err.(InvalidEscapeSequence); !ok || err == nil {
- t.Errorf("UnescapeValue(%s): expected invalid escape sequence error, got %#v", invalidValue, err)
- }
- }
-}
-
-func TestSelectorParse(t *testing.T) {
- testGoodStrings := []string{
- "x=a,y=b,z=c",
- "",
- "x!=a,y=b",
- `x=a||y\=b`,
- `x=a\=\=b`,
- }
- testBadStrings := []string{
- "x=a||y=b",
- "x==a==b",
- "x=a,b",
- "x in (a)",
- "x in (a,b,c)",
- "x",
- }
- for _, test := range testGoodStrings {
- lq, err := ParseSelector(test)
- if err != nil {
- t.Errorf("%v: error %v (%#v)\n", test, err, err)
- }
- if test != lq.String() {
- t.Errorf("%v restring gave: %v\n", test, lq.String())
- }
- }
- for _, test := range testBadStrings {
- _, err := ParseSelector(test)
- if err == nil {
- t.Errorf("%v: did not get expected error\n", test)
- }
- }
-}
-
-func TestDeterministicParse(t *testing.T) {
- s1, err := ParseSelector("x=a,a=x")
- s2, err2 := ParseSelector("a=x,x=a")
- if err != nil || err2 != nil {
- t.Errorf("Unexpected parse error")
- }
- if s1.String() != s2.String() {
- t.Errorf("Non-deterministic parse")
- }
-}
-
-func expectMatch(t *testing.T, selector string, ls Set) {
- lq, err := ParseSelector(selector)
- if err != nil {
- t.Errorf("Unable to parse %v as a selector\n", selector)
- return
- }
- if !lq.Matches(ls) {
- t.Errorf("Wanted %s to match '%s', but it did not.\n", selector, ls)
- }
-}
-
-func expectNoMatch(t *testing.T, selector string, ls Set) {
- lq, err := ParseSelector(selector)
- if err != nil {
- t.Errorf("Unable to parse %v as a selector\n", selector)
- return
- }
- if lq.Matches(ls) {
- t.Errorf("Wanted '%s' to not match '%s', but it did.", selector, ls)
- }
-}
-
-func TestEverything(t *testing.T) {
- if !Everything().Matches(Set{"x": "y"}) {
- t.Errorf("Nil selector didn't match")
- }
- if !Everything().Empty() {
- t.Errorf("Everything was not empty")
- }
-}
-
-func TestSelectorMatches(t *testing.T) {
- expectMatch(t, "", Set{"x": "y"})
- expectMatch(t, "x=y", Set{"x": "y"})
- expectMatch(t, "x=y,z=w", Set{"x": "y", "z": "w"})
- expectMatch(t, "x!=y,z!=w", Set{"x": "z", "z": "a"})
- expectMatch(t, "notin=in", Set{"notin": "in"}) // in and notin in exactMatch
- expectNoMatch(t, "x=y", Set{"x": "z"})
- expectNoMatch(t, "x=y,z=w", Set{"x": "w", "z": "w"})
- expectNoMatch(t, "x!=y,z!=w", Set{"x": "z", "z": "w"})
-
- fieldset := Set{
- "foo": "bar",
- "baz": "blah",
- "complex": `=value\,\`,
- }
- expectMatch(t, "foo=bar", fieldset)
- expectMatch(t, "baz=blah", fieldset)
- expectMatch(t, "foo=bar,baz=blah", fieldset)
- expectMatch(t, `foo=bar,baz=blah,complex=\=value\\\,\\`, fieldset)
- expectNoMatch(t, "foo=blah", fieldset)
- expectNoMatch(t, "baz=bar", fieldset)
- expectNoMatch(t, "foo=bar,foobar=bar,baz=blah", fieldset)
-}
-
-func TestOneTermEqualSelector(t *testing.T) {
- if !OneTermEqualSelector("x", "y").Matches(Set{"x": "y"}) {
- t.Errorf("No match when match expected.")
- }
- if OneTermEqualSelector("x", "y").Matches(Set{"x": "z"}) {
- t.Errorf("Match when none expected.")
- }
-}
-
-func expectMatchDirect(t *testing.T, selector, ls Set) {
- if !SelectorFromSet(selector).Matches(ls) {
- t.Errorf("Wanted %s to match '%s', but it did not.\n", selector, ls)
- }
-}
-
-func expectNoMatchDirect(t *testing.T, selector, ls Set) {
- if SelectorFromSet(selector).Matches(ls) {
- t.Errorf("Wanted '%s' to not match '%s', but it did.", selector, ls)
- }
-}
-
-func TestSetMatches(t *testing.T) {
- labelset := Set{
- "foo": "bar",
- "baz": "blah",
- }
- expectMatchDirect(t, Set{}, labelset)
- expectMatchDirect(t, Set{"foo": "bar"}, labelset)
- expectMatchDirect(t, Set{"baz": "blah"}, labelset)
- expectMatchDirect(t, Set{"foo": "bar", "baz": "blah"}, labelset)
- expectNoMatchDirect(t, Set{"foo": "=blah"}, labelset)
- expectNoMatchDirect(t, Set{"baz": "=bar"}, labelset)
- expectNoMatchDirect(t, Set{"foo": "=bar", "foobar": "bar", "baz": "blah"}, labelset)
-}
-
-func TestNilMapIsValid(t *testing.T) {
- selector := Set(nil).AsSelector()
- if selector == nil {
- t.Errorf("Selector for nil set should be Everything")
- }
- if !selector.Empty() {
- t.Errorf("Selector for nil set should be Empty")
- }
-}
-
-func TestSetIsEmpty(t *testing.T) {
- if !(Set{}).AsSelector().Empty() {
- t.Errorf("Empty set should be empty")
- }
- if !(andTerm(nil)).Empty() {
- t.Errorf("Nil andTerm should be empty")
- }
- if (&hasTerm{}).Empty() {
- t.Errorf("hasTerm should not be empty")
- }
- if (&notHasTerm{}).Empty() {
- t.Errorf("notHasTerm should not be empty")
- }
- if !(andTerm{andTerm{}}).Empty() {
- t.Errorf("Nested andTerm should be empty")
- }
- if (andTerm{&hasTerm{"a", "b"}}).Empty() {
- t.Errorf("Nested andTerm should not be empty")
- }
-}
-
-func TestRequiresExactMatch(t *testing.T) {
- testCases := map[string]struct {
- S Selector
- Label string
- Value string
- Found bool
- }{
- "empty set": {Set{}.AsSelector(), "test", "", false},
- "empty hasTerm": {&hasTerm{}, "test", "", false},
- "skipped hasTerm": {&hasTerm{"a", "b"}, "test", "", false},
- "valid hasTerm": {&hasTerm{"test", "b"}, "test", "b", true},
- "valid hasTerm no value": {&hasTerm{"test", ""}, "test", "", true},
- "valid notHasTerm": {&notHasTerm{"test", "b"}, "test", "", false},
- "valid notHasTerm no value": {&notHasTerm{"test", ""}, "test", "", false},
- "nil andTerm": {andTerm(nil), "test", "", false},
- "empty andTerm": {andTerm{}, "test", "", false},
- "nested andTerm": {andTerm{andTerm{}}, "test", "", false},
- "nested andTerm matches": {andTerm{&hasTerm{"test", "b"}}, "test", "b", true},
- "andTerm with non-match": {andTerm{&hasTerm{}, &hasTerm{"test", "b"}}, "test", "b", true},
- }
- for k, v := range testCases {
- value, found := v.S.RequiresExactMatch(v.Label)
- if value != v.Value {
- t.Errorf("%s: expected value %s, got %s", k, v.Value, value)
- }
- if found != v.Found {
- t.Errorf("%s: expected found %t, got %t", k, v.Found, found)
- }
- }
-}
-
-func TestTransform(t *testing.T) {
- testCases := []struct {
- name string
- selector string
- transform func(field, value string) (string, string, error)
- result string
- isEmpty bool
- }{
- {
- name: "empty selector",
- selector: "",
- transform: func(field, value string) (string, string, error) { return field, value, nil },
- result: "",
- isEmpty: true,
- },
- {
- name: "no-op transform",
- selector: "a=b,c=d",
- transform: func(field, value string) (string, string, error) { return field, value, nil },
- result: "a=b,c=d",
- isEmpty: false,
- },
- {
- name: "transform one field",
- selector: "a=b,c=d",
- transform: func(field, value string) (string, string, error) {
- if field == "a" {
- return "e", "f", nil
- }
- return field, value, nil
- },
- result: "e=f,c=d",
- isEmpty: false,
- },
- {
- name: "remove field to make empty",
- selector: "a=b",
- transform: func(field, value string) (string, string, error) { return "", "", nil },
- result: "",
- isEmpty: true,
- },
- {
- name: "remove only one field",
- selector: "a=b,c=d,e=f",
- transform: func(field, value string) (string, string, error) {
- if field == "c" {
- return "", "", nil
- }
- return field, value, nil
- },
- result: "a=b,e=f",
- isEmpty: false,
- },
- }
-
- for i, tc := range testCases {
- result, err := ParseAndTransformSelector(tc.selector, tc.transform)
- if err != nil {
- t.Errorf("[%d] unexpected error during Transform: %v", i, err)
- }
- if result.Empty() != tc.isEmpty {
- t.Errorf("[%d] expected empty: %t, got: %t", i, tc.isEmpty, result.Empty())
- }
- if result.String() != tc.result {
- t.Errorf("[%d] unexpected result: %s", i, result.String())
- }
- }
-
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/labels/labels_test.go b/vendor/k8s.io/apimachinery/pkg/labels/labels_test.go
deleted file mode 100644
index 2d4d761bc..000000000
--- a/vendor/k8s.io/apimachinery/pkg/labels/labels_test.go
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package labels
-
-import (
- "testing"
-)
-
-func matches(t *testing.T, ls Set, want string) {
- if ls.String() != want {
- t.Errorf("Expected '%s', but got '%s'", want, ls.String())
- }
-}
-
-func TestSetString(t *testing.T) {
- matches(t, Set{"x": "y"}, "x=y")
- matches(t, Set{"foo": "bar"}, "foo=bar")
- matches(t, Set{"foo": "bar", "baz": "qup"}, "baz=qup,foo=bar")
-
- // TODO: Make our label representation robust enough to handle labels
- // with ",=!" characters in their names.
-}
-
-func TestLabelHas(t *testing.T) {
- labelHasTests := []struct {
- Ls Labels
- Key string
- Has bool
- }{
- {Set{"x": "y"}, "x", true},
- {Set{"x": ""}, "x", true},
- {Set{"x": "y"}, "foo", false},
- }
- for _, lh := range labelHasTests {
- if has := lh.Ls.Has(lh.Key); has != lh.Has {
- t.Errorf("%#v.Has(%#v) => %v, expected %v", lh.Ls, lh.Key, has, lh.Has)
- }
- }
-}
-
-func TestLabelGet(t *testing.T) {
- ls := Set{"x": "y"}
- if ls.Get("x") != "y" {
- t.Errorf("Set.Get is broken")
- }
-}
-
-func TestLabelConflict(t *testing.T) {
- tests := []struct {
- labels1 map[string]string
- labels2 map[string]string
- conflict bool
- }{
- {
- labels1: map[string]string{},
- labels2: map[string]string{},
- conflict: false,
- },
- {
- labels1: map[string]string{"env": "test"},
- labels2: map[string]string{"infra": "true"},
- conflict: false,
- },
- {
- labels1: map[string]string{"env": "test"},
- labels2: map[string]string{"infra": "true", "env": "test"},
- conflict: false,
- },
- {
- labels1: map[string]string{"env": "test"},
- labels2: map[string]string{"env": "dev"},
- conflict: true,
- },
- {
- labels1: map[string]string{"env": "test", "infra": "false"},
- labels2: map[string]string{"infra": "true", "color": "blue"},
- conflict: true,
- },
- }
- for _, test := range tests {
- conflict := Conflicts(Set(test.labels1), Set(test.labels2))
- if conflict != test.conflict {
- t.Errorf("expected: %v but got: %v", test.conflict, conflict)
- }
- }
-}
-
-func TestLabelMerge(t *testing.T) {
- tests := []struct {
- labels1 map[string]string
- labels2 map[string]string
- mergedLabels map[string]string
- }{
- {
- labels1: map[string]string{},
- labels2: map[string]string{},
- mergedLabels: map[string]string{},
- },
- {
- labels1: map[string]string{"infra": "true"},
- labels2: map[string]string{},
- mergedLabels: map[string]string{"infra": "true"},
- },
- {
- labels1: map[string]string{"infra": "true"},
- labels2: map[string]string{"env": "test", "color": "blue"},
- mergedLabels: map[string]string{"infra": "true", "env": "test", "color": "blue"},
- },
- }
- for _, test := range tests {
- mergedLabels := Merge(Set(test.labels1), Set(test.labels2))
- if !Equals(mergedLabels, test.mergedLabels) {
- t.Errorf("expected: %v but got: %v", test.mergedLabels, mergedLabels)
- }
- }
-}
-
-func TestLabelSelectorParse(t *testing.T) {
- tests := []struct {
- selector string
- labels map[string]string
- valid bool
- }{
- {
- selector: "",
- labels: map[string]string{},
- valid: true,
- },
- {
- selector: "x=a",
- labels: map[string]string{"x": "a"},
- valid: true,
- },
- {
- selector: "x=a,y=b,z=c",
- labels: map[string]string{"x": "a", "y": "b", "z": "c"},
- valid: true,
- },
- {
- selector: " x = a , y = b , z = c ",
- labels: map[string]string{"x": "a", "y": "b", "z": "c"},
- valid: true,
- },
- {
- selector: "color=green,env=test,service=front",
- labels: map[string]string{"color": "green", "env": "test", "service": "front"},
- valid: true,
- },
- {
- selector: "color=green, env=test, service=front",
- labels: map[string]string{"color": "green", "env": "test", "service": "front"},
- valid: true,
- },
- {
- selector: ",",
- labels: map[string]string{},
- valid: false,
- },
- {
- selector: "x",
- labels: map[string]string{},
- valid: false,
- },
- {
- selector: "x,y",
- labels: map[string]string{},
- valid: false,
- },
- {
- selector: "x=$y",
- labels: map[string]string{},
- valid: false,
- },
- {
- selector: "x!=y",
- labels: map[string]string{},
- valid: false,
- },
- {
- selector: "x==y",
- labels: map[string]string{},
- valid: false,
- },
- {
- selector: "x=a||y=b",
- labels: map[string]string{},
- valid: false,
- },
- {
- selector: "x in (y)",
- labels: map[string]string{},
- valid: false,
- },
- {
- selector: "x notin (y)",
- labels: map[string]string{},
- valid: false,
- },
- {
- selector: "x y",
- labels: map[string]string{},
- valid: false,
- },
- }
- for _, test := range tests {
- labels, err := ConvertSelectorToLabelsMap(test.selector)
- if test.valid && err != nil {
- t.Errorf("selector: %s, expected no error but got: %s", test.selector, err)
- } else if !test.valid && err == nil {
- t.Errorf("selector: %s, expected an error", test.selector)
- }
-
- if !Equals(Set(labels), test.labels) {
- t.Errorf("expected: %s but got: %s", test.labels, labels)
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/labels/selector_test.go b/vendor/k8s.io/apimachinery/pkg/labels/selector_test.go
deleted file mode 100644
index 995317bd1..000000000
--- a/vendor/k8s.io/apimachinery/pkg/labels/selector_test.go
+++ /dev/null
@@ -1,575 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package labels
-
-import (
- "reflect"
- "strings"
- "testing"
-
- "k8s.io/apimachinery/pkg/selection"
- "k8s.io/apimachinery/pkg/util/sets"
-)
-
-func TestSelectorParse(t *testing.T) {
- testGoodStrings := []string{
- "x=a,y=b,z=c",
- "",
- "x!=a,y=b",
- "x=",
- "x= ",
- "x=,z= ",
- "x= ,z= ",
- "!x",
- "x>1",
- "x>1,z<5",
- }
- testBadStrings := []string{
- "x=a||y=b",
- "x==a==b",
- "!x=a",
- "x<a",
- }
- for _, test := range testGoodStrings {
- lq, err := Parse(test)
- if err != nil {
- t.Errorf("%v: error %v (%#v)\n", test, err, err)
- }
- if strings.Replace(test, " ", "", -1) != lq.String() {
- t.Errorf("%v restring gave: %v\n", test, lq.String())
- }
- }
- for _, test := range testBadStrings {
- _, err := Parse(test)
- if err == nil {
- t.Errorf("%v: did not get expected error\n", test)
- }
- }
-}
-
-func TestDeterministicParse(t *testing.T) {
- s1, err := Parse("x=a,a=x")
- s2, err2 := Parse("a=x,x=a")
- if err != nil || err2 != nil {
- t.Errorf("Unexpected parse error")
- }
- if s1.String() != s2.String() {
- t.Errorf("Non-deterministic parse")
- }
-}
-
-func expectMatch(t *testing.T, selector string, ls Set) {
- lq, err := Parse(selector)
- if err != nil {
- t.Errorf("Unable to parse %v as a selector\n", selector)
- return
- }
- if !lq.Matches(ls) {
- t.Errorf("Wanted %s to match '%s', but it did not.\n", selector, ls)
- }
-}
-
-func expectNoMatch(t *testing.T, selector string, ls Set) {
- lq, err := Parse(selector)
- if err != nil {
- t.Errorf("Unable to parse %v as a selector\n", selector)
- return
- }
- if lq.Matches(ls) {
- t.Errorf("Wanted '%s' to not match '%s', but it did.", selector, ls)
- }
-}
-
-func TestEverything(t *testing.T) {
- if !Everything().Matches(Set{"x": "y"}) {
- t.Errorf("Nil selector didn't match")
- }
- if !Everything().Empty() {
- t.Errorf("Everything was not empty")
- }
-}
-
-func TestSelectorMatches(t *testing.T) {
- expectMatch(t, "", Set{"x": "y"})
- expectMatch(t, "x=y", Set{"x": "y"})
- expectMatch(t, "x=y,z=w", Set{"x": "y", "z": "w"})
- expectMatch(t, "x!=y,z!=w", Set{"x": "z", "z": "a"})
- expectMatch(t, "notin=in", Set{"notin": "in"}) // in and notin in exactMatch
- expectMatch(t, "x", Set{"x": "z"})
- expectMatch(t, "!x", Set{"y": "z"})
- expectMatch(t, "x>1", Set{"x": "2"})
- expectMatch(t, "x<1", Set{"x": "0"})
- expectNoMatch(t, "x=z", Set{})
- expectNoMatch(t, "x=y", Set{"x": "z"})
- expectNoMatch(t, "x=y,z=w", Set{"x": "w", "z": "w"})
- expectNoMatch(t, "x!=y,z!=w", Set{"x": "z", "z": "w"})
- expectNoMatch(t, "x", Set{"y": "z"})
- expectNoMatch(t, "!x", Set{"x": "z"})
- expectNoMatch(t, "x>1", Set{"x": "0"})
- expectNoMatch(t, "x<1", Set{"x": "2"})
-
- labelset := Set{
- "foo": "bar",
- "baz": "blah",
- }
- expectMatch(t, "foo=bar", labelset)
- expectMatch(t, "baz=blah", labelset)
- expectMatch(t, "foo=bar,baz=blah", labelset)
- expectNoMatch(t, "foo=blah", labelset)
- expectNoMatch(t, "baz=bar", labelset)
- expectNoMatch(t, "foo=bar,foobar=bar,baz=blah", labelset)
-}
-
-func expectMatchDirect(t *testing.T, selector, ls Set) {
- if !SelectorFromSet(selector).Matches(ls) {
- t.Errorf("Wanted %s to match '%s', but it did not.\n", selector, ls)
- }
-}
-
-func expectNoMatchDirect(t *testing.T, selector, ls Set) {
- if SelectorFromSet(selector).Matches(ls) {
- t.Errorf("Wanted '%s' to not match '%s', but it did.", selector, ls)
- }
-}
-
-func TestSetMatches(t *testing.T) {
- labelset := Set{
- "foo": "bar",
- "baz": "blah",
- }
- expectMatchDirect(t, Set{}, labelset)
- expectMatchDirect(t, Set{"foo": "bar"}, labelset)
- expectMatchDirect(t, Set{"baz": "blah"}, labelset)
- expectMatchDirect(t, Set{"foo": "bar", "baz": "blah"}, labelset)
-
- //TODO: bad values not handled for the moment in SelectorFromSet
- //expectNoMatchDirect(t, Set{"foo": "=blah"}, labelset)
- //expectNoMatchDirect(t, Set{"baz": "=bar"}, labelset)
- //expectNoMatchDirect(t, Set{"foo": "=bar", "foobar": "bar", "baz": "blah"}, labelset)
-}
-
-func TestNilMapIsValid(t *testing.T) {
- selector := Set(nil).AsSelector()
- if selector == nil {
- t.Errorf("Selector for nil set should be Everything")
- }
- if !selector.Empty() {
- t.Errorf("Selector for nil set should be Empty")
- }
-}
-
-func TestSetIsEmpty(t *testing.T) {
- if !(Set{}).AsSelector().Empty() {
- t.Errorf("Empty set should be empty")
- }
- if !(NewSelector()).Empty() {
- t.Errorf("Nil Selector should be empty")
- }
-}
-
-func TestLexer(t *testing.T) {
- testcases := []struct {
- s string
- t Token
- }{
- {"", EndOfStringToken},
- {",", CommaToken},
- {"notin", NotInToken},
- {"in", InToken},
- {"=", EqualsToken},
- {"==", DoubleEqualsToken},
- {">", GreaterThanToken},
- {"<", LessThanToken},
- //Note that Lex returns the longest valid token found
- {"!", DoesNotExistToken},
- {"!=", NotEqualsToken},
- {"(", OpenParToken},
- {")", ClosedParToken},
- //Non-"special" characters are considered part of an identifier
- {"~", IdentifierToken},
- {"||", IdentifierToken},
- }
- for _, v := range testcases {
- l := &Lexer{s: v.s, pos: 0}
- token, lit := l.Lex()
- if token != v.t {
- t.Errorf("Got %d it should be %d for '%s'", token, v.t, v.s)
- }
- if v.t != ErrorToken && lit != v.s {
- t.Errorf("Got '%s' it should be '%s'", lit, v.s)
- }
- }
-}
-
-func min(l, r int) (m int) {
- m = r
- if l < r {
- m = l
- }
- return m
-}
-
-func TestLexerSequence(t *testing.T) {
- testcases := []struct {
- s string
- t []Token
- }{
- {"key in ( value )", []Token{IdentifierToken, InToken, OpenParToken, IdentifierToken, ClosedParToken}},
- {"key notin ( value )", []Token{IdentifierToken, NotInToken, OpenParToken, IdentifierToken, ClosedParToken}},
- {"key in ( value1, value2 )", []Token{IdentifierToken, InToken, OpenParToken, IdentifierToken, CommaToken, IdentifierToken, ClosedParToken}},
- {"key", []Token{IdentifierToken}},
- {"!key", []Token{DoesNotExistToken, IdentifierToken}},
- {"()", []Token{OpenParToken, ClosedParToken}},
- {"x in (),y", []Token{IdentifierToken, InToken, OpenParToken, ClosedParToken, CommaToken, IdentifierToken}},
- {"== != (), = notin", []Token{DoubleEqualsToken, NotEqualsToken, OpenParToken, ClosedParToken, CommaToken, EqualsToken, NotInToken}},
- {"key>2", []Token{IdentifierToken, GreaterThanToken, IdentifierToken}},
- {"key<1", []Token{IdentifierToken, LessThanToken, IdentifierToken}},
- }
- for _, v := range testcases {
- var literals []string
- var tokens []Token
- l := &Lexer{s: v.s, pos: 0}
- for {
- token, lit := l.Lex()
- if token == EndOfStringToken {
- break
- }
- tokens = append(tokens, token)
- literals = append(literals, lit)
- }
- if len(tokens) != len(v.t) {
- t.Errorf("Bad number of tokens for '%s %d, %d", v.s, len(tokens), len(v.t))
- }
- for i := 0; i < min(len(tokens), len(v.t)); i++ {
- if tokens[i] != v.t[i] {
- t.Errorf("Test '%s': Mismatching in token type found '%v' it should be '%v'", v.s, tokens[i], v.t[i])
- }
- }
- }
-}
-func TestParserLookahead(t *testing.T) {
- testcases := []struct {
- s string
- t []Token
- }{
- {"key in ( value )", []Token{IdentifierToken, InToken, OpenParToken, IdentifierToken, ClosedParToken, EndOfStringToken}},
- {"key notin ( value )", []Token{IdentifierToken, NotInToken, OpenParToken, IdentifierToken, ClosedParToken, EndOfStringToken}},
- {"key in ( value1, value2 )", []Token{IdentifierToken, InToken, OpenParToken, IdentifierToken, CommaToken, IdentifierToken, ClosedParToken, EndOfStringToken}},
- {"key", []Token{IdentifierToken, EndOfStringToken}},
- {"!key", []Token{DoesNotExistToken, IdentifierToken, EndOfStringToken}},
- {"()", []Token{OpenParToken, ClosedParToken, EndOfStringToken}},
- {"", []Token{EndOfStringToken}},
- {"x in (),y", []Token{IdentifierToken, InToken, OpenParToken, ClosedParToken, CommaToken, IdentifierToken, EndOfStringToken}},
- {"== != (), = notin", []Token{DoubleEqualsToken, NotEqualsToken, OpenParToken, ClosedParToken, CommaToken, EqualsToken, NotInToken, EndOfStringToken}},
- {"key>2", []Token{IdentifierToken, GreaterThanToken, IdentifierToken, EndOfStringToken}},
- {"key<1", []Token{IdentifierToken, LessThanToken, IdentifierToken, EndOfStringToken}},
- }
- for _, v := range testcases {
- p := &Parser{l: &Lexer{s: v.s, pos: 0}, position: 0}
- p.scan()
- if len(p.scannedItems) != len(v.t) {
- t.Errorf("Expected %d items found %d", len(v.t), len(p.scannedItems))
- }
- for {
- token, lit := p.lookahead(KeyAndOperator)
-
- token2, lit2 := p.consume(KeyAndOperator)
- if token == EndOfStringToken {
- break
- }
- if token != token2 || lit != lit2 {
- t.Errorf("Bad values")
- }
- }
- }
-}
-
-func TestRequirementConstructor(t *testing.T) {
- requirementConstructorTests := []struct {
- Key string
- Op selection.Operator
- Vals sets.String
- Success bool
- }{
- {"x", selection.In, nil, false},
- {"x", selection.NotIn, sets.NewString(), false},
- {"x", selection.In, sets.NewString("foo"), true},
- {"x", selection.NotIn, sets.NewString("foo"), true},
- {"x", selection.Exists, nil, true},
- {"x", selection.DoesNotExist, nil, true},
- {"1foo", selection.In, sets.NewString("bar"), true},
- {"1234", selection.In, sets.NewString("bar"), true},
- {"y", selection.GreaterThan, sets.NewString("1"), true},
- {"z", selection.LessThan, sets.NewString("6"), true},
- {"foo", selection.GreaterThan, sets.NewString("bar"), false},
- {"barz", selection.LessThan, sets.NewString("blah"), false},
- {strings.Repeat("a", 254), selection.Exists, nil, false}, //breaks DNS rule that len(key) <= 253
- }
- for _, rc := range requirementConstructorTests {
- if _, err := NewRequirement(rc.Key, rc.Op, rc.Vals.List()); err == nil && !rc.Success {
- t.Errorf("expected error with key:%#v op:%v vals:%v, got no error", rc.Key, rc.Op, rc.Vals)
- } else if err != nil && rc.Success {
- t.Errorf("expected no error with key:%#v op:%v vals:%v, got:%v", rc.Key, rc.Op, rc.Vals, err)
- }
- }
-}
-
-func TestToString(t *testing.T) {
- var req Requirement
- toStringTests := []struct {
- In *internalSelector
- Out string
- Valid bool
- }{
-
- {&internalSelector{
- getRequirement("x", selection.In, sets.NewString("abc", "def"), t),
- getRequirement("y", selection.NotIn, sets.NewString("jkl"), t),
- getRequirement("z", selection.Exists, nil, t)},
- "x in (abc,def),y notin (jkl),z", true},
- {&internalSelector{
- getRequirement("x", selection.NotIn, sets.NewString("abc", "def"), t),
- getRequirement("y", selection.NotEquals, sets.NewString("jkl"), t),
- getRequirement("z", selection.DoesNotExist, nil, t)},
- "x notin (abc,def),y!=jkl,!z", true},
- {&internalSelector{
- getRequirement("x", selection.In, sets.NewString("abc", "def"), t),
- req}, // adding empty req for the trailing ','
- "x in (abc,def),", false},
- {&internalSelector{
- getRequirement("x", selection.NotIn, sets.NewString("abc"), t),
- getRequirement("y", selection.In, sets.NewString("jkl", "mno"), t),
- getRequirement("z", selection.NotIn, sets.NewString(""), t)},
- "x notin (abc),y in (jkl,mno),z notin ()", true},
- {&internalSelector{
- getRequirement("x", selection.Equals, sets.NewString("abc"), t),
- getRequirement("y", selection.DoubleEquals, sets.NewString("jkl"), t),
- getRequirement("z", selection.NotEquals, sets.NewString("a"), t),
- getRequirement("z", selection.Exists, nil, t)},
- "x=abc,y==jkl,z!=a,z", true},
- {&internalSelector{
- getRequirement("x", selection.GreaterThan, sets.NewString("2"), t),
- getRequirement("y", selection.LessThan, sets.NewString("8"), t),
- getRequirement("z", selection.Exists, nil, t)},
- "x>2,y<8,z", true},
- }
- for _, ts := range toStringTests {
- if out := ts.In.String(); out == "" && ts.Valid {
- t.Errorf("%#v.String() => '%v' expected no error", ts.In, out)
- } else if out != ts.Out {
- t.Errorf("%#v.String() => '%v' want '%v'", ts.In, out, ts.Out)
- }
- }
-}
-
-func TestRequirementSelectorMatching(t *testing.T) {
- var req Requirement
- labelSelectorMatchingTests := []struct {
- Set Set
- Sel Selector
- Match bool
- }{
- {Set{"x": "foo", "y": "baz"}, &internalSelector{
- req,
- }, false},
- {Set{"x": "foo", "y": "baz"}, &internalSelector{
- getRequirement("x", selection.In, sets.NewString("foo"), t),
- getRequirement("y", selection.NotIn, sets.NewString("alpha"), t),
- }, true},
- {Set{"x": "foo", "y": "baz"}, &internalSelector{
- getRequirement("x", selection.In, sets.NewString("foo"), t),
- getRequirement("y", selection.In, sets.NewString("alpha"), t),
- }, false},
- {Set{"y": ""}, &internalSelector{
- getRequirement("x", selection.NotIn, sets.NewString(""), t),
- getRequirement("y", selection.Exists, nil, t),
- }, true},
- {Set{"y": ""}, &internalSelector{
- getRequirement("x", selection.DoesNotExist, nil, t),
- getRequirement("y", selection.Exists, nil, t),
- }, true},
- {Set{"y": ""}, &internalSelector{
- getRequirement("x", selection.NotIn, sets.NewString(""), t),
- getRequirement("y", selection.DoesNotExist, nil, t),
- }, false},
- {Set{"y": "baz"}, &internalSelector{
- getRequirement("x", selection.In, sets.NewString(""), t),
- }, false},
- {Set{"z": "2"}, &internalSelector{
- getRequirement("z", selection.GreaterThan, sets.NewString("1"), t),
- }, true},
- {Set{"z": "v2"}, &internalSelector{
- getRequirement("z", selection.GreaterThan, sets.NewString("1"), t),
- }, false},
- }
- for _, lsm := range labelSelectorMatchingTests {
- if match := lsm.Sel.Matches(lsm.Set); match != lsm.Match {
- t.Errorf("%+v.Matches(%#v) => %v, want %v", lsm.Sel, lsm.Set, match, lsm.Match)
- }
- }
-}
-
-func TestSetSelectorParser(t *testing.T) {
- setSelectorParserTests := []struct {
- In string
- Out Selector
- Match bool
- Valid bool
- }{
- {"", NewSelector(), true, true},
- {"\rx", internalSelector{
- getRequirement("x", selection.Exists, nil, t),
- }, true, true},
- {"this-is-a-dns.domain.com/key-with-dash", internalSelector{
- getRequirement("this-is-a-dns.domain.com/key-with-dash", selection.Exists, nil, t),
- }, true, true},
- {"this-is-another-dns.domain.com/key-with-dash in (so,what)", internalSelector{
- getRequirement("this-is-another-dns.domain.com/key-with-dash", selection.In, sets.NewString("so", "what"), t),
- }, true, true},
- {"0.1.2.domain/99 notin (10.10.100.1, tick.tack.clock)", internalSelector{
- getRequirement("0.1.2.domain/99", selection.NotIn, sets.NewString("10.10.100.1", "tick.tack.clock"), t),
- }, true, true},
- {"foo in (abc)", internalSelector{
- getRequirement("foo", selection.In, sets.NewString("abc"), t),
- }, true, true},
- {"x notin\n (abc)", internalSelector{
- getRequirement("x", selection.NotIn, sets.NewString("abc"), t),
- }, true, true},
- {"x notin \t (abc,def)", internalSelector{
- getRequirement("x", selection.NotIn, sets.NewString("abc", "def"), t),
- }, true, true},
- {"x in (abc,def)", internalSelector{
- getRequirement("x", selection.In, sets.NewString("abc", "def"), t),
- }, true, true},
- {"x in (abc,)", internalSelector{
- getRequirement("x", selection.In, sets.NewString("abc", ""), t),
- }, true, true},
- {"x in ()", internalSelector{
- getRequirement("x", selection.In, sets.NewString(""), t),
- }, true, true},
- {"x notin (abc,,def),bar,z in (),w", internalSelector{
- getRequirement("bar", selection.Exists, nil, t),
- getRequirement("w", selection.Exists, nil, t),
- getRequirement("x", selection.NotIn, sets.NewString("abc", "", "def"), t),
- getRequirement("z", selection.In, sets.NewString(""), t),
- }, true, true},
- {"x,y in (a)", internalSelector{
- getRequirement("y", selection.In, sets.NewString("a"), t),
- getRequirement("x", selection.Exists, nil, t),
- }, false, true},
- {"x=a", internalSelector{
- getRequirement("x", selection.Equals, sets.NewString("a"), t),
- }, true, true},
- {"x>1", internalSelector{
- getRequirement("x", selection.GreaterThan, sets.NewString("1"), t),
- }, true, true},
- {"x<7", internalSelector{
- getRequirement("x", selection.LessThan, sets.NewString("7"), t),
- }, true, true},
- {"x=a,y!=b", internalSelector{
- getRequirement("x", selection.Equals, sets.NewString("a"), t),
- getRequirement("y", selection.NotEquals, sets.NewString("b"), t),
- }, true, true},
- {"x=a,y!=b,z in (h,i,j)", internalSelector{
- getRequirement("x", selection.Equals, sets.NewString("a"), t),
- getRequirement("y", selection.NotEquals, sets.NewString("b"), t),
- getRequirement("z", selection.In, sets.NewString("h", "i", "j"), t),
- }, true, true},
- {"x=a||y=b", internalSelector{}, false, false},
- {"x,,y", nil, true, false},
- {",x,y", nil, true, false},
- {"x nott in (y)", nil, true, false},
- {"x notin ( )", internalSelector{
- getRequirement("x", selection.NotIn, sets.NewString(""), t),
- }, true, true},
- {"x notin (, a)", internalSelector{
- getRequirement("x", selection.NotIn, sets.NewString("", "a"), t),
- }, true, true},
- {"a in (xyz),", nil, true, false},
- {"a in (xyz)b notin ()", nil, true, false},
- {"a ", internalSelector{
- getRequirement("a", selection.Exists, nil, t),
- }, true, true},
- {"a in (x,y,notin, z,in)", internalSelector{
- getRequirement("a", selection.In, sets.NewString("in", "notin", "x", "y", "z"), t),
- }, true, true}, // operator 'in' inside list of identifiers
- {"a in (xyz abc)", nil, false, false}, // no comma
- {"a notin(", nil, true, false}, // bad formed
- {"a (", nil, false, false}, // cpar
- {"(", nil, false, false}, // opar
- }
-
- for _, ssp := range setSelectorParserTests {
- if sel, err := Parse(ssp.In); err != nil && ssp.Valid {
- t.Errorf("Parse(%s) => %v expected no error", ssp.In, err)
- } else if err == nil && !ssp.Valid {
- t.Errorf("Parse(%s) => %+v expected error", ssp.In, sel)
- } else if ssp.Match && !reflect.DeepEqual(sel, ssp.Out) {
- t.Errorf("Parse(%s) => parse output '%#v' doesn't match '%#v' expected match", ssp.In, sel, ssp.Out)
- }
- }
-}
-
-func getRequirement(key string, op selection.Operator, vals sets.String, t *testing.T) Requirement {
- req, err := NewRequirement(key, op, vals.List())
- if err != nil {
- t.Errorf("NewRequirement(%v, %v, %v) resulted in error:%v", key, op, vals, err)
- return Requirement{}
- }
- return *req
-}
-
-func TestAdd(t *testing.T) {
- testCases := []struct {
- name string
- sel Selector
- key string
- operator selection.Operator
- values []string
- refSelector Selector
- }{
- {
- "keyInOperator",
- internalSelector{},
- "key",
- selection.In,
- []string{"value"},
- internalSelector{Requirement{"key", selection.In, []string{"value"}}},
- },
- {
- "keyEqualsOperator",
- internalSelector{Requirement{"key", selection.In, []string{"value"}}},
- "key2",
- selection.Equals,
- []string{"value2"},
- internalSelector{
- Requirement{"key", selection.In, []string{"value"}},
- Requirement{"key2", selection.Equals, []string{"value2"}},
- },
- },
- }
- for _, ts := range testCases {
- req, err := NewRequirement(ts.key, ts.operator, ts.values)
- if err != nil {
- t.Errorf("%s - Unable to create labels.Requirement", ts.name)
- }
- ts.sel = ts.sel.Add(*req)
- if !reflect.DeepEqual(ts.sel, ts.refSelector) {
- t.Errorf("%s - Expected %v found %v", ts.name, ts.refSelector, ts.sel)
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/conversion_test.go b/vendor/k8s.io/apimachinery/pkg/runtime/conversion_test.go
deleted file mode 100644
index 33670415b..000000000
--- a/vendor/k8s.io/apimachinery/pkg/runtime/conversion_test.go
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package runtime_test
-
-import (
- "reflect"
- "testing"
-
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- runtimetesting "k8s.io/apimachinery/pkg/runtime/testing"
-)
-
-func TestStringMapConversion(t *testing.T) {
- internalGV := schema.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal}
- externalGV := schema.GroupVersion{Group: "test.group", Version: "external"}
-
- scheme := runtime.NewScheme()
- scheme.Log(t)
- scheme.AddKnownTypeWithName(internalGV.WithKind("Complex"), &runtimetesting.InternalComplex{})
- scheme.AddKnownTypeWithName(externalGV.WithKind("Complex"), &runtimetesting.ExternalComplex{})
-
- testCases := map[string]struct {
- input map[string][]string
- errFn func(error) bool
- expected runtime.Object
- }{
- "ignores omitempty": {
- input: map[string][]string{
- "String": {"not_used"},
- "string": {"value"},
- "int": {"1"},
- "Integer64": {"2"},
- },
- expected: &runtimetesting.ExternalComplex{String: "value", Integer: 1},
- },
- "returns error on bad int": {
- input: map[string][]string{
- "int": {"a"},
- },
- errFn: func(err error) bool { return err != nil },
- expected: &runtimetesting.ExternalComplex{},
- },
- "parses int64": {
- input: map[string][]string{
- "Int64": {"-1"},
- },
- expected: &runtimetesting.ExternalComplex{Int64: -1},
- },
- "returns error on bad int64": {
- input: map[string][]string{
- "Int64": {"a"},
- },
- errFn: func(err error) bool { return err != nil },
- expected: &runtimetesting.ExternalComplex{},
- },
- "parses boolean true": {
- input: map[string][]string{
- "bool": {"true"},
- },
- expected: &runtimetesting.ExternalComplex{Bool: true},
- },
- "parses boolean any value": {
- input: map[string][]string{
- "bool": {"foo"},
- },
- expected: &runtimetesting.ExternalComplex{Bool: true},
- },
- "parses boolean false": {
- input: map[string][]string{
- "bool": {"false"},
- },
- expected: &runtimetesting.ExternalComplex{Bool: false},
- },
- "parses boolean empty value": {
- input: map[string][]string{
- "bool": {""},
- },
- expected: &runtimetesting.ExternalComplex{Bool: true},
- },
- "parses boolean no value": {
- input: map[string][]string{
- "bool": {},
- },
- expected: &runtimetesting.ExternalComplex{Bool: false},
- },
- }
-
- for k, tc := range testCases {
- out := &runtimetesting.ExternalComplex{}
- if err := scheme.Convert(&tc.input, out, nil); (tc.errFn == nil && err != nil) || (tc.errFn != nil && !tc.errFn(err)) {
- t.Errorf("%s: unexpected error: %v", k, err)
- continue
- } else if err != nil {
- continue
- }
- if !reflect.DeepEqual(out, tc.expected) {
- t.Errorf("%s: unexpected output: %#v", k, out)
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/converter_test.go b/vendor/k8s.io/apimachinery/pkg/runtime/converter_test.go
deleted file mode 100644
index 7820b8cef..000000000
--- a/vendor/k8s.io/apimachinery/pkg/runtime/converter_test.go
+++ /dev/null
@@ -1,597 +0,0 @@
-/*
-Copyright 2015 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// These tests are in a separate package to break cyclic dependency in tests.
-// Unstructured type depends on unstructured converter package but we want to test how the converter handles
-// the Unstructured type so we need to import both.
-
-package runtime_test
-
-import (
- encodingjson "encoding/json"
- "fmt"
- "reflect"
- "strconv"
- "testing"
- "time"
-
- "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
- "k8s.io/apimachinery/pkg/conversion"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/util/diff"
- "k8s.io/apimachinery/pkg/util/json"
-
- "github.com/stretchr/testify/assert"
- "github.com/stretchr/testify/require"
-)
-
-var simpleEquality = conversion.EqualitiesOrDie(
- func(a, b time.Time) bool {
- return a.UTC() == b.UTC()
- },
-)
-
-// Definte a number of test types.
-type A struct {
- A int `json:"aa,omitempty"`
- B string `json:"ab,omitempty"`
- C bool `json:"ac,omitempty"`
-}
-
-type B struct {
- A A `json:"ba"`
- B string `json:"bb"`
- C map[string]string `json:"bc"`
- D []string `json:"bd"`
-}
-
-type C struct {
- A []A `json:"ca"`
- B `json:",inline"`
- C string `json:"cc"`
- D *int64 `json:"cd"`
- E map[string]int `json:"ce"`
- F []bool `json:"cf"`
- G []int `json:"cg"`
- H float32 `json:"ch"`
- I []interface{} `json:"ci"`
-}
-
-type D struct {
- A []interface{} `json:"da"`
-}
-
-type E struct {
- A interface{} `json:"ea"`
-}
-
-type F struct {
- A string `json:"fa"`
- B map[string]string `json:"fb"`
- C []A `json:"fc"`
- D int `json:"fd"`
- E float32 `json:"fe"`
- F []string `json:"ff"`
- G []int `json:"fg"`
- H []bool `json:"fh"`
- I []float32 `json:"fi"`
-}
-
-type G struct {
- CustomValue1 CustomValue `json:"customValue1"`
- CustomValue2 *CustomValue `json:"customValue2"`
- CustomPointer1 CustomPointer `json:"customPointer1"`
- CustomPointer2 *CustomPointer `json:"customPointer2"`
-}
-
-type CustomValue struct {
- data []byte
-}
-
-// MarshalJSON has a value receiver on this type.
-func (c CustomValue) MarshalJSON() ([]byte, error) {
- return c.data, nil
-}
-
-type CustomPointer struct {
- data []byte
-}
-
-// MarshalJSON has a pointer receiver on this type.
-func (c *CustomPointer) MarshalJSON() ([]byte, error) {
- return c.data, nil
-}
-
-func doRoundTrip(t *testing.T, item interface{}) {
- data, err := json.Marshal(item)
- if err != nil {
- t.Errorf("Error when marshaling object: %v", err)
- return
- }
-
- unstr := make(map[string]interface{})
- err = json.Unmarshal(data, &unstr)
- if err != nil {
- t.Errorf("Error when unmarshaling to unstructured: %v", err)
- return
- }
-
- data, err = json.Marshal(unstr)
- if err != nil {
- t.Errorf("Error when marshaling unstructured: %v", err)
- return
- }
- unmarshalledObj := reflect.New(reflect.TypeOf(item).Elem()).Interface()
- err = json.Unmarshal(data, unmarshalledObj)
- if err != nil {
- t.Errorf("Error when unmarshaling to object: %v", err)
- return
- }
- if !reflect.DeepEqual(item, unmarshalledObj) {
- t.Errorf("Object changed during JSON operations, diff: %v", diff.ObjectReflectDiff(item, unmarshalledObj))
- return
- }
-
- // TODO: should be using mismatch detection but fails due to another error
- newUnstr, err := runtime.DefaultUnstructuredConverter.ToUnstructured(item)
- if err != nil {
- t.Errorf("ToUnstructured failed: %v", err)
- return
- }
-
- newObj := reflect.New(reflect.TypeOf(item).Elem()).Interface()
- err = runtime.NewTestUnstructuredConverter(simpleEquality).FromUnstructured(newUnstr, newObj)
- if err != nil {
- t.Errorf("FromUnstructured failed: %v", err)
- return
- }
-
- if !reflect.DeepEqual(item, newObj) {
- t.Errorf("Object changed, diff: %v", diff.ObjectReflectDiff(item, newObj))
- }
-}
-
-func TestRoundTrip(t *testing.T) {
- intVal := int64(42)
- testCases := []struct {
- obj interface{}
- }{
- {
- obj: &unstructured.UnstructuredList{
- Object: map[string]interface{}{
- "kind": "List",
- },
- // Not testing a list with nil Items because items is a non-optional field and hence
- // is always marshaled into an empty array which is not equal to nil when unmarshalled and will fail.
- // That is expected.
- Items: []unstructured.Unstructured{},
- },
- },
- {
- obj: &unstructured.UnstructuredList{
- Object: map[string]interface{}{
- "kind": "List",
- },
- Items: []unstructured.Unstructured{
- {
- Object: map[string]interface{}{
- "kind": "Pod",
- },
- },
- },
- },
- },
- {
- obj: &unstructured.Unstructured{
- Object: map[string]interface{}{
- "kind": "Pod",
- },
- },
- },
- {
- obj: &unstructured.Unstructured{
- Object: map[string]interface{}{
- "apiVersion": "v1",
- "kind": "Foo",
- "metadata": map[string]interface{}{
- "name": "foo1",
- },
- },
- },
- },
- {
- // This (among others) tests nil map, slice and pointer.
- obj: &C{
- C: "ccc",
- },
- },
- {
- // This (among others) tests empty map and slice.
- obj: &C{
- A: []A{},
- C: "ccc",
- E: map[string]int{},
- I: []interface{}{},
- },
- },
- {
- obj: &C{
- A: []A{
- {
- A: 1,
- B: "11",
- C: true,
- },
- {
- A: 2,
- B: "22",
- C: false,
- },
- },
- B: B{
- A: A{
- A: 3,
- B: "33",
- },
- B: "bbb",
- C: map[string]string{
- "k1": "v1",
- "k2": "v2",
- },
- D: []string{"s1", "s2"},
- },
- C: "ccc",
- D: &intVal,
- E: map[string]int{
- "k1": 1,
- "k2": 2,
- },
- F: []bool{true, false, false},
- G: []int{1, 2, 5},
- H: 3.3,
- I: []interface{}{nil, nil, nil},
- },
- },
- {
- // Test slice of interface{} with empty slices.
- obj: &D{
- A: []interface{}{[]interface{}{}, []interface{}{}},
- },
- },
- {
- // Test slice of interface{} with different values.
- obj: &D{
- A: []interface{}{3.0, "3.0", nil},
- },
- },
- }
-
- for i := range testCases {
- t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
- doRoundTrip(t, testCases[i].obj)
- })
- }
-}
-
-// Verifies that:
-// 1) serialized json -> object
-// 2) serialized json -> map[string]interface{} -> object
-// produces the same object.
-func doUnrecognized(t *testing.T, jsonData string, item interface{}, expectedErr error) {
- unmarshalledObj := reflect.New(reflect.TypeOf(item).Elem()).Interface()
- err := json.Unmarshal([]byte(jsonData), unmarshalledObj)
- if (err != nil) != (expectedErr != nil) {
- t.Errorf("Unexpected error when unmarshaling to object: %v, expected: %v", err, expectedErr)
- return
- }
-
- unstr := make(map[string]interface{})
- err = json.Unmarshal([]byte(jsonData), &unstr)
- if err != nil {
- t.Errorf("Error when unmarshaling to unstructured: %v", err)
- return
- }
- newObj := reflect.New(reflect.TypeOf(item).Elem()).Interface()
- err = runtime.NewTestUnstructuredConverter(simpleEquality).FromUnstructured(unstr, newObj)
- if (err != nil) != (expectedErr != nil) {
- t.Errorf("Unexpected error in FromUnstructured: %v, expected: %v", err, expectedErr)
- }
-
- if expectedErr == nil && !reflect.DeepEqual(unmarshalledObj, newObj) {
- t.Errorf("Object changed, diff: %v", diff.ObjectReflectDiff(unmarshalledObj, newObj))
- }
-}
-
-func TestUnrecognized(t *testing.T) {
- testCases := []struct {
- data string
- obj interface{}
- err error
- }{
- {
- data: "{\"da\":[3.0,\"3.0\",null]}",
- obj: &D{},
- },
- {
- data: "{\"ea\":[3.0,\"3.0\",null]}",
- obj: &E{},
- },
- {
- data: "{\"ea\":[null,null,null]}",
- obj: &E{},
- },
- {
- data: "{\"ea\":[[],[null]]}",
- obj: &E{},
- },
- {
- data: "{\"ea\":{\"a\":[],\"b\":null}}",
- obj: &E{},
- },
- {
- data: "{\"fa\":\"fa\",\"fb\":{\"a\":\"a\"}}",
- obj: &F{},
- },
- {
- data: "{\"fa\":\"fa\",\"fb\":{\"a\":null}}",
- obj: &F{},
- },
- {
- data: "{\"fc\":[null]}",
- obj: &F{},
- },
- {
- data: "{\"fc\":[{\"aa\":123,\"ab\":\"bbb\"}]}",
- obj: &F{},
- },
- {
- // Only unknown fields
- data: "{\"fx\":[{\"aa\":123,\"ab\":\"bbb\"}],\"fz\":123}",
- obj: &F{},
- },
- {
- data: "{\"fc\":[{\"aa\":\"aaa\",\"ab\":\"bbb\"}]}",
- obj: &F{},
- err: fmt.Errorf("json: cannot unmarshal string into Go value of type int"),
- },
- {
- data: "{\"fd\":123,\"fe\":3.5}",
- obj: &F{},
- },
- {
- data: "{\"ff\":[\"abc\"],\"fg\":[123],\"fh\":[true,false]}",
- obj: &F{},
- },
- {
- // Invalid string data
- data: "{\"fa\":123}",
- obj: &F{},
- err: fmt.Errorf("json: cannot unmarshal number into Go value of type string"),
- },
- {
- // Invalid string data
- data: "{\"fa\":13.5}",
- obj: &F{},
- err: fmt.Errorf("json: cannot unmarshal number into Go value of type string"),
- },
- {
- // Invalid string data
- data: "{\"fa\":true}",
- obj: &F{},
- err: fmt.Errorf("json: cannot unmarshal bool into Go value of type string"),
- },
- {
- // Invalid []string data
- data: "{\"ff\":123}",
- obj: &F{},
- err: fmt.Errorf("json: cannot unmarshal number into Go value of type []string"),
- },
- {
- // Invalid []string data
- data: "{\"ff\":3.5}",
- obj: &F{},
- err: fmt.Errorf("json: cannot unmarshal number into Go value of type []string"),
- },
- {
- // Invalid []string data
- data: "{\"ff\":[123,345]}",
- obj: &F{},
- err: fmt.Errorf("json: cannot unmarshal number into Go value of type string"),
- },
- {
- // Invalid []int data
- data: "{\"fg\":123}",
- obj: &F{},
- err: fmt.Errorf("json: cannot unmarshal number into Go value of type []int"),
- },
- {
- // Invalid []int data
- data: "{\"fg\":\"abc\"}",
- obj: &F{},
- err: fmt.Errorf("json: cannot unmarshal string into Go value of type []int"),
- },
- {
- // Invalid []int data
- data: "{\"fg\":[\"abc\"]}",
- obj: &F{},
- err: fmt.Errorf("json: cannot unmarshal string into Go value of type int"),
- },
- {
- // Invalid []int data
- data: "{\"fg\":[3.5]}",
- obj: &F{},
- err: fmt.Errorf("json: cannot unmarshal number 3.5 into Go value of type int"),
- },
- {
- // Invalid []int data
- data: "{\"fg\":[true,false]}",
- obj: &F{},
- err: fmt.Errorf("json: cannot unmarshal number 3.5 into Go value of type int"),
- },
- {
- // Invalid []bool data
- data: "{\"fh\":123}",
- obj: &F{},
- err: fmt.Errorf("json: cannot unmarshal number into Go value of type []bool"),
- },
- {
- // Invalid []bool data
- data: "{\"fh\":\"abc\"}",
- obj: &F{},
- err: fmt.Errorf("json: cannot unmarshal string into Go value of type []bool"),
- },
- {
- // Invalid []bool data
- data: "{\"fh\":[\"abc\"]}",
- obj: &F{},
- err: fmt.Errorf("json: cannot unmarshal string into Go value of type bool"),
- },
- {
- // Invalid []bool data
- data: "{\"fh\":[3.5]}",
- obj: &F{},
- err: fmt.Errorf("json: cannot unmarshal number into Go value of type bool"),
- },
- {
- // Invalid []bool data
- data: "{\"fh\":[123]}",
- obj: &F{},
- err: fmt.Errorf("json: cannot unmarshal number into Go value of type bool"),
- },
- {
- // Invalid []float data
- data: "{\"fi\":123}",
- obj: &F{},
- err: fmt.Errorf("json: cannot unmarshal number into Go value of type []float32"),
- },
- {
- // Invalid []float data
- data: "{\"fi\":\"abc\"}",
- obj: &F{},
- err: fmt.Errorf("json: cannot unmarshal string into Go value of type []float32"),
- },
- {
- // Invalid []float data
- data: "{\"fi\":[\"abc\"]}",
- obj: &F{},
- err: fmt.Errorf("json: cannot unmarshal string into Go value of type float32"),
- },
- {
- // Invalid []float data
- data: "{\"fi\":[true]}",
- obj: &F{},
- err: fmt.Errorf("json: cannot unmarshal bool into Go value of type float32"),
- },
- }
-
- for _, tc := range testCases {
- t.Run(tc.data, func(t *testing.T) {
- doUnrecognized(t, tc.data, tc.obj, tc.err)
- })
- }
-}
-
-func TestDeepCopyJSON(t *testing.T) {
- src := map[string]interface{}{
- "a": nil,
- "b": int64(123),
- "c": map[string]interface{}{
- "a": "b",
- },
- "d": []interface{}{
- int64(1), int64(2),
- },
- "e": "estr",
- "f": true,
- "g": encodingjson.Number("123"),
- }
- deepCopy := runtime.DeepCopyJSON(src)
- assert.Equal(t, src, deepCopy)
-}
-
-func TestFloatIntConversion(t *testing.T) {
- unstr := map[string]interface{}{"fd": float64(3)}
-
- var obj F
- if err := runtime.NewTestUnstructuredConverter(simpleEquality).FromUnstructured(unstr, &obj); err != nil {
- t.Errorf("Unexpected error in FromUnstructured: %v", err)
- }
-
- data, err := json.Marshal(unstr)
- if err != nil {
- t.Fatalf("Error when marshaling unstructured: %v", err)
- }
- var unmarshalled F
- if err := json.Unmarshal(data, &unmarshalled); err != nil {
- t.Fatalf("Error when unmarshaling to object: %v", err)
- }
-
- if !reflect.DeepEqual(obj, unmarshalled) {
- t.Errorf("Incorrect conversion, diff: %v", diff.ObjectReflectDiff(obj, unmarshalled))
- }
-}
-
-func TestCustomToUnstructured(t *testing.T) {
- testcases := []struct {
- Data string
- Expected interface{}
- }{
- {Data: `null`, Expected: nil},
- {Data: `true`, Expected: true},
- {Data: `false`, Expected: false},
- {Data: `[]`, Expected: []interface{}{}},
- {Data: `[1]`, Expected: []interface{}{int64(1)}},
- {Data: `{}`, Expected: map[string]interface{}{}},
- {Data: `{"a":1}`, Expected: map[string]interface{}{"a": int64(1)}},
- {Data: `0`, Expected: int64(0)},
- {Data: `0.0`, Expected: float64(0)},
- }
-
- for _, tc := range testcases {
- tc := tc
- t.Run(tc.Data, func(t *testing.T) {
- t.Parallel()
- result, err := runtime.NewTestUnstructuredConverter(simpleEquality).ToUnstructured(&G{
- CustomValue1: CustomValue{data: []byte(tc.Data)},
- CustomValue2: &CustomValue{data: []byte(tc.Data)},
- CustomPointer1: CustomPointer{data: []byte(tc.Data)},
- CustomPointer2: &CustomPointer{data: []byte(tc.Data)},
- })
- require.NoError(t, err)
- for field, fieldResult := range result {
- assert.Equal(t, tc.Expected, fieldResult, field)
- }
- })
- }
-}
-
-func TestCustomToUnstructuredTopLevel(t *testing.T) {
- // Only objects are supported at the top level
- topLevelCases := []interface{}{
- &CustomValue{data: []byte(`{"a":1}`)},
- &CustomPointer{data: []byte(`{"a":1}`)},
- }
- expected := map[string]interface{}{"a": int64(1)}
- for i, obj := range topLevelCases {
- obj := obj
- t.Run(strconv.Itoa(i), func(t *testing.T) {
- t.Parallel()
- result, err := runtime.NewTestUnstructuredConverter(simpleEquality).ToUnstructured(obj)
- require.NoError(t, err)
- assert.Equal(t, expected, result)
- })
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/embedded_test.go b/vendor/k8s.io/apimachinery/pkg/runtime/embedded_test.go
deleted file mode 100644
index 606e0e96a..000000000
--- a/vendor/k8s.io/apimachinery/pkg/runtime/embedded_test.go
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package runtime_test
-
-import (
- "encoding/json"
- "reflect"
- "testing"
-
- "k8s.io/apimachinery/pkg/api/meta"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/runtime/serializer"
- runtimetesting "k8s.io/apimachinery/pkg/runtime/testing"
- "k8s.io/apimachinery/pkg/util/diff"
-)
-
-func TestDecodeEmptyRawExtensionAsObject(t *testing.T) {
- internalGV := schema.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal}
- externalGV := schema.GroupVersion{Group: "test.group", Version: "v1test"}
- externalGVK := externalGV.WithKind("ObjectTest")
-
- s := runtime.NewScheme()
- s.AddKnownTypes(internalGV, &runtimetesting.ObjectTest{})
- s.AddKnownTypeWithName(externalGVK, &runtimetesting.ObjectTestExternal{})
-
- codec := serializer.NewCodecFactory(s).LegacyCodec(externalGV)
-
- obj, gvk, err := codec.Decode([]byte(`{"kind":"`+externalGVK.Kind+`","apiVersion":"`+externalGV.String()+`","items":[{}]}`), nil, nil)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- test := obj.(*runtimetesting.ObjectTest)
- if unk, ok := test.Items[0].(*runtime.Unknown); !ok || unk.Kind != "" || unk.APIVersion != "" || string(unk.Raw) != "{}" || unk.ContentType != runtime.ContentTypeJSON {
- t.Fatalf("unexpected object: %#v", test.Items[0])
- }
- if *gvk != externalGVK {
- t.Fatalf("unexpected kind: %#v", gvk)
- }
-
- obj, gvk, err = codec.Decode([]byte(`{"kind":"`+externalGVK.Kind+`","apiVersion":"`+externalGV.String()+`","items":[{"kind":"Other","apiVersion":"v1"}]}`), nil, nil)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- test = obj.(*runtimetesting.ObjectTest)
- if unk, ok := test.Items[0].(*runtime.Unknown); !ok || unk.Kind != "" || unk.APIVersion != "" || string(unk.Raw) != `{"kind":"Other","apiVersion":"v1"}` || unk.ContentType != runtime.ContentTypeJSON {
- t.Fatalf("unexpected object: %#v", test.Items[0])
- }
- if *gvk != externalGVK {
- t.Fatalf("unexpected kind: %#v", gvk)
- }
-}
-
-func TestArrayOfRuntimeObject(t *testing.T) {
- internalGV := schema.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal}
- externalGV := schema.GroupVersion{Group: "test.group", Version: "v1test"}
-
- s := runtime.NewScheme()
- s.AddKnownTypes(internalGV, &runtimetesting.EmbeddedTest{})
- s.AddKnownTypeWithName(externalGV.WithKind("EmbeddedTest"), &runtimetesting.EmbeddedTestExternal{})
- s.AddKnownTypes(internalGV, &runtimetesting.ObjectTest{})
- s.AddKnownTypeWithName(externalGV.WithKind("ObjectTest"), &runtimetesting.ObjectTestExternal{})
-
- codec := serializer.NewCodecFactory(s).LegacyCodec(externalGV)
-
- innerItems := []runtime.Object{
- &runtimetesting.EmbeddedTest{ID: "baz"},
- }
- items := []runtime.Object{
- &runtimetesting.EmbeddedTest{ID: "foo"},
- &runtimetesting.EmbeddedTest{ID: "bar"},
- // TODO: until YAML is removed, this JSON must be in ascending key order to ensure consistent roundtrip serialization
- &runtime.Unknown{
- Raw: []byte(`{"apiVersion":"unknown.group/unknown","foo":"bar","kind":"OtherTest"}`),
- ContentType: runtime.ContentTypeJSON,
- },
- &runtimetesting.ObjectTest{
- Items: runtime.NewEncodableList(codec, innerItems),
- },
- }
- internal := &runtimetesting.ObjectTest{
- Items: runtime.NewEncodableList(codec, items),
- }
- wire, err := runtime.Encode(codec, internal)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- t.Logf("Wire format is:\n%s\n", string(wire))
-
- obj := &runtimetesting.ObjectTestExternal{}
- if err := json.Unmarshal(wire, obj); err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- t.Logf("exact wire is: %s", string(obj.Items[0].Raw))
-
- items[3] = &runtimetesting.ObjectTest{Items: innerItems}
- internal.Items = items
-
- decoded, err := runtime.Decode(codec, wire)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- list, err := meta.ExtractList(decoded)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- if errs := runtime.DecodeList(list, codec); len(errs) > 0 {
- t.Fatalf("unexpected error: %v", errs)
- }
-
- list2, err := meta.ExtractList(list[3])
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- if errs := runtime.DecodeList(list2, codec); len(errs) > 0 {
- t.Fatalf("unexpected error: %v", errs)
- }
- if err := meta.SetList(list[3], list2); err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
-
- // we want DecodeList to set type meta if possible, even on runtime.Unknown objects
- internal.Items[2].(*runtime.Unknown).TypeMeta = runtime.TypeMeta{Kind: "OtherTest", APIVersion: "unknown.group/unknown"}
- if e, a := internal.Items, list; !reflect.DeepEqual(e, a) {
- t.Errorf("mismatched decoded: %s", diff.ObjectGoPrintSideBySide(e, a))
- }
-}
-
-func TestNestedObject(t *testing.T) {
- internalGV := schema.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal}
- externalGV := schema.GroupVersion{Group: "test.group", Version: "v1test"}
- embeddedTestExternalGVK := externalGV.WithKind("EmbeddedTest")
-
- s := runtime.NewScheme()
- s.AddKnownTypes(internalGV, &runtimetesting.EmbeddedTest{})
- s.AddKnownTypeWithName(embeddedTestExternalGVK, &runtimetesting.EmbeddedTestExternal{})
-
- codec := serializer.NewCodecFactory(s).LegacyCodec(externalGV)
-
- inner := &runtimetesting.EmbeddedTest{
- ID: "inner",
- }
- outer := &runtimetesting.EmbeddedTest{
- ID: "outer",
- Object: runtime.NewEncodable(codec, inner),
- }
-
- wire, err := runtime.Encode(codec, outer)
- if err != nil {
- t.Fatalf("Unexpected encode error '%v'", err)
- }
-
- t.Logf("Wire format is:\n%v\n", string(wire))
-
- decoded, err := runtime.Decode(codec, wire)
- if err != nil {
- t.Fatalf("Unexpected decode error %v", err)
- }
-
- // for later tests
- outer.Object = inner
-
- if e, a := outer, decoded; reflect.DeepEqual(e, a) {
- t.Errorf("Expected unequal %#v %#v", e, a)
- }
-
- obj, err := runtime.Decode(codec, decoded.(*runtimetesting.EmbeddedTest).Object.(*runtime.Unknown).Raw)
- if err != nil {
- t.Fatal(err)
- }
- decoded.(*runtimetesting.EmbeddedTest).Object = obj
- if e, a := outer, decoded; !reflect.DeepEqual(e, a) {
- t.Errorf("Expected equal %#v %#v", e, a)
- }
-
- // test JSON decoding of the external object, which should preserve
- // raw bytes
- var externalViaJSON runtimetesting.EmbeddedTestExternal
- err = json.Unmarshal(wire, &externalViaJSON)
- if err != nil {
- t.Fatalf("Unexpected decode error %v", err)
- }
- if externalViaJSON.Kind == "" || externalViaJSON.APIVersion == "" || externalViaJSON.ID != "outer" {
- t.Errorf("Expected objects to have type info set, got %#v", externalViaJSON)
- }
- if len(externalViaJSON.EmptyObject.Raw) > 0 {
- t.Errorf("Expected deserialization of empty nested objects into empty bytes, got %#v", externalViaJSON)
- }
-
- // test JSON decoding, too, since Decode uses yaml unmarshalling.
- // Generic Unmarshalling of JSON cannot load the nested objects because there is
- // no default schema set. Consumers wishing to get direct JSON decoding must use
- // the external representation
- var decodedViaJSON runtimetesting.EmbeddedTest
- err = json.Unmarshal(wire, &decodedViaJSON)
- if err == nil {
- t.Fatal("Expeceted decode error")
- }
- if _, ok := err.(*json.UnmarshalTypeError); !ok {
- t.Fatalf("Unexpected decode error: %v", err)
- }
- if a := decodedViaJSON; a.Object != nil || a.EmptyObject != nil {
- t.Errorf("Expected embedded objects to be nil: %#v", a)
- }
-}
-
-// TestDeepCopyOfRuntimeObject checks to make sure that runtime.Objects's can be passed through DeepCopy with fidelity
-func TestDeepCopyOfRuntimeObject(t *testing.T) {
- internalGV := schema.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal}
- externalGV := schema.GroupVersion{Group: "test.group", Version: "v1test"}
- embeddedTestExternalGVK := externalGV.WithKind("EmbeddedTest")
-
- s := runtime.NewScheme()
- s.AddKnownTypes(internalGV, &runtimetesting.EmbeddedTest{})
- s.AddKnownTypeWithName(embeddedTestExternalGVK, &runtimetesting.EmbeddedTestExternal{})
-
- original := &runtimetesting.EmbeddedTest{
- ID: "outer",
- Object: &runtimetesting.EmbeddedTest{
- ID: "inner",
- },
- }
-
- codec := serializer.NewCodecFactory(s).LegacyCodec(externalGV)
-
- originalData, err := runtime.Encode(codec, original)
- if err != nil {
- t.Errorf("unexpected error: %v", err)
- }
- t.Logf("originalRole = %v\n", string(originalData))
-
- copyOfOriginal := original.DeepCopy()
- copiedData, err := runtime.Encode(codec, copyOfOriginal)
- if err != nil {
- t.Errorf("unexpected error: %v", err)
- }
- t.Logf("copyOfRole = %v\n", string(copiedData))
-
- if !reflect.DeepEqual(original, copyOfOriginal) {
- t.Errorf("expected \n%v\n, got \n%v", string(originalData), string(copiedData))
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/extension_test.go b/vendor/k8s.io/apimachinery/pkg/runtime/extension_test.go
deleted file mode 100644
index 5f9154ea6..000000000
--- a/vendor/k8s.io/apimachinery/pkg/runtime/extension_test.go
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package runtime_test
-
-import (
- "bytes"
- "encoding/json"
- "reflect"
- "testing"
-
- "k8s.io/apimachinery/pkg/runtime"
-)
-
-func TestEmbeddedRawExtensionMarshal(t *testing.T) {
- type test struct {
- Ext runtime.RawExtension
- }
-
- extension := test{Ext: runtime.RawExtension{Raw: []byte(`{"foo":"bar"}`)}}
- data, err := json.Marshal(extension)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- if string(data) != `{"Ext":{"foo":"bar"}}` {
- t.Errorf("unexpected data: %s", string(data))
- }
-}
-func TestEmbeddedRawExtensionUnmarshal(t *testing.T) {
- type test struct {
- Ext runtime.RawExtension
- }
-
- testCases := map[string]struct {
- orig test
- }{
- "non-empty object": {
- orig: test{Ext: runtime.RawExtension{Raw: []byte(`{"foo":"bar"}`)}},
- },
- "empty object": {
- orig: test{Ext: runtime.RawExtension{}},
- },
- }
-
- for k, tc := range testCases {
- new := test{}
- data, _ := json.Marshal(tc.orig)
- if err := json.Unmarshal(data, &new); err != nil {
- t.Errorf("%s: umarshal error: %v", k, err)
- }
- if !reflect.DeepEqual(tc.orig, new) {
- t.Errorf("%s: unmarshaled struct differs from original: %v %v", k, tc.orig, new)
- }
- }
-}
-
-func TestEmbeddedRawExtensionRoundTrip(t *testing.T) {
- type test struct {
- Ext runtime.RawExtension
- }
-
- testCases := map[string]struct {
- orig test
- }{
- "non-empty object": {
- orig: test{Ext: runtime.RawExtension{Raw: []byte(`{"foo":"bar"}`)}},
- },
- "empty object": {
- orig: test{Ext: runtime.RawExtension{}},
- },
- }
-
- for k, tc := range testCases {
- new1 := test{}
- new2 := test{}
- data, err := json.Marshal(tc.orig)
- if err != nil {
- t.Errorf("1st marshal error: %v", err)
- }
- if err = json.Unmarshal(data, &new1); err != nil {
- t.Errorf("1st unmarshal error: %v", err)
- }
- newData, err := json.Marshal(new1)
- if err != nil {
- t.Errorf("2st marshal error: %v", err)
- }
- if err = json.Unmarshal(newData, &new2); err != nil {
- t.Errorf("2nd unmarshal error: %v", err)
- }
- if !bytes.Equal(data, newData) {
- t.Errorf("%s: re-marshaled data differs from original: %v %v", k, data, newData)
- }
- if !reflect.DeepEqual(tc.orig, new1) {
- t.Errorf("%s: unmarshaled struct differs from original: %v %v", k, tc.orig, new1)
- }
- if !reflect.DeepEqual(new1, new2) {
- t.Errorf("%s: re-unmarshaled struct differs from original: %v %v", k, new1, new2)
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/local_scheme_test.go b/vendor/k8s.io/apimachinery/pkg/runtime/local_scheme_test.go
deleted file mode 100644
index 45a0dde5e..000000000
--- a/vendor/k8s.io/apimachinery/pkg/runtime/local_scheme_test.go
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
-Copyright 2018 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package runtime
-
-import (
- "testing"
-
- "reflect"
-
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/util/diff"
-)
-
-func TestPreferredVersionsAllGroups(t *testing.T) {
- tests := []struct {
- name string
- versionPriority map[string][]string
- observedVersions []schema.GroupVersion
- expectedPrioritized map[string][]schema.GroupVersion
- expectedPreferred map[schema.GroupVersion]bool
- }{
- {
- name: "observedOnly",
- observedVersions: []schema.GroupVersion{
- {Group: "", Version: "v3"},
- {Group: "foo", Version: "v1"},
- {Group: "foo", Version: "v2"},
- {Group: "", Version: "v1"},
- },
- expectedPrioritized: map[string][]schema.GroupVersion{
- "": {
- {Group: "", Version: "v3"},
- {Group: "", Version: "v1"},
- },
- "foo": {
- {Group: "foo", Version: "v1"},
- {Group: "foo", Version: "v2"},
- },
- },
- expectedPreferred: map[schema.GroupVersion]bool{
- {Group: "", Version: "v3"}: true,
- {Group: "foo", Version: "v1"}: true,
- },
- },
- {
- name: "specifiedOnly",
- versionPriority: map[string][]string{
- "": {"v3", "v1"},
- "foo": {"v1", "v2"},
- },
- expectedPrioritized: map[string][]schema.GroupVersion{
- "": {
- {Group: "", Version: "v3"},
- {Group: "", Version: "v1"},
- },
- "foo": {
- {Group: "foo", Version: "v1"},
- {Group: "foo", Version: "v2"},
- },
- },
- expectedPreferred: map[schema.GroupVersion]bool{
- {Group: "", Version: "v3"}: true,
- {Group: "foo", Version: "v1"}: true,
- },
- },
- {
- name: "both",
- versionPriority: map[string][]string{
- "": {"v3", "v1"},
- "foo": {"v1", "v2"},
- },
- observedVersions: []schema.GroupVersion{
- {Group: "", Version: "v1"},
- {Group: "", Version: "v3"},
- {Group: "", Version: "v4"},
- {Group: "", Version: "v5"},
- {Group: "bar", Version: "v1"},
- {Group: "bar", Version: "v2"},
- },
- expectedPrioritized: map[string][]schema.GroupVersion{
- "": {
- {Group: "", Version: "v3"},
- {Group: "", Version: "v1"},
- {Group: "", Version: "v4"},
- {Group: "", Version: "v5"},
- },
- "foo": {
- {Group: "foo", Version: "v1"},
- {Group: "foo", Version: "v2"},
- },
- "bar": {
- {Group: "bar", Version: "v1"},
- {Group: "bar", Version: "v2"},
- },
- },
- expectedPreferred: map[schema.GroupVersion]bool{
- {Group: "", Version: "v3"}: true,
- {Group: "foo", Version: "v1"}: true,
- {Group: "bar", Version: "v1"}: true,
- },
- },
- }
-
- for _, test := range tests {
- t.Run(test.name, func(t *testing.T) {
- scheme := NewScheme()
- scheme.versionPriority = test.versionPriority
- scheme.observedVersions = test.observedVersions
-
- for group, expected := range test.expectedPrioritized {
- actual := scheme.PrioritizedVersionsForGroup(group)
- if !reflect.DeepEqual(expected, actual) {
- t.Error(diff.ObjectDiff(expected, actual))
- }
- }
-
- prioritizedAll := scheme.PrioritizedVersionsAllGroups()
- actualPrioritizedAll := map[string][]schema.GroupVersion{}
- for _, actual := range prioritizedAll {
- actualPrioritizedAll[actual.Group] = append(actualPrioritizedAll[actual.Group], actual)
- }
- if !reflect.DeepEqual(test.expectedPrioritized, actualPrioritizedAll) {
- t.Error(diff.ObjectDiff(test.expectedPrioritized, actualPrioritizedAll))
- }
-
- preferredAll := scheme.PreferredVersionAllGroups()
- actualPreferredAll := map[schema.GroupVersion]bool{}
- for _, actual := range preferredAll {
- actualPreferredAll[actual] = true
- }
- if !reflect.DeepEqual(test.expectedPreferred, actualPreferredAll) {
- t.Error(diff.ObjectDiff(test.expectedPreferred, actualPreferredAll))
- }
- })
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version_test.go b/vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version_test.go
deleted file mode 100644
index 3934bc45a..000000000
--- a/vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version_test.go
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
-Copyright 2015 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package schema
-
-import (
- "testing"
-)
-
-func TestGroupVersionParse(t *testing.T) {
- tests := []struct {
- input string
- out GroupVersion
- err func(error) bool
- }{
- {input: "v1", out: GroupVersion{Version: "v1"}},
- {input: "v2", out: GroupVersion{Version: "v2"}},
- {input: "/v1", out: GroupVersion{Version: "v1"}},
- {input: "v1/", out: GroupVersion{Group: "v1"}},
- {input: "/v1/", err: func(err error) bool { return err.Error() == "unexpected GroupVersion string: /v1/" }},
- {input: "v1/a", out: GroupVersion{Group: "v1", Version: "a"}},
- }
- for i, test := range tests {
- out, err := ParseGroupVersion(test.input)
- if test.err == nil && err != nil || err == nil && test.err != nil {
- t.Errorf("%d: unexpected error: %v", i, err)
- continue
- }
- if test.err != nil && !test.err(err) {
- t.Errorf("%d: unexpected error: %v", i, err)
- continue
- }
- if out != test.out {
- t.Errorf("%d: unexpected output: %#v", i, out)
- }
- }
-}
-
-func TestGroupResourceParse(t *testing.T) {
- tests := []struct {
- input string
- out GroupResource
- }{
- {input: "v1", out: GroupResource{Resource: "v1"}},
- {input: ".v1", out: GroupResource{Group: "v1"}},
- {input: "v1.", out: GroupResource{Resource: "v1"}},
- {input: "v1.a", out: GroupResource{Group: "a", Resource: "v1"}},
- {input: "b.v1.a", out: GroupResource{Group: "v1.a", Resource: "b"}},
- }
- for i, test := range tests {
- out := ParseGroupResource(test.input)
- if out != test.out {
- t.Errorf("%d: unexpected output: %#v", i, out)
- }
- }
-}
-
-func TestParseResourceArg(t *testing.T) {
- tests := []struct {
- input string
- gvr *GroupVersionResource
- gr GroupResource
- }{
- {input: "v1", gr: GroupResource{Resource: "v1"}},
- {input: ".v1", gr: GroupResource{Group: "v1"}},
- {input: "v1.", gr: GroupResource{Resource: "v1"}},
- {input: "v1.a", gr: GroupResource{Group: "a", Resource: "v1"}},
- {input: "b.v1.a", gvr: &GroupVersionResource{Group: "a", Version: "v1", Resource: "b"}, gr: GroupResource{Group: "v1.a", Resource: "b"}},
- }
- for i, test := range tests {
- gvr, gr := ParseResourceArg(test.input)
- if (gvr != nil && test.gvr == nil) || (gvr == nil && test.gvr != nil) || (test.gvr != nil && *gvr != *test.gvr) {
- t.Errorf("%d: unexpected output: %#v", i, gvr)
- }
- if gr != test.gr {
- t.Errorf("%d: unexpected output: %#v", i, gr)
- }
- }
-}
-
-func TestKindForGroupVersionKinds(t *testing.T) {
- gvks := GroupVersions{
- GroupVersion{Group: "batch", Version: "v1"},
- GroupVersion{Group: "batch", Version: "v2alpha1"},
- GroupVersion{Group: "policy", Version: "v1beta1"},
- }
- cases := []struct {
- input []GroupVersionKind
- target GroupVersionKind
- ok bool
- }{
- {
- input: []GroupVersionKind{{Group: "batch", Version: "v2alpha1", Kind: "ScheduledJob"}},
- target: GroupVersionKind{Group: "batch", Version: "v2alpha1", Kind: "ScheduledJob"},
- ok: true,
- },
- {
- input: []GroupVersionKind{{Group: "batch", Version: "v3alpha1", Kind: "CronJob"}},
- target: GroupVersionKind{Group: "batch", Version: "v1", Kind: "CronJob"},
- ok: true,
- },
- {
- input: []GroupVersionKind{{Group: "policy", Version: "v1beta1", Kind: "PodDisruptionBudget"}},
- target: GroupVersionKind{Group: "policy", Version: "v1beta1", Kind: "PodDisruptionBudget"},
- ok: true,
- },
- {
- input: []GroupVersionKind{{Group: "apps", Version: "v1alpha1", Kind: "StatefulSet"}},
- target: GroupVersionKind{},
- ok: false,
- },
- }
-
- for i, c := range cases {
- target, ok := gvks.KindForGroupVersionKinds(c.input)
- if c.target != target {
- t.Errorf("%d: unexpected target: %v, expected %v", i, target, c.target)
- }
- if c.ok != ok {
- t.Errorf("%d: unexpected ok: %v, expected %v", i, ok, c.ok)
- }
- }
-}
-
-func TestParseKindArg(t *testing.T) {
- tests := []struct {
- input string
- gvk *GroupVersionKind
- gk GroupKind
- }{
- {input: "Pod", gk: GroupKind{Kind: "Pod"}},
- {input: ".apps", gk: GroupKind{Group: "apps"}},
- {input: "Pod.", gk: GroupKind{Kind: "Pod"}},
- {input: "StatefulSet.apps", gk: GroupKind{Group: "apps", Kind: "StatefulSet"}},
- {input: "StatefulSet.v1.apps", gvk: &GroupVersionKind{Group: "apps", Version: "v1", Kind: "StatefulSet"}, gk: GroupKind{Group: "v1.apps", Kind: "StatefulSet"}},
- }
- for i, test := range tests {
- t.Run(test.input, func(t *testing.T) {
- gvk, gk := ParseKindArg(test.input)
- if (gvk != nil && test.gvk == nil) || (gvk == nil && test.gvk != nil) || (test.gvk != nil && *gvk != *test.gvk) {
- t.Errorf("%d: expected output: %#v, got: %#v", i, test.gvk, gvk)
- }
- if gk != test.gk {
- t.Errorf("%d: expected output: %#v, got: %#v", i, test.gk, gk)
- }
- })
- }
-}
-
-func TestParseGroupKind(t *testing.T) {
- tests := []struct {
- input string
- out GroupKind
- }{
- {input: "Pod", out: GroupKind{Kind: "Pod"}},
- {input: ".StatefulSet", out: GroupKind{Group: "StatefulSet"}},
- {input: "StatefulSet.apps", out: GroupKind{Group: "apps", Kind: "StatefulSet"}},
- }
- for i, test := range tests {
- t.Run(test.input, func(t *testing.T) {
- out := ParseGroupKind(test.input)
- if out != test.out {
- t.Errorf("%d: expected output: %#v, got: %#v", i, test.out, out)
- }
- })
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/scheme_test.go b/vendor/k8s.io/apimachinery/pkg/runtime/scheme_test.go
deleted file mode 100644
index 0b76b5d71..000000000
--- a/vendor/k8s.io/apimachinery/pkg/runtime/scheme_test.go
+++ /dev/null
@@ -1,1035 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package runtime_test
-
-import (
- "fmt"
- "reflect"
- "strings"
- "testing"
-
- "github.com/google/gofuzz"
- flag "github.com/spf13/pflag"
-
- "k8s.io/apimachinery/pkg/conversion"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/runtime/serializer"
- runtimetesting "k8s.io/apimachinery/pkg/runtime/testing"
- "k8s.io/apimachinery/pkg/util/diff"
-)
-
-var fuzzIters = flag.Int("fuzz-iters", 50, "How many fuzzing iterations to do.")
-
-func TestScheme(t *testing.T) {
- internalGV := schema.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal}
- internalGVK := internalGV.WithKind("Simple")
- externalGV := schema.GroupVersion{Group: "test.group", Version: "testExternal"}
- externalGVK := externalGV.WithKind("Simple")
-
- scheme := runtime.NewScheme()
- scheme.AddKnownTypeWithName(internalGVK, &runtimetesting.InternalSimple{})
- scheme.AddKnownTypeWithName(externalGVK, &runtimetesting.ExternalSimple{})
-
- // If set, would clear TypeMeta during conversion.
- //scheme.AddIgnoredConversionType(&TypeMeta{}, &TypeMeta{})
-
- // test that scheme is an ObjectTyper
- var _ runtime.ObjectTyper = scheme
-
- internalToExternalCalls := 0
- externalToInternalCalls := 0
-
- // Register functions to verify that scope.Meta() gets set correctly.
- err := scheme.AddConversionFuncs(
- func(in *runtimetesting.InternalSimple, out *runtimetesting.ExternalSimple, scope conversion.Scope) error {
- err := scope.Convert(&in.TypeMeta, &out.TypeMeta, 0)
- if err != nil {
- return err
- }
- err = scope.Convert(&in.TestString, &out.TestString, 0)
- if err != nil {
- return err
- }
- internalToExternalCalls++
- return nil
- },
- func(in *runtimetesting.ExternalSimple, out *runtimetesting.InternalSimple, scope conversion.Scope) error {
- err := scope.Convert(&in.TypeMeta, &out.TypeMeta, 0)
- if err != nil {
- return err
- }
- err = scope.Convert(&in.TestString, &out.TestString, 0)
- if err != nil {
- return err
- }
- externalToInternalCalls++
- return nil
- },
- )
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
-
- t.Run("Encode, Decode, DecodeInto, and DecodeToVersion", func(t *testing.T) {
- simple := &runtimetesting.InternalSimple{
- TestString: "foo",
- }
-
- codecs := serializer.NewCodecFactory(scheme)
- codec := codecs.LegacyCodec(externalGV)
- info, _ := runtime.SerializerInfoForMediaType(codecs.SupportedMediaTypes(), runtime.ContentTypeJSON)
- jsonserializer := info.Serializer
-
- obj := runtime.Object(simple)
- data, err := runtime.Encode(codec, obj)
- if err != nil {
- t.Fatal(err)
- }
-
- obj2, err := runtime.Decode(codec, data)
- if err != nil {
- t.Fatal(err)
- }
- if _, ok := obj2.(*runtimetesting.InternalSimple); !ok {
- t.Fatalf("Got wrong type")
- }
- if e, a := simple, obj2; !reflect.DeepEqual(e, a) {
- t.Errorf("Expected:\n %#v,\n Got:\n %#v", e, a)
- }
-
- obj3 := &runtimetesting.InternalSimple{}
- if err := runtime.DecodeInto(codec, data, obj3); err != nil {
- t.Fatal(err)
- }
- // clearing TypeMeta is a function of the scheme, which we do not test here (ConvertToVersion
- // does not automatically clear TypeMeta anymore).
- simple.TypeMeta = runtime.TypeMeta{Kind: "Simple", APIVersion: externalGV.String()}
- if e, a := simple, obj3; !reflect.DeepEqual(e, a) {
- t.Errorf("Expected:\n %#v,\n Got:\n %#v", e, a)
- }
-
- obj4, err := runtime.Decode(jsonserializer, data)
- if err != nil {
- t.Fatal(err)
- }
- if _, ok := obj4.(*runtimetesting.ExternalSimple); !ok {
- t.Fatalf("Got wrong type")
- }
- })
- t.Run("Convert", func(t *testing.T) {
- simple := &runtimetesting.InternalSimple{
- TestString: "foo",
- }
-
- external := &runtimetesting.ExternalSimple{}
- err = scheme.Convert(simple, external, nil)
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
- if e, a := simple.TestString, external.TestString; e != a {
- t.Errorf("Expected %q, got %q", e, a)
- }
- })
- t.Run("Convert internal to unstructured", func(t *testing.T) {
- simple := &runtimetesting.InternalSimple{
- TestString: "foo",
- }
-
- unstructuredObj := &runtimetesting.Unstructured{}
- err = scheme.Convert(simple, unstructuredObj, nil)
- if err == nil || !strings.Contains(err.Error(), "to Unstructured without providing a preferred version to convert to") {
- t.Fatalf("Unexpected non-error: %v", err)
- }
- err = scheme.Convert(simple, unstructuredObj, externalGV)
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
- if e, a := simple.TestString, unstructuredObj.Object["testString"].(string); e != a {
- t.Errorf("Expected %q, got %q", e, a)
- }
- if e := unstructuredObj.GetObjectKind().GroupVersionKind(); e != externalGVK {
- t.Errorf("Unexpected object kind: %#v", e)
- }
- if gvks, unversioned, err := scheme.ObjectKinds(unstructuredObj); err != nil || gvks[0] != externalGVK || unversioned {
- t.Errorf("Scheme did not recognize unversioned: %v, %#v %t", err, gvks, unversioned)
- }
- })
- t.Run("Convert external to unstructured", func(t *testing.T) {
- unstructuredObj := &runtimetesting.Unstructured{}
- external := &runtimetesting.ExternalSimple{
- TestString: "foo",
- }
-
- err = scheme.Convert(external, unstructuredObj, nil)
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
- if e, a := external.TestString, unstructuredObj.Object["testString"].(string); e != a {
- t.Errorf("Expected %q, got %q", e, a)
- }
- if e := unstructuredObj.GetObjectKind().GroupVersionKind(); e != externalGVK {
- t.Errorf("Unexpected object kind: %#v", e)
- }
- })
- t.Run("Convert unstructured to unstructured", func(t *testing.T) {
- uIn := &runtimetesting.Unstructured{Object: map[string]interface{}{
- "test": []interface{}{"other", "test"},
- }}
- uOut := &runtimetesting.Unstructured{}
- err = scheme.Convert(uIn, uOut, nil)
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
- if !reflect.DeepEqual(uIn.Object, uOut.Object) {
- t.Errorf("Unexpected object contents: %#v", uOut.Object)
- }
- })
- t.Run("Convert unstructured to structured", func(t *testing.T) {
- unstructuredObj := &runtimetesting.Unstructured{
- Object: map[string]interface{}{
- "testString": "bla",
- },
- }
- unstructuredObj.SetGroupVersionKind(externalGV.WithKind("Simple"))
- externalOut := &runtimetesting.ExternalSimple{}
- err = scheme.Convert(unstructuredObj, externalOut, nil)
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
- if externalOut.TestString != "bla" {
- t.Errorf("Unexpected object contents: %#v", externalOut)
- }
- })
- t.Run("Encode and Convert should each have caused an increment", func(t *testing.T) {
- if e, a := 3, internalToExternalCalls; e != a {
- t.Errorf("Expected %v, got %v", e, a)
- }
- })
- t.Run("DecodeInto and Decode should each have caused an increment because of a conversion", func(t *testing.T) {
- if e, a := 2, externalToInternalCalls; e != a {
- t.Errorf("Expected %v, got %v", e, a)
- }
- })
- t.Run("Verify that unstructured types must have V and K set", func(t *testing.T) {
- emptyObj := &runtimetesting.Unstructured{Object: make(map[string]interface{})}
- if _, _, err := scheme.ObjectKinds(emptyObj); !runtime.IsMissingKind(err) {
- t.Errorf("unexpected error: %v", err)
- }
- emptyObj.SetGroupVersionKind(schema.GroupVersionKind{Kind: "Test"})
- if _, _, err := scheme.ObjectKinds(emptyObj); !runtime.IsMissingVersion(err) {
- t.Errorf("unexpected error: %v", err)
- }
- emptyObj.SetGroupVersionKind(schema.GroupVersionKind{Kind: "Test", Version: "v1"})
- if _, _, err := scheme.ObjectKinds(emptyObj); err != nil {
- t.Errorf("unexpected error: %v", err)
- }
- })
-}
-
-func TestBadJSONRejection(t *testing.T) {
- scheme := runtime.NewScheme()
- codecs := serializer.NewCodecFactory(scheme)
- info, _ := runtime.SerializerInfoForMediaType(codecs.SupportedMediaTypes(), runtime.ContentTypeJSON)
- jsonserializer := info.Serializer
-
- badJSONMissingKind := []byte(`{ }`)
- if _, err := runtime.Decode(jsonserializer, badJSONMissingKind); err == nil {
- t.Errorf("Did not reject despite lack of kind field: %s", badJSONMissingKind)
- }
- badJSONUnknownType := []byte(`{"kind": "bar"}`)
- if _, err1 := runtime.Decode(jsonserializer, badJSONUnknownType); err1 == nil {
- t.Errorf("Did not reject despite use of unknown type: %s", badJSONUnknownType)
- }
- /*badJSONKindMismatch := []byte(`{"kind": "Pod"}`)
- if err2 := DecodeInto(badJSONKindMismatch, &Node{}); err2 == nil {
- t.Errorf("Kind is set but doesn't match the object type: %s", badJSONKindMismatch)
- }*/
-}
-
-func TestExternalToInternalMapping(t *testing.T) {
- internalGV := schema.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal}
- externalGV := schema.GroupVersion{Group: "test.group", Version: "testExternal"}
-
- scheme := runtime.NewScheme()
- scheme.AddKnownTypeWithName(internalGV.WithKind("OptionalExtensionType"), &runtimetesting.InternalOptionalExtensionType{})
- scheme.AddKnownTypeWithName(externalGV.WithKind("OptionalExtensionType"), &runtimetesting.ExternalOptionalExtensionType{})
-
- codec := serializer.NewCodecFactory(scheme).LegacyCodec(externalGV)
-
- table := []struct {
- obj runtime.Object
- encoded string
- }{
- {
- &runtimetesting.InternalOptionalExtensionType{Extension: nil},
- `{"kind":"OptionalExtensionType","apiVersion":"` + externalGV.String() + `"}`,
- },
- }
-
- for i, item := range table {
- gotDecoded, err := runtime.Decode(codec, []byte(item.encoded))
- if err != nil {
- t.Errorf("unexpected error '%v' (%v)", err, item.encoded)
- } else if e, a := item.obj, gotDecoded; !reflect.DeepEqual(e, a) {
- t.Errorf("%d: unexpected objects:\n%s", i, diff.ObjectGoPrintSideBySide(e, a))
- }
- }
-}
-
-func TestExtensionMapping(t *testing.T) {
- internalGV := schema.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal}
- externalGV := schema.GroupVersion{Group: "test.group", Version: "testExternal"}
-
- scheme := runtime.NewScheme()
- scheme.AddKnownTypeWithName(internalGV.WithKind("ExtensionType"), &runtimetesting.InternalExtensionType{})
- scheme.AddKnownTypeWithName(internalGV.WithKind("OptionalExtensionType"), &runtimetesting.InternalOptionalExtensionType{})
- scheme.AddKnownTypeWithName(externalGV.WithKind("ExtensionType"), &runtimetesting.ExternalExtensionType{})
- scheme.AddKnownTypeWithName(externalGV.WithKind("OptionalExtensionType"), &runtimetesting.ExternalOptionalExtensionType{})
-
- // register external first when the object is the same in both schemes, so ObjectVersionAndKind reports the
- // external version.
- scheme.AddKnownTypeWithName(externalGV.WithKind("A"), &runtimetesting.ExtensionA{})
- scheme.AddKnownTypeWithName(externalGV.WithKind("B"), &runtimetesting.ExtensionB{})
- scheme.AddKnownTypeWithName(internalGV.WithKind("A"), &runtimetesting.ExtensionA{})
- scheme.AddKnownTypeWithName(internalGV.WithKind("B"), &runtimetesting.ExtensionB{})
-
- codec := serializer.NewCodecFactory(scheme).LegacyCodec(externalGV)
-
- table := []struct {
- obj runtime.Object
- expected runtime.Object
- encoded string
- }{
- {
- &runtimetesting.InternalExtensionType{
- Extension: runtime.NewEncodable(codec, &runtimetesting.ExtensionA{TestString: "foo"}),
- },
- &runtimetesting.InternalExtensionType{
- Extension: &runtime.Unknown{
- Raw: []byte(`{"apiVersion":"test.group/testExternal","kind":"A","testString":"foo"}`),
- ContentType: runtime.ContentTypeJSON,
- },
- },
- // apiVersion is set in the serialized object for easier consumption by clients
- `{"apiVersion":"` + externalGV.String() + `","kind":"ExtensionType","extension":{"apiVersion":"test.group/testExternal","kind":"A","testString":"foo"}}
-`,
- }, {
- &runtimetesting.InternalExtensionType{Extension: runtime.NewEncodable(codec, &runtimetesting.ExtensionB{TestString: "bar"})},
- &runtimetesting.InternalExtensionType{
- Extension: &runtime.Unknown{
- Raw: []byte(`{"apiVersion":"test.group/testExternal","kind":"B","testString":"bar"}`),
- ContentType: runtime.ContentTypeJSON,
- },
- },
- // apiVersion is set in the serialized object for easier consumption by clients
- `{"apiVersion":"` + externalGV.String() + `","kind":"ExtensionType","extension":{"apiVersion":"test.group/testExternal","kind":"B","testString":"bar"}}
-`,
- }, {
- &runtimetesting.InternalExtensionType{Extension: nil},
- &runtimetesting.InternalExtensionType{
- Extension: nil,
- },
- `{"apiVersion":"` + externalGV.String() + `","kind":"ExtensionType","extension":null}
-`,
- },
- }
-
- for i, item := range table {
- gotEncoded, err := runtime.Encode(codec, item.obj)
- if err != nil {
- t.Errorf("unexpected error '%v' (%#v)", err, item.obj)
- } else if e, a := item.encoded, string(gotEncoded); e != a {
- t.Errorf("expected\n%#v\ngot\n%#v\n", e, a)
- }
-
- gotDecoded, err := runtime.Decode(codec, []byte(item.encoded))
- if err != nil {
- t.Errorf("unexpected error '%v' (%v)", err, item.encoded)
- } else if e, a := item.expected, gotDecoded; !reflect.DeepEqual(e, a) {
- t.Errorf("%d: unexpected objects:\n%s", i, diff.ObjectGoPrintSideBySide(e, a))
- }
- }
-}
-
-func TestEncode(t *testing.T) {
- internalGV := schema.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal}
- internalGVK := internalGV.WithKind("Simple")
- externalGV := schema.GroupVersion{Group: "test.group", Version: "testExternal"}
- externalGVK := externalGV.WithKind("Simple")
-
- scheme := runtime.NewScheme()
- scheme.AddKnownTypeWithName(internalGVK, &runtimetesting.InternalSimple{})
- scheme.AddKnownTypeWithName(externalGVK, &runtimetesting.ExternalSimple{})
-
- codec := serializer.NewCodecFactory(scheme).LegacyCodec(externalGV)
-
- test := &runtimetesting.InternalSimple{
- TestString: "I'm the same",
- }
- obj := runtime.Object(test)
- data, err := runtime.Encode(codec, obj)
- obj2, gvk, err2 := codec.Decode(data, nil, nil)
- if err != nil || err2 != nil {
- t.Fatalf("Failure: '%v' '%v'", err, err2)
- }
- if _, ok := obj2.(*runtimetesting.InternalSimple); !ok {
- t.Fatalf("Got wrong type")
- }
- if !reflect.DeepEqual(obj2, test) {
- t.Errorf("Expected:\n %#v,\n Got:\n %#v", test, obj2)
- }
- if *gvk != externalGVK {
- t.Errorf("unexpected gvk returned by decode: %#v", *gvk)
- }
-}
-
-func TestUnversionedTypes(t *testing.T) {
- internalGV := schema.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal}
- internalGVK := internalGV.WithKind("Simple")
- externalGV := schema.GroupVersion{Group: "test.group", Version: "testExternal"}
- externalGVK := externalGV.WithKind("Simple")
- otherGV := schema.GroupVersion{Group: "group", Version: "other"}
-
- scheme := runtime.NewScheme()
- scheme.AddUnversionedTypes(externalGV, &runtimetesting.InternalSimple{})
- scheme.AddKnownTypeWithName(internalGVK, &runtimetesting.InternalSimple{})
- scheme.AddKnownTypeWithName(externalGVK, &runtimetesting.ExternalSimple{})
- scheme.AddKnownTypeWithName(otherGV.WithKind("Simple"), &runtimetesting.ExternalSimple{})
-
- codec := serializer.NewCodecFactory(scheme).LegacyCodec(externalGV)
-
- if unv, ok := scheme.IsUnversioned(&runtimetesting.InternalSimple{}); !unv || !ok {
- t.Fatalf("type not unversioned and in scheme: %t %t", unv, ok)
- }
-
- kinds, _, err := scheme.ObjectKinds(&runtimetesting.InternalSimple{})
- if err != nil {
- t.Fatal(err)
- }
- kind := kinds[0]
- if kind != externalGV.WithKind("InternalSimple") {
- t.Fatalf("unexpected: %#v", kind)
- }
-
- test := &runtimetesting.InternalSimple{
- TestString: "I'm the same",
- }
- obj := runtime.Object(test)
- data, err := runtime.Encode(codec, obj)
- if err != nil {
- t.Fatal(err)
- }
- obj2, gvk, err := codec.Decode(data, nil, nil)
- if err != nil {
- t.Fatal(err)
- }
- if _, ok := obj2.(*runtimetesting.InternalSimple); !ok {
- t.Fatalf("Got wrong type")
- }
- if !reflect.DeepEqual(obj2, test) {
- t.Errorf("Expected:\n %#v,\n Got:\n %#v", test, obj2)
- }
- // object is serialized as an unversioned object (in the group and version it was defined in)
- if *gvk != externalGV.WithKind("InternalSimple") {
- t.Errorf("unexpected gvk returned by decode: %#v", *gvk)
- }
-
- // when serialized to a different group, the object is kept in its preferred name
- codec = serializer.NewCodecFactory(scheme).LegacyCodec(otherGV)
- data, err = runtime.Encode(codec, obj)
- if err != nil {
- t.Fatal(err)
- }
- if string(data) != `{"apiVersion":"test.group/testExternal","kind":"InternalSimple","testString":"I'm the same"}`+"\n" {
- t.Errorf("unexpected data: %s", data)
- }
-}
-
-// TestObjectFuzzer can randomly populate all the above objects.
-var TestObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 100).Funcs(
- func(j *runtimetesting.MyWeirdCustomEmbeddedVersionKindField, c fuzz.Continue) {
- // We have to customize the randomization of MyWeirdCustomEmbeddedVersionKindFields because their
- // APIVersion and Kind must remain blank in memory.
- j.APIVersion = ""
- j.ObjectKind = ""
- j.ID = c.RandString()
- },
-)
-
-// Returns a new Scheme set up with the test objects.
-func GetTestScheme() *runtime.Scheme {
- internalGV := schema.GroupVersion{Version: runtime.APIVersionInternal}
- externalGV := schema.GroupVersion{Version: "v1"}
- alternateExternalGV := schema.GroupVersion{Group: "custom", Version: "v1"}
- alternateInternalGV := schema.GroupVersion{Group: "custom", Version: runtime.APIVersionInternal}
- differentExternalGV := schema.GroupVersion{Group: "other", Version: "v2"}
-
- s := runtime.NewScheme()
- // Ordinarily, we wouldn't add TestType2, but because this is a test and
- // both types are from the same package, we need to get it into the system
- // so that converter will match it with ExternalType2.
- s.AddKnownTypes(internalGV, &runtimetesting.TestType1{}, &runtimetesting.TestType2{}, &runtimetesting.ExternalInternalSame{})
- s.AddKnownTypes(externalGV, &runtimetesting.ExternalInternalSame{})
- s.AddKnownTypeWithName(externalGV.WithKind("TestType1"), &runtimetesting.ExternalTestType1{})
- s.AddKnownTypeWithName(externalGV.WithKind("TestType2"), &runtimetesting.ExternalTestType2{})
- s.AddKnownTypeWithName(internalGV.WithKind("TestType3"), &runtimetesting.TestType1{})
- s.AddKnownTypeWithName(externalGV.WithKind("TestType3"), &runtimetesting.ExternalTestType1{})
- s.AddKnownTypeWithName(externalGV.WithKind("TestType4"), &runtimetesting.ExternalTestType1{})
- s.AddKnownTypeWithName(alternateInternalGV.WithKind("TestType3"), &runtimetesting.TestType1{})
- s.AddKnownTypeWithName(alternateExternalGV.WithKind("TestType3"), &runtimetesting.ExternalTestType1{})
- s.AddKnownTypeWithName(alternateExternalGV.WithKind("TestType5"), &runtimetesting.ExternalTestType1{})
- s.AddKnownTypeWithName(differentExternalGV.WithKind("TestType1"), &runtimetesting.ExternalTestType1{})
- s.AddUnversionedTypes(externalGV, &runtimetesting.UnversionedType{})
-
- s.AddConversionFuncs(func(in *runtimetesting.TestType1, out *runtimetesting.ExternalTestType1, s conversion.Scope) {
- out.A = in.A
- })
- return s
-}
-
-func TestKnownTypes(t *testing.T) {
- s := GetTestScheme()
- if len(s.KnownTypes(schema.GroupVersion{Group: "group", Version: "v2"})) != 0 {
- t.Errorf("should have no known types for v2")
- }
-
- types := s.KnownTypes(schema.GroupVersion{Version: "v1"})
- for _, s := range []string{"TestType1", "TestType2", "TestType3", "ExternalInternalSame"} {
- if _, ok := types[s]; !ok {
- t.Errorf("missing type %q", s)
- }
- }
-}
-
-func TestAddKnownTypesIdemPotent(t *testing.T) {
- s := runtime.NewScheme()
-
- gv := schema.GroupVersion{Group: "foo", Version: "v1"}
- s.AddKnownTypes(gv, &runtimetesting.InternalSimple{})
- s.AddKnownTypes(gv, &runtimetesting.InternalSimple{})
- if len(s.KnownTypes(gv)) != 1 {
- t.Errorf("expected only one %v type after double registration", gv)
- }
- if len(s.AllKnownTypes()) != 1 {
- t.Errorf("expected only one type after double registration")
- }
-
- s.AddKnownTypeWithName(gv.WithKind("InternalSimple"), &runtimetesting.InternalSimple{})
- s.AddKnownTypeWithName(gv.WithKind("InternalSimple"), &runtimetesting.InternalSimple{})
- if len(s.KnownTypes(gv)) != 1 {
- t.Errorf("expected only one %v type after double registration with custom name", gv)
- }
- if len(s.AllKnownTypes()) != 1 {
- t.Errorf("expected only one type after double registration with custom name")
- }
-
- s.AddUnversionedTypes(gv, &runtimetesting.InternalSimple{})
- s.AddUnversionedTypes(gv, &runtimetesting.InternalSimple{})
- if len(s.KnownTypes(gv)) != 1 {
- t.Errorf("expected only one %v type after double registration with custom name", gv)
- }
- if len(s.AllKnownTypes()) != 1 {
- t.Errorf("expected only one type after double registration with custom name")
- }
-
- kinds, _, err := s.ObjectKinds(&runtimetesting.InternalSimple{})
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- if len(kinds) != 1 {
- t.Errorf("expected only one kind for InternalSimple after double registration")
- }
-}
-
-// redefine InternalSimple with the same name, but obviously as a different type than in runtimetesting
-type InternalSimple struct {
- runtime.TypeMeta `json:",inline"`
- TestString string `json:"testString"`
-}
-
-func (s *InternalSimple) DeepCopyObject() runtime.Object { return nil }
-
-func TestConflictingAddKnownTypes(t *testing.T) {
- s := runtime.NewScheme()
- gv := schema.GroupVersion{Group: "foo", Version: "v1"}
-
- panicked := make(chan bool)
- go func() {
- defer func() {
- if recover() != nil {
- panicked <- true
- }
- }()
- s.AddKnownTypeWithName(gv.WithKind("InternalSimple"), &runtimetesting.InternalSimple{})
- s.AddKnownTypeWithName(gv.WithKind("InternalSimple"), &runtimetesting.ExternalSimple{})
- panicked <- false
- }()
- if !<-panicked {
- t.Errorf("Expected AddKnownTypesWithName to panic with conflicting type registrations")
- }
-
- go func() {
- defer func() {
- if recover() != nil {
- panicked <- true
- }
- }()
-
- s.AddUnversionedTypes(gv, &runtimetesting.InternalSimple{})
- s.AddUnversionedTypes(gv, &InternalSimple{})
- panicked <- false
- }()
- if !<-panicked {
- t.Errorf("Expected AddUnversionedTypes to panic with conflicting type registrations")
- }
-}
-
-func TestConvertToVersionBasic(t *testing.T) {
- s := GetTestScheme()
- tt := &runtimetesting.TestType1{A: "I'm not a pointer object"}
- other, err := s.ConvertToVersion(tt, schema.GroupVersion{Version: "v1"})
- if err != nil {
- t.Fatalf("Failure: %v", err)
- }
- converted, ok := other.(*runtimetesting.ExternalTestType1)
- if !ok {
- t.Fatalf("Got wrong type: %T", other)
- }
- if tt.A != converted.A {
- t.Fatalf("Failed to convert object correctly: %#v", converted)
- }
-}
-
-type testGroupVersioner struct {
- target schema.GroupVersionKind
- ok bool
-}
-
-func (m testGroupVersioner) KindForGroupVersionKinds(kinds []schema.GroupVersionKind) (schema.GroupVersionKind, bool) {
- return m.target, m.ok
-}
-
-func TestConvertToVersion(t *testing.T) {
- testCases := []struct {
- scheme *runtime.Scheme
- in runtime.Object
- gv runtime.GroupVersioner
- same bool
- out runtime.Object
- errFn func(error) bool
- }{
- // errors if the type is not registered in the scheme
- {
- scheme: GetTestScheme(),
- in: &runtimetesting.UnknownType{},
- errFn: func(err error) bool { return err != nil && runtime.IsNotRegisteredError(err) },
- },
- // errors if the group versioner returns no target
- {
- scheme: GetTestScheme(),
- in: &runtimetesting.ExternalTestType1{A: "test"},
- gv: testGroupVersioner{},
- errFn: func(err error) bool {
- return err != nil && strings.Contains(err.Error(), "is not suitable for converting")
- },
- },
- // converts to internal
- {
- scheme: GetTestScheme(),
- in: &runtimetesting.ExternalTestType1{A: "test"},
- gv: schema.GroupVersion{Version: runtime.APIVersionInternal},
- out: &runtimetesting.TestType1{A: "test"},
- },
- // converts from unstructured to internal
- {
- scheme: GetTestScheme(),
- in: &runtimetesting.Unstructured{Object: map[string]interface{}{
- "apiVersion": "custom/v1",
- "kind": "TestType3",
- "A": "test",
- }},
- gv: schema.GroupVersion{Version: runtime.APIVersionInternal},
- out: &runtimetesting.TestType1{A: "test"},
- },
- // converts from unstructured to external
- {
- scheme: GetTestScheme(),
- in: &runtimetesting.Unstructured{Object: map[string]interface{}{
- "apiVersion": "custom/v1",
- "kind": "TestType3",
- "A": "test",
- }},
- gv: schema.GroupVersion{Group: "custom", Version: "v1"},
- out: &runtimetesting.ExternalTestType1{MyWeirdCustomEmbeddedVersionKindField: runtimetesting.MyWeirdCustomEmbeddedVersionKindField{APIVersion: "custom/v1", ObjectKind: "TestType3"}, A: "test"},
- },
- // prefers the best match
- {
- scheme: GetTestScheme(),
- in: &runtimetesting.ExternalTestType1{A: "test"},
- gv: schema.GroupVersions{{Version: runtime.APIVersionInternal}, {Version: "v1"}},
- out: &runtimetesting.ExternalTestType1{
- MyWeirdCustomEmbeddedVersionKindField: runtimetesting.MyWeirdCustomEmbeddedVersionKindField{APIVersion: "v1", ObjectKind: "TestType1"},
- A: "test",
- },
- },
- // unversioned type returned as-is
- {
- scheme: GetTestScheme(),
- in: &runtimetesting.UnversionedType{A: "test"},
- gv: schema.GroupVersions{{Version: "v1"}},
- same: true,
- out: &runtimetesting.UnversionedType{
- MyWeirdCustomEmbeddedVersionKindField: runtimetesting.MyWeirdCustomEmbeddedVersionKindField{APIVersion: "v1", ObjectKind: "UnversionedType"},
- A: "test",
- },
- },
- // unversioned type returned when not included in the target types
- {
- scheme: GetTestScheme(),
- in: &runtimetesting.UnversionedType{A: "test"},
- gv: schema.GroupVersions{{Group: "other", Version: "v2"}},
- same: true,
- out: &runtimetesting.UnversionedType{
- MyWeirdCustomEmbeddedVersionKindField: runtimetesting.MyWeirdCustomEmbeddedVersionKindField{APIVersion: "v1", ObjectKind: "UnversionedType"},
- A: "test",
- },
- },
- // detected as already being in the target version
- {
- scheme: GetTestScheme(),
- in: &runtimetesting.ExternalTestType1{A: "test"},
- gv: schema.GroupVersions{{Version: "v1"}},
- same: true,
- out: &runtimetesting.ExternalTestType1{
- MyWeirdCustomEmbeddedVersionKindField: runtimetesting.MyWeirdCustomEmbeddedVersionKindField{APIVersion: "v1", ObjectKind: "TestType1"},
- A: "test",
- },
- },
- // detected as already being in the first target version
- {
- scheme: GetTestScheme(),
- in: &runtimetesting.ExternalTestType1{A: "test"},
- gv: schema.GroupVersions{{Version: "v1"}, {Version: runtime.APIVersionInternal}},
- same: true,
- out: &runtimetesting.ExternalTestType1{
- MyWeirdCustomEmbeddedVersionKindField: runtimetesting.MyWeirdCustomEmbeddedVersionKindField{APIVersion: "v1", ObjectKind: "TestType1"},
- A: "test",
- },
- },
- // detected as already being in the first target version
- {
- scheme: GetTestScheme(),
- in: &runtimetesting.ExternalTestType1{A: "test"},
- gv: schema.GroupVersions{{Version: "v1"}, {Version: runtime.APIVersionInternal}},
- same: true,
- out: &runtimetesting.ExternalTestType1{
- MyWeirdCustomEmbeddedVersionKindField: runtimetesting.MyWeirdCustomEmbeddedVersionKindField{APIVersion: "v1", ObjectKind: "TestType1"},
- A: "test",
- },
- },
- // the external type is registered in multiple groups, versions, and kinds, and can be targeted to all of them (1/3): different kind
- {
- scheme: GetTestScheme(),
- in: &runtimetesting.ExternalTestType1{A: "test"},
- gv: testGroupVersioner{ok: true, target: schema.GroupVersionKind{Kind: "TestType3", Version: "v1"}},
- same: true,
- out: &runtimetesting.ExternalTestType1{
- MyWeirdCustomEmbeddedVersionKindField: runtimetesting.MyWeirdCustomEmbeddedVersionKindField{APIVersion: "v1", ObjectKind: "TestType3"},
- A: "test",
- },
- },
- // the external type is registered in multiple groups, versions, and kinds, and can be targeted to all of them (2/3): different gv
- {
- scheme: GetTestScheme(),
- in: &runtimetesting.ExternalTestType1{A: "test"},
- gv: testGroupVersioner{ok: true, target: schema.GroupVersionKind{Kind: "TestType3", Group: "custom", Version: "v1"}},
- same: true,
- out: &runtimetesting.ExternalTestType1{
- MyWeirdCustomEmbeddedVersionKindField: runtimetesting.MyWeirdCustomEmbeddedVersionKindField{APIVersion: "custom/v1", ObjectKind: "TestType3"},
- A: "test",
- },
- },
- // the external type is registered in multiple groups, versions, and kinds, and can be targeted to all of them (3/3): different gvk
- {
- scheme: GetTestScheme(),
- in: &runtimetesting.ExternalTestType1{A: "test"},
- gv: testGroupVersioner{ok: true, target: schema.GroupVersionKind{Group: "custom", Version: "v1", Kind: "TestType5"}},
- same: true,
- out: &runtimetesting.ExternalTestType1{
- MyWeirdCustomEmbeddedVersionKindField: runtimetesting.MyWeirdCustomEmbeddedVersionKindField{APIVersion: "custom/v1", ObjectKind: "TestType5"},
- A: "test",
- },
- },
- // multi group versioner recognizes multiple groups and forces the output to a particular version, copies because version differs
- {
- scheme: GetTestScheme(),
- in: &runtimetesting.ExternalTestType1{A: "test"},
- gv: runtime.NewMultiGroupVersioner(schema.GroupVersion{Group: "other", Version: "v2"}, schema.GroupKind{Group: "custom", Kind: "TestType3"}, schema.GroupKind{Kind: "TestType1"}),
- out: &runtimetesting.ExternalTestType1{
- MyWeirdCustomEmbeddedVersionKindField: runtimetesting.MyWeirdCustomEmbeddedVersionKindField{APIVersion: "other/v2", ObjectKind: "TestType1"},
- A: "test",
- },
- },
- // multi group versioner recognizes multiple groups and forces the output to a particular version, copies because version differs
- {
- scheme: GetTestScheme(),
- in: &runtimetesting.ExternalTestType1{A: "test"},
- gv: runtime.NewMultiGroupVersioner(schema.GroupVersion{Group: "other", Version: "v2"}, schema.GroupKind{Kind: "TestType1"}, schema.GroupKind{Group: "custom", Kind: "TestType3"}),
- out: &runtimetesting.ExternalTestType1{
- MyWeirdCustomEmbeddedVersionKindField: runtimetesting.MyWeirdCustomEmbeddedVersionKindField{APIVersion: "other/v2", ObjectKind: "TestType1"},
- A: "test",
- },
- },
- // multi group versioner is unable to find a match when kind AND group don't match (there is no TestType1 kind in group "other", and no kind "TestType5" in the default group)
- {
- scheme: GetTestScheme(),
- in: &runtimetesting.TestType1{A: "test"},
- gv: runtime.NewMultiGroupVersioner(schema.GroupVersion{Group: "custom", Version: "v1"}, schema.GroupKind{Group: "other"}, schema.GroupKind{Kind: "TestType5"}),
- errFn: func(err error) bool {
- return err != nil && strings.Contains(err.Error(), "is not suitable for converting")
- },
- },
- // multi group versioner recognizes multiple groups and forces the output to a particular version, performs no copy
- {
- scheme: GetTestScheme(),
- in: &runtimetesting.ExternalTestType1{A: "test"},
- gv: runtime.NewMultiGroupVersioner(schema.GroupVersion{Group: "", Version: "v1"}, schema.GroupKind{Group: "custom", Kind: "TestType3"}, schema.GroupKind{Kind: "TestType1"}),
- same: true,
- out: &runtimetesting.ExternalTestType1{
- MyWeirdCustomEmbeddedVersionKindField: runtimetesting.MyWeirdCustomEmbeddedVersionKindField{APIVersion: "v1", ObjectKind: "TestType1"},
- A: "test",
- },
- },
- // multi group versioner recognizes multiple groups and forces the output to a particular version, performs no copy
- {
- scheme: GetTestScheme(),
- in: &runtimetesting.ExternalTestType1{A: "test"},
- gv: runtime.NewMultiGroupVersioner(schema.GroupVersion{Group: "", Version: "v1"}, schema.GroupKind{Kind: "TestType1"}, schema.GroupKind{Group: "custom", Kind: "TestType3"}),
- same: true,
- out: &runtimetesting.ExternalTestType1{
- MyWeirdCustomEmbeddedVersionKindField: runtimetesting.MyWeirdCustomEmbeddedVersionKindField{APIVersion: "v1", ObjectKind: "TestType1"},
- A: "test",
- },
- },
- // group versioner can choose a particular target kind for a given input when kind is the same across group versions
- {
- scheme: GetTestScheme(),
- in: &runtimetesting.TestType1{A: "test"},
- gv: testGroupVersioner{ok: true, target: schema.GroupVersionKind{Version: "v1", Kind: "TestType3"}},
- out: &runtimetesting.ExternalTestType1{
- MyWeirdCustomEmbeddedVersionKindField: runtimetesting.MyWeirdCustomEmbeddedVersionKindField{APIVersion: "v1", ObjectKind: "TestType3"},
- A: "test",
- },
- },
- // group versioner can choose a different kind
- {
- scheme: GetTestScheme(),
- in: &runtimetesting.TestType1{A: "test"},
- gv: testGroupVersioner{ok: true, target: schema.GroupVersionKind{Kind: "TestType5", Group: "custom", Version: "v1"}},
- out: &runtimetesting.ExternalTestType1{
- MyWeirdCustomEmbeddedVersionKindField: runtimetesting.MyWeirdCustomEmbeddedVersionKindField{APIVersion: "custom/v1", ObjectKind: "TestType5"},
- A: "test",
- },
- },
- }
- for i, test := range testCases {
- t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
- original := test.in.DeepCopyObject()
- out, err := test.scheme.ConvertToVersion(test.in, test.gv)
- switch {
- case test.errFn != nil:
- if !test.errFn(err) {
- t.Fatalf("unexpected error: %v", err)
- }
- return
- case err != nil:
- t.Fatalf("unexpected error: %v", err)
- }
- if out == test.in {
- t.Fatalf("ConvertToVersion should always copy out: %#v", out)
- }
-
- if test.same {
- if !reflect.DeepEqual(original, test.in) {
- t.Fatalf("unexpected mutation of input: %s", diff.ObjectReflectDiff(original, test.in))
- }
- if !reflect.DeepEqual(out, test.out) {
- t.Fatalf("unexpected out: %s", diff.ObjectReflectDiff(out, test.out))
- }
- unsafe, err := test.scheme.UnsafeConvertToVersion(test.in, test.gv)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- if !reflect.DeepEqual(unsafe, test.out) {
- t.Fatalf("unexpected unsafe: %s", diff.ObjectReflectDiff(unsafe, test.out))
- }
- if unsafe != test.in {
- t.Fatalf("UnsafeConvertToVersion should return same object: %#v", unsafe)
- }
- return
- }
- if !reflect.DeepEqual(out, test.out) {
- t.Fatalf("unexpected out: %s", diff.ObjectReflectDiff(out, test.out))
- }
- })
- }
-}
-
-func TestConvert(t *testing.T) {
- testCases := []struct {
- scheme *runtime.Scheme
- in runtime.Object
- into runtime.Object
- gv runtime.GroupVersioner
- out runtime.Object
- errFn func(error) bool
- }{
- // converts from internal to unstructured, given a target version
- {
- scheme: GetTestScheme(),
- in: &runtimetesting.TestType1{A: "test"},
- into: &runtimetesting.Unstructured{},
- out: &runtimetesting.Unstructured{Object: map[string]interface{}{
- "myVersionKey": "custom/v1",
- "myKindKey": "TestType3",
- "A": "test",
- }},
- gv: schema.GroupVersion{Group: "custom", Version: "v1"},
- },
- }
- for i, test := range testCases {
- t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
- err := test.scheme.Convert(test.in, test.into, test.gv)
- switch {
- case test.errFn != nil:
- if !test.errFn(err) {
- t.Fatalf("unexpected error: %v", err)
- }
- return
- case err != nil:
- t.Fatalf("unexpected error: %v", err)
- return
- }
-
- if !reflect.DeepEqual(test.into, test.out) {
- t.Fatalf("unexpected out: %s", diff.ObjectReflectDiff(test.into, test.out))
- }
- })
- }
-}
-
-func TestMetaValues(t *testing.T) {
- internalGV := schema.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal}
- externalGV := schema.GroupVersion{Group: "test.group", Version: "externalVersion"}
-
- s := runtime.NewScheme()
- s.AddKnownTypeWithName(internalGV.WithKind("Simple"), &runtimetesting.InternalSimple{})
- s.AddKnownTypeWithName(externalGV.WithKind("Simple"), &runtimetesting.ExternalSimple{})
-
- internalToExternalCalls := 0
- externalToInternalCalls := 0
-
- // Register functions to verify that scope.Meta() gets set correctly.
- err := s.AddConversionFuncs(
- func(in *runtimetesting.InternalSimple, out *runtimetesting.ExternalSimple, scope conversion.Scope) error {
- t.Logf("internal -> external")
- scope.Convert(&in.TestString, &out.TestString, 0)
- internalToExternalCalls++
- return nil
- },
- func(in *runtimetesting.ExternalSimple, out *runtimetesting.InternalSimple, scope conversion.Scope) error {
- t.Logf("external -> internal")
- scope.Convert(&in.TestString, &out.TestString, 0)
- externalToInternalCalls++
- return nil
- },
- )
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- simple := &runtimetesting.InternalSimple{
- TestString: "foo",
- }
-
- s.Log(t)
-
- out, err := s.ConvertToVersion(simple, externalGV)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
-
- internal, err := s.ConvertToVersion(out, internalGV)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
-
- if e, a := simple, internal; !reflect.DeepEqual(e, a) {
- t.Errorf("Expected:\n %#v,\n Got:\n %#v", e, a)
- }
-
- if e, a := 1, internalToExternalCalls; e != a {
- t.Errorf("Expected %v, got %v", e, a)
- }
- if e, a := 1, externalToInternalCalls; e != a {
- t.Errorf("Expected %v, got %v", e, a)
- }
-}
-
-func TestMetaValuesUnregisteredConvert(t *testing.T) {
- type InternalSimple struct {
- Version string `json:"apiVersion,omitempty"`
- Kind string `json:"kind,omitempty"`
- TestString string `json:"testString"`
- }
- type ExternalSimple struct {
- Version string `json:"apiVersion,omitempty"`
- Kind string `json:"kind,omitempty"`
- TestString string `json:"testString"`
- }
- s := runtime.NewScheme()
- // We deliberately don't register the types.
-
- internalToExternalCalls := 0
-
- // Register functions to verify that scope.Meta() gets set correctly.
- err := s.AddConversionFuncs(
- func(in *InternalSimple, out *ExternalSimple, scope conversion.Scope) error {
- scope.Convert(&in.TestString, &out.TestString, 0)
- internalToExternalCalls++
- return nil
- },
- )
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
-
- simple := &InternalSimple{TestString: "foo"}
- external := &ExternalSimple{}
- err = s.Convert(simple, external, nil)
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
- if e, a := simple.TestString, external.TestString; e != a {
- t.Errorf("Expected %v, got %v", e, a)
- }
-
- // Verify that our conversion handler got called.
- if e, a := 1, internalToExternalCalls; e != a {
- t.Errorf("Expected %v, got %v", e, a)
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/codec_test.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/codec_test.go
deleted file mode 100644
index d27da113a..000000000
--- a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/codec_test.go
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package serializer
-
-import (
- "encoding/json"
- "fmt"
- "log"
- "os"
- "reflect"
- "strings"
- "testing"
-
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/conversion"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- serializertesting "k8s.io/apimachinery/pkg/runtime/serializer/testing"
- "k8s.io/apimachinery/pkg/util/diff"
-
- "github.com/ghodss/yaml"
- "github.com/google/gofuzz"
- flag "github.com/spf13/pflag"
-)
-
-var fuzzIters = flag.Int("fuzz-iters", 50, "How many fuzzing iterations to do.")
-
-type testMetaFactory struct{}
-
-func (testMetaFactory) Interpret(data []byte) (*schema.GroupVersionKind, error) {
- findKind := struct {
- APIVersion string `json:"myVersionKey,omitempty"`
- ObjectKind string `json:"myKindKey,omitempty"`
- }{}
- // yaml is a superset of json, so we use it to decode here. That way,
- // we understand both.
- if err := yaml.Unmarshal(data, &findKind); err != nil {
- return nil, fmt.Errorf("couldn't get version/kind: %v", err)
- }
- gv, err := schema.ParseGroupVersion(findKind.APIVersion)
- if err != nil {
- return nil, err
- }
- return &schema.GroupVersionKind{Group: gv.Group, Version: gv.Version, Kind: findKind.ObjectKind}, nil
-}
-
-// TestObjectFuzzer can randomly populate all the above objects.
-var TestObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 100).Funcs(
- func(j *serializertesting.MyWeirdCustomEmbeddedVersionKindField, c fuzz.Continue) {
- c.FuzzNoCustom(j)
- j.APIVersion = ""
- j.ObjectKind = ""
- },
-)
-
-// Returns a new Scheme set up with the test objects.
-func GetTestScheme() (*runtime.Scheme, runtime.Codec) {
- internalGV := schema.GroupVersion{Version: runtime.APIVersionInternal}
- externalGV := schema.GroupVersion{Version: "v1"}
- externalGV2 := schema.GroupVersion{Version: "v2"}
-
- s := runtime.NewScheme()
- // Ordinarily, we wouldn't add TestType2, but because this is a test and
- // both types are from the same package, we need to get it into the system
- // so that converter will match it with ExternalType2.
- s.AddKnownTypes(internalGV, &serializertesting.TestType1{}, &serializertesting.TestType2{}, &serializertesting.ExternalInternalSame{})
- s.AddKnownTypes(externalGV, &serializertesting.ExternalInternalSame{})
- s.AddKnownTypeWithName(externalGV.WithKind("TestType1"), &serializertesting.ExternalTestType1{})
- s.AddKnownTypeWithName(externalGV.WithKind("TestType2"), &serializertesting.ExternalTestType2{})
- s.AddKnownTypeWithName(internalGV.WithKind("TestType3"), &serializertesting.TestType1{})
- s.AddKnownTypeWithName(externalGV.WithKind("TestType3"), &serializertesting.ExternalTestType1{})
- s.AddKnownTypeWithName(externalGV2.WithKind("TestType1"), &serializertesting.ExternalTestType1{})
-
- s.AddUnversionedTypes(externalGV, &metav1.Status{})
-
- cf := newCodecFactory(s, newSerializersForScheme(s, testMetaFactory{}))
- codec := cf.LegacyCodec(schema.GroupVersion{Version: "v1"})
- return s, codec
-}
-
-var semantic = conversion.EqualitiesOrDie(
- func(a, b serializertesting.MyWeirdCustomEmbeddedVersionKindField) bool {
- a.APIVersion, a.ObjectKind = "", ""
- b.APIVersion, b.ObjectKind = "", ""
- return a == b
- },
-)
-
-func runTest(t *testing.T, source interface{}) {
- name := reflect.TypeOf(source).Elem().Name()
- TestObjectFuzzer.Fuzz(source)
-
- _, codec := GetTestScheme()
- data, err := runtime.Encode(codec, source.(runtime.Object))
- if err != nil {
- t.Errorf("%v: %v (%#v)", name, err, source)
- return
- }
- obj2, err := runtime.Decode(codec, data)
- if err != nil {
- t.Errorf("%v: %v (%v)", name, err, string(data))
- return
- }
- if !semantic.DeepEqual(source, obj2) {
- t.Errorf("1: %v: diff: %v", name, diff.ObjectGoPrintSideBySide(source, obj2))
- return
- }
- obj3 := reflect.New(reflect.TypeOf(source).Elem()).Interface()
- if err := runtime.DecodeInto(codec, data, obj3.(runtime.Object)); err != nil {
- t.Errorf("2: %v: %v", name, err)
- return
- }
- if !semantic.DeepEqual(source, obj3) {
- t.Errorf("3: %v: diff: %v", name, diff.ObjectDiff(source, obj3))
- return
- }
-}
-
-func TestTypes(t *testing.T) {
- table := []interface{}{
- &serializertesting.TestType1{},
- &serializertesting.ExternalInternalSame{},
- }
- for _, item := range table {
- // Try a few times, since runTest uses random values.
- for i := 0; i < *fuzzIters; i++ {
- runTest(t, item)
- }
- }
-}
-
-func TestVersionedEncoding(t *testing.T) {
- s, _ := GetTestScheme()
- cf := newCodecFactory(s, newSerializersForScheme(s, testMetaFactory{}))
- info, _ := runtime.SerializerInfoForMediaType(cf.SupportedMediaTypes(), runtime.ContentTypeJSON)
- encoder := info.Serializer
-
- codec := cf.CodecForVersions(encoder, nil, schema.GroupVersion{Version: "v2"}, nil)
- out, err := runtime.Encode(codec, &serializertesting.TestType1{})
- if err != nil {
- t.Fatal(err)
- }
- if string(out) != `{"myVersionKey":"v2","myKindKey":"TestType1"}`+"\n" {
- t.Fatal(string(out))
- }
-
- codec = cf.CodecForVersions(encoder, nil, schema.GroupVersion{Version: "v3"}, nil)
- _, err = runtime.Encode(codec, &serializertesting.TestType1{})
- if err == nil {
- t.Fatal(err)
- }
-
- // unversioned encode with no versions is written directly to wire
- codec = cf.CodecForVersions(encoder, nil, runtime.InternalGroupVersioner, nil)
- out, err = runtime.Encode(codec, &serializertesting.TestType1{})
- if err != nil {
- t.Fatal(err)
- }
- if string(out) != `{}`+"\n" {
- t.Fatal(string(out))
- }
-}
-
-func TestMultipleNames(t *testing.T) {
- _, codec := GetTestScheme()
-
- obj, _, err := codec.Decode([]byte(`{"myKindKey":"TestType3","myVersionKey":"v1","A":"value"}`), nil, nil)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- internal := obj.(*serializertesting.TestType1)
- if internal.A != "value" {
- t.Fatalf("unexpected decoded object: %#v", internal)
- }
-
- out, err := runtime.Encode(codec, internal)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- if !strings.Contains(string(out), `"myKindKey":"TestType1"`) {
- t.Errorf("unexpected encoded output: %s", string(out))
- }
-}
-
-func TestConvertTypesWhenDefaultNamesMatch(t *testing.T) {
- internalGV := schema.GroupVersion{Version: runtime.APIVersionInternal}
- externalGV := schema.GroupVersion{Version: "v1"}
-
- s := runtime.NewScheme()
- // create two names internally, with TestType1 being preferred
- s.AddKnownTypeWithName(internalGV.WithKind("TestType1"), &serializertesting.TestType1{})
- s.AddKnownTypeWithName(internalGV.WithKind("OtherType1"), &serializertesting.TestType1{})
- // create two names externally, with TestType1 being preferred
- s.AddKnownTypeWithName(externalGV.WithKind("TestType1"), &serializertesting.ExternalTestType1{})
- s.AddKnownTypeWithName(externalGV.WithKind("OtherType1"), &serializertesting.ExternalTestType1{})
-
- ext := &serializertesting.ExternalTestType1{}
- ext.APIVersion = "v1"
- ext.ObjectKind = "OtherType1"
- ext.A = "test"
- data, err := json.Marshal(ext)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- expect := &serializertesting.TestType1{A: "test"}
-
- codec := newCodecFactory(s, newSerializersForScheme(s, testMetaFactory{})).LegacyCodec(schema.GroupVersion{Version: "v1"})
-
- obj, err := runtime.Decode(codec, data)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- if !semantic.DeepEqual(expect, obj) {
- t.Errorf("unexpected object: %#v", obj)
- }
-
- into := &serializertesting.TestType1{}
- if err := runtime.DecodeInto(codec, data, into); err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- if !semantic.DeepEqual(expect, into) {
- t.Errorf("unexpected object: %#v", obj)
- }
-}
-
-func TestEncode_Ptr(t *testing.T) {
- _, codec := GetTestScheme()
- tt := &serializertesting.TestType1{A: "I am a pointer object"}
- data, err := runtime.Encode(codec, tt)
- obj2, err2 := runtime.Decode(codec, data)
- if err != nil || err2 != nil {
- t.Fatalf("Failure: '%v' '%v'\n%s", err, err2, data)
- }
- if _, ok := obj2.(*serializertesting.TestType1); !ok {
- t.Fatalf("Got wrong type")
- }
- if !semantic.DeepEqual(obj2, tt) {
- t.Errorf("Expected:\n %#v,\n Got:\n %#v", tt, obj2)
- }
-}
-
-func TestBadJSONRejection(t *testing.T) {
- log.SetOutput(os.Stderr)
- _, codec := GetTestScheme()
- badJSONs := [][]byte{
- []byte(`{"myVersionKey":"v1"}`), // Missing kind
- []byte(`{"myVersionKey":"v1","myKindKey":"bar"}`), // Unknown kind
- []byte(`{"myVersionKey":"bar","myKindKey":"TestType1"}`), // Unknown version
- []byte(`{"myKindKey":"TestType1"}`), // Missing version
- }
- for _, b := range badJSONs {
- if _, err := runtime.Decode(codec, b); err == nil {
- t.Errorf("Did not reject bad json: %s", string(b))
- }
- }
- badJSONKindMismatch := []byte(`{"myVersionKey":"v1","myKindKey":"ExternalInternalSame"}`)
- if err := runtime.DecodeInto(codec, badJSONKindMismatch, &serializertesting.TestType1{}); err == nil {
- t.Errorf("Kind is set but doesn't match the object type: %s", badJSONKindMismatch)
- }
- if err := runtime.DecodeInto(codec, []byte(``), &serializertesting.TestType1{}); err != nil {
- t.Errorf("Should allow empty decode: %v", err)
- }
- if _, _, err := codec.Decode([]byte(``), &schema.GroupVersionKind{Kind: "ExternalInternalSame"}, nil); err == nil {
- t.Errorf("Did not give error for empty data with only kind default")
- }
- if _, _, err := codec.Decode([]byte(`{"myVersionKey":"v1"}`), &schema.GroupVersionKind{Kind: "ExternalInternalSame"}, nil); err != nil {
- t.Errorf("Gave error for version and kind default")
- }
- if _, _, err := codec.Decode([]byte(`{"myKindKey":"ExternalInternalSame"}`), &schema.GroupVersionKind{Version: "v1"}, nil); err != nil {
- t.Errorf("Gave error for version and kind default")
- }
- if _, _, err := codec.Decode([]byte(``), &schema.GroupVersionKind{Kind: "ExternalInternalSame", Version: "v1"}, nil); err != nil {
- t.Errorf("Gave error for version and kind defaulted: %v", err)
- }
- if _, err := runtime.Decode(codec, []byte(``)); err == nil {
- t.Errorf("Did not give error for empty data")
- }
-}
-
-// Returns a new Scheme set up with the test objects needed by TestDirectCodec.
-func GetDirectCodecTestScheme() *runtime.Scheme {
- internalGV := schema.GroupVersion{Version: runtime.APIVersionInternal}
- externalGV := schema.GroupVersion{Version: "v1"}
-
- s := runtime.NewScheme()
- // Ordinarily, we wouldn't add TestType2, but because this is a test and
- // both types are from the same package, we need to get it into the system
- // so that converter will match it with ExternalType2.
- s.AddKnownTypes(internalGV, &serializertesting.TestType1{})
- s.AddKnownTypes(externalGV, &serializertesting.ExternalTestType1{})
-
- s.AddUnversionedTypes(externalGV, &metav1.Status{})
- return s
-}
-
-func TestDirectCodec(t *testing.T) {
- s := GetDirectCodecTestScheme()
- cf := newCodecFactory(s, newSerializersForScheme(s, testMetaFactory{}))
- info, _ := runtime.SerializerInfoForMediaType(cf.SupportedMediaTypes(), runtime.ContentTypeJSON)
- serializer := info.Serializer
- df := DirectCodecFactory{cf}
- ignoredGV, err := schema.ParseGroupVersion("ignored group/ignored version")
- if err != nil {
- t.Fatal(err)
- }
- directEncoder := df.EncoderForVersion(serializer, ignoredGV)
- directDecoder := df.DecoderToVersion(serializer, ignoredGV)
- out, err := runtime.Encode(directEncoder, &serializertesting.ExternalTestType1{})
- if err != nil {
- t.Fatal(err)
- }
- if string(out) != `{"myVersionKey":"v1","myKindKey":"ExternalTestType1"}`+"\n" {
- t.Fatal(string(out))
- }
- a, _, err := directDecoder.Decode(out, nil, nil)
- e := &serializertesting.ExternalTestType1{
- MyWeirdCustomEmbeddedVersionKindField: serializertesting.MyWeirdCustomEmbeddedVersionKindField{
- APIVersion: "v1",
- ObjectKind: "ExternalTestType1",
- },
- }
- if !semantic.DeepEqual(e, a) {
- t.Fatalf("expect %v, got %v", e, a)
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/json_test.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/json_test.go
deleted file mode 100644
index b3d629a06..000000000
--- a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/json_test.go
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
-Copyright 2015 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package json_test
-
-import (
- "fmt"
- "reflect"
- "strings"
- "testing"
-
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/runtime/serializer/json"
- "k8s.io/apimachinery/pkg/util/diff"
-)
-
-type testDecodable struct {
- Other string
- Value int `json:"value"`
- Spec DecodableSpec `json:"spec"`
- gvk schema.GroupVersionKind
-}
-
-// DecodableSpec has 15 fields. json-iterator treats struct with more than 10
-// fields differently from struct that has less than 10 fields.
-type DecodableSpec struct {
- A int `json:"A"`
- B int `json:"B"`
- C int `json:"C"`
- D int `json:"D"`
- E int `json:"E"`
- F int `json:"F"`
- G int `json:"G"`
- H int `json:"h"`
- I int `json:"i"`
- J int `json:"j"`
- K int `json:"k"`
- L int `json:"l"`
- M int `json:"m"`
- N int `json:"n"`
- O int `json:"o"`
-}
-
-func (d *testDecodable) GetObjectKind() schema.ObjectKind { return d }
-func (d *testDecodable) SetGroupVersionKind(gvk schema.GroupVersionKind) { d.gvk = gvk }
-func (d *testDecodable) GroupVersionKind() schema.GroupVersionKind { return d.gvk }
-func (d *testDecodable) DeepCopyObject() runtime.Object {
- panic("testDecodable does not support DeepCopy")
-}
-
-func TestDecode(t *testing.T) {
- testCases := []struct {
- creater runtime.ObjectCreater
- typer runtime.ObjectTyper
- yaml bool
- pretty bool
-
- data []byte
- defaultGVK *schema.GroupVersionKind
- into runtime.Object
-
- errFn func(error) bool
- expectedObject runtime.Object
- expectedGVK *schema.GroupVersionKind
- }{
- {
- data: []byte("{}"),
-
- expectedGVK: &schema.GroupVersionKind{},
- errFn: func(err error) bool { return strings.Contains(err.Error(), "Object 'Kind' is missing in") },
- },
- {
- data: []byte("{}"),
- defaultGVK: &schema.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"},
- creater: &mockCreater{err: fmt.Errorf("fake error")},
-
- expectedGVK: &schema.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"},
- errFn: func(err error) bool { return err.Error() == "fake error" },
- },
- {
- data: []byte("{}"),
- defaultGVK: &schema.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"},
- creater: &mockCreater{obj: &testDecodable{}},
- expectedObject: &testDecodable{},
- expectedGVK: &schema.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"},
- },
-
- // version without group is not defaulted
- {
- data: []byte(`{"apiVersion":"blah"}`),
- defaultGVK: &schema.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"},
- creater: &mockCreater{obj: &testDecodable{}},
- expectedObject: &testDecodable{},
- expectedGVK: &schema.GroupVersionKind{Kind: "Test", Group: "", Version: "blah"},
- },
- // group without version is defaulted
- {
- data: []byte(`{"apiVersion":"other/"}`),
- defaultGVK: &schema.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"},
- creater: &mockCreater{obj: &testDecodable{}},
- expectedObject: &testDecodable{},
- expectedGVK: &schema.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"},
- },
- // group version, kind is defaulted
- {
- data: []byte(`{"apiVersion":"other1/blah1"}`),
- defaultGVK: &schema.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"},
- creater: &mockCreater{obj: &testDecodable{}},
- expectedObject: &testDecodable{},
- expectedGVK: &schema.GroupVersionKind{Kind: "Test", Group: "other1", Version: "blah1"},
- },
- // gvk all provided then not defaulted at all
- {
- data: []byte(`{"kind":"Test","apiVersion":"other/blah"}`),
- defaultGVK: &schema.GroupVersionKind{Kind: "Test1", Group: "other1", Version: "blah1"},
- creater: &mockCreater{obj: &testDecodable{}},
- expectedObject: &testDecodable{},
- expectedGVK: &schema.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"},
- },
- //gvk defaulting if kind not provided in data and defaultGVK use into's kind
- {
- data: []byte(`{"apiVersion":"b1/c1"}`),
- into: &testDecodable{gvk: schema.GroupVersionKind{Kind: "a3", Group: "b1", Version: "c1"}},
- typer: &mockTyper{gvk: &schema.GroupVersionKind{Kind: "a3", Group: "b1", Version: "c1"}},
- defaultGVK: nil,
- creater: &mockCreater{obj: &testDecodable{}},
- expectedObject: &testDecodable{gvk: schema.GroupVersionKind{Kind: "a3", Group: "b1", Version: "c1"}},
- expectedGVK: &schema.GroupVersionKind{Kind: "a3", Group: "b1", Version: "c1"},
- },
-
- // accept runtime.Unknown as into and bypass creator
- {
- data: []byte(`{}`),
- into: &runtime.Unknown{},
-
- expectedGVK: &schema.GroupVersionKind{},
- expectedObject: &runtime.Unknown{
- Raw: []byte(`{}`),
- ContentType: runtime.ContentTypeJSON,
- },
- },
- {
- data: []byte(`{"test":"object"}`),
- into: &runtime.Unknown{},
-
- expectedGVK: &schema.GroupVersionKind{},
- expectedObject: &runtime.Unknown{
- Raw: []byte(`{"test":"object"}`),
- ContentType: runtime.ContentTypeJSON,
- },
- },
- {
- data: []byte(`{"test":"object"}`),
- into: &runtime.Unknown{},
- defaultGVK: &schema.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"},
- expectedGVK: &schema.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"},
- expectedObject: &runtime.Unknown{
- TypeMeta: runtime.TypeMeta{APIVersion: "other/blah", Kind: "Test"},
- Raw: []byte(`{"test":"object"}`),
- ContentType: runtime.ContentTypeJSON,
- },
- },
-
- // unregistered objects can be decoded into directly
- {
- data: []byte(`{"kind":"Test","apiVersion":"other/blah","value":1,"Other":"test"}`),
- into: &testDecodable{},
- typer: &mockTyper{err: runtime.NewNotRegisteredErrForKind(schema.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"})},
- expectedGVK: &schema.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"},
- expectedObject: &testDecodable{
- Other: "test",
- Value: 1,
- },
- },
- // registered types get defaulted by the into object kind
- {
- data: []byte(`{"value":1,"Other":"test"}`),
- into: &testDecodable{},
- typer: &mockTyper{gvk: &schema.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"}},
- expectedGVK: &schema.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"},
- expectedObject: &testDecodable{
- Other: "test",
- Value: 1,
- },
- },
- // registered types get defaulted by the into object kind even without version, but return an error
- {
- data: []byte(`{"value":1,"Other":"test"}`),
- into: &testDecodable{},
- typer: &mockTyper{gvk: &schema.GroupVersionKind{Kind: "Test", Group: "other", Version: ""}},
- expectedGVK: &schema.GroupVersionKind{Kind: "Test", Group: "other", Version: ""},
- errFn: func(err error) bool { return strings.Contains(err.Error(), "Object 'apiVersion' is missing in") },
- expectedObject: &testDecodable{
- Other: "test",
- Value: 1,
- },
- },
-
- // runtime.VersionedObjects are decoded
- {
- data: []byte(`{"value":1,"Other":"test"}`),
- into: &runtime.VersionedObjects{Objects: []runtime.Object{}},
- creater: &mockCreater{obj: &testDecodable{}},
- typer: &mockTyper{gvk: &schema.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"}},
- defaultGVK: &schema.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"},
- expectedGVK: &schema.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"},
- expectedObject: &runtime.VersionedObjects{
- Objects: []runtime.Object{
- &testDecodable{
- Other: "test",
- Value: 1,
- },
- },
- },
- },
- // runtime.VersionedObjects with an object are decoded into
- {
- data: []byte(`{"Other":"test"}`),
- into: &runtime.VersionedObjects{Objects: []runtime.Object{&testDecodable{Value: 2}}},
- typer: &mockTyper{gvk: &schema.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"}},
- expectedGVK: &schema.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"},
- expectedObject: &runtime.VersionedObjects{
- Objects: []runtime.Object{
- &testDecodable{
- Other: "test",
- Value: 2,
- },
- },
- },
- },
- // Unmarshalling is case-sensitive
- {
- // "VaLue" should have been "value"
- data: []byte(`{"kind":"Test","apiVersion":"other/blah","VaLue":1,"Other":"test"}`),
- into: &testDecodable{},
- typer: &mockTyper{err: runtime.NewNotRegisteredErrForKind(schema.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"})},
- expectedGVK: &schema.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"},
- expectedObject: &testDecodable{
- Other: "test",
- },
- },
- // Unmarshalling is case-sensitive for big struct.
- {
- // "b" should have been "B", "I" should have been "i"
- data: []byte(`{"kind":"Test","apiVersion":"other/blah","spec": {"A": 1, "b": 2, "h": 3, "I": 4}}`),
- into: &testDecodable{},
- typer: &mockTyper{err: runtime.NewNotRegisteredErrForKind(schema.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"})},
- expectedGVK: &schema.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"},
- expectedObject: &testDecodable{
- Spec: DecodableSpec{A: 1, H: 3},
- },
- },
- }
-
- for i, test := range testCases {
- var s runtime.Serializer
- if test.yaml {
- s = json.NewYAMLSerializer(json.DefaultMetaFactory, test.creater, test.typer)
- } else {
- s = json.NewSerializer(json.DefaultMetaFactory, test.creater, test.typer, test.pretty)
- }
- obj, gvk, err := s.Decode([]byte(test.data), test.defaultGVK, test.into)
-
- if !reflect.DeepEqual(test.expectedGVK, gvk) {
- t.Errorf("%d: unexpected GVK: %v", i, gvk)
- }
-
- switch {
- case err == nil && test.errFn != nil:
- t.Errorf("%d: failed: %v", i, err)
- continue
- case err != nil && test.errFn == nil:
- t.Errorf("%d: failed: %v", i, err)
- continue
- case err != nil:
- if !test.errFn(err) {
- t.Errorf("%d: failed: %v", i, err)
- }
- if obj != nil {
- t.Errorf("%d: should have returned nil object", i)
- }
- continue
- }
-
- if test.into != nil && test.into != obj {
- t.Errorf("%d: expected into to be returned: %v", i, obj)
- continue
- }
-
- if !reflect.DeepEqual(test.expectedObject, obj) {
- t.Errorf("%d: unexpected object:\n%s", i, diff.ObjectGoPrintSideBySide(test.expectedObject, obj))
- }
- }
-}
-
-type mockCreater struct {
- apiVersion string
- kind string
- err error
- obj runtime.Object
-}
-
-func (c *mockCreater) New(kind schema.GroupVersionKind) (runtime.Object, error) {
- c.apiVersion, c.kind = kind.GroupVersion().String(), kind.Kind
- return c.obj, c.err
-}
-
-type mockTyper struct {
- gvk *schema.GroupVersionKind
- err error
-}
-
-func (t *mockTyper) ObjectKinds(obj runtime.Object) ([]schema.GroupVersionKind, bool, error) {
- if t.gvk == nil {
- return nil, false, t.err
- }
- return []schema.GroupVersionKind{*t.gvk}, false, t.err
-}
-
-func (t *mockTyper) Recognizes(_ schema.GroupVersionKind) bool {
- return false
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/meta_test.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/meta_test.go
deleted file mode 100644
index f4e34a22d..000000000
--- a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/meta_test.go
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package json
-
-import "testing"
-
-func TestSimpleMetaFactoryInterpret(t *testing.T) {
- factory := SimpleMetaFactory{}
- gvk, err := factory.Interpret([]byte(`{"apiVersion":"1","kind":"object"}`))
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- if gvk.Version != "1" || gvk.Kind != "object" {
- t.Errorf("unexpected interpret: %#v", gvk)
- }
-
- // no kind or version
- gvk, err = factory.Interpret([]byte(`{}`))
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- if gvk.Version != "" || gvk.Kind != "" {
- t.Errorf("unexpected interpret: %#v", gvk)
- }
-
- // unparsable
- gvk, err = factory.Interpret([]byte(`{`))
- if err == nil {
- t.Errorf("unexpected non-error")
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/sparse_test.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/sparse_test.go
deleted file mode 100644
index 3bc9d13bb..000000000
--- a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/sparse_test.go
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
-Copyright 2018 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package serializer
-
-import (
- "testing"
-
- "k8s.io/apimachinery/pkg/api/equality"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/util/diff"
-)
-
-type FakeV1Obj struct {
- metav1.TypeMeta
- metav1.ObjectMeta
-}
-
-func (*FakeV1Obj) DeepCopyObject() runtime.Object {
- panic("not supported")
-}
-
-type FakeV2DifferentObj struct {
- metav1.TypeMeta
- metav1.ObjectMeta
-}
-
-func (*FakeV2DifferentObj) DeepCopyObject() runtime.Object {
- panic("not supported")
-}
-func TestSparse(t *testing.T) {
- v1 := schema.GroupVersion{Group: "mygroup", Version: "v1"}
- v2 := schema.GroupVersion{Group: "mygroup", Version: "v2"}
-
- scheme := runtime.NewScheme()
- scheme.AddKnownTypes(v1, &FakeV1Obj{})
- scheme.AddKnownTypes(v2, &FakeV2DifferentObj{})
- codecs := NewCodecFactory(scheme)
-
- srcObj1 := &FakeV1Obj{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}
- srcObj2 := &FakeV2DifferentObj{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}
-
- encoder := codecs.LegacyCodec(v2, v1)
- decoder := codecs.UniversalDecoder(v2, v1)
-
- srcObj1Bytes, err := runtime.Encode(encoder, srcObj1)
- if err != nil {
- t.Fatal(err)
- }
- t.Log(string(srcObj1Bytes))
- srcObj2Bytes, err := runtime.Encode(encoder, srcObj2)
- if err != nil {
- t.Fatal(err)
- }
- t.Log(string(srcObj2Bytes))
-
- uncastDstObj1, err := runtime.Decode(decoder, srcObj1Bytes)
- if err != nil {
- t.Fatal(err)
- }
- uncastDstObj2, err := runtime.Decode(decoder, srcObj2Bytes)
- if err != nil {
- t.Fatal(err)
- }
-
- // clear typemeta
- uncastDstObj1.(*FakeV1Obj).TypeMeta = metav1.TypeMeta{}
- uncastDstObj2.(*FakeV2DifferentObj).TypeMeta = metav1.TypeMeta{}
-
- if !equality.Semantic.DeepEqual(srcObj1, uncastDstObj1) {
- t.Fatal(diff.ObjectDiff(srcObj1, uncastDstObj1))
- }
- if !equality.Semantic.DeepEqual(srcObj2, uncastDstObj2) {
- t.Fatal(diff.ObjectDiff(srcObj2, uncastDstObj2))
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/streaming/streaming_test.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/streaming/streaming_test.go
deleted file mode 100644
index 9cae6a32c..000000000
--- a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/streaming/streaming_test.go
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package streaming
-
-import (
- "bytes"
- "io"
- "io/ioutil"
- "testing"
-
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/util/framer"
-)
-
-type fakeDecoder struct {
- got []byte
- obj runtime.Object
- err error
-}
-
-func (d *fakeDecoder) Decode(data []byte, gvk *schema.GroupVersionKind, into runtime.Object) (runtime.Object, *schema.GroupVersionKind, error) {
- d.got = data
- return d.obj, nil, d.err
-}
-
-func TestEmptyDecoder(t *testing.T) {
- buf := bytes.NewBuffer([]byte{})
- d := &fakeDecoder{}
- _, _, err := NewDecoder(ioutil.NopCloser(buf), d).Decode(nil, nil)
- if err != io.EOF {
- t.Fatal(err)
- }
-}
-
-func TestDecoder(t *testing.T) {
- frames := [][]byte{
- make([]byte, 1025),
- make([]byte, 1024*5),
- make([]byte, 1024*1024*5),
- make([]byte, 1025),
- }
- pr, pw := io.Pipe()
- fw := framer.NewLengthDelimitedFrameWriter(pw)
- go func() {
- for i := range frames {
- fw.Write(frames[i])
- }
- pw.Close()
- }()
-
- r := framer.NewLengthDelimitedFrameReader(pr)
- d := &fakeDecoder{}
- dec := NewDecoder(r, d)
- if _, _, err := dec.Decode(nil, nil); err != nil || !bytes.Equal(d.got, frames[0]) {
- t.Fatalf("unexpected %v %v", err, len(d.got))
- }
- if _, _, err := dec.Decode(nil, nil); err != nil || !bytes.Equal(d.got, frames[1]) {
- t.Fatalf("unexpected %v %v", err, len(d.got))
- }
- if _, _, err := dec.Decode(nil, nil); err != ErrObjectTooLarge || !bytes.Equal(d.got, frames[1]) {
- t.Fatalf("unexpected %v %v", err, len(d.got))
- }
- if _, _, err := dec.Decode(nil, nil); err != nil || !bytes.Equal(d.got, frames[3]) {
- t.Fatalf("unexpected %v %v", err, len(d.got))
- }
- if _, _, err := dec.Decode(nil, nil); err != io.EOF {
- t.Fatalf("unexpected %v %v", err, len(d.got))
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning_test.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning_test.go
deleted file mode 100644
index f79b2a7cb..000000000
--- a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning_test.go
+++ /dev/null
@@ -1,381 +0,0 @@
-/*
-Copyright 2015 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package versioning
-
-import (
- "fmt"
- "io"
- "io/ioutil"
- "reflect"
- "testing"
-
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/util/diff"
-)
-
-type testDecodable struct {
- Other string
- Value int `json:"value"`
- gvk schema.GroupVersionKind
-}
-
-func (d *testDecodable) GetObjectKind() schema.ObjectKind { return d }
-func (d *testDecodable) SetGroupVersionKind(gvk schema.GroupVersionKind) { d.gvk = gvk }
-func (d *testDecodable) GroupVersionKind() schema.GroupVersionKind { return d.gvk }
-func (d *testDecodable) DeepCopyObject() runtime.Object {
- // no real deepcopy because these tests check for pointer equality
- return d
-}
-
-type testNestedDecodable struct {
- Other string
- Value int `json:"value"`
-
- gvk schema.GroupVersionKind
- nestedCalled bool
- nestedErr error
-}
-
-func (d *testNestedDecodable) GetObjectKind() schema.ObjectKind { return d }
-func (d *testNestedDecodable) SetGroupVersionKind(gvk schema.GroupVersionKind) { d.gvk = gvk }
-func (d *testNestedDecodable) GroupVersionKind() schema.GroupVersionKind { return d.gvk }
-func (d *testNestedDecodable) DeepCopyObject() runtime.Object {
- // no real deepcopy because these tests check for pointer equality
- return d
-}
-
-func (d *testNestedDecodable) EncodeNestedObjects(e runtime.Encoder) error {
- d.nestedCalled = true
- return d.nestedErr
-}
-
-func (d *testNestedDecodable) DecodeNestedObjects(_ runtime.Decoder) error {
- d.nestedCalled = true
- return d.nestedErr
-}
-
-func TestNestedDecode(t *testing.T) {
- n := &testNestedDecodable{nestedErr: fmt.Errorf("unable to decode")}
- decoder := &mockSerializer{obj: n}
- codec := NewCodec(nil, decoder, nil, nil, nil, nil, nil, nil)
- if _, _, err := codec.Decode([]byte(`{}`), nil, n); err != n.nestedErr {
- t.Errorf("unexpected error: %v", err)
- }
- if !n.nestedCalled {
- t.Errorf("did not invoke nested decoder")
- }
-}
-
-func TestNestedEncode(t *testing.T) {
- n := &testNestedDecodable{nestedErr: fmt.Errorf("unable to decode")}
- n2 := &testNestedDecodable{nestedErr: fmt.Errorf("unable to decode 2")}
- encoder := &mockSerializer{obj: n}
- codec := NewCodec(
- encoder, nil,
- &checkConvertor{obj: n2, groupVersion: schema.GroupVersion{Group: "other"}},
- nil,
- &mockTyper{gvks: []schema.GroupVersionKind{{Kind: "test"}}},
- nil,
- schema.GroupVersion{Group: "other"}, nil,
- )
- if err := codec.Encode(n, ioutil.Discard); err != n2.nestedErr {
- t.Errorf("unexpected error: %v", err)
- }
- if n.nestedCalled || !n2.nestedCalled {
- t.Errorf("did not invoke correct nested decoder")
- }
-}
-
-func TestDecode(t *testing.T) {
- gvk1 := &schema.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"}
- decodable1 := &testDecodable{}
- decodable2 := &testDecodable{}
- decodable3 := &testDecodable{}
- versionedDecodable1 := &runtime.VersionedObjects{Objects: []runtime.Object{decodable1}}
-
- testCases := []struct {
- serializer runtime.Serializer
- convertor runtime.ObjectConvertor
- creater runtime.ObjectCreater
- typer runtime.ObjectTyper
- defaulter runtime.ObjectDefaulter
- yaml bool
- pretty bool
-
- encodes, decodes runtime.GroupVersioner
-
- defaultGVK *schema.GroupVersionKind
- into runtime.Object
-
- errFn func(error) bool
- expectedObject runtime.Object
- sameObject runtime.Object
- expectedGVK *schema.GroupVersionKind
- }{
- {
- serializer: &mockSerializer{actual: gvk1},
- convertor: &checkConvertor{groupVersion: schema.GroupVersion{Group: "other", Version: runtime.APIVersionInternal}},
- expectedGVK: gvk1,
- decodes: schema.GroupVersion{Group: "other", Version: runtime.APIVersionInternal},
- },
- {
- serializer: &mockSerializer{actual: gvk1, obj: decodable1},
- convertor: &checkConvertor{in: decodable1, obj: decodable2, groupVersion: schema.GroupVersion{Group: "other", Version: runtime.APIVersionInternal}},
- expectedGVK: gvk1,
- sameObject: decodable2,
- decodes: schema.GroupVersion{Group: "other", Version: runtime.APIVersionInternal},
- },
- // defaultGVK.Group is allowed to force a conversion to the destination group
- {
- serializer: &mockSerializer{actual: gvk1, obj: decodable1},
- defaultGVK: &schema.GroupVersionKind{Group: "force"},
- convertor: &checkConvertor{in: decodable1, obj: decodable2, groupVersion: schema.GroupVersion{Group: "force", Version: runtime.APIVersionInternal}},
- expectedGVK: gvk1,
- sameObject: decodable2,
- decodes: schema.GroupVersion{Group: "force", Version: runtime.APIVersionInternal},
- },
- // uses direct conversion for into when objects differ
- {
- into: decodable3,
- serializer: &mockSerializer{actual: gvk1, obj: decodable1},
- convertor: &checkConvertor{in: decodable1, obj: decodable3, directConvert: true},
- expectedGVK: gvk1,
- sameObject: decodable3,
- },
- {
- into: versionedDecodable1,
- serializer: &mockSerializer{actual: gvk1, obj: decodable3},
- convertor: &checkConvertor{in: decodable3, obj: decodable1, directConvert: true},
- expectedGVK: gvk1,
- sameObject: versionedDecodable1,
- },
- // returns directly when serializer returns into
- {
- into: decodable3,
- serializer: &mockSerializer{actual: gvk1, obj: decodable3},
- expectedGVK: gvk1,
- sameObject: decodable3,
- },
- // returns directly when serializer returns into
- {
- into: versionedDecodable1,
- serializer: &mockSerializer{actual: gvk1, obj: decodable1},
- expectedGVK: gvk1,
- sameObject: versionedDecodable1,
- },
-
- // runtime.VersionedObjects are decoded
- {
- into: &runtime.VersionedObjects{Objects: []runtime.Object{}},
-
- serializer: &mockSerializer{actual: gvk1, obj: decodable1},
- convertor: &checkConvertor{in: decodable1, obj: decodable2, groupVersion: schema.GroupVersion{Group: "other", Version: runtime.APIVersionInternal}},
- expectedGVK: gvk1,
- expectedObject: &runtime.VersionedObjects{Objects: []runtime.Object{decodable1, decodable2}},
- decodes: schema.GroupVersion{Group: "other", Version: runtime.APIVersionInternal},
- },
-
- // decode into the same version as the serialized object
- {
- decodes: schema.GroupVersions{gvk1.GroupVersion()},
-
- serializer: &mockSerializer{actual: gvk1, obj: decodable1},
- convertor: &checkConvertor{in: decodable1, obj: decodable1, groupVersion: schema.GroupVersions{{Group: "other", Version: "blah"}}},
- expectedGVK: gvk1,
- expectedObject: decodable1,
- },
- {
- into: &runtime.VersionedObjects{Objects: []runtime.Object{}},
- decodes: schema.GroupVersions{gvk1.GroupVersion()},
-
- serializer: &mockSerializer{actual: gvk1, obj: decodable1},
- convertor: &checkConvertor{in: decodable1, obj: decodable1, groupVersion: schema.GroupVersions{{Group: "other", Version: "blah"}}},
- expectedGVK: gvk1,
- expectedObject: &runtime.VersionedObjects{Objects: []runtime.Object{decodable1}},
- },
-
- // codec with non matching version skips conversion altogether
- {
- decodes: schema.GroupVersions{{Group: "something", Version: "else"}},
-
- serializer: &mockSerializer{actual: gvk1, obj: decodable1},
- convertor: &checkConvertor{in: decodable1, obj: decodable1, groupVersion: schema.GroupVersions{{Group: "something", Version: "else"}}},
- expectedGVK: gvk1,
- expectedObject: decodable1,
- },
- {
- into: &runtime.VersionedObjects{Objects: []runtime.Object{}},
- decodes: schema.GroupVersions{{Group: "something", Version: "else"}},
-
- serializer: &mockSerializer{actual: gvk1, obj: decodable1},
- convertor: &checkConvertor{in: decodable1, obj: decodable1, groupVersion: schema.GroupVersions{{Group: "something", Version: "else"}}},
- expectedGVK: gvk1,
- expectedObject: &runtime.VersionedObjects{Objects: []runtime.Object{decodable1}},
- },
- }
-
- for i, test := range testCases {
- t.Logf("%d", i)
- s := NewCodec(test.serializer, test.serializer, test.convertor, test.creater, test.typer, test.defaulter, test.encodes, test.decodes)
- obj, gvk, err := s.Decode([]byte(`{}`), test.defaultGVK, test.into)
-
- if !reflect.DeepEqual(test.expectedGVK, gvk) {
- t.Errorf("%d: unexpected GVK: %v", i, gvk)
- }
-
- switch {
- case err == nil && test.errFn != nil:
- t.Errorf("%d: failed: %v", i, err)
- continue
- case err != nil && test.errFn == nil:
- t.Errorf("%d: failed: %v", i, err)
- continue
- case err != nil:
- if !test.errFn(err) {
- t.Errorf("%d: failed: %v", i, err)
- }
- if obj != nil {
- t.Errorf("%d: should have returned nil object", i)
- }
- continue
- }
-
- if test.into != nil && test.into != obj {
- t.Errorf("%d: expected into to be returned: %v", i, obj)
- continue
- }
-
- switch {
- case test.expectedObject != nil:
- if !reflect.DeepEqual(test.expectedObject, obj) {
- t.Errorf("%d: unexpected object:\n%s", i, diff.ObjectGoPrintSideBySide(test.expectedObject, obj))
- }
- case test.sameObject != nil:
- if test.sameObject != obj {
- t.Errorf("%d: unexpected object:\n%s", i, diff.ObjectGoPrintSideBySide(test.sameObject, obj))
- }
- case obj != nil:
- t.Errorf("%d: unexpected object: %#v", i, obj)
- }
- }
-}
-
-type checkConvertor struct {
- err error
- in, obj runtime.Object
- groupVersion runtime.GroupVersioner
- directConvert bool
-}
-
-func (c *checkConvertor) Convert(in, out, context interface{}) error {
- if !c.directConvert {
- return fmt.Errorf("unexpected call to Convert")
- }
- if c.in != nil && c.in != in {
- return fmt.Errorf("unexpected in: %s", in)
- }
- if c.obj != nil && c.obj != out {
- return fmt.Errorf("unexpected out: %s", out)
- }
- return c.err
-}
-func (c *checkConvertor) ConvertToVersion(in runtime.Object, outVersion runtime.GroupVersioner) (out runtime.Object, err error) {
- if c.directConvert {
- return nil, fmt.Errorf("unexpected call to ConvertToVersion")
- }
- if c.in != nil && c.in != in {
- return nil, fmt.Errorf("unexpected in: %s", in)
- }
- if !reflect.DeepEqual(c.groupVersion, outVersion) {
- return nil, fmt.Errorf("unexpected outversion: %s (%s)", outVersion, c.groupVersion)
- }
- return c.obj, c.err
-}
-func (c *checkConvertor) ConvertFieldLabel(version, kind, label, value string) (string, string, error) {
- return "", "", fmt.Errorf("unexpected call to ConvertFieldLabel")
-}
-
-type mockSerializer struct {
- err error
- obj runtime.Object
- encodingObjGVK schema.GroupVersionKind
-
- defaults, actual *schema.GroupVersionKind
- into runtime.Object
-}
-
-func (s *mockSerializer) Decode(data []byte, defaults *schema.GroupVersionKind, into runtime.Object) (runtime.Object, *schema.GroupVersionKind, error) {
- s.defaults = defaults
- s.into = into
- return s.obj, s.actual, s.err
-}
-
-func (s *mockSerializer) Encode(obj runtime.Object, w io.Writer) error {
- s.obj = obj
- s.encodingObjGVK = obj.GetObjectKind().GroupVersionKind()
- return s.err
-}
-
-type mockCreater struct {
- err error
- obj runtime.Object
-}
-
-func (c *mockCreater) New(kind schema.GroupVersionKind) (runtime.Object, error) {
- return c.obj, c.err
-}
-
-type mockTyper struct {
- gvks []schema.GroupVersionKind
- unversioned bool
- err error
-}
-
-func (t *mockTyper) ObjectKinds(obj runtime.Object) ([]schema.GroupVersionKind, bool, error) {
- return t.gvks, t.unversioned, t.err
-}
-
-func (t *mockTyper) Recognizes(_ schema.GroupVersionKind) bool {
- return true
-}
-
-func TestDirectCodecEncode(t *testing.T) {
- serializer := mockSerializer{}
- typer := mockTyper{
- gvks: []schema.GroupVersionKind{
- {
- Group: "wrong_group",
- Kind: "some_kind",
- },
- {
- Group: "expected_group",
- Kind: "some_kind",
- },
- },
- }
-
- c := DirectEncoder{
- Version: schema.GroupVersion{Group: "expected_group"},
- Encoder: &serializer,
- ObjectTyper: &typer,
- }
- c.Encode(&testDecodable{}, ioutil.Discard)
- if e, a := "expected_group", serializer.encodingObjGVK.Group; e != a {
- t.Errorf("expected group to be %v, got %v", e, a)
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/swagger_doc_generator_test.go b/vendor/k8s.io/apimachinery/pkg/runtime/swagger_doc_generator_test.go
deleted file mode 100644
index a6f338d31..000000000
--- a/vendor/k8s.io/apimachinery/pkg/runtime/swagger_doc_generator_test.go
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-Copyright 2015 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package runtime
-
-import (
- "testing"
-)
-
-func TestFmtRawDoc(t *testing.T) {
- tests := []struct {
- t, expected string
- }{
- {"aaa\n --- asd\n TODO: tooooodo\n toooodoooooo\n", "aaa"},
- {"aaa\nasd\n TODO: tooooodo\nbbbb\n --- toooodoooooo\n", "aaa asd bbbb"},
- {" TODO: tooooodo\n", ""},
- {"Par1\n\nPar2\n\n", "Par1\\n\\nPar2"},
- {"", ""},
- {" ", ""},
- {" \n", ""},
- {" \n\n ", ""},
- {"Example:\n\tl1\n\t\tl2\n", "Example:\\n\\tl1\\n\\t\\tl2"},
- }
-
- for _, test := range tests {
- if o := fmtRawDoc(test.t); o != test.expected {
- t.Fatalf("Expected: %q, got %q", test.expected, o)
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/cache/cache_test.go b/vendor/k8s.io/apimachinery/pkg/util/cache/cache_test.go
deleted file mode 100644
index 42a58a93d..000000000
--- a/vendor/k8s.io/apimachinery/pkg/util/cache/cache_test.go
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package cache
-
-import (
- "testing"
-)
-
-const (
- maxTestCacheSize int = shardsCount * 2
-)
-
-func ExpectEntry(t *testing.T, cache Cache, index uint64, expectedValue interface{}) bool {
- elem, found := cache.Get(index)
- if !found {
- t.Errorf("Expected to find entry with key %d", index)
- return false
- } else if elem != expectedValue {
- t.Errorf("Expected to find %v, got %v", expectedValue, elem)
- return false
- }
- return true
-}
-
-func TestBasic(t *testing.T) {
- cache := NewCache(maxTestCacheSize)
- cache.Add(1, "xxx")
- ExpectEntry(t, cache, 1, "xxx")
-}
-
-func TestOverflow(t *testing.T) {
- cache := NewCache(maxTestCacheSize)
- for i := 0; i < maxTestCacheSize+1; i++ {
- cache.Add(uint64(i), "xxx")
- }
- foundIndexes := make([]uint64, 0)
- for i := 0; i < maxTestCacheSize+1; i++ {
- _, found := cache.Get(uint64(i))
- if found {
- foundIndexes = append(foundIndexes, uint64(i))
- }
- }
- if len(foundIndexes) != maxTestCacheSize {
- t.Errorf("Expect to find %d elements, got %d %v", maxTestCacheSize, len(foundIndexes), foundIndexes)
- }
-}
-
-func TestOverwrite(t *testing.T) {
- cache := NewCache(maxTestCacheSize)
- cache.Add(1, "xxx")
- ExpectEntry(t, cache, 1, "xxx")
- cache.Add(1, "yyy")
- ExpectEntry(t, cache, 1, "yyy")
-}
-
-// TestEvict this test will fail sporatically depending on what add()
-// selects for the randomKey to be evicted. Ensure that randomKey
-// is never the key we most recently added. Since the chance of failure
-// on each evict is 50%, if we do it 7 times, it should catch the problem
-// if it exists >99% of the time.
-func TestEvict(t *testing.T) {
- cache := NewCache(shardsCount)
- var found bool
- for retry := 0; retry < 7; retry++ {
- cache.Add(uint64(shardsCount), "xxx")
- found = ExpectEntry(t, cache, uint64(shardsCount), "xxx")
- if !found {
- break
- }
- cache.Add(0, "xxx")
- found = ExpectEntry(t, cache, 0, "xxx")
- if !found {
- break
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/cache/lruexpirecache_test.go b/vendor/k8s.io/apimachinery/pkg/util/cache/lruexpirecache_test.go
deleted file mode 100644
index bd44f60d4..000000000
--- a/vendor/k8s.io/apimachinery/pkg/util/cache/lruexpirecache_test.go
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package cache
-
-import (
- "testing"
- "time"
-
- "k8s.io/apimachinery/pkg/util/clock"
-
- "github.com/golang/groupcache/lru"
-)
-
-func expectEntry(t *testing.T, c *LRUExpireCache, key lru.Key, value interface{}) {
- result, ok := c.Get(key)
- if !ok || result != value {
- t.Errorf("Expected cache[%v]: %v, got %v", key, value, result)
- }
-}
-
-func expectNotEntry(t *testing.T, c *LRUExpireCache, key lru.Key) {
- if result, ok := c.Get(key); ok {
- t.Errorf("Expected cache[%v] to be empty, got %v", key, result)
- }
-}
-
-func TestSimpleGet(t *testing.T) {
- c := NewLRUExpireCache(10)
- c.Add("long-lived", "12345", 10*time.Hour)
- expectEntry(t, c, "long-lived", "12345")
-}
-
-func TestExpiredGet(t *testing.T) {
- fakeClock := clock.NewFakeClock(time.Now())
- c := NewLRUExpireCacheWithClock(10, fakeClock)
- c.Add("short-lived", "12345", 1*time.Millisecond)
- // ensure the entry expired
- fakeClock.Step(2 * time.Millisecond)
- expectNotEntry(t, c, "short-lived")
-}
-
-func TestLRUOverflow(t *testing.T) {
- c := NewLRUExpireCache(4)
- c.Add("elem1", "1", 10*time.Hour)
- c.Add("elem2", "2", 10*time.Hour)
- c.Add("elem3", "3", 10*time.Hour)
- c.Add("elem4", "4", 10*time.Hour)
- c.Add("elem5", "5", 10*time.Hour)
- expectNotEntry(t, c, "elem1")
- expectEntry(t, c, "elem2", "2")
- expectEntry(t, c, "elem3", "3")
- expectEntry(t, c, "elem4", "4")
- expectEntry(t, c, "elem5", "5")
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/clock/clock_test.go b/vendor/k8s.io/apimachinery/pkg/util/clock/clock_test.go
deleted file mode 100644
index c7b371fc6..000000000
--- a/vendor/k8s.io/apimachinery/pkg/util/clock/clock_test.go
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
-Copyright 2015 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package clock
-
-import (
- "testing"
- "time"
-)
-
-var (
- _ = Clock(RealClock{})
- _ = Clock(&FakeClock{})
- _ = Clock(&IntervalClock{})
-
- _ = Timer(&realTimer{})
- _ = Timer(&fakeTimer{})
-
- _ = Ticker(&realTicker{})
- _ = Ticker(&fakeTicker{})
-)
-
-func TestFakeClock(t *testing.T) {
- startTime := time.Now()
- tc := NewFakeClock(startTime)
- tc.Step(time.Second)
- now := tc.Now()
- if now.Sub(startTime) != time.Second {
- t.Errorf("input: %s now=%s gap=%s expected=%s", startTime, now, now.Sub(startTime), time.Second)
- }
-
- tt := tc.Now()
- tc.SetTime(tt.Add(time.Hour))
- if tc.Now().Sub(tt) != time.Hour {
- t.Errorf("input: %s now=%s gap=%s expected=%s", tt, tc.Now(), tc.Now().Sub(tt), time.Hour)
- }
-}
-
-func TestFakeClockSleep(t *testing.T) {
- startTime := time.Now()
- tc := NewFakeClock(startTime)
- tc.Sleep(time.Duration(1) * time.Hour)
- now := tc.Now()
- if now.Sub(startTime) != time.Hour {
- t.Errorf("Fake sleep failed, expected time to advance by one hour, instead, its %v", now.Sub(startTime))
- }
-}
-
-func TestFakeAfter(t *testing.T) {
- tc := NewFakeClock(time.Now())
- if tc.HasWaiters() {
- t.Errorf("unexpected waiter?")
- }
- oneSec := tc.After(time.Second)
- if !tc.HasWaiters() {
- t.Errorf("unexpected lack of waiter?")
- }
-
- oneOhOneSec := tc.After(time.Second + time.Millisecond)
- twoSec := tc.After(2 * time.Second)
- select {
- case <-oneSec:
- t.Errorf("unexpected channel read")
- case <-oneOhOneSec:
- t.Errorf("unexpected channel read")
- case <-twoSec:
- t.Errorf("unexpected channel read")
- default:
- }
-
- tc.Step(999 * time.Millisecond)
- select {
- case <-oneSec:
- t.Errorf("unexpected channel read")
- case <-oneOhOneSec:
- t.Errorf("unexpected channel read")
- case <-twoSec:
- t.Errorf("unexpected channel read")
- default:
- }
-
- tc.Step(time.Millisecond)
- select {
- case <-oneSec:
- // Expected!
- case <-oneOhOneSec:
- t.Errorf("unexpected channel read")
- case <-twoSec:
- t.Errorf("unexpected channel read")
- default:
- t.Errorf("unexpected non-channel read")
- }
- tc.Step(time.Millisecond)
- select {
- case <-oneSec:
- // should not double-trigger!
- t.Errorf("unexpected channel read")
- case <-oneOhOneSec:
- // Expected!
- case <-twoSec:
- t.Errorf("unexpected channel read")
- default:
- t.Errorf("unexpected non-channel read")
- }
-}
-
-func TestFakeTick(t *testing.T) {
- tc := NewFakeClock(time.Now())
- if tc.HasWaiters() {
- t.Errorf("unexpected waiter?")
- }
- oneSec := tc.NewTicker(time.Second).C()
- if !tc.HasWaiters() {
- t.Errorf("unexpected lack of waiter?")
- }
-
- oneOhOneSec := tc.NewTicker(time.Second + time.Millisecond).C()
- twoSec := tc.NewTicker(2 * time.Second).C()
- select {
- case <-oneSec:
- t.Errorf("unexpected channel read")
- case <-oneOhOneSec:
- t.Errorf("unexpected channel read")
- case <-twoSec:
- t.Errorf("unexpected channel read")
- default:
- }
-
- tc.Step(999 * time.Millisecond) // t=.999
- select {
- case <-oneSec:
- t.Errorf("unexpected channel read")
- case <-oneOhOneSec:
- t.Errorf("unexpected channel read")
- case <-twoSec:
- t.Errorf("unexpected channel read")
- default:
- }
-
- tc.Step(time.Millisecond) // t=1.000
- select {
- case <-oneSec:
- // Expected!
- case <-oneOhOneSec:
- t.Errorf("unexpected channel read")
- case <-twoSec:
- t.Errorf("unexpected channel read")
- default:
- t.Errorf("unexpected non-channel read")
- }
- tc.Step(time.Millisecond) // t=1.001
- select {
- case <-oneSec:
- // should not double-trigger!
- t.Errorf("unexpected channel read")
- case <-oneOhOneSec:
- // Expected!
- case <-twoSec:
- t.Errorf("unexpected channel read")
- default:
- t.Errorf("unexpected non-channel read")
- }
-
- tc.Step(time.Second) // t=2.001
- tc.Step(time.Second) // t=3.001
- tc.Step(time.Second) // t=4.001
- tc.Step(time.Second) // t=5.001
-
- // The one second ticker should not accumulate ticks
- accumulatedTicks := 0
- drained := false
- for !drained {
- select {
- case <-oneSec:
- accumulatedTicks++
- default:
- drained = true
- }
- }
- if accumulatedTicks != 1 {
- t.Errorf("unexpected number of accumulated ticks: %d", accumulatedTicks)
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/diff/diff_test.go b/vendor/k8s.io/apimachinery/pkg/util/diff/diff_test.go
deleted file mode 100644
index d26dba818..000000000
--- a/vendor/k8s.io/apimachinery/pkg/util/diff/diff_test.go
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package diff
-
-import (
- "testing"
-)
-
-func TestObjectReflectDiff(t *testing.T) {
- type struct1 struct{ A []int }
-
- testCases := map[string]struct {
- a, b interface{}
- out string
- }{
- "map": {
- a: map[string]int{},
- b: map[string]int{},
- },
- "detect nil map": {
- a: map[string]int(nil),
- b: map[string]int{},
- out: `
-object:
- a: map[string]int(nil)
- b: map[string]int{}`,
- },
- "detect map changes": {
- a: map[string]int{"test": 1, "other": 2},
- b: map[string]int{"test": 2, "third": 3},
- out: `
-object[other]:
- a: 2
- b: <nil>
-object[test]:
- a: 1
- b: 2
-object[third]:
- a: <nil>
- b: 3`,
- },
- "nil slice": {a: struct1{A: nil}, b: struct1{A: nil}},
- "empty slice": {a: struct1{A: []int{}}, b: struct1{A: []int{}}},
- "detect slice changes 1": {a: struct1{A: []int{1}}, b: struct1{A: []int{2}}, out: `
-object.A[0]:
- a: 1
- b: 2`,
- },
- "detect slice changes 2": {a: struct1{A: []int{}}, b: struct1{A: []int{2}}, out: `
-object.A[0]:
- a: <nil>
- b: 2`,
- },
- "detect slice changes 3": {a: struct1{A: []int{1}}, b: struct1{A: []int{}}, out: `
-object.A[0]:
- a: 1
- b: <nil>`,
- },
- "detect nil vs empty slices": {a: struct1{A: nil}, b: struct1{A: []int{}}, out: `
-object.A:
- a: []int(nil)
- b: []int{}`,
- },
- }
- for name, test := range testCases {
- expect := test.out
- if len(expect) == 0 {
- expect = "<no diffs>"
- }
- if actual := ObjectReflectDiff(test.a, test.b); actual != expect {
- t.Errorf("%s: unexpected output: %s", name, actual)
- }
- }
-}
-
-func TestStringDiff(t *testing.T) {
- diff := StringDiff("aaabb", "aaacc")
- expect := "aaa\n\nA: bb\n\nB: cc\n\n"
- if diff != expect {
- t.Errorf("diff returned %v", diff)
- }
-}
-
-func TestLimit(t *testing.T) {
- testcases := []struct {
- a interface{}
- b interface{}
- expectA string
- expectB string
- }{
- {
- a: `short a`,
- b: `short b`,
- expectA: `"short a"`,
- expectB: `"short b"`,
- },
- {
- a: `short a`,
- b: `long b needs truncating`,
- expectA: `"short a"`,
- expectB: `"long b ne...`,
- },
- {
- a: `long a needs truncating`,
- b: `long b needs truncating`,
- expectA: `...g a needs ...`,
- expectB: `...g b needs ...`,
- },
- {
- a: `long common prefix with different stuff at the end of a`,
- b: `long common prefix with different stuff at the end of b`,
- expectA: `...end of a"`,
- expectB: `...end of b"`,
- },
- {
- a: `long common prefix with different stuff at the end of a`,
- b: `long common prefix with different stuff at the end of b which continues`,
- expectA: `...of a"`,
- expectB: `...of b which...`,
- },
- }
-
- for _, tc := range testcases {
- a, b := limit(tc.a, tc.b, 10)
- if a != tc.expectA || b != tc.expectB {
- t.Errorf("limit(%q, %q)\n\texpected: %s, %s\n\tgot: %s, %s", tc.a, tc.b, tc.expectA, tc.expectB, a, b)
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/errors/errors_test.go b/vendor/k8s.io/apimachinery/pkg/util/errors/errors_test.go
deleted file mode 100644
index 0ad3967d2..000000000
--- a/vendor/k8s.io/apimachinery/pkg/util/errors/errors_test.go
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
-Copyright 2015 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package errors
-
-import (
- "fmt"
- "reflect"
- "sort"
- "testing"
-)
-
-func TestEmptyAggregate(t *testing.T) {
- var slice []error
- var agg Aggregate
- var err error
-
- agg = NewAggregate(slice)
- if agg != nil {
- t.Errorf("expected nil, got %#v", agg)
- }
- err = NewAggregate(slice)
- if err != nil {
- t.Errorf("expected nil, got %#v", err)
- }
-
- // This is not normally possible, but pedantry demands I test it.
- agg = aggregate(slice) // empty aggregate
- if s := agg.Error(); s != "" {
- t.Errorf("expected empty string, got %q", s)
- }
- if s := agg.Errors(); len(s) != 0 {
- t.Errorf("expected empty slice, got %#v", s)
- }
- err = agg.(error)
- if s := err.Error(); s != "" {
- t.Errorf("expected empty string, got %q", s)
- }
-}
-
-func TestAggregateWithNil(t *testing.T) {
- var slice []error
- slice = []error{nil}
- var agg Aggregate
- var err error
-
- agg = NewAggregate(slice)
- if agg != nil {
- t.Errorf("expected nil, got %#v", agg)
- }
- err = NewAggregate(slice)
- if err != nil {
- t.Errorf("expected nil, got %#v", err)
- }
-
- // Append a non-nil error
- slice = append(slice, fmt.Errorf("err"))
- agg = NewAggregate(slice)
- if agg == nil {
- t.Errorf("expected non-nil")
- }
- if s := agg.Error(); s != "err" {
- t.Errorf("expected 'err', got %q", s)
- }
- if s := agg.Errors(); len(s) != 1 {
- t.Errorf("expected one-element slice, got %#v", s)
- }
- if s := agg.Errors()[0].Error(); s != "err" {
- t.Errorf("expected 'err', got %q", s)
- }
-
- err = agg.(error)
- if err == nil {
- t.Errorf("expected non-nil")
- }
- if s := err.Error(); s != "err" {
- t.Errorf("expected 'err', got %q", s)
- }
-}
-
-func TestSingularAggregate(t *testing.T) {
- var slice []error = []error{fmt.Errorf("err")}
- var agg Aggregate
- var err error
-
- agg = NewAggregate(slice)
- if agg == nil {
- t.Errorf("expected non-nil")
- }
- if s := agg.Error(); s != "err" {
- t.Errorf("expected 'err', got %q", s)
- }
- if s := agg.Errors(); len(s) != 1 {
- t.Errorf("expected one-element slice, got %#v", s)
- }
- if s := agg.Errors()[0].Error(); s != "err" {
- t.Errorf("expected 'err', got %q", s)
- }
-
- err = agg.(error)
- if err == nil {
- t.Errorf("expected non-nil")
- }
- if s := err.Error(); s != "err" {
- t.Errorf("expected 'err', got %q", s)
- }
-}
-
-func TestPluralAggregate(t *testing.T) {
- var slice []error = []error{fmt.Errorf("abc"), fmt.Errorf("123")}
- var agg Aggregate
- var err error
-
- agg = NewAggregate(slice)
- if agg == nil {
- t.Errorf("expected non-nil")
- }
- if s := agg.Error(); s != "[abc, 123]" {
- t.Errorf("expected '[abc, 123]', got %q", s)
- }
- if s := agg.Errors(); len(s) != 2 {
- t.Errorf("expected two-elements slice, got %#v", s)
- }
- if s := agg.Errors()[0].Error(); s != "abc" {
- t.Errorf("expected '[abc, 123]', got %q", s)
- }
-
- err = agg.(error)
- if err == nil {
- t.Errorf("expected non-nil")
- }
- if s := err.Error(); s != "[abc, 123]" {
- t.Errorf("expected '[abc, 123]', got %q", s)
- }
-}
-
-func TestFilterOut(t *testing.T) {
- testCases := []struct {
- err error
- filter []Matcher
- expected error
- }{
- {
- nil,
- []Matcher{},
- nil,
- },
- {
- aggregate{},
- []Matcher{},
- nil,
- },
- {
- aggregate{fmt.Errorf("abc")},
- []Matcher{},
- aggregate{fmt.Errorf("abc")},
- },
- {
- aggregate{fmt.Errorf("abc")},
- []Matcher{func(err error) bool { return false }},
- aggregate{fmt.Errorf("abc")},
- },
- {
- aggregate{fmt.Errorf("abc")},
- []Matcher{func(err error) bool { return true }},
- nil,
- },
- {
- aggregate{fmt.Errorf("abc")},
- []Matcher{func(err error) bool { return false }, func(err error) bool { return false }},
- aggregate{fmt.Errorf("abc")},
- },
- {
- aggregate{fmt.Errorf("abc")},
- []Matcher{func(err error) bool { return false }, func(err error) bool { return true }},
- nil,
- },
- {
- aggregate{fmt.Errorf("abc"), fmt.Errorf("def"), fmt.Errorf("ghi")},
- []Matcher{func(err error) bool { return err.Error() == "def" }},
- aggregate{fmt.Errorf("abc"), fmt.Errorf("ghi")},
- },
- {
- aggregate{aggregate{fmt.Errorf("abc")}},
- []Matcher{},
- aggregate{aggregate{fmt.Errorf("abc")}},
- },
- {
- aggregate{aggregate{fmt.Errorf("abc"), aggregate{fmt.Errorf("def")}}},
- []Matcher{},
- aggregate{aggregate{fmt.Errorf("abc"), aggregate{fmt.Errorf("def")}}},
- },
- {
- aggregate{aggregate{fmt.Errorf("abc"), aggregate{fmt.Errorf("def")}}},
- []Matcher{func(err error) bool { return err.Error() == "def" }},
- aggregate{aggregate{fmt.Errorf("abc")}},
- },
- }
- for i, testCase := range testCases {
- err := FilterOut(testCase.err, testCase.filter...)
- if !reflect.DeepEqual(testCase.expected, err) {
- t.Errorf("%d: expected %v, got %v", i, testCase.expected, err)
- }
- }
-}
-
-func TestFlatten(t *testing.T) {
- testCases := []struct {
- agg Aggregate
- expected Aggregate
- }{
- {
- nil,
- nil,
- },
- {
- aggregate{},
- nil,
- },
- {
- aggregate{fmt.Errorf("abc")},
- aggregate{fmt.Errorf("abc")},
- },
- {
- aggregate{fmt.Errorf("abc"), fmt.Errorf("def"), fmt.Errorf("ghi")},
- aggregate{fmt.Errorf("abc"), fmt.Errorf("def"), fmt.Errorf("ghi")},
- },
- {
- aggregate{aggregate{fmt.Errorf("abc")}},
- aggregate{fmt.Errorf("abc")},
- },
- {
- aggregate{aggregate{aggregate{fmt.Errorf("abc")}}},
- aggregate{fmt.Errorf("abc")},
- },
- {
- aggregate{aggregate{fmt.Errorf("abc"), aggregate{fmt.Errorf("def")}}},
- aggregate{fmt.Errorf("abc"), fmt.Errorf("def")},
- },
- {
- aggregate{aggregate{aggregate{fmt.Errorf("abc")}, fmt.Errorf("def"), aggregate{fmt.Errorf("ghi")}}},
- aggregate{fmt.Errorf("abc"), fmt.Errorf("def"), fmt.Errorf("ghi")},
- },
- }
- for i, testCase := range testCases {
- agg := Flatten(testCase.agg)
- if !reflect.DeepEqual(testCase.expected, agg) {
- t.Errorf("%d: expected %v, got %v", i, testCase.expected, agg)
- }
- }
-}
-
-func TestCreateAggregateFromMessageCountMap(t *testing.T) {
- testCases := []struct {
- name string
- mcm MessageCountMap
- expected Aggregate
- }{
- {
- "input has single instance of one message",
- MessageCountMap{"abc": 1},
- aggregate{fmt.Errorf("abc")},
- },
- {
- "input has multiple messages",
- MessageCountMap{"abc": 2, "ghi": 1},
- aggregate{fmt.Errorf("abc (repeated 2 times)"), fmt.Errorf("ghi")},
- },
- {
- "input has multiple messages",
- MessageCountMap{"ghi": 1, "abc": 2},
- aggregate{fmt.Errorf("abc (repeated 2 times)"), fmt.Errorf("ghi")},
- },
- }
-
- var expected, agg []error
- for _, testCase := range testCases {
- t.Run(testCase.name, func(t *testing.T) {
- if testCase.expected != nil {
- expected = testCase.expected.Errors()
- sort.Slice(expected, func(i, j int) bool { return expected[i].Error() < expected[j].Error() })
- }
- if testCase.mcm != nil {
- agg = CreateAggregateFromMessageCountMap(testCase.mcm).Errors()
- sort.Slice(agg, func(i, j int) bool { return agg[i].Error() < agg[j].Error() })
- }
- if !reflect.DeepEqual(expected, agg) {
- t.Errorf("expected %v, got %v", expected, agg)
- }
- })
- }
-}
-
-func TestAggregateGoroutines(t *testing.T) {
- testCases := []struct {
- errs []error
- expected map[string]bool // can't compare directly to Aggregate due to non-deterministic ordering
- }{
- {
- []error{},
- nil,
- },
- {
- []error{nil},
- nil,
- },
- {
- []error{nil, nil},
- nil,
- },
- {
- []error{fmt.Errorf("1")},
- map[string]bool{"1": true},
- },
- {
- []error{fmt.Errorf("1"), nil},
- map[string]bool{"1": true},
- },
- {
- []error{fmt.Errorf("1"), fmt.Errorf("267")},
- map[string]bool{"1": true, "267": true},
- },
- {
- []error{fmt.Errorf("1"), nil, fmt.Errorf("1234")},
- map[string]bool{"1": true, "1234": true},
- },
- {
- []error{nil, fmt.Errorf("1"), nil, fmt.Errorf("1234"), fmt.Errorf("22")},
- map[string]bool{"1": true, "1234": true, "22": true},
- },
- }
- for i, testCase := range testCases {
- funcs := make([]func() error, len(testCase.errs))
- for i := range testCase.errs {
- err := testCase.errs[i]
- funcs[i] = func() error { return err }
- }
- agg := AggregateGoroutines(funcs...)
- if agg == nil {
- if len(testCase.expected) > 0 {
- t.Errorf("%d: expected %v, got nil", i, testCase.expected)
- }
- continue
- }
- if len(agg.Errors()) != len(testCase.expected) {
- t.Errorf("%d: expected %d errors in aggregate, got %v", i, len(testCase.expected), agg)
- continue
- }
- for _, err := range agg.Errors() {
- if !testCase.expected[err.Error()] {
- t.Errorf("%d: expected %v, got aggregate containing %v", i, testCase.expected, err)
- }
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/framer/framer_test.go b/vendor/k8s.io/apimachinery/pkg/util/framer/framer_test.go
deleted file mode 100644
index b7ed00f53..000000000
--- a/vendor/k8s.io/apimachinery/pkg/util/framer/framer_test.go
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package framer
-
-import (
- "bytes"
- "io"
- "io/ioutil"
- "testing"
-)
-
-func TestRead(t *testing.T) {
- data := []byte{
- 0x00, 0x00, 0x00, 0x04,
- 0x01, 0x02, 0x03, 0x04,
- 0x00, 0x00, 0x00, 0x03,
- 0x05, 0x06, 0x07,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x01,
- 0x08,
- }
- b := bytes.NewBuffer(data)
- r := NewLengthDelimitedFrameReader(ioutil.NopCloser(b))
- buf := make([]byte, 1)
- if n, err := r.Read(buf); err != io.ErrShortBuffer && n != 1 && bytes.Equal(buf, []byte{0x01}) {
- t.Fatalf("unexpected: %v %d %v", err, n, buf)
- }
- if n, err := r.Read(buf); err != io.ErrShortBuffer && n != 1 && bytes.Equal(buf, []byte{0x02}) {
- t.Fatalf("unexpected: %v %d %v", err, n, buf)
- }
- // read the remaining frame
- buf = make([]byte, 2)
- if n, err := r.Read(buf); err != nil && n != 2 && bytes.Equal(buf, []byte{0x03, 0x04}) {
- t.Fatalf("unexpected: %v %d %v", err, n, buf)
- }
- // read with buffer equal to frame
- buf = make([]byte, 3)
- if n, err := r.Read(buf); err != nil && n != 3 && bytes.Equal(buf, []byte{0x05, 0x06, 0x07}) {
- t.Fatalf("unexpected: %v %d %v", err, n, buf)
- }
- // read empty frame
- buf = make([]byte, 3)
- if n, err := r.Read(buf); err != nil && n != 0 && bytes.Equal(buf, []byte{}) {
- t.Fatalf("unexpected: %v %d %v", err, n, buf)
- }
- // read with larger buffer than frame
- buf = make([]byte, 3)
- if n, err := r.Read(buf); err != nil && n != 1 && bytes.Equal(buf, []byte{0x08}) {
- t.Fatalf("unexpected: %v %d %v", err, n, buf)
- }
- // read EOF
- if n, err := r.Read(buf); err != io.EOF && n != 0 {
- t.Fatalf("unexpected: %v %d", err, n)
- }
-}
-
-func TestReadLarge(t *testing.T) {
- data := []byte{
- 0x00, 0x00, 0x00, 0x04,
- 0x01, 0x02, 0x03, 0x04,
- 0x00, 0x00, 0x00, 0x03,
- 0x05, 0x06, 0x07,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x01,
- 0x08,
- }
- b := bytes.NewBuffer(data)
- r := NewLengthDelimitedFrameReader(ioutil.NopCloser(b))
- buf := make([]byte, 40)
- if n, err := r.Read(buf); err != nil && n != 4 && bytes.Equal(buf, []byte{0x01, 0x02, 0x03, 0x04}) {
- t.Fatalf("unexpected: %v %d %v", err, n, buf)
- }
- if n, err := r.Read(buf); err != nil && n != 3 && bytes.Equal(buf, []byte{0x05, 0x06, 0x7}) {
- t.Fatalf("unexpected: %v %d %v", err, n, buf)
- }
- if n, err := r.Read(buf); err != nil && n != 0 && bytes.Equal(buf, []byte{}) {
- t.Fatalf("unexpected: %v %d %v", err, n, buf)
- }
- if n, err := r.Read(buf); err != nil && n != 1 && bytes.Equal(buf, []byte{0x08}) {
- t.Fatalf("unexpected: %v %d %v", err, n, buf)
- }
- // read EOF
- if n, err := r.Read(buf); err != io.EOF && n != 0 {
- t.Fatalf("unexpected: %v %d", err, n)
- }
-}
-func TestReadInvalidFrame(t *testing.T) {
- data := []byte{
- 0x00, 0x00, 0x00, 0x04,
- 0x01, 0x02,
- }
- b := bytes.NewBuffer(data)
- r := NewLengthDelimitedFrameReader(ioutil.NopCloser(b))
- buf := make([]byte, 1)
- if n, err := r.Read(buf); err != io.ErrShortBuffer && n != 1 && bytes.Equal(buf, []byte{0x01}) {
- t.Fatalf("unexpected: %v %d %v", err, n, buf)
- }
- // read the remaining frame
- buf = make([]byte, 3)
- if n, err := r.Read(buf); err != io.ErrUnexpectedEOF && n != 1 && bytes.Equal(buf, []byte{0x02}) {
- t.Fatalf("unexpected: %v %d %v", err, n, buf)
- }
- // read EOF
- if n, err := r.Read(buf); err != io.EOF && n != 0 {
- t.Fatalf("unexpected: %v %d", err, n)
- }
-}
-
-func TestJSONFrameReader(t *testing.T) {
- b := bytes.NewBufferString("{\"test\":true}\n1\n[\"a\"]")
- r := NewJSONFramedReader(ioutil.NopCloser(b))
- buf := make([]byte, 20)
- if n, err := r.Read(buf); err != nil || n != 13 || string(buf[:n]) != `{"test":true}` {
- t.Fatalf("unexpected: %v %d %q", err, n, buf)
- }
- if n, err := r.Read(buf); err != nil || n != 1 || string(buf[:n]) != `1` {
- t.Fatalf("unexpected: %v %d %q", err, n, buf)
- }
- if n, err := r.Read(buf); err != nil || n != 5 || string(buf[:n]) != `["a"]` {
- t.Fatalf("unexpected: %v %d %q", err, n, buf)
- }
- if n, err := r.Read(buf); err != io.EOF || n != 0 {
- t.Fatalf("unexpected: %v %d %q", err, n, buf)
- }
-}
-
-func TestJSONFrameReaderShortBuffer(t *testing.T) {
- b := bytes.NewBufferString("{\"test\":true}\n1\n[\"a\"]")
- r := NewJSONFramedReader(ioutil.NopCloser(b))
- buf := make([]byte, 3)
-
- if n, err := r.Read(buf); err != io.ErrShortBuffer || n != 3 || string(buf[:n]) != `{"t` {
- t.Fatalf("unexpected: %v %d %q", err, n, buf)
- }
- if n, err := r.Read(buf); err != io.ErrShortBuffer || n != 3 || string(buf[:n]) != `est` {
- t.Fatalf("unexpected: %v %d %q", err, n, buf)
- }
- if n, err := r.Read(buf); err != io.ErrShortBuffer || n != 3 || string(buf[:n]) != `":t` {
- t.Fatalf("unexpected: %v %d %q", err, n, buf)
- }
- if n, err := r.Read(buf); err != io.ErrShortBuffer || n != 3 || string(buf[:n]) != `rue` {
- t.Fatalf("unexpected: %v %d %q", err, n, buf)
- }
- if n, err := r.Read(buf); err != nil || n != 1 || string(buf[:n]) != `}` {
- t.Fatalf("unexpected: %v %d %q", err, n, buf)
- }
-
- if n, err := r.Read(buf); err != nil || n != 1 || string(buf[:n]) != `1` {
- t.Fatalf("unexpected: %v %d %q", err, n, buf)
- }
-
- if n, err := r.Read(buf); err != io.ErrShortBuffer || n != 3 || string(buf[:n]) != `["a` {
- t.Fatalf("unexpected: %v %d %q", err, n, buf)
- }
- if n, err := r.Read(buf); err != nil || n != 2 || string(buf[:n]) != `"]` {
- t.Fatalf("unexpected: %v %d %q", err, n, buf)
- }
-
- if n, err := r.Read(buf); err != io.EOF || n != 0 {
- t.Fatalf("unexpected: %v %d %q", err, n, buf)
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/intstr/intstr_test.go b/vendor/k8s.io/apimachinery/pkg/util/intstr/intstr_test.go
deleted file mode 100644
index 4faba46f8..000000000
--- a/vendor/k8s.io/apimachinery/pkg/util/intstr/intstr_test.go
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package intstr
-
-import (
- "encoding/json"
- "reflect"
- "testing"
-
- "github.com/ghodss/yaml"
-)
-
-func TestFromInt(t *testing.T) {
- i := FromInt(93)
- if i.Type != Int || i.IntVal != 93 {
- t.Errorf("Expected IntVal=93, got %+v", i)
- }
-}
-
-func TestFromString(t *testing.T) {
- i := FromString("76")
- if i.Type != String || i.StrVal != "76" {
- t.Errorf("Expected StrVal=\"76\", got %+v", i)
- }
-}
-
-type IntOrStringHolder struct {
- IOrS IntOrString `json:"val"`
-}
-
-func TestIntOrStringUnmarshalJSON(t *testing.T) {
- cases := []struct {
- input string
- result IntOrString
- }{
- {"{\"val\": 123}", FromInt(123)},
- {"{\"val\": \"123\"}", FromString("123")},
- }
-
- for _, c := range cases {
- var result IntOrStringHolder
- if err := json.Unmarshal([]byte(c.input), &result); err != nil {
- t.Errorf("Failed to unmarshal input '%v': %v", c.input, err)
- }
- if result.IOrS != c.result {
- t.Errorf("Failed to unmarshal input '%v': expected %+v, got %+v", c.input, c.result, result)
- }
- }
-}
-
-func TestIntOrStringMarshalJSON(t *testing.T) {
- cases := []struct {
- input IntOrString
- result string
- }{
- {FromInt(123), "{\"val\":123}"},
- {FromString("123"), "{\"val\":\"123\"}"},
- }
-
- for _, c := range cases {
- input := IntOrStringHolder{c.input}
- result, err := json.Marshal(&input)
- if err != nil {
- t.Errorf("Failed to marshal input '%v': %v", input, err)
- }
- if string(result) != c.result {
- t.Errorf("Failed to marshal input '%v': expected: %+v, got %q", input, c.result, string(result))
- }
- }
-}
-
-func TestIntOrStringMarshalJSONUnmarshalYAML(t *testing.T) {
- cases := []struct {
- input IntOrString
- }{
- {FromInt(123)},
- {FromString("123")},
- }
-
- for _, c := range cases {
- input := IntOrStringHolder{c.input}
- jsonMarshalled, err := json.Marshal(&input)
- if err != nil {
- t.Errorf("1: Failed to marshal input: '%v': %v", input, err)
- }
-
- var result IntOrStringHolder
- err = yaml.Unmarshal(jsonMarshalled, &result)
- if err != nil {
- t.Errorf("2: Failed to unmarshal '%+v': %v", string(jsonMarshalled), err)
- }
-
- if !reflect.DeepEqual(input, result) {
- t.Errorf("3: Failed to marshal input '%+v': got %+v", input, result)
- }
- }
-}
-
-func TestGetValueFromIntOrPercent(t *testing.T) {
- tests := []struct {
- input IntOrString
- total int
- roundUp bool
- expectErr bool
- expectVal int
- }{
- {
- input: FromInt(123),
- expectErr: false,
- expectVal: 123,
- },
- {
- input: FromString("90%"),
- total: 100,
- roundUp: true,
- expectErr: false,
- expectVal: 90,
- },
- {
- input: FromString("90%"),
- total: 95,
- roundUp: true,
- expectErr: false,
- expectVal: 86,
- },
- {
- input: FromString("90%"),
- total: 95,
- roundUp: false,
- expectErr: false,
- expectVal: 85,
- },
- {
- input: FromString("%"),
- expectErr: true,
- },
- {
- input: FromString("90#"),
- expectErr: true,
- },
- {
- input: FromString("#%"),
- expectErr: true,
- },
- }
-
- for i, test := range tests {
- t.Logf("test case %d", i)
- value, err := GetValueFromIntOrPercent(&test.input, test.total, test.roundUp)
- if test.expectErr && err == nil {
- t.Errorf("expected error, but got none")
- continue
- }
- if !test.expectErr && err != nil {
- t.Errorf("unexpected err: %v", err)
- continue
- }
- if test.expectVal != value {
- t.Errorf("expected %v, but got %v", test.expectVal, value)
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/json/json_test.go b/vendor/k8s.io/apimachinery/pkg/util/json/json_test.go
deleted file mode 100644
index cd0c18bb2..000000000
--- a/vendor/k8s.io/apimachinery/pkg/util/json/json_test.go
+++ /dev/null
@@ -1,319 +0,0 @@
-// +build go1.8
-
-/*
-Copyright 2015 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package json
-
-import (
- "fmt"
- "math"
- "reflect"
- "strconv"
- "strings"
- "testing"
-)
-
-func TestEvaluateTypes(t *testing.T) {
- testCases := []struct {
- In string
- Data interface{}
- Out string
- Err bool
- }{
- // Invalid syntaxes
- {
- In: `x`,
- Err: true,
- },
- {
- In: ``,
- Err: true,
- },
-
- // Null
- {
- In: `null`,
- Data: nil,
- Out: `null`,
- },
- // Booleans
- {
- In: `true`,
- Data: true,
- Out: `true`,
- },
- {
- In: `false`,
- Data: false,
- Out: `false`,
- },
-
- // Integers
- {
- In: `0`,
- Data: int64(0),
- Out: `0`,
- },
- {
- In: `-0`,
- Data: int64(-0),
- Out: `0`,
- },
- {
- In: `1`,
- Data: int64(1),
- Out: `1`,
- },
- {
- In: `2147483647`,
- Data: int64(math.MaxInt32),
- Out: `2147483647`,
- },
- {
- In: `-2147483648`,
- Data: int64(math.MinInt32),
- Out: `-2147483648`,
- },
- {
- In: `9223372036854775807`,
- Data: int64(math.MaxInt64),
- Out: `9223372036854775807`,
- },
- {
- In: `-9223372036854775808`,
- Data: int64(math.MinInt64),
- Out: `-9223372036854775808`,
- },
-
- // Int overflow
- {
- In: `9223372036854775808`, // MaxInt64 + 1
- Data: float64(9223372036854775808),
- Out: `9223372036854776000`,
- },
- {
- In: `-9223372036854775809`, // MinInt64 - 1
- Data: float64(math.MinInt64),
- Out: `-9223372036854776000`,
- },
-
- // Floats
- {
- In: `0.0`,
- Data: float64(0),
- Out: `0`,
- },
- {
- In: `-0.0`,
- Data: float64(-0.0),
- Out: `-0`,
- },
- {
- In: `0.5`,
- Data: float64(0.5),
- Out: `0.5`,
- },
- {
- In: `1e3`,
- Data: float64(1e3),
- Out: `1000`,
- },
- {
- In: `1.5`,
- Data: float64(1.5),
- Out: `1.5`,
- },
- {
- In: `-0.3`,
- Data: float64(-.3),
- Out: `-0.3`,
- },
- {
- // Largest representable float32
- In: `3.40282346638528859811704183484516925440e+38`,
- Data: float64(math.MaxFloat32),
- Out: strconv.FormatFloat(math.MaxFloat32, 'g', -1, 64),
- },
- {
- // Smallest float32 without losing precision
- In: `1.175494351e-38`,
- Data: float64(1.175494351e-38),
- Out: `1.175494351e-38`,
- },
- {
- // float32 closest to zero
- In: `1.401298464324817070923729583289916131280e-45`,
- Data: float64(math.SmallestNonzeroFloat32),
- Out: strconv.FormatFloat(math.SmallestNonzeroFloat32, 'g', -1, 64),
- },
- {
- // Largest representable float64
- In: `1.797693134862315708145274237317043567981e+308`,
- Data: float64(math.MaxFloat64),
- Out: strconv.FormatFloat(math.MaxFloat64, 'g', -1, 64),
- },
- {
- // Closest to zero without losing precision
- In: `2.2250738585072014e-308`,
- Data: float64(2.2250738585072014e-308),
- Out: `2.2250738585072014e-308`,
- },
-
- {
- // float64 closest to zero
- In: `4.940656458412465441765687928682213723651e-324`,
- Data: float64(math.SmallestNonzeroFloat64),
- Out: strconv.FormatFloat(math.SmallestNonzeroFloat64, 'g', -1, 64),
- },
-
- {
- // math.MaxFloat64 + 2 overflow
- In: `1.7976931348623159e+308`,
- Err: true,
- },
-
- // Strings
- {
- In: `""`,
- Data: string(""),
- Out: `""`,
- },
- {
- In: `"0"`,
- Data: string("0"),
- Out: `"0"`,
- },
- {
- In: `"A"`,
- Data: string("A"),
- Out: `"A"`,
- },
- {
- In: `"Iñtërnâtiônàlizætiøn"`,
- Data: string("Iñtërnâtiônàlizætiøn"),
- Out: `"Iñtërnâtiônàlizætiøn"`,
- },
-
- // Arrays
- {
- In: `[]`,
- Data: []interface{}{},
- Out: `[]`,
- },
- {
- In: `[` + strings.Join([]string{
- `null`,
- `true`,
- `false`,
- `0`,
- `9223372036854775807`,
- `0.0`,
- `0.5`,
- `1.0`,
- `1.797693134862315708145274237317043567981e+308`,
- `"0"`,
- `"A"`,
- `"Iñtërnâtiônàlizætiøn"`,
- `[null,true,1,1.0,1.5]`,
- `{"boolkey":true,"floatkey":1.0,"intkey":1,"nullkey":null}`,
- }, ",") + `]`,
- Data: []interface{}{
- nil,
- true,
- false,
- int64(0),
- int64(math.MaxInt64),
- float64(0.0),
- float64(0.5),
- float64(1.0),
- float64(math.MaxFloat64),
- string("0"),
- string("A"),
- string("Iñtërnâtiônàlizætiøn"),
- []interface{}{nil, true, int64(1), float64(1.0), float64(1.5)},
- map[string]interface{}{"nullkey": nil, "boolkey": true, "intkey": int64(1), "floatkey": float64(1.0)},
- },
- Out: `[` + strings.Join([]string{
- `null`,
- `true`,
- `false`,
- `0`,
- `9223372036854775807`,
- `0`,
- `0.5`,
- `1`,
- strconv.FormatFloat(math.MaxFloat64, 'g', -1, 64),
- `"0"`,
- `"A"`,
- `"Iñtërnâtiônàlizætiøn"`,
- `[null,true,1,1,1.5]`,
- `{"boolkey":true,"floatkey":1,"intkey":1,"nullkey":null}`, // gets alphabetized by Marshal
- }, ",") + `]`,
- },
-
- // Maps
- {
- In: `{}`,
- Data: map[string]interface{}{},
- Out: `{}`,
- },
- {
- In: `{"boolkey":true,"floatkey":1.0,"intkey":1,"nullkey":null}`,
- Data: map[string]interface{}{"nullkey": nil, "boolkey": true, "intkey": int64(1), "floatkey": float64(1.0)},
- Out: `{"boolkey":true,"floatkey":1,"intkey":1,"nullkey":null}`, // gets alphabetized by Marshal
- },
- }
-
- for _, tc := range testCases {
- inputJSON := fmt.Sprintf(`{"data":%s}`, tc.In)
- expectedJSON := fmt.Sprintf(`{"data":%s}`, tc.Out)
- m := map[string]interface{}{}
- err := Unmarshal([]byte(inputJSON), &m)
- if tc.Err && err != nil {
- // Expected error
- continue
- }
- if err != nil {
- t.Errorf("%s: error decoding: %v", tc.In, err)
- continue
- }
- if tc.Err {
- t.Errorf("%s: expected error, got none", tc.In)
- continue
- }
- data, ok := m["data"]
- if !ok {
- t.Errorf("%s: decoded object missing data key: %#v", tc.In, m)
- continue
- }
- if !reflect.DeepEqual(tc.Data, data) {
- t.Errorf("%s: expected\n\t%#v (%v), got\n\t%#v (%v)", tc.In, tc.Data, reflect.TypeOf(tc.Data), data, reflect.TypeOf(data))
- continue
- }
-
- outputJSON, err := Marshal(m)
- if err != nil {
- t.Errorf("%s: error encoding: %v", tc.In, err)
- continue
- }
-
- if expectedJSON != string(outputJSON) {
- t.Errorf("%s: expected\n\t%s, got\n\t%s", tc.In, expectedJSON, string(outputJSON))
- continue
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/mergepatch/util_test.go b/vendor/k8s.io/apimachinery/pkg/util/mergepatch/util_test.go
deleted file mode 100644
index 1b37e3ef5..000000000
--- a/vendor/k8s.io/apimachinery/pkg/util/mergepatch/util_test.go
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package mergepatch
-
-import (
- "fmt"
- "testing"
-)
-
-func TestHasConflicts(t *testing.T) {
- testCases := []struct {
- A interface{}
- B interface{}
- Ret bool
- }{
- {A: "hello", B: "hello", Ret: false},
- {A: "hello", B: "hell", Ret: true},
- {A: "hello", B: nil, Ret: true},
- {A: "hello", B: 1, Ret: true},
- {A: "hello", B: float64(1.0), Ret: true},
- {A: "hello", B: false, Ret: true},
- {A: 1, B: 1, Ret: false},
- {A: nil, B: nil, Ret: false},
- {A: false, B: false, Ret: false},
- {A: float64(3), B: float64(3), Ret: false},
-
- {A: "hello", B: []interface{}{}, Ret: true},
- {A: []interface{}{1}, B: []interface{}{}, Ret: true},
- {A: []interface{}{}, B: []interface{}{}, Ret: false},
- {A: []interface{}{1}, B: []interface{}{1}, Ret: false},
- {A: map[string]interface{}{}, B: []interface{}{1}, Ret: true},
-
- {A: map[string]interface{}{}, B: map[string]interface{}{"a": 1}, Ret: false},
- {A: map[string]interface{}{"a": 1}, B: map[string]interface{}{"a": 1}, Ret: false},
- {A: map[string]interface{}{"a": 1}, B: map[string]interface{}{"a": 2}, Ret: true},
- {A: map[string]interface{}{"a": 1}, B: map[string]interface{}{"b": 2}, Ret: false},
-
- {
- A: map[string]interface{}{"a": []interface{}{1}},
- B: map[string]interface{}{"a": []interface{}{1}},
- Ret: false,
- },
- {
- A: map[string]interface{}{"a": []interface{}{1}},
- B: map[string]interface{}{"a": []interface{}{}},
- Ret: true,
- },
- {
- A: map[string]interface{}{"a": []interface{}{1}},
- B: map[string]interface{}{"a": 1},
- Ret: true,
- },
-
- // Maps and lists with multiple entries.
- {
- A: map[string]interface{}{"a": 1, "b": 2},
- B: map[string]interface{}{"a": 1, "b": 0},
- Ret: true,
- },
- {
- A: map[string]interface{}{"a": 1, "b": 2},
- B: map[string]interface{}{"a": 1, "b": 2},
- Ret: false,
- },
- {
- A: map[string]interface{}{"a": 1, "b": 2},
- B: map[string]interface{}{"a": 1, "b": 0, "c": 3},
- Ret: true,
- },
- {
- A: map[string]interface{}{"a": 1, "b": 2},
- B: map[string]interface{}{"a": 1, "b": 2, "c": 3},
- Ret: false,
- },
- {
- A: map[string]interface{}{"a": []interface{}{1, 2}},
- B: map[string]interface{}{"a": []interface{}{1, 0}},
- Ret: true,
- },
- {
- A: map[string]interface{}{"a": []interface{}{1, 2}},
- B: map[string]interface{}{"a": []interface{}{1, 2}},
- Ret: false,
- },
-
- // Numeric types are not interchangeable.
- // Callers are expected to ensure numeric types are consistent in 'left' and 'right'.
- {A: int(0), B: int64(0), Ret: true},
- {A: int(0), B: float64(0), Ret: true},
- {A: int64(0), B: float64(0), Ret: true},
- // Other types are not interchangeable.
- {A: int(0), B: "0", Ret: true},
- {A: int(0), B: nil, Ret: true},
- {A: int(0), B: false, Ret: true},
- {A: "true", B: true, Ret: true},
- {A: "null", B: nil, Ret: true},
- }
-
- for _, testCase := range testCases {
- testStr := fmt.Sprintf("A = %#v, B = %#v", testCase.A, testCase.B)
- // Run each test case multiple times if it passes because HasConflicts()
- // uses map iteration, which returns keys in nondeterministic order.
- for try := 0; try < 10; try++ {
- out, err := HasConflicts(testCase.A, testCase.B)
- if err != nil {
- t.Errorf("%v: unexpected error: %v", testStr, err)
- break
- }
- if out != testCase.Ret {
- t.Errorf("%v: expected %t got %t", testStr, testCase.Ret, out)
- break
- }
- out, err = HasConflicts(testCase.B, testCase.A)
- if err != nil {
- t.Errorf("%v: unexpected error: %v", testStr, err)
- break
- }
- if out != testCase.Ret {
- t.Errorf("%v: expected reversed %t got %t", testStr, testCase.Ret, out)
- break
- }
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/net/http_test.go b/vendor/k8s.io/apimachinery/pkg/util/net/http_test.go
deleted file mode 100644
index 98bd64971..000000000
--- a/vendor/k8s.io/apimachinery/pkg/util/net/http_test.go
+++ /dev/null
@@ -1,282 +0,0 @@
-// +build go1.8
-
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package net
-
-import (
- "crypto/tls"
- "fmt"
- "net"
- "net/http"
- "net/url"
- "os"
- "reflect"
- "testing"
-)
-
-func TestGetClientIP(t *testing.T) {
- ipString := "10.0.0.1"
- ip := net.ParseIP(ipString)
- invalidIPString := "invalidIPString"
- testCases := []struct {
- Request http.Request
- ExpectedIP net.IP
- }{
- {
- Request: http.Request{},
- },
- {
- Request: http.Request{
- Header: map[string][]string{
- "X-Real-Ip": {ipString},
- },
- },
- ExpectedIP: ip,
- },
- {
- Request: http.Request{
- Header: map[string][]string{
- "X-Real-Ip": {invalidIPString},
- },
- },
- },
- {
- Request: http.Request{
- Header: map[string][]string{
- "X-Forwarded-For": {ipString},
- },
- },
- ExpectedIP: ip,
- },
- {
- Request: http.Request{
- Header: map[string][]string{
- "X-Forwarded-For": {invalidIPString},
- },
- },
- },
- {
- Request: http.Request{
- Header: map[string][]string{
- "X-Forwarded-For": {invalidIPString + "," + ipString},
- },
- },
- ExpectedIP: ip,
- },
- {
- Request: http.Request{
- // RemoteAddr is in the form host:port
- RemoteAddr: ipString + ":1234",
- },
- ExpectedIP: ip,
- },
- {
- Request: http.Request{
- RemoteAddr: invalidIPString,
- },
- },
- {
- Request: http.Request{
- Header: map[string][]string{
- "X-Forwarded-For": {invalidIPString},
- },
- // RemoteAddr is in the form host:port
- RemoteAddr: ipString,
- },
- ExpectedIP: ip,
- },
- }
-
- for i, test := range testCases {
- if a, e := GetClientIP(&test.Request), test.ExpectedIP; reflect.DeepEqual(e, a) != true {
- t.Fatalf("test case %d failed. expected: %v, actual: %v", i, e, a)
- }
- }
-}
-
-func TestAppendForwardedForHeader(t *testing.T) {
- testCases := []struct {
- addr, forwarded, expected string
- }{
- {"1.2.3.4:8000", "", "1.2.3.4"},
- {"1.2.3.4:8000", "8.8.8.8", "8.8.8.8, 1.2.3.4"},
- {"1.2.3.4:8000", "8.8.8.8, 1.2.3.4", "8.8.8.8, 1.2.3.4, 1.2.3.4"},
- {"1.2.3.4:8000", "foo,bar", "foo,bar, 1.2.3.4"},
- }
- for i, test := range testCases {
- req := &http.Request{
- RemoteAddr: test.addr,
- Header: make(http.Header),
- }
- if test.forwarded != "" {
- req.Header.Set("X-Forwarded-For", test.forwarded)
- }
-
- AppendForwardedForHeader(req)
- actual := req.Header.Get("X-Forwarded-For")
- if actual != test.expected {
- t.Errorf("[%d] Expected %q, Got %q", i, test.expected, actual)
- }
- }
-}
-
-func TestProxierWithNoProxyCIDR(t *testing.T) {
- testCases := []struct {
- name string
- noProxy string
- url string
-
- expectedDelegated bool
- }{
- {
- name: "no env",
- url: "https://192.168.143.1/api",
- expectedDelegated: true,
- },
- {
- name: "no cidr",
- noProxy: "192.168.63.1",
- url: "https://192.168.143.1/api",
- expectedDelegated: true,
- },
- {
- name: "hostname",
- noProxy: "192.168.63.0/24,192.168.143.0/24",
- url: "https://my-hostname/api",
- expectedDelegated: true,
- },
- {
- name: "match second cidr",
- noProxy: "192.168.63.0/24,192.168.143.0/24",
- url: "https://192.168.143.1/api",
- expectedDelegated: false,
- },
- {
- name: "match second cidr with host:port",
- noProxy: "192.168.63.0/24,192.168.143.0/24",
- url: "https://192.168.143.1:8443/api",
- expectedDelegated: false,
- },
- {
- name: "IPv6 cidr",
- noProxy: "2001:db8::/48",
- url: "https://[2001:db8::1]/api",
- expectedDelegated: false,
- },
- {
- name: "IPv6+port cidr",
- noProxy: "2001:db8::/48",
- url: "https://[2001:db8::1]:8443/api",
- expectedDelegated: false,
- },
- {
- name: "IPv6, not matching cidr",
- noProxy: "2001:db8::/48",
- url: "https://[2001:db8:1::1]/api",
- expectedDelegated: true,
- },
- {
- name: "IPv6+port, not matching cidr",
- noProxy: "2001:db8::/48",
- url: "https://[2001:db8:1::1]:8443/api",
- expectedDelegated: true,
- },
- }
-
- for _, test := range testCases {
- os.Setenv("NO_PROXY", test.noProxy)
- actualDelegated := false
- proxyFunc := NewProxierWithNoProxyCIDR(func(req *http.Request) (*url.URL, error) {
- actualDelegated = true
- return nil, nil
- })
-
- req, err := http.NewRequest("GET", test.url, nil)
- if err != nil {
- t.Errorf("%s: unexpected err: %v", test.name, err)
- continue
- }
- if _, err := proxyFunc(req); err != nil {
- t.Errorf("%s: unexpected err: %v", test.name, err)
- continue
- }
-
- if test.expectedDelegated != actualDelegated {
- t.Errorf("%s: expected %v, got %v", test.name, test.expectedDelegated, actualDelegated)
- continue
- }
- }
-}
-
-type fakeTLSClientConfigHolder struct {
- called bool
-}
-
-func (f *fakeTLSClientConfigHolder) TLSClientConfig() *tls.Config {
- f.called = true
- return nil
-}
-func (f *fakeTLSClientConfigHolder) RoundTrip(*http.Request) (*http.Response, error) {
- return nil, nil
-}
-
-func TestTLSClientConfigHolder(t *testing.T) {
- rt := &fakeTLSClientConfigHolder{}
- TLSClientConfig(rt)
-
- if !rt.called {
- t.Errorf("didn't find tls config")
- }
-}
-
-func TestJoinPreservingTrailingSlash(t *testing.T) {
- tests := []struct {
- a string
- b string
- want string
- }{
- // All empty
- {"", "", ""},
-
- // Empty a
- {"", "/", "/"},
- {"", "foo", "foo"},
- {"", "/foo", "/foo"},
- {"", "/foo/", "/foo/"},
-
- // Empty b
- {"/", "", "/"},
- {"foo", "", "foo"},
- {"/foo", "", "/foo"},
- {"/foo/", "", "/foo/"},
-
- // Both populated
- {"/", "/", "/"},
- {"foo", "foo", "foo/foo"},
- {"/foo", "/foo", "/foo/foo"},
- {"/foo/", "/foo/", "/foo/foo/"},
- }
- for _, tt := range tests {
- name := fmt.Sprintf("%q+%q=%q", tt.a, tt.b, tt.want)
- t.Run(name, func(t *testing.T) {
- if got := JoinPreservingTrailingSlash(tt.a, tt.b); got != tt.want {
- t.Errorf("JoinPreservingTrailingSlash() = %v, want %v", got, tt.want)
- }
- })
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/net/interface_test.go b/vendor/k8s.io/apimachinery/pkg/util/net/interface_test.go
deleted file mode 100644
index 4799d43ae..000000000
--- a/vendor/k8s.io/apimachinery/pkg/util/net/interface_test.go
+++ /dev/null
@@ -1,725 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package net
-
-import (
- "fmt"
- "io/ioutil"
- "net"
- "os"
- "strings"
- "testing"
-)
-
-const gatewayfirst = `Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT
-eth3 00000000 0100FE0A 0003 0 0 1024 00000000 0 0 0
-eth3 0000FE0A 00000000 0001 0 0 0 0080FFFF 0 0 0
-docker0 000011AC 00000000 0001 0 0 0 0000FFFF 0 0 0
-virbr0 007AA8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0
-`
-const gatewaylast = `Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT
-docker0 000011AC 00000000 0001 0 0 0 0000FFFF 0 0 0
-virbr0 007AA8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0
-eth3 0000FE0A 00000000 0001 0 0 0 0080FFFF 0 0 0
-eth3 00000000 0100FE0A 0003 0 0 1024 00000000 0 0 0
-`
-const gatewaymiddle = `Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT
-eth3 0000FE0A 00000000 0001 0 0 0 0080FFFF 0 0 0
-docker0 000011AC 00000000 0001 0 0 0 0000FFFF 0 0 0
-eth3 00000000 0100FE0A 0003 0 0 1024 00000000 0 0 0
-virbr0 007AA8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0
-`
-const noInternetConnection = `Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT
-docker0 000011AC 00000000 0001 0 0 0 0000FFFF 0 0 0
-virbr0 007AA8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0
-`
-const nothing = `Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT
-`
-const badDestination = `Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT
-eth3 00000000 0100FE0A 0003 0 0 1024 00000000 0 0 0
-eth3 0000FE0AA1 00000000 0001 0 0 0 0080FFFF 0 0 0
-docker0 000011AC 00000000 0001 0 0 0 0000FFFF 0 0 0
-virbr0 007AA8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0
-`
-const badGateway = `Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT
-eth3 00000000 0100FE0AA1 0003 0 0 1024 00000000 0 0 0
-eth3 0000FE0A 00000000 0001 0 0 0 0080FFFF 0 0 0
-docker0 000011AC 00000000 0001 0 0 0 0000FFFF 0 0 0
-virbr0 007AA8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0
-`
-const route_Invalidhex = `Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT
-eth3 00000000 0100FE0AA 0003 0 0 1024 00000000 0 0 0
-eth3 0000FE0A 00000000 0001 0 0 0 0080FFFF 0 0 0
-docker0 000011AC 00000000 0001 0 0 0 0000FFFF 0 0 0
-virbr0 007AA8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0
-`
-
-const v6gatewayfirst = `00000000000000000000000000000000 00 00000000000000000000000000000000 00 20010001000000000000000000000001 00000064 00000000 00000000 00000003 eth3
-20010002000000000000000000000000 40 00000000000000000000000000000000 00 00000000000000000000000000000000 00000100 00000000 00000000 00000001 eth3
-00000000000000000000000000000000 60 00000000000000000000000000000000 00 00000000000000000000000000000000 00000400 00000000 00000000 00200200 lo
-`
-const v6gatewaylast = `20010002000000000000000000000000 40 00000000000000000000000000000000 00 00000000000000000000000000000000 00000100 00000000 00000000 00000001 eth3
-00000000000000000000000000000000 60 00000000000000000000000000000000 00 00000000000000000000000000000000 00000400 00000000 00000000 00200200 lo
-00000000000000000000000000000000 00 00000000000000000000000000000000 00 20010001000000000000000000000001 00000064 00000000 00000000 00000003 eth3
-`
-const v6gatewaymiddle = `20010002000000000000000000000000 40 00000000000000000000000000000000 00 00000000000000000000000000000000 00000100 00000000 00000000 00000001 eth3
-00000000000000000000000000000000 00 00000000000000000000000000000000 00 20010001000000000000000000000001 00000064 00000000 00000000 00000003 eth3
-00000000000000000000000000000000 60 00000000000000000000000000000000 00 00000000000000000000000000000000 00000400 00000000 00000000 00200200 lo
-`
-const v6noDefaultRoutes = `00000000000000000000000000000000 60 00000000000000000000000000000000 00 00000000000000000000000000000000 00000400 00000000 00000000 00200200 lo
-20010001000000000000000000000000 40 00000000000000000000000000000000 00 00000000000000000000000000000000 00000400 00000000 00000000 00000001 docker0
-20010002000000000000000000000000 40 00000000000000000000000000000000 00 00000000000000000000000000000000 00000100 00000000 00000000 00000001 eth3
-fe800000000000000000000000000000 40 00000000000000000000000000000000 00 00000000000000000000000000000000 00000100 00000000 00000000 00000001 eth3
-`
-const v6nothing = ``
-const v6badDestination = `2001000200000000 7a 00000000000000000000000000000000 00 00000000000000000000000000000000 00000400 00000000 00000000 00200200 lo
-`
-const v6badGateway = `00000000000000000000000000000000 00 00000000000000000000000000000000 00 200100010000000000000000000000000012 00000064 00000000 00000000 00000003 eth3
-`
-const v6route_Invalidhex = `000000000000000000000000000000000 00 00000000000000000000000000000000 00 fe80000000000000021fcafffea0ec00 00000064 00000000 00000000 00000003 enp1s0f0
-
-`
-
-const (
- flagUp = net.FlagUp | net.FlagBroadcast | net.FlagMulticast
- flagDown = net.FlagBroadcast | net.FlagMulticast
- flagLoopback = net.FlagUp | net.FlagLoopback
- flagP2P = net.FlagUp | net.FlagPointToPoint
-)
-
-func makeIntf(index int, name string, flags net.Flags) net.Interface {
- mac := net.HardwareAddr{0, 0x32, 0x7d, 0x69, 0xf7, byte(0x30 + index)}
- return net.Interface{
- Index: index,
- MTU: 1500,
- Name: name,
- HardwareAddr: mac,
- Flags: flags}
-}
-
-var (
- downIntf = makeIntf(1, "eth3", flagDown)
- loopbackIntf = makeIntf(1, "lo", flagLoopback)
- p2pIntf = makeIntf(1, "lo", flagP2P)
- upIntf = makeIntf(1, "eth3", flagUp)
-)
-
-var (
- ipv4Route = Route{Interface: "eth3", Destination: net.ParseIP("0.0.0.0"), Gateway: net.ParseIP("10.254.0.1"), Family: familyIPv4}
- ipv6Route = Route{Interface: "eth3", Destination: net.ParseIP("::"), Gateway: net.ParseIP("2001:1::1"), Family: familyIPv6}
-)
-
-var (
- noRoutes = []Route{}
- routeV4 = []Route{ipv4Route}
- routeV6 = []Route{ipv6Route}
- bothRoutes = []Route{ipv4Route, ipv6Route}
-)
-
-func TestGetIPv4Routes(t *testing.T) {
- testCases := []struct {
- tcase string
- route string
- count int
- expected *Route
- errStrFrag string
- }{
- {"gatewayfirst", gatewayfirst, 1, &ipv4Route, ""},
- {"gatewaymiddle", gatewaymiddle, 1, &ipv4Route, ""},
- {"gatewaylast", gatewaylast, 1, &ipv4Route, ""},
- {"no routes", nothing, 0, nil, ""},
- {"badDestination", badDestination, 0, nil, "invalid IPv4"},
- {"badGateway", badGateway, 0, nil, "invalid IPv4"},
- {"route_Invalidhex", route_Invalidhex, 0, nil, "odd length hex string"},
- {"no default routes", noInternetConnection, 0, nil, ""},
- }
- for _, tc := range testCases {
- r := strings.NewReader(tc.route)
- routes, err := getIPv4DefaultRoutes(r)
- if err != nil {
- if !strings.Contains(err.Error(), tc.errStrFrag) {
- t.Errorf("case[%s]: Error string %q does not contain %q", tc.tcase, err, tc.errStrFrag)
- }
- } else if tc.errStrFrag != "" {
- t.Errorf("case[%s]: Error %q expected, but not seen", tc.tcase, tc.errStrFrag)
- } else {
- if tc.count != len(routes) {
- t.Errorf("case[%s]: expected %d routes, have %v", tc.tcase, tc.count, routes)
- } else if tc.count == 1 {
- if !tc.expected.Gateway.Equal(routes[0].Gateway) {
- t.Errorf("case[%s]: expected %v, got %v .err : %v", tc.tcase, tc.expected, routes, err)
- }
- if !routes[0].Destination.Equal(net.IPv4zero) {
- t.Errorf("case[%s}: destination is not for default route (not zero)", tc.tcase)
- }
-
- }
- }
- }
-}
-
-func TestGetIPv6Routes(t *testing.T) {
- testCases := []struct {
- tcase string
- route string
- count int
- expected *Route
- errStrFrag string
- }{
- {"v6 gatewayfirst", v6gatewayfirst, 1, &ipv6Route, ""},
- {"v6 gatewaymiddle", v6gatewaymiddle, 1, &ipv6Route, ""},
- {"v6 gatewaylast", v6gatewaylast, 1, &ipv6Route, ""},
- {"v6 no routes", v6nothing, 0, nil, ""},
- {"v6 badDestination", v6badDestination, 0, nil, "invalid IPv6"},
- {"v6 badGateway", v6badGateway, 0, nil, "invalid IPv6"},
- {"v6 route_Invalidhex", v6route_Invalidhex, 0, nil, "odd length hex string"},
- {"v6 no default routes", v6noDefaultRoutes, 0, nil, ""},
- }
- for _, tc := range testCases {
- r := strings.NewReader(tc.route)
- routes, err := getIPv6DefaultRoutes(r)
- if err != nil {
- if !strings.Contains(err.Error(), tc.errStrFrag) {
- t.Errorf("case[%s]: Error string %q does not contain %q", tc.tcase, err, tc.errStrFrag)
- }
- } else if tc.errStrFrag != "" {
- t.Errorf("case[%s]: Error %q expected, but not seen", tc.tcase, tc.errStrFrag)
- } else {
- if tc.count != len(routes) {
- t.Errorf("case[%s]: expected %d routes, have %v", tc.tcase, tc.count, routes)
- } else if tc.count == 1 {
- if !tc.expected.Gateway.Equal(routes[0].Gateway) {
- t.Errorf("case[%s]: expected %v, got %v .err : %v", tc.tcase, tc.expected, routes, err)
- }
- if !routes[0].Destination.Equal(net.IPv6zero) {
- t.Errorf("case[%s}: destination is not for default route (not zero)", tc.tcase)
- }
- }
- }
- }
-}
-
-func TestParseIP(t *testing.T) {
- testCases := []struct {
- tcase string
- ip string
- family AddressFamily
- success bool
- expected net.IP
- }{
- {"empty", "", familyIPv4, false, nil},
- {"too short", "AA", familyIPv4, false, nil},
- {"too long", "0011223344", familyIPv4, false, nil},
- {"invalid", "invalid!", familyIPv4, false, nil},
- {"zero", "00000000", familyIPv4, true, net.IP{0, 0, 0, 0}},
- {"ffff", "FFFFFFFF", familyIPv4, true, net.IP{0xff, 0xff, 0xff, 0xff}},
- {"valid v4", "12345678", familyIPv4, true, net.IP{120, 86, 52, 18}},
- {"valid v6", "fe800000000000000000000000000000", familyIPv6, true, net.IP{0xfe, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
- {"v6 too short", "fe80000000000000021fcafffea0ec0", familyIPv6, false, nil},
- {"v6 too long", "fe80000000000000021fcafffea0ec002", familyIPv6, false, nil},
- }
- for _, tc := range testCases {
- ip, err := parseIP(tc.ip, tc.family)
- if !ip.Equal(tc.expected) {
- t.Errorf("case[%v]: expected %q, got %q . err : %v", tc.tcase, tc.expected, ip, err)
- }
- }
-}
-
-func TestIsInterfaceUp(t *testing.T) {
- testCases := []struct {
- tcase string
- intf *net.Interface
- expected bool
- }{
- {"up", &net.Interface{Index: 0, MTU: 0, Name: "eth3", HardwareAddr: nil, Flags: net.FlagUp}, true},
- {"down", &net.Interface{Index: 0, MTU: 0, Name: "eth3", HardwareAddr: nil, Flags: 0}, false},
- {"no interface", nil, false},
- }
- for _, tc := range testCases {
- it := isInterfaceUp(tc.intf)
- if it != tc.expected {
- t.Errorf("case[%v]: expected %v, got %v .", tc.tcase, tc.expected, it)
- }
- }
-}
-
-type addrStruct struct{ val string }
-
-func (a addrStruct) Network() string {
- return a.val
-}
-func (a addrStruct) String() string {
- return a.val
-}
-
-func TestFinalIP(t *testing.T) {
- testCases := []struct {
- tcase string
- addr []net.Addr
- family AddressFamily
- expected net.IP
- }{
- {"no ipv4", []net.Addr{addrStruct{val: "2001::5/64"}}, familyIPv4, nil},
- {"no ipv6", []net.Addr{addrStruct{val: "10.128.0.4/32"}}, familyIPv6, nil},
- {"invalidV4CIDR", []net.Addr{addrStruct{val: "10.20.30.40.50/24"}}, familyIPv4, nil},
- {"invalidV6CIDR", []net.Addr{addrStruct{val: "fe80::2f7:67fff:fe6e:2956/64"}}, familyIPv6, nil},
- {"loopback", []net.Addr{addrStruct{val: "127.0.0.1/24"}}, familyIPv4, nil},
- {"loopbackv6", []net.Addr{addrStruct{val: "::1/128"}}, familyIPv6, nil},
- {"link local v4", []net.Addr{addrStruct{val: "169.254.1.10/16"}}, familyIPv4, nil},
- {"link local v6", []net.Addr{addrStruct{val: "fe80::2f7:6fff:fe6e:2956/64"}}, familyIPv6, nil},
- {"ip4", []net.Addr{addrStruct{val: "10.254.12.132/17"}}, familyIPv4, net.ParseIP("10.254.12.132")},
- {"ip6", []net.Addr{addrStruct{val: "2001::5/64"}}, familyIPv6, net.ParseIP("2001::5")},
-
- {"no addresses", []net.Addr{}, familyIPv4, nil},
- }
- for _, tc := range testCases {
- ip, err := getMatchingGlobalIP(tc.addr, tc.family)
- if !ip.Equal(tc.expected) {
- t.Errorf("case[%v]: expected %v, got %v .err : %v", tc.tcase, tc.expected, ip, err)
- }
- }
-}
-
-func TestAddrs(t *testing.T) {
- var nw networkInterfacer = validNetworkInterface{}
- intf := net.Interface{Index: 0, MTU: 0, Name: "eth3", HardwareAddr: nil, Flags: 0}
- addrs, err := nw.Addrs(&intf)
- if err != nil {
- t.Errorf("expected no error got : %v", err)
- }
- if len(addrs) != 2 {
- t.Errorf("expected addrs: 2 got null")
- }
-}
-
-// Has a valid IPv4 address (IPv6 is LLA)
-type validNetworkInterface struct {
-}
-
-func (_ validNetworkInterface) InterfaceByName(intfName string) (*net.Interface, error) {
- return &upIntf, nil
-}
-func (_ validNetworkInterface) Addrs(intf *net.Interface) ([]net.Addr, error) {
- var ifat []net.Addr
- ifat = []net.Addr{
- addrStruct{val: "fe80::2f7:6fff:fe6e:2956/64"}, addrStruct{val: "10.254.71.145/17"}}
- return ifat, nil
-}
-func (_ validNetworkInterface) Interfaces() ([]net.Interface, error) {
- return []net.Interface{upIntf}, nil
-}
-
-// Both IPv4 and IPv6 addresses (expecting IPv4 to be used)
-type v4v6NetworkInterface struct {
-}
-
-func (_ v4v6NetworkInterface) InterfaceByName(intfName string) (*net.Interface, error) {
- return &upIntf, nil
-}
-func (_ v4v6NetworkInterface) Addrs(intf *net.Interface) ([]net.Addr, error) {
- var ifat []net.Addr
- ifat = []net.Addr{
- addrStruct{val: "2001::10/64"}, addrStruct{val: "10.254.71.145/17"}}
- return ifat, nil
-}
-func (_ v4v6NetworkInterface) Interfaces() ([]net.Interface, error) {
- return []net.Interface{upIntf}, nil
-}
-
-// Interface with only IPv6 address
-type ipv6NetworkInterface struct {
-}
-
-func (_ ipv6NetworkInterface) InterfaceByName(intfName string) (*net.Interface, error) {
- return &upIntf, nil
-}
-func (_ ipv6NetworkInterface) Addrs(intf *net.Interface) ([]net.Addr, error) {
- var ifat []net.Addr
- ifat = []net.Addr{addrStruct{val: "2001::200/64"}}
- return ifat, nil
-}
-
-func (_ ipv6NetworkInterface) Interfaces() ([]net.Interface, error) {
- return []net.Interface{upIntf}, nil
-}
-
-// Only with link local addresses
-type networkInterfaceWithOnlyLinkLocals struct {
-}
-
-func (_ networkInterfaceWithOnlyLinkLocals) InterfaceByName(intfName string) (*net.Interface, error) {
- return &upIntf, nil
-}
-func (_ networkInterfaceWithOnlyLinkLocals) Addrs(intf *net.Interface) ([]net.Addr, error) {
- var ifat []net.Addr
- ifat = []net.Addr{addrStruct{val: "169.254.162.166/16"}, addrStruct{val: "fe80::200/10"}}
- return ifat, nil
-}
-func (_ networkInterfaceWithOnlyLinkLocals) Interfaces() ([]net.Interface, error) {
- return []net.Interface{upIntf}, nil
-}
-
-// Unable to get interface(s)
-type failGettingNetworkInterface struct {
-}
-
-func (_ failGettingNetworkInterface) InterfaceByName(intfName string) (*net.Interface, error) {
- return nil, fmt.Errorf("unable get Interface")
-}
-func (_ failGettingNetworkInterface) Addrs(intf *net.Interface) ([]net.Addr, error) {
- return nil, nil
-}
-func (_ failGettingNetworkInterface) Interfaces() ([]net.Interface, error) {
- return nil, fmt.Errorf("mock failed getting all interfaces")
-}
-
-// No interfaces
-type noNetworkInterface struct {
-}
-
-func (_ noNetworkInterface) InterfaceByName(intfName string) (*net.Interface, error) {
- return nil, fmt.Errorf("no such network interface")
-}
-func (_ noNetworkInterface) Addrs(intf *net.Interface) ([]net.Addr, error) {
- return nil, nil
-}
-func (_ noNetworkInterface) Interfaces() ([]net.Interface, error) {
- return []net.Interface{}, nil
-}
-
-// Interface is down
-type downNetworkInterface struct {
-}
-
-func (_ downNetworkInterface) InterfaceByName(intfName string) (*net.Interface, error) {
- return &downIntf, nil
-}
-func (_ downNetworkInterface) Addrs(intf *net.Interface) ([]net.Addr, error) {
- var ifat []net.Addr
- ifat = []net.Addr{
- addrStruct{val: "fe80::2f7:6fff:fe6e:2956/64"}, addrStruct{val: "10.254.71.145/17"}}
- return ifat, nil
-}
-func (_ downNetworkInterface) Interfaces() ([]net.Interface, error) {
- return []net.Interface{downIntf}, nil
-}
-
-// Loopback interface
-type loopbackNetworkInterface struct {
-}
-
-func (_ loopbackNetworkInterface) InterfaceByName(intfName string) (*net.Interface, error) {
- return &loopbackIntf, nil
-}
-func (_ loopbackNetworkInterface) Addrs(intf *net.Interface) ([]net.Addr, error) {
- var ifat []net.Addr
- ifat = []net.Addr{
- addrStruct{val: "::1/128"}, addrStruct{val: "127.0.0.1/8"}}
- return ifat, nil
-}
-func (_ loopbackNetworkInterface) Interfaces() ([]net.Interface, error) {
- return []net.Interface{loopbackIntf}, nil
-}
-
-// Point to point interface
-type p2pNetworkInterface struct {
-}
-
-func (_ p2pNetworkInterface) InterfaceByName(intfName string) (*net.Interface, error) {
- return &p2pIntf, nil
-}
-func (_ p2pNetworkInterface) Addrs(intf *net.Interface) ([]net.Addr, error) {
- var ifat []net.Addr
- ifat = []net.Addr{
- addrStruct{val: "::1/128"}, addrStruct{val: "127.0.0.1/8"}}
- return ifat, nil
-}
-func (_ p2pNetworkInterface) Interfaces() ([]net.Interface, error) {
- return []net.Interface{p2pIntf}, nil
-}
-
-// Unable to get IP addresses for interface
-type networkInterfaceFailGetAddrs struct {
-}
-
-func (_ networkInterfaceFailGetAddrs) InterfaceByName(intfName string) (*net.Interface, error) {
- return &upIntf, nil
-}
-func (_ networkInterfaceFailGetAddrs) Addrs(intf *net.Interface) ([]net.Addr, error) {
- return nil, fmt.Errorf("unable to get Addrs")
-}
-func (_ networkInterfaceFailGetAddrs) Interfaces() ([]net.Interface, error) {
- return []net.Interface{upIntf}, nil
-}
-
-// No addresses for interface
-type networkInterfaceWithNoAddrs struct {
-}
-
-func (_ networkInterfaceWithNoAddrs) InterfaceByName(intfName string) (*net.Interface, error) {
- return &upIntf, nil
-}
-func (_ networkInterfaceWithNoAddrs) Addrs(intf *net.Interface) ([]net.Addr, error) {
- ifat := []net.Addr{}
- return ifat, nil
-}
-func (_ networkInterfaceWithNoAddrs) Interfaces() ([]net.Interface, error) {
- return []net.Interface{upIntf}, nil
-}
-
-// Invalid addresses for interface
-type networkInterfaceWithInvalidAddr struct {
-}
-
-func (_ networkInterfaceWithInvalidAddr) InterfaceByName(intfName string) (*net.Interface, error) {
- return &upIntf, nil
-}
-func (_ networkInterfaceWithInvalidAddr) Addrs(intf *net.Interface) ([]net.Addr, error) {
- var ifat []net.Addr
- ifat = []net.Addr{addrStruct{val: "10.20.30.40.50/24"}}
- return ifat, nil
-}
-func (_ networkInterfaceWithInvalidAddr) Interfaces() ([]net.Interface, error) {
- return []net.Interface{upIntf}, nil
-}
-
-func TestGetIPFromInterface(t *testing.T) {
- testCases := []struct {
- tcase string
- nwname string
- family AddressFamily
- nw networkInterfacer
- expected net.IP
- errStrFrag string
- }{
- {"ipv4", "eth3", familyIPv4, validNetworkInterface{}, net.ParseIP("10.254.71.145"), ""},
- {"ipv6", "eth3", familyIPv6, ipv6NetworkInterface{}, net.ParseIP("2001::200"), ""},
- {"no ipv4", "eth3", familyIPv4, ipv6NetworkInterface{}, nil, ""},
- {"no ipv6", "eth3", familyIPv6, validNetworkInterface{}, nil, ""},
- {"I/F down", "eth3", familyIPv4, downNetworkInterface{}, nil, ""},
- {"I/F get fail", "eth3", familyIPv4, noNetworkInterface{}, nil, "no such network interface"},
- {"fail get addr", "eth3", familyIPv4, networkInterfaceFailGetAddrs{}, nil, "unable to get Addrs"},
- {"bad addr", "eth3", familyIPv4, networkInterfaceWithInvalidAddr{}, nil, "invalid CIDR"},
- }
- for _, tc := range testCases {
- ip, err := getIPFromInterface(tc.nwname, tc.family, tc.nw)
- if err != nil {
- if !strings.Contains(err.Error(), tc.errStrFrag) {
- t.Errorf("case[%s]: Error string %q does not contain %q", tc.tcase, err, tc.errStrFrag)
- }
- } else if tc.errStrFrag != "" {
- t.Errorf("case[%s]: Error %q expected, but not seen", tc.tcase, tc.errStrFrag)
- } else if !ip.Equal(tc.expected) {
- t.Errorf("case[%v]: expected %v, got %+v .err : %v", tc.tcase, tc.expected, ip, err)
- }
- }
-}
-
-func TestChooseHostInterfaceFromRoute(t *testing.T) {
- testCases := []struct {
- tcase string
- routes []Route
- nw networkInterfacer
- expected net.IP
- }{
- {"ipv4", routeV4, validNetworkInterface{}, net.ParseIP("10.254.71.145")},
- {"ipv6", routeV6, ipv6NetworkInterface{}, net.ParseIP("2001::200")},
- {"prefer ipv4", bothRoutes, v4v6NetworkInterface{}, net.ParseIP("10.254.71.145")},
- {"all LLA", routeV4, networkInterfaceWithOnlyLinkLocals{}, nil},
- {"no routes", noRoutes, validNetworkInterface{}, nil},
- {"fail get IP", routeV4, networkInterfaceFailGetAddrs{}, nil},
- }
- for _, tc := range testCases {
- ip, err := chooseHostInterfaceFromRoute(tc.routes, tc.nw)
- if !ip.Equal(tc.expected) {
- t.Errorf("case[%v]: expected %v, got %+v .err : %v", tc.tcase, tc.expected, ip, err)
- }
- }
-}
-
-func TestMemberOf(t *testing.T) {
- testCases := []struct {
- tcase string
- ip net.IP
- family AddressFamily
- expected bool
- }{
- {"ipv4 is 4", net.ParseIP("10.20.30.40"), familyIPv4, true},
- {"ipv4 is 6", net.ParseIP("10.10.10.10"), familyIPv6, false},
- {"ipv6 is 4", net.ParseIP("2001::100"), familyIPv4, false},
- {"ipv6 is 6", net.ParseIP("2001::100"), familyIPv6, true},
- }
- for _, tc := range testCases {
- if memberOf(tc.ip, tc.family) != tc.expected {
- t.Errorf("case[%s]: expected %+v", tc.tcase, tc.expected)
- }
- }
-}
-
-func TestGetIPFromHostInterfaces(t *testing.T) {
- testCases := []struct {
- tcase string
- nw networkInterfacer
- expected net.IP
- errStrFrag string
- }{
- {"fail get I/Fs", failGettingNetworkInterface{}, nil, "failed getting all interfaces"},
- {"no interfaces", noNetworkInterface{}, nil, "no interfaces"},
- {"I/F not up", downNetworkInterface{}, nil, "no acceptable"},
- {"loopback only", loopbackNetworkInterface{}, nil, "no acceptable"},
- {"P2P I/F only", p2pNetworkInterface{}, nil, "no acceptable"},
- {"fail get addrs", networkInterfaceFailGetAddrs{}, nil, "unable to get Addrs"},
- {"no addresses", networkInterfaceWithNoAddrs{}, nil, "no acceptable"},
- {"invalid addr", networkInterfaceWithInvalidAddr{}, nil, "invalid CIDR"},
- {"no matches", networkInterfaceWithOnlyLinkLocals{}, nil, "no acceptable"},
- {"ipv4", validNetworkInterface{}, net.ParseIP("10.254.71.145"), ""},
- {"ipv6", ipv6NetworkInterface{}, net.ParseIP("2001::200"), ""},
- }
-
- for _, tc := range testCases {
- ip, err := chooseIPFromHostInterfaces(tc.nw)
- if !ip.Equal(tc.expected) {
- t.Errorf("case[%s]: expected %+v, got %+v with err : %v", tc.tcase, tc.expected, ip, err)
- }
- if err != nil && !strings.Contains(err.Error(), tc.errStrFrag) {
- t.Errorf("case[%s]: unable to find %q in error string %q", tc.tcase, tc.errStrFrag, err.Error())
- }
- }
-}
-
-func makeRouteFile(content string, t *testing.T) (*os.File, error) {
- routeFile, err := ioutil.TempFile("", "route")
- if err != nil {
- return nil, err
- }
-
- if _, err := routeFile.Write([]byte(content)); err != nil {
- return routeFile, err
- }
- err = routeFile.Close()
- return routeFile, err
-}
-
-func TestFailGettingIPv4Routes(t *testing.T) {
- defer func() { v4File.name = ipv4RouteFile }()
-
- // Try failure to open file (should not occur, as caller ensures we have IPv4 route file, but being thorough)
- v4File.name = "no-such-file"
- errStrFrag := "no such file"
- _, err := v4File.extract()
- if err == nil {
- t.Errorf("Expected error trying to read non-existent v4 route file")
- }
- if !strings.Contains(err.Error(), errStrFrag) {
- t.Errorf("Unable to find %q in error string %q", errStrFrag, err.Error())
- }
-}
-
-func TestFailGettingIPv6Routes(t *testing.T) {
- defer func() { v6File.name = ipv6RouteFile }()
-
- // Try failure to open file (this would be ignored by caller)
- v6File.name = "no-such-file"
- errStrFrag := "no such file"
- _, err := v6File.extract()
- if err == nil {
- t.Errorf("Expected error trying to read non-existent v6 route file")
- }
- if !strings.Contains(err.Error(), errStrFrag) {
- t.Errorf("Unable to find %q in error string %q", errStrFrag, err.Error())
- }
-}
-
-func TestGetAllDefaultRoutesFailNoV4RouteFile(t *testing.T) {
- defer func() { v4File.name = ipv4RouteFile }()
-
- // Should not occur, as caller ensures we have IPv4 route file, but being thorough
- v4File.name = "no-such-file"
- errStrFrag := "no such file"
- _, err := getAllDefaultRoutes()
- if err == nil {
- t.Errorf("Expected error trying to read non-existent v4 route file")
- }
- if !strings.Contains(err.Error(), errStrFrag) {
- t.Errorf("Unable to find %q in error string %q", errStrFrag, err.Error())
- }
-}
-
-func TestGetAllDefaultRoutes(t *testing.T) {
- testCases := []struct {
- tcase string
- v4Info string
- v6Info string
- count int
- expected []Route
- errStrFrag string
- }{
- {"no routes", noInternetConnection, v6noDefaultRoutes, 0, nil, "No default routes"},
- {"only v4 route", gatewayfirst, v6noDefaultRoutes, 1, routeV4, ""},
- {"only v6 route", noInternetConnection, v6gatewayfirst, 1, routeV6, ""},
- {"v4 and v6 routes", gatewayfirst, v6gatewayfirst, 2, bothRoutes, ""},
- }
- defer func() {
- v4File.name = ipv4RouteFile
- v6File.name = ipv6RouteFile
- }()
-
- for _, tc := range testCases {
- routeFile, err := makeRouteFile(tc.v4Info, t)
- if routeFile != nil {
- defer os.Remove(routeFile.Name())
- }
- if err != nil {
- t.Errorf("case[%s]: test setup failure for IPv4 route file: %v", tc.tcase, err)
- }
- v4File.name = routeFile.Name()
- v6routeFile, err := makeRouteFile(tc.v6Info, t)
- if v6routeFile != nil {
- defer os.Remove(v6routeFile.Name())
- }
- if err != nil {
- t.Errorf("case[%s]: test setup failure for IPv6 route file: %v", tc.tcase, err)
- }
- v6File.name = v6routeFile.Name()
-
- routes, err := getAllDefaultRoutes()
- if err != nil {
- if !strings.Contains(err.Error(), tc.errStrFrag) {
- t.Errorf("case[%s]: Error string %q does not contain %q", tc.tcase, err, tc.errStrFrag)
- }
- } else if tc.errStrFrag != "" {
- t.Errorf("case[%s]: Error %q expected, but not seen", tc.tcase, tc.errStrFrag)
- } else {
- if tc.count != len(routes) {
- t.Errorf("case[%s]: expected %d routes, have %v", tc.tcase, tc.count, routes)
- }
- for i, expected := range tc.expected {
- if !expected.Gateway.Equal(routes[i].Gateway) {
- t.Errorf("case[%s]: at %d expected %v, got %v .err : %v", tc.tcase, i, tc.expected, routes, err)
- }
- zeroIP := net.IPv4zero
- if expected.Family == familyIPv6 {
- zeroIP = net.IPv6zero
- }
- if !routes[i].Destination.Equal(zeroIP) {
- t.Errorf("case[%s}: at %d destination is not for default route (not %v)", tc.tcase, i, zeroIP)
- }
- }
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/net/port_range_test.go b/vendor/k8s.io/apimachinery/pkg/util/net/port_range_test.go
deleted file mode 100644
index b4cbe8245..000000000
--- a/vendor/k8s.io/apimachinery/pkg/util/net/port_range_test.go
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
-Copyright 2015 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package net
-
-import (
- "testing"
-
- flag "github.com/spf13/pflag"
-)
-
-func TestPortRange(t *testing.T) {
- testCases := []struct {
- input string
- success bool
- expected string
- included int
- excluded int
- }{
- {"100-200", true, "100-200", 200, 201},
- {" 100-200 ", true, "100-200", 200, 201},
- {"0-0", true, "0-0", 0, 1},
- {"", true, "", -1, 0},
- {"100", true, "100-100", 100, 101},
- {"100 - 200", false, "", -1, -1},
- {"-100", false, "", -1, -1},
- {"100-", false, "", -1, -1},
- {"200-100", false, "", -1, -1},
- {"60000-70000", false, "", -1, -1},
- {"70000-80000", false, "", -1, -1},
- {"70000+80000", false, "", -1, -1},
- {"1+0", true, "1-1", 1, 2},
- {"0+0", true, "0-0", 0, 1},
- {"1+-1", false, "", -1, -1},
- {"1-+1", false, "", -1, -1},
- {"100+200", true, "100-300", 300, 301},
- {"1+65535", false, "", -1, -1},
- {"0+65535", true, "0-65535", 65535, 65536},
- }
-
- for i := range testCases {
- tc := &testCases[i]
- pr := &PortRange{}
- var f flag.Value = pr
- err := f.Set(tc.input)
- if err != nil && tc.success == true {
- t.Errorf("expected success, got %q", err)
- continue
- } else if err == nil && tc.success == false {
- t.Errorf("expected failure %#v", testCases[i])
- continue
- } else if tc.success {
- if f.String() != tc.expected {
- t.Errorf("expected %q, got %q", tc.expected, f.String())
- }
- if tc.included >= 0 && !pr.Contains(tc.included) {
- t.Errorf("expected %q to include %d", f.String(), tc.included)
- }
- if tc.excluded >= 0 && pr.Contains(tc.excluded) {
- t.Errorf("expected %q to exclude %d", f.String(), tc.excluded)
- }
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/net/port_split_test.go b/vendor/k8s.io/apimachinery/pkg/util/net/port_split_test.go
deleted file mode 100644
index e801bdbea..000000000
--- a/vendor/k8s.io/apimachinery/pkg/util/net/port_split_test.go
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
-Copyright 2015 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package net
-
-import (
- "testing"
-)
-
-func TestSplitSchemeNamePort(t *testing.T) {
- table := []struct {
- in string
- name, port, scheme string
- valid bool
- normalized bool
- }{
- {
- in: "aoeu:asdf",
- name: "aoeu",
- port: "asdf",
- valid: true,
- normalized: true,
- }, {
- in: "http:aoeu:asdf",
- scheme: "http",
- name: "aoeu",
- port: "asdf",
- valid: true,
- normalized: true,
- }, {
- in: "https:aoeu:",
- scheme: "https",
- name: "aoeu",
- port: "",
- valid: true,
- normalized: false,
- }, {
- in: "https:aoeu:asdf",
- scheme: "https",
- name: "aoeu",
- port: "asdf",
- valid: true,
- normalized: true,
- }, {
- in: "aoeu:",
- name: "aoeu",
- valid: true,
- normalized: false,
- }, {
- in: "aoeu",
- name: "aoeu",
- valid: true,
- normalized: true,
- }, {
- in: ":asdf",
- valid: false,
- }, {
- in: "aoeu:asdf:htns",
- valid: false,
- }, {
- in: "http::asdf",
- valid: false,
- }, {
- in: "http::",
- valid: false,
- }, {
- in: "",
- valid: false,
- },
- }
-
- for _, item := range table {
- scheme, name, port, valid := SplitSchemeNamePort(item.in)
- if e, a := item.scheme, scheme; e != a {
- t.Errorf("%q: Wanted %q, got %q", item.in, e, a)
- }
- if e, a := item.name, name; e != a {
- t.Errorf("%q: Wanted %q, got %q", item.in, e, a)
- }
- if e, a := item.port, port; e != a {
- t.Errorf("%q: Wanted %q, got %q", item.in, e, a)
- }
- if e, a := item.valid, valid; e != a {
- t.Errorf("%q: Wanted %t, got %t", item.in, e, a)
- }
-
- // Make sure valid items round trip through JoinSchemeNamePort
- if item.valid {
- out := JoinSchemeNamePort(scheme, name, port)
- if item.normalized && out != item.in {
- t.Errorf("%q: Wanted %s, got %s", item.in, item.in, out)
- }
- scheme, name, port, valid := SplitSchemeNamePort(out)
- if e, a := item.scheme, scheme; e != a {
- t.Errorf("%q: Wanted %q, got %q", item.in, e, a)
- }
- if e, a := item.name, name; e != a {
- t.Errorf("%q: Wanted %q, got %q", item.in, e, a)
- }
- if e, a := item.port, port; e != a {
- t.Errorf("%q: Wanted %q, got %q", item.in, e, a)
- }
- if e, a := item.valid, valid; e != a {
- t.Errorf("%q: Wanted %t, got %t", item.in, e, a)
- }
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/net/util_test.go b/vendor/k8s.io/apimachinery/pkg/util/net/util_test.go
deleted file mode 100644
index bcbef753b..000000000
--- a/vendor/k8s.io/apimachinery/pkg/util/net/util_test.go
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package net
-
-import (
- "net"
- "testing"
-)
-
-func getIPNet(cidr string) *net.IPNet {
- _, ipnet, _ := net.ParseCIDR(cidr)
- return ipnet
-}
-
-func TestIPNetEqual(t *testing.T) {
- testCases := []struct {
- ipnet1 *net.IPNet
- ipnet2 *net.IPNet
- expect bool
- }{
- //null case
- {
- getIPNet("10.0.0.1/24"),
- getIPNet(""),
- false,
- },
- {
- getIPNet("10.0.0.0/24"),
- getIPNet("10.0.0.0/24"),
- true,
- },
- {
- getIPNet("10.0.0.0/24"),
- getIPNet("10.0.0.1/24"),
- true,
- },
- {
- getIPNet("10.0.0.0/25"),
- getIPNet("10.0.0.0/24"),
- false,
- },
- {
- getIPNet("10.0.1.0/24"),
- getIPNet("10.0.0.0/24"),
- false,
- },
- }
-
- for _, tc := range testCases {
- if tc.expect != IPNetEqual(tc.ipnet1, tc.ipnet2) {
- t.Errorf("Expect equality of %s and %s be to %v", tc.ipnet1.String(), tc.ipnet2.String(), tc.expect)
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime_test.go b/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime_test.go
deleted file mode 100644
index 9dff17ea5..000000000
--- a/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime_test.go
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package runtime
-
-import (
- "fmt"
- "testing"
-)
-
-func TestHandleCrash(t *testing.T) {
- defer func() {
- if x := recover(); x == nil {
- t.Errorf("Expected a panic to recover from")
- }
- }()
- defer HandleCrash()
- panic("Test Panic")
-}
-
-func TestCustomHandleCrash(t *testing.T) {
- old := PanicHandlers
- defer func() { PanicHandlers = old }()
- var result interface{}
- PanicHandlers = []func(interface{}){
- func(r interface{}) {
- result = r
- },
- }
- func() {
- defer func() {
- if x := recover(); x == nil {
- t.Errorf("Expected a panic to recover from")
- }
- }()
- defer HandleCrash()
- panic("test")
- }()
- if result != "test" {
- t.Errorf("did not receive custom handler")
- }
-}
-
-func TestCustomHandleError(t *testing.T) {
- old := ErrorHandlers
- defer func() { ErrorHandlers = old }()
- var result error
- ErrorHandlers = []func(error){
- func(err error) {
- result = err
- },
- }
- err := fmt.Errorf("test")
- HandleError(err)
- if result != err {
- t.Errorf("did not receive custom handler")
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/sets/set_test.go b/vendor/k8s.io/apimachinery/pkg/util/sets/set_test.go
deleted file mode 100644
index df722ec27..000000000
--- a/vendor/k8s.io/apimachinery/pkg/util/sets/set_test.go
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package sets
-
-import (
- "reflect"
- "testing"
-)
-
-func TestStringSet(t *testing.T) {
- s := String{}
- s2 := String{}
- if len(s) != 0 {
- t.Errorf("Expected len=0: %d", len(s))
- }
- s.Insert("a", "b")
- if len(s) != 2 {
- t.Errorf("Expected len=2: %d", len(s))
- }
- s.Insert("c")
- if s.Has("d") {
- t.Errorf("Unexpected contents: %#v", s)
- }
- if !s.Has("a") {
- t.Errorf("Missing contents: %#v", s)
- }
- s.Delete("a")
- if s.Has("a") {
- t.Errorf("Unexpected contents: %#v", s)
- }
- s.Insert("a")
- if s.HasAll("a", "b", "d") {
- t.Errorf("Unexpected contents: %#v", s)
- }
- if !s.HasAll("a", "b") {
- t.Errorf("Missing contents: %#v", s)
- }
- s2.Insert("a", "b", "d")
- if s.IsSuperset(s2) {
- t.Errorf("Unexpected contents: %#v", s)
- }
- s2.Delete("d")
- if !s.IsSuperset(s2) {
- t.Errorf("Missing contents: %#v", s)
- }
-}
-
-func TestStringSetDeleteMultiples(t *testing.T) {
- s := String{}
- s.Insert("a", "b", "c")
- if len(s) != 3 {
- t.Errorf("Expected len=3: %d", len(s))
- }
-
- s.Delete("a", "c")
- if len(s) != 1 {
- t.Errorf("Expected len=1: %d", len(s))
- }
- if s.Has("a") {
- t.Errorf("Unexpected contents: %#v", s)
- }
- if s.Has("c") {
- t.Errorf("Unexpected contents: %#v", s)
- }
- if !s.Has("b") {
- t.Errorf("Missing contents: %#v", s)
- }
-
-}
-
-func TestNewStringSet(t *testing.T) {
- s := NewString("a", "b", "c")
- if len(s) != 3 {
- t.Errorf("Expected len=3: %d", len(s))
- }
- if !s.Has("a") || !s.Has("b") || !s.Has("c") {
- t.Errorf("Unexpected contents: %#v", s)
- }
-}
-
-func TestStringSetList(t *testing.T) {
- s := NewString("z", "y", "x", "a")
- if !reflect.DeepEqual(s.List(), []string{"a", "x", "y", "z"}) {
- t.Errorf("List gave unexpected result: %#v", s.List())
- }
-}
-
-func TestStringSetDifference(t *testing.T) {
- a := NewString("1", "2", "3")
- b := NewString("1", "2", "4", "5")
- c := a.Difference(b)
- d := b.Difference(a)
- if len(c) != 1 {
- t.Errorf("Expected len=1: %d", len(c))
- }
- if !c.Has("3") {
- t.Errorf("Unexpected contents: %#v", c.List())
- }
- if len(d) != 2 {
- t.Errorf("Expected len=2: %d", len(d))
- }
- if !d.Has("4") || !d.Has("5") {
- t.Errorf("Unexpected contents: %#v", d.List())
- }
-}
-
-func TestStringSetHasAny(t *testing.T) {
- a := NewString("1", "2", "3")
-
- if !a.HasAny("1", "4") {
- t.Errorf("expected true, got false")
- }
-
- if a.HasAny("0", "4") {
- t.Errorf("expected false, got true")
- }
-}
-
-func TestStringSetEquals(t *testing.T) {
- // Simple case (order doesn't matter)
- a := NewString("1", "2")
- b := NewString("2", "1")
- if !a.Equal(b) {
- t.Errorf("Expected to be equal: %v vs %v", a, b)
- }
-
- // It is a set; duplicates are ignored
- b = NewString("2", "2", "1")
- if !a.Equal(b) {
- t.Errorf("Expected to be equal: %v vs %v", a, b)
- }
-
- // Edge cases around empty sets / empty strings
- a = NewString()
- b = NewString()
- if !a.Equal(b) {
- t.Errorf("Expected to be equal: %v vs %v", a, b)
- }
-
- b = NewString("1", "2", "3")
- if a.Equal(b) {
- t.Errorf("Expected to be not-equal: %v vs %v", a, b)
- }
-
- b = NewString("1", "2", "")
- if a.Equal(b) {
- t.Errorf("Expected to be not-equal: %v vs %v", a, b)
- }
-
- // Check for equality after mutation
- a = NewString()
- a.Insert("1")
- if a.Equal(b) {
- t.Errorf("Expected to be not-equal: %v vs %v", a, b)
- }
-
- a.Insert("2")
- if a.Equal(b) {
- t.Errorf("Expected to be not-equal: %v vs %v", a, b)
- }
-
- a.Insert("")
- if !a.Equal(b) {
- t.Errorf("Expected to be equal: %v vs %v", a, b)
- }
-
- a.Delete("")
- if a.Equal(b) {
- t.Errorf("Expected to be not-equal: %v vs %v", a, b)
- }
-}
-
-func TestStringUnion(t *testing.T) {
- tests := []struct {
- s1 String
- s2 String
- expected String
- }{
- {
- NewString("1", "2", "3", "4"),
- NewString("3", "4", "5", "6"),
- NewString("1", "2", "3", "4", "5", "6"),
- },
- {
- NewString("1", "2", "3", "4"),
- NewString(),
- NewString("1", "2", "3", "4"),
- },
- {
- NewString(),
- NewString("1", "2", "3", "4"),
- NewString("1", "2", "3", "4"),
- },
- {
- NewString(),
- NewString(),
- NewString(),
- },
- }
-
- for _, test := range tests {
- union := test.s1.Union(test.s2)
- if union.Len() != test.expected.Len() {
- t.Errorf("Expected union.Len()=%d but got %d", test.expected.Len(), union.Len())
- }
-
- if !union.Equal(test.expected) {
- t.Errorf("Expected union.Equal(expected) but not true. union:%v expected:%v", union.List(), test.expected.List())
- }
- }
-}
-
-func TestStringIntersection(t *testing.T) {
- tests := []struct {
- s1 String
- s2 String
- expected String
- }{
- {
- NewString("1", "2", "3", "4"),
- NewString("3", "4", "5", "6"),
- NewString("3", "4"),
- },
- {
- NewString("1", "2", "3", "4"),
- NewString("1", "2", "3", "4"),
- NewString("1", "2", "3", "4"),
- },
- {
- NewString("1", "2", "3", "4"),
- NewString(),
- NewString(),
- },
- {
- NewString(),
- NewString("1", "2", "3", "4"),
- NewString(),
- },
- {
- NewString(),
- NewString(),
- NewString(),
- },
- }
-
- for _, test := range tests {
- intersection := test.s1.Intersection(test.s2)
- if intersection.Len() != test.expected.Len() {
- t.Errorf("Expected intersection.Len()=%d but got %d", test.expected.Len(), intersection.Len())
- }
-
- if !intersection.Equal(test.expected) {
- t.Errorf("Expected intersection.Equal(expected) but not true. intersection:%v expected:%v", intersection.List(), test.expected.List())
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch_test.go b/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch_test.go
deleted file mode 100644
index 4721803cc..000000000
--- a/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch_test.go
+++ /dev/null
@@ -1,6763 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package strategicpatch
-
-import (
- "fmt"
- "path/filepath"
- "reflect"
- "strings"
- "testing"
-
- "github.com/davecgh/go-spew/spew"
- "github.com/ghodss/yaml"
-
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/util/json"
- "k8s.io/apimachinery/pkg/util/mergepatch"
- "k8s.io/apimachinery/pkg/util/sets"
- sptest "k8s.io/apimachinery/pkg/util/strategicpatch/testing"
-)
-
-var (
- fakeMergeItemSchema = sptest.Fake{Path: filepath.Join("testdata", "swagger-merge-item.json")}
- fakePrecisionItemSchema = sptest.Fake{Path: filepath.Join("testdata", "swagger-precision-item.json")}
-)
-
-type SortMergeListTestCases struct {
- TestCases []SortMergeListTestCase
-}
-
-type SortMergeListTestCase struct {
- Description string
- Original map[string]interface{}
- Sorted map[string]interface{}
-}
-
-type StrategicMergePatchTestCases struct {
- TestCases []StrategicMergePatchTestCase
-}
-
-type StrategicMergePatchTestCase struct {
- Description string
- StrategicMergePatchTestCaseData
-}
-
-type StrategicMergePatchRawTestCase struct {
- Description string
- StrategicMergePatchRawTestCaseData
-}
-
-type StrategicMergePatchTestCaseData struct {
- // Original is the original object (last-applied config in annotation)
- Original map[string]interface{}
- // Modified is the modified object (new config we want)
- Modified map[string]interface{}
- // Current is the current object (live config in the server)
- Current map[string]interface{}
- // TwoWay is the expected two-way merge patch diff between original and modified
- TwoWay map[string]interface{}
- // ThreeWay is the expected three-way merge patch
- ThreeWay map[string]interface{}
- // Result is the expected object after applying the three-way patch on current object.
- Result map[string]interface{}
- // TwoWayResult is the expected object after applying the two-way patch on current object.
- // If nil, Modified is used.
- TwoWayResult map[string]interface{}
-}
-
-// The meaning of each field is the same as StrategicMergePatchTestCaseData's.
-// The difference is that all the fields in StrategicMergePatchRawTestCaseData are json-encoded data.
-type StrategicMergePatchRawTestCaseData struct {
- Original []byte
- Modified []byte
- Current []byte
- TwoWay []byte
- ThreeWay []byte
- Result []byte
- TwoWayResult []byte
- ExpectedError string
-}
-
-type MergeItem struct {
- Name string `json:"name,omitempty"`
- Value string `json:"value,omitempty"`
- Other string `json:"other,omitempty"`
- MergingList []MergeItem `json:"mergingList,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
- NonMergingList []MergeItem `json:"nonMergingList,omitempty"`
- MergingIntList []int `json:"mergingIntList,omitempty" patchStrategy:"merge"`
- NonMergingIntList []int `json:"nonMergingIntList,omitempty"`
- MergeItemPtr *MergeItem `json:"mergeItemPtr,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
- SimpleMap map[string]string `json:"simpleMap,omitempty"`
- ReplacingItem runtime.RawExtension `json:"replacingItem,omitempty" patchStrategy:"replace"`
- RetainKeysMap RetainKeysMergeItem `json:"retainKeysMap,omitempty" patchStrategy:"retainKeys"`
- RetainKeysMergingList []MergeItem `json:"retainKeysMergingList,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name"`
-}
-
-type RetainKeysMergeItem struct {
- Name string `json:"name,omitempty"`
- Value string `json:"value,omitempty"`
- Other string `json:"other,omitempty"`
- SimpleMap map[string]string `json:"simpleMap,omitempty"`
- MergingIntList []int `json:"mergingIntList,omitempty" patchStrategy:"merge"`
- MergingList []MergeItem `json:"mergingList,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
- NonMergingList []MergeItem `json:"nonMergingList,omitempty"`
-}
-
-var (
- mergeItem MergeItem
- mergeItemStructSchema = PatchMetaFromStruct{T: GetTagStructTypeOrDie(mergeItem)}
-)
-
-// These are test cases for SortMergeList, used to assert that it (recursively)
-// sorts both merging and non merging lists correctly.
-var sortMergeListTestCaseData = []byte(`
-testCases:
- - description: sort one list of maps
- original:
- mergingList:
- - name: 1
- - name: 3
- - name: 2
- sorted:
- mergingList:
- - name: 1
- - name: 2
- - name: 3
- - description: sort lists of maps but not nested lists of maps
- original:
- mergingList:
- - name: 2
- nonMergingList:
- - name: 1
- - name: 3
- - name: 2
- - name: 1
- nonMergingList:
- - name: 2
- - name: 1
- sorted:
- mergingList:
- - name: 1
- nonMergingList:
- - name: 2
- - name: 1
- - name: 2
- nonMergingList:
- - name: 1
- - name: 3
- - name: 2
- - description: sort lists of maps and nested lists of maps
- original:
- mergingList:
- - name: 2
- mergingList:
- - name: 1
- - name: 3
- - name: 2
- - name: 1
- mergingList:
- - name: 2
- - name: 1
- sorted:
- mergingList:
- - name: 1
- mergingList:
- - name: 1
- - name: 2
- - name: 2
- mergingList:
- - name: 1
- - name: 2
- - name: 3
- - description: merging list should NOT sort when nested in non merging list
- original:
- nonMergingList:
- - name: 2
- mergingList:
- - name: 1
- - name: 3
- - name: 2
- - name: 1
- mergingList:
- - name: 2
- - name: 1
- sorted:
- nonMergingList:
- - name: 2
- mergingList:
- - name: 1
- - name: 3
- - name: 2
- - name: 1
- mergingList:
- - name: 2
- - name: 1
- - description: sort very nested list of maps
- fieldTypes:
- original:
- mergingList:
- - mergingList:
- - mergingList:
- - name: 2
- - name: 1
- sorted:
- mergingList:
- - mergingList:
- - mergingList:
- - name: 1
- - name: 2
- - description: sort nested lists of ints
- original:
- mergingList:
- - name: 2
- mergingIntList:
- - 1
- - 3
- - 2
- - name: 1
- mergingIntList:
- - 2
- - 1
- sorted:
- mergingList:
- - name: 1
- mergingIntList:
- - 1
- - 2
- - name: 2
- mergingIntList:
- - 1
- - 2
- - 3
- - description: sort nested pointers of ints
- original:
- mergeItemPtr:
- - name: 2
- mergingIntList:
- - 1
- - 3
- - 2
- - name: 1
- mergingIntList:
- - 2
- - 1
- sorted:
- mergeItemPtr:
- - name: 1
- mergingIntList:
- - 1
- - 2
- - name: 2
- mergingIntList:
- - 1
- - 2
- - 3
- - description: sort merging list by pointer
- original:
- mergeItemPtr:
- - name: 1
- - name: 3
- - name: 2
- sorted:
- mergeItemPtr:
- - name: 1
- - name: 2
- - name: 3
-`)
-
-func TestSortMergeLists(t *testing.T) {
- mergeItemOpenapiSchema := PatchMetaFromOpenAPI{
- Schema: sptest.GetSchemaOrDie(fakeMergeItemSchema, "mergeItem"),
- }
- schemas := []LookupPatchMeta{
- mergeItemStructSchema,
- mergeItemOpenapiSchema,
- }
-
- tc := SortMergeListTestCases{}
- err := yaml.Unmarshal(sortMergeListTestCaseData, &tc)
- if err != nil {
- t.Errorf("can't unmarshal test cases: %s\n", err)
- return
- }
-
- for _, schema := range schemas {
- for _, c := range tc.TestCases {
- temp := testObjectToJSONOrFail(t, c.Original)
- got := sortJsonOrFail(t, temp, c.Description, schema)
- expected := testObjectToJSONOrFail(t, c.Sorted)
- if !reflect.DeepEqual(got, expected) {
- t.Errorf("using %s error in test case: %s\ncannot sort object:\n%s\nexpected:\n%s\ngot:\n%s\n",
- getSchemaType(schema), c.Description, mergepatch.ToYAMLOrError(c.Original), mergepatch.ToYAMLOrError(c.Sorted), jsonToYAMLOrError(got))
- }
- }
- }
-}
-
-// These are test cases for StrategicMergePatch that cannot be generated using
-// CreateTwoWayMergePatch because it may be one of the following cases:
-// - not use the replace directive.
-// - generate duplicate integers for a merging list patch.
-// - generate empty merging lists.
-// - use patch format from an old client.
-var customStrategicMergePatchTestCaseData = []byte(`
-testCases:
- - description: unique scalars when merging lists
- original:
- mergingIntList:
- - 1
- - 2
- twoWay:
- mergingIntList:
- - 2
- - 3
- modified:
- mergingIntList:
- - 1
- - 2
- - 3
- - description: delete map from nested map
- original:
- simpleMap:
- key1: 1
- key2: 1
- twoWay:
- simpleMap:
- $patch: delete
- modified:
- simpleMap:
- {}
- - description: delete all items from merging list
- original:
- mergingList:
- - name: 1
- - name: 2
- twoWay:
- mergingList:
- - $patch: replace
- modified:
- mergingList: []
- - description: merge empty merging lists
- original:
- mergingList: []
- twoWay:
- mergingList: []
- modified:
- mergingList: []
- - description: delete all keys from map
- original:
- name: 1
- value: 1
- twoWay:
- $patch: replace
- modified: {}
- - description: add key and delete all keys from map
- original:
- name: 1
- value: 1
- twoWay:
- other: a
- $patch: replace
- modified:
- other: a
- - description: delete all duplicate entries in a merging list
- original:
- mergingList:
- - name: 1
- - name: 1
- - name: 2
- value: a
- - name: 3
- - name: 3
- twoWay:
- mergingList:
- - name: 1
- $patch: delete
- - name: 3
- $patch: delete
- modified:
- mergingList:
- - name: 2
- value: a
- - description: retainKeys map can add a field when no retainKeys directive present
- original:
- retainKeysMap:
- name: foo
- twoWay:
- retainKeysMap:
- value: bar
- modified:
- retainKeysMap:
- name: foo
- value: bar
- - description: retainKeys map can change a field when no retainKeys directive present
- original:
- retainKeysMap:
- name: foo
- value: a
- twoWay:
- retainKeysMap:
- value: b
- modified:
- retainKeysMap:
- name: foo
- value: b
- - description: retainKeys map can delete a field when no retainKeys directive present
- original:
- retainKeysMap:
- name: foo
- value: a
- twoWay:
- retainKeysMap:
- value: null
- modified:
- retainKeysMap:
- name: foo
- - description: retainKeys map merge an empty map
- original:
- retainKeysMap:
- name: foo
- value: a
- twoWay:
- retainKeysMap: {}
- modified:
- retainKeysMap:
- name: foo
- value: a
- - description: retainKeys list can add a field when no retainKeys directive present
- original:
- retainKeysMergingList:
- - name: bar
- - name: foo
- twoWay:
- retainKeysMergingList:
- - name: foo
- value: a
- modified:
- retainKeysMergingList:
- - name: bar
- - name: foo
- value: a
- - description: retainKeys list can change a field when no retainKeys directive present
- original:
- retainKeysMergingList:
- - name: bar
- - name: foo
- value: a
- twoWay:
- retainKeysMergingList:
- - name: foo
- value: b
- modified:
- retainKeysMergingList:
- - name: bar
- - name: foo
- value: b
- - description: retainKeys list can delete a field when no retainKeys directive present
- original:
- retainKeysMergingList:
- - name: bar
- - name: foo
- value: a
- twoWay:
- retainKeysMergingList:
- - name: foo
- value: null
- modified:
- retainKeysMergingList:
- - name: bar
- - name: foo
- - description: preserve the order from the patch in a merging list
- original:
- mergingList:
- - name: 1
- - name: 2
- value: b
- - name: 3
- twoWay:
- mergingList:
- - name: 3
- value: c
- - name: 1
- value: a
- - name: 2
- other: x
- modified:
- mergingList:
- - name: 3
- value: c
- - name: 1
- value: a
- - name: 2
- value: b
- other: x
- - description: preserve the order from the patch in a merging list 2
- original:
- mergingList:
- - name: 1
- - name: 2
- value: b
- - name: 3
- twoWay:
- mergingList:
- - name: 3
- value: c
- - name: 1
- value: a
- modified:
- mergingList:
- - name: 2
- value: b
- - name: 3
- value: c
- - name: 1
- value: a
- - description: preserve the order from the patch in a merging int list
- original:
- mergingIntList:
- - 1
- - 2
- - 3
- twoWay:
- mergingIntList:
- - 3
- - 1
- - 2
- modified:
- mergingIntList:
- - 3
- - 1
- - 2
- - description: preserve the order from the patch in a merging int list
- original:
- mergingIntList:
- - 1
- - 2
- - 3
- twoWay:
- mergingIntList:
- - 3
- - 1
- modified:
- mergingIntList:
- - 2
- - 3
- - 1
-`)
-
-var customStrategicMergePatchRawTestCases = []StrategicMergePatchRawTestCase{
- {
- Description: "$setElementOrder contains item that is not present in the list to be merged",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- - name: 3
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 3
- - name: 2
- - name: 1
-mergingList:
- - name: 3
- value: 3
- - name: 1
- value: 1
-`),
- Modified: []byte(`
-mergingList:
- - name: 3
- value: 3
- - name: 1
- value: 1
-`),
- },
- },
- {
- Description: "$setElementOrder contains item that is not present in the int list to be merged",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingIntList:
- - 1
- - 3
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingIntList:
- - 3
- - 2
- - 1
-`),
- Modified: []byte(`
-mergingIntList:
- - 3
- - 1
-`),
- },
- },
- {
- Description: "should check if order in $setElementOrder and patch list match",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- - name: 3
- - name: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
- - name: 3
-mergingList:
- - name: 3
- value: 3
- - name: 1
- value: 1
-`),
- ExpectedError: "doesn't match",
- },
- },
- {
- Description: "$setElementOrder contains item that is not present in the int list to be merged",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingIntList:
- - 1
- - 3
- - 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingIntList:
- - 1
- - 2
- - 3
-mergingIntList:
- - 3
- - 1
-`),
- ExpectedError: "doesn't match",
- },
- },
- {
- Description: "missing merge key should error out",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- value: a
-`),
- TwoWay: []byte(`
-mergingList:
- - value: b
-`),
- ExpectedError: "does not contain declared merge key",
- },
- },
-}
-
-func TestCustomStrategicMergePatch(t *testing.T) {
- mergeItemOpenapiSchema := PatchMetaFromOpenAPI{
- Schema: sptest.GetSchemaOrDie(fakeMergeItemSchema, "mergeItem"),
- }
- schemas := []LookupPatchMeta{
- mergeItemStructSchema,
- mergeItemOpenapiSchema,
- }
-
- tc := StrategicMergePatchTestCases{}
- err := yaml.Unmarshal(customStrategicMergePatchTestCaseData, &tc)
- if err != nil {
- t.Errorf("can't unmarshal test cases: %v\n", err)
- return
- }
-
- for _, schema := range schemas {
- for _, c := range tc.TestCases {
- original, expectedTwoWayPatch, _, expectedResult := twoWayTestCaseToJSONOrFail(t, c, schema)
- testPatchApplication(t, original, expectedTwoWayPatch, expectedResult, c.Description, "", schema)
- }
-
- for _, c := range customStrategicMergePatchRawTestCases {
- original, expectedTwoWayPatch, _, expectedResult := twoWayRawTestCaseToJSONOrFail(t, c)
- testPatchApplication(t, original, expectedTwoWayPatch, expectedResult, c.Description, c.ExpectedError, schema)
- }
- }
-}
-
-// These are test cases for StrategicMergePatch, to assert that applying a patch
-// yields the correct outcome. They are also test cases for CreateTwoWayMergePatch
-// and CreateThreeWayMergePatch, to assert that they both generate the correct patch
-// for the given set of input documents.
-//
-var createStrategicMergePatchTestCaseData = []byte(`
-testCases:
- - description: nil original
- twoWay:
- name: 1
- value: 1
- modified:
- name: 1
- value: 1
- current:
- name: 1
- other: a
- threeWay:
- value: 1
- result:
- name: 1
- value: 1
- other: a
- - description: nil patch
- original:
- name: 1
- twoWay:
- {}
- modified:
- name: 1
- current:
- name: 1
- threeWay:
- {}
- result:
- name: 1
- - description: add field to map
- original:
- name: 1
- twoWay:
- value: 1
- modified:
- name: 1
- value: 1
- current:
- name: 1
- other: a
- threeWay:
- value: 1
- result:
- name: 1
- value: 1
- other: a
- - description: add field to map with conflict
- original:
- name: 1
- twoWay:
- value: 1
- modified:
- name: 1
- value: 1
- current:
- name: a
- other: a
- threeWay:
- name: 1
- value: 1
- result:
- name: 1
- value: 1
- other: a
- - description: add field and delete field from map
- original:
- name: 1
- twoWay:
- name: null
- value: 1
- modified:
- value: 1
- current:
- name: 1
- other: a
- threeWay:
- name: null
- value: 1
- result:
- value: 1
- other: a
- - description: add field and delete field from map with conflict
- original:
- name: 1
- twoWay:
- name: null
- value: 1
- modified:
- value: 1
- current:
- name: a
- other: a
- threeWay:
- name: null
- value: 1
- result:
- value: 1
- other: a
- - description: delete field from nested map
- original:
- simpleMap:
- key1: 1
- key2: 1
- twoWay:
- simpleMap:
- key2: null
- modified:
- simpleMap:
- key1: 1
- current:
- simpleMap:
- key1: 1
- key2: 1
- other: a
- threeWay:
- simpleMap:
- key2: null
- result:
- simpleMap:
- key1: 1
- other: a
- - description: delete field from nested map with conflict
- original:
- simpleMap:
- key1: 1
- key2: 1
- twoWay:
- simpleMap:
- key2: null
- modified:
- simpleMap:
- key1: 1
- current:
- simpleMap:
- key1: a
- key2: 1
- other: a
- threeWay:
- simpleMap:
- key1: 1
- key2: null
- result:
- simpleMap:
- key1: 1
- other: a
- - description: delete all fields from map
- original:
- name: 1
- value: 1
- twoWay:
- name: null
- value: null
- modified: {}
- current:
- name: 1
- value: 1
- other: a
- threeWay:
- name: null
- value: null
- result:
- other: a
- - description: delete all fields from map with conflict
- original:
- name: 1
- value: 1
- twoWay:
- name: null
- value: null
- modified: {}
- current:
- name: 1
- value: a
- other: a
- threeWay:
- name: null
- value: null
- result:
- other: a
- - description: add field and delete all fields from map
- original:
- name: 1
- value: 1
- twoWay:
- name: null
- value: null
- other: a
- modified:
- other: a
- current:
- name: 1
- value: 1
- other: a
- threeWay:
- name: null
- value: null
- result:
- other: a
- - description: add field and delete all fields from map with conflict
- original:
- name: 1
- value: 1
- twoWay:
- name: null
- value: null
- other: a
- modified:
- other: a
- current:
- name: 1
- value: 1
- other: b
- threeWay:
- name: null
- value: null
- other: a
- result:
- other: a
- - description: replace list of scalars
- original:
- nonMergingIntList:
- - 1
- - 2
- twoWay:
- nonMergingIntList:
- - 2
- - 3
- modified:
- nonMergingIntList:
- - 2
- - 3
- current:
- nonMergingIntList:
- - 1
- - 2
- threeWay:
- nonMergingIntList:
- - 2
- - 3
- result:
- nonMergingIntList:
- - 2
- - 3
- - description: replace list of scalars with conflict
- original:
- nonMergingIntList:
- - 1
- - 2
- twoWay:
- nonMergingIntList:
- - 2
- - 3
- modified:
- nonMergingIntList:
- - 2
- - 3
- current:
- nonMergingIntList:
- - 1
- - 4
- threeWay:
- nonMergingIntList:
- - 2
- - 3
- result:
- nonMergingIntList:
- - 2
- - 3
- - description: delete all maps from merging list
- original:
- mergingList:
- - name: 1
- - name: 2
- twoWay:
- mergingList:
- - name: 1
- $patch: delete
- - name: 2
- $patch: delete
- modified:
- mergingList: []
- current:
- mergingList:
- - name: 1
- - name: 2
- threeWay:
- mergingList:
- - name: 1
- $patch: delete
- - name: 2
- $patch: delete
- result:
- mergingList: []
- - description: delete all maps from merging list with conflict
- original:
- mergingList:
- - name: 1
- - name: 2
- twoWay:
- mergingList:
- - name: 1
- $patch: delete
- - name: 2
- $patch: delete
- modified:
- mergingList: []
- current:
- mergingList:
- - name: 1
- other: a
- - name: 2
- other: b
- threeWay:
- mergingList:
- - name: 1
- $patch: delete
- - name: 2
- $patch: delete
- result:
- mergingList: []
- - description: delete all maps from empty merging list
- original:
- mergingList:
- - name: 1
- - name: 2
- twoWay:
- mergingList:
- - name: 1
- $patch: delete
- - name: 2
- $patch: delete
- modified:
- mergingList: []
- current:
- mergingList: []
- threeWay:
- mergingList:
- - name: 1
- $patch: delete
- - name: 2
- $patch: delete
- result:
- mergingList: []
- - description: merge empty merging lists
- original:
- mergingList: []
- twoWay:
- {}
- modified:
- mergingList: []
- current:
- mergingList: []
- threeWay:
- {}
- result:
- mergingList: []
- - description: defined null values should propagate overwrite current fields (with conflict)
- original:
- name: 2
- twoWay:
- name: 1
- value: 1
- other: null
- twoWayResult:
- name: 1
- value: 1
- modified:
- name: 1
- value: 1
- other: null
- current:
- name: a
- other: a
- threeWay:
- name: 1
- value: 1
- other: null
- result:
- name: 1
- value: 1
- - description: defined null values should propagate removing original fields
- original:
- name: original-name
- value: original-value
- current:
- name: original-name
- value: original-value
- other: current-other
- modified:
- name: modified-name
- value: null
- twoWay:
- name: modified-name
- value: null
- twoWayResult:
- name: modified-name
- threeWay:
- name: modified-name
- value: null
- result:
- name: modified-name
- other: current-other
- - description: nil patch with retainKeys map
- original:
- name: a
- retainKeysMap:
- name: foo
- current:
- name: a
- value: b
- retainKeysMap:
- name: foo
- modified:
- name: a
- retainKeysMap:
- name: foo
- twoWay: {}
- threeWay: {}
- result:
- name: a
- value: b
- retainKeysMap:
- name: foo
- - description: retainKeys map with no change should not be present
- original:
- name: a
- retainKeysMap:
- name: foo
- current:
- name: a
- other: c
- retainKeysMap:
- name: foo
- modified:
- name: a
- value: b
- retainKeysMap:
- name: foo
- twoWay:
- value: b
- threeWay:
- value: b
- result:
- name: a
- value: b
- other: c
- retainKeysMap:
- name: foo
-`)
-
-var strategicMergePatchRawTestCases = []StrategicMergePatchRawTestCase{
- {
- Description: "delete items in lists of scalars",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingIntList:
- - 1
- - 2
- - 3
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingIntList:
- - 1
- - 2
-$deleteFromPrimitiveList/mergingIntList:
- - 3
-`),
- Modified: []byte(`
-mergingIntList:
- - 1
- - 2
-`),
- Current: []byte(`
-mergingIntList:
- - 1
- - 2
- - 3
- - 4
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingIntList:
- - 1
- - 2
-$deleteFromPrimitiveList/mergingIntList:
- - 3
-`),
- Result: []byte(`
-mergingIntList:
- - 1
- - 2
- - 4
-`),
- },
- },
- {
- Description: "delete all duplicate items in lists of scalars",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingIntList:
- - 1
- - 2
- - 3
- - 3
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingIntList:
- - 1
- - 2
-$deleteFromPrimitiveList/mergingIntList:
- - 3
-`),
- Modified: []byte(`
-mergingIntList:
- - 1
- - 2
-`),
- Current: []byte(`
-mergingIntList:
- - 1
- - 2
- - 3
- - 3
- - 4
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingIntList:
- - 1
- - 2
-$deleteFromPrimitiveList/mergingIntList:
- - 3
-`),
- Result: []byte(`
-mergingIntList:
- - 1
- - 2
- - 4
-`),
- },
- },
- {
- Description: "add and delete items in lists of scalars",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingIntList:
- - 1
- - 2
- - 3
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingIntList:
- - 1
- - 2
- - 4
-$deleteFromPrimitiveList/mergingIntList:
- - 3
-mergingIntList:
- - 4
-`),
- Modified: []byte(`
-mergingIntList:
- - 1
- - 2
- - 4
-`),
- Current: []byte(`
-mergingIntList:
- - 1
- - 2
- - 3
- - 4
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingIntList:
- - 1
- - 2
- - 4
-$deleteFromPrimitiveList/mergingIntList:
- - 3
-`),
- Result: []byte(`
-mergingIntList:
- - 1
- - 2
- - 4
-`),
- },
- },
- {
- Description: "merge lists of maps",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- - name: 2
- value: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 4
- - name: 1
- - name: 2
- - name: 3
-mergingList:
- - name: 4
- value: 4
- - name: 3
- value: 3
-`),
- Modified: []byte(`
-mergingList:
- - name: 4
- value: 4
- - name: 1
- - name: 2
- value: 2
- - name: 3
- value: 3
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- other: a
- - name: 2
- value: 2
- other: b
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 4
- - name: 1
- - name: 2
- - name: 3
-mergingList:
- - name: 4
- value: 4
- - name: 3
- value: 3
-`),
- Result: []byte(`
-mergingList:
- - name: 4
- value: 4
- - name: 1
- other: a
- - name: 2
- value: 2
- other: b
- - name: 3
- value: 3
-`),
- },
- },
- {
- Description: "merge lists of maps with conflict",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- - name: 2
- value: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
- - name: 3
-mergingList:
- - name: 3
- value: 3
-`),
- Modified: []byte(`
-mergingList:
- - name: 1
- - name: 2
- value: 2
- - name: 3
- value: 3
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- other: a
- - name: 2
- value: 3
- other: b
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
- - name: 3
-mergingList:
- - name: 2
- value: 2
- - name: 3
- value: 3
-`),
- Result: []byte(`
-mergingList:
- - name: 1
- other: a
- - name: 2
- value: 2
- other: b
- - name: 3
- value: 3
-`),
- },
- },
- {
- Description: "add field to map in merging list",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- - name: 2
- value: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 1
- value: 1
-`),
- Modified: []byte(`
-mergingList:
- - name: 1
- value: 1
- - name: 2
- value: 2
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- other: a
- - name: 2
- value: 2
- other: b
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 1
- value: 1
-`),
- Result: []byte(`
-mergingList:
- - name: 1
- value: 1
- other: a
- - name: 2
- value: 2
- other: b
-`),
- },
- },
- {
- Description: "add field to map in merging list",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- - name: 2
- value: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 1
- value: 1
-`),
- Modified: []byte(`
-mergingList:
- - name: 1
- value: 1
- - name: 2
- value: 2
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- other: a
- - name: 2
- value: 2
- other: b
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 1
- value: 1
-`),
- Result: []byte(`
-mergingList:
- - name: 1
- value: 1
- other: a
- - name: 2
- value: 2
- other: b
-`),
- },
- },
- {
- Description: "add field to map in merging list with conflict",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- - name: 2
- value: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 1
- value: 1
-`),
- Modified: []byte(`
-mergingList:
- - name: 1
- value: 1
- - name: 2
- value: 2
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- other: a
- - name: 3
- value: 2
- other: b
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 1
- value: 1
- - name: 2
- value: 2
-`),
- Result: []byte(`
-mergingList:
- - name: 1
- value: 1
- other: a
- - name: 2
- value: 2
- - name: 3
- value: 2
- other: b
-`),
- },
- },
- {
- Description: "add duplicate field to map in merging list",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- - name: 2
- value: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 1
- value: 1
-`),
- Modified: []byte(`
-mergingList:
- - name: 1
- value: 1
- - name: 2
- value: 2
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- value: 1
- other: a
- - name: 2
- value: 2
- other: b
-`),
- ThreeWay: []byte(`{}`),
- Result: []byte(`
-mergingList:
- - name: 1
- value: 1
- other: a
- - name: 2
- value: 2
- other: b
-`),
- },
- },
- {
- Description: "add an item that already exists in current object in merging list",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- value: a
- - name: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
- - name: 3
-mergingList:
- - name: 3
-`),
- Modified: []byte(`
-mergingList:
- - name: 1
- value: a
- - name: 2
- - name: 3
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- value: a
- other: x
- - name: 2
- - name: 3
-`),
- ThreeWay: []byte(`{}`),
- Result: []byte(`
-mergingList:
- - name: 1
- value: a
- other: x
- - name: 2
- - name: 3
-`),
- },
- },
- {
- Description: "add duplicate field to map in merging list with conflict",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- - name: 2
- value: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 1
- value: 1
-`),
- Modified: []byte(`
-mergingList:
- - name: 1
- value: 1
- - name: 2
- value: 2
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- value: 1
- other: a
- - name: 2
- value: 3
- other: b
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 2
- value: 2
-`),
- Result: []byte(`
-mergingList:
- - name: 1
- value: 1
- other: a
- - name: 2
- value: 2
- other: b
-`),
- },
- },
- {
- Description: "replace map field value in merging list",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- value: 1
- - name: 2
- value: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 1
- value: a
-`),
- Modified: []byte(`
-mergingList:
- - name: 1
- value: a
- - name: 2
- value: 2
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- value: 1
- other: a
- - name: 2
- value: 2
- other: b
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 1
- value: a
-`),
- Result: []byte(`
-mergingList:
- - name: 1
- value: a
- other: a
- - name: 2
- value: 2
- other: b
-`),
- },
- },
- {
- Description: "replace map field value in merging list with conflict",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- value: 1
- - name: 2
- value: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 1
- value: a
-`),
- Modified: []byte(`
-mergingList:
- - name: 1
- value: a
- - name: 2
- value: 2
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- value: 3
- other: a
- - name: 2
- value: 2
- other: b
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 1
- value: a
-`),
- Result: []byte(`
-mergingList:
- - name: 1
- value: a
- other: a
- - name: 2
- value: 2
- other: b
-`),
- },
- },
- {
- Description: "delete map from merging list",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- - name: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 2
-mergingList:
- - name: 1
- $patch: delete
-`),
- Modified: []byte(`
-mergingList:
- - name: 2
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- - name: 2
- other: b
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 2
-mergingList:
- - name: 1
- $patch: delete
-`),
- Result: []byte(`
-mergingList:
- - name: 2
- other: b
-`),
- },
- },
- {
- Description: "delete map from merging list with conflict",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- - name: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 2
-mergingList:
- - name: 1
- $patch: delete
-`),
- Modified: []byte(`
-mergingList:
- - name: 2
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- other: a
- - name: 2
- other: b
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 2
-mergingList:
- - name: 1
- $patch: delete
-`),
- Result: []byte(`
-mergingList:
- - name: 2
- other: b
-`),
- },
- },
- {
- Description: "delete missing map from merging list",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- - name: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 2
-mergingList:
- - name: 1
- $patch: delete
-`),
- Modified: []byte(`
-mergingList:
- - name: 2
-`),
- Current: []byte(`
-mergingList:
- - name: 2
- other: b
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 2
-mergingList:
- - name: 1
- $patch: delete
-`),
- Result: []byte(`
-mergingList:
- - name: 2
- other: b
-`),
- },
- },
- {
- Description: "delete missing map from merging list with conflict",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- - name: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 2
-mergingList:
- - name: 1
- $patch: delete
-`),
- Modified: []byte(`
-mergingList:
- - name: 2
-`),
- Current: []byte(`
-mergingList:
- - name: 3
- other: a
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 2
-mergingList:
- - name: 2
- - name: 1
- $patch: delete
-`),
- Result: []byte(`
-mergingList:
- - name: 2
- - name: 3
- other: a
-`),
- },
- },
- {
- Description: "add map and delete map from merging list",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- - name: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 2
- - name: 3
-mergingList:
- - name: 3
- - name: 1
- $patch: delete
-`),
- Modified: []byte(`
-mergingList:
- - name: 2
- - name: 3
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- - name: 2
- other: b
- - name: 4
- other: c
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 2
- - name: 3
-mergingList:
- - name: 3
- - name: 1
- $patch: delete
-`),
- Result: []byte(`
-mergingList:
- - name: 2
- other: b
- - name: 4
- other: c
- - name: 3
-`),
- },
- },
- {
- Description: "add map and delete map from merging list with conflict",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- - name: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 2
- - name: 3
-mergingList:
- - name: 3
- - name: 1
- $patch: delete
-`),
- Modified: []byte(`
-mergingList:
- - name: 2
- - name: 3
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- other: a
- - name: 4
- other: c
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 2
- - name: 3
-mergingList:
- - name: 2
- - name: 3
- - name: 1
- $patch: delete
-`),
- Result: []byte(`
-mergingList:
- - name: 4
- other: c
- - name: 2
- - name: 3
-`),
- },
- },
- {
- Description: "delete field from map in merging list",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- value: 1
- - name: 2
- value: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 1
- value: null
-`),
- Modified: []byte(`
-mergingList:
- - name: 1
- - name: 2
- value: 2
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- value: 1
- other: a
- - name: 2
- value: 2
- other: b
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 1
- value: null
-`),
- Result: []byte(`
-mergingList:
- - name: 1
- other: a
- - name: 2
- value: 2
- other: b
-`),
- },
- },
- {
- Description: "delete field from map in merging list with conflict",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- value: 1
- - name: 2
- value: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 1
- value: null
-`),
- Modified: []byte(`
-mergingList:
- - name: 1
- - name: 2
- value: 2
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- value: a
- other: a
- - name: 2
- value: 2
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 1
- value: null
-`),
- Result: []byte(`
-mergingList:
- - name: 1
- other: a
- - name: 2
- value: 2
-`),
- },
- },
- {
- Description: "delete missing field from map in merging list",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- value: 1
- - name: 2
- value: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 1
- value: null
-`),
- Modified: []byte(`
-mergingList:
- - name: 1
- - name: 2
- value: 2
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- other: a
- - name: 2
- value: 2
- other: b
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 1
- value: null
-`),
- Result: []byte(`
-mergingList:
- - name: 1
- other: a
- - name: 2
- value: 2
- other: b
-`),
- },
- },
- {
- Description: "delete missing field from map in merging list with conflict",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- value: 1
- - name: 2
- value: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 1
- value: null
-`),
- Modified: []byte(`
-mergingList:
- - name: 1
- - name: 2
- value: 2
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- other: a
- - name: 2
- other: b
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 1
- value: null
- - name: 2
- value: 2
-`),
- Result: []byte(`
-mergingList:
- - name: 1
- other: a
- - name: 2
- value: 2
- other: b
-`),
- },
- },
- {
- Description: "replace non merging list nested in merging list",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- nonMergingList:
- - name: 1
- - name: 2
- value: 2
- - name: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 1
- nonMergingList:
- - name: 1
- value: 1
-`),
- Modified: []byte(`
-mergingList:
- - name: 1
- nonMergingList:
- - name: 1
- value: 1
- - name: 2
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- other: a
- nonMergingList:
- - name: 1
- - name: 2
- value: 2
- - name: 2
- other: b
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 1
- nonMergingList:
- - name: 1
- value: 1
-`),
- Result: []byte(`
-mergingList:
- - name: 1
- other: a
- nonMergingList:
- - name: 1
- value: 1
- - name: 2
- other: b
-`),
- },
- },
- {
- Description: "replace non merging list nested in merging list with value conflict",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- nonMergingList:
- - name: 1
- - name: 2
- value: 2
- - name: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 1
- nonMergingList:
- - name: 1
- value: 1
-`),
- Modified: []byte(`
-mergingList:
- - name: 1
- nonMergingList:
- - name: 1
- value: 1
- - name: 2
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- other: a
- nonMergingList:
- - name: 1
- value: c
- - name: 2
- other: b
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 1
- nonMergingList:
- - name: 1
- value: 1
-`),
- Result: []byte(`
-mergingList:
- - name: 1
- other: a
- nonMergingList:
- - name: 1
- value: 1
- - name: 2
- other: b
-`),
- },
- },
- {
- Description: "replace non merging list nested in merging list with deletion conflict",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- nonMergingList:
- - name: 1
- - name: 2
- value: 2
- - name: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 1
- nonMergingList:
- - name: 1
- value: 1
-`),
- Modified: []byte(`
-mergingList:
- - name: 1
- nonMergingList:
- - name: 1
- value: 1
- - name: 2
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- other: a
- nonMergingList:
- - name: 2
- value: 2
- - name: 2
- other: b
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 1
- nonMergingList:
- - name: 1
- value: 1
-`),
- Result: []byte(`
-mergingList:
- - name: 1
- other: a
- nonMergingList:
- - name: 1
- value: 1
- - name: 2
- other: b
-`),
- },
- },
- {
- Description: "add field to map in merging list nested in merging list",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- mergingList:
- - name: 1
- - name: 2
- value: 2
- - name: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - $setElementOrder/mergingList:
- - name: 1
- - name: 2
- name: 1
- mergingList:
- - name: 1
- value: 1
-`),
- Modified: []byte(`
-mergingList:
- - name: 1
- mergingList:
- - name: 1
- value: 1
- - name: 2
- value: 2
- - name: 2
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- other: a
- mergingList:
- - name: 1
- - name: 2
- value: 2
- - name: 2
- other: b
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - $setElementOrder/mergingList:
- - name: 1
- - name: 2
- name: 1
- mergingList:
- - name: 1
- value: 1
-`),
- Result: []byte(`
-mergingList:
- - name: 1
- other: a
- mergingList:
- - name: 1
- value: 1
- - name: 2
- value: 2
- - name: 2
- other: b
-`),
- },
- },
- {
- Description: "add field to map in merging list nested in merging list with value conflict",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- mergingList:
- - name: 1
- - name: 2
- value: 2
- - name: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - $setElementOrder/mergingList:
- - name: 1
- - name: 2
- name: 1
- mergingList:
- - name: 1
- value: 1
-`),
- Modified: []byte(`
-mergingList:
- - name: 1
- mergingList:
- - name: 1
- value: 1
- - name: 2
- value: 2
- - name: 2
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- other: a
- mergingList:
- - name: 1
- value: a
- other: c
- - name: 2
- value: b
- other: d
- - name: 2
- other: b
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - $setElementOrder/mergingList:
- - name: 1
- - name: 2
- name: 1
- mergingList:
- - name: 1
- value: 1
- - name: 2
- value: 2
-`),
- Result: []byte(`
-mergingList:
- - name: 1
- other: a
- mergingList:
- - name: 1
- value: 1
- other: c
- - name: 2
- value: 2
- other: d
- - name: 2
- other: b
-`),
- },
- },
- {
- Description: "add field to map in merging list nested in merging list with deletion conflict",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- mergingList:
- - name: 1
- - name: 2
- value: 2
- - name: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - $setElementOrder/mergingList:
- - name: 1
- - name: 2
- name: 1
- mergingList:
- - name: 1
- value: 1
-`),
- Modified: []byte(`
-mergingList:
- - name: 1
- mergingList:
- - name: 1
- value: 1
- - name: 2
- value: 2
- - name: 2
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- other: a
- mergingList:
- - name: 2
- value: 2
- other: d
- - name: 2
- other: b
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - $setElementOrder/mergingList:
- - name: 1
- - name: 2
- name: 1
- mergingList:
- - name: 1
- value: 1
-`),
- Result: []byte(`
-mergingList:
- - name: 1
- other: a
- mergingList:
- - name: 1
- value: 1
- - name: 2
- value: 2
- other: d
- - name: 2
- other: b
-`),
- },
- },
-
- {
- Description: "add field to map in merging list nested in merging list with deletion conflict",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- mergingList:
- - name: 1
- - name: 2
- value: 2
- - name: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - $setElementOrder/mergingList:
- - name: 2
- - name: 1
- name: 1
- mergingList:
- - name: 1
- value: 1
-`),
- Modified: []byte(`
-mergingList:
- - name: 1
- mergingList:
- - name: 2
- value: 2
- - name: 1
- value: 1
- - name: 2
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- other: a
- mergingList:
- - name: 2
- value: 2
- other: d
- - name: 2
- other: b
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - $setElementOrder/mergingList:
- - name: 2
- - name: 1
- name: 1
- mergingList:
- - name: 1
- value: 1
-`),
- Result: []byte(`
-mergingList:
- - name: 1
- other: a
- mergingList:
- - name: 2
- value: 2
- other: d
- - name: 1
- value: 1
- - name: 2
- other: b
-`),
- },
- },
- {
- Description: "add map to merging list by pointer",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergeItemPtr:
- - name: 1
-`),
- TwoWay: []byte(`
-$setElementOrder/mergeItemPtr:
- - name: 1
- - name: 2
-mergeItemPtr:
- - name: 2
-`),
- Modified: []byte(`
-mergeItemPtr:
- - name: 1
- - name: 2
-`),
- Current: []byte(`
-mergeItemPtr:
- - name: 1
- other: a
- - name: 3
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergeItemPtr:
- - name: 1
- - name: 2
-mergeItemPtr:
- - name: 2
-`),
- Result: []byte(`
-mergeItemPtr:
- - name: 1
- other: a
- - name: 2
- - name: 3
-`),
- },
- },
- {
- Description: "add map to merging list by pointer with conflict",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergeItemPtr:
- - name: 1
-`),
- TwoWay: []byte(`
-$setElementOrder/mergeItemPtr:
- - name: 1
- - name: 2
-mergeItemPtr:
- - name: 2
-`),
- Modified: []byte(`
-mergeItemPtr:
- - name: 1
- - name: 2
-`),
- Current: []byte(`
-mergeItemPtr:
- - name: 3
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergeItemPtr:
- - name: 1
- - name: 2
-mergeItemPtr:
- - name: 1
- - name: 2
-`),
- Result: []byte(`
-mergeItemPtr:
- - name: 1
- - name: 2
- - name: 3
-`),
- },
- },
- {
- Description: "add field to map in merging list by pointer",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergeItemPtr:
- - name: 1
- mergeItemPtr:
- - name: 1
- - name: 2
- value: 2
- - name: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergeItemPtr:
- - name: 1
- - name: 2
-mergeItemPtr:
- - $setElementOrder/mergeItemPtr:
- - name: 1
- - name: 2
- name: 1
- mergeItemPtr:
- - name: 1
- value: 1
-`),
- Modified: []byte(`
-mergeItemPtr:
- - name: 1
- mergeItemPtr:
- - name: 1
- value: 1
- - name: 2
- value: 2
- - name: 2
-`),
- Current: []byte(`
-mergeItemPtr:
- - name: 1
- other: a
- mergeItemPtr:
- - name: 1
- other: a
- - name: 2
- value: 2
- other: b
- - name: 2
- other: b
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergeItemPtr:
- - name: 1
- - name: 2
-mergeItemPtr:
- - $setElementOrder/mergeItemPtr:
- - name: 1
- - name: 2
- name: 1
- mergeItemPtr:
- - name: 1
- value: 1
-`),
- Result: []byte(`
-mergeItemPtr:
- - name: 1
- other: a
- mergeItemPtr:
- - name: 1
- value: 1
- other: a
- - name: 2
- value: 2
- other: b
- - name: 2
- other: b
-`),
- },
- },
- {
- Description: "add field to map in merging list by pointer with conflict",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergeItemPtr:
- - name: 1
- mergeItemPtr:
- - name: 1
- - name: 2
- value: 2
- - name: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergeItemPtr:
- - name: 1
- - name: 2
-mergeItemPtr:
- - $setElementOrder/mergeItemPtr:
- - name: 1
- - name: 2
- name: 1
- mergeItemPtr:
- - name: 1
- value: 1
-`),
- Modified: []byte(`
-mergeItemPtr:
- - name: 1
- mergeItemPtr:
- - name: 1
- value: 1
- - name: 2
- value: 2
- - name: 2
-`),
- Current: []byte(`
-mergeItemPtr:
- - name: 1
- other: a
- mergeItemPtr:
- - name: 1
- value: a
- - name: 2
- value: 2
- other: b
- - name: 2
- other: b
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergeItemPtr:
- - name: 1
- - name: 2
-mergeItemPtr:
- - $setElementOrder/mergeItemPtr:
- - name: 1
- - name: 2
- name: 1
- mergeItemPtr:
- - name: 1
- value: 1
-`),
- Result: []byte(`
-mergeItemPtr:
- - name: 1
- other: a
- mergeItemPtr:
- - name: 1
- value: 1
- - name: 2
- value: 2
- other: b
- - name: 2
- other: b
-`),
- },
- },
- {
- Description: "merge lists of scalars",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingIntList:
-- 1
-- 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingIntList:
-- 1
-- 2
-- 3
-mergingIntList:
-- 3
-`),
- Modified: []byte(`
-mergingIntList:
-- 1
-- 2
-- 3
-`),
- Current: []byte(`
-mergingIntList:
-- 1
-- 2
-- 4
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingIntList:
-- 1
-- 2
-- 3
-mergingIntList:
-- 3
-`),
- Result: []byte(`
-mergingIntList:
-- 1
-- 2
-- 3
-- 4
-`),
- },
- },
- {
- Description: "add duplicate field to map in merging int list",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingIntList:
- - 1
- - 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingIntList:
- - 1
- - 2
- - 3
-mergingIntList:
- - 3
-`),
- Modified: []byte(`
-mergingIntList:
- - 1
- - 2
- - 3
-`),
- Current: []byte(`
-mergingIntList:
- - 1
- - 2
- - 3
-`),
- ThreeWay: []byte(`{}`),
- Result: []byte(`
-mergingIntList:
- - 1
- - 2
- - 3
-`),
- },
- },
- // test case for setElementOrder
- {
- Description: "add an item in a list of primitives and preserve order",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingIntList:
-- 1
-- 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingIntList:
-- 3
-- 1
-- 2
-mergingIntList:
-- 3
-`),
- Modified: []byte(`
-mergingIntList:
-- 3
-- 1
-- 2
-`),
- Current: []byte(`
-mergingIntList:
-- 1
-- 4
-- 2
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingIntList:
-- 3
-- 1
-- 2
-mergingIntList:
-- 3
-`),
- Result: []byte(`
-mergingIntList:
-- 3
-- 1
-- 4
-- 2
-`),
- },
- },
- {
- Description: "delete an item in a list of primitives and preserve order",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingIntList:
-- 1
-- 2
-- 3
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingIntList:
-- 2
-- 1
-$deleteFromPrimitiveList/mergingIntList:
-- 3
-`),
- Modified: []byte(`
-mergingIntList:
-- 2
-- 1
-`),
- Current: []byte(`
-mergingIntList:
-- 1
-- 2
-- 3
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingIntList:
-- 2
-- 1
-$deleteFromPrimitiveList/mergingIntList:
-- 3
-`),
- Result: []byte(`
-mergingIntList:
-- 2
-- 1
-`),
- },
- },
- {
- Description: "add an item in a list and preserve order",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- - name: 2
- value: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 3
- - name: 1
- - name: 2
-mergingList:
- - name: 3
- value: 3
-`),
- Modified: []byte(`
-mergingList:
- - name: 3
- value: 3
- - name: 1
- - name: 2
- value: 2
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- other: a
- - name: 2
- value: 2
- other: b
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 3
- - name: 1
- - name: 2
-mergingList:
- - name: 3
- value: 3
-`),
- Result: []byte(`
-mergingList:
- - name: 3
- value: 3
- - name: 1
- other: a
- - name: 2
- value: 2
- other: b
-`),
- },
- },
- {
- Description: "add multiple items in a list and preserve order",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- - name: 2
- value: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 4
- - name: 2
- - name: 3
-mergingList:
- - name: 4
- value: 4
- - name: 3
- value: 3
-`),
- Modified: []byte(`
-mergingList:
- - name: 1
- - name: 4
- value: 4
- - name: 2
- value: 2
- - name: 3
- value: 3
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- other: a
- - name: 2
- value: 2
- other: b
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 4
- - name: 2
- - name: 3
-mergingList:
- - name: 4
- value: 4
- - name: 3
- value: 3
-`),
- Result: []byte(`
-mergingList:
- - name: 1
- other: a
- - name: 4
- value: 4
- - name: 2
- value: 2
- other: b
- - name: 3
- value: 3
-`),
- },
- },
- {
- Description: "delete an item in a list and preserve order",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- - name: 3
- value: 3
- - name: 2
- value: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 2
- - name: 1
-mergingList:
- - name: 3
- $patch: delete
-`),
- Modified: []byte(`
-mergingList:
- - name: 2
- value: 2
- - name: 1
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- other: a
- - name: 2
- value: 2
- other: b
- - name: 3
- value: 3
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 2
- - name: 1
-mergingList:
- - name: 3
- $patch: delete
-`),
- Result: []byte(`
-mergingList:
- - name: 2
- value: 2
- other: b
- - name: 1
- other: a
-`),
- },
- },
- {
- Description: "change an item in a list and preserve order",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- - name: 3
- value: 3
- - name: 2
- value: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 2
- - name: 3
- - name: 1
-mergingList:
- - name: 3
- value: x
-`),
- Modified: []byte(`
-mergingList:
- - name: 2
- value: 2
- - name: 3
- value: x
- - name: 1
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- other: a
- - name: 2
- value: 2
- other: b
- - name: 3
- value: 3
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 2
- - name: 3
- - name: 1
-mergingList:
- - name: 3
- value: x
-`),
- Result: []byte(`
-mergingList:
- - name: 2
- value: 2
- other: b
- - name: 3
- value: x
- - name: 1
- other: a
-`),
- },
- },
- {
- Description: "add and delete an item in a list and preserve order",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- - name: 3
- value: 3
- - name: 2
- value: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 4
- - name: 2
- - name: 1
-mergingList:
- - name: 4
- value: 4
- - name: 3
- $patch: delete
-`),
- Modified: []byte(`
-mergingList:
- - name: 4
- value: 4
- - name: 2
- value: 2
- - name: 1
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- other: a
- - name: 2
- value: 2
- other: b
- - name: 3
- value: 3
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 4
- - name: 2
- - name: 1
-mergingList:
- - name: 4
- value: 4
- - name: 3
- $patch: delete
-`),
- Result: []byte(`
-mergingList:
- - name: 4
- value: 4
- - name: 2
- value: 2
- other: b
- - name: 1
- other: a
-`),
- },
- },
- {
- Description: "set elements order in a list",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- - name: 3
- value: 3
- - name: 4
- value: 4
- - name: 2
- value: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 4
- - name: 2
- - name: 3
- - name: 1
-`),
- Modified: []byte(`
-mergingList:
- - name: 4
- value: 4
- - name: 2
- value: 2
- - name: 3
- value: 3
- - name: 1
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- other: a
- - name: 3
- value: 3
- - name: 4
- value: 4
- - name: 2
- value: 2
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 4
- - name: 2
- - name: 3
- - name: 1
-`),
- Result: []byte(`
-mergingList:
- - name: 4
- value: 4
- - name: 2
- value: 2
- - name: 3
- value: 3
- - name: 1
- other: a
-`),
- },
- },
- {
- Description: "set elements order in a list with server-only items",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- - name: 3
- value: 3
- - name: 4
- value: 4
- - name: 2
- value: 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 4
- - name: 2
- - name: 3
- - name: 1
-`),
- Modified: []byte(`
-mergingList:
- - name: 4
- value: 4
- - name: 2
- value: 2
- - name: 3
- value: 3
- - name: 1
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- other: a
- - name: 3
- value: 3
- - name: 4
- value: 4
- - name: 2
- value: 2
- - name: 9
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 4
- - name: 2
- - name: 3
- - name: 1
-`),
- Result: []byte(`
-mergingList:
- - name: 4
- value: 4
- - name: 2
- value: 2
- - name: 3
- value: 3
- - name: 1
- other: a
- - name: 9
-`),
- },
- },
- {
- Description: "set elements order in a list with server-only items 2",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- - name: 2
- value: 2
- - name: 3
- value: 3
- - name: 4
- value: 4
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 2
- - name: 1
- - name: 4
- - name: 3
-`),
- Modified: []byte(`
-mergingList:
- - name: 2
- value: 2
- - name: 1
- - name: 4
- value: 4
- - name: 3
- value: 3
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- other: a
- - name: 2
- value: 2
- - name: 9
- - name: 3
- value: 3
- - name: 4
- value: 4
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 2
- - name: 1
- - name: 4
- - name: 3
-`),
- Result: []byte(`
-mergingList:
- - name: 2
- value: 2
- - name: 1
- other: a
- - name: 9
- - name: 4
- value: 4
- - name: 3
- value: 3
-`),
- },
- },
- {
- Description: "set elements order in a list with server-only items 3",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
- - name: 1
- - name: 2
- value: 2
- - name: 3
- value: 3
- - name: 4
- value: 4
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 2
- - name: 1
- - name: 4
- - name: 3
-`),
- Modified: []byte(`
-mergingList:
- - name: 2
- value: 2
- - name: 1
- - name: 4
- value: 4
- - name: 3
- value: 3
-`),
- Current: []byte(`
-mergingList:
- - name: 1
- other: a
- - name: 2
- value: 2
- - name: 7
- - name: 9
- - name: 8
- - name: 3
- value: 3
- - name: 4
- value: 4
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 2
- - name: 1
- - name: 4
- - name: 3
-`),
- Result: []byte(`
-mergingList:
- - name: 2
- value: 2
- - name: 1
- other: a
- - name: 7
- - name: 9
- - name: 8
- - name: 4
- value: 4
- - name: 3
- value: 3
-`),
- },
- },
- {
- Description: "add an item in a int list and preserve order",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingIntList:
- - 1
- - 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingIntList:
- - 3
- - 1
- - 2
-mergingIntList:
- - 3
-`),
- Modified: []byte(`
-mergingIntList:
- - 3
- - 1
- - 2
-`),
- Current: []byte(`
-mergingIntList:
- - 1
- - 2
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingIntList:
- - 3
- - 1
- - 2
-mergingIntList:
- - 3
-`),
- Result: []byte(`
-mergingIntList:
- - 3
- - 1
- - 2
-`),
- },
- },
- {
- Description: "add multiple items in a int list and preserve order",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingIntList:
- - 1
- - 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingIntList:
- - 1
- - 4
- - 2
- - 3
-mergingIntList:
- - 4
- - 3
-`),
- Modified: []byte(`
-mergingIntList:
- - 1
- - 4
- - 2
- - 3
-`),
- Current: []byte(`
-mergingIntList:
- - 1
- - 2
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingIntList:
- - 1
- - 4
- - 2
- - 3
-mergingIntList:
- - 4
- - 3
-`),
- Result: []byte(`
-mergingIntList:
- - 1
- - 4
- - 2
- - 3
-`),
- },
- },
- {
- Description: "delete an item in a int list and preserve order",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingIntList:
- - 1
- - 3
- - 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingIntList:
- - 2
- - 1
-$deleteFromPrimitiveList/mergingIntList:
- - 3
-`),
- Modified: []byte(`
-mergingIntList:
- - 2
- - 1
-`),
- Current: []byte(`
-mergingIntList:
- - 1
- - 2
- - 3
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingIntList:
- - 2
- - 1
-$deleteFromPrimitiveList/mergingIntList:
- - 3
-`),
- Result: []byte(`
-mergingIntList:
- - 2
- - 1
-`),
- },
- },
- {
- Description: "add and delete an item in a int list and preserve order",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingIntList:
- - 1
- - 3
- - 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingIntList:
- - 4
- - 2
- - 1
-mergingIntList:
- - 4
-$deleteFromPrimitiveList/mergingIntList:
- - 3
-`),
- Modified: []byte(`
-mergingIntList:
- - 4
- - 2
- - 1
-`),
- Current: []byte(`
-mergingIntList:
- - 1
- - 2
- - 3
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingIntList:
- - 4
- - 2
- - 1
-mergingIntList:
- - 4
-$deleteFromPrimitiveList/mergingIntList:
- - 3
-`),
- Result: []byte(`
-mergingIntList:
- - 4
- - 2
- - 1
-`),
- },
- },
- {
- Description: "set elements order in a int list",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingIntList:
- - 1
- - 3
- - 4
- - 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingIntList:
- - 4
- - 2
- - 3
- - 1
-`),
- Modified: []byte(`
-mergingIntList:
- - 4
- - 2
- - 3
- - 1
-`),
- Current: []byte(`
-mergingIntList:
- - 1
- - 3
- - 4
- - 2
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingIntList:
- - 4
- - 2
- - 3
- - 1
-`),
- Result: []byte(`
-mergingIntList:
- - 4
- - 2
- - 3
- - 1
-`),
- },
- },
- {
- Description: "set elements order in a int list with server-only items",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingIntList:
- - 1
- - 3
- - 4
- - 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingIntList:
- - 4
- - 2
- - 3
- - 1
-`),
- Modified: []byte(`
-mergingIntList:
- - 4
- - 2
- - 3
- - 1
-`),
- Current: []byte(`
-mergingIntList:
- - 1
- - 3
- - 4
- - 2
- - 9
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingIntList:
- - 4
- - 2
- - 3
- - 1
-`),
- Result: []byte(`
-mergingIntList:
- - 4
- - 2
- - 3
- - 1
- - 9
-`),
- },
- },
- {
- Description: "set elements order in a int list with server-only items 2",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingIntList:
- - 1
- - 2
- - 3
- - 4
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingIntList:
- - 2
- - 1
- - 4
- - 3
-`),
- Modified: []byte(`
-mergingIntList:
- - 2
- - 1
- - 4
- - 3
-`),
- Current: []byte(`
-mergingIntList:
- - 1
- - 2
- - 9
- - 3
- - 4
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingIntList:
- - 2
- - 1
- - 4
- - 3
-`),
- Result: []byte(`
-mergingIntList:
- - 2
- - 1
- - 9
- - 4
- - 3
-`),
- },
- },
- {
- Description: "set elements order in a int list with server-only items 3",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingIntList:
- - 1
- - 2
- - 3
- - 4
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingIntList:
- - 2
- - 1
- - 4
- - 3
-`),
- Modified: []byte(`
-mergingIntList:
- - 2
- - 1
- - 4
- - 3
-`),
- Current: []byte(`
-mergingIntList:
- - 1
- - 2
- - 7
- - 9
- - 8
- - 3
- - 4
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingIntList:
- - 2
- - 1
- - 4
- - 3
-`),
- Result: []byte(`
-mergingIntList:
- - 2
- - 1
- - 7
- - 9
- - 8
- - 4
- - 3
-`),
- },
- },
- {
- // This test case is used just to demonstrate the behavior when dealing with a list with duplicate
- Description: "behavior of set element order for a merging list with duplicate",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
-- name: 1
-- name: 2
- value: dup1
-- name: 3
-- name: 2
- value: dup2
-- name: 4
-`),
- Current: []byte(`
-mergingList:
-- name: 1
-- name: 2
- value: dup1
-- name: 3
-- name: 2
- value: dup2
-- name: 4
-`),
- Modified: []byte(`
-mergingList:
-- name: 2
- value: dup1
-- name: 1
-- name: 4
-- name: 3
-- name: 2
- value: dup2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
-- name: 2
-- name: 1
-- name: 4
-- name: 3
-- name: 2
-`),
- TwoWayResult: []byte(`
-mergingList:
-- name: 2
- value: dup1
-- name: 2
- value: dup2
-- name: 1
-- name: 4
-- name: 3
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
-- name: 2
-- name: 1
-- name: 4
-- name: 3
-- name: 2
-`),
- Result: []byte(`
-mergingList:
-- name: 2
- value: dup1
-- name: 2
- value: dup2
-- name: 1
-- name: 4
-- name: 3
-`),
- },
- },
- {
- // This test case is used just to demonstrate the behavior when dealing with a list with duplicate
- Description: "behavior of set element order for a merging int list with duplicate",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingIntList:
-- 1
-- 2
-- 3
-- 2
-- 4
-`),
- Current: []byte(`
-mergingIntList:
-- 1
-- 2
-- 3
-- 2
-- 4
-`),
- Modified: []byte(`
-mergingIntList:
-- 2
-- 1
-- 4
-- 3
-- 2
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingIntList:
-- 2
-- 1
-- 4
-- 3
-- 2
-`),
- TwoWayResult: []byte(`
-mergingIntList:
-- 2
-- 2
-- 1
-- 4
-- 3
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingIntList:
-- 2
-- 1
-- 4
-- 3
-- 2
-`),
- Result: []byte(`
-mergingIntList:
-- 2
-- 2
-- 1
-- 4
-- 3
-`),
- },
- },
- {
- Description: "retainKeys map should clear defaulted field",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`{}`),
- Current: []byte(`
-retainKeysMap:
- value: foo
-`),
- Modified: []byte(`
-retainKeysMap:
- other: bar
-`),
- TwoWay: []byte(`
-retainKeysMap:
- other: bar
-`),
- ThreeWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - other
- other: bar
-`),
- Result: []byte(`
-retainKeysMap:
- other: bar
-`),
- },
- },
- {
- Description: "retainKeys map should clear defaulted field with conflict (discriminated union)",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`{}`),
- Current: []byte(`
-retainKeysMap:
- name: type1
- value: foo
-`),
- Modified: []byte(`
-retainKeysMap:
- name: type2
- other: bar
-`),
- TwoWay: []byte(`
-retainKeysMap:
- name: type2
- other: bar
-`),
- ThreeWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- - other
- name: type2
- other: bar
-`),
- Result: []byte(`
-retainKeysMap:
- name: type2
- other: bar
-`),
- },
- },
- {
- Description: "retainKeys map adds a field",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMap:
- name: foo
-`),
- Current: []byte(`
-retainKeysMap:
- name: foo
-`),
- Modified: []byte(`
-retainKeysMap:
- name: foo
- value: bar
-`),
- TwoWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- - value
- value: bar
-`),
- ThreeWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- - value
- value: bar
-`),
- Result: []byte(`
-retainKeysMap:
- name: foo
- value: bar
-`),
- },
- },
- {
- Description: "retainKeys map adds a field and clear a field",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMap:
- name: foo
-`),
- Current: []byte(`
-retainKeysMap:
- name: foo
- other: a
-`),
- Modified: []byte(`
-retainKeysMap:
- name: foo
- value: bar
-`),
- TwoWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- - value
- value: bar
-`),
- ThreeWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- - value
- value: bar
-`),
- Result: []byte(`
-retainKeysMap:
- name: foo
- value: bar
-`),
- },
- },
- {
- Description: "retainKeys map deletes a field",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMap:
- name: foo
- value: bar
-`),
- Current: []byte(`
-retainKeysMap:
- name: foo
- value: bar
-`),
- Modified: []byte(`
-retainKeysMap:
- name: foo
-`),
- TwoWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- value: null
-`),
- ThreeWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- value: null
-`),
- Result: []byte(`
-retainKeysMap:
- name: foo
-`),
- },
- },
- {
- Description: "retainKeys map deletes a field and clears a field",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMap:
- name: foo
- value: bar
-`),
- Current: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- other: a
-`),
- Modified: []byte(`
-retainKeysMap:
- name: foo
-`),
- TwoWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- value: null
-`),
- ThreeWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- value: null
-`),
- Result: []byte(`
-retainKeysMap:
- name: foo
-`),
- },
- },
- {
- Description: "retainKeys map clears a field",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMap:
- name: foo
- value: bar
-`),
- Current: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- other: a
-`),
- Modified: []byte(`
-retainKeysMap:
- name: foo
- value: bar
-`),
- TwoWay: []byte(`{}`),
- ThreeWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- - value
-`),
- Result: []byte(`
-retainKeysMap:
- name: foo
- value: bar
-`),
- },
- },
- {
- Description: "retainKeys map nested map with no change",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMap:
- name: foo
- simpleMap:
- key1: a
-`),
- Current: []byte(`
-retainKeysMap:
- name: foo
- simpleMap:
- key1: a
-`),
- Modified: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- simpleMap:
- key1: a
-`),
- TwoWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- - simpleMap
- - value
- value: bar
-`),
- ThreeWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- - simpleMap
- - value
- value: bar
-`),
- Result: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- simpleMap:
- key1: a
-`),
- },
- },
- {
- Description: "retainKeys map adds a field in a nested map",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- simpleMap:
- key1: a
-`),
- Current: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- simpleMap:
- key1: a
- key3: c
-`),
- Modified: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- simpleMap:
- key1: a
- key2: b
-`),
- TwoWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- - simpleMap
- - value
- simpleMap:
- key2: b
-`),
- ThreeWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- - simpleMap
- - value
- simpleMap:
- key2: b
-`),
- Result: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- simpleMap:
- key1: a
- key2: b
- key3: c
-`),
- },
- },
- {
- Description: "retainKeys map deletes a field in a nested map",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- simpleMap:
- key1: a
- key2: b
-`),
- Current: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- simpleMap:
- key1: a
- key2: b
- key3: c
-`),
- Modified: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- simpleMap:
- key1: a
-`),
- TwoWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- - simpleMap
- - value
- simpleMap:
- key2: null
-`),
- ThreeWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- - simpleMap
- - value
- simpleMap:
- key2: null
-`),
- Result: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- simpleMap:
- key1: a
- key3: c
-`),
- },
- },
- {
- Description: "retainKeys map changes a field in a nested map",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- simpleMap:
- key1: a
- key2: b
-`),
- Current: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- simpleMap:
- key1: a
- key2: b
- key3: c
-`),
- Modified: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- simpleMap:
- key1: x
- key2: b
-`),
- TwoWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- - simpleMap
- - value
- simpleMap:
- key1: x
-`),
- ThreeWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- - simpleMap
- - value
- simpleMap:
- key1: x
-`),
- Result: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- simpleMap:
- key1: x
- key2: b
- key3: c
-`),
- },
- },
- {
- Description: "retainKeys map changes a field in a nested map with conflict",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- simpleMap:
- key1: old
- key2: b
-`),
- Current: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- simpleMap:
- key1: new
- key2: b
- key3: c
-`),
- Modified: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- simpleMap:
- key1: modified
- key2: b
-`),
- TwoWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- - simpleMap
- - value
- simpleMap:
- key1: modified
-`),
- ThreeWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- - simpleMap
- - value
- simpleMap:
- key1: modified
-`),
- Result: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- simpleMap:
- key1: modified
- key2: b
- key3: c
-`),
- },
- },
- {
- Description: "retainKeys map replaces non-merging list",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- nonMergingList:
- - name: a
- - name: b
-`),
- Current: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- nonMergingList:
- - name: a
- - name: b
-`),
- Modified: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- nonMergingList:
- - name: a
- - name: c
- - name: b
-`),
- TwoWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- - nonMergingList
- - value
- nonMergingList:
- - name: a
- - name: c
- - name: b
-`),
- ThreeWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- - nonMergingList
- - value
- nonMergingList:
- - name: a
- - name: c
- - name: b
-`),
- Result: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- nonMergingList:
- - name: a
- - name: c
- - name: b
-`),
- },
- },
- {
- Description: "retainKeys map nested non-merging list with no change",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMap:
- name: foo
- nonMergingList:
- - name: a
- - name: b
-`),
- Current: []byte(`
-retainKeysMap:
- name: foo
- nonMergingList:
- - name: a
- - name: b
-`),
- Modified: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- nonMergingList:
- - name: a
- - name: b
-`),
- TwoWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- - nonMergingList
- - value
- value: bar
-`),
- ThreeWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- - nonMergingList
- - value
- value: bar
-`),
- Result: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- nonMergingList:
- - name: a
- - name: b
-`),
- },
- },
- {
- Description: "retainKeys map nested non-merging list with no change with conflict",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMap:
- name: foo
- nonMergingList:
- - name: a
- - name: b
-`),
- Current: []byte(`
-retainKeysMap:
- name: foo
- nonMergingList:
- - name: a
- - name: b
- - name: c
-`),
- Modified: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- nonMergingList:
- - name: a
- - name: b
-`),
- TwoWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- - nonMergingList
- - value
- value: bar
-`),
- ThreeWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- - nonMergingList
- - value
- value: bar
- nonMergingList:
- - name: a
- - name: b
-`),
- Result: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- nonMergingList:
- - name: a
- - name: b
-`),
- },
- },
- {
- Description: "retainKeys map deletes nested non-merging list",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMap:
- name: foo
- nonMergingList:
- - name: a
- - name: b
-`),
- Current: []byte(`
-retainKeysMap:
- name: foo
- nonMergingList:
- - name: a
- - name: b
-`),
- Modified: []byte(`
-retainKeysMap:
- name: foo
- value: bar
-`),
- TwoWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- - value
- value: bar
- nonMergingList: null
-`),
- ThreeWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- - value
- value: bar
- nonMergingList: null
-`),
- Result: []byte(`
-retainKeysMap:
- name: foo
- value: bar
-`),
- },
- },
- {
- Description: "retainKeys map delete nested non-merging list with conflict",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMap:
- name: foo
- nonMergingList:
- - name: a
- - name: b
-`),
- Current: []byte(`
-retainKeysMap:
- name: foo
- nonMergingList:
- - name: a
- - name: b
- - name: c
-`),
- Modified: []byte(`
-retainKeysMap:
- name: foo
- value: bar
-`),
- TwoWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- - value
- value: bar
- nonMergingList: null
-`),
- ThreeWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- - value
- value: bar
- nonMergingList: null
-`),
- Result: []byte(`
-retainKeysMap:
- name: foo
- value: bar
-`),
- },
- },
- {
- Description: "retainKeys map nested merging int list with no change",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMap:
- name: foo
- mergingIntList:
- - 1
- - 2
-`),
- Current: []byte(`
-retainKeysMap:
- name: foo
- mergingIntList:
- - 1
- - 2
- - 3
-`),
- Modified: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- mergingIntList:
- - 1
- - 2
-`),
- TwoWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - mergingIntList
- - name
- - value
- value: bar
-`),
- ThreeWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - mergingIntList
- - name
- - value
- $setElementOrder/mergingIntList:
- - 1
- - 2
- value: bar
-`),
- Result: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- mergingIntList:
- - 1
- - 2
- - 3
-`),
- },
- },
- {
- Description: "retainKeys map adds an item in nested merging int list",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMap:
- name: foo
- mergingIntList:
- - 1
- - 2
-`),
- Current: []byte(`
-retainKeysMap:
- name: foo
- mergingIntList:
- - 1
- - 2
- - 3
-`),
- Modified: []byte(`
-retainKeysMap:
- name: foo
- mergingIntList:
- - 1
- - 2
- - 4
-`),
- TwoWay: []byte(`
-retainKeysMap:
- $setElementOrder/mergingIntList:
- - 1
- - 2
- - 4
- $retainKeys:
- - mergingIntList
- - name
- mergingIntList:
- - 4
-`),
- ThreeWay: []byte(`
-retainKeysMap:
- $setElementOrder/mergingIntList:
- - 1
- - 2
- - 4
- $retainKeys:
- - mergingIntList
- - name
- mergingIntList:
- - 4
-`),
- Result: []byte(`
-retainKeysMap:
- name: foo
- mergingIntList:
- - 1
- - 2
- - 4
- - 3
-`),
- },
- },
- {
- Description: "retainKeys map deletes an item in nested merging int list",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMap:
- name: foo
- mergingIntList:
- - 1
- - 2
- - 3
-`),
- Current: []byte(`
-retainKeysMap:
- name: foo
- mergingIntList:
- - 1
- - 2
- - 3
- - 4
-`),
- Modified: []byte(`
-retainKeysMap:
- name: foo
- mergingIntList:
- - 1
- - 3
-`),
- TwoWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - mergingIntList
- - name
- $deleteFromPrimitiveList/mergingIntList:
- - 2
- $setElementOrder/mergingIntList:
- - 1
- - 3
-`),
- ThreeWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - mergingIntList
- - name
- $deleteFromPrimitiveList/mergingIntList:
- - 2
- $setElementOrder/mergingIntList:
- - 1
- - 3
-`),
- Result: []byte(`
-retainKeysMap:
- name: foo
- mergingIntList:
- - 1
- - 3
- - 4
-`),
- },
- },
- {
- Description: "retainKeys map adds an item and deletes an item in nested merging int list",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMap:
- name: foo
- mergingIntList:
- - 1
- - 2
- - 3
-`),
- Current: []byte(`
-retainKeysMap:
- name: foo
- mergingIntList:
- - 1
- - 2
- - 3
- - 4
-`),
- Modified: []byte(`
-retainKeysMap:
- name: foo
- mergingIntList:
- - 1
- - 3
- - 5
-`),
- TwoWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - mergingIntList
- - name
- mergingIntList:
- - 5
- $deleteFromPrimitiveList/mergingIntList:
- - 2
- $setElementOrder/mergingIntList:
- - 1
- - 3
- - 5
-`),
- ThreeWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - mergingIntList
- - name
- mergingIntList:
- - 5
- $deleteFromPrimitiveList/mergingIntList:
- - 2
- $setElementOrder/mergingIntList:
- - 1
- - 3
- - 5
-`),
- Result: []byte(`
-retainKeysMap:
- name: foo
- mergingIntList:
- - 1
- - 3
- - 5
- - 4
-`),
- },
- },
- {
- Description: "retainKeys map deletes nested merging int list",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMap:
- name: foo
- mergingIntList:
- - 1
- - 2
- - 3
-`),
- Current: []byte(`
-retainKeysMap:
- name: foo
- mergingIntList:
- - 1
- - 2
- - 3
-`),
- Modified: []byte(`
-retainKeysMap:
- name: foo
-`),
- TwoWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- mergingIntList: null
-`),
- ThreeWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- mergingIntList: null
-`),
- Result: []byte(`
-retainKeysMap:
- name: foo
-`),
- },
- },
- {
- Description: "retainKeys map nested merging list with no change",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMap:
- name: foo
- mergingList:
- - name: a
- - name: b
-`),
- Current: []byte(`
-retainKeysMap:
- name: foo
- mergingList:
- - name: a
- - name: b
- - name: c
-`),
- Modified: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- mergingList:
- - name: a
- - name: b
-`),
- TwoWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - mergingList
- - name
- - value
- value: bar
-`),
- ThreeWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - mergingList
- - name
- - value
- $setElementOrder/mergingList:
- - name: a
- - name: b
- value: bar
-`),
- Result: []byte(`
-retainKeysMap:
- name: foo
- value: bar
- mergingList:
- - name: a
- - name: b
- - name: c
-`),
- },
- },
- {
- Description: "retainKeys map adds an item in nested merging list",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMap:
- name: foo
- mergingList:
- - name: a
- - name: b
-`),
- Current: []byte(`
-retainKeysMap:
- name: foo
- mergingList:
- - name: a
- - name: b
- - name: x
-`),
- Modified: []byte(`
-retainKeysMap:
- name: foo
- mergingList:
- - name: a
- - name: b
- - name: c
-`),
- TwoWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - mergingList
- - name
- $setElementOrder/mergingList:
- - name: a
- - name: b
- - name: c
- mergingList:
- - name: c
-`),
- ThreeWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - mergingList
- - name
- $setElementOrder/mergingList:
- - name: a
- - name: b
- - name: c
- mergingList:
- - name: c
-`),
- Result: []byte(`
-retainKeysMap:
- name: foo
- mergingList:
- - name: a
- - name: b
- - name: c
- - name: x
-`),
- },
- },
- {
- Description: "retainKeys map changes an item in nested merging list",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMap:
- name: foo
- mergingList:
- - name: a
- - name: b
- value: foo
-`),
- Current: []byte(`
-retainKeysMap:
- name: foo
- mergingList:
- - name: a
- - name: b
- value: foo
- - name: x
-`),
- Modified: []byte(`
-retainKeysMap:
- name: foo
- mergingList:
- - name: a
- - name: b
- value: bar
-`),
- TwoWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - mergingList
- - name
- $setElementOrder/mergingList:
- - name: a
- - name: b
- mergingList:
- - name: b
- value: bar
-`),
- ThreeWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - mergingList
- - name
- $setElementOrder/mergingList:
- - name: a
- - name: b
- mergingList:
- - name: b
- value: bar
-`),
- Result: []byte(`
-retainKeysMap:
- name: foo
- mergingList:
- - name: a
- - name: b
- value: bar
- - name: x
-`),
- },
- },
- {
- Description: "retainKeys map deletes nested merging list",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMap:
- name: foo
- mergingList:
- - name: a
- - name: b
-`),
- Current: []byte(`
-retainKeysMap:
- name: foo
- mergingList:
- - name: a
- - name: b
-`),
- Modified: []byte(`
-retainKeysMap:
- name: foo
- value: bar
-`),
- TwoWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- - value
- value: bar
- mergingList: null
-`),
- ThreeWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - name
- - value
- value: bar
- mergingList: null
-`),
- Result: []byte(`
-retainKeysMap:
- name: foo
- value: bar
-`),
- },
- },
- {
- Description: "retainKeys map deletes an item in nested merging list",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMap:
- name: foo
- mergingList:
- - name: a
- - name: b
-`),
- Current: []byte(`
-retainKeysMap:
- name: foo
- mergingList:
- - name: a
- - name: b
- - name: x
-`),
- Modified: []byte(`
-retainKeysMap:
- name: foo
- mergingList:
- - name: a
-`),
- TwoWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - mergingList
- - name
- $setElementOrder/mergingList:
- - name: a
- mergingList:
- - name: b
- $patch: delete
-`),
- ThreeWay: []byte(`
-retainKeysMap:
- $retainKeys:
- - mergingList
- - name
- $setElementOrder/mergingList:
- - name: a
- mergingList:
- - name: b
- $patch: delete
-`),
- Result: []byte(`
-retainKeysMap:
- name: foo
- mergingList:
- - name: a
- - name: x
-`),
- },
- },
- {
- Description: "retainKeys list of maps clears a field",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
- value: a
-`),
- Current: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
- value: a
- other: x
-`),
- Modified: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
- value: a
-`),
- TwoWay: []byte(`{}`),
- ThreeWay: []byte(`
-$setElementOrder/retainKeysMergingList:
- - name: bar
- - name: foo
-retainKeysMergingList:
-- $retainKeys:
- - name
- - value
- name: foo
-`),
- Result: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
- value: a
-`),
- },
- },
- {
- Description: "retainKeys list of maps clears a field with conflict",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
- value: old
-`),
- Current: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
- value: new
- other: x
-`),
- Modified: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
- value: modified
-`),
- TwoWay: []byte(`
-$setElementOrder/retainKeysMergingList:
- - name: bar
- - name: foo
-retainKeysMergingList:
-- $retainKeys:
- - name
- - value
- name: foo
- value: modified
-`),
- ThreeWay: []byte(`
-$setElementOrder/retainKeysMergingList:
- - name: bar
- - name: foo
-retainKeysMergingList:
-- $retainKeys:
- - name
- - value
- name: foo
- value: modified
-`),
- Result: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
- value: modified
-`),
- },
- },
- {
- Description: "retainKeys list of maps changes a field and clear a field",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
- value: old
-`),
- Current: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
- value: old
- other: x
-`),
- Modified: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
- value: new
-`),
- TwoWay: []byte(`
-$setElementOrder/retainKeysMergingList:
- - name: bar
- - name: foo
-retainKeysMergingList:
-- $retainKeys:
- - name
- - value
- name: foo
- value: new
-`),
- ThreeWay: []byte(`
-$setElementOrder/retainKeysMergingList:
- - name: bar
- - name: foo
-retainKeysMergingList:
-- $retainKeys:
- - name
- - value
- name: foo
- value: new
-`),
- Result: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
- value: new
-`),
- },
- },
- {
- Description: "retainKeys list of maps changes a field and clear a field with conflict",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
- value: old
-`),
- Current: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
- value: modified
- other: x
-`),
- Modified: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
- value: new
-`),
- TwoWay: []byte(`
-$setElementOrder/retainKeysMergingList:
- - name: bar
- - name: foo
-retainKeysMergingList:
-- $retainKeys:
- - name
- - value
- name: foo
- value: new
-`),
- ThreeWay: []byte(`
-$setElementOrder/retainKeysMergingList:
- - name: bar
- - name: foo
-retainKeysMergingList:
-- $retainKeys:
- - name
- - value
- name: foo
- value: new
-`),
- Result: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
- value: new
-`),
- },
- },
- {
- Description: "retainKeys list of maps adds a field",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
-`),
- Current: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
-`),
- Modified: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
- value: a
-`),
- TwoWay: []byte(`
-$setElementOrder/retainKeysMergingList:
- - name: bar
- - name: foo
-retainKeysMergingList:
-- $retainKeys:
- - name
- - value
- name: foo
- value: a
-`),
- ThreeWay: []byte(`
-$setElementOrder/retainKeysMergingList:
- - name: bar
- - name: foo
-retainKeysMergingList:
-- $retainKeys:
- - name
- - value
- name: foo
- value: a
-`),
- Result: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
- value: a
-`),
- },
- },
- {
- Description: "retainKeys list of maps adds a field and clear a field",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
-`),
- Current: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
- other: x
-`),
- Modified: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
- value: a
-`),
- TwoWay: []byte(`
-$setElementOrder/retainKeysMergingList:
- - name: bar
- - name: foo
-retainKeysMergingList:
-- $retainKeys:
- - name
- - value
- name: foo
- value: a
-`),
- ThreeWay: []byte(`
-$setElementOrder/retainKeysMergingList:
- - name: bar
- - name: foo
-retainKeysMergingList:
-- $retainKeys:
- - name
- - value
- name: foo
- value: a
-`),
- Result: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
- value: a
-`),
- },
- },
- {
- Description: "retainKeys list of maps deletes a field",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
- value: a
-`),
- Current: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
- value: a
-`),
- Modified: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
-`),
- TwoWay: []byte(`
-$setElementOrder/retainKeysMergingList:
- - name: bar
- - name: foo
-retainKeysMergingList:
-- $retainKeys:
- - name
- name: foo
- value: null
-`),
- ThreeWay: []byte(`
-$setElementOrder/retainKeysMergingList:
- - name: bar
- - name: foo
-retainKeysMergingList:
-- $retainKeys:
- - name
- name: foo
- value: null
-`),
- Result: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
-`),
- },
- },
- {
- Description: "retainKeys list of maps deletes a field and clear a field",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
- value: a
-`),
- Current: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
- value: a
- other: x
-`),
- Modified: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
-`),
- TwoWay: []byte(`
-$setElementOrder/retainKeysMergingList:
- - name: bar
- - name: foo
-retainKeysMergingList:
-- $retainKeys:
- - name
- name: foo
- value: null
-`),
- ThreeWay: []byte(`
-$setElementOrder/retainKeysMergingList:
- - name: bar
- - name: foo
-retainKeysMergingList:
-- $retainKeys:
- - name
- name: foo
- value: null
-`),
- Result: []byte(`
-retainKeysMergingList:
-- name: bar
-- name: foo
-`),
- },
- },
- {
- Description: "delete and reorder in one list, reorder in another",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-mergingList:
-- name: a
- value: a
-- name: b
- value: b
-mergeItemPtr:
-- name: c
- value: c
-- name: d
- value: d
-`),
- Current: []byte(`
-mergingList:
-- name: a
- value: a
-- name: b
- value: b
-mergeItemPtr:
-- name: c
- value: c
-- name: d
- value: d
-`),
- Modified: []byte(`
-mergingList:
-- name: b
- value: b
-mergeItemPtr:
-- name: d
- value: d
-- name: c
- value: c
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
-- name: b
-$setElementOrder/mergeItemPtr:
-- name: d
-- name: c
-mergingList:
-- $patch: delete
- name: a
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
-- name: b
-$setElementOrder/mergeItemPtr:
-- name: d
-- name: c
-mergingList:
-- $patch: delete
- name: a
-`),
- Result: []byte(`
-mergingList:
-- name: b
- value: b
-mergeItemPtr:
-- name: d
- value: d
-- name: c
- value: c
-`),
- },
- },
-}
-
-func TestStrategicMergePatch(t *testing.T) {
- testStrategicMergePatchWithCustomArgumentsUsingStruct(t, "bad struct",
- "{}", "{}", []byte("<THIS IS NOT A STRUCT>"), mergepatch.ErrBadArgKind(struct{}{}, []byte{}))
-
- mergeItemOpenapiSchema := PatchMetaFromOpenAPI{
- Schema: sptest.GetSchemaOrDie(fakeMergeItemSchema, "mergeItem"),
- }
- schemas := []LookupPatchMeta{
- mergeItemStructSchema,
- mergeItemOpenapiSchema,
- }
-
- tc := StrategicMergePatchTestCases{}
- err := yaml.Unmarshal(createStrategicMergePatchTestCaseData, &tc)
- if err != nil {
- t.Errorf("can't unmarshal test cases: %s\n", err)
- return
- }
-
- for _, schema := range schemas {
- testStrategicMergePatchWithCustomArguments(t, "bad original",
- "<THIS IS NOT JSON>", "{}", schema, mergepatch.ErrBadJSONDoc)
- testStrategicMergePatchWithCustomArguments(t, "bad patch",
- "{}", "<THIS IS NOT JSON>", schema, mergepatch.ErrBadJSONDoc)
- testStrategicMergePatchWithCustomArguments(t, "nil struct",
- "{}", "{}", nil, mergepatch.ErrBadArgKind(struct{}{}, nil))
-
- for _, c := range tc.TestCases {
- testTwoWayPatch(t, c, schema)
- testThreeWayPatch(t, c, schema)
- }
-
- // run multiple times to exercise different map traversal orders
- for i := 0; i < 10; i++ {
- for _, c := range strategicMergePatchRawTestCases {
- testTwoWayPatchForRawTestCase(t, c, schema)
- testThreeWayPatchForRawTestCase(t, c, schema)
- }
- }
- }
-}
-
-func testStrategicMergePatchWithCustomArgumentsUsingStruct(t *testing.T, description, original, patch string, dataStruct interface{}, expected error) {
- schema, actual := NewPatchMetaFromStruct(dataStruct)
- // If actual is not nil, check error. If errors match, return.
- if actual != nil {
- checkErrorsEqual(t, description, expected, actual, schema)
- return
- }
- testStrategicMergePatchWithCustomArguments(t, description, original, patch, schema, expected)
-}
-
-func testStrategicMergePatchWithCustomArguments(t *testing.T, description, original, patch string, schema LookupPatchMeta, expected error) {
- _, actual := StrategicMergePatch([]byte(original), []byte(patch), schema)
- checkErrorsEqual(t, description, expected, actual, schema)
-}
-
-func checkErrorsEqual(t *testing.T, description string, expected, actual error, schema LookupPatchMeta) {
- if actual != expected {
- if actual == nil {
- t.Errorf("using %s expected error: %s\ndid not occur in test case: %s", getSchemaType(schema), expected, description)
- return
- }
-
- if expected == nil || actual.Error() != expected.Error() {
- t.Errorf("using %s unexpected error: %s\noccurred in test case: %s", getSchemaType(schema), actual, description)
- return
- }
- }
-}
-
-func testTwoWayPatch(t *testing.T, c StrategicMergePatchTestCase, schema LookupPatchMeta) {
- original, expectedPatch, modified, expectedResult := twoWayTestCaseToJSONOrFail(t, c, schema)
-
- actualPatch, err := CreateTwoWayMergePatchUsingLookupPatchMeta(original, modified, schema)
- if err != nil {
- t.Errorf("using %s error: %s\nin test case: %s\ncannot create two way patch: %s:\n%s\n",
- getSchemaType(schema), err, c.Description, original, mergepatch.ToYAMLOrError(c.StrategicMergePatchTestCaseData))
- return
- }
-
- testPatchCreation(t, expectedPatch, actualPatch, c.Description)
- testPatchApplication(t, original, actualPatch, expectedResult, c.Description, "", schema)
-}
-
-func testTwoWayPatchForRawTestCase(t *testing.T, c StrategicMergePatchRawTestCase, schema LookupPatchMeta) {
- original, expectedPatch, modified, expectedResult := twoWayRawTestCaseToJSONOrFail(t, c)
-
- actualPatch, err := CreateTwoWayMergePatchUsingLookupPatchMeta(original, modified, schema)
- if err != nil {
- t.Errorf("error: %s\nin test case: %s\ncannot create two way patch:\noriginal:%s\ntwoWay:%s\nmodified:%s\ncurrent:%s\nthreeWay:%s\nresult:%s\n",
- err, c.Description, c.Original, c.TwoWay, c.Modified, c.Current, c.ThreeWay, c.Result)
- return
- }
-
- testPatchCreation(t, expectedPatch, actualPatch, c.Description)
- testPatchApplication(t, original, actualPatch, expectedResult, c.Description, c.ExpectedError, schema)
-}
-
-func twoWayTestCaseToJSONOrFail(t *testing.T, c StrategicMergePatchTestCase, schema LookupPatchMeta) ([]byte, []byte, []byte, []byte) {
- expectedResult := c.TwoWayResult
- if expectedResult == nil {
- expectedResult = c.Modified
- }
- return sortJsonOrFail(t, testObjectToJSONOrFail(t, c.Original), c.Description, schema),
- sortJsonOrFail(t, testObjectToJSONOrFail(t, c.TwoWay), c.Description, schema),
- sortJsonOrFail(t, testObjectToJSONOrFail(t, c.Modified), c.Description, schema),
- sortJsonOrFail(t, testObjectToJSONOrFail(t, expectedResult), c.Description, schema)
-}
-
-func twoWayRawTestCaseToJSONOrFail(t *testing.T, c StrategicMergePatchRawTestCase) ([]byte, []byte, []byte, []byte) {
- expectedResult := c.TwoWayResult
- if expectedResult == nil {
- expectedResult = c.Modified
- }
- return yamlToJSONOrError(t, c.Original),
- yamlToJSONOrError(t, c.TwoWay),
- yamlToJSONOrError(t, c.Modified),
- yamlToJSONOrError(t, expectedResult)
-}
-
-func testThreeWayPatch(t *testing.T, c StrategicMergePatchTestCase, schema LookupPatchMeta) {
- original, modified, current, expected, result := threeWayTestCaseToJSONOrFail(t, c, schema)
- actual, err := CreateThreeWayMergePatch(original, modified, current, schema, false)
- if err != nil {
- if !mergepatch.IsConflict(err) {
- t.Errorf("using %s error: %s\nin test case: %s\ncannot create three way patch:\n%s\n",
- getSchemaType(schema), err, c.Description, mergepatch.ToYAMLOrError(c.StrategicMergePatchTestCaseData))
- return
- }
-
- if !strings.Contains(c.Description, "conflict") {
- t.Errorf("using %s unexpected conflict: %s\nin test case: %s\ncannot create three way patch:\n%s\n",
- getSchemaType(schema), err, c.Description, mergepatch.ToYAMLOrError(c.StrategicMergePatchTestCaseData))
- return
- }
-
- if len(c.Result) > 0 {
- actual, err := CreateThreeWayMergePatch(original, modified, current, schema, true)
- if err != nil {
- t.Errorf("using %s error: %s\nin test case: %s\ncannot force three way patch application:\n%s\n",
- getSchemaType(schema), err, c.Description, mergepatch.ToYAMLOrError(c.StrategicMergePatchTestCaseData))
- return
- }
-
- testPatchCreation(t, expected, actual, c.Description)
- testPatchApplication(t, current, actual, result, c.Description, "", schema)
- }
-
- return
- }
-
- if strings.Contains(c.Description, "conflict") || len(c.Result) < 1 {
- t.Errorf("using %s error in test case: %s\nexpected conflict did not occur:\n%s\n",
- getSchemaType(schema), c.Description, mergepatch.ToYAMLOrError(c.StrategicMergePatchTestCaseData))
- return
- }
-
- testPatchCreation(t, expected, actual, c.Description)
- testPatchApplication(t, current, actual, result, c.Description, "", schema)
-}
-
-func testThreeWayPatchForRawTestCase(t *testing.T, c StrategicMergePatchRawTestCase, schema LookupPatchMeta) {
- original, modified, current, expected, result := threeWayRawTestCaseToJSONOrFail(t, c)
- actual, err := CreateThreeWayMergePatch(original, modified, current, schema, false)
- if err != nil {
- if !mergepatch.IsConflict(err) {
- t.Errorf("using %s error: %s\nin test case: %s\ncannot create three way patch:\noriginal:%s\ntwoWay:%s\nmodified:%s\ncurrent:%s\nthreeWay:%s\nresult:%s\n",
- getSchemaType(schema), err, c.Description, c.Original, c.TwoWay, c.Modified, c.Current, c.ThreeWay, c.Result)
- return
- }
-
- if !strings.Contains(c.Description, "conflict") {
- t.Errorf("using %s unexpected conflict: %s\nin test case: %s\ncannot create three way patch:\noriginal:%s\ntwoWay:%s\nmodified:%s\ncurrent:%s\nthreeWay:%s\nresult:%s\n",
- getSchemaType(schema), err, c.Description, c.Original, c.TwoWay, c.Modified, c.Current, c.ThreeWay, c.Result)
- return
- }
-
- if len(c.Result) > 0 {
- actual, err := CreateThreeWayMergePatch(original, modified, current, schema, true)
- if err != nil {
- t.Errorf("using %s error: %s\nin test case: %s\ncannot force three way patch application:\noriginal:%s\ntwoWay:%s\nmodified:%s\ncurrent:%s\nthreeWay:%s\nresult:%s\n",
- getSchemaType(schema), err, c.Description, c.Original, c.TwoWay, c.Modified, c.Current, c.ThreeWay, c.Result)
- return
- }
-
- testPatchCreation(t, expected, actual, c.Description)
- testPatchApplication(t, current, actual, result, c.Description, c.ExpectedError, schema)
- }
-
- return
- }
-
- if strings.Contains(c.Description, "conflict") || len(c.Result) < 1 {
- t.Errorf("using %s error: %s\nin test case: %s\nexpected conflict did not occur:\noriginal:%s\ntwoWay:%s\nmodified:%s\ncurrent:%s\nthreeWay:%s\nresult:%s\n",
- getSchemaType(schema), err, c.Description, c.Original, c.TwoWay, c.Modified, c.Current, c.ThreeWay, c.Result)
- return
- }
-
- testPatchCreation(t, expected, actual, c.Description)
- testPatchApplication(t, current, actual, result, c.Description, c.ExpectedError, schema)
-}
-
-func threeWayTestCaseToJSONOrFail(t *testing.T, c StrategicMergePatchTestCase, schema LookupPatchMeta) ([]byte, []byte, []byte, []byte, []byte) {
- return sortJsonOrFail(t, testObjectToJSONOrFail(t, c.Original), c.Description, schema),
- sortJsonOrFail(t, testObjectToJSONOrFail(t, c.Modified), c.Description, schema),
- sortJsonOrFail(t, testObjectToJSONOrFail(t, c.Current), c.Description, schema),
- sortJsonOrFail(t, testObjectToJSONOrFail(t, c.ThreeWay), c.Description, schema),
- sortJsonOrFail(t, testObjectToJSONOrFail(t, c.Result), c.Description, schema)
-}
-
-func threeWayRawTestCaseToJSONOrFail(t *testing.T, c StrategicMergePatchRawTestCase) ([]byte, []byte, []byte, []byte, []byte) {
- return yamlToJSONOrError(t, c.Original),
- yamlToJSONOrError(t, c.Modified),
- yamlToJSONOrError(t, c.Current),
- yamlToJSONOrError(t, c.ThreeWay),
- yamlToJSONOrError(t, c.Result)
-}
-
-func testPatchCreation(t *testing.T, expected, actual []byte, description string) {
- if !reflect.DeepEqual(actual, expected) {
- t.Errorf("error in test case: %s\nexpected patch:\n%s\ngot:\n%s\n",
- description, jsonToYAMLOrError(expected), jsonToYAMLOrError(actual))
- return
- }
-}
-
-func testPatchApplication(t *testing.T, original, patch, expected []byte, description, expectedError string, schema LookupPatchMeta) {
- result, err := StrategicMergePatchUsingLookupPatchMeta(original, patch, schema)
- if len(expectedError) != 0 {
- if err != nil && strings.Contains(err.Error(), expectedError) {
- return
- }
- t.Errorf("using %s expected error should contain:\n%s\nin test case: %s\nbut got:\n%s\n", getSchemaType(schema), expectedError, description, err)
- }
- if err != nil {
- t.Errorf("using %s error: %s\nin test case: %s\ncannot apply patch:\n%s\nto original:\n%s\n",
- getSchemaType(schema), err, description, jsonToYAMLOrError(patch), jsonToYAMLOrError(original))
- return
- }
-
- if !reflect.DeepEqual(result, expected) {
- format := "using error in test case: %s\npatch application failed:\noriginal:\n%s\npatch:\n%s\nexpected:\n%s\ngot:\n%s\n"
- t.Errorf(format, description,
- jsonToYAMLOrError(original), jsonToYAMLOrError(patch),
- jsonToYAMLOrError(expected), jsonToYAMLOrError(result))
- return
- }
-}
-
-func testObjectToJSONOrFail(t *testing.T, o map[string]interface{}) []byte {
- if o == nil {
- return nil
- }
-
- j, err := toJSON(o)
- if err != nil {
- t.Error(err)
- }
- return j
-}
-
-func sortJsonOrFail(t *testing.T, j []byte, description string, schema LookupPatchMeta) []byte {
- if j == nil {
- return nil
- }
- r, err := sortMergeListsByName(j, schema)
- if err != nil {
- t.Errorf("using %s error: %s\n in test case: %s\ncannot sort object:\n%s\n", getSchemaType(schema), err, description, j)
- return nil
- }
-
- return r
-}
-
-func getSchemaType(schema LookupPatchMeta) string {
- return reflect.TypeOf(schema).String()
-}
-
-func jsonToYAMLOrError(j []byte) string {
- y, err := jsonToYAML(j)
- if err != nil {
- return err.Error()
- }
-
- return string(y)
-}
-
-func toJSON(v interface{}) ([]byte, error) {
- j, err := json.Marshal(v)
- if err != nil {
- return nil, fmt.Errorf("json marshal failed: %v\n%v\n", err, spew.Sdump(v))
- }
-
- return j, nil
-}
-
-func jsonToYAML(j []byte) ([]byte, error) {
- y, err := yaml.JSONToYAML(j)
- if err != nil {
- return nil, fmt.Errorf("json to yaml failed: %v\n%v\n", err, j)
- }
-
- return y, nil
-}
-
-func yamlToJSON(y []byte) ([]byte, error) {
- j, err := yaml.YAMLToJSON(y)
- if err != nil {
- return nil, fmt.Errorf("yaml to json failed: %v\n%v\n", err, y)
- }
-
- return j, nil
-}
-
-func yamlToJSONOrError(t *testing.T, y []byte) []byte {
- j, err := yamlToJSON(y)
- if err != nil {
- t.Errorf("%v", err)
- }
-
- return j
-}
-
-type PrecisionItem struct {
- Name string `json:"name,omitempty"`
- Int32 int32 `json:"int32,omitempty"`
- Int64 int64 `json:"int64,omitempty"`
- Float32 float32 `json:"float32,omitempty"`
- Float64 float64 `json:"float64,omitempty"`
-}
-
-var (
- precisionItem PrecisionItem
- precisionItemStructSchema = PatchMetaFromStruct{T: GetTagStructTypeOrDie(precisionItem)}
-)
-
-func TestNumberConversion(t *testing.T) {
- testcases := map[string]struct {
- Old string
- New string
- ExpectedPatch string
- ExpectedResult string
- }{
- "empty": {
- Old: `{}`,
- New: `{}`,
- ExpectedPatch: `{}`,
- ExpectedResult: `{}`,
- },
- "int32 medium": {
- Old: `{"int32":1000000}`,
- New: `{"int32":1000000,"name":"newname"}`,
- ExpectedPatch: `{"name":"newname"}`,
- ExpectedResult: `{"int32":1000000,"name":"newname"}`,
- },
- "int32 max": {
- Old: `{"int32":2147483647}`,
- New: `{"int32":2147483647,"name":"newname"}`,
- ExpectedPatch: `{"name":"newname"}`,
- ExpectedResult: `{"int32":2147483647,"name":"newname"}`,
- },
- "int64 medium": {
- Old: `{"int64":1000000}`,
- New: `{"int64":1000000,"name":"newname"}`,
- ExpectedPatch: `{"name":"newname"}`,
- ExpectedResult: `{"int64":1000000,"name":"newname"}`,
- },
- "int64 max": {
- Old: `{"int64":9223372036854775807}`,
- New: `{"int64":9223372036854775807,"name":"newname"}`,
- ExpectedPatch: `{"name":"newname"}`,
- ExpectedResult: `{"int64":9223372036854775807,"name":"newname"}`,
- },
- "float32 max": {
- Old: `{"float32":3.4028234663852886e+38}`,
- New: `{"float32":3.4028234663852886e+38,"name":"newname"}`,
- ExpectedPatch: `{"name":"newname"}`,
- ExpectedResult: `{"float32":3.4028234663852886e+38,"name":"newname"}`,
- },
- "float64 max": {
- Old: `{"float64":1.7976931348623157e+308}`,
- New: `{"float64":1.7976931348623157e+308,"name":"newname"}`,
- ExpectedPatch: `{"name":"newname"}`,
- ExpectedResult: `{"float64":1.7976931348623157e+308,"name":"newname"}`,
- },
- }
-
- precisionItemOpenapiSchema := PatchMetaFromOpenAPI{
- Schema: sptest.GetSchemaOrDie(fakePrecisionItemSchema, "precisionItem"),
- }
- precisionItemSchemas := []LookupPatchMeta{
- precisionItemStructSchema,
- precisionItemOpenapiSchema,
- }
-
- for _, schema := range precisionItemSchemas {
- for k, tc := range testcases {
- patch, err := CreateTwoWayMergePatchUsingLookupPatchMeta([]byte(tc.Old), []byte(tc.New), schema)
- if err != nil {
- t.Errorf("using %s in testcase %s: unexpected error %v", getSchemaType(schema), k, err)
- continue
- }
- if tc.ExpectedPatch != string(patch) {
- t.Errorf("using %s in testcase %s: expected %s, got %s", getSchemaType(schema), k, tc.ExpectedPatch, string(patch))
- continue
- }
-
- result, err := StrategicMergePatchUsingLookupPatchMeta([]byte(tc.Old), patch, schema)
- if err != nil {
- t.Errorf("using %s in testcase %s: unexpected error %v", getSchemaType(schema), k, err)
- continue
- }
- if tc.ExpectedResult != string(result) {
- t.Errorf("using %s in testcase %s: expected %s, got %s", getSchemaType(schema), k, tc.ExpectedResult, string(result))
- continue
- }
- }
- }
-}
-
-var replaceRawExtensionPatchTestCases = []StrategicMergePatchRawTestCase{
- {
- Description: "replace RawExtension field, rest unchanched",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-name: my-object
-value: some-value
-other: current-other
-replacingItem:
- Some: Generic
- Yaml: Inside
- The: RawExtension
- Field: Period
-`),
- Current: []byte(`
-name: my-object
-value: some-value
-other: current-other
-mergingList:
- - name: 1
- - name: 2
- - name: 3
-replacingItem:
- Some: Generic
- Yaml: Inside
- The: RawExtension
- Field: Period
-`),
- Modified: []byte(`
-name: my-object
-value: some-value
-other: current-other
-mergingList:
- - name: 1
- - name: 2
- - name: 3
-replacingItem:
- Newly: Modified
- Yaml: Inside
- The: RawExtension
-`),
- TwoWay: []byte(`
-mergingList:
- - name: 1
- - name: 2
- - name: 3
-replacingItem:
- Newly: Modified
- Yaml: Inside
- The: RawExtension
-`),
- TwoWayResult: []byte(`
-name: my-object
-value: some-value
-other: current-other
-mergingList:
- - name: 1
- - name: 2
- - name: 3
-replacingItem:
- Newly: Modified
- Yaml: Inside
- The: RawExtension
-`),
- ThreeWay: []byte(`
-replacingItem:
- Newly: Modified
- Yaml: Inside
- The: RawExtension
-`),
- Result: []byte(`
-name: my-object
-value: some-value
-other: current-other
-mergingList:
- - name: 1
- - name: 2
- - name: 3
-replacingItem:
- Newly: Modified
- Yaml: Inside
- The: RawExtension
-`),
- },
- },
- {
- Description: "replace RawExtension field and merge list",
- StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
- Original: []byte(`
-name: my-object
-value: some-value
-other: current-other
-mergingList:
- - name: 1
-replacingItem:
- Some: Generic
- Yaml: Inside
- The: RawExtension
- Field: Period
-`),
- Current: []byte(`
-name: my-object
-value: some-value
-other: current-other
-mergingList:
- - name: 1
- - name: 3
-replacingItem:
- Some: Generic
- Yaml: Inside
- The: RawExtension
- Field: Period
-`),
- Modified: []byte(`
-name: my-object
-value: some-value
-other: current-other
-mergingList:
- - name: 1
- - name: 2
-replacingItem:
- Newly: Modified
- Yaml: Inside
- The: RawExtension
-`),
- TwoWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 2
-replacingItem:
- Newly: Modified
- Yaml: Inside
- The: RawExtension
-`),
- TwoWayResult: []byte(`
-name: my-object
-value: some-value
-other: current-other
-mergingList:
- - name: 1
- - name: 2
-replacingItem:
- Newly: Modified
- Yaml: Inside
- The: RawExtension
-`),
- ThreeWay: []byte(`
-$setElementOrder/mergingList:
- - name: 1
- - name: 2
-mergingList:
- - name: 2
-replacingItem:
- Newly: Modified
- Yaml: Inside
- The: RawExtension
-`),
- Result: []byte(`
-name: my-object
-value: some-value
-other: current-other
-mergingList:
- - name: 1
- - name: 2
- - name: 3
-replacingItem:
- Newly: Modified
- Yaml: Inside
- The: RawExtension
-`),
- },
- },
-}
-
-func TestReplaceWithRawExtension(t *testing.T) {
- mergeItemOpenapiSchema := PatchMetaFromOpenAPI{
- Schema: sptest.GetSchemaOrDie(fakeMergeItemSchema, "mergeItem"),
- }
- schemas := []LookupPatchMeta{
- mergeItemStructSchema,
- mergeItemOpenapiSchema,
- }
-
- for _, schema := range schemas {
- for _, c := range replaceRawExtensionPatchTestCases {
- testTwoWayPatchForRawTestCase(t, c, schema)
- testThreeWayPatchForRawTestCase(t, c, schema)
- }
- }
-}
-
-func TestUnknownField(t *testing.T) {
- testcases := map[string]struct {
- Original string
- Current string
- Modified string
-
- ExpectedTwoWay string
- ExpectedTwoWayErr string
- ExpectedTwoWayResult string
- ExpectedThreeWay string
- ExpectedThreeWayErr string
- ExpectedThreeWayResult string
- }{
- // cases we can successfully strategically merge
- "no diff": {
- Original: `{"array":[1,2,3],"complex":{"nested":true},"name":"foo","scalar":true}`,
- Current: `{"array":[1,2,3],"complex":{"nested":true},"name":"foo","scalar":true}`,
- Modified: `{"array":[1,2,3],"complex":{"nested":true},"name":"foo","scalar":true}`,
-
- ExpectedTwoWay: `{}`,
- ExpectedTwoWayResult: `{"array":[1,2,3],"complex":{"nested":true},"name":"foo","scalar":true}`,
- ExpectedThreeWay: `{}`,
- ExpectedThreeWayResult: `{"array":[1,2,3],"complex":{"nested":true},"name":"foo","scalar":true}`,
- },
- "added only": {
- Original: `{"name":"foo"}`,
- Current: `{"name":"foo"}`,
- Modified: `{"name":"foo","scalar":true,"complex":{"nested":true},"array":[1,2,3]}`,
-
- ExpectedTwoWay: `{"array":[1,2,3],"complex":{"nested":true},"scalar":true}`,
- ExpectedTwoWayResult: `{"array":[1,2,3],"complex":{"nested":true},"name":"foo","scalar":true}`,
- ExpectedThreeWay: `{"array":[1,2,3],"complex":{"nested":true},"scalar":true}`,
- ExpectedThreeWayResult: `{"array":[1,2,3],"complex":{"nested":true},"name":"foo","scalar":true}`,
- },
- "removed only": {
- Original: `{"name":"foo","scalar":true,"complex":{"nested":true}}`,
- Current: `{"name":"foo","scalar":true,"complex":{"nested":true},"array":[1,2,3]}`,
- Modified: `{"name":"foo"}`,
-
- ExpectedTwoWay: `{"complex":null,"scalar":null}`,
- ExpectedTwoWayResult: `{"name":"foo"}`,
- ExpectedThreeWay: `{"complex":null,"scalar":null}`,
- ExpectedThreeWayResult: `{"array":[1,2,3],"name":"foo"}`,
- },
-
- // cases we cannot successfully strategically merge (expect errors)
- "diff": {
- Original: `{"array":[1,2,3],"complex":{"nested":true},"name":"foo","scalar":true}`,
- Current: `{"array":[1,2,3],"complex":{"nested":true},"name":"foo","scalar":true}`,
- Modified: `{"array":[1,2,3],"complex":{"nested":false},"name":"foo","scalar":true}`,
-
- ExpectedTwoWayErr: `unable to find api field`,
- ExpectedThreeWayErr: `unable to find api field`,
- },
- }
-
- mergeItemOpenapiSchema := PatchMetaFromOpenAPI{
- Schema: sptest.GetSchemaOrDie(fakeMergeItemSchema, "mergeItem"),
- }
- schemas := []LookupPatchMeta{
- mergeItemStructSchema,
- mergeItemOpenapiSchema,
- }
-
- for _, k := range sets.StringKeySet(testcases).List() {
- tc := testcases[k]
- for _, schema := range schemas {
- func() {
- twoWay, err := CreateTwoWayMergePatchUsingLookupPatchMeta([]byte(tc.Original), []byte(tc.Modified), schema)
- if err != nil {
- if len(tc.ExpectedTwoWayErr) == 0 {
- t.Errorf("using %s in testcase %s: error making two-way patch: %v", getSchemaType(schema), k, err)
- }
- if !strings.Contains(err.Error(), tc.ExpectedTwoWayErr) {
- t.Errorf("using %s in testcase %s: expected error making two-way patch to contain '%s', got %s", getSchemaType(schema), k, tc.ExpectedTwoWayErr, err)
- }
- return
- }
-
- if string(twoWay) != tc.ExpectedTwoWay {
- t.Errorf("using %s in testcase %s: expected two-way patch:\n\t%s\ngot\n\t%s", getSchemaType(schema), k, string(tc.ExpectedTwoWay), string(twoWay))
- return
- }
-
- twoWayResult, err := StrategicMergePatchUsingLookupPatchMeta([]byte(tc.Original), twoWay, schema)
- if err != nil {
- t.Errorf("using %s in testcase %s: error applying two-way patch: %v", getSchemaType(schema), k, err)
- return
- }
- if string(twoWayResult) != tc.ExpectedTwoWayResult {
- t.Errorf("using %s in testcase %s: expected two-way result:\n\t%s\ngot\n\t%s", getSchemaType(schema), k, string(tc.ExpectedTwoWayResult), string(twoWayResult))
- return
- }
- }()
-
- func() {
- threeWay, err := CreateThreeWayMergePatch([]byte(tc.Original), []byte(tc.Modified), []byte(tc.Current), schema, false)
- if err != nil {
- if len(tc.ExpectedThreeWayErr) == 0 {
- t.Errorf("using %s in testcase %s: error making three-way patch: %v", getSchemaType(schema), k, err)
- } else if !strings.Contains(err.Error(), tc.ExpectedThreeWayErr) {
- t.Errorf("using %s in testcase %s: expected error making three-way patch to contain '%s', got %s", getSchemaType(schema), k, tc.ExpectedThreeWayErr, err)
- }
- return
- }
-
- if string(threeWay) != tc.ExpectedThreeWay {
- t.Errorf("using %s in testcase %s: expected three-way patch:\n\t%s\ngot\n\t%s", getSchemaType(schema), k, string(tc.ExpectedThreeWay), string(threeWay))
- return
- }
-
- threeWayResult, err := StrategicMergePatch([]byte(tc.Current), threeWay, schema)
- if err != nil {
- t.Errorf("using %s in testcase %s: error applying three-way patch: %v", getSchemaType(schema), k, err)
- return
- } else if string(threeWayResult) != tc.ExpectedThreeWayResult {
- t.Errorf("using %s in testcase %s: expected three-way result:\n\t%s\ngot\n\t%s", getSchemaType(schema), k, string(tc.ExpectedThreeWayResult), string(threeWayResult))
- return
- }
- }()
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/validation/field/errors_test.go b/vendor/k8s.io/apimachinery/pkg/util/validation/field/errors_test.go
deleted file mode 100644
index fe747319b..000000000
--- a/vendor/k8s.io/apimachinery/pkg/util/validation/field/errors_test.go
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package field
-
-import (
- "fmt"
- "strings"
- "testing"
-)
-
-func TestMakeFuncs(t *testing.T) {
- testCases := []struct {
- fn func() *Error
- expected ErrorType
- }{
- {
- func() *Error { return Invalid(NewPath("f"), "v", "d") },
- ErrorTypeInvalid,
- },
- {
- func() *Error { return NotSupported(NewPath("f"), "v", nil) },
- ErrorTypeNotSupported,
- },
- {
- func() *Error { return Duplicate(NewPath("f"), "v") },
- ErrorTypeDuplicate,
- },
- {
- func() *Error { return NotFound(NewPath("f"), "v") },
- ErrorTypeNotFound,
- },
- {
- func() *Error { return Required(NewPath("f"), "d") },
- ErrorTypeRequired,
- },
- {
- func() *Error { return InternalError(NewPath("f"), fmt.Errorf("e")) },
- ErrorTypeInternal,
- },
- }
-
- for _, testCase := range testCases {
- err := testCase.fn()
- if err.Type != testCase.expected {
- t.Errorf("expected Type %q, got %q", testCase.expected, err.Type)
- }
- }
-}
-
-func TestErrorUsefulMessage(t *testing.T) {
- {
- s := Invalid(nil, nil, "").Error()
- t.Logf("message: %v", s)
- if !strings.Contains(s, "null") {
- t.Errorf("error message did not contain 'null': %s", s)
- }
- }
-
- s := Invalid(NewPath("foo"), "bar", "deet").Error()
- t.Logf("message: %v", s)
- for _, part := range []string{"foo", "bar", "deet", ErrorTypeInvalid.String()} {
- if !strings.Contains(s, part) {
- t.Errorf("error message did not contain expected part '%v'", part)
- }
- }
-
- type complicated struct {
- Baz int
- Qux string
- Inner interface{}
- KV map[string]int
- }
- s = Invalid(
- NewPath("foo"),
- &complicated{
- Baz: 1,
- Qux: "aoeu",
- Inner: &complicated{Qux: "asdf"},
- KV: map[string]int{"Billy": 2},
- },
- "detail",
- ).Error()
- t.Logf("message: %v", s)
- for _, part := range []string{
- "foo", ErrorTypeInvalid.String(),
- "Baz", "Qux", "Inner", "KV", "detail",
- "1", "aoeu", "Billy", "2",
- // "asdf", TODO: re-enable once we have a better nested printer
- } {
- if !strings.Contains(s, part) {
- t.Errorf("error message did not contain expected part '%v'", part)
- }
- }
-}
-
-func TestToAggregate(t *testing.T) {
- testCases := struct {
- ErrList []ErrorList
- NumExpectedErrs []int
- }{
- []ErrorList{
- nil,
- {},
- {Invalid(NewPath("f"), "v", "d")},
- {Invalid(NewPath("f"), "v", "d"), Invalid(NewPath("f"), "v", "d")},
- {Invalid(NewPath("f"), "v", "d"), InternalError(NewPath(""), fmt.Errorf("e"))},
- },
- []int{
- 0,
- 0,
- 1,
- 1,
- 2,
- },
- }
-
- if len(testCases.ErrList) != len(testCases.NumExpectedErrs) {
- t.Errorf("Mismatch: length of NumExpectedErrs does not match length of ErrList")
- }
- for i, tc := range testCases.ErrList {
- agg := tc.ToAggregate()
- numErrs := 0
-
- if agg != nil {
- numErrs = len(agg.Errors())
- }
- if numErrs != testCases.NumExpectedErrs[i] {
- t.Errorf("[%d] Expected %d, got %d", i, testCases.NumExpectedErrs[i], numErrs)
- }
-
- if len(tc) == 0 {
- if agg != nil {
- t.Errorf("[%d] Expected nil, got %#v", i, agg)
- }
- } else if agg == nil {
- t.Errorf("[%d] Expected non-nil", i)
- }
- }
-}
-
-func TestErrListFilter(t *testing.T) {
- list := ErrorList{
- Invalid(NewPath("test.field"), "", ""),
- Invalid(NewPath("field.test"), "", ""),
- Duplicate(NewPath("test"), "value"),
- }
- if len(list.Filter(NewErrorTypeMatcher(ErrorTypeDuplicate))) != 2 {
- t.Errorf("should not filter")
- }
- if len(list.Filter(NewErrorTypeMatcher(ErrorTypeInvalid))) != 1 {
- t.Errorf("should filter")
- }
-}
-
-func TestNotSupported(t *testing.T) {
- notSupported := NotSupported(NewPath("f"), "v", []string{"a", "b", "c"})
- expected := `Unsupported value: "v": supported values: "a", "b", "c"`
- if notSupported.ErrorBody() != expected {
- t.Errorf("Expected: %s\n, but got: %s\n", expected, notSupported.ErrorBody())
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/validation/field/path_test.go b/vendor/k8s.io/apimachinery/pkg/util/validation/field/path_test.go
deleted file mode 100644
index d2f568c36..000000000
--- a/vendor/k8s.io/apimachinery/pkg/util/validation/field/path_test.go
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
-Copyright 2015 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package field
-
-import "testing"
-
-func TestPath(t *testing.T) {
- testCases := []struct {
- op func(*Path) *Path
- expected string
- }{
- {
- func(p *Path) *Path { return p },
- "root",
- },
- {
- func(p *Path) *Path { return p.Child("first") },
- "root.first",
- },
- {
- func(p *Path) *Path { return p.Child("second") },
- "root.first.second",
- },
- {
- func(p *Path) *Path { return p.Index(0) },
- "root.first.second[0]",
- },
- {
- func(p *Path) *Path { return p.Child("third") },
- "root.first.second[0].third",
- },
- {
- func(p *Path) *Path { return p.Index(93) },
- "root.first.second[0].third[93]",
- },
- {
- func(p *Path) *Path { return p.parent },
- "root.first.second[0].third",
- },
- {
- func(p *Path) *Path { return p.parent },
- "root.first.second[0]",
- },
- {
- func(p *Path) *Path { return p.Key("key") },
- "root.first.second[0][key]",
- },
- }
-
- root := NewPath("root")
- p := root
- for i, tc := range testCases {
- p = tc.op(p)
- if p.String() != tc.expected {
- t.Errorf("[%d] Expected %q, got %q", i, tc.expected, p.String())
- }
- if p.Root() != root {
- t.Errorf("[%d] Wrong root: %#v", i, p.Root())
- }
- }
-}
-
-func TestPathMultiArg(t *testing.T) {
- testCases := []struct {
- op func(*Path) *Path
- expected string
- }{
- {
- func(p *Path) *Path { return p },
- "root.first",
- },
- {
- func(p *Path) *Path { return p.Child("second", "third") },
- "root.first.second.third",
- },
- {
- func(p *Path) *Path { return p.Index(0) },
- "root.first.second.third[0]",
- },
- {
- func(p *Path) *Path { return p.parent },
- "root.first.second.third",
- },
- {
- func(p *Path) *Path { return p.parent },
- "root.first.second",
- },
- {
- func(p *Path) *Path { return p.parent },
- "root.first",
- },
- {
- func(p *Path) *Path { return p.parent },
- "root",
- },
- }
-
- root := NewPath("root", "first")
- p := root
- for i, tc := range testCases {
- p = tc.op(p)
- if p.String() != tc.expected {
- t.Errorf("[%d] Expected %q, got %q", i, tc.expected, p.String())
- }
- if p.Root() != root.Root() {
- t.Errorf("[%d] Wrong root: %#v", i, p.Root())
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/validation/validation_test.go b/vendor/k8s.io/apimachinery/pkg/util/validation/validation_test.go
deleted file mode 100644
index 4c628bbc4..000000000
--- a/vendor/k8s.io/apimachinery/pkg/util/validation/validation_test.go
+++ /dev/null
@@ -1,513 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package validation
-
-import (
- "strings"
- "testing"
-
- "k8s.io/apimachinery/pkg/util/validation/field"
-)
-
-func TestIsDNS1123Label(t *testing.T) {
- goodValues := []string{
- "a", "ab", "abc", "a1", "a-1", "a--1--2--b",
- "0", "01", "012", "1a", "1-a", "1--a--b--2",
- strings.Repeat("a", 63),
- }
- for _, val := range goodValues {
- if msgs := IsDNS1123Label(val); len(msgs) != 0 {
- t.Errorf("expected true for '%s': %v", val, msgs)
- }
- }
-
- badValues := []string{
- "", "A", "ABC", "aBc", "A1", "A-1", "1-A",
- "-", "a-", "-a", "1-", "-1",
- "_", "a_", "_a", "a_b", "1_", "_1", "1_2",
- ".", "a.", ".a", "a.b", "1.", ".1", "1.2",
- " ", "a ", " a", "a b", "1 ", " 1", "1 2",
- strings.Repeat("a", 64),
- }
- for _, val := range badValues {
- if msgs := IsDNS1123Label(val); len(msgs) == 0 {
- t.Errorf("expected false for '%s'", val)
- }
- }
-}
-
-func TestIsDNS1123Subdomain(t *testing.T) {
- goodValues := []string{
- "a", "ab", "abc", "a1", "a-1", "a--1--2--b",
- "0", "01", "012", "1a", "1-a", "1--a--b--2",
- "a.a", "ab.a", "abc.a", "a1.a", "a-1.a", "a--1--2--b.a",
- "a.1", "ab.1", "abc.1", "a1.1", "a-1.1", "a--1--2--b.1",
- "0.a", "01.a", "012.a", "1a.a", "1-a.a", "1--a--b--2",
- "0.1", "01.1", "012.1", "1a.1", "1-a.1", "1--a--b--2.1",
- "a.b.c.d.e", "aa.bb.cc.dd.ee", "1.2.3.4.5", "11.22.33.44.55",
- strings.Repeat("a", 253),
- }
- for _, val := range goodValues {
- if msgs := IsDNS1123Subdomain(val); len(msgs) != 0 {
- t.Errorf("expected true for '%s': %v", val, msgs)
- }
- }
-
- badValues := []string{
- "", "A", "ABC", "aBc", "A1", "A-1", "1-A",
- "-", "a-", "-a", "1-", "-1",
- "_", "a_", "_a", "a_b", "1_", "_1", "1_2",
- ".", "a.", ".a", "a..b", "1.", ".1", "1..2",
- " ", "a ", " a", "a b", "1 ", " 1", "1 2",
- "A.a", "aB.a", "ab.A", "A1.a", "a1.A",
- "A.1", "aB.1", "A1.1", "1A.1",
- "0.A", "01.A", "012.A", "1A.a", "1a.A",
- "A.B.C.D.E", "AA.BB.CC.DD.EE", "a.B.c.d.e", "aa.bB.cc.dd.ee",
- "a@b", "a,b", "a_b", "a;b",
- "a:b", "a%b", "a?b", "a$b",
- strings.Repeat("a", 254),
- }
- for _, val := range badValues {
- if msgs := IsDNS1123Subdomain(val); len(msgs) == 0 {
- t.Errorf("expected false for '%s'", val)
- }
- }
-}
-
-func TestIsDNS1035Label(t *testing.T) {
- goodValues := []string{
- "a", "ab", "abc", "a1", "a-1", "a--1--2--b",
- strings.Repeat("a", 63),
- }
- for _, val := range goodValues {
- if msgs := IsDNS1035Label(val); len(msgs) != 0 {
- t.Errorf("expected true for '%s': %v", val, msgs)
- }
- }
-
- badValues := []string{
- "0", "01", "012", "1a", "1-a", "1--a--b--2",
- "", "A", "ABC", "aBc", "A1", "A-1", "1-A",
- "-", "a-", "-a", "1-", "-1",
- "_", "a_", "_a", "a_b", "1_", "_1", "1_2",
- ".", "a.", ".a", "a.b", "1.", ".1", "1.2",
- " ", "a ", " a", "a b", "1 ", " 1", "1 2",
- strings.Repeat("a", 64),
- }
- for _, val := range badValues {
- if msgs := IsDNS1035Label(val); len(msgs) == 0 {
- t.Errorf("expected false for '%s'", val)
- }
- }
-}
-
-func TestIsCIdentifier(t *testing.T) {
- goodValues := []string{
- "a", "ab", "abc", "a1", "_a", "a_", "a_b", "a_1", "a__1__2__b", "__abc_123",
- "A", "AB", "AbC", "A1", "_A", "A_", "A_B", "A_1", "A__1__2__B", "__123_ABC",
- }
- for _, val := range goodValues {
- if msgs := IsCIdentifier(val); len(msgs) != 0 {
- t.Errorf("expected true for '%s': %v", val, msgs)
- }
- }
-
- badValues := []string{
- "", "1", "123", "1a",
- "-", "a-", "-a", "1-", "-1", "1_", "1_2",
- ".", "a.", ".a", "a.b", "1.", ".1", "1.2",
- " ", "a ", " a", "a b", "1 ", " 1", "1 2",
- "#a#",
- }
- for _, val := range badValues {
- if msgs := IsCIdentifier(val); len(msgs) == 0 {
- t.Errorf("expected false for '%s'", val)
- }
- }
-}
-
-func TestIsValidPortNum(t *testing.T) {
- goodValues := []int{1, 2, 1000, 16384, 32768, 65535}
- for _, val := range goodValues {
- if msgs := IsValidPortNum(val); len(msgs) != 0 {
- t.Errorf("expected true for %d, got %v", val, msgs)
- }
- }
-
- badValues := []int{0, -1, 65536, 100000}
- for _, val := range badValues {
- if msgs := IsValidPortNum(val); len(msgs) == 0 {
- t.Errorf("expected false for %d", val)
- }
- }
-}
-
-func TestIsInRange(t *testing.T) {
- goodValues := []struct {
- value int
- min int
- max int
- }{{1, 0, 10}, {5, 5, 20}, {25, 10, 25}}
- for _, val := range goodValues {
- if msgs := IsInRange(val.value, val.min, val.max); len(msgs) > 0 {
- t.Errorf("expected no errors for %#v, but got %v", val, msgs)
- }
- }
-
- badValues := []struct {
- value int
- min int
- max int
- }{{1, 2, 10}, {5, -4, 2}, {25, 100, 120}}
- for _, val := range badValues {
- if msgs := IsInRange(val.value, val.min, val.max); len(msgs) == 0 {
- t.Errorf("expected errors for %#v", val)
- }
- }
-}
-
-func createGroupIDs(ids ...int64) []int64 {
- var output []int64
- for _, id := range ids {
- output = append(output, int64(id))
- }
- return output
-}
-
-func createUserIDs(ids ...int64) []int64 {
- var output []int64
- for _, id := range ids {
- output = append(output, int64(id))
- }
- return output
-}
-
-func TestIsValidGroupID(t *testing.T) {
- goodValues := createGroupIDs(0, 1, 1000, 65535, 2147483647)
- for _, val := range goodValues {
- if msgs := IsValidGroupID(val); len(msgs) != 0 {
- t.Errorf("expected true for '%d': %v", val, msgs)
- }
- }
-
- badValues := createGroupIDs(-1, -1003, 2147483648, 4147483647)
- for _, val := range badValues {
- if msgs := IsValidGroupID(val); len(msgs) == 0 {
- t.Errorf("expected false for '%d'", val)
- }
- }
-}
-
-func TestIsValidUserID(t *testing.T) {
- goodValues := createUserIDs(0, 1, 1000, 65535, 2147483647)
- for _, val := range goodValues {
- if msgs := IsValidUserID(val); len(msgs) != 0 {
- t.Errorf("expected true for '%d': %v", val, msgs)
- }
- }
-
- badValues := createUserIDs(-1, -1003, 2147483648, 4147483647)
- for _, val := range badValues {
- if msgs := IsValidUserID(val); len(msgs) == 0 {
- t.Errorf("expected false for '%d'", val)
- }
- }
-}
-
-func TestIsValidPortName(t *testing.T) {
- goodValues := []string{"telnet", "re-mail-ck", "pop3", "a", "a-1", "1-a", "a-1-b-2-c", "1-a-2-b-3"}
- for _, val := range goodValues {
- if msgs := IsValidPortName(val); len(msgs) != 0 {
- t.Errorf("expected true for %q: %v", val, msgs)
- }
- }
-
- badValues := []string{"longerthan15characters", "", strings.Repeat("a", 16), "12345", "1-2-3-4", "-begin", "end-", "two--hyphens", "whois++"}
- for _, val := range badValues {
- if msgs := IsValidPortName(val); len(msgs) == 0 {
- t.Errorf("expected false for %q", val)
- }
- }
-}
-
-func TestIsQualifiedName(t *testing.T) {
- successCases := []string{
- "simple",
- "now-with-dashes",
- "1-starts-with-num",
- "1234",
- "simple/simple",
- "now-with-dashes/simple",
- "now-with-dashes/now-with-dashes",
- "now.with.dots/simple",
- "now-with.dashes-and.dots/simple",
- "1-num.2-num/3-num",
- "1234/5678",
- "1.2.3.4/5678",
- "Uppercase_Is_OK_123",
- "example.com/Uppercase_Is_OK_123",
- "requests.storage-foo",
- strings.Repeat("a", 63),
- strings.Repeat("a", 253) + "/" + strings.Repeat("b", 63),
- }
- for i := range successCases {
- if errs := IsQualifiedName(successCases[i]); len(errs) != 0 {
- t.Errorf("case[%d]: %q: expected success: %v", i, successCases[i], errs)
- }
- }
-
- errorCases := []string{
- "nospecialchars%^=@",
- "cantendwithadash-",
- "-cantstartwithadash-",
- "only/one/slash",
- "Example.com/abc",
- "example_com/abc",
- "example.com/",
- "/simple",
- strings.Repeat("a", 64),
- strings.Repeat("a", 254) + "/abc",
- }
- for i := range errorCases {
- if errs := IsQualifiedName(errorCases[i]); len(errs) == 0 {
- t.Errorf("case[%d]: %q: expected failure", i, errorCases[i])
- }
- }
-}
-
-func TestIsValidLabelValue(t *testing.T) {
- successCases := []string{
- "simple",
- "now-with-dashes",
- "1-starts-with-num",
- "end-with-num-1",
- "1234", // only num
- strings.Repeat("a", 63), // to the limit
- "", // empty value
- }
- for i := range successCases {
- if errs := IsValidLabelValue(successCases[i]); len(errs) != 0 {
- t.Errorf("case %s expected success: %v", successCases[i], errs)
- }
- }
-
- errorCases := []string{
- "nospecialchars%^=@",
- "Tama-nui-te-rā.is.Māori.sun",
- "\\backslashes\\are\\bad",
- "-starts-with-dash",
- "ends-with-dash-",
- ".starts.with.dot",
- "ends.with.dot.",
- strings.Repeat("a", 64), // over the limit
- }
- for i := range errorCases {
- if errs := IsValidLabelValue(errorCases[i]); len(errs) == 0 {
- t.Errorf("case[%d] expected failure", i)
- }
- }
-}
-
-func TestIsValidIP(t *testing.T) {
- goodValues := []string{
- "::1",
- "2a00:79e0:2:0:f1c3:e797:93c1:df80",
- "::",
- "2001:4860:4860::8888",
- "::fff:1.1.1.1",
- "1.1.1.1",
- "1.1.1.01",
- "255.0.0.1",
- "1.0.0.0",
- "0.0.0.0",
- }
- for _, val := range goodValues {
- if msgs := IsValidIP(val); len(msgs) != 0 {
- t.Errorf("expected true for %q: %v", val, msgs)
- }
- }
-
- badValues := []string{
- "[2001:db8:0:1]:80",
- "myhost.mydomain",
- "-1.0.0.0",
- "[2001:db8:0:1]",
- "a",
- }
- for _, val := range badValues {
- if msgs := IsValidIP(val); len(msgs) == 0 {
- t.Errorf("expected false for %q", val)
- }
- }
-}
-
-func TestIsHTTPHeaderName(t *testing.T) {
- goodValues := []string{
- // Common ones
- "Accept-Encoding", "Host", "If-Modified-Since", "X-Forwarded-For",
- // Weirdo, but still conforming names
- "a", "ab", "abc", "a1", "-a", "a-", "a-b", "a-1", "a--1--2--b", "--abc-123",
- "A", "AB", "AbC", "A1", "-A", "A-", "A-B", "A-1", "A--1--2--B", "--123-ABC",
- }
- for _, val := range goodValues {
- if msgs := IsHTTPHeaderName(val); len(msgs) != 0 {
- t.Errorf("expected true for '%s': %v", val, msgs)
- }
- }
-
- badValues := []string{
- "Host:", "X-Forwarded-For:", "X-@Home",
- "", "_", "a_", "_a", "1_", "1_2", ".", "a.", ".a", "a.b", "1.", ".1", "1.2",
- " ", "a ", " a", "a b", "1 ", " 1", "1 2", "#a#", "^", ",", ";", "=", "<",
- "?", "@", "{",
- }
- for _, val := range badValues {
- if msgs := IsHTTPHeaderName(val); len(msgs) == 0 {
- t.Errorf("expected false for '%s'", val)
- }
- }
-}
-
-func TestIsValidPercent(t *testing.T) {
- goodValues := []string{
- "0%",
- "00000%",
- "1%",
- "01%",
- "99%",
- "100%",
- "101%",
- }
- for _, val := range goodValues {
- if msgs := IsValidPercent(val); len(msgs) != 0 {
- t.Errorf("expected true for %q: %v", val, msgs)
- }
- }
-
- badValues := []string{
- "",
- "0",
- "100",
- "0.0%",
- "99.9%",
- "hundred",
- " 1%",
- "1% ",
- "-0%",
- "-1%",
- "+1%",
- }
- for _, val := range badValues {
- if msgs := IsValidPercent(val); len(msgs) == 0 {
- t.Errorf("expected false for %q", val)
- }
- }
-}
-
-func TestIsConfigMapKey(t *testing.T) {
- successCases := []string{
- "a",
- "good",
- "good-good",
- "still.good",
- "this.is.also.good",
- ".so.is.this",
- "THIS_IS_GOOD",
- "so_is_this_17",
- }
-
- for i := range successCases {
- if errs := IsConfigMapKey(successCases[i]); len(errs) != 0 {
- t.Errorf("[%d] expected success: %v", i, errs)
- }
- }
-
- failureCases := []string{
- ".",
- "..",
- "..bad",
- "b*d",
- "bad!&bad",
- }
-
- for i := range failureCases {
- if errs := IsConfigMapKey(failureCases[i]); len(errs) == 0 {
- t.Errorf("[%d] expected failure", i)
- }
- }
-}
-
-func TestIsWildcardDNS1123Subdomain(t *testing.T) {
- goodValues := []string{
- "*.example.com",
- "*.bar.com",
- "*.foo.bar.com",
- }
- for _, val := range goodValues {
- if errs := IsWildcardDNS1123Subdomain(val); len(errs) != 0 {
- t.Errorf("expected no errors for %q: %v", val, errs)
- }
- }
-
- badValues := []string{
- "*.*.bar.com",
- "*.foo.*.com",
- "*bar.com",
- "f*.bar.com",
- "*",
- }
- for _, val := range badValues {
- if errs := IsWildcardDNS1123Subdomain(val); len(errs) == 0 {
- t.Errorf("expected errors for %q", val)
- }
- }
-}
-
-func TestIsFullyQualifiedName(t *testing.T) {
- tests := []struct {
- name string
- targetName string
- err string
- }{
- {
- name: "name needs to be fully qualified, i.e., contains at least 2 dots",
- targetName: "k8s.io",
- err: "should be a domain with at least three segments separated by dots",
- },
- {
- name: "name cannot be empty",
- targetName: "",
- err: "Required value",
- },
- {
- name: "name must conform to RFC 1123",
- targetName: "A.B.C",
- err: "a DNS-1123 subdomain must consist of lower case alphanumeric characters",
- },
- }
- for _, tc := range tests {
- err := IsFullyQualifiedName(field.NewPath(""), tc.targetName).ToAggregate()
- switch {
- case tc.err == "" && err != nil:
- t.Errorf("%q: unexpected error: %v", tc.name, err)
- case tc.err != "" && err == nil:
- t.Errorf("%q: unexpected no error, expected %s", tc.name, tc.err)
- case tc.err != "" && err != nil && !strings.Contains(err.Error(), tc.err):
- t.Errorf("%q: expected %s, got %v", tc.name, tc.err, err)
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/wait/wait_test.go b/vendor/k8s.io/apimachinery/pkg/util/wait/wait_test.go
deleted file mode 100644
index 2dfd28777..000000000
--- a/vendor/k8s.io/apimachinery/pkg/util/wait/wait_test.go
+++ /dev/null
@@ -1,501 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package wait
-
-import (
- "errors"
- "fmt"
- "sync"
- "sync/atomic"
- "testing"
- "time"
-
- "k8s.io/apimachinery/pkg/util/runtime"
-)
-
-func TestUntil(t *testing.T) {
- ch := make(chan struct{})
- close(ch)
- Until(func() {
- t.Fatal("should not have been invoked")
- }, 0, ch)
-
- ch = make(chan struct{})
- called := make(chan struct{})
- go func() {
- Until(func() {
- called <- struct{}{}
- }, 0, ch)
- close(called)
- }()
- <-called
- close(ch)
- <-called
-}
-
-func TestNonSlidingUntil(t *testing.T) {
- ch := make(chan struct{})
- close(ch)
- NonSlidingUntil(func() {
- t.Fatal("should not have been invoked")
- }, 0, ch)
-
- ch = make(chan struct{})
- called := make(chan struct{})
- go func() {
- NonSlidingUntil(func() {
- called <- struct{}{}
- }, 0, ch)
- close(called)
- }()
- <-called
- close(ch)
- <-called
-}
-
-func TestUntilReturnsImmediately(t *testing.T) {
- now := time.Now()
- ch := make(chan struct{})
- Until(func() {
- close(ch)
- }, 30*time.Second, ch)
- if now.Add(25 * time.Second).Before(time.Now()) {
- t.Errorf("Until did not return immediately when the stop chan was closed inside the func")
- }
-}
-
-func TestJitterUntil(t *testing.T) {
- ch := make(chan struct{})
- // if a channel is closed JitterUntil never calls function f
- // and returns immediately
- close(ch)
- JitterUntil(func() {
- t.Fatal("should not have been invoked")
- }, 0, 1.0, true, ch)
-
- ch = make(chan struct{})
- called := make(chan struct{})
- go func() {
- JitterUntil(func() {
- called <- struct{}{}
- }, 0, 1.0, true, ch)
- close(called)
- }()
- <-called
- close(ch)
- <-called
-}
-
-func TestJitterUntilReturnsImmediately(t *testing.T) {
- now := time.Now()
- ch := make(chan struct{})
- JitterUntil(func() {
- close(ch)
- }, 30*time.Second, 1.0, true, ch)
- if now.Add(25 * time.Second).Before(time.Now()) {
- t.Errorf("JitterUntil did not return immediately when the stop chan was closed inside the func")
- }
-}
-
-func TestJitterUntilRecoversPanic(t *testing.T) {
- // Save and restore crash handlers
- originalReallyCrash := runtime.ReallyCrash
- originalHandlers := runtime.PanicHandlers
- defer func() {
- runtime.ReallyCrash = originalReallyCrash
- runtime.PanicHandlers = originalHandlers
- }()
-
- called := 0
- handled := 0
-
- // Hook up a custom crash handler to ensure it is called when a jitter function panics
- runtime.ReallyCrash = false
- runtime.PanicHandlers = []func(interface{}){
- func(p interface{}) {
- handled++
- },
- }
-
- ch := make(chan struct{})
- JitterUntil(func() {
- called++
- if called > 2 {
- close(ch)
- return
- }
- panic("TestJitterUntilRecoversPanic")
- }, time.Millisecond, 1.0, true, ch)
-
- if called != 3 {
- t.Errorf("Expected panic recovers")
- }
-}
-
-func TestJitterUntilNegativeFactor(t *testing.T) {
- now := time.Now()
- ch := make(chan struct{})
- called := make(chan struct{})
- received := make(chan struct{})
- go func() {
- JitterUntil(func() {
- called <- struct{}{}
- <-received
- }, time.Second, -30.0, true, ch)
- }()
- // first loop
- <-called
- received <- struct{}{}
- // second loop
- <-called
- close(ch)
- received <- struct{}{}
-
- // it should take at most 2 seconds + some overhead, not 3
- if now.Add(3 * time.Second).Before(time.Now()) {
- t.Errorf("JitterUntil did not returned after predefined period with negative jitter factor when the stop chan was closed inside the func")
- }
-
-}
-
-func TestExponentialBackoff(t *testing.T) {
- opts := Backoff{Factor: 1.0, Steps: 3}
-
- // waits up to steps
- i := 0
- err := ExponentialBackoff(opts, func() (bool, error) {
- i++
- return false, nil
- })
- if err != ErrWaitTimeout || i != opts.Steps {
- t.Errorf("unexpected error: %v", err)
- }
-
- // returns immediately
- i = 0
- err = ExponentialBackoff(opts, func() (bool, error) {
- i++
- return true, nil
- })
- if err != nil || i != 1 {
- t.Errorf("unexpected error: %v", err)
- }
-
- // returns immediately on error
- testErr := fmt.Errorf("some other error")
- err = ExponentialBackoff(opts, func() (bool, error) {
- return false, testErr
- })
- if err != testErr {
- t.Errorf("unexpected error: %v", err)
- }
-
- // invoked multiple times
- i = 1
- err = ExponentialBackoff(opts, func() (bool, error) {
- if i < opts.Steps {
- i++
- return false, nil
- }
- return true, nil
- })
- if err != nil || i != opts.Steps {
- t.Errorf("unexpected error: %v", err)
- }
-}
-
-func TestPoller(t *testing.T) {
- done := make(chan struct{})
- defer close(done)
- w := poller(time.Millisecond, 2*time.Millisecond)
- ch := w(done)
- count := 0
-DRAIN:
- for {
- select {
- case _, open := <-ch:
- if !open {
- break DRAIN
- }
- count++
- case <-time.After(ForeverTestTimeout):
- t.Errorf("unexpected timeout after poll")
- }
- }
- if count > 3 {
- t.Errorf("expected up to three values, got %d", count)
- }
-}
-
-type fakePoller struct {
- max int
- used int32 // accessed with atomics
- wg sync.WaitGroup
-}
-
-func fakeTicker(max int, used *int32, doneFunc func()) WaitFunc {
- return func(done <-chan struct{}) <-chan struct{} {
- ch := make(chan struct{})
- go func() {
- defer doneFunc()
- defer close(ch)
- for i := 0; i < max; i++ {
- select {
- case ch <- struct{}{}:
- case <-done:
- return
- }
- if used != nil {
- atomic.AddInt32(used, 1)
- }
- }
- }()
- return ch
- }
-}
-
-func (fp *fakePoller) GetWaitFunc() WaitFunc {
- fp.wg.Add(1)
- return fakeTicker(fp.max, &fp.used, fp.wg.Done)
-}
-
-func TestPoll(t *testing.T) {
- invocations := 0
- f := ConditionFunc(func() (bool, error) {
- invocations++
- return true, nil
- })
- fp := fakePoller{max: 1}
- if err := pollInternal(fp.GetWaitFunc(), f); err != nil {
- t.Fatalf("unexpected error %v", err)
- }
- fp.wg.Wait()
- if invocations != 1 {
- t.Errorf("Expected exactly one invocation, got %d", invocations)
- }
- used := atomic.LoadInt32(&fp.used)
- if used != 1 {
- t.Errorf("Expected exactly one tick, got %d", used)
- }
-}
-
-func TestPollError(t *testing.T) {
- expectedError := errors.New("Expected error")
- f := ConditionFunc(func() (bool, error) {
- return false, expectedError
- })
- fp := fakePoller{max: 1}
- if err := pollInternal(fp.GetWaitFunc(), f); err == nil || err != expectedError {
- t.Fatalf("Expected error %v, got none %v", expectedError, err)
- }
- fp.wg.Wait()
- used := atomic.LoadInt32(&fp.used)
- if used != 1 {
- t.Errorf("Expected exactly one tick, got %d", used)
- }
-}
-
-func TestPollImmediate(t *testing.T) {
- invocations := 0
- f := ConditionFunc(func() (bool, error) {
- invocations++
- return true, nil
- })
- fp := fakePoller{max: 0}
- if err := pollImmediateInternal(fp.GetWaitFunc(), f); err != nil {
- t.Fatalf("unexpected error %v", err)
- }
- // We don't need to wait for fp.wg, as pollImmediate shouldn't call WaitFunc at all.
- if invocations != 1 {
- t.Errorf("Expected exactly one invocation, got %d", invocations)
- }
- used := atomic.LoadInt32(&fp.used)
- if used != 0 {
- t.Errorf("Expected exactly zero ticks, got %d", used)
- }
-}
-
-func TestPollImmediateError(t *testing.T) {
- expectedError := errors.New("Expected error")
- f := ConditionFunc(func() (bool, error) {
- return false, expectedError
- })
- fp := fakePoller{max: 0}
- if err := pollImmediateInternal(fp.GetWaitFunc(), f); err == nil || err != expectedError {
- t.Fatalf("Expected error %v, got none %v", expectedError, err)
- }
- // We don't need to wait for fp.wg, as pollImmediate shouldn't call WaitFunc at all.
- used := atomic.LoadInt32(&fp.used)
- if used != 0 {
- t.Errorf("Expected exactly zero ticks, got %d", used)
- }
-}
-
-func TestPollForever(t *testing.T) {
- ch := make(chan struct{})
- done := make(chan struct{}, 1)
- complete := make(chan struct{})
- go func() {
- f := ConditionFunc(func() (bool, error) {
- ch <- struct{}{}
- select {
- case <-done:
- return true, nil
- default:
- }
- return false, nil
- })
-
- if err := PollInfinite(time.Microsecond, f); err != nil {
- t.Fatalf("unexpected error %v", err)
- }
-
- close(ch)
- complete <- struct{}{}
- }()
-
- // ensure the condition is opened
- <-ch
-
- // ensure channel sends events
- for i := 0; i < 10; i++ {
- select {
- case _, open := <-ch:
- if !open {
- t.Fatalf("did not expect channel to be closed")
- }
- case <-time.After(ForeverTestTimeout):
- t.Fatalf("channel did not return at least once within the poll interval")
- }
- }
-
- // at most one poll notification should be sent once we return from the condition
- done <- struct{}{}
- go func() {
- for i := 0; i < 2; i++ {
- _, open := <-ch
- if !open {
- return
- }
- }
- t.Fatalf("expected closed channel after two iterations")
- }()
- <-complete
-}
-
-func TestWaitFor(t *testing.T) {
- var invocations int
- testCases := map[string]struct {
- F ConditionFunc
- Ticks int
- Invoked int
- Err bool
- }{
- "invoked once": {
- ConditionFunc(func() (bool, error) {
- invocations++
- return true, nil
- }),
- 2,
- 1,
- false,
- },
- "invoked and returns a timeout": {
- ConditionFunc(func() (bool, error) {
- invocations++
- return false, nil
- }),
- 2,
- 3, // the contract of WaitFor() says the func is called once more at the end of the wait
- true,
- },
- "returns immediately on error": {
- ConditionFunc(func() (bool, error) {
- invocations++
- return false, errors.New("test")
- }),
- 2,
- 1,
- true,
- },
- }
- for k, c := range testCases {
- invocations = 0
- ticker := fakeTicker(c.Ticks, nil, func() {})
- err := func() error {
- done := make(chan struct{})
- defer close(done)
- return WaitFor(ticker, c.F, done)
- }()
- switch {
- case c.Err && err == nil:
- t.Errorf("%s: Expected error, got nil", k)
- continue
- case !c.Err && err != nil:
- t.Errorf("%s: Expected no error, got: %#v", k, err)
- continue
- }
- if invocations != c.Invoked {
- t.Errorf("%s: Expected %d invocations, got %d", k, c.Invoked, invocations)
- }
- }
-}
-
-func TestWaitForWithDelay(t *testing.T) {
- done := make(chan struct{})
- defer close(done)
- WaitFor(poller(time.Millisecond, ForeverTestTimeout), func() (bool, error) {
- time.Sleep(10 * time.Millisecond)
- return true, nil
- }, done)
- // If polling goroutine doesn't see the done signal it will leak timers.
- select {
- case done <- struct{}{}:
- case <-time.After(ForeverTestTimeout):
- t.Errorf("expected an ack of the done signal.")
- }
-}
-
-func TestPollUntil(t *testing.T) {
- stopCh := make(chan struct{})
- called := make(chan bool)
- pollDone := make(chan struct{})
-
- go func() {
- PollUntil(time.Microsecond, ConditionFunc(func() (bool, error) {
- called <- true
- return false, nil
- }), stopCh)
-
- close(pollDone)
- }()
-
- // make sure we're called once
- <-called
- // this should trigger a "done"
- close(stopCh)
-
- go func() {
- // release the condition func if needed
- for {
- <-called
- }
- }()
-
- // make sure we finished the poll
- <-pollDone
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/yaml/decoder_test.go b/vendor/k8s.io/apimachinery/pkg/util/yaml/decoder_test.go
deleted file mode 100644
index 03e502ec6..000000000
--- a/vendor/k8s.io/apimachinery/pkg/util/yaml/decoder_test.go
+++ /dev/null
@@ -1,405 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package yaml
-
-import (
- "bufio"
- "bytes"
- "encoding/json"
- "fmt"
- "io"
- "io/ioutil"
- "math/rand"
- "reflect"
- "strings"
- "testing"
-)
-
-func TestYAMLDecoderReadBytesLength(t *testing.T) {
- d := `---
-stuff: 1
- test-foo: 1
-`
- testCases := []struct {
- bufLen int
- expectLen int
- expectErr error
- }{
- {len(d), len(d), nil},
- {len(d) + 10, len(d), nil},
- {len(d) - 10, len(d) - 10, io.ErrShortBuffer},
- }
-
- for i, testCase := range testCases {
- r := NewDocumentDecoder(ioutil.NopCloser(bytes.NewReader([]byte(d))))
- b := make([]byte, testCase.bufLen)
- n, err := r.Read(b)
- if err != testCase.expectErr || n != testCase.expectLen {
- t.Fatalf("%d: unexpected body: %d / %v", i, n, err)
- }
- }
-}
-
-func TestYAMLDecoderCallsAfterErrShortBufferRestOfFrame(t *testing.T) {
- d := `---
-stuff: 1
- test-foo: 1`
- r := NewDocumentDecoder(ioutil.NopCloser(bytes.NewReader([]byte(d))))
- b := make([]byte, 12)
- n, err := r.Read(b)
- if err != io.ErrShortBuffer || n != 12 {
- t.Fatalf("expected ErrShortBuffer: %d / %v", n, err)
- }
- expected := "---\nstuff: 1"
- if string(b) != expected {
- t.Fatalf("expected bytes read to be: %s got: %s", expected, string(b))
- }
- b = make([]byte, 13)
- n, err = r.Read(b)
- if err != nil || n != 13 {
- t.Fatalf("expected nil: %d / %v", n, err)
- }
- expected = "\n\ttest-foo: 1"
- if string(b) != expected {
- t.Fatalf("expected bytes read to be: '%s' got: '%s'", expected, string(b))
- }
- b = make([]byte, 15)
- n, err = r.Read(b)
- if err != io.EOF || n != 0 {
- t.Fatalf("expected EOF: %d / %v", n, err)
- }
-}
-
-func TestSplitYAMLDocument(t *testing.T) {
- testCases := []struct {
- input string
- atEOF bool
- expect string
- adv int
- }{
- {"foo", true, "foo", 3},
- {"fo", false, "", 0},
-
- {"---", true, "---", 3},
- {"---\n", true, "---\n", 4},
- {"---\n", false, "", 0},
-
- {"\n---\n", false, "", 5},
- {"\n---\n", true, "", 5},
-
- {"abc\n---\ndef", true, "abc", 8},
- {"def", true, "def", 3},
- {"", true, "", 0},
- }
- for i, testCase := range testCases {
- adv, token, err := splitYAMLDocument([]byte(testCase.input), testCase.atEOF)
- if err != nil {
- t.Errorf("%d: unexpected error: %v", i, err)
- continue
- }
- if adv != testCase.adv {
- t.Errorf("%d: advance did not match: %d %d", i, testCase.adv, adv)
- }
- if testCase.expect != string(token) {
- t.Errorf("%d: token did not match: %q %q", i, testCase.expect, string(token))
- }
- }
-}
-
-func TestGuessJSON(t *testing.T) {
- if r, _, isJSON := GuessJSONStream(bytes.NewReader([]byte(" \n{}")), 100); !isJSON {
- t.Fatalf("expected stream to be JSON")
- } else {
- b := make([]byte, 30)
- n, err := r.Read(b)
- if err != nil || n != 4 {
- t.Fatalf("unexpected body: %d / %v", n, err)
- }
- if string(b[:n]) != " \n{}" {
- t.Fatalf("unexpected body: %q", string(b[:n]))
- }
- }
-}
-
-func TestScanYAML(t *testing.T) {
- s := bufio.NewScanner(bytes.NewReader([]byte(`---
-stuff: 1
-
----
- `)))
- s.Split(splitYAMLDocument)
- if !s.Scan() {
- t.Fatalf("should have been able to scan")
- }
- t.Logf("scan: %s", s.Text())
- if !s.Scan() {
- t.Fatalf("should have been able to scan")
- }
- t.Logf("scan: %s", s.Text())
- if s.Scan() {
- t.Fatalf("scan should have been done")
- }
- if s.Err() != nil {
- t.Fatalf("err should have been nil: %v", s.Err())
- }
-}
-
-func TestDecodeYAML(t *testing.T) {
- s := NewYAMLToJSONDecoder(bytes.NewReader([]byte(`---
-stuff: 1
-
----
- `)))
- obj := generic{}
- if err := s.Decode(&obj); err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- if fmt.Sprintf("%#v", obj) != `yaml.generic{"stuff":1}` {
- t.Errorf("unexpected object: %#v", obj)
- }
- obj = generic{}
- if err := s.Decode(&obj); err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- if len(obj) != 0 {
- t.Fatalf("unexpected object: %#v", obj)
- }
- obj = generic{}
- if err := s.Decode(&obj); err != io.EOF {
- t.Fatalf("unexpected error: %v", err)
- }
-}
-
-func TestDecodeBrokenYAML(t *testing.T) {
- s := NewYAMLOrJSONDecoder(bytes.NewReader([]byte(`---
-stuff: 1
- test-foo: 1
-
----
- `)), 100)
- obj := generic{}
- err := s.Decode(&obj)
- if err == nil {
- t.Fatal("expected error with yaml: violate, got no error")
- }
- fmt.Printf("err: %s\n", err.Error())
- if !strings.Contains(err.Error(), "yaml: line 2:") {
- t.Fatalf("expected %q to have 'yaml: line 2:' found a tab character", err.Error())
- }
-}
-
-func TestDecodeBrokenJSON(t *testing.T) {
- s := NewYAMLOrJSONDecoder(bytes.NewReader([]byte(`{
- "foo": {
- "stuff": 1
- "otherStuff": 2
- }
-}
- `)), 100)
- obj := generic{}
- err := s.Decode(&obj)
- if err == nil {
- t.Fatal("expected error with json: prefix, got no error")
- }
- if !strings.HasPrefix(err.Error(), "json: line 3:") {
- t.Fatalf("expected %q to have 'json: line 3:' prefix", err.Error())
- }
-}
-
-type generic map[string]interface{}
-
-func TestYAMLOrJSONDecoder(t *testing.T) {
- testCases := []struct {
- input string
- buffer int
- isJSON bool
- err bool
- out []generic
- }{
- {` {"1":2}{"3":4}`, 2, true, false, []generic{
- {"1": 2},
- {"3": 4},
- }},
- {" \n{}", 3, true, false, []generic{
- {},
- }},
- {" \na: b", 2, false, false, []generic{
- {"a": "b"},
- }},
- {" \n{\"a\": \"b\"}", 2, false, true, []generic{
- {"a": "b"},
- }},
- {" \n{\"a\": \"b\"}", 3, true, false, []generic{
- {"a": "b"},
- }},
- {` {"a":"b"}`, 100, true, false, []generic{
- {"a": "b"},
- }},
- {"", 1, false, false, []generic{}},
- {"foo: bar\n---\nbaz: biz", 100, false, false, []generic{
- {"foo": "bar"},
- {"baz": "biz"},
- }},
- {"foo: bar\n---\n", 100, false, false, []generic{
- {"foo": "bar"},
- }},
- {"foo: bar\n---", 100, false, false, []generic{
- {"foo": "bar"},
- }},
- {"foo: bar\n--", 100, false, true, []generic{
- {"foo": "bar"},
- }},
- {"foo: bar\n-", 100, false, true, []generic{
- {"foo": "bar"},
- }},
- {"foo: bar\n", 100, false, false, []generic{
- {"foo": "bar"},
- }},
- }
- for i, testCase := range testCases {
- decoder := NewYAMLOrJSONDecoder(bytes.NewReader([]byte(testCase.input)), testCase.buffer)
- objs := []generic{}
-
- var err error
- for {
- out := make(generic)
- err = decoder.Decode(&out)
- if err != nil {
- break
- }
- objs = append(objs, out)
- }
- if err != io.EOF {
- switch {
- case testCase.err && err == nil:
- t.Errorf("%d: unexpected non-error", i)
- continue
- case !testCase.err && err != nil:
- t.Errorf("%d: unexpected error: %v", i, err)
- continue
- case err != nil:
- continue
- }
- }
- switch decoder.decoder.(type) {
- case *YAMLToJSONDecoder:
- if testCase.isJSON {
- t.Errorf("%d: expected JSON decoder, got YAML", i)
- }
- case *json.Decoder:
- if !testCase.isJSON {
- t.Errorf("%d: expected YAML decoder, got JSON", i)
- }
- }
- if fmt.Sprintf("%#v", testCase.out) != fmt.Sprintf("%#v", objs) {
- t.Errorf("%d: objects were not equal: \n%#v\n%#v", i, testCase.out, objs)
- }
- }
-}
-
-func TestReadSingleLongLine(t *testing.T) {
- testReadLines(t, []int{128 * 1024})
-}
-
-func TestReadRandomLineLengths(t *testing.T) {
- minLength := 100
- maxLength := 96 * 1024
- maxLines := 100
-
- lineLengths := make([]int, maxLines)
- for i := 0; i < maxLines; i++ {
- lineLengths[i] = rand.Intn(maxLength-minLength) + minLength
- }
-
- testReadLines(t, lineLengths)
-}
-
-func testReadLines(t *testing.T, lineLengths []int) {
- var (
- lines [][]byte
- inputStream []byte
- )
- for _, lineLength := range lineLengths {
- inputLine := make([]byte, lineLength+1)
- for i := 0; i < lineLength; i++ {
- char := rand.Intn('z'-'A') + 'A'
- inputLine[i] = byte(char)
- }
- inputLine[len(inputLine)-1] = '\n'
- lines = append(lines, inputLine)
- }
- for _, line := range lines {
- inputStream = append(inputStream, line...)
- }
-
- // init Reader
- reader := bufio.NewReader(bytes.NewReader(inputStream))
- lineReader := &LineReader{reader: reader}
-
- // read lines
- var readLines [][]byte
- for range lines {
- bytes, err := lineReader.Read()
- if err != nil && err != io.EOF {
- t.Fatalf("failed to read lines: %v", err)
- }
- readLines = append(readLines, bytes)
- }
-
- // validate
- for i := range lines {
- if len(lines[i]) != len(readLines[i]) {
- t.Fatalf("expected line length: %d, but got %d", len(lines[i]), len(readLines[i]))
- }
- if !reflect.DeepEqual(lines[i], readLines[i]) {
- t.Fatalf("expected line: %v, but got %v", lines[i], readLines[i])
- }
- }
-}
-
-func TestTypedJSONOrYamlErrors(t *testing.T) {
- s := NewYAMLOrJSONDecoder(bytes.NewReader([]byte(`{
- "foo": {
- "stuff": 1
- "otherStuff": 2
- }
-}
- `)), 100)
- obj := generic{}
- err := s.Decode(&obj)
- if err == nil {
- t.Fatal("expected error with json: prefix, got no error")
- }
- if _, ok := err.(JSONSyntaxError); !ok {
- t.Fatalf("expected %q to be of type JSONSyntaxError", err.Error())
- }
-
- s = NewYAMLOrJSONDecoder(bytes.NewReader([]byte(`---
-stuff: 1
- test-foo: 1
-
----
- `)), 100)
- obj = generic{}
- err = s.Decode(&obj)
- if err == nil {
- t.Fatal("expected error with yaml: prefix, got no error")
- }
- if _, ok := err.(YAMLSyntaxError); !ok {
- t.Fatalf("expected %q to be of type YAMLSyntaxError", err.Error())
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/version/helpers_test.go b/vendor/k8s.io/apimachinery/pkg/version/helpers_test.go
deleted file mode 100644
index 863a53697..000000000
--- a/vendor/k8s.io/apimachinery/pkg/version/helpers_test.go
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-Copyright 2018 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package version
-
-import (
- "testing"
-)
-
-func TestCompareKubeAwareVersionStrings(t *testing.T) {
- tests := []*struct {
- v1, v2 string
- expectedGreater bool
- }{
- {"v1", "v2", false},
- {"v2", "v1", true},
- {"v10", "v2", true},
- {"v1", "v2alpha1", true},
- {"v1", "v2beta1", true},
- {"v1alpha2", "v1alpha1", true},
- {"v1beta1", "v2alpha3", true},
- {"v1alpha10", "v1alpha2", true},
- {"v1beta10", "v1beta2", true},
- {"foo", "v1beta2", false},
- {"bar", "foo", true},
- {"version1", "version2", true}, // Non kube-like versions are sorted alphabetically
- {"version1", "version10", true}, // Non kube-like versions are sorted alphabetically
- }
-
- for _, tc := range tests {
- if e, a := tc.expectedGreater, CompareKubeAwareVersionStrings(tc.v1, tc.v2) > 0; e != a {
- if e {
- t.Errorf("expected %s to be greater than %s", tc.v1, tc.v2)
- } else {
- t.Errorf("expected %s to be less than than %s", tc.v1, tc.v2)
- }
- }
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/watch/filter_test.go b/vendor/k8s.io/apimachinery/pkg/watch/filter_test.go
deleted file mode 100644
index 4b5ae898a..000000000
--- a/vendor/k8s.io/apimachinery/pkg/watch/filter_test.go
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package watch_test
-
-import (
- "reflect"
- "testing"
-
- . "k8s.io/apimachinery/pkg/watch"
-)
-
-func TestFilter(t *testing.T) {
- table := []Event{
- {Type: Added, Object: testType("foo")},
- {Type: Added, Object: testType("bar")},
- {Type: Added, Object: testType("baz")},
- {Type: Added, Object: testType("qux")},
- {Type: Added, Object: testType("zoo")},
- }
-
- source := NewFake()
- filtered := Filter(source, func(e Event) (Event, bool) {
- return e, e.Object.(testType)[0] != 'b'
- })
-
- go func() {
- for _, item := range table {
- source.Action(item.Type, item.Object)
- }
- source.Stop()
- }()
-
- var got []string
- for {
- event, ok := <-filtered.ResultChan()
- if !ok {
- break
- }
- got = append(got, string(event.Object.(testType)))
- }
-
- if e, a := []string{"foo", "qux", "zoo"}, got; !reflect.DeepEqual(e, a) {
- t.Errorf("got %v, wanted %v", e, a)
- }
-}
-
-func TestFilterStop(t *testing.T) {
- source := NewFake()
- filtered := Filter(source, func(e Event) (Event, bool) {
- return e, e.Object.(testType)[0] != 'b'
- })
-
- go func() {
- source.Add(testType("foo"))
- filtered.Stop()
- }()
-
- var got []string
- for {
- event, ok := <-filtered.ResultChan()
- if !ok {
- break
- }
- got = append(got, string(event.Object.(testType)))
- }
-
- if e, a := []string{"foo"}, got; !reflect.DeepEqual(e, a) {
- t.Errorf("got %v, wanted %v", e, a)
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/watch/mux_test.go b/vendor/k8s.io/apimachinery/pkg/watch/mux_test.go
deleted file mode 100644
index 7029cf1f4..000000000
--- a/vendor/k8s.io/apimachinery/pkg/watch/mux_test.go
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package watch_test
-
-import (
- "reflect"
- "sync"
- "testing"
- "time"
-
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/util/wait"
- . "k8s.io/apimachinery/pkg/watch"
-)
-
-type myType struct {
- ID string
- Value string
-}
-
-func (obj *myType) GetObjectKind() schema.ObjectKind { return schema.EmptyObjectKind }
-func (obj *myType) DeepCopyObject() runtime.Object {
- if obj == nil {
- return nil
- }
- clone := *obj
- return &clone
-}
-
-func TestBroadcaster(t *testing.T) {
- table := []Event{
- {Type: Added, Object: &myType{"foo", "hello world 1"}},
- {Type: Added, Object: &myType{"bar", "hello world 2"}},
- {Type: Modified, Object: &myType{"foo", "goodbye world 3"}},
- {Type: Deleted, Object: &myType{"bar", "hello world 4"}},
- }
-
- // The broadcaster we're testing
- m := NewBroadcaster(0, WaitIfChannelFull)
-
- // Add a bunch of watchers
- const testWatchers = 2
- wg := sync.WaitGroup{}
- wg.Add(testWatchers)
- for i := 0; i < testWatchers; i++ {
- // Verify that each watcher gets the events in the correct order
- go func(watcher int, w Interface) {
- tableLine := 0
- for {
- event, ok := <-w.ResultChan()
- if !ok {
- break
- }
- if e, a := table[tableLine], event; !reflect.DeepEqual(e, a) {
- t.Errorf("Watcher %v, line %v: Expected (%v, %#v), got (%v, %#v)",
- watcher, tableLine, e.Type, e.Object, a.Type, a.Object)
- } else {
- t.Logf("Got (%v, %#v)", event.Type, event.Object)
- }
- tableLine++
- }
- wg.Done()
- }(i, m.Watch())
- }
-
- for i, item := range table {
- t.Logf("Sending %v", i)
- m.Action(item.Type, item.Object)
- }
-
- m.Shutdown()
-
- wg.Wait()
-}
-
-func TestBroadcasterWatcherClose(t *testing.T) {
- m := NewBroadcaster(0, WaitIfChannelFull)
- w := m.Watch()
- w2 := m.Watch()
- w.Stop()
- m.Shutdown()
- if _, open := <-w.ResultChan(); open {
- t.Errorf("Stop didn't work?")
- }
- if _, open := <-w2.ResultChan(); open {
- t.Errorf("Shutdown didn't work?")
- }
- // Extra stops don't hurt things
- w.Stop()
- w2.Stop()
-}
-
-func TestBroadcasterWatcherStopDeadlock(t *testing.T) {
- done := make(chan bool)
- m := NewBroadcaster(0, WaitIfChannelFull)
- go func(w0, w1 Interface) {
- // We know Broadcaster is in the distribute loop once one watcher receives
- // an event. Stop the other watcher while distribute is trying to
- // send to it.
- select {
- case <-w0.ResultChan():
- w1.Stop()
- case <-w1.ResultChan():
- w0.Stop()
- }
- close(done)
- }(m.Watch(), m.Watch())
- m.Action(Added, &myType{})
- select {
- case <-time.After(wait.ForeverTestTimeout):
- t.Error("timeout: deadlocked")
- case <-done:
- }
- m.Shutdown()
-}
-
-func TestBroadcasterDropIfChannelFull(t *testing.T) {
- m := NewBroadcaster(1, DropIfChannelFull)
-
- event1 := Event{Type: Added, Object: &myType{"foo", "hello world 1"}}
- event2 := Event{Type: Added, Object: &myType{"bar", "hello world 2"}}
-
- // Add a couple watchers
- watches := make([]Interface, 2)
- for i := range watches {
- watches[i] = m.Watch()
- }
-
- // Send a couple events before closing the broadcast channel.
- t.Log("Sending event 1")
- m.Action(event1.Type, event1.Object)
- t.Log("Sending event 2")
- m.Action(event2.Type, event2.Object)
- m.Shutdown()
-
- // Pull events from the queue.
- wg := sync.WaitGroup{}
- wg.Add(len(watches))
- for i := range watches {
- // Verify that each watcher only gets the first event because its watch
- // queue of length one was full from the first one.
- go func(watcher int, w Interface) {
- defer wg.Done()
- e1, ok := <-w.ResultChan()
- if !ok {
- t.Errorf("Watcher %v failed to retrieve first event.", watcher)
- }
- if e, a := event1, e1; !reflect.DeepEqual(e, a) {
- t.Errorf("Watcher %v: Expected (%v, %#v), got (%v, %#v)",
- watcher, e.Type, e.Object, a.Type, a.Object)
- }
- t.Logf("Got (%v, %#v)", e1.Type, e1.Object)
- e2, ok := <-w.ResultChan()
- if ok {
- t.Errorf("Watcher %v received second event (%v, %#v) even though it shouldn't have.",
- watcher, e2.Type, e2.Object)
- }
- }(i, watches[i])
- }
- wg.Wait()
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/watch/streamwatcher_test.go b/vendor/k8s.io/apimachinery/pkg/watch/streamwatcher_test.go
deleted file mode 100644
index 1e3029115..000000000
--- a/vendor/k8s.io/apimachinery/pkg/watch/streamwatcher_test.go
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package watch_test
-
-import (
- "io"
- "reflect"
- "testing"
-
- "k8s.io/apimachinery/pkg/runtime"
- . "k8s.io/apimachinery/pkg/watch"
-)
-
-type fakeDecoder struct {
- items chan Event
-}
-
-func (f fakeDecoder) Decode() (action EventType, object runtime.Object, err error) {
- item, open := <-f.items
- if !open {
- return action, nil, io.EOF
- }
- return item.Type, item.Object, nil
-}
-
-func (f fakeDecoder) Close() {
- close(f.items)
-}
-
-func TestStreamWatcher(t *testing.T) {
- table := []Event{
- {Type: Added, Object: testType("foo")},
- }
-
- fd := fakeDecoder{make(chan Event, 5)}
- sw := NewStreamWatcher(fd)
-
- for _, item := range table {
- fd.items <- item
- got, open := <-sw.ResultChan()
- if !open {
- t.Errorf("unexpected early close")
- }
- if e, a := item, got; !reflect.DeepEqual(e, a) {
- t.Errorf("expected %v, got %v", e, a)
- }
- }
-
- sw.Stop()
- _, open := <-sw.ResultChan()
- if open {
- t.Errorf("Unexpected failure to close")
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/watch/until_test.go b/vendor/k8s.io/apimachinery/pkg/watch/until_test.go
deleted file mode 100644
index e872c3681..000000000
--- a/vendor/k8s.io/apimachinery/pkg/watch/until_test.go
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package watch
-
-import (
- "errors"
- "strings"
- "testing"
- "time"
-
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/util/wait"
-)
-
-type fakePod struct {
- name string
-}
-
-func (obj *fakePod) GetObjectKind() schema.ObjectKind { return schema.EmptyObjectKind }
-func (obj *fakePod) DeepCopyObject() runtime.Object { panic("DeepCopyObject not supported by fakePod") }
-
-func TestUntil(t *testing.T) {
- fw := NewFake()
- go func() {
- var obj *fakePod
- fw.Add(obj)
- fw.Modify(obj)
- }()
- conditions := []ConditionFunc{
- func(event Event) (bool, error) { return event.Type == Added, nil },
- func(event Event) (bool, error) { return event.Type == Modified, nil },
- }
-
- timeout := time.Minute
- lastEvent, err := Until(timeout, fw, conditions...)
- if err != nil {
- t.Fatalf("expected nil error, got %#v", err)
- }
- if lastEvent == nil {
- t.Fatal("expected an event")
- }
- if lastEvent.Type != Modified {
- t.Fatalf("expected MODIFIED event type, got %v", lastEvent.Type)
- }
- if got, isPod := lastEvent.Object.(*fakePod); !isPod {
- t.Fatalf("expected a pod event, got %#v", got)
- }
-}
-
-func TestUntilMultipleConditions(t *testing.T) {
- fw := NewFake()
- go func() {
- var obj *fakePod
- fw.Add(obj)
- }()
- conditions := []ConditionFunc{
- func(event Event) (bool, error) { return event.Type == Added, nil },
- func(event Event) (bool, error) { return event.Type == Added, nil },
- }
-
- timeout := time.Minute
- lastEvent, err := Until(timeout, fw, conditions...)
- if err != nil {
- t.Fatalf("expected nil error, got %#v", err)
- }
- if lastEvent == nil {
- t.Fatal("expected an event")
- }
- if lastEvent.Type != Added {
- t.Fatalf("expected MODIFIED event type, got %v", lastEvent.Type)
- }
- if got, isPod := lastEvent.Object.(*fakePod); !isPod {
- t.Fatalf("expected a pod event, got %#v", got)
- }
-}
-
-func TestUntilMultipleConditionsFail(t *testing.T) {
- fw := NewFake()
- go func() {
- var obj *fakePod
- fw.Add(obj)
- }()
- conditions := []ConditionFunc{
- func(event Event) (bool, error) { return event.Type == Added, nil },
- func(event Event) (bool, error) { return event.Type == Added, nil },
- func(event Event) (bool, error) { return event.Type == Deleted, nil },
- }
-
- timeout := 10 * time.Second
- lastEvent, err := Until(timeout, fw, conditions...)
- if err != wait.ErrWaitTimeout {
- t.Fatalf("expected ErrWaitTimeout error, got %#v", err)
- }
- if lastEvent == nil {
- t.Fatal("expected an event")
- }
- if lastEvent.Type != Added {
- t.Fatalf("expected ADDED event type, got %v", lastEvent.Type)
- }
- if got, isPod := lastEvent.Object.(*fakePod); !isPod {
- t.Fatalf("expected a pod event, got %#v", got)
- }
-}
-
-func TestUntilTimeout(t *testing.T) {
- fw := NewFake()
- go func() {
- var obj *fakePod
- fw.Add(obj)
- fw.Modify(obj)
- }()
- conditions := []ConditionFunc{
- func(event Event) (bool, error) {
- return event.Type == Added, nil
- },
- func(event Event) (bool, error) {
- return event.Type == Modified, nil
- },
- }
-
- timeout := time.Duration(0)
- lastEvent, err := Until(timeout, fw, conditions...)
- if err != nil {
- t.Fatalf("expected nil error, got %#v", err)
- }
- if lastEvent == nil {
- t.Fatal("expected an event")
- }
- if lastEvent.Type != Modified {
- t.Fatalf("expected MODIFIED event type, got %v", lastEvent.Type)
- }
- if got, isPod := lastEvent.Object.(*fakePod); !isPod {
- t.Fatalf("expected a pod event, got %#v", got)
- }
-}
-
-func TestUntilErrorCondition(t *testing.T) {
- fw := NewFake()
- go func() {
- var obj *fakePod
- fw.Add(obj)
- }()
- expected := "something bad"
- conditions := []ConditionFunc{
- func(event Event) (bool, error) { return event.Type == Added, nil },
- func(event Event) (bool, error) { return false, errors.New(expected) },
- }
-
- timeout := time.Minute
- _, err := Until(timeout, fw, conditions...)
- if err == nil {
- t.Fatal("expected an error")
- }
- if !strings.Contains(err.Error(), expected) {
- t.Fatalf("expected %q in error string, got %q", expected, err.Error())
- }
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/watch/watch_test.go b/vendor/k8s.io/apimachinery/pkg/watch/watch_test.go
deleted file mode 100644
index bdf7fedd4..000000000
--- a/vendor/k8s.io/apimachinery/pkg/watch/watch_test.go
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package watch_test
-
-import (
- "testing"
-
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- . "k8s.io/apimachinery/pkg/watch"
-)
-
-type testType string
-
-func (obj testType) GetObjectKind() schema.ObjectKind { return schema.EmptyObjectKind }
-func (obj testType) DeepCopyObject() runtime.Object { return obj }
-
-func TestFake(t *testing.T) {
- f := NewFake()
-
- table := []struct {
- t EventType
- s testType
- }{
- {Added, testType("foo")},
- {Modified, testType("qux")},
- {Modified, testType("bar")},
- {Deleted, testType("bar")},
- {Error, testType("error: blah")},
- }
-
- // Prove that f implements Interface by phrasing this as a function.
- consumer := func(w Interface) {
- for _, expect := range table {
- got, ok := <-w.ResultChan()
- if !ok {
- t.Fatalf("closed early")
- }
- if e, a := expect.t, got.Type; e != a {
- t.Fatalf("Expected %v, got %v", e, a)
- }
- if a, ok := got.Object.(testType); !ok || a != expect.s {
- t.Fatalf("Expected %v, got %v", expect.s, a)
- }
- }
- _, stillOpen := <-w.ResultChan()
- if stillOpen {
- t.Fatal("Never stopped")
- }
- }
-
- sender := func() {
- f.Add(testType("foo"))
- f.Action(Modified, testType("qux"))
- f.Modify(testType("bar"))
- f.Delete(testType("bar"))
- f.Error(testType("error: blah"))
- f.Stop()
- }
-
- go sender()
- consumer(f)
-}
-
-func TestRaceFreeFake(t *testing.T) {
- f := NewRaceFreeFake()
-
- table := []struct {
- t EventType
- s testType
- }{
- {Added, testType("foo")},
- {Modified, testType("qux")},
- {Modified, testType("bar")},
- {Deleted, testType("bar")},
- {Error, testType("error: blah")},
- }
-
- // Prove that f implements Interface by phrasing this as a function.
- consumer := func(w Interface) {
- for _, expect := range table {
- got, ok := <-w.ResultChan()
- if !ok {
- t.Fatalf("closed early")
- }
- if e, a := expect.t, got.Type; e != a {
- t.Fatalf("Expected %v, got %v", e, a)
- }
- if a, ok := got.Object.(testType); !ok || a != expect.s {
- t.Fatalf("Expected %v, got %v", expect.s, a)
- }
- }
- _, stillOpen := <-w.ResultChan()
- if stillOpen {
- t.Fatal("Never stopped")
- }
- }
-
- sender := func() {
- f.Add(testType("foo"))
- f.Action(Modified, testType("qux"))
- f.Modify(testType("bar"))
- f.Delete(testType("bar"))
- f.Error(testType("error: blah"))
- f.Stop()
- }
-
- go sender()
- consumer(f)
-}
-
-func TestEmpty(t *testing.T) {
- w := NewEmptyWatch()
- _, ok := <-w.ResultChan()
- if ok {
- t.Errorf("unexpected result channel result")
- }
- w.Stop()
- _, ok = <-w.ResultChan()
- if ok {
- t.Errorf("unexpected result channel result")
- }
-}
diff --git a/vendor/k8s.io/apimachinery/third_party/forked/golang/json/fields_test.go b/vendor/k8s.io/apimachinery/third_party/forked/golang/json/fields_test.go
deleted file mode 100644
index 33b78bc43..000000000
--- a/vendor/k8s.io/apimachinery/third_party/forked/golang/json/fields_test.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package json
-
-import (
- "reflect"
- "testing"
-)
-
-func TestLookupPtrToStruct(t *testing.T) {
- type Elem struct {
- Key string
- Value string
- }
- type Outer struct {
- Inner []Elem `json:"inner" patchStrategy:"merge" patchMergeKey:"key"`
- }
- outer := &Outer{}
- elemType, patchStrategies, patchMergeKey, err := LookupPatchMetadataForStruct(reflect.TypeOf(outer), "inner")
- if err != nil {
- t.Fatal(err)
- }
- if elemType != reflect.TypeOf([]Elem{}) {
- t.Errorf("elemType = %v, want: %v", elemType, reflect.TypeOf([]Elem{}))
- }
- if !reflect.DeepEqual(patchStrategies, []string{"merge"}) {
- t.Errorf("patchStrategies = %v, want: %v", patchStrategies, []string{"merge"})
- }
- if patchMergeKey != "key" {
- t.Errorf("patchMergeKey = %v, want: %v", patchMergeKey, "key")
- }
-}
diff --git a/vendor/k8s.io/apimachinery/third_party/forked/golang/reflect/deep_equal_test.go b/vendor/k8s.io/apimachinery/third_party/forked/golang/reflect/deep_equal_test.go
deleted file mode 100644
index 4a0629930..000000000
--- a/vendor/k8s.io/apimachinery/third_party/forked/golang/reflect/deep_equal_test.go
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package reflect
-
-import (
- "testing"
-)
-
-func TestEqualities(t *testing.T) {
- e := Equalities{}
- type Bar struct {
- X int
- }
- type Baz struct {
- Y Bar
- }
- err := e.AddFuncs(
- func(a, b int) bool {
- return a+1 == b
- },
- func(a, b Bar) bool {
- return a.X*10 == b.X
- },
- )
- if err != nil {
- t.Fatalf("Unexpected: %v", err)
- }
-
- type Foo struct {
- X int
- }
-
- table := []struct {
- a, b interface{}
- equal bool
- }{
- {1, 2, true},
- {2, 1, false},
- {"foo", "fo", false},
- {"foo", "foo", true},
- {"foo", "foobar", false},
- {Foo{1}, Foo{2}, true},
- {Foo{2}, Foo{1}, false},
- {Bar{1}, Bar{10}, true},
- {&Bar{1}, &Bar{10}, true},
- {Baz{Bar{1}}, Baz{Bar{10}}, true},
- {[...]string{}, [...]string{"1", "2", "3"}, false},
- {[...]string{"1"}, [...]string{"1", "2", "3"}, false},
- {[...]string{"1", "2", "3"}, [...]string{}, false},
- {[...]string{"1", "2", "3"}, [...]string{"1", "2", "3"}, true},
- {map[string]int{"foo": 1}, map[string]int{}, false},
- {map[string]int{"foo": 1}, map[string]int{"foo": 2}, true},
- {map[string]int{"foo": 2}, map[string]int{"foo": 1}, false},
- {map[string]int{"foo": 1}, map[string]int{"foo": 2, "bar": 6}, false},
- {map[string]int{"foo": 1, "bar": 6}, map[string]int{"foo": 2}, false},
- {map[string]int{}, map[string]int(nil), true},
- {[]string(nil), []string(nil), true},
- {[]string{}, []string(nil), true},
- {[]string(nil), []string{}, true},
- {[]string{"1"}, []string(nil), false},
- {[]string{}, []string{"1", "2", "3"}, false},
- {[]string{"1"}, []string{"1", "2", "3"}, false},
- {[]string{"1", "2", "3"}, []string{}, false},
- }
-
- for _, item := range table {
- if e, a := item.equal, e.DeepEqual(item.a, item.b); e != a {
- t.Errorf("Expected (%+v == %+v) == %v, but got %v", item.a, item.b, e, a)
- }
- }
-}
-
-func TestDerivates(t *testing.T) {
- e := Equalities{}
- type Bar struct {
- X int
- }
- type Baz struct {
- Y Bar
- }
- err := e.AddFuncs(
- func(a, b int) bool {
- return a+1 == b
- },
- func(a, b Bar) bool {
- return a.X*10 == b.X
- },
- )
- if err != nil {
- t.Fatalf("Unexpected: %v", err)
- }
-
- type Foo struct {
- X int
- }
-
- table := []struct {
- a, b interface{}
- equal bool
- }{
- {1, 2, true},
- {2, 1, false},
- {"foo", "fo", false},
- {"foo", "foo", true},
- {"foo", "foobar", false},
- {Foo{1}, Foo{2}, true},
- {Foo{2}, Foo{1}, false},
- {Bar{1}, Bar{10}, true},
- {&Bar{1}, &Bar{10}, true},
- {Baz{Bar{1}}, Baz{Bar{10}}, true},
- {[...]string{}, [...]string{"1", "2", "3"}, false},
- {[...]string{"1"}, [...]string{"1", "2", "3"}, false},
- {[...]string{"1", "2", "3"}, [...]string{}, false},
- {[...]string{"1", "2", "3"}, [...]string{"1", "2", "3"}, true},
- {map[string]int{"foo": 1}, map[string]int{}, false},
- {map[string]int{"foo": 1}, map[string]int{"foo": 2}, true},
- {map[string]int{"foo": 2}, map[string]int{"foo": 1}, false},
- {map[string]int{"foo": 1}, map[string]int{"foo": 2, "bar": 6}, true},
- {map[string]int{"foo": 1, "bar": 6}, map[string]int{"foo": 2}, false},
- {map[string]int{}, map[string]int(nil), true},
- {[]string(nil), []string(nil), true},
- {[]string{}, []string(nil), true},
- {[]string(nil), []string{}, true},
- {[]string{"1"}, []string(nil), false},
- {[]string{}, []string{"1", "2", "3"}, true},
- {[]string{"1"}, []string{"1", "2", "3"}, true},
- {[]string{"1", "2", "3"}, []string{}, false},
- }
-
- for _, item := range table {
- if e, a := item.equal, e.DeepDerivative(item.a, item.b); e != a {
- t.Errorf("Expected (%+v ~ %+v) == %v, but got %v", item.a, item.b, e, a)
- }
- }
-}
diff --git a/vendor/k8s.io/client-go/discovery/cached_discovery_test.go b/vendor/k8s.io/client-go/discovery/cached_discovery_test.go
deleted file mode 100644
index 278931c2d..000000000
--- a/vendor/k8s.io/client-go/discovery/cached_discovery_test.go
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package discovery
-
-import (
- "io/ioutil"
- "os"
- "testing"
- "time"
-
- "github.com/googleapis/gnostic/OpenAPIv2"
- "github.com/stretchr/testify/assert"
-
- "k8s.io/apimachinery/pkg/api/errors"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/version"
- restclient "k8s.io/client-go/rest"
- "k8s.io/client-go/rest/fake"
-)
-
-func TestCachedDiscoveryClient_Fresh(t *testing.T) {
- assert := assert.New(t)
-
- d, err := ioutil.TempDir("", "")
- assert.NoError(err)
- defer os.RemoveAll(d)
-
- c := fakeDiscoveryClient{}
- cdc := newCachedDiscoveryClient(&c, d, 60*time.Second)
- assert.True(cdc.Fresh(), "should be fresh after creation")
-
- cdc.ServerGroups()
- assert.True(cdc.Fresh(), "should be fresh after groups call without cache")
- assert.Equal(c.groupCalls, 1)
-
- cdc.ServerGroups()
- assert.True(cdc.Fresh(), "should be fresh after another groups call")
- assert.Equal(c.groupCalls, 1)
-
- cdc.ServerResources()
- assert.True(cdc.Fresh(), "should be fresh after resources call")
- assert.Equal(c.resourceCalls, 1)
-
- cdc.ServerResources()
- assert.True(cdc.Fresh(), "should be fresh after another resources call")
- assert.Equal(c.resourceCalls, 1)
-
- cdc = newCachedDiscoveryClient(&c, d, 60*time.Second)
- cdc.ServerGroups()
- assert.False(cdc.Fresh(), "should NOT be fresh after recreation with existing groups cache")
- assert.Equal(c.groupCalls, 1)
-
- cdc.ServerResources()
- assert.False(cdc.Fresh(), "should NOT be fresh after recreation with existing resources cache")
- assert.Equal(c.resourceCalls, 1)
-
- cdc.Invalidate()
- assert.True(cdc.Fresh(), "should be fresh after cache invalidation")
-
- cdc.ServerResources()
- assert.True(cdc.Fresh(), "should ignore existing resources cache after invalidation")
- assert.Equal(c.resourceCalls, 2)
-}
-
-func TestNewCachedDiscoveryClient_TTL(t *testing.T) {
- assert := assert.New(t)
-
- d, err := ioutil.TempDir("", "")
- assert.NoError(err)
- defer os.RemoveAll(d)
-
- c := fakeDiscoveryClient{}
- cdc := newCachedDiscoveryClient(&c, d, 1*time.Nanosecond)
- cdc.ServerGroups()
- assert.Equal(c.groupCalls, 1)
-
- time.Sleep(1 * time.Second)
-
- cdc.ServerGroups()
- assert.Equal(c.groupCalls, 2)
-}
-
-type fakeDiscoveryClient struct {
- groupCalls int
- resourceCalls int
- versionCalls int
- openAPICalls int
-
- serverResourcesHandler func() ([]*metav1.APIResourceList, error)
-}
-
-var _ DiscoveryInterface = &fakeDiscoveryClient{}
-
-func (c *fakeDiscoveryClient) RESTClient() restclient.Interface {
- return &fake.RESTClient{}
-}
-
-func (c *fakeDiscoveryClient) ServerGroups() (*metav1.APIGroupList, error) {
- c.groupCalls = c.groupCalls + 1
- return &metav1.APIGroupList{
- Groups: []metav1.APIGroup{
- {
- Name: "a",
- Versions: []metav1.GroupVersionForDiscovery{
- {
- GroupVersion: "a/v1",
- Version: "v1",
- },
- },
- PreferredVersion: metav1.GroupVersionForDiscovery{
- GroupVersion: "a/v1",
- Version: "v1",
- },
- },
- },
- }, nil
-}
-
-func (c *fakeDiscoveryClient) ServerResourcesForGroupVersion(groupVersion string) (*metav1.APIResourceList, error) {
- c.resourceCalls = c.resourceCalls + 1
- if groupVersion == "a/v1" {
- return &metav1.APIResourceList{APIResources: []metav1.APIResource{{Name: "widgets", Kind: "Widget"}}}, nil
- }
-
- return nil, errors.NewNotFound(schema.GroupResource{}, "")
-}
-
-func (c *fakeDiscoveryClient) ServerResources() ([]*metav1.APIResourceList, error) {
- c.resourceCalls = c.resourceCalls + 1
- if c.serverResourcesHandler != nil {
- return c.serverResourcesHandler()
- }
- return []*metav1.APIResourceList{}, nil
-}
-
-func (c *fakeDiscoveryClient) ServerPreferredResources() ([]*metav1.APIResourceList, error) {
- c.resourceCalls = c.resourceCalls + 1
- return nil, nil
-}
-
-func (c *fakeDiscoveryClient) ServerPreferredNamespacedResources() ([]*metav1.APIResourceList, error) {
- c.resourceCalls = c.resourceCalls + 1
- return nil, nil
-}
-
-func (c *fakeDiscoveryClient) ServerVersion() (*version.Info, error) {
- c.versionCalls = c.versionCalls + 1
- return &version.Info{}, nil
-}
-
-func (c *fakeDiscoveryClient) OpenAPISchema() (*openapi_v2.Document, error) {
- c.openAPICalls = c.openAPICalls + 1
- return &openapi_v2.Document{}, nil
-}
diff --git a/vendor/k8s.io/client-go/discovery/discovery_client_test.go b/vendor/k8s.io/client-go/discovery/discovery_client_test.go
deleted file mode 100644
index 10e494322..000000000
--- a/vendor/k8s.io/client-go/discovery/discovery_client_test.go
+++ /dev/null
@@ -1,882 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package discovery
-
-import (
- "encoding/json"
- "fmt"
- "mime"
- "net/http"
- "net/http/httptest"
- "reflect"
- "testing"
-
- "github.com/gogo/protobuf/proto"
- "github.com/googleapis/gnostic/OpenAPIv2"
- "github.com/stretchr/testify/assert"
-
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/util/diff"
- "k8s.io/apimachinery/pkg/util/sets"
- "k8s.io/apimachinery/pkg/version"
- restclient "k8s.io/client-go/rest"
-)
-
-func TestGetServerVersion(t *testing.T) {
- expect := version.Info{
- Major: "foo",
- Minor: "bar",
- GitCommit: "baz",
- }
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
- output, err := json.Marshal(expect)
- if err != nil {
- t.Errorf("unexpected encoding error: %v", err)
- return
- }
- w.Header().Set("Content-Type", "application/json")
- w.WriteHeader(http.StatusOK)
- w.Write(output)
- }))
- defer server.Close()
- client := NewDiscoveryClientForConfigOrDie(&restclient.Config{Host: server.URL})
-
- got, err := client.ServerVersion()
- if err != nil {
- t.Fatalf("unexpected encoding error: %v", err)
- }
- if e, a := expect, *got; !reflect.DeepEqual(e, a) {
- t.Errorf("expected %v, got %v", e, a)
- }
-}
-
-func TestGetServerGroupsWithV1Server(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
- var obj interface{}
- switch req.URL.Path {
- case "/api":
- obj = &metav1.APIVersions{
- Versions: []string{
- "v1",
- },
- }
- case "/apis":
- obj = &metav1.APIGroupList{
- Groups: []metav1.APIGroup{
- {
- Name: "extensions",
- Versions: []metav1.GroupVersionForDiscovery{
- {GroupVersion: "extensions/v1beta1"},
- },
- },
- },
- }
- default:
- w.WriteHeader(http.StatusNotFound)
- return
- }
- output, err := json.Marshal(obj)
- if err != nil {
- t.Fatalf("unexpected encoding error: %v", err)
- return
- }
- w.Header().Set("Content-Type", "application/json")
- w.WriteHeader(http.StatusOK)
- w.Write(output)
- }))
- defer server.Close()
- client := NewDiscoveryClientForConfigOrDie(&restclient.Config{Host: server.URL})
- // ServerGroups should not return an error even if server returns error at /api and /apis
- apiGroupList, err := client.ServerGroups()
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- groupVersions := metav1.ExtractGroupVersions(apiGroupList)
- if !reflect.DeepEqual(groupVersions, []string{"v1", "extensions/v1beta1"}) {
- t.Errorf("expected: %q, got: %q", []string{"v1", "extensions/v1beta1"}, groupVersions)
- }
-}
-
-func TestGetServerGroupsWithBrokenServer(t *testing.T) {
- for _, statusCode := range []int{http.StatusNotFound, http.StatusForbidden} {
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
- w.WriteHeader(statusCode)
- }))
- defer server.Close()
- client := NewDiscoveryClientForConfigOrDie(&restclient.Config{Host: server.URL})
- // ServerGroups should not return an error even if server returns Not Found or Forbidden error at all end points
- apiGroupList, err := client.ServerGroups()
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- groupVersions := metav1.ExtractGroupVersions(apiGroupList)
- if len(groupVersions) != 0 {
- t.Errorf("expected empty list, got: %q", groupVersions)
- }
- }
-}
-
-func TestTimeoutIsSet(t *testing.T) {
- cfg := &restclient.Config{}
- setDiscoveryDefaults(cfg)
- assert.Equal(t, defaultTimeout, cfg.Timeout)
-}
-
-func TestGetServerResourcesWithV1Server(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
- var obj interface{}
- switch req.URL.Path {
- case "/api":
- obj = &metav1.APIVersions{
- Versions: []string{
- "v1",
- },
- }
- default:
- w.WriteHeader(http.StatusNotFound)
- return
- }
- output, err := json.Marshal(obj)
- if err != nil {
- t.Errorf("unexpected encoding error: %v", err)
- return
- }
- w.Header().Set("Content-Type", "application/json")
- w.WriteHeader(http.StatusOK)
- w.Write(output)
- }))
- defer server.Close()
- client := NewDiscoveryClientForConfigOrDie(&restclient.Config{Host: server.URL})
- // ServerResources should not return an error even if server returns error at /api/v1.
- serverResources, err := client.ServerResources()
- if err != nil {
- t.Errorf("unexpected error: %v", err)
- }
- gvs := groupVersions(serverResources)
- if !sets.NewString(gvs...).Has("v1") {
- t.Errorf("missing v1 in resource list: %v", serverResources)
- }
-}
-
-func TestGetServerResources(t *testing.T) {
- stable := metav1.APIResourceList{
- GroupVersion: "v1",
- APIResources: []metav1.APIResource{
- {Name: "pods", Namespaced: true, Kind: "Pod"},
- {Name: "services", Namespaced: true, Kind: "Service"},
- {Name: "namespaces", Namespaced: false, Kind: "Namespace"},
- },
- }
- beta := metav1.APIResourceList{
- GroupVersion: "extensions/v1beta1",
- APIResources: []metav1.APIResource{
- {Name: "deployments", Namespaced: true, Kind: "Deployment"},
- {Name: "ingresses", Namespaced: true, Kind: "Ingress"},
- {Name: "jobs", Namespaced: true, Kind: "Job"},
- },
- }
- beta2 := metav1.APIResourceList{
- GroupVersion: "extensions/v1beta2",
- APIResources: []metav1.APIResource{
- {Name: "deployments", Namespaced: true, Kind: "Deployment"},
- {Name: "ingresses", Namespaced: true, Kind: "Ingress"},
- {Name: "jobs", Namespaced: true, Kind: "Job"},
- },
- }
- tests := []struct {
- resourcesList *metav1.APIResourceList
- path string
- request string
- expectErr bool
- }{
- {
- resourcesList: &stable,
- path: "/api/v1",
- request: "v1",
- expectErr: false,
- },
- {
- resourcesList: &beta,
- path: "/apis/extensions/v1beta1",
- request: "extensions/v1beta1",
- expectErr: false,
- },
- {
- resourcesList: &stable,
- path: "/api/v1",
- request: "foobar",
- expectErr: true,
- },
- }
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
- var list interface{}
- switch req.URL.Path {
- case "/api/v1":
- list = &stable
- case "/apis/extensions/v1beta1":
- list = &beta
- case "/apis/extensions/v1beta2":
- list = &beta2
- case "/api":
- list = &metav1.APIVersions{
- Versions: []string{
- "v1",
- },
- }
- case "/apis":
- list = &metav1.APIGroupList{
- Groups: []metav1.APIGroup{
- {
- Name: "extensions",
- Versions: []metav1.GroupVersionForDiscovery{
- {GroupVersion: "extensions/v1beta1", Version: "v1beta1"},
- {GroupVersion: "extensions/v1beta2", Version: "v1beta2"},
- },
- },
- },
- }
- default:
- t.Logf("unexpected request: %s", req.URL.Path)
- w.WriteHeader(http.StatusNotFound)
- return
- }
- output, err := json.Marshal(list)
- if err != nil {
- t.Errorf("unexpected encoding error: %v", err)
- return
- }
- w.Header().Set("Content-Type", "application/json")
- w.WriteHeader(http.StatusOK)
- w.Write(output)
- }))
- defer server.Close()
- client := NewDiscoveryClientForConfigOrDie(&restclient.Config{Host: server.URL})
- for _, test := range tests {
- got, err := client.ServerResourcesForGroupVersion(test.request)
- if test.expectErr {
- if err == nil {
- t.Error("unexpected non-error")
- }
- continue
- }
- if err != nil {
- t.Errorf("unexpected error: %v", err)
- continue
- }
- if !reflect.DeepEqual(got, test.resourcesList) {
- t.Errorf("expected:\n%v\ngot:\n%v\n", test.resourcesList, got)
- }
- }
-
- serverResources, err := client.ServerResources()
- if err != nil {
- t.Errorf("unexpected error: %v", err)
- }
- serverGroupVersions := groupVersions(serverResources)
- expectedGroupVersions := []string{"v1", "extensions/v1beta1", "extensions/v1beta2"}
- if !reflect.DeepEqual(expectedGroupVersions, serverGroupVersions) {
- t.Errorf("unexpected group versions: %v", diff.ObjectReflectDiff(expectedGroupVersions, serverGroupVersions))
- }
-}
-
-var returnedOpenAPI = openapi_v2.Document{
- Definitions: &openapi_v2.Definitions{
- AdditionalProperties: []*openapi_v2.NamedSchema{
- {
- Name: "fake.type.1",
- Value: &openapi_v2.Schema{
- Properties: &openapi_v2.Properties{
- AdditionalProperties: []*openapi_v2.NamedSchema{
- {
- Name: "count",
- Value: &openapi_v2.Schema{
- Type: &openapi_v2.TypeItem{
- Value: []string{"integer"},
- },
- },
- },
- },
- },
- },
- },
- {
- Name: "fake.type.2",
- Value: &openapi_v2.Schema{
- Properties: &openapi_v2.Properties{
- AdditionalProperties: []*openapi_v2.NamedSchema{
- {
- Name: "count",
- Value: &openapi_v2.Schema{
- Type: &openapi_v2.TypeItem{
- Value: []string{"array"},
- },
- Items: &openapi_v2.ItemsItem{
- Schema: []*openapi_v2.Schema{
- {
- Type: &openapi_v2.TypeItem{
- Value: []string{"string"},
- },
- },
- },
- },
- },
- },
- },
- },
- },
- },
- },
- },
-}
-
-func openapiSchemaDeprecatedFakeServer(status int) (*httptest.Server, error) {
- var sErr error
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
- if req.URL.Path == "/openapi/v2" {
- // write the error status for the new endpoint request
- w.WriteHeader(status)
- return
- }
- if req.URL.Path != "/swagger-2.0.0.pb-v1" {
- sErr = fmt.Errorf("Unexpected url %v", req.URL)
- }
- if req.Method != "GET" {
- sErr = fmt.Errorf("Unexpected method %v", req.Method)
- }
-
- mime.AddExtensionType(".pb-v1", "application/com.github.googleapis.gnostic.OpenAPIv2@68f4ded+protobuf")
-
- output, err := proto.Marshal(&returnedOpenAPI)
- if err != nil {
- sErr = err
- return
- }
- w.WriteHeader(http.StatusOK)
- w.Write(output)
- }))
- return server, sErr
-}
-
-func openapiSchemaFakeServer() (*httptest.Server, error) {
- var sErr error
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
- if req.URL.Path != "/openapi/v2" {
- sErr = fmt.Errorf("Unexpected url %v", req.URL)
- }
- if req.Method != "GET" {
- sErr = fmt.Errorf("Unexpected method %v", req.Method)
- }
- decipherableFormat := req.Header.Get("Accept")
- if decipherableFormat != "application/com.github.proto-openapi.spec.v2@v1.0+protobuf" {
- sErr = fmt.Errorf("Unexpected accept mime type %v", decipherableFormat)
- }
-
- mime.AddExtensionType(".pb-v1", "application/com.github.googleapis.gnostic.OpenAPIv2@68f4ded+protobuf")
-
- output, err := proto.Marshal(&returnedOpenAPI)
- if err != nil {
- sErr = err
- return
- }
- w.WriteHeader(http.StatusOK)
- w.Write(output)
- }))
- return server, sErr
-}
-
-func TestGetOpenAPISchema(t *testing.T) {
- server, err := openapiSchemaFakeServer()
- if err != nil {
- t.Errorf("unexpected error starting fake server: %v", err)
- }
- defer server.Close()
-
- client := NewDiscoveryClientForConfigOrDie(&restclient.Config{Host: server.URL})
- got, err := client.OpenAPISchema()
- if err != nil {
- t.Fatalf("unexpected error getting openapi: %v", err)
- }
- if e, a := returnedOpenAPI, *got; !reflect.DeepEqual(e, a) {
- t.Errorf("expected %v, got %v", e, a)
- }
-}
-
-func TestGetOpenAPISchemaForbiddenFallback(t *testing.T) {
- server, err := openapiSchemaDeprecatedFakeServer(http.StatusForbidden)
- if err != nil {
- t.Errorf("unexpected error starting fake server: %v", err)
- }
- defer server.Close()
-
- client := NewDiscoveryClientForConfigOrDie(&restclient.Config{Host: server.URL})
- got, err := client.OpenAPISchema()
- if err != nil {
- t.Fatalf("unexpected error getting openapi: %v", err)
- }
- if e, a := returnedOpenAPI, *got; !reflect.DeepEqual(e, a) {
- t.Errorf("expected %v, got %v", e, a)
- }
-}
-
-func TestGetOpenAPISchemaNotFoundFallback(t *testing.T) {
- server, err := openapiSchemaDeprecatedFakeServer(http.StatusNotFound)
- if err != nil {
- t.Errorf("unexpected error starting fake server: %v", err)
- }
- defer server.Close()
-
- client := NewDiscoveryClientForConfigOrDie(&restclient.Config{Host: server.URL})
- got, err := client.OpenAPISchema()
- if err != nil {
- t.Fatalf("unexpected error getting openapi: %v", err)
- }
- if e, a := returnedOpenAPI, *got; !reflect.DeepEqual(e, a) {
- t.Errorf("expected %v, got %v", e, a)
- }
-}
-
-func TestGetOpenAPISchemaNotAcceptableFallback(t *testing.T) {
- server, err := openapiSchemaDeprecatedFakeServer(http.StatusNotAcceptable)
- if err != nil {
- t.Errorf("unexpected error starting fake server: %v", err)
- }
- defer server.Close()
-
- client := NewDiscoveryClientForConfigOrDie(&restclient.Config{Host: server.URL})
- got, err := client.OpenAPISchema()
- if err != nil {
- t.Fatalf("unexpected error getting openapi: %v", err)
- }
- if e, a := returnedOpenAPI, *got; !reflect.DeepEqual(e, a) {
- t.Errorf("expected %v, got %v", e, a)
- }
-}
-
-func TestServerPreferredResources(t *testing.T) {
- stable := metav1.APIResourceList{
- GroupVersion: "v1",
- APIResources: []metav1.APIResource{
- {Name: "pods", Namespaced: true, Kind: "Pod"},
- {Name: "services", Namespaced: true, Kind: "Service"},
- {Name: "namespaces", Namespaced: false, Kind: "Namespace"},
- },
- }
- tests := []struct {
- resourcesList []*metav1.APIResourceList
- response func(w http.ResponseWriter, req *http.Request)
- expectErr func(err error) bool
- }{
- {
- resourcesList: []*metav1.APIResourceList{&stable},
- expectErr: IsGroupDiscoveryFailedError,
- response: func(w http.ResponseWriter, req *http.Request) {
- var list interface{}
- switch req.URL.Path {
- case "/apis/extensions/v1beta1":
- w.WriteHeader(http.StatusInternalServerError)
- return
- case "/api/v1":
- list = &stable
- case "/api":
- list = &metav1.APIVersions{
- Versions: []string{
- "v1",
- },
- }
- case "/apis":
- list = &metav1.APIGroupList{
- Groups: []metav1.APIGroup{
- {
- Versions: []metav1.GroupVersionForDiscovery{
- {GroupVersion: "extensions/v1beta1"},
- },
- },
- },
- }
- default:
- t.Logf("unexpected request: %s", req.URL.Path)
- w.WriteHeader(http.StatusNotFound)
- return
- }
- output, err := json.Marshal(list)
- if err != nil {
- t.Errorf("unexpected encoding error: %v", err)
- return
- }
- w.Header().Set("Content-Type", "application/json")
- w.WriteHeader(http.StatusOK)
- w.Write(output)
- },
- },
- {
- resourcesList: nil,
- expectErr: IsGroupDiscoveryFailedError,
- response: func(w http.ResponseWriter, req *http.Request) {
- var list interface{}
- switch req.URL.Path {
- case "/apis/extensions/v1beta1":
- w.WriteHeader(http.StatusInternalServerError)
- return
- case "/api/v1":
- w.WriteHeader(http.StatusInternalServerError)
- case "/api":
- list = &metav1.APIVersions{
- Versions: []string{
- "v1",
- },
- }
- case "/apis":
- list = &metav1.APIGroupList{
- Groups: []metav1.APIGroup{
- {
- Versions: []metav1.GroupVersionForDiscovery{
- {GroupVersion: "extensions/v1beta1"},
- },
- },
- },
- }
- default:
- t.Logf("unexpected request: %s", req.URL.Path)
- w.WriteHeader(http.StatusNotFound)
- return
- }
- output, err := json.Marshal(list)
- if err != nil {
- t.Errorf("unexpected encoding error: %v", err)
- return
- }
- w.Header().Set("Content-Type", "application/json")
- w.WriteHeader(http.StatusOK)
- w.Write(output)
- },
- },
- }
- for _, test := range tests {
- server := httptest.NewServer(http.HandlerFunc(test.response))
- defer server.Close()
-
- client := NewDiscoveryClientForConfigOrDie(&restclient.Config{Host: server.URL})
- resources, err := client.ServerPreferredResources()
- if test.expectErr != nil {
- if err == nil {
- t.Error("unexpected non-error")
- }
-
- continue
- }
- if err != nil {
- t.Errorf("unexpected error: %v", err)
- continue
- }
- got, err := GroupVersionResources(resources)
- if err != nil {
- t.Errorf("unexpected error: %v", err)
- continue
- }
- expected, _ := GroupVersionResources(test.resourcesList)
- if !reflect.DeepEqual(got, expected) {
- t.Errorf("expected:\n%v\ngot:\n%v\n", test.resourcesList, got)
- }
- server.Close()
- }
-}
-
-func TestServerPreferredResourcesRetries(t *testing.T) {
- stable := metav1.APIResourceList{
- GroupVersion: "v1",
- APIResources: []metav1.APIResource{
- {Name: "pods", Namespaced: true, Kind: "Pod"},
- },
- }
- beta := metav1.APIResourceList{
- GroupVersion: "extensions/v1",
- APIResources: []metav1.APIResource{
- {Name: "deployments", Namespaced: true, Kind: "Deployment"},
- },
- }
-
- response := func(numErrors int) http.HandlerFunc {
- var i = 0
- return func(w http.ResponseWriter, req *http.Request) {
- var list interface{}
- switch req.URL.Path {
- case "/apis/extensions/v1beta1":
- if i < numErrors {
- i++
- w.WriteHeader(http.StatusInternalServerError)
- return
- }
- list = &beta
- case "/api/v1":
- list = &stable
- case "/api":
- list = &metav1.APIVersions{
- Versions: []string{
- "v1",
- },
- }
- case "/apis":
- list = &metav1.APIGroupList{
- Groups: []metav1.APIGroup{
- {
- Name: "extensions",
- Versions: []metav1.GroupVersionForDiscovery{
- {GroupVersion: "extensions/v1beta1", Version: "v1beta1"},
- },
- PreferredVersion: metav1.GroupVersionForDiscovery{
- GroupVersion: "extensions/v1beta1",
- Version: "v1beta1",
- },
- },
- },
- }
- default:
- t.Logf("unexpected request: %s", req.URL.Path)
- w.WriteHeader(http.StatusNotFound)
- return
- }
- output, err := json.Marshal(list)
- if err != nil {
- t.Errorf("unexpected encoding error: %v", err)
- return
- }
- w.Header().Set("Content-Type", "application/json")
- w.WriteHeader(http.StatusOK)
- w.Write(output)
- }
- }
- tests := []struct {
- responseErrors int
- expectResources int
- expectedError func(err error) bool
- }{
- {
- responseErrors: 1,
- expectResources: 2,
- expectedError: func(err error) bool {
- return err == nil
- },
- },
- {
- responseErrors: 2,
- expectResources: 1,
- expectedError: IsGroupDiscoveryFailedError,
- },
- }
-
- for i, tc := range tests {
- server := httptest.NewServer(http.HandlerFunc(response(tc.responseErrors)))
- defer server.Close()
-
- client := NewDiscoveryClientForConfigOrDie(&restclient.Config{Host: server.URL})
- resources, err := client.ServerPreferredResources()
- if !tc.expectedError(err) {
- t.Errorf("case %d: unexpected error: %v", i, err)
- }
- got, err := GroupVersionResources(resources)
- if err != nil {
- t.Errorf("case %d: unexpected error: %v", i, err)
- }
- if len(got) != tc.expectResources {
- t.Errorf("case %d: expect %d resources, got %#v", i, tc.expectResources, got)
- }
- server.Close()
- }
-}
-
-func TestServerPreferredNamespacedResources(t *testing.T) {
- stable := metav1.APIResourceList{
- GroupVersion: "v1",
- APIResources: []metav1.APIResource{
- {Name: "pods", Namespaced: true, Kind: "Pod"},
- {Name: "services", Namespaced: true, Kind: "Service"},
- {Name: "namespaces", Namespaced: false, Kind: "Namespace"},
- },
- }
- batchv1 := metav1.APIResourceList{
- GroupVersion: "batch/v1",
- APIResources: []metav1.APIResource{
- {Name: "jobs", Namespaced: true, Kind: "Job"},
- },
- }
- batchv2alpha1 := metav1.APIResourceList{
- GroupVersion: "batch/v2alpha1",
- APIResources: []metav1.APIResource{
- {Name: "jobs", Namespaced: true, Kind: "Job"},
- {Name: "cronjobs", Namespaced: true, Kind: "CronJob"},
- },
- }
- batchv3alpha1 := metav1.APIResourceList{
- GroupVersion: "batch/v3alpha1",
- APIResources: []metav1.APIResource{
- {Name: "jobs", Namespaced: true, Kind: "Job"},
- {Name: "cronjobs", Namespaced: true, Kind: "CronJob"},
- },
- }
- tests := []struct {
- response func(w http.ResponseWriter, req *http.Request)
- expected map[schema.GroupVersionResource]struct{}
- }{
- {
- response: func(w http.ResponseWriter, req *http.Request) {
- var list interface{}
- switch req.URL.Path {
- case "/api/v1":
- list = &stable
- case "/api":
- list = &metav1.APIVersions{
- Versions: []string{
- "v1",
- },
- }
- default:
- t.Logf("unexpected request: %s", req.URL.Path)
- w.WriteHeader(http.StatusNotFound)
- return
- }
- output, err := json.Marshal(list)
- if err != nil {
- t.Errorf("unexpected encoding error: %v", err)
- return
- }
- w.Header().Set("Content-Type", "application/json")
- w.WriteHeader(http.StatusOK)
- w.Write(output)
- },
- expected: map[schema.GroupVersionResource]struct{}{
- {Group: "", Version: "v1", Resource: "pods"}: {},
- {Group: "", Version: "v1", Resource: "services"}: {},
- },
- },
- {
- response: func(w http.ResponseWriter, req *http.Request) {
- var list interface{}
- switch req.URL.Path {
- case "/apis":
- list = &metav1.APIGroupList{
- Groups: []metav1.APIGroup{
- {
- Name: "batch",
- Versions: []metav1.GroupVersionForDiscovery{
- {GroupVersion: "batch/v1", Version: "v1"},
- {GroupVersion: "batch/v2alpha1", Version: "v2alpha1"},
- {GroupVersion: "batch/v3alpha1", Version: "v3alpha1"},
- },
- PreferredVersion: metav1.GroupVersionForDiscovery{GroupVersion: "batch/v1", Version: "v1"},
- },
- },
- }
- case "/apis/batch/v1":
- list = &batchv1
- case "/apis/batch/v2alpha1":
- list = &batchv2alpha1
- case "/apis/batch/v3alpha1":
- list = &batchv3alpha1
- default:
- t.Logf("unexpected request: %s", req.URL.Path)
- w.WriteHeader(http.StatusNotFound)
- return
- }
- output, err := json.Marshal(list)
- if err != nil {
- t.Errorf("unexpected encoding error: %v", err)
- return
- }
- w.Header().Set("Content-Type", "application/json")
- w.WriteHeader(http.StatusOK)
- w.Write(output)
- },
- expected: map[schema.GroupVersionResource]struct{}{
- {Group: "batch", Version: "v1", Resource: "jobs"}: {},
- {Group: "batch", Version: "v2alpha1", Resource: "cronjobs"}: {},
- },
- },
- {
- response: func(w http.ResponseWriter, req *http.Request) {
- var list interface{}
- switch req.URL.Path {
- case "/apis":
- list = &metav1.APIGroupList{
- Groups: []metav1.APIGroup{
- {
- Name: "batch",
- Versions: []metav1.GroupVersionForDiscovery{
- {GroupVersion: "batch/v1", Version: "v1"},
- {GroupVersion: "batch/v2alpha1", Version: "v2alpha1"},
- {GroupVersion: "batch/v3alpha1", Version: "v3alpha1"},
- },
- PreferredVersion: metav1.GroupVersionForDiscovery{GroupVersion: "batch/v2alpha", Version: "v2alpha1"},
- },
- },
- }
- case "/apis/batch/v1":
- list = &batchv1
- case "/apis/batch/v2alpha1":
- list = &batchv2alpha1
- case "/apis/batch/v3alpha1":
- list = &batchv3alpha1
- default:
- t.Logf("unexpected request: %s", req.URL.Path)
- w.WriteHeader(http.StatusNotFound)
- return
- }
- output, err := json.Marshal(list)
- if err != nil {
- t.Errorf("unexpected encoding error: %v", err)
- return
- }
- w.Header().Set("Content-Type", "application/json")
- w.WriteHeader(http.StatusOK)
- w.Write(output)
- },
- expected: map[schema.GroupVersionResource]struct{}{
- {Group: "batch", Version: "v2alpha1", Resource: "jobs"}: {},
- {Group: "batch", Version: "v2alpha1", Resource: "cronjobs"}: {},
- },
- },
- }
- for i, test := range tests {
- server := httptest.NewServer(http.HandlerFunc(test.response))
- defer server.Close()
-
- client := NewDiscoveryClientForConfigOrDie(&restclient.Config{Host: server.URL})
- resources, err := client.ServerPreferredNamespacedResources()
- if err != nil {
- t.Errorf("[%d] unexpected error: %v", i, err)
- continue
- }
- got, err := GroupVersionResources(resources)
- if err != nil {
- t.Errorf("[%d] unexpected error: %v", i, err)
- continue
- }
-
- if !reflect.DeepEqual(got, test.expected) {
- t.Errorf("[%d] expected:\n%v\ngot:\n%v\n", i, test.expected, got)
- }
- server.Close()
- }
-}
-
-func groupVersions(resources []*metav1.APIResourceList) []string {
- result := []string{}
- for _, resourceList := range resources {
- result = append(result, resourceList.GroupVersion)
- }
- return result
-}
diff --git a/vendor/k8s.io/client-go/discovery/fake/discovery_test.go b/vendor/k8s.io/client-go/discovery/fake/discovery_test.go
deleted file mode 100644
index cfdcf1a23..000000000
--- a/vendor/k8s.io/client-go/discovery/fake/discovery_test.go
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package fake_test
-
-import (
- "testing"
-
- "k8s.io/apimachinery/pkg/version"
- fakediscovery "k8s.io/client-go/discovery/fake"
- fakeclientset "k8s.io/client-go/kubernetes/fake"
-)
-
-func TestFakingServerVersion(t *testing.T) {
- client := fakeclientset.NewSimpleClientset()
- fakeDiscovery, ok := client.Discovery().(*fakediscovery.FakeDiscovery)
- if !ok {
- t.Fatalf("couldn't convert Discovery() to *FakeDiscovery")
- }
-
- testGitCommit := "v1.0.0"
- fakeDiscovery.FakedServerVersion = &version.Info{
- GitCommit: testGitCommit,
- }
-
- sv, err := client.Discovery().ServerVersion()
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- if sv.GitCommit != testGitCommit {
- t.Fatalf("unexpected faked discovery return value: %q", sv.GitCommit)
- }
-}
diff --git a/vendor/k8s.io/client-go/discovery/helper_blackbox_test.go b/vendor/k8s.io/client-go/discovery/helper_blackbox_test.go
deleted file mode 100644
index 9cd85cb16..000000000
--- a/vendor/k8s.io/client-go/discovery/helper_blackbox_test.go
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
-Copyright 2015 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package discovery_test
-
-import (
- "bytes"
- "encoding/json"
- "errors"
- "io"
- "io/ioutil"
- "net/http"
- "strings"
- "testing"
-
- "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/util/sets"
- "k8s.io/client-go/discovery"
- "k8s.io/client-go/kubernetes/scheme"
- restclient "k8s.io/client-go/rest"
- "k8s.io/client-go/rest/fake"
-)
-
-func objBody(object interface{}) io.ReadCloser {
- output, err := json.MarshalIndent(object, "", "")
- if err != nil {
- panic(err)
- }
- return ioutil.NopCloser(bytes.NewReader([]byte(output)))
-}
-
-func TestServerSupportsVersion(t *testing.T) {
- tests := []struct {
- name string
- requiredVersion schema.GroupVersion
- serverVersions []string
- expectErr func(err error) bool
- sendErr error
- statusCode int
- }{
- {
- name: "explicit version supported",
- requiredVersion: schema.GroupVersion{Version: "v1"},
- serverVersions: []string{"/version1", v1.SchemeGroupVersion.String()},
- statusCode: http.StatusOK,
- },
- {
- name: "explicit version not supported on server",
- requiredVersion: schema.GroupVersion{Version: "v1"},
- serverVersions: []string{"version1"},
- expectErr: func(err error) bool { return strings.Contains(err.Error(), `server does not support API version "v1"`) },
- statusCode: http.StatusOK,
- },
- {
- name: "connection refused error",
- serverVersions: []string{"version1"},
- sendErr: errors.New("connection refused"),
- expectErr: func(err error) bool { return strings.Contains(err.Error(), "connection refused") },
- statusCode: http.StatusOK,
- },
- {
- name: "discovery fails due to 404 Not Found errors and thus serverVersions is empty, use requested GroupVersion",
- requiredVersion: schema.GroupVersion{Version: "version1"},
- statusCode: http.StatusNotFound,
- },
- }
-
- for _, test := range tests {
- fakeClient := &fake.RESTClient{
- NegotiatedSerializer: scheme.Codecs,
- Resp: &http.Response{
- StatusCode: test.statusCode,
- Body: objBody(&metav1.APIVersions{Versions: test.serverVersions}),
- },
- Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
- if test.sendErr != nil {
- return nil, test.sendErr
- }
- header := http.Header{}
- header.Set("Content-Type", runtime.ContentTypeJSON)
- return &http.Response{StatusCode: test.statusCode, Header: header, Body: objBody(&metav1.APIVersions{Versions: test.serverVersions})}, nil
- }),
- }
- c := discovery.NewDiscoveryClientForConfigOrDie(&restclient.Config{})
- c.RESTClient().(*restclient.RESTClient).Client = fakeClient.Client
- err := discovery.ServerSupportsVersion(c, test.requiredVersion)
- if err == nil && test.expectErr != nil {
- t.Errorf("expected error, got nil for [%s].", test.name)
- }
- if err != nil {
- if test.expectErr == nil || !test.expectErr(err) {
- t.Errorf("unexpected error for [%s]: %v.", test.name, err)
- }
- continue
- }
- }
-}
-
-func TestFilteredBy(t *testing.T) {
- all := discovery.ResourcePredicateFunc(func(gv string, r *metav1.APIResource) bool {
- return true
- })
- none := discovery.ResourcePredicateFunc(func(gv string, r *metav1.APIResource) bool {
- return false
- })
- onlyV2 := discovery.ResourcePredicateFunc(func(gv string, r *metav1.APIResource) bool {
- return strings.HasSuffix(gv, "/v2") || gv == "v2"
- })
- onlyBar := discovery.ResourcePredicateFunc(func(gv string, r *metav1.APIResource) bool {
- return r.Kind == "Bar"
- })
-
- foo := []*metav1.APIResourceList{
- {
- GroupVersion: "foo/v1",
- APIResources: []metav1.APIResource{
- {Name: "bar", Kind: "Bar"},
- {Name: "test", Kind: "Test"},
- },
- },
- {
- GroupVersion: "foo/v2",
- APIResources: []metav1.APIResource{
- {Name: "bar", Kind: "Bar"},
- {Name: "test", Kind: "Test"},
- },
- },
- {
- GroupVersion: "foo/v3",
- APIResources: []metav1.APIResource{},
- },
- }
-
- tests := []struct {
- input []*metav1.APIResourceList
- pred discovery.ResourcePredicate
- expectedResources []string
- }{
- {nil, all, []string{}},
- {[]*metav1.APIResourceList{
- {GroupVersion: "foo/v1"},
- }, all, []string{}},
- {foo, all, []string{"foo/v1.bar", "foo/v1.test", "foo/v2.bar", "foo/v2.test"}},
- {foo, onlyV2, []string{"foo/v2.bar", "foo/v2.test"}},
- {foo, onlyBar, []string{"foo/v1.bar", "foo/v2.bar"}},
- {foo, none, []string{}},
- }
- for i, test := range tests {
- filtered := discovery.FilteredBy(test.pred, test.input)
-
- if expected, got := sets.NewString(test.expectedResources...), sets.NewString(stringify(filtered)...); !expected.Equal(got) {
- t.Errorf("[%d] unexpected group versions: expected=%v, got=%v", i, test.expectedResources, stringify(filtered))
- }
- }
-}
-
-func stringify(rls []*metav1.APIResourceList) []string {
- result := []string{}
- for _, rl := range rls {
- for _, r := range rl.APIResources {
- result = append(result, rl.GroupVersion+"."+r.Name)
- }
- if len(rl.APIResources) == 0 {
- result = append(result, rl.GroupVersion)
- }
- }
- return result
-}
diff --git a/vendor/k8s.io/client-go/discovery/round_tripper_test.go b/vendor/k8s.io/client-go/discovery/round_tripper_test.go
deleted file mode 100644
index b15e2e771..000000000
--- a/vendor/k8s.io/client-go/discovery/round_tripper_test.go
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package discovery
-
-import (
- "bytes"
- "io/ioutil"
- "net/http"
- "net/url"
- "os"
- "testing"
-)
-
-// copied from k8s.io/client-go/transport/round_trippers_test.go
-type testRoundTripper struct {
- Request *http.Request
- Response *http.Response
- Err error
-}
-
-func (rt *testRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
- rt.Request = req
- return rt.Response, rt.Err
-}
-
-func TestCacheRoundTripper(t *testing.T) {
- rt := &testRoundTripper{}
- cacheDir, err := ioutil.TempDir("", "cache-rt")
- defer os.RemoveAll(cacheDir)
- if err != nil {
- t.Fatal(err)
- }
- cache := newCacheRoundTripper(cacheDir, rt)
-
- // First call, caches the response
- req := &http.Request{
- Method: http.MethodGet,
- URL: &url.URL{Host: "localhost"},
- }
- rt.Response = &http.Response{
- Header: http.Header{"ETag": []string{`"123456"`}},
- Body: ioutil.NopCloser(bytes.NewReader([]byte("Content"))),
- StatusCode: http.StatusOK,
- }
- resp, err := cache.RoundTrip(req)
- if err != nil {
- t.Fatal(err)
- }
- content, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- t.Fatal(err)
- }
- if string(content) != "Content" {
- t.Errorf(`Expected Body to be "Content", got %q`, string(content))
- }
-
- // Second call, returns cached response
- req = &http.Request{
- Method: http.MethodGet,
- URL: &url.URL{Host: "localhost"},
- }
- rt.Response = &http.Response{
- StatusCode: http.StatusNotModified,
- Body: ioutil.NopCloser(bytes.NewReader([]byte("Other Content"))),
- }
-
- resp, err = cache.RoundTrip(req)
- if err != nil {
- t.Fatal(err)
- }
-
- // Read body and make sure we have the initial content
- content, err = ioutil.ReadAll(resp.Body)
- resp.Body.Close()
- if err != nil {
- t.Fatal(err)
- }
- if string(content) != "Content" {
- t.Errorf("Invalid content read from cache %q", string(content))
- }
-}
diff --git a/vendor/k8s.io/client-go/plugin/pkg/client/auth/exec/exec_test.go b/vendor/k8s.io/client-go/plugin/pkg/client/auth/exec/exec_test.go
deleted file mode 100644
index e3398e821..000000000
--- a/vendor/k8s.io/client-go/plugin/pkg/client/auth/exec/exec_test.go
+++ /dev/null
@@ -1,748 +0,0 @@
-/*
-Copyright 2018 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package exec
-
-import (
- "bytes"
- "crypto/ecdsa"
- "crypto/elliptic"
- "crypto/rand"
- "crypto/tls"
- "crypto/x509"
- "crypto/x509/pkix"
- "encoding/json"
- "encoding/pem"
- "fmt"
- "io/ioutil"
- "math/big"
- "net/http"
- "net/http/httptest"
- "reflect"
- "strings"
- "testing"
- "time"
-
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/client-go/pkg/apis/clientauthentication"
- "k8s.io/client-go/tools/clientcmd/api"
- "k8s.io/client-go/transport"
-)
-
-var (
- certData = []byte(`-----BEGIN CERTIFICATE-----
-MIIC6jCCAdSgAwIBAgIBCzALBgkqhkiG9w0BAQswIzEhMB8GA1UEAwwYMTAuMTMu
-MTI5LjEwNkAxNDIxMzU5MDU4MB4XDTE1MDExNTIyMDEzMVoXDTE2MDExNTIyMDEz
-MlowGzEZMBcGA1UEAxMQb3BlbnNoaWZ0LWNsaWVudDCCASIwDQYJKoZIhvcNAQEB
-BQADggEPADCCAQoCggEBAKtdhz0+uCLXw5cSYns9rU/XifFSpb/x24WDdrm72S/v
-b9BPYsAStiP148buylr1SOuNi8sTAZmlVDDIpIVwMLff+o2rKYDicn9fjbrTxTOj
-lI4pHJBH+JU3AJ0tbajupioh70jwFS0oYpwtneg2zcnE2Z4l6mhrj2okrc5Q1/X2
-I2HChtIU4JYTisObtin10QKJX01CLfYXJLa8upWzKZ4/GOcHG+eAV3jXWoXidtjb
-1Usw70amoTZ6mIVCkiu1QwCoa8+ycojGfZhvqMsAp1536ZcCul+Na+AbCv4zKS7F
-kQQaImVrXdUiFansIoofGlw/JNuoKK6ssVpS5Ic3pgcCAwEAAaM1MDMwDgYDVR0P
-AQH/BAQDAgCgMBMGA1UdJQQMMAoGCCsGAQUFBwMCMAwGA1UdEwEB/wQCMAAwCwYJ
-KoZIhvcNAQELA4IBAQCKLREH7bXtXtZ+8vI6cjD7W3QikiArGqbl36bAhhWsJLp/
-p/ndKz39iFNaiZ3GlwIURWOOKx3y3GA0x9m8FR+Llthf0EQ8sUjnwaknWs0Y6DQ3
-jjPFZOpV3KPCFrdMJ3++E3MgwFC/Ih/N2ebFX9EcV9Vcc6oVWMdwT0fsrhu683rq
-6GSR/3iVX1G/pmOiuaR0fNUaCyCfYrnI4zHBDgSfnlm3vIvN2lrsR/DQBakNL8DJ
-HBgKxMGeUPoneBv+c8DMXIL0EhaFXRlBv9QW45/GiAIOuyFJ0i6hCtGZpJjq4OpQ
-BRjCI+izPzFTjsxD4aORE+WOkyWFCGPWKfNejfw0
------END CERTIFICATE-----`)
- keyData = []byte(`-----BEGIN RSA PRIVATE KEY-----
-MIIEowIBAAKCAQEAq12HPT64ItfDlxJiez2tT9eJ8VKlv/HbhYN2ubvZL+9v0E9i
-wBK2I/Xjxu7KWvVI642LyxMBmaVUMMikhXAwt9/6jaspgOJyf1+NutPFM6OUjikc
-kEf4lTcAnS1tqO6mKiHvSPAVLShinC2d6DbNycTZniXqaGuPaiStzlDX9fYjYcKG
-0hTglhOKw5u2KfXRAolfTUIt9hcktry6lbMpnj8Y5wcb54BXeNdaheJ22NvVSzDv
-RqahNnqYhUKSK7VDAKhrz7JyiMZ9mG+oywCnXnfplwK6X41r4BsK/jMpLsWRBBoi
-ZWtd1SIVqewiih8aXD8k26gorqyxWlLkhzemBwIDAQABAoIBAD2XYRs3JrGHQUpU
-FkdbVKZkvrSY0vAZOqBTLuH0zUv4UATb8487anGkWBjRDLQCgxH+jucPTrztekQK
-aW94clo0S3aNtV4YhbSYIHWs1a0It0UdK6ID7CmdWkAj6s0T8W8lQT7C46mWYVLm
-5mFnCTHi6aB42jZrqmEpC7sivWwuU0xqj3Ml8kkxQCGmyc9JjmCB4OrFFC8NNt6M
-ObvQkUI6Z3nO4phTbpxkE1/9dT0MmPIF7GhHVzJMS+EyyRYUDllZ0wvVSOM3qZT0
-JMUaBerkNwm9foKJ1+dv2nMKZZbJajv7suUDCfU44mVeaEO+4kmTKSGCGjjTBGkr
-7L1ySDECgYEA5ElIMhpdBzIivCuBIH8LlUeuzd93pqssO1G2Xg0jHtfM4tz7fyeI
-cr90dc8gpli24dkSxzLeg3Tn3wIj/Bu64m2TpZPZEIlukYvgdgArmRIPQVxerYey
-OkrfTNkxU1HXsYjLCdGcGXs5lmb+K/kuTcFxaMOs7jZi7La+jEONwf8CgYEAwCs/
-rUOOA0klDsWWisbivOiNPII79c9McZCNBqncCBfMUoiGe8uWDEO4TFHN60vFuVk9
-8PkwpCfvaBUX+ajvbafIfHxsnfk1M04WLGCeqQ/ym5Q4sQoQOcC1b1y9qc/xEWfg
-nIUuia0ukYRpl7qQa3tNg+BNFyjypW8zukUAC/kCgYB1/Kojuxx5q5/oQVPrx73k
-2bevD+B3c+DYh9MJqSCNwFtUpYIWpggPxoQan4LwdsmO0PKzocb/ilyNFj4i/vII
-NToqSc/WjDFpaDIKyuu9oWfhECye45NqLWhb/6VOuu4QA/Nsj7luMhIBehnEAHW+
-GkzTKM8oD1PxpEG3nPKXYQKBgQC6AuMPRt3XBl1NkCrpSBy/uObFlFaP2Enpf39S
-3OZ0Gv0XQrnSaL1kP8TMcz68rMrGX8DaWYsgytstR4W+jyy7WvZwsUu+GjTJ5aMG
-77uEcEBpIi9CBzivfn7hPccE8ZgqPf+n4i6q66yxBJflW5xhvafJqDtW2LcPNbW/
-bvzdmQKBgExALRUXpq+5dbmkdXBHtvXdRDZ6rVmrnjy4nI5bPw+1GqQqk6uAR6B/
-F6NmLCQOO4PDG/cuatNHIr2FrwTmGdEL6ObLUGWn9Oer9gJhHVqqsY5I4sEPo4XX
-stR0Yiw0buV6DL/moUO0HIM9Bjh96HJp+LxiIS6UCdIhMPp5HoQa
------END RSA PRIVATE KEY-----`)
- validCert *tls.Certificate
-)
-
-func init() {
- cert, err := tls.X509KeyPair(certData, keyData)
- if err != nil {
- panic(err)
- }
- validCert = &cert
-}
-
-func TestCacheKey(t *testing.T) {
- c1 := &api.ExecConfig{
- Command: "foo-bar",
- Args: []string{"1", "2"},
- Env: []api.ExecEnvVar{
- {Name: "3", Value: "4"},
- {Name: "5", Value: "6"},
- {Name: "7", Value: "8"},
- },
- APIVersion: "client.authentication.k8s.io/v1alpha1",
- }
- c2 := &api.ExecConfig{
- Command: "foo-bar",
- Args: []string{"1", "2"},
- Env: []api.ExecEnvVar{
- {Name: "3", Value: "4"},
- {Name: "5", Value: "6"},
- {Name: "7", Value: "8"},
- },
- APIVersion: "client.authentication.k8s.io/v1alpha1",
- }
- c3 := &api.ExecConfig{
- Command: "foo-bar",
- Args: []string{"1", "2"},
- Env: []api.ExecEnvVar{
- {Name: "3", Value: "4"},
- {Name: "5", Value: "6"},
- },
- APIVersion: "client.authentication.k8s.io/v1alpha1",
- }
- key1 := cacheKey(c1)
- key2 := cacheKey(c2)
- key3 := cacheKey(c3)
- if key1 != key2 {
- t.Error("key1 and key2 didn't match")
- }
- if key1 == key3 {
- t.Error("key1 and key3 matched")
- }
- if key2 == key3 {
- t.Error("key2 and key3 matched")
- }
-}
-
-func compJSON(t *testing.T, got, want []byte) {
- t.Helper()
- gotJSON := &bytes.Buffer{}
- wantJSON := &bytes.Buffer{}
-
- if err := json.Indent(gotJSON, got, "", " "); err != nil {
- t.Errorf("got invalid JSON: %v", err)
- }
- if err := json.Indent(wantJSON, want, "", " "); err != nil {
- t.Errorf("want invalid JSON: %v", err)
- }
- g := strings.TrimSpace(gotJSON.String())
- w := strings.TrimSpace(wantJSON.String())
- if g != w {
- t.Errorf("wanted %q, got %q", w, g)
- }
-}
-
-func TestRefreshCreds(t *testing.T) {
- tests := []struct {
- name string
- config api.ExecConfig
- output string
- interactive bool
- response *clientauthentication.Response
- wantInput string
- wantCreds credentials
- wantExpiry time.Time
- wantErr bool
- }{
- {
- name: "basic-request",
- config: api.ExecConfig{
- APIVersion: "client.authentication.k8s.io/v1alpha1",
- },
- wantInput: `{
- "kind":"ExecCredential",
- "apiVersion":"client.authentication.k8s.io/v1alpha1",
- "spec": {}
- }`,
- output: `{
- "kind": "ExecCredential",
- "apiVersion": "client.authentication.k8s.io/v1alpha1",
- "status": {
- "token": "foo-bar"
- }
- }`,
- wantCreds: credentials{token: "foo-bar"},
- },
- {
- name: "interactive",
- config: api.ExecConfig{
- APIVersion: "client.authentication.k8s.io/v1alpha1",
- },
- interactive: true,
- wantInput: `{
- "kind":"ExecCredential",
- "apiVersion":"client.authentication.k8s.io/v1alpha1",
- "spec": {
- "interactive": true
- }
- }`,
- output: `{
- "kind": "ExecCredential",
- "apiVersion": "client.authentication.k8s.io/v1alpha1",
- "status": {
- "token": "foo-bar"
- }
- }`,
- wantCreds: credentials{token: "foo-bar"},
- },
- {
- name: "response",
- config: api.ExecConfig{
- APIVersion: "client.authentication.k8s.io/v1alpha1",
- },
- response: &clientauthentication.Response{
- Header: map[string][]string{
- "WWW-Authenticate": {`Basic realm="Access to the staging site", charset="UTF-8"`},
- },
- Code: 401,
- },
- wantInput: `{
- "kind":"ExecCredential",
- "apiVersion":"client.authentication.k8s.io/v1alpha1",
- "spec": {
- "response": {
- "header": {
- "WWW-Authenticate": [
- "Basic realm=\"Access to the staging site\", charset=\"UTF-8\""
- ]
- },
- "code": 401
- }
- }
- }`,
- output: `{
- "kind": "ExecCredential",
- "apiVersion": "client.authentication.k8s.io/v1alpha1",
- "status": {
- "token": "foo-bar"
- }
- }`,
- wantCreds: credentials{token: "foo-bar"},
- },
- {
- name: "expiry",
- config: api.ExecConfig{
- APIVersion: "client.authentication.k8s.io/v1alpha1",
- },
- wantInput: `{
- "kind":"ExecCredential",
- "apiVersion":"client.authentication.k8s.io/v1alpha1",
- "spec": {}
- }`,
- output: `{
- "kind": "ExecCredential",
- "apiVersion": "client.authentication.k8s.io/v1alpha1",
- "status": {
- "token": "foo-bar",
- "expirationTimestamp": "2006-01-02T15:04:05Z"
- }
- }`,
- wantExpiry: time.Date(2006, 01, 02, 15, 04, 05, 0, time.UTC),
- wantCreds: credentials{token: "foo-bar"},
- },
- {
- name: "no-group-version",
- config: api.ExecConfig{
- APIVersion: "client.authentication.k8s.io/v1alpha1",
- },
- wantInput: `{
- "kind":"ExecCredential",
- "apiVersion":"client.authentication.k8s.io/v1alpha1",
- "spec": {}
- }`,
- output: `{
- "kind": "ExecCredential",
- "status": {
- "token": "foo-bar"
- }
- }`,
- wantErr: true,
- },
- {
- name: "no-status",
- config: api.ExecConfig{
- APIVersion: "client.authentication.k8s.io/v1alpha1",
- },
- wantInput: `{
- "kind":"ExecCredential",
- "apiVersion":"client.authentication.k8s.io/v1alpha1",
- "spec": {}
- }`,
- output: `{
- "kind": "ExecCredential",
- "apiVersion":"client.authentication.k8s.io/v1alpha1"
- }`,
- wantErr: true,
- },
- {
- name: "no-creds",
- config: api.ExecConfig{
- APIVersion: "client.authentication.k8s.io/v1alpha1",
- },
- wantInput: `{
- "kind":"ExecCredential",
- "apiVersion":"client.authentication.k8s.io/v1alpha1",
- "spec": {}
- }`,
- output: `{
- "kind": "ExecCredential",
- "apiVersion":"client.authentication.k8s.io/v1alpha1",
- "status": {}
- }`,
- wantErr: true,
- },
- {
- name: "TLS credentials",
- config: api.ExecConfig{
- APIVersion: "client.authentication.k8s.io/v1alpha1",
- },
- wantInput: `{
- "kind":"ExecCredential",
- "apiVersion":"client.authentication.k8s.io/v1alpha1",
- "spec": {}
- }`,
- output: fmt.Sprintf(`{
- "kind": "ExecCredential",
- "apiVersion": "client.authentication.k8s.io/v1alpha1",
- "status": {
- "clientKeyData": %q,
- "clientCertificateData": %q
- }
- }`, keyData, certData),
- wantCreds: credentials{cert: validCert},
- },
- {
- name: "bad TLS credentials",
- config: api.ExecConfig{
- APIVersion: "client.authentication.k8s.io/v1alpha1",
- },
- wantInput: `{
- "kind":"ExecCredential",
- "apiVersion":"client.authentication.k8s.io/v1alpha1",
- "spec": {}
- }`,
- output: `{
- "kind": "ExecCredential",
- "apiVersion": "client.authentication.k8s.io/v1alpha1",
- "status": {
- "clientKeyData": "foo",
- "clientCertificateData": "bar"
- }
- }`,
- wantErr: true,
- },
- {
- name: "cert but no key",
- config: api.ExecConfig{
- APIVersion: "client.authentication.k8s.io/v1alpha1",
- },
- wantInput: `{
- "kind":"ExecCredential",
- "apiVersion":"client.authentication.k8s.io/v1alpha1",
- "spec": {}
- }`,
- output: fmt.Sprintf(`{
- "kind": "ExecCredential",
- "apiVersion": "client.authentication.k8s.io/v1alpha1",
- "status": {
- "clientCertificateData": %q
- }
- }`, certData),
- wantErr: true,
- },
- {
- name: "beta-basic-request",
- config: api.ExecConfig{
- APIVersion: "client.authentication.k8s.io/v1beta1",
- },
- output: `{
- "kind": "ExecCredential",
- "apiVersion": "client.authentication.k8s.io/v1beta1",
- "status": {
- "token": "foo-bar"
- }
- }`,
- wantCreds: credentials{token: "foo-bar"},
- },
- {
- name: "beta-expiry",
- config: api.ExecConfig{
- APIVersion: "client.authentication.k8s.io/v1beta1",
- },
- output: `{
- "kind": "ExecCredential",
- "apiVersion": "client.authentication.k8s.io/v1beta1",
- "status": {
- "token": "foo-bar",
- "expirationTimestamp": "2006-01-02T15:04:05Z"
- }
- }`,
- wantExpiry: time.Date(2006, 01, 02, 15, 04, 05, 0, time.UTC),
- wantCreds: credentials{token: "foo-bar"},
- },
- {
- name: "beta-no-group-version",
- config: api.ExecConfig{
- APIVersion: "client.authentication.k8s.io/v1beta1",
- },
- output: `{
- "kind": "ExecCredential",
- "status": {
- "token": "foo-bar"
- }
- }`,
- wantErr: true,
- },
- {
- name: "beta-no-status",
- config: api.ExecConfig{
- APIVersion: "client.authentication.k8s.io/v1beta1",
- },
- output: `{
- "kind": "ExecCredential",
- "apiVersion":"client.authentication.k8s.io/v1beta1"
- }`,
- wantErr: true,
- },
- {
- name: "beta-no-token",
- config: api.ExecConfig{
- APIVersion: "client.authentication.k8s.io/v1beta1",
- },
- output: `{
- "kind": "ExecCredential",
- "apiVersion":"client.authentication.k8s.io/v1beta1",
- "status": {}
- }`,
- wantErr: true,
- },
- }
-
- for _, test := range tests {
- t.Run(test.name, func(t *testing.T) {
- c := test.config
-
- c.Command = "./testdata/test-plugin.sh"
- c.Env = append(c.Env, api.ExecEnvVar{
- Name: "TEST_OUTPUT",
- Value: test.output,
- })
-
- a, err := newAuthenticator(newCache(), &c)
- if err != nil {
- t.Fatal(err)
- }
-
- stderr := &bytes.Buffer{}
- a.stderr = stderr
- a.interactive = test.interactive
- a.environ = func() []string { return nil }
-
- if err := a.refreshCredsLocked(test.response); err != nil {
- if !test.wantErr {
- t.Errorf("get token %v", err)
- }
- return
- }
- if test.wantErr {
- t.Fatal("expected error getting token")
- }
-
- if !reflect.DeepEqual(a.cachedCreds, &test.wantCreds) {
- t.Errorf("expected credentials %+v got %+v", &test.wantCreds, a.cachedCreds)
- }
-
- if !a.exp.Equal(test.wantExpiry) {
- t.Errorf("expected expiry %v got %v", test.wantExpiry, a.exp)
- }
-
- if test.wantInput == "" {
- if got := strings.TrimSpace(stderr.String()); got != "" {
- t.Errorf("expected no input parameters, got %q", got)
- }
- return
- }
-
- compJSON(t, stderr.Bytes(), []byte(test.wantInput))
- })
- }
-}
-
-func TestRoundTripper(t *testing.T) {
- wantToken := ""
-
- n := time.Now()
- now := func() time.Time { return n }
-
- env := []string{""}
- environ := func() []string {
- s := make([]string, len(env))
- copy(s, env)
- return s
- }
-
- setOutput := func(s string) {
- env[0] = "TEST_OUTPUT=" + s
- }
-
- handler := func(w http.ResponseWriter, r *http.Request) {
- gotToken := ""
- parts := strings.Split(r.Header.Get("Authorization"), " ")
- if len(parts) > 1 && strings.EqualFold(parts[0], "bearer") {
- gotToken = parts[1]
- }
-
- if wantToken != gotToken {
- http.Error(w, "Unauthorized", http.StatusUnauthorized)
- return
- }
- fmt.Fprintln(w, "ok")
- }
- server := httptest.NewServer(http.HandlerFunc(handler))
-
- c := api.ExecConfig{
- Command: "./testdata/test-plugin.sh",
- APIVersion: "client.authentication.k8s.io/v1alpha1",
- }
- a, err := newAuthenticator(newCache(), &c)
- if err != nil {
- t.Fatal(err)
- }
- a.environ = environ
- a.now = now
- a.stderr = ioutil.Discard
-
- tc := &transport.Config{}
- if err := a.UpdateTransportConfig(tc); err != nil {
- t.Fatal(err)
- }
- client := http.Client{
- Transport: tc.WrapTransport(http.DefaultTransport),
- }
-
- get := func(t *testing.T, statusCode int) {
- t.Helper()
- resp, err := client.Get(server.URL)
- if err != nil {
- t.Fatal(err)
- }
- defer resp.Body.Close()
- if resp.StatusCode != statusCode {
- t.Errorf("wanted status %d got %d", statusCode, resp.StatusCode)
- }
- }
-
- setOutput(`{
- "kind": "ExecCredential",
- "apiVersion": "client.authentication.k8s.io/v1alpha1",
- "status": {
- "token": "token1"
- }
- }`)
- wantToken = "token1"
- get(t, http.StatusOK)
-
- setOutput(`{
- "kind": "ExecCredential",
- "apiVersion": "client.authentication.k8s.io/v1alpha1",
- "status": {
- "token": "token2"
- }
- }`)
- // Previous token should be cached
- get(t, http.StatusOK)
-
- wantToken = "token2"
- // Token is still cached, hits unauthorized but causes token to rotate.
- get(t, http.StatusUnauthorized)
- // Follow up request uses the rotated token.
- get(t, http.StatusOK)
-
- setOutput(`{
- "kind": "ExecCredential",
- "apiVersion": "client.authentication.k8s.io/v1alpha1",
- "status": {
- "token": "token3",
- "expirationTimestamp": "` + now().Add(time.Hour).Format(time.RFC3339Nano) + `"
- }
- }`)
- wantToken = "token3"
- // Token is still cached, hit's unauthorized but causes rotation to token with an expiry.
- get(t, http.StatusUnauthorized)
- get(t, http.StatusOK)
-
- // Move time forward 2 hours, "token3" is now expired.
- n = n.Add(time.Hour * 2)
- setOutput(`{
- "kind": "ExecCredential",
- "apiVersion": "client.authentication.k8s.io/v1alpha1",
- "status": {
- "token": "token4",
- "expirationTimestamp": "` + now().Add(time.Hour).Format(time.RFC3339Nano) + `"
- }
- }`)
- wantToken = "token4"
- // Old token is expired, should refresh automatically without hitting a 401.
- get(t, http.StatusOK)
-}
-
-func TestTLSCredentials(t *testing.T) {
- now := time.Now()
-
- certPool := x509.NewCertPool()
- cert, key := genClientCert(t)
- if !certPool.AppendCertsFromPEM(cert) {
- t.Fatal("failed to add client cert to CertPool")
- }
-
- server := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- fmt.Fprintln(w, "ok")
- }))
- server.TLS = &tls.Config{
- ClientAuth: tls.RequireAndVerifyClientCert,
- ClientCAs: certPool,
- }
- server.StartTLS()
- defer server.Close()
-
- a, err := newAuthenticator(newCache(), &api.ExecConfig{
- Command: "./testdata/test-plugin.sh",
- APIVersion: "client.authentication.k8s.io/v1alpha1",
- })
- if err != nil {
- t.Fatal(err)
- }
- var output *clientauthentication.ExecCredential
- a.environ = func() []string {
- data, err := runtime.Encode(codecs.LegacyCodec(a.group), output)
- if err != nil {
- t.Fatal(err)
- }
- return []string{"TEST_OUTPUT=" + string(data)}
- }
- a.now = func() time.Time { return now }
- a.stderr = ioutil.Discard
-
- // We're not interested in server's cert, this test is about client cert.
- tc := &transport.Config{TLS: transport.TLSConfig{Insecure: true}}
- if err := a.UpdateTransportConfig(tc); err != nil {
- t.Fatal(err)
- }
-
- get := func(t *testing.T, desc string, wantErr bool) {
- t.Run(desc, func(t *testing.T) {
- tlsCfg, err := transport.TLSConfigFor(tc)
- if err != nil {
- t.Fatal("TLSConfigFor:", err)
- }
- client := http.Client{
- Transport: &http.Transport{TLSClientConfig: tlsCfg},
- }
- resp, err := client.Get(server.URL)
- switch {
- case err != nil && !wantErr:
- t.Errorf("got client.Get error: %q, want nil", err)
- case err == nil && wantErr:
- t.Error("got nil client.Get error, want non-nil")
- }
- if err == nil {
- resp.Body.Close()
- }
- })
- }
-
- output = &clientauthentication.ExecCredential{
- Status: &clientauthentication.ExecCredentialStatus{
- ClientCertificateData: string(cert),
- ClientKeyData: string(key),
- ExpirationTimestamp: &v1.Time{now.Add(time.Hour)},
- },
- }
- get(t, "valid TLS cert", false)
-
- // Advance time to force re-exec.
- nCert, nKey := genClientCert(t)
- now = now.Add(time.Hour * 2)
- output = &clientauthentication.ExecCredential{
- Status: &clientauthentication.ExecCredentialStatus{
- ClientCertificateData: string(nCert),
- ClientKeyData: string(nKey),
- ExpirationTimestamp: &v1.Time{now.Add(time.Hour)},
- },
- }
- get(t, "untrusted TLS cert", true)
-
- now = now.Add(time.Hour * 2)
- output = &clientauthentication.ExecCredential{
- Status: &clientauthentication.ExecCredentialStatus{
- ClientCertificateData: string(cert),
- ClientKeyData: string(key),
- ExpirationTimestamp: &v1.Time{now.Add(time.Hour)},
- },
- }
- get(t, "valid TLS cert again", false)
-}
-
-// genClientCert generates an x509 certificate for testing. Certificate and key
-// are returned in PEM encoding.
-func genClientCert(t *testing.T) ([]byte, []byte) {
- key, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
- if err != nil {
- t.Fatal(err)
- }
- keyRaw, err := x509.MarshalECPrivateKey(key)
- if err != nil {
- t.Fatal(err)
- }
- serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128)
- serialNumber, err := rand.Int(rand.Reader, serialNumberLimit)
- if err != nil {
- t.Fatal(err)
- }
- cert := &x509.Certificate{
- SerialNumber: serialNumber,
- Subject: pkix.Name{Organization: []string{"Acme Co"}},
- NotBefore: time.Now(),
- NotAfter: time.Now().Add(24 * time.Hour),
-
- KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,
- ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth},
- BasicConstraintsValid: true,
- }
- certRaw, err := x509.CreateCertificate(rand.Reader, cert, cert, key.Public(), key)
- if err != nil {
- t.Fatal(err)
- }
- return pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: certRaw}),
- pem.EncodeToMemory(&pem.Block{Type: "PRIVATE KEY", Bytes: keyRaw})
-}
diff --git a/vendor/k8s.io/client-go/rest/client_test.go b/vendor/k8s.io/client-go/rest/client_test.go
deleted file mode 100644
index 2eae9be2d..000000000
--- a/vendor/k8s.io/client-go/rest/client_test.go
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package rest
-
-import (
- "net/http"
- "net/http/httptest"
- "net/url"
- "os"
- "reflect"
- "testing"
- "time"
-
- "fmt"
-
- "k8s.io/api/core/v1"
- v1beta1 "k8s.io/api/extensions/v1beta1"
- "k8s.io/apimachinery/pkg/api/errors"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/serializer"
- "k8s.io/apimachinery/pkg/types"
- "k8s.io/apimachinery/pkg/util/diff"
- "k8s.io/client-go/kubernetes/scheme"
- utiltesting "k8s.io/client-go/util/testing"
-)
-
-type TestParam struct {
- actualError error
- expectingError bool
- actualCreated bool
- expCreated bool
- expStatus *metav1.Status
- testBody bool
- testBodyErrorIsNotNil bool
-}
-
-// TestSerializer makes sure that you're always able to decode metav1.Status
-func TestSerializer(t *testing.T) {
- gv := v1beta1.SchemeGroupVersion
- contentConfig := ContentConfig{
- ContentType: "application/json",
- GroupVersion: &gv,
- NegotiatedSerializer: serializer.DirectCodecFactory{CodecFactory: scheme.Codecs},
- }
-
- serializer, err := createSerializers(contentConfig)
- if err != nil {
- t.Fatal(err)
- }
- // bytes based on actual return from API server when encoding an "unversioned" object
- obj, err := runtime.Decode(serializer.Decoder, []byte(`{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Success"}`))
- t.Log(obj)
- if err != nil {
- t.Fatal(err)
- }
-}
-
-func TestDoRequestSuccess(t *testing.T) {
- testServer, fakeHandler, status := testServerEnv(t, 200)
- defer testServer.Close()
-
- c, err := restClient(testServer)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- body, err := c.Get().Prefix("test").Do().Raw()
-
- testParam := TestParam{actualError: err, expectingError: false, expCreated: true,
- expStatus: status, testBody: true, testBodyErrorIsNotNil: false}
- validate(testParam, t, body, fakeHandler)
-}
-
-func TestDoRequestFailed(t *testing.T) {
- status := &metav1.Status{
- Code: http.StatusNotFound,
- Status: metav1.StatusFailure,
- Reason: metav1.StatusReasonNotFound,
- Message: " \"\" not found",
- Details: &metav1.StatusDetails{},
- }
- expectedBody, _ := runtime.Encode(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), status)
- fakeHandler := utiltesting.FakeHandler{
- StatusCode: 404,
- ResponseBody: string(expectedBody),
- T: t,
- }
- testServer := httptest.NewServer(&fakeHandler)
- defer testServer.Close()
-
- c, err := restClient(testServer)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- err = c.Get().Do().Error()
- if err == nil {
- t.Errorf("unexpected non-error")
- }
- ss, ok := err.(errors.APIStatus)
- if !ok {
- t.Errorf("unexpected error type %v", err)
- }
- actual := ss.Status()
- if !reflect.DeepEqual(status, &actual) {
- t.Errorf("Unexpected mis-match: %s", diff.ObjectReflectDiff(status, &actual))
- }
-}
-
-func TestDoRawRequestFailed(t *testing.T) {
- status := &metav1.Status{
- Code: http.StatusNotFound,
- Status: metav1.StatusFailure,
- Reason: metav1.StatusReasonNotFound,
- Message: "the server could not find the requested resource",
- Details: &metav1.StatusDetails{
- Causes: []metav1.StatusCause{
- {Type: metav1.CauseTypeUnexpectedServerResponse, Message: "unknown"},
- },
- },
- }
- expectedBody, _ := runtime.Encode(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), status)
- fakeHandler := utiltesting.FakeHandler{
- StatusCode: 404,
- ResponseBody: string(expectedBody),
- T: t,
- }
- testServer := httptest.NewServer(&fakeHandler)
- defer testServer.Close()
-
- c, err := restClient(testServer)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- body, err := c.Get().Do().Raw()
-
- if err == nil || body == nil {
- t.Errorf("unexpected non-error: %#v", body)
- }
- ss, ok := err.(errors.APIStatus)
- if !ok {
- t.Errorf("unexpected error type %v", err)
- }
- actual := ss.Status()
- if !reflect.DeepEqual(status, &actual) {
- t.Errorf("Unexpected mis-match: %s", diff.ObjectReflectDiff(status, &actual))
- }
-}
-
-func TestDoRequestCreated(t *testing.T) {
- testServer, fakeHandler, status := testServerEnv(t, 201)
- defer testServer.Close()
-
- c, err := restClient(testServer)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- created := false
- body, err := c.Get().Prefix("test").Do().WasCreated(&created).Raw()
-
- testParam := TestParam{actualError: err, expectingError: false, expCreated: true,
- expStatus: status, testBody: false}
- validate(testParam, t, body, fakeHandler)
-}
-
-func TestDoRequestNotCreated(t *testing.T) {
- testServer, fakeHandler, expectedStatus := testServerEnv(t, 202)
- defer testServer.Close()
- c, err := restClient(testServer)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- created := false
- body, err := c.Get().Prefix("test").Do().WasCreated(&created).Raw()
- testParam := TestParam{actualError: err, expectingError: false, expCreated: false,
- expStatus: expectedStatus, testBody: false}
- validate(testParam, t, body, fakeHandler)
-}
-
-func TestDoRequestAcceptedNoContentReturned(t *testing.T) {
- testServer, fakeHandler, _ := testServerEnv(t, 204)
- defer testServer.Close()
-
- c, err := restClient(testServer)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- created := false
- body, err := c.Get().Prefix("test").Do().WasCreated(&created).Raw()
- testParam := TestParam{actualError: err, expectingError: false, expCreated: false,
- testBody: false}
- validate(testParam, t, body, fakeHandler)
-}
-
-func TestBadRequest(t *testing.T) {
- testServer, fakeHandler, _ := testServerEnv(t, 400)
- defer testServer.Close()
- c, err := restClient(testServer)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- created := false
- body, err := c.Get().Prefix("test").Do().WasCreated(&created).Raw()
- testParam := TestParam{actualError: err, expectingError: true, expCreated: false,
- testBody: true}
- validate(testParam, t, body, fakeHandler)
-}
-
-func validate(testParam TestParam, t *testing.T, body []byte, fakeHandler *utiltesting.FakeHandler) {
- switch {
- case testParam.expectingError && testParam.actualError == nil:
- t.Errorf("Expected error")
- case !testParam.expectingError && testParam.actualError != nil:
- t.Error(testParam.actualError)
- }
- if !testParam.expCreated {
- if testParam.actualCreated {
- t.Errorf("Expected object not to be created")
- }
- }
- statusOut, err := runtime.Decode(scheme.Codecs.UniversalDeserializer(), body)
- if testParam.testBody {
- if testParam.testBodyErrorIsNotNil && err == nil {
- t.Errorf("Expected Error")
- }
- if !testParam.testBodyErrorIsNotNil && err != nil {
- t.Errorf("Unexpected Error: %v", err)
- }
- }
-
- if testParam.expStatus != nil {
- if !reflect.DeepEqual(testParam.expStatus, statusOut) {
- t.Errorf("Unexpected mis-match. Expected %#v. Saw %#v", testParam.expStatus, statusOut)
- }
- }
- fakeHandler.ValidateRequest(t, "/"+v1.SchemeGroupVersion.String()+"/test", "GET", nil)
-
-}
-
-func TestHttpMethods(t *testing.T) {
- testServer, _, _ := testServerEnv(t, 200)
- defer testServer.Close()
- c, _ := restClient(testServer)
-
- request := c.Post()
- if request == nil {
- t.Errorf("Post : Object returned should not be nil")
- }
-
- request = c.Get()
- if request == nil {
- t.Errorf("Get: Object returned should not be nil")
- }
-
- request = c.Put()
- if request == nil {
- t.Errorf("Put : Object returned should not be nil")
- }
-
- request = c.Delete()
- if request == nil {
- t.Errorf("Delete : Object returned should not be nil")
- }
-
- request = c.Patch(types.JSONPatchType)
- if request == nil {
- t.Errorf("Patch : Object returned should not be nil")
- }
-}
-
-func TestCreateBackoffManager(t *testing.T) {
-
- theUrl, _ := url.Parse("http://localhost")
-
- // 1 second base backoff + duration of 2 seconds -> exponential backoff for requests.
- os.Setenv(envBackoffBase, "1")
- os.Setenv(envBackoffDuration, "2")
- backoff := readExpBackoffConfig()
- backoff.UpdateBackoff(theUrl, nil, 500)
- backoff.UpdateBackoff(theUrl, nil, 500)
- if backoff.CalculateBackoff(theUrl)/time.Second != 2 {
- t.Errorf("Backoff env not working.")
- }
-
- // 0 duration -> no backoff.
- os.Setenv(envBackoffBase, "1")
- os.Setenv(envBackoffDuration, "0")
- backoff.UpdateBackoff(theUrl, nil, 500)
- backoff.UpdateBackoff(theUrl, nil, 500)
- backoff = readExpBackoffConfig()
- if backoff.CalculateBackoff(theUrl)/time.Second != 0 {
- t.Errorf("Zero backoff duration, but backoff still occurring.")
- }
-
- // No env -> No backoff.
- os.Setenv(envBackoffBase, "")
- os.Setenv(envBackoffDuration, "")
- backoff = readExpBackoffConfig()
- backoff.UpdateBackoff(theUrl, nil, 500)
- backoff.UpdateBackoff(theUrl, nil, 500)
- if backoff.CalculateBackoff(theUrl)/time.Second != 0 {
- t.Errorf("Backoff should have been 0.")
- }
-
-}
-
-func testServerEnv(t *testing.T, statusCode int) (*httptest.Server, *utiltesting.FakeHandler, *metav1.Status) {
- status := &metav1.Status{TypeMeta: metav1.TypeMeta{APIVersion: "v1", Kind: "Status"}, Status: fmt.Sprintf("%s", metav1.StatusSuccess)}
- expectedBody, _ := runtime.Encode(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), status)
- fakeHandler := utiltesting.FakeHandler{
- StatusCode: statusCode,
- ResponseBody: string(expectedBody),
- T: t,
- }
- testServer := httptest.NewServer(&fakeHandler)
- return testServer, &fakeHandler, status
-}
-
-func restClient(testServer *httptest.Server) (*RESTClient, error) {
- c, err := RESTClientFor(&Config{
- Host: testServer.URL,
- ContentConfig: ContentConfig{
- GroupVersion: &v1.SchemeGroupVersion,
- NegotiatedSerializer: serializer.DirectCodecFactory{CodecFactory: scheme.Codecs},
- },
- Username: "user",
- Password: "pass",
- })
- return c, err
-}
diff --git a/vendor/k8s.io/client-go/rest/config_test.go b/vendor/k8s.io/client-go/rest/config_test.go
deleted file mode 100644
index 347864285..000000000
--- a/vendor/k8s.io/client-go/rest/config_test.go
+++ /dev/null
@@ -1,375 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package rest
-
-import (
- "context"
- "errors"
- "io"
- "net"
- "net/http"
- "path/filepath"
- "reflect"
- "strings"
- "testing"
-
- "k8s.io/api/core/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/util/diff"
- "k8s.io/client-go/kubernetes/scheme"
- clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
- "k8s.io/client-go/util/flowcontrol"
-
- fuzz "github.com/google/gofuzz"
- "github.com/stretchr/testify/assert"
-)
-
-func TestIsConfigTransportTLS(t *testing.T) {
- testCases := []struct {
- Config *Config
- TransportTLS bool
- }{
- {
- Config: &Config{},
- TransportTLS: false,
- },
- {
- Config: &Config{
- Host: "https://localhost",
- },
- TransportTLS: true,
- },
- {
- Config: &Config{
- Host: "localhost",
- TLSClientConfig: TLSClientConfig{
- CertFile: "foo",
- },
- },
- TransportTLS: true,
- },
- {
- Config: &Config{
- Host: "///:://localhost",
- TLSClientConfig: TLSClientConfig{
- CertFile: "foo",
- },
- },
- TransportTLS: false,
- },
- {
- Config: &Config{
- Host: "1.2.3.4:567",
- TLSClientConfig: TLSClientConfig{
- Insecure: true,
- },
- },
- TransportTLS: true,
- },
- }
- for _, testCase := range testCases {
- if err := SetKubernetesDefaults(testCase.Config); err != nil {
- t.Errorf("setting defaults failed for %#v: %v", testCase.Config, err)
- continue
- }
- useTLS := IsConfigTransportTLS(*testCase.Config)
- if testCase.TransportTLS != useTLS {
- t.Errorf("expected %v for %#v", testCase.TransportTLS, testCase.Config)
- }
- }
-}
-
-func TestSetKubernetesDefaultsUserAgent(t *testing.T) {
- config := &Config{}
- if err := SetKubernetesDefaults(config); err != nil {
- t.Errorf("unexpected error: %v", err)
- }
- if !strings.Contains(config.UserAgent, "kubernetes/") {
- t.Errorf("no user agent set: %#v", config)
- }
-}
-
-func TestAdjustVersion(t *testing.T) {
- assert := assert.New(t)
- assert.Equal("1.2.3", adjustVersion("1.2.3-alpha4"))
- assert.Equal("1.2.3", adjustVersion("1.2.3-alpha"))
- assert.Equal("1.2.3", adjustVersion("1.2.3"))
- assert.Equal("unknown", adjustVersion(""))
-}
-
-func TestAdjustCommit(t *testing.T) {
- assert := assert.New(t)
- assert.Equal("1234567", adjustCommit("1234567890"))
- assert.Equal("123456", adjustCommit("123456"))
- assert.Equal("unknown", adjustCommit(""))
-}
-
-func TestAdjustCommand(t *testing.T) {
- assert := assert.New(t)
- assert.Equal("beans", adjustCommand(filepath.Join("home", "bob", "Downloads", "beans")))
- assert.Equal("beans", adjustCommand(filepath.Join(".", "beans")))
- assert.Equal("beans", adjustCommand("beans"))
- assert.Equal("unknown", adjustCommand(""))
-}
-
-func TestBuildUserAgent(t *testing.T) {
- assert.New(t).Equal(
- "lynx/nicest (beos/itanium) kubernetes/baaaaaaaaad",
- buildUserAgent(
- "lynx", "nicest",
- "beos", "itanium", "baaaaaaaaad"))
-}
-
-// This function untestable since it doesn't accept arguments.
-func TestDefaultKubernetesUserAgent(t *testing.T) {
- assert.New(t).Contains(DefaultKubernetesUserAgent(), "kubernetes")
-}
-
-func TestRESTClientRequires(t *testing.T) {
- if _, err := RESTClientFor(&Config{Host: "127.0.0.1", ContentConfig: ContentConfig{NegotiatedSerializer: scheme.Codecs}}); err == nil {
- t.Errorf("unexpected non-error")
- }
- if _, err := RESTClientFor(&Config{Host: "127.0.0.1", ContentConfig: ContentConfig{GroupVersion: &v1.SchemeGroupVersion}}); err == nil {
- t.Errorf("unexpected non-error")
- }
- if _, err := RESTClientFor(&Config{Host: "127.0.0.1", ContentConfig: ContentConfig{GroupVersion: &v1.SchemeGroupVersion, NegotiatedSerializer: scheme.Codecs}}); err != nil {
- t.Errorf("unexpected error: %v", err)
- }
-}
-
-type fakeLimiter struct {
- FakeSaturation float64
- FakeQPS float32
-}
-
-func (t *fakeLimiter) TryAccept() bool {
- return true
-}
-
-func (t *fakeLimiter) Saturation() float64 {
- return t.FakeSaturation
-}
-
-func (t *fakeLimiter) QPS() float32 {
- return t.FakeQPS
-}
-
-func (t *fakeLimiter) Stop() {}
-
-func (t *fakeLimiter) Accept() {}
-
-type fakeCodec struct{}
-
-func (c *fakeCodec) Decode([]byte, *schema.GroupVersionKind, runtime.Object) (runtime.Object, *schema.GroupVersionKind, error) {
- return nil, nil, nil
-}
-
-func (c *fakeCodec) Encode(obj runtime.Object, stream io.Writer) error {
- return nil
-}
-
-type fakeRoundTripper struct{}
-
-func (r *fakeRoundTripper) RoundTrip(*http.Request) (*http.Response, error) {
- return nil, nil
-}
-
-var fakeWrapperFunc = func(http.RoundTripper) http.RoundTripper {
- return &fakeRoundTripper{}
-}
-
-type fakeNegotiatedSerializer struct{}
-
-func (n *fakeNegotiatedSerializer) SupportedMediaTypes() []runtime.SerializerInfo {
- return nil
-}
-
-func (n *fakeNegotiatedSerializer) EncoderForVersion(serializer runtime.Encoder, gv runtime.GroupVersioner) runtime.Encoder {
- return &fakeCodec{}
-}
-
-func (n *fakeNegotiatedSerializer) DecoderToVersion(serializer runtime.Decoder, gv runtime.GroupVersioner) runtime.Decoder {
- return &fakeCodec{}
-}
-
-var fakeDialFunc = func(ctx context.Context, network, addr string) (net.Conn, error) {
- return nil, fakeDialerError
-}
-var fakeDialerError = errors.New("fakedialer")
-
-type fakeAuthProviderConfigPersister struct{}
-
-func (fakeAuthProviderConfigPersister) Persist(map[string]string) error {
- return fakeAuthProviderConfigPersisterError
-}
-
-var fakeAuthProviderConfigPersisterError = errors.New("fakeAuthProviderConfigPersisterError")
-
-func TestAnonymousConfig(t *testing.T) {
- f := fuzz.New().NilChance(0.0).NumElements(1, 1)
- f.Funcs(
- func(r *runtime.Codec, f fuzz.Continue) {
- codec := &fakeCodec{}
- f.Fuzz(codec)
- *r = codec
- },
- func(r *http.RoundTripper, f fuzz.Continue) {
- roundTripper := &fakeRoundTripper{}
- f.Fuzz(roundTripper)
- *r = roundTripper
- },
- func(fn *func(http.RoundTripper) http.RoundTripper, f fuzz.Continue) {
- *fn = fakeWrapperFunc
- },
- func(r *runtime.NegotiatedSerializer, f fuzz.Continue) {
- serializer := &fakeNegotiatedSerializer{}
- f.Fuzz(serializer)
- *r = serializer
- },
- func(r *flowcontrol.RateLimiter, f fuzz.Continue) {
- limiter := &fakeLimiter{}
- f.Fuzz(limiter)
- *r = limiter
- },
- // Authentication does not require fuzzer
- func(r *AuthProviderConfigPersister, f fuzz.Continue) {},
- func(r *clientcmdapi.AuthProviderConfig, f fuzz.Continue) {
- r.Config = map[string]string{}
- },
- // Dial does not require fuzzer
- func(r *func(ctx context.Context, network, addr string) (net.Conn, error), f fuzz.Continue) {},
- )
- for i := 0; i < 20; i++ {
- original := &Config{}
- f.Fuzz(original)
- actual := AnonymousClientConfig(original)
- expected := *original
-
- // this is the list of known security related fields, add to this list if a new field
- // is added to Config, update AnonymousClientConfig to preserve the field otherwise.
- expected.Impersonate = ImpersonationConfig{}
- expected.BearerToken = ""
- expected.Username = ""
- expected.Password = ""
- expected.AuthProvider = nil
- expected.AuthConfigPersister = nil
- expected.ExecProvider = nil
- expected.TLSClientConfig.CertData = nil
- expected.TLSClientConfig.CertFile = ""
- expected.TLSClientConfig.KeyData = nil
- expected.TLSClientConfig.KeyFile = ""
-
- // The DeepEqual cannot handle the func comparison, so we just verify if the
- // function return the expected object.
- if actual.WrapTransport == nil || !reflect.DeepEqual(expected.WrapTransport(nil), &fakeRoundTripper{}) {
- t.Fatalf("AnonymousClientConfig dropped the WrapTransport field")
- } else {
- actual.WrapTransport = nil
- expected.WrapTransport = nil
- }
- if actual.Dial != nil {
- _, actualError := actual.Dial(context.Background(), "", "")
- _, expectedError := expected.Dial(context.Background(), "", "")
- if !reflect.DeepEqual(expectedError, actualError) {
- t.Fatalf("CopyConfig dropped the Dial field")
- }
- } else {
- actual.Dial = nil
- expected.Dial = nil
- }
-
- if !reflect.DeepEqual(*actual, expected) {
- t.Fatalf("AnonymousClientConfig dropped unexpected fields, identify whether they are security related or not: %s", diff.ObjectGoPrintDiff(expected, actual))
- }
- }
-}
-
-func TestCopyConfig(t *testing.T) {
- f := fuzz.New().NilChance(0.0).NumElements(1, 1)
- f.Funcs(
- func(r *runtime.Codec, f fuzz.Continue) {
- codec := &fakeCodec{}
- f.Fuzz(codec)
- *r = codec
- },
- func(r *http.RoundTripper, f fuzz.Continue) {
- roundTripper := &fakeRoundTripper{}
- f.Fuzz(roundTripper)
- *r = roundTripper
- },
- func(fn *func(http.RoundTripper) http.RoundTripper, f fuzz.Continue) {
- *fn = fakeWrapperFunc
- },
- func(r *runtime.NegotiatedSerializer, f fuzz.Continue) {
- serializer := &fakeNegotiatedSerializer{}
- f.Fuzz(serializer)
- *r = serializer
- },
- func(r *flowcontrol.RateLimiter, f fuzz.Continue) {
- limiter := &fakeLimiter{}
- f.Fuzz(limiter)
- *r = limiter
- },
- func(r *AuthProviderConfigPersister, f fuzz.Continue) {
- *r = fakeAuthProviderConfigPersister{}
- },
- func(r *func(ctx context.Context, network, addr string) (net.Conn, error), f fuzz.Continue) {
- *r = fakeDialFunc
- },
- )
- for i := 0; i < 20; i++ {
- original := &Config{}
- f.Fuzz(original)
- actual := CopyConfig(original)
- expected := *original
-
- // this is the list of known risky fields, add to this list if a new field
- // is added to Config, update CopyConfig to preserve the field otherwise.
-
- // The DeepEqual cannot handle the func comparison, so we just verify if the
- // function return the expected object.
- if actual.WrapTransport == nil || !reflect.DeepEqual(expected.WrapTransport(nil), &fakeRoundTripper{}) {
- t.Fatalf("CopyConfig dropped the WrapTransport field")
- } else {
- actual.WrapTransport = nil
- expected.WrapTransport = nil
- }
- if actual.Dial != nil {
- _, actualError := actual.Dial(context.Background(), "", "")
- _, expectedError := expected.Dial(context.Background(), "", "")
- if !reflect.DeepEqual(expectedError, actualError) {
- t.Fatalf("CopyConfig dropped the Dial field")
- }
- }
- actual.Dial = nil
- expected.Dial = nil
- if actual.AuthConfigPersister != nil {
- actualError := actual.AuthConfigPersister.Persist(nil)
- expectedError := expected.AuthConfigPersister.Persist(nil)
- if !reflect.DeepEqual(expectedError, actualError) {
- t.Fatalf("CopyConfig dropped the Dial field")
- }
- }
- actual.AuthConfigPersister = nil
- expected.AuthConfigPersister = nil
-
- if !reflect.DeepEqual(*actual, expected) {
- t.Fatalf("CopyConfig dropped unexpected fields, identify whether they are security related or not: %s", diff.ObjectReflectDiff(expected, *actual))
- }
- }
-}
diff --git a/vendor/k8s.io/client-go/rest/plugin_test.go b/vendor/k8s.io/client-go/rest/plugin_test.go
deleted file mode 100644
index 070e53790..000000000
--- a/vendor/k8s.io/client-go/rest/plugin_test.go
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package rest
-
-import (
- "fmt"
- "net/http"
- "reflect"
- "strconv"
- "testing"
-
- clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
-)
-
-func TestAuthPluginWrapTransport(t *testing.T) {
- if err := RegisterAuthProviderPlugin("pluginA", pluginAProvider); err != nil {
- t.Errorf("Unexpected error: failed to register pluginA: %v", err)
- }
- if err := RegisterAuthProviderPlugin("pluginB", pluginBProvider); err != nil {
- t.Errorf("Unexpected error: failed to register pluginB: %v", err)
- }
- if err := RegisterAuthProviderPlugin("pluginFail", pluginFailProvider); err != nil {
- t.Errorf("Unexpected error: failed to register pluginFail: %v", err)
- }
- testCases := []struct {
- useWrapTransport bool
- plugin string
- expectErr bool
- expectPluginA bool
- expectPluginB bool
- }{
- {false, "", false, false, false},
- {false, "pluginA", false, true, false},
- {false, "pluginB", false, false, true},
- {false, "pluginFail", true, false, false},
- {false, "pluginUnknown", true, false, false},
- }
- for i, tc := range testCases {
- c := Config{}
- if tc.useWrapTransport {
- // Specify an existing WrapTransport in the config to make sure that
- // plugins play nicely.
- c.WrapTransport = func(rt http.RoundTripper) http.RoundTripper {
- return &wrapTransport{rt}
- }
- }
- if len(tc.plugin) != 0 {
- c.AuthProvider = &clientcmdapi.AuthProviderConfig{Name: tc.plugin}
- }
- tConfig, err := c.TransportConfig()
- if err != nil {
- // Unknown/bad plugins are expected to fail here.
- if !tc.expectErr {
- t.Errorf("%d. Did not expect errors loading Auth Plugin: %q. Got: %v", i, tc.plugin, err)
- }
- continue
- }
- var fullyWrappedTransport http.RoundTripper
- fullyWrappedTransport = &emptyTransport{}
- if tConfig.WrapTransport != nil {
- fullyWrappedTransport = tConfig.WrapTransport(&emptyTransport{})
- }
- res, err := fullyWrappedTransport.RoundTrip(&http.Request{})
- if err != nil {
- t.Errorf("%d. Unexpected error in RoundTrip: %v", i, err)
- continue
- }
- hasWrapTransport := res.Header.Get("wrapTransport") == "Y"
- hasPluginA := res.Header.Get("pluginA") == "Y"
- hasPluginB := res.Header.Get("pluginB") == "Y"
- if hasWrapTransport != tc.useWrapTransport {
- t.Errorf("%d. Expected Existing config.WrapTransport: %t; Got: %t", i, tc.useWrapTransport, hasWrapTransport)
- }
- if hasPluginA != tc.expectPluginA {
- t.Errorf("%d. Expected Plugin A: %t; Got: %t", i, tc.expectPluginA, hasPluginA)
- }
- if hasPluginB != tc.expectPluginB {
- t.Errorf("%d. Expected Plugin B: %t; Got: %t", i, tc.expectPluginB, hasPluginB)
- }
- }
-}
-
-func TestAuthPluginPersist(t *testing.T) {
- // register pluginA by a different name so we don't collide across tests.
- if err := RegisterAuthProviderPlugin("pluginA2", pluginAProvider); err != nil {
- t.Errorf("Unexpected error: failed to register pluginA: %v", err)
- }
- if err := RegisterAuthProviderPlugin("pluginPersist", pluginPersistProvider); err != nil {
- t.Errorf("Unexpected error: failed to register pluginPersist: %v", err)
- }
- fooBarConfig := map[string]string{"foo": "bar"}
- testCases := []struct {
- plugin string
- startingConfig map[string]string
- expectedConfigAfterLogin map[string]string
- expectedConfigAfterRoundTrip map[string]string
- }{
- // non-persisting plugins should work fine without modifying config.
- {"pluginA2", map[string]string{}, map[string]string{}, map[string]string{}},
- {"pluginA2", fooBarConfig, fooBarConfig, fooBarConfig},
- // plugins that persist config should be able to persist when they want.
- {
- "pluginPersist",
- map[string]string{},
- map[string]string{
- "login": "Y",
- },
- map[string]string{
- "login": "Y",
- "roundTrips": "1",
- },
- },
- {
- "pluginPersist",
- map[string]string{
- "login": "Y",
- "roundTrips": "123",
- },
- map[string]string{
- "login": "Y",
- "roundTrips": "123",
- },
- map[string]string{
- "login": "Y",
- "roundTrips": "124",
- },
- },
- }
- for i, tc := range testCases {
- cfg := &clientcmdapi.AuthProviderConfig{
- Name: tc.plugin,
- Config: tc.startingConfig,
- }
- persister := &inMemoryPersister{make(map[string]string)}
- persister.Persist(tc.startingConfig)
- plugin, err := GetAuthProvider("127.0.0.1", cfg, persister)
- if err != nil {
- t.Errorf("%d. Unexpected error: failed to get plugin %q: %v", i, tc.plugin, err)
- }
- if err := plugin.Login(); err != nil {
- t.Errorf("%d. Unexpected error calling Login() w/ plugin %q: %v", i, tc.plugin, err)
- }
- // Make sure the plugin persisted what we expect after Login().
- if !reflect.DeepEqual(persister.savedConfig, tc.expectedConfigAfterLogin) {
- t.Errorf("%d. Unexpected persisted config after calling %s.Login(): \nGot:\n%v\nExpected:\n%v",
- i, tc.plugin, persister.savedConfig, tc.expectedConfigAfterLogin)
- }
- if _, err := plugin.WrapTransport(&emptyTransport{}).RoundTrip(&http.Request{}); err != nil {
- t.Errorf("%d. Unexpected error round-tripping w/ plugin %q: %v", i, tc.plugin, err)
- }
- // Make sure the plugin persisted what we expect after RoundTrip().
- if !reflect.DeepEqual(persister.savedConfig, tc.expectedConfigAfterRoundTrip) {
- t.Errorf("%d. Unexpected persisted config after calling %s.WrapTransport.RoundTrip(): \nGot:\n%v\nExpected:\n%v",
- i, tc.plugin, persister.savedConfig, tc.expectedConfigAfterLogin)
- }
- }
-
-}
-
-// emptyTransport provides an empty http.Response with an initialized header
-// to allow wrapping RoundTrippers to set header values.
-type emptyTransport struct{}
-
-func (*emptyTransport) RoundTrip(req *http.Request) (*http.Response, error) {
- res := &http.Response{
- Header: make(map[string][]string),
- }
- return res, nil
-}
-
-// wrapTransport sets "wrapTransport" = "Y" on the response.
-type wrapTransport struct {
- rt http.RoundTripper
-}
-
-func (w *wrapTransport) RoundTrip(req *http.Request) (*http.Response, error) {
- res, err := w.rt.RoundTrip(req)
- if err != nil {
- return nil, err
- }
- res.Header.Add("wrapTransport", "Y")
- return res, nil
-}
-
-// wrapTransportA sets "pluginA" = "Y" on the response.
-type wrapTransportA struct {
- rt http.RoundTripper
-}
-
-func (w *wrapTransportA) RoundTrip(req *http.Request) (*http.Response, error) {
- res, err := w.rt.RoundTrip(req)
- if err != nil {
- return nil, err
- }
- res.Header.Add("pluginA", "Y")
- return res, nil
-}
-
-type pluginA struct{}
-
-func (*pluginA) WrapTransport(rt http.RoundTripper) http.RoundTripper {
- return &wrapTransportA{rt}
-}
-
-func (*pluginA) Login() error { return nil }
-
-func pluginAProvider(string, map[string]string, AuthProviderConfigPersister) (AuthProvider, error) {
- return &pluginA{}, nil
-}
-
-// wrapTransportB sets "pluginB" = "Y" on the response.
-type wrapTransportB struct {
- rt http.RoundTripper
-}
-
-func (w *wrapTransportB) RoundTrip(req *http.Request) (*http.Response, error) {
- res, err := w.rt.RoundTrip(req)
- if err != nil {
- return nil, err
- }
- res.Header.Add("pluginB", "Y")
- return res, nil
-}
-
-type pluginB struct{}
-
-func (*pluginB) WrapTransport(rt http.RoundTripper) http.RoundTripper {
- return &wrapTransportB{rt}
-}
-
-func (*pluginB) Login() error { return nil }
-
-func pluginBProvider(string, map[string]string, AuthProviderConfigPersister) (AuthProvider, error) {
- return &pluginB{}, nil
-}
-
-// pluginFailProvider simulates a registered AuthPlugin that fails to load.
-func pluginFailProvider(string, map[string]string, AuthProviderConfigPersister) (AuthProvider, error) {
- return nil, fmt.Errorf("Failed to load AuthProvider")
-}
-
-type inMemoryPersister struct {
- savedConfig map[string]string
-}
-
-func (i *inMemoryPersister) Persist(config map[string]string) error {
- i.savedConfig = make(map[string]string)
- for k, v := range config {
- i.savedConfig[k] = v
- }
- return nil
-}
-
-// wrapTransportPersist increments the "roundTrips" entry from the config when
-// roundTrip is called.
-type wrapTransportPersist struct {
- rt http.RoundTripper
- config map[string]string
- persister AuthProviderConfigPersister
-}
-
-func (w *wrapTransportPersist) RoundTrip(req *http.Request) (*http.Response, error) {
- roundTrips := 0
- if rtVal, ok := w.config["roundTrips"]; ok {
- var err error
- roundTrips, err = strconv.Atoi(rtVal)
- if err != nil {
- return nil, err
- }
- }
- roundTrips++
- w.config["roundTrips"] = fmt.Sprintf("%d", roundTrips)
- if err := w.persister.Persist(w.config); err != nil {
- return nil, err
- }
- return w.rt.RoundTrip(req)
-}
-
-type pluginPersist struct {
- config map[string]string
- persister AuthProviderConfigPersister
-}
-
-func (p *pluginPersist) WrapTransport(rt http.RoundTripper) http.RoundTripper {
- return &wrapTransportPersist{rt, p.config, p.persister}
-}
-
-// Login sets the config entry "login" to "Y".
-func (p *pluginPersist) Login() error {
- p.config["login"] = "Y"
- p.persister.Persist(p.config)
- return nil
-}
-
-func pluginPersistProvider(_ string, config map[string]string, persister AuthProviderConfigPersister) (AuthProvider, error) {
- return &pluginPersist{config, persister}, nil
-}
diff --git a/vendor/k8s.io/client-go/rest/request_test.go b/vendor/k8s.io/client-go/rest/request_test.go
deleted file mode 100755
index f75ee86cb..000000000
--- a/vendor/k8s.io/client-go/rest/request_test.go
+++ /dev/null
@@ -1,1789 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package rest
-
-import (
- "bytes"
- "context"
- "errors"
- "flag"
- "fmt"
- "io"
- "io/ioutil"
- "net"
- "net/http"
- "net/http/httptest"
- "net/url"
- "os"
- "reflect"
- "strings"
- "syscall"
- "testing"
- "time"
-
- "github.com/golang/glog"
-
- "k8s.io/api/core/v1"
- apiequality "k8s.io/apimachinery/pkg/api/equality"
- apierrors "k8s.io/apimachinery/pkg/api/errors"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/runtime/serializer"
- "k8s.io/apimachinery/pkg/runtime/serializer/streaming"
- "k8s.io/apimachinery/pkg/util/clock"
- "k8s.io/apimachinery/pkg/util/diff"
- "k8s.io/apimachinery/pkg/util/httpstream"
- "k8s.io/apimachinery/pkg/util/intstr"
- "k8s.io/apimachinery/pkg/watch"
- "k8s.io/client-go/kubernetes/scheme"
- restclientwatch "k8s.io/client-go/rest/watch"
- "k8s.io/client-go/util/flowcontrol"
- utiltesting "k8s.io/client-go/util/testing"
-)
-
-func TestNewRequestSetsAccept(t *testing.T) {
- r := NewRequest(nil, "get", &url.URL{Path: "/path/"}, "", ContentConfig{}, Serializers{}, nil, nil, 0)
- if r.headers.Get("Accept") != "" {
- t.Errorf("unexpected headers: %#v", r.headers)
- }
- r = NewRequest(nil, "get", &url.URL{Path: "/path/"}, "", ContentConfig{ContentType: "application/other"}, Serializers{}, nil, nil, 0)
- if r.headers.Get("Accept") != "application/other, */*" {
- t.Errorf("unexpected headers: %#v", r.headers)
- }
-}
-
-type clientFunc func(req *http.Request) (*http.Response, error)
-
-func (f clientFunc) Do(req *http.Request) (*http.Response, error) {
- return f(req)
-}
-
-func TestRequestSetsHeaders(t *testing.T) {
- server := clientFunc(func(req *http.Request) (*http.Response, error) {
- if req.Header.Get("Accept") != "application/other, */*" {
- t.Errorf("unexpected headers: %#v", req.Header)
- }
- return &http.Response{
- StatusCode: http.StatusForbidden,
- Body: ioutil.NopCloser(bytes.NewReader([]byte{})),
- }, nil
- })
- config := defaultContentConfig()
- config.ContentType = "application/other"
- serializers := defaultSerializers(t)
- r := NewRequest(server, "get", &url.URL{Path: "/path"}, "", config, serializers, nil, nil, 0)
-
- // Check if all "issue" methods are setting headers.
- _ = r.Do()
- _, _ = r.Watch()
- _, _ = r.Stream()
-}
-
-func TestRequestWithErrorWontChange(t *testing.T) {
- gvCopy := v1.SchemeGroupVersion
- original := Request{
- err: errors.New("test"),
- content: ContentConfig{GroupVersion: &gvCopy},
- }
- r := original
- changed := r.Param("foo", "bar").
- AbsPath("/abs").
- Prefix("test").
- Suffix("testing").
- Namespace("new").
- Resource("foos").
- Name("bars").
- Body("foo").
- Timeout(time.Millisecond)
- if changed != &r {
- t.Errorf("returned request should point to the same object")
- }
- if !reflect.DeepEqual(changed, &original) {
- t.Errorf("expected %#v, got %#v", &original, changed)
- }
-}
-
-func TestRequestPreservesBaseTrailingSlash(t *testing.T) {
- r := &Request{baseURL: &url.URL{}, pathPrefix: "/path/"}
- if s := r.URL().String(); s != "/path/" {
- t.Errorf("trailing slash should be preserved: %s", s)
- }
-}
-
-func TestRequestAbsPathPreservesTrailingSlash(t *testing.T) {
- r := (&Request{baseURL: &url.URL{}}).AbsPath("/foo/")
- if s := r.URL().String(); s != "/foo/" {
- t.Errorf("trailing slash should be preserved: %s", s)
- }
-
- r = (&Request{baseURL: &url.URL{}}).AbsPath("/foo/")
- if s := r.URL().String(); s != "/foo/" {
- t.Errorf("trailing slash should be preserved: %s", s)
- }
-}
-
-func TestRequestAbsPathJoins(t *testing.T) {
- r := (&Request{baseURL: &url.URL{}}).AbsPath("foo/bar", "baz")
- if s := r.URL().String(); s != "foo/bar/baz" {
- t.Errorf("trailing slash should be preserved: %s", s)
- }
-}
-
-func TestRequestSetsNamespace(t *testing.T) {
- r := (&Request{
- baseURL: &url.URL{
- Path: "/",
- },
- }).Namespace("foo")
- if r.namespace == "" {
- t.Errorf("namespace should be set: %#v", r)
- }
-
- if s := r.URL().String(); s != "namespaces/foo" {
- t.Errorf("namespace should be in path: %s", s)
- }
-}
-
-func TestRequestOrdersNamespaceInPath(t *testing.T) {
- r := (&Request{
- baseURL: &url.URL{},
- pathPrefix: "/test/",
- }).Name("bar").Resource("baz").Namespace("foo")
- if s := r.URL().String(); s != "/test/namespaces/foo/baz/bar" {
- t.Errorf("namespace should be in order in path: %s", s)
- }
-}
-
-func TestRequestOrdersSubResource(t *testing.T) {
- r := (&Request{
- baseURL: &url.URL{},
- pathPrefix: "/test/",
- }).Name("bar").Resource("baz").Namespace("foo").Suffix("test").SubResource("a", "b")
- if s := r.URL().String(); s != "/test/namespaces/foo/baz/bar/a/b/test" {
- t.Errorf("namespace should be in order in path: %s", s)
- }
-}
-
-func TestRequestSetTwiceError(t *testing.T) {
- if (&Request{}).Name("bar").Name("baz").err == nil {
- t.Errorf("setting name twice should result in error")
- }
- if (&Request{}).Namespace("bar").Namespace("baz").err == nil {
- t.Errorf("setting namespace twice should result in error")
- }
- if (&Request{}).Resource("bar").Resource("baz").err == nil {
- t.Errorf("setting resource twice should result in error")
- }
- if (&Request{}).SubResource("bar").SubResource("baz").err == nil {
- t.Errorf("setting subresource twice should result in error")
- }
-}
-
-func TestInvalidSegments(t *testing.T) {
- invalidSegments := []string{".", "..", "test/segment", "test%2bsegment"}
- setters := map[string]func(string, *Request){
- "namespace": func(s string, r *Request) { r.Namespace(s) },
- "resource": func(s string, r *Request) { r.Resource(s) },
- "name": func(s string, r *Request) { r.Name(s) },
- "subresource": func(s string, r *Request) { r.SubResource(s) },
- }
- for _, invalidSegment := range invalidSegments {
- for setterName, setter := range setters {
- r := &Request{}
- setter(invalidSegment, r)
- if r.err == nil {
- t.Errorf("%s: %s: expected error, got none", setterName, invalidSegment)
- }
- }
- }
-}
-
-func TestRequestParam(t *testing.T) {
- r := (&Request{}).Param("foo", "a")
- if !reflect.DeepEqual(r.params, url.Values{"foo": []string{"a"}}) {
- t.Errorf("should have set a param: %#v", r)
- }
-
- r.Param("bar", "1")
- r.Param("bar", "2")
- if !reflect.DeepEqual(r.params, url.Values{"foo": []string{"a"}, "bar": []string{"1", "2"}}) {
- t.Errorf("should have set a param: %#v", r)
- }
-}
-
-func TestRequestVersionedParams(t *testing.T) {
- r := (&Request{content: ContentConfig{GroupVersion: &v1.SchemeGroupVersion}}).Param("foo", "a")
- if !reflect.DeepEqual(r.params, url.Values{"foo": []string{"a"}}) {
- t.Errorf("should have set a param: %#v", r)
- }
- r.VersionedParams(&v1.PodLogOptions{Follow: true, Container: "bar"}, scheme.ParameterCodec)
-
- if !reflect.DeepEqual(r.params, url.Values{
- "foo": []string{"a"},
- "container": []string{"bar"},
- "follow": []string{"true"},
- }) {
- t.Errorf("should have set a param: %#v", r)
- }
-}
-
-func TestRequestVersionedParamsFromListOptions(t *testing.T) {
- r := &Request{content: ContentConfig{GroupVersion: &v1.SchemeGroupVersion}}
- r.VersionedParams(&metav1.ListOptions{ResourceVersion: "1"}, scheme.ParameterCodec)
- if !reflect.DeepEqual(r.params, url.Values{
- "resourceVersion": []string{"1"},
- }) {
- t.Errorf("should have set a param: %#v", r)
- }
-
- var timeout int64 = 10
- r.VersionedParams(&metav1.ListOptions{ResourceVersion: "2", TimeoutSeconds: &timeout}, scheme.ParameterCodec)
- if !reflect.DeepEqual(r.params, url.Values{
- "resourceVersion": []string{"1", "2"},
- "timeoutSeconds": []string{"10"},
- }) {
- t.Errorf("should have set a param: %#v %v", r.params, r.err)
- }
-}
-
-func TestRequestURI(t *testing.T) {
- r := (&Request{}).Param("foo", "a")
- r.Prefix("other")
- r.RequestURI("/test?foo=b&a=b&c=1&c=2")
- if r.pathPrefix != "/test" {
- t.Errorf("path is wrong: %#v", r)
- }
- if !reflect.DeepEqual(r.params, url.Values{"a": []string{"b"}, "foo": []string{"b"}, "c": []string{"1", "2"}}) {
- t.Errorf("should have set a param: %#v", r)
- }
-}
-
-type NotAnAPIObject struct{}
-
-func (obj NotAnAPIObject) GroupVersionKind() *schema.GroupVersionKind { return nil }
-func (obj NotAnAPIObject) SetGroupVersionKind(gvk *schema.GroupVersionKind) {}
-
-func defaultContentConfig() ContentConfig {
- gvCopy := v1.SchemeGroupVersion
- return ContentConfig{
- ContentType: "application/json",
- GroupVersion: &gvCopy,
- NegotiatedSerializer: serializer.DirectCodecFactory{CodecFactory: scheme.Codecs},
- }
-}
-
-func defaultSerializers(t *testing.T) Serializers {
- config := defaultContentConfig()
- serializers, err := createSerializers(config)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- return *serializers
-}
-
-func TestRequestBody(t *testing.T) {
- // test unknown type
- r := (&Request{}).Body([]string{"test"})
- if r.err == nil || r.body != nil {
- t.Errorf("should have set err and left body nil: %#v", r)
- }
-
- // test error set when failing to read file
- f, err := ioutil.TempFile("", "test")
- if err != nil {
- t.Fatalf("unable to create temp file")
- }
- defer f.Close()
- os.Remove(f.Name())
- r = (&Request{}).Body(f.Name())
- if r.err == nil || r.body != nil {
- t.Errorf("should have set err and left body nil: %#v", r)
- }
-
- // test unencodable api object
- r = (&Request{content: defaultContentConfig()}).Body(&NotAnAPIObject{})
- if r.err == nil || r.body != nil {
- t.Errorf("should have set err and left body nil: %#v", r)
- }
-}
-
-func TestResultIntoWithErrReturnsErr(t *testing.T) {
- res := Result{err: errors.New("test")}
- if err := res.Into(&v1.Pod{}); err != res.err {
- t.Errorf("should have returned exact error from result")
- }
-}
-
-func TestResultIntoWithNoBodyReturnsErr(t *testing.T) {
- res := Result{
- body: []byte{},
- decoder: scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion),
- }
- if err := res.Into(&v1.Pod{}); err == nil || !strings.Contains(err.Error(), "0-length") {
- t.Errorf("should have complained about 0 length body")
- }
-}
-
-func TestURLTemplate(t *testing.T) {
- uri, _ := url.Parse("http://localhost")
- r := NewRequest(nil, "POST", uri, "", ContentConfig{GroupVersion: &schema.GroupVersion{Group: "test"}}, Serializers{}, nil, nil, 0)
- r.Prefix("pre1").Resource("r1").Namespace("ns").Name("nm").Param("p0", "v0")
- full := r.URL()
- if full.String() != "http://localhost/pre1/namespaces/ns/r1/nm?p0=v0" {
- t.Errorf("unexpected initial URL: %s", full)
- }
- actualURL := r.finalURLTemplate()
- actual := actualURL.String()
- expected := "http://localhost/pre1/namespaces/%7Bnamespace%7D/r1/%7Bname%7D?p0=%7Bvalue%7D"
- if actual != expected {
- t.Errorf("unexpected URL template: %s %s", actual, expected)
- }
- if r.URL().String() != full.String() {
- t.Errorf("creating URL template changed request: %s -> %s", full.String(), r.URL().String())
- }
-}
-
-func TestTransformResponse(t *testing.T) {
- invalid := []byte("aaaaa")
- uri, _ := url.Parse("http://localhost")
- testCases := []struct {
- Response *http.Response
- Data []byte
- Created bool
- Error bool
- ErrFn func(err error) bool
- }{
- {Response: &http.Response{StatusCode: 200}, Data: []byte{}},
- {Response: &http.Response{StatusCode: 201}, Data: []byte{}, Created: true},
- {Response: &http.Response{StatusCode: 199}, Error: true},
- {Response: &http.Response{StatusCode: 500}, Error: true},
- {Response: &http.Response{StatusCode: 422}, Error: true},
- {Response: &http.Response{StatusCode: 409}, Error: true},
- {Response: &http.Response{StatusCode: 404}, Error: true},
- {Response: &http.Response{StatusCode: 401}, Error: true},
- {
- Response: &http.Response{
- StatusCode: 401,
- Header: http.Header{"Content-Type": []string{"application/json"}},
- Body: ioutil.NopCloser(bytes.NewReader(invalid)),
- },
- Error: true,
- ErrFn: func(err error) bool {
- return err.Error() != "aaaaa" && apierrors.IsUnauthorized(err)
- },
- },
- {
- Response: &http.Response{
- StatusCode: 401,
- Header: http.Header{"Content-Type": []string{"text/any"}},
- Body: ioutil.NopCloser(bytes.NewReader(invalid)),
- },
- Error: true,
- ErrFn: func(err error) bool {
- return strings.Contains(err.Error(), "server has asked for the client to provide") && apierrors.IsUnauthorized(err)
- },
- },
- {Response: &http.Response{StatusCode: 403}, Error: true},
- {Response: &http.Response{StatusCode: 200, Body: ioutil.NopCloser(bytes.NewReader(invalid))}, Data: invalid},
- {Response: &http.Response{StatusCode: 200, Body: ioutil.NopCloser(bytes.NewReader(invalid))}, Data: invalid},
- }
- for i, test := range testCases {
- r := NewRequest(nil, "", uri, "", defaultContentConfig(), defaultSerializers(t), nil, nil, 0)
- if test.Response.Body == nil {
- test.Response.Body = ioutil.NopCloser(bytes.NewReader([]byte{}))
- }
- result := r.transformResponse(test.Response, &http.Request{})
- response, created, err := result.body, result.statusCode == http.StatusCreated, result.err
- hasErr := err != nil
- if hasErr != test.Error {
- t.Errorf("%d: unexpected error: %t %v", i, test.Error, err)
- } else if hasErr && test.Response.StatusCode > 399 {
- status, ok := err.(apierrors.APIStatus)
- if !ok {
- t.Errorf("%d: response should have been transformable into APIStatus: %v", i, err)
- continue
- }
- if int(status.Status().Code) != test.Response.StatusCode {
- t.Errorf("%d: status code did not match response: %#v", i, status.Status())
- }
- }
- if test.ErrFn != nil && !test.ErrFn(err) {
- t.Errorf("%d: error function did not match: %v", i, err)
- }
- if !(test.Data == nil && response == nil) && !apiequality.Semantic.DeepDerivative(test.Data, response) {
- t.Errorf("%d: unexpected response: %#v %#v", i, test.Data, response)
- }
- if test.Created != created {
- t.Errorf("%d: expected created %t, got %t", i, test.Created, created)
- }
- }
-}
-
-type renegotiator struct {
- called bool
- contentType string
- params map[string]string
- decoder runtime.Decoder
- err error
-}
-
-func (r *renegotiator) invoke(contentType string, params map[string]string) (runtime.Decoder, error) {
- r.called = true
- r.contentType = contentType
- r.params = params
- return r.decoder, r.err
-}
-
-func TestTransformResponseNegotiate(t *testing.T) {
- invalid := []byte("aaaaa")
- uri, _ := url.Parse("http://localhost")
- testCases := []struct {
- Response *http.Response
- Data []byte
- Created bool
- Error bool
- ErrFn func(err error) bool
-
- ContentType string
- Called bool
- ExpectContentType string
- Decoder runtime.Decoder
- NegotiateErr error
- }{
- {
- ContentType: "application/json",
- Response: &http.Response{
- StatusCode: 401,
- Header: http.Header{"Content-Type": []string{"application/json"}},
- Body: ioutil.NopCloser(bytes.NewReader(invalid)),
- },
- Error: true,
- ErrFn: func(err error) bool {
- return err.Error() != "aaaaa" && apierrors.IsUnauthorized(err)
- },
- },
- {
- ContentType: "application/json",
- Response: &http.Response{
- StatusCode: 401,
- Header: http.Header{"Content-Type": []string{"application/protobuf"}},
- Body: ioutil.NopCloser(bytes.NewReader(invalid)),
- },
- Decoder: scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion),
-
- Called: true,
- ExpectContentType: "application/protobuf",
-
- Error: true,
- ErrFn: func(err error) bool {
- return err.Error() != "aaaaa" && apierrors.IsUnauthorized(err)
- },
- },
- {
- ContentType: "application/json",
- Response: &http.Response{
- StatusCode: 500,
- Header: http.Header{"Content-Type": []string{"application/,others"}},
- },
- Decoder: scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion),
-
- Error: true,
- ErrFn: func(err error) bool {
- return err.Error() == "Internal error occurred: mime: expected token after slash" && err.(apierrors.APIStatus).Status().Code == 500
- },
- },
- {
- // no negotiation when no content type specified
- Response: &http.Response{
- StatusCode: 200,
- Header: http.Header{"Content-Type": []string{"text/any"}},
- Body: ioutil.NopCloser(bytes.NewReader(invalid)),
- },
- Decoder: scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion),
- },
- {
- // no negotiation when no response content type specified
- ContentType: "text/any",
- Response: &http.Response{
- StatusCode: 200,
- Body: ioutil.NopCloser(bytes.NewReader(invalid)),
- },
- Decoder: scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion),
- },
- {
- // unrecognized content type is not handled
- ContentType: "application/json",
- Response: &http.Response{
- StatusCode: 404,
- Header: http.Header{"Content-Type": []string{"application/unrecognized"}},
- Body: ioutil.NopCloser(bytes.NewReader(invalid)),
- },
- Decoder: scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion),
-
- NegotiateErr: fmt.Errorf("aaaa"),
- Called: true,
- ExpectContentType: "application/unrecognized",
-
- Error: true,
- ErrFn: func(err error) bool {
- return err.Error() != "aaaaa" && apierrors.IsNotFound(err)
- },
- },
- }
- for i, test := range testCases {
- serializers := defaultSerializers(t)
- negotiator := &renegotiator{
- decoder: test.Decoder,
- err: test.NegotiateErr,
- }
- serializers.RenegotiatedDecoder = negotiator.invoke
- contentConfig := defaultContentConfig()
- contentConfig.ContentType = test.ContentType
- r := NewRequest(nil, "", uri, "", contentConfig, serializers, nil, nil, 0)
- if test.Response.Body == nil {
- test.Response.Body = ioutil.NopCloser(bytes.NewReader([]byte{}))
- }
- result := r.transformResponse(test.Response, &http.Request{})
- _, err := result.body, result.err
- hasErr := err != nil
- if hasErr != test.Error {
- t.Errorf("%d: unexpected error: %t %v", i, test.Error, err)
- continue
- } else if hasErr && test.Response.StatusCode > 399 {
- status, ok := err.(apierrors.APIStatus)
- if !ok {
- t.Errorf("%d: response should have been transformable into APIStatus: %v", i, err)
- continue
- }
- if int(status.Status().Code) != test.Response.StatusCode {
- t.Errorf("%d: status code did not match response: %#v", i, status.Status())
- }
- }
- if test.ErrFn != nil && !test.ErrFn(err) {
- t.Errorf("%d: error function did not match: %v", i, err)
- }
- if negotiator.called != test.Called {
- t.Errorf("%d: negotiator called %t != %t", i, negotiator.called, test.Called)
- }
- if !test.Called {
- continue
- }
- if negotiator.contentType != test.ExpectContentType {
- t.Errorf("%d: unexpected content type: %s", i, negotiator.contentType)
- }
- }
-}
-
-func TestTransformUnstructuredError(t *testing.T) {
- testCases := []struct {
- Req *http.Request
- Res *http.Response
-
- Resource string
- Name string
-
- ErrFn func(error) bool
- Transformed error
- }{
- {
- Resource: "foo",
- Name: "bar",
- Req: &http.Request{
- Method: "POST",
- },
- Res: &http.Response{
- StatusCode: http.StatusConflict,
- Body: ioutil.NopCloser(bytes.NewReader(nil)),
- },
- ErrFn: apierrors.IsAlreadyExists,
- },
- {
- Resource: "foo",
- Name: "bar",
- Req: &http.Request{
- Method: "PUT",
- },
- Res: &http.Response{
- StatusCode: http.StatusConflict,
- Body: ioutil.NopCloser(bytes.NewReader(nil)),
- },
- ErrFn: apierrors.IsConflict,
- },
- {
- Resource: "foo",
- Name: "bar",
- Req: &http.Request{},
- Res: &http.Response{
- StatusCode: http.StatusNotFound,
- Body: ioutil.NopCloser(bytes.NewReader(nil)),
- },
- ErrFn: apierrors.IsNotFound,
- },
- {
- Req: &http.Request{},
- Res: &http.Response{
- StatusCode: http.StatusBadRequest,
- Body: ioutil.NopCloser(bytes.NewReader(nil)),
- },
- ErrFn: apierrors.IsBadRequest,
- },
- {
- // status in response overrides transformed result
- Req: &http.Request{},
- Res: &http.Response{StatusCode: http.StatusBadRequest, Body: ioutil.NopCloser(bytes.NewReader([]byte(`{"kind":"Status","apiVersion":"v1","status":"Failure","code":404}`)))},
- ErrFn: apierrors.IsBadRequest,
- Transformed: &apierrors.StatusError{
- ErrStatus: metav1.Status{Status: metav1.StatusFailure, Code: http.StatusNotFound},
- },
- },
- {
- // successful status is ignored
- Req: &http.Request{},
- Res: &http.Response{StatusCode: http.StatusBadRequest, Body: ioutil.NopCloser(bytes.NewReader([]byte(`{"kind":"Status","apiVersion":"v1","status":"Success","code":404}`)))},
- ErrFn: apierrors.IsBadRequest,
- },
- {
- // empty object does not change result
- Req: &http.Request{},
- Res: &http.Response{StatusCode: http.StatusBadRequest, Body: ioutil.NopCloser(bytes.NewReader([]byte(`{}`)))},
- ErrFn: apierrors.IsBadRequest,
- },
- {
- // we default apiVersion for backwards compatibility with old clients
- // TODO: potentially remove in 1.7
- Req: &http.Request{},
- Res: &http.Response{StatusCode: http.StatusBadRequest, Body: ioutil.NopCloser(bytes.NewReader([]byte(`{"kind":"Status","status":"Failure","code":404}`)))},
- ErrFn: apierrors.IsBadRequest,
- Transformed: &apierrors.StatusError{
- ErrStatus: metav1.Status{Status: metav1.StatusFailure, Code: http.StatusNotFound},
- },
- },
- {
- // we do not default kind
- Req: &http.Request{},
- Res: &http.Response{StatusCode: http.StatusBadRequest, Body: ioutil.NopCloser(bytes.NewReader([]byte(`{"status":"Failure","code":404}`)))},
- ErrFn: apierrors.IsBadRequest,
- },
- }
-
- for i, testCase := range testCases {
- r := &Request{
- content: defaultContentConfig(),
- serializers: defaultSerializers(t),
- resourceName: testCase.Name,
- resource: testCase.Resource,
- }
- result := r.transformResponse(testCase.Res, testCase.Req)
- err := result.err
- if !testCase.ErrFn(err) {
- t.Errorf("unexpected error: %v", err)
- continue
- }
- if !apierrors.IsUnexpectedServerError(err) {
- t.Errorf("%d: unexpected error type: %v", i, err)
- }
- if len(testCase.Name) != 0 && !strings.Contains(err.Error(), testCase.Name) {
- t.Errorf("unexpected error string: %s", err)
- }
- if len(testCase.Resource) != 0 && !strings.Contains(err.Error(), testCase.Resource) {
- t.Errorf("unexpected error string: %s", err)
- }
-
- // verify Error() properly transforms the error
- transformed := result.Error()
- expect := testCase.Transformed
- if expect == nil {
- expect = err
- }
- if !reflect.DeepEqual(expect, transformed) {
- t.Errorf("%d: unexpected Error(): %s", i, diff.ObjectReflectDiff(expect, transformed))
- }
-
- // verify result.Get properly transforms the error
- if _, err := result.Get(); !reflect.DeepEqual(expect, err) {
- t.Errorf("%d: unexpected error on Get(): %s", i, diff.ObjectReflectDiff(expect, err))
- }
-
- // verify result.Into properly handles the error
- if err := result.Into(&v1.Pod{}); !reflect.DeepEqual(expect, err) {
- t.Errorf("%d: unexpected error on Into(): %s", i, diff.ObjectReflectDiff(expect, err))
- }
-
- // verify result.Raw leaves the error in the untransformed state
- if _, err := result.Raw(); !reflect.DeepEqual(result.err, err) {
- t.Errorf("%d: unexpected error on Raw(): %s", i, diff.ObjectReflectDiff(expect, err))
- }
- }
-}
-
-func TestRequestWatch(t *testing.T) {
- testCases := []struct {
- Request *Request
- Err bool
- ErrFn func(error) bool
- Empty bool
- }{
- {
- Request: &Request{err: errors.New("bail")},
- Err: true,
- },
- {
- Request: &Request{baseURL: &url.URL{}, pathPrefix: "%"},
- Err: true,
- },
- {
- Request: &Request{
- client: clientFunc(func(req *http.Request) (*http.Response, error) {
- return nil, errors.New("err")
- }),
- baseURL: &url.URL{},
- },
- Err: true,
- },
- {
- Request: &Request{
- content: defaultContentConfig(),
- serializers: defaultSerializers(t),
- client: clientFunc(func(req *http.Request) (*http.Response, error) {
- return &http.Response{
- StatusCode: http.StatusForbidden,
- Body: ioutil.NopCloser(bytes.NewReader([]byte{})),
- }, nil
- }),
- baseURL: &url.URL{},
- },
- Err: true,
- ErrFn: func(err error) bool {
- return apierrors.IsForbidden(err)
- },
- },
- {
- Request: &Request{
- content: defaultContentConfig(),
- serializers: defaultSerializers(t),
- client: clientFunc(func(req *http.Request) (*http.Response, error) {
- return &http.Response{
- StatusCode: http.StatusUnauthorized,
- Body: ioutil.NopCloser(bytes.NewReader([]byte{})),
- }, nil
- }),
- baseURL: &url.URL{},
- },
- Err: true,
- ErrFn: func(err error) bool {
- return apierrors.IsUnauthorized(err)
- },
- },
- {
- Request: &Request{
- content: defaultContentConfig(),
- serializers: defaultSerializers(t),
- client: clientFunc(func(req *http.Request) (*http.Response, error) {
- return &http.Response{
- StatusCode: http.StatusUnauthorized,
- Body: ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), &metav1.Status{
- Status: metav1.StatusFailure,
- Reason: metav1.StatusReasonUnauthorized,
- })))),
- }, nil
- }),
- baseURL: &url.URL{},
- },
- Err: true,
- ErrFn: func(err error) bool {
- return apierrors.IsUnauthorized(err)
- },
- },
- {
- Request: &Request{
- serializers: defaultSerializers(t),
- client: clientFunc(func(req *http.Request) (*http.Response, error) {
- return nil, io.EOF
- }),
- baseURL: &url.URL{},
- },
- Empty: true,
- },
- {
- Request: &Request{
- serializers: defaultSerializers(t),
- client: clientFunc(func(req *http.Request) (*http.Response, error) {
- return nil, &url.Error{Err: io.EOF}
- }),
- baseURL: &url.URL{},
- },
- Empty: true,
- },
- {
- Request: &Request{
- serializers: defaultSerializers(t),
- client: clientFunc(func(req *http.Request) (*http.Response, error) {
- return nil, errors.New("http: can't write HTTP request on broken connection")
- }),
- baseURL: &url.URL{},
- },
- Empty: true,
- },
- {
- Request: &Request{
- serializers: defaultSerializers(t),
- client: clientFunc(func(req *http.Request) (*http.Response, error) {
- return nil, errors.New("foo: connection reset by peer")
- }),
- baseURL: &url.URL{},
- },
- Empty: true,
- },
- }
- for i, testCase := range testCases {
- t.Logf("testcase %v", testCase.Request)
- testCase.Request.backoffMgr = &NoBackoff{}
- watch, err := testCase.Request.Watch()
- hasErr := err != nil
- if hasErr != testCase.Err {
- t.Errorf("%d: expected %t, got %t: %v", i, testCase.Err, hasErr, err)
- continue
- }
- if testCase.ErrFn != nil && !testCase.ErrFn(err) {
- t.Errorf("%d: error not valid: %v", i, err)
- }
- if hasErr && watch != nil {
- t.Errorf("%d: watch should be nil when error is returned", i)
- continue
- }
- if testCase.Empty {
- _, ok := <-watch.ResultChan()
- if ok {
- t.Errorf("%d: expected the watch to be empty: %#v", i, watch)
- }
- }
- }
-}
-
-func TestRequestStream(t *testing.T) {
- testCases := []struct {
- Request *Request
- Err bool
- ErrFn func(error) bool
- }{
- {
- Request: &Request{err: errors.New("bail")},
- Err: true,
- },
- {
- Request: &Request{baseURL: &url.URL{}, pathPrefix: "%"},
- Err: true,
- },
- {
- Request: &Request{
- client: clientFunc(func(req *http.Request) (*http.Response, error) {
- return nil, errors.New("err")
- }),
- baseURL: &url.URL{},
- },
- Err: true,
- },
- {
- Request: &Request{
- client: clientFunc(func(req *http.Request) (*http.Response, error) {
- return &http.Response{
- StatusCode: http.StatusUnauthorized,
- Body: ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), &metav1.Status{
- Status: metav1.StatusFailure,
- Reason: metav1.StatusReasonUnauthorized,
- })))),
- }, nil
- }),
- content: defaultContentConfig(),
- serializers: defaultSerializers(t),
- baseURL: &url.URL{},
- },
- Err: true,
- },
- {
- Request: &Request{
- client: clientFunc(func(req *http.Request) (*http.Response, error) {
- return &http.Response{
- StatusCode: http.StatusBadRequest,
- Body: ioutil.NopCloser(bytes.NewReader([]byte(`{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"a container name must be specified for pod kube-dns-v20-mz5cv, choose one of: [kubedns dnsmasq healthz]","reason":"BadRequest","code":400}`))),
- }, nil
- }),
- content: defaultContentConfig(),
- serializers: defaultSerializers(t),
- baseURL: &url.URL{},
- },
- Err: true,
- ErrFn: func(err error) bool {
- if err.Error() == "a container name must be specified for pod kube-dns-v20-mz5cv, choose one of: [kubedns dnsmasq healthz]" {
- return true
- }
- return false
- },
- },
- }
- for i, testCase := range testCases {
- testCase.Request.backoffMgr = &NoBackoff{}
- body, err := testCase.Request.Stream()
- hasErr := err != nil
- if hasErr != testCase.Err {
- t.Errorf("%d: expected %t, got %t: %v", i, testCase.Err, hasErr, err)
- }
- if hasErr && body != nil {
- t.Errorf("%d: body should be nil when error is returned", i)
- }
-
- if hasErr {
- if testCase.ErrFn != nil && !testCase.ErrFn(err) {
- t.Errorf("unexpected error: %v", err)
- }
- }
- }
-}
-
-type fakeUpgradeConnection struct{}
-
-func (c *fakeUpgradeConnection) CreateStream(headers http.Header) (httpstream.Stream, error) {
- return nil, nil
-}
-func (c *fakeUpgradeConnection) Close() error {
- return nil
-}
-func (c *fakeUpgradeConnection) CloseChan() <-chan bool {
- return make(chan bool)
-}
-func (c *fakeUpgradeConnection) SetIdleTimeout(timeout time.Duration) {
-}
-
-type fakeUpgradeRoundTripper struct {
- req *http.Request
- conn httpstream.Connection
-}
-
-func (f *fakeUpgradeRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
- f.req = req
- b := []byte{}
- body := ioutil.NopCloser(bytes.NewReader(b))
- resp := &http.Response{
- StatusCode: 101,
- Body: body,
- }
- return resp, nil
-}
-
-func (f *fakeUpgradeRoundTripper) NewConnection(resp *http.Response) (httpstream.Connection, error) {
- return f.conn, nil
-}
-
-func TestRequestDo(t *testing.T) {
- testCases := []struct {
- Request *Request
- Err bool
- }{
- {
- Request: &Request{err: errors.New("bail")},
- Err: true,
- },
- {
- Request: &Request{baseURL: &url.URL{}, pathPrefix: "%"},
- Err: true,
- },
- {
- Request: &Request{
- client: clientFunc(func(req *http.Request) (*http.Response, error) {
- return nil, errors.New("err")
- }),
- baseURL: &url.URL{},
- },
- Err: true,
- },
- }
- for i, testCase := range testCases {
- testCase.Request.backoffMgr = &NoBackoff{}
- body, err := testCase.Request.Do().Raw()
- hasErr := err != nil
- if hasErr != testCase.Err {
- t.Errorf("%d: expected %t, got %t: %v", i, testCase.Err, hasErr, err)
- }
- if hasErr && body != nil {
- t.Errorf("%d: body should be nil when error is returned", i)
- }
- }
-}
-
-func TestDoRequestNewWay(t *testing.T) {
- reqBody := "request body"
- expectedObj := &v1.Service{Spec: v1.ServiceSpec{Ports: []v1.ServicePort{{
- Protocol: "TCP",
- Port: 12345,
- TargetPort: intstr.FromInt(12345),
- }}}}
- expectedBody, _ := runtime.Encode(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), expectedObj)
- fakeHandler := utiltesting.FakeHandler{
- StatusCode: 200,
- ResponseBody: string(expectedBody),
- T: t,
- }
- testServer := httptest.NewServer(&fakeHandler)
- defer testServer.Close()
- c := testRESTClient(t, testServer)
- obj, err := c.Verb("POST").
- Prefix("foo", "bar").
- Suffix("baz").
- Timeout(time.Second).
- Body([]byte(reqBody)).
- Do().Get()
- if err != nil {
- t.Errorf("Unexpected error: %v %#v", err, err)
- return
- }
- if obj == nil {
- t.Error("nil obj")
- } else if !apiequality.Semantic.DeepDerivative(expectedObj, obj) {
- t.Errorf("Expected: %#v, got %#v", expectedObj, obj)
- }
- requestURL := defaultResourcePathWithPrefix("foo/bar", "", "", "baz")
- requestURL += "?timeout=1s"
- fakeHandler.ValidateRequest(t, requestURL, "POST", &reqBody)
-}
-
-// This test assumes that the client implementation backs off exponentially, for an individual request.
-func TestBackoffLifecycle(t *testing.T) {
- count := 0
- testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
- count++
- t.Logf("Attempt %d", count)
- if count == 5 || count == 9 {
- w.WriteHeader(http.StatusOK)
- return
- } else {
- w.WriteHeader(http.StatusGatewayTimeout)
- return
- }
- }))
- defer testServer.Close()
- c := testRESTClient(t, testServer)
-
- // Test backoff recovery and increase. This correlates to the constants
- // which are used in the server implementation returning StatusOK above.
- seconds := []int{0, 1, 2, 4, 8, 0, 1, 2, 4, 0}
- request := c.Verb("POST").Prefix("backofftest").Suffix("abc")
- clock := clock.FakeClock{}
- request.backoffMgr = &URLBackoff{
- // Use a fake backoff here to avoid flakes and speed the test up.
- Backoff: flowcontrol.NewFakeBackOff(
- time.Duration(1)*time.Second,
- time.Duration(200)*time.Second,
- &clock,
- )}
-
- for _, sec := range seconds {
- thisBackoff := request.backoffMgr.CalculateBackoff(request.URL())
- t.Logf("Current backoff %v", thisBackoff)
- if thisBackoff != time.Duration(sec)*time.Second {
- t.Errorf("Backoff is %v instead of %v", thisBackoff, sec)
- }
- now := clock.Now()
- request.DoRaw()
- elapsed := clock.Since(now)
- if clock.Since(now) != thisBackoff {
- t.Errorf("CalculatedBackoff not honored by clock: Expected time of %v, but got %v ", thisBackoff, elapsed)
- }
- }
-}
-
-type testBackoffManager struct {
- sleeps []time.Duration
-}
-
-func (b *testBackoffManager) UpdateBackoff(actualUrl *url.URL, err error, responseCode int) {
-}
-
-func (b *testBackoffManager) CalculateBackoff(actualUrl *url.URL) time.Duration {
- return time.Duration(0)
-}
-
-func (b *testBackoffManager) Sleep(d time.Duration) {
- b.sleeps = append(b.sleeps, d)
-}
-
-func TestCheckRetryClosesBody(t *testing.T) {
- count := 0
- ch := make(chan struct{})
- testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
- count++
- t.Logf("attempt %d", count)
- if count >= 5 {
- w.WriteHeader(http.StatusOK)
- close(ch)
- return
- }
- w.Header().Set("Retry-After", "1")
- http.Error(w, "Too many requests, please try again later.", http.StatusTooManyRequests)
- }))
- defer testServer.Close()
-
- backoffMgr := &testBackoffManager{}
- expectedSleeps := []time.Duration{0, time.Second, 0, time.Second, 0, time.Second, 0, time.Second, 0}
-
- c := testRESTClient(t, testServer)
- c.createBackoffMgr = func() BackoffManager { return backoffMgr }
- _, err := c.Verb("POST").
- Prefix("foo", "bar").
- Suffix("baz").
- Timeout(time.Second).
- Body([]byte(strings.Repeat("abcd", 1000))).
- DoRaw()
- if err != nil {
- t.Fatalf("Unexpected error: %v %#v", err, err)
- }
- <-ch
- if count != 5 {
- t.Errorf("unexpected retries: %d", count)
- }
- if !reflect.DeepEqual(backoffMgr.sleeps, expectedSleeps) {
- t.Errorf("unexpected sleeps, expected: %v, got: %v", expectedSleeps, backoffMgr.sleeps)
- }
-}
-
-func TestConnectionResetByPeerIsRetried(t *testing.T) {
- count := 0
- backoff := &testBackoffManager{}
- req := &Request{
- verb: "GET",
- client: clientFunc(func(req *http.Request) (*http.Response, error) {
- count++
- if count >= 3 {
- return &http.Response{
- StatusCode: 200,
- Body: ioutil.NopCloser(bytes.NewReader([]byte{})),
- }, nil
- }
- return nil, &net.OpError{Err: syscall.ECONNRESET}
- }),
- backoffMgr: backoff,
- }
- // We expect two retries of "connection reset by peer" and the success.
- _, err := req.Do().Raw()
- if err != nil {
- t.Errorf("Unexpected error: %v", err)
- }
- // We have a sleep before each retry (including the initial one) and for
- // every "retry-after" call - thus 5 together.
- if len(backoff.sleeps) != 5 {
- t.Errorf("Expected 5 retries, got: %d", len(backoff.sleeps))
- }
-}
-
-func TestCheckRetryHandles429And5xx(t *testing.T) {
- count := 0
- ch := make(chan struct{})
- testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
- data, err := ioutil.ReadAll(req.Body)
- if err != nil {
- t.Fatalf("unable to read request body: %v", err)
- }
- if !bytes.Equal(data, []byte(strings.Repeat("abcd", 1000))) {
- t.Fatalf("retry did not send a complete body: %s", data)
- }
- t.Logf("attempt %d", count)
- if count >= 4 {
- w.WriteHeader(http.StatusOK)
- close(ch)
- return
- }
- w.Header().Set("Retry-After", "0")
- w.WriteHeader([]int{http.StatusTooManyRequests, 500, 501, 504}[count])
- count++
- }))
- defer testServer.Close()
-
- c := testRESTClient(t, testServer)
- _, err := c.Verb("POST").
- Prefix("foo", "bar").
- Suffix("baz").
- Timeout(time.Second).
- Body([]byte(strings.Repeat("abcd", 1000))).
- DoRaw()
- if err != nil {
- t.Fatalf("Unexpected error: %v %#v", err, err)
- }
- <-ch
- if count != 4 {
- t.Errorf("unexpected retries: %d", count)
- }
-}
-
-func BenchmarkCheckRetryClosesBody(b *testing.B) {
- count := 0
- testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
- count++
- if count%3 == 0 {
- w.WriteHeader(http.StatusOK)
- return
- }
- w.Header().Set("Retry-After", "0")
- w.WriteHeader(http.StatusTooManyRequests)
- }))
- defer testServer.Close()
-
- c := testRESTClient(b, testServer)
- r := c.Verb("POST").
- Prefix("foo", "bar").
- Suffix("baz").
- Timeout(time.Second).
- Body([]byte(strings.Repeat("abcd", 1000)))
-
- for i := 0; i < b.N; i++ {
- if _, err := r.DoRaw(); err != nil {
- b.Fatalf("Unexpected error: %v %#v", err, err)
- }
- }
-}
-
-func TestDoRequestNewWayReader(t *testing.T) {
- reqObj := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}
- reqBodyExpected, _ := runtime.Encode(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), reqObj)
- expectedObj := &v1.Service{Spec: v1.ServiceSpec{Ports: []v1.ServicePort{{
- Protocol: "TCP",
- Port: 12345,
- TargetPort: intstr.FromInt(12345),
- }}}}
- expectedBody, _ := runtime.Encode(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), expectedObj)
- fakeHandler := utiltesting.FakeHandler{
- StatusCode: 200,
- ResponseBody: string(expectedBody),
- T: t,
- }
- testServer := httptest.NewServer(&fakeHandler)
- defer testServer.Close()
- c := testRESTClient(t, testServer)
- obj, err := c.Verb("POST").
- Resource("bar").
- Name("baz").
- Prefix("foo").
- Timeout(time.Second).
- Body(bytes.NewBuffer(reqBodyExpected)).
- Do().Get()
- if err != nil {
- t.Errorf("Unexpected error: %v %#v", err, err)
- return
- }
- if obj == nil {
- t.Error("nil obj")
- } else if !apiequality.Semantic.DeepDerivative(expectedObj, obj) {
- t.Errorf("Expected: %#v, got %#v", expectedObj, obj)
- }
- tmpStr := string(reqBodyExpected)
- requestURL := defaultResourcePathWithPrefix("foo", "bar", "", "baz")
- requestURL += "?timeout=1s"
- fakeHandler.ValidateRequest(t, requestURL, "POST", &tmpStr)
-}
-
-func TestDoRequestNewWayObj(t *testing.T) {
- reqObj := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}
- reqBodyExpected, _ := runtime.Encode(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), reqObj)
- expectedObj := &v1.Service{Spec: v1.ServiceSpec{Ports: []v1.ServicePort{{
- Protocol: "TCP",
- Port: 12345,
- TargetPort: intstr.FromInt(12345),
- }}}}
- expectedBody, _ := runtime.Encode(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), expectedObj)
- fakeHandler := utiltesting.FakeHandler{
- StatusCode: 200,
- ResponseBody: string(expectedBody),
- T: t,
- }
- testServer := httptest.NewServer(&fakeHandler)
- defer testServer.Close()
- c := testRESTClient(t, testServer)
- obj, err := c.Verb("POST").
- Suffix("baz").
- Name("bar").
- Resource("foo").
- Timeout(time.Second).
- Body(reqObj).
- Do().Get()
- if err != nil {
- t.Errorf("Unexpected error: %v %#v", err, err)
- return
- }
- if obj == nil {
- t.Error("nil obj")
- } else if !apiequality.Semantic.DeepDerivative(expectedObj, obj) {
- t.Errorf("Expected: %#v, got %#v", expectedObj, obj)
- }
- tmpStr := string(reqBodyExpected)
- requestURL := defaultResourcePathWithPrefix("", "foo", "", "bar/baz")
- requestURL += "?timeout=1s"
- fakeHandler.ValidateRequest(t, requestURL, "POST", &tmpStr)
-}
-
-func TestDoRequestNewWayFile(t *testing.T) {
- reqObj := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}
- reqBodyExpected, err := runtime.Encode(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), reqObj)
- if err != nil {
- t.Errorf("unexpected error: %v", err)
- }
-
- file, err := ioutil.TempFile("", "foo")
- if err != nil {
- t.Errorf("unexpected error: %v", err)
- }
- defer file.Close()
- defer os.Remove(file.Name())
-
- _, err = file.Write(reqBodyExpected)
- if err != nil {
- t.Errorf("unexpected error: %v", err)
- }
-
- expectedObj := &v1.Service{Spec: v1.ServiceSpec{Ports: []v1.ServicePort{{
- Protocol: "TCP",
- Port: 12345,
- TargetPort: intstr.FromInt(12345),
- }}}}
- expectedBody, _ := runtime.Encode(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), expectedObj)
- fakeHandler := utiltesting.FakeHandler{
- StatusCode: 200,
- ResponseBody: string(expectedBody),
- T: t,
- }
- testServer := httptest.NewServer(&fakeHandler)
- defer testServer.Close()
- c := testRESTClient(t, testServer)
- wasCreated := true
- obj, err := c.Verb("POST").
- Prefix("foo/bar", "baz").
- Timeout(time.Second).
- Body(file.Name()).
- Do().WasCreated(&wasCreated).Get()
- if err != nil {
- t.Errorf("Unexpected error: %v %#v", err, err)
- return
- }
- if obj == nil {
- t.Error("nil obj")
- } else if !apiequality.Semantic.DeepDerivative(expectedObj, obj) {
- t.Errorf("Expected: %#v, got %#v", expectedObj, obj)
- }
- if wasCreated {
- t.Errorf("expected object was created")
- }
- tmpStr := string(reqBodyExpected)
- requestURL := defaultResourcePathWithPrefix("foo/bar/baz", "", "", "")
- requestURL += "?timeout=1s"
- fakeHandler.ValidateRequest(t, requestURL, "POST", &tmpStr)
-}
-
-func TestWasCreated(t *testing.T) {
- reqObj := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}
- reqBodyExpected, err := runtime.Encode(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), reqObj)
- if err != nil {
- t.Errorf("unexpected error: %v", err)
- }
-
- expectedObj := &v1.Service{Spec: v1.ServiceSpec{Ports: []v1.ServicePort{{
- Protocol: "TCP",
- Port: 12345,
- TargetPort: intstr.FromInt(12345),
- }}}}
- expectedBody, _ := runtime.Encode(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), expectedObj)
- fakeHandler := utiltesting.FakeHandler{
- StatusCode: 201,
- ResponseBody: string(expectedBody),
- T: t,
- }
- testServer := httptest.NewServer(&fakeHandler)
- defer testServer.Close()
- c := testRESTClient(t, testServer)
- wasCreated := false
- obj, err := c.Verb("PUT").
- Prefix("foo/bar", "baz").
- Timeout(time.Second).
- Body(reqBodyExpected).
- Do().WasCreated(&wasCreated).Get()
- if err != nil {
- t.Errorf("Unexpected error: %v %#v", err, err)
- return
- }
- if obj == nil {
- t.Error("nil obj")
- } else if !apiequality.Semantic.DeepDerivative(expectedObj, obj) {
- t.Errorf("Expected: %#v, got %#v", expectedObj, obj)
- }
- if !wasCreated {
- t.Errorf("Expected object was created")
- }
-
- tmpStr := string(reqBodyExpected)
- requestURL := defaultResourcePathWithPrefix("foo/bar/baz", "", "", "")
- requestURL += "?timeout=1s"
- fakeHandler.ValidateRequest(t, requestURL, "PUT", &tmpStr)
-}
-
-func TestVerbs(t *testing.T) {
- c := testRESTClient(t, nil)
- if r := c.Post(); r.verb != "POST" {
- t.Errorf("Post verb is wrong")
- }
- if r := c.Put(); r.verb != "PUT" {
- t.Errorf("Put verb is wrong")
- }
- if r := c.Get(); r.verb != "GET" {
- t.Errorf("Get verb is wrong")
- }
- if r := c.Delete(); r.verb != "DELETE" {
- t.Errorf("Delete verb is wrong")
- }
-}
-
-func TestAbsPath(t *testing.T) {
- for i, tc := range []struct {
- configPrefix string
- resourcePrefix string
- absPath string
- wantsAbsPath string
- }{
- {"/", "", "", "/"},
- {"", "", "/", "/"},
- {"", "", "/api", "/api"},
- {"", "", "/api/", "/api/"},
- {"", "", "/apis", "/apis"},
- {"", "/foo", "/bar/foo", "/bar/foo"},
- {"", "/api/foo/123", "/bar/foo", "/bar/foo"},
- {"/p1", "", "", "/p1"},
- {"/p1", "", "/", "/p1/"},
- {"/p1", "", "/api", "/p1/api"},
- {"/p1", "", "/apis", "/p1/apis"},
- {"/p1", "/r1", "/apis", "/p1/apis"},
- {"/p1", "/api/r1", "/apis", "/p1/apis"},
- {"/p1/api/p2", "", "", "/p1/api/p2"},
- {"/p1/api/p2", "", "/", "/p1/api/p2/"},
- {"/p1/api/p2", "", "/api", "/p1/api/p2/api"},
- {"/p1/api/p2", "", "/api/", "/p1/api/p2/api/"},
- {"/p1/api/p2", "/r1", "/api/", "/p1/api/p2/api/"},
- {"/p1/api/p2", "/api/r1", "/api/", "/p1/api/p2/api/"},
- } {
- u, _ := url.Parse("http://localhost:123" + tc.configPrefix)
- r := NewRequest(nil, "POST", u, "", ContentConfig{GroupVersion: &schema.GroupVersion{Group: "test"}}, Serializers{}, nil, nil, 0).Prefix(tc.resourcePrefix).AbsPath(tc.absPath)
- if r.pathPrefix != tc.wantsAbsPath {
- t.Errorf("test case %d failed, unexpected path: %q, expected %q", i, r.pathPrefix, tc.wantsAbsPath)
- }
- }
-}
-
-func TestUnacceptableParamNames(t *testing.T) {
- table := []struct {
- name string
- testVal string
- expectSuccess bool
- }{
- // timeout is no longer "protected"
- {"timeout", "42", true},
- }
-
- for _, item := range table {
- c := testRESTClient(t, nil)
- r := c.Get().setParam(item.name, item.testVal)
- if e, a := item.expectSuccess, r.err == nil; e != a {
- t.Errorf("expected %v, got %v (%v)", e, a, r.err)
- }
- }
-}
-
-func TestBody(t *testing.T) {
- const data = "test payload"
-
- obj := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}
- bodyExpected, _ := runtime.Encode(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), obj)
-
- f, err := ioutil.TempFile("", "test_body")
- if err != nil {
- t.Fatalf("TempFile error: %v", err)
- }
- if _, err := f.WriteString(data); err != nil {
- t.Fatalf("TempFile.WriteString error: %v", err)
- }
- f.Close()
- defer os.Remove(f.Name())
-
- var nilObject *metav1.DeleteOptions
- typedObject := interface{}(nilObject)
- c := testRESTClient(t, nil)
- tests := []struct {
- input interface{}
- expected string
- headers map[string]string
- }{
- {[]byte(data), data, nil},
- {f.Name(), data, nil},
- {strings.NewReader(data), data, nil},
- {obj, string(bodyExpected), map[string]string{"Content-Type": "application/json"}},
- {typedObject, "", nil},
- }
- for i, tt := range tests {
- r := c.Post().Body(tt.input)
- if r.err != nil {
- t.Errorf("%d: r.Body(%#v) error: %v", i, tt, r.err)
- continue
- }
- if tt.headers != nil {
- for k, v := range tt.headers {
- if r.headers.Get(k) != v {
- t.Errorf("%d: r.headers[%q] = %q; want %q", i, k, v, v)
- }
- }
- }
-
- if r.body == nil {
- if len(tt.expected) != 0 {
- t.Errorf("%d: r.body = %q; want %q", i, r.body, tt.expected)
- }
- continue
- }
- buf := make([]byte, len(tt.expected))
- if _, err := r.body.Read(buf); err != nil {
- t.Errorf("%d: r.body.Read error: %v", i, err)
- continue
- }
- body := string(buf)
- if body != tt.expected {
- t.Errorf("%d: r.body = %q; want %q", i, body, tt.expected)
- }
- }
-}
-
-func TestWatch(t *testing.T) {
- var table = []struct {
- t watch.EventType
- obj runtime.Object
- }{
- {watch.Added, &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "first"}}},
- {watch.Modified, &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "second"}}},
- {watch.Deleted, &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "last"}}},
- }
-
- testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- flusher, ok := w.(http.Flusher)
- if !ok {
- panic("need flusher!")
- }
-
- w.Header().Set("Transfer-Encoding", "chunked")
- w.WriteHeader(http.StatusOK)
- flusher.Flush()
-
- encoder := restclientwatch.NewEncoder(streaming.NewEncoder(w, scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion)), scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion))
- for _, item := range table {
- if err := encoder.Encode(&watch.Event{Type: item.t, Object: item.obj}); err != nil {
- panic(err)
- }
- flusher.Flush()
- }
- }))
- defer testServer.Close()
-
- s := testRESTClient(t, testServer)
- watching, err := s.Get().Prefix("path/to/watch/thing").Watch()
- if err != nil {
- t.Fatalf("Unexpected error")
- }
-
- for _, item := range table {
- got, ok := <-watching.ResultChan()
- if !ok {
- t.Fatalf("Unexpected early close")
- }
- if e, a := item.t, got.Type; e != a {
- t.Errorf("Expected %v, got %v", e, a)
- }
- if e, a := item.obj, got.Object; !apiequality.Semantic.DeepDerivative(e, a) {
- t.Errorf("Expected %v, got %v", e, a)
- }
- }
-
- _, ok := <-watching.ResultChan()
- if ok {
- t.Fatal("Unexpected non-close")
- }
-}
-
-func TestStream(t *testing.T) {
- expectedBody := "expected body"
-
- testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- flusher, ok := w.(http.Flusher)
- if !ok {
- panic("need flusher!")
- }
- w.Header().Set("Transfer-Encoding", "chunked")
- w.WriteHeader(http.StatusOK)
- w.Write([]byte(expectedBody))
- flusher.Flush()
- }))
- defer testServer.Close()
-
- s := testRESTClient(t, testServer)
- readCloser, err := s.Get().Prefix("path/to/stream/thing").Stream()
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- defer readCloser.Close()
- buf := new(bytes.Buffer)
- buf.ReadFrom(readCloser)
- resultBody := buf.String()
-
- if expectedBody != resultBody {
- t.Errorf("Expected %s, got %s", expectedBody, resultBody)
- }
-}
-
-func testRESTClient(t testing.TB, srv *httptest.Server) *RESTClient {
- baseURL, _ := url.Parse("http://localhost")
- if srv != nil {
- var err error
- baseURL, err = url.Parse(srv.URL)
- if err != nil {
- t.Fatalf("failed to parse test URL: %v", err)
- }
- }
- versionedAPIPath := defaultResourcePathWithPrefix("", "", "", "")
- client, err := NewRESTClient(baseURL, versionedAPIPath, defaultContentConfig(), 0, 0, nil, nil)
- if err != nil {
- t.Fatalf("failed to create a client: %v", err)
- }
- return client
-}
-
-func TestDoContext(t *testing.T) {
- receivedCh := make(chan struct{})
- block := make(chan struct{})
- testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
- close(receivedCh)
- <-block
- w.WriteHeader(http.StatusOK)
- }))
- defer testServer.Close()
- defer close(block)
-
- ctx, cancel := context.WithCancel(context.Background())
- defer cancel()
-
- go func() {
- <-receivedCh
- cancel()
- }()
-
- c := testRESTClient(t, testServer)
- _, err := c.Verb("GET").
- Context(ctx).
- Prefix("foo").
- DoRaw()
- if err == nil {
- t.Fatal("Expected context cancellation error")
- }
-}
-
-func buildString(length int) string {
- s := make([]byte, length)
- for i := range s {
- s[i] = 'a'
- }
- return string(s)
-}
-
-func TestTruncateBody(t *testing.T) {
- tests := []struct {
- body string
- want string
- level string
- }{
- // Anything below 8 is completely truncated
- {
- body: "Completely truncated below 8",
- want: " [truncated 28 chars]",
- level: "0",
- },
- // Small strings are not truncated by high levels
- {
- body: "Small body never gets truncated",
- want: "Small body never gets truncated",
- level: "10",
- },
- {
- body: "Small body never gets truncated",
- want: "Small body never gets truncated",
- level: "8",
- },
- // Strings are truncated to 1024 if level is less than 9.
- {
- body: buildString(2000),
- level: "8",
- want: fmt.Sprintf("%s [truncated 976 chars]", buildString(1024)),
- },
- // Strings are truncated to 10240 if level is 9.
- {
- body: buildString(20000),
- level: "9",
- want: fmt.Sprintf("%s [truncated 9760 chars]", buildString(10240)),
- },
- // Strings are not truncated if level is 10 or higher
- {
- body: buildString(20000),
- level: "10",
- want: buildString(20000),
- },
- // Strings are not truncated if level is 10 or higher
- {
- body: buildString(20000),
- level: "11",
- want: buildString(20000),
- },
- }
-
- l := flag.Lookup("v").Value.(flag.Getter).Get().(glog.Level)
- for _, test := range tests {
- flag.Set("v", test.level)
- got := truncateBody(test.body)
- if got != test.want {
- t.Errorf("truncateBody(%v) = %v, want %v", test.body, got, test.want)
- }
- }
- flag.Set("v", l.String())
-}
-
-func defaultResourcePathWithPrefix(prefix, resource, namespace, name string) string {
- var path string
- path = "/api/" + v1.SchemeGroupVersion.Version
-
- if prefix != "" {
- path = path + "/" + prefix
- }
- if namespace != "" {
- path = path + "/namespaces/" + namespace
- }
- // Resource names are lower case.
- resource = strings.ToLower(resource)
- if resource != "" {
- path = path + "/" + resource
- }
- if name != "" {
- path = path + "/" + name
- }
- return path
-}
diff --git a/vendor/k8s.io/client-go/rest/url_utils_test.go b/vendor/k8s.io/client-go/rest/url_utils_test.go
deleted file mode 100644
index 6321678a4..000000000
--- a/vendor/k8s.io/client-go/rest/url_utils_test.go
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package rest
-
-import (
- "path"
- "testing"
-
- "k8s.io/api/core/v1"
-)
-
-func TestValidatesHostParameter(t *testing.T) {
- testCases := []struct {
- Host string
- APIPath string
-
- URL string
- Err bool
- }{
- {"127.0.0.1", "", "http://127.0.0.1/" + v1.SchemeGroupVersion.Version, false},
- {"127.0.0.1:8080", "", "http://127.0.0.1:8080/" + v1.SchemeGroupVersion.Version, false},
- {"foo.bar.com", "", "http://foo.bar.com/" + v1.SchemeGroupVersion.Version, false},
- {"http://host/prefix", "", "http://host/prefix/" + v1.SchemeGroupVersion.Version, false},
- {"http://host", "", "http://host/" + v1.SchemeGroupVersion.Version, false},
- {"http://host", "/", "http://host/" + v1.SchemeGroupVersion.Version, false},
- {"http://host", "/other", "http://host/other/" + v1.SchemeGroupVersion.Version, false},
- {"host/server", "", "", true},
- }
- for i, testCase := range testCases {
- u, versionedAPIPath, err := DefaultServerURL(testCase.Host, testCase.APIPath, v1.SchemeGroupVersion, false)
- switch {
- case err == nil && testCase.Err:
- t.Errorf("expected error but was nil")
- continue
- case err != nil && !testCase.Err:
- t.Errorf("unexpected error %v", err)
- continue
- case err != nil:
- continue
- }
- u.Path = path.Join(u.Path, versionedAPIPath)
- if e, a := testCase.URL, u.String(); e != a {
- t.Errorf("%d: expected host %s, got %s", i, e, a)
- continue
- }
- }
-}
diff --git a/vendor/k8s.io/client-go/rest/urlbackoff_test.go b/vendor/k8s.io/client-go/rest/urlbackoff_test.go
deleted file mode 100644
index c5f439238..000000000
--- a/vendor/k8s.io/client-go/rest/urlbackoff_test.go
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package rest
-
-import (
- "net/url"
- "testing"
- "time"
-
- "k8s.io/client-go/util/flowcontrol"
-)
-
-func parse(raw string) *url.URL {
- theUrl, _ := url.Parse(raw)
- return theUrl
-}
-
-func TestURLBackoffFunctionalityCollisions(t *testing.T) {
- myBackoff := &URLBackoff{
- Backoff: flowcontrol.NewBackOff(1*time.Second, 60*time.Second),
- }
-
- // Add some noise and make sure backoff for a clean URL is zero.
- myBackoff.UpdateBackoff(parse("http://100.200.300.400:8080"), nil, 500)
-
- myBackoff.UpdateBackoff(parse("http://1.2.3.4:8080"), nil, 500)
-
- if myBackoff.CalculateBackoff(parse("http://1.2.3.4:100")) > 0 {
- t.Errorf("URLs are colliding in the backoff map!")
- }
-}
-
-// TestURLBackoffFunctionality generally tests the URLBackoff wrapper. We avoid duplicating tests from backoff and request.
-func TestURLBackoffFunctionality(t *testing.T) {
- myBackoff := &URLBackoff{
- Backoff: flowcontrol.NewBackOff(1*time.Second, 60*time.Second),
- }
-
- // Now test that backoff increases, then recovers.
- // 200 and 300 should both result in clearing the backoff.
- // all others like 429 should result in increased backoff.
- seconds := []int{0,
- 1, 2, 4, 8, 0,
- 1, 2}
- returnCodes := []int{
- 429, 500, 501, 502, 300,
- 500, 501, 502,
- }
-
- if len(seconds) != len(returnCodes) {
- t.Fatalf("responseCode to backoff arrays should be the same length... sanity check failed.")
- }
-
- for i, sec := range seconds {
- backoffSec := myBackoff.CalculateBackoff(parse("http://1.2.3.4:100"))
- if backoffSec < time.Duration(sec)*time.Second || backoffSec > time.Duration(sec+5)*time.Second {
- t.Errorf("Backoff out of range %v: %v %v", i, sec, backoffSec)
- }
- myBackoff.UpdateBackoff(parse("http://1.2.3.4:100/responseCodeForFuncTest"), nil, returnCodes[i])
- }
-
- if myBackoff.CalculateBackoff(parse("http://1.2.3.4:100")) == 0 {
- t.Errorf("The final return code %v should have resulted in a backoff ! ", returnCodes[7])
- }
-}
diff --git a/vendor/k8s.io/client-go/rest/watch/decoder_test.go b/vendor/k8s.io/client-go/rest/watch/decoder_test.go
deleted file mode 100644
index 2d29d437d..000000000
--- a/vendor/k8s.io/client-go/rest/watch/decoder_test.go
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package versioned_test
-
-import (
- "encoding/json"
- "io"
- "testing"
- "time"
-
- "k8s.io/api/core/v1"
- apiequality "k8s.io/apimachinery/pkg/api/equality"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/serializer"
- runtimejson "k8s.io/apimachinery/pkg/runtime/serializer/json"
- "k8s.io/apimachinery/pkg/runtime/serializer/streaming"
- "k8s.io/apimachinery/pkg/util/wait"
- "k8s.io/apimachinery/pkg/watch"
- "k8s.io/client-go/kubernetes/scheme"
- restclientwatch "k8s.io/client-go/rest/watch"
-)
-
-// getDecoder mimics how k8s.io/client-go/rest.createSerializers creates a decoder
-func getDecoder() runtime.Decoder {
- jsonSerializer := runtimejson.NewSerializer(runtimejson.DefaultMetaFactory, scheme.Scheme, scheme.Scheme, false)
- directCodecFactory := serializer.DirectCodecFactory{CodecFactory: scheme.Codecs}
- return directCodecFactory.DecoderToVersion(jsonSerializer, v1.SchemeGroupVersion)
-}
-
-func TestDecoder(t *testing.T) {
- table := []watch.EventType{watch.Added, watch.Deleted, watch.Modified, watch.Error}
-
- for _, eventType := range table {
- out, in := io.Pipe()
-
- decoder := restclientwatch.NewDecoder(streaming.NewDecoder(out, getDecoder()), getDecoder())
-
- expect := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}
- encoder := json.NewEncoder(in)
- go func() {
- data, err := runtime.Encode(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), expect)
- if err != nil {
- t.Fatalf("Unexpected error %v", err)
- }
- event := metav1.WatchEvent{
- Type: string(eventType),
- Object: runtime.RawExtension{Raw: json.RawMessage(data)},
- }
- if err := encoder.Encode(&event); err != nil {
- t.Errorf("Unexpected error %v", err)
- }
- in.Close()
- }()
-
- done := make(chan struct{})
- go func() {
- action, got, err := decoder.Decode()
- if err != nil {
- t.Fatalf("Unexpected error %v", err)
- }
- if e, a := eventType, action; e != a {
- t.Errorf("Expected %v, got %v", e, a)
- }
- if e, a := expect, got; !apiequality.Semantic.DeepDerivative(e, a) {
- t.Errorf("Expected %v, got %v", e, a)
- }
- t.Logf("Exited read")
- close(done)
- }()
- <-done
-
- done = make(chan struct{})
- go func() {
- _, _, err := decoder.Decode()
- if err == nil {
- t.Errorf("Unexpected nil error")
- }
- close(done)
- }()
- <-done
-
- decoder.Close()
- }
-}
-
-func TestDecoder_SourceClose(t *testing.T) {
- out, in := io.Pipe()
- decoder := restclientwatch.NewDecoder(streaming.NewDecoder(out, getDecoder()), getDecoder())
-
- done := make(chan struct{})
-
- go func() {
- _, _, err := decoder.Decode()
- if err == nil {
- t.Errorf("Unexpected nil error")
- }
- close(done)
- }()
-
- in.Close()
-
- select {
- case <-done:
- break
- case <-time.After(wait.ForeverTestTimeout):
- t.Error("Timeout")
- }
-}
diff --git a/vendor/k8s.io/client-go/rest/watch/encoder_test.go b/vendor/k8s.io/client-go/rest/watch/encoder_test.go
deleted file mode 100644
index 1388d1cc6..000000000
--- a/vendor/k8s.io/client-go/rest/watch/encoder_test.go
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package versioned_test
-
-import (
- "bytes"
- "io/ioutil"
- "testing"
-
- "k8s.io/api/core/v1"
- apiequality "k8s.io/apimachinery/pkg/api/equality"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/serializer"
- runtimejson "k8s.io/apimachinery/pkg/runtime/serializer/json"
- "k8s.io/apimachinery/pkg/runtime/serializer/streaming"
- "k8s.io/apimachinery/pkg/watch"
- "k8s.io/client-go/kubernetes/scheme"
- restclientwatch "k8s.io/client-go/rest/watch"
-)
-
-// getEncoder mimics how k8s.io/client-go/rest.createSerializers creates a encoder
-func getEncoder() runtime.Encoder {
- jsonSerializer := runtimejson.NewSerializer(runtimejson.DefaultMetaFactory, scheme.Scheme, scheme.Scheme, false)
- directCodecFactory := serializer.DirectCodecFactory{CodecFactory: scheme.Codecs}
- return directCodecFactory.EncoderForVersion(jsonSerializer, v1.SchemeGroupVersion)
-}
-
-func TestEncodeDecodeRoundTrip(t *testing.T) {
- testCases := []struct {
- Type watch.EventType
- Object runtime.Object
- }{
- {
- watch.Added,
- &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}},
- },
- {
- watch.Modified,
- &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}},
- },
- {
- watch.Deleted,
- &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}},
- },
- }
- for i, testCase := range testCases {
- buf := &bytes.Buffer{}
-
- encoder := restclientwatch.NewEncoder(streaming.NewEncoder(buf, getEncoder()), getEncoder())
- if err := encoder.Encode(&watch.Event{Type: testCase.Type, Object: testCase.Object}); err != nil {
- t.Errorf("%d: unexpected error: %v", i, err)
- continue
- }
-
- rc := ioutil.NopCloser(buf)
- decoder := restclientwatch.NewDecoder(streaming.NewDecoder(rc, getDecoder()), getDecoder())
- event, obj, err := decoder.Decode()
- if err != nil {
- t.Errorf("%d: unexpected error: %v", i, err)
- continue
- }
- if !apiequality.Semantic.DeepDerivative(testCase.Object, obj) {
- t.Errorf("%d: expected %#v, got %#v", i, testCase.Object, obj)
- }
- if event != testCase.Type {
- t.Errorf("%d: unexpected type: %#v", i, event)
- }
- }
-}
diff --git a/vendor/k8s.io/client-go/testing/fixture_test.go b/vendor/k8s.io/client-go/testing/fixture_test.go
deleted file mode 100644
index 405fe1a7e..000000000
--- a/vendor/k8s.io/client-go/testing/fixture_test.go
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
-Copyright 2015 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package testing
-
-import (
- "fmt"
- "math/rand"
- "strconv"
- "sync"
- "testing"
-
- "github.com/stretchr/testify/assert"
-
- "k8s.io/apimachinery/pkg/api/meta"
- "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
- runtime "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- serializer "k8s.io/apimachinery/pkg/runtime/serializer"
- "k8s.io/apimachinery/pkg/watch"
-)
-
-func getArbitraryResource(s schema.GroupVersionResource, name, namespace string) *unstructured.Unstructured {
- return &unstructured.Unstructured{
- Object: map[string]interface{}{
- "kind": s.Resource,
- "apiVersion": s.Version,
- "metadata": map[string]interface{}{
- "name": name,
- "namespace": namespace,
- "generateName": "test_generateName",
- "uid": "test_uid",
- "resourceVersion": "test_resourceVersion",
- "selfLink": "test_selfLink",
- },
- "data": strconv.Itoa(rand.Int()),
- },
- }
-}
-
-func TestWatchCallNonNamespace(t *testing.T) {
- testResource := schema.GroupVersionResource{Group: "", Version: "test_version", Resource: "test_kind"}
- testObj := getArbitraryResource(testResource, "test_name", "test_namespace")
- accessor, err := meta.Accessor(testObj)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- ns := accessor.GetNamespace()
- scheme := runtime.NewScheme()
- codecs := serializer.NewCodecFactory(scheme)
- o := NewObjectTracker(scheme, codecs.UniversalDecoder())
- watch, err := o.Watch(testResource, ns)
- if err != nil {
- t.Fatalf("test resource watch failed in %s: %v ", ns, err)
- }
- go func() {
- err := o.Create(testResource, testObj, ns)
- if err != nil {
- t.Errorf("test resource creation failed: %v", err)
- }
- }()
- out := <-watch.ResultChan()
- assert.Equal(t, testObj, out.Object, "watched object mismatch")
-}
-
-func TestWatchCallAllNamespace(t *testing.T) {
- testResource := schema.GroupVersionResource{Group: "", Version: "test_version", Resource: "test_kind"}
- testObj := getArbitraryResource(testResource, "test_name", "test_namespace")
- accessor, err := meta.Accessor(testObj)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- ns := accessor.GetNamespace()
- scheme := runtime.NewScheme()
- codecs := serializer.NewCodecFactory(scheme)
- o := NewObjectTracker(scheme, codecs.UniversalDecoder())
- w, err := o.Watch(testResource, "test_namespace")
- if err != nil {
- t.Fatalf("test resource watch failed in test_namespace: %v", err)
- }
- wAll, err := o.Watch(testResource, "")
- if err != nil {
- t.Fatalf("test resource watch failed in all namespaces: %v", err)
- }
- go func() {
- err := o.Create(testResource, testObj, ns)
- assert.NoError(t, err, "test resource creation failed")
- }()
- out := <-w.ResultChan()
- outAll := <-wAll.ResultChan()
- assert.Equal(t, watch.Added, out.Type, "watch event mismatch")
- assert.Equal(t, watch.Added, outAll.Type, "watch event mismatch")
- assert.Equal(t, testObj, out.Object, "watched created object mismatch")
- assert.Equal(t, testObj, outAll.Object, "watched created object mismatch")
- go func() {
- err := o.Update(testResource, testObj, ns)
- assert.NoError(t, err, "test resource updating failed")
- }()
- out = <-w.ResultChan()
- outAll = <-wAll.ResultChan()
- assert.Equal(t, watch.Modified, out.Type, "watch event mismatch")
- assert.Equal(t, watch.Modified, outAll.Type, "watch event mismatch")
- assert.Equal(t, testObj, out.Object, "watched updated object mismatch")
- assert.Equal(t, testObj, outAll.Object, "watched updated object mismatch")
- go func() {
- err := o.Delete(testResource, "test_namespace", "test_name")
- assert.NoError(t, err, "test resource deletion failed")
- }()
- out = <-w.ResultChan()
- outAll = <-wAll.ResultChan()
- assert.Equal(t, watch.Deleted, out.Type, "watch event mismatch")
- assert.Equal(t, watch.Deleted, outAll.Type, "watch event mismatch")
- assert.Equal(t, testObj, out.Object, "watched deleted object mismatch")
- assert.Equal(t, testObj, outAll.Object, "watched deleted object mismatch")
-}
-
-func TestWatchCallMultipleInvocation(t *testing.T) {
- cases := []struct {
- name string
- op watch.EventType
- }{
- {
- "foo",
- watch.Added,
- },
- {
- "bar",
- watch.Added,
- },
- {
- "bar",
- watch.Modified,
- },
- {
- "foo",
- watch.Deleted,
- },
- {
- "bar",
- watch.Deleted,
- },
- }
-
- scheme := runtime.NewScheme()
- codecs := serializer.NewCodecFactory(scheme)
- testResource := schema.GroupVersionResource{Group: "", Version: "test_version", Resource: "test_kind"}
-
- o := NewObjectTracker(scheme, codecs.UniversalDecoder())
- watchNamespaces := []string{
- "",
- "",
- "test_namespace",
- "test_namespace",
- }
- var wg sync.WaitGroup
- wg.Add(len(watchNamespaces))
- for idx, watchNamespace := range watchNamespaces {
- i := idx
- w, err := o.Watch(testResource, watchNamespace)
- if err != nil {
- t.Fatalf("test resource watch failed in %s: %v", watchNamespace, err)
- }
- go func() {
- assert.NoError(t, err, "watch invocation failed")
- for _, c := range cases {
- fmt.Printf("%#v %#v\n", c, i)
- event := <-w.ResultChan()
- accessor, err := meta.Accessor(event.Object)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- assert.Equal(t, c.op, event.Type, "watch event mismatched")
- assert.Equal(t, c.name, accessor.GetName(), "watched object mismatch")
- }
- wg.Done()
- }()
- }
- for _, c := range cases {
- switch c.op {
- case watch.Added:
- obj := getArbitraryResource(testResource, c.name, "test_namespace")
- o.Create(testResource, obj, "test_namespace")
- case watch.Modified:
- obj := getArbitraryResource(testResource, c.name, "test_namespace")
- o.Update(testResource, obj, "test_namespace")
- case watch.Deleted:
- o.Delete(testResource, "test_namespace", c.name)
- }
- }
- wg.Wait()
-}
-
-func TestWatchAddAfterStop(t *testing.T) {
- testResource := schema.GroupVersionResource{Group: "", Version: "test_version", Resource: "test_kind"}
- testObj := getArbitraryResource(testResource, "test_name", "test_namespace")
- accessor, err := meta.Accessor(testObj)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
-
- ns := accessor.GetNamespace()
- scheme := runtime.NewScheme()
- codecs := serializer.NewCodecFactory(scheme)
- o := NewObjectTracker(scheme, codecs.UniversalDecoder())
- watch, err := o.Watch(testResource, ns)
- if err != nil {
- t.Errorf("watch creation failed: %v", err)
- }
-
- // When the watch is stopped it should ignore later events without panicking.
- defer func() {
- if r := recover(); r != nil {
- t.Errorf("Watch panicked when it should have ignored create after stop: %v", r)
- }
- }()
-
- watch.Stop()
- err = o.Create(testResource, testObj, ns)
- if err != nil {
- t.Errorf("test resource creation failed: %v", err)
- }
-}
diff --git a/vendor/k8s.io/client-go/tools/auth/clientauth_test.go b/vendor/k8s.io/client-go/tools/auth/clientauth_test.go
deleted file mode 100644
index 11f7369de..000000000
--- a/vendor/k8s.io/client-go/tools/auth/clientauth_test.go
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package auth_test
-
-import (
- "io/ioutil"
- "os"
- "reflect"
- "testing"
-
- clientauth "k8s.io/client-go/tools/auth"
-)
-
-func TestLoadFromFile(t *testing.T) {
- loadAuthInfoTests := []struct {
- authData string
- authInfo *clientauth.Info
- expectErr bool
- }{
- {
- `{"user": "user", "password": "pass"}`,
- &clientauth.Info{User: "user", Password: "pass"},
- false,
- },
- {
- "", nil, true,
- },
- }
- for _, loadAuthInfoTest := range loadAuthInfoTests {
- tt := loadAuthInfoTest
- aifile, err := ioutil.TempFile("", "testAuthInfo")
- if err != nil {
- t.Errorf("Unexpected error: %v", err)
- }
- if tt.authData != "missing" {
- defer os.Remove(aifile.Name())
- defer aifile.Close()
- _, err = aifile.WriteString(tt.authData)
- if err != nil {
- t.Errorf("Unexpected error: %v", err)
- }
- } else {
- aifile.Close()
- os.Remove(aifile.Name())
- }
- authInfo, err := clientauth.LoadFromFile(aifile.Name())
- gotErr := err != nil
- if gotErr != tt.expectErr {
- t.Errorf("expected errorness: %v, actual errorness: %v", tt.expectErr, gotErr)
- }
- if !reflect.DeepEqual(authInfo, tt.authInfo) {
- t.Errorf("Expected %v, got %v", tt.authInfo, authInfo)
- }
- }
-}
diff --git a/vendor/k8s.io/client-go/tools/cache/controller_test.go b/vendor/k8s.io/client-go/tools/cache/controller_test.go
deleted file mode 100644
index 64aca8d7d..000000000
--- a/vendor/k8s.io/client-go/tools/cache/controller_test.go
+++ /dev/null
@@ -1,405 +0,0 @@
-/*
-Copyright 2015 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package cache
-
-import (
- "fmt"
- "math/rand"
- "sync"
- "testing"
- "time"
-
- "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/util/sets"
- "k8s.io/apimachinery/pkg/util/wait"
- "k8s.io/apimachinery/pkg/watch"
- fcache "k8s.io/client-go/tools/cache/testing"
-
- "github.com/google/gofuzz"
-)
-
-func Example() {
- // source simulates an apiserver object endpoint.
- source := fcache.NewFakeControllerSource()
-
- // This will hold the downstream state, as we know it.
- downstream := NewStore(DeletionHandlingMetaNamespaceKeyFunc)
-
- // This will hold incoming changes. Note how we pass downstream in as a
- // KeyLister, that way resync operations will result in the correct set
- // of update/delete deltas.
- fifo := NewDeltaFIFO(MetaNamespaceKeyFunc, downstream)
-
- // Let's do threadsafe output to get predictable test results.
- deletionCounter := make(chan string, 1000)
-
- cfg := &Config{
- Queue: fifo,
- ListerWatcher: source,
- ObjectType: &v1.Pod{},
- FullResyncPeriod: time.Millisecond * 100,
- RetryOnError: false,
-
- // Let's implement a simple controller that just deletes
- // everything that comes in.
- Process: func(obj interface{}) error {
- // Obj is from the Pop method of the Queue we make above.
- newest := obj.(Deltas).Newest()
-
- if newest.Type != Deleted {
- // Update our downstream store.
- err := downstream.Add(newest.Object)
- if err != nil {
- return err
- }
-
- // Delete this object.
- source.Delete(newest.Object.(runtime.Object))
- } else {
- // Update our downstream store.
- err := downstream.Delete(newest.Object)
- if err != nil {
- return err
- }
-
- // fifo's KeyOf is easiest, because it handles
- // DeletedFinalStateUnknown markers.
- key, err := fifo.KeyOf(newest.Object)
- if err != nil {
- return err
- }
-
- // Report this deletion.
- deletionCounter <- key
- }
- return nil
- },
- }
-
- // Create the controller and run it until we close stop.
- stop := make(chan struct{})
- defer close(stop)
- go New(cfg).Run(stop)
-
- // Let's add a few objects to the source.
- testIDs := []string{"a-hello", "b-controller", "c-framework"}
- for _, name := range testIDs {
- // Note that these pods are not valid-- the fake source doesn't
- // call validation or anything.
- source.Add(&v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: name}})
- }
-
- // Let's wait for the controller to process the things we just added.
- outputSet := sets.String{}
- for i := 0; i < len(testIDs); i++ {
- outputSet.Insert(<-deletionCounter)
- }
-
- for _, key := range outputSet.List() {
- fmt.Println(key)
- }
- // Output:
- // a-hello
- // b-controller
- // c-framework
-}
-
-func ExampleNewInformer() {
- // source simulates an apiserver object endpoint.
- source := fcache.NewFakeControllerSource()
-
- // Let's do threadsafe output to get predictable test results.
- deletionCounter := make(chan string, 1000)
-
- // Make a controller that immediately deletes anything added to it, and
- // logs anything deleted.
- _, controller := NewInformer(
- source,
- &v1.Pod{},
- time.Millisecond*100,
- ResourceEventHandlerFuncs{
- AddFunc: func(obj interface{}) {
- source.Delete(obj.(runtime.Object))
- },
- DeleteFunc: func(obj interface{}) {
- key, err := DeletionHandlingMetaNamespaceKeyFunc(obj)
- if err != nil {
- key = "oops something went wrong with the key"
- }
-
- // Report this deletion.
- deletionCounter <- key
- },
- },
- )
-
- // Run the controller and run it until we close stop.
- stop := make(chan struct{})
- defer close(stop)
- go controller.Run(stop)
-
- // Let's add a few objects to the source.
- testIDs := []string{"a-hello", "b-controller", "c-framework"}
- for _, name := range testIDs {
- // Note that these pods are not valid-- the fake source doesn't
- // call validation or anything.
- source.Add(&v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: name}})
- }
-
- // Let's wait for the controller to process the things we just added.
- outputSet := sets.String{}
- for i := 0; i < len(testIDs); i++ {
- outputSet.Insert(<-deletionCounter)
- }
-
- for _, key := range outputSet.List() {
- fmt.Println(key)
- }
- // Output:
- // a-hello
- // b-controller
- // c-framework
-}
-
-func TestHammerController(t *testing.T) {
- // This test executes a bunch of requests through the fake source and
- // controller framework to make sure there's no locking/threading
- // errors. If an error happens, it should hang forever or trigger the
- // race detector.
-
- // source simulates an apiserver object endpoint.
- source := fcache.NewFakeControllerSource()
-
- // Let's do threadsafe output to get predictable test results.
- outputSetLock := sync.Mutex{}
- // map of key to operations done on the key
- outputSet := map[string][]string{}
-
- recordFunc := func(eventType string, obj interface{}) {
- key, err := DeletionHandlingMetaNamespaceKeyFunc(obj)
- if err != nil {
- t.Errorf("something wrong with key: %v", err)
- key = "oops something went wrong with the key"
- }
-
- // Record some output when items are deleted.
- outputSetLock.Lock()
- defer outputSetLock.Unlock()
- outputSet[key] = append(outputSet[key], eventType)
- }
-
- // Make a controller which just logs all the changes it gets.
- _, controller := NewInformer(
- source,
- &v1.Pod{},
- time.Millisecond*100,
- ResourceEventHandlerFuncs{
- AddFunc: func(obj interface{}) { recordFunc("add", obj) },
- UpdateFunc: func(oldObj, newObj interface{}) { recordFunc("update", newObj) },
- DeleteFunc: func(obj interface{}) { recordFunc("delete", obj) },
- },
- )
-
- if controller.HasSynced() {
- t.Errorf("Expected HasSynced() to return false before we started the controller")
- }
-
- // Run the controller and run it until we close stop.
- stop := make(chan struct{})
- go controller.Run(stop)
-
- // Let's wait for the controller to do its initial sync
- wait.Poll(100*time.Millisecond, wait.ForeverTestTimeout, func() (bool, error) {
- return controller.HasSynced(), nil
- })
- if !controller.HasSynced() {
- t.Errorf("Expected HasSynced() to return true after the initial sync")
- }
-
- wg := sync.WaitGroup{}
- const threads = 3
- wg.Add(threads)
- for i := 0; i < threads; i++ {
- go func() {
- defer wg.Done()
- // Let's add a few objects to the source.
- currentNames := sets.String{}
- rs := rand.NewSource(rand.Int63())
- f := fuzz.New().NilChance(.5).NumElements(0, 2).RandSource(rs)
- r := rand.New(rs) // Mustn't use r and f concurrently!
- for i := 0; i < 100; i++ {
- var name string
- var isNew bool
- if currentNames.Len() == 0 || r.Intn(3) == 1 {
- f.Fuzz(&name)
- isNew = true
- } else {
- l := currentNames.List()
- name = l[r.Intn(len(l))]
- }
-
- pod := &v1.Pod{}
- f.Fuzz(pod)
- pod.ObjectMeta.Name = name
- pod.ObjectMeta.Namespace = "default"
- // Add, update, or delete randomly.
- // Note that these pods are not valid-- the fake source doesn't
- // call validation or perform any other checking.
- if isNew {
- currentNames.Insert(name)
- source.Add(pod)
- continue
- }
- switch r.Intn(2) {
- case 0:
- currentNames.Insert(name)
- source.Modify(pod)
- case 1:
- currentNames.Delete(name)
- source.Delete(pod)
- }
- }
- }()
- }
- wg.Wait()
-
- // Let's wait for the controller to finish processing the things we just added.
- // TODO: look in the queue to see how many items need to be processed.
- time.Sleep(100 * time.Millisecond)
- close(stop)
-
- // TODO: Verify that no goroutines were leaked here and that everything shut
- // down cleanly.
-
- outputSetLock.Lock()
- t.Logf("got: %#v", outputSet)
-}
-
-func TestUpdate(t *testing.T) {
- // This test is going to exercise the various paths that result in a
- // call to update.
-
- // source simulates an apiserver object endpoint.
- source := fcache.NewFakeControllerSource()
-
- const (
- FROM = "from"
- TO = "to"
- )
-
- // These are the transitions we expect to see; because this is
- // asynchronous, there are a lot of valid possibilities.
- type pair struct{ from, to string }
- allowedTransitions := map[pair]bool{
- {FROM, TO}: true,
-
- // Because a resync can happen when we've already observed one
- // of the above but before the item is deleted.
- {TO, TO}: true,
- // Because a resync could happen before we observe an update.
- {FROM, FROM}: true,
- }
-
- pod := func(name, check string, final bool) *v1.Pod {
- p := &v1.Pod{
- ObjectMeta: metav1.ObjectMeta{
- Name: name,
- Labels: map[string]string{"check": check},
- },
- }
- if final {
- p.Labels["final"] = "true"
- }
- return p
- }
- deletePod := func(p *v1.Pod) bool {
- return p.Labels["final"] == "true"
- }
-
- tests := []func(string){
- func(name string) {
- name = "a-" + name
- source.Add(pod(name, FROM, false))
- source.Modify(pod(name, TO, true))
- },
- }
-
- const threads = 3
-
- var testDoneWG sync.WaitGroup
- testDoneWG.Add(threads * len(tests))
-
- // Make a controller that deletes things once it observes an update.
- // It calls Done() on the wait group on deletions so we can tell when
- // everything we've added has been deleted.
- watchCh := make(chan struct{})
- _, controller := NewInformer(
- &testLW{
- WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
- watch, err := source.Watch(options)
- close(watchCh)
- return watch, err
- },
- ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
- return source.List(options)
- },
- },
- &v1.Pod{},
- 0,
- ResourceEventHandlerFuncs{
- UpdateFunc: func(oldObj, newObj interface{}) {
- o, n := oldObj.(*v1.Pod), newObj.(*v1.Pod)
- from, to := o.Labels["check"], n.Labels["check"]
- if !allowedTransitions[pair{from, to}] {
- t.Errorf("observed transition %q -> %q for %v", from, to, n.Name)
- }
- if deletePod(n) {
- source.Delete(n)
- }
- },
- DeleteFunc: func(obj interface{}) {
- testDoneWG.Done()
- },
- },
- )
-
- // Run the controller and run it until we close stop.
- // Once Run() is called, calls to testDoneWG.Done() might start, so
- // all testDoneWG.Add() calls must happen before this point
- stop := make(chan struct{})
- go controller.Run(stop)
- <-watchCh
-
- // run every test a few times, in parallel
- var wg sync.WaitGroup
- wg.Add(threads * len(tests))
- for i := 0; i < threads; i++ {
- for j, f := range tests {
- go func(name string, f func(string)) {
- defer wg.Done()
- f(name)
- }(fmt.Sprintf("%v-%v", i, j), f)
- }
- }
- wg.Wait()
-
- // Let's wait for the controller to process the things we just added.
- testDoneWG.Wait()
- close(stop)
-}
diff --git a/vendor/k8s.io/client-go/tools/cache/delta_fifo_test.go b/vendor/k8s.io/client-go/tools/cache/delta_fifo_test.go
deleted file mode 100644
index 9f8e57580..000000000
--- a/vendor/k8s.io/client-go/tools/cache/delta_fifo_test.go
+++ /dev/null
@@ -1,492 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package cache
-
-import (
- "fmt"
- "reflect"
- "testing"
- "time"
-)
-
-// helper function to reduce stuttering
-func testPop(f *DeltaFIFO) testFifoObject {
- return Pop(f).(Deltas).Newest().Object.(testFifoObject)
-}
-
-// keyLookupFunc adapts a raw function to be a KeyLookup.
-type keyLookupFunc func() []testFifoObject
-
-// ListKeys just calls kl.
-func (kl keyLookupFunc) ListKeys() []string {
- result := []string{}
- for _, fifoObj := range kl() {
- result = append(result, fifoObj.name)
- }
- return result
-}
-
-// GetByKey returns the key if it exists in the list returned by kl.
-func (kl keyLookupFunc) GetByKey(key string) (interface{}, bool, error) {
- for _, v := range kl() {
- if v.name == key {
- return v, true, nil
- }
- }
- return nil, false, nil
-}
-
-func TestDeltaFIFO_basic(t *testing.T) {
- f := NewDeltaFIFO(testFifoObjectKeyFunc, nil)
- const amount = 500
- go func() {
- for i := 0; i < amount; i++ {
- f.Add(mkFifoObj(string([]rune{'a', rune(i)}), i+1))
- }
- }()
- go func() {
- for u := uint64(0); u < amount; u++ {
- f.Add(mkFifoObj(string([]rune{'b', rune(u)}), u+1))
- }
- }()
-
- lastInt := int(0)
- lastUint := uint64(0)
- for i := 0; i < amount*2; i++ {
- switch obj := testPop(f).val.(type) {
- case int:
- if obj <= lastInt {
- t.Errorf("got %v (int) out of order, last was %v", obj, lastInt)
- }
- lastInt = obj
- case uint64:
- if obj <= lastUint {
- t.Errorf("got %v (uint) out of order, last was %v", obj, lastUint)
- } else {
- lastUint = obj
- }
- default:
- t.Fatalf("unexpected type %#v", obj)
- }
- }
-}
-
-func TestDeltaFIFO_requeueOnPop(t *testing.T) {
- f := NewDeltaFIFO(testFifoObjectKeyFunc, nil)
-
- f.Add(mkFifoObj("foo", 10))
- _, err := f.Pop(func(obj interface{}) error {
- if obj.(Deltas)[0].Object.(testFifoObject).name != "foo" {
- t.Fatalf("unexpected object: %#v", obj)
- }
- return ErrRequeue{Err: nil}
- })
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- if _, ok, err := f.GetByKey("foo"); !ok || err != nil {
- t.Fatalf("object should have been requeued: %t %v", ok, err)
- }
-
- _, err = f.Pop(func(obj interface{}) error {
- if obj.(Deltas)[0].Object.(testFifoObject).name != "foo" {
- t.Fatalf("unexpected object: %#v", obj)
- }
- return ErrRequeue{Err: fmt.Errorf("test error")}
- })
- if err == nil || err.Error() != "test error" {
- t.Fatalf("unexpected error: %v", err)
- }
- if _, ok, err := f.GetByKey("foo"); !ok || err != nil {
- t.Fatalf("object should have been requeued: %t %v", ok, err)
- }
-
- _, err = f.Pop(func(obj interface{}) error {
- if obj.(Deltas)[0].Object.(testFifoObject).name != "foo" {
- t.Fatalf("unexpected object: %#v", obj)
- }
- return nil
- })
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- if _, ok, err := f.GetByKey("foo"); ok || err != nil {
- t.Fatalf("object should have been removed: %t %v", ok, err)
- }
-}
-
-func TestDeltaFIFO_addUpdate(t *testing.T) {
- f := NewDeltaFIFO(testFifoObjectKeyFunc, nil)
- f.Add(mkFifoObj("foo", 10))
- f.Update(mkFifoObj("foo", 12))
- f.Delete(mkFifoObj("foo", 15))
-
- if e, a := []interface{}{mkFifoObj("foo", 15)}, f.List(); !reflect.DeepEqual(e, a) {
- t.Errorf("Expected %+v, got %+v", e, a)
- }
- if e, a := []string{"foo"}, f.ListKeys(); !reflect.DeepEqual(e, a) {
- t.Errorf("Expected %+v, got %+v", e, a)
- }
-
- got := make(chan testFifoObject, 2)
- go func() {
- for {
- obj := testPop(f)
- t.Logf("got a thing %#v", obj)
- t.Logf("D len: %v", len(f.queue))
- got <- obj
- }
- }()
-
- first := <-got
- if e, a := 15, first.val; e != a {
- t.Errorf("Didn't get updated value (%v), got %v", e, a)
- }
- select {
- case unexpected := <-got:
- t.Errorf("Got second value %v", unexpected.val)
- case <-time.After(50 * time.Millisecond):
- }
- _, exists, _ := f.Get(mkFifoObj("foo", ""))
- if exists {
- t.Errorf("item did not get removed")
- }
-}
-
-func TestDeltaFIFO_enqueueingNoLister(t *testing.T) {
- f := NewDeltaFIFO(testFifoObjectKeyFunc, nil)
- f.Add(mkFifoObj("foo", 10))
- f.Update(mkFifoObj("bar", 15))
- f.Add(mkFifoObj("qux", 17))
- f.Delete(mkFifoObj("qux", 18))
-
- // This delete does not enqueue anything because baz doesn't exist.
- f.Delete(mkFifoObj("baz", 20))
-
- expectList := []int{10, 15, 18}
- for _, expect := range expectList {
- if e, a := expect, testPop(f).val; e != a {
- t.Errorf("Didn't get updated value (%v), got %v", e, a)
- }
- }
- if e, a := 0, len(f.items); e != a {
- t.Errorf("queue unexpectedly not empty: %v != %v\n%#v", e, a, f.items)
- }
-}
-
-func TestDeltaFIFO_enqueueingWithLister(t *testing.T) {
- f := NewDeltaFIFO(
- testFifoObjectKeyFunc,
- keyLookupFunc(func() []testFifoObject {
- return []testFifoObject{mkFifoObj("foo", 5), mkFifoObj("bar", 6), mkFifoObj("baz", 7)}
- }),
- )
- f.Add(mkFifoObj("foo", 10))
- f.Update(mkFifoObj("bar", 15))
-
- // This delete does enqueue the deletion, because "baz" is in the key lister.
- f.Delete(mkFifoObj("baz", 20))
-
- expectList := []int{10, 15, 20}
- for _, expect := range expectList {
- if e, a := expect, testPop(f).val; e != a {
- t.Errorf("Didn't get updated value (%v), got %v", e, a)
- }
- }
- if e, a := 0, len(f.items); e != a {
- t.Errorf("queue unexpectedly not empty: %v != %v", e, a)
- }
-}
-
-func TestDeltaFIFO_addReplace(t *testing.T) {
- f := NewDeltaFIFO(testFifoObjectKeyFunc, nil)
- f.Add(mkFifoObj("foo", 10))
- f.Replace([]interface{}{mkFifoObj("foo", 15)}, "0")
- got := make(chan testFifoObject, 2)
- go func() {
- for {
- got <- testPop(f)
- }
- }()
-
- first := <-got
- if e, a := 15, first.val; e != a {
- t.Errorf("Didn't get updated value (%v), got %v", e, a)
- }
- select {
- case unexpected := <-got:
- t.Errorf("Got second value %v", unexpected.val)
- case <-time.After(50 * time.Millisecond):
- }
- _, exists, _ := f.Get(mkFifoObj("foo", ""))
- if exists {
- t.Errorf("item did not get removed")
- }
-}
-
-func TestDeltaFIFO_ResyncNonExisting(t *testing.T) {
- f := NewDeltaFIFO(
- testFifoObjectKeyFunc,
- keyLookupFunc(func() []testFifoObject {
- return []testFifoObject{mkFifoObj("foo", 5)}
- }),
- )
- f.Delete(mkFifoObj("foo", 10))
- f.Resync()
-
- deltas := f.items["foo"]
- if len(deltas) != 1 {
- t.Fatalf("unexpected deltas length: %v", deltas)
- }
- if deltas[0].Type != Deleted {
- t.Errorf("unexpected delta: %v", deltas[0])
- }
-}
-
-func TestDeltaFIFO_DeleteExistingNonPropagated(t *testing.T) {
- f := NewDeltaFIFO(
- testFifoObjectKeyFunc,
- keyLookupFunc(func() []testFifoObject {
- return []testFifoObject{}
- }),
- )
- f.Add(mkFifoObj("foo", 5))
- f.Delete(mkFifoObj("foo", 6))
-
- deltas := f.items["foo"]
- if len(deltas) != 2 {
- t.Fatalf("unexpected deltas length: %v", deltas)
- }
- if deltas[len(deltas)-1].Type != Deleted {
- t.Errorf("unexpected delta: %v", deltas[len(deltas)-1])
- }
-}
-
-func TestDeltaFIFO_ReplaceMakesDeletions(t *testing.T) {
- f := NewDeltaFIFO(
- testFifoObjectKeyFunc,
- keyLookupFunc(func() []testFifoObject {
- return []testFifoObject{mkFifoObj("foo", 5), mkFifoObj("bar", 6), mkFifoObj("baz", 7)}
- }),
- )
- f.Delete(mkFifoObj("baz", 10))
- f.Replace([]interface{}{mkFifoObj("foo", 5)}, "0")
-
- expectedList := []Deltas{
- {{Deleted, mkFifoObj("baz", 10)}},
- {{Sync, mkFifoObj("foo", 5)}},
- // Since "bar" didn't have a delete event and wasn't in the Replace list
- // it should get a tombstone key with the right Obj.
- {{Deleted, DeletedFinalStateUnknown{Key: "bar", Obj: mkFifoObj("bar", 6)}}},
- }
-
- for _, expected := range expectedList {
- cur := Pop(f).(Deltas)
- if e, a := expected, cur; !reflect.DeepEqual(e, a) {
- t.Errorf("Expected %#v, got %#v", e, a)
- }
- }
-}
-
-func TestDeltaFIFO_UpdateResyncRace(t *testing.T) {
- f := NewDeltaFIFO(
- testFifoObjectKeyFunc,
- keyLookupFunc(func() []testFifoObject {
- return []testFifoObject{mkFifoObj("foo", 5)}
- }),
- )
- f.Update(mkFifoObj("foo", 6))
- f.Resync()
-
- expectedList := []Deltas{
- {{Updated, mkFifoObj("foo", 6)}},
- }
-
- for _, expected := range expectedList {
- cur := Pop(f).(Deltas)
- if e, a := expected, cur; !reflect.DeepEqual(e, a) {
- t.Errorf("Expected %#v, got %#v", e, a)
- }
- }
-}
-
-func TestDeltaFIFO_HasSyncedCorrectOnDeletion(t *testing.T) {
- f := NewDeltaFIFO(
- testFifoObjectKeyFunc,
- keyLookupFunc(func() []testFifoObject {
- return []testFifoObject{mkFifoObj("foo", 5), mkFifoObj("bar", 6), mkFifoObj("baz", 7)}
- }),
- )
- f.Replace([]interface{}{mkFifoObj("foo", 5)}, "0")
-
- expectedList := []Deltas{
- {{Sync, mkFifoObj("foo", 5)}},
- // Since "bar" didn't have a delete event and wasn't in the Replace list
- // it should get a tombstone key with the right Obj.
- {{Deleted, DeletedFinalStateUnknown{Key: "bar", Obj: mkFifoObj("bar", 6)}}},
- }
-
- for _, expected := range expectedList {
- if f.HasSynced() {
- t.Errorf("Expected HasSynced to be false")
- }
- cur := Pop(f).(Deltas)
- if e, a := expected, cur; !reflect.DeepEqual(e, a) {
- t.Errorf("Expected %#v, got %#v", e, a)
- }
- }
- if f.HasSynced() {
- t.Errorf("Expected HasSynced to be true")
- }
-}
-
-func TestDeltaFIFO_detectLineJumpers(t *testing.T) {
- f := NewDeltaFIFO(testFifoObjectKeyFunc, nil)
-
- f.Add(mkFifoObj("foo", 10))
- f.Add(mkFifoObj("bar", 1))
- f.Add(mkFifoObj("foo", 11))
- f.Add(mkFifoObj("foo", 13))
- f.Add(mkFifoObj("zab", 30))
-
- if e, a := 13, testPop(f).val; a != e {
- t.Fatalf("expected %d, got %d", e, a)
- }
-
- f.Add(mkFifoObj("foo", 14)) // ensure foo doesn't jump back in line
-
- if e, a := 1, testPop(f).val; a != e {
- t.Fatalf("expected %d, got %d", e, a)
- }
-
- if e, a := 30, testPop(f).val; a != e {
- t.Fatalf("expected %d, got %d", e, a)
- }
-
- if e, a := 14, testPop(f).val; a != e {
- t.Fatalf("expected %d, got %d", e, a)
- }
-}
-
-func TestDeltaFIFO_addIfNotPresent(t *testing.T) {
- f := NewDeltaFIFO(testFifoObjectKeyFunc, nil)
-
- f.Add(mkFifoObj("b", 3))
- b3 := Pop(f)
- f.Add(mkFifoObj("c", 4))
- c4 := Pop(f)
- if e, a := 0, len(f.items); e != a {
- t.Fatalf("Expected %v, got %v items in queue", e, a)
- }
-
- f.Add(mkFifoObj("a", 1))
- f.Add(mkFifoObj("b", 2))
- f.AddIfNotPresent(b3)
- f.AddIfNotPresent(c4)
-
- if e, a := 3, len(f.items); a != e {
- t.Fatalf("expected queue length %d, got %d", e, a)
- }
-
- expectedValues := []int{1, 2, 4}
- for _, expected := range expectedValues {
- if actual := testPop(f).val; actual != expected {
- t.Fatalf("expected value %d, got %d", expected, actual)
- }
- }
-}
-
-func TestDeltaFIFO_KeyOf(t *testing.T) {
- f := DeltaFIFO{keyFunc: testFifoObjectKeyFunc}
-
- table := []struct {
- obj interface{}
- key string
- }{
- {obj: testFifoObject{name: "A"}, key: "A"},
- {obj: DeletedFinalStateUnknown{Key: "B", Obj: nil}, key: "B"},
- {obj: Deltas{{Object: testFifoObject{name: "C"}}}, key: "C"},
- {obj: Deltas{{Object: DeletedFinalStateUnknown{Key: "D", Obj: nil}}}, key: "D"},
- }
-
- for _, item := range table {
- got, err := f.KeyOf(item.obj)
- if err != nil {
- t.Errorf("Unexpected error for %q: %v", item.obj, err)
- continue
- }
- if e, a := item.key, got; e != a {
- t.Errorf("Expected %v, got %v", e, a)
- }
- }
-}
-
-func TestDeltaFIFO_HasSynced(t *testing.T) {
- tests := []struct {
- actions []func(f *DeltaFIFO)
- expectedSynced bool
- }{
- {
- actions: []func(f *DeltaFIFO){},
- expectedSynced: false,
- },
- {
- actions: []func(f *DeltaFIFO){
- func(f *DeltaFIFO) { f.Add(mkFifoObj("a", 1)) },
- },
- expectedSynced: true,
- },
- {
- actions: []func(f *DeltaFIFO){
- func(f *DeltaFIFO) { f.Replace([]interface{}{}, "0") },
- },
- expectedSynced: true,
- },
- {
- actions: []func(f *DeltaFIFO){
- func(f *DeltaFIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("b", 2)}, "0") },
- },
- expectedSynced: false,
- },
- {
- actions: []func(f *DeltaFIFO){
- func(f *DeltaFIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("b", 2)}, "0") },
- func(f *DeltaFIFO) { Pop(f) },
- },
- expectedSynced: false,
- },
- {
- actions: []func(f *DeltaFIFO){
- func(f *DeltaFIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("b", 2)}, "0") },
- func(f *DeltaFIFO) { Pop(f) },
- func(f *DeltaFIFO) { Pop(f) },
- },
- expectedSynced: true,
- },
- }
-
- for i, test := range tests {
- f := NewDeltaFIFO(testFifoObjectKeyFunc, nil)
-
- for _, action := range test.actions {
- action(f)
- }
- if e, a := test.expectedSynced, f.HasSynced(); a != e {
- t.Errorf("test case %v failed, expected: %v , got %v", i, e, a)
- }
- }
-}
diff --git a/vendor/k8s.io/client-go/tools/cache/expiration_cache_test.go b/vendor/k8s.io/client-go/tools/cache/expiration_cache_test.go
deleted file mode 100644
index fac621cbc..000000000
--- a/vendor/k8s.io/client-go/tools/cache/expiration_cache_test.go
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package cache
-
-import (
- "reflect"
- "testing"
- "time"
-
- "k8s.io/apimachinery/pkg/util/clock"
- "k8s.io/apimachinery/pkg/util/sets"
- "k8s.io/apimachinery/pkg/util/wait"
-)
-
-func TestTTLExpirationBasic(t *testing.T) {
- testObj := testStoreObject{id: "foo", val: "bar"}
- deleteChan := make(chan string, 1)
- ttlStore := NewFakeExpirationStore(
- testStoreKeyFunc, deleteChan,
- &FakeExpirationPolicy{
- NeverExpire: sets.NewString(),
- RetrieveKeyFunc: func(obj interface{}) (string, error) {
- return obj.(*timestampedEntry).obj.(testStoreObject).id, nil
- },
- },
- clock.RealClock{},
- )
- err := ttlStore.Add(testObj)
- if err != nil {
- t.Errorf("Unable to add obj %#v", testObj)
- }
- item, exists, err := ttlStore.Get(testObj)
- if err != nil {
- t.Errorf("Failed to get from store, %v", err)
- }
- if exists || item != nil {
- t.Errorf("Got unexpected item %#v", item)
- }
- key, _ := testStoreKeyFunc(testObj)
- select {
- case delKey := <-deleteChan:
- if delKey != key {
- t.Errorf("Unexpected delete for key %s", key)
- }
- case <-time.After(wait.ForeverTestTimeout):
- t.Errorf("Unexpected timeout waiting on delete")
- }
- close(deleteChan)
-}
-
-func TestReAddExpiredItem(t *testing.T) {
- deleteChan := make(chan string, 1)
- exp := &FakeExpirationPolicy{
- NeverExpire: sets.NewString(),
- RetrieveKeyFunc: func(obj interface{}) (string, error) {
- return obj.(*timestampedEntry).obj.(testStoreObject).id, nil
- },
- }
- ttlStore := NewFakeExpirationStore(
- testStoreKeyFunc, deleteChan, exp, clock.RealClock{})
- testKey := "foo"
- testObj := testStoreObject{id: testKey, val: "bar"}
- err := ttlStore.Add(testObj)
- if err != nil {
- t.Errorf("Unable to add obj %#v", testObj)
- }
-
- // This get will expire the item.
- item, exists, err := ttlStore.Get(testObj)
- if err != nil {
- t.Errorf("Failed to get from store, %v", err)
- }
- if exists || item != nil {
- t.Errorf("Got unexpected item %#v", item)
- }
-
- key, _ := testStoreKeyFunc(testObj)
- differentValue := "different_bar"
- err = ttlStore.Add(
- testStoreObject{id: testKey, val: differentValue})
- if err != nil {
- t.Errorf("Failed to add second value")
- }
-
- select {
- case delKey := <-deleteChan:
- if delKey != key {
- t.Errorf("Unexpected delete for key %s", key)
- }
- case <-time.After(wait.ForeverTestTimeout):
- t.Errorf("Unexpected timeout waiting on delete")
- }
- exp.NeverExpire = sets.NewString(testKey)
- item, exists, err = ttlStore.GetByKey(testKey)
- if err != nil {
- t.Errorf("Failed to get from store, %v", err)
- }
- if !exists || item == nil || item.(testStoreObject).val != differentValue {
- t.Errorf("Got unexpected item %#v", item)
- }
- close(deleteChan)
-}
-
-func TestTTLList(t *testing.T) {
- testObjs := []testStoreObject{
- {id: "foo", val: "bar"},
- {id: "foo1", val: "bar1"},
- {id: "foo2", val: "bar2"},
- }
- expireKeys := sets.NewString(testObjs[0].id, testObjs[2].id)
- deleteChan := make(chan string, len(testObjs))
- defer close(deleteChan)
-
- ttlStore := NewFakeExpirationStore(
- testStoreKeyFunc, deleteChan,
- &FakeExpirationPolicy{
- NeverExpire: sets.NewString(testObjs[1].id),
- RetrieveKeyFunc: func(obj interface{}) (string, error) {
- return obj.(*timestampedEntry).obj.(testStoreObject).id, nil
- },
- },
- clock.RealClock{},
- )
- for _, obj := range testObjs {
- err := ttlStore.Add(obj)
- if err != nil {
- t.Errorf("Unable to add obj %#v", obj)
- }
- }
- listObjs := ttlStore.List()
- if len(listObjs) != 1 || !reflect.DeepEqual(listObjs[0], testObjs[1]) {
- t.Errorf("List returned unexpected results %#v", listObjs)
- }
-
- // Make sure all our deletes come through in an acceptable rate (1/100ms)
- for expireKeys.Len() != 0 {
- select {
- case delKey := <-deleteChan:
- if !expireKeys.Has(delKey) {
- t.Errorf("Unexpected delete for key %s", delKey)
- }
- expireKeys.Delete(delKey)
- case <-time.After(wait.ForeverTestTimeout):
- t.Errorf("Unexpected timeout waiting on delete")
- return
- }
- }
-}
-
-func TestTTLPolicy(t *testing.T) {
- fakeTime := time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC)
- ttl := 30 * time.Second
- exactlyOnTTL := fakeTime.Add(-ttl)
- expiredTime := fakeTime.Add(-(ttl + 1))
-
- policy := TTLPolicy{ttl, clock.NewFakeClock(fakeTime)}
- fakeTimestampedEntry := &timestampedEntry{obj: struct{}{}, timestamp: exactlyOnTTL}
- if policy.IsExpired(fakeTimestampedEntry) {
- t.Errorf("TTL cache should not expire entries exactly on ttl")
- }
- fakeTimestampedEntry.timestamp = fakeTime
- if policy.IsExpired(fakeTimestampedEntry) {
- t.Errorf("TTL Cache should not expire entries before ttl")
- }
- fakeTimestampedEntry.timestamp = expiredTime
- if !policy.IsExpired(fakeTimestampedEntry) {
- t.Errorf("TTL Cache should expire entries older than ttl")
- }
- for _, ttl = range []time.Duration{0, -1} {
- policy.Ttl = ttl
- if policy.IsExpired(fakeTimestampedEntry) {
- t.Errorf("TTL policy should only expire entries when initialized with a ttl > 0")
- }
- }
-}
diff --git a/vendor/k8s.io/client-go/tools/cache/fifo_test.go b/vendor/k8s.io/client-go/tools/cache/fifo_test.go
deleted file mode 100644
index afd311d78..000000000
--- a/vendor/k8s.io/client-go/tools/cache/fifo_test.go
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package cache
-
-import (
- "fmt"
- "reflect"
- "testing"
- "time"
-)
-
-func testFifoObjectKeyFunc(obj interface{}) (string, error) {
- return obj.(testFifoObject).name, nil
-}
-
-type testFifoObject struct {
- name string
- val interface{}
-}
-
-func mkFifoObj(name string, val interface{}) testFifoObject {
- return testFifoObject{name: name, val: val}
-}
-
-func TestFIFO_basic(t *testing.T) {
- f := NewFIFO(testFifoObjectKeyFunc)
- const amount = 500
- go func() {
- for i := 0; i < amount; i++ {
- f.Add(mkFifoObj(string([]rune{'a', rune(i)}), i+1))
- }
- }()
- go func() {
- for u := uint64(0); u < amount; u++ {
- f.Add(mkFifoObj(string([]rune{'b', rune(u)}), u+1))
- }
- }()
-
- lastInt := int(0)
- lastUint := uint64(0)
- for i := 0; i < amount*2; i++ {
- switch obj := Pop(f).(testFifoObject).val.(type) {
- case int:
- if obj <= lastInt {
- t.Errorf("got %v (int) out of order, last was %v", obj, lastInt)
- }
- lastInt = obj
- case uint64:
- if obj <= lastUint {
- t.Errorf("got %v (uint) out of order, last was %v", obj, lastUint)
- } else {
- lastUint = obj
- }
- default:
- t.Fatalf("unexpected type %#v", obj)
- }
- }
-}
-
-func TestFIFO_requeueOnPop(t *testing.T) {
- f := NewFIFO(testFifoObjectKeyFunc)
-
- f.Add(mkFifoObj("foo", 10))
- _, err := f.Pop(func(obj interface{}) error {
- if obj.(testFifoObject).name != "foo" {
- t.Fatalf("unexpected object: %#v", obj)
- }
- return ErrRequeue{Err: nil}
- })
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- if _, ok, err := f.GetByKey("foo"); !ok || err != nil {
- t.Fatalf("object should have been requeued: %t %v", ok, err)
- }
-
- _, err = f.Pop(func(obj interface{}) error {
- if obj.(testFifoObject).name != "foo" {
- t.Fatalf("unexpected object: %#v", obj)
- }
- return ErrRequeue{Err: fmt.Errorf("test error")}
- })
- if err == nil || err.Error() != "test error" {
- t.Fatalf("unexpected error: %v", err)
- }
- if _, ok, err := f.GetByKey("foo"); !ok || err != nil {
- t.Fatalf("object should have been requeued: %t %v", ok, err)
- }
-
- _, err = f.Pop(func(obj interface{}) error {
- if obj.(testFifoObject).name != "foo" {
- t.Fatalf("unexpected object: %#v", obj)
- }
- return nil
- })
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
- if _, ok, err := f.GetByKey("foo"); ok || err != nil {
- t.Fatalf("object should have been removed: %t %v", ok, err)
- }
-}
-
-func TestFIFO_addUpdate(t *testing.T) {
- f := NewFIFO(testFifoObjectKeyFunc)
- f.Add(mkFifoObj("foo", 10))
- f.Update(mkFifoObj("foo", 15))
-
- if e, a := []interface{}{mkFifoObj("foo", 15)}, f.List(); !reflect.DeepEqual(e, a) {
- t.Errorf("Expected %+v, got %+v", e, a)
- }
- if e, a := []string{"foo"}, f.ListKeys(); !reflect.DeepEqual(e, a) {
- t.Errorf("Expected %+v, got %+v", e, a)
- }
-
- got := make(chan testFifoObject, 2)
- go func() {
- for {
- got <- Pop(f).(testFifoObject)
- }
- }()
-
- first := <-got
- if e, a := 15, first.val; e != a {
- t.Errorf("Didn't get updated value (%v), got %v", e, a)
- }
- select {
- case unexpected := <-got:
- t.Errorf("Got second value %v", unexpected.val)
- case <-time.After(50 * time.Millisecond):
- }
- _, exists, _ := f.Get(mkFifoObj("foo", ""))
- if exists {
- t.Errorf("item did not get removed")
- }
-}
-
-func TestFIFO_addReplace(t *testing.T) {
- f := NewFIFO(testFifoObjectKeyFunc)
- f.Add(mkFifoObj("foo", 10))
- f.Replace([]interface{}{mkFifoObj("foo", 15)}, "15")
- got := make(chan testFifoObject, 2)
- go func() {
- for {
- got <- Pop(f).(testFifoObject)
- }
- }()
-
- first := <-got
- if e, a := 15, first.val; e != a {
- t.Errorf("Didn't get updated value (%v), got %v", e, a)
- }
- select {
- case unexpected := <-got:
- t.Errorf("Got second value %v", unexpected.val)
- case <-time.After(50 * time.Millisecond):
- }
- _, exists, _ := f.Get(mkFifoObj("foo", ""))
- if exists {
- t.Errorf("item did not get removed")
- }
-}
-
-func TestFIFO_detectLineJumpers(t *testing.T) {
- f := NewFIFO(testFifoObjectKeyFunc)
-
- f.Add(mkFifoObj("foo", 10))
- f.Add(mkFifoObj("bar", 1))
- f.Add(mkFifoObj("foo", 11))
- f.Add(mkFifoObj("foo", 13))
- f.Add(mkFifoObj("zab", 30))
-
- if e, a := 13, Pop(f).(testFifoObject).val; a != e {
- t.Fatalf("expected %d, got %d", e, a)
- }
-
- f.Add(mkFifoObj("foo", 14)) // ensure foo doesn't jump back in line
-
- if e, a := 1, Pop(f).(testFifoObject).val; a != e {
- t.Fatalf("expected %d, got %d", e, a)
- }
-
- if e, a := 30, Pop(f).(testFifoObject).val; a != e {
- t.Fatalf("expected %d, got %d", e, a)
- }
-
- if e, a := 14, Pop(f).(testFifoObject).val; a != e {
- t.Fatalf("expected %d, got %d", e, a)
- }
-}
-
-func TestFIFO_addIfNotPresent(t *testing.T) {
- f := NewFIFO(testFifoObjectKeyFunc)
-
- f.Add(mkFifoObj("a", 1))
- f.Add(mkFifoObj("b", 2))
- f.AddIfNotPresent(mkFifoObj("b", 3))
- f.AddIfNotPresent(mkFifoObj("c", 4))
-
- if e, a := 3, len(f.items); a != e {
- t.Fatalf("expected queue length %d, got %d", e, a)
- }
-
- expectedValues := []int{1, 2, 4}
- for _, expected := range expectedValues {
- if actual := Pop(f).(testFifoObject).val; actual != expected {
- t.Fatalf("expected value %d, got %d", expected, actual)
- }
- }
-}
-
-func TestFIFO_HasSynced(t *testing.T) {
- tests := []struct {
- actions []func(f *FIFO)
- expectedSynced bool
- }{
- {
- actions: []func(f *FIFO){},
- expectedSynced: false,
- },
- {
- actions: []func(f *FIFO){
- func(f *FIFO) { f.Add(mkFifoObj("a", 1)) },
- },
- expectedSynced: true,
- },
- {
- actions: []func(f *FIFO){
- func(f *FIFO) { f.Replace([]interface{}{}, "0") },
- },
- expectedSynced: true,
- },
- {
- actions: []func(f *FIFO){
- func(f *FIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("b", 2)}, "0") },
- },
- expectedSynced: false,
- },
- {
- actions: []func(f *FIFO){
- func(f *FIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("b", 2)}, "0") },
- func(f *FIFO) { Pop(f) },
- },
- expectedSynced: false,
- },
- {
- actions: []func(f *FIFO){
- func(f *FIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("b", 2)}, "0") },
- func(f *FIFO) { Pop(f) },
- func(f *FIFO) { Pop(f) },
- },
- expectedSynced: true,
- },
- }
-
- for i, test := range tests {
- f := NewFIFO(testFifoObjectKeyFunc)
-
- for _, action := range test.actions {
- action(f)
- }
- if e, a := test.expectedSynced, f.HasSynced(); a != e {
- t.Errorf("test case %v failed, expected: %v , got %v", i, e, a)
- }
- }
-}
diff --git a/vendor/k8s.io/client-go/tools/cache/heap_test.go b/vendor/k8s.io/client-go/tools/cache/heap_test.go
deleted file mode 100644
index c2e476988..000000000
--- a/vendor/k8s.io/client-go/tools/cache/heap_test.go
+++ /dev/null
@@ -1,382 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package cache
-
-import (
- "sync"
- "testing"
- "time"
-)
-
-func testHeapObjectKeyFunc(obj interface{}) (string, error) {
- return obj.(testHeapObject).name, nil
-}
-
-type testHeapObject struct {
- name string
- val interface{}
-}
-
-func mkHeapObj(name string, val interface{}) testHeapObject {
- return testHeapObject{name: name, val: val}
-}
-
-func compareInts(val1 interface{}, val2 interface{}) bool {
- first := val1.(testHeapObject).val.(int)
- second := val2.(testHeapObject).val.(int)
- return first < second
-}
-
-// TestHeapBasic tests Heap invariant and synchronization.
-func TestHeapBasic(t *testing.T) {
- h := NewHeap(testHeapObjectKeyFunc, compareInts)
- var wg sync.WaitGroup
- wg.Add(2)
- const amount = 500
- var i, u int
- // Insert items in the heap in opposite orders in two go routines.
- go func() {
- for i = amount; i > 0; i-- {
- h.Add(mkHeapObj(string([]rune{'a', rune(i)}), i))
- }
- wg.Done()
- }()
- go func() {
- for u = 0; u < amount; u++ {
- h.Add(mkHeapObj(string([]rune{'b', rune(u)}), u+1))
- }
- wg.Done()
- }()
- // Wait for the two go routines to finish.
- wg.Wait()
- // Make sure that the numbers are popped in ascending order.
- prevNum := 0
- for i := 0; i < amount*2; i++ {
- obj, err := h.Pop()
- num := obj.(testHeapObject).val.(int)
- // All the items must be sorted.
- if err != nil || prevNum > num {
- t.Errorf("got %v out of order, last was %v", obj, prevNum)
- }
- prevNum = num
- }
-}
-
-// Tests Heap.Add and ensures that heap invariant is preserved after adding items.
-func TestHeap_Add(t *testing.T) {
- h := NewHeap(testHeapObjectKeyFunc, compareInts)
- h.Add(mkHeapObj("foo", 10))
- h.Add(mkHeapObj("bar", 1))
- h.Add(mkHeapObj("baz", 11))
- h.Add(mkHeapObj("zab", 30))
- h.Add(mkHeapObj("foo", 13)) // This updates "foo".
-
- item, err := h.Pop()
- if e, a := 1, item.(testHeapObject).val; err != nil || a != e {
- t.Fatalf("expected %d, got %d", e, a)
- }
- item, err = h.Pop()
- if e, a := 11, item.(testHeapObject).val; err != nil || a != e {
- t.Fatalf("expected %d, got %d", e, a)
- }
- h.Delete(mkHeapObj("baz", 11)) // Nothing is deleted.
- h.Add(mkHeapObj("foo", 14)) // foo is updated.
- item, err = h.Pop()
- if e, a := 14, item.(testHeapObject).val; err != nil || a != e {
- t.Fatalf("expected %d, got %d", e, a)
- }
- item, err = h.Pop()
- if e, a := 30, item.(testHeapObject).val; err != nil || a != e {
- t.Fatalf("expected %d, got %d", e, a)
- }
-}
-
-// TestHeap_BulkAdd tests Heap.BulkAdd functionality and ensures that all the
-// items given to BulkAdd are added to the queue before Pop reads them.
-func TestHeap_BulkAdd(t *testing.T) {
- h := NewHeap(testHeapObjectKeyFunc, compareInts)
- const amount = 500
- // Insert items in the heap in opposite orders in a go routine.
- go func() {
- l := []interface{}{}
- for i := amount; i > 0; i-- {
- l = append(l, mkHeapObj(string([]rune{'a', rune(i)}), i))
- }
- h.BulkAdd(l)
- }()
- prevNum := -1
- for i := 0; i < amount; i++ {
- obj, err := h.Pop()
- num := obj.(testHeapObject).val.(int)
- // All the items must be sorted.
- if err != nil || prevNum >= num {
- t.Errorf("got %v out of order, last was %v", obj, prevNum)
- }
- prevNum = num
- }
-}
-
-// TestHeapEmptyPop tests that pop returns properly after heap is closed.
-func TestHeapEmptyPop(t *testing.T) {
- h := NewHeap(testHeapObjectKeyFunc, compareInts)
- go func() {
- time.Sleep(1 * time.Second)
- h.Close()
- }()
- _, err := h.Pop()
- if err == nil || err.Error() != closedMsg {
- t.Errorf("pop should have returned heap closed error: %v", err)
- }
-}
-
-// TestHeap_AddIfNotPresent tests Heap.AddIfNotPresent and ensures that heap
-// invariant is preserved after adding items.
-func TestHeap_AddIfNotPresent(t *testing.T) {
- h := NewHeap(testHeapObjectKeyFunc, compareInts)
- h.AddIfNotPresent(mkHeapObj("foo", 10))
- h.AddIfNotPresent(mkHeapObj("bar", 1))
- h.AddIfNotPresent(mkHeapObj("baz", 11))
- h.AddIfNotPresent(mkHeapObj("zab", 30))
- h.AddIfNotPresent(mkHeapObj("foo", 13)) // This is not added.
-
- if len := len(h.data.items); len != 4 {
- t.Errorf("unexpected number of items: %d", len)
- }
- if val := h.data.items["foo"].obj.(testHeapObject).val; val != 10 {
- t.Errorf("unexpected value: %d", val)
- }
- item, err := h.Pop()
- if e, a := 1, item.(testHeapObject).val; err != nil || a != e {
- t.Fatalf("expected %d, got %d", e, a)
- }
- item, err = h.Pop()
- if e, a := 10, item.(testHeapObject).val; err != nil || a != e {
- t.Fatalf("expected %d, got %d", e, a)
- }
- // bar is already popped. Let's add another one.
- h.AddIfNotPresent(mkHeapObj("bar", 14))
- item, err = h.Pop()
- if e, a := 11, item.(testHeapObject).val; err != nil || a != e {
- t.Fatalf("expected %d, got %d", e, a)
- }
- item, err = h.Pop()
- if e, a := 14, item.(testHeapObject).val; err != nil || a != e {
- t.Fatalf("expected %d, got %d", e, a)
- }
-}
-
-// TestHeap_Delete tests Heap.Delete and ensures that heap invariant is
-// preserved after deleting items.
-func TestHeap_Delete(t *testing.T) {
- h := NewHeap(testHeapObjectKeyFunc, compareInts)
- h.Add(mkHeapObj("foo", 10))
- h.Add(mkHeapObj("bar", 1))
- h.Add(mkHeapObj("bal", 31))
- h.Add(mkHeapObj("baz", 11))
-
- // Delete head. Delete should work with "key" and doesn't care about the value.
- if err := h.Delete(mkHeapObj("bar", 200)); err != nil {
- t.Fatalf("Failed to delete head.")
- }
- item, err := h.Pop()
- if e, a := 10, item.(testHeapObject).val; err != nil || a != e {
- t.Fatalf("expected %d, got %d", e, a)
- }
- h.Add(mkHeapObj("zab", 30))
- h.Add(mkHeapObj("faz", 30))
- len := h.data.Len()
- // Delete non-existing item.
- if err = h.Delete(mkHeapObj("non-existent", 10)); err == nil || len != h.data.Len() {
- t.Fatalf("Didn't expect any item removal")
- }
- // Delete tail.
- if err = h.Delete(mkHeapObj("bal", 31)); err != nil {
- t.Fatalf("Failed to delete tail.")
- }
- // Delete one of the items with value 30.
- if err = h.Delete(mkHeapObj("zab", 30)); err != nil {
- t.Fatalf("Failed to delete item.")
- }
- item, err = h.Pop()
- if e, a := 11, item.(testHeapObject).val; err != nil || a != e {
- t.Fatalf("expected %d, got %d", e, a)
- }
- item, err = h.Pop()
- if e, a := 30, item.(testHeapObject).val; err != nil || a != e {
- t.Fatalf("expected %d, got %d", e, a)
- }
- if h.data.Len() != 0 {
- t.Fatalf("expected an empty heap.")
- }
-}
-
-// TestHeap_Update tests Heap.Update and ensures that heap invariant is
-// preserved after adding items.
-func TestHeap_Update(t *testing.T) {
- h := NewHeap(testHeapObjectKeyFunc, compareInts)
- h.Add(mkHeapObj("foo", 10))
- h.Add(mkHeapObj("bar", 1))
- h.Add(mkHeapObj("bal", 31))
- h.Add(mkHeapObj("baz", 11))
-
- // Update an item to a value that should push it to the head.
- h.Update(mkHeapObj("baz", 0))
- if h.data.queue[0] != "baz" || h.data.items["baz"].index != 0 {
- t.Fatalf("expected baz to be at the head")
- }
- item, err := h.Pop()
- if e, a := 0, item.(testHeapObject).val; err != nil || a != e {
- t.Fatalf("expected %d, got %d", e, a)
- }
- // Update bar to push it farther back in the queue.
- h.Update(mkHeapObj("bar", 100))
- if h.data.queue[0] != "foo" || h.data.items["foo"].index != 0 {
- t.Fatalf("expected foo to be at the head")
- }
-}
-
-// TestHeap_Get tests Heap.Get.
-func TestHeap_Get(t *testing.T) {
- h := NewHeap(testHeapObjectKeyFunc, compareInts)
- h.Add(mkHeapObj("foo", 10))
- h.Add(mkHeapObj("bar", 1))
- h.Add(mkHeapObj("bal", 31))
- h.Add(mkHeapObj("baz", 11))
-
- // Get works with the key.
- obj, exists, err := h.Get(mkHeapObj("baz", 0))
- if err != nil || exists == false || obj.(testHeapObject).val != 11 {
- t.Fatalf("unexpected error in getting element")
- }
- // Get non-existing object.
- _, exists, err = h.Get(mkHeapObj("non-existing", 0))
- if err != nil || exists == true {
- t.Fatalf("didn't expect to get any object")
- }
-}
-
-// TestHeap_GetByKey tests Heap.GetByKey and is very similar to TestHeap_Get.
-func TestHeap_GetByKey(t *testing.T) {
- h := NewHeap(testHeapObjectKeyFunc, compareInts)
- h.Add(mkHeapObj("foo", 10))
- h.Add(mkHeapObj("bar", 1))
- h.Add(mkHeapObj("bal", 31))
- h.Add(mkHeapObj("baz", 11))
-
- obj, exists, err := h.GetByKey("baz")
- if err != nil || exists == false || obj.(testHeapObject).val != 11 {
- t.Fatalf("unexpected error in getting element")
- }
- // Get non-existing object.
- _, exists, err = h.GetByKey("non-existing")
- if err != nil || exists == true {
- t.Fatalf("didn't expect to get any object")
- }
-}
-
-// TestHeap_Close tests Heap.Close and Heap.IsClosed functions.
-func TestHeap_Close(t *testing.T) {
- h := NewHeap(testHeapObjectKeyFunc, compareInts)
- h.Add(mkHeapObj("foo", 10))
- h.Add(mkHeapObj("bar", 1))
-
- if h.IsClosed() {
- t.Fatalf("didn't expect heap to be closed")
- }
- h.Close()
- if !h.IsClosed() {
- t.Fatalf("expect heap to be closed")
- }
-}
-
-// TestHeap_List tests Heap.List function.
-func TestHeap_List(t *testing.T) {
- h := NewHeap(testHeapObjectKeyFunc, compareInts)
- list := h.List()
- if len(list) != 0 {
- t.Errorf("expected an empty list")
- }
-
- items := map[string]int{
- "foo": 10,
- "bar": 1,
- "bal": 30,
- "baz": 11,
- "faz": 30,
- }
- for k, v := range items {
- h.Add(mkHeapObj(k, v))
- }
- list = h.List()
- if len(list) != len(items) {
- t.Errorf("expected %d items, got %d", len(items), len(list))
- }
- for _, obj := range list {
- heapObj := obj.(testHeapObject)
- v, ok := items[heapObj.name]
- if !ok || v != heapObj.val {
- t.Errorf("unexpected item in the list: %v", heapObj)
- }
- }
-}
-
-// TestHeap_ListKeys tests Heap.ListKeys function. Scenario is the same as
-// TestHeap_list.
-func TestHeap_ListKeys(t *testing.T) {
- h := NewHeap(testHeapObjectKeyFunc, compareInts)
- list := h.ListKeys()
- if len(list) != 0 {
- t.Errorf("expected an empty list")
- }
-
- items := map[string]int{
- "foo": 10,
- "bar": 1,
- "bal": 30,
- "baz": 11,
- "faz": 30,
- }
- for k, v := range items {
- h.Add(mkHeapObj(k, v))
- }
- list = h.ListKeys()
- if len(list) != len(items) {
- t.Errorf("expected %d items, got %d", len(items), len(list))
- }
- for _, key := range list {
- _, ok := items[key]
- if !ok {
- t.Errorf("unexpected item in the list: %v", key)
- }
- }
-}
-
-// TestHeapAddAfterClose tests that heap returns an error if anything is added
-// after it is closed.
-func TestHeapAddAfterClose(t *testing.T) {
- h := NewHeap(testHeapObjectKeyFunc, compareInts)
- h.Close()
- if err := h.Add(mkHeapObj("test", 1)); err == nil || err.Error() != closedMsg {
- t.Errorf("expected heap closed error")
- }
- if err := h.AddIfNotPresent(mkHeapObj("test", 1)); err == nil || err.Error() != closedMsg {
- t.Errorf("expected heap closed error")
- }
- if err := h.BulkAdd([]interface{}{mkHeapObj("test", 1)}); err == nil || err.Error() != closedMsg {
- t.Errorf("expected heap closed error")
- }
-}
diff --git a/vendor/k8s.io/client-go/tools/cache/index_test.go b/vendor/k8s.io/client-go/tools/cache/index_test.go
deleted file mode 100644
index ecc104c0c..000000000
--- a/vendor/k8s.io/client-go/tools/cache/index_test.go
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
-Copyright 2015 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package cache
-
-import (
- "strings"
- "testing"
-
- "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-)
-
-func testIndexFunc(obj interface{}) ([]string, error) {
- pod := obj.(*v1.Pod)
- return []string{pod.Labels["foo"]}, nil
-}
-
-func TestGetIndexFuncValues(t *testing.T) {
- index := NewIndexer(MetaNamespaceKeyFunc, Indexers{"testmodes": testIndexFunc})
-
- pod1 := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "one", Labels: map[string]string{"foo": "bar"}}}
- pod2 := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "two", Labels: map[string]string{"foo": "bar"}}}
- pod3 := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "tre", Labels: map[string]string{"foo": "biz"}}}
-
- index.Add(pod1)
- index.Add(pod2)
- index.Add(pod3)
-
- keys := index.ListIndexFuncValues("testmodes")
- if len(keys) != 2 {
- t.Errorf("Expected 2 keys but got %v", len(keys))
- }
-
- for _, key := range keys {
- if key != "bar" && key != "biz" {
- t.Errorf("Expected only 'bar' or 'biz' but got %s", key)
- }
- }
-}
-
-func testUsersIndexFunc(obj interface{}) ([]string, error) {
- pod := obj.(*v1.Pod)
- usersString := pod.Annotations["users"]
-
- return strings.Split(usersString, ","), nil
-}
-
-func TestMultiIndexKeys(t *testing.T) {
- index := NewIndexer(MetaNamespaceKeyFunc, Indexers{"byUser": testUsersIndexFunc})
-
- pod1 := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "one", Annotations: map[string]string{"users": "ernie,bert"}}}
- pod2 := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "two", Annotations: map[string]string{"users": "bert,oscar"}}}
- pod3 := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "tre", Annotations: map[string]string{"users": "ernie,elmo"}}}
-
- index.Add(pod1)
- index.Add(pod2)
- index.Add(pod3)
-
- erniePods, err := index.ByIndex("byUser", "ernie")
- if err != nil {
- t.Errorf("unexpected error: %v", err)
- }
- if len(erniePods) != 2 {
- t.Errorf("Expected 2 pods but got %v", len(erniePods))
- }
- for _, erniePod := range erniePods {
- if erniePod.(*v1.Pod).Name != "one" && erniePod.(*v1.Pod).Name != "tre" {
- t.Errorf("Expected only 'one' or 'tre' but got %s", erniePod.(*v1.Pod).Name)
- }
- }
-
- bertPods, err := index.ByIndex("byUser", "bert")
- if err != nil {
- t.Errorf("unexpected error: %v", err)
- }
- if len(bertPods) != 2 {
- t.Errorf("Expected 2 pods but got %v", len(bertPods))
- }
- for _, bertPod := range bertPods {
- if bertPod.(*v1.Pod).Name != "one" && bertPod.(*v1.Pod).Name != "two" {
- t.Errorf("Expected only 'one' or 'two' but got %s", bertPod.(*v1.Pod).Name)
- }
- }
-
- oscarPods, err := index.ByIndex("byUser", "oscar")
- if err != nil {
- t.Errorf("unexpected error: %v", err)
- }
- if len(oscarPods) != 1 {
- t.Errorf("Expected 1 pods but got %v", len(erniePods))
- }
- for _, oscarPod := range oscarPods {
- if oscarPod.(*v1.Pod).Name != "two" {
- t.Errorf("Expected only 'two' but got %s", oscarPod.(*v1.Pod).Name)
- }
- }
-
- ernieAndBertKeys, err := index.Index("byUser", pod1)
- if err != nil {
- t.Errorf("unexpected error: %v", err)
- }
- if len(ernieAndBertKeys) != 3 {
- t.Errorf("Expected 3 pods but got %v", len(ernieAndBertKeys))
- }
- for _, ernieAndBertKey := range ernieAndBertKeys {
- if ernieAndBertKey.(*v1.Pod).Name != "one" && ernieAndBertKey.(*v1.Pod).Name != "two" && ernieAndBertKey.(*v1.Pod).Name != "tre" {
- t.Errorf("Expected only 'one', 'two' or 'tre' but got %s", ernieAndBertKey.(*v1.Pod).Name)
- }
- }
-
- index.Delete(pod3)
- erniePods, err = index.ByIndex("byUser", "ernie")
- if err != nil {
- t.Errorf("unexpected error: %v", err)
- }
- if len(erniePods) != 1 {
- t.Errorf("Expected 1 pods but got %v", len(erniePods))
- }
- for _, erniePod := range erniePods {
- if erniePod.(*v1.Pod).Name != "one" {
- t.Errorf("Expected only 'one' but got %s", erniePod.(*v1.Pod).Name)
- }
- }
-
- elmoPods, err := index.ByIndex("byUser", "elmo")
- if err != nil {
- t.Errorf("unexpected error: %v", err)
- }
- if len(elmoPods) != 0 {
- t.Errorf("Expected 0 pods but got %v", len(elmoPods))
- }
-
- copyOfPod2 := pod2.DeepCopy()
- copyOfPod2.Annotations["users"] = "oscar"
- index.Update(copyOfPod2)
- bertPods, err = index.ByIndex("byUser", "bert")
- if err != nil {
- t.Errorf("unexpected error: %v", err)
- }
- if len(bertPods) != 1 {
- t.Errorf("Expected 1 pods but got %v", len(bertPods))
- }
- for _, bertPod := range bertPods {
- if bertPod.(*v1.Pod).Name != "one" {
- t.Errorf("Expected only 'one' but got %s", bertPod.(*v1.Pod).Name)
- }
- }
-
-}
diff --git a/vendor/k8s.io/client-go/tools/cache/mutation_detector_test.go b/vendor/k8s.io/client-go/tools/cache/mutation_detector_test.go
deleted file mode 100644
index 41b6942f5..000000000
--- a/vendor/k8s.io/client-go/tools/cache/mutation_detector_test.go
+++ /dev/null
@@ -1,81 +0,0 @@
-// +build !race
-
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package cache
-
-import (
- "testing"
- "time"
-
- "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/watch"
-)
-
-func TestMutationDetector(t *testing.T) {
- fakeWatch := watch.NewFake()
- lw := &testLW{
- WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
- return fakeWatch, nil
- },
- ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
- return &v1.PodList{}, nil
- },
- }
- pod := &v1.Pod{
- ObjectMeta: metav1.ObjectMeta{
- Name: "anything",
- Labels: map[string]string{"check": "foo"},
- },
- }
- stopCh := make(chan struct{})
- defer close(stopCh)
- addReceived := make(chan bool)
- mutationFound := make(chan bool)
-
- informer := NewSharedInformer(lw, &v1.Pod{}, 1*time.Second).(*sharedIndexInformer)
- informer.cacheMutationDetector = &defaultCacheMutationDetector{
- name: "name",
- period: 1 * time.Second,
- failureFunc: func(message string) {
- mutationFound <- true
- },
- }
- informer.AddEventHandler(
- ResourceEventHandlerFuncs{
- AddFunc: func(obj interface{}) {
- addReceived <- true
- },
- },
- )
- go informer.Run(stopCh)
-
- fakeWatch.Add(pod)
-
- select {
- case <-addReceived:
- }
-
- pod.Labels["change"] = "true"
-
- select {
- case <-mutationFound:
- }
-
-}
diff --git a/vendor/k8s.io/client-go/tools/cache/processor_listener_test.go b/vendor/k8s.io/client-go/tools/cache/processor_listener_test.go
deleted file mode 100644
index 1da73420f..000000000
--- a/vendor/k8s.io/client-go/tools/cache/processor_listener_test.go
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package cache
-
-import (
- "sync"
- "testing"
- "time"
-
- "k8s.io/apimachinery/pkg/util/wait"
-)
-
-const (
- concurrencyLevel = 5
-)
-
-func BenchmarkListener(b *testing.B) {
- var notification addNotification
-
- var swg sync.WaitGroup
- swg.Add(b.N)
- b.SetParallelism(concurrencyLevel)
- // Preallocate enough space so that benchmark does not run out of it
- pl := newProcessListener(&ResourceEventHandlerFuncs{
- AddFunc: func(obj interface{}) {
- swg.Done()
- },
- }, 0, 0, time.Now(), 1024*1024)
- var wg wait.Group
- defer wg.Wait() // Wait for .run and .pop to stop
- defer close(pl.addCh) // Tell .run and .pop to stop
- wg.Start(pl.run)
- wg.Start(pl.pop)
-
- b.ReportAllocs()
- b.ResetTimer()
- b.RunParallel(func(pb *testing.PB) {
- for pb.Next() {
- pl.add(notification)
- }
- })
- swg.Wait() // Block until all notifications have been received
- b.StopTimer()
-}
diff --git a/vendor/k8s.io/client-go/tools/cache/reflector_test.go b/vendor/k8s.io/client-go/tools/cache/reflector_test.go
deleted file mode 100644
index bb06059f7..000000000
--- a/vendor/k8s.io/client-go/tools/cache/reflector_test.go
+++ /dev/null
@@ -1,389 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package cache
-
-import (
- "errors"
- "fmt"
- "math/rand"
- "strconv"
- "testing"
- "time"
-
- "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/util/wait"
- "k8s.io/apimachinery/pkg/watch"
-)
-
-var nevererrc chan error
-
-type testLW struct {
- ListFunc func(options metav1.ListOptions) (runtime.Object, error)
- WatchFunc func(options metav1.ListOptions) (watch.Interface, error)
-}
-
-func (t *testLW) List(options metav1.ListOptions) (runtime.Object, error) {
- return t.ListFunc(options)
-}
-func (t *testLW) Watch(options metav1.ListOptions) (watch.Interface, error) {
- return t.WatchFunc(options)
-}
-
-func TestCloseWatchChannelOnError(t *testing.T) {
- r := NewReflector(&testLW{}, &v1.Pod{}, NewStore(MetaNamespaceKeyFunc), 0)
- pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "bar"}}
- fw := watch.NewFake()
- r.listerWatcher = &testLW{
- WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
- return fw, nil
- },
- ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
- return &v1.PodList{ListMeta: metav1.ListMeta{ResourceVersion: "1"}}, nil
- },
- }
- go r.ListAndWatch(wait.NeverStop)
- fw.Error(pod)
- select {
- case _, ok := <-fw.ResultChan():
- if ok {
- t.Errorf("Watch channel left open after cancellation")
- }
- case <-time.After(wait.ForeverTestTimeout):
- t.Errorf("the cancellation is at least %s late", wait.ForeverTestTimeout.String())
- break
- }
-}
-
-func TestRunUntil(t *testing.T) {
- stopCh := make(chan struct{})
- store := NewStore(MetaNamespaceKeyFunc)
- r := NewReflector(&testLW{}, &v1.Pod{}, store, 0)
- fw := watch.NewFake()
- r.listerWatcher = &testLW{
- WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
- return fw, nil
- },
- ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
- return &v1.PodList{ListMeta: metav1.ListMeta{ResourceVersion: "1"}}, nil
- },
- }
- go r.Run(stopCh)
- // Synchronously add a dummy pod into the watch channel so we
- // know the RunUntil go routine is in the watch handler.
- fw.Add(&v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "bar"}})
- close(stopCh)
- select {
- case _, ok := <-fw.ResultChan():
- if ok {
- t.Errorf("Watch channel left open after stopping the watch")
- }
- case <-time.After(wait.ForeverTestTimeout):
- t.Errorf("the cancellation is at least %s late", wait.ForeverTestTimeout.String())
- break
- }
-}
-
-func TestReflectorResyncChan(t *testing.T) {
- s := NewStore(MetaNamespaceKeyFunc)
- g := NewReflector(&testLW{}, &v1.Pod{}, s, time.Millisecond)
- a, _ := g.resyncChan()
- b := time.After(wait.ForeverTestTimeout)
- select {
- case <-a:
- t.Logf("got timeout as expected")
- case <-b:
- t.Errorf("resyncChan() is at least 99 milliseconds late??")
- }
-}
-
-func BenchmarkReflectorResyncChanMany(b *testing.B) {
- s := NewStore(MetaNamespaceKeyFunc)
- g := NewReflector(&testLW{}, &v1.Pod{}, s, 25*time.Millisecond)
- // The improvement to this (calling the timer's Stop() method) makes
- // this benchmark about 40% faster.
- for i := 0; i < b.N; i++ {
- g.resyncPeriod = time.Duration(rand.Float64() * float64(time.Millisecond) * 25)
- _, stop := g.resyncChan()
- stop()
- }
-}
-
-func TestReflectorWatchHandlerError(t *testing.T) {
- s := NewStore(MetaNamespaceKeyFunc)
- g := NewReflector(&testLW{}, &v1.Pod{}, s, 0)
- fw := watch.NewFake()
- go func() {
- fw.Stop()
- }()
- var resumeRV string
- err := g.watchHandler(fw, &resumeRV, nevererrc, wait.NeverStop)
- if err == nil {
- t.Errorf("unexpected non-error")
- }
-}
-
-func TestReflectorWatchHandler(t *testing.T) {
- s := NewStore(MetaNamespaceKeyFunc)
- g := NewReflector(&testLW{}, &v1.Pod{}, s, 0)
- fw := watch.NewFake()
- s.Add(&v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}})
- s.Add(&v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "bar"}})
- go func() {
- fw.Add(&v1.Service{ObjectMeta: metav1.ObjectMeta{Name: "rejected"}})
- fw.Delete(&v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}})
- fw.Modify(&v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "bar", ResourceVersion: "55"}})
- fw.Add(&v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "baz", ResourceVersion: "32"}})
- fw.Stop()
- }()
- var resumeRV string
- err := g.watchHandler(fw, &resumeRV, nevererrc, wait.NeverStop)
- if err != nil {
- t.Errorf("unexpected error %v", err)
- }
-
- mkPod := func(id string, rv string) *v1.Pod {
- return &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: id, ResourceVersion: rv}}
- }
-
- table := []struct {
- Pod *v1.Pod
- exists bool
- }{
- {mkPod("foo", ""), false},
- {mkPod("rejected", ""), false},
- {mkPod("bar", "55"), true},
- {mkPod("baz", "32"), true},
- }
- for _, item := range table {
- obj, exists, _ := s.Get(item.Pod)
- if e, a := item.exists, exists; e != a {
- t.Errorf("%v: expected %v, got %v", item.Pod, e, a)
- }
- if !exists {
- continue
- }
- if e, a := item.Pod.ResourceVersion, obj.(*v1.Pod).ResourceVersion; e != a {
- t.Errorf("%v: expected %v, got %v", item.Pod, e, a)
- }
- }
-
- // RV should send the last version we see.
- if e, a := "32", resumeRV; e != a {
- t.Errorf("expected %v, got %v", e, a)
- }
-
- // last sync resource version should be the last version synced with store
- if e, a := "32", g.LastSyncResourceVersion(); e != a {
- t.Errorf("expected %v, got %v", e, a)
- }
-}
-
-func TestReflectorStopWatch(t *testing.T) {
- s := NewStore(MetaNamespaceKeyFunc)
- g := NewReflector(&testLW{}, &v1.Pod{}, s, 0)
- fw := watch.NewFake()
- var resumeRV string
- stopWatch := make(chan struct{}, 1)
- stopWatch <- struct{}{}
- err := g.watchHandler(fw, &resumeRV, nevererrc, stopWatch)
- if err != errorStopRequested {
- t.Errorf("expected stop error, got %q", err)
- }
-}
-
-func TestReflectorListAndWatch(t *testing.T) {
- createdFakes := make(chan *watch.FakeWatcher)
-
- // The ListFunc says that it's at revision 1. Therefore, we expect our WatchFunc
- // to get called at the beginning of the watch with 1, and again with 3 when we
- // inject an error.
- expectedRVs := []string{"1", "3"}
- lw := &testLW{
- WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
- rv := options.ResourceVersion
- fw := watch.NewFake()
- if e, a := expectedRVs[0], rv; e != a {
- t.Errorf("Expected rv %v, but got %v", e, a)
- }
- expectedRVs = expectedRVs[1:]
- // channel is not buffered because the for loop below needs to block. But
- // we don't want to block here, so report the new fake via a go routine.
- go func() { createdFakes <- fw }()
- return fw, nil
- },
- ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
- return &v1.PodList{ListMeta: metav1.ListMeta{ResourceVersion: "1"}}, nil
- },
- }
- s := NewFIFO(MetaNamespaceKeyFunc)
- r := NewReflector(lw, &v1.Pod{}, s, 0)
- go r.ListAndWatch(wait.NeverStop)
-
- ids := []string{"foo", "bar", "baz", "qux", "zoo"}
- var fw *watch.FakeWatcher
- for i, id := range ids {
- if fw == nil {
- fw = <-createdFakes
- }
- sendingRV := strconv.FormatUint(uint64(i+2), 10)
- fw.Add(&v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: id, ResourceVersion: sendingRV}})
- if sendingRV == "3" {
- // Inject a failure.
- fw.Stop()
- fw = nil
- }
- }
-
- // Verify we received the right ids with the right resource versions.
- for i, id := range ids {
- pod := Pop(s).(*v1.Pod)
- if e, a := id, pod.Name; e != a {
- t.Errorf("%v: Expected %v, got %v", i, e, a)
- }
- if e, a := strconv.FormatUint(uint64(i+2), 10), pod.ResourceVersion; e != a {
- t.Errorf("%v: Expected %v, got %v", i, e, a)
- }
- }
-
- if len(expectedRVs) != 0 {
- t.Error("called watchStarter an unexpected number of times")
- }
-}
-
-func TestReflectorListAndWatchWithErrors(t *testing.T) {
- mkPod := func(id string, rv string) *v1.Pod {
- return &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: id, ResourceVersion: rv}}
- }
- mkList := func(rv string, pods ...*v1.Pod) *v1.PodList {
- list := &v1.PodList{ListMeta: metav1.ListMeta{ResourceVersion: rv}}
- for _, pod := range pods {
- list.Items = append(list.Items, *pod)
- }
- return list
- }
- table := []struct {
- list *v1.PodList
- listErr error
- events []watch.Event
- watchErr error
- }{
- {
- list: mkList("1"),
- events: []watch.Event{
- {Type: watch.Added, Object: mkPod("foo", "2")},
- {Type: watch.Added, Object: mkPod("bar", "3")},
- },
- }, {
- list: mkList("3", mkPod("foo", "2"), mkPod("bar", "3")),
- events: []watch.Event{
- {Type: watch.Deleted, Object: mkPod("foo", "4")},
- {Type: watch.Added, Object: mkPod("qux", "5")},
- },
- }, {
- listErr: fmt.Errorf("a list error"),
- }, {
- list: mkList("5", mkPod("bar", "3"), mkPod("qux", "5")),
- watchErr: fmt.Errorf("a watch error"),
- }, {
- list: mkList("5", mkPod("bar", "3"), mkPod("qux", "5")),
- events: []watch.Event{
- {Type: watch.Added, Object: mkPod("baz", "6")},
- },
- }, {
- list: mkList("6", mkPod("bar", "3"), mkPod("qux", "5"), mkPod("baz", "6")),
- },
- }
-
- s := NewFIFO(MetaNamespaceKeyFunc)
- for line, item := range table {
- if item.list != nil {
- // Test that the list is what currently exists in the store.
- current := s.List()
- checkMap := map[string]string{}
- for _, item := range current {
- pod := item.(*v1.Pod)
- checkMap[pod.Name] = pod.ResourceVersion
- }
- for _, pod := range item.list.Items {
- if e, a := pod.ResourceVersion, checkMap[pod.Name]; e != a {
- t.Errorf("%v: expected %v, got %v for pod %v", line, e, a, pod.Name)
- }
- }
- if e, a := len(item.list.Items), len(checkMap); e != a {
- t.Errorf("%v: expected %v, got %v", line, e, a)
- }
- }
- watchRet, watchErr := item.events, item.watchErr
- lw := &testLW{
- WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
- if watchErr != nil {
- return nil, watchErr
- }
- watchErr = fmt.Errorf("second watch")
- fw := watch.NewFake()
- go func() {
- for _, e := range watchRet {
- fw.Action(e.Type, e.Object)
- }
- fw.Stop()
- }()
- return fw, nil
- },
- ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
- return item.list, item.listErr
- },
- }
- r := NewReflector(lw, &v1.Pod{}, s, 0)
- r.ListAndWatch(wait.NeverStop)
- }
-}
-
-func TestReflectorResync(t *testing.T) {
- iteration := 0
- stopCh := make(chan struct{})
- rerr := errors.New("expected resync reached")
- s := &FakeCustomStore{
- ResyncFunc: func() error {
- iteration++
- if iteration == 2 {
- return rerr
- }
- return nil
- },
- }
-
- lw := &testLW{
- WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
- fw := watch.NewFake()
- return fw, nil
- },
- ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
- return &v1.PodList{ListMeta: metav1.ListMeta{ResourceVersion: "0"}}, nil
- },
- }
- resyncPeriod := 1 * time.Millisecond
- r := NewReflector(lw, &v1.Pod{}, s, resyncPeriod)
- if err := r.ListAndWatch(stopCh); err != nil {
- // error from Resync is not propaged up to here.
- t.Errorf("expected error %v", err)
- }
- if iteration != 2 {
- t.Errorf("exactly 2 iterations were expected, got: %v", iteration)
- }
-}
diff --git a/vendor/k8s.io/client-go/tools/cache/shared_informer_test.go b/vendor/k8s.io/client-go/tools/cache/shared_informer_test.go
deleted file mode 100644
index 22e4a90dd..000000000
--- a/vendor/k8s.io/client-go/tools/cache/shared_informer_test.go
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package cache
-
-import (
- "fmt"
- "sync"
- "testing"
- "time"
-
- "k8s.io/api/core/v1"
- "k8s.io/apimachinery/pkg/api/meta"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/util/clock"
- "k8s.io/apimachinery/pkg/util/sets"
- "k8s.io/apimachinery/pkg/util/wait"
- fcache "k8s.io/client-go/tools/cache/testing"
-)
-
-type testListener struct {
- lock sync.RWMutex
- resyncPeriod time.Duration
- expectedItemNames sets.String
- receivedItemNames []string
- name string
-}
-
-func newTestListener(name string, resyncPeriod time.Duration, expected ...string) *testListener {
- l := &testListener{
- resyncPeriod: resyncPeriod,
- expectedItemNames: sets.NewString(expected...),
- name: name,
- }
- return l
-}
-
-func (l *testListener) OnAdd(obj interface{}) {
- l.handle(obj)
-}
-
-func (l *testListener) OnUpdate(old, new interface{}) {
- l.handle(new)
-}
-
-func (l *testListener) OnDelete(obj interface{}) {
-}
-
-func (l *testListener) handle(obj interface{}) {
- key, _ := MetaNamespaceKeyFunc(obj)
- fmt.Printf("%s: handle: %v\n", l.name, key)
- l.lock.Lock()
- defer l.lock.Unlock()
-
- objectMeta, _ := meta.Accessor(obj)
- l.receivedItemNames = append(l.receivedItemNames, objectMeta.GetName())
-}
-
-func (l *testListener) ok() bool {
- fmt.Println("polling")
- err := wait.PollImmediate(100*time.Millisecond, 2*time.Second, func() (bool, error) {
- if l.satisfiedExpectations() {
- return true, nil
- }
- return false, nil
- })
- if err != nil {
- return false
- }
-
- // wait just a bit to allow any unexpected stragglers to come in
- fmt.Println("sleeping")
- time.Sleep(1 * time.Second)
- fmt.Println("final check")
- return l.satisfiedExpectations()
-}
-
-func (l *testListener) satisfiedExpectations() bool {
- l.lock.RLock()
- defer l.lock.RUnlock()
-
- return len(l.receivedItemNames) == l.expectedItemNames.Len() && sets.NewString(l.receivedItemNames...).Equal(l.expectedItemNames)
-}
-
-func TestListenerResyncPeriods(t *testing.T) {
- // source simulates an apiserver object endpoint.
- source := fcache.NewFakeControllerSource()
- source.Add(&v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "pod1"}})
- source.Add(&v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "pod2"}})
-
- // create the shared informer and resync every 1s
- informer := NewSharedInformer(source, &v1.Pod{}, 1*time.Second).(*sharedIndexInformer)
-
- clock := clock.NewFakeClock(time.Now())
- informer.clock = clock
- informer.processor.clock = clock
-
- // listener 1, never resync
- listener1 := newTestListener("listener1", 0, "pod1", "pod2")
- informer.AddEventHandlerWithResyncPeriod(listener1, listener1.resyncPeriod)
-
- // listener 2, resync every 2s
- listener2 := newTestListener("listener2", 2*time.Second, "pod1", "pod2")
- informer.AddEventHandlerWithResyncPeriod(listener2, listener2.resyncPeriod)
-
- // listener 3, resync every 3s
- listener3 := newTestListener("listener3", 3*time.Second, "pod1", "pod2")
- informer.AddEventHandlerWithResyncPeriod(listener3, listener3.resyncPeriod)
- listeners := []*testListener{listener1, listener2, listener3}
-
- stop := make(chan struct{})
- defer close(stop)
-
- go informer.Run(stop)
-
- // ensure all listeners got the initial List
- for _, listener := range listeners {
- if !listener.ok() {
- t.Errorf("%s: expected %v, got %v", listener.name, listener.expectedItemNames, listener.receivedItemNames)
- }
- }
-
- // reset
- for _, listener := range listeners {
- listener.receivedItemNames = []string{}
- }
-
- // advance so listener2 gets a resync
- clock.Step(2 * time.Second)
-
- // make sure listener2 got the resync
- if !listener2.ok() {
- t.Errorf("%s: expected %v, got %v", listener2.name, listener2.expectedItemNames, listener2.receivedItemNames)
- }
-
- // wait a bit to give errant items a chance to go to 1 and 3
- time.Sleep(1 * time.Second)
-
- // make sure listeners 1 and 3 got nothing
- if len(listener1.receivedItemNames) != 0 {
- t.Errorf("listener1: should not have resynced (got %d)", len(listener1.receivedItemNames))
- }
- if len(listener3.receivedItemNames) != 0 {
- t.Errorf("listener3: should not have resynced (got %d)", len(listener3.receivedItemNames))
- }
-
- // reset
- for _, listener := range listeners {
- listener.receivedItemNames = []string{}
- }
-
- // advance so listener3 gets a resync
- clock.Step(1 * time.Second)
-
- // make sure listener3 got the resync
- if !listener3.ok() {
- t.Errorf("%s: expected %v, got %v", listener3.name, listener3.expectedItemNames, listener3.receivedItemNames)
- }
-
- // wait a bit to give errant items a chance to go to 1 and 2
- time.Sleep(1 * time.Second)
-
- // make sure listeners 1 and 2 got nothing
- if len(listener1.receivedItemNames) != 0 {
- t.Errorf("listener1: should not have resynced (got %d)", len(listener1.receivedItemNames))
- }
- if len(listener2.receivedItemNames) != 0 {
- t.Errorf("listener2: should not have resynced (got %d)", len(listener2.receivedItemNames))
- }
-}
-
-func TestResyncCheckPeriod(t *testing.T) {
- // source simulates an apiserver object endpoint.
- source := fcache.NewFakeControllerSource()
-
- // create the shared informer and resync every 12 hours
- informer := NewSharedInformer(source, &v1.Pod{}, 12*time.Hour).(*sharedIndexInformer)
-
- clock := clock.NewFakeClock(time.Now())
- informer.clock = clock
- informer.processor.clock = clock
-
- // listener 1, never resync
- listener1 := newTestListener("listener1", 0)
- informer.AddEventHandlerWithResyncPeriod(listener1, listener1.resyncPeriod)
- if e, a := 12*time.Hour, informer.resyncCheckPeriod; e != a {
- t.Errorf("expected %d, got %d", e, a)
- }
- if e, a := time.Duration(0), informer.processor.listeners[0].resyncPeriod; e != a {
- t.Errorf("expected %d, got %d", e, a)
- }
-
- // listener 2, resync every minute
- listener2 := newTestListener("listener2", 1*time.Minute)
- informer.AddEventHandlerWithResyncPeriod(listener2, listener2.resyncPeriod)
- if e, a := 1*time.Minute, informer.resyncCheckPeriod; e != a {
- t.Errorf("expected %d, got %d", e, a)
- }
- if e, a := time.Duration(0), informer.processor.listeners[0].resyncPeriod; e != a {
- t.Errorf("expected %d, got %d", e, a)
- }
- if e, a := 1*time.Minute, informer.processor.listeners[1].resyncPeriod; e != a {
- t.Errorf("expected %d, got %d", e, a)
- }
-
- // listener 3, resync every 55 seconds
- listener3 := newTestListener("listener3", 55*time.Second)
- informer.AddEventHandlerWithResyncPeriod(listener3, listener3.resyncPeriod)
- if e, a := 55*time.Second, informer.resyncCheckPeriod; e != a {
- t.Errorf("expected %d, got %d", e, a)
- }
- if e, a := time.Duration(0), informer.processor.listeners[0].resyncPeriod; e != a {
- t.Errorf("expected %d, got %d", e, a)
- }
- if e, a := 1*time.Minute, informer.processor.listeners[1].resyncPeriod; e != a {
- t.Errorf("expected %d, got %d", e, a)
- }
- if e, a := 55*time.Second, informer.processor.listeners[2].resyncPeriod; e != a {
- t.Errorf("expected %d, got %d", e, a)
- }
-
- // listener 4, resync every 5 seconds
- listener4 := newTestListener("listener4", 5*time.Second)
- informer.AddEventHandlerWithResyncPeriod(listener4, listener4.resyncPeriod)
- if e, a := 5*time.Second, informer.resyncCheckPeriod; e != a {
- t.Errorf("expected %d, got %d", e, a)
- }
- if e, a := time.Duration(0), informer.processor.listeners[0].resyncPeriod; e != a {
- t.Errorf("expected %d, got %d", e, a)
- }
- if e, a := 1*time.Minute, informer.processor.listeners[1].resyncPeriod; e != a {
- t.Errorf("expected %d, got %d", e, a)
- }
- if e, a := 55*time.Second, informer.processor.listeners[2].resyncPeriod; e != a {
- t.Errorf("expected %d, got %d", e, a)
- }
- if e, a := 5*time.Second, informer.processor.listeners[3].resyncPeriod; e != a {
- t.Errorf("expected %d, got %d", e, a)
- }
-}
-
-// verify that https://github.com/kubernetes/kubernetes/issues/59822 is fixed
-func TestSharedInformerInitializationRace(t *testing.T) {
- source := fcache.NewFakeControllerSource()
- informer := NewSharedInformer(source, &v1.Pod{}, 1*time.Second).(*sharedIndexInformer)
- listener := newTestListener("raceListener", 0)
-
- stop := make(chan struct{})
- go informer.AddEventHandlerWithResyncPeriod(listener, listener.resyncPeriod)
- go informer.Run(stop)
- close(stop)
-}
diff --git a/vendor/k8s.io/client-go/tools/cache/store_test.go b/vendor/k8s.io/client-go/tools/cache/store_test.go
deleted file mode 100644
index 52c9585a9..000000000
--- a/vendor/k8s.io/client-go/tools/cache/store_test.go
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package cache
-
-import (
- "testing"
-
- "k8s.io/apimachinery/pkg/util/sets"
-)
-
-// Test public interface
-func doTestStore(t *testing.T, store Store) {
- mkObj := func(id string, val string) testStoreObject {
- return testStoreObject{id: id, val: val}
- }
-
- store.Add(mkObj("foo", "bar"))
- if item, ok, _ := store.Get(mkObj("foo", "")); !ok {
- t.Errorf("didn't find inserted item")
- } else {
- if e, a := "bar", item.(testStoreObject).val; e != a {
- t.Errorf("expected %v, got %v", e, a)
- }
- }
- store.Update(mkObj("foo", "baz"))
- if item, ok, _ := store.Get(mkObj("foo", "")); !ok {
- t.Errorf("didn't find inserted item")
- } else {
- if e, a := "baz", item.(testStoreObject).val; e != a {
- t.Errorf("expected %v, got %v", e, a)
- }
- }
- store.Delete(mkObj("foo", ""))
- if _, ok, _ := store.Get(mkObj("foo", "")); ok {
- t.Errorf("found deleted item??")
- }
-
- // Test List.
- store.Add(mkObj("a", "b"))
- store.Add(mkObj("c", "d"))
- store.Add(mkObj("e", "e"))
- {
- found := sets.String{}
- for _, item := range store.List() {
- found.Insert(item.(testStoreObject).val)
- }
- if !found.HasAll("b", "d", "e") {
- t.Errorf("missing items, found: %v", found)
- }
- if len(found) != 3 {
- t.Errorf("extra items")
- }
- }
-
- // Test Replace.
- store.Replace([]interface{}{
- mkObj("foo", "foo"),
- mkObj("bar", "bar"),
- }, "0")
-
- {
- found := sets.String{}
- for _, item := range store.List() {
- found.Insert(item.(testStoreObject).val)
- }
- if !found.HasAll("foo", "bar") {
- t.Errorf("missing items")
- }
- if len(found) != 2 {
- t.Errorf("extra items")
- }
- }
-}
-
-// Test public interface
-func doTestIndex(t *testing.T, indexer Indexer) {
- mkObj := func(id string, val string) testStoreObject {
- return testStoreObject{id: id, val: val}
- }
-
- // Test Index
- expected := map[string]sets.String{}
- expected["b"] = sets.NewString("a", "c")
- expected["f"] = sets.NewString("e")
- expected["h"] = sets.NewString("g")
- indexer.Add(mkObj("a", "b"))
- indexer.Add(mkObj("c", "b"))
- indexer.Add(mkObj("e", "f"))
- indexer.Add(mkObj("g", "h"))
- {
- for k, v := range expected {
- found := sets.String{}
- indexResults, err := indexer.Index("by_val", mkObj("", k))
- if err != nil {
- t.Errorf("Unexpected error %v", err)
- }
- for _, item := range indexResults {
- found.Insert(item.(testStoreObject).id)
- }
- items := v.List()
- if !found.HasAll(items...) {
- t.Errorf("missing items, index %s, expected %v but found %v", k, items, found.List())
- }
- }
- }
-}
-
-func testStoreKeyFunc(obj interface{}) (string, error) {
- return obj.(testStoreObject).id, nil
-}
-
-func testStoreIndexFunc(obj interface{}) ([]string, error) {
- return []string{obj.(testStoreObject).val}, nil
-}
-
-func testStoreIndexers() Indexers {
- indexers := Indexers{}
- indexers["by_val"] = testStoreIndexFunc
- return indexers
-}
-
-type testStoreObject struct {
- id string
- val string
-}
-
-func TestCache(t *testing.T) {
- doTestStore(t, NewStore(testStoreKeyFunc))
-}
-
-func TestFIFOCache(t *testing.T) {
- doTestStore(t, NewFIFO(testStoreKeyFunc))
-}
-
-func TestUndeltaStore(t *testing.T) {
- nop := func([]interface{}) {}
- doTestStore(t, NewUndeltaStore(nop, testStoreKeyFunc))
-}
-
-func TestIndex(t *testing.T) {
- doTestIndex(t, NewIndexer(testStoreKeyFunc, testStoreIndexers()))
-}
diff --git a/vendor/k8s.io/client-go/tools/cache/undelta_store_test.go b/vendor/k8s.io/client-go/tools/cache/undelta_store_test.go
deleted file mode 100644
index 6316442e6..000000000
--- a/vendor/k8s.io/client-go/tools/cache/undelta_store_test.go
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
-Copyright 2015 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package cache
-
-import (
- "reflect"
- "testing"
-)
-
-// store_test.go checks that UndeltaStore conforms to the Store interface
-// behavior. This test just tests that it calls the push func in addition.
-
-type testUndeltaObject struct {
- name string
- val interface{}
-}
-
-func testUndeltaKeyFunc(obj interface{}) (string, error) {
- return obj.(testUndeltaObject).name, nil
-}
-
-/*
-var (
- o1 interface{} = t{1}
- o2 interface{} = t{2}
- l1 []interface{} = []interface{}{t{1}}
-)
-*/
-
-func TestUpdateCallsPush(t *testing.T) {
- mkObj := func(name string, val interface{}) testUndeltaObject {
- return testUndeltaObject{name: name, val: val}
- }
-
- var got []interface{}
- var callcount int = 0
- push := func(m []interface{}) {
- callcount++
- got = m
- }
-
- u := NewUndeltaStore(push, testUndeltaKeyFunc)
-
- u.Add(mkObj("a", 2))
- u.Update(mkObj("a", 1))
- if callcount != 2 {
- t.Errorf("Expected 2 calls, got %d", callcount)
- }
-
- l := []interface{}{mkObj("a", 1)}
- if !reflect.DeepEqual(l, got) {
- t.Errorf("Expected %#v, Got %#v", l, got)
- }
-}
-
-func TestDeleteCallsPush(t *testing.T) {
- mkObj := func(name string, val interface{}) testUndeltaObject {
- return testUndeltaObject{name: name, val: val}
- }
-
- var got []interface{}
- var callcount int = 0
- push := func(m []interface{}) {
- callcount++
- got = m
- }
-
- u := NewUndeltaStore(push, testUndeltaKeyFunc)
-
- u.Add(mkObj("a", 2))
- u.Delete(mkObj("a", ""))
- if callcount != 2 {
- t.Errorf("Expected 2 calls, got %d", callcount)
- }
- expected := []interface{}{}
- if !reflect.DeepEqual(expected, got) {
- t.Errorf("Expected %#v, Got %#v", expected, got)
- }
-}
-
-func TestReadsDoNotCallPush(t *testing.T) {
- push := func(m []interface{}) {
- t.Errorf("Unexpected call to push!")
- }
-
- u := NewUndeltaStore(push, testUndeltaKeyFunc)
-
- // These should not call push.
- _ = u.List()
- _, _, _ = u.Get(testUndeltaObject{"a", ""})
-}
-
-func TestReplaceCallsPush(t *testing.T) {
- mkObj := func(name string, val interface{}) testUndeltaObject {
- return testUndeltaObject{name: name, val: val}
- }
-
- var got []interface{}
- var callcount int = 0
- push := func(m []interface{}) {
- callcount++
- got = m
- }
-
- u := NewUndeltaStore(push, testUndeltaKeyFunc)
-
- m := []interface{}{mkObj("a", 1)}
-
- u.Replace(m, "0")
- if callcount != 1 {
- t.Errorf("Expected 1 calls, got %d", callcount)
- }
- expected := []interface{}{mkObj("a", 1)}
- if !reflect.DeepEqual(expected, got) {
- t.Errorf("Expected %#v, Got %#v", expected, got)
- }
-}
diff --git a/vendor/k8s.io/client-go/tools/clientcmd/api/helpers_test.go b/vendor/k8s.io/client-go/tools/clientcmd/api/helpers_test.go
deleted file mode 100644
index 430208456..000000000
--- a/vendor/k8s.io/client-go/tools/clientcmd/api/helpers_test.go
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
-Copyright 2015 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package api
-
-import (
- "fmt"
- "io/ioutil"
- "os"
- "reflect"
- "testing"
-
- "github.com/ghodss/yaml"
-)
-
-func newMergedConfig(certFile, certContent, keyFile, keyContent, caFile, caContent string, t *testing.T) Config {
- if err := ioutil.WriteFile(certFile, []byte(certContent), 0644); err != nil {
- t.Errorf("unexpected error: %v", err)
- }
- if err := ioutil.WriteFile(keyFile, []byte(keyContent), 0600); err != nil {
- t.Errorf("unexpected error: %v", err)
- }
- if err := ioutil.WriteFile(caFile, []byte(caContent), 0644); err != nil {
- t.Errorf("unexpected error: %v", err)
- }
-
- return Config{
- AuthInfos: map[string]*AuthInfo{
- "red-user": {Token: "red-token", ClientCertificateData: []byte(certContent), ClientKeyData: []byte(keyContent)},
- "blue-user": {Token: "blue-token", ClientCertificate: certFile, ClientKey: keyFile}},
- Clusters: map[string]*Cluster{
- "cow-cluster": {Server: "http://cow.org:8080", CertificateAuthorityData: []byte(caContent)},
- "chicken-cluster": {Server: "http://chicken.org:8080", CertificateAuthority: caFile}},
- Contexts: map[string]*Context{
- "federal-context": {AuthInfo: "red-user", Cluster: "cow-cluster"},
- "shaker-context": {AuthInfo: "blue-user", Cluster: "chicken-cluster"}},
- CurrentContext: "federal-context",
- }
-}
-
-func TestMinifySuccess(t *testing.T) {
- certFile, _ := ioutil.TempFile("", "")
- defer os.Remove(certFile.Name())
- keyFile, _ := ioutil.TempFile("", "")
- defer os.Remove(keyFile.Name())
- caFile, _ := ioutil.TempFile("", "")
- defer os.Remove(caFile.Name())
-
- mutatingConfig := newMergedConfig(certFile.Name(), "cert", keyFile.Name(), "key", caFile.Name(), "ca", t)
-
- if err := MinifyConfig(&mutatingConfig); err != nil {
- t.Errorf("unexpected error: %v", err)
- }
-
- if len(mutatingConfig.Contexts) > 1 {
- t.Errorf("unexpected contexts: %v", mutatingConfig.Contexts)
- }
- if _, exists := mutatingConfig.Contexts["federal-context"]; !exists {
- t.Errorf("missing context")
- }
-
- if len(mutatingConfig.Clusters) > 1 {
- t.Errorf("unexpected clusters: %v", mutatingConfig.Clusters)
- }
- if _, exists := mutatingConfig.Clusters["cow-cluster"]; !exists {
- t.Errorf("missing cluster")
- }
-
- if len(mutatingConfig.AuthInfos) > 1 {
- t.Errorf("unexpected users: %v", mutatingConfig.AuthInfos)
- }
- if _, exists := mutatingConfig.AuthInfos["red-user"]; !exists {
- t.Errorf("missing user")
- }
-}
-
-func TestMinifyMissingContext(t *testing.T) {
- certFile, _ := ioutil.TempFile("", "")
- defer os.Remove(certFile.Name())
- keyFile, _ := ioutil.TempFile("", "")
- defer os.Remove(keyFile.Name())
- caFile, _ := ioutil.TempFile("", "")
- defer os.Remove(caFile.Name())
-
- mutatingConfig := newMergedConfig(certFile.Name(), "cert", keyFile.Name(), "key", caFile.Name(), "ca", t)
- mutatingConfig.CurrentContext = "missing"
-
- errMsg := "cannot locate context missing"
-
- if err := MinifyConfig(&mutatingConfig); err == nil || err.Error() != errMsg {
- t.Errorf("expected %v, got %v", errMsg, err)
- }
-}
-
-func TestMinifyMissingCluster(t *testing.T) {
- certFile, _ := ioutil.TempFile("", "")
- defer os.Remove(certFile.Name())
- keyFile, _ := ioutil.TempFile("", "")
- defer os.Remove(keyFile.Name())
- caFile, _ := ioutil.TempFile("", "")
- defer os.Remove(caFile.Name())
-
- mutatingConfig := newMergedConfig(certFile.Name(), "cert", keyFile.Name(), "key", caFile.Name(), "ca", t)
- delete(mutatingConfig.Clusters, mutatingConfig.Contexts[mutatingConfig.CurrentContext].Cluster)
-
- errMsg := "cannot locate cluster cow-cluster"
-
- if err := MinifyConfig(&mutatingConfig); err == nil || err.Error() != errMsg {
- t.Errorf("expected %v, got %v", errMsg, err)
- }
-}
-
-func TestMinifyMissingAuthInfo(t *testing.T) {
- certFile, _ := ioutil.TempFile("", "")
- defer os.Remove(certFile.Name())
- keyFile, _ := ioutil.TempFile("", "")
- defer os.Remove(keyFile.Name())
- caFile, _ := ioutil.TempFile("", "")
- defer os.Remove(caFile.Name())
-
- mutatingConfig := newMergedConfig(certFile.Name(), "cert", keyFile.Name(), "key", caFile.Name(), "ca", t)
- delete(mutatingConfig.AuthInfos, mutatingConfig.Contexts[mutatingConfig.CurrentContext].AuthInfo)
-
- errMsg := "cannot locate user red-user"
-
- if err := MinifyConfig(&mutatingConfig); err == nil || err.Error() != errMsg {
- t.Errorf("expected %v, got %v", errMsg, err)
- }
-}
-
-func TestFlattenSuccess(t *testing.T) {
- certFile, _ := ioutil.TempFile("", "")
- defer os.Remove(certFile.Name())
- keyFile, _ := ioutil.TempFile("", "")
- defer os.Remove(keyFile.Name())
- caFile, _ := ioutil.TempFile("", "")
- defer os.Remove(caFile.Name())
-
- certData := "cert"
- keyData := "key"
- caData := "ca"
-
- unchangingCluster := "cow-cluster"
- unchangingAuthInfo := "red-user"
- changingCluster := "chicken-cluster"
- changingAuthInfo := "blue-user"
-
- startingConfig := newMergedConfig(certFile.Name(), certData, keyFile.Name(), keyData, caFile.Name(), caData, t)
- mutatingConfig := startingConfig
-
- if err := FlattenConfig(&mutatingConfig); err != nil {
- t.Errorf("unexpected error: %v", err)
- }
-
- if len(mutatingConfig.Contexts) != 2 {
- t.Errorf("unexpected contexts: %v", mutatingConfig.Contexts)
- }
- if !reflect.DeepEqual(startingConfig.Contexts, mutatingConfig.Contexts) {
- t.Errorf("expected %v, got %v", startingConfig.Contexts, mutatingConfig.Contexts)
- }
-
- if len(mutatingConfig.Clusters) != 2 {
- t.Errorf("unexpected clusters: %v", mutatingConfig.Clusters)
- }
- if !reflect.DeepEqual(startingConfig.Clusters[unchangingCluster], mutatingConfig.Clusters[unchangingCluster]) {
- t.Errorf("expected %v, got %v", startingConfig.Clusters[unchangingCluster], mutatingConfig.Clusters[unchangingCluster])
- }
- if len(mutatingConfig.Clusters[changingCluster].CertificateAuthority) != 0 {
- t.Errorf("unexpected caFile")
- }
- if string(mutatingConfig.Clusters[changingCluster].CertificateAuthorityData) != caData {
- t.Errorf("expected %v, got %v", caData, string(mutatingConfig.Clusters[changingCluster].CertificateAuthorityData))
- }
-
- if len(mutatingConfig.AuthInfos) != 2 {
- t.Errorf("unexpected users: %v", mutatingConfig.AuthInfos)
- }
- if !reflect.DeepEqual(startingConfig.AuthInfos[unchangingAuthInfo], mutatingConfig.AuthInfos[unchangingAuthInfo]) {
- t.Errorf("expected %v, got %v", startingConfig.AuthInfos[unchangingAuthInfo], mutatingConfig.AuthInfos[unchangingAuthInfo])
- }
- if len(mutatingConfig.AuthInfos[changingAuthInfo].ClientCertificate) != 0 {
- t.Errorf("unexpected caFile")
- }
- if string(mutatingConfig.AuthInfos[changingAuthInfo].ClientCertificateData) != certData {
- t.Errorf("expected %v, got %v", certData, string(mutatingConfig.AuthInfos[changingAuthInfo].ClientCertificateData))
- }
- if len(mutatingConfig.AuthInfos[changingAuthInfo].ClientKey) != 0 {
- t.Errorf("unexpected caFile")
- }
- if string(mutatingConfig.AuthInfos[changingAuthInfo].ClientKeyData) != keyData {
- t.Errorf("expected %v, got %v", keyData, string(mutatingConfig.AuthInfos[changingAuthInfo].ClientKeyData))
- }
-
-}
-
-func Example_minifyAndShorten() {
- certFile, _ := ioutil.TempFile("", "")
- defer os.Remove(certFile.Name())
- keyFile, _ := ioutil.TempFile("", "")
- defer os.Remove(keyFile.Name())
- caFile, _ := ioutil.TempFile("", "")
- defer os.Remove(caFile.Name())
-
- certData := "cert"
- keyData := "key"
- caData := "ca"
-
- config := newMergedConfig(certFile.Name(), certData, keyFile.Name(), keyData, caFile.Name(), caData, nil)
-
- MinifyConfig(&config)
- ShortenConfig(&config)
-
- output, _ := yaml.Marshal(config)
- fmt.Printf("%s", string(output))
- // Output:
- // clusters:
- // cow-cluster:
- // LocationOfOrigin: ""
- // certificate-authority-data: REDACTED
- // server: http://cow.org:8080
- // contexts:
- // federal-context:
- // LocationOfOrigin: ""
- // cluster: cow-cluster
- // user: red-user
- // current-context: federal-context
- // preferences: {}
- // users:
- // red-user:
- // LocationOfOrigin: ""
- // client-certificate-data: REDACTED
- // client-key-data: REDACTED
- // token: red-token
-}
-
-func TestShortenSuccess(t *testing.T) {
- certFile, _ := ioutil.TempFile("", "")
- defer os.Remove(certFile.Name())
- keyFile, _ := ioutil.TempFile("", "")
- defer os.Remove(keyFile.Name())
- caFile, _ := ioutil.TempFile("", "")
- defer os.Remove(caFile.Name())
-
- certData := "cert"
- keyData := "key"
- caData := "ca"
-
- unchangingCluster := "chicken-cluster"
- unchangingAuthInfo := "blue-user"
- changingCluster := "cow-cluster"
- changingAuthInfo := "red-user"
-
- startingConfig := newMergedConfig(certFile.Name(), certData, keyFile.Name(), keyData, caFile.Name(), caData, t)
- mutatingConfig := startingConfig
-
- ShortenConfig(&mutatingConfig)
-
- if len(mutatingConfig.Contexts) != 2 {
- t.Errorf("unexpected contexts: %v", mutatingConfig.Contexts)
- }
- if !reflect.DeepEqual(startingConfig.Contexts, mutatingConfig.Contexts) {
- t.Errorf("expected %v, got %v", startingConfig.Contexts, mutatingConfig.Contexts)
- }
-
- redacted := string(redactedBytes)
- if len(mutatingConfig.Clusters) != 2 {
- t.Errorf("unexpected clusters: %v", mutatingConfig.Clusters)
- }
- if !reflect.DeepEqual(startingConfig.Clusters[unchangingCluster], mutatingConfig.Clusters[unchangingCluster]) {
- t.Errorf("expected %v, got %v", startingConfig.Clusters[unchangingCluster], mutatingConfig.Clusters[unchangingCluster])
- }
- if string(mutatingConfig.Clusters[changingCluster].CertificateAuthorityData) != redacted {
- t.Errorf("expected %v, got %v", redacted, string(mutatingConfig.Clusters[changingCluster].CertificateAuthorityData))
- }
-
- if len(mutatingConfig.AuthInfos) != 2 {
- t.Errorf("unexpected users: %v", mutatingConfig.AuthInfos)
- }
- if !reflect.DeepEqual(startingConfig.AuthInfos[unchangingAuthInfo], mutatingConfig.AuthInfos[unchangingAuthInfo]) {
- t.Errorf("expected %v, got %v", startingConfig.AuthInfos[unchangingAuthInfo], mutatingConfig.AuthInfos[unchangingAuthInfo])
- }
- if string(mutatingConfig.AuthInfos[changingAuthInfo].ClientCertificateData) != redacted {
- t.Errorf("expected %v, got %v", redacted, string(mutatingConfig.AuthInfos[changingAuthInfo].ClientCertificateData))
- }
- if string(mutatingConfig.AuthInfos[changingAuthInfo].ClientKeyData) != redacted {
- t.Errorf("expected %v, got %v", redacted, string(mutatingConfig.AuthInfos[changingAuthInfo].ClientKeyData))
- }
-}
diff --git a/vendor/k8s.io/client-go/tools/clientcmd/api/types_test.go b/vendor/k8s.io/client-go/tools/clientcmd/api/types_test.go
deleted file mode 100644
index bd3483452..000000000
--- a/vendor/k8s.io/client-go/tools/clientcmd/api/types_test.go
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package api
-
-import (
- "fmt"
-
- "github.com/ghodss/yaml"
-)
-
-func Example_emptyConfig() {
- defaultConfig := NewConfig()
-
- output, err := yaml.Marshal(defaultConfig)
- if err != nil {
- fmt.Printf("Unexpected error: %v", err)
- }
-
- fmt.Printf("%v", string(output))
- // Output:
- // clusters: {}
- // contexts: {}
- // current-context: ""
- // preferences: {}
- // users: {}
-}
-
-func Example_ofOptionsConfig() {
- defaultConfig := NewConfig()
- defaultConfig.Preferences.Colors = true
- defaultConfig.Clusters["alfa"] = &Cluster{
- Server: "https://alfa.org:8080",
- InsecureSkipTLSVerify: true,
- CertificateAuthority: "path/to/my/cert-ca-filename",
- }
- defaultConfig.Clusters["bravo"] = &Cluster{
- Server: "https://bravo.org:8080",
- InsecureSkipTLSVerify: false,
- }
- defaultConfig.AuthInfos["white-mage-via-cert"] = &AuthInfo{
- ClientCertificate: "path/to/my/client-cert-filename",
- ClientKey: "path/to/my/client-key-filename",
- }
- defaultConfig.AuthInfos["red-mage-via-token"] = &AuthInfo{
- Token: "my-secret-token",
- }
- defaultConfig.AuthInfos["black-mage-via-auth-provider"] = &AuthInfo{
- AuthProvider: &AuthProviderConfig{
- Name: "gcp",
- Config: map[string]string{
- "foo": "bar",
- "token": "s3cr3t-t0k3n",
- },
- },
- }
- defaultConfig.Contexts["bravo-as-black-mage"] = &Context{
- Cluster: "bravo",
- AuthInfo: "black-mage-via-auth-provider",
- Namespace: "yankee",
- }
- defaultConfig.Contexts["alfa-as-black-mage"] = &Context{
- Cluster: "alfa",
- AuthInfo: "black-mage-via-auth-provider",
- Namespace: "zulu",
- }
- defaultConfig.Contexts["alfa-as-white-mage"] = &Context{
- Cluster: "alfa",
- AuthInfo: "white-mage-via-cert",
- }
- defaultConfig.CurrentContext = "alfa-as-white-mage"
-
- output, err := yaml.Marshal(defaultConfig)
- if err != nil {
- fmt.Printf("Unexpected error: %v", err)
- }
-
- fmt.Printf("%v", string(output))
- // Output:
- // clusters:
- // alfa:
- // LocationOfOrigin: ""
- // certificate-authority: path/to/my/cert-ca-filename
- // insecure-skip-tls-verify: true
- // server: https://alfa.org:8080
- // bravo:
- // LocationOfOrigin: ""
- // server: https://bravo.org:8080
- // contexts:
- // alfa-as-black-mage:
- // LocationOfOrigin: ""
- // cluster: alfa
- // namespace: zulu
- // user: black-mage-via-auth-provider
- // alfa-as-white-mage:
- // LocationOfOrigin: ""
- // cluster: alfa
- // user: white-mage-via-cert
- // bravo-as-black-mage:
- // LocationOfOrigin: ""
- // cluster: bravo
- // namespace: yankee
- // user: black-mage-via-auth-provider
- // current-context: alfa-as-white-mage
- // preferences:
- // colors: true
- // users:
- // black-mage-via-auth-provider:
- // LocationOfOrigin: ""
- // auth-provider:
- // config:
- // foo: bar
- // token: s3cr3t-t0k3n
- // name: gcp
- // red-mage-via-token:
- // LocationOfOrigin: ""
- // token: my-secret-token
- // white-mage-via-cert:
- // LocationOfOrigin: ""
- // client-certificate: path/to/my/client-cert-filename
- // client-key: path/to/my/client-key-filename
-}
diff --git a/vendor/k8s.io/client-go/tools/clientcmd/client_config_test.go b/vendor/k8s.io/client-go/tools/clientcmd/client_config_test.go
deleted file mode 100644
index 0a9288bcf..000000000
--- a/vendor/k8s.io/client-go/tools/clientcmd/client_config_test.go
+++ /dev/null
@@ -1,528 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package clientcmd
-
-import (
- "io/ioutil"
- "os"
- "reflect"
- "strings"
- "testing"
-
- "github.com/imdario/mergo"
- restclient "k8s.io/client-go/rest"
- clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
-)
-
-func TestOldMergoLib(t *testing.T) {
- type T struct {
- X string
- }
- dst := T{X: "one"}
- src := T{X: "two"}
- mergo.Merge(&dst, &src)
- if dst.X != "two" {
- // mergo.Merge changed in an incompatible way with
- //
- // https://github.com/imdario/mergo/commit/d304790b2ed594794496464fadd89d2bb266600a
- //
- // We have to stay with the old version which still does eager
- // copying from src to dst in structs.
- t.Errorf("mergo.Merge library found with incompatible, new behavior")
- }
-}
-
-func createValidTestConfig() *clientcmdapi.Config {
- const (
- server = "https://anything.com:8080"
- token = "the-token"
- )
-
- config := clientcmdapi.NewConfig()
- config.Clusters["clean"] = &clientcmdapi.Cluster{
- Server: server,
- }
- config.AuthInfos["clean"] = &clientcmdapi.AuthInfo{
- Token: token,
- }
- config.Contexts["clean"] = &clientcmdapi.Context{
- Cluster: "clean",
- AuthInfo: "clean",
- }
- config.CurrentContext = "clean"
-
- return config
-}
-
-func createCAValidTestConfig() *clientcmdapi.Config {
-
- config := createValidTestConfig()
- config.Clusters["clean"].CertificateAuthorityData = []byte{0, 0}
- return config
-}
-
-func TestInsecureOverridesCA(t *testing.T) {
- config := createCAValidTestConfig()
- clientBuilder := NewNonInteractiveClientConfig(*config, "clean", &ConfigOverrides{
- ClusterInfo: clientcmdapi.Cluster{
- InsecureSkipTLSVerify: true,
- },
- }, nil)
-
- actualCfg, err := clientBuilder.ClientConfig()
- if err != nil {
- t.Errorf("Unexpected error: %v", err)
- }
-
- matchBoolArg(true, actualCfg.Insecure, t)
- matchStringArg("", actualCfg.TLSClientConfig.CAFile, t)
- matchByteArg(nil, actualCfg.TLSClientConfig.CAData, t)
-}
-
-func TestMergeContext(t *testing.T) {
- const namespace = "overridden-namespace"
-
- config := createValidTestConfig()
- clientBuilder := NewNonInteractiveClientConfig(*config, "clean", &ConfigOverrides{}, nil)
-
- _, overridden, err := clientBuilder.Namespace()
- if err != nil {
- t.Errorf("Unexpected error: %v", err)
- }
-
- if overridden {
- t.Error("Expected namespace to not be overridden")
- }
-
- clientBuilder = NewNonInteractiveClientConfig(*config, "clean", &ConfigOverrides{
- Context: clientcmdapi.Context{
- Namespace: namespace,
- },
- }, nil)
-
- actual, overridden, err := clientBuilder.Namespace()
- if err != nil {
- t.Errorf("Unexpected error: %v", err)
- }
-
- if !overridden {
- t.Error("Expected namespace to be overridden")
- }
-
- matchStringArg(namespace, actual, t)
-}
-
-func TestCertificateData(t *testing.T) {
- caData := []byte("ca-data")
- certData := []byte("cert-data")
- keyData := []byte("key-data")
-
- config := clientcmdapi.NewConfig()
- config.Clusters["clean"] = &clientcmdapi.Cluster{
- Server: "https://localhost:8443",
- CertificateAuthorityData: caData,
- }
- config.AuthInfos["clean"] = &clientcmdapi.AuthInfo{
- ClientCertificateData: certData,
- ClientKeyData: keyData,
- }
- config.Contexts["clean"] = &clientcmdapi.Context{
- Cluster: "clean",
- AuthInfo: "clean",
- }
- config.CurrentContext = "clean"
-
- clientBuilder := NewNonInteractiveClientConfig(*config, "clean", &ConfigOverrides{}, nil)
-
- clientConfig, err := clientBuilder.ClientConfig()
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
-
- // Make sure cert data gets into config (will override file paths)
- matchByteArg(caData, clientConfig.TLSClientConfig.CAData, t)
- matchByteArg(certData, clientConfig.TLSClientConfig.CertData, t)
- matchByteArg(keyData, clientConfig.TLSClientConfig.KeyData, t)
-}
-
-func TestBasicAuthData(t *testing.T) {
- username := "myuser"
- password := "mypass"
-
- config := clientcmdapi.NewConfig()
- config.Clusters["clean"] = &clientcmdapi.Cluster{
- Server: "https://localhost:8443",
- }
- config.AuthInfos["clean"] = &clientcmdapi.AuthInfo{
- Username: username,
- Password: password,
- }
- config.Contexts["clean"] = &clientcmdapi.Context{
- Cluster: "clean",
- AuthInfo: "clean",
- }
- config.CurrentContext = "clean"
-
- clientBuilder := NewNonInteractiveClientConfig(*config, "clean", &ConfigOverrides{}, nil)
-
- clientConfig, err := clientBuilder.ClientConfig()
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
-
- // Make sure basic auth data gets into config
- matchStringArg(username, clientConfig.Username, t)
- matchStringArg(password, clientConfig.Password, t)
-}
-
-func TestBasicTokenFile(t *testing.T) {
- token := "exampletoken"
- f, err := ioutil.TempFile("", "tokenfile")
- if err != nil {
- t.Errorf("Unexpected error: %v", err)
- return
- }
- defer os.Remove(f.Name())
- if err := ioutil.WriteFile(f.Name(), []byte(token), 0644); err != nil {
- t.Errorf("Unexpected error: %v", err)
- return
- }
-
- config := clientcmdapi.NewConfig()
- config.Clusters["clean"] = &clientcmdapi.Cluster{
- Server: "https://localhost:8443",
- }
- config.AuthInfos["clean"] = &clientcmdapi.AuthInfo{
- TokenFile: f.Name(),
- }
- config.Contexts["clean"] = &clientcmdapi.Context{
- Cluster: "clean",
- AuthInfo: "clean",
- }
- config.CurrentContext = "clean"
-
- clientBuilder := NewNonInteractiveClientConfig(*config, "clean", &ConfigOverrides{}, nil)
-
- clientConfig, err := clientBuilder.ClientConfig()
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
-
- matchStringArg(token, clientConfig.BearerToken, t)
-}
-
-func TestPrecedenceTokenFile(t *testing.T) {
- token := "exampletoken"
- f, err := ioutil.TempFile("", "tokenfile")
- if err != nil {
- t.Errorf("Unexpected error: %v", err)
- return
- }
- defer os.Remove(f.Name())
- if err := ioutil.WriteFile(f.Name(), []byte(token), 0644); err != nil {
- t.Errorf("Unexpected error: %v", err)
- return
- }
-
- config := clientcmdapi.NewConfig()
- config.Clusters["clean"] = &clientcmdapi.Cluster{
- Server: "https://localhost:8443",
- }
- expectedToken := "expected"
- config.AuthInfos["clean"] = &clientcmdapi.AuthInfo{
- Token: expectedToken,
- TokenFile: f.Name(),
- }
- config.Contexts["clean"] = &clientcmdapi.Context{
- Cluster: "clean",
- AuthInfo: "clean",
- }
- config.CurrentContext = "clean"
-
- clientBuilder := NewNonInteractiveClientConfig(*config, "clean", &ConfigOverrides{}, nil)
-
- clientConfig, err := clientBuilder.ClientConfig()
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
-
- matchStringArg(expectedToken, clientConfig.BearerToken, t)
-}
-
-func TestCreateClean(t *testing.T) {
- config := createValidTestConfig()
- clientBuilder := NewNonInteractiveClientConfig(*config, "clean", &ConfigOverrides{}, nil)
-
- clientConfig, err := clientBuilder.ClientConfig()
- if err != nil {
- t.Errorf("Unexpected error: %v", err)
- }
-
- matchStringArg(config.Clusters["clean"].Server, clientConfig.Host, t)
- matchStringArg("", clientConfig.APIPath, t)
- matchBoolArg(config.Clusters["clean"].InsecureSkipTLSVerify, clientConfig.Insecure, t)
- matchStringArg(config.AuthInfos["clean"].Token, clientConfig.BearerToken, t)
-}
-
-func TestCreateCleanWithPrefix(t *testing.T) {
- tt := []struct {
- server string
- host string
- }{
- {"https://anything.com:8080/foo/bar", "https://anything.com:8080/foo/bar"},
- {"http://anything.com:8080/foo/bar", "http://anything.com:8080/foo/bar"},
- {"http://anything.com:8080/foo/bar/", "http://anything.com:8080/foo/bar/"},
- {"http://anything.com:8080/", "http://anything.com:8080/"},
- {"http://anything.com:8080//", "http://anything.com:8080//"},
- {"anything.com:8080/foo/bar", "anything.com:8080/foo/bar"},
- {"anything.com:8080", "anything.com:8080"},
- {"anything.com", "anything.com"},
- {"anything", "anything"},
- }
-
- tt = append(tt, struct{ server, host string }{"", "http://localhost:8080"})
-
- for _, tc := range tt {
- config := createValidTestConfig()
-
- cleanConfig := config.Clusters["clean"]
- cleanConfig.Server = tc.server
- config.Clusters["clean"] = cleanConfig
-
- clientBuilder := NewNonInteractiveClientConfig(*config, "clean", &ConfigOverrides{
- ClusterDefaults: clientcmdapi.Cluster{Server: "http://localhost:8080"},
- }, nil)
-
- clientConfig, err := clientBuilder.ClientConfig()
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
-
- matchStringArg(tc.host, clientConfig.Host, t)
- }
-}
-
-func TestCreateCleanDefault(t *testing.T) {
- config := createValidTestConfig()
- clientBuilder := NewDefaultClientConfig(*config, &ConfigOverrides{})
-
- clientConfig, err := clientBuilder.ClientConfig()
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
-
- matchStringArg(config.Clusters["clean"].Server, clientConfig.Host, t)
- matchBoolArg(config.Clusters["clean"].InsecureSkipTLSVerify, clientConfig.Insecure, t)
- matchStringArg(config.AuthInfos["clean"].Token, clientConfig.BearerToken, t)
-}
-
-func TestCreateCleanDefaultCluster(t *testing.T) {
- config := createValidTestConfig()
- clientBuilder := NewDefaultClientConfig(*config, &ConfigOverrides{
- ClusterDefaults: clientcmdapi.Cluster{Server: "http://localhost:8080"},
- })
-
- clientConfig, err := clientBuilder.ClientConfig()
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
-
- matchStringArg(config.Clusters["clean"].Server, clientConfig.Host, t)
- matchBoolArg(config.Clusters["clean"].InsecureSkipTLSVerify, clientConfig.Insecure, t)
- matchStringArg(config.AuthInfos["clean"].Token, clientConfig.BearerToken, t)
-}
-
-func TestCreateMissingContextNoDefault(t *testing.T) {
- const expectedErrorContains = "Context was not found for specified context"
- config := createValidTestConfig()
- clientBuilder := NewNonInteractiveClientConfig(*config, "not-present", &ConfigOverrides{}, nil)
-
- _, err := clientBuilder.ClientConfig()
- if err == nil {
- t.Fatalf("Unexpected error: %v", err)
- }
-}
-
-func TestCreateMissingContext(t *testing.T) {
- const expectedErrorContains = "context was not found for specified context: not-present"
- config := createValidTestConfig()
- clientBuilder := NewNonInteractiveClientConfig(*config, "not-present", &ConfigOverrides{
- ClusterDefaults: clientcmdapi.Cluster{Server: "http://localhost:8080"},
- }, nil)
-
- _, err := clientBuilder.ClientConfig()
- if err == nil {
- t.Fatalf("Expected error: %v", expectedErrorContains)
- }
- if !strings.Contains(err.Error(), expectedErrorContains) {
- t.Fatalf("Expected error: %v, but got %v", expectedErrorContains, err)
- }
-}
-
-func TestInClusterClientConfigPrecedence(t *testing.T) {
- tt := []struct {
- overrides *ConfigOverrides
- }{
- {
- overrides: &ConfigOverrides{
- ClusterInfo: clientcmdapi.Cluster{
- Server: "https://host-from-overrides.com",
- },
- },
- },
- {
- overrides: &ConfigOverrides{
- AuthInfo: clientcmdapi.AuthInfo{
- Token: "https://host-from-overrides.com",
- },
- },
- },
- {
- overrides: &ConfigOverrides{
- ClusterInfo: clientcmdapi.Cluster{
- CertificateAuthority: "/path/to/ca-from-overrides.crt",
- },
- },
- },
- {
- overrides: &ConfigOverrides{
- ClusterInfo: clientcmdapi.Cluster{
- Server: "https://host-from-overrides.com",
- },
- AuthInfo: clientcmdapi.AuthInfo{
- Token: "https://host-from-overrides.com",
- },
- },
- },
- {
- overrides: &ConfigOverrides{
- ClusterInfo: clientcmdapi.Cluster{
- Server: "https://host-from-overrides.com",
- CertificateAuthority: "/path/to/ca-from-overrides.crt",
- },
- },
- },
- {
- overrides: &ConfigOverrides{
- ClusterInfo: clientcmdapi.Cluster{
- CertificateAuthority: "/path/to/ca-from-overrides.crt",
- },
- AuthInfo: clientcmdapi.AuthInfo{
- Token: "https://host-from-overrides.com",
- },
- },
- },
- {
- overrides: &ConfigOverrides{
- ClusterInfo: clientcmdapi.Cluster{
- Server: "https://host-from-overrides.com",
- CertificateAuthority: "/path/to/ca-from-overrides.crt",
- },
- AuthInfo: clientcmdapi.AuthInfo{
- Token: "https://host-from-overrides.com",
- },
- },
- },
- {
- overrides: &ConfigOverrides{},
- },
- }
-
- for _, tc := range tt {
- expectedServer := "https://host-from-cluster.com"
- expectedToken := "token-from-cluster"
- expectedCAFile := "/path/to/ca-from-cluster.crt"
-
- icc := &inClusterClientConfig{
- inClusterConfigProvider: func() (*restclient.Config, error) {
- return &restclient.Config{
- Host: expectedServer,
- BearerToken: expectedToken,
- TLSClientConfig: restclient.TLSClientConfig{
- CAFile: expectedCAFile,
- },
- }, nil
- },
- overrides: tc.overrides,
- }
-
- clientConfig, err := icc.ClientConfig()
- if err != nil {
- t.Fatalf("Unxpected error: %v", err)
- }
-
- if overridenServer := tc.overrides.ClusterInfo.Server; len(overridenServer) > 0 {
- expectedServer = overridenServer
- }
- if overridenToken := tc.overrides.AuthInfo.Token; len(overridenToken) > 0 {
- expectedToken = overridenToken
- }
- if overridenCAFile := tc.overrides.ClusterInfo.CertificateAuthority; len(overridenCAFile) > 0 {
- expectedCAFile = overridenCAFile
- }
-
- if clientConfig.Host != expectedServer {
- t.Errorf("Expected server %v, got %v", expectedServer, clientConfig.Host)
- }
- if clientConfig.BearerToken != expectedToken {
- t.Errorf("Expected token %v, got %v", expectedToken, clientConfig.BearerToken)
- }
- if clientConfig.TLSClientConfig.CAFile != expectedCAFile {
- t.Errorf("Expected Certificate Authority %v, got %v", expectedCAFile, clientConfig.TLSClientConfig.CAFile)
- }
- }
-}
-
-func matchBoolArg(expected, got bool, t *testing.T) {
- if expected != got {
- t.Errorf("Expected %v, got %v", expected, got)
- }
-}
-
-func matchStringArg(expected, got string, t *testing.T) {
- if expected != got {
- t.Errorf("Expected %q, got %q", expected, got)
- }
-}
-
-func matchByteArg(expected, got []byte, t *testing.T) {
- if !reflect.DeepEqual(expected, got) {
- t.Errorf("Expected %v, got %v", expected, got)
- }
-}
-
-func TestNamespaceOverride(t *testing.T) {
- config := &DirectClientConfig{
- overrides: &ConfigOverrides{
- Context: clientcmdapi.Context{
- Namespace: "foo",
- },
- },
- }
-
- ns, overridden, err := config.Namespace()
-
- if err != nil {
- t.Errorf("Unexpected error: %v", err)
- }
-
- if !overridden {
- t.Errorf("Expected overridden = true")
- }
-
- matchStringArg("foo", ns, t)
-}
diff --git a/vendor/k8s.io/client-go/tools/clientcmd/loader_test.go b/vendor/k8s.io/client-go/tools/clientcmd/loader_test.go
deleted file mode 100644
index 86eccac45..000000000
--- a/vendor/k8s.io/client-go/tools/clientcmd/loader_test.go
+++ /dev/null
@@ -1,789 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package clientcmd
-
-import (
- "fmt"
- "io/ioutil"
- "os"
- "path"
- "path/filepath"
- "reflect"
- "strings"
- "testing"
-
- "github.com/ghodss/yaml"
-
- "k8s.io/apimachinery/pkg/runtime"
- clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
- clientcmdlatest "k8s.io/client-go/tools/clientcmd/api/latest"
-)
-
-var (
- testConfigAlfa = clientcmdapi.Config{
- AuthInfos: map[string]*clientcmdapi.AuthInfo{
- "red-user": {Token: "red-token"}},
- Clusters: map[string]*clientcmdapi.Cluster{
- "cow-cluster": {Server: "http://cow.org:8080"}},
- Contexts: map[string]*clientcmdapi.Context{
- "federal-context": {AuthInfo: "red-user", Cluster: "cow-cluster", Namespace: "hammer-ns"}},
- }
- testConfigBravo = clientcmdapi.Config{
- AuthInfos: map[string]*clientcmdapi.AuthInfo{
- "black-user": {Token: "black-token"}},
- Clusters: map[string]*clientcmdapi.Cluster{
- "pig-cluster": {Server: "http://pig.org:8080"}},
- Contexts: map[string]*clientcmdapi.Context{
- "queen-anne-context": {AuthInfo: "black-user", Cluster: "pig-cluster", Namespace: "saw-ns"}},
- }
- testConfigCharlie = clientcmdapi.Config{
- AuthInfos: map[string]*clientcmdapi.AuthInfo{
- "green-user": {Token: "green-token"}},
- Clusters: map[string]*clientcmdapi.Cluster{
- "horse-cluster": {Server: "http://horse.org:8080"}},
- Contexts: map[string]*clientcmdapi.Context{
- "shaker-context": {AuthInfo: "green-user", Cluster: "horse-cluster", Namespace: "chisel-ns"}},
- }
- testConfigDelta = clientcmdapi.Config{
- AuthInfos: map[string]*clientcmdapi.AuthInfo{
- "blue-user": {Token: "blue-token"}},
- Clusters: map[string]*clientcmdapi.Cluster{
- "chicken-cluster": {Server: "http://chicken.org:8080"}},
- Contexts: map[string]*clientcmdapi.Context{
- "gothic-context": {AuthInfo: "blue-user", Cluster: "chicken-cluster", Namespace: "plane-ns"}},
- }
-
- testConfigConflictAlfa = clientcmdapi.Config{
- AuthInfos: map[string]*clientcmdapi.AuthInfo{
- "red-user": {Token: "a-different-red-token"},
- "yellow-user": {Token: "yellow-token"}},
- Clusters: map[string]*clientcmdapi.Cluster{
- "cow-cluster": {Server: "http://a-different-cow.org:8080", InsecureSkipTLSVerify: true},
- "donkey-cluster": {Server: "http://donkey.org:8080", InsecureSkipTLSVerify: true}},
- CurrentContext: "federal-context",
- }
-)
-
-func TestNonExistentCommandLineFile(t *testing.T) {
- loadingRules := ClientConfigLoadingRules{
- ExplicitPath: "bogus_file",
- }
-
- _, err := loadingRules.Load()
- if err == nil {
- t.Fatalf("Expected error for missing command-line file, got none")
- }
- if !strings.Contains(err.Error(), "bogus_file") {
- t.Fatalf("Expected error about 'bogus_file', got %s", err.Error())
- }
-}
-
-func TestToleratingMissingFiles(t *testing.T) {
- loadingRules := ClientConfigLoadingRules{
- Precedence: []string{"bogus1", "bogus2", "bogus3"},
- }
-
- _, err := loadingRules.Load()
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
-}
-
-func TestErrorReadingFile(t *testing.T) {
- commandLineFile, _ := ioutil.TempFile("", "")
- defer os.Remove(commandLineFile.Name())
-
- if err := ioutil.WriteFile(commandLineFile.Name(), []byte("bogus value"), 0644); err != nil {
- t.Fatalf("Error creating tempfile: %v", err)
- }
-
- loadingRules := ClientConfigLoadingRules{
- ExplicitPath: commandLineFile.Name(),
- }
-
- _, err := loadingRules.Load()
- if err == nil {
- t.Fatalf("Expected error for unloadable file, got none")
- }
- if !strings.Contains(err.Error(), commandLineFile.Name()) {
- t.Fatalf("Expected error about '%s', got %s", commandLineFile.Name(), err.Error())
- }
-}
-
-func TestErrorReadingNonFile(t *testing.T) {
- tmpdir, err := ioutil.TempDir("", "")
- if err != nil {
- t.Fatalf("Couldn't create tmpdir")
- }
- defer os.RemoveAll(tmpdir)
-
- loadingRules := ClientConfigLoadingRules{
- ExplicitPath: tmpdir,
- }
-
- _, err = loadingRules.Load()
- if err == nil {
- t.Fatalf("Expected error for non-file, got none")
- }
- if !strings.Contains(err.Error(), tmpdir) {
- t.Fatalf("Expected error about '%s', got %s", tmpdir, err.Error())
- }
-}
-
-func TestConflictingCurrentContext(t *testing.T) {
- commandLineFile, _ := ioutil.TempFile("", "")
- defer os.Remove(commandLineFile.Name())
- envVarFile, _ := ioutil.TempFile("", "")
- defer os.Remove(envVarFile.Name())
-
- mockCommandLineConfig := clientcmdapi.Config{
- CurrentContext: "any-context-value",
- }
- mockEnvVarConfig := clientcmdapi.Config{
- CurrentContext: "a-different-context",
- }
-
- WriteToFile(mockCommandLineConfig, commandLineFile.Name())
- WriteToFile(mockEnvVarConfig, envVarFile.Name())
-
- loadingRules := ClientConfigLoadingRules{
- ExplicitPath: commandLineFile.Name(),
- Precedence: []string{envVarFile.Name()},
- }
-
- mergedConfig, err := loadingRules.Load()
- if err != nil {
- t.Errorf("Unexpected error: %v", err)
- }
-
- if mergedConfig.CurrentContext != mockCommandLineConfig.CurrentContext {
- t.Errorf("expected %v, got %v", mockCommandLineConfig.CurrentContext, mergedConfig.CurrentContext)
- }
-}
-
-func TestLoadingEmptyMaps(t *testing.T) {
- configFile, _ := ioutil.TempFile("", "")
- defer os.Remove(configFile.Name())
-
- mockConfig := clientcmdapi.Config{
- CurrentContext: "any-context-value",
- }
-
- WriteToFile(mockConfig, configFile.Name())
-
- config, err := LoadFromFile(configFile.Name())
- if err != nil {
- t.Errorf("Unexpected error: %v", err)
- }
-
- if config.Clusters == nil {
- t.Error("expected config.Clusters to be non-nil")
- }
- if config.AuthInfos == nil {
- t.Error("expected config.AuthInfos to be non-nil")
- }
- if config.Contexts == nil {
- t.Error("expected config.Contexts to be non-nil")
- }
-}
-
-func TestDuplicateClusterName(t *testing.T) {
- configFile, _ := ioutil.TempFile("", "")
- defer os.Remove(configFile.Name())
-
- err := ioutil.WriteFile(configFile.Name(), []byte(`
-kind: Config
-apiVersion: v1
-clusters:
-- cluster:
- api-version: v1
- server: https://kubernetes.default.svc:443
- certificate-authority: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
- name: kubeconfig-cluster
-- cluster:
- api-version: v2
- server: https://test.example.server:443
- certificate-authority: /var/run/secrets/test.example.io/serviceaccount/ca.crt
- name: kubeconfig-cluster
-contexts:
-- context:
- cluster: kubeconfig-cluster
- namespace: default
- user: kubeconfig-user
- name: kubeconfig-context
-current-context: kubeconfig-context
-users:
-- name: kubeconfig-user
- user:
- tokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
-`), os.FileMode(0755))
-
- if err != nil {
- t.Errorf("Unexpected error: %v", err)
- }
-
- _, err = LoadFromFile(configFile.Name())
- if err == nil || !strings.Contains(err.Error(),
- "error converting *[]NamedCluster into *map[string]*api.Cluster: duplicate name \"kubeconfig-cluster\" in list") {
- t.Error("Expected error in loading duplicate cluster name, got none")
- }
-}
-
-func TestDuplicateContextName(t *testing.T) {
- configFile, _ := ioutil.TempFile("", "")
- defer os.Remove(configFile.Name())
-
- err := ioutil.WriteFile(configFile.Name(), []byte(`
-kind: Config
-apiVersion: v1
-clusters:
-- cluster:
- api-version: v1
- server: https://kubernetes.default.svc:443
- certificate-authority: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
- name: kubeconfig-cluster
-contexts:
-- context:
- cluster: kubeconfig-cluster
- namespace: default
- user: kubeconfig-user
- name: kubeconfig-context
-- context:
- cluster: test-example-cluster
- namespace: test-example
- user: test-example-user
- name: kubeconfig-context
-current-context: kubeconfig-context
-users:
-- name: kubeconfig-user
- user:
- tokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
-`), os.FileMode(0755))
-
- if err != nil {
- t.Errorf("Unexpected error: %v", err)
- }
-
- _, err = LoadFromFile(configFile.Name())
- if err == nil || !strings.Contains(err.Error(),
- "error converting *[]NamedContext into *map[string]*api.Context: duplicate name \"kubeconfig-context\" in list") {
- t.Error("Expected error in loading duplicate context name, got none")
- }
-}
-
-func TestDuplicateUserName(t *testing.T) {
- configFile, _ := ioutil.TempFile("", "")
- defer os.Remove(configFile.Name())
-
- err := ioutil.WriteFile(configFile.Name(), []byte(`
-kind: Config
-apiVersion: v1
-clusters:
-- cluster:
- api-version: v1
- server: https://kubernetes.default.svc:443
- certificate-authority: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
- name: kubeconfig-cluster
-contexts:
-- context:
- cluster: kubeconfig-cluster
- namespace: default
- user: kubeconfig-user
- name: kubeconfig-context
-current-context: kubeconfig-context
-users:
-- name: kubeconfig-user
- user:
- tokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
-- name: kubeconfig-user
- user:
- tokenFile: /var/run/secrets/test.example.com/serviceaccount/token
-`), os.FileMode(0755))
-
- if err != nil {
- t.Errorf("Unexpected error: %v", err)
- }
-
- _, err = LoadFromFile(configFile.Name())
- if err == nil || !strings.Contains(err.Error(),
- "error converting *[]NamedAuthInfo into *map[string]*api.AuthInfo: duplicate name \"kubeconfig-user\" in list") {
- t.Error("Expected error in loading duplicate user name, got none")
- }
-}
-
-func TestDuplicateExtensionName(t *testing.T) {
- configFile, _ := ioutil.TempFile("", "")
- defer os.Remove(configFile.Name())
-
- err := ioutil.WriteFile(configFile.Name(), []byte(`
-kind: Config
-apiVersion: v1
-clusters:
-- cluster:
- api-version: v1
- server: https://kubernetes.default.svc:443
- certificate-authority: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
- name: kubeconfig-cluster
-contexts:
-- context:
- cluster: kubeconfig-cluster
- namespace: default
- user: kubeconfig-user
- name: kubeconfig-context
-current-context: kubeconfig-context
-users:
-- name: kubeconfig-user
- user:
- tokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
-extensions:
-- extension:
- bytes: test
- name: test-extension
-- extension:
- bytes: some-example
- name: test-extension
-`), os.FileMode(0755))
-
- if err != nil {
- t.Errorf("Unexpected error: %v", err)
- }
-
- _, err = LoadFromFile(configFile.Name())
- if err == nil || !strings.Contains(err.Error(),
- "error converting *[]NamedExtension into *map[string]runtime.Object: duplicate name \"test-extension\" in list") {
- t.Error("Expected error in loading duplicate extension name, got none")
- }
-}
-
-func TestResolveRelativePaths(t *testing.T) {
- pathResolutionConfig1 := clientcmdapi.Config{
- AuthInfos: map[string]*clientcmdapi.AuthInfo{
- "relative-user-1": {ClientCertificate: "relative/client/cert", ClientKey: "../relative/client/key"},
- "absolute-user-1": {ClientCertificate: "/absolute/client/cert", ClientKey: "/absolute/client/key"},
- "relative-cmd-1": {Exec: &clientcmdapi.ExecConfig{Command: "../relative/client/cmd"}},
- "absolute-cmd-1": {Exec: &clientcmdapi.ExecConfig{Command: "/absolute/client/cmd"}},
- "PATH-cmd-1": {Exec: &clientcmdapi.ExecConfig{Command: "cmd"}},
- },
- Clusters: map[string]*clientcmdapi.Cluster{
- "relative-server-1": {CertificateAuthority: "../relative/ca"},
- "absolute-server-1": {CertificateAuthority: "/absolute/ca"},
- },
- }
- pathResolutionConfig2 := clientcmdapi.Config{
- AuthInfos: map[string]*clientcmdapi.AuthInfo{
- "relative-user-2": {ClientCertificate: "relative/client/cert2", ClientKey: "../relative/client/key2"},
- "absolute-user-2": {ClientCertificate: "/absolute/client/cert2", ClientKey: "/absolute/client/key2"},
- },
- Clusters: map[string]*clientcmdapi.Cluster{
- "relative-server-2": {CertificateAuthority: "../relative/ca2"},
- "absolute-server-2": {CertificateAuthority: "/absolute/ca2"},
- },
- }
-
- configDir1, _ := ioutil.TempDir("", "")
- defer os.RemoveAll(configDir1)
- configFile1 := path.Join(configDir1, ".kubeconfig")
- configDir1, _ = filepath.Abs(configDir1)
-
- configDir2, _ := ioutil.TempDir("", "")
- defer os.RemoveAll(configDir2)
- configDir2, _ = ioutil.TempDir(configDir2, "")
- configFile2 := path.Join(configDir2, ".kubeconfig")
- configDir2, _ = filepath.Abs(configDir2)
-
- WriteToFile(pathResolutionConfig1, configFile1)
- WriteToFile(pathResolutionConfig2, configFile2)
-
- loadingRules := ClientConfigLoadingRules{
- Precedence: []string{configFile1, configFile2},
- }
-
- mergedConfig, err := loadingRules.Load()
- if err != nil {
- t.Errorf("Unexpected error: %v", err)
- }
-
- foundClusterCount := 0
- for key, cluster := range mergedConfig.Clusters {
- if key == "relative-server-1" {
- foundClusterCount++
- matchStringArg(path.Join(configDir1, pathResolutionConfig1.Clusters["relative-server-1"].CertificateAuthority), cluster.CertificateAuthority, t)
- }
- if key == "relative-server-2" {
- foundClusterCount++
- matchStringArg(path.Join(configDir2, pathResolutionConfig2.Clusters["relative-server-2"].CertificateAuthority), cluster.CertificateAuthority, t)
- }
- if key == "absolute-server-1" {
- foundClusterCount++
- matchStringArg(pathResolutionConfig1.Clusters["absolute-server-1"].CertificateAuthority, cluster.CertificateAuthority, t)
- }
- if key == "absolute-server-2" {
- foundClusterCount++
- matchStringArg(pathResolutionConfig2.Clusters["absolute-server-2"].CertificateAuthority, cluster.CertificateAuthority, t)
- }
- }
- if foundClusterCount != 4 {
- t.Errorf("Expected 4 clusters, found %v: %v", foundClusterCount, mergedConfig.Clusters)
- }
-
- foundAuthInfoCount := 0
- for key, authInfo := range mergedConfig.AuthInfos {
- if key == "relative-user-1" {
- foundAuthInfoCount++
- matchStringArg(path.Join(configDir1, pathResolutionConfig1.AuthInfos["relative-user-1"].ClientCertificate), authInfo.ClientCertificate, t)
- matchStringArg(path.Join(configDir1, pathResolutionConfig1.AuthInfos["relative-user-1"].ClientKey), authInfo.ClientKey, t)
- }
- if key == "relative-user-2" {
- foundAuthInfoCount++
- matchStringArg(path.Join(configDir2, pathResolutionConfig2.AuthInfos["relative-user-2"].ClientCertificate), authInfo.ClientCertificate, t)
- matchStringArg(path.Join(configDir2, pathResolutionConfig2.AuthInfos["relative-user-2"].ClientKey), authInfo.ClientKey, t)
- }
- if key == "absolute-user-1" {
- foundAuthInfoCount++
- matchStringArg(pathResolutionConfig1.AuthInfos["absolute-user-1"].ClientCertificate, authInfo.ClientCertificate, t)
- matchStringArg(pathResolutionConfig1.AuthInfos["absolute-user-1"].ClientKey, authInfo.ClientKey, t)
- }
- if key == "absolute-user-2" {
- foundAuthInfoCount++
- matchStringArg(pathResolutionConfig2.AuthInfos["absolute-user-2"].ClientCertificate, authInfo.ClientCertificate, t)
- matchStringArg(pathResolutionConfig2.AuthInfos["absolute-user-2"].ClientKey, authInfo.ClientKey, t)
- }
- if key == "relative-cmd-1" {
- foundAuthInfoCount++
- matchStringArg(path.Join(configDir1, pathResolutionConfig1.AuthInfos[key].Exec.Command), authInfo.Exec.Command, t)
- }
- if key == "absolute-cmd-1" {
- foundAuthInfoCount++
- matchStringArg(pathResolutionConfig1.AuthInfos[key].Exec.Command, authInfo.Exec.Command, t)
- }
- if key == "PATH-cmd-1" {
- foundAuthInfoCount++
- matchStringArg(pathResolutionConfig1.AuthInfos[key].Exec.Command, authInfo.Exec.Command, t)
- }
- }
- if foundAuthInfoCount != 7 {
- t.Errorf("Expected 7 users, found %v: %v", foundAuthInfoCount, mergedConfig.AuthInfos)
- }
-
-}
-
-func TestMigratingFile(t *testing.T) {
- sourceFile, _ := ioutil.TempFile("", "")
- defer os.Remove(sourceFile.Name())
- destinationFile, _ := ioutil.TempFile("", "")
- // delete the file so that we'll write to it
- os.Remove(destinationFile.Name())
-
- WriteToFile(testConfigAlfa, sourceFile.Name())
-
- loadingRules := ClientConfigLoadingRules{
- MigrationRules: map[string]string{destinationFile.Name(): sourceFile.Name()},
- }
-
- if _, err := loadingRules.Load(); err != nil {
- t.Errorf("unexpected error %v", err)
- }
-
- // the load should have recreated this file
- defer os.Remove(destinationFile.Name())
-
- sourceContent, err := ioutil.ReadFile(sourceFile.Name())
- if err != nil {
- t.Errorf("unexpected error %v", err)
- }
- destinationContent, err := ioutil.ReadFile(destinationFile.Name())
- if err != nil {
- t.Errorf("unexpected error %v", err)
- }
-
- if !reflect.DeepEqual(sourceContent, destinationContent) {
- t.Errorf("source and destination do not match")
- }
-}
-
-func TestMigratingFileLeaveExistingFileAlone(t *testing.T) {
- sourceFile, _ := ioutil.TempFile("", "")
- defer os.Remove(sourceFile.Name())
- destinationFile, _ := ioutil.TempFile("", "")
- defer os.Remove(destinationFile.Name())
-
- WriteToFile(testConfigAlfa, sourceFile.Name())
-
- loadingRules := ClientConfigLoadingRules{
- MigrationRules: map[string]string{destinationFile.Name(): sourceFile.Name()},
- }
-
- if _, err := loadingRules.Load(); err != nil {
- t.Errorf("unexpected error %v", err)
- }
-
- destinationContent, err := ioutil.ReadFile(destinationFile.Name())
- if err != nil {
- t.Errorf("unexpected error %v", err)
- }
-
- if len(destinationContent) > 0 {
- t.Errorf("destination should not have been touched")
- }
-}
-
-func TestMigratingFileSourceMissingSkip(t *testing.T) {
- sourceFilename := "some-missing-file"
- destinationFile, _ := ioutil.TempFile("", "")
- // delete the file so that we'll write to it
- os.Remove(destinationFile.Name())
-
- loadingRules := ClientConfigLoadingRules{
- MigrationRules: map[string]string{destinationFile.Name(): sourceFilename},
- }
-
- if _, err := loadingRules.Load(); err != nil {
- t.Errorf("unexpected error %v", err)
- }
-
- if _, err := os.Stat(destinationFile.Name()); !os.IsNotExist(err) {
- t.Errorf("destination should not exist")
- }
-}
-
-func TestFileLocking(t *testing.T) {
- f, _ := ioutil.TempFile("", "")
- defer os.Remove(f.Name())
-
- err := lockFile(f.Name())
- if err != nil {
- t.Errorf("unexpected error while locking file: %v", err)
- }
- defer unlockFile(f.Name())
-
- err = lockFile(f.Name())
- if err == nil {
- t.Error("expected error while locking file.")
- }
-}
-
-func Example_noMergingOnExplicitPaths() {
- commandLineFile, _ := ioutil.TempFile("", "")
- defer os.Remove(commandLineFile.Name())
- envVarFile, _ := ioutil.TempFile("", "")
- defer os.Remove(envVarFile.Name())
-
- WriteToFile(testConfigAlfa, commandLineFile.Name())
- WriteToFile(testConfigConflictAlfa, envVarFile.Name())
-
- loadingRules := ClientConfigLoadingRules{
- ExplicitPath: commandLineFile.Name(),
- Precedence: []string{envVarFile.Name()},
- }
-
- mergedConfig, err := loadingRules.Load()
-
- json, err := runtime.Encode(clientcmdlatest.Codec, mergedConfig)
- if err != nil {
- fmt.Printf("Unexpected error: %v", err)
- }
- output, err := yaml.JSONToYAML(json)
- if err != nil {
- fmt.Printf("Unexpected error: %v", err)
- }
-
- fmt.Printf("%v", string(output))
- // Output:
- // apiVersion: v1
- // clusters:
- // - cluster:
- // server: http://cow.org:8080
- // name: cow-cluster
- // contexts:
- // - context:
- // cluster: cow-cluster
- // namespace: hammer-ns
- // user: red-user
- // name: federal-context
- // current-context: ""
- // kind: Config
- // preferences: {}
- // users:
- // - name: red-user
- // user:
- // token: red-token
-}
-
-func Example_mergingSomeWithConflict() {
- commandLineFile, _ := ioutil.TempFile("", "")
- defer os.Remove(commandLineFile.Name())
- envVarFile, _ := ioutil.TempFile("", "")
- defer os.Remove(envVarFile.Name())
-
- WriteToFile(testConfigAlfa, commandLineFile.Name())
- WriteToFile(testConfigConflictAlfa, envVarFile.Name())
-
- loadingRules := ClientConfigLoadingRules{
- Precedence: []string{commandLineFile.Name(), envVarFile.Name()},
- }
-
- mergedConfig, err := loadingRules.Load()
-
- json, err := runtime.Encode(clientcmdlatest.Codec, mergedConfig)
- if err != nil {
- fmt.Printf("Unexpected error: %v", err)
- }
- output, err := yaml.JSONToYAML(json)
- if err != nil {
- fmt.Printf("Unexpected error: %v", err)
- }
-
- fmt.Printf("%v", string(output))
- // Output:
- // apiVersion: v1
- // clusters:
- // - cluster:
- // server: http://cow.org:8080
- // name: cow-cluster
- // - cluster:
- // insecure-skip-tls-verify: true
- // server: http://donkey.org:8080
- // name: donkey-cluster
- // contexts:
- // - context:
- // cluster: cow-cluster
- // namespace: hammer-ns
- // user: red-user
- // name: federal-context
- // current-context: federal-context
- // kind: Config
- // preferences: {}
- // users:
- // - name: red-user
- // user:
- // token: red-token
- // - name: yellow-user
- // user:
- // token: yellow-token
-}
-
-func Example_mergingEverythingNoConflicts() {
- commandLineFile, _ := ioutil.TempFile("", "")
- defer os.Remove(commandLineFile.Name())
- envVarFile, _ := ioutil.TempFile("", "")
- defer os.Remove(envVarFile.Name())
- currentDirFile, _ := ioutil.TempFile("", "")
- defer os.Remove(currentDirFile.Name())
- homeDirFile, _ := ioutil.TempFile("", "")
- defer os.Remove(homeDirFile.Name())
-
- WriteToFile(testConfigAlfa, commandLineFile.Name())
- WriteToFile(testConfigBravo, envVarFile.Name())
- WriteToFile(testConfigCharlie, currentDirFile.Name())
- WriteToFile(testConfigDelta, homeDirFile.Name())
-
- loadingRules := ClientConfigLoadingRules{
- Precedence: []string{commandLineFile.Name(), envVarFile.Name(), currentDirFile.Name(), homeDirFile.Name()},
- }
-
- mergedConfig, err := loadingRules.Load()
-
- json, err := runtime.Encode(clientcmdlatest.Codec, mergedConfig)
- if err != nil {
- fmt.Printf("Unexpected error: %v", err)
- }
- output, err := yaml.JSONToYAML(json)
- if err != nil {
- fmt.Printf("Unexpected error: %v", err)
- }
-
- fmt.Printf("%v", string(output))
- // Output:
- // apiVersion: v1
- // clusters:
- // - cluster:
- // server: http://chicken.org:8080
- // name: chicken-cluster
- // - cluster:
- // server: http://cow.org:8080
- // name: cow-cluster
- // - cluster:
- // server: http://horse.org:8080
- // name: horse-cluster
- // - cluster:
- // server: http://pig.org:8080
- // name: pig-cluster
- // contexts:
- // - context:
- // cluster: cow-cluster
- // namespace: hammer-ns
- // user: red-user
- // name: federal-context
- // - context:
- // cluster: chicken-cluster
- // namespace: plane-ns
- // user: blue-user
- // name: gothic-context
- // - context:
- // cluster: pig-cluster
- // namespace: saw-ns
- // user: black-user
- // name: queen-anne-context
- // - context:
- // cluster: horse-cluster
- // namespace: chisel-ns
- // user: green-user
- // name: shaker-context
- // current-context: ""
- // kind: Config
- // preferences: {}
- // users:
- // - name: black-user
- // user:
- // token: black-token
- // - name: blue-user
- // user:
- // token: blue-token
- // - name: green-user
- // user:
- // token: green-token
- // - name: red-user
- // user:
- // token: red-token
-}
-
-func TestDeduplicate(t *testing.T) {
- testCases := []struct {
- src []string
- expect []string
- }{
- {
- src: []string{"a", "b", "c", "d", "e", "f"},
- expect: []string{"a", "b", "c", "d", "e", "f"},
- },
- {
- src: []string{"a", "b", "c", "b", "e", "f"},
- expect: []string{"a", "b", "c", "e", "f"},
- },
- {
- src: []string{"a", "a", "b", "b", "c", "b"},
- expect: []string{"a", "b", "c"},
- },
- }
-
- for _, testCase := range testCases {
- get := deduplicate(testCase.src)
- if !reflect.DeepEqual(get, testCase.expect) {
- t.Errorf("expect: %v, get: %v", testCase.expect, get)
- }
- }
-}
diff --git a/vendor/k8s.io/client-go/tools/clientcmd/merged_client_builder_test.go b/vendor/k8s.io/client-go/tools/clientcmd/merged_client_builder_test.go
deleted file mode 100644
index 8b0386764..000000000
--- a/vendor/k8s.io/client-go/tools/clientcmd/merged_client_builder_test.go
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package clientcmd
-
-import (
- "fmt"
- "testing"
-
- restclient "k8s.io/client-go/rest"
- clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
-)
-
-type testLoader struct {
- ClientConfigLoader
-
- called bool
- config *clientcmdapi.Config
- err error
-}
-
-func (l *testLoader) Load() (*clientcmdapi.Config, error) {
- l.called = true
- return l.config, l.err
-}
-
-type testClientConfig struct {
- config *restclient.Config
- namespace string
- namespaceSpecified bool
- err error
-}
-
-func (c *testClientConfig) RawConfig() (clientcmdapi.Config, error) {
- return clientcmdapi.Config{}, fmt.Errorf("unexpected call")
-}
-func (c *testClientConfig) ClientConfig() (*restclient.Config, error) {
- return c.config, c.err
-}
-func (c *testClientConfig) Namespace() (string, bool, error) {
- return c.namespace, c.namespaceSpecified, c.err
-}
-func (c *testClientConfig) ConfigAccess() ConfigAccess {
- return nil
-}
-
-type testICC struct {
- testClientConfig
-
- possible bool
- called bool
-}
-
-func (icc *testICC) Possible() bool {
- icc.called = true
- return icc.possible
-}
-
-func TestInClusterConfig(t *testing.T) {
- default1 := &DirectClientConfig{
- config: *createValidTestConfig(),
- contextName: "clean",
- overrides: &ConfigOverrides{},
- }
- invalidDefaultConfig := clientcmdapi.NewConfig()
- invalidDefaultConfig.Clusters["clean"] = &clientcmdapi.Cluster{
- Server: "http://localhost:8080",
- }
- invalidDefaultConfig.Contexts["other"] = &clientcmdapi.Context{
- Cluster: "clean",
- }
- invalidDefaultConfig.CurrentContext = "clean"
-
- defaultInvalid := &DirectClientConfig{
- config: *invalidDefaultConfig,
- overrides: &ConfigOverrides{},
- }
- if _, err := defaultInvalid.ClientConfig(); err == nil || !IsConfigurationInvalid(err) {
- t.Fatal(err)
- }
- config1, err := default1.ClientConfig()
- if err != nil {
- t.Fatal(err)
- }
- config2 := &restclient.Config{Host: "config2"}
- err1 := fmt.Errorf("unique error")
-
- testCases := map[string]struct {
- clientConfig *testClientConfig
- icc *testICC
- defaultConfig *DirectClientConfig
-
- checkedICC bool
- result *restclient.Config
- err error
- }{
- "in-cluster checked on other error": {
- clientConfig: &testClientConfig{err: ErrEmptyConfig},
- icc: &testICC{},
-
- checkedICC: true,
- result: nil,
- err: ErrEmptyConfig,
- },
-
- "in-cluster not checked on non-empty error": {
- clientConfig: &testClientConfig{err: ErrEmptyCluster},
- icc: &testICC{},
-
- checkedICC: false,
- result: nil,
- err: ErrEmptyCluster,
- },
-
- "in-cluster checked when config is default": {
- defaultConfig: default1,
- clientConfig: &testClientConfig{config: config1},
- icc: &testICC{},
-
- checkedICC: true,
- result: config1,
- err: nil,
- },
-
- "in-cluster not checked when default config is invalid": {
- defaultConfig: defaultInvalid,
- clientConfig: &testClientConfig{config: config1},
- icc: &testICC{},
-
- checkedICC: false,
- result: config1,
- err: nil,
- },
-
- "in-cluster not checked when config is not equal to default": {
- defaultConfig: default1,
- clientConfig: &testClientConfig{config: config2},
- icc: &testICC{},
-
- checkedICC: false,
- result: config2,
- err: nil,
- },
-
- "in-cluster checked when config is not equal to default and error is empty": {
- clientConfig: &testClientConfig{config: config2, err: ErrEmptyConfig},
- icc: &testICC{},
-
- checkedICC: true,
- result: config2,
- err: ErrEmptyConfig,
- },
-
- "in-cluster error returned when config is empty": {
- clientConfig: &testClientConfig{err: ErrEmptyConfig},
- icc: &testICC{
- possible: true,
- testClientConfig: testClientConfig{
- err: err1,
- },
- },
-
- checkedICC: true,
- result: nil,
- err: err1,
- },
-
- "in-cluster config returned when config is empty": {
- clientConfig: &testClientConfig{err: ErrEmptyConfig},
- icc: &testICC{
- possible: true,
- testClientConfig: testClientConfig{
- config: config2,
- },
- },
-
- checkedICC: true,
- result: config2,
- err: nil,
- },
-
- "in-cluster not checked when standard default is invalid": {
- defaultConfig: &DefaultClientConfig,
- clientConfig: &testClientConfig{config: config2},
- icc: &testICC{},
-
- checkedICC: false,
- result: config2,
- err: nil,
- },
- }
-
- for name, test := range testCases {
- c := &DeferredLoadingClientConfig{icc: test.icc}
- c.loader = &ClientConfigLoadingRules{DefaultClientConfig: test.defaultConfig}
- c.clientConfig = test.clientConfig
-
- cfg, err := c.ClientConfig()
- if test.icc.called != test.checkedICC {
- t.Errorf("%s: unexpected in-cluster-config call %t", name, test.icc.called)
- }
- if err != test.err || cfg != test.result {
- t.Errorf("%s: unexpected result: %v %#v", name, err, cfg)
- }
- }
-}
-
-func TestInClusterConfigNamespace(t *testing.T) {
- err1 := fmt.Errorf("unique error")
-
- testCases := map[string]struct {
- clientConfig *testClientConfig
- icc *testICC
-
- checkedICC bool
- result string
- ok bool
- err error
- }{
- "in-cluster checked on empty error": {
- clientConfig: &testClientConfig{err: ErrEmptyConfig},
- icc: &testICC{},
-
- checkedICC: true,
- err: ErrEmptyConfig,
- },
-
- "in-cluster not checked on non-empty error": {
- clientConfig: &testClientConfig{err: ErrEmptyCluster},
- icc: &testICC{},
-
- err: ErrEmptyCluster,
- },
-
- "in-cluster checked when config is default": {
- clientConfig: &testClientConfig{},
- icc: &testICC{},
-
- checkedICC: true,
- },
-
- "in-cluster not checked when config is not equal to default": {
- clientConfig: &testClientConfig{namespace: "test", namespaceSpecified: true},
- icc: &testICC{},
-
- result: "test",
- ok: true,
- },
-
- "in-cluster checked when namespace is not specified, but is defaulted": {
- clientConfig: &testClientConfig{namespace: "test", namespaceSpecified: false},
- icc: &testICC{},
-
- checkedICC: true,
- result: "test",
- ok: false,
- },
-
- "in-cluster error returned when config is empty": {
- clientConfig: &testClientConfig{err: ErrEmptyConfig},
- icc: &testICC{
- possible: true,
- testClientConfig: testClientConfig{
- err: err1,
- },
- },
-
- checkedICC: true,
- err: err1,
- },
-
- "in-cluster config returned when config is empty": {
- clientConfig: &testClientConfig{err: ErrEmptyConfig},
- icc: &testICC{
- possible: true,
- testClientConfig: testClientConfig{
- namespace: "test",
- namespaceSpecified: true,
- },
- },
-
- checkedICC: true,
- result: "test",
- ok: true,
- },
-
- "in-cluster config returned when config is empty and namespace is defaulted but not explicitly set": {
- clientConfig: &testClientConfig{err: ErrEmptyConfig},
- icc: &testICC{
- possible: true,
- testClientConfig: testClientConfig{
- namespace: "test",
- namespaceSpecified: false,
- },
- },
-
- checkedICC: true,
- result: "test",
- ok: false,
- },
- }
-
- for name, test := range testCases {
- c := &DeferredLoadingClientConfig{icc: test.icc}
- c.clientConfig = test.clientConfig
-
- ns, ok, err := c.Namespace()
- if test.icc.called != test.checkedICC {
- t.Errorf("%s: unexpected in-cluster-config call %t", name, test.icc.called)
- }
- if err != test.err || ns != test.result || ok != test.ok {
- t.Errorf("%s: unexpected result: %v %s %t", name, err, ns, ok)
- }
- }
-}
diff --git a/vendor/k8s.io/client-go/tools/clientcmd/overrides_test.go b/vendor/k8s.io/client-go/tools/clientcmd/overrides_test.go
deleted file mode 100644
index 13a995cf5..000000000
--- a/vendor/k8s.io/client-go/tools/clientcmd/overrides_test.go
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package clientcmd
-
-import (
- "testing"
-
- "github.com/spf13/pflag"
-)
-
-func TestNamespacePrefixStrip(t *testing.T) {
- testData := map[string]string{
- "namespaces/foo": "foo",
- "NAMESPACES/foo": "foo",
- "NameSpaces/foo": "foo",
- "namespace/foo": "foo",
- "NAMESPACE/foo": "foo",
- "nameSpace/foo": "foo",
- "ns/foo": "foo",
- "NS/foo": "foo",
- "namespaces/": "namespaces/",
- "namespace/": "namespace/",
- "ns/": "ns/",
- }
-
- for before, after := range testData {
- overrides := &ConfigOverrides{}
- fs := &pflag.FlagSet{}
- BindOverrideFlags(overrides, fs, RecommendedConfigOverrideFlags(""))
- fs.Parse([]string{"--namespace", before})
-
- if overrides.Context.Namespace != after {
- t.Fatalf("Expected %s, got %s", after, overrides.Context.Namespace)
- }
- }
-}
diff --git a/vendor/k8s.io/client-go/tools/clientcmd/validation_test.go b/vendor/k8s.io/client-go/tools/clientcmd/validation_test.go
deleted file mode 100644
index 4742b1a14..000000000
--- a/vendor/k8s.io/client-go/tools/clientcmd/validation_test.go
+++ /dev/null
@@ -1,574 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package clientcmd
-
-import (
- "io/ioutil"
- "os"
- "strings"
- "testing"
-
- utilerrors "k8s.io/apimachinery/pkg/util/errors"
- clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
-)
-
-func TestConfirmUsableBadInfoButOkConfig(t *testing.T) {
- config := clientcmdapi.NewConfig()
- config.Clusters["missing ca"] = &clientcmdapi.Cluster{
- Server: "anything",
- CertificateAuthority: "missing",
- }
- config.AuthInfos["error"] = &clientcmdapi.AuthInfo{
- Username: "anything",
- Token: "here",
- }
- config.Contexts["dirty"] = &clientcmdapi.Context{
- Cluster: "missing ca",
- AuthInfo: "error",
- }
- config.Clusters["clean"] = &clientcmdapi.Cluster{
- Server: "anything",
- }
- config.AuthInfos["clean"] = &clientcmdapi.AuthInfo{
- Token: "here",
- }
- config.Contexts["clean"] = &clientcmdapi.Context{
- Cluster: "clean",
- AuthInfo: "clean",
- }
-
- badValidation := configValidationTest{
- config: config,
- expectedErrorSubstring: []string{"unable to read certificate-authority"},
- }
- okTest := configValidationTest{
- config: config,
- }
-
- okTest.testConfirmUsable("clean", t)
- badValidation.testConfig(t)
-}
-
-func TestConfirmUsableBadInfoConfig(t *testing.T) {
- config := clientcmdapi.NewConfig()
- config.Clusters["missing ca"] = &clientcmdapi.Cluster{
- Server: "anything",
- CertificateAuthority: "missing",
- }
- config.AuthInfos["error"] = &clientcmdapi.AuthInfo{
- Username: "anything",
- Token: "here",
- }
- config.Contexts["first"] = &clientcmdapi.Context{
- Cluster: "missing ca",
- AuthInfo: "error",
- }
- test := configValidationTest{
- config: config,
- expectedErrorSubstring: []string{"unable to read certificate-authority"},
- }
-
- test.testConfirmUsable("first", t)
-}
-
-func TestConfirmUsableEmptyConfig(t *testing.T) {
- config := clientcmdapi.NewConfig()
- test := configValidationTest{
- config: config,
- expectedErrorSubstring: []string{"invalid configuration: no configuration has been provided"},
- }
-
- test.testConfirmUsable("", t)
-}
-
-func TestConfirmUsableMissingConfig(t *testing.T) {
- config := clientcmdapi.NewConfig()
- test := configValidationTest{
- config: config,
- expectedErrorSubstring: []string{"invalid configuration: no configuration has been provided"},
- }
-
- test.testConfirmUsable("not-here", t)
-}
-
-func TestValidateEmptyConfig(t *testing.T) {
- config := clientcmdapi.NewConfig()
- test := configValidationTest{
- config: config,
- expectedErrorSubstring: []string{"invalid configuration: no configuration has been provided"},
- }
-
- test.testConfig(t)
-}
-
-func TestValidateMissingCurrentContextConfig(t *testing.T) {
- config := clientcmdapi.NewConfig()
- config.CurrentContext = "anything"
- test := configValidationTest{
- config: config,
- expectedErrorSubstring: []string{"context was not found for specified "},
- }
-
- test.testConfig(t)
-}
-
-func TestIsContextNotFound(t *testing.T) {
- config := clientcmdapi.NewConfig()
- config.CurrentContext = "anything"
-
- err := Validate(*config)
- if !IsContextNotFound(err) {
- t.Errorf("Expected context not found, but got %v", err)
- }
- if !IsConfigurationInvalid(err) {
- t.Errorf("Expected configuration invalid, but got %v", err)
- }
-}
-
-func TestIsEmptyConfig(t *testing.T) {
- config := clientcmdapi.NewConfig()
-
- err := Validate(*config)
- if !IsEmptyConfig(err) {
- t.Errorf("Expected context not found, but got %v", err)
- }
- if !IsConfigurationInvalid(err) {
- t.Errorf("Expected configuration invalid, but got %v", err)
- }
-}
-
-func TestIsConfigurationInvalid(t *testing.T) {
- if newErrConfigurationInvalid([]error{}) != nil {
- t.Errorf("unexpected error")
- }
- if newErrConfigurationInvalid([]error{ErrNoContext}) == ErrNoContext {
- t.Errorf("unexpected error")
- }
- if newErrConfigurationInvalid([]error{ErrNoContext, ErrNoContext}) == nil {
- t.Errorf("unexpected error")
- }
- if !IsConfigurationInvalid(newErrConfigurationInvalid([]error{ErrNoContext, ErrNoContext})) {
- t.Errorf("unexpected error")
- }
-}
-
-func TestValidateMissingReferencesConfig(t *testing.T) {
- config := clientcmdapi.NewConfig()
- config.CurrentContext = "anything"
- config.Contexts["anything"] = &clientcmdapi.Context{Cluster: "missing", AuthInfo: "missing"}
- test := configValidationTest{
- config: config,
- expectedErrorSubstring: []string{"user \"missing\" was not found for context \"anything\"", "cluster \"missing\" was not found for context \"anything\""},
- }
-
- test.testContext("anything", t)
- test.testConfig(t)
-}
-
-func TestValidateEmptyContext(t *testing.T) {
- config := clientcmdapi.NewConfig()
- config.CurrentContext = "anything"
- config.Contexts["anything"] = &clientcmdapi.Context{}
- test := configValidationTest{
- config: config,
- expectedErrorSubstring: []string{"user was not specified for context \"anything\"", "cluster was not specified for context \"anything\""},
- }
-
- test.testContext("anything", t)
- test.testConfig(t)
-}
-
-func TestValidateEmptyContextName(t *testing.T) {
- config := clientcmdapi.NewConfig()
- config.CurrentContext = "anything"
- config.Contexts[""] = &clientcmdapi.Context{Cluster: "missing", AuthInfo: "missing"}
- test := configValidationTest{
- config: config,
- expectedErrorSubstring: []string{"empty context name", "is not allowed"},
- }
-
- test.testContext("", t)
- test.testConfig(t)
-}
-
-func TestValidateEmptyClusterInfo(t *testing.T) {
- config := clientcmdapi.NewConfig()
- config.Clusters["empty"] = clientcmdapi.NewCluster()
- test := configValidationTest{
- config: config,
- expectedErrorSubstring: []string{"cluster has no server defined"},
- }
-
- test.testCluster("empty", t)
- test.testConfig(t)
-}
-
-func TestValidateClusterInfoErrEmptyCluster(t *testing.T) {
- cluster := clientcmdapi.NewCluster()
- errs := validateClusterInfo("", *cluster)
-
- if len(errs) != 1 {
- t.Fatalf("unexpected errors: %v", errs)
- }
- if errs[0] != ErrEmptyCluster {
- t.Errorf("unexpected error: %v", errs[0])
- }
-}
-
-func TestValidateMissingCAFileClusterInfo(t *testing.T) {
- config := clientcmdapi.NewConfig()
- config.Clusters["missing ca"] = &clientcmdapi.Cluster{
- Server: "anything",
- CertificateAuthority: "missing",
- }
- test := configValidationTest{
- config: config,
- expectedErrorSubstring: []string{"unable to read certificate-authority"},
- }
-
- test.testCluster("missing ca", t)
- test.testConfig(t)
-}
-
-func TestValidateCleanClusterInfo(t *testing.T) {
- config := clientcmdapi.NewConfig()
- config.Clusters["clean"] = &clientcmdapi.Cluster{
- Server: "anything",
- }
- test := configValidationTest{
- config: config,
- }
-
- test.testCluster("clean", t)
- test.testConfig(t)
-}
-
-func TestValidateCleanWithCAClusterInfo(t *testing.T) {
- tempFile, _ := ioutil.TempFile("", "")
- defer os.Remove(tempFile.Name())
-
- config := clientcmdapi.NewConfig()
- config.Clusters["clean"] = &clientcmdapi.Cluster{
- Server: "anything",
- CertificateAuthority: tempFile.Name(),
- }
- test := configValidationTest{
- config: config,
- }
-
- test.testCluster("clean", t)
- test.testConfig(t)
-}
-
-func TestValidateEmptyAuthInfo(t *testing.T) {
- config := clientcmdapi.NewConfig()
- config.AuthInfos["error"] = &clientcmdapi.AuthInfo{}
- test := configValidationTest{
- config: config,
- }
-
- test.testAuthInfo("error", t)
- test.testConfig(t)
-}
-
-func TestValidateCertFilesNotFoundAuthInfo(t *testing.T) {
- config := clientcmdapi.NewConfig()
- config.AuthInfos["error"] = &clientcmdapi.AuthInfo{
- ClientCertificate: "missing",
- ClientKey: "missing",
- }
- test := configValidationTest{
- config: config,
- expectedErrorSubstring: []string{"unable to read client-cert", "unable to read client-key"},
- }
-
- test.testAuthInfo("error", t)
- test.testConfig(t)
-}
-
-func TestValidateCertDataOverridesFiles(t *testing.T) {
- tempFile, _ := ioutil.TempFile("", "")
- defer os.Remove(tempFile.Name())
-
- config := clientcmdapi.NewConfig()
- config.AuthInfos["clean"] = &clientcmdapi.AuthInfo{
- ClientCertificate: tempFile.Name(),
- ClientCertificateData: []byte("certdata"),
- ClientKey: tempFile.Name(),
- ClientKeyData: []byte("keydata"),
- }
- test := configValidationTest{
- config: config,
- expectedErrorSubstring: []string{"client-cert-data and client-cert are both specified", "client-key-data and client-key are both specified"},
- }
-
- test.testAuthInfo("clean", t)
- test.testConfig(t)
-}
-
-func TestValidateCleanCertFilesAuthInfo(t *testing.T) {
- tempFile, _ := ioutil.TempFile("", "")
- defer os.Remove(tempFile.Name())
-
- config := clientcmdapi.NewConfig()
- config.AuthInfos["clean"] = &clientcmdapi.AuthInfo{
- ClientCertificate: tempFile.Name(),
- ClientKey: tempFile.Name(),
- }
- test := configValidationTest{
- config: config,
- }
-
- test.testAuthInfo("clean", t)
- test.testConfig(t)
-}
-
-func TestValidateCleanTokenAuthInfo(t *testing.T) {
- config := clientcmdapi.NewConfig()
- config.AuthInfos["clean"] = &clientcmdapi.AuthInfo{
- Token: "any-value",
- }
- test := configValidationTest{
- config: config,
- }
-
- test.testAuthInfo("clean", t)
- test.testConfig(t)
-}
-
-func TestValidateMultipleMethodsAuthInfo(t *testing.T) {
- config := clientcmdapi.NewConfig()
- config.AuthInfos["error"] = &clientcmdapi.AuthInfo{
- Token: "token",
- Username: "username",
- }
- test := configValidationTest{
- config: config,
- expectedErrorSubstring: []string{"more than one authentication method", "token", "basicAuth"},
- }
-
- test.testAuthInfo("error", t)
- test.testConfig(t)
-}
-
-func TestValidateAuthInfoExec(t *testing.T) {
- config := clientcmdapi.NewConfig()
- config.AuthInfos["user"] = &clientcmdapi.AuthInfo{
- Exec: &clientcmdapi.ExecConfig{
- Command: "/bin/example",
- APIVersion: "clientauthentication.k8s.io/v1alpha1",
- Args: []string{"hello", "world"},
- Env: []clientcmdapi.ExecEnvVar{
- {Name: "foo", Value: "bar"},
- },
- },
- }
- test := configValidationTest{
- config: config,
- }
-
- test.testAuthInfo("user", t)
- test.testConfig(t)
-}
-
-func TestValidateAuthInfoExecNoVersion(t *testing.T) {
- config := clientcmdapi.NewConfig()
- config.AuthInfos["user"] = &clientcmdapi.AuthInfo{
- Exec: &clientcmdapi.ExecConfig{
- Command: "/bin/example",
- },
- }
- test := configValidationTest{
- config: config,
- expectedErrorSubstring: []string{
- "apiVersion must be specified for user to use exec authentication plugin",
- },
- }
-
- test.testAuthInfo("user", t)
- test.testConfig(t)
-}
-
-func TestValidateAuthInfoExecNoCommand(t *testing.T) {
- config := clientcmdapi.NewConfig()
- config.AuthInfos["user"] = &clientcmdapi.AuthInfo{
- Exec: &clientcmdapi.ExecConfig{
- APIVersion: "clientauthentication.k8s.io/v1alpha1",
- },
- }
- test := configValidationTest{
- config: config,
- expectedErrorSubstring: []string{
- "command must be specified for user to use exec authentication plugin",
- },
- }
-
- test.testAuthInfo("user", t)
- test.testConfig(t)
-}
-
-func TestValidateAuthInfoExecWithAuthProvider(t *testing.T) {
- config := clientcmdapi.NewConfig()
- config.AuthInfos["user"] = &clientcmdapi.AuthInfo{
- AuthProvider: &clientcmdapi.AuthProviderConfig{
- Name: "oidc",
- },
- Exec: &clientcmdapi.ExecConfig{
- Command: "/bin/example",
- APIVersion: "clientauthentication.k8s.io/v1alpha1",
- },
- }
- test := configValidationTest{
- config: config,
- expectedErrorSubstring: []string{
- "authProvider cannot be provided in combination with an exec plugin for user",
- },
- }
-
- test.testAuthInfo("user", t)
- test.testConfig(t)
-}
-
-func TestValidateAuthInfoExecInvalidEnv(t *testing.T) {
- config := clientcmdapi.NewConfig()
- config.AuthInfos["user"] = &clientcmdapi.AuthInfo{
- Exec: &clientcmdapi.ExecConfig{
- Command: "/bin/example",
- APIVersion: "clientauthentication.k8s.io/v1alpha1",
- Env: []clientcmdapi.ExecEnvVar{
- {Name: "foo"}, // No value
- },
- },
- }
- test := configValidationTest{
- config: config,
- expectedErrorSubstring: []string{
- "env variable foo value must be specified for user to use exec authentication plugin",
- },
- }
-
- test.testAuthInfo("user", t)
- test.testConfig(t)
-}
-
-type configValidationTest struct {
- config *clientcmdapi.Config
- expectedErrorSubstring []string
-}
-
-func (c configValidationTest) testContext(contextName string, t *testing.T) {
- errs := validateContext(contextName, *c.config.Contexts[contextName], *c.config)
-
- if len(c.expectedErrorSubstring) != 0 {
- if len(errs) == 0 {
- t.Errorf("Expected error containing: %v", c.expectedErrorSubstring)
- }
- for _, curr := range c.expectedErrorSubstring {
- if len(errs) != 0 && !strings.Contains(utilerrors.NewAggregate(errs).Error(), curr) {
- t.Errorf("Expected error containing: %v, but got %v", c.expectedErrorSubstring, utilerrors.NewAggregate(errs))
- }
- }
-
- } else {
- if len(errs) != 0 {
- t.Errorf("Unexpected error: %v", utilerrors.NewAggregate(errs))
- }
- }
-}
-
-func (c configValidationTest) testConfirmUsable(contextName string, t *testing.T) {
- err := ConfirmUsable(*c.config, contextName)
-
- if len(c.expectedErrorSubstring) != 0 {
- if err == nil {
- t.Errorf("Expected error containing: %v", c.expectedErrorSubstring)
- } else {
- for _, curr := range c.expectedErrorSubstring {
- if err != nil && !strings.Contains(err.Error(), curr) {
- t.Errorf("Expected error containing: %v, but got %v", c.expectedErrorSubstring, err)
- }
- }
- }
- } else {
- if err != nil {
- t.Errorf("Unexpected error: %v", err)
- }
- }
-}
-
-func (c configValidationTest) testConfig(t *testing.T) {
- err := Validate(*c.config)
-
- if len(c.expectedErrorSubstring) != 0 {
- if err == nil {
- t.Errorf("Expected error containing: %v", c.expectedErrorSubstring)
- } else {
- for _, curr := range c.expectedErrorSubstring {
- if err != nil && !strings.Contains(err.Error(), curr) {
- t.Errorf("Expected error containing: %v, but got %v", c.expectedErrorSubstring, err)
- }
- }
- if !IsConfigurationInvalid(err) {
- t.Errorf("all errors should be configuration invalid: %v", err)
- }
- }
- } else {
- if err != nil {
- t.Errorf("Unexpected error: %v", err)
- }
- }
-}
-
-func (c configValidationTest) testCluster(clusterName string, t *testing.T) {
- errs := validateClusterInfo(clusterName, *c.config.Clusters[clusterName])
-
- if len(c.expectedErrorSubstring) != 0 {
- if len(errs) == 0 {
- t.Errorf("Expected error containing: %v", c.expectedErrorSubstring)
- }
- for _, curr := range c.expectedErrorSubstring {
- if len(errs) != 0 && !strings.Contains(utilerrors.NewAggregate(errs).Error(), curr) {
- t.Errorf("Expected error containing: %v, but got %v", c.expectedErrorSubstring, utilerrors.NewAggregate(errs))
- }
- }
-
- } else {
- if len(errs) != 0 {
- t.Errorf("Unexpected error: %v", utilerrors.NewAggregate(errs))
- }
- }
-}
-
-func (c configValidationTest) testAuthInfo(authInfoName string, t *testing.T) {
- errs := validateAuthInfo(authInfoName, *c.config.AuthInfos[authInfoName])
-
- if len(c.expectedErrorSubstring) != 0 {
- if len(errs) == 0 {
- t.Errorf("Expected error containing: %v", c.expectedErrorSubstring)
- }
- for _, curr := range c.expectedErrorSubstring {
- if len(errs) != 0 && !strings.Contains(utilerrors.NewAggregate(errs).Error(), curr) {
- t.Errorf("Expected error containing: %v, but got %v", c.expectedErrorSubstring, utilerrors.NewAggregate(errs))
- }
- }
-
- } else {
- if len(errs) != 0 {
- t.Errorf("Unexpected error: %v", utilerrors.NewAggregate(errs))
- }
- }
-}
diff --git a/vendor/k8s.io/client-go/tools/pager/pager_test.go b/vendor/k8s.io/client-go/tools/pager/pager_test.go
deleted file mode 100644
index ae517cab2..000000000
--- a/vendor/k8s.io/client-go/tools/pager/pager_test.go
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package pager
-
-import (
- "context"
- "fmt"
- "reflect"
- "testing"
-
- "k8s.io/apimachinery/pkg/api/errors"
- metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- metav1beta1 "k8s.io/apimachinery/pkg/apis/meta/v1beta1"
- "k8s.io/apimachinery/pkg/runtime"
-)
-
-func list(count int, rv string) *metainternalversion.List {
- var list metainternalversion.List
- for i := 0; i < count; i++ {
- list.Items = append(list.Items, &metav1beta1.PartialObjectMetadata{
- ObjectMeta: metav1.ObjectMeta{
- Name: fmt.Sprintf("%d", i),
- },
- })
- }
- list.ResourceVersion = rv
- return &list
-}
-
-type testPager struct {
- t *testing.T
- rv string
- index int
- remaining int
- last int
- continuing bool
- done bool
- expectPage int64
-}
-
-func (p *testPager) reset() {
- p.continuing = false
- p.remaining += p.index
- p.index = 0
- p.last = 0
- p.done = false
-}
-
-func (p *testPager) PagedList(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) {
- if p.done {
- p.t.Errorf("did not expect additional call to paged list")
- return nil, fmt.Errorf("unexpected list call")
- }
- expectedContinue := fmt.Sprintf("%s:%d", p.rv, p.last)
- if options.Limit != p.expectPage || (p.continuing && options.Continue != expectedContinue) {
- p.t.Errorf("invariant violated, expected limit %d and continue %s, got %#v", p.expectPage, expectedContinue, options)
- return nil, fmt.Errorf("invariant violated")
- }
- var list metainternalversion.List
- total := options.Limit
- if total == 0 {
- total = int64(p.remaining)
- }
- for i := int64(0); i < total; i++ {
- if p.remaining <= 0 {
- break
- }
- list.Items = append(list.Items, &metav1beta1.PartialObjectMetadata{
- ObjectMeta: metav1.ObjectMeta{
- Name: fmt.Sprintf("%d", p.index),
- },
- })
- p.remaining--
- p.index++
- }
- p.last = p.index
- if p.remaining > 0 {
- list.Continue = fmt.Sprintf("%s:%d", p.rv, p.last)
- p.continuing = true
- } else {
- p.done = true
- }
- list.ResourceVersion = p.rv
- return &list, nil
-}
-
-func (p *testPager) ExpiresOnSecondPage(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) {
- if p.continuing {
- p.done = true
- return nil, errors.NewResourceExpired("this list has expired")
- }
- return p.PagedList(ctx, options)
-}
-
-func (p *testPager) ExpiresOnSecondPageThenFullList(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) {
- if p.continuing {
- p.reset()
- p.expectPage = 0
- return nil, errors.NewResourceExpired("this list has expired")
- }
- return p.PagedList(ctx, options)
-}
-
-func TestListPager_List(t *testing.T) {
- type fields struct {
- PageSize int64
- PageFn ListPageFunc
- FullListIfExpired bool
- }
- type args struct {
- ctx context.Context
- options metav1.ListOptions
- }
- tests := []struct {
- name string
- fields fields
- args args
- want runtime.Object
- wantErr bool
- isExpired bool
- }{
- {
- name: "empty page",
- fields: fields{PageSize: 10, PageFn: (&testPager{t: t, expectPage: 10, remaining: 0, rv: "rv:20"}).PagedList},
- args: args{},
- want: list(0, "rv:20"),
- },
- {
- name: "one page",
- fields: fields{PageSize: 10, PageFn: (&testPager{t: t, expectPage: 10, remaining: 9, rv: "rv:20"}).PagedList},
- args: args{},
- want: list(9, "rv:20"),
- },
- {
- name: "one full page",
- fields: fields{PageSize: 10, PageFn: (&testPager{t: t, expectPage: 10, remaining: 10, rv: "rv:20"}).PagedList},
- args: args{},
- want: list(10, "rv:20"),
- },
- {
- name: "two pages",
- fields: fields{PageSize: 10, PageFn: (&testPager{t: t, expectPage: 10, remaining: 11, rv: "rv:20"}).PagedList},
- args: args{},
- want: list(11, "rv:20"),
- },
- {
- name: "three pages",
- fields: fields{PageSize: 10, PageFn: (&testPager{t: t, expectPage: 10, remaining: 21, rv: "rv:20"}).PagedList},
- args: args{},
- want: list(21, "rv:20"),
- },
- {
- name: "expires on second page",
- fields: fields{PageSize: 10, PageFn: (&testPager{t: t, expectPage: 10, remaining: 21, rv: "rv:20"}).ExpiresOnSecondPage},
- args: args{},
- wantErr: true,
- isExpired: true,
- },
- {
- name: "expires on second page and then lists",
- fields: fields{
- FullListIfExpired: true,
- PageSize: 10,
- PageFn: (&testPager{t: t, expectPage: 10, remaining: 21, rv: "rv:20"}).ExpiresOnSecondPageThenFullList,
- },
- args: args{},
- want: list(21, "rv:20"),
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- p := &ListPager{
- PageSize: tt.fields.PageSize,
- PageFn: tt.fields.PageFn,
- FullListIfExpired: tt.fields.FullListIfExpired,
- }
- got, err := p.List(tt.args.ctx, tt.args.options)
- if (err != nil) != tt.wantErr {
- t.Errorf("ListPager.List() error = %v, wantErr %v", err, tt.wantErr)
- return
- }
- if tt.isExpired != errors.IsResourceExpired(err) {
- t.Errorf("ListPager.List() error = %v, isExpired %v", err, tt.isExpired)
- return
- }
- if !reflect.DeepEqual(got, tt.want) {
- t.Errorf("ListPager.List() = %v, want %v", got, tt.want)
- }
- })
- }
-}
diff --git a/vendor/k8s.io/client-go/tools/reference/ref_test.go b/vendor/k8s.io/client-go/tools/reference/ref_test.go
deleted file mode 100644
index b0cf06a97..000000000
--- a/vendor/k8s.io/client-go/tools/reference/ref_test.go
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
-Copyright 2018 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package reference
-
-import (
- "testing"
-
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
-)
-
-type TestRuntimeObj struct {
- metav1.TypeMeta
- metav1.ObjectMeta
-}
-
-func (o *TestRuntimeObj) DeepCopyObject() runtime.Object {
- panic("die")
-}
-
-func TestGetReferenceRefVersion(t *testing.T) {
- tests := []struct {
- name string
- input *TestRuntimeObj
- expectedRefVersion string
- }{
- {
- name: "api from selflink",
- input: &TestRuntimeObj{
- ObjectMeta: metav1.ObjectMeta{SelfLink: "/api/v1/namespaces"},
- },
- expectedRefVersion: "v1",
- },
- {
- name: "foo.group/v3 from selflink",
- input: &TestRuntimeObj{
- ObjectMeta: metav1.ObjectMeta{SelfLink: "/apis/foo.group/v3/namespaces"},
- },
- expectedRefVersion: "foo.group/v3",
- },
- }
-
- scheme := runtime.NewScheme()
- scheme.AddKnownTypes(schema.GroupVersion{Group: "this", Version: "is ignored"}, &TestRuntimeObj{})
-
- for _, test := range tests {
- t.Run(test.name, func(t *testing.T) {
- ref, err := GetReference(scheme, test.input)
- if err != nil {
- t.Fatal(err)
- }
- if test.expectedRefVersion != ref.APIVersion {
- t.Errorf("expected %q, got %q", test.expectedRefVersion, ref.APIVersion)
- }
- })
- }
-}
diff --git a/vendor/k8s.io/client-go/transport/cache_test.go b/vendor/k8s.io/client-go/transport/cache_test.go
deleted file mode 100644
index 9b740cdec..000000000
--- a/vendor/k8s.io/client-go/transport/cache_test.go
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
-Copyright 2015 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package transport
-
-import (
- "context"
- "crypto/tls"
- "net"
- "net/http"
- "testing"
-)
-
-func TestTLSConfigKey(t *testing.T) {
- // Make sure config fields that don't affect the tls config don't affect the cache key
- identicalConfigurations := map[string]*Config{
- "empty": {},
- "basic": {Username: "bob", Password: "password"},
- "bearer": {BearerToken: "token"},
- "user agent": {UserAgent: "useragent"},
- "transport": {Transport: http.DefaultTransport},
- "wrap transport": {WrapTransport: func(http.RoundTripper) http.RoundTripper { return nil }},
- }
- for nameA, valueA := range identicalConfigurations {
- for nameB, valueB := range identicalConfigurations {
- keyA, err := tlsConfigKey(valueA)
- if err != nil {
- t.Errorf("Unexpected error for %q: %v", nameA, err)
- continue
- }
- keyB, err := tlsConfigKey(valueB)
- if err != nil {
- t.Errorf("Unexpected error for %q: %v", nameB, err)
- continue
- }
- if keyA != keyB {
- t.Errorf("Expected identical cache keys for %q and %q, got:\n\t%s\n\t%s", nameA, nameB, keyA, keyB)
- continue
- }
- }
- }
-
- // Make sure config fields that affect the tls config affect the cache key
- dialer := net.Dialer{}
- getCert := func() (*tls.Certificate, error) { return nil, nil }
- uniqueConfigurations := map[string]*Config{
- "no tls": {},
- "dialer": {Dial: dialer.DialContext},
- "dialer2": {Dial: func(ctx context.Context, network, address string) (net.Conn, error) { return nil, nil }},
- "insecure": {TLS: TLSConfig{Insecure: true}},
- "cadata 1": {TLS: TLSConfig{CAData: []byte{1}}},
- "cadata 2": {TLS: TLSConfig{CAData: []byte{2}}},
- "cert 1, key 1": {
- TLS: TLSConfig{
- CertData: []byte{1},
- KeyData: []byte{1},
- },
- },
- "cert 1, key 1, servername 1": {
- TLS: TLSConfig{
- CertData: []byte{1},
- KeyData: []byte{1},
- ServerName: "1",
- },
- },
- "cert 1, key 1, servername 2": {
- TLS: TLSConfig{
- CertData: []byte{1},
- KeyData: []byte{1},
- ServerName: "2",
- },
- },
- "cert 1, key 2": {
- TLS: TLSConfig{
- CertData: []byte{1},
- KeyData: []byte{2},
- },
- },
- "cert 2, key 1": {
- TLS: TLSConfig{
- CertData: []byte{2},
- KeyData: []byte{1},
- },
- },
- "cert 2, key 2": {
- TLS: TLSConfig{
- CertData: []byte{2},
- KeyData: []byte{2},
- },
- },
- "cadata 1, cert 1, key 1": {
- TLS: TLSConfig{
- CAData: []byte{1},
- CertData: []byte{1},
- KeyData: []byte{1},
- },
- },
- "getCert1": {
- TLS: TLSConfig{
- KeyData: []byte{1},
- GetCert: getCert,
- },
- },
- "getCert2": {
- TLS: TLSConfig{
- KeyData: []byte{1},
- GetCert: func() (*tls.Certificate, error) { return nil, nil },
- },
- },
- "getCert1, key 2": {
- TLS: TLSConfig{
- KeyData: []byte{2},
- GetCert: getCert,
- },
- },
- }
- for nameA, valueA := range uniqueConfigurations {
- for nameB, valueB := range uniqueConfigurations {
- keyA, err := tlsConfigKey(valueA)
- if err != nil {
- t.Errorf("Unexpected error for %q: %v", nameA, err)
- continue
- }
- keyB, err := tlsConfigKey(valueB)
- if err != nil {
- t.Errorf("Unexpected error for %q: %v", nameB, err)
- continue
- }
-
- // Make sure we get the same key on the same config
- if nameA == nameB {
- if keyA != keyB {
- t.Errorf("Expected identical cache keys for %q and %q, got:\n\t%s\n\t%s", nameA, nameB, keyA, keyB)
- }
- continue
- }
-
- if keyA == keyB {
- t.Errorf("Expected unique cache keys for %q and %q, got:\n\t%s\n\t%s", nameA, nameB, keyA, keyB)
- continue
- }
- }
- }
-}
diff --git a/vendor/k8s.io/client-go/transport/round_trippers_test.go b/vendor/k8s.io/client-go/transport/round_trippers_test.go
deleted file mode 100644
index d5ffc6bde..000000000
--- a/vendor/k8s.io/client-go/transport/round_trippers_test.go
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package transport
-
-import (
- "net/http"
- "reflect"
- "strings"
- "testing"
-)
-
-type testRoundTripper struct {
- Request *http.Request
- Response *http.Response
- Err error
-}
-
-func (rt *testRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
- rt.Request = req
- return rt.Response, rt.Err
-}
-
-func TestBearerAuthRoundTripper(t *testing.T) {
- rt := &testRoundTripper{}
- req := &http.Request{}
- NewBearerAuthRoundTripper("test", rt).RoundTrip(req)
- if rt.Request == nil {
- t.Fatalf("unexpected nil request: %v", rt)
- }
- if rt.Request == req {
- t.Fatalf("round tripper should have copied request object: %#v", rt.Request)
- }
- if rt.Request.Header.Get("Authorization") != "Bearer test" {
- t.Errorf("unexpected authorization header: %#v", rt.Request)
- }
-}
-
-func TestBasicAuthRoundTripper(t *testing.T) {
- for n, tc := range map[string]struct {
- user string
- pass string
- }{
- "basic": {user: "user", pass: "pass"},
- "no pass": {user: "user"},
- } {
- rt := &testRoundTripper{}
- req := &http.Request{}
- NewBasicAuthRoundTripper(tc.user, tc.pass, rt).RoundTrip(req)
- if rt.Request == nil {
- t.Fatalf("%s: unexpected nil request: %v", n, rt)
- }
- if rt.Request == req {
- t.Fatalf("%s: round tripper should have copied request object: %#v", n, rt.Request)
- }
- if user, pass, found := rt.Request.BasicAuth(); !found || user != tc.user || pass != tc.pass {
- t.Errorf("%s: unexpected authorization header: %#v", n, rt.Request)
- }
- }
-}
-
-func TestUserAgentRoundTripper(t *testing.T) {
- rt := &testRoundTripper{}
- req := &http.Request{
- Header: make(http.Header),
- }
- req.Header.Set("User-Agent", "other")
- NewUserAgentRoundTripper("test", rt).RoundTrip(req)
- if rt.Request == nil {
- t.Fatalf("unexpected nil request: %v", rt)
- }
- if rt.Request != req {
- t.Fatalf("round tripper should not have copied request object: %#v", rt.Request)
- }
- if rt.Request.Header.Get("User-Agent") != "other" {
- t.Errorf("unexpected user agent header: %#v", rt.Request)
- }
-
- req = &http.Request{}
- NewUserAgentRoundTripper("test", rt).RoundTrip(req)
- if rt.Request == nil {
- t.Fatalf("unexpected nil request: %v", rt)
- }
- if rt.Request == req {
- t.Fatalf("round tripper should have copied request object: %#v", rt.Request)
- }
- if rt.Request.Header.Get("User-Agent") != "test" {
- t.Errorf("unexpected user agent header: %#v", rt.Request)
- }
-}
-
-func TestImpersonationRoundTripper(t *testing.T) {
- tcs := []struct {
- name string
- impersonationConfig ImpersonationConfig
- expected map[string][]string
- }{
- {
- name: "all",
- impersonationConfig: ImpersonationConfig{
- UserName: "user",
- Groups: []string{"one", "two"},
- Extra: map[string][]string{
- "first": {"A", "a"},
- "second": {"B", "b"},
- },
- },
- expected: map[string][]string{
- ImpersonateUserHeader: {"user"},
- ImpersonateGroupHeader: {"one", "two"},
- ImpersonateUserExtraHeaderPrefix + "First": {"A", "a"},
- ImpersonateUserExtraHeaderPrefix + "Second": {"B", "b"},
- },
- },
- }
-
- for _, tc := range tcs {
- rt := &testRoundTripper{}
- req := &http.Request{
- Header: make(http.Header),
- }
- NewImpersonatingRoundTripper(tc.impersonationConfig, rt).RoundTrip(req)
-
- for k, v := range rt.Request.Header {
- expected, ok := tc.expected[k]
- if !ok {
- t.Errorf("%v missing %v=%v", tc.name, k, v)
- continue
- }
- if !reflect.DeepEqual(expected, v) {
- t.Errorf("%v expected %v: %v, got %v", tc.name, k, expected, v)
- }
- }
- for k, v := range tc.expected {
- expected, ok := rt.Request.Header[k]
- if !ok {
- t.Errorf("%v missing %v=%v", tc.name, k, v)
- continue
- }
- if !reflect.DeepEqual(expected, v) {
- t.Errorf("%v expected %v: %v, got %v", tc.name, k, expected, v)
- }
- }
- }
-}
-
-func TestAuthProxyRoundTripper(t *testing.T) {
- for n, tc := range map[string]struct {
- username string
- groups []string
- extra map[string][]string
- }{
- "allfields": {
- username: "user",
- groups: []string{"groupA", "groupB"},
- extra: map[string][]string{
- "one": {"alpha", "bravo"},
- "two": {"charlie", "delta"},
- },
- },
- } {
- rt := &testRoundTripper{}
- req := &http.Request{}
- NewAuthProxyRoundTripper(tc.username, tc.groups, tc.extra, rt).RoundTrip(req)
- if rt.Request == nil {
- t.Errorf("%s: unexpected nil request: %v", n, rt)
- continue
- }
- if rt.Request == req {
- t.Errorf("%s: round tripper should have copied request object: %#v", n, rt.Request)
- continue
- }
-
- actualUsernames, ok := rt.Request.Header["X-Remote-User"]
- if !ok {
- t.Errorf("%s missing value", n)
- continue
- }
- if e, a := []string{tc.username}, actualUsernames; !reflect.DeepEqual(e, a) {
- t.Errorf("%s expected %v, got %v", n, e, a)
- continue
- }
- actualGroups, ok := rt.Request.Header["X-Remote-Group"]
- if !ok {
- t.Errorf("%s missing value", n)
- continue
- }
- if e, a := tc.groups, actualGroups; !reflect.DeepEqual(e, a) {
- t.Errorf("%s expected %v, got %v", n, e, a)
- continue
- }
-
- actualExtra := map[string][]string{}
- for key, values := range rt.Request.Header {
- if strings.HasPrefix(strings.ToLower(key), strings.ToLower("X-Remote-Extra-")) {
- extraKey := strings.ToLower(key[len("X-Remote-Extra-"):])
- actualExtra[extraKey] = append(actualExtra[key], values...)
- }
- }
- if e, a := tc.extra, actualExtra; !reflect.DeepEqual(e, a) {
- t.Errorf("%s expected %v, got %v", n, e, a)
- continue
- }
- }
-}
diff --git a/vendor/k8s.io/client-go/transport/transport_test.go b/vendor/k8s.io/client-go/transport/transport_test.go
deleted file mode 100644
index 2e9896a08..000000000
--- a/vendor/k8s.io/client-go/transport/transport_test.go
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
-Copyright 2015 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package transport
-
-import (
- "crypto/tls"
- "errors"
- "net/http"
- "testing"
-)
-
-const (
- rootCACert = `-----BEGIN CERTIFICATE-----
-MIIC4DCCAcqgAwIBAgIBATALBgkqhkiG9w0BAQswIzEhMB8GA1UEAwwYMTAuMTMu
-MTI5LjEwNkAxNDIxMzU5MDU4MB4XDTE1MDExNTIxNTczN1oXDTE2MDExNTIxNTcz
-OFowIzEhMB8GA1UEAwwYMTAuMTMuMTI5LjEwNkAxNDIxMzU5MDU4MIIBIjANBgkq
-hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAunDRXGwsiYWGFDlWH6kjGun+PshDGeZX
-xtx9lUnL8pIRWH3wX6f13PO9sktaOWW0T0mlo6k2bMlSLlSZgG9H6og0W6gLS3vq
-s4VavZ6DbXIwemZG2vbRwsvR+t4G6Nbwelm6F8RFnA1Fwt428pavmNQ/wgYzo+T1
-1eS+HiN4ACnSoDSx3QRWcgBkB1g6VReofVjx63i0J+w8Q/41L9GUuLqquFxu6ZnH
-60vTB55lHgFiDLjA1FkEz2dGvGh/wtnFlRvjaPC54JH2K1mPYAUXTreoeJtLJKX0
-ycoiyB24+zGCniUmgIsmQWRPaOPircexCp1BOeze82BT1LCZNTVaxQIDAQABoyMw
-ITAOBgNVHQ8BAf8EBAMCAKQwDwYDVR0TAQH/BAUwAwEB/zALBgkqhkiG9w0BAQsD
-ggEBADMxsUuAFlsYDpF4fRCzXXwrhbtj4oQwcHpbu+rnOPHCZupiafzZpDu+rw4x
-YGPnCb594bRTQn4pAu3Ac18NbLD5pV3uioAkv8oPkgr8aUhXqiv7KdDiaWm6sbAL
-EHiXVBBAFvQws10HMqMoKtO8f1XDNAUkWduakR/U6yMgvOPwS7xl0eUTqyRB6zGb
-K55q2dejiFWaFqB/y78txzvz6UlOZKE44g2JAVoJVM6kGaxh33q8/FmrL4kuN3ut
-W+MmJCVDvd4eEqPwbp7146ZWTqpIJ8lvA6wuChtqV8lhAPka2hD/LMqY8iXNmfXD
-uml0obOEy+ON91k+SWTJ3ggmF/U=
------END CERTIFICATE-----`
-
- certData = `-----BEGIN CERTIFICATE-----
-MIIC6jCCAdSgAwIBAgIBCzALBgkqhkiG9w0BAQswIzEhMB8GA1UEAwwYMTAuMTMu
-MTI5LjEwNkAxNDIxMzU5MDU4MB4XDTE1MDExNTIyMDEzMVoXDTE2MDExNTIyMDEz
-MlowGzEZMBcGA1UEAxMQb3BlbnNoaWZ0LWNsaWVudDCCASIwDQYJKoZIhvcNAQEB
-BQADggEPADCCAQoCggEBAKtdhz0+uCLXw5cSYns9rU/XifFSpb/x24WDdrm72S/v
-b9BPYsAStiP148buylr1SOuNi8sTAZmlVDDIpIVwMLff+o2rKYDicn9fjbrTxTOj
-lI4pHJBH+JU3AJ0tbajupioh70jwFS0oYpwtneg2zcnE2Z4l6mhrj2okrc5Q1/X2
-I2HChtIU4JYTisObtin10QKJX01CLfYXJLa8upWzKZ4/GOcHG+eAV3jXWoXidtjb
-1Usw70amoTZ6mIVCkiu1QwCoa8+ycojGfZhvqMsAp1536ZcCul+Na+AbCv4zKS7F
-kQQaImVrXdUiFansIoofGlw/JNuoKK6ssVpS5Ic3pgcCAwEAAaM1MDMwDgYDVR0P
-AQH/BAQDAgCgMBMGA1UdJQQMMAoGCCsGAQUFBwMCMAwGA1UdEwEB/wQCMAAwCwYJ
-KoZIhvcNAQELA4IBAQCKLREH7bXtXtZ+8vI6cjD7W3QikiArGqbl36bAhhWsJLp/
-p/ndKz39iFNaiZ3GlwIURWOOKx3y3GA0x9m8FR+Llthf0EQ8sUjnwaknWs0Y6DQ3
-jjPFZOpV3KPCFrdMJ3++E3MgwFC/Ih/N2ebFX9EcV9Vcc6oVWMdwT0fsrhu683rq
-6GSR/3iVX1G/pmOiuaR0fNUaCyCfYrnI4zHBDgSfnlm3vIvN2lrsR/DQBakNL8DJ
-HBgKxMGeUPoneBv+c8DMXIL0EhaFXRlBv9QW45/GiAIOuyFJ0i6hCtGZpJjq4OpQ
-BRjCI+izPzFTjsxD4aORE+WOkyWFCGPWKfNejfw0
------END CERTIFICATE-----`
-
- keyData = `-----BEGIN RSA PRIVATE KEY-----
-MIIEowIBAAKCAQEAq12HPT64ItfDlxJiez2tT9eJ8VKlv/HbhYN2ubvZL+9v0E9i
-wBK2I/Xjxu7KWvVI642LyxMBmaVUMMikhXAwt9/6jaspgOJyf1+NutPFM6OUjikc
-kEf4lTcAnS1tqO6mKiHvSPAVLShinC2d6DbNycTZniXqaGuPaiStzlDX9fYjYcKG
-0hTglhOKw5u2KfXRAolfTUIt9hcktry6lbMpnj8Y5wcb54BXeNdaheJ22NvVSzDv
-RqahNnqYhUKSK7VDAKhrz7JyiMZ9mG+oywCnXnfplwK6X41r4BsK/jMpLsWRBBoi
-ZWtd1SIVqewiih8aXD8k26gorqyxWlLkhzemBwIDAQABAoIBAD2XYRs3JrGHQUpU
-FkdbVKZkvrSY0vAZOqBTLuH0zUv4UATb8487anGkWBjRDLQCgxH+jucPTrztekQK
-aW94clo0S3aNtV4YhbSYIHWs1a0It0UdK6ID7CmdWkAj6s0T8W8lQT7C46mWYVLm
-5mFnCTHi6aB42jZrqmEpC7sivWwuU0xqj3Ml8kkxQCGmyc9JjmCB4OrFFC8NNt6M
-ObvQkUI6Z3nO4phTbpxkE1/9dT0MmPIF7GhHVzJMS+EyyRYUDllZ0wvVSOM3qZT0
-JMUaBerkNwm9foKJ1+dv2nMKZZbJajv7suUDCfU44mVeaEO+4kmTKSGCGjjTBGkr
-7L1ySDECgYEA5ElIMhpdBzIivCuBIH8LlUeuzd93pqssO1G2Xg0jHtfM4tz7fyeI
-cr90dc8gpli24dkSxzLeg3Tn3wIj/Bu64m2TpZPZEIlukYvgdgArmRIPQVxerYey
-OkrfTNkxU1HXsYjLCdGcGXs5lmb+K/kuTcFxaMOs7jZi7La+jEONwf8CgYEAwCs/
-rUOOA0klDsWWisbivOiNPII79c9McZCNBqncCBfMUoiGe8uWDEO4TFHN60vFuVk9
-8PkwpCfvaBUX+ajvbafIfHxsnfk1M04WLGCeqQ/ym5Q4sQoQOcC1b1y9qc/xEWfg
-nIUuia0ukYRpl7qQa3tNg+BNFyjypW8zukUAC/kCgYB1/Kojuxx5q5/oQVPrx73k
-2bevD+B3c+DYh9MJqSCNwFtUpYIWpggPxoQan4LwdsmO0PKzocb/ilyNFj4i/vII
-NToqSc/WjDFpaDIKyuu9oWfhECye45NqLWhb/6VOuu4QA/Nsj7luMhIBehnEAHW+
-GkzTKM8oD1PxpEG3nPKXYQKBgQC6AuMPRt3XBl1NkCrpSBy/uObFlFaP2Enpf39S
-3OZ0Gv0XQrnSaL1kP8TMcz68rMrGX8DaWYsgytstR4W+jyy7WvZwsUu+GjTJ5aMG
-77uEcEBpIi9CBzivfn7hPccE8ZgqPf+n4i6q66yxBJflW5xhvafJqDtW2LcPNbW/
-bvzdmQKBgExALRUXpq+5dbmkdXBHtvXdRDZ6rVmrnjy4nI5bPw+1GqQqk6uAR6B/
-F6NmLCQOO4PDG/cuatNHIr2FrwTmGdEL6ObLUGWn9Oer9gJhHVqqsY5I4sEPo4XX
-stR0Yiw0buV6DL/moUO0HIM9Bjh96HJp+LxiIS6UCdIhMPp5HoQa
------END RSA PRIVATE KEY-----`
-)
-
-func TestNew(t *testing.T) {
- testCases := map[string]struct {
- Config *Config
- Err bool
- TLS bool
- TLSCert bool
- TLSErr bool
- Default bool
- }{
- "default transport": {
- Default: true,
- Config: &Config{},
- },
-
- "server name": {
- TLS: true,
- Config: &Config{TLS: TLSConfig{
- ServerName: "foo",
- }},
- },
-
- "ca transport": {
- TLS: true,
- Config: &Config{
- TLS: TLSConfig{
- CAData: []byte(rootCACert),
- },
- },
- },
- "bad ca file transport": {
- Err: true,
- Config: &Config{
- TLS: TLSConfig{
- CAFile: "invalid file",
- },
- },
- },
- "ca data overriding bad ca file transport": {
- TLS: true,
- Config: &Config{
- TLS: TLSConfig{
- CAData: []byte(rootCACert),
- CAFile: "invalid file",
- },
- },
- },
-
- "cert transport": {
- TLS: true,
- TLSCert: true,
- Config: &Config{
- TLS: TLSConfig{
- CAData: []byte(rootCACert),
- CertData: []byte(certData),
- KeyData: []byte(keyData),
- },
- },
- },
- "bad cert data transport": {
- Err: true,
- Config: &Config{
- TLS: TLSConfig{
- CAData: []byte(rootCACert),
- CertData: []byte(certData),
- KeyData: []byte("bad key data"),
- },
- },
- },
- "bad file cert transport": {
- Err: true,
- Config: &Config{
- TLS: TLSConfig{
- CAData: []byte(rootCACert),
- CertData: []byte(certData),
- KeyFile: "invalid file",
- },
- },
- },
- "key data overriding bad file cert transport": {
- TLS: true,
- TLSCert: true,
- Config: &Config{
- TLS: TLSConfig{
- CAData: []byte(rootCACert),
- CertData: []byte(certData),
- KeyData: []byte(keyData),
- KeyFile: "invalid file",
- },
- },
- },
- "callback cert and key": {
- TLS: true,
- TLSCert: true,
- Config: &Config{
- TLS: TLSConfig{
- CAData: []byte(rootCACert),
- GetCert: func() (*tls.Certificate, error) {
- crt, err := tls.X509KeyPair([]byte(certData), []byte(keyData))
- return &crt, err
- },
- },
- },
- },
- "cert callback error": {
- TLS: true,
- TLSCert: true,
- TLSErr: true,
- Config: &Config{
- TLS: TLSConfig{
- CAData: []byte(rootCACert),
- GetCert: func() (*tls.Certificate, error) {
- return nil, errors.New("GetCert failure")
- },
- },
- },
- },
- "cert data overrides empty callback result": {
- TLS: true,
- TLSCert: true,
- Config: &Config{
- TLS: TLSConfig{
- CAData: []byte(rootCACert),
- GetCert: func() (*tls.Certificate, error) {
- return nil, nil
- },
- CertData: []byte(certData),
- KeyData: []byte(keyData),
- },
- },
- },
- "callback returns nothing": {
- TLS: true,
- TLSCert: true,
- Config: &Config{
- TLS: TLSConfig{
- CAData: []byte(rootCACert),
- GetCert: func() (*tls.Certificate, error) {
- return nil, nil
- },
- },
- },
- },
- }
- for k, testCase := range testCases {
- t.Run(k, func(t *testing.T) {
- rt, err := New(testCase.Config)
- switch {
- case testCase.Err && err == nil:
- t.Fatal("unexpected non-error")
- case !testCase.Err && err != nil:
- t.Fatalf("unexpected error: %v", err)
- }
- if testCase.Err {
- return
- }
-
- switch {
- case testCase.Default && rt != http.DefaultTransport:
- t.Fatalf("got %#v, expected the default transport", rt)
- case !testCase.Default && rt == http.DefaultTransport:
- t.Fatalf("got %#v, expected non-default transport", rt)
- }
-
- // We only know how to check TLSConfig on http.Transports
- transport := rt.(*http.Transport)
- switch {
- case testCase.TLS && transport.TLSClientConfig == nil:
- t.Fatalf("got %#v, expected TLSClientConfig", transport)
- case !testCase.TLS && transport.TLSClientConfig != nil:
- t.Fatalf("got %#v, expected no TLSClientConfig", transport)
- }
- if !testCase.TLS {
- return
- }
-
- switch {
- case testCase.TLSCert && transport.TLSClientConfig.GetClientCertificate == nil:
- t.Fatalf("got %#v, expected TLSClientConfig.GetClientCertificate", transport.TLSClientConfig)
- case !testCase.TLSCert && transport.TLSClientConfig.GetClientCertificate != nil:
- t.Fatalf("got %#v, expected no TLSClientConfig.GetClientCertificate", transport.TLSClientConfig)
- }
- if !testCase.TLSCert {
- return
- }
-
- _, err = transport.TLSClientConfig.GetClientCertificate(nil)
- switch {
- case testCase.TLSErr && err == nil:
- t.Error("got nil error from GetClientCertificate, expected non-nil")
- case !testCase.TLSErr && err != nil:
- t.Errorf("got error from GetClientCertificate: %q, expected nil", err)
- }
- })
- }
-}
diff --git a/vendor/k8s.io/client-go/util/buffer/ring_growing_test.go b/vendor/k8s.io/client-go/util/buffer/ring_growing_test.go
deleted file mode 100644
index 31a4c079d..000000000
--- a/vendor/k8s.io/client-go/util/buffer/ring_growing_test.go
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package buffer
-
-import (
- "testing"
-
- "github.com/stretchr/testify/assert"
-)
-
-func TestGrowth(t *testing.T) {
- t.Parallel()
- x := 10
- g := NewRingGrowing(1)
- for i := 0; i < x; i++ {
- assert.Equal(t, i, g.readable)
- g.WriteOne(i)
- }
- read := 0
- for g.readable > 0 {
- v, ok := g.ReadOne()
- assert.True(t, ok)
- assert.Equal(t, read, v)
- read++
- }
- assert.Equalf(t, x, read, "expected to have read %d items: %d", x, read)
- assert.Zerof(t, g.readable, "expected readable to be zero: %d", g.readable)
- assert.Equalf(t, 16, g.n, "expected N to be 16: %d", g.n)
-}
-
-func TestEmpty(t *testing.T) {
- t.Parallel()
- g := NewRingGrowing(1)
- _, ok := g.ReadOne()
- assert.False(t, ok)
-}
diff --git a/vendor/k8s.io/client-go/util/cert/csr_test.go b/vendor/k8s.io/client-go/util/cert/csr_test.go
deleted file mode 100644
index ed28f021e..000000000
--- a/vendor/k8s.io/client-go/util/cert/csr_test.go
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package cert
-
-import (
- "crypto/x509"
- "crypto/x509/pkix"
- "encoding/pem"
- "io/ioutil"
- "net"
- "testing"
-)
-
-func TestMakeCSR(t *testing.T) {
- keyFile := "testdata/dontUseThisKey.pem"
- subject := &pkix.Name{
- CommonName: "kube-worker",
- }
- dnsSANs := []string{"localhost"}
- ipSANs := []net.IP{net.ParseIP("127.0.0.1")}
-
- keyData, err := ioutil.ReadFile(keyFile)
- if err != nil {
- t.Fatal(err)
- }
- key, err := ParsePrivateKeyPEM(keyData)
- if err != nil {
- t.Fatal(err)
- }
- csrPEM, err := MakeCSR(key, subject, dnsSANs, ipSANs)
- if err != nil {
- t.Error(err)
- }
- csrBlock, rest := pem.Decode(csrPEM)
- if csrBlock == nil {
- t.Error("Unable to decode MakeCSR result.")
- }
- if len(rest) != 0 {
- t.Error("Found more than one PEM encoded block in the result.")
- }
- if csrBlock.Type != CertificateRequestBlockType {
- t.Errorf("Found block type %q, wanted 'CERTIFICATE REQUEST'", csrBlock.Type)
- }
- csr, err := x509.ParseCertificateRequest(csrBlock.Bytes)
- if err != nil {
- t.Errorf("Found %v parsing MakeCSR result as a CertificateRequest.", err)
- }
- if csr.Subject.CommonName != subject.CommonName {
- t.Errorf("Wanted %v, got %v", subject, csr.Subject)
- }
- if len(csr.DNSNames) != 1 {
- t.Errorf("Wanted 1 DNS name in the result, got %d", len(csr.DNSNames))
- } else if csr.DNSNames[0] != dnsSANs[0] {
- t.Errorf("Wanted %v, got %v", dnsSANs[0], csr.DNSNames[0])
- }
- if len(csr.IPAddresses) != 1 {
- t.Errorf("Wanted 1 IP address in the result, got %d", len(csr.IPAddresses))
- } else if csr.IPAddresses[0].String() != ipSANs[0].String() {
- t.Errorf("Wanted %v, got %v", ipSANs[0], csr.IPAddresses[0])
- }
-}
diff --git a/vendor/k8s.io/client-go/util/cert/pem_test.go b/vendor/k8s.io/client-go/util/cert/pem_test.go
deleted file mode 100644
index de3ce5253..000000000
--- a/vendor/k8s.io/client-go/util/cert/pem_test.go
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package cert
-
-import (
- "io/ioutil"
- "os"
- "testing"
-)
-
-const (
- // rsaPrivateKey is a RSA Private Key in PKCS#1 format
- // openssl genrsa -out rsa2048.pem 2048
- rsaPrivateKey = `-----BEGIN RSA PRIVATE KEY-----
-MIIEpAIBAAKCAQEA92mVjhBKOFsdxFzb/Pjq+7b5TJlODAdY5hK+WxLZTIrfhDPq
-FWrGKdjSNiHbXrdEtwJh9V+RqPZVSN3aWy1224RgkyNdMJsXhJKuCC24ZKY8SXtW
-xuTYmMRaMnCsv6QBGRTIbZ2EFbAObVM7lDyv1VqY3amZIWFQMlZ9CNpxDSPa5yi4
-3gopbXkne0oGNmey9X0qtpk7NMZIgAL6Zz4rZ30bcfC2ag6RLOFI2E/c4n8c38R8
-9MfXfLkj8/Cxo4JfI9NvRCpPOpFO8d/ZtWVUuIrBQN+Y7tkN2T60Qq/TkKXUrhDe
-fwlTlktZVJ/GztLYU41b2GcWsh/XO+PH831rmwIDAQABAoIBAQCC9c6GDjVbM0/E
-WurPMusfJjE7zII1d8YkspM0HfwLug6qKdikUYpnKC/NG4rEzfl/bbFwco/lgc6O
-7W/hh2U8uQttlvCDA/Uk5YddKOZL0Hpk4vaB/SxxYK3luSKXpjY2knutGg2KdVCN
-qdsFkkH4iyYTXuyBcMNEgedZQldI/kEujIH/L7FE+DF5TMzT4lHhozDoG+fy564q
-qVGUZXJn0ubc3GaPn2QOLNNM44sfYA4UJCpKBXPu85bvNObjxVQO4WqwwxU1vRnL
-UUsaGaelhSVJCo0dVPRvrfPPKZ09HTwpy40EkgQo6VriFc1EBoQDjENLbAJv9OfQ
-aCc9wiZhAoGBAP/8oEy48Zbb0P8Vdy4djf5tfBW8yXFLWzXewJ4l3itKS1r42nbX
-9q3cJsgRTQm8uRcMIpWxsc3n6zG+lREvTkoTB3ViI7+uQPiqA+BtWyNy7jzufFke
-ONKZfg7QxxmYRWZBRnoNGNbMpNeERuLmhvQuom9D1WbhzAYJbfs/O4WTAoGBAPds
-2FNDU0gaesFDdkIUGq1nIJqRQDW485LXZm4pFqBFxdOpbdWRuYT2XZjd3fD0XY98
-Nhkpb7NTMCuK3BdKcqIptt+cK+quQgYid0hhhgZbpCQ5AL6c6KgyjgpYlh2enzU9
-Zo3yg8ej1zbbA11sBlhX+5iO2P1u5DG+JHLwUUbZAoGAUwaU102EzfEtsA4+QW7E
-hyjrfgFlNKHES4yb3K9bh57pIfBkqvcQwwMMcQdrfSUAw0DkVrjzel0mI1Q09QXq
-1ould6UFAz55RC2gZEITtUOpkYmoOx9aPrQZ9qQwb1S77ZZuTVfCHqjxLhVxCFbM
-npYhiQTvShciHTMhwMOZgpECgYAVV5EtVXBYltgh1YTc3EkUzgF087R7LdHsx6Gx
-POATwRD4WfP8aQ58lpeqOPEM+LcdSlSMRRO6fyF3kAm+BJDwxfJdRWZQXumZB94M
-I0VhRQRaj4Qt7PDwmTPBVrTUJzuKZxpyggm17b8Bn1Ch/VBqzGQKW8AB1E/grosM
-UwhfuQKBgQC2JO/iqTQScHClf0qlItCJsBuVukFmSAVCkpOD8YdbdlPdOOwSk1wQ
-C0eAlsC3BCMvkpidKQmra6IqIrvTGI6EFgkrb3aknWdup2w8j2udYCNqyE3W+fVe
-p8FdYQ1FkACQ+daO5VlClL/9l0sGjKXlNKbpmJ2H4ngZmXj5uGmxuQ==
------END RSA PRIVATE KEY-----`
-
- // rsaPublicKey is a RSA Public Key in PEM encoded format
- // openssl rsa -in rsa2048.pem -pubout -out rsa2048pub.pem
- rsaPublicKey = `-----BEGIN PUBLIC KEY-----
-MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA92mVjhBKOFsdxFzb/Pjq
-+7b5TJlODAdY5hK+WxLZTIrfhDPqFWrGKdjSNiHbXrdEtwJh9V+RqPZVSN3aWy12
-24RgkyNdMJsXhJKuCC24ZKY8SXtWxuTYmMRaMnCsv6QBGRTIbZ2EFbAObVM7lDyv
-1VqY3amZIWFQMlZ9CNpxDSPa5yi43gopbXkne0oGNmey9X0qtpk7NMZIgAL6Zz4r
-Z30bcfC2ag6RLOFI2E/c4n8c38R89MfXfLkj8/Cxo4JfI9NvRCpPOpFO8d/ZtWVU
-uIrBQN+Y7tkN2T60Qq/TkKXUrhDefwlTlktZVJ/GztLYU41b2GcWsh/XO+PH831r
-mwIDAQAB
------END PUBLIC KEY-----`
-
- // certificate is an x509 certificate in PEM encoded format
- // openssl req -new -key rsa2048.pem -sha256 -nodes -x509 -days 1826 -out x509certificate.pem -subj "/C=US/CN=not-valid"
- certificate = `-----BEGIN CERTIFICATE-----
-MIIDFTCCAf2gAwIBAgIJAN8B8NOwtiUCMA0GCSqGSIb3DQEBCwUAMCExCzAJBgNV
-BAYTAlVTMRIwEAYDVQQDDAlub3QtdmFsaWQwHhcNMTcwMzIyMDI1NjM2WhcNMjIw
-MzIyMDI1NjM2WjAhMQswCQYDVQQGEwJVUzESMBAGA1UEAwwJbm90LXZhbGlkMIIB
-IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA92mVjhBKOFsdxFzb/Pjq+7b5
-TJlODAdY5hK+WxLZTIrfhDPqFWrGKdjSNiHbXrdEtwJh9V+RqPZVSN3aWy1224Rg
-kyNdMJsXhJKuCC24ZKY8SXtWxuTYmMRaMnCsv6QBGRTIbZ2EFbAObVM7lDyv1VqY
-3amZIWFQMlZ9CNpxDSPa5yi43gopbXkne0oGNmey9X0qtpk7NMZIgAL6Zz4rZ30b
-cfC2ag6RLOFI2E/c4n8c38R89MfXfLkj8/Cxo4JfI9NvRCpPOpFO8d/ZtWVUuIrB
-QN+Y7tkN2T60Qq/TkKXUrhDefwlTlktZVJ/GztLYU41b2GcWsh/XO+PH831rmwID
-AQABo1AwTjAdBgNVHQ4EFgQU1I5GfinLF7ta+dBJ6UWcrYaexLswHwYDVR0jBBgw
-FoAU1I5GfinLF7ta+dBJ6UWcrYaexLswDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0B
-AQsFAAOCAQEAUl0wUD4y41juHFOVMYiziPYr1ShSpQXdwp8FfaHrzI5hsr8UMe8D
-dzb9QzZ4bx3yZhiG3ahrSBh956thMTHrKTEwAfJIEXI4cuSVWQAaOJ4Em5SDFxQe
-d0E6Ui2nGh1SFGF7oyuEXyzqgRMWFNDFw9HLUNgXaO18Zfouw8+K0BgbfEWEcSi1
-JLQbyhCjz088gltrliQGPWDFAg9cHBKtJhuTzZkvuqK1CLEmBhtzP1zFiGBfOJc8
-v+aKjAwrPUNX11cXOCPxBv2qXMetxaovBem6AI2hvypCInXaVQfP+yOLubzlTDjS
-Y708SlY38hmS1uTwDpyLOn8AKkZ8jtx75g==
------END CERTIFICATE-----`
-
- // ecdsaPrivateKeyWithParams is a ECDSA Private Key with included EC Parameters block
- // openssl ecparam -name prime256v1 -genkey -out ecdsa256params.pem
- ecdsaPrivateKeyWithParams = `-----BEGIN EC PARAMETERS-----
-BggqhkjOPQMBBw==
------END EC PARAMETERS-----
------BEGIN EC PRIVATE KEY-----
-MHcCAQEEIAwSOWQqlMTZNqNF7tgua812Jxib1DVOgb2pHHyIEyNNoAoGCCqGSM49
-AwEHoUQDQgAEyxYNrs6a6tsNCFNYn+l+JDUZ0PnUZbcsDgJn2O62D1se8M5iQ5rY
-iIv6RpxE3VHvlHEIvYgCZkG0jHszTUopBg==
------END EC PRIVATE KEY-----`
-
- // ecdsaPrivateKey is a ECDSA Private Key in ASN.1 format
- // openssl ecparam -name prime256v1 -genkey -noout -out ecdsa256.pem
- ecdsaPrivateKey = `-----BEGIN EC PRIVATE KEY-----
-MHcCAQEEIP6Qw6dHDiLsSnLXUhQVTPE0fTQQrj3XSbiQAZPXnk5+oAoGCCqGSM49
-AwEHoUQDQgAEZZzi1u5f2/AEGFI/HYUhU+u6cTK1q2bbtE7r1JMK+/sQA5sNAp+7
-Vdc3psr1OaNzyTyuhTECyRdFKXm63cMnGg==
------END EC PRIVATE KEY-----`
-
- // ecdsaPublicKey is a ECDSA Public Key in PEM encoded format
- // openssl ec -in ecdsa256.pem -pubout -out ecdsa256pub.pem
- ecdsaPublicKey = `-----BEGIN PUBLIC KEY-----
-MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEZZzi1u5f2/AEGFI/HYUhU+u6cTK1
-q2bbtE7r1JMK+/sQA5sNAp+7Vdc3psr1OaNzyTyuhTECyRdFKXm63cMnGg==
------END PUBLIC KEY-----`
-)
-
-func TestReadPrivateKey(t *testing.T) {
- f, err := ioutil.TempFile("", "")
- if err != nil {
- t.Fatalf("error creating tmpfile: %v", err)
- }
- defer os.Remove(f.Name())
-
- if _, err := PrivateKeyFromFile(f.Name()); err == nil {
- t.Fatalf("Expected error reading key from empty file, got none")
- }
-
- if err := ioutil.WriteFile(f.Name(), []byte(rsaPrivateKey), os.FileMode(0600)); err != nil {
- t.Fatalf("error writing private key to tmpfile: %v", err)
- }
- if _, err := PrivateKeyFromFile(f.Name()); err != nil {
- t.Fatalf("error reading private RSA key: %v", err)
- }
-
- if err := ioutil.WriteFile(f.Name(), []byte(ecdsaPrivateKey), os.FileMode(0600)); err != nil {
- t.Fatalf("error writing private key to tmpfile: %v", err)
- }
- if _, err := PrivateKeyFromFile(f.Name()); err != nil {
- t.Fatalf("error reading private ECDSA key: %v", err)
- }
-
- if err := ioutil.WriteFile(f.Name(), []byte(ecdsaPrivateKeyWithParams), os.FileMode(0600)); err != nil {
- t.Fatalf("error writing private key to tmpfile: %v", err)
- }
- if _, err := PrivateKeyFromFile(f.Name()); err != nil {
- t.Fatalf("error reading private ECDSA key with params: %v", err)
- }
-}
-
-func TestReadPublicKeys(t *testing.T) {
- f, err := ioutil.TempFile("", "")
- if err != nil {
- t.Fatalf("error creating tmpfile: %v", err)
- }
- defer os.Remove(f.Name())
-
- if _, err := PublicKeysFromFile(f.Name()); err == nil {
- t.Fatalf("Expected error reading keys from empty file, got none")
- }
-
- if err := ioutil.WriteFile(f.Name(), []byte(rsaPublicKey), os.FileMode(0600)); err != nil {
- t.Fatalf("error writing public key to tmpfile: %v", err)
- }
- if keys, err := PublicKeysFromFile(f.Name()); err != nil {
- t.Fatalf("error reading RSA public key: %v", err)
- } else if len(keys) != 1 {
- t.Fatalf("expected 1 key, got %d", len(keys))
- }
-
- if err := ioutil.WriteFile(f.Name(), []byte(ecdsaPublicKey), os.FileMode(0600)); err != nil {
- t.Fatalf("error writing public key to tmpfile: %v", err)
- }
- if keys, err := PublicKeysFromFile(f.Name()); err != nil {
- t.Fatalf("error reading ECDSA public key: %v", err)
- } else if len(keys) != 1 {
- t.Fatalf("expected 1 key, got %d", len(keys))
- }
-
- if err := ioutil.WriteFile(f.Name(), []byte(rsaPublicKey+"\n"+ecdsaPublicKey), os.FileMode(0600)); err != nil {
- t.Fatalf("error writing public key to tmpfile: %v", err)
- }
- if keys, err := PublicKeysFromFile(f.Name()); err != nil {
- t.Fatalf("error reading combined RSA/ECDSA public key file: %v", err)
- } else if len(keys) != 2 {
- t.Fatalf("expected 2 keys, got %d", len(keys))
- }
-
- if err := ioutil.WriteFile(f.Name(), []byte(certificate), os.FileMode(0600)); err != nil {
- t.Fatalf("error writing certificate to tmpfile: %v", err)
- }
- if keys, err := PublicKeysFromFile(f.Name()); err != nil {
- t.Fatalf("error reading public key from certificate file: %v", err)
- } else if len(keys) != 1 {
- t.Fatalf("expected 1 keys, got %d", len(keys))
- }
-
-}
diff --git a/vendor/k8s.io/client-go/util/connrotation/connrotation_test.go b/vendor/k8s.io/client-go/util/connrotation/connrotation_test.go
deleted file mode 100644
index a618f2961..000000000
--- a/vendor/k8s.io/client-go/util/connrotation/connrotation_test.go
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-Copyright 2018 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package connrotation
-
-import (
- "context"
- "net"
- "testing"
- "time"
-)
-
-func TestCloseAll(t *testing.T) {
- closed := make(chan struct{})
- dialFn := func(ctx context.Context, network, address string) (net.Conn, error) {
- return closeOnlyConn{onClose: func() { closed <- struct{}{} }}, nil
- }
- dialer := NewDialer(dialFn)
-
- const numConns = 10
-
- // Outer loop to ensure Dialer is re-usable after CloseAll.
- for i := 0; i < 5; i++ {
- for j := 0; j < numConns; j++ {
- if _, err := dialer.Dial("", ""); err != nil {
- t.Fatal(err)
- }
- }
- dialer.CloseAll()
- for j := 0; j < numConns; j++ {
- select {
- case <-closed:
- case <-time.After(time.Second):
- t.Fatalf("iteration %d: 1s after CloseAll only %d/%d connections closed", i, j, numConns)
- }
- }
- }
-}
-
-type closeOnlyConn struct {
- net.Conn
- onClose func()
-}
-
-func (c closeOnlyConn) Close() error {
- go c.onClose()
- return nil
-}
diff --git a/vendor/k8s.io/client-go/util/flowcontrol/backoff_test.go b/vendor/k8s.io/client-go/util/flowcontrol/backoff_test.go
deleted file mode 100644
index 23a6cbfa3..000000000
--- a/vendor/k8s.io/client-go/util/flowcontrol/backoff_test.go
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
-Copyright 2015 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package flowcontrol
-
-import (
- "testing"
- "time"
-
- "k8s.io/apimachinery/pkg/util/clock"
-)
-
-func TestSlowBackoff(t *testing.T) {
- id := "_idSlow"
- tc := clock.NewFakeClock(time.Now())
- step := time.Second
- maxDuration := 50 * step
-
- b := NewFakeBackOff(step, maxDuration, tc)
- cases := []time.Duration{0, 1, 2, 4, 8, 16, 32, 50, 50, 50}
- for ix, c := range cases {
- tc.Step(step)
- w := b.Get(id)
- if w != c*step {
- t.Errorf("input: '%d': expected %s, got %s", ix, c*step, w)
- }
- b.Next(id, tc.Now())
- }
-
- //Now confirm that the Reset cancels backoff.
- b.Next(id, tc.Now())
- b.Reset(id)
- if b.Get(id) != 0 {
- t.Errorf("Reset didn't clear the backoff.")
- }
-
-}
-
-func TestBackoffReset(t *testing.T) {
- id := "_idReset"
- tc := clock.NewFakeClock(time.Now())
- step := time.Second
- maxDuration := step * 5
- b := NewFakeBackOff(step, maxDuration, tc)
- startTime := tc.Now()
-
- // get to backoff = maxDuration
- for i := 0; i <= int(maxDuration/step); i++ {
- tc.Step(step)
- b.Next(id, tc.Now())
- }
-
- // backoff should be capped at maxDuration
- if !b.IsInBackOffSince(id, tc.Now()) {
- t.Errorf("expected to be in Backoff got %s", b.Get(id))
- }
-
- lastUpdate := tc.Now()
- tc.Step(2*maxDuration + step) // time += 11s, 11 > 2*maxDuration
- if b.IsInBackOffSince(id, lastUpdate) {
- t.Errorf("expected to not be in Backoff after reset (start=%s, now=%s, lastUpdate=%s), got %s", startTime, tc.Now(), lastUpdate, b.Get(id))
- }
-}
-
-func TestBackoffHightWaterMark(t *testing.T) {
- id := "_idHiWaterMark"
- tc := clock.NewFakeClock(time.Now())
- step := time.Second
- maxDuration := 5 * step
- b := NewFakeBackOff(step, maxDuration, tc)
-
- // get to backoff = maxDuration
- for i := 0; i <= int(maxDuration/step); i++ {
- tc.Step(step)
- b.Next(id, tc.Now())
- }
-
- // backoff high watermark expires after 2*maxDuration
- tc.Step(maxDuration + step)
- b.Next(id, tc.Now())
-
- if b.Get(id) != maxDuration {
- t.Errorf("expected Backoff to stay at high watermark %s got %s", maxDuration, b.Get(id))
- }
-}
-
-func TestBackoffGC(t *testing.T) {
- id := "_idGC"
- tc := clock.NewFakeClock(time.Now())
- step := time.Second
- maxDuration := 5 * step
-
- b := NewFakeBackOff(step, maxDuration, tc)
-
- for i := 0; i <= int(maxDuration/step); i++ {
- tc.Step(step)
- b.Next(id, tc.Now())
- }
- lastUpdate := tc.Now()
- tc.Step(maxDuration + step)
- b.GC()
- _, found := b.perItemBackoff[id]
- if !found {
- t.Errorf("expected GC to skip entry, elapsed time=%s maxDuration=%s", tc.Now().Sub(lastUpdate), maxDuration)
- }
-
- tc.Step(maxDuration + step)
- b.GC()
- r, found := b.perItemBackoff[id]
- if found {
- t.Errorf("expected GC of entry after %s got entry %v", tc.Now().Sub(lastUpdate), r)
- }
-}
-
-func TestIsInBackOffSinceUpdate(t *testing.T) {
- id := "_idIsInBackOffSinceUpdate"
- tc := clock.NewFakeClock(time.Now())
- step := time.Second
- maxDuration := 10 * step
- b := NewFakeBackOff(step, maxDuration, tc)
- startTime := tc.Now()
-
- cases := []struct {
- tick time.Duration
- inBackOff bool
- value int
- }{
- {tick: 0, inBackOff: false, value: 0},
- {tick: 1, inBackOff: false, value: 1},
- {tick: 2, inBackOff: true, value: 2},
- {tick: 3, inBackOff: false, value: 2},
- {tick: 4, inBackOff: true, value: 4},
- {tick: 5, inBackOff: true, value: 4},
- {tick: 6, inBackOff: true, value: 4},
- {tick: 7, inBackOff: false, value: 4},
- {tick: 8, inBackOff: true, value: 8},
- {tick: 9, inBackOff: true, value: 8},
- {tick: 10, inBackOff: true, value: 8},
- {tick: 11, inBackOff: true, value: 8},
- {tick: 12, inBackOff: true, value: 8},
- {tick: 13, inBackOff: true, value: 8},
- {tick: 14, inBackOff: true, value: 8},
- {tick: 15, inBackOff: false, value: 8},
- {tick: 16, inBackOff: true, value: 10},
- {tick: 17, inBackOff: true, value: 10},
- {tick: 18, inBackOff: true, value: 10},
- {tick: 19, inBackOff: true, value: 10},
- {tick: 20, inBackOff: true, value: 10},
- {tick: 21, inBackOff: true, value: 10},
- {tick: 22, inBackOff: true, value: 10},
- {tick: 23, inBackOff: true, value: 10},
- {tick: 24, inBackOff: true, value: 10},
- {tick: 25, inBackOff: false, value: 10},
- {tick: 26, inBackOff: true, value: 10},
- {tick: 27, inBackOff: true, value: 10},
- {tick: 28, inBackOff: true, value: 10},
- {tick: 29, inBackOff: true, value: 10},
- {tick: 30, inBackOff: true, value: 10},
- {tick: 31, inBackOff: true, value: 10},
- {tick: 32, inBackOff: true, value: 10},
- {tick: 33, inBackOff: true, value: 10},
- {tick: 34, inBackOff: true, value: 10},
- {tick: 35, inBackOff: false, value: 10},
- {tick: 56, inBackOff: false, value: 0},
- {tick: 57, inBackOff: false, value: 1},
- }
-
- for _, c := range cases {
- tc.SetTime(startTime.Add(c.tick * step))
- if c.inBackOff != b.IsInBackOffSinceUpdate(id, tc.Now()) {
- t.Errorf("expected IsInBackOffSinceUpdate %v got %v at tick %s", c.inBackOff, b.IsInBackOffSinceUpdate(id, tc.Now()), c.tick*step)
- }
-
- if c.inBackOff && (time.Duration(c.value)*step != b.Get(id)) {
- t.Errorf("expected backoff value=%s got %s at tick %s", time.Duration(c.value)*step, b.Get(id), c.tick*step)
- }
-
- if !c.inBackOff {
- b.Next(id, tc.Now())
- }
- }
-}
diff --git a/vendor/k8s.io/client-go/util/flowcontrol/throttle_test.go b/vendor/k8s.io/client-go/util/flowcontrol/throttle_test.go
deleted file mode 100644
index 99cf64d64..000000000
--- a/vendor/k8s.io/client-go/util/flowcontrol/throttle_test.go
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package flowcontrol
-
-import (
- "sync"
- "testing"
- "time"
-)
-
-func TestMultithreadedThrottling(t *testing.T) {
- // Bucket with 100QPS and no burst
- r := NewTokenBucketRateLimiter(100, 1)
-
- // channel to collect 100 tokens
- taken := make(chan bool, 100)
-
- // Set up goroutines to hammer the throttler
- startCh := make(chan bool)
- endCh := make(chan bool)
- for i := 0; i < 10; i++ {
- go func() {
- // wait for the starting signal
- <-startCh
- for {
- // get a token
- r.Accept()
- select {
- // try to add it to the taken channel
- case taken <- true:
- continue
- // if taken is full, notify and return
- default:
- endCh <- true
- return
- }
- }
- }()
- }
-
- // record wall time
- startTime := time.Now()
- // take the initial capacity so all tokens are the result of refill
- r.Accept()
- // start the thundering herd
- close(startCh)
- // wait for the first signal that we collected 100 tokens
- <-endCh
- // record wall time
- endTime := time.Now()
-
- // tolerate a 1% clock change because these things happen
- if duration := endTime.Sub(startTime); duration < (time.Second * 99 / 100) {
- // We shouldn't be able to get 100 tokens out of the bucket in less than 1 second of wall clock time, no matter what
- t.Errorf("Expected it to take at least 1 second to get 100 tokens, took %v", duration)
- } else {
- t.Logf("Took %v to get 100 tokens", duration)
- }
-}
-
-func TestBasicThrottle(t *testing.T) {
- r := NewTokenBucketRateLimiter(1, 3)
- for i := 0; i < 3; i++ {
- if !r.TryAccept() {
- t.Error("unexpected false accept")
- }
- }
- if r.TryAccept() {
- t.Error("unexpected true accept")
- }
-}
-
-func TestIncrementThrottle(t *testing.T) {
- r := NewTokenBucketRateLimiter(1, 1)
- if !r.TryAccept() {
- t.Error("unexpected false accept")
- }
- if r.TryAccept() {
- t.Error("unexpected true accept")
- }
-
- // Allow to refill
- time.Sleep(2 * time.Second)
-
- if !r.TryAccept() {
- t.Error("unexpected false accept")
- }
-}
-
-func TestThrottle(t *testing.T) {
- r := NewTokenBucketRateLimiter(10, 5)
-
- // Should consume 5 tokens immediately, then
- // the remaining 11 should take at least 1 second (0.1s each)
- expectedFinish := time.Now().Add(time.Second * 1)
- for i := 0; i < 16; i++ {
- r.Accept()
- }
- if time.Now().Before(expectedFinish) {
- t.Error("rate limit was not respected, finished too early")
- }
-}
-
-func TestAlwaysFake(t *testing.T) {
- rl := NewFakeAlwaysRateLimiter()
- if !rl.TryAccept() {
- t.Error("TryAccept in AlwaysFake should return true.")
- }
- // If this will block the test will timeout
- rl.Accept()
-}
-
-func TestNeverFake(t *testing.T) {
- rl := NewFakeNeverRateLimiter()
- if rl.TryAccept() {
- t.Error("TryAccept in NeverFake should return false.")
- }
-
- finished := false
- wg := sync.WaitGroup{}
- wg.Add(1)
- go func() {
- rl.Accept()
- finished = true
- wg.Done()
- }()
-
- // Wait some time to make sure it never finished.
- time.Sleep(time.Second)
- if finished {
- t.Error("Accept should block forever in NeverFake.")
- }
-
- rl.Stop()
- wg.Wait()
- if !finished {
- t.Error("Stop should make Accept unblock in NeverFake.")
- }
-}
diff --git a/vendor/k8s.io/client-go/util/integer/integer_test.go b/vendor/k8s.io/client-go/util/integer/integer_test.go
deleted file mode 100644
index e9f586888..000000000
--- a/vendor/k8s.io/client-go/util/integer/integer_test.go
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package integer
-
-import "testing"
-
-func TestIntMax(t *testing.T) {
- tests := []struct {
- nums []int
- expectedMax int
- }{
- {
- nums: []int{-1, 0},
- expectedMax: 0,
- },
- {
- nums: []int{-1, -2},
- expectedMax: -1,
- },
- {
- nums: []int{0, 1},
- expectedMax: 1,
- },
- {
- nums: []int{1, 2},
- expectedMax: 2,
- },
- }
-
- for i, test := range tests {
- t.Logf("executing scenario %d", i)
- if max := IntMax(test.nums[0], test.nums[1]); max != test.expectedMax {
- t.Errorf("expected %v, got %v", test.expectedMax, max)
- }
- }
-}
-
-func TestIntMin(t *testing.T) {
- tests := []struct {
- nums []int
- expectedMin int
- }{
- {
- nums: []int{-1, 0},
- expectedMin: -1,
- },
- {
- nums: []int{-1, -2},
- expectedMin: -2,
- },
- {
- nums: []int{0, 1},
- expectedMin: 0,
- },
- {
- nums: []int{1, 2},
- expectedMin: 1,
- },
- }
-
- for i, test := range tests {
- t.Logf("executing scenario %d", i)
- if min := IntMin(test.nums[0], test.nums[1]); min != test.expectedMin {
- t.Errorf("expected %v, got %v", test.expectedMin, min)
- }
- }
-}
-
-func TestInt32Max(t *testing.T) {
- tests := []struct {
- nums []int32
- expectedMax int32
- }{
- {
- nums: []int32{-1, 0},
- expectedMax: 0,
- },
- {
- nums: []int32{-1, -2},
- expectedMax: -1,
- },
- {
- nums: []int32{0, 1},
- expectedMax: 1,
- },
- {
- nums: []int32{1, 2},
- expectedMax: 2,
- },
- }
-
- for i, test := range tests {
- t.Logf("executing scenario %d", i)
- if max := Int32Max(test.nums[0], test.nums[1]); max != test.expectedMax {
- t.Errorf("expected %v, got %v", test.expectedMax, max)
- }
- }
-}
-
-func TestInt32Min(t *testing.T) {
- tests := []struct {
- nums []int32
- expectedMin int32
- }{
- {
- nums: []int32{-1, 0},
- expectedMin: -1,
- },
- {
- nums: []int32{-1, -2},
- expectedMin: -2,
- },
- {
- nums: []int32{0, 1},
- expectedMin: 0,
- },
- {
- nums: []int32{1, 2},
- expectedMin: 1,
- },
- }
-
- for i, test := range tests {
- t.Logf("executing scenario %d", i)
- if min := Int32Min(test.nums[0], test.nums[1]); min != test.expectedMin {
- t.Errorf("expected %v, got %v", test.expectedMin, min)
- }
- }
-}
-
-func TestInt64Max(t *testing.T) {
- tests := []struct {
- nums []int64
- expectedMax int64
- }{
- {
- nums: []int64{-1, 0},
- expectedMax: 0,
- },
- {
- nums: []int64{-1, -2},
- expectedMax: -1,
- },
- {
- nums: []int64{0, 1},
- expectedMax: 1,
- },
- {
- nums: []int64{1, 2},
- expectedMax: 2,
- },
- }
-
- for i, test := range tests {
- t.Logf("executing scenario %d", i)
- if max := Int64Max(test.nums[0], test.nums[1]); max != test.expectedMax {
- t.Errorf("expected %v, got %v", test.expectedMax, max)
- }
- }
-}
-
-func TestInt64Min(t *testing.T) {
- tests := []struct {
- nums []int64
- expectedMin int64
- }{
- {
- nums: []int64{-1, 0},
- expectedMin: -1,
- },
- {
- nums: []int64{-1, -2},
- expectedMin: -2,
- },
- {
- nums: []int64{0, 1},
- expectedMin: 0,
- },
- {
- nums: []int64{1, 2},
- expectedMin: 1,
- },
- }
-
- for i, test := range tests {
- t.Logf("executing scenario %d", i)
- if min := Int64Min(test.nums[0], test.nums[1]); min != test.expectedMin {
- t.Errorf("expected %v, got %v", test.expectedMin, min)
- }
- }
-}
-
-func TestRoundToInt32(t *testing.T) {
- tests := []struct {
- num float64
- exp int32
- }{
- {
- num: 5.5,
- exp: 6,
- },
- {
- num: -3.7,
- exp: -4,
- },
- {
- num: 3.49,
- exp: 3,
- },
- {
- num: -7.9,
- exp: -8,
- },
- {
- num: -4.499999,
- exp: -4,
- },
- {
- num: 0,
- exp: 0,
- },
- }
-
- for i, test := range tests {
- t.Logf("executing scenario %d", i)
- if got := RoundToInt32(test.num); got != test.exp {
- t.Errorf("expected %d, got %d", test.exp, got)
- }
- }
-}
diff --git a/vendor/k8s.io/client-go/util/retry/util_test.go b/vendor/k8s.io/client-go/util/retry/util_test.go
deleted file mode 100644
index dbb4374fe..000000000
--- a/vendor/k8s.io/client-go/util/retry/util_test.go
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package retry
-
-import (
- "fmt"
- "testing"
-
- "k8s.io/apimachinery/pkg/api/errors"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/util/wait"
-)
-
-func TestRetryOnConflict(t *testing.T) {
- opts := wait.Backoff{Factor: 1.0, Steps: 3}
- conflictErr := errors.NewConflict(schema.GroupResource{Resource: "test"}, "other", nil)
-
- // never returns
- err := RetryOnConflict(opts, func() error {
- return conflictErr
- })
- if err != conflictErr {
- t.Errorf("unexpected error: %v", err)
- }
-
- // returns immediately
- i := 0
- err = RetryOnConflict(opts, func() error {
- i++
- return nil
- })
- if err != nil || i != 1 {
- t.Errorf("unexpected error: %v", err)
- }
-
- // returns immediately on error
- testErr := fmt.Errorf("some other error")
- err = RetryOnConflict(opts, func() error {
- return testErr
- })
- if err != testErr {
- t.Errorf("unexpected error: %v", err)
- }
-
- // keeps retrying
- i = 0
- err = RetryOnConflict(opts, func() error {
- if i < 2 {
- i++
- return errors.NewConflict(schema.GroupResource{Resource: "test"}, "other", nil)
- }
- return nil
- })
- if err != nil || i != 2 {
- t.Errorf("unexpected error: %v", err)
- }
-}
diff --git a/vendor/k8s.io/kube-openapi/pkg/util/proto/openapi_suite_test.go b/vendor/k8s.io/kube-openapi/pkg/util/proto/openapi_suite_test.go
deleted file mode 100644
index 24b5168e4..000000000
--- a/vendor/k8s.io/kube-openapi/pkg/util/proto/openapi_suite_test.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package proto_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/ginkgo/config"
- . "github.com/onsi/ginkgo/types"
- . "github.com/onsi/gomega"
-
- "fmt"
- "testing"
-)
-
-func TestOpenapi(t *testing.T) {
- RegisterFailHandler(Fail)
- RunSpecsWithDefaultAndCustomReporters(t, "Openapi Suite", []Reporter{newlineReporter{}})
-}
-
-// Print a newline after the default newlineReporter due to issue
-// https://github.com/jstemmer/go-junit-report/issues/31
-type newlineReporter struct{}
-
-func (newlineReporter) SpecSuiteWillBegin(config GinkgoConfigType, summary *SuiteSummary) {}
-
-func (newlineReporter) BeforeSuiteDidRun(setupSummary *SetupSummary) {}
-
-func (newlineReporter) AfterSuiteDidRun(setupSummary *SetupSummary) {}
-
-func (newlineReporter) SpecWillRun(specSummary *SpecSummary) {}
-
-func (newlineReporter) SpecDidComplete(specSummary *SpecSummary) {}
-
-// SpecSuiteDidEnd Prints a newline between "35 Passed | 0 Failed | 0 Pending | 0 Skipped" and "--- PASS:"
-func (newlineReporter) SpecSuiteDidEnd(summary *SuiteSummary) { fmt.Printf("\n") }
diff --git a/vendor/k8s.io/kube-openapi/pkg/util/proto/openapi_test.go b/vendor/k8s.io/kube-openapi/pkg/util/proto/openapi_test.go
deleted file mode 100644
index b6e237256..000000000
--- a/vendor/k8s.io/kube-openapi/pkg/util/proto/openapi_test.go
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package proto_test
-
-import (
- "path/filepath"
-
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
-
- "k8s.io/kube-openapi/pkg/util/proto"
- "k8s.io/kube-openapi/pkg/util/proto/testing"
-)
-
-var fakeSchema = testing.Fake{Path: filepath.Join("testdata", "swagger.json")}
-var fakeSchemaNext = testing.Fake{Path: filepath.Join("testdata", "swagger_next.json")}
-
-var _ = Describe("Reading apps/v1beta1/Deployment from v1.8 openAPIData", func() {
- var models proto.Models
- BeforeEach(func() {
- s, err := fakeSchema.OpenAPISchema()
- Expect(err).To(BeNil())
- models, err = proto.NewOpenAPIData(s)
- Expect(err).To(BeNil())
- })
-
- model := "io.k8s.api.apps.v1beta1.Deployment"
- var schema proto.Schema
- It("should lookup the Schema by its model name", func() {
- schema = models.LookupModel(model)
- Expect(schema).ToNot(BeNil())
- })
-
- var deployment *proto.Kind
- It("should be a Kind", func() {
- deployment = schema.(*proto.Kind)
- Expect(deployment).ToNot(BeNil())
- })
-
- It("should have a path", func() {
- Expect(deployment.GetPath().Get()).To(Equal([]string{"io.k8s.api.apps.v1beta1.Deployment"}))
- })
-
- It("should have a kind key of type string", func() {
- Expect(deployment.Fields).To(HaveKey("kind"))
- key := deployment.Fields["kind"].(*proto.Primitive)
- Expect(key).ToNot(BeNil())
- Expect(key.Type).To(Equal("string"))
- Expect(key.GetPath().Get()).To(Equal([]string{"io.k8s.api.apps.v1beta1.Deployment", ".kind"}))
- })
-
- It("should have a apiVersion key of type string", func() {
- Expect(deployment.Fields).To(HaveKey("apiVersion"))
- key := deployment.Fields["apiVersion"].(*proto.Primitive)
- Expect(key).ToNot(BeNil())
- Expect(key.Type).To(Equal("string"))
- Expect(key.GetPath().Get()).To(Equal([]string{"io.k8s.api.apps.v1beta1.Deployment", ".apiVersion"}))
- })
-
- It("should have a metadata key of type Reference", func() {
- Expect(deployment.Fields).To(HaveKey("metadata"))
- key := deployment.Fields["metadata"].(proto.Reference)
- Expect(key).ToNot(BeNil())
- Expect(key.Reference()).To(Equal("io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta"))
- subSchema := key.SubSchema().(*proto.Kind)
- Expect(subSchema).ToNot(BeNil())
- })
-
- var status *proto.Kind
- It("should have a status key of type Reference", func() {
- Expect(deployment.Fields).To(HaveKey("status"))
- key := deployment.Fields["status"].(proto.Reference)
- Expect(key).ToNot(BeNil())
- Expect(key.Reference()).To(Equal("io.k8s.api.apps.v1beta1.DeploymentStatus"))
- status = key.SubSchema().(*proto.Kind)
- Expect(status).ToNot(BeNil())
- })
-
- It("should have a valid DeploymentStatus", func() {
- By("having availableReplicas key")
- Expect(status.Fields).To(HaveKey("availableReplicas"))
- replicas := status.Fields["availableReplicas"].(*proto.Primitive)
- Expect(replicas).ToNot(BeNil())
- Expect(replicas.Type).To(Equal("integer"))
-
- By("having conditions key")
- Expect(status.Fields).To(HaveKey("conditions"))
- conditions := status.Fields["conditions"].(*proto.Array)
- Expect(conditions).ToNot(BeNil())
- Expect(conditions.GetName()).To(Equal(`Array of Reference to "io.k8s.api.apps.v1beta1.DeploymentCondition"`))
- Expect(conditions.GetExtensions()).To(Equal(map[string]interface{}{
- "x-kubernetes-patch-merge-key": "type",
- "x-kubernetes-patch-strategy": "merge",
- }))
- condition := conditions.SubType.(proto.Reference)
- Expect(condition.Reference()).To(Equal("io.k8s.api.apps.v1beta1.DeploymentCondition"))
- })
-
- var spec *proto.Kind
- It("should have a spec key of type Reference", func() {
- Expect(deployment.Fields).To(HaveKey("spec"))
- key := deployment.Fields["spec"].(proto.Reference)
- Expect(key).ToNot(BeNil())
- Expect(key.Reference()).To(Equal("io.k8s.api.apps.v1beta1.DeploymentSpec"))
- spec = key.SubSchema().(*proto.Kind)
- Expect(spec).ToNot(BeNil())
- })
-
- It("should have a spec with no gvk", func() {
- _, found := spec.GetExtensions()["x-kubernetes-group-version-kind"]
- Expect(found).To(BeFalse())
- })
-
- It("should have a spec with a PodTemplateSpec sub-field", func() {
- Expect(spec.Fields).To(HaveKey("template"))
- key := spec.Fields["template"].(proto.Reference)
- Expect(key).ToNot(BeNil())
- Expect(key.Reference()).To(Equal("io.k8s.api.core.v1.PodTemplateSpec"))
- })
-})
-
-var _ = Describe("Reading apps/v1beta1/Deployment from v1.11 openAPIData", func() {
- var models proto.Models
- BeforeEach(func() {
- s, err := fakeSchemaNext.OpenAPISchema()
- Expect(err).To(BeNil())
- models, err = proto.NewOpenAPIData(s)
- Expect(err).To(BeNil())
- })
-
- model := "io.k8s.api.apps.v1beta1.Deployment"
- var schema proto.Schema
- It("should lookup the Schema by its model name", func() {
- schema = models.LookupModel(model)
- Expect(schema).ToNot(BeNil())
- })
-
- var deployment *proto.Kind
- It("should be a Kind", func() {
- deployment = schema.(*proto.Kind)
- Expect(deployment).ToNot(BeNil())
- })
-})
-
-var _ = Describe("Reading apps/v1beta1/ControllerRevision from v1.11 openAPIData", func() {
- var models proto.Models
- BeforeEach(func() {
- s, err := fakeSchemaNext.OpenAPISchema()
- Expect(err).To(BeNil())
- models, err = proto.NewOpenAPIData(s)
- Expect(err).To(BeNil())
- })
-
- model := "io.k8s.api.apps.v1beta1.ControllerRevision"
- var schema proto.Schema
- It("should lookup the Schema by its model name", func() {
- schema = models.LookupModel(model)
- Expect(schema).ToNot(BeNil())
- })
-
- var cr *proto.Kind
- It("data property should be map[string]Arbitrary", func() {
- cr = schema.(*proto.Kind)
- Expect(cr).ToNot(BeNil())
- Expect(cr.Fields).To(HaveKey("data"))
-
- data := cr.Fields["data"].(*proto.Map)
- Expect(data).ToNot(BeNil())
- Expect(data.GetName()).To(Equal("Map of Arbitrary value (primitive, object or array)"))
- Expect(data.GetPath().Get()).To(Equal([]string{"io.k8s.api.apps.v1beta1.ControllerRevision", ".data"}))
-
- arbitrary := data.SubType.(*proto.Arbitrary)
- Expect(arbitrary).ToNot(BeNil())
- Expect(arbitrary.GetName()).To(Equal("Arbitrary value (primitive, object or array)"))
- Expect(arbitrary.GetPath().Get()).To(Equal([]string{"io.k8s.api.apps.v1beta1.ControllerRevision", ".data"}))
- })
-})
-
-var _ = Describe("Reading authorization.k8s.io/v1/SubjectAccessReview from openAPIData", func() {
- var models proto.Models
- BeforeEach(func() {
- s, err := fakeSchema.OpenAPISchema()
- Expect(err).To(BeNil())
- models, err = proto.NewOpenAPIData(s)
- Expect(err).To(BeNil())
- })
-
- model := "io.k8s.api.authorization.v1.LocalSubjectAccessReview"
- var schema proto.Schema
- It("should lookup the Schema by its model", func() {
- schema = models.LookupModel(model)
- Expect(schema).ToNot(BeNil())
- })
-
- var sarspec *proto.Kind
- It("should be a Kind and have a spec", func() {
- sar := schema.(*proto.Kind)
- Expect(sar).ToNot(BeNil())
- Expect(sar.Fields).To(HaveKey("spec"))
- specRef := sar.Fields["spec"].(proto.Reference)
- Expect(specRef).ToNot(BeNil())
- Expect(specRef.Reference()).To(Equal("io.k8s.api.authorization.v1.SubjectAccessReviewSpec"))
- sarspec = specRef.SubSchema().(*proto.Kind)
- Expect(sarspec).ToNot(BeNil())
- })
-
- It("should have a valid SubjectAccessReviewSpec", func() {
- Expect(sarspec.Fields).To(HaveKey("extra"))
- extra := sarspec.Fields["extra"].(*proto.Map)
- Expect(extra).ToNot(BeNil())
- Expect(extra.GetName()).To(Equal("Map of Array of string"))
- Expect(extra.GetPath().Get()).To(Equal([]string{"io.k8s.api.authorization.v1.SubjectAccessReviewSpec", ".extra"}))
- array := extra.SubType.(*proto.Array)
- Expect(array).ToNot(BeNil())
- Expect(array.GetName()).To(Equal("Array of string"))
- Expect(array.GetPath().Get()).To(Equal([]string{"io.k8s.api.authorization.v1.SubjectAccessReviewSpec", ".extra"}))
- str := array.SubType.(*proto.Primitive)
- Expect(str).ToNot(BeNil())
- Expect(str.Type).To(Equal("string"))
- Expect(str.GetName()).To(Equal("string"))
- Expect(str.GetPath().Get()).To(Equal([]string{"io.k8s.api.authorization.v1.SubjectAccessReviewSpec", ".extra"}))
- })
-})
-
-var _ = Describe("Path", func() {
- It("can be created by NewPath", func() {
- path := proto.NewPath("key")
- Expect(path.String()).To(Equal("key"))
- })
- It("can create and print complex paths", func() {
- key := proto.NewPath("key")
- array := key.ArrayPath(12)
- field := array.FieldPath("subKey")
-
- Expect(field.String()).To(Equal("key[12].subKey"))
- })
- It("has a length", func() {
- key := proto.NewPath("key")
- array := key.ArrayPath(12)
- field := array.FieldPath("subKey")
-
- Expect(field.Len()).To(Equal(3))
- })
- It("can look like an array", func() {
- key := proto.NewPath("key")
- array := key.ArrayPath(12)
- field := array.FieldPath("subKey")
-
- Expect(field.Get()).To(Equal([]string{"key", "[12]", ".subKey"}))
- })
-})
diff --git a/vendor/k8s.io/kube-openapi/pkg/util/util_test.go b/vendor/k8s.io/kube-openapi/pkg/util/util_test.go
deleted file mode 100644
index 43b9b4048..000000000
--- a/vendor/k8s.io/kube-openapi/pkg/util/util_test.go
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-Copyright 2018 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package util
-
-import (
- "reflect"
- "testing"
-)
-
-func TestCanonicalName(t *testing.T) {
-
- var tests = []struct {
- input string
- expected string
- }{
- {"k8s.io/api/core/v1.Pod", "io.k8s.api.core.v1.Pod"},
- {"k8s.io/api/networking/v1/NetworkPolicy", "io.k8s.api.networking.v1.NetworkPolicy"},
- {"k8s.io/api/apps/v1beta2.Scale", "io.k8s.api.apps.v1beta2.Scale"},
- {"servicecatalog.k8s.io/foo/bar/v1alpha1.Baz", "io.k8s.servicecatalog.foo.bar.v1alpha1.Baz"},
- }
- for _, test := range tests {
- if got := ToCanonicalName(test.input); got != test.expected {
- t.Errorf("ToCanonicalName(%q) = %v", test.input, got)
- }
- }
-}
-
-type TestType struct{}
-
-func TestGetCanonicalTypeName(t *testing.T) {
-
- var tests = []struct {
- input interface{}
- expected string
- }{
- {TestType{}, "k8s.io/kube-openapi/pkg/util.TestType"},
- {&TestType{}, "k8s.io/kube-openapi/pkg/util.TestType"},
- }
- for _, test := range tests {
- if got := GetCanonicalTypeName(test.input); got != test.expected {
- t.Errorf("GetCanonicalTypeName(%q) = %v", reflect.TypeOf(test.input), got)
- }
- }
-}