Skip to content

test(fileset): add unit tests for FileSet #15

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

Merged
merged 3 commits into from
May 22, 2025

Conversation

DNEGEL3125
Copy link
Contributor

  • test IsInSetSmart
  • test Add
  • test AddRange


// Test cases
tests := []struct {
name string
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name is not being used in the test. You may want to use t.Run(name, func(t *testing.T) {...} to use the name to run sub-tests.

Comment on lines 144 to 152
// Check the length of the Set
if len(fs.Set) != len(test.expected) {
t.Errorf("Expected %d paths in the set; got %d", len(test.expected), len(fs.Set))
}

// Check the Set
for path, expected := range test.expected {
if fs.Set[path] != expected {
t.Errorf("Set[%q] = %v; expected %v", path, fs.Set[path], expected)
}
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may use maps.Equal instead.

@criyle criyle merged commit 638345b into criyle:master May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants