(t *testing.T)
| 94 | } |
| 95 | |
| 96 | func TestDigestAlgForRef(t *testing.T) { |
| 97 | tests := []struct { |
| 98 | name string |
| 99 | digest string |
| 100 | expected string |
| 101 | }{ |
| 102 | { |
| 103 | name: "sha1 (40 hex chars)", |
| 104 | digest: "1234567890abcdef1234567890abcdef12345678", |
| 105 | expected: "sha1", |
| 106 | }, |
| 107 | { |
| 108 | name: "sha256 (64 hex chars)", |
| 109 | digest: "1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", |
| 110 | expected: "sha256", |
| 111 | }, |
| 112 | { |
| 113 | name: "empty string defaults to sha1", |
| 114 | digest: "", |
| 115 | expected: "sha1", |
| 116 | }, |
| 117 | { |
| 118 | name: "unexpected length defaults to sha1", |
| 119 | digest: "abc", |
| 120 | expected: "sha1", |
| 121 | }, |
| 122 | } |
| 123 | |
| 124 | for _, tt := range tests { |
| 125 | t.Run(tt.name, func(t *testing.T) { |
| 126 | assert.Equal(t, tt.expected, DigestAlgForRef(tt.digest)) |
| 127 | }) |
| 128 | } |
| 129 | } |
nothing calls this directly
no test coverage detected