-
Notifications
You must be signed in to change notification settings - Fork 12
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
test: remove hardcoded files to check #39
Conversation
2272c56
to
cb09296
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #39 +/- ##
==========================================
+ Coverage 67.36% 69.58% +2.22%
==========================================
Files 4 4
Lines 576 434 -142
==========================================
- Hits 388 302 -86
+ Misses 132 76 -56
Partials 56 56 ☔ View full report in Codecov by Sentry. |
@thaJeztah PTAL |
clidocstool_test.go
Outdated
bres, err := os.ReadFile(filepath.Join(tmpdir, tt)) | ||
seen := make(map[string]struct{}) | ||
|
||
require.NoError(t, filepath.Walk("fixtures", func(path string, info fs.FileInfo, err error) error { |
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.
Can we use filepath.WalkDir
for these? Not sure if we need the added features of Walk
🤔
I'm wondering though if we're over-complicating things here; are we expecting to recurse here? Could we use a filepath.Glob(path/*.md)
to get the list of markdown files? https://pkg.go.dev/path/filepath#Glob
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.
Can we use
filepath.WalkDir
for these? Not sure if we need the added features ofWalk
🤔
I think it's fine to keep Walk
even if it's always calling os.Lstat
for these test cases. We have less than 10 files.
Could we use a
filepath.Glob(path/*.md)
to get the list of markdown files? https://pkg.go.dev/path/filepath#Glob
No because we also need to check for dir existence which Walk
provides efficiently.
Signed-off-by: CrazyMax <[email protected]>
cb09296
to
04f2e85
Compare
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.
LGTM
Removes hardcoded files to verify in our tests but also check if unexpected files are generated and fail if not available in fixtures.