Skip to content

Generate unit test for functions with variable semantics #1927

Closed
@nathan-boulestin

Description

@nathan-boulestin

Is your feature request related to a problem? Please describe.
We declare functions with the variable semantics to make mocking a lot easier.
For example we will declare var MyFunc= func() instead of func MyFunc()
The commands for generating unit tests does not recognize this semantic as functions and does no generate any unit test template.

Describe the solution you'd like
I would like the commands for generating units tests to also work for the variable semantic.
So a function declared var MyFunc= func() would produce the same unit test as func MyFunc().

Describe alternatives you've considered
As an alternative I made a regex to convert functions to each declaration semantic using text replace:
var MyFunc= func() -> func MyFunc():
match: var ([a-zA-Z]*) = func(\([a-zA-Z\s\.\*]*\))
replace: func $1$2

func MyFunc() -> var MyFunc= func():
match: func ([a-zA-Z]*)(\([a-zA-Z\s\.\*]*\))
replace: var $1 = func$2

I have to convert the functions, use the generate unit tests command, and then convert back the functions semantic.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions