@@ -206,6 +206,7 @@ fn parse_for_team(team_name: String, codeowners_file: &str) -> Result<Vec<TeamOw
206206mod tests {
207207 use super :: * ;
208208 use crate :: common_test:: tests:: { build_ownership_with_all_mappers, vecs_match} ;
209+ use indoc:: indoc;
209210
210211 #[ test]
211212 fn test_for_file_owner ( ) -> Result < ( ) , Box < dyn Error > > {
@@ -243,17 +244,17 @@ mod tests {
243244
244245 #[ test]
245246 fn test_parse_for_team_trims_header ( ) -> Result < ( ) , Box < dyn Error > > {
246- let codeownership_file = r# "
247- # STOP! - DO NOT EDIT THIS FILE MANUALLY
248- # This file was automatically generated by "bin/codeownership validate".
249- #
250- # CODEOWNERS is used for GitHub to suggest code/file owners to various GitHub
251- # teams. This is useful when developers create Pull Requests since the
252- # code/file owner is notified. Reference GitHub docs for more details:
253- # https://help.github.com/en/articles/about-code-owners
247+ let codeownership_file = indoc ! { "
248+ # STOP! - DO NOT EDIT THIS FILE MANUALLY
249+ # This file was automatically generated by \ " bin/codeownership validate\ " .
250+ #
251+ # CODEOWNERS is used for GitHub to suggest code/file owners to various GitHub
252+ # teams. This is useful when developers create Pull Requests since the
253+ # code/file owner is notified. Reference GitHub docs for more details:
254+ # https://help.github.com/en/articles/about-code-owners
254255
255256
256- "# ;
257+ " } ;
257258
258259 let team_ownership = parse_for_team ( "@Bar" . to_string ( ) , codeownership_file) ?;
259260 assert ! ( team_ownership. is_empty( ) ) ;
@@ -262,14 +263,14 @@ mod tests {
262263
263264 #[ test]
264265 fn test_parse_for_team_includes_owned_globs ( ) -> Result < ( ) , Box < dyn Error > > {
265- let codeownership_file = r# "
266- # First Section
267- /path/to/owned @Foo
268- /path/to/not/owned @Bar
266+ let codeownership_file = indoc ! { "
267+ # First Section
268+ /path/to/owned @Foo
269+ /path/to/not/owned @Bar
269270
270- # Last Section
271- /another/owned/path @Foo
272- "# ;
271+ # Last Section
272+ /another/owned/path @Foo
273+ " } ;
273274
274275 let team_ownership = parse_for_team ( "@Foo" . to_string ( ) , codeownership_file) ?;
275276 vecs_match (
@@ -290,11 +291,11 @@ mod tests {
290291
291292 #[ test]
292293 fn test_parse_for_team_with_partial_team_match ( ) -> Result < ( ) , Box < dyn Error > > {
293- let codeownership_file = r# "
294- # First Section
295- /path/to/owned @Foo
296- /path/to/not/owned @FooBar
297- "# ;
294+ let codeownership_file = indoc ! { "
295+ # First Section
296+ /path/to/owned @Foo
297+ /path/to/not/owned @FooBar
298+ " } ;
298299
299300 let team_ownership = parse_for_team ( "@Foo" . to_string ( ) , codeownership_file) ?;
300301 vecs_match (
@@ -309,16 +310,16 @@ mod tests {
309310
310311 #[ test]
311312 fn test_parse_for_team_with_trailing_newlines ( ) -> Result < ( ) , Box < dyn Error > > {
312- let codeownership_file = r# "
313- # First Section
314- /path/to/owned @Foo
313+ let codeownership_file = indoc ! { "
314+ # First Section
315+ /path/to/owned @Foo
315316
316- # Last Section
317- /another/owned/path @Foo
317+ # Last Section
318+ /another/owned/path @Foo
318319
319320
320321
321- "# ;
322+ " } ;
322323
323324 let team_ownership = parse_for_team ( "@Foo" . to_string ( ) , codeownership_file) ?;
324325 vecs_match (
@@ -339,9 +340,9 @@ mod tests {
339340
340341 #[ test]
341342 fn test_parse_for_team_without_trailing_newline ( ) -> Result < ( ) , Box < dyn Error > > {
342- let codeownership_file = r# "
343- # First Section
344- /path/to/owned @Foo"# ;
343+ let codeownership_file = indoc ! { "
344+ # First Section
345+ /path/to/owned @Foo"} ;
345346
346347 let team_ownership = parse_for_team ( "@Foo" . to_string ( ) , codeownership_file) ?;
347348 vecs_match (
@@ -356,12 +357,12 @@ mod tests {
356357
357358 #[ test]
358359 fn test_parse_for_team_with_missing_section_header ( ) -> Result < ( ) , Box < dyn Error > > {
359- let codeownership_file = r# "
360- # First Section
361- /path/to/owned @Foo
360+ let codeownership_file = indoc ! { "
361+ # First Section
362+ /path/to/owned @Foo
362363
363- /another/owned/path @Foo
364- "# ;
364+ /another/owned/path @Foo
365+ " } ;
365366
366367 let team_ownership = parse_for_team ( "@Foo" . to_string ( ) , codeownership_file) ;
367368 assert ! ( team_ownership
@@ -371,10 +372,10 @@ mod tests {
371372
372373 #[ test]
373374 fn test_parse_for_team_with_malformed_team_line ( ) -> Result < ( ) , Box < dyn Error > > {
374- let codeownership_file = r# "
375- # First Section
376- @Foo
377- "# ;
375+ let codeownership_file = indoc ! { "
376+ # First Section
377+ @Foo
378+ " } ;
378379
379380 let team_ownership = parse_for_team ( "@Foo" . to_string ( ) , codeownership_file) ;
380381 assert ! ( team_ownership
@@ -384,11 +385,11 @@ mod tests {
384385
385386 #[ test]
386387 fn test_parse_for_team_with_invalid_file ( ) -> Result < ( ) , Box < dyn Error > > {
387- let codeownership_file = r# "
388- # First Section
389- # Second Section
390- path/to/owned @Foo
391- "# ;
388+ let codeownership_file = indoc ! { "
389+ # First Section
390+ # Second Section
391+ path/to/owned @Foo
392+ " } ;
392393 let team_ownership = parse_for_team ( "@Foo" . to_string ( ) , codeownership_file) ?;
393394 vecs_match (
394395 & team_ownership,
0 commit comments