Commit Graph

9 Commits

Author SHA1 Message Date
Kabir Oberai 4148a6a7ff Support effectful properties 2023-04-11 23:17:51 +02:00
Seth Deckard 6f41152d83
Fix Generator to handle reserved keywords
Allows for reserved keywords to be used as argument labels / parameters
in mocked types.

Fixes: https://github.com/Brightify/Cuckoo/issues/452

- Moves escaping util function to Utils and makes it internal since it
  now needs to be used outside of `Generator`.
- Uses escaping function in areas affected by the bug.
- Renames set of reserved names to reflect the larger scope (no longer
  used for just function names).
- Some minor clean-up to style and formatting on areas touched.

Example of the problem:

Generate a mock for a protocol with the function:

```
func escape(for: String) -> String
```

This would result in `for` as a function parameter used within the body
of the function for the mock and verification and stubbing proxies,
which would not compile. This change escapes keywords like this so the
generated code will compile.

See `TestedProtocol.withReservedKeywords` for a test example. An example
was added to `TestedClass` as well, but the real motivation for this is
protocols since conforming types can and often do use a different
parameter name so the argument label like `for` would never be used
within the body of the function.
2023-03-23 08:31:12 -04:00
David Steinacher f0f77397a5 add missing () when closure is an autoclosure 2023-02-12 16:30:21 +01:00
Matyáš Kříž 835c61246a Completely convert project to Tuist. 2023-01-07 18:58:48 +01:00
sk409 5a9301b97c Remove closure argument name. 2022-09-01 17:00:52 +02:00
Yoji Ueda 0ff327d675 Remove unnecessary await expression in MockTemplate. 2022-08-16 16:42:21 +02:00
sk409 3f6e9a84e8 Add support for multiline method signatures. 2022-06-17 18:23:07 +02:00
Matyáš Kříž 0259cd8730 Remove unnecessary whitespace in tests. 2021-07-22 16:24:45 +02:00
Matyáš Kříž 5afae85bbe Integrate `tuist`. 2020-04-01 15:07:38 +02:00