This repository was archived by the owner on Sep 30, 2024. It is now read-only.
Rockskip: add search tests#62581
Merged
Merged
Conversation
keegancsmith
approved these changes
May 10, 2024
Comment on lines
+94
to
+108
| // We don't use 'state' in this test, it's just needed for these method calls. | ||
| state := map[string][]string{} | ||
| gitAdd(t, repoDir, state, "a.txt", "sym1a\n") | ||
| gitAdd(t, repoDir, state, "b.txt", "sym1b\n") | ||
| gitRm(t, repoDir, state, "a.txt") | ||
|
|
||
| out, err := gitserver.CreateGitCommand(repoDir, "git", "rev-parse", "HEAD").CombinedOutput() | ||
| require.NoError(t, err, string(out)) | ||
| commit1 := string(bytes.TrimSpace(out)) | ||
|
|
||
| gitAdd(t, repoDir, state, "c.txt", "sym1c\nsym2c") | ||
| gitAdd(t, repoDir, state, "a.java", "sym1a\nsym2a") | ||
| gitAdd(t, repoDir, state, "b.java", "sym1b\nsym2b") | ||
| gitRm(t, repoDir, state, "a.java") | ||
| gitAdd(t, repoDir, state, "a.txt", "sym2a\nsym3a") |
Member
There was a problem hiding this comment.
quite a nice pattern from the go's internal testing is the idea of a testscript which makes this sort of code nicer to write. I am not sure if we can directly use it, since we seem to be more setting up to run the tests but maybe just use it as potential future idea :) It is copied out of internal and exposed here https://pkg.go.dev/github.com/rogpeppe/go-internal/testscript
Contributor
Author
There was a problem hiding this comment.
This is really nice! I'm not going to use this now but will keep it in mind for future refactors/ tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit adds integration tests for Rockskip symbol search. Specific changes:
server_test.gointo new filemock.goTestSearchandTestSearchResultLimitingTest plan
Lots of new test cases!