MCPcopy Index your code
hub / github.com/jetify-com/devbox / TestShortRev

Function TestShortRev

internal/devbox/update_test.go:335–353  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

333}
334
335func TestShortRev(t *testing.T) {
336 // GitHub refs only parse as "locked" (with a Rev) if the third path
337 // component is a 40-char hex SHA. Anything shorter is treated as a ref
338 // name, not a revision.
339 longRev := "abc1234def56789012345678901234567890abcd"
340 cases := []struct {
341 in, want string
342 }{
343 {"github:numtide/flake-utils/" + longRev + "#pkg", "abc1234"},
344 {"path:./local", ""},
345 {"", ""},
346 {"not a flake ref", ""},
347 }
348 for _, tc := range cases {
349 t.Run(tc.in, func(t *testing.T) {
350 require.Equal(t, tc.want, shortRev(tc.in))
351 })
352 }
353}
354
355func TestShortDate(t *testing.T) {
356 require.Equal(t, "2025-04-22", shortDate("2025-04-22T14:30:00Z"))

Callers

nothing calls this directly

Calls 2

shortRevFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected