From 7b44a6ed7cf2f56947bb1be55a408ccffa773fe6 Mon Sep 17 00:00:00 2001 From: Tsungyu Yu Date: Thu, 3 Sep 2020 17:23:33 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=20add=20create=20by=20void=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/SwiftBuilder/CreateByVoid.swift | 2 +- .../SwiftBuilderCreateByVoidTests.swift | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 Tests/SwiftBuilderTests/SwiftBuilderCreateByVoidTests.swift diff --git a/Sources/SwiftBuilder/CreateByVoid.swift b/Sources/SwiftBuilder/CreateByVoid.swift index 906162a..59a493b 100644 --- a/Sources/SwiftBuilder/CreateByVoid.swift +++ b/Sources/SwiftBuilder/CreateByVoid.swift @@ -12,7 +12,7 @@ public protocol CreateByVoid { } extension Builder: CreateByVoid where Subject: CreateByVoid{ public init() { - subject = .init() + subject = Subject() } } diff --git a/Tests/SwiftBuilderTests/SwiftBuilderCreateByVoidTests.swift b/Tests/SwiftBuilderTests/SwiftBuilderCreateByVoidTests.swift new file mode 100644 index 0000000..69ccb14 --- /dev/null +++ b/Tests/SwiftBuilderTests/SwiftBuilderCreateByVoidTests.swift @@ -0,0 +1,20 @@ +// +// File.swift +// +// +// Created by 游宗諭 on 2020/9/3. +// + +import XCTest +import SwiftBuilder +class SwiftBuilderCreateByVoidTests: XCTestCase { + struct Target:CreateByVoid { + var i = 0 + } + func testBuildByVoid() { + let target:Target = Builder() + .build() + XCTAssertEqual(target.i, 0) + } +} +