mirror_test.go 842 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright 2017 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package db
  5. import (
  6. "testing"
  7. "github.com/stretchr/testify/assert"
  8. )
  9. func Test_parseRemoteUpdateOutput(t *testing.T) {
  10. tests := []struct {
  11. output string
  12. expResults []*mirrorSyncResult
  13. }{
  14. {
  15. `
  16. From https://try.gogs.io/unknwon/upsteam
  17. * [new branch] develop -> develop
  18. b0bb24f..1d85a4f master -> master
  19. - [deleted] (none) -> bugfix
  20. `,
  21. []*mirrorSyncResult{
  22. {"develop", gitShortEmptyID, ""},
  23. {"master", "b0bb24f", "1d85a4f"},
  24. {"bugfix", "", gitShortEmptyID},
  25. },
  26. },
  27. }
  28. for _, test := range tests {
  29. t.Run("", func(t *testing.T) {
  30. assert.Equal(t, test.expResults, parseRemoteUpdateOutput(test.output))
  31. })
  32. }
  33. }