From e7816d5d9aed402366f46112e0eebb32f962063f Mon Sep 17 00:00:00 2001 From: Shiyang Wang Date: Sat, 3 Jun 2017 10:48:28 +0800 Subject: [PATCH] add more unit test Kubernetes-commit: 87f877962468a83efe4f46ec01582d8703a4e899 --- util/jsonpath/parser_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/util/jsonpath/parser_test.go b/util/jsonpath/parser_test.go index 7abc5ae5..4f71a60a 100644 --- a/util/jsonpath/parser_test.go +++ b/util/jsonpath/parser_test.go @@ -71,6 +71,12 @@ var parserTests = []parserTest{ []Node{newList(), newFilter(newList(), newList(), "=="), newList(), newField("status"), newField("nodeInfo"), newField("osImage"), newList(), newText("Linux")}, false}, {"test filter suffix", `{[?(@.status.nodeInfo.osImage == "{[()]}")]}`, []Node{newList(), newFilter(newList(), newList(), "=="), newList(), newField("status"), newField("nodeInfo"), newField("osImage"), newList(), newText("{[()]}")}, false}, + {"double inside single", `{[?(@.status.nodeInfo.osImage == "''")]}`, + []Node{newList(), newFilter(newList(), newList(), "=="), newList(), newField("status"), newField("nodeInfo"), newField("osImage"), newList(), newText("''")}, false}, + {"single inside double", `{[?(@.status.nodeInfo.osImage == '""')]}`, + []Node{newList(), newFilter(newList(), newList(), "=="), newList(), newField("status"), newField("nodeInfo"), newField("osImage"), newList(), newText("\"\"")}, false}, + {"single containing escaped single", `{[?(@.status.nodeInfo.osImage == '\\\'')]}`, + []Node{newList(), newFilter(newList(), newList(), "=="), newList(), newField("status"), newField("nodeInfo"), newField("osImage"), newList(), newText("\\'")}, false}, } func collectNode(nodes []Node, cur Node) []Node {