Skip to content

Commit 04d5648

Browse files
authored
Remove [types removal] warning headers from yaml runner tests (#120)
This commit removes [types removal] warning headers when making assertions on warnings of allowed_warnings in yaml tests.
1 parent 7e784d8 commit 04d5648

File tree

1 file changed

+10
-7
lines changed
  • yaml_test_runner/src/step

1 file changed

+10
-7
lines changed

yaml_test_runner/src/step/do.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,14 @@ impl Do {
9191
pub fn to_tokens(&self, mut read_response: bool, tokens: &mut Tokens) -> bool {
9292
self.api_call.to_tokens(tokens);
9393

94-
// only assert that there are no warnings if expected warnings is empty and not allowing warnings
94+
// Filter out [types removal] warnings in all cases, same as the java runner. This should
95+
// really be in the yaml tests themselves
9596
if !self.warnings.is_empty() {
9697
tokens.append(quote! {
97-
let warnings: Vec<&str> = response.warning_headers().collect();
98+
let warnings: Vec<&str> = response
99+
.warning_headers()
100+
.filter(|w| !w.starts_with("[types removal]"))
101+
.collect();
98102
});
99103
for warning in &self.warnings {
100104
tokens.append(quote! {
@@ -106,7 +110,7 @@ impl Do {
106110
tokens.append(quote! {
107111
let allowed_warnings = vec![#(#allowed),*];
108112
let warnings: Vec<&str> = response.warning_headers()
109-
.filter(|w| !allowed_warnings.iter().any(|a| w.contains(a)))
113+
.filter(|w| !w.starts_with("[types removal]") || !allowed_warnings.iter().any(|a| w.contains(a)))
110114
.collect();
111115
assert_warnings_is_empty!(warnings);
112116
});
@@ -122,11 +126,10 @@ impl Do {
122126
c.to_tokens(tokens);
123127
}
124128

125-
match &self.api_call.ignore {
126-
Some(i) => tokens.append(quote! {
129+
if let Some(i) = &self.api_call.ignore {
130+
tokens.append(quote! {
127131
assert_response_success_or!(response, #i);
128-
}),
129-
None => (),
132+
});
130133
}
131134

132135
read_response

0 commit comments

Comments
 (0)