[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

New to go packaging. Need help with a test that has hard coded date value...



Hi all,

First, thank you for letting me join the team. I am excited to be here.

The problematic test...

func TestTitleHeading(t *testing.T) {
    doc := NewDocument()
    doc.Heading(1, "Title", "A short description", time.Now())

    if doc.String() != `.TH TITLE 1 "2022-01-11" "Title" "A short description"` {
        t.Error("Expected title heading, got:", doc.String())

Obviously, the test fails as the date there is today. So patching the test with todays date passes it, but this is a maintenance nightmare. Is there a better way?

Thank you,

Scarlett Moore

Attachment: OpenPGP_0x2E7C0367B9BFA089.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


Reply to: