onsi / ginkgo

A Modern Testing Framework for Go
http://onsi.github.io/ginkgo/
MIT License
8.08k stars 643 forks source link

add AddSpecialSuiteFailureReasons to reduce boilerplate #1411

Closed grosser closed 1 month ago

grosser commented 1 month ago

basically

report.SpecialSuiteFailureReasons = append(report.SpecialSuiteFailureReasons, suite.CompilationError.Error())
->
report.AddSpecialSuiteFailureReasons(suite.CompilationError.Error())

because the boilerplate was a bit annoying to see everywhere and now the lines are easier to read

onsi commented 1 month ago

heyo - i appreciate the boiler plate is annoying but I'd prefer to keep it as-is for now. the report isn't a pointer and i'm trying to be more explicit about when and how it changes.

grosser commented 1 month ago

FYI I started with keeping just 1 method as pointer and that felt weird :) I like the idea of making it a pointer since I don't like dealing with some things being a pointer and others not, but yeah if you have other plans 🤷 ... feel free to close if you don't think this is mergeable in the near future

onsi commented 1 month ago

yeah i hear you. a lot of the mess in v1 stemmed form me using pointers everywhere and not managing state mutation more carefully. v2 tried to take a more immutable pov (though, ultimately, there are some pointers here or there). it definitely helped avoid some of the issues i hit with v1 though it's generated it's own kinds of messes along the way :shrug: