MCPcopy Index your code
hub / github.com/github/github-mcp-server / Test_looksLikeSHA

Function Test_looksLikeSHA

pkg/github/repositories_test.go:3966–4030  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3964}
3965
3966func Test_looksLikeSHA(t *testing.T) {
3967 tests := []struct {
3968 name string
3969 input string
3970 expected bool
3971 }{
3972 {
3973 name: "full 40-character SHA",
3974 input: "abc123def456abc123def456abc123def456abc1",
3975 expected: true,
3976 },
3977 {
3978 name: "too short",
3979 input: "abc123def456abc123def45",
3980 expected: false,
3981 },
3982 {
3983 name: "too long - 41 characters",
3984 input: "abc123def456abc123def456abc123def456abc12",
3985 expected: false,
3986 },
3987 {
3988 name: "contains invalid character - space",
3989 input: "abc123def456abc123def456 bc123def456abc1",
3990 expected: false,
3991 },
3992 {
3993 name: "contains invalid character - dash",
3994 input: "abc123def456abc123d-f456abc123def456abc1",
3995 expected: false,
3996 },
3997 {
3998 name: "contains invalid character - g",
3999 input: "abc123def456gbc123def456abc123def456abc1",
4000 expected: false,
4001 },
4002 {
4003 name: "branch name with slash",
4004 input: "feature/branch",
4005 expected: false,
4006 },
4007 {
4008 name: "empty string",
4009 input: "",
4010 expected: false,
4011 },
4012 {
4013 name: "all zeros SHA",
4014 input: "0000000000000000000000000000000000000000",
4015 expected: true,
4016 },
4017 {
4018 name: "all f's SHA",
4019 input: "ffffffffffffffffffffffffffffffffffffffff",
4020 expected: true,
4021 },
4022 }
4023

Callers

nothing calls this directly

Calls 1

looksLikeSHAFunction · 0.85

Tested by

no test coverage detected