-
Notifications
You must be signed in to change notification settings - Fork 14
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: ignore_test suggestion #1119
base: master
Are you sure you want to change the base?
Conversation
In some cases, there are files that may be useful, but should not be part of artifact. The ability to add files and directories to the .packignore file has been added, which allows you to ignore these files and directories when packing. Closes #812 @TarantoolBot document Title: `tt pack` support `.packignore` Use `.packignore` in the same way as `.gitignore` allows to exclude unnecessary files while preparing application package with `tt pack command.
745c43c
to
fd1e566
Compare
3aa4384
to
28e723f
Compare
I see following meaningful changes:
func Test_createIgnorePattern_negate(t *testing.T) {
testCases := mapSlice(testCases_ignorePatternBasic,
func(tc testCase_ignorePattern) testCase_ignorePattern {
return testCase_ignorePattern{
name: tc.name,
pattern: "!" + tc.pattern,
expectedMatches: tc.expectedMatches,
expectedMismatches: tc.expectedMismatches,
expectedDirOnly: tc.expectedDirOnly,
expectedIsNegate: true,
}
},
)
runTestSet_ignorePattern(t, testCases)
} vs func Test_createIgnorePattern_negate(t *testing.T) {
negate := func(tc testCase_ignorePattern) testCase_ignorePattern {
return testCase_ignorePattern{
name: tc.name,
pattern: "!" + tc.pattern,
expectedMatches: tc.expectedMatches,
expectedMismatches: tc.expectedMismatches,
expectedDirOnly: tc.expectedDirOnly,
expectedIsNegate: true,
}
}
testCases := mapSlice(testCases_ignorePatternBasic, negate)
runTestSet_ignorePattern(t, testCases)
} |
var ignoreTestData_paths = []ignoreTestData{ | ||
{ | ||
name: "name_at_depth1", | ||
var ignoreTestCaseWildcard = ignorePatternCases{ |
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.
The whole point of the above set (original name is ignoreTestData_names
) is that none of them contains path separator in pattern
(but contains various wildcards). This set (original name is ignoreTestData_paths
) do contain path separator in pattern
.
I can agree that original naming is not the best one, but the suggested one doesn't reflect the nature of the set at all.
28e723f
to
b20cf80
Compare
There is a suggestion to always use map in table driven tests: it makes the case name stand out from the structure, which makes it visually easier to understand what the case is about. And most importantly, there is a guarantee to avoid duplication of names, which helps in debugging.
The
Both of the given examples are overengineered and unreadable. func Test_createIgnorePattern_negate(t *testing.T) {
invertPattern := func(td *ignorePatternCase) {
td.pattern = "!" + td.pattern
td.isNegate = true
}
tc := preparePatterns(ignoreBaseTestCasesPattern, invertPattern)
checkIgnorePattern(t, tc)
} My suggestion is to remove explicit data copying altogether - it makes the code dirty, hiding the useful idea of 1-2 lines behind a forest of empty actions. Syntactic sugar in the form of
The name doesn't matter at all. |
64a5ef4
to
37cf2f2
Compare
No problem. As I mentioned earlier I have no objection and have applied this change.
The problem is that
I doubt that you mean that, but it seems this way we change the original test set at each transformation which requires us to keep in mind what is in origin at any time, keep test orders or something similar. In my opinion this approach complicates the readability and here "the less code" doesn't mean "the better". I've considered all your comments and have done my best to make code friendlier to maintainer )). Please, take a look (#1096). |
37cf2f2
to
c2839f0
Compare
No description provided.