From 83c7536c8ad1e30f2a6a182049003d3c0f036cfe Mon Sep 17 00:00:00 2001
From: wwwil <wwwil.squires@gmail.com>
Date: Wed, 5 Jun 2019 12:23:59 +0100
Subject: [PATCH] Add tests for regex test op

---
 check/data         | 10 ++++++++++
 check/test_test.go | 12 ++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/check/data b/check/data
index 116a5f9..7e41a9f 100644
--- a/check/data
+++ b/check/data
@@ -297,3 +297,13 @@ groups:
               op: eq
               value: "false"
             set: true
+
+    - id: 26
+      text: "check regex op matches"
+      tests:
+        test_items:
+          - path: "{.currentMasterVersion}"
+            compare:
+              op: regex
+              value: '^1\.12.*$'
+            set: true
diff --git a/check/test_test.go b/check/test_test.go
index 308dcad..a74679c 100644
--- a/check/test_test.go
+++ b/check/test_test.go
@@ -152,6 +152,10 @@ func TestTestExecute(t *testing.T) {
 			controls.Groups[0].Checks[22],
 			"authentication:\n  anonymous:\n    enabled: false",
 		},
+		{
+			controls.Groups[0].Checks[26],
+			"currentMasterVersion: 1.12.7",
+		},
 	}
 
 	for _, c := range cases {
@@ -180,6 +184,14 @@ func TestTestExecuteExceptions(t *testing.T) {
 			controls.Groups[0].Checks[25],
 			"broken } yaml\nenabled: true",
 		},
+		{
+			controls.Groups[0].Checks[26],
+			"currentMasterVersion: 1.11",
+		},
+		{
+			controls.Groups[0].Checks[26],
+			"currentMasterVersion: ",
+		},
 	}
 
 	for _, c := range cases {
-- 
GitLab