aboutsummaryrefslogtreecommitdiff
path: root/tests/test_register_constructor.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_register_constructor.py')
-rwxr-xr-xtests/test_register_constructor.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/test_register_constructor.py b/tests/test_register_constructor.py
index 3e5137e..b78191f 100755
--- a/tests/test_register_constructor.py
+++ b/tests/test_register_constructor.py
@@ -587,5 +587,46 @@ class TestRegisterConstructor(parameterized.TestCase):
source,
locals())
+ def test_register_constructor_error_assisted_param(self):
+ source = '''
+ struct X {
+ INJECT(X(ASSISTED(double) factor)) {
+ (void) factor;
+ }
+ };
+
+ fruit::Component<X> getComponent() {
+ return fruit::createComponent()
+ .registerConstructor<X(fruit::Assisted<double>)>();
+ }
+ '''
+ expect_compile_error(
+ 'AssistedParamInRegisterConstructorSignatureError<X\\(fruit::Assisted<double>\\)>',
+ 'CandidateSignature was used as signature for a registerConstructor.* but it contains an assisted parameter.',
+ COMMON_DEFINITIONS,
+ source,
+ locals())
+
+ def test_implicit_register_constructor_error_assisted_param(self):
+ source = '''
+ struct X {
+ INJECT(X(ASSISTED(double) factor)) {
+ (void) factor;
+ }
+ };
+
+ fruit::Component<X> getComponent() {
+ return fruit::createComponent();
+ }
+ '''
+ expect_compile_error(
+ 'AssistedParamInRegisterConstructorSignatureError<X\\(fruit::Assisted<double>\\)>',
+ 'CandidateSignature was used as signature for a registerConstructor.* but it contains an assisted parameter.',
+ COMMON_DEFINITIONS,
+ source,
+ locals())
+
+
+
if __name__ == '__main__':
absltest.main()