Skip to content

Commit

Permalink
update README (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkowalski87 authored Nov 15, 2023
1 parent ad6e977 commit 78794b0
Showing 1 changed file with 23 additions and 1 deletion.
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)

0 comments on commit 78794b0

Please sign in to comment.