-
Notifications
You must be signed in to change notification settings - Fork 64
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
feat(lang): show expected output for examples #27
Conversation
@princjef This should be ready to merge. I don't know why the pipeline's failing, but my guess is it's not directly connected to the changes I made. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice change :) As long as we can make the output look reasonable for examples with no output I'm good with it.
0ec9917
to
1fdfc24
Compare
Support for empty output has been added. Given the following examples: func ExampleHello() {
fmt.Println(Hello("foo"))
// Output: Hello foo!
}
func ExampleHello_noOutput() {
_ = Hello("foo")
}
func ExampleHello_comments() {
_ = Hello("foo")
// This returns a hello string
} The output looks like this: <details><summary>Example</summary>
<p>
```go
{
fmt.Println(Hello("foo"))
}
```
#### Output
```
Hello foo!
```
</p>
</details>
<details><summary>Example</summary>
<p>
```go
{
_ = Hello("foo")
}
```
</p>
</details>
<details><summary>Example</summary>
<p>
```go
{
_ = Hello("foo")
}
```
</p>
</details> |
Signed-off-by: Trevor Taubitz <[email protected]>
Signed-off-by: Trevor Taubitz <[email protected]>
Signed-off-by: Trevor Taubitz <[email protected]>
Signed-off-by: Trevor Taubitz <[email protected]>
@princjef This should be good for another round of review. I have added support for empty outputs, as well as rebased on the latest master branch to avoid merge conflicts. |
Signed-off-by: Trevor Taubitz <[email protected]>
An update has been made to differentiate empty output and no output. Given the following examples: func ExampleHello_emptyOutput() {
_ = Hello("foo")
// Output:
}
func ExampleHello_noOutput() {
_ = Hello("foo")
} The output is as follows: <details><summary>Example</summary>
<p>
```go
{
_ = Hello("foo")
}
```
#### Output
```
```
</p>
</details>
<details><summary>Example</summary>
<p>
```go
{
_ = Hello("foo")
}
```
</p>
</details> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great 💯
Signed-off-by: Trevor Taubitz <[email protected]>
Looks good to go! Will merge once CI checks have passed |
Closes #26
This MR includes example output along with the code that generates that output. Given
foo.go
:and
foo_test.go
:the output looks like this:
Note, this MR also includes a
go mod tidy
. This might overlap with #25, so this can be altered if necessary. Additionally, I ended up using the markdown code fence typeoutput
as a descriptor, but I don't know if there's a better descriptor to use here.