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

update README #14

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Changes from all commits
Commits
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
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,35 @@ You can also specify array of expected values and use it in your test.
}
```

Because for example above names of test methods looks weird, You can use `labels` parameter to use custom naming.

```swift
@Parametrize(
input: [APIEndpoint.order("2345")],
output: ["https://example.com/api/order/2345"]),
labels: ["order"])
func testEndpointURL(input endpoint: APIEndpoint, output expectedUrl: String) throws {
XCTAssertEqual(endpoint.buildURL?.absoluteString, expectedUrl)
}
```

Macro will generate following test method.
```swift
func testEndpointURL_order() throws {
let endpoint: APIEndpoint = APIEndpoint.order("2345")
let expectedUrl: String =
"https://example.com/api/order/2345"
XCTAssertEqual(endpoint.buildURL?.absoluteString, expectedUrl)
}
```

## Features

- [x] Primitive types as input values (like Int, Double, String and Bool)
- [x] Custom objects as input values (like structs, classes and enums)
- [x] Diagnostics for error handling
- [x] Expected output array of objects/values
- [ ] Labels for paramter values like: `@Parametrize(input: [3.14, 2.71], labels: ["pi", "e"])`
- [x] Labels for paramter values like: `@Parametrize(input: [3.14, 2.71], labels: ["pi", "e"])`

## License
XCTestParametrizedMacro is released under an MIT license. See [LICENSE](LICENSE)