Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Add support for Obj-C and partial mocks #217

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
a03c2e4
Add initial support for mocking Obj-C types
andrewchang-bird Jul 19, 2021
ae9bbc4
Support verifying Obj-C mock invocations
andrewchang-bird Jul 19, 2021
d276cb4
Clean up invocation return value and arg handling
andrewchang-bird Jul 20, 2021
b1b9ae2
Support Obj-C argument captor matchers
andrewchang-bird Jul 20, 2021
87322f3
Add test target to generator and framework schemes
andrewchang-bird Jul 20, 2021
dde03e7
Support wildcard argument matching on primitives
andrewchang-bird Jul 20, 2021
409d8a8
Fix regression with inOrder verification blocks
andrewchang-bird Jul 20, 2021
083d8eb
Migrate to wrapped argument index API
andrewchang-bird Jul 20, 2021
aca3112
Clean up Obj-C stubbing and verification files
andrewchang-bird Jul 20, 2021
e8f9d92
Support @objc Swift throwing methods
andrewchang-bird Jul 21, 2021
99341d9
Improve argument index error site inline docs
andrewchang-bird Jul 21, 2021
d15b5d3
Improve Obj-C to Swift error interoperability
andrewchang-bird Jul 21, 2021
9bd9749
Add tests for throwing in non-throwing methods
andrewchang-bird Jul 21, 2021
e3b4f0e
Add docs and support closures that throw
andrewchang-bird Jul 21, 2021
f771eab
Reduce max supported Obj-C closure args to 10
andrewchang-bird Jul 21, 2021
b6e5fcd
Migrate to new proxied calling convention (WIP)
andrewchang-bird Jul 23, 2021
3696830
Clean up generic static mock context handling
andrewchang-bird Jul 23, 2021
23631ff
Additional changes to support proxy API
andrewchang-bird Jul 23, 2021
f68bbf9
Revert back to thick thunks and remove proxy API
andrewchang-bird Jul 25, 2021
1c4ddc0
Fix initializer proxy formatting
andrewchang-bird Jul 23, 2021
366cd1a
Clean up compilation directive formatting
andrewchang-bird Jul 23, 2021
a3b542c
Fix thunk generation for variables
andrewchang-bird Jul 25, 2021
50e6439
Clean up error throwing stubbing tests
andrewchang-bird Jul 25, 2021
b630398
Replace TestFailer hack with Obj-C exceptions
andrewchang-bird Jul 25, 2021
b2f42cb
Add basic support for per-member call proxying
andrewchang-bird Jul 25, 2021
3d6dd58
Add initial tests for partial mocks
andrewchang-bird Jul 25, 2021
c094eb8
Add initial support for partial mocking
andrewchang-bird Jul 26, 2021
b3c6d68
Fix Obj-C type erasure bridging for @objc Swift
andrewchang-bird Jul 26, 2021
750a382
Handle throwing closures in @objc Swift classes
andrewchang-bird Jul 26, 2021
7a2524f
Refactor InvocationRecorder to Obj-C exceptions
andrewchang-bird Jul 26, 2021
5e4a5be
Add tests for the new inline property syntax
andrewchang-bird Jul 26, 2021
53d6b31
Refactor TypeFacade to use Obj-C exceptions
andrewchang-bird Jul 26, 2021
9f36d59
Add docs on using invocation forwarding
andrewchang-bird Jul 26, 2021
d5f61e3
Gate NS* and CG* preset value providers
andrewchang-bird Jul 28, 2021
587c48d
Update docs to use the new inline property syntax
andrewchang-bird Jul 28, 2021
1eac792
Support verifying @objc Swift methods that throw
andrewchang-bird Jul 28, 2021
231a96c
Fix Obj-C compat with closure implementations
andrewchang-bird Jul 29, 2021
f4b6e9f
Clean up and improve testing around Obj-C support
andrewchang-bird Jul 29, 2021
5af36d8
Support forwarding invocations in Obj-C mocks
andrewchang-bird Jul 29, 2021
3564689
Support default value providers in Obj-C mocks
andrewchang-bird Jul 30, 2021
eee2957
Allow implicit wildcard argument matcher indexes
andrewchang-bird Jul 31, 2021
2e5c932
Update README and inline docs
andrewchang-bird Jul 30, 2021
31f24d2
Fix build errors specific to GitHub Actions
andrewchang-bird Aug 2, 2021
b420717
Fix argument label handling for subscripts
andrewchang-bird Aug 2, 2021
620d944
Fix compatibility issues with Swift 5.3
andrewchang-bird Aug 5, 2021
4514a70
Improve partial class mock tests
andrewchang-bird Aug 5, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 1 addition & 39 deletions .github/workflows/build-framework-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
--disable-cache \
--diagnostics all \
--loglevel verbose \
--prune stub \
--prune disable \
--verbose
- name: Test All Thunks
run: make clean-test
Expand Down Expand Up @@ -107,41 +107,3 @@ jobs:
run: make clean-test
- name: Cached Test
run: make test

build-xcode-11_7:
name: Xcode 11.7 toolchain
runs-on: macOS-latest

steps:
- uses: actions/checkout@v2
- name: Set Up Environment
run: sudo xcode-select -s /Applications/Xcode_11.7.app/Contents/Developer
- name: Print Debug Info
run: make print-debug-info
- name: Set Up Project
run: make setup-project
- name: Clean
run: make clean
- name: Build Framework
run: make build-framework
- name: Build and Install CLI
run: |
make print-debug-info | grep "Mockingbird rpath: /var/tmp/mockingbird/$(make get-version)/libs"
PREFIX=$(pwd) HERMETIC=1 make print-debug-info
PREFIX=$(pwd) HERMETIC=1 make install
- name: Set Up Target
run: |
./bin/mockingbird install \
--target MockingbirdTests \
--source MockingbirdTestsHost \
--support Sources/MockingbirdSupport \
--output Tests/MockingbirdTests/Mocks/MockingbirdTestsHostMocks.generated.swift \
--header '// Header line 1' '// Header line 2' \
--diagnostics all \
--loglevel verbose \
--prune stub \
--verbose
- name: Test
run: make clean-test
- name: Cached Test
run: make test
1 change: 1 addition & 0 deletions .xcode/xcconfigs/MockingbirdFramework.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ TARGET_NAME = Mockingbird
ENABLE_BITCODE = NO
SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator appletvos appletvsimulator
BUILD_LIBRARY_FOR_DISTRIBUTION = YES
DEFINES_MODULE = YES
Binary file removed Images/mockingbird-hero-image.png
Binary file not shown.
470 changes: 447 additions & 23 deletions Mockingbird.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "Mockingbird::MockingbirdTests"
BuildableName = "MockingbirdTests.xctest"
BlueprintName = "MockingbirdTests"
ReferencedContainer = "container:Mockingbird.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
Expand Down
Loading