@@ -69,18 +69,31 @@ local or_matcher(matchers) =
6969 '$$matcher_params$$' : matchers,
7070 };
7171
72- local json_to_string(json) = std.manifestJsonEx (json, '' );
72+ local range_matcher(from, to) =
73+ {
74+ '$$matcher_type$$' : 'range' ,
75+ '$$matcher_params$$' : {
76+ from: from,
77+ to: to,
78+ },
79+ };
80+
81+ local type_matcher(type) =
82+ {
83+ '$$matcher_type$$' : 'type::%s' % type,
84+ '$$matcher_params$$' : null ,
85+ };
7386
7487{
75- key: {
76- regex(regex):: '%s%s' % [SHORTHAND_MATCHER_PREFIX, json_to_string(regex_matcher(regex))],
77- string(string, case_sensitive=true):: '%s%s' % [SHORTHAND_MATCHER_PREFIX, json_to_string(string_matcher(string, case_sensitive))],
78- int(int):: '%s%s' % [SHORTHAND_MATCHER_PREFIX, json_to_string(int_matcher(int))],
79- float(float):: '%s%s' % [SHORTHAND_MATCHER_PREFIX, json_to_string(float_matcher(float))],
80- len(len):: '%s%s' % [SHORTHAND_MATCHER_PREFIX, json_to_string(len_matcher(len))],
81- or(matchers):: '%s%s' % [SHORTHAND_MATCHER_PREFIX, json_to_string(or_matcher(matchers))],
88+ type: {
89+ int():: type_matcher('int' ),
90+ float():: type_matcher('float' ),
91+ string():: type_matcher('string' ),
92+ object():: type_matcher('object' ),
93+ array():: type_matcher('array' ),
8294 },
8395
96+ key(matcher):: '%s%s' % [SHORTHAND_MATCHER_PREFIX, std.manifestJsonEx (matcher, '' )],
8497 any():: any_matcher(),
8598 regex(regex):: regex_matcher(regex),
8699 string(string, case_sensitive=true):: string_matcher(string, case_sensitive),
@@ -91,4 +104,5 @@ local json_to_string(json) = std.manifestJsonEx(json, '');
91104 len(len):: len_matcher(len),
92105 and(matchers):: and_matcher(matchers),
93106 or(matchers):: or_matcher(matchers),
107+ range(from, to):: range_matcher(from, to),
94108}
0 commit comments