From 7d847d0c1202d7cdc76897b5e2235ef2484ae357 Mon Sep 17 00:00:00 2001 From: kenta okamura Date: Sun, 14 Jun 2026 22:00:31 +0900 Subject: [PATCH] Add test case for initializer with function type in its generic type --- Tests/TestInit/FixtureInit.swift | 18 ++++++++++++++++++ Tests/TestInit/InitTests.swift | 7 +++++++ 2 files changed, 25 insertions(+) diff --git a/Tests/TestInit/FixtureInit.swift b/Tests/TestInit/FixtureInit.swift index aca4a2be..55ffa213 100644 --- a/Tests/TestInit/FixtureInit.swift +++ b/Tests/TestInit/FixtureInit.swift @@ -354,3 +354,21 @@ class MyProtocolMock: MyProtocol { } } """ + +@Fixture enum initWithDictionaryThatHasFunction { + /// @mockable + protocol Tester { + var testDictionary: [String: () -> String] { get } + } + + @Fixture enum expected { + class TesterMock: Tester { + init() { } + init(testDictionary: [String: () -> String] = [String: () -> String]()) { + self.testDictionary = testDictionary + } + + var testDictionary: [String: () -> String] = [String: () -> String]() + } + } +} diff --git a/Tests/TestInit/InitTests.swift b/Tests/TestInit/InitTests.swift index 2a8da0b0..9306e08c 100644 --- a/Tests/TestInit/InitTests.swift +++ b/Tests/TestInit/InitTests.swift @@ -55,4 +55,11 @@ class InitTests: MockoloTestCase { dstContent: typedThrowableInitMock ) } + + func testInitWithDictionaryThatHasFunction() { + verify( + srcContent: initWithDictionaryThatHasFunction._source, + dstContent: initWithDictionaryThatHasFunction.expected._source + ) + } }