From 74e553b8475e23597636c41203f62ef9dfc0bea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Mon, 28 Oct 2019 20:56:12 +0100 Subject: [PATCH] add test to check that version doesn't start with v MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- params/version_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 params/version_test.go diff --git a/params/version_test.go b/params/version_test.go new file mode 100644 index 000000000..a210b8fc7 --- /dev/null +++ b/params/version_test.go @@ -0,0 +1,19 @@ +package params_test + +import ( + "io/ioutil" + "path/filepath" + "regexp" + "testing" +) + +func TestVersionFormat(t *testing.T) { + data, err := ioutil.ReadFile(filepath.Join("..", "VERSION")) + if err != nil { + t.Error("unable to open VERSION file") + } + matched, _ := regexp.Match(`^\d+\.\d+\.\d+(-[.\w]+)?\n?$`, data) + if !matched { + t.Error("version in incorrect format") + } +}