diff options
author | Michael Muré <batolettre@gmail.com> | 2023-01-22 14:42:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-22 14:42:09 +0100 |
commit | 05be19d3bdfcafbfb4cf39d0dfc0ae480c5e062d (patch) | |
tree | c25a2b194ed4633dd23b2af53aa52ef45d49e344 /commands/cmdtest/regex_test.go | |
parent | 06e8396e6fe83c691bbdfd74cfdd6bc28a0d20f1 (diff) | |
parent | b66d467a39638ff7f5840017a1d986c6de341b4b (diff) | |
download | git-bug-05be19d3bdfcafbfb4cf39d0dfc0ae480c5e062d.tar.gz |
Merge pull request #1005 from MichaelMure/cli-testing
commands: add a helper to generate testing regex for CLI output
Diffstat (limited to 'commands/cmdtest/regex_test.go')
-rw-r--r-- | commands/cmdtest/regex_test.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/commands/cmdtest/regex_test.go b/commands/cmdtest/regex_test.go new file mode 100644 index 00000000..7f2e75fa --- /dev/null +++ b/commands/cmdtest/regex_test.go @@ -0,0 +1,25 @@ +package cmdtest + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestMakeExpectedRegex(t *testing.T) { + cases := []struct { + sub string + text string + }{ + {ExpId, "d96dc877077a571414168c946eb013035888715b561e75682cfae9ef785e3227"}, + {ExpHumanId, "d96dc87"}, + {ExpTimestamp, "1674368486"}, + {ExpISO8601, "2023-01-22T07:21:26+01:00"}, + } + + for _, tc := range cases { + t.Run(tc.sub, func(t *testing.T) { + require.Regexp(t, MakeExpectedRegex(tc.text), tc.text) + }) + } +} |