-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed support for derived classes defined in WinRT. (#108)
- Loading branch information
1 parent
e1f4746
commit 298c5dc
Showing
12 changed files
with
261 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import COM | ||
import XCTest | ||
import WinRTComponent | ||
|
||
class ClassInheritanceTests : XCTestCase { | ||
public func testOverridableMemberOnBaseClass() throws { | ||
// Created from Swift | ||
XCTAssertEqual(try MinimalBaseClass()._typeName(), "MinimalBaseClass") | ||
XCTAssertEqual(try MinimalBaseClass.getTypeName(MinimalBaseClass()), "MinimalBaseClass") | ||
|
||
// Created from WinRT | ||
XCTAssertEqual(try MinimalBaseClass.createBase()._typeName(), "MinimalBaseClass") | ||
XCTAssertEqual(try MinimalBaseClass.getTypeName(MinimalBaseClass.createBase()), "MinimalBaseClass") | ||
} | ||
|
||
public func testOverridenMemberInWinRTDerivedClass() throws { | ||
// Created from Swift | ||
XCTAssertEqual(try MinimalDerivedClass()._typeName(), "MinimalDerivedClass") | ||
XCTAssertEqual(try MinimalBaseClass.getTypeName(MinimalDerivedClass()), "MinimalDerivedClass") | ||
|
||
// Created from WinRT | ||
XCTAssertEqual(try MinimalDerivedClass.createDerived()._typeName(), "MinimalDerivedClass") | ||
XCTAssertEqual(try MinimalBaseClass.getTypeName(MinimalDerivedClass.createDerived()), "MinimalDerivedClass") | ||
} | ||
|
||
public func testOverridenMemberInWinRTPrivateClass() throws { | ||
XCTAssertEqual(try MinimalBaseClass.createPrivate()._typeName(), "PrivateClass") | ||
XCTAssertEqual(try MinimalBaseClass.getTypeName(MinimalBaseClass.createPrivate()), "PrivateClass") | ||
} | ||
|
||
public func testOverridenMemberInSwiftClass() throws { | ||
class SwiftDerived: MinimalBaseClass { | ||
public override init() throws { try super.init() } | ||
public override func _typeName() throws -> String { "SwiftDerived" } | ||
} | ||
|
||
XCTAssertEqual(try SwiftDerived()._typeName(), "SwiftDerived") | ||
XCTAssertEqual(try MinimalBaseClass.getTypeName(SwiftDerived()), "SwiftDerived") | ||
} | ||
|
||
public func testOverridenMemberInSwiftClassDerivedFromWinRTDerivedClass() throws { | ||
class SwiftDerived2: MinimalDerivedClass { | ||
public override init() throws { try super.init() } | ||
public override func _typeName() throws -> String { "SwiftDerived2" } | ||
} | ||
|
||
XCTAssertEqual(try SwiftDerived2()._typeName(), "SwiftDerived2") | ||
XCTAssertEqual(try MinimalBaseClass.getTypeName(SwiftDerived2()), "SwiftDerived2") | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.