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

Is there a better way to do this test logic?? #122

Closed
zendern opened this issue Apr 12, 2020 · 2 comments
Closed

Is there a better way to do this test logic?? #122

zendern opened this issue Apr 12, 2020 · 2 comments
Labels
enhancement New feature or request hacktoberfest help wanted Extra attention is needed

Comments

@zendern
Copy link
Contributor

zendern commented Apr 12, 2020

  • What are you trying to do?
    Checking for if running in a test in production code is kinda icky..... is there a refactor that can be done here so that this is not necessary??

const TestLogfilename = "nancy.test.log"

nancy/logger/logger.go

Lines 75 to 80 in a76019e

func useTestLogFile(args []string) bool {
if stringPrefixInSlice("-test.", args) && !stringInSlice("-iq", args) {
return true
}
return false
}

  • What feature or behavior is this required for?
    Nothing really.....just removing a little ickyness

  • How could we solve this issue? (Not knowing is okay!)
    Maybe conversion to a struct or something where the log directory could be passed in easily. Or something else ¯_(ツ)_/¯

  • Anything else?

cc @bhamail / @DarthHater

@DarthHater
Copy link
Member

I think @bhamail had some cool thoughts here, in that maybe we can pass in a io.Writer or something akin and make it a) more easy to test (since you can pass in anything), and kinda take the log directory etc... out of it like you are suggesting.

@DarthHater DarthHater added enhancement New feature or request help wanted Extra attention is needed labels Apr 13, 2020
@fitzoh
Copy link
Contributor

fitzoh commented Oct 8, 2020

I think this one has been resolved?

@bhamail bhamail closed this as completed Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants