1
0

oid_test.go 659 B

1234567891011121314151617181920212223242526272829303132333435
  1. package lfsutil
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/assert"
  5. )
  6. func TestValidOID(t *testing.T) {
  7. tests := []struct {
  8. name string
  9. oid OID
  10. expVal bool
  11. }{
  12. {
  13. name: "malformed",
  14. oid: OID("7c222fb2927d828af22f592134e8932480637c0d"),
  15. },
  16. {
  17. name: "not all lower cased",
  18. oid: OID("EF797c8118f02dfb649607dd5d3f8c7623048c9c063d532cc95c5ed7a898a64f"),
  19. },
  20. {
  21. name: "valid",
  22. oid: OID("ef797c8118f02dfb649607dd5d3f8c7623048c9c063d532cc95c5ed7a898a64f"),
  23. expVal: true,
  24. },
  25. }
  26. for _, test := range tests {
  27. t.Run(test.name, func(t *testing.T) {
  28. assert.Equal(t, test.expVal, ValidOID(test.oid))
  29. })
  30. }
  31. }