package main import ( "testing" "github.com/alecthomas/assert/v2" ) func TestClassifyStatus(t *testing.T) { testcases := map[string]struct { Str string Err string }{ "merged+deployed": {"released", ""}, "merged, deployed": {"released", ""}, "released in v1.2": {"released", ""}, "merged, released in v1.2": {"released", ""}, statusReleasedFmt: {"released", ""}, "merged": {"merged", ""}, statusMerged: {"merged", ""}, "open": {"open", ""}, "closed": {"closed", ""}, "locked": {"closed", ""}, } for in, exp := range testcases { t.Run(in, func(t *testing.T) { actStr, actErr := classifyStatus(in) assert.Equal(t, exp.Str, actStr) if exp.Err == "" { assert.NoError(t, actErr) } else { assert.EqualError(t, actErr, exp.Err) } }) } }