1*a65addddSAndroid Build Coastguard Worker#!/usr/bin/env python3 2*a65addddSAndroid Build Coastguard Worker# Copyright 2016 Google Inc. All Rights Reserved. 3*a65addddSAndroid Build Coastguard Worker# 4*a65addddSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License"); 5*a65addddSAndroid Build Coastguard Worker# you may not use this file except in compliance with the License. 6*a65addddSAndroid Build Coastguard Worker# You may obtain a copy of the License at 7*a65addddSAndroid Build Coastguard Worker# 8*a65addddSAndroid Build Coastguard Worker# http://www.apache.org/licenses/LICENSE-2.0 9*a65addddSAndroid Build Coastguard Worker# 10*a65addddSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software 11*a65addddSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS-IS" BASIS, 12*a65addddSAndroid Build Coastguard Worker# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*a65addddSAndroid Build Coastguard Worker# See the License for the specific language governing permissions and 14*a65addddSAndroid Build Coastguard Worker# limitations under the License. 15*a65addddSAndroid Build Coastguard Worker 16*a65addddSAndroid Build Coastguard Workerfrom absl.testing import parameterized 17*a65addddSAndroid Build Coastguard Workerfrom fruit_test_common import * 18*a65addddSAndroid Build Coastguard Worker 19*a65addddSAndroid Build Coastguard WorkerCOMMON_DEFINITIONS = ''' 20*a65addddSAndroid Build Coastguard Worker #include "test_common.h" 21*a65addddSAndroid Build Coastguard Worker 22*a65addddSAndroid Build Coastguard Worker struct X; 23*a65addddSAndroid Build Coastguard Worker 24*a65addddSAndroid Build Coastguard Worker struct Annotation1 {}; 25*a65addddSAndroid Build Coastguard Worker using XAnnot1 = fruit::Annotated<Annotation1, X>; 26*a65addddSAndroid Build Coastguard Worker 27*a65addddSAndroid Build Coastguard Worker struct Annotation2 {}; 28*a65addddSAndroid Build Coastguard Worker using XAnnot2 = fruit::Annotated<Annotation2, X>; 29*a65addddSAndroid Build Coastguard Worker ''' 30*a65addddSAndroid Build Coastguard Worker 31*a65addddSAndroid Build Coastguard Workerclass TestInjector(parameterized.TestCase): 32*a65addddSAndroid Build Coastguard Worker def test_empty_injector(self): 33*a65addddSAndroid Build Coastguard Worker source = ''' 34*a65addddSAndroid Build Coastguard Worker fruit::Component<> getComponent() { 35*a65addddSAndroid Build Coastguard Worker return fruit::createComponent(); 36*a65addddSAndroid Build Coastguard Worker } 37*a65addddSAndroid Build Coastguard Worker 38*a65addddSAndroid Build Coastguard Worker int main() { 39*a65addddSAndroid Build Coastguard Worker fruit::Injector<> injector(getComponent); 40*a65addddSAndroid Build Coastguard Worker } 41*a65addddSAndroid Build Coastguard Worker ''' 42*a65addddSAndroid Build Coastguard Worker expect_success( 43*a65addddSAndroid Build Coastguard Worker COMMON_DEFINITIONS, 44*a65addddSAndroid Build Coastguard Worker source) 45*a65addddSAndroid Build Coastguard Worker 46*a65addddSAndroid Build Coastguard Worker @parameterized.parameters([ 47*a65addddSAndroid Build Coastguard Worker 'X', 48*a65addddSAndroid Build Coastguard Worker 'fruit::Annotated<Annotation1, X>', 49*a65addddSAndroid Build Coastguard Worker ]) 50*a65addddSAndroid Build Coastguard Worker def test_error_component_with_requirements(self, XAnnot): 51*a65addddSAndroid Build Coastguard Worker source = ''' 52*a65addddSAndroid Build Coastguard Worker struct X {}; 53*a65addddSAndroid Build Coastguard Worker 54*a65addddSAndroid Build Coastguard Worker fruit::Component<fruit::Required<XAnnot>> getComponent(); 55*a65addddSAndroid Build Coastguard Worker 56*a65addddSAndroid Build Coastguard Worker void f(fruit::NormalizedComponent<XAnnot> normalizedComponent) { 57*a65addddSAndroid Build Coastguard Worker fruit::Injector<XAnnot> injector(normalizedComponent, getComponent); 58*a65addddSAndroid Build Coastguard Worker } 59*a65addddSAndroid Build Coastguard Worker ''' 60*a65addddSAndroid Build Coastguard Worker expect_compile_error( 61*a65addddSAndroid Build Coastguard Worker 'ComponentWithRequirementsInInjectorError<XAnnot>', 62*a65addddSAndroid Build Coastguard Worker 'When using the two-argument constructor of Injector, the component used as second parameter must not have requirements', 63*a65addddSAndroid Build Coastguard Worker COMMON_DEFINITIONS, 64*a65addddSAndroid Build Coastguard Worker source, 65*a65addddSAndroid Build Coastguard Worker locals()) 66*a65addddSAndroid Build Coastguard Worker 67*a65addddSAndroid Build Coastguard Worker @parameterized.parameters([ 68*a65addddSAndroid Build Coastguard Worker 'X', 69*a65addddSAndroid Build Coastguard Worker 'fruit::Annotated<Annotation1, X>', 70*a65addddSAndroid Build Coastguard Worker ]) 71*a65addddSAndroid Build Coastguard Worker def test_error_declared_types_not_provided(self, XAnnot): 72*a65addddSAndroid Build Coastguard Worker source = ''' 73*a65addddSAndroid Build Coastguard Worker struct X { 74*a65addddSAndroid Build Coastguard Worker using Inject = X(); 75*a65addddSAndroid Build Coastguard Worker }; 76*a65addddSAndroid Build Coastguard Worker 77*a65addddSAndroid Build Coastguard Worker fruit::Component<> getEmptyComponent() { 78*a65addddSAndroid Build Coastguard Worker return fruit::createComponent(); 79*a65addddSAndroid Build Coastguard Worker } 80*a65addddSAndroid Build Coastguard Worker 81*a65addddSAndroid Build Coastguard Worker int main() { 82*a65addddSAndroid Build Coastguard Worker fruit::NormalizedComponent<> normalizedComponent(getEmptyComponent); 83*a65addddSAndroid Build Coastguard Worker fruit::Injector<XAnnot> injector(normalizedComponent, getEmptyComponent); 84*a65addddSAndroid Build Coastguard Worker } 85*a65addddSAndroid Build Coastguard Worker ''' 86*a65addddSAndroid Build Coastguard Worker expect_compile_error( 87*a65addddSAndroid Build Coastguard Worker 'TypesInInjectorNotProvidedError<XAnnot>', 88*a65addddSAndroid Build Coastguard Worker 'The types in TypesNotProvided are declared as provided by the injector, but none of the two components passed to the Injector constructor provides them.', 89*a65addddSAndroid Build Coastguard Worker COMMON_DEFINITIONS, 90*a65addddSAndroid Build Coastguard Worker source, 91*a65addddSAndroid Build Coastguard Worker locals()) 92*a65addddSAndroid Build Coastguard Worker 93*a65addddSAndroid Build Coastguard Worker @parameterized.parameters([ 94*a65addddSAndroid Build Coastguard Worker ('X', 'const X'), 95*a65addddSAndroid Build Coastguard Worker ('fruit::Annotated<Annotation1, X>', 'fruit::Annotated<Annotation1, const X>'), 96*a65addddSAndroid Build Coastguard Worker ]) 97*a65addddSAndroid Build Coastguard Worker def test_error_declared_nonconst_types_provided_as_const(self, XAnnot, ConstXAnnot): 98*a65addddSAndroid Build Coastguard Worker source = ''' 99*a65addddSAndroid Build Coastguard Worker struct X { 100*a65addddSAndroid Build Coastguard Worker using Inject = X(); 101*a65addddSAndroid Build Coastguard Worker }; 102*a65addddSAndroid Build Coastguard Worker 103*a65addddSAndroid Build Coastguard Worker fruit::Component<ConstXAnnot> getComponent(); 104*a65addddSAndroid Build Coastguard Worker 105*a65addddSAndroid Build Coastguard Worker int main() { 106*a65addddSAndroid Build Coastguard Worker fruit::Injector<XAnnot> injector(getComponent); 107*a65addddSAndroid Build Coastguard Worker } 108*a65addddSAndroid Build Coastguard Worker ''' 109*a65addddSAndroid Build Coastguard Worker expect_generic_compile_error( 110*a65addddSAndroid Build Coastguard Worker r'no matching constructor for initialization of .fruit::Injector<XAnnot>.' 111*a65addddSAndroid Build Coastguard Worker r'|no matching function for call to .fruit::Injector<XAnnot>::Injector\(fruit::Component<ConstXAnnot> \(&\)\(\)\).' 112*a65addddSAndroid Build Coastguard Worker # MSVC 113*a65addddSAndroid Build Coastguard Worker r'|.fruit::Injector<XAnnot>::Injector.: no overloaded function could convert all the argument types' 114*a65addddSAndroid Build Coastguard Worker r'|.fruit::Injector<XAnnot>::Injector.: none of the 2 overloads could convert all the argument types', 115*a65addddSAndroid Build Coastguard Worker COMMON_DEFINITIONS, 116*a65addddSAndroid Build Coastguard Worker source, 117*a65addddSAndroid Build Coastguard Worker locals()) 118*a65addddSAndroid Build Coastguard Worker 119*a65addddSAndroid Build Coastguard Worker @parameterized.parameters([ 120*a65addddSAndroid Build Coastguard Worker ('X', 'const X'), 121*a65addddSAndroid Build Coastguard Worker ('fruit::Annotated<Annotation1, X>', 'fruit::Annotated<Annotation1, const X>'), 122*a65addddSAndroid Build Coastguard Worker ]) 123*a65addddSAndroid Build Coastguard Worker def test_error_declared_nonconst_types_provided_as_const_with_normalized_component(self, XAnnot, ConstXAnnot): 124*a65addddSAndroid Build Coastguard Worker source = ''' 125*a65addddSAndroid Build Coastguard Worker struct X {}; 126*a65addddSAndroid Build Coastguard Worker 127*a65addddSAndroid Build Coastguard Worker fruit::Component<> getEmptyComponent(); 128*a65addddSAndroid Build Coastguard Worker 129*a65addddSAndroid Build Coastguard Worker void f(fruit::NormalizedComponent<ConstXAnnot> normalizedComponent) { 130*a65addddSAndroid Build Coastguard Worker fruit::Injector<XAnnot> injector(normalizedComponent, getEmptyComponent); 131*a65addddSAndroid Build Coastguard Worker } 132*a65addddSAndroid Build Coastguard Worker ''' 133*a65addddSAndroid Build Coastguard Worker expect_compile_error( 134*a65addddSAndroid Build Coastguard Worker 'TypesInInjectorProvidedAsConstOnlyError<XAnnot>', 135*a65addddSAndroid Build Coastguard Worker 'The types in TypesProvidedAsConstOnly are declared as non-const provided types by the injector', 136*a65addddSAndroid Build Coastguard Worker COMMON_DEFINITIONS, 137*a65addddSAndroid Build Coastguard Worker source, 138*a65addddSAndroid Build Coastguard Worker locals()) 139*a65addddSAndroid Build Coastguard Worker 140*a65addddSAndroid Build Coastguard Worker @parameterized.parameters([ 141*a65addddSAndroid Build Coastguard Worker ('X', 'Y'), 142*a65addddSAndroid Build Coastguard Worker ('fruit::Annotated<Annotation1, X>', 'fruit::Annotated<Annotation2, Y>'), 143*a65addddSAndroid Build Coastguard Worker ]) 144*a65addddSAndroid Build Coastguard Worker def test_injector_get_error_type_not_provided(self, XAnnot, YAnnot): 145*a65addddSAndroid Build Coastguard Worker source = ''' 146*a65addddSAndroid Build Coastguard Worker struct X { 147*a65addddSAndroid Build Coastguard Worker using Inject = X(); 148*a65addddSAndroid Build Coastguard Worker }; 149*a65addddSAndroid Build Coastguard Worker 150*a65addddSAndroid Build Coastguard Worker struct Y {}; 151*a65addddSAndroid Build Coastguard Worker 152*a65addddSAndroid Build Coastguard Worker fruit::Component<XAnnot> getComponent() { 153*a65addddSAndroid Build Coastguard Worker return fruit::createComponent(); 154*a65addddSAndroid Build Coastguard Worker } 155*a65addddSAndroid Build Coastguard Worker 156*a65addddSAndroid Build Coastguard Worker int main() { 157*a65addddSAndroid Build Coastguard Worker fruit::Injector<XAnnot> injector(getComponent); 158*a65addddSAndroid Build Coastguard Worker injector.get<YAnnot>(); 159*a65addddSAndroid Build Coastguard Worker } 160*a65addddSAndroid Build Coastguard Worker ''' 161*a65addddSAndroid Build Coastguard Worker expect_compile_error( 162*a65addddSAndroid Build Coastguard Worker 'TypeNotProvidedError<YAnnot>', 163*a65addddSAndroid Build Coastguard Worker 'Trying to get an instance of T, but it is not provided by this Provider/Injector.', 164*a65addddSAndroid Build Coastguard Worker COMMON_DEFINITIONS, 165*a65addddSAndroid Build Coastguard Worker source, 166*a65addddSAndroid Build Coastguard Worker locals()) 167*a65addddSAndroid Build Coastguard Worker 168*a65addddSAndroid Build Coastguard Worker @parameterized.parameters([ 169*a65addddSAndroid Build Coastguard Worker ('const X', 'X&', r'X&'), 170*a65addddSAndroid Build Coastguard Worker ('const X', 'X*', r'X\*'), 171*a65addddSAndroid Build Coastguard Worker ('const X', 'std::shared_ptr<X>', r'std::shared_ptr<X>'), 172*a65addddSAndroid Build Coastguard Worker ('fruit::Annotated<Annotation1, const X>', 'fruit::Annotated<Annotation1, X&>', r'fruit::Annotated<Annotation1, X&>'), 173*a65addddSAndroid Build Coastguard Worker ('fruit::Annotated<Annotation1, const X>', 'fruit::Annotated<Annotation1, X*>', r'fruit::Annotated<Annotation1, X\*>'), 174*a65addddSAndroid Build Coastguard Worker ('fruit::Annotated<Annotation1, const X>', 'fruit::Annotated<Annotation1, std::shared_ptr<X>>', r'fruit::Annotated<Annotation1, std::shared_ptr<X>>'), 175*a65addddSAndroid Build Coastguard Worker ]) 176*a65addddSAndroid Build Coastguard Worker def test_injector_const_provided_type_does_not_allow_injecting_nonconst_variants(self, ConstXAnnot, XInjectorGetParam, XInjectorGetParamRegex): 177*a65addddSAndroid Build Coastguard Worker source = ''' 178*a65addddSAndroid Build Coastguard Worker void f(fruit::Injector<ConstXAnnot> injector) { 179*a65addddSAndroid Build Coastguard Worker injector.get<XInjectorGetParam>(); 180*a65addddSAndroid Build Coastguard Worker } 181*a65addddSAndroid Build Coastguard Worker ''' 182*a65addddSAndroid Build Coastguard Worker expect_compile_error( 183*a65addddSAndroid Build Coastguard Worker 'TypeProvidedAsConstOnlyError<XInjectorGetParamRegex>', 184*a65addddSAndroid Build Coastguard Worker 'Trying to get an instance of T, but it is only provided as a constant by this Provider/Injector', 185*a65addddSAndroid Build Coastguard Worker COMMON_DEFINITIONS, 186*a65addddSAndroid Build Coastguard Worker source, 187*a65addddSAndroid Build Coastguard Worker locals()) 188*a65addddSAndroid Build Coastguard Worker 189*a65addddSAndroid Build Coastguard Worker @parameterized.parameters([ 190*a65addddSAndroid Build Coastguard Worker ('X', 'X'), 191*a65addddSAndroid Build Coastguard Worker ('X', 'const X&'), 192*a65addddSAndroid Build Coastguard Worker ('X', 'const X*'), 193*a65addddSAndroid Build Coastguard Worker ('X', 'X&'), 194*a65addddSAndroid Build Coastguard Worker ('X', 'X*'), 195*a65addddSAndroid Build Coastguard Worker ('X', 'std::shared_ptr<X>'), 196*a65addddSAndroid Build Coastguard Worker ('fruit::Annotated<Annotation1, X>', 'fruit::Annotated<Annotation1, X>'), 197*a65addddSAndroid Build Coastguard Worker ('fruit::Annotated<Annotation1, X>', 'fruit::Annotated<Annotation1, const X&>'), 198*a65addddSAndroid Build Coastguard Worker ('fruit::Annotated<Annotation1, X>', 'fruit::Annotated<Annotation1, const X*>'), 199*a65addddSAndroid Build Coastguard Worker ('fruit::Annotated<Annotation1, X>', 'fruit::Annotated<Annotation1, X&>'), 200*a65addddSAndroid Build Coastguard Worker ('fruit::Annotated<Annotation1, X>', 'fruit::Annotated<Annotation1, X*>'), 201*a65addddSAndroid Build Coastguard Worker ('fruit::Annotated<Annotation1, X>', 'fruit::Annotated<Annotation1, std::shared_ptr<X>>'), 202*a65addddSAndroid Build Coastguard Worker ]) 203*a65addddSAndroid Build Coastguard Worker def test_injector_get_ok(self, XBindingInInjector, XInjectorGetParam): 204*a65addddSAndroid Build Coastguard Worker source = ''' 205*a65addddSAndroid Build Coastguard Worker struct X { 206*a65addddSAndroid Build Coastguard Worker using Inject = X(); 207*a65addddSAndroid Build Coastguard Worker }; 208*a65addddSAndroid Build Coastguard Worker 209*a65addddSAndroid Build Coastguard Worker fruit::Component<XBindingInInjector> getComponent() { 210*a65addddSAndroid Build Coastguard Worker return fruit::createComponent(); 211*a65addddSAndroid Build Coastguard Worker } 212*a65addddSAndroid Build Coastguard Worker 213*a65addddSAndroid Build Coastguard Worker int main() { 214*a65addddSAndroid Build Coastguard Worker fruit::Injector<XBindingInInjector> injector(getComponent); 215*a65addddSAndroid Build Coastguard Worker 216*a65addddSAndroid Build Coastguard Worker auto x = injector.get<XInjectorGetParam>(); 217*a65addddSAndroid Build Coastguard Worker (void)x; 218*a65addddSAndroid Build Coastguard Worker } 219*a65addddSAndroid Build Coastguard Worker ''' 220*a65addddSAndroid Build Coastguard Worker expect_success( 221*a65addddSAndroid Build Coastguard Worker COMMON_DEFINITIONS, 222*a65addddSAndroid Build Coastguard Worker source, 223*a65addddSAndroid Build Coastguard Worker locals()) 224*a65addddSAndroid Build Coastguard Worker 225*a65addddSAndroid Build Coastguard Worker @parameterized.parameters([ 226*a65addddSAndroid Build Coastguard Worker ('const X', 'X'), 227*a65addddSAndroid Build Coastguard Worker ('const X', 'const X&'), 228*a65addddSAndroid Build Coastguard Worker ('const X', 'const X*'), 229*a65addddSAndroid Build Coastguard Worker ('fruit::Annotated<Annotation1, const X>', 'fruit::Annotated<Annotation1, X>'), 230*a65addddSAndroid Build Coastguard Worker ('fruit::Annotated<Annotation1, const X>', 'fruit::Annotated<Annotation1, const X&>'), 231*a65addddSAndroid Build Coastguard Worker ('fruit::Annotated<Annotation1, const X>', 'fruit::Annotated<Annotation1, const X*>'), 232*a65addddSAndroid Build Coastguard Worker ]) 233*a65addddSAndroid Build Coastguard Worker def test_injector_get_const_binding_ok(self, XBindingInInjector, XInjectorGetParam): 234*a65addddSAndroid Build Coastguard Worker XBindingInInjectorWithoutConst = XBindingInInjector.replace('const ', '') 235*a65addddSAndroid Build Coastguard Worker source = ''' 236*a65addddSAndroid Build Coastguard Worker struct X {}; 237*a65addddSAndroid Build Coastguard Worker 238*a65addddSAndroid Build Coastguard Worker const X x{}; 239*a65addddSAndroid Build Coastguard Worker 240*a65addddSAndroid Build Coastguard Worker fruit::Component<XBindingInInjector> getComponent() { 241*a65addddSAndroid Build Coastguard Worker return fruit::createComponent() 242*a65addddSAndroid Build Coastguard Worker .bindInstance<XBindingInInjectorWithoutConst, X>(x); 243*a65addddSAndroid Build Coastguard Worker } 244*a65addddSAndroid Build Coastguard Worker 245*a65addddSAndroid Build Coastguard Worker int main() { 246*a65addddSAndroid Build Coastguard Worker fruit::Injector<XBindingInInjector> injector(getComponent); 247*a65addddSAndroid Build Coastguard Worker 248*a65addddSAndroid Build Coastguard Worker auto x = injector.get<XInjectorGetParam>(); 249*a65addddSAndroid Build Coastguard Worker (void)x; 250*a65addddSAndroid Build Coastguard Worker } 251*a65addddSAndroid Build Coastguard Worker ''' 252*a65addddSAndroid Build Coastguard Worker expect_success( 253*a65addddSAndroid Build Coastguard Worker COMMON_DEFINITIONS, 254*a65addddSAndroid Build Coastguard Worker source, 255*a65addddSAndroid Build Coastguard Worker locals()) 256*a65addddSAndroid Build Coastguard Worker 257*a65addddSAndroid Build Coastguard Worker @parameterized.parameters([ 258*a65addddSAndroid Build Coastguard Worker ('X**', r'X\*\*'), 259*a65addddSAndroid Build Coastguard Worker ('std::shared_ptr<X>*', r'std::shared_ptr<X>\*'), 260*a65addddSAndroid Build Coastguard Worker ('const std::shared_ptr<X>', r'const std::shared_ptr<X>'), 261*a65addddSAndroid Build Coastguard Worker ('X* const', r'X\* const'), 262*a65addddSAndroid Build Coastguard Worker ('const X* const', r'const X\* const'), 263*a65addddSAndroid Build Coastguard Worker ('std::nullptr_t', r'(std::)?nullptr(_t)?'), 264*a65addddSAndroid Build Coastguard Worker ('X*&', r'X\*&'), 265*a65addddSAndroid Build Coastguard Worker ('X(*)()', r'X(\((__cdecl)?\*\))?\((void)?\)'), 266*a65addddSAndroid Build Coastguard Worker ('void', r'void'), 267*a65addddSAndroid Build Coastguard Worker ('fruit::Annotated<Annotation1, X**>', r'X\*\*'), 268*a65addddSAndroid Build Coastguard Worker ]) 269*a65addddSAndroid Build Coastguard Worker def test_injector_get_error_type_not_injectable(self, XVariant, XVariantRegex): 270*a65addddSAndroid Build Coastguard Worker source = ''' 271*a65addddSAndroid Build Coastguard Worker struct X {}; 272*a65addddSAndroid Build Coastguard Worker 273*a65addddSAndroid Build Coastguard Worker void f(fruit::Injector<X> injector) { 274*a65addddSAndroid Build Coastguard Worker injector.get<XVariant>(); 275*a65addddSAndroid Build Coastguard Worker } 276*a65addddSAndroid Build Coastguard Worker ''' 277*a65addddSAndroid Build Coastguard Worker expect_compile_error( 278*a65addddSAndroid Build Coastguard Worker 'NonInjectableTypeError<XVariantRegex>', 279*a65addddSAndroid Build Coastguard Worker 'The type T is not injectable.', 280*a65addddSAndroid Build Coastguard Worker COMMON_DEFINITIONS, 281*a65addddSAndroid Build Coastguard Worker source, 282*a65addddSAndroid Build Coastguard Worker locals()) 283*a65addddSAndroid Build Coastguard Worker 284*a65addddSAndroid Build Coastguard Worker @parameterized.parameters([ 285*a65addddSAndroid Build Coastguard Worker ('X[]', r'X\[\]'), 286*a65addddSAndroid Build Coastguard Worker ]) 287*a65addddSAndroid Build Coastguard Worker def test_injector_get_error_array_type(self, XVariant, XVariantRegex): 288*a65addddSAndroid Build Coastguard Worker source = ''' 289*a65addddSAndroid Build Coastguard Worker struct X {}; 290*a65addddSAndroid Build Coastguard Worker 291*a65addddSAndroid Build Coastguard Worker void f(fruit::Injector<X> injector) { 292*a65addddSAndroid Build Coastguard Worker injector.get<XVariant>(); 293*a65addddSAndroid Build Coastguard Worker } 294*a65addddSAndroid Build Coastguard Worker ''' 295*a65addddSAndroid Build Coastguard Worker expect_generic_compile_error( 296*a65addddSAndroid Build Coastguard Worker 'function cannot return array type' 297*a65addddSAndroid Build Coastguard Worker '|function returning an array' 298*a65addddSAndroid Build Coastguard Worker # MSVC 299*a65addddSAndroid Build Coastguard Worker '|.fruit::Injector<X>::get.: no matching overloaded function found', 300*a65addddSAndroid Build Coastguard Worker COMMON_DEFINITIONS, 301*a65addddSAndroid Build Coastguard Worker source, 302*a65addddSAndroid Build Coastguard Worker locals()) 303*a65addddSAndroid Build Coastguard Worker 304*a65addddSAndroid Build Coastguard Workerif __name__ == '__main__': 305*a65addddSAndroid Build Coastguard Worker absltest.main() 306