diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /workhorse/internal/git/pktline_test.go | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'workhorse/internal/git/pktline_test.go')
-rw-r--r-- | workhorse/internal/git/pktline_test.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/workhorse/internal/git/pktline_test.go b/workhorse/internal/git/pktline_test.go new file mode 100644 index 00000000000..d4be8634538 --- /dev/null +++ b/workhorse/internal/git/pktline_test.go @@ -0,0 +1,39 @@ +package git + +import ( + "bytes" + "testing" +) + +func TestSuccessfulScanDeepen(t *testing.T) { + examples := []struct { + input string + output bool + }{ + {"000dsomething000cdeepen 10000", true}, + {"000dsomething0000000cdeepen 1", true}, + {"000dsomething0000", false}, + } + + for _, example := range examples { + hasDeepen := scanDeepen(bytes.NewReader([]byte(example.input))) + + if hasDeepen != example.output { + t.Fatalf("scanDeepen %q: expected %v, got %v", example.input, example.output, hasDeepen) + } + } +} + +func TestFailedScanDeepen(t *testing.T) { + examples := []string{ + "invalid data", + "deepen", + "000cdeepen", + } + + for _, example := range examples { + if scanDeepen(bytes.NewReader([]byte(example))) { + t.Fatalf("scanDeepen %q: expected result to be false, got true", example) + } + } +} |