(t *testing.T)
| 57 | } |
| 58 | |
| 59 | func TestGetBuildDate(t *testing.T) { |
| 60 | info := GetBuildInfo() |
| 61 | |
| 62 | if info.BuildDate == unknownBuildValue { |
| 63 | // If build date is unknown, the function should return an error |
| 64 | _, err := GetBuildDate() |
| 65 | if err == nil { |
| 66 | t.Error("GetBuildDate() should return error when build date is unknown") |
| 67 | } |
| 68 | return |
| 69 | } |
| 70 | |
| 71 | // If build date is set, it should parse correctly |
| 72 | buildTime, err := GetBuildDate() |
| 73 | if err != nil { |
| 74 | t.Errorf("GetBuildDate() failed to parse build date: %v", err) |
| 75 | } |
| 76 | |
| 77 | // Build time should be reasonable (not zero time) |
| 78 | if buildTime.IsZero() { |
| 79 | t.Error("GetBuildDate() returned zero time") |
| 80 | } |
| 81 | |
| 82 | // Build time should be in the past |
| 83 | if buildTime.After(time.Now()) { |
| 84 | t.Error("GetBuildDate() returned future time") |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | func TestIsDevBuild(t *testing.T) { |
| 89 | isDev := IsDevBuild() |
nothing calls this directly
no test coverage detected