github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/utils/docgen/main_test.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"regexp"
     6  	"testing"
     7  	"time"
     8  )
     9  
    10  func TestVersion(t *testing.T) {
    11  	rx := regexp.MustCompile(`^[0-9]+\.[0-9]+\.[0-9]+( (ALPHA|BETA|RC[0-9]))?$`)
    12  
    13  	if !rx.MatchString(Version) {
    14  		t.Error("Release version doesn't contain a valid string:")
    15  		t.Log("  Version:", Version)
    16  	}
    17  }
    18  
    19  func TestCopyright(t *testing.T) {
    20  	rx := regexp.MustCompile(fmt.Sprintf(`^(\(c\)|©) [0-9]{4}-%s .*$`, time.Now().Format("2006")))
    21  
    22  	if !rx.MatchString(Copyright) {
    23  		t.Error("Copyright string doesn't contain a valid string (possibly out of date?):")
    24  		t.Log("  Copyright:", Copyright)
    25  	}
    26  }
    27  
    28  func TestLicense(t *testing.T) {
    29  	if License == "" {
    30  		t.Error("License isn't valid:")
    31  		t.Log("  License:", License)
    32  	}
    33  }