You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
270 lines
7.1 KiB
270 lines
7.1 KiB
---
|
|
test case: valid key with no parameters
|
|
in:
|
|
key: 'key'
|
|
out:
|
|
key: 'key'
|
|
parameters: []
|
|
types: []
|
|
---
|
|
test case: valid key with empty brackets
|
|
in:
|
|
key: 'key[]'
|
|
out:
|
|
key: 'key'
|
|
parameters: ['']
|
|
types: ['undefined']
|
|
---
|
|
test case: valid key with quoted empty string in brackets
|
|
in:
|
|
key: 'key[""]'
|
|
out:
|
|
key: 'key'
|
|
parameters: ['']
|
|
types: ['string']
|
|
---
|
|
test case: valid key with space in brackets
|
|
in:
|
|
key: 'key[ ]'
|
|
out:
|
|
key: 'key'
|
|
parameters: ['']
|
|
types: ['undefined']
|
|
---
|
|
test case: valid key with leading space before quoted empty string in brackets
|
|
in:
|
|
key: 'key[ ""]'
|
|
out:
|
|
key: 'key'
|
|
parameters: ['']
|
|
types: ['string']
|
|
---
|
|
test case: valid key with leading and trailing spaces around quoted empty string in brackets
|
|
in:
|
|
key: 'key[ "" ]'
|
|
out:
|
|
key: 'key'
|
|
parameters: ['']
|
|
types: ['string']
|
|
---
|
|
test case: valid key with 'a' in brackets
|
|
in:
|
|
key: 'key[a]'
|
|
out:
|
|
key: 'key'
|
|
parameters: ['a']
|
|
types: ['string']
|
|
---
|
|
test case: valid key with leading space before 'a' in brackets
|
|
in:
|
|
key: 'key[ a]'
|
|
out:
|
|
key: 'key'
|
|
parameters: ['a']
|
|
types: ['string']
|
|
---
|
|
test case: valid key with leading and trailing spaces around 'a' in brackets
|
|
in:
|
|
key: 'key[ a ]'
|
|
out:
|
|
key: 'key'
|
|
parameters: ['a ']
|
|
types: ['string']
|
|
---
|
|
test case: valid key with quoted 'a' in brackets
|
|
in:
|
|
key: 'key["a"]'
|
|
out:
|
|
key: 'key'
|
|
parameters: ['a']
|
|
types: ['string']
|
|
---
|
|
test case: valid key with quoted 'a' followed by comma in brackets
|
|
in:
|
|
key: 'key["a",]'
|
|
out:
|
|
key: 'key'
|
|
parameters: ['a', '']
|
|
types: ['string', 'undefined']
|
|
---
|
|
test case: valid key with unquoted 'a' followed by comma in brackets
|
|
in:
|
|
key: 'key[a,]'
|
|
out:
|
|
key: 'key'
|
|
parameters: ['a', '']
|
|
types: ['string', 'undefined']
|
|
---
|
|
test case: valid key with multiple unquoted parameters in brackets
|
|
in:
|
|
key: 'key[a,b,c]'
|
|
out:
|
|
key: 'key'
|
|
parameters: ['a', 'b', 'c']
|
|
types: ['string', 'string', 'string']
|
|
---
|
|
test case: valid key with multiple quoted parameters in brackets
|
|
in:
|
|
key: 'key["a","b","c"]'
|
|
out:
|
|
key: 'key'
|
|
parameters: ['a', 'b', 'c']
|
|
types: ['string', 'string', 'string']
|
|
---
|
|
test case: valid key with first unquoted parameter and second array parameter containing two unquoted parameters
|
|
in:
|
|
key: 'key[a,[b,c]]'
|
|
out:
|
|
key: 'key'
|
|
parameters: ['a','b,c']
|
|
types: ['string', 'array']
|
|
---
|
|
test case: valid key with first unquoted parameter and second array parameter containing unquoted and empty parameter
|
|
in:
|
|
key: 'key[a,[b,]]'
|
|
out:
|
|
key: 'key'
|
|
parameters: ['a', 'b,']
|
|
types: ['string', 'array']
|
|
---
|
|
test case: valid key with two unquoted parameters where second parameter contains opening square bracket
|
|
in:
|
|
key: 'key[a,b[c]'
|
|
out:
|
|
key: 'key'
|
|
parameters: ['a', 'b[c']
|
|
types: ['string', 'string']
|
|
---
|
|
test case: valid key with multiple quoted parameters and array # array contains multiple quoted parameters which containing escaping and characters that are not allowed in unquoted parameters
|
|
in:
|
|
key: 'key["a","b",["c","d\",]"]]'
|
|
out:
|
|
key: 'key'
|
|
parameters: ['a',"b",'"c","d\",]"']
|
|
types: ['string', 'string', 'array']
|
|
---
|
|
test case: valid key with multiple quoted parameters and multiple arrays # arrays contains multiple unquoted and quoted parameters which containing escaping and characters that are not allowed in unquoted parameters
|
|
in:
|
|
key: 'key["a","b",["c","d\",]"],[e,f]]'
|
|
out:
|
|
key: 'key'
|
|
parameters: ['a','b','"c","d\",]"','e,f']
|
|
types: ['string', 'string', 'array', 'array']
|
|
---
|
|
test case: valid key, single parameter with unquoted string containing double quote characters
|
|
in:
|
|
key: 'key[a"b"]'
|
|
out:
|
|
key: 'key'
|
|
parameters: ['a"b"']
|
|
types: ['string']
|
|
---
|
|
test case: valid key, multiple different type parameters where one is unquoted string containing double quote characters
|
|
in:
|
|
key: 'key["a",b"c",d]'
|
|
out:
|
|
key: 'key'
|
|
parameters: ['a','b"c"','d']
|
|
types: ['string', 'string', 'string']
|
|
---
|
|
test case: valid key with many quoted/unquoted parameters with/without trailing/leading spaces also featuring escaping
|
|
in:
|
|
key: 'key["\"aaa\"", "bbb","ccc" , "ddd" ,"", "","" , "" ,, , ,eee, fff,ggg , hhh" ]'
|
|
out:
|
|
key: 'key'
|
|
parameters: ['"aaa"', 'bbb', 'ccc', 'ddd', '', '', '', '', '', '', '', 'eee', 'fff', 'ggg ', 'hhh" ']
|
|
types: ['string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'undefined', 'undefined', 'undefined', 'string', 'string', 'string', 'string']
|
|
---
|
|
test case: valid key with quoted and unquoted arrays
|
|
in:
|
|
key: 'key[[],"[]",[a,b],"z,[c,d]"]'
|
|
out:
|
|
key: 'key'
|
|
parameters: ['','[]','a,b','z,[c,d]']
|
|
types: ['array', 'string', 'array', 'string']
|
|
---
|
|
test case: invalid key, unmatched opening bracket (1) # array missing closing bracket after second parameter
|
|
in:
|
|
key: 'key[["a",]'
|
|
---
|
|
test case: invalid key, unmatched opening bracket (2) # array missing closing bracket, brackets are inside quotes and are a part of the array parameter
|
|
in:
|
|
key: 'key[[a"]"]'
|
|
---
|
|
test case: invalid key, unmatched opening bracket (3) # array missing closing bracket after second parameter, one of the closing brackets is inside quotes and is a part of the second array parameter
|
|
in:
|
|
key: 'key[["a","\"b\"]"]'
|
|
---
|
|
test case: invalid key, invalid character for unquoted parameter, multiple parameter key
|
|
in:
|
|
key: 'key["a",["b","c\"]"]]]'
|
|
---
|
|
test case: invalid key, unmatched closing bracket, parameter followed by trailing space
|
|
in:
|
|
key: 'key[a ]]'
|
|
---
|
|
test case: invalid key, unmatched closing bracket, parameter followed by leading space
|
|
in:
|
|
key: 'key[ a]]'
|
|
---
|
|
test case: invalid key, part of parameters list not enclosed in brackets
|
|
in:
|
|
key: 'key[ГУГЛ]654'
|
|
---
|
|
test case: invalid key, braces are not allowed in key
|
|
in:
|
|
key: '{}key'
|
|
---
|
|
test case: invalid key, comma is not allowed in key or parameters should be enclosed in brackets
|
|
in:
|
|
key: 'ssh,21'
|
|
---
|
|
test case: invalid key, multiple square bracket pairs are not allowed
|
|
in:
|
|
key: 'key[][]'
|
|
---
|
|
test case: invalid key, multiple square bracket pairs containing parameters are not allowed
|
|
in:
|
|
key: 'key["a",b,["c","d\",]"]]["d"]'
|
|
---
|
|
test case: invalid key, multi-level arrays are not allowed
|
|
in:
|
|
key: 'key[[[]]]'
|
|
---
|
|
test case: invalid key, multi-level arrays are not allowed, array consists of multiple different type parameters
|
|
in:
|
|
key: 'key["a",["b",["c","d"],e],"f"]'
|
|
---
|
|
test case: invalid key, multi-level arrays are not allowed, array consists of single parameter which is another array
|
|
in:
|
|
key: 'key["a","b",[["c","d\",]"]]]'
|
|
---
|
|
test case: invalid key, character ] is not allowed in unquoted parameter string
|
|
in:
|
|
key: 'key[a]]'
|
|
---
|
|
test case: invalid key, character [ is allowed in unquoted parameter string but character ] is not
|
|
in:
|
|
key: 'key[a[b]]'
|
|
---
|
|
test case: invalid key, character ] is not allowed in unquoted parameter string, key with multiple different type parameters
|
|
in:
|
|
key: 'key["a",b[c,d],e]'
|
|
---
|
|
test case: invalid key, quoted parameter cannot contain unquoted part
|
|
in:
|
|
key: 'key["a"b]'
|
|
---
|
|
test case: invalid key, second parameter of the array cannot contain unquoted part
|
|
in:
|
|
key: 'key["a",["b","]"c]]'
|
|
---
|
|
test case: invalid key, array type parameter cannot contain quoted parameter with unquoted part
|
|
in:
|
|
key: 'key[["]"a]]'
|
|
---
|
|
test case: invalid key, array type parameter cannot contain quoted part
|
|
in:
|
|
key: 'key[[a]"b"]'
|
|
...
|