MCPcopy Create free account
hub / github.com/cli/cli / TestShortSHA

Function TestShortSHA

git/client_test.go:1863–1885  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1861}
1862
1863func TestShortSHA(t *testing.T) {
1864 tests := []struct {
1865 name string
1866 sha string
1867 want string
1868 }{
1869 {name: "long SHA", sha: "abc123def456789", want: "abc123de"},
1870 {name: "short value", sha: "short", want: "short"},
1871 }
1872
1873 for _, tt := range tests {
1874 t.Run(tt.name, func(t *testing.T) {
1875 // Given a commit identifier
1876 sha := tt.sha
1877
1878 // When it is shortened for display
1879 shortSHA := ShortSHA(sha)
1880
1881 // Then at most the first eight characters are returned
1882 assert.Equal(t, tt.want, shortSHA)
1883 })
1884 }
1885}
1886
1887func TestParseWorktrees(t *testing.T) {
1888 tests := []struct {

Callers

nothing calls this directly

Calls 3

ShortSHAFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected