You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920
  1. // Copyright 2022 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package git
  4. import (
  5. "testing"
  6. "github.com/stretchr/testify/assert"
  7. )
  8. func TestIsValidSHAPattern(t *testing.T) {
  9. assert.True(t, IsValidSHAPattern("fee1"))
  10. assert.True(t, IsValidSHAPattern("abc000"))
  11. assert.True(t, IsValidSHAPattern("9023902390239023902390239023902390239023"))
  12. assert.False(t, IsValidSHAPattern("90239023902390239023902390239023902390239023"))
  13. assert.False(t, IsValidSHAPattern("abc"))
  14. assert.False(t, IsValidSHAPattern("123g"))
  15. assert.False(t, IsValidSHAPattern("some random text"))
  16. }